Compare commits

..

5 Commits

Author SHA1 Message Date
Kujtim Hoxha aedf9960f5 change additions/removals
release / goreleaser (push) Has been cancelled
2025-04-24 13:13:45 +02:00
Kujtim Hoxha cc514da850 small fixes
release / goreleaser (push) Has been cancelled
2025-04-24 13:01:32 +02:00
Kujtim Hoxha 263bea8051 update mainter email
release / goreleaser (push) Has been cancelled
2025-04-23 12:26:50 +02:00
Kujtim Hoxha 332243d4c8 small changes 2025-04-23 12:15:23 +02:00
Kujtim Hoxha 4d9082c1d4 remove edit/normal mode 2025-04-23 12:09:47 +02:00
279 changed files with 32406 additions and 32728 deletions
+1 -1
View File
@@ -4,7 +4,7 @@ on:
workflow_dispatch:
push:
branches:
- dev
- main
concurrency: ${{ github.workflow }}-${{ github.ref }}
-25
View File
@@ -1,25 +0,0 @@
name: deploy
on:
push:
branches:
- dontlook
workflow_dispatch:
concurrency: ${{ github.workflow }}-${{ github.ref }}
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: oven-sh/setup-bun@v1
with:
bun-version: latest
- run: bun install
- run: bun sst deploy --stage=dev
env:
CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }}
+1 -1
View File
@@ -36,5 +36,5 @@ jobs:
version: latest
args: release --clean
env:
GITHUB_TOKEN: ${{ secrets.SST_GITHUB_TOKEN }}
GITHUB_TOKEN: ${{ secrets.HOMEBREW_GITHUB_TOKEN }}
AUR_KEY: ${{ secrets.AUR_KEY }}
+44 -4
View File
@@ -1,5 +1,45 @@
node_modules
.opencode
.sst
app.log
# Binaries for programs and plugins
*.exe
*.exe~
*.dll
*.so
*.dylib
# Test binary, built with `go test -c`
*.test
# Output of the go coverage tool, specifically when used with LiteIDE
*.out
# Dependency directories (remove the comment below to include it)
# vendor/
# Go workspace file
go.work
# IDE specific files
.idea/
.vscode/
*.swp
*.swo
# OS specific files
.DS_Store
.DS_Store?
._*
.Spotlight-V100
.Trashes
ehthumbs.db
Thumbs.db
*.log
# Binary output directory
/bin/
/dist/
# Local environment variables
.env
.env.local
.opencode/
@@ -4,19 +4,14 @@ before:
hooks:
builds:
- env:
- CGO_ENABLED=0
goos:
- linux
- darwin
goarch:
- amd64
- arm64
ldflags:
- -s -w -X github.com/sst/opencode/internal/version.Version={{.Version}}
main: ./main.go
archives:
- format: tar.gz
# this name template makes the OS and Arch compatible with the results of uname.
name_template: >-
opencode-
{{- if eq .Os "darwin" }}mac-
@@ -26,6 +21,7 @@ archives:
{{- else if eq .Arch "#86" }}i386
{{- else }}{{ .Arch }}{{ end }}
{{- if .Arm }}v{{ .Arm }}{{ end }}
# use zip for windows archives
format_overrides:
- goos: windows
format: zip
@@ -35,11 +31,10 @@ snapshot:
name_template: "0.0.0-{{ .Timestamp }}"
aurs:
- name: opencode
homepage: "https://github.com/sst/opencode"
homepage: "https://github.com/opencode-ai/opencode"
description: "terminal based agent that can build anything"
maintainers:
- "dax"
- "adam"
- "kujtimiihoxha <kujtimii.h@gmail.com>"
license: "MIT"
private_key: "{{ .Env.AUR_KEY }}"
git_url: "ssh://aur@aur.archlinux.org/opencode-bin.git"
@@ -51,7 +46,7 @@ aurs:
install -Dm755 ./opencode "${pkgdir}/usr/bin/opencode"
brews:
- repository:
owner: sst
owner: opencode-ai
name: homebrew-tap
nfpms:
- maintainer: kujtimiihoxha
+8
View File
@@ -0,0 +1,8 @@
{
"$schema": "./opencode-schema.json",
"lsp": {
"gopls": {
"command": "gopls"
}
}
}
+1 -1
View File
@@ -1,6 +1,6 @@
MIT License
Copyright (c) 2025 OpenCode
Copyright (c) 2025 Kujtim Hoxha
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
+27 -378
View File
@@ -1,6 +1,4 @@
# OpenCode
![OpenCode Terminal UI](screenshot.png)
# OpenCode
> **⚠️ Early Development Notice:** This project is in early development and is not yet ready for production use. Features may change, break, or be incomplete. Use at your own risk.
@@ -13,7 +11,7 @@ OpenCode is a Go-based CLI application that brings AI assistance to your termina
## Features
- **Interactive TUI**: Built with [Bubble Tea](https://github.com/charmbracelet/bubbletea) for a smooth terminal experience
- **Multiple AI Providers**: Support for OpenAI, Anthropic Claude, Google Gemini, AWS Bedrock, Groq, Azure OpenAI, and OpenRouter
- **Multiple AI Providers**: Support for OpenAI, Anthropic Claude, Google Gemini, AWS Bedrock, and Groq
- **Session Management**: Save and manage multiple conversation sessions
- **Tool Integration**: AI can execute commands, search files, and modify code
- **Vim-like Editor**: Integrated editor with text input capabilities
@@ -21,40 +19,12 @@ OpenCode is a Go-based CLI application that brings AI assistance to your termina
- **LSP Integration**: Language Server Protocol support for code intelligence
- **File Change Tracking**: Track and visualize file changes during sessions
- **External Editor Support**: Open your preferred editor for composing messages
- **Named Arguments for Custom Commands**: Create powerful custom commands with multiple named placeholders
## Installation
### Using the Install Script
```bash
# Install the latest version
curl -fsSL https://opencode.ai/install | bash
# Install a specific version
curl -fsSL https://opencode.ai/install | VERSION=0.1.0 bash
```
### Using Homebrew (macOS and Linux)
```bash
brew install sst/tap/opencode
```
### Using AUR (Arch Linux)
```bash
# Using yay
yay -S opencode-bin
# Using paru
paru -S opencode-bin
```
### Using Go
```bash
go install github.com/sst/opencode@latest
# Coming soon
go install github.com/kujtimiihoxha/opencode@latest
```
## Configuration
@@ -69,20 +39,15 @@ OpenCode looks for configuration in the following locations:
You can configure OpenCode using environment variables:
| Environment Variable | Purpose |
| -------------------------- | ------------------------------------------------------ |
| `ANTHROPIC_API_KEY` | For Claude models |
| `OPENAI_API_KEY` | For OpenAI models |
| `GEMINI_API_KEY` | For Google Gemini models |
| `VERTEXAI_PROJECT` | For Google Cloud VertexAI (Gemini) |
| `VERTEXAI_LOCATION` | For Google Cloud VertexAI (Gemini) |
| `GROQ_API_KEY` | For Groq models |
| `AWS_ACCESS_KEY_ID` | For AWS Bedrock (Claude) |
| `AWS_SECRET_ACCESS_KEY` | For AWS Bedrock (Claude) |
| `AWS_REGION` | For AWS Bedrock (Claude) |
| `AZURE_OPENAI_ENDPOINT` | For Azure OpenAI models |
| `AZURE_OPENAI_API_KEY` | For Azure OpenAI models (optional when using Entra ID) |
| `AZURE_OPENAI_API_VERSION` | For Azure OpenAI models |
| Environment Variable | Purpose |
| ----------------------- | ------------------------ |
| `ANTHROPIC_API_KEY` | For Claude models |
| `OPENAI_API_KEY` | For OpenAI models |
| `GEMINI_API_KEY` | For Google Gemini models |
| `GROQ_API_KEY` | For Groq models |
| `AWS_ACCESS_KEY_ID` | For AWS Bedrock (Claude) |
| `AWS_SECRET_ACCESS_KEY` | For AWS Bedrock (Claude) |
| `AWS_REGION` | For AWS Bedrock (Claude) |
### Configuration File Structure
@@ -99,18 +64,10 @@ You can configure OpenCode using environment variables:
"anthropic": {
"apiKey": "your-api-key",
"disabled": false
},
"groq": {
"apiKey": "your-api-key",
"disabled": false
},
"openrouter": {
"apiKey": "your-api-key",
"disabled": false
}
},
"agents": {
"primary": {
"coder": {
"model": "claude-3.7-sonnet",
"maxTokens": 5000
},
@@ -137,10 +94,6 @@ You can configure OpenCode using environment variables:
"command": "gopls"
}
},
"shell": {
"path": "/bin/zsh",
"args": ["-l"]
},
"debug": false,
"debugLSP": false
}
@@ -178,60 +131,7 @@ OpenCode supports a variety of AI models from different providers:
- Claude 3.7 Sonnet
### Groq
- Llama 4 Maverick (17b-128e-instruct)
- Llama 4 Scout (17b-16e-instruct)
- QWEN QWQ-32b
- Deepseek R1 distill Llama 70b
- Llama 3.3 70b Versatile
### Azure OpenAI
- GPT-4.1 family (gpt-4.1, gpt-4.1-mini, gpt-4.1-nano)
- GPT-4.5 Preview
- GPT-4o family (gpt-4o, gpt-4o-mini)
- O1 family (o1, o1-mini)
- O3 family (o3, o3-mini)
- O4 Mini
### Google Cloud VertexAI
- Gemini 2.5
- Gemini 2.5 Flash
## Using Bedrock Models
To use bedrock models with OpenCode you need three things.
1. Valid AWS credentials (the env vars: `AWS_SECRET_KEY_ID`, `AWS_SECRET_ACCESS_KEY` and `AWS_REGION`)
2. Access to the corresponding model in AWS Bedrock in your region.
a. You can request access in the AWS console on the Bedrock -> "Model access" page.
3. A correct configuration file. You don't need the `providers` key. Instead you have to prefix your models per agent with `bedrock.` and then a valid model. For now only Claude 3.7 is supported.
```json
{
"agents": {
"primary": {
"model": "bedrock.claude-3.7-sonnet",
"maxTokens": 5000,
"reasoningEffort": ""
},
"task": {
"model": "bedrock.claude-3.7-sonnet",
"maxTokens": 5000,
"reasoningEffort": ""
},
"title": {
"model": "bedrock.claude-3.7-sonnet",
"maxTokens": 80,
"reasoningEffort": ""
}
}
}
```
## Interactive Mode Usage
## Usage
```bash
# Start OpenCode
@@ -244,78 +144,13 @@ opencode -d
opencode -c /path/to/project
```
## Non-interactive Prompt Mode
You can run OpenCode in non-interactive mode by passing a prompt directly as a command-line argument or by piping text into the command. This is useful for scripting, automation, or when you want a quick answer without launching the full TUI.
```bash
# Run a single prompt and print the AI's response to the terminal
opencode -p "Explain the use of context in Go"
# Pipe input to OpenCode (equivalent to using -p flag)
echo "Explain the use of context in Go" | opencode
# Get response in JSON format
opencode -p "Explain the use of context in Go" -f json
# Or with piped input
echo "Explain the use of context in Go" | opencode -f json
# Run without showing the spinner
opencode -p "Explain the use of context in Go" -q
# Or with piped input
echo "Explain the use of context in Go" | opencode -q
# Enable verbose logging to stderr
opencode -p "Explain the use of context in Go" --verbose
# Or with piped input
echo "Explain the use of context in Go" | opencode --verbose
# Restrict the agent to only use specific tools
opencode -p "Explain the use of context in Go" --allowedTools=view,ls,glob
# Or with piped input
echo "Explain the use of context in Go" | opencode --allowedTools=view,ls,glob
# Prevent the agent from using specific tools
opencode -p "Explain the use of context in Go" --excludedTools=bash,edit
# Or with piped input
echo "Explain the use of context in Go" | opencode --excludedTools=bash,edit
```
In this mode, OpenCode will process your prompt, print the result to standard output, and then exit. All permissions are auto-approved for the session.
### Tool Restrictions
You can control which tools the AI assistant has access to in non-interactive mode:
- `--allowedTools`: Comma-separated list of tools that the agent is allowed to use. Only these tools will be available.
- `--excludedTools`: Comma-separated list of tools that the agent is not allowed to use. All other tools will be available.
These flags are mutually exclusive - you can use either `--allowedTools` or `--excludedTools`, but not both at the same time.
### Output Formats
OpenCode supports the following output formats in non-interactive mode:
| Format | Description |
| ------ | ------------------------------- |
| `text` | Plain text output (default) |
| `json` | Output wrapped in a JSON object |
The output format is implemented as a strongly-typed `OutputFormat` in the codebase, ensuring type safety and validation when processing outputs.
## Command-line Flags
| Flag | Short | Description |
| ----------------- | ----- | --------------------------------------------------- |
| `--help` | `-h` | Display help information |
| `--debug` | `-d` | Enable debug mode |
| `--cwd` | `-c` | Set current working directory |
| `--prompt` | `-p` | Run a single prompt in non-interactive mode |
| `--output-format` | `-f` | Output format for non-interactive mode (text, json) |
| `--quiet` | `-q` | Hide spinner in non-interactive mode |
| `--verbose` | | Display logs to stderr in non-interactive mode |
| `--allowedTools` | | Restrict the agent to only use specified tools |
| `--excludedTools` | | Prevent the agent from using specified tools |
| Flag | Short | Description |
| --------- | ----- | ----------------------------- |
| `--help` | `-h` | Display help information |
| `--debug` | `-d` | Enable debug mode |
| `--cwd` | `-c` | Set current working directory |
## Keyboard Shortcuts
@@ -329,7 +164,6 @@ The output format is implemented as a strongly-typed `OutputFormat` in the codeb
| `Ctrl+L` | View logs |
| `Ctrl+A` | Switch session |
| `Ctrl+K` | Command dialog |
| `Ctrl+O` | Toggle model selection dialog |
| `Esc` | Close current overlay/dialog or return to previous mode |
### Chat Page Shortcuts
@@ -359,16 +193,6 @@ The output format is implemented as a strongly-typed `OutputFormat` in the codeb
| `Enter` | Select session |
| `Esc` | Close dialog |
### Model Dialog Shortcuts
| Shortcut | Action |
| ---------- | ----------------- |
| `↑` or `k` | Move up |
| `↓` or `j` | Move down |
| `←` or `h` | Previous provider |
| `→` or `l` | Next provider |
| `Esc` | Close dialog |
### Permission Dialog Shortcuts
| Shortcut | Action |
@@ -405,111 +229,12 @@ OpenCode's AI assistant has access to various tools to help with coding tasks:
### Other Tools
| Tool | Description | Parameters |
| ------- | ------------------------------- | ----------------------------------------------------------- |
| `bash` | Execute shell commands | `command` (required), `timeout` (optional) |
| `fetch` | Fetch data from URLs | `url` (required), `format` (required), `timeout` (optional) |
| `agent` | Run sub-tasks with the AI agent | `prompt` (required) |
## Theming
OpenCode supports multiple themes for customizing the appearance of the terminal interface.
### Available Themes
The following predefined themes are available:
- `opencode` (default)
- `catppuccin`
- `dracula`
- `flexoki`
- `gruvbox`
- `monokai`
- `onedark`
- `tokyonight`
- `tron`
- `custom` (user-defined)
### Setting a Theme
You can set a theme in your `.opencode.json` configuration file:
```json
{
"tui": {
"theme": "monokai"
}
}
```
### Custom Themes
You can define your own custom theme by setting the `theme` to `"custom"` and providing color definitions in the `customTheme` map:
```json
{
"tui": {
"theme": "custom",
"customTheme": {
"primary": "#ffcc00",
"secondary": "#00ccff",
"accent": { "dark": "#aa00ff", "light": "#ddccff" },
"error": "#ff0000"
}
}
}
```
#### Color Definition Formats
Custom theme colors support two formats:
1. **Simple Hex String**: A single hex color string (e.g., `"#aabbcc"`) that will be used for both light and dark terminal backgrounds.
2. **Adaptive Object**: An object with `dark` and `light` keys, each holding a hex color string. This allows for adaptive colors based on the terminal's background.
#### Available Color Keys
You can define any of the following color keys in your `customTheme`:
- Base colors: `primary`, `secondary`, `accent`
- Status colors: `error`, `warning`, `success`, `info`
- Text colors: `text`, `textMuted`, `textEmphasized`
- Background colors: `background`, `backgroundSecondary`, `backgroundDarker`
- Border colors: `borderNormal`, `borderFocused`, `borderDim`
- Diff view colors: `diffAdded`, `diffRemoved`, `diffContext`, etc.
You don't need to define all colors. Any undefined colors will fall back to the default "opencode" theme colors.
### Shell Configuration
OpenCode allows you to configure the shell used by the `bash` tool. By default, it uses:
1. The shell specified in the config file (if provided)
2. The shell from the `$SHELL` environment variable (if available)
3. Falls back to `/bin/bash` if neither of the above is available
To configure a custom shell, add a `shell` section to your `.opencode.json` configuration file:
```json
{
"shell": {
"path": "/bin/zsh",
"args": ["-l"]
}
}
```
You can specify any shell executable and custom arguments:
```json
{
"shell": {
"path": "/usr/bin/fish",
"args": []
}
}
```
| Tool | Description | Parameters |
| ------------- | -------------------------------------- | ----------------------------------------------------------------------------------------- |
| `bash` | Execute shell commands | `command` (required), `timeout` (optional) |
| `fetch` | Fetch data from URLs | `url` (required), `format` (required), `timeout` (optional) |
| `sourcegraph` | Search code across public repositories | `query` (required), `count` (optional), `context_window` (optional), `timeout` (optional) |
| `agent` | Run sub-tasks with the AI agent | `prompt` (required) |
## Architecture
@@ -526,82 +251,6 @@ OpenCode is built with a modular architecture:
- **internal/session**: Session management
- **internal/lsp**: Language Server Protocol integration
## Custom Commands
OpenCode supports custom commands that can be created by users to quickly send predefined prompts to the AI assistant.
### Creating Custom Commands
Custom commands are predefined prompts stored as Markdown files in one of three locations:
1. **User Commands** (prefixed with `user:`):
```
$XDG_CONFIG_HOME/opencode/commands/
```
(typically `~/.config/opencode/commands/` on Linux/macOS)
or
```
$HOME/.opencode/commands/
```
2. **Project Commands** (prefixed with `project:`):
```
<PROJECT DIR>/.opencode/commands/
```
Each `.md` file in these directories becomes a custom command. The file name (without extension) becomes the command ID.
For example, creating a file at `~/.config/opencode/commands/prime-context.md` with content:
```markdown
RUN git ls-files
READ README.md
```
This creates a command called `user:prime-context`.
### Command Arguments
OpenCode supports named arguments in custom commands using placeholders in the format `$NAME` (where NAME consists of uppercase letters, numbers, and underscores, and must start with a letter).
For example:
```markdown
# Fetch Context for Issue $ISSUE_NUMBER
RUN gh issue view $ISSUE_NUMBER --json title,body,comments
RUN git grep --author="$AUTHOR_NAME" -n .
RUN grep -R "$SEARCH_PATTERN" $DIRECTORY
```
When you run a command with arguments, OpenCode will prompt you to enter values for each unique placeholder. Named arguments provide several benefits:
- Clear identification of what each argument represents
- Ability to use the same argument multiple times
- Better organization for commands with multiple inputs
### Organizing Commands
You can organize commands in subdirectories:
```
~/.config/opencode/commands/git/commit.md
```
This creates a command with ID `user:git:commit`.
### Using Custom Commands
1. Press `Ctrl+K` to open the command dialog
2. Select your custom command (prefixed with either `user:` or `project:`)
3. Press Enter to execute the command
The content of the command file will be sent as a message to the AI assistant.
## MCP (Model Context Protocol)
OpenCode implements the Model Context Protocol (MCP) to extend its capabilities through external tools. MCP provides a standardized way for the AI assistant to interact with external services and tools.
@@ -692,7 +341,7 @@ While the LSP client implementation supports the full LSP protocol (including co
```bash
# Clone the repository
git clone https://github.com/sst/opencode.git
git clone https://github.com/kujtimiihoxha/opencode.git
cd opencode
# Build
-1610
View File
@@ -1,1610 +0,0 @@
{
"lockfileVersion": 1,
"workspaces": {
"": {
"name": "opencode",
"devDependencies": {
"prettier": "3.5.3",
"sst": "3.16.0",
},
},
"packages/function": {
"name": "@opencode/function",
"version": "0.0.1",
"devDependencies": {
"@cloudflare/workers-types": "4.20250522.0",
"@types/node": "catalog:",
"typescript": "catalog:",
},
},
"packages/opencode": {
"name": "opencode",
"version": "0.0.0",
"dependencies": {
"@flystorage/file-storage": "1.1.0",
"@flystorage/local-fs": "1.1.0",
"@hono/zod-validator": "0.5.0",
"@standard-schema/spec": "1.0.0",
"ai": "catalog:",
"cac": "6.7.14",
"decimal.js": "10.5.0",
"diff": "8.0.2",
"env-paths": "3.0.0",
"hono": "4.7.10",
"hono-openapi": "0.4.8",
"remeda": "2.22.3",
"ts-lsp-client": "1.0.3",
"turndown": "7.2.0",
"vscode-jsonrpc": "8.2.1",
"vscode-languageclient": "8",
"zod": "catalog:",
"zod-openapi": "4.2.4",
},
"devDependencies": {
"@tsconfig/bun": "1.0.7",
"@types/bun": "latest",
"@types/turndown": "5.0.5",
"typescript": "catalog:",
},
},
"packages/web": {
"name": "@opencode/web",
"version": "0.0.1",
"dependencies": {
"@astrojs/markdown-remark": "6.3.1",
"@astrojs/solid-js": "5.1.0",
"@astrojs/starlight": "0.34.3",
"@fontsource/ibm-plex-mono": "5.2.5",
"@shikijs/transformers": "3.4.2",
"@types/luxon": "3.6.2",
"ai": "catalog:",
"astro": "5.7.13",
"diff": "8.0.2",
"luxon": "3.6.1",
"rehype-autolink-headings": "7.1.0",
"sharp": "0.32.5",
"shiki": "3.4.2",
"solid-js": "1.9.7",
"toolbeam-docs-theme": "0.2.4",
},
"devDependencies": {
"@types/node": "catalog:",
"typescript": "catalog:",
},
},
},
"trustedDependencies": [
"sharp",
"esbuild",
],
"overrides": {
"zod": "3.24.2",
},
"catalog": {
"@types/node": "22.13.9",
"ai": "5.0.0-alpha.7",
"typescript": "5.8.2",
"zod": "3.24.2",
},
"packages": {
"@ai-sdk/gateway": ["@ai-sdk/gateway@1.0.0-alpha.7", "", { "dependencies": { "@ai-sdk/provider": "2.0.0-alpha.7", "@ai-sdk/provider-utils": "3.0.0-alpha.7" }, "peerDependencies": { "zod": "^3.24.0" } }, "sha512-gz1V165eiJnQIexfLyKm11vimrmQ3zdcJhPpjeLFmDU9wrvZwLuklfZ0WgfYSb+EjiP1cKypwt6JSGvWkfKIAQ=="],
"@ai-sdk/provider": ["@ai-sdk/provider@2.0.0-alpha.7", "", { "dependencies": { "json-schema": "^0.4.0" } }, "sha512-lhdrARU3SSmt5p/GNNK7VhazvZpKSCIOjpHUfX7f5jIhVGi/vvlxP1rD6Go57nn1MtuGKNqL04AebSRFDQsQbw=="],
"@ai-sdk/provider-utils": ["@ai-sdk/provider-utils@3.0.0-alpha.7", "", { "dependencies": { "@ai-sdk/provider": "2.0.0-alpha.7", "@standard-schema/spec": "^1.0.0", "zod-to-json-schema": "^3.24.1" }, "peerDependencies": { "zod": "^3.23.8" } }, "sha512-AYkT3jskmo7Lwzijo/yHKD1jC+UZizsROO8ULTg9aJZUwR4ABZzAxh4NxDIEy4TWRfBGufp+/9ICHAn6pkU71w=="],
"@ampproject/remapping": ["@ampproject/remapping@2.3.0", "", { "dependencies": { "@jridgewell/gen-mapping": "^0.3.5", "@jridgewell/trace-mapping": "^0.3.24" } }, "sha512-30iZtAPgz+LTIYoeivqYo853f02jBYSd5uGnGpkFV0M3xOt9aN73erkgYAmZU43x4VfqcnLxW9Kpg3R5LC4YYw=="],
"@apidevtools/json-schema-ref-parser": ["@apidevtools/json-schema-ref-parser@11.9.3", "", { "dependencies": { "@jsdevtools/ono": "^7.1.3", "@types/json-schema": "^7.0.15", "js-yaml": "^4.1.0" } }, "sha512-60vepv88RwcJtSHrD6MjIL6Ta3SOYbgfnkHb+ppAVK+o9mXprRtulx7VlRl3lN3bbvysAfCS7WMVfhUYemB0IQ=="],
"@astrojs/compiler": ["@astrojs/compiler@2.12.0", "", {}, "sha512-7bCjW6tVDpUurQLeKBUN9tZ5kSv5qYrGmcn0sG0IwacL7isR2ZbyyA3AdZ4uxsuUFOS2SlgReTH7wkxO6zpqWA=="],
"@astrojs/internal-helpers": ["@astrojs/internal-helpers@0.6.1", "", {}, "sha512-l5Pqf6uZu31aG+3Lv8nl/3s4DbUzdlxTWDof4pEpto6GUJNhhCbelVi9dEyurOVyqaelwmS9oSyOWOENSfgo9A=="],
"@astrojs/markdown-remark": ["@astrojs/markdown-remark@6.3.1", "", { "dependencies": { "@astrojs/internal-helpers": "0.6.1", "@astrojs/prism": "3.2.0", "github-slugger": "^2.0.0", "hast-util-from-html": "^2.0.3", "hast-util-to-text": "^4.0.2", "import-meta-resolve": "^4.1.0", "js-yaml": "^4.1.0", "mdast-util-definitions": "^6.0.0", "rehype-raw": "^7.0.0", "rehype-stringify": "^10.0.1", "remark-gfm": "^4.0.1", "remark-parse": "^11.0.0", "remark-rehype": "^11.1.1", "remark-smartypants": "^3.0.2", "shiki": "^3.0.0", "smol-toml": "^1.3.1", "unified": "^11.0.5", "unist-util-remove-position": "^5.0.0", "unist-util-visit": "^5.0.0", "unist-util-visit-parents": "^6.0.1", "vfile": "^6.0.3" } }, "sha512-c5F5gGrkczUaTVgmMW9g1YMJGzOtRvjjhw6IfGuxarM6ct09MpwysP10US729dy07gg8y+ofVifezvP3BNsWZg=="],
"@astrojs/mdx": ["@astrojs/mdx@4.3.0", "", { "dependencies": { "@astrojs/markdown-remark": "6.3.2", "@mdx-js/mdx": "^3.1.0", "acorn": "^8.14.1", "es-module-lexer": "^1.6.0", "estree-util-visit": "^2.0.0", "hast-util-to-html": "^9.0.5", "kleur": "^4.1.5", "rehype-raw": "^7.0.0", "remark-gfm": "^4.0.1", "remark-smartypants": "^3.0.2", "source-map": "^0.7.4", "unist-util-visit": "^5.0.0", "vfile": "^6.0.3" }, "peerDependencies": { "astro": "^5.0.0" } }, "sha512-OGX2KvPeBzjSSKhkCqrUoDMyzFcjKt5nTE5SFw3RdoLf0nrhyCXBQcCyclzWy1+P+XpOamn+p+hm1EhpCRyPxw=="],
"@astrojs/prism": ["@astrojs/prism@3.2.0", "", { "dependencies": { "prismjs": "^1.29.0" } }, "sha512-GilTHKGCW6HMq7y3BUv9Ac7GMe/MO9gi9GW62GzKtth0SwukCu/qp2wLiGpEujhY+VVhaG9v7kv/5vFzvf4NYw=="],
"@astrojs/sitemap": ["@astrojs/sitemap@3.4.0", "", { "dependencies": { "sitemap": "^8.0.0", "stream-replace-string": "^2.0.0", "zod": "^3.24.2" } }, "sha512-C5m/xsKvRSILKM3hy47n5wKtTQtJXn8epoYuUmCCstaE9XBt20yInym3Bz2uNbEiNfv11bokoW0MqeXPIvjFIQ=="],
"@astrojs/solid-js": ["@astrojs/solid-js@5.1.0", "", { "dependencies": { "vite": "^6.3.5", "vite-plugin-solid": "^2.11.6" }, "peerDependencies": { "solid-devtools": "^0.30.1", "solid-js": "^1.8.5" }, "optionalPeers": ["solid-devtools"] }, "sha512-VmPHOU9k7m6HHCT2Y1mNzifilUnttlowBM36frGcfj5wERJE9Ci0QtWJbzdf6AlcoIirb7xVw+ByupU011Di9w=="],
"@astrojs/starlight": ["@astrojs/starlight@0.34.3", "", { "dependencies": { "@astrojs/markdown-remark": "^6.3.1", "@astrojs/mdx": "^4.2.3", "@astrojs/sitemap": "^3.3.0", "@pagefind/default-ui": "^1.3.0", "@types/hast": "^3.0.4", "@types/js-yaml": "^4.0.9", "@types/mdast": "^4.0.4", "astro-expressive-code": "^0.41.1", "bcp-47": "^2.1.0", "hast-util-from-html": "^2.0.1", "hast-util-select": "^6.0.2", "hast-util-to-string": "^3.0.0", "hastscript": "^9.0.0", "i18next": "^23.11.5", "js-yaml": "^4.1.0", "klona": "^2.0.6", "mdast-util-directive": "^3.0.0", "mdast-util-to-markdown": "^2.1.0", "mdast-util-to-string": "^4.0.0", "pagefind": "^1.3.0", "rehype": "^13.0.1", "rehype-format": "^5.0.0", "remark-directive": "^3.0.0", "ultrahtml": "^1.6.0", "unified": "^11.0.5", "unist-util-visit": "^5.0.0", "vfile": "^6.0.2" }, "peerDependencies": { "astro": "^5.5.0" } }, "sha512-MAuD3NF+E+QXJJuVKofoR6xcPTP4BJmYWeOBd03udVdubNGVnPnSWVZAi+ZtnTofES4+mJdp8BNGf+ubUxkiiA=="],
"@astrojs/telemetry": ["@astrojs/telemetry@3.2.1", "", { "dependencies": { "ci-info": "^4.2.0", "debug": "^4.4.0", "dlv": "^1.1.3", "dset": "^3.1.4", "is-docker": "^3.0.0", "is-wsl": "^3.1.0", "which-pm-runs": "^1.1.0" } }, "sha512-SSVM820Jqc6wjsn7qYfV9qfeQvePtVc1nSofhyap7l0/iakUKywj3hfy3UJAOV4sGV4Q/u450RD4AaCaFvNPlg=="],
"@babel/code-frame": ["@babel/code-frame@7.27.1", "", { "dependencies": { "@babel/helper-validator-identifier": "^7.27.1", "js-tokens": "^4.0.0", "picocolors": "^1.1.1" } }, "sha512-cjQ7ZlQ0Mv3b47hABuTevyTuYN4i+loJKGeV9flcCgIK37cCXRh+L1bd3iBHlynerhQ7BhCkn2BPbQUL+rGqFg=="],
"@babel/compat-data": ["@babel/compat-data@7.27.3", "", {}, "sha512-V42wFfx1ymFte+ecf6iXghnnP8kWTO+ZLXIyZq+1LAXHHvTZdVxicn4yiVYdYMGaCO3tmqub11AorKkv+iodqw=="],
"@babel/core": ["@babel/core@7.27.4", "", { "dependencies": { "@ampproject/remapping": "^2.2.0", "@babel/code-frame": "^7.27.1", "@babel/generator": "^7.27.3", "@babel/helper-compilation-targets": "^7.27.2", "@babel/helper-module-transforms": "^7.27.3", "@babel/helpers": "^7.27.4", "@babel/parser": "^7.27.4", "@babel/template": "^7.27.2", "@babel/traverse": "^7.27.4", "@babel/types": "^7.27.3", "convert-source-map": "^2.0.0", "debug": "^4.1.0", "gensync": "^1.0.0-beta.2", "json5": "^2.2.3", "semver": "^6.3.1" } }, "sha512-bXYxrXFubeYdvB0NhD/NBB3Qi6aZeV20GOWVI47t2dkecCEoneR4NPVcb7abpXDEvejgrUfFtG6vG/zxAKmg+g=="],
"@babel/generator": ["@babel/generator@7.27.3", "", { "dependencies": { "@babel/parser": "^7.27.3", "@babel/types": "^7.27.3", "@jridgewell/gen-mapping": "^0.3.5", "@jridgewell/trace-mapping": "^0.3.25", "jsesc": "^3.0.2" } }, "sha512-xnlJYj5zepml8NXtjkG0WquFUv8RskFqyFcVgTBp5k+NaA/8uw/K+OSVf8AMGw5e9HKP2ETd5xpK5MLZQD6b4Q=="],
"@babel/helper-compilation-targets": ["@babel/helper-compilation-targets@7.27.2", "", { "dependencies": { "@babel/compat-data": "^7.27.2", "@babel/helper-validator-option": "^7.27.1", "browserslist": "^4.24.0", "lru-cache": "^5.1.1", "semver": "^6.3.1" } }, "sha512-2+1thGUUWWjLTYTHZWK1n8Yga0ijBz1XAhUXcKy81rd5g6yh7hGqMp45v7cadSbEHc9G3OTv45SyneRN3ps4DQ=="],
"@babel/helper-module-imports": ["@babel/helper-module-imports@7.27.1", "", { "dependencies": { "@babel/traverse": "^7.27.1", "@babel/types": "^7.27.1" } }, "sha512-0gSFWUPNXNopqtIPQvlD5WgXYI5GY2kP2cCvoT8kczjbfcfuIljTbcWrulD1CIPIX2gt1wghbDy08yE1p+/r3w=="],
"@babel/helper-module-transforms": ["@babel/helper-module-transforms@7.27.3", "", { "dependencies": { "@babel/helper-module-imports": "^7.27.1", "@babel/helper-validator-identifier": "^7.27.1", "@babel/traverse": "^7.27.3" }, "peerDependencies": { "@babel/core": "^7.0.0" } }, "sha512-dSOvYwvyLsWBeIRyOeHXp5vPj5l1I011r52FM1+r1jCERv+aFXYk4whgQccYEGYxK2H3ZAIA8nuPkQ0HaUo3qg=="],
"@babel/helper-plugin-utils": ["@babel/helper-plugin-utils@7.27.1", "", {}, "sha512-1gn1Up5YXka3YYAHGKpbideQ5Yjf1tDa9qYcgysz+cNCXukyLl6DjPXhD3VRwSb8c0J9tA4b2+rHEZtc6R0tlw=="],
"@babel/helper-string-parser": ["@babel/helper-string-parser@7.27.1", "", {}, "sha512-qMlSxKbpRlAridDExk92nSobyDdpPijUq2DW6oDnUqd0iOGxmQjyqhMIihI9+zv4LPyZdRje2cavWPbCbWm3eA=="],
"@babel/helper-validator-identifier": ["@babel/helper-validator-identifier@7.27.1", "", {}, "sha512-D2hP9eA+Sqx1kBZgzxZh0y1trbuU+JoDkiEwqhQ36nodYqJwyEIhPSdMNd7lOm/4io72luTPWH20Yda0xOuUow=="],
"@babel/helper-validator-option": ["@babel/helper-validator-option@7.27.1", "", {}, "sha512-YvjJow9FxbhFFKDSuFnVCe2WxXk1zWc22fFePVNEaWJEu8IrZVlda6N0uHwzZrUM1il7NC9Mlp4MaJYbYd9JSg=="],
"@babel/helpers": ["@babel/helpers@7.27.4", "", { "dependencies": { "@babel/template": "^7.27.2", "@babel/types": "^7.27.3" } }, "sha512-Y+bO6U+I7ZKaM5G5rDUZiYfUvQPUibYmAFe7EnKdnKBbVXDZxvp+MWOH5gYciY0EPk4EScsuFMQBbEfpdRKSCQ=="],
"@babel/parser": ["@babel/parser@7.27.4", "", { "dependencies": { "@babel/types": "^7.27.3" }, "bin": "./bin/babel-parser.js" }, "sha512-BRmLHGwpUqLFR2jzx9orBuX/ABDkj2jLKOXrHDTN2aOKL+jFDDKaRNo9nyYsIl9h/UE/7lMKdDjKQQyxKKDZ7g=="],
"@babel/plugin-syntax-jsx": ["@babel/plugin-syntax-jsx@7.27.1", "", { "dependencies": { "@babel/helper-plugin-utils": "^7.27.1" }, "peerDependencies": { "@babel/core": "^7.0.0-0" } }, "sha512-y8YTNIeKoyhGd9O0Jiyzyyqk8gdjnumGTQPsz0xOZOQ2RmkVJeZ1vmmfIvFEKqucBG6axJGBZDE/7iI5suUI/w=="],
"@babel/runtime": ["@babel/runtime@7.27.4", "", {}, "sha512-t3yaEOuGu9NlIZ+hIeGbBjFtZT7j2cb2tg0fuaJKeGotchRjjLfrBA9Kwf8quhpP1EUuxModQg04q/mBwyg8uA=="],
"@babel/template": ["@babel/template@7.27.2", "", { "dependencies": { "@babel/code-frame": "^7.27.1", "@babel/parser": "^7.27.2", "@babel/types": "^7.27.1" } }, "sha512-LPDZ85aEJyYSd18/DkjNh4/y1ntkE5KwUHWTiqgRxruuZL2F1yuHligVHLvcHY2vMHXttKFpJn6LwfI7cw7ODw=="],
"@babel/traverse": ["@babel/traverse@7.27.4", "", { "dependencies": { "@babel/code-frame": "^7.27.1", "@babel/generator": "^7.27.3", "@babel/parser": "^7.27.4", "@babel/template": "^7.27.2", "@babel/types": "^7.27.3", "debug": "^4.3.1", "globals": "^11.1.0" } }, "sha512-oNcu2QbHqts9BtOWJosOVJapWjBDSxGCpFvikNR5TGDYDQf3JwpIoMzIKrvfoti93cLfPJEG4tH9SPVeyCGgdA=="],
"@babel/types": ["@babel/types@7.27.3", "", { "dependencies": { "@babel/helper-string-parser": "^7.27.1", "@babel/helper-validator-identifier": "^7.27.1" } }, "sha512-Y1GkI4ktrtvmawoSq+4FCVHNryea6uR+qUQy0AGxLSsjCX0nVmkYQMBLHDkXZuo5hGx7eYdnIaslsdBFm7zbUw=="],
"@capsizecss/unpack": ["@capsizecss/unpack@2.4.0", "", { "dependencies": { "blob-to-buffer": "^1.2.8", "cross-fetch": "^3.0.4", "fontkit": "^2.0.2" } }, "sha512-GrSU71meACqcmIUxPYOJvGKF0yryjN/L1aCuE9DViCTJI7bfkjgYDPD1zbNDcINJwSSP6UaBZY9GAbYDO7re0Q=="],
"@cloudflare/workers-types": ["@cloudflare/workers-types@4.20250522.0", "", {}, "sha512-9RIffHobc35JWeddzBguGgPa4wLDr5x5F94+0/qy7LiV6pTBQ/M5qGEN9VA16IDT3EUpYI0WKh6VpcmeVEtVtw=="],
"@ctrl/tinycolor": ["@ctrl/tinycolor@4.1.0", "", {}, "sha512-WyOx8cJQ+FQus4Mm4uPIZA64gbk3Wxh0so5Lcii0aJifqwoVOlfFtorjLE0Hen4OYyHZMXDWqMmaQemBhgxFRQ=="],
"@emnapi/runtime": ["@emnapi/runtime@1.4.3", "", { "dependencies": { "tslib": "^2.4.0" } }, "sha512-pBPWdu6MLKROBX05wSNKcNb++m5Er+KQ9QkB+WVM+pW2Kx9hoSrVTnu3BdkI5eBLZoKu/J6mW/B6i6bJB2ytXQ=="],
"@esbuild/aix-ppc64": ["@esbuild/aix-ppc64@0.25.5", "", { "os": "aix", "cpu": "ppc64" }, "sha512-9o3TMmpmftaCMepOdA5k/yDw8SfInyzWWTjYTFCX3kPSDJMROQTb8jg+h9Cnwnmm1vOzvxN7gIfB5V2ewpjtGA=="],
"@esbuild/android-arm": ["@esbuild/android-arm@0.25.5", "", { "os": "android", "cpu": "arm" }, "sha512-AdJKSPeEHgi7/ZhuIPtcQKr5RQdo6OO2IL87JkianiMYMPbCtot9fxPbrMiBADOWWm3T2si9stAiVsGbTQFkbA=="],
"@esbuild/android-arm64": ["@esbuild/android-arm64@0.25.5", "", { "os": "android", "cpu": "arm64" }, "sha512-VGzGhj4lJO+TVGV1v8ntCZWJktV7SGCs3Pn1GRWI1SBFtRALoomm8k5E9Pmwg3HOAal2VDc2F9+PM/rEY6oIDg=="],
"@esbuild/android-x64": ["@esbuild/android-x64@0.25.5", "", { "os": "android", "cpu": "x64" }, "sha512-D2GyJT1kjvO//drbRT3Hib9XPwQeWd9vZoBJn+bu/lVsOZ13cqNdDeqIF/xQ5/VmWvMduP6AmXvylO/PIc2isw=="],
"@esbuild/darwin-arm64": ["@esbuild/darwin-arm64@0.25.5", "", { "os": "darwin", "cpu": "arm64" }, "sha512-GtaBgammVvdF7aPIgH2jxMDdivezgFu6iKpmT+48+F8Hhg5J/sfnDieg0aeG/jfSvkYQU2/pceFPDKlqZzwnfQ=="],
"@esbuild/darwin-x64": ["@esbuild/darwin-x64@0.25.5", "", { "os": "darwin", "cpu": "x64" }, "sha512-1iT4FVL0dJ76/q1wd7XDsXrSW+oLoquptvh4CLR4kITDtqi2e/xwXwdCVH8hVHU43wgJdsq7Gxuzcs6Iq/7bxQ=="],
"@esbuild/freebsd-arm64": ["@esbuild/freebsd-arm64@0.25.5", "", { "os": "freebsd", "cpu": "arm64" }, "sha512-nk4tGP3JThz4La38Uy/gzyXtpkPW8zSAmoUhK9xKKXdBCzKODMc2adkB2+8om9BDYugz+uGV7sLmpTYzvmz6Sw=="],
"@esbuild/freebsd-x64": ["@esbuild/freebsd-x64@0.25.5", "", { "os": "freebsd", "cpu": "x64" }, "sha512-PrikaNjiXdR2laW6OIjlbeuCPrPaAl0IwPIaRv+SMV8CiM8i2LqVUHFC1+8eORgWyY7yhQY+2U2fA55mBzReaw=="],
"@esbuild/linux-arm": ["@esbuild/linux-arm@0.25.5", "", { "os": "linux", "cpu": "arm" }, "sha512-cPzojwW2okgh7ZlRpcBEtsX7WBuqbLrNXqLU89GxWbNt6uIg78ET82qifUy3W6OVww6ZWobWub5oqZOVtwolfw=="],
"@esbuild/linux-arm64": ["@esbuild/linux-arm64@0.25.5", "", { "os": "linux", "cpu": "arm64" }, "sha512-Z9kfb1v6ZlGbWj8EJk9T6czVEjjq2ntSYLY2cw6pAZl4oKtfgQuS4HOq41M/BcoLPzrUbNd+R4BXFyH//nHxVg=="],
"@esbuild/linux-ia32": ["@esbuild/linux-ia32@0.25.5", "", { "os": "linux", "cpu": "ia32" }, "sha512-sQ7l00M8bSv36GLV95BVAdhJ2QsIbCuCjh/uYrWiMQSUuV+LpXwIqhgJDcvMTj+VsQmqAHL2yYaasENvJ7CDKA=="],
"@esbuild/linux-loong64": ["@esbuild/linux-loong64@0.25.5", "", { "os": "linux", "cpu": "none" }, "sha512-0ur7ae16hDUC4OL5iEnDb0tZHDxYmuQyhKhsPBV8f99f6Z9KQM02g33f93rNH5A30agMS46u2HP6qTdEt6Q1kg=="],
"@esbuild/linux-mips64el": ["@esbuild/linux-mips64el@0.25.5", "", { "os": "linux", "cpu": "none" }, "sha512-kB/66P1OsHO5zLz0i6X0RxlQ+3cu0mkxS3TKFvkb5lin6uwZ/ttOkP3Z8lfR9mJOBk14ZwZ9182SIIWFGNmqmg=="],
"@esbuild/linux-ppc64": ["@esbuild/linux-ppc64@0.25.5", "", { "os": "linux", "cpu": "ppc64" }, "sha512-UZCmJ7r9X2fe2D6jBmkLBMQetXPXIsZjQJCjgwpVDz+YMcS6oFR27alkgGv3Oqkv07bxdvw7fyB71/olceJhkQ=="],
"@esbuild/linux-riscv64": ["@esbuild/linux-riscv64@0.25.5", "", { "os": "linux", "cpu": "none" }, "sha512-kTxwu4mLyeOlsVIFPfQo+fQJAV9mh24xL+y+Bm6ej067sYANjyEw1dNHmvoqxJUCMnkBdKpvOn0Ahql6+4VyeA=="],
"@esbuild/linux-s390x": ["@esbuild/linux-s390x@0.25.5", "", { "os": "linux", "cpu": "s390x" }, "sha512-K2dSKTKfmdh78uJ3NcWFiqyRrimfdinS5ErLSn3vluHNeHVnBAFWC8a4X5N+7FgVE1EjXS1QDZbpqZBjfrqMTQ=="],
"@esbuild/linux-x64": ["@esbuild/linux-x64@0.25.5", "", { "os": "linux", "cpu": "x64" }, "sha512-uhj8N2obKTE6pSZ+aMUbqq+1nXxNjZIIjCjGLfsWvVpy7gKCOL6rsY1MhRh9zLtUtAI7vpgLMK6DxjO8Qm9lJw=="],
"@esbuild/netbsd-arm64": ["@esbuild/netbsd-arm64@0.25.5", "", { "os": "none", "cpu": "arm64" }, "sha512-pwHtMP9viAy1oHPvgxtOv+OkduK5ugofNTVDilIzBLpoWAM16r7b/mxBvfpuQDpRQFMfuVr5aLcn4yveGvBZvw=="],
"@esbuild/netbsd-x64": ["@esbuild/netbsd-x64@0.25.5", "", { "os": "none", "cpu": "x64" }, "sha512-WOb5fKrvVTRMfWFNCroYWWklbnXH0Q5rZppjq0vQIdlsQKuw6mdSihwSo4RV/YdQ5UCKKvBy7/0ZZYLBZKIbwQ=="],
"@esbuild/openbsd-arm64": ["@esbuild/openbsd-arm64@0.25.5", "", { "os": "openbsd", "cpu": "arm64" }, "sha512-7A208+uQKgTxHd0G0uqZO8UjK2R0DDb4fDmERtARjSHWxqMTye4Erz4zZafx7Di9Cv+lNHYuncAkiGFySoD+Mw=="],
"@esbuild/openbsd-x64": ["@esbuild/openbsd-x64@0.25.5", "", { "os": "openbsd", "cpu": "x64" }, "sha512-G4hE405ErTWraiZ8UiSoesH8DaCsMm0Cay4fsFWOOUcz8b8rC6uCvnagr+gnioEjWn0wC+o1/TAHt+It+MpIMg=="],
"@esbuild/sunos-x64": ["@esbuild/sunos-x64@0.25.5", "", { "os": "sunos", "cpu": "x64" }, "sha512-l+azKShMy7FxzY0Rj4RCt5VD/q8mG/e+mDivgspo+yL8zW7qEwctQ6YqKX34DTEleFAvCIUviCFX1SDZRSyMQA=="],
"@esbuild/win32-arm64": ["@esbuild/win32-arm64@0.25.5", "", { "os": "win32", "cpu": "arm64" }, "sha512-O2S7SNZzdcFG7eFKgvwUEZ2VG9D/sn/eIiz8XRZ1Q/DO5a3s76Xv0mdBzVM5j5R639lXQmPmSo0iRpHqUUrsxw=="],
"@esbuild/win32-ia32": ["@esbuild/win32-ia32@0.25.5", "", { "os": "win32", "cpu": "ia32" }, "sha512-onOJ02pqs9h1iMJ1PQphR+VZv8qBMQ77Klcsqv9CNW2w6yLqoURLcgERAIurY6QE63bbLuqgP9ATqajFLK5AMQ=="],
"@esbuild/win32-x64": ["@esbuild/win32-x64@0.25.5", "", { "os": "win32", "cpu": "x64" }, "sha512-TXv6YnJ8ZMVdX+SXWVBo/0p8LTcrUYngpWjvm91TMjjBQii7Oz11Lw5lbDV5Y0TzuhSJHwiH4hEtC1I42mMS0g=="],
"@expressive-code/core": ["@expressive-code/core@0.41.2", "", { "dependencies": { "@ctrl/tinycolor": "^4.0.4", "hast-util-select": "^6.0.2", "hast-util-to-html": "^9.0.1", "hast-util-to-text": "^4.0.1", "hastscript": "^9.0.0", "postcss": "^8.4.38", "postcss-nested": "^6.0.1", "unist-util-visit": "^5.0.0", "unist-util-visit-parents": "^6.0.1" } }, "sha512-AJW5Tp9czbLqKMzwudL9Rv4js9afXBxkSGLmCNPq1iRgAYcx9NkTPJiSNCesjKRWoVC328AdSu6fqrD22zDgDg=="],
"@expressive-code/plugin-frames": ["@expressive-code/plugin-frames@0.41.2", "", { "dependencies": { "@expressive-code/core": "^0.41.2" } }, "sha512-pfy0hkJI4nbaONjmksFDcuHmIuyPTFmi1JpABe4q2ajskiJtfBf+WDAL2pg595R9JNoPrrH5+aT9lbkx2noicw=="],
"@expressive-code/plugin-shiki": ["@expressive-code/plugin-shiki@0.41.2", "", { "dependencies": { "@expressive-code/core": "^0.41.2", "shiki": "^3.2.2" } }, "sha512-xD4zwqAkDccXqye+235BH5bN038jYiSMLfUrCOmMlzxPDGWdxJDk5z4uUB/aLfivEF2tXyO2zyaarL3Oqht0fQ=="],
"@expressive-code/plugin-text-markers": ["@expressive-code/plugin-text-markers@0.41.2", "", { "dependencies": { "@expressive-code/core": "^0.41.2" } }, "sha512-JFWBz2qYxxJOJkkWf96LpeolbnOqJY95TvwYc0hXIHf9oSWV0h0SY268w/5N3EtQaD9KktzDE+VIVwb9jdb3nw=="],
"@flystorage/dynamic-import": ["@flystorage/dynamic-import@1.0.0", "", {}, "sha512-CIbIUrBdaPFyKnkVBaqzksvzNtsMSXITR/G/6zlil3MBnPFq2LX+X4Mv5p2XOmv/3OulFs/ff2SNb+5dc2Twtg=="],
"@flystorage/file-storage": ["@flystorage/file-storage@1.1.0", "", {}, "sha512-25Gd5EsXDmhHrK5orpRuVqebQms1Cm9m5ACMZ0sVDX+Sbl1V0G88CbcWt7mEoWRYLvQ1U072htqg6Sav76ZlVA=="],
"@flystorage/local-fs": ["@flystorage/local-fs@1.1.0", "", { "dependencies": { "@flystorage/dynamic-import": "^1.0.0", "@flystorage/file-storage": "^1.1.0", "file-type": "^20.5.0", "mime-types": "^3.0.1" } }, "sha512-dbErRhqmCv2UF0zPdeH7iVWuVeTWAJHuJD/mXDe2V370/SL7XIvdE3ditBHWC+1SzBKXJ0lkykOenwlum+oqIA=="],
"@fontsource/ibm-plex-mono": ["@fontsource/ibm-plex-mono@5.2.5", "", {}, "sha512-G09N3GfuT9qj3Ax2FDZvKqZttzM3v+cco2l8uXamhKyXLdmlaUDH5o88/C3vtTHj2oT7yRKsvxz9F+BXbWKMYA=="],
"@hapi/bourne": ["@hapi/bourne@2.1.0", "", {}, "sha512-i1BpaNDVLJdRBEKeJWkVO6tYX6DMFBuwMhSuWqLsY4ufeTKGVuV5rBsUhxPayXqnnWHgXUAmWK16H/ykO5Wj4Q=="],
"@hono/zod-validator": ["@hono/zod-validator@0.5.0", "", { "peerDependencies": { "hono": ">=3.9.0", "zod": "^3.19.1" } }, "sha512-ds5bW6DCgAnNHP33E3ieSbaZFd5dkV52ZjyaXtGoR06APFrCtzAsKZxTHwOrJNBdXsi0e5wNwo5L4nVEVnJUdg=="],
"@img/sharp-darwin-arm64": ["@img/sharp-darwin-arm64@0.33.5", "", { "optionalDependencies": { "@img/sharp-libvips-darwin-arm64": "1.0.4" }, "os": "darwin", "cpu": "arm64" }, "sha512-UT4p+iz/2H4twwAoLCqfA9UH5pI6DggwKEGuaPy7nCVQ8ZsiY5PIcrRvD1DzuY3qYL07NtIQcWnBSY/heikIFQ=="],
"@img/sharp-darwin-x64": ["@img/sharp-darwin-x64@0.33.5", "", { "optionalDependencies": { "@img/sharp-libvips-darwin-x64": "1.0.4" }, "os": "darwin", "cpu": "x64" }, "sha512-fyHac4jIc1ANYGRDxtiqelIbdWkIuQaI84Mv45KvGRRxSAa7o7d1ZKAOBaYbnepLC1WqxfpimdeWfvqqSGwR2Q=="],
"@img/sharp-libvips-darwin-arm64": ["@img/sharp-libvips-darwin-arm64@1.0.4", "", { "os": "darwin", "cpu": "arm64" }, "sha512-XblONe153h0O2zuFfTAbQYAX2JhYmDHeWikp1LM9Hul9gVPjFY427k6dFEcOL72O01QxQsWi761svJ/ev9xEDg=="],
"@img/sharp-libvips-darwin-x64": ["@img/sharp-libvips-darwin-x64@1.0.4", "", { "os": "darwin", "cpu": "x64" }, "sha512-xnGR8YuZYfJGmWPvmlunFaWJsb9T/AO2ykoP3Fz/0X5XV2aoYBPkX6xqCQvUTKKiLddarLaxpzNe+b1hjeWHAQ=="],
"@img/sharp-libvips-linux-arm": ["@img/sharp-libvips-linux-arm@1.0.5", "", { "os": "linux", "cpu": "arm" }, "sha512-gvcC4ACAOPRNATg/ov8/MnbxFDJqf/pDePbBnuBDcjsI8PssmjoKMAz4LtLaVi+OnSb5FK/yIOamqDwGmXW32g=="],
"@img/sharp-libvips-linux-arm64": ["@img/sharp-libvips-linux-arm64@1.0.4", "", { "os": "linux", "cpu": "arm64" }, "sha512-9B+taZ8DlyyqzZQnoeIvDVR/2F4EbMepXMc/NdVbkzsJbzkUjhXv/70GQJ7tdLA4YJgNP25zukcxpX2/SueNrA=="],
"@img/sharp-libvips-linux-s390x": ["@img/sharp-libvips-linux-s390x@1.0.4", "", { "os": "linux", "cpu": "s390x" }, "sha512-u7Wz6ntiSSgGSGcjZ55im6uvTrOxSIS8/dgoVMoiGE9I6JAfU50yH5BoDlYA1tcuGS7g/QNtetJnxA6QEsCVTA=="],
"@img/sharp-libvips-linux-x64": ["@img/sharp-libvips-linux-x64@1.0.4", "", { "os": "linux", "cpu": "x64" }, "sha512-MmWmQ3iPFZr0Iev+BAgVMb3ZyC4KeFc3jFxnNbEPas60e1cIfevbtuyf9nDGIzOaW9PdnDciJm+wFFaTlj5xYw=="],
"@img/sharp-libvips-linuxmusl-arm64": ["@img/sharp-libvips-linuxmusl-arm64@1.0.4", "", { "os": "linux", "cpu": "arm64" }, "sha512-9Ti+BbTYDcsbp4wfYib8Ctm1ilkugkA/uscUn6UXK1ldpC1JjiXbLfFZtRlBhjPZ5o1NCLiDbg8fhUPKStHoTA=="],
"@img/sharp-libvips-linuxmusl-x64": ["@img/sharp-libvips-linuxmusl-x64@1.0.4", "", { "os": "linux", "cpu": "x64" }, "sha512-viYN1KX9m+/hGkJtvYYp+CCLgnJXwiQB39damAO7WMdKWlIhmYTfHjwSbQeUK/20vY154mwezd9HflVFM1wVSw=="],
"@img/sharp-linux-arm": ["@img/sharp-linux-arm@0.33.5", "", { "optionalDependencies": { "@img/sharp-libvips-linux-arm": "1.0.5" }, "os": "linux", "cpu": "arm" }, "sha512-JTS1eldqZbJxjvKaAkxhZmBqPRGmxgu+qFKSInv8moZ2AmT5Yib3EQ1c6gp493HvrvV8QgdOXdyaIBrhvFhBMQ=="],
"@img/sharp-linux-arm64": ["@img/sharp-linux-arm64@0.33.5", "", { "optionalDependencies": { "@img/sharp-libvips-linux-arm64": "1.0.4" }, "os": "linux", "cpu": "arm64" }, "sha512-JMVv+AMRyGOHtO1RFBiJy/MBsgz0x4AWrT6QoEVVTyh1E39TrCUpTRI7mx9VksGX4awWASxqCYLCV4wBZHAYxA=="],
"@img/sharp-linux-s390x": ["@img/sharp-linux-s390x@0.33.5", "", { "optionalDependencies": { "@img/sharp-libvips-linux-s390x": "1.0.4" }, "os": "linux", "cpu": "s390x" }, "sha512-y/5PCd+mP4CA/sPDKl2961b+C9d+vPAveS33s6Z3zfASk2j5upL6fXVPZi7ztePZ5CuH+1kW8JtvxgbuXHRa4Q=="],
"@img/sharp-linux-x64": ["@img/sharp-linux-x64@0.33.5", "", { "optionalDependencies": { "@img/sharp-libvips-linux-x64": "1.0.4" }, "os": "linux", "cpu": "x64" }, "sha512-opC+Ok5pRNAzuvq1AG0ar+1owsu842/Ab+4qvU879ippJBHvyY5n2mxF1izXqkPYlGuP/M556uh53jRLJmzTWA=="],
"@img/sharp-linuxmusl-arm64": ["@img/sharp-linuxmusl-arm64@0.33.5", "", { "optionalDependencies": { "@img/sharp-libvips-linuxmusl-arm64": "1.0.4" }, "os": "linux", "cpu": "arm64" }, "sha512-XrHMZwGQGvJg2V/oRSUfSAfjfPxO+4DkiRh6p2AFjLQztWUuY/o8Mq0eMQVIY7HJ1CDQUJlxGGZRw1a5bqmd1g=="],
"@img/sharp-linuxmusl-x64": ["@img/sharp-linuxmusl-x64@0.33.5", "", { "optionalDependencies": { "@img/sharp-libvips-linuxmusl-x64": "1.0.4" }, "os": "linux", "cpu": "x64" }, "sha512-WT+d/cgqKkkKySYmqoZ8y3pxx7lx9vVejxW/W4DOFMYVSkErR+w7mf2u8m/y4+xHe7yY9DAXQMWQhpnMuFfScw=="],
"@img/sharp-wasm32": ["@img/sharp-wasm32@0.33.5", "", { "dependencies": { "@emnapi/runtime": "^1.2.0" }, "cpu": "none" }, "sha512-ykUW4LVGaMcU9lu9thv85CbRMAwfeadCJHRsg2GmeRa/cJxsVY9Rbd57JcMxBkKHag5U/x7TSBpScF4U8ElVzg=="],
"@img/sharp-win32-ia32": ["@img/sharp-win32-ia32@0.33.5", "", { "os": "win32", "cpu": "ia32" }, "sha512-T36PblLaTwuVJ/zw/LaH0PdZkRz5rd3SmMHX8GSmR7vtNSP5Z6bQkExdSK7xGWyxLw4sUknBuugTelgw2faBbQ=="],
"@img/sharp-win32-x64": ["@img/sharp-win32-x64@0.33.5", "", { "os": "win32", "cpu": "x64" }, "sha512-MpY/o8/8kj+EcnxwvrP4aTJSWw/aZ7JIGR4aBeZkZw5B7/Jn+tY9/VNwtcoGmdT7GfggGIU4kygOMSbYnOrAbg=="],
"@jridgewell/gen-mapping": ["@jridgewell/gen-mapping@0.3.8", "", { "dependencies": { "@jridgewell/set-array": "^1.2.1", "@jridgewell/sourcemap-codec": "^1.4.10", "@jridgewell/trace-mapping": "^0.3.24" } }, "sha512-imAbBGkb+ebQyxKgzv5Hu2nmROxoDOXHh80evxdoXNOrvAnVx7zimzc1Oo5h9RlfV4vPXaE2iM5pOFbvOCClWA=="],
"@jridgewell/resolve-uri": ["@jridgewell/resolve-uri@3.1.2", "", {}, "sha512-bRISgCIjP20/tbWSPWMEi54QVPRZExkuD9lJL+UIxUKtwVJA8wW1Trb1jMs1RFXo1CBTNZ/5hpC9QvmKWdopKw=="],
"@jridgewell/set-array": ["@jridgewell/set-array@1.2.1", "", {}, "sha512-R8gLRTZeyp03ymzP/6Lil/28tGeGEzhx1q2k703KGWRAI1VdvPIXdG70VJc2pAMw3NA6JKL5hhFu1sJX0Mnn/A=="],
"@jridgewell/sourcemap-codec": ["@jridgewell/sourcemap-codec@1.5.0", "", {}, "sha512-gv3ZRaISU3fjPAgNsriBRqGWQL6quFx04YMPW/zD8XMLsU32mhCCbfbO6KZFLjvYpCZ8zyDEgqsgf+PwPaM7GQ=="],
"@jridgewell/trace-mapping": ["@jridgewell/trace-mapping@0.3.25", "", { "dependencies": { "@jridgewell/resolve-uri": "^3.1.0", "@jridgewell/sourcemap-codec": "^1.4.14" } }, "sha512-vNk6aEwybGtawWmy/PzwnGDOjCkLWSD2wqvjGGAgOAwCGWySYXfYoxt00IJkTF+8Lb57DwOb3Aa0o9CApepiYQ=="],
"@jsdevtools/ono": ["@jsdevtools/ono@7.1.3", "", {}, "sha512-4JQNk+3mVzK3xh2rqd6RB4J46qUR19azEHBneZyTZM+c456qOrbbM/5xcR8huNCCcbVt7+UmizG6GuUvPvKUYg=="],
"@mdx-js/mdx": ["@mdx-js/mdx@3.1.0", "", { "dependencies": { "@types/estree": "^1.0.0", "@types/estree-jsx": "^1.0.0", "@types/hast": "^3.0.0", "@types/mdx": "^2.0.0", "collapse-white-space": "^2.0.0", "devlop": "^1.0.0", "estree-util-is-identifier-name": "^3.0.0", "estree-util-scope": "^1.0.0", "estree-walker": "^3.0.0", "hast-util-to-jsx-runtime": "^2.0.0", "markdown-extensions": "^2.0.0", "recma-build-jsx": "^1.0.0", "recma-jsx": "^1.0.0", "recma-stringify": "^1.0.0", "rehype-recma": "^1.0.0", "remark-mdx": "^3.0.0", "remark-parse": "^11.0.0", "remark-rehype": "^11.0.0", "source-map": "^0.7.0", "unified": "^11.0.0", "unist-util-position-from-estree": "^2.0.0", "unist-util-stringify-position": "^4.0.0", "unist-util-visit": "^5.0.0", "vfile": "^6.0.0" } }, "sha512-/QxEhPAvGwbQmy1Px8F899L5Uc2KZ6JtXwlCgJmjSTBedwOZkByYcBG4GceIGPXRDsmfxhHazuS+hlOShRLeDw=="],
"@mixmark-io/domino": ["@mixmark-io/domino@2.2.0", "", {}, "sha512-Y28PR25bHXUg88kCV7nivXrP2Nj2RueZ3/l/jdx6J9f8J4nsEGcgX0Qe6lt7Pa+J79+kPiJU3LguR6O/6zrLOw=="],
"@modelcontextprotocol/sdk": ["@modelcontextprotocol/sdk@1.6.1", "", { "dependencies": { "content-type": "^1.0.5", "cors": "^2.8.5", "eventsource": "^3.0.2", "express": "^5.0.1", "express-rate-limit": "^7.5.0", "pkce-challenge": "^4.1.0", "raw-body": "^3.0.0", "zod": "^3.23.8", "zod-to-json-schema": "^3.24.1" } }, "sha512-oxzMzYCkZHMntzuyerehK3fV6A2Kwh5BD6CGEJSVDU2QNEhfLOptf2X7esQgaHZXHZY0oHmMsOtIDLP71UJXgA=="],
"@opencode/function": ["@opencode/function@workspace:packages/function"],
"@opencode/web": ["@opencode/web@workspace:packages/web"],
"@opentelemetry/api": ["@opentelemetry/api@1.9.0", "", {}, "sha512-3giAOQvZiH5F9bMlMiv8+GSPMeqg0dbaeo58/0SlA9sxSqZhnUtxzX9/2FzyhS9sWQf5S0GJE0AKBrFqjpeYcg=="],
"@oslojs/encoding": ["@oslojs/encoding@1.1.0", "", {}, "sha512-70wQhgYmndg4GCPxPPxPGevRKqTIJ2Nh4OkiMWmDAVYsTQ+Ta7Sq+rPevXyXGdzr30/qZBnyOalCszoMxlyldQ=="],
"@pagefind/darwin-arm64": ["@pagefind/darwin-arm64@1.3.0", "", { "os": "darwin", "cpu": "arm64" }, "sha512-365BEGl6ChOsauRjyVpBjXybflXAOvoMROw3TucAROHIcdBvXk9/2AmEvGFU0r75+vdQI4LJdJdpH4Y6Yqaj4A=="],
"@pagefind/darwin-x64": ["@pagefind/darwin-x64@1.3.0", "", { "os": "darwin", "cpu": "x64" }, "sha512-zlGHA23uuXmS8z3XxEGmbHpWDxXfPZ47QS06tGUq0HDcZjXjXHeLG+cboOy828QIV5FXsm9MjfkP5e4ZNbOkow=="],
"@pagefind/default-ui": ["@pagefind/default-ui@1.3.0", "", {}, "sha512-CGKT9ccd3+oRK6STXGgfH+m0DbOKayX6QGlq38TfE1ZfUcPc5+ulTuzDbZUnMo+bubsEOIypm4Pl2iEyzZ1cNg=="],
"@pagefind/linux-arm64": ["@pagefind/linux-arm64@1.3.0", "", { "os": "linux", "cpu": "arm64" }, "sha512-8lsxNAiBRUk72JvetSBXs4WRpYrQrVJXjlRRnOL6UCdBN9Nlsz0t7hWstRk36+JqHpGWOKYiuHLzGYqYAqoOnQ=="],
"@pagefind/linux-x64": ["@pagefind/linux-x64@1.3.0", "", { "os": "linux", "cpu": "x64" }, "sha512-hAvqdPJv7A20Ucb6FQGE6jhjqy+vZ6pf+s2tFMNtMBG+fzcdc91uTw7aP/1Vo5plD0dAOHwdxfkyw0ugal4kcQ=="],
"@pagefind/windows-x64": ["@pagefind/windows-x64@1.3.0", "", { "os": "win32", "cpu": "x64" }, "sha512-BR1bIRWOMqkf8IoU576YDhij1Wd/Zf2kX/kCI0b2qzCKC8wcc2GQJaaRMCpzvCCrmliO4vtJ6RITp/AnoYUUmQ=="],
"@rollup/pluginutils": ["@rollup/pluginutils@5.1.4", "", { "dependencies": { "@types/estree": "^1.0.0", "estree-walker": "^2.0.2", "picomatch": "^4.0.2" }, "peerDependencies": { "rollup": "^1.20.0||^2.0.0||^3.0.0||^4.0.0" }, "optionalPeers": ["rollup"] }, "sha512-USm05zrsFxYLPdWWq+K3STlWiT/3ELn3RcV5hJMghpeAIhxfsUIg6mt12CBJBInWMV4VneoV7SfGv8xIwo2qNQ=="],
"@rollup/rollup-android-arm-eabi": ["@rollup/rollup-android-arm-eabi@4.41.1", "", { "os": "android", "cpu": "arm" }, "sha512-NELNvyEWZ6R9QMkiytB4/L4zSEaBC03KIXEghptLGLZWJ6VPrL63ooZQCOnlx36aQPGhzuOMwDerC1Eb2VmrLw=="],
"@rollup/rollup-android-arm64": ["@rollup/rollup-android-arm64@4.41.1", "", { "os": "android", "cpu": "arm64" }, "sha512-DXdQe1BJ6TK47ukAoZLehRHhfKnKg9BjnQYUu9gzhI8Mwa1d2fzxA1aw2JixHVl403bwp1+/o/NhhHtxWJBgEA=="],
"@rollup/rollup-darwin-arm64": ["@rollup/rollup-darwin-arm64@4.41.1", "", { "os": "darwin", "cpu": "arm64" }, "sha512-5afxvwszzdulsU2w8JKWwY8/sJOLPzf0e1bFuvcW5h9zsEg+RQAojdW0ux2zyYAz7R8HvvzKCjLNJhVq965U7w=="],
"@rollup/rollup-darwin-x64": ["@rollup/rollup-darwin-x64@4.41.1", "", { "os": "darwin", "cpu": "x64" }, "sha512-egpJACny8QOdHNNMZKf8xY0Is6gIMz+tuqXlusxquWu3F833DcMwmGM7WlvCO9sB3OsPjdC4U0wHw5FabzCGZg=="],
"@rollup/rollup-freebsd-arm64": ["@rollup/rollup-freebsd-arm64@4.41.1", "", { "os": "freebsd", "cpu": "arm64" }, "sha512-DBVMZH5vbjgRk3r0OzgjS38z+atlupJ7xfKIDJdZZL6sM6wjfDNo64aowcLPKIx7LMQi8vybB56uh1Ftck/Atg=="],
"@rollup/rollup-freebsd-x64": ["@rollup/rollup-freebsd-x64@4.41.1", "", { "os": "freebsd", "cpu": "x64" }, "sha512-3FkydeohozEskBxNWEIbPfOE0aqQgB6ttTkJ159uWOFn42VLyfAiyD9UK5mhu+ItWzft60DycIN1Xdgiy8o/SA=="],
"@rollup/rollup-linux-arm-gnueabihf": ["@rollup/rollup-linux-arm-gnueabihf@4.41.1", "", { "os": "linux", "cpu": "arm" }, "sha512-wC53ZNDgt0pqx5xCAgNunkTzFE8GTgdZ9EwYGVcg+jEjJdZGtq9xPjDnFgfFozQI/Xm1mh+D9YlYtl+ueswNEg=="],
"@rollup/rollup-linux-arm-musleabihf": ["@rollup/rollup-linux-arm-musleabihf@4.41.1", "", { "os": "linux", "cpu": "arm" }, "sha512-jwKCca1gbZkZLhLRtsrka5N8sFAaxrGz/7wRJ8Wwvq3jug7toO21vWlViihG85ei7uJTpzbXZRcORotE+xyrLA=="],
"@rollup/rollup-linux-arm64-gnu": ["@rollup/rollup-linux-arm64-gnu@4.41.1", "", { "os": "linux", "cpu": "arm64" }, "sha512-g0UBcNknsmmNQ8V2d/zD2P7WWfJKU0F1nu0k5pW4rvdb+BIqMm8ToluW/eeRmxCared5dD76lS04uL4UaNgpNA=="],
"@rollup/rollup-linux-arm64-musl": ["@rollup/rollup-linux-arm64-musl@4.41.1", "", { "os": "linux", "cpu": "arm64" }, "sha512-XZpeGB5TKEZWzIrj7sXr+BEaSgo/ma/kCgrZgL0oo5qdB1JlTzIYQKel/RmhT6vMAvOdM2teYlAaOGJpJ9lahg=="],
"@rollup/rollup-linux-loongarch64-gnu": ["@rollup/rollup-linux-loongarch64-gnu@4.41.1", "", { "os": "linux", "cpu": "none" }, "sha512-bkCfDJ4qzWfFRCNt5RVV4DOw6KEgFTUZi2r2RuYhGWC8WhCA8lCAJhDeAmrM/fdiAH54m0mA0Vk2FGRPyzI+tw=="],
"@rollup/rollup-linux-powerpc64le-gnu": ["@rollup/rollup-linux-powerpc64le-gnu@4.41.1", "", { "os": "linux", "cpu": "ppc64" }, "sha512-3mr3Xm+gvMX+/8EKogIZSIEF0WUu0HL9di+YWlJpO8CQBnoLAEL/roTCxuLncEdgcfJcvA4UMOf+2dnjl4Ut1A=="],
"@rollup/rollup-linux-riscv64-gnu": ["@rollup/rollup-linux-riscv64-gnu@4.41.1", "", { "os": "linux", "cpu": "none" }, "sha512-3rwCIh6MQ1LGrvKJitQjZFuQnT2wxfU+ivhNBzmxXTXPllewOF7JR1s2vMX/tWtUYFgphygxjqMl76q4aMotGw=="],
"@rollup/rollup-linux-riscv64-musl": ["@rollup/rollup-linux-riscv64-musl@4.41.1", "", { "os": "linux", "cpu": "none" }, "sha512-LdIUOb3gvfmpkgFZuccNa2uYiqtgZAz3PTzjuM5bH3nvuy9ty6RGc/Q0+HDFrHrizJGVpjnTZ1yS5TNNjFlklw=="],
"@rollup/rollup-linux-s390x-gnu": ["@rollup/rollup-linux-s390x-gnu@4.41.1", "", { "os": "linux", "cpu": "s390x" }, "sha512-oIE6M8WC9ma6xYqjvPhzZYk6NbobIURvP/lEbh7FWplcMO6gn7MM2yHKA1eC/GvYwzNKK/1LYgqzdkZ8YFxR8g=="],
"@rollup/rollup-linux-x64-gnu": ["@rollup/rollup-linux-x64-gnu@4.41.1", "", { "os": "linux", "cpu": "x64" }, "sha512-cWBOvayNvA+SyeQMp79BHPK8ws6sHSsYnK5zDcsC3Hsxr1dgTABKjMnMslPq1DvZIp6uO7kIWhiGwaTdR4Og9A=="],
"@rollup/rollup-linux-x64-musl": ["@rollup/rollup-linux-x64-musl@4.41.1", "", { "os": "linux", "cpu": "x64" }, "sha512-y5CbN44M+pUCdGDlZFzGGBSKCA4A/J2ZH4edTYSSxFg7ce1Xt3GtydbVKWLlzL+INfFIZAEg1ZV6hh9+QQf9YQ=="],
"@rollup/rollup-win32-arm64-msvc": ["@rollup/rollup-win32-arm64-msvc@4.41.1", "", { "os": "win32", "cpu": "arm64" }, "sha512-lZkCxIrjlJlMt1dLO/FbpZbzt6J/A8p4DnqzSa4PWqPEUUUnzXLeki/iyPLfV0BmHItlYgHUqJe+3KiyydmiNQ=="],
"@rollup/rollup-win32-ia32-msvc": ["@rollup/rollup-win32-ia32-msvc@4.41.1", "", { "os": "win32", "cpu": "ia32" }, "sha512-+psFT9+pIh2iuGsxFYYa/LhS5MFKmuivRsx9iPJWNSGbh2XVEjk90fmpUEjCnILPEPJnikAU6SFDiEUyOv90Pg=="],
"@rollup/rollup-win32-x64-msvc": ["@rollup/rollup-win32-x64-msvc@4.41.1", "", { "os": "win32", "cpu": "x64" }, "sha512-Wq2zpapRYLfi4aKxf2Xff0tN+7slj2d4R87WEzqw7ZLsVvO5zwYCIuEGSZYiK41+GlwUo1HiR+GdkLEJnCKTCw=="],
"@shikijs/core": ["@shikijs/core@3.4.2", "", { "dependencies": { "@shikijs/types": "3.4.2", "@shikijs/vscode-textmate": "^10.0.2", "@types/hast": "^3.0.4", "hast-util-to-html": "^9.0.5" } }, "sha512-AG8vnSi1W2pbgR2B911EfGqtLE9c4hQBYkv/x7Z+Kt0VxhgQKcW7UNDVYsu9YxwV6u+OJrvdJrMq6DNWoBjihQ=="],
"@shikijs/engine-javascript": ["@shikijs/engine-javascript@3.4.2", "", { "dependencies": { "@shikijs/types": "3.4.2", "@shikijs/vscode-textmate": "^10.0.2", "oniguruma-to-es": "^4.3.3" } }, "sha512-1/adJbSMBOkpScCE/SB6XkjJU17ANln3Wky7lOmrnpl+zBdQ1qXUJg2GXTYVHRq+2j3hd1DesmElTXYDgtfSOQ=="],
"@shikijs/engine-oniguruma": ["@shikijs/engine-oniguruma@3.4.2", "", { "dependencies": { "@shikijs/types": "3.4.2", "@shikijs/vscode-textmate": "^10.0.2" } }, "sha512-zcZKMnNndgRa3ORja6Iemsr3DrLtkX3cAF7lTJkdMB6v9alhlBsX9uNiCpqofNrXOvpA3h6lHcLJxgCIhVOU5Q=="],
"@shikijs/langs": ["@shikijs/langs@3.4.2", "", { "dependencies": { "@shikijs/types": "3.4.2" } }, "sha512-H6azIAM+OXD98yztIfs/KH5H4PU39t+SREhmM8LaNXyUrqj2mx+zVkr8MWYqjceSjDw9I1jawm1WdFqU806rMA=="],
"@shikijs/themes": ["@shikijs/themes@3.4.2", "", { "dependencies": { "@shikijs/types": "3.4.2" } }, "sha512-qAEuAQh+brd8Jyej2UDDf+b4V2g1Rm8aBIdvt32XhDPrHvDkEnpb7Kzc9hSuHUxz0Iuflmq7elaDuQAP9bHIhg=="],
"@shikijs/transformers": ["@shikijs/transformers@3.4.2", "", { "dependencies": { "@shikijs/core": "3.4.2", "@shikijs/types": "3.4.2" } }, "sha512-I5baLVi/ynLEOZoWSAMlACHNnG+yw5HDmse0oe+GW6U1u+ULdEB3UHiVWaHoJSSONV7tlcVxuaMy74sREDkSvg=="],
"@shikijs/types": ["@shikijs/types@3.4.2", "", { "dependencies": { "@shikijs/vscode-textmate": "^10.0.2", "@types/hast": "^3.0.4" } }, "sha512-zHC1l7L+eQlDXLnxvM9R91Efh2V4+rN3oMVS2swCBssbj2U/FBwybD1eeLaq8yl/iwT+zih8iUbTBCgGZOYlVg=="],
"@shikijs/vscode-textmate": ["@shikijs/vscode-textmate@10.0.2", "", {}, "sha512-83yeghZ2xxin3Nj8z1NMd/NCuca+gsYXswywDy5bHvwlWL8tpTQmzGeUuHd9FC3E/SBEMvzJRwWEOz5gGes9Qg=="],
"@standard-schema/spec": ["@standard-schema/spec@1.0.0", "", {}, "sha512-m2bOd0f2RT9k8QJx1JN85cZYyH1RqFBdlwtkSlf4tBDYLCiiZnv1fIIwacK6cqwXavOydf0NPToMQgpKq+dVlA=="],
"@swc/helpers": ["@swc/helpers@0.5.17", "", { "dependencies": { "tslib": "^2.8.0" } }, "sha512-5IKx/Y13RsYd+sauPb2x+U/xZikHjolzfuDgTAl/Tdf3Q8rslRvC19NKDLgAJQ6wsqADk10ntlv08nPFw/gO/A=="],
"@tokenizer/inflate": ["@tokenizer/inflate@0.2.7", "", { "dependencies": { "debug": "^4.4.0", "fflate": "^0.8.2", "token-types": "^6.0.0" } }, "sha512-MADQgmZT1eKjp06jpI2yozxaU9uVs4GzzgSL+uEq7bVcJ9V1ZXQkeGNql1fsSI0gMy1vhvNTNbUqrx+pZfJVmg=="],
"@tokenizer/token": ["@tokenizer/token@0.3.0", "", {}, "sha512-OvjF+z51L3ov0OyAU0duzsYuvO01PH7x4t6DJx+guahgTnBHkhJdG7soQeTSFLWN3efnHyibZ4Z8l2EuWwJN3A=="],
"@tsconfig/bun": ["@tsconfig/bun@1.0.7", "", {}, "sha512-udGrGJBNQdXGVulehc1aWT73wkR9wdaGBtB6yL70RJsqwW/yJhIg6ZbRlPOfIUiFNrnBuYLBi9CSmMKfDC7dvA=="],
"@types/babel__core": ["@types/babel__core@7.20.5", "", { "dependencies": { "@babel/parser": "^7.20.7", "@babel/types": "^7.20.7", "@types/babel__generator": "*", "@types/babel__template": "*", "@types/babel__traverse": "*" } }, "sha512-qoQprZvz5wQFJwMDqeseRXWv3rqMvhgpbXFfVyWhbx9X47POIA6i/+dXefEmZKoAgOaTdaIgNSMqMIU61yRyzA=="],
"@types/babel__generator": ["@types/babel__generator@7.27.0", "", { "dependencies": { "@babel/types": "^7.0.0" } }, "sha512-ufFd2Xi92OAVPYsy+P4n7/U7e68fex0+Ee8gSG9KX7eo084CWiQ4sdxktvdl0bOPupXtVJPY19zk6EwWqUQ8lg=="],
"@types/babel__template": ["@types/babel__template@7.4.4", "", { "dependencies": { "@babel/parser": "^7.1.0", "@babel/types": "^7.0.0" } }, "sha512-h/NUaSyG5EyxBIp8YRxo4RMe2/qQgvyowRwVMzhYhBCONbW8PUsg4lkFMrhgZhUe5z3L3MiLDuvyJ/CaPa2A8A=="],
"@types/babel__traverse": ["@types/babel__traverse@7.20.7", "", { "dependencies": { "@babel/types": "^7.20.7" } }, "sha512-dkO5fhS7+/oos4ciWxyEyjWe48zmG6wbCheo/G2ZnHx4fs3EU6YC6UM8rk56gAjNJ9P3MTH2jo5jb92/K6wbng=="],
"@types/bun": ["@types/bun@1.2.15", "", { "dependencies": { "bun-types": "1.2.15" } }, "sha512-U1ljPdBEphF0nw1MIk0hI7kPg7dFdPyM7EenHsp6W5loNHl7zqy6JQf/RKCgnUn2KDzUpkBwHPnEJEjII594bA=="],
"@types/debug": ["@types/debug@4.1.12", "", { "dependencies": { "@types/ms": "*" } }, "sha512-vIChWdVG3LG1SMxEvI/AK+FWJthlrqlTu7fbrlywTkkaONwk/UAGaULXRlf8vkzFBLVm0zkMdCquhL5aOjhXPQ=="],
"@types/estree": ["@types/estree@1.0.7", "", {}, "sha512-w28IoSUCJpidD/TGviZwwMJckNESJZXFu7NBZ5YJ4mEUnNraUn9Pm8HSZm/jDF1pDWYKspWE7oVphigUPRakIQ=="],
"@types/estree-jsx": ["@types/estree-jsx@1.0.5", "", { "dependencies": { "@types/estree": "*" } }, "sha512-52CcUVNFyfb1A2ALocQw/Dd1BQFNmSdkuC3BkZ6iqhdMfQz7JWOFRuJFloOzjk+6WijU56m9oKXFAXc7o3Towg=="],
"@types/fontkit": ["@types/fontkit@2.0.8", "", { "dependencies": { "@types/node": "*" } }, "sha512-wN+8bYxIpJf+5oZdrdtaX04qUuWHcKxcDEgRS9Qm9ZClSHjzEn13SxUC+5eRM+4yXIeTYk8mTzLAWGF64847ew=="],
"@types/hast": ["@types/hast@3.0.4", "", { "dependencies": { "@types/unist": "*" } }, "sha512-WPs+bbQw5aCj+x6laNGWLH3wviHtoCv/P3+otBhbOhJgG8qtpdAMlTCxLtsTWA7LH1Oh/bFCHsBn0TPS5m30EQ=="],
"@types/js-yaml": ["@types/js-yaml@4.0.9", "", {}, "sha512-k4MGaQl5TGo/iipqb2UDG2UwjXziSWkh0uysQelTlJpX1qGlpUZYm8PnO4DxG1qBomtJUdYJ6qR6xdIah10JLg=="],
"@types/json-schema": ["@types/json-schema@7.0.15", "", {}, "sha512-5+fP8P8MFNC+AyZCDxrB2pkZFPGzqQWUzpSeuuVLvm8VMcorNYavBqoFcxK8bQz4Qsbn4oUEEem4wDLfcysGHA=="],
"@types/luxon": ["@types/luxon@3.6.2", "", {}, "sha512-R/BdP7OxEMc44l2Ex5lSXHoIXTB2JLNa3y2QISIbr58U/YcsffyQrYW//hZSdrfxrjRZj3GcUoxMPGdO8gSYuw=="],
"@types/mdast": ["@types/mdast@4.0.4", "", { "dependencies": { "@types/unist": "*" } }, "sha512-kGaNbPh1k7AFzgpud/gMdvIm5xuECykRR+JnWKQno9TAXVa6WIVCGTPvYGekIDL4uwCZQSYbUxNBSb1aUo79oA=="],
"@types/mdx": ["@types/mdx@2.0.13", "", {}, "sha512-+OWZQfAYyio6YkJb3HLxDrvnx6SWWDbC0zVPfBRzUk0/nqoDyf6dNxQi3eArPe8rJ473nobTMQ/8Zk+LxJ+Yuw=="],
"@types/ms": ["@types/ms@2.1.0", "", {}, "sha512-GsCCIZDE/p3i96vtEqx+7dBUGXrc7zeSK3wwPHIaRThS+9OhWIXRqzs4d6k1SVU8g91DrNRWxWUGhp5KXQb2VA=="],
"@types/nlcst": ["@types/nlcst@2.0.3", "", { "dependencies": { "@types/unist": "*" } }, "sha512-vSYNSDe6Ix3q+6Z7ri9lyWqgGhJTmzRjZRqyq15N0Z/1/UnVsno9G/N40NBijoYx2seFDIl0+B2mgAb9mezUCA=="],
"@types/node": ["@types/node@22.13.9", "", { "dependencies": { "undici-types": "~6.20.0" } }, "sha512-acBjXdRJ3A6Pb3tqnw9HZmyR3Fiol3aGxRCK1x3d+6CDAMjl7I649wpSd+yNURCjbOUGu9tqtLKnTGxmK6CyGw=="],
"@types/sax": ["@types/sax@1.2.7", "", { "dependencies": { "@types/node": "*" } }, "sha512-rO73L89PJxeYM3s3pPPjiPgVVcymqU490g0YO5n5By0k2Erzj6tay/4lr1CHAAU4JyOWd1rpQ8bCf6cZfHU96A=="],
"@types/turndown": ["@types/turndown@5.0.5", "", {}, "sha512-TL2IgGgc7B5j78rIccBtlYAnkuv8nUQqhQc+DSYV5j9Be9XOcm/SKOVRuA47xAVI3680Tk9B1d8flK2GWT2+4w=="],
"@types/unist": ["@types/unist@3.0.3", "", {}, "sha512-ko/gIFJRv177XgZsZcBwnqJN5x/Gien8qNOn0D5bQU/zAzVf9Zt3BlcUiLqhV9y4ARk0GbT3tnUiPNgnTXzc/Q=="],
"@ungap/structured-clone": ["@ungap/structured-clone@1.3.0", "", {}, "sha512-WmoN8qaIAo7WTYWbAZuG8PYEhn5fkz7dZrqTBZ7dtt//lL2Gwms1IcnQ5yHqjDfX8Ft5j4YzDM23f87zBfDe9g=="],
"accepts": ["accepts@2.0.0", "", { "dependencies": { "mime-types": "^3.0.0", "negotiator": "^1.0.0" } }, "sha512-5cvg6CtKwfgdmVqY1WIiXKc3Q1bkRqGLi+2W/6ao+6Y7gu/RCwRuAhGEzh5B4KlszSuTLgZYuqFqo5bImjNKng=="],
"acorn": ["acorn@8.14.1", "", { "bin": { "acorn": "bin/acorn" } }, "sha512-OvQ/2pUDKmgfCg++xsTX1wGxfTaszcHVcTctW4UJB4hibJx2HXxxO5UmVgyjMa+ZDsiaf5wWLXYpRWMmBI0QHg=="],
"acorn-jsx": ["acorn-jsx@5.3.2", "", { "peerDependencies": { "acorn": "^6.0.0 || ^7.0.0 || ^8.0.0" } }, "sha512-rq9s+JNhf0IChjtDXxllJ7g41oZk5SlXtp0LHwyA5cejwn7vKmKp4pPri6YEePv2PU65sAsegbXtIinmDFDXgQ=="],
"ai": ["ai@5.0.0-alpha.7", "", { "dependencies": { "@ai-sdk/gateway": "1.0.0-alpha.7", "@ai-sdk/provider": "2.0.0-alpha.7", "@ai-sdk/provider-utils": "3.0.0-alpha.7", "@opentelemetry/api": "1.9.0" }, "peerDependencies": { "zod": "^3.23.8" } }, "sha512-ShCk3frIMdVtK9knvWKiFS7N6Vwnf8mLMv670+T//W9oqfoetSVPBhTF6Dy+oDM/bjVSsBf1BuYImLDvHICOIQ=="],
"ansi-align": ["ansi-align@3.0.1", "", { "dependencies": { "string-width": "^4.1.0" } }, "sha512-IOfwwBF5iczOjp/WeY4YxyjqAFMQoZufdQWDd19SEExbVLNXqvpzSJ/M7Za4/sCPmQ0+GRquoA7bGcINcxew6w=="],
"ansi-regex": ["ansi-regex@6.1.0", "", {}, "sha512-7HSX4QQb4CspciLpVFwyRe79O3xsIZDDLER21kERQ71oaPodF8jL725AgJMFAYbooIqolJoRLuM81SpeUkpkvA=="],
"ansi-styles": ["ansi-styles@6.2.1", "", {}, "sha512-bN798gFfQX+viw3R7yrGWRqnrN2oRkEkUjjl4JNn4E8GxxbjtG3FbrEIIY3l8/hrwUwIeCZvi4QuOTP4MErVug=="],
"anymatch": ["anymatch@3.1.3", "", { "dependencies": { "normalize-path": "^3.0.0", "picomatch": "^2.0.4" } }, "sha512-KMReFUr0B4t+D+OBkjR3KYqvocp2XaSzO55UcB6mgQMd3KbcE+mWTyvVV7D/zsdEbNnV6acZUutkiHQXvTr1Rw=="],
"arg": ["arg@5.0.2", "", {}, "sha512-PYjyFOLKQ9y57JvQ6QLo8dAgNqswh8M1RMJYdQduT6xbWSgK36P/Z/v+p888pM69jMMfS8Xd8F6I1kQ/I9HUGg=="],
"argparse": ["argparse@2.0.1", "", {}, "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q=="],
"args": ["args@5.0.3", "", { "dependencies": { "camelcase": "5.0.0", "chalk": "2.4.2", "leven": "2.1.0", "mri": "1.1.4" } }, "sha512-h6k/zfFgusnv3i5TU08KQkVKuCPBtL/PWQbWkHUxvJrZ2nAyeaUupneemcrgn1xmqxPQsPIzwkUhOpoqPDRZuA=="],
"aria-query": ["aria-query@5.3.2", "", {}, "sha512-COROpnaoap1E2F000S62r6A60uHZnmlvomhfyT2DlTcrY1OrBKn2UhH7qn5wTC9zMvD0AY7csdPSNwKP+7WiQw=="],
"array-iterate": ["array-iterate@2.0.1", "", {}, "sha512-I1jXZMjAgCMmxT4qxXfPXa6SthSoE8h6gkSI9BGGNv8mP8G/v0blc+qFnZu6K42vTOiuME596QaLO0TP3Lk0xg=="],
"astring": ["astring@1.9.0", "", { "bin": { "astring": "bin/astring" } }, "sha512-LElXdjswlqjWrPpJFg1Fx4wpkOCxj1TDHlSV4PlaRxHGWko024xICaa97ZkMfs6DRKlCguiAI+rbXv5GWwXIkg=="],
"astro": ["astro@5.7.13", "", { "dependencies": { "@astrojs/compiler": "^2.11.0", "@astrojs/internal-helpers": "0.6.1", "@astrojs/markdown-remark": "6.3.1", "@astrojs/telemetry": "3.2.1", "@capsizecss/unpack": "^2.4.0", "@oslojs/encoding": "^1.1.0", "@rollup/pluginutils": "^5.1.4", "acorn": "^8.14.1", "aria-query": "^5.3.2", "axobject-query": "^4.1.0", "boxen": "8.0.1", "ci-info": "^4.2.0", "clsx": "^2.1.1", "common-ancestor-path": "^1.0.1", "cookie": "^1.0.2", "cssesc": "^3.0.0", "debug": "^4.4.0", "deterministic-object-hash": "^2.0.2", "devalue": "^5.1.1", "diff": "^5.2.0", "dlv": "^1.1.3", "dset": "^3.1.4", "es-module-lexer": "^1.6.0", "esbuild": "^0.25.0", "estree-walker": "^3.0.3", "flattie": "^1.1.1", "fontace": "~0.3.0", "github-slugger": "^2.0.0", "html-escaper": "3.0.3", "http-cache-semantics": "^4.1.1", "js-yaml": "^4.1.0", "kleur": "^4.1.5", "magic-string": "^0.30.17", "magicast": "^0.3.5", "mrmime": "^2.0.1", "neotraverse": "^0.6.18", "p-limit": "^6.2.0", "p-queue": "^8.1.0", "package-manager-detector": "^1.1.0", "picomatch": "^4.0.2", "prompts": "^2.4.2", "rehype": "^13.0.2", "semver": "^7.7.1", "shiki": "^3.2.1", "tinyexec": "^0.3.2", "tinyglobby": "^0.2.12", "tsconfck": "^3.1.5", "ultrahtml": "^1.6.0", "unifont": "~0.5.0", "unist-util-visit": "^5.0.0", "unstorage": "^1.15.0", "vfile": "^6.0.3", "vite": "^6.3.4", "vitefu": "^1.0.6", "xxhash-wasm": "^1.1.0", "yargs-parser": "^21.1.1", "yocto-spinner": "^0.2.1", "zod": "^3.24.2", "zod-to-json-schema": "^3.24.5", "zod-to-ts": "^1.2.0" }, "optionalDependencies": { "sharp": "^0.33.3" }, "bin": { "astro": "astro.js" } }, "sha512-cRGq2llKOhV3XMcYwQpfBIUcssN6HEK5CRbcMxAfd9OcFhvWE7KUy50zLioAZVVl3AqgUTJoNTlmZfD2eG0G1w=="],
"astro-expressive-code": ["astro-expressive-code@0.41.2", "", { "dependencies": { "rehype-expressive-code": "^0.41.2" }, "peerDependencies": { "astro": "^4.0.0-beta || ^5.0.0-beta || ^3.3.0" } }, "sha512-HN0jWTnhr7mIV/2e6uu4PPRNNo/k4UEgTLZqbp3MrHU+caCARveG2yZxaZVBmxyiVdYqW5Pd3u3n2zjnshixbw=="],
"atomic-sleep": ["atomic-sleep@1.0.0", "", {}, "sha512-kNOjDqAh7px0XWNI+4QbzoiR/nTkHAWNud2uvnJquD1/x5a7EQZMJT0AczqK0Qn67oY/TTQ1LbUKajZpp3I9tQ=="],
"available-typed-arrays": ["available-typed-arrays@1.0.7", "", { "dependencies": { "possible-typed-array-names": "^1.0.0" } }, "sha512-wvUjBtSGN7+7SjNpq/9M2Tg350UZD3q62IFZLbRAR1bSMlCo1ZaeW+BJ+D090e4hIIZLBcTDWe4Mh4jvUDajzQ=="],
"aws-sdk": ["aws-sdk@2.1692.0", "", { "dependencies": { "buffer": "4.9.2", "events": "1.1.1", "ieee754": "1.1.13", "jmespath": "0.16.0", "querystring": "0.2.0", "sax": "1.2.1", "url": "0.10.3", "util": "^0.12.4", "uuid": "8.0.0", "xml2js": "0.6.2" } }, "sha512-x511uiJ/57FIsbgUe5csJ13k3uzu25uWQE+XqfBis/sB0SFoiElJWXRkgEAUh0U6n40eT3ay5Ue4oPkRMu1LYw=="],
"aws4fetch": ["aws4fetch@1.0.18", "", {}, "sha512-3Cf+YaUl07p24MoQ46rFwulAmiyCwH2+1zw1ZyPAX5OtJ34Hh185DwB8y/qRLb6cYYYtSFJ9pthyLc0MD4e8sQ=="],
"axobject-query": ["axobject-query@4.1.0", "", {}, "sha512-qIj0G9wZbMGNLjLmg1PT6v2mE9AH2zlnADJD/2tC6E00hgmhUOfEB6greHPAfLRSufHqROIUTkw6E+M3lH0PTQ=="],
"b4a": ["b4a@1.6.7", "", {}, "sha512-OnAYlL5b7LEkALw87fUVafQw5rVR9RjwGd4KUwNQ6DrrNmaVaUCgLipfVlzrPQ4tWOR9P0IXGNOx50jYCCdSJg=="],
"babel-plugin-jsx-dom-expressions": ["babel-plugin-jsx-dom-expressions@0.39.8", "", { "dependencies": { "@babel/helper-module-imports": "7.18.6", "@babel/plugin-syntax-jsx": "^7.18.6", "@babel/types": "^7.20.7", "html-entities": "2.3.3", "parse5": "^7.1.2", "validate-html-nesting": "^1.2.1" }, "peerDependencies": { "@babel/core": "^7.20.12" } }, "sha512-/MVOIIjonylDXnrWmG23ZX82m9mtKATsVHB7zYlPfDR9Vdd/NBE48if+wv27bSkBtyO7EPMUlcUc4J63QwuACQ=="],
"babel-preset-solid": ["babel-preset-solid@1.9.6", "", { "dependencies": { "babel-plugin-jsx-dom-expressions": "^0.39.8" }, "peerDependencies": { "@babel/core": "^7.0.0" } }, "sha512-HXTK9f93QxoH8dYn1M2mJdOlWgMsR88Lg/ul6QCZGkNTktjTE5HAf93YxQumHoCudLEtZrU1cFCMFOVho6GqFg=="],
"bail": ["bail@2.0.2", "", {}, "sha512-0xO6mYd7JB2YesxDKplafRpsiOzPt9V02ddPCLbY1xYGPOX24NTyN50qnUxgCPcSoYMhKpAuBTjQoRZCAkUDRw=="],
"balanced-match": ["balanced-match@1.0.2", "", {}, "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw=="],
"bare-events": ["bare-events@2.5.4", "", {}, "sha512-+gFfDkR8pj4/TrWCGUGWmJIkBwuxPS5F+a5yWjOHQt2hHvNZd5YLzadjmDUtFmMM4y429bnKLa8bYBMHcYdnQA=="],
"bare-fs": ["bare-fs@4.1.5", "", { "dependencies": { "bare-events": "^2.5.4", "bare-path": "^3.0.0", "bare-stream": "^2.6.4" }, "peerDependencies": { "bare-buffer": "*" }, "optionalPeers": ["bare-buffer"] }, "sha512-1zccWBMypln0jEE05LzZt+V/8y8AQsQQqxtklqaIyg5nu6OAYFhZxPXinJTSG+kU5qyNmeLgcn9AW7eHiCHVLA=="],
"bare-os": ["bare-os@3.6.1", "", {}, "sha512-uaIjxokhFidJP+bmmvKSgiMzj2sV5GPHaZVAIktcxcpCyBFFWO+YlikVAdhmUo2vYFvFhOXIAlldqV29L8126g=="],
"bare-path": ["bare-path@3.0.0", "", { "dependencies": { "bare-os": "^3.0.1" } }, "sha512-tyfW2cQcB5NN8Saijrhqn0Zh7AnFNsnczRcuWODH0eYAXBsJ5gVxAUuNr7tsHSC6IZ77cA0SitzT+s47kot8Mw=="],
"bare-stream": ["bare-stream@2.6.5", "", { "dependencies": { "streamx": "^2.21.0" }, "peerDependencies": { "bare-buffer": "*", "bare-events": "*" }, "optionalPeers": ["bare-buffer", "bare-events"] }, "sha512-jSmxKJNJmHySi6hC42zlZnq00rga4jjxcgNZjY9N5WlOe/iOoGRtdwGsHzQv2RlH2KOYMwGUXhf2zXd32BA9RA=="],
"base-64": ["base-64@1.0.0", "", {}, "sha512-kwDPIFCGx0NZHog36dj+tHiwP4QMzsZ3AgMViUBKI0+V5n4U0ufTCUMhnQ04diaRI8EX/QcPfql7zlhZ7j4zgg=="],
"base64-js": ["base64-js@1.5.1", "", {}, "sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA=="],
"bcp-47": ["bcp-47@2.1.0", "", { "dependencies": { "is-alphabetical": "^2.0.0", "is-alphanumerical": "^2.0.0", "is-decimal": "^2.0.0" } }, "sha512-9IIS3UPrvIa1Ej+lVDdDwO7zLehjqsaByECw0bu2RRGP73jALm6FYbzI5gWbgHLvNdkvfXB5YrSbocZdOS0c0w=="],
"bcp-47-match": ["bcp-47-match@2.0.3", "", {}, "sha512-JtTezzbAibu8G0R9op9zb3vcWZd9JF6M0xOYGPn0fNCd7wOpRB1mU2mH9T8gaBGbAAyIIVgB2G7xG0GP98zMAQ=="],
"bl": ["bl@4.1.0", "", { "dependencies": { "buffer": "^5.5.0", "inherits": "^2.0.4", "readable-stream": "^3.4.0" } }, "sha512-1W07cM9gS6DcLperZfFSj+bWLtaPGSOHWhPiGzXmvVJbRLdG82sH/Kn8EtW1VqWVA54AKf2h5k5BbnIbwF3h6w=="],
"blob-to-buffer": ["blob-to-buffer@1.2.9", "", {}, "sha512-BF033y5fN6OCofD3vgHmNtwZWRcq9NLyyxyILx9hfMy1sXYy4ojFl765hJ2lP0YaN2fuxPaLO2Vzzoxy0FLFFA=="],
"body-parser": ["body-parser@2.2.0", "", { "dependencies": { "bytes": "^3.1.2", "content-type": "^1.0.5", "debug": "^4.4.0", "http-errors": "^2.0.0", "iconv-lite": "^0.6.3", "on-finished": "^2.4.1", "qs": "^6.14.0", "raw-body": "^3.0.0", "type-is": "^2.0.0" } }, "sha512-02qvAaxv8tp7fBa/mw1ga98OGm+eCbqzJOKoRt70sLmfEEi+jyBYVTDGfCL/k06/4EMk/z01gCe7HoCH/f2LTg=="],
"boolbase": ["boolbase@1.0.0", "", {}, "sha512-JZOSA7Mo9sNGB8+UjSgzdLtokWAky1zbztM3WRLCbZ70/3cTANmQmOdR7y2g+J0e2WXywy1yS468tY+IruqEww=="],
"boxen": ["boxen@8.0.1", "", { "dependencies": { "ansi-align": "^3.0.1", "camelcase": "^8.0.0", "chalk": "^5.3.0", "cli-boxes": "^3.0.0", "string-width": "^7.2.0", "type-fest": "^4.21.0", "widest-line": "^5.0.0", "wrap-ansi": "^9.0.0" } }, "sha512-F3PH5k5juxom4xktynS7MoFY+NUWH5LC4CnH11YB8NPew+HLpmBLCybSAEyb2F+4pRXhuhWqFesoQd6DAyc2hw=="],
"brace-expansion": ["brace-expansion@2.0.1", "", { "dependencies": { "balanced-match": "^1.0.0" } }, "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA=="],
"brotli": ["brotli@1.3.3", "", { "dependencies": { "base64-js": "^1.1.2" } }, "sha512-oTKjJdShmDuGW94SyyaoQvAjf30dZaHnjJ8uAF+u2/vGJkJbJPJAT1gDiOJP5v1Zb6f9KEyW/1HpuaWIXtGHPg=="],
"browserslist": ["browserslist@4.25.0", "", { "dependencies": { "caniuse-lite": "^1.0.30001718", "electron-to-chromium": "^1.5.160", "node-releases": "^2.0.19", "update-browserslist-db": "^1.1.3" }, "bin": { "browserslist": "cli.js" } }, "sha512-PJ8gYKeS5e/whHBh8xrwYK+dAvEj7JXtz6uTucnMRB8OiGTsKccFekoRrjajPBHV8oOY+2tI4uxeceSimKwMFA=="],
"buffer": ["buffer@4.9.2", "", { "dependencies": { "base64-js": "^1.0.2", "ieee754": "^1.1.4", "isarray": "^1.0.0" } }, "sha512-xq+q3SRMOxGivLhBNaUdC64hDTQwejJ+H0T/NB1XMtTVEwNTrfFF3gAxiyW0Bu/xWEGhjVKgUcMhCrUy2+uCWg=="],
"bun-types": ["bun-types@1.2.15", "", { "dependencies": { "@types/node": "*" } }, "sha512-NarRIaS+iOaQU1JPfyKhZm4AsUOrwUOqRNHY0XxI8GI8jYxiLXLcdjYMG9UKS+fwWasc1uw1htV9AX24dD+p4w=="],
"bytes": ["bytes@3.1.2", "", {}, "sha512-/Nf7TyzTx6S3yRJObOAV7956r8cr2+Oj8AC5dt8wSP3BQAoeX58NoHyCU8P8zGkNXStjTSi6fzO6F0pBdcYbEg=="],
"cac": ["cac@6.7.14", "", {}, "sha512-b6Ilus+c3RrdDk+JhLKUAQfzzgLEPy6wcXqS7f/xe1EETvsDP6GORG7SFuOs6cID5YkqchW/LXZbX5bc8j7ZcQ=="],
"call-bind": ["call-bind@1.0.8", "", { "dependencies": { "call-bind-apply-helpers": "^1.0.0", "es-define-property": "^1.0.0", "get-intrinsic": "^1.2.4", "set-function-length": "^1.2.2" } }, "sha512-oKlSFMcMwpUg2ednkhQ454wfWiU/ul3CkJe/PEHcTKuiX6RpbehUiFMXu13HalGZxfUwCQzZG747YXBn1im9ww=="],
"call-bind-apply-helpers": ["call-bind-apply-helpers@1.0.2", "", { "dependencies": { "es-errors": "^1.3.0", "function-bind": "^1.1.2" } }, "sha512-Sp1ablJ0ivDkSzjcaJdxEunN5/XvksFJ2sMBFfq6x0ryhQV/2b/KwFe21cMpmHtPOSij8K99/wSfoEuTObmuMQ=="],
"call-bound": ["call-bound@1.0.4", "", { "dependencies": { "call-bind-apply-helpers": "^1.0.2", "get-intrinsic": "^1.3.0" } }, "sha512-+ys997U96po4Kx/ABpBCqhA9EuxJaQWDQg7295H4hBphv3IZg0boBKuwYpt4YXp6MZ5AmZQnU/tyMTlRpaSejg=="],
"camelcase": ["camelcase@8.0.0", "", {}, "sha512-8WB3Jcas3swSvjIeA2yvCJ+Miyz5l1ZmB6HFb9R1317dt9LCQoswg/BGrmAmkWVEszSrrg4RwmO46qIm2OEnSA=="],
"caniuse-lite": ["caniuse-lite@1.0.30001720", "", {}, "sha512-Ec/2yV2nNPwb4DnTANEV99ZWwm3ZWfdlfkQbWSDDt+PsXEVYwlhPH8tdMaPunYTKKmz7AnHi2oNEi1GcmKCD8g=="],
"ccount": ["ccount@2.0.1", "", {}, "sha512-eyrF0jiFpY+3drT6383f1qhkbGsLSifNAjA61IUjZjmLCWjItY6LB9ft9YhoDgwfmclB2zhu51Lc7+95b8NRAg=="],
"chalk": ["chalk@5.4.1", "", {}, "sha512-zgVZuo2WcZgfUEmsn6eO3kINexW8RAE4maiQ8QNs8CtpPCSyMiYsULR3HQYkm3w8FIA3SberyMJMSldGsW+U3w=="],
"character-entities": ["character-entities@2.0.2", "", {}, "sha512-shx7oQ0Awen/BRIdkjkvz54PnEEI/EjwXDSIZp86/KKdbafHh1Df/RYGBhn4hbe2+uKC9FnT5UCEdyPz3ai9hQ=="],
"character-entities-html4": ["character-entities-html4@2.1.0", "", {}, "sha512-1v7fgQRj6hnSwFpq1Eu0ynr/CDEw0rXo2B61qXrLNdHZmPKgb7fqS1a2JwF0rISo9q77jDI8VMEHoApn8qDoZA=="],
"character-entities-legacy": ["character-entities-legacy@3.0.0", "", {}, "sha512-RpPp0asT/6ufRm//AJVwpViZbGM/MkjQFxJccQRHmISF/22NBtsHqAWmL+/pmkPWoIUJdWyeVleTl1wydHATVQ=="],
"character-reference-invalid": ["character-reference-invalid@2.0.1", "", {}, "sha512-iBZ4F4wRbyORVsu0jPV7gXkOsGYjGHPmAyv+HiHG8gi5PtC9KI2j1+v8/tlibRvjoWX027ypmG/n0HtO5t7unw=="],
"chokidar": ["chokidar@4.0.3", "", { "dependencies": { "readdirp": "^4.0.1" } }, "sha512-Qgzu8kfBvo+cA4962jnP1KkS6Dop5NS6g7R5LFYJr4b8Ub94PPQXUksCw9PvXoeXPRRddRNC5C1JQUR2SMGtnA=="],
"chownr": ["chownr@1.1.4", "", {}, "sha512-jJ0bqzaylmJtVnNgzTeSOs8DPavpbYgEr/b0YL8/2GO3xJEhInFmhKMUnEJQjZumK7KXGFhUy89PrsJWlakBVg=="],
"ci-info": ["ci-info@4.2.0", "", {}, "sha512-cYY9mypksY8NRqgDB1XD1RiJL338v/551niynFTGkZOO2LHuB2OmOYxDIe/ttN9AHwrqdum1360G3ald0W9kCg=="],
"cli-boxes": ["cli-boxes@3.0.0", "", {}, "sha512-/lzGpEWL/8PfI0BmBOPRwp0c/wFNX1RdUML3jK/RcSBA9T8mZDdQpqYBKtCFTOfQbwPqWEOpjqW+Fnayc0969g=="],
"clone": ["clone@2.1.2", "", {}, "sha512-3Pe/CF1Nn94hyhIYpjtiLhdCoEoz0DqQ+988E9gmeEdQZlojxnOb74wctFyuwWQHzqyf9X7C7MG8juUpqBJT8w=="],
"clsx": ["clsx@2.1.1", "", {}, "sha512-eYm0QWBtUrBWZWG0d386OGAw16Z995PiOVo2B7bjWSbHedGl5e0ZWaq65kOGgUSNesEIDkB9ISbTg/JK9dhCZA=="],
"collapse-white-space": ["collapse-white-space@2.1.0", "", {}, "sha512-loKTxY1zCOuG4j9f6EPnuyyYkf58RnhhWTvRoZEokgB+WbdXehfjFviyOVYkqzEWz1Q5kRiZdBYS5SwxbQYwzw=="],
"color": ["color@4.2.3", "", { "dependencies": { "color-convert": "^2.0.1", "color-string": "^1.9.0" } }, "sha512-1rXeuUUiGGrykh+CeBdu5Ie7OJwinCgQY0bc7GCRxy5xVHy+moaqkpL/jqQq0MtQOeYcrqEz4abc5f0KtU7W4A=="],
"color-convert": ["color-convert@2.0.1", "", { "dependencies": { "color-name": "~1.1.4" } }, "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ=="],
"color-name": ["color-name@1.1.4", "", {}, "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA=="],
"color-string": ["color-string@1.9.1", "", { "dependencies": { "color-name": "^1.0.0", "simple-swizzle": "^0.2.2" } }, "sha512-shrVawQFojnZv6xM40anx4CkoDP+fZsw/ZerEMsW/pyzsRbElpsL/DBVW7q3ExxwusdNXI3lXpuhEZkzs8p5Eg=="],
"comma-separated-tokens": ["comma-separated-tokens@2.0.3", "", {}, "sha512-Fu4hJdvzeylCfQPp9SGWidpzrMs7tTrlu6Vb8XGaRGck8QSNZJJp538Wrb60Lax4fPwR64ViY468OIUTbRlGZg=="],
"common-ancestor-path": ["common-ancestor-path@1.0.1", "", {}, "sha512-L3sHRo1pXXEqX8VU28kfgUY+YGsk09hPqZiZmLacNib6XNTCM8ubYeT7ryXQw8asB1sKgcU5lkB7ONug08aB8w=="],
"content-disposition": ["content-disposition@1.0.0", "", { "dependencies": { "safe-buffer": "5.2.1" } }, "sha512-Au9nRL8VNUut/XSzbQA38+M78dzP4D+eqg3gfJHMIHHYa3bg067xj1KxMUWj+VULbiZMowKngFFbKczUrNJ1mg=="],
"content-type": ["content-type@1.0.5", "", {}, "sha512-nTjqfcBFEipKdXCv4YDQWCfmcLZKm81ldF0pAopTvyrFGVbcR6P/VAAd5G7N+0tTr8QqiU0tFadD6FK4NtJwOA=="],
"convert-source-map": ["convert-source-map@2.0.0", "", {}, "sha512-Kvp459HrV2FEJ1CAsi1Ku+MY3kasH19TFykTz2xWmMeq6bk2NU3XXvfJ+Q61m0xktWwt+1HSYf3JZsTms3aRJg=="],
"cookie": ["cookie@1.0.2", "", {}, "sha512-9Kr/j4O16ISv8zBBhJoi4bXOYNTkFLOqSL3UDB0njXxCXNezjeyVrJyGOWtgfs/q2km1gwBcfH8q1yEGoMYunA=="],
"cookie-es": ["cookie-es@1.2.2", "", {}, "sha512-+W7VmiVINB+ywl1HGXJXmrqkOhpKrIiVZV6tQuV54ZyQC7MMuBt81Vc336GMLoHBq5hV/F9eXgt5Mnx0Rha5Fg=="],
"cookie-signature": ["cookie-signature@1.2.2", "", {}, "sha512-D76uU73ulSXrD1UXF4KE2TMxVVwhsnCgfAyTg9k8P6KGZjlXKrOLe4dJQKI3Bxi5wjesZoFXJWElNWBjPZMbhg=="],
"cors": ["cors@2.8.5", "", { "dependencies": { "object-assign": "^4", "vary": "^1" } }, "sha512-KIHbLJqu73RGr/hnbrO9uBeixNGuvSQjul/jdFvS/KFSIH1hWVd1ng7zOHx+YrEfInLG7q4n6GHQ9cDtxv/P6g=="],
"cross-fetch": ["cross-fetch@3.2.0", "", { "dependencies": { "node-fetch": "^2.7.0" } }, "sha512-Q+xVJLoGOeIMXZmbUK4HYk+69cQH6LudR0Vu/pRm2YlU/hDV9CiS0gKUMaWY5f2NeUH9C1nV3bsTlCo0FsTV1Q=="],
"crossws": ["crossws@0.3.5", "", { "dependencies": { "uncrypto": "^0.1.3" } }, "sha512-ojKiDvcmByhwa8YYqbQI/hg7MEU0NC03+pSdEq4ZUnZR9xXpwk7E43SMNGkn+JxJGPFtNvQ48+vV2p+P1ml5PA=="],
"css-selector-parser": ["css-selector-parser@3.1.2", "", {}, "sha512-WfUcL99xWDs7b3eZPoRszWVfbNo8ErCF15PTvVROjkShGlAfjIkG6hlfj/sl6/rfo5Q9x9ryJ3VqVnAZDA+gcw=="],
"css-tree": ["css-tree@3.1.0", "", { "dependencies": { "mdn-data": "2.12.2", "source-map-js": "^1.0.1" } }, "sha512-0eW44TGN5SQXU1mWSkKwFstI/22X2bG1nYzZTYMAWjylYURhse752YgbE4Cx46AC+bAvI+/dYTPRk1LqSUnu6w=="],
"cssesc": ["cssesc@3.0.0", "", { "bin": { "cssesc": "bin/cssesc" } }, "sha512-/Tb/JcjK111nNScGob5MNtsntNM1aCNUDipB/TkwZFhyDrrE47SOx/18wF2bbjgc3ZzCSKW1T5nt5EbFoAz/Vg=="],
"csstype": ["csstype@3.1.3", "", {}, "sha512-M1uQkMl8rQK/szD0LNhtqxIPLpimGm8sOBwU7lLnCpSbTyY3yeU1Vc7l4KT5zT4s/yOxHH5O7tIuuLOCnLADRw=="],
"dateformat": ["dateformat@4.6.3", "", {}, "sha512-2P0p0pFGzHS5EMnhdxQi7aJN+iMheud0UhG4dlE1DLAlvL8JHjJJTX/CSm4JXwV0Ka5nGk3zC5mcb5bUQUxxMA=="],
"debug": ["debug@4.4.1", "", { "dependencies": { "ms": "^2.1.3" } }, "sha512-KcKCqiftBJcZr++7ykoDIEwSa3XWowTfNPo92BYxjXiyYEVrUQh2aLyhxBCwww+heortUFxEJYcRzosstTEBYQ=="],
"decimal.js": ["decimal.js@10.5.0", "", {}, "sha512-8vDa8Qxvr/+d94hSh5P3IJwI5t8/c0KsMp+g8bNw9cY2icONa5aPfvKeieW1WlG0WQYwwhJ7mjui2xtiePQSXw=="],
"decode-named-character-reference": ["decode-named-character-reference@1.1.0", "", { "dependencies": { "character-entities": "^2.0.0" } }, "sha512-Wy+JTSbFThEOXQIR2L6mxJvEs+veIzpmqD7ynWxMXGpnk3smkHQOp6forLdHsKpAMW9iJpaBBIxz285t1n1C3w=="],
"decompress-response": ["decompress-response@6.0.0", "", { "dependencies": { "mimic-response": "^3.1.0" } }, "sha512-aW35yZM6Bb/4oJlZncMH2LCoZtJXTRxES17vE3hoRiowU2kWHaJKFkSBDnDR+cm9J+9QhXmREyIfv0pji9ejCQ=="],
"deep-extend": ["deep-extend@0.6.0", "", {}, "sha512-LOHxIOaPYdHlJRtCQfDIVZtfw/ufM8+rVj649RIHzcm/vGwQRXFt6OPqIFWsm2XEMrNIEtWR64sY1LEKD2vAOA=="],
"define-data-property": ["define-data-property@1.1.4", "", { "dependencies": { "es-define-property": "^1.0.0", "es-errors": "^1.3.0", "gopd": "^1.0.1" } }, "sha512-rBMvIzlpA8v6E+SJZoo++HAYqsLrkg7MSfIinMPFhmkorw7X+dOXVJQs+QT69zGkzMyfDnIMN2Wid1+NbL3T+A=="],
"defu": ["defu@6.1.4", "", {}, "sha512-mEQCMmwJu317oSz8CwdIOdwf3xMif1ttiM8LTufzc3g6kR+9Pe236twL8j3IYT1F7GfRgGcW6MWxzZjLIkuHIg=="],
"depd": ["depd@2.0.0", "", {}, "sha512-g7nH6P6dyDioJogAAGprGpCtVImJhpPk/roCzdb3fIh61/s/nPsfR6onyMwkCAR/OlC3yBC0lESvUoQEAssIrw=="],
"dequal": ["dequal@2.0.3", "", {}, "sha512-0je+qPKHEMohvfRTCEo3CrPG6cAzAYgmzKyxRiYSSDkS6eGJdyVJm7WaYA5ECaAD9wLB2T4EEeymA5aFVcYXCA=="],
"destr": ["destr@2.0.5", "", {}, "sha512-ugFTXCtDZunbzasqBxrK93Ik/DRYsO6S/fedkWEMKqt04xZ4csmnmwGDBAb07QWNaGMAmnTIemsYZCksjATwsA=="],
"detect-libc": ["detect-libc@2.0.4", "", {}, "sha512-3UDv+G9CsCKO1WKMGw9fwq/SWJYbI0c5Y7LU1AXYoDdbhE2AHQ6N6Nb34sG8Fj7T5APy8qXDCKuuIHd1BR0tVA=="],
"deterministic-object-hash": ["deterministic-object-hash@2.0.2", "", { "dependencies": { "base-64": "^1.0.0" } }, "sha512-KxektNH63SrbfUyDiwXqRb1rLwKt33AmMv+5Nhsw1kqZ13SJBRTgZHtGbE+hH3a1mVW1cz+4pqSWVPAtLVXTzQ=="],
"devalue": ["devalue@5.1.1", "", {}, "sha512-maua5KUiapvEwiEAe+XnlZ3Rh0GD+qI1J/nb9vrJc3muPXvcF/8gXYTWF76+5DAqHyDUtOIImEuo0YKE9mshVw=="],
"devlop": ["devlop@1.1.0", "", { "dependencies": { "dequal": "^2.0.0" } }, "sha512-RWmIqhcFf1lRYBvNmr7qTNuyCt/7/ns2jbpp1+PalgE/rDQcBT0fioSMUpJ93irlUhC5hrg4cYqe6U+0ImW0rA=="],
"dfa": ["dfa@1.2.0", "", {}, "sha512-ED3jP8saaweFTjeGX8HQPjeC1YYyZs98jGNZx6IiBvxW7JG5v492kamAQB3m2wop07CvU/RQmzcKr6bgcC5D/Q=="],
"diff": ["diff@8.0.2", "", {}, "sha512-sSuxWU5j5SR9QQji/o2qMvqRNYRDOcBTgsJ/DeCf4iSN4gW+gNMXM7wFIP+fdXZxoNiAnHUTGjCr+TSWXdRDKg=="],
"direction": ["direction@2.0.1", "", { "bin": { "direction": "cli.js" } }, "sha512-9S6m9Sukh1cZNknO1CWAr2QAWsbKLafQiyM5gZ7VgXHeuaoUwffKN4q6NC4A/Mf9iiPlOXQEKW/Mv/mh9/3YFA=="],
"dlv": ["dlv@1.1.3", "", {}, "sha512-+HlytyjlPKnIG8XuRG8WvmBP8xs8P71y+SKKS6ZXWoEgLuePxtDoUEiH7WkdePWrQ5JBpE6aoVqfZfJUQkjXwA=="],
"dset": ["dset@3.1.4", "", {}, "sha512-2QF/g9/zTaPDc3BjNcVTGoBbXBgYfMTTceLaYcFJ/W9kggFUkhxD/hMEeuLKbugyef9SqAx8cpgwlIP/jinUTA=="],
"dunder-proto": ["dunder-proto@1.0.1", "", { "dependencies": { "call-bind-apply-helpers": "^1.0.1", "es-errors": "^1.3.0", "gopd": "^1.2.0" } }, "sha512-KIN/nDJBQRcXw0MLVhZE9iQHmG68qAVIBg9CqmUYjmQIhgij9U5MFvrqkUL5FbtyyzZuOeOt0zdeRe4UY7ct+A=="],
"duplexify": ["duplexify@4.1.3", "", { "dependencies": { "end-of-stream": "^1.4.1", "inherits": "^2.0.3", "readable-stream": "^3.1.1", "stream-shift": "^1.0.2" } }, "sha512-M3BmBhwJRZsSx38lZyhE53Csddgzl5R7xGJNk7CVddZD6CcmwMCH8J+7AprIrQKH7TonKxaCjcv27Qmf+sQ+oA=="],
"ee-first": ["ee-first@1.1.1", "", {}, "sha512-WMwm9LhRUo+WUaRN+vRuETqG89IgZphVSNkdFgeb6sS/E4OrDIN7t48CAewSHXc6C8lefD8KKfr5vY61brQlow=="],
"electron-to-chromium": ["electron-to-chromium@1.5.161", "", {}, "sha512-hwtetwfKNZo/UlwHIVBlKZVdy7o8bIZxxKs0Mv/ROPiQQQmDgdm5a+KvKtBsxM8ZjFzTaCeLoodZ8jiBE3o9rA=="],
"emoji-regex": ["emoji-regex@10.4.0", "", {}, "sha512-EC+0oUMY1Rqm4O6LLrgjtYDvcVYTy7chDnM4Q7030tP4Kwj3u/pR6gP9ygnp2CJMK5Gq+9Q2oqmrFJAz01DXjw=="],
"encodeurl": ["encodeurl@2.0.0", "", {}, "sha512-Q0n9HRi4m6JuGIV1eFlmvJB7ZEVxu93IrMyiMsGC0lrMJMWzRgx6WGquyfQgZVb31vhGgXnfmPNNXmxnOkRBrg=="],
"end-of-stream": ["end-of-stream@1.4.4", "", { "dependencies": { "once": "^1.4.0" } }, "sha512-+uw1inIHVPQoaVuHzRyXd21icM+cnt4CzD5rW+NC1wjOUSTOs+Te7FOv7AhN7vS9x/oIyhLP5PR1H+phQAHu5Q=="],
"entities": ["entities@6.0.0", "", {}, "sha512-aKstq2TDOndCn4diEyp9Uq/Flu2i1GlLkc6XIDQSDMuaFE3OPW5OphLCyQ5SpSJZTb4reN+kTcYru5yIfXoRPw=="],
"env-paths": ["env-paths@3.0.0", "", {}, "sha512-dtJUTepzMW3Lm/NPxRf3wP4642UWhjL2sQxc+ym2YMj1m/H2zDNQOlezafzkHwn6sMstjHTwG6iQQsctDW/b1A=="],
"es-define-property": ["es-define-property@1.0.1", "", {}, "sha512-e3nRfgfUZ4rNGL232gUgX06QNyyez04KdjFrF+LTRoOXmrOgFKDg4BCdsjW8EnT69eqdYGmRpJwiPVYNrCaW3g=="],
"es-errors": ["es-errors@1.3.0", "", {}, "sha512-Zf5H2Kxt2xjTvbJvP2ZWLEICxA6j+hAmMzIlypy4xcBg1vKVnx89Wy0GbS+kf5cwCVFFzdCFh2XSCFNULS6csw=="],
"es-module-lexer": ["es-module-lexer@1.7.0", "", {}, "sha512-jEQoCwk8hyb2AZziIOLhDqpm5+2ww5uIE6lkO/6jcOCusfk6LhMHpXXfBLXTZ7Ydyt0j4VoUQv6uGNYbdW+kBA=="],
"es-object-atoms": ["es-object-atoms@1.1.1", "", { "dependencies": { "es-errors": "^1.3.0" } }, "sha512-FGgH2h8zKNim9ljj7dankFPcICIK9Cp5bm+c2gQSYePhpaG5+esrLODihIorn+Pe6FGJzWhXQotPv73jTaldXA=="],
"esast-util-from-estree": ["esast-util-from-estree@2.0.0", "", { "dependencies": { "@types/estree-jsx": "^1.0.0", "devlop": "^1.0.0", "estree-util-visit": "^2.0.0", "unist-util-position-from-estree": "^2.0.0" } }, "sha512-4CyanoAudUSBAn5K13H4JhsMH6L9ZP7XbLVe/dKybkxMO7eDyLsT8UHl9TRNrU2Gr9nz+FovfSIjuXWJ81uVwQ=="],
"esast-util-from-js": ["esast-util-from-js@2.0.1", "", { "dependencies": { "@types/estree-jsx": "^1.0.0", "acorn": "^8.0.0", "esast-util-from-estree": "^2.0.0", "vfile-message": "^4.0.0" } }, "sha512-8Ja+rNJ0Lt56Pcf3TAmpBZjmx8ZcK5Ts4cAzIOjsjevg9oSXJnl6SUQ2EevU8tv3h6ZLWmoKL5H4fgWvdvfETw=="],
"esbuild": ["esbuild@0.25.5", "", { "optionalDependencies": { "@esbuild/aix-ppc64": "0.25.5", "@esbuild/android-arm": "0.25.5", "@esbuild/android-arm64": "0.25.5", "@esbuild/android-x64": "0.25.5", "@esbuild/darwin-arm64": "0.25.5", "@esbuild/darwin-x64": "0.25.5", "@esbuild/freebsd-arm64": "0.25.5", "@esbuild/freebsd-x64": "0.25.5", "@esbuild/linux-arm": "0.25.5", "@esbuild/linux-arm64": "0.25.5", "@esbuild/linux-ia32": "0.25.5", "@esbuild/linux-loong64": "0.25.5", "@esbuild/linux-mips64el": "0.25.5", "@esbuild/linux-ppc64": "0.25.5", "@esbuild/linux-riscv64": "0.25.5", "@esbuild/linux-s390x": "0.25.5", "@esbuild/linux-x64": "0.25.5", "@esbuild/netbsd-arm64": "0.25.5", "@esbuild/netbsd-x64": "0.25.5", "@esbuild/openbsd-arm64": "0.25.5", "@esbuild/openbsd-x64": "0.25.5", "@esbuild/sunos-x64": "0.25.5", "@esbuild/win32-arm64": "0.25.5", "@esbuild/win32-ia32": "0.25.5", "@esbuild/win32-x64": "0.25.5" }, "bin": { "esbuild": "bin/esbuild" } }, "sha512-P8OtKZRv/5J5hhz0cUAdu/cLuPIKXpQl1R9pZtvmHWQvrAUVd0UNIPT4IB4W3rNOqVO0rlqHmCIbSwxh/c9yUQ=="],
"escalade": ["escalade@3.2.0", "", {}, "sha512-WUj2qlxaQtO4g6Pq5c29GTcWGDyd8itL8zTlipgECz3JesAiiOKotd8JU6otB3PACgG6xkJUyVhboMS+bje/jA=="],
"escape-html": ["escape-html@1.0.3", "", {}, "sha512-NiSupZ4OeuGwr68lGIeym/ksIZMJodUGOSCZ/FSnTxcrekbvqrgdUxlJOMpijaKZVjAJrWrGs/6Jy8OMuyj9ow=="],
"escape-string-regexp": ["escape-string-regexp@1.0.5", "", {}, "sha512-vbRorB5FUQWvla16U8R/qgaFIya2qGzwDrNmCZuYKrbdSUMG6I1ZCGQRefkRVhuOkIGVne7BQ35DSfo1qvJqFg=="],
"estree-util-attach-comments": ["estree-util-attach-comments@3.0.0", "", { "dependencies": { "@types/estree": "^1.0.0" } }, "sha512-cKUwm/HUcTDsYh/9FgnuFqpfquUbwIqwKM26BVCGDPVgvaCl/nDCCjUfiLlx6lsEZ3Z4RFxNbOQ60pkaEwFxGw=="],
"estree-util-build-jsx": ["estree-util-build-jsx@3.0.1", "", { "dependencies": { "@types/estree-jsx": "^1.0.0", "devlop": "^1.0.0", "estree-util-is-identifier-name": "^3.0.0", "estree-walker": "^3.0.0" } }, "sha512-8U5eiL6BTrPxp/CHbs2yMgP8ftMhR5ww1eIKoWRMlqvltHF8fZn5LRDvTKuxD3DUn+shRbLGqXemcP51oFCsGQ=="],
"estree-util-is-identifier-name": ["estree-util-is-identifier-name@3.0.0", "", {}, "sha512-hFtqIDZTIUZ9BXLb8y4pYGyk6+wekIivNVTcmvk8NoOh+VeRn5y6cEHzbURrWbfp1fIqdVipilzj+lfaadNZmg=="],
"estree-util-scope": ["estree-util-scope@1.0.0", "", { "dependencies": { "@types/estree": "^1.0.0", "devlop": "^1.0.0" } }, "sha512-2CAASclonf+JFWBNJPndcOpA8EMJwa0Q8LUFJEKqXLW6+qBvbFZuF5gItbQOs/umBUkjviCSDCbBwU2cXbmrhQ=="],
"estree-util-to-js": ["estree-util-to-js@2.0.0", "", { "dependencies": { "@types/estree-jsx": "^1.0.0", "astring": "^1.8.0", "source-map": "^0.7.0" } }, "sha512-WDF+xj5rRWmD5tj6bIqRi6CkLIXbbNQUcxQHzGysQzvHmdYG2G7p/Tf0J0gpxGgkeMZNTIjT/AoSvC9Xehcgdg=="],
"estree-util-visit": ["estree-util-visit@2.0.0", "", { "dependencies": { "@types/estree-jsx": "^1.0.0", "@types/unist": "^3.0.0" } }, "sha512-m5KgiH85xAhhW8Wta0vShLcUvOsh3LLPI2YVwcbio1l7E09NTLL1EyMZFM1OyWowoH0skScNbhOPl4kcBgzTww=="],
"estree-walker": ["estree-walker@3.0.3", "", { "dependencies": { "@types/estree": "^1.0.0" } }, "sha512-7RUKfXgSMMkzt6ZuXmqapOurLGPPfgj6l9uRZ7lRGolvk0y2yocc35LdcxKC5PQZdn2DMqioAQ2NoWcrTKmm6g=="],
"etag": ["etag@1.8.1", "", {}, "sha512-aIL5Fx7mawVa300al2BnEE4iNvo1qETxLrPI/o05L7z6go7fCw1J6EQmbK4FmJ2AS7kgVF/KEZWufBfdClMcPg=="],
"eventemitter3": ["eventemitter3@5.0.1", "", {}, "sha512-GWkBvjiSZK87ELrYOSESUYeVIc9mvLLf/nXalMOS5dYrgZq9o5OVkbZAVM06CVxYsCwH9BDZFPlQTlPA1j4ahA=="],
"events": ["events@1.1.1", "", {}, "sha512-kEcvvCBByWXGnZy6JUlgAp2gBIUjfCAV6P6TgT1/aaQKcmuAEC4OZTV1I4EWQLz2gxZw76atuVyvHhTxvi0Flw=="],
"eventsource": ["eventsource@3.0.7", "", { "dependencies": { "eventsource-parser": "^3.0.1" } }, "sha512-CRT1WTyuQoD771GW56XEZFQ/ZoSfWid1alKGDYMmkt2yl8UXrVR4pspqWNEcqKvVIzg6PAltWjxcSSPrboA4iA=="],
"eventsource-parser": ["eventsource-parser@3.0.2", "", {}, "sha512-6RxOBZ/cYgd8usLwsEl+EC09Au/9BcmCKYF2/xbml6DNczf7nv0MQb+7BA2F+li6//I+28VNlQR37XfQtcAJuA=="],
"expand-template": ["expand-template@2.0.3", "", {}, "sha512-XYfuKMvj4O35f/pOXLObndIRvyQ+/+6AhODh+OKWj9S9498pHHn/IMszH+gt0fBCRWMNfk1ZSp5x3AifmnI2vg=="],
"express": ["express@5.1.0", "", { "dependencies": { "accepts": "^2.0.0", "body-parser": "^2.2.0", "content-disposition": "^1.0.0", "content-type": "^1.0.5", "cookie": "^0.7.1", "cookie-signature": "^1.2.1", "debug": "^4.4.0", "encodeurl": "^2.0.0", "escape-html": "^1.0.3", "etag": "^1.8.1", "finalhandler": "^2.1.0", "fresh": "^2.0.0", "http-errors": "^2.0.0", "merge-descriptors": "^2.0.0", "mime-types": "^3.0.0", "on-finished": "^2.4.1", "once": "^1.4.0", "parseurl": "^1.3.3", "proxy-addr": "^2.0.7", "qs": "^6.14.0", "range-parser": "^1.2.1", "router": "^2.2.0", "send": "^1.1.0", "serve-static": "^2.2.0", "statuses": "^2.0.1", "type-is": "^2.0.1", "vary": "^1.1.2" } }, "sha512-DT9ck5YIRU+8GYzzU5kT3eHGA5iL+1Zd0EutOmTE9Dtk+Tvuzd23VBU+ec7HPNSTxXYO55gPV/hq4pSBJDjFpA=="],
"express-rate-limit": ["express-rate-limit@7.5.0", "", { "peerDependencies": { "express": "^4.11 || 5 || ^5.0.0-beta.1" } }, "sha512-eB5zbQh5h+VenMPM3fh+nw1YExi5nMr6HUCR62ELSP11huvxm/Uir1H1QEyTkk5QX6A58pX6NmaTMceKZ0Eodg=="],
"expressive-code": ["expressive-code@0.41.2", "", { "dependencies": { "@expressive-code/core": "^0.41.2", "@expressive-code/plugin-frames": "^0.41.2", "@expressive-code/plugin-shiki": "^0.41.2", "@expressive-code/plugin-text-markers": "^0.41.2" } }, "sha512-aLZiZaqorRtNExtGpUjK9zFH9aTpWeoTXMyLo4b4IcuXfPqtLPPxhRm/QlPb8QqIcMMXnSiGRHSFpQfX0m7HJw=="],
"extend": ["extend@3.0.2", "", {}, "sha512-fjquC59cD7CyW6urNXK0FBufkZcoiGG80wTuPujX590cB5Ttln20E2UB4S/WARVqhXffZl2LNgS+gQdPIIim/g=="],
"fast-deep-equal": ["fast-deep-equal@3.1.3", "", {}, "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q=="],
"fast-fifo": ["fast-fifo@1.3.2", "", {}, "sha512-/d9sfos4yxzpwkDkuN7k2SqFKtYNmCTzgfEpz82x34IM9/zc8KGxQoXg1liNC/izpRM/MBdt44Nmx41ZWqk+FQ=="],
"fast-redact": ["fast-redact@3.5.0", "", {}, "sha512-dwsoQlS7h9hMeYUq1W++23NDcBLV4KqONnITDV9DjfS3q1SgDGVrBdvvTLUotWtPSD7asWDV9/CmsZPy8Hf70A=="],
"fast-safe-stringify": ["fast-safe-stringify@2.1.1", "", {}, "sha512-W+KJc2dmILlPplD/H4K9l9LcAHAfPtP6BY84uVLXQ6Evcz9Lcg33Y2z1IVblT6xdY54PXYVHEv+0Wpq8Io6zkA=="],
"fdir": ["fdir@6.4.5", "", { "peerDependencies": { "picomatch": "^3 || ^4" }, "optionalPeers": ["picomatch"] }, "sha512-4BG7puHpVsIYxZUbiUE3RqGloLaSSwzYie5jvasC4LWuBWzZawynvYouhjbQKw2JuIGYdm0DzIxl8iVidKlUEw=="],
"fflate": ["fflate@0.8.2", "", {}, "sha512-cPJU47OaAoCbg0pBvzsgpTPhmhqI5eJjh/JIu8tPj5q+T7iLvW/JAYUqmE7KOB4R1ZyEhzBaIQpQpardBF5z8A=="],
"file-type": ["file-type@20.5.0", "", { "dependencies": { "@tokenizer/inflate": "^0.2.6", "strtok3": "^10.2.0", "token-types": "^6.0.0", "uint8array-extras": "^1.4.0" } }, "sha512-BfHZtG/l9iMm4Ecianu7P8HRD2tBHLtjXinm4X62XBOYzi7CYA7jyqfJzOvXHqzVrVPYqBo2/GvbARMaaJkKVg=="],
"finalhandler": ["finalhandler@2.1.0", "", { "dependencies": { "debug": "^4.4.0", "encodeurl": "^2.0.0", "escape-html": "^1.0.3", "on-finished": "^2.4.1", "parseurl": "^1.3.3", "statuses": "^2.0.1" } }, "sha512-/t88Ty3d5JWQbWYgaOGCCYfXRwV1+be02WqYYlL6h0lEiUAMPM8o8qKGO01YIkOHzka2up08wvgYD0mDiI+q3Q=="],
"flattie": ["flattie@1.1.1", "", {}, "sha512-9UbaD6XdAL97+k/n+N7JwX46K/M6Zc6KcFYskrYL8wbBV/Uyk0CTAMY0VT+qiK5PM7AIc9aTWYtq65U7T+aCNQ=="],
"fontace": ["fontace@0.3.0", "", { "dependencies": { "@types/fontkit": "^2.0.8", "fontkit": "^2.0.4" } }, "sha512-czoqATrcnxgWb/nAkfyIrRp6Q8biYj7nGnL6zfhTcX+JKKpWHFBnb8uNMw/kZr7u++3Y3wYSYoZgHkCcsuBpBg=="],
"fontkit": ["fontkit@2.0.4", "", { "dependencies": { "@swc/helpers": "^0.5.12", "brotli": "^1.3.2", "clone": "^2.1.2", "dfa": "^1.2.0", "fast-deep-equal": "^3.1.3", "restructure": "^3.0.0", "tiny-inflate": "^1.0.3", "unicode-properties": "^1.4.0", "unicode-trie": "^2.0.0" } }, "sha512-syetQadaUEDNdxdugga9CpEYVaQIxOwk7GlwZWWZ19//qW4zE5bknOKeMBDYAASwnpaSHKJITRLMF9m1fp3s6g=="],
"for-each": ["for-each@0.3.5", "", { "dependencies": { "is-callable": "^1.2.7" } }, "sha512-dKx12eRCVIzqCxFGplyFKJMPvLEWgmNtUrpTiJIR5u97zEhRG8ySrtboPHZXx7daLxQVrl643cTzbab2tkQjxg=="],
"forwarded": ["forwarded@0.2.0", "", {}, "sha512-buRG0fpBtRHSTCOASe6hD258tEubFoRLb4ZNA6NxMVHNw2gOcwHo9wyablzMzOA5z9xA9L1KNjk/Nt6MT9aYow=="],
"fresh": ["fresh@2.0.0", "", {}, "sha512-Rx/WycZ60HOaqLKAi6cHRKKI7zxWbJ31MhntmtwMoaTeF7XFH9hhBp8vITaMidfljRQ6eYWCKkaTK+ykVJHP2A=="],
"fs-constants": ["fs-constants@1.0.0", "", {}, "sha512-y6OAwoSIf7FyjMIv94u+b5rdheZEjzR63GTyZJm5qh4Bi+2YgwLCcI/fPFZkL5PSixOt6ZNKm+w+Hfp/Bciwow=="],
"fsevents": ["fsevents@2.3.3", "", { "os": "darwin" }, "sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw=="],
"function-bind": ["function-bind@1.1.2", "", {}, "sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA=="],
"gensync": ["gensync@1.0.0-beta.2", "", {}, "sha512-3hN7NaskYvMDLQY55gnW3NQ+mesEAepTqlg+VEbj7zzqEMBVNhzcGYYeqFo/TlYz6eQiFcp1HcsCZO+nGgS8zg=="],
"get-east-asian-width": ["get-east-asian-width@1.3.0", "", {}, "sha512-vpeMIQKxczTD/0s2CdEWHcb0eeJe6TFjxb+J5xgX7hScxqrGuyjmv4c1D4A/gelKfyox0gJJwIHF+fLjeaM8kQ=="],
"get-intrinsic": ["get-intrinsic@1.3.0", "", { "dependencies": { "call-bind-apply-helpers": "^1.0.2", "es-define-property": "^1.0.1", "es-errors": "^1.3.0", "es-object-atoms": "^1.1.1", "function-bind": "^1.1.2", "get-proto": "^1.0.1", "gopd": "^1.2.0", "has-symbols": "^1.1.0", "hasown": "^2.0.2", "math-intrinsics": "^1.1.0" } }, "sha512-9fSjSaos/fRIVIp+xSJlE6lfwhES7LNtKaCBIamHsjr2na1BiABJPo0mOjjz8GJDURarmCPGqaiVg5mfjb98CQ=="],
"get-proto": ["get-proto@1.0.1", "", { "dependencies": { "dunder-proto": "^1.0.1", "es-object-atoms": "^1.0.0" } }, "sha512-sTSfBjoXBp89JvIKIefqw7U2CCebsc74kiY6awiGogKtoSGbgjYE/G/+l9sF3MWFPNc9IcoOC4ODfKHfxFmp0g=="],
"github-from-package": ["github-from-package@0.0.0", "", {}, "sha512-SyHy3T1v2NUXn29OsWdxmK6RwHD+vkj3v8en8AOBZ1wBQ/hCAQ5bAQTD02kW4W9tUp/3Qh6J8r9EvntiyCmOOw=="],
"github-slugger": ["github-slugger@2.0.0", "", {}, "sha512-IaOQ9puYtjrkq7Y0Ygl9KDZnrf/aiUJYUpVf89y8kyaxbRG7Y1SrX/jaumrv81vc61+kiMempujsM3Yw7w5qcw=="],
"globals": ["globals@11.12.0", "", {}, "sha512-WOBp/EEGUiIsJSp7wcv/y6MO+lV9UoncWqxuFfm8eBwzWNgyfBd6Gz+IeKQ9jCmyhoH99g15M3T+QaVHFjizVA=="],
"gopd": ["gopd@1.2.0", "", {}, "sha512-ZUKRh6/kUFoAiTAtTYPZJ3hw9wNxx+BIBOijnlG9PnrJsCcSjs1wyyD6vJpaYtgnzDrKYRSqf3OO6Rfa93xsRg=="],
"h3": ["h3@1.15.3", "", { "dependencies": { "cookie-es": "^1.2.2", "crossws": "^0.3.4", "defu": "^6.1.4", "destr": "^2.0.5", "iron-webcrypto": "^1.2.1", "node-mock-http": "^1.0.0", "radix3": "^1.1.2", "ufo": "^1.6.1", "uncrypto": "^0.1.3" } }, "sha512-z6GknHqyX0h9aQaTx22VZDf6QyZn+0Nh+Ym8O/u0SGSkyF5cuTJYKlc8MkzW3Nzf9LE1ivcpmYC3FUGpywhuUQ=="],
"has-flag": ["has-flag@4.0.0", "", {}, "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ=="],
"has-property-descriptors": ["has-property-descriptors@1.0.2", "", { "dependencies": { "es-define-property": "^1.0.0" } }, "sha512-55JNKuIW+vq4Ke1BjOTjM2YctQIvCT7GFzHwmfZPGo5wnrgkid0YQtnAleFSqumZm4az3n2BS+erby5ipJdgrg=="],
"has-symbols": ["has-symbols@1.1.0", "", {}, "sha512-1cDNdwJ2Jaohmb3sg4OmKaMBwuC48sYni5HUw2DvsC8LjGTLK9h+eb1X6RyuOHe4hT0ULCW68iomhjUoKUqlPQ=="],
"has-tostringtag": ["has-tostringtag@1.0.2", "", { "dependencies": { "has-symbols": "^1.0.3" } }, "sha512-NqADB8VjPFLM2V0VvHUewwwsw0ZWBaIdgo+ieHtK3hasLz4qeCRjYcqfB6AQrBggRKppKF8L52/VqdVsO47Dlw=="],
"hasown": ["hasown@2.0.2", "", { "dependencies": { "function-bind": "^1.1.2" } }, "sha512-0hJU9SCPvmMzIBdZFqNPXWa6dqh7WdH0cII9y+CyS8rG3nL48Bclra9HmKhVVUHyPWNH5Y7xDwAB7bfgSjkUMQ=="],
"hast-util-embedded": ["hast-util-embedded@3.0.0", "", { "dependencies": { "@types/hast": "^3.0.0", "hast-util-is-element": "^3.0.0" } }, "sha512-naH8sld4Pe2ep03qqULEtvYr7EjrLK2QHY8KJR6RJkTUjPGObe1vnx585uzem2hGra+s1q08DZZpfgDVYRbaXA=="],
"hast-util-format": ["hast-util-format@1.1.0", "", { "dependencies": { "@types/hast": "^3.0.0", "hast-util-embedded": "^3.0.0", "hast-util-minify-whitespace": "^1.0.0", "hast-util-phrasing": "^3.0.0", "hast-util-whitespace": "^3.0.0", "html-whitespace-sensitive-tag-names": "^3.0.0", "unist-util-visit-parents": "^6.0.0" } }, "sha512-yY1UDz6bC9rDvCWHpx12aIBGRG7krurX0p0Fm6pT547LwDIZZiNr8a+IHDogorAdreULSEzP82Nlv5SZkHZcjA=="],
"hast-util-from-html": ["hast-util-from-html@2.0.3", "", { "dependencies": { "@types/hast": "^3.0.0", "devlop": "^1.1.0", "hast-util-from-parse5": "^8.0.0", "parse5": "^7.0.0", "vfile": "^6.0.0", "vfile-message": "^4.0.0" } }, "sha512-CUSRHXyKjzHov8yKsQjGOElXy/3EKpyX56ELnkHH34vDVw1N1XSQ1ZcAvTyAPtGqLTuKP/uxM+aLkSPqF/EtMw=="],
"hast-util-from-parse5": ["hast-util-from-parse5@8.0.3", "", { "dependencies": { "@types/hast": "^3.0.0", "@types/unist": "^3.0.0", "devlop": "^1.0.0", "hastscript": "^9.0.0", "property-information": "^7.0.0", "vfile": "^6.0.0", "vfile-location": "^5.0.0", "web-namespaces": "^2.0.0" } }, "sha512-3kxEVkEKt0zvcZ3hCRYI8rqrgwtlIOFMWkbclACvjlDw8Li9S2hk/d51OI0nr/gIpdMHNepwgOKqZ/sy0Clpyg=="],
"hast-util-has-property": ["hast-util-has-property@3.0.0", "", { "dependencies": { "@types/hast": "^3.0.0" } }, "sha512-MNilsvEKLFpV604hwfhVStK0usFY/QmM5zX16bo7EjnAEGofr5YyI37kzopBlZJkHD4t887i+q/C8/tr5Q94cA=="],
"hast-util-heading-rank": ["hast-util-heading-rank@3.0.0", "", { "dependencies": { "@types/hast": "^3.0.0" } }, "sha512-EJKb8oMUXVHcWZTDepnr+WNbfnXKFNf9duMesmr4S8SXTJBJ9M4Yok08pu9vxdJwdlGRhVumk9mEhkEvKGifwA=="],
"hast-util-is-body-ok-link": ["hast-util-is-body-ok-link@3.0.1", "", { "dependencies": { "@types/hast": "^3.0.0" } }, "sha512-0qpnzOBLztXHbHQenVB8uNuxTnm/QBFUOmdOSsEn7GnBtyY07+ENTWVFBAnXd/zEgd9/SUG3lRY7hSIBWRgGpQ=="],
"hast-util-is-element": ["hast-util-is-element@3.0.0", "", { "dependencies": { "@types/hast": "^3.0.0" } }, "sha512-Val9mnv2IWpLbNPqc/pUem+a7Ipj2aHacCwgNfTiK0vJKl0LF+4Ba4+v1oPHFpf3bLYmreq0/l3Gud9S5OH42g=="],
"hast-util-minify-whitespace": ["hast-util-minify-whitespace@1.0.1", "", { "dependencies": { "@types/hast": "^3.0.0", "hast-util-embedded": "^3.0.0", "hast-util-is-element": "^3.0.0", "hast-util-whitespace": "^3.0.0", "unist-util-is": "^6.0.0" } }, "sha512-L96fPOVpnclQE0xzdWb/D12VT5FabA7SnZOUMtL1DbXmYiHJMXZvFkIZfiMmTCNJHUeO2K9UYNXoVyfz+QHuOw=="],
"hast-util-parse-selector": ["hast-util-parse-selector@4.0.0", "", { "dependencies": { "@types/hast": "^3.0.0" } }, "sha512-wkQCkSYoOGCRKERFWcxMVMOcYE2K1AaNLU8DXS9arxnLOUEWbOXKXiJUNzEpqZ3JOKpnha3jkFrumEjVliDe7A=="],
"hast-util-phrasing": ["hast-util-phrasing@3.0.1", "", { "dependencies": { "@types/hast": "^3.0.0", "hast-util-embedded": "^3.0.0", "hast-util-has-property": "^3.0.0", "hast-util-is-body-ok-link": "^3.0.0", "hast-util-is-element": "^3.0.0" } }, "sha512-6h60VfI3uBQUxHqTyMymMZnEbNl1XmEGtOxxKYL7stY2o601COo62AWAYBQR9lZbYXYSBoxag8UpPRXK+9fqSQ=="],
"hast-util-raw": ["hast-util-raw@9.1.0", "", { "dependencies": { "@types/hast": "^3.0.0", "@types/unist": "^3.0.0", "@ungap/structured-clone": "^1.0.0", "hast-util-from-parse5": "^8.0.0", "hast-util-to-parse5": "^8.0.0", "html-void-elements": "^3.0.0", "mdast-util-to-hast": "^13.0.0", "parse5": "^7.0.0", "unist-util-position": "^5.0.0", "unist-util-visit": "^5.0.0", "vfile": "^6.0.0", "web-namespaces": "^2.0.0", "zwitch": "^2.0.0" } }, "sha512-Y8/SBAHkZGoNkpzqqfCldijcuUKh7/su31kEBp67cFY09Wy0mTRgtsLYsiIxMJxlu0f6AA5SUTbDR8K0rxnbUw=="],
"hast-util-select": ["hast-util-select@6.0.4", "", { "dependencies": { "@types/hast": "^3.0.0", "@types/unist": "^3.0.0", "bcp-47-match": "^2.0.0", "comma-separated-tokens": "^2.0.0", "css-selector-parser": "^3.0.0", "devlop": "^1.0.0", "direction": "^2.0.0", "hast-util-has-property": "^3.0.0", "hast-util-to-string": "^3.0.0", "hast-util-whitespace": "^3.0.0", "nth-check": "^2.0.0", "property-information": "^7.0.0", "space-separated-tokens": "^2.0.0", "unist-util-visit": "^5.0.0", "zwitch": "^2.0.0" } }, "sha512-RqGS1ZgI0MwxLaKLDxjprynNzINEkRHY2i8ln4DDjgv9ZhcYVIHN9rlpiYsqtFwrgpYU361SyWDQcGNIBVu3lw=="],
"hast-util-to-estree": ["hast-util-to-estree@3.1.3", "", { "dependencies": { "@types/estree": "^1.0.0", "@types/estree-jsx": "^1.0.0", "@types/hast": "^3.0.0", "comma-separated-tokens": "^2.0.0", "devlop": "^1.0.0", "estree-util-attach-comments": "^3.0.0", "estree-util-is-identifier-name": "^3.0.0", "hast-util-whitespace": "^3.0.0", "mdast-util-mdx-expression": "^2.0.0", "mdast-util-mdx-jsx": "^3.0.0", "mdast-util-mdxjs-esm": "^2.0.0", "property-information": "^7.0.0", "space-separated-tokens": "^2.0.0", "style-to-js": "^1.0.0", "unist-util-position": "^5.0.0", "zwitch": "^2.0.0" } }, "sha512-48+B/rJWAp0jamNbAAf9M7Uf//UVqAoMmgXhBdxTDJLGKY+LRnZ99qcG+Qjl5HfMpYNzS5v4EAwVEF34LeAj7w=="],
"hast-util-to-html": ["hast-util-to-html@9.0.5", "", { "dependencies": { "@types/hast": "^3.0.0", "@types/unist": "^3.0.0", "ccount": "^2.0.0", "comma-separated-tokens": "^2.0.0", "hast-util-whitespace": "^3.0.0", "html-void-elements": "^3.0.0", "mdast-util-to-hast": "^13.0.0", "property-information": "^7.0.0", "space-separated-tokens": "^2.0.0", "stringify-entities": "^4.0.0", "zwitch": "^2.0.4" } }, "sha512-OguPdidb+fbHQSU4Q4ZiLKnzWo8Wwsf5bZfbvu7//a9oTYoqD/fWpe96NuHkoS9h0ccGOTe0C4NGXdtS0iObOw=="],
"hast-util-to-jsx-runtime": ["hast-util-to-jsx-runtime@2.3.6", "", { "dependencies": { "@types/estree": "^1.0.0", "@types/hast": "^3.0.0", "@types/unist": "^3.0.0", "comma-separated-tokens": "^2.0.0", "devlop": "^1.0.0", "estree-util-is-identifier-name": "^3.0.0", "hast-util-whitespace": "^3.0.0", "mdast-util-mdx-expression": "^2.0.0", "mdast-util-mdx-jsx": "^3.0.0", "mdast-util-mdxjs-esm": "^2.0.0", "property-information": "^7.0.0", "space-separated-tokens": "^2.0.0", "style-to-js": "^1.0.0", "unist-util-position": "^5.0.0", "vfile-message": "^4.0.0" } }, "sha512-zl6s8LwNyo1P9uw+XJGvZtdFF1GdAkOg8ujOw+4Pyb76874fLps4ueHXDhXWdk6YHQ6OgUtinliG7RsYvCbbBg=="],
"hast-util-to-parse5": ["hast-util-to-parse5@8.0.0", "", { "dependencies": { "@types/hast": "^3.0.0", "comma-separated-tokens": "^2.0.0", "devlop": "^1.0.0", "property-information": "^6.0.0", "space-separated-tokens": "^2.0.0", "web-namespaces": "^2.0.0", "zwitch": "^2.0.0" } }, "sha512-3KKrV5ZVI8if87DVSi1vDeByYrkGzg4mEfeu4alwgmmIeARiBLKCZS2uw5Gb6nU9x9Yufyj3iudm6i7nl52PFw=="],
"hast-util-to-string": ["hast-util-to-string@3.0.1", "", { "dependencies": { "@types/hast": "^3.0.0" } }, "sha512-XelQVTDWvqcl3axRfI0xSeoVKzyIFPwsAGSLIsKdJKQMXDYJS4WYrBNF/8J7RdhIcFI2BOHgAifggsvsxp/3+A=="],
"hast-util-to-text": ["hast-util-to-text@4.0.2", "", { "dependencies": { "@types/hast": "^3.0.0", "@types/unist": "^3.0.0", "hast-util-is-element": "^3.0.0", "unist-util-find-after": "^5.0.0" } }, "sha512-KK6y/BN8lbaq654j7JgBydev7wuNMcID54lkRav1P0CaE1e47P72AWWPiGKXTJU271ooYzcvTAn/Zt0REnvc7A=="],
"hast-util-whitespace": ["hast-util-whitespace@3.0.0", "", { "dependencies": { "@types/hast": "^3.0.0" } }, "sha512-88JUN06ipLwsnv+dVn+OIYOvAuvBMy/Qoi6O7mQHxdPXpjy+Cd6xRkWwux7DKO+4sYILtLBRIKgsdpS2gQc7qw=="],
"hastscript": ["hastscript@9.0.1", "", { "dependencies": { "@types/hast": "^3.0.0", "comma-separated-tokens": "^2.0.0", "hast-util-parse-selector": "^4.0.0", "property-information": "^7.0.0", "space-separated-tokens": "^2.0.0" } }, "sha512-g7df9rMFX/SPi34tyGCyUBREQoKkapwdY/T04Qn9TDWfHhAYt4/I0gMVirzK5wEzeUqIjEB+LXC/ypb7Aqno5w=="],
"hono": ["hono@4.7.10", "", {}, "sha512-QkACju9MiN59CKSY5JsGZCYmPZkA6sIW6OFCUp7qDjZu6S6KHtJHhAc9Uy9mV9F8PJ1/HQ3ybZF2yjCa/73fvQ=="],
"hono-openapi": ["hono-openapi@0.4.8", "", { "dependencies": { "json-schema-walker": "^2.0.0" }, "peerDependencies": { "@hono/arktype-validator": "^2.0.0", "@hono/effect-validator": "^1.2.0", "@hono/typebox-validator": "^0.2.0 || ^0.3.0", "@hono/valibot-validator": "^0.5.1", "@hono/zod-validator": "^0.4.1", "@sinclair/typebox": "^0.34.9", "@valibot/to-json-schema": "^1.0.0-beta.3", "arktype": "^2.0.0", "effect": "^3.11.3", "hono": "^4.6.13", "openapi-types": "^12.1.3", "valibot": "^1.0.0-beta.9", "zod": "^3.23.8", "zod-openapi": "^4.0.0" }, "optionalPeers": ["@hono/arktype-validator", "@hono/effect-validator", "@hono/typebox-validator", "@hono/valibot-validator", "@hono/zod-validator", "@sinclair/typebox", "@valibot/to-json-schema", "arktype", "effect", "hono", "valibot", "zod", "zod-openapi"] }, "sha512-LYr5xdtD49M7hEAduV1PftOMzuT8ZNvkyWfh1DThkLsIr4RkvDb12UxgIiFbwrJB6FLtFXLoOZL9x4IeDk2+VA=="],
"html-entities": ["html-entities@2.3.3", "", {}, "sha512-DV5Ln36z34NNTDgnz0EWGBLZENelNAtkiFA4kyNOG2tDI6Mz1uSWiq1wAKdyjnJwyDiDO7Fa2SO1CTxPXL8VxA=="],
"html-escaper": ["html-escaper@3.0.3", "", {}, "sha512-RuMffC89BOWQoY0WKGpIhn5gX3iI54O6nRA0yC124NYVtzjmFWBIiFd8M0x+ZdX0P9R4lADg1mgP8C7PxGOWuQ=="],
"html-void-elements": ["html-void-elements@3.0.0", "", {}, "sha512-bEqo66MRXsUGxWHV5IP0PUiAWwoEjba4VCzg0LjFJBpchPaTfyfCKTG6bc5F8ucKec3q5y6qOdGyYTSBEvhCrg=="],
"html-whitespace-sensitive-tag-names": ["html-whitespace-sensitive-tag-names@3.0.1", "", {}, "sha512-q+310vW8zmymYHALr1da4HyXUQ0zgiIwIicEfotYPWGN0OJVEN/58IJ3A4GBYcEq3LGAZqKb+ugvP0GNB9CEAA=="],
"http-cache-semantics": ["http-cache-semantics@4.2.0", "", {}, "sha512-dTxcvPXqPvXBQpq5dUr6mEMJX4oIEFv6bwom3FDwKRDsuIjjJGANqhBuoAn9c1RQJIdAKav33ED65E2ys+87QQ=="],
"http-errors": ["http-errors@2.0.0", "", { "dependencies": { "depd": "2.0.0", "inherits": "2.0.4", "setprototypeof": "1.2.0", "statuses": "2.0.1", "toidentifier": "1.0.1" } }, "sha512-FtwrG/euBzaEjYeRqOgly7G0qviiXoJWnvEH2Z1plBdXgbyjv34pHTSb9zoeHMyDy33+DWy5Wt9Wo+TURtOYSQ=="],
"i18next": ["i18next@23.16.8", "", { "dependencies": { "@babel/runtime": "^7.23.2" } }, "sha512-06r/TitrM88Mg5FdUXAKL96dJMzgqLE5dv3ryBAra4KCwD9mJ4ndOTS95ZuymIGoE+2hzfdaMak2X11/es7ZWg=="],
"iconv-lite": ["iconv-lite@0.6.3", "", { "dependencies": { "safer-buffer": ">= 2.1.2 < 3.0.0" } }, "sha512-4fCk79wshMdzMp2rH06qWrJE4iolqLhCUH+OiuIgU++RB0+94NlDL81atO7GX55uUKueo0txHNtvEyI6D7WdMw=="],
"ieee754": ["ieee754@1.1.13", "", {}, "sha512-4vf7I2LYV/HaWerSo3XmlMkp5eZ83i+/CDluXi/IGTs/O1sejBNhTtnxzmRZfvOUqj7lZjqHkeTvpgSFDlWZTg=="],
"import-meta-resolve": ["import-meta-resolve@4.1.0", "", {}, "sha512-I6fiaX09Xivtk+THaMfAwnA3MVA5Big1WHF1Dfx9hFuvNIWpXnorlkzhcQf6ehrqQiiZECRt1poOAkPmer3ruw=="],
"inherits": ["inherits@2.0.4", "", {}, "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ=="],
"ini": ["ini@1.3.8", "", {}, "sha512-JV/yugV2uzW5iMRSiZAyDtQd+nxtUnjeLt0acNdw98kKLrvuRVyB80tsREOE7yvGVgalhZ6RNXCmEHkUKBKxew=="],
"inline-style-parser": ["inline-style-parser@0.2.4", "", {}, "sha512-0aO8FkhNZlj/ZIbNi7Lxxr12obT7cL1moPfE4tg1LkX7LlLfC6DeX4l2ZEud1ukP9jNQyNnfzQVqwbwmAATY4Q=="],
"ipaddr.js": ["ipaddr.js@1.9.1", "", {}, "sha512-0KI/607xoxSToH7GjN1FfSbLoU0+btTicjsQSWQlh/hZykN8KpmMf7uYwPW3R+akZ6R/w18ZlXSHBYXiYUPO3g=="],
"iron-webcrypto": ["iron-webcrypto@1.2.1", "", {}, "sha512-feOM6FaSr6rEABp/eDfVseKyTMDt+KGpeB35SkVn9Tyn0CqvVsY3EwI0v5i8nMHyJnzCIQf7nsy3p41TPkJZhg=="],
"is-alphabetical": ["is-alphabetical@2.0.1", "", {}, "sha512-FWyyY60MeTNyeSRpkM2Iry0G9hpr7/9kD40mD/cGQEuilcZYS4okz8SN2Q6rLCJ8gbCt6fN+rC+6tMGS99LaxQ=="],
"is-alphanumerical": ["is-alphanumerical@2.0.1", "", { "dependencies": { "is-alphabetical": "^2.0.0", "is-decimal": "^2.0.0" } }, "sha512-hmbYhX/9MUMF5uh7tOXyK/n0ZvWpad5caBA17GsC6vyuCqaWliRG5K1qS9inmUhEMaOBIW7/whAnSwveW/LtZw=="],
"is-arguments": ["is-arguments@1.2.0", "", { "dependencies": { "call-bound": "^1.0.2", "has-tostringtag": "^1.0.2" } }, "sha512-7bVbi0huj/wrIAOzb8U1aszg9kdi3KN/CyU19CTI7tAoZYEZoL9yCDXpbXN+uPsuWnP02cyug1gleqq+TU+YCA=="],
"is-arrayish": ["is-arrayish@0.3.2", "", {}, "sha512-eVRqCvVlZbuw3GrM63ovNSNAeA1K16kaR/LRY/92w0zxQ5/1YzwblUX652i4Xs9RwAGjW9d9y6X88t8OaAJfWQ=="],
"is-callable": ["is-callable@1.2.7", "", {}, "sha512-1BC0BVFhS/p0qtw6enp8e+8OD0UrK0oFLztSjNzhcKA3WDuJxxAPXzPuPtKkjEY9UUoEWlX/8fgKeu2S8i9JTA=="],
"is-decimal": ["is-decimal@2.0.1", "", {}, "sha512-AAB9hiomQs5DXWcRB1rqsxGUstbRroFOPPVAomNk/3XHR5JyEZChOyTWe2oayKnsSsr/kcGqF+z6yuH6HHpN0A=="],
"is-docker": ["is-docker@3.0.0", "", { "bin": { "is-docker": "cli.js" } }, "sha512-eljcgEDlEns/7AXFosB5K/2nCM4P7FQPkGc/DWLy5rmFEWvZayGrik1d9/QIY5nJ4f9YsVvBkA6kJpHn9rISdQ=="],
"is-fullwidth-code-point": ["is-fullwidth-code-point@3.0.0", "", {}, "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg=="],
"is-generator-function": ["is-generator-function@1.1.0", "", { "dependencies": { "call-bound": "^1.0.3", "get-proto": "^1.0.0", "has-tostringtag": "^1.0.2", "safe-regex-test": "^1.1.0" } }, "sha512-nPUB5km40q9e8UfN/Zc24eLlzdSf9OfKByBw9CIdw4H1giPMeA0OIJvbchsCu4npfI2QcMVBsGEBHKZ7wLTWmQ=="],
"is-hexadecimal": ["is-hexadecimal@2.0.1", "", {}, "sha512-DgZQp241c8oO6cA1SbTEWiXeoxV42vlcJxgH+B3hi1AiqqKruZR3ZGF8In3fj4+/y/7rHvlOZLZtgJ/4ttYGZg=="],
"is-inside-container": ["is-inside-container@1.0.0", "", { "dependencies": { "is-docker": "^3.0.0" }, "bin": { "is-inside-container": "cli.js" } }, "sha512-KIYLCCJghfHZxqjYBE7rEy0OBuTd5xCHS7tHVgvCLkx7StIoaxwNW3hCALgEUjFfeRk+MG/Qxmp/vtETEF3tRA=="],
"is-plain-obj": ["is-plain-obj@4.1.0", "", {}, "sha512-+Pgi+vMuUNkJyExiMBt5IlFoMyKnr5zhJ4Uspz58WOhBF5QoIZkFyNHIbBAtHwzVAgk5RtndVNsDRN61/mmDqg=="],
"is-promise": ["is-promise@4.0.0", "", {}, "sha512-hvpoI6korhJMnej285dSg6nu1+e6uxs7zG3BYAm5byqDsgJNWwxzM6z6iZiAgQR4TJ30JmBTOwqZUw3WlyH3AQ=="],
"is-regex": ["is-regex@1.2.1", "", { "dependencies": { "call-bound": "^1.0.2", "gopd": "^1.2.0", "has-tostringtag": "^1.0.2", "hasown": "^2.0.2" } }, "sha512-MjYsKHO5O7mCsmRGxWcLWheFqN9DJ/2TmngvjKXihe6efViPqc274+Fx/4fYj/r03+ESvBdTXK0V6tA3rgez1g=="],
"is-typed-array": ["is-typed-array@1.1.15", "", { "dependencies": { "which-typed-array": "^1.1.16" } }, "sha512-p3EcsicXjit7SaskXHs1hA91QxgTw46Fv6EFKKGS5DRFLD8yKnohjF3hxoju94b/OcMZoQukzpPpBE9uLVKzgQ=="],
"is-what": ["is-what@4.1.16", "", {}, "sha512-ZhMwEosbFJkA0YhFnNDgTM4ZxDRsS6HqTo7qsZM08fehyRYIYa0yHu5R6mgo1n/8MgaPBXiPimPD77baVFYg+A=="],
"is-wsl": ["is-wsl@3.1.0", "", { "dependencies": { "is-inside-container": "^1.0.0" } }, "sha512-UcVfVfaK4Sc4m7X3dUSoHoozQGBEFeDC+zVo06t98xe8CzHSZZBekNXH+tu0NalHolcJ/QAGqS46Hef7QXBIMw=="],
"isarray": ["isarray@1.0.0", "", {}, "sha512-VLghIWNM6ELQzo7zwmcg0NmTVyWKYjvIeM83yjp0wRDTmUnrM678fQbcKBo6n2CJEF0szoG//ytg+TKla89ALQ=="],
"jmespath": ["jmespath@0.16.0", "", {}, "sha512-9FzQjJ7MATs1tSpnco1K6ayiYE3figslrXA72G2HQ/n76RzvYlofyi5QM+iX4YRs/pu3yzxlVQSST23+dMDknw=="],
"jose": ["jose@5.2.3", "", {}, "sha512-KUXdbctm1uHVL8BYhnyHkgp3zDX5KW8ZhAKVFEfUbU2P8Alpzjb+48hHvjOdQIyPshoblhzsuqOwEEAbtHVirA=="],
"joycon": ["joycon@3.1.1", "", {}, "sha512-34wB/Y7MW7bzjKRjUKTa46I2Z7eV62Rkhva+KkopW7Qvv/OSWBqvkSY7vusOPrNuZcUG3tApvdVgNB8POj3SPw=="],
"js-tokens": ["js-tokens@4.0.0", "", {}, "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ=="],
"js-yaml": ["js-yaml@4.1.0", "", { "dependencies": { "argparse": "^2.0.1" }, "bin": { "js-yaml": "bin/js-yaml.js" } }, "sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA=="],
"jsesc": ["jsesc@3.1.0", "", { "bin": { "jsesc": "bin/jsesc" } }, "sha512-/sM3dO2FOzXjKQhJuo0Q173wf2KOo8t4I8vHy6lF9poUp7bKT0/NHE8fPX23PwfhnykfqnC2xRxOnVw5XuGIaA=="],
"json-rpc-2.0": ["json-rpc-2.0@1.7.0", "", {}, "sha512-asnLgC1qD5ytP+fvBP8uL0rvj+l8P6iYICbzZ8dVxCpESffVjzA7KkYkbKCIbavs7cllwH1ZUaNtJwphdeRqpg=="],
"json-schema": ["json-schema@0.4.0", "", {}, "sha512-es94M3nTIfsEPisRafak+HDLfHXnKBhV3vU5eqPcS3flIWqcxJWgXHXiey3YrpaNsanY5ei1VoYEbOzijuq9BA=="],
"json-schema-walker": ["json-schema-walker@2.0.0", "", { "dependencies": { "@apidevtools/json-schema-ref-parser": "^11.1.0", "clone": "^2.1.2" } }, "sha512-nXN2cMky0Iw7Af28w061hmxaPDaML5/bQD9nwm1lOoIKEGjHcRGxqWe4MfrkYThYAPjSUhmsp4bJNoLAyVn9Xw=="],
"json5": ["json5@2.2.3", "", { "bin": { "json5": "lib/cli.js" } }, "sha512-XmOWe7eyHYH14cLdVPoyg+GOH3rYX++KpzrylJwSW98t3Nk+U8XOl8FWKOgwtzdb8lXGf6zYwDUzeHMWfxasyg=="],
"kleur": ["kleur@4.1.5", "", {}, "sha512-o+NO+8WrRiQEE4/7nwRJhN1HWpVmJm511pBHUxPLtp0BUISzlBplORYSmTclCnJvQq2tKu/sgl3xVpkc7ZWuQQ=="],
"klona": ["klona@2.0.6", "", {}, "sha512-dhG34DXATL5hSxJbIexCft8FChFXtmskoZYnoPWjXQuebWYCNkVeV3KkGegCK9CP1oswI/vQibS2GY7Em/sJJA=="],
"leven": ["leven@2.1.0", "", {}, "sha512-nvVPLpIHUxCUoRLrFqTgSxXJ614d8AgQoWl7zPe/2VadE8+1dpU3LBhowRuBAcuwruWtOdD8oYC9jDNJjXDPyA=="],
"longest-streak": ["longest-streak@3.1.0", "", {}, "sha512-9Ri+o0JYgehTaVBBDoMqIl8GXtbWg711O3srftcHhZ0dqnETqLaoIK0x17fUw9rFSlK/0NlsKe0Ahhyl5pXE2g=="],
"lru-cache": ["lru-cache@6.0.0", "", { "dependencies": { "yallist": "^4.0.0" } }, "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA=="],
"luxon": ["luxon@3.6.1", "", {}, "sha512-tJLxrKJhO2ukZ5z0gyjY1zPh3Rh88Ej9P7jNrZiHMUXHae1yvI2imgOZtL1TO8TW6biMMKfTtAOoEJANgtWBMQ=="],
"magic-string": ["magic-string@0.30.17", "", { "dependencies": { "@jridgewell/sourcemap-codec": "^1.5.0" } }, "sha512-sNPKHvyjVf7gyjwS4xGTaW/mCnF8wnjtifKBEhxfZ7E/S8tQ0rssrwGNn6q8JH/ohItJfSQp9mBtQYuTlH5QnA=="],
"magicast": ["magicast@0.3.5", "", { "dependencies": { "@babel/parser": "^7.25.4", "@babel/types": "^7.25.4", "source-map-js": "^1.2.0" } }, "sha512-L0WhttDl+2BOsybvEOLK7fW3UA0OQ0IQ2d6Zl2x/a6vVRs3bAY0ECOSHHeL5jD+SbOpOCUEi0y1DgHEn9Qn1AQ=="],
"markdown-extensions": ["markdown-extensions@2.0.0", "", {}, "sha512-o5vL7aDWatOTX8LzaS1WMoaoxIiLRQJuIKKe2wAw6IeULDHaqbiqiggmx+pKvZDb1Sj+pE46Sn1T7lCqfFtg1Q=="],
"markdown-table": ["markdown-table@3.0.4", "", {}, "sha512-wiYz4+JrLyb/DqW2hkFJxP7Vd7JuTDm77fvbM8VfEQdmSMqcImWeeRbHwZjBjIFki/VaMK2BhFi7oUUZeM5bqw=="],
"math-intrinsics": ["math-intrinsics@1.1.0", "", {}, "sha512-/IXtbwEk5HTPyEwyKX6hGkYXxM9nbj64B+ilVJnC/R6B0pH5G4V3b0pVbL7DBj4tkhBAppbQUlf6F6Xl9LHu1g=="],
"mdast-util-definitions": ["mdast-util-definitions@6.0.0", "", { "dependencies": { "@types/mdast": "^4.0.0", "@types/unist": "^3.0.0", "unist-util-visit": "^5.0.0" } }, "sha512-scTllyX6pnYNZH/AIp/0ePz6s4cZtARxImwoPJ7kS42n+MnVsI4XbnG6d4ibehRIldYMWM2LD7ImQblVhUejVQ=="],
"mdast-util-directive": ["mdast-util-directive@3.1.0", "", { "dependencies": { "@types/mdast": "^4.0.0", "@types/unist": "^3.0.0", "ccount": "^2.0.0", "devlop": "^1.0.0", "mdast-util-from-markdown": "^2.0.0", "mdast-util-to-markdown": "^2.0.0", "parse-entities": "^4.0.0", "stringify-entities": "^4.0.0", "unist-util-visit-parents": "^6.0.0" } }, "sha512-I3fNFt+DHmpWCYAT7quoM6lHf9wuqtI+oCOfvILnoicNIqjh5E3dEJWiXuYME2gNe8vl1iMQwyUHa7bgFmak6Q=="],
"mdast-util-find-and-replace": ["mdast-util-find-and-replace@3.0.2", "", { "dependencies": { "@types/mdast": "^4.0.0", "escape-string-regexp": "^5.0.0", "unist-util-is": "^6.0.0", "unist-util-visit-parents": "^6.0.0" } }, "sha512-Tmd1Vg/m3Xz43afeNxDIhWRtFZgM2VLyaf4vSTYwudTyeuTneoL3qtWMA5jeLyz/O1vDJmmV4QuScFCA2tBPwg=="],
"mdast-util-from-markdown": ["mdast-util-from-markdown@2.0.2", "", { "dependencies": { "@types/mdast": "^4.0.0", "@types/unist": "^3.0.0", "decode-named-character-reference": "^1.0.0", "devlop": "^1.0.0", "mdast-util-to-string": "^4.0.0", "micromark": "^4.0.0", "micromark-util-decode-numeric-character-reference": "^2.0.0", "micromark-util-decode-string": "^2.0.0", "micromark-util-normalize-identifier": "^2.0.0", "micromark-util-symbol": "^2.0.0", "micromark-util-types": "^2.0.0", "unist-util-stringify-position": "^4.0.0" } }, "sha512-uZhTV/8NBuw0WHkPTrCqDOl0zVe1BIng5ZtHoDk49ME1qqcjYmmLmOf0gELgcRMxN4w2iuIeVso5/6QymSrgmA=="],
"mdast-util-gfm": ["mdast-util-gfm@3.1.0", "", { "dependencies": { "mdast-util-from-markdown": "^2.0.0", "mdast-util-gfm-autolink-literal": "^2.0.0", "mdast-util-gfm-footnote": "^2.0.0", "mdast-util-gfm-strikethrough": "^2.0.0", "mdast-util-gfm-table": "^2.0.0", "mdast-util-gfm-task-list-item": "^2.0.0", "mdast-util-to-markdown": "^2.0.0" } }, "sha512-0ulfdQOM3ysHhCJ1p06l0b0VKlhU0wuQs3thxZQagjcjPrlFRqY215uZGHHJan9GEAXd9MbfPjFJz+qMkVR6zQ=="],
"mdast-util-gfm-autolink-literal": ["mdast-util-gfm-autolink-literal@2.0.1", "", { "dependencies": { "@types/mdast": "^4.0.0", "ccount": "^2.0.0", "devlop": "^1.0.0", "mdast-util-find-and-replace": "^3.0.0", "micromark-util-character": "^2.0.0" } }, "sha512-5HVP2MKaP6L+G6YaxPNjuL0BPrq9orG3TsrZ9YXbA3vDw/ACI4MEsnoDpn6ZNm7GnZgtAcONJyPhOP8tNJQavQ=="],
"mdast-util-gfm-footnote": ["mdast-util-gfm-footnote@2.1.0", "", { "dependencies": { "@types/mdast": "^4.0.0", "devlop": "^1.1.0", "mdast-util-from-markdown": "^2.0.0", "mdast-util-to-markdown": "^2.0.0", "micromark-util-normalize-identifier": "^2.0.0" } }, "sha512-sqpDWlsHn7Ac9GNZQMeUzPQSMzR6Wv0WKRNvQRg0KqHh02fpTz69Qc1QSseNX29bhz1ROIyNyxExfawVKTm1GQ=="],
"mdast-util-gfm-strikethrough": ["mdast-util-gfm-strikethrough@2.0.0", "", { "dependencies": { "@types/mdast": "^4.0.0", "mdast-util-from-markdown": "^2.0.0", "mdast-util-to-markdown": "^2.0.0" } }, "sha512-mKKb915TF+OC5ptj5bJ7WFRPdYtuHv0yTRxK2tJvi+BDqbkiG7h7u/9SI89nRAYcmap2xHQL9D+QG/6wSrTtXg=="],
"mdast-util-gfm-table": ["mdast-util-gfm-table@2.0.0", "", { "dependencies": { "@types/mdast": "^4.0.0", "devlop": "^1.0.0", "markdown-table": "^3.0.0", "mdast-util-from-markdown": "^2.0.0", "mdast-util-to-markdown": "^2.0.0" } }, "sha512-78UEvebzz/rJIxLvE7ZtDd/vIQ0RHv+3Mh5DR96p7cS7HsBhYIICDBCu8csTNWNO6tBWfqXPWekRuj2FNOGOZg=="],
"mdast-util-gfm-task-list-item": ["mdast-util-gfm-task-list-item@2.0.0", "", { "dependencies": { "@types/mdast": "^4.0.0", "devlop": "^1.0.0", "mdast-util-from-markdown": "^2.0.0", "mdast-util-to-markdown": "^2.0.0" } }, "sha512-IrtvNvjxC1o06taBAVJznEnkiHxLFTzgonUdy8hzFVeDun0uTjxxrRGVaNFqkU1wJR3RBPEfsxmU6jDWPofrTQ=="],
"mdast-util-mdx": ["mdast-util-mdx@3.0.0", "", { "dependencies": { "mdast-util-from-markdown": "^2.0.0", "mdast-util-mdx-expression": "^2.0.0", "mdast-util-mdx-jsx": "^3.0.0", "mdast-util-mdxjs-esm": "^2.0.0", "mdast-util-to-markdown": "^2.0.0" } }, "sha512-JfbYLAW7XnYTTbUsmpu0kdBUVe+yKVJZBItEjwyYJiDJuZ9w4eeaqks4HQO+R7objWgS2ymV60GYpI14Ug554w=="],
"mdast-util-mdx-expression": ["mdast-util-mdx-expression@2.0.1", "", { "dependencies": { "@types/estree-jsx": "^1.0.0", "@types/hast": "^3.0.0", "@types/mdast": "^4.0.0", "devlop": "^1.0.0", "mdast-util-from-markdown": "^2.0.0", "mdast-util-to-markdown": "^2.0.0" } }, "sha512-J6f+9hUp+ldTZqKRSg7Vw5V6MqjATc+3E4gf3CFNcuZNWD8XdyI6zQ8GqH7f8169MM6P7hMBRDVGnn7oHB9kXQ=="],
"mdast-util-mdx-jsx": ["mdast-util-mdx-jsx@3.2.0", "", { "dependencies": { "@types/estree-jsx": "^1.0.0", "@types/hast": "^3.0.0", "@types/mdast": "^4.0.0", "@types/unist": "^3.0.0", "ccount": "^2.0.0", "devlop": "^1.1.0", "mdast-util-from-markdown": "^2.0.0", "mdast-util-to-markdown": "^2.0.0", "parse-entities": "^4.0.0", "stringify-entities": "^4.0.0", "unist-util-stringify-position": "^4.0.0", "vfile-message": "^4.0.0" } }, "sha512-lj/z8v0r6ZtsN/cGNNtemmmfoLAFZnjMbNyLzBafjzikOM+glrjNHPlf6lQDOTccj9n5b0PPihEBbhneMyGs1Q=="],
"mdast-util-mdxjs-esm": ["mdast-util-mdxjs-esm@2.0.1", "", { "dependencies": { "@types/estree-jsx": "^1.0.0", "@types/hast": "^3.0.0", "@types/mdast": "^4.0.0", "devlop": "^1.0.0", "mdast-util-from-markdown": "^2.0.0", "mdast-util-to-markdown": "^2.0.0" } }, "sha512-EcmOpxsZ96CvlP03NghtH1EsLtr0n9Tm4lPUJUBccV9RwUOneqSycg19n5HGzCf+10LozMRSObtVr3ee1WoHtg=="],
"mdast-util-phrasing": ["mdast-util-phrasing@4.1.0", "", { "dependencies": { "@types/mdast": "^4.0.0", "unist-util-is": "^6.0.0" } }, "sha512-TqICwyvJJpBwvGAMZjj4J2n0X8QWp21b9l0o7eXyVJ25YNWYbJDVIyD1bZXE6WtV6RmKJVYmQAKWa0zWOABz2w=="],
"mdast-util-to-hast": ["mdast-util-to-hast@13.2.0", "", { "dependencies": { "@types/hast": "^3.0.0", "@types/mdast": "^4.0.0", "@ungap/structured-clone": "^1.0.0", "devlop": "^1.0.0", "micromark-util-sanitize-uri": "^2.0.0", "trim-lines": "^3.0.0", "unist-util-position": "^5.0.0", "unist-util-visit": "^5.0.0", "vfile": "^6.0.0" } }, "sha512-QGYKEuUsYT9ykKBCMOEDLsU5JRObWQusAolFMeko/tYPufNkRffBAQjIE+99jbA87xv6FgmjLtwjh9wBWajwAA=="],
"mdast-util-to-markdown": ["mdast-util-to-markdown@2.1.2", "", { "dependencies": { "@types/mdast": "^4.0.0", "@types/unist": "^3.0.0", "longest-streak": "^3.0.0", "mdast-util-phrasing": "^4.0.0", "mdast-util-to-string": "^4.0.0", "micromark-util-classify-character": "^2.0.0", "micromark-util-decode-string": "^2.0.0", "unist-util-visit": "^5.0.0", "zwitch": "^2.0.0" } }, "sha512-xj68wMTvGXVOKonmog6LwyJKrYXZPvlwabaryTjLh9LuvovB/KAH+kvi8Gjj+7rJjsFi23nkUxRQv1KqSroMqA=="],
"mdast-util-to-string": ["mdast-util-to-string@4.0.0", "", { "dependencies": { "@types/mdast": "^4.0.0" } }, "sha512-0H44vDimn51F0YwvxSJSm0eCDOJTRlmN0R1yBh4HLj9wiV1Dn0QoXGbvFAWj2hSItVTlCmBF1hqKlIyUBVFLPg=="],
"mdn-data": ["mdn-data@2.12.2", "", {}, "sha512-IEn+pegP1aManZuckezWCO+XZQDplx1366JoVhTpMpBB1sPey/SbveZQUosKiKiGYjg1wH4pMlNgXbCiYgihQA=="],
"media-typer": ["media-typer@1.1.0", "", {}, "sha512-aisnrDP4GNe06UcKFnV5bfMNPBUw4jsLGaWwWfnH3v02GnBuXX2MCVn5RbrWo0j3pczUilYblq7fQ7Nw2t5XKw=="],
"merge-anything": ["merge-anything@5.1.7", "", { "dependencies": { "is-what": "^4.1.8" } }, "sha512-eRtbOb1N5iyH0tkQDAoQ4Ipsp/5qSR79Dzrz8hEPxRX10RWWR/iQXdoKmBSRCThY1Fh5EhISDtpSc93fpxUniQ=="],
"merge-descriptors": ["merge-descriptors@2.0.0", "", {}, "sha512-Snk314V5ayFLhp3fkUREub6WtjBfPdCPY1Ln8/8munuLuiYhsABgBVWsozAG+MWMbVEvcdcpbi9R7ww22l9Q3g=="],
"micromark": ["micromark@4.0.2", "", { "dependencies": { "@types/debug": "^4.0.0", "debug": "^4.0.0", "decode-named-character-reference": "^1.0.0", "devlop": "^1.0.0", "micromark-core-commonmark": "^2.0.0", "micromark-factory-space": "^2.0.0", "micromark-util-character": "^2.0.0", "micromark-util-chunked": "^2.0.0", "micromark-util-combine-extensions": "^2.0.0", "micromark-util-decode-numeric-character-reference": "^2.0.0", "micromark-util-encode": "^2.0.0", "micromark-util-normalize-identifier": "^2.0.0", "micromark-util-resolve-all": "^2.0.0", "micromark-util-sanitize-uri": "^2.0.0", "micromark-util-subtokenize": "^2.0.0", "micromark-util-symbol": "^2.0.0", "micromark-util-types": "^2.0.0" } }, "sha512-zpe98Q6kvavpCr1NPVSCMebCKfD7CA2NqZ+rykeNhONIJBpc1tFKt9hucLGwha3jNTNI8lHpctWJWoimVF4PfA=="],
"micromark-core-commonmark": ["micromark-core-commonmark@2.0.3", "", { "dependencies": { "decode-named-character-reference": "^1.0.0", "devlop": "^1.0.0", "micromark-factory-destination": "^2.0.0", "micromark-factory-label": "^2.0.0", "micromark-factory-space": "^2.0.0", "micromark-factory-title": "^2.0.0", "micromark-factory-whitespace": "^2.0.0", "micromark-util-character": "^2.0.0", "micromark-util-chunked": "^2.0.0", "micromark-util-classify-character": "^2.0.0", "micromark-util-html-tag-name": "^2.0.0", "micromark-util-normalize-identifier": "^2.0.0", "micromark-util-resolve-all": "^2.0.0", "micromark-util-subtokenize": "^2.0.0", "micromark-util-symbol": "^2.0.0", "micromark-util-types": "^2.0.0" } }, "sha512-RDBrHEMSxVFLg6xvnXmb1Ayr2WzLAWjeSATAoxwKYJV94TeNavgoIdA0a9ytzDSVzBy2YKFK+emCPOEibLeCrg=="],
"micromark-extension-directive": ["micromark-extension-directive@3.0.2", "", { "dependencies": { "devlop": "^1.0.0", "micromark-factory-space": "^2.0.0", "micromark-factory-whitespace": "^2.0.0", "micromark-util-character": "^2.0.0", "micromark-util-symbol": "^2.0.0", "micromark-util-types": "^2.0.0", "parse-entities": "^4.0.0" } }, "sha512-wjcXHgk+PPdmvR58Le9d7zQYWy+vKEU9Se44p2CrCDPiLr2FMyiT4Fyb5UFKFC66wGB3kPlgD7q3TnoqPS7SZA=="],
"micromark-extension-gfm": ["micromark-extension-gfm@3.0.0", "", { "dependencies": { "micromark-extension-gfm-autolink-literal": "^2.0.0", "micromark-extension-gfm-footnote": "^2.0.0", "micromark-extension-gfm-strikethrough": "^2.0.0", "micromark-extension-gfm-table": "^2.0.0", "micromark-extension-gfm-tagfilter": "^2.0.0", "micromark-extension-gfm-task-list-item": "^2.0.0", "micromark-util-combine-extensions": "^2.0.0", "micromark-util-types": "^2.0.0" } }, "sha512-vsKArQsicm7t0z2GugkCKtZehqUm31oeGBV/KVSorWSy8ZlNAv7ytjFhvaryUiCUJYqs+NoE6AFhpQvBTM6Q4w=="],
"micromark-extension-gfm-autolink-literal": ["micromark-extension-gfm-autolink-literal@2.1.0", "", { "dependencies": { "micromark-util-character": "^2.0.0", "micromark-util-sanitize-uri": "^2.0.0", "micromark-util-symbol": "^2.0.0", "micromark-util-types": "^2.0.0" } }, "sha512-oOg7knzhicgQ3t4QCjCWgTmfNhvQbDDnJeVu9v81r7NltNCVmhPy1fJRX27pISafdjL+SVc4d3l48Gb6pbRypw=="],
"micromark-extension-gfm-footnote": ["micromark-extension-gfm-footnote@2.1.0", "", { "dependencies": { "devlop": "^1.0.0", "micromark-core-commonmark": "^2.0.0", "micromark-factory-space": "^2.0.0", "micromark-util-character": "^2.0.0", "micromark-util-normalize-identifier": "^2.0.0", "micromark-util-sanitize-uri": "^2.0.0", "micromark-util-symbol": "^2.0.0", "micromark-util-types": "^2.0.0" } }, "sha512-/yPhxI1ntnDNsiHtzLKYnE3vf9JZ6cAisqVDauhp4CEHxlb4uoOTxOCJ+9s51bIB8U1N1FJ1RXOKTIlD5B/gqw=="],
"micromark-extension-gfm-strikethrough": ["micromark-extension-gfm-strikethrough@2.1.0", "", { "dependencies": { "devlop": "^1.0.0", "micromark-util-chunked": "^2.0.0", "micromark-util-classify-character": "^2.0.0", "micromark-util-resolve-all": "^2.0.0", "micromark-util-symbol": "^2.0.0", "micromark-util-types": "^2.0.0" } }, "sha512-ADVjpOOkjz1hhkZLlBiYA9cR2Anf8F4HqZUO6e5eDcPQd0Txw5fxLzzxnEkSkfnD0wziSGiv7sYhk/ktvbf1uw=="],
"micromark-extension-gfm-table": ["micromark-extension-gfm-table@2.1.1", "", { "dependencies": { "devlop": "^1.0.0", "micromark-factory-space": "^2.0.0", "micromark-util-character": "^2.0.0", "micromark-util-symbol": "^2.0.0", "micromark-util-types": "^2.0.0" } }, "sha512-t2OU/dXXioARrC6yWfJ4hqB7rct14e8f7m0cbI5hUmDyyIlwv5vEtooptH8INkbLzOatzKuVbQmAYcbWoyz6Dg=="],
"micromark-extension-gfm-tagfilter": ["micromark-extension-gfm-tagfilter@2.0.0", "", { "dependencies": { "micromark-util-types": "^2.0.0" } }, "sha512-xHlTOmuCSotIA8TW1mDIM6X2O1SiX5P9IuDtqGonFhEK0qgRI4yeC6vMxEV2dgyr2TiD+2PQ10o+cOhdVAcwfg=="],
"micromark-extension-gfm-task-list-item": ["micromark-extension-gfm-task-list-item@2.1.0", "", { "dependencies": { "devlop": "^1.0.0", "micromark-factory-space": "^2.0.0", "micromark-util-character": "^2.0.0", "micromark-util-symbol": "^2.0.0", "micromark-util-types": "^2.0.0" } }, "sha512-qIBZhqxqI6fjLDYFTBIa4eivDMnP+OZqsNwmQ3xNLE4Cxwc+zfQEfbs6tzAo2Hjq+bh6q5F+Z8/cksrLFYWQQw=="],
"micromark-extension-mdx-expression": ["micromark-extension-mdx-expression@3.0.1", "", { "dependencies": { "@types/estree": "^1.0.0", "devlop": "^1.0.0", "micromark-factory-mdx-expression": "^2.0.0", "micromark-factory-space": "^2.0.0", "micromark-util-character": "^2.0.0", "micromark-util-events-to-acorn": "^2.0.0", "micromark-util-symbol": "^2.0.0", "micromark-util-types": "^2.0.0" } }, "sha512-dD/ADLJ1AeMvSAKBwO22zG22N4ybhe7kFIZ3LsDI0GlsNr2A3KYxb0LdC1u5rj4Nw+CHKY0RVdnHX8vj8ejm4Q=="],
"micromark-extension-mdx-jsx": ["micromark-extension-mdx-jsx@3.0.2", "", { "dependencies": { "@types/estree": "^1.0.0", "devlop": "^1.0.0", "estree-util-is-identifier-name": "^3.0.0", "micromark-factory-mdx-expression": "^2.0.0", "micromark-factory-space": "^2.0.0", "micromark-util-character": "^2.0.0", "micromark-util-events-to-acorn": "^2.0.0", "micromark-util-symbol": "^2.0.0", "micromark-util-types": "^2.0.0", "vfile-message": "^4.0.0" } }, "sha512-e5+q1DjMh62LZAJOnDraSSbDMvGJ8x3cbjygy2qFEi7HCeUT4BDKCvMozPozcD6WmOt6sVvYDNBKhFSz3kjOVQ=="],
"micromark-extension-mdx-md": ["micromark-extension-mdx-md@2.0.0", "", { "dependencies": { "micromark-util-types": "^2.0.0" } }, "sha512-EpAiszsB3blw4Rpba7xTOUptcFeBFi+6PY8VnJ2hhimH+vCQDirWgsMpz7w1XcZE7LVrSAUGb9VJpG9ghlYvYQ=="],
"micromark-extension-mdxjs": ["micromark-extension-mdxjs@3.0.0", "", { "dependencies": { "acorn": "^8.0.0", "acorn-jsx": "^5.0.0", "micromark-extension-mdx-expression": "^3.0.0", "micromark-extension-mdx-jsx": "^3.0.0", "micromark-extension-mdx-md": "^2.0.0", "micromark-extension-mdxjs-esm": "^3.0.0", "micromark-util-combine-extensions": "^2.0.0", "micromark-util-types": "^2.0.0" } }, "sha512-A873fJfhnJ2siZyUrJ31l34Uqwy4xIFmvPY1oj+Ean5PHcPBYzEsvqvWGaWcfEIr11O5Dlw3p2y0tZWpKHDejQ=="],
"micromark-extension-mdxjs-esm": ["micromark-extension-mdxjs-esm@3.0.0", "", { "dependencies": { "@types/estree": "^1.0.0", "devlop": "^1.0.0", "micromark-core-commonmark": "^2.0.0", "micromark-util-character": "^2.0.0", "micromark-util-events-to-acorn": "^2.0.0", "micromark-util-symbol": "^2.0.0", "micromark-util-types": "^2.0.0", "unist-util-position-from-estree": "^2.0.0", "vfile-message": "^4.0.0" } }, "sha512-DJFl4ZqkErRpq/dAPyeWp15tGrcrrJho1hKK5uBS70BCtfrIFg81sqcTVu3Ta+KD1Tk5vAtBNElWxtAa+m8K9A=="],
"micromark-factory-destination": ["micromark-factory-destination@2.0.1", "", { "dependencies": { "micromark-util-character": "^2.0.0", "micromark-util-symbol": "^2.0.0", "micromark-util-types": "^2.0.0" } }, "sha512-Xe6rDdJlkmbFRExpTOmRj9N3MaWmbAgdpSrBQvCFqhezUn4AHqJHbaEnfbVYYiexVSs//tqOdY/DxhjdCiJnIA=="],
"micromark-factory-label": ["micromark-factory-label@2.0.1", "", { "dependencies": { "devlop": "^1.0.0", "micromark-util-character": "^2.0.0", "micromark-util-symbol": "^2.0.0", "micromark-util-types": "^2.0.0" } }, "sha512-VFMekyQExqIW7xIChcXn4ok29YE3rnuyveW3wZQWWqF4Nv9Wk5rgJ99KzPvHjkmPXF93FXIbBp6YdW3t71/7Vg=="],
"micromark-factory-mdx-expression": ["micromark-factory-mdx-expression@2.0.3", "", { "dependencies": { "@types/estree": "^1.0.0", "devlop": "^1.0.0", "micromark-factory-space": "^2.0.0", "micromark-util-character": "^2.0.0", "micromark-util-events-to-acorn": "^2.0.0", "micromark-util-symbol": "^2.0.0", "micromark-util-types": "^2.0.0", "unist-util-position-from-estree": "^2.0.0", "vfile-message": "^4.0.0" } }, "sha512-kQnEtA3vzucU2BkrIa8/VaSAsP+EJ3CKOvhMuJgOEGg9KDC6OAY6nSnNDVRiVNRqj7Y4SlSzcStaH/5jge8JdQ=="],
"micromark-factory-space": ["micromark-factory-space@2.0.1", "", { "dependencies": { "micromark-util-character": "^2.0.0", "micromark-util-types": "^2.0.0" } }, "sha512-zRkxjtBxxLd2Sc0d+fbnEunsTj46SWXgXciZmHq0kDYGnck/ZSGj9/wULTV95uoeYiK5hRXP2mJ98Uo4cq/LQg=="],
"micromark-factory-title": ["micromark-factory-title@2.0.1", "", { "dependencies": { "micromark-factory-space": "^2.0.0", "micromark-util-character": "^2.0.0", "micromark-util-symbol": "^2.0.0", "micromark-util-types": "^2.0.0" } }, "sha512-5bZ+3CjhAd9eChYTHsjy6TGxpOFSKgKKJPJxr293jTbfry2KDoWkhBb6TcPVB4NmzaPhMs1Frm9AZH7OD4Cjzw=="],
"micromark-factory-whitespace": ["micromark-factory-whitespace@2.0.1", "", { "dependencies": { "micromark-factory-space": "^2.0.0", "micromark-util-character": "^2.0.0", "micromark-util-symbol": "^2.0.0", "micromark-util-types": "^2.0.0" } }, "sha512-Ob0nuZ3PKt/n0hORHyvoD9uZhr+Za8sFoP+OnMcnWK5lngSzALgQYKMr9RJVOWLqQYuyn6ulqGWSXdwf6F80lQ=="],
"micromark-util-character": ["micromark-util-character@2.1.1", "", { "dependencies": { "micromark-util-symbol": "^2.0.0", "micromark-util-types": "^2.0.0" } }, "sha512-wv8tdUTJ3thSFFFJKtpYKOYiGP2+v96Hvk4Tu8KpCAsTMs6yi+nVmGh1syvSCsaxz45J6Jbw+9DD6g97+NV67Q=="],
"micromark-util-chunked": ["micromark-util-chunked@2.0.1", "", { "dependencies": { "micromark-util-symbol": "^2.0.0" } }, "sha512-QUNFEOPELfmvv+4xiNg2sRYeS/P84pTW0TCgP5zc9FpXetHY0ab7SxKyAQCNCc1eK0459uoLI1y5oO5Vc1dbhA=="],
"micromark-util-classify-character": ["micromark-util-classify-character@2.0.1", "", { "dependencies": { "micromark-util-character": "^2.0.0", "micromark-util-symbol": "^2.0.0", "micromark-util-types": "^2.0.0" } }, "sha512-K0kHzM6afW/MbeWYWLjoHQv1sgg2Q9EccHEDzSkxiP/EaagNzCm7T/WMKZ3rjMbvIpvBiZgwR3dKMygtA4mG1Q=="],
"micromark-util-combine-extensions": ["micromark-util-combine-extensions@2.0.1", "", { "dependencies": { "micromark-util-chunked": "^2.0.0", "micromark-util-types": "^2.0.0" } }, "sha512-OnAnH8Ujmy59JcyZw8JSbK9cGpdVY44NKgSM7E9Eh7DiLS2E9RNQf0dONaGDzEG9yjEl5hcqeIsj4hfRkLH/Bg=="],
"micromark-util-decode-numeric-character-reference": ["micromark-util-decode-numeric-character-reference@2.0.2", "", { "dependencies": { "micromark-util-symbol": "^2.0.0" } }, "sha512-ccUbYk6CwVdkmCQMyr64dXz42EfHGkPQlBj5p7YVGzq8I7CtjXZJrubAYezf7Rp+bjPseiROqe7G6foFd+lEuw=="],
"micromark-util-decode-string": ["micromark-util-decode-string@2.0.1", "", { "dependencies": { "decode-named-character-reference": "^1.0.0", "micromark-util-character": "^2.0.0", "micromark-util-decode-numeric-character-reference": "^2.0.0", "micromark-util-symbol": "^2.0.0" } }, "sha512-nDV/77Fj6eH1ynwscYTOsbK7rR//Uj0bZXBwJZRfaLEJ1iGBR6kIfNmlNqaqJf649EP0F3NWNdeJi03elllNUQ=="],
"micromark-util-encode": ["micromark-util-encode@2.0.1", "", {}, "sha512-c3cVx2y4KqUnwopcO9b/SCdo2O67LwJJ/UyqGfbigahfegL9myoEFoDYZgkT7f36T0bLrM9hZTAaAyH+PCAXjw=="],
"micromark-util-events-to-acorn": ["micromark-util-events-to-acorn@2.0.3", "", { "dependencies": { "@types/estree": "^1.0.0", "@types/unist": "^3.0.0", "devlop": "^1.0.0", "estree-util-visit": "^2.0.0", "micromark-util-symbol": "^2.0.0", "micromark-util-types": "^2.0.0", "vfile-message": "^4.0.0" } }, "sha512-jmsiEIiZ1n7X1Rr5k8wVExBQCg5jy4UXVADItHmNk1zkwEVhBuIUKRu3fqv+hs4nxLISi2DQGlqIOGiFxgbfHg=="],
"micromark-util-html-tag-name": ["micromark-util-html-tag-name@2.0.1", "", {}, "sha512-2cNEiYDhCWKI+Gs9T0Tiysk136SnR13hhO8yW6BGNyhOC4qYFnwF1nKfD3HFAIXA5c45RrIG1ub11GiXeYd1xA=="],
"micromark-util-normalize-identifier": ["micromark-util-normalize-identifier@2.0.1", "", { "dependencies": { "micromark-util-symbol": "^2.0.0" } }, "sha512-sxPqmo70LyARJs0w2UclACPUUEqltCkJ6PhKdMIDuJ3gSf/Q+/GIe3WKl0Ijb/GyH9lOpUkRAO2wp0GVkLvS9Q=="],
"micromark-util-resolve-all": ["micromark-util-resolve-all@2.0.1", "", { "dependencies": { "micromark-util-types": "^2.0.0" } }, "sha512-VdQyxFWFT2/FGJgwQnJYbe1jjQoNTS4RjglmSjTUlpUMa95Htx9NHeYW4rGDJzbjvCsl9eLjMQwGeElsqmzcHg=="],
"micromark-util-sanitize-uri": ["micromark-util-sanitize-uri@2.0.1", "", { "dependencies": { "micromark-util-character": "^2.0.0", "micromark-util-encode": "^2.0.0", "micromark-util-symbol": "^2.0.0" } }, "sha512-9N9IomZ/YuGGZZmQec1MbgxtlgougxTodVwDzzEouPKo3qFWvymFHWcnDi2vzV1ff6kas9ucW+o3yzJK9YB1AQ=="],
"micromark-util-subtokenize": ["micromark-util-subtokenize@2.1.0", "", { "dependencies": { "devlop": "^1.0.0", "micromark-util-chunked": "^2.0.0", "micromark-util-symbol": "^2.0.0", "micromark-util-types": "^2.0.0" } }, "sha512-XQLu552iSctvnEcgXw6+Sx75GflAPNED1qx7eBJ+wydBb2KCbRZe+NwvIEEMM83uml1+2WSXpBAcp9IUCgCYWA=="],
"micromark-util-symbol": ["micromark-util-symbol@2.0.1", "", {}, "sha512-vs5t8Apaud9N28kgCrRUdEed4UJ+wWNvicHLPxCa9ENlYuAY31M0ETy5y1vA33YoNPDFTghEbnh6efaE8h4x0Q=="],
"micromark-util-types": ["micromark-util-types@2.0.2", "", {}, "sha512-Yw0ECSpJoViF1qTU4DC6NwtC4aWGt1EkzaQB8KPPyCRR8z9TWeV0HbEFGTO+ZY1wB22zmxnJqhPyTpOVCpeHTA=="],
"mime-db": ["mime-db@1.54.0", "", {}, "sha512-aU5EJuIN2WDemCcAp2vFBfp/m4EAhWJnUNSSw0ixs7/kXbd6Pg64EmwJkNdFhB8aWt1sH2CTXrLxo/iAGV3oPQ=="],
"mime-types": ["mime-types@3.0.1", "", { "dependencies": { "mime-db": "^1.54.0" } }, "sha512-xRc4oEhT6eaBpU1XF7AjpOFD+xQmXNB5OVKwp4tqCuBpHLS/ZbBDrc07mYTDqVMg6PfxUjjNp85O6Cd2Z/5HWA=="],
"mimic-response": ["mimic-response@3.1.0", "", {}, "sha512-z0yWI+4FDrrweS8Zmt4Ej5HdJmky15+L2e6Wgn3+iK5fWzb6T3fhNFq2+MeTRb064c6Wr4N/wv0DzQTjNzHNGQ=="],
"minimatch": ["minimatch@5.1.6", "", { "dependencies": { "brace-expansion": "^2.0.1" } }, "sha512-lKwV/1brpG6mBUFHtb7NUmtABCb2WZZmm2wNiOA5hAb8VdCS4B3dtMWyvcoViccwAW/COERjXLt0zP1zXUN26g=="],
"minimist": ["minimist@1.2.8", "", {}, "sha512-2yyAR8qBkN3YuheJanUpWC5U3bb5osDywNB8RzDVlDwDHbocAJveqqj1u8+SVD7jkWT4yvsHCpWqqWqAxb0zCA=="],
"mkdirp-classic": ["mkdirp-classic@0.5.3", "", {}, "sha512-gKLcREMhtuZRwRAfqP3RFW+TK4JqApVBtOIftVgjuABpAtpxhPGaDcfvbhNvD0B8iD1oUr/txX35NjcaY6Ns/A=="],
"mri": ["mri@1.1.4", "", {}, "sha512-6y7IjGPm8AzlvoUrwAaw1tLnUBudaS3752vcd8JtrpGGQn+rXIe63LFVHm/YMwtqAuh+LJPCFdlLYPWM1nYn6w=="],
"mrmime": ["mrmime@2.0.1", "", {}, "sha512-Y3wQdFg2Va6etvQ5I82yUhGdsKrcYox6p7FfL1LbK2J4V01F9TGlepTIhnK24t7koZibmg82KGglhA1XK5IsLQ=="],
"ms": ["ms@2.1.3", "", {}, "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA=="],
"nanoid": ["nanoid@3.3.11", "", { "bin": { "nanoid": "bin/nanoid.cjs" } }, "sha512-N8SpfPUnUp1bK+PMYW8qSWdl9U+wwNWI4QKxOYDy9JAro3WMX7p2OeVRF9v+347pnakNevPmiHhNmZ2HbFA76w=="],
"napi-build-utils": ["napi-build-utils@2.0.0", "", {}, "sha512-GEbrYkbfF7MoNaoh2iGG84Mnf/WZfB0GdGEsM8wz7Expx/LlWf5U8t9nvJKXSp3qr5IsEbK04cBGhol/KwOsWA=="],
"negotiator": ["negotiator@1.0.0", "", {}, "sha512-8Ofs/AUQh8MaEcrlq5xOX0CQ9ypTF5dl78mjlMNfOK08fzpgTHQRQPBxcPlEtIw0yRpws+Zo/3r+5WRby7u3Gg=="],
"neotraverse": ["neotraverse@0.6.18", "", {}, "sha512-Z4SmBUweYa09+o6pG+eASabEpP6QkQ70yHj351pQoEXIs8uHbaU2DWVmzBANKgflPa47A50PtB2+NgRpQvr7vA=="],
"nlcst-to-string": ["nlcst-to-string@4.0.0", "", { "dependencies": { "@types/nlcst": "^2.0.0" } }, "sha512-YKLBCcUYKAg0FNlOBT6aI91qFmSiFKiluk655WzPF+DDMA02qIyy8uiRqI8QXtcFpEvll12LpL5MXqEmAZ+dcA=="],
"node-abi": ["node-abi@3.75.0", "", { "dependencies": { "semver": "^7.3.5" } }, "sha512-OhYaY5sDsIka7H7AtijtI9jwGYLyl29eQn/W623DiN/MIv5sUqc4g7BIDThX+gb7di9f6xK02nkp8sdfFWZLTg=="],
"node-addon-api": ["node-addon-api@6.1.0", "", {}, "sha512-+eawOlIgy680F0kBzPUNFhMZGtJ1YmqM6l4+Crf4IkImjYrO/mqPwRMh352g23uIaQKFItcQ64I7KMaJxHgAVA=="],
"node-fetch": ["node-fetch@2.7.0", "", { "dependencies": { "whatwg-url": "^5.0.0" }, "peerDependencies": { "encoding": "^0.1.0" }, "optionalPeers": ["encoding"] }, "sha512-c4FRfUm/dbcWZ7U+1Wq0AwCyFL+3nt2bEw05wfxSz+DWpWsitgmSgYmy2dQdWyKC1694ELPqMs/YzUSNozLt8A=="],
"node-fetch-native": ["node-fetch-native@1.6.6", "", {}, "sha512-8Mc2HhqPdlIfedsuZoc3yioPuzp6b+L5jRCRY1QzuWZh2EGJVQrGppC6V6cF0bLdbW0+O2YpqCA25aF/1lvipQ=="],
"node-mock-http": ["node-mock-http@1.0.0", "", {}, "sha512-0uGYQ1WQL1M5kKvGRXWQ3uZCHtLTO8hln3oBjIusM75WoesZ909uQJs/Hb946i2SS+Gsrhkaa6iAO17jRIv6DQ=="],
"node-releases": ["node-releases@2.0.19", "", {}, "sha512-xxOWJsBKtzAq7DY0J+DTzuz58K8e7sJbdgwkbMWQe8UYB6ekmsQ45q0M/tJDsGaZmbC+l7n57UV8Hl5tHxO9uw=="],
"normalize-path": ["normalize-path@3.0.0", "", {}, "sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA=="],
"nth-check": ["nth-check@2.1.1", "", { "dependencies": { "boolbase": "^1.0.0" } }, "sha512-lqjrjmaOoAnWfMmBPL+XNnynZh2+swxiX3WUE0s4yEHI6m+AwrK2UZOimIRl3X/4QctVqS8AiZjFqyOGrMXb/w=="],
"object-assign": ["object-assign@4.1.1", "", {}, "sha512-rJgTQnkUnH1sFw8yT6VSU3zD3sWmu6sZhIseY8VX+GRu3P6F7Fu+JNDoXfklElbLJSnc3FUQHVe4cU5hj+BcUg=="],
"object-hash": ["object-hash@2.2.0", "", {}, "sha512-gScRMn0bS5fH+IuwyIFgnh9zBdo4DV+6GhygmWM9HyNJSgS0hScp1f5vjtm7oIIOiT9trXrShAkLFSc2IqKNgw=="],
"object-inspect": ["object-inspect@1.13.4", "", {}, "sha512-W67iLl4J2EXEGTbfeHCffrjDfitvLANg0UlX3wFUUSTx92KXRFegMHUVgSqE+wvhAbi4WqjGg9czysTV2Epbew=="],
"ofetch": ["ofetch@1.4.1", "", { "dependencies": { "destr": "^2.0.3", "node-fetch-native": "^1.6.4", "ufo": "^1.5.4" } }, "sha512-QZj2DfGplQAr2oj9KzceK9Hwz6Whxazmn85yYeVuS3u9XTMOGMRx0kO95MQ+vLsj/S/NwBDMMLU5hpxvI6Tklw=="],
"ohash": ["ohash@2.0.11", "", {}, "sha512-RdR9FQrFwNBNXAr4GixM8YaRZRJ5PUWbKYbE5eOsrwAjJW0q2REGcf79oYPsLyskQCZG1PLN+S/K1V00joZAoQ=="],
"oidc-token-hash": ["oidc-token-hash@5.1.0", "", {}, "sha512-y0W+X7Ppo7oZX6eovsRkuzcSM40Bicg2JEJkDJ4irIt1wsYAP5MLSNv+QAogO8xivMffw/9OvV3um1pxXgt1uA=="],
"on-exit-leak-free": ["on-exit-leak-free@0.2.0", "", {}, "sha512-dqaz3u44QbRXQooZLTUKU41ZrzYrcvLISVgbrzbyCMxpmSLJvZ3ZamIJIZ29P6OhZIkNIQKosdeM6t1LYbA9hg=="],
"on-finished": ["on-finished@2.4.1", "", { "dependencies": { "ee-first": "1.1.1" } }, "sha512-oVlzkg3ENAhCk2zdv7IJwd/QUD4z2RxRwpkcGY8psCVcCYZNq4wYnVWALHM+brtuJjePWiYF/ClmuDr8Ch5+kg=="],
"once": ["once@1.4.0", "", { "dependencies": { "wrappy": "1" } }, "sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w=="],
"oniguruma-parser": ["oniguruma-parser@0.12.1", "", {}, "sha512-8Unqkvk1RYc6yq2WBYRj4hdnsAxVze8i7iPfQr8e4uSP3tRv0rpZcbGUDvxfQQcdwHt/e9PrMvGCsa8OqG9X3w=="],
"oniguruma-to-es": ["oniguruma-to-es@4.3.3", "", { "dependencies": { "oniguruma-parser": "^0.12.1", "regex": "^6.0.1", "regex-recursion": "^6.0.2" } }, "sha512-rPiZhzC3wXwE59YQMRDodUwwT9FZ9nNBwQQfsd1wfdtlKEyCdRV0avrTcSZ5xlIvGRVPd/cx6ZN45ECmS39xvg=="],
"openapi-types": ["openapi-types@12.1.3", "", {}, "sha512-N4YtSYJqghVu4iek2ZUvcN/0aqH1kRDuNqzcycDxhOUpg7GdvLa2F3DgS6yBNhInhv2r/6I0Flkn7CqL8+nIcw=="],
"opencode": ["opencode@workspace:packages/opencode"],
"opencontrol": ["opencontrol@0.0.6", "", { "dependencies": { "@modelcontextprotocol/sdk": "1.6.1", "@tsconfig/bun": "1.0.7", "hono": "4.7.4", "zod": "3.24.2", "zod-to-json-schema": "3.24.3" }, "bin": { "opencontrol": "bin/index.mjs" } }, "sha512-QeCrpOK5D15QV8kjnGVeD/BHFLwcVr+sn4T6KKmP0WAMs2pww56e4h+eOGHb5iPOufUQXbdbBKi6WV2kk7tefQ=="],
"openid-client": ["openid-client@5.6.4", "", { "dependencies": { "jose": "^4.15.4", "lru-cache": "^6.0.0", "object-hash": "^2.2.0", "oidc-token-hash": "^5.0.3" } }, "sha512-T1h3B10BRPKfcObdBklX639tVz+xh34O7GjofqrqiAQdm7eHsQ00ih18x6wuJ/E6FxdtS2u3FmUGPDeEcMwzNA=="],
"p-limit": ["p-limit@6.2.0", "", { "dependencies": { "yocto-queue": "^1.1.1" } }, "sha512-kuUqqHNUqoIWp/c467RI4X6mmyuojY5jGutNU0wVTmEOOfcuwLqyMVoAi9MKi2Ak+5i9+nhmrK4ufZE8069kHA=="],
"p-queue": ["p-queue@8.1.0", "", { "dependencies": { "eventemitter3": "^5.0.1", "p-timeout": "^6.1.2" } }, "sha512-mxLDbbGIBEXTJL0zEx8JIylaj3xQ7Z/7eEVjcF9fJX4DBiH9oqe+oahYnlKKxm0Ci9TlWTyhSHgygxMxjIB2jw=="],
"p-timeout": ["p-timeout@6.1.4", "", {}, "sha512-MyIV3ZA/PmyBN/ud8vV9XzwTrNtR4jFrObymZYnZqMmW0zA8Z17vnT0rBgFE/TlohB+YCHqXMgZzb3Csp49vqg=="],
"package-manager-detector": ["package-manager-detector@1.3.0", "", {}, "sha512-ZsEbbZORsyHuO00lY1kV3/t72yp6Ysay6Pd17ZAlNGuGwmWDLCJxFpRs0IzfXfj1o4icJOkUEioexFHzyPurSQ=="],
"pagefind": ["pagefind@1.3.0", "", { "optionalDependencies": { "@pagefind/darwin-arm64": "1.3.0", "@pagefind/darwin-x64": "1.3.0", "@pagefind/linux-arm64": "1.3.0", "@pagefind/linux-x64": "1.3.0", "@pagefind/windows-x64": "1.3.0" }, "bin": { "pagefind": "lib/runner/bin.cjs" } }, "sha512-8KPLGT5g9s+olKMRTU9LFekLizkVIu9tes90O1/aigJ0T5LmyPqTzGJrETnSw3meSYg58YH7JTzhTTW/3z6VAw=="],
"pako": ["pako@0.2.9", "", {}, "sha512-NUcwaKxUxWrZLpDG+z/xZaCgQITkA/Dv4V/T6bw7VON6l1Xz/VnrBqrYjZQ12TamKHzITTfOEIYUj48y2KXImA=="],
"parse-entities": ["parse-entities@4.0.2", "", { "dependencies": { "@types/unist": "^2.0.0", "character-entities-legacy": "^3.0.0", "character-reference-invalid": "^2.0.0", "decode-named-character-reference": "^1.0.0", "is-alphanumerical": "^2.0.0", "is-decimal": "^2.0.0", "is-hexadecimal": "^2.0.0" } }, "sha512-GG2AQYWoLgL877gQIKeRPGO1xF9+eG1ujIb5soS5gPvLQ1y2o8FL90w2QWNdf9I361Mpp7726c+lj3U0qK1uGw=="],
"parse-latin": ["parse-latin@7.0.0", "", { "dependencies": { "@types/nlcst": "^2.0.0", "@types/unist": "^3.0.0", "nlcst-to-string": "^4.0.0", "unist-util-modify-children": "^4.0.0", "unist-util-visit-children": "^3.0.0", "vfile": "^6.0.0" } }, "sha512-mhHgobPPua5kZ98EF4HWiH167JWBfl4pvAIXXdbaVohtK7a6YBOy56kvhCqduqyo/f3yrHFWmqmiMg/BkBkYYQ=="],
"parse5": ["parse5@7.3.0", "", { "dependencies": { "entities": "^6.0.0" } }, "sha512-IInvU7fabl34qmi9gY8XOVxhYyMyuH2xUNpb2q8/Y+7552KlejkRvqvD19nMoUW/uQGGbqNpA6Tufu5FL5BZgw=="],
"parseurl": ["parseurl@1.3.3", "", {}, "sha512-CiyeOxFT/JZyN5m0z9PfXw4SCBJ6Sygz1Dpl0wqjlhDEGGBP1GnsUVEL0p63hoG1fcj3fHynXi9NYO4nWOL+qQ=="],
"path-to-regexp": ["path-to-regexp@8.2.0", "", {}, "sha512-TdrF7fW9Rphjq4RjrW0Kp2AW0Ahwu9sRGTkS6bvDi0SCwZlEZYmcfDbEsTz8RVk0EHIS/Vd1bv3JhG+1xZuAyQ=="],
"peek-readable": ["peek-readable@7.0.0", "", {}, "sha512-nri2TO5JE3/mRryik9LlHFT53cgHfRK0Lt0BAZQXku/AW3E6XLt2GaY8siWi7dvW/m1z0ecn+J+bpDa9ZN3IsQ=="],
"picocolors": ["picocolors@1.1.1", "", {}, "sha512-xceH2snhtb5M9liqDsmEw56le376mTZkEX/jEb/RxNFyegNul7eNslCXP9FDj/Lcu0X8KEyMceP2ntpaHrDEVA=="],
"picomatch": ["picomatch@4.0.2", "", {}, "sha512-M7BAV6Rlcy5u+m6oPhAPFgJTzAioX/6B0DxyvDlo9l8+T3nLKbrczg2WLUyzd45L8RqfUMyGPzekbMvX2Ldkwg=="],
"pino": ["pino@7.11.0", "", { "dependencies": { "atomic-sleep": "^1.0.0", "fast-redact": "^3.0.0", "on-exit-leak-free": "^0.2.0", "pino-abstract-transport": "v0.5.0", "pino-std-serializers": "^4.0.0", "process-warning": "^1.0.0", "quick-format-unescaped": "^4.0.3", "real-require": "^0.1.0", "safe-stable-stringify": "^2.1.0", "sonic-boom": "^2.2.1", "thread-stream": "^0.15.1" }, "bin": { "pino": "bin.js" } }, "sha512-dMACeu63HtRLmCG8VKdy4cShCPKaYDR4youZqoSWLxl5Gu99HUw8bw75thbPv9Nip+H+QYX8o3ZJbTdVZZ2TVg=="],
"pino-abstract-transport": ["pino-abstract-transport@0.5.0", "", { "dependencies": { "duplexify": "^4.1.2", "split2": "^4.0.0" } }, "sha512-+KAgmVeqXYbTtU2FScx1XS3kNyfZ5TrXY07V96QnUSFqo2gAqlvmaxH67Lj7SWazqsMabf+58ctdTcBgnOLUOQ=="],
"pino-pretty": ["pino-pretty@5.1.3", "", { "dependencies": { "@hapi/bourne": "^2.0.0", "args": "^5.0.1", "chalk": "^4.0.0", "dateformat": "^4.5.1", "fast-safe-stringify": "^2.0.7", "jmespath": "^0.15.0", "joycon": "^3.0.0", "pump": "^3.0.0", "readable-stream": "^3.6.0", "rfdc": "^1.3.0", "split2": "^3.1.1", "strip-json-comments": "^3.1.1" }, "bin": { "pino-pretty": "bin.js" } }, "sha512-Zj+0TVdYKkAAIx9EUCL5e4TttwgsaFvJh2ceIMQeFCY8ak9tseEZQGSgpvyjEj1/iIVGIh5tdhkGEQWSMILKHA=="],
"pino-std-serializers": ["pino-std-serializers@4.0.0", "", {}, "sha512-cK0pekc1Kjy5w9V2/n+8MkZwusa6EyyxfeQCB799CQRhRt/CqYKiWs5adeu8Shve2ZNffvfC/7J64A2PJo1W/Q=="],
"pkce-challenge": ["pkce-challenge@4.1.0", "", {}, "sha512-ZBmhE1C9LcPoH9XZSdwiPtbPHZROwAnMy+kIFQVrnMCxY4Cudlz3gBOpzilgc0jOgRaiT3sIWfpMomW2ar2orQ=="],
"possible-typed-array-names": ["possible-typed-array-names@1.1.0", "", {}, "sha512-/+5VFTchJDoVj3bhoqi6UeymcD00DAwb1nJwamzPvHEszJ4FpF6SNNbUbOS8yI56qHzdV8eK0qEfOSiodkTdxg=="],
"postcss": ["postcss@8.5.4", "", { "dependencies": { "nanoid": "^3.3.11", "picocolors": "^1.1.1", "source-map-js": "^1.2.1" } }, "sha512-QSa9EBe+uwlGTFmHsPKokv3B/oEMQZxfqW0QqNCyhpa6mB1afzulwn8hihglqAb2pOw+BJgNlmXQ8la2VeHB7w=="],
"postcss-nested": ["postcss-nested@6.2.0", "", { "dependencies": { "postcss-selector-parser": "^6.1.1" }, "peerDependencies": { "postcss": "^8.2.14" } }, "sha512-HQbt28KulC5AJzG+cZtj9kvKB93CFCdLvog1WFLf1D+xmMvPGlBstkpTEZfK5+AN9hfJocyBFCNiqyS48bpgzQ=="],
"postcss-selector-parser": ["postcss-selector-parser@6.1.2", "", { "dependencies": { "cssesc": "^3.0.0", "util-deprecate": "^1.0.2" } }, "sha512-Q8qQfPiZ+THO/3ZrOrO0cJJKfpYCagtMUkXbnEfmgUjwXg6z/WBeOyS9APBBPCTSiDV+s4SwQGu8yFsiMRIudg=="],
"prebuild-install": ["prebuild-install@7.1.3", "", { "dependencies": { "detect-libc": "^2.0.0", "expand-template": "^2.0.3", "github-from-package": "0.0.0", "minimist": "^1.2.3", "mkdirp-classic": "^0.5.3", "napi-build-utils": "^2.0.0", "node-abi": "^3.3.0", "pump": "^3.0.0", "rc": "^1.2.7", "simple-get": "^4.0.0", "tar-fs": "^2.0.0", "tunnel-agent": "^0.6.0" }, "bin": { "prebuild-install": "bin.js" } }, "sha512-8Mf2cbV7x1cXPUILADGI3wuhfqWvtiLA1iclTDbFRZkgRQS0NqsPZphna9V+HyTEadheuPmjaJMsbzKQFOzLug=="],
"prettier": ["prettier@3.5.3", "", { "bin": { "prettier": "bin/prettier.cjs" } }, "sha512-QQtaxnoDJeAkDvDKWCLiwIXkTgRhwYDEQCghU9Z6q03iyek/rxRh/2lC3HB7P8sWT2xC/y5JDctPLBIGzHKbhw=="],
"prismjs": ["prismjs@1.30.0", "", {}, "sha512-DEvV2ZF2r2/63V+tK8hQvrR2ZGn10srHbXviTlcv7Kpzw8jWiNTqbVgjO3IY8RxrrOUF8VPMQQFysYYYv0YZxw=="],
"process-warning": ["process-warning@1.0.0", "", {}, "sha512-du4wfLyj4yCZq1VupnVSZmRsPJsNuxoDQFdCFHLaYiEbFBD7QE0a+I4D7hOxrVnh78QE/YipFAj9lXHiXocV+Q=="],
"prompts": ["prompts@2.4.2", "", { "dependencies": { "kleur": "^3.0.3", "sisteransi": "^1.0.5" } }, "sha512-NxNv/kLguCA7p3jE8oL2aEBsrJWgAakBpgmgK6lpPWV+WuOmY6r2/zbAVnP+T8bQlA0nzHXSJSJW0Hq7ylaD2Q=="],
"property-information": ["property-information@7.1.0", "", {}, "sha512-TwEZ+X+yCJmYfL7TPUOcvBZ4QfoT5YenQiJuX//0th53DE6w0xxLEtfK3iyryQFddXuvkIk51EEgrJQ0WJkOmQ=="],
"proxy-addr": ["proxy-addr@2.0.7", "", { "dependencies": { "forwarded": "0.2.0", "ipaddr.js": "1.9.1" } }, "sha512-llQsMLSUDUPT44jdrU/O37qlnifitDP+ZwrmmZcoSKyLKvtZxpyV0n2/bD/N4tBAAZ/gJEdZU7KMraoK1+XYAg=="],
"pump": ["pump@3.0.2", "", { "dependencies": { "end-of-stream": "^1.1.0", "once": "^1.3.1" } }, "sha512-tUPXtzlGM8FE3P0ZL6DVs/3P58k9nk8/jZeQCurTJylQA8qFYzHFfhBJkuqyE0FifOsQ0uKWekiZ5g8wtr28cw=="],
"punycode": ["punycode@1.3.2", "", {}, "sha512-RofWgt/7fL5wP1Y7fxE7/EmTLzQVnB0ycyibJ0OOHIlJqTNzglYFxVwETOcIoJqJmpDXJ9xImDv+Fq34F/d4Dw=="],
"qs": ["qs@6.14.0", "", { "dependencies": { "side-channel": "^1.1.0" } }, "sha512-YWWTjgABSKcvs/nWBi9PycY/JiPJqOD4JA6o9Sej2AtvSGarXxKC3OQSk4pAarbdQlKAh5D4FCQkJNkW+GAn3w=="],
"querystring": ["querystring@0.2.0", "", {}, "sha512-X/xY82scca2tau62i9mDyU9K+I+djTMUsvwf7xnUX5GLvVzgJybOJf4Y6o9Zx3oJK/LSXg5tTZBjwzqVPaPO2g=="],
"quick-format-unescaped": ["quick-format-unescaped@4.0.4", "", {}, "sha512-tYC1Q1hgyRuHgloV/YXs2w15unPVh8qfu/qCTfhTYamaw7fyhumKa2yGpdSo87vY32rIclj+4fWYQXUMs9EHvg=="],
"radix3": ["radix3@1.1.2", "", {}, "sha512-b484I/7b8rDEdSDKckSSBA8knMpcdsXudlE/LNL639wFoHKwLbEkQFZHWEYwDC0wa0FKUcCY+GAF73Z7wxNVFA=="],
"range-parser": ["range-parser@1.2.1", "", {}, "sha512-Hrgsx+orqoygnmhFbKaHE6c296J+HTAQXoxEF6gNupROmmGJRoyzfG3ccAveqCBrwr/2yxQ5BVd/GTl5agOwSg=="],
"raw-body": ["raw-body@3.0.0", "", { "dependencies": { "bytes": "3.1.2", "http-errors": "2.0.0", "iconv-lite": "0.6.3", "unpipe": "1.0.0" } }, "sha512-RmkhL8CAyCRPXCE28MMH0z2PNWQBNk2Q09ZdxM9IOOXwxwZbN+qbWaatPkdkWIKL2ZVDImrN/pK5HTRz2PcS4g=="],
"rc": ["rc@1.2.8", "", { "dependencies": { "deep-extend": "^0.6.0", "ini": "~1.3.0", "minimist": "^1.2.0", "strip-json-comments": "~2.0.1" }, "bin": { "rc": "./cli.js" } }, "sha512-y3bGgqKj3QBdxLbLkomlohkvsA8gdAiUQlSBJnBhfn+BPxg4bc62d8TcBW15wavDfgexCgccckhcZvywyQYPOw=="],
"readable-stream": ["readable-stream@3.6.2", "", { "dependencies": { "inherits": "^2.0.3", "string_decoder": "^1.1.1", "util-deprecate": "^1.0.1" } }, "sha512-9u/sniCrY3D5WdsERHzHE4G2YCXqoG5FTHUiCC4SIbr6XcLZBY05ya9EKjYek9O5xOAwjGq+1JdGBAS7Q9ScoA=="],
"readdirp": ["readdirp@4.1.2", "", {}, "sha512-GDhwkLfywWL2s6vEjyhri+eXmfH6j1L7JE27WhqLeYzoh/A3DBaYGEj2H/HFZCn/kMfim73FXxEJTw06WtxQwg=="],
"real-require": ["real-require@0.1.0", "", {}, "sha512-r/H9MzAWtrv8aSVjPCMFpDMl5q66GqtmmRkRjpHTsp4zBAa+snZyiQNlMONiUmEJcsnaw0wCauJ2GWODr/aFkg=="],
"recma-build-jsx": ["recma-build-jsx@1.0.0", "", { "dependencies": { "@types/estree": "^1.0.0", "estree-util-build-jsx": "^3.0.0", "vfile": "^6.0.0" } }, "sha512-8GtdyqaBcDfva+GUKDr3nev3VpKAhup1+RvkMvUxURHpW7QyIvk9F5wz7Vzo06CEMSilw6uArgRqhpiUcWp8ew=="],
"recma-jsx": ["recma-jsx@1.0.0", "", { "dependencies": { "acorn-jsx": "^5.0.0", "estree-util-to-js": "^2.0.0", "recma-parse": "^1.0.0", "recma-stringify": "^1.0.0", "unified": "^11.0.0" } }, "sha512-5vwkv65qWwYxg+Atz95acp8DMu1JDSqdGkA2Of1j6rCreyFUE/gp15fC8MnGEuG1W68UKjM6x6+YTWIh7hZM/Q=="],
"recma-parse": ["recma-parse@1.0.0", "", { "dependencies": { "@types/estree": "^1.0.0", "esast-util-from-js": "^2.0.0", "unified": "^11.0.0", "vfile": "^6.0.0" } }, "sha512-OYLsIGBB5Y5wjnSnQW6t3Xg7q3fQ7FWbw/vcXtORTnyaSFscOtABg+7Pnz6YZ6c27fG1/aN8CjfwoUEUIdwqWQ=="],
"recma-stringify": ["recma-stringify@1.0.0", "", { "dependencies": { "@types/estree": "^1.0.0", "estree-util-to-js": "^2.0.0", "unified": "^11.0.0", "vfile": "^6.0.0" } }, "sha512-cjwII1MdIIVloKvC9ErQ+OgAtwHBmcZ0Bg4ciz78FtbT8In39aAYbaA7zvxQ61xVMSPE8WxhLwLbhif4Js2C+g=="],
"regex": ["regex@6.0.1", "", { "dependencies": { "regex-utilities": "^2.3.0" } }, "sha512-uorlqlzAKjKQZ5P+kTJr3eeJGSVroLKoHmquUj4zHWuR+hEyNqlXsSKlYYF5F4NI6nl7tWCs0apKJ0lmfsXAPA=="],
"regex-recursion": ["regex-recursion@6.0.2", "", { "dependencies": { "regex-utilities": "^2.3.0" } }, "sha512-0YCaSCq2VRIebiaUviZNs0cBz1kg5kVS2UKUfNIx8YVs1cN3AV7NTctO5FOKBA+UT2BPJIWZauYHPqJODG50cg=="],
"regex-utilities": ["regex-utilities@2.3.0", "", {}, "sha512-8VhliFJAWRaUiVvREIiW2NXXTmHs4vMNnSzuJVhscgmGav3g9VDxLrQndI3dZZVVdp0ZO/5v0xmX516/7M9cng=="],
"rehype": ["rehype@13.0.2", "", { "dependencies": { "@types/hast": "^3.0.0", "rehype-parse": "^9.0.0", "rehype-stringify": "^10.0.0", "unified": "^11.0.0" } }, "sha512-j31mdaRFrwFRUIlxGeuPXXKWQxet52RBQRvCmzl5eCefn/KGbomK5GMHNMsOJf55fgo3qw5tST5neDuarDYR2A=="],
"rehype-autolink-headings": ["rehype-autolink-headings@7.1.0", "", { "dependencies": { "@types/hast": "^3.0.0", "@ungap/structured-clone": "^1.0.0", "hast-util-heading-rank": "^3.0.0", "hast-util-is-element": "^3.0.0", "unified": "^11.0.0", "unist-util-visit": "^5.0.0" } }, "sha512-rItO/pSdvnvsP4QRB1pmPiNHUskikqtPojZKJPPPAVx9Hj8i8TwMBhofrrAYRhYOOBZH9tgmG5lPqDLuIWPWmw=="],
"rehype-expressive-code": ["rehype-expressive-code@0.41.2", "", { "dependencies": { "expressive-code": "^0.41.2" } }, "sha512-vHYfWO9WxAw6kHHctddOt+P4266BtyT1mrOIuxJD+1ELuvuJAa5uBIhYt0OVMyOhlvf57hzWOXJkHnMhpaHyxw=="],
"rehype-format": ["rehype-format@5.0.1", "", { "dependencies": { "@types/hast": "^3.0.0", "hast-util-format": "^1.0.0" } }, "sha512-zvmVru9uB0josBVpr946OR8ui7nJEdzZobwLOOqHb/OOD88W0Vk2SqLwoVOj0fM6IPCCO6TaV9CvQvJMWwukFQ=="],
"rehype-parse": ["rehype-parse@9.0.1", "", { "dependencies": { "@types/hast": "^3.0.0", "hast-util-from-html": "^2.0.0", "unified": "^11.0.0" } }, "sha512-ksCzCD0Fgfh7trPDxr2rSylbwq9iYDkSn8TCDmEJ49ljEUBxDVCzCHv7QNzZOfODanX4+bWQ4WZqLCRWYLfhag=="],
"rehype-raw": ["rehype-raw@7.0.0", "", { "dependencies": { "@types/hast": "^3.0.0", "hast-util-raw": "^9.0.0", "vfile": "^6.0.0" } }, "sha512-/aE8hCfKlQeA8LmyeyQvQF3eBiLRGNlfBJEvWH7ivp9sBqs7TNqBL5X3v157rM4IFETqDnIOO+z5M/biZbo9Ww=="],
"rehype-recma": ["rehype-recma@1.0.0", "", { "dependencies": { "@types/estree": "^1.0.0", "@types/hast": "^3.0.0", "hast-util-to-estree": "^3.0.0" } }, "sha512-lqA4rGUf1JmacCNWWZx0Wv1dHqMwxzsDWYMTowuplHF3xH0N/MmrZ/G3BDZnzAkRmxDadujCjaKM2hqYdCBOGw=="],
"rehype-stringify": ["rehype-stringify@10.0.1", "", { "dependencies": { "@types/hast": "^3.0.0", "hast-util-to-html": "^9.0.0", "unified": "^11.0.0" } }, "sha512-k9ecfXHmIPuFVI61B9DeLPN0qFHfawM6RsuX48hoqlaKSF61RskNjSm1lI8PhBEM0MRdLxVVm4WmTqJQccH9mA=="],
"remark-directive": ["remark-directive@3.0.1", "", { "dependencies": { "@types/mdast": "^4.0.0", "mdast-util-directive": "^3.0.0", "micromark-extension-directive": "^3.0.0", "unified": "^11.0.0" } }, "sha512-gwglrEQEZcZYgVyG1tQuA+h58EZfq5CSULw7J90AFuCTyib1thgHPoqQ+h9iFvU6R+vnZ5oNFQR5QKgGpk741A=="],
"remark-gfm": ["remark-gfm@4.0.1", "", { "dependencies": { "@types/mdast": "^4.0.0", "mdast-util-gfm": "^3.0.0", "micromark-extension-gfm": "^3.0.0", "remark-parse": "^11.0.0", "remark-stringify": "^11.0.0", "unified": "^11.0.0" } }, "sha512-1quofZ2RQ9EWdeN34S79+KExV1764+wCUGop5CPL1WGdD0ocPpu91lzPGbwWMECpEpd42kJGQwzRfyov9j4yNg=="],
"remark-mdx": ["remark-mdx@3.1.0", "", { "dependencies": { "mdast-util-mdx": "^3.0.0", "micromark-extension-mdxjs": "^3.0.0" } }, "sha512-Ngl/H3YXyBV9RcRNdlYsZujAmhsxwzxpDzpDEhFBVAGthS4GDgnctpDjgFl/ULx5UEDzqtW1cyBSNKqYYrqLBA=="],
"remark-parse": ["remark-parse@11.0.0", "", { "dependencies": { "@types/mdast": "^4.0.0", "mdast-util-from-markdown": "^2.0.0", "micromark-util-types": "^2.0.0", "unified": "^11.0.0" } }, "sha512-FCxlKLNGknS5ba/1lmpYijMUzX2esxW5xQqjWxw2eHFfS2MSdaHVINFmhjo+qN1WhZhNimq0dZATN9pH0IDrpA=="],
"remark-rehype": ["remark-rehype@11.1.2", "", { "dependencies": { "@types/hast": "^3.0.0", "@types/mdast": "^4.0.0", "mdast-util-to-hast": "^13.0.0", "unified": "^11.0.0", "vfile": "^6.0.0" } }, "sha512-Dh7l57ianaEoIpzbp0PC9UKAdCSVklD8E5Rpw7ETfbTl3FqcOOgq5q2LVDhgGCkaBv7p24JXikPdvhhmHvKMsw=="],
"remark-smartypants": ["remark-smartypants@3.0.2", "", { "dependencies": { "retext": "^9.0.0", "retext-smartypants": "^6.0.0", "unified": "^11.0.4", "unist-util-visit": "^5.0.0" } }, "sha512-ILTWeOriIluwEvPjv67v7Blgrcx+LZOkAUVtKI3putuhlZm84FnqDORNXPPm+HY3NdZOMhyDwZ1E+eZB/Df5dA=="],
"remark-stringify": ["remark-stringify@11.0.0", "", { "dependencies": { "@types/mdast": "^4.0.0", "mdast-util-to-markdown": "^2.0.0", "unified": "^11.0.0" } }, "sha512-1OSmLd3awB/t8qdoEOMazZkNsfVTeY4fTsgzcQFdXNq8ToTN4ZGwrMnlda4K6smTFKD+GRV6O48i6Z4iKgPPpw=="],
"remeda": ["remeda@2.22.3", "", { "dependencies": { "type-fest": "^4.40.1" } }, "sha512-Ka6965m9Zu9OLsysWxVf3jdJKmp6+PKzDv7HWHinEevf0JOJ9y02YpjiC/sKxRpCqGhVyvm1U+0YIj+E6DMgKw=="],
"restructure": ["restructure@3.0.2", "", {}, "sha512-gSfoiOEA0VPE6Tukkrr7I0RBdE0s7H1eFCDBk05l1KIQT1UIKNc5JZy6jdyW6eYH3aR3g5b3PuL77rq0hvwtAw=="],
"retext": ["retext@9.0.0", "", { "dependencies": { "@types/nlcst": "^2.0.0", "retext-latin": "^4.0.0", "retext-stringify": "^4.0.0", "unified": "^11.0.0" } }, "sha512-sbMDcpHCNjvlheSgMfEcVrZko3cDzdbe1x/e7G66dFp0Ff7Mldvi2uv6JkJQzdRcvLYE8CA8Oe8siQx8ZOgTcA=="],
"retext-latin": ["retext-latin@4.0.0", "", { "dependencies": { "@types/nlcst": "^2.0.0", "parse-latin": "^7.0.0", "unified": "^11.0.0" } }, "sha512-hv9woG7Fy0M9IlRQloq/N6atV82NxLGveq+3H2WOi79dtIYWN8OaxogDm77f8YnVXJL2VD3bbqowu5E3EMhBYA=="],
"retext-smartypants": ["retext-smartypants@6.2.0", "", { "dependencies": { "@types/nlcst": "^2.0.0", "nlcst-to-string": "^4.0.0", "unist-util-visit": "^5.0.0" } }, "sha512-kk0jOU7+zGv//kfjXEBjdIryL1Acl4i9XNkHxtM7Tm5lFiCog576fjNC9hjoR7LTKQ0DsPWy09JummSsH1uqfQ=="],
"retext-stringify": ["retext-stringify@4.0.0", "", { "dependencies": { "@types/nlcst": "^2.0.0", "nlcst-to-string": "^4.0.0", "unified": "^11.0.0" } }, "sha512-rtfN/0o8kL1e+78+uxPTqu1Klt0yPzKuQ2BfWwwfgIUSayyzxpM1PJzkKt4V8803uB9qSy32MvI7Xep9khTpiA=="],
"rfdc": ["rfdc@1.4.1", "", {}, "sha512-q1b3N5QkRUWUl7iyylaaj3kOpIT0N2i9MqIEQXP73GVsN9cw3fdx8X63cEmWhJGi2PPCF23Ijp7ktmd39rawIA=="],
"rollup": ["rollup@4.41.1", "", { "dependencies": { "@types/estree": "1.0.7" }, "optionalDependencies": { "@rollup/rollup-android-arm-eabi": "4.41.1", "@rollup/rollup-android-arm64": "4.41.1", "@rollup/rollup-darwin-arm64": "4.41.1", "@rollup/rollup-darwin-x64": "4.41.1", "@rollup/rollup-freebsd-arm64": "4.41.1", "@rollup/rollup-freebsd-x64": "4.41.1", "@rollup/rollup-linux-arm-gnueabihf": "4.41.1", "@rollup/rollup-linux-arm-musleabihf": "4.41.1", "@rollup/rollup-linux-arm64-gnu": "4.41.1", "@rollup/rollup-linux-arm64-musl": "4.41.1", "@rollup/rollup-linux-loongarch64-gnu": "4.41.1", "@rollup/rollup-linux-powerpc64le-gnu": "4.41.1", "@rollup/rollup-linux-riscv64-gnu": "4.41.1", "@rollup/rollup-linux-riscv64-musl": "4.41.1", "@rollup/rollup-linux-s390x-gnu": "4.41.1", "@rollup/rollup-linux-x64-gnu": "4.41.1", "@rollup/rollup-linux-x64-musl": "4.41.1", "@rollup/rollup-win32-arm64-msvc": "4.41.1", "@rollup/rollup-win32-ia32-msvc": "4.41.1", "@rollup/rollup-win32-x64-msvc": "4.41.1", "fsevents": "~2.3.2" }, "bin": { "rollup": "dist/bin/rollup" } }, "sha512-cPmwD3FnFv8rKMBc1MxWCwVQFxwf1JEmSX3iQXrRVVG15zerAIXRjMFVWnd5Q5QvgKF7Aj+5ykXFhUl+QGnyOw=="],
"router": ["router@2.2.0", "", { "dependencies": { "debug": "^4.4.0", "depd": "^2.0.0", "is-promise": "^4.0.0", "parseurl": "^1.3.3", "path-to-regexp": "^8.0.0" } }, "sha512-nLTrUKm2UyiL7rlhapu/Zl45FwNgkZGaCpZbIHajDYgwlJCOzLSk+cIPAnsEqV955GjILJnKbdQC1nVPz+gAYQ=="],
"safe-buffer": ["safe-buffer@5.2.1", "", {}, "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ=="],
"safe-regex-test": ["safe-regex-test@1.1.0", "", { "dependencies": { "call-bound": "^1.0.2", "es-errors": "^1.3.0", "is-regex": "^1.2.1" } }, "sha512-x/+Cz4YrimQxQccJf5mKEbIa1NzeCRNI5Ecl/ekmlYaampdNLPalVyIcCZNNH3MvmqBugV5TMYZXv0ljslUlaw=="],
"safe-stable-stringify": ["safe-stable-stringify@2.5.0", "", {}, "sha512-b3rppTKm9T+PsVCBEOUR46GWI7fdOs00VKZ1+9c1EWDaDMvjQc6tUwuFyIprgGgTcWoVHSKrU8H31ZHA2e0RHA=="],
"safer-buffer": ["safer-buffer@2.1.2", "", {}, "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg=="],
"sax": ["sax@1.2.1", "", {}, "sha512-8I2a3LovHTOpm7NV5yOyO8IHqgVsfK4+UuySrXU8YXkSRX7k6hCV9b3HrkKCr3nMpgj+0bmocaJJWpvp1oc7ZA=="],
"semver": ["semver@7.7.2", "", { "bin": { "semver": "bin/semver.js" } }, "sha512-RF0Fw+rO5AMf9MAyaRXI4AV0Ulj5lMHqVxxdSgiVbixSCXoEmmX/jk0CuJw4+3SqroYO9VoUh+HcuJivvtJemA=="],
"send": ["send@1.2.0", "", { "dependencies": { "debug": "^4.3.5", "encodeurl": "^2.0.0", "escape-html": "^1.0.3", "etag": "^1.8.1", "fresh": "^2.0.0", "http-errors": "^2.0.0", "mime-types": "^3.0.1", "ms": "^2.1.3", "on-finished": "^2.4.1", "range-parser": "^1.2.1", "statuses": "^2.0.1" } }, "sha512-uaW0WwXKpL9blXE2o0bRhoL2EGXIrZxQ2ZQ4mgcfoBxdFmQold+qWsD2jLrfZ0trjKL6vOw0j//eAwcALFjKSw=="],
"seroval": ["seroval@1.3.2", "", {}, "sha512-RbcPH1n5cfwKrru7v7+zrZvjLurgHhGyso3HTyGtRivGWgYjbOmGuivCQaORNELjNONoK35nj28EoWul9sb1zQ=="],
"seroval-plugins": ["seroval-plugins@1.3.2", "", { "peerDependencies": { "seroval": "^1.0" } }, "sha512-0QvCV2lM3aj/U3YozDiVwx9zpH0q8A60CTWIv4Jszj/givcudPb48B+rkU5D51NJ0pTpweGMttHjboPa9/zoIQ=="],
"serve-static": ["serve-static@2.2.0", "", { "dependencies": { "encodeurl": "^2.0.0", "escape-html": "^1.0.3", "parseurl": "^1.3.3", "send": "^1.2.0" } }, "sha512-61g9pCh0Vnh7IutZjtLGGpTA355+OPn2TyDv/6ivP2h/AdAVX9azsoxmg2/M6nZeQZNYBEwIcsne1mJd9oQItQ=="],
"set-function-length": ["set-function-length@1.2.2", "", { "dependencies": { "define-data-property": "^1.1.4", "es-errors": "^1.3.0", "function-bind": "^1.1.2", "get-intrinsic": "^1.2.4", "gopd": "^1.0.1", "has-property-descriptors": "^1.0.2" } }, "sha512-pgRc4hJ4/sNjWCSS9AmnS40x3bNMDTknHgL5UaMBTMyJnU90EgWh1Rz+MC9eFu4BuN/UwZjKQuY/1v3rM7HMfg=="],
"setprototypeof": ["setprototypeof@1.2.0", "", {}, "sha512-E5LDX7Wrp85Kil5bhZv46j8jOeboKq5JMmYM3gVGdGH8xFpPWXUMsNrlODCrkoxMEeNi/XZIwuRvY4XNwYMJpw=="],
"sharp": ["sharp@0.32.5", "", { "dependencies": { "color": "^4.2.3", "detect-libc": "^2.0.2", "node-addon-api": "^6.1.0", "prebuild-install": "^7.1.1", "semver": "^7.5.4", "simple-get": "^4.0.1", "tar-fs": "^3.0.4", "tunnel-agent": "^0.6.0" } }, "sha512-0dap3iysgDkNaPOaOL4X/0akdu0ma62GcdC2NBQ+93eqpePdDdr2/LM0sFdDSMmN7yS+odyZtPsb7tx/cYBKnQ=="],
"shiki": ["shiki@3.4.2", "", { "dependencies": { "@shikijs/core": "3.4.2", "@shikijs/engine-javascript": "3.4.2", "@shikijs/engine-oniguruma": "3.4.2", "@shikijs/langs": "3.4.2", "@shikijs/themes": "3.4.2", "@shikijs/types": "3.4.2", "@shikijs/vscode-textmate": "^10.0.2", "@types/hast": "^3.0.4" } }, "sha512-wuxzZzQG8kvZndD7nustrNFIKYJ1jJoWIPaBpVe2+KHSvtzMi4SBjOxrigs8qeqce/l3U0cwiC+VAkLKSunHQQ=="],
"side-channel": ["side-channel@1.1.0", "", { "dependencies": { "es-errors": "^1.3.0", "object-inspect": "^1.13.3", "side-channel-list": "^1.0.0", "side-channel-map": "^1.0.1", "side-channel-weakmap": "^1.0.2" } }, "sha512-ZX99e6tRweoUXqR+VBrslhda51Nh5MTQwou5tnUDgbtyM0dBgmhEDtWGP/xbKn6hqfPRHujUNwz5fy/wbbhnpw=="],
"side-channel-list": ["side-channel-list@1.0.0", "", { "dependencies": { "es-errors": "^1.3.0", "object-inspect": "^1.13.3" } }, "sha512-FCLHtRD/gnpCiCHEiJLOwdmFP+wzCmDEkc9y7NsYxeF4u7Btsn1ZuwgwJGxImImHicJArLP4R0yX4c2KCrMrTA=="],
"side-channel-map": ["side-channel-map@1.0.1", "", { "dependencies": { "call-bound": "^1.0.2", "es-errors": "^1.3.0", "get-intrinsic": "^1.2.5", "object-inspect": "^1.13.3" } }, "sha512-VCjCNfgMsby3tTdo02nbjtM/ewra6jPHmpThenkTYh8pG9ucZ/1P8So4u4FGBek/BjpOVsDCMoLA/iuBKIFXRA=="],
"side-channel-weakmap": ["side-channel-weakmap@1.0.2", "", { "dependencies": { "call-bound": "^1.0.2", "es-errors": "^1.3.0", "get-intrinsic": "^1.2.5", "object-inspect": "^1.13.3", "side-channel-map": "^1.0.1" } }, "sha512-WPS/HvHQTYnHisLo9McqBHOJk2FkHO/tlpvldyrnem4aeQp4hai3gythswg6p01oSoTl58rcpiFAjF2br2Ak2A=="],
"simple-concat": ["simple-concat@1.0.1", "", {}, "sha512-cSFtAPtRhljv69IK0hTVZQ+OfE9nePi/rtJmw5UjHeVyVroEqJXP1sFztKUy1qU+xvz3u/sfYJLa947b7nAN2Q=="],
"simple-get": ["simple-get@4.0.1", "", { "dependencies": { "decompress-response": "^6.0.0", "once": "^1.3.1", "simple-concat": "^1.0.0" } }, "sha512-brv7p5WgH0jmQJr1ZDDfKDOSeWWg+OVypG99A/5vYGPqJ6pxiaHLy8nxtFjBA7oMa01ebA9gfh1uMCFqOuXxvA=="],
"simple-swizzle": ["simple-swizzle@0.2.2", "", { "dependencies": { "is-arrayish": "^0.3.1" } }, "sha512-JA//kQgZtbuY83m+xT+tXJkmJncGMTFT+C+g2h2R9uxkYIrE2yy9sgmcLhCnw57/WSD+Eh3J97FPEDFnbXnDUg=="],
"sisteransi": ["sisteransi@1.0.5", "", {}, "sha512-bLGGlR1QxBcynn2d5YmDX4MGjlZvy2MRBDRNHLJ8VI6l6+9FUiyTFNJ0IveOSP0bcXgVDPRcfGqA0pjaqUpfVg=="],
"sitemap": ["sitemap@8.0.0", "", { "dependencies": { "@types/node": "^17.0.5", "@types/sax": "^1.2.1", "arg": "^5.0.0", "sax": "^1.2.4" }, "bin": { "sitemap": "dist/cli.js" } }, "sha512-+AbdxhM9kJsHtruUF39bwS/B0Fytw6Fr1o4ZAIAEqA6cke2xcoO2GleBw9Zw7nRzILVEgz7zBM5GiTJjie1G9A=="],
"smol-toml": ["smol-toml@1.3.4", "", {}, "sha512-UOPtVuYkzYGee0Bd2Szz8d2G3RfMfJ2t3qVdZUAozZyAk+a0Sxa+QKix0YCwjL/A1RR0ar44nCxaoN9FxdJGwA=="],
"solid-js": ["solid-js@1.9.7", "", { "dependencies": { "csstype": "^3.1.0", "seroval": "~1.3.0", "seroval-plugins": "~1.3.0" } }, "sha512-/saTKi8iWEM233n5OSi1YHCCuh66ZIQ7aK2hsToPe4tqGm7qAejU1SwNuTPivbWAYq7SjuHVVYxxuZQNRbICiw=="],
"solid-refresh": ["solid-refresh@0.6.3", "", { "dependencies": { "@babel/generator": "^7.23.6", "@babel/helper-module-imports": "^7.22.15", "@babel/types": "^7.23.6" }, "peerDependencies": { "solid-js": "^1.3" } }, "sha512-F3aPsX6hVw9ttm5LYlth8Q15x6MlI/J3Dn+o3EQyRTtTxidepSTwAYdozt01/YA+7ObcciagGEyXIopGZzQtbA=="],
"sonic-boom": ["sonic-boom@2.8.0", "", { "dependencies": { "atomic-sleep": "^1.0.0" } }, "sha512-kuonw1YOYYNOve5iHdSahXPOK49GqwA+LZhI6Wz/l0rP57iKyXXIHaRagOBHAPmGwJC6od2Z9zgvZ5loSgMlVg=="],
"source-map": ["source-map@0.7.4", "", {}, "sha512-l3BikUxvPOcn5E74dZiq5BGsTb5yEwhaTSzccU6t4sDOH8NWJCstKO5QT2CvtFoK6F0saL7p9xHAqHOlCPJygA=="],
"source-map-js": ["source-map-js@1.2.1", "", {}, "sha512-UXWMKhLOwVKb728IUtQPXxfYU+usdybtUrK/8uGE8CQMvrhOpwvzDBwj0QhSL7MQc7vIsISBG8VQ8+IDQxpfQA=="],
"space-separated-tokens": ["space-separated-tokens@2.0.2", "", {}, "sha512-PEGlAwrG8yXGXRjW32fGbg66JAlOAwbObuqVoJpv/mRgoWDQfgH1wDPvtzWyUSNAXBGSk8h755YDbbcEy3SH2Q=="],
"split2": ["split2@3.2.2", "", { "dependencies": { "readable-stream": "^3.0.0" } }, "sha512-9NThjpgZnifTkJpzTZ7Eue85S49QwpNhZTq6GRJwObb6jnLFNGB7Qm73V5HewTROPyxD0C29xqmaI68bQtV+hg=="],
"sst": ["sst@3.16.0", "", { "dependencies": { "aws-sdk": "2.1692.0", "aws4fetch": "1.0.18", "jose": "5.2.3", "opencontrol": "0.0.6", "openid-client": "5.6.4" }, "optionalDependencies": { "sst-darwin-arm64": "3.16.0", "sst-darwin-x64": "3.16.0", "sst-linux-arm64": "3.16.0", "sst-linux-x64": "3.16.0", "sst-linux-x86": "3.16.0", "sst-win32-arm64": "3.16.0", "sst-win32-x64": "3.16.0", "sst-win32-x86": "3.16.0" }, "bin": { "sst": "bin/sst.mjs" } }, "sha512-XX4ktkpyvB2lQCG8/jgH/RWAtdNahE/MjlK6OctM4Nagk1rOrMxxzARit2ZFCisX+ZBvcN0ymgJimnfZqWjM7Q=="],
"sst-darwin-arm64": ["sst-darwin-arm64@3.16.0", "", { "os": "darwin", "cpu": "arm64" }, "sha512-NJDGjZ0bl+hWJoT1P2KLyA65OXHkItVg3BNkRsas6qaa+c1U6GU8wLFnfdqkDRnJIYhOIsnZtIquNp7lMIr3ww=="],
"sst-darwin-x64": ["sst-darwin-x64@3.16.0", "", { "os": "darwin", "cpu": "x64" }, "sha512-IZiIUZgTGKjW+aR6/qgqNMzdFS2789PBQjsMquXaTZc7ebRutbCozQ4CC78SuwPXDUZ0/Bz+hyGeXHNOB52lVQ=="],
"sst-linux-arm64": ["sst-linux-arm64@3.16.0", "", { "os": "linux", "cpu": "arm64" }, "sha512-pvbxU+hrbvtIt347ilbXzVQEl2kXXBIYArLMzblPNg4KblCRvJvH595P86hrr8ZojlOkEb1rC8NSAwiZyBad4g=="],
"sst-linux-x64": ["sst-linux-x64@3.16.0", "", { "os": "linux", "cpu": "x64" }, "sha512-p7qtmdiG1imWSZ7gUbVecee6TIuILTvIe6dgpvkgznYvuTFiMCZaY2SNMFuNRiBoN5zZI0y5osDDXY2uzzo7rA=="],
"sst-linux-x86": ["sst-linux-x86@3.16.0", "", { "os": "linux", "cpu": "none" }, "sha512-bw+enzOnZ+MjGd7/h4swGfHpIoyLbIdguelGV7vZLIeuV4t4rZ/hAqfR25GEMjjonVv3Py5hsasMzR2s9GsBLA=="],
"sst-win32-arm64": ["sst-win32-arm64@3.16.0", "", { "os": "win32", "cpu": "arm64" }, "sha512-bjjYn1gq1p1tBFKvuB3K5ZMuofK/WWmrtKpD+OJOf8PE5fxzRJ8yvOFVIm1QhD4hxDQAPdNonE/P/cXDtKXQig=="],
"sst-win32-x64": ["sst-win32-x64@3.16.0", "", { "os": "win32", "cpu": "x64" }, "sha512-WFHaUyaLHepKPOMFr7Kf8iECIg1prn3L7c5r+IKgIiv+KznOeslwG6f9mYwxcOYZrZNiXVeDJmDp9xZtB5auSQ=="],
"sst-win32-x86": ["sst-win32-x86@3.16.0", "", { "os": "win32", "cpu": "none" }, "sha512-Twbdy9sS6zSKsdwpWVEYpFEjVcRAn0Ufdbz+pVdMK3JXniSB7MLC6/KQuxUwvUk2a88+jnPuPVXAYC51SgzDyg=="],
"statuses": ["statuses@2.0.1", "", {}, "sha512-RwNA9Z/7PrK06rYLIzFMlaF+l73iwpzsqRIFgbMLbTcLD6cOao82TaWefPXQvB2fOC4AjuYSEndS7N/mTCbkdQ=="],
"stream-replace-string": ["stream-replace-string@2.0.0", "", {}, "sha512-TlnjJ1C0QrmxRNrON00JvaFFlNh5TTG00APw23j74ET7gkQpTASi6/L2fuiav8pzK715HXtUeClpBTw2NPSn6w=="],
"stream-shift": ["stream-shift@1.0.3", "", {}, "sha512-76ORR0DO1o1hlKwTbi/DM3EXWGf3ZJYO8cXX5RJwnul2DEg2oyoZyjLNoQM8WsvZiFKCRfC1O0J7iCvie3RZmQ=="],
"streamx": ["streamx@2.22.0", "", { "dependencies": { "fast-fifo": "^1.3.2", "text-decoder": "^1.1.0" }, "optionalDependencies": { "bare-events": "^2.2.0" } }, "sha512-sLh1evHOzBy/iWRiR6d1zRcLao4gGZr3C1kzNz4fopCOKJb6xD9ub8Mpi9Mr1R6id5o43S+d93fI48UC5uM9aw=="],
"string-width": ["string-width@7.2.0", "", { "dependencies": { "emoji-regex": "^10.3.0", "get-east-asian-width": "^1.0.0", "strip-ansi": "^7.1.0" } }, "sha512-tsaTIkKW9b4N+AEj+SVA+WhJzV7/zMhcSu78mLKWSk7cXMOSHsBKFWUs0fWwq8QyK3MgJBQRX6Gbi4kYbdvGkQ=="],
"string_decoder": ["string_decoder@1.3.0", "", { "dependencies": { "safe-buffer": "~5.2.0" } }, "sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA=="],
"stringify-entities": ["stringify-entities@4.0.4", "", { "dependencies": { "character-entities-html4": "^2.0.0", "character-entities-legacy": "^3.0.0" } }, "sha512-IwfBptatlO+QCJUo19AqvrPNqlVMpW9YEL2LIVY+Rpv2qsjCGxaDLNRgeGsQWJhfItebuJhsGSLjaBbNSQ+ieg=="],
"strip-ansi": ["strip-ansi@7.1.0", "", { "dependencies": { "ansi-regex": "^6.0.1" } }, "sha512-iq6eVVI64nQQTRYq2KtEg2d2uU7LElhTJwsH4YzIHZshxlgZms/wIc4VoDQTlG/IvVIrBKG06CrZnp0qv7hkcQ=="],
"strip-json-comments": ["strip-json-comments@3.1.1", "", {}, "sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig=="],
"strtok3": ["strtok3@10.2.2", "", { "dependencies": { "@tokenizer/token": "^0.3.0", "peek-readable": "^7.0.0" } }, "sha512-Xt18+h4s7Z8xyZ0tmBoRmzxcop97R4BAh+dXouUDCYn+Em+1P3qpkUfI5ueWLT8ynC5hZ+q4iPEmGG1urvQGBg=="],
"style-to-js": ["style-to-js@1.1.16", "", { "dependencies": { "style-to-object": "1.0.8" } }, "sha512-/Q6ld50hKYPH3d/r6nr117TZkHR0w0kGGIVfpG9N6D8NymRPM9RqCUv4pRpJ62E5DqOYx2AFpbZMyCPnjQCnOw=="],
"style-to-object": ["style-to-object@1.0.8", "", { "dependencies": { "inline-style-parser": "0.2.4" } }, "sha512-xT47I/Eo0rwJmaXC4oilDGDWLohVhR6o/xAQcPQN8q6QBuZVL8qMYL85kLmST5cPjAorwvqIA4qXTRQoYHaL6g=="],
"supports-color": ["supports-color@7.2.0", "", { "dependencies": { "has-flag": "^4.0.0" } }, "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw=="],
"tar-fs": ["tar-fs@3.0.9", "", { "dependencies": { "pump": "^3.0.0", "tar-stream": "^3.1.5" }, "optionalDependencies": { "bare-fs": "^4.0.1", "bare-path": "^3.0.0" } }, "sha512-XF4w9Xp+ZQgifKakjZYmFdkLoSWd34VGKcsTCwlNWM7QG3ZbaxnTsaBwnjFZqHRf/rROxaR8rXnbtwdvaDI+lA=="],
"tar-stream": ["tar-stream@3.1.7", "", { "dependencies": { "b4a": "^1.6.4", "fast-fifo": "^1.2.0", "streamx": "^2.15.0" } }, "sha512-qJj60CXt7IU1Ffyc3NJMjh6EkuCFej46zUqJ4J7pqYlThyd9bO0XBTmcOIhSzZJVWfsLks0+nle/j538YAW9RQ=="],
"text-decoder": ["text-decoder@1.2.3", "", { "dependencies": { "b4a": "^1.6.4" } }, "sha512-3/o9z3X0X0fTupwsYvR03pJ/DjWuqqrfwBgTQzdWDiQSm9KitAyz/9WqsT2JQW7KV2m+bC2ol/zqpW37NHxLaA=="],
"thread-stream": ["thread-stream@0.15.2", "", { "dependencies": { "real-require": "^0.1.0" } }, "sha512-UkEhKIg2pD+fjkHQKyJO3yoIvAP3N6RlNFt2dUhcS1FGvCD1cQa1M/PGknCLFIyZdtJOWQjejp7bdNqmN7zwdA=="],
"tiny-inflate": ["tiny-inflate@1.0.3", "", {}, "sha512-pkY1fj1cKHb2seWDy0B16HeWyczlJA9/WW3u3c4z/NiWDsO3DOU5D7nhTLE9CF0yXv/QZFY7sEJmj24dK+Rrqw=="],
"tinyexec": ["tinyexec@0.3.2", "", {}, "sha512-KQQR9yN7R5+OSwaK0XQoj22pwHoTlgYqmUscPYoknOoWCWfj/5/ABTMRi69FrKU5ffPVh5QcFikpWJI/P1ocHA=="],
"tinyglobby": ["tinyglobby@0.2.14", "", { "dependencies": { "fdir": "^6.4.4", "picomatch": "^4.0.2" } }, "sha512-tX5e7OM1HnYr2+a2C/4V0htOcSQcoSTH9KgJnVvNm5zm/cyEWKJ7j7YutsH9CxMdtOkkLFy2AHrMci9IM8IPZQ=="],
"toidentifier": ["toidentifier@1.0.1", "", {}, "sha512-o5sSPKEkg/DIQNmH43V0/uerLrpzVedkUh8tGNvaeXpfpuwjKenlSox/2O/BTlZUtEe+JG7s5YhEz608PlAHRA=="],
"token-types": ["token-types@6.0.0", "", { "dependencies": { "@tokenizer/token": "^0.3.0", "ieee754": "^1.2.1" } }, "sha512-lbDrTLVsHhOMljPscd0yitpozq7Ga2M5Cvez5AjGg8GASBjtt6iERCAJ93yommPmz62fb45oFIXHEZ3u9bfJEA=="],
"toolbeam-docs-theme": ["toolbeam-docs-theme@0.2.4", "", { "peerDependencies": { "@astrojs/starlight": "^0.34.3", "astro": "^5.7.13" } }, "sha512-W5mdbcgRpTBDFyEdcU81USs3MFZoXMInpSznc/AFZCwqz8atk4iBNDIlhvihpGHY54Nf5crKmZwJjxVojkHFvA=="],
"tr46": ["tr46@0.0.3", "", {}, "sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw=="],
"trim-lines": ["trim-lines@3.0.1", "", {}, "sha512-kRj8B+YHZCc9kQYdWfJB2/oUl9rA99qbowYYBtr4ui4mZyAQ2JpvVBd/6U2YloATfqBhBTSMhTpgBHtU0Mf3Rg=="],
"trough": ["trough@2.2.0", "", {}, "sha512-tmMpK00BjZiUyVyvrBK7knerNgmgvcV/KLVyuma/SC+TQN167GrMRciANTz09+k3zW8L8t60jWO1GpfkZdjTaw=="],
"ts-lsp-client": ["ts-lsp-client@1.0.3", "", { "dependencies": { "json-rpc-2.0": "^1.7.0", "pino": "^7.0.5", "pino-pretty": "^5.1.3", "tslib": "~2.6.2" } }, "sha512-0ItrsqvNUM9KNFGbeT1N8jSi9gvasGOvxJUXjGf4P2TX0w250AUWLeRStaSrQbYcFDshDtE5d4BshUmYwodDgw=="],
"tsconfck": ["tsconfck@3.1.6", "", { "peerDependencies": { "typescript": "^5.0.0" }, "optionalPeers": ["typescript"], "bin": { "tsconfck": "bin/tsconfck.js" } }, "sha512-ks6Vjr/jEw0P1gmOVwutM3B7fWxoWBL2KRDb1JfqGVawBmO5UsvmWOQFGHBPl5yxYz4eERr19E6L7NMv+Fej4w=="],
"tslib": ["tslib@2.6.3", "", {}, "sha512-xNvxJEOUiWPGhUuUdQgAJPKOOJfGnIyKySOc09XkKsgdUV/3E2zvwZYdejjmRgPCgcym1juLH3226yA7sEFJKQ=="],
"tunnel-agent": ["tunnel-agent@0.6.0", "", { "dependencies": { "safe-buffer": "^5.0.1" } }, "sha512-McnNiV1l8RYeY8tBgEpuodCC1mLUdbSN+CYBL7kJsJNInOP8UjDDEwdk6Mw60vdLLrr5NHKZhMAOSrR2NZuQ+w=="],
"turndown": ["turndown@7.2.0", "", { "dependencies": { "@mixmark-io/domino": "^2.2.0" } }, "sha512-eCZGBN4nNNqM9Owkv9HAtWRYfLA4h909E/WGAWWBpmB275ehNhZyk87/Tpvjbp0jjNl9XwCsbe6bm6CqFsgD+A=="],
"type-fest": ["type-fest@4.41.0", "", {}, "sha512-TeTSQ6H5YHvpqVwBRcnLDCBnDOHWYu7IvGbHT6N8AOymcr9PJGjc1GTtiWZTYg0NCgYwvnYWEkVChQAr9bjfwA=="],
"type-is": ["type-is@2.0.1", "", { "dependencies": { "content-type": "^1.0.5", "media-typer": "^1.1.0", "mime-types": "^3.0.0" } }, "sha512-OZs6gsjF4vMp32qrCbiVSkrFmXtG/AZhY3t0iAMrMBiAZyV9oALtXO8hsrHbMXF9x6L3grlFuwW2oAz7cav+Gw=="],
"typescript": ["typescript@5.8.2", "", { "bin": { "tsc": "bin/tsc", "tsserver": "bin/tsserver" } }, "sha512-aJn6wq13/afZp/jT9QZmwEjDqqvSGp1VT5GVg+f/t6/oVyrgXM6BY1h9BRh/O5p3PlUPAe+WuiEZOmb/49RqoQ=="],
"ufo": ["ufo@1.6.1", "", {}, "sha512-9a4/uxlTWJ4+a5i0ooc1rU7C7YOw3wT+UGqdeNNHWnOF9qcMBgLRS+4IYUqbczewFx4mLEig6gawh7X6mFlEkA=="],
"uint8array-extras": ["uint8array-extras@1.4.0", "", {}, "sha512-ZPtzy0hu4cZjv3z5NW9gfKnNLjoz4y6uv4HlelAjDK7sY/xOkKZv9xK/WQpcsBB3jEybChz9DPC2U/+cusjJVQ=="],
"ultrahtml": ["ultrahtml@1.6.0", "", {}, "sha512-R9fBn90VTJrqqLDwyMph+HGne8eqY1iPfYhPzZrvKpIfwkWZbcYlfpsb8B9dTvBfpy1/hqAD7Wi8EKfP9e8zdw=="],
"uncrypto": ["uncrypto@0.1.3", "", {}, "sha512-Ql87qFHB3s/De2ClA9e0gsnS6zXG27SkTiSJwjCc9MebbfapQfuPzumMIUMi38ezPZVNFcHI9sUIepeQfw8J8Q=="],
"undici-types": ["undici-types@6.20.0", "", {}, "sha512-Ny6QZ2Nju20vw1SRHe3d9jVu6gJ+4e3+MMpqu7pqE5HT6WsTSlce++GQmK5UXS8mzV8DSYHrQH+Xrf2jVcuKNg=="],
"unicode-properties": ["unicode-properties@1.4.1", "", { "dependencies": { "base64-js": "^1.3.0", "unicode-trie": "^2.0.0" } }, "sha512-CLjCCLQ6UuMxWnbIylkisbRj31qxHPAurvena/0iwSVbQ2G1VY5/HjV0IRabOEbDHlzZlRdCrD4NhB0JtU40Pg=="],
"unicode-trie": ["unicode-trie@2.0.0", "", { "dependencies": { "pako": "^0.2.5", "tiny-inflate": "^1.0.0" } }, "sha512-x7bc76x0bm4prf1VLg79uhAzKw8DVboClSN5VxJuQ+LKDOVEW9CdH+VY7SP+vX7xCYQqzzgQpFqz15zeLvAtZQ=="],
"unified": ["unified@11.0.5", "", { "dependencies": { "@types/unist": "^3.0.0", "bail": "^2.0.0", "devlop": "^1.0.0", "extend": "^3.0.0", "is-plain-obj": "^4.0.0", "trough": "^2.0.0", "vfile": "^6.0.0" } }, "sha512-xKvGhPWw3k84Qjh8bI3ZeJjqnyadK+GEFtazSfZv/rKeTkTjOJho6mFqh2SM96iIcZokxiOpg78GazTSg8+KHA=="],
"unifont": ["unifont@0.5.0", "", { "dependencies": { "css-tree": "^3.0.0", "ohash": "^2.0.0" } }, "sha512-4DueXMP5Hy4n607sh+vJ+rajoLu778aU3GzqeTCqsD/EaUcvqZT9wPC8kgK6Vjh22ZskrxyRCR71FwNOaYn6jA=="],
"unist-util-find-after": ["unist-util-find-after@5.0.0", "", { "dependencies": { "@types/unist": "^3.0.0", "unist-util-is": "^6.0.0" } }, "sha512-amQa0Ep2m6hE2g72AugUItjbuM8X8cGQnFoHk0pGfrFeT9GZhzN5SW8nRsiGKK7Aif4CrACPENkA6P/Lw6fHGQ=="],
"unist-util-is": ["unist-util-is@6.0.0", "", { "dependencies": { "@types/unist": "^3.0.0" } }, "sha512-2qCTHimwdxLfz+YzdGfkqNlH0tLi9xjTnHddPmJwtIG9MGsdbutfTc4P+haPD7l7Cjxf/WZj+we5qfVPvvxfYw=="],
"unist-util-modify-children": ["unist-util-modify-children@4.0.0", "", { "dependencies": { "@types/unist": "^3.0.0", "array-iterate": "^2.0.0" } }, "sha512-+tdN5fGNddvsQdIzUF3Xx82CU9sMM+fA0dLgR9vOmT0oPT2jH+P1nd5lSqfCfXAw+93NhcXNY2qqvTUtE4cQkw=="],
"unist-util-position": ["unist-util-position@5.0.0", "", { "dependencies": { "@types/unist": "^3.0.0" } }, "sha512-fucsC7HjXvkB5R3kTCO7kUjRdrS0BJt3M/FPxmHMBOm8JQi2BsHAHFsy27E0EolP8rp0NzXsJ+jNPyDWvOJZPA=="],
"unist-util-position-from-estree": ["unist-util-position-from-estree@2.0.0", "", { "dependencies": { "@types/unist": "^3.0.0" } }, "sha512-KaFVRjoqLyF6YXCbVLNad/eS4+OfPQQn2yOd7zF/h5T/CSL2v8NpN6a5TPvtbXthAGw5nG+PuTtq+DdIZr+cRQ=="],
"unist-util-remove-position": ["unist-util-remove-position@5.0.0", "", { "dependencies": { "@types/unist": "^3.0.0", "unist-util-visit": "^5.0.0" } }, "sha512-Hp5Kh3wLxv0PHj9m2yZhhLt58KzPtEYKQQ4yxfYFEO7EvHwzyDYnduhHnY1mDxoqr7VUwVuHXk9RXKIiYS1N8Q=="],
"unist-util-stringify-position": ["unist-util-stringify-position@4.0.0", "", { "dependencies": { "@types/unist": "^3.0.0" } }, "sha512-0ASV06AAoKCDkS2+xw5RXJywruurpbC4JZSm7nr7MOt1ojAzvyyaO+UxZf18j8FCF6kmzCZKcAgN/yu2gm2XgQ=="],
"unist-util-visit": ["unist-util-visit@5.0.0", "", { "dependencies": { "@types/unist": "^3.0.0", "unist-util-is": "^6.0.0", "unist-util-visit-parents": "^6.0.0" } }, "sha512-MR04uvD+07cwl/yhVuVWAtw+3GOR/knlL55Nd/wAdblk27GCVt3lqpTivy/tkJcZoNPzTwS1Y+KMojlLDhoTzg=="],
"unist-util-visit-children": ["unist-util-visit-children@3.0.0", "", { "dependencies": { "@types/unist": "^3.0.0" } }, "sha512-RgmdTfSBOg04sdPcpTSD1jzoNBjt9a80/ZCzp5cI9n1qPzLZWF9YdvWGN2zmTumP1HWhXKdUWexjy/Wy/lJ7tA=="],
"unist-util-visit-parents": ["unist-util-visit-parents@6.0.1", "", { "dependencies": { "@types/unist": "^3.0.0", "unist-util-is": "^6.0.0" } }, "sha512-L/PqWzfTP9lzzEa6CKs0k2nARxTdZduw3zyh8d2NVBnsyvHjSX4TWse388YrrQKbvI8w20fGjGlhgT96WwKykw=="],
"unpipe": ["unpipe@1.0.0", "", {}, "sha512-pjy2bYhSsufwWlKwPc+l3cN7+wuJlK6uz0YdJEOlQDbl6jo/YlPi4mb8agUkVC8BF7V8NuzeyPNqRksA3hztKQ=="],
"unstorage": ["unstorage@1.16.0", "", { "dependencies": { "anymatch": "^3.1.3", "chokidar": "^4.0.3", "destr": "^2.0.5", "h3": "^1.15.2", "lru-cache": "^10.4.3", "node-fetch-native": "^1.6.6", "ofetch": "^1.4.1", "ufo": "^1.6.1" }, "peerDependencies": { "@azure/app-configuration": "^1.8.0", "@azure/cosmos": "^4.2.0", "@azure/data-tables": "^13.3.0", "@azure/identity": "^4.6.0", "@azure/keyvault-secrets": "^4.9.0", "@azure/storage-blob": "^12.26.0", "@capacitor/preferences": "^6.0.3 || ^7.0.0", "@deno/kv": ">=0.9.0", "@netlify/blobs": "^6.5.0 || ^7.0.0 || ^8.1.0", "@planetscale/database": "^1.19.0", "@upstash/redis": "^1.34.3", "@vercel/blob": ">=0.27.1", "@vercel/kv": "^1.0.1", "aws4fetch": "^1.0.20", "db0": ">=0.2.1", "idb-keyval": "^6.2.1", "ioredis": "^5.4.2", "uploadthing": "^7.4.4" }, "optionalPeers": ["@azure/app-configuration", "@azure/cosmos", "@azure/data-tables", "@azure/identity", "@azure/keyvault-secrets", "@azure/storage-blob", "@capacitor/preferences", "@deno/kv", "@netlify/blobs", "@planetscale/database", "@upstash/redis", "@vercel/blob", "@vercel/kv", "aws4fetch", "db0", "idb-keyval", "ioredis", "uploadthing"] }, "sha512-WQ37/H5A7LcRPWfYOrDa1Ys02xAbpPJq6q5GkO88FBXVSQzHd7+BjEwfRqyaSWCv9MbsJy058GWjjPjcJ16GGA=="],
"update-browserslist-db": ["update-browserslist-db@1.1.3", "", { "dependencies": { "escalade": "^3.2.0", "picocolors": "^1.1.1" }, "peerDependencies": { "browserslist": ">= 4.21.0" }, "bin": { "update-browserslist-db": "cli.js" } }, "sha512-UxhIZQ+QInVdunkDAaiazvvT/+fXL5Osr0JZlJulepYu6Jd7qJtDZjlur0emRlT71EN3ScPoE7gvsuIKKNavKw=="],
"url": ["url@0.10.3", "", { "dependencies": { "punycode": "1.3.2", "querystring": "0.2.0" } }, "sha512-hzSUW2q06EqL1gKM/a+obYHLIO6ct2hwPuviqTTOcfFVc61UbfJ2Q32+uGL/HCPxKqrdGB5QUwIe7UqlDgwsOQ=="],
"util": ["util@0.12.5", "", { "dependencies": { "inherits": "^2.0.3", "is-arguments": "^1.0.4", "is-generator-function": "^1.0.7", "is-typed-array": "^1.1.3", "which-typed-array": "^1.1.2" } }, "sha512-kZf/K6hEIrWHI6XqOFUiiMa+79wE/D8Q+NCNAWclkyg3b4d2k7s0QGepNjiABc+aR3N1PAyHL7p6UcLY6LmrnA=="],
"util-deprecate": ["util-deprecate@1.0.2", "", {}, "sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw=="],
"uuid": ["uuid@8.0.0", "", { "bin": { "uuid": "dist/bin/uuid" } }, "sha512-jOXGuXZAWdsTH7eZLtyXMqUb9EcWMGZNbL9YcGBJl4MH4nrxHmZJhEHvyLFrkxo+28uLb/NYRcStH48fnD0Vzw=="],
"validate-html-nesting": ["validate-html-nesting@1.2.2", "", {}, "sha512-hGdgQozCsQJMyfK5urgFcWEqsSSrK63Awe0t/IMR0bZ0QMtnuaiHzThW81guu3qx9abLi99NEuiaN6P9gVYsNg=="],
"vary": ["vary@1.1.2", "", {}, "sha512-BNGbWLfd0eUPabhkXUVm0j8uuvREyTh5ovRa/dyow/BqAbZJyC+5fU+IzQOzmAKzYqYRAISoRhdQr3eIZ/PXqg=="],
"vfile": ["vfile@6.0.3", "", { "dependencies": { "@types/unist": "^3.0.0", "vfile-message": "^4.0.0" } }, "sha512-KzIbH/9tXat2u30jf+smMwFCsno4wHVdNmzFyL+T/L3UGqqk6JKfVqOFOZEpZSHADH1k40ab6NUIXZq422ov3Q=="],
"vfile-location": ["vfile-location@5.0.3", "", { "dependencies": { "@types/unist": "^3.0.0", "vfile": "^6.0.0" } }, "sha512-5yXvWDEgqeiYiBe1lbxYF7UMAIm/IcopxMHrMQDq3nvKcjPKIhZklUKL+AE7J7uApI4kwe2snsK+eI6UTj9EHg=="],
"vfile-message": ["vfile-message@4.0.2", "", { "dependencies": { "@types/unist": "^3.0.0", "unist-util-stringify-position": "^4.0.0" } }, "sha512-jRDZ1IMLttGj41KcZvlrYAaI3CfqpLpfpf+Mfig13viT6NKvRzWZ+lXz0Y5D60w6uJIBAOGq9mSHf0gktF0duw=="],
"vite": ["vite@6.3.5", "", { "dependencies": { "esbuild": "^0.25.0", "fdir": "^6.4.4", "picomatch": "^4.0.2", "postcss": "^8.5.3", "rollup": "^4.34.9", "tinyglobby": "^0.2.13" }, "optionalDependencies": { "fsevents": "~2.3.3" }, "peerDependencies": { "@types/node": "^18.0.0 || ^20.0.0 || >=22.0.0", "jiti": ">=1.21.0", "less": "*", "lightningcss": "^1.21.0", "sass": "*", "sass-embedded": "*", "stylus": "*", "sugarss": "*", "terser": "^5.16.0", "tsx": "^4.8.1", "yaml": "^2.4.2" }, "optionalPeers": ["@types/node", "jiti", "less", "lightningcss", "sass", "sass-embedded", "stylus", "sugarss", "terser", "tsx", "yaml"], "bin": { "vite": "bin/vite.js" } }, "sha512-cZn6NDFE7wdTpINgs++ZJ4N49W2vRp8LCKrn3Ob1kYNtOo21vfDoaV5GzBfLU4MovSAB8uNRm4jgzVQZ+mBzPQ=="],
"vite-plugin-solid": ["vite-plugin-solid@2.11.6", "", { "dependencies": { "@babel/core": "^7.23.3", "@types/babel__core": "^7.20.4", "babel-preset-solid": "^1.8.4", "merge-anything": "^5.1.7", "solid-refresh": "^0.6.3", "vitefu": "^1.0.4" }, "peerDependencies": { "@testing-library/jest-dom": "^5.16.6 || ^5.17.0 || ^6.*", "solid-js": "^1.7.2", "vite": "^3.0.0 || ^4.0.0 || ^5.0.0 || ^6.0.0" }, "optionalPeers": ["@testing-library/jest-dom"] }, "sha512-Sl5CTqJTGyEeOsmdH6BOgalIZlwH3t4/y0RQuFLMGnvWMBvxb4+lq7x3BSiAw6etf0QexfNJW7HSOO/Qf7pigg=="],
"vitefu": ["vitefu@1.0.6", "", { "peerDependencies": { "vite": "^3.0.0 || ^4.0.0 || ^5.0.0 || ^6.0.0" }, "optionalPeers": ["vite"] }, "sha512-+Rex1GlappUyNN6UfwbVZne/9cYC4+R2XDk9xkNXBKMw6HQagdX9PgZ8V2v1WUSK1wfBLp7qbI1+XSNIlB1xmA=="],
"vscode-jsonrpc": ["vscode-jsonrpc@8.2.1", "", {}, "sha512-kdjOSJ2lLIn7r1rtrMbbNCHjyMPfRnowdKjBQ+mGq6NAW5QY2bEZC/khaC5OR8svbbjvLEaIXkOq45e2X9BIbQ=="],
"vscode-languageclient": ["vscode-languageclient@8.1.0", "", { "dependencies": { "minimatch": "^5.1.0", "semver": "^7.3.7", "vscode-languageserver-protocol": "3.17.3" } }, "sha512-GL4QdbYUF/XxQlAsvYWZRV3V34kOkpRlvV60/72ghHfsYFnS/v2MANZ9P6sHmxFcZKOse8O+L9G7Czg0NUWing=="],
"vscode-languageserver-protocol": ["vscode-languageserver-protocol@3.17.3", "", { "dependencies": { "vscode-jsonrpc": "8.1.0", "vscode-languageserver-types": "3.17.3" } }, "sha512-924/h0AqsMtA5yK22GgMtCYiMdCOtWTSGgUOkgEDX+wk2b0x4sAfLiO4NxBxqbiVtz7K7/1/RgVrVI0NClZwqA=="],
"vscode-languageserver-types": ["vscode-languageserver-types@3.17.3", "", {}, "sha512-SYU4z1dL0PyIMd4Vj8YOqFvHu7Hz/enbWtpfnVbJHU4Nd1YNYx8u0ennumc6h48GQNeOLxmwySmnADouT/AuZA=="],
"web-namespaces": ["web-namespaces@2.0.1", "", {}, "sha512-bKr1DkiNa2krS7qxNtdrtHAmzuYGFQLiQ13TsorsdT6ULTkPLKuu5+GsFpDlg6JFjUTwX2DyhMPG2be8uPrqsQ=="],
"webidl-conversions": ["webidl-conversions@3.0.1", "", {}, "sha512-2JAn3z8AR6rjK8Sm8orRC0h/bcl/DqL7tRPdGZ4I1CjdF+EaMLmYxBHyXuKL849eucPFhvBoxMsflfOb8kxaeQ=="],
"whatwg-url": ["whatwg-url@5.0.0", "", { "dependencies": { "tr46": "~0.0.3", "webidl-conversions": "^3.0.0" } }, "sha512-saE57nupxk6v3HY35+jzBwYa0rKSy0XR8JSxZPwgLr7ys0IBzhGviA1/TUGJLmSVqs8pb9AnvICXEuOHLprYTw=="],
"which-pm-runs": ["which-pm-runs@1.1.0", "", {}, "sha512-n1brCuqClxfFfq/Rb0ICg9giSZqCS+pLtccdag6C2HyufBrh3fBOiy9nb6ggRMvWOVH5GrdJskj5iGTZNxd7SA=="],
"which-typed-array": ["which-typed-array@1.1.19", "", { "dependencies": { "available-typed-arrays": "^1.0.7", "call-bind": "^1.0.8", "call-bound": "^1.0.4", "for-each": "^0.3.5", "get-proto": "^1.0.1", "gopd": "^1.2.0", "has-tostringtag": "^1.0.2" } }, "sha512-rEvr90Bck4WZt9HHFC4DJMsjvu7x+r6bImz0/BrbWb7A2djJ8hnZMrWnHo9F8ssv0OMErasDhftrfROTyqSDrw=="],
"widest-line": ["widest-line@5.0.0", "", { "dependencies": { "string-width": "^7.0.0" } }, "sha512-c9bZp7b5YtRj2wOe6dlj32MK+Bx/M/d+9VB2SHM1OtsUHR0aV0tdP6DWh/iMt0kWi1t5g1Iudu6hQRNd1A4PVA=="],
"wrap-ansi": ["wrap-ansi@9.0.0", "", { "dependencies": { "ansi-styles": "^6.2.1", "string-width": "^7.0.0", "strip-ansi": "^7.1.0" } }, "sha512-G8ura3S+3Z2G+mkgNRq8dqaFZAuxfsxpBB8OCTGRTCtp+l/v9nbFNmCUP1BZMts3G1142MsZfn6eeUKrr4PD1Q=="],
"wrappy": ["wrappy@1.0.2", "", {}, "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ=="],
"xml2js": ["xml2js@0.6.2", "", { "dependencies": { "sax": ">=0.6.0", "xmlbuilder": "~11.0.0" } }, "sha512-T4rieHaC1EXcES0Kxxj4JWgaUQHDk+qwHcYOCFHfiwKz7tOVPLq7Hjq9dM1WCMhylqMEfP7hMcOIChvotiZegA=="],
"xmlbuilder": ["xmlbuilder@11.0.1", "", {}, "sha512-fDlsI/kFEx7gLvbecc0/ohLG50fugQp8ryHzMTuW9vSa1GJ0XYWKnhsUx7oie3G98+r56aTQIUB4kht42R3JvA=="],
"xxhash-wasm": ["xxhash-wasm@1.1.0", "", {}, "sha512-147y/6YNh+tlp6nd/2pWq38i9h6mz/EuQ6njIrmW8D1BS5nCqs0P6DG+m6zTGnNz5I+uhZ0SHxBs9BsPrwcKDA=="],
"yallist": ["yallist@4.0.0", "", {}, "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A=="],
"yargs-parser": ["yargs-parser@21.1.1", "", {}, "sha512-tVpsJW7DdjecAiFpbIB1e3qxIQsE6NoPc5/eTdrbbIC4h0LVsWhnoa3g+m2HclBIujHzsxZ4VJVA+GUuc2/LBw=="],
"yocto-queue": ["yocto-queue@1.2.1", "", {}, "sha512-AyeEbWOu/TAXdxlV9wmGcR0+yh2j3vYPGOECcIj2S7MkrLyC7ne+oye2BKTItt0ii2PHk4cDy+95+LshzbXnGg=="],
"yocto-spinner": ["yocto-spinner@0.2.3", "", { "dependencies": { "yoctocolors": "^2.1.1" } }, "sha512-sqBChb33loEnkoXte1bLg45bEBsOP9N1kzQh5JZNKj/0rik4zAPTNSAVPj3uQAdc6slYJ0Ksc403G2XgxsJQFQ=="],
"yoctocolors": ["yoctocolors@2.1.1", "", {}, "sha512-GQHQqAopRhwU8Kt1DDM8NjibDXHC8eoh1erhGAJPEyveY9qqVeXvVikNKrDz69sHowPMorbPUrH/mx8c50eiBQ=="],
"zod": ["zod@3.24.2", "", {}, "sha512-lY7CDW43ECgW9u1TcT3IoXHflywfVqDYze4waEz812jR/bZ8FHDsl7pFQoSZTz5N+2NqRXs8GBwnAwo3ZNxqhQ=="],
"zod-openapi": ["zod-openapi@4.2.4", "", { "peerDependencies": { "zod": "^3.21.4" } }, "sha512-tsrQpbpqFCXqVXUzi3TPwFhuMtLN3oNZobOtYnK6/5VkXsNdnIgyNr4r8no4wmYluaxzN3F7iS+8xCW8BmMQ8g=="],
"zod-to-json-schema": ["zod-to-json-schema@3.24.5", "", { "peerDependencies": { "zod": "^3.24.1" } }, "sha512-/AuWwMP+YqiPbsJx5D6TfgRTc4kTLjsh5SOcd4bLsfUg2RcEXrFMJl1DGgdHy2aCfsIA/cr/1JM0xcB2GZji8g=="],
"zod-to-ts": ["zod-to-ts@1.2.0", "", { "peerDependencies": { "typescript": "^4.9.4 || ^5.0.2", "zod": "^3" } }, "sha512-x30XE43V+InwGpvTySRNz9kB7qFU8DlyEy7BsSTCHPH1R0QasMmHWZDCzYm6bVXtj/9NNJAZF3jW8rzFvH5OFA=="],
"zwitch": ["zwitch@2.0.4", "", {}, "sha512-bXE4cR/kVZhKZX/RjPEflHaKVhUVl85noU3v6b8apfQEc1x4A+zBxjZ4lN8LqGd6WZ3dl98pY4o717VFmoPp+A=="],
"@astrojs/mdx/@astrojs/markdown-remark": ["@astrojs/markdown-remark@6.3.2", "", { "dependencies": { "@astrojs/internal-helpers": "0.6.1", "@astrojs/prism": "3.3.0", "github-slugger": "^2.0.0", "hast-util-from-html": "^2.0.3", "hast-util-to-text": "^4.0.2", "import-meta-resolve": "^4.1.0", "js-yaml": "^4.1.0", "mdast-util-definitions": "^6.0.0", "rehype-raw": "^7.0.0", "rehype-stringify": "^10.0.1", "remark-gfm": "^4.0.1", "remark-parse": "^11.0.0", "remark-rehype": "^11.1.2", "remark-smartypants": "^3.0.2", "shiki": "^3.2.1", "smol-toml": "^1.3.1", "unified": "^11.0.5", "unist-util-remove-position": "^5.0.0", "unist-util-visit": "^5.0.0", "unist-util-visit-parents": "^6.0.1", "vfile": "^6.0.3" } }, "sha512-bO35JbWpVvyKRl7cmSJD822e8YA8ThR/YbUsciWNA7yTcqpIAL2hJDToWP5KcZBWxGT6IOdOkHSXARSNZc4l/Q=="],
"@babel/core/semver": ["semver@6.3.1", "", { "bin": { "semver": "bin/semver.js" } }, "sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA=="],
"@babel/helper-compilation-targets/lru-cache": ["lru-cache@5.1.1", "", { "dependencies": { "yallist": "^3.0.2" } }, "sha512-KpNARQA3Iwv+jTA0utUVVbrh+Jlrr1Fv0e56GGzAFOXN7dk/FviaDW8LHmK52DlcH4WP2n6gI8vN1aesBFgo9w=="],
"@babel/helper-compilation-targets/semver": ["semver@6.3.1", "", { "bin": { "semver": "bin/semver.js" } }, "sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA=="],
"@emnapi/runtime/tslib": ["tslib@2.8.1", "", {}, "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w=="],
"@rollup/pluginutils/estree-walker": ["estree-walker@2.0.2", "", {}, "sha512-Rfkk/Mp/DL7JVje3u18FxFujQlTNR2q6QfMSMB7AvCBx91NGj/ba3kCfza0f6dVDbw7YlRf/nDrn7pQrCCyQ/w=="],
"@swc/helpers/tslib": ["tslib@2.8.1", "", {}, "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w=="],
"ansi-align/string-width": ["string-width@4.2.3", "", { "dependencies": { "emoji-regex": "^8.0.0", "is-fullwidth-code-point": "^3.0.0", "strip-ansi": "^6.0.1" } }, "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g=="],
"anymatch/picomatch": ["picomatch@2.3.1", "", {}, "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA=="],
"args/camelcase": ["camelcase@5.0.0", "", {}, "sha512-faqwZqnWxbxn+F1d399ygeamQNy3lPp/H9H6rNrqYh4FSVCtcY+3cub1MxA8o9mDd55mM8Aghuu/kuyYA6VTsA=="],
"args/chalk": ["chalk@2.4.2", "", { "dependencies": { "ansi-styles": "^3.2.1", "escape-string-regexp": "^1.0.5", "supports-color": "^5.3.0" } }, "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ=="],
"astro/diff": ["diff@5.2.0", "", {}, "sha512-uIFDxqpRZGZ6ThOk84hEfqWoHx2devRFvpTZcTHur85vImfaxUbTW9Ryh4CpCuDnToOP1CEtXKIgytHBPVff5A=="],
"astro/sharp": ["sharp@0.33.5", "", { "dependencies": { "color": "^4.2.3", "detect-libc": "^2.0.3", "semver": "^7.6.3" }, "optionalDependencies": { "@img/sharp-darwin-arm64": "0.33.5", "@img/sharp-darwin-x64": "0.33.5", "@img/sharp-libvips-darwin-arm64": "1.0.4", "@img/sharp-libvips-darwin-x64": "1.0.4", "@img/sharp-libvips-linux-arm": "1.0.5", "@img/sharp-libvips-linux-arm64": "1.0.4", "@img/sharp-libvips-linux-s390x": "1.0.4", "@img/sharp-libvips-linux-x64": "1.0.4", "@img/sharp-libvips-linuxmusl-arm64": "1.0.4", "@img/sharp-libvips-linuxmusl-x64": "1.0.4", "@img/sharp-linux-arm": "0.33.5", "@img/sharp-linux-arm64": "0.33.5", "@img/sharp-linux-s390x": "0.33.5", "@img/sharp-linux-x64": "0.33.5", "@img/sharp-linuxmusl-arm64": "0.33.5", "@img/sharp-linuxmusl-x64": "0.33.5", "@img/sharp-wasm32": "0.33.5", "@img/sharp-win32-ia32": "0.33.5", "@img/sharp-win32-x64": "0.33.5" } }, "sha512-haPVm1EkS9pgvHrQ/F3Xy+hgcuMV0Wm9vfIBSiwZ05k+xgb0PkBQpGsAA/oWdDobNaZTH5ppvHtzCFbnSEwHVw=="],
"babel-plugin-jsx-dom-expressions/@babel/helper-module-imports": ["@babel/helper-module-imports@7.18.6", "", { "dependencies": { "@babel/types": "^7.18.6" } }, "sha512-0NFvs3VkuSYbFi1x2Vd6tKrywq+z/cLeYC/RJNFrIX/30Bf5aiGYbtvGXolEktzJH8o5E5KJ3tT+nkxuuZFVlA=="],
"bl/buffer": ["buffer@5.7.1", "", { "dependencies": { "base64-js": "^1.3.1", "ieee754": "^1.1.13" } }, "sha512-EHcyIPBQ4BSGlvjB16k5KgAJ27CIsHY/2JBmCRReo48y9rQ3MaUzWX3KVlBa4U7MyX02HdVj0K7C3WaB3ju7FQ=="],
"express/cookie": ["cookie@0.7.2", "", {}, "sha512-yki5XnKuf750l50uGTllt6kKILY4nQ1eNIQatoXEByZ5dWgnKqbnqmTrBE5B4N7lrMJKQ2ytWMiTO2o0v6Ew/w=="],
"hast-util-to-parse5/property-information": ["property-information@6.5.0", "", {}, "sha512-PgTgs/BlvHxOu8QuEN7wi5A0OmXaBcHpmCSTehcs6Uuu9IkDIEo13Hy7n898RHfrQ49vKCoGeWZSaAK01nwVig=="],
"mdast-util-find-and-replace/escape-string-regexp": ["escape-string-regexp@5.0.0", "", {}, "sha512-/veY75JbMK4j1yjvuUxuVsiS/hr/4iHs9FTT6cgTexxdE0Ly/glccBAkloH/DofkjRbZU3bnoj38mOmhkZ0lHw=="],
"opencontrol/hono": ["hono@4.7.4", "", {}, "sha512-Pst8FuGqz3L7tFF+u9Pu70eI0xa5S3LPUmrNd5Jm8nTHze9FxLTK9Kaj5g/k4UcwuJSXTP65SyHOPLrffpcAJg=="],
"opencontrol/zod-to-json-schema": ["zod-to-json-schema@3.24.3", "", { "peerDependencies": { "zod": "^3.24.1" } }, "sha512-HIAfWdYIt1sssHfYZFCXp4rU1w2r8hVVXYIlmoa0r0gABLs5di3RCqPU5DDROogVz1pAdYBaz7HK5n9pSUNs3A=="],
"openid-client/jose": ["jose@4.15.9", "", {}, "sha512-1vUQX+IdDMVPj4k8kOxgUqlcK518yluMuGZwqlr44FS1ppZB/5GWh4rZG89erpOBOJjU/OBsnCVFfapsRz6nEA=="],
"parse-entities/@types/unist": ["@types/unist@2.0.11", "", {}, "sha512-CmBKiL6NNo/OqgmMn95Fk9Whlp2mtvIv+KNpQKN2F4SjvrEesubTRWGYSg+BnWZOnlCaSTU1sMpsBOzgbYhnsA=="],
"pino-abstract-transport/split2": ["split2@4.2.0", "", {}, "sha512-UcjcJOWknrNkF6PLX83qcHM6KHgVKNkV62Y8a5uYDVv9ydGQVwAHMKqHdJje1VTWpljG0WYpCDhrCdAOYH4TWg=="],
"pino-pretty/chalk": ["chalk@4.1.2", "", { "dependencies": { "ansi-styles": "^4.1.0", "supports-color": "^7.1.0" } }, "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA=="],
"pino-pretty/jmespath": ["jmespath@0.15.0", "", {}, "sha512-+kHj8HXArPfpPEKGLZ+kB5ONRTCiGQXo8RQYL0hH8t6pWXUBBK5KkkQmTNOwKK4LEsd0yTsgtjJVm4UBSZea4w=="],
"prebuild-install/tar-fs": ["tar-fs@2.1.3", "", { "dependencies": { "chownr": "^1.1.1", "mkdirp-classic": "^0.5.2", "pump": "^3.0.0", "tar-stream": "^2.1.4" } }, "sha512-090nwYJDmlhwFwEW3QQl+vaNnxsO2yVsd45eTKRBzSzu+hlb1w2K9inVq5b0ngXuLVqQ4ApvsUHHnu/zQNkWAg=="],
"prompts/kleur": ["kleur@3.0.3", "", {}, "sha512-eTIzlVOSUR+JxdDFepEYcBMtZ9Qqdef+rnzWdRZuMbOywu5tO2w2N7rqjoANZ5k9vywhL6Br1VRjUIgTQx4E8w=="],
"rc/strip-json-comments": ["strip-json-comments@2.0.1", "", {}, "sha512-4gB8na07fecVVkOI6Rs4e7T6NOTki5EmL7TUduTs6bu3EdnSycntVJ4re8kgZA+wx9IueI2Y11bfbgwtzuE0KQ=="],
"sitemap/@types/node": ["@types/node@17.0.45", "", {}, "sha512-w+tIMs3rq2afQdsPJlODhoUEKzFP1ayaoyl1CcnwtIlsVe7K7bA1NGm4s3PraqTLlXnbIN84zuBlxBWo1u9BLw=="],
"sitemap/sax": ["sax@1.4.1", "", {}, "sha512-+aWOz7yVScEGoKNd4PA10LZ8sk0A/z5+nXQG5giUO5rprX9jgYsTdov9qCchZiPIZezbZH+jRut8nPodFAX4Jg=="],
"token-types/ieee754": ["ieee754@1.2.1", "", {}, "sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA=="],
"unstorage/lru-cache": ["lru-cache@10.4.3", "", {}, "sha512-JNAzZcXrCt42VGLuYz0zfAzDfAvJWW6AfYlDBQyDV5DClI2m5sAmK+OIO7s59XfsRsWHp02jAJrRadPRGTt6SQ=="],
"vscode-languageserver-protocol/vscode-jsonrpc": ["vscode-jsonrpc@8.1.0", "", {}, "sha512-6TDy/abTQk+zDGYazgbIPc+4JoXdwC8NHU9Pbn4UJP1fehUyZmM4RHp5IthX7A6L5KS30PRui+j+tbbMMMafdw=="],
"@astrojs/mdx/@astrojs/markdown-remark/@astrojs/prism": ["@astrojs/prism@3.3.0", "", { "dependencies": { "prismjs": "^1.30.0" } }, "sha512-q8VwfU/fDZNoDOf+r7jUnMC2//H2l0TuQ6FkGJL8vD8nw/q5KiL3DS1KKBI3QhI9UQhpJ5dc7AtqfbXWuOgLCQ=="],
"@babel/helper-compilation-targets/lru-cache/yallist": ["yallist@3.1.1", "", {}, "sha512-a4UGQaWPH59mOXUYnAG2ewncQS4i4F43Tv3JoAM+s2VDAmS9NsK8GpDMLrCHPksFT7h3K6TOoUNn2pb7RoXx4g=="],
"ansi-align/string-width/emoji-regex": ["emoji-regex@8.0.0", "", {}, "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A=="],
"ansi-align/string-width/strip-ansi": ["strip-ansi@6.0.1", "", { "dependencies": { "ansi-regex": "^5.0.1" } }, "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A=="],
"args/chalk/ansi-styles": ["ansi-styles@3.2.1", "", { "dependencies": { "color-convert": "^1.9.0" } }, "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA=="],
"args/chalk/supports-color": ["supports-color@5.5.0", "", { "dependencies": { "has-flag": "^3.0.0" } }, "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow=="],
"bl/buffer/ieee754": ["ieee754@1.2.1", "", {}, "sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA=="],
"pino-pretty/chalk/ansi-styles": ["ansi-styles@4.3.0", "", { "dependencies": { "color-convert": "^2.0.1" } }, "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg=="],
"prebuild-install/tar-fs/tar-stream": ["tar-stream@2.2.0", "", { "dependencies": { "bl": "^4.0.3", "end-of-stream": "^1.4.1", "fs-constants": "^1.0.0", "inherits": "^2.0.3", "readable-stream": "^3.1.1" } }, "sha512-ujeqbceABgwMZxEJnk2HDY2DlnUZ+9oEcb1KzTVfYHio0UE6dG71n60d8D2I4qNvleWrrXpmjpt7vZeF1LnMZQ=="],
"ansi-align/string-width/strip-ansi/ansi-regex": ["ansi-regex@5.0.1", "", {}, "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ=="],
"args/chalk/ansi-styles/color-convert": ["color-convert@1.9.3", "", { "dependencies": { "color-name": "1.1.3" } }, "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg=="],
"args/chalk/supports-color/has-flag": ["has-flag@3.0.0", "", {}, "sha512-sKJf1+ceQBr4SMkvQnBDNDtf4TXpVhVGateu0t918bl30FnbE2m4vNLX+VWe/dpjlb+HugGYzW7uQXH98HPEYw=="],
"args/chalk/ansi-styles/color-convert/color-name": ["color-name@1.1.3", "", {}, "sha512-72fSenhMw2HZMTVHeCA9KCmpEIbzWiQsjN+BHcBbS9vr1mtt+vJjPdksIBNUmKAW8TFUDPJK5SUU3QhE9NEXDw=="],
}
}
-2
View File
@@ -1,2 +0,0 @@
[install]
exact = true
+75 -64
View File
@@ -7,15 +7,17 @@ import (
"sync"
"time"
"log/slog"
tea "github.com/charmbracelet/bubbletea"
"github.com/kujtimiihoxha/opencode/internal/app"
"github.com/kujtimiihoxha/opencode/internal/config"
"github.com/kujtimiihoxha/opencode/internal/db"
"github.com/kujtimiihoxha/opencode/internal/llm/agent"
"github.com/kujtimiihoxha/opencode/internal/logging"
"github.com/kujtimiihoxha/opencode/internal/pubsub"
"github.com/kujtimiihoxha/opencode/internal/tui"
"github.com/kujtimiihoxha/opencode/internal/version"
zone "github.com/lrstanley/bubblezone"
"github.com/spf13/cobra"
"github.com/sst/opencode/internal/config"
"github.com/sst/opencode/internal/pubsub"
"github.com/sst/opencode/internal/tui"
"github.com/sst/opencode/internal/tui/app"
)
var rootCmd = &cobra.Command{
@@ -25,14 +27,15 @@ var rootCmd = &cobra.Command{
It provides an interactive chat interface with AI capabilities, code analysis, and LSP integration
to assist developers in writing, debugging, and understanding code directly from the terminal.`,
RunE: func(cmd *cobra.Command, args []string) error {
// Setup logging
// file, err := os.OpenFile("debug.log", os.O_WRONLY|os.O_CREATE|os.O_APPEND, 0644)
// if err != nil {
// panic(err)
// }
// defer file.Close()
// logger := slog.New(slog.NewTextHandler(file, &slog.HandlerOptions{Level: slog.LevelDebug}))
// slog.SetDefault(logger)
// If the help flag is set, show the help message
if cmd.Flag("help").Changed {
cmd.Help()
return nil
}
if cmd.Flag("version").Changed {
fmt.Println(version.Version)
return nil
}
// Load the config
debug, _ := cmd.Flags().GetBool("debug")
@@ -55,13 +58,19 @@ to assist developers in writing, debugging, and understanding code directly from
return err
}
// Connect DB, this will also run migrations
conn, err := db.Connect()
if err != nil {
return err
}
// Create main context for the application
ctx, cancel := context.WithCancel(context.Background())
defer cancel()
app, err := app.New(ctx)
app, err := app.New(ctx, conn)
if err != nil {
slog.Error("Failed to create app", "error", err)
logging.Error("Failed to create app: %v", err)
return err
}
@@ -70,19 +79,11 @@ to assist developers in writing, debugging, and understanding code directly from
program := tea.NewProgram(
tui.New(app),
tea.WithAltScreen(),
tea.WithMouseCellMotion(),
)
evts, err := app.Events.Event(ctx)
if err != nil {
slog.Error("Failed to subscribe to events", "error", err)
return err
}
go func() {
for item := range evts {
program.Send(item)
}
}()
// Initialize MCP tools in the background
initMCPTools(ctx, app)
// Setup the subscriptions, this will send services events to the TUI
ch, cancelSubs := setupSubscriptions(app, ctx)
@@ -95,18 +96,18 @@ to assist developers in writing, debugging, and understanding code directly from
// Set up message handling for the TUI
go func() {
defer tuiWg.Done()
// defer logging.RecoverPanic("TUI-message-handler", func() {
// attemptTUIRecovery(program)
// })
defer logging.RecoverPanic("TUI-message-handler", func() {
attemptTUIRecovery(program)
})
for {
select {
case <-tuiCtx.Done():
slog.Info("TUI message handler shutting down")
logging.Info("TUI message handler shutting down")
return
case msg, ok := <-ch:
if !ok {
slog.Info("TUI message channel closed")
logging.Info("TUI message channel closed")
return
}
program.Send(msg)
@@ -116,19 +117,19 @@ to assist developers in writing, debugging, and understanding code directly from
// Cleanup function for when the program exits
cleanup := func() {
// Shutdown the app
app.Shutdown()
// Cancel subscriptions first
cancelSubs()
// Then shutdown the app
app.Shutdown()
// Then cancel TUI message handler
tuiCancel()
// Wait for TUI message handler to finish
tuiWg.Wait()
slog.Info("All goroutines cleaned up")
logging.Info("All goroutines cleaned up")
}
// Run the TUI
@@ -136,15 +137,38 @@ to assist developers in writing, debugging, and understanding code directly from
cleanup()
if err != nil {
slog.Error("TUI error", "error", err)
logging.Error("TUI error: %v", err)
return fmt.Errorf("TUI error: %v", err)
}
slog.Info("TUI exited", "result", result)
logging.Info("TUI exited with result: %v", result)
return nil
},
}
// attemptTUIRecovery tries to recover the TUI after a panic
func attemptTUIRecovery(program *tea.Program) {
logging.Info("Attempting to recover TUI after panic")
// We could try to restart the TUI or gracefully exit
// For now, we'll just quit the program to avoid further issues
program.Quit()
}
func initMCPTools(ctx context.Context, app *app.App) {
go func() {
defer logging.RecoverPanic("MCP-goroutine", nil)
// Create a context with timeout for the initial MCP tools fetch
ctxWithTimeout, cancel := context.WithTimeout(ctx, 30*time.Second)
defer cancel()
// Set this up once with proper error handling
agent.GetMcpTools(ctxWithTimeout, app.Permissions)
logging.Info("MCP message handling goroutine exiting")
}()
}
func setupSubscriber[T any](
ctx context.Context,
wg *sync.WaitGroup,
@@ -155,19 +179,15 @@ func setupSubscriber[T any](
wg.Add(1)
go func() {
defer wg.Done()
// defer logging.RecoverPanic(fmt.Sprintf("subscription-%s", name), nil)
defer logging.RecoverPanic(fmt.Sprintf("subscription-%s", name), nil)
subCh := subscriber(ctx)
if subCh == nil {
slog.Warn("subscription channel is nil", "name", name)
return
}
for {
select {
case event, ok := <-subCh:
if !ok {
slog.Info("subscription channel closed", "name", name)
logging.Info("subscription channel closed", "name", name)
return
}
@@ -176,13 +196,13 @@ func setupSubscriber[T any](
select {
case outputCh <- msg:
case <-time.After(2 * time.Second):
slog.Warn("message dropped due to slow consumer", "name", name)
logging.Warn("message dropped due to slow consumer", "name", name)
case <-ctx.Done():
slog.Info("subscription cancelled", "name", name)
logging.Info("subscription cancelled", "name", name)
return
}
case <-ctx.Done():
slog.Info("subscription cancelled", "name", name)
logging.Info("subscription cancelled", "name", name)
return
}
}
@@ -195,25 +215,28 @@ func setupSubscriptions(app *app.App, parentCtx context.Context) (chan tea.Msg,
wg := sync.WaitGroup{}
ctx, cancel := context.WithCancel(parentCtx) // Inherit from parent context
setupSubscriber(ctx, &wg, "status", app.Status.Subscribe, ch)
setupSubscriber(ctx, &wg, "logging", logging.Subscribe, ch)
setupSubscriber(ctx, &wg, "sessions", app.Sessions.Subscribe, ch)
setupSubscriber(ctx, &wg, "messages", app.Messages.Subscribe, ch)
setupSubscriber(ctx, &wg, "permissions", app.Permissions.Subscribe, ch)
cleanupFunc := func() {
slog.Info("Cancelling all subscriptions")
logging.Info("Cancelling all subscriptions")
cancel() // Signal all goroutines to stop
waitCh := make(chan struct{})
go func() {
// defer logging.RecoverPanic("subscription-cleanup", nil)
defer logging.RecoverPanic("subscription-cleanup", nil)
wg.Wait()
close(waitCh)
}()
select {
case <-waitCh:
slog.Info("All subscription goroutines completed successfully")
logging.Info("All subscription goroutines completed successfully")
close(ch) // Only close after all writers are confirmed done
case <-time.After(5 * time.Second):
slog.Warn("Timed out waiting for some subscription goroutines to complete")
logging.Warn("Timed out waiting for some subscription goroutines to complete")
close(ch)
}
}
@@ -232,16 +255,4 @@ func init() {
rootCmd.Flags().BoolP("version", "v", false, "Version")
rootCmd.Flags().BoolP("debug", "d", false, "Debug")
rootCmd.Flags().StringP("cwd", "c", "", "Current working directory")
rootCmd.Flags().StringP("prompt", "p", "", "Run a single prompt in non-interactive mode")
rootCmd.Flags().StringP("output-format", "f", "text", "Output format for non-interactive mode (text, json)")
rootCmd.Flags().BoolP("quiet", "q", false, "Hide spinner in non-interactive mode")
rootCmd.Flags().BoolP("verbose", "", false, "Display logs to stderr in non-interactive mode")
rootCmd.Flags().StringSlice("allowedTools", nil, "Restrict the agent to only use the specified tools in non-interactive mode (comma-separated list)")
rootCmd.Flags().StringSlice("excludedTools", nil, "Prevent the agent from using the specified tools in non-interactive mode (comma-separated list)")
// Make allowedTools and excludedTools mutually exclusive
rootCmd.MarkFlagsMutuallyExclusive("allowedTools", "excludedTools")
// Make quiet and verbose mutually exclusive
rootCmd.MarkFlagsMutuallyExclusive("quiet", "verbose")
}
+64
View File
@@ -0,0 +1,64 @@
# OpenCode Configuration Schema Generator
This tool generates a JSON Schema for the OpenCode configuration file. The schema can be used to validate configuration files and provide autocompletion in editors that support JSON Schema.
## Usage
```bash
go run cmd/schema/main.go > opencode-schema.json
```
This will generate a JSON Schema file that can be used to validate configuration files.
## Schema Features
The generated schema includes:
- All configuration options with descriptions
- Default values where applicable
- Validation for enum values (e.g., model IDs, provider types)
- Required fields
- Type checking
## Using the Schema
You can use the generated schema in several ways:
1. **Editor Integration**: Many editors (VS Code, JetBrains IDEs, etc.) support JSON Schema for validation and autocompletion. You can configure your editor to use the generated schema for `.opencode.json` files.
2. **Validation Tools**: You can use tools like [jsonschema](https://github.com/Julian/jsonschema) to validate your configuration files against the schema.
3. **Documentation**: The schema serves as documentation for the configuration options.
## Example Configuration
Here's an example configuration that conforms to the schema:
```json
{
"data": {
"directory": ".opencode"
},
"debug": false,
"providers": {
"anthropic": {
"apiKey": "your-api-key"
}
},
"agents": {
"coder": {
"model": "claude-3.7-sonnet",
"maxTokens": 5000,
"reasoningEffort": "medium"
},
"task": {
"model": "claude-3.7-sonnet",
"maxTokens": 5000
},
"title": {
"model": "claude-3.7-sonnet",
"maxTokens": 80
}
}
}
```
+262
View File
@@ -0,0 +1,262 @@
package main
import (
"encoding/json"
"fmt"
"os"
"github.com/kujtimiihoxha/opencode/internal/config"
"github.com/kujtimiihoxha/opencode/internal/llm/models"
)
// JSONSchemaType represents a JSON Schema type
type JSONSchemaType struct {
Type string `json:"type,omitempty"`
Description string `json:"description,omitempty"`
Properties map[string]any `json:"properties,omitempty"`
Required []string `json:"required,omitempty"`
AdditionalProperties any `json:"additionalProperties,omitempty"`
Enum []any `json:"enum,omitempty"`
Items map[string]any `json:"items,omitempty"`
OneOf []map[string]any `json:"oneOf,omitempty"`
AnyOf []map[string]any `json:"anyOf,omitempty"`
Default any `json:"default,omitempty"`
}
func main() {
schema := generateSchema()
// Pretty print the schema
encoder := json.NewEncoder(os.Stdout)
encoder.SetIndent("", " ")
if err := encoder.Encode(schema); err != nil {
fmt.Fprintf(os.Stderr, "Error encoding schema: %v\n", err)
os.Exit(1)
}
}
func generateSchema() map[string]any {
schema := map[string]any{
"$schema": "http://json-schema.org/draft-07/schema#",
"title": "OpenCode Configuration",
"description": "Configuration schema for the OpenCode application",
"type": "object",
"properties": map[string]any{},
}
// Add Data configuration
schema["properties"].(map[string]any)["data"] = map[string]any{
"type": "object",
"description": "Storage configuration",
"properties": map[string]any{
"directory": map[string]any{
"type": "string",
"description": "Directory where application data is stored",
"default": ".opencode",
},
},
"required": []string{"directory"},
}
// Add working directory
schema["properties"].(map[string]any)["wd"] = map[string]any{
"type": "string",
"description": "Working directory for the application",
}
// Add debug flags
schema["properties"].(map[string]any)["debug"] = map[string]any{
"type": "boolean",
"description": "Enable debug mode",
"default": false,
}
schema["properties"].(map[string]any)["debugLSP"] = map[string]any{
"type": "boolean",
"description": "Enable LSP debug mode",
"default": false,
}
// Add MCP servers
schema["properties"].(map[string]any)["mcpServers"] = map[string]any{
"type": "object",
"description": "Model Control Protocol server configurations",
"additionalProperties": map[string]any{
"type": "object",
"description": "MCP server configuration",
"properties": map[string]any{
"command": map[string]any{
"type": "string",
"description": "Command to execute for the MCP server",
},
"env": map[string]any{
"type": "array",
"description": "Environment variables for the MCP server",
"items": map[string]any{
"type": "string",
},
},
"args": map[string]any{
"type": "array",
"description": "Command arguments for the MCP server",
"items": map[string]any{
"type": "string",
},
},
"type": map[string]any{
"type": "string",
"description": "Type of MCP server",
"enum": []string{"stdio", "sse"},
"default": "stdio",
},
"url": map[string]any{
"type": "string",
"description": "URL for SSE type MCP servers",
},
"headers": map[string]any{
"type": "object",
"description": "HTTP headers for SSE type MCP servers",
"additionalProperties": map[string]any{
"type": "string",
},
},
},
"required": []string{"command"},
},
}
// Add providers
providerSchema := map[string]any{
"type": "object",
"description": "LLM provider configurations",
"additionalProperties": map[string]any{
"type": "object",
"description": "Provider configuration",
"properties": map[string]any{
"apiKey": map[string]any{
"type": "string",
"description": "API key for the provider",
},
"disabled": map[string]any{
"type": "boolean",
"description": "Whether the provider is disabled",
"default": false,
},
},
},
}
// Add known providers
knownProviders := []string{
string(models.ProviderAnthropic),
string(models.ProviderOpenAI),
string(models.ProviderGemini),
string(models.ProviderGROQ),
string(models.ProviderBedrock),
}
providerSchema["additionalProperties"].(map[string]any)["properties"].(map[string]any)["provider"] = map[string]any{
"type": "string",
"description": "Provider type",
"enum": knownProviders,
}
schema["properties"].(map[string]any)["providers"] = providerSchema
// Add agents
agentSchema := map[string]any{
"type": "object",
"description": "Agent configurations",
"additionalProperties": map[string]any{
"type": "object",
"description": "Agent configuration",
"properties": map[string]any{
"model": map[string]any{
"type": "string",
"description": "Model ID for the agent",
},
"maxTokens": map[string]any{
"type": "integer",
"description": "Maximum tokens for the agent",
"minimum": 1,
},
"reasoningEffort": map[string]any{
"type": "string",
"description": "Reasoning effort for models that support it (OpenAI, Anthropic)",
"enum": []string{"low", "medium", "high"},
},
},
"required": []string{"model"},
},
}
// Add model enum
modelEnum := []string{}
for modelID := range models.SupportedModels {
modelEnum = append(modelEnum, string(modelID))
}
agentSchema["additionalProperties"].(map[string]any)["properties"].(map[string]any)["model"].(map[string]any)["enum"] = modelEnum
// Add specific agent properties
agentProperties := map[string]any{}
knownAgents := []string{
string(config.AgentCoder),
string(config.AgentTask),
string(config.AgentTitle),
}
for _, agentName := range knownAgents {
agentProperties[agentName] = map[string]any{
"$ref": "#/definitions/agent",
}
}
// Create a combined schema that allows both specific agents and additional ones
combinedAgentSchema := map[string]any{
"type": "object",
"description": "Agent configurations",
"properties": agentProperties,
"additionalProperties": agentSchema["additionalProperties"],
}
schema["properties"].(map[string]any)["agents"] = combinedAgentSchema
schema["definitions"] = map[string]any{
"agent": agentSchema["additionalProperties"],
}
// Add LSP configuration
schema["properties"].(map[string]any)["lsp"] = map[string]any{
"type": "object",
"description": "Language Server Protocol configurations",
"additionalProperties": map[string]any{
"type": "object",
"description": "LSP configuration for a language",
"properties": map[string]any{
"disabled": map[string]any{
"type": "boolean",
"description": "Whether the LSP is disabled",
"default": false,
},
"command": map[string]any{
"type": "string",
"description": "Command to execute for the LSP server",
},
"args": map[string]any{
"type": "array",
"description": "Command arguments for the LSP server",
"items": map[string]any{
"type": "string",
},
},
"options": map[string]any{
"type": "object",
"description": "Additional options for the LSP server",
},
},
"required": []string{"command"},
},
}
return schema
}
+143
View File
@@ -0,0 +1,143 @@
module github.com/kujtimiihoxha/opencode
go 1.24.0
toolchain go1.24.2
require (
github.com/JohannesKaufmann/html-to-markdown v1.6.0
github.com/PuerkitoBio/goquery v1.9.2
github.com/alecthomas/chroma/v2 v2.15.0
github.com/anthropics/anthropic-sdk-go v0.2.0-beta.2
github.com/bmatcuk/doublestar/v4 v4.8.1
github.com/catppuccin/go v0.3.0
github.com/charmbracelet/bubbles v0.20.0
github.com/charmbracelet/bubbletea v1.3.4
github.com/charmbracelet/glamour v0.9.1
github.com/charmbracelet/huh v0.6.0
github.com/charmbracelet/lipgloss v1.1.0
github.com/charmbracelet/x/ansi v0.8.0
github.com/fsnotify/fsnotify v1.8.0
github.com/go-git/go-git/v5 v5.15.0
github.com/go-logfmt/logfmt v0.6.0
github.com/golang-migrate/migrate/v4 v4.18.2
github.com/google/generative-ai-go v0.19.0
github.com/google/uuid v1.6.0
github.com/lrstanley/bubblezone v0.0.0-20250315020633-c249a3fe1231
github.com/mark3labs/mcp-go v0.17.0
github.com/mattn/go-runewidth v0.0.16
github.com/mattn/go-sqlite3 v1.14.24
github.com/muesli/ansi v0.0.0-20230316100256-276c6243b2f6
github.com/muesli/reflow v0.3.0
github.com/muesli/termenv v0.16.0
github.com/openai/openai-go v0.1.0-beta.2
github.com/sergi/go-diff v1.3.2-0.20230802210424-5b0b94c5c0d3
github.com/spf13/cobra v1.9.1
github.com/spf13/viper v1.20.0
github.com/stretchr/testify v1.10.0
google.golang.org/api v0.215.0
)
require (
cloud.google.com/go v0.116.0 // indirect
cloud.google.com/go/ai v0.8.0 // indirect
cloud.google.com/go/auth v0.13.0 // indirect
cloud.google.com/go/auth/oauth2adapt v0.2.6 // indirect
cloud.google.com/go/compute/metadata v0.6.0 // indirect
cloud.google.com/go/longrunning v0.5.7 // indirect
dario.cat/mergo v1.0.0 // indirect
github.com/Microsoft/go-winio v0.6.2 // indirect
github.com/ProtonMail/go-crypto v1.1.6 // indirect
github.com/andybalholm/cascadia v1.3.2 // indirect
github.com/atotto/clipboard v0.1.4 // indirect
github.com/aws/aws-sdk-go-v2 v1.30.3 // indirect
github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.6.3 // indirect
github.com/aws/aws-sdk-go-v2/config v1.27.27 // indirect
github.com/aws/aws-sdk-go-v2/credentials v1.17.27 // indirect
github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.16.11 // indirect
github.com/aws/aws-sdk-go-v2/internal/configsources v1.3.15 // indirect
github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.6.15 // indirect
github.com/aws/aws-sdk-go-v2/internal/ini v1.8.0 // indirect
github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.11.3 // indirect
github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.11.17 // indirect
github.com/aws/aws-sdk-go-v2/service/sso v1.22.4 // indirect
github.com/aws/aws-sdk-go-v2/service/ssooidc v1.26.4 // indirect
github.com/aws/aws-sdk-go-v2/service/sts v1.30.3 // indirect
github.com/aws/smithy-go v1.20.3 // indirect
github.com/aymanbagabas/go-osc52/v2 v2.0.1 // indirect
github.com/aymerick/douceur v0.2.0 // indirect
github.com/charmbracelet/colorprofile v0.2.3-0.20250311203215-f60798e515dc // indirect
github.com/charmbracelet/x/cellbuf v0.0.13-0.20250311204145-2c3ea96c31dd // indirect
github.com/charmbracelet/x/exp/strings v0.0.0-20240722160745-212f7b056ed0 // indirect
github.com/charmbracelet/x/term v0.2.1 // indirect
github.com/cloudflare/circl v1.6.1 // indirect
github.com/cyphar/filepath-securejoin v0.4.1 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/dlclark/regexp2 v1.11.4 // indirect
github.com/dustin/go-humanize v1.0.1 // indirect
github.com/emirpasic/gods v1.18.1 // indirect
github.com/erikgeiser/coninput v0.0.0-20211004153227-1c3628e74d0f // indirect
github.com/felixge/httpsnoop v1.0.4 // indirect
github.com/go-git/gcfg v1.5.1-0.20230307220236-3a3c6141e376 // indirect
github.com/go-git/go-billy/v5 v5.6.2 // indirect
github.com/go-logr/logr v1.4.2 // indirect
github.com/go-logr/stdr v1.2.2 // indirect
github.com/go-viper/mapstructure/v2 v2.2.1 // indirect
github.com/golang/groupcache v0.0.0-20241129210726-2c02b8208cf8 // indirect
github.com/google/s2a-go v0.1.8 // indirect
github.com/googleapis/enterprise-certificate-proxy v0.3.4 // indirect
github.com/googleapis/gax-go/v2 v2.14.1 // indirect
github.com/gorilla/css v1.0.1 // indirect
github.com/hashicorp/errwrap v1.1.0 // indirect
github.com/hashicorp/go-multierror v1.1.1 // indirect
github.com/inconshreveable/mousetrap v1.1.0 // indirect
github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99 // indirect
github.com/kevinburke/ssh_config v1.2.0 // indirect
github.com/lucasb-eyer/go-colorful v1.2.0 // indirect
github.com/mattn/go-isatty v0.0.20 // indirect
github.com/mattn/go-localereader v0.0.1 // indirect
github.com/microcosm-cc/bluemonday v1.0.27 // indirect
github.com/mitchellh/hashstructure/v2 v2.0.2 // indirect
github.com/muesli/cancelreader v0.2.2 // indirect
github.com/pelletier/go-toml/v2 v2.2.3 // indirect
github.com/pjbgf/sha1cd v0.3.2 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/rivo/uniseg v0.4.7 // indirect
github.com/sagikazarmark/locafero v0.7.0 // indirect
github.com/skeema/knownhosts v1.3.1 // indirect
github.com/sourcegraph/conc v0.3.0 // indirect
github.com/spf13/afero v1.12.0 // indirect
github.com/spf13/cast v1.7.1 // indirect
github.com/spf13/pflag v1.0.6 // indirect
github.com/subosito/gotenv v1.6.0 // indirect
github.com/tidwall/gjson v1.18.0 // indirect
github.com/tidwall/match v1.1.1 // indirect
github.com/tidwall/pretty v1.2.1 // indirect
github.com/tidwall/sjson v1.2.5 // indirect
github.com/xanzy/ssh-agent v0.3.3 // indirect
github.com/xo/terminfo v0.0.0-20220910002029-abceb7e1c41e // indirect
github.com/yosida95/uritemplate/v3 v3.0.2 // indirect
github.com/yuin/goldmark v1.7.8 // indirect
github.com/yuin/goldmark-emoji v1.0.5 // indirect
go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.54.0 // indirect
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.54.0 // indirect
go.opentelemetry.io/otel v1.29.0 // indirect
go.opentelemetry.io/otel/metric v1.29.0 // indirect
go.opentelemetry.io/otel/trace v1.29.0 // indirect
go.uber.org/atomic v1.9.0 // indirect
go.uber.org/multierr v1.9.0 // indirect
golang.org/x/crypto v0.37.0 // indirect
golang.org/x/net v0.39.0 // indirect
golang.org/x/oauth2 v0.25.0 // indirect
golang.org/x/sync v0.13.0 // indirect
golang.org/x/sys v0.32.0 // indirect
golang.org/x/term v0.31.0 // indirect
golang.org/x/text v0.24.0 // indirect
golang.org/x/time v0.8.0 // indirect
google.golang.org/genproto/googleapis/api v0.0.0-20241209162323-e6fa225c2576 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20241223144023-3abc09e42ca8 // indirect
google.golang.org/grpc v1.67.3 // indirect
google.golang.org/protobuf v1.36.1 // indirect
gopkg.in/warnings.v0 v0.1.2 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
)
+396
View File
@@ -0,0 +1,396 @@
cloud.google.com/go v0.116.0 h1:B3fRrSDkLRt5qSHWe40ERJvhvnQwdZiHu0bJOpldweE=
cloud.google.com/go v0.116.0/go.mod h1:cEPSRWPzZEswwdr9BxE6ChEn01dWlTaF05LiC2Xs70U=
cloud.google.com/go/ai v0.8.0 h1:rXUEz8Wp2OlrM8r1bfmpF2+VKqc1VJpafE3HgzRnD/w=
cloud.google.com/go/ai v0.8.0/go.mod h1:t3Dfk4cM61sytiggo2UyGsDVW3RF1qGZaUKDrZFyqkE=
cloud.google.com/go/auth v0.13.0 h1:8Fu8TZy167JkW8Tj3q7dIkr2v4cndv41ouecJx0PAHs=
cloud.google.com/go/auth v0.13.0/go.mod h1:COOjD9gwfKNKz+IIduatIhYJQIc0mG3H102r/EMxX6Q=
cloud.google.com/go/auth/oauth2adapt v0.2.6 h1:V6a6XDu2lTwPZWOawrAa9HUK+DB2zfJyTuciBG5hFkU=
cloud.google.com/go/auth/oauth2adapt v0.2.6/go.mod h1:AlmsELtlEBnaNTL7jCj8VQFLy6mbZv0s4Q7NGBeQ5E8=
cloud.google.com/go/compute/metadata v0.6.0 h1:A6hENjEsCDtC1k8byVsgwvVcioamEHvZ4j01OwKxG9I=
cloud.google.com/go/compute/metadata v0.6.0/go.mod h1:FjyFAW1MW0C203CEOMDTu3Dk1FlqW3Rga40jzHL4hfg=
cloud.google.com/go/longrunning v0.5.7 h1:WLbHekDbjK1fVFD3ibpFFVoyizlLRl73I7YKuAKilhU=
cloud.google.com/go/longrunning v0.5.7/go.mod h1:8GClkudohy1Fxm3owmBGid8W0pSgodEMwEAztp38Xng=
dario.cat/mergo v1.0.0 h1:AGCNq9Evsj31mOgNPcLyXc+4PNABt905YmuqPYYpBWk=
dario.cat/mergo v1.0.0/go.mod h1:uNxQE+84aUszobStD9th8a29P2fMDhsBdgRYvZOxGmk=
github.com/JohannesKaufmann/html-to-markdown v1.6.0 h1:04VXMiE50YYfCfLboJCLcgqF5x+rHJnb1ssNmqpLH/k=
github.com/JohannesKaufmann/html-to-markdown v1.6.0/go.mod h1:NUI78lGg/a7vpEJTz/0uOcYMaibytE4BUOQS8k78yPQ=
github.com/MakeNowJust/heredoc v1.0.0 h1:cXCdzVdstXyiTqTvfqk9SDHpKNjxuom+DOlyEeQ4pzQ=
github.com/MakeNowJust/heredoc v1.0.0/go.mod h1:mG5amYoWBHf8vpLOuehzbGGw0EHxpZZ6lCpQ4fNJ8LE=
github.com/Microsoft/go-winio v0.5.2/go.mod h1:WpS1mjBmmwHBEWmogvA2mj8546UReBk4v8QkMxJ6pZY=
github.com/Microsoft/go-winio v0.6.2 h1:F2VQgta7ecxGYO8k3ZZz3RS8fVIXVxONVUPlNERoyfY=
github.com/Microsoft/go-winio v0.6.2/go.mod h1:yd8OoFMLzJbo9gZq8j5qaps8bJ9aShtEA8Ipt1oGCvU=
github.com/ProtonMail/go-crypto v1.1.6 h1:ZcV+Ropw6Qn0AX9brlQLAUXfqLBc7Bl+f/DmNxpLfdw=
github.com/ProtonMail/go-crypto v1.1.6/go.mod h1:rA3QumHc/FZ8pAHreoekgiAbzpNsfQAosU5td4SnOrE=
github.com/PuerkitoBio/goquery v1.9.2 h1:4/wZksC3KgkQw7SQgkKotmKljk0M6V8TUvA8Wb4yPeE=
github.com/PuerkitoBio/goquery v1.9.2/go.mod h1:GHPCaP0ODyyxqcNoFGYlAprUFH81NuRPd0GX3Zu2Mvk=
github.com/alecthomas/assert/v2 v2.11.0 h1:2Q9r3ki8+JYXvGsDyBXwH3LcJ+WK5D0gc5E8vS6K3D0=
github.com/alecthomas/assert/v2 v2.11.0/go.mod h1:Bze95FyfUr7x34QZrjL+XP+0qgp/zg8yS+TtBj1WA3k=
github.com/alecthomas/chroma/v2 v2.15.0 h1:LxXTQHFoYrstG2nnV9y2X5O94sOBzf0CIUpSTbpxvMc=
github.com/alecthomas/chroma/v2 v2.15.0/go.mod h1:gUhVLrPDXPtp/f+L1jo9xepo9gL4eLwRuGAunSZMkio=
github.com/alecthomas/repr v0.4.0 h1:GhI2A8MACjfegCPVq9f1FLvIBS+DrQ2KQBFZP1iFzXc=
github.com/alecthomas/repr v0.4.0/go.mod h1:Fr0507jx4eOXV7AlPV6AVZLYrLIuIeSOWtW57eE/O/4=
github.com/andybalholm/cascadia v1.3.2 h1:3Xi6Dw5lHF15JtdcmAHD3i1+T8plmv7BQ/nsViSLyss=
github.com/andybalholm/cascadia v1.3.2/go.mod h1:7gtRlve5FxPPgIgX36uWBX58OdBsSS6lUvCFb+h7KvU=
github.com/anmitsu/go-shlex v0.0.0-20200514113438-38f4b401e2be h1:9AeTilPcZAjCFIImctFaOjnTIavg87rW78vTPkQqLI8=
github.com/anmitsu/go-shlex v0.0.0-20200514113438-38f4b401e2be/go.mod h1:ySMOLuWl6zY27l47sB3qLNK6tF2fkHG55UZxx8oIVo4=
github.com/anthropics/anthropic-sdk-go v0.2.0-beta.2 h1:h7qxtumNjKPWFv1QM/HJy60MteeW23iKeEtBoY7bYZk=
github.com/anthropics/anthropic-sdk-go v0.2.0-beta.2/go.mod h1:AapDW22irxK2PSumZiQXYUFvsdQgkwIWlpESweWZI/c=
github.com/armon/go-socks5 v0.0.0-20160902184237-e75332964ef5 h1:0CwZNZbxp69SHPdPJAN/hZIm0C4OItdklCFmMRWYpio=
github.com/armon/go-socks5 v0.0.0-20160902184237-e75332964ef5/go.mod h1:wHh0iHkYZB8zMSxRWpUBQtwG5a7fFgvEO+odwuTv2gs=
github.com/atotto/clipboard v0.1.4 h1:EH0zSVneZPSuFR11BlR9YppQTVDbh5+16AmcJi4g1z4=
github.com/atotto/clipboard v0.1.4/go.mod h1:ZY9tmq7sm5xIbd9bOK4onWV4S6X0u6GY7Vn0Yu86PYI=
github.com/aws/aws-sdk-go-v2 v1.30.3 h1:jUeBtG0Ih+ZIFH0F4UkmL9w3cSpaMv9tYYDbzILP8dY=
github.com/aws/aws-sdk-go-v2 v1.30.3/go.mod h1:nIQjQVp5sfpQcTc9mPSr1B0PaWK5ByX9MOoDadSN4lc=
github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.6.3 h1:tW1/Rkad38LA15X4UQtjXZXNKsCgkshC3EbmcUmghTg=
github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.6.3/go.mod h1:UbnqO+zjqk3uIt9yCACHJ9IVNhyhOCnYk8yA19SAWrM=
github.com/aws/aws-sdk-go-v2/config v1.27.27 h1:HdqgGt1OAP0HkEDDShEl0oSYa9ZZBSOmKpdpsDMdO90=
github.com/aws/aws-sdk-go-v2/config v1.27.27/go.mod h1:MVYamCg76dFNINkZFu4n4RjDixhVr51HLj4ErWzrVwg=
github.com/aws/aws-sdk-go-v2/credentials v1.17.27 h1:2raNba6gr2IfA0eqqiP2XiQ0UVOpGPgDSi0I9iAP+UI=
github.com/aws/aws-sdk-go-v2/credentials v1.17.27/go.mod h1:gniiwbGahQByxan6YjQUMcW4Aov6bLC3m+evgcoN4r4=
github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.16.11 h1:KreluoV8FZDEtI6Co2xuNk/UqI9iwMrOx/87PBNIKqw=
github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.16.11/go.mod h1:SeSUYBLsMYFoRvHE0Tjvn7kbxaUhl75CJi1sbfhMxkU=
github.com/aws/aws-sdk-go-v2/internal/configsources v1.3.15 h1:SoNJ4RlFEQEbtDcCEt+QG56MY4fm4W8rYirAmq+/DdU=
github.com/aws/aws-sdk-go-v2/internal/configsources v1.3.15/go.mod h1:U9ke74k1n2bf+RIgoX1SXFed1HLs51OgUSs+Ph0KJP8=
github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.6.15 h1:C6WHdGnTDIYETAm5iErQUiVNsclNx9qbJVPIt03B6bI=
github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.6.15/go.mod h1:ZQLZqhcu+JhSrA9/NXRm8SkDvsycE+JkV3WGY41e+IM=
github.com/aws/aws-sdk-go-v2/internal/ini v1.8.0 h1:hT8rVHwugYE2lEfdFE0QWVo81lF7jMrYJVDWI+f+VxU=
github.com/aws/aws-sdk-go-v2/internal/ini v1.8.0/go.mod h1:8tu/lYfQfFe6IGnaOdrpVgEL2IrrDOf6/m9RQum4NkY=
github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.11.3 h1:dT3MqvGhSoaIhRseqw2I0yH81l7wiR2vjs57O51EAm8=
github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.11.3/go.mod h1:GlAeCkHwugxdHaueRr4nhPuY+WW+gR8UjlcqzPr1SPI=
github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.11.17 h1:HGErhhrxZlQ044RiM+WdoZxp0p+EGM62y3L6pwA4olE=
github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.11.17/go.mod h1:RkZEx4l0EHYDJpWppMJ3nD9wZJAa8/0lq9aVC+r2UII=
github.com/aws/aws-sdk-go-v2/service/sso v1.22.4 h1:BXx0ZIxvrJdSgSvKTZ+yRBeSqqgPM89VPlulEcl37tM=
github.com/aws/aws-sdk-go-v2/service/sso v1.22.4/go.mod h1:ooyCOXjvJEsUw7x+ZDHeISPMhtwI3ZCB7ggFMcFfWLU=
github.com/aws/aws-sdk-go-v2/service/ssooidc v1.26.4 h1:yiwVzJW2ZxZTurVbYWA7QOrAaCYQR72t0wrSBfoesUE=
github.com/aws/aws-sdk-go-v2/service/ssooidc v1.26.4/go.mod h1:0oxfLkpz3rQ/CHlx5hB7H69YUpFiI1tql6Q6Ne+1bCw=
github.com/aws/aws-sdk-go-v2/service/sts v1.30.3 h1:ZsDKRLXGWHk8WdtyYMoGNO7bTudrvuKpDKgMVRlepGE=
github.com/aws/aws-sdk-go-v2/service/sts v1.30.3/go.mod h1:zwySh8fpFyXp9yOr/KVzxOl8SRqgf/IDw5aUt9UKFcQ=
github.com/aws/smithy-go v1.20.3 h1:ryHwveWzPV5BIof6fyDvor6V3iUL7nTfiTKXHiW05nE=
github.com/aws/smithy-go v1.20.3/go.mod h1:krry+ya/rV9RDcV/Q16kpu6ypI4K2czasz0NC3qS14E=
github.com/aymanbagabas/go-osc52/v2 v2.0.1 h1:HwpRHbFMcZLEVr42D4p7XBqjyuxQH5SMiErDT4WkJ2k=
github.com/aymanbagabas/go-osc52/v2 v2.0.1/go.mod h1:uYgXzlJ7ZpABp8OJ+exZzJJhRNQ2ASbcXHWsFqH8hp8=
github.com/aymanbagabas/go-udiff v0.2.0 h1:TK0fH4MteXUDspT88n8CKzvK0X9O2xu9yQjWpi6yML8=
github.com/aymanbagabas/go-udiff v0.2.0/go.mod h1:RE4Ex0qsGkTAJoQdQQCA0uG+nAzJO/pI/QwceO5fgrA=
github.com/aymerick/douceur v0.2.0 h1:Mv+mAeH1Q+n9Fr+oyamOlAkUNPWPlA8PPGR0QAaYuPk=
github.com/aymerick/douceur v0.2.0/go.mod h1:wlT5vV2O3h55X9m7iVYN0TBM0NH/MmbLnd30/FjWUq4=
github.com/bmatcuk/doublestar/v4 v4.8.1 h1:54Bopc5c2cAvhLRAzqOGCYHYyhcDHsFF4wWIR5wKP38=
github.com/bmatcuk/doublestar/v4 v4.8.1/go.mod h1:xBQ8jztBU6kakFMg+8WGxn0c6z1fTSPVIjEY1Wr7jzc=
github.com/catppuccin/go v0.3.0 h1:d+0/YicIq+hSTo5oPuRi5kOpqkVA5tAsU6dNhvRu+aY=
github.com/catppuccin/go v0.3.0/go.mod h1:8IHJuMGaUUjQM82qBrGNBv7LFq6JI3NnQCF6MOlZjpc=
github.com/charmbracelet/bubbles v0.20.0 h1:jSZu6qD8cRQ6k9OMfR1WlM+ruM8fkPWkHvQWD9LIutE=
github.com/charmbracelet/bubbles v0.20.0/go.mod h1:39slydyswPy+uVOHZ5x/GjwVAFkCsV8IIVy+4MhzwwU=
github.com/charmbracelet/bubbletea v1.3.4 h1:kCg7B+jSCFPLYRA52SDZjr51kG/fMUEoPoZrkaDHyoI=
github.com/charmbracelet/bubbletea v1.3.4/go.mod h1:dtcUCyCGEX3g9tosuYiut3MXgY/Jsv9nKVdibKKRRXo=
github.com/charmbracelet/colorprofile v0.2.3-0.20250311203215-f60798e515dc h1:4pZI35227imm7yK2bGPcfpFEmuY1gc2YSTShr4iJBfs=
github.com/charmbracelet/colorprofile v0.2.3-0.20250311203215-f60798e515dc/go.mod h1:X4/0JoqgTIPSFcRA/P6INZzIuyqdFY5rm8tb41s9okk=
github.com/charmbracelet/glamour v0.9.1 h1:11dEfiGP8q1BEqvGoIjivuc2rBk+5qEXdPtaQ2WoiCM=
github.com/charmbracelet/glamour v0.9.1/go.mod h1:+SHvIS8qnwhgTpVMiXwn7OfGomSqff1cHBCI8jLOetk=
github.com/charmbracelet/huh v0.6.0 h1:mZM8VvZGuE0hoDXq6XLxRtgfWyTI3b2jZNKh0xWmax8=
github.com/charmbracelet/huh v0.6.0/go.mod h1:GGNKeWCeNzKpEOh/OJD8WBwTQjV3prFAtQPpLv+AVwU=
github.com/charmbracelet/lipgloss v1.1.0 h1:vYXsiLHVkK7fp74RkV7b2kq9+zDLoEU4MZoFqR/noCY=
github.com/charmbracelet/lipgloss v1.1.0/go.mod h1:/6Q8FR2o+kj8rz4Dq0zQc3vYf7X+B0binUUBwA0aL30=
github.com/charmbracelet/x/ansi v0.8.0 h1:9GTq3xq9caJW8ZrBTe0LIe2fvfLR/bYXKTx2llXn7xE=
github.com/charmbracelet/x/ansi v0.8.0/go.mod h1:wdYl/ONOLHLIVmQaxbIYEC/cRKOQyjTkowiI4blgS9Q=
github.com/charmbracelet/x/cellbuf v0.0.13-0.20250311204145-2c3ea96c31dd h1:vy0GVL4jeHEwG5YOXDmi86oYw2yuYUGqz6a8sLwg0X8=
github.com/charmbracelet/x/cellbuf v0.0.13-0.20250311204145-2c3ea96c31dd/go.mod h1:xe0nKWGd3eJgtqZRaN9RjMtK7xUYchjzPr7q6kcvCCs=
github.com/charmbracelet/x/exp/golden v0.0.0-20240815200342-61de596daa2b h1:MnAMdlwSltxJyULnrYbkZpp4k58Co7Tah3ciKhSNo0Q=
github.com/charmbracelet/x/exp/golden v0.0.0-20240815200342-61de596daa2b/go.mod h1:wDlXFlCrmJ8J+swcL/MnGUuYnqgQdW9rhSD61oNMb6U=
github.com/charmbracelet/x/exp/strings v0.0.0-20240722160745-212f7b056ed0 h1:qko3AQ4gK1MTS/de7F5hPGx6/k1u0w4TeYmBFwzYVP4=
github.com/charmbracelet/x/exp/strings v0.0.0-20240722160745-212f7b056ed0/go.mod h1:pBhA0ybfXv6hDjQUZ7hk1lVxBiUbupdw5R31yPUViVQ=
github.com/charmbracelet/x/term v0.2.1 h1:AQeHeLZ1OqSXhrAWpYUtZyX1T3zVxfpZuEQMIQaGIAQ=
github.com/charmbracelet/x/term v0.2.1/go.mod h1:oQ4enTYFV7QN4m0i9mzHrViD7TQKvNEEkHUMCmsxdUg=
github.com/cloudflare/circl v1.6.1 h1:zqIqSPIndyBh1bjLVVDHMPpVKqp8Su/V+6MeDzzQBQ0=
github.com/cloudflare/circl v1.6.1/go.mod h1:uddAzsPgqdMAYatqJ0lsjX1oECcQLIlRpzZh3pJrofs=
github.com/cpuguy83/go-md2man/v2 v2.0.6/go.mod h1:oOW0eioCTA6cOiMLiUPZOpcVxMig6NIQQ7OS05n1F4g=
github.com/cyphar/filepath-securejoin v0.4.1 h1:JyxxyPEaktOD+GAnqIqTf9A8tHyAG22rowi7HkoSU1s=
github.com/cyphar/filepath-securejoin v0.4.1/go.mod h1:Sdj7gXlvMcPZsbhwhQ33GguGLDGQL7h7bg04C/+u9jI=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/dlclark/regexp2 v1.11.4 h1:rPYF9/LECdNymJufQKmri9gV604RvvABwgOA8un7yAo=
github.com/dlclark/regexp2 v1.11.4/go.mod h1:DHkYz0B9wPfa6wondMfaivmHpzrQ3v9q8cnmRbL6yW8=
github.com/dustin/go-humanize v1.0.1 h1:GzkhY7T5VNhEkwH0PVJgjz+fX1rhBrR7pRT3mDkpeCY=
github.com/dustin/go-humanize v1.0.1/go.mod h1:Mu1zIs6XwVuF/gI1OepvI0qD18qycQx+mFykh5fBlto=
github.com/elazarl/goproxy v1.7.2 h1:Y2o6urb7Eule09PjlhQRGNsqRfPmYI3KKQLFpCAV3+o=
github.com/elazarl/goproxy v1.7.2/go.mod h1:82vkLNir0ALaW14Rc399OTTjyNREgmdL2cVoIbS6XaE=
github.com/emirpasic/gods v1.18.1 h1:FXtiHYKDGKCW2KzwZKx0iC0PQmdlorYgdFG9jPXJ1Bc=
github.com/emirpasic/gods v1.18.1/go.mod h1:8tpGGwCnJ5H4r6BWwaV6OrWmMoPhUl5jm/FMNAnJvWQ=
github.com/erikgeiser/coninput v0.0.0-20211004153227-1c3628e74d0f h1:Y/CXytFA4m6baUTXGLOoWe4PQhGxaX0KpnayAqC48p4=
github.com/erikgeiser/coninput v0.0.0-20211004153227-1c3628e74d0f/go.mod h1:vw97MGsxSvLiUE2X8qFplwetxpGLQrlU1Q9AUEIzCaM=
github.com/felixge/httpsnoop v1.0.4 h1:NFTV2Zj1bL4mc9sqWACXbQFVBBg2W3GPvqp8/ESS2Wg=
github.com/felixge/httpsnoop v1.0.4/go.mod h1:m8KPJKqk1gH5J9DgRY2ASl2lWCfGKXixSwevea8zH2U=
github.com/frankban/quicktest v1.14.6 h1:7Xjx+VpznH+oBnejlPUj8oUpdxnVs4f8XU8WnHkI4W8=
github.com/frankban/quicktest v1.14.6/go.mod h1:4ptaffx2x8+WTWXmUCuVU6aPUX1/Mz7zb5vbUoiM6w0=
github.com/fsnotify/fsnotify v1.8.0 h1:dAwr6QBTBZIkG8roQaJjGof0pp0EeF+tNV7YBP3F/8M=
github.com/fsnotify/fsnotify v1.8.0/go.mod h1:8jBTzvmWwFyi3Pb8djgCCO5IBqzKJ/Jwo8TRcHyHii0=
github.com/gliderlabs/ssh v0.3.8 h1:a4YXD1V7xMF9g5nTkdfnja3Sxy1PVDCj1Zg4Wb8vY6c=
github.com/gliderlabs/ssh v0.3.8/go.mod h1:xYoytBv1sV0aL3CavoDuJIQNURXkkfPA/wxQ1pL1fAU=
github.com/go-git/gcfg v1.5.1-0.20230307220236-3a3c6141e376 h1:+zs/tPmkDkHx3U66DAb0lQFJrpS6731Oaa12ikc+DiI=
github.com/go-git/gcfg v1.5.1-0.20230307220236-3a3c6141e376/go.mod h1:an3vInlBmSxCcxctByoQdvwPiA7DTK7jaaFDBTtu0ic=
github.com/go-git/go-billy/v5 v5.6.2 h1:6Q86EsPXMa7c3YZ3aLAQsMA0VlWmy43r6FHqa/UNbRM=
github.com/go-git/go-billy/v5 v5.6.2/go.mod h1:rcFC2rAsp/erv7CMz9GczHcuD0D32fWzH+MJAU+jaUU=
github.com/go-git/go-git-fixtures/v4 v4.3.2-0.20231010084843-55a94097c399 h1:eMje31YglSBqCdIqdhKBW8lokaMrL3uTkpGYlE2OOT4=
github.com/go-git/go-git-fixtures/v4 v4.3.2-0.20231010084843-55a94097c399/go.mod h1:1OCfN199q1Jm3HZlxleg+Dw/mwps2Wbk9frAWm+4FII=
github.com/go-git/go-git/v5 v5.15.0 h1:f5Qn0W0F7ry1iN0ZwIU5m/n7/BKB4hiZfc+zlZx7ly0=
github.com/go-git/go-git/v5 v5.15.0/go.mod h1:4Ge4alE/5gPs30F2H1esi2gPd69R0C39lolkucHBOp8=
github.com/go-logfmt/logfmt v0.6.0 h1:wGYYu3uicYdqXVgoYbvnkrPVXkuLM1p1ifugDMEdRi4=
github.com/go-logfmt/logfmt v0.6.0/go.mod h1:WYhtIu8zTZfxdn5+rREduYbwxfcBr/Vr6KEVveWlfTs=
github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A=
github.com/go-logr/logr v1.4.2 h1:6pFjapn8bFcIbiKo3XT4j/BhANplGihG6tvd+8rYgrY=
github.com/go-logr/logr v1.4.2/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY=
github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag=
github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE=
github.com/go-viper/mapstructure/v2 v2.2.1 h1:ZAaOCxANMuZx5RCeg0mBdEZk7DZasvvZIxtHqx8aGss=
github.com/go-viper/mapstructure/v2 v2.2.1/go.mod h1:oJDH3BJKyqBA2TXFhDsKDGDTlndYOZ6rGS0BRZIxGhM=
github.com/golang-migrate/migrate/v4 v4.18.2 h1:2VSCMz7x7mjyTXx3m2zPokOY82LTRgxK1yQYKo6wWQ8=
github.com/golang-migrate/migrate/v4 v4.18.2/go.mod h1:2CM6tJvn2kqPXwnXO/d3rAQYiyoIm180VsO8PRX6Rpk=
github.com/golang/groupcache v0.0.0-20241129210726-2c02b8208cf8 h1:f+oWsMOmNPc8JmEHVZIycC7hBoQxHH9pNKQORJNozsQ=
github.com/golang/groupcache v0.0.0-20241129210726-2c02b8208cf8/go.mod h1:wcDNUvekVysuuOpQKo3191zZyTpiI6se1N1ULghS0sw=
github.com/google/generative-ai-go v0.19.0 h1:R71szggh8wHMCUlEMsW2A/3T+5LdEIkiaHSYgSpUgdg=
github.com/google/generative-ai-go v0.19.0/go.mod h1:JYolL13VG7j79kM5BtHz4qwONHkeJQzOCkKXnpqtS/E=
github.com/google/go-cmp v0.7.0 h1:wk8382ETsv4JYUZwIsn6YpYiWiBsYLSJiTsyBybVuN8=
github.com/google/go-cmp v0.7.0/go.mod h1:pXiqmnSA92OHEEa9HXL2W4E7lf9JzCmGVUdgjX3N/iU=
github.com/google/s2a-go v0.1.8 h1:zZDs9gcbt9ZPLV0ndSyQk6Kacx2g/X+SKYovpnz3SMM=
github.com/google/s2a-go v0.1.8/go.mod h1:6iNWHTpQ+nfNRN5E00MSdfDwVesa8hhS32PhPO8deJA=
github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0=
github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
github.com/googleapis/enterprise-certificate-proxy v0.3.4 h1:XYIDZApgAnrN1c855gTgghdIA6Stxb52D5RnLI1SLyw=
github.com/googleapis/enterprise-certificate-proxy v0.3.4/go.mod h1:YKe7cfqYXjKGpGvmSg28/fFvhNzinZQm8DGnaburhGA=
github.com/googleapis/gax-go/v2 v2.14.1 h1:hb0FFeiPaQskmvakKu5EbCbpntQn48jyHuvrkurSS/Q=
github.com/googleapis/gax-go/v2 v2.14.1/go.mod h1:Hb/NubMaVM88SrNkvl8X/o8XWwDJEPqouaLeN2IUxoA=
github.com/gorilla/css v1.0.1 h1:ntNaBIghp6JmvWnxbZKANoLyuXTPZ4cAMlo6RyhlbO8=
github.com/gorilla/css v1.0.1/go.mod h1:BvnYkspnSzMmwRK+b8/xgNPLiIuNZr6vbZBTPQ2A3b0=
github.com/hashicorp/errwrap v1.0.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4=
github.com/hashicorp/errwrap v1.1.0 h1:OxrOeh75EUXMY8TBjag2fzXGZ40LB6IKw45YeGUDY2I=
github.com/hashicorp/errwrap v1.1.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4=
github.com/hashicorp/go-multierror v1.1.1 h1:H5DkEtf6CXdFp0N0Em5UCwQpXMWke8IA0+lD48awMYo=
github.com/hashicorp/go-multierror v1.1.1/go.mod h1:iw975J/qwKPdAO1clOe2L8331t/9/fmwbPZ6JB6eMoM=
github.com/hexops/gotextdiff v1.0.3 h1:gitA9+qJrrTCsiCl7+kh75nPqQt1cx4ZkudSTLoUqJM=
github.com/hexops/gotextdiff v1.0.3/go.mod h1:pSWU5MAI3yDq+fZBTazCSJysOMbxWL1BSow5/V2vxeg=
github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2s0bqwp9tc8=
github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw=
github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99 h1:BQSFePA1RWJOlocH6Fxy8MmwDt+yVQYULKfN0RoTN8A=
github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99/go.mod h1:1lJo3i6rXxKeerYnT8Nvf0QmHCRC1n8sfWVwXF2Frvo=
github.com/kevinburke/ssh_config v1.2.0 h1:x584FjTGwHzMwvHx18PXxbBVzfnxogHaAReU4gf13a4=
github.com/kevinburke/ssh_config v1.2.0/go.mod h1:CT57kijsi8u/K/BOFA39wgDQJ9CxiF4nAY/ojJ6r6mM=
github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=
github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE=
github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk=
github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE=
github.com/lib/pq v1.10.9 h1:YXG7RB+JIjhP29X+OtkiDnYaXQwpS4JEWq7dtCCRUEw=
github.com/lib/pq v1.10.9/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o=
github.com/lrstanley/bubblezone v0.0.0-20250315020633-c249a3fe1231 h1:9rjt7AfnrXKNSZhp36A3/4QAZAwGGCGD/p8Bse26zms=
github.com/lrstanley/bubblezone v0.0.0-20250315020633-c249a3fe1231/go.mod h1:S5etECMx+sZnW0Gm100Ma9J1PgVCTgNyFaqGu2b08b4=
github.com/lucasb-eyer/go-colorful v1.2.0 h1:1nnpGOrhyZZuNyfu1QjKiUICQ74+3FNCN69Aj6K7nkY=
github.com/lucasb-eyer/go-colorful v1.2.0/go.mod h1:R4dSotOR9KMtayYi1e77YzuveK+i7ruzyGqttikkLy0=
github.com/mark3labs/mcp-go v0.17.0 h1:5Ps6T7qXr7De/2QTqs9h6BKeZ/qdeUeGrgM5lPzi930=
github.com/mark3labs/mcp-go v0.17.0/go.mod h1:KmJndYv7GIgcPVwEKJjNcbhVQ+hJGJhrCCB/9xITzpE=
github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY=
github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y=
github.com/mattn/go-localereader v0.0.1 h1:ygSAOl7ZXTx4RdPYinUpg6W99U8jWvWi9Ye2JC/oIi4=
github.com/mattn/go-localereader v0.0.1/go.mod h1:8fBrzywKY7BI3czFoHkuzRoWE9C+EiG4R1k4Cjx5p88=
github.com/mattn/go-runewidth v0.0.12/go.mod h1:RAqKPSqVFrSLVXbA8x7dzmKdmGzieGRCM46jaSJTDAk=
github.com/mattn/go-runewidth v0.0.16 h1:E5ScNMtiwvlvB5paMFdw9p4kSQzbXFikJ5SQO6TULQc=
github.com/mattn/go-runewidth v0.0.16/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w=
github.com/mattn/go-sqlite3 v1.14.24 h1:tpSp2G2KyMnnQu99ngJ47EIkWVmliIizyZBfPrBWDRM=
github.com/mattn/go-sqlite3 v1.14.24/go.mod h1:Uh1q+B4BYcTPb+yiD3kU8Ct7aC0hY9fxUwlHK0RXw+Y=
github.com/microcosm-cc/bluemonday v1.0.27 h1:MpEUotklkwCSLeH+Qdx1VJgNqLlpY2KXwXFM08ygZfk=
github.com/microcosm-cc/bluemonday v1.0.27/go.mod h1:jFi9vgW+H7c3V0lb6nR74Ib/DIB5OBs92Dimizgw2cA=
github.com/mitchellh/hashstructure/v2 v2.0.2 h1:vGKWl0YJqUNxE8d+h8f6NJLcCJrgbhC4NcD46KavDd4=
github.com/mitchellh/hashstructure/v2 v2.0.2/go.mod h1:MG3aRVU/N29oo/V/IhBX8GR/zz4kQkprJgF2EVszyDE=
github.com/muesli/ansi v0.0.0-20230316100256-276c6243b2f6 h1:ZK8zHtRHOkbHy6Mmr5D264iyp3TiX5OmNcI5cIARiQI=
github.com/muesli/ansi v0.0.0-20230316100256-276c6243b2f6/go.mod h1:CJlz5H+gyd6CUWT45Oy4q24RdLyn7Md9Vj2/ldJBSIo=
github.com/muesli/cancelreader v0.2.2 h1:3I4Kt4BQjOR54NavqnDogx/MIoWBFa0StPA8ELUXHmA=
github.com/muesli/cancelreader v0.2.2/go.mod h1:3XuTXfFS2VjM+HTLZY9Ak0l6eUKfijIfMUZ4EgX0QYo=
github.com/muesli/reflow v0.3.0 h1:IFsN6K9NfGtjeggFP+68I4chLZV2yIKsXJFNZ+eWh6s=
github.com/muesli/reflow v0.3.0/go.mod h1:pbwTDkVPibjO2kyvBQRBxTWEEGDGq0FlB1BIKtnHY/8=
github.com/muesli/termenv v0.16.0 h1:S5AlUN9dENB57rsbnkPyfdGuWIlkmzJjbFf0Tf5FWUc=
github.com/muesli/termenv v0.16.0/go.mod h1:ZRfOIKPFDYQoDFF4Olj7/QJbW60Ol/kL1pU3VfY/Cnk=
github.com/onsi/gomega v1.34.1 h1:EUMJIKUjM8sKjYbtxQI9A4z2o+rruxnzNvpknOXie6k=
github.com/onsi/gomega v1.34.1/go.mod h1:kU1QgUvBDLXBJq618Xvm2LUX6rSAfRaFRTcdOeDLwwY=
github.com/openai/openai-go v0.1.0-beta.2 h1:Ra5nCFkbEl9w+UJwAciC4kqnIBUCcJazhmMA0/YN894=
github.com/openai/openai-go v0.1.0-beta.2/go.mod h1:g461MYGXEXBVdV5SaR/5tNzNbSfwTBBefwc+LlDCK0Y=
github.com/pelletier/go-toml/v2 v2.2.3 h1:YmeHyLY8mFWbdkNWwpr+qIL2bEqT0o95WSdkNHvL12M=
github.com/pelletier/go-toml/v2 v2.2.3/go.mod h1:MfCQTFTvCcUyyvvwm1+G6H/jORL20Xlb6rzQu9GuUkc=
github.com/pjbgf/sha1cd v0.3.2 h1:a9wb0bp1oC2TGwStyn0Umc/IGKQnEgF0vVaZ8QF8eo4=
github.com/pjbgf/sha1cd v0.3.2/go.mod h1:zQWigSxVmsHEZow5qaLtPYxpcKMMQpa09ixqBxuCS6A=
github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/rivo/uniseg v0.1.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc=
github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc=
github.com/rivo/uniseg v0.4.7 h1:WUdvkW8uEhrYfLC4ZzdpI2ztxP1I582+49Oc5Mq64VQ=
github.com/rivo/uniseg v0.4.7/go.mod h1:FN3SvrM+Zdj16jyLfmOkMNblXMcoc8DfTHruCPUcx88=
github.com/rogpeppe/go-internal v1.14.1 h1:UQB4HGPB6osV0SQTLymcB4TgvyWu6ZyliaW0tI/otEQ=
github.com/rogpeppe/go-internal v1.14.1/go.mod h1:MaRKkUm5W0goXpeCfT7UZI6fk/L7L7so1lCWt35ZSgc=
github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
github.com/sagikazarmark/locafero v0.7.0 h1:5MqpDsTGNDhY8sGp0Aowyf0qKsPrhewaLSsFaodPcyo=
github.com/sagikazarmark/locafero v0.7.0/go.mod h1:2za3Cg5rMaTMoG/2Ulr9AwtFaIppKXTRYnozin4aB5k=
github.com/sebdah/goldie/v2 v2.5.3 h1:9ES/mNN+HNUbNWpVAlrzuZ7jE+Nrczbj8uFRjM7624Y=
github.com/sebdah/goldie/v2 v2.5.3/go.mod h1:oZ9fp0+se1eapSRjfYbsV/0Hqhbuu3bJVvKI/NNtssI=
github.com/sergi/go-diff v1.0.0/go.mod h1:0CfEIISq7TuYL3j771MWULgwwjU+GofnZX9QAmXWZgo=
github.com/sergi/go-diff v1.3.1/go.mod h1:aMJSSKb2lpPvRNec0+w3fl7LP9IOFzdc9Pa4NFbPK1I=
github.com/sergi/go-diff v1.3.2-0.20230802210424-5b0b94c5c0d3 h1:n661drycOFuPLCN3Uc8sB6B/s6Z4t2xvBgU1htSHuq8=
github.com/sergi/go-diff v1.3.2-0.20230802210424-5b0b94c5c0d3/go.mod h1:A0bzQcvG0E7Rwjx0REVgAGH58e96+X0MeOfepqsbeW4=
github.com/sirupsen/logrus v1.7.0/go.mod h1:yWOB1SBYBC5VeMP7gHvWumXLIWorT60ONWic61uBYv0=
github.com/skeema/knownhosts v1.3.1 h1:X2osQ+RAjK76shCbvhHHHVl3ZlgDm8apHEHFqRjnBY8=
github.com/skeema/knownhosts v1.3.1/go.mod h1:r7KTdC8l4uxWRyK2TpQZ/1o5HaSzh06ePQNxPwTcfiY=
github.com/sourcegraph/conc v0.3.0 h1:OQTbbt6P72L20UqAkXXuLOj79LfEanQ+YQFNpLA9ySo=
github.com/sourcegraph/conc v0.3.0/go.mod h1:Sdozi7LEKbFPqYX2/J+iBAM6HpqSLTASQIKqDmF7Mt0=
github.com/spf13/afero v1.12.0 h1:UcOPyRBYczmFn6yvphxkn9ZEOY65cpwGKb5mL36mrqs=
github.com/spf13/afero v1.12.0/go.mod h1:ZTlWwG4/ahT8W7T0WQ5uYmjI9duaLQGy3Q2OAl4sk/4=
github.com/spf13/cast v1.7.1 h1:cuNEagBQEHWN1FnbGEjCXL2szYEXqfJPbP2HNUaca9Y=
github.com/spf13/cast v1.7.1/go.mod h1:ancEpBxwJDODSW/UG4rDrAqiKolqNNh2DX3mk86cAdo=
github.com/spf13/cobra v1.9.1 h1:CXSaggrXdbHK9CF+8ywj8Amf7PBRmPCOJugH954Nnlo=
github.com/spf13/cobra v1.9.1/go.mod h1:nDyEzZ8ogv936Cinf6g1RU9MRY64Ir93oCnqb9wxYW0=
github.com/spf13/pflag v1.0.6 h1:jFzHGLGAlb3ruxLB8MhbI6A8+AQX/2eW4qeyNZXNp2o=
github.com/spf13/pflag v1.0.6/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg=
github.com/spf13/viper v1.20.0 h1:zrxIyR3RQIOsarIrgL8+sAvALXul9jeEPa06Y0Ph6vY=
github.com/spf13/viper v1.20.0/go.mod h1:P9Mdzt1zoHIG8m2eZQinpiBjo6kCmZSKBClNNqjJvu4=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4=
github.com/stretchr/testify v1.10.0 h1:Xv5erBjTwe/5IxqUQTdXv5kgmIvbHo3QQyRwhJsOfJA=
github.com/stretchr/testify v1.10.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
github.com/subosito/gotenv v1.6.0 h1:9NlTDc1FTs4qu0DDq7AEtTPNw6SVm7uBMsUCUjABIf8=
github.com/subosito/gotenv v1.6.0/go.mod h1:Dk4QP5c2W3ibzajGcXpNraDfq2IrhjMIvMSWPKKo0FU=
github.com/tidwall/gjson v1.14.2/go.mod h1:/wbyibRr2FHMks5tjHJ5F8dMZh3AcwJEMf5vlfC0lxk=
github.com/tidwall/gjson v1.18.0 h1:FIDeeyB800efLX89e5a8Y0BNH+LOngJyGrIWxG2FKQY=
github.com/tidwall/gjson v1.18.0/go.mod h1:/wbyibRr2FHMks5tjHJ5F8dMZh3AcwJEMf5vlfC0lxk=
github.com/tidwall/match v1.1.1 h1:+Ho715JplO36QYgwN9PGYNhgZvoUSc9X2c80KVTi+GA=
github.com/tidwall/match v1.1.1/go.mod h1:eRSPERbgtNPcGhD8UCthc6PmLEQXEWd3PRB5JTxsfmM=
github.com/tidwall/pretty v1.2.0/go.mod h1:ITEVvHYasfjBbM0u2Pg8T2nJnzm8xPwvNhhsoaGGjNU=
github.com/tidwall/pretty v1.2.1 h1:qjsOFOWWQl+N3RsoF5/ssm1pHmJJwhjlSbZ51I6wMl4=
github.com/tidwall/pretty v1.2.1/go.mod h1:ITEVvHYasfjBbM0u2Pg8T2nJnzm8xPwvNhhsoaGGjNU=
github.com/tidwall/sjson v1.2.5 h1:kLy8mja+1c9jlljvWTlSazM7cKDRfJuR/bOJhcY5NcY=
github.com/tidwall/sjson v1.2.5/go.mod h1:Fvgq9kS/6ociJEDnK0Fk1cpYF4FIW6ZF7LAe+6jwd28=
github.com/xanzy/ssh-agent v0.3.3 h1:+/15pJfg/RsTxqYcX6fHqOXZwwMP+2VyYWJeWM2qQFM=
github.com/xanzy/ssh-agent v0.3.3/go.mod h1:6dzNDKs0J9rVPHPhaGCukekBHKqfl+L3KghI1Bc68Uw=
github.com/xo/terminfo v0.0.0-20220910002029-abceb7e1c41e h1:JVG44RsyaB9T2KIHavMF/ppJZNG9ZpyihvCd0w101no=
github.com/xo/terminfo v0.0.0-20220910002029-abceb7e1c41e/go.mod h1:RbqR21r5mrJuqunuUZ/Dhy/avygyECGrLceyNeo4LiM=
github.com/yosida95/uritemplate/v3 v3.0.2 h1:Ed3Oyj9yrmi9087+NczuL5BwkIc4wvTb5zIM+UJPGz4=
github.com/yosida95/uritemplate/v3 v3.0.2/go.mod h1:ILOh0sOhIJR3+L/8afwt/kE++YT040gmv5BQTMR2HP4=
github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY=
github.com/yuin/goldmark v1.7.1/go.mod h1:uzxRWxtg69N339t3louHJ7+O03ezfj6PlliRlaOzY1E=
github.com/yuin/goldmark v1.7.8 h1:iERMLn0/QJeHFhxSt3p6PeN9mGnvIKSpG9YYorDMnic=
github.com/yuin/goldmark v1.7.8/go.mod h1:uzxRWxtg69N339t3louHJ7+O03ezfj6PlliRlaOzY1E=
github.com/yuin/goldmark-emoji v1.0.5 h1:EMVWyCGPlXJfUXBXpuMu+ii3TIaxbVBnEX9uaDC4cIk=
github.com/yuin/goldmark-emoji v1.0.5/go.mod h1:tTkZEbwu5wkPmgTcitqddVxY9osFZiavD+r4AzQrh1U=
go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.54.0 h1:r6I7RJCN86bpD/FQwedZ0vSixDpwuWREjW9oRMsmqDc=
go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.54.0/go.mod h1:B9yO6b04uB80CzjedvewuqDhxJxi11s7/GtiGa8bAjI=
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.54.0 h1:TT4fX+nBOA/+LUkobKGW1ydGcn+G3vRw9+g5HwCphpk=
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.54.0/go.mod h1:L7UH0GbB0p47T4Rri3uHjbpCFYrVrwc1I25QhNPiGK8=
go.opentelemetry.io/otel v1.29.0 h1:PdomN/Al4q/lN6iBJEN3AwPvUiHPMlt93c8bqTG5Llw=
go.opentelemetry.io/otel v1.29.0/go.mod h1:N/WtXPs1CNCUEx+Agz5uouwCba+i+bJGFicT8SR4NP8=
go.opentelemetry.io/otel/metric v1.29.0 h1:vPf/HFWTNkPu1aYeIsc98l4ktOQaL6LeSoeV2g+8YLc=
go.opentelemetry.io/otel/metric v1.29.0/go.mod h1:auu/QWieFVWx+DmQOUMgj0F8LHWdgalxXqvp7BII/W8=
go.opentelemetry.io/otel/trace v1.29.0 h1:J/8ZNK4XgR7a21DZUAsbF8pZ5Jcw1VhACmnYt39JTi4=
go.opentelemetry.io/otel/trace v1.29.0/go.mod h1:eHl3w0sp3paPkYstJOmAimxhiFXPg+MMTlEh3nsQgWQ=
go.uber.org/atomic v1.9.0 h1:ECmE8Bn/WFTYwEW/bpKD3M8VtR/zQVbavAoalC1PYyE=
go.uber.org/atomic v1.9.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc=
go.uber.org/multierr v1.9.0 h1:7fIwc/ZtS0q++VgcfqFDxSBZVv/Xo49/SYnDFupUwlI=
go.uber.org/multierr v1.9.0/go.mod h1:X2jQV1h+kxSjClGpnseKVIxpmcjrj7MNnI0bnlfKTVQ=
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
golang.org/x/crypto v0.0.0-20220622213112-05595931fe9d/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4=
golang.org/x/crypto v0.19.0/go.mod h1:Iy9bg/ha4yyC70EfRS8jz+B6ybOBKMaSxLj6P6oBDfU=
golang.org/x/crypto v0.22.0/go.mod h1:vr6Su+7cTlO45qkww3VDJlzDn0ctJvRgYbC2NvXHt+M=
golang.org/x/crypto v0.23.0/go.mod h1:CKFgDieR+mRhux2Lsu27y0fO304Db0wZe70UKqHu0v8=
golang.org/x/crypto v0.37.0 h1:kJNSjF/Xp7kU0iB2Z+9viTPMW4EqqsrywMXLJOOsXSE=
golang.org/x/crypto v0.37.0/go.mod h1:vg+k43peMZ0pUMhYmVAWysMK35e6ioLh3wB8ZCAfbVc=
golang.org/x/exp v0.0.0-20240719175910-8a7402abbf56 h1:2dVuKD2vS7b0QIHQbpyTISPd0LeHDbnYEryqj5Q1ug8=
golang.org/x/exp v0.0.0-20240719175910-8a7402abbf56/go.mod h1:M4RDyNAINzryxdtnbRXRL/OHtkFuWGRjvuhBJpk2IlY=
golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4=
golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs=
golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c=
golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs=
golang.org/x/net v0.9.0/go.mod h1:d48xBJpPfHeWQsugry2m+kC02ZBRGRgulfHnEXEuWns=
golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg=
golang.org/x/net v0.21.0/go.mod h1:bIjVDfnllIU7BJ2DNgfnXvpSvtn8VRwhlsaeUTyUS44=
golang.org/x/net v0.24.0/go.mod h1:2Q7sJY5mzlzWjKtYUEXSlBWCdyaioyXzRB2RtU8KVE8=
golang.org/x/net v0.25.0/go.mod h1:JkAGAh7GEvH74S6FOH42FLoXpXbE/aqXSrIQjXgsiwM=
golang.org/x/net v0.39.0 h1:ZCu7HMWDxpXpaiKdhzIfaltL9Lp31x/3fCP11bc6/fY=
golang.org/x/net v0.39.0/go.mod h1:X7NRbYVEA+ewNkCNyJ513WmMdQ3BineSwVtN2zD/d+E=
golang.org/x/oauth2 v0.25.0 h1:CY4y7XT9v0cRI9oupztF8AgiIu99L/ksR/Xp/6jrZ70=
golang.org/x/oauth2 v0.25.0/go.mod h1:XYTD2NtWslqkgxebSiOHnXEap4TF09sJSc7H1sXbhtI=
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.13.0 h1:AauUjRAJ9OSnvULf/ARrrVywoJDy0YS2AwQ98I37610=
golang.org/x/sync v0.13.0/go.mod h1:1dzgHSNfp02xaA81J2MS99Qcpr2w7fw1gpm99rleRqA=
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20191026070338-33540a1f6037/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210124154548-22da62e12c0c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20210809222454-d867a43fc93e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.7.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.17.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/sys v0.19.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/sys v0.20.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/sys v0.32.0 h1:s77OFDvIQeibCmezSnk/q6iAfkdiQaJi4VzroCFrN20=
golang.org/x/sys v0.32.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k=
golang.org/x/term v0.7.0/go.mod h1:P32HKFT3hSsZrRxla30E9HqToFYAQPCMs/zFMBUFqPY=
golang.org/x/term v0.8.0/go.mod h1:xPskH00ivmX89bAKVGSKKtLOWNx2+17Eiy94tnKShWo=
golang.org/x/term v0.17.0/go.mod h1:lLRBjIVuehSbZlaOtGMbcMncT+aqLLLmKrsjNrUguwk=
golang.org/x/term v0.19.0/go.mod h1:2CuTdWZ7KHSQwUzKva0cbMg6q2DMI3Mmxp+gKJbskEk=
golang.org/x/term v0.20.0/go.mod h1:8UkIAJTvZgivsXaD6/pH6U9ecQzZ45awqEOzuCvwpFY=
golang.org/x/term v0.31.0 h1:erwDkOK1Msy6offm1mOgvspSkslFnIGsFnxOKoufg3o=
golang.org/x/term v0.31.0/go.mod h1:R4BeIy7D95HzImkxGkTW1UQTtP54tio2RyHz7PwK0aw=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ=
golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8=
golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8=
golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU=
golang.org/x/text v0.15.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU=
golang.org/x/text v0.24.0 h1:dd5Bzh4yt5KYA8f9CJHCP4FB4D51c2c6JvN37xJJkJ0=
golang.org/x/text v0.24.0/go.mod h1:L8rBsPeo2pSS+xqN0d5u2ikmjtmoJbDBT1b7nHvFCdU=
golang.org/x/time v0.8.0 h1:9i3RxcPv3PZnitoVGMPDKZSq1xW1gK1Xy3ArNOGZfEg=
golang.org/x/time v0.8.0/go.mod h1:3BpzKBy/shNhVucY/MWOyx10tF3SFh9QdLuxbVysPQM=
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc=
golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU=
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
google.golang.org/api v0.215.0 h1:jdYF4qnyczlEz2ReWIsosNLDuzXyvFHJtI5gcr0J7t0=
google.golang.org/api v0.215.0/go.mod h1:fta3CVtuJYOEdugLNWm6WodzOS8KdFckABwN4I40hzY=
google.golang.org/genproto/googleapis/api v0.0.0-20241209162323-e6fa225c2576 h1:CkkIfIt50+lT6NHAVoRYEyAvQGFM7xEwXUUywFvEb3Q=
google.golang.org/genproto/googleapis/api v0.0.0-20241209162323-e6fa225c2576/go.mod h1:1R3kvZ1dtP3+4p4d3G8uJ8rFk/fWlScl38vanWACI08=
google.golang.org/genproto/googleapis/rpc v0.0.0-20241223144023-3abc09e42ca8 h1:TqExAhdPaB60Ux47Cn0oLV07rGnxZzIsaRhQaqS666A=
google.golang.org/genproto/googleapis/rpc v0.0.0-20241223144023-3abc09e42ca8/go.mod h1:lcTa1sDdWEIHMWlITnIczmw5w60CF9ffkb8Z+DVmmjA=
google.golang.org/grpc v1.67.3 h1:OgPcDAFKHnH8X3O4WcO4XUc8GRDeKsKReqbQtiCj7N8=
google.golang.org/grpc v1.67.3/go.mod h1:YGaHCc6Oap+FzBJTZLBzkGSYt/cvGPFTPxkn7QfSU8s=
google.golang.org/protobuf v1.36.1 h1:yBPeRvTftaleIgM3PZ/WBIZ7XM/eEYAaEyCwvyjq/gk=
google.golang.org/protobuf v1.36.1/go.mod h1:9fA7Ob0pmnwhb644+1+CVWFRbNajQ6iRojtC/QF5bRE=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk=
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q=
gopkg.in/warnings.v0 v0.1.2 h1:wFXVbFY8DY5/xOe1ECiWdKCzZlxgshcYVNkBHstARME=
gopkg.in/warnings.v0 v0.1.2/go.mod h1:jksf8JmL6Qr/oQM2OXTHunEvvTAsrWBLb6OOjuVWRNI=
gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY=
gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ=
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
-44
View File
@@ -1,44 +0,0 @@
export const domain = (() => {
if ($app.stage === "production") return "opencode.ai"
if ($app.stage === "dev") return "dev.opencode.ai"
return `${$app.stage}.dev.opencode.ai`
})()
const bucket = new sst.cloudflare.Bucket("Bucket")
export const api = new sst.cloudflare.Worker("Api", {
domain: `api.${domain}`,
handler: "packages/function/src/api.ts",
url: true,
link: [bucket],
transform: {
worker: (args) => {
args.logpush = true
args.bindings = $resolve(args.bindings).apply((bindings) => [
...bindings,
{
name: "SYNC_SERVER",
type: "durable_object_namespace",
className: "SyncServer",
},
])
args.migrations = {
oldTag: "v1",
newTag: "v1",
//newSqliteClasses: ["SyncServer"],
}
},
},
})
new sst.cloudflare.StaticSite("Web", {
path: "packages/web",
domain,
environment: {
VITE_API_URL: api.url,
},
build: {
command: "bun run build",
output: "dist",
},
})
+3 -3
View File
@@ -40,15 +40,15 @@ INSTALL_DIR=$HOME/.opencode/bin
mkdir -p "$INSTALL_DIR"
if [ -z "$requested_version" ]; then
url="https://github.com/sst/opencode/releases/latest/download/$filename"
specific_version=$(curl -s https://api.github.com/repos/sst/opencode/releases/latest | awk -F'"' '/"tag_name": "/ {gsub(/^v/, "", $4); print $4}')
url="https://github.com/opencode-ai/opencode/releases/latest/download/$filename"
specific_version=$(curl -s https://api.github.com/repos/opencode-ai/opencode/releases/latest | awk -F'"' '/"tag_name": "/ {gsub(/^v/, "", $4); print $4}')
if [[ $? -ne 0 ]]; then
echo "${RED}Failed to fetch version information${NC}"
exit 1
fi
else
url="https://github.com/sst/opencode/releases/download/v${requested_version}/$filename"
url="https://github.com/opencode-ai/opencode/releases/download/v${requested_version}/$filename"
specific_version=$requested_version
fi
+99
View File
@@ -0,0 +1,99 @@
package app
import (
"context"
"database/sql"
"maps"
"sync"
"time"
"github.com/kujtimiihoxha/opencode/internal/config"
"github.com/kujtimiihoxha/opencode/internal/db"
"github.com/kujtimiihoxha/opencode/internal/history"
"github.com/kujtimiihoxha/opencode/internal/llm/agent"
"github.com/kujtimiihoxha/opencode/internal/logging"
"github.com/kujtimiihoxha/opencode/internal/lsp"
"github.com/kujtimiihoxha/opencode/internal/message"
"github.com/kujtimiihoxha/opencode/internal/permission"
"github.com/kujtimiihoxha/opencode/internal/session"
)
type App struct {
Sessions session.Service
Messages message.Service
History history.Service
Permissions permission.Service
CoderAgent agent.Service
LSPClients map[string]*lsp.Client
clientsMutex sync.RWMutex
watcherCancelFuncs []context.CancelFunc
cancelFuncsMutex sync.Mutex
watcherWG sync.WaitGroup
}
func New(ctx context.Context, conn *sql.DB) (*App, error) {
q := db.New(conn)
sessions := session.NewService(q)
messages := message.NewService(q)
files := history.NewService(q, conn)
app := &App{
Sessions: sessions,
Messages: messages,
History: files,
Permissions: permission.NewPermissionService(),
LSPClients: make(map[string]*lsp.Client),
}
// Initialize LSP clients in the background
go app.initLSPClients(ctx)
var err error
app.CoderAgent, err = agent.NewAgent(
config.AgentCoder,
app.Sessions,
app.Messages,
agent.CoderAgentTools(
app.Permissions,
app.Sessions,
app.Messages,
app.History,
app.LSPClients,
),
)
if err != nil {
logging.Error("Failed to create coder agent", err)
return nil, err
}
return app, nil
}
// Shutdown performs a clean shutdown of the application
func (app *App) Shutdown() {
// Cancel all watcher goroutines
app.cancelFuncsMutex.Lock()
for _, cancel := range app.watcherCancelFuncs {
cancel()
}
app.cancelFuncsMutex.Unlock()
app.watcherWG.Wait()
// Perform additional cleanup for LSP clients
app.clientsMutex.RLock()
clients := make(map[string]*lsp.Client, len(app.LSPClients))
maps.Copy(clients, app.LSPClients)
app.clientsMutex.RUnlock()
for name, client := range clients {
shutdownCtx, cancel := context.WithTimeout(context.Background(), 5*time.Second)
if err := client.Shutdown(shutdownCtx); err != nil {
logging.Error("Failed to shutdown LSP client", "name", name, "error", err)
}
cancel()
}
}
+126
View File
@@ -0,0 +1,126 @@
package app
import (
"context"
"time"
"github.com/kujtimiihoxha/opencode/internal/config"
"github.com/kujtimiihoxha/opencode/internal/logging"
"github.com/kujtimiihoxha/opencode/internal/lsp"
"github.com/kujtimiihoxha/opencode/internal/lsp/watcher"
)
func (app *App) initLSPClients(ctx context.Context) {
cfg := config.Get()
// Initialize LSP clients
for name, clientConfig := range cfg.LSP {
// Start each client initialization in its own goroutine
go app.createAndStartLSPClient(ctx, name, clientConfig.Command, clientConfig.Args...)
}
logging.Info("LSP clients initialization started in background")
}
// createAndStartLSPClient creates a new LSP client, initializes it, and starts its workspace watcher
func (app *App) createAndStartLSPClient(ctx context.Context, name string, command string, args ...string) {
// Create a specific context for initialization with a timeout
logging.Info("Creating LSP client", "name", name, "command", command, "args", args)
// Create the LSP client
lspClient, err := lsp.NewClient(ctx, command, args...)
if err != nil {
logging.Error("Failed to create LSP client for", name, err)
return
}
// Create a longer timeout for initialization (some servers take time to start)
initCtx, cancel := context.WithTimeout(ctx, 30*time.Second)
defer cancel()
// Initialize with the initialization context
_, err = lspClient.InitializeLSPClient(initCtx, config.WorkingDirectory())
if err != nil {
logging.Error("Initialize failed", "name", name, "error", err)
// Clean up the client to prevent resource leaks
lspClient.Close()
return
}
// Wait for the server to be ready
if err := lspClient.WaitForServerReady(initCtx); err != nil {
logging.Error("Server failed to become ready", "name", name, "error", err)
// We'll continue anyway, as some functionality might still work
lspClient.SetServerState(lsp.StateError)
} else {
logging.Info("LSP server is ready", "name", name)
lspClient.SetServerState(lsp.StateReady)
}
logging.Info("LSP client initialized", "name", name)
// Create a child context that can be canceled when the app is shutting down
watchCtx, cancelFunc := context.WithCancel(ctx)
// Create a context with the server name for better identification
watchCtx = context.WithValue(watchCtx, "serverName", name)
// Create the workspace watcher
workspaceWatcher := watcher.NewWorkspaceWatcher(lspClient)
// Store the cancel function to be called during cleanup
app.cancelFuncsMutex.Lock()
app.watcherCancelFuncs = append(app.watcherCancelFuncs, cancelFunc)
app.cancelFuncsMutex.Unlock()
// Add the watcher to a WaitGroup to track active goroutines
app.watcherWG.Add(1)
// Add to map with mutex protection before starting goroutine
app.clientsMutex.Lock()
app.LSPClients[name] = lspClient
app.clientsMutex.Unlock()
go app.runWorkspaceWatcher(watchCtx, name, workspaceWatcher)
}
// runWorkspaceWatcher executes the workspace watcher for an LSP client
func (app *App) runWorkspaceWatcher(ctx context.Context, name string, workspaceWatcher *watcher.WorkspaceWatcher) {
defer app.watcherWG.Done()
defer logging.RecoverPanic("LSP-"+name, func() {
// Try to restart the client
app.restartLSPClient(ctx, name)
})
workspaceWatcher.WatchWorkspace(ctx, config.WorkingDirectory())
logging.Info("Workspace watcher stopped", "client", name)
}
// restartLSPClient attempts to restart a crashed or failed LSP client
func (app *App) restartLSPClient(ctx context.Context, name string) {
// Get the original configuration
cfg := config.Get()
clientConfig, exists := cfg.LSP[name]
if !exists {
logging.Error("Cannot restart client, configuration not found", "client", name)
return
}
// Clean up the old client if it exists
app.clientsMutex.Lock()
oldClient, exists := app.LSPClients[name]
if exists {
delete(app.LSPClients, name) // Remove from map before potentially slow shutdown
}
app.clientsMutex.Unlock()
if exists && oldClient != nil {
// Try to shut it down gracefully, but don't block on errors
shutdownCtx, cancel := context.WithTimeout(context.Background(), 5*time.Second)
_ = oldClient.Shutdown(shutdownCtx)
cancel()
}
// Create a new client using the shared function
app.createAndStartLSPClient(ctx, name, clientConfig.Command, clientConfig.Args...)
logging.Info("Successfully restarted LSP client", "client", name)
}
+594
View File
@@ -0,0 +1,594 @@
// Package config manages application configuration from various sources.
package config
import (
"fmt"
"log/slog"
"os"
"strings"
"github.com/kujtimiihoxha/opencode/internal/llm/models"
"github.com/kujtimiihoxha/opencode/internal/logging"
"github.com/spf13/viper"
)
// MCPType defines the type of MCP (Model Control Protocol) server.
type MCPType string
// Supported MCP types
const (
MCPStdio MCPType = "stdio"
MCPSse MCPType = "sse"
)
// MCPServer defines the configuration for a Model Control Protocol server.
type MCPServer struct {
Command string `json:"command"`
Env []string `json:"env"`
Args []string `json:"args"`
Type MCPType `json:"type"`
URL string `json:"url"`
Headers map[string]string `json:"headers"`
}
type AgentName string
const (
AgentCoder AgentName = "coder"
AgentTask AgentName = "task"
AgentTitle AgentName = "title"
)
// Agent defines configuration for different LLM models and their token limits.
type Agent struct {
Model models.ModelID `json:"model"`
MaxTokens int64 `json:"maxTokens"`
ReasoningEffort string `json:"reasoningEffort"` // For openai models low,medium,heigh
}
// Provider defines configuration for an LLM provider.
type Provider struct {
APIKey string `json:"apiKey"`
Disabled bool `json:"disabled"`
}
// Data defines storage configuration.
type Data struct {
Directory string `json:"directory"`
}
// LSPConfig defines configuration for Language Server Protocol integration.
type LSPConfig struct {
Disabled bool `json:"enabled"`
Command string `json:"command"`
Args []string `json:"args"`
Options any `json:"options"`
}
// Config is the main configuration structure for the application.
type Config struct {
Data Data `json:"data"`
WorkingDir string `json:"wd,omitempty"`
MCPServers map[string]MCPServer `json:"mcpServers,omitempty"`
Providers map[models.ModelProvider]Provider `json:"providers,omitempty"`
LSP map[string]LSPConfig `json:"lsp,omitempty"`
Agents map[AgentName]Agent `json:"agents"`
Debug bool `json:"debug,omitempty"`
DebugLSP bool `json:"debugLSP,omitempty"`
}
// Application constants
const (
defaultDataDirectory = ".opencode"
defaultLogLevel = "info"
appName = "opencode"
)
// Global configuration instance
var cfg *Config
// Load initializes the configuration from environment variables and config files.
// If debug is true, debug mode is enabled and log level is set to debug.
// It returns an error if configuration loading fails.
func Load(workingDir string, debug bool) (*Config, error) {
if cfg != nil {
return cfg, nil
}
cfg = &Config{
WorkingDir: workingDir,
MCPServers: make(map[string]MCPServer),
Providers: make(map[models.ModelProvider]Provider),
LSP: make(map[string]LSPConfig),
}
configureViper()
setDefaults(debug)
setProviderDefaults()
// Read global config
if err := readConfig(viper.ReadInConfig()); err != nil {
return cfg, err
}
// Load and merge local config
mergeLocalConfig(workingDir)
// Apply configuration to the struct
if err := viper.Unmarshal(cfg); err != nil {
return cfg, fmt.Errorf("failed to unmarshal config: %w", err)
}
applyDefaultValues()
defaultLevel := slog.LevelInfo
if cfg.Debug {
defaultLevel = slog.LevelDebug
}
if os.Getenv("OPENCODE_DEV_DEBUG") == "true" {
loggingFile := fmt.Sprintf("%s/%s", cfg.Data.Directory, "debug.log")
// if file does not exist create it
if _, err := os.Stat(loggingFile); os.IsNotExist(err) {
if err := os.MkdirAll(cfg.Data.Directory, 0o755); err != nil {
return cfg, fmt.Errorf("failed to create directory: %w", err)
}
if _, err := os.Create(loggingFile); err != nil {
return cfg, fmt.Errorf("failed to create log file: %w", err)
}
}
sloggingFileWriter, err := os.OpenFile(loggingFile, os.O_CREATE|os.O_WRONLY|os.O_APPEND, 0o666)
if err != nil {
return cfg, fmt.Errorf("failed to open log file: %w", err)
}
// Configure logger
logger := slog.New(slog.NewTextHandler(sloggingFileWriter, &slog.HandlerOptions{
Level: defaultLevel,
}))
slog.SetDefault(logger)
} else {
// Configure logger
logger := slog.New(slog.NewTextHandler(logging.NewWriter(), &slog.HandlerOptions{
Level: defaultLevel,
}))
slog.SetDefault(logger)
}
// Validate configuration
if err := Validate(); err != nil {
return cfg, fmt.Errorf("config validation failed: %w", err)
}
if cfg.Agents == nil {
cfg.Agents = make(map[AgentName]Agent)
}
// Override the max tokens for title agent
cfg.Agents[AgentTitle] = Agent{
Model: cfg.Agents[AgentTitle].Model,
MaxTokens: 80,
}
return cfg, nil
}
// configureViper sets up viper's configuration paths and environment variables.
func configureViper() {
viper.SetConfigName(fmt.Sprintf(".%s", appName))
viper.SetConfigType("json")
viper.AddConfigPath("$HOME")
viper.AddConfigPath(fmt.Sprintf("$XDG_CONFIG_HOME/%s", appName))
viper.AddConfigPath(fmt.Sprintf("$HOME/.config/%s", appName))
viper.SetEnvPrefix(strings.ToUpper(appName))
viper.AutomaticEnv()
}
// setDefaults configures default values for configuration options.
func setDefaults(debug bool) {
viper.SetDefault("data.directory", defaultDataDirectory)
if debug {
viper.SetDefault("debug", true)
viper.Set("log.level", "debug")
} else {
viper.SetDefault("debug", false)
viper.SetDefault("log.level", defaultLogLevel)
}
}
// setProviderDefaults configures LLM provider defaults based on environment variables.
// the default model priority is:
// 1. Anthropic
// 2. OpenAI
// 3. Google Gemini
// 4. Groq
// 5. AWS Bedrock
func setProviderDefaults() {
// Anthropic configuration
if apiKey := os.Getenv("ANTHROPIC_API_KEY"); apiKey != "" {
viper.SetDefault("providers.anthropic.apiKey", apiKey)
viper.SetDefault("agents.coder.model", models.Claude37Sonnet)
viper.SetDefault("agents.task.model", models.Claude37Sonnet)
viper.SetDefault("agents.title.model", models.Claude37Sonnet)
return
}
// OpenAI configuration
if apiKey := os.Getenv("OPENAI_API_KEY"); apiKey != "" {
viper.SetDefault("providers.openai.apiKey", apiKey)
viper.SetDefault("agents.coder.model", models.GPT41)
viper.SetDefault("agents.task.model", models.GPT41Mini)
viper.SetDefault("agents.title.model", models.GPT41Mini)
return
}
// Google Gemini configuration
if apiKey := os.Getenv("GEMINI_API_KEY"); apiKey != "" {
viper.SetDefault("providers.gemini.apiKey", apiKey)
viper.SetDefault("agents.coder.model", models.Gemini25)
viper.SetDefault("agents.task.model", models.Gemini25Flash)
viper.SetDefault("agents.title.model", models.Gemini25Flash)
return
}
// Groq configuration
if apiKey := os.Getenv("GROQ_API_KEY"); apiKey != "" {
viper.SetDefault("providers.groq.apiKey", apiKey)
viper.SetDefault("agents.coder.model", models.QWENQwq)
viper.SetDefault("agents.task.model", models.QWENQwq)
viper.SetDefault("agents.title.model", models.QWENQwq)
return
}
// AWS Bedrock configuration
if hasAWSCredentials() {
viper.SetDefault("agents.coder.model", models.BedrockClaude37Sonnet)
viper.SetDefault("agents.task.model", models.BedrockClaude37Sonnet)
viper.SetDefault("agents.title.model", models.BedrockClaude37Sonnet)
return
}
}
// hasAWSCredentials checks if AWS credentials are available in the environment.
func hasAWSCredentials() bool {
// Check for explicit AWS credentials
if os.Getenv("AWS_ACCESS_KEY_ID") != "" && os.Getenv("AWS_SECRET_ACCESS_KEY") != "" {
return true
}
// Check for AWS profile
if os.Getenv("AWS_PROFILE") != "" || os.Getenv("AWS_DEFAULT_PROFILE") != "" {
return true
}
// Check for AWS region
if os.Getenv("AWS_REGION") != "" || os.Getenv("AWS_DEFAULT_REGION") != "" {
return true
}
// Check if running on EC2 with instance profile
if os.Getenv("AWS_CONTAINER_CREDENTIALS_RELATIVE_URI") != "" ||
os.Getenv("AWS_CONTAINER_CREDENTIALS_FULL_URI") != "" {
return true
}
return false
}
// readConfig handles the result of reading a configuration file.
func readConfig(err error) error {
if err == nil {
return nil
}
// It's okay if the config file doesn't exist
if _, ok := err.(viper.ConfigFileNotFoundError); ok {
return nil
}
return fmt.Errorf("failed to read config: %w", err)
}
// mergeLocalConfig loads and merges configuration from the local directory.
func mergeLocalConfig(workingDir string) {
local := viper.New()
local.SetConfigName(fmt.Sprintf(".%s", appName))
local.SetConfigType("json")
local.AddConfigPath(workingDir)
// Merge local config if it exists
if err := local.ReadInConfig(); err == nil {
viper.MergeConfigMap(local.AllSettings())
}
}
// applyDefaultValues sets default values for configuration fields that need processing.
func applyDefaultValues() {
// Set default MCP type if not specified
for k, v := range cfg.MCPServers {
if v.Type == "" {
v.Type = MCPStdio
cfg.MCPServers[k] = v
}
}
}
// Validate checks if the configuration is valid and applies defaults where needed.
// It validates model IDs and providers, ensuring they are supported.
func Validate() error {
if cfg == nil {
return fmt.Errorf("config not loaded")
}
// Validate agent models
for name, agent := range cfg.Agents {
// Check if model exists
model, modelExists := models.SupportedModels[agent.Model]
if !modelExists {
logging.Warn("unsupported model configured, reverting to default",
"agent", name,
"configured_model", agent.Model)
// Set default model based on available providers
if setDefaultModelForAgent(name) {
logging.Info("set default model for agent", "agent", name, "model", cfg.Agents[name].Model)
} else {
return fmt.Errorf("no valid provider available for agent %s", name)
}
continue
}
// Check if provider for the model is configured
provider := model.Provider
providerCfg, providerExists := cfg.Providers[provider]
if !providerExists {
// Provider not configured, check if we have environment variables
apiKey := getProviderAPIKey(provider)
if apiKey == "" {
logging.Warn("provider not configured for model, reverting to default",
"agent", name,
"model", agent.Model,
"provider", provider)
// Set default model based on available providers
if setDefaultModelForAgent(name) {
logging.Info("set default model for agent", "agent", name, "model", cfg.Agents[name].Model)
} else {
return fmt.Errorf("no valid provider available for agent %s", name)
}
} else {
// Add provider with API key from environment
cfg.Providers[provider] = Provider{
APIKey: apiKey,
}
logging.Info("added provider from environment", "provider", provider)
}
} else if providerCfg.Disabled || providerCfg.APIKey == "" {
// Provider is disabled or has no API key
logging.Warn("provider is disabled or has no API key, reverting to default",
"agent", name,
"model", agent.Model,
"provider", provider)
// Set default model based on available providers
if setDefaultModelForAgent(name) {
logging.Info("set default model for agent", "agent", name, "model", cfg.Agents[name].Model)
} else {
return fmt.Errorf("no valid provider available for agent %s", name)
}
}
// Validate max tokens
if agent.MaxTokens <= 0 {
logging.Warn("invalid max tokens, setting to default",
"agent", name,
"model", agent.Model,
"max_tokens", agent.MaxTokens)
// Update the agent with default max tokens
updatedAgent := cfg.Agents[name]
if model.DefaultMaxTokens > 0 {
updatedAgent.MaxTokens = model.DefaultMaxTokens
} else {
updatedAgent.MaxTokens = 4096 // Fallback default
}
cfg.Agents[name] = updatedAgent
} else if model.ContextWindow > 0 && agent.MaxTokens > model.ContextWindow/2 {
// Ensure max tokens doesn't exceed half the context window (reasonable limit)
logging.Warn("max tokens exceeds half the context window, adjusting",
"agent", name,
"model", agent.Model,
"max_tokens", agent.MaxTokens,
"context_window", model.ContextWindow)
// Update the agent with adjusted max tokens
updatedAgent := cfg.Agents[name]
updatedAgent.MaxTokens = model.ContextWindow / 2
cfg.Agents[name] = updatedAgent
}
// Validate reasoning effort for models that support reasoning
if model.CanReason && provider == models.ProviderOpenAI {
if agent.ReasoningEffort == "" {
// Set default reasoning effort for models that support it
logging.Info("setting default reasoning effort for model that supports reasoning",
"agent", name,
"model", agent.Model)
// Update the agent with default reasoning effort
updatedAgent := cfg.Agents[name]
updatedAgent.ReasoningEffort = "medium"
cfg.Agents[name] = updatedAgent
} else {
// Check if reasoning effort is valid (low, medium, high)
effort := strings.ToLower(agent.ReasoningEffort)
if effort != "low" && effort != "medium" && effort != "high" {
logging.Warn("invalid reasoning effort, setting to medium",
"agent", name,
"model", agent.Model,
"reasoning_effort", agent.ReasoningEffort)
// Update the agent with valid reasoning effort
updatedAgent := cfg.Agents[name]
updatedAgent.ReasoningEffort = "medium"
cfg.Agents[name] = updatedAgent
}
}
} else if !model.CanReason && agent.ReasoningEffort != "" {
// Model doesn't support reasoning but reasoning effort is set
logging.Warn("model doesn't support reasoning but reasoning effort is set, ignoring",
"agent", name,
"model", agent.Model,
"reasoning_effort", agent.ReasoningEffort)
// Update the agent to remove reasoning effort
updatedAgent := cfg.Agents[name]
updatedAgent.ReasoningEffort = ""
cfg.Agents[name] = updatedAgent
}
}
// Validate providers
for provider, providerCfg := range cfg.Providers {
if providerCfg.APIKey == "" && !providerCfg.Disabled {
logging.Warn("provider has no API key, marking as disabled", "provider", provider)
providerCfg.Disabled = true
cfg.Providers[provider] = providerCfg
}
}
// Validate LSP configurations
for language, lspConfig := range cfg.LSP {
if lspConfig.Command == "" && !lspConfig.Disabled {
logging.Warn("LSP configuration has no command, marking as disabled", "language", language)
lspConfig.Disabled = true
cfg.LSP[language] = lspConfig
}
}
return nil
}
// getProviderAPIKey gets the API key for a provider from environment variables
func getProviderAPIKey(provider models.ModelProvider) string {
switch provider {
case models.ProviderAnthropic:
return os.Getenv("ANTHROPIC_API_KEY")
case models.ProviderOpenAI:
return os.Getenv("OPENAI_API_KEY")
case models.ProviderGemini:
return os.Getenv("GEMINI_API_KEY")
case models.ProviderGROQ:
return os.Getenv("GROQ_API_KEY")
case models.ProviderBedrock:
if hasAWSCredentials() {
return "aws-credentials-available"
}
}
return ""
}
// setDefaultModelForAgent sets a default model for an agent based on available providers
func setDefaultModelForAgent(agent AgentName) bool {
// Check providers in order of preference
if apiKey := os.Getenv("ANTHROPIC_API_KEY"); apiKey != "" {
maxTokens := int64(5000)
if agent == AgentTitle {
maxTokens = 80
}
cfg.Agents[agent] = Agent{
Model: models.Claude37Sonnet,
MaxTokens: maxTokens,
}
return true
}
if apiKey := os.Getenv("OPENAI_API_KEY"); apiKey != "" {
var model models.ModelID
maxTokens := int64(5000)
reasoningEffort := ""
switch agent {
case AgentTitle:
model = models.GPT41Mini
maxTokens = 80
case AgentTask:
model = models.GPT41Mini
default:
model = models.GPT41
}
// Check if model supports reasoning
if modelInfo, ok := models.SupportedModels[model]; ok && modelInfo.CanReason {
reasoningEffort = "medium"
}
cfg.Agents[agent] = Agent{
Model: model,
MaxTokens: maxTokens,
ReasoningEffort: reasoningEffort,
}
return true
}
if apiKey := os.Getenv("GEMINI_API_KEY"); apiKey != "" {
var model models.ModelID
maxTokens := int64(5000)
if agent == AgentTitle {
model = models.Gemini25Flash
maxTokens = 80
} else {
model = models.Gemini25
}
cfg.Agents[agent] = Agent{
Model: model,
MaxTokens: maxTokens,
}
return true
}
if apiKey := os.Getenv("GROQ_API_KEY"); apiKey != "" {
maxTokens := int64(5000)
if agent == AgentTitle {
maxTokens = 80
}
cfg.Agents[agent] = Agent{
Model: models.QWENQwq,
MaxTokens: maxTokens,
}
return true
}
if hasAWSCredentials() {
maxTokens := int64(5000)
if agent == AgentTitle {
maxTokens = 80
}
cfg.Agents[agent] = Agent{
Model: models.BedrockClaude37Sonnet,
MaxTokens: maxTokens,
ReasoningEffort: "medium", // Claude models support reasoning
}
return true
}
return false
}
// Get returns the current configuration.
// It's safe to call this function multiple times.
func Get() *Config {
return cfg
}
// WorkingDirectory returns the current working directory from the configuration.
func WorkingDirectory() string {
if cfg == nil {
panic("config not loaded")
}
return cfg.WorkingDir
}
@@ -58,3 +58,4 @@ func MarkProjectInitialized() error {
return nil
}
+91
View File
@@ -0,0 +1,91 @@
package db
import (
"database/sql"
"fmt"
"os"
"path/filepath"
"github.com/golang-migrate/migrate/v4"
"github.com/golang-migrate/migrate/v4/source/iofs"
"github.com/golang-migrate/migrate/v4/database/sqlite3"
_ "github.com/mattn/go-sqlite3"
"github.com/kujtimiihoxha/opencode/internal/config"
"github.com/kujtimiihoxha/opencode/internal/logging"
)
func Connect() (*sql.DB, error) {
dataDir := config.Get().Data.Directory
if dataDir == "" {
return nil, fmt.Errorf("data.dir is not set")
}
if err := os.MkdirAll(dataDir, 0o700); err != nil {
return nil, fmt.Errorf("failed to create data directory: %w", err)
}
dbPath := filepath.Join(dataDir, "opencode.db")
// Open the SQLite database
db, err := sql.Open("sqlite3", dbPath)
if err != nil {
return nil, fmt.Errorf("failed to open database: %w", err)
}
// Verify connection
if err = db.Ping(); err != nil {
db.Close()
return nil, fmt.Errorf("failed to connect to database: %w", err)
}
// Set pragmas for better performance
pragmas := []string{
"PRAGMA foreign_keys = ON;",
"PRAGMA journal_mode = WAL;",
"PRAGMA page_size = 4096;",
"PRAGMA cache_size = -8000;",
"PRAGMA synchronous = NORMAL;",
}
for _, pragma := range pragmas {
if _, err = db.Exec(pragma); err != nil {
logging.Error("Failed to set pragma", pragma, err)
} else {
logging.Debug("Set pragma", "pragma", pragma)
}
}
// Initialize schema from embedded file
d, err := iofs.New(FS, "migrations")
if err != nil {
logging.Error("Failed to open embedded migrations", "error", err)
db.Close()
return nil, fmt.Errorf("failed to open embedded migrations: %w", err)
}
driver, err := sqlite3.WithInstance(db, &sqlite3.Config{})
if err != nil {
logging.Error("Failed to create SQLite driver", "error", err)
db.Close()
return nil, fmt.Errorf("failed to create SQLite driver: %w", err)
}
m, err := migrate.NewWithInstance("iofs", d, "ql", driver)
if err != nil {
logging.Error("Failed to create migration instance", "error", err)
db.Close()
return nil, fmt.Errorf("failed to create migration instance: %w", err)
}
err = m.Up()
if err != nil && err != migrate.ErrNoChange {
logging.Error("Migration failed", "error", err)
db.Close()
return nil, fmt.Errorf("failed to apply schema: %w", err)
} else if err == migrate.ErrNoChange {
logging.Info("No schema changes to apply")
} else {
logging.Info("Schema migration applied successfully")
}
return db, nil
}
+288
View File
@@ -0,0 +1,288 @@
// Code generated by sqlc. DO NOT EDIT.
// versions:
// sqlc v1.27.0
package db
import (
"context"
"database/sql"
"fmt"
)
type DBTX interface {
ExecContext(context.Context, string, ...interface{}) (sql.Result, error)
PrepareContext(context.Context, string) (*sql.Stmt, error)
QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error)
QueryRowContext(context.Context, string, ...interface{}) *sql.Row
}
func New(db DBTX) *Queries {
return &Queries{db: db}
}
func Prepare(ctx context.Context, db DBTX) (*Queries, error) {
q := Queries{db: db}
var err error
if q.createFileStmt, err = db.PrepareContext(ctx, createFile); err != nil {
return nil, fmt.Errorf("error preparing query CreateFile: %w", err)
}
if q.createMessageStmt, err = db.PrepareContext(ctx, createMessage); err != nil {
return nil, fmt.Errorf("error preparing query CreateMessage: %w", err)
}
if q.createSessionStmt, err = db.PrepareContext(ctx, createSession); err != nil {
return nil, fmt.Errorf("error preparing query CreateSession: %w", err)
}
if q.deleteFileStmt, err = db.PrepareContext(ctx, deleteFile); err != nil {
return nil, fmt.Errorf("error preparing query DeleteFile: %w", err)
}
if q.deleteMessageStmt, err = db.PrepareContext(ctx, deleteMessage); err != nil {
return nil, fmt.Errorf("error preparing query DeleteMessage: %w", err)
}
if q.deleteSessionStmt, err = db.PrepareContext(ctx, deleteSession); err != nil {
return nil, fmt.Errorf("error preparing query DeleteSession: %w", err)
}
if q.deleteSessionFilesStmt, err = db.PrepareContext(ctx, deleteSessionFiles); err != nil {
return nil, fmt.Errorf("error preparing query DeleteSessionFiles: %w", err)
}
if q.deleteSessionMessagesStmt, err = db.PrepareContext(ctx, deleteSessionMessages); err != nil {
return nil, fmt.Errorf("error preparing query DeleteSessionMessages: %w", err)
}
if q.getFileStmt, err = db.PrepareContext(ctx, getFile); err != nil {
return nil, fmt.Errorf("error preparing query GetFile: %w", err)
}
if q.getFileByPathAndSessionStmt, err = db.PrepareContext(ctx, getFileByPathAndSession); err != nil {
return nil, fmt.Errorf("error preparing query GetFileByPathAndSession: %w", err)
}
if q.getMessageStmt, err = db.PrepareContext(ctx, getMessage); err != nil {
return nil, fmt.Errorf("error preparing query GetMessage: %w", err)
}
if q.getSessionByIDStmt, err = db.PrepareContext(ctx, getSessionByID); err != nil {
return nil, fmt.Errorf("error preparing query GetSessionByID: %w", err)
}
if q.listFilesByPathStmt, err = db.PrepareContext(ctx, listFilesByPath); err != nil {
return nil, fmt.Errorf("error preparing query ListFilesByPath: %w", err)
}
if q.listFilesBySessionStmt, err = db.PrepareContext(ctx, listFilesBySession); err != nil {
return nil, fmt.Errorf("error preparing query ListFilesBySession: %w", err)
}
if q.listLatestSessionFilesStmt, err = db.PrepareContext(ctx, listLatestSessionFiles); err != nil {
return nil, fmt.Errorf("error preparing query ListLatestSessionFiles: %w", err)
}
if q.listMessagesBySessionStmt, err = db.PrepareContext(ctx, listMessagesBySession); err != nil {
return nil, fmt.Errorf("error preparing query ListMessagesBySession: %w", err)
}
if q.listNewFilesStmt, err = db.PrepareContext(ctx, listNewFiles); err != nil {
return nil, fmt.Errorf("error preparing query ListNewFiles: %w", err)
}
if q.listSessionsStmt, err = db.PrepareContext(ctx, listSessions); err != nil {
return nil, fmt.Errorf("error preparing query ListSessions: %w", err)
}
if q.updateFileStmt, err = db.PrepareContext(ctx, updateFile); err != nil {
return nil, fmt.Errorf("error preparing query UpdateFile: %w", err)
}
if q.updateMessageStmt, err = db.PrepareContext(ctx, updateMessage); err != nil {
return nil, fmt.Errorf("error preparing query UpdateMessage: %w", err)
}
if q.updateSessionStmt, err = db.PrepareContext(ctx, updateSession); err != nil {
return nil, fmt.Errorf("error preparing query UpdateSession: %w", err)
}
return &q, nil
}
func (q *Queries) Close() error {
var err error
if q.createFileStmt != nil {
if cerr := q.createFileStmt.Close(); cerr != nil {
err = fmt.Errorf("error closing createFileStmt: %w", cerr)
}
}
if q.createMessageStmt != nil {
if cerr := q.createMessageStmt.Close(); cerr != nil {
err = fmt.Errorf("error closing createMessageStmt: %w", cerr)
}
}
if q.createSessionStmt != nil {
if cerr := q.createSessionStmt.Close(); cerr != nil {
err = fmt.Errorf("error closing createSessionStmt: %w", cerr)
}
}
if q.deleteFileStmt != nil {
if cerr := q.deleteFileStmt.Close(); cerr != nil {
err = fmt.Errorf("error closing deleteFileStmt: %w", cerr)
}
}
if q.deleteMessageStmt != nil {
if cerr := q.deleteMessageStmt.Close(); cerr != nil {
err = fmt.Errorf("error closing deleteMessageStmt: %w", cerr)
}
}
if q.deleteSessionStmt != nil {
if cerr := q.deleteSessionStmt.Close(); cerr != nil {
err = fmt.Errorf("error closing deleteSessionStmt: %w", cerr)
}
}
if q.deleteSessionFilesStmt != nil {
if cerr := q.deleteSessionFilesStmt.Close(); cerr != nil {
err = fmt.Errorf("error closing deleteSessionFilesStmt: %w", cerr)
}
}
if q.deleteSessionMessagesStmt != nil {
if cerr := q.deleteSessionMessagesStmt.Close(); cerr != nil {
err = fmt.Errorf("error closing deleteSessionMessagesStmt: %w", cerr)
}
}
if q.getFileStmt != nil {
if cerr := q.getFileStmt.Close(); cerr != nil {
err = fmt.Errorf("error closing getFileStmt: %w", cerr)
}
}
if q.getFileByPathAndSessionStmt != nil {
if cerr := q.getFileByPathAndSessionStmt.Close(); cerr != nil {
err = fmt.Errorf("error closing getFileByPathAndSessionStmt: %w", cerr)
}
}
if q.getMessageStmt != nil {
if cerr := q.getMessageStmt.Close(); cerr != nil {
err = fmt.Errorf("error closing getMessageStmt: %w", cerr)
}
}
if q.getSessionByIDStmt != nil {
if cerr := q.getSessionByIDStmt.Close(); cerr != nil {
err = fmt.Errorf("error closing getSessionByIDStmt: %w", cerr)
}
}
if q.listFilesByPathStmt != nil {
if cerr := q.listFilesByPathStmt.Close(); cerr != nil {
err = fmt.Errorf("error closing listFilesByPathStmt: %w", cerr)
}
}
if q.listFilesBySessionStmt != nil {
if cerr := q.listFilesBySessionStmt.Close(); cerr != nil {
err = fmt.Errorf("error closing listFilesBySessionStmt: %w", cerr)
}
}
if q.listLatestSessionFilesStmt != nil {
if cerr := q.listLatestSessionFilesStmt.Close(); cerr != nil {
err = fmt.Errorf("error closing listLatestSessionFilesStmt: %w", cerr)
}
}
if q.listMessagesBySessionStmt != nil {
if cerr := q.listMessagesBySessionStmt.Close(); cerr != nil {
err = fmt.Errorf("error closing listMessagesBySessionStmt: %w", cerr)
}
}
if q.listNewFilesStmt != nil {
if cerr := q.listNewFilesStmt.Close(); cerr != nil {
err = fmt.Errorf("error closing listNewFilesStmt: %w", cerr)
}
}
if q.listSessionsStmt != nil {
if cerr := q.listSessionsStmt.Close(); cerr != nil {
err = fmt.Errorf("error closing listSessionsStmt: %w", cerr)
}
}
if q.updateFileStmt != nil {
if cerr := q.updateFileStmt.Close(); cerr != nil {
err = fmt.Errorf("error closing updateFileStmt: %w", cerr)
}
}
if q.updateMessageStmt != nil {
if cerr := q.updateMessageStmt.Close(); cerr != nil {
err = fmt.Errorf("error closing updateMessageStmt: %w", cerr)
}
}
if q.updateSessionStmt != nil {
if cerr := q.updateSessionStmt.Close(); cerr != nil {
err = fmt.Errorf("error closing updateSessionStmt: %w", cerr)
}
}
return err
}
func (q *Queries) exec(ctx context.Context, stmt *sql.Stmt, query string, args ...interface{}) (sql.Result, error) {
switch {
case stmt != nil && q.tx != nil:
return q.tx.StmtContext(ctx, stmt).ExecContext(ctx, args...)
case stmt != nil:
return stmt.ExecContext(ctx, args...)
default:
return q.db.ExecContext(ctx, query, args...)
}
}
func (q *Queries) query(ctx context.Context, stmt *sql.Stmt, query string, args ...interface{}) (*sql.Rows, error) {
switch {
case stmt != nil && q.tx != nil:
return q.tx.StmtContext(ctx, stmt).QueryContext(ctx, args...)
case stmt != nil:
return stmt.QueryContext(ctx, args...)
default:
return q.db.QueryContext(ctx, query, args...)
}
}
func (q *Queries) queryRow(ctx context.Context, stmt *sql.Stmt, query string, args ...interface{}) *sql.Row {
switch {
case stmt != nil && q.tx != nil:
return q.tx.StmtContext(ctx, stmt).QueryRowContext(ctx, args...)
case stmt != nil:
return stmt.QueryRowContext(ctx, args...)
default:
return q.db.QueryRowContext(ctx, query, args...)
}
}
type Queries struct {
db DBTX
tx *sql.Tx
createFileStmt *sql.Stmt
createMessageStmt *sql.Stmt
createSessionStmt *sql.Stmt
deleteFileStmt *sql.Stmt
deleteMessageStmt *sql.Stmt
deleteSessionStmt *sql.Stmt
deleteSessionFilesStmt *sql.Stmt
deleteSessionMessagesStmt *sql.Stmt
getFileStmt *sql.Stmt
getFileByPathAndSessionStmt *sql.Stmt
getMessageStmt *sql.Stmt
getSessionByIDStmt *sql.Stmt
listFilesByPathStmt *sql.Stmt
listFilesBySessionStmt *sql.Stmt
listLatestSessionFilesStmt *sql.Stmt
listMessagesBySessionStmt *sql.Stmt
listNewFilesStmt *sql.Stmt
listSessionsStmt *sql.Stmt
updateFileStmt *sql.Stmt
updateMessageStmt *sql.Stmt
updateSessionStmt *sql.Stmt
}
func (q *Queries) WithTx(tx *sql.Tx) *Queries {
return &Queries{
db: tx,
tx: tx,
createFileStmt: q.createFileStmt,
createMessageStmt: q.createMessageStmt,
createSessionStmt: q.createSessionStmt,
deleteFileStmt: q.deleteFileStmt,
deleteMessageStmt: q.deleteMessageStmt,
deleteSessionStmt: q.deleteSessionStmt,
deleteSessionFilesStmt: q.deleteSessionFilesStmt,
deleteSessionMessagesStmt: q.deleteSessionMessagesStmt,
getFileStmt: q.getFileStmt,
getFileByPathAndSessionStmt: q.getFileByPathAndSessionStmt,
getMessageStmt: q.getMessageStmt,
getSessionByIDStmt: q.getSessionByIDStmt,
listFilesByPathStmt: q.listFilesByPathStmt,
listFilesBySessionStmt: q.listFilesBySessionStmt,
listLatestSessionFilesStmt: q.listLatestSessionFilesStmt,
listMessagesBySessionStmt: q.listMessagesBySessionStmt,
listNewFilesStmt: q.listNewFilesStmt,
listSessionsStmt: q.listSessionsStmt,
updateFileStmt: q.updateFileStmt,
updateMessageStmt: q.updateMessageStmt,
updateSessionStmt: q.updateSessionStmt,
}
}
+6
View File
@@ -0,0 +1,6 @@
package db
import "embed"
//go:embed migrations/*.sql
var FS embed.FS
+311
View File
@@ -0,0 +1,311 @@
// Code generated by sqlc. DO NOT EDIT.
// versions:
// sqlc v1.27.0
// source: files.sql
package db
import (
"context"
)
const createFile = `-- name: CreateFile :one
INSERT INTO files (
id,
session_id,
path,
content,
version,
created_at,
updated_at
) VALUES (
?, ?, ?, ?, ?, strftime('%s', 'now'), strftime('%s', 'now')
)
RETURNING id, session_id, path, content, version, created_at, updated_at
`
type CreateFileParams struct {
ID string `json:"id"`
SessionID string `json:"session_id"`
Path string `json:"path"`
Content string `json:"content"`
Version string `json:"version"`
}
func (q *Queries) CreateFile(ctx context.Context, arg CreateFileParams) (File, error) {
row := q.queryRow(ctx, q.createFileStmt, createFile,
arg.ID,
arg.SessionID,
arg.Path,
arg.Content,
arg.Version,
)
var i File
err := row.Scan(
&i.ID,
&i.SessionID,
&i.Path,
&i.Content,
&i.Version,
&i.CreatedAt,
&i.UpdatedAt,
)
return i, err
}
const deleteFile = `-- name: DeleteFile :exec
DELETE FROM files
WHERE id = ?
`
func (q *Queries) DeleteFile(ctx context.Context, id string) error {
_, err := q.exec(ctx, q.deleteFileStmt, deleteFile, id)
return err
}
const deleteSessionFiles = `-- name: DeleteSessionFiles :exec
DELETE FROM files
WHERE session_id = ?
`
func (q *Queries) DeleteSessionFiles(ctx context.Context, sessionID string) error {
_, err := q.exec(ctx, q.deleteSessionFilesStmt, deleteSessionFiles, sessionID)
return err
}
const getFile = `-- name: GetFile :one
SELECT id, session_id, path, content, version, created_at, updated_at
FROM files
WHERE id = ? LIMIT 1
`
func (q *Queries) GetFile(ctx context.Context, id string) (File, error) {
row := q.queryRow(ctx, q.getFileStmt, getFile, id)
var i File
err := row.Scan(
&i.ID,
&i.SessionID,
&i.Path,
&i.Content,
&i.Version,
&i.CreatedAt,
&i.UpdatedAt,
)
return i, err
}
const getFileByPathAndSession = `-- name: GetFileByPathAndSession :one
SELECT id, session_id, path, content, version, created_at, updated_at
FROM files
WHERE path = ? AND session_id = ?
ORDER BY created_at DESC
LIMIT 1
`
type GetFileByPathAndSessionParams struct {
Path string `json:"path"`
SessionID string `json:"session_id"`
}
func (q *Queries) GetFileByPathAndSession(ctx context.Context, arg GetFileByPathAndSessionParams) (File, error) {
row := q.queryRow(ctx, q.getFileByPathAndSessionStmt, getFileByPathAndSession, arg.Path, arg.SessionID)
var i File
err := row.Scan(
&i.ID,
&i.SessionID,
&i.Path,
&i.Content,
&i.Version,
&i.CreatedAt,
&i.UpdatedAt,
)
return i, err
}
const listFilesByPath = `-- name: ListFilesByPath :many
SELECT id, session_id, path, content, version, created_at, updated_at
FROM files
WHERE path = ?
ORDER BY created_at DESC
`
func (q *Queries) ListFilesByPath(ctx context.Context, path string) ([]File, error) {
rows, err := q.query(ctx, q.listFilesByPathStmt, listFilesByPath, path)
if err != nil {
return nil, err
}
defer rows.Close()
items := []File{}
for rows.Next() {
var i File
if err := rows.Scan(
&i.ID,
&i.SessionID,
&i.Path,
&i.Content,
&i.Version,
&i.CreatedAt,
&i.UpdatedAt,
); err != nil {
return nil, err
}
items = append(items, i)
}
if err := rows.Close(); err != nil {
return nil, err
}
if err := rows.Err(); err != nil {
return nil, err
}
return items, nil
}
const listFilesBySession = `-- name: ListFilesBySession :many
SELECT id, session_id, path, content, version, created_at, updated_at
FROM files
WHERE session_id = ?
ORDER BY created_at ASC
`
func (q *Queries) ListFilesBySession(ctx context.Context, sessionID string) ([]File, error) {
rows, err := q.query(ctx, q.listFilesBySessionStmt, listFilesBySession, sessionID)
if err != nil {
return nil, err
}
defer rows.Close()
items := []File{}
for rows.Next() {
var i File
if err := rows.Scan(
&i.ID,
&i.SessionID,
&i.Path,
&i.Content,
&i.Version,
&i.CreatedAt,
&i.UpdatedAt,
); err != nil {
return nil, err
}
items = append(items, i)
}
if err := rows.Close(); err != nil {
return nil, err
}
if err := rows.Err(); err != nil {
return nil, err
}
return items, nil
}
const listLatestSessionFiles = `-- name: ListLatestSessionFiles :many
SELECT f.id, f.session_id, f.path, f.content, f.version, f.created_at, f.updated_at
FROM files f
INNER JOIN (
SELECT path, MAX(created_at) as max_created_at
FROM files
GROUP BY path
) latest ON f.path = latest.path AND f.created_at = latest.max_created_at
WHERE f.session_id = ?
ORDER BY f.path
`
func (q *Queries) ListLatestSessionFiles(ctx context.Context, sessionID string) ([]File, error) {
rows, err := q.query(ctx, q.listLatestSessionFilesStmt, listLatestSessionFiles, sessionID)
if err != nil {
return nil, err
}
defer rows.Close()
items := []File{}
for rows.Next() {
var i File
if err := rows.Scan(
&i.ID,
&i.SessionID,
&i.Path,
&i.Content,
&i.Version,
&i.CreatedAt,
&i.UpdatedAt,
); err != nil {
return nil, err
}
items = append(items, i)
}
if err := rows.Close(); err != nil {
return nil, err
}
if err := rows.Err(); err != nil {
return nil, err
}
return items, nil
}
const listNewFiles = `-- name: ListNewFiles :many
SELECT id, session_id, path, content, version, created_at, updated_at
FROM files
WHERE is_new = 1
ORDER BY created_at DESC
`
func (q *Queries) ListNewFiles(ctx context.Context) ([]File, error) {
rows, err := q.query(ctx, q.listNewFilesStmt, listNewFiles)
if err != nil {
return nil, err
}
defer rows.Close()
items := []File{}
for rows.Next() {
var i File
if err := rows.Scan(
&i.ID,
&i.SessionID,
&i.Path,
&i.Content,
&i.Version,
&i.CreatedAt,
&i.UpdatedAt,
); err != nil {
return nil, err
}
items = append(items, i)
}
if err := rows.Close(); err != nil {
return nil, err
}
if err := rows.Err(); err != nil {
return nil, err
}
return items, nil
}
const updateFile = `-- name: UpdateFile :one
UPDATE files
SET
content = ?,
version = ?,
updated_at = strftime('%s', 'now')
WHERE id = ?
RETURNING id, session_id, path, content, version, created_at, updated_at
`
type UpdateFileParams struct {
Content string `json:"content"`
Version string `json:"version"`
ID string `json:"id"`
}
func (q *Queries) UpdateFile(ctx context.Context, arg UpdateFileParams) (File, error) {
row := q.queryRow(ctx, q.updateFileStmt, updateFile, arg.Content, arg.Version, arg.ID)
var i File
err := row.Scan(
&i.ID,
&i.SessionID,
&i.Path,
&i.Content,
&i.Version,
&i.CreatedAt,
&i.UpdatedAt,
)
return i, err
}
+157
View File
@@ -0,0 +1,157 @@
// Code generated by sqlc. DO NOT EDIT.
// versions:
// sqlc v1.27.0
// source: messages.sql
package db
import (
"context"
"database/sql"
)
const createMessage = `-- name: CreateMessage :one
INSERT INTO messages (
id,
session_id,
role,
parts,
model,
created_at,
updated_at
) VALUES (
?, ?, ?, ?, ?, strftime('%s', 'now'), strftime('%s', 'now')
)
RETURNING id, session_id, role, parts, model, created_at, updated_at, finished_at
`
type CreateMessageParams struct {
ID string `json:"id"`
SessionID string `json:"session_id"`
Role string `json:"role"`
Parts string `json:"parts"`
Model sql.NullString `json:"model"`
}
func (q *Queries) CreateMessage(ctx context.Context, arg CreateMessageParams) (Message, error) {
row := q.queryRow(ctx, q.createMessageStmt, createMessage,
arg.ID,
arg.SessionID,
arg.Role,
arg.Parts,
arg.Model,
)
var i Message
err := row.Scan(
&i.ID,
&i.SessionID,
&i.Role,
&i.Parts,
&i.Model,
&i.CreatedAt,
&i.UpdatedAt,
&i.FinishedAt,
)
return i, err
}
const deleteMessage = `-- name: DeleteMessage :exec
DELETE FROM messages
WHERE id = ?
`
func (q *Queries) DeleteMessage(ctx context.Context, id string) error {
_, err := q.exec(ctx, q.deleteMessageStmt, deleteMessage, id)
return err
}
const deleteSessionMessages = `-- name: DeleteSessionMessages :exec
DELETE FROM messages
WHERE session_id = ?
`
func (q *Queries) DeleteSessionMessages(ctx context.Context, sessionID string) error {
_, err := q.exec(ctx, q.deleteSessionMessagesStmt, deleteSessionMessages, sessionID)
return err
}
const getMessage = `-- name: GetMessage :one
SELECT id, session_id, role, parts, model, created_at, updated_at, finished_at
FROM messages
WHERE id = ? LIMIT 1
`
func (q *Queries) GetMessage(ctx context.Context, id string) (Message, error) {
row := q.queryRow(ctx, q.getMessageStmt, getMessage, id)
var i Message
err := row.Scan(
&i.ID,
&i.SessionID,
&i.Role,
&i.Parts,
&i.Model,
&i.CreatedAt,
&i.UpdatedAt,
&i.FinishedAt,
)
return i, err
}
const listMessagesBySession = `-- name: ListMessagesBySession :many
SELECT id, session_id, role, parts, model, created_at, updated_at, finished_at
FROM messages
WHERE session_id = ?
ORDER BY created_at ASC
`
func (q *Queries) ListMessagesBySession(ctx context.Context, sessionID string) ([]Message, error) {
rows, err := q.query(ctx, q.listMessagesBySessionStmt, listMessagesBySession, sessionID)
if err != nil {
return nil, err
}
defer rows.Close()
items := []Message{}
for rows.Next() {
var i Message
if err := rows.Scan(
&i.ID,
&i.SessionID,
&i.Role,
&i.Parts,
&i.Model,
&i.CreatedAt,
&i.UpdatedAt,
&i.FinishedAt,
); err != nil {
return nil, err
}
items = append(items, i)
}
if err := rows.Close(); err != nil {
return nil, err
}
if err := rows.Err(); err != nil {
return nil, err
}
return items, nil
}
const updateMessage = `-- name: UpdateMessage :exec
UPDATE messages
SET
parts = ?,
finished_at = ?,
updated_at = strftime('%s', 'now')
WHERE id = ?
`
type UpdateMessageParams struct {
Parts string `json:"parts"`
FinishedAt sql.NullInt64 `json:"finished_at"`
ID string `json:"id"`
}
func (q *Queries) UpdateMessage(ctx context.Context, arg UpdateMessageParams) error {
_, err := q.exec(ctx, q.updateMessageStmt, updateMessage, arg.Parts, arg.FinishedAt, arg.ID)
return err
}
@@ -0,0 +1,10 @@
DROP TRIGGER IF EXISTS update_sessions_updated_at;
DROP TRIGGER IF EXISTS update_messages_updated_at;
DROP TRIGGER IF EXISTS update_files_updated_at;
DROP TRIGGER IF EXISTS update_session_message_count_on_delete;
DROP TRIGGER IF EXISTS update_session_message_count_on_insert;
DROP TABLE IF EXISTS sessions;
DROP TABLE IF EXISTS messages;
DROP TABLE IF EXISTS files;
@@ -0,0 +1,80 @@
-- Sessions
CREATE TABLE IF NOT EXISTS sessions (
id TEXT PRIMARY KEY,
parent_session_id TEXT,
title TEXT NOT NULL,
message_count INTEGER NOT NULL DEFAULT 0 CHECK (message_count >= 0),
prompt_tokens INTEGER NOT NULL DEFAULT 0 CHECK (prompt_tokens >= 0),
completion_tokens INTEGER NOT NULL DEFAULT 0 CHECK (completion_tokens>= 0),
cost REAL NOT NULL DEFAULT 0.0 CHECK (cost >= 0.0),
updated_at INTEGER NOT NULL, -- Unix timestamp in milliseconds
created_at INTEGER NOT NULL -- Unix timestamp in milliseconds
);
CREATE TRIGGER IF NOT EXISTS update_sessions_updated_at
AFTER UPDATE ON sessions
BEGIN
UPDATE sessions SET updated_at = strftime('%s', 'now')
WHERE id = new.id;
END;
-- Files
CREATE TABLE IF NOT EXISTS files (
id TEXT PRIMARY KEY,
session_id TEXT NOT NULL,
path TEXT NOT NULL,
content TEXT NOT NULL,
version TEXT NOT NULL,
created_at INTEGER NOT NULL, -- Unix timestamp in milliseconds
updated_at INTEGER NOT NULL, -- Unix timestamp in milliseconds
FOREIGN KEY (session_id) REFERENCES sessions (id) ON DELETE CASCADE,
UNIQUE(path, session_id, version)
);
CREATE INDEX IF NOT EXISTS idx_files_session_id ON files (session_id);
CREATE INDEX IF NOT EXISTS idx_files_path ON files (path);
CREATE TRIGGER IF NOT EXISTS update_files_updated_at
AFTER UPDATE ON files
BEGIN
UPDATE files SET updated_at = strftime('%s', 'now')
WHERE id = new.id;
END;
-- Messages
CREATE TABLE IF NOT EXISTS messages (
id TEXT PRIMARY KEY,
session_id TEXT NOT NULL,
role TEXT NOT NULL,
parts TEXT NOT NULL default '[]',
model TEXT,
created_at INTEGER NOT NULL, -- Unix timestamp in milliseconds
updated_at INTEGER NOT NULL, -- Unix timestamp in milliseconds
finished_at INTEGER, -- Unix timestamp in milliseconds
FOREIGN KEY (session_id) REFERENCES sessions (id) ON DELETE CASCADE
);
CREATE INDEX IF NOT EXISTS idx_messages_session_id ON messages (session_id);
CREATE TRIGGER IF NOT EXISTS update_messages_updated_at
AFTER UPDATE ON messages
BEGIN
UPDATE messages SET updated_at = strftime('%s', 'now')
WHERE id = new.id;
END;
CREATE TRIGGER IF NOT EXISTS update_session_message_count_on_insert
AFTER INSERT ON messages
BEGIN
UPDATE sessions SET
message_count = message_count + 1
WHERE id = new.session_id;
END;
CREATE TRIGGER IF NOT EXISTS update_session_message_count_on_delete
AFTER DELETE ON messages
BEGIN
UPDATE sessions SET
message_count = message_count - 1
WHERE id = old.session_id;
END;
+42
View File
@@ -0,0 +1,42 @@
// Code generated by sqlc. DO NOT EDIT.
// versions:
// sqlc v1.27.0
package db
import (
"database/sql"
)
type File struct {
ID string `json:"id"`
SessionID string `json:"session_id"`
Path string `json:"path"`
Content string `json:"content"`
Version string `json:"version"`
CreatedAt int64 `json:"created_at"`
UpdatedAt int64 `json:"updated_at"`
}
type Message struct {
ID string `json:"id"`
SessionID string `json:"session_id"`
Role string `json:"role"`
Parts string `json:"parts"`
Model sql.NullString `json:"model"`
CreatedAt int64 `json:"created_at"`
UpdatedAt int64 `json:"updated_at"`
FinishedAt sql.NullInt64 `json:"finished_at"`
}
type Session struct {
ID string `json:"id"`
ParentSessionID sql.NullString `json:"parent_session_id"`
Title string `json:"title"`
MessageCount int64 `json:"message_count"`
PromptTokens int64 `json:"prompt_tokens"`
CompletionTokens int64 `json:"completion_tokens"`
Cost float64 `json:"cost"`
UpdatedAt int64 `json:"updated_at"`
CreatedAt int64 `json:"created_at"`
}
+35
View File
@@ -0,0 +1,35 @@
// Code generated by sqlc. DO NOT EDIT.
// versions:
// sqlc v1.27.0
package db
import (
"context"
)
type Querier interface {
CreateFile(ctx context.Context, arg CreateFileParams) (File, error)
CreateMessage(ctx context.Context, arg CreateMessageParams) (Message, error)
CreateSession(ctx context.Context, arg CreateSessionParams) (Session, error)
DeleteFile(ctx context.Context, id string) error
DeleteMessage(ctx context.Context, id string) error
DeleteSession(ctx context.Context, id string) error
DeleteSessionFiles(ctx context.Context, sessionID string) error
DeleteSessionMessages(ctx context.Context, sessionID string) error
GetFile(ctx context.Context, id string) (File, error)
GetFileByPathAndSession(ctx context.Context, arg GetFileByPathAndSessionParams) (File, error)
GetMessage(ctx context.Context, id string) (Message, error)
GetSessionByID(ctx context.Context, id string) (Session, error)
ListFilesByPath(ctx context.Context, path string) ([]File, error)
ListFilesBySession(ctx context.Context, sessionID string) ([]File, error)
ListLatestSessionFiles(ctx context.Context, sessionID string) ([]File, error)
ListMessagesBySession(ctx context.Context, sessionID string) ([]Message, error)
ListNewFiles(ctx context.Context) ([]File, error)
ListSessions(ctx context.Context) ([]Session, error)
UpdateFile(ctx context.Context, arg UpdateFileParams) (File, error)
UpdateMessage(ctx context.Context, arg UpdateMessageParams) error
UpdateSession(ctx context.Context, arg UpdateSessionParams) (Session, error)
}
var _ Querier = (*Queries)(nil)
+185
View File
@@ -0,0 +1,185 @@
// Code generated by sqlc. DO NOT EDIT.
// versions:
// sqlc v1.27.0
// source: sessions.sql
package db
import (
"context"
"database/sql"
)
const createSession = `-- name: CreateSession :one
INSERT INTO sessions (
id,
parent_session_id,
title,
message_count,
prompt_tokens,
completion_tokens,
cost,
updated_at,
created_at
) VALUES (
?,
?,
?,
?,
?,
?,
?,
strftime('%s', 'now'),
strftime('%s', 'now')
) RETURNING id, parent_session_id, title, message_count, prompt_tokens, completion_tokens, cost, updated_at, created_at
`
type CreateSessionParams struct {
ID string `json:"id"`
ParentSessionID sql.NullString `json:"parent_session_id"`
Title string `json:"title"`
MessageCount int64 `json:"message_count"`
PromptTokens int64 `json:"prompt_tokens"`
CompletionTokens int64 `json:"completion_tokens"`
Cost float64 `json:"cost"`
}
func (q *Queries) CreateSession(ctx context.Context, arg CreateSessionParams) (Session, error) {
row := q.queryRow(ctx, q.createSessionStmt, createSession,
arg.ID,
arg.ParentSessionID,
arg.Title,
arg.MessageCount,
arg.PromptTokens,
arg.CompletionTokens,
arg.Cost,
)
var i Session
err := row.Scan(
&i.ID,
&i.ParentSessionID,
&i.Title,
&i.MessageCount,
&i.PromptTokens,
&i.CompletionTokens,
&i.Cost,
&i.UpdatedAt,
&i.CreatedAt,
)
return i, err
}
const deleteSession = `-- name: DeleteSession :exec
DELETE FROM sessions
WHERE id = ?
`
func (q *Queries) DeleteSession(ctx context.Context, id string) error {
_, err := q.exec(ctx, q.deleteSessionStmt, deleteSession, id)
return err
}
const getSessionByID = `-- name: GetSessionByID :one
SELECT id, parent_session_id, title, message_count, prompt_tokens, completion_tokens, cost, updated_at, created_at
FROM sessions
WHERE id = ? LIMIT 1
`
func (q *Queries) GetSessionByID(ctx context.Context, id string) (Session, error) {
row := q.queryRow(ctx, q.getSessionByIDStmt, getSessionByID, id)
var i Session
err := row.Scan(
&i.ID,
&i.ParentSessionID,
&i.Title,
&i.MessageCount,
&i.PromptTokens,
&i.CompletionTokens,
&i.Cost,
&i.UpdatedAt,
&i.CreatedAt,
)
return i, err
}
const listSessions = `-- name: ListSessions :many
SELECT id, parent_session_id, title, message_count, prompt_tokens, completion_tokens, cost, updated_at, created_at
FROM sessions
WHERE parent_session_id is NULL
ORDER BY created_at DESC
`
func (q *Queries) ListSessions(ctx context.Context) ([]Session, error) {
rows, err := q.query(ctx, q.listSessionsStmt, listSessions)
if err != nil {
return nil, err
}
defer rows.Close()
items := []Session{}
for rows.Next() {
var i Session
if err := rows.Scan(
&i.ID,
&i.ParentSessionID,
&i.Title,
&i.MessageCount,
&i.PromptTokens,
&i.CompletionTokens,
&i.Cost,
&i.UpdatedAt,
&i.CreatedAt,
); err != nil {
return nil, err
}
items = append(items, i)
}
if err := rows.Close(); err != nil {
return nil, err
}
if err := rows.Err(); err != nil {
return nil, err
}
return items, nil
}
const updateSession = `-- name: UpdateSession :one
UPDATE sessions
SET
title = ?,
prompt_tokens = ?,
completion_tokens = ?,
cost = ?
WHERE id = ?
RETURNING id, parent_session_id, title, message_count, prompt_tokens, completion_tokens, cost, updated_at, created_at
`
type UpdateSessionParams struct {
Title string `json:"title"`
PromptTokens int64 `json:"prompt_tokens"`
CompletionTokens int64 `json:"completion_tokens"`
Cost float64 `json:"cost"`
ID string `json:"id"`
}
func (q *Queries) UpdateSession(ctx context.Context, arg UpdateSessionParams) (Session, error) {
row := q.queryRow(ctx, q.updateSessionStmt, updateSession,
arg.Title,
arg.PromptTokens,
arg.CompletionTokens,
arg.Cost,
arg.ID,
)
var i Session
err := row.Scan(
&i.ID,
&i.ParentSessionID,
&i.Title,
&i.MessageCount,
&i.PromptTokens,
&i.CompletionTokens,
&i.Cost,
&i.UpdatedAt,
&i.CreatedAt,
)
return i, err
}
+71
View File
@@ -0,0 +1,71 @@
-- name: GetFile :one
SELECT *
FROM files
WHERE id = ? LIMIT 1;
-- name: GetFileByPathAndSession :one
SELECT *
FROM files
WHERE path = ? AND session_id = ?
ORDER BY created_at DESC
LIMIT 1;
-- name: ListFilesBySession :many
SELECT *
FROM files
WHERE session_id = ?
ORDER BY created_at ASC;
-- name: ListFilesByPath :many
SELECT *
FROM files
WHERE path = ?
ORDER BY created_at DESC;
-- name: CreateFile :one
INSERT INTO files (
id,
session_id,
path,
content,
version,
created_at,
updated_at
) VALUES (
?, ?, ?, ?, ?, strftime('%s', 'now'), strftime('%s', 'now')
)
RETURNING *;
-- name: UpdateFile :one
UPDATE files
SET
content = ?,
version = ?,
updated_at = strftime('%s', 'now')
WHERE id = ?
RETURNING *;
-- name: DeleteFile :exec
DELETE FROM files
WHERE id = ?;
-- name: DeleteSessionFiles :exec
DELETE FROM files
WHERE session_id = ?;
-- name: ListLatestSessionFiles :many
SELECT f.*
FROM files f
INNER JOIN (
SELECT path, MAX(created_at) as max_created_at
FROM files
GROUP BY path
) latest ON f.path = latest.path AND f.created_at = latest.max_created_at
WHERE f.session_id = ?
ORDER BY f.path;
-- name: ListNewFiles :many
SELECT *
FROM files
WHERE is_new = 1
ORDER BY created_at DESC;
+41
View File
@@ -0,0 +1,41 @@
-- name: GetMessage :one
SELECT *
FROM messages
WHERE id = ? LIMIT 1;
-- name: ListMessagesBySession :many
SELECT *
FROM messages
WHERE session_id = ?
ORDER BY created_at ASC;
-- name: CreateMessage :one
INSERT INTO messages (
id,
session_id,
role,
parts,
model,
created_at,
updated_at
) VALUES (
?, ?, ?, ?, ?, strftime('%s', 'now'), strftime('%s', 'now')
)
RETURNING *;
-- name: UpdateMessage :exec
UPDATE messages
SET
parts = ?,
finished_at = ?,
updated_at = strftime('%s', 'now')
WHERE id = ?;
-- name: DeleteMessage :exec
DELETE FROM messages
WHERE id = ?;
-- name: DeleteSessionMessages :exec
DELETE FROM messages
WHERE session_id = ?;
+48
View File
@@ -0,0 +1,48 @@
-- name: CreateSession :one
INSERT INTO sessions (
id,
parent_session_id,
title,
message_count,
prompt_tokens,
completion_tokens,
cost,
updated_at,
created_at
) VALUES (
?,
?,
?,
?,
?,
?,
?,
strftime('%s', 'now'),
strftime('%s', 'now')
) RETURNING *;
-- name: GetSessionByID :one
SELECT *
FROM sessions
WHERE id = ? LIMIT 1;
-- name: ListSessions :many
SELECT *
FROM sessions
WHERE parent_session_id is NULL
ORDER BY created_at DESC;
-- name: UpdateSession :one
UPDATE sessions
SET
title = ?,
prompt_tokens = ?,
completion_tokens = ?,
cost = ?
WHERE id = ?
RETURNING *;
-- name: DeleteSession :exec
DELETE FROM sessions
WHERE id = ?;
+1047
View File
@@ -0,0 +1,1047 @@
package diff
import (
"bytes"
"fmt"
"io"
"os"
"path/filepath"
"regexp"
"strconv"
"strings"
"time"
"github.com/alecthomas/chroma/v2"
"github.com/alecthomas/chroma/v2/formatters"
"github.com/alecthomas/chroma/v2/lexers"
"github.com/alecthomas/chroma/v2/styles"
"github.com/charmbracelet/lipgloss"
"github.com/charmbracelet/x/ansi"
"github.com/go-git/go-git/v5"
"github.com/go-git/go-git/v5/plumbing/object"
"github.com/kujtimiihoxha/opencode/internal/config"
"github.com/kujtimiihoxha/opencode/internal/logging"
"github.com/sergi/go-diff/diffmatchpatch"
)
// -------------------------------------------------------------------------
// Core Types
// -------------------------------------------------------------------------
// LineType represents the kind of line in a diff.
type LineType int
const (
LineContext LineType = iota // Line exists in both files
LineAdded // Line added in the new file
LineRemoved // Line removed from the old file
)
// Segment represents a portion of a line for intra-line highlighting
type Segment struct {
Start int
End int
Type LineType
Text string
}
// DiffLine represents a single line in a diff
type DiffLine struct {
OldLineNo int // Line number in old file (0 for added lines)
NewLineNo int // Line number in new file (0 for removed lines)
Kind LineType // Type of line (added, removed, context)
Content string // Content of the line
Segments []Segment // Segments for intraline highlighting
}
// Hunk represents a section of changes in a diff
type Hunk struct {
Header string
Lines []DiffLine
}
// DiffResult contains the parsed result of a diff
type DiffResult struct {
OldFile string
NewFile string
Hunks []Hunk
}
// linePair represents a pair of lines for side-by-side display
type linePair struct {
left *DiffLine
right *DiffLine
}
// -------------------------------------------------------------------------
// Style Configuration
// -------------------------------------------------------------------------
// StyleConfig defines styling for diff rendering
type StyleConfig struct {
ShowHeader bool
ShowHunkHeader bool
FileNameFg lipgloss.Color
// Background colors
RemovedLineBg lipgloss.Color
AddedLineBg lipgloss.Color
ContextLineBg lipgloss.Color
HunkLineBg lipgloss.Color
RemovedLineNumberBg lipgloss.Color
AddedLineNamerBg lipgloss.Color
// Foreground colors
HunkLineFg lipgloss.Color
RemovedFg lipgloss.Color
AddedFg lipgloss.Color
LineNumberFg lipgloss.Color
RemovedHighlightFg lipgloss.Color
AddedHighlightFg lipgloss.Color
// Highlight settings
HighlightStyle string
RemovedHighlightBg lipgloss.Color
AddedHighlightBg lipgloss.Color
}
// StyleOption is a function that modifies a StyleConfig
type StyleOption func(*StyleConfig)
// NewStyleConfig creates a StyleConfig with default values
func NewStyleConfig(opts ...StyleOption) StyleConfig {
// Default color scheme
config := StyleConfig{
ShowHeader: true,
ShowHunkHeader: true,
FileNameFg: lipgloss.Color("#a0a0a0"),
RemovedLineBg: lipgloss.Color("#3A3030"),
AddedLineBg: lipgloss.Color("#303A30"),
ContextLineBg: lipgloss.Color("#212121"),
HunkLineBg: lipgloss.Color("#212121"),
HunkLineFg: lipgloss.Color("#a0a0a0"),
RemovedFg: lipgloss.Color("#7C4444"),
AddedFg: lipgloss.Color("#478247"),
LineNumberFg: lipgloss.Color("#888888"),
HighlightStyle: "dracula",
RemovedHighlightBg: lipgloss.Color("#612726"),
AddedHighlightBg: lipgloss.Color("#256125"),
RemovedLineNumberBg: lipgloss.Color("#332929"),
AddedLineNamerBg: lipgloss.Color("#293229"),
RemovedHighlightFg: lipgloss.Color("#FADADD"),
AddedHighlightFg: lipgloss.Color("#DAFADA"),
}
// Apply all provided options
for _, opt := range opts {
opt(&config)
}
return config
}
// Style option functions
func WithFileNameFg(color lipgloss.Color) StyleOption {
return func(s *StyleConfig) { s.FileNameFg = color }
}
func WithRemovedLineBg(color lipgloss.Color) StyleOption {
return func(s *StyleConfig) { s.RemovedLineBg = color }
}
func WithAddedLineBg(color lipgloss.Color) StyleOption {
return func(s *StyleConfig) { s.AddedLineBg = color }
}
func WithContextLineBg(color lipgloss.Color) StyleOption {
return func(s *StyleConfig) { s.ContextLineBg = color }
}
func WithRemovedFg(color lipgloss.Color) StyleOption {
return func(s *StyleConfig) { s.RemovedFg = color }
}
func WithAddedFg(color lipgloss.Color) StyleOption {
return func(s *StyleConfig) { s.AddedFg = color }
}
func WithLineNumberFg(color lipgloss.Color) StyleOption {
return func(s *StyleConfig) { s.LineNumberFg = color }
}
func WithHighlightStyle(style string) StyleOption {
return func(s *StyleConfig) { s.HighlightStyle = style }
}
func WithRemovedHighlightColors(bg, fg lipgloss.Color) StyleOption {
return func(s *StyleConfig) {
s.RemovedHighlightBg = bg
s.RemovedHighlightFg = fg
}
}
func WithAddedHighlightColors(bg, fg lipgloss.Color) StyleOption {
return func(s *StyleConfig) {
s.AddedHighlightBg = bg
s.AddedHighlightFg = fg
}
}
func WithRemovedLineNumberBg(color lipgloss.Color) StyleOption {
return func(s *StyleConfig) { s.RemovedLineNumberBg = color }
}
func WithAddedLineNumberBg(color lipgloss.Color) StyleOption {
return func(s *StyleConfig) { s.AddedLineNamerBg = color }
}
func WithHunkLineBg(color lipgloss.Color) StyleOption {
return func(s *StyleConfig) { s.HunkLineBg = color }
}
func WithHunkLineFg(color lipgloss.Color) StyleOption {
return func(s *StyleConfig) { s.HunkLineFg = color }
}
func WithShowHeader(show bool) StyleOption {
return func(s *StyleConfig) { s.ShowHeader = show }
}
func WithShowHunkHeader(show bool) StyleOption {
return func(s *StyleConfig) { s.ShowHunkHeader = show }
}
// -------------------------------------------------------------------------
// Parse Configuration
// -------------------------------------------------------------------------
// ParseConfig configures the behavior of diff parsing
type ParseConfig struct {
ContextSize int // Number of context lines to include
}
// ParseOption modifies a ParseConfig
type ParseOption func(*ParseConfig)
// WithContextSize sets the number of context lines to include
func WithContextSize(size int) ParseOption {
return func(p *ParseConfig) {
if size >= 0 {
p.ContextSize = size
}
}
}
// -------------------------------------------------------------------------
// Side-by-Side Configuration
// -------------------------------------------------------------------------
// SideBySideConfig configures the rendering of side-by-side diffs
type SideBySideConfig struct {
TotalWidth int
Style StyleConfig
}
// SideBySideOption modifies a SideBySideConfig
type SideBySideOption func(*SideBySideConfig)
// NewSideBySideConfig creates a SideBySideConfig with default values
func NewSideBySideConfig(opts ...SideBySideOption) SideBySideConfig {
config := SideBySideConfig{
TotalWidth: 160, // Default width for side-by-side view
Style: NewStyleConfig(),
}
for _, opt := range opts {
opt(&config)
}
return config
}
// WithTotalWidth sets the total width for side-by-side view
func WithTotalWidth(width int) SideBySideOption {
return func(s *SideBySideConfig) {
if width > 0 {
s.TotalWidth = width
}
}
}
// WithStyle sets the styling configuration
func WithStyle(style StyleConfig) SideBySideOption {
return func(s *SideBySideConfig) {
s.Style = style
}
}
// WithStyleOptions applies the specified style options
func WithStyleOptions(opts ...StyleOption) SideBySideOption {
return func(s *SideBySideConfig) {
s.Style = NewStyleConfig(opts...)
}
}
// -------------------------------------------------------------------------
// Diff Parsing
// -------------------------------------------------------------------------
// ParseUnifiedDiff parses a unified diff format string into structured data
func ParseUnifiedDiff(diff string) (DiffResult, error) {
var result DiffResult
var currentHunk *Hunk
hunkHeaderRe := regexp.MustCompile(`^@@ -(\d+),?(\d*) \+(\d+),?(\d*) @@`)
lines := strings.Split(diff, "\n")
var oldLine, newLine int
inFileHeader := true
for _, line := range lines {
// Parse file headers
if inFileHeader {
if strings.HasPrefix(line, "--- a/") {
result.OldFile = strings.TrimPrefix(line, "--- a/")
continue
}
if strings.HasPrefix(line, "+++ b/") {
result.NewFile = strings.TrimPrefix(line, "+++ b/")
inFileHeader = false
continue
}
}
// Parse hunk headers
if matches := hunkHeaderRe.FindStringSubmatch(line); matches != nil {
if currentHunk != nil {
result.Hunks = append(result.Hunks, *currentHunk)
}
currentHunk = &Hunk{
Header: line,
Lines: []DiffLine{},
}
oldStart, _ := strconv.Atoi(matches[1])
newStart, _ := strconv.Atoi(matches[3])
oldLine = oldStart
newLine = newStart
continue
}
// Ignore "No newline at end of file" markers
if strings.HasPrefix(line, "\\ No newline at end of file") {
continue
}
if currentHunk == nil {
continue
}
// Process the line based on its prefix
if len(line) > 0 {
switch line[0] {
case '+':
currentHunk.Lines = append(currentHunk.Lines, DiffLine{
OldLineNo: 0,
NewLineNo: newLine,
Kind: LineAdded,
Content: line[1:],
})
newLine++
case '-':
currentHunk.Lines = append(currentHunk.Lines, DiffLine{
OldLineNo: oldLine,
NewLineNo: 0,
Kind: LineRemoved,
Content: line[1:],
})
oldLine++
default:
currentHunk.Lines = append(currentHunk.Lines, DiffLine{
OldLineNo: oldLine,
NewLineNo: newLine,
Kind: LineContext,
Content: line,
})
oldLine++
newLine++
}
} else {
// Handle empty lines
currentHunk.Lines = append(currentHunk.Lines, DiffLine{
OldLineNo: oldLine,
NewLineNo: newLine,
Kind: LineContext,
Content: "",
})
oldLine++
newLine++
}
}
// Add the last hunk if there is one
if currentHunk != nil {
result.Hunks = append(result.Hunks, *currentHunk)
}
return result, nil
}
// HighlightIntralineChanges updates lines in a hunk to show character-level differences
func HighlightIntralineChanges(h *Hunk, style StyleConfig) {
var updated []DiffLine
dmp := diffmatchpatch.New()
for i := 0; i < len(h.Lines); i++ {
// Look for removed line followed by added line
if i+1 < len(h.Lines) &&
h.Lines[i].Kind == LineRemoved &&
h.Lines[i+1].Kind == LineAdded {
oldLine := h.Lines[i]
newLine := h.Lines[i+1]
// Find character-level differences
patches := dmp.DiffMain(oldLine.Content, newLine.Content, false)
patches = dmp.DiffCleanupSemantic(patches)
patches = dmp.DiffCleanupMerge(patches)
patches = dmp.DiffCleanupEfficiency(patches)
segments := make([]Segment, 0)
removeStart := 0
addStart := 0
for _, patch := range patches {
switch patch.Type {
case diffmatchpatch.DiffDelete:
segments = append(segments, Segment{
Start: removeStart,
End: removeStart + len(patch.Text),
Type: LineRemoved,
Text: patch.Text,
})
removeStart += len(patch.Text)
case diffmatchpatch.DiffInsert:
segments = append(segments, Segment{
Start: addStart,
End: addStart + len(patch.Text),
Type: LineAdded,
Text: patch.Text,
})
addStart += len(patch.Text)
default:
// Context text, no highlighting needed
removeStart += len(patch.Text)
addStart += len(patch.Text)
}
}
oldLine.Segments = segments
newLine.Segments = segments
updated = append(updated, oldLine, newLine)
i++ // Skip the next line as we've already processed it
} else {
updated = append(updated, h.Lines[i])
}
}
h.Lines = updated
}
// pairLines converts a flat list of diff lines to pairs for side-by-side display
func pairLines(lines []DiffLine) []linePair {
var pairs []linePair
i := 0
for i < len(lines) {
switch lines[i].Kind {
case LineRemoved:
// Check if the next line is an addition, if so pair them
if i+1 < len(lines) && lines[i+1].Kind == LineAdded {
pairs = append(pairs, linePair{left: &lines[i], right: &lines[i+1]})
i += 2
} else {
pairs = append(pairs, linePair{left: &lines[i], right: nil})
i++
}
case LineAdded:
pairs = append(pairs, linePair{left: nil, right: &lines[i]})
i++
case LineContext:
pairs = append(pairs, linePair{left: &lines[i], right: &lines[i]})
i++
}
}
return pairs
}
// -------------------------------------------------------------------------
// Syntax Highlighting
// -------------------------------------------------------------------------
// SyntaxHighlight applies syntax highlighting to text based on file extension
func SyntaxHighlight(w io.Writer, source, fileName, formatter string, bg lipgloss.TerminalColor) error {
// Determine the language lexer to use
l := lexers.Match(fileName)
if l == nil {
l = lexers.Analyse(source)
}
if l == nil {
l = lexers.Fallback
}
l = chroma.Coalesce(l)
// Get the formatter
f := formatters.Get(formatter)
if f == nil {
f = formatters.Fallback
}
theme := `
<style name="vscode-dark-plus">
<!-- Base colors -->
<entry type="Background" style="bg:#1E1E1E"/>
<entry type="Text" style="#D4D4D4"/>
<entry type="Other" style="#D4D4D4"/>
<entry type="Error" style="#F44747"/>
<!-- Keywords - using the Control flow / Special keywords color -->
<entry type="Keyword" style="#C586C0"/>
<entry type="KeywordConstant" style="#4FC1FF"/>
<entry type="KeywordDeclaration" style="#C586C0"/>
<entry type="KeywordNamespace" style="#C586C0"/>
<entry type="KeywordPseudo" style="#C586C0"/>
<entry type="KeywordReserved" style="#C586C0"/>
<entry type="KeywordType" style="#4EC9B0"/>
<!-- Names -->
<entry type="Name" style="#D4D4D4"/>
<entry type="NameAttribute" style="#9CDCFE"/>
<entry type="NameBuiltin" style="#4EC9B0"/>
<entry type="NameBuiltinPseudo" style="#9CDCFE"/>
<entry type="NameClass" style="#4EC9B0"/>
<entry type="NameConstant" style="#4FC1FF"/>
<entry type="NameDecorator" style="#DCDCAA"/>
<entry type="NameEntity" style="#9CDCFE"/>
<entry type="NameException" style="#4EC9B0"/>
<entry type="NameFunction" style="#DCDCAA"/>
<entry type="NameLabel" style="#C8C8C8"/>
<entry type="NameNamespace" style="#4EC9B0"/>
<entry type="NameOther" style="#9CDCFE"/>
<entry type="NameTag" style="#569CD6"/>
<entry type="NameVariable" style="#9CDCFE"/>
<entry type="NameVariableClass" style="#9CDCFE"/>
<entry type="NameVariableGlobal" style="#9CDCFE"/>
<entry type="NameVariableInstance" style="#9CDCFE"/>
<!-- Literals -->
<entry type="Literal" style="#CE9178"/>
<entry type="LiteralDate" style="#CE9178"/>
<entry type="LiteralString" style="#CE9178"/>
<entry type="LiteralStringBacktick" style="#CE9178"/>
<entry type="LiteralStringChar" style="#CE9178"/>
<entry type="LiteralStringDoc" style="#CE9178"/>
<entry type="LiteralStringDouble" style="#CE9178"/>
<entry type="LiteralStringEscape" style="#d7ba7d"/>
<entry type="LiteralStringHeredoc" style="#CE9178"/>
<entry type="LiteralStringInterpol" style="#CE9178"/>
<entry type="LiteralStringOther" style="#CE9178"/>
<entry type="LiteralStringRegex" style="#d16969"/>
<entry type="LiteralStringSingle" style="#CE9178"/>
<entry type="LiteralStringSymbol" style="#CE9178"/>
<!-- Numbers - using the numberLiteral color -->
<entry type="LiteralNumber" style="#b5cea8"/>
<entry type="LiteralNumberBin" style="#b5cea8"/>
<entry type="LiteralNumberFloat" style="#b5cea8"/>
<entry type="LiteralNumberHex" style="#b5cea8"/>
<entry type="LiteralNumberInteger" style="#b5cea8"/>
<entry type="LiteralNumberIntegerLong" style="#b5cea8"/>
<entry type="LiteralNumberOct" style="#b5cea8"/>
<!-- Operators -->
<entry type="Operator" style="#D4D4D4"/>
<entry type="OperatorWord" style="#C586C0"/>
<entry type="Punctuation" style="#D4D4D4"/>
<!-- Comments - standard VSCode Dark+ comment color -->
<entry type="Comment" style="#6A9955"/>
<entry type="CommentHashbang" style="#6A9955"/>
<entry type="CommentMultiline" style="#6A9955"/>
<entry type="CommentSingle" style="#6A9955"/>
<entry type="CommentSpecial" style="#6A9955"/>
<entry type="CommentPreproc" style="#C586C0"/>
<!-- Generic styles -->
<entry type="Generic" style="#D4D4D4"/>
<entry type="GenericDeleted" style="#F44747"/>
<entry type="GenericEmph" style="italic #D4D4D4"/>
<entry type="GenericError" style="#F44747"/>
<entry type="GenericHeading" style="bold #D4D4D4"/>
<entry type="GenericInserted" style="#b5cea8"/>
<entry type="GenericOutput" style="#808080"/>
<entry type="GenericPrompt" style="#D4D4D4"/>
<entry type="GenericStrong" style="bold #D4D4D4"/>
<entry type="GenericSubheading" style="bold #D4D4D4"/>
<entry type="GenericTraceback" style="#F44747"/>
<entry type="GenericUnderline" style="underline"/>
<entry type="TextWhitespace" style="#D4D4D4"/>
</style>
`
r := strings.NewReader(theme)
style := chroma.MustNewXMLStyle(r)
// Modify the style to use the provided background
s, err := style.Builder().Transform(
func(t chroma.StyleEntry) chroma.StyleEntry {
r, g, b, _ := bg.RGBA()
t.Background = chroma.NewColour(uint8(r>>8), uint8(g>>8), uint8(b>>8))
return t
},
).Build()
if err != nil {
s = styles.Fallback
}
// Tokenize and format
it, err := l.Tokenise(nil, source)
if err != nil {
return err
}
return f.Format(w, s, it)
}
// highlightLine applies syntax highlighting to a single line
func highlightLine(fileName string, line string, bg lipgloss.TerminalColor) string {
var buf bytes.Buffer
err := SyntaxHighlight(&buf, line, fileName, "terminal16m", bg)
if err != nil {
return line
}
return buf.String()
}
// createStyles generates the lipgloss styles needed for rendering diffs
func createStyles(config StyleConfig) (removedLineStyle, addedLineStyle, contextLineStyle, lineNumberStyle lipgloss.Style) {
removedLineStyle = lipgloss.NewStyle().Background(config.RemovedLineBg)
addedLineStyle = lipgloss.NewStyle().Background(config.AddedLineBg)
contextLineStyle = lipgloss.NewStyle().Background(config.ContextLineBg)
lineNumberStyle = lipgloss.NewStyle().Foreground(config.LineNumberFg)
return
}
// -------------------------------------------------------------------------
// Rendering Functions
// -------------------------------------------------------------------------
// applyHighlighting applies intra-line highlighting to a piece of text
func applyHighlighting(content string, segments []Segment, segmentType LineType, highlightBg lipgloss.Color,
) string {
// Find all ANSI sequences in the content
ansiRegex := regexp.MustCompile(`\x1b(?:[@-Z\\-_]|\[[0-9?]*(?:;[0-9?]*)*[@-~])`)
ansiMatches := ansiRegex.FindAllStringIndex(content, -1)
// Build a mapping of visible character positions to their actual indices
visibleIdx := 0
ansiSequences := make(map[int]string)
lastAnsiSeq := "\x1b[0m" // Default reset sequence
for i := 0; i < len(content); {
isAnsi := false
for _, match := range ansiMatches {
if match[0] == i {
ansiSequences[visibleIdx] = content[match[0]:match[1]]
lastAnsiSeq = content[match[0]:match[1]]
i = match[1]
isAnsi = true
break
}
}
if isAnsi {
continue
}
// For non-ANSI positions, store the last ANSI sequence
if _, exists := ansiSequences[visibleIdx]; !exists {
ansiSequences[visibleIdx] = lastAnsiSeq
}
visibleIdx++
i++
}
// Apply highlighting
var sb strings.Builder
inSelection := false
currentPos := 0
for i := 0; i < len(content); {
// Check if we're at an ANSI sequence
isAnsi := false
for _, match := range ansiMatches {
if match[0] == i {
sb.WriteString(content[match[0]:match[1]]) // Preserve ANSI sequence
i = match[1]
isAnsi = true
break
}
}
if isAnsi {
continue
}
// Check for segment boundaries
for _, seg := range segments {
if seg.Type == segmentType {
if currentPos == seg.Start {
inSelection = true
}
if currentPos == seg.End {
inSelection = false
}
}
}
// Get current character
char := string(content[i])
if inSelection {
// Get the current styling
currentStyle := ansiSequences[currentPos]
// Apply background highlight
sb.WriteString("\x1b[48;2;")
r, g, b, _ := highlightBg.RGBA()
sb.WriteString(fmt.Sprintf("%d;%d;%dm", r>>8, g>>8, b>>8))
sb.WriteString(char)
sb.WriteString("\x1b[49m") // Reset only background
// Reapply the original ANSI sequence
sb.WriteString(currentStyle)
} else {
// Not in selection, just copy the character
sb.WriteString(char)
}
currentPos++
i++
}
return sb.String()
}
// renderLeftColumn formats the left side of a side-by-side diff
func renderLeftColumn(fileName string, dl *DiffLine, colWidth int, styles StyleConfig) string {
if dl == nil {
contextLineStyle := lipgloss.NewStyle().Background(styles.ContextLineBg)
return contextLineStyle.Width(colWidth).Render("")
}
removedLineStyle, _, contextLineStyle, lineNumberStyle := createStyles(styles)
// Determine line style based on line type
var marker string
var bgStyle lipgloss.Style
switch dl.Kind {
case LineRemoved:
marker = removedLineStyle.Foreground(styles.RemovedFg).Render("-")
bgStyle = removedLineStyle
lineNumberStyle = lineNumberStyle.Foreground(styles.RemovedFg).Background(styles.RemovedLineNumberBg)
case LineAdded:
marker = "?"
bgStyle = contextLineStyle
case LineContext:
marker = contextLineStyle.Render(" ")
bgStyle = contextLineStyle
}
// Format line number
lineNum := ""
if dl.OldLineNo > 0 {
lineNum = fmt.Sprintf("%6d", dl.OldLineNo)
}
// Create the line prefix
prefix := lineNumberStyle.Render(lineNum + " " + marker)
// Apply syntax highlighting
content := highlightLine(fileName, dl.Content, bgStyle.GetBackground())
// Apply intra-line highlighting for removed lines
if dl.Kind == LineRemoved && len(dl.Segments) > 0 {
content = applyHighlighting(content, dl.Segments, LineRemoved, styles.RemovedHighlightBg)
}
// Add a padding space for removed lines
if dl.Kind == LineRemoved {
content = bgStyle.Render(" ") + content
}
// Create the final line and truncate if needed
lineText := prefix + content
return bgStyle.MaxHeight(1).Width(colWidth).Render(
ansi.Truncate(
lineText,
colWidth,
lipgloss.NewStyle().Background(styles.HunkLineBg).Foreground(styles.HunkLineFg).Render("..."),
),
)
}
// renderRightColumn formats the right side of a side-by-side diff
func renderRightColumn(fileName string, dl *DiffLine, colWidth int, styles StyleConfig) string {
if dl == nil {
contextLineStyle := lipgloss.NewStyle().Background(styles.ContextLineBg)
return contextLineStyle.Width(colWidth).Render("")
}
_, addedLineStyle, contextLineStyle, lineNumberStyle := createStyles(styles)
// Determine line style based on line type
var marker string
var bgStyle lipgloss.Style
switch dl.Kind {
case LineAdded:
marker = addedLineStyle.Foreground(styles.AddedFg).Render("+")
bgStyle = addedLineStyle
lineNumberStyle = lineNumberStyle.Foreground(styles.AddedFg).Background(styles.AddedLineNamerBg)
case LineRemoved:
marker = "?"
bgStyle = contextLineStyle
case LineContext:
marker = contextLineStyle.Render(" ")
bgStyle = contextLineStyle
}
// Format line number
lineNum := ""
if dl.NewLineNo > 0 {
lineNum = fmt.Sprintf("%6d", dl.NewLineNo)
}
// Create the line prefix
prefix := lineNumberStyle.Render(lineNum + " " + marker)
// Apply syntax highlighting
content := highlightLine(fileName, dl.Content, bgStyle.GetBackground())
// Apply intra-line highlighting for added lines
if dl.Kind == LineAdded && len(dl.Segments) > 0 {
content = applyHighlighting(content, dl.Segments, LineAdded, styles.AddedHighlightBg)
}
// Add a padding space for added lines
if dl.Kind == LineAdded {
content = bgStyle.Render(" ") + content
}
// Create the final line and truncate if needed
lineText := prefix + content
return bgStyle.MaxHeight(1).Width(colWidth).Render(
ansi.Truncate(
lineText,
colWidth,
lipgloss.NewStyle().Background(styles.HunkLineBg).Foreground(styles.HunkLineFg).Render("..."),
),
)
}
// -------------------------------------------------------------------------
// Public API
// -------------------------------------------------------------------------
// RenderSideBySideHunk formats a hunk for side-by-side display
func RenderSideBySideHunk(fileName string, h Hunk, opts ...SideBySideOption) string {
// Apply options to create the configuration
config := NewSideBySideConfig(opts...)
// Make a copy of the hunk so we don't modify the original
hunkCopy := Hunk{Lines: make([]DiffLine, len(h.Lines))}
copy(hunkCopy.Lines, h.Lines)
// Highlight changes within lines
HighlightIntralineChanges(&hunkCopy, config.Style)
// Pair lines for side-by-side display
pairs := pairLines(hunkCopy.Lines)
// Calculate column width
colWidth := config.TotalWidth / 2
leftWidth := colWidth
rightWidth := config.TotalWidth - colWidth
var sb strings.Builder
for _, p := range pairs {
leftStr := renderLeftColumn(fileName, p.left, leftWidth, config.Style)
rightStr := renderRightColumn(fileName, p.right, rightWidth, config.Style)
sb.WriteString(leftStr + rightStr + "\n")
}
return sb.String()
}
// FormatDiff creates a side-by-side formatted view of a diff
func FormatDiff(diffText string, opts ...SideBySideOption) (string, error) {
diffResult, err := ParseUnifiedDiff(diffText)
if err != nil {
return "", err
}
var sb strings.Builder
config := NewSideBySideConfig(opts...)
if config.Style.ShowHeader {
removeIcon := lipgloss.NewStyle().
Background(config.Style.RemovedLineBg).
Foreground(config.Style.RemovedFg).
Render("⏹")
addIcon := lipgloss.NewStyle().
Background(config.Style.AddedLineBg).
Foreground(config.Style.AddedFg).
Render("⏹")
fileName := lipgloss.NewStyle().
Background(config.Style.ContextLineBg).
Foreground(config.Style.FileNameFg).
Render(" " + diffResult.OldFile)
sb.WriteString(
lipgloss.NewStyle().
Background(config.Style.ContextLineBg).
Padding(0, 1, 0, 1).
Foreground(config.Style.FileNameFg).
BorderStyle(lipgloss.NormalBorder()).
BorderTop(true).
BorderBottom(true).
BorderForeground(config.Style.FileNameFg).
BorderBackground(config.Style.ContextLineBg).
Width(config.TotalWidth).
Render(
lipgloss.JoinHorizontal(lipgloss.Top,
removeIcon,
addIcon,
fileName,
),
) + "\n",
)
}
for _, h := range diffResult.Hunks {
// Render hunk header
if config.Style.ShowHunkHeader {
sb.WriteString(
lipgloss.NewStyle().
Background(config.Style.HunkLineBg).
Foreground(config.Style.HunkLineFg).
Width(config.TotalWidth).
Render(h.Header) + "\n",
)
}
sb.WriteString(RenderSideBySideHunk(diffResult.OldFile, h, opts...))
}
return sb.String(), nil
}
// GenerateDiff creates a unified diff from two file contents
func GenerateDiff(beforeContent, afterContent, fileName string) (string, int, int) {
// remove the cwd prefix and ensure consistent path format
// this prevents issues with absolute paths in different environments
cwd := config.WorkingDirectory()
fileName = strings.TrimPrefix(fileName, cwd)
fileName = strings.TrimPrefix(fileName, "/")
// Create temporary directory for git operations
tempDir, err := os.MkdirTemp("", fmt.Sprintf("git-diff-%d", time.Now().UnixNano()))
if err != nil {
logging.Error("Failed to create temp directory for git diff", "error", err)
return "", 0, 0
}
defer os.RemoveAll(tempDir)
// Initialize git repo
repo, err := git.PlainInit(tempDir, false)
if err != nil {
logging.Error("Failed to initialize git repository", "error", err)
return "", 0, 0
}
wt, err := repo.Worktree()
if err != nil {
logging.Error("Failed to get git worktree", "error", err)
return "", 0, 0
}
// Write the "before" content and commit it
fullPath := filepath.Join(tempDir, fileName)
if err = os.MkdirAll(filepath.Dir(fullPath), 0o755); err != nil {
logging.Error("Failed to create directory for file", "error", err)
return "", 0, 0
}
if err = os.WriteFile(fullPath, []byte(beforeContent), 0o644); err != nil {
logging.Error("Failed to write before content to file", "error", err)
return "", 0, 0
}
_, err = wt.Add(fileName)
if err != nil {
logging.Error("Failed to add file to git", "error", err)
return "", 0, 0
}
beforeCommit, err := wt.Commit("Before", &git.CommitOptions{
Author: &object.Signature{
Name: "OpenCode",
Email: "coder@opencode.ai",
When: time.Now(),
},
})
if err != nil {
logging.Error("Failed to commit before content", "error", err)
return "", 0, 0
}
// Write the "after" content and commit it
if err = os.WriteFile(fullPath, []byte(afterContent), 0o644); err != nil {
logging.Error("Failed to write after content to file", "error", err)
return "", 0, 0
}
_, err = wt.Add(fileName)
if err != nil {
logging.Error("Failed to add file to git", "error", err)
return "", 0, 0
}
afterCommit, err := wt.Commit("After", &git.CommitOptions{
Author: &object.Signature{
Name: "OpenCode",
Email: "coder@opencode.ai",
When: time.Now(),
},
})
if err != nil {
logging.Error("Failed to commit after content", "error", err)
return "", 0, 0
}
// Get the diff between the two commits
beforeCommitObj, err := repo.CommitObject(beforeCommit)
if err != nil {
logging.Error("Failed to get before commit object", "error", err)
return "", 0, 0
}
afterCommitObj, err := repo.CommitObject(afterCommit)
if err != nil {
logging.Error("Failed to get after commit object", "error", err)
return "", 0, 0
}
patch, err := beforeCommitObj.Patch(afterCommitObj)
if err != nil {
logging.Error("Failed to create git diff patch", "error", err)
return "", 0, 0
}
// Count additions and removals
additions := 0
removals := 0
for _, fileStat := range patch.Stats() {
additions += fileStat.Addition
removals += fileStat.Deletion
}
return patch.String(), additions, removals
}
+252
View File
@@ -0,0 +1,252 @@
package history
import (
"context"
"database/sql"
"fmt"
"strconv"
"strings"
"time"
"github.com/google/uuid"
"github.com/kujtimiihoxha/opencode/internal/db"
"github.com/kujtimiihoxha/opencode/internal/pubsub"
)
const (
InitialVersion = "initial"
)
type File struct {
ID string
SessionID string
Path string
Content string
Version string
CreatedAt int64
UpdatedAt int64
}
type Service interface {
pubsub.Suscriber[File]
Create(ctx context.Context, sessionID, path, content string) (File, error)
CreateVersion(ctx context.Context, sessionID, path, content string) (File, error)
Get(ctx context.Context, id string) (File, error)
GetByPathAndSession(ctx context.Context, path, sessionID string) (File, error)
ListBySession(ctx context.Context, sessionID string) ([]File, error)
ListLatestSessionFiles(ctx context.Context, sessionID string) ([]File, error)
Update(ctx context.Context, file File) (File, error)
Delete(ctx context.Context, id string) error
DeleteSessionFiles(ctx context.Context, sessionID string) error
}
type service struct {
*pubsub.Broker[File]
db *sql.DB
q *db.Queries
}
func NewService(q *db.Queries, db *sql.DB) Service {
return &service{
Broker: pubsub.NewBroker[File](),
q: q,
db: db,
}
}
func (s *service) Create(ctx context.Context, sessionID, path, content string) (File, error) {
return s.createWithVersion(ctx, sessionID, path, content, InitialVersion)
}
func (s *service) CreateVersion(ctx context.Context, sessionID, path, content string) (File, error) {
// Get the latest version for this path
files, err := s.q.ListFilesByPath(ctx, path)
if err != nil {
return File{}, err
}
if len(files) == 0 {
// No previous versions, create initial
return s.Create(ctx, sessionID, path, content)
}
// Get the latest version
latestFile := files[0] // Files are ordered by created_at DESC
latestVersion := latestFile.Version
// Generate the next version
var nextVersion string
if latestVersion == InitialVersion {
nextVersion = "v1"
} else if strings.HasPrefix(latestVersion, "v") {
versionNum, err := strconv.Atoi(latestVersion[1:])
if err != nil {
// If we can't parse the version, just use a timestamp-based version
nextVersion = fmt.Sprintf("v%d", latestFile.CreatedAt)
} else {
nextVersion = fmt.Sprintf("v%d", versionNum+1)
}
} else {
// If the version format is unexpected, use a timestamp-based version
nextVersion = fmt.Sprintf("v%d", latestFile.CreatedAt)
}
return s.createWithVersion(ctx, sessionID, path, content, nextVersion)
}
func (s *service) createWithVersion(ctx context.Context, sessionID, path, content, version string) (File, error) {
// Maximum number of retries for transaction conflicts
const maxRetries = 3
var file File
var err error
// Retry loop for transaction conflicts
for attempt := range maxRetries {
// Start a transaction
tx, txErr := s.db.Begin()
if txErr != nil {
return File{}, fmt.Errorf("failed to begin transaction: %w", txErr)
}
// Create a new queries instance with the transaction
qtx := s.q.WithTx(tx)
// Try to create the file within the transaction
dbFile, txErr := qtx.CreateFile(ctx, db.CreateFileParams{
ID: uuid.New().String(),
SessionID: sessionID,
Path: path,
Content: content,
Version: version,
})
if txErr != nil {
// Rollback the transaction
tx.Rollback()
// Check if this is a uniqueness constraint violation
if strings.Contains(txErr.Error(), "UNIQUE constraint failed") {
if attempt < maxRetries-1 {
// If we have retries left, generate a new version and try again
if strings.HasPrefix(version, "v") {
versionNum, parseErr := strconv.Atoi(version[1:])
if parseErr == nil {
version = fmt.Sprintf("v%d", versionNum+1)
continue
}
}
// If we can't parse the version, use a timestamp-based version
version = fmt.Sprintf("v%d", time.Now().Unix())
continue
}
}
return File{}, txErr
}
// Commit the transaction
if txErr = tx.Commit(); txErr != nil {
return File{}, fmt.Errorf("failed to commit transaction: %w", txErr)
}
file = s.fromDBItem(dbFile)
s.Publish(pubsub.CreatedEvent, file)
return file, nil
}
return file, err
}
func (s *service) Get(ctx context.Context, id string) (File, error) {
dbFile, err := s.q.GetFile(ctx, id)
if err != nil {
return File{}, err
}
return s.fromDBItem(dbFile), nil
}
func (s *service) GetByPathAndSession(ctx context.Context, path, sessionID string) (File, error) {
dbFile, err := s.q.GetFileByPathAndSession(ctx, db.GetFileByPathAndSessionParams{
Path: path,
SessionID: sessionID,
})
if err != nil {
return File{}, err
}
return s.fromDBItem(dbFile), nil
}
func (s *service) ListBySession(ctx context.Context, sessionID string) ([]File, error) {
dbFiles, err := s.q.ListFilesBySession(ctx, sessionID)
if err != nil {
return nil, err
}
files := make([]File, len(dbFiles))
for i, dbFile := range dbFiles {
files[i] = s.fromDBItem(dbFile)
}
return files, nil
}
func (s *service) ListLatestSessionFiles(ctx context.Context, sessionID string) ([]File, error) {
dbFiles, err := s.q.ListLatestSessionFiles(ctx, sessionID)
if err != nil {
return nil, err
}
files := make([]File, len(dbFiles))
for i, dbFile := range dbFiles {
files[i] = s.fromDBItem(dbFile)
}
return files, nil
}
func (s *service) Update(ctx context.Context, file File) (File, error) {
dbFile, err := s.q.UpdateFile(ctx, db.UpdateFileParams{
ID: file.ID,
Content: file.Content,
Version: file.Version,
})
if err != nil {
return File{}, err
}
updatedFile := s.fromDBItem(dbFile)
s.Publish(pubsub.UpdatedEvent, updatedFile)
return updatedFile, nil
}
func (s *service) Delete(ctx context.Context, id string) error {
file, err := s.Get(ctx, id)
if err != nil {
return err
}
err = s.q.DeleteFile(ctx, id)
if err != nil {
return err
}
s.Publish(pubsub.DeletedEvent, file)
return nil
}
func (s *service) DeleteSessionFiles(ctx context.Context, sessionID string) error {
files, err := s.ListBySession(ctx, sessionID)
if err != nil {
return err
}
for _, file := range files {
err = s.Delete(ctx, file.ID)
if err != nil {
return err
}
}
return nil
}
func (s *service) fromDBItem(item db.File) File {
return File{
ID: item.ID,
SessionID: item.SessionID,
Path: item.Path,
Content: item.Content,
Version: item.Version,
CreatedAt: item.CreatedAt,
UpdatedAt: item.UpdatedAt,
}
}
+111
View File
@@ -0,0 +1,111 @@
package agent
import (
"context"
"encoding/json"
"fmt"
"github.com/kujtimiihoxha/opencode/internal/config"
"github.com/kujtimiihoxha/opencode/internal/llm/tools"
"github.com/kujtimiihoxha/opencode/internal/lsp"
"github.com/kujtimiihoxha/opencode/internal/message"
"github.com/kujtimiihoxha/opencode/internal/session"
)
type agentTool struct {
sessions session.Service
messages message.Service
lspClients map[string]*lsp.Client
}
const (
AgentToolName = "agent"
)
type AgentParams struct {
Prompt string `json:"prompt"`
}
func (b *agentTool) Info() tools.ToolInfo {
return tools.ToolInfo{
Name: AgentToolName,
Description: "Launch a new agent that has access to the following tools: GlobTool, GrepTool, LS, View. When you are searching for a keyword or file and are not confident that you will find the right match on the first try, use the Agent tool to perform the search for you. For example:\n\n- If you are searching for a keyword like \"config\" or \"logger\", or for questions like \"which file does X?\", the Agent tool is strongly recommended\n- If you want to read a specific file path, use the View or GlobTool tool instead of the Agent tool, to find the match more quickly\n- If you are searching for a specific class definition like \"class Foo\", use the GlobTool tool instead, to find the match more quickly\n\nUsage notes:\n1. Launch multiple agents concurrently whenever possible, to maximize performance; to do that, use a single message with multiple tool uses\n2. When the agent is done, it will return a single message back to you. The result returned by the agent is not visible to the user. To show the user the result, you should send a text message back to the user with a concise summary of the result.\n3. Each agent invocation is stateless. You will not be able to send additional messages to the agent, nor will the agent be able to communicate with you outside of its final report. Therefore, your prompt should contain a highly detailed task description for the agent to perform autonomously and you should specify exactly what information the agent should return back to you in its final and only message to you.\n4. The agent's outputs should generally be trusted\n5. IMPORTANT: The agent can not use Bash, Replace, Edit, so can not modify files. If you want to use these tools, use them directly instead of going through the agent.",
Parameters: map[string]any{
"prompt": map[string]any{
"type": "string",
"description": "The task for the agent to perform",
},
},
Required: []string{"prompt"},
}
}
func (b *agentTool) Run(ctx context.Context, call tools.ToolCall) (tools.ToolResponse, error) {
var params AgentParams
if err := json.Unmarshal([]byte(call.Input), &params); err != nil {
return tools.NewTextErrorResponse(fmt.Sprintf("error parsing parameters: %s", err)), nil
}
if params.Prompt == "" {
return tools.NewTextErrorResponse("prompt is required"), nil
}
sessionID, messageID := tools.GetContextValues(ctx)
if sessionID == "" || messageID == "" {
return tools.ToolResponse{}, fmt.Errorf("session_id and message_id are required")
}
agent, err := NewAgent(config.AgentTask, b.sessions, b.messages, TaskAgentTools(b.lspClients))
if err != nil {
return tools.ToolResponse{}, fmt.Errorf("error creating agent: %s", err)
}
session, err := b.sessions.CreateTaskSession(ctx, call.ID, sessionID, "New Agent Session")
if err != nil {
return tools.ToolResponse{}, fmt.Errorf("error creating session: %s", err)
}
done, err := agent.Run(ctx, session.ID, params.Prompt)
if err != nil {
return tools.ToolResponse{}, fmt.Errorf("error generating agent: %s", err)
}
result := <-done
if result.Err() != nil {
return tools.ToolResponse{}, fmt.Errorf("error generating agent: %s", result.Err())
}
response := result.Response()
if response.Role != message.Assistant {
return tools.NewTextErrorResponse("no response"), nil
}
updatedSession, err := b.sessions.Get(ctx, session.ID)
if err != nil {
return tools.ToolResponse{}, fmt.Errorf("error getting session: %s", err)
}
parentSession, err := b.sessions.Get(ctx, sessionID)
if err != nil {
return tools.ToolResponse{}, fmt.Errorf("error getting parent session: %s", err)
}
parentSession.Cost += updatedSession.Cost
parentSession.PromptTokens += updatedSession.PromptTokens
parentSession.CompletionTokens += updatedSession.CompletionTokens
_, err = b.sessions.Save(ctx, parentSession)
if err != nil {
return tools.ToolResponse{}, fmt.Errorf("error saving parent session: %s", err)
}
return tools.NewTextResponse(response.Content().String()), nil
}
func NewAgentTool(
Sessions session.Service,
Messages message.Service,
LspClients map[string]*lsp.Client,
) tools.BaseTool {
return &agentTool{
sessions: Sessions,
messages: Messages,
lspClients: LspClients,
}
}
+491
View File
@@ -0,0 +1,491 @@
package agent
import (
"context"
"errors"
"fmt"
"strings"
"sync"
"github.com/kujtimiihoxha/opencode/internal/config"
"github.com/kujtimiihoxha/opencode/internal/llm/models"
"github.com/kujtimiihoxha/opencode/internal/llm/prompt"
"github.com/kujtimiihoxha/opencode/internal/llm/provider"
"github.com/kujtimiihoxha/opencode/internal/llm/tools"
"github.com/kujtimiihoxha/opencode/internal/logging"
"github.com/kujtimiihoxha/opencode/internal/message"
"github.com/kujtimiihoxha/opencode/internal/permission"
"github.com/kujtimiihoxha/opencode/internal/session"
)
// Common errors
var (
ErrRequestCancelled = errors.New("request cancelled by user")
ErrSessionBusy = errors.New("session is currently processing another request")
)
type AgentEvent struct {
message message.Message
err error
}
func (e *AgentEvent) Err() error {
return e.err
}
func (e *AgentEvent) Response() message.Message {
return e.message
}
type Service interface {
Run(ctx context.Context, sessionID string, content string) (<-chan AgentEvent, error)
Cancel(sessionID string)
IsSessionBusy(sessionID string) bool
IsBusy() bool
}
type agent struct {
sessions session.Service
messages message.Service
tools []tools.BaseTool
provider provider.Provider
titleProvider provider.Provider
activeRequests sync.Map
}
func NewAgent(
agentName config.AgentName,
sessions session.Service,
messages message.Service,
agentTools []tools.BaseTool,
) (Service, error) {
agentProvider, err := createAgentProvider(agentName)
if err != nil {
return nil, err
}
var titleProvider provider.Provider
// Only generate titles for the coder agent
if agentName == config.AgentCoder {
titleProvider, err = createAgentProvider(config.AgentTitle)
if err != nil {
return nil, err
}
}
agent := &agent{
provider: agentProvider,
messages: messages,
sessions: sessions,
tools: agentTools,
titleProvider: titleProvider,
activeRequests: sync.Map{},
}
return agent, nil
}
func (a *agent) Cancel(sessionID string) {
if cancelFunc, exists := a.activeRequests.LoadAndDelete(sessionID); exists {
if cancel, ok := cancelFunc.(context.CancelFunc); ok {
logging.InfoPersist(fmt.Sprintf("Request cancellation initiated for session: %s", sessionID))
cancel()
}
}
}
func (a *agent) IsBusy() bool {
busy := false
a.activeRequests.Range(func(key, value interface{}) bool {
if cancelFunc, ok := value.(context.CancelFunc); ok {
if cancelFunc != nil {
busy = true
return false // Stop iterating
}
}
return true // Continue iterating
})
return busy
}
func (a *agent) IsSessionBusy(sessionID string) bool {
_, busy := a.activeRequests.Load(sessionID)
return busy
}
func (a *agent) generateTitle(ctx context.Context, sessionID string, content string) error {
if a.titleProvider == nil {
return nil
}
session, err := a.sessions.Get(ctx, sessionID)
if err != nil {
return err
}
response, err := a.titleProvider.SendMessages(
ctx,
[]message.Message{
{
Role: message.User,
Parts: []message.ContentPart{
message.TextContent{
Text: content,
},
},
},
},
make([]tools.BaseTool, 0),
)
if err != nil {
return err
}
title := strings.TrimSpace(strings.ReplaceAll(response.Content, "\n", " "))
if title == "" {
return nil
}
session.Title = title
_, err = a.sessions.Save(ctx, session)
return err
}
func (a *agent) err(err error) AgentEvent {
return AgentEvent{
err: err,
}
}
func (a *agent) Run(ctx context.Context, sessionID string, content string) (<-chan AgentEvent, error) {
events := make(chan AgentEvent)
if a.IsSessionBusy(sessionID) {
return nil, ErrSessionBusy
}
genCtx, cancel := context.WithCancel(ctx)
a.activeRequests.Store(sessionID, cancel)
go func() {
logging.Debug("Request started", "sessionID", sessionID)
defer logging.RecoverPanic("agent.Run", func() {
events <- a.err(fmt.Errorf("panic while running the agent"))
})
result := a.processGeneration(genCtx, sessionID, content)
if result.Err() != nil && !errors.Is(result.Err(), ErrRequestCancelled) && !errors.Is(result.Err(), context.Canceled) {
logging.ErrorPersist(fmt.Sprintf("Generation error for session %s: %v", sessionID, result))
}
logging.Debug("Request completed", "sessionID", sessionID)
a.activeRequests.Delete(sessionID)
cancel()
events <- result
close(events)
}()
return events, nil
}
func (a *agent) processGeneration(ctx context.Context, sessionID, content string) AgentEvent {
// List existing messages; if none, start title generation asynchronously.
msgs, err := a.messages.List(ctx, sessionID)
if err != nil {
return a.err(fmt.Errorf("failed to list messages: %w", err))
}
if len(msgs) == 0 {
go func() {
defer logging.RecoverPanic("agent.Run", func() {
logging.ErrorPersist("panic while generating title")
})
titleErr := a.generateTitle(context.Background(), sessionID, content)
if titleErr != nil {
logging.ErrorPersist(fmt.Sprintf("failed to generate title: %v", titleErr))
}
}()
}
userMsg, err := a.createUserMessage(ctx, sessionID, content)
if err != nil {
return a.err(fmt.Errorf("failed to create user message: %w", err))
}
// Append the new user message to the conversation history.
msgHistory := append(msgs, userMsg)
for {
// Check for cancellation before each iteration
select {
case <-ctx.Done():
return a.err(ctx.Err())
default:
// Continue processing
}
agentMessage, toolResults, err := a.streamAndHandleEvents(ctx, sessionID, msgHistory)
if err != nil {
if errors.Is(err, context.Canceled) {
agentMessage.AddFinish(message.FinishReasonCanceled)
a.messages.Update(context.Background(), agentMessage)
return a.err(ErrRequestCancelled)
}
return a.err(fmt.Errorf("failed to process events: %w", err))
}
logging.Info("Result", "message", agentMessage.FinishReason(), "toolResults", toolResults)
if (agentMessage.FinishReason() == message.FinishReasonToolUse) && toolResults != nil {
// We are not done, we need to respond with the tool response
msgHistory = append(msgHistory, agentMessage, *toolResults)
continue
}
return AgentEvent{
message: agentMessage,
}
}
}
func (a *agent) createUserMessage(ctx context.Context, sessionID, content string) (message.Message, error) {
return a.messages.Create(ctx, sessionID, message.CreateMessageParams{
Role: message.User,
Parts: []message.ContentPart{
message.TextContent{Text: content},
},
})
}
func (a *agent) streamAndHandleEvents(ctx context.Context, sessionID string, msgHistory []message.Message) (message.Message, *message.Message, error) {
eventChan := a.provider.StreamResponse(ctx, msgHistory, a.tools)
assistantMsg, err := a.messages.Create(ctx, sessionID, message.CreateMessageParams{
Role: message.Assistant,
Parts: []message.ContentPart{},
Model: a.provider.Model().ID,
})
if err != nil {
return assistantMsg, nil, fmt.Errorf("failed to create assistant message: %w", err)
}
// Add the session and message ID into the context if needed by tools.
ctx = context.WithValue(ctx, tools.MessageIDContextKey, assistantMsg.ID)
ctx = context.WithValue(ctx, tools.SessionIDContextKey, sessionID)
// Process each event in the stream.
for event := range eventChan {
if processErr := a.processEvent(ctx, sessionID, &assistantMsg, event); processErr != nil {
a.finishMessage(ctx, &assistantMsg, message.FinishReasonCanceled)
return assistantMsg, nil, processErr
}
if ctx.Err() != nil {
a.finishMessage(context.Background(), &assistantMsg, message.FinishReasonCanceled)
return assistantMsg, nil, ctx.Err()
}
}
toolResults := make([]message.ToolResult, len(assistantMsg.ToolCalls()))
toolCalls := assistantMsg.ToolCalls()
for i, toolCall := range toolCalls {
select {
case <-ctx.Done():
a.finishMessage(context.Background(), &assistantMsg, message.FinishReasonCanceled)
// Make all future tool calls cancelled
for j := i; j < len(toolCalls); j++ {
toolResults[j] = message.ToolResult{
ToolCallID: toolCalls[j].ID,
Content: "Tool execution canceled by user",
IsError: true,
}
}
goto out
default:
// Continue processing
var tool tools.BaseTool
for _, availableTools := range a.tools {
if availableTools.Info().Name == toolCall.Name {
tool = availableTools
}
}
// Tool not found
if tool == nil {
toolResults[i] = message.ToolResult{
ToolCallID: toolCall.ID,
Content: fmt.Sprintf("Tool not found: %s", toolCall.Name),
IsError: true,
}
continue
}
toolResult, toolErr := tool.Run(ctx, tools.ToolCall{
ID: toolCall.ID,
Name: toolCall.Name,
Input: toolCall.Input,
})
if toolErr != nil {
if errors.Is(toolErr, permission.ErrorPermissionDenied) {
toolResults[i] = message.ToolResult{
ToolCallID: toolCall.ID,
Content: "Permission denied",
IsError: true,
}
for j := i + 1; j < len(toolCalls); j++ {
toolResults[j] = message.ToolResult{
ToolCallID: toolCalls[j].ID,
Content: "Tool execution canceled by user",
IsError: true,
}
}
a.finishMessage(ctx, &assistantMsg, message.FinishReasonPermissionDenied)
break
}
}
toolResults[i] = message.ToolResult{
ToolCallID: toolCall.ID,
Content: toolResult.Content,
Metadata: toolResult.Metadata,
IsError: toolResult.IsError,
}
}
}
out:
if len(toolResults) == 0 {
return assistantMsg, nil, nil
}
parts := make([]message.ContentPart, 0)
for _, tr := range toolResults {
parts = append(parts, tr)
}
msg, err := a.messages.Create(context.Background(), assistantMsg.SessionID, message.CreateMessageParams{
Role: message.Tool,
Parts: parts,
})
if err != nil {
return assistantMsg, nil, fmt.Errorf("failed to create cancelled tool message: %w", err)
}
return assistantMsg, &msg, err
}
func (a *agent) finishMessage(ctx context.Context, msg *message.Message, finishReson message.FinishReason) {
msg.AddFinish(finishReson)
_ = a.messages.Update(ctx, *msg)
}
func (a *agent) processEvent(ctx context.Context, sessionID string, assistantMsg *message.Message, event provider.ProviderEvent) error {
select {
case <-ctx.Done():
return ctx.Err()
default:
// Continue processing.
}
switch event.Type {
case provider.EventThinkingDelta:
assistantMsg.AppendReasoningContent(event.Content)
return a.messages.Update(ctx, *assistantMsg)
case provider.EventContentDelta:
assistantMsg.AppendContent(event.Content)
return a.messages.Update(ctx, *assistantMsg)
case provider.EventToolUseStart:
assistantMsg.AddToolCall(*event.ToolCall)
return a.messages.Update(ctx, *assistantMsg)
// TODO: see how to handle this
// case provider.EventToolUseDelta:
// tm := time.Unix(assistantMsg.UpdatedAt, 0)
// assistantMsg.AppendToolCallInput(event.ToolCall.ID, event.ToolCall.Input)
// if time.Since(tm) > 1000*time.Millisecond {
// err := a.messages.Update(ctx, *assistantMsg)
// assistantMsg.UpdatedAt = time.Now().Unix()
// return err
// }
case provider.EventToolUseStop:
assistantMsg.FinishToolCall(event.ToolCall.ID)
return a.messages.Update(ctx, *assistantMsg)
case provider.EventError:
if errors.Is(event.Error, context.Canceled) {
logging.InfoPersist(fmt.Sprintf("Event processing canceled for session: %s", sessionID))
return context.Canceled
}
logging.ErrorPersist(event.Error.Error())
return event.Error
case provider.EventComplete:
assistantMsg.SetToolCalls(event.Response.ToolCalls)
assistantMsg.AddFinish(event.Response.FinishReason)
if err := a.messages.Update(ctx, *assistantMsg); err != nil {
return fmt.Errorf("failed to update message: %w", err)
}
return a.TrackUsage(ctx, sessionID, a.provider.Model(), event.Response.Usage)
}
return nil
}
func (a *agent) TrackUsage(ctx context.Context, sessionID string, model models.Model, usage provider.TokenUsage) error {
sess, err := a.sessions.Get(ctx, sessionID)
if err != nil {
return fmt.Errorf("failed to get session: %w", err)
}
cost := model.CostPer1MInCached/1e6*float64(usage.CacheCreationTokens) +
model.CostPer1MOutCached/1e6*float64(usage.CacheReadTokens) +
model.CostPer1MIn/1e6*float64(usage.InputTokens) +
model.CostPer1MOut/1e6*float64(usage.OutputTokens)
sess.Cost += cost
sess.CompletionTokens += usage.OutputTokens
sess.PromptTokens += usage.InputTokens
_, err = a.sessions.Save(ctx, sess)
if err != nil {
return fmt.Errorf("failed to save session: %w", err)
}
return nil
}
func createAgentProvider(agentName config.AgentName) (provider.Provider, error) {
cfg := config.Get()
agentConfig, ok := cfg.Agents[agentName]
if !ok {
return nil, fmt.Errorf("agent %s not found", agentName)
}
model, ok := models.SupportedModels[agentConfig.Model]
if !ok {
return nil, fmt.Errorf("model %s not supported", agentConfig.Model)
}
providerCfg, ok := cfg.Providers[model.Provider]
if !ok {
return nil, fmt.Errorf("provider %s not supported", model.Provider)
}
if providerCfg.Disabled {
return nil, fmt.Errorf("provider %s is not enabled", model.Provider)
}
maxTokens := model.DefaultMaxTokens
if agentConfig.MaxTokens > 0 {
maxTokens = agentConfig.MaxTokens
}
opts := []provider.ProviderClientOption{
provider.WithAPIKey(providerCfg.APIKey),
provider.WithModel(model),
provider.WithSystemMessage(prompt.GetAgentPrompt(agentName, model.Provider)),
provider.WithMaxTokens(maxTokens),
}
if model.Provider == models.ProviderOpenAI && model.CanReason {
opts = append(
opts,
provider.WithOpenAIOptions(
provider.WithReasoningEffort(agentConfig.ReasoningEffort),
),
)
} else if model.Provider == models.ProviderAnthropic && model.CanReason && agentName == config.AgentCoder {
opts = append(
opts,
provider.WithAnthropicOptions(
provider.WithAnthropicShouldThinkFn(provider.DefaultShouldThinkFn),
),
)
}
agentProvider, err := provider.NewProvider(
model.Provider,
opts...,
)
if err != nil {
return nil, fmt.Errorf("could not create provider: %v", err)
}
return agentProvider, nil
}
+197
View File
@@ -0,0 +1,197 @@
package agent
import (
"context"
"encoding/json"
"fmt"
"github.com/kujtimiihoxha/opencode/internal/config"
"github.com/kujtimiihoxha/opencode/internal/llm/tools"
"github.com/kujtimiihoxha/opencode/internal/logging"
"github.com/kujtimiihoxha/opencode/internal/permission"
"github.com/kujtimiihoxha/opencode/internal/version"
"github.com/mark3labs/mcp-go/client"
"github.com/mark3labs/mcp-go/mcp"
)
type mcpTool struct {
mcpName string
tool mcp.Tool
mcpConfig config.MCPServer
permissions permission.Service
}
type MCPClient interface {
Initialize(
ctx context.Context,
request mcp.InitializeRequest,
) (*mcp.InitializeResult, error)
ListTools(ctx context.Context, request mcp.ListToolsRequest) (*mcp.ListToolsResult, error)
CallTool(ctx context.Context, request mcp.CallToolRequest) (*mcp.CallToolResult, error)
Close() error
}
func (b *mcpTool) Info() tools.ToolInfo {
return tools.ToolInfo{
Name: fmt.Sprintf("%s_%s", b.mcpName, b.tool.Name),
Description: b.tool.Description,
Parameters: b.tool.InputSchema.Properties,
Required: b.tool.InputSchema.Required,
}
}
func runTool(ctx context.Context, c MCPClient, toolName string, input string) (tools.ToolResponse, error) {
defer c.Close()
initRequest := mcp.InitializeRequest{}
initRequest.Params.ProtocolVersion = mcp.LATEST_PROTOCOL_VERSION
initRequest.Params.ClientInfo = mcp.Implementation{
Name: "OpenCode",
Version: version.Version,
}
_, err := c.Initialize(ctx, initRequest)
if err != nil {
return tools.NewTextErrorResponse(err.Error()), nil
}
toolRequest := mcp.CallToolRequest{}
toolRequest.Params.Name = toolName
var args map[string]any
if err = json.Unmarshal([]byte(input), &input); err != nil {
return tools.NewTextErrorResponse(fmt.Sprintf("error parsing parameters: %s", err)), nil
}
toolRequest.Params.Arguments = args
result, err := c.CallTool(ctx, toolRequest)
if err != nil {
return tools.NewTextErrorResponse(err.Error()), nil
}
output := ""
for _, v := range result.Content {
if v, ok := v.(mcp.TextContent); ok {
output = v.Text
} else {
output = fmt.Sprintf("%v", v)
}
}
return tools.NewTextResponse(output), nil
}
func (b *mcpTool) Run(ctx context.Context, params tools.ToolCall) (tools.ToolResponse, error) {
sessionID, messageID := tools.GetContextValues(ctx)
if sessionID == "" || messageID == "" {
return tools.ToolResponse{}, fmt.Errorf("session ID and message ID are required for creating a new file")
}
permissionDescription := fmt.Sprintf("execute %s with the following parameters: %s", b.Info().Name, params.Input)
p := b.permissions.Request(
permission.CreatePermissionRequest{
SessionID: sessionID,
Path: config.WorkingDirectory(),
ToolName: b.Info().Name,
Action: "execute",
Description: permissionDescription,
Params: params.Input,
},
)
if !p {
return tools.NewTextErrorResponse("permission denied"), nil
}
switch b.mcpConfig.Type {
case config.MCPStdio:
c, err := client.NewStdioMCPClient(
b.mcpConfig.Command,
b.mcpConfig.Env,
b.mcpConfig.Args...,
)
if err != nil {
return tools.NewTextErrorResponse(err.Error()), nil
}
return runTool(ctx, c, b.tool.Name, params.Input)
case config.MCPSse:
c, err := client.NewSSEMCPClient(
b.mcpConfig.URL,
client.WithHeaders(b.mcpConfig.Headers),
)
if err != nil {
return tools.NewTextErrorResponse(err.Error()), nil
}
return runTool(ctx, c, b.tool.Name, params.Input)
}
return tools.NewTextErrorResponse("invalid mcp type"), nil
}
func NewMcpTool(name string, tool mcp.Tool, permissions permission.Service, mcpConfig config.MCPServer) tools.BaseTool {
return &mcpTool{
mcpName: name,
tool: tool,
mcpConfig: mcpConfig,
permissions: permissions,
}
}
var mcpTools []tools.BaseTool
func getTools(ctx context.Context, name string, m config.MCPServer, permissions permission.Service, c MCPClient) []tools.BaseTool {
var stdioTools []tools.BaseTool
initRequest := mcp.InitializeRequest{}
initRequest.Params.ProtocolVersion = mcp.LATEST_PROTOCOL_VERSION
initRequest.Params.ClientInfo = mcp.Implementation{
Name: "OpenCode",
Version: version.Version,
}
_, err := c.Initialize(ctx, initRequest)
if err != nil {
logging.Error("error initializing mcp client", "error", err)
return stdioTools
}
toolsRequest := mcp.ListToolsRequest{}
tools, err := c.ListTools(ctx, toolsRequest)
if err != nil {
logging.Error("error listing tools", "error", err)
return stdioTools
}
for _, t := range tools.Tools {
stdioTools = append(stdioTools, NewMcpTool(name, t, permissions, m))
}
defer c.Close()
return stdioTools
}
func GetMcpTools(ctx context.Context, permissions permission.Service) []tools.BaseTool {
if len(mcpTools) > 0 {
return mcpTools
}
for name, m := range config.Get().MCPServers {
switch m.Type {
case config.MCPStdio:
c, err := client.NewStdioMCPClient(
m.Command,
m.Env,
m.Args...,
)
if err != nil {
logging.Error("error creating mcp client", "error", err)
continue
}
mcpTools = append(mcpTools, getTools(ctx, name, m, permissions, c)...)
case config.MCPSse:
c, err := client.NewSSEMCPClient(
m.URL,
client.WithHeaders(m.Headers),
)
if err != nil {
logging.Error("error creating mcp client", "error", err)
continue
}
mcpTools = append(mcpTools, getTools(ctx, name, m, permissions, c)...)
}
}
return mcpTools
}
+51
View File
@@ -0,0 +1,51 @@
package agent
import (
"context"
"github.com/kujtimiihoxha/opencode/internal/history"
"github.com/kujtimiihoxha/opencode/internal/llm/tools"
"github.com/kujtimiihoxha/opencode/internal/lsp"
"github.com/kujtimiihoxha/opencode/internal/message"
"github.com/kujtimiihoxha/opencode/internal/permission"
"github.com/kujtimiihoxha/opencode/internal/session"
)
func CoderAgentTools(
permissions permission.Service,
sessions session.Service,
messages message.Service,
history history.Service,
lspClients map[string]*lsp.Client,
) []tools.BaseTool {
ctx := context.Background()
otherTools := GetMcpTools(ctx, permissions)
if len(lspClients) > 0 {
otherTools = append(otherTools, tools.NewDiagnosticsTool(lspClients))
}
return append(
[]tools.BaseTool{
tools.NewBashTool(permissions),
tools.NewEditTool(lspClients, permissions, history),
tools.NewFetchTool(permissions),
tools.NewGlobTool(),
tools.NewGrepTool(),
tools.NewLsTool(),
tools.NewSourcegraphTool(),
tools.NewViewTool(lspClients),
tools.NewPatchTool(lspClients, permissions, history),
tools.NewWriteTool(lspClients, permissions, history),
NewAgentTool(sessions, messages, lspClients),
}, otherTools...,
)
}
func TaskAgentTools(lspClients map[string]*lsp.Client) []tools.BaseTool {
return []tools.BaseTool{
tools.NewGlobTool(),
tools.NewGrepTool(),
tools.NewLsTool(),
tools.NewSourcegraphTool(),
tools.NewViewTool(lspClients),
}
}
+77
View File
@@ -0,0 +1,77 @@
package models
const (
ProviderAnthropic ModelProvider = "anthropic"
// Models
Claude35Sonnet ModelID = "claude-3.5-sonnet"
Claude3Haiku ModelID = "claude-3-haiku"
Claude37Sonnet ModelID = "claude-3.7-sonnet"
Claude35Haiku ModelID = "claude-3.5-haiku"
Claude3Opus ModelID = "claude-3-opus"
)
var AnthropicModels = map[ModelID]Model{
// Anthropic
Claude35Sonnet: {
ID: Claude35Sonnet,
Name: "Claude 3.5 Sonnet",
Provider: ProviderAnthropic,
APIModel: "claude-3-5-sonnet-latest",
CostPer1MIn: 3.0,
CostPer1MInCached: 3.75,
CostPer1MOutCached: 0.30,
CostPer1MOut: 15.0,
ContextWindow: 200000,
DefaultMaxTokens: 5000,
},
Claude3Haiku: {
ID: Claude3Haiku,
Name: "Claude 3 Haiku",
Provider: ProviderAnthropic,
APIModel: "claude-3-haiku-latest",
CostPer1MIn: 0.25,
CostPer1MInCached: 0.30,
CostPer1MOutCached: 0.03,
CostPer1MOut: 1.25,
ContextWindow: 200000,
DefaultMaxTokens: 5000,
},
Claude37Sonnet: {
ID: Claude37Sonnet,
Name: "Claude 3.7 Sonnet",
Provider: ProviderAnthropic,
APIModel: "claude-3-7-sonnet-latest",
CostPer1MIn: 3.0,
CostPer1MInCached: 3.75,
CostPer1MOutCached: 0.30,
CostPer1MOut: 15.0,
ContextWindow: 200000,
DefaultMaxTokens: 50000,
CanReason: true,
},
Claude35Haiku: {
ID: Claude35Haiku,
Name: "Claude 3.5 Haiku",
Provider: ProviderAnthropic,
APIModel: "claude-3-5-haiku-latest",
CostPer1MIn: 0.80,
CostPer1MInCached: 1.0,
CostPer1MOutCached: 0.08,
CostPer1MOut: 4.0,
ContextWindow: 200000,
DefaultMaxTokens: 4096,
},
Claude3Opus: {
ID: Claude3Opus,
Name: "Claude 3 Opus",
Provider: ProviderAnthropic,
APIModel: "claude-3-opus-latest",
CostPer1MIn: 15.0,
CostPer1MInCached: 18.75,
CostPer1MOutCached: 1.50,
CostPer1MOut: 75.0,
ContextWindow: 200000,
DefaultMaxTokens: 4096,
},
}
+63
View File
@@ -0,0 +1,63 @@
package models
const (
ProviderGemini ModelProvider = "gemini"
// Models
Gemini25Flash ModelID = "gemini-2.5-flash"
Gemini25 ModelID = "gemini-2.5"
Gemini20Flash ModelID = "gemini-2.0-flash"
Gemini20FlashLite ModelID = "gemini-2.0-flash-lite"
)
var GeminiModels = map[ModelID]Model{
Gemini25Flash: {
ID: Gemini25Flash,
Name: "Gemini 2.5 Flash",
Provider: ProviderGemini,
APIModel: "gemini-2.5-flash-preview-04-17",
CostPer1MIn: 0.15,
CostPer1MInCached: 0,
CostPer1MOutCached: 0,
CostPer1MOut: 0.60,
ContextWindow: 1000000,
DefaultMaxTokens: 50000,
},
Gemini25: {
ID: Gemini25,
Name: "Gemini 2.5 Pro",
Provider: ProviderGemini,
APIModel: "gemini-2.5-pro-preview-03-25",
CostPer1MIn: 1.25,
CostPer1MInCached: 0,
CostPer1MOutCached: 0,
CostPer1MOut: 10,
ContextWindow: 1000000,
DefaultMaxTokens: 50000,
},
Gemini20Flash: {
ID: Gemini20Flash,
Name: "Gemini 2.0 Flash",
Provider: ProviderGemini,
APIModel: "gemini-2.0-flash",
CostPer1MIn: 0.10,
CostPer1MInCached: 0,
CostPer1MOutCached: 0,
CostPer1MOut: 0.40,
ContextWindow: 1000000,
DefaultMaxTokens: 6000,
},
Gemini20FlashLite: {
ID: Gemini20FlashLite,
Name: "Gemini 2.0 Flash Lite",
Provider: ProviderGemini,
APIModel: "gemini-2.0-flash-lite",
CostPer1MIn: 0.05,
CostPer1MInCached: 0,
CostPer1MOutCached: 0,
CostPer1MOut: 0.30,
ContextWindow: 1000000,
DefaultMaxTokens: 6000,
},
}
+95
View File
@@ -0,0 +1,95 @@
package models
import "maps"
type (
ModelID string
ModelProvider string
)
type Model struct {
ID ModelID `json:"id"`
Name string `json:"name"`
Provider ModelProvider `json:"provider"`
APIModel string `json:"api_model"`
CostPer1MIn float64 `json:"cost_per_1m_in"`
CostPer1MOut float64 `json:"cost_per_1m_out"`
CostPer1MInCached float64 `json:"cost_per_1m_in_cached"`
CostPer1MOutCached float64 `json:"cost_per_1m_out_cached"`
ContextWindow int64 `json:"context_window"`
DefaultMaxTokens int64 `json:"default_max_tokens"`
CanReason bool `json:"can_reason"`
}
// Model IDs
const ( // GEMINI
// GROQ
QWENQwq ModelID = "qwen-qwq"
// Bedrock
BedrockClaude37Sonnet ModelID = "bedrock.claude-3.7-sonnet"
)
const (
ProviderBedrock ModelProvider = "bedrock"
ProviderGROQ ModelProvider = "groq"
// ForTests
ProviderMock ModelProvider = "__mock"
)
var SupportedModels = map[ModelID]Model{
//
// // GEMINI
// GEMINI25: {
// ID: GEMINI25,
// Name: "Gemini 2.5 Pro",
// Provider: ProviderGemini,
// APIModel: "gemini-2.5-pro-exp-03-25",
// CostPer1MIn: 0,
// CostPer1MInCached: 0,
// CostPer1MOutCached: 0,
// CostPer1MOut: 0,
// },
//
// GRMINI20Flash: {
// ID: GRMINI20Flash,
// Name: "Gemini 2.0 Flash",
// Provider: ProviderGemini,
// APIModel: "gemini-2.0-flash",
// CostPer1MIn: 0.1,
// CostPer1MInCached: 0,
// CostPer1MOutCached: 0.025,
// CostPer1MOut: 0.4,
// },
//
// // GROQ
// QWENQwq: {
// ID: QWENQwq,
// Name: "Qwen Qwq",
// Provider: ProviderGROQ,
// APIModel: "qwen-qwq-32b",
// CostPer1MIn: 0,
// CostPer1MInCached: 0,
// CostPer1MOutCached: 0,
// CostPer1MOut: 0,
// },
//
// // Bedrock
BedrockClaude37Sonnet: {
ID: BedrockClaude37Sonnet,
Name: "Bedrock: Claude 3.7 Sonnet",
Provider: ProviderBedrock,
APIModel: "anthropic.claude-3-7-sonnet-20250219-v1:0",
CostPer1MIn: 3.0,
CostPer1MInCached: 3.75,
CostPer1MOutCached: 0.30,
CostPer1MOut: 15.0,
},
}
func init() {
maps.Copy(SupportedModels, AnthropicModels)
maps.Copy(SupportedModels, OpenAIModels)
maps.Copy(SupportedModels, GeminiModels)
}
+169
View File
@@ -0,0 +1,169 @@
package models
const (
ProviderOpenAI ModelProvider = "openai"
GPT41 ModelID = "gpt-4.1"
GPT41Mini ModelID = "gpt-4.1-mini"
GPT41Nano ModelID = "gpt-4.1-nano"
GPT45Preview ModelID = "gpt-4.5-preview"
GPT4o ModelID = "gpt-4o"
GPT4oMini ModelID = "gpt-4o-mini"
O1 ModelID = "o1"
O1Pro ModelID = "o1-pro"
O1Mini ModelID = "o1-mini"
O3 ModelID = "o3"
O3Mini ModelID = "o3-mini"
O4Mini ModelID = "o4-mini"
)
var OpenAIModels = map[ModelID]Model{
GPT41: {
ID: GPT41,
Name: "GPT 4.1",
Provider: ProviderOpenAI,
APIModel: "gpt-4.1",
CostPer1MIn: 2.00,
CostPer1MInCached: 0.50,
CostPer1MOutCached: 0.0,
CostPer1MOut: 8.00,
ContextWindow: 1_047_576,
DefaultMaxTokens: 20000,
},
GPT41Mini: {
ID: GPT41Mini,
Name: "GPT 4.1 mini",
Provider: ProviderOpenAI,
APIModel: "gpt-4.1",
CostPer1MIn: 0.40,
CostPer1MInCached: 0.10,
CostPer1MOutCached: 0.0,
CostPer1MOut: 1.60,
ContextWindow: 200_000,
DefaultMaxTokens: 20000,
},
GPT41Nano: {
ID: GPT41Nano,
Name: "GPT 4.1 nano",
Provider: ProviderOpenAI,
APIModel: "gpt-4.1-nano",
CostPer1MIn: 0.10,
CostPer1MInCached: 0.025,
CostPer1MOutCached: 0.0,
CostPer1MOut: 0.40,
ContextWindow: 1_047_576,
DefaultMaxTokens: 20000,
},
GPT45Preview: {
ID: GPT45Preview,
Name: "GPT 4.5 preview",
Provider: ProviderOpenAI,
APIModel: "gpt-4.5-preview",
CostPer1MIn: 75.00,
CostPer1MInCached: 37.50,
CostPer1MOutCached: 0.0,
CostPer1MOut: 150.00,
ContextWindow: 128_000,
DefaultMaxTokens: 15000,
},
GPT4o: {
ID: GPT4o,
Name: "GPT 4o",
Provider: ProviderOpenAI,
APIModel: "gpt-4o",
CostPer1MIn: 2.50,
CostPer1MInCached: 1.25,
CostPer1MOutCached: 0.0,
CostPer1MOut: 10.00,
ContextWindow: 128_000,
DefaultMaxTokens: 4096,
},
GPT4oMini: {
ID: GPT4oMini,
Name: "GPT 4o mini",
Provider: ProviderOpenAI,
APIModel: "gpt-4o-mini",
CostPer1MIn: 0.15,
CostPer1MInCached: 0.075,
CostPer1MOutCached: 0.0,
CostPer1MOut: 0.60,
ContextWindow: 128_000,
},
O1: {
ID: O1,
Name: "O1",
Provider: ProviderOpenAI,
APIModel: "o1",
CostPer1MIn: 15.00,
CostPer1MInCached: 7.50,
CostPer1MOutCached: 0.0,
CostPer1MOut: 60.00,
ContextWindow: 200_000,
DefaultMaxTokens: 50000,
CanReason: true,
},
O1Pro: {
ID: O1Pro,
Name: "o1 pro",
Provider: ProviderOpenAI,
APIModel: "o1-pro",
CostPer1MIn: 150.00,
CostPer1MInCached: 0.0,
CostPer1MOutCached: 0.0,
CostPer1MOut: 600.00,
ContextWindow: 200_000,
DefaultMaxTokens: 50000,
CanReason: true,
},
O1Mini: {
ID: O1Mini,
Name: "o1 mini",
Provider: ProviderOpenAI,
APIModel: "o1-mini",
CostPer1MIn: 1.10,
CostPer1MInCached: 0.55,
CostPer1MOutCached: 0.0,
CostPer1MOut: 4.40,
ContextWindow: 128_000,
DefaultMaxTokens: 50000,
CanReason: true,
},
O3: {
ID: O3,
Name: "o3",
Provider: ProviderOpenAI,
APIModel: "o3",
CostPer1MIn: 10.00,
CostPer1MInCached: 2.50,
CostPer1MOutCached: 0.0,
CostPer1MOut: 40.00,
ContextWindow: 200_000,
CanReason: true,
},
O3Mini: {
ID: O3Mini,
Name: "o3 mini",
Provider: ProviderOpenAI,
APIModel: "o3-mini",
CostPer1MIn: 1.10,
CostPer1MInCached: 0.55,
CostPer1MOutCached: 0.0,
CostPer1MOut: 4.40,
ContextWindow: 200_000,
DefaultMaxTokens: 50000,
CanReason: true,
},
O4Mini: {
ID: O4Mini,
Name: "o4 mini",
Provider: ProviderOpenAI,
APIModel: "o4-mini",
CostPer1MIn: 1.10,
CostPer1MInCached: 0.275,
CostPer1MOutCached: 0.0,
CostPer1MOut: 4.40,
ContextWindow: 128_000,
DefaultMaxTokens: 50000,
CanReason: true,
},
}
@@ -1,4 +1,77 @@
You are OpenCode, an interactive CLI tool that helps users with software engineering tasks. Use the instructions below and the tools available to you to assist the user.
package prompt
import (
"context"
"fmt"
"os"
"path/filepath"
"runtime"
"time"
"github.com/kujtimiihoxha/opencode/internal/config"
"github.com/kujtimiihoxha/opencode/internal/llm/models"
"github.com/kujtimiihoxha/opencode/internal/llm/tools"
)
func CoderPrompt(provider models.ModelProvider) string {
basePrompt := baseAnthropicCoderPrompt
switch provider {
case models.ProviderOpenAI:
basePrompt = baseOpenAICoderPrompt
}
envInfo := getEnvironmentInfo()
return fmt.Sprintf("%s\n\n%s\n%s", basePrompt, envInfo, lspInformation())
}
const baseOpenAICoderPrompt = `
You are operating as and within the OpenCode CLI, a terminal-based agentic coding assistant built by OpenAI. It wraps OpenAI models to enable natural language interaction with a local codebase. You are expected to be precise, safe, and helpful.
You can:
- Receive user prompts, project context, and files.
- Stream responses and emit function calls (e.g., shell commands, code edits).
- Apply patches, run commands, and manage user approvals based on policy.
- Work inside a sandboxed, git-backed workspace with rollback support.
- Log telemetry so sessions can be replayed or inspected later.
- More details on your functionality are available at "opencode --help"
You are an agent - please keep going until the user's query is completely resolved, before ending your turn and yielding back to the user. Only terminate your turn when you are sure that the problem is solved. If you are not sure about file content or codebase structure pertaining to the user's request, use your tools to read files and gather the relevant information: do NOT guess or make up an answer.
Please resolve the user's task by editing and testing the code files in your current code execution session. You are a deployed coding agent. Your session allows for you to modify and run code. The repo(s) are already cloned in your working directory, and you must fully solve the problem for your answer to be considered correct.
You MUST adhere to the following criteria when executing the task:
- Working on the repo(s) in the current environment is allowed, even if they are proprietary.
- Analyzing code for vulnerabilities is allowed.
- Showing user code and tool call details is allowed.
- User instructions may overwrite the *CODING GUIDELINES* section in this developer message.
- If completing the user's task requires writing or modifying files:
- Your code and final answer should follow these *CODING GUIDELINES*:
- Fix the problem at the root cause rather than applying surface-level patches, when possible.
- Avoid unneeded complexity in your solution.
- Ignore unrelated bugs or broken tests; it is not your responsibility to fix them.
- Update documentation as necessary.
- Keep changes consistent with the style of the existing codebase. Changes should be minimal and focused on the task.
- Use "git log" and "git blame" to search the history of the codebase if additional context is required; internet access is disabled.
- NEVER add copyright or license headers unless specifically requested.
- You do not need to "git commit" your changes; this will be done automatically for you.
- Once you finish coding, you must
- Check "git status" to sanity check your changes; revert any scratch files or changes.
- Remove all inline comments you added as much as possible, even if they look normal. Check using "git diff". Inline comments must be generally avoided, unless active maintainers of the repo, after long careful study of the code and the issue, will still misinterpret the code without the comments.
- Check if you accidentally add copyright or license headers. If so, remove them.
- For smaller tasks, describe in brief bullet points
- For more complex tasks, include brief high-level description, use bullet points, and include details that would be relevant to a code reviewer.
- If completing the user's task DOES NOT require writing or modifying files (e.g., the user asks a question about the code base):
- Respond in a friendly tune as a remote teammate, who is knowledgeable, capable and eager to help with coding.
- When your task involves writing or modifying files:
- Do NOT tell the user to "save the file" or "copy the code into a file" if you already created or modified the file using "apply_patch". Instead, reference the file as already saved.
- Do NOT show the full contents of large files you have already written, unless the user explicitly asks for them.
- When doing things with paths, always use use the full path, if the working directory is /abc/xyz and you want to edit the file abc.go in the working dir refer to it as /abc/xyz/abc.go.
- If you send a path not including the working dir, the working dir will be prepended to it.
- Remember the user does not see the full output of tools
`
const baseAnthropicCoderPrompt = `You are OpenCode, an interactive CLI tool that helps users with software engineering tasks. Use the instructions below and the tools available to you to assist the user.
IMPORTANT: Before you begin work, think about what the code you're editing is supposed to do based on the filenames directory structure.
@@ -8,7 +81,7 @@ If the current working directory contains a file called OpenCode.md, it will be
2. Recording the user's code style preferences (naming conventions, preferred libraries, etc.)
3. Maintaining useful information about the codebase structure and organization
When you spend time searching for commands to typecheck, lint, build, or test, you should ask the user if it's okay to add those commands to CONTEXT.md. Similarly, when learning about code style preferences or important codebase information, ask if it's okay to add that to CONTEXT.md so you can remember it for next time.
When you spend time searching for commands to typecheck, lint, build, or test, you should ask the user if it's okay to add those commands to OpenCode.md. Similarly, when learning about code style preferences or important codebase information, ask if it's okay to add that to OpenCode.md so you can remember it for next time.
# Tone and style
You should be concise, direct, and to the point. When you run a non-trivial bash command, you should explain what the command does and why you are running it, to make sure the user understands what you are doing (this is especially important when you are running a command that will make changes to the user's system).
@@ -30,7 +103,7 @@ assistant: 4
<example>
user: is 11 a prime number?
assistant: yes
assistant: true
</example>
<example>
@@ -92,4 +165,58 @@ NEVER commit changes unless the user explicitly asks you to. It is VERY IMPORTAN
- If you intend to call multiple tools and there are no dependencies between the calls, make all of the independent calls in the same function_calls block.
- IMPORTANT: The user does not see the full output of the tool responses, so if you need the output of the tool for the response make sure to summarize it for the user.
You MUST answer concisely with fewer than 4 lines of text (not including tool use or code generation), unless user asks for detail.
You MUST answer concisely with fewer than 4 lines of text (not including tool use or code generation), unless user asks for detail.`
func getEnvironmentInfo() string {
cwd := config.WorkingDirectory()
isGit := isGitRepo(cwd)
platform := runtime.GOOS
date := time.Now().Format("1/2/2006")
ls := tools.NewLsTool()
r, _ := ls.Run(context.Background(), tools.ToolCall{
Input: `{"path":"."}`,
})
return fmt.Sprintf(`Here is useful information about the environment you are running in:
<env>
Working directory: %s
Is directory a git repo: %s
Platform: %s
Today's date: %s
</env>
<project>
%s
</project>
`, cwd, boolToYesNo(isGit), platform, date, r.Content)
}
func isGitRepo(dir string) bool {
_, err := os.Stat(filepath.Join(dir, ".git"))
return err == nil
}
func lspInformation() string {
cfg := config.Get()
hasLSP := false
for _, v := range cfg.LSP {
if !v.Disabled {
hasLSP = true
break
}
}
if !hasLSP {
return ""
}
return `# LSP Information
Tools that support it will also include useful diagnostics such as linting and typechecking.
- These diagnostics will be automatically enabled when you run the tool, and will be displayed in the output at the bottom within the <file_diagnostics></file_diagnostics> and <project_diagnostics></project_diagnostics> tags.
- Take necessary actions to fix the issues.
- You should ignore diagnostics of files that you did not change or are not related or caused by your changes unless the user explicitly asks you to fix them.
`
}
func boolToYesNo(b bool) string {
if b {
return "Yes"
}
return "No"
}
+63
View File
@@ -0,0 +1,63 @@
package prompt
import (
"fmt"
"os"
"path/filepath"
"github.com/kujtimiihoxha/opencode/internal/config"
"github.com/kujtimiihoxha/opencode/internal/llm/models"
)
// contextFiles is a list of potential context files to check for
var contextFiles = []string{
".github/copilot-instructions.md",
".cursorrules",
"CLAUDE.md",
"CLAUDE.local.md",
"opencode.md",
"opencode.local.md",
"OpenCode.md",
"OpenCode.local.md",
"OPENCODE.md",
"OPENCODE.local.md",
}
func GetAgentPrompt(agentName config.AgentName, provider models.ModelProvider) string {
basePrompt := ""
switch agentName {
case config.AgentCoder:
basePrompt = CoderPrompt(provider)
case config.AgentTitle:
basePrompt = TitlePrompt(provider)
case config.AgentTask:
basePrompt = TaskPrompt(provider)
default:
basePrompt = "You are a helpful assistant"
}
if agentName == config.AgentCoder || agentName == config.AgentTask {
// Add context from project-specific instruction files if they exist
contextContent := getContextFromFiles()
if contextContent != "" {
return fmt.Sprintf("%s\n\n# Project-Specific Context\n%s", basePrompt, contextContent)
}
}
return basePrompt
}
// getContextFromFiles checks for the existence of context files and returns their content
func getContextFromFiles() string {
workDir := config.WorkingDirectory()
var contextContent string
for _, file := range contextFiles {
filePath := filepath.Join(workDir, file)
content, err := os.ReadFile(filePath)
if err == nil {
contextContent += fmt.Sprintf("\n%s\n", string(content))
}
}
return contextContent
}
+17
View File
@@ -0,0 +1,17 @@
package prompt
import (
"fmt"
"github.com/kujtimiihoxha/opencode/internal/llm/models"
)
func TaskPrompt(_ models.ModelProvider) string {
agentPrompt := `You are an agent for OpenCode. Given the user's prompt, you should use the tools available to you to answer the user's question.
Notes:
1. IMPORTANT: You should be concise, direct, and to the point, since your responses will be displayed on a command line interface. Answer the user's question directly, without elaboration, explanation, or details. One word answers are best. Avoid introductions, conclusions, and explanations. You MUST avoid text before/after your response, such as "The answer is <answer>.", "Here is the content of the file..." or "Based on the information provided, the answer is..." or "Here is what I will do next...".
2. When relevant, share file names and code snippets relevant to the query
3. Any file paths you return in your final response MUST be absolute. DO NOT use relative paths.`
return fmt.Sprintf("%s\n%s\n", agentPrompt, getEnvironmentInfo())
}
+12
View File
@@ -0,0 +1,12 @@
package prompt
import "github.com/kujtimiihoxha/opencode/internal/llm/models"
func TitlePrompt(_ models.ModelProvider) string {
return `you will generate a short title based on the first message a user begins a conversation with
- ensure it is not more than 50 characters long
- the title should be a summary of the user's message
- it should be one line long
- do not use quotes or colons
- the entire text you return will be used as the title`
}
+455
View File
@@ -0,0 +1,455 @@
package provider
import (
"context"
"encoding/json"
"errors"
"fmt"
"io"
"strings"
"time"
"github.com/anthropics/anthropic-sdk-go"
"github.com/anthropics/anthropic-sdk-go/bedrock"
"github.com/anthropics/anthropic-sdk-go/option"
"github.com/kujtimiihoxha/opencode/internal/config"
"github.com/kujtimiihoxha/opencode/internal/llm/tools"
"github.com/kujtimiihoxha/opencode/internal/logging"
"github.com/kujtimiihoxha/opencode/internal/message"
)
type anthropicOptions struct {
useBedrock bool
disableCache bool
shouldThink func(userMessage string) bool
}
type AnthropicOption func(*anthropicOptions)
type anthropicClient struct {
providerOptions providerClientOptions
options anthropicOptions
client anthropic.Client
}
type AnthropicClient ProviderClient
func newAnthropicClient(opts providerClientOptions) AnthropicClient {
anthropicOpts := anthropicOptions{}
for _, o := range opts.anthropicOptions {
o(&anthropicOpts)
}
anthropicClientOptions := []option.RequestOption{}
if opts.apiKey != "" {
anthropicClientOptions = append(anthropicClientOptions, option.WithAPIKey(opts.apiKey))
}
if anthropicOpts.useBedrock {
anthropicClientOptions = append(anthropicClientOptions, bedrock.WithLoadDefaultConfig(context.Background()))
}
client := anthropic.NewClient(anthropicClientOptions...)
return &anthropicClient{
providerOptions: opts,
options: anthropicOpts,
client: client,
}
}
func (a *anthropicClient) convertMessages(messages []message.Message) (anthropicMessages []anthropic.MessageParam) {
for i, msg := range messages {
cache := false
if i > len(messages)-3 {
cache = true
}
switch msg.Role {
case message.User:
content := anthropic.NewTextBlock(msg.Content().String())
if cache && !a.options.disableCache {
content.OfRequestTextBlock.CacheControl = anthropic.CacheControlEphemeralParam{
Type: "ephemeral",
}
}
anthropicMessages = append(anthropicMessages, anthropic.NewUserMessage(content))
case message.Assistant:
blocks := []anthropic.ContentBlockParamUnion{}
if msg.Content().String() != "" {
content := anthropic.NewTextBlock(msg.Content().String())
if cache && !a.options.disableCache {
content.OfRequestTextBlock.CacheControl = anthropic.CacheControlEphemeralParam{
Type: "ephemeral",
}
}
blocks = append(blocks, content)
}
for _, toolCall := range msg.ToolCalls() {
var inputMap map[string]any
err := json.Unmarshal([]byte(toolCall.Input), &inputMap)
if err != nil {
continue
}
blocks = append(blocks, anthropic.ContentBlockParamOfRequestToolUseBlock(toolCall.ID, inputMap, toolCall.Name))
}
if len(blocks) == 0 {
logging.Warn("There is a message without content, investigate, this should not happen")
continue
}
anthropicMessages = append(anthropicMessages, anthropic.NewAssistantMessage(blocks...))
case message.Tool:
results := make([]anthropic.ContentBlockParamUnion, len(msg.ToolResults()))
for i, toolResult := range msg.ToolResults() {
results[i] = anthropic.NewToolResultBlock(toolResult.ToolCallID, toolResult.Content, toolResult.IsError)
}
anthropicMessages = append(anthropicMessages, anthropic.NewUserMessage(results...))
}
}
return
}
func (a *anthropicClient) convertTools(tools []tools.BaseTool) []anthropic.ToolUnionParam {
anthropicTools := make([]anthropic.ToolUnionParam, len(tools))
for i, tool := range tools {
info := tool.Info()
toolParam := anthropic.ToolParam{
Name: info.Name,
Description: anthropic.String(info.Description),
InputSchema: anthropic.ToolInputSchemaParam{
Properties: info.Parameters,
// TODO: figure out how we can tell claude the required fields?
},
}
if i == len(tools)-1 && !a.options.disableCache {
toolParam.CacheControl = anthropic.CacheControlEphemeralParam{
Type: "ephemeral",
}
}
anthropicTools[i] = anthropic.ToolUnionParam{OfTool: &toolParam}
}
return anthropicTools
}
func (a *anthropicClient) finishReason(reason string) message.FinishReason {
switch reason {
case "end_turn":
return message.FinishReasonEndTurn
case "max_tokens":
return message.FinishReasonMaxTokens
case "tool_use":
return message.FinishReasonToolUse
case "stop_sequence":
return message.FinishReasonEndTurn
default:
return message.FinishReasonUnknown
}
}
func (a *anthropicClient) preparedMessages(messages []anthropic.MessageParam, tools []anthropic.ToolUnionParam) anthropic.MessageNewParams {
var thinkingParam anthropic.ThinkingConfigParamUnion
lastMessage := messages[len(messages)-1]
isUser := lastMessage.Role == anthropic.MessageParamRoleUser
messageContent := ""
temperature := anthropic.Float(0)
if isUser {
for _, m := range lastMessage.Content {
if m.OfRequestTextBlock != nil && m.OfRequestTextBlock.Text != "" {
messageContent = m.OfRequestTextBlock.Text
}
}
if messageContent != "" && a.options.shouldThink != nil && a.options.shouldThink(messageContent) {
thinkingParam = anthropic.ThinkingConfigParamUnion{
OfThinkingConfigEnabled: &anthropic.ThinkingConfigEnabledParam{
BudgetTokens: int64(float64(a.providerOptions.maxTokens) * 0.8),
Type: "enabled",
},
}
temperature = anthropic.Float(1)
}
}
return anthropic.MessageNewParams{
Model: anthropic.Model(a.providerOptions.model.APIModel),
MaxTokens: a.providerOptions.maxTokens,
Temperature: temperature,
Messages: messages,
Tools: tools,
Thinking: thinkingParam,
System: []anthropic.TextBlockParam{
{
Text: a.providerOptions.systemMessage,
CacheControl: anthropic.CacheControlEphemeralParam{
Type: "ephemeral",
},
},
},
}
}
func (a *anthropicClient) send(ctx context.Context, messages []message.Message, tools []tools.BaseTool) (resposne *ProviderResponse, err error) {
preparedMessages := a.preparedMessages(a.convertMessages(messages), a.convertTools(tools))
cfg := config.Get()
if cfg.Debug {
// jsonData, _ := json.Marshal(preparedMessages)
// logging.Debug("Prepared messages", "messages", string(jsonData))
}
attempts := 0
for {
attempts++
anthropicResponse, err := a.client.Messages.New(
ctx,
preparedMessages,
)
// If there is an error we are going to see if we can retry the call
if err != nil {
retry, after, retryErr := a.shouldRetry(attempts, err)
if retryErr != nil {
return nil, retryErr
}
if retry {
logging.WarnPersist("Retrying due to rate limit... attempt %d of %d", logging.PersistTimeArg, time.Millisecond*time.Duration(after+100))
select {
case <-ctx.Done():
return nil, ctx.Err()
case <-time.After(time.Duration(after) * time.Millisecond):
continue
}
}
return nil, retryErr
}
content := ""
for _, block := range anthropicResponse.Content {
if text, ok := block.AsAny().(anthropic.TextBlock); ok {
content += text.Text
}
}
return &ProviderResponse{
Content: content,
ToolCalls: a.toolCalls(*anthropicResponse),
Usage: a.usage(*anthropicResponse),
}, nil
}
}
func (a *anthropicClient) stream(ctx context.Context, messages []message.Message, tools []tools.BaseTool) <-chan ProviderEvent {
preparedMessages := a.preparedMessages(a.convertMessages(messages), a.convertTools(tools))
cfg := config.Get()
if cfg.Debug {
// jsonData, _ := json.Marshal(preparedMessages)
// logging.Debug("Prepared messages", "messages", string(jsonData))
}
attempts := 0
eventChan := make(chan ProviderEvent)
go func() {
for {
attempts++
anthropicStream := a.client.Messages.NewStreaming(
ctx,
preparedMessages,
)
accumulatedMessage := anthropic.Message{}
currentToolCallID := ""
for anthropicStream.Next() {
event := anthropicStream.Current()
err := accumulatedMessage.Accumulate(event)
if err != nil {
eventChan <- ProviderEvent{Type: EventError, Error: err}
continue
}
switch event := event.AsAny().(type) {
case anthropic.ContentBlockStartEvent:
if event.ContentBlock.Type == "text" {
eventChan <- ProviderEvent{Type: EventContentStart}
} else if event.ContentBlock.Type == "tool_use" {
currentToolCallID = event.ContentBlock.ID
eventChan <- ProviderEvent{
Type: EventToolUseStart,
ToolCall: &message.ToolCall{
ID: event.ContentBlock.ID,
Name: event.ContentBlock.Name,
Finished: false,
},
}
}
case anthropic.ContentBlockDeltaEvent:
if event.Delta.Type == "thinking_delta" && event.Delta.Thinking != "" {
eventChan <- ProviderEvent{
Type: EventThinkingDelta,
Thinking: event.Delta.Thinking,
}
} else if event.Delta.Type == "text_delta" && event.Delta.Text != "" {
eventChan <- ProviderEvent{
Type: EventContentDelta,
Content: event.Delta.Text,
}
} else if event.Delta.Type == "input_json_delta" {
if currentToolCallID != "" {
eventChan <- ProviderEvent{
Type: EventToolUseDelta,
ToolCall: &message.ToolCall{
ID: currentToolCallID,
Finished: false,
Input: event.Delta.JSON.PartialJSON.Raw(),
},
}
}
}
case anthropic.ContentBlockStopEvent:
if currentToolCallID != "" {
eventChan <- ProviderEvent{
Type: EventToolUseStop,
ToolCall: &message.ToolCall{
ID: currentToolCallID,
},
}
currentToolCallID = ""
} else {
eventChan <- ProviderEvent{Type: EventContentStop}
}
case anthropic.MessageStopEvent:
content := ""
for _, block := range accumulatedMessage.Content {
if text, ok := block.AsAny().(anthropic.TextBlock); ok {
content += text.Text
}
}
eventChan <- ProviderEvent{
Type: EventComplete,
Response: &ProviderResponse{
Content: content,
ToolCalls: a.toolCalls(accumulatedMessage),
Usage: a.usage(accumulatedMessage),
FinishReason: a.finishReason(string(accumulatedMessage.StopReason)),
},
}
}
}
err := anthropicStream.Err()
if err == nil || errors.Is(err, io.EOF) {
close(eventChan)
return
}
// If there is an error we are going to see if we can retry the call
retry, after, retryErr := a.shouldRetry(attempts, err)
if retryErr != nil {
eventChan <- ProviderEvent{Type: EventError, Error: retryErr}
close(eventChan)
return
}
if retry {
logging.WarnPersist("Retrying due to rate limit... attempt %d of %d", logging.PersistTimeArg, time.Millisecond*time.Duration(after+100))
select {
case <-ctx.Done():
// context cancelled
if ctx.Err() != nil {
eventChan <- ProviderEvent{Type: EventError, Error: ctx.Err()}
}
close(eventChan)
return
case <-time.After(time.Duration(after) * time.Millisecond):
continue
}
}
if ctx.Err() != nil {
eventChan <- ProviderEvent{Type: EventError, Error: ctx.Err()}
}
close(eventChan)
return
}
}()
return eventChan
}
func (a *anthropicClient) shouldRetry(attempts int, err error) (bool, int64, error) {
var apierr *anthropic.Error
if !errors.As(err, &apierr) {
return false, 0, err
}
if apierr.StatusCode != 429 && apierr.StatusCode != 529 {
return false, 0, err
}
if attempts > maxRetries {
return false, 0, fmt.Errorf("maximum retry attempts reached for rate limit: %d retries", maxRetries)
}
retryMs := 0
retryAfterValues := apierr.Response.Header.Values("Retry-After")
backoffMs := 2000 * (1 << (attempts - 1))
jitterMs := int(float64(backoffMs) * 0.2)
retryMs = backoffMs + jitterMs
if len(retryAfterValues) > 0 {
if _, err := fmt.Sscanf(retryAfterValues[0], "%d", &retryMs); err == nil {
retryMs = retryMs * 1000
}
}
return true, int64(retryMs), nil
}
func (a *anthropicClient) toolCalls(msg anthropic.Message) []message.ToolCall {
var toolCalls []message.ToolCall
for _, block := range msg.Content {
switch variant := block.AsAny().(type) {
case anthropic.ToolUseBlock:
toolCall := message.ToolCall{
ID: variant.ID,
Name: variant.Name,
Input: string(variant.Input),
Type: string(variant.Type),
Finished: true,
}
toolCalls = append(toolCalls, toolCall)
}
}
return toolCalls
}
func (a *anthropicClient) usage(msg anthropic.Message) TokenUsage {
return TokenUsage{
InputTokens: msg.Usage.InputTokens,
OutputTokens: msg.Usage.OutputTokens,
CacheCreationTokens: msg.Usage.CacheCreationInputTokens,
CacheReadTokens: msg.Usage.CacheReadInputTokens,
}
}
func WithAnthropicBedrock(useBedrock bool) AnthropicOption {
return func(options *anthropicOptions) {
options.useBedrock = useBedrock
}
}
func WithAnthropicDisableCache() AnthropicOption {
return func(options *anthropicOptions) {
options.disableCache = true
}
}
func DefaultShouldThinkFn(s string) bool {
return strings.Contains(strings.ToLower(s), "think")
}
func WithAnthropicShouldThinkFn(fn func(string) bool) AnthropicOption {
return func(options *anthropicOptions) {
options.shouldThink = fn
}
}
+100
View File
@@ -0,0 +1,100 @@
package provider
import (
"context"
"errors"
"fmt"
"os"
"strings"
"github.com/kujtimiihoxha/opencode/internal/llm/tools"
"github.com/kujtimiihoxha/opencode/internal/message"
)
type bedrockOptions struct {
// Bedrock specific options can be added here
}
type BedrockOption func(*bedrockOptions)
type bedrockClient struct {
providerOptions providerClientOptions
options bedrockOptions
childProvider ProviderClient
}
type BedrockClient ProviderClient
func newBedrockClient(opts providerClientOptions) BedrockClient {
bedrockOpts := bedrockOptions{}
// Apply bedrock specific options if they are added in the future
// Get AWS region from environment
region := os.Getenv("AWS_REGION")
if region == "" {
region = os.Getenv("AWS_DEFAULT_REGION")
}
if region == "" {
region = "us-east-1" // default region
}
if len(region) < 2 {
return &bedrockClient{
providerOptions: opts,
options: bedrockOpts,
childProvider: nil, // Will cause an error when used
}
}
// Prefix the model name with region
regionPrefix := region[:2]
modelName := opts.model.APIModel
opts.model.APIModel = fmt.Sprintf("%s.%s", regionPrefix, modelName)
// Determine which provider to use based on the model
if strings.Contains(string(opts.model.APIModel), "anthropic") {
// Create Anthropic client with Bedrock configuration
anthropicOpts := opts
anthropicOpts.anthropicOptions = append(anthropicOpts.anthropicOptions,
WithAnthropicBedrock(true),
WithAnthropicDisableCache(),
)
return &bedrockClient{
providerOptions: opts,
options: bedrockOpts,
childProvider: newAnthropicClient(anthropicOpts),
}
}
// Return client with nil childProvider if model is not supported
// This will cause an error when used
return &bedrockClient{
providerOptions: opts,
options: bedrockOpts,
childProvider: nil,
}
}
func (b *bedrockClient) send(ctx context.Context, messages []message.Message, tools []tools.BaseTool) (*ProviderResponse, error) {
if b.childProvider == nil {
return nil, errors.New("unsupported model for bedrock provider")
}
return b.childProvider.send(ctx, messages, tools)
}
func (b *bedrockClient) stream(ctx context.Context, messages []message.Message, tools []tools.BaseTool) <-chan ProviderEvent {
eventChan := make(chan ProviderEvent)
if b.childProvider == nil {
go func() {
eventChan <- ProviderEvent{
Type: EventError,
Error: errors.New("unsupported model for bedrock provider"),
}
close(eventChan)
}()
return eventChan
}
return b.childProvider.stream(ctx, messages, tools)
}
+569
View File
@@ -0,0 +1,569 @@
package provider
import (
"context"
"encoding/json"
"errors"
"fmt"
"io"
"strings"
"time"
"github.com/google/generative-ai-go/genai"
"github.com/google/uuid"
"github.com/kujtimiihoxha/opencode/internal/config"
"github.com/kujtimiihoxha/opencode/internal/llm/tools"
"github.com/kujtimiihoxha/opencode/internal/logging"
"github.com/kujtimiihoxha/opencode/internal/message"
"google.golang.org/api/iterator"
"google.golang.org/api/option"
)
type geminiOptions struct {
disableCache bool
}
type GeminiOption func(*geminiOptions)
type geminiClient struct {
providerOptions providerClientOptions
options geminiOptions
client *genai.Client
}
type GeminiClient ProviderClient
func newGeminiClient(opts providerClientOptions) GeminiClient {
geminiOpts := geminiOptions{}
for _, o := range opts.geminiOptions {
o(&geminiOpts)
}
client, err := genai.NewClient(context.Background(), option.WithAPIKey(opts.apiKey))
if err != nil {
logging.Error("Failed to create Gemini client", "error", err)
return nil
}
return &geminiClient{
providerOptions: opts,
options: geminiOpts,
client: client,
}
}
func (g *geminiClient) convertMessages(messages []message.Message) []*genai.Content {
var history []*genai.Content
// Add system message first
history = append(history, &genai.Content{
Parts: []genai.Part{genai.Text(g.providerOptions.systemMessage)},
Role: "user",
})
// Add a system response to acknowledge the system message
history = append(history, &genai.Content{
Parts: []genai.Part{genai.Text("I'll help you with that.")},
Role: "model",
})
for _, msg := range messages {
switch msg.Role {
case message.User:
history = append(history, &genai.Content{
Parts: []genai.Part{genai.Text(msg.Content().String())},
Role: "user",
})
case message.Assistant:
content := &genai.Content{
Role: "model",
Parts: []genai.Part{},
}
if msg.Content().String() != "" {
content.Parts = append(content.Parts, genai.Text(msg.Content().String()))
}
if len(msg.ToolCalls()) > 0 {
for _, call := range msg.ToolCalls() {
args, _ := parseJsonToMap(call.Input)
content.Parts = append(content.Parts, genai.FunctionCall{
Name: call.Name,
Args: args,
})
}
}
history = append(history, content)
case message.Tool:
for _, result := range msg.ToolResults() {
response := map[string]interface{}{"result": result.Content}
parsed, err := parseJsonToMap(result.Content)
if err == nil {
response = parsed
}
var toolCall message.ToolCall
for _, m := range messages {
if m.Role == message.Assistant {
for _, call := range m.ToolCalls() {
if call.ID == result.ToolCallID {
toolCall = call
break
}
}
}
}
history = append(history, &genai.Content{
Parts: []genai.Part{genai.FunctionResponse{
Name: toolCall.Name,
Response: response,
}},
Role: "function",
})
}
}
}
return history
}
func (g *geminiClient) convertTools(tools []tools.BaseTool) []*genai.Tool {
geminiTools := make([]*genai.Tool, 0, len(tools))
for _, tool := range tools {
info := tool.Info()
declaration := &genai.FunctionDeclaration{
Name: info.Name,
Description: info.Description,
Parameters: &genai.Schema{
Type: genai.TypeObject,
Properties: convertSchemaProperties(info.Parameters),
Required: info.Required,
},
}
geminiTools = append(geminiTools, &genai.Tool{
FunctionDeclarations: []*genai.FunctionDeclaration{declaration},
})
}
return geminiTools
}
func (g *geminiClient) finishReason(reason genai.FinishReason) message.FinishReason {
reasonStr := reason.String()
switch {
case reasonStr == "STOP":
return message.FinishReasonEndTurn
case reasonStr == "MAX_TOKENS":
return message.FinishReasonMaxTokens
case strings.Contains(reasonStr, "FUNCTION") || strings.Contains(reasonStr, "TOOL"):
return message.FinishReasonToolUse
default:
return message.FinishReasonUnknown
}
}
func (g *geminiClient) send(ctx context.Context, messages []message.Message, tools []tools.BaseTool) (*ProviderResponse, error) {
model := g.client.GenerativeModel(g.providerOptions.model.APIModel)
model.SetMaxOutputTokens(int32(g.providerOptions.maxTokens))
// Convert tools
if len(tools) > 0 {
model.Tools = g.convertTools(tools)
}
// Convert messages
geminiMessages := g.convertMessages(messages)
cfg := config.Get()
if cfg.Debug {
jsonData, _ := json.Marshal(geminiMessages)
logging.Debug("Prepared messages", "messages", string(jsonData))
}
attempts := 0
for {
attempts++
chat := model.StartChat()
chat.History = geminiMessages[:len(geminiMessages)-1] // All but last message
lastMsg := geminiMessages[len(geminiMessages)-1]
var lastText string
for _, part := range lastMsg.Parts {
if text, ok := part.(genai.Text); ok {
lastText = string(text)
break
}
}
resp, err := chat.SendMessage(ctx, genai.Text(lastText))
// If there is an error we are going to see if we can retry the call
if err != nil {
retry, after, retryErr := g.shouldRetry(attempts, err)
if retryErr != nil {
return nil, retryErr
}
if retry {
logging.WarnPersist("Retrying due to rate limit... attempt %d of %d", logging.PersistTimeArg, time.Millisecond*time.Duration(after+100))
select {
case <-ctx.Done():
return nil, ctx.Err()
case <-time.After(time.Duration(after) * time.Millisecond):
continue
}
}
return nil, retryErr
}
content := ""
var toolCalls []message.ToolCall
if len(resp.Candidates) > 0 && resp.Candidates[0].Content != nil {
for _, part := range resp.Candidates[0].Content.Parts {
switch p := part.(type) {
case genai.Text:
content = string(p)
case genai.FunctionCall:
id := "call_" + uuid.New().String()
args, _ := json.Marshal(p.Args)
toolCalls = append(toolCalls, message.ToolCall{
ID: id,
Name: p.Name,
Input: string(args),
Type: "function",
})
}
}
}
return &ProviderResponse{
Content: content,
ToolCalls: toolCalls,
Usage: g.usage(resp),
FinishReason: g.finishReason(resp.Candidates[0].FinishReason),
}, nil
}
}
func (g *geminiClient) stream(ctx context.Context, messages []message.Message, tools []tools.BaseTool) <-chan ProviderEvent {
model := g.client.GenerativeModel(g.providerOptions.model.APIModel)
model.SetMaxOutputTokens(int32(g.providerOptions.maxTokens))
// Convert tools
if len(tools) > 0 {
model.Tools = g.convertTools(tools)
}
// Convert messages
geminiMessages := g.convertMessages(messages)
cfg := config.Get()
if cfg.Debug {
jsonData, _ := json.Marshal(geminiMessages)
logging.Debug("Prepared messages", "messages", string(jsonData))
}
attempts := 0
eventChan := make(chan ProviderEvent)
go func() {
defer close(eventChan)
for {
attempts++
chat := model.StartChat()
chat.History = geminiMessages[:len(geminiMessages)-1] // All but last message
lastMsg := geminiMessages[len(geminiMessages)-1]
var lastText string
for _, part := range lastMsg.Parts {
if text, ok := part.(genai.Text); ok {
lastText = string(text)
break
}
}
iter := chat.SendMessageStream(ctx, genai.Text(lastText))
currentContent := ""
toolCalls := []message.ToolCall{}
var finalResp *genai.GenerateContentResponse
eventChan <- ProviderEvent{Type: EventContentStart}
for {
resp, err := iter.Next()
if err == iterator.Done {
break
}
if err != nil {
retry, after, retryErr := g.shouldRetry(attempts, err)
if retryErr != nil {
eventChan <- ProviderEvent{Type: EventError, Error: retryErr}
return
}
if retry {
logging.WarnPersist("Retrying due to rate limit... attempt %d of %d", logging.PersistTimeArg, time.Millisecond*time.Duration(after+100))
select {
case <-ctx.Done():
if ctx.Err() != nil {
eventChan <- ProviderEvent{Type: EventError, Error: ctx.Err()}
}
return
case <-time.After(time.Duration(after) * time.Millisecond):
break
}
} else {
eventChan <- ProviderEvent{Type: EventError, Error: err}
return
}
}
finalResp = resp
if len(resp.Candidates) > 0 && resp.Candidates[0].Content != nil {
for _, part := range resp.Candidates[0].Content.Parts {
switch p := part.(type) {
case genai.Text:
newText := string(p)
delta := newText[len(currentContent):]
if delta != "" {
eventChan <- ProviderEvent{
Type: EventContentDelta,
Content: delta,
}
currentContent = newText
}
case genai.FunctionCall:
id := "call_" + uuid.New().String()
args, _ := json.Marshal(p.Args)
newCall := message.ToolCall{
ID: id,
Name: p.Name,
Input: string(args),
Type: "function",
}
isNew := true
for _, existing := range toolCalls {
if existing.Name == newCall.Name && existing.Input == newCall.Input {
isNew = false
break
}
}
if isNew {
toolCalls = append(toolCalls, newCall)
}
}
}
}
}
eventChan <- ProviderEvent{Type: EventContentStop}
if finalResp != nil {
eventChan <- ProviderEvent{
Type: EventComplete,
Response: &ProviderResponse{
Content: currentContent,
ToolCalls: toolCalls,
Usage: g.usage(finalResp),
FinishReason: g.finishReason(finalResp.Candidates[0].FinishReason),
},
}
return
}
// If we get here, we need to retry
if attempts > maxRetries {
eventChan <- ProviderEvent{
Type: EventError,
Error: fmt.Errorf("maximum retry attempts reached: %d retries", maxRetries),
}
return
}
// Wait before retrying
select {
case <-ctx.Done():
if ctx.Err() != nil {
eventChan <- ProviderEvent{Type: EventError, Error: ctx.Err()}
}
return
case <-time.After(time.Duration(2000*(1<<(attempts-1))) * time.Millisecond):
continue
}
}
}()
return eventChan
}
func (g *geminiClient) shouldRetry(attempts int, err error) (bool, int64, error) {
// Check if error is a rate limit error
if attempts > maxRetries {
return false, 0, fmt.Errorf("maximum retry attempts reached for rate limit: %d retries", maxRetries)
}
// Gemini doesn't have a standard error type we can check against
// So we'll check the error message for rate limit indicators
if errors.Is(err, io.EOF) {
return false, 0, err
}
errMsg := err.Error()
isRateLimit := false
// Check for common rate limit error messages
if contains(errMsg, "rate limit", "quota exceeded", "too many requests") {
isRateLimit = true
}
if !isRateLimit {
return false, 0, err
}
// Calculate backoff with jitter
backoffMs := 2000 * (1 << (attempts - 1))
jitterMs := int(float64(backoffMs) * 0.2)
retryMs := backoffMs + jitterMs
return true, int64(retryMs), nil
}
func (g *geminiClient) toolCalls(resp *genai.GenerateContentResponse) []message.ToolCall {
var toolCalls []message.ToolCall
if len(resp.Candidates) > 0 && resp.Candidates[0].Content != nil {
for _, part := range resp.Candidates[0].Content.Parts {
if funcCall, ok := part.(genai.FunctionCall); ok {
id := "call_" + uuid.New().String()
args, _ := json.Marshal(funcCall.Args)
toolCalls = append(toolCalls, message.ToolCall{
ID: id,
Name: funcCall.Name,
Input: string(args),
Type: "function",
})
}
}
}
return toolCalls
}
func (g *geminiClient) usage(resp *genai.GenerateContentResponse) TokenUsage {
if resp == nil || resp.UsageMetadata == nil {
return TokenUsage{}
}
return TokenUsage{
InputTokens: int64(resp.UsageMetadata.PromptTokenCount),
OutputTokens: int64(resp.UsageMetadata.CandidatesTokenCount),
CacheCreationTokens: 0, // Not directly provided by Gemini
CacheReadTokens: int64(resp.UsageMetadata.CachedContentTokenCount),
}
}
func WithGeminiDisableCache() GeminiOption {
return func(options *geminiOptions) {
options.disableCache = true
}
}
// Helper functions
func parseJsonToMap(jsonStr string) (map[string]interface{}, error) {
var result map[string]interface{}
err := json.Unmarshal([]byte(jsonStr), &result)
return result, err
}
func convertSchemaProperties(parameters map[string]interface{}) map[string]*genai.Schema {
properties := make(map[string]*genai.Schema)
for name, param := range parameters {
properties[name] = convertToSchema(param)
}
return properties
}
func convertToSchema(param interface{}) *genai.Schema {
schema := &genai.Schema{Type: genai.TypeString}
paramMap, ok := param.(map[string]interface{})
if !ok {
return schema
}
if desc, ok := paramMap["description"].(string); ok {
schema.Description = desc
}
typeVal, hasType := paramMap["type"]
if !hasType {
return schema
}
typeStr, ok := typeVal.(string)
if !ok {
return schema
}
schema.Type = mapJSONTypeToGenAI(typeStr)
switch typeStr {
case "array":
schema.Items = processArrayItems(paramMap)
case "object":
if props, ok := paramMap["properties"].(map[string]interface{}); ok {
schema.Properties = convertSchemaProperties(props)
}
}
return schema
}
func processArrayItems(paramMap map[string]interface{}) *genai.Schema {
items, ok := paramMap["items"].(map[string]interface{})
if !ok {
return nil
}
return convertToSchema(items)
}
func mapJSONTypeToGenAI(jsonType string) genai.Type {
switch jsonType {
case "string":
return genai.TypeString
case "number":
return genai.TypeNumber
case "integer":
return genai.TypeInteger
case "boolean":
return genai.TypeBoolean
case "array":
return genai.TypeArray
case "object":
return genai.TypeObject
default:
return genai.TypeString // Default to string for unknown types
}
}
func contains(s string, substrs ...string) bool {
for _, substr := range substrs {
if strings.Contains(strings.ToLower(s), strings.ToLower(substr)) {
return true
}
}
return false
}
+395
View File
@@ -0,0 +1,395 @@
package provider
import (
"context"
"encoding/json"
"errors"
"fmt"
"io"
"time"
"github.com/kujtimiihoxha/opencode/internal/config"
"github.com/kujtimiihoxha/opencode/internal/llm/tools"
"github.com/kujtimiihoxha/opencode/internal/logging"
"github.com/kujtimiihoxha/opencode/internal/message"
"github.com/openai/openai-go"
"github.com/openai/openai-go/option"
"github.com/openai/openai-go/shared"
)
type openaiOptions struct {
baseURL string
disableCache bool
reasoningEffort string
}
type OpenAIOption func(*openaiOptions)
type openaiClient struct {
providerOptions providerClientOptions
options openaiOptions
client openai.Client
}
type OpenAIClient ProviderClient
func newOpenAIClient(opts providerClientOptions) OpenAIClient {
openaiOpts := openaiOptions{
reasoningEffort: "medium",
}
for _, o := range opts.openaiOptions {
o(&openaiOpts)
}
openaiClientOptions := []option.RequestOption{}
if opts.apiKey != "" {
openaiClientOptions = append(openaiClientOptions, option.WithAPIKey(opts.apiKey))
}
if openaiOpts.baseURL != "" {
openaiClientOptions = append(openaiClientOptions, option.WithBaseURL(openaiOpts.baseURL))
}
client := openai.NewClient(openaiClientOptions...)
return &openaiClient{
providerOptions: opts,
options: openaiOpts,
client: client,
}
}
func (o *openaiClient) convertMessages(messages []message.Message) (openaiMessages []openai.ChatCompletionMessageParamUnion) {
// Add system message first
openaiMessages = append(openaiMessages, openai.SystemMessage(o.providerOptions.systemMessage))
for _, msg := range messages {
switch msg.Role {
case message.User:
openaiMessages = append(openaiMessages, openai.UserMessage(msg.Content().String()))
case message.Assistant:
assistantMsg := openai.ChatCompletionAssistantMessageParam{
Role: "assistant",
}
if msg.Content().String() != "" {
assistantMsg.Content = openai.ChatCompletionAssistantMessageParamContentUnion{
OfString: openai.String(msg.Content().String()),
}
}
if len(msg.ToolCalls()) > 0 {
assistantMsg.ToolCalls = make([]openai.ChatCompletionMessageToolCallParam, len(msg.ToolCalls()))
for i, call := range msg.ToolCalls() {
assistantMsg.ToolCalls[i] = openai.ChatCompletionMessageToolCallParam{
ID: call.ID,
Type: "function",
Function: openai.ChatCompletionMessageToolCallFunctionParam{
Name: call.Name,
Arguments: call.Input,
},
}
}
}
openaiMessages = append(openaiMessages, openai.ChatCompletionMessageParamUnion{
OfAssistant: &assistantMsg,
})
case message.Tool:
for _, result := range msg.ToolResults() {
openaiMessages = append(openaiMessages,
openai.ToolMessage(result.Content, result.ToolCallID),
)
}
}
}
return
}
func (o *openaiClient) convertTools(tools []tools.BaseTool) []openai.ChatCompletionToolParam {
openaiTools := make([]openai.ChatCompletionToolParam, len(tools))
for i, tool := range tools {
info := tool.Info()
openaiTools[i] = openai.ChatCompletionToolParam{
Function: openai.FunctionDefinitionParam{
Name: info.Name,
Description: openai.String(info.Description),
Parameters: openai.FunctionParameters{
"type": "object",
"properties": info.Parameters,
"required": info.Required,
},
},
}
}
return openaiTools
}
func (o *openaiClient) finishReason(reason string) message.FinishReason {
switch reason {
case "stop":
return message.FinishReasonEndTurn
case "length":
return message.FinishReasonMaxTokens
case "tool_calls":
return message.FinishReasonToolUse
default:
return message.FinishReasonUnknown
}
}
func (o *openaiClient) preparedParams(messages []openai.ChatCompletionMessageParamUnion, tools []openai.ChatCompletionToolParam) openai.ChatCompletionNewParams {
params := openai.ChatCompletionNewParams{
Model: openai.ChatModel(o.providerOptions.model.APIModel),
Messages: messages,
Tools: tools,
}
if o.providerOptions.model.CanReason == true {
params.MaxCompletionTokens = openai.Int(o.providerOptions.maxTokens)
switch o.options.reasoningEffort {
case "low":
params.ReasoningEffort = shared.ReasoningEffortLow
case "medium":
params.ReasoningEffort = shared.ReasoningEffortMedium
case "high":
params.ReasoningEffort = shared.ReasoningEffortHigh
default:
params.ReasoningEffort = shared.ReasoningEffortMedium
}
} else {
params.MaxTokens = openai.Int(o.providerOptions.maxTokens)
}
return params
}
func (o *openaiClient) send(ctx context.Context, messages []message.Message, tools []tools.BaseTool) (response *ProviderResponse, err error) {
params := o.preparedParams(o.convertMessages(messages), o.convertTools(tools))
cfg := config.Get()
if cfg.Debug {
jsonData, _ := json.Marshal(params)
logging.Debug("Prepared messages", "messages", string(jsonData))
}
attempts := 0
for {
attempts++
openaiResponse, err := o.client.Chat.Completions.New(
ctx,
params,
)
// If there is an error we are going to see if we can retry the call
if err != nil {
retry, after, retryErr := o.shouldRetry(attempts, err)
if retryErr != nil {
return nil, retryErr
}
if retry {
logging.WarnPersist("Retrying due to rate limit... attempt %d of %d", logging.PersistTimeArg, time.Millisecond*time.Duration(after+100))
select {
case <-ctx.Done():
return nil, ctx.Err()
case <-time.After(time.Duration(after) * time.Millisecond):
continue
}
}
return nil, retryErr
}
content := ""
if openaiResponse.Choices[0].Message.Content != "" {
content = openaiResponse.Choices[0].Message.Content
}
return &ProviderResponse{
Content: content,
ToolCalls: o.toolCalls(*openaiResponse),
Usage: o.usage(*openaiResponse),
FinishReason: o.finishReason(string(openaiResponse.Choices[0].FinishReason)),
}, nil
}
}
func (o *openaiClient) stream(ctx context.Context, messages []message.Message, tools []tools.BaseTool) <-chan ProviderEvent {
params := o.preparedParams(o.convertMessages(messages), o.convertTools(tools))
params.StreamOptions = openai.ChatCompletionStreamOptionsParam{
IncludeUsage: openai.Bool(true),
}
cfg := config.Get()
if cfg.Debug {
jsonData, _ := json.Marshal(params)
logging.Debug("Prepared messages", "messages", string(jsonData))
}
attempts := 0
eventChan := make(chan ProviderEvent)
go func() {
for {
attempts++
openaiStream := o.client.Chat.Completions.NewStreaming(
ctx,
params,
)
acc := openai.ChatCompletionAccumulator{}
currentContent := ""
toolCalls := make([]message.ToolCall, 0)
for openaiStream.Next() {
chunk := openaiStream.Current()
acc.AddChunk(chunk)
if tool, ok := acc.JustFinishedToolCall(); ok {
toolCalls = append(toolCalls, message.ToolCall{
ID: tool.Id,
Name: tool.Name,
Input: tool.Arguments,
Type: "function",
})
}
for _, choice := range chunk.Choices {
if choice.Delta.Content != "" {
eventChan <- ProviderEvent{
Type: EventContentDelta,
Content: choice.Delta.Content,
}
currentContent += choice.Delta.Content
}
}
}
err := openaiStream.Err()
if err == nil || errors.Is(err, io.EOF) {
// Stream completed successfully
eventChan <- ProviderEvent{
Type: EventComplete,
Response: &ProviderResponse{
Content: currentContent,
ToolCalls: toolCalls,
Usage: o.usage(acc.ChatCompletion),
FinishReason: o.finishReason(string(acc.ChatCompletion.Choices[0].FinishReason)),
},
}
close(eventChan)
return
}
// If there is an error we are going to see if we can retry the call
retry, after, retryErr := o.shouldRetry(attempts, err)
if retryErr != nil {
eventChan <- ProviderEvent{Type: EventError, Error: retryErr}
close(eventChan)
return
}
if retry {
logging.WarnPersist("Retrying due to rate limit... attempt %d of %d", logging.PersistTimeArg, time.Millisecond*time.Duration(after+100))
select {
case <-ctx.Done():
// context cancelled
if ctx.Err() == nil {
eventChan <- ProviderEvent{Type: EventError, Error: ctx.Err()}
}
close(eventChan)
return
case <-time.After(time.Duration(after) * time.Millisecond):
continue
}
}
eventChan <- ProviderEvent{Type: EventError, Error: retryErr}
close(eventChan)
return
}
}()
return eventChan
}
func (o *openaiClient) shouldRetry(attempts int, err error) (bool, int64, error) {
var apierr *openai.Error
if !errors.As(err, &apierr) {
return false, 0, err
}
if apierr.StatusCode != 429 && apierr.StatusCode != 500 {
return false, 0, err
}
if attempts > maxRetries {
return false, 0, fmt.Errorf("maximum retry attempts reached for rate limit: %d retries", maxRetries)
}
retryMs := 0
retryAfterValues := apierr.Response.Header.Values("Retry-After")
backoffMs := 2000 * (1 << (attempts - 1))
jitterMs := int(float64(backoffMs) * 0.2)
retryMs = backoffMs + jitterMs
if len(retryAfterValues) > 0 {
if _, err := fmt.Sscanf(retryAfterValues[0], "%d", &retryMs); err == nil {
retryMs = retryMs * 1000
}
}
return true, int64(retryMs), nil
}
func (o *openaiClient) toolCalls(completion openai.ChatCompletion) []message.ToolCall {
var toolCalls []message.ToolCall
if len(completion.Choices) > 0 && len(completion.Choices[0].Message.ToolCalls) > 0 {
for _, call := range completion.Choices[0].Message.ToolCalls {
toolCall := message.ToolCall{
ID: call.ID,
Name: call.Function.Name,
Input: call.Function.Arguments,
Type: "function",
Finished: true,
}
toolCalls = append(toolCalls, toolCall)
}
}
return toolCalls
}
func (o *openaiClient) usage(completion openai.ChatCompletion) TokenUsage {
cachedTokens := completion.Usage.PromptTokensDetails.CachedTokens
inputTokens := completion.Usage.PromptTokens - cachedTokens
return TokenUsage{
InputTokens: inputTokens,
OutputTokens: completion.Usage.CompletionTokens,
CacheCreationTokens: 0, // OpenAI doesn't provide this directly
CacheReadTokens: cachedTokens,
}
}
func WithOpenAIBaseURL(baseURL string) OpenAIOption {
return func(options *openaiOptions) {
options.baseURL = baseURL
}
}
func WithOpenAIDisableCache() OpenAIOption {
return func(options *openaiOptions) {
options.disableCache = true
}
}
func WithReasoningEffort(effort string) OpenAIOption {
return func(options *openaiOptions) {
defaultReasoningEffort := "medium"
switch effort {
case "low", "medium", "high":
defaultReasoningEffort = effort
default:
logging.Warn("Invalid reasoning effort, using default: medium")
}
options.reasoningEffort = defaultReasoningEffort
}
}
+188
View File
@@ -0,0 +1,188 @@
package provider
import (
"context"
"fmt"
"github.com/kujtimiihoxha/opencode/internal/llm/models"
"github.com/kujtimiihoxha/opencode/internal/llm/tools"
"github.com/kujtimiihoxha/opencode/internal/message"
)
type EventType string
const maxRetries = 8
const (
EventContentStart EventType = "content_start"
EventToolUseStart EventType = "tool_use_start"
EventToolUseDelta EventType = "tool_use_delta"
EventToolUseStop EventType = "tool_use_stop"
EventContentDelta EventType = "content_delta"
EventThinkingDelta EventType = "thinking_delta"
EventContentStop EventType = "content_stop"
EventComplete EventType = "complete"
EventError EventType = "error"
EventWarning EventType = "warning"
)
type TokenUsage struct {
InputTokens int64
OutputTokens int64
CacheCreationTokens int64
CacheReadTokens int64
}
type ProviderResponse struct {
Content string
ToolCalls []message.ToolCall
Usage TokenUsage
FinishReason message.FinishReason
}
type ProviderEvent struct {
Type EventType
Content string
Thinking string
Response *ProviderResponse
ToolCall *message.ToolCall
Error error
}
type Provider interface {
SendMessages(ctx context.Context, messages []message.Message, tools []tools.BaseTool) (*ProviderResponse, error)
StreamResponse(ctx context.Context, messages []message.Message, tools []tools.BaseTool) <-chan ProviderEvent
Model() models.Model
}
type providerClientOptions struct {
apiKey string
model models.Model
maxTokens int64
systemMessage string
anthropicOptions []AnthropicOption
openaiOptions []OpenAIOption
geminiOptions []GeminiOption
bedrockOptions []BedrockOption
}
type ProviderClientOption func(*providerClientOptions)
type ProviderClient interface {
send(ctx context.Context, messages []message.Message, tools []tools.BaseTool) (*ProviderResponse, error)
stream(ctx context.Context, messages []message.Message, tools []tools.BaseTool) <-chan ProviderEvent
}
type baseProvider[C ProviderClient] struct {
options providerClientOptions
client C
}
func NewProvider(providerName models.ModelProvider, opts ...ProviderClientOption) (Provider, error) {
clientOptions := providerClientOptions{}
for _, o := range opts {
o(&clientOptions)
}
switch providerName {
case models.ProviderAnthropic:
return &baseProvider[AnthropicClient]{
options: clientOptions,
client: newAnthropicClient(clientOptions),
}, nil
case models.ProviderOpenAI:
return &baseProvider[OpenAIClient]{
options: clientOptions,
client: newOpenAIClient(clientOptions),
}, nil
case models.ProviderGemini:
return &baseProvider[GeminiClient]{
options: clientOptions,
client: newGeminiClient(clientOptions),
}, nil
case models.ProviderBedrock:
return &baseProvider[BedrockClient]{
options: clientOptions,
client: newBedrockClient(clientOptions),
}, nil
case models.ProviderMock:
// TODO: implement mock client for test
panic("not implemented")
}
return nil, fmt.Errorf("provider not supported: %s", providerName)
}
func (p *baseProvider[C]) cleanMessages(messages []message.Message) (cleaned []message.Message) {
for _, msg := range messages {
// The message has no content
if len(msg.Parts) == 0 {
continue
}
cleaned = append(cleaned, msg)
}
return
}
func (p *baseProvider[C]) SendMessages(ctx context.Context, messages []message.Message, tools []tools.BaseTool) (*ProviderResponse, error) {
messages = p.cleanMessages(messages)
return p.client.send(ctx, messages, tools)
}
func (p *baseProvider[C]) Model() models.Model {
return p.options.model
}
func (p *baseProvider[C]) StreamResponse(ctx context.Context, messages []message.Message, tools []tools.BaseTool) <-chan ProviderEvent {
messages = p.cleanMessages(messages)
return p.client.stream(ctx, messages, tools)
}
func WithAPIKey(apiKey string) ProviderClientOption {
return func(options *providerClientOptions) {
options.apiKey = apiKey
}
}
func WithModel(model models.Model) ProviderClientOption {
return func(options *providerClientOptions) {
options.model = model
}
}
func WithMaxTokens(maxTokens int64) ProviderClientOption {
return func(options *providerClientOptions) {
options.maxTokens = maxTokens
}
}
func WithSystemMessage(systemMessage string) ProviderClientOption {
return func(options *providerClientOptions) {
options.systemMessage = systemMessage
}
}
func WithAnthropicOptions(anthropicOptions ...AnthropicOption) ProviderClientOption {
return func(options *providerClientOptions) {
options.anthropicOptions = anthropicOptions
}
}
func WithOpenAIOptions(openaiOptions ...OpenAIOption) ProviderClientOption {
return func(options *providerClientOptions) {
options.openaiOptions = openaiOptions
}
}
func WithGeminiOptions(geminiOptions ...GeminiOption) ProviderClientOption {
return func(options *providerClientOptions) {
options.geminiOptions = geminiOptions
}
}
func WithBedrockOptions(bedrockOptions ...BedrockOption) ProviderClientOption {
return func(options *providerClientOptions) {
options.bedrockOptions = bedrockOptions
}
}
@@ -1,30 +1,62 @@
import { z } from "zod"
import { Tool } from "./tool"
package tools
const MAX_OUTPUT_LENGTH = 30000
const BANNED_COMMANDS = [
"alias",
"curl",
"curlie",
"wget",
"axel",
"aria2c",
"nc",
"telnet",
"lynx",
"w3m",
"links",
"httpie",
"xh",
"http-prompt",
"chrome",
"firefox",
"safari",
]
const DEFAULT_TIMEOUT = 1 * 60 * 1000
const MAX_TIMEOUT = 10 * 60 * 1000
import (
"context"
"encoding/json"
"fmt"
"strings"
"time"
const DESCRIPTION = `Executes a given bash command in a persistent shell session with optional timeout, ensuring proper handling and security measures.
"github.com/kujtimiihoxha/opencode/internal/config"
"github.com/kujtimiihoxha/opencode/internal/llm/tools/shell"
"github.com/kujtimiihoxha/opencode/internal/permission"
)
type BashParams struct {
Command string `json:"command"`
Timeout int `json:"timeout"`
}
type BashPermissionsParams struct {
Command string `json:"command"`
Timeout int `json:"timeout"`
}
type BashResponseMetadata struct {
StartTime int64 `json:"start_time"`
EndTime int64 `json:"end_time"`
}
type bashTool struct {
permissions permission.Service
}
const (
BashToolName = "bash"
DefaultTimeout = 1 * 60 * 1000 // 1 minutes in milliseconds
MaxTimeout = 10 * 60 * 1000 // 10 minutes in milliseconds
MaxOutputLength = 30000
)
var bannedCommands = []string{
"alias", "curl", "curlie", "wget", "axel", "aria2c",
"nc", "telnet", "lynx", "w3m", "links", "httpie", "xh",
"http-prompt", "chrome", "firefox", "safari",
}
var safeReadOnlyCommands = []string{
"ls", "echo", "pwd", "date", "cal", "uptime", "whoami", "id", "groups", "env", "printenv", "set", "unset", "which", "type", "whereis",
"whatis", "uname", "hostname", "df", "du", "free", "top", "ps", "kill", "killall", "nice", "nohup", "time", "timeout",
"git status", "git log", "git diff", "git show", "git branch", "git tag", "git remote", "git ls-files", "git ls-remote",
"git rev-parse", "git config --get", "git config --list", "git describe", "git blame", "git grep", "git shortlog",
"go version", "go help", "go list", "go env", "go doc", "go vet", "go fmt", "go mod", "go test", "go build", "go run", "go install", "go clean",
}
func bashDescription() string {
bannedCommandsStr := strings.Join(bannedCommands, ", ")
return fmt.Sprintf(`Executes a given bash command in a persistent shell session with optional timeout, ensuring proper handling and security measures.
Before executing the command, please follow these steps:
@@ -34,14 +66,14 @@ Before executing the command, please follow these steps:
2. Security Check:
- For security and to limit the threat of a prompt injection attack, some commands are limited or banned. If you use a disallowed command, you will receive an error message explaining the restriction. Explain the error to the User.
- Verify that the command is not one of the banned commands: ${BANNED_COMMANDS.join(", ")}.
- Verify that the command is not one of the banned commands: %s.
3. Command Execution:
- After ensuring proper quoting, execute the command.
- Capture the output of the command.
4. Output Processing:
- If the output exceeds ${MAX_OUTPUT_LENGTH} characters, output will be truncated before being returned to you.
- If the output exceeds %d characters, output will be truncated before being returned to you.
- Prepare the output for display to the user.
5. Return Result:
@@ -168,33 +200,148 @@ EOF
Important:
- Return an empty response - the user will see the gh output directly
- Never update git config`
- Never update git config`, bannedCommandsStr, MaxOutputLength)
}
export const BashTool = Tool.define({
id: "opencode.bash",
description: DESCRIPTION,
parameters: z.object({
command: z.string(),
timeout: z
.number()
.min(0)
.max(MAX_TIMEOUT)
.describe("Optional timeout in milliseconds")
.optional(),
}),
async execute(params) {
const timeout = Math.min(params.timeout ?? DEFAULT_TIMEOUT, MAX_TIMEOUT)
if (BANNED_COMMANDS.some((item) => params.command.startsWith(item)))
throw new Error(`Command '${params.command}' is not allowed`)
func NewBashTool(permission permission.Service) BaseTool {
return &bashTool{
permissions: permission,
}
}
const process = Bun.spawnSync({
cmd: ["bash", "-c", params.command],
maxBuffer: MAX_OUTPUT_LENGTH,
timeout: timeout,
})
return {
metadata: {},
output: process.stdout.toString("utf-8"),
}
},
})
func (b *bashTool) Info() ToolInfo {
return ToolInfo{
Name: BashToolName,
Description: bashDescription(),
Parameters: map[string]any{
"command": map[string]any{
"type": "string",
"description": "The command to execute",
},
"timeout": map[string]any{
"type": "number",
"description": "Optional timeout in milliseconds (max 600000)",
},
},
Required: []string{"command"},
}
}
func (b *bashTool) Run(ctx context.Context, call ToolCall) (ToolResponse, error) {
var params BashParams
if err := json.Unmarshal([]byte(call.Input), &params); err != nil {
return NewTextErrorResponse("invalid parameters"), nil
}
if params.Timeout > MaxTimeout {
params.Timeout = MaxTimeout
} else if params.Timeout <= 0 {
params.Timeout = DefaultTimeout
}
if params.Command == "" {
return NewTextErrorResponse("missing command"), nil
}
baseCmd := strings.Fields(params.Command)[0]
for _, banned := range bannedCommands {
if strings.EqualFold(baseCmd, banned) {
return NewTextErrorResponse(fmt.Sprintf("command '%s' is not allowed", baseCmd)), nil
}
}
isSafeReadOnly := false
cmdLower := strings.ToLower(params.Command)
for _, safe := range safeReadOnlyCommands {
if strings.HasPrefix(cmdLower, strings.ToLower(safe)) {
if len(cmdLower) == len(safe) || cmdLower[len(safe)] == ' ' || cmdLower[len(safe)] == '-' {
isSafeReadOnly = true
break
}
}
}
sessionID, messageID := GetContextValues(ctx)
if sessionID == "" || messageID == "" {
return ToolResponse{}, fmt.Errorf("session ID and message ID are required for creating a new file")
}
if !isSafeReadOnly {
p := b.permissions.Request(
permission.CreatePermissionRequest{
SessionID: sessionID,
Path: config.WorkingDirectory(),
ToolName: BashToolName,
Action: "execute",
Description: fmt.Sprintf("Execute command: %s", params.Command),
Params: BashPermissionsParams{
Command: params.Command,
},
},
)
if !p {
return ToolResponse{}, permission.ErrorPermissionDenied
}
}
startTime := time.Now()
shell := shell.GetPersistentShell(config.WorkingDirectory())
stdout, stderr, exitCode, interrupted, err := shell.Exec(ctx, params.Command, params.Timeout)
if err != nil {
return ToolResponse{}, fmt.Errorf("error executing command: %w", err)
}
stdout = truncateOutput(stdout)
stderr = truncateOutput(stderr)
errorMessage := stderr
if interrupted {
if errorMessage != "" {
errorMessage += "\n"
}
errorMessage += "Command was aborted before completion"
} else if exitCode != 0 {
if errorMessage != "" {
errorMessage += "\n"
}
errorMessage += fmt.Sprintf("Exit code %d", exitCode)
}
hasBothOutputs := stdout != "" && stderr != ""
if hasBothOutputs {
stdout += "\n"
}
if errorMessage != "" {
stdout += "\n" + errorMessage
}
metadata := BashResponseMetadata{
StartTime: startTime.UnixMilli(),
EndTime: time.Now().UnixMilli(),
}
if stdout == "" {
return WithResponseMetadata(NewTextResponse("no output"), metadata), nil
}
return WithResponseMetadata(NewTextResponse(stdout), metadata), nil
}
func truncateOutput(content string) string {
if len(content) <= MaxOutputLength {
return content
}
halfLength := MaxOutputLength / 2
start := content[:halfLength]
end := content[len(content)-halfLength:]
truncatedLinesCount := countLines(content[halfLength : len(content)-halfLength])
return fmt.Sprintf("%s\n\n... [%d lines truncated] ...\n\n%s", start, truncatedLinesCount, end)
}
func countLines(s string) int {
if s == "" {
return 0
}
return len(strings.Split(s, "\n"))
}
+295
View File
@@ -0,0 +1,295 @@
package tools
import (
"context"
"encoding/json"
"fmt"
"maps"
"sort"
"strings"
"time"
"github.com/kujtimiihoxha/opencode/internal/lsp"
"github.com/kujtimiihoxha/opencode/internal/lsp/protocol"
)
type DiagnosticsParams struct {
FilePath string `json:"file_path"`
}
type diagnosticsTool struct {
lspClients map[string]*lsp.Client
}
const (
DiagnosticsToolName = "diagnostics"
diagnosticsDescription = `Get diagnostics for a file and/or project.
WHEN TO USE THIS TOOL:
- Use when you need to check for errors or warnings in your code
- Helpful for debugging and ensuring code quality
- Good for getting a quick overview of issues in a file or project
HOW TO USE:
- Provide a path to a file to get diagnostics for that file
- Leave the path empty to get diagnostics for the entire project
- Results are displayed in a structured format with severity levels
FEATURES:
- Displays errors, warnings, and hints
- Groups diagnostics by severity
- Provides detailed information about each diagnostic
LIMITATIONS:
- Results are limited to the diagnostics provided by the LSP clients
- May not cover all possible issues in the code
- Does not provide suggestions for fixing issues
TIPS:
- Use in conjunction with other tools for a comprehensive code review
- Combine with the LSP client for real-time diagnostics
`
)
func NewDiagnosticsTool(lspClients map[string]*lsp.Client) BaseTool {
return &diagnosticsTool{
lspClients,
}
}
func (b *diagnosticsTool) Info() ToolInfo {
return ToolInfo{
Name: DiagnosticsToolName,
Description: diagnosticsDescription,
Parameters: map[string]any{
"file_path": map[string]any{
"type": "string",
"description": "The path to the file to get diagnostics for (leave w empty for project diagnostics)",
},
},
Required: []string{},
}
}
func (b *diagnosticsTool) Run(ctx context.Context, call ToolCall) (ToolResponse, error) {
var params DiagnosticsParams
if err := json.Unmarshal([]byte(call.Input), &params); err != nil {
return NewTextErrorResponse(fmt.Sprintf("error parsing parameters: %s", err)), nil
}
lsps := b.lspClients
if len(lsps) == 0 {
return NewTextErrorResponse("no LSP clients available"), nil
}
if params.FilePath != "" {
notifyLspOpenFile(ctx, params.FilePath, lsps)
waitForLspDiagnostics(ctx, params.FilePath, lsps)
}
output := getDiagnostics(params.FilePath, lsps)
return NewTextResponse(output), nil
}
func notifyLspOpenFile(ctx context.Context, filePath string, lsps map[string]*lsp.Client) {
for _, client := range lsps {
err := client.OpenFile(ctx, filePath)
if err != nil {
continue
}
}
}
func waitForLspDiagnostics(ctx context.Context, filePath string, lsps map[string]*lsp.Client) {
if len(lsps) == 0 {
return
}
diagChan := make(chan struct{}, 1)
for _, client := range lsps {
originalDiags := make(map[protocol.DocumentUri][]protocol.Diagnostic)
maps.Copy(originalDiags, client.GetDiagnostics())
handler := func(params json.RawMessage) {
lsp.HandleDiagnostics(client, params)
var diagParams protocol.PublishDiagnosticsParams
if err := json.Unmarshal(params, &diagParams); err != nil {
return
}
if diagParams.URI.Path() == filePath || hasDiagnosticsChanged(client.GetDiagnostics(), originalDiags) {
select {
case diagChan <- struct{}{}:
default:
}
}
}
client.RegisterNotificationHandler("textDocument/publishDiagnostics", handler)
if client.IsFileOpen(filePath) {
err := client.NotifyChange(ctx, filePath)
if err != nil {
continue
}
} else {
err := client.OpenFile(ctx, filePath)
if err != nil {
continue
}
}
}
select {
case <-diagChan:
case <-time.After(5 * time.Second):
case <-ctx.Done():
}
}
func hasDiagnosticsChanged(current, original map[protocol.DocumentUri][]protocol.Diagnostic) bool {
for uri, diags := range current {
origDiags, exists := original[uri]
if !exists || len(diags) != len(origDiags) {
return true
}
}
return false
}
func getDiagnostics(filePath string, lsps map[string]*lsp.Client) string {
fileDiagnostics := []string{}
projectDiagnostics := []string{}
formatDiagnostic := func(pth string, diagnostic protocol.Diagnostic, source string) string {
severity := "Info"
switch diagnostic.Severity {
case protocol.SeverityError:
severity = "Error"
case protocol.SeverityWarning:
severity = "Warn"
case protocol.SeverityHint:
severity = "Hint"
}
location := fmt.Sprintf("%s:%d:%d", pth, diagnostic.Range.Start.Line+1, diagnostic.Range.Start.Character+1)
sourceInfo := ""
if diagnostic.Source != "" {
sourceInfo = diagnostic.Source
} else if source != "" {
sourceInfo = source
}
codeInfo := ""
if diagnostic.Code != nil {
codeInfo = fmt.Sprintf("[%v]", diagnostic.Code)
}
tagsInfo := ""
if len(diagnostic.Tags) > 0 {
tags := []string{}
for _, tag := range diagnostic.Tags {
switch tag {
case protocol.Unnecessary:
tags = append(tags, "unnecessary")
case protocol.Deprecated:
tags = append(tags, "deprecated")
}
}
if len(tags) > 0 {
tagsInfo = fmt.Sprintf(" (%s)", strings.Join(tags, ", "))
}
}
return fmt.Sprintf("%s: %s [%s]%s%s %s",
severity,
location,
sourceInfo,
codeInfo,
tagsInfo,
diagnostic.Message)
}
for lspName, client := range lsps {
diagnostics := client.GetDiagnostics()
if len(diagnostics) > 0 {
for location, diags := range diagnostics {
isCurrentFile := location.Path() == filePath
for _, diag := range diags {
formattedDiag := formatDiagnostic(location.Path(), diag, lspName)
if isCurrentFile {
fileDiagnostics = append(fileDiagnostics, formattedDiag)
} else {
projectDiagnostics = append(projectDiagnostics, formattedDiag)
}
}
}
}
}
sort.Slice(fileDiagnostics, func(i, j int) bool {
iIsError := strings.HasPrefix(fileDiagnostics[i], "Error")
jIsError := strings.HasPrefix(fileDiagnostics[j], "Error")
if iIsError != jIsError {
return iIsError // Errors come first
}
return fileDiagnostics[i] < fileDiagnostics[j] // Then alphabetically
})
sort.Slice(projectDiagnostics, func(i, j int) bool {
iIsError := strings.HasPrefix(projectDiagnostics[i], "Error")
jIsError := strings.HasPrefix(projectDiagnostics[j], "Error")
if iIsError != jIsError {
return iIsError
}
return projectDiagnostics[i] < projectDiagnostics[j]
})
output := ""
if len(fileDiagnostics) > 0 {
output += "\n<file_diagnostics>\n"
if len(fileDiagnostics) > 10 {
output += strings.Join(fileDiagnostics[:10], "\n")
output += fmt.Sprintf("\n... and %d more diagnostics", len(fileDiagnostics)-10)
} else {
output += strings.Join(fileDiagnostics, "\n")
}
output += "\n</file_diagnostics>\n"
}
if len(projectDiagnostics) > 0 {
output += "\n<project_diagnostics>\n"
if len(projectDiagnostics) > 10 {
output += strings.Join(projectDiagnostics[:10], "\n")
output += fmt.Sprintf("\n... and %d more diagnostics", len(projectDiagnostics)-10)
} else {
output += strings.Join(projectDiagnostics, "\n")
}
output += "\n</project_diagnostics>\n"
}
if len(fileDiagnostics) > 0 || len(projectDiagnostics) > 0 {
fileErrors := countSeverity(fileDiagnostics, "Error")
fileWarnings := countSeverity(fileDiagnostics, "Warn")
projectErrors := countSeverity(projectDiagnostics, "Error")
projectWarnings := countSeverity(projectDiagnostics, "Warn")
output += "\n<diagnostic_summary>\n"
output += fmt.Sprintf("Current file: %d errors, %d warnings\n", fileErrors, fileWarnings)
output += fmt.Sprintf("Project: %d errors, %d warnings\n", projectErrors, projectWarnings)
output += "</diagnostic_summary>\n"
}
return output
}
func countSeverity(diagnostics []string, severity string) int {
count := 0
for _, diag := range diagnostics {
if strings.HasPrefix(diag, severity) {
count++
}
}
return count
}
+489
View File
@@ -0,0 +1,489 @@
package tools
import (
"context"
"encoding/json"
"fmt"
"os"
"path/filepath"
"strings"
"time"
"github.com/kujtimiihoxha/opencode/internal/config"
"github.com/kujtimiihoxha/opencode/internal/diff"
"github.com/kujtimiihoxha/opencode/internal/history"
"github.com/kujtimiihoxha/opencode/internal/logging"
"github.com/kujtimiihoxha/opencode/internal/lsp"
"github.com/kujtimiihoxha/opencode/internal/permission"
)
type EditParams struct {
FilePath string `json:"file_path"`
OldString string `json:"old_string"`
NewString string `json:"new_string"`
}
type EditPermissionsParams struct {
FilePath string `json:"file_path"`
Diff string `json:"diff"`
}
type EditResponseMetadata struct {
Diff string `json:"diff"`
Additions int `json:"additions"`
Removals int `json:"removals"`
}
type editTool struct {
lspClients map[string]*lsp.Client
permissions permission.Service
files history.Service
}
const (
EditToolName = "edit"
editDescription = `Edits files by replacing text, creating new files, or deleting content. For moving or renaming files, use the Bash tool with the 'mv' command instead. For larger file edits, use the FileWrite tool to overwrite files.
Before using this tool:
1. Use the FileRead tool to understand the file's contents and context
2. Verify the directory path is correct (only applicable when creating new files):
- Use the LS tool to verify the parent directory exists and is the correct location
To make a file edit, provide the following:
1. file_path: The absolute path to the file to modify (must be absolute, not relative)
2. old_string: The text to replace (must be unique within the file, and must match the file contents exactly, including all whitespace and indentation)
3. new_string: The edited text to replace the old_string
Special cases:
- To create a new file: provide file_path and new_string, leave old_string empty
- To delete content: provide file_path and old_string, leave new_string empty
The tool will replace ONE occurrence of old_string with new_string in the specified file.
CRITICAL REQUIREMENTS FOR USING THIS TOOL:
1. UNIQUENESS: The old_string MUST uniquely identify the specific instance you want to change. This means:
- Include AT LEAST 3-5 lines of context BEFORE the change point
- Include AT LEAST 3-5 lines of context AFTER the change point
- Include all whitespace, indentation, and surrounding code exactly as it appears in the file
2. SINGLE INSTANCE: This tool can only change ONE instance at a time. If you need to change multiple instances:
- Make separate calls to this tool for each instance
- Each call must uniquely identify its specific instance using extensive context
3. VERIFICATION: Before using this tool:
- Check how many instances of the target text exist in the file
- If multiple instances exist, gather enough context to uniquely identify each one
- Plan separate tool calls for each instance
WARNING: If you do not follow these requirements:
- The tool will fail if old_string matches multiple locations
- The tool will fail if old_string doesn't match exactly (including whitespace)
- You may change the wrong instance if you don't include enough context
When making edits:
- Ensure the edit results in idiomatic, correct code
- Do not leave the code in a broken state
- Always use absolute file paths (starting with /)
Remember: when making multiple file edits in a row to the same file, you should prefer to send all edits in a single message with multiple calls to this tool, rather than multiple messages with a single call each.`
)
func NewEditTool(lspClients map[string]*lsp.Client, permissions permission.Service, files history.Service) BaseTool {
return &editTool{
lspClients: lspClients,
permissions: permissions,
files: files,
}
}
func (e *editTool) Info() ToolInfo {
return ToolInfo{
Name: EditToolName,
Description: editDescription,
Parameters: map[string]any{
"file_path": map[string]any{
"type": "string",
"description": "The absolute path to the file to modify",
},
"old_string": map[string]any{
"type": "string",
"description": "The text to replace",
},
"new_string": map[string]any{
"type": "string",
"description": "The text to replace it with",
},
},
Required: []string{"file_path", "old_string", "new_string"},
}
}
func (e *editTool) Run(ctx context.Context, call ToolCall) (ToolResponse, error) {
var params EditParams
if err := json.Unmarshal([]byte(call.Input), &params); err != nil {
return NewTextErrorResponse("invalid parameters"), nil
}
if params.FilePath == "" {
return NewTextErrorResponse("file_path is required"), nil
}
if !filepath.IsAbs(params.FilePath) {
wd := config.WorkingDirectory()
params.FilePath = filepath.Join(wd, params.FilePath)
}
var response ToolResponse
var err error
if params.OldString == "" {
response, err = e.createNewFile(ctx, params.FilePath, params.NewString)
if err != nil {
return response, err
}
}
if params.NewString == "" {
response, err = e.deleteContent(ctx, params.FilePath, params.OldString)
if err != nil {
return response, err
}
}
response, err = e.replaceContent(ctx, params.FilePath, params.OldString, params.NewString)
if err != nil {
return response, err
}
if response.IsError {
// Return early if there was an error during content replacement
// This prevents unnecessary LSP diagnostics processing
return response, nil
}
waitForLspDiagnostics(ctx, params.FilePath, e.lspClients)
text := fmt.Sprintf("<result>\n%s\n</result>\n", response.Content)
text += getDiagnostics(params.FilePath, e.lspClients)
response.Content = text
return response, nil
}
func (e *editTool) createNewFile(ctx context.Context, filePath, content string) (ToolResponse, error) {
fileInfo, err := os.Stat(filePath)
if err == nil {
if fileInfo.IsDir() {
return NewTextErrorResponse(fmt.Sprintf("path is a directory, not a file: %s", filePath)), nil
}
return NewTextErrorResponse(fmt.Sprintf("file already exists: %s", filePath)), nil
} else if !os.IsNotExist(err) {
return ToolResponse{}, fmt.Errorf("failed to access file: %w", err)
}
dir := filepath.Dir(filePath)
if err = os.MkdirAll(dir, 0o755); err != nil {
return ToolResponse{}, fmt.Errorf("failed to create parent directories: %w", err)
}
sessionID, messageID := GetContextValues(ctx)
if sessionID == "" || messageID == "" {
return ToolResponse{}, fmt.Errorf("session ID and message ID are required for creating a new file")
}
diff, additions, removals := diff.GenerateDiff(
"",
content,
filePath,
)
rootDir := config.WorkingDirectory()
permissionPath := filepath.Dir(filePath)
if strings.HasPrefix(filePath, rootDir) {
permissionPath = rootDir
}
p := e.permissions.Request(
permission.CreatePermissionRequest{
SessionID: sessionID,
Path: permissionPath,
ToolName: EditToolName,
Action: "write",
Description: fmt.Sprintf("Create file %s", filePath),
Params: EditPermissionsParams{
FilePath: filePath,
Diff: diff,
},
},
)
if !p {
return ToolResponse{}, permission.ErrorPermissionDenied
}
err = os.WriteFile(filePath, []byte(content), 0o644)
if err != nil {
return ToolResponse{}, fmt.Errorf("failed to write file: %w", err)
}
// File can't be in the history so we create a new file history
_, err = e.files.Create(ctx, sessionID, filePath, "")
if err != nil {
// Log error but don't fail the operation
return ToolResponse{}, fmt.Errorf("error creating file history: %w", err)
}
// Add the new content to the file history
_, err = e.files.CreateVersion(ctx, sessionID, filePath, content)
if err != nil {
// Log error but don't fail the operation
logging.Debug("Error creating file history version", "error", err)
}
recordFileWrite(filePath)
recordFileRead(filePath)
return WithResponseMetadata(
NewTextResponse("File created: "+filePath),
EditResponseMetadata{
Diff: diff,
Additions: additions,
Removals: removals,
},
), nil
}
func (e *editTool) deleteContent(ctx context.Context, filePath, oldString string) (ToolResponse, error) {
fileInfo, err := os.Stat(filePath)
if err != nil {
if os.IsNotExist(err) {
return NewTextErrorResponse(fmt.Sprintf("file not found: %s", filePath)), nil
}
return ToolResponse{}, fmt.Errorf("failed to access file: %w", err)
}
if fileInfo.IsDir() {
return NewTextErrorResponse(fmt.Sprintf("path is a directory, not a file: %s", filePath)), nil
}
if getLastReadTime(filePath).IsZero() {
return NewTextErrorResponse("you must read the file before editing it. Use the View tool first"), nil
}
modTime := fileInfo.ModTime()
lastRead := getLastReadTime(filePath)
if modTime.After(lastRead) {
return NewTextErrorResponse(
fmt.Sprintf("file %s has been modified since it was last read (mod time: %s, last read: %s)",
filePath, modTime.Format(time.RFC3339), lastRead.Format(time.RFC3339),
)), nil
}
content, err := os.ReadFile(filePath)
if err != nil {
return ToolResponse{}, fmt.Errorf("failed to read file: %w", err)
}
oldContent := string(content)
index := strings.Index(oldContent, oldString)
if index == -1 {
return NewTextErrorResponse("old_string not found in file. Make sure it matches exactly, including whitespace and line breaks"), nil
}
lastIndex := strings.LastIndex(oldContent, oldString)
if index != lastIndex {
return NewTextErrorResponse("old_string appears multiple times in the file. Please provide more context to ensure a unique match"), nil
}
newContent := oldContent[:index] + oldContent[index+len(oldString):]
sessionID, messageID := GetContextValues(ctx)
if sessionID == "" || messageID == "" {
return ToolResponse{}, fmt.Errorf("session ID and message ID are required for creating a new file")
}
diff, additions, removals := diff.GenerateDiff(
oldContent,
newContent,
filePath,
)
rootDir := config.WorkingDirectory()
permissionPath := filepath.Dir(filePath)
if strings.HasPrefix(filePath, rootDir) {
permissionPath = rootDir
}
p := e.permissions.Request(
permission.CreatePermissionRequest{
SessionID: sessionID,
Path: permissionPath,
ToolName: EditToolName,
Action: "write",
Description: fmt.Sprintf("Delete content from file %s", filePath),
Params: EditPermissionsParams{
FilePath: filePath,
Diff: diff,
},
},
)
if !p {
return ToolResponse{}, permission.ErrorPermissionDenied
}
err = os.WriteFile(filePath, []byte(newContent), 0o644)
if err != nil {
return ToolResponse{}, fmt.Errorf("failed to write file: %w", err)
}
// Check if file exists in history
file, err := e.files.GetByPathAndSession(ctx, filePath, sessionID)
if err != nil {
_, err = e.files.Create(ctx, sessionID, filePath, oldContent)
if err != nil {
// Log error but don't fail the operation
return ToolResponse{}, fmt.Errorf("error creating file history: %w", err)
}
}
if file.Content != oldContent {
// User Manually changed the content store an intermediate version
_, err = e.files.CreateVersion(ctx, sessionID, filePath, oldContent)
if err != nil {
logging.Debug("Error creating file history version", "error", err)
}
}
// Store the new version
_, err = e.files.CreateVersion(ctx, sessionID, filePath, "")
if err != nil {
logging.Debug("Error creating file history version", "error", err)
}
recordFileWrite(filePath)
recordFileRead(filePath)
return WithResponseMetadata(
NewTextResponse("Content deleted from file: "+filePath),
EditResponseMetadata{
Diff: diff,
Additions: additions,
Removals: removals,
},
), nil
}
func (e *editTool) replaceContent(ctx context.Context, filePath, oldString, newString string) (ToolResponse, error) {
fileInfo, err := os.Stat(filePath)
if err != nil {
if os.IsNotExist(err) {
return NewTextErrorResponse(fmt.Sprintf("file not found: %s", filePath)), nil
}
return ToolResponse{}, fmt.Errorf("failed to access file: %w", err)
}
if fileInfo.IsDir() {
return NewTextErrorResponse(fmt.Sprintf("path is a directory, not a file: %s", filePath)), nil
}
if getLastReadTime(filePath).IsZero() {
return NewTextErrorResponse("you must read the file before editing it. Use the View tool first"), nil
}
modTime := fileInfo.ModTime()
lastRead := getLastReadTime(filePath)
if modTime.After(lastRead) {
return NewTextErrorResponse(
fmt.Sprintf("file %s has been modified since it was last read (mod time: %s, last read: %s)",
filePath, modTime.Format(time.RFC3339), lastRead.Format(time.RFC3339),
)), nil
}
content, err := os.ReadFile(filePath)
if err != nil {
return ToolResponse{}, fmt.Errorf("failed to read file: %w", err)
}
oldContent := string(content)
index := strings.Index(oldContent, oldString)
if index == -1 {
return NewTextErrorResponse("old_string not found in file. Make sure it matches exactly, including whitespace and line breaks"), nil
}
lastIndex := strings.LastIndex(oldContent, oldString)
if index != lastIndex {
return NewTextErrorResponse("old_string appears multiple times in the file. Please provide more context to ensure a unique match"), nil
}
newContent := oldContent[:index] + newString + oldContent[index+len(oldString):]
if oldContent == newContent {
return NewTextErrorResponse("new content is the same as old content. No changes made."), nil
}
sessionID, messageID := GetContextValues(ctx)
if sessionID == "" || messageID == "" {
return ToolResponse{}, fmt.Errorf("session ID and message ID are required for creating a new file")
}
diff, additions, removals := diff.GenerateDiff(
oldContent,
newContent,
filePath,
)
rootDir := config.WorkingDirectory()
permissionPath := filepath.Dir(filePath)
if strings.HasPrefix(filePath, rootDir) {
permissionPath = rootDir
}
p := e.permissions.Request(
permission.CreatePermissionRequest{
SessionID: sessionID,
Path: permissionPath,
ToolName: EditToolName,
Action: "write",
Description: fmt.Sprintf("Replace content in file %s", filePath),
Params: EditPermissionsParams{
FilePath: filePath,
Diff: diff,
},
},
)
if !p {
return ToolResponse{}, permission.ErrorPermissionDenied
}
err = os.WriteFile(filePath, []byte(newContent), 0o644)
if err != nil {
return ToolResponse{}, fmt.Errorf("failed to write file: %w", err)
}
// Check if file exists in history
file, err := e.files.GetByPathAndSession(ctx, filePath, sessionID)
if err != nil {
_, err = e.files.Create(ctx, sessionID, filePath, oldContent)
if err != nil {
// Log error but don't fail the operation
return ToolResponse{}, fmt.Errorf("error creating file history: %w", err)
}
}
if file.Content != oldContent {
// User Manually changed the content store an intermediate version
_, err = e.files.CreateVersion(ctx, sessionID, filePath, oldContent)
if err != nil {
logging.Debug("Error creating file history version", "error", err)
}
}
// Store the new version
_, err = e.files.CreateVersion(ctx, sessionID, filePath, newContent)
if err != nil {
logging.Debug("Error creating file history version", "error", err)
}
recordFileWrite(filePath)
recordFileRead(filePath)
return WithResponseMetadata(
NewTextResponse("Content replaced in file: "+filePath),
EditResponseMetadata{
Diff: diff,
Additions: additions,
Removals: removals,
}), nil
}
+227
View File
@@ -0,0 +1,227 @@
package tools
import (
"context"
"encoding/json"
"fmt"
"io"
"net/http"
"strings"
"time"
md "github.com/JohannesKaufmann/html-to-markdown"
"github.com/PuerkitoBio/goquery"
"github.com/kujtimiihoxha/opencode/internal/config"
"github.com/kujtimiihoxha/opencode/internal/permission"
)
type FetchParams struct {
URL string `json:"url"`
Format string `json:"format"`
Timeout int `json:"timeout,omitempty"`
}
type FetchPermissionsParams struct {
URL string `json:"url"`
Format string `json:"format"`
Timeout int `json:"timeout,omitempty"`
}
type fetchTool struct {
client *http.Client
permissions permission.Service
}
const (
FetchToolName = "fetch"
fetchToolDescription = `Fetches content from a URL and returns it in the specified format.
WHEN TO USE THIS TOOL:
- Use when you need to download content from a URL
- Helpful for retrieving documentation, API responses, or web content
- Useful for getting external information to assist with tasks
HOW TO USE:
- Provide the URL to fetch content from
- Specify the desired output format (text, markdown, or html)
- Optionally set a timeout for the request
FEATURES:
- Supports three output formats: text, markdown, and html
- Automatically handles HTTP redirects
- Sets reasonable timeouts to prevent hanging
- Validates input parameters before making requests
LIMITATIONS:
- Maximum response size is 5MB
- Only supports HTTP and HTTPS protocols
- Cannot handle authentication or cookies
- Some websites may block automated requests
TIPS:
- Use text format for plain text content or simple API responses
- Use markdown format for content that should be rendered with formatting
- Use html format when you need the raw HTML structure
- Set appropriate timeouts for potentially slow websites`
)
func NewFetchTool(permissions permission.Service) BaseTool {
return &fetchTool{
client: &http.Client{
Timeout: 30 * time.Second,
},
permissions: permissions,
}
}
func (t *fetchTool) Info() ToolInfo {
return ToolInfo{
Name: FetchToolName,
Description: fetchToolDescription,
Parameters: map[string]any{
"url": map[string]any{
"type": "string",
"description": "The URL to fetch content from",
},
"format": map[string]any{
"type": "string",
"description": "The format to return the content in (text, markdown, or html)",
"enum": []string{"text", "markdown", "html"},
},
"timeout": map[string]any{
"type": "number",
"description": "Optional timeout in seconds (max 120)",
},
},
Required: []string{"url", "format"},
}
}
func (t *fetchTool) Run(ctx context.Context, call ToolCall) (ToolResponse, error) {
var params FetchParams
if err := json.Unmarshal([]byte(call.Input), &params); err != nil {
return NewTextErrorResponse("Failed to parse fetch parameters: " + err.Error()), nil
}
if params.URL == "" {
return NewTextErrorResponse("URL parameter is required"), nil
}
format := strings.ToLower(params.Format)
if format != "text" && format != "markdown" && format != "html" {
return NewTextErrorResponse("Format must be one of: text, markdown, html"), nil
}
if !strings.HasPrefix(params.URL, "http://") && !strings.HasPrefix(params.URL, "https://") {
return NewTextErrorResponse("URL must start with http:// or https://"), nil
}
sessionID, messageID := GetContextValues(ctx)
if sessionID == "" || messageID == "" {
return ToolResponse{}, fmt.Errorf("session ID and message ID are required for creating a new file")
}
p := t.permissions.Request(
permission.CreatePermissionRequest{
SessionID: sessionID,
Path: config.WorkingDirectory(),
ToolName: FetchToolName,
Action: "fetch",
Description: fmt.Sprintf("Fetch content from URL: %s", params.URL),
Params: FetchPermissionsParams(params),
},
)
if !p {
return ToolResponse{}, permission.ErrorPermissionDenied
}
client := t.client
if params.Timeout > 0 {
maxTimeout := 120 // 2 minutes
if params.Timeout > maxTimeout {
params.Timeout = maxTimeout
}
client = &http.Client{
Timeout: time.Duration(params.Timeout) * time.Second,
}
}
req, err := http.NewRequestWithContext(ctx, "GET", params.URL, nil)
if err != nil {
return ToolResponse{}, fmt.Errorf("failed to create request: %w", err)
}
req.Header.Set("User-Agent", "opencode/1.0")
resp, err := client.Do(req)
if err != nil {
return ToolResponse{}, fmt.Errorf("failed to fetch URL: %w", err)
}
defer resp.Body.Close()
if resp.StatusCode != http.StatusOK {
return NewTextErrorResponse(fmt.Sprintf("Request failed with status code: %d", resp.StatusCode)), nil
}
maxSize := int64(5 * 1024 * 1024) // 5MB
body, err := io.ReadAll(io.LimitReader(resp.Body, maxSize))
if err != nil {
return NewTextErrorResponse("Failed to read response body: " + err.Error()), nil
}
content := string(body)
contentType := resp.Header.Get("Content-Type")
switch format {
case "text":
if strings.Contains(contentType, "text/html") {
text, err := extractTextFromHTML(content)
if err != nil {
return NewTextErrorResponse("Failed to extract text from HTML: " + err.Error()), nil
}
return NewTextResponse(text), nil
}
return NewTextResponse(content), nil
case "markdown":
if strings.Contains(contentType, "text/html") {
markdown, err := convertHTMLToMarkdown(content)
if err != nil {
return NewTextErrorResponse("Failed to convert HTML to Markdown: " + err.Error()), nil
}
return NewTextResponse(markdown), nil
}
return NewTextResponse("```\n" + content + "\n```"), nil
case "html":
return NewTextResponse(content), nil
default:
return NewTextResponse(content), nil
}
}
func extractTextFromHTML(html string) (string, error) {
doc, err := goquery.NewDocumentFromReader(strings.NewReader(html))
if err != nil {
return "", err
}
text := doc.Text()
text = strings.Join(strings.Fields(text), " ")
return text, nil
}
func convertHTMLToMarkdown(html string) (string, error) {
converter := md.NewConverter("", true, nil)
markdown, err := converter.ConvertString(html)
if err != nil {
return "", err
}
return markdown, nil
}
+53
View File
@@ -0,0 +1,53 @@
package tools
import (
"sync"
"time"
)
// File record to track when files were read/written
type fileRecord struct {
path string
readTime time.Time
writeTime time.Time
}
var (
fileRecords = make(map[string]fileRecord)
fileRecordMutex sync.RWMutex
)
func recordFileRead(path string) {
fileRecordMutex.Lock()
defer fileRecordMutex.Unlock()
record, exists := fileRecords[path]
if !exists {
record = fileRecord{path: path}
}
record.readTime = time.Now()
fileRecords[path] = record
}
func getLastReadTime(path string) time.Time {
fileRecordMutex.RLock()
defer fileRecordMutex.RUnlock()
record, exists := fileRecords[path]
if !exists {
return time.Time{}
}
return record.readTime
}
func recordFileWrite(path string) {
fileRecordMutex.Lock()
defer fileRecordMutex.Unlock()
record, exists := fileRecords[path]
if !exists {
record = fileRecord{path: path}
}
record.writeTime = time.Now()
fileRecords[path] = record
}
+233
View File
@@ -0,0 +1,233 @@
package tools
import (
"context"
"encoding/json"
"fmt"
"io/fs"
"os"
"path/filepath"
"sort"
"strings"
"time"
"github.com/bmatcuk/doublestar/v4"
"github.com/kujtimiihoxha/opencode/internal/config"
)
const (
GlobToolName = "glob"
globDescription = `Fast file pattern matching tool that finds files by name and pattern, returning matching paths sorted by modification time (newest first).
WHEN TO USE THIS TOOL:
- Use when you need to find files by name patterns or extensions
- Great for finding specific file types across a directory structure
- Useful for discovering files that match certain naming conventions
HOW TO USE:
- Provide a glob pattern to match against file paths
- Optionally specify a starting directory (defaults to current working directory)
- Results are sorted with most recently modified files first
GLOB PATTERN SYNTAX:
- '*' matches any sequence of non-separator characters
- '**' matches any sequence of characters, including separators
- '?' matches any single non-separator character
- '[...]' matches any character in the brackets
- '[!...]' matches any character not in the brackets
COMMON PATTERN EXAMPLES:
- '*.js' - Find all JavaScript files in the current directory
- '**/*.js' - Find all JavaScript files in any subdirectory
- 'src/**/*.{ts,tsx}' - Find all TypeScript files in the src directory
- '*.{html,css,js}' - Find all HTML, CSS, and JS files
LIMITATIONS:
- Results are limited to 100 files (newest first)
- Does not search file contents (use Grep tool for that)
- Hidden files (starting with '.') are skipped
TIPS:
- For the most useful results, combine with the Grep tool: first find files with Glob, then search their contents with Grep
- When doing iterative exploration that may require multiple rounds of searching, consider using the Agent tool instead
- Always check if results are truncated and refine your search pattern if needed`
)
type fileInfo struct {
path string
modTime time.Time
}
type GlobParams struct {
Pattern string `json:"pattern"`
Path string `json:"path"`
}
type GlobResponseMetadata struct {
NumberOfFiles int `json:"number_of_files"`
Truncated bool `json:"truncated"`
}
type globTool struct{}
func NewGlobTool() BaseTool {
return &globTool{}
}
func (g *globTool) Info() ToolInfo {
return ToolInfo{
Name: GlobToolName,
Description: globDescription,
Parameters: map[string]any{
"pattern": map[string]any{
"type": "string",
"description": "The glob pattern to match files against",
},
"path": map[string]any{
"type": "string",
"description": "The directory to search in. Defaults to the current working directory.",
},
},
Required: []string{"pattern"},
}
}
func (g *globTool) Run(ctx context.Context, call ToolCall) (ToolResponse, error) {
var params GlobParams
if err := json.Unmarshal([]byte(call.Input), &params); err != nil {
return NewTextErrorResponse(fmt.Sprintf("error parsing parameters: %s", err)), nil
}
if params.Pattern == "" {
return NewTextErrorResponse("pattern is required"), nil
}
searchPath := params.Path
if searchPath == "" {
searchPath = config.WorkingDirectory()
}
files, truncated, err := globFiles(params.Pattern, searchPath, 100)
if err != nil {
return ToolResponse{}, fmt.Errorf("error finding files: %w", err)
}
var output string
if len(files) == 0 {
output = "No files found"
} else {
output = strings.Join(files, "\n")
if truncated {
output += "\n\n(Results are truncated. Consider using a more specific path or pattern.)"
}
}
return WithResponseMetadata(
NewTextResponse(output),
GlobResponseMetadata{
NumberOfFiles: len(files),
Truncated: truncated,
},
), nil
}
func globFiles(pattern, searchPath string, limit int) ([]string, bool, error) {
if !strings.HasPrefix(pattern, "/") && !strings.HasPrefix(pattern, searchPath) {
if !strings.HasSuffix(searchPath, "/") {
searchPath += "/"
}
pattern = searchPath + pattern
}
fsys := os.DirFS("/")
relPattern := strings.TrimPrefix(pattern, "/")
var matches []fileInfo
err := doublestar.GlobWalk(fsys, relPattern, func(path string, d fs.DirEntry) error {
if d.IsDir() {
return nil
}
if skipHidden(path) {
return nil
}
info, err := d.Info()
if err != nil {
return nil // Skip files we can't access
}
absPath := "/" + path // Restore absolute path
matches = append(matches, fileInfo{
path: absPath,
modTime: info.ModTime(),
})
if len(matches) >= limit*2 { // Collect more than needed for sorting
return fs.SkipAll
}
return nil
})
if err != nil {
return nil, false, fmt.Errorf("glob walk error: %w", err)
}
sort.Slice(matches, func(i, j int) bool {
return matches[i].modTime.After(matches[j].modTime)
})
truncated := len(matches) > limit
if truncated {
matches = matches[:limit]
}
results := make([]string, len(matches))
for i, m := range matches {
results[i] = m.path
}
return results, truncated, nil
}
func skipHidden(path string) bool {
// Check for hidden files (starting with a dot)
base := filepath.Base(path)
if base != "." && strings.HasPrefix(base, ".") {
return true
}
// List of commonly ignored directories in development projects
commonIgnoredDirs := map[string]bool{
"node_modules": true,
"vendor": true,
"dist": true,
"build": true,
"target": true,
".git": true,
".idea": true,
".vscode": true,
"__pycache__": true,
"bin": true,
"obj": true,
"out": true,
"coverage": true,
"tmp": true,
"temp": true,
"logs": true,
"generated": true,
"bower_components": true,
"jspm_packages": true,
}
// Check if any path component is in our ignore list
parts := strings.SplitSeq(path, string(os.PathSeparator))
for part := range parts {
if commonIgnoredDirs[part] {
return true
}
}
return false
}
+358
View File
@@ -0,0 +1,358 @@
package tools
import (
"bufio"
"context"
"encoding/json"
"fmt"
"os"
"os/exec"
"path/filepath"
"regexp"
"sort"
"strconv"
"strings"
"time"
"github.com/kujtimiihoxha/opencode/internal/config"
)
type GrepParams struct {
Pattern string `json:"pattern"`
Path string `json:"path"`
Include string `json:"include"`
LiteralText bool `json:"literal_text"`
}
type grepMatch struct {
path string
modTime time.Time
lineNum int
lineText string
}
type GrepResponseMetadata struct {
NumberOfMatches int `json:"number_of_matches"`
Truncated bool `json:"truncated"`
}
type grepTool struct{}
const (
GrepToolName = "grep"
grepDescription = `Fast content search tool that finds files containing specific text or patterns, returning matching file paths sorted by modification time (newest first).
WHEN TO USE THIS TOOL:
- Use when you need to find files containing specific text or patterns
- Great for searching code bases for function names, variable declarations, or error messages
- Useful for finding all files that use a particular API or pattern
HOW TO USE:
- Provide a regex pattern to search for within file contents
- Set literal_text=true if you want to search for the exact text with special characters (recommended for non-regex users)
- Optionally specify a starting directory (defaults to current working directory)
- Optionally provide an include pattern to filter which files to search
- Results are sorted with most recently modified files first
REGEX PATTERN SYNTAX (when literal_text=false):
- Supports standard regular expression syntax
- 'function' searches for the literal text "function"
- 'log\..*Error' finds text starting with "log." and ending with "Error"
- 'import\s+.*\s+from' finds import statements in JavaScript/TypeScript
COMMON INCLUDE PATTERN EXAMPLES:
- '*.js' - Only search JavaScript files
- '*.{ts,tsx}' - Only search TypeScript files
- '*.go' - Only search Go files
LIMITATIONS:
- Results are limited to 100 files (newest first)
- Performance depends on the number of files being searched
- Very large binary files may be skipped
- Hidden files (starting with '.') are skipped
TIPS:
- For faster, more targeted searches, first use Glob to find relevant files, then use Grep
- When doing iterative exploration that may require multiple rounds of searching, consider using the Agent tool instead
- Always check if results are truncated and refine your search pattern if needed
- Use literal_text=true when searching for exact text containing special characters like dots, parentheses, etc.`
)
func NewGrepTool() BaseTool {
return &grepTool{}
}
func (g *grepTool) Info() ToolInfo {
return ToolInfo{
Name: GrepToolName,
Description: grepDescription,
Parameters: map[string]any{
"pattern": map[string]any{
"type": "string",
"description": "The regex pattern to search for in file contents",
},
"path": map[string]any{
"type": "string",
"description": "The directory to search in. Defaults to the current working directory.",
},
"include": map[string]any{
"type": "string",
"description": "File pattern to include in the search (e.g. \"*.js\", \"*.{ts,tsx}\")",
},
"literal_text": map[string]any{
"type": "boolean",
"description": "If true, the pattern will be treated as literal text with special regex characters escaped. Default is false.",
},
},
Required: []string{"pattern"},
}
}
// escapeRegexPattern escapes special regex characters so they're treated as literal characters
func escapeRegexPattern(pattern string) string {
specialChars := []string{"\\", ".", "+", "*", "?", "(", ")", "[", "]", "{", "}", "^", "$", "|"}
escaped := pattern
for _, char := range specialChars {
escaped = strings.ReplaceAll(escaped, char, "\\"+char)
}
return escaped
}
func (g *grepTool) Run(ctx context.Context, call ToolCall) (ToolResponse, error) {
var params GrepParams
if err := json.Unmarshal([]byte(call.Input), &params); err != nil {
return NewTextErrorResponse(fmt.Sprintf("error parsing parameters: %s", err)), nil
}
if params.Pattern == "" {
return NewTextErrorResponse("pattern is required"), nil
}
// If literal_text is true, escape the pattern
searchPattern := params.Pattern
if params.LiteralText {
searchPattern = escapeRegexPattern(params.Pattern)
}
searchPath := params.Path
if searchPath == "" {
searchPath = config.WorkingDirectory()
}
matches, truncated, err := searchFiles(searchPattern, searchPath, params.Include, 100)
if err != nil {
return ToolResponse{}, fmt.Errorf("error searching files: %w", err)
}
var output string
if len(matches) == 0 {
output = "No files found"
} else {
output = fmt.Sprintf("Found %d matches\n", len(matches))
currentFile := ""
for _, match := range matches {
if currentFile != match.path {
if currentFile != "" {
output += "\n"
}
currentFile = match.path
output += fmt.Sprintf("%s:\n", match.path)
}
if match.lineNum > 0 {
output += fmt.Sprintf(" Line %d: %s\n", match.lineNum, match.lineText)
} else {
output += fmt.Sprintf(" %s\n", match.path)
}
}
if truncated {
output += "\n(Results are truncated. Consider using a more specific path or pattern.)"
}
}
return WithResponseMetadata(
NewTextResponse(output),
GrepResponseMetadata{
NumberOfMatches: len(matches),
Truncated: truncated,
},
), nil
}
func searchFiles(pattern, rootPath, include string, limit int) ([]grepMatch, bool, error) {
matches, err := searchWithRipgrep(pattern, rootPath, include)
if err != nil {
matches, err = searchFilesWithRegex(pattern, rootPath, include)
if err != nil {
return nil, false, err
}
}
sort.Slice(matches, func(i, j int) bool {
return matches[i].modTime.After(matches[j].modTime)
})
truncated := len(matches) > limit
if truncated {
matches = matches[:limit]
}
return matches, truncated, nil
}
func searchWithRipgrep(pattern, path, include string) ([]grepMatch, error) {
_, err := exec.LookPath("rg")
if err != nil {
return nil, fmt.Errorf("ripgrep not found: %w", err)
}
// Use -n to show line numbers and include the matched line
args := []string{"-n", pattern}
if include != "" {
args = append(args, "--glob", include)
}
args = append(args, path)
cmd := exec.Command("rg", args...)
output, err := cmd.Output()
if err != nil {
if exitErr, ok := err.(*exec.ExitError); ok && exitErr.ExitCode() == 1 {
return []grepMatch{}, nil
}
return nil, err
}
lines := strings.Split(strings.TrimSpace(string(output)), "\n")
matches := make([]grepMatch, 0, len(lines))
for _, line := range lines {
if line == "" {
continue
}
// Parse ripgrep output format: file:line:content
parts := strings.SplitN(line, ":", 3)
if len(parts) < 3 {
continue
}
filePath := parts[0]
lineNum, err := strconv.Atoi(parts[1])
if err != nil {
continue
}
lineText := parts[2]
fileInfo, err := os.Stat(filePath)
if err != nil {
continue // Skip files we can't access
}
matches = append(matches, grepMatch{
path: filePath,
modTime: fileInfo.ModTime(),
lineNum: lineNum,
lineText: lineText,
})
}
return matches, nil
}
func searchFilesWithRegex(pattern, rootPath, include string) ([]grepMatch, error) {
matches := []grepMatch{}
regex, err := regexp.Compile(pattern)
if err != nil {
return nil, fmt.Errorf("invalid regex pattern: %w", err)
}
var includePattern *regexp.Regexp
if include != "" {
regexPattern := globToRegex(include)
includePattern, err = regexp.Compile(regexPattern)
if err != nil {
return nil, fmt.Errorf("invalid include pattern: %w", err)
}
}
err = filepath.Walk(rootPath, func(path string, info os.FileInfo, err error) error {
if err != nil {
return nil // Skip errors
}
if info.IsDir() {
return nil // Skip directories
}
if skipHidden(path) {
return nil
}
if includePattern != nil && !includePattern.MatchString(path) {
return nil
}
match, lineNum, lineText, err := fileContainsPattern(path, regex)
if err != nil {
return nil // Skip files we can't read
}
if match {
matches = append(matches, grepMatch{
path: path,
modTime: info.ModTime(),
lineNum: lineNum,
lineText: lineText,
})
if len(matches) >= 200 {
return filepath.SkipAll
}
}
return nil
})
if err != nil {
return nil, err
}
return matches, nil
}
func fileContainsPattern(filePath string, pattern *regexp.Regexp) (bool, int, string, error) {
file, err := os.Open(filePath)
if err != nil {
return false, 0, "", err
}
defer file.Close()
scanner := bufio.NewScanner(file)
lineNum := 0
for scanner.Scan() {
lineNum++
line := scanner.Text()
if pattern.MatchString(line) {
return true, lineNum, line, nil
}
}
return false, 0, "", scanner.Err()
}
func globToRegex(glob string) string {
regexPattern := strings.ReplaceAll(glob, ".", "\\.")
regexPattern = strings.ReplaceAll(regexPattern, "*", ".*")
regexPattern = strings.ReplaceAll(regexPattern, "?", ".")
re := regexp.MustCompile(`\{([^}]+)\}`)
regexPattern = re.ReplaceAllStringFunc(regexPattern, func(match string) string {
inner := match[1 : len(match)-1]
return "(" + strings.ReplaceAll(inner, ",", "|") + ")"
})
return regexPattern
}
+316
View File
@@ -0,0 +1,316 @@
package tools
import (
"context"
"encoding/json"
"fmt"
"os"
"path/filepath"
"strings"
"github.com/kujtimiihoxha/opencode/internal/config"
)
type LSParams struct {
Path string `json:"path"`
Ignore []string `json:"ignore"`
}
type TreeNode struct {
Name string `json:"name"`
Path string `json:"path"`
Type string `json:"type"` // "file" or "directory"
Children []*TreeNode `json:"children,omitempty"`
}
type LSResponseMetadata struct {
NumberOfFiles int `json:"number_of_files"`
Truncated bool `json:"truncated"`
}
type lsTool struct{}
const (
LSToolName = "ls"
MaxLSFiles = 1000
lsDescription = `Directory listing tool that shows files and subdirectories in a tree structure, helping you explore and understand the project organization.
WHEN TO USE THIS TOOL:
- Use when you need to explore the structure of a directory
- Helpful for understanding the organization of a project
- Good first step when getting familiar with a new codebase
HOW TO USE:
- Provide a path to list (defaults to current working directory)
- Optionally specify glob patterns to ignore
- Results are displayed in a tree structure
FEATURES:
- Displays a hierarchical view of files and directories
- Automatically skips hidden files/directories (starting with '.')
- Skips common system directories like __pycache__
- Can filter out files matching specific patterns
LIMITATIONS:
- Results are limited to 1000 files
- Very large directories will be truncated
- Does not show file sizes or permissions
- Cannot recursively list all directories in a large project
TIPS:
- Use Glob tool for finding files by name patterns instead of browsing
- Use Grep tool for searching file contents
- Combine with other tools for more effective exploration`
)
func NewLsTool() BaseTool {
return &lsTool{}
}
func (l *lsTool) Info() ToolInfo {
return ToolInfo{
Name: LSToolName,
Description: lsDescription,
Parameters: map[string]any{
"path": map[string]any{
"type": "string",
"description": "The path to the directory to list (defaults to current working directory)",
},
"ignore": map[string]any{
"type": "array",
"description": "List of glob patterns to ignore",
"items": map[string]any{
"type": "string",
},
},
},
Required: []string{"path"},
}
}
func (l *lsTool) Run(ctx context.Context, call ToolCall) (ToolResponse, error) {
var params LSParams
if err := json.Unmarshal([]byte(call.Input), &params); err != nil {
return NewTextErrorResponse(fmt.Sprintf("error parsing parameters: %s", err)), nil
}
searchPath := params.Path
if searchPath == "" {
searchPath = config.WorkingDirectory()
}
if !filepath.IsAbs(searchPath) {
searchPath = filepath.Join(config.WorkingDirectory(), searchPath)
}
if _, err := os.Stat(searchPath); os.IsNotExist(err) {
return NewTextErrorResponse(fmt.Sprintf("path does not exist: %s", searchPath)), nil
}
files, truncated, err := listDirectory(searchPath, params.Ignore, MaxLSFiles)
if err != nil {
return ToolResponse{}, fmt.Errorf("error listing directory: %w", err)
}
tree := createFileTree(files)
output := printTree(tree, searchPath)
if truncated {
output = fmt.Sprintf("There are more than %d files in the directory. Use a more specific path or use the Glob tool to find specific files. The first %d files and directories are included below:\n\n%s", MaxLSFiles, MaxLSFiles, output)
}
return WithResponseMetadata(
NewTextResponse(output),
LSResponseMetadata{
NumberOfFiles: len(files),
Truncated: truncated,
},
), nil
}
func listDirectory(initialPath string, ignorePatterns []string, limit int) ([]string, bool, error) {
var results []string
truncated := false
err := filepath.Walk(initialPath, func(path string, info os.FileInfo, err error) error {
if err != nil {
return nil // Skip files we don't have permission to access
}
if shouldSkip(path, ignorePatterns) {
if info.IsDir() {
return filepath.SkipDir
}
return nil
}
if path != initialPath {
if info.IsDir() {
path = path + string(filepath.Separator)
}
results = append(results, path)
}
if len(results) >= limit {
truncated = true
return filepath.SkipAll
}
return nil
})
if err != nil {
return nil, truncated, err
}
return results, truncated, nil
}
func shouldSkip(path string, ignorePatterns []string) bool {
base := filepath.Base(path)
if base != "." && strings.HasPrefix(base, ".") {
return true
}
commonIgnored := []string{
"__pycache__",
"node_modules",
"dist",
"build",
"target",
"vendor",
"bin",
"obj",
".git",
".idea",
".vscode",
".DS_Store",
"*.pyc",
"*.pyo",
"*.pyd",
"*.so",
"*.dll",
"*.exe",
}
if strings.Contains(path, filepath.Join("__pycache__", "")) {
return true
}
for _, ignored := range commonIgnored {
if strings.HasSuffix(ignored, "/") {
if strings.Contains(path, filepath.Join(ignored[:len(ignored)-1], "")) {
return true
}
} else if strings.HasPrefix(ignored, "*.") {
if strings.HasSuffix(base, ignored[1:]) {
return true
}
} else {
if base == ignored {
return true
}
}
}
for _, pattern := range ignorePatterns {
matched, err := filepath.Match(pattern, base)
if err == nil && matched {
return true
}
}
return false
}
func createFileTree(sortedPaths []string) []*TreeNode {
root := []*TreeNode{}
pathMap := make(map[string]*TreeNode)
for _, path := range sortedPaths {
parts := strings.Split(path, string(filepath.Separator))
currentPath := ""
var parentPath string
var cleanParts []string
for _, part := range parts {
if part != "" {
cleanParts = append(cleanParts, part)
}
}
parts = cleanParts
if len(parts) == 0 {
continue
}
for i, part := range parts {
if currentPath == "" {
currentPath = part
} else {
currentPath = filepath.Join(currentPath, part)
}
if _, exists := pathMap[currentPath]; exists {
parentPath = currentPath
continue
}
isLastPart := i == len(parts)-1
isDir := !isLastPart || strings.HasSuffix(path, string(filepath.Separator))
nodeType := "file"
if isDir {
nodeType = "directory"
}
newNode := &TreeNode{
Name: part,
Path: currentPath,
Type: nodeType,
Children: []*TreeNode{},
}
pathMap[currentPath] = newNode
if i > 0 && parentPath != "" {
if parent, ok := pathMap[parentPath]; ok {
parent.Children = append(parent.Children, newNode)
}
} else {
root = append(root, newNode)
}
parentPath = currentPath
}
}
return root
}
func printTree(tree []*TreeNode, rootPath string) string {
var result strings.Builder
result.WriteString(fmt.Sprintf("- %s%s\n", rootPath, string(filepath.Separator)))
for _, node := range tree {
printNode(&result, node, 1)
}
return result.String()
}
func printNode(builder *strings.Builder, node *TreeNode, level int) {
indent := strings.Repeat(" ", level)
nodeName := node.Name
if node.Type == "directory" {
nodeName += string(filepath.Separator)
}
fmt.Fprintf(builder, "%s- %s\n", indent, nodeName)
if node.Type == "directory" && len(node.Children) > 0 {
for _, child := range node.Children {
printNode(builder, child, level+1)
}
}
}
+457
View File
@@ -0,0 +1,457 @@
package tools
import (
"context"
"encoding/json"
"os"
"path/filepath"
"strings"
"testing"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
)
func TestLsTool_Info(t *testing.T) {
tool := NewLsTool()
info := tool.Info()
assert.Equal(t, LSToolName, info.Name)
assert.NotEmpty(t, info.Description)
assert.Contains(t, info.Parameters, "path")
assert.Contains(t, info.Parameters, "ignore")
assert.Contains(t, info.Required, "path")
}
func TestLsTool_Run(t *testing.T) {
// Create a temporary directory for testing
tempDir, err := os.MkdirTemp("", "ls_tool_test")
require.NoError(t, err)
defer os.RemoveAll(tempDir)
// Create a test directory structure
testDirs := []string{
"dir1",
"dir2",
"dir2/subdir1",
"dir2/subdir2",
"dir3",
"dir3/.hidden_dir",
"__pycache__",
}
testFiles := []string{
"file1.txt",
"file2.txt",
"dir1/file3.txt",
"dir2/file4.txt",
"dir2/subdir1/file5.txt",
"dir2/subdir2/file6.txt",
"dir3/file7.txt",
"dir3/.hidden_file.txt",
"__pycache__/cache.pyc",
".hidden_root_file.txt",
}
// Create directories
for _, dir := range testDirs {
dirPath := filepath.Join(tempDir, dir)
err := os.MkdirAll(dirPath, 0755)
require.NoError(t, err)
}
// Create files
for _, file := range testFiles {
filePath := filepath.Join(tempDir, file)
err := os.WriteFile(filePath, []byte("test content"), 0644)
require.NoError(t, err)
}
t.Run("lists directory successfully", func(t *testing.T) {
tool := NewLsTool()
params := LSParams{
Path: tempDir,
}
paramsJSON, err := json.Marshal(params)
require.NoError(t, err)
call := ToolCall{
Name: LSToolName,
Input: string(paramsJSON),
}
response, err := tool.Run(context.Background(), call)
require.NoError(t, err)
// Check that visible directories and files are included
assert.Contains(t, response.Content, "dir1")
assert.Contains(t, response.Content, "dir2")
assert.Contains(t, response.Content, "dir3")
assert.Contains(t, response.Content, "file1.txt")
assert.Contains(t, response.Content, "file2.txt")
// Check that hidden files and directories are not included
assert.NotContains(t, response.Content, ".hidden_dir")
assert.NotContains(t, response.Content, ".hidden_file.txt")
assert.NotContains(t, response.Content, ".hidden_root_file.txt")
// Check that __pycache__ is not included
assert.NotContains(t, response.Content, "__pycache__")
})
t.Run("handles non-existent path", func(t *testing.T) {
tool := NewLsTool()
params := LSParams{
Path: filepath.Join(tempDir, "non_existent_dir"),
}
paramsJSON, err := json.Marshal(params)
require.NoError(t, err)
call := ToolCall{
Name: LSToolName,
Input: string(paramsJSON),
}
response, err := tool.Run(context.Background(), call)
require.NoError(t, err)
assert.Contains(t, response.Content, "path does not exist")
})
t.Run("handles empty path parameter", func(t *testing.T) {
// For this test, we need to mock the config.WorkingDirectory function
// Since we can't easily do that, we'll just check that the response doesn't contain an error message
tool := NewLsTool()
params := LSParams{
Path: "",
}
paramsJSON, err := json.Marshal(params)
require.NoError(t, err)
call := ToolCall{
Name: LSToolName,
Input: string(paramsJSON),
}
response, err := tool.Run(context.Background(), call)
require.NoError(t, err)
// The response should either contain a valid directory listing or an error
// We'll just check that it's not empty
assert.NotEmpty(t, response.Content)
})
t.Run("handles invalid parameters", func(t *testing.T) {
tool := NewLsTool()
call := ToolCall{
Name: LSToolName,
Input: "invalid json",
}
response, err := tool.Run(context.Background(), call)
require.NoError(t, err)
assert.Contains(t, response.Content, "error parsing parameters")
})
t.Run("respects ignore patterns", func(t *testing.T) {
tool := NewLsTool()
params := LSParams{
Path: tempDir,
Ignore: []string{"file1.txt", "dir1"},
}
paramsJSON, err := json.Marshal(params)
require.NoError(t, err)
call := ToolCall{
Name: LSToolName,
Input: string(paramsJSON),
}
response, err := tool.Run(context.Background(), call)
require.NoError(t, err)
// The output format is a tree, so we need to check for specific patterns
// Check that file1.txt is not directly mentioned
assert.NotContains(t, response.Content, "- file1.txt")
// Check that dir1/ is not directly mentioned
assert.NotContains(t, response.Content, "- dir1/")
})
t.Run("handles relative path", func(t *testing.T) {
// Save original working directory
origWd, err := os.Getwd()
require.NoError(t, err)
defer func() {
os.Chdir(origWd)
}()
// Change to a directory above the temp directory
parentDir := filepath.Dir(tempDir)
err = os.Chdir(parentDir)
require.NoError(t, err)
tool := NewLsTool()
params := LSParams{
Path: filepath.Base(tempDir),
}
paramsJSON, err := json.Marshal(params)
require.NoError(t, err)
call := ToolCall{
Name: LSToolName,
Input: string(paramsJSON),
}
response, err := tool.Run(context.Background(), call)
require.NoError(t, err)
// Should list the temp directory contents
assert.Contains(t, response.Content, "dir1")
assert.Contains(t, response.Content, "file1.txt")
})
}
func TestShouldSkip(t *testing.T) {
testCases := []struct {
name string
path string
ignorePatterns []string
expected bool
}{
{
name: "hidden file",
path: "/path/to/.hidden_file",
ignorePatterns: []string{},
expected: true,
},
{
name: "hidden directory",
path: "/path/to/.hidden_dir",
ignorePatterns: []string{},
expected: true,
},
{
name: "pycache directory",
path: "/path/to/__pycache__/file.pyc",
ignorePatterns: []string{},
expected: true,
},
{
name: "node_modules directory",
path: "/path/to/node_modules/package",
ignorePatterns: []string{},
expected: false, // The shouldSkip function doesn't directly check for node_modules in the path
},
{
name: "normal file",
path: "/path/to/normal_file.txt",
ignorePatterns: []string{},
expected: false,
},
{
name: "normal directory",
path: "/path/to/normal_dir",
ignorePatterns: []string{},
expected: false,
},
{
name: "ignored by pattern",
path: "/path/to/ignore_me.txt",
ignorePatterns: []string{"ignore_*.txt"},
expected: true,
},
{
name: "not ignored by pattern",
path: "/path/to/keep_me.txt",
ignorePatterns: []string{"ignore_*.txt"},
expected: false,
},
}
for _, tc := range testCases {
t.Run(tc.name, func(t *testing.T) {
result := shouldSkip(tc.path, tc.ignorePatterns)
assert.Equal(t, tc.expected, result)
})
}
}
func TestCreateFileTree(t *testing.T) {
paths := []string{
"/path/to/file1.txt",
"/path/to/dir1/file2.txt",
"/path/to/dir1/subdir/file3.txt",
"/path/to/dir2/file4.txt",
}
tree := createFileTree(paths)
// Check the structure of the tree
assert.Len(t, tree, 1) // Should have one root node
// Check the root node
rootNode := tree[0]
assert.Equal(t, "path", rootNode.Name)
assert.Equal(t, "directory", rootNode.Type)
assert.Len(t, rootNode.Children, 1)
// Check the "to" node
toNode := rootNode.Children[0]
assert.Equal(t, "to", toNode.Name)
assert.Equal(t, "directory", toNode.Type)
assert.Len(t, toNode.Children, 3) // file1.txt, dir1, dir2
// Find the dir1 node
var dir1Node *TreeNode
for _, child := range toNode.Children {
if child.Name == "dir1" {
dir1Node = child
break
}
}
require.NotNil(t, dir1Node)
assert.Equal(t, "directory", dir1Node.Type)
assert.Len(t, dir1Node.Children, 2) // file2.txt and subdir
}
func TestPrintTree(t *testing.T) {
// Create a simple tree
tree := []*TreeNode{
{
Name: "dir1",
Path: "dir1",
Type: "directory",
Children: []*TreeNode{
{
Name: "file1.txt",
Path: "dir1/file1.txt",
Type: "file",
},
{
Name: "subdir",
Path: "dir1/subdir",
Type: "directory",
Children: []*TreeNode{
{
Name: "file2.txt",
Path: "dir1/subdir/file2.txt",
Type: "file",
},
},
},
},
},
{
Name: "file3.txt",
Path: "file3.txt",
Type: "file",
},
}
result := printTree(tree, "/root")
// Check the output format
assert.Contains(t, result, "- /root/")
assert.Contains(t, result, " - dir1/")
assert.Contains(t, result, " - file1.txt")
assert.Contains(t, result, " - subdir/")
assert.Contains(t, result, " - file2.txt")
assert.Contains(t, result, " - file3.txt")
}
func TestListDirectory(t *testing.T) {
// Create a temporary directory for testing
tempDir, err := os.MkdirTemp("", "list_directory_test")
require.NoError(t, err)
defer os.RemoveAll(tempDir)
// Create a test directory structure
testDirs := []string{
"dir1",
"dir1/subdir1",
".hidden_dir",
}
testFiles := []string{
"file1.txt",
"file2.txt",
"dir1/file3.txt",
"dir1/subdir1/file4.txt",
".hidden_file.txt",
}
// Create directories
for _, dir := range testDirs {
dirPath := filepath.Join(tempDir, dir)
err := os.MkdirAll(dirPath, 0755)
require.NoError(t, err)
}
// Create files
for _, file := range testFiles {
filePath := filepath.Join(tempDir, file)
err := os.WriteFile(filePath, []byte("test content"), 0644)
require.NoError(t, err)
}
t.Run("lists files with no limit", func(t *testing.T) {
files, truncated, err := listDirectory(tempDir, []string{}, 1000)
require.NoError(t, err)
assert.False(t, truncated)
// Check that visible files and directories are included
containsPath := func(paths []string, target string) bool {
targetPath := filepath.Join(tempDir, target)
for _, path := range paths {
if strings.HasPrefix(path, targetPath) {
return true
}
}
return false
}
assert.True(t, containsPath(files, "dir1"))
assert.True(t, containsPath(files, "file1.txt"))
assert.True(t, containsPath(files, "file2.txt"))
assert.True(t, containsPath(files, "dir1/file3.txt"))
// Check that hidden files and directories are not included
assert.False(t, containsPath(files, ".hidden_dir"))
assert.False(t, containsPath(files, ".hidden_file.txt"))
})
t.Run("respects limit and returns truncated flag", func(t *testing.T) {
files, truncated, err := listDirectory(tempDir, []string{}, 2)
require.NoError(t, err)
assert.True(t, truncated)
assert.Len(t, files, 2)
})
t.Run("respects ignore patterns", func(t *testing.T) {
files, truncated, err := listDirectory(tempDir, []string{"*.txt"}, 1000)
require.NoError(t, err)
assert.False(t, truncated)
// Check that no .txt files are included
for _, file := range files {
assert.False(t, strings.HasSuffix(file, ".txt"), "Found .txt file: %s", file)
}
// But directories should still be included
containsDir := false
for _, file := range files {
if strings.Contains(file, "dir1") {
containsDir = true
break
}
}
assert.True(t, containsDir)
})
}
+372
View File
@@ -0,0 +1,372 @@
package tools
import (
"context"
"encoding/json"
"fmt"
"os"
"path/filepath"
"time"
"github.com/kujtimiihoxha/opencode/internal/config"
"github.com/kujtimiihoxha/opencode/internal/diff"
"github.com/kujtimiihoxha/opencode/internal/history"
"github.com/kujtimiihoxha/opencode/internal/logging"
"github.com/kujtimiihoxha/opencode/internal/lsp"
"github.com/kujtimiihoxha/opencode/internal/permission"
)
type PatchParams struct {
PatchText string `json:"patch_text"`
}
type PatchResponseMetadata struct {
FilesChanged []string `json:"files_changed"`
Additions int `json:"additions"`
Removals int `json:"removals"`
}
type patchTool struct {
lspClients map[string]*lsp.Client
permissions permission.Service
files history.Service
}
const (
PatchToolName = "patch"
patchDescription = `Applies a patch to multiple files in one operation. This tool is useful for making coordinated changes across multiple files.
The patch text must follow this format:
*** Begin Patch
*** Update File: /path/to/file
@@ Context line (unique within the file)
Line to keep
-Line to remove
+Line to add
Line to keep
*** Add File: /path/to/new/file
+Content of the new file
+More content
*** Delete File: /path/to/file/to/delete
*** End Patch
Before using this tool:
1. Use the FileRead tool to understand the files' contents and context
2. Verify all file paths are correct (use the LS tool)
CRITICAL REQUIREMENTS FOR USING THIS TOOL:
1. UNIQUENESS: Context lines MUST uniquely identify the specific sections you want to change
2. PRECISION: All whitespace, indentation, and surrounding code must match exactly
3. VALIDATION: Ensure edits result in idiomatic, correct code
4. PATHS: Always use absolute file paths (starting with /)
The tool will apply all changes in a single atomic operation.`
)
func NewPatchTool(lspClients map[string]*lsp.Client, permissions permission.Service, files history.Service) BaseTool {
return &patchTool{
lspClients: lspClients,
permissions: permissions,
files: files,
}
}
func (p *patchTool) Info() ToolInfo {
return ToolInfo{
Name: PatchToolName,
Description: patchDescription,
Parameters: map[string]any{
"patch_text": map[string]any{
"type": "string",
"description": "The full patch text that describes all changes to be made",
},
},
Required: []string{"patch_text"},
}
}
func (p *patchTool) Run(ctx context.Context, call ToolCall) (ToolResponse, error) {
var params PatchParams
if err := json.Unmarshal([]byte(call.Input), &params); err != nil {
return NewTextErrorResponse("invalid parameters"), nil
}
if params.PatchText == "" {
return NewTextErrorResponse("patch_text is required"), nil
}
// Identify all files needed for the patch and verify they've been read
filesToRead := diff.IdentifyFilesNeeded(params.PatchText)
for _, filePath := range filesToRead {
absPath := filePath
if !filepath.IsAbs(absPath) {
wd := config.WorkingDirectory()
absPath = filepath.Join(wd, absPath)
}
if getLastReadTime(absPath).IsZero() {
return NewTextErrorResponse(fmt.Sprintf("you must read the file %s before patching it. Use the FileRead tool first", filePath)), nil
}
fileInfo, err := os.Stat(absPath)
if err != nil {
if os.IsNotExist(err) {
return NewTextErrorResponse(fmt.Sprintf("file not found: %s", absPath)), nil
}
return ToolResponse{}, fmt.Errorf("failed to access file: %w", err)
}
if fileInfo.IsDir() {
return NewTextErrorResponse(fmt.Sprintf("path is a directory, not a file: %s", absPath)), nil
}
modTime := fileInfo.ModTime()
lastRead := getLastReadTime(absPath)
if modTime.After(lastRead) {
return NewTextErrorResponse(
fmt.Sprintf("file %s has been modified since it was last read (mod time: %s, last read: %s)",
absPath, modTime.Format(time.RFC3339), lastRead.Format(time.RFC3339),
)), nil
}
}
// Check for new files to ensure they don't already exist
filesToAdd := diff.IdentifyFilesAdded(params.PatchText)
for _, filePath := range filesToAdd {
absPath := filePath
if !filepath.IsAbs(absPath) {
wd := config.WorkingDirectory()
absPath = filepath.Join(wd, absPath)
}
_, err := os.Stat(absPath)
if err == nil {
return NewTextErrorResponse(fmt.Sprintf("file already exists and cannot be added: %s", absPath)), nil
} else if !os.IsNotExist(err) {
return ToolResponse{}, fmt.Errorf("failed to check file: %w", err)
}
}
// Load all required files
currentFiles := make(map[string]string)
for _, filePath := range filesToRead {
absPath := filePath
if !filepath.IsAbs(absPath) {
wd := config.WorkingDirectory()
absPath = filepath.Join(wd, absPath)
}
content, err := os.ReadFile(absPath)
if err != nil {
return ToolResponse{}, fmt.Errorf("failed to read file %s: %w", absPath, err)
}
currentFiles[filePath] = string(content)
}
// Process the patch
patch, fuzz, err := diff.TextToPatch(params.PatchText, currentFiles)
if err != nil {
return NewTextErrorResponse(fmt.Sprintf("failed to parse patch: %s", err)), nil
}
if fuzz > 3 {
return NewTextErrorResponse(fmt.Sprintf("patch contains fuzzy matches (fuzz level: %d). Please make your context lines more precise", fuzz)), nil
}
// Convert patch to commit
commit, err := diff.PatchToCommit(patch, currentFiles)
if err != nil {
return NewTextErrorResponse(fmt.Sprintf("failed to create commit from patch: %s", err)), nil
}
// Get session ID and message ID
sessionID, messageID := GetContextValues(ctx)
if sessionID == "" || messageID == "" {
return ToolResponse{}, fmt.Errorf("session ID and message ID are required for creating a patch")
}
// Request permission for all changes
for path, change := range commit.Changes {
switch change.Type {
case diff.ActionAdd:
dir := filepath.Dir(path)
patchDiff, _, _ := diff.GenerateDiff("", *change.NewContent, path)
p := p.permissions.Request(
permission.CreatePermissionRequest{
SessionID: sessionID,
Path: dir,
ToolName: PatchToolName,
Action: "create",
Description: fmt.Sprintf("Create file %s", path),
Params: EditPermissionsParams{
FilePath: path,
Diff: patchDiff,
},
},
)
if !p {
return ToolResponse{}, permission.ErrorPermissionDenied
}
case diff.ActionUpdate:
currentContent := ""
if change.OldContent != nil {
currentContent = *change.OldContent
}
newContent := ""
if change.NewContent != nil {
newContent = *change.NewContent
}
patchDiff, _, _ := diff.GenerateDiff(currentContent, newContent, path)
dir := filepath.Dir(path)
p := p.permissions.Request(
permission.CreatePermissionRequest{
SessionID: sessionID,
Path: dir,
ToolName: PatchToolName,
Action: "update",
Description: fmt.Sprintf("Update file %s", path),
Params: EditPermissionsParams{
FilePath: path,
Diff: patchDiff,
},
},
)
if !p {
return ToolResponse{}, permission.ErrorPermissionDenied
}
case diff.ActionDelete:
dir := filepath.Dir(path)
patchDiff, _, _ := diff.GenerateDiff(*change.OldContent, "", path)
p := p.permissions.Request(
permission.CreatePermissionRequest{
SessionID: sessionID,
Path: dir,
ToolName: PatchToolName,
Action: "delete",
Description: fmt.Sprintf("Delete file %s", path),
Params: EditPermissionsParams{
FilePath: path,
Diff: patchDiff,
},
},
)
if !p {
return ToolResponse{}, permission.ErrorPermissionDenied
}
}
}
// Apply the changes to the filesystem
err = diff.ApplyCommit(commit, func(path string, content string) error {
absPath := path
if !filepath.IsAbs(absPath) {
wd := config.WorkingDirectory()
absPath = filepath.Join(wd, absPath)
}
// Create parent directories if needed
dir := filepath.Dir(absPath)
if err := os.MkdirAll(dir, 0o755); err != nil {
return fmt.Errorf("failed to create parent directories for %s: %w", absPath, err)
}
return os.WriteFile(absPath, []byte(content), 0o644)
}, func(path string) error {
absPath := path
if !filepath.IsAbs(absPath) {
wd := config.WorkingDirectory()
absPath = filepath.Join(wd, absPath)
}
return os.Remove(absPath)
})
if err != nil {
return NewTextErrorResponse(fmt.Sprintf("failed to apply patch: %s", err)), nil
}
// Update file history for all modified files
changedFiles := []string{}
totalAdditions := 0
totalRemovals := 0
for path, change := range commit.Changes {
absPath := path
if !filepath.IsAbs(absPath) {
wd := config.WorkingDirectory()
absPath = filepath.Join(wd, absPath)
}
changedFiles = append(changedFiles, absPath)
oldContent := ""
if change.OldContent != nil {
oldContent = *change.OldContent
}
newContent := ""
if change.NewContent != nil {
newContent = *change.NewContent
}
// Calculate diff statistics
_, additions, removals := diff.GenerateDiff(oldContent, newContent, path)
totalAdditions += additions
totalRemovals += removals
// Update history
file, err := p.files.GetByPathAndSession(ctx, absPath, sessionID)
if err != nil && change.Type != diff.ActionAdd {
// If not adding a file, create history entry for existing file
_, err = p.files.Create(ctx, sessionID, absPath, oldContent)
if err != nil {
logging.Debug("Error creating file history", "error", err)
}
}
if err == nil && change.Type != diff.ActionAdd && file.Content != oldContent {
// User manually changed content, store intermediate version
_, err = p.files.CreateVersion(ctx, sessionID, absPath, oldContent)
if err != nil {
logging.Debug("Error creating file history version", "error", err)
}
}
// Store new version
if change.Type == diff.ActionDelete {
_, err = p.files.CreateVersion(ctx, sessionID, absPath, "")
} else {
_, err = p.files.CreateVersion(ctx, sessionID, absPath, newContent)
}
if err != nil {
logging.Debug("Error creating file history version", "error", err)
}
// Record file operations
recordFileWrite(absPath)
recordFileRead(absPath)
}
// Run LSP diagnostics on all changed files
for _, filePath := range changedFiles {
waitForLspDiagnostics(ctx, filePath, p.lspClients)
}
result := fmt.Sprintf("Patch applied successfully. %d files changed, %d additions, %d removals",
len(changedFiles), totalAdditions, totalRemovals)
diagnosticsText := ""
for _, filePath := range changedFiles {
diagnosticsText += getDiagnostics(filePath, p.lspClients)
}
if diagnosticsText != "" {
result += "\n\nDiagnostics:\n" + diagnosticsText
}
return WithResponseMetadata(
NewTextResponse(result),
PatchResponseMetadata{
FilesChanged: changedFiles,
Additions: totalAdditions,
Removals: totalRemovals,
}), nil
}
+304
View File
@@ -0,0 +1,304 @@
package shell
import (
"context"
"errors"
"fmt"
"os"
"os/exec"
"path/filepath"
"strings"
"sync"
"syscall"
"time"
)
type PersistentShell struct {
cmd *exec.Cmd
stdin *os.File
isAlive bool
cwd string
mu sync.Mutex
commandQueue chan *commandExecution
}
type commandExecution struct {
command string
timeout time.Duration
resultChan chan commandResult
ctx context.Context
}
type commandResult struct {
stdout string
stderr string
exitCode int
interrupted bool
err error
}
var (
shellInstance *PersistentShell
shellInstanceOnce sync.Once
)
func GetPersistentShell(workingDir string) *PersistentShell {
shellInstanceOnce.Do(func() {
shellInstance = newPersistentShell(workingDir)
})
if !shellInstance.isAlive {
shellInstance = newPersistentShell(shellInstance.cwd)
}
return shellInstance
}
func newPersistentShell(cwd string) *PersistentShell {
shellPath := os.Getenv("SHELL")
if shellPath == "" {
shellPath = "/bin/bash"
}
cmd := exec.Command(shellPath, "-l")
cmd.Dir = cwd
stdinPipe, err := cmd.StdinPipe()
if err != nil {
return nil
}
cmd.Env = append(os.Environ(), "GIT_EDITOR=true")
err = cmd.Start()
if err != nil {
return nil
}
shell := &PersistentShell{
cmd: cmd,
stdin: stdinPipe.(*os.File),
isAlive: true,
cwd: cwd,
commandQueue: make(chan *commandExecution, 10),
}
go func() {
defer func() {
if r := recover(); r != nil {
fmt.Fprintf(os.Stderr, "Panic in shell command processor: %v\n", r)
shell.isAlive = false
close(shell.commandQueue)
}
}()
shell.processCommands()
}()
go func() {
err := cmd.Wait()
if err != nil {
// Log the error if needed
}
shell.isAlive = false
close(shell.commandQueue)
}()
return shell
}
func (s *PersistentShell) processCommands() {
for cmd := range s.commandQueue {
result := s.execCommand(cmd.command, cmd.timeout, cmd.ctx)
cmd.resultChan <- result
}
}
func (s *PersistentShell) execCommand(command string, timeout time.Duration, ctx context.Context) commandResult {
s.mu.Lock()
defer s.mu.Unlock()
if !s.isAlive {
return commandResult{
stderr: "Shell is not alive",
exitCode: 1,
err: errors.New("shell is not alive"),
}
}
tempDir := os.TempDir()
stdoutFile := filepath.Join(tempDir, fmt.Sprintf("opencode-stdout-%d", time.Now().UnixNano()))
stderrFile := filepath.Join(tempDir, fmt.Sprintf("opencode-stderr-%d", time.Now().UnixNano()))
statusFile := filepath.Join(tempDir, fmt.Sprintf("opencode-status-%d", time.Now().UnixNano()))
cwdFile := filepath.Join(tempDir, fmt.Sprintf("opencode-cwd-%d", time.Now().UnixNano()))
defer func() {
os.Remove(stdoutFile)
os.Remove(stderrFile)
os.Remove(statusFile)
os.Remove(cwdFile)
}()
fullCommand := fmt.Sprintf(`
eval %s < /dev/null > %s 2> %s
EXEC_EXIT_CODE=$?
pwd > %s
echo $EXEC_EXIT_CODE > %s
`,
shellQuote(command),
shellQuote(stdoutFile),
shellQuote(stderrFile),
shellQuote(cwdFile),
shellQuote(statusFile),
)
_, err := s.stdin.Write([]byte(fullCommand + "\n"))
if err != nil {
return commandResult{
stderr: fmt.Sprintf("Failed to write command to shell: %v", err),
exitCode: 1,
err: err,
}
}
interrupted := false
startTime := time.Now()
done := make(chan bool)
go func() {
for {
select {
case <-ctx.Done():
s.killChildren()
interrupted = true
done <- true
return
case <-time.After(10 * time.Millisecond):
if fileExists(statusFile) && fileSize(statusFile) > 0 {
done <- true
return
}
if timeout > 0 {
elapsed := time.Since(startTime)
if elapsed > timeout {
s.killChildren()
interrupted = true
done <- true
return
}
}
}
}
}()
<-done
stdout := readFileOrEmpty(stdoutFile)
stderr := readFileOrEmpty(stderrFile)
exitCodeStr := readFileOrEmpty(statusFile)
newCwd := readFileOrEmpty(cwdFile)
exitCode := 0
if exitCodeStr != "" {
fmt.Sscanf(exitCodeStr, "%d", &exitCode)
} else if interrupted {
exitCode = 143
stderr += "\nCommand execution timed out or was interrupted"
}
if newCwd != "" {
s.cwd = strings.TrimSpace(newCwd)
}
return commandResult{
stdout: stdout,
stderr: stderr,
exitCode: exitCode,
interrupted: interrupted,
}
}
func (s *PersistentShell) killChildren() {
if s.cmd == nil || s.cmd.Process == nil {
return
}
pgrepCmd := exec.Command("pgrep", "-P", fmt.Sprintf("%d", s.cmd.Process.Pid))
output, err := pgrepCmd.Output()
if err != nil {
return
}
for pidStr := range strings.SplitSeq(string(output), "\n") {
if pidStr = strings.TrimSpace(pidStr); pidStr != "" {
var pid int
fmt.Sscanf(pidStr, "%d", &pid)
if pid > 0 {
proc, err := os.FindProcess(pid)
if err == nil {
proc.Signal(syscall.SIGTERM)
}
}
}
}
}
func (s *PersistentShell) Exec(ctx context.Context, command string, timeoutMs int) (string, string, int, bool, error) {
if !s.isAlive {
return "", "Shell is not alive", 1, false, errors.New("shell is not alive")
}
timeout := time.Duration(timeoutMs) * time.Millisecond
resultChan := make(chan commandResult)
s.commandQueue <- &commandExecution{
command: command,
timeout: timeout,
resultChan: resultChan,
ctx: ctx,
}
result := <-resultChan
return result.stdout, result.stderr, result.exitCode, result.interrupted, result.err
}
func (s *PersistentShell) Close() {
s.mu.Lock()
defer s.mu.Unlock()
if !s.isAlive {
return
}
s.stdin.Write([]byte("exit\n"))
s.cmd.Process.Kill()
s.isAlive = false
}
func shellQuote(s string) string {
return "'" + strings.ReplaceAll(s, "'", "'\\''") + "'"
}
func readFileOrEmpty(path string) string {
content, err := os.ReadFile(path)
if err != nil {
return ""
}
return string(content)
}
func fileExists(path string) bool {
_, err := os.Stat(path)
return err == nil
}
func fileSize(path string) int64 {
info, err := os.Stat(path)
if err != nil {
return 0
}
return info.Size()
}
+383
View File
@@ -0,0 +1,383 @@
package tools
import (
"bytes"
"context"
"encoding/json"
"fmt"
"io"
"net/http"
"strings"
"time"
)
type SourcegraphParams struct {
Query string `json:"query"`
Count int `json:"count,omitempty"`
ContextWindow int `json:"context_window,omitempty"`
Timeout int `json:"timeout,omitempty"`
}
type SourcegraphResponseMetadata struct {
NumberOfMatches int `json:"number_of_matches"`
Truncated bool `json:"truncated"`
}
type sourcegraphTool struct {
client *http.Client
}
const (
SourcegraphToolName = "sourcegraph"
sourcegraphToolDescription = `Search code across public repositories using Sourcegraph's GraphQL API.
WHEN TO USE THIS TOOL:
- Use when you need to find code examples or implementations across public repositories
- Helpful for researching how others have solved similar problems
- Useful for discovering patterns and best practices in open source code
HOW TO USE:
- Provide a search query using Sourcegraph's query syntax
- Optionally specify the number of results to return (default: 10)
- Optionally set a timeout for the request
QUERY SYNTAX:
- Basic search: "fmt.Println" searches for exact matches
- File filters: "file:.go fmt.Println" limits to Go files
- Repository filters: "repo:^github\.com/golang/go$ fmt.Println" limits to specific repos
- Language filters: "lang:go fmt.Println" limits to Go code
- Boolean operators: "fmt.Println AND log.Fatal" for combined terms
- Regular expressions: "fmt\.(Print|Printf|Println)" for pattern matching
- Quoted strings: "\"exact phrase\"" for exact phrase matching
- Exclude filters: "-file:test" or "-repo:forks" to exclude matches
ADVANCED FILTERS:
- Repository filters:
* "repo:name" - Match repositories with name containing "name"
* "repo:^github\.com/org/repo$" - Exact repository match
* "repo:org/repo@branch" - Search specific branch
* "repo:org/repo rev:branch" - Alternative branch syntax
* "-repo:name" - Exclude repositories
* "fork:yes" or "fork:only" - Include or only show forks
* "archived:yes" or "archived:only" - Include or only show archived repos
* "visibility:public" or "visibility:private" - Filter by visibility
- File filters:
* "file:\.js$" - Files with .js extension
* "file:internal/" - Files in internal directory
* "-file:test" - Exclude test files
* "file:has.content(Copyright)" - Files containing "Copyright"
* "file:has.contributor([email protected])" - Files with specific contributor
- Content filters:
* "content:\"exact string\"" - Search for exact string
* "-content:\"unwanted\"" - Exclude files with unwanted content
* "case:yes" - Case-sensitive search
- Type filters:
* "type:symbol" - Search for symbols (functions, classes, etc.)
* "type:file" - Search file content only
* "type:path" - Search filenames only
* "type:diff" - Search code changes
* "type:commit" - Search commit messages
- Commit/diff search:
* "after:\"1 month ago\"" - Commits after date
* "before:\"2023-01-01\"" - Commits before date
* "author:name" - Commits by author
* "message:\"fix bug\"" - Commits with message
- Result selection:
* "select:repo" - Show only repository names
* "select:file" - Show only file paths
* "select:content" - Show only matching content
* "select:symbol" - Show only matching symbols
- Result control:
* "count:100" - Return up to 100 results
* "count:all" - Return all results
* "timeout:30s" - Set search timeout
EXAMPLES:
- "file:.go context.WithTimeout" - Find Go code using context.WithTimeout
- "lang:typescript useState type:symbol" - Find TypeScript React useState hooks
- "repo:^github\.com/kubernetes/kubernetes$ pod list type:file" - Find Kubernetes files related to pod listing
- "repo:sourcegraph/sourcegraph$ after:\"3 months ago\" type:diff database" - Recent changes to database code
- "file:Dockerfile (alpine OR ubuntu) -content:alpine:latest" - Dockerfiles with specific base images
- "repo:has.path(\.py) file:requirements.txt tensorflow" - Python projects using TensorFlow
BOOLEAN OPERATORS:
- "term1 AND term2" - Results containing both terms
- "term1 OR term2" - Results containing either term
- "term1 NOT term2" - Results with term1 but not term2
- "term1 and (term2 or term3)" - Grouping with parentheses
LIMITATIONS:
- Only searches public repositories
- Rate limits may apply
- Complex queries may take longer to execute
- Maximum of 20 results per query
TIPS:
- Use specific file extensions to narrow results
- Add repo: filters for more targeted searches
- Use type:symbol to find function/method definitions
- Use type:file to find relevant files`
)
func NewSourcegraphTool() BaseTool {
return &sourcegraphTool{
client: &http.Client{
Timeout: 30 * time.Second,
},
}
}
func (t *sourcegraphTool) Info() ToolInfo {
return ToolInfo{
Name: SourcegraphToolName,
Description: sourcegraphToolDescription,
Parameters: map[string]any{
"query": map[string]any{
"type": "string",
"description": "The Sourcegraph search query",
},
"count": map[string]any{
"type": "number",
"description": "Optional number of results to return (default: 10, max: 20)",
},
"context_window": map[string]any{
"type": "number",
"description": "The context around the match to return (default: 10 lines)",
},
"timeout": map[string]any{
"type": "number",
"description": "Optional timeout in seconds (max 120)",
},
},
Required: []string{"query"},
}
}
func (t *sourcegraphTool) Run(ctx context.Context, call ToolCall) (ToolResponse, error) {
var params SourcegraphParams
if err := json.Unmarshal([]byte(call.Input), &params); err != nil {
return NewTextErrorResponse("Failed to parse sourcegraph parameters: " + err.Error()), nil
}
if params.Query == "" {
return NewTextErrorResponse("Query parameter is required"), nil
}
if params.Count <= 0 {
params.Count = 10
} else if params.Count > 20 {
params.Count = 20 // Limit to 20 results
}
if params.ContextWindow <= 0 {
params.ContextWindow = 10 // Default context window
}
client := t.client
if params.Timeout > 0 {
maxTimeout := 120 // 2 minutes
if params.Timeout > maxTimeout {
params.Timeout = maxTimeout
}
client = &http.Client{
Timeout: time.Duration(params.Timeout) * time.Second,
}
}
type graphqlRequest struct {
Query string `json:"query"`
Variables struct {
Query string `json:"query"`
} `json:"variables"`
}
request := graphqlRequest{
Query: "query Search($query: String!) { search(query: $query, version: V2, patternType: keyword ) { results { matchCount, limitHit, resultCount, approximateResultCount, missing { name }, timedout { name }, indexUnavailable, results { __typename, ... on FileMatch { repository { name }, file { path, url, content }, lineMatches { preview, lineNumber, offsetAndLengths } } } } } }",
}
request.Variables.Query = params.Query
graphqlQueryBytes, err := json.Marshal(request)
if err != nil {
return ToolResponse{}, fmt.Errorf("failed to marshal GraphQL request: %w", err)
}
graphqlQuery := string(graphqlQueryBytes)
req, err := http.NewRequestWithContext(
ctx,
"POST",
"https://sourcegraph.com/.api/graphql",
bytes.NewBuffer([]byte(graphqlQuery)),
)
if err != nil {
return ToolResponse{}, fmt.Errorf("failed to create request: %w", err)
}
req.Header.Set("Content-Type", "application/json")
req.Header.Set("User-Agent", "opencode/1.0")
resp, err := client.Do(req)
if err != nil {
return ToolResponse{}, fmt.Errorf("failed to fetch URL: %w", err)
}
defer resp.Body.Close()
if resp.StatusCode != http.StatusOK {
body, _ := io.ReadAll(resp.Body)
if len(body) > 0 {
return NewTextErrorResponse(fmt.Sprintf("Request failed with status code: %d, response: %s", resp.StatusCode, string(body))), nil
}
return NewTextErrorResponse(fmt.Sprintf("Request failed with status code: %d", resp.StatusCode)), nil
}
body, err := io.ReadAll(resp.Body)
if err != nil {
return ToolResponse{}, fmt.Errorf("failed to read response body: %w", err)
}
var result map[string]any
if err = json.Unmarshal(body, &result); err != nil {
return ToolResponse{}, fmt.Errorf("failed to unmarshal response: %w", err)
}
formattedResults, err := formatSourcegraphResults(result, params.ContextWindow)
if err != nil {
return NewTextErrorResponse("Failed to format results: " + err.Error()), nil
}
return NewTextResponse(formattedResults), nil
}
func formatSourcegraphResults(result map[string]any, contextWindow int) (string, error) {
var buffer strings.Builder
if errors, ok := result["errors"].([]any); ok && len(errors) > 0 {
buffer.WriteString("## Sourcegraph API Error\n\n")
for _, err := range errors {
if errMap, ok := err.(map[string]any); ok {
if message, ok := errMap["message"].(string); ok {
buffer.WriteString(fmt.Sprintf("- %s\n", message))
}
}
}
return buffer.String(), nil
}
data, ok := result["data"].(map[string]any)
if !ok {
return "", fmt.Errorf("invalid response format: missing data field")
}
search, ok := data["search"].(map[string]any)
if !ok {
return "", fmt.Errorf("invalid response format: missing search field")
}
searchResults, ok := search["results"].(map[string]any)
if !ok {
return "", fmt.Errorf("invalid response format: missing results field")
}
matchCount, _ := searchResults["matchCount"].(float64)
resultCount, _ := searchResults["resultCount"].(float64)
limitHit, _ := searchResults["limitHit"].(bool)
buffer.WriteString("# Sourcegraph Search Results\n\n")
buffer.WriteString(fmt.Sprintf("Found %d matches across %d results\n", int(matchCount), int(resultCount)))
if limitHit {
buffer.WriteString("(Result limit reached, try a more specific query)\n")
}
buffer.WriteString("\n")
results, ok := searchResults["results"].([]any)
if !ok || len(results) == 0 {
buffer.WriteString("No results found. Try a different query.\n")
return buffer.String(), nil
}
maxResults := 10
if len(results) > maxResults {
results = results[:maxResults]
}
for i, res := range results {
fileMatch, ok := res.(map[string]any)
if !ok {
continue
}
typeName, _ := fileMatch["__typename"].(string)
if typeName != "FileMatch" {
continue
}
repo, _ := fileMatch["repository"].(map[string]any)
file, _ := fileMatch["file"].(map[string]any)
lineMatches, _ := fileMatch["lineMatches"].([]any)
if repo == nil || file == nil {
continue
}
repoName, _ := repo["name"].(string)
filePath, _ := file["path"].(string)
fileURL, _ := file["url"].(string)
fileContent, _ := file["content"].(string)
buffer.WriteString(fmt.Sprintf("## Result %d: %s/%s\n\n", i+1, repoName, filePath))
if fileURL != "" {
buffer.WriteString(fmt.Sprintf("URL: %s\n\n", fileURL))
}
if len(lineMatches) > 0 {
for _, lm := range lineMatches {
lineMatch, ok := lm.(map[string]any)
if !ok {
continue
}
lineNumber, _ := lineMatch["lineNumber"].(float64)
preview, _ := lineMatch["preview"].(string)
if fileContent != "" {
lines := strings.Split(fileContent, "\n")
buffer.WriteString("```\n")
startLine := max(1, int(lineNumber)-contextWindow)
for j := startLine - 1; j < int(lineNumber)-1 && j < len(lines); j++ {
if j >= 0 {
buffer.WriteString(fmt.Sprintf("%d| %s\n", j+1, lines[j]))
}
}
buffer.WriteString(fmt.Sprintf("%d| %s\n", int(lineNumber), preview))
endLine := int(lineNumber) + contextWindow
for j := int(lineNumber); j < endLine && j < len(lines); j++ {
if j < len(lines) {
buffer.WriteString(fmt.Sprintf("%d| %s\n", j+1, lines[j]))
}
}
buffer.WriteString("```\n\n")
} else {
buffer.WriteString("```\n")
buffer.WriteString(fmt.Sprintf("%d| %s\n", int(lineNumber), preview))
buffer.WriteString("```\n\n")
}
}
}
}
return buffer.String(), nil
}
+84
View File
@@ -0,0 +1,84 @@
package tools
import (
"context"
"encoding/json"
)
type ToolInfo struct {
Name string
Description string
Parameters map[string]any
Required []string
}
type toolResponseType string
type (
sessionIDContextKey string
messageIDContextKey string
)
const (
ToolResponseTypeText toolResponseType = "text"
ToolResponseTypeImage toolResponseType = "image"
SessionIDContextKey sessionIDContextKey = "session_id"
MessageIDContextKey messageIDContextKey = "message_id"
)
type ToolResponse struct {
Type toolResponseType `json:"type"`
Content string `json:"content"`
Metadata string `json:"metadata,omitempty"`
IsError bool `json:"is_error"`
}
func NewTextResponse(content string) ToolResponse {
return ToolResponse{
Type: ToolResponseTypeText,
Content: content,
}
}
func WithResponseMetadata(response ToolResponse, metadata any) ToolResponse {
if metadata != nil {
metadataBytes, err := json.Marshal(metadata)
if err != nil {
return response
}
response.Metadata = string(metadataBytes)
}
return response
}
func NewTextErrorResponse(content string) ToolResponse {
return ToolResponse{
Type: ToolResponseTypeText,
Content: content,
IsError: true,
}
}
type ToolCall struct {
ID string `json:"id"`
Name string `json:"name"`
Input string `json:"input"`
}
type BaseTool interface {
Info() ToolInfo
Run(ctx context.Context, params ToolCall) (ToolResponse, error)
}
func GetContextValues(ctx context.Context) (string, string) {
sessionID := ctx.Value(SessionIDContextKey)
messageID := ctx.Value(MessageIDContextKey)
if sessionID == nil {
return "", ""
}
if messageID == nil {
return sessionID.(string), ""
}
return sessionID.(string), messageID.(string)
}
+312
View File
@@ -0,0 +1,312 @@
package tools
import (
"bufio"
"context"
"encoding/json"
"fmt"
"io"
"os"
"path/filepath"
"strings"
"github.com/kujtimiihoxha/opencode/internal/config"
"github.com/kujtimiihoxha/opencode/internal/lsp"
)
type ViewParams struct {
FilePath string `json:"file_path"`
Offset int `json:"offset"`
Limit int `json:"limit"`
}
type viewTool struct {
lspClients map[string]*lsp.Client
}
type ViewResponseMetadata struct {
FilePath string `json:"file_path"`
Content string `json:"content"`
}
const (
ViewToolName = "view"
MaxReadSize = 250 * 1024
DefaultReadLimit = 2000
MaxLineLength = 2000
viewDescription = `File viewing tool that reads and displays the contents of files with line numbers, allowing you to examine code, logs, or text data.
WHEN TO USE THIS TOOL:
- Use when you need to read the contents of a specific file
- Helpful for examining source code, configuration files, or log files
- Perfect for looking at text-based file formats
HOW TO USE:
- Provide the path to the file you want to view
- Optionally specify an offset to start reading from a specific line
- Optionally specify a limit to control how many lines are read
FEATURES:
- Displays file contents with line numbers for easy reference
- Can read from any position in a file using the offset parameter
- Handles large files by limiting the number of lines read
- Automatically truncates very long lines for better display
- Suggests similar file names when the requested file isn't found
LIMITATIONS:
- Maximum file size is 250KB
- Default reading limit is 2000 lines
- Lines longer than 2000 characters are truncated
- Cannot display binary files or images
- Images can be identified but not displayed
TIPS:
- Use with Glob tool to first find files you want to view
- For code exploration, first use Grep to find relevant files, then View to examine them
- When viewing large files, use the offset parameter to read specific sections`
)
func NewViewTool(lspClients map[string]*lsp.Client) BaseTool {
return &viewTool{
lspClients,
}
}
func (v *viewTool) Info() ToolInfo {
return ToolInfo{
Name: ViewToolName,
Description: viewDescription,
Parameters: map[string]any{
"file_path": map[string]any{
"type": "string",
"description": "The path to the file to read",
},
"offset": map[string]any{
"type": "integer",
"description": "The line number to start reading from (0-based)",
},
"limit": map[string]any{
"type": "integer",
"description": "The number of lines to read (defaults to 2000)",
},
},
Required: []string{"file_path"},
}
}
// Run implements Tool.
func (v *viewTool) Run(ctx context.Context, call ToolCall) (ToolResponse, error) {
var params ViewParams
if err := json.Unmarshal([]byte(call.Input), &params); err != nil {
return NewTextErrorResponse(fmt.Sprintf("error parsing parameters: %s", err)), nil
}
if params.FilePath == "" {
return NewTextErrorResponse("file_path is required"), nil
}
// Handle relative paths
filePath := params.FilePath
if !filepath.IsAbs(filePath) {
filePath = filepath.Join(config.WorkingDirectory(), filePath)
}
// Check if file exists
fileInfo, err := os.Stat(filePath)
if err != nil {
if os.IsNotExist(err) {
// Try to offer suggestions for similarly named files
dir := filepath.Dir(filePath)
base := filepath.Base(filePath)
dirEntries, dirErr := os.ReadDir(dir)
if dirErr == nil {
var suggestions []string
for _, entry := range dirEntries {
if strings.Contains(strings.ToLower(entry.Name()), strings.ToLower(base)) ||
strings.Contains(strings.ToLower(base), strings.ToLower(entry.Name())) {
suggestions = append(suggestions, filepath.Join(dir, entry.Name()))
if len(suggestions) >= 3 {
break
}
}
}
if len(suggestions) > 0 {
return NewTextErrorResponse(fmt.Sprintf("File not found: %s\n\nDid you mean one of these?\n%s",
filePath, strings.Join(suggestions, "\n"))), nil
}
}
return NewTextErrorResponse(fmt.Sprintf("File not found: %s", filePath)), nil
}
return ToolResponse{}, fmt.Errorf("error accessing file: %w", err)
}
// Check if it's a directory
if fileInfo.IsDir() {
return NewTextErrorResponse(fmt.Sprintf("Path is a directory, not a file: %s", filePath)), nil
}
// Check file size
if fileInfo.Size() > MaxReadSize {
return NewTextErrorResponse(fmt.Sprintf("File is too large (%d bytes). Maximum size is %d bytes",
fileInfo.Size(), MaxReadSize)), nil
}
// Set default limit if not provided
if params.Limit <= 0 {
params.Limit = DefaultReadLimit
}
// Check if it's an image file
isImage, imageType := isImageFile(filePath)
// TODO: handle images
if isImage {
return NewTextErrorResponse(fmt.Sprintf("This is an image file of type: %s\nUse a different tool to process images", imageType)), nil
}
// Read the file content
content, lineCount, err := readTextFile(filePath, params.Offset, params.Limit)
if err != nil {
return ToolResponse{}, fmt.Errorf("error reading file: %w", err)
}
notifyLspOpenFile(ctx, filePath, v.lspClients)
output := "<file>\n"
// Format the output with line numbers
output += addLineNumbers(content, params.Offset+1)
// Add a note if the content was truncated
if lineCount > params.Offset+len(strings.Split(content, "\n")) {
output += fmt.Sprintf("\n\n(File has more lines. Use 'offset' parameter to read beyond line %d)",
params.Offset+len(strings.Split(content, "\n")))
}
output += "\n</file>\n"
output += getDiagnostics(filePath, v.lspClients)
recordFileRead(filePath)
return WithResponseMetadata(
NewTextResponse(output),
ViewResponseMetadata{
FilePath: filePath,
Content: content,
},
), nil
}
func addLineNumbers(content string, startLine int) string {
if content == "" {
return ""
}
lines := strings.Split(content, "\n")
var result []string
for i, line := range lines {
line = strings.TrimSuffix(line, "\r")
lineNum := i + startLine
numStr := fmt.Sprintf("%d", lineNum)
if len(numStr) >= 6 {
result = append(result, fmt.Sprintf("%s|%s", numStr, line))
} else {
paddedNum := fmt.Sprintf("%6s", numStr)
result = append(result, fmt.Sprintf("%s|%s", paddedNum, line))
}
}
return strings.Join(result, "\n")
}
func readTextFile(filePath string, offset, limit int) (string, int, error) {
file, err := os.Open(filePath)
if err != nil {
return "", 0, err
}
defer file.Close()
lineCount := 0
scanner := NewLineScanner(file)
if offset > 0 {
for lineCount < offset && scanner.Scan() {
lineCount++
}
if err = scanner.Err(); err != nil {
return "", 0, err
}
}
if offset == 0 {
_, err = file.Seek(0, io.SeekStart)
if err != nil {
return "", 0, err
}
}
var lines []string
lineCount = offset
for scanner.Scan() && len(lines) < limit {
lineCount++
lineText := scanner.Text()
if len(lineText) > MaxLineLength {
lineText = lineText[:MaxLineLength] + "..."
}
lines = append(lines, lineText)
}
// Continue scanning to get total line count
for scanner.Scan() {
lineCount++
}
if err := scanner.Err(); err != nil {
return "", 0, err
}
return strings.Join(lines, "\n"), lineCount, nil
}
func isImageFile(filePath string) (bool, string) {
ext := strings.ToLower(filepath.Ext(filePath))
switch ext {
case ".jpg", ".jpeg":
return true, "JPEG"
case ".png":
return true, "PNG"
case ".gif":
return true, "GIF"
case ".bmp":
return true, "BMP"
case ".svg":
return true, "SVG"
case ".webp":
return true, "WebP"
default:
return false, ""
}
}
type LineScanner struct {
scanner *bufio.Scanner
}
func NewLineScanner(r io.Reader) *LineScanner {
return &LineScanner{
scanner: bufio.NewScanner(r),
}
}
func (s *LineScanner) Scan() bool {
return s.scanner.Scan()
}
func (s *LineScanner) Text() string {
return s.scanner.Text()
}
func (s *LineScanner) Err() error {
return s.scanner.Err()
}
+227
View File
@@ -0,0 +1,227 @@
package tools
import (
"context"
"encoding/json"
"fmt"
"os"
"path/filepath"
"strings"
"time"
"github.com/kujtimiihoxha/opencode/internal/config"
"github.com/kujtimiihoxha/opencode/internal/diff"
"github.com/kujtimiihoxha/opencode/internal/history"
"github.com/kujtimiihoxha/opencode/internal/logging"
"github.com/kujtimiihoxha/opencode/internal/lsp"
"github.com/kujtimiihoxha/opencode/internal/permission"
)
type WriteParams struct {
FilePath string `json:"file_path"`
Content string `json:"content"`
}
type WritePermissionsParams struct {
FilePath string `json:"file_path"`
Diff string `json:"diff"`
}
type writeTool struct {
lspClients map[string]*lsp.Client
permissions permission.Service
files history.Service
}
type WriteResponseMetadata struct {
Diff string `json:"diff"`
Additions int `json:"additions"`
Removals int `json:"removals"`
}
const (
WriteToolName = "write"
writeDescription = `File writing tool that creates or updates files in the filesystem, allowing you to save or modify text content.
WHEN TO USE THIS TOOL:
- Use when you need to create a new file
- Helpful for updating existing files with modified content
- Perfect for saving generated code, configurations, or text data
HOW TO USE:
- Provide the path to the file you want to write
- Include the content to be written to the file
- The tool will create any necessary parent directories
FEATURES:
- Can create new files or overwrite existing ones
- Creates parent directories automatically if they don't exist
- Checks if the file has been modified since last read for safety
- Avoids unnecessary writes when content hasn't changed
LIMITATIONS:
- You should read a file before writing to it to avoid conflicts
- Cannot append to files (rewrites the entire file)
TIPS:
- Use the View tool first to examine existing files before modifying them
- Use the LS tool to verify the correct location when creating new files
- Combine with Glob and Grep tools to find and modify multiple files
- Always include descriptive comments when making changes to existing code`
)
func NewWriteTool(lspClients map[string]*lsp.Client, permissions permission.Service, files history.Service) BaseTool {
return &writeTool{
lspClients: lspClients,
permissions: permissions,
files: files,
}
}
func (w *writeTool) Info() ToolInfo {
return ToolInfo{
Name: WriteToolName,
Description: writeDescription,
Parameters: map[string]any{
"file_path": map[string]any{
"type": "string",
"description": "The path to the file to write",
},
"content": map[string]any{
"type": "string",
"description": "The content to write to the file",
},
},
Required: []string{"file_path", "content"},
}
}
func (w *writeTool) Run(ctx context.Context, call ToolCall) (ToolResponse, error) {
var params WriteParams
if err := json.Unmarshal([]byte(call.Input), &params); err != nil {
return NewTextErrorResponse(fmt.Sprintf("error parsing parameters: %s", err)), nil
}
if params.FilePath == "" {
return NewTextErrorResponse("file_path is required"), nil
}
if params.Content == "" {
return NewTextErrorResponse("content is required"), nil
}
filePath := params.FilePath
if !filepath.IsAbs(filePath) {
filePath = filepath.Join(config.WorkingDirectory(), filePath)
}
fileInfo, err := os.Stat(filePath)
if err == nil {
if fileInfo.IsDir() {
return NewTextErrorResponse(fmt.Sprintf("Path is a directory, not a file: %s", filePath)), nil
}
modTime := fileInfo.ModTime()
lastRead := getLastReadTime(filePath)
if modTime.After(lastRead) {
return NewTextErrorResponse(fmt.Sprintf("File %s has been modified since it was last read.\nLast modification: %s\nLast read: %s\n\nPlease read the file again before modifying it.",
filePath, modTime.Format(time.RFC3339), lastRead.Format(time.RFC3339))), nil
}
oldContent, readErr := os.ReadFile(filePath)
if readErr == nil && string(oldContent) == params.Content {
return NewTextErrorResponse(fmt.Sprintf("File %s already contains the exact content. No changes made.", filePath)), nil
}
} else if !os.IsNotExist(err) {
return ToolResponse{}, fmt.Errorf("error checking file: %w", err)
}
dir := filepath.Dir(filePath)
if err = os.MkdirAll(dir, 0o755); err != nil {
return ToolResponse{}, fmt.Errorf("error creating directory: %w", err)
}
oldContent := ""
if fileInfo != nil && !fileInfo.IsDir() {
oldBytes, readErr := os.ReadFile(filePath)
if readErr == nil {
oldContent = string(oldBytes)
}
}
sessionID, messageID := GetContextValues(ctx)
if sessionID == "" || messageID == "" {
return ToolResponse{}, fmt.Errorf("session_id and message_id are required")
}
diff, additions, removals := diff.GenerateDiff(
oldContent,
params.Content,
filePath,
)
rootDir := config.WorkingDirectory()
permissionPath := filepath.Dir(filePath)
if strings.HasPrefix(filePath, rootDir) {
permissionPath = rootDir
}
p := w.permissions.Request(
permission.CreatePermissionRequest{
SessionID: sessionID,
Path: permissionPath,
ToolName: WriteToolName,
Action: "write",
Description: fmt.Sprintf("Create file %s", filePath),
Params: WritePermissionsParams{
FilePath: filePath,
Diff: diff,
},
},
)
if !p {
return ToolResponse{}, permission.ErrorPermissionDenied
}
err = os.WriteFile(filePath, []byte(params.Content), 0o644)
if err != nil {
return ToolResponse{}, fmt.Errorf("error writing file: %w", err)
}
// Check if file exists in history
file, err := w.files.GetByPathAndSession(ctx, filePath, sessionID)
if err != nil {
_, err = w.files.Create(ctx, sessionID, filePath, oldContent)
if err != nil {
// Log error but don't fail the operation
return ToolResponse{}, fmt.Errorf("error creating file history: %w", err)
}
}
if file.Content != oldContent {
// User Manually changed the content store an intermediate version
_, err = w.files.CreateVersion(ctx, sessionID, filePath, oldContent)
if err != nil {
logging.Debug("Error creating file history version", "error", err)
}
}
// Store the new version
_, err = w.files.CreateVersion(ctx, sessionID, filePath, params.Content)
if err != nil {
logging.Debug("Error creating file history version", "error", err)
}
recordFileWrite(filePath)
recordFileRead(filePath)
waitForLspDiagnostics(ctx, filePath, w.lspClients)
result := fmt.Sprintf("File successfully written: %s", filePath)
result = fmt.Sprintf("<result>\n%s\n</result>", result)
result += getDiagnostics(filePath, w.lspClients)
return WithResponseMetadata(NewTextResponse(result),
WriteResponseMetadata{
Diff: diff,
Additions: additions,
Removals: removals,
},
), nil
}
+78
View File
@@ -0,0 +1,78 @@
package logging
import (
"fmt"
"log/slog"
"os"
"runtime/debug"
"time"
)
func Info(msg string, args ...any) {
slog.Info(msg, args...)
}
func Debug(msg string, args ...any) {
slog.Debug(msg, args...)
}
func Warn(msg string, args ...any) {
slog.Warn(msg, args...)
}
func Error(msg string, args ...any) {
slog.Error(msg, args...)
}
func InfoPersist(msg string, args ...any) {
args = append(args, persistKeyArg, true)
slog.Info(msg, args...)
}
func DebugPersist(msg string, args ...any) {
args = append(args, persistKeyArg, true)
slog.Debug(msg, args...)
}
func WarnPersist(msg string, args ...any) {
args = append(args, persistKeyArg, true)
slog.Warn(msg, args...)
}
func ErrorPersist(msg string, args ...any) {
args = append(args, persistKeyArg, true)
slog.Error(msg, args...)
}
// RecoverPanic is a common function to handle panics gracefully.
// It logs the error, creates a panic log file with stack trace,
// and executes an optional cleanup function before returning.
func RecoverPanic(name string, cleanup func()) {
if r := recover(); r != nil {
// Log the panic
ErrorPersist(fmt.Sprintf("Panic in %s: %v", name, r))
// Create a timestamped panic log file
timestamp := time.Now().Format("20060102-150405")
filename := fmt.Sprintf("opencode-panic-%s-%s.log", name, timestamp)
file, err := os.Create(filename)
if err != nil {
ErrorPersist(fmt.Sprintf("Failed to create panic log: %v", err))
} else {
defer file.Close()
// Write panic information and stack trace
fmt.Fprintf(file, "Panic in %s: %v\n\n", name, r)
fmt.Fprintf(file, "Time: %s\n\n", time.Now().Format(time.RFC3339))
fmt.Fprintf(file, "Stack Trace:\n%s\n", debug.Stack())
InfoPersist(fmt.Sprintf("Panic details written to %s", filename))
}
// Execute cleanup function if provided
if cleanup != nil {
cleanup()
}
}
}
+21
View File
@@ -0,0 +1,21 @@
package logging
import (
"time"
)
// LogMessage is the event payload for a log message
type LogMessage struct {
ID string
Time time.Time
Level string
Persist bool // used when we want to show the mesage in the status bar
PersistTime time.Duration // used when we want to show the mesage in the status bar
Message string `json:"msg"`
Attributes []Attr
}
type Attr struct {
Key string
Value string
}
+101
View File
@@ -0,0 +1,101 @@
package logging
import (
"bytes"
"context"
"fmt"
"strings"
"sync"
"time"
"github.com/go-logfmt/logfmt"
"github.com/kujtimiihoxha/opencode/internal/pubsub"
)
const (
persistKeyArg = "$_persist"
PersistTimeArg = "$_persist_time"
)
type LogData struct {
messages []LogMessage
*pubsub.Broker[LogMessage]
lock sync.Mutex
}
func (l *LogData) Add(msg LogMessage) {
l.lock.Lock()
defer l.lock.Unlock()
l.messages = append(l.messages, msg)
l.Publish(pubsub.CreatedEvent, msg)
}
func (l *LogData) List() []LogMessage {
l.lock.Lock()
defer l.lock.Unlock()
return l.messages
}
var defaultLogData = &LogData{
messages: make([]LogMessage, 0),
Broker: pubsub.NewBroker[LogMessage](),
}
type writer struct{}
func (w *writer) Write(p []byte) (int, error) {
d := logfmt.NewDecoder(bytes.NewReader(p))
for d.ScanRecord() {
msg := LogMessage{
ID: fmt.Sprintf("%d", time.Now().UnixNano()),
Time: time.Now(),
}
for d.ScanKeyval() {
switch string(d.Key()) {
case "time":
parsed, err := time.Parse(time.RFC3339, string(d.Value()))
if err != nil {
return 0, fmt.Errorf("parsing time: %w", err)
}
msg.Time = parsed
case "level":
msg.Level = strings.ToLower(string(d.Value()))
case "msg":
msg.Message = string(d.Value())
default:
if string(d.Key()) == persistKeyArg {
msg.Persist = true
} else if string(d.Key()) == PersistTimeArg {
parsed, err := time.ParseDuration(string(d.Value()))
if err != nil {
continue
}
msg.PersistTime = parsed
} else {
msg.Attributes = append(msg.Attributes, Attr{
Key: string(d.Key()),
Value: string(d.Value()),
})
}
}
}
defaultLogData.Add(msg)
}
if d.Err() != nil {
return 0, d.Err()
}
return len(p), nil
}
func NewWriter() *writer {
w := &writer{}
return w
}
func Subscribe(ctx context.Context) <-chan pubsub.Event[LogMessage] {
return defaultLogData.Subscribe(ctx)
}
func List() []LogMessage {
return defaultLogData.List()
}
+778
View File
@@ -0,0 +1,778 @@
package lsp
import (
"bufio"
"context"
"encoding/json"
"fmt"
"io"
"os"
"os/exec"
"path/filepath"
"strings"
"sync"
"sync/atomic"
"time"
"github.com/kujtimiihoxha/opencode/internal/config"
"github.com/kujtimiihoxha/opencode/internal/logging"
"github.com/kujtimiihoxha/opencode/internal/lsp/protocol"
)
type Client struct {
Cmd *exec.Cmd
stdin io.WriteCloser
stdout *bufio.Reader
stderr io.ReadCloser
// Request ID counter
nextID atomic.Int32
// Response handlers
handlers map[int32]chan *Message
handlersMu sync.RWMutex
// Server request handlers
serverRequestHandlers map[string]ServerRequestHandler
serverHandlersMu sync.RWMutex
// Notification handlers
notificationHandlers map[string]NotificationHandler
notificationMu sync.RWMutex
// Diagnostic cache
diagnostics map[protocol.DocumentUri][]protocol.Diagnostic
diagnosticsMu sync.RWMutex
// Files are currently opened by the LSP
openFiles map[string]*OpenFileInfo
openFilesMu sync.RWMutex
// Server state
serverState atomic.Value
}
func NewClient(ctx context.Context, command string, args ...string) (*Client, error) {
cmd := exec.CommandContext(ctx, command, args...)
// Copy env
cmd.Env = os.Environ()
stdin, err := cmd.StdinPipe()
if err != nil {
return nil, fmt.Errorf("failed to create stdin pipe: %w", err)
}
stdout, err := cmd.StdoutPipe()
if err != nil {
return nil, fmt.Errorf("failed to create stdout pipe: %w", err)
}
stderr, err := cmd.StderrPipe()
if err != nil {
return nil, fmt.Errorf("failed to create stderr pipe: %w", err)
}
client := &Client{
Cmd: cmd,
stdin: stdin,
stdout: bufio.NewReader(stdout),
stderr: stderr,
handlers: make(map[int32]chan *Message),
notificationHandlers: make(map[string]NotificationHandler),
serverRequestHandlers: make(map[string]ServerRequestHandler),
diagnostics: make(map[protocol.DocumentUri][]protocol.Diagnostic),
openFiles: make(map[string]*OpenFileInfo),
}
// Initialize server state
client.serverState.Store(StateStarting)
// Start the LSP server process
if err := cmd.Start(); err != nil {
return nil, fmt.Errorf("failed to start LSP server: %w", err)
}
// Handle stderr in a separate goroutine
go func() {
scanner := bufio.NewScanner(stderr)
for scanner.Scan() {
fmt.Fprintf(os.Stderr, "LSP Server: %s\n", scanner.Text())
}
if err := scanner.Err(); err != nil {
fmt.Fprintf(os.Stderr, "Error reading stderr: %v\n", err)
}
}()
// Start message handling loop
go func() {
defer logging.RecoverPanic("LSP-message-handler", func() {
logging.ErrorPersist("LSP message handler crashed, LSP functionality may be impaired")
})
client.handleMessages()
}()
return client, nil
}
func (c *Client) RegisterNotificationHandler(method string, handler NotificationHandler) {
c.notificationMu.Lock()
defer c.notificationMu.Unlock()
c.notificationHandlers[method] = handler
}
func (c *Client) RegisterServerRequestHandler(method string, handler ServerRequestHandler) {
c.serverHandlersMu.Lock()
defer c.serverHandlersMu.Unlock()
c.serverRequestHandlers[method] = handler
}
func (c *Client) InitializeLSPClient(ctx context.Context, workspaceDir string) (*protocol.InitializeResult, error) {
initParams := &protocol.InitializeParams{
WorkspaceFoldersInitializeParams: protocol.WorkspaceFoldersInitializeParams{
WorkspaceFolders: []protocol.WorkspaceFolder{
{
URI: protocol.URI("file://" + workspaceDir),
Name: workspaceDir,
},
},
},
XInitializeParams: protocol.XInitializeParams{
ProcessID: int32(os.Getpid()),
ClientInfo: &protocol.ClientInfo{
Name: "mcp-language-server",
Version: "0.1.0",
},
RootPath: workspaceDir,
RootURI: protocol.DocumentUri("file://" + workspaceDir),
Capabilities: protocol.ClientCapabilities{
Workspace: protocol.WorkspaceClientCapabilities{
Configuration: true,
DidChangeConfiguration: protocol.DidChangeConfigurationClientCapabilities{
DynamicRegistration: true,
},
DidChangeWatchedFiles: protocol.DidChangeWatchedFilesClientCapabilities{
DynamicRegistration: true,
RelativePatternSupport: true,
},
},
TextDocument: protocol.TextDocumentClientCapabilities{
Synchronization: &protocol.TextDocumentSyncClientCapabilities{
DynamicRegistration: true,
DidSave: true,
},
Completion: protocol.CompletionClientCapabilities{
CompletionItem: protocol.ClientCompletionItemOptions{},
},
CodeLens: &protocol.CodeLensClientCapabilities{
DynamicRegistration: true,
},
DocumentSymbol: protocol.DocumentSymbolClientCapabilities{},
CodeAction: protocol.CodeActionClientCapabilities{
CodeActionLiteralSupport: protocol.ClientCodeActionLiteralOptions{
CodeActionKind: protocol.ClientCodeActionKindOptions{
ValueSet: []protocol.CodeActionKind{},
},
},
},
PublishDiagnostics: protocol.PublishDiagnosticsClientCapabilities{
VersionSupport: true,
},
SemanticTokens: protocol.SemanticTokensClientCapabilities{
Requests: protocol.ClientSemanticTokensRequestOptions{
Range: &protocol.Or_ClientSemanticTokensRequestOptions_range{},
Full: &protocol.Or_ClientSemanticTokensRequestOptions_full{},
},
TokenTypes: []string{},
TokenModifiers: []string{},
Formats: []protocol.TokenFormat{},
},
},
Window: protocol.WindowClientCapabilities{},
},
InitializationOptions: map[string]any{
"codelenses": map[string]bool{
"generate": true,
"regenerate_cgo": true,
"test": true,
"tidy": true,
"upgrade_dependency": true,
"vendor": true,
"vulncheck": false,
},
},
},
}
var result protocol.InitializeResult
if err := c.Call(ctx, "initialize", initParams, &result); err != nil {
return nil, fmt.Errorf("initialize failed: %w", err)
}
if err := c.Notify(ctx, "initialized", struct{}{}); err != nil {
return nil, fmt.Errorf("initialized notification failed: %w", err)
}
// Register handlers
c.RegisterServerRequestHandler("workspace/applyEdit", HandleApplyEdit)
c.RegisterServerRequestHandler("workspace/configuration", HandleWorkspaceConfiguration)
c.RegisterServerRequestHandler("client/registerCapability", HandleRegisterCapability)
c.RegisterNotificationHandler("window/showMessage", HandleServerMessage)
c.RegisterNotificationHandler("textDocument/publishDiagnostics",
func(params json.RawMessage) { HandleDiagnostics(c, params) })
// Notify the LSP server
err := c.Initialized(ctx, protocol.InitializedParams{})
if err != nil {
return nil, fmt.Errorf("initialization failed: %w", err)
}
return &result, nil
}
func (c *Client) Close() error {
// Try to close all open files first
ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second)
defer cancel()
// Attempt to close files but continue shutdown regardless
c.CloseAllFiles(ctx)
// Close stdin to signal the server
if err := c.stdin.Close(); err != nil {
return fmt.Errorf("failed to close stdin: %w", err)
}
// Use a channel to handle the Wait with timeout
done := make(chan error, 1)
go func() {
done <- c.Cmd.Wait()
}()
// Wait for process to exit with timeout
select {
case err := <-done:
return err
case <-time.After(2 * time.Second):
// If we timeout, try to kill the process
if err := c.Cmd.Process.Kill(); err != nil {
return fmt.Errorf("failed to kill process: %w", err)
}
return fmt.Errorf("process killed after timeout")
}
}
type ServerState int
const (
StateStarting ServerState = iota
StateReady
StateError
)
// GetServerState returns the current state of the LSP server
func (c *Client) GetServerState() ServerState {
if val := c.serverState.Load(); val != nil {
return val.(ServerState)
}
return StateStarting
}
// SetServerState sets the current state of the LSP server
func (c *Client) SetServerState(state ServerState) {
c.serverState.Store(state)
}
// WaitForServerReady waits for the server to be ready by polling the server
// with a simple request until it responds successfully or times out
func (c *Client) WaitForServerReady(ctx context.Context) error {
cnf := config.Get()
// Set initial state
c.SetServerState(StateStarting)
// Create a context with timeout
ctx, cancel := context.WithTimeout(ctx, 30*time.Second)
defer cancel()
// Try to ping the server with a simple request
ticker := time.NewTicker(500 * time.Millisecond)
defer ticker.Stop()
if cnf.DebugLSP {
logging.Debug("Waiting for LSP server to be ready...")
}
// Determine server type for specialized initialization
serverType := c.detectServerType()
// For TypeScript-like servers, we need to open some key files first
if serverType == ServerTypeTypeScript {
if cnf.DebugLSP {
logging.Debug("TypeScript-like server detected, opening key configuration files")
}
c.openKeyConfigFiles(ctx)
}
for {
select {
case <-ctx.Done():
c.SetServerState(StateError)
return fmt.Errorf("timeout waiting for LSP server to be ready")
case <-ticker.C:
// Try a ping method appropriate for this server type
err := c.pingServerByType(ctx, serverType)
if err == nil {
// Server responded successfully
c.SetServerState(StateReady)
if cnf.DebugLSP {
logging.Debug("LSP server is ready")
}
return nil
} else {
logging.Debug("LSP server not ready yet", "error", err, "serverType", serverType)
}
if cnf.DebugLSP {
logging.Debug("LSP server not ready yet", "error", err, "serverType", serverType)
}
}
}
}
// ServerType represents the type of LSP server
type ServerType int
const (
ServerTypeUnknown ServerType = iota
ServerTypeGo
ServerTypeTypeScript
ServerTypeRust
ServerTypePython
ServerTypeGeneric
)
// detectServerType tries to determine what type of LSP server we're dealing with
func (c *Client) detectServerType() ServerType {
if c.Cmd == nil {
return ServerTypeUnknown
}
cmdPath := strings.ToLower(c.Cmd.Path)
switch {
case strings.Contains(cmdPath, "gopls"):
return ServerTypeGo
case strings.Contains(cmdPath, "typescript") || strings.Contains(cmdPath, "vtsls") || strings.Contains(cmdPath, "tsserver"):
return ServerTypeTypeScript
case strings.Contains(cmdPath, "rust-analyzer"):
return ServerTypeRust
case strings.Contains(cmdPath, "pyright") || strings.Contains(cmdPath, "pylsp") || strings.Contains(cmdPath, "python"):
return ServerTypePython
default:
return ServerTypeGeneric
}
}
// openKeyConfigFiles opens important configuration files that help initialize the server
func (c *Client) openKeyConfigFiles(ctx context.Context) {
workDir := config.WorkingDirectory()
serverType := c.detectServerType()
var filesToOpen []string
switch serverType {
case ServerTypeTypeScript:
// TypeScript servers need these config files to properly initialize
filesToOpen = []string{
filepath.Join(workDir, "tsconfig.json"),
filepath.Join(workDir, "package.json"),
filepath.Join(workDir, "jsconfig.json"),
}
// Also find and open a few TypeScript files to help the server initialize
c.openTypeScriptFiles(ctx, workDir)
case ServerTypeGo:
filesToOpen = []string{
filepath.Join(workDir, "go.mod"),
filepath.Join(workDir, "go.sum"),
}
case ServerTypeRust:
filesToOpen = []string{
filepath.Join(workDir, "Cargo.toml"),
filepath.Join(workDir, "Cargo.lock"),
}
}
// Try to open each file, ignoring errors if they don't exist
for _, file := range filesToOpen {
if _, err := os.Stat(file); err == nil {
// File exists, try to open it
if err := c.OpenFile(ctx, file); err != nil {
logging.Debug("Failed to open key config file", "file", file, "error", err)
} else {
logging.Debug("Opened key config file for initialization", "file", file)
}
}
}
}
// pingServerByType sends a ping request appropriate for the server type
func (c *Client) pingServerByType(ctx context.Context, serverType ServerType) error {
switch serverType {
case ServerTypeTypeScript:
// For TypeScript, try a document symbol request on an open file
return c.pingTypeScriptServer(ctx)
case ServerTypeGo:
// For Go, workspace/symbol works well
return c.pingWithWorkspaceSymbol(ctx)
case ServerTypeRust:
// For Rust, workspace/symbol works well
return c.pingWithWorkspaceSymbol(ctx)
default:
// Default ping method
return c.pingWithWorkspaceSymbol(ctx)
}
}
// pingTypeScriptServer tries to ping a TypeScript server with appropriate methods
func (c *Client) pingTypeScriptServer(ctx context.Context) error {
// First try workspace/symbol which works for many servers
if err := c.pingWithWorkspaceSymbol(ctx); err == nil {
return nil
}
// If that fails, try to find an open file and request document symbols
c.openFilesMu.RLock()
defer c.openFilesMu.RUnlock()
// If we have any open files, try to get document symbols for one
for uri := range c.openFiles {
filePath := strings.TrimPrefix(uri, "file://")
if strings.HasSuffix(filePath, ".ts") || strings.HasSuffix(filePath, ".js") ||
strings.HasSuffix(filePath, ".tsx") || strings.HasSuffix(filePath, ".jsx") {
var symbols []protocol.DocumentSymbol
err := c.Call(ctx, "textDocument/documentSymbol", protocol.DocumentSymbolParams{
TextDocument: protocol.TextDocumentIdentifier{
URI: protocol.DocumentUri(uri),
},
}, &symbols)
if err == nil {
return nil
}
}
}
// If we have no open TypeScript files, try to find and open one
workDir := config.WorkingDirectory()
err := filepath.WalkDir(workDir, func(path string, d os.DirEntry, err error) error {
if err != nil {
return err
}
// Skip directories and non-TypeScript files
if d.IsDir() {
return nil
}
ext := filepath.Ext(path)
if ext == ".ts" || ext == ".js" || ext == ".tsx" || ext == ".jsx" {
// Found a TypeScript file, try to open it
if err := c.OpenFile(ctx, path); err == nil {
// Successfully opened, stop walking
return filepath.SkipAll
}
}
return nil
})
if err != nil {
logging.Debug("Error walking directory for TypeScript files", "error", err)
}
// Final fallback - just try a generic capability
return c.pingWithServerCapabilities(ctx)
}
// openTypeScriptFiles finds and opens TypeScript files to help initialize the server
func (c *Client) openTypeScriptFiles(ctx context.Context, workDir string) {
cnf := config.Get()
filesOpened := 0
maxFilesToOpen := 5 // Limit to a reasonable number of files
// Find and open TypeScript files
err := filepath.WalkDir(workDir, func(path string, d os.DirEntry, err error) error {
if err != nil {
return err
}
// Skip directories and non-TypeScript files
if d.IsDir() {
// Skip common directories to avoid wasting time
if shouldSkipDir(path) {
return filepath.SkipDir
}
return nil
}
// Check if we've opened enough files
if filesOpened >= maxFilesToOpen {
return filepath.SkipAll
}
// Check file extension
ext := filepath.Ext(path)
if ext == ".ts" || ext == ".tsx" || ext == ".js" || ext == ".jsx" {
// Try to open the file
if err := c.OpenFile(ctx, path); err == nil {
filesOpened++
if cnf.DebugLSP {
logging.Debug("Opened TypeScript file for initialization", "file", path)
}
}
}
return nil
})
if err != nil && cnf.DebugLSP {
logging.Debug("Error walking directory for TypeScript files", "error", err)
}
if cnf.DebugLSP {
logging.Debug("Opened TypeScript files for initialization", "count", filesOpened)
}
}
// shouldSkipDir returns true if the directory should be skipped during file search
func shouldSkipDir(path string) bool {
dirName := filepath.Base(path)
// Skip hidden directories
if strings.HasPrefix(dirName, ".") {
return true
}
// Skip common directories that won't contain relevant source files
skipDirs := map[string]bool{
"node_modules": true,
"dist": true,
"build": true,
"coverage": true,
"vendor": true,
"target": true,
}
return skipDirs[dirName]
}
// pingWithWorkspaceSymbol tries a workspace/symbol request
func (c *Client) pingWithWorkspaceSymbol(ctx context.Context) error {
var result []protocol.SymbolInformation
return c.Call(ctx, "workspace/symbol", protocol.WorkspaceSymbolParams{
Query: "",
}, &result)
}
// pingWithServerCapabilities tries to get server capabilities
func (c *Client) pingWithServerCapabilities(ctx context.Context) error {
// This is a very lightweight request that should work for most servers
return c.Notify(ctx, "$/cancelRequest", struct{ ID int }{ID: -1})
}
type OpenFileInfo struct {
Version int32
URI protocol.DocumentUri
}
func (c *Client) OpenFile(ctx context.Context, filepath string) error {
uri := fmt.Sprintf("file://%s", filepath)
c.openFilesMu.Lock()
if _, exists := c.openFiles[uri]; exists {
c.openFilesMu.Unlock()
return nil // Already open
}
c.openFilesMu.Unlock()
// Skip files that do not exist or cannot be read
content, err := os.ReadFile(filepath)
if err != nil {
return fmt.Errorf("error reading file: %w", err)
}
params := protocol.DidOpenTextDocumentParams{
TextDocument: protocol.TextDocumentItem{
URI: protocol.DocumentUri(uri),
LanguageID: DetectLanguageID(uri),
Version: 1,
Text: string(content),
},
}
if err := c.Notify(ctx, "textDocument/didOpen", params); err != nil {
return err
}
c.openFilesMu.Lock()
c.openFiles[uri] = &OpenFileInfo{
Version: 1,
URI: protocol.DocumentUri(uri),
}
c.openFilesMu.Unlock()
return nil
}
func (c *Client) NotifyChange(ctx context.Context, filepath string) error {
uri := fmt.Sprintf("file://%s", filepath)
content, err := os.ReadFile(filepath)
if err != nil {
return fmt.Errorf("error reading file: %w", err)
}
c.openFilesMu.Lock()
fileInfo, isOpen := c.openFiles[uri]
if !isOpen {
c.openFilesMu.Unlock()
return fmt.Errorf("cannot notify change for unopened file: %s", filepath)
}
// Increment version
fileInfo.Version++
version := fileInfo.Version
c.openFilesMu.Unlock()
params := protocol.DidChangeTextDocumentParams{
TextDocument: protocol.VersionedTextDocumentIdentifier{
TextDocumentIdentifier: protocol.TextDocumentIdentifier{
URI: protocol.DocumentUri(uri),
},
Version: version,
},
ContentChanges: []protocol.TextDocumentContentChangeEvent{
{
Value: protocol.TextDocumentContentChangeWholeDocument{
Text: string(content),
},
},
},
}
return c.Notify(ctx, "textDocument/didChange", params)
}
func (c *Client) CloseFile(ctx context.Context, filepath string) error {
cnf := config.Get()
uri := fmt.Sprintf("file://%s", filepath)
c.openFilesMu.Lock()
if _, exists := c.openFiles[uri]; !exists {
c.openFilesMu.Unlock()
return nil // Already closed
}
c.openFilesMu.Unlock()
params := protocol.DidCloseTextDocumentParams{
TextDocument: protocol.TextDocumentIdentifier{
URI: protocol.DocumentUri(uri),
},
}
if cnf.DebugLSP {
logging.Debug("Closing file", "file", filepath)
}
if err := c.Notify(ctx, "textDocument/didClose", params); err != nil {
return err
}
c.openFilesMu.Lock()
delete(c.openFiles, uri)
c.openFilesMu.Unlock()
return nil
}
func (c *Client) IsFileOpen(filepath string) bool {
uri := fmt.Sprintf("file://%s", filepath)
c.openFilesMu.RLock()
defer c.openFilesMu.RUnlock()
_, exists := c.openFiles[uri]
return exists
}
// CloseAllFiles closes all currently open files
func (c *Client) CloseAllFiles(ctx context.Context) {
cnf := config.Get()
c.openFilesMu.Lock()
filesToClose := make([]string, 0, len(c.openFiles))
// First collect all URIs that need to be closed
for uri := range c.openFiles {
// Convert URI back to file path by trimming "file://" prefix
filePath := strings.TrimPrefix(uri, "file://")
filesToClose = append(filesToClose, filePath)
}
c.openFilesMu.Unlock()
// Then close them all
for _, filePath := range filesToClose {
err := c.CloseFile(ctx, filePath)
if err != nil && cnf.DebugLSP {
logging.Warn("Error closing file", "file", filePath, "error", err)
}
}
if cnf.DebugLSP {
logging.Debug("Closed all files", "files", filesToClose)
}
}
func (c *Client) GetFileDiagnostics(uri protocol.DocumentUri) []protocol.Diagnostic {
c.diagnosticsMu.RLock()
defer c.diagnosticsMu.RUnlock()
return c.diagnostics[uri]
}
// GetDiagnostics returns all diagnostics for all files
func (c *Client) GetDiagnostics() map[protocol.DocumentUri][]protocol.Diagnostic {
return c.diagnostics
}
// OpenFileOnDemand opens a file only if it's not already open
// This is used for lazy-loading files when they're actually needed
func (c *Client) OpenFileOnDemand(ctx context.Context, filepath string) error {
// Check if the file is already open
if c.IsFileOpen(filepath) {
return nil
}
// Open the file
return c.OpenFile(ctx, filepath)
}
// GetDiagnosticsForFile ensures a file is open and returns its diagnostics
// This is useful for on-demand diagnostics when using lazy loading
func (c *Client) GetDiagnosticsForFile(ctx context.Context, filepath string) ([]protocol.Diagnostic, error) {
uri := fmt.Sprintf("file://%s", filepath)
documentUri := protocol.DocumentUri(uri)
// Make sure the file is open
if !c.IsFileOpen(filepath) {
if err := c.OpenFile(ctx, filepath); err != nil {
return nil, fmt.Errorf("failed to open file for diagnostics: %w", err)
}
// Give the LSP server a moment to process the file
time.Sleep(100 * time.Millisecond)
}
// Get diagnostics
c.diagnosticsMu.RLock()
diagnostics := c.diagnostics[documentUri]
c.diagnosticsMu.RUnlock()
return diagnostics, nil
}
+108
View File
@@ -0,0 +1,108 @@
package lsp
import (
"encoding/json"
"github.com/kujtimiihoxha/opencode/internal/config"
"github.com/kujtimiihoxha/opencode/internal/logging"
"github.com/kujtimiihoxha/opencode/internal/lsp/protocol"
"github.com/kujtimiihoxha/opencode/internal/lsp/util"
)
// Requests
func HandleWorkspaceConfiguration(params json.RawMessage) (any, error) {
return []map[string]any{{}}, nil
}
func HandleRegisterCapability(params json.RawMessage) (any, error) {
var registerParams protocol.RegistrationParams
if err := json.Unmarshal(params, &registerParams); err != nil {
logging.Error("Error unmarshaling registration params", "error", err)
return nil, err
}
for _, reg := range registerParams.Registrations {
switch reg.Method {
case "workspace/didChangeWatchedFiles":
// Parse the registration options
optionsJSON, err := json.Marshal(reg.RegisterOptions)
if err != nil {
logging.Error("Error marshaling registration options", "error", err)
continue
}
var options protocol.DidChangeWatchedFilesRegistrationOptions
if err := json.Unmarshal(optionsJSON, &options); err != nil {
logging.Error("Error unmarshaling registration options", "error", err)
continue
}
// Store the file watchers registrations
notifyFileWatchRegistration(reg.ID, options.Watchers)
}
}
return nil, nil
}
func HandleApplyEdit(params json.RawMessage) (any, error) {
var edit protocol.ApplyWorkspaceEditParams
if err := json.Unmarshal(params, &edit); err != nil {
return nil, err
}
err := util.ApplyWorkspaceEdit(edit.Edit)
if err != nil {
logging.Error("Error applying workspace edit", "error", err)
return protocol.ApplyWorkspaceEditResult{Applied: false, FailureReason: err.Error()}, nil
}
return protocol.ApplyWorkspaceEditResult{Applied: true}, nil
}
// FileWatchRegistrationHandler is a function that will be called when file watch registrations are received
type FileWatchRegistrationHandler func(id string, watchers []protocol.FileSystemWatcher)
// fileWatchHandler holds the current handler for file watch registrations
var fileWatchHandler FileWatchRegistrationHandler
// RegisterFileWatchHandler sets the handler for file watch registrations
func RegisterFileWatchHandler(handler FileWatchRegistrationHandler) {
fileWatchHandler = handler
}
// notifyFileWatchRegistration notifies the handler about new file watch registrations
func notifyFileWatchRegistration(id string, watchers []protocol.FileSystemWatcher) {
if fileWatchHandler != nil {
fileWatchHandler(id, watchers)
}
}
// Notifications
func HandleServerMessage(params json.RawMessage) {
cnf := config.Get()
var msg struct {
Type int `json:"type"`
Message string `json:"message"`
}
if err := json.Unmarshal(params, &msg); err == nil {
if cnf.DebugLSP {
logging.Debug("Server message", "type", msg.Type, "message", msg.Message)
}
}
}
func HandleDiagnostics(client *Client, params json.RawMessage) {
var diagParams protocol.PublishDiagnosticsParams
if err := json.Unmarshal(params, &diagParams); err != nil {
logging.Error("Error unmarshaling diagnostics params", "error", err)
return
}
client.diagnosticsMu.Lock()
defer client.diagnosticsMu.Unlock()
client.diagnostics[diagParams.URI] = diagParams.Diagnostics
}
+132
View File
@@ -0,0 +1,132 @@
package lsp
import (
"path/filepath"
"strings"
"github.com/kujtimiihoxha/opencode/internal/lsp/protocol"
)
func DetectLanguageID(uri string) protocol.LanguageKind {
ext := strings.ToLower(filepath.Ext(uri))
switch ext {
case ".abap":
return protocol.LangABAP
case ".bat":
return protocol.LangWindowsBat
case ".bib", ".bibtex":
return protocol.LangBibTeX
case ".clj":
return protocol.LangClojure
case ".coffee":
return protocol.LangCoffeescript
case ".c":
return protocol.LangC
case ".cpp", ".cxx", ".cc", ".c++":
return protocol.LangCPP
case ".cs":
return protocol.LangCSharp
case ".css":
return protocol.LangCSS
case ".d":
return protocol.LangD
case ".pas", ".pascal":
return protocol.LangDelphi
case ".diff", ".patch":
return protocol.LangDiff
case ".dart":
return protocol.LangDart
case ".dockerfile":
return protocol.LangDockerfile
case ".ex", ".exs":
return protocol.LangElixir
case ".erl", ".hrl":
return protocol.LangErlang
case ".fs", ".fsi", ".fsx", ".fsscript":
return protocol.LangFSharp
case ".gitcommit":
return protocol.LangGitCommit
case ".gitrebase":
return protocol.LangGitRebase
case ".go":
return protocol.LangGo
case ".groovy":
return protocol.LangGroovy
case ".hbs", ".handlebars":
return protocol.LangHandlebars
case ".hs":
return protocol.LangHaskell
case ".html", ".htm":
return protocol.LangHTML
case ".ini":
return protocol.LangIni
case ".java":
return protocol.LangJava
case ".js":
return protocol.LangJavaScript
case ".jsx":
return protocol.LangJavaScriptReact
case ".json":
return protocol.LangJSON
case ".tex", ".latex":
return protocol.LangLaTeX
case ".less":
return protocol.LangLess
case ".lua":
return protocol.LangLua
case ".makefile", "makefile":
return protocol.LangMakefile
case ".md", ".markdown":
return protocol.LangMarkdown
case ".m":
return protocol.LangObjectiveC
case ".mm":
return protocol.LangObjectiveCPP
case ".pl":
return protocol.LangPerl
case ".pm":
return protocol.LangPerl6
case ".php":
return protocol.LangPHP
case ".ps1", ".psm1":
return protocol.LangPowershell
case ".pug", ".jade":
return protocol.LangPug
case ".py":
return protocol.LangPython
case ".r":
return protocol.LangR
case ".cshtml", ".razor":
return protocol.LangRazor
case ".rb":
return protocol.LangRuby
case ".rs":
return protocol.LangRust
case ".scss":
return protocol.LangSCSS
case ".sass":
return protocol.LangSASS
case ".scala":
return protocol.LangScala
case ".shader":
return protocol.LangShaderLab
case ".sh", ".bash", ".zsh", ".ksh":
return protocol.LangShellScript
case ".sql":
return protocol.LangSQL
case ".swift":
return protocol.LangSwift
case ".ts":
return protocol.LangTypeScript
case ".tsx":
return protocol.LangTypeScriptReact
case ".xml":
return protocol.LangXML
case ".xsl":
return protocol.LangXSL
case ".yaml", ".yml":
return protocol.LangYAML
default:
return protocol.LanguageKind("") // Unknown language
}
}
+554
View File
@@ -0,0 +1,554 @@
// Generated code. Do not edit
package lsp
import (
"context"
"github.com/kujtimiihoxha/opencode/internal/lsp/protocol"
)
// Implementation sends a textDocument/implementation request to the LSP server.
// A request to resolve the implementation locations of a symbol at a given text document position. The request's parameter is of type TextDocumentPositionParams the response is of type Definition or a Thenable that resolves to such.
func (c *Client) Implementation(ctx context.Context, params protocol.ImplementationParams) (protocol.Or_Result_textDocument_implementation, error) {
var result protocol.Or_Result_textDocument_implementation
err := c.Call(ctx, "textDocument/implementation", params, &result)
return result, err
}
// TypeDefinition sends a textDocument/typeDefinition request to the LSP server.
// A request to resolve the type definition locations of a symbol at a given text document position. The request's parameter is of type TextDocumentPositionParams the response is of type Definition or a Thenable that resolves to such.
func (c *Client) TypeDefinition(ctx context.Context, params protocol.TypeDefinitionParams) (protocol.Or_Result_textDocument_typeDefinition, error) {
var result protocol.Or_Result_textDocument_typeDefinition
err := c.Call(ctx, "textDocument/typeDefinition", params, &result)
return result, err
}
// DocumentColor sends a textDocument/documentColor request to the LSP server.
// A request to list all color symbols found in a given text document. The request's parameter is of type DocumentColorParams the response is of type ColorInformation ColorInformation[] or a Thenable that resolves to such.
func (c *Client) DocumentColor(ctx context.Context, params protocol.DocumentColorParams) ([]protocol.ColorInformation, error) {
var result []protocol.ColorInformation
err := c.Call(ctx, "textDocument/documentColor", params, &result)
return result, err
}
// ColorPresentation sends a textDocument/colorPresentation request to the LSP server.
// A request to list all presentation for a color. The request's parameter is of type ColorPresentationParams the response is of type ColorInformation ColorInformation[] or a Thenable that resolves to such.
func (c *Client) ColorPresentation(ctx context.Context, params protocol.ColorPresentationParams) ([]protocol.ColorPresentation, error) {
var result []protocol.ColorPresentation
err := c.Call(ctx, "textDocument/colorPresentation", params, &result)
return result, err
}
// FoldingRange sends a textDocument/foldingRange request to the LSP server.
// A request to provide folding ranges in a document. The request's parameter is of type FoldingRangeParams, the response is of type FoldingRangeList or a Thenable that resolves to such.
func (c *Client) FoldingRange(ctx context.Context, params protocol.FoldingRangeParams) ([]protocol.FoldingRange, error) {
var result []protocol.FoldingRange
err := c.Call(ctx, "textDocument/foldingRange", params, &result)
return result, err
}
// Declaration sends a textDocument/declaration request to the LSP server.
// A request to resolve the type definition locations of a symbol at a given text document position. The request's parameter is of type TextDocumentPositionParams the response is of type Declaration or a typed array of DeclarationLink or a Thenable that resolves to such.
func (c *Client) Declaration(ctx context.Context, params protocol.DeclarationParams) (protocol.Or_Result_textDocument_declaration, error) {
var result protocol.Or_Result_textDocument_declaration
err := c.Call(ctx, "textDocument/declaration", params, &result)
return result, err
}
// SelectionRange sends a textDocument/selectionRange request to the LSP server.
// A request to provide selection ranges in a document. The request's parameter is of type SelectionRangeParams, the response is of type SelectionRange SelectionRange[] or a Thenable that resolves to such.
func (c *Client) SelectionRange(ctx context.Context, params protocol.SelectionRangeParams) ([]protocol.SelectionRange, error) {
var result []protocol.SelectionRange
err := c.Call(ctx, "textDocument/selectionRange", params, &result)
return result, err
}
// PrepareCallHierarchy sends a textDocument/prepareCallHierarchy request to the LSP server.
// A request to result a CallHierarchyItem in a document at a given position. Can be used as an input to an incoming or outgoing call hierarchy. Since 3.16.0
func (c *Client) PrepareCallHierarchy(ctx context.Context, params protocol.CallHierarchyPrepareParams) ([]protocol.CallHierarchyItem, error) {
var result []protocol.CallHierarchyItem
err := c.Call(ctx, "textDocument/prepareCallHierarchy", params, &result)
return result, err
}
// IncomingCalls sends a callHierarchy/incomingCalls request to the LSP server.
// A request to resolve the incoming calls for a given CallHierarchyItem. Since 3.16.0
func (c *Client) IncomingCalls(ctx context.Context, params protocol.CallHierarchyIncomingCallsParams) ([]protocol.CallHierarchyIncomingCall, error) {
var result []protocol.CallHierarchyIncomingCall
err := c.Call(ctx, "callHierarchy/incomingCalls", params, &result)
return result, err
}
// OutgoingCalls sends a callHierarchy/outgoingCalls request to the LSP server.
// A request to resolve the outgoing calls for a given CallHierarchyItem. Since 3.16.0
func (c *Client) OutgoingCalls(ctx context.Context, params protocol.CallHierarchyOutgoingCallsParams) ([]protocol.CallHierarchyOutgoingCall, error) {
var result []protocol.CallHierarchyOutgoingCall
err := c.Call(ctx, "callHierarchy/outgoingCalls", params, &result)
return result, err
}
// SemanticTokensFull sends a textDocument/semanticTokens/full request to the LSP server.
// Since 3.16.0
func (c *Client) SemanticTokensFull(ctx context.Context, params protocol.SemanticTokensParams) (protocol.SemanticTokens, error) {
var result protocol.SemanticTokens
err := c.Call(ctx, "textDocument/semanticTokens/full", params, &result)
return result, err
}
// SemanticTokensFullDelta sends a textDocument/semanticTokens/full/delta request to the LSP server.
// Since 3.16.0
func (c *Client) SemanticTokensFullDelta(ctx context.Context, params protocol.SemanticTokensDeltaParams) (protocol.Or_Result_textDocument_semanticTokens_full_delta, error) {
var result protocol.Or_Result_textDocument_semanticTokens_full_delta
err := c.Call(ctx, "textDocument/semanticTokens/full/delta", params, &result)
return result, err
}
// SemanticTokensRange sends a textDocument/semanticTokens/range request to the LSP server.
// Since 3.16.0
func (c *Client) SemanticTokensRange(ctx context.Context, params protocol.SemanticTokensRangeParams) (protocol.SemanticTokens, error) {
var result protocol.SemanticTokens
err := c.Call(ctx, "textDocument/semanticTokens/range", params, &result)
return result, err
}
// LinkedEditingRange sends a textDocument/linkedEditingRange request to the LSP server.
// A request to provide ranges that can be edited together. Since 3.16.0
func (c *Client) LinkedEditingRange(ctx context.Context, params protocol.LinkedEditingRangeParams) (protocol.LinkedEditingRanges, error) {
var result protocol.LinkedEditingRanges
err := c.Call(ctx, "textDocument/linkedEditingRange", params, &result)
return result, err
}
// WillCreateFiles sends a workspace/willCreateFiles request to the LSP server.
// The will create files request is sent from the client to the server before files are actually created as long as the creation is triggered from within the client. The request can return a WorkspaceEdit which will be applied to workspace before the files are created. Hence the WorkspaceEdit can not manipulate the content of the file to be created. Since 3.16.0
func (c *Client) WillCreateFiles(ctx context.Context, params protocol.CreateFilesParams) (protocol.WorkspaceEdit, error) {
var result protocol.WorkspaceEdit
err := c.Call(ctx, "workspace/willCreateFiles", params, &result)
return result, err
}
// WillRenameFiles sends a workspace/willRenameFiles request to the LSP server.
// The will rename files request is sent from the client to the server before files are actually renamed as long as the rename is triggered from within the client. Since 3.16.0
func (c *Client) WillRenameFiles(ctx context.Context, params protocol.RenameFilesParams) (protocol.WorkspaceEdit, error) {
var result protocol.WorkspaceEdit
err := c.Call(ctx, "workspace/willRenameFiles", params, &result)
return result, err
}
// WillDeleteFiles sends a workspace/willDeleteFiles request to the LSP server.
// The did delete files notification is sent from the client to the server when files were deleted from within the client. Since 3.16.0
func (c *Client) WillDeleteFiles(ctx context.Context, params protocol.DeleteFilesParams) (protocol.WorkspaceEdit, error) {
var result protocol.WorkspaceEdit
err := c.Call(ctx, "workspace/willDeleteFiles", params, &result)
return result, err
}
// Moniker sends a textDocument/moniker request to the LSP server.
// A request to get the moniker of a symbol at a given text document position. The request parameter is of type TextDocumentPositionParams. The response is of type Moniker Moniker[] or null.
func (c *Client) Moniker(ctx context.Context, params protocol.MonikerParams) ([]protocol.Moniker, error) {
var result []protocol.Moniker
err := c.Call(ctx, "textDocument/moniker", params, &result)
return result, err
}
// PrepareTypeHierarchy sends a textDocument/prepareTypeHierarchy request to the LSP server.
// A request to result a TypeHierarchyItem in a document at a given position. Can be used as an input to a subtypes or supertypes type hierarchy. Since 3.17.0
func (c *Client) PrepareTypeHierarchy(ctx context.Context, params protocol.TypeHierarchyPrepareParams) ([]protocol.TypeHierarchyItem, error) {
var result []protocol.TypeHierarchyItem
err := c.Call(ctx, "textDocument/prepareTypeHierarchy", params, &result)
return result, err
}
// Supertypes sends a typeHierarchy/supertypes request to the LSP server.
// A request to resolve the supertypes for a given TypeHierarchyItem. Since 3.17.0
func (c *Client) Supertypes(ctx context.Context, params protocol.TypeHierarchySupertypesParams) ([]protocol.TypeHierarchyItem, error) {
var result []protocol.TypeHierarchyItem
err := c.Call(ctx, "typeHierarchy/supertypes", params, &result)
return result, err
}
// Subtypes sends a typeHierarchy/subtypes request to the LSP server.
// A request to resolve the subtypes for a given TypeHierarchyItem. Since 3.17.0
func (c *Client) Subtypes(ctx context.Context, params protocol.TypeHierarchySubtypesParams) ([]protocol.TypeHierarchyItem, error) {
var result []protocol.TypeHierarchyItem
err := c.Call(ctx, "typeHierarchy/subtypes", params, &result)
return result, err
}
// InlineValue sends a textDocument/inlineValue request to the LSP server.
// A request to provide inline values in a document. The request's parameter is of type InlineValueParams, the response is of type InlineValue InlineValue[] or a Thenable that resolves to such. Since 3.17.0
func (c *Client) InlineValue(ctx context.Context, params protocol.InlineValueParams) ([]protocol.InlineValue, error) {
var result []protocol.InlineValue
err := c.Call(ctx, "textDocument/inlineValue", params, &result)
return result, err
}
// InlayHint sends a textDocument/inlayHint request to the LSP server.
// A request to provide inlay hints in a document. The request's parameter is of type InlayHintsParams, the response is of type InlayHint InlayHint[] or a Thenable that resolves to such. Since 3.17.0
func (c *Client) InlayHint(ctx context.Context, params protocol.InlayHintParams) ([]protocol.InlayHint, error) {
var result []protocol.InlayHint
err := c.Call(ctx, "textDocument/inlayHint", params, &result)
return result, err
}
// Resolve sends a inlayHint/resolve request to the LSP server.
// A request to resolve additional properties for an inlay hint. The request's parameter is of type InlayHint, the response is of type InlayHint or a Thenable that resolves to such. Since 3.17.0
func (c *Client) Resolve(ctx context.Context, params protocol.InlayHint) (protocol.InlayHint, error) {
var result protocol.InlayHint
err := c.Call(ctx, "inlayHint/resolve", params, &result)
return result, err
}
// Diagnostic sends a textDocument/diagnostic request to the LSP server.
// The document diagnostic request definition. Since 3.17.0
func (c *Client) Diagnostic(ctx context.Context, params protocol.DocumentDiagnosticParams) (protocol.DocumentDiagnosticReport, error) {
var result protocol.DocumentDiagnosticReport
err := c.Call(ctx, "textDocument/diagnostic", params, &result)
return result, err
}
// DiagnosticWorkspace sends a workspace/diagnostic request to the LSP server.
// The workspace diagnostic request definition. Since 3.17.0
func (c *Client) DiagnosticWorkspace(ctx context.Context, params protocol.WorkspaceDiagnosticParams) (protocol.WorkspaceDiagnosticReport, error) {
var result protocol.WorkspaceDiagnosticReport
err := c.Call(ctx, "workspace/diagnostic", params, &result)
return result, err
}
// InlineCompletion sends a textDocument/inlineCompletion request to the LSP server.
// A request to provide inline completions in a document. The request's parameter is of type InlineCompletionParams, the response is of type InlineCompletion InlineCompletion[] or a Thenable that resolves to such. Since 3.18.0 PROPOSED
func (c *Client) InlineCompletion(ctx context.Context, params protocol.InlineCompletionParams) (protocol.Or_Result_textDocument_inlineCompletion, error) {
var result protocol.Or_Result_textDocument_inlineCompletion
err := c.Call(ctx, "textDocument/inlineCompletion", params, &result)
return result, err
}
// TextDocumentContent sends a workspace/textDocumentContent request to the LSP server.
// The workspace/textDocumentContent request is sent from the client to the server to request the content of a text document. Since 3.18.0 PROPOSED
func (c *Client) TextDocumentContent(ctx context.Context, params protocol.TextDocumentContentParams) (string, error) {
var result string
err := c.Call(ctx, "workspace/textDocumentContent", params, &result)
return result, err
}
// Initialize sends a initialize request to the LSP server.
// The initialize request is sent from the client to the server. It is sent once as the request after starting up the server. The requests parameter is of type InitializeParams the response if of type InitializeResult of a Thenable that resolves to such.
func (c *Client) Initialize(ctx context.Context, params protocol.ParamInitialize) (protocol.InitializeResult, error) {
var result protocol.InitializeResult
err := c.Call(ctx, "initialize", params, &result)
return result, err
}
// Shutdown sends a shutdown request to the LSP server.
// A shutdown request is sent from the client to the server. It is sent once when the client decides to shutdown the server. The only notification that is sent after a shutdown request is the exit event.
func (c *Client) Shutdown(ctx context.Context) error {
return c.Call(ctx, "shutdown", nil, nil)
}
// WillSaveWaitUntil sends a textDocument/willSaveWaitUntil request to the LSP server.
// A document will save request is sent from the client to the server before the document is actually saved. The request can return an array of TextEdits which will be applied to the text document before it is saved. Please note that clients might drop results if computing the text edits took too long or if a server constantly fails on this request. This is done to keep the save fast and reliable.
func (c *Client) WillSaveWaitUntil(ctx context.Context, params protocol.WillSaveTextDocumentParams) ([]protocol.TextEdit, error) {
var result []protocol.TextEdit
err := c.Call(ctx, "textDocument/willSaveWaitUntil", params, &result)
return result, err
}
// Completion sends a textDocument/completion request to the LSP server.
// Request to request completion at a given text document position. The request's parameter is of type TextDocumentPosition the response is of type CompletionItem CompletionItem[] or CompletionList or a Thenable that resolves to such. The request can delay the computation of the CompletionItem.detail detail and CompletionItem.documentation documentation properties to the completionItem/resolve request. However, properties that are needed for the initial sorting and filtering, like sortText, filterText, insertText, and textEdit, must not be changed during resolve.
func (c *Client) Completion(ctx context.Context, params protocol.CompletionParams) (protocol.Or_Result_textDocument_completion, error) {
var result protocol.Or_Result_textDocument_completion
err := c.Call(ctx, "textDocument/completion", params, &result)
return result, err
}
// ResolveCompletionItem sends a completionItem/resolve request to the LSP server.
// Request to resolve additional information for a given completion item.The request's parameter is of type CompletionItem the response is of type CompletionItem or a Thenable that resolves to such.
func (c *Client) ResolveCompletionItem(ctx context.Context, params protocol.CompletionItem) (protocol.CompletionItem, error) {
var result protocol.CompletionItem
err := c.Call(ctx, "completionItem/resolve", params, &result)
return result, err
}
// Hover sends a textDocument/hover request to the LSP server.
// Request to request hover information at a given text document position. The request's parameter is of type TextDocumentPosition the response is of type Hover or a Thenable that resolves to such.
func (c *Client) Hover(ctx context.Context, params protocol.HoverParams) (protocol.Hover, error) {
var result protocol.Hover
err := c.Call(ctx, "textDocument/hover", params, &result)
return result, err
}
// SignatureHelp sends a textDocument/signatureHelp request to the LSP server.
func (c *Client) SignatureHelp(ctx context.Context, params protocol.SignatureHelpParams) (protocol.SignatureHelp, error) {
var result protocol.SignatureHelp
err := c.Call(ctx, "textDocument/signatureHelp", params, &result)
return result, err
}
// Definition sends a textDocument/definition request to the LSP server.
// A request to resolve the definition location of a symbol at a given text document position. The request's parameter is of type TextDocumentPosition the response is of either type Definition or a typed array of DefinitionLink or a Thenable that resolves to such.
func (c *Client) Definition(ctx context.Context, params protocol.DefinitionParams) (protocol.Or_Result_textDocument_definition, error) {
var result protocol.Or_Result_textDocument_definition
err := c.Call(ctx, "textDocument/definition", params, &result)
return result, err
}
// References sends a textDocument/references request to the LSP server.
// A request to resolve project-wide references for the symbol denoted by the given text document position. The request's parameter is of type ReferenceParams the response is of type Location Location[] or a Thenable that resolves to such.
func (c *Client) References(ctx context.Context, params protocol.ReferenceParams) ([]protocol.Location, error) {
var result []protocol.Location
err := c.Call(ctx, "textDocument/references", params, &result)
return result, err
}
// DocumentHighlight sends a textDocument/documentHighlight request to the LSP server.
// Request to resolve a DocumentHighlight for a given text document position. The request's parameter is of type TextDocumentPosition the request response is an array of type DocumentHighlight or a Thenable that resolves to such.
func (c *Client) DocumentHighlight(ctx context.Context, params protocol.DocumentHighlightParams) ([]protocol.DocumentHighlight, error) {
var result []protocol.DocumentHighlight
err := c.Call(ctx, "textDocument/documentHighlight", params, &result)
return result, err
}
// DocumentSymbol sends a textDocument/documentSymbol request to the LSP server.
// A request to list all symbols found in a given text document. The request's parameter is of type TextDocumentIdentifier the response is of type SymbolInformation SymbolInformation[] or a Thenable that resolves to such.
func (c *Client) DocumentSymbol(ctx context.Context, params protocol.DocumentSymbolParams) (protocol.Or_Result_textDocument_documentSymbol, error) {
var result protocol.Or_Result_textDocument_documentSymbol
err := c.Call(ctx, "textDocument/documentSymbol", params, &result)
return result, err
}
// CodeAction sends a textDocument/codeAction request to the LSP server.
// A request to provide commands for the given text document and range.
func (c *Client) CodeAction(ctx context.Context, params protocol.CodeActionParams) ([]protocol.Or_Result_textDocument_codeAction_Item0_Elem, error) {
var result []protocol.Or_Result_textDocument_codeAction_Item0_Elem
err := c.Call(ctx, "textDocument/codeAction", params, &result)
return result, err
}
// ResolveCodeAction sends a codeAction/resolve request to the LSP server.
// Request to resolve additional information for a given code action.The request's parameter is of type CodeAction the response is of type CodeAction or a Thenable that resolves to such.
func (c *Client) ResolveCodeAction(ctx context.Context, params protocol.CodeAction) (protocol.CodeAction, error) {
var result protocol.CodeAction
err := c.Call(ctx, "codeAction/resolve", params, &result)
return result, err
}
// Symbol sends a workspace/symbol request to the LSP server.
// A request to list project-wide symbols matching the query string given by the WorkspaceSymbolParams. The response is of type SymbolInformation SymbolInformation[] or a Thenable that resolves to such. Since 3.17.0 - support for WorkspaceSymbol in the returned data. Clients need to advertise support for WorkspaceSymbols via the client capability workspace.symbol.resolveSupport.
func (c *Client) Symbol(ctx context.Context, params protocol.WorkspaceSymbolParams) (protocol.Or_Result_workspace_symbol, error) {
var result protocol.Or_Result_workspace_symbol
err := c.Call(ctx, "workspace/symbol", params, &result)
return result, err
}
// ResolveWorkspaceSymbol sends a workspaceSymbol/resolve request to the LSP server.
// A request to resolve the range inside the workspace symbol's location. Since 3.17.0
func (c *Client) ResolveWorkspaceSymbol(ctx context.Context, params protocol.WorkspaceSymbol) (protocol.WorkspaceSymbol, error) {
var result protocol.WorkspaceSymbol
err := c.Call(ctx, "workspaceSymbol/resolve", params, &result)
return result, err
}
// CodeLens sends a textDocument/codeLens request to the LSP server.
// A request to provide code lens for the given text document.
func (c *Client) CodeLens(ctx context.Context, params protocol.CodeLensParams) ([]protocol.CodeLens, error) {
var result []protocol.CodeLens
err := c.Call(ctx, "textDocument/codeLens", params, &result)
return result, err
}
// ResolveCodeLens sends a codeLens/resolve request to the LSP server.
// A request to resolve a command for a given code lens.
func (c *Client) ResolveCodeLens(ctx context.Context, params protocol.CodeLens) (protocol.CodeLens, error) {
var result protocol.CodeLens
err := c.Call(ctx, "codeLens/resolve", params, &result)
return result, err
}
// DocumentLink sends a textDocument/documentLink request to the LSP server.
// A request to provide document links
func (c *Client) DocumentLink(ctx context.Context, params protocol.DocumentLinkParams) ([]protocol.DocumentLink, error) {
var result []protocol.DocumentLink
err := c.Call(ctx, "textDocument/documentLink", params, &result)
return result, err
}
// ResolveDocumentLink sends a documentLink/resolve request to the LSP server.
// Request to resolve additional information for a given document link. The request's parameter is of type DocumentLink the response is of type DocumentLink or a Thenable that resolves to such.
func (c *Client) ResolveDocumentLink(ctx context.Context, params protocol.DocumentLink) (protocol.DocumentLink, error) {
var result protocol.DocumentLink
err := c.Call(ctx, "documentLink/resolve", params, &result)
return result, err
}
// Formatting sends a textDocument/formatting request to the LSP server.
// A request to format a whole document.
func (c *Client) Formatting(ctx context.Context, params protocol.DocumentFormattingParams) ([]protocol.TextEdit, error) {
var result []protocol.TextEdit
err := c.Call(ctx, "textDocument/formatting", params, &result)
return result, err
}
// RangeFormatting sends a textDocument/rangeFormatting request to the LSP server.
// A request to format a range in a document.
func (c *Client) RangeFormatting(ctx context.Context, params protocol.DocumentRangeFormattingParams) ([]protocol.TextEdit, error) {
var result []protocol.TextEdit
err := c.Call(ctx, "textDocument/rangeFormatting", params, &result)
return result, err
}
// RangesFormatting sends a textDocument/rangesFormatting request to the LSP server.
// A request to format ranges in a document. Since 3.18.0 PROPOSED
func (c *Client) RangesFormatting(ctx context.Context, params protocol.DocumentRangesFormattingParams) ([]protocol.TextEdit, error) {
var result []protocol.TextEdit
err := c.Call(ctx, "textDocument/rangesFormatting", params, &result)
return result, err
}
// OnTypeFormatting sends a textDocument/onTypeFormatting request to the LSP server.
// A request to format a document on type.
func (c *Client) OnTypeFormatting(ctx context.Context, params protocol.DocumentOnTypeFormattingParams) ([]protocol.TextEdit, error) {
var result []protocol.TextEdit
err := c.Call(ctx, "textDocument/onTypeFormatting", params, &result)
return result, err
}
// Rename sends a textDocument/rename request to the LSP server.
// A request to rename a symbol.
func (c *Client) Rename(ctx context.Context, params protocol.RenameParams) (protocol.WorkspaceEdit, error) {
var result protocol.WorkspaceEdit
err := c.Call(ctx, "textDocument/rename", params, &result)
return result, err
}
// PrepareRename sends a textDocument/prepareRename request to the LSP server.
// A request to test and perform the setup necessary for a rename. Since 3.16 - support for default behavior
func (c *Client) PrepareRename(ctx context.Context, params protocol.PrepareRenameParams) (protocol.PrepareRenameResult, error) {
var result protocol.PrepareRenameResult
err := c.Call(ctx, "textDocument/prepareRename", params, &result)
return result, err
}
// ExecuteCommand sends a workspace/executeCommand request to the LSP server.
// A request send from the client to the server to execute a command. The request might return a workspace edit which the client will apply to the workspace.
func (c *Client) ExecuteCommand(ctx context.Context, params protocol.ExecuteCommandParams) (any, error) {
var result any
err := c.Call(ctx, "workspace/executeCommand", params, &result)
return result, err
}
// DidChangeWorkspaceFolders sends a workspace/didChangeWorkspaceFolders notification to the LSP server.
// The workspace/didChangeWorkspaceFolders notification is sent from the client to the server when the workspace folder configuration changes.
func (c *Client) DidChangeWorkspaceFolders(ctx context.Context, params protocol.DidChangeWorkspaceFoldersParams) error {
return c.Notify(ctx, "workspace/didChangeWorkspaceFolders", params)
}
// WorkDoneProgressCancel sends a window/workDoneProgress/cancel notification to the LSP server.
// The window/workDoneProgress/cancel notification is sent from the client to the server to cancel a progress initiated on the server side.
func (c *Client) WorkDoneProgressCancel(ctx context.Context, params protocol.WorkDoneProgressCancelParams) error {
return c.Notify(ctx, "window/workDoneProgress/cancel", params)
}
// DidCreateFiles sends a workspace/didCreateFiles notification to the LSP server.
// The did create files notification is sent from the client to the server when files were created from within the client. Since 3.16.0
func (c *Client) DidCreateFiles(ctx context.Context, params protocol.CreateFilesParams) error {
return c.Notify(ctx, "workspace/didCreateFiles", params)
}
// DidRenameFiles sends a workspace/didRenameFiles notification to the LSP server.
// The did rename files notification is sent from the client to the server when files were renamed from within the client. Since 3.16.0
func (c *Client) DidRenameFiles(ctx context.Context, params protocol.RenameFilesParams) error {
return c.Notify(ctx, "workspace/didRenameFiles", params)
}
// DidDeleteFiles sends a workspace/didDeleteFiles notification to the LSP server.
// The will delete files request is sent from the client to the server before files are actually deleted as long as the deletion is triggered from within the client. Since 3.16.0
func (c *Client) DidDeleteFiles(ctx context.Context, params protocol.DeleteFilesParams) error {
return c.Notify(ctx, "workspace/didDeleteFiles", params)
}
// DidOpenNotebookDocument sends a notebookDocument/didOpen notification to the LSP server.
// A notification sent when a notebook opens. Since 3.17.0
func (c *Client) DidOpenNotebookDocument(ctx context.Context, params protocol.DidOpenNotebookDocumentParams) error {
return c.Notify(ctx, "notebookDocument/didOpen", params)
}
// DidChangeNotebookDocument sends a notebookDocument/didChange notification to the LSP server.
func (c *Client) DidChangeNotebookDocument(ctx context.Context, params protocol.DidChangeNotebookDocumentParams) error {
return c.Notify(ctx, "notebookDocument/didChange", params)
}
// DidSaveNotebookDocument sends a notebookDocument/didSave notification to the LSP server.
// A notification sent when a notebook document is saved. Since 3.17.0
func (c *Client) DidSaveNotebookDocument(ctx context.Context, params protocol.DidSaveNotebookDocumentParams) error {
return c.Notify(ctx, "notebookDocument/didSave", params)
}
// DidCloseNotebookDocument sends a notebookDocument/didClose notification to the LSP server.
// A notification sent when a notebook closes. Since 3.17.0
func (c *Client) DidCloseNotebookDocument(ctx context.Context, params protocol.DidCloseNotebookDocumentParams) error {
return c.Notify(ctx, "notebookDocument/didClose", params)
}
// Initialized sends a initialized notification to the LSP server.
// The initialized notification is sent from the client to the server after the client is fully initialized and the server is allowed to send requests from the server to the client.
func (c *Client) Initialized(ctx context.Context, params protocol.InitializedParams) error {
return c.Notify(ctx, "initialized", params)
}
// Exit sends a exit notification to the LSP server.
// The exit event is sent from the client to the server to ask the server to exit its process.
func (c *Client) Exit(ctx context.Context) error {
return c.Notify(ctx, "exit", nil)
}
// DidChangeConfiguration sends a workspace/didChangeConfiguration notification to the LSP server.
// The configuration change notification is sent from the client to the server when the client's configuration has changed. The notification contains the changed configuration as defined by the language client.
func (c *Client) DidChangeConfiguration(ctx context.Context, params protocol.DidChangeConfigurationParams) error {
return c.Notify(ctx, "workspace/didChangeConfiguration", params)
}
// DidOpen sends a textDocument/didOpen notification to the LSP server.
// The document open notification is sent from the client to the server to signal newly opened text documents. The document's truth is now managed by the client and the server must not try to read the document's truth using the document's uri. Open in this sense means it is managed by the client. It doesn't necessarily mean that its content is presented in an editor. An open notification must not be sent more than once without a corresponding close notification send before. This means open and close notification must be balanced and the max open count is one.
func (c *Client) DidOpen(ctx context.Context, params protocol.DidOpenTextDocumentParams) error {
return c.Notify(ctx, "textDocument/didOpen", params)
}
// DidChange sends a textDocument/didChange notification to the LSP server.
// The document change notification is sent from the client to the server to signal changes to a text document.
func (c *Client) DidChange(ctx context.Context, params protocol.DidChangeTextDocumentParams) error {
return c.Notify(ctx, "textDocument/didChange", params)
}
// DidClose sends a textDocument/didClose notification to the LSP server.
// The document close notification is sent from the client to the server when the document got closed in the client. The document's truth now exists where the document's uri points to (e.g. if the document's uri is a file uri the truth now exists on disk). As with the open notification the close notification is about managing the document's content. Receiving a close notification doesn't mean that the document was open in an editor before. A close notification requires a previous open notification to be sent.
func (c *Client) DidClose(ctx context.Context, params protocol.DidCloseTextDocumentParams) error {
return c.Notify(ctx, "textDocument/didClose", params)
}
// DidSave sends a textDocument/didSave notification to the LSP server.
// The document save notification is sent from the client to the server when the document got saved in the client.
func (c *Client) DidSave(ctx context.Context, params protocol.DidSaveTextDocumentParams) error {
return c.Notify(ctx, "textDocument/didSave", params)
}
// WillSave sends a textDocument/willSave notification to the LSP server.
// A document will save notification is sent from the client to the server before the document is actually saved.
func (c *Client) WillSave(ctx context.Context, params protocol.WillSaveTextDocumentParams) error {
return c.Notify(ctx, "textDocument/willSave", params)
}
// DidChangeWatchedFiles sends a workspace/didChangeWatchedFiles notification to the LSP server.
// The watched files notification is sent from the client to the server when the client detects changes to file watched by the language client.
func (c *Client) DidChangeWatchedFiles(ctx context.Context, params protocol.DidChangeWatchedFilesParams) error {
return c.Notify(ctx, "workspace/didChangeWatchedFiles", params)
}
// SetTrace sends a $/setTrace notification to the LSP server.
func (c *Client) SetTrace(ctx context.Context, params protocol.SetTraceParams) error {
return c.Notify(ctx, "$/setTrace", params)
}
// Progress sends a $/progress notification to the LSP server.
func (c *Client) Progress(ctx context.Context, params protocol.ProgressParams) error {
return c.Notify(ctx, "$/progress", params)
}
+48
View File
@@ -0,0 +1,48 @@
package lsp
import (
"encoding/json"
)
// Message represents a JSON-RPC 2.0 message
type Message struct {
JSONRPC string `json:"jsonrpc"`
ID int32 `json:"id,omitempty"`
Method string `json:"method,omitempty"`
Params json.RawMessage `json:"params,omitempty"`
Result json.RawMessage `json:"result,omitempty"`
Error *ResponseError `json:"error,omitempty"`
}
// ResponseError represents a JSON-RPC 2.0 error
type ResponseError struct {
Code int `json:"code"`
Message string `json:"message"`
}
func NewRequest(id int32, method string, params any) (*Message, error) {
paramsJSON, err := json.Marshal(params)
if err != nil {
return nil, err
}
return &Message{
JSONRPC: "2.0",
ID: id,
Method: method,
Params: paramsJSON,
}, nil
}
func NewNotification(method string, params any) (*Message, error) {
paramsJSON, err := json.Marshal(params)
if err != nil {
return nil, err
}
return &Message{
JSONRPC: "2.0",
Method: method,
Params: paramsJSON,
}, nil
}
+27
View File
@@ -0,0 +1,27 @@
Copyright 2009 The Go Authors.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above
copyright notice, this list of conditions and the following disclaimer
in the documentation and/or other materials provided with the
distribution.
* Neither the name of Google LLC nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+117
View File
@@ -0,0 +1,117 @@
package protocol
import "fmt"
// TextEditResult is an interface for types that represent workspace symbols
type WorkspaceSymbolResult interface {
GetName() string
GetLocation() Location
isWorkspaceSymbol() // marker method
}
func (ws *WorkspaceSymbol) GetName() string { return ws.Name }
func (ws *WorkspaceSymbol) GetLocation() Location {
switch v := ws.Location.Value.(type) {
case Location:
return v
case LocationUriOnly:
return Location{URI: v.URI}
}
return Location{}
}
func (ws *WorkspaceSymbol) isWorkspaceSymbol() {}
func (si *SymbolInformation) GetName() string { return si.Name }
func (si *SymbolInformation) GetLocation() Location { return si.Location }
func (si *SymbolInformation) isWorkspaceSymbol() {}
// Results converts the Value to a slice of WorkspaceSymbolResult
func (r Or_Result_workspace_symbol) Results() ([]WorkspaceSymbolResult, error) {
if r.Value == nil {
return make([]WorkspaceSymbolResult, 0), nil
}
switch v := r.Value.(type) {
case []WorkspaceSymbol:
results := make([]WorkspaceSymbolResult, len(v))
for i := range v {
results[i] = &v[i]
}
return results, nil
case []SymbolInformation:
results := make([]WorkspaceSymbolResult, len(v))
for i := range v {
results[i] = &v[i]
}
return results, nil
default:
return nil, fmt.Errorf("unknown symbol type: %T", r.Value)
}
}
// TextEditResult is an interface for types that represent document symbols
type DocumentSymbolResult interface {
GetRange() Range
GetName() string
isDocumentSymbol() // marker method
}
func (ds *DocumentSymbol) GetRange() Range { return ds.Range }
func (ds *DocumentSymbol) GetName() string { return ds.Name }
func (ds *DocumentSymbol) isDocumentSymbol() {}
func (si *SymbolInformation) GetRange() Range { return si.Location.Range }
// Note: SymbolInformation already has GetName() implemented above
func (si *SymbolInformation) isDocumentSymbol() {}
// Results converts the Value to a slice of DocumentSymbolResult
func (r Or_Result_textDocument_documentSymbol) Results() ([]DocumentSymbolResult, error) {
if r.Value == nil {
return make([]DocumentSymbolResult, 0), nil
}
switch v := r.Value.(type) {
case []DocumentSymbol:
results := make([]DocumentSymbolResult, len(v))
for i := range v {
results[i] = &v[i]
}
return results, nil
case []SymbolInformation:
results := make([]DocumentSymbolResult, len(v))
for i := range v {
results[i] = &v[i]
}
return results, nil
default:
return nil, fmt.Errorf("unknown document symbol type: %T", v)
}
}
// TextEditResult is an interface for types that can be used as text edits
type TextEditResult interface {
GetRange() Range
GetNewText() string
isTextEdit() // marker method
}
func (te *TextEdit) GetRange() Range { return te.Range }
func (te *TextEdit) GetNewText() string { return te.NewText }
func (te *TextEdit) isTextEdit() {}
// Convert Or_TextDocumentEdit_edits_Elem to TextEdit
func (e Or_TextDocumentEdit_edits_Elem) AsTextEdit() (TextEdit, error) {
if e.Value == nil {
return TextEdit{}, fmt.Errorf("nil text edit")
}
switch v := e.Value.(type) {
case TextEdit:
return v, nil
case AnnotatedTextEdit:
return TextEdit{
Range: v.Range,
NewText: v.NewText,
}, nil
default:
return TextEdit{}, fmt.Errorf("unknown text edit type: %T", e.Value)
}
}
@@ -0,0 +1,58 @@
package protocol
import (
"fmt"
"strings"
)
// PatternInfo is an interface for types that represent glob patterns
type PatternInfo interface {
GetPattern() string
GetBasePath() string
isPattern() // marker method
}
// StringPattern implements PatternInfo for string patterns
type StringPattern struct {
Pattern string
}
func (p StringPattern) GetPattern() string { return p.Pattern }
func (p StringPattern) GetBasePath() string { return "" }
func (p StringPattern) isPattern() {}
// RelativePatternInfo implements PatternInfo for RelativePattern
type RelativePatternInfo struct {
RP RelativePattern
BasePath string
}
func (p RelativePatternInfo) GetPattern() string { return string(p.RP.Pattern) }
func (p RelativePatternInfo) GetBasePath() string { return p.BasePath }
func (p RelativePatternInfo) isPattern() {}
// AsPattern converts GlobPattern to a PatternInfo object
func (g *GlobPattern) AsPattern() (PatternInfo, error) {
if g.Value == nil {
return nil, fmt.Errorf("nil pattern")
}
switch v := g.Value.(type) {
case string:
return StringPattern{Pattern: v}, nil
case RelativePattern:
// Handle BaseURI which could be string or DocumentUri
basePath := ""
switch baseURI := v.BaseURI.Value.(type) {
case string:
basePath = strings.TrimPrefix(baseURI, "file://")
case DocumentUri:
basePath = strings.TrimPrefix(string(baseURI), "file://")
default:
return nil, fmt.Errorf("unknown BaseURI type: %T", v.BaseURI.Value)
}
return RelativePatternInfo{RP: v, BasePath: basePath}, nil
default:
return nil, fmt.Errorf("unknown pattern type: %T", g.Value)
}
}
+30
View File
@@ -0,0 +1,30 @@
package protocol
var TableKindMap = map[SymbolKind]string{
File: "File",
Module: "Module",
Namespace: "Namespace",
Package: "Package",
Class: "Class",
Method: "Method",
Property: "Property",
Field: "Field",
Constructor: "Constructor",
Enum: "Enum",
Interface: "Interface",
Function: "Function",
Variable: "Variable",
Constant: "Constant",
String: "String",
Number: "Number",
Boolean: "Boolean",
Array: "Array",
Object: "Object",
Key: "Key",
Null: "Null",
EnumMember: "EnumMember",
Struct: "Struct",
Event: "Event",
Operator: "Operator",
TypeParameter: "TypeParameter",
}
@@ -0,0 +1,81 @@
// Copyright 2022 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package protocol
import (
"encoding/json"
"fmt"
)
// DocumentChange is a union of various file edit operations.
//
// Exactly one field of this struct is non-nil; see [DocumentChange.Valid].
//
// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#resourceChanges
type DocumentChange struct {
TextDocumentEdit *TextDocumentEdit
CreateFile *CreateFile
RenameFile *RenameFile
DeleteFile *DeleteFile
}
// Valid reports whether the DocumentChange sum-type value is valid,
// that is, exactly one of create, delete, edit, or rename.
func (ch DocumentChange) Valid() bool {
n := 0
if ch.TextDocumentEdit != nil {
n++
}
if ch.CreateFile != nil {
n++
}
if ch.RenameFile != nil {
n++
}
if ch.DeleteFile != nil {
n++
}
return n == 1
}
func (d *DocumentChange) UnmarshalJSON(data []byte) error {
var m map[string]any
if err := json.Unmarshal(data, &m); err != nil {
return err
}
if _, ok := m["textDocument"]; ok {
d.TextDocumentEdit = new(TextDocumentEdit)
return json.Unmarshal(data, d.TextDocumentEdit)
}
// The {Create,Rename,Delete}File types all share a 'kind' field.
kind := m["kind"]
switch kind {
case "create":
d.CreateFile = new(CreateFile)
return json.Unmarshal(data, d.CreateFile)
case "rename":
d.RenameFile = new(RenameFile)
return json.Unmarshal(data, d.RenameFile)
case "delete":
d.DeleteFile = new(DeleteFile)
return json.Unmarshal(data, d.DeleteFile)
}
return fmt.Errorf("DocumentChanges: unexpected kind: %q", kind)
}
func (d *DocumentChange) MarshalJSON() ([]byte, error) {
if d.TextDocumentEdit != nil {
return json.Marshal(d.TextDocumentEdit)
} else if d.CreateFile != nil {
return json.Marshal(d.CreateFile)
} else if d.RenameFile != nil {
return json.Marshal(d.RenameFile)
} else if d.DeleteFile != nil {
return json.Marshal(d.DeleteFile)
}
return nil, fmt.Errorf("empty DocumentChanges union value")
}
+3072
View File
@@ -0,0 +1,3072 @@
// Copyright 2023 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// Code generated for LSP. DO NOT EDIT.
package protocol
// Code generated from protocol/metaModel.json at ref release/protocol/3.17.6-next.9 (hash c94395b5da53729e6dff931293b051009ccaaaa4).
// https://github.com/microsoft/vscode-languageserver-node/blob/release/protocol/3.17.6-next.9/protocol/metaModel.json
// LSP metaData.version = 3.17.0.
import "bytes"
import "encoding/json"
import "fmt"
// UnmarshalError indicates that a JSON value did not conform to
// one of the expected cases of an LSP union type.
type UnmarshalError struct {
msg string
}
func (e UnmarshalError) Error() string {
return e.msg
}
func (t Or_CancelParams_id) MarshalJSON() ([]byte, error) {
switch x := t.Value.(type) {
case int32:
return json.Marshal(x)
case string:
return json.Marshal(x)
case nil:
return []byte("null"), nil
}
return nil, fmt.Errorf("type %T not one of [int32 string]", t)
}
func (t *Or_CancelParams_id) UnmarshalJSON(x []byte) error {
if string(x) == "null" {
t.Value = nil
return nil
}
decoder41 := json.NewDecoder(bytes.NewReader(x))
decoder41.DisallowUnknownFields()
var int32Val int32
if err := decoder41.Decode(&int32Val); err == nil {
t.Value = int32Val
return nil
}
decoder42 := json.NewDecoder(bytes.NewReader(x))
decoder42.DisallowUnknownFields()
var stringVal string
if err := decoder42.Decode(&stringVal); err == nil {
t.Value = stringVal
return nil
}
return &UnmarshalError{"unmarshal failed to match one of [int32 string]"}
}
func (t Or_ClientSemanticTokensRequestOptions_full) MarshalJSON() ([]byte, error) {
switch x := t.Value.(type) {
case ClientSemanticTokensRequestFullDelta:
return json.Marshal(x)
case bool:
return json.Marshal(x)
case nil:
return []byte("null"), nil
}
return nil, fmt.Errorf("type %T not one of [ClientSemanticTokensRequestFullDelta bool]", t)
}
func (t *Or_ClientSemanticTokensRequestOptions_full) UnmarshalJSON(x []byte) error {
if string(x) == "null" {
t.Value = nil
return nil
}
decoder220 := json.NewDecoder(bytes.NewReader(x))
decoder220.DisallowUnknownFields()
var boolVal bool
if err := decoder220.Decode(&boolVal); err == nil {
t.Value = boolVal
return nil
}
decoder221 := json.NewDecoder(bytes.NewReader(x))
decoder221.DisallowUnknownFields()
var h221 ClientSemanticTokensRequestFullDelta
if err := decoder221.Decode(&h221); err == nil {
t.Value = h221
return nil
}
return &UnmarshalError{"unmarshal failed to match one of [ClientSemanticTokensRequestFullDelta bool]"}
}
func (t Or_ClientSemanticTokensRequestOptions_range) MarshalJSON() ([]byte, error) {
switch x := t.Value.(type) {
case Lit_ClientSemanticTokensRequestOptions_range_Item1:
return json.Marshal(x)
case bool:
return json.Marshal(x)
case nil:
return []byte("null"), nil
}
return nil, fmt.Errorf("type %T not one of [Lit_ClientSemanticTokensRequestOptions_range_Item1 bool]", t)
}
func (t *Or_ClientSemanticTokensRequestOptions_range) UnmarshalJSON(x []byte) error {
if string(x) == "null" {
t.Value = nil
return nil
}
decoder217 := json.NewDecoder(bytes.NewReader(x))
decoder217.DisallowUnknownFields()
var boolVal bool
if err := decoder217.Decode(&boolVal); err == nil {
t.Value = boolVal
return nil
}
decoder218 := json.NewDecoder(bytes.NewReader(x))
decoder218.DisallowUnknownFields()
var h218 Lit_ClientSemanticTokensRequestOptions_range_Item1
if err := decoder218.Decode(&h218); err == nil {
t.Value = h218
return nil
}
return &UnmarshalError{"unmarshal failed to match one of [Lit_ClientSemanticTokensRequestOptions_range_Item1 bool]"}
}
func (t Or_CompletionItemDefaults_editRange) MarshalJSON() ([]byte, error) {
switch x := t.Value.(type) {
case EditRangeWithInsertReplace:
return json.Marshal(x)
case Range:
return json.Marshal(x)
case nil:
return []byte("null"), nil
}
return nil, fmt.Errorf("type %T not one of [EditRangeWithInsertReplace Range]", t)
}
func (t *Or_CompletionItemDefaults_editRange) UnmarshalJSON(x []byte) error {
if string(x) == "null" {
t.Value = nil
return nil
}
decoder183 := json.NewDecoder(bytes.NewReader(x))
decoder183.DisallowUnknownFields()
var h183 EditRangeWithInsertReplace
if err := decoder183.Decode(&h183); err == nil {
t.Value = h183
return nil
}
decoder184 := json.NewDecoder(bytes.NewReader(x))
decoder184.DisallowUnknownFields()
var h184 Range
if err := decoder184.Decode(&h184); err == nil {
t.Value = h184
return nil
}
return &UnmarshalError{"unmarshal failed to match one of [EditRangeWithInsertReplace Range]"}
}
func (t Or_CompletionItem_documentation) MarshalJSON() ([]byte, error) {
switch x := t.Value.(type) {
case MarkupContent:
return json.Marshal(x)
case string:
return json.Marshal(x)
case nil:
return []byte("null"), nil
}
return nil, fmt.Errorf("type %T not one of [MarkupContent string]", t)
}
func (t *Or_CompletionItem_documentation) UnmarshalJSON(x []byte) error {
if string(x) == "null" {
t.Value = nil
return nil
}
decoder25 := json.NewDecoder(bytes.NewReader(x))
decoder25.DisallowUnknownFields()
var stringVal string
if err := decoder25.Decode(&stringVal); err == nil {
t.Value = stringVal
return nil
}
decoder26 := json.NewDecoder(bytes.NewReader(x))
decoder26.DisallowUnknownFields()
var h26 MarkupContent
if err := decoder26.Decode(&h26); err == nil {
t.Value = h26
return nil
}
return &UnmarshalError{"unmarshal failed to match one of [MarkupContent string]"}
}
func (t Or_CompletionItem_textEdit) MarshalJSON() ([]byte, error) {
switch x := t.Value.(type) {
case InsertReplaceEdit:
return json.Marshal(x)
case TextEdit:
return json.Marshal(x)
case nil:
return []byte("null"), nil
}
return nil, fmt.Errorf("type %T not one of [InsertReplaceEdit TextEdit]", t)
}
func (t *Or_CompletionItem_textEdit) UnmarshalJSON(x []byte) error {
if string(x) == "null" {
t.Value = nil
return nil
}
decoder29 := json.NewDecoder(bytes.NewReader(x))
decoder29.DisallowUnknownFields()
var h29 InsertReplaceEdit
if err := decoder29.Decode(&h29); err == nil {
t.Value = h29
return nil
}
decoder30 := json.NewDecoder(bytes.NewReader(x))
decoder30.DisallowUnknownFields()
var h30 TextEdit
if err := decoder30.Decode(&h30); err == nil {
t.Value = h30
return nil
}
return &UnmarshalError{"unmarshal failed to match one of [InsertReplaceEdit TextEdit]"}
}
func (t Or_Declaration) MarshalJSON() ([]byte, error) {
switch x := t.Value.(type) {
case Location:
return json.Marshal(x)
case []Location:
return json.Marshal(x)
case nil:
return []byte("null"), nil
}
return nil, fmt.Errorf("type %T not one of [Location []Location]", t)
}
func (t *Or_Declaration) UnmarshalJSON(x []byte) error {
if string(x) == "null" {
t.Value = nil
return nil
}
decoder237 := json.NewDecoder(bytes.NewReader(x))
decoder237.DisallowUnknownFields()
var h237 Location
if err := decoder237.Decode(&h237); err == nil {
t.Value = h237
return nil
}
decoder238 := json.NewDecoder(bytes.NewReader(x))
decoder238.DisallowUnknownFields()
var h238 []Location
if err := decoder238.Decode(&h238); err == nil {
t.Value = h238
return nil
}
return &UnmarshalError{"unmarshal failed to match one of [Location []Location]"}
}
func (t Or_Definition) MarshalJSON() ([]byte, error) {
switch x := t.Value.(type) {
case Location:
return json.Marshal(x)
case []Location:
return json.Marshal(x)
case nil:
return []byte("null"), nil
}
return nil, fmt.Errorf("type %T not one of [Location []Location]", t)
}
func (t *Or_Definition) UnmarshalJSON(x []byte) error {
if string(x) == "null" {
t.Value = nil
return nil
}
decoder224 := json.NewDecoder(bytes.NewReader(x))
decoder224.DisallowUnknownFields()
var h224 Location
if err := decoder224.Decode(&h224); err == nil {
t.Value = h224
return nil
}
decoder225 := json.NewDecoder(bytes.NewReader(x))
decoder225.DisallowUnknownFields()
var h225 []Location
if err := decoder225.Decode(&h225); err == nil {
t.Value = h225
return nil
}
return &UnmarshalError{"unmarshal failed to match one of [Location []Location]"}
}
func (t Or_Diagnostic_code) MarshalJSON() ([]byte, error) {
switch x := t.Value.(type) {
case int32:
return json.Marshal(x)
case string:
return json.Marshal(x)
case nil:
return []byte("null"), nil
}
return nil, fmt.Errorf("type %T not one of [int32 string]", t)
}
func (t *Or_Diagnostic_code) UnmarshalJSON(x []byte) error {
if string(x) == "null" {
t.Value = nil
return nil
}
decoder179 := json.NewDecoder(bytes.NewReader(x))
decoder179.DisallowUnknownFields()
var int32Val int32
if err := decoder179.Decode(&int32Val); err == nil {
t.Value = int32Val
return nil
}
decoder180 := json.NewDecoder(bytes.NewReader(x))
decoder180.DisallowUnknownFields()
var stringVal string
if err := decoder180.Decode(&stringVal); err == nil {
t.Value = stringVal
return nil
}
return &UnmarshalError{"unmarshal failed to match one of [int32 string]"}
}
func (t Or_DidChangeConfigurationRegistrationOptions_section) MarshalJSON() ([]byte, error) {
switch x := t.Value.(type) {
case []string:
return json.Marshal(x)
case string:
return json.Marshal(x)
case nil:
return []byte("null"), nil
}
return nil, fmt.Errorf("type %T not one of [[]string string]", t)
}
func (t *Or_DidChangeConfigurationRegistrationOptions_section) UnmarshalJSON(x []byte) error {
if string(x) == "null" {
t.Value = nil
return nil
}
decoder22 := json.NewDecoder(bytes.NewReader(x))
decoder22.DisallowUnknownFields()
var stringVal string
if err := decoder22.Decode(&stringVal); err == nil {
t.Value = stringVal
return nil
}
decoder23 := json.NewDecoder(bytes.NewReader(x))
decoder23.DisallowUnknownFields()
var h23 []string
if err := decoder23.Decode(&h23); err == nil {
t.Value = h23
return nil
}
return &UnmarshalError{"unmarshal failed to match one of [[]string string]"}
}
func (t Or_DocumentDiagnosticReport) MarshalJSON() ([]byte, error) {
switch x := t.Value.(type) {
case RelatedFullDocumentDiagnosticReport:
return json.Marshal(x)
case RelatedUnchangedDocumentDiagnosticReport:
return json.Marshal(x)
case nil:
return []byte("null"), nil
}
return nil, fmt.Errorf("type %T not one of [RelatedFullDocumentDiagnosticReport RelatedUnchangedDocumentDiagnosticReport]", t)
}
func (t *Or_DocumentDiagnosticReport) UnmarshalJSON(x []byte) error {
if string(x) == "null" {
t.Value = nil
return nil
}
decoder247 := json.NewDecoder(bytes.NewReader(x))
decoder247.DisallowUnknownFields()
var h247 RelatedFullDocumentDiagnosticReport
if err := decoder247.Decode(&h247); err == nil {
t.Value = h247
return nil
}
decoder248 := json.NewDecoder(bytes.NewReader(x))
decoder248.DisallowUnknownFields()
var h248 RelatedUnchangedDocumentDiagnosticReport
if err := decoder248.Decode(&h248); err == nil {
t.Value = h248
return nil
}
return &UnmarshalError{"unmarshal failed to match one of [RelatedFullDocumentDiagnosticReport RelatedUnchangedDocumentDiagnosticReport]"}
}
func (t Or_DocumentDiagnosticReportPartialResult_relatedDocuments_Value) MarshalJSON() ([]byte, error) {
switch x := t.Value.(type) {
case FullDocumentDiagnosticReport:
return json.Marshal(x)
case UnchangedDocumentDiagnosticReport:
return json.Marshal(x)
case nil:
return []byte("null"), nil
}
return nil, fmt.Errorf("type %T not one of [FullDocumentDiagnosticReport UnchangedDocumentDiagnosticReport]", t)
}
func (t *Or_DocumentDiagnosticReportPartialResult_relatedDocuments_Value) UnmarshalJSON(x []byte) error {
if string(x) == "null" {
t.Value = nil
return nil
}
decoder16 := json.NewDecoder(bytes.NewReader(x))
decoder16.DisallowUnknownFields()
var h16 FullDocumentDiagnosticReport
if err := decoder16.Decode(&h16); err == nil {
t.Value = h16
return nil
}
decoder17 := json.NewDecoder(bytes.NewReader(x))
decoder17.DisallowUnknownFields()
var h17 UnchangedDocumentDiagnosticReport
if err := decoder17.Decode(&h17); err == nil {
t.Value = h17
return nil
}
return &UnmarshalError{"unmarshal failed to match one of [FullDocumentDiagnosticReport UnchangedDocumentDiagnosticReport]"}
}
func (t Or_DocumentFilter) MarshalJSON() ([]byte, error) {
switch x := t.Value.(type) {
case NotebookCellTextDocumentFilter:
return json.Marshal(x)
case TextDocumentFilter:
return json.Marshal(x)
case nil:
return []byte("null"), nil
}
return nil, fmt.Errorf("type %T not one of [NotebookCellTextDocumentFilter TextDocumentFilter]", t)
}
func (t *Or_DocumentFilter) UnmarshalJSON(x []byte) error {
if string(x) == "null" {
t.Value = nil
return nil
}
decoder270 := json.NewDecoder(bytes.NewReader(x))
decoder270.DisallowUnknownFields()
var h270 NotebookCellTextDocumentFilter
if err := decoder270.Decode(&h270); err == nil {
t.Value = h270
return nil
}
decoder271 := json.NewDecoder(bytes.NewReader(x))
decoder271.DisallowUnknownFields()
var h271 TextDocumentFilter
if err := decoder271.Decode(&h271); err == nil {
t.Value = h271
return nil
}
return &UnmarshalError{"unmarshal failed to match one of [NotebookCellTextDocumentFilter TextDocumentFilter]"}
}
func (t Or_GlobPattern) MarshalJSON() ([]byte, error) {
switch x := t.Value.(type) {
case Pattern:
return json.Marshal(x)
case RelativePattern:
return json.Marshal(x)
case nil:
return []byte("null"), nil
}
return nil, fmt.Errorf("type %T not one of [Pattern RelativePattern]", t)
}
func (t *Or_GlobPattern) UnmarshalJSON(x []byte) error {
if string(x) == "null" {
t.Value = nil
return nil
}
decoder274 := json.NewDecoder(bytes.NewReader(x))
decoder274.DisallowUnknownFields()
var h274 Pattern
if err := decoder274.Decode(&h274); err == nil {
t.Value = h274
return nil
}
decoder275 := json.NewDecoder(bytes.NewReader(x))
decoder275.DisallowUnknownFields()
var h275 RelativePattern
if err := decoder275.Decode(&h275); err == nil {
t.Value = h275
return nil
}
return &UnmarshalError{"unmarshal failed to match one of [Pattern RelativePattern]"}
}
func (t Or_Hover_contents) MarshalJSON() ([]byte, error) {
switch x := t.Value.(type) {
case MarkedString:
return json.Marshal(x)
case MarkupContent:
return json.Marshal(x)
case []MarkedString:
return json.Marshal(x)
case nil:
return []byte("null"), nil
}
return nil, fmt.Errorf("type %T not one of [MarkedString MarkupContent []MarkedString]", t)
}
func (t *Or_Hover_contents) UnmarshalJSON(x []byte) error {
if string(x) == "null" {
t.Value = nil
return nil
}
decoder34 := json.NewDecoder(bytes.NewReader(x))
decoder34.DisallowUnknownFields()
var h34 MarkedString
if err := decoder34.Decode(&h34); err == nil {
t.Value = h34
return nil
}
decoder35 := json.NewDecoder(bytes.NewReader(x))
decoder35.DisallowUnknownFields()
var h35 MarkupContent
if err := decoder35.Decode(&h35); err == nil {
t.Value = h35
return nil
}
decoder36 := json.NewDecoder(bytes.NewReader(x))
decoder36.DisallowUnknownFields()
var h36 []MarkedString
if err := decoder36.Decode(&h36); err == nil {
t.Value = h36
return nil
}
return &UnmarshalError{"unmarshal failed to match one of [MarkedString MarkupContent []MarkedString]"}
}
func (t Or_InlayHintLabelPart_tooltip) MarshalJSON() ([]byte, error) {
switch x := t.Value.(type) {
case MarkupContent:
return json.Marshal(x)
case string:
return json.Marshal(x)
case nil:
return []byte("null"), nil
}
return nil, fmt.Errorf("type %T not one of [MarkupContent string]", t)
}
func (t *Or_InlayHintLabelPart_tooltip) UnmarshalJSON(x []byte) error {
if string(x) == "null" {
t.Value = nil
return nil
}
decoder56 := json.NewDecoder(bytes.NewReader(x))
decoder56.DisallowUnknownFields()
var stringVal string
if err := decoder56.Decode(&stringVal); err == nil {
t.Value = stringVal
return nil
}
decoder57 := json.NewDecoder(bytes.NewReader(x))
decoder57.DisallowUnknownFields()
var h57 MarkupContent
if err := decoder57.Decode(&h57); err == nil {
t.Value = h57
return nil
}
return &UnmarshalError{"unmarshal failed to match one of [MarkupContent string]"}
}
func (t Or_InlayHint_label) MarshalJSON() ([]byte, error) {
switch x := t.Value.(type) {
case []InlayHintLabelPart:
return json.Marshal(x)
case string:
return json.Marshal(x)
case nil:
return []byte("null"), nil
}
return nil, fmt.Errorf("type %T not one of [[]InlayHintLabelPart string]", t)
}
func (t *Or_InlayHint_label) UnmarshalJSON(x []byte) error {
if string(x) == "null" {
t.Value = nil
return nil
}
decoder9 := json.NewDecoder(bytes.NewReader(x))
decoder9.DisallowUnknownFields()
var stringVal string
if err := decoder9.Decode(&stringVal); err == nil {
t.Value = stringVal
return nil
}
decoder10 := json.NewDecoder(bytes.NewReader(x))
decoder10.DisallowUnknownFields()
var h10 []InlayHintLabelPart
if err := decoder10.Decode(&h10); err == nil {
t.Value = h10
return nil
}
return &UnmarshalError{"unmarshal failed to match one of [[]InlayHintLabelPart string]"}
}
func (t Or_InlayHint_tooltip) MarshalJSON() ([]byte, error) {
switch x := t.Value.(type) {
case MarkupContent:
return json.Marshal(x)
case string:
return json.Marshal(x)
case nil:
return []byte("null"), nil
}
return nil, fmt.Errorf("type %T not one of [MarkupContent string]", t)
}
func (t *Or_InlayHint_tooltip) UnmarshalJSON(x []byte) error {
if string(x) == "null" {
t.Value = nil
return nil
}
decoder12 := json.NewDecoder(bytes.NewReader(x))
decoder12.DisallowUnknownFields()
var stringVal string
if err := decoder12.Decode(&stringVal); err == nil {
t.Value = stringVal
return nil
}
decoder13 := json.NewDecoder(bytes.NewReader(x))
decoder13.DisallowUnknownFields()
var h13 MarkupContent
if err := decoder13.Decode(&h13); err == nil {
t.Value = h13
return nil
}
return &UnmarshalError{"unmarshal failed to match one of [MarkupContent string]"}
}
func (t Or_InlineCompletionItem_insertText) MarshalJSON() ([]byte, error) {
switch x := t.Value.(type) {
case StringValue:
return json.Marshal(x)
case string:
return json.Marshal(x)
case nil:
return []byte("null"), nil
}
return nil, fmt.Errorf("type %T not one of [StringValue string]", t)
}
func (t *Or_InlineCompletionItem_insertText) UnmarshalJSON(x []byte) error {
if string(x) == "null" {
t.Value = nil
return nil
}
decoder19 := json.NewDecoder(bytes.NewReader(x))
decoder19.DisallowUnknownFields()
var stringVal string
if err := decoder19.Decode(&stringVal); err == nil {
t.Value = stringVal
return nil
}
decoder20 := json.NewDecoder(bytes.NewReader(x))
decoder20.DisallowUnknownFields()
var h20 StringValue
if err := decoder20.Decode(&h20); err == nil {
t.Value = h20
return nil
}
return &UnmarshalError{"unmarshal failed to match one of [StringValue string]"}
}
func (t Or_InlineValue) MarshalJSON() ([]byte, error) {
switch x := t.Value.(type) {
case InlineValueEvaluatableExpression:
return json.Marshal(x)
case InlineValueText:
return json.Marshal(x)
case InlineValueVariableLookup:
return json.Marshal(x)
case nil:
return []byte("null"), nil
}
return nil, fmt.Errorf("type %T not one of [InlineValueEvaluatableExpression InlineValueText InlineValueVariableLookup]", t)
}
func (t *Or_InlineValue) UnmarshalJSON(x []byte) error {
if string(x) == "null" {
t.Value = nil
return nil
}
decoder242 := json.NewDecoder(bytes.NewReader(x))
decoder242.DisallowUnknownFields()
var h242 InlineValueEvaluatableExpression
if err := decoder242.Decode(&h242); err == nil {
t.Value = h242
return nil
}
decoder243 := json.NewDecoder(bytes.NewReader(x))
decoder243.DisallowUnknownFields()
var h243 InlineValueText
if err := decoder243.Decode(&h243); err == nil {
t.Value = h243
return nil
}
decoder244 := json.NewDecoder(bytes.NewReader(x))
decoder244.DisallowUnknownFields()
var h244 InlineValueVariableLookup
if err := decoder244.Decode(&h244); err == nil {
t.Value = h244
return nil
}
return &UnmarshalError{"unmarshal failed to match one of [InlineValueEvaluatableExpression InlineValueText InlineValueVariableLookup]"}
}
func (t Or_LSPAny) MarshalJSON() ([]byte, error) {
switch x := t.Value.(type) {
case LSPArray:
return json.Marshal(x)
case LSPObject:
return json.Marshal(x)
case bool:
return json.Marshal(x)
case float64:
return json.Marshal(x)
case int32:
return json.Marshal(x)
case string:
return json.Marshal(x)
case uint32:
return json.Marshal(x)
case nil:
return []byte("null"), nil
}
return nil, fmt.Errorf("type %T not one of [LSPArray LSPObject bool float64 int32 string uint32]", t)
}
func (t *Or_LSPAny) UnmarshalJSON(x []byte) error {
if string(x) == "null" {
t.Value = nil
return nil
}
decoder228 := json.NewDecoder(bytes.NewReader(x))
decoder228.DisallowUnknownFields()
var boolVal bool
if err := decoder228.Decode(&boolVal); err == nil {
t.Value = boolVal
return nil
}
decoder229 := json.NewDecoder(bytes.NewReader(x))
decoder229.DisallowUnknownFields()
var float64Val float64
if err := decoder229.Decode(&float64Val); err == nil {
t.Value = float64Val
return nil
}
decoder230 := json.NewDecoder(bytes.NewReader(x))
decoder230.DisallowUnknownFields()
var int32Val int32
if err := decoder230.Decode(&int32Val); err == nil {
t.Value = int32Val
return nil
}
decoder231 := json.NewDecoder(bytes.NewReader(x))
decoder231.DisallowUnknownFields()
var stringVal string
if err := decoder231.Decode(&stringVal); err == nil {
t.Value = stringVal
return nil
}
decoder232 := json.NewDecoder(bytes.NewReader(x))
decoder232.DisallowUnknownFields()
var uint32Val uint32
if err := decoder232.Decode(&uint32Val); err == nil {
t.Value = uint32Val
return nil
}
decoder233 := json.NewDecoder(bytes.NewReader(x))
decoder233.DisallowUnknownFields()
var h233 LSPArray
if err := decoder233.Decode(&h233); err == nil {
t.Value = h233
return nil
}
decoder234 := json.NewDecoder(bytes.NewReader(x))
decoder234.DisallowUnknownFields()
var h234 LSPObject
if err := decoder234.Decode(&h234); err == nil {
t.Value = h234
return nil
}
return &UnmarshalError{"unmarshal failed to match one of [LSPArray LSPObject bool float64 int32 string uint32]"}
}
func (t Or_MarkedString) MarshalJSON() ([]byte, error) {
switch x := t.Value.(type) {
case MarkedStringWithLanguage:
return json.Marshal(x)
case string:
return json.Marshal(x)
case nil:
return []byte("null"), nil
}
return nil, fmt.Errorf("type %T not one of [MarkedStringWithLanguage string]", t)
}
func (t *Or_MarkedString) UnmarshalJSON(x []byte) error {
if string(x) == "null" {
t.Value = nil
return nil
}
decoder266 := json.NewDecoder(bytes.NewReader(x))
decoder266.DisallowUnknownFields()
var stringVal string
if err := decoder266.Decode(&stringVal); err == nil {
t.Value = stringVal
return nil
}
decoder267 := json.NewDecoder(bytes.NewReader(x))
decoder267.DisallowUnknownFields()
var h267 MarkedStringWithLanguage
if err := decoder267.Decode(&h267); err == nil {
t.Value = h267
return nil
}
return &UnmarshalError{"unmarshal failed to match one of [MarkedStringWithLanguage string]"}
}
func (t Or_NotebookCellTextDocumentFilter_notebook) MarshalJSON() ([]byte, error) {
switch x := t.Value.(type) {
case NotebookDocumentFilter:
return json.Marshal(x)
case string:
return json.Marshal(x)
case nil:
return []byte("null"), nil
}
return nil, fmt.Errorf("type %T not one of [NotebookDocumentFilter string]", t)
}
func (t *Or_NotebookCellTextDocumentFilter_notebook) UnmarshalJSON(x []byte) error {
if string(x) == "null" {
t.Value = nil
return nil
}
decoder208 := json.NewDecoder(bytes.NewReader(x))
decoder208.DisallowUnknownFields()
var stringVal string
if err := decoder208.Decode(&stringVal); err == nil {
t.Value = stringVal
return nil
}
decoder209 := json.NewDecoder(bytes.NewReader(x))
decoder209.DisallowUnknownFields()
var h209 NotebookDocumentFilter
if err := decoder209.Decode(&h209); err == nil {
t.Value = h209
return nil
}
return &UnmarshalError{"unmarshal failed to match one of [NotebookDocumentFilter string]"}
}
func (t Or_NotebookDocumentFilter) MarshalJSON() ([]byte, error) {
switch x := t.Value.(type) {
case NotebookDocumentFilterNotebookType:
return json.Marshal(x)
case NotebookDocumentFilterPattern:
return json.Marshal(x)
case NotebookDocumentFilterScheme:
return json.Marshal(x)
case nil:
return []byte("null"), nil
}
return nil, fmt.Errorf("type %T not one of [NotebookDocumentFilterNotebookType NotebookDocumentFilterPattern NotebookDocumentFilterScheme]", t)
}
func (t *Or_NotebookDocumentFilter) UnmarshalJSON(x []byte) error {
if string(x) == "null" {
t.Value = nil
return nil
}
decoder285 := json.NewDecoder(bytes.NewReader(x))
decoder285.DisallowUnknownFields()
var h285 NotebookDocumentFilterNotebookType
if err := decoder285.Decode(&h285); err == nil {
t.Value = h285
return nil
}
decoder286 := json.NewDecoder(bytes.NewReader(x))
decoder286.DisallowUnknownFields()
var h286 NotebookDocumentFilterPattern
if err := decoder286.Decode(&h286); err == nil {
t.Value = h286
return nil
}
decoder287 := json.NewDecoder(bytes.NewReader(x))
decoder287.DisallowUnknownFields()
var h287 NotebookDocumentFilterScheme
if err := decoder287.Decode(&h287); err == nil {
t.Value = h287
return nil
}
return &UnmarshalError{"unmarshal failed to match one of [NotebookDocumentFilterNotebookType NotebookDocumentFilterPattern NotebookDocumentFilterScheme]"}
}
func (t Or_NotebookDocumentFilterWithCells_notebook) MarshalJSON() ([]byte, error) {
switch x := t.Value.(type) {
case NotebookDocumentFilter:
return json.Marshal(x)
case string:
return json.Marshal(x)
case nil:
return []byte("null"), nil
}
return nil, fmt.Errorf("type %T not one of [NotebookDocumentFilter string]", t)
}
func (t *Or_NotebookDocumentFilterWithCells_notebook) UnmarshalJSON(x []byte) error {
if string(x) == "null" {
t.Value = nil
return nil
}
decoder192 := json.NewDecoder(bytes.NewReader(x))
decoder192.DisallowUnknownFields()
var stringVal string
if err := decoder192.Decode(&stringVal); err == nil {
t.Value = stringVal
return nil
}
decoder193 := json.NewDecoder(bytes.NewReader(x))
decoder193.DisallowUnknownFields()
var h193 NotebookDocumentFilter
if err := decoder193.Decode(&h193); err == nil {
t.Value = h193
return nil
}
return &UnmarshalError{"unmarshal failed to match one of [NotebookDocumentFilter string]"}
}
func (t Or_NotebookDocumentFilterWithNotebook_notebook) MarshalJSON() ([]byte, error) {
switch x := t.Value.(type) {
case NotebookDocumentFilter:
return json.Marshal(x)
case string:
return json.Marshal(x)
case nil:
return []byte("null"), nil
}
return nil, fmt.Errorf("type %T not one of [NotebookDocumentFilter string]", t)
}
func (t *Or_NotebookDocumentFilterWithNotebook_notebook) UnmarshalJSON(x []byte) error {
if string(x) == "null" {
t.Value = nil
return nil
}
decoder189 := json.NewDecoder(bytes.NewReader(x))
decoder189.DisallowUnknownFields()
var stringVal string
if err := decoder189.Decode(&stringVal); err == nil {
t.Value = stringVal
return nil
}
decoder190 := json.NewDecoder(bytes.NewReader(x))
decoder190.DisallowUnknownFields()
var h190 NotebookDocumentFilter
if err := decoder190.Decode(&h190); err == nil {
t.Value = h190
return nil
}
return &UnmarshalError{"unmarshal failed to match one of [NotebookDocumentFilter string]"}
}
func (t Or_NotebookDocumentSyncOptions_notebookSelector_Elem) MarshalJSON() ([]byte, error) {
switch x := t.Value.(type) {
case NotebookDocumentFilterWithCells:
return json.Marshal(x)
case NotebookDocumentFilterWithNotebook:
return json.Marshal(x)
case nil:
return []byte("null"), nil
}
return nil, fmt.Errorf("type %T not one of [NotebookDocumentFilterWithCells NotebookDocumentFilterWithNotebook]", t)
}
func (t *Or_NotebookDocumentSyncOptions_notebookSelector_Elem) UnmarshalJSON(x []byte) error {
if string(x) == "null" {
t.Value = nil
return nil
}
decoder68 := json.NewDecoder(bytes.NewReader(x))
decoder68.DisallowUnknownFields()
var h68 NotebookDocumentFilterWithCells
if err := decoder68.Decode(&h68); err == nil {
t.Value = h68
return nil
}
decoder69 := json.NewDecoder(bytes.NewReader(x))
decoder69.DisallowUnknownFields()
var h69 NotebookDocumentFilterWithNotebook
if err := decoder69.Decode(&h69); err == nil {
t.Value = h69
return nil
}
return &UnmarshalError{"unmarshal failed to match one of [NotebookDocumentFilterWithCells NotebookDocumentFilterWithNotebook]"}
}
func (t Or_ParameterInformation_documentation) MarshalJSON() ([]byte, error) {
switch x := t.Value.(type) {
case MarkupContent:
return json.Marshal(x)
case string:
return json.Marshal(x)
case nil:
return []byte("null"), nil
}
return nil, fmt.Errorf("type %T not one of [MarkupContent string]", t)
}
func (t *Or_ParameterInformation_documentation) UnmarshalJSON(x []byte) error {
if string(x) == "null" {
t.Value = nil
return nil
}
decoder205 := json.NewDecoder(bytes.NewReader(x))
decoder205.DisallowUnknownFields()
var stringVal string
if err := decoder205.Decode(&stringVal); err == nil {
t.Value = stringVal
return nil
}
decoder206 := json.NewDecoder(bytes.NewReader(x))
decoder206.DisallowUnknownFields()
var h206 MarkupContent
if err := decoder206.Decode(&h206); err == nil {
t.Value = h206
return nil
}
return &UnmarshalError{"unmarshal failed to match one of [MarkupContent string]"}
}
func (t Or_ParameterInformation_label) MarshalJSON() ([]byte, error) {
switch x := t.Value.(type) {
case Tuple_ParameterInformation_label_Item1:
return json.Marshal(x)
case string:
return json.Marshal(x)
case nil:
return []byte("null"), nil
}
return nil, fmt.Errorf("type %T not one of [Tuple_ParameterInformation_label_Item1 string]", t)
}
func (t *Or_ParameterInformation_label) UnmarshalJSON(x []byte) error {
if string(x) == "null" {
t.Value = nil
return nil
}
decoder202 := json.NewDecoder(bytes.NewReader(x))
decoder202.DisallowUnknownFields()
var stringVal string
if err := decoder202.Decode(&stringVal); err == nil {
t.Value = stringVal
return nil
}
decoder203 := json.NewDecoder(bytes.NewReader(x))
decoder203.DisallowUnknownFields()
var h203 Tuple_ParameterInformation_label_Item1
if err := decoder203.Decode(&h203); err == nil {
t.Value = h203
return nil
}
return &UnmarshalError{"unmarshal failed to match one of [Tuple_ParameterInformation_label_Item1 string]"}
}
func (t Or_PrepareRenameResult) MarshalJSON() ([]byte, error) {
switch x := t.Value.(type) {
case PrepareRenameDefaultBehavior:
return json.Marshal(x)
case PrepareRenamePlaceholder:
return json.Marshal(x)
case Range:
return json.Marshal(x)
case nil:
return []byte("null"), nil
}
return nil, fmt.Errorf("type %T not one of [PrepareRenameDefaultBehavior PrepareRenamePlaceholder Range]", t)
}
func (t *Or_PrepareRenameResult) UnmarshalJSON(x []byte) error {
if string(x) == "null" {
t.Value = nil
return nil
}
decoder252 := json.NewDecoder(bytes.NewReader(x))
decoder252.DisallowUnknownFields()
var h252 PrepareRenameDefaultBehavior
if err := decoder252.Decode(&h252); err == nil {
t.Value = h252
return nil
}
decoder253 := json.NewDecoder(bytes.NewReader(x))
decoder253.DisallowUnknownFields()
var h253 PrepareRenamePlaceholder
if err := decoder253.Decode(&h253); err == nil {
t.Value = h253
return nil
}
decoder254 := json.NewDecoder(bytes.NewReader(x))
decoder254.DisallowUnknownFields()
var h254 Range
if err := decoder254.Decode(&h254); err == nil {
t.Value = h254
return nil
}
return &UnmarshalError{"unmarshal failed to match one of [PrepareRenameDefaultBehavior PrepareRenamePlaceholder Range]"}
}
func (t Or_ProgressToken) MarshalJSON() ([]byte, error) {
switch x := t.Value.(type) {
case int32:
return json.Marshal(x)
case string:
return json.Marshal(x)
case nil:
return []byte("null"), nil
}
return nil, fmt.Errorf("type %T not one of [int32 string]", t)
}
func (t *Or_ProgressToken) UnmarshalJSON(x []byte) error {
if string(x) == "null" {
t.Value = nil
return nil
}
decoder255 := json.NewDecoder(bytes.NewReader(x))
decoder255.DisallowUnknownFields()
var int32Val int32
if err := decoder255.Decode(&int32Val); err == nil {
t.Value = int32Val
return nil
}
decoder256 := json.NewDecoder(bytes.NewReader(x))
decoder256.DisallowUnknownFields()
var stringVal string
if err := decoder256.Decode(&stringVal); err == nil {
t.Value = stringVal
return nil
}
return &UnmarshalError{"unmarshal failed to match one of [int32 string]"}
}
func (t Or_RelatedFullDocumentDiagnosticReport_relatedDocuments_Value) MarshalJSON() ([]byte, error) {
switch x := t.Value.(type) {
case FullDocumentDiagnosticReport:
return json.Marshal(x)
case UnchangedDocumentDiagnosticReport:
return json.Marshal(x)
case nil:
return []byte("null"), nil
}
return nil, fmt.Errorf("type %T not one of [FullDocumentDiagnosticReport UnchangedDocumentDiagnosticReport]", t)
}
func (t *Or_RelatedFullDocumentDiagnosticReport_relatedDocuments_Value) UnmarshalJSON(x []byte) error {
if string(x) == "null" {
t.Value = nil
return nil
}
decoder60 := json.NewDecoder(bytes.NewReader(x))
decoder60.DisallowUnknownFields()
var h60 FullDocumentDiagnosticReport
if err := decoder60.Decode(&h60); err == nil {
t.Value = h60
return nil
}
decoder61 := json.NewDecoder(bytes.NewReader(x))
decoder61.DisallowUnknownFields()
var h61 UnchangedDocumentDiagnosticReport
if err := decoder61.Decode(&h61); err == nil {
t.Value = h61
return nil
}
return &UnmarshalError{"unmarshal failed to match one of [FullDocumentDiagnosticReport UnchangedDocumentDiagnosticReport]"}
}
func (t Or_RelatedUnchangedDocumentDiagnosticReport_relatedDocuments_Value) MarshalJSON() ([]byte, error) {
switch x := t.Value.(type) {
case FullDocumentDiagnosticReport:
return json.Marshal(x)
case UnchangedDocumentDiagnosticReport:
return json.Marshal(x)
case nil:
return []byte("null"), nil
}
return nil, fmt.Errorf("type %T not one of [FullDocumentDiagnosticReport UnchangedDocumentDiagnosticReport]", t)
}
func (t *Or_RelatedUnchangedDocumentDiagnosticReport_relatedDocuments_Value) UnmarshalJSON(x []byte) error {
if string(x) == "null" {
t.Value = nil
return nil
}
decoder64 := json.NewDecoder(bytes.NewReader(x))
decoder64.DisallowUnknownFields()
var h64 FullDocumentDiagnosticReport
if err := decoder64.Decode(&h64); err == nil {
t.Value = h64
return nil
}
decoder65 := json.NewDecoder(bytes.NewReader(x))
decoder65.DisallowUnknownFields()
var h65 UnchangedDocumentDiagnosticReport
if err := decoder65.Decode(&h65); err == nil {
t.Value = h65
return nil
}
return &UnmarshalError{"unmarshal failed to match one of [FullDocumentDiagnosticReport UnchangedDocumentDiagnosticReport]"}
}
func (t Or_RelativePattern_baseUri) MarshalJSON() ([]byte, error) {
switch x := t.Value.(type) {
case URI:
return json.Marshal(x)
case WorkspaceFolder:
return json.Marshal(x)
case nil:
return []byte("null"), nil
}
return nil, fmt.Errorf("type %T not one of [URI WorkspaceFolder]", t)
}
func (t *Or_RelativePattern_baseUri) UnmarshalJSON(x []byte) error {
if string(x) == "null" {
t.Value = nil
return nil
}
decoder214 := json.NewDecoder(bytes.NewReader(x))
decoder214.DisallowUnknownFields()
var h214 URI
if err := decoder214.Decode(&h214); err == nil {
t.Value = h214
return nil
}
decoder215 := json.NewDecoder(bytes.NewReader(x))
decoder215.DisallowUnknownFields()
var h215 WorkspaceFolder
if err := decoder215.Decode(&h215); err == nil {
t.Value = h215
return nil
}
return &UnmarshalError{"unmarshal failed to match one of [URI WorkspaceFolder]"}
}
func (t Or_Result_textDocument_codeAction_Item0_Elem) MarshalJSON() ([]byte, error) {
switch x := t.Value.(type) {
case CodeAction:
return json.Marshal(x)
case Command:
return json.Marshal(x)
case nil:
return []byte("null"), nil
}
return nil, fmt.Errorf("type %T not one of [CodeAction Command]", t)
}
func (t *Or_Result_textDocument_codeAction_Item0_Elem) UnmarshalJSON(x []byte) error {
if string(x) == "null" {
t.Value = nil
return nil
}
decoder322 := json.NewDecoder(bytes.NewReader(x))
decoder322.DisallowUnknownFields()
var h322 CodeAction
if err := decoder322.Decode(&h322); err == nil {
t.Value = h322
return nil
}
decoder323 := json.NewDecoder(bytes.NewReader(x))
decoder323.DisallowUnknownFields()
var h323 Command
if err := decoder323.Decode(&h323); err == nil {
t.Value = h323
return nil
}
return &UnmarshalError{"unmarshal failed to match one of [CodeAction Command]"}
}
func (t Or_Result_textDocument_completion) MarshalJSON() ([]byte, error) {
switch x := t.Value.(type) {
case CompletionList:
return json.Marshal(x)
case []CompletionItem:
return json.Marshal(x)
case nil:
return []byte("null"), nil
}
return nil, fmt.Errorf("type %T not one of [CompletionList []CompletionItem]", t)
}
func (t *Or_Result_textDocument_completion) UnmarshalJSON(x []byte) error {
if string(x) == "null" {
t.Value = nil
return nil
}
decoder310 := json.NewDecoder(bytes.NewReader(x))
decoder310.DisallowUnknownFields()
var h310 CompletionList
if err := decoder310.Decode(&h310); err == nil {
t.Value = h310
return nil
}
decoder311 := json.NewDecoder(bytes.NewReader(x))
decoder311.DisallowUnknownFields()
var h311 []CompletionItem
if err := decoder311.Decode(&h311); err == nil {
t.Value = h311
return nil
}
return &UnmarshalError{"unmarshal failed to match one of [CompletionList []CompletionItem]"}
}
func (t Or_Result_textDocument_declaration) MarshalJSON() ([]byte, error) {
switch x := t.Value.(type) {
case Declaration:
return json.Marshal(x)
case []DeclarationLink:
return json.Marshal(x)
case nil:
return []byte("null"), nil
}
return nil, fmt.Errorf("type %T not one of [Declaration []DeclarationLink]", t)
}
func (t *Or_Result_textDocument_declaration) UnmarshalJSON(x []byte) error {
if string(x) == "null" {
t.Value = nil
return nil
}
decoder298 := json.NewDecoder(bytes.NewReader(x))
decoder298.DisallowUnknownFields()
var h298 Declaration
if err := decoder298.Decode(&h298); err == nil {
t.Value = h298
return nil
}
decoder299 := json.NewDecoder(bytes.NewReader(x))
decoder299.DisallowUnknownFields()
var h299 []DeclarationLink
if err := decoder299.Decode(&h299); err == nil {
t.Value = h299
return nil
}
return &UnmarshalError{"unmarshal failed to match one of [Declaration []DeclarationLink]"}
}
func (t Or_Result_textDocument_definition) MarshalJSON() ([]byte, error) {
switch x := t.Value.(type) {
case Definition:
return json.Marshal(x)
case []DefinitionLink:
return json.Marshal(x)
case nil:
return []byte("null"), nil
}
return nil, fmt.Errorf("type %T not one of [Definition []DefinitionLink]", t)
}
func (t *Or_Result_textDocument_definition) UnmarshalJSON(x []byte) error {
if string(x) == "null" {
t.Value = nil
return nil
}
decoder314 := json.NewDecoder(bytes.NewReader(x))
decoder314.DisallowUnknownFields()
var h314 Definition
if err := decoder314.Decode(&h314); err == nil {
t.Value = h314
return nil
}
decoder315 := json.NewDecoder(bytes.NewReader(x))
decoder315.DisallowUnknownFields()
var h315 []DefinitionLink
if err := decoder315.Decode(&h315); err == nil {
t.Value = h315
return nil
}
return &UnmarshalError{"unmarshal failed to match one of [Definition []DefinitionLink]"}
}
func (t Or_Result_textDocument_documentSymbol) MarshalJSON() ([]byte, error) {
switch x := t.Value.(type) {
case []DocumentSymbol:
return json.Marshal(x)
case []SymbolInformation:
return json.Marshal(x)
case nil:
return []byte("null"), nil
}
return nil, fmt.Errorf("type %T not one of [[]DocumentSymbol []SymbolInformation]", t)
}
func (t *Or_Result_textDocument_documentSymbol) UnmarshalJSON(x []byte) error {
if string(x) == "null" {
t.Value = nil
return nil
}
decoder318 := json.NewDecoder(bytes.NewReader(x))
decoder318.DisallowUnknownFields()
var h318 []DocumentSymbol
if err := decoder318.Decode(&h318); err == nil {
t.Value = h318
return nil
}
decoder319 := json.NewDecoder(bytes.NewReader(x))
decoder319.DisallowUnknownFields()
var h319 []SymbolInformation
if err := decoder319.Decode(&h319); err == nil {
t.Value = h319
return nil
}
return &UnmarshalError{"unmarshal failed to match one of [[]DocumentSymbol []SymbolInformation]"}
}
func (t Or_Result_textDocument_implementation) MarshalJSON() ([]byte, error) {
switch x := t.Value.(type) {
case Definition:
return json.Marshal(x)
case []DefinitionLink:
return json.Marshal(x)
case nil:
return []byte("null"), nil
}
return nil, fmt.Errorf("type %T not one of [Definition []DefinitionLink]", t)
}
func (t *Or_Result_textDocument_implementation) UnmarshalJSON(x []byte) error {
if string(x) == "null" {
t.Value = nil
return nil
}
decoder290 := json.NewDecoder(bytes.NewReader(x))
decoder290.DisallowUnknownFields()
var h290 Definition
if err := decoder290.Decode(&h290); err == nil {
t.Value = h290
return nil
}
decoder291 := json.NewDecoder(bytes.NewReader(x))
decoder291.DisallowUnknownFields()
var h291 []DefinitionLink
if err := decoder291.Decode(&h291); err == nil {
t.Value = h291
return nil
}
return &UnmarshalError{"unmarshal failed to match one of [Definition []DefinitionLink]"}
}
func (t Or_Result_textDocument_inlineCompletion) MarshalJSON() ([]byte, error) {
switch x := t.Value.(type) {
case InlineCompletionList:
return json.Marshal(x)
case []InlineCompletionItem:
return json.Marshal(x)
case nil:
return []byte("null"), nil
}
return nil, fmt.Errorf("type %T not one of [InlineCompletionList []InlineCompletionItem]", t)
}
func (t *Or_Result_textDocument_inlineCompletion) UnmarshalJSON(x []byte) error {
if string(x) == "null" {
t.Value = nil
return nil
}
decoder306 := json.NewDecoder(bytes.NewReader(x))
decoder306.DisallowUnknownFields()
var h306 InlineCompletionList
if err := decoder306.Decode(&h306); err == nil {
t.Value = h306
return nil
}
decoder307 := json.NewDecoder(bytes.NewReader(x))
decoder307.DisallowUnknownFields()
var h307 []InlineCompletionItem
if err := decoder307.Decode(&h307); err == nil {
t.Value = h307
return nil
}
return &UnmarshalError{"unmarshal failed to match one of [InlineCompletionList []InlineCompletionItem]"}
}
func (t Or_Result_textDocument_semanticTokens_full_delta) MarshalJSON() ([]byte, error) {
switch x := t.Value.(type) {
case SemanticTokens:
return json.Marshal(x)
case SemanticTokensDelta:
return json.Marshal(x)
case nil:
return []byte("null"), nil
}
return nil, fmt.Errorf("type %T not one of [SemanticTokens SemanticTokensDelta]", t)
}
func (t *Or_Result_textDocument_semanticTokens_full_delta) UnmarshalJSON(x []byte) error {
if string(x) == "null" {
t.Value = nil
return nil
}
decoder302 := json.NewDecoder(bytes.NewReader(x))
decoder302.DisallowUnknownFields()
var h302 SemanticTokens
if err := decoder302.Decode(&h302); err == nil {
t.Value = h302
return nil
}
decoder303 := json.NewDecoder(bytes.NewReader(x))
decoder303.DisallowUnknownFields()
var h303 SemanticTokensDelta
if err := decoder303.Decode(&h303); err == nil {
t.Value = h303
return nil
}
return &UnmarshalError{"unmarshal failed to match one of [SemanticTokens SemanticTokensDelta]"}
}
func (t Or_Result_textDocument_typeDefinition) MarshalJSON() ([]byte, error) {
switch x := t.Value.(type) {
case Definition:
return json.Marshal(x)
case []DefinitionLink:
return json.Marshal(x)
case nil:
return []byte("null"), nil
}
return nil, fmt.Errorf("type %T not one of [Definition []DefinitionLink]", t)
}
func (t *Or_Result_textDocument_typeDefinition) UnmarshalJSON(x []byte) error {
if string(x) == "null" {
t.Value = nil
return nil
}
decoder294 := json.NewDecoder(bytes.NewReader(x))
decoder294.DisallowUnknownFields()
var h294 Definition
if err := decoder294.Decode(&h294); err == nil {
t.Value = h294
return nil
}
decoder295 := json.NewDecoder(bytes.NewReader(x))
decoder295.DisallowUnknownFields()
var h295 []DefinitionLink
if err := decoder295.Decode(&h295); err == nil {
t.Value = h295
return nil
}
return &UnmarshalError{"unmarshal failed to match one of [Definition []DefinitionLink]"}
}
func (t Or_Result_workspace_symbol) MarshalJSON() ([]byte, error) {
switch x := t.Value.(type) {
case []SymbolInformation:
return json.Marshal(x)
case []WorkspaceSymbol:
return json.Marshal(x)
case nil:
return []byte("null"), nil
}
return nil, fmt.Errorf("type %T not one of [[]SymbolInformation []WorkspaceSymbol]", t)
}
func (t *Or_Result_workspace_symbol) UnmarshalJSON(x []byte) error {
if string(x) == "null" {
t.Value = nil
return nil
}
decoder326 := json.NewDecoder(bytes.NewReader(x))
decoder326.DisallowUnknownFields()
var h326 []SymbolInformation
if err := decoder326.Decode(&h326); err == nil {
t.Value = h326
return nil
}
decoder327 := json.NewDecoder(bytes.NewReader(x))
decoder327.DisallowUnknownFields()
var h327 []WorkspaceSymbol
if err := decoder327.Decode(&h327); err == nil {
t.Value = h327
return nil
}
return &UnmarshalError{"unmarshal failed to match one of [[]SymbolInformation []WorkspaceSymbol]"}
}
func (t Or_SemanticTokensOptions_full) MarshalJSON() ([]byte, error) {
switch x := t.Value.(type) {
case SemanticTokensFullDelta:
return json.Marshal(x)
case bool:
return json.Marshal(x)
case nil:
return []byte("null"), nil
}
return nil, fmt.Errorf("type %T not one of [SemanticTokensFullDelta bool]", t)
}
func (t *Or_SemanticTokensOptions_full) UnmarshalJSON(x []byte) error {
if string(x) == "null" {
t.Value = nil
return nil
}
decoder47 := json.NewDecoder(bytes.NewReader(x))
decoder47.DisallowUnknownFields()
var boolVal bool
if err := decoder47.Decode(&boolVal); err == nil {
t.Value = boolVal
return nil
}
decoder48 := json.NewDecoder(bytes.NewReader(x))
decoder48.DisallowUnknownFields()
var h48 SemanticTokensFullDelta
if err := decoder48.Decode(&h48); err == nil {
t.Value = h48
return nil
}
return &UnmarshalError{"unmarshal failed to match one of [SemanticTokensFullDelta bool]"}
}
func (t Or_SemanticTokensOptions_range) MarshalJSON() ([]byte, error) {
switch x := t.Value.(type) {
case Lit_SemanticTokensOptions_range_Item1:
return json.Marshal(x)
case bool:
return json.Marshal(x)
case nil:
return []byte("null"), nil
}
return nil, fmt.Errorf("type %T not one of [Lit_SemanticTokensOptions_range_Item1 bool]", t)
}
func (t *Or_SemanticTokensOptions_range) UnmarshalJSON(x []byte) error {
if string(x) == "null" {
t.Value = nil
return nil
}
decoder44 := json.NewDecoder(bytes.NewReader(x))
decoder44.DisallowUnknownFields()
var boolVal bool
if err := decoder44.Decode(&boolVal); err == nil {
t.Value = boolVal
return nil
}
decoder45 := json.NewDecoder(bytes.NewReader(x))
decoder45.DisallowUnknownFields()
var h45 Lit_SemanticTokensOptions_range_Item1
if err := decoder45.Decode(&h45); err == nil {
t.Value = h45
return nil
}
return &UnmarshalError{"unmarshal failed to match one of [Lit_SemanticTokensOptions_range_Item1 bool]"}
}
func (t Or_ServerCapabilities_callHierarchyProvider) MarshalJSON() ([]byte, error) {
switch x := t.Value.(type) {
case CallHierarchyOptions:
return json.Marshal(x)
case CallHierarchyRegistrationOptions:
return json.Marshal(x)
case bool:
return json.Marshal(x)
case nil:
return []byte("null"), nil
}
return nil, fmt.Errorf("type %T not one of [CallHierarchyOptions CallHierarchyRegistrationOptions bool]", t)
}
func (t *Or_ServerCapabilities_callHierarchyProvider) UnmarshalJSON(x []byte) error {
if string(x) == "null" {
t.Value = nil
return nil
}
decoder140 := json.NewDecoder(bytes.NewReader(x))
decoder140.DisallowUnknownFields()
var boolVal bool
if err := decoder140.Decode(&boolVal); err == nil {
t.Value = boolVal
return nil
}
decoder141 := json.NewDecoder(bytes.NewReader(x))
decoder141.DisallowUnknownFields()
var h141 CallHierarchyOptions
if err := decoder141.Decode(&h141); err == nil {
t.Value = h141
return nil
}
decoder142 := json.NewDecoder(bytes.NewReader(x))
decoder142.DisallowUnknownFields()
var h142 CallHierarchyRegistrationOptions
if err := decoder142.Decode(&h142); err == nil {
t.Value = h142
return nil
}
return &UnmarshalError{"unmarshal failed to match one of [CallHierarchyOptions CallHierarchyRegistrationOptions bool]"}
}
func (t Or_ServerCapabilities_codeActionProvider) MarshalJSON() ([]byte, error) {
switch x := t.Value.(type) {
case CodeActionOptions:
return json.Marshal(x)
case bool:
return json.Marshal(x)
case nil:
return []byte("null"), nil
}
return nil, fmt.Errorf("type %T not one of [CodeActionOptions bool]", t)
}
func (t *Or_ServerCapabilities_codeActionProvider) UnmarshalJSON(x []byte) error {
if string(x) == "null" {
t.Value = nil
return nil
}
decoder109 := json.NewDecoder(bytes.NewReader(x))
decoder109.DisallowUnknownFields()
var boolVal bool
if err := decoder109.Decode(&boolVal); err == nil {
t.Value = boolVal
return nil
}
decoder110 := json.NewDecoder(bytes.NewReader(x))
decoder110.DisallowUnknownFields()
var h110 CodeActionOptions
if err := decoder110.Decode(&h110); err == nil {
t.Value = h110
return nil
}
return &UnmarshalError{"unmarshal failed to match one of [CodeActionOptions bool]"}
}
func (t Or_ServerCapabilities_colorProvider) MarshalJSON() ([]byte, error) {
switch x := t.Value.(type) {
case DocumentColorOptions:
return json.Marshal(x)
case DocumentColorRegistrationOptions:
return json.Marshal(x)
case bool:
return json.Marshal(x)
case nil:
return []byte("null"), nil
}
return nil, fmt.Errorf("type %T not one of [DocumentColorOptions DocumentColorRegistrationOptions bool]", t)
}
func (t *Or_ServerCapabilities_colorProvider) UnmarshalJSON(x []byte) error {
if string(x) == "null" {
t.Value = nil
return nil
}
decoder113 := json.NewDecoder(bytes.NewReader(x))
decoder113.DisallowUnknownFields()
var boolVal bool
if err := decoder113.Decode(&boolVal); err == nil {
t.Value = boolVal
return nil
}
decoder114 := json.NewDecoder(bytes.NewReader(x))
decoder114.DisallowUnknownFields()
var h114 DocumentColorOptions
if err := decoder114.Decode(&h114); err == nil {
t.Value = h114
return nil
}
decoder115 := json.NewDecoder(bytes.NewReader(x))
decoder115.DisallowUnknownFields()
var h115 DocumentColorRegistrationOptions
if err := decoder115.Decode(&h115); err == nil {
t.Value = h115
return nil
}
return &UnmarshalError{"unmarshal failed to match one of [DocumentColorOptions DocumentColorRegistrationOptions bool]"}
}
func (t Or_ServerCapabilities_declarationProvider) MarshalJSON() ([]byte, error) {
switch x := t.Value.(type) {
case DeclarationOptions:
return json.Marshal(x)
case DeclarationRegistrationOptions:
return json.Marshal(x)
case bool:
return json.Marshal(x)
case nil:
return []byte("null"), nil
}
return nil, fmt.Errorf("type %T not one of [DeclarationOptions DeclarationRegistrationOptions bool]", t)
}
func (t *Or_ServerCapabilities_declarationProvider) UnmarshalJSON(x []byte) error {
if string(x) == "null" {
t.Value = nil
return nil
}
decoder83 := json.NewDecoder(bytes.NewReader(x))
decoder83.DisallowUnknownFields()
var boolVal bool
if err := decoder83.Decode(&boolVal); err == nil {
t.Value = boolVal
return nil
}
decoder84 := json.NewDecoder(bytes.NewReader(x))
decoder84.DisallowUnknownFields()
var h84 DeclarationOptions
if err := decoder84.Decode(&h84); err == nil {
t.Value = h84
return nil
}
decoder85 := json.NewDecoder(bytes.NewReader(x))
decoder85.DisallowUnknownFields()
var h85 DeclarationRegistrationOptions
if err := decoder85.Decode(&h85); err == nil {
t.Value = h85
return nil
}
return &UnmarshalError{"unmarshal failed to match one of [DeclarationOptions DeclarationRegistrationOptions bool]"}
}
func (t Or_ServerCapabilities_definitionProvider) MarshalJSON() ([]byte, error) {
switch x := t.Value.(type) {
case DefinitionOptions:
return json.Marshal(x)
case bool:
return json.Marshal(x)
case nil:
return []byte("null"), nil
}
return nil, fmt.Errorf("type %T not one of [DefinitionOptions bool]", t)
}
func (t *Or_ServerCapabilities_definitionProvider) UnmarshalJSON(x []byte) error {
if string(x) == "null" {
t.Value = nil
return nil
}
decoder87 := json.NewDecoder(bytes.NewReader(x))
decoder87.DisallowUnknownFields()
var boolVal bool
if err := decoder87.Decode(&boolVal); err == nil {
t.Value = boolVal
return nil
}
decoder88 := json.NewDecoder(bytes.NewReader(x))
decoder88.DisallowUnknownFields()
var h88 DefinitionOptions
if err := decoder88.Decode(&h88); err == nil {
t.Value = h88
return nil
}
return &UnmarshalError{"unmarshal failed to match one of [DefinitionOptions bool]"}
}
func (t Or_ServerCapabilities_diagnosticProvider) MarshalJSON() ([]byte, error) {
switch x := t.Value.(type) {
case DiagnosticOptions:
return json.Marshal(x)
case DiagnosticRegistrationOptions:
return json.Marshal(x)
case nil:
return []byte("null"), nil
}
return nil, fmt.Errorf("type %T not one of [DiagnosticOptions DiagnosticRegistrationOptions]", t)
}
func (t *Or_ServerCapabilities_diagnosticProvider) UnmarshalJSON(x []byte) error {
if string(x) == "null" {
t.Value = nil
return nil
}
decoder174 := json.NewDecoder(bytes.NewReader(x))
decoder174.DisallowUnknownFields()
var h174 DiagnosticOptions
if err := decoder174.Decode(&h174); err == nil {
t.Value = h174
return nil
}
decoder175 := json.NewDecoder(bytes.NewReader(x))
decoder175.DisallowUnknownFields()
var h175 DiagnosticRegistrationOptions
if err := decoder175.Decode(&h175); err == nil {
t.Value = h175
return nil
}
return &UnmarshalError{"unmarshal failed to match one of [DiagnosticOptions DiagnosticRegistrationOptions]"}
}
func (t Or_ServerCapabilities_documentFormattingProvider) MarshalJSON() ([]byte, error) {
switch x := t.Value.(type) {
case DocumentFormattingOptions:
return json.Marshal(x)
case bool:
return json.Marshal(x)
case nil:
return []byte("null"), nil
}
return nil, fmt.Errorf("type %T not one of [DocumentFormattingOptions bool]", t)
}
func (t *Or_ServerCapabilities_documentFormattingProvider) UnmarshalJSON(x []byte) error {
if string(x) == "null" {
t.Value = nil
return nil
}
decoder120 := json.NewDecoder(bytes.NewReader(x))
decoder120.DisallowUnknownFields()
var boolVal bool
if err := decoder120.Decode(&boolVal); err == nil {
t.Value = boolVal
return nil
}
decoder121 := json.NewDecoder(bytes.NewReader(x))
decoder121.DisallowUnknownFields()
var h121 DocumentFormattingOptions
if err := decoder121.Decode(&h121); err == nil {
t.Value = h121
return nil
}
return &UnmarshalError{"unmarshal failed to match one of [DocumentFormattingOptions bool]"}
}
func (t Or_ServerCapabilities_documentHighlightProvider) MarshalJSON() ([]byte, error) {
switch x := t.Value.(type) {
case DocumentHighlightOptions:
return json.Marshal(x)
case bool:
return json.Marshal(x)
case nil:
return []byte("null"), nil
}
return nil, fmt.Errorf("type %T not one of [DocumentHighlightOptions bool]", t)
}
func (t *Or_ServerCapabilities_documentHighlightProvider) UnmarshalJSON(x []byte) error {
if string(x) == "null" {
t.Value = nil
return nil
}
decoder103 := json.NewDecoder(bytes.NewReader(x))
decoder103.DisallowUnknownFields()
var boolVal bool
if err := decoder103.Decode(&boolVal); err == nil {
t.Value = boolVal
return nil
}
decoder104 := json.NewDecoder(bytes.NewReader(x))
decoder104.DisallowUnknownFields()
var h104 DocumentHighlightOptions
if err := decoder104.Decode(&h104); err == nil {
t.Value = h104
return nil
}
return &UnmarshalError{"unmarshal failed to match one of [DocumentHighlightOptions bool]"}
}
func (t Or_ServerCapabilities_documentRangeFormattingProvider) MarshalJSON() ([]byte, error) {
switch x := t.Value.(type) {
case DocumentRangeFormattingOptions:
return json.Marshal(x)
case bool:
return json.Marshal(x)
case nil:
return []byte("null"), nil
}
return nil, fmt.Errorf("type %T not one of [DocumentRangeFormattingOptions bool]", t)
}
func (t *Or_ServerCapabilities_documentRangeFormattingProvider) UnmarshalJSON(x []byte) error {
if string(x) == "null" {
t.Value = nil
return nil
}
decoder123 := json.NewDecoder(bytes.NewReader(x))
decoder123.DisallowUnknownFields()
var boolVal bool
if err := decoder123.Decode(&boolVal); err == nil {
t.Value = boolVal
return nil
}
decoder124 := json.NewDecoder(bytes.NewReader(x))
decoder124.DisallowUnknownFields()
var h124 DocumentRangeFormattingOptions
if err := decoder124.Decode(&h124); err == nil {
t.Value = h124
return nil
}
return &UnmarshalError{"unmarshal failed to match one of [DocumentRangeFormattingOptions bool]"}
}
func (t Or_ServerCapabilities_documentSymbolProvider) MarshalJSON() ([]byte, error) {
switch x := t.Value.(type) {
case DocumentSymbolOptions:
return json.Marshal(x)
case bool:
return json.Marshal(x)
case nil:
return []byte("null"), nil
}
return nil, fmt.Errorf("type %T not one of [DocumentSymbolOptions bool]", t)
}
func (t *Or_ServerCapabilities_documentSymbolProvider) UnmarshalJSON(x []byte) error {
if string(x) == "null" {
t.Value = nil
return nil
}
decoder106 := json.NewDecoder(bytes.NewReader(x))
decoder106.DisallowUnknownFields()
var boolVal bool
if err := decoder106.Decode(&boolVal); err == nil {
t.Value = boolVal
return nil
}
decoder107 := json.NewDecoder(bytes.NewReader(x))
decoder107.DisallowUnknownFields()
var h107 DocumentSymbolOptions
if err := decoder107.Decode(&h107); err == nil {
t.Value = h107
return nil
}
return &UnmarshalError{"unmarshal failed to match one of [DocumentSymbolOptions bool]"}
}
func (t Or_ServerCapabilities_foldingRangeProvider) MarshalJSON() ([]byte, error) {
switch x := t.Value.(type) {
case FoldingRangeOptions:
return json.Marshal(x)
case FoldingRangeRegistrationOptions:
return json.Marshal(x)
case bool:
return json.Marshal(x)
case nil:
return []byte("null"), nil
}
return nil, fmt.Errorf("type %T not one of [FoldingRangeOptions FoldingRangeRegistrationOptions bool]", t)
}
func (t *Or_ServerCapabilities_foldingRangeProvider) UnmarshalJSON(x []byte) error {
if string(x) == "null" {
t.Value = nil
return nil
}
decoder130 := json.NewDecoder(bytes.NewReader(x))
decoder130.DisallowUnknownFields()
var boolVal bool
if err := decoder130.Decode(&boolVal); err == nil {
t.Value = boolVal
return nil
}
decoder131 := json.NewDecoder(bytes.NewReader(x))
decoder131.DisallowUnknownFields()
var h131 FoldingRangeOptions
if err := decoder131.Decode(&h131); err == nil {
t.Value = h131
return nil
}
decoder132 := json.NewDecoder(bytes.NewReader(x))
decoder132.DisallowUnknownFields()
var h132 FoldingRangeRegistrationOptions
if err := decoder132.Decode(&h132); err == nil {
t.Value = h132
return nil
}
return &UnmarshalError{"unmarshal failed to match one of [FoldingRangeOptions FoldingRangeRegistrationOptions bool]"}
}
func (t Or_ServerCapabilities_hoverProvider) MarshalJSON() ([]byte, error) {
switch x := t.Value.(type) {
case HoverOptions:
return json.Marshal(x)
case bool:
return json.Marshal(x)
case nil:
return []byte("null"), nil
}
return nil, fmt.Errorf("type %T not one of [HoverOptions bool]", t)
}
func (t *Or_ServerCapabilities_hoverProvider) UnmarshalJSON(x []byte) error {
if string(x) == "null" {
t.Value = nil
return nil
}
decoder79 := json.NewDecoder(bytes.NewReader(x))
decoder79.DisallowUnknownFields()
var boolVal bool
if err := decoder79.Decode(&boolVal); err == nil {
t.Value = boolVal
return nil
}
decoder80 := json.NewDecoder(bytes.NewReader(x))
decoder80.DisallowUnknownFields()
var h80 HoverOptions
if err := decoder80.Decode(&h80); err == nil {
t.Value = h80
return nil
}
return &UnmarshalError{"unmarshal failed to match one of [HoverOptions bool]"}
}
func (t Or_ServerCapabilities_implementationProvider) MarshalJSON() ([]byte, error) {
switch x := t.Value.(type) {
case ImplementationOptions:
return json.Marshal(x)
case ImplementationRegistrationOptions:
return json.Marshal(x)
case bool:
return json.Marshal(x)
case nil:
return []byte("null"), nil
}
return nil, fmt.Errorf("type %T not one of [ImplementationOptions ImplementationRegistrationOptions bool]", t)
}
func (t *Or_ServerCapabilities_implementationProvider) UnmarshalJSON(x []byte) error {
if string(x) == "null" {
t.Value = nil
return nil
}
decoder96 := json.NewDecoder(bytes.NewReader(x))
decoder96.DisallowUnknownFields()
var boolVal bool
if err := decoder96.Decode(&boolVal); err == nil {
t.Value = boolVal
return nil
}
decoder97 := json.NewDecoder(bytes.NewReader(x))
decoder97.DisallowUnknownFields()
var h97 ImplementationOptions
if err := decoder97.Decode(&h97); err == nil {
t.Value = h97
return nil
}
decoder98 := json.NewDecoder(bytes.NewReader(x))
decoder98.DisallowUnknownFields()
var h98 ImplementationRegistrationOptions
if err := decoder98.Decode(&h98); err == nil {
t.Value = h98
return nil
}
return &UnmarshalError{"unmarshal failed to match one of [ImplementationOptions ImplementationRegistrationOptions bool]"}
}
func (t Or_ServerCapabilities_inlayHintProvider) MarshalJSON() ([]byte, error) {
switch x := t.Value.(type) {
case InlayHintOptions:
return json.Marshal(x)
case InlayHintRegistrationOptions:
return json.Marshal(x)
case bool:
return json.Marshal(x)
case nil:
return []byte("null"), nil
}
return nil, fmt.Errorf("type %T not one of [InlayHintOptions InlayHintRegistrationOptions bool]", t)
}
func (t *Or_ServerCapabilities_inlayHintProvider) UnmarshalJSON(x []byte) error {
if string(x) == "null" {
t.Value = nil
return nil
}
decoder169 := json.NewDecoder(bytes.NewReader(x))
decoder169.DisallowUnknownFields()
var boolVal bool
if err := decoder169.Decode(&boolVal); err == nil {
t.Value = boolVal
return nil
}
decoder170 := json.NewDecoder(bytes.NewReader(x))
decoder170.DisallowUnknownFields()
var h170 InlayHintOptions
if err := decoder170.Decode(&h170); err == nil {
t.Value = h170
return nil
}
decoder171 := json.NewDecoder(bytes.NewReader(x))
decoder171.DisallowUnknownFields()
var h171 InlayHintRegistrationOptions
if err := decoder171.Decode(&h171); err == nil {
t.Value = h171
return nil
}
return &UnmarshalError{"unmarshal failed to match one of [InlayHintOptions InlayHintRegistrationOptions bool]"}
}
func (t Or_ServerCapabilities_inlineCompletionProvider) MarshalJSON() ([]byte, error) {
switch x := t.Value.(type) {
case InlineCompletionOptions:
return json.Marshal(x)
case bool:
return json.Marshal(x)
case nil:
return []byte("null"), nil
}
return nil, fmt.Errorf("type %T not one of [InlineCompletionOptions bool]", t)
}
func (t *Or_ServerCapabilities_inlineCompletionProvider) UnmarshalJSON(x []byte) error {
if string(x) == "null" {
t.Value = nil
return nil
}
decoder177 := json.NewDecoder(bytes.NewReader(x))
decoder177.DisallowUnknownFields()
var boolVal bool
if err := decoder177.Decode(&boolVal); err == nil {
t.Value = boolVal
return nil
}
decoder178 := json.NewDecoder(bytes.NewReader(x))
decoder178.DisallowUnknownFields()
var h178 InlineCompletionOptions
if err := decoder178.Decode(&h178); err == nil {
t.Value = h178
return nil
}
return &UnmarshalError{"unmarshal failed to match one of [InlineCompletionOptions bool]"}
}
func (t Or_ServerCapabilities_inlineValueProvider) MarshalJSON() ([]byte, error) {
switch x := t.Value.(type) {
case InlineValueOptions:
return json.Marshal(x)
case InlineValueRegistrationOptions:
return json.Marshal(x)
case bool:
return json.Marshal(x)
case nil:
return []byte("null"), nil
}
return nil, fmt.Errorf("type %T not one of [InlineValueOptions InlineValueRegistrationOptions bool]", t)
}
func (t *Or_ServerCapabilities_inlineValueProvider) UnmarshalJSON(x []byte) error {
if string(x) == "null" {
t.Value = nil
return nil
}
decoder164 := json.NewDecoder(bytes.NewReader(x))
decoder164.DisallowUnknownFields()
var boolVal bool
if err := decoder164.Decode(&boolVal); err == nil {
t.Value = boolVal
return nil
}
decoder165 := json.NewDecoder(bytes.NewReader(x))
decoder165.DisallowUnknownFields()
var h165 InlineValueOptions
if err := decoder165.Decode(&h165); err == nil {
t.Value = h165
return nil
}
decoder166 := json.NewDecoder(bytes.NewReader(x))
decoder166.DisallowUnknownFields()
var h166 InlineValueRegistrationOptions
if err := decoder166.Decode(&h166); err == nil {
t.Value = h166
return nil
}
return &UnmarshalError{"unmarshal failed to match one of [InlineValueOptions InlineValueRegistrationOptions bool]"}
}
func (t Or_ServerCapabilities_linkedEditingRangeProvider) MarshalJSON() ([]byte, error) {
switch x := t.Value.(type) {
case LinkedEditingRangeOptions:
return json.Marshal(x)
case LinkedEditingRangeRegistrationOptions:
return json.Marshal(x)
case bool:
return json.Marshal(x)
case nil:
return []byte("null"), nil
}
return nil, fmt.Errorf("type %T not one of [LinkedEditingRangeOptions LinkedEditingRangeRegistrationOptions bool]", t)
}
func (t *Or_ServerCapabilities_linkedEditingRangeProvider) UnmarshalJSON(x []byte) error {
if string(x) == "null" {
t.Value = nil
return nil
}
decoder145 := json.NewDecoder(bytes.NewReader(x))
decoder145.DisallowUnknownFields()
var boolVal bool
if err := decoder145.Decode(&boolVal); err == nil {
t.Value = boolVal
return nil
}
decoder146 := json.NewDecoder(bytes.NewReader(x))
decoder146.DisallowUnknownFields()
var h146 LinkedEditingRangeOptions
if err := decoder146.Decode(&h146); err == nil {
t.Value = h146
return nil
}
decoder147 := json.NewDecoder(bytes.NewReader(x))
decoder147.DisallowUnknownFields()
var h147 LinkedEditingRangeRegistrationOptions
if err := decoder147.Decode(&h147); err == nil {
t.Value = h147
return nil
}
return &UnmarshalError{"unmarshal failed to match one of [LinkedEditingRangeOptions LinkedEditingRangeRegistrationOptions bool]"}
}
func (t Or_ServerCapabilities_monikerProvider) MarshalJSON() ([]byte, error) {
switch x := t.Value.(type) {
case MonikerOptions:
return json.Marshal(x)
case MonikerRegistrationOptions:
return json.Marshal(x)
case bool:
return json.Marshal(x)
case nil:
return []byte("null"), nil
}
return nil, fmt.Errorf("type %T not one of [MonikerOptions MonikerRegistrationOptions bool]", t)
}
func (t *Or_ServerCapabilities_monikerProvider) UnmarshalJSON(x []byte) error {
if string(x) == "null" {
t.Value = nil
return nil
}
decoder154 := json.NewDecoder(bytes.NewReader(x))
decoder154.DisallowUnknownFields()
var boolVal bool
if err := decoder154.Decode(&boolVal); err == nil {
t.Value = boolVal
return nil
}
decoder155 := json.NewDecoder(bytes.NewReader(x))
decoder155.DisallowUnknownFields()
var h155 MonikerOptions
if err := decoder155.Decode(&h155); err == nil {
t.Value = h155
return nil
}
decoder156 := json.NewDecoder(bytes.NewReader(x))
decoder156.DisallowUnknownFields()
var h156 MonikerRegistrationOptions
if err := decoder156.Decode(&h156); err == nil {
t.Value = h156
return nil
}
return &UnmarshalError{"unmarshal failed to match one of [MonikerOptions MonikerRegistrationOptions bool]"}
}
func (t Or_ServerCapabilities_notebookDocumentSync) MarshalJSON() ([]byte, error) {
switch x := t.Value.(type) {
case NotebookDocumentSyncOptions:
return json.Marshal(x)
case NotebookDocumentSyncRegistrationOptions:
return json.Marshal(x)
case nil:
return []byte("null"), nil
}
return nil, fmt.Errorf("type %T not one of [NotebookDocumentSyncOptions NotebookDocumentSyncRegistrationOptions]", t)
}
func (t *Or_ServerCapabilities_notebookDocumentSync) UnmarshalJSON(x []byte) error {
if string(x) == "null" {
t.Value = nil
return nil
}
decoder76 := json.NewDecoder(bytes.NewReader(x))
decoder76.DisallowUnknownFields()
var h76 NotebookDocumentSyncOptions
if err := decoder76.Decode(&h76); err == nil {
t.Value = h76
return nil
}
decoder77 := json.NewDecoder(bytes.NewReader(x))
decoder77.DisallowUnknownFields()
var h77 NotebookDocumentSyncRegistrationOptions
if err := decoder77.Decode(&h77); err == nil {
t.Value = h77
return nil
}
return &UnmarshalError{"unmarshal failed to match one of [NotebookDocumentSyncOptions NotebookDocumentSyncRegistrationOptions]"}
}
func (t Or_ServerCapabilities_referencesProvider) MarshalJSON() ([]byte, error) {
switch x := t.Value.(type) {
case ReferenceOptions:
return json.Marshal(x)
case bool:
return json.Marshal(x)
case nil:
return []byte("null"), nil
}
return nil, fmt.Errorf("type %T not one of [ReferenceOptions bool]", t)
}
func (t *Or_ServerCapabilities_referencesProvider) UnmarshalJSON(x []byte) error {
if string(x) == "null" {
t.Value = nil
return nil
}
decoder100 := json.NewDecoder(bytes.NewReader(x))
decoder100.DisallowUnknownFields()
var boolVal bool
if err := decoder100.Decode(&boolVal); err == nil {
t.Value = boolVal
return nil
}
decoder101 := json.NewDecoder(bytes.NewReader(x))
decoder101.DisallowUnknownFields()
var h101 ReferenceOptions
if err := decoder101.Decode(&h101); err == nil {
t.Value = h101
return nil
}
return &UnmarshalError{"unmarshal failed to match one of [ReferenceOptions bool]"}
}
func (t Or_ServerCapabilities_renameProvider) MarshalJSON() ([]byte, error) {
switch x := t.Value.(type) {
case RenameOptions:
return json.Marshal(x)
case bool:
return json.Marshal(x)
case nil:
return []byte("null"), nil
}
return nil, fmt.Errorf("type %T not one of [RenameOptions bool]", t)
}
func (t *Or_ServerCapabilities_renameProvider) UnmarshalJSON(x []byte) error {
if string(x) == "null" {
t.Value = nil
return nil
}
decoder126 := json.NewDecoder(bytes.NewReader(x))
decoder126.DisallowUnknownFields()
var boolVal bool
if err := decoder126.Decode(&boolVal); err == nil {
t.Value = boolVal
return nil
}
decoder127 := json.NewDecoder(bytes.NewReader(x))
decoder127.DisallowUnknownFields()
var h127 RenameOptions
if err := decoder127.Decode(&h127); err == nil {
t.Value = h127
return nil
}
return &UnmarshalError{"unmarshal failed to match one of [RenameOptions bool]"}
}
func (t Or_ServerCapabilities_selectionRangeProvider) MarshalJSON() ([]byte, error) {
switch x := t.Value.(type) {
case SelectionRangeOptions:
return json.Marshal(x)
case SelectionRangeRegistrationOptions:
return json.Marshal(x)
case bool:
return json.Marshal(x)
case nil:
return []byte("null"), nil
}
return nil, fmt.Errorf("type %T not one of [SelectionRangeOptions SelectionRangeRegistrationOptions bool]", t)
}
func (t *Or_ServerCapabilities_selectionRangeProvider) UnmarshalJSON(x []byte) error {
if string(x) == "null" {
t.Value = nil
return nil
}
decoder135 := json.NewDecoder(bytes.NewReader(x))
decoder135.DisallowUnknownFields()
var boolVal bool
if err := decoder135.Decode(&boolVal); err == nil {
t.Value = boolVal
return nil
}
decoder136 := json.NewDecoder(bytes.NewReader(x))
decoder136.DisallowUnknownFields()
var h136 SelectionRangeOptions
if err := decoder136.Decode(&h136); err == nil {
t.Value = h136
return nil
}
decoder137 := json.NewDecoder(bytes.NewReader(x))
decoder137.DisallowUnknownFields()
var h137 SelectionRangeRegistrationOptions
if err := decoder137.Decode(&h137); err == nil {
t.Value = h137
return nil
}
return &UnmarshalError{"unmarshal failed to match one of [SelectionRangeOptions SelectionRangeRegistrationOptions bool]"}
}
func (t Or_ServerCapabilities_semanticTokensProvider) MarshalJSON() ([]byte, error) {
switch x := t.Value.(type) {
case SemanticTokensOptions:
return json.Marshal(x)
case SemanticTokensRegistrationOptions:
return json.Marshal(x)
case nil:
return []byte("null"), nil
}
return nil, fmt.Errorf("type %T not one of [SemanticTokensOptions SemanticTokensRegistrationOptions]", t)
}
func (t *Or_ServerCapabilities_semanticTokensProvider) UnmarshalJSON(x []byte) error {
if string(x) == "null" {
t.Value = nil
return nil
}
decoder150 := json.NewDecoder(bytes.NewReader(x))
decoder150.DisallowUnknownFields()
var h150 SemanticTokensOptions
if err := decoder150.Decode(&h150); err == nil {
t.Value = h150
return nil
}
decoder151 := json.NewDecoder(bytes.NewReader(x))
decoder151.DisallowUnknownFields()
var h151 SemanticTokensRegistrationOptions
if err := decoder151.Decode(&h151); err == nil {
t.Value = h151
return nil
}
return &UnmarshalError{"unmarshal failed to match one of [SemanticTokensOptions SemanticTokensRegistrationOptions]"}
}
func (t Or_ServerCapabilities_textDocumentSync) MarshalJSON() ([]byte, error) {
switch x := t.Value.(type) {
case TextDocumentSyncKind:
return json.Marshal(x)
case TextDocumentSyncOptions:
return json.Marshal(x)
case nil:
return []byte("null"), nil
}
return nil, fmt.Errorf("type %T not one of [TextDocumentSyncKind TextDocumentSyncOptions]", t)
}
func (t *Or_ServerCapabilities_textDocumentSync) UnmarshalJSON(x []byte) error {
if string(x) == "null" {
t.Value = nil
return nil
}
decoder72 := json.NewDecoder(bytes.NewReader(x))
decoder72.DisallowUnknownFields()
var h72 TextDocumentSyncKind
if err := decoder72.Decode(&h72); err == nil {
t.Value = h72
return nil
}
decoder73 := json.NewDecoder(bytes.NewReader(x))
decoder73.DisallowUnknownFields()
var h73 TextDocumentSyncOptions
if err := decoder73.Decode(&h73); err == nil {
t.Value = h73
return nil
}
return &UnmarshalError{"unmarshal failed to match one of [TextDocumentSyncKind TextDocumentSyncOptions]"}
}
func (t Or_ServerCapabilities_typeDefinitionProvider) MarshalJSON() ([]byte, error) {
switch x := t.Value.(type) {
case TypeDefinitionOptions:
return json.Marshal(x)
case TypeDefinitionRegistrationOptions:
return json.Marshal(x)
case bool:
return json.Marshal(x)
case nil:
return []byte("null"), nil
}
return nil, fmt.Errorf("type %T not one of [TypeDefinitionOptions TypeDefinitionRegistrationOptions bool]", t)
}
func (t *Or_ServerCapabilities_typeDefinitionProvider) UnmarshalJSON(x []byte) error {
if string(x) == "null" {
t.Value = nil
return nil
}
decoder91 := json.NewDecoder(bytes.NewReader(x))
decoder91.DisallowUnknownFields()
var boolVal bool
if err := decoder91.Decode(&boolVal); err == nil {
t.Value = boolVal
return nil
}
decoder92 := json.NewDecoder(bytes.NewReader(x))
decoder92.DisallowUnknownFields()
var h92 TypeDefinitionOptions
if err := decoder92.Decode(&h92); err == nil {
t.Value = h92
return nil
}
decoder93 := json.NewDecoder(bytes.NewReader(x))
decoder93.DisallowUnknownFields()
var h93 TypeDefinitionRegistrationOptions
if err := decoder93.Decode(&h93); err == nil {
t.Value = h93
return nil
}
return &UnmarshalError{"unmarshal failed to match one of [TypeDefinitionOptions TypeDefinitionRegistrationOptions bool]"}
}
func (t Or_ServerCapabilities_typeHierarchyProvider) MarshalJSON() ([]byte, error) {
switch x := t.Value.(type) {
case TypeHierarchyOptions:
return json.Marshal(x)
case TypeHierarchyRegistrationOptions:
return json.Marshal(x)
case bool:
return json.Marshal(x)
case nil:
return []byte("null"), nil
}
return nil, fmt.Errorf("type %T not one of [TypeHierarchyOptions TypeHierarchyRegistrationOptions bool]", t)
}
func (t *Or_ServerCapabilities_typeHierarchyProvider) UnmarshalJSON(x []byte) error {
if string(x) == "null" {
t.Value = nil
return nil
}
decoder159 := json.NewDecoder(bytes.NewReader(x))
decoder159.DisallowUnknownFields()
var boolVal bool
if err := decoder159.Decode(&boolVal); err == nil {
t.Value = boolVal
return nil
}
decoder160 := json.NewDecoder(bytes.NewReader(x))
decoder160.DisallowUnknownFields()
var h160 TypeHierarchyOptions
if err := decoder160.Decode(&h160); err == nil {
t.Value = h160
return nil
}
decoder161 := json.NewDecoder(bytes.NewReader(x))
decoder161.DisallowUnknownFields()
var h161 TypeHierarchyRegistrationOptions
if err := decoder161.Decode(&h161); err == nil {
t.Value = h161
return nil
}
return &UnmarshalError{"unmarshal failed to match one of [TypeHierarchyOptions TypeHierarchyRegistrationOptions bool]"}
}
func (t Or_ServerCapabilities_workspaceSymbolProvider) MarshalJSON() ([]byte, error) {
switch x := t.Value.(type) {
case WorkspaceSymbolOptions:
return json.Marshal(x)
case bool:
return json.Marshal(x)
case nil:
return []byte("null"), nil
}
return nil, fmt.Errorf("type %T not one of [WorkspaceSymbolOptions bool]", t)
}
func (t *Or_ServerCapabilities_workspaceSymbolProvider) UnmarshalJSON(x []byte) error {
if string(x) == "null" {
t.Value = nil
return nil
}
decoder117 := json.NewDecoder(bytes.NewReader(x))
decoder117.DisallowUnknownFields()
var boolVal bool
if err := decoder117.Decode(&boolVal); err == nil {
t.Value = boolVal
return nil
}
decoder118 := json.NewDecoder(bytes.NewReader(x))
decoder118.DisallowUnknownFields()
var h118 WorkspaceSymbolOptions
if err := decoder118.Decode(&h118); err == nil {
t.Value = h118
return nil
}
return &UnmarshalError{"unmarshal failed to match one of [WorkspaceSymbolOptions bool]"}
}
func (t Or_SignatureInformation_documentation) MarshalJSON() ([]byte, error) {
switch x := t.Value.(type) {
case MarkupContent:
return json.Marshal(x)
case string:
return json.Marshal(x)
case nil:
return []byte("null"), nil
}
return nil, fmt.Errorf("type %T not one of [MarkupContent string]", t)
}
func (t *Or_SignatureInformation_documentation) UnmarshalJSON(x []byte) error {
if string(x) == "null" {
t.Value = nil
return nil
}
decoder186 := json.NewDecoder(bytes.NewReader(x))
decoder186.DisallowUnknownFields()
var stringVal string
if err := decoder186.Decode(&stringVal); err == nil {
t.Value = stringVal
return nil
}
decoder187 := json.NewDecoder(bytes.NewReader(x))
decoder187.DisallowUnknownFields()
var h187 MarkupContent
if err := decoder187.Decode(&h187); err == nil {
t.Value = h187
return nil
}
return &UnmarshalError{"unmarshal failed to match one of [MarkupContent string]"}
}
func (t Or_TextDocumentContentChangeEvent) MarshalJSON() ([]byte, error) {
switch x := t.Value.(type) {
case TextDocumentContentChangePartial:
return json.Marshal(x)
case TextDocumentContentChangeWholeDocument:
return json.Marshal(x)
case nil:
return []byte("null"), nil
}
return nil, fmt.Errorf("type %T not one of [TextDocumentContentChangePartial TextDocumentContentChangeWholeDocument]", t)
}
func (t *Or_TextDocumentContentChangeEvent) UnmarshalJSON(x []byte) error {
if string(x) == "null" {
t.Value = nil
return nil
}
decoder263 := json.NewDecoder(bytes.NewReader(x))
decoder263.DisallowUnknownFields()
var h263 TextDocumentContentChangePartial
if err := decoder263.Decode(&h263); err == nil {
t.Value = h263
return nil
}
decoder264 := json.NewDecoder(bytes.NewReader(x))
decoder264.DisallowUnknownFields()
var h264 TextDocumentContentChangeWholeDocument
if err := decoder264.Decode(&h264); err == nil {
t.Value = h264
return nil
}
return &UnmarshalError{"unmarshal failed to match one of [TextDocumentContentChangePartial TextDocumentContentChangeWholeDocument]"}
}
func (t Or_TextDocumentEdit_edits_Elem) MarshalJSON() ([]byte, error) {
switch x := t.Value.(type) {
case AnnotatedTextEdit:
return json.Marshal(x)
case SnippetTextEdit:
return json.Marshal(x)
case TextEdit:
return json.Marshal(x)
case nil:
return []byte("null"), nil
}
return nil, fmt.Errorf("type %T not one of [AnnotatedTextEdit SnippetTextEdit TextEdit]", t)
}
func (t *Or_TextDocumentEdit_edits_Elem) UnmarshalJSON(x []byte) error {
if string(x) == "null" {
t.Value = nil
return nil
}
decoder52 := json.NewDecoder(bytes.NewReader(x))
decoder52.DisallowUnknownFields()
var h52 AnnotatedTextEdit
if err := decoder52.Decode(&h52); err == nil {
t.Value = h52
return nil
}
decoder53 := json.NewDecoder(bytes.NewReader(x))
decoder53.DisallowUnknownFields()
var h53 SnippetTextEdit
if err := decoder53.Decode(&h53); err == nil {
t.Value = h53
return nil
}
decoder54 := json.NewDecoder(bytes.NewReader(x))
decoder54.DisallowUnknownFields()
var h54 TextEdit
if err := decoder54.Decode(&h54); err == nil {
t.Value = h54
return nil
}
return &UnmarshalError{"unmarshal failed to match one of [AnnotatedTextEdit SnippetTextEdit TextEdit]"}
}
func (t Or_TextDocumentFilter) MarshalJSON() ([]byte, error) {
switch x := t.Value.(type) {
case TextDocumentFilterLanguage:
return json.Marshal(x)
case TextDocumentFilterPattern:
return json.Marshal(x)
case TextDocumentFilterScheme:
return json.Marshal(x)
case nil:
return []byte("null"), nil
}
return nil, fmt.Errorf("type %T not one of [TextDocumentFilterLanguage TextDocumentFilterPattern TextDocumentFilterScheme]", t)
}
func (t *Or_TextDocumentFilter) UnmarshalJSON(x []byte) error {
if string(x) == "null" {
t.Value = nil
return nil
}
decoder279 := json.NewDecoder(bytes.NewReader(x))
decoder279.DisallowUnknownFields()
var h279 TextDocumentFilterLanguage
if err := decoder279.Decode(&h279); err == nil {
t.Value = h279
return nil
}
decoder280 := json.NewDecoder(bytes.NewReader(x))
decoder280.DisallowUnknownFields()
var h280 TextDocumentFilterPattern
if err := decoder280.Decode(&h280); err == nil {
t.Value = h280
return nil
}
decoder281 := json.NewDecoder(bytes.NewReader(x))
decoder281.DisallowUnknownFields()
var h281 TextDocumentFilterScheme
if err := decoder281.Decode(&h281); err == nil {
t.Value = h281
return nil
}
return &UnmarshalError{"unmarshal failed to match one of [TextDocumentFilterLanguage TextDocumentFilterPattern TextDocumentFilterScheme]"}
}
func (t Or_TextDocumentSyncOptions_save) MarshalJSON() ([]byte, error) {
switch x := t.Value.(type) {
case SaveOptions:
return json.Marshal(x)
case bool:
return json.Marshal(x)
case nil:
return []byte("null"), nil
}
return nil, fmt.Errorf("type %T not one of [SaveOptions bool]", t)
}
func (t *Or_TextDocumentSyncOptions_save) UnmarshalJSON(x []byte) error {
if string(x) == "null" {
t.Value = nil
return nil
}
decoder195 := json.NewDecoder(bytes.NewReader(x))
decoder195.DisallowUnknownFields()
var boolVal bool
if err := decoder195.Decode(&boolVal); err == nil {
t.Value = boolVal
return nil
}
decoder196 := json.NewDecoder(bytes.NewReader(x))
decoder196.DisallowUnknownFields()
var h196 SaveOptions
if err := decoder196.Decode(&h196); err == nil {
t.Value = h196
return nil
}
return &UnmarshalError{"unmarshal failed to match one of [SaveOptions bool]"}
}
func (t Or_WorkspaceDocumentDiagnosticReport) MarshalJSON() ([]byte, error) {
switch x := t.Value.(type) {
case WorkspaceFullDocumentDiagnosticReport:
return json.Marshal(x)
case WorkspaceUnchangedDocumentDiagnosticReport:
return json.Marshal(x)
case nil:
return []byte("null"), nil
}
return nil, fmt.Errorf("type %T not one of [WorkspaceFullDocumentDiagnosticReport WorkspaceUnchangedDocumentDiagnosticReport]", t)
}
func (t *Or_WorkspaceDocumentDiagnosticReport) UnmarshalJSON(x []byte) error {
if string(x) == "null" {
t.Value = nil
return nil
}
decoder259 := json.NewDecoder(bytes.NewReader(x))
decoder259.DisallowUnknownFields()
var h259 WorkspaceFullDocumentDiagnosticReport
if err := decoder259.Decode(&h259); err == nil {
t.Value = h259
return nil
}
decoder260 := json.NewDecoder(bytes.NewReader(x))
decoder260.DisallowUnknownFields()
var h260 WorkspaceUnchangedDocumentDiagnosticReport
if err := decoder260.Decode(&h260); err == nil {
t.Value = h260
return nil
}
return &UnmarshalError{"unmarshal failed to match one of [WorkspaceFullDocumentDiagnosticReport WorkspaceUnchangedDocumentDiagnosticReport]"}
}
func (t Or_WorkspaceEdit_documentChanges_Elem) MarshalJSON() ([]byte, error) {
switch x := t.Value.(type) {
case CreateFile:
return json.Marshal(x)
case DeleteFile:
return json.Marshal(x)
case RenameFile:
return json.Marshal(x)
case TextDocumentEdit:
return json.Marshal(x)
case nil:
return []byte("null"), nil
}
return nil, fmt.Errorf("type %T not one of [CreateFile DeleteFile RenameFile TextDocumentEdit]", t)
}
func (t *Or_WorkspaceEdit_documentChanges_Elem) UnmarshalJSON(x []byte) error {
if string(x) == "null" {
t.Value = nil
return nil
}
decoder4 := json.NewDecoder(bytes.NewReader(x))
decoder4.DisallowUnknownFields()
var h4 CreateFile
if err := decoder4.Decode(&h4); err == nil {
t.Value = h4
return nil
}
decoder5 := json.NewDecoder(bytes.NewReader(x))
decoder5.DisallowUnknownFields()
var h5 DeleteFile
if err := decoder5.Decode(&h5); err == nil {
t.Value = h5
return nil
}
decoder6 := json.NewDecoder(bytes.NewReader(x))
decoder6.DisallowUnknownFields()
var h6 RenameFile
if err := decoder6.Decode(&h6); err == nil {
t.Value = h6
return nil
}
decoder7 := json.NewDecoder(bytes.NewReader(x))
decoder7.DisallowUnknownFields()
var h7 TextDocumentEdit
if err := decoder7.Decode(&h7); err == nil {
t.Value = h7
return nil
}
return &UnmarshalError{"unmarshal failed to match one of [CreateFile DeleteFile RenameFile TextDocumentEdit]"}
}
func (t Or_WorkspaceFoldersServerCapabilities_changeNotifications) MarshalJSON() ([]byte, error) {
switch x := t.Value.(type) {
case bool:
return json.Marshal(x)
case string:
return json.Marshal(x)
case nil:
return []byte("null"), nil
}
return nil, fmt.Errorf("type %T not one of [bool string]", t)
}
func (t *Or_WorkspaceFoldersServerCapabilities_changeNotifications) UnmarshalJSON(x []byte) error {
if string(x) == "null" {
t.Value = nil
return nil
}
decoder210 := json.NewDecoder(bytes.NewReader(x))
decoder210.DisallowUnknownFields()
var boolVal bool
if err := decoder210.Decode(&boolVal); err == nil {
t.Value = boolVal
return nil
}
decoder211 := json.NewDecoder(bytes.NewReader(x))
decoder211.DisallowUnknownFields()
var stringVal string
if err := decoder211.Decode(&stringVal); err == nil {
t.Value = stringVal
return nil
}
return &UnmarshalError{"unmarshal failed to match one of [bool string]"}
}
func (t Or_WorkspaceOptions_textDocumentContent) MarshalJSON() ([]byte, error) {
switch x := t.Value.(type) {
case TextDocumentContentOptions:
return json.Marshal(x)
case TextDocumentContentRegistrationOptions:
return json.Marshal(x)
case nil:
return []byte("null"), nil
}
return nil, fmt.Errorf("type %T not one of [TextDocumentContentOptions TextDocumentContentRegistrationOptions]", t)
}
func (t *Or_WorkspaceOptions_textDocumentContent) UnmarshalJSON(x []byte) error {
if string(x) == "null" {
t.Value = nil
return nil
}
decoder199 := json.NewDecoder(bytes.NewReader(x))
decoder199.DisallowUnknownFields()
var h199 TextDocumentContentOptions
if err := decoder199.Decode(&h199); err == nil {
t.Value = h199
return nil
}
decoder200 := json.NewDecoder(bytes.NewReader(x))
decoder200.DisallowUnknownFields()
var h200 TextDocumentContentRegistrationOptions
if err := decoder200.Decode(&h200); err == nil {
t.Value = h200
return nil
}
return &UnmarshalError{"unmarshal failed to match one of [TextDocumentContentOptions TextDocumentContentRegistrationOptions]"}
}
func (t Or_WorkspaceSymbol_location) MarshalJSON() ([]byte, error) {
switch x := t.Value.(type) {
case Location:
return json.Marshal(x)
case LocationUriOnly:
return json.Marshal(x)
case nil:
return []byte("null"), nil
}
return nil, fmt.Errorf("type %T not one of [Location LocationUriOnly]", t)
}
func (t *Or_WorkspaceSymbol_location) UnmarshalJSON(x []byte) error {
if string(x) == "null" {
t.Value = nil
return nil
}
decoder39 := json.NewDecoder(bytes.NewReader(x))
decoder39.DisallowUnknownFields()
var h39 Location
if err := decoder39.Decode(&h39); err == nil {
t.Value = h39
return nil
}
decoder40 := json.NewDecoder(bytes.NewReader(x))
decoder40.DisallowUnknownFields()
var h40 LocationUriOnly
if err := decoder40.Decode(&h40); err == nil {
t.Value = h40
return nil
}
return &UnmarshalError{"unmarshal failed to match one of [Location LocationUriOnly]"}
}
+6907
View File
@@ -0,0 +1,6907 @@
// Copyright 2023 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// Code generated for LSP. DO NOT EDIT.
package protocol
// Code generated from protocol/metaModel.json at ref release/protocol/3.17.6-next.9 (hash c94395b5da53729e6dff931293b051009ccaaaa4).
// https://github.com/microsoft/vscode-languageserver-node/blob/release/protocol/3.17.6-next.9/protocol/metaModel.json
// LSP metaData.version = 3.17.0.
import "encoding/json"
// created for And
type And_RegOpt_textDocument_colorPresentation struct {
WorkDoneProgressOptions
TextDocumentRegistrationOptions
}
// A special text edit with an additional change annotation.
//
// @since 3.16.0.
//
// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#annotatedTextEdit
type AnnotatedTextEdit struct {
// The actual identifier of the change annotation
AnnotationID *ChangeAnnotationIdentifier `json:"annotationId,omitempty"`
TextEdit
}
// The parameters passed via an apply workspace edit request.
//
// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#applyWorkspaceEditParams
type ApplyWorkspaceEditParams struct {
// An optional label of the workspace edit. This label is
// presented in the user interface for example on an undo
// stack to undo the workspace edit.
Label string `json:"label,omitempty"`
// The edits to apply.
Edit WorkspaceEdit `json:"edit"`
// Additional data about the edit.
//
// @since 3.18.0
// @proposed
Metadata *WorkspaceEditMetadata `json:"metadata,omitempty"`
}
// The result returned from the apply workspace edit request.
//
// @since 3.17 renamed from ApplyWorkspaceEditResponse
//
// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#applyWorkspaceEditResult
type ApplyWorkspaceEditResult struct {
// Indicates whether the edit was applied or not.
Applied bool `json:"applied"`
// An optional textual description for why the edit was not applied.
// This may be used by the server for diagnostic logging or to provide
// a suitable error for a request that triggered the edit.
FailureReason string `json:"failureReason,omitempty"`
// Depending on the client's failure handling strategy `failedChange` might
// contain the index of the change that failed. This property is only available
// if the client signals a `failureHandlingStrategy` in its client capabilities.
FailedChange uint32 `json:"failedChange,omitempty"`
}
// A base for all symbol information.
//
// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#baseSymbolInformation
type BaseSymbolInformation struct {
// The name of this symbol.
Name string `json:"name"`
// The kind of this symbol.
Kind SymbolKind `json:"kind"`
// Tags for this symbol.
//
// @since 3.16.0
Tags []SymbolTag `json:"tags,omitempty"`
// The name of the symbol containing this symbol. This information is for
// user interface purposes (e.g. to render a qualifier in the user interface
// if necessary). It can't be used to re-infer a hierarchy for the document
// symbols.
ContainerName string `json:"containerName,omitempty"`
}
// @since 3.16.0
//
// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#callHierarchyClientCapabilities
type CallHierarchyClientCapabilities struct {
// Whether implementation supports dynamic registration. If this is set to `true`
// the client supports the new `(TextDocumentRegistrationOptions & StaticRegistrationOptions)`
// return value for the corresponding server capability as well.
DynamicRegistration bool `json:"dynamicRegistration,omitempty"`
}
// Represents an incoming call, e.g. a caller of a method or constructor.
//
// @since 3.16.0
//
// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#callHierarchyIncomingCall
type CallHierarchyIncomingCall struct {
// The item that makes the call.
From CallHierarchyItem `json:"from"`
// The ranges at which the calls appear. This is relative to the caller
// denoted by {@link CallHierarchyIncomingCall.from `this.from`}.
FromRanges []Range `json:"fromRanges"`
}
// The parameter of a `callHierarchy/incomingCalls` request.
//
// @since 3.16.0
//
// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#callHierarchyIncomingCallsParams
type CallHierarchyIncomingCallsParams struct {
Item CallHierarchyItem `json:"item"`
WorkDoneProgressParams
PartialResultParams
}
// Represents programming constructs like functions or constructors in the context
// of call hierarchy.
//
// @since 3.16.0
//
// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#callHierarchyItem
type CallHierarchyItem struct {
// The name of this item.
Name string `json:"name"`
// The kind of this item.
Kind SymbolKind `json:"kind"`
// Tags for this item.
Tags []SymbolTag `json:"tags,omitempty"`
// More detail for this item, e.g. the signature of a function.
Detail string `json:"detail,omitempty"`
// The resource identifier of this item.
URI DocumentUri `json:"uri"`
// The range enclosing this symbol not including leading/trailing whitespace but everything else, e.g. comments and code.
Range Range `json:"range"`
// The range that should be selected and revealed when this symbol is being picked, e.g. the name of a function.
// Must be contained by the {@link CallHierarchyItem.range `range`}.
SelectionRange Range `json:"selectionRange"`
// A data entry field that is preserved between a call hierarchy prepare and
// incoming calls or outgoing calls requests.
Data interface{} `json:"data,omitempty"`
}
// Call hierarchy options used during static registration.
//
// @since 3.16.0
//
// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#callHierarchyOptions
type CallHierarchyOptions struct {
WorkDoneProgressOptions
}
// Represents an outgoing call, e.g. calling a getter from a method or a method from a constructor etc.
//
// @since 3.16.0
//
// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#callHierarchyOutgoingCall
type CallHierarchyOutgoingCall struct {
// The item that is called.
To CallHierarchyItem `json:"to"`
// The range at which this item is called. This is the range relative to the caller, e.g the item
// passed to {@link CallHierarchyItemProvider.provideCallHierarchyOutgoingCalls `provideCallHierarchyOutgoingCalls`}
// and not {@link CallHierarchyOutgoingCall.to `this.to`}.
FromRanges []Range `json:"fromRanges"`
}
// The parameter of a `callHierarchy/outgoingCalls` request.
//
// @since 3.16.0
//
// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#callHierarchyOutgoingCallsParams
type CallHierarchyOutgoingCallsParams struct {
Item CallHierarchyItem `json:"item"`
WorkDoneProgressParams
PartialResultParams
}
// The parameter of a `textDocument/prepareCallHierarchy` request.
//
// @since 3.16.0
//
// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#callHierarchyPrepareParams
type CallHierarchyPrepareParams struct {
TextDocumentPositionParams
WorkDoneProgressParams
}
// Call hierarchy options used during static or dynamic registration.
//
// @since 3.16.0
//
// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#callHierarchyRegistrationOptions
type CallHierarchyRegistrationOptions struct {
TextDocumentRegistrationOptions
CallHierarchyOptions
StaticRegistrationOptions
}
// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#cancelParams
type CancelParams struct {
// The request id to cancel.
ID interface{} `json:"id"`
}
// Additional information that describes document changes.
//
// @since 3.16.0
//
// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#changeAnnotation
type ChangeAnnotation struct {
// A human-readable string describing the actual change. The string
// is rendered prominent in the user interface.
Label string `json:"label"`
// A flag which indicates that user confirmation is needed
// before applying the change.
NeedsConfirmation bool `json:"needsConfirmation,omitempty"`
// A human-readable string which is rendered less prominent in
// the user interface.
Description string `json:"description,omitempty"`
}
// An identifier to refer to a change annotation stored with a workspace edit.
//
// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#changeAnnotationIdentifier
type ChangeAnnotationIdentifier = string // (alias)
// @since 3.18.0
//
// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#changeAnnotationsSupportOptions
type ChangeAnnotationsSupportOptions struct {
// Whether the client groups edits with equal labels into tree nodes,
// for instance all edits labelled with "Changes in Strings" would
// be a tree node.
GroupsOnLabel bool `json:"groupsOnLabel,omitempty"`
}
// Defines the capabilities provided by the client.
//
// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#clientCapabilities
type ClientCapabilities struct {
// Workspace specific client capabilities.
Workspace WorkspaceClientCapabilities `json:"workspace,omitempty"`
// Text document specific client capabilities.
TextDocument TextDocumentClientCapabilities `json:"textDocument,omitempty"`
// Capabilities specific to the notebook document support.
//
// @since 3.17.0
NotebookDocument *NotebookDocumentClientCapabilities `json:"notebookDocument,omitempty"`
// Window specific client capabilities.
Window WindowClientCapabilities `json:"window,omitempty"`
// General client capabilities.
//
// @since 3.16.0
General *GeneralClientCapabilities `json:"general,omitempty"`
// Experimental client capabilities.
Experimental interface{} `json:"experimental,omitempty"`
}
// @since 3.18.0
//
// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#clientCodeActionKindOptions
type ClientCodeActionKindOptions struct {
// The code action kind values the client supports. When this
// property exists the client also guarantees that it will
// handle values outside its set gracefully and falls back
// to a default value when unknown.
ValueSet []CodeActionKind `json:"valueSet"`
}
// @since 3.18.0
//
// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#clientCodeActionLiteralOptions
type ClientCodeActionLiteralOptions struct {
// The code action kind is support with the following value
// set.
CodeActionKind ClientCodeActionKindOptions `json:"codeActionKind"`
}
// @since 3.18.0
//
// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#clientCodeActionResolveOptions
type ClientCodeActionResolveOptions struct {
// The properties that a client can resolve lazily.
Properties []string `json:"properties"`
}
// @since 3.18.0
//
// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#clientCodeLensResolveOptions
type ClientCodeLensResolveOptions struct {
// The properties that a client can resolve lazily.
Properties []string `json:"properties"`
}
// @since 3.18.0
//
// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#clientCompletionItemInsertTextModeOptions
type ClientCompletionItemInsertTextModeOptions struct {
ValueSet []InsertTextMode `json:"valueSet"`
}
// @since 3.18.0
//
// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#clientCompletionItemOptions
type ClientCompletionItemOptions struct {
// Client supports snippets as insert text.
//
// A snippet can define tab stops and placeholders with `$1`, `$2`
// and `${3:foo}`. `$0` defines the final tab stop, it defaults to
// the end of the snippet. Placeholders with equal identifiers are linked,
// that is typing in one will update others too.
SnippetSupport bool `json:"snippetSupport,omitempty"`
// Client supports commit characters on a completion item.
CommitCharactersSupport bool `json:"commitCharactersSupport,omitempty"`
// Client supports the following content formats for the documentation
// property. The order describes the preferred format of the client.
DocumentationFormat []MarkupKind `json:"documentationFormat,omitempty"`
// Client supports the deprecated property on a completion item.
DeprecatedSupport bool `json:"deprecatedSupport,omitempty"`
// Client supports the preselect property on a completion item.
PreselectSupport bool `json:"preselectSupport,omitempty"`
// Client supports the tag property on a completion item. Clients supporting
// tags have to handle unknown tags gracefully. Clients especially need to
// preserve unknown tags when sending a completion item back to the server in
// a resolve call.
//
// @since 3.15.0
TagSupport *CompletionItemTagOptions `json:"tagSupport,omitempty"`
// Client support insert replace edit to control different behavior if a
// completion item is inserted in the text or should replace text.
//
// @since 3.16.0
InsertReplaceSupport bool `json:"insertReplaceSupport,omitempty"`
// Indicates which properties a client can resolve lazily on a completion
// item. Before version 3.16.0 only the predefined properties `documentation`
// and `details` could be resolved lazily.
//
// @since 3.16.0
ResolveSupport *ClientCompletionItemResolveOptions `json:"resolveSupport,omitempty"`
// The client supports the `insertTextMode` property on
// a completion item to override the whitespace handling mode
// as defined by the client (see `insertTextMode`).
//
// @since 3.16.0
InsertTextModeSupport *ClientCompletionItemInsertTextModeOptions `json:"insertTextModeSupport,omitempty"`
// The client has support for completion item label
// details (see also `CompletionItemLabelDetails`).
//
// @since 3.17.0
LabelDetailsSupport bool `json:"labelDetailsSupport,omitempty"`
}
// @since 3.18.0
//
// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#clientCompletionItemOptionsKind
type ClientCompletionItemOptionsKind struct {
// The completion item kind values the client supports. When this
// property exists the client also guarantees that it will
// handle values outside its set gracefully and falls back
// to a default value when unknown.
//
// If this property is not present the client only supports
// the completion items kinds from `Text` to `Reference` as defined in
// the initial version of the protocol.
ValueSet []CompletionItemKind `json:"valueSet,omitempty"`
}
// @since 3.18.0
//
// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#clientCompletionItemResolveOptions
type ClientCompletionItemResolveOptions struct {
// The properties that a client can resolve lazily.
Properties []string `json:"properties"`
}
// @since 3.18.0
//
// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#clientDiagnosticsTagOptions
type ClientDiagnosticsTagOptions struct {
// The tags supported by the client.
ValueSet []DiagnosticTag `json:"valueSet"`
}
// @since 3.18.0
//
// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#clientFoldingRangeKindOptions
type ClientFoldingRangeKindOptions struct {
// The folding range kind values the client supports. When this
// property exists the client also guarantees that it will
// handle values outside its set gracefully and falls back
// to a default value when unknown.
ValueSet []FoldingRangeKind `json:"valueSet,omitempty"`
}
// @since 3.18.0
//
// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#clientFoldingRangeOptions
type ClientFoldingRangeOptions struct {
// If set, the client signals that it supports setting collapsedText on
// folding ranges to display custom labels instead of the default text.
//
// @since 3.17.0
CollapsedText bool `json:"collapsedText,omitempty"`
}
// Information about the client
//
// @since 3.15.0
// @since 3.18.0 ClientInfo type name added.
//
// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#clientInfo
type ClientInfo struct {
// The name of the client as defined by the client.
Name string `json:"name"`
// The client's version as defined by the client.
Version string `json:"version,omitempty"`
}
// @since 3.18.0
//
// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#clientInlayHintResolveOptions
type ClientInlayHintResolveOptions struct {
// The properties that a client can resolve lazily.
Properties []string `json:"properties"`
}
// @since 3.18.0
//
// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#clientSemanticTokensRequestFullDelta
type ClientSemanticTokensRequestFullDelta struct {
// The client will send the `textDocument/semanticTokens/full/delta` request if
// the server provides a corresponding handler.
Delta bool `json:"delta,omitempty"`
}
// @since 3.18.0
//
// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#clientSemanticTokensRequestOptions
type ClientSemanticTokensRequestOptions struct {
// The client will send the `textDocument/semanticTokens/range` request if
// the server provides a corresponding handler.
Range *Or_ClientSemanticTokensRequestOptions_range `json:"range,omitempty"`
// The client will send the `textDocument/semanticTokens/full` request if
// the server provides a corresponding handler.
Full *Or_ClientSemanticTokensRequestOptions_full `json:"full,omitempty"`
}
// @since 3.18.0
//
// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#clientShowMessageActionItemOptions
type ClientShowMessageActionItemOptions struct {
// Whether the client supports additional attributes which
// are preserved and send back to the server in the
// request's response.
AdditionalPropertiesSupport bool `json:"additionalPropertiesSupport,omitempty"`
}
// @since 3.18.0
//
// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#clientSignatureInformationOptions
type ClientSignatureInformationOptions struct {
// Client supports the following content formats for the documentation
// property. The order describes the preferred format of the client.
DocumentationFormat []MarkupKind `json:"documentationFormat,omitempty"`
// Client capabilities specific to parameter information.
ParameterInformation *ClientSignatureParameterInformationOptions `json:"parameterInformation,omitempty"`
// The client supports the `activeParameter` property on `SignatureInformation`
// literal.
//
// @since 3.16.0
ActiveParameterSupport bool `json:"activeParameterSupport,omitempty"`
// The client supports the `activeParameter` property on
// `SignatureHelp`/`SignatureInformation` being set to `null` to
// indicate that no parameter should be active.
//
// @since 3.18.0
// @proposed
NoActiveParameterSupport bool `json:"noActiveParameterSupport,omitempty"`
}
// @since 3.18.0
//
// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#clientSignatureParameterInformationOptions
type ClientSignatureParameterInformationOptions struct {
// The client supports processing label offsets instead of a
// simple label string.
//
// @since 3.14.0
LabelOffsetSupport bool `json:"labelOffsetSupport,omitempty"`
}
// @since 3.18.0
//
// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#clientSymbolKindOptions
type ClientSymbolKindOptions struct {
// The symbol kind values the client supports. When this
// property exists the client also guarantees that it will
// handle values outside its set gracefully and falls back
// to a default value when unknown.
//
// If this property is not present the client only supports
// the symbol kinds from `File` to `Array` as defined in
// the initial version of the protocol.
ValueSet []SymbolKind `json:"valueSet,omitempty"`
}
// @since 3.18.0
//
// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#clientSymbolResolveOptions
type ClientSymbolResolveOptions struct {
// The properties that a client can resolve lazily. Usually
// `location.range`
Properties []string `json:"properties"`
}
// @since 3.18.0
//
// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#clientSymbolTagOptions
type ClientSymbolTagOptions struct {
// The tags supported by the client.
ValueSet []SymbolTag `json:"valueSet"`
}
// A code action represents a change that can be performed in code, e.g. to fix a problem or
// to refactor code.
//
// A CodeAction must set either `edit` and/or a `command`. If both are supplied, the `edit` is applied first, then the `command` is executed.
//
// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#codeAction
type CodeAction struct {
// A short, human-readable, title for this code action.
Title string `json:"title"`
// The kind of the code action.
//
// Used to filter code actions.
Kind CodeActionKind `json:"kind,omitempty"`
// The diagnostics that this code action resolves.
Diagnostics []Diagnostic `json:"diagnostics,omitempty"`
// Marks this as a preferred action. Preferred actions are used by the `auto fix` command and can be targeted
// by keybindings.
//
// A quick fix should be marked preferred if it properly addresses the underlying error.
// A refactoring should be marked preferred if it is the most reasonable choice of actions to take.
//
// @since 3.15.0
IsPreferred bool `json:"isPreferred,omitempty"`
// Marks that the code action cannot currently be applied.
//
// Clients should follow the following guidelines regarding disabled code actions:
//
// - Disabled code actions are not shown in automatic [lightbulbs](https://code.visualstudio.com/docs/editor/editingevolved#_code-action)
// code action menus.
//
// - Disabled actions are shown as faded out in the code action menu when the user requests a more specific type
// of code action, such as refactorings.
//
// - If the user has a [keybinding](https://code.visualstudio.com/docs/editor/refactoring#_keybindings-for-code-actions)
// that auto applies a code action and only disabled code actions are returned, the client should show the user an
// error message with `reason` in the editor.
//
// @since 3.16.0
Disabled *CodeActionDisabled `json:"disabled,omitempty"`
// The workspace edit this code action performs.
Edit *WorkspaceEdit `json:"edit,omitempty"`
// A command this code action executes. If a code action
// provides an edit and a command, first the edit is
// executed and then the command.
Command *Command `json:"command,omitempty"`
// A data entry field that is preserved on a code action between
// a `textDocument/codeAction` and a `codeAction/resolve` request.
//
// @since 3.16.0
Data *json.RawMessage `json:"data,omitempty"`
}
// The Client Capabilities of a {@link CodeActionRequest}.
//
// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#codeActionClientCapabilities
type CodeActionClientCapabilities struct {
// Whether code action supports dynamic registration.
DynamicRegistration bool `json:"dynamicRegistration,omitempty"`
// The client support code action literals of type `CodeAction` as a valid
// response of the `textDocument/codeAction` request. If the property is not
// set the request can only return `Command` literals.
//
// @since 3.8.0
CodeActionLiteralSupport ClientCodeActionLiteralOptions `json:"codeActionLiteralSupport,omitempty"`
// Whether code action supports the `isPreferred` property.
//
// @since 3.15.0
IsPreferredSupport bool `json:"isPreferredSupport,omitempty"`
// Whether code action supports the `disabled` property.
//
// @since 3.16.0
DisabledSupport bool `json:"disabledSupport,omitempty"`
// Whether code action supports the `data` property which is
// preserved between a `textDocument/codeAction` and a
// `codeAction/resolve` request.
//
// @since 3.16.0
DataSupport bool `json:"dataSupport,omitempty"`
// Whether the client supports resolving additional code action
// properties via a separate `codeAction/resolve` request.
//
// @since 3.16.0
ResolveSupport *ClientCodeActionResolveOptions `json:"resolveSupport,omitempty"`
// Whether the client honors the change annotations in
// text edits and resource operations returned via the
// `CodeAction#edit` property by for example presenting
// the workspace edit in the user interface and asking
// for confirmation.
//
// @since 3.16.0
HonorsChangeAnnotations bool `json:"honorsChangeAnnotations,omitempty"`
// Whether the client supports documentation for a class of
// code actions.
//
// @since 3.18.0
// @proposed
DocumentationSupport bool `json:"documentationSupport,omitempty"`
}
// Contains additional diagnostic information about the context in which
// a {@link CodeActionProvider.provideCodeActions code action} is run.
//
// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#codeActionContext
type CodeActionContext struct {
// An array of diagnostics known on the client side overlapping the range provided to the
// `textDocument/codeAction` request. They are provided so that the server knows which
// errors are currently presented to the user for the given range. There is no guarantee
// that these accurately reflect the error state of the resource. The primary parameter
// to compute code actions is the provided range.
Diagnostics []Diagnostic `json:"diagnostics"`
// Requested kind of actions to return.
//
// Actions not of this kind are filtered out by the client before being shown. So servers
// can omit computing them.
Only []CodeActionKind `json:"only,omitempty"`
// The reason why code actions were requested.
//
// @since 3.17.0
TriggerKind *CodeActionTriggerKind `json:"triggerKind,omitempty"`
}
// Captures why the code action is currently disabled.
//
// @since 3.18.0
//
// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#codeActionDisabled
type CodeActionDisabled struct {
// Human readable description of why the code action is currently disabled.
//
// This is displayed in the code actions UI.
Reason string `json:"reason"`
}
// A set of predefined code action kinds
type CodeActionKind string
// Documentation for a class of code actions.
//
// @since 3.18.0
// @proposed
//
// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#codeActionKindDocumentation
type CodeActionKindDocumentation struct {
// The kind of the code action being documented.
//
// If the kind is generic, such as `CodeActionKind.Refactor`, the documentation will be shown whenever any
// refactorings are returned. If the kind if more specific, such as `CodeActionKind.RefactorExtract`, the
// documentation will only be shown when extract refactoring code actions are returned.
Kind CodeActionKind `json:"kind"`
// Command that is ued to display the documentation to the user.
//
// The title of this documentation code action is taken from {@linkcode Command.title}
Command Command `json:"command"`
}
// Provider options for a {@link CodeActionRequest}.
//
// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#codeActionOptions
type CodeActionOptions struct {
// CodeActionKinds that this server may return.
//
// The list of kinds may be generic, such as `CodeActionKind.Refactor`, or the server
// may list out every specific kind they provide.
CodeActionKinds []CodeActionKind `json:"codeActionKinds,omitempty"`
// Static documentation for a class of code actions.
//
// Documentation from the provider should be shown in the code actions menu if either:
//
//
// - Code actions of `kind` are requested by the editor. In this case, the editor will show the documentation that
// most closely matches the requested code action kind. For example, if a provider has documentation for
// both `Refactor` and `RefactorExtract`, when the user requests code actions for `RefactorExtract`,
// the editor will use the documentation for `RefactorExtract` instead of the documentation for `Refactor`.
//
//
// - Any code actions of `kind` are returned by the provider.
//
// At most one documentation entry should be shown per provider.
//
// @since 3.18.0
// @proposed
Documentation []CodeActionKindDocumentation `json:"documentation,omitempty"`
// The server provides support to resolve additional
// information for a code action.
//
// @since 3.16.0
ResolveProvider bool `json:"resolveProvider,omitempty"`
WorkDoneProgressOptions
}
// The parameters of a {@link CodeActionRequest}.
//
// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#codeActionParams
type CodeActionParams struct {
// The document in which the command was invoked.
TextDocument TextDocumentIdentifier `json:"textDocument"`
// The range for which the command was invoked.
Range Range `json:"range"`
// Context carrying additional information.
Context CodeActionContext `json:"context"`
WorkDoneProgressParams
PartialResultParams
}
// Registration options for a {@link CodeActionRequest}.
//
// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#codeActionRegistrationOptions
type CodeActionRegistrationOptions struct {
TextDocumentRegistrationOptions
CodeActionOptions
}
// The reason why code actions were requested.
//
// @since 3.17.0
type CodeActionTriggerKind uint32
// Structure to capture a description for an error code.
//
// @since 3.16.0
//
// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#codeDescription
type CodeDescription struct {
// An URI to open with more information about the diagnostic error.
Href URI `json:"href"`
}
// A code lens represents a {@link Command command} that should be shown along with
// source text, like the number of references, a way to run tests, etc.
//
// A code lens is _unresolved_ when no command is associated to it. For performance
// reasons the creation of a code lens and resolving should be done in two stages.
//
// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#codeLens
type CodeLens struct {
// The range in which this code lens is valid. Should only span a single line.
Range Range `json:"range"`
// The command this code lens represents.
Command *Command `json:"command,omitempty"`
// A data entry field that is preserved on a code lens item between
// a {@link CodeLensRequest} and a {@link CodeLensResolveRequest}
Data interface{} `json:"data,omitempty"`
}
// The client capabilities of a {@link CodeLensRequest}.
//
// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#codeLensClientCapabilities
type CodeLensClientCapabilities struct {
// Whether code lens supports dynamic registration.
DynamicRegistration bool `json:"dynamicRegistration,omitempty"`
// Whether the client supports resolving additional code lens
// properties via a separate `codeLens/resolve` request.
//
// @since 3.18.0
ResolveSupport *ClientCodeLensResolveOptions `json:"resolveSupport,omitempty"`
}
// Code Lens provider options of a {@link CodeLensRequest}.
//
// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#codeLensOptions
type CodeLensOptions struct {
// Code lens has a resolve provider as well.
ResolveProvider bool `json:"resolveProvider,omitempty"`
WorkDoneProgressOptions
}
// The parameters of a {@link CodeLensRequest}.
//
// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#codeLensParams
type CodeLensParams struct {
// The document to request code lens for.
TextDocument TextDocumentIdentifier `json:"textDocument"`
WorkDoneProgressParams
PartialResultParams
}
// Registration options for a {@link CodeLensRequest}.
//
// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#codeLensRegistrationOptions
type CodeLensRegistrationOptions struct {
TextDocumentRegistrationOptions
CodeLensOptions
}
// @since 3.16.0
//
// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#codeLensWorkspaceClientCapabilities
type CodeLensWorkspaceClientCapabilities struct {
// Whether the client implementation supports a refresh request sent from the
// server to the client.
//
// Note that this event is global and will force the client to refresh all
// code lenses currently shown. It should be used with absolute care and is
// useful for situation where a server for example detect a project wide
// change that requires such a calculation.
RefreshSupport bool `json:"refreshSupport,omitempty"`
}
// Represents a color in RGBA space.
//
// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#color
type Color struct {
// The red component of this color in the range [0-1].
Red float64 `json:"red"`
// The green component of this color in the range [0-1].
Green float64 `json:"green"`
// The blue component of this color in the range [0-1].
Blue float64 `json:"blue"`
// The alpha component of this color in the range [0-1].
Alpha float64 `json:"alpha"`
}
// Represents a color range from a document.
//
// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#colorInformation
type ColorInformation struct {
// The range in the document where this color appears.
Range Range `json:"range"`
// The actual color value for this color range.
Color Color `json:"color"`
}
// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#colorPresentation
type ColorPresentation struct {
// The label of this color presentation. It will be shown on the color
// picker header. By default this is also the text that is inserted when selecting
// this color presentation.
Label string `json:"label"`
// An {@link TextEdit edit} which is applied to a document when selecting
// this presentation for the color. When `falsy` the {@link ColorPresentation.label label}
// is used.
TextEdit *TextEdit `json:"textEdit,omitempty"`
// An optional array of additional {@link TextEdit text edits} that are applied when
// selecting this color presentation. Edits must not overlap with the main {@link ColorPresentation.textEdit edit} nor with themselves.
AdditionalTextEdits []TextEdit `json:"additionalTextEdits,omitempty"`
}
// Parameters for a {@link ColorPresentationRequest}.
//
// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#colorPresentationParams
type ColorPresentationParams struct {
// The text document.
TextDocument TextDocumentIdentifier `json:"textDocument"`
// The color to request presentations for.
Color Color `json:"color"`
// The range where the color would be inserted. Serves as a context.
Range Range `json:"range"`
WorkDoneProgressParams
PartialResultParams
}
// Represents a reference to a command. Provides a title which
// will be used to represent a command in the UI and, optionally,
// an array of arguments which will be passed to the command handler
// function when invoked.
//
// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#command
type Command struct {
// Title of the command, like `save`.
Title string `json:"title"`
// An optional tooltip.
//
// @since 3.18.0
// @proposed
Tooltip string `json:"tooltip,omitempty"`
// The identifier of the actual command handler.
Command string `json:"command"`
// Arguments that the command handler should be
// invoked with.
Arguments []json.RawMessage `json:"arguments,omitempty"`
}
// Completion client capabilities
//
// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#completionClientCapabilities
type CompletionClientCapabilities struct {
// Whether completion supports dynamic registration.
DynamicRegistration bool `json:"dynamicRegistration,omitempty"`
// The client supports the following `CompletionItem` specific
// capabilities.
CompletionItem ClientCompletionItemOptions `json:"completionItem,omitempty"`
CompletionItemKind *ClientCompletionItemOptionsKind `json:"completionItemKind,omitempty"`
// Defines how the client handles whitespace and indentation
// when accepting a completion item that uses multi line
// text in either `insertText` or `textEdit`.
//
// @since 3.17.0
InsertTextMode InsertTextMode `json:"insertTextMode,omitempty"`
// The client supports to send additional context information for a
// `textDocument/completion` request.
ContextSupport bool `json:"contextSupport,omitempty"`
// The client supports the following `CompletionList` specific
// capabilities.
//
// @since 3.17.0
CompletionList *CompletionListCapabilities `json:"completionList,omitempty"`
}
// Contains additional information about the context in which a completion request is triggered.
//
// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#completionContext
type CompletionContext struct {
// How the completion was triggered.
TriggerKind CompletionTriggerKind `json:"triggerKind"`
// The trigger character (a single character) that has trigger code complete.
// Is undefined if `triggerKind !== CompletionTriggerKind.TriggerCharacter`
TriggerCharacter string `json:"triggerCharacter,omitempty"`
}
// A completion item represents a text snippet that is
// proposed to complete text that is being typed.
//
// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#completionItem
type CompletionItem struct {
// The label of this completion item.
//
// The label property is also by default the text that
// is inserted when selecting this completion.
//
// If label details are provided the label itself should
// be an unqualified name of the completion item.
Label string `json:"label"`
// Additional details for the label
//
// @since 3.17.0
LabelDetails *CompletionItemLabelDetails `json:"labelDetails,omitempty"`
// The kind of this completion item. Based of the kind
// an icon is chosen by the editor.
Kind CompletionItemKind `json:"kind,omitempty"`
// Tags for this completion item.
//
// @since 3.15.0
Tags []CompletionItemTag `json:"tags,omitempty"`
// A human-readable string with additional information
// about this item, like type or symbol information.
Detail string `json:"detail,omitempty"`
// A human-readable string that represents a doc-comment.
Documentation *Or_CompletionItem_documentation `json:"documentation,omitempty"`
// Indicates if this item is deprecated.
// @deprecated Use `tags` instead.
Deprecated bool `json:"deprecated,omitempty"`
// Select this item when showing.
//
// *Note* that only one completion item can be selected and that the
// tool / client decides which item that is. The rule is that the *first*
// item of those that match best is selected.
Preselect bool `json:"preselect,omitempty"`
// A string that should be used when comparing this item
// with other items. When `falsy` the {@link CompletionItem.label label}
// is used.
SortText string `json:"sortText,omitempty"`
// A string that should be used when filtering a set of
// completion items. When `falsy` the {@link CompletionItem.label label}
// is used.
FilterText string `json:"filterText,omitempty"`
// A string that should be inserted into a document when selecting
// this completion. When `falsy` the {@link CompletionItem.label label}
// is used.
//
// The `insertText` is subject to interpretation by the client side.
// Some tools might not take the string literally. For example
// VS Code when code complete is requested in this example
// `con<cursor position>` and a completion item with an `insertText` of
// `console` is provided it will only insert `sole`. Therefore it is
// recommended to use `textEdit` instead since it avoids additional client
// side interpretation.
InsertText string `json:"insertText,omitempty"`
// The format of the insert text. The format applies to both the
// `insertText` property and the `newText` property of a provided
// `textEdit`. If omitted defaults to `InsertTextFormat.PlainText`.
//
// Please note that the insertTextFormat doesn't apply to
// `additionalTextEdits`.
InsertTextFormat *InsertTextFormat `json:"insertTextFormat,omitempty"`
// How whitespace and indentation is handled during completion
// item insertion. If not provided the clients default value depends on
// the `textDocument.completion.insertTextMode` client capability.
//
// @since 3.16.0
InsertTextMode *InsertTextMode `json:"insertTextMode,omitempty"`
// An {@link TextEdit edit} which is applied to a document when selecting
// this completion. When an edit is provided the value of
// {@link CompletionItem.insertText insertText} is ignored.
//
// Most editors support two different operations when accepting a completion
// item. One is to insert a completion text and the other is to replace an
// existing text with a completion text. Since this can usually not be
// predetermined by a server it can report both ranges. Clients need to
// signal support for `InsertReplaceEdits` via the
// `textDocument.completion.insertReplaceSupport` client capability
// property.
//
// *Note 1:* The text edit's range as well as both ranges from an insert
// replace edit must be a [single line] and they must contain the position
// at which completion has been requested.
// *Note 2:* If an `InsertReplaceEdit` is returned the edit's insert range
// must be a prefix of the edit's replace range, that means it must be
// contained and starting at the same position.
//
// @since 3.16.0 additional type `InsertReplaceEdit`
TextEdit *Or_CompletionItem_textEdit `json:"textEdit,omitempty"`
// The edit text used if the completion item is part of a CompletionList and
// CompletionList defines an item default for the text edit range.
//
// Clients will only honor this property if they opt into completion list
// item defaults using the capability `completionList.itemDefaults`.
//
// If not provided and a list's default range is provided the label
// property is used as a text.
//
// @since 3.17.0
TextEditText string `json:"textEditText,omitempty"`
// An optional array of additional {@link TextEdit text edits} that are applied when
// selecting this completion. Edits must not overlap (including the same insert position)
// with the main {@link CompletionItem.textEdit edit} nor with themselves.
//
// Additional text edits should be used to change text unrelated to the current cursor position
// (for example adding an import statement at the top of the file if the completion item will
// insert an unqualified type).
AdditionalTextEdits []TextEdit `json:"additionalTextEdits,omitempty"`
// An optional set of characters that when pressed while this completion is active will accept it first and
// then type that character. *Note* that all commit characters should have `length=1` and that superfluous
// characters will be ignored.
CommitCharacters []string `json:"commitCharacters,omitempty"`
// An optional {@link Command command} that is executed *after* inserting this completion. *Note* that
// additional modifications to the current document should be described with the
// {@link CompletionItem.additionalTextEdits additionalTextEdits}-property.
Command *Command `json:"command,omitempty"`
// A data entry field that is preserved on a completion item between a
// {@link CompletionRequest} and a {@link CompletionResolveRequest}.
Data interface{} `json:"data,omitempty"`
}
// In many cases the items of an actual completion result share the same
// value for properties like `commitCharacters` or the range of a text
// edit. A completion list can therefore define item defaults which will
// be used if a completion item itself doesn't specify the value.
//
// If a completion list specifies a default value and a completion item
// also specifies a corresponding value the one from the item is used.
//
// Servers are only allowed to return default values if the client
// signals support for this via the `completionList.itemDefaults`
// capability.
//
// @since 3.17.0
//
// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#completionItemDefaults
type CompletionItemDefaults struct {
// A default commit character set.
//
// @since 3.17.0
CommitCharacters []string `json:"commitCharacters,omitempty"`
// A default edit range.
//
// @since 3.17.0
EditRange *Or_CompletionItemDefaults_editRange `json:"editRange,omitempty"`
// A default insert text format.
//
// @since 3.17.0
InsertTextFormat *InsertTextFormat `json:"insertTextFormat,omitempty"`
// A default insert text mode.
//
// @since 3.17.0
InsertTextMode *InsertTextMode `json:"insertTextMode,omitempty"`
// A default data value.
//
// @since 3.17.0
Data interface{} `json:"data,omitempty"`
}
// The kind of a completion entry.
type CompletionItemKind uint32
// Additional details for a completion item label.
//
// @since 3.17.0
//
// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#completionItemLabelDetails
type CompletionItemLabelDetails struct {
// An optional string which is rendered less prominently directly after {@link CompletionItem.label label},
// without any spacing. Should be used for function signatures and type annotations.
Detail string `json:"detail,omitempty"`
// An optional string which is rendered less prominently after {@link CompletionItem.detail}. Should be used
// for fully qualified names and file paths.
Description string `json:"description,omitempty"`
}
// Completion item tags are extra annotations that tweak the rendering of a completion
// item.
//
// @since 3.15.0
type CompletionItemTag uint32
// @since 3.18.0
//
// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#completionItemTagOptions
type CompletionItemTagOptions struct {
// The tags supported by the client.
ValueSet []CompletionItemTag `json:"valueSet"`
}
// Represents a collection of {@link CompletionItem completion items} to be presented
// in the editor.
//
// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#completionList
type CompletionList struct {
// This list it not complete. Further typing results in recomputing this list.
//
// Recomputed lists have all their items replaced (not appended) in the
// incomplete completion sessions.
IsIncomplete bool `json:"isIncomplete"`
// In many cases the items of an actual completion result share the same
// value for properties like `commitCharacters` or the range of a text
// edit. A completion list can therefore define item defaults which will
// be used if a completion item itself doesn't specify the value.
//
// If a completion list specifies a default value and a completion item
// also specifies a corresponding value the one from the item is used.
//
// Servers are only allowed to return default values if the client
// signals support for this via the `completionList.itemDefaults`
// capability.
//
// @since 3.17.0
ItemDefaults *CompletionItemDefaults `json:"itemDefaults,omitempty"`
// The completion items.
Items []CompletionItem `json:"items"`
}
// The client supports the following `CompletionList` specific
// capabilities.
//
// @since 3.17.0
//
// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#completionListCapabilities
type CompletionListCapabilities struct {
// The client supports the following itemDefaults on
// a completion list.
//
// The value lists the supported property names of the
// `CompletionList.itemDefaults` object. If omitted
// no properties are supported.
//
// @since 3.17.0
ItemDefaults []string `json:"itemDefaults,omitempty"`
}
// Completion options.
//
// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#completionOptions
type CompletionOptions struct {
// Most tools trigger completion request automatically without explicitly requesting
// it using a keyboard shortcut (e.g. Ctrl+Space). Typically they do so when the user
// starts to type an identifier. For example if the user types `c` in a JavaScript file
// code complete will automatically pop up present `console` besides others as a
// completion item. Characters that make up identifiers don't need to be listed here.
//
// If code complete should automatically be trigger on characters not being valid inside
// an identifier (for example `.` in JavaScript) list them in `triggerCharacters`.
TriggerCharacters []string `json:"triggerCharacters,omitempty"`
// The list of all possible characters that commit a completion. This field can be used
// if clients don't support individual commit characters per completion item. See
// `ClientCapabilities.textDocument.completion.completionItem.commitCharactersSupport`
//
// If a server provides both `allCommitCharacters` and commit characters on an individual
// completion item the ones on the completion item win.
//
// @since 3.2.0
AllCommitCharacters []string `json:"allCommitCharacters,omitempty"`
// The server provides support to resolve additional
// information for a completion item.
ResolveProvider bool `json:"resolveProvider,omitempty"`
// The server supports the following `CompletionItem` specific
// capabilities.
//
// @since 3.17.0
CompletionItem *ServerCompletionItemOptions `json:"completionItem,omitempty"`
WorkDoneProgressOptions
}
// Completion parameters
//
// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#completionParams
type CompletionParams struct {
// The completion context. This is only available it the client specifies
// to send this using the client capability `textDocument.completion.contextSupport === true`
Context CompletionContext `json:"context,omitempty"`
TextDocumentPositionParams
WorkDoneProgressParams
PartialResultParams
}
// Registration options for a {@link CompletionRequest}.
//
// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#completionRegistrationOptions
type CompletionRegistrationOptions struct {
TextDocumentRegistrationOptions
CompletionOptions
}
// How a completion was triggered
type CompletionTriggerKind uint32
// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#configurationItem
type ConfigurationItem struct {
// The scope to get the configuration section for.
ScopeURI *URI `json:"scopeUri,omitempty"`
// The configuration section asked for.
Section string `json:"section,omitempty"`
}
// The parameters of a configuration request.
//
// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#configurationParams
type ConfigurationParams struct {
Items []ConfigurationItem `json:"items"`
}
// Create file operation.
//
// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#createFile
type CreateFile struct {
// A create
Kind string `json:"kind"`
// The resource to create.
URI DocumentUri `json:"uri"`
// Additional options
Options *CreateFileOptions `json:"options,omitempty"`
ResourceOperation
}
// Options to create a file.
//
// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#createFileOptions
type CreateFileOptions struct {
// Overwrite existing file. Overwrite wins over `ignoreIfExists`
Overwrite bool `json:"overwrite,omitempty"`
// Ignore if exists.
IgnoreIfExists bool `json:"ignoreIfExists,omitempty"`
}
// The parameters sent in notifications/requests for user-initiated creation of
// files.
//
// @since 3.16.0
//
// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#createFilesParams
type CreateFilesParams struct {
// An array of all files/folders created in this operation.
Files []FileCreate `json:"files"`
}
// The declaration of a symbol representation as one or many {@link Location locations}.
//
// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#declaration
type Declaration = Or_Declaration // (alias)
// @since 3.14.0
//
// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#declarationClientCapabilities
type DeclarationClientCapabilities struct {
// Whether declaration supports dynamic registration. If this is set to `true`
// the client supports the new `DeclarationRegistrationOptions` return value
// for the corresponding server capability as well.
DynamicRegistration bool `json:"dynamicRegistration,omitempty"`
// The client supports additional metadata in the form of declaration links.
LinkSupport bool `json:"linkSupport,omitempty"`
}
// Information about where a symbol is declared.
//
// Provides additional metadata over normal {@link Location location} declarations, including the range of
// the declaring symbol.
//
// Servers should prefer returning `DeclarationLink` over `Declaration` if supported
// by the client.
//
// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#declarationLink
type DeclarationLink = LocationLink // (alias)
// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#declarationOptions
type DeclarationOptions struct {
WorkDoneProgressOptions
}
// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#declarationParams
type DeclarationParams struct {
TextDocumentPositionParams
WorkDoneProgressParams
PartialResultParams
}
// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#declarationRegistrationOptions
type DeclarationRegistrationOptions struct {
DeclarationOptions
TextDocumentRegistrationOptions
StaticRegistrationOptions
}
// The definition of a symbol represented as one or many {@link Location locations}.
// For most programming languages there is only one location at which a symbol is
// defined.
//
// Servers should prefer returning `DefinitionLink` over `Definition` if supported
// by the client.
//
// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#definition
type Definition = Or_Definition // (alias)
// Client Capabilities for a {@link DefinitionRequest}.
//
// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#definitionClientCapabilities
type DefinitionClientCapabilities struct {
// Whether definition supports dynamic registration.
DynamicRegistration bool `json:"dynamicRegistration,omitempty"`
// The client supports additional metadata in the form of definition links.
//
// @since 3.14.0
LinkSupport bool `json:"linkSupport,omitempty"`
}
// Information about where a symbol is defined.
//
// Provides additional metadata over normal {@link Location location} definitions, including the range of
// the defining symbol
//
// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#definitionLink
type DefinitionLink = LocationLink // (alias)
// Server Capabilities for a {@link DefinitionRequest}.
//
// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#definitionOptions
type DefinitionOptions struct {
WorkDoneProgressOptions
}
// Parameters for a {@link DefinitionRequest}.
//
// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#definitionParams
type DefinitionParams struct {
TextDocumentPositionParams
WorkDoneProgressParams
PartialResultParams
}
// Registration options for a {@link DefinitionRequest}.
//
// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#definitionRegistrationOptions
type DefinitionRegistrationOptions struct {
TextDocumentRegistrationOptions
DefinitionOptions
}
// Delete file operation
//
// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#deleteFile
type DeleteFile struct {
// A delete
Kind string `json:"kind"`
// The file to delete.
URI DocumentUri `json:"uri"`
// Delete options.
Options *DeleteFileOptions `json:"options,omitempty"`
ResourceOperation
}
// Delete file options
//
// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#deleteFileOptions
type DeleteFileOptions struct {
// Delete the content recursively if a folder is denoted.
Recursive bool `json:"recursive,omitempty"`
// Ignore the operation if the file doesn't exist.
IgnoreIfNotExists bool `json:"ignoreIfNotExists,omitempty"`
}
// The parameters sent in notifications/requests for user-initiated deletes of
// files.
//
// @since 3.16.0
//
// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#deleteFilesParams
type DeleteFilesParams struct {
// An array of all files/folders deleted in this operation.
Files []FileDelete `json:"files"`
}
// Represents a diagnostic, such as a compiler error or warning. Diagnostic objects
// are only valid in the scope of a resource.
//
// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#diagnostic
type Diagnostic struct {
// The range at which the message applies
Range Range `json:"range"`
// The diagnostic's severity. To avoid interpretation mismatches when a
// server is used with different clients it is highly recommended that servers
// always provide a severity value.
Severity DiagnosticSeverity `json:"severity,omitempty"`
// The diagnostic's code, which usually appear in the user interface.
Code interface{} `json:"code,omitempty"`
// An optional property to describe the error code.
// Requires the code field (above) to be present/not null.
//
// @since 3.16.0
CodeDescription *CodeDescription `json:"codeDescription,omitempty"`
// A human-readable string describing the source of this
// diagnostic, e.g. 'typescript' or 'super lint'. It usually
// appears in the user interface.
Source string `json:"source,omitempty"`
// The diagnostic's message. It usually appears in the user interface
Message string `json:"message"`
// Additional metadata about the diagnostic.
//
// @since 3.15.0
Tags []DiagnosticTag `json:"tags,omitempty"`
// An array of related diagnostic information, e.g. when symbol-names within
// a scope collide all definitions can be marked via this property.
RelatedInformation []DiagnosticRelatedInformation `json:"relatedInformation,omitempty"`
// A data entry field that is preserved between a `textDocument/publishDiagnostics`
// notification and `textDocument/codeAction` request.
//
// @since 3.16.0
Data *json.RawMessage `json:"data,omitempty"`
}
// Client capabilities specific to diagnostic pull requests.
//
// @since 3.17.0
//
// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#diagnosticClientCapabilities
type DiagnosticClientCapabilities struct {
// Whether implementation supports dynamic registration. If this is set to `true`
// the client supports the new `(TextDocumentRegistrationOptions & StaticRegistrationOptions)`
// return value for the corresponding server capability as well.
DynamicRegistration bool `json:"dynamicRegistration,omitempty"`
// Whether the clients supports related documents for document diagnostic pulls.
RelatedDocumentSupport bool `json:"relatedDocumentSupport,omitempty"`
DiagnosticsCapabilities
}
// Diagnostic options.
//
// @since 3.17.0
//
// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#diagnosticOptions
type DiagnosticOptions struct {
// An optional identifier under which the diagnostics are
// managed by the client.
Identifier string `json:"identifier,omitempty"`
// Whether the language has inter file dependencies meaning that
// editing code in one file can result in a different diagnostic
// set in another file. Inter file dependencies are common for
// most programming languages and typically uncommon for linters.
InterFileDependencies bool `json:"interFileDependencies"`
// The server provides support for workspace diagnostics as well.
WorkspaceDiagnostics bool `json:"workspaceDiagnostics"`
WorkDoneProgressOptions
}
// Diagnostic registration options.
//
// @since 3.17.0
//
// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#diagnosticRegistrationOptions
type DiagnosticRegistrationOptions struct {
TextDocumentRegistrationOptions
DiagnosticOptions
StaticRegistrationOptions
}
// Represents a related message and source code location for a diagnostic. This should be
// used to point to code locations that cause or related to a diagnostics, e.g when duplicating
// a symbol in a scope.
//
// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#diagnosticRelatedInformation
type DiagnosticRelatedInformation struct {
// The location of this related diagnostic information.
Location Location `json:"location"`
// The message of this related diagnostic information.
Message string `json:"message"`
}
// Cancellation data returned from a diagnostic request.
//
// @since 3.17.0
//
// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#diagnosticServerCancellationData
type DiagnosticServerCancellationData struct {
RetriggerRequest bool `json:"retriggerRequest"`
}
// The diagnostic's severity.
type DiagnosticSeverity uint32
// The diagnostic tags.
//
// @since 3.15.0
type DiagnosticTag uint32
// Workspace client capabilities specific to diagnostic pull requests.
//
// @since 3.17.0
//
// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#diagnosticWorkspaceClientCapabilities
type DiagnosticWorkspaceClientCapabilities struct {
// Whether the client implementation supports a refresh request sent from
// the server to the client.
//
// Note that this event is global and will force the client to refresh all
// pulled diagnostics currently shown. It should be used with absolute care and
// is useful for situation where a server for example detects a project wide
// change that requires such a calculation.
RefreshSupport bool `json:"refreshSupport,omitempty"`
}
// General diagnostics capabilities for pull and push model.
//
// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#diagnosticsCapabilities
type DiagnosticsCapabilities struct {
// Whether the clients accepts diagnostics with related information.
RelatedInformation bool `json:"relatedInformation,omitempty"`
// Client supports the tag property to provide meta data about a diagnostic.
// Clients supporting tags have to handle unknown tags gracefully.
//
// @since 3.15.0
TagSupport *ClientDiagnosticsTagOptions `json:"tagSupport,omitempty"`
// Client supports a codeDescription property
//
// @since 3.16.0
CodeDescriptionSupport bool `json:"codeDescriptionSupport,omitempty"`
// Whether code action supports the `data` property which is
// preserved between a `textDocument/publishDiagnostics` and
// `textDocument/codeAction` request.
//
// @since 3.16.0
DataSupport bool `json:"dataSupport,omitempty"`
}
// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#didChangeConfigurationClientCapabilities
type DidChangeConfigurationClientCapabilities struct {
// Did change configuration notification supports dynamic registration.
DynamicRegistration bool `json:"dynamicRegistration,omitempty"`
}
// The parameters of a change configuration notification.
//
// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#didChangeConfigurationParams
type DidChangeConfigurationParams struct {
// The actual changed settings
Settings interface{} `json:"settings"`
}
// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#didChangeConfigurationRegistrationOptions
type DidChangeConfigurationRegistrationOptions struct {
Section *Or_DidChangeConfigurationRegistrationOptions_section `json:"section,omitempty"`
}
// The params sent in a change notebook document notification.
//
// @since 3.17.0
//
// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#didChangeNotebookDocumentParams
type DidChangeNotebookDocumentParams struct {
// The notebook document that did change. The version number points
// to the version after all provided changes have been applied. If
// only the text document content of a cell changes the notebook version
// doesn't necessarily have to change.
NotebookDocument VersionedNotebookDocumentIdentifier `json:"notebookDocument"`
// The actual changes to the notebook document.
//
// The changes describe single state changes to the notebook document.
// So if there are two changes c1 (at array index 0) and c2 (at array
// index 1) for a notebook in state S then c1 moves the notebook from
// S to S' and c2 from S' to S''. So c1 is computed on the state S and
// c2 is computed on the state S'.
//
// To mirror the content of a notebook using change events use the following approach:
//
// - start with the same initial content
// - apply the 'notebookDocument/didChange' notifications in the order you receive them.
// - apply the `NotebookChangeEvent`s in a single notification in the order
// you receive them.
Change NotebookDocumentChangeEvent `json:"change"`
}
// The change text document notification's parameters.
//
// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#didChangeTextDocumentParams
type DidChangeTextDocumentParams struct {
// The document that did change. The version number points
// to the version after all provided content changes have
// been applied.
TextDocument VersionedTextDocumentIdentifier `json:"textDocument"`
// The actual content changes. The content changes describe single state changes
// to the document. So if there are two content changes c1 (at array index 0) and
// c2 (at array index 1) for a document in state S then c1 moves the document from
// S to S' and c2 from S' to S''. So c1 is computed on the state S and c2 is computed
// on the state S'.
//
// To mirror the content of a document using change events use the following approach:
//
// - start with the same initial content
// - apply the 'textDocument/didChange' notifications in the order you receive them.
// - apply the `TextDocumentContentChangeEvent`s in a single notification in the order
// you receive them.
ContentChanges []TextDocumentContentChangeEvent `json:"contentChanges"`
}
// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#didChangeWatchedFilesClientCapabilities
type DidChangeWatchedFilesClientCapabilities struct {
// Did change watched files notification supports dynamic registration. Please note
// that the current protocol doesn't support static configuration for file changes
// from the server side.
DynamicRegistration bool `json:"dynamicRegistration,omitempty"`
// Whether the client has support for {@link RelativePattern relative pattern}
// or not.
//
// @since 3.17.0
RelativePatternSupport bool `json:"relativePatternSupport,omitempty"`
}
// The watched files change notification's parameters.
//
// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#didChangeWatchedFilesParams
type DidChangeWatchedFilesParams struct {
// The actual file events.
Changes []FileEvent `json:"changes"`
}
// Describe options to be used when registered for text document change events.
//
// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#didChangeWatchedFilesRegistrationOptions
type DidChangeWatchedFilesRegistrationOptions struct {
// The watchers to register.
Watchers []FileSystemWatcher `json:"watchers"`
}
// The parameters of a `workspace/didChangeWorkspaceFolders` notification.
//
// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#didChangeWorkspaceFoldersParams
type DidChangeWorkspaceFoldersParams struct {
// The actual workspace folder change event.
Event WorkspaceFoldersChangeEvent `json:"event"`
}
// The params sent in a close notebook document notification.
//
// @since 3.17.0
//
// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#didCloseNotebookDocumentParams
type DidCloseNotebookDocumentParams struct {
// The notebook document that got closed.
NotebookDocument NotebookDocumentIdentifier `json:"notebookDocument"`
// The text documents that represent the content
// of a notebook cell that got closed.
CellTextDocuments []TextDocumentIdentifier `json:"cellTextDocuments"`
}
// The parameters sent in a close text document notification
//
// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#didCloseTextDocumentParams
type DidCloseTextDocumentParams struct {
// The document that was closed.
TextDocument TextDocumentIdentifier `json:"textDocument"`
}
// The params sent in an open notebook document notification.
//
// @since 3.17.0
//
// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#didOpenNotebookDocumentParams
type DidOpenNotebookDocumentParams struct {
// The notebook document that got opened.
NotebookDocument NotebookDocument `json:"notebookDocument"`
// The text documents that represent the content
// of a notebook cell.
CellTextDocuments []TextDocumentItem `json:"cellTextDocuments"`
}
// The parameters sent in an open text document notification
//
// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#didOpenTextDocumentParams
type DidOpenTextDocumentParams struct {
// The document that was opened.
TextDocument TextDocumentItem `json:"textDocument"`
}
// The params sent in a save notebook document notification.
//
// @since 3.17.0
//
// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#didSaveNotebookDocumentParams
type DidSaveNotebookDocumentParams struct {
// The notebook document that got saved.
NotebookDocument NotebookDocumentIdentifier `json:"notebookDocument"`
}
// The parameters sent in a save text document notification
//
// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#didSaveTextDocumentParams
type DidSaveTextDocumentParams struct {
// The document that was saved.
TextDocument TextDocumentIdentifier `json:"textDocument"`
// Optional the content when saved. Depends on the includeText value
// when the save notification was requested.
Text *string `json:"text,omitempty"`
}
// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#documentColorClientCapabilities
type DocumentColorClientCapabilities struct {
// Whether implementation supports dynamic registration. If this is set to `true`
// the client supports the new `DocumentColorRegistrationOptions` return value
// for the corresponding server capability as well.
DynamicRegistration bool `json:"dynamicRegistration,omitempty"`
}
// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#documentColorOptions
type DocumentColorOptions struct {
WorkDoneProgressOptions
}
// Parameters for a {@link DocumentColorRequest}.
//
// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#documentColorParams
type DocumentColorParams struct {
// The text document.
TextDocument TextDocumentIdentifier `json:"textDocument"`
WorkDoneProgressParams
PartialResultParams
}
// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#documentColorRegistrationOptions
type DocumentColorRegistrationOptions struct {
TextDocumentRegistrationOptions
DocumentColorOptions
StaticRegistrationOptions
}
// Parameters of the document diagnostic request.
//
// @since 3.17.0
//
// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#documentDiagnosticParams
type DocumentDiagnosticParams struct {
// The text document.
TextDocument TextDocumentIdentifier `json:"textDocument"`
// The additional identifier provided during registration.
Identifier string `json:"identifier,omitempty"`
// The result id of a previous response if provided.
PreviousResultID string `json:"previousResultId,omitempty"`
WorkDoneProgressParams
PartialResultParams
}
// The result of a document diagnostic pull request. A report can
// either be a full report containing all diagnostics for the
// requested document or an unchanged report indicating that nothing
// has changed in terms of diagnostics in comparison to the last
// pull request.
//
// @since 3.17.0
//
// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#documentDiagnosticReport
type DocumentDiagnosticReport = Or_DocumentDiagnosticReport // (alias)
// The document diagnostic report kinds.
//
// @since 3.17.0
type DocumentDiagnosticReportKind string
// A partial result for a document diagnostic report.
//
// @since 3.17.0
//
// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#documentDiagnosticReportPartialResult
type DocumentDiagnosticReportPartialResult struct {
RelatedDocuments map[DocumentUri]interface{} `json:"relatedDocuments"`
}
// A document filter describes a top level text document or
// a notebook cell document.
//
// @since 3.17.0 - proposed support for NotebookCellTextDocumentFilter.
//
// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#documentFilter
type DocumentFilter = Or_DocumentFilter // (alias)
// Client capabilities of a {@link DocumentFormattingRequest}.
//
// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#documentFormattingClientCapabilities
type DocumentFormattingClientCapabilities struct {
// Whether formatting supports dynamic registration.
DynamicRegistration bool `json:"dynamicRegistration,omitempty"`
}
// Provider options for a {@link DocumentFormattingRequest}.
//
// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#documentFormattingOptions
type DocumentFormattingOptions struct {
WorkDoneProgressOptions
}
// The parameters of a {@link DocumentFormattingRequest}.
//
// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#documentFormattingParams
type DocumentFormattingParams struct {
// The document to format.
TextDocument TextDocumentIdentifier `json:"textDocument"`
// The format options.
Options FormattingOptions `json:"options"`
WorkDoneProgressParams
}
// Registration options for a {@link DocumentFormattingRequest}.
//
// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#documentFormattingRegistrationOptions
type DocumentFormattingRegistrationOptions struct {
TextDocumentRegistrationOptions
DocumentFormattingOptions
}
// A document highlight is a range inside a text document which deserves
// special attention. Usually a document highlight is visualized by changing
// the background color of its range.
//
// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#documentHighlight
type DocumentHighlight struct {
// The range this highlight applies to.
Range Range `json:"range"`
// The highlight kind, default is {@link DocumentHighlightKind.Text text}.
Kind DocumentHighlightKind `json:"kind,omitempty"`
}
// Client Capabilities for a {@link DocumentHighlightRequest}.
//
// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#documentHighlightClientCapabilities
type DocumentHighlightClientCapabilities struct {
// Whether document highlight supports dynamic registration.
DynamicRegistration bool `json:"dynamicRegistration,omitempty"`
}
// A document highlight kind.
type DocumentHighlightKind uint32
// Provider options for a {@link DocumentHighlightRequest}.
//
// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#documentHighlightOptions
type DocumentHighlightOptions struct {
WorkDoneProgressOptions
}
// Parameters for a {@link DocumentHighlightRequest}.
//
// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#documentHighlightParams
type DocumentHighlightParams struct {
TextDocumentPositionParams
WorkDoneProgressParams
PartialResultParams
}
// Registration options for a {@link DocumentHighlightRequest}.
//
// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#documentHighlightRegistrationOptions
type DocumentHighlightRegistrationOptions struct {
TextDocumentRegistrationOptions
DocumentHighlightOptions
}
// A document link is a range in a text document that links to an internal or external resource, like another
// text document or a web site.
//
// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#documentLink
type DocumentLink struct {
// The range this link applies to.
Range Range `json:"range"`
// The uri this link points to. If missing a resolve request is sent later.
Target *URI `json:"target,omitempty"`
// The tooltip text when you hover over this link.
//
// If a tooltip is provided, is will be displayed in a string that includes instructions on how to
// trigger the link, such as `{0} (ctrl + click)`. The specific instructions vary depending on OS,
// user settings, and localization.
//
// @since 3.15.0
Tooltip string `json:"tooltip,omitempty"`
// A data entry field that is preserved on a document link between a
// DocumentLinkRequest and a DocumentLinkResolveRequest.
Data interface{} `json:"data,omitempty"`
}
// The client capabilities of a {@link DocumentLinkRequest}.
//
// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#documentLinkClientCapabilities
type DocumentLinkClientCapabilities struct {
// Whether document link supports dynamic registration.
DynamicRegistration bool `json:"dynamicRegistration,omitempty"`
// Whether the client supports the `tooltip` property on `DocumentLink`.
//
// @since 3.15.0
TooltipSupport bool `json:"tooltipSupport,omitempty"`
}
// Provider options for a {@link DocumentLinkRequest}.
//
// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#documentLinkOptions
type DocumentLinkOptions struct {
// Document links have a resolve provider as well.
ResolveProvider bool `json:"resolveProvider,omitempty"`
WorkDoneProgressOptions
}
// The parameters of a {@link DocumentLinkRequest}.
//
// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#documentLinkParams
type DocumentLinkParams struct {
// The document to provide document links for.
TextDocument TextDocumentIdentifier `json:"textDocument"`
WorkDoneProgressParams
PartialResultParams
}
// Registration options for a {@link DocumentLinkRequest}.
//
// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#documentLinkRegistrationOptions
type DocumentLinkRegistrationOptions struct {
TextDocumentRegistrationOptions
DocumentLinkOptions
}
// Client capabilities of a {@link DocumentOnTypeFormattingRequest}.
//
// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#documentOnTypeFormattingClientCapabilities
type DocumentOnTypeFormattingClientCapabilities struct {
// Whether on type formatting supports dynamic registration.
DynamicRegistration bool `json:"dynamicRegistration,omitempty"`
}
// Provider options for a {@link DocumentOnTypeFormattingRequest}.
//
// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#documentOnTypeFormattingOptions
type DocumentOnTypeFormattingOptions struct {
// A character on which formatting should be triggered, like `{`.
FirstTriggerCharacter string `json:"firstTriggerCharacter"`
// More trigger characters.
MoreTriggerCharacter []string `json:"moreTriggerCharacter,omitempty"`
}
// The parameters of a {@link DocumentOnTypeFormattingRequest}.
//
// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#documentOnTypeFormattingParams
type DocumentOnTypeFormattingParams struct {
// The document to format.
TextDocument TextDocumentIdentifier `json:"textDocument"`
// The position around which the on type formatting should happen.
// This is not necessarily the exact position where the character denoted
// by the property `ch` got typed.
Position Position `json:"position"`
// The character that has been typed that triggered the formatting
// on type request. That is not necessarily the last character that
// got inserted into the document since the client could auto insert
// characters as well (e.g. like automatic brace completion).
Ch string `json:"ch"`
// The formatting options.
Options FormattingOptions `json:"options"`
}
// Registration options for a {@link DocumentOnTypeFormattingRequest}.
//
// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#documentOnTypeFormattingRegistrationOptions
type DocumentOnTypeFormattingRegistrationOptions struct {
TextDocumentRegistrationOptions
DocumentOnTypeFormattingOptions
}
// Client capabilities of a {@link DocumentRangeFormattingRequest}.
//
// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#documentRangeFormattingClientCapabilities
type DocumentRangeFormattingClientCapabilities struct {
// Whether range formatting supports dynamic registration.
DynamicRegistration bool `json:"dynamicRegistration,omitempty"`
// Whether the client supports formatting multiple ranges at once.
//
// @since 3.18.0
// @proposed
RangesSupport bool `json:"rangesSupport,omitempty"`
}
// Provider options for a {@link DocumentRangeFormattingRequest}.
//
// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#documentRangeFormattingOptions
type DocumentRangeFormattingOptions struct {
// Whether the server supports formatting multiple ranges at once.
//
// @since 3.18.0
// @proposed
RangesSupport bool `json:"rangesSupport,omitempty"`
WorkDoneProgressOptions
}
// The parameters of a {@link DocumentRangeFormattingRequest}.
//
// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#documentRangeFormattingParams
type DocumentRangeFormattingParams struct {
// The document to format.
TextDocument TextDocumentIdentifier `json:"textDocument"`
// The range to format
Range Range `json:"range"`
// The format options
Options FormattingOptions `json:"options"`
WorkDoneProgressParams
}
// Registration options for a {@link DocumentRangeFormattingRequest}.
//
// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#documentRangeFormattingRegistrationOptions
type DocumentRangeFormattingRegistrationOptions struct {
TextDocumentRegistrationOptions
DocumentRangeFormattingOptions
}
// The parameters of a {@link DocumentRangesFormattingRequest}.
//
// @since 3.18.0
// @proposed
//
// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#documentRangesFormattingParams
type DocumentRangesFormattingParams struct {
// The document to format.
TextDocument TextDocumentIdentifier `json:"textDocument"`
// The ranges to format
Ranges []Range `json:"ranges"`
// The format options
Options FormattingOptions `json:"options"`
WorkDoneProgressParams
}
// A document selector is the combination of one or many document filters.
//
// @sample `let sel:DocumentSelector = [{ language: 'typescript' }, { language: 'json', pattern: '**tsconfig.json' }]`;
//
// The use of a string as a document filter is deprecated @since 3.16.0.
//
// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#documentSelector
type DocumentSelector = []DocumentFilter // (alias)
// Represents programming constructs like variables, classes, interfaces etc.
// that appear in a document. Document symbols can be hierarchical and they
// have two ranges: one that encloses its definition and one that points to
// its most interesting range, e.g. the range of an identifier.
//
// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#documentSymbol
type DocumentSymbol struct {
// The name of this symbol. Will be displayed in the user interface and therefore must not be
// an empty string or a string only consisting of white spaces.
Name string `json:"name"`
// More detail for this symbol, e.g the signature of a function.
Detail string `json:"detail,omitempty"`
// The kind of this symbol.
Kind SymbolKind `json:"kind"`
// Tags for this document symbol.
//
// @since 3.16.0
Tags []SymbolTag `json:"tags,omitempty"`
// Indicates if this symbol is deprecated.
//
// @deprecated Use tags instead
Deprecated bool `json:"deprecated,omitempty"`
// The range enclosing this symbol not including leading/trailing whitespace but everything else
// like comments. This information is typically used to determine if the clients cursor is
// inside the symbol to reveal in the symbol in the UI.
Range Range `json:"range"`
// The range that should be selected and revealed when this symbol is being picked, e.g the name of a function.
// Must be contained by the `range`.
SelectionRange Range `json:"selectionRange"`
// Children of this symbol, e.g. properties of a class.
Children []DocumentSymbol `json:"children,omitempty"`
}
// Client Capabilities for a {@link DocumentSymbolRequest}.
//
// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#documentSymbolClientCapabilities
type DocumentSymbolClientCapabilities struct {
// Whether document symbol supports dynamic registration.
DynamicRegistration bool `json:"dynamicRegistration,omitempty"`
// Specific capabilities for the `SymbolKind` in the
// `textDocument/documentSymbol` request.
SymbolKind *ClientSymbolKindOptions `json:"symbolKind,omitempty"`
// The client supports hierarchical document symbols.
HierarchicalDocumentSymbolSupport bool `json:"hierarchicalDocumentSymbolSupport,omitempty"`
// The client supports tags on `SymbolInformation`. Tags are supported on
// `DocumentSymbol` if `hierarchicalDocumentSymbolSupport` is set to true.
// Clients supporting tags have to handle unknown tags gracefully.
//
// @since 3.16.0
TagSupport *ClientSymbolTagOptions `json:"tagSupport,omitempty"`
// The client supports an additional label presented in the UI when
// registering a document symbol provider.
//
// @since 3.16.0
LabelSupport bool `json:"labelSupport,omitempty"`
}
// Provider options for a {@link DocumentSymbolRequest}.
//
// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#documentSymbolOptions
type DocumentSymbolOptions struct {
// A human-readable string that is shown when multiple outlines trees
// are shown for the same document.
//
// @since 3.16.0
Label string `json:"label,omitempty"`
WorkDoneProgressOptions
}
// Parameters for a {@link DocumentSymbolRequest}.
//
// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#documentSymbolParams
type DocumentSymbolParams struct {
// The text document.
TextDocument TextDocumentIdentifier `json:"textDocument"`
WorkDoneProgressParams
PartialResultParams
}
// Registration options for a {@link DocumentSymbolRequest}.
//
// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#documentSymbolRegistrationOptions
type DocumentSymbolRegistrationOptions struct {
TextDocumentRegistrationOptions
DocumentSymbolOptions
}
// Edit range variant that includes ranges for insert and replace operations.
//
// @since 3.18.0
//
// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#editRangeWithInsertReplace
type EditRangeWithInsertReplace struct {
Insert Range `json:"insert"`
Replace Range `json:"replace"`
}
// Predefined error codes.
type ErrorCodes int32
// The client capabilities of a {@link ExecuteCommandRequest}.
//
// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#executeCommandClientCapabilities
type ExecuteCommandClientCapabilities struct {
// Execute command supports dynamic registration.
DynamicRegistration bool `json:"dynamicRegistration,omitempty"`
}
// The server capabilities of a {@link ExecuteCommandRequest}.
//
// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#executeCommandOptions
type ExecuteCommandOptions struct {
// The commands to be executed on the server
Commands []string `json:"commands"`
WorkDoneProgressOptions
}
// The parameters of a {@link ExecuteCommandRequest}.
//
// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#executeCommandParams
type ExecuteCommandParams struct {
// The identifier of the actual command handler.
Command string `json:"command"`
// Arguments that the command should be invoked with.
Arguments []json.RawMessage `json:"arguments,omitempty"`
WorkDoneProgressParams
}
// Registration options for a {@link ExecuteCommandRequest}.
//
// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#executeCommandRegistrationOptions
type ExecuteCommandRegistrationOptions struct {
ExecuteCommandOptions
}
// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#executionSummary
type ExecutionSummary struct {
// A strict monotonically increasing value
// indicating the execution order of a cell
// inside a notebook.
ExecutionOrder uint32 `json:"executionOrder"`
// Whether the execution was successful or
// not if known by the client.
Success bool `json:"success,omitempty"`
}
type FailureHandlingKind string
// The file event type
type FileChangeType uint32
// Represents information on a file/folder create.
//
// @since 3.16.0
//
// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#fileCreate
type FileCreate struct {
// A file:// URI for the location of the file/folder being created.
URI string `json:"uri"`
}
// Represents information on a file/folder delete.
//
// @since 3.16.0
//
// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#fileDelete
type FileDelete struct {
// A file:// URI for the location of the file/folder being deleted.
URI string `json:"uri"`
}
// An event describing a file change.
//
// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#fileEvent
type FileEvent struct {
// The file's uri.
URI DocumentUri `json:"uri"`
// The change type.
Type FileChangeType `json:"type"`
}
// Capabilities relating to events from file operations by the user in the client.
//
// These events do not come from the file system, they come from user operations
// like renaming a file in the UI.
//
// @since 3.16.0
//
// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#fileOperationClientCapabilities
type FileOperationClientCapabilities struct {
// Whether the client supports dynamic registration for file requests/notifications.
DynamicRegistration bool `json:"dynamicRegistration,omitempty"`
// The client has support for sending didCreateFiles notifications.
DidCreate bool `json:"didCreate,omitempty"`
// The client has support for sending willCreateFiles requests.
WillCreate bool `json:"willCreate,omitempty"`
// The client has support for sending didRenameFiles notifications.
DidRename bool `json:"didRename,omitempty"`
// The client has support for sending willRenameFiles requests.
WillRename bool `json:"willRename,omitempty"`
// The client has support for sending didDeleteFiles notifications.
DidDelete bool `json:"didDelete,omitempty"`
// The client has support for sending willDeleteFiles requests.
WillDelete bool `json:"willDelete,omitempty"`
}
// A filter to describe in which file operation requests or notifications
// the server is interested in receiving.
//
// @since 3.16.0
//
// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#fileOperationFilter
type FileOperationFilter struct {
// A Uri scheme like `file` or `untitled`.
Scheme string `json:"scheme,omitempty"`
// The actual file operation pattern.
Pattern FileOperationPattern `json:"pattern"`
}
// Options for notifications/requests for user operations on files.
//
// @since 3.16.0
//
// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#fileOperationOptions
type FileOperationOptions struct {
// The server is interested in receiving didCreateFiles notifications.
DidCreate *FileOperationRegistrationOptions `json:"didCreate,omitempty"`
// The server is interested in receiving willCreateFiles requests.
WillCreate *FileOperationRegistrationOptions `json:"willCreate,omitempty"`
// The server is interested in receiving didRenameFiles notifications.
DidRename *FileOperationRegistrationOptions `json:"didRename,omitempty"`
// The server is interested in receiving willRenameFiles requests.
WillRename *FileOperationRegistrationOptions `json:"willRename,omitempty"`
// The server is interested in receiving didDeleteFiles file notifications.
DidDelete *FileOperationRegistrationOptions `json:"didDelete,omitempty"`
// The server is interested in receiving willDeleteFiles file requests.
WillDelete *FileOperationRegistrationOptions `json:"willDelete,omitempty"`
}
// A pattern to describe in which file operation requests or notifications
// the server is interested in receiving.
//
// @since 3.16.0
//
// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#fileOperationPattern
type FileOperationPattern struct {
// The glob pattern to match. Glob patterns can have the following syntax:
//
// - `*` to match one or more characters in a path segment
// - `?` to match on one character in a path segment
// - `**` to match any number of path segments, including none
// - `{}` to group sub patterns into an OR expression. (e.g. `**/*.{ts,js}` matches all TypeScript and JavaScript files)
// - `[]` to declare a range of characters to match in a path segment (e.g., `example.[0-9]` to match on `example.0`, `example.1`, …)
// - `[!...]` to negate a range of characters to match in a path segment (e.g., `example.[!0-9]` to match on `example.a`, `example.b`, but not `example.0`)
Glob string `json:"glob"`
// Whether to match files or folders with this pattern.
//
// Matches both if undefined.
Matches *FileOperationPatternKind `json:"matches,omitempty"`
// Additional options used during matching.
Options *FileOperationPatternOptions `json:"options,omitempty"`
}
// A pattern kind describing if a glob pattern matches a file a folder or
// both.
//
// @since 3.16.0
type FileOperationPatternKind string
// Matching options for the file operation pattern.
//
// @since 3.16.0
//
// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#fileOperationPatternOptions
type FileOperationPatternOptions struct {
// The pattern should be matched ignoring casing.
IgnoreCase bool `json:"ignoreCase,omitempty"`
}
// The options to register for file operations.
//
// @since 3.16.0
//
// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#fileOperationRegistrationOptions
type FileOperationRegistrationOptions struct {
// The actual filters.
Filters []FileOperationFilter `json:"filters"`
}
// Represents information on a file/folder rename.
//
// @since 3.16.0
//
// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#fileRename
type FileRename struct {
// A file:// URI for the original location of the file/folder being renamed.
OldURI string `json:"oldUri"`
// A file:// URI for the new location of the file/folder being renamed.
NewURI string `json:"newUri"`
}
// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#fileSystemWatcher
type FileSystemWatcher struct {
// The glob pattern to watch. See {@link GlobPattern glob pattern} for more detail.
//
// @since 3.17.0 support for relative patterns.
GlobPattern GlobPattern `json:"globPattern"`
// The kind of events of interest. If omitted it defaults
// to WatchKind.Create | WatchKind.Change | WatchKind.Delete
// which is 7.
Kind *WatchKind `json:"kind,omitempty"`
}
// Represents a folding range. To be valid, start and end line must be bigger than zero and smaller
// than the number of lines in the document. Clients are free to ignore invalid ranges.
//
// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#foldingRange
type FoldingRange struct {
// The zero-based start line of the range to fold. The folded area starts after the line's last character.
// To be valid, the end must be zero or larger and smaller than the number of lines in the document.
StartLine uint32 `json:"startLine"`
// The zero-based character offset from where the folded range starts. If not defined, defaults to the length of the start line.
StartCharacter uint32 `json:"startCharacter,omitempty"`
// The zero-based end line of the range to fold. The folded area ends with the line's last character.
// To be valid, the end must be zero or larger and smaller than the number of lines in the document.
EndLine uint32 `json:"endLine"`
// The zero-based character offset before the folded range ends. If not defined, defaults to the length of the end line.
EndCharacter uint32 `json:"endCharacter,omitempty"`
// Describes the kind of the folding range such as 'comment' or 'region'. The kind
// is used to categorize folding ranges and used by commands like 'Fold all comments'.
// See {@link FoldingRangeKind} for an enumeration of standardized kinds.
Kind string `json:"kind,omitempty"`
// The text that the client should show when the specified range is
// collapsed. If not defined or not supported by the client, a default
// will be chosen by the client.
//
// @since 3.17.0
CollapsedText string `json:"collapsedText,omitempty"`
}
// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#foldingRangeClientCapabilities
type FoldingRangeClientCapabilities struct {
// Whether implementation supports dynamic registration for folding range
// providers. If this is set to `true` the client supports the new
// `FoldingRangeRegistrationOptions` return value for the corresponding
// server capability as well.
DynamicRegistration bool `json:"dynamicRegistration,omitempty"`
// The maximum number of folding ranges that the client prefers to receive
// per document. The value serves as a hint, servers are free to follow the
// limit.
RangeLimit uint32 `json:"rangeLimit,omitempty"`
// If set, the client signals that it only supports folding complete lines.
// If set, client will ignore specified `startCharacter` and `endCharacter`
// properties in a FoldingRange.
LineFoldingOnly bool `json:"lineFoldingOnly,omitempty"`
// Specific options for the folding range kind.
//
// @since 3.17.0
FoldingRangeKind *ClientFoldingRangeKindOptions `json:"foldingRangeKind,omitempty"`
// Specific options for the folding range.
//
// @since 3.17.0
FoldingRange *ClientFoldingRangeOptions `json:"foldingRange,omitempty"`
}
// A set of predefined range kinds.
type FoldingRangeKind string
// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#foldingRangeOptions
type FoldingRangeOptions struct {
WorkDoneProgressOptions
}
// Parameters for a {@link FoldingRangeRequest}.
//
// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#foldingRangeParams
type FoldingRangeParams struct {
// The text document.
TextDocument TextDocumentIdentifier `json:"textDocument"`
WorkDoneProgressParams
PartialResultParams
}
// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#foldingRangeRegistrationOptions
type FoldingRangeRegistrationOptions struct {
TextDocumentRegistrationOptions
FoldingRangeOptions
StaticRegistrationOptions
}
// Client workspace capabilities specific to folding ranges
//
// @since 3.18.0
// @proposed
//
// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#foldingRangeWorkspaceClientCapabilities
type FoldingRangeWorkspaceClientCapabilities struct {
// Whether the client implementation supports a refresh request sent from the
// server to the client.
//
// Note that this event is global and will force the client to refresh all
// folding ranges currently shown. It should be used with absolute care and is
// useful for situation where a server for example detects a project wide
// change that requires such a calculation.
//
// @since 3.18.0
// @proposed
RefreshSupport bool `json:"refreshSupport,omitempty"`
}
// Value-object describing what options formatting should use.
//
// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#formattingOptions
type FormattingOptions struct {
// Size of a tab in spaces.
TabSize uint32 `json:"tabSize"`
// Prefer spaces over tabs.
InsertSpaces bool `json:"insertSpaces"`
// Trim trailing whitespace on a line.
//
// @since 3.15.0
TrimTrailingWhitespace bool `json:"trimTrailingWhitespace,omitempty"`
// Insert a newline character at the end of the file if one does not exist.
//
// @since 3.15.0
InsertFinalNewline bool `json:"insertFinalNewline,omitempty"`
// Trim all newlines after the final newline at the end of the file.
//
// @since 3.15.0
TrimFinalNewlines bool `json:"trimFinalNewlines,omitempty"`
}
// A diagnostic report with a full set of problems.
//
// @since 3.17.0
//
// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#fullDocumentDiagnosticReport
type FullDocumentDiagnosticReport struct {
// A full document diagnostic report.
Kind string `json:"kind"`
// An optional result id. If provided it will
// be sent on the next diagnostic request for the
// same document.
ResultID string `json:"resultId,omitempty"`
// The actual items.
Items []Diagnostic `json:"items"`
}
// General client capabilities.
//
// @since 3.16.0
//
// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#generalClientCapabilities
type GeneralClientCapabilities struct {
// Client capability that signals how the client
// handles stale requests (e.g. a request
// for which the client will not process the response
// anymore since the information is outdated).
//
// @since 3.17.0
StaleRequestSupport *StaleRequestSupportOptions `json:"staleRequestSupport,omitempty"`
// Client capabilities specific to regular expressions.
//
// @since 3.16.0
RegularExpressions *RegularExpressionsClientCapabilities `json:"regularExpressions,omitempty"`
// Client capabilities specific to the client's markdown parser.
//
// @since 3.16.0
Markdown *MarkdownClientCapabilities `json:"markdown,omitempty"`
// The position encodings supported by the client. Client and server
// have to agree on the same position encoding to ensure that offsets
// (e.g. character position in a line) are interpreted the same on both
// sides.
//
// To keep the protocol backwards compatible the following applies: if
// the value 'utf-16' is missing from the array of position encodings
// servers can assume that the client supports UTF-16. UTF-16 is
// therefore a mandatory encoding.
//
// If omitted it defaults to ['utf-16'].
//
// Implementation considerations: since the conversion from one encoding
// into another requires the content of the file / line the conversion
// is best done where the file is read which is usually on the server
// side.
//
// @since 3.17.0
PositionEncodings []PositionEncodingKind `json:"positionEncodings,omitempty"`
}
// The glob pattern. Either a string pattern or a relative pattern.
//
// @since 3.17.0
//
// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#globPattern
type GlobPattern = Or_GlobPattern // (alias)
// The result of a hover request.
//
// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#hover
type Hover struct {
// The hover's content
Contents MarkupContent `json:"contents"`
// An optional range inside the text document that is used to
// visualize the hover, e.g. by changing the background color.
Range Range `json:"range,omitempty"`
}
// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#hoverClientCapabilities
type HoverClientCapabilities struct {
// Whether hover supports dynamic registration.
DynamicRegistration bool `json:"dynamicRegistration,omitempty"`
// Client supports the following content formats for the content
// property. The order describes the preferred format of the client.
ContentFormat []MarkupKind `json:"contentFormat,omitempty"`
}
// Hover options.
//
// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#hoverOptions
type HoverOptions struct {
WorkDoneProgressOptions
}
// Parameters for a {@link HoverRequest}.
//
// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#hoverParams
type HoverParams struct {
TextDocumentPositionParams
WorkDoneProgressParams
}
// Registration options for a {@link HoverRequest}.
//
// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#hoverRegistrationOptions
type HoverRegistrationOptions struct {
TextDocumentRegistrationOptions
HoverOptions
}
// @since 3.6.0
//
// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#implementationClientCapabilities
type ImplementationClientCapabilities struct {
// Whether implementation supports dynamic registration. If this is set to `true`
// the client supports the new `ImplementationRegistrationOptions` return value
// for the corresponding server capability as well.
DynamicRegistration bool `json:"dynamicRegistration,omitempty"`
// The client supports additional metadata in the form of definition links.
//
// @since 3.14.0
LinkSupport bool `json:"linkSupport,omitempty"`
}
// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#implementationOptions
type ImplementationOptions struct {
WorkDoneProgressOptions
}
// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#implementationParams
type ImplementationParams struct {
TextDocumentPositionParams
WorkDoneProgressParams
PartialResultParams
}
// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#implementationRegistrationOptions
type ImplementationRegistrationOptions struct {
TextDocumentRegistrationOptions
ImplementationOptions
StaticRegistrationOptions
}
// The data type of the ResponseError if the
// initialize request fails.
//
// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#initializeError
type InitializeError struct {
// Indicates whether the client execute the following retry logic:
// (1) show the message provided by the ResponseError to the user
// (2) user selects retry or cancel
// (3) if user selected retry the initialize method is sent again.
Retry bool `json:"retry"`
}
// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#initializeParams
type InitializeParams struct {
XInitializeParams
WorkspaceFoldersInitializeParams
}
// The result returned from an initialize request.
//
// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#initializeResult
type InitializeResult struct {
// The capabilities the language server provides.
Capabilities ServerCapabilities `json:"capabilities"`
// Information about the server.
//
// @since 3.15.0
ServerInfo *ServerInfo `json:"serverInfo,omitempty"`
}
// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#initializedParams
type InitializedParams struct {
}
// Inlay hint information.
//
// @since 3.17.0
//
// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#inlayHint
type InlayHint struct {
// The position of this hint.
//
// If multiple hints have the same position, they will be shown in the order
// they appear in the response.
Position Position `json:"position"`
// The label of this hint. A human readable string or an array of
// InlayHintLabelPart label parts.
//
// *Note* that neither the string nor the label part can be empty.
Label []InlayHintLabelPart `json:"label"`
// The kind of this hint. Can be omitted in which case the client
// should fall back to a reasonable default.
Kind InlayHintKind `json:"kind,omitempty"`
// Optional text edits that are performed when accepting this inlay hint.
//
// *Note* that edits are expected to change the document so that the inlay
// hint (or its nearest variant) is now part of the document and the inlay
// hint itself is now obsolete.
TextEdits []TextEdit `json:"textEdits,omitempty"`
// The tooltip text when you hover over this item.
Tooltip *Or_InlayHint_tooltip `json:"tooltip,omitempty"`
// Render padding before the hint.
//
// Note: Padding should use the editor's background color, not the
// background color of the hint itself. That means padding can be used
// to visually align/separate an inlay hint.
PaddingLeft bool `json:"paddingLeft,omitempty"`
// Render padding after the hint.
//
// Note: Padding should use the editor's background color, not the
// background color of the hint itself. That means padding can be used
// to visually align/separate an inlay hint.
PaddingRight bool `json:"paddingRight,omitempty"`
// A data entry field that is preserved on an inlay hint between
// a `textDocument/inlayHint` and a `inlayHint/resolve` request.
Data interface{} `json:"data,omitempty"`
}
// Inlay hint client capabilities.
//
// @since 3.17.0
//
// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#inlayHintClientCapabilities
type InlayHintClientCapabilities struct {
// Whether inlay hints support dynamic registration.
DynamicRegistration bool `json:"dynamicRegistration,omitempty"`
// Indicates which properties a client can resolve lazily on an inlay
// hint.
ResolveSupport *ClientInlayHintResolveOptions `json:"resolveSupport,omitempty"`
}
// Inlay hint kinds.
//
// @since 3.17.0
type InlayHintKind uint32
// An inlay hint label part allows for interactive and composite labels
// of inlay hints.
//
// @since 3.17.0
//
// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#inlayHintLabelPart
type InlayHintLabelPart struct {
// The value of this label part.
Value string `json:"value"`
// The tooltip text when you hover over this label part. Depending on
// the client capability `inlayHint.resolveSupport` clients might resolve
// this property late using the resolve request.
Tooltip *Or_InlayHintLabelPart_tooltip `json:"tooltip,omitempty"`
// An optional source code location that represents this
// label part.
//
// The editor will use this location for the hover and for code navigation
// features: This part will become a clickable link that resolves to the
// definition of the symbol at the given location (not necessarily the
// location itself), it shows the hover that shows at the given location,
// and it shows a context menu with further code navigation commands.
//
// Depending on the client capability `inlayHint.resolveSupport` clients
// might resolve this property late using the resolve request.
Location *Location `json:"location,omitempty"`
// An optional command for this label part.
//
// Depending on the client capability `inlayHint.resolveSupport` clients
// might resolve this property late using the resolve request.
Command *Command `json:"command,omitempty"`
}
// Inlay hint options used during static registration.
//
// @since 3.17.0
//
// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#inlayHintOptions
type InlayHintOptions struct {
// The server provides support to resolve additional
// information for an inlay hint item.
ResolveProvider bool `json:"resolveProvider,omitempty"`
WorkDoneProgressOptions
}
// A parameter literal used in inlay hint requests.
//
// @since 3.17.0
//
// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#inlayHintParams
type InlayHintParams struct {
// The text document.
TextDocument TextDocumentIdentifier `json:"textDocument"`
// The document range for which inlay hints should be computed.
Range Range `json:"range"`
WorkDoneProgressParams
}
// Inlay hint options used during static or dynamic registration.
//
// @since 3.17.0
//
// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#inlayHintRegistrationOptions
type InlayHintRegistrationOptions struct {
InlayHintOptions
TextDocumentRegistrationOptions
StaticRegistrationOptions
}
// Client workspace capabilities specific to inlay hints.
//
// @since 3.17.0
//
// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#inlayHintWorkspaceClientCapabilities
type InlayHintWorkspaceClientCapabilities struct {
// Whether the client implementation supports a refresh request sent from
// the server to the client.
//
// Note that this event is global and will force the client to refresh all
// inlay hints currently shown. It should be used with absolute care and
// is useful for situation where a server for example detects a project wide
// change that requires such a calculation.
RefreshSupport bool `json:"refreshSupport,omitempty"`
}
// Client capabilities specific to inline completions.
//
// @since 3.18.0
// @proposed
//
// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#inlineCompletionClientCapabilities
type InlineCompletionClientCapabilities struct {
// Whether implementation supports dynamic registration for inline completion providers.
DynamicRegistration bool `json:"dynamicRegistration,omitempty"`
}
// Provides information about the context in which an inline completion was requested.
//
// @since 3.18.0
// @proposed
//
// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#inlineCompletionContext
type InlineCompletionContext struct {
// Describes how the inline completion was triggered.
TriggerKind InlineCompletionTriggerKind `json:"triggerKind"`
// Provides information about the currently selected item in the autocomplete widget if it is visible.
SelectedCompletionInfo *SelectedCompletionInfo `json:"selectedCompletionInfo,omitempty"`
}
// An inline completion item represents a text snippet that is proposed inline to complete text that is being typed.
//
// @since 3.18.0
// @proposed
//
// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#inlineCompletionItem
type InlineCompletionItem struct {
// The text to replace the range with. Must be set.
InsertText Or_InlineCompletionItem_insertText `json:"insertText"`
// A text that is used to decide if this inline completion should be shown. When `falsy` the {@link InlineCompletionItem.insertText} is used.
FilterText string `json:"filterText,omitempty"`
// The range to replace. Must begin and end on the same line.
Range *Range `json:"range,omitempty"`
// An optional {@link Command} that is executed *after* inserting this completion.
Command *Command `json:"command,omitempty"`
}
// Represents a collection of {@link InlineCompletionItem inline completion items} to be presented in the editor.
//
// @since 3.18.0
// @proposed
//
// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#inlineCompletionList
type InlineCompletionList struct {
// The inline completion items
Items []InlineCompletionItem `json:"items"`
}
// Inline completion options used during static registration.
//
// @since 3.18.0
// @proposed
//
// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#inlineCompletionOptions
type InlineCompletionOptions struct {
WorkDoneProgressOptions
}
// A parameter literal used in inline completion requests.
//
// @since 3.18.0
// @proposed
//
// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#inlineCompletionParams
type InlineCompletionParams struct {
// Additional information about the context in which inline completions were
// requested.
Context InlineCompletionContext `json:"context"`
TextDocumentPositionParams
WorkDoneProgressParams
}
// Inline completion options used during static or dynamic registration.
//
// @since 3.18.0
// @proposed
//
// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#inlineCompletionRegistrationOptions
type InlineCompletionRegistrationOptions struct {
InlineCompletionOptions
TextDocumentRegistrationOptions
StaticRegistrationOptions
}
// Describes how an {@link InlineCompletionItemProvider inline completion provider} was triggered.
//
// @since 3.18.0
// @proposed
type InlineCompletionTriggerKind uint32
// Inline value information can be provided by different means:
//
// - directly as a text value (class InlineValueText).
// - as a name to use for a variable lookup (class InlineValueVariableLookup)
// - as an evaluatable expression (class InlineValueEvaluatableExpression)
//
// The InlineValue types combines all inline value types into one type.
//
// @since 3.17.0
//
// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#inlineValue
type InlineValue = Or_InlineValue // (alias)
// Client capabilities specific to inline values.
//
// @since 3.17.0
//
// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#inlineValueClientCapabilities
type InlineValueClientCapabilities struct {
// Whether implementation supports dynamic registration for inline value providers.
DynamicRegistration bool `json:"dynamicRegistration,omitempty"`
}
// @since 3.17.0
//
// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#inlineValueContext
type InlineValueContext struct {
// The stack frame (as a DAP Id) where the execution has stopped.
FrameID int32 `json:"frameId"`
// The document range where execution has stopped.
// Typically the end position of the range denotes the line where the inline values are shown.
StoppedLocation Range `json:"stoppedLocation"`
}
// Provide an inline value through an expression evaluation.
// If only a range is specified, the expression will be extracted from the underlying document.
// An optional expression can be used to override the extracted expression.
//
// @since 3.17.0
//
// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#inlineValueEvaluatableExpression
type InlineValueEvaluatableExpression struct {
// The document range for which the inline value applies.
// The range is used to extract the evaluatable expression from the underlying document.
Range Range `json:"range"`
// If specified the expression overrides the extracted expression.
Expression string `json:"expression,omitempty"`
}
// Inline value options used during static registration.
//
// @since 3.17.0
//
// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#inlineValueOptions
type InlineValueOptions struct {
WorkDoneProgressOptions
}
// A parameter literal used in inline value requests.
//
// @since 3.17.0
//
// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#inlineValueParams
type InlineValueParams struct {
// The text document.
TextDocument TextDocumentIdentifier `json:"textDocument"`
// The document range for which inline values should be computed.
Range Range `json:"range"`
// Additional information about the context in which inline values were
// requested.
Context InlineValueContext `json:"context"`
WorkDoneProgressParams
}
// Inline value options used during static or dynamic registration.
//
// @since 3.17.0
//
// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#inlineValueRegistrationOptions
type InlineValueRegistrationOptions struct {
InlineValueOptions
TextDocumentRegistrationOptions
StaticRegistrationOptions
}
// Provide inline value as text.
//
// @since 3.17.0
//
// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#inlineValueText
type InlineValueText struct {
// The document range for which the inline value applies.
Range Range `json:"range"`
// The text of the inline value.
Text string `json:"text"`
}
// Provide inline value through a variable lookup.
// If only a range is specified, the variable name will be extracted from the underlying document.
// An optional variable name can be used to override the extracted name.
//
// @since 3.17.0
//
// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#inlineValueVariableLookup
type InlineValueVariableLookup struct {
// The document range for which the inline value applies.
// The range is used to extract the variable name from the underlying document.
Range Range `json:"range"`
// If specified the name of the variable to look up.
VariableName string `json:"variableName,omitempty"`
// How to perform the lookup.
CaseSensitiveLookup bool `json:"caseSensitiveLookup"`
}
// Client workspace capabilities specific to inline values.
//
// @since 3.17.0
//
// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#inlineValueWorkspaceClientCapabilities
type InlineValueWorkspaceClientCapabilities struct {
// Whether the client implementation supports a refresh request sent from the
// server to the client.
//
// Note that this event is global and will force the client to refresh all
// inline values currently shown. It should be used with absolute care and is
// useful for situation where a server for example detects a project wide
// change that requires such a calculation.
RefreshSupport bool `json:"refreshSupport,omitempty"`
}
// A special text edit to provide an insert and a replace operation.
//
// @since 3.16.0
//
// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#insertReplaceEdit
type InsertReplaceEdit struct {
// The string to be inserted.
NewText string `json:"newText"`
// The range if the insert is requested
Insert Range `json:"insert"`
// The range if the replace is requested.
Replace Range `json:"replace"`
}
// Defines whether the insert text in a completion item should be interpreted as
// plain text or a snippet.
type InsertTextFormat uint32
// How whitespace and indentation is handled during completion
// item insertion.
//
// @since 3.16.0
type InsertTextMode uint32
type LSPAny = interface{}
// LSP arrays.
// @since 3.17.0
//
// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#lSPArray
type LSPArray = []interface{} // (alias)
type LSPErrorCodes int32
// LSP object definition.
// @since 3.17.0
//
// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#lSPObject
type LSPObject = map[string]LSPAny // (alias)
// Predefined Language kinds
// @since 3.18.0
// @proposed
type LanguageKind string
// Client capabilities for the linked editing range request.
//
// @since 3.16.0
//
// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#linkedEditingRangeClientCapabilities
type LinkedEditingRangeClientCapabilities struct {
// Whether implementation supports dynamic registration. If this is set to `true`
// the client supports the new `(TextDocumentRegistrationOptions & StaticRegistrationOptions)`
// return value for the corresponding server capability as well.
DynamicRegistration bool `json:"dynamicRegistration,omitempty"`
}
// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#linkedEditingRangeOptions
type LinkedEditingRangeOptions struct {
WorkDoneProgressOptions
}
// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#linkedEditingRangeParams
type LinkedEditingRangeParams struct {
TextDocumentPositionParams
WorkDoneProgressParams
}
// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#linkedEditingRangeRegistrationOptions
type LinkedEditingRangeRegistrationOptions struct {
TextDocumentRegistrationOptions
LinkedEditingRangeOptions
StaticRegistrationOptions
}
// The result of a linked editing range request.
//
// @since 3.16.0
//
// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#linkedEditingRanges
type LinkedEditingRanges struct {
// A list of ranges that can be edited together. The ranges must have
// identical length and contain identical text content. The ranges cannot overlap.
Ranges []Range `json:"ranges"`
// An optional word pattern (regular expression) that describes valid contents for
// the given ranges. If no pattern is provided, the client configuration's word
// pattern will be used.
WordPattern string `json:"wordPattern,omitempty"`
}
// created for Literal (Lit_ClientSemanticTokensRequestOptions_range_Item1)
type Lit_ClientSemanticTokensRequestOptions_range_Item1 struct {
}
// created for Literal (Lit_SemanticTokensOptions_range_Item1)
type Lit_SemanticTokensOptions_range_Item1 struct {
}
// Represents a location inside a resource, such as a line
// inside a text file.
//
// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#location
type Location struct {
URI DocumentUri `json:"uri"`
Range Range `json:"range"`
}
// Represents the connection of two locations. Provides additional metadata over normal {@link Location locations},
// including an origin range.
//
// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#locationLink
type LocationLink struct {
// Span of the origin of this link.
//
// Used as the underlined span for mouse interaction. Defaults to the word range at
// the definition position.
OriginSelectionRange *Range `json:"originSelectionRange,omitempty"`
// The target resource identifier of this link.
TargetURI DocumentUri `json:"targetUri"`
// The full target range of this link. If the target for example is a symbol then target range is the
// range enclosing this symbol not including leading/trailing whitespace but everything else
// like comments. This information is typically used to highlight the range in the editor.
TargetRange Range `json:"targetRange"`
// The range that should be selected and revealed when this link is being followed, e.g the name of a function.
// Must be contained by the `targetRange`. See also `DocumentSymbol#range`
TargetSelectionRange Range `json:"targetSelectionRange"`
}
// Location with only uri and does not include range.
//
// @since 3.18.0
//
// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#locationUriOnly
type LocationUriOnly struct {
URI DocumentUri `json:"uri"`
}
// The log message parameters.
//
// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#logMessageParams
type LogMessageParams struct {
// The message type. See {@link MessageType}
Type MessageType `json:"type"`
// The actual message.
Message string `json:"message"`
}
// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#logTraceParams
type LogTraceParams struct {
Message string `json:"message"`
Verbose string `json:"verbose,omitempty"`
}
// Client capabilities specific to the used markdown parser.
//
// @since 3.16.0
//
// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#markdownClientCapabilities
type MarkdownClientCapabilities struct {
// The name of the parser.
Parser string `json:"parser"`
// The version of the parser.
Version string `json:"version,omitempty"`
// A list of HTML tags that the client allows / supports in
// Markdown.
//
// @since 3.17.0
AllowedTags []string `json:"allowedTags,omitempty"`
}
// MarkedString can be used to render human readable text. It is either a markdown string
// or a code-block that provides a language and a code snippet. The language identifier
// is semantically equal to the optional language identifier in fenced code blocks in GitHub
// issues. See https://help.github.com/articles/creating-and-highlighting-code-blocks/#syntax-highlighting
//
// The pair of a language and a value is an equivalent to markdown:
// ```${language}
// ${value}
// ```
//
// Note that markdown strings will be sanitized - that means html will be escaped.
// @deprecated use MarkupContent instead.
//
// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#markedString
type MarkedString = Or_MarkedString // (alias)
// @since 3.18.0
// @deprecated use MarkupContent instead.
//
// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#markedStringWithLanguage
type MarkedStringWithLanguage struct {
Language string `json:"language"`
Value string `json:"value"`
}
// A `MarkupContent` literal represents a string value which content is interpreted base on its
// kind flag. Currently the protocol supports `plaintext` and `markdown` as markup kinds.
//
// If the kind is `markdown` then the value can contain fenced code blocks like in GitHub issues.
// See https://help.github.com/articles/creating-and-highlighting-code-blocks/#syntax-highlighting
//
// Here is an example how such a string can be constructed using JavaScript / TypeScript:
// ```ts
//
// let markdown: MarkdownContent = {
// kind: MarkupKind.Markdown,
// value: [
// '# Header',
// 'Some text',
// '```typescript',
// 'someCode();',
// '```'
// ].join('\n')
// };
//
// ```
//
// *Please Note* that clients might sanitize the return markdown. A client could decide to
// remove HTML from the markdown to avoid script execution.
//
// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#markupContent
type MarkupContent struct {
// The type of the Markup
Kind MarkupKind `json:"kind"`
// The content itself
Value string `json:"value"`
}
// Describes the content type that a client supports in various
// result literals like `Hover`, `ParameterInfo` or `CompletionItem`.
//
// Please note that `MarkupKinds` must not start with a `$`. This kinds
// are reserved for internal usage.
type MarkupKind string
// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#messageActionItem
type MessageActionItem struct {
// A short title like 'Retry', 'Open Log' etc.
Title string `json:"title"`
}
// The message type
type MessageType uint32
// Moniker definition to match LSIF 0.5 moniker definition.
//
// @since 3.16.0
//
// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#moniker
type Moniker struct {
// The scheme of the moniker. For example tsc or .Net
Scheme string `json:"scheme"`
// The identifier of the moniker. The value is opaque in LSIF however
// schema owners are allowed to define the structure if they want.
Identifier string `json:"identifier"`
// The scope in which the moniker is unique
Unique UniquenessLevel `json:"unique"`
// The moniker kind if known.
Kind *MonikerKind `json:"kind,omitempty"`
}
// Client capabilities specific to the moniker request.
//
// @since 3.16.0
//
// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#monikerClientCapabilities
type MonikerClientCapabilities struct {
// Whether moniker supports dynamic registration. If this is set to `true`
// the client supports the new `MonikerRegistrationOptions` return value
// for the corresponding server capability as well.
DynamicRegistration bool `json:"dynamicRegistration,omitempty"`
}
// The moniker kind.
//
// @since 3.16.0
type MonikerKind string
// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#monikerOptions
type MonikerOptions struct {
WorkDoneProgressOptions
}
// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#monikerParams
type MonikerParams struct {
TextDocumentPositionParams
WorkDoneProgressParams
PartialResultParams
}
// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#monikerRegistrationOptions
type MonikerRegistrationOptions struct {
TextDocumentRegistrationOptions
MonikerOptions
}
// A notebook cell.
//
// A cell's document URI must be unique across ALL notebook
// cells and can therefore be used to uniquely identify a
// notebook cell or the cell's text document.
//
// @since 3.17.0
//
// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#notebookCell
type NotebookCell struct {
// The cell's kind
Kind NotebookCellKind `json:"kind"`
// The URI of the cell's text document
// content.
Document DocumentUri `json:"document"`
// Additional metadata stored with the cell.
//
// Note: should always be an object literal (e.g. LSPObject)
Metadata *LSPObject `json:"metadata,omitempty"`
// Additional execution summary information
// if supported by the client.
ExecutionSummary *ExecutionSummary `json:"executionSummary,omitempty"`
}
// A change describing how to move a `NotebookCell`
// array from state S to S'.
//
// @since 3.17.0
//
// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#notebookCellArrayChange
type NotebookCellArrayChange struct {
// The start oftest of the cell that changed.
Start uint32 `json:"start"`
// The deleted cells
DeleteCount uint32 `json:"deleteCount"`
// The new cells, if any
Cells []NotebookCell `json:"cells,omitempty"`
}
// A notebook cell kind.
//
// @since 3.17.0
type NotebookCellKind uint32
// @since 3.18.0
//
// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#notebookCellLanguage
type NotebookCellLanguage struct {
Language string `json:"language"`
}
// A notebook cell text document filter denotes a cell text
// document by different properties.
//
// @since 3.17.0
//
// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#notebookCellTextDocumentFilter
type NotebookCellTextDocumentFilter struct {
// A filter that matches against the notebook
// containing the notebook cell. If a string
// value is provided it matches against the
// notebook type. '*' matches every notebook.
Notebook Or_NotebookCellTextDocumentFilter_notebook `json:"notebook"`
// A language id like `python`.
//
// Will be matched against the language id of the
// notebook cell document. '*' matches every language.
Language string `json:"language,omitempty"`
}
// A notebook document.
//
// @since 3.17.0
//
// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#notebookDocument
type NotebookDocument struct {
// The notebook document's uri.
URI URI `json:"uri"`
// The type of the notebook.
NotebookType string `json:"notebookType"`
// The version number of this document (it will increase after each
// change, including undo/redo).
Version int32 `json:"version"`
// Additional metadata stored with the notebook
// document.
//
// Note: should always be an object literal (e.g. LSPObject)
Metadata *LSPObject `json:"metadata,omitempty"`
// The cells of a notebook.
Cells []NotebookCell `json:"cells"`
}
// Structural changes to cells in a notebook document.
//
// @since 3.18.0
//
// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#notebookDocumentCellChangeStructure
type NotebookDocumentCellChangeStructure struct {
// The change to the cell array.
Array NotebookCellArrayChange `json:"array"`
// Additional opened cell text documents.
DidOpen []TextDocumentItem `json:"didOpen,omitempty"`
// Additional closed cell text documents.
DidClose []TextDocumentIdentifier `json:"didClose,omitempty"`
}
// Cell changes to a notebook document.
//
// @since 3.18.0
//
// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#notebookDocumentCellChanges
type NotebookDocumentCellChanges struct {
// Changes to the cell structure to add or
// remove cells.
Structure *NotebookDocumentCellChangeStructure `json:"structure,omitempty"`
// Changes to notebook cells properties like its
// kind, execution summary or metadata.
Data []NotebookCell `json:"data,omitempty"`
// Changes to the text content of notebook cells.
TextContent []NotebookDocumentCellContentChanges `json:"textContent,omitempty"`
}
// Content changes to a cell in a notebook document.
//
// @since 3.18.0
//
// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#notebookDocumentCellContentChanges
type NotebookDocumentCellContentChanges struct {
Document VersionedTextDocumentIdentifier `json:"document"`
Changes []TextDocumentContentChangeEvent `json:"changes"`
}
// A change event for a notebook document.
//
// @since 3.17.0
//
// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#notebookDocumentChangeEvent
type NotebookDocumentChangeEvent struct {
// The changed meta data if any.
//
// Note: should always be an object literal (e.g. LSPObject)
Metadata *LSPObject `json:"metadata,omitempty"`
// Changes to cells
Cells *NotebookDocumentCellChanges `json:"cells,omitempty"`
}
// Capabilities specific to the notebook document support.
//
// @since 3.17.0
//
// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#notebookDocumentClientCapabilities
type NotebookDocumentClientCapabilities struct {
// Capabilities specific to notebook document synchronization
//
// @since 3.17.0
Synchronization NotebookDocumentSyncClientCapabilities `json:"synchronization"`
}
// A notebook document filter denotes a notebook document by
// different properties. The properties will be match
// against the notebook's URI (same as with documents)
//
// @since 3.17.0
//
// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#notebookDocumentFilter
type NotebookDocumentFilter = Or_NotebookDocumentFilter // (alias)
// A notebook document filter where `notebookType` is required field.
//
// @since 3.18.0
//
// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#notebookDocumentFilterNotebookType
type NotebookDocumentFilterNotebookType struct {
// The type of the enclosing notebook.
NotebookType string `json:"notebookType"`
// A Uri {@link Uri.scheme scheme}, like `file` or `untitled`.
Scheme string `json:"scheme,omitempty"`
// A glob pattern.
Pattern *GlobPattern `json:"pattern,omitempty"`
}
// A notebook document filter where `pattern` is required field.
//
// @since 3.18.0
//
// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#notebookDocumentFilterPattern
type NotebookDocumentFilterPattern struct {
// The type of the enclosing notebook.
NotebookType string `json:"notebookType,omitempty"`
// A Uri {@link Uri.scheme scheme}, like `file` or `untitled`.
Scheme string `json:"scheme,omitempty"`
// A glob pattern.
Pattern GlobPattern `json:"pattern"`
}
// A notebook document filter where `scheme` is required field.
//
// @since 3.18.0
//
// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#notebookDocumentFilterScheme
type NotebookDocumentFilterScheme struct {
// The type of the enclosing notebook.
NotebookType string `json:"notebookType,omitempty"`
// A Uri {@link Uri.scheme scheme}, like `file` or `untitled`.
Scheme string `json:"scheme"`
// A glob pattern.
Pattern *GlobPattern `json:"pattern,omitempty"`
}
// @since 3.18.0
//
// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#notebookDocumentFilterWithCells
type NotebookDocumentFilterWithCells struct {
// The notebook to be synced If a string
// value is provided it matches against the
// notebook type. '*' matches every notebook.
Notebook *Or_NotebookDocumentFilterWithCells_notebook `json:"notebook,omitempty"`
// The cells of the matching notebook to be synced.
Cells []NotebookCellLanguage `json:"cells"`
}
// @since 3.18.0
//
// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#notebookDocumentFilterWithNotebook
type NotebookDocumentFilterWithNotebook struct {
// The notebook to be synced If a string
// value is provided it matches against the
// notebook type. '*' matches every notebook.
Notebook Or_NotebookDocumentFilterWithNotebook_notebook `json:"notebook"`
// The cells of the matching notebook to be synced.
Cells []NotebookCellLanguage `json:"cells,omitempty"`
}
// A literal to identify a notebook document in the client.
//
// @since 3.17.0
//
// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#notebookDocumentIdentifier
type NotebookDocumentIdentifier struct {
// The notebook document's uri.
URI URI `json:"uri"`
}
// Notebook specific client capabilities.
//
// @since 3.17.0
//
// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#notebookDocumentSyncClientCapabilities
type NotebookDocumentSyncClientCapabilities struct {
// Whether implementation supports dynamic registration. If this is
// set to `true` the client supports the new
// `(TextDocumentRegistrationOptions & StaticRegistrationOptions)`
// return value for the corresponding server capability as well.
DynamicRegistration bool `json:"dynamicRegistration,omitempty"`
// The client supports sending execution summary data per cell.
ExecutionSummarySupport bool `json:"executionSummarySupport,omitempty"`
}
// Options specific to a notebook plus its cells
// to be synced to the server.
//
// If a selector provides a notebook document
// filter but no cell selector all cells of a
// matching notebook document will be synced.
//
// If a selector provides no notebook document
// filter but only a cell selector all notebook
// document that contain at least one matching
// cell will be synced.
//
// @since 3.17.0
//
// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#notebookDocumentSyncOptions
type NotebookDocumentSyncOptions struct {
// The notebooks to be synced
NotebookSelector []Or_NotebookDocumentSyncOptions_notebookSelector_Elem `json:"notebookSelector"`
// Whether save notification should be forwarded to
// the server. Will only be honored if mode === `notebook`.
Save bool `json:"save,omitempty"`
}
// Registration options specific to a notebook.
//
// @since 3.17.0
//
// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#notebookDocumentSyncRegistrationOptions
type NotebookDocumentSyncRegistrationOptions struct {
NotebookDocumentSyncOptions
StaticRegistrationOptions
}
// A text document identifier to optionally denote a specific version of a text document.
//
// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#optionalVersionedTextDocumentIdentifier
type OptionalVersionedTextDocumentIdentifier struct {
// The version number of this document. If a versioned text document identifier
// is sent from the server to the client and the file is not open in the editor
// (the server has not received an open notification before) the server can send
// `null` to indicate that the version is unknown and the content on disk is the
// truth (as specified with document content ownership).
Version int32 `json:"version"`
TextDocumentIdentifier
}
// created for Or [int32 string]
type Or_CancelParams_id struct {
Value interface{} `json:"value"`
}
// created for Or [ClientSemanticTokensRequestFullDelta bool]
type Or_ClientSemanticTokensRequestOptions_full struct {
Value interface{} `json:"value"`
}
// created for Or [Lit_ClientSemanticTokensRequestOptions_range_Item1 bool]
type Or_ClientSemanticTokensRequestOptions_range struct {
Value interface{} `json:"value"`
}
// created for Or [EditRangeWithInsertReplace Range]
type Or_CompletionItemDefaults_editRange struct {
Value interface{} `json:"value"`
}
// created for Or [MarkupContent string]
type Or_CompletionItem_documentation struct {
Value interface{} `json:"value"`
}
// created for Or [InsertReplaceEdit TextEdit]
type Or_CompletionItem_textEdit struct {
Value interface{} `json:"value"`
}
// created for Or [Location []Location]
type Or_Declaration struct {
Value interface{} `json:"value"`
}
// created for Or [Location []Location]
type Or_Definition struct {
Value interface{} `json:"value"`
}
// created for Or [int32 string]
type Or_Diagnostic_code struct {
Value interface{} `json:"value"`
}
// created for Or [[]string string]
type Or_DidChangeConfigurationRegistrationOptions_section struct {
Value interface{} `json:"value"`
}
// created for Or [RelatedFullDocumentDiagnosticReport RelatedUnchangedDocumentDiagnosticReport]
type Or_DocumentDiagnosticReport struct {
Value interface{} `json:"value"`
}
// created for Or [FullDocumentDiagnosticReport UnchangedDocumentDiagnosticReport]
type Or_DocumentDiagnosticReportPartialResult_relatedDocuments_Value struct {
Value interface{} `json:"value"`
}
// created for Or [NotebookCellTextDocumentFilter TextDocumentFilter]
type Or_DocumentFilter struct {
Value interface{} `json:"value"`
}
// created for Or [Pattern RelativePattern]
type Or_GlobPattern struct {
Value interface{} `json:"value"`
}
// created for Or [MarkedString MarkupContent []MarkedString]
type Or_Hover_contents struct {
Value interface{} `json:"value"`
}
// created for Or [MarkupContent string]
type Or_InlayHintLabelPart_tooltip struct {
Value interface{} `json:"value"`
}
// created for Or [[]InlayHintLabelPart string]
type Or_InlayHint_label struct {
Value interface{} `json:"value"`
}
// created for Or [MarkupContent string]
type Or_InlayHint_tooltip struct {
Value interface{} `json:"value"`
}
// created for Or [StringValue string]
type Or_InlineCompletionItem_insertText struct {
Value interface{} `json:"value"`
}
// created for Or [InlineValueEvaluatableExpression InlineValueText InlineValueVariableLookup]
type Or_InlineValue struct {
Value interface{} `json:"value"`
}
// created for Or [LSPArray LSPObject bool float64 int32 string uint32]
type Or_LSPAny struct {
Value interface{} `json:"value"`
}
// created for Or [MarkedStringWithLanguage string]
type Or_MarkedString struct {
Value interface{} `json:"value"`
}
// created for Or [NotebookDocumentFilter string]
type Or_NotebookCellTextDocumentFilter_notebook struct {
Value interface{} `json:"value"`
}
// created for Or [NotebookDocumentFilterNotebookType NotebookDocumentFilterPattern NotebookDocumentFilterScheme]
type Or_NotebookDocumentFilter struct {
Value interface{} `json:"value"`
}
// created for Or [NotebookDocumentFilter string]
type Or_NotebookDocumentFilterWithCells_notebook struct {
Value interface{} `json:"value"`
}
// created for Or [NotebookDocumentFilter string]
type Or_NotebookDocumentFilterWithNotebook_notebook struct {
Value interface{} `json:"value"`
}
// created for Or [NotebookDocumentFilterWithCells NotebookDocumentFilterWithNotebook]
type Or_NotebookDocumentSyncOptions_notebookSelector_Elem struct {
Value interface{} `json:"value"`
}
// created for Or [MarkupContent string]
type Or_ParameterInformation_documentation struct {
Value interface{} `json:"value"`
}
// created for Or [Tuple_ParameterInformation_label_Item1 string]
type Or_ParameterInformation_label struct {
Value interface{} `json:"value"`
}
// created for Or [PrepareRenameDefaultBehavior PrepareRenamePlaceholder Range]
type Or_PrepareRenameResult struct {
Value interface{} `json:"value"`
}
// created for Or [int32 string]
type Or_ProgressToken struct {
Value interface{} `json:"value"`
}
// created for Or [FullDocumentDiagnosticReport UnchangedDocumentDiagnosticReport]
type Or_RelatedFullDocumentDiagnosticReport_relatedDocuments_Value struct {
Value interface{} `json:"value"`
}
// created for Or [FullDocumentDiagnosticReport UnchangedDocumentDiagnosticReport]
type Or_RelatedUnchangedDocumentDiagnosticReport_relatedDocuments_Value struct {
Value interface{} `json:"value"`
}
// created for Or [URI WorkspaceFolder]
type Or_RelativePattern_baseUri struct {
Value interface{} `json:"value"`
}
// created for Or [CodeAction Command]
type Or_Result_textDocument_codeAction_Item0_Elem struct {
Value interface{} `json:"value"`
}
// created for Or [CompletionList []CompletionItem]
type Or_Result_textDocument_completion struct {
Value interface{} `json:"value"`
}
// created for Or [Declaration []DeclarationLink]
type Or_Result_textDocument_declaration struct {
Value interface{} `json:"value"`
}
// created for Or [Definition []DefinitionLink]
type Or_Result_textDocument_definition struct {
Value interface{} `json:"value"`
}
// created for Or [[]DocumentSymbol []SymbolInformation]
type Or_Result_textDocument_documentSymbol struct {
Value interface{} `json:"value"`
}
// created for Or [Definition []DefinitionLink]
type Or_Result_textDocument_implementation struct {
Value interface{} `json:"value"`
}
// created for Or [InlineCompletionList []InlineCompletionItem]
type Or_Result_textDocument_inlineCompletion struct {
Value interface{} `json:"value"`
}
// created for Or [SemanticTokens SemanticTokensDelta]
type Or_Result_textDocument_semanticTokens_full_delta struct {
Value interface{} `json:"value"`
}
// created for Or [Definition []DefinitionLink]
type Or_Result_textDocument_typeDefinition struct {
Value interface{} `json:"value"`
}
// created for Or [[]SymbolInformation []WorkspaceSymbol]
type Or_Result_workspace_symbol struct {
Value interface{} `json:"value"`
}
// created for Or [SemanticTokensFullDelta bool]
type Or_SemanticTokensOptions_full struct {
Value interface{} `json:"value"`
}
// created for Or [Lit_SemanticTokensOptions_range_Item1 bool]
type Or_SemanticTokensOptions_range struct {
Value interface{} `json:"value"`
}
// created for Or [CallHierarchyOptions CallHierarchyRegistrationOptions bool]
type Or_ServerCapabilities_callHierarchyProvider struct {
Value interface{} `json:"value"`
}
// created for Or [CodeActionOptions bool]
type Or_ServerCapabilities_codeActionProvider struct {
Value interface{} `json:"value"`
}
// created for Or [DocumentColorOptions DocumentColorRegistrationOptions bool]
type Or_ServerCapabilities_colorProvider struct {
Value interface{} `json:"value"`
}
// created for Or [DeclarationOptions DeclarationRegistrationOptions bool]
type Or_ServerCapabilities_declarationProvider struct {
Value interface{} `json:"value"`
}
// created for Or [DefinitionOptions bool]
type Or_ServerCapabilities_definitionProvider struct {
Value interface{} `json:"value"`
}
// created for Or [DiagnosticOptions DiagnosticRegistrationOptions]
type Or_ServerCapabilities_diagnosticProvider struct {
Value interface{} `json:"value"`
}
// created for Or [DocumentFormattingOptions bool]
type Or_ServerCapabilities_documentFormattingProvider struct {
Value interface{} `json:"value"`
}
// created for Or [DocumentHighlightOptions bool]
type Or_ServerCapabilities_documentHighlightProvider struct {
Value interface{} `json:"value"`
}
// created for Or [DocumentRangeFormattingOptions bool]
type Or_ServerCapabilities_documentRangeFormattingProvider struct {
Value interface{} `json:"value"`
}
// created for Or [DocumentSymbolOptions bool]
type Or_ServerCapabilities_documentSymbolProvider struct {
Value interface{} `json:"value"`
}
// created for Or [FoldingRangeOptions FoldingRangeRegistrationOptions bool]
type Or_ServerCapabilities_foldingRangeProvider struct {
Value interface{} `json:"value"`
}
// created for Or [HoverOptions bool]
type Or_ServerCapabilities_hoverProvider struct {
Value interface{} `json:"value"`
}
// created for Or [ImplementationOptions ImplementationRegistrationOptions bool]
type Or_ServerCapabilities_implementationProvider struct {
Value interface{} `json:"value"`
}
// created for Or [InlayHintOptions InlayHintRegistrationOptions bool]
type Or_ServerCapabilities_inlayHintProvider struct {
Value interface{} `json:"value"`
}
// created for Or [InlineCompletionOptions bool]
type Or_ServerCapabilities_inlineCompletionProvider struct {
Value interface{} `json:"value"`
}
// created for Or [InlineValueOptions InlineValueRegistrationOptions bool]
type Or_ServerCapabilities_inlineValueProvider struct {
Value interface{} `json:"value"`
}
// created for Or [LinkedEditingRangeOptions LinkedEditingRangeRegistrationOptions bool]
type Or_ServerCapabilities_linkedEditingRangeProvider struct {
Value interface{} `json:"value"`
}
// created for Or [MonikerOptions MonikerRegistrationOptions bool]
type Or_ServerCapabilities_monikerProvider struct {
Value interface{} `json:"value"`
}
// created for Or [NotebookDocumentSyncOptions NotebookDocumentSyncRegistrationOptions]
type Or_ServerCapabilities_notebookDocumentSync struct {
Value interface{} `json:"value"`
}
// created for Or [ReferenceOptions bool]
type Or_ServerCapabilities_referencesProvider struct {
Value interface{} `json:"value"`
}
// created for Or [RenameOptions bool]
type Or_ServerCapabilities_renameProvider struct {
Value interface{} `json:"value"`
}
// created for Or [SelectionRangeOptions SelectionRangeRegistrationOptions bool]
type Or_ServerCapabilities_selectionRangeProvider struct {
Value interface{} `json:"value"`
}
// created for Or [SemanticTokensOptions SemanticTokensRegistrationOptions]
type Or_ServerCapabilities_semanticTokensProvider struct {
Value interface{} `json:"value"`
}
// created for Or [TextDocumentSyncKind TextDocumentSyncOptions]
type Or_ServerCapabilities_textDocumentSync struct {
Value interface{} `json:"value"`
}
// created for Or [TypeDefinitionOptions TypeDefinitionRegistrationOptions bool]
type Or_ServerCapabilities_typeDefinitionProvider struct {
Value interface{} `json:"value"`
}
// created for Or [TypeHierarchyOptions TypeHierarchyRegistrationOptions bool]
type Or_ServerCapabilities_typeHierarchyProvider struct {
Value interface{} `json:"value"`
}
// created for Or [WorkspaceSymbolOptions bool]
type Or_ServerCapabilities_workspaceSymbolProvider struct {
Value interface{} `json:"value"`
}
// created for Or [MarkupContent string]
type Or_SignatureInformation_documentation struct {
Value interface{} `json:"value"`
}
// created for Or [TextDocumentContentChangePartial TextDocumentContentChangeWholeDocument]
type Or_TextDocumentContentChangeEvent struct {
Value interface{} `json:"value"`
}
// created for Or [AnnotatedTextEdit SnippetTextEdit TextEdit]
type Or_TextDocumentEdit_edits_Elem struct {
Value interface{} `json:"value"`
}
// created for Or [TextDocumentFilterLanguage TextDocumentFilterPattern TextDocumentFilterScheme]
type Or_TextDocumentFilter struct {
Value interface{} `json:"value"`
}
// created for Or [SaveOptions bool]
type Or_TextDocumentSyncOptions_save struct {
Value interface{} `json:"value"`
}
// created for Or [WorkspaceFullDocumentDiagnosticReport WorkspaceUnchangedDocumentDiagnosticReport]
type Or_WorkspaceDocumentDiagnosticReport struct {
Value interface{} `json:"value"`
}
// created for Or [CreateFile DeleteFile RenameFile TextDocumentEdit]
type Or_WorkspaceEdit_documentChanges_Elem struct {
Value interface{} `json:"value"`
}
// created for Or [bool string]
type Or_WorkspaceFoldersServerCapabilities_changeNotifications struct {
Value interface{} `json:"value"`
}
// created for Or [TextDocumentContentOptions TextDocumentContentRegistrationOptions]
type Or_WorkspaceOptions_textDocumentContent struct {
Value interface{} `json:"value"`
}
// created for Or [Location LocationUriOnly]
type Or_WorkspaceSymbol_location struct {
Value interface{} `json:"value"`
}
// The parameters of a configuration request.
//
// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#configurationParams
type ParamConfiguration struct {
Items []ConfigurationItem `json:"items"`
}
// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#initializeParams
type ParamInitialize struct {
XInitializeParams
WorkspaceFoldersInitializeParams
}
// Represents a parameter of a callable-signature. A parameter can
// have a label and a doc-comment.
//
// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#parameterInformation
type ParameterInformation struct {
// The label of this parameter information.
//
// Either a string or an inclusive start and exclusive end offsets within its containing
// signature label. (see SignatureInformation.label). The offsets are based on a UTF-16
// string representation as `Position` and `Range` does.
//
// To avoid ambiguities a server should use the [start, end] offset value instead of using
// a substring. Whether a client support this is controlled via `labelOffsetSupport` client
// capability.
//
// *Note*: a label of type string should be a substring of its containing signature label.
// Its intended use case is to highlight the parameter label part in the `SignatureInformation.label`.
Label Or_ParameterInformation_label `json:"label"`
// The human-readable doc-comment of this parameter. Will be shown
// in the UI but can be omitted.
Documentation *Or_ParameterInformation_documentation `json:"documentation,omitempty"`
}
// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#partialResultParams
type PartialResultParams struct {
// An optional token that a server can use to report partial results (e.g. streaming) to
// the client.
PartialResultToken *ProgressToken `json:"partialResultToken,omitempty"`
}
// The glob pattern to watch relative to the base path. Glob patterns can have the following syntax:
//
// - `*` to match one or more characters in a path segment
// - `?` to match on one character in a path segment
// - `**` to match any number of path segments, including none
// - `{}` to group conditions (e.g. `**/*.{ts,js}` matches all TypeScript and JavaScript files)
// - `[]` to declare a range of characters to match in a path segment (e.g., `example.[0-9]` to match on `example.0`, `example.1`, …)
// - `[!...]` to negate a range of characters to match in a path segment (e.g., `example.[!0-9]` to match on `example.a`, `example.b`, but not `example.0`)
//
// @since 3.17.0
//
// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#pattern
type Pattern = string // (alias)
// Position in a text document expressed as zero-based line and character
// offset. Prior to 3.17 the offsets were always based on a UTF-16 string
// representation. So a string of the form `a𐐀b` the character offset of the
// character `a` is 0, the character offset of `𐐀` is 1 and the character
// offset of b is 3 since `𐐀` is represented using two code units in UTF-16.
// Since 3.17 clients and servers can agree on a different string encoding
// representation (e.g. UTF-8). The client announces it's supported encoding
// via the client capability [`general.positionEncodings`](https://microsoft.github.io/language-server-protocol/specifications/specification-current/#clientCapabilities).
// The value is an array of position encodings the client supports, with
// decreasing preference (e.g. the encoding at index `0` is the most preferred
// one). To stay backwards compatible the only mandatory encoding is UTF-16
// represented via the string `utf-16`. The server can pick one of the
// encodings offered by the client and signals that encoding back to the
// client via the initialize result's property
// [`capabilities.positionEncoding`](https://microsoft.github.io/language-server-protocol/specifications/specification-current/#serverCapabilities). If the string value
// `utf-16` is missing from the client's capability `general.positionEncodings`
// servers can safely assume that the client supports UTF-16. If the server
// omits the position encoding in its initialize result the encoding defaults
// to the string value `utf-16`. Implementation considerations: since the
// conversion from one encoding into another requires the content of the
// file / line the conversion is best done where the file is read which is
// usually on the server side.
//
// Positions are line end character agnostic. So you can not specify a position
// that denotes `\r|\n` or `\n|` where `|` represents the character offset.
//
// @since 3.17.0 - support for negotiated position encoding.
//
// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#position
type Position struct {
// Line position in a document (zero-based).
//
// If a line number is greater than the number of lines in a document, it defaults back to the number of lines in the document.
// If a line number is negative, it defaults to 0.
Line uint32 `json:"line"`
// Character offset on a line in a document (zero-based).
//
// The meaning of this offset is determined by the negotiated
// `PositionEncodingKind`.
//
// If the character value is greater than the line length it defaults back to the
// line length.
Character uint32 `json:"character"`
}
// A set of predefined position encoding kinds.
//
// @since 3.17.0
type PositionEncodingKind string
// @since 3.18.0
//
// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#prepareRenameDefaultBehavior
type PrepareRenameDefaultBehavior struct {
DefaultBehavior bool `json:"defaultBehavior"`
}
// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#prepareRenameParams
type PrepareRenameParams struct {
TextDocumentPositionParams
WorkDoneProgressParams
}
// @since 3.18.0
//
// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#prepareRenamePlaceholder
type PrepareRenamePlaceholder struct {
Range Range `json:"range"`
Placeholder string `json:"placeholder"`
}
// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#prepareRenameResult
type PrepareRenameResult = Or_PrepareRenameResult // (alias)
type PrepareSupportDefaultBehavior uint32
// A previous result id in a workspace pull request.
//
// @since 3.17.0
//
// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#previousResultId
type PreviousResultID struct {
// The URI for which the client knowns a
// result id.
URI DocumentUri `json:"uri"`
// The value of the previous result id.
Value string `json:"value"`
}
// A previous result id in a workspace pull request.
//
// @since 3.17.0
//
// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#previousResultId
type PreviousResultId struct {
// The URI for which the client knowns a
// result id.
URI DocumentUri `json:"uri"`
// The value of the previous result id.
Value string `json:"value"`
}
// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#progressParams
type ProgressParams struct {
// The progress token provided by the client or server.
Token ProgressToken `json:"token"`
// The progress data.
Value interface{} `json:"value"`
}
// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#progressToken
type ProgressToken = Or_ProgressToken // (alias)
// The publish diagnostic client capabilities.
//
// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#publishDiagnosticsClientCapabilities
type PublishDiagnosticsClientCapabilities struct {
// Whether the client interprets the version property of the
// `textDocument/publishDiagnostics` notification's parameter.
//
// @since 3.15.0
VersionSupport bool `json:"versionSupport,omitempty"`
DiagnosticsCapabilities
}
// The publish diagnostic notification's parameters.
//
// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#publishDiagnosticsParams
type PublishDiagnosticsParams struct {
// The URI for which diagnostic information is reported.
URI DocumentUri `json:"uri"`
// Optional the version number of the document the diagnostics are published for.
//
// @since 3.15.0
Version int32 `json:"version,omitempty"`
// An array of diagnostic information items.
Diagnostics []Diagnostic `json:"diagnostics"`
}
// A range in a text document expressed as (zero-based) start and end positions.
//
// If you want to specify a range that contains a line including the line ending
// character(s) then use an end position denoting the start of the next line.
// For example:
// ```ts
//
// {
// start: { line: 5, character: 23 }
// end : { line 6, character : 0 }
// }
//
// ```
//
// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#range
type Range struct {
// The range's start position.
Start Position `json:"start"`
// The range's end position.
End Position `json:"end"`
}
// Client Capabilities for a {@link ReferencesRequest}.
//
// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#referenceClientCapabilities
type ReferenceClientCapabilities struct {
// Whether references supports dynamic registration.
DynamicRegistration bool `json:"dynamicRegistration,omitempty"`
}
// Value-object that contains additional information when
// requesting references.
//
// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#referenceContext
type ReferenceContext struct {
// Include the declaration of the current symbol.
IncludeDeclaration bool `json:"includeDeclaration"`
}
// Reference options.
//
// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#referenceOptions
type ReferenceOptions struct {
WorkDoneProgressOptions
}
// Parameters for a {@link ReferencesRequest}.
//
// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#referenceParams
type ReferenceParams struct {
Context ReferenceContext `json:"context"`
TextDocumentPositionParams
WorkDoneProgressParams
PartialResultParams
}
// Registration options for a {@link ReferencesRequest}.
//
// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#referenceRegistrationOptions
type ReferenceRegistrationOptions struct {
TextDocumentRegistrationOptions
ReferenceOptions
}
// General parameters to register for a notification or to register a provider.
//
// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#registration
type Registration struct {
// The id used to register the request. The id can be used to deregister
// the request again.
ID string `json:"id"`
// The method / capability to register for.
Method string `json:"method"`
// Options necessary for the registration.
RegisterOptions interface{} `json:"registerOptions,omitempty"`
}
// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#registrationParams
type RegistrationParams struct {
Registrations []Registration `json:"registrations"`
}
// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#regularExpressionEngineKind
type RegularExpressionEngineKind = string // (alias)
// Client capabilities specific to regular expressions.
//
// @since 3.16.0
//
// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#regularExpressionsClientCapabilities
type RegularExpressionsClientCapabilities struct {
// The engine's name.
Engine RegularExpressionEngineKind `json:"engine"`
// The engine's version.
Version string `json:"version,omitempty"`
}
// A full diagnostic report with a set of related documents.
//
// @since 3.17.0
//
// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#relatedFullDocumentDiagnosticReport
type RelatedFullDocumentDiagnosticReport struct {
// Diagnostics of related documents. This information is useful
// in programming languages where code in a file A can generate
// diagnostics in a file B which A depends on. An example of
// such a language is C/C++ where marco definitions in a file
// a.cpp and result in errors in a header file b.hpp.
//
// @since 3.17.0
RelatedDocuments map[DocumentUri]interface{} `json:"relatedDocuments,omitempty"`
FullDocumentDiagnosticReport
}
// An unchanged diagnostic report with a set of related documents.
//
// @since 3.17.0
//
// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#relatedUnchangedDocumentDiagnosticReport
type RelatedUnchangedDocumentDiagnosticReport struct {
// Diagnostics of related documents. This information is useful
// in programming languages where code in a file A can generate
// diagnostics in a file B which A depends on. An example of
// such a language is C/C++ where marco definitions in a file
// a.cpp and result in errors in a header file b.hpp.
//
// @since 3.17.0
RelatedDocuments map[DocumentUri]interface{} `json:"relatedDocuments,omitempty"`
UnchangedDocumentDiagnosticReport
}
// A relative pattern is a helper to construct glob patterns that are matched
// relatively to a base URI. The common value for a `baseUri` is a workspace
// folder root, but it can be another absolute URI as well.
//
// @since 3.17.0
//
// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#relativePattern
type RelativePattern struct {
// A workspace folder or a base URI to which this pattern will be matched
// against relatively.
BaseURI Or_RelativePattern_baseUri `json:"baseUri"`
// The actual glob pattern;
Pattern Pattern `json:"pattern"`
}
// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#renameClientCapabilities
type RenameClientCapabilities struct {
// Whether rename supports dynamic registration.
DynamicRegistration bool `json:"dynamicRegistration,omitempty"`
// Client supports testing for validity of rename operations
// before execution.
//
// @since 3.12.0
PrepareSupport bool `json:"prepareSupport,omitempty"`
// Client supports the default behavior result.
//
// The value indicates the default behavior used by the
// client.
//
// @since 3.16.0
PrepareSupportDefaultBehavior *PrepareSupportDefaultBehavior `json:"prepareSupportDefaultBehavior,omitempty"`
// Whether the client honors the change annotations in
// text edits and resource operations returned via the
// rename request's workspace edit by for example presenting
// the workspace edit in the user interface and asking
// for confirmation.
//
// @since 3.16.0
HonorsChangeAnnotations bool `json:"honorsChangeAnnotations,omitempty"`
}
// Rename file operation
//
// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#renameFile
type RenameFile struct {
// A rename
Kind string `json:"kind"`
// The old (existing) location.
OldURI DocumentUri `json:"oldUri"`
// The new location.
NewURI DocumentUri `json:"newUri"`
// Rename options.
Options *RenameFileOptions `json:"options,omitempty"`
ResourceOperation
}
// Rename file options
//
// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#renameFileOptions
type RenameFileOptions struct {
// Overwrite target if existing. Overwrite wins over `ignoreIfExists`
Overwrite bool `json:"overwrite,omitempty"`
// Ignores if target exists.
IgnoreIfExists bool `json:"ignoreIfExists,omitempty"`
}
// The parameters sent in notifications/requests for user-initiated renames of
// files.
//
// @since 3.16.0
//
// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#renameFilesParams
type RenameFilesParams struct {
// An array of all files/folders renamed in this operation. When a folder is renamed, only
// the folder will be included, and not its children.
Files []FileRename `json:"files"`
}
// Provider options for a {@link RenameRequest}.
//
// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#renameOptions
type RenameOptions struct {
// Renames should be checked and tested before being executed.
//
// @since version 3.12.0
PrepareProvider bool `json:"prepareProvider,omitempty"`
WorkDoneProgressOptions
}
// The parameters of a {@link RenameRequest}.
//
// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#renameParams
type RenameParams struct {
// The document to rename.
TextDocument TextDocumentIdentifier `json:"textDocument"`
// The position at which this request was sent.
Position Position `json:"position"`
// The new name of the symbol. If the given name is not valid the
// request must return a {@link ResponseError} with an
// appropriate message set.
NewName string `json:"newName"`
WorkDoneProgressParams
}
// Registration options for a {@link RenameRequest}.
//
// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#renameRegistrationOptions
type RenameRegistrationOptions struct {
TextDocumentRegistrationOptions
RenameOptions
}
// A generic resource operation.
//
// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#resourceOperation
type ResourceOperation struct {
// The resource operation kind.
Kind string `json:"kind"`
// An optional annotation identifier describing the operation.
//
// @since 3.16.0
AnnotationID *ChangeAnnotationIdentifier `json:"annotationId,omitempty"`
}
type ResourceOperationKind string
// Save options.
//
// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#saveOptions
type SaveOptions struct {
// The client is supposed to include the content on save.
IncludeText bool `json:"includeText,omitempty"`
}
// Describes the currently selected completion item.
//
// @since 3.18.0
// @proposed
//
// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#selectedCompletionInfo
type SelectedCompletionInfo struct {
// The range that will be replaced if this completion item is accepted.
Range Range `json:"range"`
// The text the range will be replaced with if this completion is accepted.
Text string `json:"text"`
}
// A selection range represents a part of a selection hierarchy. A selection range
// may have a parent selection range that contains it.
//
// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#selectionRange
type SelectionRange struct {
// The {@link Range range} of this selection range.
Range Range `json:"range"`
// The parent selection range containing this range. Therefore `parent.range` must contain `this.range`.
Parent *SelectionRange `json:"parent,omitempty"`
}
// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#selectionRangeClientCapabilities
type SelectionRangeClientCapabilities struct {
// Whether implementation supports dynamic registration for selection range providers. If this is set to `true`
// the client supports the new `SelectionRangeRegistrationOptions` return value for the corresponding server
// capability as well.
DynamicRegistration bool `json:"dynamicRegistration,omitempty"`
}
// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#selectionRangeOptions
type SelectionRangeOptions struct {
WorkDoneProgressOptions
}
// A parameter literal used in selection range requests.
//
// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#selectionRangeParams
type SelectionRangeParams struct {
// The text document.
TextDocument TextDocumentIdentifier `json:"textDocument"`
// The positions inside the text document.
Positions []Position `json:"positions"`
WorkDoneProgressParams
PartialResultParams
}
// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#selectionRangeRegistrationOptions
type SelectionRangeRegistrationOptions struct {
SelectionRangeOptions
TextDocumentRegistrationOptions
StaticRegistrationOptions
}
// A set of predefined token modifiers. This set is not fixed
// an clients can specify additional token types via the
// corresponding client capabilities.
//
// @since 3.16.0
type SemanticTokenModifiers string
// A set of predefined token types. This set is not fixed
// an clients can specify additional token types via the
// corresponding client capabilities.
//
// @since 3.16.0
type SemanticTokenTypes string
// @since 3.16.0
//
// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#semanticTokens
type SemanticTokens struct {
// An optional result id. If provided and clients support delta updating
// the client will include the result id in the next semantic token request.
// A server can then instead of computing all semantic tokens again simply
// send a delta.
ResultID string `json:"resultId,omitempty"`
// The actual tokens.
Data []uint32 `json:"data"`
}
// @since 3.16.0
//
// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#semanticTokensClientCapabilities
type SemanticTokensClientCapabilities struct {
// Whether implementation supports dynamic registration. If this is set to `true`
// the client supports the new `(TextDocumentRegistrationOptions & StaticRegistrationOptions)`
// return value for the corresponding server capability as well.
DynamicRegistration bool `json:"dynamicRegistration,omitempty"`
// Which requests the client supports and might send to the server
// depending on the server's capability. Please note that clients might not
// show semantic tokens or degrade some of the user experience if a range
// or full request is advertised by the client but not provided by the
// server. If for example the client capability `requests.full` and
// `request.range` are both set to true but the server only provides a
// range provider the client might not render a minimap correctly or might
// even decide to not show any semantic tokens at all.
Requests ClientSemanticTokensRequestOptions `json:"requests"`
// The token types that the client supports.
TokenTypes []string `json:"tokenTypes"`
// The token modifiers that the client supports.
TokenModifiers []string `json:"tokenModifiers"`
// The token formats the clients supports.
Formats []TokenFormat `json:"formats"`
// Whether the client supports tokens that can overlap each other.
OverlappingTokenSupport bool `json:"overlappingTokenSupport,omitempty"`
// Whether the client supports tokens that can span multiple lines.
MultilineTokenSupport bool `json:"multilineTokenSupport,omitempty"`
// Whether the client allows the server to actively cancel a
// semantic token request, e.g. supports returning
// LSPErrorCodes.ServerCancelled. If a server does the client
// needs to retrigger the request.
//
// @since 3.17.0
ServerCancelSupport bool `json:"serverCancelSupport,omitempty"`
// Whether the client uses semantic tokens to augment existing
// syntax tokens. If set to `true` client side created syntax
// tokens and semantic tokens are both used for colorization. If
// set to `false` the client only uses the returned semantic tokens
// for colorization.
//
// If the value is `undefined` then the client behavior is not
// specified.
//
// @since 3.17.0
AugmentsSyntaxTokens bool `json:"augmentsSyntaxTokens,omitempty"`
}
// @since 3.16.0
//
// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#semanticTokensDelta
type SemanticTokensDelta struct {
ResultID string `json:"resultId,omitempty"`
// The semantic token edits to transform a previous result into a new result.
Edits []SemanticTokensEdit `json:"edits"`
}
// @since 3.16.0
//
// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#semanticTokensDeltaParams
type SemanticTokensDeltaParams struct {
// The text document.
TextDocument TextDocumentIdentifier `json:"textDocument"`
// The result id of a previous response. The result Id can either point to a full response
// or a delta response depending on what was received last.
PreviousResultID string `json:"previousResultId"`
WorkDoneProgressParams
PartialResultParams
}
// @since 3.16.0
//
// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#semanticTokensDeltaPartialResult
type SemanticTokensDeltaPartialResult struct {
Edits []SemanticTokensEdit `json:"edits"`
}
// @since 3.16.0
//
// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#semanticTokensEdit
type SemanticTokensEdit struct {
// The start offset of the edit.
Start uint32 `json:"start"`
// The count of elements to remove.
DeleteCount uint32 `json:"deleteCount"`
// The elements to insert.
Data []uint32 `json:"data,omitempty"`
}
// Semantic tokens options to support deltas for full documents
//
// @since 3.18.0
//
// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#semanticTokensFullDelta
type SemanticTokensFullDelta struct {
// The server supports deltas for full documents.
Delta bool `json:"delta,omitempty"`
}
// @since 3.16.0
//
// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#semanticTokensLegend
type SemanticTokensLegend struct {
// The token types a server uses.
TokenTypes []string `json:"tokenTypes"`
// The token modifiers a server uses.
TokenModifiers []string `json:"tokenModifiers"`
}
// @since 3.16.0
//
// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#semanticTokensOptions
type SemanticTokensOptions struct {
// The legend used by the server
Legend SemanticTokensLegend `json:"legend"`
// Server supports providing semantic tokens for a specific range
// of a document.
Range *Or_SemanticTokensOptions_range `json:"range,omitempty"`
// Server supports providing semantic tokens for a full document.
Full *Or_SemanticTokensOptions_full `json:"full,omitempty"`
WorkDoneProgressOptions
}
// @since 3.16.0
//
// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#semanticTokensParams
type SemanticTokensParams struct {
// The text document.
TextDocument TextDocumentIdentifier `json:"textDocument"`
WorkDoneProgressParams
PartialResultParams
}
// @since 3.16.0
//
// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#semanticTokensPartialResult
type SemanticTokensPartialResult struct {
Data []uint32 `json:"data"`
}
// @since 3.16.0
//
// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#semanticTokensRangeParams
type SemanticTokensRangeParams struct {
// The text document.
TextDocument TextDocumentIdentifier `json:"textDocument"`
// The range the semantic tokens are requested for.
Range Range `json:"range"`
WorkDoneProgressParams
PartialResultParams
}
// @since 3.16.0
//
// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#semanticTokensRegistrationOptions
type SemanticTokensRegistrationOptions struct {
TextDocumentRegistrationOptions
SemanticTokensOptions
StaticRegistrationOptions
}
// @since 3.16.0
//
// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#semanticTokensWorkspaceClientCapabilities
type SemanticTokensWorkspaceClientCapabilities struct {
// Whether the client implementation supports a refresh request sent from
// the server to the client.
//
// Note that this event is global and will force the client to refresh all
// semantic tokens currently shown. It should be used with absolute care
// and is useful for situation where a server for example detects a project
// wide change that requires such a calculation.
RefreshSupport bool `json:"refreshSupport,omitempty"`
}
// Defines the capabilities provided by a language
// server.
//
// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#serverCapabilities
type ServerCapabilities struct {
// The position encoding the server picked from the encodings offered
// by the client via the client capability `general.positionEncodings`.
//
// If the client didn't provide any position encodings the only valid
// value that a server can return is 'utf-16'.
//
// If omitted it defaults to 'utf-16'.
//
// @since 3.17.0
PositionEncoding *PositionEncodingKind `json:"positionEncoding,omitempty"`
// Defines how text documents are synced. Is either a detailed structure
// defining each notification or for backwards compatibility the
// TextDocumentSyncKind number.
TextDocumentSync interface{} `json:"textDocumentSync,omitempty"`
// Defines how notebook documents are synced.
//
// @since 3.17.0
NotebookDocumentSync *Or_ServerCapabilities_notebookDocumentSync `json:"notebookDocumentSync,omitempty"`
// The server provides completion support.
CompletionProvider *CompletionOptions `json:"completionProvider,omitempty"`
// The server provides hover support.
HoverProvider *Or_ServerCapabilities_hoverProvider `json:"hoverProvider,omitempty"`
// The server provides signature help support.
SignatureHelpProvider *SignatureHelpOptions `json:"signatureHelpProvider,omitempty"`
// The server provides Goto Declaration support.
DeclarationProvider *Or_ServerCapabilities_declarationProvider `json:"declarationProvider,omitempty"`
// The server provides goto definition support.
DefinitionProvider *Or_ServerCapabilities_definitionProvider `json:"definitionProvider,omitempty"`
// The server provides Goto Type Definition support.
TypeDefinitionProvider *Or_ServerCapabilities_typeDefinitionProvider `json:"typeDefinitionProvider,omitempty"`
// The server provides Goto Implementation support.
ImplementationProvider *Or_ServerCapabilities_implementationProvider `json:"implementationProvider,omitempty"`
// The server provides find references support.
ReferencesProvider *Or_ServerCapabilities_referencesProvider `json:"referencesProvider,omitempty"`
// The server provides document highlight support.
DocumentHighlightProvider *Or_ServerCapabilities_documentHighlightProvider `json:"documentHighlightProvider,omitempty"`
// The server provides document symbol support.
DocumentSymbolProvider *Or_ServerCapabilities_documentSymbolProvider `json:"documentSymbolProvider,omitempty"`
// The server provides code actions. CodeActionOptions may only be
// specified if the client states that it supports
// `codeActionLiteralSupport` in its initial `initialize` request.
CodeActionProvider interface{} `json:"codeActionProvider,omitempty"`
// The server provides code lens.
CodeLensProvider *CodeLensOptions `json:"codeLensProvider,omitempty"`
// The server provides document link support.
DocumentLinkProvider *DocumentLinkOptions `json:"documentLinkProvider,omitempty"`
// The server provides color provider support.
ColorProvider *Or_ServerCapabilities_colorProvider `json:"colorProvider,omitempty"`
// The server provides workspace symbol support.
WorkspaceSymbolProvider *Or_ServerCapabilities_workspaceSymbolProvider `json:"workspaceSymbolProvider,omitempty"`
// The server provides document formatting.
DocumentFormattingProvider *Or_ServerCapabilities_documentFormattingProvider `json:"documentFormattingProvider,omitempty"`
// The server provides document range formatting.
DocumentRangeFormattingProvider *Or_ServerCapabilities_documentRangeFormattingProvider `json:"documentRangeFormattingProvider,omitempty"`
// The server provides document formatting on typing.
DocumentOnTypeFormattingProvider *DocumentOnTypeFormattingOptions `json:"documentOnTypeFormattingProvider,omitempty"`
// The server provides rename support. RenameOptions may only be
// specified if the client states that it supports
// `prepareSupport` in its initial `initialize` request.
RenameProvider interface{} `json:"renameProvider,omitempty"`
// The server provides folding provider support.
FoldingRangeProvider *Or_ServerCapabilities_foldingRangeProvider `json:"foldingRangeProvider,omitempty"`
// The server provides selection range support.
SelectionRangeProvider *Or_ServerCapabilities_selectionRangeProvider `json:"selectionRangeProvider,omitempty"`
// The server provides execute command support.
ExecuteCommandProvider *ExecuteCommandOptions `json:"executeCommandProvider,omitempty"`
// The server provides call hierarchy support.
//
// @since 3.16.0
CallHierarchyProvider *Or_ServerCapabilities_callHierarchyProvider `json:"callHierarchyProvider,omitempty"`
// The server provides linked editing range support.
//
// @since 3.16.0
LinkedEditingRangeProvider *Or_ServerCapabilities_linkedEditingRangeProvider `json:"linkedEditingRangeProvider,omitempty"`
// The server provides semantic tokens support.
//
// @since 3.16.0
SemanticTokensProvider interface{} `json:"semanticTokensProvider,omitempty"`
// The server provides moniker support.
//
// @since 3.16.0
MonikerProvider *Or_ServerCapabilities_monikerProvider `json:"monikerProvider,omitempty"`
// The server provides type hierarchy support.
//
// @since 3.17.0
TypeHierarchyProvider *Or_ServerCapabilities_typeHierarchyProvider `json:"typeHierarchyProvider,omitempty"`
// The server provides inline values.
//
// @since 3.17.0
InlineValueProvider *Or_ServerCapabilities_inlineValueProvider `json:"inlineValueProvider,omitempty"`
// The server provides inlay hints.
//
// @since 3.17.0
InlayHintProvider interface{} `json:"inlayHintProvider,omitempty"`
// The server has support for pull model diagnostics.
//
// @since 3.17.0
DiagnosticProvider *Or_ServerCapabilities_diagnosticProvider `json:"diagnosticProvider,omitempty"`
// Inline completion options used during static registration.
//
// @since 3.18.0
// @proposed
InlineCompletionProvider *Or_ServerCapabilities_inlineCompletionProvider `json:"inlineCompletionProvider,omitempty"`
// Workspace specific server capabilities.
Workspace *WorkspaceOptions `json:"workspace,omitempty"`
// Experimental server capabilities.
Experimental interface{} `json:"experimental,omitempty"`
}
// @since 3.18.0
//
// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#serverCompletionItemOptions
type ServerCompletionItemOptions struct {
// The server has support for completion item label
// details (see also `CompletionItemLabelDetails`) when
// receiving a completion item in a resolve call.
//
// @since 3.17.0
LabelDetailsSupport bool `json:"labelDetailsSupport,omitempty"`
}
// Information about the server
//
// @since 3.15.0
// @since 3.18.0 ServerInfo type name added.
//
// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#serverInfo
type ServerInfo struct {
// The name of the server as defined by the server.
Name string `json:"name"`
// The server's version as defined by the server.
Version string `json:"version,omitempty"`
}
// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#setTraceParams
type SetTraceParams struct {
Value TraceValue `json:"value"`
}
// Client capabilities for the showDocument request.
//
// @since 3.16.0
//
// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#showDocumentClientCapabilities
type ShowDocumentClientCapabilities struct {
// The client has support for the showDocument
// request.
Support bool `json:"support"`
}
// Params to show a resource in the UI.
//
// @since 3.16.0
//
// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#showDocumentParams
type ShowDocumentParams struct {
// The uri to show.
URI URI `json:"uri"`
// Indicates to show the resource in an external program.
// To show, for example, `https://code.visualstudio.com/`
// in the default WEB browser set `external` to `true`.
External bool `json:"external,omitempty"`
// An optional property to indicate whether the editor
// showing the document should take focus or not.
// Clients might ignore this property if an external
// program is started.
TakeFocus bool `json:"takeFocus,omitempty"`
// An optional selection range if the document is a text
// document. Clients might ignore the property if an
// external program is started or the file is not a text
// file.
Selection *Range `json:"selection,omitempty"`
}
// The result of a showDocument request.
//
// @since 3.16.0
//
// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#showDocumentResult
type ShowDocumentResult struct {
// A boolean indicating if the show was successful.
Success bool `json:"success"`
}
// The parameters of a notification message.
//
// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#showMessageParams
type ShowMessageParams struct {
// The message type. See {@link MessageType}
Type MessageType `json:"type"`
// The actual message.
Message string `json:"message"`
}
// Show message request client capabilities
//
// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#showMessageRequestClientCapabilities
type ShowMessageRequestClientCapabilities struct {
// Capabilities specific to the `MessageActionItem` type.
MessageActionItem *ClientShowMessageActionItemOptions `json:"messageActionItem,omitempty"`
}
// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#showMessageRequestParams
type ShowMessageRequestParams struct {
// The message type. See {@link MessageType}
Type MessageType `json:"type"`
// The actual message.
Message string `json:"message"`
// The message action items to present.
Actions []MessageActionItem `json:"actions,omitempty"`
}
// Signature help represents the signature of something
// callable. There can be multiple signature but only one
// active and only one active parameter.
//
// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#signatureHelp
type SignatureHelp struct {
// One or more signatures.
Signatures []SignatureInformation `json:"signatures"`
// The active signature. If omitted or the value lies outside the
// range of `signatures` the value defaults to zero or is ignored if
// the `SignatureHelp` has no signatures.
//
// Whenever possible implementors should make an active decision about
// the active signature and shouldn't rely on a default value.
//
// In future version of the protocol this property might become
// mandatory to better express this.
ActiveSignature uint32 `json:"activeSignature,omitempty"`
// The active parameter of the active signature.
//
// If `null`, no parameter of the signature is active (for example a named
// argument that does not match any declared parameters). This is only valid
// if the client specifies the client capability
// `textDocument.signatureHelp.noActiveParameterSupport === true`
//
// If omitted or the value lies outside the range of
// `signatures[activeSignature].parameters` defaults to 0 if the active
// signature has parameters.
//
// If the active signature has no parameters it is ignored.
//
// In future version of the protocol this property might become
// mandatory (but still nullable) to better express the active parameter if
// the active signature does have any.
ActiveParameter uint32 `json:"activeParameter,omitempty"`
}
// Client Capabilities for a {@link SignatureHelpRequest}.
//
// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#signatureHelpClientCapabilities
type SignatureHelpClientCapabilities struct {
// Whether signature help supports dynamic registration.
DynamicRegistration bool `json:"dynamicRegistration,omitempty"`
// The client supports the following `SignatureInformation`
// specific properties.
SignatureInformation *ClientSignatureInformationOptions `json:"signatureInformation,omitempty"`
// The client supports to send additional context information for a
// `textDocument/signatureHelp` request. A client that opts into
// contextSupport will also support the `retriggerCharacters` on
// `SignatureHelpOptions`.
//
// @since 3.15.0
ContextSupport bool `json:"contextSupport,omitempty"`
}
// Additional information about the context in which a signature help request was triggered.
//
// @since 3.15.0
//
// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#signatureHelpContext
type SignatureHelpContext struct {
// Action that caused signature help to be triggered.
TriggerKind SignatureHelpTriggerKind `json:"triggerKind"`
// Character that caused signature help to be triggered.
//
// This is undefined when `triggerKind !== SignatureHelpTriggerKind.TriggerCharacter`
TriggerCharacter string `json:"triggerCharacter,omitempty"`
// `true` if signature help was already showing when it was triggered.
//
// Retriggers occurs when the signature help is already active and can be caused by actions such as
// typing a trigger character, a cursor move, or document content changes.
IsRetrigger bool `json:"isRetrigger"`
// The currently active `SignatureHelp`.
//
// The `activeSignatureHelp` has its `SignatureHelp.activeSignature` field updated based on
// the user navigating through available signatures.
ActiveSignatureHelp *SignatureHelp `json:"activeSignatureHelp,omitempty"`
}
// Server Capabilities for a {@link SignatureHelpRequest}.
//
// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#signatureHelpOptions
type SignatureHelpOptions struct {
// List of characters that trigger signature help automatically.
TriggerCharacters []string `json:"triggerCharacters,omitempty"`
// List of characters that re-trigger signature help.
//
// These trigger characters are only active when signature help is already showing. All trigger characters
// are also counted as re-trigger characters.
//
// @since 3.15.0
RetriggerCharacters []string `json:"retriggerCharacters,omitempty"`
WorkDoneProgressOptions
}
// Parameters for a {@link SignatureHelpRequest}.
//
// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#signatureHelpParams
type SignatureHelpParams struct {
// The signature help context. This is only available if the client specifies
// to send this using the client capability `textDocument.signatureHelp.contextSupport === true`
//
// @since 3.15.0
Context *SignatureHelpContext `json:"context,omitempty"`
TextDocumentPositionParams
WorkDoneProgressParams
}
// Registration options for a {@link SignatureHelpRequest}.
//
// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#signatureHelpRegistrationOptions
type SignatureHelpRegistrationOptions struct {
TextDocumentRegistrationOptions
SignatureHelpOptions
}
// How a signature help was triggered.
//
// @since 3.15.0
type SignatureHelpTriggerKind uint32
// Represents the signature of something callable. A signature
// can have a label, like a function-name, a doc-comment, and
// a set of parameters.
//
// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#signatureInformation
type SignatureInformation struct {
// The label of this signature. Will be shown in
// the UI.
Label string `json:"label"`
// The human-readable doc-comment of this signature. Will be shown
// in the UI but can be omitted.
Documentation *Or_SignatureInformation_documentation `json:"documentation,omitempty"`
// The parameters of this signature.
Parameters []ParameterInformation `json:"parameters,omitempty"`
// The index of the active parameter.
//
// If `null`, no parameter of the signature is active (for example a named
// argument that does not match any declared parameters). This is only valid
// if the client specifies the client capability
// `textDocument.signatureHelp.noActiveParameterSupport === true`
//
// If provided (or `null`), this is used in place of
// `SignatureHelp.activeParameter`.
//
// @since 3.16.0
ActiveParameter uint32 `json:"activeParameter,omitempty"`
}
// An interactive text edit.
//
// @since 3.18.0
// @proposed
//
// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#snippetTextEdit
type SnippetTextEdit struct {
// The range of the text document to be manipulated.
Range Range `json:"range"`
// The snippet to be inserted.
Snippet StringValue `json:"snippet"`
// The actual identifier of the snippet edit.
AnnotationID *ChangeAnnotationIdentifier `json:"annotationId,omitempty"`
}
// @since 3.18.0
//
// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#staleRequestSupportOptions
type StaleRequestSupportOptions struct {
// The client will actively cancel the request.
Cancel bool `json:"cancel"`
// The list of requests for which the client
// will retry the request if it receives a
// response with error code `ContentModified`
RetryOnContentModified []string `json:"retryOnContentModified"`
}
// Static registration options to be returned in the initialize
// request.
//
// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#staticRegistrationOptions
type StaticRegistrationOptions struct {
// The id used to register the request. The id can be used to deregister
// the request again. See also Registration#id.
ID string `json:"id,omitempty"`
}
// A string value used as a snippet is a template which allows to insert text
// and to control the editor cursor when insertion happens.
//
// A snippet can define tab stops and placeholders with `$1`, `$2`
// and `${3:foo}`. `$0` defines the final tab stop, it defaults to
// the end of the snippet. Variables are defined with `$name` and
// `${name:default value}`.
//
// @since 3.18.0
// @proposed
//
// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#stringValue
type StringValue struct {
// The kind of string value.
Kind string `json:"kind"`
// The snippet string.
Value string `json:"value"`
}
// Represents information about programming constructs like variables, classes,
// interfaces etc.
//
// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#symbolInformation
type SymbolInformation struct {
// extends BaseSymbolInformation
// Indicates if this symbol is deprecated.
//
// @deprecated Use tags instead
Deprecated bool `json:"deprecated,omitempty"`
// The location of this symbol. The location's range is used by a tool
// to reveal the location in the editor. If the symbol is selected in the
// tool the range's start information is used to position the cursor. So
// the range usually spans more than the actual symbol's name and does
// normally include things like visibility modifiers.
//
// The range doesn't have to denote a node range in the sense of an abstract
// syntax tree. It can therefore not be used to re-construct a hierarchy of
// the symbols.
Location Location `json:"location"`
// The name of this symbol.
Name string `json:"name"`
// The kind of this symbol.
Kind SymbolKind `json:"kind"`
// Tags for this symbol.
//
// @since 3.16.0
Tags []SymbolTag `json:"tags,omitempty"`
// The name of the symbol containing this symbol. This information is for
// user interface purposes (e.g. to render a qualifier in the user interface
// if necessary). It can't be used to re-infer a hierarchy for the document
// symbols.
ContainerName string `json:"containerName,omitempty"`
}
// A symbol kind.
type SymbolKind uint32
// Symbol tags are extra annotations that tweak the rendering of a symbol.
//
// @since 3.16
type SymbolTag uint32
// Describe options to be used when registered for text document change events.
//
// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#textDocumentChangeRegistrationOptions
type TextDocumentChangeRegistrationOptions struct {
// How documents are synced to the server.
SyncKind TextDocumentSyncKind `json:"syncKind"`
TextDocumentRegistrationOptions
}
// Text document specific client capabilities.
//
// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#textDocumentClientCapabilities
type TextDocumentClientCapabilities struct {
// Defines which synchronization capabilities the client supports.
Synchronization *TextDocumentSyncClientCapabilities `json:"synchronization,omitempty"`
// Capabilities specific to the `textDocument/completion` request.
Completion CompletionClientCapabilities `json:"completion,omitempty"`
// Capabilities specific to the `textDocument/hover` request.
Hover *HoverClientCapabilities `json:"hover,omitempty"`
// Capabilities specific to the `textDocument/signatureHelp` request.
SignatureHelp *SignatureHelpClientCapabilities `json:"signatureHelp,omitempty"`
// Capabilities specific to the `textDocument/declaration` request.
//
// @since 3.14.0
Declaration *DeclarationClientCapabilities `json:"declaration,omitempty"`
// Capabilities specific to the `textDocument/definition` request.
Definition *DefinitionClientCapabilities `json:"definition,omitempty"`
// Capabilities specific to the `textDocument/typeDefinition` request.
//
// @since 3.6.0
TypeDefinition *TypeDefinitionClientCapabilities `json:"typeDefinition,omitempty"`
// Capabilities specific to the `textDocument/implementation` request.
//
// @since 3.6.0
Implementation *ImplementationClientCapabilities `json:"implementation,omitempty"`
// Capabilities specific to the `textDocument/references` request.
References *ReferenceClientCapabilities `json:"references,omitempty"`
// Capabilities specific to the `textDocument/documentHighlight` request.
DocumentHighlight *DocumentHighlightClientCapabilities `json:"documentHighlight,omitempty"`
// Capabilities specific to the `textDocument/documentSymbol` request.
DocumentSymbol DocumentSymbolClientCapabilities `json:"documentSymbol,omitempty"`
// Capabilities specific to the `textDocument/codeAction` request.
CodeAction CodeActionClientCapabilities `json:"codeAction,omitempty"`
// Capabilities specific to the `textDocument/codeLens` request.
CodeLens *CodeLensClientCapabilities `json:"codeLens,omitempty"`
// Capabilities specific to the `textDocument/documentLink` request.
DocumentLink *DocumentLinkClientCapabilities `json:"documentLink,omitempty"`
// Capabilities specific to the `textDocument/documentColor` and the
// `textDocument/colorPresentation` request.
//
// @since 3.6.0
ColorProvider *DocumentColorClientCapabilities `json:"colorProvider,omitempty"`
// Capabilities specific to the `textDocument/formatting` request.
Formatting *DocumentFormattingClientCapabilities `json:"formatting,omitempty"`
// Capabilities specific to the `textDocument/rangeFormatting` request.
RangeFormatting *DocumentRangeFormattingClientCapabilities `json:"rangeFormatting,omitempty"`
// Capabilities specific to the `textDocument/onTypeFormatting` request.
OnTypeFormatting *DocumentOnTypeFormattingClientCapabilities `json:"onTypeFormatting,omitempty"`
// Capabilities specific to the `textDocument/rename` request.
Rename *RenameClientCapabilities `json:"rename,omitempty"`
// Capabilities specific to the `textDocument/foldingRange` request.
//
// @since 3.10.0
FoldingRange *FoldingRangeClientCapabilities `json:"foldingRange,omitempty"`
// Capabilities specific to the `textDocument/selectionRange` request.
//
// @since 3.15.0
SelectionRange *SelectionRangeClientCapabilities `json:"selectionRange,omitempty"`
// Capabilities specific to the `textDocument/publishDiagnostics` notification.
PublishDiagnostics PublishDiagnosticsClientCapabilities `json:"publishDiagnostics,omitempty"`
// Capabilities specific to the various call hierarchy requests.
//
// @since 3.16.0
CallHierarchy *CallHierarchyClientCapabilities `json:"callHierarchy,omitempty"`
// Capabilities specific to the various semantic token request.
//
// @since 3.16.0
SemanticTokens SemanticTokensClientCapabilities `json:"semanticTokens,omitempty"`
// Capabilities specific to the `textDocument/linkedEditingRange` request.
//
// @since 3.16.0
LinkedEditingRange *LinkedEditingRangeClientCapabilities `json:"linkedEditingRange,omitempty"`
// Client capabilities specific to the `textDocument/moniker` request.
//
// @since 3.16.0
Moniker *MonikerClientCapabilities `json:"moniker,omitempty"`
// Capabilities specific to the various type hierarchy requests.
//
// @since 3.17.0
TypeHierarchy *TypeHierarchyClientCapabilities `json:"typeHierarchy,omitempty"`
// Capabilities specific to the `textDocument/inlineValue` request.
//
// @since 3.17.0
InlineValue *InlineValueClientCapabilities `json:"inlineValue,omitempty"`
// Capabilities specific to the `textDocument/inlayHint` request.
//
// @since 3.17.0
InlayHint *InlayHintClientCapabilities `json:"inlayHint,omitempty"`
// Capabilities specific to the diagnostic pull model.
//
// @since 3.17.0
Diagnostic *DiagnosticClientCapabilities `json:"diagnostic,omitempty"`
// Client capabilities specific to inline completions.
//
// @since 3.18.0
// @proposed
InlineCompletion *InlineCompletionClientCapabilities `json:"inlineCompletion,omitempty"`
}
// An event describing a change to a text document. If only a text is provided
// it is considered to be the full content of the document.
//
// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#textDocumentContentChangeEvent
type TextDocumentContentChangeEvent = Or_TextDocumentContentChangeEvent // (alias)
// @since 3.18.0
//
// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#textDocumentContentChangePartial
type TextDocumentContentChangePartial struct {
// The range of the document that changed.
Range *Range `json:"range,omitempty"`
// The optional length of the range that got replaced.
//
// @deprecated use range instead.
RangeLength uint32 `json:"rangeLength,omitempty"`
// The new text for the provided range.
Text string `json:"text"`
}
// @since 3.18.0
//
// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#textDocumentContentChangeWholeDocument
type TextDocumentContentChangeWholeDocument struct {
// The new text of the whole document.
Text string `json:"text"`
}
// Client capabilities for a text document content provider.
//
// @since 3.18.0
// @proposed
//
// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#textDocumentContentClientCapabilities
type TextDocumentContentClientCapabilities struct {
// Text document content provider supports dynamic registration.
DynamicRegistration bool `json:"dynamicRegistration,omitempty"`
}
// Text document content provider options.
//
// @since 3.18.0
// @proposed
//
// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#textDocumentContentOptions
type TextDocumentContentOptions struct {
// The scheme for which the server provides content.
Scheme string `json:"scheme"`
}
// Parameters for the `workspace/textDocumentContent` request.
//
// @since 3.18.0
// @proposed
//
// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#textDocumentContentParams
type TextDocumentContentParams struct {
// The uri of the text document.
URI DocumentUri `json:"uri"`
}
// Parameters for the `workspace/textDocumentContent/refresh` request.
//
// @since 3.18.0
// @proposed
//
// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#textDocumentContentRefreshParams
type TextDocumentContentRefreshParams struct {
// The uri of the text document to refresh.
URI DocumentUri `json:"uri"`
}
// Text document content provider registration options.
//
// @since 3.18.0
// @proposed
//
// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#textDocumentContentRegistrationOptions
type TextDocumentContentRegistrationOptions struct {
TextDocumentContentOptions
StaticRegistrationOptions
}
// Describes textual changes on a text document. A TextDocumentEdit describes all changes
// on a document version Si and after they are applied move the document to version Si+1.
// So the creator of a TextDocumentEdit doesn't need to sort the array of edits or do any
// kind of ordering. However the edits must be non overlapping.
//
// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#textDocumentEdit
type TextDocumentEdit struct {
// The text document to change.
TextDocument OptionalVersionedTextDocumentIdentifier `json:"textDocument"`
// The edits to be applied.
//
// @since 3.16.0 - support for AnnotatedTextEdit. This is guarded using a
// client capability.
//
// @since 3.18.0 - support for SnippetTextEdit. This is guarded using a
// client capability.
Edits []Or_TextDocumentEdit_edits_Elem `json:"edits"`
}
// A document filter denotes a document by different properties like
// the {@link TextDocument.languageId language}, the {@link Uri.scheme scheme} of
// its resource, or a glob-pattern that is applied to the {@link TextDocument.fileName path}.
//
// Glob patterns can have the following syntax:
//
// - `*` to match one or more characters in a path segment
// - `?` to match on one character in a path segment
// - `**` to match any number of path segments, including none
// - `{}` to group sub patterns into an OR expression. (e.g. `**/*.{ts,js}` matches all TypeScript and JavaScript files)
// - `[]` to declare a range of characters to match in a path segment (e.g., `example.[0-9]` to match on `example.0`, `example.1`, …)
// - `[!...]` to negate a range of characters to match in a path segment (e.g., `example.[!0-9]` to match on `example.a`, `example.b`, but not `example.0`)
//
// @sample A language filter that applies to typescript files on disk: `{ language: 'typescript', scheme: 'file' }`
// @sample A language filter that applies to all package.json paths: `{ language: 'json', pattern: '**package.json' }`
//
// @since 3.17.0
//
// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#textDocumentFilter
type TextDocumentFilter = Or_TextDocumentFilter // (alias)
// A document filter where `language` is required field.
//
// @since 3.18.0
//
// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#textDocumentFilterLanguage
type TextDocumentFilterLanguage struct {
// A language id, like `typescript`.
Language string `json:"language"`
// A Uri {@link Uri.scheme scheme}, like `file` or `untitled`.
Scheme string `json:"scheme,omitempty"`
// A glob pattern, like **/*.{ts,js}. See TextDocumentFilter for examples.
//
// @since 3.18.0 - support for relative patterns.
Pattern *GlobPattern `json:"pattern,omitempty"`
}
// A document filter where `pattern` is required field.
//
// @since 3.18.0
//
// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#textDocumentFilterPattern
type TextDocumentFilterPattern struct {
// A language id, like `typescript`.
Language string `json:"language,omitempty"`
// A Uri {@link Uri.scheme scheme}, like `file` or `untitled`.
Scheme string `json:"scheme,omitempty"`
// A glob pattern, like **/*.{ts,js}. See TextDocumentFilter for examples.
//
// @since 3.18.0 - support for relative patterns.
Pattern GlobPattern `json:"pattern"`
}
// A document filter where `scheme` is required field.
//
// @since 3.18.0
//
// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#textDocumentFilterScheme
type TextDocumentFilterScheme struct {
// A language id, like `typescript`.
Language string `json:"language,omitempty"`
// A Uri {@link Uri.scheme scheme}, like `file` or `untitled`.
Scheme string `json:"scheme"`
// A glob pattern, like **/*.{ts,js}. See TextDocumentFilter for examples.
//
// @since 3.18.0 - support for relative patterns.
Pattern *GlobPattern `json:"pattern,omitempty"`
}
// A literal to identify a text document in the client.
//
// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#textDocumentIdentifier
type TextDocumentIdentifier struct {
// The text document's uri.
URI DocumentUri `json:"uri"`
}
// An item to transfer a text document from the client to the
// server.
//
// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#textDocumentItem
type TextDocumentItem struct {
// The text document's uri.
URI DocumentUri `json:"uri"`
// The text document's language identifier.
LanguageID LanguageKind `json:"languageId"`
// The version number of this document (it will increase after each
// change, including undo/redo).
Version int32 `json:"version"`
// The content of the opened text document.
Text string `json:"text"`
}
// A parameter literal used in requests to pass a text document and a position inside that
// document.
//
// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#textDocumentPositionParams
type TextDocumentPositionParams struct {
// The text document.
TextDocument TextDocumentIdentifier `json:"textDocument"`
// The position inside the text document.
Position Position `json:"position"`
}
// General text document registration options.
//
// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#textDocumentRegistrationOptions
type TextDocumentRegistrationOptions struct {
// A document selector to identify the scope of the registration. If set to null
// the document selector provided on the client side will be used.
DocumentSelector DocumentSelector `json:"documentSelector"`
}
// Represents reasons why a text document is saved.
type TextDocumentSaveReason uint32
// Save registration options.
//
// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#textDocumentSaveRegistrationOptions
type TextDocumentSaveRegistrationOptions struct {
TextDocumentRegistrationOptions
SaveOptions
}
// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#textDocumentSyncClientCapabilities
type TextDocumentSyncClientCapabilities struct {
// Whether text document synchronization supports dynamic registration.
DynamicRegistration bool `json:"dynamicRegistration,omitempty"`
// The client supports sending will save notifications.
WillSave bool `json:"willSave,omitempty"`
// The client supports sending a will save request and
// waits for a response providing text edits which will
// be applied to the document before it is saved.
WillSaveWaitUntil bool `json:"willSaveWaitUntil,omitempty"`
// The client supports did save notifications.
DidSave bool `json:"didSave,omitempty"`
}
// Defines how the host (editor) should sync
// document changes to the language server.
type TextDocumentSyncKind uint32
// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#textDocumentSyncOptions
type TextDocumentSyncOptions struct {
// Open and close notifications are sent to the server. If omitted open close notification should not
// be sent.
OpenClose bool `json:"openClose,omitempty"`
// Change notifications are sent to the server. See TextDocumentSyncKind.None, TextDocumentSyncKind.Full
// and TextDocumentSyncKind.Incremental. If omitted it defaults to TextDocumentSyncKind.None.
Change TextDocumentSyncKind `json:"change,omitempty"`
// If present will save notifications are sent to the server. If omitted the notification should not be
// sent.
WillSave bool `json:"willSave,omitempty"`
// If present will save wait until requests are sent to the server. If omitted the request should not be
// sent.
WillSaveWaitUntil bool `json:"willSaveWaitUntil,omitempty"`
// If present save notifications are sent to the server. If omitted the notification should not be
// sent.
Save *SaveOptions `json:"save,omitempty"`
}
// A text edit applicable to a text document.
//
// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#textEdit
type TextEdit struct {
// The range of the text document to be manipulated. To insert
// text into a document create a range where start === end.
Range Range `json:"range"`
// The string to be inserted. For delete operations use an
// empty string.
NewText string `json:"newText"`
}
type TokenFormat string
type TraceValue string
// created for Tuple
type Tuple_ParameterInformation_label_Item1 struct {
Fld0 uint32 `json:"fld0"`
Fld1 uint32 `json:"fld1"`
}
// Since 3.6.0
//
// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#typeDefinitionClientCapabilities
type TypeDefinitionClientCapabilities struct {
// Whether implementation supports dynamic registration. If this is set to `true`
// the client supports the new `TypeDefinitionRegistrationOptions` return value
// for the corresponding server capability as well.
DynamicRegistration bool `json:"dynamicRegistration,omitempty"`
// The client supports additional metadata in the form of definition links.
//
// Since 3.14.0
LinkSupport bool `json:"linkSupport,omitempty"`
}
// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#typeDefinitionOptions
type TypeDefinitionOptions struct {
WorkDoneProgressOptions
}
// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#typeDefinitionParams
type TypeDefinitionParams struct {
TextDocumentPositionParams
WorkDoneProgressParams
PartialResultParams
}
// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#typeDefinitionRegistrationOptions
type TypeDefinitionRegistrationOptions struct {
TextDocumentRegistrationOptions
TypeDefinitionOptions
StaticRegistrationOptions
}
// @since 3.17.0
//
// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#typeHierarchyClientCapabilities
type TypeHierarchyClientCapabilities struct {
// Whether implementation supports dynamic registration. If this is set to `true`
// the client supports the new `(TextDocumentRegistrationOptions & StaticRegistrationOptions)`
// return value for the corresponding server capability as well.
DynamicRegistration bool `json:"dynamicRegistration,omitempty"`
}
// @since 3.17.0
//
// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#typeHierarchyItem
type TypeHierarchyItem struct {
// The name of this item.
Name string `json:"name"`
// The kind of this item.
Kind SymbolKind `json:"kind"`
// Tags for this item.
Tags []SymbolTag `json:"tags,omitempty"`
// More detail for this item, e.g. the signature of a function.
Detail string `json:"detail,omitempty"`
// The resource identifier of this item.
URI DocumentUri `json:"uri"`
// The range enclosing this symbol not including leading/trailing whitespace
// but everything else, e.g. comments and code.
Range Range `json:"range"`
// The range that should be selected and revealed when this symbol is being
// picked, e.g. the name of a function. Must be contained by the
// {@link TypeHierarchyItem.range `range`}.
SelectionRange Range `json:"selectionRange"`
// A data entry field that is preserved between a type hierarchy prepare and
// supertypes or subtypes requests. It could also be used to identify the
// type hierarchy in the server, helping improve the performance on
// resolving supertypes and subtypes.
Data interface{} `json:"data,omitempty"`
}
// Type hierarchy options used during static registration.
//
// @since 3.17.0
//
// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#typeHierarchyOptions
type TypeHierarchyOptions struct {
WorkDoneProgressOptions
}
// The parameter of a `textDocument/prepareTypeHierarchy` request.
//
// @since 3.17.0
//
// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#typeHierarchyPrepareParams
type TypeHierarchyPrepareParams struct {
TextDocumentPositionParams
WorkDoneProgressParams
}
// Type hierarchy options used during static or dynamic registration.
//
// @since 3.17.0
//
// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#typeHierarchyRegistrationOptions
type TypeHierarchyRegistrationOptions struct {
TextDocumentRegistrationOptions
TypeHierarchyOptions
StaticRegistrationOptions
}
// The parameter of a `typeHierarchy/subtypes` request.
//
// @since 3.17.0
//
// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#typeHierarchySubtypesParams
type TypeHierarchySubtypesParams struct {
Item TypeHierarchyItem `json:"item"`
WorkDoneProgressParams
PartialResultParams
}
// The parameter of a `typeHierarchy/supertypes` request.
//
// @since 3.17.0
//
// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#typeHierarchySupertypesParams
type TypeHierarchySupertypesParams struct {
Item TypeHierarchyItem `json:"item"`
WorkDoneProgressParams
PartialResultParams
}
// A diagnostic report indicating that the last returned
// report is still accurate.
//
// @since 3.17.0
//
// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#unchangedDocumentDiagnosticReport
type UnchangedDocumentDiagnosticReport struct {
// A document diagnostic report indicating
// no changes to the last result. A server can
// only return `unchanged` if result ids are
// provided.
Kind string `json:"kind"`
// A result id which will be sent on the next
// diagnostic request for the same document.
ResultID string `json:"resultId"`
}
// Moniker uniqueness level to define scope of the moniker.
//
// @since 3.16.0
type UniquenessLevel string
// General parameters to unregister a request or notification.
//
// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#unregistration
type Unregistration struct {
// The id used to unregister the request or notification. Usually an id
// provided during the register request.
ID string `json:"id"`
// The method to unregister for.
Method string `json:"method"`
}
// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#unregistrationParams
type UnregistrationParams struct {
Unregisterations []Unregistration `json:"unregisterations"`
}
// A versioned notebook document identifier.
//
// @since 3.17.0
//
// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#versionedNotebookDocumentIdentifier
type VersionedNotebookDocumentIdentifier struct {
// The version number of this notebook document.
Version int32 `json:"version"`
// The notebook document's uri.
URI URI `json:"uri"`
}
// A text document identifier to denote a specific version of a text document.
//
// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#versionedTextDocumentIdentifier
type VersionedTextDocumentIdentifier struct {
// The version number of this document.
Version int32 `json:"version"`
TextDocumentIdentifier
}
type WatchKind = uint32 // The parameters sent in a will save text document notification.
// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#willSaveTextDocumentParams
type WillSaveTextDocumentParams struct {
// The document that will be saved.
TextDocument TextDocumentIdentifier `json:"textDocument"`
// The 'TextDocumentSaveReason'.
Reason TextDocumentSaveReason `json:"reason"`
}
// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#windowClientCapabilities
type WindowClientCapabilities struct {
// It indicates whether the client supports server initiated
// progress using the `window/workDoneProgress/create` request.
//
// The capability also controls Whether client supports handling
// of progress notifications. If set servers are allowed to report a
// `workDoneProgress` property in the request specific server
// capabilities.
//
// @since 3.15.0
WorkDoneProgress bool `json:"workDoneProgress,omitempty"`
// Capabilities specific to the showMessage request.
//
// @since 3.16.0
ShowMessage *ShowMessageRequestClientCapabilities `json:"showMessage,omitempty"`
// Capabilities specific to the showDocument request.
//
// @since 3.16.0
ShowDocument *ShowDocumentClientCapabilities `json:"showDocument,omitempty"`
}
// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#workDoneProgressBegin
type WorkDoneProgressBegin struct {
Kind string `json:"kind"`
// Mandatory title of the progress operation. Used to briefly inform about
// the kind of operation being performed.
//
// Examples: "Indexing" or "Linking dependencies".
Title string `json:"title"`
// Controls if a cancel button should show to allow the user to cancel the
// long running operation. Clients that don't support cancellation are allowed
// to ignore the setting.
Cancellable bool `json:"cancellable,omitempty"`
// Optional, more detailed associated progress message. Contains
// complementary information to the `title`.
//
// Examples: "3/25 files", "project/src/module2", "node_modules/some_dep".
// If unset, the previous progress message (if any) is still valid.
Message string `json:"message,omitempty"`
// Optional progress percentage to display (value 100 is considered 100%).
// If not provided infinite progress is assumed and clients are allowed
// to ignore the `percentage` value in subsequent in report notifications.
//
// The value should be steadily rising. Clients are free to ignore values
// that are not following this rule. The value range is [0, 100].
Percentage uint32 `json:"percentage,omitempty"`
}
// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#workDoneProgressCancelParams
type WorkDoneProgressCancelParams struct {
// The token to be used to report progress.
Token ProgressToken `json:"token"`
}
// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#workDoneProgressCreateParams
type WorkDoneProgressCreateParams struct {
// The token to be used to report progress.
Token ProgressToken `json:"token"`
}
// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#workDoneProgressEnd
type WorkDoneProgressEnd struct {
Kind string `json:"kind"`
// Optional, a final message indicating to for example indicate the outcome
// of the operation.
Message string `json:"message,omitempty"`
}
// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#workDoneProgressOptions
type WorkDoneProgressOptions struct {
WorkDoneProgress bool `json:"workDoneProgress,omitempty"`
}
// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#workDoneProgressParams
type WorkDoneProgressParams struct {
// An optional token that a server can use to report work done progress.
WorkDoneToken ProgressToken `json:"workDoneToken,omitempty"`
}
// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#workDoneProgressReport
type WorkDoneProgressReport struct {
Kind string `json:"kind"`
// Controls enablement state of a cancel button.
//
// Clients that don't support cancellation or don't support controlling the button's
// enablement state are allowed to ignore the property.
Cancellable bool `json:"cancellable,omitempty"`
// Optional, more detailed associated progress message. Contains
// complementary information to the `title`.
//
// Examples: "3/25 files", "project/src/module2", "node_modules/some_dep".
// If unset, the previous progress message (if any) is still valid.
Message string `json:"message,omitempty"`
// Optional progress percentage to display (value 100 is considered 100%).
// If not provided infinite progress is assumed and clients are allowed
// to ignore the `percentage` value in subsequent in report notifications.
//
// The value should be steadily rising. Clients are free to ignore values
// that are not following this rule. The value range is [0, 100]
Percentage uint32 `json:"percentage,omitempty"`
}
// Workspace specific client capabilities.
//
// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#workspaceClientCapabilities
type WorkspaceClientCapabilities struct {
// The client supports applying batch edits
// to the workspace by supporting the request
// 'workspace/applyEdit'
ApplyEdit bool `json:"applyEdit,omitempty"`
// Capabilities specific to `WorkspaceEdit`s.
WorkspaceEdit *WorkspaceEditClientCapabilities `json:"workspaceEdit,omitempty"`
// Capabilities specific to the `workspace/didChangeConfiguration` notification.
DidChangeConfiguration DidChangeConfigurationClientCapabilities `json:"didChangeConfiguration,omitempty"`
// Capabilities specific to the `workspace/didChangeWatchedFiles` notification.
DidChangeWatchedFiles DidChangeWatchedFilesClientCapabilities `json:"didChangeWatchedFiles,omitempty"`
// Capabilities specific to the `workspace/symbol` request.
Symbol *WorkspaceSymbolClientCapabilities `json:"symbol,omitempty"`
// Capabilities specific to the `workspace/executeCommand` request.
ExecuteCommand *ExecuteCommandClientCapabilities `json:"executeCommand,omitempty"`
// The client has support for workspace folders.
//
// @since 3.6.0
WorkspaceFolders bool `json:"workspaceFolders,omitempty"`
// The client supports `workspace/configuration` requests.
//
// @since 3.6.0
Configuration bool `json:"configuration,omitempty"`
// Capabilities specific to the semantic token requests scoped to the
// workspace.
//
// @since 3.16.0.
SemanticTokens *SemanticTokensWorkspaceClientCapabilities `json:"semanticTokens,omitempty"`
// Capabilities specific to the code lens requests scoped to the
// workspace.
//
// @since 3.16.0.
CodeLens *CodeLensWorkspaceClientCapabilities `json:"codeLens,omitempty"`
// The client has support for file notifications/requests for user operations on files.
//
// Since 3.16.0
FileOperations *FileOperationClientCapabilities `json:"fileOperations,omitempty"`
// Capabilities specific to the inline values requests scoped to the
// workspace.
//
// @since 3.17.0.
InlineValue *InlineValueWorkspaceClientCapabilities `json:"inlineValue,omitempty"`
// Capabilities specific to the inlay hint requests scoped to the
// workspace.
//
// @since 3.17.0.
InlayHint *InlayHintWorkspaceClientCapabilities `json:"inlayHint,omitempty"`
// Capabilities specific to the diagnostic requests scoped to the
// workspace.
//
// @since 3.17.0.
Diagnostics *DiagnosticWorkspaceClientCapabilities `json:"diagnostics,omitempty"`
// Capabilities specific to the folding range requests scoped to the workspace.
//
// @since 3.18.0
// @proposed
FoldingRange *FoldingRangeWorkspaceClientCapabilities `json:"foldingRange,omitempty"`
// Capabilities specific to the `workspace/textDocumentContent` request.
//
// @since 3.18.0
// @proposed
TextDocumentContent *TextDocumentContentClientCapabilities `json:"textDocumentContent,omitempty"`
}
// Parameters of the workspace diagnostic request.
//
// @since 3.17.0
//
// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#workspaceDiagnosticParams
type WorkspaceDiagnosticParams struct {
// The additional identifier provided during registration.
Identifier string `json:"identifier,omitempty"`
// The currently known diagnostic reports with their
// previous result ids.
PreviousResultIds []PreviousResultId `json:"previousResultIds"`
WorkDoneProgressParams
PartialResultParams
}
// A workspace diagnostic report.
//
// @since 3.17.0
//
// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#workspaceDiagnosticReport
type WorkspaceDiagnosticReport struct {
Items []WorkspaceDocumentDiagnosticReport `json:"items"`
}
// A partial result for a workspace diagnostic report.
//
// @since 3.17.0
//
// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#workspaceDiagnosticReportPartialResult
type WorkspaceDiagnosticReportPartialResult struct {
Items []WorkspaceDocumentDiagnosticReport `json:"items"`
}
// A workspace diagnostic document report.
//
// @since 3.17.0
//
// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#workspaceDocumentDiagnosticReport
type WorkspaceDocumentDiagnosticReport = Or_WorkspaceDocumentDiagnosticReport // (alias)
// A workspace edit represents changes to many resources managed in the workspace. The edit
// should either provide `changes` or `documentChanges`. If documentChanges are present
// they are preferred over `changes` if the client can handle versioned document edits.
//
// Since version 3.13.0 a workspace edit can contain resource operations as well. If resource
// operations are present clients need to execute the operations in the order in which they
// are provided. So a workspace edit for example can consist of the following two changes:
// (1) a create file a.txt and (2) a text document edit which insert text into file a.txt.
//
// An invalid sequence (e.g. (1) delete file a.txt and (2) insert text into file a.txt) will
// cause failure of the operation. How the client recovers from the failure is described by
// the client capability: `workspace.workspaceEdit.failureHandling`
//
// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#workspaceEdit
type WorkspaceEdit struct {
// Holds changes to existing resources.
Changes map[DocumentUri][]TextEdit `json:"changes,omitempty"`
// Depending on the client capability `workspace.workspaceEdit.resourceOperations` document changes
// are either an array of `TextDocumentEdit`s to express changes to n different text documents
// where each text document edit addresses a specific version of a text document. Or it can contain
// above `TextDocumentEdit`s mixed with create, rename and delete file / folder operations.
//
// Whether a client supports versioned document edits is expressed via
// `workspace.workspaceEdit.documentChanges` client capability.
//
// If a client neither supports `documentChanges` nor `workspace.workspaceEdit.resourceOperations` then
// only plain `TextEdit`s using the `changes` property are supported.
DocumentChanges []DocumentChange `json:"documentChanges,omitempty"`
// A map of change annotations that can be referenced in `AnnotatedTextEdit`s or create, rename and
// delete file / folder operations.
//
// Whether clients honor this property depends on the client capability `workspace.changeAnnotationSupport`.
//
// @since 3.16.0
ChangeAnnotations map[ChangeAnnotationIdentifier]ChangeAnnotation `json:"changeAnnotations,omitempty"`
}
// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#workspaceEditClientCapabilities
type WorkspaceEditClientCapabilities struct {
// The client supports versioned document changes in `WorkspaceEdit`s
DocumentChanges bool `json:"documentChanges,omitempty"`
// The resource operations the client supports. Clients should at least
// support 'create', 'rename' and 'delete' files and folders.
//
// @since 3.13.0
ResourceOperations []ResourceOperationKind `json:"resourceOperations,omitempty"`
// The failure handling strategy of a client if applying the workspace edit
// fails.
//
// @since 3.13.0
FailureHandling *FailureHandlingKind `json:"failureHandling,omitempty"`
// Whether the client normalizes line endings to the client specific
// setting.
// If set to `true` the client will normalize line ending characters
// in a workspace edit to the client-specified new line
// character.
//
// @since 3.16.0
NormalizesLineEndings bool `json:"normalizesLineEndings,omitempty"`
// Whether the client in general supports change annotations on text edits,
// create file, rename file and delete file changes.
//
// @since 3.16.0
ChangeAnnotationSupport *ChangeAnnotationsSupportOptions `json:"changeAnnotationSupport,omitempty"`
// Whether the client supports `WorkspaceEditMetadata` in `WorkspaceEdit`s.
//
// @since 3.18.0
// @proposed
MetadataSupport bool `json:"metadataSupport,omitempty"`
// Whether the client supports snippets as text edits.
//
// @since 3.18.0
// @proposed
SnippetEditSupport bool `json:"snippetEditSupport,omitempty"`
}
// Additional data about a workspace edit.
//
// @since 3.18.0
// @proposed
//
// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#workspaceEditMetadata
type WorkspaceEditMetadata struct {
// Signal to the editor that this edit is a refactoring.
IsRefactoring bool `json:"isRefactoring,omitempty"`
}
// A workspace folder inside a client.
//
// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#workspaceFolder
type WorkspaceFolder struct {
// The associated URI for this workspace folder.
URI URI `json:"uri"`
// The name of the workspace folder. Used to refer to this
// workspace folder in the user interface.
Name string `json:"name"`
}
// The workspace folder change event.
//
// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#workspaceFoldersChangeEvent
type WorkspaceFoldersChangeEvent struct {
// The array of added workspace folders
Added []WorkspaceFolder `json:"added"`
// The array of the removed workspace folders
Removed []WorkspaceFolder `json:"removed"`
}
// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#workspaceFoldersInitializeParams
type WorkspaceFoldersInitializeParams struct {
// The workspace folders configured in the client when the server starts.
//
// This property is only available if the client supports workspace folders.
// It can be `null` if the client supports workspace folders but none are
// configured.
//
// @since 3.6.0
WorkspaceFolders []WorkspaceFolder `json:"workspaceFolders,omitempty"`
}
// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#workspaceFoldersServerCapabilities
type WorkspaceFoldersServerCapabilities struct {
// The server has support for workspace folders
Supported bool `json:"supported,omitempty"`
// Whether the server wants to receive workspace folder
// change notifications.
//
// If a string is provided the string is treated as an ID
// under which the notification is registered on the client
// side. The ID can be used to unregister for these events
// using the `client/unregisterCapability` request.
ChangeNotifications *Or_WorkspaceFoldersServerCapabilities_changeNotifications `json:"changeNotifications,omitempty"`
}
// A full document diagnostic report for a workspace diagnostic result.
//
// @since 3.17.0
//
// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#workspaceFullDocumentDiagnosticReport
type WorkspaceFullDocumentDiagnosticReport struct {
// The URI for which diagnostic information is reported.
URI DocumentUri `json:"uri"`
// The version number for which the diagnostics are reported.
// If the document is not marked as open `null` can be provided.
Version int32 `json:"version"`
FullDocumentDiagnosticReport
}
// Defines workspace specific capabilities of the server.
//
// @since 3.18.0
//
// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#workspaceOptions
type WorkspaceOptions struct {
// The server supports workspace folder.
//
// @since 3.6.0
WorkspaceFolders *WorkspaceFoldersServerCapabilities `json:"workspaceFolders,omitempty"`
// The server is interested in notifications/requests for operations on files.
//
// @since 3.16.0
FileOperations *FileOperationOptions `json:"fileOperations,omitempty"`
// The server supports the `workspace/textDocumentContent` request.
//
// @since 3.18.0
// @proposed
TextDocumentContent *Or_WorkspaceOptions_textDocumentContent `json:"textDocumentContent,omitempty"`
}
// A special workspace symbol that supports locations without a range.
//
// See also SymbolInformation.
//
// @since 3.17.0
//
// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#workspaceSymbol
type WorkspaceSymbol struct {
// The location of the symbol. Whether a server is allowed to
// return a location without a range depends on the client
// capability `workspace.symbol.resolveSupport`.
//
// See SymbolInformation#location for more details.
Location Or_WorkspaceSymbol_location `json:"location"`
// A data entry field that is preserved on a workspace symbol between a
// workspace symbol request and a workspace symbol resolve request.
Data interface{} `json:"data,omitempty"`
BaseSymbolInformation
}
// Client capabilities for a {@link WorkspaceSymbolRequest}.
//
// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#workspaceSymbolClientCapabilities
type WorkspaceSymbolClientCapabilities struct {
// Symbol request supports dynamic registration.
DynamicRegistration bool `json:"dynamicRegistration,omitempty"`
// Specific capabilities for the `SymbolKind` in the `workspace/symbol` request.
SymbolKind *ClientSymbolKindOptions `json:"symbolKind,omitempty"`
// The client supports tags on `SymbolInformation`.
// Clients supporting tags have to handle unknown tags gracefully.
//
// @since 3.16.0
TagSupport *ClientSymbolTagOptions `json:"tagSupport,omitempty"`
// The client support partial workspace symbols. The client will send the
// request `workspaceSymbol/resolve` to the server to resolve additional
// properties.
//
// @since 3.17.0
ResolveSupport *ClientSymbolResolveOptions `json:"resolveSupport,omitempty"`
}
// Server capabilities for a {@link WorkspaceSymbolRequest}.
//
// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#workspaceSymbolOptions
type WorkspaceSymbolOptions struct {
// The server provides support to resolve additional
// information for a workspace symbol.
//
// @since 3.17.0
ResolveProvider bool `json:"resolveProvider,omitempty"`
WorkDoneProgressOptions
}
// The parameters of a {@link WorkspaceSymbolRequest}.
//
// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#workspaceSymbolParams
type WorkspaceSymbolParams struct {
// A query string to filter symbols by. Clients may send an empty
// string here to request all symbols.
//
// The `query`-parameter should be interpreted in a *relaxed way* as editors
// will apply their own highlighting and scoring on the results. A good rule
// of thumb is to match case-insensitive and to simply check that the
// characters of *query* appear in their order in a candidate symbol.
// Servers shouldn't use prefix, substring, or similar strict matching.
Query string `json:"query"`
WorkDoneProgressParams
PartialResultParams
}
// Registration options for a {@link WorkspaceSymbolRequest}.
//
// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#workspaceSymbolRegistrationOptions
type WorkspaceSymbolRegistrationOptions struct {
WorkspaceSymbolOptions
}
// An unchanged document diagnostic report for a workspace diagnostic result.
//
// @since 3.17.0
//
// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#workspaceUnchangedDocumentDiagnosticReport
type WorkspaceUnchangedDocumentDiagnosticReport struct {
// The URI for which diagnostic information is reported.
URI DocumentUri `json:"uri"`
// The version number for which the diagnostics are reported.
// If the document is not marked as open `null` can be provided.
Version int32 `json:"version"`
UnchangedDocumentDiagnosticReport
}
// The initialize parameters
//
// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#_InitializeParams
type XInitializeParams struct {
// The process Id of the parent process that started
// the server.
//
// Is `null` if the process has not been started by another process.
// If the parent process is not alive then the server should exit.
ProcessID int32 `json:"processId"`
// Information about the client
//
// @since 3.15.0
ClientInfo *ClientInfo `json:"clientInfo,omitempty"`
// The locale the client is currently showing the user interface
// in. This must not necessarily be the locale of the operating
// system.
//
// Uses IETF language tags as the value's syntax
// (See https://en.wikipedia.org/wiki/IETF_language_tag)
//
// @since 3.16.0
Locale string `json:"locale,omitempty"`
// The rootPath of the workspace. Is null
// if no folder is open.
//
// @deprecated in favour of rootUri.
RootPath string `json:"rootPath,omitempty"`
// The rootUri of the workspace. Is null if no
// folder is open. If both `rootPath` and `rootUri` are set
// `rootUri` wins.
//
// @deprecated in favour of workspaceFolders.
RootURI DocumentUri `json:"rootUri"`
// The capabilities provided by the client (editor or tool)
Capabilities ClientCapabilities `json:"capabilities"`
// User provided initialization options.
InitializationOptions interface{} `json:"initializationOptions,omitempty"`
// The initial trace setting. If omitted trace is disabled ('off').
Trace *TraceValue `json:"trace,omitempty"`
WorkDoneProgressParams
}
// The initialize parameters
//
// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification#_InitializeParams
type _InitializeParams struct {
// The process Id of the parent process that started
// the server.
//
// Is `null` if the process has not been started by another process.
// If the parent process is not alive then the server should exit.
ProcessID int32 `json:"processId"`
// Information about the client
//
// @since 3.15.0
ClientInfo *ClientInfo `json:"clientInfo,omitempty"`
// The locale the client is currently showing the user interface
// in. This must not necessarily be the locale of the operating
// system.
//
// Uses IETF language tags as the value's syntax
// (See https://en.wikipedia.org/wiki/IETF_language_tag)
//
// @since 3.16.0
Locale string `json:"locale,omitempty"`
// The rootPath of the workspace. Is null
// if no folder is open.
//
// @deprecated in favour of rootUri.
RootPath string `json:"rootPath,omitempty"`
// The rootUri of the workspace. Is null if no
// folder is open. If both `rootPath` and `rootUri` are set
// `rootUri` wins.
//
// @deprecated in favour of workspaceFolders.
RootURI DocumentUri `json:"rootUri"`
// The capabilities provided by the client (editor or tool)
Capabilities ClientCapabilities `json:"capabilities"`
// User provided initialization options.
InitializationOptions interface{} `json:"initializationOptions,omitempty"`
// The initial trace setting. If omitted trace is disabled ('off').
Trace *TraceValue `json:"trace,omitempty"`
WorkDoneProgressParams
}
const (
// A set of predefined code action kinds
// Empty kind.
Empty CodeActionKind = ""
// Base kind for quickfix actions: 'quickfix'
QuickFix CodeActionKind = "quickfix"
// Base kind for refactoring actions: 'refactor'
Refactor CodeActionKind = "refactor"
// Base kind for refactoring extraction actions: 'refactor.extract'
//
// Example extract actions:
//
//
// - Extract method
// - Extract function
// - Extract variable
// - Extract interface from class
// - ...
RefactorExtract CodeActionKind = "refactor.extract"
// Base kind for refactoring inline actions: 'refactor.inline'
//
// Example inline actions:
//
//
// - Inline function
// - Inline variable
// - Inline constant
// - ...
RefactorInline CodeActionKind = "refactor.inline"
// Base kind for refactoring move actions: `refactor.move`
//
// Example move actions:
//
//
// - Move a function to a new file
// - Move a property between classes
// - Move method to base class
// - ...
//
// @since 3.18.0
// @proposed
RefactorMove CodeActionKind = "refactor.move"
// Base kind for refactoring rewrite actions: 'refactor.rewrite'
//
// Example rewrite actions:
//
//
// - Convert JavaScript function to class
// - Add or remove parameter
// - Encapsulate field
// - Make method static
// - Move method to base class
// - ...
RefactorRewrite CodeActionKind = "refactor.rewrite"
// Base kind for source actions: `source`
//
// Source code actions apply to the entire file.
Source CodeActionKind = "source"
// Base kind for an organize imports source action: `source.organizeImports`
SourceOrganizeImports CodeActionKind = "source.organizeImports"
// Base kind for auto-fix source actions: `source.fixAll`.
//
// Fix all actions automatically fix errors that have a clear fix that do not require user input.
// They should not suppress errors or perform unsafe fixes such as generating new types or classes.
//
// @since 3.15.0
SourceFixAll CodeActionKind = "source.fixAll"
// Base kind for all code actions applying to the entire notebook's scope. CodeActionKinds using
// this should always begin with `notebook.`
//
// @since 3.18.0
Notebook CodeActionKind = "notebook"
// The reason why code actions were requested.
//
// @since 3.17.0
// Code actions were explicitly requested by the user or by an extension.
CodeActionInvoked CodeActionTriggerKind = 1
// Code actions were requested automatically.
//
// This typically happens when current selection in a file changes, but can
// also be triggered when file content changes.
CodeActionAutomatic CodeActionTriggerKind = 2
// The kind of a completion entry.
TextCompletion CompletionItemKind = 1
MethodCompletion CompletionItemKind = 2
FunctionCompletion CompletionItemKind = 3
ConstructorCompletion CompletionItemKind = 4
FieldCompletion CompletionItemKind = 5
VariableCompletion CompletionItemKind = 6
ClassCompletion CompletionItemKind = 7
InterfaceCompletion CompletionItemKind = 8
ModuleCompletion CompletionItemKind = 9
PropertyCompletion CompletionItemKind = 10
UnitCompletion CompletionItemKind = 11
ValueCompletion CompletionItemKind = 12
EnumCompletion CompletionItemKind = 13
KeywordCompletion CompletionItemKind = 14
SnippetCompletion CompletionItemKind = 15
ColorCompletion CompletionItemKind = 16
FileCompletion CompletionItemKind = 17
ReferenceCompletion CompletionItemKind = 18
FolderCompletion CompletionItemKind = 19
EnumMemberCompletion CompletionItemKind = 20
ConstantCompletion CompletionItemKind = 21
StructCompletion CompletionItemKind = 22
EventCompletion CompletionItemKind = 23
OperatorCompletion CompletionItemKind = 24
TypeParameterCompletion CompletionItemKind = 25
// Completion item tags are extra annotations that tweak the rendering of a completion
// item.
//
// @since 3.15.0
// Render a completion as obsolete, usually using a strike-out.
ComplDeprecated CompletionItemTag = 1
// How a completion was triggered
// Completion was triggered by typing an identifier (24x7 code
// complete), manual invocation (e.g Ctrl+Space) or via API.
Invoked CompletionTriggerKind = 1
// Completion was triggered by a trigger character specified by
// the `triggerCharacters` properties of the `CompletionRegistrationOptions`.
TriggerCharacter CompletionTriggerKind = 2
// Completion was re-triggered as current completion list is incomplete
TriggerForIncompleteCompletions CompletionTriggerKind = 3
// The diagnostic's severity.
// Reports an error.
SeverityError DiagnosticSeverity = 1
// Reports a warning.
SeverityWarning DiagnosticSeverity = 2
// Reports an information.
SeverityInformation DiagnosticSeverity = 3
// Reports a hint.
SeverityHint DiagnosticSeverity = 4
// The diagnostic tags.
//
// @since 3.15.0
// Unused or unnecessary code.
//
// Clients are allowed to render diagnostics with this tag faded out instead of having
// an error squiggle.
Unnecessary DiagnosticTag = 1
// Deprecated or obsolete code.
//
// Clients are allowed to rendered diagnostics with this tag strike through.
Deprecated DiagnosticTag = 2
// The document diagnostic report kinds.
//
// @since 3.17.0
// A diagnostic report with a full
// set of problems.
DiagnosticFull DocumentDiagnosticReportKind = "full"
// A report indicating that the last
// returned report is still accurate.
DiagnosticUnchanged DocumentDiagnosticReportKind = "unchanged"
// A document highlight kind.
// A textual occurrence.
Text DocumentHighlightKind = 1
// Read-access of a symbol, like reading a variable.
Read DocumentHighlightKind = 2
// Write-access of a symbol, like writing to a variable.
Write DocumentHighlightKind = 3
// Predefined error codes.
ParseError ErrorCodes = -32700
InvalidRequest ErrorCodes = -32600
MethodNotFound ErrorCodes = -32601
InvalidParams ErrorCodes = -32602
InternalError ErrorCodes = -32603
// Error code indicating that a server received a notification or
// request before the server has received the `initialize` request.
ServerNotInitialized ErrorCodes = -32002
UnknownErrorCode ErrorCodes = -32001
// Applying the workspace change is simply aborted if one of the changes provided
// fails. All operations executed before the failing operation stay executed.
Abort FailureHandlingKind = "abort"
// All operations are executed transactional. That means they either all
// succeed or no changes at all are applied to the workspace.
Transactional FailureHandlingKind = "transactional"
// If the workspace edit contains only textual file changes they are executed transactional.
// If resource changes (create, rename or delete file) are part of the change the failure
// handling strategy is abort.
TextOnlyTransactional FailureHandlingKind = "textOnlyTransactional"
// The client tries to undo the operations already executed. But there is no
// guarantee that this is succeeding.
Undo FailureHandlingKind = "undo"
// The file event type
// The file got created.
Created FileChangeType = 1
// The file got changed.
Changed FileChangeType = 2
// The file got deleted.
Deleted FileChangeType = 3
// A pattern kind describing if a glob pattern matches a file a folder or
// both.
//
// @since 3.16.0
// The pattern matches a file only.
FilePattern FileOperationPatternKind = "file"
// The pattern matches a folder only.
FolderPattern FileOperationPatternKind = "folder"
// A set of predefined range kinds.
// Folding range for a comment
Comment FoldingRangeKind = "comment"
// Folding range for an import or include
Imports FoldingRangeKind = "imports"
// Folding range for a region (e.g. `#region`)
Region FoldingRangeKind = "region"
// Inlay hint kinds.
//
// @since 3.17.0
// An inlay hint that for a type annotation.
Type InlayHintKind = 1
// An inlay hint that is for a parameter.
Parameter InlayHintKind = 2
// Describes how an {@link InlineCompletionItemProvider inline completion provider} was triggered.
//
// @since 3.18.0
// @proposed
// Completion was triggered explicitly by a user gesture.
InlineInvoked InlineCompletionTriggerKind = 1
// Completion was triggered automatically while editing.
InlineAutomatic InlineCompletionTriggerKind = 2
// Defines whether the insert text in a completion item should be interpreted as
// plain text or a snippet.
// The primary text to be inserted is treated as a plain string.
PlainTextTextFormat InsertTextFormat = 1
// The primary text to be inserted is treated as a snippet.
//
// A snippet can define tab stops and placeholders with `$1`, `$2`
// and `${3:foo}`. `$0` defines the final tab stop, it defaults to
// the end of the snippet. Placeholders with equal identifiers are linked,
// that is typing in one will update others too.
//
// See also: https://microsoft.github.io/language-server-protocol/specifications/specification-current/#snippet_syntax
SnippetTextFormat InsertTextFormat = 2
// How whitespace and indentation is handled during completion
// item insertion.
//
// @since 3.16.0
// The insertion or replace strings is taken as it is. If the
// value is multi line the lines below the cursor will be
// inserted using the indentation defined in the string value.
// The client will not apply any kind of adjustments to the
// string.
AsIs InsertTextMode = 1
// The editor adjusts leading whitespace of new lines so that
// they match the indentation up to the cursor of the line for
// which the item is accepted.
//
// Consider a line like this: <2tabs><cursor><3tabs>foo. Accepting a
// multi line completion item is indented using 2 tabs and all
// following lines inserted will be indented using 2 tabs as well.
AdjustIndentation InsertTextMode = 2
// A request failed but it was syntactically correct, e.g the
// method name was known and the parameters were valid. The error
// message should contain human readable information about why
// the request failed.
//
// @since 3.17.0
RequestFailed LSPErrorCodes = -32803
// The server cancelled the request. This error code should
// only be used for requests that explicitly support being
// server cancellable.
//
// @since 3.17.0
ServerCancelled LSPErrorCodes = -32802
// The server detected that the content of a document got
// modified outside normal conditions. A server should
// NOT send this error code if it detects a content change
// in it unprocessed messages. The result even computed
// on an older state might still be useful for the client.
//
// If a client decides that a result is not of any use anymore
// the client should cancel the request.
ContentModified LSPErrorCodes = -32801
// The client has canceled a request and a server has detected
// the cancel.
RequestCancelled LSPErrorCodes = -32800
// Predefined Language kinds
// @since 3.18.0
// @proposed
LangABAP LanguageKind = "abap"
LangWindowsBat LanguageKind = "bat"
LangBibTeX LanguageKind = "bibtex"
LangClojure LanguageKind = "clojure"
LangCoffeescript LanguageKind = "coffeescript"
LangC LanguageKind = "c"
LangCPP LanguageKind = "cpp"
LangCSharp LanguageKind = "csharp"
LangCSS LanguageKind = "css"
// @since 3.18.0
// @proposed
LangD LanguageKind = "d"
// @since 3.18.0
// @proposed
LangDelphi LanguageKind = "pascal"
LangDiff LanguageKind = "diff"
LangDart LanguageKind = "dart"
LangDockerfile LanguageKind = "dockerfile"
LangElixir LanguageKind = "elixir"
LangErlang LanguageKind = "erlang"
LangFSharp LanguageKind = "fsharp"
LangGitCommit LanguageKind = "git-commit"
LangGitRebase LanguageKind = "rebase"
LangGo LanguageKind = "go"
LangGroovy LanguageKind = "groovy"
LangHandlebars LanguageKind = "handlebars"
LangHaskell LanguageKind = "haskell"
LangHTML LanguageKind = "html"
LangIni LanguageKind = "ini"
LangJava LanguageKind = "java"
LangJavaScript LanguageKind = "javascript"
LangJavaScriptReact LanguageKind = "javascriptreact"
LangJSON LanguageKind = "json"
LangLaTeX LanguageKind = "latex"
LangLess LanguageKind = "less"
LangLua LanguageKind = "lua"
LangMakefile LanguageKind = "makefile"
LangMarkdown LanguageKind = "markdown"
LangObjectiveC LanguageKind = "objective-c"
LangObjectiveCPP LanguageKind = "objective-cpp"
// @since 3.18.0
// @proposed
LangPascal LanguageKind = "pascal"
LangPerl LanguageKind = "perl"
LangPerl6 LanguageKind = "perl6"
LangPHP LanguageKind = "php"
LangPowershell LanguageKind = "powershell"
LangPug LanguageKind = "jade"
LangPython LanguageKind = "python"
LangR LanguageKind = "r"
LangRazor LanguageKind = "razor"
LangRuby LanguageKind = "ruby"
LangRust LanguageKind = "rust"
LangSCSS LanguageKind = "scss"
LangSASS LanguageKind = "sass"
LangScala LanguageKind = "scala"
LangShaderLab LanguageKind = "shaderlab"
LangShellScript LanguageKind = "shellscript"
LangSQL LanguageKind = "sql"
LangSwift LanguageKind = "swift"
LangTypeScript LanguageKind = "typescript"
LangTypeScriptReact LanguageKind = "typescriptreact"
LangTeX LanguageKind = "tex"
LangVisualBasic LanguageKind = "vb"
LangXML LanguageKind = "xml"
LangXSL LanguageKind = "xsl"
LangYAML LanguageKind = "yaml"
// Describes the content type that a client supports in various
// result literals like `Hover`, `ParameterInfo` or `CompletionItem`.
//
// Please note that `MarkupKinds` must not start with a `$`. This kinds
// are reserved for internal usage.
// Plain text is supported as a content format
PlainText MarkupKind = "plaintext"
// Markdown is supported as a content format
Markdown MarkupKind = "markdown"
// The message type
// An error message.
Error MessageType = 1
// A warning message.
Warning MessageType = 2
// An information message.
Info MessageType = 3
// A log message.
Log MessageType = 4
// A debug message.
//
// @since 3.18.0
// @proposed
Debug MessageType = 5
// The moniker kind.
//
// @since 3.16.0
// The moniker represent a symbol that is imported into a project
Import MonikerKind = "import"
// The moniker represents a symbol that is exported from a project
Export MonikerKind = "export"
// The moniker represents a symbol that is local to a project (e.g. a local
// variable of a function, a class not visible outside the project, ...)
Local MonikerKind = "local"
// A notebook cell kind.
//
// @since 3.17.0
// A markup-cell is formatted source that is used for display.
Markup NotebookCellKind = 1
// A code-cell is source code.
Code NotebookCellKind = 2
// A set of predefined position encoding kinds.
//
// @since 3.17.0
// Character offsets count UTF-8 code units (e.g. bytes).
UTF8 PositionEncodingKind = "utf-8"
// Character offsets count UTF-16 code units.
//
// This is the default and must always be supported
// by servers
UTF16 PositionEncodingKind = "utf-16"
// Character offsets count UTF-32 code units.
//
// Implementation note: these are the same as Unicode codepoints,
// so this `PositionEncodingKind` may also be used for an
// encoding-agnostic representation of character offsets.
UTF32 PositionEncodingKind = "utf-32"
// The client's default behavior is to select the identifier
// according the to language's syntax rule.
Identifier PrepareSupportDefaultBehavior = 1
// Supports creating new files and folders.
Create ResourceOperationKind = "create"
// Supports renaming existing files and folders.
Rename ResourceOperationKind = "rename"
// Supports deleting existing files and folders.
Delete ResourceOperationKind = "delete"
// A set of predefined token modifiers. This set is not fixed
// an clients can specify additional token types via the
// corresponding client capabilities.
//
// @since 3.16.0
ModDeclaration SemanticTokenModifiers = "declaration"
ModDefinition SemanticTokenModifiers = "definition"
ModReadonly SemanticTokenModifiers = "readonly"
ModStatic SemanticTokenModifiers = "static"
ModDeprecated SemanticTokenModifiers = "deprecated"
ModAbstract SemanticTokenModifiers = "abstract"
ModAsync SemanticTokenModifiers = "async"
ModModification SemanticTokenModifiers = "modification"
ModDocumentation SemanticTokenModifiers = "documentation"
ModDefaultLibrary SemanticTokenModifiers = "defaultLibrary"
// A set of predefined token types. This set is not fixed
// an clients can specify additional token types via the
// corresponding client capabilities.
//
// @since 3.16.0
NamespaceType SemanticTokenTypes = "namespace"
// Represents a generic type. Acts as a fallback for types which can't be mapped to
// a specific type like class or enum.
TypeType SemanticTokenTypes = "type"
ClassType SemanticTokenTypes = "class"
EnumType SemanticTokenTypes = "enum"
InterfaceType SemanticTokenTypes = "interface"
StructType SemanticTokenTypes = "struct"
TypeParameterType SemanticTokenTypes = "typeParameter"
ParameterType SemanticTokenTypes = "parameter"
VariableType SemanticTokenTypes = "variable"
PropertyType SemanticTokenTypes = "property"
EnumMemberType SemanticTokenTypes = "enumMember"
EventType SemanticTokenTypes = "event"
FunctionType SemanticTokenTypes = "function"
MethodType SemanticTokenTypes = "method"
MacroType SemanticTokenTypes = "macro"
KeywordType SemanticTokenTypes = "keyword"
ModifierType SemanticTokenTypes = "modifier"
CommentType SemanticTokenTypes = "comment"
StringType SemanticTokenTypes = "string"
NumberType SemanticTokenTypes = "number"
RegexpType SemanticTokenTypes = "regexp"
OperatorType SemanticTokenTypes = "operator"
// @since 3.17.0
DecoratorType SemanticTokenTypes = "decorator"
// @since 3.18.0
LabelType SemanticTokenTypes = "label"
// How a signature help was triggered.
//
// @since 3.15.0
// Signature help was invoked manually by the user or by a command.
SigInvoked SignatureHelpTriggerKind = 1
// Signature help was triggered by a trigger character.
SigTriggerCharacter SignatureHelpTriggerKind = 2
// Signature help was triggered by the cursor moving or by the document content changing.
SigContentChange SignatureHelpTriggerKind = 3
// A symbol kind.
File SymbolKind = 1
Module SymbolKind = 2
Namespace SymbolKind = 3
Package SymbolKind = 4
Class SymbolKind = 5
Method SymbolKind = 6
Property SymbolKind = 7
Field SymbolKind = 8
Constructor SymbolKind = 9
Enum SymbolKind = 10
Interface SymbolKind = 11
Function SymbolKind = 12
Variable SymbolKind = 13
Constant SymbolKind = 14
String SymbolKind = 15
Number SymbolKind = 16
Boolean SymbolKind = 17
Array SymbolKind = 18
Object SymbolKind = 19
Key SymbolKind = 20
Null SymbolKind = 21
EnumMember SymbolKind = 22
Struct SymbolKind = 23
Event SymbolKind = 24
Operator SymbolKind = 25
TypeParameter SymbolKind = 26
// Symbol tags are extra annotations that tweak the rendering of a symbol.
//
// @since 3.16
// Render a symbol as obsolete, usually using a strike-out.
DeprecatedSymbol SymbolTag = 1
// Represents reasons why a text document is saved.
// Manually triggered, e.g. by the user pressing save, by starting debugging,
// or by an API call.
Manual TextDocumentSaveReason = 1
// Automatic after a delay.
AfterDelay TextDocumentSaveReason = 2
// When the editor lost focus.
FocusOut TextDocumentSaveReason = 3
// Defines how the host (editor) should sync
// document changes to the language server.
// Documents should not be synced at all.
None TextDocumentSyncKind = 0
// Documents are synced by always sending the full content
// of the document.
Full TextDocumentSyncKind = 1
// Documents are synced by sending the full content on open.
// After that only incremental updates to the document are
// send.
Incremental TextDocumentSyncKind = 2
Relative TokenFormat = "relative"
// Turn tracing off.
Off TraceValue = "off"
// Trace messages only.
Messages TraceValue = "messages"
// Verbose message tracing.
Verbose TraceValue = "verbose"
// Moniker uniqueness level to define scope of the moniker.
//
// @since 3.16.0
// The moniker is only unique inside a document
Document UniquenessLevel = "document"
// The moniker is unique inside a project for which a dump got created
Project UniquenessLevel = "project"
// The moniker is unique inside the group to which a project belongs
Group UniquenessLevel = "group"
// The moniker is unique inside the moniker scheme.
Scheme UniquenessLevel = "scheme"
// The moniker is globally unique
Global UniquenessLevel = "global"
// Interested in create events.
WatchCreate WatchKind = 1
// Interested in change events
WatchChange WatchKind = 2
// Interested in delete events
WatchDelete WatchKind = 4
)
+218
View File
@@ -0,0 +1,218 @@
// Copyright 2023 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package protocol
// This file declares URI, DocumentUri, and its methods.
//
// For the LSP definition of these types, see
// https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#uri
import (
"fmt"
"net/url"
"path/filepath"
"strings"
"unicode"
)
// A DocumentUri is the URI of a client editor document.
//
// According to the LSP specification:
//
// Care should be taken to handle encoding in URIs. For
// example, some clients (such as VS Code) may encode colons
// in drive letters while others do not. The URIs below are
// both valid, but clients and servers should be consistent
// with the form they use themselves to ensure the other party
// doesnt interpret them as distinct URIs. Clients and
// servers should not assume that each other are encoding the
// same way (for example a client encoding colons in drive
// letters cannot assume server responses will have encoded
// colons). The same applies to casing of drive letters - one
// party should not assume the other party will return paths
// with drive letters cased the same as it.
//
// file:///c:/project/readme.md
// file:///C%3A/project/readme.md
//
// This is done during JSON unmarshalling;
// see [DocumentUri.UnmarshalText] for details.
type DocumentUri string
// A URI is an arbitrary URL (e.g. https), not necessarily a file.
type URI = string
// UnmarshalText implements decoding of DocumentUri values.
//
// In particular, it implements a systematic correction of various odd
// features of the definition of DocumentUri in the LSP spec that
// appear to be workarounds for bugs in VS Code. For example, it may
// URI-encode the URI itself, so that colon becomes %3A, and it may
// send file://foo.go URIs that have two slashes (not three) and no
// hostname.
//
// We use UnmarshalText, not UnmarshalJSON, because it is called even
// for non-addressable values such as keys and values of map[K]V,
// where there is no pointer of type *K or *V on which to call
// UnmarshalJSON. (See Go issue #28189 for more detail.)
//
// Non-empty DocumentUris are valid "file"-scheme URIs.
// The empty DocumentUri is valid.
func (uri *DocumentUri) UnmarshalText(data []byte) (err error) {
*uri, err = ParseDocumentUri(string(data))
return
}
// Path returns the file path for the given URI.
//
// DocumentUri("").Path() returns the empty string.
//
// Path panics if called on a URI that is not a valid filename.
func (uri DocumentUri) Path() string {
filename, err := filename(uri)
if err != nil {
// e.g. ParseRequestURI failed.
//
// This can only affect DocumentUris created by
// direct string manipulation; all DocumentUris
// received from the client pass through
// ParseRequestURI, which ensures validity.
panic(err)
}
return filepath.FromSlash(filename)
}
// Dir returns the URI for the directory containing the receiver.
func (uri DocumentUri) Dir() DocumentUri {
// This function could be more efficiently implemented by avoiding any call
// to Path(), but at least consolidates URI manipulation.
return URIFromPath(uri.DirPath())
}
// DirPath returns the file path to the directory containing this URI, which
// must be a file URI.
func (uri DocumentUri) DirPath() string {
return filepath.Dir(uri.Path())
}
func filename(uri DocumentUri) (string, error) {
if uri == "" {
return "", nil
}
// This conservative check for the common case
// of a simple non-empty absolute POSIX filename
// avoids the allocation of a net.URL.
if strings.HasPrefix(string(uri), "file:///") {
rest := string(uri)[len("file://"):] // leave one slash
for i := range len(rest) {
b := rest[i]
// Reject these cases:
if b < ' ' || b == 0x7f || // control character
b == '%' || b == '+' || // URI escape
b == ':' || // Windows drive letter
b == '@' || b == '&' || b == '?' { // authority or query
goto slow
}
}
return rest, nil
}
slow:
u, err := url.ParseRequestURI(string(uri))
if err != nil {
return "", err
}
if u.Scheme != fileScheme {
return "", fmt.Errorf("only file URIs are supported, got %q from %q", u.Scheme, uri)
}
// If the URI is a Windows URI, we trim the leading "/" and uppercase
// the drive letter, which will never be case sensitive.
if isWindowsDriveURIPath(u.Path) {
u.Path = strings.ToUpper(string(u.Path[1])) + u.Path[2:]
}
return u.Path, nil
}
// ParseDocumentUri interprets a string as a DocumentUri, applying VS
// Code workarounds; see [DocumentUri.UnmarshalText] for details.
func ParseDocumentUri(s string) (DocumentUri, error) {
if s == "" {
return "", nil
}
if !strings.HasPrefix(s, "file://") {
return "", fmt.Errorf("DocumentUri scheme is not 'file': %s", s)
}
// VS Code sends URLs with only two slashes,
// which are invalid. golang/go#39789.
if !strings.HasPrefix(s, "file:///") {
s = "file:///" + s[len("file://"):]
}
// Even though the input is a URI, it may not be in canonical form. VS Code
// in particular over-escapes :, @, etc. Unescape and re-encode to canonicalize.
path, err := url.PathUnescape(s[len("file://"):])
if err != nil {
return "", err
}
// File URIs from Windows may have lowercase drive letters.
// Since drive letters are guaranteed to be case insensitive,
// we change them to uppercase to remain consistent.
// For example, file:///c:/x/y/z becomes file:///C:/x/y/z.
if isWindowsDriveURIPath(path) {
path = path[:1] + strings.ToUpper(string(path[1])) + path[2:]
}
u := url.URL{Scheme: fileScheme, Path: path}
return DocumentUri(u.String()), nil
}
// URIFromPath returns DocumentUri for the supplied file path.
// Given "", it returns "".
func URIFromPath(path string) DocumentUri {
if path == "" {
return ""
}
if !isWindowsDrivePath(path) {
if abs, err := filepath.Abs(path); err == nil {
path = abs
}
}
// Check the file path again, in case it became absolute.
if isWindowsDrivePath(path) {
path = "/" + strings.ToUpper(string(path[0])) + path[1:]
}
path = filepath.ToSlash(path)
u := url.URL{
Scheme: fileScheme,
Path: path,
}
return DocumentUri(u.String())
}
const fileScheme = "file"
// isWindowsDrivePath returns true if the file path is of the form used by
// Windows. We check if the path begins with a drive letter, followed by a ":".
// For example: C:/x/y/z.
func isWindowsDrivePath(path string) bool {
if len(path) < 3 {
return false
}
return unicode.IsLetter(rune(path[0])) && path[1] == ':'
}
// isWindowsDriveURIPath returns true if the file URI is of the format used by
// Windows URIs. The url.Parse package does not specially handle Windows paths
// (see golang/go#6027), so we check if the URI path has a drive prefix (e.g. "/C:").
func isWindowsDriveURIPath(uri string) bool {
if len(uri) < 4 {
return false
}
return uri[0] == '/' && unicode.IsLetter(rune(uri[1])) && uri[2] == ':'
}
+272
View File
@@ -0,0 +1,272 @@
package lsp
import (
"bufio"
"context"
"encoding/json"
"fmt"
"io"
"strings"
"github.com/kujtimiihoxha/opencode/internal/config"
"github.com/kujtimiihoxha/opencode/internal/logging"
)
// Write writes an LSP message to the given writer
func WriteMessage(w io.Writer, msg *Message) error {
data, err := json.Marshal(msg)
if err != nil {
return fmt.Errorf("failed to marshal message: %w", err)
}
cnf := config.Get()
if cnf.DebugLSP {
logging.Debug("Sending message to server", "method", msg.Method, "id", msg.ID)
}
_, err = fmt.Fprintf(w, "Content-Length: %d\r\n\r\n", len(data))
if err != nil {
return fmt.Errorf("failed to write header: %w", err)
}
_, err = w.Write(data)
if err != nil {
return fmt.Errorf("failed to write message: %w", err)
}
return nil
}
// ReadMessage reads a single LSP message from the given reader
func ReadMessage(r *bufio.Reader) (*Message, error) {
cnf := config.Get()
// Read headers
var contentLength int
for {
line, err := r.ReadString('\n')
if err != nil {
return nil, fmt.Errorf("failed to read header: %w", err)
}
line = strings.TrimSpace(line)
if cnf.DebugLSP {
logging.Debug("Received header", "line", line)
}
if line == "" {
break // End of headers
}
if strings.HasPrefix(line, "Content-Length: ") {
_, err := fmt.Sscanf(line, "Content-Length: %d", &contentLength)
if err != nil {
return nil, fmt.Errorf("invalid Content-Length: %w", err)
}
}
}
if cnf.DebugLSP {
logging.Debug("Content-Length", "length", contentLength)
}
// Read content
content := make([]byte, contentLength)
_, err := io.ReadFull(r, content)
if err != nil {
return nil, fmt.Errorf("failed to read content: %w", err)
}
if cnf.DebugLSP {
logging.Debug("Received content", "content", string(content))
}
// Parse message
var msg Message
if err := json.Unmarshal(content, &msg); err != nil {
return nil, fmt.Errorf("failed to unmarshal message: %w", err)
}
return &msg, nil
}
// handleMessages reads and dispatches messages in a loop
func (c *Client) handleMessages() {
cnf := config.Get()
for {
msg, err := ReadMessage(c.stdout)
if err != nil {
if cnf.DebugLSP {
logging.Error("Error reading message", "error", err)
}
return
}
// Handle server->client request (has both Method and ID)
if msg.Method != "" && msg.ID != 0 {
if cnf.DebugLSP {
logging.Debug("Received request from server", "method", msg.Method, "id", msg.ID)
}
response := &Message{
JSONRPC: "2.0",
ID: msg.ID,
}
// Look up handler for this method
c.serverHandlersMu.RLock()
handler, ok := c.serverRequestHandlers[msg.Method]
c.serverHandlersMu.RUnlock()
if ok {
result, err := handler(msg.Params)
if err != nil {
response.Error = &ResponseError{
Code: -32603,
Message: err.Error(),
}
} else {
rawJSON, err := json.Marshal(result)
if err != nil {
response.Error = &ResponseError{
Code: -32603,
Message: fmt.Sprintf("failed to marshal response: %v", err),
}
} else {
response.Result = rawJSON
}
}
} else {
response.Error = &ResponseError{
Code: -32601,
Message: fmt.Sprintf("method not found: %s", msg.Method),
}
}
// Send response back to server
if err := WriteMessage(c.stdin, response); err != nil {
logging.Error("Error sending response to server", "error", err)
}
continue
}
// Handle notification (has Method but no ID)
if msg.Method != "" && msg.ID == 0 {
c.notificationMu.RLock()
handler, ok := c.notificationHandlers[msg.Method]
c.notificationMu.RUnlock()
if ok {
if cnf.DebugLSP {
logging.Debug("Handling notification", "method", msg.Method)
}
go handler(msg.Params)
} else if cnf.DebugLSP {
logging.Debug("No handler for notification", "method", msg.Method)
}
continue
}
// Handle response to our request (has ID but no Method)
if msg.ID != 0 && msg.Method == "" {
c.handlersMu.RLock()
ch, ok := c.handlers[msg.ID]
c.handlersMu.RUnlock()
if ok {
if cnf.DebugLSP {
logging.Debug("Received response for request", "id", msg.ID)
}
ch <- msg
close(ch)
} else if cnf.DebugLSP {
logging.Debug("No handler for response", "id", msg.ID)
}
}
}
}
// Call makes a request and waits for the response
func (c *Client) Call(ctx context.Context, method string, params any, result any) error {
cnf := config.Get()
id := c.nextID.Add(1)
if cnf.DebugLSP {
logging.Debug("Making call", "method", method, "id", id)
}
msg, err := NewRequest(id, method, params)
if err != nil {
return fmt.Errorf("failed to create request: %w", err)
}
// Create response channel
ch := make(chan *Message, 1)
c.handlersMu.Lock()
c.handlers[id] = ch
c.handlersMu.Unlock()
defer func() {
c.handlersMu.Lock()
delete(c.handlers, id)
c.handlersMu.Unlock()
}()
// Send request
if err := WriteMessage(c.stdin, msg); err != nil {
return fmt.Errorf("failed to send request: %w", err)
}
if cnf.DebugLSP {
logging.Debug("Request sent", "method", method, "id", id)
}
// Wait for response
resp := <-ch
if cnf.DebugLSP {
logging.Debug("Received response", "id", id)
}
if resp.Error != nil {
return fmt.Errorf("request failed: %s (code: %d)", resp.Error.Message, resp.Error.Code)
}
if result != nil {
// If result is a json.RawMessage, just copy the raw bytes
if rawMsg, ok := result.(*json.RawMessage); ok {
*rawMsg = resp.Result
return nil
}
// Otherwise unmarshal into the provided type
if err := json.Unmarshal(resp.Result, result); err != nil {
return fmt.Errorf("failed to unmarshal result: %w", err)
}
}
return nil
}
// Notify sends a notification (a request without an ID that doesn't expect a response)
func (c *Client) Notify(ctx context.Context, method string, params any) error {
cnf := config.Get()
if cnf.DebugLSP {
logging.Debug("Sending notification", "method", method)
}
msg, err := NewNotification(method, params)
if err != nil {
return fmt.Errorf("failed to create notification: %w", err)
}
if err := WriteMessage(c.stdin, msg); err != nil {
return fmt.Errorf("failed to send notification: %w", err)
}
return nil
}
type (
NotificationHandler func(params json.RawMessage)
ServerRequestHandler func(params json.RawMessage) (any, error)
)
+239
View File
@@ -0,0 +1,239 @@
package util
import (
"bytes"
"fmt"
"os"
"sort"
"strings"
"github.com/kujtimiihoxha/opencode/internal/lsp/protocol"
)
func applyTextEdits(uri protocol.DocumentUri, edits []protocol.TextEdit) error {
path := strings.TrimPrefix(string(uri), "file://")
// Read the file content
content, err := os.ReadFile(path)
if err != nil {
return fmt.Errorf("failed to read file: %w", err)
}
// Detect line ending style
var lineEnding string
if bytes.Contains(content, []byte("\r\n")) {
lineEnding = "\r\n"
} else {
lineEnding = "\n"
}
// Track if file ends with a newline
endsWithNewline := len(content) > 0 && bytes.HasSuffix(content, []byte(lineEnding))
// Split into lines without the endings
lines := strings.Split(string(content), lineEnding)
// Check for overlapping edits
for i, edit1 := range edits {
for j := i + 1; j < len(edits); j++ {
if rangesOverlap(edit1.Range, edits[j].Range) {
return fmt.Errorf("overlapping edits detected between edit %d and %d", i, j)
}
}
}
// Sort edits in reverse order
sortedEdits := make([]protocol.TextEdit, len(edits))
copy(sortedEdits, edits)
sort.Slice(sortedEdits, func(i, j int) bool {
if sortedEdits[i].Range.Start.Line != sortedEdits[j].Range.Start.Line {
return sortedEdits[i].Range.Start.Line > sortedEdits[j].Range.Start.Line
}
return sortedEdits[i].Range.Start.Character > sortedEdits[j].Range.Start.Character
})
// Apply each edit
for _, edit := range sortedEdits {
newLines, err := applyTextEdit(lines, edit)
if err != nil {
return fmt.Errorf("failed to apply edit: %w", err)
}
lines = newLines
}
// Join lines with proper line endings
var newContent strings.Builder
for i, line := range lines {
if i > 0 {
newContent.WriteString(lineEnding)
}
newContent.WriteString(line)
}
// Only add a newline if the original file had one and we haven't already added it
if endsWithNewline && !strings.HasSuffix(newContent.String(), lineEnding) {
newContent.WriteString(lineEnding)
}
if err := os.WriteFile(path, []byte(newContent.String()), 0o644); err != nil {
return fmt.Errorf("failed to write file: %w", err)
}
return nil
}
func applyTextEdit(lines []string, edit protocol.TextEdit) ([]string, error) {
startLine := int(edit.Range.Start.Line)
endLine := int(edit.Range.End.Line)
startChar := int(edit.Range.Start.Character)
endChar := int(edit.Range.End.Character)
// Validate positions
if startLine < 0 || startLine >= len(lines) {
return nil, fmt.Errorf("invalid start line: %d", startLine)
}
if endLine < 0 || endLine >= len(lines) {
endLine = len(lines) - 1
}
// Create result slice with initial capacity
result := make([]string, 0, len(lines))
// Copy lines before edit
result = append(result, lines[:startLine]...)
// Get the prefix of the start line
startLineContent := lines[startLine]
if startChar < 0 || startChar > len(startLineContent) {
startChar = len(startLineContent)
}
prefix := startLineContent[:startChar]
// Get the suffix of the end line
endLineContent := lines[endLine]
if endChar < 0 || endChar > len(endLineContent) {
endChar = len(endLineContent)
}
suffix := endLineContent[endChar:]
// Handle the edit
if edit.NewText == "" {
if prefix+suffix != "" {
result = append(result, prefix+suffix)
}
} else {
// Split new text into lines, being careful not to add extra newlines
// newLines := strings.Split(strings.TrimRight(edit.NewText, "\n"), "\n")
newLines := strings.Split(edit.NewText, "\n")
if len(newLines) == 1 {
// Single line change
result = append(result, prefix+newLines[0]+suffix)
} else {
// Multi-line change
result = append(result, prefix+newLines[0])
result = append(result, newLines[1:len(newLines)-1]...)
result = append(result, newLines[len(newLines)-1]+suffix)
}
}
// Add remaining lines
if endLine+1 < len(lines) {
result = append(result, lines[endLine+1:]...)
}
return result, nil
}
// applyDocumentChange applies a DocumentChange (create/rename/delete operations)
func applyDocumentChange(change protocol.DocumentChange) error {
if change.CreateFile != nil {
path := strings.TrimPrefix(string(change.CreateFile.URI), "file://")
if change.CreateFile.Options != nil {
if change.CreateFile.Options.Overwrite {
// Proceed with overwrite
} else if change.CreateFile.Options.IgnoreIfExists {
if _, err := os.Stat(path); err == nil {
return nil // File exists and we're ignoring it
}
}
}
if err := os.WriteFile(path, []byte(""), 0o644); err != nil {
return fmt.Errorf("failed to create file: %w", err)
}
}
if change.DeleteFile != nil {
path := strings.TrimPrefix(string(change.DeleteFile.URI), "file://")
if change.DeleteFile.Options != nil && change.DeleteFile.Options.Recursive {
if err := os.RemoveAll(path); err != nil {
return fmt.Errorf("failed to delete directory recursively: %w", err)
}
} else {
if err := os.Remove(path); err != nil {
return fmt.Errorf("failed to delete file: %w", err)
}
}
}
if change.RenameFile != nil {
oldPath := strings.TrimPrefix(string(change.RenameFile.OldURI), "file://")
newPath := strings.TrimPrefix(string(change.RenameFile.NewURI), "file://")
if change.RenameFile.Options != nil {
if !change.RenameFile.Options.Overwrite {
if _, err := os.Stat(newPath); err == nil {
return fmt.Errorf("target file already exists and overwrite is not allowed: %s", newPath)
}
}
}
if err := os.Rename(oldPath, newPath); err != nil {
return fmt.Errorf("failed to rename file: %w", err)
}
}
if change.TextDocumentEdit != nil {
textEdits := make([]protocol.TextEdit, len(change.TextDocumentEdit.Edits))
for i, edit := range change.TextDocumentEdit.Edits {
var err error
textEdits[i], err = edit.AsTextEdit()
if err != nil {
return fmt.Errorf("invalid edit type: %w", err)
}
}
return applyTextEdits(change.TextDocumentEdit.TextDocument.URI, textEdits)
}
return nil
}
// ApplyWorkspaceEdit applies the given WorkspaceEdit to the filesystem
func ApplyWorkspaceEdit(edit protocol.WorkspaceEdit) error {
// Handle Changes field
for uri, textEdits := range edit.Changes {
if err := applyTextEdits(uri, textEdits); err != nil {
return fmt.Errorf("failed to apply text edits: %w", err)
}
}
// Handle DocumentChanges field
for _, change := range edit.DocumentChanges {
if err := applyDocumentChange(change); err != nil {
return fmt.Errorf("failed to apply document change: %w", err)
}
}
return nil
}
func rangesOverlap(r1, r2 protocol.Range) bool {
if r1.Start.Line > r2.End.Line || r2.Start.Line > r1.End.Line {
return false
}
if r1.Start.Line == r2.End.Line && r1.Start.Character > r2.End.Character {
return false
}
if r2.Start.Line == r1.End.Line && r2.Start.Character > r1.End.Character {
return false
}
return true
}
+985
View File
@@ -0,0 +1,985 @@
package watcher
import (
"context"
"fmt"
"os"
"path/filepath"
"strings"
"sync"
"time"
"github.com/bmatcuk/doublestar/v4"
"github.com/fsnotify/fsnotify"
"github.com/kujtimiihoxha/opencode/internal/config"
"github.com/kujtimiihoxha/opencode/internal/logging"
"github.com/kujtimiihoxha/opencode/internal/lsp"
"github.com/kujtimiihoxha/opencode/internal/lsp/protocol"
)
// WorkspaceWatcher manages LSP file watching
type WorkspaceWatcher struct {
client *lsp.Client
workspacePath string
debounceTime time.Duration
debounceMap map[string]*time.Timer
debounceMu sync.Mutex
// File watchers registered by the server
registrations []protocol.FileSystemWatcher
registrationMu sync.RWMutex
}
// NewWorkspaceWatcher creates a new workspace watcher
func NewWorkspaceWatcher(client *lsp.Client) *WorkspaceWatcher {
return &WorkspaceWatcher{
client: client,
debounceTime: 300 * time.Millisecond,
debounceMap: make(map[string]*time.Timer),
registrations: []protocol.FileSystemWatcher{},
}
}
// AddRegistrations adds file watchers to track
func (w *WorkspaceWatcher) AddRegistrations(ctx context.Context, id string, watchers []protocol.FileSystemWatcher) {
cnf := config.Get()
logging.Debug("Adding file watcher registrations")
w.registrationMu.Lock()
defer w.registrationMu.Unlock()
// Add new watchers
w.registrations = append(w.registrations, watchers...)
// Print detailed registration information for debugging
if cnf.DebugLSP {
logging.Debug("Adding file watcher registrations",
"id", id,
"watchers", len(watchers),
"total", len(w.registrations),
)
for i, watcher := range watchers {
logging.Debug("Registration", "index", i+1)
// Log the GlobPattern
switch v := watcher.GlobPattern.Value.(type) {
case string:
logging.Debug("GlobPattern", "pattern", v)
case protocol.RelativePattern:
logging.Debug("GlobPattern", "pattern", v.Pattern)
// Log BaseURI details
switch u := v.BaseURI.Value.(type) {
case string:
logging.Debug("BaseURI", "baseURI", u)
case protocol.DocumentUri:
logging.Debug("BaseURI", "baseURI", u)
default:
logging.Debug("BaseURI", "baseURI", u)
}
default:
logging.Debug("GlobPattern", "unknown type", fmt.Sprintf("%T", v))
}
// Log WatchKind
watchKind := protocol.WatchKind(protocol.WatchChange | protocol.WatchCreate | protocol.WatchDelete)
if watcher.Kind != nil {
watchKind = *watcher.Kind
}
logging.Debug("WatchKind", "kind", watchKind)
}
}
// Determine server type for specialized handling
serverName := getServerNameFromContext(ctx)
logging.Debug("Server type detected", "serverName", serverName)
// Check if this server has sent file watchers
hasFileWatchers := len(watchers) > 0
// For servers that need file preloading, we'll use a smart approach
if shouldPreloadFiles(serverName) || !hasFileWatchers {
go func() {
startTime := time.Now()
filesOpened := 0
// Determine max files to open based on server type
maxFilesToOpen := 50 // Default conservative limit
switch serverName {
case "typescript", "typescript-language-server", "tsserver", "vtsls":
// TypeScript servers benefit from seeing more files
maxFilesToOpen = 100
case "java", "jdtls":
// Java servers need to see many files for project model
maxFilesToOpen = 200
}
// First, open high-priority files
highPriorityFilesOpened := w.openHighPriorityFiles(ctx, serverName)
filesOpened += highPriorityFilesOpened
if cnf.DebugLSP {
logging.Debug("Opened high-priority files",
"count", highPriorityFilesOpened,
"serverName", serverName)
}
// If we've already opened enough high-priority files, we might not need more
if filesOpened >= maxFilesToOpen {
if cnf.DebugLSP {
logging.Debug("Reached file limit with high-priority files",
"filesOpened", filesOpened,
"maxFiles", maxFilesToOpen)
}
return
}
// For the remaining slots, walk the directory and open matching files
err := filepath.WalkDir(w.workspacePath, func(path string, d os.DirEntry, err error) error {
if err != nil {
return err
}
// Skip directories that should be excluded
if d.IsDir() {
if path != w.workspacePath && shouldExcludeDir(path) {
if cnf.DebugLSP {
logging.Debug("Skipping excluded directory", "path", path)
}
return filepath.SkipDir
}
} else {
// Process files, but limit the total number
if filesOpened < maxFilesToOpen {
// Only process if it's not already open (high-priority files were opened earlier)
if !w.client.IsFileOpen(path) {
w.openMatchingFile(ctx, path)
filesOpened++
// Add a small delay after every 10 files to prevent overwhelming the server
if filesOpened%10 == 0 {
time.Sleep(50 * time.Millisecond)
}
}
} else {
// We've reached our limit, stop walking
return filepath.SkipAll
}
}
return nil
})
elapsedTime := time.Since(startTime)
if cnf.DebugLSP {
logging.Debug("Limited workspace scan complete",
"filesOpened", filesOpened,
"maxFiles", maxFilesToOpen,
"elapsedTime", elapsedTime.Seconds(),
"workspacePath", w.workspacePath,
)
}
if err != nil && cnf.DebugLSP {
logging.Debug("Error scanning workspace for files to open", "error", err)
}
}()
} else if cnf.DebugLSP {
logging.Debug("Using on-demand file loading for server", "server", serverName)
}
}
// openHighPriorityFiles opens important files for the server type
// Returns the number of files opened
func (w *WorkspaceWatcher) openHighPriorityFiles(ctx context.Context, serverName string) int {
cnf := config.Get()
filesOpened := 0
// Define patterns for high-priority files based on server type
var patterns []string
switch serverName {
case "typescript", "typescript-language-server", "tsserver", "vtsls":
patterns = []string{
"**/tsconfig.json",
"**/package.json",
"**/jsconfig.json",
"**/index.ts",
"**/index.js",
"**/main.ts",
"**/main.js",
}
case "gopls":
patterns = []string{
"**/go.mod",
"**/go.sum",
"**/main.go",
}
case "rust-analyzer":
patterns = []string{
"**/Cargo.toml",
"**/Cargo.lock",
"**/src/lib.rs",
"**/src/main.rs",
}
case "python", "pyright", "pylsp":
patterns = []string{
"**/pyproject.toml",
"**/setup.py",
"**/requirements.txt",
"**/__init__.py",
"**/__main__.py",
}
case "clangd":
patterns = []string{
"**/CMakeLists.txt",
"**/Makefile",
"**/compile_commands.json",
}
case "java", "jdtls":
patterns = []string{
"**/pom.xml",
"**/build.gradle",
"**/src/main/java/**/*.java",
}
default:
// For unknown servers, use common configuration files
patterns = []string{
"**/package.json",
"**/Makefile",
"**/CMakeLists.txt",
"**/.editorconfig",
}
}
// For each pattern, find and open matching files
for _, pattern := range patterns {
// Use doublestar.Glob to find files matching the pattern (supports ** patterns)
matches, err := doublestar.Glob(os.DirFS(w.workspacePath), pattern)
if err != nil {
if cnf.DebugLSP {
logging.Debug("Error finding high-priority files", "pattern", pattern, "error", err)
}
continue
}
for _, match := range matches {
// Convert relative path to absolute
fullPath := filepath.Join(w.workspacePath, match)
// Skip directories and excluded files
info, err := os.Stat(fullPath)
if err != nil || info.IsDir() || shouldExcludeFile(fullPath) {
continue
}
// Open the file
if err := w.client.OpenFile(ctx, fullPath); err != nil {
if cnf.DebugLSP {
logging.Debug("Error opening high-priority file", "path", fullPath, "error", err)
}
} else {
filesOpened++
if cnf.DebugLSP {
logging.Debug("Opened high-priority file", "path", fullPath)
}
}
// Add a small delay to prevent overwhelming the server
time.Sleep(20 * time.Millisecond)
// Limit the number of files opened per pattern
if filesOpened >= 5 && (serverName != "java" && serverName != "jdtls") {
break
}
}
}
return filesOpened
}
// WatchWorkspace sets up file watching for a workspace
func (w *WorkspaceWatcher) WatchWorkspace(ctx context.Context, workspacePath string) {
cnf := config.Get()
w.workspacePath = workspacePath
// Store the watcher in the context for later use
ctx = context.WithValue(ctx, "workspaceWatcher", w)
// If the server name isn't already in the context, try to detect it
if _, ok := ctx.Value("serverName").(string); !ok {
serverName := getServerNameFromContext(ctx)
ctx = context.WithValue(ctx, "serverName", serverName)
}
serverName := getServerNameFromContext(ctx)
logging.Debug("Starting workspace watcher", "workspacePath", workspacePath, "serverName", serverName)
// Register handler for file watcher registrations from the server
lsp.RegisterFileWatchHandler(func(id string, watchers []protocol.FileSystemWatcher) {
w.AddRegistrations(ctx, id, watchers)
})
watcher, err := fsnotify.NewWatcher()
if err != nil {
logging.Error("Error creating watcher", "error", err)
}
defer watcher.Close()
// Watch the workspace recursively
err = filepath.WalkDir(workspacePath, func(path string, d os.DirEntry, err error) error {
if err != nil {
return err
}
// Skip excluded directories (except workspace root)
if d.IsDir() && path != workspacePath {
if shouldExcludeDir(path) {
if cnf.DebugLSP {
logging.Debug("Skipping excluded directory", "path", path)
}
return filepath.SkipDir
}
}
// Add directories to watcher
if d.IsDir() {
err = watcher.Add(path)
if err != nil {
logging.Error("Error watching path", "path", path, "error", err)
}
}
return nil
})
if err != nil {
logging.Error("Error walking workspace", "error", err)
}
// Event loop
for {
select {
case <-ctx.Done():
return
case event, ok := <-watcher.Events:
if !ok {
return
}
uri := fmt.Sprintf("file://%s", event.Name)
// Add new directories to the watcher
if event.Op&fsnotify.Create != 0 {
if info, err := os.Stat(event.Name); err == nil {
if info.IsDir() {
// Skip excluded directories
if !shouldExcludeDir(event.Name) {
if err := watcher.Add(event.Name); err != nil {
logging.Error("Error adding directory to watcher", "path", event.Name, "error", err)
}
}
} else {
// For newly created files
if !shouldExcludeFile(event.Name) {
w.openMatchingFile(ctx, event.Name)
}
}
}
}
// Debug logging
if cnf.DebugLSP {
matched, kind := w.isPathWatched(event.Name)
logging.Debug("File event",
"path", event.Name,
"operation", event.Op.String(),
"watched", matched,
"kind", kind,
)
}
// Check if this path should be watched according to server registrations
if watched, watchKind := w.isPathWatched(event.Name); watched {
switch {
case event.Op&fsnotify.Write != 0:
if watchKind&protocol.WatchChange != 0 {
w.debounceHandleFileEvent(ctx, uri, protocol.FileChangeType(protocol.Changed))
}
case event.Op&fsnotify.Create != 0:
// Already handled earlier in the event loop
// Just send the notification if needed
info, err := os.Stat(event.Name)
if err != nil {
logging.Error("Error getting file info", "path", event.Name, "error", err)
return
}
if !info.IsDir() && watchKind&protocol.WatchCreate != 0 {
w.debounceHandleFileEvent(ctx, uri, protocol.FileChangeType(protocol.Created))
}
case event.Op&fsnotify.Remove != 0:
if watchKind&protocol.WatchDelete != 0 {
w.handleFileEvent(ctx, uri, protocol.FileChangeType(protocol.Deleted))
}
case event.Op&fsnotify.Rename != 0:
// For renames, first delete
if watchKind&protocol.WatchDelete != 0 {
w.handleFileEvent(ctx, uri, protocol.FileChangeType(protocol.Deleted))
}
// Then check if the new file exists and create an event
if info, err := os.Stat(event.Name); err == nil && !info.IsDir() {
if watchKind&protocol.WatchCreate != 0 {
w.debounceHandleFileEvent(ctx, uri, protocol.FileChangeType(protocol.Created))
}
}
}
}
case err, ok := <-watcher.Errors:
if !ok {
return
}
logging.Error("Error watching file", "error", err)
}
}
}
// isPathWatched checks if a path should be watched based on server registrations
func (w *WorkspaceWatcher) isPathWatched(path string) (bool, protocol.WatchKind) {
w.registrationMu.RLock()
defer w.registrationMu.RUnlock()
// If no explicit registrations, watch everything
if len(w.registrations) == 0 {
return true, protocol.WatchKind(protocol.WatchChange | protocol.WatchCreate | protocol.WatchDelete)
}
// Check each registration
for _, reg := range w.registrations {
isMatch := w.matchesPattern(path, reg.GlobPattern)
if isMatch {
kind := protocol.WatchKind(protocol.WatchChange | protocol.WatchCreate | protocol.WatchDelete)
if reg.Kind != nil {
kind = *reg.Kind
}
return true, kind
}
}
return false, 0
}
// matchesGlob handles advanced glob patterns including ** and alternatives
func matchesGlob(pattern, path string) bool {
// Handle file extension patterns with braces like *.{go,mod,sum}
if strings.Contains(pattern, "{") && strings.Contains(pattern, "}") {
// Extract extensions from pattern like "*.{go,mod,sum}"
parts := strings.SplitN(pattern, "{", 2)
if len(parts) == 2 {
prefix := parts[0]
extPart := strings.SplitN(parts[1], "}", 2)
if len(extPart) == 2 {
extensions := strings.Split(extPart[0], ",")
suffix := extPart[1]
// Check if the path matches any of the extensions
for _, ext := range extensions {
extPattern := prefix + ext + suffix
isMatch := matchesSimpleGlob(extPattern, path)
if isMatch {
return true
}
}
return false
}
}
}
return matchesSimpleGlob(pattern, path)
}
// matchesSimpleGlob handles glob patterns with ** wildcards
func matchesSimpleGlob(pattern, path string) bool {
// Handle special case for **/*.ext pattern (common in LSP)
if strings.HasPrefix(pattern, "**/") {
rest := strings.TrimPrefix(pattern, "**/")
// If the rest is a simple file extension pattern like *.go
if strings.HasPrefix(rest, "*.") {
ext := strings.TrimPrefix(rest, "*")
isMatch := strings.HasSuffix(path, ext)
return isMatch
}
// Otherwise, try to check if the path ends with the rest part
isMatch := strings.HasSuffix(path, rest)
// If it matches directly, great!
if isMatch {
return true
}
// Otherwise, check if any path component matches
pathComponents := strings.Split(path, "/")
for i := range pathComponents {
subPath := strings.Join(pathComponents[i:], "/")
if strings.HasSuffix(subPath, rest) {
return true
}
}
return false
}
// Handle other ** wildcard pattern cases
if strings.Contains(pattern, "**") {
parts := strings.Split(pattern, "**")
// Validate the path starts with the first part
if !strings.HasPrefix(path, parts[0]) && parts[0] != "" {
return false
}
// For patterns like "**/*.go", just check the suffix
if len(parts) == 2 && parts[0] == "" {
isMatch := strings.HasSuffix(path, parts[1])
return isMatch
}
// For other patterns, handle middle part
remaining := strings.TrimPrefix(path, parts[0])
if len(parts) == 2 {
isMatch := strings.HasSuffix(remaining, parts[1])
return isMatch
}
}
// Handle simple * wildcard for file extension patterns (*.go, *.sum, etc)
if strings.HasPrefix(pattern, "*.") {
ext := strings.TrimPrefix(pattern, "*")
isMatch := strings.HasSuffix(path, ext)
return isMatch
}
// Fall back to simple matching for simpler patterns
matched, err := filepath.Match(pattern, path)
if err != nil {
logging.Error("Error matching pattern", "pattern", pattern, "path", path, "error", err)
return false
}
return matched
}
// matchesPattern checks if a path matches the glob pattern
func (w *WorkspaceWatcher) matchesPattern(path string, pattern protocol.GlobPattern) bool {
patternInfo, err := pattern.AsPattern()
if err != nil {
logging.Error("Error parsing pattern", "pattern", pattern, "error", err)
return false
}
basePath := patternInfo.GetBasePath()
patternText := patternInfo.GetPattern()
path = filepath.ToSlash(path)
// For simple patterns without base path
if basePath == "" {
// Check if the pattern matches the full path or just the file extension
fullPathMatch := matchesGlob(patternText, path)
baseNameMatch := matchesGlob(patternText, filepath.Base(path))
return fullPathMatch || baseNameMatch
}
// For relative patterns
basePath = strings.TrimPrefix(basePath, "file://")
basePath = filepath.ToSlash(basePath)
// Make path relative to basePath for matching
relPath, err := filepath.Rel(basePath, path)
if err != nil {
logging.Error("Error getting relative path", "path", path, "basePath", basePath, "error", err)
return false
}
relPath = filepath.ToSlash(relPath)
isMatch := matchesGlob(patternText, relPath)
return isMatch
}
// debounceHandleFileEvent handles file events with debouncing to reduce notifications
func (w *WorkspaceWatcher) debounceHandleFileEvent(ctx context.Context, uri string, changeType protocol.FileChangeType) {
w.debounceMu.Lock()
defer w.debounceMu.Unlock()
// Create a unique key based on URI and change type
key := fmt.Sprintf("%s:%d", uri, changeType)
// Cancel existing timer if any
if timer, exists := w.debounceMap[key]; exists {
timer.Stop()
}
// Create new timer
w.debounceMap[key] = time.AfterFunc(w.debounceTime, func() {
w.handleFileEvent(ctx, uri, changeType)
// Cleanup timer after execution
w.debounceMu.Lock()
delete(w.debounceMap, key)
w.debounceMu.Unlock()
})
}
// handleFileEvent sends file change notifications
func (w *WorkspaceWatcher) handleFileEvent(ctx context.Context, uri string, changeType protocol.FileChangeType) {
// If the file is open and it's a change event, use didChange notification
filePath := uri[7:] // Remove "file://" prefix
if changeType == protocol.FileChangeType(protocol.Changed) && w.client.IsFileOpen(filePath) {
err := w.client.NotifyChange(ctx, filePath)
if err != nil {
logging.Error("Error notifying change", "error", err)
}
return
}
// Notify LSP server about the file event using didChangeWatchedFiles
if err := w.notifyFileEvent(ctx, uri, changeType); err != nil {
logging.Error("Error notifying LSP server about file event", "error", err)
}
}
// notifyFileEvent sends a didChangeWatchedFiles notification for a file event
func (w *WorkspaceWatcher) notifyFileEvent(ctx context.Context, uri string, changeType protocol.FileChangeType) error {
cnf := config.Get()
if cnf.DebugLSP {
logging.Debug("Notifying file event",
"uri", uri,
"changeType", changeType,
)
}
params := protocol.DidChangeWatchedFilesParams{
Changes: []protocol.FileEvent{
{
URI: protocol.DocumentUri(uri),
Type: changeType,
},
},
}
return w.client.DidChangeWatchedFiles(ctx, params)
}
// getServerNameFromContext extracts the server name from the context
// This is a best-effort function that tries to identify which LSP server we're dealing with
func getServerNameFromContext(ctx context.Context) string {
// First check if the server name is directly stored in the context
if serverName, ok := ctx.Value("serverName").(string); ok && serverName != "" {
return strings.ToLower(serverName)
}
// Otherwise, try to extract server name from the client command path
if w, ok := ctx.Value("workspaceWatcher").(*WorkspaceWatcher); ok && w != nil && w.client != nil && w.client.Cmd != nil {
path := strings.ToLower(w.client.Cmd.Path)
// Extract server name from path
if strings.Contains(path, "typescript") || strings.Contains(path, "tsserver") || strings.Contains(path, "vtsls") {
return "typescript"
} else if strings.Contains(path, "gopls") {
return "gopls"
} else if strings.Contains(path, "rust-analyzer") {
return "rust-analyzer"
} else if strings.Contains(path, "pyright") || strings.Contains(path, "pylsp") || strings.Contains(path, "python") {
return "python"
} else if strings.Contains(path, "clangd") {
return "clangd"
} else if strings.Contains(path, "jdtls") || strings.Contains(path, "java") {
return "java"
}
// Return the base name as fallback
return filepath.Base(path)
}
return "unknown"
}
// shouldPreloadFiles determines if we should preload files for a specific language server
// Some servers work better with preloaded files, others don't need it
func shouldPreloadFiles(serverName string) bool {
// TypeScript/JavaScript servers typically need some files preloaded
// to properly resolve imports and provide intellisense
switch serverName {
case "typescript", "typescript-language-server", "tsserver", "vtsls":
return true
case "java", "jdtls":
// Java servers often need to see source files to build the project model
return true
default:
// For most servers, we'll use lazy loading by default
return false
}
}
// Common patterns for directories and files to exclude
// TODO: make configurable
var (
excludedDirNames = map[string]bool{
".git": true,
"node_modules": true,
"dist": true,
"build": true,
"out": true,
"bin": true,
".idea": true,
".vscode": true,
".cache": true,
"coverage": true,
"target": true, // Rust build output
"vendor": true, // Go vendor directory
}
excludedFileExtensions = map[string]bool{
".swp": true,
".swo": true,
".tmp": true,
".temp": true,
".bak": true,
".log": true,
".o": true, // Object files
".so": true, // Shared libraries
".dylib": true, // macOS shared libraries
".dll": true, // Windows shared libraries
".a": true, // Static libraries
".exe": true, // Windows executables
".lock": true, // Lock files
}
// Large binary files that shouldn't be opened
largeBinaryExtensions = map[string]bool{
".png": true,
".jpg": true,
".jpeg": true,
".gif": true,
".bmp": true,
".ico": true,
".zip": true,
".tar": true,
".gz": true,
".rar": true,
".7z": true,
".pdf": true,
".mp3": true,
".mp4": true,
".mov": true,
".wav": true,
".wasm": true,
}
// Maximum file size to open (5MB)
maxFileSize int64 = 5 * 1024 * 1024
)
// shouldExcludeDir returns true if the directory should be excluded from watching/opening
func shouldExcludeDir(dirPath string) bool {
dirName := filepath.Base(dirPath)
// Skip dot directories
if strings.HasPrefix(dirName, ".") {
return true
}
// Skip common excluded directories
if excludedDirNames[dirName] {
return true
}
return false
}
// shouldExcludeFile returns true if the file should be excluded from opening
func shouldExcludeFile(filePath string) bool {
fileName := filepath.Base(filePath)
cnf := config.Get()
// Skip dot files
if strings.HasPrefix(fileName, ".") {
return true
}
// Check file extension
ext := strings.ToLower(filepath.Ext(filePath))
if excludedFileExtensions[ext] || largeBinaryExtensions[ext] {
return true
}
// Skip temporary files
if strings.HasSuffix(filePath, "~") {
return true
}
// Check file size
info, err := os.Stat(filePath)
if err != nil {
// If we can't stat the file, skip it
return true
}
// Skip large files
if info.Size() > maxFileSize {
if cnf.DebugLSP {
logging.Debug("Skipping large file",
"path", filePath,
"size", info.Size(),
"maxSize", maxFileSize,
"debug", cnf.Debug,
"sizeMB", float64(info.Size())/(1024*1024),
"maxSizeMB", float64(maxFileSize)/(1024*1024),
)
}
return true
}
return false
}
// openMatchingFile opens a file if it matches any of the registered patterns
func (w *WorkspaceWatcher) openMatchingFile(ctx context.Context, path string) {
cnf := config.Get()
// Skip directories
info, err := os.Stat(path)
if err != nil || info.IsDir() {
return
}
// Skip excluded files
if shouldExcludeFile(path) {
return
}
// Check if this path should be watched according to server registrations
if watched, _ := w.isPathWatched(path); watched {
// Get server name for specialized handling
serverName := getServerNameFromContext(ctx)
// Check if the file is a high-priority file that should be opened immediately
// This helps with project initialization for certain language servers
if isHighPriorityFile(path, serverName) {
if cnf.DebugLSP {
logging.Debug("Opening high-priority file", "path", path, "serverName", serverName)
}
if err := w.client.OpenFile(ctx, path); err != nil && cnf.DebugLSP {
logging.Error("Error opening high-priority file", "path", path, "error", err)
}
return
}
// For non-high-priority files, we'll use different strategies based on server type
if shouldPreloadFiles(serverName) {
// For servers that benefit from preloading, open files but with limits
// Check file size - for preloading we're more conservative
if info.Size() > (1 * 1024 * 1024) { // 1MB limit for preloaded files
if cnf.DebugLSP {
logging.Debug("Skipping large file for preloading", "path", path, "size", info.Size())
}
return
}
// Check file extension for common source files
ext := strings.ToLower(filepath.Ext(path))
// Only preload source files for the specific language
shouldOpen := false
switch serverName {
case "typescript", "typescript-language-server", "tsserver", "vtsls":
shouldOpen = ext == ".ts" || ext == ".js" || ext == ".tsx" || ext == ".jsx"
case "gopls":
shouldOpen = ext == ".go"
case "rust-analyzer":
shouldOpen = ext == ".rs"
case "python", "pyright", "pylsp":
shouldOpen = ext == ".py"
case "clangd":
shouldOpen = ext == ".c" || ext == ".cpp" || ext == ".h" || ext == ".hpp"
case "java", "jdtls":
shouldOpen = ext == ".java"
default:
// For unknown servers, be conservative
shouldOpen = false
}
if shouldOpen {
// Don't need to check if it's already open - the client.OpenFile handles that
if err := w.client.OpenFile(ctx, path); err != nil && cnf.DebugLSP {
logging.Error("Error opening file", "path", path, "error", err)
}
}
}
}
}
// isHighPriorityFile determines if a file should be opened immediately
// regardless of the preloading strategy
func isHighPriorityFile(path string, serverName string) bool {
fileName := filepath.Base(path)
ext := filepath.Ext(path)
switch serverName {
case "typescript", "typescript-language-server", "tsserver", "vtsls":
// For TypeScript, we want to open configuration files immediately
return fileName == "tsconfig.json" ||
fileName == "package.json" ||
fileName == "jsconfig.json" ||
// Also open main entry points
fileName == "index.ts" ||
fileName == "index.js" ||
fileName == "main.ts" ||
fileName == "main.js"
case "gopls":
// For Go, we want to open go.mod files immediately
return fileName == "go.mod" ||
fileName == "go.sum" ||
// Also open main.go files
fileName == "main.go"
case "rust-analyzer":
// For Rust, we want to open Cargo.toml files immediately
return fileName == "Cargo.toml" ||
fileName == "Cargo.lock" ||
// Also open lib.rs and main.rs
fileName == "lib.rs" ||
fileName == "main.rs"
case "python", "pyright", "pylsp":
// For Python, open key project files
return fileName == "pyproject.toml" ||
fileName == "setup.py" ||
fileName == "requirements.txt" ||
fileName == "__init__.py" ||
fileName == "__main__.py"
case "clangd":
// For C/C++, open key project files
return fileName == "CMakeLists.txt" ||
fileName == "Makefile" ||
fileName == "compile_commands.json"
case "java", "jdtls":
// For Java, open key project files
return fileName == "pom.xml" ||
fileName == "build.gradle" ||
ext == ".java" // Java servers often need to see source files
}
// For unknown servers, prioritize common configuration files
return fileName == "package.json" ||
fileName == "Makefile" ||
fileName == "CMakeLists.txt" ||
fileName == ".editorconfig"
}
+324
View File
@@ -0,0 +1,324 @@
package message
import (
"encoding/base64"
"slices"
"time"
"github.com/kujtimiihoxha/opencode/internal/llm/models"
)
type MessageRole string
const (
Assistant MessageRole = "assistant"
User MessageRole = "user"
System MessageRole = "system"
Tool MessageRole = "tool"
)
type FinishReason string
const (
FinishReasonEndTurn FinishReason = "end_turn"
FinishReasonMaxTokens FinishReason = "max_tokens"
FinishReasonToolUse FinishReason = "tool_use"
FinishReasonCanceled FinishReason = "canceled"
FinishReasonError FinishReason = "error"
FinishReasonPermissionDenied FinishReason = "permission_denied"
// Should never happen
FinishReasonUnknown FinishReason = "unknown"
)
type ContentPart interface {
isPart()
}
type ReasoningContent struct {
Thinking string `json:"thinking"`
}
func (tc ReasoningContent) String() string {
return tc.Thinking
}
func (ReasoningContent) isPart() {}
type TextContent struct {
Text string `json:"text"`
}
func (tc TextContent) String() string {
return tc.Text
}
func (TextContent) isPart() {}
type ImageURLContent struct {
URL string `json:"url"`
Detail string `json:"detail,omitempty"`
}
func (iuc ImageURLContent) String() string {
return iuc.URL
}
func (ImageURLContent) isPart() {}
type BinaryContent struct {
MIMEType string
Data []byte
}
func (bc BinaryContent) String() string {
base64Encoded := base64.StdEncoding.EncodeToString(bc.Data)
return "data:" + bc.MIMEType + ";base64," + base64Encoded
}
func (BinaryContent) isPart() {}
type ToolCall struct {
ID string `json:"id"`
Name string `json:"name"`
Input string `json:"input"`
Type string `json:"type"`
Finished bool `json:"finished"`
}
func (ToolCall) isPart() {}
type ToolResult struct {
ToolCallID string `json:"tool_call_id"`
Name string `json:"name"`
Content string `json:"content"`
Metadata string `json:"metadata"`
IsError bool `json:"is_error"`
}
func (ToolResult) isPart() {}
type Finish struct {
Reason FinishReason `json:"reason"`
Time int64 `json:"time"`
}
func (Finish) isPart() {}
type Message struct {
ID string
Role MessageRole
SessionID string
Parts []ContentPart
Model models.ModelID
CreatedAt int64
UpdatedAt int64
}
func (m *Message) Content() TextContent {
for _, part := range m.Parts {
if c, ok := part.(TextContent); ok {
return c
}
}
return TextContent{}
}
func (m *Message) ReasoningContent() ReasoningContent {
for _, part := range m.Parts {
if c, ok := part.(ReasoningContent); ok {
return c
}
}
return ReasoningContent{}
}
func (m *Message) ImageURLContent() []ImageURLContent {
imageURLContents := make([]ImageURLContent, 0)
for _, part := range m.Parts {
if c, ok := part.(ImageURLContent); ok {
imageURLContents = append(imageURLContents, c)
}
}
return imageURLContents
}
func (m *Message) BinaryContent() []BinaryContent {
binaryContents := make([]BinaryContent, 0)
for _, part := range m.Parts {
if c, ok := part.(BinaryContent); ok {
binaryContents = append(binaryContents, c)
}
}
return binaryContents
}
func (m *Message) ToolCalls() []ToolCall {
toolCalls := make([]ToolCall, 0)
for _, part := range m.Parts {
if c, ok := part.(ToolCall); ok {
toolCalls = append(toolCalls, c)
}
}
return toolCalls
}
func (m *Message) ToolResults() []ToolResult {
toolResults := make([]ToolResult, 0)
for _, part := range m.Parts {
if c, ok := part.(ToolResult); ok {
toolResults = append(toolResults, c)
}
}
return toolResults
}
func (m *Message) IsFinished() bool {
for _, part := range m.Parts {
if _, ok := part.(Finish); ok {
return true
}
}
return false
}
func (m *Message) FinishPart() *Finish {
for _, part := range m.Parts {
if c, ok := part.(Finish); ok {
return &c
}
}
return nil
}
func (m *Message) FinishReason() FinishReason {
for _, part := range m.Parts {
if c, ok := part.(Finish); ok {
return c.Reason
}
}
return ""
}
func (m *Message) IsThinking() bool {
if m.ReasoningContent().Thinking != "" && m.Content().Text == "" && !m.IsFinished() {
return true
}
return false
}
func (m *Message) AppendContent(delta string) {
found := false
for i, part := range m.Parts {
if c, ok := part.(TextContent); ok {
m.Parts[i] = TextContent{Text: c.Text + delta}
found = true
}
}
if !found {
m.Parts = append(m.Parts, TextContent{Text: delta})
}
}
func (m *Message) AppendReasoningContent(delta string) {
found := false
for i, part := range m.Parts {
if c, ok := part.(ReasoningContent); ok {
m.Parts[i] = ReasoningContent{Thinking: c.Thinking + delta}
found = true
}
}
if !found {
m.Parts = append(m.Parts, ReasoningContent{Thinking: delta})
}
}
func (m *Message) FinishToolCall(toolCallID string) {
for i, part := range m.Parts {
if c, ok := part.(ToolCall); ok {
if c.ID == toolCallID {
m.Parts[i] = ToolCall{
ID: c.ID,
Name: c.Name,
Input: c.Input,
Type: c.Type,
Finished: true,
}
return
}
}
}
}
func (m *Message) AppendToolCallInput(toolCallID string, inputDelta string) {
for i, part := range m.Parts {
if c, ok := part.(ToolCall); ok {
if c.ID == toolCallID {
m.Parts[i] = ToolCall{
ID: c.ID,
Name: c.Name,
Input: c.Input + inputDelta,
Type: c.Type,
Finished: c.Finished,
}
return
}
}
}
}
func (m *Message) AddToolCall(tc ToolCall) {
for i, part := range m.Parts {
if c, ok := part.(ToolCall); ok {
if c.ID == tc.ID {
m.Parts[i] = tc
return
}
}
}
m.Parts = append(m.Parts, tc)
}
func (m *Message) SetToolCalls(tc []ToolCall) {
// remove any existing tool call part it could have multiple
parts := make([]ContentPart, 0)
for _, part := range m.Parts {
if _, ok := part.(ToolCall); ok {
continue
}
parts = append(parts, part)
}
m.Parts = parts
for _, toolCall := range tc {
m.Parts = append(m.Parts, toolCall)
}
}
func (m *Message) AddToolResult(tr ToolResult) {
m.Parts = append(m.Parts, tr)
}
func (m *Message) SetToolResults(tr []ToolResult) {
for _, toolResult := range tr {
m.Parts = append(m.Parts, toolResult)
}
}
func (m *Message) AddFinish(reason FinishReason) {
// remove any existing finish part
for i, part := range m.Parts {
if _, ok := part.(Finish); ok {
m.Parts = slices.Delete(m.Parts, i, i+1)
break
}
}
m.Parts = append(m.Parts, Finish{Reason: reason, Time: time.Now().Unix()})
}
func (m *Message) AddImageURL(url, detail string) {
m.Parts = append(m.Parts, ImageURLContent{URL: url, Detail: detail})
}
func (m *Message) AddBinary(mimeType string, data []byte) {
m.Parts = append(m.Parts, BinaryContent{MIMEType: mimeType, Data: data})
}
+282
View File
@@ -0,0 +1,282 @@
package message
import (
"context"
"database/sql"
"encoding/json"
"fmt"
"time"
"github.com/google/uuid"
"github.com/kujtimiihoxha/opencode/internal/db"
"github.com/kujtimiihoxha/opencode/internal/llm/models"
"github.com/kujtimiihoxha/opencode/internal/pubsub"
)
type CreateMessageParams struct {
Role MessageRole
Parts []ContentPart
Model models.ModelID
}
type Service interface {
pubsub.Suscriber[Message]
Create(ctx context.Context, sessionID string, params CreateMessageParams) (Message, error)
Update(ctx context.Context, message Message) error
Get(ctx context.Context, id string) (Message, error)
List(ctx context.Context, sessionID string) ([]Message, error)
Delete(ctx context.Context, id string) error
DeleteSessionMessages(ctx context.Context, sessionID string) error
}
type service struct {
*pubsub.Broker[Message]
q db.Querier
}
func NewService(q db.Querier) Service {
return &service{
Broker: pubsub.NewBroker[Message](),
q: q,
}
}
func (s *service) Delete(ctx context.Context, id string) error {
message, err := s.Get(ctx, id)
if err != nil {
return err
}
err = s.q.DeleteMessage(ctx, message.ID)
if err != nil {
return err
}
s.Publish(pubsub.DeletedEvent, message)
return nil
}
func (s *service) Create(ctx context.Context, sessionID string, params CreateMessageParams) (Message, error) {
if params.Role != Assistant {
params.Parts = append(params.Parts, Finish{
Reason: "stop",
})
}
partsJSON, err := marshallParts(params.Parts)
if err != nil {
return Message{}, err
}
dbMessage, err := s.q.CreateMessage(ctx, db.CreateMessageParams{
ID: uuid.New().String(),
SessionID: sessionID,
Role: string(params.Role),
Parts: string(partsJSON),
Model: sql.NullString{String: string(params.Model), Valid: true},
})
if err != nil {
return Message{}, err
}
message, err := s.fromDBItem(dbMessage)
if err != nil {
return Message{}, err
}
s.Publish(pubsub.CreatedEvent, message)
return message, nil
}
func (s *service) DeleteSessionMessages(ctx context.Context, sessionID string) error {
messages, err := s.List(ctx, sessionID)
if err != nil {
return err
}
for _, message := range messages {
if message.SessionID == sessionID {
err = s.Delete(ctx, message.ID)
if err != nil {
return err
}
}
}
return nil
}
func (s *service) Update(ctx context.Context, message Message) error {
parts, err := marshallParts(message.Parts)
if err != nil {
return err
}
finishedAt := sql.NullInt64{}
if f := message.FinishPart(); f != nil {
finishedAt.Int64 = f.Time
finishedAt.Valid = true
}
err = s.q.UpdateMessage(ctx, db.UpdateMessageParams{
ID: message.ID,
Parts: string(parts),
FinishedAt: finishedAt,
})
if err != nil {
return err
}
message.UpdatedAt = time.Now().Unix()
s.Publish(pubsub.UpdatedEvent, message)
return nil
}
func (s *service) Get(ctx context.Context, id string) (Message, error) {
dbMessage, err := s.q.GetMessage(ctx, id)
if err != nil {
return Message{}, err
}
return s.fromDBItem(dbMessage)
}
func (s *service) List(ctx context.Context, sessionID string) ([]Message, error) {
dbMessages, err := s.q.ListMessagesBySession(ctx, sessionID)
if err != nil {
return nil, err
}
messages := make([]Message, len(dbMessages))
for i, dbMessage := range dbMessages {
messages[i], err = s.fromDBItem(dbMessage)
if err != nil {
return nil, err
}
}
return messages, nil
}
func (s *service) fromDBItem(item db.Message) (Message, error) {
parts, err := unmarshallParts([]byte(item.Parts))
if err != nil {
return Message{}, err
}
return Message{
ID: item.ID,
SessionID: item.SessionID,
Role: MessageRole(item.Role),
Parts: parts,
Model: models.ModelID(item.Model.String),
CreatedAt: item.CreatedAt,
UpdatedAt: item.UpdatedAt,
}, nil
}
type partType string
const (
reasoningType partType = "reasoning"
textType partType = "text"
imageURLType partType = "image_url"
binaryType partType = "binary"
toolCallType partType = "tool_call"
toolResultType partType = "tool_result"
finishType partType = "finish"
)
type partWrapper struct {
Type partType `json:"type"`
Data ContentPart `json:"data"`
}
func marshallParts(parts []ContentPart) ([]byte, error) {
wrappedParts := make([]partWrapper, len(parts))
for i, part := range parts {
var typ partType
switch part.(type) {
case ReasoningContent:
typ = reasoningType
case TextContent:
typ = textType
case ImageURLContent:
typ = imageURLType
case BinaryContent:
typ = binaryType
case ToolCall:
typ = toolCallType
case ToolResult:
typ = toolResultType
case Finish:
typ = finishType
default:
return nil, fmt.Errorf("unknown part type: %T", part)
}
wrappedParts[i] = partWrapper{
Type: typ,
Data: part,
}
}
return json.Marshal(wrappedParts)
}
func unmarshallParts(data []byte) ([]ContentPart, error) {
temp := []json.RawMessage{}
if err := json.Unmarshal(data, &temp); err != nil {
return nil, err
}
parts := make([]ContentPart, 0)
for _, rawPart := range temp {
var wrapper struct {
Type partType `json:"type"`
Data json.RawMessage `json:"data"`
}
if err := json.Unmarshal(rawPart, &wrapper); err != nil {
return nil, err
}
switch wrapper.Type {
case reasoningType:
part := ReasoningContent{}
if err := json.Unmarshal(wrapper.Data, &part); err != nil {
return nil, err
}
parts = append(parts, part)
case textType:
part := TextContent{}
if err := json.Unmarshal(wrapper.Data, &part); err != nil {
return nil, err
}
parts = append(parts, part)
case imageURLType:
part := ImageURLContent{}
if err := json.Unmarshal(wrapper.Data, &part); err != nil {
return nil, err
}
case binaryType:
part := BinaryContent{}
if err := json.Unmarshal(wrapper.Data, &part); err != nil {
return nil, err
}
parts = append(parts, part)
case toolCallType:
part := ToolCall{}
if err := json.Unmarshal(wrapper.Data, &part); err != nil {
return nil, err
}
parts = append(parts, part)
case toolResultType:
part := ToolResult{}
if err := json.Unmarshal(wrapper.Data, &part); err != nil {
return nil, err
}
parts = append(parts, part)
case finishType:
part := Finish{}
if err := json.Unmarshal(wrapper.Data, &part); err != nil {
return nil, err
}
parts = append(parts, part)
default:
return nil, fmt.Errorf("unknown part type: %s", wrapper.Type)
}
}
return parts, nil
}
+124
View File
@@ -0,0 +1,124 @@
package permission
import (
"errors"
"path/filepath"
"slices"
"sync"
"time"
"github.com/google/uuid"
"github.com/kujtimiihoxha/opencode/internal/config"
"github.com/kujtimiihoxha/opencode/internal/pubsub"
)
var ErrorPermissionDenied = errors.New("permission denied")
type CreatePermissionRequest struct {
SessionID string `json:"session_id"`
ToolName string `json:"tool_name"`
Description string `json:"description"`
Action string `json:"action"`
Params any `json:"params"`
Path string `json:"path"`
}
type PermissionRequest struct {
ID string `json:"id"`
SessionID string `json:"session_id"`
ToolName string `json:"tool_name"`
Description string `json:"description"`
Action string `json:"action"`
Params any `json:"params"`
Path string `json:"path"`
}
type Service interface {
pubsub.Suscriber[PermissionRequest]
GrantPersistant(permission PermissionRequest)
Grant(permission PermissionRequest)
Deny(permission PermissionRequest)
Request(opts CreatePermissionRequest) bool
AutoApproveSession(sessionID string)
}
type permissionService struct {
*pubsub.Broker[PermissionRequest]
sessionPermissions []PermissionRequest
pendingRequests sync.Map
autoApproveSessions []string
}
func (s *permissionService) GrantPersistant(permission PermissionRequest) {
respCh, ok := s.pendingRequests.Load(permission.ID)
if ok {
respCh.(chan bool) <- true
}
s.sessionPermissions = append(s.sessionPermissions, permission)
}
func (s *permissionService) Grant(permission PermissionRequest) {
respCh, ok := s.pendingRequests.Load(permission.ID)
if ok {
respCh.(chan bool) <- true
}
}
func (s *permissionService) Deny(permission PermissionRequest) {
respCh, ok := s.pendingRequests.Load(permission.ID)
if ok {
respCh.(chan bool) <- false
}
}
func (s *permissionService) Request(opts CreatePermissionRequest) bool {
if slices.Contains(s.autoApproveSessions, opts.SessionID) {
return true
}
dir := filepath.Dir(opts.Path)
if dir == "." {
dir = config.WorkingDirectory()
}
permission := PermissionRequest{
ID: uuid.New().String(),
Path: dir,
SessionID: opts.SessionID,
ToolName: opts.ToolName,
Description: opts.Description,
Action: opts.Action,
Params: opts.Params,
}
for _, p := range s.sessionPermissions {
if p.ToolName == permission.ToolName && p.Action == permission.Action && p.SessionID == permission.SessionID && p.Path == permission.Path {
return true
}
}
respCh := make(chan bool, 1)
s.pendingRequests.Store(permission.ID, respCh)
defer s.pendingRequests.Delete(permission.ID)
s.Publish(pubsub.CreatedEvent, permission)
// Wait for the response with a timeout
select {
case resp := <-respCh:
return resp
case <-time.After(10 * time.Minute):
return false
}
}
func (s *permissionService) AutoApproveSession(sessionID string) {
s.autoApproveSessions = append(s.autoApproveSessions, sessionID)
}
func NewPermissionService() Service {
return &permissionService{
Broker: pubsub.NewBroker[PermissionRequest](),
sessionPermissions: make([]PermissionRequest, 0),
}
}
+116
View File
@@ -0,0 +1,116 @@
package pubsub
import (
"context"
"sync"
)
const bufferSize = 64
type Broker[T any] struct {
subs map[chan Event[T]]struct{}
mu sync.RWMutex
done chan struct{}
subCount int
maxEvents int
}
func NewBroker[T any]() *Broker[T] {
return NewBrokerWithOptions[T](bufferSize, 1000)
}
func NewBrokerWithOptions[T any](channelBufferSize, maxEvents int) *Broker[T] {
b := &Broker[T]{
subs: make(map[chan Event[T]]struct{}),
done: make(chan struct{}),
subCount: 0,
maxEvents: maxEvents,
}
return b
}
func (b *Broker[T]) Shutdown() {
select {
case <-b.done: // Already closed
return
default:
close(b.done)
}
b.mu.Lock()
defer b.mu.Unlock()
for ch := range b.subs {
delete(b.subs, ch)
close(ch)
}
b.subCount = 0
}
func (b *Broker[T]) Subscribe(ctx context.Context) <-chan Event[T] {
b.mu.Lock()
defer b.mu.Unlock()
select {
case <-b.done:
ch := make(chan Event[T])
close(ch)
return ch
default:
}
sub := make(chan Event[T], bufferSize)
b.subs[sub] = struct{}{}
b.subCount++
go func() {
<-ctx.Done()
b.mu.Lock()
defer b.mu.Unlock()
select {
case <-b.done:
return
default:
}
delete(b.subs, sub)
close(sub)
b.subCount--
}()
return sub
}
func (b *Broker[T]) GetSubscriberCount() int {
b.mu.RLock()
defer b.mu.RUnlock()
return b.subCount
}
func (b *Broker[T]) Publish(t EventType, payload T) {
b.mu.RLock()
select {
case <-b.done:
b.mu.RUnlock()
return
default:
}
subscribers := make([]chan Event[T], 0, len(b.subs))
for sub := range b.subs {
subscribers = append(subscribers, sub)
}
b.mu.RUnlock()
event := Event[T]{Type: t, Payload: payload}
for _, sub := range subscribers {
select {
case sub <- event:
default:
}
}
}
+28
View File
@@ -0,0 +1,28 @@
package pubsub
import "context"
const (
CreatedEvent EventType = "created"
UpdatedEvent EventType = "updated"
DeletedEvent EventType = "deleted"
)
type Suscriber[T any] interface {
Subscribe(context.Context) <-chan Event[T]
}
type (
// EventType identifies the type of event
EventType string
// Event represents an event in the lifecycle of a resource
Event[T any] struct {
Type EventType
Payload T
}
Publisher[T any] interface {
Publish(EventType, T)
}
)
+150
View File
@@ -0,0 +1,150 @@
package session
import (
"context"
"database/sql"
"github.com/google/uuid"
"github.com/kujtimiihoxha/opencode/internal/db"
"github.com/kujtimiihoxha/opencode/internal/pubsub"
)
type Session struct {
ID string
ParentSessionID string
Title string
MessageCount int64
PromptTokens int64
CompletionTokens int64
Cost float64
CreatedAt int64
UpdatedAt int64
}
type Service interface {
pubsub.Suscriber[Session]
Create(ctx context.Context, title string) (Session, error)
CreateTitleSession(ctx context.Context, parentSessionID string) (Session, error)
CreateTaskSession(ctx context.Context, toolCallID, parentSessionID, title string) (Session, error)
Get(ctx context.Context, id string) (Session, error)
List(ctx context.Context) ([]Session, error)
Save(ctx context.Context, session Session) (Session, error)
Delete(ctx context.Context, id string) error
}
type service struct {
*pubsub.Broker[Session]
q db.Querier
}
func (s *service) Create(ctx context.Context, title string) (Session, error) {
dbSession, err := s.q.CreateSession(ctx, db.CreateSessionParams{
ID: uuid.New().String(),
Title: title,
})
if err != nil {
return Session{}, err
}
session := s.fromDBItem(dbSession)
s.Publish(pubsub.CreatedEvent, session)
return session, nil
}
func (s *service) CreateTaskSession(ctx context.Context, toolCallID, parentSessionID, title string) (Session, error) {
dbSession, err := s.q.CreateSession(ctx, db.CreateSessionParams{
ID: toolCallID,
ParentSessionID: sql.NullString{String: parentSessionID, Valid: true},
Title: title,
})
if err != nil {
return Session{}, err
}
session := s.fromDBItem(dbSession)
s.Publish(pubsub.CreatedEvent, session)
return session, nil
}
func (s *service) CreateTitleSession(ctx context.Context, parentSessionID string) (Session, error) {
dbSession, err := s.q.CreateSession(ctx, db.CreateSessionParams{
ID: "title-" + parentSessionID,
ParentSessionID: sql.NullString{String: parentSessionID, Valid: true},
Title: "Generate a title",
})
if err != nil {
return Session{}, err
}
session := s.fromDBItem(dbSession)
s.Publish(pubsub.CreatedEvent, session)
return session, nil
}
func (s *service) Delete(ctx context.Context, id string) error {
session, err := s.Get(ctx, id)
if err != nil {
return err
}
err = s.q.DeleteSession(ctx, session.ID)
if err != nil {
return err
}
s.Publish(pubsub.DeletedEvent, session)
return nil
}
func (s *service) Get(ctx context.Context, id string) (Session, error) {
dbSession, err := s.q.GetSessionByID(ctx, id)
if err != nil {
return Session{}, err
}
return s.fromDBItem(dbSession), nil
}
func (s *service) Save(ctx context.Context, session Session) (Session, error) {
dbSession, err := s.q.UpdateSession(ctx, db.UpdateSessionParams{
ID: session.ID,
Title: session.Title,
PromptTokens: session.PromptTokens,
CompletionTokens: session.CompletionTokens,
Cost: session.Cost,
})
if err != nil {
return Session{}, err
}
session = s.fromDBItem(dbSession)
s.Publish(pubsub.UpdatedEvent, session)
return session, nil
}
func (s *service) List(ctx context.Context) ([]Session, error) {
dbSessions, err := s.q.ListSessions(ctx)
if err != nil {
return nil, err
}
sessions := make([]Session, len(dbSessions))
for i, dbSession := range dbSessions {
sessions[i] = s.fromDBItem(dbSession)
}
return sessions, nil
}
func (s service) fromDBItem(item db.Session) Session {
return Session{
ID: item.ID,
ParentSessionID: item.ParentSessionID.String,
Title: item.Title,
MessageCount: item.MessageCount,
PromptTokens: item.PromptTokens,
CompletionTokens: item.CompletionTokens,
Cost: item.Cost,
CreatedAt: item.CreatedAt,
UpdatedAt: item.UpdatedAt,
}
}
func NewService(q db.Querier) Service {
broker := pubsub.NewBroker[Session]()
return &service{
broker,
q,
}
}
+119
View File
@@ -0,0 +1,119 @@
package chat
import (
"fmt"
"sort"
"github.com/charmbracelet/lipgloss"
"github.com/charmbracelet/x/ansi"
"github.com/kujtimiihoxha/opencode/internal/config"
"github.com/kujtimiihoxha/opencode/internal/session"
"github.com/kujtimiihoxha/opencode/internal/tui/styles"
"github.com/kujtimiihoxha/opencode/internal/version"
)
type SendMsg struct {
Text string
}
type SessionSelectedMsg = session.Session
type SessionClearedMsg struct{}
type EditorFocusMsg bool
func lspsConfigured(width int) string {
cfg := config.Get()
title := "LSP Configuration"
title = ansi.Truncate(title, width, "…")
lsps := styles.BaseStyle.Width(width).Foreground(styles.PrimaryColor).Bold(true).Render(title)
// Get LSP names and sort them for consistent ordering
var lspNames []string
for name := range cfg.LSP {
lspNames = append(lspNames, name)
}
sort.Strings(lspNames)
var lspViews []string
for _, name := range lspNames {
lsp := cfg.LSP[name]
lspName := styles.BaseStyle.Foreground(styles.Forground).Render(
fmt.Sprintf("• %s", name),
)
cmd := lsp.Command
cmd = ansi.Truncate(cmd, width-lipgloss.Width(lspName)-3, "…")
lspPath := styles.BaseStyle.Foreground(styles.ForgroundDim).Render(
fmt.Sprintf(" (%s)", cmd),
)
lspViews = append(lspViews,
styles.BaseStyle.
Width(width).
Render(
lipgloss.JoinHorizontal(
lipgloss.Left,
lspName,
lspPath,
),
),
)
}
return styles.BaseStyle.
Width(width).
Render(
lipgloss.JoinVertical(
lipgloss.Left,
lsps,
lipgloss.JoinVertical(
lipgloss.Left,
lspViews...,
),
),
)
}
func logo(width int) string {
logo := fmt.Sprintf("%s %s", styles.OpenCodeIcon, "OpenCode")
version := styles.BaseStyle.Foreground(styles.ForgroundDim).Render(version.Version)
return styles.BaseStyle.
Bold(true).
Width(width).
Render(
lipgloss.JoinHorizontal(
lipgloss.Left,
logo,
" ",
version,
),
)
}
func repo(width int) string {
repo := "https://github.com/kujtimiihoxha/opencode"
return styles.BaseStyle.
Foreground(styles.ForgroundDim).
Width(width).
Render(repo)
}
func cwd(width int) string {
cwd := fmt.Sprintf("cwd: %s", config.WorkingDirectory())
return styles.BaseStyle.
Foreground(styles.ForgroundDim).
Width(width).
Render(cwd)
}
func header(width int) string {
header := lipgloss.JoinVertical(
lipgloss.Top,
logo(width),
repo(width),
"",
cwd(width),
)
return header
}
+177
View File
@@ -0,0 +1,177 @@
package chat
import (
"os"
"os/exec"
"github.com/charmbracelet/bubbles/key"
"github.com/charmbracelet/bubbles/textarea"
tea "github.com/charmbracelet/bubbletea"
"github.com/charmbracelet/lipgloss"
"github.com/kujtimiihoxha/opencode/internal/app"
"github.com/kujtimiihoxha/opencode/internal/session"
"github.com/kujtimiihoxha/opencode/internal/tui/layout"
"github.com/kujtimiihoxha/opencode/internal/tui/styles"
"github.com/kujtimiihoxha/opencode/internal/tui/util"
)
type editorCmp struct {
app *app.App
session session.Session
textarea textarea.Model
}
type EditorKeyMaps struct {
Send key.Binding
OpenEditor key.Binding
}
type bluredEditorKeyMaps struct {
Send key.Binding
Focus key.Binding
OpenEditor key.Binding
}
var editorMaps = EditorKeyMaps{
Send: key.NewBinding(
key.WithKeys("enter", "ctrl+s"),
key.WithHelp("enter", "send message"),
),
OpenEditor: key.NewBinding(
key.WithKeys("ctrl+e"),
key.WithHelp("ctrl+e", "open editor"),
),
}
func openEditor() tea.Cmd {
editor := os.Getenv("EDITOR")
if editor == "" {
editor = "nvim"
}
tmpfile, err := os.CreateTemp("", "msg_*.md")
if err != nil {
return util.ReportError(err)
}
tmpfile.Close()
c := exec.Command(editor, tmpfile.Name()) //nolint:gosec
c.Stdin = os.Stdin
c.Stdout = os.Stdout
c.Stderr = os.Stderr
return tea.ExecProcess(c, func(err error) tea.Msg {
if err != nil {
return util.ReportError(err)
}
content, err := os.ReadFile(tmpfile.Name())
if err != nil {
return util.ReportError(err)
}
if len(content) == 0 {
return util.ReportWarn("Message is empty")
}
os.Remove(tmpfile.Name())
return SendMsg{
Text: string(content),
}
})
}
func (m *editorCmp) Init() tea.Cmd {
return textarea.Blink
}
func (m *editorCmp) send() tea.Cmd {
if m.app.CoderAgent.IsSessionBusy(m.session.ID) {
return util.ReportWarn("Agent is working, please wait...")
}
value := m.textarea.Value()
m.textarea.Reset()
if value == "" {
return nil
}
return tea.Batch(
util.CmdHandler(SendMsg{
Text: value,
}),
)
}
func (m *editorCmp) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
var cmd tea.Cmd
switch msg := msg.(type) {
case SessionSelectedMsg:
if msg.ID != m.session.ID {
m.session = msg
}
return m, nil
case tea.KeyMsg:
if key.Matches(msg, messageKeys.PageUp) || key.Matches(msg, messageKeys.PageDown) ||
key.Matches(msg, messageKeys.HalfPageUp) || key.Matches(msg, messageKeys.HalfPageDown) {
return m, nil
}
if key.Matches(msg, editorMaps.OpenEditor) {
if m.app.CoderAgent.IsSessionBusy(m.session.ID) {
return m, util.ReportWarn("Agent is working, please wait...")
}
return m, openEditor()
}
// Handle Enter key
if m.textarea.Focused() && key.Matches(msg, editorMaps.Send) {
value := m.textarea.Value()
if len(value) > 0 && value[len(value)-1] == '\\' {
// If the last character is a backslash, remove it and add a newline
m.textarea.SetValue(value[:len(value)-1] + "\n")
return m, nil
} else {
// Otherwise, send the message
return m, m.send()
}
}
}
m.textarea, cmd = m.textarea.Update(msg)
return m, cmd
}
func (m *editorCmp) View() string {
style := lipgloss.NewStyle().Padding(0, 0, 0, 1).Bold(true)
return lipgloss.JoinHorizontal(lipgloss.Top, style.Render(">"), m.textarea.View())
}
func (m *editorCmp) SetSize(width, height int) tea.Cmd {
m.textarea.SetWidth(width - 3) // account for the prompt and padding right
m.textarea.SetHeight(height)
return nil
}
func (m *editorCmp) GetSize() (int, int) {
return m.textarea.Width(), m.textarea.Height()
}
func (m *editorCmp) BindingKeys() []key.Binding {
bindings := []key.Binding{}
bindings = append(bindings, layout.KeyMapToSlice(editorMaps)...)
return bindings
}
func NewEditorCmp(app *app.App) tea.Model {
ti := textarea.New()
ti.Prompt = " "
ti.ShowLineNumbers = false
ti.BlurredStyle.Base = ti.BlurredStyle.Base.Background(styles.Background)
ti.BlurredStyle.CursorLine = ti.BlurredStyle.CursorLine.Background(styles.Background)
ti.BlurredStyle.Placeholder = ti.BlurredStyle.Placeholder.Background(styles.Background)
ti.BlurredStyle.Text = ti.BlurredStyle.Text.Background(styles.Background)
ti.FocusedStyle.Base = ti.FocusedStyle.Base.Background(styles.Background)
ti.FocusedStyle.CursorLine = ti.FocusedStyle.CursorLine.Background(styles.Background)
ti.FocusedStyle.Placeholder = ti.FocusedStyle.Placeholder.Background(styles.Background)
ti.FocusedStyle.Text = ti.BlurredStyle.Text.Background(styles.Background)
ti.CharLimit = -1
ti.Focus()
return &editorCmp{
app: app,
textarea: ti,
}
}
+448
View File
@@ -0,0 +1,448 @@
package chat
import (
"context"
"fmt"
"math"
"github.com/charmbracelet/bubbles/key"
"github.com/charmbracelet/bubbles/spinner"
"github.com/charmbracelet/bubbles/viewport"
tea "github.com/charmbracelet/bubbletea"
"github.com/charmbracelet/lipgloss"
"github.com/kujtimiihoxha/opencode/internal/app"
"github.com/kujtimiihoxha/opencode/internal/message"
"github.com/kujtimiihoxha/opencode/internal/pubsub"
"github.com/kujtimiihoxha/opencode/internal/session"
"github.com/kujtimiihoxha/opencode/internal/tui/styles"
"github.com/kujtimiihoxha/opencode/internal/tui/util"
)
type cacheItem struct {
width int
content []uiMessage
}
type messagesCmp struct {
app *app.App
width, height int
viewport viewport.Model
session session.Session
messages []message.Message
uiMessages []uiMessage
currentMsgID string
cachedContent map[string]cacheItem
spinner spinner.Model
rendering bool
}
type renderFinishedMsg struct{}
type MessageKeys struct {
PageDown key.Binding
PageUp key.Binding
HalfPageUp key.Binding
HalfPageDown key.Binding
}
var messageKeys = MessageKeys{
PageDown: key.NewBinding(
key.WithKeys("pgdown"),
key.WithHelp("f/pgdn", "page down"),
),
PageUp: key.NewBinding(
key.WithKeys("pgup"),
key.WithHelp("b/pgup", "page up"),
),
HalfPageUp: key.NewBinding(
key.WithKeys("ctrl+u"),
key.WithHelp("ctrl+u", "½ page up"),
),
HalfPageDown: key.NewBinding(
key.WithKeys("ctrl+d", "ctrl+d"),
key.WithHelp("ctrl+d", "½ page down"),
),
}
func (m *messagesCmp) Init() tea.Cmd {
return tea.Batch(m.viewport.Init(), m.spinner.Tick)
}
func (m *messagesCmp) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
var cmds []tea.Cmd
switch msg := msg.(type) {
case SessionSelectedMsg:
if msg.ID != m.session.ID {
cmd := m.SetSession(msg)
return m, cmd
}
return m, nil
case SessionClearedMsg:
m.session = session.Session{}
m.messages = make([]message.Message, 0)
m.currentMsgID = ""
m.rendering = false
return m, nil
case tea.KeyMsg:
if key.Matches(msg, messageKeys.PageUp) || key.Matches(msg, messageKeys.PageDown) ||
key.Matches(msg, messageKeys.HalfPageUp) || key.Matches(msg, messageKeys.HalfPageDown) {
u, cmd := m.viewport.Update(msg)
m.viewport = u
cmds = append(cmds, cmd)
}
case renderFinishedMsg:
m.rendering = false
m.viewport.GotoBottom()
case pubsub.Event[message.Message]:
needsRerender := false
if msg.Type == pubsub.CreatedEvent {
if msg.Payload.SessionID == m.session.ID {
messageExists := false
for _, v := range m.messages {
if v.ID == msg.Payload.ID {
messageExists = true
break
}
}
if !messageExists {
if len(m.messages) > 0 {
lastMsgID := m.messages[len(m.messages)-1].ID
delete(m.cachedContent, lastMsgID)
}
m.messages = append(m.messages, msg.Payload)
delete(m.cachedContent, m.currentMsgID)
m.currentMsgID = msg.Payload.ID
needsRerender = true
}
}
// There are tool calls from the child task
for _, v := range m.messages {
for _, c := range v.ToolCalls() {
if c.ID == msg.Payload.SessionID {
delete(m.cachedContent, v.ID)
needsRerender = true
}
}
}
} else if msg.Type == pubsub.UpdatedEvent && msg.Payload.SessionID == m.session.ID {
for i, v := range m.messages {
if v.ID == msg.Payload.ID {
m.messages[i] = msg.Payload
delete(m.cachedContent, msg.Payload.ID)
needsRerender = true
break
}
}
}
if needsRerender {
m.renderView()
if len(m.messages) > 0 {
if (msg.Type == pubsub.CreatedEvent) ||
(msg.Type == pubsub.UpdatedEvent && msg.Payload.ID == m.messages[len(m.messages)-1].ID) {
m.viewport.GotoBottom()
}
}
}
}
spinner, cmd := m.spinner.Update(msg)
m.spinner = spinner
cmds = append(cmds, cmd)
return m, tea.Batch(cmds...)
}
func (m *messagesCmp) IsAgentWorking() bool {
return m.app.CoderAgent.IsSessionBusy(m.session.ID)
}
func formatTimeDifference(unixTime1, unixTime2 int64) string {
diffSeconds := float64(math.Abs(float64(unixTime2 - unixTime1)))
if diffSeconds < 60 {
return fmt.Sprintf("%.1fs", diffSeconds)
}
minutes := int(diffSeconds / 60)
seconds := int(diffSeconds) % 60
return fmt.Sprintf("%dm%ds", minutes, seconds)
}
func (m *messagesCmp) renderView() {
m.uiMessages = make([]uiMessage, 0)
pos := 0
if m.width == 0 {
return
}
for inx, msg := range m.messages {
switch msg.Role {
case message.User:
if cache, ok := m.cachedContent[msg.ID]; ok && cache.width == m.width {
m.uiMessages = append(m.uiMessages, cache.content...)
continue
}
userMsg := renderUserMessage(
msg,
msg.ID == m.currentMsgID,
m.width,
pos,
)
m.uiMessages = append(m.uiMessages, userMsg)
m.cachedContent[msg.ID] = cacheItem{
width: m.width,
content: []uiMessage{userMsg},
}
pos += userMsg.height + 1 // + 1 for spacing
case message.Assistant:
if cache, ok := m.cachedContent[msg.ID]; ok && cache.width == m.width {
m.uiMessages = append(m.uiMessages, cache.content...)
continue
}
assistantMessages := renderAssistantMessage(
msg,
inx,
m.messages,
m.app.Messages,
m.currentMsgID,
m.width,
pos,
)
for _, msg := range assistantMessages {
m.uiMessages = append(m.uiMessages, msg)
pos += msg.height + 1 // + 1 for spacing
}
m.cachedContent[msg.ID] = cacheItem{
width: m.width,
content: assistantMessages,
}
}
}
messages := make([]string, 0)
for _, v := range m.uiMessages {
messages = append(messages, v.content,
styles.BaseStyle.
Width(m.width).
Render(
"",
),
)
}
m.viewport.SetContent(
styles.BaseStyle.
Width(m.width).
Render(
lipgloss.JoinVertical(
lipgloss.Top,
messages...,
),
),
)
}
func (m *messagesCmp) View() string {
if m.rendering {
return styles.BaseStyle.
Width(m.width).
Render(
lipgloss.JoinVertical(
lipgloss.Top,
"Loading...",
m.working(),
m.help(),
),
)
}
if len(m.messages) == 0 {
content := styles.BaseStyle.
Width(m.width).
Height(m.height - 1).
Render(
m.initialScreen(),
)
return styles.BaseStyle.
Width(m.width).
Render(
lipgloss.JoinVertical(
lipgloss.Top,
content,
"",
m.help(),
),
)
}
return styles.BaseStyle.
Width(m.width).
Render(
lipgloss.JoinVertical(
lipgloss.Top,
m.viewport.View(),
m.working(),
m.help(),
),
)
}
func hasToolsWithoutResponse(messages []message.Message) bool {
toolCalls := make([]message.ToolCall, 0)
toolResults := make([]message.ToolResult, 0)
for _, m := range messages {
toolCalls = append(toolCalls, m.ToolCalls()...)
toolResults = append(toolResults, m.ToolResults()...)
}
for _, v := range toolCalls {
found := false
for _, r := range toolResults {
if v.ID == r.ToolCallID {
found = true
break
}
}
if !found && v.Finished {
return true
}
}
return false
}
func hasUnfinishedToolCalls(messages []message.Message) bool {
toolCalls := make([]message.ToolCall, 0)
for _, m := range messages {
toolCalls = append(toolCalls, m.ToolCalls()...)
}
for _, v := range toolCalls {
if !v.Finished {
return true
}
}
return false
}
func (m *messagesCmp) working() string {
text := ""
if m.IsAgentWorking() && len(m.messages) > 0 {
task := "Thinking..."
lastMessage := m.messages[len(m.messages)-1]
if hasToolsWithoutResponse(m.messages) {
task = "Waiting for tool response..."
} else if hasUnfinishedToolCalls(m.messages) {
task = "Building tool call..."
} else if !lastMessage.IsFinished() {
task = "Generating..."
}
if task != "" {
text += styles.BaseStyle.Width(m.width).Foreground(styles.PrimaryColor).Bold(true).Render(
fmt.Sprintf("%s %s ", m.spinner.View(), task),
)
}
}
return text
}
func (m *messagesCmp) help() string {
text := ""
if m.app.CoderAgent.IsBusy() {
text += lipgloss.JoinHorizontal(
lipgloss.Left,
styles.BaseStyle.Foreground(styles.ForgroundDim).Bold(true).Render("press "),
styles.BaseStyle.Foreground(styles.Forground).Bold(true).Render("esc"),
styles.BaseStyle.Foreground(styles.ForgroundDim).Bold(true).Render(" to exit cancel"),
)
} else {
text += lipgloss.JoinHorizontal(
lipgloss.Left,
styles.BaseStyle.Foreground(styles.ForgroundDim).Bold(true).Render("press "),
styles.BaseStyle.Foreground(styles.Forground).Bold(true).Render("enter"),
styles.BaseStyle.Foreground(styles.ForgroundDim).Bold(true).Render(" to send the message,"),
styles.BaseStyle.Foreground(styles.ForgroundDim).Bold(true).Render(" write"),
styles.BaseStyle.Foreground(styles.Forground).Bold(true).Render(" \\"),
styles.BaseStyle.Foreground(styles.ForgroundDim).Bold(true).Render(" and enter to add a new line"),
)
}
return styles.BaseStyle.
Width(m.width).
Render(text)
}
func (m *messagesCmp) initialScreen() string {
return styles.BaseStyle.Width(m.width).Render(
lipgloss.JoinVertical(
lipgloss.Top,
header(m.width),
"",
lspsConfigured(m.width),
),
)
}
func (m *messagesCmp) SetSize(width, height int) tea.Cmd {
if m.width == width && m.height == height {
return nil
}
m.width = width
m.height = height
m.viewport.Width = width
m.viewport.Height = height - 2
for _, msg := range m.messages {
delete(m.cachedContent, msg.ID)
}
m.uiMessages = make([]uiMessage, 0)
m.renderView()
return nil
}
func (m *messagesCmp) GetSize() (int, int) {
return m.width, m.height
}
func (m *messagesCmp) SetSession(session session.Session) tea.Cmd {
if m.session.ID == session.ID {
return nil
}
m.session = session
messages, err := m.app.Messages.List(context.Background(), session.ID)
if err != nil {
return util.ReportError(err)
}
m.messages = messages
m.currentMsgID = m.messages[len(m.messages)-1].ID
delete(m.cachedContent, m.currentMsgID)
m.rendering = true
return func() tea.Msg {
m.renderView()
return renderFinishedMsg{}
}
}
func (m *messagesCmp) BindingKeys() []key.Binding {
return []key.Binding{
m.viewport.KeyMap.PageDown,
m.viewport.KeyMap.PageUp,
m.viewport.KeyMap.HalfPageUp,
m.viewport.KeyMap.HalfPageDown,
}
}
func NewMessagesCmp(app *app.App) tea.Model {
s := spinner.New()
s.Spinner = spinner.Pulse
vp := viewport.New(0, 0)
vp.KeyMap.PageUp = messageKeys.PageUp
vp.KeyMap.PageDown = messageKeys.PageDown
vp.KeyMap.HalfPageUp = messageKeys.HalfPageUp
vp.KeyMap.HalfPageDown = messageKeys.HalfPageDown
return &messagesCmp{
app: app,
cachedContent: make(map[string]cacheItem),
viewport: vp,
spinner: s,
}
}
+624
View File
@@ -0,0 +1,624 @@
package chat
import (
"context"
"encoding/json"
"fmt"
"path/filepath"
"strings"
"sync"
"time"
"github.com/charmbracelet/glamour"
"github.com/charmbracelet/lipgloss"
"github.com/charmbracelet/x/ansi"
"github.com/kujtimiihoxha/opencode/internal/config"
"github.com/kujtimiihoxha/opencode/internal/diff"
"github.com/kujtimiihoxha/opencode/internal/llm/agent"
"github.com/kujtimiihoxha/opencode/internal/llm/models"
"github.com/kujtimiihoxha/opencode/internal/llm/tools"
"github.com/kujtimiihoxha/opencode/internal/message"
"github.com/kujtimiihoxha/opencode/internal/tui/styles"
)
type uiMessageType int
const (
userMessageType uiMessageType = iota
assistantMessageType
toolMessageType
maxResultHeight = 10
)
var diffStyle = diff.NewStyleConfig(diff.WithShowHeader(false), diff.WithShowHunkHeader(false))
type uiMessage struct {
ID string
messageType uiMessageType
position int
height int
content string
}
type renderCache struct {
mutex sync.Mutex
cache map[string][]uiMessage
}
func toMarkdown(content string, focused bool, width int) string {
r, _ := glamour.NewTermRenderer(
glamour.WithStyles(styles.MarkdownTheme(false)),
glamour.WithWordWrap(width),
)
if focused {
r, _ = glamour.NewTermRenderer(
glamour.WithStyles(styles.MarkdownTheme(true)),
glamour.WithWordWrap(width),
)
}
rendered, _ := r.Render(content)
return rendered
}
func renderMessage(msg string, isUser bool, isFocused bool, width int, info ...string) string {
style := styles.BaseStyle.
Width(width - 1).
BorderLeft(true).
Foreground(styles.ForgroundDim).
BorderForeground(styles.PrimaryColor).
BorderStyle(lipgloss.ThickBorder())
if isUser {
style = style.
BorderForeground(styles.Blue)
}
parts := []string{
styles.ForceReplaceBackgroundWithLipgloss(toMarkdown(msg, isFocused, width), styles.Background),
}
// remove newline at the end
parts[0] = strings.TrimSuffix(parts[0], "\n")
if len(info) > 0 {
parts = append(parts, info...)
}
rendered := style.Render(
lipgloss.JoinVertical(
lipgloss.Left,
parts...,
),
)
return rendered
}
func renderUserMessage(msg message.Message, isFocused bool, width int, position int) uiMessage {
content := renderMessage(msg.Content().String(), true, isFocused, width)
userMsg := uiMessage{
ID: msg.ID,
messageType: userMessageType,
position: position,
height: lipgloss.Height(content),
content: content,
}
return userMsg
}
// Returns multiple uiMessages because of the tool calls
func renderAssistantMessage(
msg message.Message,
msgIndex int,
allMessages []message.Message, // we need this to get tool results and the user message
messagesService message.Service, // We need this to get the task tool messages
focusedUIMessageId string,
width int,
position int,
) []uiMessage {
messages := []uiMessage{}
content := msg.Content().String()
thinking := msg.IsThinking()
thinkingContent := msg.ReasoningContent().Thinking
finished := msg.IsFinished()
finishData := msg.FinishPart()
info := []string{}
// Add finish info if available
if finished {
switch finishData.Reason {
case message.FinishReasonEndTurn:
took := formatTimeDifference(msg.CreatedAt, finishData.Time)
info = append(info, styles.BaseStyle.Width(width-1).Foreground(styles.ForgroundDim).Render(
fmt.Sprintf(" %s (%s)", models.SupportedModels[msg.Model].Name, took),
))
case message.FinishReasonCanceled:
info = append(info, styles.BaseStyle.Width(width-1).Foreground(styles.ForgroundDim).Render(
fmt.Sprintf(" %s (%s)", models.SupportedModels[msg.Model].Name, "canceled"),
))
case message.FinishReasonError:
info = append(info, styles.BaseStyle.Width(width-1).Foreground(styles.ForgroundDim).Render(
fmt.Sprintf(" %s (%s)", models.SupportedModels[msg.Model].Name, "error"),
))
case message.FinishReasonPermissionDenied:
info = append(info, styles.BaseStyle.Width(width-1).Foreground(styles.ForgroundDim).Render(
fmt.Sprintf(" %s (%s)", models.SupportedModels[msg.Model].Name, "permission denied"),
))
}
}
if content != "" || (finished && finishData.Reason == message.FinishReasonEndTurn) {
if content == "" {
content = "*Finished without output*"
}
content = renderMessage(content, false, true, width, info...)
messages = append(messages, uiMessage{
ID: msg.ID,
messageType: assistantMessageType,
position: position,
height: lipgloss.Height(content),
content: content,
})
position += messages[0].height
position++ // for the space
} else if thinking && thinkingContent != "" {
// Render the thinking content
content = renderMessage(thinkingContent, false, msg.ID == focusedUIMessageId, width)
}
for i, toolCall := range msg.ToolCalls() {
toolCallContent := renderToolMessage(
toolCall,
allMessages,
messagesService,
focusedUIMessageId,
false,
width,
i+1,
)
messages = append(messages, toolCallContent)
position += toolCallContent.height
position++ // for the space
}
return messages
}
func findToolResponse(toolCallID string, futureMessages []message.Message) *message.ToolResult {
for _, msg := range futureMessages {
for _, result := range msg.ToolResults() {
if result.ToolCallID == toolCallID {
return &result
}
}
}
return nil
}
func toolName(name string) string {
switch name {
case agent.AgentToolName:
return "Task"
case tools.BashToolName:
return "Bash"
case tools.EditToolName:
return "Edit"
case tools.FetchToolName:
return "Fetch"
case tools.GlobToolName:
return "Glob"
case tools.GrepToolName:
return "Grep"
case tools.LSToolName:
return "List"
case tools.SourcegraphToolName:
return "Sourcegraph"
case tools.ViewToolName:
return "View"
case tools.WriteToolName:
return "Write"
case tools.PatchToolName:
return "Patch"
}
return name
}
func getToolAction(name string) string {
switch name {
case agent.AgentToolName:
return "Preparing prompt..."
case tools.BashToolName:
return "Building command..."
case tools.EditToolName:
return "Preparing edit..."
case tools.FetchToolName:
return "Writing fetch..."
case tools.GlobToolName:
return "Finding files..."
case tools.GrepToolName:
return "Searching content..."
case tools.LSToolName:
return "Listing directory..."
case tools.SourcegraphToolName:
return "Searching code..."
case tools.ViewToolName:
return "Reading file..."
case tools.WriteToolName:
return "Preparing write..."
case tools.PatchToolName:
return "Preparing patch..."
}
return "Working..."
}
// renders params, params[0] (params[1]=params[2] ....)
func renderParams(paramsWidth int, params ...string) string {
if len(params) == 0 {
return ""
}
mainParam := params[0]
if len(mainParam) > paramsWidth {
mainParam = mainParam[:paramsWidth-3] + "..."
}
if len(params) == 1 {
return mainParam
}
otherParams := params[1:]
// create pairs of key/value
// if odd number of params, the last one is a key without value
if len(otherParams)%2 != 0 {
otherParams = append(otherParams, "")
}
parts := make([]string, 0, len(otherParams)/2)
for i := 0; i < len(otherParams); i += 2 {
key := otherParams[i]
value := otherParams[i+1]
if value == "" {
continue
}
parts = append(parts, fmt.Sprintf("%s=%s", key, value))
}
partsRendered := strings.Join(parts, ", ")
remainingWidth := paramsWidth - lipgloss.Width(partsRendered) - 5 // for the space
if remainingWidth < 30 {
// No space for the params, just show the main
return mainParam
}
if len(parts) > 0 {
mainParam = fmt.Sprintf("%s (%s)", mainParam, strings.Join(parts, ", "))
}
return ansi.Truncate(mainParam, paramsWidth, "...")
}
func removeWorkingDirPrefix(path string) string {
wd := config.WorkingDirectory()
if strings.HasPrefix(path, wd) {
path = strings.TrimPrefix(path, wd)
}
if strings.HasPrefix(path, "/") {
path = strings.TrimPrefix(path, "/")
}
if strings.HasPrefix(path, "./") {
path = strings.TrimPrefix(path, "./")
}
if strings.HasPrefix(path, "../") {
path = strings.TrimPrefix(path, "../")
}
return path
}
func renderToolParams(paramWidth int, toolCall message.ToolCall) string {
params := ""
switch toolCall.Name {
case agent.AgentToolName:
var params agent.AgentParams
json.Unmarshal([]byte(toolCall.Input), &params)
prompt := strings.ReplaceAll(params.Prompt, "\n", " ")
return renderParams(paramWidth, prompt)
case tools.BashToolName:
var params tools.BashParams
json.Unmarshal([]byte(toolCall.Input), &params)
command := strings.ReplaceAll(params.Command, "\n", " ")
return renderParams(paramWidth, command)
case tools.EditToolName:
var params tools.EditParams
json.Unmarshal([]byte(toolCall.Input), &params)
filePath := removeWorkingDirPrefix(params.FilePath)
return renderParams(paramWidth, filePath)
case tools.FetchToolName:
var params tools.FetchParams
json.Unmarshal([]byte(toolCall.Input), &params)
url := params.URL
toolParams := []string{
url,
}
if params.Format != "" {
toolParams = append(toolParams, "format", params.Format)
}
if params.Timeout != 0 {
toolParams = append(toolParams, "timeout", (time.Duration(params.Timeout) * time.Second).String())
}
return renderParams(paramWidth, toolParams...)
case tools.GlobToolName:
var params tools.GlobParams
json.Unmarshal([]byte(toolCall.Input), &params)
pattern := params.Pattern
toolParams := []string{
pattern,
}
if params.Path != "" {
toolParams = append(toolParams, "path", params.Path)
}
return renderParams(paramWidth, toolParams...)
case tools.GrepToolName:
var params tools.GrepParams
json.Unmarshal([]byte(toolCall.Input), &params)
pattern := params.Pattern
toolParams := []string{
pattern,
}
if params.Path != "" {
toolParams = append(toolParams, "path", params.Path)
}
if params.Include != "" {
toolParams = append(toolParams, "include", params.Include)
}
if params.LiteralText {
toolParams = append(toolParams, "literal", "true")
}
return renderParams(paramWidth, toolParams...)
case tools.LSToolName:
var params tools.LSParams
json.Unmarshal([]byte(toolCall.Input), &params)
path := params.Path
if path == "" {
path = "."
}
return renderParams(paramWidth, path)
case tools.SourcegraphToolName:
var params tools.SourcegraphParams
json.Unmarshal([]byte(toolCall.Input), &params)
return renderParams(paramWidth, params.Query)
case tools.ViewToolName:
var params tools.ViewParams
json.Unmarshal([]byte(toolCall.Input), &params)
filePath := removeWorkingDirPrefix(params.FilePath)
toolParams := []string{
filePath,
}
if params.Limit != 0 {
toolParams = append(toolParams, "limit", fmt.Sprintf("%d", params.Limit))
}
if params.Offset != 0 {
toolParams = append(toolParams, "offset", fmt.Sprintf("%d", params.Offset))
}
return renderParams(paramWidth, toolParams...)
case tools.WriteToolName:
var params tools.WriteParams
json.Unmarshal([]byte(toolCall.Input), &params)
filePath := removeWorkingDirPrefix(params.FilePath)
return renderParams(paramWidth, filePath)
default:
input := strings.ReplaceAll(toolCall.Input, "\n", " ")
params = renderParams(paramWidth, input)
}
return params
}
func truncateHeight(content string, height int) string {
lines := strings.Split(content, "\n")
if len(lines) > height {
return strings.Join(lines[:height], "\n")
}
return content
}
func renderToolResponse(toolCall message.ToolCall, response message.ToolResult, width int) string {
if response.IsError {
errContent := fmt.Sprintf("Error: %s", strings.ReplaceAll(response.Content, "\n", " "))
errContent = ansi.Truncate(errContent, width-1, "...")
return styles.BaseStyle.
Width(width).
Foreground(styles.Error).
Render(errContent)
}
resultContent := truncateHeight(response.Content, maxResultHeight)
switch toolCall.Name {
case agent.AgentToolName:
return styles.ForceReplaceBackgroundWithLipgloss(
toMarkdown(resultContent, false, width),
styles.Background,
)
case tools.BashToolName:
resultContent = fmt.Sprintf("```bash\n%s\n```", resultContent)
return styles.ForceReplaceBackgroundWithLipgloss(
toMarkdown(resultContent, true, width),
styles.Background,
)
case tools.EditToolName:
metadata := tools.EditResponseMetadata{}
json.Unmarshal([]byte(response.Metadata), &metadata)
truncDiff := truncateHeight(metadata.Diff, maxResultHeight)
formattedDiff, _ := diff.FormatDiff(truncDiff, diff.WithTotalWidth(width), diff.WithStyle(diffStyle))
return formattedDiff
case tools.FetchToolName:
var params tools.FetchParams
json.Unmarshal([]byte(toolCall.Input), &params)
mdFormat := "markdown"
switch params.Format {
case "text":
mdFormat = "text"
case "html":
mdFormat = "html"
}
resultContent = fmt.Sprintf("```%s\n%s\n```", mdFormat, resultContent)
return styles.ForceReplaceBackgroundWithLipgloss(
toMarkdown(resultContent, true, width),
styles.Background,
)
case tools.GlobToolName:
return styles.BaseStyle.Width(width).Foreground(styles.ForgroundMid).Render(resultContent)
case tools.GrepToolName:
return styles.BaseStyle.Width(width).Foreground(styles.ForgroundMid).Render(resultContent)
case tools.LSToolName:
return styles.BaseStyle.Width(width).Foreground(styles.ForgroundMid).Render(resultContent)
case tools.SourcegraphToolName:
return styles.BaseStyle.Width(width).Foreground(styles.ForgroundMid).Render(resultContent)
case tools.ViewToolName:
metadata := tools.ViewResponseMetadata{}
json.Unmarshal([]byte(response.Metadata), &metadata)
ext := filepath.Ext(metadata.FilePath)
if ext == "" {
ext = ""
} else {
ext = strings.ToLower(ext[1:])
}
resultContent = fmt.Sprintf("```%s\n%s\n```", ext, truncateHeight(metadata.Content, maxResultHeight))
return styles.ForceReplaceBackgroundWithLipgloss(
toMarkdown(resultContent, true, width),
styles.Background,
)
case tools.WriteToolName:
params := tools.WriteParams{}
json.Unmarshal([]byte(toolCall.Input), &params)
metadata := tools.WriteResponseMetadata{}
json.Unmarshal([]byte(response.Metadata), &metadata)
ext := filepath.Ext(params.FilePath)
if ext == "" {
ext = ""
} else {
ext = strings.ToLower(ext[1:])
}
resultContent = fmt.Sprintf("```%s\n%s\n```", ext, truncateHeight(params.Content, maxResultHeight))
return styles.ForceReplaceBackgroundWithLipgloss(
toMarkdown(resultContent, true, width),
styles.Background,
)
default:
resultContent = fmt.Sprintf("```text\n%s\n```", resultContent)
return styles.ForceReplaceBackgroundWithLipgloss(
toMarkdown(resultContent, true, width),
styles.Background,
)
}
}
func renderToolMessage(
toolCall message.ToolCall,
allMessages []message.Message,
messagesService message.Service,
focusedUIMessageId string,
nested bool,
width int,
position int,
) uiMessage {
if nested {
width = width - 3
}
style := styles.BaseStyle.
Width(width - 1).
BorderLeft(true).
BorderStyle(lipgloss.ThickBorder()).
PaddingLeft(1).
BorderForeground(styles.ForgroundDim)
response := findToolResponse(toolCall.ID, allMessages)
toolName := styles.BaseStyle.Foreground(styles.ForgroundDim).Render(fmt.Sprintf("%s: ", toolName(toolCall.Name)))
if !toolCall.Finished {
// Get a brief description of what the tool is doing
toolAction := getToolAction(toolCall.Name)
// toolInput := strings.ReplaceAll(toolCall.Input, "\n", " ")
// truncatedInput := toolInput
// if len(truncatedInput) > 10 {
// truncatedInput = truncatedInput[len(truncatedInput)-10:]
// }
//
// truncatedInput = styles.BaseStyle.
// Italic(true).
// Width(width - 2 - lipgloss.Width(toolName)).
// Background(styles.BackgroundDim).
// Foreground(styles.ForgroundMid).
// Render(truncatedInput)
progressText := styles.BaseStyle.
Width(width - 2 - lipgloss.Width(toolName)).
Foreground(styles.ForgroundDim).
Render(fmt.Sprintf("%s", toolAction))
content := style.Render(lipgloss.JoinHorizontal(lipgloss.Left, toolName, progressText))
toolMsg := uiMessage{
messageType: toolMessageType,
position: position,
height: lipgloss.Height(content),
content: content,
}
return toolMsg
}
params := renderToolParams(width-2-lipgloss.Width(toolName), toolCall)
responseContent := ""
if response != nil {
responseContent = renderToolResponse(toolCall, *response, width-2)
responseContent = strings.TrimSuffix(responseContent, "\n")
} else {
responseContent = styles.BaseStyle.
Italic(true).
Width(width - 2).
Foreground(styles.ForgroundDim).
Render("Waiting for response...")
}
parts := []string{}
if !nested {
params := styles.BaseStyle.
Width(width - 2 - lipgloss.Width(toolName)).
Foreground(styles.ForgroundDim).
Render(params)
parts = append(parts, lipgloss.JoinHorizontal(lipgloss.Left, toolName, params))
} else {
prefix := styles.BaseStyle.
Foreground(styles.ForgroundDim).
Render(" └ ")
params := styles.BaseStyle.
Width(width - 2 - lipgloss.Width(toolName)).
Foreground(styles.ForgroundMid).
Render(params)
parts = append(parts, lipgloss.JoinHorizontal(lipgloss.Left, prefix, toolName, params))
}
if toolCall.Name == agent.AgentToolName {
taskMessages, _ := messagesService.List(context.Background(), toolCall.ID)
toolCalls := []message.ToolCall{}
for _, v := range taskMessages {
toolCalls = append(toolCalls, v.ToolCalls()...)
}
for _, call := range toolCalls {
rendered := renderToolMessage(call, []message.Message{}, messagesService, focusedUIMessageId, true, width, 0)
parts = append(parts, rendered.content)
}
}
if responseContent != "" && !nested {
parts = append(parts, responseContent)
}
content := style.Render(
lipgloss.JoinVertical(
lipgloss.Left,
parts...,
),
)
if nested {
content = lipgloss.JoinVertical(
lipgloss.Left,
parts...,
)
}
toolMsg := uiMessage{
messageType: toolMessageType,
position: position,
height: lipgloss.Height(content),
content: content,
}
return toolMsg
}
+342
View File
@@ -0,0 +1,342 @@
package chat
import (
"context"
"fmt"
"sort"
"strings"
tea "github.com/charmbracelet/bubbletea"
"github.com/charmbracelet/lipgloss"
"github.com/kujtimiihoxha/opencode/internal/config"
"github.com/kujtimiihoxha/opencode/internal/diff"
"github.com/kujtimiihoxha/opencode/internal/history"
"github.com/kujtimiihoxha/opencode/internal/pubsub"
"github.com/kujtimiihoxha/opencode/internal/session"
"github.com/kujtimiihoxha/opencode/internal/tui/styles"
)
type sidebarCmp struct {
width, height int
session session.Session
history history.Service
modFiles map[string]struct {
additions int
removals int
}
}
func (m *sidebarCmp) Init() tea.Cmd {
if m.history != nil {
ctx := context.Background()
// Subscribe to file events
filesCh := m.history.Subscribe(ctx)
// Initialize the modified files map
m.modFiles = make(map[string]struct {
additions int
removals int
})
// Load initial files and calculate diffs
m.loadModifiedFiles(ctx)
// Return a command that will send file events to the Update method
return func() tea.Msg {
return <-filesCh
}
}
return nil
}
func (m *sidebarCmp) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
switch msg := msg.(type) {
case SessionSelectedMsg:
if msg.ID != m.session.ID {
m.session = msg
ctx := context.Background()
m.loadModifiedFiles(ctx)
}
case pubsub.Event[session.Session]:
if msg.Type == pubsub.UpdatedEvent {
if m.session.ID == msg.Payload.ID {
m.session = msg.Payload
}
}
case pubsub.Event[history.File]:
if msg.Payload.SessionID == m.session.ID {
// Process the individual file change instead of reloading all files
ctx := context.Background()
m.processFileChanges(ctx, msg.Payload)
// Return a command to continue receiving events
return m, func() tea.Msg {
ctx := context.Background()
filesCh := m.history.Subscribe(ctx)
return <-filesCh
}
}
}
return m, nil
}
func (m *sidebarCmp) View() string {
return styles.BaseStyle.
Width(m.width).
PaddingLeft(4).
PaddingRight(2).
Height(m.height - 1).
Render(
lipgloss.JoinVertical(
lipgloss.Top,
header(m.width),
" ",
m.sessionSection(),
" ",
lspsConfigured(m.width),
" ",
m.modifiedFiles(),
),
)
}
func (m *sidebarCmp) sessionSection() string {
sessionKey := styles.BaseStyle.Foreground(styles.PrimaryColor).Bold(true).Render("Session")
sessionValue := styles.BaseStyle.
Foreground(styles.Forground).
Width(m.width - lipgloss.Width(sessionKey)).
Render(fmt.Sprintf(": %s", m.session.Title))
return lipgloss.JoinHorizontal(
lipgloss.Left,
sessionKey,
sessionValue,
)
}
func (m *sidebarCmp) modifiedFile(filePath string, additions, removals int) string {
stats := ""
if additions > 0 && removals > 0 {
additions := styles.BaseStyle.Foreground(styles.Green).PaddingLeft(1).Render(fmt.Sprintf("+%d", additions))
removals := styles.BaseStyle.Foreground(styles.Red).PaddingLeft(1).Render(fmt.Sprintf("-%d", removals))
content := lipgloss.JoinHorizontal(lipgloss.Left, additions, removals)
stats = styles.BaseStyle.Width(lipgloss.Width(content)).Render(content)
} else if additions > 0 {
additions := fmt.Sprintf(" %s", styles.BaseStyle.PaddingLeft(1).Foreground(styles.Green).Render(fmt.Sprintf("+%d", additions)))
stats = styles.BaseStyle.Width(lipgloss.Width(additions)).Render(additions)
} else if removals > 0 {
removals := fmt.Sprintf(" %s", styles.BaseStyle.PaddingLeft(1).Foreground(styles.Red).Render(fmt.Sprintf("-%d", removals)))
stats = styles.BaseStyle.Width(lipgloss.Width(removals)).Render(removals)
}
filePathStr := styles.BaseStyle.Render(filePath)
return styles.BaseStyle.
Width(m.width).
Render(
lipgloss.JoinHorizontal(
lipgloss.Left,
filePathStr,
stats,
),
)
}
func (m *sidebarCmp) modifiedFiles() string {
modifiedFiles := styles.BaseStyle.Width(m.width).Foreground(styles.PrimaryColor).Bold(true).Render("Modified Files:")
// If no modified files, show a placeholder message
if m.modFiles == nil || len(m.modFiles) == 0 {
message := "No modified files"
remainingWidth := m.width - lipgloss.Width(message)
if remainingWidth > 0 {
message += strings.Repeat(" ", remainingWidth)
}
return styles.BaseStyle.
Width(m.width).
Render(
lipgloss.JoinVertical(
lipgloss.Top,
modifiedFiles,
styles.BaseStyle.Foreground(styles.ForgroundDim).Render(message),
),
)
}
// Sort file paths alphabetically for consistent ordering
var paths []string
for path := range m.modFiles {
paths = append(paths, path)
}
sort.Strings(paths)
// Create views for each file in sorted order
var fileViews []string
for _, path := range paths {
stats := m.modFiles[path]
fileViews = append(fileViews, m.modifiedFile(path, stats.additions, stats.removals))
}
return styles.BaseStyle.
Width(m.width).
Render(
lipgloss.JoinVertical(
lipgloss.Top,
modifiedFiles,
lipgloss.JoinVertical(
lipgloss.Left,
fileViews...,
),
),
)
}
func (m *sidebarCmp) SetSize(width, height int) tea.Cmd {
m.width = width
m.height = height
return nil
}
func (m *sidebarCmp) GetSize() (int, int) {
return m.width, m.height
}
func NewSidebarCmp(session session.Session, history history.Service) tea.Model {
return &sidebarCmp{
session: session,
history: history,
}
}
func (m *sidebarCmp) loadModifiedFiles(ctx context.Context) {
if m.history == nil || m.session.ID == "" {
return
}
// Get all latest files for this session
latestFiles, err := m.history.ListLatestSessionFiles(ctx, m.session.ID)
if err != nil {
return
}
// Get all files for this session (to find initial versions)
allFiles, err := m.history.ListBySession(ctx, m.session.ID)
if err != nil {
return
}
// Clear the existing map to rebuild it
m.modFiles = make(map[string]struct {
additions int
removals int
})
// Process each latest file
for _, file := range latestFiles {
// Skip if this is the initial version (no changes to show)
if file.Version == history.InitialVersion {
continue
}
// Find the initial version for this specific file
var initialVersion history.File
for _, v := range allFiles {
if v.Path == file.Path && v.Version == history.InitialVersion {
initialVersion = v
break
}
}
// Skip if we can't find the initial version
if initialVersion.ID == "" {
continue
}
if initialVersion.Content == file.Content {
continue
}
// Calculate diff between initial and latest version
_, additions, removals := diff.GenerateDiff(initialVersion.Content, file.Content, file.Path)
// Only add to modified files if there are changes
if additions > 0 || removals > 0 {
// Remove working directory prefix from file path
displayPath := file.Path
workingDir := config.WorkingDirectory()
displayPath = strings.TrimPrefix(displayPath, workingDir)
displayPath = strings.TrimPrefix(displayPath, "/")
m.modFiles[displayPath] = struct {
additions int
removals int
}{
additions: additions,
removals: removals,
}
}
}
}
func (m *sidebarCmp) processFileChanges(ctx context.Context, file history.File) {
// Skip if this is the initial version (no changes to show)
if file.Version == history.InitialVersion {
return
}
// Find the initial version for this file
initialVersion, err := m.findInitialVersion(ctx, file.Path)
if err != nil || initialVersion.ID == "" {
return
}
// Skip if content hasn't changed
if initialVersion.Content == file.Content {
// If this file was previously modified but now matches the initial version,
// remove it from the modified files list
displayPath := getDisplayPath(file.Path)
delete(m.modFiles, displayPath)
return
}
// Calculate diff between initial and latest version
_, additions, removals := diff.GenerateDiff(initialVersion.Content, file.Content, file.Path)
// Only add to modified files if there are changes
if additions > 0 || removals > 0 {
displayPath := getDisplayPath(file.Path)
m.modFiles[displayPath] = struct {
additions int
removals int
}{
additions: additions,
removals: removals,
}
} else {
// If no changes, remove from modified files
displayPath := getDisplayPath(file.Path)
delete(m.modFiles, displayPath)
}
}
// Helper function to find the initial version of a file
func (m *sidebarCmp) findInitialVersion(ctx context.Context, path string) (history.File, error) {
// Get all versions of this file for the session
fileVersions, err := m.history.ListBySession(ctx, m.session.ID)
if err != nil {
return history.File{}, err
}
// Find the initial version
for _, v := range fileVersions {
if v.Path == path && v.Version == history.InitialVersion {
return v, nil
}
}
return history.File{}, fmt.Errorf("initial version not found")
}
// Helper function to get the display path for a file
func getDisplayPath(path string) string {
workingDir := config.WorkingDirectory()
displayPath := strings.TrimPrefix(path, workingDir)
return strings.TrimPrefix(displayPath, "/")
}
+252
View File
@@ -0,0 +1,252 @@
package core
import (
"fmt"
"strings"
"time"
tea "github.com/charmbracelet/bubbletea"
"github.com/charmbracelet/lipgloss"
"github.com/kujtimiihoxha/opencode/internal/config"
"github.com/kujtimiihoxha/opencode/internal/llm/models"
"github.com/kujtimiihoxha/opencode/internal/lsp"
"github.com/kujtimiihoxha/opencode/internal/lsp/protocol"
"github.com/kujtimiihoxha/opencode/internal/pubsub"
"github.com/kujtimiihoxha/opencode/internal/session"
"github.com/kujtimiihoxha/opencode/internal/tui/components/chat"
"github.com/kujtimiihoxha/opencode/internal/tui/styles"
"github.com/kujtimiihoxha/opencode/internal/tui/util"
)
type StatusCmp interface {
tea.Model
SetHelpMsg(string)
}
type statusCmp struct {
info util.InfoMsg
width int
messageTTL time.Duration
lspClients map[string]*lsp.Client
session session.Session
}
// clearMessageCmd is a command that clears status messages after a timeout
func (m statusCmp) clearMessageCmd(ttl time.Duration) tea.Cmd {
return tea.Tick(ttl, func(time.Time) tea.Msg {
return util.ClearStatusMsg{}
})
}
func (m statusCmp) Init() tea.Cmd {
return nil
}
func (m statusCmp) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
switch msg := msg.(type) {
case tea.WindowSizeMsg:
m.width = msg.Width
return m, nil
case chat.SessionSelectedMsg:
m.session = msg
case chat.SessionClearedMsg:
m.session = session.Session{}
case pubsub.Event[session.Session]:
if msg.Type == pubsub.UpdatedEvent {
if m.session.ID == msg.Payload.ID {
m.session = msg.Payload
}
}
case util.InfoMsg:
m.info = msg
ttl := msg.TTL
if ttl == 0 {
ttl = m.messageTTL
}
return m, m.clearMessageCmd(ttl)
case util.ClearStatusMsg:
m.info = util.InfoMsg{}
}
return m, nil
}
var helpWidget = styles.Padded.Background(styles.ForgroundMid).Foreground(styles.BackgroundDarker).Bold(true).Render("ctrl+? help")
func formatTokensAndCost(tokens int64, cost float64) string {
// Format tokens in human-readable format (e.g., 110K, 1.2M)
var formattedTokens string
switch {
case tokens >= 1_000_000:
formattedTokens = fmt.Sprintf("%.1fM", float64(tokens)/1_000_000)
case tokens >= 1_000:
formattedTokens = fmt.Sprintf("%.1fK", float64(tokens)/1_000)
default:
formattedTokens = fmt.Sprintf("%d", tokens)
}
// Remove .0 suffix if present
if strings.HasSuffix(formattedTokens, ".0K") {
formattedTokens = strings.Replace(formattedTokens, ".0K", "K", 1)
}
if strings.HasSuffix(formattedTokens, ".0M") {
formattedTokens = strings.Replace(formattedTokens, ".0M", "M", 1)
}
// Format cost with $ symbol and 2 decimal places
formattedCost := fmt.Sprintf("$%.2f", cost)
return fmt.Sprintf("Tokens: %s, Cost: %s", formattedTokens, formattedCost)
}
func (m statusCmp) View() string {
status := helpWidget
if m.session.ID != "" {
tokens := formatTokensAndCost(m.session.PromptTokens+m.session.CompletionTokens, m.session.Cost)
tokensStyle := styles.Padded.
Background(styles.Forground).
Foreground(styles.BackgroundDim).
Render(tokens)
status += tokensStyle
}
diagnostics := styles.Padded.Background(styles.BackgroundDarker).Render(m.projectDiagnostics())
if m.info.Msg != "" {
infoStyle := styles.Padded.
Foreground(styles.Base).
Width(m.availableFooterMsgWidth(diagnostics))
switch m.info.Type {
case util.InfoTypeInfo:
infoStyle = infoStyle.Background(styles.BorderColor)
case util.InfoTypeWarn:
infoStyle = infoStyle.Background(styles.Peach)
case util.InfoTypeError:
infoStyle = infoStyle.Background(styles.Red)
}
// Truncate message if it's longer than available width
msg := m.info.Msg
availWidth := m.availableFooterMsgWidth(diagnostics) - 10
if len(msg) > availWidth && availWidth > 0 {
msg = msg[:availWidth] + "..."
}
status += infoStyle.Render(msg)
} else {
status += styles.Padded.
Foreground(styles.Base).
Background(styles.BackgroundDim).
Width(m.availableFooterMsgWidth(diagnostics)).
Render("")
}
status += diagnostics
status += m.model()
return status
}
func (m *statusCmp) projectDiagnostics() string {
// Check if any LSP server is still initializing
initializing := false
for _, client := range m.lspClients {
if client.GetServerState() == lsp.StateStarting {
initializing = true
break
}
}
// If any server is initializing, show that status
if initializing {
return lipgloss.NewStyle().
Background(styles.BackgroundDarker).
Foreground(styles.Peach).
Render(fmt.Sprintf("%s Initializing LSP...", styles.SpinnerIcon))
}
errorDiagnostics := []protocol.Diagnostic{}
warnDiagnostics := []protocol.Diagnostic{}
hintDiagnostics := []protocol.Diagnostic{}
infoDiagnostics := []protocol.Diagnostic{}
for _, client := range m.lspClients {
for _, d := range client.GetDiagnostics() {
for _, diag := range d {
switch diag.Severity {
case protocol.SeverityError:
errorDiagnostics = append(errorDiagnostics, diag)
case protocol.SeverityWarning:
warnDiagnostics = append(warnDiagnostics, diag)
case protocol.SeverityHint:
hintDiagnostics = append(hintDiagnostics, diag)
case protocol.SeverityInformation:
infoDiagnostics = append(infoDiagnostics, diag)
}
}
}
}
if len(errorDiagnostics) == 0 && len(warnDiagnostics) == 0 && len(hintDiagnostics) == 0 && len(infoDiagnostics) == 0 {
return "No diagnostics"
}
diagnostics := []string{}
if len(errorDiagnostics) > 0 {
errStr := lipgloss.NewStyle().
Background(styles.BackgroundDarker).
Foreground(styles.Error).
Render(fmt.Sprintf("%s %d", styles.ErrorIcon, len(errorDiagnostics)))
diagnostics = append(diagnostics, errStr)
}
if len(warnDiagnostics) > 0 {
warnStr := lipgloss.NewStyle().
Background(styles.BackgroundDarker).
Foreground(styles.Warning).
Render(fmt.Sprintf("%s %d", styles.WarningIcon, len(warnDiagnostics)))
diagnostics = append(diagnostics, warnStr)
}
if len(hintDiagnostics) > 0 {
hintStr := lipgloss.NewStyle().
Background(styles.BackgroundDarker).
Foreground(styles.Text).
Render(fmt.Sprintf("%s %d", styles.HintIcon, len(hintDiagnostics)))
diagnostics = append(diagnostics, hintStr)
}
if len(infoDiagnostics) > 0 {
infoStr := lipgloss.NewStyle().
Background(styles.BackgroundDarker).
Foreground(styles.Peach).
Render(fmt.Sprintf("%s %d", styles.InfoIcon, len(infoDiagnostics)))
diagnostics = append(diagnostics, infoStr)
}
return strings.Join(diagnostics, " ")
}
func (m statusCmp) availableFooterMsgWidth(diagnostics string) int {
tokens := ""
tokensWidth := 0
if m.session.ID != "" {
tokens = formatTokensAndCost(m.session.PromptTokens+m.session.CompletionTokens, m.session.Cost)
tokensWidth = lipgloss.Width(tokens) + 2
}
return max(0, m.width-lipgloss.Width(helpWidget)-lipgloss.Width(m.model())-lipgloss.Width(diagnostics)-tokensWidth)
}
func (m statusCmp) model() string {
cfg := config.Get()
coder, ok := cfg.Agents[config.AgentCoder]
if !ok {
return "Unknown"
}
model := models.SupportedModels[coder.Model]
return styles.Padded.Background(styles.Grey).Foreground(styles.Text).Render(model.Name)
}
func (m statusCmp) SetHelpMsg(s string) {
helpWidget = styles.Padded.Background(styles.Forground).Foreground(styles.BackgroundDarker).Bold(true).Render(s)
}
func NewStatusCmp(lspClients map[string]*lsp.Client) StatusCmp {
return &statusCmp{
messageTTL: 10 * time.Second,
lspClients: lspClients,
}
}

Some files were not shown because too many files have changed in this diff Show More