diff --git a/.github/workflows/notify-discord.yml b/.github/workflows/notify-discord.yml
new file mode 100644
index 0000000000..c9032c301e
--- /dev/null
+++ b/.github/workflows/notify-discord.yml
@@ -0,0 +1,14 @@
+name: discord
+
+on:
+ release:
+ types: [published] # fires only when a release is published
+
+jobs:
+ notify:
+ runs-on: ubuntu-latest
+ steps:
+ - name: Send nicely-formatted embed to Discord
+ uses: SethCohen/github-releases-to-discord@v1
+ with:
+ webhook_url: ${{ secrets.DISCORD_WEBHOOK }}
diff --git a/.github/workflows/opencode.yml b/.github/workflows/opencode.yml
new file mode 100644
index 0000000000..b2d5dacc1a
--- /dev/null
+++ b/.github/workflows/opencode.yml
@@ -0,0 +1,24 @@
+name: opencode
+
+on:
+ issue_comment:
+ types: [created]
+
+jobs:
+ opencode:
+ if: startsWith(github.event.comment.body, 'hey opencode')
+ runs-on: ubuntu-latest
+ permissions:
+ id-token: write
+ steps:
+ - name: Checkout repository
+ uses: actions/checkout@v4
+ with:
+ fetch-depth: 1
+
+ - name: Run opencode
+ uses: sst/opencode/sdks/github@github-v1
+ env:
+ ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }}
+ with:
+ model: anthropic/claude-sonnet-4-20250514
diff --git a/.github/workflows/publish-github-action.yml b/.github/workflows/publish-github-action.yml
new file mode 100644
index 0000000000..e4b4ae7589
--- /dev/null
+++ b/.github/workflows/publish-github-action.yml
@@ -0,0 +1,29 @@
+name: publish-github-action
+
+on:
+ workflow_dispatch:
+
+concurrency: ${{ github.workflow }}-${{ github.ref }}
+
+permissions:
+ contents: write
+
+jobs:
+ publish:
+ runs-on: ubuntu-latest
+ steps:
+ - uses: actions/checkout@v3
+ with:
+ fetch-depth: 0
+
+ - run: git fetch --force --tags
+
+ - uses: oven-sh/setup-bun@v2
+ with:
+ bun-version: 1.2.17
+
+ - name: Publish
+ run: |
+ git config --global user.email "opencode@sst.dev"
+ git config --global user.name "opencode"
+ ./scripts/publish-github-action.ts
diff --git a/AGENTS.md b/AGENTS.md
new file mode 100644
index 0000000000..d6aaf1bd96
--- /dev/null
+++ b/AGENTS.md
@@ -0,0 +1,15 @@
+# TUI Agent Guidelines
+
+## Style
+
+- prefer single word variable/function names
+- avoid try catch where possible - prefer to let exceptions bubble up
+- avoid else statements where possible
+- do not make useless helper functions - inline functionality unless the
+ function is reusable or composable
+- prefer Bun apis
+
+## Workflow
+
+- you can regenerate the golang sdk by calling ./scripts/stainless.ts
+- we use bun for everything
diff --git a/README.md b/README.md
index 5015bd77c0..87afde2d45 100644
--- a/README.md
+++ b/README.md
@@ -1 +1,110 @@
-# Test Project for Git Status Bar
+
+
+
+
+
+
+
+
+
+AI coding agent, built for the terminal.
+
+
+
+
+
+
+[](https://opencode.ai)
+
+---
+
+### Installation
+
+```bash
+# YOLO
+curl -fsSL https://opencode.ai/install | bash
+
+# Package managers
+npm i -g opencode-ai@latest # or bun/pnpm/yarn
+brew install sst/tap/opencode # macOS
+paru -S opencode-bin # Arch Linux
+```
+
+> [!TIP]
+> Remove versions older than 0.1.x before installing.
+
+#### Installation Directory
+
+The install script respects the following priority order for the installation path:
+
+1. `$OPENCODE_INSTALL_DIR` - Custom installation directory
+2. `$XDG_BIN_DIR` - XDG Base Directory Specification compliant path
+3. `$HOME/bin` - Standard user binary directory (if exists or can be created)
+4. `$HOME/.opencode/bin` - Default fallback
+
+```bash
+# Examples
+OPENCODE_INSTALL_DIR=/usr/local/bin curl -fsSL https://opencode.ai/install | bash
+XDG_BIN_DIR=$HOME/.local/bin curl -fsSL https://opencode.ai/install | bash
+```
+
+### Documentation
+
+For more info on how to configure opencode [**head over to our docs**](https://opencode.ai/docs).
+
+### Contributing
+
+opencode is an opinionated tool so any fundamental feature needs to go through a
+design process with the core team.
+
+> [!IMPORTANT]
+> We do not accept PRs for core features.
+
+However we still merge a ton of PRs - you can contribute:
+
+- Bug fixes
+- Improvements to LLM performance
+- Support for new providers
+- Fixes for env specific quirks
+- Missing standard behavior
+- Documentation
+
+Take a look at the git history to see what kind of PRs we end up merging.
+
+> [!NOTE]
+> If you do not follow the above guidelines we might close your PR.
+
+To run opencode locally you need.
+
+- Bun
+- Golang 1.24.x
+
+And run.
+
+```bash
+$ bun install
+$ bun run packages/opencode/src/index.ts
+```
+
+#### Development Notes
+
+**API Client**: After making changes to the TypeScript API endpoints in `packages/opencode/src/server/server.ts`, you will need the opencode team to generate a new stainless sdk for the clients.
+
+### FAQ
+
+#### How is this different than Claude Code?
+
+It's very similar to Claude Code in terms of capability. Here are the key differences:
+
+- 100% open source
+- Not coupled to any provider. Although Anthropic is recommended, opencode can be used with OpenAI, Google or even local models. As models evolve the gaps between them will close and pricing will drop so being provider agnostic is important.
+- A focus on TUI. opencode is built by neovim users and the creators of [terminal.shop](https://terminal.shop); we are going to push the limits of what's possible in the terminal.
+- A client/server architecture. This for example can allow opencode to run on your computer, while you can drive it remotely from a mobile app. Meaning that the TUI frontend is just one of the possible clients.
+
+#### What's the other repo?
+
+The other confusingly named repo has no relation to this one. You can [read the story behind it here](https://x.com/thdxr/status/1933561254481666466).
+
+---
+
+**Join our community** [Discord](https://discord.gg/opencode) | [YouTube](https://www.youtube.com/c/sst-dev) | [X.com](https://x.com/SST_dev)
diff --git a/STATS.md b/STATS.md
index a22d456655..8934a87833 100644
--- a/STATS.md
+++ b/STATS.md
@@ -1,15 +1,23 @@
# Download Stats
-| Date | GitHub Downloads | npm Downloads | Total |
-| ---------- | ---------------- | --------------- | ----------------- |
-| 2025-06-29 | 18,789 (+0) | 39,420 (+0) | 58,209 (+0) |
-| 2025-06-30 | 20,127 (+1,338) | 41,059 (+1,639) | 61,186 (+2,977) |
-| 2025-07-01 | 22,108 (+1,981) | 43,745 (+2,686) | 65,853 (+4,667) |
-| 2025-07-02 | 24,814 (+2,706) | 46,168 (+2,423) | 70,982 (+5,129) |
-| 2025-07-03 | 27,834 (+3,020) | 49,955 (+3,787) | 77,789 (+6,807) |
-| 2025-07-04 | 30,608 (+2,774) | 54,758 (+4,803) | 85,366 (+7,577) |
-| 2025-07-05 | 32,524 (+1,916) | 58,371 (+3,613) | 90,895 (+5,529) |
-| 2025-07-06 | 33,766 (+1,242) | 59,694 (+1,323) | 93,460 (+2,565) |
-| 2025-07-08 | 38,052 (+4,286) | 64,468 (+4,774) | 102,520 (+9,060) |
-| 2025-07-10 | 43,796 (+5,744) | 71,402 (+6,934) | 115,198 (+12,678) |
-| 2025-07-11 | 46,982 (+3,186) | 77,462 (+6,060) | 124,444 (+9,246) |
+| Date | GitHub Downloads | npm Downloads | Total |
+| ---------- | ---------------- | ---------------- | ----------------- |
+| 2025-06-29 | 18,789 (+0) | 39,420 (+0) | 58,209 (+0) |
+| 2025-06-30 | 20,127 (+1,338) | 41,059 (+1,639) | 61,186 (+2,977) |
+| 2025-07-01 | 22,108 (+1,981) | 43,745 (+2,686) | 65,853 (+4,667) |
+| 2025-07-02 | 24,814 (+2,706) | 46,168 (+2,423) | 70,982 (+5,129) |
+| 2025-07-03 | 27,834 (+3,020) | 49,955 (+3,787) | 77,789 (+6,807) |
+| 2025-07-04 | 30,608 (+2,774) | 54,758 (+4,803) | 85,366 (+7,577) |
+| 2025-07-05 | 32,524 (+1,916) | 58,371 (+3,613) | 90,895 (+5,529) |
+| 2025-07-06 | 33,766 (+1,242) | 59,694 (+1,323) | 93,460 (+2,565) |
+| 2025-07-08 | 38,052 (+4,286) | 64,468 (+4,774) | 102,520 (+9,060) |
+| 2025-07-10 | 43,796 (+5,744) | 71,402 (+6,934) | 115,198 (+12,678) |
+| 2025-07-11 | 46,982 (+3,186) | 77,462 (+6,060) | 124,444 (+9,246) |
+| 2025-07-12 | 49,302 (+2,320) | 82,177 (+4,715) | 131,479 (+7,035) |
+| 2025-07-13 | 50,803 (+1,501) | 86,394 (+4,217) | 137,197 (+5,718) |
+| 2025-07-14 | 53,283 (+2,480) | 87,860 (+1,466) | 141,143 (+3,946) |
+| 2025-07-15 | 57,590 (+4,307) | 91,036 (+3,176) | 148,626 (+7,483) |
+| 2025-07-16 | 62,313 (+4,723) | 95,258 (+4,222) | 157,571 (+8,945) |
+| 2025-07-17 | 66,684 (+4,371) | 100,048 (+4,790) | 166,732 (+9,161) |
+| 2025-07-18 | 70,379 (+3,695) | 102,587 (+2,539) | 172,966 (+6,234) |
+| 2025-07-18 | 70,380 (+1) | 102,587 (+0) | 172,967 (+1) |
diff --git a/bun.lock b/bun.lock
index e7675ded1f..f789eb74ef 100644
--- a/bun.lock
+++ b/bun.lock
@@ -30,38 +30,34 @@
},
"dependencies": {
"@clack/prompts": "0.11.0",
- "@flystorage/file-storage": "1.1.0",
- "@flystorage/local-fs": "1.1.0",
- "@hono/zod-validator": "0.5.0",
+ "@hono/zod-validator": "0.4.2",
+ "@modelcontextprotocol/sdk": "1.15.1",
"@openauthjs/openauth": "0.4.3",
- "@standard-schema/spec": "1.0.0",
"ai": "catalog:",
"decimal.js": "10.5.0",
"diff": "8.0.2",
- "env-paths": "3.0.0",
"hono": "4.7.10",
"hono-openapi": "0.4.8",
"isomorphic-git": "1.32.1",
"open": "10.1.2",
"remeda": "2.22.3",
- "ts-lsp-client": "1.0.3",
"turndown": "7.2.0",
"vscode-jsonrpc": "8.2.1",
- "vscode-languageclient": "8",
"xdg-basedir": "5.1.0",
"yargs": "18.0.0",
"zod": "catalog:",
- "zod-openapi": "4.2.4",
- "zod-validation-error": "3.5.2",
+ "zod-openapi": "4.1.0",
},
"devDependencies": {
"@ai-sdk/amazon-bedrock": "2.2.10",
"@ai-sdk/anthropic": "1.2.12",
+ "@standard-schema/spec": "1.0.0",
"@tsconfig/bun": "1.0.7",
"@types/bun": "latest",
"@types/turndown": "5.0.5",
"@types/yargs": "17.0.33",
"typescript": "catalog:",
+ "vscode-languageserver-types": "3.17.5",
"zod-to-json-schema": "3.24.5",
},
},
@@ -85,6 +81,7 @@
"marked": "15.0.12",
"marked-shiki": "1.2.0",
"rehype-autolink-headings": "7.1.0",
+ "remeda": "2.26.0",
"sharp": "0.32.5",
"shiki": "3.4.2",
"solid-js": "1.9.7",
@@ -103,7 +100,7 @@
],
"catalog": {
"@types/node": "22.13.9",
- "ai": "5.0.0-beta.7",
+ "ai": "5.0.0-beta.21",
"typescript": "5.8.2",
"zod": "3.25.49",
},
@@ -112,19 +109,19 @@
"@ai-sdk/anthropic": ["@ai-sdk/anthropic@1.2.12", "", { "dependencies": { "@ai-sdk/provider": "1.1.3", "@ai-sdk/provider-utils": "2.2.8" }, "peerDependencies": { "zod": "^3.0.0" } }, "sha512-YSzjlko7JvuiyQFmI9RN1tNZdEiZxc+6xld/0tq/VkJaHpEzGAb1yiNxxvmYVcjvfu/PcvCxAAYXmTYQQ63IHQ=="],
- "@ai-sdk/gateway": ["@ai-sdk/gateway@1.0.0-beta.3", "", { "dependencies": { "@ai-sdk/provider": "2.0.0-beta.1", "@ai-sdk/provider-utils": "3.0.0-beta.2" }, "peerDependencies": { "zod": "^3.25.49" } }, "sha512-g49gMSkXy94lYvl5LRh438OR/0JCG6ol0jV+iLot7cy5HLltZlGocEuauETBu4b10mDXOd7XIjTEZoQpYFMYLQ=="],
+ "@ai-sdk/gateway": ["@ai-sdk/gateway@1.0.0-beta.8", "", { "dependencies": { "@ai-sdk/provider": "2.0.0-beta.1", "@ai-sdk/provider-utils": "3.0.0-beta.3" }, "peerDependencies": { "zod": "^3.25.49 || ^4" } }, "sha512-D2SqYRT/42JTiRxUuiWtn5cYQFscpb9Z14UNvJx7lnurBUXx57zy7TbLH0h7O+WbCluTQN5G6146JpUZ/SRyzw=="],
"@ai-sdk/provider": ["@ai-sdk/provider@2.0.0-beta.1", "", { "dependencies": { "json-schema": "^0.4.0" } }, "sha512-Z8SPncMtS3RsoXITmT7NVwrAq6M44dmw0DoUOYJqNNtCu8iMWuxB8Nxsoqpa0uEEy9R1V1ZThJAXTYgjTUxl3w=="],
- "@ai-sdk/provider-utils": ["@ai-sdk/provider-utils@3.0.0-beta.2", "", { "dependencies": { "@ai-sdk/provider": "2.0.0-beta.1", "@standard-schema/spec": "^1.0.0", "eventsource-parser": "^3.0.3", "zod-to-json-schema": "^3.24.1" }, "peerDependencies": { "zod": "^3.25.49" } }, "sha512-H4K+4weOVgWqrDDeAbQWoA4U5mN4WrQPHQFdH7ynQYcnhj/pzctU9Q6mGlR5ESMWxaXxazxlOblSITlXo9bahA=="],
+ "@ai-sdk/provider-utils": ["@ai-sdk/provider-utils@3.0.0-beta.3", "", { "dependencies": { "@ai-sdk/provider": "2.0.0-beta.1", "@standard-schema/spec": "^1.0.0", "eventsource-parser": "^3.0.3", "zod-to-json-schema": "^3.24.1" }, "peerDependencies": { "zod": "^3.25.49 || ^4" } }, "sha512-4gZ392GxjzMF7TnReF2eTKhOSyiSS3ydRVq4I7jxkeV5sdEuMoH3gzfItmlctsqGxlMU1/+zKPwl5yYz9O2dzg=="],
"@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/cloudflare": ["@astrojs/cloudflare@12.5.4", "", { "dependencies": { "@astrojs/internal-helpers": "0.6.1", "@astrojs/underscore-redirects": "0.6.1", "@cloudflare/workers-types": "^4.20250507.0", "tinyglobby": "^0.2.13", "vite": "^6.3.5", "wrangler": "^4.14.1" }, "peerDependencies": { "astro": "^5.0.0" } }, "sha512-WKUeMP2tIbddEu0tlVEPj8o9m/8CJB6who3a3jupuIyR56ltmW924ZOMYtp/C9uxH7KeDJXrMszRj3LHs9U97w=="],
+ "@astrojs/cloudflare": ["@astrojs/cloudflare@12.6.0", "", { "dependencies": { "@astrojs/internal-helpers": "0.6.1", "@astrojs/underscore-redirects": "1.0.0", "@cloudflare/workers-types": "^4.20250507.0", "tinyglobby": "^0.2.13", "vite": "^6.3.5", "wrangler": "^4.14.1" }, "peerDependencies": { "astro": "^5.0.0" } }, "sha512-pQ8bokC59GEiXvyXpC4swBNoL7C/EknP+82KFzQwgR/Aeo5N1oPiAoPHgJbpPya/YF4E26WODdCQfBQDvLRfuw=="],
- "@astrojs/compiler": ["@astrojs/compiler@2.12.0", "", {}, "sha512-7bCjW6tVDpUurQLeKBUN9tZ5kSv5qYrGmcn0sG0IwacL7isR2ZbyyA3AdZ4uxsuUFOS2SlgReTH7wkxO6zpqWA=="],
+ "@astrojs/compiler": ["@astrojs/compiler@2.12.2", "", {}, "sha512-w2zfvhjNCkNMmMMOn5b0J8+OmUaBL1o40ipMvqcG6NRpdC+lKxmTi48DT8Xw0SzJ3AfmeFLB45zXZXtmbsjcgw=="],
"@astrojs/internal-helpers": ["@astrojs/internal-helpers@0.6.1", "", {}, "sha512-l5Pqf6uZu31aG+3Lv8nl/3s4DbUzdlxTWDof4pEpto6GUJNhhCbelVi9dEyurOVyqaelwmS9oSyOWOENSfgo9A=="],
@@ -134,7 +131,7 @@
"@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/sitemap": ["@astrojs/sitemap@3.4.1", "", { "dependencies": { "sitemap": "^8.0.0", "stream-replace-string": "^2.0.0", "zod": "^3.24.2" } }, "sha512-VjZvr1e4FH6NHyyHXOiQgLiw94LnCVY4v06wN/D0gZKchTMkg71GrAHJz81/huafcmavtLkIv26HnpfDq6/h/Q=="],
"@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=="],
@@ -142,24 +139,26 @@
"@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=="],
- "@astrojs/underscore-redirects": ["@astrojs/underscore-redirects@0.6.1", "", {}, "sha512-4bMLrs2KW+8/vHEE5Ffv2HbxCbbgXO+2N6MpoCsMXUlUoi7pgEEx8kbkzMXJ2dZtWF3gvwm9lvgjnFeanC2LGg=="],
+ "@astrojs/underscore-redirects": ["@astrojs/underscore-redirects@1.0.0", "", {}, "sha512-qZxHwVnmb5FXuvRsaIGaqWgnftjCuMY+GSbaVZdBmE4j8AfgPqKPxYp8SUERyJcjpKCEmO4wD6ybuGH8A2kVRQ=="],
"@aws-crypto/crc32": ["@aws-crypto/crc32@5.2.0", "", { "dependencies": { "@aws-crypto/util": "^5.2.0", "@aws-sdk/types": "^3.222.0", "tslib": "^2.6.2" } }, "sha512-nLbCWqQNgUiwwtFsen1AdzAtvuLRsQS8rYgMuxCrdKf9kOssamGLuPwyTY9wyYblNr9+1XM8v6zoDTPPSIeANg=="],
"@aws-crypto/util": ["@aws-crypto/util@5.2.0", "", { "dependencies": { "@aws-sdk/types": "^3.222.0", "@smithy/util-utf8": "^2.0.0", "tslib": "^2.6.2" } }, "sha512-4RkU9EsI6ZpBve5fseQlGNUWKMa1RLPQ1dnjnQoe07ldfIzcsGb5hC5W0Dm7u423KWzawlrpbjXBrXCEv9zazQ=="],
- "@aws-sdk/types": ["@aws-sdk/types@3.821.0", "", { "dependencies": { "@smithy/types": "^4.3.1", "tslib": "^2.6.2" } }, "sha512-Znroqdai1a90TlxGaJ+FK1lwC0fHpo97Xjsp5UKGR5JODYm7f9+/fF17ebO1KdoBr/Rm0UIFiF5VmI8ts9F1eA=="],
+ "@aws-sdk/types": ["@aws-sdk/types@3.840.0", "", { "dependencies": { "@smithy/types": "^4.3.1", "tslib": "^2.6.2" } }, "sha512-xliuHaUFZxEx1NSXeLLZ9Dyu6+EJVQKEoD+yM+zqUo3YDZ7medKJWY6fIOKiPX/N7XbLdBYwajb15Q7IL8KkeA=="],
"@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/compat-data": ["@babel/compat-data@7.28.0", "", {}, "sha512-60X7qkglvrap8mn1lh2ebxXdZYtUcpd7gsmy9kLaBJ4i/WdY8PqTSdxyA8qraikqKQK5C1KRBKXqznrVapyNaw=="],
- "@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/core": ["@babel/core@7.28.0", "", { "dependencies": { "@ampproject/remapping": "^2.2.0", "@babel/code-frame": "^7.27.1", "@babel/generator": "^7.28.0", "@babel/helper-compilation-targets": "^7.27.2", "@babel/helper-module-transforms": "^7.27.3", "@babel/helpers": "^7.27.6", "@babel/parser": "^7.28.0", "@babel/template": "^7.27.2", "@babel/traverse": "^7.28.0", "@babel/types": "^7.28.0", "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-UlLAnTPrFdNGoFtbSXwcGFQBtQZJCNjaN6hQNP3UPvuNXT1i82N26KL3dZeIpNalWywr9IuQuncaAfUaS1g6sQ=="],
- "@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/generator": ["@babel/generator@7.28.0", "", { "dependencies": { "@babel/parser": "^7.28.0", "@babel/types": "^7.28.0", "@jridgewell/gen-mapping": "^0.3.12", "@jridgewell/trace-mapping": "^0.3.28", "jsesc": "^3.0.2" } }, "sha512-lJjzvrbEeWrhB4P3QBsH7tey117PjLZnDbLiQEKjQ/fNJTjuq4HSqgFA+UNSwZT8D7dxxbnuSBMsa1lrWzKlQg=="],
"@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-globals": ["@babel/helper-globals@7.28.0", "", {}, "sha512-+W6cISkXFa1jXsDEdYA8HeevQT/FULhxzR99pxphltZcVaugps53THCeiWA8SguxxpSp3gKPiuYfSWopkLQ4hw=="],
+
"@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=="],
@@ -172,19 +171,19 @@
"@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/helpers": ["@babel/helpers@7.27.6", "", { "dependencies": { "@babel/template": "^7.27.2", "@babel/types": "^7.27.6" } }, "sha512-muE8Tt8M22638HU31A3CgfSUciwz1fhATfoVai05aPXGor//CdWDCbnlY1yvBPo07njuVOCNGCSp/GTt12lIug=="],
- "@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/parser": ["@babel/parser@7.28.0", "", { "dependencies": { "@babel/types": "^7.28.0" }, "bin": "./bin/babel-parser.js" }, "sha512-jVZGvOxOuNSsuQuLRTh13nU0AogFlw32w/MT+LV6D3sP5WdbW61E77RnkbaO2dUvmPAYrBDJXGn5gGS6tH4j8g=="],
"@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/runtime": ["@babel/runtime@7.27.6", "", {}, "sha512-vbavdySgbTTrmFE+EsiqUTzlOr5bzlnJtUv9PynGCAKvfQqjIXbvFdumPM/GxMDfyuGMJaJAU6TO4zc1Jf1i8Q=="],
"@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/traverse": ["@babel/traverse@7.28.0", "", { "dependencies": { "@babel/code-frame": "^7.27.1", "@babel/generator": "^7.28.0", "@babel/helper-globals": "^7.28.0", "@babel/parser": "^7.28.0", "@babel/template": "^7.27.2", "@babel/types": "^7.28.0", "debug": "^4.3.1" } }, "sha512-mGe7UK5wWyh0bKRfupsUchrQGqvDbZDbKJw+kcRGSmdHVYrv+ltd0pnpDTVpiTqnaBru9iEvA8pz8W46v0Amwg=="],
- "@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=="],
+ "@babel/types": ["@babel/types@7.28.1", "", { "dependencies": { "@babel/helper-string-parser": "^7.27.1", "@babel/helper-validator-identifier": "^7.27.1" } }, "sha512-x0LvFTekgSX+83TI28Y9wYPUfzrnl2aT5+5QLnO6v7mSJYtEEevuDRN0F0uSHRk1G1IWZC43o00Y0xDDrpBGPQ=="],
"@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=="],
@@ -194,17 +193,17 @@
"@cloudflare/kv-asset-handler": ["@cloudflare/kv-asset-handler@0.4.0", "", { "dependencies": { "mime": "^3.0.0" } }, "sha512-+tv3z+SPp+gqTIcImN9o0hqE9xyfQjI1XD9pL6NuKjua9B1y7mNYv0S9cP+QEbA4ppVgGZEmKOvHX5G5Ei1CVA=="],
- "@cloudflare/unenv-preset": ["@cloudflare/unenv-preset@2.3.2", "", { "peerDependencies": { "unenv": "2.0.0-rc.17", "workerd": "^1.20250508.0" }, "optionalPeers": ["workerd"] }, "sha512-MtUgNl+QkQyhQvv5bbWP+BpBC1N0me4CHHuP2H4ktmOMKdB/6kkz/lo+zqiA4mEazb4y+1cwyNjVrQ2DWeE4mg=="],
+ "@cloudflare/unenv-preset": ["@cloudflare/unenv-preset@2.3.3", "", { "peerDependencies": { "unenv": "2.0.0-rc.17", "workerd": "^1.20250508.0" }, "optionalPeers": ["workerd"] }, "sha512-/M3MEcj3V2WHIRSW1eAQBPRJ6JnGQHc6JKMAPLkDb7pLs3m6X9ES/+K3ceGqxI6TKeF32AWAi7ls0AYzVxCP0A=="],
- "@cloudflare/workerd-darwin-64": ["@cloudflare/workerd-darwin-64@1.20250525.0", "", { "os": "darwin", "cpu": "x64" }, "sha512-L5l+7sSJJT2+riR5rS3Q3PKNNySPjWfRIeaNGMVRi1dPO6QPi4lwuxfRUFNoeUdilZJUVPfSZvTtj9RedsKznQ=="],
+ "@cloudflare/workerd-darwin-64": ["@cloudflare/workerd-darwin-64@1.20250709.0", "", { "os": "darwin", "cpu": "x64" }, "sha512-VqwcvnbI8FNCP87ZWNHA3/sAC5U9wMbNnjBG0sHEYzM7B9RPHKYHdVKdBEWhzZXnkQYMK81IHm4CZsK16XxAuQ=="],
- "@cloudflare/workerd-darwin-arm64": ["@cloudflare/workerd-darwin-arm64@1.20250525.0", "", { "os": "darwin", "cpu": "arm64" }, "sha512-Y3IbIdrF/vJWh/WBvshwcSyUh175VAiLRW7963S1dXChrZ1N5wuKGQm9xY69cIGVtitpMJWWW3jLq7J/Xxwm0Q=="],
+ "@cloudflare/workerd-darwin-arm64": ["@cloudflare/workerd-darwin-arm64@1.20250709.0", "", { "os": "darwin", "cpu": "arm64" }, "sha512-A54ttSgXMM4huChPTThhkieOjpDxR+srVOO9zjTHVIyoQxA8zVsku4CcY/GQ95RczMV+yCKVVu/tAME7vwBFuA=="],
- "@cloudflare/workerd-linux-64": ["@cloudflare/workerd-linux-64@1.20250525.0", "", { "os": "linux", "cpu": "x64" }, "sha512-KSyQPAby+c6cpENoO0ayCQlY6QIh28l/+QID7VC1SLXfiNHy+hPNsH1vVBTST6CilHVAQSsy9tCZ9O9XECB8yg=="],
+ "@cloudflare/workerd-linux-64": ["@cloudflare/workerd-linux-64@1.20250709.0", "", { "os": "linux", "cpu": "x64" }, "sha512-no4O3OK+VXINIxv99OHJDpIgML2ZssrSvImwLtULzqm+cl4t1PIfXNRUqj89ujTkmad+L9y4G6dBQMPCLnmlGg=="],
- "@cloudflare/workerd-linux-arm64": ["@cloudflare/workerd-linux-arm64@1.20250525.0", "", { "os": "linux", "cpu": "arm64" }, "sha512-Nt0FUxS2kQhJUea4hMCNPaetkrAFDhPnNX/ntwcqVlGgnGt75iaAhupWJbU0GB+gIWlKeuClUUnDZqKbicoKyg=="],
+ "@cloudflare/workerd-linux-arm64": ["@cloudflare/workerd-linux-arm64@1.20250709.0", "", { "os": "linux", "cpu": "arm64" }, "sha512-7cNICk2Qd+m4QGrcmWyAuZJXTHt1ud6isA+dic7Yk42WZmwXhlcUATyvFD9FSQNFcldjuRB4n8JlWEFqZBn+lw=="],
- "@cloudflare/workerd-windows-64": ["@cloudflare/workerd-windows-64@1.20250525.0", "", { "os": "win32", "cpu": "x64" }, "sha512-mwTj+9f3uIa4NEXR1cOa82PjLa6dbrb3J+KCVJFYIaq7e63VxEzOchCXS4tublT2pmOhmFqkgBMXrxozxNkR2Q=="],
+ "@cloudflare/workerd-windows-64": ["@cloudflare/workerd-windows-64@1.20250709.0", "", { "os": "win32", "cpu": "x64" }, "sha512-j1AyO8V/62Q23EJplWgzBlRCqo/diXgox58AbDqSqgyzCBAlvUzXQRDBab/FPNG/erRqt7I1zQhahrBhrM0uLA=="],
"@cloudflare/workers-types": ["@cloudflare/workers-types@4.20250522.0", "", {}, "sha512-9RIffHobc35JWeddzBguGgPa4wLDr5x5F94+0/qy7LiV6pTBQ/M5qGEN9VA16IDT3EUpYI0WKh6VpcmeVEtVtw=="],
@@ -212,79 +211,73 @@
"@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=="],
+ "@emnapi/runtime": ["@emnapi/runtime@1.4.4", "", { "dependencies": { "tslib": "^2.4.0" } }, "sha512-hHyapA4A3gPaDCNfiqyZUStTMqIkKRshqPIuDOXv1hcBnD4U3l8cP0T1HMCfGRxQ6V64TGCcoswChANyOAwbQg=="],
- "@esbuild/aix-ppc64": ["@esbuild/aix-ppc64@0.25.5", "", { "os": "aix", "cpu": "ppc64" }, "sha512-9o3TMmpmftaCMepOdA5k/yDw8SfInyzWWTjYTFCX3kPSDJMROQTb8jg+h9Cnwnmm1vOzvxN7gIfB5V2ewpjtGA=="],
+ "@esbuild/aix-ppc64": ["@esbuild/aix-ppc64@0.25.6", "", { "os": "aix", "cpu": "ppc64" }, "sha512-ShbM/3XxwuxjFiuVBHA+d3j5dyac0aEVVq1oluIDf71hUw0aRF59dV/efUsIwFnR6m8JNM2FjZOzmaZ8yG61kw=="],
- "@esbuild/android-arm": ["@esbuild/android-arm@0.25.5", "", { "os": "android", "cpu": "arm" }, "sha512-AdJKSPeEHgi7/ZhuIPtcQKr5RQdo6OO2IL87JkianiMYMPbCtot9fxPbrMiBADOWWm3T2si9stAiVsGbTQFkbA=="],
+ "@esbuild/android-arm": ["@esbuild/android-arm@0.25.6", "", { "os": "android", "cpu": "arm" }, "sha512-S8ToEOVfg++AU/bHwdksHNnyLyVM+eMVAOf6yRKFitnwnbwwPNqKr3srzFRe7nzV69RQKb5DgchIX5pt3L53xg=="],
- "@esbuild/android-arm64": ["@esbuild/android-arm64@0.25.5", "", { "os": "android", "cpu": "arm64" }, "sha512-VGzGhj4lJO+TVGV1v8ntCZWJktV7SGCs3Pn1GRWI1SBFtRALoomm8k5E9Pmwg3HOAal2VDc2F9+PM/rEY6oIDg=="],
+ "@esbuild/android-arm64": ["@esbuild/android-arm64@0.25.6", "", { "os": "android", "cpu": "arm64" }, "sha512-hd5zdUarsK6strW+3Wxi5qWws+rJhCCbMiC9QZyzoxfk5uHRIE8T287giQxzVpEvCwuJ9Qjg6bEjcRJcgfLqoA=="],
- "@esbuild/android-x64": ["@esbuild/android-x64@0.25.5", "", { "os": "android", "cpu": "x64" }, "sha512-D2GyJT1kjvO//drbRT3Hib9XPwQeWd9vZoBJn+bu/lVsOZ13cqNdDeqIF/xQ5/VmWvMduP6AmXvylO/PIc2isw=="],
+ "@esbuild/android-x64": ["@esbuild/android-x64@0.25.6", "", { "os": "android", "cpu": "x64" }, "sha512-0Z7KpHSr3VBIO9A/1wcT3NTy7EB4oNC4upJ5ye3R7taCc2GUdeynSLArnon5G8scPwaU866d3H4BCrE5xLW25A=="],
- "@esbuild/darwin-arm64": ["@esbuild/darwin-arm64@0.25.5", "", { "os": "darwin", "cpu": "arm64" }, "sha512-GtaBgammVvdF7aPIgH2jxMDdivezgFu6iKpmT+48+F8Hhg5J/sfnDieg0aeG/jfSvkYQU2/pceFPDKlqZzwnfQ=="],
+ "@esbuild/darwin-arm64": ["@esbuild/darwin-arm64@0.25.6", "", { "os": "darwin", "cpu": "arm64" }, "sha512-FFCssz3XBavjxcFxKsGy2DYK5VSvJqa6y5HXljKzhRZ87LvEi13brPrf/wdyl/BbpbMKJNOr1Sd0jtW4Ge1pAA=="],
- "@esbuild/darwin-x64": ["@esbuild/darwin-x64@0.25.5", "", { "os": "darwin", "cpu": "x64" }, "sha512-1iT4FVL0dJ76/q1wd7XDsXrSW+oLoquptvh4CLR4kITDtqi2e/xwXwdCVH8hVHU43wgJdsq7Gxuzcs6Iq/7bxQ=="],
+ "@esbuild/darwin-x64": ["@esbuild/darwin-x64@0.25.6", "", { "os": "darwin", "cpu": "x64" }, "sha512-GfXs5kry/TkGM2vKqK2oyiLFygJRqKVhawu3+DOCk7OxLy/6jYkWXhlHwOoTb0WqGnWGAS7sooxbZowy+pK9Yg=="],
- "@esbuild/freebsd-arm64": ["@esbuild/freebsd-arm64@0.25.5", "", { "os": "freebsd", "cpu": "arm64" }, "sha512-nk4tGP3JThz4La38Uy/gzyXtpkPW8zSAmoUhK9xKKXdBCzKODMc2adkB2+8om9BDYugz+uGV7sLmpTYzvmz6Sw=="],
+ "@esbuild/freebsd-arm64": ["@esbuild/freebsd-arm64@0.25.6", "", { "os": "freebsd", "cpu": "arm64" }, "sha512-aoLF2c3OvDn2XDTRvn8hN6DRzVVpDlj2B/F66clWd/FHLiHaG3aVZjxQX2DYphA5y/evbdGvC6Us13tvyt4pWg=="],
- "@esbuild/freebsd-x64": ["@esbuild/freebsd-x64@0.25.5", "", { "os": "freebsd", "cpu": "x64" }, "sha512-PrikaNjiXdR2laW6OIjlbeuCPrPaAl0IwPIaRv+SMV8CiM8i2LqVUHFC1+8eORgWyY7yhQY+2U2fA55mBzReaw=="],
+ "@esbuild/freebsd-x64": ["@esbuild/freebsd-x64@0.25.6", "", { "os": "freebsd", "cpu": "x64" }, "sha512-2SkqTjTSo2dYi/jzFbU9Plt1vk0+nNg8YC8rOXXea+iA3hfNJWebKYPs3xnOUf9+ZWhKAaxnQNUf2X9LOpeiMQ=="],
- "@esbuild/linux-arm": ["@esbuild/linux-arm@0.25.5", "", { "os": "linux", "cpu": "arm" }, "sha512-cPzojwW2okgh7ZlRpcBEtsX7WBuqbLrNXqLU89GxWbNt6uIg78ET82qifUy3W6OVww6ZWobWub5oqZOVtwolfw=="],
+ "@esbuild/linux-arm": ["@esbuild/linux-arm@0.25.6", "", { "os": "linux", "cpu": "arm" }, "sha512-SZHQlzvqv4Du5PrKE2faN0qlbsaW/3QQfUUc6yO2EjFcA83xnwm91UbEEVx4ApZ9Z5oG8Bxz4qPE+HFwtVcfyw=="],
- "@esbuild/linux-arm64": ["@esbuild/linux-arm64@0.25.5", "", { "os": "linux", "cpu": "arm64" }, "sha512-Z9kfb1v6ZlGbWj8EJk9T6czVEjjq2ntSYLY2cw6pAZl4oKtfgQuS4HOq41M/BcoLPzrUbNd+R4BXFyH//nHxVg=="],
+ "@esbuild/linux-arm64": ["@esbuild/linux-arm64@0.25.6", "", { "os": "linux", "cpu": "arm64" }, "sha512-b967hU0gqKd9Drsh/UuAm21Khpoh6mPBSgz8mKRq4P5mVK8bpA+hQzmm/ZwGVULSNBzKdZPQBRT3+WuVavcWsQ=="],
- "@esbuild/linux-ia32": ["@esbuild/linux-ia32@0.25.5", "", { "os": "linux", "cpu": "ia32" }, "sha512-sQ7l00M8bSv36GLV95BVAdhJ2QsIbCuCjh/uYrWiMQSUuV+LpXwIqhgJDcvMTj+VsQmqAHL2yYaasENvJ7CDKA=="],
+ "@esbuild/linux-ia32": ["@esbuild/linux-ia32@0.25.6", "", { "os": "linux", "cpu": "ia32" }, "sha512-aHWdQ2AAltRkLPOsKdi3xv0mZ8fUGPdlKEjIEhxCPm5yKEThcUjHpWB1idN74lfXGnZ5SULQSgtr5Qos5B0bPw=="],
- "@esbuild/linux-loong64": ["@esbuild/linux-loong64@0.25.5", "", { "os": "linux", "cpu": "none" }, "sha512-0ur7ae16hDUC4OL5iEnDb0tZHDxYmuQyhKhsPBV8f99f6Z9KQM02g33f93rNH5A30agMS46u2HP6qTdEt6Q1kg=="],
+ "@esbuild/linux-loong64": ["@esbuild/linux-loong64@0.25.6", "", { "os": "linux", "cpu": "none" }, "sha512-VgKCsHdXRSQ7E1+QXGdRPlQ/e08bN6WMQb27/TMfV+vPjjTImuT9PmLXupRlC90S1JeNNW5lzkAEO/McKeJ2yg=="],
- "@esbuild/linux-mips64el": ["@esbuild/linux-mips64el@0.25.5", "", { "os": "linux", "cpu": "none" }, "sha512-kB/66P1OsHO5zLz0i6X0RxlQ+3cu0mkxS3TKFvkb5lin6uwZ/ttOkP3Z8lfR9mJOBk14ZwZ9182SIIWFGNmqmg=="],
+ "@esbuild/linux-mips64el": ["@esbuild/linux-mips64el@0.25.6", "", { "os": "linux", "cpu": "none" }, "sha512-WViNlpivRKT9/py3kCmkHnn44GkGXVdXfdc4drNmRl15zVQ2+D2uFwdlGh6IuK5AAnGTo2qPB1Djppj+t78rzw=="],
- "@esbuild/linux-ppc64": ["@esbuild/linux-ppc64@0.25.5", "", { "os": "linux", "cpu": "ppc64" }, "sha512-UZCmJ7r9X2fe2D6jBmkLBMQetXPXIsZjQJCjgwpVDz+YMcS6oFR27alkgGv3Oqkv07bxdvw7fyB71/olceJhkQ=="],
+ "@esbuild/linux-ppc64": ["@esbuild/linux-ppc64@0.25.6", "", { "os": "linux", "cpu": "ppc64" }, "sha512-wyYKZ9NTdmAMb5730I38lBqVu6cKl4ZfYXIs31Baf8aoOtB4xSGi3THmDYt4BTFHk7/EcVixkOV2uZfwU3Q2Jw=="],
- "@esbuild/linux-riscv64": ["@esbuild/linux-riscv64@0.25.5", "", { "os": "linux", "cpu": "none" }, "sha512-kTxwu4mLyeOlsVIFPfQo+fQJAV9mh24xL+y+Bm6ej067sYANjyEw1dNHmvoqxJUCMnkBdKpvOn0Ahql6+4VyeA=="],
+ "@esbuild/linux-riscv64": ["@esbuild/linux-riscv64@0.25.6", "", { "os": "linux", "cpu": "none" }, "sha512-KZh7bAGGcrinEj4qzilJ4hqTY3Dg2U82c8bv+e1xqNqZCrCyc+TL9AUEn5WGKDzm3CfC5RODE/qc96OcbIe33w=="],
- "@esbuild/linux-s390x": ["@esbuild/linux-s390x@0.25.5", "", { "os": "linux", "cpu": "s390x" }, "sha512-K2dSKTKfmdh78uJ3NcWFiqyRrimfdinS5ErLSn3vluHNeHVnBAFWC8a4X5N+7FgVE1EjXS1QDZbpqZBjfrqMTQ=="],
+ "@esbuild/linux-s390x": ["@esbuild/linux-s390x@0.25.6", "", { "os": "linux", "cpu": "s390x" }, "sha512-9N1LsTwAuE9oj6lHMyyAM+ucxGiVnEqUdp4v7IaMmrwb06ZTEVCIs3oPPplVsnjPfyjmxwHxHMF8b6vzUVAUGw=="],
- "@esbuild/linux-x64": ["@esbuild/linux-x64@0.25.5", "", { "os": "linux", "cpu": "x64" }, "sha512-uhj8N2obKTE6pSZ+aMUbqq+1nXxNjZIIjCjGLfsWvVpy7gKCOL6rsY1MhRh9zLtUtAI7vpgLMK6DxjO8Qm9lJw=="],
+ "@esbuild/linux-x64": ["@esbuild/linux-x64@0.25.6", "", { "os": "linux", "cpu": "x64" }, "sha512-A6bJB41b4lKFWRKNrWoP2LHsjVzNiaurf7wyj/XtFNTsnPuxwEBWHLty+ZE0dWBKuSK1fvKgrKaNjBS7qbFKig=="],
- "@esbuild/netbsd-arm64": ["@esbuild/netbsd-arm64@0.25.5", "", { "os": "none", "cpu": "arm64" }, "sha512-pwHtMP9viAy1oHPvgxtOv+OkduK5ugofNTVDilIzBLpoWAM16r7b/mxBvfpuQDpRQFMfuVr5aLcn4yveGvBZvw=="],
+ "@esbuild/netbsd-arm64": ["@esbuild/netbsd-arm64@0.25.6", "", { "os": "none", "cpu": "arm64" }, "sha512-IjA+DcwoVpjEvyxZddDqBY+uJ2Snc6duLpjmkXm/v4xuS3H+3FkLZlDm9ZsAbF9rsfP3zeA0/ArNDORZgrxR/Q=="],
- "@esbuild/netbsd-x64": ["@esbuild/netbsd-x64@0.25.5", "", { "os": "none", "cpu": "x64" }, "sha512-WOb5fKrvVTRMfWFNCroYWWklbnXH0Q5rZppjq0vQIdlsQKuw6mdSihwSo4RV/YdQ5UCKKvBy7/0ZZYLBZKIbwQ=="],
+ "@esbuild/netbsd-x64": ["@esbuild/netbsd-x64@0.25.6", "", { "os": "none", "cpu": "x64" }, "sha512-dUXuZr5WenIDlMHdMkvDc1FAu4xdWixTCRgP7RQLBOkkGgwuuzaGSYcOpW4jFxzpzL1ejb8yF620UxAqnBrR9g=="],
- "@esbuild/openbsd-arm64": ["@esbuild/openbsd-arm64@0.25.5", "", { "os": "openbsd", "cpu": "arm64" }, "sha512-7A208+uQKgTxHd0G0uqZO8UjK2R0DDb4fDmERtARjSHWxqMTye4Erz4zZafx7Di9Cv+lNHYuncAkiGFySoD+Mw=="],
+ "@esbuild/openbsd-arm64": ["@esbuild/openbsd-arm64@0.25.6", "", { "os": "openbsd", "cpu": "arm64" }, "sha512-l8ZCvXP0tbTJ3iaqdNf3pjaOSd5ex/e6/omLIQCVBLmHTlfXW3zAxQ4fnDmPLOB1x9xrcSi/xtCWFwCZRIaEwg=="],
- "@esbuild/openbsd-x64": ["@esbuild/openbsd-x64@0.25.5", "", { "os": "openbsd", "cpu": "x64" }, "sha512-G4hE405ErTWraiZ8UiSoesH8DaCsMm0Cay4fsFWOOUcz8b8rC6uCvnagr+gnioEjWn0wC+o1/TAHt+It+MpIMg=="],
+ "@esbuild/openbsd-x64": ["@esbuild/openbsd-x64@0.25.6", "", { "os": "openbsd", "cpu": "x64" }, "sha512-hKrmDa0aOFOr71KQ/19JC7az1P0GWtCN1t2ahYAf4O007DHZt/dW8ym5+CUdJhQ/qkZmI1HAF8KkJbEFtCL7gw=="],
- "@esbuild/sunos-x64": ["@esbuild/sunos-x64@0.25.5", "", { "os": "sunos", "cpu": "x64" }, "sha512-l+azKShMy7FxzY0Rj4RCt5VD/q8mG/e+mDivgspo+yL8zW7qEwctQ6YqKX34DTEleFAvCIUviCFX1SDZRSyMQA=="],
+ "@esbuild/openharmony-arm64": ["@esbuild/openharmony-arm64@0.25.6", "", { "os": "none", "cpu": "arm64" }, "sha512-+SqBcAWoB1fYKmpWoQP4pGtx+pUUC//RNYhFdbcSA16617cchuryuhOCRpPsjCblKukAckWsV+aQ3UKT/RMPcA=="],
- "@esbuild/win32-arm64": ["@esbuild/win32-arm64@0.25.5", "", { "os": "win32", "cpu": "arm64" }, "sha512-O2S7SNZzdcFG7eFKgvwUEZ2VG9D/sn/eIiz8XRZ1Q/DO5a3s76Xv0mdBzVM5j5R639lXQmPmSo0iRpHqUUrsxw=="],
+ "@esbuild/sunos-x64": ["@esbuild/sunos-x64@0.25.6", "", { "os": "sunos", "cpu": "x64" }, "sha512-dyCGxv1/Br7MiSC42qinGL8KkG4kX0pEsdb0+TKhmJZgCUDBGmyo1/ArCjNGiOLiIAgdbWgmWgib4HoCi5t7kA=="],
- "@esbuild/win32-ia32": ["@esbuild/win32-ia32@0.25.5", "", { "os": "win32", "cpu": "ia32" }, "sha512-onOJ02pqs9h1iMJ1PQphR+VZv8qBMQ77Klcsqv9CNW2w6yLqoURLcgERAIurY6QE63bbLuqgP9ATqajFLK5AMQ=="],
+ "@esbuild/win32-arm64": ["@esbuild/win32-arm64@0.25.6", "", { "os": "win32", "cpu": "arm64" }, "sha512-42QOgcZeZOvXfsCBJF5Afw73t4veOId//XD3i+/9gSkhSV6Gk3VPlWncctI+JcOyERv85FUo7RxuxGy+z8A43Q=="],
- "@esbuild/win32-x64": ["@esbuild/win32-x64@0.25.5", "", { "os": "win32", "cpu": "x64" }, "sha512-TXv6YnJ8ZMVdX+SXWVBo/0p8LTcrUYngpWjvm91TMjjBQii7Oz11Lw5lbDV5Y0TzuhSJHwiH4hEtC1I42mMS0g=="],
+ "@esbuild/win32-ia32": ["@esbuild/win32-ia32@0.25.6", "", { "os": "win32", "cpu": "ia32" }, "sha512-4AWhgXmDuYN7rJI6ORB+uU9DHLq/erBbuMoAuB4VWJTu5KtCgcKYPynF0YI1VkBNuEfjNlLrFr9KZPJzrtLkrQ=="],
- "@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=="],
+ "@esbuild/win32-x64": ["@esbuild/win32-x64@0.25.6", "", { "os": "win32", "cpu": "x64" }, "sha512-NgJPHHbEpLQgDH2MjQu90pzW/5vvXIZ7KOnPyNBm92A6WgZ/7b6fJyUBjoumLqeOQQGqY2QjQxRo97ah4Sj0cA=="],
- "@expressive-code/plugin-frames": ["@expressive-code/plugin-frames@0.41.2", "", { "dependencies": { "@expressive-code/core": "^0.41.2" } }, "sha512-pfy0hkJI4nbaONjmksFDcuHmIuyPTFmi1JpABe4q2ajskiJtfBf+WDAL2pg595R9JNoPrrH5+aT9lbkx2noicw=="],
+ "@expressive-code/core": ["@expressive-code/core@0.41.3", "", { "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-9qzohqU7O0+JwMEEgQhnBPOw5DtsQRBXhW++5fvEywsuX44vCGGof1SL5OvPElvNgaWZ4pFZAFSlkNOkGyLwSQ=="],
- "@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-frames": ["@expressive-code/plugin-frames@0.41.3", "", { "dependencies": { "@expressive-code/core": "^0.41.3" } }, "sha512-rFQtmf/3N2CK3Cq/uERweMTYZnBu+CwxBdHuOftEmfA9iBE7gTVvwpbh82P9ZxkPLvc40UMhYt7uNuAZexycRQ=="],
- "@expressive-code/plugin-text-markers": ["@expressive-code/plugin-text-markers@0.41.2", "", { "dependencies": { "@expressive-code/core": "^0.41.2" } }, "sha512-JFWBz2qYxxJOJkkWf96LpeolbnOqJY95TvwYc0hXIHf9oSWV0h0SY268w/5N3EtQaD9KktzDE+VIVwb9jdb3nw=="],
+ "@expressive-code/plugin-shiki": ["@expressive-code/plugin-shiki@0.41.3", "", { "dependencies": { "@expressive-code/core": "^0.41.3", "shiki": "^3.2.2" } }, "sha512-RlTARoopzhFJIOVHLGvuXJ8DCEme/hjV+ZnRJBIxzxsKVpGPW4Oshqg9xGhWTYdHstTsxO663s0cdBLzZj9TQA=="],
- "@fastify/busboy": ["@fastify/busboy@2.1.1", "", {}, "sha512-vBZP4NlzfOlerQTnba4aqZoMhE/a9HY7HRqoOPaETQcSQuWEIyZMHGfVu6w9wGtGK5fED5qRs2DteVCjOH60sA=="],
+ "@expressive-code/plugin-text-markers": ["@expressive-code/plugin-text-markers@0.41.3", "", { "dependencies": { "@expressive-code/core": "^0.41.3" } }, "sha512-SN8tkIzDpA0HLAscEYD2IVrfLiid6qEdE9QLlGVSxO1KEw7qYvjpbNBQjUjMr5/jvTJ7ys6zysU2vLPHE0sb2g=="],
- "@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=="],
+ "@fastify/busboy": ["@fastify/busboy@2.1.1", "", {}, "sha512-vBZP4NlzfOlerQTnba4aqZoMhE/a9HY7HRqoOPaETQcSQuWEIyZMHGfVu6w9wGtGK5fED5qRs2DteVCjOH60sA=="],
"@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=="],
+ "@hono/zod-validator": ["@hono/zod-validator@0.4.2", "", { "peerDependencies": { "hono": ">=3.9.0", "zod": "^3.19.1" } }, "sha512-1rrlBg+EpDPhzOV4hT9pxr5+xDVmKuz6YJl+la7VCwK6ass5ldyKm5fD+umJdV2zhHD6jROoCCv8NbTwyfhT0g=="],
"@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=="],
@@ -324,13 +317,11 @@
"@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/gen-mapping": ["@jridgewell/gen-mapping@0.3.12", "", { "dependencies": { "@jridgewell/sourcemap-codec": "^1.5.0", "@jridgewell/trace-mapping": "^0.3.24" } }, "sha512-OuLGC46TjB5BbN1dH8JULVVZY4WTdkF7tV9Ys6wLL1rubZnCMstOhNHueU5bLCrnRuDhKPDM4g6sw4Bel5Gzqg=="],
"@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/sourcemap-codec": ["@jridgewell/sourcemap-codec@1.5.4", "", {}, "sha512-VT2+G1VQs/9oz078bLrYbecdZKs912zQlkelYpuf+SXF+QvZDYJlbx/LSx+meSAwdDFnF8FVXW92AVjjkVmgFw=="],
"@jridgewell/trace-mapping": ["@jridgewell/trace-mapping@0.3.9", "", { "dependencies": { "@jridgewell/resolve-uri": "^3.0.3", "@jridgewell/sourcemap-codec": "^1.4.10" } }, "sha512-3Belt6tdc8bPgAtbcmdtNJlirVoTmEb5e2gC94PnkwEW9jI6CAHUeoG85tjWP5WquqfavoMtMwiG4P926ZKKuQ=="],
@@ -340,7 +331,7 @@
"@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=="],
+ "@modelcontextprotocol/sdk": ["@modelcontextprotocol/sdk@1.15.1", "", { "dependencies": { "ajv": "^6.12.6", "content-type": "^1.0.5", "cors": "^2.8.5", "cross-spawn": "^7.0.5", "eventsource": "^3.0.2", "eventsource-parser": "^3.0.0", "express": "^5.0.1", "express-rate-limit": "^7.5.0", "pkce-challenge": "^5.0.0", "raw-body": "^3.0.0", "zod": "^3.23.8", "zod-to-json-schema": "^3.24.1" } }, "sha512-W/XlN9c528yYn+9MQkVjxiTPgPxoxt+oczfjHBDsJx0+59+O7B75Zhsp0B16Xbwbz8ANISDajh6+V7nIcPMc5w=="],
"@octokit/auth-app": ["@octokit/auth-app@8.0.1", "", { "dependencies": { "@octokit/auth-oauth-app": "^9.0.1", "@octokit/auth-oauth-user": "^6.0.0", "@octokit/request": "^10.0.2", "@octokit/request-error": "^7.0.0", "@octokit/types": "^14.0.0", "toad-cache": "^3.7.0", "universal-github-app-jwt": "^2.2.0", "universal-user-agent": "^7.0.0" } }, "sha512-P2J5pB3pjiGwtJX4WqJVYCtNkcZ+j5T2Wm14aJAEIC3WJOrv12jvBley3G1U/XI8q9o1A7QMG54LiFED2BiFlg=="],
@@ -408,47 +399,53 @@
"@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=="],
+ "@poppinss/colors": ["@poppinss/colors@4.1.5", "", { "dependencies": { "kleur": "^4.1.5" } }, "sha512-FvdDqtcRCtz6hThExcFOgW0cWX+xwSMWcRuQe5ZEb2m7cVQOAVZOIMt+/v9RxGiD9/OY16qJBXK4CVKWAPalBw=="],
+
+ "@poppinss/dumper": ["@poppinss/dumper@0.6.4", "", { "dependencies": { "@poppinss/colors": "^4.1.5", "@sindresorhus/is": "^7.0.2", "supports-color": "^10.0.0" } }, "sha512-iG0TIdqv8xJ3Lt9O8DrPRxw1MRLjNpoqiSGU03P/wNLP/s0ra0udPJ1J2Tx5M0J3H/cVyEgpbn8xUKRY9j59kQ=="],
- "@rollup/rollup-android-arm-eabi": ["@rollup/rollup-android-arm-eabi@4.41.1", "", { "os": "android", "cpu": "arm" }, "sha512-NELNvyEWZ6R9QMkiytB4/L4zSEaBC03KIXEghptLGLZWJ6VPrL63ooZQCOnlx36aQPGhzuOMwDerC1Eb2VmrLw=="],
+ "@poppinss/exception": ["@poppinss/exception@1.2.2", "", {}, "sha512-m7bpKCD4QMlFCjA/nKTs23fuvoVFoA83brRKmObCUNmi/9tVu8Ve3w4YQAnJu4q3Tjf5fr685HYIC/IA2zHRSg=="],
- "@rollup/rollup-android-arm64": ["@rollup/rollup-android-arm64@4.41.1", "", { "os": "android", "cpu": "arm64" }, "sha512-DXdQe1BJ6TK47ukAoZLehRHhfKnKg9BjnQYUu9gzhI8Mwa1d2fzxA1aw2JixHVl403bwp1+/o/NhhHtxWJBgEA=="],
+ "@rollup/pluginutils": ["@rollup/pluginutils@5.2.0", "", { "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-qWJ2ZTbmumwiLFomfzTyt5Kng4hwPi9rwCYN4SHb6eaRU1KNO4ccxINHr/VhH4GgPlt1XfSTLX2LBTme8ne4Zw=="],
- "@rollup/rollup-darwin-arm64": ["@rollup/rollup-darwin-arm64@4.41.1", "", { "os": "darwin", "cpu": "arm64" }, "sha512-5afxvwszzdulsU2w8JKWwY8/sJOLPzf0e1bFuvcW5h9zsEg+RQAojdW0ux2zyYAz7R8HvvzKCjLNJhVq965U7w=="],
+ "@rollup/rollup-android-arm-eabi": ["@rollup/rollup-android-arm-eabi@4.45.0", "", { "os": "android", "cpu": "arm" }, "sha512-2o/FgACbji4tW1dzXOqAV15Eu7DdgbKsF2QKcxfG4xbh5iwU7yr5RRP5/U+0asQliSYv5M4o7BevlGIoSL0LXg=="],
- "@rollup/rollup-darwin-x64": ["@rollup/rollup-darwin-x64@4.41.1", "", { "os": "darwin", "cpu": "x64" }, "sha512-egpJACny8QOdHNNMZKf8xY0Is6gIMz+tuqXlusxquWu3F833DcMwmGM7WlvCO9sB3OsPjdC4U0wHw5FabzCGZg=="],
+ "@rollup/rollup-android-arm64": ["@rollup/rollup-android-arm64@4.45.0", "", { "os": "android", "cpu": "arm64" }, "sha512-PSZ0SvMOjEAxwZeTx32eI/j5xSYtDCRxGu5k9zvzoY77xUNssZM+WV6HYBLROpY5CkXsbQjvz40fBb7WPwDqtQ=="],
- "@rollup/rollup-freebsd-arm64": ["@rollup/rollup-freebsd-arm64@4.41.1", "", { "os": "freebsd", "cpu": "arm64" }, "sha512-DBVMZH5vbjgRk3r0OzgjS38z+atlupJ7xfKIDJdZZL6sM6wjfDNo64aowcLPKIx7LMQi8vybB56uh1Ftck/Atg=="],
+ "@rollup/rollup-darwin-arm64": ["@rollup/rollup-darwin-arm64@4.45.0", "", { "os": "darwin", "cpu": "arm64" }, "sha512-BA4yPIPssPB2aRAWzmqzQ3y2/KotkLyZukVB7j3psK/U3nVJdceo6qr9pLM2xN6iRP/wKfxEbOb1yrlZH6sYZg=="],
- "@rollup/rollup-freebsd-x64": ["@rollup/rollup-freebsd-x64@4.41.1", "", { "os": "freebsd", "cpu": "x64" }, "sha512-3FkydeohozEskBxNWEIbPfOE0aqQgB6ttTkJ159uWOFn42VLyfAiyD9UK5mhu+ItWzft60DycIN1Xdgiy8o/SA=="],
+ "@rollup/rollup-darwin-x64": ["@rollup/rollup-darwin-x64@4.45.0", "", { "os": "darwin", "cpu": "x64" }, "sha512-Pr2o0lvTwsiG4HCr43Zy9xXrHspyMvsvEw4FwKYqhli4FuLE5FjcZzuQ4cfPe0iUFCvSQG6lACI0xj74FDZKRA=="],
- "@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-freebsd-arm64": ["@rollup/rollup-freebsd-arm64@4.45.0", "", { "os": "freebsd", "cpu": "arm64" }, "sha512-lYE8LkE5h4a/+6VnnLiL14zWMPnx6wNbDG23GcYFpRW1V9hYWHAw9lBZ6ZUIrOaoK7NliF1sdwYGiVmziUF4vA=="],
- "@rollup/rollup-linux-arm-musleabihf": ["@rollup/rollup-linux-arm-musleabihf@4.41.1", "", { "os": "linux", "cpu": "arm" }, "sha512-jwKCca1gbZkZLhLRtsrka5N8sFAaxrGz/7wRJ8Wwvq3jug7toO21vWlViihG85ei7uJTpzbXZRcORotE+xyrLA=="],
+ "@rollup/rollup-freebsd-x64": ["@rollup/rollup-freebsd-x64@4.45.0", "", { "os": "freebsd", "cpu": "x64" }, "sha512-PVQWZK9sbzpvqC9Q0GlehNNSVHR+4m7+wET+7FgSnKG3ci5nAMgGmr9mGBXzAuE5SvguCKJ6mHL6vq1JaJ/gvw=="],
- "@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-arm-gnueabihf": ["@rollup/rollup-linux-arm-gnueabihf@4.45.0", "", { "os": "linux", "cpu": "arm" }, "sha512-hLrmRl53prCcD+YXTfNvXd776HTxNh8wPAMllusQ+amcQmtgo3V5i/nkhPN6FakW+QVLoUUr2AsbtIRPFU3xIA=="],
- "@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-arm-musleabihf": ["@rollup/rollup-linux-arm-musleabihf@4.45.0", "", { "os": "linux", "cpu": "arm" }, "sha512-XBKGSYcrkdiRRjl+8XvrUR3AosXU0NvF7VuqMsm7s5nRy+nt58ZMB19Jdp1RdqewLcaYnpk8zeVs/4MlLZEJxw=="],
- "@rollup/rollup-linux-loongarch64-gnu": ["@rollup/rollup-linux-loongarch64-gnu@4.41.1", "", { "os": "linux", "cpu": "none" }, "sha512-bkCfDJ4qzWfFRCNt5RVV4DOw6KEgFTUZi2r2RuYhGWC8WhCA8lCAJhDeAmrM/fdiAH54m0mA0Vk2FGRPyzI+tw=="],
+ "@rollup/rollup-linux-arm64-gnu": ["@rollup/rollup-linux-arm64-gnu@4.45.0", "", { "os": "linux", "cpu": "arm64" }, "sha512-fRvZZPUiBz7NztBE/2QnCS5AtqLVhXmUOPj9IHlfGEXkapgImf4W9+FSkL8cWqoAjozyUzqFmSc4zh2ooaeF6g=="],
- "@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-arm64-musl": ["@rollup/rollup-linux-arm64-musl@4.45.0", "", { "os": "linux", "cpu": "arm64" }, "sha512-Btv2WRZOcUGi8XU80XwIvzTg4U6+l6D0V6sZTrZx214nrwxw5nAi8hysaXj/mctyClWgesyuxbeLylCBNauimg=="],
- "@rollup/rollup-linux-riscv64-gnu": ["@rollup/rollup-linux-riscv64-gnu@4.41.1", "", { "os": "linux", "cpu": "none" }, "sha512-3rwCIh6MQ1LGrvKJitQjZFuQnT2wxfU+ivhNBzmxXTXPllewOF7JR1s2vMX/tWtUYFgphygxjqMl76q4aMotGw=="],
+ "@rollup/rollup-linux-loongarch64-gnu": ["@rollup/rollup-linux-loongarch64-gnu@4.45.0", "", { "os": "linux", "cpu": "none" }, "sha512-Li0emNnwtUZdLwHjQPBxn4VWztcrw/h7mgLyHiEI5Z0MhpeFGlzaiBHpSNVOMB/xucjXTTcO+dhv469Djr16KA=="],
- "@rollup/rollup-linux-riscv64-musl": ["@rollup/rollup-linux-riscv64-musl@4.41.1", "", { "os": "linux", "cpu": "none" }, "sha512-LdIUOb3gvfmpkgFZuccNa2uYiqtgZAz3PTzjuM5bH3nvuy9ty6RGc/Q0+HDFrHrizJGVpjnTZ1yS5TNNjFlklw=="],
+ "@rollup/rollup-linux-powerpc64le-gnu": ["@rollup/rollup-linux-powerpc64le-gnu@4.45.0", "", { "os": "linux", "cpu": "ppc64" }, "sha512-sB8+pfkYx2kvpDCfd63d5ScYT0Fz1LO6jIb2zLZvmK9ob2D8DeVqrmBDE0iDK8KlBVmsTNzrjr3G1xV4eUZhSw=="],
- "@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-riscv64-gnu": ["@rollup/rollup-linux-riscv64-gnu@4.45.0", "", { "os": "linux", "cpu": "none" }, "sha512-5GQ6PFhh7E6jQm70p1aW05G2cap5zMOvO0se5JMecHeAdj5ZhWEHbJ4hiKpfi1nnnEdTauDXxPgXae/mqjow9w=="],
- "@rollup/rollup-linux-x64-gnu": ["@rollup/rollup-linux-x64-gnu@4.41.1", "", { "os": "linux", "cpu": "x64" }, "sha512-cWBOvayNvA+SyeQMp79BHPK8ws6sHSsYnK5zDcsC3Hsxr1dgTABKjMnMslPq1DvZIp6uO7kIWhiGwaTdR4Og9A=="],
+ "@rollup/rollup-linux-riscv64-musl": ["@rollup/rollup-linux-riscv64-musl@4.45.0", "", { "os": "linux", "cpu": "none" }, "sha512-N/euLsBd1rekWcuduakTo/dJw6U6sBP3eUq+RXM9RNfPuWTvG2w/WObDkIvJ2KChy6oxZmOSC08Ak2OJA0UiAA=="],
- "@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-linux-s390x-gnu": ["@rollup/rollup-linux-s390x-gnu@4.45.0", "", { "os": "linux", "cpu": "s390x" }, "sha512-2l9sA7d7QdikL0xQwNMO3xURBUNEWyHVHfAsHsUdq+E/pgLTUcCE+gih5PCdmyHmfTDeXUWVhqL0WZzg0nua3g=="],
- "@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-linux-x64-gnu": ["@rollup/rollup-linux-x64-gnu@4.45.0", "", { "os": "linux", "cpu": "x64" }, "sha512-XZdD3fEEQcwG2KrJDdEQu7NrHonPxxaV0/w2HpvINBdcqebz1aL+0vM2WFJq4DeiAVT6F5SUQas65HY5JDqoPw=="],
- "@rollup/rollup-win32-ia32-msvc": ["@rollup/rollup-win32-ia32-msvc@4.41.1", "", { "os": "win32", "cpu": "ia32" }, "sha512-+psFT9+pIh2iuGsxFYYa/LhS5MFKmuivRsx9iPJWNSGbh2XVEjk90fmpUEjCnILPEPJnikAU6SFDiEUyOv90Pg=="],
+ "@rollup/rollup-linux-x64-musl": ["@rollup/rollup-linux-x64-musl@4.45.0", "", { "os": "linux", "cpu": "x64" }, "sha512-7ayfgvtmmWgKWBkCGg5+xTQ0r5V1owVm67zTrsEY1008L5ro7mCyGYORomARt/OquB9KY7LpxVBZes+oSniAAQ=="],
- "@rollup/rollup-win32-x64-msvc": ["@rollup/rollup-win32-x64-msvc@4.41.1", "", { "os": "win32", "cpu": "x64" }, "sha512-Wq2zpapRYLfi4aKxf2Xff0tN+7slj2d4R87WEzqw7ZLsVvO5zwYCIuEGSZYiK41+GlwUo1HiR+GdkLEJnCKTCw=="],
+ "@rollup/rollup-win32-arm64-msvc": ["@rollup/rollup-win32-arm64-msvc@4.45.0", "", { "os": "win32", "cpu": "arm64" }, "sha512-B+IJgcBnE2bm93jEW5kHisqvPITs4ddLOROAcOc/diBgrEiQJJ6Qcjby75rFSmH5eMGrqJryUgJDhrfj942apQ=="],
+
+ "@rollup/rollup-win32-ia32-msvc": ["@rollup/rollup-win32-ia32-msvc@4.45.0", "", { "os": "win32", "cpu": "ia32" }, "sha512-+CXwwG66g0/FpWOnP/v1HnrGVSOygK/osUbu3wPRy8ECXjoYKjRAyfxYpDQOfghC5qPJYLPH0oN4MCOjwgdMug=="],
+
+ "@rollup/rollup-win32-x64-msvc": ["@rollup/rollup-win32-x64-msvc@4.45.0", "", { "os": "win32", "cpu": "x64" }, "sha512-SRf1cytG7wqcHVLrBc9VtPK4pU5wxiB/lNIkNmW2ApKXIg+RpqwHfsaEK+e7eH4A1BpI6BX/aBWXxZCIrJg3uA=="],
"@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=="],
@@ -466,6 +463,8 @@
"@shikijs/vscode-textmate": ["@shikijs/vscode-textmate@10.0.2", "", {}, "sha512-83yeghZ2xxin3Nj8z1NMd/NCuca+gsYXswywDy5bHvwlWL8tpTQmzGeUuHd9FC3E/SBEMvzJRwWEOz5gGes9Qg=="],
+ "@sindresorhus/is": ["@sindresorhus/is@7.0.2", "", {}, "sha512-d9xRovfKNz1SKieM0qJdO+PQonjnnIfSNWfHYnBSJ9hkjm0ZPw6HlxscDXYstp3z+7V2GOFHc+J0CYrYTjqCJw=="],
+
"@smithy/eventstream-codec": ["@smithy/eventstream-codec@4.0.4", "", { "dependencies": { "@aws-crypto/crc32": "5.2.0", "@smithy/types": "^4.3.1", "@smithy/util-hex-encoding": "^4.0.0", "tslib": "^2.6.2" } }, "sha512-7XoWfZqWb/QoR/rAU4VSi0mWnO2vu9/ltS6JZ5ZSZv0eovLVfDfu0/AX4ub33RsJTOth3TiFWSHS5YdztvFnig=="],
"@smithy/is-array-buffer": ["@smithy/is-array-buffer@4.0.0", "", { "dependencies": { "tslib": "^2.6.2" } }, "sha512-saYhF8ZZNoJDTvJBEWgeBccCg+yvp1CX+ed12yORU3NilJScfc6gfch2oVb4QgxZrGUx3/ZJlb+c/dJbyupxlw=="],
@@ -478,14 +477,12 @@
"@smithy/util-utf8": ["@smithy/util-utf8@4.0.0", "", { "dependencies": { "@smithy/util-buffer-from": "^4.0.0", "tslib": "^2.6.2" } }, "sha512-b+zebfKCfRdgNJDknHCob3O7FpeYQN6ZG6YLExMcasDHsCXlsXCEuiPZeLnJLpwa5dvPetGlnGCiMHuLwGvFow=="],
+ "@speed-highlight/core": ["@speed-highlight/core@1.2.7", "", {}, "sha512-0dxmVj4gxg3Jg879kvFS/msl4s9F3T9UXC1InxgOf7t5NvcPD97u/WTA5vL/IxWHMn7qSxBozqrnnE2wvl1m8g=="],
+
"@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=="],
@@ -500,7 +497,7 @@
"@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": ["@types/estree@1.0.8", "", {}, "sha512-dWHzHa2WqEXI/O1E9OjrocMTKJl2mSrEolh1Iomrv6U+JuNwaHXsXx9bLu5gG7BUWFIN0skIQJQ/L1rIex4X6w=="],
"@types/estree-jsx": ["@types/estree-jsx@1.0.5", "", { "dependencies": { "@types/estree": "*" } }, "sha512-52CcUVNFyfb1A2ALocQw/Dd1BQFNmSdkuC3BkZ6iqhdMfQz7JWOFRuJFloOzjk+6WijU56m9oKXFAXc7o3Towg=="],
@@ -540,13 +537,15 @@
"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": ["acorn@8.15.0", "", { "bin": { "acorn": "bin/acorn" } }, "sha512-NZyJarBfL7nWwIq+FDL6Zp/yHEhePMNnnJ0y3qfieCrmNvYct8uvtiV41UvlSe6apAfk0fY1FbWx+NwfmpvtTg=="],
"acorn-jsx": ["acorn-jsx@5.3.2", "", { "peerDependencies": { "acorn": "^6.0.0 || ^7.0.0 || ^8.0.0" } }, "sha512-rq9s+JNhf0IChjtDXxllJ7g41oZk5SlXtp0LHwyA5cejwn7vKmKp4pPri6YEePv2PU65sAsegbXtIinmDFDXgQ=="],
"acorn-walk": ["acorn-walk@8.3.2", "", {}, "sha512-cjkyv4OtNCIeqhHrfS81QWXoCBPExR/J62oyEqepVw8WaQeSqpW2uhuLPh1m9eWhDuOo/jUXVTlifvesOWp/4A=="],
- "ai": ["ai@5.0.0-beta.7", "", { "dependencies": { "@ai-sdk/gateway": "1.0.0-beta.3", "@ai-sdk/provider": "2.0.0-beta.1", "@ai-sdk/provider-utils": "3.0.0-beta.2", "@opentelemetry/api": "1.9.0" }, "peerDependencies": { "zod": "^3.25.49" } }, "sha512-oC4KzUJCQPMB7v9rCqL/rVk2ogZvI6lYiXfKjzPYHwa1zIgy329qqRLmAd3mKEDTTG6By1r0zasQu7FKmG+4gw=="],
+ "ai": ["ai@5.0.0-beta.21", "", { "dependencies": { "@ai-sdk/gateway": "1.0.0-beta.8", "@ai-sdk/provider": "2.0.0-beta.1", "@ai-sdk/provider-utils": "3.0.0-beta.3", "@opentelemetry/api": "1.9.0" }, "peerDependencies": { "zod": "^3.25.49 || ^4" }, "bin": { "ai": "dist/bin/ai.min.js" } }, "sha512-ZmgUoEIXb2G2HLtK1U3UB+hSDa3qrVIeAfgXf3SIE9r5Vqj6xHG1pN/7fHIZDSgb1TCaypG0ANVB0O9WmnMfiw=="],
+
+ "ajv": ["ajv@6.12.6", "", { "dependencies": { "fast-deep-equal": "^3.1.1", "fast-json-stable-stringify": "^2.0.0", "json-schema-traverse": "^0.4.1", "uri-js": "^4.2.2" } }, "sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g=="],
"ansi-align": ["ansi-align@3.0.1", "", { "dependencies": { "string-width": "^4.1.0" } }, "sha512-IOfwwBF5iczOjp/WeY4YxyjqAFMQoZufdQWDd19SEExbVLNXqvpzSJ/M7Za4/sCPmQ0+GRquoA7bGcINcxew6w=="],
@@ -562,24 +561,18 @@
"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=="],
- "as-table": ["as-table@1.0.55", "", { "dependencies": { "printable-characters": "^1.0.42" } }, "sha512-xvsWESUJn0JN421Xb9MQw6AsMHRCUknCe0Wjlxvjud80mU4E6hQf1A6NzQKcYNmYw62MfzEtXc+badstZP3JpQ=="],
-
"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=="],
+ "astro-expressive-code": ["astro-expressive-code@0.41.3", "", { "dependencies": { "rehype-expressive-code": "^0.41.3" }, "peerDependencies": { "astro": "^4.0.0-beta || ^5.0.0-beta || ^3.3.0" } }, "sha512-u+zHMqo/QNLE2eqYRCrK3+XMlKakv33Bzuz+56V1gs8H0y6TZ0hIi3VNbIxeTn51NLn+mJfUV/A0kMNfE4rANw=="],
"async-lock": ["async-lock@1.4.1", "", {}, "sha512-Az2ZTpuytrtqENulXwO3GGv1Bztugx6TT37NIo7imr/Qo0gsYiGtSdBa2B6fsXhTpVZDNfu1Qn3pk531e3q+nQ=="],
- "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=="],
@@ -596,11 +589,9 @@
"bail": ["bail@2.0.2", "", {}, "sha512-0xO6mYd7JB2YesxDKplafRpsiOzPt9V02ddPCLbY1xYGPOX24NTyN50qnUxgCPcSoYMhKpAuBTjQoRZCAkUDRw=="],
- "balanced-match": ["balanced-match@1.0.2", "", {}, "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw=="],
+ "bare-events": ["bare-events@2.6.0", "", {}, "sha512-EKZ5BTXYExaNqi3I3f9RtEsaI/xBSGjE0XZCZilPzFAV/goswFHuPd9jEZlPIZ/iNZJwDSao9qRiScySz7MbQg=="],
- "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-fs": ["bare-fs@4.1.6", "", { "dependencies": { "bare-events": "^2.5.4", "bare-path": "^3.0.0", "bare-stream": "^2.6.4" }, "peerDependencies": { "bare-buffer": "*" }, "optionalPeers": ["bare-buffer"] }, "sha512-25RsLF33BqooOEFNdMcEhMpJy8EoR88zSMrnOQOaM3USnOK2VmaJ1uaQEwPA6AQjrv1lXChScosN6CzbwbO9OQ=="],
"bare-os": ["bare-os@3.6.1", "", {}, "sha512-uaIjxokhFidJP+bmmvKSgiMzj2sV5GPHaZVAIktcxcpCyBFFWO+YlikVAdhmUo2vYFvFhOXIAlldqV29L8126g=="],
@@ -630,11 +621,9 @@
"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=="],
+ "browserslist": ["browserslist@4.25.1", "", { "dependencies": { "caniuse-lite": "^1.0.30001726", "electron-to-chromium": "^1.5.173", "node-releases": "^2.0.19", "update-browserslist-db": "^1.1.3" }, "bin": { "browserslist": "cli.js" } }, "sha512-KGj0KoOMXLpSNkkEI6Z6mShmQy0bc1I+T7K9N81k4WWMrfz+6fQ6es80B/YLAeRoKvjYE1YSHHOW1qe9xIVzHw=="],
"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=="],
@@ -652,7 +641,7 @@
"camelcase": ["camelcase@8.0.0", "", {}, "sha512-8WB3Jcas3swSvjIeA2yvCJ+Miyz5l1ZmB6HFb9R1317dt9LCQoswg/BGrmAmkWVEszSrrg4RwmO46qIm2OEnSA=="],
- "caniuse-lite": ["caniuse-lite@1.0.30001720", "", {}, "sha512-Ec/2yV2nNPwb4DnTANEV99ZWwm3ZWfdlfkQbWSDDt+PsXEVYwlhPH8tdMaPunYTKKmz7AnHi2oNEi1GcmKCD8g=="],
+ "caniuse-lite": ["caniuse-lite@1.0.30001727", "", {}, "sha512-pB68nIHmbN6L/4C6MH1DokyR3bYqFwjaSs/sWDHGj4CTcFtQUQMuJftVwWkXq7mNWOybD3KhUv3oWHoGxgP14Q=="],
"ccount": ["ccount@2.0.1", "", {}, "sha512-eyrF0jiFpY+3drT6383f1qhkbGsLSifNAjA61IUjZjmLCWjItY6LB9ft9YhoDgwfmclB2zhu51Lc7+95b8NRAg=="],
@@ -670,7 +659,7 @@
"chownr": ["chownr@1.1.4", "", {}, "sha512-jJ0bqzaylmJtVnNgzTeSOs8DPavpbYgEr/b0YL8/2GO3xJEhInFmhKMUnEJQjZumK7KXGFhUy89PrsJWlakBVg=="],
- "ci-info": ["ci-info@4.2.0", "", {}, "sha512-cYY9mypksY8NRqgDB1XD1RiJL338v/551niynFTGkZOO2LHuB2OmOYxDIe/ttN9AHwrqdum1360G3ald0W9kCg=="],
+ "ci-info": ["ci-info@4.3.0", "", {}, "sha512-l+2bNRMiQgcfILUi33labAZYIWlH1kWDp+ecNo5iisRKrbm0xcRyCww71/YU0Fkw0mAFpz9bJayXPjey6vkmaQ=="],
"clean-git-ref": ["clean-git-ref@2.0.1", "", {}, "sha512-bLSptAy2P0s6hU4PzuIMKmMJJSE6gLXGH1cntDu7bWJUksvuM+7ReOK61mozULErYvP6a15rnYl0zFDef+pyPw=="],
@@ -714,9 +703,11 @@
"cross-fetch": ["cross-fetch@3.2.0", "", { "dependencies": { "node-fetch": "^2.7.0" } }, "sha512-Q+xVJLoGOeIMXZmbUK4HYk+69cQH6LudR0Vu/pRm2YlU/hDV9CiS0gKUMaWY5f2NeUH9C1nV3bsTlCo0FsTV1Q=="],
+ "cross-spawn": ["cross-spawn@7.0.6", "", { "dependencies": { "path-key": "^3.1.0", "shebang-command": "^2.0.0", "which": "^2.0.1" } }, "sha512-uV2QOWP2nWzsy2aMp8aRibhi9dlzF5Hgh5SHaB9OiTGEyDTiJJyx0uy51QXdyWbtAHNua4XJzUKca3OzKUd3vA=="],
+
"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-selector-parser": ["css-selector-parser@3.1.3", "", {}, "sha512-gJMigczVZqYAk0hPVzx/M4Hm1D9QOtqkdQk9005TNzDIUGzo5cnHEDiKUT7jGPximL/oYb+LIitcHFQ4aKupxg=="],
"css-tree": ["css-tree@3.1.0", "", { "dependencies": { "mdn-data": "2.12.2", "source-map-js": "^1.0.1" } }, "sha512-0eW44TGN5SQXU1mWSkKwFstI/22X2bG1nYzZTYMAWjylYURhse752YgbE4Cx46AC+bAvI+/dYTPRk1LqSUnu6w=="],
@@ -724,15 +715,11 @@
"csstype": ["csstype@3.1.3", "", {}, "sha512-M1uQkMl8rQK/szD0LNhtqxIPLpimGm8sOBwU7lLnCpSbTyY3yeU1Vc7l4KT5zT4s/yOxHH5O7tIuuLOCnLADRw=="],
- "data-uri-to-buffer": ["data-uri-to-buffer@2.0.2", "", {}, "sha512-ND9qDTLc6diwj+Xe5cdAgVTbLVdXbtxTJRXRhli8Mowuaan+0EJOtdqJ0QCHNSSPyoXGx9HX2/VMnKeC34AChA=="],
-
- "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=="],
+ "decode-named-character-reference": ["decode-named-character-reference@1.2.0", "", { "dependencies": { "character-entities": "^2.0.0" } }, "sha512-c6fcElNV6ShtZXmsgNgFFV5tVX2PaV4g+MOAkb8eXHvn6sryJBrZa9r0zV6+dtTyoCKxtDy5tyQ5ZwQuidtd+Q=="],
"decompress-response": ["decompress-response@6.0.0", "", { "dependencies": { "mimic-response": "^3.1.0" } }, "sha512-aW35yZM6Bb/4oJlZncMH2LCoZtJXTRxES17vE3hoRiowU2kWHaJKFkSBDnDR+cm9J+9QhXmREyIfv0pji9ejCQ=="],
@@ -776,21 +763,19 @@
"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=="],
+ "electron-to-chromium": ["electron-to-chromium@1.5.183", "", {}, "sha512-vCrDBYjQCAEefWGjlK3EpoSKfKbT10pR4XXPdn65q7snuNOZnthoVpBfZPykmDapOKfoD+MMIPG8ZjKyyc9oHA=="],
"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=="],
+ "end-of-stream": ["end-of-stream@1.4.5", "", { "dependencies": { "once": "^1.4.0" } }, "sha512-ooEGc6HP26xXq/N+GCGOT0JKCLDGrq2bQUZrQ7gyrJiZANJ/8YDTxTpQBXGMn+WbIQXNVpyWymm7KYVICQnyOg=="],
- "entities": ["entities@6.0.0", "", {}, "sha512-aKstq2TDOndCn4diEyp9Uq/Flu2i1GlLkc6XIDQSDMuaFE3OPW5OphLCyQ5SpSJZTb4reN+kTcYru5yIfXoRPw=="],
+ "entities": ["entities@6.0.1", "", {}, "sha512-aN97NXWF6AWBTahfVOIrB/NShkzi5H7F9r1s9mD3cDj4Ko5f2qhhVoYMibXF7GlLveb/D2ioWay8lxI97Ven3g=="],
- "env-paths": ["env-paths@3.0.0", "", {}, "sha512-dtJUTepzMW3Lm/NPxRf3wP4642UWhjL2sQxc+ym2YMj1m/H2zDNQOlezafzkHwn6sMstjHTwG6iQQsctDW/b1A=="],
+ "error-stack-parser-es": ["error-stack-parser-es@1.0.5", "", {}, "sha512-5qucVt2XcuGMcEGgWI7i+yZpmpByQ8J1lHhcL7PwqCwu9FPP3VUXzT4ltHe5i2z9dePwEHcDVOAfSnHsOlCXRA=="],
"es-define-property": ["es-define-property@1.0.1", "", {}, "sha512-e3nRfgfUZ4rNGL232gUgX06QNyyez04KdjFrF+LTRoOXmrOgFKDg4BCdsjW8EnT69eqdYGmRpJwiPVYNrCaW3g=="],
@@ -804,13 +789,13 @@
"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=="],
+ "esbuild": ["esbuild@0.25.6", "", { "optionalDependencies": { "@esbuild/aix-ppc64": "0.25.6", "@esbuild/android-arm": "0.25.6", "@esbuild/android-arm64": "0.25.6", "@esbuild/android-x64": "0.25.6", "@esbuild/darwin-arm64": "0.25.6", "@esbuild/darwin-x64": "0.25.6", "@esbuild/freebsd-arm64": "0.25.6", "@esbuild/freebsd-x64": "0.25.6", "@esbuild/linux-arm": "0.25.6", "@esbuild/linux-arm64": "0.25.6", "@esbuild/linux-ia32": "0.25.6", "@esbuild/linux-loong64": "0.25.6", "@esbuild/linux-mips64el": "0.25.6", "@esbuild/linux-ppc64": "0.25.6", "@esbuild/linux-riscv64": "0.25.6", "@esbuild/linux-s390x": "0.25.6", "@esbuild/linux-x64": "0.25.6", "@esbuild/netbsd-arm64": "0.25.6", "@esbuild/netbsd-x64": "0.25.6", "@esbuild/openbsd-arm64": "0.25.6", "@esbuild/openbsd-x64": "0.25.6", "@esbuild/openharmony-arm64": "0.25.6", "@esbuild/sunos-x64": "0.25.6", "@esbuild/win32-arm64": "0.25.6", "@esbuild/win32-ia32": "0.25.6", "@esbuild/win32-x64": "0.25.6" }, "bin": { "esbuild": "bin/esbuild" } }, "sha512-GVuzuUwtdsghE3ocJ9Bs8PNoF13HNQ5TXbEi2AhvVb8xU1Iwt9Fos9FEamfoee+u/TOsn7GUWc04lz46n2bbTg=="],
"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=="],
+ "escape-string-regexp": ["escape-string-regexp@5.0.0", "", {}, "sha512-/veY75JbMK4j1yjvuUxuVsiS/hr/4iHs9FTT6cgTexxdE0Ly/glccBAkloH/DofkjRbZU3bnoj38mOmhkZ0lHw=="],
"estree-util-attach-comments": ["estree-util-attach-comments@3.0.0", "", { "dependencies": { "@types/estree": "^1.0.0" } }, "sha512-cKUwm/HUcTDsYh/9FgnuFqpfquUbwIqwKM26BVCGDPVgvaCl/nDCCjUfiLlx6lsEZ3Z4RFxNbOQ60pkaEwFxGw=="],
@@ -842,11 +827,11 @@
"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=="],
+ "express-rate-limit": ["express-rate-limit@7.5.1", "", { "peerDependencies": { "express": ">= 4.11" } }, "sha512-7iN8iPMDzOMHPUYllBEsQdWVB6fPDMPqwjBaFrgr4Jgr/+okjvzAy+UHlYYL/Vs0OsOrMkwS6PJDkFlJwoxUnw=="],
- "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=="],
+ "expressive-code": ["expressive-code@0.41.3", "", { "dependencies": { "@expressive-code/core": "^0.41.3", "@expressive-code/plugin-frames": "^0.41.3", "@expressive-code/plugin-shiki": "^0.41.3", "@expressive-code/plugin-text-markers": "^0.41.3" } }, "sha512-YLnD62jfgBZYrXIPQcJ0a51Afv9h8VlWqEGK9uU2T5nL/5rb8SnA86+7+mgCZe5D34Tff5RNEA5hjNVJYHzrFg=="],
- "exsolve": ["exsolve@1.0.5", "", {}, "sha512-pz5dvkYYKQ1AHVrgOzBKWeP4u4FRb3a6DNK2ucr0OoNwYIU4QWsJ+NM36LLzORT+z845MzKHHhpXiUF5nvQoJg=="],
+ "exsolve": ["exsolve@1.0.7", "", {}, "sha512-VO5fQUzZtI6C+vx4w/4BWJpg3s/5l+6pRQEHzFRM8WFi4XffSP1Z+4qi7GbjWbvRQEbdIco5mIMq+zX4rPuLrw=="],
"extend": ["extend@3.0.2", "", {}, "sha512-fjquC59cD7CyW6urNXK0FBufkZcoiGG80wTuPujX590cB5Ttln20E2UB4S/WARVqhXffZl2LNgS+gQdPIIim/g=="],
@@ -856,15 +841,9 @@
"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-json-stable-stringify": ["fast-json-stable-stringify@2.1.0", "", {}, "sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw=="],
- "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=="],
+ "fdir": ["fdir@6.4.6", "", { "peerDependencies": { "picomatch": "^3 || ^4" }, "optionalPeers": ["picomatch"] }, "sha512-hiFoqpyZcfNm1yc4u8oWCf9A2c4D3QjCrks3zmoVKVxpQRzmPNar1hUJcBG2RQHvEVGDN+Jm81ZheVLAQMK6+w=="],
"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=="],
@@ -896,22 +875,16 @@
"get-proto": ["get-proto@1.0.1", "", { "dependencies": { "dunder-proto": "^1.0.1", "es-object-atoms": "^1.0.0" } }, "sha512-sTSfBjoXBp89JvIKIefqw7U2CCebsc74kiY6awiGogKtoSGbgjYE/G/+l9sF3MWFPNc9IcoOC4ODfKHfxFmp0g=="],
- "get-source": ["get-source@2.0.12", "", { "dependencies": { "data-uri-to-buffer": "^2.0.0", "source-map": "^0.6.1" } }, "sha512-X5+4+iD+HoSeEED+uwrQ07BOQr0kEDFMVqqpBuI+RaZBpBpHCuXxo70bjar6f0b0u/DQJsJ7ssurpP0V60Az+w=="],
-
"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=="],
"glob-to-regexp": ["glob-to-regexp@0.4.1", "", {}, "sha512-lkX1HJXwyMcprw/5YUZc2s7DrpAiHB21/V+E1rHUrVNokkvB6bqMzT0VfV6/86ZNabt1k14YOIaT7nDvOX3Iiw=="],
- "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=="],
@@ -1034,14 +1007,14 @@
"isarray": ["isarray@1.0.0", "", {}, "sha512-VLghIWNM6ELQzo7zwmcg0NmTVyWKYjvIeM83yjp0wRDTmUnrM678fQbcKBo6n2CJEF0szoG//ytg+TKla89ALQ=="],
+ "isexe": ["isexe@2.0.0", "", {}, "sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw=="],
+
"isomorphic-git": ["isomorphic-git@1.32.1", "", { "dependencies": { "async-lock": "^1.4.1", "clean-git-ref": "^2.0.1", "crc-32": "^1.2.0", "diff3": "0.0.3", "ignore": "^5.1.4", "minimisted": "^2.0.0", "pako": "^1.0.10", "path-browserify": "^1.0.1", "pify": "^4.0.1", "readable-stream": "^3.4.0", "sha.js": "^2.4.9", "simple-get": "^4.0.1" }, "bin": { "isogit": "cli.cjs" } }, "sha512-NZCS7qpLkCZ1M/IrujYBD31sM6pd/fMVArK4fz4I7h6m0rUW2AsYU7S7zXeABuHL6HIfW6l53b4UQ/K441CQjg=="],
"jmespath": ["jmespath@0.16.0", "", {}, "sha512-9FzQjJ7MATs1tSpnco1K6ayiYE3figslrXA72G2HQ/n76RzvYlofyi5QM+iX4YRs/pu3yzxlVQSST23+dMDknw=="],
"jose": ["jose@6.0.11", "", {}, "sha512-QxG7EaliDARm1O1S8BGakqncGT9s25bKL1WSf6/oa17Tkqwi8D2ZNglqCF+DsYF88/rV66Q/Q2mFAy697E1DUg=="],
- "joycon": ["joycon@3.1.1", "", {}, "sha512-34wB/Y7MW7bzjKRjUKTa46I2Z7eV62Rkhva+KkopW7Qvv/OSWBqvkSY7vusOPrNuZcUG3tApvdVgNB8POj3SPw=="],
-
"js-base64": ["js-base64@3.7.7", "", {}, "sha512-7rCnleh0z2CkXhH67J8K1Ytz0b2Y+yxTPL+/KOJoa20hfnVQ/3/T6W/KflYI4bRHRagNeXeU2bkNGI3v1oS/lw=="],
"js-tokens": ["js-tokens@4.0.0", "", {}, "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ=="],
@@ -1050,10 +1023,10 @@
"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-traverse": ["json-schema-traverse@0.4.1", "", {}, "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg=="],
+
"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=="],
@@ -1066,8 +1039,6 @@
"language-map": ["language-map@1.5.0", "", {}, "sha512-n7gFZpe+DwEAX9cXVTw43i3wiudWDDtSn28RmdnS/HCPr284dQI/SztsamWanRr75oSlKSaGbV2nmWCTzGCoVg=="],
- "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=="],
@@ -1212,9 +1183,7 @@
"mimic-response": ["mimic-response@3.1.0", "", {}, "sha512-z0yWI+4FDrrweS8Zmt4Ej5HdJmky15+L2e6Wgn3+iK5fWzb6T3fhNFq2+MeTRb064c6Wr4N/wv0DzQTjNzHNGQ=="],
- "miniflare": ["miniflare@4.20250525.1", "", { "dependencies": { "@cspotcode/source-map-support": "0.8.1", "acorn": "8.14.0", "acorn-walk": "8.3.2", "exit-hook": "2.2.1", "glob-to-regexp": "0.4.1", "sharp": "^0.33.5", "stoppable": "1.1.0", "undici": "^5.28.5", "workerd": "1.20250525.0", "ws": "8.18.0", "youch": "3.3.4", "zod": "3.22.3" }, "bin": { "miniflare": "bootstrap.js" } }, "sha512-4PJlT5WA+hfclFU5Q7xnpG1G1VGYTXaf/3iu6iKQ8IsbSi9QvPTA2bSZ5goCFxmJXDjV4cxttVxB0Wl1CLuQ0w=="],
-
- "minimatch": ["minimatch@5.1.6", "", { "dependencies": { "brace-expansion": "^2.0.1" } }, "sha512-lKwV/1brpG6mBUFHtb7NUmtABCb2WZZmm2wNiOA5hAb8VdCS4B3dtMWyvcoViccwAW/COERjXLt0zP1zXUN26g=="],
+ "miniflare": ["miniflare@4.20250709.0", "", { "dependencies": { "@cspotcode/source-map-support": "0.8.1", "acorn": "8.14.0", "acorn-walk": "8.3.2", "exit-hook": "2.2.1", "glob-to-regexp": "0.4.1", "sharp": "^0.33.5", "stoppable": "1.1.0", "undici": "^5.28.5", "workerd": "1.20250709.0", "ws": "8.18.0", "youch": "4.1.0-beta.10", "zod": "3.22.3" }, "bin": { "miniflare": "bootstrap.js" } }, "sha512-dRGXi6Do9ArQZt7205QGWZ1tD6k6xQNY/mAZBAtiaQYvKxFuNyiHYlFnSN8Co4AFCVOozo/U52sVAaHvlcmnew=="],
"minimist": ["minimist@1.2.8", "", {}, "sha512-2yyAR8qBkN3YuheJanUpWC5U3bb5osDywNB8RzDVlDwDHbocAJveqqj1u8+SVD7jkWT4yvsHCpWqqWqAxb0zCA=="],
@@ -1222,14 +1191,10 @@
"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=="],
- "mustache": ["mustache@4.2.0", "", { "bin": { "mustache": "bin/mustache" } }, "sha512-71ippSywq5Yb7/tVYyGbkBggbU8H3u5Rz56fH60jGFgr8uHwxs+aSKeqmluIVzM0m0kB7xQjKS6qPfd0b2ZoqQ=="],
-
"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=="],
@@ -1248,7 +1213,7 @@
"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-mock-http": ["node-mock-http@1.0.1", "", {}, "sha512-0gJJgENizp4ghds/Ywu2FCmcRsgBTmRQzYPZm61wy+Em2sBarSka0OhQS5huLBg6od1zkNpnWMCZloQDFVvOMQ=="],
"node-releases": ["node-releases@2.0.19", "", {}, "sha512-xxOWJsBKtzAq7DY0J+DTzuz58K8e7sJbdgwkbMWQe8UYB6ekmsQ45q0M/tJDsGaZmbC+l7n57UV8Hl5tHxO9uw=="],
@@ -1268,8 +1233,6 @@
"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=="],
@@ -1310,31 +1273,23 @@
"path-browserify": ["path-browserify@1.0.1", "", {}, "sha512-b7uo2UCUOYZcnF/3ID0lulOJi/bafxa1xPe7ZPsammBSpjSWQkjNxlt635YGS2MiR9GjvuXCtz2emr3jbsz98g=="],
+ "path-key": ["path-key@3.1.1", "", {}, "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q=="],
+
"path-to-regexp": ["path-to-regexp@6.3.0", "", {}, "sha512-Yhpw4T9C6hPpgPeA28us07OJeqZ5EzQTkbfwuhsUg0c237RomFoETJgmp2sa3F/41gfLE6G5cqcYwznmeEeOlQ=="],
"pathe": ["pathe@2.0.3", "", {}, "sha512-WUjGcAqP1gQacoQe+OBJsFA7Ld4DyXuUIjZ5cc75cLHvJ7dtNsTugphxIADwspS+AraAUePCKrSVtPLFj/F88w=="],
- "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=="],
"pify": ["pify@4.0.1", "", {}, "sha512-uB80kBFb/tfd68bVleG9T5GGsGPjJrLAUpR5PZIrhBnIaRTQRjqdJSsIKkOP6OAIFbj7GOrcudc5pNjZ+geV2g=="],
- "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=="],
+ "pkce-challenge": ["pkce-challenge@5.0.0", "", {}, "sha512-ueGLflrrnvwB3xuo/uGob5pd5FN7l0MsLf0Z87o/UQmRtwjvfylfc9MurIxRAWywCYTgrvpXBcqjV4OfCYGCIQ=="],
"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": ["postcss@8.5.6", "", { "dependencies": { "nanoid": "^3.3.11", "picocolors": "^1.1.1", "source-map-js": "^1.2.1" } }, "sha512-3Ybi1tAuwAP9s0r1UQ2J4n5Y0G05bJkpUIO0/bI9MhwmD70S5aTWbXGBwxHrelT+XM1k6dM0pk+SwNkpTRN7Pg=="],
"postcss-nested": ["postcss-nested@6.2.0", "", { "dependencies": { "postcss-selector-parser": "^6.1.1" }, "peerDependencies": { "postcss": "^8.2.14" } }, "sha512-HQbt28KulC5AJzG+cZtj9kvKB93CFCdLvog1WFLf1D+xmMvPGlBstkpTEZfK5+AN9hfJocyBFCNiqyS48bpgzQ=="],
@@ -1344,19 +1299,15 @@
"prettier": ["prettier@3.5.3", "", { "bin": { "prettier": "bin/prettier.cjs" } }, "sha512-QQtaxnoDJeAkDvDKWCLiwIXkTgRhwYDEQCghU9Z6q03iyek/rxRh/2lC3HB7P8sWT2xC/y5JDctPLBIGzHKbhw=="],
- "printable-characters": ["printable-characters@1.0.42", "", {}, "sha512-dKp+C4iXWK4vVYZmYSd0KBH5F/h1HoZRsbJ82AVKRO3PEo8L4lBS/vLwhVtpwwuYcoIsVY+1JYKR268yn480uQ=="],
-
"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=="],
+ "pump": ["pump@3.0.3", "", { "dependencies": { "end-of-stream": "^1.1.0", "once": "^1.3.1" } }, "sha512-todwxLMY7/heScKmntwQG8CXVkWUOdYxIvY2s0VWAAMh/nd8SoYiRaKjlr7+iCs984f2P8zvrfWcDDYVb73NfA=="],
"punycode": ["punycode@1.3.2", "", {}, "sha512-RofWgt/7fL5wP1Y7fxE7/EmTLzQVnB0ycyibJ0OOHIlJqTNzglYFxVwETOcIoJqJmpDXJ9xImDv+Fq34F/d4Dw=="],
@@ -1364,8 +1315,6 @@
"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=="],
@@ -1378,8 +1327,6 @@
"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=="],
@@ -1398,7 +1345,7 @@
"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-expressive-code": ["rehype-expressive-code@0.41.3", "", { "dependencies": { "expressive-code": "^0.41.3" } }, "sha512-8d9Py4c/V6I/Od2VIXFAdpiO2kc0SV2qTJsRAaqSIcM9aruW4ASLNe2kOEo1inXAAkIhpFzAHTc358HKbvpNUg=="],
"rehype-format": ["rehype-format@5.0.1", "", { "dependencies": { "@types/hast": "^3.0.0", "hast-util-format": "^1.0.0" } }, "sha512-zvmVru9uB0josBVpr946OR8ui7nJEdzZobwLOOqHb/OOD88W0Vk2SqLwoVOj0fM6IPCCO6TaV9CvQvJMWwukFQ=="],
@@ -1424,7 +1371,7 @@
"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=="],
+ "remeda": ["remeda@2.26.0", "", { "dependencies": { "type-fest": "^4.41.0" } }, "sha512-lmNNwtaC6Co4m0WTTNoZ/JlpjEqAjPZO0+czC9YVRQUpkbS4x8Hmh+Mn9HPfJfiXqUQ5IXXgSXSOB2pBKAytdA=="],
"restructure": ["restructure@3.0.2", "", {}, "sha512-gSfoiOEA0VPE6Tukkrr7I0RBdE0s7H1eFCDBk05l1KIQT1UIKNc5JZy6jdyW6eYH3aR3g5b3PuL77rq0hvwtAw=="],
@@ -1436,9 +1383,7 @@
"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=="],
+ "rollup": ["rollup@4.45.0", "", { "dependencies": { "@types/estree": "1.0.8" }, "optionalDependencies": { "@rollup/rollup-android-arm-eabi": "4.45.0", "@rollup/rollup-android-arm64": "4.45.0", "@rollup/rollup-darwin-arm64": "4.45.0", "@rollup/rollup-darwin-x64": "4.45.0", "@rollup/rollup-freebsd-arm64": "4.45.0", "@rollup/rollup-freebsd-x64": "4.45.0", "@rollup/rollup-linux-arm-gnueabihf": "4.45.0", "@rollup/rollup-linux-arm-musleabihf": "4.45.0", "@rollup/rollup-linux-arm64-gnu": "4.45.0", "@rollup/rollup-linux-arm64-musl": "4.45.0", "@rollup/rollup-linux-loongarch64-gnu": "4.45.0", "@rollup/rollup-linux-powerpc64le-gnu": "4.45.0", "@rollup/rollup-linux-riscv64-gnu": "4.45.0", "@rollup/rollup-linux-riscv64-musl": "4.45.0", "@rollup/rollup-linux-s390x-gnu": "4.45.0", "@rollup/rollup-linux-x64-gnu": "4.45.0", "@rollup/rollup-linux-x64-musl": "4.45.0", "@rollup/rollup-win32-arm64-msvc": "4.45.0", "@rollup/rollup-win32-ia32-msvc": "4.45.0", "@rollup/rollup-win32-x64-msvc": "4.45.0", "fsevents": "~2.3.2" }, "bin": { "rollup": "dist/bin/rollup" } }, "sha512-WLjEcJRIo7i3WDDgOIJqVI2d+lAC3EwvOGy+Xfq6hs+GQuAA4Di/H72xmXkOhrIWFg2PFYSKZYfH0f4vfKXN4A=="],
"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=="],
@@ -1448,8 +1393,6 @@
"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=="],
@@ -1470,10 +1413,14 @@
"setprototypeof": ["setprototypeof@1.2.0", "", {}, "sha512-E5LDX7Wrp85Kil5bhZv46j8jOeboKq5JMmYM3gVGdGH8xFpPWXUMsNrlODCrkoxMEeNi/XZIwuRvY4XNwYMJpw=="],
- "sha.js": ["sha.js@2.4.11", "", { "dependencies": { "inherits": "^2.0.1", "safe-buffer": "^5.0.1" }, "bin": { "sha.js": "./bin.js" } }, "sha512-QMEp5B7cftE7APOjk5Y6xgrbWu+WkLVQwk8JNjZ8nKRciZaByEW6MubieAiToS7+dwvrjGhH8jRXz3MVd0AYqQ=="],
+ "sha.js": ["sha.js@2.4.12", "", { "dependencies": { "inherits": "^2.0.4", "safe-buffer": "^5.2.1", "to-buffer": "^1.2.0" }, "bin": { "sha.js": "bin.js" } }, "sha512-8LzC5+bvI45BjpfXU8V5fdU2mfeKiQe1D1gIMn7XUlF3OTUrpdJpPPH4EMAnF0DsHHdSZqCdSss5qCmJKuiO3w=="],
"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=="],
+ "shebang-command": ["shebang-command@2.0.0", "", { "dependencies": { "shebang-regex": "^3.0.0" } }, "sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA=="],
+
+ "shebang-regex": ["shebang-regex@3.0.0", "", {}, "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A=="],
+
"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=="],
@@ -1494,22 +1441,18 @@
"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=="],
+ "smol-toml": ["smol-toml@1.4.1", "", {}, "sha512-CxdwHXyYTONGHThDbq5XdwbFsuY4wlClRGejfE2NtwUtiHYsP1QtNsHb/hnj31jKYSchztJsaA8pSQoVzkfCFg=="],
"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.17.8", "", { "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.17.8", "sst-darwin-x64": "3.17.8", "sst-linux-arm64": "3.17.8", "sst-linux-x64": "3.17.8", "sst-linux-x86": "3.17.8", "sst-win32-arm64": "3.17.8", "sst-win32-x64": "3.17.8", "sst-win32-x86": "3.17.8" }, "bin": { "sst": "bin/sst.mjs" } }, "sha512-P/a9/ZsjtQRrTBerBMO1ODaVa5HVTmNLrQNJiYvu2Bgd0ov+vefQeHv6oima8HLlPwpDIPS2gxJk8BZrTZMfCA=="],
"sst-darwin-arm64": ["sst-darwin-arm64@3.17.8", "", { "os": "darwin", "cpu": "arm64" }, "sha512-50P6YRMnZVItZUfB0+NzqMww2mmm4vB3zhTVtWUtGoXeiw78g1AEnVlmS28gYXPHM1P987jTvR7EON9u9ig/Dg=="],
@@ -1528,17 +1471,13 @@
"sst-win32-x86": ["sst-win32-x86@3.17.8", "", { "os": "win32", "cpu": "none" }, "sha512-oVmFa/PoElQmfnGJlB0w6rPXiYuldiagO6AbrLMT/6oAnWerLQ8Uhv9tJWfMh3xtPLImQLTjxDo1v0AIzEv9QA=="],
- "stacktracey": ["stacktracey@2.1.8", "", { "dependencies": { "as-table": "^1.0.36", "get-source": "^2.0.12" } }, "sha512-Kpij9riA+UNg7TnphqjH7/CzctQ/owJGNbFkfEeve4Z4uxT5+JapVLFXcsurIfN34gnTWZNJ/f7NMG0E8JDzTw=="],
-
- "statuses": ["statuses@2.0.1", "", {}, "sha512-RwNA9Z/7PrK06rYLIzFMlaF+l73iwpzsqRIFgbMLbTcLD6cOao82TaWefPXQvB2fOC4AjuYSEndS7N/mTCbkdQ=="],
+ "statuses": ["statuses@2.0.2", "", {}, "sha512-DvEy55V3DB7uknRo+4iOGT5fP1slR8wQohVdknigZPMpMstaKJQWhwiYBACJE3Ul2pTnATihhBYnRhZQHGBiRw=="],
"stoppable": ["stoppable@1.1.0", "", {}, "sha512-KXDYZ9dszj6bzvnEMRYvxgeTHU74QBFL54XKtP3nyMuJ81CFYtABZ3bAzL2EdFUaEwJOBOgENyFj3R7oTzDyyw=="],
"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=="],
+ "streamx": ["streamx@2.22.1", "", { "dependencies": { "fast-fifo": "^1.3.2", "text-decoder": "^1.1.0" }, "optionalDependencies": { "bare-events": "^2.2.0" } }, "sha512-znKXEBxfatz2GBNK02kRnCXjV+AA4kjZIUxeWSr3UGirZMJfTE9uiwKHobnbgxWyL/JWro8tTq+vOqAK1/qbSA=="],
"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=="],
@@ -1548,36 +1487,32 @@
"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=="],
+ "strip-json-comments": ["strip-json-comments@2.0.1", "", {}, "sha512-4gB8na07fecVVkOI6Rs4e7T6NOTki5EmL7TUduTs6bu3EdnSycntVJ4re8kgZA+wx9IueI2Y11bfbgwtzuE0KQ=="],
- "style-to-js": ["style-to-js@1.1.16", "", { "dependencies": { "style-to-object": "1.0.8" } }, "sha512-/Q6ld50hKYPH3d/r6nr117TZkHR0w0kGGIVfpG9N6D8NymRPM9RqCUv4pRpJ62E5DqOYx2AFpbZMyCPnjQCnOw=="],
+ "style-to-js": ["style-to-js@1.1.17", "", { "dependencies": { "style-to-object": "1.0.9" } }, "sha512-xQcBGDxJb6jjFCTzvQtfiPn6YvvP2O8U1MDIPNfJQlWMYfktPy+iGsHE7cssjs7y84d9fQaK4UF3RIJaAHSoYA=="],
- "style-to-object": ["style-to-object@1.0.8", "", { "dependencies": { "inline-style-parser": "0.2.4" } }, "sha512-xT47I/Eo0rwJmaXC4oilDGDWLohVhR6o/xAQcPQN8q6QBuZVL8qMYL85kLmST5cPjAorwvqIA4qXTRQoYHaL6g=="],
+ "style-to-object": ["style-to-object@1.0.9", "", { "dependencies": { "inline-style-parser": "0.2.4" } }, "sha512-G4qppLgKu/k6FwRpHiGiKPaPTFcG3g4wNVX/Qsfu+RqQM30E7Tyu/TEgxcL9PNLF5pdRLwQdE3YKKf+KF2Dzlw=="],
- "supports-color": ["supports-color@7.2.0", "", { "dependencies": { "has-flag": "^4.0.0" } }, "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw=="],
+ "supports-color": ["supports-color@10.0.0", "", {}, "sha512-HRVVSbCCMbj7/kdWF9Q+bbckjBHLtHMEoJWlkmYzzdwhYMkjkOwubLM6t7NbWKjgKamGDrWL1++KrjUO1t9oAQ=="],
- "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-fs": ["tar-fs@3.1.0", "", { "dependencies": { "pump": "^3.0.0", "tar-stream": "^3.1.5" }, "optionalDependencies": { "bare-fs": "^4.0.1", "bare-path": "^3.0.0" } }, "sha512-5Mty5y/sOF1YWj1J6GiBodjlDc05CUR8PKXrsnFAiSG0xA+GHeWLovaZPYUDXkH/1iKRf2+M5+OrRgzC7O9b7w=="],
"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=="],
+ "to-buffer": ["to-buffer@1.2.1", "", { "dependencies": { "isarray": "^2.0.5", "safe-buffer": "^5.2.1", "typed-array-buffer": "^1.0.3" } }, "sha512-tB82LpAIWjhLYbqjx3X4zEeHN6M8CiuOEy2JY8SEQVdYRe3CCHOFaqrBW1doLDrfpWhplcW7BL+bO3/6S3pcDQ=="],
+
"toad-cache": ["toad-cache@3.7.0", "", {}, "sha512-/m8M+2BJUpoJdgAHoG+baCwBT+tf2VraSfkBgl0Y00qIWt41DJ8R5B8nsEw0I58YwF5IZH6z24/2TobDKnqSWw=="],
"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.4.3", "", { "peerDependencies": { "@astrojs/starlight": "^0.34.3", "astro": "^5.7.13" } }, "sha512-3um/NsSq4xFeKbKrNGPHIzfTixwnEVvroqA8Q+lecnYHHJ5TtiYTggHDqewOW+I67t0J1IVBwVKUPjxiQfIcog=="],
"tr46": ["tr46@0.0.3", "", {}, "sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw=="],
@@ -1586,11 +1521,9 @@
"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=="],
+ "tslib": ["tslib@2.8.1", "", {}, "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w=="],
"tunnel-agent": ["tunnel-agent@0.6.0", "", { "dependencies": { "safe-buffer": "^5.0.1" } }, "sha512-McnNiV1l8RYeY8tBgEpuodCC1mLUdbSN+CYBL7kJsJNInOP8UjDDEwdk6Mw60vdLLrr5NHKZhMAOSrR2NZuQ+w=="],
@@ -1600,12 +1533,12 @@
"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=="],
+ "typed-array-buffer": ["typed-array-buffer@1.0.3", "", { "dependencies": { "call-bound": "^1.0.3", "es-errors": "^1.3.0", "is-typed-array": "^1.1.14" } }, "sha512-nAYYwfY3qnzX30IkA6AQZjVbtK6duGontcQm1WSG1MD94YLqK0515GNApXkoxKOWMusVssAHWLh9SeaoefYFGw=="],
+
"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=="],
@@ -1622,7 +1555,7 @@
"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=="],
+ "unifont": ["unifont@0.5.2", "", { "dependencies": { "css-tree": "^3.0.0", "ofetch": "^1.4.1", "ohash": "^2.0.0" } }, "sha512-LzR4WUqzH9ILFvjLAUU7dK3Lnou/qd5kD+IakBtBK4S15/+x2y9VX+DcWQv6s551R6W+vzwgVS6tFg3XggGBgg=="],
"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=="],
@@ -1650,10 +1583,12 @@
"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=="],
+ "unstorage": ["unstorage@1.16.1", "", { "dependencies": { "anymatch": "^3.1.3", "chokidar": "^4.0.3", "destr": "^2.0.5", "h3": "^1.15.3", "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 || ^9.0.0 || ^10.0.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-gdpZ3guLDhz+zWIlYP1UwQ259tG5T5vYRzDaHMkQ1bBY1SQPutvZnrRjTFaWUUpseErJIgAZS51h6NOcZVZiqQ=="],
"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=="],
+ "uri-js": ["uri-js@4.4.1", "", { "dependencies": { "punycode": "^2.1.0" } }, "sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg=="],
+
"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=="],
@@ -1662,7 +1597,7 @@
"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=="],
+ "validate-html-nesting": ["validate-html-nesting@1.2.3", "", {}, "sha512-kdkWdCl6eCeLlRShJKbjVOU2kFKxMF8Ghu50n+crEoyx+VKm3FxAxF9z4DCy6+bbTOqNW0+jcIYRnjoIRzigRw=="],
"vary": ["vary@1.1.2", "", {}, "sha512-BNGbWLfd0eUPabhkXUVm0j8uuvREyTh5ovRa/dyow/BqAbZJyC+5fU+IzQOzmAKzYqYRAISoRhdQr3eIZ/PXqg=="],
@@ -1674,17 +1609,13 @@
"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=="],
+ "vite-plugin-solid": ["vite-plugin-solid@2.11.7", "", { "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-5TgK1RnE449g0Ryxb9BXqem89RSy7fE8XGVCo+Gw84IHgPuPVP7nYNP6WBVAaY/0xw+OqfdQee+kusL0y3XYNg=="],
- "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=="],
+ "vitefu": ["vitefu@1.1.1", "", { "peerDependencies": { "vite": "^3.0.0 || ^4.0.0 || ^5.0.0 || ^6.0.0 || ^7.0.0-beta.0" }, "optionalPeers": ["vite"] }, "sha512-B/Fegf3i8zh0yFbpzZ21amWzHmuNlLlmJT6n7bu5e+pCHUKQIfXSYokrqOBGEMMe9UG2sostKQF9mml/vYaWJQ=="],
"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=="],
+ "vscode-languageserver-types": ["vscode-languageserver-types@3.17.5", "", {}, "sha512-Ld1VelNuX9pdF39h2Hgaeb5hEZM2Z3jUrrMgWQAu82jMtZp7p3vJT3BzToKtZI7NgQssZje5o0zryOrhQvzQAg=="],
"web-namespaces": ["web-namespaces@2.0.1", "", {}, "sha512-bKr1DkiNa2krS7qxNtdrtHAmzuYGFQLiQ13TsorsdT6ULTkPLKuu5+GsFpDlg6JFjUTwX2DyhMPG2be8uPrqsQ=="],
@@ -1692,15 +1623,17 @@
"whatwg-url": ["whatwg-url@5.0.0", "", { "dependencies": { "tr46": "~0.0.3", "webidl-conversions": "^3.0.0" } }, "sha512-saE57nupxk6v3HY35+jzBwYa0rKSy0XR8JSxZPwgLr7ys0IBzhGviA1/TUGJLmSVqs8pb9AnvICXEuOHLprYTw=="],
+ "which": ["which@2.0.2", "", { "dependencies": { "isexe": "^2.0.0" }, "bin": { "node-which": "./bin/node-which" } }, "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA=="],
+
"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=="],
- "workerd": ["workerd@1.20250525.0", "", { "optionalDependencies": { "@cloudflare/workerd-darwin-64": "1.20250525.0", "@cloudflare/workerd-darwin-arm64": "1.20250525.0", "@cloudflare/workerd-linux-64": "1.20250525.0", "@cloudflare/workerd-linux-arm64": "1.20250525.0", "@cloudflare/workerd-windows-64": "1.20250525.0" }, "bin": { "workerd": "bin/workerd" } }, "sha512-SXJgLREy/Aqw2J71Oah0Pbu+SShbqbTExjVQyRBTM1r7MG7fS5NUlknhnt6sikjA/t4cO09Bi8OJqHdTkrcnYQ=="],
+ "workerd": ["workerd@1.20250709.0", "", { "optionalDependencies": { "@cloudflare/workerd-darwin-64": "1.20250709.0", "@cloudflare/workerd-darwin-arm64": "1.20250709.0", "@cloudflare/workerd-linux-64": "1.20250709.0", "@cloudflare/workerd-linux-arm64": "1.20250709.0", "@cloudflare/workerd-windows-64": "1.20250709.0" }, "bin": { "workerd": "bin/workerd" } }, "sha512-BqLPpmvRN+TYUSG61OkWamsGdEuMwgvabP8m0QOHIfofnrD2YVyWqE1kXJ0GH5EsVEuWamE5sR8XpTfsGBmIpg=="],
- "wrangler": ["wrangler@4.19.1", "", { "dependencies": { "@cloudflare/kv-asset-handler": "0.4.0", "@cloudflare/unenv-preset": "2.3.2", "blake3-wasm": "2.1.5", "esbuild": "0.25.4", "miniflare": "4.20250525.1", "path-to-regexp": "6.3.0", "unenv": "2.0.0-rc.17", "workerd": "1.20250525.0" }, "optionalDependencies": { "fsevents": "~2.3.2" }, "peerDependencies": { "@cloudflare/workers-types": "^4.20250525.0" }, "optionalPeers": ["@cloudflare/workers-types"], "bin": { "wrangler": "bin/wrangler.js", "wrangler2": "bin/wrangler.js" } }, "sha512-b+ed2SJKauHgndl4Im1wHE+FeSSlrdlEZNuvpc8q/94k4EmRxRkXnwBAsVWuicBxG3HStFLQPGGlvL8wGKTtHw=="],
+ "wrangler": ["wrangler@4.24.3", "", { "dependencies": { "@cloudflare/kv-asset-handler": "0.4.0", "@cloudflare/unenv-preset": "2.3.3", "blake3-wasm": "2.1.5", "esbuild": "0.25.4", "miniflare": "4.20250709.0", "path-to-regexp": "6.3.0", "unenv": "2.0.0-rc.17", "workerd": "1.20250709.0" }, "optionalDependencies": { "fsevents": "~2.3.2" }, "peerDependencies": { "@cloudflare/workers-types": "^4.20250709.0" }, "optionalPeers": ["@cloudflare/workers-types"], "bin": { "wrangler": "bin/wrangler.js", "wrangler2": "bin/wrangler.js" } }, "sha512-stB1Wfs5NKlspsAzz8SBujBKsDqT5lpCyrL+vSUMy3uueEtI1A5qyORbKoJhIguEbwHfWS39mBsxzm6Vm1J2cg=="],
"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=="],
@@ -1730,18 +1663,18 @@
"yoctocolors": ["yoctocolors@2.1.1", "", {}, "sha512-GQHQqAopRhwU8Kt1DDM8NjibDXHC8eoh1erhGAJPEyveY9qqVeXvVikNKrDz69sHowPMorbPUrH/mx8c50eiBQ=="],
- "youch": ["youch@3.3.4", "", { "dependencies": { "cookie": "^0.7.1", "mustache": "^4.2.0", "stacktracey": "^2.1.8" } }, "sha512-UeVBXie8cA35DS6+nBkls68xaBBXCye0CNznrhszZjTbRVnJKQuNsyLKBTTL4ln1o1rh2PKtv35twV7irj5SEg=="],
+ "youch": ["youch@4.1.0-beta.10", "", { "dependencies": { "@poppinss/colors": "^4.1.5", "@poppinss/dumper": "^0.6.4", "@speed-highlight/core": "^1.2.7", "cookie": "^1.0.2", "youch-core": "^0.3.3" } }, "sha512-rLfVLB4FgQneDr0dv1oddCVZmKjcJ6yX6mS4pU82Mq/Dt9a3cLZQ62pDBL4AUO+uVrCvtWz3ZFUL2HFAFJ/BXQ=="],
+
+ "youch-core": ["youch-core@0.3.3", "", { "dependencies": { "@poppinss/exception": "^1.2.2", "error-stack-parser-es": "^1.0.5" } }, "sha512-ho7XuGjLaJ2hWHoK8yFnsUGy2Y5uDpqSTq1FkHLK4/oqKtyUU1AFbOOxY4IpC9f0fTLjwYbslUz0Po5BpD1wrA=="],
"zod": ["zod@3.25.49", "", {}, "sha512-JMMPMy9ZBk3XFEdbM3iL1brx4NUSejd6xr3ELrrGEfGb355gjhiAWtG3K5o+AViV/3ZfkIrCzXsZn6SbLwTR8Q=="],
- "zod-openapi": ["zod-openapi@4.2.4", "", { "peerDependencies": { "zod": "^3.21.4" } }, "sha512-tsrQpbpqFCXqVXUzi3TPwFhuMtLN3oNZobOtYnK6/5VkXsNdnIgyNr4r8no4wmYluaxzN3F7iS+8xCW8BmMQ8g=="],
+ "zod-openapi": ["zod-openapi@4.1.0", "", { "peerDependencies": { "zod": "^3.21.4" } }, "sha512-bRCwRYhEO9CmFLyKgJX8h6j1dRtRiwOe+TLzMVPyV0pRW5vRIgb1rLgIGcuRZ5z3MmSVrZqbv3yva4IJrtZK4g=="],
"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=="],
- "zod-validation-error": ["zod-validation-error@3.5.2", "", { "peerDependencies": { "zod": "^3.25.0" } }, "sha512-mdi7YOLtram5dzJ5aDtm1AG9+mxRma1iaMrZdYIpFO7epdKBUwLHIxTF8CPDeCQ828zAXYtizrKlEJAtzgfgrw=="],
-
"zwitch": ["zwitch@2.0.4", "", {}, "sha512-bXE4cR/kVZhKZX/RjPEflHaKVhUVl85noU3v6b8apfQEc1x4A+zBxjZ4lN8LqGd6WZ3dl98pY4o717VFmoPp+A=="],
"@ai-sdk/amazon-bedrock/@ai-sdk/provider": ["@ai-sdk/provider@1.1.3", "", { "dependencies": { "json-schema": "^0.4.0" } }, "sha512-qZMxYJ0qqX/RfnuIaab+zp8UAeJn/ygXXAffR5I4N0n1IrvA6qBsjc8hXLmBiMV2zoXlifkacF7sEFnYnjBcqg=="],
@@ -1754,31 +1687,21 @@
"@ai-sdk/anthropic/@ai-sdk/provider-utils": ["@ai-sdk/provider-utils@2.2.8", "", { "dependencies": { "@ai-sdk/provider": "1.1.3", "nanoid": "^3.3.8", "secure-json-parse": "^2.7.0" }, "peerDependencies": { "zod": "^3.23.8" } }, "sha512-fqhG+4sCVv8x7nFzYnFo19ryhAa3w096Kmc3hWxMQfW/TubPOmt3A6tYZhl4mUfQWWQMsuSkLrtjlWuXBVSGQA=="],
- "@ampproject/remapping/@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=="],
+ "@ampproject/remapping/@jridgewell/trace-mapping": ["@jridgewell/trace-mapping@0.3.29", "", { "dependencies": { "@jridgewell/resolve-uri": "^3.1.0", "@jridgewell/sourcemap-codec": "^1.4.14" } }, "sha512-uw6guiW/gcAGPDhLmd77/6lW8QLeiV5RUTsAX46Db6oLhGaVj4lhnPwb184s1bkc8kdVg/+h988dro8GRDpmYQ=="],
"@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=="],
- "@astrojs/sitemap/zod": ["zod@3.24.2", "", {}, "sha512-lY7CDW43ECgW9u1TcT3IoXHflywfVqDYze4waEz812jR/bZ8FHDsl7pFQoSZTz5N+2NqRXs8GBwnAwo3ZNxqhQ=="],
-
- "@aws-crypto/crc32/tslib": ["tslib@2.8.1", "", {}, "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w=="],
-
"@aws-crypto/util/@smithy/util-utf8": ["@smithy/util-utf8@2.3.0", "", { "dependencies": { "@smithy/util-buffer-from": "^2.2.0", "tslib": "^2.6.2" } }, "sha512-R8Rdn8Hy72KKcebgLiv8jQcQkXoLMOGGv5uI1/k0l+snqkOzQ1R0ChUBCxWMlBsFMekWjq0wRudIweFs7sKT5A=="],
- "@aws-crypto/util/tslib": ["tslib@2.8.1", "", {}, "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w=="],
-
- "@aws-sdk/types/tslib": ["tslib@2.8.1", "", {}, "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w=="],
-
"@babel/core/semver": ["semver@6.3.1", "", { "bin": { "semver": "bin/semver.js" } }, "sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA=="],
- "@babel/generator/@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=="],
+ "@babel/generator/@jridgewell/trace-mapping": ["@jridgewell/trace-mapping@0.3.29", "", { "dependencies": { "@jridgewell/resolve-uri": "^3.1.0", "@jridgewell/sourcemap-codec": "^1.4.14" } }, "sha512-uw6guiW/gcAGPDhLmd77/6lW8QLeiV5RUTsAX46Db6oLhGaVj4lhnPwb184s1bkc8kdVg/+h988dro8GRDpmYQ=="],
"@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=="],
- "@jridgewell/gen-mapping/@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=="],
-
- "@modelcontextprotocol/sdk/zod": ["zod@3.24.2", "", {}, "sha512-lY7CDW43ECgW9u1TcT3IoXHflywfVqDYze4waEz812jR/bZ8FHDsl7pFQoSZTz5N+2NqRXs8GBwnAwo3ZNxqhQ=="],
+ "@jridgewell/gen-mapping/@jridgewell/trace-mapping": ["@jridgewell/trace-mapping@0.3.29", "", { "dependencies": { "@jridgewell/resolve-uri": "^3.1.0", "@jridgewell/sourcemap-codec": "^1.4.14" } }, "sha512-uw6guiW/gcAGPDhLmd77/6lW8QLeiV5RUTsAX46Db6oLhGaVj4lhnPwb184s1bkc8kdVg/+h988dro8GRDpmYQ=="],
"@openauthjs/openauth/@standard-schema/spec": ["@standard-schema/spec@1.0.0-beta.3", "", {}, "sha512-0ifF3BjA1E8SY9C+nUew8RefNOIq0cDlYALPty4rhUm8Rrl6tCM8hBT4bhGhx7I7iXD0uAgt50lgo8dD73ACMw=="],
@@ -1790,47 +1713,23 @@
"@rollup/pluginutils/estree-walker": ["estree-walker@2.0.2", "", {}, "sha512-Rfkk/Mp/DL7JVje3u18FxFujQlTNR2q6QfMSMB7AvCBx91NGj/ba3kCfza0f6dVDbw7YlRf/nDrn7pQrCCyQ/w=="],
- "@smithy/eventstream-codec/tslib": ["tslib@2.8.1", "", {}, "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w=="],
-
- "@smithy/is-array-buffer/tslib": ["tslib@2.8.1", "", {}, "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w=="],
-
- "@smithy/types/tslib": ["tslib@2.8.1", "", {}, "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w=="],
-
- "@smithy/util-buffer-from/tslib": ["tslib@2.8.1", "", {}, "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w=="],
-
- "@smithy/util-hex-encoding/tslib": ["tslib@2.8.1", "", {}, "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w=="],
-
- "@smithy/util-utf8/tslib": ["tslib@2.8.1", "", {}, "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w=="],
-
- "@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=="],
- "astro/zod": ["zod@3.24.2", "", {}, "sha512-lY7CDW43ECgW9u1TcT3IoXHflywfVqDYze4waEz812jR/bZ8FHDsl7pFQoSZTz5N+2NqRXs8GBwnAwo3ZNxqhQ=="],
-
"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=="],
- "eventsource/eventsource-parser": ["eventsource-parser@3.0.2", "", {}, "sha512-6RxOBZ/cYgd8usLwsEl+EC09Au/9BcmCKYF2/xbml6DNczf7nv0MQb+7BA2F+li6//I+28VNlQR37XfQtcAJuA=="],
-
"express/cookie": ["cookie@0.7.2", "", {}, "sha512-yki5XnKuf750l50uGTllt6kKILY4nQ1eNIQatoXEByZ5dWgnKqbnqmTrBE5B4N7lrMJKQ2ytWMiTO2o0v6Ew/w=="],
- "get-source/source-map": ["source-map@0.6.1", "", {}, "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g=="],
-
"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=="],
+ "http-errors/statuses": ["statuses@2.0.1", "", {}, "sha512-RwNA9Z/7PrK06rYLIzFMlaF+l73iwpzsqRIFgbMLbTcLD6cOao82TaWefPXQvB2fOC4AjuYSEndS7N/mTCbkdQ=="],
"miniflare/acorn": ["acorn@8.14.0", "", { "bin": { "acorn": "bin/acorn" } }, "sha512-cl669nCJTZBsL97OF4kUQm5g5hC2uihk0NxY3WENAC0TYdILVkAyHymAntgxGkl7K+t0cXIrH5siy5S4XkFycA=="],
@@ -1838,6 +1737,10 @@
"miniflare/zod": ["zod@3.22.3", "", {}, "sha512-EjIevzuJRiRPbVH4mGc8nApb/lVLKVpmUhAaR5R5doKGfAnGJ6Gr3CViAVjP+4FWSxCsybeWQdcgCtbX+7oZug=="],
+ "opencode/remeda": ["remeda@2.22.3", "", { "dependencies": { "type-fest": "^4.40.1" } }, "sha512-Ka6965m9Zu9OLsysWxVf3jdJKmp6+PKzDv7HWHinEevf0JOJ9y02YpjiC/sKxRpCqGhVyvm1U+0YIj+E6DMgKw=="],
+
+ "opencontrol/@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=="],
+
"opencontrol/hono": ["hono@4.7.4", "", {}, "sha512-Pst8FuGqz3L7tFF+u9Pu70eI0xa5S3LPUmrNd5Jm8nTHze9FxLTK9Kaj5g/k4UcwuJSXTP65SyHOPLrffpcAJg=="],
"opencontrol/zod": ["zod@3.24.2", "", {}, "sha512-lY7CDW43ECgW9u1TcT3IoXHflywfVqDYze4waEz812jR/bZ8FHDsl7pFQoSZTz5N+2NqRXs8GBwnAwo3ZNxqhQ=="],
@@ -1848,18 +1751,10 @@
"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=="],
-
"router/path-to-regexp": ["path-to-regexp@8.2.0", "", {}, "sha512-TdrF7fW9Rphjq4RjrW0Kp2AW0Ahwu9sRGTkS6bvDi0SCwZlEZYmcfDbEsTz8RVk0EHIS/Vd1bv3JhG+1xZuAyQ=="],
"sitemap/@types/node": ["@types/node@17.0.45", "", {}, "sha512-w+tIMs3rq2afQdsPJlODhoUEKzFP1ayaoyl1CcnwtIlsVe7K7bA1NGm4s3PraqTLlXnbIN84zuBlxBWo1u9BLw=="],
@@ -1868,19 +1763,19 @@
"sst/jose": ["jose@5.2.3", "", {}, "sha512-KUXdbctm1uHVL8BYhnyHkgp3zDX5KW8ZhAKVFEfUbU2P8Alpzjb+48hHvjOdQIyPshoblhzsuqOwEEAbtHVirA=="],
- "token-types/ieee754": ["ieee754@1.2.1", "", {}, "sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA=="],
+ "to-buffer/isarray": ["isarray@2.0.5", "", {}, "sha512-xHjhDr3cNBK0BzdUJSPXZntQUx/mwMS5Rw4A7lPJ90XGAO6ISP/ePDNuo0vhqOZU+UD5JoodwCAAoZQd3FeAKw=="],
"unicode-trie/pako": ["pako@0.2.9", "", {}, "sha512-NUcwaKxUxWrZLpDG+z/xZaCgQITkA/Dv4V/T6bw7VON6l1Xz/VnrBqrYjZQ12TamKHzITTfOEIYUj48y2KXImA=="],
"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=="],
+ "uri-js/punycode": ["punycode@2.3.1", "", {}, "sha512-vYt7UD1U9Wg6138shLtLOvdAu+8DsC/ilFtEVHcH+wydcSpNE20AfSOduf6MkRFahL5FY7X1oU7nKVZFtfq8Fg=="],
"wrangler/esbuild": ["esbuild@0.25.4", "", { "optionalDependencies": { "@esbuild/aix-ppc64": "0.25.4", "@esbuild/android-arm": "0.25.4", "@esbuild/android-arm64": "0.25.4", "@esbuild/android-x64": "0.25.4", "@esbuild/darwin-arm64": "0.25.4", "@esbuild/darwin-x64": "0.25.4", "@esbuild/freebsd-arm64": "0.25.4", "@esbuild/freebsd-x64": "0.25.4", "@esbuild/linux-arm": "0.25.4", "@esbuild/linux-arm64": "0.25.4", "@esbuild/linux-ia32": "0.25.4", "@esbuild/linux-loong64": "0.25.4", "@esbuild/linux-mips64el": "0.25.4", "@esbuild/linux-ppc64": "0.25.4", "@esbuild/linux-riscv64": "0.25.4", "@esbuild/linux-s390x": "0.25.4", "@esbuild/linux-x64": "0.25.4", "@esbuild/netbsd-arm64": "0.25.4", "@esbuild/netbsd-x64": "0.25.4", "@esbuild/openbsd-arm64": "0.25.4", "@esbuild/openbsd-x64": "0.25.4", "@esbuild/sunos-x64": "0.25.4", "@esbuild/win32-arm64": "0.25.4", "@esbuild/win32-ia32": "0.25.4", "@esbuild/win32-x64": "0.25.4" }, "bin": { "esbuild": "bin/esbuild" } }, "sha512-8pgjLUcUjcgDg+2Q4NYXnPbo/vncAY4UmyaCm0jZevERqCHZIaWwdJHkf8XQtu4AxSKCdvrUbT0XUr1IdZzI8Q=="],
- "yargs/yargs-parser": ["yargs-parser@22.0.0", "", {}, "sha512-rwu/ClNdSMpkSrUb+d6BRsSkLUq1fmfsY6TOpYzTwvwkg1/NRG85KBy3kq++A8LKQwX6lsu+aWad+2khvuXrqw=="],
+ "xml2js/sax": ["sax@1.4.1", "", {}, "sha512-+aWOz7yVScEGoKNd4PA10LZ8sk0A/z5+nXQG5giUO5rprX9jgYsTdov9qCchZiPIZezbZH+jRut8nPodFAX4Jg=="],
- "youch/cookie": ["cookie@0.7.2", "", {}, "sha512-yki5XnKuf750l50uGTllt6kKILY4nQ1eNIQatoXEByZ5dWgnKqbnqmTrBE5B4N7lrMJKQ2ytWMiTO2o0v6Ew/w=="],
+ "yargs/yargs-parser": ["yargs-parser@22.0.0", "", {}, "sha512-rwu/ClNdSMpkSrUb+d6BRsSkLUq1fmfsY6TOpYzTwvwkg1/NRG85KBy3kq++A8LKQwX6lsu+aWad+2khvuXrqw=="],
"@astrojs/mdx/@astrojs/markdown-remark/@astrojs/prism": ["@astrojs/prism@3.3.0", "", { "dependencies": { "prismjs": "^1.30.0" } }, "sha512-q8VwfU/fDZNoDOf+r7jUnMC2//H2l0TuQ6FkGJL8vD8nw/q5KiL3DS1KKBI3QhI9UQhpJ5dc7AtqfbXWuOgLCQ=="],
@@ -1892,13 +1787,11 @@
"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=="],
+ "opencontrol/@modelcontextprotocol/sdk/pkce-challenge": ["pkce-challenge@4.1.0", "", {}, "sha512-ZBmhE1C9LcPoH9XZSdwiPtbPHZROwAnMy+kIFQVrnMCxY4Cudlz3gBOpzilgc0jOgRaiT3sIWfpMomW2ar2orQ=="],
- "bl/buffer/ieee754": ["ieee754@1.2.1", "", {}, "sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA=="],
+ "opencontrol/@modelcontextprotocol/sdk/zod": ["zod@3.25.49", "", {}, "sha512-JMMPMy9ZBk3XFEdbM3iL1brx4NUSejd6xr3ELrrGEfGb355gjhiAWtG3K5o+AViV/3ZfkIrCzXsZn6SbLwTR8Q=="],
- "pino-pretty/chalk/ansi-styles": ["ansi-styles@4.3.0", "", { "dependencies": { "color-convert": "^2.0.1" } }, "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg=="],
+ "opencontrol/@modelcontextprotocol/sdk/zod-to-json-schema": ["zod-to-json-schema@3.24.5", "", { "peerDependencies": { "zod": "^3.24.1" } }, "sha512-/AuWwMP+YqiPbsJx5D6TfgRTc4kTLjsh5SOcd4bLsfUg2RcEXrFMJl1DGgdHy2aCfsIA/cr/1JM0xcB2GZji8g=="],
"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=="],
@@ -1955,11 +1848,5 @@
"@aws-crypto/util/@smithy/util-utf8/@smithy/util-buffer-from/@smithy/is-array-buffer": ["@smithy/is-array-buffer@2.2.0", "", { "dependencies": { "tslib": "^2.6.2" } }, "sha512-GGP3O9QFD24uGeAXYUjwSTXARoqpZykHadOmA8G5vfJPK0/DC67qa//0qvqrJzL1xc8WQWX7/yc7fwudjPHPhA=="],
"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=="],
}
}
diff --git a/install b/install
index e18bd7bbf8..46de9e3510 100755
--- a/install
+++ b/install
@@ -48,7 +48,7 @@ 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}')
- if [[ $? -ne 0 ]]; then
+ if [[ $? -ne 0 || -z "$specific_version" ]]; then
echo "${RED}Failed to fetch version information${NC}"
exit 1
fi
@@ -186,4 +186,3 @@ if [ -n "${GITHUB_ACTIONS-}" ] && [ "${GITHUB_ACTIONS}" == "true" ]; then
echo "$INSTALL_DIR" >> $GITHUB_PATH
print_message info "Added $INSTALL_DIR to \$GITHUB_PATH"
fi
-
diff --git a/opencode.json b/opencode.json
index ff206980da..2fa644079b 100644
--- a/opencode.json
+++ b/opencode.json
@@ -5,21 +5,5 @@
"type": "local",
"command": ["opencode", "x", "@h1deya/mcp-server-weather"]
}
- },
- "experimental": {
- "hook": {
- "file_edited": {
- ".json": [
- {
- "command": ["bun", "run", "prettier", "$FILE"]
- }
- ]
- },
- "session_completed": [
- {
- "command": ["touch", "./node_modules/foo"]
- }
- ]
- }
}
}
diff --git a/package.json b/package.json
index 7a8c6b0712..9c98d4dc9e 100644
--- a/package.json
+++ b/package.json
@@ -18,7 +18,7 @@
"typescript": "5.8.2",
"@types/node": "22.13.9",
"zod": "3.25.49",
- "ai": "5.0.0-beta.7"
+ "ai": "5.0.0-beta.21"
}
},
"devDependencies": {
@@ -39,7 +39,5 @@
"protobufjs",
"sharp"
],
- "patchedDependencies": {
- "ai@4.3.16": "patches/ai@4.3.16.patch"
- }
+ "patchedDependencies": {}
}
diff --git a/packages/function/src/api.ts b/packages/function/src/api.ts
index 150afd8873..4ba7cbf656 100644
--- a/packages/function/src/api.ts
+++ b/packages/function/src/api.ts
@@ -42,7 +42,11 @@ export class SyncServer extends DurableObject {
async publish(key: string, content: any) {
const sessionID = await this.getSessionID()
- if (!key.startsWith(`session/info/${sessionID}`) && !key.startsWith(`session/message/${sessionID}/`))
+ if (
+ !key.startsWith(`session/info/${sessionID}`) &&
+ !key.startsWith(`session/message/${sessionID}/`) &&
+ !key.startsWith(`session/part/${sessionID}/`)
+ )
return new Response("Error: Invalid key", { status: 400 })
// store message
@@ -71,7 +75,7 @@ export class SyncServer extends DurableObject {
}
public async getData() {
- const data = await this.ctx.storage.list()
+ const data = (await this.ctx.storage.list()) as Map
return Array.from(data.entries())
.filter(([key, _]) => key.startsWith("session/"))
.map(([key, content]) => ({ key, content }))
@@ -207,8 +211,13 @@ export default {
return
}
if (type === "message") {
- const [, messageID] = splits
- messages[messageID] = d.content
+ messages[d.content.id] = {
+ parts: [],
+ ...d.content,
+ }
+ }
+ if (type === "part") {
+ messages[d.content.messageID].parts.push(d.content)
}
})
@@ -223,6 +232,9 @@ export default {
)
}
+ /**
+ * Used by the GitHub action to get GitHub installation access token given the OIDC token
+ */
if (request.method === "POST" && method === "exchange_github_app_token") {
const EXPECTED_AUDIENCE = "opencode-github-action"
const GITHUB_ISSUER = "https://token.actions.githubusercontent.com"
@@ -276,6 +288,38 @@ export default {
})
}
+ /**
+ * Used by the opencode CLI to check if the GitHub app is installed
+ */
+ if (request.method === "GET" && method === "get_github_app_installation") {
+ const owner = url.searchParams.get("owner")
+ const repo = url.searchParams.get("repo")
+
+ const auth = createAppAuth({
+ appId: Resource.GITHUB_APP_ID.value,
+ privateKey: Resource.GITHUB_APP_PRIVATE_KEY.value,
+ })
+ const appAuth = await auth({ type: "app" })
+
+ // Lookup installation
+ const octokit = new Octokit({ auth: appAuth.token })
+ let installation
+ try {
+ const ret = await octokit.apps.getRepoInstallation({ owner, repo })
+ installation = ret.data
+ } catch (err) {
+ if (err instanceof Error && err.message.includes("Not Found")) {
+ // not installed
+ } else {
+ throw err
+ }
+ }
+
+ return new Response(JSON.stringify({ installation }), {
+ headers: { "Content-Type": "application/json" },
+ })
+ }
+
return new Response("Not Found", { status: 404 })
},
}
diff --git a/packages/opencode/package.json b/packages/opencode/package.json
index fae2e3425b..8541e0184d 100644
--- a/packages/opencode/package.json
+++ b/packages/opencode/package.json
@@ -17,37 +17,33 @@
"devDependencies": {
"@ai-sdk/amazon-bedrock": "2.2.10",
"@ai-sdk/anthropic": "1.2.12",
+ "@standard-schema/spec": "1.0.0",
"@tsconfig/bun": "1.0.7",
"@types/bun": "latest",
"@types/turndown": "5.0.5",
"@types/yargs": "17.0.33",
"typescript": "catalog:",
+ "vscode-languageserver-types": "3.17.5",
"zod-to-json-schema": "3.24.5"
},
"dependencies": {
"@clack/prompts": "0.11.0",
- "@flystorage/file-storage": "1.1.0",
- "@flystorage/local-fs": "1.1.0",
- "@hono/zod-validator": "0.5.0",
+ "@hono/zod-validator": "0.4.2",
+ "@modelcontextprotocol/sdk": "1.15.1",
"@openauthjs/openauth": "0.4.3",
- "@standard-schema/spec": "1.0.0",
"ai": "catalog:",
"decimal.js": "10.5.0",
"diff": "8.0.2",
- "env-paths": "3.0.0",
"hono": "4.7.10",
"hono-openapi": "0.4.8",
"isomorphic-git": "1.32.1",
"open": "10.1.2",
"remeda": "2.22.3",
- "ts-lsp-client": "1.0.3",
"turndown": "7.2.0",
"vscode-jsonrpc": "8.2.1",
- "vscode-languageclient": "8",
"xdg-basedir": "5.1.0",
"yargs": "18.0.0",
"zod": "catalog:",
- "zod-openapi": "4.2.4",
- "zod-validation-error": "3.5.2"
+ "zod-openapi": "4.1.0"
}
}
diff --git a/packages/opencode/script/publish.ts b/packages/opencode/script/publish.ts
index 53332d20f5..08e042d7f3 100755
--- a/packages/opencode/script/publish.ts
+++ b/packages/opencode/script/publish.ts
@@ -9,7 +9,7 @@ const snapshot = process.argv.includes("--snapshot")
const version = snapshot
? `0.0.0-${new Date().toISOString().slice(0, 16).replace(/[-:T]/g, "")}`
- : await $`git describe --tags --exact-match HEAD`
+ : await $`git describe --tags --abbrev=0`
.text()
.then((x) => x.substring(1).trim())
.catch(() => {
diff --git a/packages/opencode/src/app/app.ts b/packages/opencode/src/app/app.ts
index 69ddd2acce..fc7f49cb95 100644
--- a/packages/opencode/src/app/app.ts
+++ b/packages/opencode/src/app/app.ts
@@ -12,7 +12,6 @@ export namespace App {
export const Info = z
.object({
- user: z.string(),
hostname: z.string(),
git: z.boolean(),
path: z.object({
@@ -70,7 +69,6 @@ export namespace App {
const root = git ?? input.cwd
const info: Info = {
- user: os.userInfo().username,
hostname: os.hostname(),
time: {
initialized: state.initialized,
diff --git a/packages/opencode/src/auth/anthropic.ts b/packages/opencode/src/auth/anthropic.ts
index cb38238e9d..d3228cb88b 100644
--- a/packages/opencode/src/auth/anthropic.ts
+++ b/packages/opencode/src/auth/anthropic.ts
@@ -4,9 +4,13 @@ import { Auth } from "./index"
export namespace AuthAnthropic {
const CLIENT_ID = "9d1c250a-e61b-44d9-88ed-5944d1962f5e"
- export async function authorize() {
+ export async function authorize(mode: "max" | "console") {
const pkce = await generatePKCE()
- const url = new URL("https://claude.ai/oauth/authorize", import.meta.url)
+
+ const url = new URL(
+ `https://${mode === "console" ? "console.anthropic.com" : "claude.ai"}/oauth/authorize`,
+ import.meta.url,
+ )
url.searchParams.set("code", "true")
url.searchParams.set("client_id", CLIENT_ID)
url.searchParams.set("response_type", "code")
@@ -39,12 +43,11 @@ export namespace AuthAnthropic {
})
if (!result.ok) throw new ExchangeFailed()
const json = await result.json()
- await Auth.set("anthropic", {
- type: "oauth",
+ return {
refresh: json.refresh_token as string,
access: json.access_token as string,
expires: Date.now() + json.expires_in * 1000,
- })
+ }
}
export async function access() {
diff --git a/packages/opencode/src/bun/index.ts b/packages/opencode/src/bun/index.ts
index fa9cb6e35e..eea467370c 100644
--- a/packages/opencode/src/bun/index.ts
+++ b/packages/opencode/src/bun/index.ts
@@ -60,17 +60,24 @@ export namespace BunProc {
export async function install(pkg: string, version = "latest") {
const mod = path.join(Global.Path.cache, "node_modules", pkg)
const pkgjson = Bun.file(path.join(Global.Path.cache, "package.json"))
- const parsed = await pkgjson.json().catch(() => ({
- dependencies: {},
- }))
+ const parsed = await pkgjson.json().catch(async () => {
+ const result = { dependencies: {} }
+ await Bun.write(pkgjson.name!, JSON.stringify(result, null, 2))
+ return result
+ })
if (parsed.dependencies[pkg] === version) return mod
- parsed.dependencies[pkg] = version
- await BunProc.run(
- ["add", "--exact", "--cwd", Global.Path.cache, "--registry=https://registry.npmjs.org", pkg + "@" + version],
- {
- cwd: Global.Path.cache,
- },
- ).catch((e) => {
+
+ // Build command arguments
+ const args = ["add", "--force", "--exact", "--cwd", Global.Path.cache, pkg + "@" + version]
+
+ // Let Bun handle registry resolution:
+ // - If .npmrc files exist, Bun will use them automatically
+ // - If no .npmrc files exist, Bun will default to https://registry.npmjs.org
+ log.info("installing package using Bun's default registry resolution", { pkg, version })
+
+ await BunProc.run(args, {
+ cwd: Global.Path.cache,
+ }).catch((e) => {
throw new InstallFailedError(
{ pkg, version },
{
@@ -78,6 +85,8 @@ export namespace BunProc {
},
)
})
+ parsed.dependencies[pkg] = version
+ await Bun.write(pkgjson.name!, JSON.stringify(parsed, null, 2))
return mod
}
}
diff --git a/packages/opencode/src/cli/cmd/auth.ts b/packages/opencode/src/cli/cmd/auth.ts
index 91ec61ea8b..fd7c0e640a 100644
--- a/packages/opencode/src/cli/cmd/auth.ts
+++ b/packages/opencode/src/cli/cmd/auth.ts
@@ -120,7 +120,7 @@ export const AuthLoginCommand = cmd({
if (provider === "amazon-bedrock") {
prompts.log.info(
- "Amazon bedrock can be configured with standard AWS environment variables like AWS_PROFILE or AWS_ACCESS_KEY_ID",
+ "Amazon bedrock can be configured with standard AWS environment variables like AWS_BEARER_TOKEN_BEDROCK, AWS_PROFILE or AWS_ACCESS_KEY_ID",
)
prompts.outro("Done")
return
@@ -132,20 +132,24 @@ export const AuthLoginCommand = cmd({
options: [
{
label: "Claude Pro/Max",
- value: "oauth",
+ value: "max",
},
{
- label: "API Key",
+ label: "Create API Key",
+ value: "console",
+ },
+ {
+ label: "Manually enter API Key",
value: "api",
},
],
})
if (prompts.isCancel(method)) throw new UI.CancelledError()
- if (method === "oauth") {
+ if (method === "max") {
// some weird bug where program exits without this
await new Promise((resolve) => setTimeout(resolve, 10))
- const { url, verifier } = await AuthAnthropic.authorize()
+ const { url, verifier } = await AuthAnthropic.authorize("max")
prompts.note("Trying to open browser...")
try {
await open(url)
@@ -162,13 +166,66 @@ export const AuthLoginCommand = cmd({
})
if (prompts.isCancel(code)) throw new UI.CancelledError()
- await AuthAnthropic.exchange(code, verifier)
- .then(() => {
- prompts.log.success("Login successful")
+ try {
+ const credentials = await AuthAnthropic.exchange(code, verifier)
+ await Auth.set("anthropic", {
+ type: "oauth",
+ refresh: credentials.refresh,
+ access: credentials.access,
+ expires: credentials.expires,
})
- .catch(() => {
- prompts.log.error("Invalid code")
+ prompts.log.success("Login successful")
+ } catch {
+ prompts.log.error("Invalid code")
+ }
+ prompts.outro("Done")
+ return
+ }
+
+ if (method === "console") {
+ // some weird bug where program exits without this
+ await new Promise((resolve) => setTimeout(resolve, 10))
+ const { url, verifier } = await AuthAnthropic.authorize("console")
+ prompts.note("Trying to open browser...")
+ try {
+ await open(url)
+ } catch (e) {
+ prompts.log.error(
+ "Failed to open browser perhaps you are running without a display or X server, please open the following URL in your browser:",
+ )
+ }
+ prompts.log.info(url)
+
+ const code = await prompts.text({
+ message: "Paste the authorization code here: ",
+ validate: (x) => (x.length > 0 ? undefined : "Required"),
+ })
+ if (prompts.isCancel(code)) throw new UI.CancelledError()
+
+ try {
+ const credentials = await AuthAnthropic.exchange(code, verifier)
+ const accessToken = credentials.access
+ const response = await fetch("https://api.anthropic.com/api/oauth/claude_cli/create_api_key", {
+ method: "POST",
+ headers: {
+ Authorization: `Bearer ${accessToken}`,
+ "Content-Type": "application/x-www-form-urlencoded",
+ Accept: "application/json, text/plain, */*",
+ },
})
+ if (!response.ok) {
+ throw new Error("Failed to create API key")
+ }
+ const json = await response.json()
+ await Auth.set("anthropic", {
+ type: "api",
+ key: json.raw_key,
+ })
+
+ prompts.log.success("Login successful - API key created and saved")
+ } catch (error) {
+ prompts.log.error("Invalid code or failed to create API key")
+ }
prompts.outro("Done")
return
}
diff --git a/packages/opencode/src/cli/cmd/debug/snapshot.ts b/packages/opencode/src/cli/cmd/debug/snapshot.ts
index a06048c63a..48d7f91e67 100644
--- a/packages/opencode/src/cli/cmd/debug/snapshot.ts
+++ b/packages/opencode/src/cli/cmd/debug/snapshot.ts
@@ -4,11 +4,11 @@ import { cmd } from "../cmd"
export const SnapshotCommand = cmd({
command: "snapshot",
- builder: (yargs) => yargs.command(SnapshotCreateCommand).command(SnapshotRestoreCommand).demandCommand(),
+ builder: (yargs) => yargs.command(CreateCommand).command(RestoreCommand).command(DiffCommand).demandCommand(),
async handler() {},
})
-export const SnapshotCreateCommand = cmd({
+const CreateCommand = cmd({
command: "create",
async handler() {
await bootstrap({ cwd: process.cwd() }, async () => {
@@ -18,7 +18,7 @@ export const SnapshotCreateCommand = cmd({
},
})
-export const SnapshotRestoreCommand = cmd({
+const RestoreCommand = cmd({
command: "restore ",
builder: (yargs) =>
yargs.positional("commit", {
@@ -33,3 +33,20 @@ export const SnapshotRestoreCommand = cmd({
})
},
})
+
+export const DiffCommand = cmd({
+ command: "diff ",
+ describe: "diff",
+ builder: (yargs) =>
+ yargs.positional("commit", {
+ type: "string",
+ description: "commit",
+ demandOption: true,
+ }),
+ async handler(args) {
+ await bootstrap({ cwd: process.cwd() }, async () => {
+ const diff = await Snapshot.diff("test", args.commit)
+ console.log(diff)
+ })
+ },
+})
diff --git a/packages/opencode/src/cli/cmd/install-github.ts b/packages/opencode/src/cli/cmd/install-github.ts
new file mode 100644
index 0000000000..604d76a481
--- /dev/null
+++ b/packages/opencode/src/cli/cmd/install-github.ts
@@ -0,0 +1,235 @@
+import { $ } from "bun"
+import path from "path"
+import { exec } from "child_process"
+import * as prompts from "@clack/prompts"
+import { map, pipe, sortBy, values } from "remeda"
+import { UI } from "../ui"
+import { cmd } from "./cmd"
+import { ModelsDev } from "../../provider/models"
+import { App } from "../../app/app"
+
+const WORKFLOW_FILE = ".github/workflows/opencode.yml"
+
+export const InstallGithubCommand = cmd({
+ command: "install-github",
+ describe: "install the GitHub agent",
+ async handler() {
+ await App.provide({ cwd: process.cwd() }, async () => {
+ UI.empty()
+ prompts.intro("Install GitHub agent")
+ const app = await getAppInfo()
+ await installGitHubApp()
+
+ const providers = await ModelsDev.get()
+ const provider = await promptProvider()
+ const model = await promptModel()
+ //const key = await promptKey()
+
+ await addWorkflowFiles()
+ printNextSteps()
+
+ function printNextSteps() {
+ let step2
+ if (provider === "amazon-bedrock") {
+ step2 =
+ "Configure OIDC in AWS - https://docs.github.com/en/actions/how-tos/security-for-github-actions/security-hardening-your-deployments/configuring-openid-connect-in-amazon-web-services"
+ } else {
+ const url = `https://github.com/organizations/${app.owner}/settings/secrets/actions`
+ const env = providers[provider].env
+ const envStr =
+ env.length === 1
+ ? `\`${env[0]}\` secret`
+ : `\`${[env.slice(0, -1).join("\`, \`"), ...env.slice(-1)].join("\` and \`")}\` secrets`
+ step2 = `Add ${envStr} for ${providers[provider].name} - ${url}`
+ }
+
+ prompts.outro(
+ [
+ "Next steps:",
+ ` 1. Commit "${WORKFLOW_FILE}" file and push`,
+ ` 2. ${step2}`,
+ " 3. Learn how to use the GitHub agent - https://docs.opencode.ai/docs/github/getting-started",
+ ].join("\n"),
+ )
+ }
+
+ async function getAppInfo() {
+ const app = App.info()
+ if (!app.git) {
+ prompts.log.error(`Could not find git repository. Please run this command from a git repository.`)
+ throw new UI.CancelledError()
+ }
+
+ // Get repo info
+ const info = await $`git remote get-url origin`.quiet().nothrow().text()
+ // match https or git pattern
+ // ie. https://github.com/sst/opencode.git
+ // ie. git@github.com:sst/opencode.git
+ const parsed = info.match(/git@github\.com:(.*)\.git/) ?? info.match(/github\.com\/(.*)\.git/)
+ if (!parsed) {
+ prompts.log.error(`Could not find git repository. Please run this command from a git repository.`)
+ throw new UI.CancelledError()
+ }
+ const [owner, repo] = parsed[1].split("/")
+ return { owner, repo, root: app.path.root }
+ }
+
+ async function promptProvider() {
+ const priority: Record = {
+ anthropic: 0,
+ "github-copilot": 1,
+ openai: 2,
+ google: 3,
+ }
+ let provider = await prompts.select({
+ message: "Select provider",
+ maxItems: 8,
+ options: [
+ ...pipe(
+ providers,
+ values(),
+ sortBy(
+ (x) => priority[x.id] ?? 99,
+ (x) => x.name ?? x.id,
+ ),
+ map((x) => ({
+ label: x.name,
+ value: x.id,
+ hint: priority[x.id] === 0 ? "recommended" : undefined,
+ })),
+ ),
+ {
+ value: "other",
+ label: "Other",
+ },
+ ],
+ })
+
+ if (prompts.isCancel(provider)) throw new UI.CancelledError()
+ if (provider === "other") {
+ provider = await prompts.text({
+ message: "Enter provider id",
+ validate: (x) => (x.match(/^[a-z-]+$/) ? undefined : "a-z and hyphens only"),
+ })
+ if (prompts.isCancel(provider)) throw new UI.CancelledError()
+ provider = provider.replace(/^@ai-sdk\//, "")
+ if (prompts.isCancel(provider)) throw new UI.CancelledError()
+ prompts.log.warn(
+ `This only stores a credential for ${provider} - you will need configure it in opencode.json, check the docs for examples.`,
+ )
+ }
+
+ return provider
+ }
+
+ async function promptModel() {
+ const providerData = providers[provider]!
+
+ const model = await prompts.select({
+ message: "Select model",
+ maxItems: 8,
+ options: pipe(
+ providerData.models,
+ values(),
+ sortBy((x) => x.name ?? x.id),
+ map((x) => ({
+ label: x.name ?? x.id,
+ value: x.id,
+ })),
+ ),
+ })
+
+ if (prompts.isCancel(model)) throw new UI.CancelledError()
+ return model
+ }
+
+ async function installGitHubApp() {
+ const s = prompts.spinner()
+ s.start("Installing GitHub app")
+
+ // Get installation
+ const installation = await getInstallation()
+ if (installation) return s.stop("GitHub app already installed")
+
+ // Open browser
+ const url = "https://github.com/apps/opencode-agent"
+ const command =
+ process.platform === "darwin"
+ ? `open "${url}"`
+ : process.platform === "win32"
+ ? `start "${url}"`
+ : `xdg-open "${url}"`
+
+ exec(command, (error) => {
+ if (error) {
+ prompts.log.warn(`Could not open browser. Please visit: ${url}`)
+ }
+ })
+
+ // Wait for installation
+ s.message("Waiting for GitHub app to be installed")
+ const MAX_RETRIES = 60
+ let retries = 0
+ do {
+ const installation = await getInstallation()
+ if (installation) break
+
+ if (retries > MAX_RETRIES) {
+ s.stop(
+ `Failed to detect GitHub app installation. Make sure to install the app for the \`${app.owner}/${app.repo}\` repository.`,
+ )
+ throw new UI.CancelledError()
+ }
+
+ retries++
+ await new Promise((resolve) => setTimeout(resolve, 1000))
+ } while (true)
+
+ s.stop("Installed GitHub app")
+
+ async function getInstallation() {
+ return await fetch(`https://api.opencode.ai/get_github_app_installation?owner=${app.owner}&repo=${app.repo}`)
+ .then((res) => res.json())
+ .then((data) => data.installation)
+ }
+ }
+
+ async function addWorkflowFiles() {
+ const envStr =
+ provider === "amazon-bedrock"
+ ? ""
+ : `\n env:${providers[provider].env.map((e) => `\n ${e}: \${{ secrets.${e} }}`).join("")}`
+
+ await Bun.write(
+ path.join(app.root, WORKFLOW_FILE),
+ `
+name: opencode
+
+on:
+ issue_comment:
+ types: [created]
+
+jobs:
+ opencode:
+ if: startsWith(github.event.comment.body, 'hey opencode')
+ runs-on: ubuntu-latest
+ permissions:
+ id-token: write
+ steps:
+ - name: Checkout repository
+ uses: actions/checkout@v4
+ with:
+ fetch-depth: 1
+
+ - name: Run opencode
+ uses: sst/opencode/sdks/github@github-v1${envStr}
+ with:
+ model: ${provider}/${model}
+`.trim(),
+ )
+
+ prompts.log.success(`Added workflow file: "${WORKFLOW_FILE}"`)
+ }
+ })
+ },
+})
diff --git a/packages/opencode/src/cli/cmd/mcp.ts b/packages/opencode/src/cli/cmd/mcp.ts
new file mode 100644
index 0000000000..5f8b6e5d88
--- /dev/null
+++ b/packages/opencode/src/cli/cmd/mcp.ts
@@ -0,0 +1,79 @@
+import { cmd } from "./cmd"
+import { Client } from "@modelcontextprotocol/sdk/client/index.js"
+import { StreamableHTTPClientTransport } from "@modelcontextprotocol/sdk/client/streamableHttp.js"
+import * as prompts from "@clack/prompts"
+import { UI } from "../ui"
+
+export const McpCommand = cmd({
+ command: "mcp",
+ builder: (yargs) => yargs.command(McpAddCommand).demandCommand(),
+ async handler() {},
+})
+
+export const McpAddCommand = cmd({
+ command: "add",
+ describe: "add an MCP server",
+ async handler() {
+ UI.empty()
+ prompts.intro("Add MCP server")
+
+ const name = await prompts.text({
+ message: "Enter MCP server name",
+ validate: (x) => (x.length > 0 ? undefined : "Required"),
+ })
+ if (prompts.isCancel(name)) throw new UI.CancelledError()
+
+ const type = await prompts.select({
+ message: "Select MCP server type",
+ options: [
+ {
+ label: "Local",
+ value: "local",
+ hint: "Run a local command",
+ },
+ {
+ label: "Remote",
+ value: "remote",
+ hint: "Connect to a remote URL",
+ },
+ ],
+ })
+ if (prompts.isCancel(type)) throw new UI.CancelledError()
+
+ if (type === "local") {
+ const command = await prompts.text({
+ message: "Enter command to run",
+ placeholder: "e.g., opencode x @modelcontextprotocol/server-filesystem",
+ validate: (x) => (x.length > 0 ? undefined : "Required"),
+ })
+ if (prompts.isCancel(command)) throw new UI.CancelledError()
+
+ prompts.log.info(`Local MCP server "${name}" configured with command: ${command}`)
+ prompts.outro("MCP server added successfully")
+ return
+ }
+
+ if (type === "remote") {
+ const url = await prompts.text({
+ message: "Enter MCP server URL",
+ placeholder: "e.g., https://example.com/mcp",
+ validate: (x) => {
+ if (x.length === 0) return "Required"
+ const isValid = URL.canParse(x)
+ return isValid ? undefined : "Invalid URL"
+ },
+ })
+ if (prompts.isCancel(url)) throw new UI.CancelledError()
+
+ const client = new Client({
+ name: "opencode",
+ version: "1.0.0",
+ })
+ const transport = new StreamableHTTPClientTransport(new URL(url))
+ await client.connect(transport)
+ prompts.log.info(`Remote MCP server "${name}" configured with URL: ${url}`)
+ }
+
+ prompts.outro("MCP server added successfully")
+ },
+})
diff --git a/packages/opencode/src/cli/cmd/run.ts b/packages/opencode/src/cli/cmd/run.ts
index e6b9e86d29..fe15a0bd01 100644
--- a/packages/opencode/src/cli/cmd/run.ts
+++ b/packages/opencode/src/cli/cmd/run.ts
@@ -9,6 +9,7 @@ import { Config } from "../../config/config"
import { bootstrap } from "../bootstrap"
import { MessageV2 } from "../../session/message-v2"
import { Mode } from "../../session/mode"
+import { Identifier } from "../../id/id"
const TOOL: Record = {
todowrite: ["Todo", UI.Style.TEXT_WARNING_BOLD],
@@ -83,19 +84,22 @@ export const RunCommand = cmd({
return
}
- const isPiped = !process.stdout.isTTY
-
UI.empty()
UI.println(UI.logo())
UI.empty()
- const displayMessage = message.length > 300 ? message.slice(0, 300) + "..." : message
- UI.println(UI.Style.TEXT_NORMAL_BOLD + "> ", displayMessage)
- UI.empty()
const cfg = await Config.get()
- if (cfg.autoshare || Flag.OPENCODE_AUTO_SHARE || args.share) {
- await Session.share(session.id)
- UI.println(UI.Style.TEXT_INFO_BOLD + "~ https://opencode.ai/s/" + session.id.slice(-8))
+ if (cfg.share === "auto" || Flag.OPENCODE_AUTO_SHARE || args.share) {
+ try {
+ await Session.share(session.id)
+ UI.println(UI.Style.TEXT_INFO_BOLD + "~ https://opencode.ai/s/" + session.id.slice(-8))
+ } catch (error) {
+ if (error instanceof Error && error.message.includes("disabled")) {
+ UI.println(UI.Style.TEXT_DANGER_BOLD + "! " + error.message)
+ } else {
+ throw error
+ }
+ }
}
UI.empty()
@@ -112,23 +116,29 @@ export const RunCommand = cmd({
)
}
+ let text = ""
Bus.subscribe(MessageV2.Event.PartUpdated, async (evt) => {
- if (evt.properties.sessionID !== session.id) return
+ if (evt.properties.part.sessionID !== session.id) return
+ if (evt.properties.part.messageID === messageID) return
const part = evt.properties.part
if (part.type === "tool" && part.state.status === "completed") {
const [tool, color] = TOOL[part.tool] ?? [part.tool, UI.Style.TEXT_INFO_BOLD]
- printEvent(color, tool, part.state.title || "Unknown")
+ const title =
+ part.state.title || Object.keys(part.state.input).length > 0 ? JSON.stringify(part.state.input) : "Unknown"
+ printEvent(color, tool, title)
}
if (part.type === "text") {
- if (part.text.includes("\n")) {
+ text = part.text
+
+ if (part.time?.end) {
UI.empty()
- UI.println(part.text)
+ UI.println(UI.markdown(text))
UI.empty()
+ text = ""
return
}
- printEvent(UI.Style.TEXT_NORMAL_BOLD, "Text", part.text)
}
})
@@ -148,8 +158,10 @@ export const RunCommand = cmd({
const mode = args.mode ? await Mode.get(args.mode) : await Mode.list().then((x) => x[0])
+ const messageID = Identifier.ascending("message")
const result = await Session.chat({
sessionID: session.id,
+ messageID,
...(mode.model
? mode.model
: {
@@ -159,15 +171,17 @@ export const RunCommand = cmd({
mode: mode.name,
parts: [
{
+ id: Identifier.ascending("part"),
type: "text",
text: message,
},
],
})
+ const isPiped = !process.stdout.isTTY
if (isPiped) {
const match = result.parts.findLast((x) => x.type === "text")
- if (match) process.stdout.write(match.text)
+ if (match) process.stdout.write(UI.markdown(match.text))
if (errorMsg) process.stdout.write(errorMsg)
}
UI.empty()
diff --git a/packages/opencode/src/cli/cmd/stats.ts b/packages/opencode/src/cli/cmd/stats.ts
index 0db41651a7..39ae86ba0b 100644
--- a/packages/opencode/src/cli/cmd/stats.ts
+++ b/packages/opencode/src/cli/cmd/stats.ts
@@ -1,7 +1,4 @@
-import { Storage } from "../../storage/storage"
-import { MessageV2 } from "../../session/message-v2"
import { cmd } from "./cmd"
-import { bootstrap } from "../bootstrap"
interface SessionStats {
totalSessions: number
@@ -27,88 +24,10 @@ interface SessionStats {
export const StatsCommand = cmd({
command: "stats",
- describe: "analyze and display statistics from message-v2 format",
- handler: async () => {
- await bootstrap({ cwd: process.cwd() }, async () => {
- const stats: SessionStats = {
- totalSessions: 0,
- totalMessages: 0,
- totalCost: 0,
- totalTokens: {
- input: 0,
- output: 0,
- reasoning: 0,
- cache: {
- read: 0,
- write: 0,
- },
- },
- toolUsage: {},
- dateRange: {
- earliest: Date.now(),
- latest: 0,
- },
- days: 0,
- costPerDay: 0,
- }
-
- const sessionMap = new Map()
-
- try {
- for await (const messagePath of Storage.list("session/message")) {
- try {
- const message = await Storage.readJSON(messagePath)
- if (!message.parts.find((part) => part.type === "step-finish")) continue
-
- stats.totalMessages++
-
- const sessionId = message.sessionID
- sessionMap.set(sessionId, (sessionMap.get(sessionId) || 0) + 1)
-
- if (message.time.created < stats.dateRange.earliest) {
- stats.dateRange.earliest = message.time.created
- }
- if (message.time.created > stats.dateRange.latest) {
- stats.dateRange.latest = message.time.created
- }
-
- if (message.role === "assistant") {
- stats.totalCost += message.cost
- stats.totalTokens.input += message.tokens.input
- stats.totalTokens.output += message.tokens.output
- stats.totalTokens.reasoning += message.tokens.reasoning
- stats.totalTokens.cache.read += message.tokens.cache.read
- stats.totalTokens.cache.write += message.tokens.cache.write
-
- for (const part of message.parts) {
- if (part.type === "tool") {
- stats.toolUsage[part.tool] = (stats.toolUsage[part.tool] || 0) + 1
- }
- }
- }
- } catch (e) {
- continue
- }
- }
- } catch (e) {
- console.error("Failed to read storage:", e)
- return
- }
-
- stats.totalSessions = sessionMap.size
-
- if (stats.dateRange.latest > 0) {
- const daysDiff = (stats.dateRange.latest - stats.dateRange.earliest) / (1000 * 60 * 60 * 24)
- stats.days = Math.max(1, Math.ceil(daysDiff))
- stats.costPerDay = stats.totalCost / stats.days
- }
-
- displayStats(stats)
- })
- },
+ handler: async () => {},
})
-function displayStats(stats: SessionStats) {
+export function displayStats(stats: SessionStats) {
const width = 56
function renderRow(label: string, value: string): string {
diff --git a/packages/opencode/src/cli/ui.ts b/packages/opencode/src/cli/ui.ts
index 9801b459e8..0fa4d1ce64 100644
--- a/packages/opencode/src/cli/ui.ts
+++ b/packages/opencode/src/cli/ui.ts
@@ -76,4 +76,8 @@ export namespace UI {
export function error(message: string) {
println(Style.TEXT_DANGER_BOLD + "Error: " + Style.TEXT_NORMAL + message)
}
+
+ export function markdown(text: string): string {
+ return text
+ }
}
diff --git a/packages/opencode/src/config/config.ts b/packages/opencode/src/config/config.ts
index 2eb12804c8..781e47c79e 100644
--- a/packages/opencode/src/config/config.ts
+++ b/packages/opencode/src/config/config.ts
@@ -4,7 +4,7 @@ import { z } from "zod"
import { App } from "../app/app"
import { Filesystem } from "../util/filesystem"
import { ModelsDev } from "../provider/models"
-import { mergeDeep } from "remeda"
+import { mergeDeep, pipe } from "remeda"
import { Global } from "../global"
import fs from "fs/promises"
import { lazy } from "../util/lazy"
@@ -21,6 +21,17 @@ export namespace Config {
result = mergeDeep(result, await load(resolved))
}
}
+
+ // Handle migration from autoshare to share field
+ if (result.autoshare === true && !result.share) {
+ result.share = "auto"
+ }
+
+ if (!result.username) {
+ const os = await import("os")
+ result.username = os.userInfo().username
+ }
+
log.info("loaded", result)
return result
@@ -46,6 +57,7 @@ export namespace Config {
type: z.literal("remote").describe("Type of MCP server connection"),
url: z.string().describe("URL of the remote MCP server"),
enabled: z.boolean().optional().describe("Enable or disable the MCP server on startup"),
+ headers: z.record(z.string(), z.string()).optional().describe("Headers to send with the request"),
})
.strict()
.openapi({
@@ -70,8 +82,10 @@ export namespace Config {
.object({
leader: z.string().optional().default("ctrl+x").describe("Leader key for keybind combinations"),
app_help: z.string().optional().default("h").describe("Show help dialog"),
- switch_mode: z.string().optional().default("tab").describe("Switch mode"),
+ switch_mode: z.string().optional().default("tab").describe("Next mode"),
+ switch_mode_reverse: z.string().optional().default("shift+tab").describe("Previous Mode"),
editor_open: z.string().optional().default("e").describe("Open external editor"),
+ session_export: z.string().optional().default("x").describe("Export session to editor"),
session_new: z.string().optional().default("n").describe("Create a new session"),
session_list: z.string().optional().default("l").describe("List all sessions"),
session_share: z.string().optional().default("s").describe("Share current session"),
@@ -112,22 +126,47 @@ export namespace Config {
ref: "KeybindsConfig",
})
+ export const Layout = z.enum(["auto", "stretch"]).openapi({
+ ref: "LayoutConfig",
+ })
+ export type Layout = z.infer
+
export const Info = z
.object({
$schema: z.string().optional().describe("JSON schema reference for configuration validation"),
theme: z.string().optional().describe("Theme name to use for the interface"),
keybinds: Keybinds.optional().describe("Custom keybind configurations"),
- autoshare: z.boolean().optional().describe("Share newly created sessions automatically"),
+ share: z
+ .enum(["manual", "auto", "disabled"])
+ .optional()
+ .describe(
+ "Control sharing behavior:'manual' allows manual sharing via commands, 'auto' enables automatic sharing, 'disabled' disables all sharing",
+ ),
+ autoshare: z
+ .boolean()
+ .optional()
+ .describe("@deprecated Use 'share' field instead. Share newly created sessions automatically"),
autoupdate: z.boolean().optional().describe("Automatically update to the latest version"),
disabled_providers: z.array(z.string()).optional().describe("Disable providers that are loaded automatically"),
model: z.string().describe("Model to use in the format of provider/model, eg anthropic/claude-2").optional(),
+ small_model: z
+ .string()
+ .describe(
+ "Small model to use for tasks like summarization and title generation in the format of provider/model",
+ )
+ .optional(),
+ username: z
+ .string()
+ .optional()
+ .describe("Custom username to display in conversations instead of system username"),
mode: z
.object({
build: Mode.optional(),
plan: Mode.optional(),
})
.catchall(Mode)
- .optional(),
+ .optional()
+ .describe("Modes configuration, see https://opencode.ai/docs/modes"),
log_level: Log.Level.optional().describe("Minimum log level to write to log files"),
provider: z
.record(
@@ -140,6 +179,7 @@ export namespace Config {
.describe("Custom provider configurations and model overrides"),
mcp: z.record(z.string(), Mcp).optional().describe("MCP (Model Context Protocol) server configurations"),
instructions: z.array(z.string()).optional().describe("Additional instruction files or patterns to include"),
+ layout: Layout.optional().describe("@deprecated Always uses stretch layout."),
experimental: z
.object({
hook: z
@@ -175,7 +215,11 @@ export namespace Config {
export type Info = z.output
export const global = lazy(async () => {
- let result = await load(path.join(Global.Path.config, "config.json"))
+ let result = pipe(
+ {},
+ mergeDeep(await load(path.join(Global.Path.config, "config.json"))),
+ mergeDeep(await load(path.join(Global.Path.config, "opencode.json"))),
+ )
await import(path.join(Global.Path.config, "config"), {
with: {
@@ -199,9 +243,10 @@ export namespace Config {
let text = await Bun.file(configPath)
.text()
.catch((err) => {
- if (err.code === "ENOENT") return "{}"
+ if (err.code === "ENOENT") return
throw new JsonError({ path: configPath }, { cause: err })
})
+ if (!text) return {}
text = text.replace(/\{env:([^}]+)\}/g, (_, varName) => {
return process.env[varName] || ""
@@ -226,7 +271,13 @@ export namespace Config {
}
const parsed = Info.safeParse(data)
- if (parsed.success) return parsed.data
+ if (parsed.success) {
+ if (!parsed.data.$schema) {
+ parsed.data.$schema = "https://opencode.ai/config.json"
+ await Bun.write(configPath, JSON.stringify(parsed.data, null, 2))
+ }
+ return parsed.data
+ }
throw new InvalidError({ path: configPath, issues: parsed.error.issues })
}
export const JsonError = NamedError.create(
diff --git a/packages/opencode/src/format/formatter.ts b/packages/opencode/src/format/formatter.ts
index 1c0c9721ff..83e359f6f5 100644
--- a/packages/opencode/src/format/formatter.ts
+++ b/packages/opencode/src/format/formatter.ts
@@ -105,7 +105,29 @@ export const ruff: Info = {
command: ["ruff", "format", "$FILE"],
extensions: [".py", ".pyi"],
async enabled() {
- return Bun.which("ruff") !== null
+ if (!Bun.which("ruff")) return false
+ const app = App.info()
+ const configs = ["pyproject.toml", "ruff.toml", ".ruff.toml"]
+ for (const config of configs) {
+ const found = await Filesystem.findUp(config, app.path.cwd, app.path.root)
+ if (found.length > 0) {
+ if (config === "pyproject.toml") {
+ const content = await Bun.file(found[0]).text()
+ if (content.includes("[tool.ruff]")) return true
+ } else {
+ return true
+ }
+ }
+ }
+ const deps = ["requirements.txt", "pyproject.toml", "Pipfile"]
+ for (const dep of deps) {
+ const found = await Filesystem.findUp(dep, app.path.cwd, app.path.root)
+ if (found.length > 0) {
+ const content = await Bun.file(found[0]).text()
+ if (content.includes("ruff")) return true
+ }
+ }
+ return false
},
}
diff --git a/packages/opencode/src/global/index.ts b/packages/opencode/src/global/index.ts
index f4d92be7cb..b083e94deb 100644
--- a/packages/opencode/src/global/index.ts
+++ b/packages/opencode/src/global/index.ts
@@ -27,7 +27,7 @@ await Promise.all([
fs.mkdir(Global.Path.state, { recursive: true }),
])
-const CACHE_VERSION = "1"
+const CACHE_VERSION = "2"
const version = await Bun.file(path.join(Global.Path.cache, "version"))
.text()
diff --git a/packages/opencode/src/id/id.ts b/packages/opencode/src/id/id.ts
index b705ff2ce1..6c1edd50d4 100644
--- a/packages/opencode/src/id/id.ts
+++ b/packages/opencode/src/id/id.ts
@@ -6,6 +6,7 @@ export namespace Identifier {
session: "ses",
message: "msg",
user: "usr",
+ part: "prt",
} as const
export function schema(prefix: keyof typeof prefixes) {
diff --git a/packages/opencode/src/index.ts b/packages/opencode/src/index.ts
index 26129c10c5..73ff26c6f6 100644
--- a/packages/opencode/src/index.ts
+++ b/packages/opencode/src/index.ts
@@ -15,6 +15,11 @@ import { ServeCommand } from "./cli/cmd/serve"
import { TuiCommand } from "./cli/cmd/tui"
import { DebugCommand } from "./cli/cmd/debug"
import { StatsCommand } from "./cli/cmd/stats"
+import { McpCommand } from "./cli/cmd/mcp"
+import { InstallGithubCommand } from "./cli/cmd/install-github"
+import { Trace } from "./trace"
+
+Trace.init()
const cancel = new AbortController()
@@ -40,7 +45,7 @@ const cli = yargs(hideBin(process.argv))
type: "boolean",
})
.middleware(async () => {
- await Log.init({ print: process.argv.includes("--print-logs") })
+ await Log.init({ print: process.argv.includes("--print-logs"), dev: Installation.isDev() })
try {
const { Config } = await import("./config/config")
@@ -65,6 +70,7 @@ const cli = yargs(hideBin(process.argv))
})
})
.usage("\n" + UI.logo())
+ .command(McpCommand)
.command(TuiCommand)
.command(RunCommand)
.command(GenerateCommand)
@@ -74,6 +80,7 @@ const cli = yargs(hideBin(process.argv))
.command(ServeCommand)
.command(ModelsCommand)
.command(StatsCommand)
+ .command(InstallGithubCommand)
.fail((msg) => {
if (msg.startsWith("Unknown argument") || msg.startsWith("Not enough non-option arguments")) {
cli.showHelp("log")
diff --git a/packages/opencode/src/installation/index.ts b/packages/opencode/src/installation/index.ts
index 9dfe22432c..ab631a8d2f 100644
--- a/packages/opencode/src/installation/index.ts
+++ b/packages/opencode/src/installation/index.ts
@@ -140,6 +140,12 @@ export namespace Installation {
export async function latest() {
return fetch("https://api.github.com/repos/sst/opencode/releases/latest")
.then((res) => res.json())
- .then((data) => data.tag_name.slice(1) as string)
+ .then((data) => {
+ if (typeof data.tag_name !== "string") {
+ log.error("GitHub API error", data)
+ throw new Error("failed to fetch latest version")
+ }
+ return data.tag_name.slice(1) as string
+ })
}
}
diff --git a/packages/opencode/src/mcp/index.ts b/packages/opencode/src/mcp/index.ts
index ded7d0d2e6..34aec6406d 100644
--- a/packages/opencode/src/mcp/index.ts
+++ b/packages/opencode/src/mcp/index.ts
@@ -37,6 +37,7 @@ export namespace MCP {
transport: {
type: "sse",
url: mcp.url,
+ headers: mcp.headers,
},
}).catch(() => {})
if (!client) {
diff --git a/packages/opencode/src/provider/provider.ts b/packages/opencode/src/provider/provider.ts
index 45c06206ba..df3a0e4818 100644
--- a/packages/opencode/src/provider/provider.ts
+++ b/packages/opencode/src/provider/provider.ts
@@ -21,7 +21,7 @@ import { AuthCopilot } from "../auth/copilot"
import { ModelsDev } from "./models"
import { NamedError } from "../util/error"
import { Auth } from "../auth"
-// import { TaskTool } from "../tool/task"
+import { TaskTool } from "../tool/task"
export namespace Provider {
const log = Log.create({ service: "provider" })
@@ -139,7 +139,8 @@ export namespace Provider {
}
},
"amazon-bedrock": async () => {
- if (!process.env["AWS_PROFILE"] && !process.env["AWS_ACCESS_KEY_ID"]) return { autoload: false }
+ if (!process.env["AWS_PROFILE"] && !process.env["AWS_ACCESS_KEY_ID"] && !process.env["AWS_BEARER_TOKEN_BEDROCK"])
+ return { autoload: false }
const region = process.env["AWS_REGION"] ?? "us-east-1"
@@ -271,14 +272,20 @@ export namespace Provider {
reasoning: model.reasoning ?? existing?.reasoning ?? false,
temperature: model.temperature ?? existing?.temperature ?? false,
tool_call: model.tool_call ?? existing?.tool_call ?? true,
- cost: {
- ...existing?.cost,
- ...model.cost,
- input: 0,
- output: 0,
- cache_read: 0,
- cache_write: 0,
- },
+ cost:
+ !model.cost && !existing?.cost
+ ? {
+ input: 0,
+ output: 0,
+ cache_read: 0,
+ cache_write: 0,
+ }
+ : {
+ cache_read: 0,
+ cache_write: 0,
+ ...existing?.cost,
+ ...model.cost,
+ },
options: {
...existing?.options,
...model.options,
@@ -408,6 +415,24 @@ export namespace Provider {
}
}
+ export async function getSmallModel(providerID: string) {
+ const cfg = await Config.get()
+
+ if (cfg.small_model) {
+ const parsed = parseModel(cfg.small_model)
+ return getModel(parsed.providerID, parsed.modelID)
+ }
+
+ const provider = await state().then((state) => state.providers[providerID])
+ if (!provider) return
+ const priority = ["3-5-haiku", "3.5-haiku", "gemini-2.5-flash"]
+ for (const item of priority) {
+ for (const model of Object.keys(provider.info.models)) {
+ if (model.includes(item)) return getModel(providerID, model)
+ }
+ }
+ }
+
const priority = ["gemini-2.5-pro-preview", "codex-mini", "claude-sonnet-4"]
export function sort(models: ModelsDev.Model[]) {
return sortBy(
@@ -456,7 +481,7 @@ export namespace Provider {
WriteTool,
TodoWriteTool,
TodoReadTool,
- // TaskTool,
+ TaskTool,
]
const TOOL_MAPPING: Record = {
@@ -469,7 +494,10 @@ export namespace Provider {
...t,
parameters: optionalToNullable(t.parameters),
})),
- google: TOOLS,
+ google: TOOLS.map((t) => ({
+ ...t,
+ parameters: sanitizeGeminiParameters(t.parameters),
+ })),
}
export async function tools(providerID: string) {
@@ -483,6 +511,60 @@ export namespace Provider {
return TOOL_MAPPING[providerID] ?? TOOLS
}
+ function sanitizeGeminiParameters(schema: z.ZodTypeAny, visited = new Set()): z.ZodTypeAny {
+ if (!schema || visited.has(schema)) {
+ return schema
+ }
+ visited.add(schema)
+
+ if (schema instanceof z.ZodDefault) {
+ const innerSchema = schema.removeDefault()
+ // Handle Gemini's incompatibility with `default` on `anyOf` (unions).
+ if (innerSchema instanceof z.ZodUnion) {
+ // The schema was `z.union(...).default(...)`, which is not allowed.
+ // We strip the default and return the sanitized union.
+ return sanitizeGeminiParameters(innerSchema, visited)
+ }
+ // Otherwise, the default is on a regular type, which is allowed.
+ // We recurse on the inner type and then re-apply the default.
+ return sanitizeGeminiParameters(innerSchema, visited).default(schema._def.defaultValue())
+ }
+
+ if (schema instanceof z.ZodOptional) {
+ return z.optional(sanitizeGeminiParameters(schema.unwrap(), visited))
+ }
+
+ if (schema instanceof z.ZodObject) {
+ const newShape: Record = {}
+ for (const [key, value] of Object.entries(schema.shape)) {
+ newShape[key] = sanitizeGeminiParameters(value as z.ZodTypeAny, visited)
+ }
+ return z.object(newShape)
+ }
+
+ if (schema instanceof z.ZodArray) {
+ return z.array(sanitizeGeminiParameters(schema.element, visited))
+ }
+
+ if (schema instanceof z.ZodUnion) {
+ // This schema corresponds to `anyOf` in JSON Schema.
+ // We recursively sanitize each option in the union.
+ const sanitizedOptions = schema.options.map((option: z.ZodTypeAny) => sanitizeGeminiParameters(option, visited))
+ return z.union(sanitizedOptions as [z.ZodTypeAny, z.ZodTypeAny, ...z.ZodTypeAny[]])
+ }
+
+ if (schema instanceof z.ZodString) {
+ const newSchema = z.string({ description: schema.description })
+ const safeChecks = ["min", "max", "length", "regex", "startsWith", "endsWith", "includes", "trim"]
+ // rome-ignore lint/suspicious/noExplicitAny:
+ ;(newSchema._def as any).checks = (schema._def as z.ZodStringDef).checks.filter((check) =>
+ safeChecks.includes(check.kind),
+ )
+ return newSchema
+ }
+
+ return schema
+ }
function optionalToNullable(schema: z.ZodTypeAny): z.ZodTypeAny {
if (schema instanceof z.ZodObject) {
const shape = schema.shape
@@ -531,12 +613,4 @@ export namespace Provider {
providerID: z.string(),
}),
)
-
- export const AuthError = NamedError.create(
- "ProviderAuthError",
- z.object({
- providerID: z.string(),
- message: z.string(),
- }),
- )
}
diff --git a/packages/opencode/src/server/server.ts b/packages/opencode/src/server/server.ts
index a958f48b6c..4e6ebfbb3b 100644
--- a/packages/opencode/src/server/server.ts
+++ b/packages/opencode/src/server/server.ts
@@ -269,6 +269,7 @@ export namespace Server {
zValidator(
"json",
z.object({
+ messageID: z.string(),
providerID: z.string(),
modelID: z.string(),
}),
@@ -405,7 +406,14 @@ export namespace Server {
description: "List of messages",
content: {
"application/json": {
- schema: resolver(MessageV2.Info.array()),
+ schema: resolver(
+ z
+ .object({
+ info: MessageV2.Info,
+ parts: MessageV2.Part.array(),
+ })
+ .array(),
+ ),
},
},
},
@@ -443,15 +451,7 @@ export namespace Server {
id: z.string().openapi({ description: "Session ID" }),
}),
),
- zValidator(
- "json",
- z.object({
- providerID: z.string(),
- modelID: z.string(),
- mode: z.string(),
- parts: MessageV2.UserPart.array(),
- }),
- ),
+ zValidator("json", Session.ChatInput.omit({ sessionID: true })),
async (c) => {
const sessionID = c.req.valid("param").id
const body = c.req.valid("json")
diff --git a/packages/opencode/src/session/index.ts b/packages/opencode/src/session/index.ts
index 21434c3b69..2b358bec4d 100644
--- a/packages/opencode/src/session/index.ts
+++ b/packages/opencode/src/session/index.ts
@@ -12,10 +12,12 @@ import {
type ProviderMetadata,
type ModelMessage,
stepCountIs,
+ type StreamTextResult,
} from "ai"
import PROMPT_INITIALIZE from "../session/prompt/initialize.txt"
import PROMPT_PLAN from "../session/prompt/plan.txt"
+import PROMPT_ANTHROPIC_SPOOF from "../session/prompt/anthropic_spoof.txt"
import { App } from "../app/app"
import { Bus } from "../bus"
@@ -145,12 +147,16 @@ export namespace Session {
state().sessions.set(result.id, result)
await Storage.writeJSON("session/info/" + result.id, result)
const cfg = await Config.get()
- if (!result.parentID && (Flag.OPENCODE_AUTO_SHARE || cfg.autoshare))
- share(result.id).then((share) => {
- update(result.id, (draft) => {
- draft.share = share
+ if (!result.parentID && (Flag.OPENCODE_AUTO_SHARE || cfg.share === "auto"))
+ share(result.id)
+ .then((share) => {
+ update(result.id, (draft) => {
+ draft.share = share
+ })
+ })
+ .catch(() => {
+ // Silently ignore sharing errors during session creation
})
- })
Bus.publish(Event.Updated, {
info: result,
})
@@ -172,6 +178,11 @@ export namespace Session {
}
export async function share(id: string) {
+ const cfg = await Config.get()
+ if (cfg.share === "disabled") {
+ throw new Error("Sharing is disabled in configuration")
+ }
+
const session = await get(id)
if (session.share) return session.share
const share = await Share.create(id)
@@ -183,7 +194,10 @@ export namespace Session {
await Storage.writeJSON("session/share/" + id, share)
await Share.sync("session/info/" + id, session)
for (const msg of await messages(id)) {
- await Share.sync("session/message/" + id + "/" + msg.id, msg)
+ await Share.sync("session/message/" + id + "/" + msg.info.id, msg.info)
+ for (const part of msg.parts) {
+ await Share.sync("session/part/" + id + "/" + msg.info.id + "/" + part.id, part)
+ }
}
return share
}
@@ -213,13 +227,18 @@ export namespace Session {
}
export async function messages(sessionID: string) {
- const result = [] as MessageV2.Info[]
- const list = Storage.list("session/message/" + sessionID)
- for await (const p of list) {
+ const result = [] as {
+ info: MessageV2.Info
+ parts: MessageV2.Part[]
+ }[]
+ for (const p of await Storage.list("session/message/" + sessionID)) {
const read = await Storage.readJSON(p)
- result.push(read)
+ result.push({
+ info: read,
+ parts: await parts(sessionID, read.id),
+ })
}
- result.sort((a, b) => (a.id > b.id ? 1 : -1))
+ result.sort((a, b) => (a.info.id > b.info.id ? 1 : -1))
return result
}
@@ -227,8 +246,18 @@ export namespace Session {
return Storage.readJSON("session/message/" + sessionID + "/" + messageID)
}
+ export async function parts(sessionID: string, messageID: string) {
+ const result = [] as MessageV2.Part[]
+ for (const item of await Storage.list("session/part/" + sessionID + "/" + messageID)) {
+ const read = await Storage.readJSON(item)
+ result.push(read)
+ }
+ result.sort((a, b) => (a.id > b.id ? 1 : -1))
+ return result
+ }
+
export async function* list() {
- for await (const item of Storage.list("session/info")) {
+ for (const item of await Storage.list("session/info")) {
const sessionID = path.basename(item, ".json")
yield get(sessionID)
}
@@ -236,7 +265,7 @@ export namespace Session {
export async function children(parentID: string) {
const result = [] as Session.Info[]
- for await (const item of Storage.list("session/info")) {
+ for (const item of await Storage.list("session/info")) {
const sessionID = path.basename(item, ".json")
const session = await get(sessionID)
if (session.parentID !== parentID) continue
@@ -282,13 +311,47 @@ export namespace Session {
})
}
- export async function chat(input: {
- sessionID: string
- providerID: string
- modelID: string
- mode?: string
- parts: MessageV2.UserPart[]
- }) {
+ async function updatePart(part: MessageV2.Part) {
+ await Storage.writeJSON(["session", "part", part.sessionID, part.messageID, part.id].join("/"), part)
+ Bus.publish(MessageV2.Event.PartUpdated, {
+ part,
+ })
+ return part
+ }
+
+ export const ChatInput = z.object({
+ sessionID: Identifier.schema("session"),
+ messageID: Identifier.schema("message").optional(),
+ providerID: z.string(),
+ modelID: z.string(),
+ mode: z.string().optional(),
+ parts: z.array(
+ z.discriminatedUnion("type", [
+ MessageV2.TextPart.omit({
+ messageID: true,
+ sessionID: true,
+ })
+ .partial({
+ id: true,
+ })
+ .openapi({
+ ref: "TextPartInput",
+ }),
+ MessageV2.FilePart.omit({
+ messageID: true,
+ sessionID: true,
+ })
+ .partial({
+ id: true,
+ })
+ .openapi({
+ ref: "FilePartInput",
+ }),
+ ]),
+ ),
+ })
+
+ export async function chat(input: z.infer) {
const l = log.clone().tag("session", input.sessionID)
l.info("chatting")
@@ -299,16 +362,19 @@ export namespace Session {
if (session.revert) {
const trimmed = []
for (const msg of msgs) {
- if (msg.id > session.revert.messageID || (msg.id === session.revert.messageID && session.revert.part === 0)) {
- await Storage.remove("session/message/" + input.sessionID + "/" + msg.id)
+ if (
+ msg.info.id > session.revert.messageID ||
+ (msg.info.id === session.revert.messageID && session.revert.part === 0)
+ ) {
+ await Storage.remove("session/message/" + input.sessionID + "/" + msg.info.id)
await Bus.publish(MessageV2.Event.Removed, {
sessionID: input.sessionID,
- messageID: msg.id,
+ messageID: msg.info.id,
})
continue
}
- if (msg.id === session.revert.messageID) {
+ if (msg.info.id === session.revert.messageID) {
if (session.revert.part === 0) break
msg.parts = msg.parts.slice(0, session.revert.part)
}
@@ -320,11 +386,11 @@ export namespace Session {
})
}
- const previous = msgs.at(-1) as MessageV2.Assistant
+ const previous = msgs.filter((x) => x.info.role === "assistant").at(-1)?.info as MessageV2.Assistant
const outputLimit = Math.min(model.info.limit.output, OUTPUT_TOKEN_MAX) || OUTPUT_TOKEN_MAX
// auto summarize if too long
- if (previous) {
+ if (previous && previous.tokens) {
const tokens =
previous.tokens.input + previous.tokens.cache.read + previous.tokens.cache.write + previous.tokens.output
if (model.info.limit.context && tokens > Math.max((model.info.limit.context - outputLimit) * 0.9, 0)) {
@@ -339,12 +405,21 @@ export namespace Session {
using abort = lock(input.sessionID)
- const lastSummary = msgs.findLast((msg) => msg.role === "assistant" && msg.summary === true)
- if (lastSummary) msgs = msgs.filter((msg) => msg.id >= lastSummary.id)
+ const lastSummary = msgs.findLast((msg) => msg.info.role === "assistant" && msg.info.summary === true)
+ if (lastSummary) msgs = msgs.filter((msg) => msg.info.id >= lastSummary.info.id)
+
+ const userMsg: MessageV2.Info = {
+ id: input.messageID ?? Identifier.ascending("message"),
+ role: "user",
+ sessionID: input.sessionID,
+ time: {
+ created: Date.now(),
+ },
+ }
const app = App.info()
- input.parts = await Promise.all(
- input.parts.map(async (part): Promise => {
+ const userParts = await Promise.all(
+ input.parts.map(async (part): Promise => {
if (part.type === "file") {
const url = new URL(part.url)
switch (url.protocol) {
@@ -394,16 +469,22 @@ export namespace Session {
const result = await ReadTool.execute(args, {
sessionID: input.sessionID,
abort: abort.signal,
- messageID: "", // read tool doesn't use message ID
+ messageID: userMsg.id,
metadata: async () => {},
})
return [
{
+ id: Identifier.ascending("part"),
+ messageID: userMsg.id,
+ sessionID: input.sessionID,
type: "text",
synthetic: true,
text: `Called the Read tool with the following input: ${JSON.stringify(args)}`,
},
{
+ id: Identifier.ascending("part"),
+ messageID: userMsg.id,
+ sessionID: input.sessionID,
type: "text",
synthetic: true,
text: result.output,
@@ -415,11 +496,17 @@ export namespace Session {
FileTime.read(input.sessionID, filePath)
return [
{
+ id: Identifier.ascending("part"),
+ messageID: userMsg.id,
+ sessionID: input.sessionID,
type: "text",
text: `Called the Read tool with the following input: {\"filePath\":\"${pathname}\"}`,
synthetic: true,
},
{
+ id: Identifier.ascending("part"),
+ messageID: userMsg.id,
+ sessionID: input.sessionID,
type: "file",
url: `data:${part.mime};base64,` + Buffer.from(await file.bytes()).toString("base64"),
mime: part.mime,
@@ -428,21 +515,32 @@ export namespace Session {
]
}
}
- return [part]
+ return [
+ {
+ id: Identifier.ascending("part"),
+ ...part,
+ messageID: userMsg.id,
+ sessionID: input.sessionID,
+ },
+ ]
}),
).then((x) => x.flat())
if (input.mode === "plan")
- input.parts.push({
+ userParts.push({
+ id: Identifier.ascending("part"),
+ messageID: userMsg.id,
+ sessionID: input.sessionID,
type: "text",
text: PROMPT_PLAN,
synthetic: true,
})
if (msgs.length === 0 && !session.parentID) {
+ const small = (await Provider.getSmallModel(input.providerID)) ?? model
generateText({
maxOutputTokens: input.providerID === "google" ? 1024 : 20,
- providerOptions: model.info.options,
+ providerOptions: small.info.options,
messages: [
...SystemPrompt.title(input.providerID).map(
(x): ModelMessage => ({
@@ -452,17 +550,19 @@ export namespace Session {
),
...MessageV2.toModelMessage([
{
- id: Identifier.ascending("message"),
- role: "user",
- sessionID: input.sessionID,
- parts: input.parts,
- time: {
- created: Date.now(),
+ info: {
+ id: Identifier.ascending("message"),
+ role: "user",
+ sessionID: input.sessionID,
+ time: {
+ created: Date.now(),
+ },
},
+ parts: userParts,
},
]),
],
- model: model.language,
+ model: small.language,
})
.then((result) => {
if (result.text)
@@ -472,30 +572,24 @@ export namespace Session {
})
.catch(() => {})
}
- const msg: MessageV2.Info = {
- id: Identifier.ascending("message"),
- role: "user",
- sessionID: input.sessionID,
- parts: input.parts,
- time: {
- created: Date.now(),
- },
+ await updateMessage(userMsg)
+ for (const part of userParts) {
+ await updatePart(part)
}
- await updateMessage(msg)
- msgs.push(msg)
+ msgs.push({ info: userMsg, parts: userParts })
const mode = await Mode.get(input.mode ?? "build")
- let system = mode.prompt ? [mode.prompt] : SystemPrompt.provider(input.providerID, input.modelID)
+ let system = input.providerID === "anthropic" ? [PROMPT_ANTHROPIC_SPOOF.trim()] : []
+ system.push(...(mode.prompt ? [mode.prompt] : SystemPrompt.provider(input.modelID)))
system.push(...(await SystemPrompt.environment()))
system.push(...(await SystemPrompt.custom()))
// max 2 system prompt messages for caching purposes
const [first, ...rest] = system
system = [first, rest.join("\n")]
- const next: MessageV2.Info = {
+ const assistantMsg: MessageV2.Info = {
id: Identifier.ascending("message"),
role: "assistant",
- parts: [],
system,
path: {
cwd: app.path.cwd,
@@ -515,29 +609,39 @@ export namespace Session {
},
sessionID: input.sessionID,
}
- await updateMessage(next)
+ await updateMessage(assistantMsg)
const tools: Record = {}
+ const processor = createProcessor(assistantMsg, model.info)
+
for (const item of await Provider.tools(input.providerID)) {
if (mode.tools[item.id] === false) continue
+ if (session.parentID && item.id === "task") continue
tools[item.id] = tool({
id: item.id as any,
description: item.description,
inputSchema: item.parameters as ZodSchema,
- async execute(args, opts) {
+ async execute(args, options) {
const result = await item.execute(args, {
sessionID: input.sessionID,
abort: abort.signal,
- messageID: next.id,
+ messageID: assistantMsg.id,
metadata: async (val) => {
- const match = next.parts.find(
- (p): p is MessageV2.ToolPart => p.type === "tool" && p.id === opts.toolCallId,
- )
+ const match = processor.partFromToolCall(options.toolCallId)
if (match && match.state.status === "running") {
- match.state.title = val.title
- match.state.metadata = val.metadata
+ await updatePart({
+ ...match,
+ state: {
+ title: val.title,
+ metadata: val.metadata,
+ status: "running",
+ input: args,
+ time: {
+ start: Date.now(),
+ },
+ },
+ })
}
- await updateMessage(next)
},
})
return result
@@ -575,11 +679,7 @@ export namespace Session {
tools[key] = item
}
- let text: MessageV2.TextPart = {
- type: "text",
- text: "",
- }
- const result = streamText({
+ const stream = streamText({
onError() {},
maxRetries: 10,
maxOutputTokens: outputLimit,
@@ -612,206 +712,260 @@ export namespace Session {
],
}),
})
- try {
- for await (const value of result.fullStream) {
- l.info("part", {
- type: value.type,
- })
- switch (value.type) {
- case "start":
- break
-
- case "tool-input-start":
- next.parts.push({
- type: "tool",
- tool: value.toolName,
- id: value.id,
- state: {
- status: "pending",
- },
- })
- Bus.publish(MessageV2.Event.PartUpdated, {
- part: next.parts[next.parts.length - 1],
- sessionID: next.sessionID,
- messageID: next.id,
+ const result = await processor.process(stream)
+ return result
+ }
+
+ function createProcessor(assistantMsg: MessageV2.Assistant, model: ModelsDev.Model) {
+ const toolCalls: Record = {}
+ return {
+ partFromToolCall(toolCallID: string) {
+ return toolCalls[toolCallID]
+ },
+ async process(stream: StreamTextResult, never>) {
+ try {
+ let currentText: MessageV2.TextPart | undefined
+
+ for await (const value of stream.fullStream) {
+ log.info("part", {
+ type: value.type,
})
- break
-
- case "tool-input-delta":
- break
-
- case "tool-call": {
- const match = next.parts.find(
- (p): p is MessageV2.ToolPart => p.type === "tool" && p.id === value.toolCallId,
- )
- if (match) {
- match.state = {
- status: "running",
- input: value.input,
- time: {
- start: Date.now(),
- },
+ switch (value.type) {
+ case "start":
+ const snapshot = await Snapshot.create(assistantMsg.sessionID)
+ if (snapshot)
+ await updatePart({
+ id: Identifier.ascending("part"),
+ messageID: assistantMsg.id,
+ sessionID: assistantMsg.sessionID,
+ type: "snapshot",
+ snapshot,
+ })
+ break
+
+ case "tool-input-start":
+ const part = await updatePart({
+ id: Identifier.ascending("part"),
+ messageID: assistantMsg.id,
+ sessionID: assistantMsg.sessionID,
+ type: "tool",
+ tool: value.toolName,
+ callID: value.id,
+ state: {
+ status: "pending",
+ },
+ })
+ toolCalls[value.id] = part as MessageV2.ToolPart
+ break
+
+ case "tool-input-delta":
+ break
+
+ case "tool-call": {
+ const match = toolCalls[value.toolCallId]
+ if (match) {
+ const part = await updatePart({
+ ...match,
+ state: {
+ status: "running",
+ input: value.input,
+ time: {
+ start: Date.now(),
+ },
+ },
+ })
+ toolCalls[value.toolCallId] = part as MessageV2.ToolPart
+ }
+ break
}
- Bus.publish(MessageV2.Event.PartUpdated, {
- part: match,
- sessionID: next.sessionID,
- messageID: next.id,
- })
- }
- break
- }
- case "tool-result": {
- const match = next.parts.find(
- (p): p is MessageV2.ToolPart => p.type === "tool" && p.id === value.toolCallId,
- )
- if (match && match.state.status === "running") {
- match.state = {
- status: "completed",
- input: value.input,
- output: value.output.output,
- metadata: value.output.metadata,
- title: value.output.title,
- time: {
- start: match.state.time.start,
- end: Date.now(),
- },
+ case "tool-result": {
+ const match = toolCalls[value.toolCallId]
+ if (match && match.state.status === "running") {
+ await updatePart({
+ ...match,
+ state: {
+ status: "completed",
+ input: value.input,
+ output: value.output.output,
+ metadata: value.output.metadata,
+ title: value.output.title,
+ time: {
+ start: match.state.time.start,
+ end: Date.now(),
+ },
+ },
+ })
+ delete toolCalls[value.toolCallId]
+ const snapshot = await Snapshot.create(assistantMsg.sessionID)
+ if (snapshot)
+ await updatePart({
+ id: Identifier.ascending("part"),
+ messageID: assistantMsg.id,
+ sessionID: assistantMsg.sessionID,
+ type: "snapshot",
+ snapshot,
+ })
+ }
+ break
}
- Bus.publish(MessageV2.Event.PartUpdated, {
- part: match,
- sessionID: next.sessionID,
- messageID: next.id,
- })
- }
- break
- }
- case "tool-error": {
- const match = next.parts.find(
- (p): p is MessageV2.ToolPart => p.type === "tool" && p.id === value.toolCallId,
- )
- if (match && match.state.status === "running") {
- match.state = {
- status: "error",
- input: value.input,
- error: (value.error as any).toString(),
- time: {
- start: match.state.time.start,
- end: Date.now(),
- },
+ case "tool-error": {
+ const match = toolCalls[value.toolCallId]
+ if (match && match.state.status === "running") {
+ await updatePart({
+ ...match,
+ state: {
+ status: "error",
+ input: value.input,
+ error: (value.error as any).toString(),
+ time: {
+ start: match.state.time.start,
+ end: Date.now(),
+ },
+ },
+ })
+ delete toolCalls[value.toolCallId]
+ const snapshot = await Snapshot.create(assistantMsg.sessionID)
+ if (snapshot)
+ await updatePart({
+ id: Identifier.ascending("part"),
+ messageID: assistantMsg.id,
+ sessionID: assistantMsg.sessionID,
+ type: "snapshot",
+ snapshot,
+ })
+ }
+ break
}
- Bus.publish(MessageV2.Event.PartUpdated, {
- part: match,
- sessionID: next.sessionID,
- messageID: next.id,
- })
- }
- break
- }
- case "error":
- throw value.error
+ case "error":
+ throw value.error
- case "start-step":
- next.parts.push({
- type: "step-start",
- })
- break
-
- case "finish-step":
- const usage = getUsage(model.info, value.usage, value.providerMetadata)
- next.cost += usage.cost
- next.tokens = usage.tokens
- next.parts.push({
- type: "step-finish",
- tokens: usage.tokens,
- cost: usage.cost,
- })
- break
+ case "start-step":
+ await updatePart({
+ id: Identifier.ascending("part"),
+ messageID: assistantMsg.id,
+ sessionID: assistantMsg.sessionID,
+ type: "step-start",
+ })
+ break
- case "text-start":
- text = {
- type: "text",
- text: "",
- }
- break
-
- case "text":
- if (text.text === "") next.parts.push(text)
- text.text += value.text
- break
-
- case "text-end":
- Bus.publish(MessageV2.Event.PartUpdated, {
- part: text,
- sessionID: next.sessionID,
- messageID: next.id,
- })
- break
+ case "finish-step":
+ const usage = getUsage(model, value.usage, value.providerMetadata)
+ assistantMsg.cost += usage.cost
+ assistantMsg.tokens = usage.tokens
+ await updatePart({
+ id: Identifier.ascending("part"),
+ messageID: assistantMsg.id,
+ sessionID: assistantMsg.sessionID,
+ type: "step-finish",
+ tokens: usage.tokens,
+ cost: usage.cost,
+ })
+ await updateMessage(assistantMsg)
+ break
- case "finish":
- next.time.completed = Date.now()
- break
+ case "text-start":
+ currentText = {
+ id: Identifier.ascending("part"),
+ messageID: assistantMsg.id,
+ sessionID: assistantMsg.sessionID,
+ type: "text",
+ text: "",
+ time: {
+ start: Date.now(),
+ },
+ }
+ break
- default:
- l.info("unhandled", {
- ...value,
- })
- continue
+ case "text":
+ if (currentText) {
+ currentText.text += value.text
+ await updatePart(currentText)
+ }
+ break
+
+ case "text-end":
+ if (currentText && currentText.text) {
+ currentText.time = {
+ start: Date.now(),
+ end: Date.now(),
+ }
+ await updatePart(currentText)
+ }
+ currentText = undefined
+ break
+
+ case "finish":
+ assistantMsg.time.completed = Date.now()
+ await updateMessage(assistantMsg)
+ break
+
+ default:
+ log.info("unhandled", {
+ ...value,
+ })
+ continue
+ }
+ }
+ } catch (e) {
+ log.error("", {
+ error: e,
+ })
+ switch (true) {
+ case e instanceof DOMException && e.name === "AbortError":
+ assistantMsg.error = new MessageV2.AbortedError(
+ { message: e.message },
+ {
+ cause: e,
+ },
+ ).toObject()
+ break
+ case MessageV2.OutputLengthError.isInstance(e):
+ assistantMsg.error = e
+ break
+ case LoadAPIKeyError.isInstance(e):
+ assistantMsg.error = new MessageV2.AuthError(
+ {
+ providerID: model.id,
+ message: e.message,
+ },
+ { cause: e },
+ ).toObject()
+ break
+ case e instanceof Error:
+ assistantMsg.error = new NamedError.Unknown({ message: e.toString() }, { cause: e }).toObject()
+ break
+ default:
+ assistantMsg.error = new NamedError.Unknown({ message: JSON.stringify(e) }, { cause: e })
+ }
+ Bus.publish(Event.Error, {
+ sessionID: assistantMsg.sessionID,
+ error: assistantMsg.error,
+ })
}
- await updateMessage(next)
- }
- } catch (e) {
- log.error("", {
- error: e,
- })
- switch (true) {
- case e instanceof DOMException && e.name === "AbortError":
- next.error = new MessageV2.AbortedError(
- { message: e.message },
- {
- cause: e,
- },
- ).toObject()
- break
- case MessageV2.OutputLengthError.isInstance(e):
- next.error = e
- break
- case LoadAPIKeyError.isInstance(e):
- next.error = new Provider.AuthError(
- {
- providerID: input.providerID,
- message: e.message,
- },
- { cause: e },
- ).toObject()
- break
- case e instanceof Error:
- next.error = new NamedError.Unknown({ message: e.toString() }, { cause: e }).toObject()
- break
- default:
- next.error = new NamedError.Unknown({ message: JSON.stringify(e) }, { cause: e })
- }
- Bus.publish(Event.Error, {
- sessionID: next.sessionID,
- error: next.error,
- })
- }
- for (const part of next.parts) {
- if (part.type === "tool" && part.state.status !== "completed") {
- part.state = {
- status: "error",
- error: "Tool execution aborted",
- time: {
- start: Date.now(),
- end: Date.now(),
- },
- input: {},
+ const p = await parts(assistantMsg.sessionID, assistantMsg.id)
+ for (const part of p) {
+ if (part.type === "tool" && part.state.status !== "completed") {
+ updatePart({
+ ...part,
+ state: {
+ status: "error",
+ error: "Tool execution aborted",
+ time: {
+ start: Date.now(),
+ end: Date.now(),
+ },
+ input: {},
+ },
+ })
+ }
}
- }
+ assistantMsg.time.completed = Date.now()
+ await updateMessage(assistantMsg)
+ return { info: assistantMsg, parts: p }
+ },
}
- next.time.completed = Date.now()
- await updateMessage(next)
- return next
}
export async function revert(_input: { sessionID: string; messageID: string; part: number }) {
@@ -860,8 +1014,8 @@ export namespace Session {
export async function summarize(input: { sessionID: string; providerID: string; modelID: string }) {
using abort = lock(input.sessionID)
const msgs = await messages(input.sessionID)
- const lastSummary = msgs.findLast((msg) => msg.role === "assistant" && msg.summary === true)?.id
- const filtered = msgs.filter((msg) => !lastSummary || msg.id >= lastSummary)
+ const lastSummary = msgs.findLast((msg) => msg.info.role === "assistant" && msg.info.summary === true)
+ const filtered = msgs.filter((msg) => !lastSummary || msg.info.id >= lastSummary.info.id)
const model = await Provider.getModel(input.providerID, input.modelID)
const app = App.info()
const system = SystemPrompt.summarize(input.providerID)
@@ -869,7 +1023,6 @@ export namespace Session {
const next: MessageV2.Info = {
id: Identifier.ascending("message"),
role: "assistant",
- parts: [],
sessionID: input.sessionID,
system,
path: {
@@ -892,8 +1045,9 @@ export namespace Session {
}
await updateMessage(next)
- let text: MessageV2.TextPart | undefined
- const result = streamText({
+ const processor = createProcessor(next, model.info)
+ const stream = streamText({
+ maxRetries: 10,
abortSignal: abort.signal,
model: model.language,
messages: [
@@ -914,81 +1068,10 @@ export namespace Session {
],
},
],
- onStepFinish: async (step) => {
- const usage = getUsage(model.info, step.usage, step.providerMetadata)
- next.cost += usage.cost
- next.tokens = usage.tokens
- await updateMessage(next)
- if (text) {
- Bus.publish(MessageV2.Event.PartUpdated, {
- part: text,
- messageID: next.id,
- sessionID: next.sessionID,
- })
- }
- text = undefined
- },
- async onFinish(input) {
- const usage = getUsage(model.info, input.usage, input.providerMetadata)
- next.cost += usage.cost
- next.tokens = usage.tokens
- next.time.completed = Date.now()
- await updateMessage(next)
- },
})
- try {
- for await (const value of result.fullStream) {
- switch (value.type) {
- case "text":
- if (!text) {
- text = {
- type: "text",
- text: value.text,
- }
- next.parts.push(text)
- } else text.text += value.text
- await updateMessage(next)
- break
- }
- }
- } catch (e: any) {
- log.error("summarize stream error", {
- error: e,
- })
- switch (true) {
- case e instanceof DOMException && e.name === "AbortError":
- next.error = new MessageV2.AbortedError(
- { message: e.message },
- {
- cause: e,
- },
- ).toObject()
- break
- case MessageV2.OutputLengthError.isInstance(e):
- next.error = e
- break
- case LoadAPIKeyError.isInstance(e):
- next.error = new Provider.AuthError(
- {
- providerID: input.providerID,
- message: e.message,
- },
- { cause: e },
- ).toObject()
- break
- case e instanceof Error:
- next.error = new NamedError.Unknown({ message: e.toString() }, { cause: e }).toObject()
- break
- default:
- next.error = new NamedError.Unknown({ message: JSON.stringify(e) }, { cause: e }).toObject()
- }
- Bus.publish(Event.Error, {
- error: next.error,
- })
- }
- next.time.completed = Date.now()
- await updateMessage(next)
+ const result = await processor.process(stream)
+ return result
}
function lock(sessionID: string) {
@@ -1038,14 +1121,21 @@ export namespace Session {
}
}
- export async function initialize(input: { sessionID: string; modelID: string; providerID: string }) {
+ export async function initialize(input: {
+ sessionID: string
+ modelID: string
+ providerID: string
+ messageID: string
+ }) {
const app = App.info()
await Session.chat({
sessionID: input.sessionID,
+ messageID: input.messageID,
providerID: input.providerID,
modelID: input.modelID,
parts: [
{
+ id: Identifier.ascending("part"),
type: "text",
text: PROMPT_INITIALIZE.replace("${path}", app.path.root),
},
diff --git a/packages/opencode/src/session/message-v2.ts b/packages/opencode/src/session/message-v2.ts
index aadc1a5e2c..c74a39a7a3 100644
--- a/packages/opencode/src/session/message-v2.ts
+++ b/packages/opencode/src/session/message-v2.ts
@@ -1,13 +1,20 @@
import z from "zod"
import { Bus } from "../bus"
-import { Provider } from "../provider/provider"
import { NamedError } from "../util/error"
import { Message } from "./message"
import { convertToModelMessages, type ModelMessage, type UIMessage } from "ai"
+import { Identifier } from "../id/id"
export namespace MessageV2 {
export const OutputLengthError = NamedError.create("MessageOutputLengthError", z.object({}))
export const AbortedError = NamedError.create("MessageAbortedError", z.object({}))
+ export const AuthError = NamedError.create(
+ "ProviderAuthError",
+ z.object({
+ providerID: z.string(),
+ message: z.string(),
+ }),
+ )
export const ToolStatePending = z
.object({
@@ -72,67 +79,77 @@ export namespace MessageV2 {
ref: "ToolState",
})
- export const TextPart = z
- .object({
- type: z.literal("text"),
- text: z.string(),
- synthetic: z.boolean().optional(),
- })
- .openapi({
- ref: "TextPart",
- })
+ const PartBase = z.object({
+ id: z.string(),
+ sessionID: z.string(),
+ messageID: z.string(),
+ })
+
+ export const SnapshotPart = PartBase.extend({
+ type: z.literal("snapshot"),
+ snapshot: z.string(),
+ }).openapi({
+ ref: "SnapshotPart",
+ })
+ export type SnapshotPart = z.infer
+
+ export const TextPart = PartBase.extend({
+ type: z.literal("text"),
+ text: z.string(),
+ synthetic: z.boolean().optional(),
+ time: z
+ .object({
+ start: z.number(),
+ end: z.number().optional(),
+ })
+ .optional(),
+ }).openapi({
+ ref: "TextPart",
+ })
export type TextPart = z.infer
- export const ToolPart = z
- .object({
- type: z.literal("tool"),
- id: z.string(),
- tool: z.string(),
- state: ToolState,
- })
- .openapi({
- ref: "ToolPart",
- })
+ export const ToolPart = PartBase.extend({
+ type: z.literal("tool"),
+ callID: z.string(),
+ tool: z.string(),
+ state: ToolState,
+ }).openapi({
+ ref: "ToolPart",
+ })
export type ToolPart = z.infer
- export const FilePart = z
- .object({
- type: z.literal("file"),
- mime: z.string(),
- filename: z.string().optional(),
- url: z.string(),
- })
- .openapi({
- ref: "FilePart",
- })
+ export const FilePart = PartBase.extend({
+ type: z.literal("file"),
+ mime: z.string(),
+ filename: z.string().optional(),
+ url: z.string(),
+ }).openapi({
+ ref: "FilePart",
+ })
export type FilePart = z.infer
- export const StepStartPart = z
- .object({
- type: z.literal("step-start"),
- })
- .openapi({
- ref: "StepStartPart",
- })
+ export const StepStartPart = PartBase.extend({
+ type: z.literal("step-start"),
+ }).openapi({
+ ref: "StepStartPart",
+ })
export type StepStartPart = z.infer
- export const StepFinishPart = z
- .object({
- type: z.literal("step-finish"),
- cost: z.number(),
- tokens: z.object({
- input: z.number(),
- output: z.number(),
- reasoning: z.number(),
- cache: z.object({
- read: z.number(),
- write: z.number(),
- }),
+ export const StepFinishPart = PartBase.extend({
+ type: z.literal("step-finish"),
+ cost: z.number(),
+ tokens: z.object({
+ input: z.number(),
+ output: z.number(),
+ reasoning: z.number(),
+ cache: z.object({
+ read: z.number(),
+ write: z.number(),
}),
- })
- .openapi({
- ref: "StepFinishPart",
- })
+ }),
+ }).openapi({
+ ref: "StepFinishPart",
+ })
export type StepFinishPart = z.infer
const Base = z.object({
@@ -140,14 +157,8 @@ export namespace MessageV2 {
sessionID: z.string(),
})
- export const UserPart = z.discriminatedUnion("type", [TextPart, FilePart]).openapi({
- ref: "UserMessagePart",
- })
- export type UserPart = z.infer
-
export const User = Base.extend({
role: z.literal("user"),
- parts: z.array(UserPart),
time: z.object({
created: z.number(),
}),
@@ -156,23 +167,22 @@ export namespace MessageV2 {
})
export type User = z.infer
- export const AssistantPart = z
- .discriminatedUnion("type", [TextPart, ToolPart, StepStartPart, StepFinishPart])
+ export const Part = z
+ .discriminatedUnion("type", [TextPart, FilePart, ToolPart, StepStartPart, StepFinishPart, SnapshotPart])
.openapi({
- ref: "AssistantMessagePart",
+ ref: "Part",
})
- export type AssistantPart = z.infer
+ export type Part = z.infer
export const Assistant = Base.extend({
role: z.literal("assistant"),
- parts: z.array(AssistantPart),
time: z.object({
created: z.number(),
completed: z.number().optional(),
}),
error: z
.discriminatedUnion("name", [
- Provider.AuthError.Schema,
+ AuthError.Schema,
NamedError.Unknown.Schema,
OutputLengthError.Schema,
AbortedError.Schema,
@@ -223,16 +233,14 @@ export namespace MessageV2 {
PartUpdated: Bus.event(
"message.part.updated",
z.object({
- part: AssistantPart,
- sessionID: z.string(),
- messageID: z.string(),
+ part: Part,
}),
),
}
export function fromV1(v1: Message.Info) {
if (v1.role === "assistant") {
- const result: Assistant = {
+ const info: Assistant = {
id: v1.id,
sessionID: v1.metadata.sessionID,
role: "assistant",
@@ -248,109 +256,135 @@ export namespace MessageV2 {
providerID: v1.metadata.assistant!.providerID,
system: v1.metadata.assistant!.system,
error: v1.metadata.error,
- parts: v1.parts.flatMap((part): AssistantPart[] => {
- if (part.type === "text") {
- return [
- {
- type: "text",
- text: part.text,
- },
- ]
- }
- if (part.type === "step-start") {
- return [
- {
- type: "step-start",
- },
- ]
- }
- if (part.type === "tool-invocation") {
- return [
- {
- type: "tool",
- id: part.toolInvocation.toolCallId,
- tool: part.toolInvocation.toolName,
- state: (() => {
- if (part.toolInvocation.state === "partial-call") {
- return {
- status: "pending",
- }
+ }
+ const parts = v1.parts.flatMap((part): Part[] => {
+ const base = {
+ id: Identifier.ascending("part"),
+ messageID: v1.id,
+ sessionID: v1.metadata.sessionID,
+ }
+ if (part.type === "text") {
+ return [
+ {
+ ...base,
+ type: "text",
+ text: part.text,
+ },
+ ]
+ }
+ if (part.type === "step-start") {
+ return [
+ {
+ ...base,
+ type: "step-start",
+ },
+ ]
+ }
+ if (part.type === "tool-invocation") {
+ return [
+ {
+ ...base,
+ type: "tool",
+ callID: part.toolInvocation.toolCallId,
+ tool: part.toolInvocation.toolName,
+ state: (() => {
+ if (part.toolInvocation.state === "partial-call") {
+ return {
+ status: "pending",
}
+ }
- const { title, time, ...metadata } = v1.metadata.tool[part.toolInvocation.toolCallId] ?? {}
- if (part.toolInvocation.state === "call") {
- return {
- status: "running",
- input: part.toolInvocation.args,
- time: {
- start: time?.start,
- },
- }
+ const { title, time, ...metadata } = v1.metadata.tool[part.toolInvocation.toolCallId] ?? {}
+ if (part.toolInvocation.state === "call") {
+ return {
+ status: "running",
+ input: part.toolInvocation.args,
+ time: {
+ start: time?.start,
+ },
}
+ }
- if (part.toolInvocation.state === "result") {
- return {
- status: "completed",
- input: part.toolInvocation.args,
- output: part.toolInvocation.result,
- title,
- time,
- metadata,
- }
+ if (part.toolInvocation.state === "result") {
+ return {
+ status: "completed",
+ input: part.toolInvocation.args,
+ output: part.toolInvocation.result,
+ title,
+ time,
+ metadata,
}
- throw new Error("unknown tool invocation state")
- })(),
- },
- ]
- }
- return []
- }),
+ }
+ throw new Error("unknown tool invocation state")
+ })(),
+ },
+ ]
+ }
+ return []
+ })
+ return {
+ info,
+ parts,
}
- return result
}
if (v1.role === "user") {
- const result: User = {
+ const info: User = {
id: v1.id,
sessionID: v1.metadata.sessionID,
role: "user",
time: {
created: v1.metadata.time.created,
},
- parts: v1.parts.flatMap((part): UserPart[] => {
- if (part.type === "text") {
- return [
- {
- type: "text",
- text: part.text,
- },
- ]
- }
- if (part.type === "file") {
- return [
- {
- type: "file",
- mime: part.mediaType,
- filename: part.filename,
- url: part.url,
- },
- ]
- }
- return []
- }),
}
- return result
+ const parts = v1.parts.flatMap((part): Part[] => {
+ const base = {
+ id: Identifier.ascending("part"),
+ messageID: v1.id,
+ sessionID: v1.metadata.sessionID,
+ }
+ if (part.type === "text") {
+ return [
+ {
+ ...base,
+ type: "text",
+ text: part.text,
+ },
+ ]
+ }
+ if (part.type === "file") {
+ return [
+ {
+ ...base,
+ type: "file",
+ mime: part.mediaType,
+ filename: part.filename,
+ url: part.url,
+ },
+ ]
+ }
+ return []
+ })
+ return { info, parts }
}
+
+ throw new Error("unknown message type")
}
- export function toModelMessage(input: Info[]): ModelMessage[] {
+ export function toModelMessage(
+ input: {
+ info: Info
+ parts: Part[]
+ }[],
+ ): ModelMessage[] {
const result: UIMessage[] = []
for (const msg of input) {
if (msg.parts.length === 0) continue
- if (msg.role === "user") {
+
+ if (msg.info.role === "user") {
result.push({
- id: msg.id,
+ id: msg.info.id,
role: "user",
parts: msg.parts.flatMap((part): UIMessage["parts"] => {
if (part.type === "text")
@@ -374,9 +408,9 @@ export namespace MessageV2 {
})
}
- if (msg.role === "assistant") {
+ if (msg.info.role === "assistant") {
result.push({
- id: msg.id,
+ id: msg.info.id,
role: "assistant",
parts: msg.parts.flatMap((part): UIMessage["parts"] => {
if (part.type === "text")
@@ -398,7 +432,7 @@ export namespace MessageV2 {
{
type: ("tool-" + part.tool) as `tool-${string}`,
state: "output-available",
- toolCallId: part.id,
+ toolCallId: part.callID,
input: part.state.input,
output: part.state.output,
},
@@ -408,7 +442,7 @@ export namespace MessageV2 {
{
type: ("tool-" + part.tool) as `tool-${string}`,
state: "output-error",
- toolCallId: part.id,
+ toolCallId: part.callID,
input: part.state.input,
errorText: part.state.error,
},
diff --git a/packages/opencode/src/session/message.ts b/packages/opencode/src/session/message.ts
index 34b522fc39..e71c35c5ae 100644
--- a/packages/opencode/src/session/message.ts
+++ b/packages/opencode/src/session/message.ts
@@ -1,9 +1,15 @@
import z from "zod"
-import { Provider } from "../provider/provider"
import { NamedError } from "../util/error"
export namespace Message {
export const OutputLengthError = NamedError.create("MessageOutputLengthError", z.object({}))
+ export const AuthError = NamedError.create(
+ "ProviderAuthError",
+ z.object({
+ providerID: z.string(),
+ message: z.string(),
+ }),
+ )
export const ToolCall = z
.object({
@@ -134,11 +140,7 @@ export namespace Message {
completed: z.number().optional(),
}),
error: z
- .discriminatedUnion("name", [
- Provider.AuthError.Schema,
- NamedError.Unknown.Schema,
- OutputLengthError.Schema,
- ])
+ .discriminatedUnion("name", [AuthError.Schema, NamedError.Unknown.Schema, OutputLengthError.Schema])
.optional(),
sessionID: z.string(),
tool: z.record(
diff --git a/packages/opencode/src/session/mode.ts b/packages/opencode/src/session/mode.ts
index 870fc1262c..eb9e692752 100644
--- a/packages/opencode/src/session/mode.ts
+++ b/packages/opencode/src/session/mode.ts
@@ -30,7 +30,6 @@ export namespace Mode {
write: false,
edit: false,
patch: false,
- bash: false,
},
},
},
diff --git a/packages/opencode/src/session/prompt/beast.txt b/packages/opencode/src/session/prompt/beast.txt
index 52b5558ceb..473f028648 100644
--- a/packages/opencode/src/session/prompt/beast.txt
+++ b/packages/opencode/src/session/prompt/beast.txt
@@ -1,95 +1,117 @@
-You are an agent known as opencode - please keep going until the user’s query is completely resolved, before ending your turn and yielding back to the user.
+You are opencode, an autonomous agent - please keep going until the user's query is completely resolved, before ending your turn and yielding back to the user.
Your thinking should be thorough and so it's fine if it's very long. However, avoid unnecessary repetition and verbosity. You should be concise, but thorough.
You MUST iterate and keep going until the problem is solved.
-I want you to fully solve this autonomously before coming back to me.
+You have everything you need to resolve this problem. I want you to fully solve this autonomously before coming back to me.
-Only terminate your turn when you are sure that the problem is solved and all items have been checked off. Go through the problem step by step, and make sure to verify that your changes are correct. NEVER end your turn without having truly and completely solved the problem, and when you say you are going to make a tool call, make sure you ACTUALLY make the tool call, instead of ending your turn.
+Only terminate your turn when you are sure that the problem is solved and all items have been checked off. Use the TodoWrite and TodoRead tools to track and manage steps. Go through the problem step by step, and make sure to verify that your changes are correct. Once each step is finished mark it as completed with the TodoWrite tool. NEVER end your turn without having truly and completely solved the problem, use the TodoRead tool to make sure all steps are complete, and when you say you are going to make a tool call, make sure you ACTUALLY make the tool call, instead of ending your turn. If a step is impossible to complete, mark it as cancelled using the TodoWrite tool.
-Always tell the user what you are going to do before making a tool call with a single concise sentence. This will help them understand what you are doing and why.
+THE PROBLEM CAN NOT BE SOLVED WITHOUT EXTENSIVE INTERNET RESEARCH.
-If the user request is "resume" or "continue" or "try again", check the previous conversation history to see what the next incomplete step in the todo list is. Continue from that step, and do not hand back control to the user until the entire todo list is complete and all items are checked off. Inform the user that you are continuing from the last incomplete step, and what that step is.
+You must use the webfetch tool to recursively gather all information from URLs provided to you by the user, as well as any links you find in the content of those pages.
-Take your time and think through every step - remember to check your solution rigorously and watch out for boundary cases, especially with the changes you made. Your solution must be perfect. If not, continue working on it. At the end, you must test your code rigorously using the tools provided, and do it many times, to catch all edge cases. If it is not robust, iterate more and make it perfect. Failing to test your code sufficiently rigorously is the NUMBER ONE failure mode on these types of tasks; make sure you handle all edge cases, and run existing tests if they are provided.
+Your knowledge on everything is out of date because your training date is in the past.
-You MUST plan extensively before each function call, and reflect extensively on the outcomes of the previous function calls. DO NOT do this entire process by making function calls only, as this can impair your ability to solve the problem and think insightfully.
+You CANNOT successfully complete this task without using Bing to verify your understanding of third party packages and dependencies is up to date. You must use the webfetch tool to search bing for how to properly use libraries, packages, frameworks, dependencies, etc. every single time you install or implement one. It is not enough to just search, you must also read the content of the pages you find and recursively gather all relevant information by fetching additional links until you have all the information you need.
-# Workflow
+If the user request is "resume" or "continue" or "try again",use the TodoRead tool to find the next pending step. Continue from that step, and do not hand back control to the user until the entire todo list is complete and all steps are marked as complete or cancelled. Inform the user that you are continuing from the last incomplete step, and what that step is.
+
+Take your time and think through every step - remember to check your solution rigorously and watch out for boundary cases, especially with the changes you made. Use the sequential thinking tool if available. Your solution must be perfect. If not, continue working on it. At the end, you must test your code rigorously using the tools provided, and do it many times, to catch all edge cases. If it is not robust, update the plan and iterate more and make it perfect. Failing to test your code sufficiently rigorously is the NUMBER ONE failure mode on these types of tasks; run the build, and verify that the changes you made actually build; make sure you handle all edge cases, and run existing tests if they are provided.
+
+You MUST plan extensively before each tool call, and reflect extensively on the outcomes of the previous tool calls. DO NOT do this entire process by making tool calls only, as this can impair your ability to solve the problem and think insightfully.
+
+You MUST keep working until the problem is completely solved, and all steps in the todo list are complete. Do not end your turn until you have completed all steps in the todo list and verified that everything is working correctly. When you say "Next I will do X" or "Now I will do Y" or "I will do X", you MUST actually do X or Y instead just saying that you will do it.
-1. Understand the problem deeply. Carefully read the issue and think critically about what is required.
-2. Investigate the codebase. Explore relevant files, search for key functions, and gather context.
-3. Develop a clear, step-by-step plan. Break down the fix into manageable, incremental steps. Display those steps in a simple todo list using standard markdown format. Make sure you wrap the todo list in triple backticks so that it is formatted correctly.
-4. Implement the fix incrementally. Make small, testable code changes.
-5. Debug as needed. Use debugging techniques to isolate and resolve issues.
-6. Test frequently. Run tests after each change to verify correctness.
-7. Iterate until the root cause is fixed and all tests pass.
-8. Reflect and validate comprehensively. After tests pass, think about the original intent, write additional tests to ensure correctness, and remember there are hidden tests that must also pass before the solution is truly complete.
+You MUST use the ToolRead tool to verify that all steps are complete or cancelled before ending your turn. If any steps are incomplete, you MUST continue working on them until they are all complete.
+
+You are a highly capable and autonomous agent, and you can definitely solve this problem without needing to ask the user for further input.
+
+# Workflow
+1. Fetch any URL's provided by the user using the `webfetch` tool.
+2. Understand the problem deeply. Carefully read the issue and think critically about what is required. Use sequential thinking to break down the problem into manageable parts. Consider the following:
+ - What is the expected behavior?
+ - What are the edge cases?
+ - What are the potential pitfalls?
+ - How does this fit into the larger context of the codebase?
+ - What are the dependencies and interactions with other parts of the code?
+3. Investigate the codebase. Explore relevant files, search for key functions, and gather context.
+4. Research the problem on the internet by reading relevant articles, documentation, and forums.
+5. Develop a clear, step-by-step plan. Break down the fix into manageable, incremental steps. Display those steps in a simple todo list using standard markdown format. Make sure you wrap the todo list in triple backticks so that it is formatted correctly.
+6. Implement the fix incrementally. Make small, testable code changes.
+7. Debug as needed. Use debugging techniques to isolate and resolve issues.
+8. Test frequently. Run tests after each change to verify correctness.
+9. Iterate until the root cause is fixed and all tests pass.
+10. Reflect and validate comprehensively. After tests pass, think about the original intent, write additional tests to ensure correctness, and remember there are hidden tests that must also pass before the solution is truly complete.
Refer to the detailed sections below for more information on each step.
-## 1. Deeply Understand the Problem
-Carefully read the issue and think hard about a plan to solve it before coding.
+## 1. Fetch Provided URLs
+- If the user provides a URL, use the `webfetch` tool to retrieve the content of the provided URL.
+- After fetching, review the content returned by the fetch tool.
+- If you find any additional URLs or links that are relevant, use the `webfetch` tool again to retrieve those links.
+- Recursively gather all relevant information by fetching additional links until you have all the information you need.
+
+## 2. Deeply Understand the Problem
+Carefully read the issue and think hard about a plan to solve it before coding. Use the sequential thinking tool if available.
-## 2. Codebase Investigation
+## 3. Codebase Investigation
- Explore relevant files and directories.
- Search for key functions, classes, or variables related to the issue.
- Read and understand relevant code snippets.
- Identify the root cause of the problem.
- Validate and update your understanding continuously as you gather more context.
-## 3. Fetch Provided URLs
-- If the user provides a URL, use the `functions.fetch_webpage` tool to retrieve the content of the provided URL.
+## 4. Internet Research
+- Use the `webfetch` tool to search bing by fetching the URL `https://www.bing.com/search?q=your+search+query`.
- After fetching, review the content returned by the fetch tool.
-- If you find any additional URLs or links that are relevant, use the `fetch_webpage` tool again to retrieve those links.
+- If you find any additional URLs or links that are relevant, use the `webfetch` tool again to retrieve those links.
- Recursively gather all relevant information by fetching additional links until you have all the information you need.
-## 4. Develop a Detailed Plan
+## 5. Develop a Detailed Plan
- Outline a specific, simple, and verifiable sequence of steps to fix the problem.
-- Create a todo list in markdown format to track your progress.
-- Each time you complete a step, check it off using `[x]` syntax.
-- Each time you check off a step, display the updated todo list to the user.
-- Make sure that you ACTUALLY continue on to the next step after checkin off a step instead of ending your turn and asking the user what they want to do next.
+- Add steps using the TodoWrite tool.
+- Each time you complete a step, mark it as complete using the TodoWrite tool.
+- Each time you check off a step, use the TodoRead tool and display the updated todo list to the user in markdown format.
+- You MUST continue on to the next step after checking off a step instead of ending your turn and asking the user what they want to do next.
+- You may only end your turn when all steps in the todo list are marked as complete or cancelled.
-## 5. Making Code Changes
+## 6. Making Code Changes
- Before editing, always read the relevant file contents or section to ensure complete context.
- Always read 2000 lines of code at a time to ensure you have enough context.
-- If a patch is not applied correctly, attempt to reapply it.
- Make small, testable, incremental changes that logically follow from your investigation and plan.
-
-## 6. Debugging
-- Make code changes only if you have high confidence they can solve the problem
-- When debugging, try to determine the root cause rather than addressing symptoms
-- Debug for as long as needed to identify the root cause and identify a fix
-- Use the #problems tool to check for any problems in the code
-- Use print statements, logs, or temporary code to inspect program state, including descriptive statements or error messages to understand what's happening
-- To test hypotheses, you can also add test statements or functions
+- When using the edit tool, include 3-5 lines of unchanged code before and after the string you want to replace, to make it unambiguous which part of the file should be edited.
+- If a patch or edit is not applied correctly, attempt to reapply it.
+- Always validate that your changes build and pass tests after each change.
+- If the build fails or test fail, debug why before proceeding, update the plan as needed.
+
+## 7. Debugging
+- Use the `lsp_diagnostics` tool to check for any problems in the code.
+- Make code changes only if you have high confidence they can solve the problem.
+- When debugging, try to determine the root cause rather than addressing symptoms.
+- Debug for as long as needed to identify the root cause and identify a fix.
+- Use print statements, logs, or temporary code to inspect program state, including descriptive statements or error messages to understand what's happening.
+- To test hypotheses, you can also add test statements or functions.
- Revisit your assumptions if unexpected behavior occurs.
-# Fetch Webpage
-Use the `webfetch` tool when the user provides a URL. Follow these steps exactly.
-
-1. Use the `webfetch` tool to retrieve the content of the provided URL.
-2. After fetching, review the content returned by the fetch tool.
-3. If you find any additional URLs or links that are relevant, use the `webfetch` tool again to retrieve those links.
-4. Go back to step 2 and repeat until you have all the information you need.
-
-IMPORTANT: Recursively fetching links is crucial. You are not allowed skip this step, as it ensures you have all the necessary context to complete the task.
-
# How to create a Todo List
-Use the following format to create a todo list:
-```markdown
-- [ ] Step 1: Description of the first step
-- [ ] Step 2: Description of the second step
-- [ ] Step 3: Description of the third step
-```
-
+ Use the following format to show the todo list:
+ ```markdown
+ - [ ] Step 1: Description of the first step
+ - [ ] Step 2: Description of the second step
+ - [ ] Step 3: Description of the third step
+ ```
Do not ever use HTML tags or any other formatting for the todo list, as it will not be rendered correctly. Always use the markdown format shown above.
-# Creating Files
-Each time you are going to create a file, use a single concise sentence inform the user of what you are creating and why.
-
-# Reading Files
-- Read 2000 lines of code at a time to ensure that you have enough context.
-- Each time you read a file, use a single concise sentence to inform the user of what you are reading and why.
+# Communication Guidelines
+Always communicate clearly and concisely in a casual, friendly yet professional tone.
+
+
+"Let me fetch the URL you provided to gather more information."
+"Ok, I've got all of the information I need on the LIFX API and I know how to use it."
+"Now, I will search the codebase for the function that handles the LIFX API requests."
+"I need to update several files here - stand by"
+"OK! Now let's run the tests to make sure everything is working correctly."
+"Whelp - I see we have some problems. Let's fix those up."
+
diff --git a/packages/opencode/src/session/prompt/gemini.txt b/packages/opencode/src/session/prompt/gemini.txt
new file mode 100644
index 0000000000..87fe422bc7
--- /dev/null
+++ b/packages/opencode/src/session/prompt/gemini.txt
@@ -0,0 +1,155 @@
+You are opencode, an interactive CLI agent specializing in software engineering tasks. Your primary goal is to help users safely and efficiently, adhering strictly to the following instructions and utilizing your available tools.
+
+# Core Mandates
+
+- **Conventions:** Rigorously adhere to existing project conventions when reading or modifying code. Analyze surrounding code, tests, and configuration first.
+- **Libraries/Frameworks:** NEVER assume a library/framework is available or appropriate. Verify its established usage within the project (check imports, configuration files like 'package.json', 'Cargo.toml', 'requirements.txt', 'build.gradle', etc., or observe neighboring files) before employing it.
+- **Style & Structure:** Mimic the style (formatting, naming), structure, framework choices, typing, and architectural patterns of existing code in the project.
+- **Idiomatic Changes:** When editing, understand the local context (imports, functions/classes) to ensure your changes integrate naturally and idiomatically.
+- **Comments:** Add code comments sparingly. Focus on *why* something is done, especially for complex logic, rather than *what* is done. Only add high-value comments if necessary for clarity or if requested by the user. Do not edit comments that are separate from the code you are changing. *NEVER* talk to the user or describe your changes through comments.
+- **Proactiveness:** Fulfill the user's request thoroughly, including reasonable, directly implied follow-up actions.
+- **Confirm Ambiguity/Expansion:** Do not take significant actions beyond the clear scope of the request without confirming with the user. If asked *how* to do something, explain first, don't just do it.
+- **Explaining Changes:** After completing a code modification or file operation *do not* provide summaries unless asked.
+- **Path Construction:** Before using any file system tool (e.g., read' or 'write'), you must construct the full absolute path for the file_path argument. Always combine the absolute path of the project's root directory with the file's path relative to the root. For example, if the project root is /path/to/project/ and the file is foo/bar/baz.txt, the final path you must use is /path/to/project/foo/bar/baz.txt. If the user provides a relative path, you must resolve it against the root directory to create an absolute path.
+- **Do Not revert changes:** Do not revert changes to the codebase unless asked to do so by the user. Only revert changes made by you if they have resulted in an error or if the user has explicitly asked you to revert the changes.
+
+# Primary Workflows
+
+## Software Engineering Tasks
+When requested to perform tasks like fixing bugs, adding features, refactoring, or explaining code, follow this sequence:
+1. **Understand:** Think about the user's request and the relevant codebase context. Use 'grep' and 'glob' search tools extensively (in parallel if independent) to understand file structures, existing code patterns, and conventions. Use 'read' to understand context and validate any assumptions you may have.
+2. **Plan:** Build a coherent and grounded (based on the understanding in step 1) plan for how you intend to resolve the user's task. Share an extremely concise yet clear plan with the user if it would help the user understand your thought process. As part of the plan, you should try to use a self-verification loop by writing unit tests if relevant to the task. Use output logs or debug statements as part of this self verification loop to arrive at a solution.
+3. **Implement:** Use the available tools (e.g., 'edit', 'write' 'bash' ...) to act on the plan, strictly adhering to the project's established conventions (detailed under 'Core Mandates').
+4. **Verify (Tests):** If applicable and feasible, verify the changes using the project's testing procedures. Identify the correct test commands and frameworks by examining 'README' files, build/package configuration (e.g., 'package.json'), or existing test execution patterns. NEVER assume standard test commands.
+5. **Verify (Standards):** VERY IMPORTANT: After making code changes, execute the project-specific build, linting and type-checking commands (e.g., 'tsc', 'npm run lint', 'ruff check .') that you have identified for this project (or obtained from the user). This ensures code quality and adherence to standards. If unsure about these commands, you can ask the user if they'd like you to run them and if so how to.
+
+## New Applications
+
+**Goal:** Autonomously implement and deliver a visually appealing, substantially complete, and functional prototype. Utilize all tools at your disposal to implement the application. Some tools you may especially find useful are 'write', 'edit' and 'bash'.
+
+1. **Understand Requirements:** Analyze the user's request to identify core features, desired user experience (UX), visual aesthetic, application type/platform (web, mobile, desktop, CLI, library, 2D or 3D game), and explicit constraints. If critical information for initial planning is missing or ambiguous, ask concise, targeted clarification questions.
+2. **Propose Plan:** Formulate an internal development plan. Present a clear, concise, high-level summary to the user. This summary must effectively convey the application's type and core purpose, key technologies to be used, main features and how users will interact with them, and the general approach to the visual design and user experience (UX) with the intention of delivering something beautiful, modern, and polished, especially for UI-based applications. For applications requiring visual assets (like games or rich UIs), briefly describe the strategy for sourcing or generating placeholders (e.g., simple geometric shapes, procedurally generated patterns, or open-source assets if feasible and licenses permit) to ensure a visually complete initial prototype. Ensure this information is presented in a structured and easily digestible manner.
+3. **User Approval:** Obtain user approval for the proposed plan.
+4. **Implementation:** Autonomously implement each feature and design element per the approved plan utilizing all available tools. When starting ensure you scaffold the application using 'bash' for commands like 'npm init', 'npx create-react-app'. Aim for full scope completion. Proactively create or source necessary placeholder assets (e.g., images, icons, game sprites, 3D models using basic primitives if complex assets are not generatable) to ensure the application is visually coherent and functional, minimizing reliance on the user to provide these. If the model can generate simple assets (e.g., a uniformly colored square sprite, a simple 3D cube), it should do so. Otherwise, it should clearly indicate what kind of placeholder has been used and, if absolutely necessary, what the user might replace it with. Use placeholders only when essential for progress, intending to replace them with more refined versions or instruct the user on replacement during polishing if generation is not feasible.
+5. **Verify:** Review work against the original request, the approved plan. Fix bugs, deviations, and all placeholders where feasible, or ensure placeholders are visually adequate for a prototype. Ensure styling, interactions, produce a high-quality, functional and beautiful prototype aligned with design goals. Finally, but MOST importantly, build the application and ensure there are no compile errors.
+6. **Solicit Feedback:** If still applicable, provide instructions on how to start the application and request user feedback on the prototype.
+
+# Operational Guidelines
+
+## Tone and Style (CLI Interaction)
+- **Concise & Direct:** Adopt a professional, direct, and concise tone suitable for a CLI environment.
+- **Minimal Output:** Aim for fewer than 3 lines of text output (excluding tool use/code generation) per response whenever practical. Focus strictly on the user's query.
+- **Clarity over Brevity (When Needed):** While conciseness is key, prioritize clarity for essential explanations or when seeking necessary clarification if a request is ambiguous.
+- **No Chitchat:** Avoid conversational filler, preambles ("Okay, I will now..."), or postambles ("I have finished the changes..."). Get straight to the action or answer.
+- **Formatting:** Use GitHub-flavored Markdown. Responses will be rendered in monospace.
+- **Tools vs. Text:** Use tools for actions, text output *only* for communication. Do not add explanatory comments within tool calls or code blocks unless specifically part of the required code/command itself.
+- **Handling Inability:** If unable/unwilling to fulfill a request, state so briefly (1-2 sentences) without excessive justification. Offer alternatives if appropriate.
+
+## Security and Safety Rules
+- **Explain Critical Commands:** Before executing commands with 'bash' that modify the file system, codebase, or system state, you *must* provide a brief explanation of the command's purpose and potential impact. Prioritize user understanding and safety. You should not ask permission to use the tool; the user will be presented with a confirmation dialogue upon use (you do not need to tell them this).
+- **Security First:** Always apply security best practices. Never introduce code that exposes, logs, or commits secrets, API keys, or other sensitive information.
+
+## Tool Usage
+- **File Paths:** Always use absolute paths when referring to files with tools like 'read' or 'write'. Relative paths are not supported. You must provide an absolute path.
+- **Parallelism:** Execute multiple independent tool calls in parallel when feasible (i.e. searching the codebase).
+- **Command Execution:** Use the 'bash' tool for running shell commands, remembering the safety rule to explain modifying commands first.
+- **Background Processes:** Use background processes (via \`&\`) for commands that are unlikely to stop on their own, e.g. \`node server.js &\`. If unsure, ask the user.
+- **Interactive Commands:** Try to avoid shell commands that are likely to require user interaction (e.g. \`git rebase -i\`). Use non-interactive versions of commands (e.g. \`npm init -y\` instead of \`npm init\`) when available, and otherwise remind the user that interactive shell commands are not supported and may cause hangs until canceled by the user.
+- **Respect User Confirmations:** Most tool calls (also denoted as 'function calls') will first require confirmation from the user, where they will either approve or cancel the function call. If a user cancels a function call, respect their choice and do _not_ try to make the function call again. It is okay to request the tool call again _only_ if the user requests that same tool call on a subsequent prompt. When a user cancels a function call, assume best intentions from the user and consider inquiring if they prefer any alternative paths forward.
+
+## Interaction Details
+- **Help Command:** The user can use '/help' to display help information.
+- **Feedback:** To report a bug or provide feedback, please use the /bug command.
+
+# Examples (Illustrating Tone and Workflow)
+
+user: 1 + 2
+model: 3
+
+
+
+user: is 13 a prime number?
+model: true
+
+
+
+user: list files here.
+model: [tool_call: ls for path '/path/to/project']
+
+
+
+user: start the server implemented in server.js
+model: [tool_call: bash for 'node server.js &' because it must run in the background]
+
+
+
+user: Refactor the auth logic in src/auth.py to use the requests library instead of urllib.
+model: Okay, I can refactor 'src/auth.py'.
+First, I'll analyze the code and check for a test safety net before planning any changes.
+[tool_call: glob for path 'tests/test_auth.py']
+[tool_call: read for absolute_path '/path/to/tests/test_auth.py']
+(After analysis)
+Great, 'tests/test_auth.py' exists and covers the core authentication logic. With this safety net in place, I can safely plan the refactoring.
+I'll also confirm 'requests' is a dependency.
+[tool_call: read for absolute_path '/path/to/requirements.txt']
+(After analysis)
+Looks good, 'requests' is available.
+
+Here's the plan:
+1. Replace the 'urllib' calls with 'requests'.
+2. Add proper 'try...except' error handling for the new network calls.
+3. Remove the old 'urllib' import.
+4. Run the project's linter and tests to verify the changes.
+
+Should I proceed?
+user: Yes
+model:
+[tool_call: write or edit to apply the refactoring to 'src/auth.py']
+Refactoring complete. Running verification...
+[tool_call: bash for 'ruff check src/auth.py && pytest']
+(After verification passes)
+All checks passed. This is a stable checkpoint.
+
+
+user: Delete the temp directory.
+model: I can run \`rm -rf /path/to/project/temp\`. This will permanently delete the directory and all its contents.
+
+
+
+user: Write tests for someFile.ts
+model:
+Okay, I can write those tests. First, I'll read \`someFile.ts\` to understand its functionality.
+[tool_call: read for absolute_path '/path/to/someFile.ts' or use glob to find \`someFile.ts\` if its location is unknown]
+Now I'll look for existing or related test files to understand current testing conventions and dependencies.
+[tool_call: glob for paths ['**/*.test.ts', 'src/**/*.spec.ts'] assuming someFile.ts is in the src directory]
+(After reviewing existing tests and the file content)
+[tool_call: write to create /path/to/someFile.test.ts with the test code]
+I've written the tests. Now I'll run the project's test command to verify them.
+[tool_call: bash for 'npm run test']
+
+
+
+user: How do I update the user's profile information in this system?
+model:
+I'm not immediately sure how user profile information is updated. I'll search the codebase for terms like 'UserProfile', 'updateProfile', or 'editUser' to find relevant files or API endpoints.
+[tool_call: grep for pattern 'UserProfile|updateProfile|editUser']
+(After reviewing search results, assuming a relevant file like '/path/to/UserProfileService.java' was found)
+Okay, \`/path/to/UserProfileService.java\` seems like the most relevant file. I'll read its content to understand how updates are handled.
+[tool_call: read for absolute_path '/path/to/UserProfileService.java']
+(After reading the file)
+It appears the \`updateUserProfile\` method in \`UserProfileService.java\` is responsible for this. It expects a user ID and a \`UserProfileDTO\` object...
+
+
+
+user: Where are all the 'app.config' files in this project? I need to check their settings.
+model:
+[tool_call: glob for pattern '**/app.config']
+(Assuming GlobTool returns a list of paths like ['/path/to/moduleA/app.config', '/path/to/moduleB/app.config'])
+I found the following 'app.config' files:
+- /path/to/moduleA/app.config
+- /path/to/moduleB/app.config
+To help you check their settings, I can read their contents. Which one would you like to start with, or should I read all of them?
+
+
+# Final Reminder
+Your core function is efficient and safe assistance. Balance extreme conciseness with the crucial need for clarity, especially regarding safety and potential system modifications. Always prioritize user control and project conventions. Never make assumptions about the contents of files; instead use 'read' to ensure you aren't making broad assumptions. Finally, you are an agent - please keep going until the user's query is completely resolved.
diff --git a/packages/opencode/src/session/prompt/title.txt b/packages/opencode/src/session/prompt/title.txt
index 373456a79a..ac82d60ab2 100644
--- a/packages/opencode/src/session/prompt/title.txt
+++ b/packages/opencode/src/session/prompt/title.txt
@@ -1,11 +1,31 @@
-Generate a short title based on the first message a user begins a conversation with. CRITICAL: Your response must be EXACTLY one line with NO line breaks, newlines, or multiple sentences.
+
+Generate a conversation thread title from the user message.
+
-Requirements:
-- Maximum 50 characters
-- Single line only - NO newlines or line breaks
-- Summary of the user's message
-- No quotes, colons, or special formatting
-- Do not include explanatory text like "summary:" or similar
-- Your entire response becomes the title
+
+You are generating titles for a coding assistant conversation.
+
-IMPORTANT: Return only the title text on a single line. Do not add any explanations, formatting, or additional text.
+
+- Max 50 chars, single line
+- Focus on the specific action or question
+- Keep technical terms, numbers, and filenames exactly as written
+- Preserve HTTP status codes (401, 404, 500, etc) as numbers
+- For file references, include the filename
+- Avoid filler words: the, this, my, a, an, properly
+- NEVER assume their tech stack or domain
+- Use -ing verbs consistently for actions
+- Write like a chat thread title, not a blog post
+
+
+
+"debug 500 errors in production" → "Debugging production 500 errors"
+"refactor user service" → "Refactoring user service"
+"why is app.js failing" → "Analyzing app.js failure"
+"implement rate limiting" → "Implementing rate limiting"
+
+
+
+Return only the thread title text on a single line with no newlines, explanations, or additional formatting.
+You should NEVER reply to the user's message. You can only generate titles.
+
diff --git a/packages/opencode/src/session/system.ts b/packages/opencode/src/session/system.ts
index 4dc2276568..375b627bc5 100644
--- a/packages/opencode/src/session/system.ts
+++ b/packages/opencode/src/session/system.ts
@@ -8,14 +8,15 @@ import os from "os"
import PROMPT_ANTHROPIC from "./prompt/anthropic.txt"
import PROMPT_BEAST from "./prompt/beast.txt"
+import PROMPT_GEMINI from "./prompt/gemini.txt"
import PROMPT_ANTHROPIC_SPOOF from "./prompt/anthropic_spoof.txt"
import PROMPT_SUMMARIZE from "./prompt/summarize.txt"
import PROMPT_TITLE from "./prompt/title.txt"
export namespace SystemPrompt {
- export function provider(providerID: string, modelID: string) {
- if (providerID === "anthropic") return [PROMPT_ANTHROPIC_SPOOF.trim(), PROMPT_ANTHROPIC]
- if (modelID.includes("gpt-")) return [PROMPT_BEAST]
+ export function provider(modelID: string) {
+ if (modelID.includes("gpt-") || modelID.includes("o1") || modelID.includes("o3")) return [PROMPT_BEAST]
+ if (modelID.includes("gemini-")) return [PROMPT_GEMINI]
return [PROMPT_ANTHROPIC]
}
diff --git a/packages/opencode/src/snapshot/index.ts b/packages/opencode/src/snapshot/index.ts
index 608eb89c7a..b23de6e079 100644
--- a/packages/opencode/src/snapshot/index.ts
+++ b/packages/opencode/src/snapshot/index.ts
@@ -9,10 +9,8 @@ export namespace Snapshot {
const log = Log.create({ service: "snapshot" })
export async function create(sessionID: string) {
- return
log.info("creating snapshot")
const app = App.info()
- const git = gitdir(sessionID)
// not a git repo, check if too big to snapshot
if (!app.git) {
@@ -21,9 +19,10 @@ export namespace Snapshot {
limit: 1000,
})
log.info("found files", { count: files.length })
- if (files.length > 1000) return
+ if (files.length >= 1000) return
}
+ const git = gitdir(sessionID)
if (await fs.mkdir(git, { recursive: true })) {
await $`git init`
.env({
@@ -40,22 +39,27 @@ export namespace Snapshot {
log.info("added files")
const result =
- await $`git --git-dir ${git} commit --allow-empty -m "snapshot" --author="opencode "`
+ await $`git --git-dir ${git} commit -m "snapshot" --no-gpg-sign --author="opencode "`
.quiet()
.cwd(app.path.cwd)
.nothrow()
- log.info("commit")
const match = result.stdout.toString().match(/\[.+ ([a-f0-9]+)\]/)
if (!match) return
return match![1]
}
- export async function restore(sessionID: string, commit: string) {
- log.info("restore", { commit })
+ export async function restore(sessionID: string, snapshot: string) {
+ log.info("restore", { commit: snapshot })
const app = App.info()
const git = gitdir(sessionID)
- await $`git --git-dir=${git} checkout ${commit} --force`.quiet().cwd(app.path.root)
+ await $`git --git-dir=${git} checkout ${snapshot} --force`.quiet().cwd(app.path.root)
+ }
+
+ export async function diff(sessionID: string, commit: string) {
+ const git = gitdir(sessionID)
+ const result = await $`git --git-dir=${git} diff -R ${commit}`.quiet().cwd(App.info().path.root)
+ return result.stdout.toString("utf8")
}
function gitdir(sessionID: string) {
diff --git a/packages/opencode/src/storage/storage.ts b/packages/opencode/src/storage/storage.ts
index 001eee0a17..97efcef7c7 100644
--- a/packages/opencode/src/storage/storage.ts
+++ b/packages/opencode/src/storage/storage.ts
@@ -5,6 +5,7 @@ import path from "path"
import z from "zod"
import fs from "fs/promises"
import { MessageV2 } from "../session/message-v2"
+import { Identifier } from "../id/id"
export namespace Storage {
const log = Log.create({ service: "storage" })
@@ -28,13 +29,49 @@ export namespace Storage {
log.info("migrating to v2 message", { file })
try {
const result = MessageV2.fromV1(content)
- await Bun.write(file, JSON.stringify(result, null, 2))
+ await Bun.write(
+ file,
+ JSON.stringify(
+ {
+ ...result.info,
+ parts: result.parts,
+ },
+ null,
+ 2,
+ ),
+ )
} catch (e) {
await fs.rename(file, file.replace("storage", "broken"))
}
}
} catch {}
},
+ async (dir: string) => {
+ const files = new Bun.Glob("session/message/*/*.json").scanSync({
+ cwd: dir,
+ absolute: true,
+ })
+ for (const file of files) {
+ try {
+ const { parts, ...info } = await Bun.file(file).json()
+ if (!parts) continue
+ for (const part of parts) {
+ const id = Identifier.ascending("part")
+ await Bun.write(
+ [dir, "session", "part", info.sessionID, info.id, id + ".json"].join("/"),
+ JSON.stringify({
+ ...part,
+ id,
+ sessionID: info.sessionID,
+ messageID: info.id,
+ ...(part.type === "tool" ? { callID: part.id } : {}),
+ }),
+ )
+ }
+ await Bun.write(file, JSON.stringify(info, null, 2))
+ } catch (e) {}
+ }
+ },
]
const state = App.state("storage", async () => {
@@ -84,18 +121,19 @@ export namespace Storage {
}
const glob = new Bun.Glob("**/*")
- export async function* list(prefix: string) {
+ export async function list(prefix: string) {
const dir = await state().then((x) => x.dir)
try {
- for await (const item of glob.scan({
- cwd: path.join(dir, prefix),
- onlyFiles: true,
- })) {
- const result = path.join(prefix, item.slice(0, -5))
- yield result
- }
+ const result = await Array.fromAsync(
+ glob.scan({
+ cwd: path.join(dir, prefix),
+ onlyFiles: true,
+ }),
+ ).then((items) => items.map((item) => path.join(prefix, item.slice(0, -5))))
+ result.sort()
+ return result
} catch {
- return
+ return []
}
}
}
diff --git a/packages/opencode/src/tool/edit.ts b/packages/opencode/src/tool/edit.ts
index 7e8d733da1..4b9f355ec4 100644
--- a/packages/opencode/src/tool/edit.ts
+++ b/packages/opencode/src/tool/edit.ts
@@ -20,8 +20,8 @@ export const EditTool = Tool.define({
parameters: z.object({
filePath: z.string().describe("The absolute path to the file to modify"),
oldString: z.string().describe("The text to replace"),
- newString: z.string().describe("The text to replace it with (must be different from old_string)"),
- replaceAll: z.boolean().optional().describe("Replace all occurrences of old_string (default false)"),
+ newString: z.string().describe("The text to replace it with (must be different from oldString)"),
+ replaceAll: z.boolean().optional().describe("Replace all occurrences of oldString (default false)"),
}),
async execute(params, ctx) {
if (!params.filePath) {
@@ -86,7 +86,10 @@ export const EditTool = Tool.define({
output += `\nThis file has errors, please fix\n\n${issues.map(LSP.Diagnostic.pretty).join("\n")}\n\n`
continue
}
- output += `\n\n${file}\n${issues.map(LSP.Diagnostic.pretty).join("\n")}\n\n`
+ output += `\n\n${file}\n${issues
+ .filter((item) => item.severity === 1)
+ .map(LSP.Diagnostic.pretty)
+ .join("\n")}\n\n`
}
return {
diff --git a/packages/opencode/src/tool/edit.txt b/packages/opencode/src/tool/edit.txt
index fff2eca643..8bf8844d31 100644
--- a/packages/opencode/src/tool/edit.txt
+++ b/packages/opencode/src/tool/edit.txt
@@ -2,8 +2,8 @@ Performs exact string replacements in files.
Usage:
- You must use your `Read` tool at least once in the conversation before editing. This tool will error if you attempt an edit without reading the file.
-- When editing text from Read tool output, ensure you preserve the exact indentation (tabs/spaces) as it appears AFTER the line number prefix. The line number prefix format is: spaces + line number + tab. Everything after that tab is the actual file content to match. Never include any part of the line number prefix in the old_string or new_string.
+- When editing text from Read tool output, ensure you preserve the exact indentation (tabs/spaces) as it appears AFTER the line number prefix. The line number prefix format is: spaces + line number + tab. Everything after that tab is the actual file content to match. Never include any part of the line number prefix in the oldString or newString.
- ALWAYS prefer editing existing files in the codebase. NEVER write new files unless explicitly required.
- Only use emojis if the user explicitly requests it. Avoid adding emojis to files unless asked.
-- The edit will FAIL if `old_string` is not unique in the file. Either provide a larger string with more surrounding context to make it unique or use `replace_all` to change every instance of `old_string`.
-- Use `replace_all` for replacing and renaming strings across the file. This parameter is useful if you want to rename a variable for instance.
+- The edit will FAIL if `oldString` is not unique in the file. Either provide a larger string with more surrounding context to make it unique or use `replaceAll` to change every instance of `oldString`.
+- Use `replaceAll` for replacing and renaming strings across the file. This parameter is useful if you want to rename a variable for instance.
diff --git a/packages/opencode/src/tool/grep.ts b/packages/opencode/src/tool/grep.ts
index cd28fb482b..898e3e7368 100644
--- a/packages/opencode/src/tool/grep.ts
+++ b/packages/opencode/src/tool/grep.ts
@@ -55,12 +55,11 @@ export const GrepTool = Tool.define({
for (const line of lines) {
if (!line) continue
- const parts = line.split(":", 3)
- if (parts.length < 3) continue
+ const [filePath, lineNumStr, ...lineTextParts] = line.split(":")
+ if (!filePath || !lineNumStr || lineTextParts.length === 0) continue
- const filePath = parts[0]
- const lineNum = parseInt(parts[1], 10)
- const lineText = parts[2]
+ const lineNum = parseInt(lineNumStr, 10)
+ const lineText = lineTextParts.join(":")
const file = Bun.file(filePath)
const stats = await file.stat().catch(() => null)
diff --git a/packages/opencode/src/tool/ls.ts b/packages/opencode/src/tool/ls.ts
index a2c585a032..d96e27e959 100644
--- a/packages/opencode/src/tool/ls.ts
+++ b/packages/opencode/src/tool/ls.ts
@@ -18,6 +18,17 @@ export const IGNORE_PATTERNS = [
".vscode/",
".zig-cache/",
"zig-out",
+ ".coverage",
+ "coverage/",
+ "vendor/",
+ "tmp/",
+ "temp/",
+ ".cache/",
+ "cache/",
+ "logs/",
+ ".venv/",
+ "venv/",
+ "env/",
]
const LIMIT = 100
diff --git a/packages/opencode/src/tool/multiedit.txt b/packages/opencode/src/tool/multiedit.txt
index 1b32bbd9c2..bb4815124d 100644
--- a/packages/opencode/src/tool/multiedit.txt
+++ b/packages/opencode/src/tool/multiedit.txt
@@ -8,9 +8,9 @@ Before using this tool:
To make multiple file edits, provide the following:
1. file_path: The absolute path to the file to modify (must be absolute, not relative)
2. edits: An array of edit operations to perform, where each edit contains:
- - old_string: The text to replace (must match the file contents exactly, including all whitespace and indentation)
- - new_string: The edited text to replace the old_string
- - replace_all: Replace all occurrences of old_string. This parameter is optional and defaults to false.
+ - oldString: The text to replace (must match the file contents exactly, including all whitespace and indentation)
+ - newString: The edited text to replace the oldString
+ - replaceAll: Replace all occurrences of oldString. This parameter is optional and defaults to false.
IMPORTANT:
- All edits are applied in sequence, in the order they are provided
@@ -24,8 +24,8 @@ CRITICAL REQUIREMENTS:
3. Plan your edits carefully to avoid conflicts between sequential operations
WARNING:
-- The tool will fail if edits.old_string doesn't match the file contents exactly (including whitespace)
-- The tool will fail if edits.old_string and edits.new_string are the same
+- The tool will fail if edits.oldString doesn't match the file contents exactly (including whitespace)
+- The tool will fail if edits.oldString and edits.newString are the same
- Since edits are applied in sequence, ensure that earlier edits don't affect the text that later edits are trying to find
When making edits:
@@ -33,9 +33,9 @@ When making edits:
- Do not leave the code in a broken state
- Always use absolute file paths (starting with /)
- Only use emojis if the user explicitly requests it. Avoid adding emojis to files unless asked.
-- Use replace_all for replacing and renaming strings across the file. This parameter is useful if you want to rename a variable for instance.
+- Use replaceAll for replacing and renaming strings across the file. This parameter is useful if you want to rename a variable for instance.
If you want to create a new file, use:
- A new file path, including dir name if needed
-- First edit: empty old_string and the new file's contents as new_string
+- First edit: empty oldString and the new file's contents as newString
- Subsequent edits: normal edit operations on the created content
diff --git a/packages/opencode/src/tool/read.ts b/packages/opencode/src/tool/read.ts
index ccc60e7bc0..81414186df 100644
--- a/packages/opencode/src/tool/read.ts
+++ b/packages/opencode/src/tool/read.ts
@@ -7,7 +7,6 @@ import { FileTime } from "../file/time"
import DESCRIPTION from "./read.txt"
import { App } from "../app/app"
-const MAX_READ_SIZE = 250 * 1024
const DEFAULT_READ_LIMIT = 2000
const MAX_LINE_LENGTH = 2000
@@ -45,10 +44,7 @@ export const ReadTool = Tool.define({
throw new Error(`File not found: ${filePath}`)
}
- const stats = await file.stat()
- if (stats.size > MAX_READ_SIZE)
- throw new Error(`File is too large (${stats.size} bytes). Maximum size is ${MAX_READ_SIZE} bytes`)
const limit = params.limit ?? DEFAULT_READ_LIMIT
const offset = params.offset || 0
const isImage = isImageFile(filePath)
diff --git a/packages/opencode/src/tool/task.ts b/packages/opencode/src/tool/task.ts
index 757398337d..c26ca7e542 100644
--- a/packages/opencode/src/tool/task.ts
+++ b/packages/opencode/src/tool/task.ts
@@ -4,6 +4,7 @@ import { z } from "zod"
import { Session } from "../session"
import { Bus } from "../bus"
import { MessageV2 } from "../session/message-v2"
+import { Identifier } from "../id/id"
export const TaskTool = Tool.define({
id: "task",
@@ -14,24 +15,20 @@ export const TaskTool = Tool.define({
}),
async execute(params, ctx) {
const session = await Session.create(ctx.sessionID)
- const msg = (await Session.getMessage(ctx.sessionID, ctx.messageID)) as MessageV2.Assistant
+ const msg = await Session.getMessage(ctx.sessionID, ctx.messageID)
+ if (msg.role !== "assistant") throw new Error("Not an assistant message")
- function summary(input: MessageV2.Info) {
- const result = []
- for (const part of input.parts) {
- if (part.type === "tool" && part.state.status === "completed") {
- result.push(part)
- }
- }
- return result
- }
-
- const unsub = Bus.subscribe(MessageV2.Event.Updated, async (evt) => {
- if (evt.properties.info.sessionID !== session.id) return
+ const messageID = Identifier.ascending("message")
+ const parts: Record = {}
+ const unsub = Bus.subscribe(MessageV2.Event.PartUpdated, async (evt) => {
+ if (evt.properties.part.sessionID !== session.id) return
+ if (evt.properties.part.messageID === messageID) return
+ if (evt.properties.part.type !== "tool") return
+ parts[evt.properties.part.id] = evt.properties.part
ctx.metadata({
title: params.description,
metadata: {
- summary: summary(evt.properties.info),
+ summary: Object.values(parts).sort((a, b) => a.id?.localeCompare(b.id)),
},
})
})
@@ -40,11 +37,13 @@ export const TaskTool = Tool.define({
Session.abort(session.id)
})
const result = await Session.chat({
+ messageID,
sessionID: session.id,
modelID: msg.modelID,
providerID: msg.providerID,
parts: [
{
+ id: Identifier.ascending("part"),
type: "text",
text: params.prompt,
},
@@ -54,7 +53,7 @@ export const TaskTool = Tool.define({
return {
title: params.description,
metadata: {
- summary: summary(result),
+ summary: result.parts.filter((x) => x.type === "tool"),
},
output: result.parts.findLast((x) => x.type === "text")!.text,
}
diff --git a/packages/opencode/src/trace/index.ts b/packages/opencode/src/trace/index.ts
new file mode 100644
index 0000000000..8dba93d50f
--- /dev/null
+++ b/packages/opencode/src/trace/index.ts
@@ -0,0 +1,53 @@
+import { Global } from "../global"
+import { Installation } from "../installation"
+import path from "path"
+
+export namespace Trace {
+ export function init() {
+ if (!Installation.isDev()) return
+ const writer = Bun.file(path.join(Global.Path.data, "log", "fetch.log")).writer()
+
+ const originalFetch = globalThis.fetch
+ // @ts-expect-error
+ globalThis.fetch = async (input: RequestInfo | URL, init?: RequestInit) => {
+ const url = typeof input === "string" ? input : input instanceof URL ? input.toString() : input.url
+ const method = init?.method || "GET"
+
+ const urlObj = new URL(url)
+
+ writer.write(`\n${method} ${urlObj.pathname}${urlObj.search} HTTP/1.1\n`)
+ writer.write(`Host: ${urlObj.host}\n`)
+
+ if (init?.headers) {
+ if (init.headers instanceof Headers) {
+ init.headers.forEach((value, key) => {
+ writer.write(`${key}: ${value}\n`)
+ })
+ } else {
+ for (const [key, value] of Object.entries(init.headers)) {
+ writer.write(`${key}: ${value}\n`)
+ }
+ }
+ }
+
+ if (init?.body) {
+ writer.write(`\n${init.body}`)
+ }
+ writer.flush()
+ const response = await originalFetch(input, init)
+ const clonedResponse = response.clone()
+ writer.write(`\nHTTP/1.1 ${response.status} ${response.statusText}\n`)
+ response.headers.forEach((value, key) => {
+ writer.write(`${key}: ${value}\n`)
+ })
+ if (clonedResponse.body) {
+ clonedResponse.text().then(async (x) => {
+ writer.write(`\n${x}\n`)
+ })
+ }
+ writer.flush()
+
+ return response
+ }
+ }
+}
diff --git a/packages/opencode/src/util/log.ts b/packages/opencode/src/util/log.ts
index 50749dae99..c3cb04d29c 100644
--- a/packages/opencode/src/util/log.ts
+++ b/packages/opencode/src/util/log.ts
@@ -50,6 +50,7 @@ export namespace Log {
export interface Options {
print: boolean
+ dev?: boolean
level?: Level
}
@@ -63,7 +64,10 @@ export namespace Log {
await fs.mkdir(dir, { recursive: true })
cleanup(dir)
if (options.print) return
- logpath = path.join(dir, new Date().toISOString().split(".")[0].replace(/:/g, "") + ".log")
+ logpath = path.join(
+ dir,
+ options.dev ? "dev.log" : new Date().toISOString().split(".")[0].replace(/:/g, "") + ".log",
+ )
const logfile = Bun.file(logpath)
await fs.truncate(logpath).catch(() => {})
const writer = logfile.writer()
@@ -75,15 +79,16 @@ export namespace Log {
}
async function cleanup(dir: string) {
- const entries = await fs.readdir(dir, { withFileTypes: true })
- const files = entries
- .filter((entry) => entry.isFile() && entry.name.endsWith(".log"))
- .map((entry) => path.join(dir, entry.name))
-
+ const glob = new Bun.Glob("????-??-??T??????.log")
+ const files = await Array.fromAsync(
+ glob.scan({
+ cwd: dir,
+ absolute: true,
+ }),
+ )
if (files.length <= 5) return
const filesToDelete = files.slice(0, -10)
-
await Promise.all(filesToDelete.map((file) => fs.unlink(file).catch(() => {})))
}
@@ -105,7 +110,7 @@ export namespace Log {
...extra,
})
.filter(([_, value]) => value !== undefined && value !== null)
- .map(([key, value]) => `${key}=${value}`)
+ .map(([key, value]) => `${key}=${typeof value === "object" ? JSON.stringify(value) : value}`)
.join(" ")
const next = new Date()
const diff = next.getTime() - last
diff --git a/packages/opencode/test/bun.test.ts b/packages/opencode/test/bun.test.ts
new file mode 100644
index 0000000000..18f0db6bfa
--- /dev/null
+++ b/packages/opencode/test/bun.test.ts
@@ -0,0 +1,53 @@
+import { describe, expect, test } from "bun:test"
+import fs from "fs/promises"
+import path from "path"
+
+describe("BunProc registry configuration", () => {
+ test("should not contain hardcoded registry parameters", async () => {
+ // Read the bun/index.ts file
+ const bunIndexPath = path.join(__dirname, "../src/bun/index.ts")
+ const content = await fs.readFile(bunIndexPath, "utf-8")
+
+ // Verify that no hardcoded registry is present
+ expect(content).not.toContain("--registry=")
+ expect(content).not.toContain("hasNpmRcConfig")
+ expect(content).not.toContain("NpmRc")
+ })
+
+ test("should use Bun's default registry resolution", async () => {
+ // Read the bun/index.ts file
+ const bunIndexPath = path.join(__dirname, "../src/bun/index.ts")
+ const content = await fs.readFile(bunIndexPath, "utf-8")
+
+ // Verify that it uses Bun's default resolution
+ expect(content).toContain("Bun's default registry resolution")
+ expect(content).toContain("Bun will use them automatically")
+ expect(content).toContain("No need to pass --registry flag")
+ })
+
+ test("should have correct command structure without registry", async () => {
+ // Read the bun/index.ts file
+ const bunIndexPath = path.join(__dirname, "../src/bun/index.ts")
+ const content = await fs.readFile(bunIndexPath, "utf-8")
+
+ // Extract the install function
+ const installFunctionMatch = content.match(/export async function install[\s\S]*?^ }/m)
+ expect(installFunctionMatch).toBeTruthy()
+
+ if (installFunctionMatch) {
+ const installFunction = installFunctionMatch[0]
+
+ // Verify expected arguments are present
+ expect(installFunction).toContain('"add"')
+ expect(installFunction).toContain('"--force"')
+ expect(installFunction).toContain('"--exact"')
+ expect(installFunction).toContain('"--cwd"')
+ expect(installFunction).toContain('Global.Path.cache')
+ expect(installFunction).toContain('pkg + "@" + version')
+
+ // Verify no registry argument is added
+ expect(installFunction).not.toContain('"--registry"')
+ expect(installFunction).not.toContain('args.push("--registry')
+ }
+ })
+})
diff --git a/packages/tui/.gitignore b/packages/tui/.gitignore
index aac2e0bdc9..4685365f7f 100644
--- a/packages/tui/.gitignore
+++ b/packages/tui/.gitignore
@@ -1 +1,2 @@
opencode-test
+cmd/opencode/opencode
diff --git a/packages/tui/AGENTS.md b/packages/tui/AGENTS.md
deleted file mode 100644
index 753374f921..0000000000
--- a/packages/tui/AGENTS.md
+++ /dev/null
@@ -1,25 +0,0 @@
-# TUI Agent Guidelines
-
-## Build/Test Commands
-
-- **Build**: `go build ./cmd/opencode` (builds main binary)
-- **Test**: `go test ./...` (runs all tests)
-- **Single test**: `go test ./internal/theme -run TestLoadThemesFromJSON` (specific test)
-- **Release build**: Uses `.goreleaser.yml` configuration
-
-## Code Style
-
-- **Language**: Go 1.24+ with standard formatting (`gofmt`)
-- **Imports**: Group standard, third-party, local packages with blank lines
-- **Naming**: Go conventions - PascalCase exports, camelCase private, ALL_CAPS constants
-- **Error handling**: Return errors explicitly, use `fmt.Errorf` for wrapping
-- **Structs**: Define clear interfaces, embed when appropriate
-- **Testing**: Use table-driven tests, `t.TempDir()` for file operations
-
-## Architecture
-
-- **TUI Framework**: Bubble Tea v2 with Lipgloss v2 for styling
-- **Client**: Generated OpenAPI client communicates with TypeScript server
-- **Components**: Reusable UI components in `internal/components/`
-- **Themes**: JSON-based theming system with override hierarchy
-- **State**: Centralized app state with message passing
diff --git a/packages/tui/input/driver.go b/packages/tui/input/driver.go
index 710d99da1c..1e34677aba 100644
--- a/packages/tui/input/driver.go
+++ b/packages/tui/input/driver.go
@@ -31,42 +31,20 @@ type win32InputState struct {
// Reader represents an input event reader. It reads input events and parses
// escape sequences from the terminal input buffer and translates them into
-// human-readable events.
+// human‑readable events.
type Reader struct {
- rd cancelreader.CancelReader
- table map[string]Key // table is a lookup table for key sequences.
-
- term string // term is the terminal name $TERM.
-
- // paste is the bracketed paste mode buffer.
- // When nil, bracketed paste mode is disabled.
- paste []byte
-
- buf [256]byte // do we need a larger buffer?
-
- // partialSeq holds incomplete escape sequences that need more data
- partialSeq []byte
-
- // keyState keeps track of the current Windows Console API key events state.
- // It is used to decode ANSI escape sequences and utf16 sequences.
- keyState win32InputState
-
- parser Parser
- logger Logger
+ rd cancelreader.CancelReader
+ table map[string]Key // table is a lookup table for key sequences.
+ term string // $TERM
+ paste []byte // bracketed paste buffer; nil when disabled
+ buf [256]byte // read buffer
+ partialSeq []byte // holds incomplete escape sequences
+ keyState win32InputState
+ parser Parser
+ logger Logger
}
-// NewReader returns a new input event reader. The reader reads input events
-// from the terminal and parses escape sequences into human-readable events. It
-// supports reading Terminfo databases. See [Parser] for more information.
-//
-// Example:
-//
-// r, _ := input.NewReader(os.Stdin, os.Getenv("TERM"), 0)
-// defer r.Close()
-// events, _ := r.ReadEvents()
-// for _, ev := range events {
-// log.Printf("%v", ev)
-// }
+// NewReader returns a new input event reader.
func NewReader(r io.Reader, termType string, flags int) (*Reader, error) {
d := new(Reader)
cr, err := newCancelreader(r, flags)
@@ -82,46 +60,38 @@ func NewReader(r io.Reader, termType string, flags int) (*Reader, error) {
}
// SetLogger sets a logger for the reader.
-func (d *Reader) SetLogger(l Logger) {
- d.logger = l
-}
+func (d *Reader) SetLogger(l Logger) { d.logger = l }
-// Read implements [io.Reader].
-func (d *Reader) Read(p []byte) (int, error) {
- return d.rd.Read(p) //nolint:wrapcheck
-}
+// Read implements io.Reader.
+func (d *Reader) Read(p []byte) (int, error) { return d.rd.Read(p) }
// Cancel cancels the underlying reader.
-func (d *Reader) Cancel() bool {
- return d.rd.Cancel()
-}
+func (d *Reader) Cancel() bool { return d.rd.Cancel() }
// Close closes the underlying reader.
-func (d *Reader) Close() error {
- return d.rd.Close() //nolint:wrapcheck
-}
+func (d *Reader) Close() error { return d.rd.Close() }
func (d *Reader) readEvents() ([]Event, error) {
nb, err := d.rd.Read(d.buf[:])
if err != nil {
- return nil, err //nolint:wrapcheck
+ return nil, err
}
var events []Event
- // Combine any partial sequence from previous read with new data
+ // Combine any partial sequence from previous read with new data.
var buf []byte
if len(d.partialSeq) > 0 {
buf = make([]byte, len(d.partialSeq)+nb)
copy(buf, d.partialSeq)
copy(buf[len(d.partialSeq):], d.buf[:nb])
- d.partialSeq = nil // clear the partial sequence
+ d.partialSeq = nil
} else {
buf = d.buf[:nb]
}
- // Lookup table first
- if bytes.HasPrefix(buf, []byte{'\x1b'}) {
+ // Fast path: direct lookup for simple escape sequences.
+ if bytes.HasPrefix(buf, []byte{0x1b}) {
if k, ok := d.table[string(buf)]; ok {
if d.logger != nil {
d.logger.Printf("input: %q", buf)
@@ -133,24 +103,23 @@ func (d *Reader) readEvents() ([]Event, error) {
var i int
for i < len(buf) {
- nb, ev := d.parser.parseSequence(buf[i:])
- if d.logger != nil && nb > 0 {
- d.logger.Printf("input: %q", buf[i:i+nb])
+ consumed, ev := d.parser.parseSequence(buf[i:])
+ if d.logger != nil && consumed > 0 {
+ d.logger.Printf("input: %q", buf[i:i+consumed])
}
- // Handle incomplete sequences - when parseSequence returns (0, nil)
- // it means we need more data to complete the sequence
- if nb == 0 && ev == nil {
- // Store the remaining data for the next read
- remaining := len(buf) - i
- if remaining > 0 {
- d.partialSeq = make([]byte, remaining)
+ // Incomplete sequence – store remainder and exit.
+ if consumed == 0 && ev == nil {
+ rem := len(buf) - i
+ if rem > 0 {
+ d.partialSeq = make([]byte, rem)
copy(d.partialSeq, buf[i:])
}
break
}
- // Handle bracketed-paste
+ // Handle bracketed paste specially so we don’t emit a paste event for
+ // every byte.
if d.paste != nil {
if _, ok := ev.(PasteEndEvent); !ok {
d.paste = append(d.paste, buf[i])
@@ -160,15 +129,9 @@ func (d *Reader) readEvents() ([]Event, error) {
}
switch ev.(type) {
- // case UnknownEvent:
- // // If the sequence is not recognized by the parser, try looking it up.
- // if k, ok := d.table[string(buf[i:i+nb])]; ok {
- // ev = KeyPressEvent(k)
- // }
case PasteStartEvent:
d.paste = []byte{}
case PasteEndEvent:
- // Decode the captured data into runes.
var paste []rune
for len(d.paste) > 0 {
r, w := utf8.DecodeRune(d.paste)
@@ -177,7 +140,7 @@ func (d *Reader) readEvents() ([]Event, error) {
}
d.paste = d.paste[w:]
}
- d.paste = nil // reset the buffer
+ d.paste = nil
events = append(events, PasteEvent(paste))
case nil:
i++
@@ -189,8 +152,41 @@ func (d *Reader) readEvents() ([]Event, error) {
} else {
events = append(events, ev)
}
- i += nb
+ i += consumed
}
+ // Collapse bursts of wheel/motion events into a single event each.
+ events = coalesceMouseEvents(events)
return events, nil
}
+
+// coalesceMouseEvents reduces the volume of MouseWheelEvent and MouseMotionEvent
+// objects that arrive in rapid succession by keeping only the most recent
+// event in each contiguous run.
+func coalesceMouseEvents(in []Event) []Event {
+ if len(in) < 2 {
+ return in
+ }
+
+ out := make([]Event, 0, len(in))
+ for _, ev := range in {
+ switch ev.(type) {
+ case MouseWheelEvent:
+ if len(out) > 0 {
+ if _, ok := out[len(out)-1].(MouseWheelEvent); ok {
+ out[len(out)-1] = ev // replace previous wheel event
+ continue
+ }
+ }
+ case MouseMotionEvent:
+ if len(out) > 0 {
+ if _, ok := out[len(out)-1].(MouseMotionEvent); ok {
+ out[len(out)-1] = ev // replace previous motion event
+ continue
+ }
+ }
+ }
+ out = append(out, ev)
+ }
+ return out
+}
diff --git a/packages/tui/input/parse.go b/packages/tui/input/parse.go
index 13f564d678..ad8e21849c 100644
--- a/packages/tui/input/parse.go
+++ b/packages/tui/input/parse.go
@@ -303,7 +303,8 @@ func (p *Parser) parseCsi(b []byte) (int, Event) {
return i, CursorPositionEvent{Y: row - 1, X: col - 1}
case 'm' | '<'<= 3 {
+ pa = pa[:3]
return i, parseSGRMouseEvent(cmd, pa)
}
case 'm' | '>'<= len(a.Modes) {
- a.ModeIndex = 0
+func (a *App) cycleMode(forward bool) (*App, tea.Cmd) {
+ if forward {
+ a.ModeIndex++
+ if a.ModeIndex >= len(a.Modes) {
+ a.ModeIndex = 0
+ }
+ } else {
+ a.ModeIndex--
+ if a.ModeIndex < 0 {
+ a.ModeIndex = len(a.Modes) - 1
+ }
}
a.Mode = &a.Modes[a.ModeIndex]
@@ -235,8 +248,16 @@ func (a *App) SwitchMode() (*App, tea.Cmd) {
}
}
+func (a *App) SwitchMode() (*App, tea.Cmd) {
+ return a.cycleMode(true)
+}
+
+func (a *App) SwitchModeReverse() (*App, tea.Cmd) {
+ return a.cycleMode(false)
+}
+
func (a *App) InitializeProvider() tea.Cmd {
- providersResponse, err := a.Client.Config.Providers(context.Background())
+ providersResponse, err := a.Client.App.Providers(context.Background())
if err != nil {
slog.Error("Failed to list providers", "error", err)
// TODO: notify user
@@ -331,7 +352,7 @@ func (a *App) InitializeProvider() tea.Cmd {
}
func getDefaultModel(
- response *opencode.ConfigProvidersResponse,
+ response *opencode.AppProvidersResponse,
provider opencode.Provider,
) *opencode.Model {
if match, ok := response.Default[provider.ID]; ok {
@@ -351,7 +372,7 @@ func (a *App) IsBusy() bool {
}
lastMessage := a.Messages[len(a.Messages)-1]
- if casted, ok := lastMessage.(opencode.AssistantMessage); ok {
+ if casted, ok := lastMessage.Info.(opencode.AssistantMessage); ok {
return casted.Time.Completed == 0
}
return false
@@ -374,10 +395,11 @@ func (a *App) InitializeProject(ctx context.Context) tea.Cmd {
}
a.Session = session
- cmds = append(cmds, util.CmdHandler(SessionSelectedMsg(session)))
+ cmds = append(cmds, util.CmdHandler(SessionCreatedMsg{Session: session}))
go func() {
_, err := a.Client.Session.Init(ctx, a.Session.ID, opencode.SessionInitParams{
+ MessageID: opencode.F(id.Ascending(id.Message)),
ProviderID: opencode.F(a.Provider.ID),
ModelID: opencode.F(a.Model.ID),
})
@@ -440,7 +462,7 @@ func (a *App) CreateSession(ctx context.Context) (*opencode.Session, error) {
func (a *App) SendChatMessage(
ctx context.Context,
text string,
- attachments []opencode.FilePartParam,
+ attachments []opencode.FilePartInputParam,
) (*App, tea.Cmd) {
var cmds []tea.Cmd
if a.Session.ID == "" {
@@ -449,57 +471,65 @@ func (a *App) SendChatMessage(
return a, toast.NewErrorToast(err.Error())
}
a.Session = session
- cmds = append(cmds, util.CmdHandler(SessionSelectedMsg(session)))
+ cmds = append(cmds, util.CmdHandler(SessionCreatedMsg{Session: session}))
+ }
+
+ message := opencode.UserMessage{
+ ID: id.Ascending(id.Message),
+ SessionID: a.Session.ID,
+ Role: opencode.UserMessageRoleUser,
+ Time: opencode.UserMessageTime{
+ Created: float64(time.Now().UnixMilli()),
+ },
}
- optimisticParts := []opencode.UserMessagePart{{
- Type: opencode.UserMessagePartTypeText,
- Text: text,
+ parts := []opencode.PartUnion{opencode.TextPart{
+ ID: id.Ascending(id.Part),
+ MessageID: message.ID,
+ SessionID: a.Session.ID,
+ Type: opencode.TextPartTypeText,
+ Text: text,
}}
if len(attachments) > 0 {
for _, attachment := range attachments {
- optimisticParts = append(optimisticParts, opencode.UserMessagePart{
- Type: opencode.UserMessagePartTypeFile,
- Filename: attachment.Filename.Value,
- Mime: attachment.Mime.Value,
- URL: attachment.URL.Value,
+ parts = append(parts, opencode.FilePart{
+ ID: id.Ascending(id.Part),
+ MessageID: message.ID,
+ SessionID: a.Session.ID,
+ Type: opencode.FilePartTypeFile,
+ Filename: attachment.Filename.Value,
+ Mime: attachment.Mime.Value,
+ URL: attachment.URL.Value,
})
}
}
- optimisticMessage := opencode.UserMessage{
- ID: fmt.Sprintf("optimistic-%d", time.Now().UnixNano()),
- Role: opencode.UserMessageRoleUser,
- Parts: optimisticParts,
- SessionID: a.Session.ID,
- Time: opencode.UserMessageTime{
- Created: float64(time.Now().Unix()),
- },
- }
-
- a.Messages = append(a.Messages, optimisticMessage)
- cmds = append(cmds, util.CmdHandler(OptimisticMessageAddedMsg{Message: optimisticMessage}))
+ a.Messages = append(a.Messages, Message{Info: message, Parts: parts})
cmds = append(cmds, func() tea.Msg {
- parts := []opencode.UserMessagePartUnionParam{
- opencode.TextPartParam{
- Type: opencode.F(opencode.TextPartTypeText),
- Text: opencode.F(text),
- },
- }
- if len(attachments) > 0 {
- for _, attachment := range attachments {
- parts = append(parts, opencode.FilePartParam{
- Mime: attachment.Mime,
- Type: attachment.Type,
- URL: attachment.URL,
- Filename: attachment.Filename,
+ partsParam := []opencode.SessionChatParamsPartUnion{}
+ for _, part := range parts {
+ switch casted := part.(type) {
+ case opencode.TextPart:
+ partsParam = append(partsParam, opencode.TextPartInputParam{
+ ID: opencode.F(casted.ID),
+ Type: opencode.F(opencode.TextPartInputType(casted.Type)),
+ Text: opencode.F(casted.Text),
+ })
+ case opencode.FilePart:
+ partsParam = append(partsParam, opencode.FilePartInputParam{
+ ID: opencode.F(casted.ID),
+ Mime: opencode.F(casted.Mime),
+ Type: opencode.F(opencode.FilePartInputType(casted.Type)),
+ URL: opencode.F(casted.URL),
+ Filename: opencode.F(casted.Filename),
})
}
}
_, err := a.Client.Session.Chat(ctx, a.Session.ID, opencode.SessionChatParams{
- Parts: opencode.F(parts),
+ Parts: opencode.F(partsParam),
+ MessageID: opencode.F(message.ID),
ProviderID: opencode.F(a.Provider.ID),
ModelID: opencode.F(a.Model.ID),
Mode: opencode.F(a.Mode.Name),
@@ -557,20 +587,30 @@ func (a *App) DeleteSession(ctx context.Context, sessionID string) error {
return nil
}
-func (a *App) ListMessages(ctx context.Context, sessionId string) ([]opencode.Message, error) {
+func (a *App) ListMessages(ctx context.Context, sessionId string) ([]Message, error) {
response, err := a.Client.Session.Messages(ctx, sessionId)
if err != nil {
return nil, err
}
if response == nil {
- return []opencode.Message{}, nil
+ return []Message{}, nil
+ }
+ messages := []Message{}
+ for _, message := range *response {
+ msg := Message{
+ Info: message.Info.AsUnion(),
+ Parts: []opencode.PartUnion{},
+ }
+ for _, part := range message.Parts {
+ msg.Parts = append(msg.Parts, part.AsUnion())
+ }
+ messages = append(messages, msg)
}
- messages := *response
return messages, nil
}
func (a *App) ListProviders(ctx context.Context) ([]opencode.Provider, error) {
- response, err := a.Client.Config.Providers(ctx)
+ response, err := a.Client.App.Providers(ctx)
if err != nil {
return nil, err
}
diff --git a/packages/tui/internal/clipboard/clipboard_linux.go b/packages/tui/internal/clipboard/clipboard_linux.go
index 5fdc1e7ad5..101906395a 100644
--- a/packages/tui/internal/clipboard/clipboard_linux.go
+++ b/packages/tui/internal/clipboard/clipboard_linux.go
@@ -13,6 +13,7 @@ import (
"context"
"fmt"
"log/slog"
+ "os"
"os/exec"
"strings"
"sync"
@@ -44,7 +45,7 @@ var (
writeImg: []string{"xsel", "--clipboard", "--input"},
},
{
- name: "wl-clipboard",
+ name: "wl-copy",
readCmd: []string{"wl-paste", "-n"},
writeCmd: []string{"wl-copy"},
readImg: []string{"wl-paste", "-t", "image/png", "-n"},
@@ -66,14 +67,23 @@ func initialize() error {
return nil // Already initialized
}
- // Check which clipboard tool is available
- for i, tool := range clipboardTools {
- cmd := exec.Command("which", tool.name)
- if err := cmd.Run(); err == nil {
- clipboardTools[i].available = true
- if selectedTool < 0 {
- selectedTool = i
- slog.Debug("Clipboard tool found", "tool", tool.name)
+ order := []string{"xclip", "xsel", "wl-copy"}
+ if os.Getenv("WAYLAND_DISPLAY") != "" {
+ order = []string{"wl-copy", "xclip", "xsel"}
+ }
+
+ for _, name := range order {
+ for i, tool := range clipboardTools {
+ if tool.name == name {
+ cmd := exec.Command("which", tool.name)
+ if err := cmd.Run(); err == nil {
+ clipboardTools[i].available = true
+ if selectedTool < 0 {
+ selectedTool = i
+ slog.Debug("Clipboard tool found", "tool", tool.name)
+ }
+ }
+ break
}
}
}
diff --git a/packages/tui/internal/commands/command.go b/packages/tui/internal/commands/command.go
index dfa7abdd0d..5a981549ac 100644
--- a/packages/tui/internal/commands/command.go
+++ b/packages/tui/internal/commands/command.go
@@ -87,6 +87,7 @@ func (r CommandRegistry) Matches(msg tea.KeyPressMsg, leader bool) []Command {
const (
AppHelpCommand CommandName = "app_help"
SwitchModeCommand CommandName = "switch_mode"
+ SwitchModeReverseCommand CommandName = "switch_mode_reverse"
EditorOpenCommand CommandName = "editor_open"
SessionNewCommand CommandName = "session_new"
SessionListCommand CommandName = "session_list"
@@ -94,6 +95,7 @@ const (
SessionUnshareCommand CommandName = "session_unshare"
SessionInterruptCommand CommandName = "session_interrupt"
SessionCompactCommand CommandName = "session_compact"
+ SessionExportCommand CommandName = "session_export"
ToolDetailsCommand CommandName = "tool_details"
ModelListCommand CommandName = "model_list"
ThemeListCommand CommandName = "theme_list"
@@ -155,15 +157,26 @@ func LoadFromConfig(config *opencode.Config) CommandRegistry {
},
{
Name: SwitchModeCommand,
- Description: "switch mode",
+ Description: "next mode",
Keybindings: parseBindings("tab"),
},
+ {
+ Name: SwitchModeReverseCommand,
+ Description: "previous mode",
+ Keybindings: parseBindings("shift+tab"),
+ },
{
Name: EditorOpenCommand,
Description: "open editor",
Keybindings: parseBindings("e"),
Trigger: []string{"editor"},
},
+ {
+ Name: SessionExportCommand,
+ Description: "export conversation",
+ Keybindings: parseBindings("x"),
+ Trigger: []string{"export"},
+ },
{
Name: SessionNewCommand,
Description: "new session",
@@ -217,12 +230,12 @@ func LoadFromConfig(config *opencode.Config) CommandRegistry {
Keybindings: parseBindings("t"),
Trigger: []string{"themes"},
},
- {
- Name: FileListCommand,
- Description: "list files",
- Keybindings: parseBindings("f"),
- Trigger: []string{"files"},
- },
+ // {
+ // Name: FileListCommand,
+ // Description: "list files",
+ // Keybindings: parseBindings("f"),
+ // Trigger: []string{"files"},
+ // },
{
Name: FileCloseCommand,
Description: "close file",
@@ -323,7 +336,7 @@ func LoadFromConfig(config *opencode.Config) CommandRegistry {
Name: AppExitCommand,
Description: "exit the app",
Keybindings: parseBindings("ctrl+c", "q"),
- Trigger: []string{"exit", "quit"},
+ Trigger: []string{"exit", "quit", "q"},
},
}
registry := make(CommandRegistry)
@@ -331,6 +344,10 @@ func LoadFromConfig(config *opencode.Config) CommandRegistry {
marshalled, _ := json.Marshal(config.Keybinds)
json.Unmarshal(marshalled, &keybinds)
for _, command := range defaults {
+ // Remove share/unshare commands if sharing is disabled
+ if config.Share == opencode.ConfigShareDisabled && (command.Name == SessionShareCommand || command.Name == SessionUnshareCommand) {
+ continue
+ }
if keybind, ok := keybinds[string(command.Name)]; ok && keybind != "" {
command.Keybindings = parseBindings(keybind)
}
diff --git a/packages/tui/internal/completions/commands.go b/packages/tui/internal/completions/commands.go
index bb48d540ca..2ffe3ea94b 100644
--- a/packages/tui/internal/completions/commands.go
+++ b/packages/tui/internal/completions/commands.go
@@ -8,7 +8,6 @@ import (
"github.com/lithammer/fuzzysearch/fuzzy"
"github.com/sst/opencode/internal/app"
"github.com/sst/opencode/internal/commands"
- "github.com/sst/opencode/internal/components/dialog"
"github.com/sst/opencode/internal/styles"
"github.com/sst/opencode/internal/theme"
)
@@ -17,7 +16,7 @@ type CommandCompletionProvider struct {
app *app.App
}
-func NewCommandCompletionProvider(app *app.App) dialog.CompletionProvider {
+func NewCommandCompletionProvider(app *app.App) CompletionProvider {
return &CommandCompletionProvider{app: app}
}
@@ -32,24 +31,28 @@ func (c *CommandCompletionProvider) GetEmptyMessage() string {
func (c *CommandCompletionProvider) getCommandCompletionItem(
cmd commands.Command,
space int,
- t theme.Theme,
-) dialog.CompletionItemI {
- spacer := strings.Repeat(" ", space)
- title := " /" + cmd.PrimaryTrigger() + styles.NewStyle().
- Foreground(t.TextMuted()).
- Render(spacer+cmd.Description)
+) CompletionSuggestion {
+ displayFunc := func(s styles.Style) string {
+ t := theme.CurrentTheme()
+ spacer := strings.Repeat(" ", space)
+ display := " /" + cmd.PrimaryTrigger() + s.
+ Foreground(t.TextMuted()).
+ Render(spacer+cmd.Description)
+ return display
+ }
+
value := string(cmd.Name)
- return dialog.NewCompletionItem(dialog.CompletionItem{
- Title: title,
+ return CompletionSuggestion{
+ Display: displayFunc,
Value: value,
ProviderID: c.GetId(),
- })
+ RawData: cmd,
+ }
}
func (c *CommandCompletionProvider) GetChildEntries(
query string,
-) ([]dialog.CompletionItemI, error) {
- t := theme.CurrentTheme()
+) ([]CompletionSuggestion, error) {
commands := c.app.Commands
space := 1
@@ -63,44 +66,44 @@ func (c *CommandCompletionProvider) GetChildEntries(
sorted := commands.Sorted()
if query == "" {
// If no query, return all commands
- items := []dialog.CompletionItemI{}
+ items := []CompletionSuggestion{}
for _, cmd := range sorted {
if !cmd.HasTrigger() {
continue
}
space := space - lipgloss.Width(cmd.PrimaryTrigger())
- items = append(items, c.getCommandCompletionItem(cmd, space, t))
+ items = append(items, c.getCommandCompletionItem(cmd, space))
}
return items, nil
}
- // Use fuzzy matching for commands
var commandNames []string
- commandMap := make(map[string]dialog.CompletionItemI)
+ commandMap := make(map[string]CompletionSuggestion)
for _, cmd := range sorted {
if !cmd.HasTrigger() {
continue
}
space := space - lipgloss.Width(cmd.PrimaryTrigger())
- // Add all triggers as searchable options
for _, trigger := range cmd.Trigger {
commandNames = append(commandNames, trigger)
- commandMap[trigger] = c.getCommandCompletionItem(cmd, space, t)
+ commandMap[trigger] = c.getCommandCompletionItem(cmd, space)
}
}
- // Find fuzzy matches
- matches := fuzzy.RankFind(query, commandNames)
-
- // Sort by score (best matches first)
+ matches := fuzzy.RankFindFold(query, commandNames)
sort.Sort(matches)
- // Convert matches to completion items
- items := []dialog.CompletionItemI{}
+ // Convert matches to completion items, deduplicating by command name
+ items := []CompletionSuggestion{}
+ seen := make(map[string]bool)
for _, match := range matches {
if item, ok := commandMap[match.Target]; ok {
- items = append(items, item)
+ // Use the command's value (name) as the deduplication key
+ if !seen[item.Value] {
+ seen[item.Value] = true
+ items = append(items, item)
+ }
}
}
return items, nil
diff --git a/packages/tui/internal/completions/files.go b/packages/tui/internal/completions/files.go
index 861762db8d..bece89a896 100644
--- a/packages/tui/internal/completions/files.go
+++ b/packages/tui/internal/completions/files.go
@@ -9,14 +9,13 @@ import (
"github.com/sst/opencode-sdk-go"
"github.com/sst/opencode/internal/app"
- "github.com/sst/opencode/internal/components/dialog"
"github.com/sst/opencode/internal/styles"
"github.com/sst/opencode/internal/theme"
)
type filesContextGroup struct {
app *app.App
- gitFiles []dialog.CompletionItemI
+ gitFiles []CompletionSuggestion
}
func (cg *filesContextGroup) GetId() string {
@@ -27,12 +26,8 @@ func (cg *filesContextGroup) GetEmptyMessage() string {
return "no matching files"
}
-func (cg *filesContextGroup) getGitFiles() []dialog.CompletionItemI {
- t := theme.CurrentTheme()
- items := make([]dialog.CompletionItemI, 0)
- base := styles.NewStyle().Background(t.BackgroundElement())
- green := base.Foreground(t.Success()).Render
- red := base.Foreground(t.Error()).Render
+func (cg *filesContextGroup) getGitFiles() []CompletionSuggestion {
+ items := make([]CompletionSuggestion, 0)
status, _ := cg.app.Client.File.Status(context.Background())
if status != nil {
@@ -42,19 +37,25 @@ func (cg *filesContextGroup) getGitFiles() []dialog.CompletionItemI {
})
for _, file := range files {
- title := file.Path
- if file.Added > 0 {
- title += green(" +" + strconv.Itoa(int(file.Added)))
- }
- if file.Removed > 0 {
- title += red(" -" + strconv.Itoa(int(file.Removed)))
+ displayFunc := func(s styles.Style) string {
+ t := theme.CurrentTheme()
+ green := s.Foreground(t.Success()).Render
+ red := s.Foreground(t.Error()).Render
+ display := file.Path
+ if file.Added > 0 {
+ display += green(" +" + strconv.Itoa(int(file.Added)))
+ }
+ if file.Removed > 0 {
+ display += red(" -" + strconv.Itoa(int(file.Removed)))
+ }
+ return display
}
- item := dialog.NewCompletionItem(dialog.CompletionItem{
- Title: title,
+ item := CompletionSuggestion{
+ Display: displayFunc,
Value: file.Path,
ProviderID: cg.GetId(),
- Raw: file,
- })
+ RawData: file,
+ }
items = append(items, item)
}
}
@@ -64,8 +65,8 @@ func (cg *filesContextGroup) getGitFiles() []dialog.CompletionItemI {
func (cg *filesContextGroup) GetChildEntries(
query string,
-) ([]dialog.CompletionItemI, error) {
- items := make([]dialog.CompletionItemI, 0)
+) ([]CompletionSuggestion, error) {
+ items := make([]CompletionSuggestion, 0)
query = strings.TrimSpace(query)
if query == "" {
@@ -87,7 +88,7 @@ func (cg *filesContextGroup) GetChildEntries(
for _, file := range *files {
exists := false
for _, existing := range cg.gitFiles {
- if existing.GetValue() == file {
+ if existing.Value == file {
if query != "" {
items = append(items, existing)
}
@@ -95,12 +96,18 @@ func (cg *filesContextGroup) GetChildEntries(
}
}
if !exists {
- item := dialog.NewCompletionItem(dialog.CompletionItem{
- Title: file,
+ displayFunc := func(s styles.Style) string {
+ // t := theme.CurrentTheme()
+ // return s.Foreground(t.Text()).Render(file)
+ return s.Render(file)
+ }
+
+ item := CompletionSuggestion{
+ Display: displayFunc,
Value: file,
ProviderID: cg.GetId(),
- Raw: file,
- })
+ RawData: file,
+ }
items = append(items, item)
}
}
@@ -108,7 +115,7 @@ func (cg *filesContextGroup) GetChildEntries(
return items, nil
}
-func NewFileContextGroup(app *app.App) dialog.CompletionProvider {
+func NewFileContextGroup(app *app.App) CompletionProvider {
cg := &filesContextGroup{
app: app,
}
diff --git a/packages/tui/internal/completions/provider.go b/packages/tui/internal/completions/provider.go
new file mode 100644
index 0000000000..dc11522c32
--- /dev/null
+++ b/packages/tui/internal/completions/provider.go
@@ -0,0 +1,8 @@
+package completions
+
+// CompletionProvider defines the interface for completion data providers
+type CompletionProvider interface {
+ GetId() string
+ GetChildEntries(query string) ([]CompletionSuggestion, error)
+ GetEmptyMessage() string
+}
diff --git a/packages/tui/internal/completions/suggestion.go b/packages/tui/internal/completions/suggestion.go
new file mode 100644
index 0000000000..fac6b68135
--- /dev/null
+++ b/packages/tui/internal/completions/suggestion.go
@@ -0,0 +1,24 @@
+package completions
+
+import "github.com/sst/opencode/internal/styles"
+
+// CompletionSuggestion represents a data-only completion suggestion
+// with no styling or rendering logic
+type CompletionSuggestion struct {
+ // The text to be displayed in the list. May contain minimal inline
+ // ANSI styling if intrinsic to the data (e.g., git diff colors).
+ Display func(styles.Style) string
+
+ // The value to be used when the item is selected (e.g., inserted into the editor).
+ Value string
+
+ // An optional, longer description to be displayed.
+ Description string
+
+ // The ID of the provider that generated this suggestion.
+ ProviderID string
+
+ // The raw, underlying data object (e.g., opencode.Symbol, commands.Command).
+ // This allows the selection handler to perform rich actions.
+ RawData any
+}
diff --git a/packages/tui/internal/completions/symbols.go b/packages/tui/internal/completions/symbols.go
index fea1b7117d..725e2e69bd 100644
--- a/packages/tui/internal/completions/symbols.go
+++ b/packages/tui/internal/completions/symbols.go
@@ -8,7 +8,6 @@ import (
"github.com/sst/opencode-sdk-go"
"github.com/sst/opencode/internal/app"
- "github.com/sst/opencode/internal/components/dialog"
"github.com/sst/opencode/internal/styles"
"github.com/sst/opencode/internal/theme"
)
@@ -58,8 +57,8 @@ const (
func (cg *symbolsContextGroup) GetChildEntries(
query string,
-) ([]dialog.CompletionItemI, error) {
- items := make([]dialog.CompletionItemI, 0)
+) ([]CompletionSuggestion, error) {
+ items := make([]CompletionSuggestion, 0)
query = strings.TrimSpace(query)
if query == "" {
@@ -78,40 +77,42 @@ func (cg *symbolsContextGroup) GetChildEntries(
return items, nil
}
- t := theme.CurrentTheme()
- baseStyle := styles.NewStyle().Background(t.BackgroundElement())
- base := baseStyle.Render
- muted := baseStyle.Foreground(t.TextMuted()).Render
-
for _, sym := range *symbols {
parts := strings.Split(sym.Name, ".")
lastPart := parts[len(parts)-1]
- title := base(lastPart)
-
- uriParts := strings.Split(sym.Location.Uri, "/")
- lastTwoParts := uriParts[len(uriParts)-2:]
- joined := strings.Join(lastTwoParts, "/")
- title += muted(fmt.Sprintf(" %s", joined))
-
start := int(sym.Location.Range.Start.Line)
end := int(sym.Location.Range.End.Line)
- title += muted(fmt.Sprintf(":L%d-%d", start, end))
+
+ displayFunc := func(s styles.Style) string {
+ t := theme.CurrentTheme()
+ base := s.Foreground(t.Text()).Render
+ muted := s.Foreground(t.TextMuted()).Render
+ display := base(lastPart)
+
+ uriParts := strings.Split(sym.Location.Uri, "/")
+ lastTwoParts := uriParts[len(uriParts)-2:]
+ joined := strings.Join(lastTwoParts, "/")
+ display += muted(fmt.Sprintf(" %s", joined))
+
+ display += muted(fmt.Sprintf(":L%d-%d", start, end))
+ return display
+ }
value := fmt.Sprintf("%s?start=%d&end=%d", sym.Location.Uri, start, end)
- item := dialog.NewCompletionItem(dialog.CompletionItem{
- Title: title,
+ item := CompletionSuggestion{
+ Display: displayFunc,
Value: value,
ProviderID: cg.GetId(),
- Raw: sym,
- })
+ RawData: sym,
+ }
items = append(items, item)
}
return items, nil
}
-func NewSymbolsContextGroup(app *app.App) dialog.CompletionProvider {
+func NewSymbolsContextGroup(app *app.App) CompletionProvider {
return &symbolsContextGroup{
app: app,
}
diff --git a/packages/tui/internal/components/chat/cache.go b/packages/tui/internal/components/chat/cache.go
index 1586c2cc36..454f1a5a94 100644
--- a/packages/tui/internal/components/chat/cache.go
+++ b/packages/tui/internal/components/chat/cache.go
@@ -1,28 +1,28 @@
package chat
import (
- "crypto/sha256"
"encoding/hex"
"fmt"
+ "hash/fnv"
"sync"
)
-// MessageCache caches rendered messages to avoid re-rendering
-type MessageCache struct {
+// PartCache caches rendered messages to avoid re-rendering
+type PartCache struct {
mu sync.RWMutex
cache map[string]string
}
-// NewMessageCache creates a new message cache
-func NewMessageCache() *MessageCache {
- return &MessageCache{
+// NewPartCache creates a new message cache
+func NewPartCache() *PartCache {
+ return &PartCache{
cache: make(map[string]string),
}
}
// generateKey creates a unique key for a message based on its content and rendering parameters
-func (c *MessageCache) GenerateKey(params ...any) string {
- h := sha256.New()
+func (c *PartCache) GenerateKey(params ...any) string {
+ h := fnv.New64a()
for _, param := range params {
h.Write(fmt.Appendf(nil, ":%v", param))
}
@@ -30,7 +30,7 @@ func (c *MessageCache) GenerateKey(params ...any) string {
}
// Get retrieves a cached rendered message
-func (c *MessageCache) Get(key string) (string, bool) {
+func (c *PartCache) Get(key string) (string, bool) {
c.mu.RLock()
defer c.mu.RUnlock()
@@ -39,14 +39,14 @@ func (c *MessageCache) Get(key string) (string, bool) {
}
// Set stores a rendered message in the cache
-func (c *MessageCache) Set(key string, content string) {
+func (c *PartCache) Set(key string, content string) {
c.mu.Lock()
defer c.mu.Unlock()
c.cache[key] = content
}
// Clear removes all entries from the cache
-func (c *MessageCache) Clear() {
+func (c *PartCache) Clear() {
c.mu.Lock()
defer c.mu.Unlock()
@@ -54,7 +54,7 @@ func (c *MessageCache) Clear() {
}
// Size returns the number of cached entries
-func (c *MessageCache) Size() int {
+func (c *PartCache) Size() int {
c.mu.RLock()
defer c.mu.RUnlock()
diff --git a/packages/tui/internal/components/chat/editor.go b/packages/tui/internal/components/chat/editor.go
index d5f6facab2..ef129765fb 100644
--- a/packages/tui/internal/components/chat/editor.go
+++ b/packages/tui/internal/components/chat/editor.go
@@ -27,8 +27,8 @@ import (
type EditorComponent interface {
tea.Model
- View(width int) string
- Content(width int) string
+ tea.ViewModel
+ Content() string
Lines() int
Value() string
Length() int
@@ -40,12 +40,14 @@ type EditorComponent interface {
Paste() (tea.Model, tea.Cmd)
Newline() (tea.Model, tea.Cmd)
SetValue(value string)
+ SetValueWithAttachments(value string)
SetInterruptKeyInDebounce(inDebounce bool)
SetExitKeyInDebounce(inDebounce bool)
}
type editorComponent struct {
app *app.App
+ width int
textarea textarea.Model
spinner spinner.Model
interruptKeyInDebounce bool
@@ -61,6 +63,9 @@ func (m *editorComponent) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
var cmd tea.Cmd
switch msg := msg.(type) {
+ case tea.WindowSizeMsg:
+ m.width = msg.Width - 4
+ return m, nil
case spinner.TickMsg:
m.spinner, cmd = m.spinner.Update(msg)
return m, cmd
@@ -87,51 +92,13 @@ func (m *editorComponent) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
}
filePath := text
- ext := strings.ToLower(filepath.Ext(filePath))
-
- mediaType := ""
- switch ext {
- case ".jpg":
- mediaType = "image/jpeg"
- case ".png", ".jpeg", ".gif", ".webp":
- mediaType = "image/" + ext[1:]
- case ".pdf":
- mediaType = "application/pdf"
- default:
- attachment := &textarea.Attachment{
- ID: uuid.NewString(),
- Display: "@" + filePath,
- URL: fmt.Sprintf("file://./%s", filePath),
- Filename: filePath,
- MediaType: "text/plain",
- }
- m.textarea.InsertAttachment(attachment)
- m.textarea.InsertString(" ")
- return m, nil
- }
- fileBytes, err := os.ReadFile(filePath)
- if err != nil {
- slog.Error("Failed to read file", "error", err)
+ attachment := m.createAttachmentFromFile(filePath)
+ if attachment == nil {
m.textarea.InsertRunesFromUserInput([]rune(msg))
return m, nil
}
- base64EncodedFile := base64.StdEncoding.EncodeToString(fileBytes)
- url := fmt.Sprintf("data:%s;base64,%s", mediaType, base64EncodedFile)
- attachmentCount := len(m.textarea.GetAttachments())
- attachmentIndex := attachmentCount + 1
- label := "File"
- if strings.HasPrefix(mediaType, "image/") {
- label = "Image"
- }
- attachment := &textarea.Attachment{
- ID: uuid.NewString(),
- MediaType: mediaType,
- Display: fmt.Sprintf("[%s #%d]", label, attachmentIndex),
- URL: url,
- Filename: filePath,
- }
m.textarea.InsertAttachment(attachment)
m.textarea.InsertString(" ")
case tea.ClipboardMsg:
@@ -142,9 +109,9 @@ func (m *editorComponent) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
m.spinner = createSpinner()
return m, tea.Batch(m.spinner.Tick, m.textarea.Focus())
case dialog.CompletionSelectedMsg:
- switch msg.Item.GetProviderID() {
+ switch msg.Item.ProviderID {
case "commands":
- commandName := strings.TrimPrefix(msg.Item.GetValue(), "/")
+ commandName := strings.TrimPrefix(msg.Item.Value, "/")
updated, cmd := m.Clear()
m = updated.(*editorComponent)
cmds = append(cmds, cmd)
@@ -154,7 +121,7 @@ func (m *editorComponent) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
atIndex := m.textarea.LastRuneIndex('@')
if atIndex == -1 {
// Should not happen, but as a fallback, just insert.
- m.textarea.InsertString(msg.Item.GetValue() + " ")
+ m.textarea.InsertString(msg.Item.Value + " ")
return m, nil
}
@@ -165,26 +132,8 @@ func (m *editorComponent) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
// Now, insert the attachment at the position where the '@' was.
// The cursor is now at `atIndex` after the replacement.
- filePath := msg.Item.GetValue()
- extension := filepath.Ext(filePath)
- mediaType := ""
- switch extension {
- case ".jpg":
- mediaType = "image/jpeg"
- case ".png", ".jpeg", ".gif", ".webp":
- mediaType = "image/" + extension[1:]
- case ".pdf":
- mediaType = "application/pdf"
- default:
- mediaType = "text/plain"
- }
- attachment := &textarea.Attachment{
- ID: uuid.NewString(),
- Display: "@" + filePath,
- URL: fmt.Sprintf("file://./%s", url.PathEscape(filePath)),
- Filename: filePath,
- MediaType: mediaType,
- }
+ filePath := msg.Item.Value
+ attachment := m.createAttachmentFromPath(filePath)
m.textarea.InsertAttachment(attachment)
m.textarea.InsertString(" ")
return m, nil
@@ -192,20 +141,20 @@ func (m *editorComponent) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
atIndex := m.textarea.LastRuneIndex('@')
if atIndex == -1 {
// Should not happen, but as a fallback, just insert.
- m.textarea.InsertString(msg.Item.GetValue() + " ")
+ m.textarea.InsertString(msg.Item.Value + " ")
return m, nil
}
cursorCol := m.textarea.CursorColumn()
m.textarea.ReplaceRange(atIndex, cursorCol, "")
- symbol := msg.Item.GetRaw().(opencode.Symbol)
+ symbol := msg.Item.RawData.(opencode.Symbol)
parts := strings.Split(symbol.Name, ".")
lastPart := parts[len(parts)-1]
attachment := &textarea.Attachment{
ID: uuid.NewString(),
Display: "@" + lastPart,
- URL: msg.Item.GetValue(),
+ URL: msg.Item.Value,
Filename: lastPart,
MediaType: "text/plain",
}
@@ -213,7 +162,7 @@ func (m *editorComponent) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
m.textarea.InsertString(" ")
return m, nil
default:
- slog.Debug("Unknown provider", "provider", msg.Item.GetProviderID())
+ slog.Debug("Unknown provider", "provider", msg.Item.ProviderID)
return m, nil
}
}
@@ -227,7 +176,12 @@ func (m *editorComponent) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
return m, tea.Batch(cmds...)
}
-func (m *editorComponent) Content(width int) string {
+func (m *editorComponent) Content() string {
+ width := m.width
+ if m.app.Session.ID == "" {
+ width = min(width, 80)
+ }
+
t := theme.CurrentTheme()
base := styles.NewStyle().Foreground(t.Text()).Background(t.Background()).Render
muted := styles.NewStyle().Foreground(t.TextMuted()).Background(t.Background()).Render
@@ -294,7 +248,12 @@ func (m *editorComponent) Content(width int) string {
return content
}
-func (m *editorComponent) View(width int) string {
+func (m *editorComponent) View() string {
+ width := m.width
+ if m.app.Session.ID == "" {
+ width = min(width, 80)
+ }
+
if m.Lines() > 1 {
return lipgloss.Place(
width,
@@ -305,7 +264,7 @@ func (m *editorComponent) View(width int) string {
styles.WhitespaceStyle(theme.CurrentTheme().Background()),
)
}
- return m.Content(width)
+ return m.Content()
}
func (m *editorComponent) Focused() bool {
@@ -337,9 +296,16 @@ func (m *editorComponent) Submit() (tea.Model, tea.Cmd) {
if value == "" {
return m, nil
}
+
+ switch value {
+ case "exit", "quit", "q", ":q":
+ return m, tea.Quit
+ }
+
if len(value) > 0 && value[len(value)-1] == '\\' {
// If the last character is a backslash, remove it and add a newline
- m.textarea.ReplaceRange(len(value)-1, len(value), "")
+ backslashCol := m.textarea.CurrentRowLength() - 1
+ m.textarea.ReplaceRange(backslashCol, backslashCol+1, "")
m.textarea.InsertString("\n")
return m, nil
}
@@ -347,10 +313,10 @@ func (m *editorComponent) Submit() (tea.Model, tea.Cmd) {
var cmds []tea.Cmd
attachments := m.textarea.GetAttachments()
- fileParts := make([]opencode.FilePartParam, 0)
+ fileParts := make([]opencode.FilePartInputParam, 0)
for _, attachment := range attachments {
- fileParts = append(fileParts, opencode.FilePartParam{
- Type: opencode.F(opencode.FilePartTypeFile),
+ fileParts = append(fileParts, opencode.FilePartInputParam{
+ Type: opencode.F(opencode.FilePartInputTypeFile),
Mime: opencode.F(attachment.MediaType),
URL: opencode.F(attachment.URL),
Filename: opencode.F(attachment.Filename),
@@ -411,6 +377,38 @@ func (m *editorComponent) SetValue(value string) {
m.textarea.SetValue(value)
}
+func (m *editorComponent) SetValueWithAttachments(value string) {
+ m.textarea.Reset()
+
+ i := 0
+ for i < len(value) {
+ // Check if filepath and add attachment
+ if value[i] == '@' {
+ start := i + 1
+ end := start
+ for end < len(value) && value[end] != ' ' && value[end] != '\t' && value[end] != '\n' && value[end] != '\r' {
+ end++
+ }
+
+ if end > start {
+ filePath := value[start:end]
+ if _, err := os.Stat(filePath); err == nil {
+ attachment := m.createAttachmentFromFile(filePath)
+ if attachment != nil {
+ m.textarea.InsertAttachment(attachment)
+ i = end
+ continue
+ }
+ }
+ }
+ }
+
+ // Not a valid file path, insert the character normally
+ m.textarea.InsertRune(rune(value[i]))
+ i++
+ }
+}
+
func (m *editorComponent) SetExitKeyInDebounce(inDebounce bool) {
m.exitKeyInDebounce = inDebounce
}
@@ -491,3 +489,69 @@ func NewEditorComponent(app *app.App) EditorComponent {
return m
}
+
+func getMediaTypeFromExtension(ext string) string {
+ switch strings.ToLower(ext) {
+ case ".jpg":
+ return "image/jpeg"
+ case ".png", ".jpeg", ".gif", ".webp":
+ return "image/" + ext[1:]
+ case ".pdf":
+ return "application/pdf"
+ default:
+ return "text/plain"
+ }
+}
+
+func (m *editorComponent) createAttachmentFromFile(filePath string) *textarea.Attachment {
+ ext := strings.ToLower(filepath.Ext(filePath))
+ mediaType := getMediaTypeFromExtension(ext)
+
+ // For text files, create a simple file reference
+ if mediaType == "text/plain" {
+ return &textarea.Attachment{
+ ID: uuid.NewString(),
+ Display: "@" + filePath,
+ URL: fmt.Sprintf("file://./%s", filePath),
+ Filename: filePath,
+ MediaType: mediaType,
+ }
+ }
+
+ // For binary files (images, PDFs), read and encode
+ fileBytes, err := os.ReadFile(filePath)
+ if err != nil {
+ slog.Error("Failed to read file", "error", err)
+ return nil
+ }
+
+ base64EncodedFile := base64.StdEncoding.EncodeToString(fileBytes)
+ url := fmt.Sprintf("data:%s;base64,%s", mediaType, base64EncodedFile)
+ attachmentCount := len(m.textarea.GetAttachments())
+ attachmentIndex := attachmentCount + 1
+ label := "File"
+ if strings.HasPrefix(mediaType, "image/") {
+ label = "Image"
+ }
+
+ return &textarea.Attachment{
+ ID: uuid.NewString(),
+ MediaType: mediaType,
+ Display: fmt.Sprintf("[%s #%d]", label, attachmentIndex),
+ URL: url,
+ Filename: filePath,
+ }
+}
+
+func (m *editorComponent) createAttachmentFromPath(filePath string) *textarea.Attachment {
+ extension := filepath.Ext(filePath)
+ mediaType := getMediaTypeFromExtension(extension)
+
+ return &textarea.Attachment{
+ ID: uuid.NewString(),
+ Display: "@" + filePath,
+ URL: fmt.Sprintf("file://./%s", url.PathEscape(filePath)),
+ Filename: filePath,
+ MediaType: mediaType,
+ }
+}
diff --git a/packages/tui/internal/components/chat/message.go b/packages/tui/internal/components/chat/message.go
index b2a5d71663..d3263b053c 100644
--- a/packages/tui/internal/components/chat/message.go
+++ b/packages/tui/internal/components/chat/message.go
@@ -9,11 +9,11 @@ import (
"github.com/charmbracelet/lipgloss/v2"
"github.com/charmbracelet/lipgloss/v2/compat"
+ "github.com/charmbracelet/x/ansi"
+ "github.com/muesli/reflow/truncate"
"github.com/sst/opencode-sdk-go"
"github.com/sst/opencode/internal/app"
- "github.com/sst/opencode/internal/commands"
"github.com/sst/opencode/internal/components/diff"
- "github.com/sst/opencode/internal/layout"
"github.com/sst/opencode/internal/styles"
"github.com/sst/opencode/internal/theme"
"github.com/sst/opencode/internal/util"
@@ -109,7 +109,6 @@ func WithPaddingBottom(padding int) renderingOption {
func renderContentBlock(
app *app.App,
content string,
- highlight bool,
width int,
options ...renderingOption,
) string {
@@ -158,18 +157,6 @@ func renderContentBlock(
BorderRightBackground(t.Background())
}
- if highlight {
- style = style.
- BorderLeftForeground(borderColor).
- BorderRightForeground(borderColor)
- }
- }
-
- if highlight {
- style = style.
- Foreground(t.Text()).
- Background(t.BackgroundElement()).
- Bold(true)
}
content = style.Render(content)
@@ -184,32 +171,6 @@ func renderContentBlock(
}
}
- if highlight {
- copy := app.Key(commands.MessagesCopyCommand)
- // revert := app.Key(commands.MessagesRevertCommand)
-
- background := t.Background()
- header := layout.Render(
- layout.FlexOptions{
- Background: &background,
- Direction: layout.Row,
- Justify: layout.JustifyCenter,
- Align: layout.AlignStretch,
- Width: width - 2,
- Gap: 5,
- },
- layout.FlexItem{
- View: copy,
- },
- // layout.FlexItem{
- // View: revert,
- // },
- )
- header = styles.NewStyle().Background(t.Background()).Padding(0, 1).Render(header)
-
- content = "\n\n\n" + header + "\n\n" + content + "\n\n\n"
- }
-
return content
}
@@ -219,7 +180,6 @@ func renderText(
text string,
author string,
showToolDetails bool,
- highlight bool,
width int,
extra string,
toolCalls ...opencode.ToolPart,
@@ -228,9 +188,6 @@ func renderText(
var ts time.Time
backgroundColor := t.BackgroundPanel()
- if highlight {
- backgroundColor = t.BackgroundElement()
- }
var content string
switch casted := message.(type) {
case opencode.AssistantMessage:
@@ -238,8 +195,18 @@ func renderText(
content = util.ToMarkdown(text, width, backgroundColor)
case opencode.UserMessage:
ts = time.UnixMilli(int64(casted.Time.Created))
- messageStyle := styles.NewStyle().Background(backgroundColor).Width(width - 6)
- content = messageStyle.Render(text)
+ base := styles.NewStyle().Foreground(t.Text()).Background(backgroundColor)
+ words := strings.Fields(text)
+ for i, word := range words {
+ if strings.HasPrefix(word, "@") {
+ words[i] = base.Foreground(t.Secondary()).Render(word + " ")
+ } else {
+ words[i] = base.Render(word + " ")
+ }
+ }
+ text = strings.Join(words, "")
+ text = ansi.WordwrapWc(text, width-6, " -")
+ content = base.Width(width - 6).Render(text)
}
timestamp := ts.
@@ -277,7 +244,6 @@ func renderText(
return renderContentBlock(
app,
content,
- highlight,
width,
WithTextColor(t.Text()),
WithBorderColorRight(t.Secondary()),
@@ -286,7 +252,6 @@ func renderText(
return renderContentBlock(
app,
content,
- highlight,
width,
WithBorderColor(t.Accent()),
)
@@ -297,7 +262,6 @@ func renderText(
func renderToolDetails(
app *app.App,
toolCall opencode.ToolPart,
- highlight bool,
width int,
) string {
ignoredTools := []string{"todoread"}
@@ -305,11 +269,9 @@ func renderToolDetails(
return ""
}
- if toolCall.State.Status == opencode.ToolPartStateStatusPending ||
- toolCall.State.Status == opencode.ToolPartStateStatusRunning {
+ if toolCall.State.Status == opencode.ToolPartStateStatusPending {
title := renderToolTitle(toolCall, width)
- title = styles.NewStyle().Width(width - 6).Render(title)
- return renderContentBlock(app, title, highlight, width)
+ return renderContentBlock(app, title, width)
}
var result *string
@@ -334,16 +296,16 @@ func renderToolDetails(
t := theme.CurrentTheme()
backgroundColor := t.BackgroundPanel()
borderColor := t.BackgroundPanel()
- if highlight {
- backgroundColor = t.BackgroundElement()
- borderColor = t.BorderActive()
- }
+ defaultStyle := styles.NewStyle().Background(backgroundColor).Width(width - 6).Render
- if toolCall.State.Status == opencode.ToolPartStateStatusCompleted {
+ if toolCall.State.Metadata != nil {
metadata := toolCall.State.Metadata.(map[string]any)
switch toolCall.Tool {
case "read":
- preview := metadata["preview"]
+ var preview any
+ if metadata != nil {
+ preview = metadata["preview"]
+ }
if preview != nil && toolInputMap["filePath"] != nil {
filename := toolInputMap["filePath"].(string)
body = preview.(string)
@@ -351,26 +313,34 @@ func renderToolDetails(
}
case "edit":
if filename, ok := toolInputMap["filePath"].(string); ok {
- diffField := metadata["diff"]
+ var diffField any
+ if metadata != nil {
+ diffField = metadata["diff"]
+ }
if diffField != nil {
patch := diffField.(string)
var formattedDiff string
- formattedDiff, _ = diff.FormatUnifiedDiff(
- filename,
- patch,
- diff.WithWidth(width-2),
- )
+ if width < 120 {
+ formattedDiff, _ = diff.FormatUnifiedDiff(
+ filename,
+ patch,
+ diff.WithWidth(width-2),
+ )
+ } else {
+ formattedDiff, _ = diff.FormatDiff(
+ filename,
+ patch,
+ diff.WithWidth(width-2),
+ )
+ }
body = strings.TrimSpace(formattedDiff)
style := styles.NewStyle().
Background(backgroundColor).
Foreground(t.TextMuted()).
Padding(1, 2).
Width(width - 4)
- if highlight {
- style = style.Foreground(t.Text()).Bold(true)
- }
- if diagnostics := renderDiagnostics(metadata, filename); diagnostics != "" {
+ if diagnostics := renderDiagnostics(metadata, filename, backgroundColor, width-6); diagnostics != "" {
diagnostics = style.Render(diagnostics)
body += "\n" + diagnostics
}
@@ -381,7 +351,6 @@ func renderToolDetails(
content = renderContentBlock(
app,
content,
- highlight,
width,
WithPadding(0),
WithBorderColor(borderColor),
@@ -393,7 +362,7 @@ func renderToolDetails(
if filename, ok := toolInputMap["filePath"].(string); ok {
if content, ok := toolInputMap["content"].(string); ok {
body = util.RenderFile(filename, content, width)
- if diagnostics := renderDiagnostics(metadata, filename); diagnostics != "" {
+ if diagnostics := renderDiagnostics(metadata, filename, backgroundColor, width-4); diagnostics != "" {
body += "\n\n" + diagnostics
}
}
@@ -439,19 +408,17 @@ func renderToolDetails(
if summary != nil {
toolcalls := summary.([]any)
steps := []string{}
- for _, toolcall := range toolcalls {
- call := toolcall.(map[string]any)
- if toolInvocation, ok := call["toolInvocation"].(map[string]any); ok {
- data, _ := json.Marshal(toolInvocation)
- var toolCall opencode.ToolPart
- _ = json.Unmarshal(data, &toolCall)
- step := renderToolTitle(toolCall, width)
- step = "∟ " + step
- steps = append(steps, step)
- }
+ for _, item := range toolcalls {
+ data, _ := json.Marshal(item)
+ var toolCall opencode.ToolPart
+ _ = json.Unmarshal(data, &toolCall)
+ step := renderToolTitle(toolCall, width)
+ step = "∟ " + step
+ steps = append(steps, step)
}
body = strings.Join(steps, "\n")
}
+ body = defaultStyle(body)
default:
if result == nil {
empty := ""
@@ -459,7 +426,7 @@ func renderToolDetails(
}
body = *result
body = util.TruncateHeight(body, 10)
- body = styles.NewStyle().Width(width - 6).Render(body)
+ body = defaultStyle(body)
}
}
@@ -479,12 +446,16 @@ func renderToolDetails(
if body == "" && error == "" && result != nil {
body = *result
body = util.TruncateHeight(body, 10)
- body = styles.NewStyle().Width(width - 6).Render(body)
+ body = defaultStyle(body)
+ }
+
+ if body == "" {
+ body = defaultStyle("")
}
title := renderToolTitle(toolCall, width)
content := title + "\n\n" + body
- return renderContentBlock(app, content, highlight, width, WithBorderColor(borderColor))
+ return renderContentBlock(app, content, width, WithBorderColor(borderColor))
}
func renderToolName(name string) string {
@@ -539,10 +510,9 @@ func renderToolTitle(
toolCall opencode.ToolPart,
width int,
) string {
- // TODO: handle truncate to width
-
if toolCall.State.Status == opencode.ToolPartStateStatusPending {
- return renderToolAction(toolCall.Tool)
+ title := renderToolAction(toolCall.Tool)
+ return styles.NewStyle().Width(width - 6).Render(title)
}
toolArgs := ""
@@ -590,13 +560,15 @@ func renderToolTitle(
toolName := renderToolName(toolCall.Tool)
title = fmt.Sprintf("%s %s", toolName, toolArgs)
}
+
+ title = truncate.StringWithTail(title, uint(width-6), "...")
return title
}
func renderToolAction(name string) string {
switch name {
case "task":
- return "Searching..."
+ return "Planning..."
case "bash":
return "Writing command..."
case "edit":
@@ -667,7 +639,12 @@ type Diagnostic struct {
}
// renderDiagnostics formats LSP diagnostics for display in the TUI
-func renderDiagnostics(metadata map[string]any, filePath string) string {
+func renderDiagnostics(
+ metadata map[string]any,
+ filePath string,
+ backgroundColor compat.AdaptiveColor,
+ width int,
+) string {
if diagnosticsData, ok := metadata["diagnostics"].(map[string]any); ok {
if fileDiagnostics, ok := diagnosticsData[filePath].([]any); ok {
var errorDiagnostics []string
@@ -703,9 +680,15 @@ func renderDiagnostics(metadata map[string]any, filePath string) string {
var result strings.Builder
for _, diagnostic := range errorDiagnostics {
if result.Len() > 0 {
- result.WriteString("\n")
+ result.WriteString("\n\n")
}
- result.WriteString(styles.NewStyle().Foreground(t.Error()).Render(diagnostic))
+ diagnostic = ansi.WordwrapWc(diagnostic, width, " -")
+ result.WriteString(
+ styles.NewStyle().
+ Background(backgroundColor).
+ Foreground(t.Error()).
+ Render(diagnostic),
+ )
}
return result.String()
}
diff --git a/packages/tui/internal/components/chat/messages.go b/packages/tui/internal/components/chat/messages.go
index 7ecd9b21f9..acc7b8879c 100644
--- a/packages/tui/internal/components/chat/messages.go
+++ b/packages/tui/internal/components/chat/messages.go
@@ -10,6 +10,7 @@ import (
"github.com/sst/opencode-sdk-go"
"github.com/sst/opencode/internal/app"
"github.com/sst/opencode/internal/components/dialog"
+ "github.com/sst/opencode/internal/components/toast"
"github.com/sst/opencode/internal/layout"
"github.com/sst/opencode/internal/styles"
"github.com/sst/opencode/internal/theme"
@@ -18,36 +19,30 @@ import (
type MessagesComponent interface {
tea.Model
- View(width, height int) string
- SetWidth(width int) tea.Cmd
+ tea.ViewModel
PageUp() (tea.Model, tea.Cmd)
PageDown() (tea.Model, tea.Cmd)
HalfPageUp() (tea.Model, tea.Cmd)
HalfPageDown() (tea.Model, tea.Cmd)
- First() (tea.Model, tea.Cmd)
- Last() (tea.Model, tea.Cmd)
- Previous() (tea.Model, tea.Cmd)
- Next() (tea.Model, tea.Cmd)
ToolDetailsVisible() bool
- Selected() string
+ GotoTop() (tea.Model, tea.Cmd)
+ GotoBottom() (tea.Model, tea.Cmd)
+ CopyLastMessage() (tea.Model, tea.Cmd)
}
type messagesComponent struct {
- width int
+ width, height int
app *app.App
+ header string
viewport viewport.Model
- cache *MessageCache
- rendering bool
+ cache *PartCache
+ loading bool
showToolDetails bool
+ rendering bool
+ dirty bool
tail bool
partCount int
lineCount int
- selectedPart int
- selectedText string
-}
-type renderFinishedMsg struct{}
-type selectedMessagePartChangedMsg struct {
- part int
}
type ToggleToolDetailsMsg struct{}
@@ -56,55 +51,61 @@ func (m *messagesComponent) Init() tea.Cmd {
return tea.Batch(m.viewport.Init())
}
-func (m *messagesComponent) Selected() string {
- return m.selectedText
-}
-
func (m *messagesComponent) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
var cmds []tea.Cmd
switch msg := msg.(type) {
+ case tea.WindowSizeMsg:
+ effectiveWidth := msg.Width - 4
+ // Clear cache on resize since width affects rendering
+ if m.width != effectiveWidth {
+ m.cache.Clear()
+ }
+ m.width = effectiveWidth
+ m.height = msg.Height - 7
+ m.viewport.SetWidth(m.width)
+ m.loading = true
+ return m, m.Reload()
case app.SendMsg:
m.viewport.GotoBottom()
m.tail = true
- m.selectedPart = -1
return m, nil
- case app.OptimisticMessageAddedMsg:
- m.tail = true
- m.rendering = true
- return m, m.Reload()
case dialog.ThemeSelectedMsg:
m.cache.Clear()
- m.rendering = true
+ m.loading = true
return m, m.Reload()
case ToggleToolDetailsMsg:
m.showToolDetails = !m.showToolDetails
- m.rendering = true
return m, m.Reload()
case app.SessionLoadedMsg, app.SessionClearedMsg:
m.cache.Clear()
m.tail = true
- m.rendering = true
- return m, m.Reload()
- case renderFinishedMsg:
- m.rendering = false
- if m.tail {
- m.viewport.GotoBottom()
- }
- case selectedMessagePartChangedMsg:
+ m.loading = true
return m, m.Reload()
+
case opencode.EventListResponseEventSessionUpdated:
if msg.Properties.Info.ID == m.app.Session.ID {
- m.renderView(m.width)
- if m.tail {
- m.viewport.GotoBottom()
- }
+ m.header = m.renderHeader()
}
case opencode.EventListResponseEventMessageUpdated:
if msg.Properties.Info.SessionID == m.app.Session.ID {
- m.renderView(m.width)
- if m.tail {
- m.viewport.GotoBottom()
- }
+ cmds = append(cmds, m.renderView())
+ }
+ case opencode.EventListResponseEventMessagePartUpdated:
+ if msg.Properties.Part.SessionID == m.app.Session.ID {
+ cmds = append(cmds, m.renderView())
+ }
+ case renderCompleteMsg:
+ m.partCount = msg.partCount
+ m.lineCount = msg.lineCount
+ m.rendering = false
+ m.loading = false
+ m.viewport.SetHeight(m.height - lipgloss.Height(m.header))
+ m.viewport.SetContent(msg.content)
+ if m.tail {
+ m.viewport.GotoBottom()
+ }
+ if m.dirty {
+ cmds = append(cmds, m.renderView())
}
}
@@ -116,261 +117,307 @@ func (m *messagesComponent) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
return m, tea.Batch(cmds...)
}
-func (m *messagesComponent) renderView(width int) {
- measure := util.Measure("messages.renderView")
- defer measure("messageCount", len(m.app.Messages))
+type renderCompleteMsg struct {
+ content string
+ partCount int
+ lineCount int
+}
- t := theme.CurrentTheme()
- blocks := make([]string, 0)
- m.partCount = 0
- m.lineCount = 0
+func (m *messagesComponent) renderView() tea.Cmd {
+ m.header = m.renderHeader()
- orphanedToolCalls := make([]opencode.ToolPart, 0)
+ if m.rendering {
+ m.dirty = true
+ return func() tea.Msg {
+ return nil
+ }
+ }
+ m.dirty = false
+ m.rendering = true
- for _, message := range m.app.Messages {
- var content string
- var cached bool
-
- switch casted := message.(type) {
- case opencode.UserMessage:
- userLoop:
- for partIndex, part := range casted.Parts {
- switch part := part.AsUnion().(type) {
- case opencode.TextPart:
- remainingParts := casted.Parts[partIndex+1:]
- fileParts := make([]opencode.FilePart, 0)
- for _, part := range remainingParts {
- switch part := part.AsUnion().(type) {
- case opencode.FilePart:
- fileParts = append(fileParts, part)
+ return func() tea.Msg {
+ measure := util.Measure("messages.renderView")
+ defer measure()
+
+ t := theme.CurrentTheme()
+ blocks := make([]string, 0)
+ partCount := 0
+ lineCount := 0
+
+ orphanedToolCalls := make([]opencode.ToolPart, 0)
+
+ width := m.width // always use full width
+
+ for _, message := range m.app.Messages {
+ var content string
+ var cached bool
+
+ switch casted := message.Info.(type) {
+ case opencode.UserMessage:
+ for partIndex, part := range message.Parts {
+ switch part := part.(type) {
+ case opencode.TextPart:
+ if part.Synthetic {
+ continue
}
- }
- flexItems := []layout.FlexItem{}
- if len(fileParts) > 0 {
- fileStyle := styles.NewStyle().Background(t.BackgroundElement()).Foreground(t.TextMuted()).Padding(0, 1)
- mediaTypeStyle := styles.NewStyle().Background(t.Secondary()).Foreground(t.BackgroundPanel()).Padding(0, 1)
- for _, filePart := range fileParts {
- mediaType := ""
- switch filePart.Mime {
- case "text/plain":
- mediaType = "txt"
- case "image/png", "image/jpeg", "image/gif", "image/webp":
- mediaType = "img"
- mediaTypeStyle = mediaTypeStyle.Background(t.Accent())
- case "application/pdf":
- mediaType = "pdf"
- mediaTypeStyle = mediaTypeStyle.Background(t.Primary())
+ remainingParts := message.Parts[partIndex+1:]
+ fileParts := make([]opencode.FilePart, 0)
+ for _, part := range remainingParts {
+ switch part := part.(type) {
+ case opencode.FilePart:
+ fileParts = append(fileParts, part)
}
- flexItems = append(flexItems, layout.FlexItem{
- View: mediaTypeStyle.Render(mediaType) + fileStyle.Render(filePart.Filename),
- })
}
- }
- bgColor := t.BackgroundPanel()
- files := layout.Render(
- layout.FlexOptions{
- Background: &bgColor,
- Width: width - 6,
- Direction: layout.Column,
- },
- flexItems...,
- )
-
- key := m.cache.GenerateKey(casted.ID, part.Text, width, m.selectedPart == m.partCount, files)
- content, cached = m.cache.Get(key)
- if !cached {
- content = renderText(
- m.app,
- message,
- part.Text,
- m.app.Info.User,
- m.showToolDetails,
- m.partCount == m.selectedPart,
- width,
- files,
+ flexItems := []layout.FlexItem{}
+ if len(fileParts) > 0 {
+ fileStyle := styles.NewStyle().Background(t.BackgroundElement()).Foreground(t.TextMuted()).Padding(0, 1)
+ mediaTypeStyle := styles.NewStyle().Background(t.Secondary()).Foreground(t.BackgroundPanel()).Padding(0, 1)
+ for _, filePart := range fileParts {
+ mediaType := ""
+ switch filePart.Mime {
+ case "text/plain":
+ mediaType = "txt"
+ case "image/png", "image/jpeg", "image/gif", "image/webp":
+ mediaType = "img"
+ mediaTypeStyle = mediaTypeStyle.Background(t.Accent())
+ case "application/pdf":
+ mediaType = "pdf"
+ mediaTypeStyle = mediaTypeStyle.Background(t.Primary())
+ }
+ flexItems = append(flexItems, layout.FlexItem{
+ View: mediaTypeStyle.Render(mediaType) + fileStyle.Render(filePart.Filename),
+ })
+ }
+ }
+ bgColor := t.BackgroundPanel()
+ files := layout.Render(
+ layout.FlexOptions{
+ Background: &bgColor,
+ Width: width - 6,
+ Direction: layout.Column,
+ },
+ flexItems...,
)
- m.cache.Set(key, content)
- }
- if content != "" {
- m = m.updateSelected(content, part.Text)
- blocks = append(blocks, content)
- }
- // Only render the first text part
- break userLoop
- }
- }
- case opencode.AssistantMessage:
- hasTextPart := false
- for partIndex, p := range casted.Parts {
- switch part := p.AsUnion().(type) {
- case opencode.TextPart:
- hasTextPart = true
- finished := casted.Time.Completed > 0
- remainingParts := casted.Parts[partIndex+1:]
- toolCallParts := make([]opencode.ToolPart, 0)
-
- // sometimes tool calls happen without an assistant message
- // these should be included in this assistant message as well
- if len(orphanedToolCalls) > 0 {
- toolCallParts = append(toolCallParts, orphanedToolCalls...)
- orphanedToolCalls = make([]opencode.ToolPart, 0)
+ key := m.cache.GenerateKey(casted.ID, part.Text, width, files)
+ content, cached = m.cache.Get(key)
+ if !cached {
+ content = renderText(
+ m.app,
+ message.Info,
+ part.Text,
+ m.app.Config.Username,
+ m.showToolDetails,
+ width,
+ files,
+ )
+ content = lipgloss.PlaceHorizontal(
+ m.width,
+ lipgloss.Center,
+ content,
+ styles.WhitespaceStyle(t.Background()),
+ )
+ m.cache.Set(key, content)
+ }
+ if content != "" {
+ partCount++
+ lineCount += lipgloss.Height(content) + 1
+ blocks = append(blocks, content)
+ }
}
+ }
- remaining := true
- for _, part := range remainingParts {
- if !remaining {
- break
+ case opencode.AssistantMessage:
+ hasTextPart := false
+ for partIndex, p := range message.Parts {
+ switch part := p.(type) {
+ case opencode.TextPart:
+ hasTextPart = true
+ finished := part.Time.End > 0
+ remainingParts := message.Parts[partIndex+1:]
+ toolCallParts := make([]opencode.ToolPart, 0)
+
+ // sometimes tool calls happen without an assistant message
+ // these should be included in this assistant message as well
+ if len(orphanedToolCalls) > 0 {
+ toolCallParts = append(toolCallParts, orphanedToolCalls...)
+ orphanedToolCalls = make([]opencode.ToolPart, 0)
}
- switch part := part.AsUnion().(type) {
- case opencode.TextPart:
- // we only want tool calls associated with the current text part.
- // if we hit another text part, we're done.
- remaining = false
- case opencode.ToolPart:
- toolCallParts = append(toolCallParts, part)
- if part.State.Status != opencode.ToolPartStateStatusCompleted || part.State.Status != opencode.ToolPartStateStatusError {
- // i don't think there's a case where a tool call isn't in result state
- // and the message time is 0, but just in case
- finished = false
+
+ remaining := true
+ for _, part := range remainingParts {
+ if !remaining {
+ break
+ }
+ switch part := part.(type) {
+ case opencode.TextPart:
+ // we only want tool calls associated with the current text part.
+ // if we hit another text part, we're done.
+ remaining = false
+ case opencode.ToolPart:
+ toolCallParts = append(toolCallParts, part)
+ if part.State.Status != opencode.ToolPartStateStatusCompleted && part.State.Status != opencode.ToolPartStateStatusError {
+ // i don't think there's a case where a tool call isn't in result state
+ // and the message time is 0, but just in case
+ finished = false
+ }
}
}
- }
- if finished {
- key := m.cache.GenerateKey(casted.ID, p.Text, width, m.showToolDetails, m.selectedPart == m.partCount)
- content, cached = m.cache.Get(key)
- if !cached {
+ if finished {
+ key := m.cache.GenerateKey(casted.ID, part.Text, width, m.showToolDetails)
+ content, cached = m.cache.Get(key)
+ if !cached {
+ content = renderText(
+ m.app,
+ message.Info,
+ part.Text,
+ casted.ModelID,
+ m.showToolDetails,
+ width,
+ "",
+ toolCallParts...,
+ )
+ content = lipgloss.PlaceHorizontal(
+ m.width,
+ lipgloss.Center,
+ content,
+ styles.WhitespaceStyle(t.Background()),
+ )
+ m.cache.Set(key, content)
+ }
+ } else {
content = renderText(
m.app,
- message,
- p.Text,
+ message.Info,
+ part.Text,
casted.ModelID,
m.showToolDetails,
- m.partCount == m.selectedPart,
width,
"",
toolCallParts...,
)
- m.cache.Set(key, content)
+ content = lipgloss.PlaceHorizontal(
+ m.width,
+ lipgloss.Center,
+ content,
+ styles.WhitespaceStyle(t.Background()),
+ )
}
- } else {
- content = renderText(
- m.app,
- message,
- p.Text,
- casted.ModelID,
- m.showToolDetails,
- m.partCount == m.selectedPart,
- width,
- "",
- toolCallParts...,
- )
- }
- if content != "" {
- m = m.updateSelected(content, p.Text)
- blocks = append(blocks, content)
- }
- case opencode.ToolPart:
- if !m.showToolDetails {
- if !hasTextPart {
- orphanedToolCalls = append(orphanedToolCalls, part)
+ if content != "" {
+ partCount++
+ lineCount += lipgloss.Height(content) + 1
+ blocks = append(blocks, content)
+ }
+ case opencode.ToolPart:
+ if !m.showToolDetails {
+ if !hasTextPart {
+ orphanedToolCalls = append(orphanedToolCalls, part)
+ }
+ continue
}
- continue
- }
- if part.State.Status == opencode.ToolPartStateStatusCompleted || part.State.Status == opencode.ToolPartStateStatusError {
- key := m.cache.GenerateKey(casted.ID,
- part.ID,
- m.showToolDetails,
- width,
- m.partCount == m.selectedPart,
- )
- content, cached = m.cache.Get(key)
- if !cached {
+ if part.State.Status == opencode.ToolPartStateStatusCompleted || part.State.Status == opencode.ToolPartStateStatusError {
+ key := m.cache.GenerateKey(casted.ID,
+ part.ID,
+ m.showToolDetails,
+ width,
+ )
+ content, cached = m.cache.Get(key)
+ if !cached {
+ content = renderToolDetails(
+ m.app,
+ part,
+ width,
+ )
+ content = lipgloss.PlaceHorizontal(
+ m.width,
+ lipgloss.Center,
+ content,
+ styles.WhitespaceStyle(t.Background()),
+ )
+ m.cache.Set(key, content)
+ }
+ } else {
+ // if the tool call isn't finished, don't cache
content = renderToolDetails(
m.app,
part,
- m.partCount == m.selectedPart,
width,
)
- m.cache.Set(key, content)
+ content = lipgloss.PlaceHorizontal(
+ m.width,
+ lipgloss.Center,
+ content,
+ styles.WhitespaceStyle(t.Background()),
+ )
+ }
+ if content != "" {
+ partCount++
+ lineCount += lipgloss.Height(content) + 1
+ blocks = append(blocks, content)
}
- } else {
- // if the tool call isn't finished, don't cache
- content = renderToolDetails(
- m.app,
- part,
- m.partCount == m.selectedPart,
- width,
- )
- }
- if content != "" {
- m = m.updateSelected(content, "")
- blocks = append(blocks, content)
}
}
}
- }
- error := ""
- if assistant, ok := message.(opencode.AssistantMessage); ok {
- switch err := assistant.Error.AsUnion().(type) {
- case nil:
- case opencode.AssistantMessageErrorMessageOutputLengthError:
- error = "Message output length exceeded"
- case opencode.ProviderAuthError:
- error = err.Data.Message
- case opencode.MessageAbortedError:
- error = "Request was aborted"
- case opencode.UnknownError:
- error = err.Data.Message
+ error := ""
+ if assistant, ok := message.Info.(opencode.AssistantMessage); ok {
+ switch err := assistant.Error.AsUnion().(type) {
+ case nil:
+ case opencode.AssistantMessageErrorMessageOutputLengthError:
+ error = "Message output length exceeded"
+ case opencode.ProviderAuthError:
+ error = err.Data.Message
+ case opencode.MessageAbortedError:
+ error = "Request was aborted"
+ case opencode.UnknownError:
+ error = err.Data.Message
+ }
}
- }
- if error != "" {
- error = styles.NewStyle().Width(width - 6).Render(error)
- error = renderContentBlock(
- m.app,
- error,
- false,
- width,
- WithBorderColor(t.Error()),
- )
- blocks = append(blocks, error)
- m.lineCount += lipgloss.Height(error) + 1
+ if error != "" {
+ error = styles.NewStyle().Width(width - 6).Render(error)
+ error = renderContentBlock(
+ m.app,
+ error,
+ width,
+ WithBorderColor(t.Error()),
+ )
+ error = lipgloss.PlaceHorizontal(
+ m.width,
+ lipgloss.Center,
+ error,
+ styles.WhitespaceStyle(t.Background()),
+ )
+ blocks = append(blocks, error)
+ lineCount += lipgloss.Height(error) + 1
+ }
}
- }
-
- m.viewport.SetContent("\n" + strings.Join(blocks, "\n\n"))
- if m.selectedPart == m.partCount {
- m.viewport.GotoBottom()
- }
-
-}
-func (m *messagesComponent) updateSelected(content string, selectedText string) *messagesComponent {
- if m.selectedPart == m.partCount {
- m.viewport.SetYOffset(m.lineCount - (m.viewport.Height() / 2) + 4)
- m.selectedText = selectedText
+ content := "\n" + strings.Join(blocks, "\n\n")
+ return renderCompleteMsg{
+ content: content,
+ partCount: partCount,
+ lineCount: lineCount,
+ }
}
- m.partCount++
- m.lineCount += lipgloss.Height(content) + 1
- return m
}
-func (m *messagesComponent) header(width int) string {
+func (m *messagesComponent) renderHeader() string {
if m.app.Session.ID == "" {
return ""
}
+ headerWidth := m.width
+
t := theme.CurrentTheme()
base := styles.NewStyle().Foreground(t.Text()).Background(t.Background()).Render
muted := styles.NewStyle().Foreground(t.TextMuted()).Background(t.Background()).Render
headerLines := []string{}
headerLines = append(
headerLines,
- util.ToMarkdown("# "+m.app.Session.Title, width-6, t.Background()),
+ util.ToMarkdown("# "+m.app.Session.Title, headerWidth-6, t.Background()),
)
share := ""
@@ -386,7 +433,7 @@ func (m *messagesComponent) header(width int) string {
contextWindow := m.app.Model.Limit.Context
for _, message := range m.app.Messages {
- if assistant, ok := message.(opencode.AssistantMessage); ok {
+ if assistant, ok := message.Info.(opencode.AssistantMessage); ok {
cost += assistant.Cost
usage := assistant.Tokens
if usage.Output > 0 {
@@ -413,29 +460,34 @@ func (m *messagesComponent) header(width int) string {
Render(formatTokensAndCost(tokens, contextWindow, cost, isSubscriptionModel))
background := t.Background()
- share = layout.Render(
+
+ var items []layout.FlexItem
+ justify := layout.JustifyEnd
+
+ if m.app.Config.Share != opencode.ConfigShareDisabled {
+ items = append(items, layout.FlexItem{View: share})
+ justify = layout.JustifySpaceBetween
+ }
+
+ items = append(items, layout.FlexItem{View: sessionInfo})
+
+ headerRow := layout.Render(
layout.FlexOptions{
Background: &background,
Direction: layout.Row,
- Justify: layout.JustifySpaceBetween,
+ Justify: justify,
Align: layout.AlignStretch,
- Width: width - 6,
- },
- layout.FlexItem{
- View: share,
- },
- layout.FlexItem{
- View: sessionInfo,
+ Width: headerWidth - 6,
},
+ items...,
)
- headerLines = append(headerLines, share)
+ headerLines = append(headerLines, headerRow)
header := strings.Join(headerLines, "\n")
-
header = styles.NewStyle().
Background(t.Background()).
- Width(width).
+ Width(headerWidth).
PaddingLeft(2).
PaddingRight(2).
BorderLeft(true).
@@ -444,6 +496,12 @@ func (m *messagesComponent) header(width int) string {
BorderForeground(t.BackgroundElement()).
BorderStyle(lipgloss.ThickBorder()).
Render(header)
+ header = lipgloss.PlaceHorizontal(
+ m.width,
+ lipgloss.Center,
+ header,
+ styles.WhitespaceStyle(t.Background()),
+ )
return "\n" + header + "\n"
}
@@ -473,7 +531,10 @@ func formatTokensAndCost(
formattedTokens = strings.Replace(formattedTokens, ".0M", "M", 1)
}
- percentage := (float64(tokens) / float64(contextWindow)) * 100
+ percentage := 0.0
+ if contextWindow > 0 {
+ percentage = (float64(tokens) / float64(contextWindow)) * 100
+ }
if isSubscriptionModel {
return fmt.Sprintf(
@@ -492,46 +553,26 @@ func formatTokensAndCost(
)
}
-func (m *messagesComponent) View(width, height int) string {
+func (m *messagesComponent) View() string {
t := theme.CurrentTheme()
- if m.rendering {
+ if m.loading {
return lipgloss.Place(
- width,
- height,
+ m.width,
+ m.height,
lipgloss.Center,
lipgloss.Center,
styles.NewStyle().Background(t.Background()).Render(""),
styles.WhitespaceStyle(t.Background()),
)
}
- header := m.header(width)
- m.viewport.SetWidth(width)
- m.viewport.SetHeight(height - lipgloss.Height(header))
return styles.NewStyle().
Background(t.Background()).
- Render(header + "\n" + m.viewport.View())
-}
-
-func (m *messagesComponent) SetWidth(width int) tea.Cmd {
- if m.width == width {
- return nil
- }
- // Clear cache on resize since width affects rendering
- if m.width != width {
- m.cache.Clear()
- }
- m.width = width
- m.viewport.SetWidth(width)
- m.renderView(width)
- return nil
+ Render(m.header + "\n" + m.viewport.View())
}
func (m *messagesComponent) Reload() tea.Cmd {
- return func() tea.Msg {
- m.renderView(m.width)
- return renderFinishedMsg{}
- }
+ return m.renderView()
}
func (m *messagesComponent) PageUp() (tea.Model, tea.Cmd) {
@@ -554,61 +595,50 @@ func (m *messagesComponent) HalfPageDown() (tea.Model, tea.Cmd) {
return m, nil
}
-func (m *messagesComponent) Previous() (tea.Model, tea.Cmd) {
- m.tail = false
- if m.selectedPart < 0 {
- m.selectedPart = m.partCount
- }
- m.selectedPart--
- if m.selectedPart < 0 {
- m.selectedPart = 0
- }
- return m, util.CmdHandler(selectedMessagePartChangedMsg{
- part: m.selectedPart,
- })
-}
-
-func (m *messagesComponent) Next() (tea.Model, tea.Cmd) {
- m.tail = false
- m.selectedPart++
- if m.selectedPart >= m.partCount {
- m.selectedPart = m.partCount
- }
- return m, util.CmdHandler(selectedMessagePartChangedMsg{
- part: m.selectedPart,
- })
+func (m *messagesComponent) ToolDetailsVisible() bool {
+ return m.showToolDetails
}
-func (m *messagesComponent) First() (tea.Model, tea.Cmd) {
- m.selectedPart = 0
- m.tail = false
- return m, util.CmdHandler(selectedMessagePartChangedMsg{
- part: m.selectedPart,
- })
+func (m *messagesComponent) GotoTop() (tea.Model, tea.Cmd) {
+ m.viewport.GotoTop()
+ return m, nil
}
-func (m *messagesComponent) Last() (tea.Model, tea.Cmd) {
- m.selectedPart = m.partCount - 1
- m.tail = true
- return m, util.CmdHandler(selectedMessagePartChangedMsg{
- part: m.selectedPart,
- })
+func (m *messagesComponent) GotoBottom() (tea.Model, tea.Cmd) {
+ m.viewport.GotoBottom()
+ return m, nil
}
-func (m *messagesComponent) ToolDetailsVisible() bool {
- return m.showToolDetails
+func (m *messagesComponent) CopyLastMessage() (tea.Model, tea.Cmd) {
+ if len(m.app.Messages) == 0 {
+ return m, nil
+ }
+ lastMessage := m.app.Messages[len(m.app.Messages)-1]
+ var lastTextPart *opencode.TextPart
+ for _, part := range lastMessage.Parts {
+ if p, ok := part.(opencode.TextPart); ok {
+ lastTextPart = &p
+ }
+ }
+ if lastTextPart == nil {
+ return m, nil
+ }
+ var cmds []tea.Cmd
+ cmds = append(cmds, m.app.SetClipboard(lastTextPart.Text))
+ cmds = append(cmds, toast.NewSuccessToast("Message copied to clipboard"))
+ return m, tea.Batch(cmds...)
}
func NewMessagesComponent(app *app.App) MessagesComponent {
vp := viewport.New()
vp.KeyMap = viewport.KeyMap{}
+ vp.MouseWheelDelta = 4
return &messagesComponent{
app: app,
viewport: vp,
showToolDetails: true,
- cache: NewMessageCache(),
+ cache: NewPartCache(),
tail: true,
- selectedPart: -1,
}
}
diff --git a/packages/tui/internal/components/dialog/complete.go b/packages/tui/internal/components/dialog/complete.go
index 0e8019a23a..f18d975102 100644
--- a/packages/tui/internal/components/dialog/complete.go
+++ b/packages/tui/internal/components/dialog/complete.go
@@ -11,73 +11,15 @@ import (
"github.com/charmbracelet/lipgloss/v2"
"github.com/lithammer/fuzzysearch/fuzzy"
"github.com/muesli/reflow/truncate"
+ "github.com/sst/opencode/internal/completions"
"github.com/sst/opencode/internal/components/list"
"github.com/sst/opencode/internal/styles"
"github.com/sst/opencode/internal/theme"
"github.com/sst/opencode/internal/util"
)
-type CompletionItem struct {
- Title string
- Value string
- ProviderID string
- Raw any
-}
-
-type CompletionItemI interface {
- list.ListItem
- GetValue() string
- DisplayValue() string
- GetProviderID() string
- GetRaw() any
-}
-
-func (ci *CompletionItem) Render(selected bool, width int) string {
- t := theme.CurrentTheme()
- baseStyle := styles.NewStyle().Foreground(t.Text())
-
- truncatedStr := truncate.String(string(ci.DisplayValue()), uint(width-4))
-
- itemStyle := baseStyle.
- Background(t.BackgroundElement()).
- Padding(0, 1)
-
- if selected {
- itemStyle = itemStyle.Foreground(t.Primary())
- }
-
- title := itemStyle.Render(truncatedStr)
- return title
-}
-
-func (ci *CompletionItem) DisplayValue() string {
- return ci.Title
-}
-
-func (ci *CompletionItem) GetValue() string {
- return ci.Value
-}
-
-func (ci *CompletionItem) GetProviderID() string {
- return ci.ProviderID
-}
-
-func (ci *CompletionItem) GetRaw() any {
- return ci.Raw
-}
-
-func NewCompletionItem(completionItem CompletionItem) CompletionItemI {
- return &completionItem
-}
-
-type CompletionProvider interface {
- GetId() string
- GetChildEntries(query string) ([]CompletionItemI, error)
- GetEmptyMessage() string
-}
-
type CompletionSelectedMsg struct {
- Item CompletionItemI
+ Item completions.CompletionSuggestion
SearchString string
}
@@ -96,11 +38,11 @@ type CompletionDialog interface {
type completionDialogComponent struct {
query string
- providers []CompletionProvider
+ providers []completions.CompletionProvider
width int
height int
pseudoSearchTextArea textarea.Model
- list list.List[CompletionItemI]
+ list list.List[completions.CompletionSuggestion]
trigger string
}
@@ -114,7 +56,7 @@ var completionDialogKeys = completionDialogKeyMap{
key.WithKeys("tab", "enter", "right"),
),
Cancel: key.NewBinding(
- key.WithKeys(" ", "esc", "backspace", "ctrl+c"),
+ key.WithKeys("space", " ", "esc", "backspace", "ctrl+h", "ctrl+c"),
),
}
@@ -124,7 +66,8 @@ func (c *completionDialogComponent) Init() tea.Cmd {
func (c *completionDialogComponent) getAllCompletions(query string) tea.Cmd {
return func() tea.Msg {
- allItems := make([]CompletionItemI, 0)
+ allItems := make([]completions.CompletionSuggestion, 0)
+ providersWithResults := 0
// Collect results from all providers
for _, provider := range c.providers {
@@ -139,25 +82,27 @@ func (c *completionDialogComponent) getAllCompletions(query string) tea.Cmd {
)
continue
}
- allItems = append(allItems, items...)
+ if len(items) > 0 {
+ providersWithResults++
+ allItems = append(allItems, items...)
+ }
}
// If there's a query, use fuzzy ranking to sort results
- if query != "" && len(allItems) > 0 {
+ if query != "" && providersWithResults > 1 {
+ t := theme.CurrentTheme()
+ baseStyle := styles.NewStyle().Background(t.BackgroundElement())
// Create a slice of display values for fuzzy matching
displayValues := make([]string, len(allItems))
for i, item := range allItems {
- displayValues[i] = item.DisplayValue()
+ displayValues[i] = item.Display(baseStyle)
}
- // Get fuzzy matches with ranking
matches := fuzzy.RankFindFold(query, displayValues)
-
- // Sort by score (best matches first)
sort.Sort(matches)
// Reorder items based on fuzzy ranking
- rankedItems := make([]CompletionItemI, 0, len(matches))
+ rankedItems := make([]completions.CompletionSuggestion, 0, len(matches))
for _, match := range matches {
rankedItems = append(rankedItems, allItems[match.OriginalIndex])
}
@@ -171,7 +116,7 @@ func (c *completionDialogComponent) getAllCompletions(query string) tea.Cmd {
func (c *completionDialogComponent) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
var cmds []tea.Cmd
switch msg := msg.(type) {
- case []CompletionItemI:
+ case []completions.CompletionSuggestion:
c.list.SetItems(msg)
case tea.KeyMsg:
if c.pseudoSearchTextArea.Focused() {
@@ -189,7 +134,7 @@ func (c *completionDialogComponent) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
}
u, cmd := c.list.Update(msg)
- c.list = u.(list.List[CompletionItemI])
+ c.list = u.(list.List[completions.CompletionSuggestion])
cmds = append(cmds, cmd)
}
@@ -205,7 +150,7 @@ func (c *completionDialogComponent) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
width := lipgloss.Width(value)
triggerWidth := lipgloss.Width(c.trigger)
// Only close on backspace when there are no characters left, unless we're back to just the trigger
- if msg.String() != "backspace" || (width <= triggerWidth && value != c.trigger) {
+ if (msg.String() != "backspace" && msg.String() != "ctrl+h") || (width <= triggerWidth && value != c.trigger) {
return c, c.close()
}
}
@@ -223,11 +168,11 @@ func (c *completionDialogComponent) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
func (c *completionDialogComponent) View() string {
t := theme.CurrentTheme()
- baseStyle := styles.NewStyle().Foreground(t.Text())
c.list.SetMaxWidth(c.width)
- return baseStyle.
- Padding(0, 0).
+ return styles.NewStyle().
+ Padding(0, 1).
+ Foreground(t.Text()).
Background(t.BackgroundElement()).
BorderStyle(lipgloss.ThickBorder()).
BorderLeft(true).
@@ -246,7 +191,7 @@ func (c *completionDialogComponent) IsEmpty() bool {
return c.list.IsEmpty()
}
-func (c *completionDialogComponent) complete(item CompletionItemI) tea.Cmd {
+func (c *completionDialogComponent) complete(item completions.CompletionSuggestion) tea.Cmd {
value := c.pseudoSearchTextArea.Value()
return tea.Batch(
util.CmdHandler(CompletionSelectedMsg{
@@ -265,7 +210,7 @@ func (c *completionDialogComponent) close() tea.Cmd {
func NewCompletionDialogComponent(
trigger string,
- providers ...CompletionProvider,
+ providers ...completions.CompletionProvider,
) CompletionDialog {
ti := textarea.New()
ti.SetValue(trigger)
@@ -276,11 +221,34 @@ func NewCompletionDialogComponent(
emptyMessage = providers[0].GetEmptyMessage()
}
+ // Define render function for completion suggestions
+ renderFunc := func(item completions.CompletionSuggestion, selected bool, width int, baseStyle styles.Style) string {
+ t := theme.CurrentTheme()
+ style := baseStyle
+
+ if selected {
+ style = style.Background(t.BackgroundElement()).Foreground(t.Primary())
+ } else {
+ style = style.Background(t.BackgroundElement()).Foreground(t.Text())
+ }
+
+ // The item.Display string already has any inline colors from the provider
+ truncatedStr := truncate.String(item.Display(style), uint(width-4))
+ return style.Width(width - 4).Render(truncatedStr)
+ }
+
+ // Define selectable function - all completion suggestions are selectable
+ selectableFunc := func(item completions.CompletionSuggestion) bool {
+ return true
+ }
+
li := list.NewListComponent(
- []CompletionItemI{},
- 7,
- emptyMessage,
- false,
+ list.WithItems([]completions.CompletionSuggestion{}),
+ list.WithMaxVisibleHeight[completions.CompletionSuggestion](7),
+ list.WithFallbackMessage[completions.CompletionSuggestion](emptyMessage),
+ list.WithAlphaNumericKeys[completions.CompletionSuggestion](false),
+ list.WithRenderFunc(renderFunc),
+ list.WithSelectableFunc(selectableFunc),
)
c := &completionDialogComponent{
@@ -293,7 +261,7 @@ func NewCompletionDialogComponent(
// Load initial items from all providers
go func() {
- allItems := make([]CompletionItemI, 0)
+ allItems := make([]completions.CompletionSuggestion, 0)
for _, provider := range providers {
items, err := provider.GetChildEntries("")
if err != nil {
diff --git a/packages/tui/internal/components/dialog/find.go b/packages/tui/internal/components/dialog/find.go
index 3fc6e59940..40be600c57 100644
--- a/packages/tui/internal/components/dialog/find.go
+++ b/packages/tui/internal/components/dialog/find.go
@@ -3,9 +3,8 @@ package dialog
import (
"log/slog"
- "github.com/charmbracelet/bubbles/v2/key"
- "github.com/charmbracelet/bubbles/v2/textinput"
tea "github.com/charmbracelet/bubbletea/v2"
+ "github.com/sst/opencode/internal/completions"
"github.com/sst/opencode/internal/components/list"
"github.com/sst/opencode/internal/components/modal"
"github.com/sst/opencode/internal/layout"
@@ -14,12 +13,20 @@ import (
"github.com/sst/opencode/internal/util"
)
+const (
+ findDialogWidth = 76
+)
+
type FindSelectedMsg struct {
FilePath string
}
type FindDialogCloseMsg struct{}
+type findInitialSuggestionsMsg struct {
+ suggestions []completions.CompletionSuggestion
+}
+
type FindDialog interface {
layout.Modal
tea.Model
@@ -29,117 +36,157 @@ type FindDialog interface {
IsEmpty() bool
}
-type findDialogComponent struct {
- query string
- completionProvider CompletionProvider
- width, height int
- modal *modal.Modal
- textInput textinput.Model
- list list.List[CompletionItemI]
+// findItem is a custom list item for file suggestions
+type findItem struct {
+ suggestion completions.CompletionSuggestion
+}
+
+func (f findItem) Render(
+ selected bool,
+ width int,
+ baseStyle styles.Style,
+) string {
+ t := theme.CurrentTheme()
+
+ itemStyle := baseStyle.
+ Background(t.BackgroundPanel()).
+ Foreground(t.TextMuted())
+
+ if selected {
+ itemStyle = itemStyle.Foreground(t.Primary())
+ }
+
+ return itemStyle.PaddingLeft(1).Render(f.suggestion.Display(itemStyle))
}
-type findDialogKeyMap struct {
- Select key.Binding
- Cancel key.Binding
+func (f findItem) Selectable() bool {
+ return true
}
-var findDialogKeys = findDialogKeyMap{
- Select: key.NewBinding(
- key.WithKeys("enter"),
- ),
- Cancel: key.NewBinding(
- key.WithKeys("esc"),
- ),
+type findDialogComponent struct {
+ completionProvider completions.CompletionProvider
+ allSuggestions []completions.CompletionSuggestion
+ width, height int
+ modal *modal.Modal
+ searchDialog *SearchDialog
+ dialogWidth int
}
func (f *findDialogComponent) Init() tea.Cmd {
- return textinput.Blink
+ return tea.Batch(
+ f.loadInitialSuggestions(),
+ f.searchDialog.Init(),
+ )
}
-func (f *findDialogComponent) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
- var cmd tea.Cmd
- var cmds []tea.Cmd
+func (f *findDialogComponent) loadInitialSuggestions() tea.Cmd {
+ return func() tea.Msg {
+ items, err := f.completionProvider.GetChildEntries("")
+ if err != nil {
+ slog.Error("Failed to get initial completion items", "error", err)
+ return findInitialSuggestionsMsg{suggestions: []completions.CompletionSuggestion{}}
+ }
+ return findInitialSuggestionsMsg{suggestions: items}
+ }
+}
+func (f *findDialogComponent) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
switch msg := msg.(type) {
- case []CompletionItemI:
- f.list.SetItems(msg)
- case tea.KeyMsg:
- switch msg.String() {
- case "ctrl+c":
- if f.textInput.Value() == "" {
- return f, nil
- }
- f.textInput.SetValue("")
- return f.update(msg)
+ case findInitialSuggestionsMsg:
+ // Handle initial suggestions setup
+ f.allSuggestions = msg.suggestions
+
+ // Calculate dialog width
+ f.dialogWidth = f.calculateDialogWidth()
+
+ // Initialize search dialog with calculated width
+ f.searchDialog = NewSearchDialog("Search files...", 10)
+ f.searchDialog.SetWidth(f.dialogWidth)
+
+ // Convert to list items
+ items := make([]list.Item, len(f.allSuggestions))
+ for i, suggestion := range f.allSuggestions {
+ items[i] = findItem{suggestion: suggestion}
}
+ f.searchDialog.SetItems(items)
- switch {
- case key.Matches(msg, findDialogKeys.Select):
- item, i := f.list.GetSelectedItem()
- if i == -1 {
- return f, nil
- }
- return f, f.selectFile(item)
- case key.Matches(msg, findDialogKeys.Cancel):
- return f, f.Close()
- default:
- f.textInput, cmd = f.textInput.Update(msg)
- cmds = append(cmds, cmd)
-
- f, cmd = f.update(msg)
- cmds = append(cmds, cmd)
+ // Update modal with calculated width
+ f.modal = modal.New(
+ modal.WithTitle("Find Files"),
+ modal.WithMaxWidth(f.dialogWidth+4),
+ )
+
+ return f, f.searchDialog.Init()
+
+ case []completions.CompletionSuggestion:
+ // Store suggestions and convert to findItem for the search dialog
+ f.allSuggestions = msg
+ items := make([]list.Item, len(msg))
+ for i, suggestion := range msg {
+ items[i] = findItem{suggestion: suggestion}
}
- }
+ f.searchDialog.SetItems(items)
+ return f, nil
- return f, tea.Batch(cmds...)
-}
+ case SearchSelectionMsg:
+ // Handle selection from search dialog - now we can directly access the suggestion
+ if item, ok := msg.Item.(findItem); ok {
+ return f, f.selectFile(item.suggestion)
+ }
+ return f, nil
-func (f *findDialogComponent) update(msg tea.Msg) (*findDialogComponent, tea.Cmd) {
- var cmd tea.Cmd
- var cmds []tea.Cmd
+ case SearchCancelledMsg:
+ return f, f.Close()
- query := f.textInput.Value()
- if query != f.query {
- f.query = query
- cmd = func() tea.Msg {
- items, err := f.completionProvider.GetChildEntries(query)
+ case SearchQueryChangedMsg:
+ // Update completion items based on search query
+ return f, func() tea.Msg {
+ items, err := f.completionProvider.GetChildEntries(msg.Query)
if err != nil {
slog.Error("Failed to get completion items", "error", err)
+ return []completions.CompletionSuggestion{}
}
return items
}
- cmds = append(cmds, cmd)
- }
- u, cmd := f.list.Update(msg)
- f.list = u.(list.List[CompletionItemI])
- cmds = append(cmds, cmd)
+ case tea.WindowSizeMsg:
+ f.width = msg.Width
+ f.height = msg.Height
+ // Recalculate width based on new viewport size
+ oldWidth := f.dialogWidth
+ f.dialogWidth = f.calculateDialogWidth()
+ if oldWidth != f.dialogWidth {
+ f.searchDialog.SetWidth(f.dialogWidth)
+ // Update modal max width too
+ f.modal = modal.New(
+ modal.WithTitle("Find Files"),
+ modal.WithMaxWidth(f.dialogWidth+4),
+ )
+ }
+ f.searchDialog.SetHeight(msg.Height)
+ }
- return f, tea.Batch(cmds...)
+ // Forward all other messages to the search dialog
+ updatedDialog, cmd := f.searchDialog.Update(msg)
+ f.searchDialog = updatedDialog.(*SearchDialog)
+ return f, cmd
}
func (f *findDialogComponent) View() string {
- t := theme.CurrentTheme()
- f.textInput.SetWidth(f.width - 8)
- f.list.SetMaxWidth(f.width - 4)
- inputView := f.textInput.View()
- inputView = styles.NewStyle().
- Background(t.BackgroundElement()).
- Height(1).
- Width(f.width-4).
- Padding(0, 0).
- Render(inputView)
+ return f.searchDialog.View()
+}
- listView := f.list.View()
- return styles.NewStyle().Height(12).Render(inputView + "\n" + listView)
+func (f *findDialogComponent) calculateDialogWidth() int {
+ // Use fixed width unless viewport is smaller
+ if f.width > 0 && f.width < findDialogWidth+10 {
+ return f.width - 10
+ }
+ return findDialogWidth
}
func (f *findDialogComponent) SetWidth(width int) {
f.width = width
- if width > 4 {
- f.textInput.SetWidth(width - 4)
- f.list.SetMaxWidth(width - 4)
- }
+ f.searchDialog.SetWidth(f.dialogWidth)
}
func (f *findDialogComponent) SetHeight(height int) {
@@ -147,14 +194,14 @@ func (f *findDialogComponent) SetHeight(height int) {
}
func (f *findDialogComponent) IsEmpty() bool {
- return f.list.IsEmpty()
+ return f.searchDialog.GetQuery() == ""
}
-func (f *findDialogComponent) selectFile(item CompletionItemI) tea.Cmd {
+func (f *findDialogComponent) selectFile(item completions.CompletionSuggestion) tea.Cmd {
return tea.Sequence(
f.Close(),
util.CmdHandler(FindSelectedMsg{
- FilePath: item.GetValue(),
+ FilePath: item.Value,
}),
)
}
@@ -164,70 +211,26 @@ func (f *findDialogComponent) Render(background string) string {
}
func (f *findDialogComponent) Close() tea.Cmd {
- f.textInput.Reset()
- f.textInput.Blur()
+ f.searchDialog.SetQuery("")
+ f.searchDialog.Blur()
return util.CmdHandler(modal.CloseModalMsg{})
}
-func createTextInput(existing *textinput.Model) textinput.Model {
- t := theme.CurrentTheme()
- bgColor := t.BackgroundElement()
- textColor := t.Text()
- textMutedColor := t.TextMuted()
-
- ti := textinput.New()
-
- ti.Styles.Blurred.Placeholder = styles.NewStyle().
- Foreground(textMutedColor).
- Background(bgColor).
- Lipgloss()
- ti.Styles.Blurred.Text = styles.NewStyle().Foreground(textColor).Background(bgColor).Lipgloss()
- ti.Styles.Focused.Placeholder = styles.NewStyle().
- Foreground(textMutedColor).
- Background(bgColor).
- Lipgloss()
- ti.Styles.Focused.Text = styles.NewStyle().Foreground(textColor).Background(bgColor).Lipgloss()
- ti.Styles.Cursor.Color = t.Primary()
- ti.VirtualCursor = true
-
- ti.Prompt = " "
- ti.CharLimit = -1
- ti.Focus()
-
- if existing != nil {
- ti.SetValue(existing.Value())
- ti.SetWidth(existing.Width())
+func NewFindDialog(completionProvider completions.CompletionProvider) FindDialog {
+ component := &findDialogComponent{
+ completionProvider: completionProvider,
+ dialogWidth: findDialogWidth,
+ allSuggestions: []completions.CompletionSuggestion{},
}
- return ti
-}
-
-func NewFindDialog(completionProvider CompletionProvider) FindDialog {
- ti := createTextInput(nil)
+ // Create search dialog and modal with fixed width
+ component.searchDialog = NewSearchDialog("Search files...", 10)
+ component.searchDialog.SetWidth(findDialogWidth)
- li := list.NewListComponent(
- []CompletionItemI{},
- 10, // max visible items
- completionProvider.GetEmptyMessage(),
- false,
+ component.modal = modal.New(
+ modal.WithTitle("Find Files"),
+ modal.WithMaxWidth(findDialogWidth+4),
)
- go func() {
- items, err := completionProvider.GetChildEntries("")
- if err != nil {
- slog.Error("Failed to get completion items", "error", err)
- }
- li.SetItems(items)
- }()
-
- return &findDialogComponent{
- query: "",
- completionProvider: completionProvider,
- textInput: ti,
- list: li,
- modal: modal.New(
- modal.WithTitle("Find Files"),
- modal.WithMaxWidth(80),
- ),
- }
+ return component
}
diff --git a/packages/tui/internal/components/dialog/models.go b/packages/tui/internal/components/dialog/models.go
index f8cda82a86..8f1069fcb8 100644
--- a/packages/tui/internal/components/dialog/models.go
+++ b/packages/tui/internal/components/dialog/models.go
@@ -8,6 +8,7 @@ import (
"github.com/charmbracelet/bubbles/v2/key"
tea "github.com/charmbracelet/bubbletea/v2"
+ "github.com/lithammer/fuzzysearch/fuzzy"
"github.com/sst/opencode-sdk-go"
"github.com/sst/opencode/internal/app"
"github.com/sst/opencode/internal/components/list"
@@ -22,6 +23,7 @@ const (
numVisibleModels = 10
minDialogWidth = 40
maxDialogWidth = 80
+ maxRecentModels = 5
)
// ModelDialog interface for the model selection dialog
@@ -30,13 +32,13 @@ type ModelDialog interface {
}
type modelDialog struct {
- app *app.App
- allModels []ModelWithProvider
- width int
- height int
- modal *modal.Modal
- modelList list.List[ModelItem]
- dialogWidth int
+ app *app.App
+ allModels []ModelWithProvider
+ width int
+ height int
+ modal *modal.Modal
+ searchDialog *SearchDialog
+ dialogWidth int
}
type ModelWithProvider struct {
@@ -44,39 +46,42 @@ type ModelWithProvider struct {
Provider opencode.Provider
}
-type ModelItem struct {
- ModelName string
- ProviderName string
+// modelItem is a custom list item for model selections
+type modelItem struct {
+ model ModelWithProvider
}
-func (m ModelItem) Render(selected bool, width int) string {
+func (m modelItem) Render(
+ selected bool,
+ width int,
+ baseStyle styles.Style,
+) string {
t := theme.CurrentTheme()
+ itemStyle := baseStyle.
+ Background(t.BackgroundPanel()).
+ Foreground(t.Text())
+
if selected {
- displayText := fmt.Sprintf("%s (%s)", m.ModelName, m.ProviderName)
- return styles.NewStyle().
- Background(t.Primary()).
- Foreground(t.BackgroundPanel()).
- Width(width).
- PaddingLeft(1).
- Render(displayText)
- } else {
- modelStyle := styles.NewStyle().
- Foreground(t.Text()).
- Background(t.BackgroundPanel())
- providerStyle := styles.NewStyle().
- Foreground(t.TextMuted()).
- Background(t.BackgroundPanel())
-
- modelPart := modelStyle.Render(m.ModelName)
- providerPart := providerStyle.Render(fmt.Sprintf(" (%s)", m.ProviderName))
-
- combinedText := modelPart + providerPart
- return styles.NewStyle().
- Background(t.BackgroundPanel()).
- PaddingLeft(1).
- Render(combinedText)
+ itemStyle = itemStyle.Foreground(t.Primary())
}
+
+ providerStyle := baseStyle.
+ Foreground(t.TextMuted()).
+ Background(t.BackgroundPanel())
+
+ modelPart := itemStyle.Render(m.model.Model.Name)
+ providerPart := providerStyle.Render(fmt.Sprintf(" %s", m.model.Provider.Name))
+
+ combinedText := modelPart + providerPart
+ return baseStyle.
+ Background(t.BackgroundPanel()).
+ PaddingLeft(1).
+ Render(combinedText)
+}
+
+func (m modelItem) Selectable() bool {
+ return true
}
type modelKeyMap struct {
@@ -97,52 +102,67 @@ var modelKeys = modelKeyMap{
func (m *modelDialog) Init() tea.Cmd {
m.setupAllModels()
- return nil
+ return m.searchDialog.Init()
}
func (m *modelDialog) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
switch msg := msg.(type) {
- case tea.KeyMsg:
- switch {
- case key.Matches(msg, modelKeys.Enter):
- _, selectedIndex := m.modelList.GetSelectedItem()
- if selectedIndex >= 0 && selectedIndex < len(m.allModels) {
- selectedModel := m.allModels[selectedIndex]
- return m, tea.Sequence(
- util.CmdHandler(modal.CloseModalMsg{}),
- util.CmdHandler(
- app.ModelSelectedMsg{
- Provider: selectedModel.Provider,
- Model: selectedModel.Model,
- }),
- )
+ case SearchSelectionMsg:
+ // Handle selection from search dialog
+ if item, ok := msg.Item.(modelItem); ok {
+ return m, tea.Sequence(
+ util.CmdHandler(modal.CloseModalMsg{}),
+ util.CmdHandler(
+ app.ModelSelectedMsg{
+ Provider: item.model.Provider,
+ Model: item.model.Model,
+ }),
+ )
+ }
+ return m, util.CmdHandler(modal.CloseModalMsg{})
+ case SearchCancelledMsg:
+ return m, util.CmdHandler(modal.CloseModalMsg{})
+
+ case SearchRemoveItemMsg:
+ if item, ok := msg.Item.(modelItem); ok {
+ if m.isModelInRecentSection(item.model, msg.Index) {
+ m.app.State.RemoveModelFromRecentlyUsed(item.model.Provider.ID, item.model.Model.ID)
+ m.app.SaveState()
+ items := m.buildDisplayList(m.searchDialog.GetQuery())
+ m.searchDialog.SetItems(items)
}
- return m, util.CmdHandler(modal.CloseModalMsg{})
- case key.Matches(msg, modelKeys.Escape):
- return m, util.CmdHandler(modal.CloseModalMsg{})
}
+ return m, nil
+
+ case SearchQueryChangedMsg:
+ // Update the list based on search query
+ items := m.buildDisplayList(msg.Query)
+ m.searchDialog.SetItems(items)
+ return m, nil
+
case tea.WindowSizeMsg:
m.width = msg.Width
m.height = msg.Height
+ m.searchDialog.SetWidth(m.dialogWidth)
+ m.searchDialog.SetHeight(msg.Height)
}
- // Update the list component
- updatedList, cmd := m.modelList.Update(msg)
- m.modelList = updatedList.(list.List[ModelItem])
+ updatedDialog, cmd := m.searchDialog.Update(msg)
+ m.searchDialog = updatedDialog.(*SearchDialog)
return m, cmd
}
func (m *modelDialog) View() string {
- return m.modelList.View()
+ return m.searchDialog.View()
}
-func (m *modelDialog) calculateOptimalWidth(modelItems []ModelItem) int {
+func (m *modelDialog) calculateOptimalWidth(models []ModelWithProvider) int {
maxWidth := minDialogWidth
- for _, item := range modelItems {
+ for _, model := range models {
// Calculate the width needed for this item: "ModelName (ProviderName)"
// Add 4 for the parentheses, space, and some padding
- itemWidth := len(item.ModelName) + len(item.ProviderName) + 4
+ itemWidth := len(model.Model.Name) + len(model.Provider.Name) + 4
if itemWidth > maxWidth {
maxWidth = itemWidth
}
@@ -170,22 +190,16 @@ func (m *modelDialog) setupAllModels() {
m.sortModels()
- modelItems := make([]ModelItem, len(m.allModels))
- for i, modelWithProvider := range m.allModels {
- modelItems[i] = ModelItem{
- ModelName: modelWithProvider.Model.Name,
- ProviderName: modelWithProvider.Provider.Name,
- }
- }
+ // Calculate optimal width based on all models
+ m.dialogWidth = m.calculateOptimalWidth(m.allModels)
- m.dialogWidth = m.calculateOptimalWidth(modelItems)
+ // Initialize search dialog
+ m.searchDialog = NewSearchDialog("Search models...", numVisibleModels)
+ m.searchDialog.SetWidth(m.dialogWidth)
- m.modelList = list.NewListComponent(modelItems, numVisibleModels, "No models available", true)
- m.modelList.SetMaxWidth(m.dialogWidth)
-
- if len(m.allModels) > 0 {
- m.modelList.SetSelectedIndex(0)
- }
+ // Build initial display list (empty query shows grouped view)
+ items := m.buildDisplayList("")
+ m.searchDialog.SetItems(items)
}
func (m *modelDialog) sortModels() {
@@ -248,6 +262,176 @@ func (m *modelDialog) getModelUsageTime(providerID, modelID string) time.Time {
return time.Time{}
}
+// buildDisplayList creates the list items based on search query
+func (m *modelDialog) buildDisplayList(query string) []list.Item {
+ if query != "" {
+ // Search mode: use fuzzy matching
+ return m.buildSearchResults(query)
+ } else {
+ // Grouped mode: show Recent section and provider groups
+ return m.buildGroupedResults()
+ }
+}
+
+// buildSearchResults creates a flat list of search results using fuzzy matching
+func (m *modelDialog) buildSearchResults(query string) []list.Item {
+ type modelMatch struct {
+ model ModelWithProvider
+ score int
+ }
+
+ modelNames := []string{}
+ modelMap := make(map[string]ModelWithProvider)
+
+ // Create search strings and perform fuzzy matching
+ for _, model := range m.allModels {
+ searchStr := fmt.Sprintf("%s %s", model.Model.Name, model.Provider.Name)
+ modelNames = append(modelNames, searchStr)
+ modelMap[searchStr] = model
+
+ searchStr = fmt.Sprintf("%s %s", model.Provider.Name, model.Model.Name)
+ modelNames = append(modelNames, searchStr)
+ modelMap[searchStr] = model
+ }
+
+ matches := fuzzy.RankFindFold(query, modelNames)
+ sort.Sort(matches)
+
+ items := []list.Item{}
+ seenModels := make(map[string]bool)
+
+ for _, match := range matches {
+ model := modelMap[match.Target]
+ // Create a unique key to avoid duplicates
+ key := fmt.Sprintf("%s:%s", model.Provider.ID, model.Model.ID)
+ if seenModels[key] {
+ continue
+ }
+ seenModels[key] = true
+ items = append(items, modelItem{model: model})
+ }
+
+ return items
+}
+
+// buildGroupedResults creates a grouped list with Recent section and provider groups
+func (m *modelDialog) buildGroupedResults() []list.Item {
+ var items []list.Item
+
+ // Add Recent section
+ recentModels := m.getRecentModels(maxRecentModels)
+ if len(recentModels) > 0 {
+ items = append(items, list.HeaderItem("Recent"))
+ for _, model := range recentModels {
+ items = append(items, modelItem{model: model})
+ }
+ }
+
+ // Group models by provider
+ providerGroups := make(map[string][]ModelWithProvider)
+ for _, model := range m.allModels {
+ providerName := model.Provider.Name
+ providerGroups[providerName] = append(providerGroups[providerName], model)
+ }
+
+ // Get sorted provider names for consistent order
+ var providerNames []string
+ for name := range providerGroups {
+ providerNames = append(providerNames, name)
+ }
+ sort.Strings(providerNames)
+
+ // Add provider groups
+ for _, providerName := range providerNames {
+ models := providerGroups[providerName]
+
+ // Sort models within provider group
+ sort.Slice(models, func(i, j int) bool {
+ modelA := models[i]
+ modelB := models[j]
+
+ usageA := m.getModelUsageTime(modelA.Provider.ID, modelA.Model.ID)
+ usageB := m.getModelUsageTime(modelB.Provider.ID, modelB.Model.ID)
+
+ // Sort by usage time first, then by release date, then alphabetically
+ if !usageA.IsZero() && !usageB.IsZero() {
+ return usageA.After(usageB)
+ }
+ if !usageA.IsZero() && usageB.IsZero() {
+ return true
+ }
+ if usageA.IsZero() && !usageB.IsZero() {
+ return false
+ }
+
+ // Sort by release date if available
+ if modelA.Model.ReleaseDate != "" && modelB.Model.ReleaseDate != "" {
+ dateA := m.parseReleaseDate(modelA.Model.ReleaseDate)
+ dateB := m.parseReleaseDate(modelB.Model.ReleaseDate)
+ if !dateA.IsZero() && !dateB.IsZero() {
+ return dateA.After(dateB)
+ }
+ }
+
+ return modelA.Model.Name < modelB.Model.Name
+ })
+
+ // Add provider header
+ items = append(items, list.HeaderItem(providerName))
+
+ // Add models in this provider group
+ for _, model := range models {
+ items = append(items, modelItem{model: model})
+ }
+ }
+
+ return items
+}
+
+// getRecentModels returns the most recently used models
+func (m *modelDialog) getRecentModels(limit int) []ModelWithProvider {
+ var recentModels []ModelWithProvider
+
+ // Get recent models from app state
+ for _, usage := range m.app.State.RecentlyUsedModels {
+ if len(recentModels) >= limit {
+ break
+ }
+
+ // Find the corresponding model
+ for _, model := range m.allModels {
+ if model.Provider.ID == usage.ProviderID && model.Model.ID == usage.ModelID {
+ recentModels = append(recentModels, model)
+ break
+ }
+ }
+ }
+
+ return recentModels
+}
+
+func (m *modelDialog) isModelInRecentSection(model ModelWithProvider, index int) bool {
+ // Only check if we're in grouped mode (no search query)
+ if m.searchDialog.GetQuery() != "" {
+ return false
+ }
+
+ recentModels := m.getRecentModels(maxRecentModels)
+ if len(recentModels) == 0 {
+ return false
+ }
+
+ // Index 0 is the "Recent" header, so recent models are at indices 1 to len(recentModels)
+ if index >= 1 && index <= len(recentModels) {
+ if index-1 < len(recentModels) {
+ recentModel := recentModels[index-1]
+ return recentModel.Provider.ID == model.Provider.ID && recentModel.Model.ID == model.Model.ID
+ }
+ }
+
+ return false
+}
+
func (m *modelDialog) Render(background string) string {
return m.modal.Render(m.View(), background)
}
diff --git a/packages/tui/internal/components/dialog/permission.go b/packages/tui/internal/components/dialog/permission.go
deleted file mode 100644
index 5bc40624bd..0000000000
--- a/packages/tui/internal/components/dialog/permission.go
+++ /dev/null
@@ -1,496 +0,0 @@
-package dialog
-
-import (
- "fmt"
- "github.com/charmbracelet/bubbles/v2/key"
- "github.com/charmbracelet/bubbles/v2/viewport"
- tea "github.com/charmbracelet/bubbletea/v2"
- "github.com/charmbracelet/lipgloss/v2"
- "github.com/sst/opencode/internal/styles"
- "github.com/sst/opencode/internal/theme"
- "github.com/sst/opencode/internal/util"
- "strings"
-)
-
-type PermissionAction string
-
-// Permission responses
-const (
- PermissionAllow PermissionAction = "allow"
- PermissionAllowForSession PermissionAction = "allow_session"
- PermissionDeny PermissionAction = "deny"
-)
-
-// PermissionResponseMsg represents the user's response to a permission request
-type PermissionResponseMsg struct {
- // Permission permission.PermissionRequest
- Action PermissionAction
-}
-
-// PermissionDialogComponent interface for permission dialog component
-type PermissionDialogComponent interface {
- tea.Model
- tea.ViewModel
- // SetPermissions(permission permission.PermissionRequest) tea.Cmd
-}
-
-type permissionsMapping struct {
- Left key.Binding
- Right key.Binding
- EnterSpace key.Binding
- Allow key.Binding
- AllowSession key.Binding
- Deny key.Binding
- Tab key.Binding
-}
-
-var permissionsKeys = permissionsMapping{
- Left: key.NewBinding(
- key.WithKeys("left"),
- key.WithHelp("←", "switch options"),
- ),
- Right: key.NewBinding(
- key.WithKeys("right"),
- key.WithHelp("→", "switch options"),
- ),
- EnterSpace: key.NewBinding(
- key.WithKeys("enter", " "),
- key.WithHelp("enter/space", "confirm"),
- ),
- Allow: key.NewBinding(
- key.WithKeys("a"),
- key.WithHelp("a", "allow"),
- ),
- AllowSession: key.NewBinding(
- key.WithKeys("s"),
- key.WithHelp("s", "allow for session"),
- ),
- Deny: key.NewBinding(
- key.WithKeys("d"),
- key.WithHelp("d", "deny"),
- ),
- Tab: key.NewBinding(
- key.WithKeys("tab"),
- key.WithHelp("tab", "switch options"),
- ),
-}
-
-// permissionDialogComponent is the implementation of PermissionDialog
-type permissionDialogComponent struct {
- width int
- height int
- // permission permission.PermissionRequest
- windowSize tea.WindowSizeMsg
- contentViewPort viewport.Model
- selectedOption int // 0: Allow, 1: Allow for session, 2: Deny
-
- diffCache map[string]string
- markdownCache map[string]string
-}
-
-func (p *permissionDialogComponent) Init() tea.Cmd {
- return p.contentViewPort.Init()
-}
-
-func (p *permissionDialogComponent) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
- var cmds []tea.Cmd
-
- switch msg := msg.(type) {
- case tea.WindowSizeMsg:
- p.windowSize = msg
- cmd := p.SetSize()
- cmds = append(cmds, cmd)
- p.markdownCache = make(map[string]string)
- p.diffCache = make(map[string]string)
- // case tea.KeyMsg:
- // switch {
- // case key.Matches(msg, permissionsKeys.Right) || key.Matches(msg, permissionsKeys.Tab):
- // p.selectedOption = (p.selectedOption + 1) % 3
- // return p, nil
- // case key.Matches(msg, permissionsKeys.Left):
- // p.selectedOption = (p.selectedOption + 2) % 3
- // case key.Matches(msg, permissionsKeys.EnterSpace):
- // return p, p.selectCurrentOption()
- // case key.Matches(msg, permissionsKeys.Allow):
- // return p, util.CmdHandler(PermissionResponseMsg{Action: PermissionAllow, Permission: p.permission})
- // case key.Matches(msg, permissionsKeys.AllowSession):
- // return p, util.CmdHandler(PermissionResponseMsg{Action: PermissionAllowForSession, Permission: p.permission})
- // case key.Matches(msg, permissionsKeys.Deny):
- // return p, util.CmdHandler(PermissionResponseMsg{Action: PermissionDeny, Permission: p.permission})
- // default:
- // // Pass other keys to viewport
- // viewPort, cmd := p.contentViewPort.Update(msg)
- // p.contentViewPort = viewPort
- // cmds = append(cmds, cmd)
- // }
- }
-
- return p, tea.Batch(cmds...)
-}
-
-func (p *permissionDialogComponent) selectCurrentOption() tea.Cmd {
- var action PermissionAction
-
- switch p.selectedOption {
- case 0:
- action = PermissionAllow
- case 1:
- action = PermissionAllowForSession
- case 2:
- action = PermissionDeny
- }
-
- return util.CmdHandler(PermissionResponseMsg{Action: action}) // , Permission: p.permission})
-}
-
-func (p *permissionDialogComponent) renderButtons() string {
- t := theme.CurrentTheme()
- baseStyle := styles.NewStyle().Foreground(t.Text())
-
- allowStyle := baseStyle
- allowSessionStyle := baseStyle
- denyStyle := baseStyle
- spacerStyle := baseStyle.Background(t.Background())
-
- // Style the selected button
- switch p.selectedOption {
- case 0:
- allowStyle = allowStyle.Background(t.Primary()).Foreground(t.Background())
- allowSessionStyle = allowSessionStyle.Background(t.Background()).Foreground(t.Primary())
- denyStyle = denyStyle.Background(t.Background()).Foreground(t.Primary())
- case 1:
- allowStyle = allowStyle.Background(t.Background()).Foreground(t.Primary())
- allowSessionStyle = allowSessionStyle.Background(t.Primary()).Foreground(t.Background())
- denyStyle = denyStyle.Background(t.Background()).Foreground(t.Primary())
- case 2:
- allowStyle = allowStyle.Background(t.Background()).Foreground(t.Primary())
- allowSessionStyle = allowSessionStyle.Background(t.Background()).Foreground(t.Primary())
- denyStyle = denyStyle.Background(t.Primary()).Foreground(t.Background())
- }
-
- allowButton := allowStyle.Padding(0, 1).Render("Allow (a)")
- allowSessionButton := allowSessionStyle.Padding(0, 1).Render("Allow for session (s)")
- denyButton := denyStyle.Padding(0, 1).Render("Deny (d)")
-
- content := lipgloss.JoinHorizontal(
- lipgloss.Left,
- allowButton,
- spacerStyle.Render(" "),
- allowSessionButton,
- spacerStyle.Render(" "),
- denyButton,
- spacerStyle.Render(" "),
- )
-
- remainingWidth := p.width - lipgloss.Width(content)
- if remainingWidth > 0 {
- content = spacerStyle.Render(strings.Repeat(" ", remainingWidth)) + content
- }
- return content
-}
-
-func (p *permissionDialogComponent) renderHeader() string {
- return "NOT IMPLEMENTED"
- // t := theme.CurrentTheme()
- // baseStyle := styles.BaseStyle()
- //
- // toolKey := baseStyle.Foreground(t.TextMuted()).Bold(true).Render("Tool")
- // toolValue := baseStyle.
- // Foreground(t.Text()).
- // Width(p.width - lipgloss.Width(toolKey)).
- // Render(fmt.Sprintf(": %s", p.permission.ToolName))
- //
- // pathKey := baseStyle.Foreground(t.TextMuted()).Bold(true).Render("Path")
- //
- // // Get the current working directory to display relative path
- // relativePath := p.permission.Path
- // if filepath.IsAbs(relativePath) {
- // if cwd, err := filepath.Rel(config.WorkingDirectory(), relativePath); err == nil {
- // relativePath = cwd
- // }
- // }
- //
- // pathValue := baseStyle.
- // Foreground(t.Text()).
- // Width(p.width - lipgloss.Width(pathKey)).
- // Render(fmt.Sprintf(": %s", relativePath))
- //
- // headerParts := []string{
- // lipgloss.JoinHorizontal(
- // lipgloss.Left,
- // toolKey,
- // toolValue,
- // ),
- // baseStyle.Render(strings.Repeat(" ", p.width)),
- // lipgloss.JoinHorizontal(
- // lipgloss.Left,
- // pathKey,
- // pathValue,
- // ),
- // baseStyle.Render(strings.Repeat(" ", p.width)),
- // }
- //
- // // Add tool-specific header information
- // switch p.permission.ToolName {
- // case "bash":
- // headerParts = append(headerParts, baseStyle.Foreground(t.TextMuted()).Width(p.width).Bold(true).Render("Command"))
- // case "edit":
- // headerParts = append(headerParts, baseStyle.Foreground(t.TextMuted()).Width(p.width).Bold(true).Render("Diff"))
- // case "write":
- // headerParts = append(headerParts, baseStyle.Foreground(t.TextMuted()).Width(p.width).Bold(true).Render("Diff"))
- // case "fetch":
- // headerParts = append(headerParts, baseStyle.Foreground(t.TextMuted()).Width(p.width).Bold(true).Render("URL"))
- // }
- //
- // return lipgloss.NewStyle().Background(t.Background()).Render(lipgloss.JoinVertical(lipgloss.Left, headerParts...))
-}
-
-func (p *permissionDialogComponent) renderBashContent() string {
- // t := theme.CurrentTheme()
- // baseStyle := styles.BaseStyle()
- //
- // if pr, ok := p.permission.Params.(tools.BashPermissionsParams); ok {
- // content := fmt.Sprintf("```bash\n%s\n```", pr.Command)
- //
- // // Use the cache for markdown rendering
- // renderedContent := p.GetOrSetMarkdown(p.permission.ID, func() (string, error) {
- // r := styles.GetMarkdownRenderer(p.width - 10)
- // s, err := r.Render(content)
- // return s
- // })
- //
- // finalContent := baseStyle.
- // Width(p.contentViewPort.Width).
- // Render(renderedContent)
- // p.contentViewPort.SetContent(finalContent)
- // return p.styleViewport()
- // }
- return ""
-}
-
-func (p *permissionDialogComponent) renderEditContent() string {
- // if pr, ok := p.permission.Params.(tools.EditPermissionsParams); ok {
- // diff := p.GetOrSetDiff(p.permission.ID, func() (string, error) {
- // return diff.FormatDiff(pr.Diff, diff.WithTotalWidth(p.contentViewPort.Width))
- // })
- //
- // p.contentViewPort.SetContent(diff)
- // return p.styleViewport()
- // }
- return ""
-}
-
-func (p *permissionDialogComponent) renderPatchContent() string {
- // if pr, ok := p.permission.Params.(tools.EditPermissionsParams); ok {
- // diff := p.GetOrSetDiff(p.permission.ID, func() (string, error) {
- // return diff.FormatDiff(pr.Diff, diff.WithTotalWidth(p.contentViewPort.Width))
- // })
- //
- // p.contentViewPort.SetContent(diff)
- // return p.styleViewport()
- // }
- return ""
-}
-
-func (p *permissionDialogComponent) renderWriteContent() string {
- // if pr, ok := p.permission.Params.(tools.WritePermissionsParams); ok {
- // // Use the cache for diff rendering
- // diff := p.GetOrSetDiff(p.permission.ID, func() (string, error) {
- // return diff.FormatDiff(pr.Diff, diff.WithTotalWidth(p.contentViewPort.Width))
- // })
- //
- // p.contentViewPort.SetContent(diff)
- // return p.styleViewport()
- // }
- return ""
-}
-
-func (p *permissionDialogComponent) renderFetchContent() string {
- // t := theme.CurrentTheme()
- // baseStyle := styles.BaseStyle()
- //
- // if pr, ok := p.permission.Params.(tools.FetchPermissionsParams); ok {
- // content := fmt.Sprintf("```bash\n%s\n```", pr.URL)
- //
- // // Use the cache for markdown rendering
- // renderedContent := p.GetOrSetMarkdown(p.permission.ID, func() (string, error) {
- // r := styles.GetMarkdownRenderer(p.width - 10)
- // s, err := r.Render(content)
- // return s
- // })
- //
- // finalContent := baseStyle.
- // Width(p.contentViewPort.Width).
- // Render(renderedContent)
- // p.contentViewPort.SetContent(finalContent)
- // return p.styleViewport()
- // }
- return ""
-}
-
-func (p *permissionDialogComponent) renderDefaultContent() string {
- // t := theme.CurrentTheme()
- // baseStyle := styles.BaseStyle()
- //
- // content := p.permission.Description
- //
- // // Use the cache for markdown rendering
- // renderedContent := p.GetOrSetMarkdown(p.permission.ID, func() (string, error) {
- // r := styles.GetMarkdownRenderer(p.width - 10)
- // s, err := r.Render(content)
- // return s
- // })
- //
- // finalContent := baseStyle.
- // Width(p.contentViewPort.Width).
- // Render(renderedContent)
- // p.contentViewPort.SetContent(finalContent)
- //
- // if renderedContent == "" {
- // return ""
- // }
- //
- return p.styleViewport()
-}
-
-func (p *permissionDialogComponent) styleViewport() string {
- t := theme.CurrentTheme()
- contentStyle := styles.NewStyle().Background(t.Background())
-
- return contentStyle.Render(p.contentViewPort.View())
-}
-
-func (p *permissionDialogComponent) render() string {
- return "NOT IMPLEMENTED"
- // t := theme.CurrentTheme()
- // baseStyle := styles.BaseStyle()
- //
- // title := baseStyle.
- // Bold(true).
- // Width(p.width - 4).
- // Foreground(t.Primary()).
- // Render("Permission Required")
- // // Render header
- // headerContent := p.renderHeader()
- // // Render buttons
- // buttons := p.renderButtons()
- //
- // // Calculate content height dynamically based on window size
- // p.contentViewPort.Height = p.height - lipgloss.Height(headerContent) - lipgloss.Height(buttons) - 2 - lipgloss.Height(title)
- // p.contentViewPort.Width = p.width - 4
- //
- // // Render content based on tool type
- // var contentFinal string
- // switch p.permission.ToolName {
- // case "bash":
- // contentFinal = p.renderBashContent()
- // case "edit":
- // contentFinal = p.renderEditContent()
- // case "patch":
- // contentFinal = p.renderPatchContent()
- // case "write":
- // contentFinal = p.renderWriteContent()
- // case "fetch":
- // contentFinal = p.renderFetchContent()
- // default:
- // contentFinal = p.renderDefaultContent()
- // }
- //
- // content := lipgloss.JoinVertical(
- // lipgloss.Top,
- // title,
- // baseStyle.Render(strings.Repeat(" ", lipgloss.Width(title))),
- // headerContent,
- // contentFinal,
- // buttons,
- // baseStyle.Render(strings.Repeat(" ", p.width-4)),
- // )
- //
- // return baseStyle.
- // Padding(1, 0, 0, 1).
- // Border(lipgloss.RoundedBorder()).
- // BorderBackground(t.Background()).
- // BorderForeground(t.TextMuted()).
- // Width(p.width).
- // Height(p.height).
- // Render(
- // content,
- // )
-}
-
-func (p *permissionDialogComponent) View() string {
- return p.render()
-}
-
-func (p *permissionDialogComponent) SetSize() tea.Cmd {
- // if p.permission.ID == "" {
- // return nil
- // }
- // switch p.permission.ToolName {
- // case "bash":
- // p.width = int(float64(p.windowSize.Width) * 0.4)
- // p.height = int(float64(p.windowSize.Height) * 0.3)
- // case "edit":
- // p.width = int(float64(p.windowSize.Width) * 0.8)
- // p.height = int(float64(p.windowSize.Height) * 0.8)
- // case "write":
- // p.width = int(float64(p.windowSize.Width) * 0.8)
- // p.height = int(float64(p.windowSize.Height) * 0.8)
- // case "fetch":
- // p.width = int(float64(p.windowSize.Width) * 0.4)
- // p.height = int(float64(p.windowSize.Height) * 0.3)
- // default:
- // p.width = int(float64(p.windowSize.Width) * 0.7)
- // p.height = int(float64(p.windowSize.Height) * 0.5)
- // }
- return nil
-}
-
-// func (p *permissionDialogCmp) SetPermissions(permission permission.PermissionRequest) tea.Cmd {
-// p.permission = permission
-// return p.SetSize()
-// }
-
-// Helper to get or set cached diff content
-func (c *permissionDialogComponent) GetOrSetDiff(key string, generator func() (string, error)) string {
- if cached, ok := c.diffCache[key]; ok {
- return cached
- }
-
- content, err := generator()
- if err != nil {
- return fmt.Sprintf("Error formatting diff: %v", err)
- }
-
- c.diffCache[key] = content
-
- return content
-}
-
-// Helper to get or set cached markdown content
-func (c *permissionDialogComponent) GetOrSetMarkdown(key string, generator func() (string, error)) string {
- if cached, ok := c.markdownCache[key]; ok {
- return cached
- }
-
- content, err := generator()
- if err != nil {
- return fmt.Sprintf("Error rendering markdown: %v", err)
- }
-
- c.markdownCache[key] = content
-
- return content
-}
-
-func NewPermissionDialogCmp() PermissionDialogComponent {
- // Create viewport for content
- contentViewport := viewport.New() // (0, 0)
-
- return &permissionDialogComponent{
- contentViewPort: contentViewport,
- selectedOption: 0, // Default to "Allow"
- diffCache: make(map[string]string),
- markdownCache: make(map[string]string),
- }
-}
diff --git a/packages/tui/internal/components/dialog/search.go b/packages/tui/internal/components/dialog/search.go
new file mode 100644
index 0000000000..cdb2b824ea
--- /dev/null
+++ b/packages/tui/internal/components/dialog/search.go
@@ -0,0 +1,247 @@
+package dialog
+
+import (
+ "github.com/charmbracelet/bubbles/v2/key"
+ "github.com/charmbracelet/bubbles/v2/textinput"
+ tea "github.com/charmbracelet/bubbletea/v2"
+ "github.com/charmbracelet/lipgloss/v2"
+ "github.com/sst/opencode/internal/components/list"
+ "github.com/sst/opencode/internal/styles"
+ "github.com/sst/opencode/internal/theme"
+)
+
+// SearchQueryChangedMsg is emitted when the search query changes
+type SearchQueryChangedMsg struct {
+ Query string
+}
+
+// SearchSelectionMsg is emitted when an item is selected
+type SearchSelectionMsg struct {
+ Item any
+ Index int
+}
+
+// SearchCancelledMsg is emitted when the search is cancelled
+type SearchCancelledMsg struct{}
+
+// SearchRemoveItemMsg is emitted when Ctrl+X is pressed to remove an item
+type SearchRemoveItemMsg struct {
+ Item any
+ Index int
+}
+
+// SearchDialog is a reusable component that combines a text input with a list
+type SearchDialog struct {
+ textInput textinput.Model
+ list list.List[list.Item]
+ width int
+ height int
+ focused bool
+}
+
+type searchKeyMap struct {
+ Up key.Binding
+ Down key.Binding
+ Enter key.Binding
+ Escape key.Binding
+ Remove key.Binding
+}
+
+var searchKeys = searchKeyMap{
+ Up: key.NewBinding(
+ key.WithKeys("up", "ctrl+p"),
+ key.WithHelp("↑", "previous item"),
+ ),
+ Down: key.NewBinding(
+ key.WithKeys("down", "ctrl+n"),
+ key.WithHelp("↓", "next item"),
+ ),
+ Enter: key.NewBinding(
+ key.WithKeys("enter"),
+ key.WithHelp("enter", "select"),
+ ),
+ Escape: key.NewBinding(
+ key.WithKeys("esc"),
+ key.WithHelp("esc", "cancel"),
+ ),
+ Remove: key.NewBinding(
+ key.WithKeys("ctrl+x"),
+ key.WithHelp("ctrl+x", "remove from recent"),
+ ),
+}
+
+// NewSearchDialog creates a new SearchDialog
+func NewSearchDialog(placeholder string, maxVisibleHeight int) *SearchDialog {
+ t := theme.CurrentTheme()
+ bgColor := t.BackgroundElement()
+ textColor := t.Text()
+ textMutedColor := t.TextMuted()
+
+ ti := textinput.New()
+ ti.Placeholder = placeholder
+ ti.Styles.Blurred.Placeholder = styles.NewStyle().
+ Foreground(textMutedColor).
+ Background(bgColor).
+ Lipgloss()
+ ti.Styles.Blurred.Text = styles.NewStyle().
+ Foreground(textColor).
+ Background(bgColor).
+ Lipgloss()
+ ti.Styles.Focused.Placeholder = styles.NewStyle().
+ Foreground(textMutedColor).
+ Background(bgColor).
+ Lipgloss()
+ ti.Styles.Focused.Text = styles.NewStyle().
+ Foreground(textColor).
+ Background(bgColor).
+ Lipgloss()
+ ti.Styles.Focused.Prompt = styles.NewStyle().
+ Background(bgColor).
+ Lipgloss()
+ ti.Styles.Cursor.Color = t.Primary()
+ ti.VirtualCursor = true
+
+ ti.Prompt = " "
+ ti.CharLimit = -1
+ ti.Focus()
+
+ emptyList := list.NewListComponent(
+ list.WithItems([]list.Item{}),
+ list.WithMaxVisibleHeight[list.Item](maxVisibleHeight),
+ list.WithFallbackMessage[list.Item](" No items"),
+ list.WithAlphaNumericKeys[list.Item](false),
+ list.WithRenderFunc(
+ func(item list.Item, selected bool, width int, baseStyle styles.Style) string {
+ return item.Render(selected, width, baseStyle)
+ },
+ ),
+ list.WithSelectableFunc(func(item list.Item) bool {
+ return item.Selectable()
+ }),
+ )
+
+ return &SearchDialog{
+ textInput: ti,
+ list: emptyList,
+ focused: true,
+ }
+}
+
+func (s *SearchDialog) Init() tea.Cmd {
+ return textinput.Blink
+}
+
+func (s *SearchDialog) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
+ var cmds []tea.Cmd
+
+ switch msg := msg.(type) {
+ case tea.KeyMsg:
+ switch msg.String() {
+ case "ctrl+c":
+ value := s.textInput.Value()
+ if value == "" {
+ return s, nil
+ }
+ s.textInput.Reset()
+ cmds = append(cmds, func() tea.Msg {
+ return SearchQueryChangedMsg{Query: ""}
+ })
+ }
+
+ switch {
+ case key.Matches(msg, searchKeys.Escape):
+ return s, func() tea.Msg { return SearchCancelledMsg{} }
+
+ case key.Matches(msg, searchKeys.Enter):
+ if selectedItem, idx := s.list.GetSelectedItem(); idx != -1 {
+ return s, func() tea.Msg {
+ return SearchSelectionMsg{Item: selectedItem, Index: idx}
+ }
+ }
+
+ case key.Matches(msg, searchKeys.Remove):
+ if selectedItem, idx := s.list.GetSelectedItem(); idx != -1 {
+ return s, func() tea.Msg {
+ return SearchRemoveItemMsg{Item: selectedItem, Index: idx}
+ }
+ }
+
+ case key.Matches(msg, searchKeys.Up):
+ var cmd tea.Cmd
+ listModel, cmd := s.list.Update(msg)
+ s.list = listModel.(list.List[list.Item])
+ if cmd != nil {
+ cmds = append(cmds, cmd)
+ }
+
+ case key.Matches(msg, searchKeys.Down):
+ var cmd tea.Cmd
+ listModel, cmd := s.list.Update(msg)
+ s.list = listModel.(list.List[list.Item])
+ if cmd != nil {
+ cmds = append(cmds, cmd)
+ }
+
+ default:
+ oldValue := s.textInput.Value()
+ var cmd tea.Cmd
+ s.textInput, cmd = s.textInput.Update(msg)
+ if cmd != nil {
+ cmds = append(cmds, cmd)
+ }
+ if newValue := s.textInput.Value(); newValue != oldValue {
+ cmds = append(cmds, func() tea.Msg {
+ return SearchQueryChangedMsg{Query: newValue}
+ })
+ }
+ }
+ }
+
+ return s, tea.Batch(cmds...)
+}
+
+func (s *SearchDialog) View() string {
+ s.list.SetMaxWidth(s.width)
+ listView := s.list.View()
+ listView = lipgloss.PlaceVertical(s.list.GetMaxVisibleHeight(), lipgloss.Top, listView)
+ textinput := s.textInput.View()
+ return textinput + "\n\n" + listView
+}
+
+// SetWidth sets the width of the search dialog
+func (s *SearchDialog) SetWidth(width int) {
+ s.width = width
+ s.textInput.SetWidth(width - 2) // Account for padding and borders
+}
+
+// SetHeight sets the height of the search dialog
+func (s *SearchDialog) SetHeight(height int) {
+ s.height = height
+}
+
+// SetItems updates the list items
+func (s *SearchDialog) SetItems(items []list.Item) {
+ s.list.SetItems(items)
+}
+
+// GetQuery returns the current search query
+func (s *SearchDialog) GetQuery() string {
+ return s.textInput.Value()
+}
+
+// SetQuery sets the search query
+func (s *SearchDialog) SetQuery(query string) {
+ s.textInput.SetValue(query)
+}
+
+// Focus focuses the search dialog
+func (s *SearchDialog) Focus() {
+ s.focused = true
+ s.textInput.Focus()
+}
+
+// Blur removes focus from the search dialog
+func (s *SearchDialog) Blur() {
+ s.focused = false
+ s.textInput.Blur()
+}
diff --git a/packages/tui/internal/components/dialog/session.go b/packages/tui/internal/components/dialog/session.go
index 6f18dba0eb..307897bc5c 100644
--- a/packages/tui/internal/components/dialog/session.go
+++ b/packages/tui/internal/components/dialog/session.go
@@ -28,17 +28,26 @@ type SessionDialog interface {
type sessionItem struct {
title string
isDeleteConfirming bool
+ isCurrentSession bool
}
-func (s sessionItem) Render(selected bool, width int) string {
+func (s sessionItem) Render(
+ selected bool,
+ width int,
+ isFirstInViewport bool,
+ baseStyle styles.Style,
+) string {
t := theme.CurrentTheme()
- baseStyle := styles.NewStyle()
var text string
if s.isDeleteConfirming {
text = "Press again to confirm delete"
} else {
- text = s.title
+ if s.isCurrentSession {
+ text = "● " + s.title
+ } else {
+ text = s.title
+ }
}
truncatedStr := truncate.StringWithTail(text, uint(width-1), "...")
@@ -52,6 +61,14 @@ func (s sessionItem) Render(selected bool, width int) string {
Foreground(t.BackgroundElement()).
Width(width).
PaddingLeft(1)
+ } else if s.isCurrentSession {
+ // Different style for current session when selected
+ itemStyle = baseStyle.
+ Background(t.Primary()).
+ Foreground(t.BackgroundElement()).
+ Width(width).
+ PaddingLeft(1).
+ Bold(true)
} else {
// Normal selection
itemStyle = baseStyle.
@@ -66,6 +83,12 @@ func (s sessionItem) Render(selected bool, width int) string {
itemStyle = baseStyle.
Foreground(t.Error()).
PaddingLeft(1)
+ } else if s.isCurrentSession {
+ // Highlight current session when not selected
+ itemStyle = baseStyle.
+ Foreground(t.Primary()).
+ PaddingLeft(1).
+ Bold(true)
} else {
itemStyle = baseStyle.
PaddingLeft(1)
@@ -75,6 +98,10 @@ func (s sessionItem) Render(selected bool, width int) string {
return itemStyle.Render(truncatedStr)
}
+func (s sessionItem) Selectable() bool {
+ return true
+}
+
type sessionDialog struct {
width int
height int
@@ -110,6 +137,13 @@ func (s *sessionDialog) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
util.CmdHandler(app.SessionSelectedMsg(&selectedSession)),
)
}
+ case "n":
+ s.app.Session = &opencode.Session{}
+ s.app.Messages = []app.Message{}
+ return s, tea.Sequence(
+ util.CmdHandler(modal.CloseModalMsg{}),
+ util.CmdHandler(app.SessionClearedMsg{}),
+ )
case "x", "delete", "backspace":
if _, idx := s.list.GetSelectedItem(); idx >= 0 && idx < len(s.sessions) {
if s.deleteConfirmation == idx {
@@ -150,10 +184,21 @@ func (s *sessionDialog) Render(background string) string {
listView := s.list.View()
t := theme.CurrentTheme()
- helpStyle := styles.NewStyle().PaddingLeft(1).PaddingTop(1)
- helpText := styles.NewStyle().Foreground(t.Text()).Render("x/del")
- helpText = helpText + styles.NewStyle().Background(t.BackgroundElement()).Foreground(t.TextMuted()).Render(" delete session")
- helpText = helpStyle.Render(helpText)
+ keyStyle := styles.NewStyle().Foreground(t.Text()).Background(t.BackgroundPanel()).Render
+ mutedStyle := styles.NewStyle().Foreground(t.TextMuted()).Background(t.BackgroundPanel()).Render
+
+ leftHelp := keyStyle("n") + mutedStyle(" new session")
+ rightHelp := keyStyle("x/del") + mutedStyle(" delete session")
+
+ bgColor := t.BackgroundPanel()
+ helpText := layout.Render(layout.FlexOptions{
+ Direction: layout.Row,
+ Justify: layout.JustifySpaceBetween,
+ Width: layout.Current.Container.Width - 14,
+ Background: &bgColor,
+ }, layout.FlexItem{View: leftHelp}, layout.FlexItem{View: rightHelp})
+
+ helpText = styles.NewStyle().PaddingLeft(1).PaddingTop(1).Render(helpText)
content := strings.Join([]string{listView, helpText}, "\n")
@@ -168,6 +213,7 @@ func (s *sessionDialog) updateListItems() {
item := sessionItem{
title: sess.Title,
isDeleteConfirming: s.deleteConfirmation == i,
+ isCurrentSession: s.app.Session != nil && s.app.Session.ID == sess.ID,
}
items = append(items, item)
}
@@ -203,15 +249,23 @@ func NewSessionDialog(app *app.App) SessionDialog {
items = append(items, sessionItem{
title: sess.Title,
isDeleteConfirming: false,
+ isCurrentSession: app.Session != nil && app.Session.ID == sess.ID,
})
}
- // Create a generic list component
listComponent := list.NewListComponent(
- items,
- 10, // maxVisibleSessions
- "No sessions available",
- true, // useAlphaNumericKeys
+ list.WithItems(items),
+ list.WithMaxVisibleHeight[sessionItem](10),
+ list.WithFallbackMessage[sessionItem]("No sessions available"),
+ list.WithAlphaNumericKeys[sessionItem](true),
+ list.WithRenderFunc(
+ func(item sessionItem, selected bool, width int, baseStyle styles.Style) string {
+ return item.Render(selected, width, false, baseStyle)
+ },
+ ),
+ list.WithSelectableFunc(func(item sessionItem) bool {
+ return true
+ }),
)
listComponent.SetMaxWidth(layout.Current.Container.Width - 12)
diff --git a/packages/tui/internal/components/dialog/theme.go b/packages/tui/internal/components/dialog/theme.go
index b6e970617b..c71cddc8e2 100644
--- a/packages/tui/internal/components/dialog/theme.go
+++ b/packages/tui/internal/components/dialog/theme.go
@@ -5,6 +5,7 @@ import (
list "github.com/sst/opencode/internal/components/list"
"github.com/sst/opencode/internal/components/modal"
"github.com/sst/opencode/internal/layout"
+ "github.com/sst/opencode/internal/styles"
"github.com/sst/opencode/internal/theme"
"github.com/sst/opencode/internal/util"
)
@@ -24,7 +25,7 @@ type themeDialog struct {
height int
modal *modal.Modal
- list list.List[list.StringItem]
+ list list.List[list.Item]
originalTheme string
themeApplied bool
}
@@ -42,16 +43,18 @@ func (t *themeDialog) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
switch msg.String() {
case "enter":
if item, idx := t.list.GetSelectedItem(); idx >= 0 {
- selectedTheme := string(item)
- if err := theme.SetTheme(selectedTheme); err != nil {
- // status.Error(err.Error())
- return t, nil
+ if stringItem, ok := item.(list.StringItem); ok {
+ selectedTheme := string(stringItem)
+ if err := theme.SetTheme(selectedTheme); err != nil {
+ // status.Error(err.Error())
+ return t, nil
+ }
+ t.themeApplied = true
+ return t, tea.Sequence(
+ util.CmdHandler(modal.CloseModalMsg{}),
+ util.CmdHandler(ThemeSelectedMsg{ThemeName: selectedTheme}),
+ )
}
- t.themeApplied = true
- return t, tea.Sequence(
- util.CmdHandler(modal.CloseModalMsg{}),
- util.CmdHandler(ThemeSelectedMsg{ThemeName: selectedTheme}),
- )
}
}
@@ -61,11 +64,13 @@ func (t *themeDialog) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
var cmd tea.Cmd
listModel, cmd := t.list.Update(msg)
- t.list = listModel.(list.List[list.StringItem])
+ t.list = listModel.(list.List[list.Item])
if item, newIdx := t.list.GetSelectedItem(); newIdx >= 0 && newIdx != prevIdx {
- theme.SetTheme(string(item))
- return t, util.CmdHandler(ThemeSelectedMsg{ThemeName: string(item)})
+ if stringItem, ok := item.(list.StringItem); ok {
+ theme.SetTheme(string(stringItem))
+ return t, util.CmdHandler(ThemeSelectedMsg{ThemeName: string(stringItem)})
+ }
}
return t, cmd
}
@@ -94,21 +99,32 @@ func NewThemeDialog() ThemeDialog {
}
}
- list := list.NewStringList(
- themes,
- 10, // maxVisibleThemes
- "No themes available",
- true,
+ // Convert themes to list items
+ items := make([]list.Item, len(themes))
+ for i, theme := range themes {
+ items[i] = list.StringItem(theme)
+ }
+
+ listComponent := list.NewListComponent(
+ list.WithItems(items),
+ list.WithMaxVisibleHeight[list.Item](10),
+ list.WithFallbackMessage[list.Item]("No themes available"),
+ list.WithAlphaNumericKeys[list.Item](true),
+ list.WithRenderFunc(func(item list.Item, selected bool, width int, baseStyle styles.Style) string {
+ return item.Render(selected, width, baseStyle)
+ }),
+ list.WithSelectableFunc(func(item list.Item) bool {
+ return item.Selectable()
+ }),
)
// Set the initial selection to the current theme
- list.SetSelectedIndex(selectedIdx)
+ listComponent.SetSelectedIndex(selectedIdx)
// Set the max width for the list to match the modal width
- list.SetMaxWidth(36) // 40 (modal max width) - 4 (modal padding)
-
+ listComponent.SetMaxWidth(36) // 40 (modal max width) - 4 (modal padding)
return &themeDialog{
- list: list,
+ list: listComponent,
modal: modal.New(modal.WithTitle("Select Theme"), modal.WithMaxWidth(40)),
originalTheme: currentTheme,
themeApplied: false,
diff --git a/packages/tui/internal/components/diff/diff.go b/packages/tui/internal/components/diff/diff.go
index 03f58cc26f..da2e007c25 100644
--- a/packages/tui/internal/components/diff/diff.go
+++ b/packages/tui/internal/components/diff/diff.go
@@ -38,6 +38,10 @@ const (
LineRemoved // Line removed from the old file
)
+var (
+ ansiRegex = regexp.MustCompile(`\x1b(?:[@-Z\\-_]|\[[0-9?]*(?:;[0-9?]*)*[@-~])`)
+)
+
// Segment represents a portion of a line for intra-line highlighting
type Segment struct {
Start int
@@ -548,7 +552,6 @@ func createStyles(t theme.Theme) (removedLineStyle, addedLineStyle, contextLineS
// applyHighlighting applies intra-line highlighting to a piece of text
func applyHighlighting(content string, segments []Segment, segmentType LineType, highlightBg compat.AdaptiveColor) 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
diff --git a/packages/tui/internal/components/list/list.go b/packages/tui/internal/components/list/list.go
index 16bc73ca52..fd2d7d93fe 100644
--- a/packages/tui/internal/components/list/list.go
+++ b/packages/tui/internal/components/list/list.go
@@ -5,16 +5,88 @@ import (
"github.com/charmbracelet/bubbles/v2/key"
tea "github.com/charmbracelet/bubbletea/v2"
+ "github.com/charmbracelet/lipgloss/v2"
"github.com/muesli/reflow/truncate"
"github.com/sst/opencode/internal/styles"
"github.com/sst/opencode/internal/theme"
)
-type ListItem interface {
- Render(selected bool, width int) string
+// Item interface that all list items must implement
+type Item interface {
+ Render(selected bool, width int, baseStyle styles.Style) string
+ Selectable() bool
}
-type List[T ListItem] interface {
+// RenderFunc defines how to render an item in the list
+type RenderFunc[T any] func(item T, selected bool, width int, baseStyle styles.Style) string
+
+// SelectableFunc defines whether an item is selectable
+type SelectableFunc[T any] func(item T) bool
+
+// Options holds configuration for the list component
+type Options[T any] struct {
+ items []T
+ maxVisibleHeight int
+ fallbackMsg string
+ useAlphaNumericKeys bool
+ renderItem RenderFunc[T]
+ isSelectable SelectableFunc[T]
+ baseStyle styles.Style
+}
+
+// Option is a function that configures the list component
+type Option[T any] func(*Options[T])
+
+// WithItems sets the initial items for the list
+func WithItems[T any](items []T) Option[T] {
+ return func(o *Options[T]) {
+ o.items = items
+ }
+}
+
+// WithMaxVisibleHeight sets the maximum visible height in lines
+func WithMaxVisibleHeight[T any](height int) Option[T] {
+ return func(o *Options[T]) {
+ o.maxVisibleHeight = height
+ }
+}
+
+// WithFallbackMessage sets the message to show when the list is empty
+func WithFallbackMessage[T any](msg string) Option[T] {
+ return func(o *Options[T]) {
+ o.fallbackMsg = msg
+ }
+}
+
+// WithAlphaNumericKeys enables j/k navigation keys
+func WithAlphaNumericKeys[T any](enabled bool) Option[T] {
+ return func(o *Options[T]) {
+ o.useAlphaNumericKeys = enabled
+ }
+}
+
+// WithRenderFunc sets the function to render items
+func WithRenderFunc[T any](fn RenderFunc[T]) Option[T] {
+ return func(o *Options[T]) {
+ o.renderItem = fn
+ }
+}
+
+// WithSelectableFunc sets the function to determine if items are selectable
+func WithSelectableFunc[T any](fn SelectableFunc[T]) Option[T] {
+ return func(o *Options[T]) {
+ o.isSelectable = fn
+ }
+}
+
+// WithStyle sets the base style that gets passed to render functions
+func WithStyle[T any](style styles.Style) Option[T] {
+ return func(o *Options[T]) {
+ o.baseStyle = style
+ }
+}
+
+type List[T any] interface {
tea.Model
tea.ViewModel
SetMaxWidth(maxWidth int)
@@ -24,17 +96,21 @@ type List[T ListItem] interface {
SetSelectedIndex(idx int)
SetEmptyMessage(msg string)
IsEmpty() bool
+ GetMaxVisibleHeight() int
}
-type listComponent[T ListItem] struct {
+type listComponent[T any] struct {
fallbackMsg string
items []T
selectedIdx int
maxWidth int
- maxVisibleItems int
+ maxVisibleHeight int
useAlphaNumericKeys bool
width int
height int
+ renderItem RenderFunc[T]
+ isSelectable SelectableFunc[T]
+ baseStyle styles.Style
}
type listKeyMap struct {
@@ -46,11 +122,11 @@ type listKeyMap struct {
var simpleListKeys = listKeyMap{
Up: key.NewBinding(
- key.WithKeys("up"),
+ key.WithKeys("up", "ctrl+p"),
key.WithHelp("↑", "previous list item"),
),
Down: key.NewBinding(
- key.WithKeys("down"),
+ key.WithKeys("down", "ctrl+n"),
key.WithHelp("↓", "next list item"),
),
UpAlpha: key.NewBinding(
@@ -72,14 +148,10 @@ func (c *listComponent[T]) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
case tea.KeyMsg:
switch {
case key.Matches(msg, simpleListKeys.Up) || (c.useAlphaNumericKeys && key.Matches(msg, simpleListKeys.UpAlpha)):
- if c.selectedIdx > 0 {
- c.selectedIdx--
- }
+ c.moveUp()
return c, nil
case key.Matches(msg, simpleListKeys.Down) || (c.useAlphaNumericKeys && key.Matches(msg, simpleListKeys.DownAlpha)):
- if c.selectedIdx < len(c.items)-1 {
- c.selectedIdx++
- }
+ c.moveDown()
return c, nil
}
}
@@ -87,8 +159,50 @@ func (c *listComponent[T]) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
return c, nil
}
+// moveUp moves the selection up, skipping non-selectable items
+func (c *listComponent[T]) moveUp() {
+ if len(c.items) == 0 {
+ return
+ }
+
+ // Find the previous selectable item
+ for i := c.selectedIdx - 1; i >= 0; i-- {
+ if c.isSelectable(c.items[i]) {
+ c.selectedIdx = i
+ return
+ }
+ }
+
+ // If no selectable item found above, stay at current position
+}
+
+// moveDown moves the selection down, skipping non-selectable items
+func (c *listComponent[T]) moveDown() {
+ if len(c.items) == 0 {
+ return
+ }
+
+ originalIdx := c.selectedIdx
+ for {
+ if c.selectedIdx < len(c.items)-1 {
+ c.selectedIdx++
+ } else {
+ break
+ }
+
+ if c.isSelectable(c.items[c.selectedIdx]) {
+ return
+ }
+
+ // Prevent infinite loop
+ if c.selectedIdx == originalIdx {
+ break
+ }
+ }
+}
+
func (c *listComponent[T]) GetSelectedItem() (T, int) {
- if len(c.items) > 0 {
+ if len(c.items) > 0 && c.isSelectable(c.items[c.selectedIdx]) {
return c.items[c.selectedIdx], c.selectedIdx
}
@@ -97,8 +211,13 @@ func (c *listComponent[T]) GetSelectedItem() (T, int) {
}
func (c *listComponent[T]) SetItems(items []T) {
- c.selectedIdx = 0
c.items = items
+ c.selectedIdx = 0
+
+ // Ensure initial selection is on a selectable item
+ if len(items) > 0 && !c.isSelectable(items[0]) {
+ c.moveDown()
+ }
}
func (c *listComponent[T]) GetItems() []T {
@@ -123,62 +242,145 @@ func (c *listComponent[T]) SetSelectedIndex(idx int) {
}
}
+func (c *listComponent[T]) GetMaxVisibleHeight() int {
+ return c.maxVisibleHeight
+}
+
func (c *listComponent[T]) View() string {
items := c.items
maxWidth := c.maxWidth
if maxWidth == 0 {
maxWidth = 80 // Default width if not set
}
- maxVisibleItems := min(c.maxVisibleItems, len(items))
- startIdx := 0
if len(items) <= 0 {
return c.fallbackMsg
}
- if len(items) > maxVisibleItems {
- halfVisible := maxVisibleItems / 2
- if c.selectedIdx >= halfVisible && c.selectedIdx < len(items)-halfVisible {
- startIdx = c.selectedIdx - halfVisible
- } else if c.selectedIdx >= len(items)-halfVisible {
- startIdx = len(items) - maxVisibleItems
- }
- }
-
- endIdx := min(startIdx+maxVisibleItems, len(items))
+ // Calculate viewport based on actual heights
+ startIdx, endIdx := c.calculateViewport()
- listItems := make([]string, 0, maxVisibleItems)
+ listItems := make([]string, 0, endIdx-startIdx)
for i := startIdx; i < endIdx; i++ {
item := items[i]
- title := item.Render(i == c.selectedIdx, maxWidth)
+
+ // Special handling for HeaderItem to remove top margin on first item
+ if i == startIdx {
+ // Check if this is a HeaderItem
+ if _, ok := any(item).(Item); ok {
+ if headerItem, isHeader := any(item).(HeaderItem); isHeader {
+ // Render header without top margin when it's first
+ t := theme.CurrentTheme()
+ truncatedStr := truncate.StringWithTail(string(headerItem), uint(maxWidth-1), "...")
+ headerStyle := c.baseStyle.
+ Foreground(t.Accent()).
+ Bold(true).
+ MarginBottom(0).
+ PaddingLeft(1)
+ listItems = append(listItems, headerStyle.Render(truncatedStr))
+ continue
+ }
+ }
+ }
+
+ title := c.renderItem(item, i == c.selectedIdx, maxWidth, c.baseStyle)
listItems = append(listItems, title)
}
return strings.Join(listItems, "\n")
}
-func NewListComponent[T ListItem](
- items []T,
- maxVisibleItems int,
- fallbackMsg string,
- useAlphaNumericKeys bool,
-) List[T] {
+// calculateViewport determines which items to show based on available space
+func (c *listComponent[T]) calculateViewport() (startIdx, endIdx int) {
+ items := c.items
+ if len(items) == 0 {
+ return 0, 0
+ }
+
+ // Calculate heights of all items
+ itemHeights := make([]int, len(items))
+ for i, item := range items {
+ rendered := c.renderItem(item, false, c.maxWidth, c.baseStyle)
+ itemHeights[i] = lipgloss.Height(rendered)
+ }
+
+ // Find the range of items that fit within maxVisibleHeight
+ // Start by trying to center the selected item
+ start := 0
+ end := len(items)
+
+ // Calculate height from start to selected
+ heightToSelected := 0
+ for i := 0; i <= c.selectedIdx && i < len(items); i++ {
+ heightToSelected += itemHeights[i]
+ }
+
+ // If selected item is beyond visible height, scroll to show it
+ if heightToSelected > c.maxVisibleHeight {
+ // Start from selected and work backwards to find start
+ currentHeight := itemHeights[c.selectedIdx]
+ start = c.selectedIdx
+
+ for i := c.selectedIdx - 1; i >= 0 && currentHeight+itemHeights[i] <= c.maxVisibleHeight; i-- {
+ currentHeight += itemHeights[i]
+ start = i
+ }
+ }
+
+ // Calculate end based on start
+ currentHeight := 0
+ for i := start; i < len(items); i++ {
+ if currentHeight+itemHeights[i] > c.maxVisibleHeight {
+ end = i
+ break
+ }
+ currentHeight += itemHeights[i]
+ }
+
+ return start, end
+}
+
+func abs(x int) int {
+ if x < 0 {
+ return -x
+ }
+ return x
+}
+
+func max(a, b int) int {
+ if a > b {
+ return a
+ }
+ return b
+}
+
+func NewListComponent[T any](opts ...Option[T]) List[T] {
+ options := &Options[T]{
+ baseStyle: styles.NewStyle(), // Default empty style
+ }
+
+ for _, opt := range opts {
+ opt(options)
+ }
+
return &listComponent[T]{
- fallbackMsg: fallbackMsg,
- items: items,
- maxVisibleItems: maxVisibleItems,
- useAlphaNumericKeys: useAlphaNumericKeys,
+ fallbackMsg: options.fallbackMsg,
+ items: options.items,
+ maxVisibleHeight: options.maxVisibleHeight,
+ useAlphaNumericKeys: options.useAlphaNumericKeys,
selectedIdx: 0,
+ renderItem: options.renderItem,
+ isSelectable: options.isSelectable,
+ baseStyle: options.baseStyle,
}
}
-// StringItem is a simple implementation of ListItem for string values
+// StringItem is a simple implementation of Item for string values
type StringItem string
-func (s StringItem) Render(selected bool, width int) string {
+func (s StringItem) Render(selected bool, width int, baseStyle styles.Style) string {
t := theme.CurrentTheme()
- baseStyle := styles.NewStyle()
truncatedStr := truncate.StringWithTail(string(s), uint(width-1), "...")
@@ -198,16 +400,32 @@ func (s StringItem) Render(selected bool, width int) string {
return itemStyle.Render(truncatedStr)
}
-// NewStringList creates a new list component with string items
-func NewStringList(
- items []string,
- maxVisibleItems int,
- fallbackMsg string,
- useAlphaNumericKeys bool,
-) List[StringItem] {
- stringItems := make([]StringItem, len(items))
- for i, item := range items {
- stringItems[i] = StringItem(item)
- }
- return NewListComponent(stringItems, maxVisibleItems, fallbackMsg, useAlphaNumericKeys)
+func (s StringItem) Selectable() bool {
+ return true
+}
+
+// HeaderItem is a non-selectable header item for grouping
+type HeaderItem string
+
+func (h HeaderItem) Render(selected bool, width int, baseStyle styles.Style) string {
+ t := theme.CurrentTheme()
+
+ truncatedStr := truncate.StringWithTail(string(h), uint(width-1), "...")
+
+ headerStyle := baseStyle.
+ Foreground(t.Accent()).
+ Bold(true).
+ MarginTop(1).
+ MarginBottom(0).
+ PaddingLeft(1)
+
+ return headerStyle.Render(truncatedStr)
}
+
+func (h HeaderItem) Selectable() bool {
+ return false
+}
+
+// Ensure StringItem and HeaderItem implement Item
+var _ Item = StringItem("")
+var _ Item = HeaderItem("")
diff --git a/packages/tui/internal/components/list/list_test.go b/packages/tui/internal/components/list/list_test.go
new file mode 100644
index 0000000000..4d954409a8
--- /dev/null
+++ b/packages/tui/internal/components/list/list_test.go
@@ -0,0 +1,219 @@
+package list
+
+import (
+ "testing"
+
+ tea "github.com/charmbracelet/bubbletea/v2"
+ "github.com/sst/opencode/internal/styles"
+)
+
+// testItem is a simple test implementation of ListItem
+type testItem struct {
+ value string
+}
+
+func (t testItem) Render(
+ selected bool,
+ width int,
+ isFirstInViewport bool,
+ baseStyle styles.Style,
+) string {
+ return t.value
+}
+
+func (t testItem) Selectable() bool {
+ return true
+}
+
+// createTestList creates a list with test items for testing
+func createTestList() *listComponent[testItem] {
+ items := []testItem{
+ {value: "item1"},
+ {value: "item2"},
+ {value: "item3"},
+ }
+ list := NewListComponent(
+ WithItems(items),
+ WithMaxVisibleItems[testItem](5),
+ WithFallbackMessage[testItem]("empty"),
+ WithAlphaNumericKeys[testItem](false),
+ WithRenderFunc(
+ func(item testItem, selected bool, width int, baseStyle styles.Style) string {
+ return item.Render(selected, width, false, baseStyle)
+ },
+ ),
+ WithSelectableFunc(func(item testItem) bool {
+ return item.Selectable()
+ }),
+ WithHeightFunc(func(item testItem, isFirstInViewport bool) int {
+ return 1
+ }),
+ )
+
+ return list.(*listComponent[testItem])
+}
+
+func TestArrowKeyNavigation(t *testing.T) {
+ list := createTestList()
+
+ // Test down arrow navigation
+ downKey := tea.KeyPressMsg{Code: tea.KeyDown}
+ updatedModel, _ := list.Update(downKey)
+ list = updatedModel.(*listComponent[testItem])
+ _, idx := list.GetSelectedItem()
+ if idx != 1 {
+ t.Errorf("Expected selected index 1 after down arrow, got %d", idx)
+ }
+
+ // Test up arrow navigation
+ upKey := tea.KeyPressMsg{Code: tea.KeyUp}
+ updatedModel, _ = list.Update(upKey)
+ list = updatedModel.(*listComponent[testItem])
+ _, idx = list.GetSelectedItem()
+ if idx != 0 {
+ t.Errorf("Expected selected index 0 after up arrow, got %d", idx)
+ }
+}
+
+func TestJKKeyNavigation(t *testing.T) {
+ items := []testItem{
+ {value: "item1"},
+ {value: "item2"},
+ {value: "item3"},
+ }
+ // Create list with alpha keys enabled
+ list := NewListComponent(
+ WithItems(items),
+ WithMaxVisibleItems[testItem](5),
+ WithFallbackMessage[testItem]("empty"),
+ WithAlphaNumericKeys[testItem](true),
+ WithRenderFunc(
+ func(item testItem, selected bool, width int, baseStyle styles.Style) string {
+ return item.Render(selected, width, false, baseStyle)
+ },
+ ),
+ WithSelectableFunc(func(item testItem) bool {
+ return item.Selectable()
+ }),
+ WithHeightFunc(func(item testItem, isFirstInViewport bool) int {
+ return 1
+ }),
+ )
+
+ // Test j key (down)
+ jKey := tea.KeyPressMsg{Code: 'j', Text: "j"}
+ updatedModel, _ := list.Update(jKey)
+ list = updatedModel.(*listComponent[testItem])
+ _, idx := list.GetSelectedItem()
+ if idx != 1 {
+ t.Errorf("Expected selected index 1 after 'j' key, got %d", idx)
+ }
+
+ // Test k key (up)
+ kKey := tea.KeyPressMsg{Code: 'k', Text: "k"}
+ updatedModel, _ = list.Update(kKey)
+ list = updatedModel.(*listComponent[testItem])
+ _, idx = list.GetSelectedItem()
+ if idx != 0 {
+ t.Errorf("Expected selected index 0 after 'k' key, got %d", idx)
+ }
+}
+
+func TestCtrlNavigation(t *testing.T) {
+ list := createTestList()
+
+ // Test Ctrl-N (down)
+ ctrlN := tea.KeyPressMsg{Code: 'n', Mod: tea.ModCtrl}
+ updatedModel, _ := list.Update(ctrlN)
+ list = updatedModel.(*listComponent[testItem])
+ _, idx := list.GetSelectedItem()
+ if idx != 1 {
+ t.Errorf("Expected selected index 1 after Ctrl-N, got %d", idx)
+ }
+
+ // Test Ctrl-P (up)
+ ctrlP := tea.KeyPressMsg{Code: 'p', Mod: tea.ModCtrl}
+ updatedModel, _ = list.Update(ctrlP)
+ list = updatedModel.(*listComponent[testItem])
+ _, idx = list.GetSelectedItem()
+ if idx != 0 {
+ t.Errorf("Expected selected index 0 after Ctrl-P, got %d", idx)
+ }
+}
+
+func TestNavigationBoundaries(t *testing.T) {
+ list := createTestList()
+
+ // Test up arrow at first item (should stay at 0)
+ upKey := tea.KeyPressMsg{Code: tea.KeyUp}
+ updatedModel, _ := list.Update(upKey)
+ list = updatedModel.(*listComponent[testItem])
+ _, idx := list.GetSelectedItem()
+ if idx != 0 {
+ t.Errorf("Expected to stay at index 0 when pressing up at first item, got %d", idx)
+ }
+
+ // Move to last item
+ downKey := tea.KeyPressMsg{Code: tea.KeyDown}
+ updatedModel, _ = list.Update(downKey)
+ list = updatedModel.(*listComponent[testItem])
+ updatedModel, _ = list.Update(downKey)
+ list = updatedModel.(*listComponent[testItem])
+ _, idx = list.GetSelectedItem()
+ if idx != 2 {
+ t.Errorf("Expected to be at index 2, got %d", idx)
+ }
+
+ // Test down arrow at last item (should stay at 2)
+ updatedModel, _ = list.Update(downKey)
+ list = updatedModel.(*listComponent[testItem])
+ _, idx = list.GetSelectedItem()
+ if idx != 2 {
+ t.Errorf("Expected to stay at index 2 when pressing down at last item, got %d", idx)
+ }
+}
+
+func TestEmptyList(t *testing.T) {
+ emptyList := NewListComponent(
+ WithItems([]testItem{}),
+ WithMaxVisibleItems[testItem](5),
+ WithFallbackMessage[testItem]("empty"),
+ WithAlphaNumericKeys[testItem](false),
+ WithRenderFunc(
+ func(item testItem, selected bool, width int, baseStyle styles.Style) string {
+ return item.Render(selected, width, false, baseStyle)
+ },
+ ),
+ WithSelectableFunc(func(item testItem) bool {
+ return item.Selectable()
+ }),
+ WithHeightFunc(func(item testItem, isFirstInViewport bool) int {
+ return 1
+ }),
+ )
+
+ // Test navigation on empty list (should not crash)
+ downKey := tea.KeyPressMsg{Code: tea.KeyDown}
+ upKey := tea.KeyPressMsg{Code: tea.KeyUp}
+ ctrlN := tea.KeyPressMsg{Code: 'n', Mod: tea.ModCtrl}
+ ctrlP := tea.KeyPressMsg{Code: 'p', Mod: tea.ModCtrl}
+
+ updatedModel, _ := emptyList.Update(downKey)
+ emptyList = updatedModel.(*listComponent[testItem])
+ updatedModel, _ = emptyList.Update(upKey)
+ emptyList = updatedModel.(*listComponent[testItem])
+ updatedModel, _ = emptyList.Update(ctrlN)
+ emptyList = updatedModel.(*listComponent[testItem])
+ updatedModel, _ = emptyList.Update(ctrlP)
+ emptyList = updatedModel.(*listComponent[testItem])
+
+ // Verify empty list behavior
+ _, idx := emptyList.GetSelectedItem()
+ if idx != -1 {
+ t.Errorf("Expected index -1 for empty list, got %d", idx)
+ }
+
+ if !emptyList.IsEmpty() {
+ t.Error("Expected IsEmpty() to return true for empty list")
+ }
+}
diff --git a/packages/tui/internal/components/modal/modal.go b/packages/tui/internal/components/modal/modal.go
index 5c2fbf8bb5..09989d8ece 100644
--- a/packages/tui/internal/components/modal/modal.go
+++ b/packages/tui/internal/components/modal/modal.go
@@ -95,7 +95,7 @@ func (m *Modal) Render(contentView string, background string) string {
var finalContent string
if m.title != "" {
titleStyle := baseStyle.
- Foreground(t.Primary()).
+ Foreground(t.Text()).
Bold(true).
Padding(0, 1)
@@ -140,6 +140,6 @@ func (m *Modal) Render(contentView string, background string) string {
modalView,
background,
layout.WithOverlayBorder(),
- layout.WithOverlayBorderColor(t.Primary()),
+ layout.WithOverlayBorderColor(t.BorderActive()),
)
}
diff --git a/packages/tui/internal/components/textarea/textarea.go b/packages/tui/internal/components/textarea/textarea.go
index 650d0e177a..cc073e27d8 100644
--- a/packages/tui/internal/components/textarea/textarea.go
+++ b/packages/tui/internal/components/textarea/textarea.go
@@ -218,11 +218,11 @@ func DefaultKeyMap() KeyMap {
key.WithHelp("left", "character backward"),
),
WordForward: key.NewBinding(
- key.WithKeys("alt+right", "alt+f"),
+ key.WithKeys("alt+right", "ctrl+right", "alt+f"),
key.WithHelp("alt+right", "word forward"),
),
WordBackward: key.NewBinding(
- key.WithKeys("alt+left", "alt+b"),
+ key.WithKeys("alt+left", "ctrl+left", "alt+b"),
key.WithHelp("alt+left", "word backward"),
),
LineNext: key.NewBinding(
diff --git a/packages/tui/internal/config/config.go b/packages/tui/internal/config/config.go
index 7004b85b1e..d20376dd82 100644
--- a/packages/tui/internal/config/config.go
+++ b/packages/tui/internal/config/config.go
@@ -69,6 +69,15 @@ func (s *State) UpdateModelUsage(providerID, modelID string) {
}
}
+func (s *State) RemoveModelFromRecentlyUsed(providerID, modelID string) {
+ for i, usage := range s.RecentlyUsedModels {
+ if usage.ProviderID == providerID && usage.ModelID == modelID {
+ s.RecentlyUsedModels = append(s.RecentlyUsedModels[:i], s.RecentlyUsedModels[i+1:]...)
+ return
+ }
+ }
+}
+
// SaveState writes the provided Config struct to the specified TOML file.
// It will create the file if it doesn't exist, or overwrite it if it does.
func SaveState(filePath string, state *State) error {
diff --git a/packages/tui/internal/id/id.go b/packages/tui/internal/id/id.go
new file mode 100644
index 0000000000..0490b8f203
--- /dev/null
+++ b/packages/tui/internal/id/id.go
@@ -0,0 +1,96 @@
+package id
+
+import (
+ "crypto/rand"
+ "encoding/hex"
+ "fmt"
+ "strings"
+ "sync"
+ "time"
+)
+
+const (
+ PrefixSession = "ses"
+ PrefixMessage = "msg"
+ PrefixUser = "usr"
+ PrefixPart = "prt"
+)
+
+const length = 26
+
+var (
+ lastTimestamp int64
+ counter int64
+ mu sync.Mutex
+)
+
+type Prefix string
+
+const (
+ Session Prefix = PrefixSession
+ Message Prefix = PrefixMessage
+ User Prefix = PrefixUser
+ Part Prefix = PrefixPart
+)
+
+func ValidatePrefix(id string, prefix Prefix) bool {
+ return strings.HasPrefix(id, string(prefix))
+}
+
+func Ascending(prefix Prefix, given ...string) string {
+ return generateID(prefix, false, given...)
+}
+
+func Descending(prefix Prefix, given ...string) string {
+ return generateID(prefix, true, given...)
+}
+
+func generateID(prefix Prefix, descending bool, given ...string) string {
+ if len(given) > 0 && given[0] != "" {
+ if !strings.HasPrefix(given[0], string(prefix)) {
+ panic(fmt.Sprintf("ID %s does not start with %s", given[0], string(prefix)))
+ }
+ return given[0]
+ }
+
+ return generateNewID(prefix, descending)
+}
+
+func randomBase62(length int) string {
+ const chars = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"
+ result := make([]byte, length)
+ bytes := make([]byte, length)
+ rand.Read(bytes)
+
+ for i := 0; i < length; i++ {
+ result[i] = chars[bytes[i]%62]
+ }
+
+ return string(result)
+}
+
+func generateNewID(prefix Prefix, descending bool) string {
+ mu.Lock()
+ defer mu.Unlock()
+
+ currentTimestamp := time.Now().UnixMilli()
+
+ if currentTimestamp != lastTimestamp {
+ lastTimestamp = currentTimestamp
+ counter = 0
+ }
+ counter++
+
+ now := uint64(currentTimestamp)*0x1000 + uint64(counter)
+
+ if descending {
+ now = ^now
+ }
+
+ timeBytes := make([]byte, 6)
+ for i := 0; i < 6; i++ {
+ timeBytes[i] = byte((now >> (40 - 8*i)) & 0xff)
+ }
+
+ return string(prefix) + "_" + hex.EncodeToString(timeBytes) + randomBase62(length-12)
+}
\ No newline at end of file
diff --git a/packages/tui/internal/layout/overlay.go b/packages/tui/internal/layout/overlay.go
index 48064c91ae..08016e31c7 100644
--- a/packages/tui/internal/layout/overlay.go
+++ b/packages/tui/internal/layout/overlay.go
@@ -15,6 +15,11 @@ import (
"github.com/sst/opencode/internal/util"
)
+var (
+ // ANSI escape sequence regex
+ ansiRegex = regexp.MustCompile(`\x1b\[[0-9;]*m`)
+)
+
// Split a string into lines, additionally returning the size of the widest line.
func getLines(s string) (lines []string, widest int) {
lines = strings.Split(s, "\n")
@@ -272,9 +277,6 @@ func combineStyles(bgStyle ansiStyle, fgColor *compat.AdaptiveColor) string {
// getStyleAtPosition extracts the active ANSI style at a given visual position
func getStyleAtPosition(s string, targetPos int) ansiStyle {
- // ANSI escape sequence regex
- ansiRegex := regexp.MustCompile(`\x1b\[[0-9;]*m`)
-
visualPos := 0
currentStyle := ansiStyle{}
diff --git a/packages/tui/internal/styles/markdown.go b/packages/tui/internal/styles/markdown.go
index 14db75466c..9ff87c4e64 100644
--- a/packages/tui/internal/styles/markdown.go
+++ b/packages/tui/internal/styles/markdown.go
@@ -284,7 +284,6 @@ func generateMarkdownStyleConfig(backgroundColor compat.AdaptiveColor) ansi.Styl
Table: ansi.StyleTable{
StyleBlock: ansi.StyleBlock{
StylePrimitive: ansi.StylePrimitive{
- BlockPrefix: "\n",
BlockSuffix: "\n",
},
},
diff --git a/packages/tui/internal/tui/tui.go b/packages/tui/internal/tui/tui.go
index 389dd64f11..a81c1a6ba7 100644
--- a/packages/tui/internal/tui/tui.go
+++ b/packages/tui/internal/tui/tui.go
@@ -2,9 +2,11 @@ package tui
import (
"context"
+ "fmt"
"log/slog"
"os"
"os/exec"
+ "slices"
"strings"
"time"
@@ -54,7 +56,6 @@ const (
const interruptDebounceTimeout = 1 * time.Second
const exitDebounceTimeout = 1 * time.Second
-const fileViewerFullWidthCutoff = 160
type appModel struct {
width, height int
@@ -64,11 +65,10 @@ type appModel struct {
editor chat.EditorComponent
messages chat.MessagesComponent
completions dialog.CompletionDialog
- commandProvider dialog.CompletionProvider
- fileProvider dialog.CompletionProvider
- symbolsProvider dialog.CompletionProvider
+ commandProvider completions.CompletionProvider
+ fileProvider completions.CompletionProvider
+ symbolsProvider completions.CompletionProvider
showCompletionDialog bool
- fileCompletionActive bool
leaderBinding *key.Binding
// isLeaderSequence bool
toastManager *toast.ToastManager
@@ -76,10 +76,6 @@ type appModel struct {
exitKeyState ExitKeyState
messagesRight bool
fileViewer fileviewer.Model
- lastMouse tea.Mouse
- fileViewerStart int
- fileViewerEnd int
- fileViewerHit bool
}
func (a appModel) Init() tea.Cmd {
@@ -154,7 +150,6 @@ func (a appModel) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
!a.showCompletionDialog &&
a.editor.Value() == "" {
a.showCompletionDialog = true
- a.fileCompletionActive = false
updated, cmd := a.editor.Update(msg)
a.editor = updated.(chat.EditorComponent)
@@ -173,7 +168,6 @@ func (a appModel) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
if keyString == "@" &&
!a.showCompletionDialog {
a.showCompletionDialog = true
- a.fileCompletionActive = true
updated, cmd := a.editor.Update(msg)
a.editor = updated.(chat.EditorComponent)
@@ -190,7 +184,7 @@ func (a appModel) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
if a.showCompletionDialog {
switch keyString {
- case "tab", "enter", "esc", "ctrl+c", "up", "down":
+ case "tab", "enter", "esc", "ctrl+c", "up", "down", "ctrl+p", "ctrl+n":
updated, cmd := a.completions.Update(msg)
a.completions = updated.(dialog.CompletionDialog)
cmds = append(cmds, cmd)
@@ -278,36 +272,27 @@ func (a appModel) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
return a, util.CmdHandler(commands.ExecuteCommandsMsg(matches))
}
+ // Fallback: suspend if ctrl+z is pressed and no user keybind matched
+ if keyString == "ctrl+z" {
+ return a, tea.Suspend
+ }
+
// 10. Fallback to editor. This is for other characters like backspace, tab, etc.
updatedEditor, cmd := a.editor.Update(msg)
a.editor = updatedEditor.(chat.EditorComponent)
return a, cmd
case tea.MouseWheelMsg:
if a.modal != nil {
- return a, nil
- }
-
- var cmd tea.Cmd
- if a.fileViewerHit {
- a.fileViewer, cmd = a.fileViewer.Update(msg)
- cmds = append(cmds, cmd)
- } else {
- updated, cmd := a.messages.Update(msg)
- a.messages = updated.(chat.MessagesComponent)
+ u, cmd := a.modal.Update(msg)
+ a.modal = u.(layout.Modal)
cmds = append(cmds, cmd)
+ return a, tea.Batch(cmds...)
}
+ updated, cmd := a.messages.Update(msg)
+ a.messages = updated.(chat.MessagesComponent)
+ cmds = append(cmds, cmd)
return a, tea.Batch(cmds...)
- case tea.MouseMotionMsg:
- a.lastMouse = msg.Mouse()
- a.fileViewerHit = a.fileViewer.HasFile() &&
- a.lastMouse.X > a.fileViewerStart &&
- a.lastMouse.X < a.fileViewerEnd
- case tea.MouseClickMsg:
- a.lastMouse = msg.Mouse()
- a.fileViewerHit = a.fileViewer.HasFile() &&
- a.lastMouse.X > a.fileViewerStart &&
- a.lastMouse.X < a.fileViewerEnd
case tea.BackgroundColorMsg:
styles.Terminal = &styles.TerminalInfo{
Background: msg.Color,
@@ -349,13 +334,12 @@ func (a appModel) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
cmds = append(cmds, cmd)
case app.SetEditorContentMsg:
// Set the editor content without sending
- a.editor.SetValue(msg.Text)
+ a.editor.SetValueWithAttachments(msg.Text)
updated, cmd := a.editor.Focus()
a.editor = updated.(chat.EditorComponent)
cmds = append(cmds, cmd)
case dialog.CompletionDialogCloseMsg:
a.showCompletionDialog = false
- a.fileCompletionActive = false
case opencode.EventListResponseEventInstallationUpdated:
return a, toast.NewSuccessToast(
"opencode updated to "+msg.Properties.Version+", restart to apply.",
@@ -364,55 +348,76 @@ func (a appModel) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
case opencode.EventListResponseEventSessionDeleted:
if a.app.Session != nil && msg.Properties.Info.ID == a.app.Session.ID {
a.app.Session = &opencode.Session{}
- a.app.Messages = []opencode.MessageUnion{}
+ a.app.Messages = []app.Message{}
}
return a, toast.NewSuccessToast("Session deleted successfully")
case opencode.EventListResponseEventSessionUpdated:
if msg.Properties.Info.ID == a.app.Session.ID {
a.app.Session = &msg.Properties.Info
}
- case opencode.EventListResponseEventMessageUpdated:
- if msg.Properties.Info.SessionID == a.app.Session.ID {
- exists := false
- optimisticReplaced := false
-
- // First check if this is replacing an optimistic message
- if msg.Properties.Info.Role == opencode.MessageRoleUser {
- // Look for optimistic messages to replace
- for i, m := range a.app.Messages {
- switch m := m.(type) {
- case opencode.UserMessage:
- if strings.HasPrefix(m.ID, "optimistic-") && m.Role == opencode.UserMessageRoleUser {
- // Replace the optimistic message with the real one
- a.app.Messages[i] = msg.Properties.Info.AsUnion()
- exists = true
- optimisticReplaced = true
- break
- }
+ case opencode.EventListResponseEventMessagePartUpdated:
+ slog.Info("message part updated", "message", msg.Properties.Part.MessageID, "part", msg.Properties.Part.ID)
+ if msg.Properties.Part.SessionID == a.app.Session.ID {
+ messageIndex := slices.IndexFunc(a.app.Messages, func(m app.Message) bool {
+ switch casted := m.Info.(type) {
+ case opencode.UserMessage:
+ return casted.ID == msg.Properties.Part.MessageID
+ case opencode.AssistantMessage:
+ return casted.ID == msg.Properties.Part.MessageID
+ }
+ return false
+ })
+ if messageIndex > -1 {
+ message := a.app.Messages[messageIndex]
+ partIndex := slices.IndexFunc(message.Parts, func(p opencode.PartUnion) bool {
+ switch casted := p.(type) {
+ case opencode.TextPart:
+ return casted.ID == msg.Properties.Part.ID
+ case opencode.FilePart:
+ return casted.ID == msg.Properties.Part.ID
+ case opencode.ToolPart:
+ return casted.ID == msg.Properties.Part.ID
+ case opencode.StepStartPart:
+ return casted.ID == msg.Properties.Part.ID
+ case opencode.StepFinishPart:
+ return casted.ID == msg.Properties.Part.ID
}
+ return false
+ })
+ if partIndex > -1 {
+ message.Parts[partIndex] = msg.Properties.Part.AsUnion()
}
+ if partIndex == -1 {
+ message.Parts = append(message.Parts, msg.Properties.Part.AsUnion())
+ }
+ a.app.Messages[messageIndex] = message
}
-
- // If not replacing optimistic, check for existing message with same ID
- if !optimisticReplaced {
- for i, m := range a.app.Messages {
- var id string
- switch m := m.(type) {
- case opencode.UserMessage:
- id = m.ID
- case opencode.AssistantMessage:
- id = m.ID
- }
- if id == msg.Properties.Info.ID {
- a.app.Messages[i] = msg.Properties.Info.AsUnion()
- exists = true
- break
- }
+ }
+ case opencode.EventListResponseEventMessageUpdated:
+ if msg.Properties.Info.SessionID == a.app.Session.ID {
+ matchIndex := slices.IndexFunc(a.app.Messages, func(m app.Message) bool {
+ switch casted := m.Info.(type) {
+ case opencode.UserMessage:
+ return casted.ID == msg.Properties.Info.ID
+ case opencode.AssistantMessage:
+ return casted.ID == msg.Properties.Info.ID
+ }
+ return false
+ })
+
+ if matchIndex > -1 {
+ match := a.app.Messages[matchIndex]
+ a.app.Messages[matchIndex] = app.Message{
+ Info: msg.Properties.Info.AsUnion(),
+ Parts: match.Parts,
}
}
- if !exists {
- a.app.Messages = append(a.app.Messages, msg.Properties.Info.AsUnion())
+ if matchIndex == -1 {
+ a.app.Messages = append(a.app.Messages, app.Message{
+ Info: msg.Properties.Info.AsUnion(),
+ Parts: []opencode.PartUnion{},
+ })
}
}
case opencode.EventListResponseEventSessionError:
@@ -434,14 +439,7 @@ func (a appModel) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
case tea.WindowSizeMsg:
msg.Height -= 2 // Make space for the status bar
a.width, a.height = msg.Width, msg.Height
- container := min(a.width, 84)
- if a.fileViewer.HasFile() {
- if a.width < fileViewerFullWidthCutoff {
- container = a.width
- } else {
- container = min(min(a.width, max(a.width/2, 50)), 84)
- }
- }
+ container := min(a.width, 86)
layout.Current = &layout.LayoutInfo{
Viewport: layout.Dimensions{
Width: a.width,
@@ -451,32 +449,17 @@ func (a appModel) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
Width: container,
},
}
- mainWidth := layout.Current.Container.Width
- a.messages.SetWidth(mainWidth - 4)
-
- sideWidth := a.width - mainWidth
- if a.width < fileViewerFullWidthCutoff {
- sideWidth = a.width
- }
- a.fileViewerStart = mainWidth
- a.fileViewerEnd = a.fileViewerStart + sideWidth
- if a.messagesRight {
- a.fileViewerStart = 0
- a.fileViewerEnd = sideWidth
- }
- a.fileViewer, cmd = a.fileViewer.SetSize(sideWidth, layout.Current.Viewport.Height)
- cmds = append(cmds, cmd)
case app.SessionSelectedMsg:
messages, err := a.app.ListMessages(context.Background(), msg.ID)
if err != nil {
- slog.Error("Failed to list messages", "error", err)
+ slog.Error("Failed to list messages", "error", err.Error())
return a, toast.NewErrorToast("Failed to open session")
}
a.app.Session = msg
- a.app.Messages = make([]opencode.MessageUnion, 0)
- for _, message := range messages {
- a.app.Messages = append(a.app.Messages, message.AsUnion())
- }
+ a.app.Messages = messages
+ return a, util.CmdHandler(app.SessionLoadedMsg{})
+ case app.SessionCreatedMsg:
+ a.app.Session = msg.Session
return a, util.CmdHandler(app.SessionLoadedMsg{})
case app.ModelSelectedMsg:
a.app.Provider = &msg.Provider
@@ -545,48 +528,22 @@ func (a appModel) View() string {
t := theme.CurrentTheme()
var mainLayout string
- mainWidth := layout.Current.Container.Width - 4
+
if a.app.Session.ID == "" {
- mainLayout = a.home(mainWidth)
+ mainLayout = a.home()
} else {
- mainLayout = a.chat(mainWidth)
+ mainLayout = a.chat()
}
mainLayout = styles.NewStyle().
Background(t.Background()).
Padding(0, 2).
Render(mainLayout)
-
- mainHeight := lipgloss.Height(mainLayout)
-
- if a.fileViewer.HasFile() {
- file := a.fileViewer.View()
- baseStyle := styles.NewStyle().Background(t.BackgroundPanel())
- sidePanel := baseStyle.Height(mainHeight).Render(file)
- if a.width >= fileViewerFullWidthCutoff {
- if a.messagesRight {
- mainLayout = lipgloss.JoinHorizontal(
- lipgloss.Top,
- sidePanel,
- mainLayout,
- )
- } else {
- mainLayout = lipgloss.JoinHorizontal(
- lipgloss.Top,
- mainLayout,
- sidePanel,
- )
- }
- } else {
- mainLayout = sidePanel
- }
- } else {
- mainLayout = lipgloss.PlaceHorizontal(
- a.width,
- lipgloss.Center,
- mainLayout,
- styles.WhitespaceStyle(t.Background()),
- )
- }
+ mainLayout = lipgloss.PlaceHorizontal(
+ a.width,
+ lipgloss.Center,
+ mainLayout,
+ styles.WhitespaceStyle(t.Background()),
+ )
mainStyle := styles.NewStyle().Background(t.Background())
mainLayout = mainStyle.Render(mainLayout)
@@ -622,8 +579,9 @@ func (a appModel) openFile(filepath string) (tea.Model, tea.Cmd) {
return a, cmd
}
-func (a appModel) home(width int) string {
+func (a appModel) home() string {
t := theme.CurrentTheme()
+ effectiveWidth := a.width - 4
baseStyle := styles.NewStyle().Background(t.Background())
base := baseStyle.Render
muted := styles.NewStyle().Foreground(t.TextMuted()).Background(t.Background()).Render
@@ -654,7 +612,7 @@ func (a appModel) home(width int) string {
logoAndVersion := strings.Join([]string{logo, version}, "\n")
logoAndVersion = lipgloss.PlaceHorizontal(
- width,
+ effectiveWidth,
lipgloss.Center,
logoAndVersion,
styles.WhitespaceStyle(t.Background()),
@@ -665,7 +623,7 @@ func (a appModel) home(width int) string {
cmdcomp.WithLimit(6),
)
cmds := lipgloss.PlaceHorizontal(
- width,
+ effectiveWidth,
lipgloss.Center,
commandsView.View(),
styles.WhitespaceStyle(t.Background()),
@@ -677,19 +635,16 @@ func (a appModel) home(width int) string {
lines = append(lines, logoAndVersion)
lines = append(lines, "")
lines = append(lines, "")
- // lines = append(lines, base("cwd ")+muted(cwd))
- // lines = append(lines, base("config ")+muted(config))
- // lines = append(lines, "")
lines = append(lines, cmds)
lines = append(lines, "")
lines = append(lines, "")
mainHeight := lipgloss.Height(strings.Join(lines, "\n"))
- editorWidth := min(width, 80)
- editorView := a.editor.View(editorWidth)
+ editorView := a.editor.View()
+ editorWidth := lipgloss.Width(editorView)
editorView = lipgloss.PlaceHorizontal(
- width,
+ effectiveWidth,
lipgloss.Center,
editorView,
styles.WhitespaceStyle(t.Background()),
@@ -699,7 +654,7 @@ func (a appModel) home(width int) string {
editorLines := a.editor.Lines()
mainLayout := lipgloss.Place(
- width,
+ effectiveWidth,
a.height,
lipgloss.Center,
lipgloss.Center,
@@ -707,14 +662,14 @@ func (a appModel) home(width int) string {
styles.WhitespaceStyle(t.Background()),
)
- editorX := (width - editorWidth) / 2
+ editorX := (effectiveWidth - editorWidth) / 2
editorY := (a.height / 2) + (mainHeight / 2) - 2
if editorLines > 1 {
mainLayout = layout.PlaceOverlay(
editorX,
editorY,
- a.editor.Content(editorWidth),
+ a.editor.Content(),
mainLayout,
)
}
@@ -735,23 +690,31 @@ func (a appModel) home(width int) string {
return mainLayout
}
-func (a appModel) chat(width int) string {
- editorView := a.editor.View(width)
+func (a appModel) chat() string {
+ effectiveWidth := a.width - 4
+ t := theme.CurrentTheme()
+ editorView := a.editor.View()
lines := a.editor.Lines()
- messagesView := a.messages.View(width, a.height-5)
+ messagesView := a.messages.View()
editorWidth := lipgloss.Width(editorView)
editorHeight := max(lines, 5)
+ editorView = lipgloss.PlaceHorizontal(
+ effectiveWidth,
+ lipgloss.Center,
+ editorView,
+ styles.WhitespaceStyle(t.Background()),
+ )
mainLayout := messagesView + "\n" + editorView
- editorX := (a.width - editorWidth) / 2
+ editorX := (effectiveWidth - editorWidth) / 2
if lines > 1 {
editorY := a.height - editorHeight
mainLayout = layout.PlaceOverlay(
editorX,
editorY,
- a.editor.Content(width),
+ a.editor.Content(),
mainLayout,
)
}
@@ -786,6 +749,10 @@ func (a appModel) executeCommand(command commands.Command) (tea.Model, tea.Cmd)
updated, cmd := a.app.SwitchMode()
a.app = updated
cmds = append(cmds, cmd)
+ case commands.SwitchModeReverseCommand:
+ updated, cmd := a.app.SwitchModeReverse()
+ a.app = updated
+ cmds = append(cmds, cmd)
case commands.EditorOpenCommand:
if a.app.IsBusy() {
// status.Warn("Agent is working, please wait...")
@@ -837,7 +804,7 @@ func (a appModel) executeCommand(command commands.Command) (tea.Model, tea.Cmd)
return a, nil
}
a.app.Session = &opencode.Session{}
- a.app.Messages = []opencode.MessageUnion{}
+ a.app.Messages = []app.Message{}
cmds = append(cmds, util.CmdHandler(app.SessionClearedMsg{}))
case commands.SessionListCommand:
sessionDialog := dialog.NewSessionDialog(a.app)
@@ -877,6 +844,56 @@ func (a appModel) executeCommand(command commands.Command) (tea.Model, tea.Cmd)
}
// TODO: block until compaction is complete
a.app.CompactSession(context.Background())
+ case commands.SessionExportCommand:
+ if a.app.Session.ID == "" {
+ return a, toast.NewErrorToast("No active session to export.")
+ }
+
+ // Use current conversation history
+ messages := a.app.Messages
+ if len(messages) == 0 {
+ return a, toast.NewInfoToast("No messages to export.")
+ }
+
+ // Format to Markdown
+ markdownContent := formatConversationToMarkdown(messages)
+
+ // Check if EDITOR is set
+ editor := os.Getenv("EDITOR")
+ if editor == "" {
+ return a, toast.NewErrorToast("No EDITOR set, can't open editor")
+ }
+
+ // Create and write to temp file
+ tmpfile, err := os.CreateTemp("", "conversation-*.md")
+ if err != nil {
+ slog.Error("Failed to create temp file", "error", err)
+ return a, toast.NewErrorToast("Failed to create temporary file.")
+ }
+
+ _, err = tmpfile.WriteString(markdownContent)
+ if err != nil {
+ slog.Error("Failed to write to temp file", "error", err)
+ tmpfile.Close()
+ os.Remove(tmpfile.Name())
+ return a, toast.NewErrorToast("Failed to write conversation to file.")
+ }
+ tmpfile.Close()
+
+ // Open in editor
+ c := exec.Command(editor, tmpfile.Name())
+ c.Stdin = os.Stdin
+ c.Stdout = os.Stdout
+ c.Stderr = os.Stderr
+ cmd = tea.ExecProcess(c, func(err error) tea.Msg {
+ if err != nil {
+ slog.Error("Failed to open editor for conversation", "error", err)
+ }
+ // Clean up the file after editor closes
+ os.Remove(tmpfile.Name())
+ return nil
+ })
+ cmds = append(cmds, cmd)
case commands.ToolDetailsCommand:
message := "Tool details are now visible"
if a.messages.ToolDetailsVisible() {
@@ -890,12 +907,11 @@ func (a appModel) executeCommand(command commands.Command) (tea.Model, tea.Cmd)
case commands.ThemeListCommand:
themeDialog := dialog.NewThemeDialog()
a.modal = themeDialog
- case commands.FileListCommand:
- a.editor.Blur()
- provider := completions.NewFileContextGroup(a.app)
- findDialog := dialog.NewFindDialog(provider)
- findDialog.SetWidth(layout.Current.Container.Width - 8)
- a.modal = findDialog
+ // case commands.FileListCommand:
+ // a.editor.Blur()
+ // findDialog := dialog.NewFindDialog(a.fileProvider)
+ // cmds = append(cmds, findDialog.Init())
+ // a.modal = findDialog
case commands.FileCloseCommand:
a.fileViewer, cmd = a.fileViewer.Clear()
cmds = append(cmds, cmd)
@@ -928,11 +944,11 @@ func (a appModel) executeCommand(command commands.Command) (tea.Model, tea.Cmd)
a.editor = updated.(chat.EditorComponent)
cmds = append(cmds, cmd)
case commands.MessagesFirstCommand:
- updated, cmd := a.messages.First()
+ updated, cmd := a.messages.GotoTop()
a.messages = updated.(chat.MessagesComponent)
cmds = append(cmds, cmd)
case commands.MessagesLastCommand:
- updated, cmd := a.messages.Last()
+ updated, cmd := a.messages.GotoBottom()
a.messages = updated.(chat.MessagesComponent)
cmds = append(cmds, cmd)
case commands.MessagesPageUpCommand:
@@ -971,26 +987,14 @@ func (a appModel) executeCommand(command commands.Command) (tea.Model, tea.Cmd)
a.messages = updated.(chat.MessagesComponent)
cmds = append(cmds, cmd)
}
- case commands.MessagesPreviousCommand:
- updated, cmd := a.messages.Previous()
- a.messages = updated.(chat.MessagesComponent)
- cmds = append(cmds, cmd)
- case commands.MessagesNextCommand:
- updated, cmd := a.messages.Next()
- a.messages = updated.(chat.MessagesComponent)
- cmds = append(cmds, cmd)
case commands.MessagesLayoutToggleCommand:
a.messagesRight = !a.messagesRight
a.app.State.MessagesRight = a.messagesRight
a.app.SaveState()
case commands.MessagesCopyCommand:
- selected := a.messages.Selected()
- if selected != "" {
- cmd = a.app.SetClipboard(selected)
- cmds = append(cmds, cmd)
- cmd = toast.NewSuccessToast("Message copied to clipboard")
- cmds = append(cmds, cmd)
- }
+ updated, cmd := a.messages.CopyLastMessage()
+ a.messages = updated.(chat.MessagesComponent)
+ cmds = append(cmds, cmd)
case commands.MessagesRevertCommand:
case commands.AppExitCommand:
return a, tea.Quit
@@ -1024,7 +1028,6 @@ func NewModel(app *app.App) tea.Model {
symbolsProvider: symbolsProvider,
leaderBinding: leaderBinding,
showCompletionDialog: false,
- fileCompletionActive: false,
toastManager: toast.NewToastManager(),
interruptKeyState: InterruptKeyIdle,
exitKeyState: ExitKeyIdle,
@@ -1034,3 +1037,44 @@ func NewModel(app *app.App) tea.Model {
return model
}
+
+func formatConversationToMarkdown(messages []app.Message) string {
+ var builder strings.Builder
+
+ builder.WriteString("# Conversation History\n\n")
+
+ for _, msg := range messages {
+ builder.WriteString("---\n\n")
+
+ var role string
+ var timestamp time.Time
+
+ switch info := msg.Info.(type) {
+ case opencode.UserMessage:
+ role = "User"
+ timestamp = time.UnixMilli(int64(info.Time.Created))
+ case opencode.AssistantMessage:
+ role = "Assistant"
+ timestamp = time.UnixMilli(int64(info.Time.Created))
+ default:
+ continue
+ }
+
+ builder.WriteString(
+ fmt.Sprintf("**%s** (*%s*)\n\n", role, timestamp.Format("2006-01-02 15:04:05")),
+ )
+
+ for _, part := range msg.Parts {
+ switch p := part.(type) {
+ case opencode.TextPart:
+ builder.WriteString(p.Text + "\n\n")
+ case opencode.FilePart:
+ builder.WriteString(fmt.Sprintf("[File: %s]\n\n", p.Filename))
+ case opencode.ToolPart:
+ builder.WriteString(fmt.Sprintf("[Tool: %s]\n\n", p.Tool))
+ }
+ }
+ }
+
+ return builder.String()
+}
diff --git a/packages/tui/sdk/.stats.yml b/packages/tui/sdk/.stats.yml
index 4449c4d950..02591cbbbe 100644
--- a/packages/tui/sdk/.stats.yml
+++ b/packages/tui/sdk/.stats.yml
@@ -1,4 +1,4 @@
configured_endpoints: 22
-openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/opencode%2Fopencode-eb25bb3673f94d0e98a7036e2a2b0ed7ad63d1598665f2d5e091ec0835273798.yml
-openapi_spec_hash: 62f6a8a06aaa4f4ae13e85d56652724f
-config_hash: 589ec6a935a43a3c49a325ece86cbda2
+openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/opencode%2Fopencode-a1da357fcefd3105736841fbf44018022fade78e67ffc81e178cf9196da723ee.yml
+openapi_spec_hash: 9bd27afcc5b8f43d8e4223f7c984035f
+config_hash: 62b73a3397120578a992bffd1e69386a
diff --git a/packages/tui/sdk/README.md b/packages/tui/sdk/README.md
index 2b5782347e..2588b61474 100644
--- a/packages/tui/sdk/README.md
+++ b/packages/tui/sdk/README.md
@@ -49,11 +49,11 @@ import (
func main() {
client := opencode.NewClient()
- events, err := client.Event.List(context.TODO())
+ sessions, err := client.Session.List(context.TODO())
if err != nil {
panic(err.Error())
}
- fmt.Printf("%+v\n", events)
+ fmt.Printf("%+v\n", sessions)
}
```
@@ -142,7 +142,7 @@ client := opencode.NewClient(
option.WithHeader("X-Some-Header", "custom_header_info"),
)
-client.Event.List(context.TODO(), ...,
+client.Session.List(context.TODO(), ...,
// Override the header
option.WithHeader("X-Some-Header", "some_other_custom_header_info"),
// Add an undocumented field to the request body, using sjson syntax
@@ -171,14 +171,14 @@ When the API returns a non-success status code, we return an error with type
To handle errors, we recommend that you use the `errors.As` pattern:
```go
-_, err := client.Event.List(context.TODO())
+_, err := client.Session.List(context.TODO())
if err != nil {
var apierr *opencode.Error
if errors.As(err, &apierr) {
println(string(apierr.DumpRequest(true))) // Prints the serialized HTTP request
println(string(apierr.DumpResponse(true))) // Prints the serialized HTTP response
}
- panic(err.Error()) // GET "/event": 400 Bad Request { ... }
+ panic(err.Error()) // GET "/session": 400 Bad Request { ... }
}
```
@@ -196,7 +196,7 @@ To set a per-retry timeout, use `option.WithRequestTimeout()`.
// This sets the timeout for the request, including all the retries.
ctx, cancel := context.WithTimeout(context.Background(), 5*time.Minute)
defer cancel()
-client.Event.List(
+client.Session.List(
ctx,
// This sets the per-retry timeout
option.WithRequestTimeout(20*time.Second),
@@ -231,7 +231,7 @@ client := opencode.NewClient(
)
// Override per-request:
-client.Event.List(context.TODO(), option.WithMaxRetries(5))
+client.Session.List(context.TODO(), option.WithMaxRetries(5))
```
### Accessing raw response data (e.g. response headers)
@@ -242,11 +242,11 @@ you need to examine response headers, status codes, or other details.
```go
// Create a variable to store the HTTP response
var response *http.Response
-events, err := client.Event.List(context.TODO(), option.WithResponseInto(&response))
+sessions, err := client.Session.List(context.TODO(), option.WithResponseInto(&response))
if err != nil {
// handle error
}
-fmt.Printf("%+v\n", events)
+fmt.Printf("%+v\n", sessions)
fmt.Printf("Status Code: %d\n", response.StatusCode)
fmt.Printf("Headers: %+#v\n", response.Header)
diff --git a/packages/tui/sdk/api.md b/packages/tui/sdk/api.md
index 15bdcfa93b..15b177e92e 100644
--- a/packages/tui/sdk/api.md
+++ b/packages/tui/sdk/api.md
@@ -21,6 +21,9 @@ Response Types:
- opencode.App
- opencode.LogLevel
- opencode.Mode
+- opencode.Model
+- opencode.Provider
+- opencode.AppProvidersResponse
Methods:
@@ -28,6 +31,7 @@ Methods:
- client.App.Init(ctx context.Context) (bool, error)
- client.App.Log(ctx context.Context, body opencode.AppLogParams) (bool, error)
- client.App.Modes(ctx context.Context) ([]opencode.Mode, error)
+- client.App.Providers(ctx context.Context) (opencode.AppProvidersResponse, error)
# Find
@@ -59,33 +63,31 @@ Methods:
Response Types:
- opencode.Config
-- opencode.Keybinds
-- opencode.McpLocal
-- opencode.McpRemote
-- opencode.Model
-- opencode.Provider
-- opencode.ConfigProvidersResponse
+- opencode.KeybindsConfig
+- opencode.McpLocalConfig
+- opencode.McpRemoteConfig
+- opencode.ModeConfig
Methods:
- client.Config.Get(ctx context.Context) (opencode.Config, error)
-- client.Config.Providers(ctx context.Context) (opencode.ConfigProvidersResponse, error)
# Session
Params Types:
-- opencode.FilePartParam
-- opencode.TextPartParam
-- opencode.UserMessagePartUnionParam
+- opencode.FilePartInputParam
+- opencode.TextPartInputParam
Response Types:
- opencode.AssistantMessage
-- opencode.AssistantMessagePart
- opencode.FilePart
- opencode.Message
+- opencode.Part
- opencode.Session
+- opencode.SnapshotPart
+- opencode.StepFinishPart
- opencode.StepStartPart
- opencode.TextPart
- opencode.ToolPart
@@ -94,7 +96,7 @@ Response Types:
- opencode.ToolStatePending
- opencode.ToolStateRunning
- opencode.UserMessage
-- opencode.UserMessagePart
+- opencode.SessionMessagesResponse
Methods:
@@ -104,7 +106,7 @@ Methods:
- client.Session.Abort(ctx context.Context, id string) (bool, error)
- client.Session.Chat(ctx context.Context, id string, body opencode.SessionChatParams) (opencode.AssistantMessage, error)
- client.Session.Init(ctx context.Context, id string, body opencode.SessionInitParams) (bool, error)
-- client.Session.Messages(ctx context.Context, id string) ([]opencode.Message, error)
+- client.Session.Messages(ctx context.Context, id string) ([]opencode.SessionMessagesResponse, error)
- client.Session.Share(ctx context.Context, id string) (opencode.Session, error)
- client.Session.Summarize(ctx context.Context, id string, body opencode.SessionSummarizeParams) (bool, error)
- client.Session.Unshare(ctx context.Context, id string) (opencode.Session, error)
diff --git a/packages/tui/sdk/app.go b/packages/tui/sdk/app.go
index 09d8cbf39d..aa47e83b2f 100644
--- a/packages/tui/sdk/app.go
+++ b/packages/tui/sdk/app.go
@@ -63,12 +63,19 @@ func (r *AppService) Modes(ctx context.Context, opts ...option.RequestOption) (r
return
}
+// List all providers
+func (r *AppService) Providers(ctx context.Context, opts ...option.RequestOption) (res *AppProvidersResponse, err error) {
+ opts = append(r.Options[:], opts...)
+ path := "config/providers"
+ err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...)
+ return
+}
+
type App struct {
Git bool `json:"git,required"`
Hostname string `json:"hostname,required"`
Path AppPath `json:"path,required"`
Time AppTime `json:"time,required"`
- User string `json:"user,required"`
JSON appJSON `json:"-"`
}
@@ -78,7 +85,6 @@ type appJSON struct {
Hostname apijson.Field
Path apijson.Field
Time apijson.Field
- User apijson.Field
raw string
ExtraFields map[string]apijson.Field
}
@@ -205,6 +211,145 @@ func (r modeModelJSON) RawJSON() string {
return r.raw
}
+type Model struct {
+ ID string `json:"id,required"`
+ Attachment bool `json:"attachment,required"`
+ Cost ModelCost `json:"cost,required"`
+ Limit ModelLimit `json:"limit,required"`
+ Name string `json:"name,required"`
+ Options map[string]interface{} `json:"options,required"`
+ Reasoning bool `json:"reasoning,required"`
+ ReleaseDate string `json:"release_date,required"`
+ Temperature bool `json:"temperature,required"`
+ ToolCall bool `json:"tool_call,required"`
+ JSON modelJSON `json:"-"`
+}
+
+// modelJSON contains the JSON metadata for the struct [Model]
+type modelJSON struct {
+ ID apijson.Field
+ Attachment apijson.Field
+ Cost apijson.Field
+ Limit apijson.Field
+ Name apijson.Field
+ Options apijson.Field
+ Reasoning apijson.Field
+ ReleaseDate apijson.Field
+ Temperature apijson.Field
+ ToolCall apijson.Field
+ raw string
+ ExtraFields map[string]apijson.Field
+}
+
+func (r *Model) UnmarshalJSON(data []byte) (err error) {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+func (r modelJSON) RawJSON() string {
+ return r.raw
+}
+
+type ModelCost struct {
+ Input float64 `json:"input,required"`
+ Output float64 `json:"output,required"`
+ CacheRead float64 `json:"cache_read"`
+ CacheWrite float64 `json:"cache_write"`
+ JSON modelCostJSON `json:"-"`
+}
+
+// modelCostJSON contains the JSON metadata for the struct [ModelCost]
+type modelCostJSON struct {
+ Input apijson.Field
+ Output apijson.Field
+ CacheRead apijson.Field
+ CacheWrite apijson.Field
+ raw string
+ ExtraFields map[string]apijson.Field
+}
+
+func (r *ModelCost) UnmarshalJSON(data []byte) (err error) {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+func (r modelCostJSON) RawJSON() string {
+ return r.raw
+}
+
+type ModelLimit struct {
+ Context float64 `json:"context,required"`
+ Output float64 `json:"output,required"`
+ JSON modelLimitJSON `json:"-"`
+}
+
+// modelLimitJSON contains the JSON metadata for the struct [ModelLimit]
+type modelLimitJSON struct {
+ Context apijson.Field
+ Output apijson.Field
+ raw string
+ ExtraFields map[string]apijson.Field
+}
+
+func (r *ModelLimit) UnmarshalJSON(data []byte) (err error) {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+func (r modelLimitJSON) RawJSON() string {
+ return r.raw
+}
+
+type Provider struct {
+ ID string `json:"id,required"`
+ Env []string `json:"env,required"`
+ Models map[string]Model `json:"models,required"`
+ Name string `json:"name,required"`
+ API string `json:"api"`
+ Npm string `json:"npm"`
+ JSON providerJSON `json:"-"`
+}
+
+// providerJSON contains the JSON metadata for the struct [Provider]
+type providerJSON struct {
+ ID apijson.Field
+ Env apijson.Field
+ Models apijson.Field
+ Name apijson.Field
+ API apijson.Field
+ Npm apijson.Field
+ raw string
+ ExtraFields map[string]apijson.Field
+}
+
+func (r *Provider) UnmarshalJSON(data []byte) (err error) {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+func (r providerJSON) RawJSON() string {
+ return r.raw
+}
+
+type AppProvidersResponse struct {
+ Default map[string]string `json:"default,required"`
+ Providers []Provider `json:"providers,required"`
+ JSON appProvidersResponseJSON `json:"-"`
+}
+
+// appProvidersResponseJSON contains the JSON metadata for the struct
+// [AppProvidersResponse]
+type appProvidersResponseJSON struct {
+ Default apijson.Field
+ Providers apijson.Field
+ raw string
+ ExtraFields map[string]apijson.Field
+}
+
+func (r *AppProvidersResponse) UnmarshalJSON(data []byte) (err error) {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+func (r appProvidersResponseJSON) RawJSON() string {
+ return r.raw
+}
+
type AppLogParams struct {
// Log level
Level param.Field[AppLogParamsLevel] `json:"level,required"`
diff --git a/packages/tui/sdk/app_test.go b/packages/tui/sdk/app_test.go
index 8028f2c53d..16bb8ff886 100644
--- a/packages/tui/sdk/app_test.go
+++ b/packages/tui/sdk/app_test.go
@@ -107,3 +107,25 @@ func TestAppModes(t *testing.T) {
t.Fatalf("err should be nil: %s", err.Error())
}
}
+
+func TestAppProviders(t *testing.T) {
+ t.Skip("skipped: tests are disabled for the time being")
+ baseURL := "http://localhost:4010"
+ if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok {
+ baseURL = envURL
+ }
+ if !testutil.CheckTestServer(t, baseURL) {
+ return
+ }
+ client := opencode.NewClient(
+ option.WithBaseURL(baseURL),
+ )
+ _, err := client.App.Providers(context.TODO())
+ if err != nil {
+ var apierr *opencode.Error
+ if errors.As(err, &apierr) {
+ t.Log(string(apierr.DumpRequest(true)))
+ }
+ t.Fatalf("err should be nil: %s", err.Error())
+ }
+}
diff --git a/packages/tui/sdk/client_test.go b/packages/tui/sdk/client_test.go
index e75d64925f..0f5b8205dc 100644
--- a/packages/tui/sdk/client_test.go
+++ b/packages/tui/sdk/client_test.go
@@ -38,7 +38,7 @@ func TestUserAgentHeader(t *testing.T) {
},
}),
)
- client.Event.List(context.Background())
+ client.Session.List(context.Background())
if userAgent != fmt.Sprintf("Opencode/Go %s", internal.PackageVersion) {
t.Errorf("Expected User-Agent to be correct, but got: %#v", userAgent)
}
@@ -61,7 +61,7 @@ func TestRetryAfter(t *testing.T) {
},
}),
)
- _, err := client.Event.List(context.Background())
+ _, err := client.Session.List(context.Background())
if err == nil {
t.Error("Expected there to be a cancel error")
}
@@ -95,7 +95,7 @@ func TestDeleteRetryCountHeader(t *testing.T) {
}),
option.WithHeaderDel("X-Stainless-Retry-Count"),
)
- _, err := client.Event.List(context.Background())
+ _, err := client.Session.List(context.Background())
if err == nil {
t.Error("Expected there to be a cancel error")
}
@@ -124,7 +124,7 @@ func TestOverwriteRetryCountHeader(t *testing.T) {
}),
option.WithHeader("X-Stainless-Retry-Count", "42"),
)
- _, err := client.Event.List(context.Background())
+ _, err := client.Session.List(context.Background())
if err == nil {
t.Error("Expected there to be a cancel error")
}
@@ -152,7 +152,7 @@ func TestRetryAfterMs(t *testing.T) {
},
}),
)
- _, err := client.Event.List(context.Background())
+ _, err := client.Session.List(context.Background())
if err == nil {
t.Error("Expected there to be a cancel error")
}
@@ -174,7 +174,7 @@ func TestContextCancel(t *testing.T) {
)
cancelCtx, cancel := context.WithCancel(context.Background())
cancel()
- _, err := client.Event.List(cancelCtx)
+ _, err := client.Session.List(cancelCtx)
if err == nil {
t.Error("Expected there to be a cancel error")
}
@@ -193,7 +193,7 @@ func TestContextCancelDelay(t *testing.T) {
)
cancelCtx, cancel := context.WithTimeout(context.Background(), 2*time.Millisecond)
defer cancel()
- _, err := client.Event.List(cancelCtx)
+ _, err := client.Session.List(cancelCtx)
if err == nil {
t.Error("expected there to be a cancel error")
}
@@ -218,7 +218,7 @@ func TestContextDeadline(t *testing.T) {
},
}),
)
- _, err := client.Event.List(deadlineCtx)
+ _, err := client.Session.List(deadlineCtx)
if err == nil {
t.Error("expected there to be a deadline error")
}
diff --git a/packages/tui/sdk/config.go b/packages/tui/sdk/config.go
index 59c4e62cfc..34788dacd4 100644
--- a/packages/tui/sdk/config.go
+++ b/packages/tui/sdk/config.go
@@ -40,18 +40,11 @@ func (r *ConfigService) Get(ctx context.Context, opts ...option.RequestOption) (
return
}
-// List all providers
-func (r *ConfigService) Providers(ctx context.Context, opts ...option.RequestOption) (res *ConfigProvidersResponse, err error) {
- opts = append(r.Options[:], opts...)
- path := "config/providers"
- err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...)
- return
-}
-
type Config struct {
// JSON schema reference for configuration validation
Schema string `json:"$schema"`
- // Share newly created sessions automatically
+ // @deprecated Use 'share' field instead. Share newly created sessions
+ // automatically
Autoshare bool `json:"autoshare"`
// Automatically update to the latest version
Autoupdate bool `json:"autoupdate"`
@@ -61,19 +54,27 @@ type Config struct {
// Additional instruction files or patterns to include
Instructions []string `json:"instructions"`
// Custom keybind configurations
- Keybinds Keybinds `json:"keybinds"`
+ Keybinds KeybindsConfig `json:"keybinds"`
+ // @deprecated Always uses stretch layout.
+ Layout ConfigLayout `json:"layout"`
// Minimum log level to write to log files
LogLevel LogLevel `json:"log_level"`
// MCP (Model Context Protocol) server configurations
- Mcp map[string]ConfigMcp `json:"mcp"`
- Mode ConfigMode `json:"mode"`
+ Mcp map[string]ConfigMcp `json:"mcp"`
+ // Modes configuration, see https://opencode.ai/docs/modes
+ Mode ConfigMode `json:"mode"`
// Model to use in the format of provider/model, eg anthropic/claude-2
Model string `json:"model"`
// Custom provider configurations and model overrides
Provider map[string]ConfigProvider `json:"provider"`
+ // Control sharing behavior:'manual' allows manual sharing via commands, 'auto'
+ // enables automatic sharing, 'disabled' disables all sharing
+ Share ConfigShare `json:"share"`
// Theme name to use for the interface
- Theme string `json:"theme"`
- JSON configJSON `json:"-"`
+ Theme string `json:"theme"`
+ // Custom username to display in conversations instead of system username
+ Username string `json:"username"`
+ JSON configJSON `json:"-"`
}
// configJSON contains the JSON metadata for the struct [Config]
@@ -85,12 +86,15 @@ type configJSON struct {
Experimental apijson.Field
Instructions apijson.Field
Keybinds apijson.Field
+ Layout apijson.Field
LogLevel apijson.Field
Mcp apijson.Field
Mode apijson.Field
Model apijson.Field
Provider apijson.Field
+ Share apijson.Field
Theme apijson.Field
+ Username apijson.Field
raw string
ExtraFields map[string]apijson.Field
}
@@ -193,6 +197,22 @@ func (r configExperimentalHookSessionCompletedJSON) RawJSON() string {
return r.raw
}
+// @deprecated Always uses stretch layout.
+type ConfigLayout string
+
+const (
+ ConfigLayoutAuto ConfigLayout = "auto"
+ ConfigLayoutStretch ConfigLayout = "stretch"
+)
+
+func (r ConfigLayout) IsKnown() bool {
+ switch r {
+ case ConfigLayoutAuto, ConfigLayoutStretch:
+ return true
+ }
+ return false
+}
+
type ConfigMcp struct {
// Type of MCP server connection
Type ConfigMcpType `json:"type,required"`
@@ -202,6 +222,8 @@ type ConfigMcp struct {
Enabled bool `json:"enabled"`
// This field can have the runtime type of [map[string]string].
Environment interface{} `json:"environment"`
+ // This field can have the runtime type of [map[string]string].
+ Headers interface{} `json:"headers"`
// URL of the remote MCP server
URL string `json:"url"`
JSON configMcpJSON `json:"-"`
@@ -214,6 +236,7 @@ type configMcpJSON struct {
Command apijson.Field
Enabled apijson.Field
Environment apijson.Field
+ Headers apijson.Field
URL apijson.Field
raw string
ExtraFields map[string]apijson.Field
@@ -235,12 +258,12 @@ func (r *ConfigMcp) UnmarshalJSON(data []byte) (err error) {
// AsUnion returns a [ConfigMcpUnion] interface which you can cast to the specific
// types for more type safety.
//
-// Possible runtime types of the union are [McpLocal], [McpRemote].
+// Possible runtime types of the union are [McpLocalConfig], [McpRemoteConfig].
func (r ConfigMcp) AsUnion() ConfigMcpUnion {
return r.union
}
-// Union satisfied by [McpLocal] or [McpRemote].
+// Union satisfied by [McpLocalConfig] or [McpRemoteConfig].
type ConfigMcpUnion interface {
implementsConfigMcp()
}
@@ -251,12 +274,12 @@ func init() {
"type",
apijson.UnionVariant{
TypeFilter: gjson.JSON,
- Type: reflect.TypeOf(McpLocal{}),
+ Type: reflect.TypeOf(McpLocalConfig{}),
DiscriminatorValue: "local",
},
apijson.UnionVariant{
TypeFilter: gjson.JSON,
- Type: reflect.TypeOf(McpRemote{}),
+ Type: reflect.TypeOf(McpRemoteConfig{}),
DiscriminatorValue: "remote",
},
)
@@ -278,10 +301,11 @@ func (r ConfigMcpType) IsKnown() bool {
return false
}
+// Modes configuration, see https://opencode.ai/docs/modes
type ConfigMode struct {
- Build ConfigModeBuild `json:"build"`
- Plan ConfigModePlan `json:"plan"`
- ExtraFields map[string]ConfigMode `json:"-,extras"`
+ Build ModeConfig `json:"build"`
+ Plan ModeConfig `json:"plan"`
+ ExtraFields map[string]ModeConfig `json:"-,extras"`
JSON configModeJSON `json:"-"`
}
@@ -301,54 +325,6 @@ func (r configModeJSON) RawJSON() string {
return r.raw
}
-type ConfigModeBuild struct {
- Model string `json:"model"`
- Prompt string `json:"prompt"`
- Tools map[string]bool `json:"tools"`
- JSON configModeBuildJSON `json:"-"`
-}
-
-// configModeBuildJSON contains the JSON metadata for the struct [ConfigModeBuild]
-type configModeBuildJSON struct {
- Model apijson.Field
- Prompt apijson.Field
- Tools apijson.Field
- raw string
- ExtraFields map[string]apijson.Field
-}
-
-func (r *ConfigModeBuild) UnmarshalJSON(data []byte) (err error) {
- return apijson.UnmarshalRoot(data, r)
-}
-
-func (r configModeBuildJSON) RawJSON() string {
- return r.raw
-}
-
-type ConfigModePlan struct {
- Model string `json:"model"`
- Prompt string `json:"prompt"`
- Tools map[string]bool `json:"tools"`
- JSON configModePlanJSON `json:"-"`
-}
-
-// configModePlanJSON contains the JSON metadata for the struct [ConfigModePlan]
-type configModePlanJSON struct {
- Model apijson.Field
- Prompt apijson.Field
- Tools apijson.Field
- raw string
- ExtraFields map[string]apijson.Field
-}
-
-func (r *ConfigModePlan) UnmarshalJSON(data []byte) (err error) {
- return apijson.UnmarshalRoot(data, r)
-}
-
-func (r configModePlanJSON) RawJSON() string {
- return r.raw
-}
-
type ConfigProvider struct {
Models map[string]ConfigProviderModel `json:"models,required"`
ID string `json:"id"`
@@ -470,7 +446,25 @@ func (r configProviderModelsLimitJSON) RawJSON() string {
return r.raw
}
-type Keybinds struct {
+// Control sharing behavior:'manual' allows manual sharing via commands, 'auto'
+// enables automatic sharing, 'disabled' disables all sharing
+type ConfigShare string
+
+const (
+ ConfigShareManual ConfigShare = "manual"
+ ConfigShareAuto ConfigShare = "auto"
+ ConfigShareDisabled ConfigShare = "disabled"
+)
+
+func (r ConfigShare) IsKnown() bool {
+ switch r {
+ case ConfigShareManual, ConfigShareAuto, ConfigShareDisabled:
+ return true
+ }
+ return false
+}
+
+type KeybindsConfig struct {
// Exit the application
AppExit string `json:"app_exit,required"`
// Show help dialog
@@ -523,6 +517,8 @@ type Keybinds struct {
ProjectInit string `json:"project_init,required"`
// Compact the session
SessionCompact string `json:"session_compact,required"`
+ // Export session to editor
+ SessionExport string `json:"session_export,required"`
// Interrupt current session
SessionInterrupt string `json:"session_interrupt,required"`
// List all sessions
@@ -533,17 +529,19 @@ type Keybinds struct {
SessionShare string `json:"session_share,required"`
// Unshare current session
SessionUnshare string `json:"session_unshare,required"`
- // Switch mode
+ // Next mode
SwitchMode string `json:"switch_mode,required"`
+ // Previous Mode
+ SwitchModeReverse string `json:"switch_mode_reverse,required"`
// List available themes
ThemeList string `json:"theme_list,required"`
// Toggle tool details
- ToolDetails string `json:"tool_details,required"`
- JSON keybindsJSON `json:"-"`
+ ToolDetails string `json:"tool_details,required"`
+ JSON keybindsConfigJSON `json:"-"`
}
-// keybindsJSON contains the JSON metadata for the struct [Keybinds]
-type keybindsJSON struct {
+// keybindsConfigJSON contains the JSON metadata for the struct [KeybindsConfig]
+type keybindsConfigJSON struct {
AppExit apijson.Field
AppHelp apijson.Field
EditorOpen apijson.Field
@@ -570,40 +568,42 @@ type keybindsJSON struct {
ModelList apijson.Field
ProjectInit apijson.Field
SessionCompact apijson.Field
+ SessionExport apijson.Field
SessionInterrupt apijson.Field
SessionList apijson.Field
SessionNew apijson.Field
SessionShare apijson.Field
SessionUnshare apijson.Field
SwitchMode apijson.Field
+ SwitchModeReverse apijson.Field
ThemeList apijson.Field
ToolDetails apijson.Field
raw string
ExtraFields map[string]apijson.Field
}
-func (r *Keybinds) UnmarshalJSON(data []byte) (err error) {
+func (r *KeybindsConfig) UnmarshalJSON(data []byte) (err error) {
return apijson.UnmarshalRoot(data, r)
}
-func (r keybindsJSON) RawJSON() string {
+func (r keybindsConfigJSON) RawJSON() string {
return r.raw
}
-type McpLocal struct {
+type McpLocalConfig struct {
// Command and arguments to run the MCP server
Command []string `json:"command,required"`
// Type of MCP server connection
- Type McpLocalType `json:"type,required"`
+ Type McpLocalConfigType `json:"type,required"`
// Enable or disable the MCP server on startup
Enabled bool `json:"enabled"`
// Environment variables to set when running the MCP server
- Environment map[string]string `json:"environment"`
- JSON mcpLocalJSON `json:"-"`
+ Environment map[string]string `json:"environment"`
+ JSON mcpLocalConfigJSON `json:"-"`
}
-// mcpLocalJSON contains the JSON metadata for the struct [McpLocal]
-type mcpLocalJSON struct {
+// mcpLocalConfigJSON contains the JSON metadata for the struct [McpLocalConfig]
+type mcpLocalConfigJSON struct {
Command apijson.Field
Type apijson.Field
Enabled apijson.Field
@@ -612,210 +612,98 @@ type mcpLocalJSON struct {
ExtraFields map[string]apijson.Field
}
-func (r *McpLocal) UnmarshalJSON(data []byte) (err error) {
+func (r *McpLocalConfig) UnmarshalJSON(data []byte) (err error) {
return apijson.UnmarshalRoot(data, r)
}
-func (r mcpLocalJSON) RawJSON() string {
+func (r mcpLocalConfigJSON) RawJSON() string {
return r.raw
}
-func (r McpLocal) implementsConfigMcp() {}
+func (r McpLocalConfig) implementsConfigMcp() {}
// Type of MCP server connection
-type McpLocalType string
+type McpLocalConfigType string
const (
- McpLocalTypeLocal McpLocalType = "local"
+ McpLocalConfigTypeLocal McpLocalConfigType = "local"
)
-func (r McpLocalType) IsKnown() bool {
+func (r McpLocalConfigType) IsKnown() bool {
switch r {
- case McpLocalTypeLocal:
+ case McpLocalConfigTypeLocal:
return true
}
return false
}
-type McpRemote struct {
+type McpRemoteConfig struct {
// Type of MCP server connection
- Type McpRemoteType `json:"type,required"`
+ Type McpRemoteConfigType `json:"type,required"`
// URL of the remote MCP server
URL string `json:"url,required"`
// Enable or disable the MCP server on startup
- Enabled bool `json:"enabled"`
- JSON mcpRemoteJSON `json:"-"`
+ Enabled bool `json:"enabled"`
+ // Headers to send with the request
+ Headers map[string]string `json:"headers"`
+ JSON mcpRemoteConfigJSON `json:"-"`
}
-// mcpRemoteJSON contains the JSON metadata for the struct [McpRemote]
-type mcpRemoteJSON struct {
+// mcpRemoteConfigJSON contains the JSON metadata for the struct [McpRemoteConfig]
+type mcpRemoteConfigJSON struct {
Type apijson.Field
URL apijson.Field
Enabled apijson.Field
+ Headers apijson.Field
raw string
ExtraFields map[string]apijson.Field
}
-func (r *McpRemote) UnmarshalJSON(data []byte) (err error) {
+func (r *McpRemoteConfig) UnmarshalJSON(data []byte) (err error) {
return apijson.UnmarshalRoot(data, r)
}
-func (r mcpRemoteJSON) RawJSON() string {
+func (r mcpRemoteConfigJSON) RawJSON() string {
return r.raw
}
-func (r McpRemote) implementsConfigMcp() {}
+func (r McpRemoteConfig) implementsConfigMcp() {}
// Type of MCP server connection
-type McpRemoteType string
+type McpRemoteConfigType string
const (
- McpRemoteTypeRemote McpRemoteType = "remote"
+ McpRemoteConfigTypeRemote McpRemoteConfigType = "remote"
)
-func (r McpRemoteType) IsKnown() bool {
+func (r McpRemoteConfigType) IsKnown() bool {
switch r {
- case McpRemoteTypeRemote:
+ case McpRemoteConfigTypeRemote:
return true
}
return false
}
-type Model struct {
- ID string `json:"id,required"`
- Attachment bool `json:"attachment,required"`
- Cost ModelCost `json:"cost,required"`
- Limit ModelLimit `json:"limit,required"`
- Name string `json:"name,required"`
- Options map[string]interface{} `json:"options,required"`
- Reasoning bool `json:"reasoning,required"`
- ReleaseDate string `json:"release_date,required"`
- Temperature bool `json:"temperature,required"`
- ToolCall bool `json:"tool_call,required"`
- JSON modelJSON `json:"-"`
-}
-
-// modelJSON contains the JSON metadata for the struct [Model]
-type modelJSON struct {
- ID apijson.Field
- Attachment apijson.Field
- Cost apijson.Field
- Limit apijson.Field
- Name apijson.Field
- Options apijson.Field
- Reasoning apijson.Field
- ReleaseDate apijson.Field
- Temperature apijson.Field
- ToolCall apijson.Field
- raw string
- ExtraFields map[string]apijson.Field
-}
-
-func (r *Model) UnmarshalJSON(data []byte) (err error) {
- return apijson.UnmarshalRoot(data, r)
+type ModeConfig struct {
+ Model string `json:"model"`
+ Prompt string `json:"prompt"`
+ Tools map[string]bool `json:"tools"`
+ JSON modeConfigJSON `json:"-"`
}
-func (r modelJSON) RawJSON() string {
- return r.raw
-}
-
-type ModelCost struct {
- Input float64 `json:"input,required"`
- Output float64 `json:"output,required"`
- CacheRead float64 `json:"cache_read"`
- CacheWrite float64 `json:"cache_write"`
- JSON modelCostJSON `json:"-"`
-}
-
-// modelCostJSON contains the JSON metadata for the struct [ModelCost]
-type modelCostJSON struct {
- Input apijson.Field
- Output apijson.Field
- CacheRead apijson.Field
- CacheWrite apijson.Field
- raw string
- ExtraFields map[string]apijson.Field
-}
-
-func (r *ModelCost) UnmarshalJSON(data []byte) (err error) {
- return apijson.UnmarshalRoot(data, r)
-}
-
-func (r modelCostJSON) RawJSON() string {
- return r.raw
-}
-
-type ModelLimit struct {
- Context float64 `json:"context,required"`
- Output float64 `json:"output,required"`
- JSON modelLimitJSON `json:"-"`
-}
-
-// modelLimitJSON contains the JSON metadata for the struct [ModelLimit]
-type modelLimitJSON struct {
- Context apijson.Field
- Output apijson.Field
- raw string
- ExtraFields map[string]apijson.Field
-}
-
-func (r *ModelLimit) UnmarshalJSON(data []byte) (err error) {
- return apijson.UnmarshalRoot(data, r)
-}
-
-func (r modelLimitJSON) RawJSON() string {
- return r.raw
-}
-
-type Provider struct {
- ID string `json:"id,required"`
- Env []string `json:"env,required"`
- Models map[string]Model `json:"models,required"`
- Name string `json:"name,required"`
- API string `json:"api"`
- Npm string `json:"npm"`
- JSON providerJSON `json:"-"`
-}
-
-// providerJSON contains the JSON metadata for the struct [Provider]
-type providerJSON struct {
- ID apijson.Field
- Env apijson.Field
- Models apijson.Field
- Name apijson.Field
- API apijson.Field
- Npm apijson.Field
- raw string
- ExtraFields map[string]apijson.Field
-}
-
-func (r *Provider) UnmarshalJSON(data []byte) (err error) {
- return apijson.UnmarshalRoot(data, r)
-}
-
-func (r providerJSON) RawJSON() string {
- return r.raw
-}
-
-type ConfigProvidersResponse struct {
- Default map[string]string `json:"default,required"`
- Providers []Provider `json:"providers,required"`
- JSON configProvidersResponseJSON `json:"-"`
-}
-
-// configProvidersResponseJSON contains the JSON metadata for the struct
-// [ConfigProvidersResponse]
-type configProvidersResponseJSON struct {
- Default apijson.Field
- Providers apijson.Field
+// modeConfigJSON contains the JSON metadata for the struct [ModeConfig]
+type modeConfigJSON struct {
+ Model apijson.Field
+ Prompt apijson.Field
+ Tools apijson.Field
raw string
ExtraFields map[string]apijson.Field
}
-func (r *ConfigProvidersResponse) UnmarshalJSON(data []byte) (err error) {
+func (r *ModeConfig) UnmarshalJSON(data []byte) (err error) {
return apijson.UnmarshalRoot(data, r)
}
-func (r configProvidersResponseJSON) RawJSON() string {
+func (r modeConfigJSON) RawJSON() string {
return r.raw
}
diff --git a/packages/tui/sdk/config_test.go b/packages/tui/sdk/config_test.go
index 57a1d158de..86e058a9a5 100644
--- a/packages/tui/sdk/config_test.go
+++ b/packages/tui/sdk/config_test.go
@@ -34,25 +34,3 @@ func TestConfigGet(t *testing.T) {
t.Fatalf("err should be nil: %s", err.Error())
}
}
-
-func TestConfigProviders(t *testing.T) {
- t.Skip("skipped: tests are disabled for the time being")
- baseURL := "http://localhost:4010"
- if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok {
- baseURL = envURL
- }
- if !testutil.CheckTestServer(t, baseURL) {
- return
- }
- client := opencode.NewClient(
- option.WithBaseURL(baseURL),
- )
- _, err := client.Config.Providers(context.TODO())
- if err != nil {
- var apierr *opencode.Error
- if errors.As(err, &apierr) {
- t.Log(string(apierr.DumpRequest(true)))
- }
- t.Fatalf("err should be nil: %s", err.Error())
- }
-}
diff --git a/packages/tui/sdk/event.go b/packages/tui/sdk/event.go
index 8bbf636c31..9002d2aac8 100644
--- a/packages/tui/sdk/event.go
+++ b/packages/tui/sdk/event.go
@@ -610,18 +610,14 @@ func (r eventListResponseEventMessagePartUpdatedJSON) RawJSON() string {
func (r EventListResponseEventMessagePartUpdated) implementsEventListResponse() {}
type EventListResponseEventMessagePartUpdatedProperties struct {
- MessageID string `json:"messageID,required"`
- Part AssistantMessagePart `json:"part,required"`
- SessionID string `json:"sessionID,required"`
- JSON eventListResponseEventMessagePartUpdatedPropertiesJSON `json:"-"`
+ Part Part `json:"part,required"`
+ JSON eventListResponseEventMessagePartUpdatedPropertiesJSON `json:"-"`
}
// eventListResponseEventMessagePartUpdatedPropertiesJSON contains the JSON
// metadata for the struct [EventListResponseEventMessagePartUpdatedProperties]
type eventListResponseEventMessagePartUpdatedPropertiesJSON struct {
- MessageID apijson.Field
Part apijson.Field
- SessionID apijson.Field
raw string
ExtraFields map[string]apijson.Field
}
diff --git a/packages/tui/sdk/scripts/lint b/packages/tui/sdk/scripts/lint
index 9f37abf280..7e03a7beb7 100755
--- a/packages/tui/sdk/scripts/lint
+++ b/packages/tui/sdk/scripts/lint
@@ -5,7 +5,7 @@ set -e
cd "$(dirname "$0")/.."
echo "==> Running Go build"
-go build .
+go build ./...
echo "==> Checking tests compile"
-go test -run=^$ .
+go test -run=^$ ./...
diff --git a/packages/tui/sdk/session.go b/packages/tui/sdk/session.go
index 6321d1ff65..bfb2e27731 100644
--- a/packages/tui/sdk/session.go
+++ b/packages/tui/sdk/session.go
@@ -101,7 +101,7 @@ func (r *SessionService) Init(ctx context.Context, id string, body SessionInitPa
}
// List messages for a session
-func (r *SessionService) Messages(ctx context.Context, id string, opts ...option.RequestOption) (res *[]Message, err error) {
+func (r *SessionService) Messages(ctx context.Context, id string, opts ...option.RequestOption) (res *[]SessionMessagesResponse, err error) {
opts = append(r.Options[:], opts...)
if id == "" {
err = errors.New("missing required id parameter")
@@ -152,7 +152,6 @@ type AssistantMessage struct {
ID string `json:"id,required"`
Cost float64 `json:"cost,required"`
ModelID string `json:"modelID,required"`
- Parts []AssistantMessagePart `json:"parts,required"`
Path AssistantMessagePath `json:"path,required"`
ProviderID string `json:"providerID,required"`
Role AssistantMessageRole `json:"role,required"`
@@ -171,7 +170,6 @@ type assistantMessageJSON struct {
ID apijson.Field
Cost apijson.Field
ModelID apijson.Field
- Parts apijson.Field
Path apijson.Field
ProviderID apijson.Field
Role apijson.Field
@@ -435,211 +433,23 @@ func (r AssistantMessageErrorName) IsKnown() bool {
return false
}
-type AssistantMessagePart struct {
- Type AssistantMessagePartType `json:"type,required"`
- ID string `json:"id"`
- Cost float64 `json:"cost"`
- // This field can have the runtime type of [ToolPartState].
- State interface{} `json:"state"`
- Synthetic bool `json:"synthetic"`
- Text string `json:"text"`
- // This field can have the runtime type of
- // [AssistantMessagePartStepFinishPartTokens].
- Tokens interface{} `json:"tokens"`
- Tool string `json:"tool"`
- JSON assistantMessagePartJSON `json:"-"`
- union AssistantMessagePartUnion
-}
-
-// assistantMessagePartJSON contains the JSON metadata for the struct
-// [AssistantMessagePart]
-type assistantMessagePartJSON struct {
- Type apijson.Field
- ID apijson.Field
- Cost apijson.Field
- State apijson.Field
- Synthetic apijson.Field
- Text apijson.Field
- Tokens apijson.Field
- Tool apijson.Field
- raw string
- ExtraFields map[string]apijson.Field
-}
-
-func (r assistantMessagePartJSON) RawJSON() string {
- return r.raw
-}
-
-func (r *AssistantMessagePart) UnmarshalJSON(data []byte) (err error) {
- *r = AssistantMessagePart{}
- err = apijson.UnmarshalRoot(data, &r.union)
- if err != nil {
- return err
- }
- return apijson.Port(r.union, &r)
-}
-
-// AsUnion returns a [AssistantMessagePartUnion] interface which you can cast to
-// the specific types for more type safety.
-//
-// Possible runtime types of the union are [TextPart], [ToolPart], [StepStartPart],
-// [AssistantMessagePartStepFinishPart].
-func (r AssistantMessagePart) AsUnion() AssistantMessagePartUnion {
- return r.union
-}
-
-// Union satisfied by [TextPart], [ToolPart], [StepStartPart] or
-// [AssistantMessagePartStepFinishPart].
-type AssistantMessagePartUnion interface {
- implementsAssistantMessagePart()
-}
-
-func init() {
- apijson.RegisterUnion(
- reflect.TypeOf((*AssistantMessagePartUnion)(nil)).Elem(),
- "type",
- apijson.UnionVariant{
- TypeFilter: gjson.JSON,
- Type: reflect.TypeOf(TextPart{}),
- DiscriminatorValue: "text",
- },
- apijson.UnionVariant{
- TypeFilter: gjson.JSON,
- Type: reflect.TypeOf(ToolPart{}),
- DiscriminatorValue: "tool",
- },
- apijson.UnionVariant{
- TypeFilter: gjson.JSON,
- Type: reflect.TypeOf(StepStartPart{}),
- DiscriminatorValue: "step-start",
- },
- apijson.UnionVariant{
- TypeFilter: gjson.JSON,
- Type: reflect.TypeOf(AssistantMessagePartStepFinishPart{}),
- DiscriminatorValue: "step-finish",
- },
- )
-}
-
-type AssistantMessagePartStepFinishPart struct {
- Cost float64 `json:"cost,required"`
- Tokens AssistantMessagePartStepFinishPartTokens `json:"tokens,required"`
- Type AssistantMessagePartStepFinishPartType `json:"type,required"`
- JSON assistantMessagePartStepFinishPartJSON `json:"-"`
-}
-
-// assistantMessagePartStepFinishPartJSON contains the JSON metadata for the struct
-// [AssistantMessagePartStepFinishPart]
-type assistantMessagePartStepFinishPartJSON struct {
- Cost apijson.Field
- Tokens apijson.Field
- Type apijson.Field
- raw string
- ExtraFields map[string]apijson.Field
-}
-
-func (r *AssistantMessagePartStepFinishPart) UnmarshalJSON(data []byte) (err error) {
- return apijson.UnmarshalRoot(data, r)
-}
-
-func (r assistantMessagePartStepFinishPartJSON) RawJSON() string {
- return r.raw
-}
-
-func (r AssistantMessagePartStepFinishPart) implementsAssistantMessagePart() {}
-
-type AssistantMessagePartStepFinishPartTokens struct {
- Cache AssistantMessagePartStepFinishPartTokensCache `json:"cache,required"`
- Input float64 `json:"input,required"`
- Output float64 `json:"output,required"`
- Reasoning float64 `json:"reasoning,required"`
- JSON assistantMessagePartStepFinishPartTokensJSON `json:"-"`
-}
-
-// assistantMessagePartStepFinishPartTokensJSON contains the JSON metadata for the
-// struct [AssistantMessagePartStepFinishPartTokens]
-type assistantMessagePartStepFinishPartTokensJSON struct {
- Cache apijson.Field
- Input apijson.Field
- Output apijson.Field
- Reasoning apijson.Field
- raw string
- ExtraFields map[string]apijson.Field
-}
-
-func (r *AssistantMessagePartStepFinishPartTokens) UnmarshalJSON(data []byte) (err error) {
- return apijson.UnmarshalRoot(data, r)
-}
-
-func (r assistantMessagePartStepFinishPartTokensJSON) RawJSON() string {
- return r.raw
-}
-
-type AssistantMessagePartStepFinishPartTokensCache struct {
- Read float64 `json:"read,required"`
- Write float64 `json:"write,required"`
- JSON assistantMessagePartStepFinishPartTokensCacheJSON `json:"-"`
-}
-
-// assistantMessagePartStepFinishPartTokensCacheJSON contains the JSON metadata for
-// the struct [AssistantMessagePartStepFinishPartTokensCache]
-type assistantMessagePartStepFinishPartTokensCacheJSON struct {
- Read apijson.Field
- Write apijson.Field
- raw string
- ExtraFields map[string]apijson.Field
-}
-
-func (r *AssistantMessagePartStepFinishPartTokensCache) UnmarshalJSON(data []byte) (err error) {
- return apijson.UnmarshalRoot(data, r)
-}
-
-func (r assistantMessagePartStepFinishPartTokensCacheJSON) RawJSON() string {
- return r.raw
-}
-
-type AssistantMessagePartStepFinishPartType string
-
-const (
- AssistantMessagePartStepFinishPartTypeStepFinish AssistantMessagePartStepFinishPartType = "step-finish"
-)
-
-func (r AssistantMessagePartStepFinishPartType) IsKnown() bool {
- switch r {
- case AssistantMessagePartStepFinishPartTypeStepFinish:
- return true
- }
- return false
-}
-
-type AssistantMessagePartType string
-
-const (
- AssistantMessagePartTypeText AssistantMessagePartType = "text"
- AssistantMessagePartTypeTool AssistantMessagePartType = "tool"
- AssistantMessagePartTypeStepStart AssistantMessagePartType = "step-start"
- AssistantMessagePartTypeStepFinish AssistantMessagePartType = "step-finish"
-)
-
-func (r AssistantMessagePartType) IsKnown() bool {
- switch r {
- case AssistantMessagePartTypeText, AssistantMessagePartTypeTool, AssistantMessagePartTypeStepStart, AssistantMessagePartTypeStepFinish:
- return true
- }
- return false
-}
-
type FilePart struct {
- Mime string `json:"mime,required"`
- Type FilePartType `json:"type,required"`
- URL string `json:"url,required"`
- Filename string `json:"filename"`
- JSON filePartJSON `json:"-"`
+ ID string `json:"id,required"`
+ MessageID string `json:"messageID,required"`
+ Mime string `json:"mime,required"`
+ SessionID string `json:"sessionID,required"`
+ Type FilePartType `json:"type,required"`
+ URL string `json:"url,required"`
+ Filename string `json:"filename"`
+ JSON filePartJSON `json:"-"`
}
// filePartJSON contains the JSON metadata for the struct [FilePart]
type filePartJSON struct {
+ ID apijson.Field
+ MessageID apijson.Field
Mime apijson.Field
+ SessionID apijson.Field
Type apijson.Field
URL apijson.Field
Filename apijson.Field
@@ -655,7 +465,7 @@ func (r filePartJSON) RawJSON() string {
return r.raw
}
-func (r FilePart) implementsUserMessagePart() {}
+func (r FilePart) implementsPart() {}
type FilePartType string
@@ -671,24 +481,36 @@ func (r FilePartType) IsKnown() bool {
return false
}
-type FilePartParam struct {
- Mime param.Field[string] `json:"mime,required"`
- Type param.Field[FilePartType] `json:"type,required"`
- URL param.Field[string] `json:"url,required"`
- Filename param.Field[string] `json:"filename"`
+type FilePartInputParam struct {
+ Mime param.Field[string] `json:"mime,required"`
+ Type param.Field[FilePartInputType] `json:"type,required"`
+ URL param.Field[string] `json:"url,required"`
+ ID param.Field[string] `json:"id"`
+ Filename param.Field[string] `json:"filename"`
}
-func (r FilePartParam) MarshalJSON() (data []byte, err error) {
+func (r FilePartInputParam) MarshalJSON() (data []byte, err error) {
return apijson.MarshalRoot(r)
}
-func (r FilePartParam) implementsUserMessagePartUnionParam() {}
+func (r FilePartInputParam) implementsSessionChatParamsPartUnion() {}
+
+type FilePartInputType string
+
+const (
+ FilePartInputTypeFile FilePartInputType = "file"
+)
+
+func (r FilePartInputType) IsKnown() bool {
+ switch r {
+ case FilePartInputTypeFile:
+ return true
+ }
+ return false
+}
type Message struct {
- ID string `json:"id,required"`
- // This field can have the runtime type of [[]UserMessagePart],
- // [[]AssistantMessagePart].
- Parts interface{} `json:"parts,required"`
+ ID string `json:"id,required"`
Role MessageRole `json:"role,required"`
SessionID string `json:"sessionID,required"`
// This field can have the runtime type of [UserMessageTime],
@@ -713,7 +535,6 @@ type Message struct {
// messageJSON contains the JSON metadata for the struct [Message]
type messageJSON struct {
ID apijson.Field
- Parts apijson.Field
Role apijson.Field
SessionID apijson.Field
Time apijson.Field
@@ -787,6 +608,136 @@ func (r MessageRole) IsKnown() bool {
return false
}
+type Part struct {
+ ID string `json:"id,required"`
+ MessageID string `json:"messageID,required"`
+ SessionID string `json:"sessionID,required"`
+ Type PartType `json:"type,required"`
+ CallID string `json:"callID"`
+ Cost float64 `json:"cost"`
+ Filename string `json:"filename"`
+ Mime string `json:"mime"`
+ Snapshot string `json:"snapshot"`
+ // This field can have the runtime type of [ToolPartState].
+ State interface{} `json:"state"`
+ Synthetic bool `json:"synthetic"`
+ Text string `json:"text"`
+ // This field can have the runtime type of [TextPartTime].
+ Time interface{} `json:"time"`
+ // This field can have the runtime type of [StepFinishPartTokens].
+ Tokens interface{} `json:"tokens"`
+ Tool string `json:"tool"`
+ URL string `json:"url"`
+ JSON partJSON `json:"-"`
+ union PartUnion
+}
+
+// partJSON contains the JSON metadata for the struct [Part]
+type partJSON struct {
+ ID apijson.Field
+ MessageID apijson.Field
+ SessionID apijson.Field
+ Type apijson.Field
+ CallID apijson.Field
+ Cost apijson.Field
+ Filename apijson.Field
+ Mime apijson.Field
+ Snapshot apijson.Field
+ State apijson.Field
+ Synthetic apijson.Field
+ Text apijson.Field
+ Time apijson.Field
+ Tokens apijson.Field
+ Tool apijson.Field
+ URL apijson.Field
+ raw string
+ ExtraFields map[string]apijson.Field
+}
+
+func (r partJSON) RawJSON() string {
+ return r.raw
+}
+
+func (r *Part) UnmarshalJSON(data []byte) (err error) {
+ *r = Part{}
+ err = apijson.UnmarshalRoot(data, &r.union)
+ if err != nil {
+ return err
+ }
+ return apijson.Port(r.union, &r)
+}
+
+// AsUnion returns a [PartUnion] interface which you can cast to the specific types
+// for more type safety.
+//
+// Possible runtime types of the union are [TextPart], [FilePart], [ToolPart],
+// [StepStartPart], [StepFinishPart], [SnapshotPart].
+func (r Part) AsUnion() PartUnion {
+ return r.union
+}
+
+// Union satisfied by [TextPart], [FilePart], [ToolPart], [StepStartPart],
+// [StepFinishPart] or [SnapshotPart].
+type PartUnion interface {
+ implementsPart()
+}
+
+func init() {
+ apijson.RegisterUnion(
+ reflect.TypeOf((*PartUnion)(nil)).Elem(),
+ "type",
+ apijson.UnionVariant{
+ TypeFilter: gjson.JSON,
+ Type: reflect.TypeOf(TextPart{}),
+ DiscriminatorValue: "text",
+ },
+ apijson.UnionVariant{
+ TypeFilter: gjson.JSON,
+ Type: reflect.TypeOf(FilePart{}),
+ DiscriminatorValue: "file",
+ },
+ apijson.UnionVariant{
+ TypeFilter: gjson.JSON,
+ Type: reflect.TypeOf(ToolPart{}),
+ DiscriminatorValue: "tool",
+ },
+ apijson.UnionVariant{
+ TypeFilter: gjson.JSON,
+ Type: reflect.TypeOf(StepStartPart{}),
+ DiscriminatorValue: "step-start",
+ },
+ apijson.UnionVariant{
+ TypeFilter: gjson.JSON,
+ Type: reflect.TypeOf(StepFinishPart{}),
+ DiscriminatorValue: "step-finish",
+ },
+ apijson.UnionVariant{
+ TypeFilter: gjson.JSON,
+ Type: reflect.TypeOf(SnapshotPart{}),
+ DiscriminatorValue: "snapshot",
+ },
+ )
+}
+
+type PartType string
+
+const (
+ PartTypeText PartType = "text"
+ PartTypeFile PartType = "file"
+ PartTypeTool PartType = "tool"
+ PartTypeStepStart PartType = "step-start"
+ PartTypeStepFinish PartType = "step-finish"
+ PartTypeSnapshot PartType = "snapshot"
+)
+
+func (r PartType) IsKnown() bool {
+ switch r {
+ case PartTypeText, PartTypeFile, PartTypeTool, PartTypeStepStart, PartTypeStepFinish, PartTypeSnapshot:
+ return true
+ }
+ return false
+}
+
type Session struct {
ID string `json:"id,required"`
Time SessionTime `json:"time,required"`
@@ -885,13 +836,159 @@ func (r sessionShareJSON) RawJSON() string {
return r.raw
}
+type SnapshotPart struct {
+ ID string `json:"id,required"`
+ MessageID string `json:"messageID,required"`
+ SessionID string `json:"sessionID,required"`
+ Snapshot string `json:"snapshot,required"`
+ Type SnapshotPartType `json:"type,required"`
+ JSON snapshotPartJSON `json:"-"`
+}
+
+// snapshotPartJSON contains the JSON metadata for the struct [SnapshotPart]
+type snapshotPartJSON struct {
+ ID apijson.Field
+ MessageID apijson.Field
+ SessionID apijson.Field
+ Snapshot apijson.Field
+ Type apijson.Field
+ raw string
+ ExtraFields map[string]apijson.Field
+}
+
+func (r *SnapshotPart) UnmarshalJSON(data []byte) (err error) {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+func (r snapshotPartJSON) RawJSON() string {
+ return r.raw
+}
+
+func (r SnapshotPart) implementsPart() {}
+
+type SnapshotPartType string
+
+const (
+ SnapshotPartTypeSnapshot SnapshotPartType = "snapshot"
+)
+
+func (r SnapshotPartType) IsKnown() bool {
+ switch r {
+ case SnapshotPartTypeSnapshot:
+ return true
+ }
+ return false
+}
+
+type StepFinishPart struct {
+ ID string `json:"id,required"`
+ Cost float64 `json:"cost,required"`
+ MessageID string `json:"messageID,required"`
+ SessionID string `json:"sessionID,required"`
+ Tokens StepFinishPartTokens `json:"tokens,required"`
+ Type StepFinishPartType `json:"type,required"`
+ JSON stepFinishPartJSON `json:"-"`
+}
+
+// stepFinishPartJSON contains the JSON metadata for the struct [StepFinishPart]
+type stepFinishPartJSON struct {
+ ID apijson.Field
+ Cost apijson.Field
+ MessageID apijson.Field
+ SessionID apijson.Field
+ Tokens apijson.Field
+ Type apijson.Field
+ raw string
+ ExtraFields map[string]apijson.Field
+}
+
+func (r *StepFinishPart) UnmarshalJSON(data []byte) (err error) {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+func (r stepFinishPartJSON) RawJSON() string {
+ return r.raw
+}
+
+func (r StepFinishPart) implementsPart() {}
+
+type StepFinishPartTokens struct {
+ Cache StepFinishPartTokensCache `json:"cache,required"`
+ Input float64 `json:"input,required"`
+ Output float64 `json:"output,required"`
+ Reasoning float64 `json:"reasoning,required"`
+ JSON stepFinishPartTokensJSON `json:"-"`
+}
+
+// stepFinishPartTokensJSON contains the JSON metadata for the struct
+// [StepFinishPartTokens]
+type stepFinishPartTokensJSON struct {
+ Cache apijson.Field
+ Input apijson.Field
+ Output apijson.Field
+ Reasoning apijson.Field
+ raw string
+ ExtraFields map[string]apijson.Field
+}
+
+func (r *StepFinishPartTokens) UnmarshalJSON(data []byte) (err error) {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+func (r stepFinishPartTokensJSON) RawJSON() string {
+ return r.raw
+}
+
+type StepFinishPartTokensCache struct {
+ Read float64 `json:"read,required"`
+ Write float64 `json:"write,required"`
+ JSON stepFinishPartTokensCacheJSON `json:"-"`
+}
+
+// stepFinishPartTokensCacheJSON contains the JSON metadata for the struct
+// [StepFinishPartTokensCache]
+type stepFinishPartTokensCacheJSON struct {
+ Read apijson.Field
+ Write apijson.Field
+ raw string
+ ExtraFields map[string]apijson.Field
+}
+
+func (r *StepFinishPartTokensCache) UnmarshalJSON(data []byte) (err error) {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+func (r stepFinishPartTokensCacheJSON) RawJSON() string {
+ return r.raw
+}
+
+type StepFinishPartType string
+
+const (
+ StepFinishPartTypeStepFinish StepFinishPartType = "step-finish"
+)
+
+func (r StepFinishPartType) IsKnown() bool {
+ switch r {
+ case StepFinishPartTypeStepFinish:
+ return true
+ }
+ return false
+}
+
type StepStartPart struct {
- Type StepStartPartType `json:"type,required"`
- JSON stepStartPartJSON `json:"-"`
+ ID string `json:"id,required"`
+ MessageID string `json:"messageID,required"`
+ SessionID string `json:"sessionID,required"`
+ Type StepStartPartType `json:"type,required"`
+ JSON stepStartPartJSON `json:"-"`
}
// stepStartPartJSON contains the JSON metadata for the struct [StepStartPart]
type stepStartPartJSON struct {
+ ID apijson.Field
+ MessageID apijson.Field
+ SessionID apijson.Field
Type apijson.Field
raw string
ExtraFields map[string]apijson.Field
@@ -905,7 +1002,7 @@ func (r stepStartPartJSON) RawJSON() string {
return r.raw
}
-func (r StepStartPart) implementsAssistantMessagePart() {}
+func (r StepStartPart) implementsPart() {}
type StepStartPartType string
@@ -922,17 +1019,25 @@ func (r StepStartPartType) IsKnown() bool {
}
type TextPart struct {
+ ID string `json:"id,required"`
+ MessageID string `json:"messageID,required"`
+ SessionID string `json:"sessionID,required"`
Text string `json:"text,required"`
Type TextPartType `json:"type,required"`
Synthetic bool `json:"synthetic"`
+ Time TextPartTime `json:"time"`
JSON textPartJSON `json:"-"`
}
// textPartJSON contains the JSON metadata for the struct [TextPart]
type textPartJSON struct {
+ ID apijson.Field
+ MessageID apijson.Field
+ SessionID apijson.Field
Text apijson.Field
Type apijson.Field
Synthetic apijson.Field
+ Time apijson.Field
raw string
ExtraFields map[string]apijson.Field
}
@@ -945,9 +1050,7 @@ func (r textPartJSON) RawJSON() string {
return r.raw
}
-func (r TextPart) implementsAssistantMessagePart() {}
-
-func (r TextPart) implementsUserMessagePart() {}
+func (r TextPart) implementsPart() {}
type TextPartType string
@@ -963,29 +1066,82 @@ func (r TextPartType) IsKnown() bool {
return false
}
-type TextPartParam struct {
- Text param.Field[string] `json:"text,required"`
- Type param.Field[TextPartType] `json:"type,required"`
- Synthetic param.Field[bool] `json:"synthetic"`
+type TextPartTime struct {
+ Start float64 `json:"start,required"`
+ End float64 `json:"end"`
+ JSON textPartTimeJSON `json:"-"`
+}
+
+// textPartTimeJSON contains the JSON metadata for the struct [TextPartTime]
+type textPartTimeJSON struct {
+ Start apijson.Field
+ End apijson.Field
+ raw string
+ ExtraFields map[string]apijson.Field
+}
+
+func (r *TextPartTime) UnmarshalJSON(data []byte) (err error) {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+func (r textPartTimeJSON) RawJSON() string {
+ return r.raw
+}
+
+type TextPartInputParam struct {
+ Text param.Field[string] `json:"text,required"`
+ Type param.Field[TextPartInputType] `json:"type,required"`
+ ID param.Field[string] `json:"id"`
+ Synthetic param.Field[bool] `json:"synthetic"`
+ Time param.Field[TextPartInputTimeParam] `json:"time"`
}
-func (r TextPartParam) MarshalJSON() (data []byte, err error) {
+func (r TextPartInputParam) MarshalJSON() (data []byte, err error) {
return apijson.MarshalRoot(r)
}
-func (r TextPartParam) implementsUserMessagePartUnionParam() {}
+func (r TextPartInputParam) implementsSessionChatParamsPartUnion() {}
+
+type TextPartInputType string
+
+const (
+ TextPartInputTypeText TextPartInputType = "text"
+)
+
+func (r TextPartInputType) IsKnown() bool {
+ switch r {
+ case TextPartInputTypeText:
+ return true
+ }
+ return false
+}
+
+type TextPartInputTimeParam struct {
+ Start param.Field[float64] `json:"start,required"`
+ End param.Field[float64] `json:"end"`
+}
+
+func (r TextPartInputTimeParam) MarshalJSON() (data []byte, err error) {
+ return apijson.MarshalRoot(r)
+}
type ToolPart struct {
- ID string `json:"id,required"`
- State ToolPartState `json:"state,required"`
- Tool string `json:"tool,required"`
- Type ToolPartType `json:"type,required"`
- JSON toolPartJSON `json:"-"`
+ ID string `json:"id,required"`
+ CallID string `json:"callID,required"`
+ MessageID string `json:"messageID,required"`
+ SessionID string `json:"sessionID,required"`
+ State ToolPartState `json:"state,required"`
+ Tool string `json:"tool,required"`
+ Type ToolPartType `json:"type,required"`
+ JSON toolPartJSON `json:"-"`
}
// toolPartJSON contains the JSON metadata for the struct [ToolPart]
type toolPartJSON struct {
ID apijson.Field
+ CallID apijson.Field
+ MessageID apijson.Field
+ SessionID apijson.Field
State apijson.Field
Tool apijson.Field
Type apijson.Field
@@ -1001,7 +1157,7 @@ func (r toolPartJSON) RawJSON() string {
return r.raw
}
-func (r ToolPart) implementsAssistantMessagePart() {}
+func (r ToolPart) implementsPart() {}
type ToolPartState struct {
Status ToolPartStateStatus `json:"status,required"`
@@ -1357,18 +1513,16 @@ func (r toolStateRunningTimeJSON) RawJSON() string {
}
type UserMessage struct {
- ID string `json:"id,required"`
- Parts []UserMessagePart `json:"parts,required"`
- Role UserMessageRole `json:"role,required"`
- SessionID string `json:"sessionID,required"`
- Time UserMessageTime `json:"time,required"`
- JSON userMessageJSON `json:"-"`
+ ID string `json:"id,required"`
+ Role UserMessageRole `json:"role,required"`
+ SessionID string `json:"sessionID,required"`
+ Time UserMessageTime `json:"time,required"`
+ JSON userMessageJSON `json:"-"`
}
// userMessageJSON contains the JSON metadata for the struct [UserMessage]
type userMessageJSON struct {
ID apijson.Field
- Parts apijson.Field
Role apijson.Field
SessionID apijson.Field
Time apijson.Field
@@ -1420,119 +1574,81 @@ func (r userMessageTimeJSON) RawJSON() string {
return r.raw
}
-type UserMessagePart struct {
- Type UserMessagePartType `json:"type,required"`
- Filename string `json:"filename"`
- Mime string `json:"mime"`
- Synthetic bool `json:"synthetic"`
- Text string `json:"text"`
- URL string `json:"url"`
- JSON userMessagePartJSON `json:"-"`
- union UserMessagePartUnion
+type SessionMessagesResponse struct {
+ Info Message `json:"info,required"`
+ Parts []Part `json:"parts,required"`
+ JSON sessionMessagesResponseJSON `json:"-"`
}
-// userMessagePartJSON contains the JSON metadata for the struct [UserMessagePart]
-type userMessagePartJSON struct {
- Type apijson.Field
- Filename apijson.Field
- Mime apijson.Field
- Synthetic apijson.Field
- Text apijson.Field
- URL apijson.Field
+// sessionMessagesResponseJSON contains the JSON metadata for the struct
+// [SessionMessagesResponse]
+type sessionMessagesResponseJSON struct {
+ Info apijson.Field
+ Parts apijson.Field
raw string
ExtraFields map[string]apijson.Field
}
-func (r userMessagePartJSON) RawJSON() string {
+func (r *SessionMessagesResponse) UnmarshalJSON(data []byte) (err error) {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+func (r sessionMessagesResponseJSON) RawJSON() string {
return r.raw
}
-func (r *UserMessagePart) UnmarshalJSON(data []byte) (err error) {
- *r = UserMessagePart{}
- err = apijson.UnmarshalRoot(data, &r.union)
- if err != nil {
- return err
- }
- return apijson.Port(r.union, &r)
+type SessionChatParams struct {
+ ModelID param.Field[string] `json:"modelID,required"`
+ Parts param.Field[[]SessionChatParamsPartUnion] `json:"parts,required"`
+ ProviderID param.Field[string] `json:"providerID,required"`
+ MessageID param.Field[string] `json:"messageID"`
+ Mode param.Field[string] `json:"mode"`
}
-// AsUnion returns a [UserMessagePartUnion] interface which you can cast to the
-// specific types for more type safety.
-//
-// Possible runtime types of the union are [TextPart], [FilePart].
-func (r UserMessagePart) AsUnion() UserMessagePartUnion {
- return r.union
+func (r SessionChatParams) MarshalJSON() (data []byte, err error) {
+ return apijson.MarshalRoot(r)
}
-// Union satisfied by [TextPart] or [FilePart].
-type UserMessagePartUnion interface {
- implementsUserMessagePart()
+type SessionChatParamsPart struct {
+ Type param.Field[SessionChatParamsPartsType] `json:"type,required"`
+ ID param.Field[string] `json:"id"`
+ Filename param.Field[string] `json:"filename"`
+ Mime param.Field[string] `json:"mime"`
+ Synthetic param.Field[bool] `json:"synthetic"`
+ Text param.Field[string] `json:"text"`
+ Time param.Field[interface{}] `json:"time"`
+ URL param.Field[string] `json:"url"`
}
-func init() {
- apijson.RegisterUnion(
- reflect.TypeOf((*UserMessagePartUnion)(nil)).Elem(),
- "type",
- apijson.UnionVariant{
- TypeFilter: gjson.JSON,
- Type: reflect.TypeOf(TextPart{}),
- DiscriminatorValue: "text",
- },
- apijson.UnionVariant{
- TypeFilter: gjson.JSON,
- Type: reflect.TypeOf(FilePart{}),
- DiscriminatorValue: "file",
- },
- )
+func (r SessionChatParamsPart) MarshalJSON() (data []byte, err error) {
+ return apijson.MarshalRoot(r)
}
-type UserMessagePartType string
+func (r SessionChatParamsPart) implementsSessionChatParamsPartUnion() {}
+
+// Satisfied by [TextPartInputParam], [FilePartInputParam],
+// [SessionChatParamsPart].
+type SessionChatParamsPartUnion interface {
+ implementsSessionChatParamsPartUnion()
+}
+
+type SessionChatParamsPartsType string
const (
- UserMessagePartTypeText UserMessagePartType = "text"
- UserMessagePartTypeFile UserMessagePartType = "file"
+ SessionChatParamsPartsTypeText SessionChatParamsPartsType = "text"
+ SessionChatParamsPartsTypeFile SessionChatParamsPartsType = "file"
)
-func (r UserMessagePartType) IsKnown() bool {
+func (r SessionChatParamsPartsType) IsKnown() bool {
switch r {
- case UserMessagePartTypeText, UserMessagePartTypeFile:
+ case SessionChatParamsPartsTypeText, SessionChatParamsPartsTypeFile:
return true
}
return false
}
-type UserMessagePartParam struct {
- Type param.Field[UserMessagePartType] `json:"type,required"`
- Filename param.Field[string] `json:"filename"`
- Mime param.Field[string] `json:"mime"`
- Synthetic param.Field[bool] `json:"synthetic"`
- Text param.Field[string] `json:"text"`
- URL param.Field[string] `json:"url"`
-}
-
-func (r UserMessagePartParam) MarshalJSON() (data []byte, err error) {
- return apijson.MarshalRoot(r)
-}
-
-func (r UserMessagePartParam) implementsUserMessagePartUnionParam() {}
-
-// Satisfied by [TextPartParam], [FilePartParam], [UserMessagePartParam].
-type UserMessagePartUnionParam interface {
- implementsUserMessagePartUnionParam()
-}
-
-type SessionChatParams struct {
- Mode param.Field[string] `json:"mode,required"`
- ModelID param.Field[string] `json:"modelID,required"`
- Parts param.Field[[]UserMessagePartUnionParam] `json:"parts,required"`
- ProviderID param.Field[string] `json:"providerID,required"`
-}
-
-func (r SessionChatParams) MarshalJSON() (data []byte, err error) {
- return apijson.MarshalRoot(r)
-}
-
type SessionInitParams struct {
+ MessageID param.Field[string] `json:"messageID,required"`
ModelID param.Field[string] `json:"modelID,required"`
ProviderID param.Field[string] `json:"providerID,required"`
}
diff --git a/packages/tui/sdk/session_test.go b/packages/tui/sdk/session_test.go
index 4ff2818c5e..b96a98b9de 100644
--- a/packages/tui/sdk/session_test.go
+++ b/packages/tui/sdk/session_test.go
@@ -101,7 +101,7 @@ func TestSessionAbort(t *testing.T) {
}
}
-func TestSessionChat(t *testing.T) {
+func TestSessionChatWithOptionalParams(t *testing.T) {
t.Skip("skipped: tests are disabled for the time being")
baseURL := "http://localhost:4010"
if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok {
@@ -117,14 +117,20 @@ func TestSessionChat(t *testing.T) {
context.TODO(),
"id",
opencode.SessionChatParams{
- Mode: opencode.F("mode"),
ModelID: opencode.F("modelID"),
- Parts: opencode.F([]opencode.UserMessagePartUnionParam{opencode.TextPartParam{
+ Parts: opencode.F([]opencode.SessionChatParamsPartUnion{opencode.TextPartInputParam{
Text: opencode.F("text"),
- Type: opencode.F(opencode.TextPartTypeText),
+ Type: opencode.F(opencode.TextPartInputTypeText),
+ ID: opencode.F("id"),
Synthetic: opencode.F(true),
+ Time: opencode.F(opencode.TextPartInputTimeParam{
+ Start: opencode.F(0.000000),
+ End: opencode.F(0.000000),
+ }),
}}),
ProviderID: opencode.F("providerID"),
+ MessageID: opencode.F("msg"),
+ Mode: opencode.F("mode"),
},
)
if err != nil {
@@ -152,6 +158,7 @@ func TestSessionInit(t *testing.T) {
context.TODO(),
"id",
opencode.SessionInitParams{
+ MessageID: opencode.F("messageID"),
ModelID: opencode.F("modelID"),
ProviderID: opencode.F("providerID"),
},
diff --git a/packages/tui/sdk/usage_test.go b/packages/tui/sdk/usage_test.go
index 0e261a7aac..ef7ce8bde5 100644
--- a/packages/tui/sdk/usage_test.go
+++ b/packages/tui/sdk/usage_test.go
@@ -23,10 +23,10 @@ func TestUsage(t *testing.T) {
client := opencode.NewClient(
option.WithBaseURL(baseURL),
)
- events, err := client.Event.List(context.TODO())
+ sessions, err := client.Session.List(context.TODO())
if err != nil {
t.Error(err)
return
}
- t.Logf("%+v\n", events)
+ t.Logf("%+v\n", sessions)
}
diff --git a/packages/web/astro.config.mjs b/packages/web/astro.config.mjs
index 542e0284bf..a250ce60b9 100644
--- a/packages/web/astro.config.mjs
+++ b/packages/web/astro.config.mjs
@@ -33,6 +33,7 @@ export default defineConfig({
solidJs(),
starlight({
title: "opencode",
+ lastUpdated: true,
expressiveCode: { themes: ["github-light", "github-dark"] },
social: [
{ icon: "github", label: "GitHub", href: config.github },
diff --git a/packages/web/package.json b/packages/web/package.json
index 9755b01243..548c84c39f 100644
--- a/packages/web/package.json
+++ b/packages/web/package.json
@@ -27,6 +27,7 @@
"marked": "15.0.12",
"marked-shiki": "1.2.0",
"rehype-autolink-headings": "7.1.0",
+ "remeda": "2.26.0",
"sharp": "0.32.5",
"shiki": "3.4.2",
"solid-js": "1.9.7",
diff --git a/packages/web/src/assets/lander/screenshot.png b/packages/web/src/assets/lander/screenshot.png
index d49a62b4d3..feb6175851 100644
Binary files a/packages/web/src/assets/lander/screenshot.png and b/packages/web/src/assets/lander/screenshot.png differ
diff --git a/packages/web/src/components/Share.tsx b/packages/web/src/components/Share.tsx
index 84e0a1ffbc..7d9265bbd1 100644
--- a/packages/web/src/components/Share.tsx
+++ b/packages/web/src/components/Share.tsx
@@ -1,6 +1,7 @@
-import { For, Show, onMount, Suspense, onCleanup, createMemo, createSignal, SuspenseList } from "solid-js"
+import { For, Show, onMount, Suspense, onCleanup, createMemo, createSignal, SuspenseList, createEffect } from "solid-js"
import { DateTime } from "luxon"
-import { createStore, reconcile } from "solid-js/store"
+import { createStore, reconcile, unwrap } from "solid-js/store"
+import { mapValues } from "remeda"
import { IconArrowDown } from "./icons"
import { IconOpencode } from "./icons/custom"
import styles from "./share.module.css"
@@ -9,6 +10,8 @@ import type { Message } from "opencode/session/message"
import type { Session } from "opencode/session/index"
import { Part, ProviderIcon } from "./share/part"
+type MessageWithParts = MessageV2.Info & { parts: MessageV2.Part[] }
+
type Status = "disconnected" | "connecting" | "connected" | "error" | "reconnecting"
function scrollToAnchor(id: string) {
@@ -39,7 +42,7 @@ export default function Share(props: {
id: string
api: string
info: Session.Info
- messages: Record
+ messages: Record
}) {
let lastScrollY = 0
let hasScrolledToAnchor = false
@@ -57,10 +60,13 @@ export default function Share(props: {
const [store, setStore] = createStore<{
info?: Session.Info
- messages: Record
- }>({ info: props.info, messages: props.messages })
+ messages: Record
+ }>({ info: props.info, messages: mapValues(props.messages, (x: any) => "metadata" in x ? fromV1(x) : x) })
const messages = createMemo(() => Object.values(store.messages).toSorted((a, b) => a.id?.localeCompare(b.id)))
const [connectionStatus, setConnectionStatus] = createSignal<[Status, string?]>(["disconnected", "Disconnected"])
+ createEffect(() => {
+ console.log(unwrap(store))
+ })
onMount(() => {
const apiUrl = props.api
@@ -115,8 +121,22 @@ export default function Share(props: {
}
if (type === "message") {
const [, messageID] = splits
+ if ("metadata" in d.content) {
+ d.content = fromV1(d.content)
+ }
+ d.content.parts = d.content.parts ?? store.messages[messageID]?.parts ?? []
setStore("messages", messageID, reconcile(d.content))
}
+ if (type === "part") {
+ setStore("messages", d.content.messageID, "parts", arr => {
+ const index = arr.findIndex((x) => x.id === d.content.id)
+ if (index === -1)
+ arr.push(d.content)
+ if (index > -1)
+ arr[index] = d.content
+ return [...arr]
+ })
+ }
} catch (error) {
console.error("Error parsing WebSocket message:", error)
}
@@ -233,7 +253,7 @@ export default function Share(props: {
rootDir: undefined as string | undefined,
created: undefined as number | undefined,
completed: undefined as number | undefined,
- messages: [] as MessageV2.Info[],
+ messages: [] as MessageWithParts[],
models: {} as Record,
cost: 0,
tokens: {
@@ -247,7 +267,7 @@ export default function Share(props: {
const msgs = messages()
for (let i = 0; i < msgs.length; i++) {
- const msg = "metadata" in msgs[i] ? fromV1(msgs[i] as Message.Info) : (msgs[i] as MessageV2.Info)
+ const msg = msgs[i]
result.messages.push(msg)
@@ -321,6 +341,8 @@ export default function Share(props: {
const filteredParts = createMemo(() =>
msg.parts.filter((x, index) => {
if (x.type === "step-start" && index > 0) return false
+ if (x.type === "snapshot") return false
+ if (x.type === "step-finish") return false
if (x.type === "text" && x.synthetic === true) return false
if (x.type === "tool" && x.tool === "todoread") return false
if (x.type === "text" && !x.text) return false
@@ -463,9 +485,9 @@ export default function Share(props: {
)
}
-export function fromV1(v1: Message.Info): MessageV2.Info {
+export function fromV1(v1: Message.Info): MessageWithParts {
if (v1.role === "assistant") {
- const result: MessageV2.Assistant = {
+ return {
id: v1.id,
sessionID: v1.metadata.sessionID,
role: "assistant",
@@ -476,15 +498,29 @@ export function fromV1(v1: Message.Info): MessageV2.Info {
cost: v1.metadata.assistant!.cost,
path: v1.metadata.assistant!.path,
summary: v1.metadata.assistant!.summary,
- tokens: v1.metadata.assistant!.tokens,
+ tokens: v1.metadata.assistant!.tokens ?? {
+ input: 0,
+ output: 0,
+ cache: {
+ read: 0,
+ write: 0,
+ },
+ reasoning: 0,
+ },
modelID: v1.metadata.assistant!.modelID,
providerID: v1.metadata.assistant!.providerID,
system: v1.metadata.assistant!.system,
error: v1.metadata.error,
- parts: v1.parts.flatMap((part): MessageV2.AssistantPart[] => {
+ parts: v1.parts.flatMap((part, index): MessageV2.Part[] => {
+ const base = {
+ id: index.toString(),
+ messageID: v1.id,
+ sessionID: v1.metadata.sessionID,
+ }
if (part.type === "text") {
return [
{
+ ...base,
type: "text",
text: part.text,
},
@@ -493,6 +529,7 @@ export function fromV1(v1: Message.Info): MessageV2.Info {
if (part.type === "step-start") {
return [
{
+ ...base,
type: "step-start",
},
]
@@ -500,8 +537,9 @@ export function fromV1(v1: Message.Info): MessageV2.Info {
if (part.type === "tool-invocation") {
return [
{
+ ...base,
type: "tool",
- id: part.toolInvocation.toolCallId,
+ callID: part.toolInvocation.toolCallId,
tool: part.toolInvocation.toolName,
state: (() => {
if (part.toolInvocation.state === "partial-call") {
@@ -539,21 +577,26 @@ export function fromV1(v1: Message.Info): MessageV2.Info {
return []
}),
}
- return result
}
if (v1.role === "user") {
- const result: MessageV2.User = {
+ return {
id: v1.id,
sessionID: v1.metadata.sessionID,
role: "user",
time: {
created: v1.metadata.time.created,
},
- parts: v1.parts.flatMap((part): MessageV2.UserPart[] => {
+ parts: v1.parts.flatMap((part, index): MessageV2.Part[] => {
+ const base = {
+ id: index.toString(),
+ messageID: v1.id,
+ sessionID: v1.metadata.sessionID,
+ }
if (part.type === "text") {
return [
{
+ ...base,
type: "text",
text: part.text,
},
@@ -562,6 +605,7 @@ export function fromV1(v1: Message.Info): MessageV2.Info {
if (part.type === "file") {
return [
{
+ ...base,
type: "file",
mime: part.mediaType,
filename: part.filename,
@@ -572,7 +616,6 @@ export function fromV1(v1: Message.Info): MessageV2.Info {
return []
}),
}
- return result
}
throw new Error("unknown message type")
diff --git a/packages/web/src/components/icons/custom.tsx b/packages/web/src/components/icons/custom.tsx
index 95f64c1919..ba06ddfb3a 100644
--- a/packages/web/src/components/icons/custom.tsx
+++ b/packages/web/src/components/icons/custom.tsx
@@ -58,3 +58,11 @@ export function IconMeta(props: JSX.SvgSVGAttributes) {
)
}
+
+// https://icones.js.org/collection/ri?s=robot&icon=ri:robot-2-line
+export function IconRobot(props: JSX.SvgSVGAttributes) {
+ return (
+
+ )
+}
diff --git a/packages/web/src/components/share/content-code.tsx b/packages/web/src/components/share/content-code.tsx
index 72352d1e92..2f383b8be1 100644
--- a/packages/web/src/components/share/content-code.tsx
+++ b/packages/web/src/components/share/content-code.tsx
@@ -1,4 +1,4 @@
-import { codeToHtml } from "shiki"
+import { codeToHtml, bundledLanguages } from "shiki"
import { createResource, Suspense } from "solid-js"
import { transformerNotationDiff } from "@shikijs/transformers"
import style from "./content-code.module.css"
@@ -15,7 +15,7 @@ export function ContentCode(props: Props) {
// TODO: For testing delays
// await new Promise((resolve) => setTimeout(resolve, 3000))
return (await codeToHtml(code || "", {
- lang: lang || "text",
+ lang: lang && lang in bundledLanguages ? lang : "text",
themes: {
light: "github-light",
dark: "github-dark",
diff --git a/packages/web/src/components/share/content-diff.module.css b/packages/web/src/components/share/content-diff.module.css
index 18854a889e..5bf6e22435 100644
--- a/packages/web/src/components/share/content-diff.module.css
+++ b/packages/web/src/components/share/content-diff.module.css
@@ -23,6 +23,20 @@
grid-template-columns: 1fr 1fr;
align-items: stretch;
+ &:first-child {
+ [data-slot="before"],
+ [data-slot="after"] {
+ padding-top: 0.25rem;
+ }
+ }
+
+ &:last-child {
+ [data-slot="before"],
+ [data-slot="after"] {
+ padding-bottom: 0.25rem;
+ }
+ }
+
[data-slot="before"],
[data-slot="after"] {
position: relative;
@@ -75,46 +89,16 @@
}
}
- /* .diff > .row:first-child [data-section="cell"]:first-child { */
- /* padding-top: 0.5rem; */
- /* } */
- /**/
- /* .diff > .row:last-child [data-section="cell"]:last-child { */
- /* padding-bottom: 0.5rem; */
- /* } */
- /**/
- /* [data-section="cell"] { */
- /* position: relative; */
- /* flex: 1; */
- /* display: flex; */
- /* flex-direction: column; */
- /**/
- /* width: 100%; */
- /* padding: 0.1875rem 0.5rem 0.1875rem 2.2ch; */
- /* margin: 0; */
- /**/
- /* &[data-display-mobile="true"] { */
- /* display: none; */
- /* } */
- /**/
- /* pre { */
- /* --shiki-dark-bg: var(--sl-color-bg-surface) !important; */
- /* background-color: var(--sl-color-bg-surface) !important; */
- /**/
- /* white-space: pre-wrap; */
- /* word-break: break-word; */
- /**/
- /* code > span:empty::before { */
- /* content: "\00a0"; */
- /* white-space: pre; */
- /* display: inline-block; */
- /* width: 0; */
- /* } */
- /* } */
- /* } */
-
[data-component="mobile"] {
+ & > [data-component="diff-block"]:first-child > div {
+ padding-top: 0.25rem;
+ }
+
+ & > [data-component="diff-block"]:last-child > div {
+ padding-bottom: 0.25rem;
+ }
+
& > [data-component="diff-block"] > div {
padding: 0 1rem 0 2.2ch;
diff --git a/packages/web/src/components/share/content-diff.tsx b/packages/web/src/components/share/content-diff.tsx
index c196c4bcba..45249e0cda 100644
--- a/packages/web/src/components/share/content-diff.tsx
+++ b/packages/web/src/components/share/content-diff.tsx
@@ -1,5 +1,5 @@
-import { type Component, createMemo } from "solid-js"
import { parsePatch } from "diff"
+import { createMemo } from "solid-js"
import { ContentCode } from "./content-code"
import styles from "./content-diff.module.css"
@@ -90,8 +90,8 @@ export function ContentDiff(props: Props) {
i++
} else if (prefix === " ") {
diffRows.push({
- left: content,
- right: content,
+ left: content === "" ? " " : content,
+ right: content === "" ? " " : content,
type: "unchanged",
})
i++
diff --git a/packages/web/src/components/share/content-markdown.module.css b/packages/web/src/components/share/content-markdown.module.css
index 0e6b836207..3e38ddf025 100644
--- a/packages/web/src/components/share/content-markdown.module.css
+++ b/packages/web/src/components/share/content-markdown.module.css
@@ -1,21 +1,13 @@
.root {
- border: 1px solid var(--sl-color-blue-high);
- padding: 0.5rem calc(0.5rem + 3px);
- border-radius: 0.25rem;
display: flex;
flex-direction: column;
align-items: flex-start;
gap: 1rem;
- align-self: flex-start;
-
- &[data-highlight="true"] {
- background-color: var(--sl-color-blue-low);
- }
[data-slot="expand-button"] {
flex: 0 0 auto;
padding: 2px 0;
- font-size: 0.75rem;
+ font-size: 0.857em;
}
[data-slot="markdown"] {
@@ -29,7 +21,7 @@
display: block;
}
- font-size: 0.875rem;
+ font-size: 1em;
line-height: 1.5;
p,
@@ -61,7 +53,7 @@
h4,
h5,
h6 {
- font-size: 0.875rem;
+ font-size: 1em;
font-weight: 600;
margin-bottom: 0.5rem;
}
@@ -75,7 +67,7 @@
background-color: var(--sl-color-bg-surface) !important;
padding: 0.5rem 0.75rem;
line-height: 1.6;
- font-size: 0.75rem;
+ font-size: 0.857em;
white-space: pre-wrap;
word-break: break-word;
diff --git a/packages/web/src/components/share/content-markdown.tsx b/packages/web/src/components/share/content-markdown.tsx
index f792712968..69cde82b2c 100644
--- a/packages/web/src/components/share/content-markdown.tsx
+++ b/packages/web/src/components/share/content-markdown.tsx
@@ -1,10 +1,11 @@
-import style from "./content-markdown.module.css"
-import { createResource, createSignal } from "solid-js"
-import { createOverflow } from "./common"
-import { transformerNotationDiff } from "@shikijs/transformers"
import { marked } from "marked"
-import markedShiki from "marked-shiki"
import { codeToHtml } from "shiki"
+import markedShiki from "marked-shiki"
+import { createOverflow } from "./common"
+import { CopyButton } from "./copy-button"
+import { createResource, createSignal } from "solid-js"
+import { transformerNotationDiff } from "@shikijs/transformers"
+import style from "./content-markdown.module.css"
const markedWithShiki = marked.use(
markedShiki({
@@ -54,6 +55,7 @@ export function ContentMarkdown(props: Props) {
{expanded() ? "Show less" : "Show more"}
)}
+
)
}
diff --git a/packages/web/src/components/share/content-text.module.css b/packages/web/src/components/share/content-text.module.css
index 203f0d06d1..a3842275c1 100644
--- a/packages/web/src/components/share/content-text.module.css
+++ b/packages/web/src/components/share/content-text.module.css
@@ -2,6 +2,7 @@
color: var(--sl-color-text);
background-color: var(--sl-color-bg-surface);
padding: 0.5rem calc(0.5rem + 3px);
+ padding-right: calc(1rem + 18px);
border-radius: 0.25rem;
display: flex;
flex-direction: column;
diff --git a/packages/web/src/components/share/copy-button.module.css b/packages/web/src/components/share/copy-button.module.css
new file mode 100644
index 0000000000..9da67a1ba6
--- /dev/null
+++ b/packages/web/src/components/share/copy-button.module.css
@@ -0,0 +1,31 @@
+.root {
+ position: absolute;
+ opacity: 0;
+ visibility: hidden;
+ transition: opacity 0.15s ease;
+
+ button {
+ cursor: pointer;
+ background: none;
+ border: none;
+ padding: 0.125rem;
+ background-color: var(--sl-color-bg);
+ color: var(--sl-color-text-secondary);
+
+ svg {
+ display: block;
+ width: 1rem;
+ height: 1rem;
+ }
+
+ &[data-copied="true"] {
+ color: var(--sl-color-green-high);
+ }
+ }
+}
+
+/* Show copy button when parent is hovered */
+*:hover > .root {
+ opacity: 1;
+ visibility: visible;
+}
diff --git a/packages/web/src/components/share/copy-button.tsx b/packages/web/src/components/share/copy-button.tsx
new file mode 100644
index 0000000000..ad2e83b2e8
--- /dev/null
+++ b/packages/web/src/components/share/copy-button.tsx
@@ -0,0 +1,36 @@
+import { createSignal } from "solid-js"
+import { IconClipboard, IconCheckCircle } from "../icons"
+import styles from "./copy-button.module.css"
+
+interface CopyButtonProps {
+ text: string
+}
+
+export function CopyButton(props: CopyButtonProps) {
+ const [copied, setCopied] = createSignal(false)
+
+ function handleCopyClick() {
+ if (props.text) {
+ navigator.clipboard.writeText(props.text)
+ .catch((err) => console.error("Copy failed", err))
+
+ setCopied(true)
+ setTimeout(() => setCopied(false), 2000)
+ }
+ }
+
+ return (
+
+
+
+ )
+}
diff --git a/packages/web/src/components/share/part.module.css b/packages/web/src/components/share/part.module.css
index 5ffb83f6b5..ffae0c3b78 100644
--- a/packages/web/src/components/share/part.module.css
+++ b/packages/web/src/components/share/part.module.css
@@ -103,7 +103,7 @@
[data-component="content"] {
flex: 1 1 auto;
min-width: 0;
- padding: 0 0 0.375rem;
+ padding: 0 0 1rem;
display: flex;
flex-direction: column;
gap: 1rem;
@@ -135,6 +135,20 @@
gap: 1rem;
flex-grow: 1;
max-width: var(--md-tool-width);
+
+ & > [data-component="assistant-text-markdown"] {
+ align-self: flex-start;
+ font-size: 0.875rem;
+ border: 1px solid var(--sl-color-blue-high);
+ padding: 0.5rem calc(0.5rem + 3px);
+ border-radius: 0.25rem;
+ position: relative;
+
+ [data-component="copy-button"] {
+ top: 0.5rem;
+ right: calc(0.5rem - 1px);
+ }
+ }
}
[data-component="step-start"] {
@@ -142,7 +156,6 @@
flex-direction: column;
align-items: flex-start;
gap: 0.375rem;
- padding-bottom: 1rem;
[data-slot="provider"] {
line-height: 18px;
@@ -237,6 +250,32 @@
&[data-tool="edit"] {
[data-component="tool-result"] {
max-width: var(--lg-tool-width);
+ align-items: stretch;
+ width: 100%;
+ }
+ }
+ &[data-tool="task"] {
+ [data-component="tool-input"] {
+ font-size: 0.75rem;
+ line-height: 1.5;
+ max-width: var(--md-tool-width);
+ display: -webkit-box;
+ -webkit-line-clamp: 3;
+ -webkit-box-orient: vertical;
+ overflow: hidden;
+ }
+ [data-component="tool-output"] {
+ max-width: var(--sm-tool-width);
+ font-size: 0.75rem;
+ border: 1px solid var(--sl-color-divider);
+ padding: 0.5rem calc(0.5rem + 3px);
+ border-radius: 0.25rem;
+ position: relative;
+
+ [data-component="copy-button"] {
+ top: 0.5rem;
+ right: calc(0.5rem - 1px);
+ }
}
}
}
diff --git a/packages/web/src/components/share/part.tsx b/packages/web/src/components/share/part.tsx
index 443e4a7955..4a9320e6de 100644
--- a/packages/web/src/components/share/part.tsx
+++ b/packages/web/src/components/share/part.tsx
@@ -19,25 +19,25 @@ import {
IconMagnifyingGlass,
IconDocumentMagnifyingGlass,
} from "../icons"
-import { IconMeta, IconOpenAI, IconGemini, IconAnthropic } from "../icons/custom"
-import { formatDuration } from "../share/common"
+import { IconMeta, IconRobot, IconOpenAI, IconGemini, IconAnthropic } from "../icons/custom"
import { ContentCode } from "./content-code"
import { ContentDiff } from "./content-diff"
import { ContentText } from "./content-text"
+import { ContentBash } from "./content-bash"
import { ContentError } from "./content-error"
+import { formatDuration } from "../share/common"
import { ContentMarkdown } from "./content-markdown"
-import { ContentBash } from "./content-bash"
import type { MessageV2 } from "opencode/session/message-v2"
import type { Diagnostic } from "vscode-languageserver-types"
import styles from "./part.module.css"
-const MIN_DURATION = 2
+const MIN_DURATION = 2000
export interface PartProps {
index: number
message: MessageV2.Info
- part: MessageV2.AssistantPart | MessageV2.UserPart
+ part: MessageV2.Part
last: boolean
}
@@ -114,7 +114,7 @@ export function Part(props: PartProps) {
-
+
@@ -131,12 +131,13 @@ export function Part(props: PartProps) {
{props.message.role === "user" && props.part.type === "text" && (
-
)}
{props.message.role === "assistant" && props.part.type === "text" && (
-
+
+
+
{props.last && props.message.role === "assistant" && props.message.time.completed && (
)}
{props.message.role === "user" && props.part.type === "file" && (
@@ -245,6 +245,14 @@ export function Part(props: PartProps) {
state={props.part.state}
/>
+
+
+
+ time={DateTime.fromMillis(props.part.state.time.end)
+ .diff(DateTime.fromMillis(props.part.state.time.start))
+ .toMillis()}
+ />
>
)}
@@ -636,12 +643,25 @@ function Footer(props: ParentProps<{ title: string }>) {
}
function ToolFooter(props: { time: number }) {
- return props.time > MIN_DURATION ? (
-
- ) : (
-
+ return props.time > MIN_DURATION &&
+}
+
+function TaskTool(props: ToolProps) {
+ return (
+ <>
+
+ Task
+ {props.state.input.description}
+
+
+ “{props.state.input.prompt}”
+
+
+
+
+
+
+ >
)
}
diff --git a/packages/web/src/content/docs/docs/cli.mdx b/packages/web/src/content/docs/docs/cli.mdx
index d7ca8340cf..6159246162 100644
--- a/packages/web/src/content/docs/docs/cli.mdx
+++ b/packages/web/src/content/docs/docs/cli.mdx
@@ -66,7 +66,7 @@ Logs you into a provider and saves them in the credentials file in `~/.local/sha
opencode auth login
```
-When opencode starts up it will loads the providers from the credentials file. And if there are any keys defined in your environments or a `.env` file in your project.
+When opencode starts up it loads the providers from the credentials file. And if there are any keys defined in your environments or a `.env` file in your project.
---
diff --git a/packages/web/src/content/docs/docs/config.mdx b/packages/web/src/content/docs/docs/config.mdx
index 3c0a9f236e..8cb911691e 100644
--- a/packages/web/src/content/docs/docs/config.mdx
+++ b/packages/web/src/content/docs/docs/config.mdx
@@ -5,12 +5,11 @@ description: Using the opencode JSON config.
You can configure opencode using a JSON config file.
-```json title="opencode config"
+```json title="opencode.json"
{
"$schema": "https://opencode.ai/config.json",
"theme": "opencode",
"model": "anthropic/claude-sonnet-4-20250514",
- "autoshare": false,
"autoupdate": true
}
```
@@ -21,7 +20,7 @@ This can be used to configure opencode globally or for a specific project.
### Global
-Place your global opencode config in `~/.config/opencode/config.json`. You'll want to use the global config for things like themes, providers, or keybinds.
+Place your global opencode config in `~/.config/opencode/opencode.json`. You'll want to use the global config for things like themes, providers, or keybinds.
---
@@ -93,6 +92,24 @@ You can configure the theme you want to use in your opencode config through the
---
+### Layout
+
+You can configure the layout of the TUI with the `layout` option.
+
+```json title="opencode.json"
+{
+ "$schema": "https://opencode.ai/config.json",
+ "layout": "stretch"
+}
+```
+
+This takes:
+
+- `"auto"`: Centers content with padding. This is the default.
+- `"stretch"`: Uses full terminal width.
+
+---
+
### Logging
Logs are written to:
@@ -118,8 +135,28 @@ With the following options:
| `WARN` | Warnings and errors only |
| `ERROR` | Errors only |
-The **default** log level is `INFO`. If you are running opencode locally in
-development mode it's set to `DEBUG`.
+The **default** log level is `INFO`. If you are running opencode locally in development mode it's set to `DEBUG`.
+
+---
+
+### Sharing
+
+You can configure the [share](/docs/share) feature through the `share` option.
+
+```json title="opencode.json"
+{
+ "$schema": "https://opencode.ai/config.json",
+ "share": "manual"
+}
+```
+
+This takes:
+
+- `"manual"` - Allow manual sharing via commands (default)
+- `"auto"` - Automatically share new conversations
+- `"disabled"` - Disable sharing entirely
+
+By default, sharing is set to manual mode where you need to explicitly share conversations using the `/share` command.
---
@@ -138,6 +175,19 @@ You can customize your keybinds through the `keybinds` option.
---
+### Autoupdate
+
+opencode will automatically download any new updates when it starts up. You can disable this with the `autoupdate` option.
+
+```json title="opencode.json"
+{
+ "$schema": "https://opencode.ai/config.json",
+ "autoupdate": false
+}
+```
+
+---
+
### MCP servers
You can configure MCP servers you want to use through the `mcp` option.
@@ -153,6 +203,22 @@ You can configure MCP servers you want to use through the `mcp` option.
---
+### Instructions
+
+You can configure the instructions for the model you're using through the `instructions` option.
+
+```json title="opencode.json"
+{
+ "$schema": "https://opencode.ai/config.json",
+ "instructions": ["CONTRIBUTING.md", "docs/guidelines.md", ".cursor/rules/*.md"]
+}
+```
+
+This takes an array of paths and glob patterns to instruction files. [Learn more
+about rules here](/docs/rules).
+
+---
+
### Disabled providers
You can disable providers that are loaded automatically through the `disabled_providers` option. This is useful when you want to prevent certain providers from being loaded even if their credentials are available.
@@ -188,7 +254,9 @@ Use `{env:VARIABLE_NAME}` to substitute environment variables:
"model": "{env:OPENCODE_MODEL}",
"provider": {
"anthropic": {
- "api_key": "{env:ANTHROPIC_API_KEY}"
+ "options": {
+ "apiKey": "{env:ANTHROPIC_API_KEY}"
+ }
}
}
}
@@ -208,7 +276,9 @@ Use `{file:path/to/file}` to substitute the contents of a file:
"instructions": ["{file:./custom-instructions.md}"],
"provider": {
"openai": {
- "api_key": "{file:~/.secrets/openai-key}"
+ "options": {
+ "apiKey": "{file:~/.secrets/openai-key}"
+ }
}
}
}
diff --git a/packages/web/src/content/docs/docs/enterprise.mdx b/packages/web/src/content/docs/docs/enterprise.mdx
index a493dd8a4c..d73d1d3a4b 100644
--- a/packages/web/src/content/docs/docs/enterprise.mdx
+++ b/packages/web/src/content/docs/docs/enterprise.mdx
@@ -23,7 +23,7 @@ Since opencode is open source and does not store any of your code or context dat
**opencode does not store your code or context data.** All processing happens locally or through direct API calls to your AI provider.
-The only caveat here is the optional `/share` feature that must be manually enabled.
+The only caveat here is the optional `/share` feature.
---
@@ -33,6 +33,17 @@ If a user enables the `/share` feature, the conversation and the data associated
The data is currently served through our CDN's edge network, and is cached on the edge near your users.
+We recommend you disable this for your trial.
+
+```json title="opencode.json"
+{
+ "$schema": "https://opencode.ai/config.json",
+ "share": "disabled"
+}
+```
+
+[Learn more about sharing](/docs/share).
+
---
### Code ownership
@@ -51,9 +62,37 @@ pricing and implementation options.
### SSO
-SSO integration can be implemented for enterprise deployments after your trial. Currently users manage and configure individual API keys locally.
+SSO integration can be implemented for enterprise deployments after your trial.
+This will allow your team's session data and shared conversations to be protected
+by your enterprise's authentication system.
+
+---
+
+### Private NPM
+
+opencode supports private npm registries through Bun's native `.npmrc` file support. If your organization uses a private registry, such as JFrog Artifactory, Nexus, or similar, ensure developers are authenticated before running opencode.
+
+To set up authentication with your private registry:
+
+```bash
+npm login --registry=https://your-company.jfrog.io/api/npm/npm-virtual/
+```
+
+This creates `~/.npmrc` with authentication details. opencode will automatically
+pick this up.
+
+:::caution
+You must be logged into the private registry before running opencode.
+:::
+
+Alternatively, you can manually configure a `.npmrc` file:
+
+```bash title="~/.npmrc"
+registry=https://your-company.jfrog.io/api/npm/npm-virtual/
+//your-company.jfrog.io/api/npm/npm-virtual/:_authToken=${NPM_AUTH_TOKEN}
+```
-This can be switched to a centralized authentication system that your organization uses.
+Developers must be logged into the private registry before running opencode to ensure packages can be installed from your enterprise registry.
---
diff --git a/packages/web/src/content/docs/docs/keybinds.mdx b/packages/web/src/content/docs/docs/keybinds.mdx
index 8c5aa2c42a..1d0c53b3d3 100644
--- a/packages/web/src/content/docs/docs/keybinds.mdx
+++ b/packages/web/src/content/docs/docs/keybinds.mdx
@@ -9,32 +9,45 @@ opencode has a list of keybinds that you can customize through the opencode conf
{
"$schema": "https://opencode.ai/config.json",
"keybinds": {
+
"leader": "ctrl+x",
- "help": "h",
+ "app_help": "h",
+ "switch_mode": "tab",
+
"editor_open": "e",
+
"session_new": "n",
"session_list": "l",
"session_share": "s",
+ "session_unshare": "u",
"session_interrupt": "esc",
"session_compact": "c",
+
"tool_details": "d",
"model_list": "m",
"theme_list": "t",
"project_init": "i",
+
+ "file_list": "f",
+ "file_close": "esc",
+ "file_diff_toggle": "v",
+
"input_clear": "ctrl+c",
"input_paste": "ctrl+v",
"input_submit": "enter",
"input_newline": "shift+enter,ctrl+j",
- "history_previous": "up",
- "history_next": "down",
+
"messages_page_up": "pgup",
"messages_page_down": "pgdown",
"messages_half_page_up": "ctrl+alt+u",
"messages_half_page_down": "ctrl+alt+d",
- "messages_previous": "ctrl+alt+k",
- "messages_next": "ctrl+alt+j",
+ "messages_previous": "ctrl+up",
+ "messages_next": "ctrl+down",
"messages_first": "ctrl+g",
"messages_last": "ctrl+alt+g",
+ "messages_layout_toggle": "p",
+ "messages_copy": "y",
+ "messages_revert": "r",
"app_exit": "ctrl+c,q"
}
}
diff --git a/packages/web/src/content/docs/docs/mcp-servers.mdx b/packages/web/src/content/docs/docs/mcp-servers.mdx
index 0496e31cf7..985570a45d 100644
--- a/packages/web/src/content/docs/docs/mcp-servers.mdx
+++ b/packages/web/src/content/docs/docs/mcp-servers.mdx
@@ -18,19 +18,24 @@ You can define MCP servers in your opencode config under `mcp`.
### Local
-Add a local MCP servers under `mcp.localmcp`.
+Add local MCP servers under `mcp` with `"type": "local"`.
```json title="opencode.json"
{
"$schema": "https://opencode.ai/config.json",
"mcp": {
- "localmcp": {
+ "my-local-mcp-server": {
"type": "local",
"command": ["bun", "x", "my-mcp-command"],
"enabled": true,
"environment": {
"MY_ENV_VAR": "my_env_var_value"
}
+ }, {
+ "my-different-local-mcp-server": {
+ "type": "local",
+ "command": ["bun", "x", "my-other-mcp-command"],
+ "enabled": true
}
}
}
@@ -40,16 +45,19 @@ You can also disable a server by setting `enabled` to `false`. This is useful if
### Remote
-Add a remote MCP servers under `mcp.remotemcp`.
+Add remote MCP servers under `mcp` with `"type": "remote"`.
```json title="opencode.json"
{
"$schema": "https://opencode.ai/config.json",
"mcp": {
- "remotemcp": {
+ "my-remote-mcp": {
"type": "remote",
"url": "https://my-mcp-server.com",
- "enabled": true
+ "enabled": true,
+ "headers": {
+ "Authorization": "Bearer MY_API_KEY"
+ }
}
}
}
diff --git a/packages/web/src/content/docs/docs/models.mdx b/packages/web/src/content/docs/docs/models.mdx
index d1c9c7ac65..cde1d2a41d 100644
--- a/packages/web/src/content/docs/docs/models.mdx
+++ b/packages/web/src/content/docs/docs/models.mdx
@@ -27,14 +27,32 @@ You can add custom providers by specifying the npm package for the provider and
{
"$schema": "https://opencode.ai/config.json",
"provider": {
- "openrouter": {
- "npm": "@openrouter/ai-sdk-provider",
- "name": "OpenRouter",
- "options": {},
+ "moonshot": {
+ "npm": "@ai-sdk/openai-compatible",
+ "options": {
+ "baseURL": "https://api.moonshot.ai/v1"
+ },
"models": {
- "anthropic/claude-3.5-sonnet": {
- "name": "Claude 3.5 Sonnet"
- }
+ "kimi-k2-0711-preview": {}
+ }
+ }
+ }
+}
+```
+
+---
+
+### Base URL
+
+You can customize the base URL for any provider by setting the `baseURL` option. This is useful when using proxy services or custom endpoints.
+
+```json title="opencode.json" {6}
+{
+ "$schema": "https://opencode.ai/config.json",
+ "provider": {
+ "anthropic": {
+ "options": {
+ "baseURL": "https://api.anthropic.com/v1"
}
}
}
@@ -46,7 +64,7 @@ You can add custom providers by specifying the npm package for the provider and
### Local
You can configure local model like ones served through LM Studio or Ollama. To
-do so, you'll need to specify a couple of things.
+do so, you'll need to specify a couple of things.
Here's an example of configuring a local model from LM Studio:
diff --git a/packages/web/src/content/docs/docs/rules.mdx b/packages/web/src/content/docs/docs/rules.mdx
index 3249cc3f8d..aa5590bb5f 100644
--- a/packages/web/src/content/docs/docs/rules.mdx
+++ b/packages/web/src/content/docs/docs/rules.mdx
@@ -81,7 +81,7 @@ If you have both global and project-specific rules, opencode will combine them t
## Custom Instructions
-You can specify custom instruction files in your `opencode.json` or the global `~/.config/opencode/config.json`. This allows you and your team to reuse existing rules rather than having to duplicate them to AGENTS.md.
+You can specify custom instruction files in your `opencode.json` or the global `~/.config/opencode/opencode.json`. This allows you and your team to reuse existing rules rather than having to duplicate them to AGENTS.md.
Example:
@@ -93,3 +93,60 @@ Example:
```
All instruction files are combined with your `AGENTS.md` files.
+
+---
+
+## Referencing External Files
+
+While opencode doesn't automatically parse file references in `AGENTS.md`, you can achieve similar functionality in two ways:
+
+### Using opencode.json
+
+The recommended approach is to use the `instructions` field in `opencode.json`:
+
+```json title="opencode.json"
+{
+ "$schema": "https://opencode.ai/config.json",
+ "instructions": ["docs/development-standards.md", "test/testing-guidelines.md", "packages/*/AGENTS.md"]
+}
+```
+
+### Manual Instructions in AGENTS.md
+
+You can teach opencode to read external files by providing explicit instructions in your `AGENTS.md`. Here's a practical example:
+
+```markdown title="AGENTS.md"
+# TypeScript Project Rules
+
+## External File Loading
+
+CRITICAL: When you encounter a file reference (e.g., @rules/general.md), use your Read tool to load it on a need-to-know basis. They're relevant to the SPECIFIC task at hand.
+
+Instructions:
+
+- Do NOT preemptively load all references - use lazy loading based on actual need
+- When loaded, treat content as mandatory instructions that override defaults
+- Follow references recursively when needed
+
+## Development Guidelines
+
+For TypeScript code style and best practices: @docs/typescript-guidelines.md
+For React component architecture and hooks patterns: @docs/react-patterns.md
+For REST API design and error handling: @docs/api-standards.md
+For testing strategies and coverage requirements: @test/testing-guidelines.md
+
+## General Guidelines
+
+Read the following file immediately as it's relevant to all workflows: @rules/general-guidelines.md.
+```
+
+This approach allows you to:
+
+- Create modular, reusable rule files
+- Share rules across projects via symlinks or git submodules
+- Keep AGENTS.md concise while referencing detailed guidelines
+- Ensure opencode loads files only when needed for the specific task
+
+:::tip
+For monorepos or projects with shared standards, using `opencode.json` with glob patterns (like `packages/*/AGENTS.md`) is more maintainable than manual instructions.
+:::
diff --git a/packages/web/src/content/docs/docs/share.mdx b/packages/web/src/content/docs/docs/share.mdx
index f538152e4c..efb54c2d57 100644
--- a/packages/web/src/content/docs/docs/share.mdx
+++ b/packages/web/src/content/docs/docs/share.mdx
@@ -23,13 +23,13 @@ When you share a conversation, opencode:
## Sharing
-You can manually share a conversation or enable automatic sharing for all new conversations.
+opencode supports three sharing modes that control how conversations are shared:
---
-### Manual
+### Manual (default)
-Use the `/share` command in any conversation to create a shareable link:
+By default, opencode uses manual sharing mode. Sessions are not shared automatically, but you can manually share them using the `/share` command:
```
/share
@@ -37,24 +37,48 @@ Use the `/share` command in any conversation to create a shareable link:
This will generate a unique URL that'll be copied to your clipboard.
+To explicitly set manual mode in your [config file](/docs/config):
+
+```json title="opencode.json"
+{
+ "$schema": "https://opencode.ai/config.json",
+ "share": "manual"
+}
+```
+
+---
+
+### Auto-share
+
+You can enable automatic sharing for all new conversations by setting the `share` option to `"auto"` in your [config file](/docs/config):
+
+```json title="opencode.json"
+{
+ "$schema": "https://opencode.ai/config.json",
+ "share": "auto"
+}
+```
+
+With auto-share enabled, every new conversation will automatically be shared and a link will be generated.
+
---
-### Autoshare
+### Disabled
-You can enable automatic sharing for all new conversations through the `autoshare` option in your [config file](/docs/config).
+You can disable sharing entirely by setting the `share` option to `"disabled"` in your [config file](/docs/config):
```json title="opencode.json"
{
"$schema": "https://opencode.ai/config.json",
- "autoshare": true
+ "share": "disabled"
}
```
-By default, `autoshare` is disabled.
+To enforce this across your team for a given project, add it to the `opencode.json` in your project and check into Git.
---
-## Unsharing
+## Un-sharing
To stop sharing a conversation and remove it from public access:
@@ -85,10 +109,11 @@ includes:
### Recommendations
-- Only share conversations that don't contain sensitive information
-- Review conversation content before sharing
-- Unshare conversations when collaboration is complete
-- Avoid sharing conversations with proprietary code or confidential data
+- Only share conversations that don't contain sensitive information.
+- Review conversation content before sharing.
+- Unshare conversations when collaboration is complete.
+- Avoid sharing conversations with proprietary code or confidential data.
+- For sensitive projects, disable sharing entirely.
---
@@ -96,8 +121,8 @@ includes:
For enterprise deployments, the share feature can be:
-- **Self-hosted** on your own infrastructure
-- **Restricted** to authenticated users only
- **Disabled** entirely for security compliance
+- **Restricted** to users authenticated through SSO only
+- **Self-hosted** on your own infrastructure
[Learn more](/docs/enterprise) about using opencode in your organization.
diff --git a/packages/web/src/content/docs/docs/troubleshooting.mdx b/packages/web/src/content/docs/docs/troubleshooting.mdx
index 234c7cce1e..9d7dd33a5a 100644
--- a/packages/web/src/content/docs/docs/troubleshooting.mdx
+++ b/packages/web/src/content/docs/docs/troubleshooting.mdx
@@ -115,4 +115,29 @@ Xvfb :99 -screen 0 1024x768x24 > /dev/null 2>&1 &
export DISPLAY=:99.0
```
-opencode will automatically detect and use the first available clipboard tool in order of preference: `xclip`, `xsel`, then `wl-clipboard`.
+opencode will detect if you're using Wayland and prefer `wl-clipboard`, otherwise it will try to find clipboard tools in order of: `xclip` and `xsel`.
+
+---
+
+### How to select and copy text in the TUI
+
+There are several ways to copy text from opencode's TUI:
+
+- **Copy latest message**: Use `y` to copy the most recent message in your current session to the clipboard
+- **Export session**: Use `/export` (or `x`) to open the current session as plain text in your `$EDITOR` (requires the `EDITOR` environment variable to be set)
+
+We're working on adding click & drag text selection in a future update.
+
+---
+
+### TUI not rendering full width
+
+By default, opencode's TUI uses an "auto" layout that centers content with padding. If you want the TUI to use the full width of your terminal, you can configure the layout setting:
+
+```json title="opencode.json"
+{
+ "layout": "stretch"
+}
+```
+
+Read more about this in the [config docs](/docs/config#layout).
diff --git a/patches/ai@4.3.16.patch b/patches/ai@4.3.16.patch
deleted file mode 100644
index 7d6df589d7..0000000000
--- a/patches/ai@4.3.16.patch
+++ /dev/null
@@ -1,13 +0,0 @@
-diff --git a/dist/index.mjs b/dist/index.mjs
-index 92a80377692488c4ba8801ce33e7736ad7055e43..add6281bbecaa1c03d3b48eb99aead4a7a7336b2 100644
---- a/dist/index.mjs
-+++ b/dist/index.mjs
-@@ -1593,7 +1593,7 @@ function prepareCallSettings({
- return {
- maxTokens,
- // TODO v5 remove default 0 for temperature
-- temperature: temperature != null ? temperature : 0,
-+ temperature: temperature,
- topP,
- topK,
- presencePenalty,
diff --git a/scripts/publish-github-action.ts b/scripts/publish-github-action.ts
new file mode 100755
index 0000000000..9d0cbb7ee3
--- /dev/null
+++ b/scripts/publish-github-action.ts
@@ -0,0 +1,16 @@
+#!/usr/bin/env bun
+
+import { $ } from "bun"
+
+try {
+ await $`git tag -d github-v1`
+ await $`git push origin :refs/tags/github-v1`
+} catch (e: any) {
+ if (e instanceof $.ShellError && e.stderr.toString().match(/tag \S+ not found/)) {
+ console.log("tag not found, continuing...")
+ } else {
+ throw e
+ }
+}
+await $`git tag -a github-v1 -m "Update github-v1 to latest"`
+await $`git push origin github-v1`
diff --git a/scripts/stainless b/scripts/stainless
index 6554268feb..4b417a0022 100755
--- a/scripts/stainless
+++ b/scripts/stainless
@@ -23,4 +23,7 @@ rm -rf packages/tui/sdk
mv opencode-go/ packages/tui/sdk/
rm -rf packages/tui/sdk/.git
+echo "Kicking off production build..."
+stl builds create --branch main --wait false
+
echo "Done!"
diff --git a/sdks/github/action.yml b/sdks/github/action.yml
new file mode 100644
index 0000000000..8501ce0988
--- /dev/null
+++ b/sdks/github/action.yml
@@ -0,0 +1,58 @@
+name: "opencode GitHub Action"
+description: "Run opencode in GitHub Actions workflows"
+branding:
+ icon: "code"
+ color: "orange"
+
+inputs:
+ model:
+ description: "Model to use"
+ required: false
+
+ share:
+ description: "Share the opencode session (defaults to true for public repos)"
+ required: false
+
+outputs:
+ share_url:
+ description: "URL to share the opencode execution"
+ value: ${{ steps.run_opencode.outputs.share_url }}
+
+runs:
+ using: "composite"
+ steps:
+ - name: Setup Node.js
+ uses: actions/setup-node@v4
+ with:
+ node-version: 22
+
+ - name: Install Bun
+ uses: oven-sh/setup-bun@v2
+ with:
+ bun-version: 1.2.16
+
+ - name: Install Dependencies
+ shell: bash
+ run: |
+ cd ${GITHUB_ACTION_PATH}
+ bun install
+
+ - name: Install opencode
+ shell: bash
+ run: curl -fsSL https://opencode.ai/install | bash
+
+ - name: Run opencode
+ shell: bash
+ id: run_opencode
+ run: |
+ bun run ${GITHUB_ACTION_PATH}/src/index.ts
+ env:
+ INPUT_MODEL: ${{ inputs.model }}
+ INPUT_SHARE: ${{ inputs.share }}
+
+ #- name: Testing
+ # shell: bash
+ # run: |
+ # gh pr comment ${{ github.event.number }} --body "This is an automated comment"
+ # env:
+ # GH_TOKEN: ${{ github.token }}
diff --git a/sdks/github/bun.lock b/sdks/github/bun.lock
new file mode 100644
index 0000000000..2558775160
--- /dev/null
+++ b/sdks/github/bun.lock
@@ -0,0 +1,157 @@
+{
+ "lockfileVersion": 1,
+ "workspaces": {
+ "": {
+ "name": "github",
+ "dependencies": {
+ "@actions/core": "^1.11.1",
+ "@actions/github": "^6.0.1",
+ "@octokit/graphql": "^9.0.1",
+ "@octokit/rest": "^22.0.0",
+ },
+ "devDependencies": {
+ "@octokit/webhooks-types": "^7.6.1",
+ "@types/bun": "latest",
+ "@types/node": "^24.0.10",
+ },
+ "peerDependencies": {
+ "typescript": "^5",
+ },
+ },
+ },
+ "packages": {
+ "@actions/core": ["@actions/core@1.11.1", "", { "dependencies": { "@actions/exec": "^1.1.1", "@actions/http-client": "^2.0.1" } }, "sha512-hXJCSrkwfA46Vd9Z3q4cpEpHB1rL5NG04+/rbqW9d3+CSvtB1tYe8UTpAlixa1vj0m/ULglfEK2UKxMGxCxv5A=="],
+
+ "@actions/exec": ["@actions/exec@1.1.1", "", { "dependencies": { "@actions/io": "^1.0.1" } }, "sha512-+sCcHHbVdk93a0XT19ECtO/gIXoxvdsgQLzb2fE2/5sIZmWQuluYyjPQtrtTHdU1YzTZ7bAPN4sITq2xi1679w=="],
+
+ "@actions/github": ["@actions/github@6.0.1", "", { "dependencies": { "@actions/http-client": "^2.2.0", "@octokit/core": "^5.0.1", "@octokit/plugin-paginate-rest": "^9.2.2", "@octokit/plugin-rest-endpoint-methods": "^10.4.0", "@octokit/request": "^8.4.1", "@octokit/request-error": "^5.1.1", "undici": "^5.28.5" } }, "sha512-xbZVcaqD4XnQAe35qSQqskb3SqIAfRyLBrHMd/8TuL7hJSz2QtbDwnNM8zWx4zO5l2fnGtseNE3MbEvD7BxVMw=="],
+
+ "@actions/http-client": ["@actions/http-client@2.2.3", "", { "dependencies": { "tunnel": "^0.0.6", "undici": "^5.25.4" } }, "sha512-mx8hyJi/hjFvbPokCg4uRd4ZX78t+YyRPtnKWwIl+RzNaVuFpQHfmlGVfsKEJN8LwTCvL+DfVgAM04XaHkm6bA=="],
+
+ "@actions/io": ["@actions/io@1.1.3", "", {}, "sha512-wi9JjgKLYS7U/z8PPbco+PvTb/nRWjeoFlJ1Qer83k/3C5PHQi28hiVdeE2kHXmIL99mQFawx8qt/JPjZilJ8Q=="],
+
+ "@fastify/busboy": ["@fastify/busboy@2.1.1", "", {}, "sha512-vBZP4NlzfOlerQTnba4aqZoMhE/a9HY7HRqoOPaETQcSQuWEIyZMHGfVu6w9wGtGK5fED5qRs2DteVCjOH60sA=="],
+
+ "@octokit/auth-token": ["@octokit/auth-token@4.0.0", "", {}, "sha512-tY/msAuJo6ARbK6SPIxZrPBms3xPbfwBrulZe0Wtr/DIY9lje2HeV1uoebShn6mx7SjCHif6EjMvoREj+gZ+SA=="],
+
+ "@octokit/core": ["@octokit/core@5.2.2", "", { "dependencies": { "@octokit/auth-token": "^4.0.0", "@octokit/graphql": "^7.1.0", "@octokit/request": "^8.4.1", "@octokit/request-error": "^5.1.1", "@octokit/types": "^13.0.0", "before-after-hook": "^2.2.0", "universal-user-agent": "^6.0.0" } }, "sha512-/g2d4sW9nUDJOMz3mabVQvOGhVa4e/BN/Um7yca9Bb2XTzPPnfTWHWQg+IsEYO7M3Vx+EXvaM/I2pJWIMun1bg=="],
+
+ "@octokit/endpoint": ["@octokit/endpoint@9.0.6", "", { "dependencies": { "@octokit/types": "^13.1.0", "universal-user-agent": "^6.0.0" } }, "sha512-H1fNTMA57HbkFESSt3Y9+FBICv+0jFceJFPWDePYlR/iMGrwM5ph+Dd4XRQs+8X+PUFURLQgX9ChPfhJ/1uNQw=="],
+
+ "@octokit/graphql": ["@octokit/graphql@9.0.1", "", { "dependencies": { "@octokit/request": "^10.0.2", "@octokit/types": "^14.0.0", "universal-user-agent": "^7.0.0" } }, "sha512-j1nQNU1ZxNFx2ZtKmL4sMrs4egy5h65OMDmSbVyuCzjOcwsHq6EaYjOTGXPQxgfiN8dJ4CriYHk6zF050WEULg=="],
+
+ "@octokit/openapi-types": ["@octokit/openapi-types@25.1.0", "", {}, "sha512-idsIggNXUKkk0+BExUn1dQ92sfysJrje03Q0bv0e+KPLrvyqZF8MnBpFz8UNfYDwB3Ie7Z0TByjWfzxt7vseaA=="],
+
+ "@octokit/plugin-paginate-rest": ["@octokit/plugin-paginate-rest@9.2.2", "", { "dependencies": { "@octokit/types": "^12.6.0" }, "peerDependencies": { "@octokit/core": "5" } }, "sha512-u3KYkGF7GcZnSD/3UP0S7K5XUFT2FkOQdcfXZGZQPGv3lm4F2Xbf71lvjldr8c1H3nNbF+33cLEkWYbokGWqiQ=="],
+
+ "@octokit/plugin-request-log": ["@octokit/plugin-request-log@6.0.0", "", { "peerDependencies": { "@octokit/core": ">=6" } }, "sha512-UkOzeEN3W91/eBq9sPZNQ7sUBvYCqYbrrD8gTbBuGtHEuycE4/awMXcYvx6sVYo7LypPhmQwwpUe4Yyu4QZN5Q=="],
+
+ "@octokit/plugin-rest-endpoint-methods": ["@octokit/plugin-rest-endpoint-methods@10.4.1", "", { "dependencies": { "@octokit/types": "^12.6.0" }, "peerDependencies": { "@octokit/core": "5" } }, "sha512-xV1b+ceKV9KytQe3zCVqjg+8GTGfDYwaT1ATU5isiUyVtlVAO3HNdzpS4sr4GBx4hxQ46s7ITtZrAsxG22+rVg=="],
+
+ "@octokit/request": ["@octokit/request@8.4.1", "", { "dependencies": { "@octokit/endpoint": "^9.0.6", "@octokit/request-error": "^5.1.1", "@octokit/types": "^13.1.0", "universal-user-agent": "^6.0.0" } }, "sha512-qnB2+SY3hkCmBxZsR/MPCybNmbJe4KAlfWErXq+rBKkQJlbjdJeS85VI9r8UqeLYLvnAenU8Q1okM/0MBsAGXw=="],
+
+ "@octokit/request-error": ["@octokit/request-error@5.1.1", "", { "dependencies": { "@octokit/types": "^13.1.0", "deprecation": "^2.0.0", "once": "^1.4.0" } }, "sha512-v9iyEQJH6ZntoENr9/yXxjuezh4My67CBSu9r6Ve/05Iu5gNgnisNWOsoJHTP6k0Rr0+HQIpnH+kyammu90q/g=="],
+
+ "@octokit/rest": ["@octokit/rest@22.0.0", "", { "dependencies": { "@octokit/core": "^7.0.2", "@octokit/plugin-paginate-rest": "^13.0.1", "@octokit/plugin-request-log": "^6.0.0", "@octokit/plugin-rest-endpoint-methods": "^16.0.0" } }, "sha512-z6tmTu9BTnw51jYGulxrlernpsQYXpui1RK21vmXn8yF5bp6iX16yfTtJYGK5Mh1qDkvDOmp2n8sRMcQmR8jiA=="],
+
+ "@octokit/types": ["@octokit/types@14.1.0", "", { "dependencies": { "@octokit/openapi-types": "^25.1.0" } }, "sha512-1y6DgTy8Jomcpu33N+p5w58l6xyt55Ar2I91RPiIA0xCJBXyUAhXCcmZaDWSANiha7R9a6qJJ2CRomGPZ6f46g=="],
+
+ "@octokit/webhooks-types": ["@octokit/webhooks-types@7.6.1", "", {}, "sha512-S8u2cJzklBC0FgTwWVLaM8tMrDuDMVE4xiTK4EYXM9GntyvrdbSoxqDQa+Fh57CCNApyIpyeqPhhFEmHPfrXgw=="],
+
+ "@types/bun": ["@types/bun@1.2.18", "", { "dependencies": { "bun-types": "1.2.18" } }, "sha512-Xf6RaWVheyemaThV0kUfaAUvCNokFr+bH8Jxp+tTZfx7dAPA8z9ePnP9S9+Vspzuxxx9JRAXhnyccRj3GyCMdQ=="],
+
+ "@types/node": ["@types/node@24.0.13", "", { "dependencies": { "undici-types": "~7.8.0" } }, "sha512-Qm9OYVOFHFYg3wJoTSrz80hoec5Lia/dPp84do3X7dZvLikQvM1YpmvTBEdIr/e+U8HTkFjLHLnl78K/qjf+jQ=="],
+
+ "@types/react": ["@types/react@19.1.8", "", { "dependencies": { "csstype": "^3.0.2" } }, "sha512-AwAfQ2Wa5bCx9WP8nZL2uMZWod7J7/JSplxbTmBQ5ms6QpqNYm672H0Vu9ZVKVngQ+ii4R/byguVEUZQyeg44g=="],
+
+ "before-after-hook": ["before-after-hook@2.2.3", "", {}, "sha512-NzUnlZexiaH/46WDhANlyR2bXRopNg4F/zuSA3OpZnllCUgRaOF2znDioDWrmbNVsuZk6l9pMquQB38cfBZwkQ=="],
+
+ "bun-types": ["bun-types@1.2.18", "", { "dependencies": { "@types/node": "*" }, "peerDependencies": { "@types/react": "^19" } }, "sha512-04+Eha5NP7Z0A9YgDAzMk5PHR16ZuLVa83b26kH5+cp1qZW4F6FmAURngE7INf4tKOvCE69vYvDEwoNl1tGiWw=="],
+
+ "csstype": ["csstype@3.1.3", "", {}, "sha512-M1uQkMl8rQK/szD0LNhtqxIPLpimGm8sOBwU7lLnCpSbTyY3yeU1Vc7l4KT5zT4s/yOxHH5O7tIuuLOCnLADRw=="],
+
+ "deprecation": ["deprecation@2.3.1", "", {}, "sha512-xmHIy4F3scKVwMsQ4WnVaS8bHOx0DmVwRywosKhaILI0ywMDWPtBSku2HNxRvF7jtwDRsoEwYQSfbxj8b7RlJQ=="],
+
+ "fast-content-type-parse": ["fast-content-type-parse@3.0.0", "", {}, "sha512-ZvLdcY8P+N8mGQJahJV5G4U88CSvT1rP8ApL6uETe88MBXrBHAkZlSEySdUlyztF7ccb+Znos3TFqaepHxdhBg=="],
+
+ "once": ["once@1.4.0", "", { "dependencies": { "wrappy": "1" } }, "sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w=="],
+
+ "tunnel": ["tunnel@0.0.6", "", {}, "sha512-1h/Lnq9yajKY2PEbBadPXj3VxsDDu844OnaAo52UVmIzIvwwtBPIuNvkjuzBlTWpfJyUbG3ez0KSBibQkj4ojg=="],
+
+ "typescript": ["typescript@5.8.3", "", { "bin": { "tsc": "bin/tsc", "tsserver": "bin/tsserver" } }, "sha512-p1diW6TqL9L07nNxvRMM7hMMw4c5XOo/1ibL4aAIGmSAt9slTE1Xgw5KWuof2uTOvCg9BY7ZRi+GaF+7sfgPeQ=="],
+
+ "undici": ["undici@5.29.0", "", { "dependencies": { "@fastify/busboy": "^2.0.0" } }, "sha512-raqeBD6NQK4SkWhQzeYKd1KmIG6dllBOTt55Rmkt4HtI9mwdWtJljnrXjAFUBLTSN67HWrOIZ3EPF4kjUw80Bg=="],
+
+ "undici-types": ["undici-types@7.8.0", "", {}, "sha512-9UJ2xGDvQ43tYyVMpuHlsgApydB8ZKfVYTsLDhXkFL/6gfkp+U8xTGdh8pMJv1SpZna0zxG1DwsKZsreLbXBxw=="],
+
+ "universal-user-agent": ["universal-user-agent@7.0.3", "", {}, "sha512-TmnEAEAsBJVZM/AADELsK76llnwcf9vMKuPz8JflO1frO8Lchitr0fNaN9d+Ap0BjKtqWqd/J17qeDnXh8CL2A=="],
+
+ "wrappy": ["wrappy@1.0.2", "", {}, "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ=="],
+
+ "@octokit/core/@octokit/graphql": ["@octokit/graphql@7.1.1", "", { "dependencies": { "@octokit/request": "^8.4.1", "@octokit/types": "^13.0.0", "universal-user-agent": "^6.0.0" } }, "sha512-3mkDltSfcDUoa176nlGoA32RGjeWjl3K7F/BwHwRMJUW/IteSa4bnSV8p2ThNkcIcZU2umkZWxwETSSCJf2Q7g=="],
+
+ "@octokit/core/@octokit/types": ["@octokit/types@13.10.0", "", { "dependencies": { "@octokit/openapi-types": "^24.2.0" } }, "sha512-ifLaO34EbbPj0Xgro4G5lP5asESjwHracYJvVaPIyXMuiuXLlhic3S47cBdTb+jfODkTE5YtGCLt3Ay3+J97sA=="],
+
+ "@octokit/core/universal-user-agent": ["universal-user-agent@6.0.1", "", {}, "sha512-yCzhz6FN2wU1NiiQRogkTQszlQSlpWaw8SvVegAc+bDxbzHgh1vX8uIe8OYyMH6DwH+sdTJsgMl36+mSMdRJIQ=="],
+
+ "@octokit/endpoint/@octokit/types": ["@octokit/types@13.10.0", "", { "dependencies": { "@octokit/openapi-types": "^24.2.0" } }, "sha512-ifLaO34EbbPj0Xgro4G5lP5asESjwHracYJvVaPIyXMuiuXLlhic3S47cBdTb+jfODkTE5YtGCLt3Ay3+J97sA=="],
+
+ "@octokit/endpoint/universal-user-agent": ["universal-user-agent@6.0.1", "", {}, "sha512-yCzhz6FN2wU1NiiQRogkTQszlQSlpWaw8SvVegAc+bDxbzHgh1vX8uIe8OYyMH6DwH+sdTJsgMl36+mSMdRJIQ=="],
+
+ "@octokit/graphql/@octokit/request": ["@octokit/request@10.0.3", "", { "dependencies": { "@octokit/endpoint": "^11.0.0", "@octokit/request-error": "^7.0.0", "@octokit/types": "^14.0.0", "fast-content-type-parse": "^3.0.0", "universal-user-agent": "^7.0.2" } }, "sha512-V6jhKokg35vk098iBqp2FBKunk3kMTXlmq+PtbV9Gl3TfskWlebSofU9uunVKhUN7xl+0+i5vt0TGTG8/p/7HA=="],
+
+ "@octokit/plugin-paginate-rest/@octokit/types": ["@octokit/types@12.6.0", "", { "dependencies": { "@octokit/openapi-types": "^20.0.0" } }, "sha512-1rhSOfRa6H9w4YwK0yrf5faDaDTb+yLyBUKOCV4xtCDB5VmIPqd/v9yr9o6SAzOAlRxMiRiCic6JVM1/kunVkw=="],
+
+ "@octokit/plugin-request-log/@octokit/core": ["@octokit/core@7.0.3", "", { "dependencies": { "@octokit/auth-token": "^6.0.0", "@octokit/graphql": "^9.0.1", "@octokit/request": "^10.0.2", "@octokit/request-error": "^7.0.0", "@octokit/types": "^14.0.0", "before-after-hook": "^4.0.0", "universal-user-agent": "^7.0.0" } }, "sha512-oNXsh2ywth5aowwIa7RKtawnkdH6LgU1ztfP9AIUCQCvzysB+WeU8o2kyyosDPwBZutPpjZDKPQGIzzrfTWweQ=="],
+
+ "@octokit/plugin-rest-endpoint-methods/@octokit/types": ["@octokit/types@12.6.0", "", { "dependencies": { "@octokit/openapi-types": "^20.0.0" } }, "sha512-1rhSOfRa6H9w4YwK0yrf5faDaDTb+yLyBUKOCV4xtCDB5VmIPqd/v9yr9o6SAzOAlRxMiRiCic6JVM1/kunVkw=="],
+
+ "@octokit/request/@octokit/types": ["@octokit/types@13.10.0", "", { "dependencies": { "@octokit/openapi-types": "^24.2.0" } }, "sha512-ifLaO34EbbPj0Xgro4G5lP5asESjwHracYJvVaPIyXMuiuXLlhic3S47cBdTb+jfODkTE5YtGCLt3Ay3+J97sA=="],
+
+ "@octokit/request/universal-user-agent": ["universal-user-agent@6.0.1", "", {}, "sha512-yCzhz6FN2wU1NiiQRogkTQszlQSlpWaw8SvVegAc+bDxbzHgh1vX8uIe8OYyMH6DwH+sdTJsgMl36+mSMdRJIQ=="],
+
+ "@octokit/request-error/@octokit/types": ["@octokit/types@13.10.0", "", { "dependencies": { "@octokit/openapi-types": "^24.2.0" } }, "sha512-ifLaO34EbbPj0Xgro4G5lP5asESjwHracYJvVaPIyXMuiuXLlhic3S47cBdTb+jfODkTE5YtGCLt3Ay3+J97sA=="],
+
+ "@octokit/rest/@octokit/core": ["@octokit/core@7.0.3", "", { "dependencies": { "@octokit/auth-token": "^6.0.0", "@octokit/graphql": "^9.0.1", "@octokit/request": "^10.0.2", "@octokit/request-error": "^7.0.0", "@octokit/types": "^14.0.0", "before-after-hook": "^4.0.0", "universal-user-agent": "^7.0.0" } }, "sha512-oNXsh2ywth5aowwIa7RKtawnkdH6LgU1ztfP9AIUCQCvzysB+WeU8o2kyyosDPwBZutPpjZDKPQGIzzrfTWweQ=="],
+
+ "@octokit/rest/@octokit/plugin-paginate-rest": ["@octokit/plugin-paginate-rest@13.1.1", "", { "dependencies": { "@octokit/types": "^14.1.0" }, "peerDependencies": { "@octokit/core": ">=6" } }, "sha512-q9iQGlZlxAVNRN2jDNskJW/Cafy7/XE52wjZ5TTvyhyOD904Cvx//DNyoO3J/MXJ0ve3rPoNWKEg5iZrisQSuw=="],
+
+ "@octokit/rest/@octokit/plugin-rest-endpoint-methods": ["@octokit/plugin-rest-endpoint-methods@16.0.0", "", { "dependencies": { "@octokit/types": "^14.1.0" }, "peerDependencies": { "@octokit/core": ">=6" } }, "sha512-kJVUQk6/dx/gRNLWUnAWKFs1kVPn5O5CYZyssyEoNYaFedqZxsfYs7DwI3d67hGz4qOwaJ1dpm07hOAD1BXx6g=="],
+
+ "@octokit/core/@octokit/types/@octokit/openapi-types": ["@octokit/openapi-types@24.2.0", "", {}, "sha512-9sIH3nSUttelJSXUrmGzl7QUBFul0/mB8HRYl3fOlgHbIWG+WnYDXU3v/2zMtAvuzZ/ed00Ei6on975FhBfzrg=="],
+
+ "@octokit/endpoint/@octokit/types/@octokit/openapi-types": ["@octokit/openapi-types@24.2.0", "", {}, "sha512-9sIH3nSUttelJSXUrmGzl7QUBFul0/mB8HRYl3fOlgHbIWG+WnYDXU3v/2zMtAvuzZ/ed00Ei6on975FhBfzrg=="],
+
+ "@octokit/graphql/@octokit/request/@octokit/endpoint": ["@octokit/endpoint@11.0.0", "", { "dependencies": { "@octokit/types": "^14.0.0", "universal-user-agent": "^7.0.2" } }, "sha512-hoYicJZaqISMAI3JfaDr1qMNi48OctWuOih1m80bkYow/ayPw6Jj52tqWJ6GEoFTk1gBqfanSoI1iY99Z5+ekQ=="],
+
+ "@octokit/graphql/@octokit/request/@octokit/request-error": ["@octokit/request-error@7.0.0", "", { "dependencies": { "@octokit/types": "^14.0.0" } }, "sha512-KRA7VTGdVyJlh0cP5Tf94hTiYVVqmt2f3I6mnimmaVz4UG3gQV/k4mDJlJv3X67iX6rmN7gSHCF8ssqeMnmhZg=="],
+
+ "@octokit/plugin-paginate-rest/@octokit/types/@octokit/openapi-types": ["@octokit/openapi-types@20.0.0", "", {}, "sha512-EtqRBEjp1dL/15V7WiX5LJMIxxkdiGJnabzYx5Apx4FkQIFgAfKumXeYAqqJCj1s+BMX4cPFIFC4OLCR6stlnA=="],
+
+ "@octokit/plugin-request-log/@octokit/core/@octokit/auth-token": ["@octokit/auth-token@6.0.0", "", {}, "sha512-P4YJBPdPSpWTQ1NU4XYdvHvXJJDxM6YwpS0FZHRgP7YFkdVxsWcpWGy/NVqlAA7PcPCnMacXlRm1y2PFZRWL/w=="],
+
+ "@octokit/plugin-request-log/@octokit/core/@octokit/request": ["@octokit/request@10.0.3", "", { "dependencies": { "@octokit/endpoint": "^11.0.0", "@octokit/request-error": "^7.0.0", "@octokit/types": "^14.0.0", "fast-content-type-parse": "^3.0.0", "universal-user-agent": "^7.0.2" } }, "sha512-V6jhKokg35vk098iBqp2FBKunk3kMTXlmq+PtbV9Gl3TfskWlebSofU9uunVKhUN7xl+0+i5vt0TGTG8/p/7HA=="],
+
+ "@octokit/plugin-request-log/@octokit/core/@octokit/request-error": ["@octokit/request-error@7.0.0", "", { "dependencies": { "@octokit/types": "^14.0.0" } }, "sha512-KRA7VTGdVyJlh0cP5Tf94hTiYVVqmt2f3I6mnimmaVz4UG3gQV/k4mDJlJv3X67iX6rmN7gSHCF8ssqeMnmhZg=="],
+
+ "@octokit/plugin-request-log/@octokit/core/before-after-hook": ["before-after-hook@4.0.0", "", {}, "sha512-q6tR3RPqIB1pMiTRMFcZwuG5T8vwp+vUvEG0vuI6B+Rikh5BfPp2fQ82c925FOs+b0lcFQ8CFrL+KbilfZFhOQ=="],
+
+ "@octokit/plugin-rest-endpoint-methods/@octokit/types/@octokit/openapi-types": ["@octokit/openapi-types@20.0.0", "", {}, "sha512-EtqRBEjp1dL/15V7WiX5LJMIxxkdiGJnabzYx5Apx4FkQIFgAfKumXeYAqqJCj1s+BMX4cPFIFC4OLCR6stlnA=="],
+
+ "@octokit/request-error/@octokit/types/@octokit/openapi-types": ["@octokit/openapi-types@24.2.0", "", {}, "sha512-9sIH3nSUttelJSXUrmGzl7QUBFul0/mB8HRYl3fOlgHbIWG+WnYDXU3v/2zMtAvuzZ/ed00Ei6on975FhBfzrg=="],
+
+ "@octokit/request/@octokit/types/@octokit/openapi-types": ["@octokit/openapi-types@24.2.0", "", {}, "sha512-9sIH3nSUttelJSXUrmGzl7QUBFul0/mB8HRYl3fOlgHbIWG+WnYDXU3v/2zMtAvuzZ/ed00Ei6on975FhBfzrg=="],
+
+ "@octokit/rest/@octokit/core/@octokit/auth-token": ["@octokit/auth-token@6.0.0", "", {}, "sha512-P4YJBPdPSpWTQ1NU4XYdvHvXJJDxM6YwpS0FZHRgP7YFkdVxsWcpWGy/NVqlAA7PcPCnMacXlRm1y2PFZRWL/w=="],
+
+ "@octokit/rest/@octokit/core/@octokit/request": ["@octokit/request@10.0.3", "", { "dependencies": { "@octokit/endpoint": "^11.0.0", "@octokit/request-error": "^7.0.0", "@octokit/types": "^14.0.0", "fast-content-type-parse": "^3.0.0", "universal-user-agent": "^7.0.2" } }, "sha512-V6jhKokg35vk098iBqp2FBKunk3kMTXlmq+PtbV9Gl3TfskWlebSofU9uunVKhUN7xl+0+i5vt0TGTG8/p/7HA=="],
+
+ "@octokit/rest/@octokit/core/@octokit/request-error": ["@octokit/request-error@7.0.0", "", { "dependencies": { "@octokit/types": "^14.0.0" } }, "sha512-KRA7VTGdVyJlh0cP5Tf94hTiYVVqmt2f3I6mnimmaVz4UG3gQV/k4mDJlJv3X67iX6rmN7gSHCF8ssqeMnmhZg=="],
+
+ "@octokit/rest/@octokit/core/before-after-hook": ["before-after-hook@4.0.0", "", {}, "sha512-q6tR3RPqIB1pMiTRMFcZwuG5T8vwp+vUvEG0vuI6B+Rikh5BfPp2fQ82c925FOs+b0lcFQ8CFrL+KbilfZFhOQ=="],
+
+ "@octokit/plugin-request-log/@octokit/core/@octokit/request/@octokit/endpoint": ["@octokit/endpoint@11.0.0", "", { "dependencies": { "@octokit/types": "^14.0.0", "universal-user-agent": "^7.0.2" } }, "sha512-hoYicJZaqISMAI3JfaDr1qMNi48OctWuOih1m80bkYow/ayPw6Jj52tqWJ6GEoFTk1gBqfanSoI1iY99Z5+ekQ=="],
+
+ "@octokit/rest/@octokit/core/@octokit/request/@octokit/endpoint": ["@octokit/endpoint@11.0.0", "", { "dependencies": { "@octokit/types": "^14.0.0", "universal-user-agent": "^7.0.2" } }, "sha512-hoYicJZaqISMAI3JfaDr1qMNi48OctWuOih1m80bkYow/ayPw6Jj52tqWJ6GEoFTk1gBqfanSoI1iY99Z5+ekQ=="],
+ }
+}
diff --git a/sdks/github/package.json b/sdks/github/package.json
new file mode 100644
index 0000000000..e1b9222eb2
--- /dev/null
+++ b/sdks/github/package.json
@@ -0,0 +1,19 @@
+{
+ "name": "github",
+ "type": "module",
+ "private": true,
+ "devDependencies": {
+ "@octokit/webhooks-types": "^7.6.1",
+ "@types/bun": "latest",
+ "@types/node": "^24.0.10"
+ },
+ "peerDependencies": {
+ "typescript": "^5"
+ },
+ "dependencies": {
+ "@actions/core": "^1.11.1",
+ "@actions/github": "^6.0.1",
+ "@octokit/graphql": "^9.0.1",
+ "@octokit/rest": "^22.0.0"
+ }
+}
diff --git a/sdks/github/src/index.ts b/sdks/github/src/index.ts
new file mode 100644
index 0000000000..fd6e08aa01
--- /dev/null
+++ b/sdks/github/src/index.ts
@@ -0,0 +1,541 @@
+#!/usr/bin/env bun
+
+import os from "os"
+import path from "path"
+import { $ } from "bun"
+import { Octokit } from "@octokit/rest"
+import { graphql } from "@octokit/graphql"
+import * as core from "@actions/core"
+import * as github from "@actions/github"
+import type { IssueCommentEvent } from "@octokit/webhooks-types"
+import type { GitHubIssue, GitHubPullRequest, IssueQueryResponse, PullRequestQueryResponse } from "./types"
+
+if (github.context.eventName !== "issue_comment") {
+ core.setFailed(`Unsupported event type: ${github.context.eventName}`)
+ process.exit(1)
+}
+
+const { owner, repo } = github.context.repo
+const payload = github.context.payload as IssueCommentEvent
+const actor = github.context.actor
+const issueId = payload.issue.number
+const body = payload.comment.body
+
+let appToken: string
+let octoRest: Octokit
+let octoGraph: typeof graphql
+let commentId: number
+let gitCredentials: string
+let shareUrl: string | undefined
+let state:
+ | {
+ type: "issue"
+ issue: GitHubIssue
+ }
+ | {
+ type: "local-pr"
+ pr: GitHubPullRequest
+ }
+ | {
+ type: "fork-pr"
+ pr: GitHubPullRequest
+ }
+
+async function run() {
+ try {
+ const match = body.match(/^hey\s*opencode,?\s*(.*)$/)
+ if (!match?.[1]) throw new Error("Command must start with `hey opencode`")
+ const userPrompt = match[1]
+
+ const oidcToken = await generateGitHubToken()
+ appToken = await exchangeForAppToken(oidcToken)
+ octoRest = new Octokit({ auth: appToken })
+ octoGraph = graphql.defaults({
+ headers: { authorization: `token ${appToken}` },
+ })
+
+ await configureGit(appToken)
+ await assertPermissions()
+
+ const comment = await createComment("opencode started...")
+ commentId = comment.data.id
+
+ // Set state
+ const repoData = await fetchRepo()
+ if (payload.issue.pull_request) {
+ const prData = await fetchPR()
+ state = {
+ type: prData.headRepository.nameWithOwner === prData.baseRepository.nameWithOwner ? "local-pr" : "fork-pr",
+ pr: prData,
+ }
+ } else {
+ state = {
+ type: "issue",
+ issue: await fetchIssue(),
+ }
+ }
+
+ // Setup git branch
+ if (state.type === "local-pr") await checkoutLocalBranch(state.pr)
+ else if (state.type === "fork-pr") await checkoutForkBranch(state.pr)
+
+ // Prompt
+ const share = process.env.INPUT_SHARE === "true" || !repoData.data.private
+ const promptData = state.type === "issue" ? buildPromptDataForIssue(state.issue) : buildPromptDataForPR(state.pr)
+ const responseRet = await runOpencode(`${userPrompt}\n\n${promptData}`, {
+ share,
+ })
+
+ const response = responseRet.stdout
+ shareUrl = responseRet.stderr.match(/https:\/\/opencode\.ai\/s\/\w+/)?.[0]
+
+ // Comment and push changes
+ if (await branchIsDirty()) {
+ const summary =
+ (await runOpencode(`Summarize the following in less than 40 characters:\n\n${response}`, { share: false }))
+ ?.stdout || `Fix issue: ${payload.issue.title}`
+
+ if (state.type === "issue") {
+ const branch = await pushToNewBranch(summary)
+ const pr = await createPR(repoData.data.default_branch, branch, summary, `${response}\n\nCloses #${issueId}`)
+ await updateComment(`opencode created pull request #${pr}`)
+ } else if (state.type === "local-pr") {
+ await pushToCurrentBranch(summary)
+ await updateComment(response)
+ } else if (state.type === "fork-pr") {
+ await pushToForkBranch(summary, state.pr)
+ await updateComment(response)
+ }
+ } else {
+ await updateComment(response)
+ }
+ await restoreGitConfig()
+ await revokeAppToken()
+ } catch (e: any) {
+ await restoreGitConfig()
+ await revokeAppToken()
+ console.error(e)
+ let msg = e
+ if (e instanceof $.ShellError) {
+ msg = e.stderr.toString()
+ } else if (e instanceof Error) {
+ msg = e.message
+ }
+ if (commentId) await updateComment(msg)
+ core.setFailed(`opencode failed with error: ${msg}`)
+ // Also output the clean error message for the action to capture
+ //core.setOutput("prepare_error", e.message);
+ process.exit(1)
+ }
+}
+
+if (import.meta.main) {
+ run()
+}
+
+async function generateGitHubToken() {
+ try {
+ return await core.getIDToken("opencode-github-action")
+ } catch (error) {
+ console.error("Failed to get OIDC token:", error)
+ throw new Error("Could not fetch an OIDC token. Make sure to add `id-token: write` to your workflow permissions.")
+ }
+}
+
+async function exchangeForAppToken(oidcToken: string) {
+ const response = await fetch("https://api.opencode.ai/exchange_github_app_token", {
+ method: "POST",
+ headers: {
+ Authorization: `Bearer ${oidcToken}`,
+ },
+ })
+
+ if (!response.ok) {
+ const responseJson = (await response.json()) as { error?: string }
+ throw new Error(`App token exchange failed: ${response.status} ${response.statusText} - ${responseJson.error}`)
+ }
+
+ const responseJson = (await response.json()) as { token: string }
+ return responseJson.token
+}
+
+async function configureGit(appToken: string) {
+ console.log("Configuring git...")
+ const config = "http.https://github.com/.extraheader"
+ const ret = await $`git config --local --get ${config}`
+ gitCredentials = ret.stdout.toString().trim()
+
+ const newCredentials = Buffer.from(`x-access-token:${appToken}`, "utf8").toString("base64")
+
+ await $`git config --local --unset-all ${config}`
+ await $`git config --local ${config} "AUTHORIZATION: basic ${newCredentials}"`
+ await $`git config --global user.name "opencode-agent[bot]"`
+ await $`git config --global user.email "opencode-agent[bot]@users.noreply.github.com"`
+}
+
+async function checkoutLocalBranch(pr: GitHubPullRequest) {
+ console.log("Checking out local branch...")
+
+ const branch = pr.headRefName
+ const depth = Math.max(pr.commits.totalCount, 20)
+
+ await $`git fetch origin --depth=${depth} ${branch}`
+ await $`git checkout ${branch}`
+}
+
+async function checkoutForkBranch(pr: GitHubPullRequest) {
+ console.log("Checking out fork branch...")
+
+ const remoteBranch = pr.headRefName
+ const localBranch = generateBranchName()
+ const depth = Math.max(pr.commits.totalCount, 20)
+
+ await $`git remote add fork https://github.com/${pr.headRepository.nameWithOwner}.git`
+ await $`git fetch fork --depth=${depth} ${remoteBranch}`
+ await $`git checkout -b ${localBranch} fork/${remoteBranch}`
+}
+
+async function restoreGitConfig() {
+ if (!gitCredentials) return
+ const config = "http.https://github.com/.extraheader"
+ await $`git config --local ${config} "${gitCredentials}"`
+}
+
+async function assertPermissions() {
+ console.log(`Asserting permissions for user ${actor}...`)
+
+ let permission
+ try {
+ const response = await octoRest.repos.getCollaboratorPermissionLevel({
+ owner,
+ repo,
+ username: actor,
+ })
+
+ permission = response.data.permission
+ console.log(` permission: ${permission}`)
+ } catch (error) {
+ console.error(`Failed to check permissions: ${error}`)
+ throw new Error(`Failed to check permissions for user ${actor}: ${error}`)
+ }
+
+ if (!["admin", "write"].includes(permission)) throw new Error(`User ${actor} does not have write permissions`)
+}
+
+function buildComment(content: string) {
+ const runId = process.env.GITHUB_RUN_ID!
+ const runUrl = `/${owner}/${repo}/actions/runs/${runId}`
+ return [content, "\n\n", shareUrl ? `[view session](${shareUrl}) | ` : "", `[view log](${runUrl})`].join("")
+}
+
+async function createComment(body: string) {
+ console.log("Creating comment...")
+ return await octoRest.rest.issues.createComment({
+ owner,
+ repo,
+ issue_number: issueId,
+ body: buildComment(body),
+ })
+}
+
+async function updateComment(body: string) {
+ console.log("Updating comment...")
+ return await octoRest.rest.issues.updateComment({
+ owner,
+ repo,
+ comment_id: commentId,
+ body: buildComment(body),
+ })
+}
+
+function generateBranchName() {
+ const type = state.type === "issue" ? "issue" : "pr"
+ const timestamp = new Date()
+ .toISOString()
+ .replace(/[:-]/g, "")
+ .replace(/\.\d{3}Z/, "")
+ .split("T")
+ .join("_")
+ return `opencode/${type}${issueId}-${timestamp}`
+}
+
+async function pushToCurrentBranch(summary: string) {
+ console.log("Pushing to current branch...")
+ await $`git add .`
+ await $`git commit -m "${summary}
+
+Co-authored-by: ${actor} <${actor}@users.noreply.github.com>"`
+ await $`git push`
+}
+
+async function pushToForkBranch(summary: string, pr: GitHubPullRequest) {
+ console.log("Pushing to fork branch...")
+
+ const remoteBranch = pr.headRefName
+
+ await $`git add .`
+ await $`git commit -m "${summary}
+
+Co-authored-by: ${actor} <${actor}@users.noreply.github.com>"`
+ await $`git push fork HEAD:${remoteBranch}`
+}
+
+async function pushToNewBranch(summary: string) {
+ console.log("Pushing to new branch...")
+ const branch = generateBranchName()
+ await $`git checkout -b ${branch}`
+ await $`git add .`
+ await $`git commit -m "${summary}
+
+Co-authored-by: ${actor} <${actor}@users.noreply.github.com>"`
+ await $`git push -u origin ${branch}`
+ return branch
+}
+
+async function createPR(base: string, branch: string, title: string, body: string) {
+ console.log("Creating pull request...")
+ const pr = await octoRest.rest.pulls.create({
+ owner,
+ repo,
+ head: branch,
+ base,
+ title,
+ body: buildComment(body),
+ })
+ return pr.data.number
+}
+
+async function runOpencode(
+ prompt: string,
+ opts?: {
+ share?: boolean
+ },
+) {
+ console.log("Running opencode...")
+
+ const promptPath = path.join(os.tmpdir(), "PROMPT")
+ await Bun.write(promptPath, prompt)
+ const ret = await $`cat ${promptPath} | opencode run -m ${process.env.INPUT_MODEL} ${opts?.share ? "--share" : ""}`
+ return {
+ stdout: ret.stdout.toString().trim(),
+ stderr: ret.stderr.toString().trim(),
+ }
+}
+
+async function branchIsDirty() {
+ console.log("Checking if branch is dirty...")
+ const ret = await $`git status --porcelain`
+ return ret.stdout.toString().trim().length > 0
+}
+
+async function fetchRepo() {
+ return await octoRest.rest.repos.get({ owner, repo })
+}
+
+async function fetchIssue() {
+ console.log("Fetching prompt data for issue...")
+ const issueResult = await octoGraph(
+ `
+query($owner: String!, $repo: String!, $number: Int!) {
+ repository(owner: $owner, name: $repo) {
+ issue(number: $number) {
+ title
+ body
+ author {
+ login
+ }
+ createdAt
+ state
+ comments(first: 100) {
+ nodes {
+ id
+ databaseId
+ body
+ author {
+ login
+ }
+ createdAt
+ }
+ }
+ }
+ }
+}`,
+ {
+ owner,
+ repo,
+ number: issueId,
+ },
+ )
+
+ const issue = issueResult.repository.issue
+ if (!issue) throw new Error(`Issue #${issueId} not found`)
+
+ return issue
+}
+
+function buildPromptDataForIssue(issue: GitHubIssue) {
+ const comments = (issue.comments?.nodes || [])
+ .filter((c) => {
+ const id = parseInt(c.databaseId)
+ return id !== commentId && id !== payload.comment.id
+ })
+ .map((c) => ` - ${c.author.login} at ${c.createdAt}: ${c.body}`)
+
+ return [
+ "Here is the context for the issue:",
+ `- Title: ${issue.title}`,
+ `- Body: ${issue.body}`,
+ `- Author: ${issue.author.login}`,
+ `- Created At: ${issue.createdAt}`,
+ `- State: ${issue.state}`,
+ ...(comments.length > 0 ? ["- Comments:", ...comments] : []),
+ ].join("\n")
+}
+
+async function fetchPR() {
+ console.log("Fetching prompt data for PR...")
+ const prResult = await octoGraph(
+ `
+query($owner: String!, $repo: String!, $number: Int!) {
+ repository(owner: $owner, name: $repo) {
+ pullRequest(number: $number) {
+ title
+ body
+ author {
+ login
+ }
+ baseRefName
+ headRefName
+ headRefOid
+ createdAt
+ additions
+ deletions
+ state
+ baseRepository {
+ nameWithOwner
+ }
+ headRepository {
+ nameWithOwner
+ }
+ commits(first: 100) {
+ totalCount
+ nodes {
+ commit {
+ oid
+ message
+ author {
+ name
+ email
+ }
+ }
+ }
+ }
+ files(first: 100) {
+ nodes {
+ path
+ additions
+ deletions
+ changeType
+ }
+ }
+ comments(first: 100) {
+ nodes {
+ id
+ databaseId
+ body
+ author {
+ login
+ }
+ createdAt
+ }
+ }
+ reviews(first: 100) {
+ nodes {
+ id
+ databaseId
+ author {
+ login
+ }
+ body
+ state
+ submittedAt
+ comments(first: 100) {
+ nodes {
+ id
+ databaseId
+ body
+ path
+ line
+ author {
+ login
+ }
+ createdAt
+ }
+ }
+ }
+ }
+ }
+ }
+}`,
+ {
+ owner,
+ repo,
+ number: issueId,
+ },
+ )
+
+ const pr = prResult.repository.pullRequest
+ if (!pr) throw new Error(`PR #${issueId} not found`)
+
+ return pr
+}
+
+function buildPromptDataForPR(pr: GitHubPullRequest) {
+ const comments = (pr.comments?.nodes || [])
+ .filter((c) => {
+ const id = parseInt(c.databaseId)
+ return id !== commentId && id !== payload.comment.id
+ })
+ .map((c) => ` - ${c.author.login} at ${c.createdAt}: ${c.body}`)
+
+ const files = (pr.files.nodes || []).map((f) => ` - ${f.path} (${f.changeType}) +${f.additions}/-${f.deletions}`)
+ const reviewData = (pr.reviews.nodes || []).map((r) => {
+ const comments = (r.comments.nodes || []).map((c) => ` - ${c.path}:${c.line ?? "?"}: ${c.body}`)
+ return [
+ ` - ${r.author.login} at ${r.submittedAt}:`,
+ ` - Review body: ${r.body}`,
+ ...(comments.length > 0 ? [" - Comments:", ...comments] : []),
+ ]
+ })
+
+ return [
+ "Here is the context for the pull request:",
+ `- Title: ${pr.title}`,
+ `- Body: ${pr.body}`,
+ `- Author: ${pr.author.login}`,
+ `- Created At: ${pr.createdAt}`,
+ `- Base Branch: ${pr.baseRefName}`,
+ `- Head Branch: ${pr.headRefName}`,
+ `- State: ${pr.state}`,
+ `- Additions: ${pr.additions}`,
+ `- Deletions: ${pr.deletions}`,
+ `- Total Commits: ${pr.commits.totalCount}`,
+ `- Changed Files: ${pr.files.nodes.length} files`,
+ ...(comments.length > 0 ? ["- Comments:", ...comments] : []),
+ ...(files.length > 0 ? ["- Changed files:", ...files] : []),
+ ...(reviewData.length > 0 ? ["- Reviews:", ...reviewData] : []),
+ ].join("\n")
+}
+
+async function revokeAppToken() {
+ if (!appToken) return
+
+ await fetch("https://api.github.com/installation/token", {
+ method: "DELETE",
+ headers: {
+ Authorization: `Bearer ${appToken}`,
+ Accept: "application/vnd.github+json",
+ "X-GitHub-Api-Version": "2022-11-28",
+ },
+ })
+}
diff --git a/sdks/github/src/types.ts b/sdks/github/src/types.ts
new file mode 100644
index 0000000000..fe0058fbd0
--- /dev/null
+++ b/sdks/github/src/types.ts
@@ -0,0 +1,103 @@
+// Types for GitHub GraphQL query responses
+export type GitHubAuthor = {
+ login: string;
+ name?: string;
+};
+
+export type GitHubComment = {
+ id: string;
+ databaseId: string;
+ body: string;
+ author: GitHubAuthor;
+ createdAt: string;
+};
+
+export type GitHubReviewComment = GitHubComment & {
+ path: string;
+ line: number | null;
+};
+
+export type GitHubCommit = {
+ oid: string;
+ message: string;
+ author: {
+ name: string;
+ email: string;
+ };
+};
+
+export type GitHubFile = {
+ path: string;
+ additions: number;
+ deletions: number;
+ changeType: string;
+};
+
+export type GitHubReview = {
+ id: string;
+ databaseId: string;
+ author: GitHubAuthor;
+ body: string;
+ state: string;
+ submittedAt: string;
+ comments: {
+ nodes: GitHubReviewComment[];
+ };
+};
+
+export type GitHubPullRequest = {
+ title: string;
+ body: string;
+ author: GitHubAuthor;
+ baseRefName: string;
+ headRefName: string;
+ headRefOid: string;
+ createdAt: string;
+ additions: number;
+ deletions: number;
+ state: string;
+ baseRepository: {
+ nameWithOwner: string;
+ };
+ headRepository: {
+ nameWithOwner: string;
+ };
+ commits: {
+ totalCount: number;
+ nodes: Array<{
+ commit: GitHubCommit;
+ }>;
+ };
+ files: {
+ nodes: GitHubFile[];
+ };
+ comments: {
+ nodes: GitHubComment[];
+ };
+ reviews: {
+ nodes: GitHubReview[];
+ };
+};
+
+export type GitHubIssue = {
+ title: string;
+ body: string;
+ author: GitHubAuthor;
+ createdAt: string;
+ state: string;
+ comments: {
+ nodes: GitHubComment[];
+ };
+};
+
+export type PullRequestQueryResponse = {
+ repository: {
+ pullRequest: GitHubPullRequest;
+ };
+};
+
+export type IssueQueryResponse = {
+ repository: {
+ issue: GitHubIssue;
+ };
+};
diff --git a/sdks/github/sst-env.d.ts b/sdks/github/sst-env.d.ts
new file mode 100644
index 0000000000..b6a7e9066e
--- /dev/null
+++ b/sdks/github/sst-env.d.ts
@@ -0,0 +1,9 @@
+/* This file is auto-generated by SST. Do not edit. */
+/* tslint:disable */
+/* eslint-disable */
+/* deno-fmt-ignore-file */
+
+///
+
+import "sst"
+export {}
\ No newline at end of file
diff --git a/sdks/github/tsconfig.json b/sdks/github/tsconfig.json
new file mode 100644
index 0000000000..59435b49c4
--- /dev/null
+++ b/sdks/github/tsconfig.json
@@ -0,0 +1,29 @@
+{
+ "compilerOptions": {
+ // Environment setup & latest features
+ "lib": ["ESNext"],
+ "target": "ESNext",
+ "module": "ESNext",
+ "moduleDetection": "force",
+ "jsx": "react-jsx",
+ "allowJs": true,
+
+ // Bundler mode
+ "moduleResolution": "bundler",
+ "allowImportingTsExtensions": true,
+ "verbatimModuleSyntax": true,
+ "noEmit": true,
+
+ // Best practices
+ "strict": true,
+ "skipLibCheck": true,
+ "noFallthroughCasesInSwitch": true,
+ "noUncheckedIndexedAccess": true,
+ "noImplicitOverride": true,
+
+ // Some stricter flags (disabled by default)
+ "noUnusedLocals": false,
+ "noUnusedParameters": false,
+ "noPropertyAccessFromIndexSignature": false
+ }
+}
diff --git a/stainless.yml b/stainless.yml
index aec6817f51..42f42b4cdb 100644
--- a/stainless.yml
+++ b/stainless.yml
@@ -49,12 +49,15 @@ resources:
models:
app: App
logLevel: LogLevel
+ provider: Provider
+ model: Model
mode: Mode
methods:
get: get /app
init: post /app/init
log: post /log
modes: get /mode
+ providers: get /config/providers
find:
models:
@@ -75,27 +78,28 @@ resources:
config:
models:
config: Config
- keybinds: KeybindsConfig
- mcpLocal: McpLocalConfig
- mcpRemote: McpRemoteConfig
- provider: Provider
- model: Model
+ keybindsConfig: KeybindsConfig
+ mcpLocalConfig: McpLocalConfig
+ mcpRemoteConfig: McpRemoteConfig
+ modeConfig: ModeConfig
methods:
get: get /config
- providers: get /config/providers
session:
models:
session: Session
message: Message
+ part: Part
textPart: TextPart
+ textPartInput: TextPartInput
filePart: FilePart
+ filePartInput: FilePartInput
toolPart: ToolPart
stepStartPart: StepStartPart
+ stepFinishPart: StepFinishPart
+ snapshotPart: SnapshotPart
assistantMessage: AssistantMessage
- assistantMessagePart: AssistantMessagePart
userMessage: UserMessage
- userMessagePart: UserMessagePart
toolStatePending: ToolStatePending
toolStateRunning: ToolStateRunning
toolStateCompleted: ToolStateCompleted
@@ -124,9 +128,13 @@ readme:
example_requests:
default:
type: request
- endpoint: get /event
+ endpoint: get /session
params: {}
headline:
+ type: request
+ endpoint: get /session
+ params: {}
+ streaming:
type: request
endpoint: get /event
params: {}