From cc0d4609046bc25f2873be38bcf5c3fc92b420d5 Mon Sep 17 00:00:00 2001 From: opencode Date: Mon, 29 Sep 2025 05:53:07 +0000 Subject: [PATCH 01/12] release: v0.13.4 --- bun.lock | 18 +++++++++--------- packages/app/package.json | 2 +- packages/console/app/package.json | 2 +- packages/console/core/package.json | 2 +- packages/console/function/package.json | 2 +- packages/console/scripts/package.json | 2 +- packages/function/package.json | 2 +- packages/opencode/package.json | 2 +- packages/plugin/package.json | 2 +- packages/sdk/js/package.json | 2 +- packages/web/package.json | 2 +- sdks/vscode/package.json | 2 +- 12 files changed, 20 insertions(+), 20 deletions(-) diff --git a/bun.lock b/bun.lock index e40f05697..1ac0d48b5 100644 --- a/bun.lock +++ b/bun.lock @@ -12,7 +12,7 @@ }, "packages/app": { "name": "@opencode/app", - "version": "0.13.2", + "version": "0.13.4", "dependencies": { "@kobalte/core": "0.13.11", "@opencode-ai/sdk": "workspace:*", @@ -60,7 +60,7 @@ }, "packages/console/core": { "name": "@opencode/console-core", - "version": "0.13.2", + "version": "0.13.4", "dependencies": { "@aws-sdk/client-sts": "3.782.0", "@opencode/console-resource": "workspace:*", @@ -77,7 +77,7 @@ }, "packages/console/function": { "name": "@opencode/console-function", - "version": "0.13.2", + "version": "0.13.4", "dependencies": { "@ai-sdk/anthropic": "2.0.0", "@ai-sdk/openai": "2.0.2", @@ -103,7 +103,7 @@ }, "packages/console/scripts": { "name": "@opencode/console-scripts", - "version": "0.13.2", + "version": "0.13.4", "dependencies": { "@opencode/console-core": "workspace:*", "tsx": "4.20.5", @@ -115,7 +115,7 @@ }, "packages/function": { "name": "@opencode/function", - "version": "0.13.2", + "version": "0.13.4", "dependencies": { "@octokit/auth-app": "8.0.1", "@octokit/rest": "22.0.0", @@ -130,7 +130,7 @@ }, "packages/opencode": { "name": "opencode", - "version": "0.13.2", + "version": "0.13.4", "bin": { "opencode": "./bin/opencode", }, @@ -181,7 +181,7 @@ }, "packages/plugin": { "name": "@opencode-ai/plugin", - "version": "0.13.2", + "version": "0.13.4", "dependencies": { "@opencode-ai/sdk": "workspace:*", "zod": "catalog:", @@ -193,7 +193,7 @@ }, "packages/sdk/js": { "name": "@opencode-ai/sdk", - "version": "0.13.2", + "version": "0.13.4", "dependencies": { "@hey-api/openapi-ts": "0.81.0", }, @@ -205,7 +205,7 @@ }, "packages/web": { "name": "@opencode/web", - "version": "0.13.2", + "version": "0.13.4", "dependencies": { "@astrojs/cloudflare": "12.6.3", "@astrojs/markdown-remark": "6.3.1", diff --git a/packages/app/package.json b/packages/app/package.json index ededee45d..9da48237d 100644 --- a/packages/app/package.json +++ b/packages/app/package.json @@ -1,6 +1,6 @@ { "name": "@opencode/app", - "version": "0.13.2", + "version": "0.13.4", "description": "", "type": "module", "scripts": { diff --git a/packages/console/app/package.json b/packages/console/app/package.json index 24b4a69c1..3654b2211 100644 --- a/packages/console/app/package.json +++ b/packages/console/app/package.json @@ -7,7 +7,7 @@ "dev:remote": "VITE_AUTH_URL=https://auth.dev.opencode.ai bun sst shell --stage=dev bun dev", "build": "vinxi build && ../../opencode/script/schema.ts ./.output/public/config.json", "start": "vinxi start", - "version": "0.13.2" + "version": "0.13.4" }, "dependencies": { "@ibm/plex": "6.4.1", diff --git a/packages/console/core/package.json b/packages/console/core/package.json index 6bb850d87..7224f89a5 100644 --- a/packages/console/core/package.json +++ b/packages/console/core/package.json @@ -1,7 +1,7 @@ { "$schema": "https://json.schemastore.org/package.json", "name": "@opencode/console-core", - "version": "0.13.2", + "version": "0.13.4", "private": true, "type": "module", "dependencies": { diff --git a/packages/console/function/package.json b/packages/console/function/package.json index 6fa31a936..2cea6109b 100644 --- a/packages/console/function/package.json +++ b/packages/console/function/package.json @@ -1,6 +1,6 @@ { "name": "@opencode/console-function", - "version": "0.13.2", + "version": "0.13.4", "$schema": "https://json.schemastore.org/package.json", "private": true, "type": "module", diff --git a/packages/console/scripts/package.json b/packages/console/scripts/package.json index e02ed041f..b27ddf6ca 100644 --- a/packages/console/scripts/package.json +++ b/packages/console/scripts/package.json @@ -1,6 +1,6 @@ { "name": "@opencode/console-scripts", - "version": "0.13.2", + "version": "0.13.4", "$schema": "https://json.schemastore.org/package.json", "private": true, "type": "module", diff --git a/packages/function/package.json b/packages/function/package.json index 4f09e6be3..ee47c1a76 100644 --- a/packages/function/package.json +++ b/packages/function/package.json @@ -1,6 +1,6 @@ { "name": "@opencode/function", - "version": "0.13.2", + "version": "0.13.4", "$schema": "https://json.schemastore.org/package.json", "private": true, "type": "module", diff --git a/packages/opencode/package.json b/packages/opencode/package.json index 206fc6675..c5c01f4a0 100644 --- a/packages/opencode/package.json +++ b/packages/opencode/package.json @@ -1,6 +1,6 @@ { "$schema": "https://json.schemastore.org/package.json", - "version": "0.13.2", + "version": "0.13.4", "name": "opencode", "type": "module", "private": true, diff --git a/packages/plugin/package.json b/packages/plugin/package.json index 1774ae882..421ed7fa6 100644 --- a/packages/plugin/package.json +++ b/packages/plugin/package.json @@ -1,7 +1,7 @@ { "$schema": "https://json.schemastore.org/package.json", "name": "@opencode-ai/plugin", - "version": "0.13.2", + "version": "0.13.4", "type": "module", "scripts": { "typecheck": "tsc --noEmit", diff --git a/packages/sdk/js/package.json b/packages/sdk/js/package.json index 3e7447764..36b09ee6d 100644 --- a/packages/sdk/js/package.json +++ b/packages/sdk/js/package.json @@ -1,7 +1,7 @@ { "$schema": "https://json.schemastore.org/package.json", "name": "@opencode-ai/sdk", - "version": "0.13.2", + "version": "0.13.4", "type": "module", "scripts": { "typecheck": "tsc --noEmit", diff --git a/packages/web/package.json b/packages/web/package.json index 1608bff2f..40ddc88ed 100644 --- a/packages/web/package.json +++ b/packages/web/package.json @@ -1,7 +1,7 @@ { "name": "@opencode/web", "type": "module", - "version": "0.13.2", + "version": "0.13.4", "scripts": { "dev": "astro dev", "dev:remote": "VITE_API_URL=https://api.opencode.ai astro dev", diff --git a/sdks/vscode/package.json b/sdks/vscode/package.json index 4835d9f52..7ae361dc3 100644 --- a/sdks/vscode/package.json +++ b/sdks/vscode/package.json @@ -2,7 +2,7 @@ "name": "opencode", "displayName": "opencode", "description": "opencode for VS Code", - "version": "0.13.2", + "version": "0.13.4", "publisher": "sst-dev", "repository": { "type": "git", From 468201190eacb7b0e573f2ee8a603894db829b1b Mon Sep 17 00:00:00 2001 From: Giuseppe Rota <403432+grota@users.noreply.github.com> Date: Mon, 29 Sep 2025 13:52:26 +0200 Subject: [PATCH 02/12] docs: document model id behavior (#2856) --- packages/web/src/content/docs/models.mdx | 33 +++++++++++++++++++++++- 1 file changed, 32 insertions(+), 1 deletion(-) diff --git a/packages/web/src/content/docs/models.mdx b/packages/web/src/content/docs/models.mdx index efebc5cb4..b3fc4c28f 100644 --- a/packages/web/src/content/docs/models.mdx +++ b/packages/web/src/content/docs/models.mdx @@ -100,10 +100,41 @@ You can globally configure a model's options through the config. } ``` -Here we're configuring global settings for two models: `gpt-5` when accessed via the `openai` provider, and `claude-sonnet-4-20250514` when accessed via the `anthropic` provider. +Here we're configuring global settings for two built-in models: `gpt-5` when accessed via the `openai` provider, and `claude-sonnet-4-20250514` when accessed via the `anthropic` provider. +The built-in provider and model names can be found on [Models.dev](https://models.dev). You can also configure these options for any agents that you are using. The agent config overrides any global options here. [Learn more](/docs/agents/#additional). +You can also define custom models that extend built-in ones and can optionally use specific options by referring to their id: + +```jsonc title="opencode.jsonc" {6-20} +{ + "$schema": "https://opencode.ai/config.json", + "provider": { + "opencode": { + "models": { + "gpt-5-high": { + "id": "gpt-5", + "options": { + "reasoningEffort": "high", + "textVerbosity": "low", + "reasoningSummary": "auto" + } + }, + "gpt-5-low": { + "id": "gpt-5", + "options": { + "reasoningEffort": "low", + "textVerbosity": "low", + "reasoningSummary": "auto" + } + } + } + } + } +} +``` + --- ## Loading models From 478ead6a0553df9e1267d32aca2149f177922862 Mon Sep 17 00:00:00 2001 From: GitHub Action Date: Mon, 29 Sep 2025 12:04:29 +0000 Subject: [PATCH 03/12] ignore: update download stats 2025-09-29 --- STATS.md | 1 + 1 file changed, 1 insertion(+) diff --git a/STATS.md b/STATS.md index b92604813..1f946e052 100644 --- a/STATS.md +++ b/STATS.md @@ -93,3 +93,4 @@ | 2025-09-26 | 404,334 (+5,455) | 306,713 (+5,050) | 711,047 (+10,505) | | 2025-09-27 | 411,618 (+7,284) | 317,763 (+11,050) | 729,381 (+18,334) | | 2025-09-28 | 414,910 (+3,292) | 322,522 (+4,759) | 737,432 (+8,051) | +| 2025-09-29 | 419,919 (+5,009) | 328,033 (+5,511) | 747,952 (+10,520) | From edeaab321aeea77e696ccb7c7c7f28fd25cef722 Mon Sep 17 00:00:00 2001 From: Aiden Cline <63023139+rekram1-node@users.noreply.github.com> Date: Mon, 29 Sep 2025 08:51:46 -0500 Subject: [PATCH 04/12] fix: bash regex (#2858) --- packages/opencode/src/config/markdown.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/opencode/src/config/markdown.ts b/packages/opencode/src/config/markdown.ts index e0e5afe42..a4dcbf5d4 100644 --- a/packages/opencode/src/config/markdown.ts +++ b/packages/opencode/src/config/markdown.ts @@ -1,6 +1,6 @@ export namespace ConfigMarkdown { export const FILE_REGEX = /(? Date: Mon, 29 Sep 2025 14:12:58 +0000 Subject: [PATCH 05/12] release: v0.13.5 --- bun.lock | 18 +++++++++--------- packages/app/package.json | 2 +- packages/console/app/package.json | 2 +- packages/console/core/package.json | 2 +- packages/console/function/package.json | 2 +- packages/console/scripts/package.json | 2 +- packages/function/package.json | 2 +- packages/opencode/package.json | 2 +- packages/plugin/package.json | 2 +- packages/sdk/js/package.json | 2 +- packages/web/package.json | 2 +- sdks/vscode/package.json | 2 +- 12 files changed, 20 insertions(+), 20 deletions(-) diff --git a/bun.lock b/bun.lock index 1ac0d48b5..d1b83367a 100644 --- a/bun.lock +++ b/bun.lock @@ -12,7 +12,7 @@ }, "packages/app": { "name": "@opencode/app", - "version": "0.13.4", + "version": "0.13.5", "dependencies": { "@kobalte/core": "0.13.11", "@opencode-ai/sdk": "workspace:*", @@ -60,7 +60,7 @@ }, "packages/console/core": { "name": "@opencode/console-core", - "version": "0.13.4", + "version": "0.13.5", "dependencies": { "@aws-sdk/client-sts": "3.782.0", "@opencode/console-resource": "workspace:*", @@ -77,7 +77,7 @@ }, "packages/console/function": { "name": "@opencode/console-function", - "version": "0.13.4", + "version": "0.13.5", "dependencies": { "@ai-sdk/anthropic": "2.0.0", "@ai-sdk/openai": "2.0.2", @@ -103,7 +103,7 @@ }, "packages/console/scripts": { "name": "@opencode/console-scripts", - "version": "0.13.4", + "version": "0.13.5", "dependencies": { "@opencode/console-core": "workspace:*", "tsx": "4.20.5", @@ -115,7 +115,7 @@ }, "packages/function": { "name": "@opencode/function", - "version": "0.13.4", + "version": "0.13.5", "dependencies": { "@octokit/auth-app": "8.0.1", "@octokit/rest": "22.0.0", @@ -130,7 +130,7 @@ }, "packages/opencode": { "name": "opencode", - "version": "0.13.4", + "version": "0.13.5", "bin": { "opencode": "./bin/opencode", }, @@ -181,7 +181,7 @@ }, "packages/plugin": { "name": "@opencode-ai/plugin", - "version": "0.13.4", + "version": "0.13.5", "dependencies": { "@opencode-ai/sdk": "workspace:*", "zod": "catalog:", @@ -193,7 +193,7 @@ }, "packages/sdk/js": { "name": "@opencode-ai/sdk", - "version": "0.13.4", + "version": "0.13.5", "dependencies": { "@hey-api/openapi-ts": "0.81.0", }, @@ -205,7 +205,7 @@ }, "packages/web": { "name": "@opencode/web", - "version": "0.13.4", + "version": "0.13.5", "dependencies": { "@astrojs/cloudflare": "12.6.3", "@astrojs/markdown-remark": "6.3.1", diff --git a/packages/app/package.json b/packages/app/package.json index 9da48237d..75ebe811d 100644 --- a/packages/app/package.json +++ b/packages/app/package.json @@ -1,6 +1,6 @@ { "name": "@opencode/app", - "version": "0.13.4", + "version": "0.13.5", "description": "", "type": "module", "scripts": { diff --git a/packages/console/app/package.json b/packages/console/app/package.json index 3654b2211..52f69bfde 100644 --- a/packages/console/app/package.json +++ b/packages/console/app/package.json @@ -7,7 +7,7 @@ "dev:remote": "VITE_AUTH_URL=https://auth.dev.opencode.ai bun sst shell --stage=dev bun dev", "build": "vinxi build && ../../opencode/script/schema.ts ./.output/public/config.json", "start": "vinxi start", - "version": "0.13.4" + "version": "0.13.5" }, "dependencies": { "@ibm/plex": "6.4.1", diff --git a/packages/console/core/package.json b/packages/console/core/package.json index 7224f89a5..0fce4b3dd 100644 --- a/packages/console/core/package.json +++ b/packages/console/core/package.json @@ -1,7 +1,7 @@ { "$schema": "https://json.schemastore.org/package.json", "name": "@opencode/console-core", - "version": "0.13.4", + "version": "0.13.5", "private": true, "type": "module", "dependencies": { diff --git a/packages/console/function/package.json b/packages/console/function/package.json index 2cea6109b..2461ac880 100644 --- a/packages/console/function/package.json +++ b/packages/console/function/package.json @@ -1,6 +1,6 @@ { "name": "@opencode/console-function", - "version": "0.13.4", + "version": "0.13.5", "$schema": "https://json.schemastore.org/package.json", "private": true, "type": "module", diff --git a/packages/console/scripts/package.json b/packages/console/scripts/package.json index b27ddf6ca..11beb8fe0 100644 --- a/packages/console/scripts/package.json +++ b/packages/console/scripts/package.json @@ -1,6 +1,6 @@ { "name": "@opencode/console-scripts", - "version": "0.13.4", + "version": "0.13.5", "$schema": "https://json.schemastore.org/package.json", "private": true, "type": "module", diff --git a/packages/function/package.json b/packages/function/package.json index ee47c1a76..a96b4118c 100644 --- a/packages/function/package.json +++ b/packages/function/package.json @@ -1,6 +1,6 @@ { "name": "@opencode/function", - "version": "0.13.4", + "version": "0.13.5", "$schema": "https://json.schemastore.org/package.json", "private": true, "type": "module", diff --git a/packages/opencode/package.json b/packages/opencode/package.json index c5c01f4a0..d88615487 100644 --- a/packages/opencode/package.json +++ b/packages/opencode/package.json @@ -1,6 +1,6 @@ { "$schema": "https://json.schemastore.org/package.json", - "version": "0.13.4", + "version": "0.13.5", "name": "opencode", "type": "module", "private": true, diff --git a/packages/plugin/package.json b/packages/plugin/package.json index 421ed7fa6..b89a0c78a 100644 --- a/packages/plugin/package.json +++ b/packages/plugin/package.json @@ -1,7 +1,7 @@ { "$schema": "https://json.schemastore.org/package.json", "name": "@opencode-ai/plugin", - "version": "0.13.4", + "version": "0.13.5", "type": "module", "scripts": { "typecheck": "tsc --noEmit", diff --git a/packages/sdk/js/package.json b/packages/sdk/js/package.json index 36b09ee6d..3137e47df 100644 --- a/packages/sdk/js/package.json +++ b/packages/sdk/js/package.json @@ -1,7 +1,7 @@ { "$schema": "https://json.schemastore.org/package.json", "name": "@opencode-ai/sdk", - "version": "0.13.4", + "version": "0.13.5", "type": "module", "scripts": { "typecheck": "tsc --noEmit", diff --git a/packages/web/package.json b/packages/web/package.json index 40ddc88ed..baee8f20d 100644 --- a/packages/web/package.json +++ b/packages/web/package.json @@ -1,7 +1,7 @@ { "name": "@opencode/web", "type": "module", - "version": "0.13.4", + "version": "0.13.5", "scripts": { "dev": "astro dev", "dev:remote": "VITE_API_URL=https://api.opencode.ai astro dev", diff --git a/sdks/vscode/package.json b/sdks/vscode/package.json index 7ae361dc3..c419cf4c8 100644 --- a/sdks/vscode/package.json +++ b/sdks/vscode/package.json @@ -2,7 +2,7 @@ "name": "opencode", "displayName": "opencode", "description": "opencode for VS Code", - "version": "0.13.4", + "version": "0.13.5", "publisher": "sst-dev", "repository": { "type": "git", From 7447460b5af698d7d88717ad47e9d256ea81bd88 Mon Sep 17 00:00:00 2001 From: Frank Date: Mon, 29 Sep 2025 14:17:53 -0400 Subject: [PATCH 06/12] wip: zen --- github/sst-env.d.ts | 2 +- infra/app.ts | 1 + infra/console.ts | 3 +- packages/app/src/sst-env.d.ts | 6 +- packages/app/sst-env.d.ts | 2 +- .../src/routes/workspace/member-section.tsx | 42 +- packages/console/app/sst-env.d.ts | 2 +- .../migrations/0020_supreme_jack_power.sql | 1 + .../core/migrations/meta/0020_snapshot.json | 695 ++++++++++++++++++ .../core/migrations/meta/_journal.json | 7 + packages/console/core/src/actor.ts | 2 +- packages/console/core/src/schema/user.sql.ts | 6 +- packages/console/core/src/workspace.ts | 2 +- packages/console/core/sst-env.d.ts | 2 +- packages/console/function/sst-env.d.ts | 110 +-- packages/console/resource/sst-env.d.ts | 110 +-- packages/console/scripts/sst-env.d.ts | 2 +- packages/function/sst-env.d.ts | 110 +-- packages/opencode/sst-env.d.ts | 2 +- packages/plugin/sst-env.d.ts | 2 +- packages/sdk/js/sst-env.d.ts | 2 +- packages/web/sst-env.d.ts | 2 +- sdks/vscode/sst-env.d.ts | 2 +- sst-env.d.ts | 122 +-- 24 files changed, 995 insertions(+), 242 deletions(-) create mode 100644 packages/console/core/migrations/0020_supreme_jack_power.sql create mode 100644 packages/console/core/migrations/meta/0020_snapshot.json diff --git a/github/sst-env.d.ts b/github/sst-env.d.ts index 6b69016e7..f742a1200 100644 --- a/github/sst-env.d.ts +++ b/github/sst-env.d.ts @@ -6,4 +6,4 @@ /// import "sst" -export {} +export {} \ No newline at end of file diff --git a/infra/app.ts b/infra/app.ts index 465ed9052..151879208 100644 --- a/infra/app.ts +++ b/infra/app.ts @@ -2,6 +2,7 @@ import { domain } from "./stage" const GITHUB_APP_ID = new sst.Secret("GITHUB_APP_ID") const GITHUB_APP_PRIVATE_KEY = new sst.Secret("GITHUB_APP_PRIVATE_KEY") +export const EMAILOCTOPUS_API_KEY = new sst.Secret("EMAILOCTOPUS_API_KEY") const bucket = new sst.cloudflare.Bucket("Bucket") export const api = new sst.cloudflare.Worker("Api", { diff --git a/infra/console.ts b/infra/console.ts index b898995d9..bab661975 100644 --- a/infra/console.ts +++ b/infra/console.ts @@ -1,4 +1,5 @@ import { domain } from "./stage" +import { EMAILOCTOPUS_API_KEY } from "./app" //////////////// // DATABASE @@ -121,7 +122,7 @@ if ($app.stage === "production" || $app.stage === "frank") { new sst.cloudflare.x.SolidStart("Console", { domain, path: "packages/console/app", - link: [database, AUTH_API_URL, STRIPE_WEBHOOK_SECRET, STRIPE_SECRET_KEY, ZEN_MODELS], + link: [database, AUTH_API_URL, STRIPE_WEBHOOK_SECRET, STRIPE_SECRET_KEY, ZEN_MODELS, EMAILOCTOPUS_API_KEY], environment: { //VITE_DOCS_URL: web.url.apply((url) => url!), //VITE_API_URL: gateway.url.apply((url) => url!), diff --git a/packages/app/src/sst-env.d.ts b/packages/app/src/sst-env.d.ts index 1b1683a1e..47a8fbec7 100644 --- a/packages/app/src/sst-env.d.ts +++ b/packages/app/src/sst-env.d.ts @@ -2,7 +2,9 @@ /* tslint:disable */ /* eslint-disable */ /// -interface ImportMetaEnv {} +interface ImportMetaEnv { + +} interface ImportMeta { readonly env: ImportMetaEnv -} +} \ No newline at end of file diff --git a/packages/app/sst-env.d.ts b/packages/app/sst-env.d.ts index 0397645b5..b6a7e9066 100644 --- a/packages/app/sst-env.d.ts +++ b/packages/app/sst-env.d.ts @@ -6,4 +6,4 @@ /// import "sst" -export {} +export {} \ No newline at end of file diff --git a/packages/console/app/src/routes/workspace/member-section.tsx b/packages/console/app/src/routes/workspace/member-section.tsx index 602c29efc..d0afd7eb9 100644 --- a/packages/console/app/src/routes/workspace/member-section.tsx +++ b/packages/console/app/src/routes/workspace/member-section.tsx @@ -5,7 +5,7 @@ import { createStore } from "solid-js/store" import { formatDateUTC, formatDateForTable } from "./common" import styles from "./member-section.module.css" import { and, Database, eq, sql } from "@opencode/console-core/drizzle/index.js" -import { UserTable } from "@opencode/console-core/schema/user.sql.js" +import { UserTable, UserRole } from "@opencode/console-core/schema/user.sql.js" import { Identifier } from "@opencode/console-core/identifier.js" const removeMember = action(async (form: FormData) => { @@ -31,10 +31,12 @@ const removeMember = action(async (form: FormData) => { const inviteMember = action(async (form: FormData) => { "use server" - const name = form.get("name")?.toString().trim() - if (!name) return { error: "Name is required" } + const email = form.get("email")?.toString().trim() + if (!email) return { error: "Email is required" } const workspaceID = form.get("workspaceID")?.toString() if (!workspaceID) return { error: "Workspace ID is required" } + const role = form.get("role")?.toString() as (typeof UserRole)[number] + if (!role) return { error: "Role is required" } return json( await withActor( () => @@ -44,12 +46,10 @@ const inviteMember = action(async (form: FormData) => { .values({ id: Identifier.create("user"), name: "", - email: name, + email, workspaceID, - role: "member", - timeJoined: sql`now()`, + role, }) - .onDuplicateKeyUpdate({ set: { timeJoined: sql`now()` } }) .then((data) => ({ error: undefined, data })) .catch((e) => ({ error: e.message as string })), ), @@ -109,7 +109,23 @@ export function MemberCreateForm() { >
- (input = r)} data-component="input" name="name" type="text" placeholder="Enter email" /> + (input = r)} data-component="input" name="email" type="text" placeholder="Enter email" /> +
+ + +
{(err) =>
{err()}
}
@@ -160,15 +176,15 @@ export function MemberSection() { {(member) => { - const [copied, setCopied] = createSignal(false) - // const submission = useSubmission(removeKey, ([fd]) => fd.get("id")?.toString() === key.id) return ( {member.email} {member.role} - - {formatDateForTable(member.timeJoined!)} - + invited}> + + {formatDateForTable(member.timeSeen!)} + + diff --git a/packages/console/app/sst-env.d.ts b/packages/console/app/sst-env.d.ts index bd5588217..9b9de7327 100644 --- a/packages/console/app/sst-env.d.ts +++ b/packages/console/app/sst-env.d.ts @@ -6,4 +6,4 @@ /// import "sst" -export {} +export {} \ No newline at end of file diff --git a/packages/console/core/migrations/0020_supreme_jack_power.sql b/packages/console/core/migrations/0020_supreme_jack_power.sql new file mode 100644 index 000000000..93e34e142 --- /dev/null +++ b/packages/console/core/migrations/0020_supreme_jack_power.sql @@ -0,0 +1 @@ +ALTER TABLE `user` DROP COLUMN `time_joined`; \ No newline at end of file diff --git a/packages/console/core/migrations/meta/0020_snapshot.json b/packages/console/core/migrations/meta/0020_snapshot.json new file mode 100644 index 000000000..662093f55 --- /dev/null +++ b/packages/console/core/migrations/meta/0020_snapshot.json @@ -0,0 +1,695 @@ +{ + "version": "5", + "dialect": "mysql", + "id": "908437f9-54ed-4c83-b555-614926e326f8", + "prevId": "a2bb7222-561c-45f0-8939-8ef9b8e57bb3", + "tables": { + "account": { + "name": "account", + "columns": { + "id": { + "name": "id", + "type": "varchar(30)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "time_created": { + "name": "time_created", + "type": "timestamp(3)", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "(now())" + }, + "time_updated": { + "name": "time_updated", + "type": "timestamp(3)", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "CURRENT_TIMESTAMP(3) ON UPDATE CURRENT_TIMESTAMP(3)" + }, + "time_deleted": { + "name": "time_deleted", + "type": "timestamp(3)", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "email": { + "name": "email", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + } + }, + "indexes": { + "email": { + "name": "email", + "columns": [ + "email" + ], + "isUnique": true + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraint": {} + }, + "billing": { + "name": "billing", + "columns": { + "id": { + "name": "id", + "type": "varchar(30)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "workspace_id": { + "name": "workspace_id", + "type": "varchar(30)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "time_created": { + "name": "time_created", + "type": "timestamp(3)", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "(now())" + }, + "time_updated": { + "name": "time_updated", + "type": "timestamp(3)", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "CURRENT_TIMESTAMP(3) ON UPDATE CURRENT_TIMESTAMP(3)" + }, + "time_deleted": { + "name": "time_deleted", + "type": "timestamp(3)", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "customer_id": { + "name": "customer_id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "payment_method_id": { + "name": "payment_method_id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "payment_method_last4": { + "name": "payment_method_last4", + "type": "varchar(4)", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "balance": { + "name": "balance", + "type": "bigint", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "monthly_limit": { + "name": "monthly_limit", + "type": "int", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "monthly_usage": { + "name": "monthly_usage", + "type": "bigint", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "time_monthly_usage_updated": { + "name": "time_monthly_usage_updated", + "type": "timestamp(3)", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "reload": { + "name": "reload", + "type": "boolean", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "reload_error": { + "name": "reload_error", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "time_reload_error": { + "name": "time_reload_error", + "type": "timestamp(3)", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "time_reload_locked_till": { + "name": "time_reload_locked_till", + "type": "timestamp(3)", + "primaryKey": false, + "notNull": false, + "autoincrement": false + } + }, + "indexes": { + "global_customer_id": { + "name": "global_customer_id", + "columns": [ + "customer_id" + ], + "isUnique": true + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": { + "billing_workspace_id_id_pk": { + "name": "billing_workspace_id_id_pk", + "columns": [ + "workspace_id", + "id" + ] + } + }, + "uniqueConstraints": {}, + "checkConstraint": {} + }, + "payment": { + "name": "payment", + "columns": { + "id": { + "name": "id", + "type": "varchar(30)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "workspace_id": { + "name": "workspace_id", + "type": "varchar(30)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "time_created": { + "name": "time_created", + "type": "timestamp(3)", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "(now())" + }, + "time_updated": { + "name": "time_updated", + "type": "timestamp(3)", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "CURRENT_TIMESTAMP(3) ON UPDATE CURRENT_TIMESTAMP(3)" + }, + "time_deleted": { + "name": "time_deleted", + "type": "timestamp(3)", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "customer_id": { + "name": "customer_id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "invoice_id": { + "name": "invoice_id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "payment_id": { + "name": "payment_id", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "amount": { + "name": "amount", + "type": "bigint", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "time_refunded": { + "name": "time_refunded", + "type": "timestamp(3)", + "primaryKey": false, + "notNull": false, + "autoincrement": false + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": { + "payment_workspace_id_id_pk": { + "name": "payment_workspace_id_id_pk", + "columns": [ + "workspace_id", + "id" + ] + } + }, + "uniqueConstraints": {}, + "checkConstraint": {} + }, + "usage": { + "name": "usage", + "columns": { + "id": { + "name": "id", + "type": "varchar(30)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "workspace_id": { + "name": "workspace_id", + "type": "varchar(30)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "time_created": { + "name": "time_created", + "type": "timestamp(3)", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "(now())" + }, + "time_updated": { + "name": "time_updated", + "type": "timestamp(3)", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "CURRENT_TIMESTAMP(3) ON UPDATE CURRENT_TIMESTAMP(3)" + }, + "time_deleted": { + "name": "time_deleted", + "type": "timestamp(3)", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "model": { + "name": "model", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "provider": { + "name": "provider", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "input_tokens": { + "name": "input_tokens", + "type": "int", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "output_tokens": { + "name": "output_tokens", + "type": "int", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "reasoning_tokens": { + "name": "reasoning_tokens", + "type": "int", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "cache_read_tokens": { + "name": "cache_read_tokens", + "type": "int", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "cache_write_5m_tokens": { + "name": "cache_write_5m_tokens", + "type": "int", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "cache_write_1h_tokens": { + "name": "cache_write_1h_tokens", + "type": "int", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "cost": { + "name": "cost", + "type": "bigint", + "primaryKey": false, + "notNull": true, + "autoincrement": false + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": { + "usage_workspace_id_id_pk": { + "name": "usage_workspace_id_id_pk", + "columns": [ + "workspace_id", + "id" + ] + } + }, + "uniqueConstraints": {}, + "checkConstraint": {} + }, + "key": { + "name": "key", + "columns": { + "id": { + "name": "id", + "type": "varchar(30)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "workspace_id": { + "name": "workspace_id", + "type": "varchar(30)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "time_created": { + "name": "time_created", + "type": "timestamp(3)", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "(now())" + }, + "time_updated": { + "name": "time_updated", + "type": "timestamp(3)", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "CURRENT_TIMESTAMP(3) ON UPDATE CURRENT_TIMESTAMP(3)" + }, + "time_deleted": { + "name": "time_deleted", + "type": "timestamp(3)", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "actor": { + "name": "actor", + "type": "json", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "name": { + "name": "name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "old_name": { + "name": "old_name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "key": { + "name": "key", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "time_used": { + "name": "time_used", + "type": "timestamp(3)", + "primaryKey": false, + "notNull": false, + "autoincrement": false + } + }, + "indexes": { + "global_key": { + "name": "global_key", + "columns": [ + "key" + ], + "isUnique": true + }, + "name": { + "name": "name", + "columns": [ + "workspace_id", + "name" + ], + "isUnique": true + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": { + "key_workspace_id_id_pk": { + "name": "key_workspace_id_id_pk", + "columns": [ + "workspace_id", + "id" + ] + } + }, + "uniqueConstraints": {}, + "checkConstraint": {} + }, + "user": { + "name": "user", + "columns": { + "id": { + "name": "id", + "type": "varchar(30)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "workspace_id": { + "name": "workspace_id", + "type": "varchar(30)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "time_created": { + "name": "time_created", + "type": "timestamp(3)", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "(now())" + }, + "time_updated": { + "name": "time_updated", + "type": "timestamp(3)", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "CURRENT_TIMESTAMP(3) ON UPDATE CURRENT_TIMESTAMP(3)" + }, + "time_deleted": { + "name": "time_deleted", + "type": "timestamp(3)", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "email": { + "name": "email", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "name": { + "name": "name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "time_seen": { + "name": "time_seen", + "type": "timestamp(3)", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "color": { + "name": "color", + "type": "int", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "role": { + "name": "role", + "type": "enum('admin','member')", + "primaryKey": false, + "notNull": true, + "autoincrement": false + } + }, + "indexes": { + "user_email": { + "name": "user_email", + "columns": [ + "workspace_id", + "email" + ], + "isUnique": true + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": { + "user_workspace_id_id_pk": { + "name": "user_workspace_id_id_pk", + "columns": [ + "workspace_id", + "id" + ] + } + }, + "uniqueConstraints": {}, + "checkConstraint": {} + }, + "workspace": { + "name": "workspace", + "columns": { + "id": { + "name": "id", + "type": "varchar(30)", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "slug": { + "name": "slug", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "name": { + "name": "name", + "type": "varchar(255)", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "time_created": { + "name": "time_created", + "type": "timestamp(3)", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "(now())" + }, + "time_updated": { + "name": "time_updated", + "type": "timestamp(3)", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "CURRENT_TIMESTAMP(3) ON UPDATE CURRENT_TIMESTAMP(3)" + }, + "time_deleted": { + "name": "time_deleted", + "type": "timestamp(3)", + "primaryKey": false, + "notNull": false, + "autoincrement": false + } + }, + "indexes": { + "slug": { + "name": "slug", + "columns": [ + "slug" + ], + "isUnique": true + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": { + "workspace_id": { + "name": "workspace_id", + "columns": [ + "id" + ] + } + }, + "uniqueConstraints": {}, + "checkConstraint": {} + } + }, + "views": {}, + "_meta": { + "schemas": {}, + "tables": {}, + "columns": {} + }, + "internal": { + "tables": {}, + "indexes": {} + } +} \ No newline at end of file diff --git a/packages/console/core/migrations/meta/_journal.json b/packages/console/core/migrations/meta/_journal.json index d19c9a11a..5b45082fd 100644 --- a/packages/console/core/migrations/meta/_journal.json +++ b/packages/console/core/migrations/meta/_journal.json @@ -141,6 +141,13 @@ "when": 1759103696975, "tag": "0019_dazzling_cable", "breakpoints": true + }, + { + "idx": 20, + "version": "5", + "when": 1759169697658, + "tag": "0020_supreme_jack_power", + "breakpoints": true } ] } \ No newline at end of file diff --git a/packages/console/core/src/actor.ts b/packages/console/core/src/actor.ts index 9f2216f9c..f9db01293 100644 --- a/packages/console/core/src/actor.ts +++ b/packages/console/core/src/actor.ts @@ -21,7 +21,7 @@ export namespace Actor { properties: { userID: string workspaceID: string - role: UserRole + role: (typeof UserRole)[number] } } diff --git a/packages/console/core/src/schema/user.sql.ts b/packages/console/core/src/schema/user.sql.ts index 0c2bba947..34939474e 100644 --- a/packages/console/core/src/schema/user.sql.ts +++ b/packages/console/core/src/schema/user.sql.ts @@ -2,8 +2,7 @@ import { mysqlTable, uniqueIndex, varchar, int, mysqlEnum } from "drizzle-orm/my import { timestamps, utc, workspaceColumns } from "../drizzle/types" import { workspaceIndexes } from "./workspace.sql" -const UserRole = ["admin", "member"] as const -export type UserRole = (typeof UserRole)[number] +export const UserRole = ["admin", "member"] as const export const UserTable = mysqlTable( "user", @@ -13,9 +12,8 @@ export const UserTable = mysqlTable( email: varchar("email", { length: 255 }).notNull(), name: varchar("name", { length: 255 }).notNull(), timeSeen: utc("time_seen"), - timeJoined: utc("time_joined"), color: int("color"), - role: mysqlEnum("role", ["admin", "member"]).notNull(), + role: mysqlEnum("role", UserRole).notNull(), }, (table) => [...workspaceIndexes(table), uniqueIndex("user_email").on(table.workspaceID, table.email)], ) diff --git a/packages/console/core/src/workspace.ts b/packages/console/core/src/workspace.ts index 5067803ee..0ff3a1532 100644 --- a/packages/console/core/src/workspace.ts +++ b/packages/console/core/src/workspace.ts @@ -21,8 +21,8 @@ export namespace Workspace { id: Identifier.create("user"), email: account.properties.email, name: "", + timeSeen: sql`now()`, role: "admin", - timeJoined: sql`now()`, }) await tx.insert(BillingTable).values({ workspaceID, diff --git a/packages/console/core/sst-env.d.ts b/packages/console/core/sst-env.d.ts index bd5588217..9b9de7327 100644 --- a/packages/console/core/sst-env.d.ts +++ b/packages/console/core/sst-env.d.ts @@ -6,4 +6,4 @@ /// import "sst" -export {} +export {} \ No newline at end of file diff --git a/packages/console/function/sst-env.d.ts b/packages/console/function/sst-env.d.ts index c14ff4acc..0cd862dff 100644 --- a/packages/console/function/sst-env.d.ts +++ b/packages/console/function/sst-env.d.ts @@ -6,75 +6,83 @@ import "sst" declare module "sst" { export interface Resource { - AUTH_API_URL: { - type: "sst.sst.Linkable" - value: string + "AUTH_API_URL": { + "type": "sst.sst.Linkable" + "value": string } - Console: { - type: "sst.cloudflare.SolidStart" - url: string + "Console": { + "type": "sst.cloudflare.SolidStart" + "url": string } - Database: { - database: string - host: string - password: string - port: number - type: "sst.sst.Linkable" - username: string + "Database": { + "database": string + "host": string + "password": string + "port": number + "type": "sst.sst.Linkable" + "username": string } - GITHUB_APP_ID: { - type: "sst.sst.Secret" - value: string + "Desktop": { + "type": "sst.cloudflare.StaticSite" + "url": string } - GITHUB_APP_PRIVATE_KEY: { - type: "sst.sst.Secret" - value: string + "EMAILOCTOPUS_API_KEY": { + "type": "sst.sst.Secret" + "value": string } - GITHUB_CLIENT_ID_CONSOLE: { - type: "sst.sst.Secret" - value: string + "GITHUB_APP_ID": { + "type": "sst.sst.Secret" + "value": string } - GITHUB_CLIENT_SECRET_CONSOLE: { - type: "sst.sst.Secret" - value: string + "GITHUB_APP_PRIVATE_KEY": { + "type": "sst.sst.Secret" + "value": string } - GOOGLE_CLIENT_ID: { - type: "sst.sst.Secret" - value: string + "GITHUB_CLIENT_ID_CONSOLE": { + "type": "sst.sst.Secret" + "value": string } - HONEYCOMB_API_KEY: { - type: "sst.sst.Secret" - value: string + "GITHUB_CLIENT_SECRET_CONSOLE": { + "type": "sst.sst.Secret" + "value": string } - STRIPE_SECRET_KEY: { - type: "sst.sst.Secret" - value: string + "GOOGLE_CLIENT_ID": { + "type": "sst.sst.Secret" + "value": string } - STRIPE_WEBHOOK_SECRET: { - type: "sst.sst.Linkable" - value: string + "HONEYCOMB_API_KEY": { + "type": "sst.sst.Secret" + "value": string } - Web: { - type: "sst.cloudflare.Astro" - url: string + "STRIPE_SECRET_KEY": { + "type": "sst.sst.Secret" + "value": string } - ZEN_MODELS: { - type: "sst.sst.Secret" - value: string + "STRIPE_WEBHOOK_SECRET": { + "type": "sst.sst.Linkable" + "value": string + } + "Web": { + "type": "sst.cloudflare.Astro" + "url": string + } + "ZEN_MODELS": { + "type": "sst.sst.Secret" + "value": string } } } -// cloudflare -import * as cloudflare from "@cloudflare/workers-types" +// cloudflare +import * as cloudflare from "@cloudflare/workers-types"; declare module "sst" { export interface Resource { - Api: cloudflare.Service - AuthApi: cloudflare.Service - AuthStorage: cloudflare.KVNamespace - Bucket: cloudflare.R2Bucket - LogProcessor: cloudflare.Service + "Api": cloudflare.Service + "AuthApi": cloudflare.Service + "AuthStorage": cloudflare.KVNamespace + "Bucket": cloudflare.R2Bucket + "LogProcessor": cloudflare.Service } } import "sst" -export {} +export {} \ No newline at end of file diff --git a/packages/console/resource/sst-env.d.ts b/packages/console/resource/sst-env.d.ts index c14ff4acc..0cd862dff 100644 --- a/packages/console/resource/sst-env.d.ts +++ b/packages/console/resource/sst-env.d.ts @@ -6,75 +6,83 @@ import "sst" declare module "sst" { export interface Resource { - AUTH_API_URL: { - type: "sst.sst.Linkable" - value: string + "AUTH_API_URL": { + "type": "sst.sst.Linkable" + "value": string } - Console: { - type: "sst.cloudflare.SolidStart" - url: string + "Console": { + "type": "sst.cloudflare.SolidStart" + "url": string } - Database: { - database: string - host: string - password: string - port: number - type: "sst.sst.Linkable" - username: string + "Database": { + "database": string + "host": string + "password": string + "port": number + "type": "sst.sst.Linkable" + "username": string } - GITHUB_APP_ID: { - type: "sst.sst.Secret" - value: string + "Desktop": { + "type": "sst.cloudflare.StaticSite" + "url": string } - GITHUB_APP_PRIVATE_KEY: { - type: "sst.sst.Secret" - value: string + "EMAILOCTOPUS_API_KEY": { + "type": "sst.sst.Secret" + "value": string } - GITHUB_CLIENT_ID_CONSOLE: { - type: "sst.sst.Secret" - value: string + "GITHUB_APP_ID": { + "type": "sst.sst.Secret" + "value": string } - GITHUB_CLIENT_SECRET_CONSOLE: { - type: "sst.sst.Secret" - value: string + "GITHUB_APP_PRIVATE_KEY": { + "type": "sst.sst.Secret" + "value": string } - GOOGLE_CLIENT_ID: { - type: "sst.sst.Secret" - value: string + "GITHUB_CLIENT_ID_CONSOLE": { + "type": "sst.sst.Secret" + "value": string } - HONEYCOMB_API_KEY: { - type: "sst.sst.Secret" - value: string + "GITHUB_CLIENT_SECRET_CONSOLE": { + "type": "sst.sst.Secret" + "value": string } - STRIPE_SECRET_KEY: { - type: "sst.sst.Secret" - value: string + "GOOGLE_CLIENT_ID": { + "type": "sst.sst.Secret" + "value": string } - STRIPE_WEBHOOK_SECRET: { - type: "sst.sst.Linkable" - value: string + "HONEYCOMB_API_KEY": { + "type": "sst.sst.Secret" + "value": string } - Web: { - type: "sst.cloudflare.Astro" - url: string + "STRIPE_SECRET_KEY": { + "type": "sst.sst.Secret" + "value": string } - ZEN_MODELS: { - type: "sst.sst.Secret" - value: string + "STRIPE_WEBHOOK_SECRET": { + "type": "sst.sst.Linkable" + "value": string + } + "Web": { + "type": "sst.cloudflare.Astro" + "url": string + } + "ZEN_MODELS": { + "type": "sst.sst.Secret" + "value": string } } } -// cloudflare -import * as cloudflare from "@cloudflare/workers-types" +// cloudflare +import * as cloudflare from "@cloudflare/workers-types"; declare module "sst" { export interface Resource { - Api: cloudflare.Service - AuthApi: cloudflare.Service - AuthStorage: cloudflare.KVNamespace - Bucket: cloudflare.R2Bucket - LogProcessor: cloudflare.Service + "Api": cloudflare.Service + "AuthApi": cloudflare.Service + "AuthStorage": cloudflare.KVNamespace + "Bucket": cloudflare.R2Bucket + "LogProcessor": cloudflare.Service } } import "sst" -export {} +export {} \ No newline at end of file diff --git a/packages/console/scripts/sst-env.d.ts b/packages/console/scripts/sst-env.d.ts index bd5588217..9b9de7327 100644 --- a/packages/console/scripts/sst-env.d.ts +++ b/packages/console/scripts/sst-env.d.ts @@ -6,4 +6,4 @@ /// import "sst" -export {} +export {} \ No newline at end of file diff --git a/packages/function/sst-env.d.ts b/packages/function/sst-env.d.ts index c14ff4acc..0cd862dff 100644 --- a/packages/function/sst-env.d.ts +++ b/packages/function/sst-env.d.ts @@ -6,75 +6,83 @@ import "sst" declare module "sst" { export interface Resource { - AUTH_API_URL: { - type: "sst.sst.Linkable" - value: string + "AUTH_API_URL": { + "type": "sst.sst.Linkable" + "value": string } - Console: { - type: "sst.cloudflare.SolidStart" - url: string + "Console": { + "type": "sst.cloudflare.SolidStart" + "url": string } - Database: { - database: string - host: string - password: string - port: number - type: "sst.sst.Linkable" - username: string + "Database": { + "database": string + "host": string + "password": string + "port": number + "type": "sst.sst.Linkable" + "username": string } - GITHUB_APP_ID: { - type: "sst.sst.Secret" - value: string + "Desktop": { + "type": "sst.cloudflare.StaticSite" + "url": string } - GITHUB_APP_PRIVATE_KEY: { - type: "sst.sst.Secret" - value: string + "EMAILOCTOPUS_API_KEY": { + "type": "sst.sst.Secret" + "value": string } - GITHUB_CLIENT_ID_CONSOLE: { - type: "sst.sst.Secret" - value: string + "GITHUB_APP_ID": { + "type": "sst.sst.Secret" + "value": string } - GITHUB_CLIENT_SECRET_CONSOLE: { - type: "sst.sst.Secret" - value: string + "GITHUB_APP_PRIVATE_KEY": { + "type": "sst.sst.Secret" + "value": string } - GOOGLE_CLIENT_ID: { - type: "sst.sst.Secret" - value: string + "GITHUB_CLIENT_ID_CONSOLE": { + "type": "sst.sst.Secret" + "value": string } - HONEYCOMB_API_KEY: { - type: "sst.sst.Secret" - value: string + "GITHUB_CLIENT_SECRET_CONSOLE": { + "type": "sst.sst.Secret" + "value": string } - STRIPE_SECRET_KEY: { - type: "sst.sst.Secret" - value: string + "GOOGLE_CLIENT_ID": { + "type": "sst.sst.Secret" + "value": string } - STRIPE_WEBHOOK_SECRET: { - type: "sst.sst.Linkable" - value: string + "HONEYCOMB_API_KEY": { + "type": "sst.sst.Secret" + "value": string } - Web: { - type: "sst.cloudflare.Astro" - url: string + "STRIPE_SECRET_KEY": { + "type": "sst.sst.Secret" + "value": string } - ZEN_MODELS: { - type: "sst.sst.Secret" - value: string + "STRIPE_WEBHOOK_SECRET": { + "type": "sst.sst.Linkable" + "value": string + } + "Web": { + "type": "sst.cloudflare.Astro" + "url": string + } + "ZEN_MODELS": { + "type": "sst.sst.Secret" + "value": string } } } -// cloudflare -import * as cloudflare from "@cloudflare/workers-types" +// cloudflare +import * as cloudflare from "@cloudflare/workers-types"; declare module "sst" { export interface Resource { - Api: cloudflare.Service - AuthApi: cloudflare.Service - AuthStorage: cloudflare.KVNamespace - Bucket: cloudflare.R2Bucket - LogProcessor: cloudflare.Service + "Api": cloudflare.Service + "AuthApi": cloudflare.Service + "AuthStorage": cloudflare.KVNamespace + "Bucket": cloudflare.R2Bucket + "LogProcessor": cloudflare.Service } } import "sst" -export {} +export {} \ No newline at end of file diff --git a/packages/opencode/sst-env.d.ts b/packages/opencode/sst-env.d.ts index 0397645b5..b6a7e9066 100644 --- a/packages/opencode/sst-env.d.ts +++ b/packages/opencode/sst-env.d.ts @@ -6,4 +6,4 @@ /// import "sst" -export {} +export {} \ No newline at end of file diff --git a/packages/plugin/sst-env.d.ts b/packages/plugin/sst-env.d.ts index 0397645b5..b6a7e9066 100644 --- a/packages/plugin/sst-env.d.ts +++ b/packages/plugin/sst-env.d.ts @@ -6,4 +6,4 @@ /// import "sst" -export {} +export {} \ No newline at end of file diff --git a/packages/sdk/js/sst-env.d.ts b/packages/sdk/js/sst-env.d.ts index bd5588217..9b9de7327 100644 --- a/packages/sdk/js/sst-env.d.ts +++ b/packages/sdk/js/sst-env.d.ts @@ -6,4 +6,4 @@ /// import "sst" -export {} +export {} \ No newline at end of file diff --git a/packages/web/sst-env.d.ts b/packages/web/sst-env.d.ts index 0397645b5..b6a7e9066 100644 --- a/packages/web/sst-env.d.ts +++ b/packages/web/sst-env.d.ts @@ -6,4 +6,4 @@ /// import "sst" -export {} +export {} \ No newline at end of file diff --git a/sdks/vscode/sst-env.d.ts b/sdks/vscode/sst-env.d.ts index 0397645b5..b6a7e9066 100644 --- a/sdks/vscode/sst-env.d.ts +++ b/sdks/vscode/sst-env.d.ts @@ -6,4 +6,4 @@ /// import "sst" -export {} +export {} \ No newline at end of file diff --git a/sst-env.d.ts b/sst-env.d.ts index a8370105d..f6fdecb7b 100644 --- a/sst-env.d.ts +++ b/sst-env.d.ts @@ -5,83 +5,91 @@ declare module "sst" { export interface Resource { - AUTH_API_URL: { - type: "sst.sst.Linkable" - value: string + "AUTH_API_URL": { + "type": "sst.sst.Linkable" + "value": string } - Api: { - type: "sst.cloudflare.Worker" - url: string + "Api": { + "type": "sst.cloudflare.Worker" + "url": string } - AuthApi: { - type: "sst.cloudflare.Worker" - url: string + "AuthApi": { + "type": "sst.cloudflare.Worker" + "url": string } - AuthStorage: { - type: "sst.cloudflare.Kv" + "AuthStorage": { + "type": "sst.cloudflare.Kv" } - Bucket: { - name: string - type: "sst.cloudflare.Bucket" + "Bucket": { + "name": string + "type": "sst.cloudflare.Bucket" } - Console: { - type: "sst.cloudflare.SolidStart" - url: string + "Console": { + "type": "sst.cloudflare.SolidStart" + "url": string } - Database: { - database: string - host: string - password: string - port: number - type: "sst.sst.Linkable" - username: string + "Database": { + "database": string + "host": string + "password": string + "port": number + "type": "sst.sst.Linkable" + "username": string } - GITHUB_APP_ID: { - type: "sst.sst.Secret" - value: string + "Desktop": { + "type": "sst.cloudflare.StaticSite" + "url": string } - GITHUB_APP_PRIVATE_KEY: { - type: "sst.sst.Secret" - value: string + "EMAILOCTOPUS_API_KEY": { + "type": "sst.sst.Secret" + "value": string } - GITHUB_CLIENT_ID_CONSOLE: { - type: "sst.sst.Secret" - value: string + "GITHUB_APP_ID": { + "type": "sst.sst.Secret" + "value": string } - GITHUB_CLIENT_SECRET_CONSOLE: { - type: "sst.sst.Secret" - value: string + "GITHUB_APP_PRIVATE_KEY": { + "type": "sst.sst.Secret" + "value": string } - GOOGLE_CLIENT_ID: { - type: "sst.sst.Secret" - value: string + "GITHUB_CLIENT_ID_CONSOLE": { + "type": "sst.sst.Secret" + "value": string } - HONEYCOMB_API_KEY: { - type: "sst.sst.Secret" - value: string + "GITHUB_CLIENT_SECRET_CONSOLE": { + "type": "sst.sst.Secret" + "value": string } - LogProcessor: { - type: "sst.cloudflare.Worker" + "GOOGLE_CLIENT_ID": { + "type": "sst.sst.Secret" + "value": string } - STRIPE_SECRET_KEY: { - type: "sst.sst.Secret" - value: string + "HONEYCOMB_API_KEY": { + "type": "sst.sst.Secret" + "value": string } - STRIPE_WEBHOOK_SECRET: { - type: "sst.sst.Linkable" - value: string + "LogProcessor": { + "type": "sst.cloudflare.Worker" } - Web: { - type: "sst.cloudflare.Astro" - url: string + "STRIPE_SECRET_KEY": { + "type": "sst.sst.Secret" + "value": string } - ZEN_MODELS: { - type: "sst.sst.Secret" - value: string + "STRIPE_WEBHOOK_SECRET": { + "type": "sst.sst.Linkable" + "value": string + } + "Web": { + "type": "sst.cloudflare.Astro" + "url": string + } + "ZEN_MODELS": { + "type": "sst.sst.Secret" + "value": string } } } /// import "sst" -export {} +export {} \ No newline at end of file From bc9ff7e99f86d7b871a01cdc1dcab20a965f0b25 Mon Sep 17 00:00:00 2001 From: Aiden Cline <63023139+rekram1-node@users.noreply.github.com> Date: Mon, 29 Sep 2025 22:21:54 -0500 Subject: [PATCH 07/12] fix: worktree cmd (#2870) --- packages/opencode/src/project/project.ts | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/packages/opencode/src/project/project.ts b/packages/opencode/src/project/project.ts index 37a03cc2b..88134483e 100644 --- a/packages/opencode/src/project/project.ts +++ b/packages/opencode/src/project/project.ts @@ -62,14 +62,12 @@ export namespace Project { await Storage.write(["project", "global"], project) return project } - worktree = path.dirname( - await $`git rev-parse --path-format=absolute --git-common-dir` - .quiet() - .nothrow() - .cwd(worktree) - .text() - .then((x) => x.trim()), - ) + worktree = await $`git rev-parse --path-format=absolute --show-toplevel` + .quiet() + .nothrow() + .cwd(worktree) + .text() + .then((x) => x.trim()) const project: Info = { id, worktree, From c398485213611891adb2339288cc8a60fdf038bc Mon Sep 17 00:00:00 2001 From: Aiden Cline <63023139+rekram1-node@users.noreply.github.com> Date: Mon, 29 Sep 2025 23:55:47 -0500 Subject: [PATCH 08/12] fix: tui stuck saying generating... even when it is done (#2872) --- packages/tui/internal/components/chat/messages.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/tui/internal/components/chat/messages.go b/packages/tui/internal/components/chat/messages.go index 6352dbc74..a09e809f0 100644 --- a/packages/tui/internal/components/chat/messages.go +++ b/packages/tui/internal/components/chat/messages.go @@ -664,7 +664,7 @@ func (m *messagesComponent) renderView() tea.Cmd { error = err.Data.Message } - if !hasContent && error == "" && !reverted { + if !hasContent && error == "" && !reverted && casted.Time.Completed == 0 { content = renderText( m.app, message.Info, From 5a507023a6f3d9f166f4696bbb6424297f6afdaf Mon Sep 17 00:00:00 2001 From: Dax Raad Date: Tue, 30 Sep 2025 04:41:07 -0400 Subject: [PATCH 09/12] update anthropic system prompts --- .../src/session/prompt/anthropic-20250930.txt | 166 ++++++++++++++++++ .../opencode/src/session/prompt/anthropic.txt | 5 +- 2 files changed, 170 insertions(+), 1 deletion(-) create mode 100644 packages/opencode/src/session/prompt/anthropic-20250930.txt diff --git a/packages/opencode/src/session/prompt/anthropic-20250930.txt b/packages/opencode/src/session/prompt/anthropic-20250930.txt new file mode 100644 index 000000000..7a4faea63 --- /dev/null +++ b/packages/opencode/src/session/prompt/anthropic-20250930.txt @@ -0,0 +1,166 @@ +You are an interactive CLI tool that helps users with software engineering tasks. Use the instructions below and the tools available to you to assist the user. + +IMPORTANT: Assist with defensive security tasks only. Refuse to create, modify, or improve code that may be used maliciously. Do not assist with credential discovery or harvesting, including bulk crawling for SSH keys, browser cookies, or cryptocurrency wallets. Allow security analysis, detection rules, vulnerability explanations, defensive tools, and security documentation. +IMPORTANT: You must NEVER generate or guess URLs for the user unless you are confident that the URLs are for helping the user with programming. You may use URLs provided by the user in their messages or local files. + +If the user asks for help or wants to give feedback inform them of the following: +- /help: Get help with using Claude Code +- To give feedback, users should report the issue at https://github.com/anthropics/claude-code/issues + +When the user directly asks about Claude Code (eg. "can Claude Code do...", "does Claude Code have..."), or asks in second person (eg. "are you able...", "can you do..."), or asks how to use a specific Claude Code feature (eg. implement a hook, or write a slash command), use the WebFetch tool to gather information to answer the question from Claude Code docs. The list of available docs is available at https://docs.claude.com/en/docs/claude-code/claude_code_docs_map.md. + +# Tone and style +You should be concise, direct, and to the point, while providing complete information and matching the level of detail you provide in your response with the level of complexity of the user's query or the work you have completed. +A concise response is generally less than 4 lines, not including tool calls or code generated. You should provide more detail when the task is complex or when the user asks you to. +IMPORTANT: You should minimize output tokens as much as possible while maintaining helpfulness, quality, and accuracy. Only address the specific task at hand, avoiding tangential information unless absolutely critical for completing the request. If you can answer in 1-3 sentences or a short paragraph, please do. +IMPORTANT: You should NOT answer with unnecessary preamble or postamble (such as explaining your code or summarizing your action), unless the user asks you to. +Do not add additional code explanation summary unless requested by the user. After working on a file, briefly confirm that you have completed the task, rather than providing an explanation of what you did. +Answer the user's question directly, avoiding any elaboration, explanation, introduction, conclusion, or excessive details. Brief answers are best, but be sure to provide complete information. You MUST avoid extra preamble before/after your response, such as "The answer is .", "Here is the content of the file..." or "Based on the information provided, the answer is..." or "Here is what I will do next...". + +Here are some examples to demonstrate appropriate verbosity: + +user: 2 + 2 +assistant: 4 + + + +user: what is 2+2? +assistant: 4 + + + +user: is 11 a prime number? +assistant: Yes + + + +user: what command should I run to list files in the current directory? +assistant: ls + + + +user: what command should I run to watch files in the current directory? +assistant: [runs ls to list the files in the current directory, then read docs/commands in the relevant file to find out how to watch files] +npm run dev + + + +user: How many golf balls fit inside a jetta? +assistant: 150000 + + + +user: what files are in the directory src/? +assistant: [runs ls and sees foo.c, bar.c, baz.c] +user: which file contains the implementation of foo? +assistant: src/foo.c + +When you run a non-trivial bash command, you should explain what the command does and why you are running it, to make sure the user understands what you are doing (this is especially important when you are running a command that will make changes to the user's system). +Remember that your output will be displayed on a command line interface. Your responses can use Github-flavored markdown for formatting, and will be rendered in a monospace font using the CommonMark specification. +Output text to communicate with the user; all text you output outside of tool use is displayed to the user. Only use tools to complete tasks. Never use tools like Bash or code comments as means to communicate with the user during the session. +If you cannot or will not help the user with something, please do not say why or what it could lead to, since this comes across as preachy and annoying. Please offer helpful alternatives if possible, and otherwise keep your response to 1-2 sentences. +Only use emojis if the user explicitly requests it. Avoid using emojis in all communication unless asked. +IMPORTANT: Keep your responses short, since they will be displayed on a command line interface. + +# Proactiveness +You are allowed to be proactive, but only when the user asks you to do something. You should strive to strike a balance between: +- Doing the right thing when asked, including taking actions and follow-up actions +- Not surprising the user with actions you take without asking +For example, if the user asks you how to approach something, you should do your best to answer their question first, and not immediately jump into taking actions. + +# Professional objectivity +Prioritize technical accuracy and truthfulness over validating the user's beliefs. Focus on facts and problem-solving, providing direct, objective technical info without any unnecessary superlatives, praise, or emotional validation. It is best for the user if Claude honestly applies the same rigorous standards to all ideas and disagrees when necessary, even if it may not be what the user wants to hear. Objective guidance and respectful correction are more valuable than false agreement. Whenever there is uncertainty, it's best to investigate to find the truth first rather than instinctively confirming the user's beliefs. + +# Task Management +You have access to the TodoWrite tools to help you manage and plan tasks. Use these tools VERY frequently to ensure that you are tracking your tasks and giving the user visibility into your progress. +These tools are also EXTREMELY helpful for planning tasks, and for breaking down larger complex tasks into smaller steps. If you do not use this tool when planning, you may forget to do important tasks - and that is unacceptable. + +It is critical that you mark todos as completed as soon as you are done with a task. Do not batch up multiple tasks before marking them as completed. + +Examples: + + +user: Run the build and fix any type errors +assistant: I'm going to use the TodoWrite tool to write the following items to the todo list: +- Run the build +- Fix any type errors + +I'm now going to run the build using Bash. + +Looks like I found 10 type errors. I'm going to use the TodoWrite tool to write 10 items to the todo list. + +marking the first todo as in_progress + +Let me start working on the first item... + +The first item has been fixed, let me mark the first todo as completed, and move on to the second item... +.. +.. + +In the above example, the assistant completes all the tasks, including the 10 error fixes and running the build and fixing all errors. + + +user: Help me write a new feature that allows users to track their usage metrics and export them to various formats + +assistant: I'll help you implement a usage metrics tracking and export feature. Let me first use the TodoWrite tool to plan this task. +Adding the following todos to the todo list: +1. Research existing metrics tracking in the codebase +2. Design the metrics collection system +3. Implement core metrics tracking functionality +4. Create export functionality for different formats + +Let me start by researching the existing codebase to understand what metrics we might already be tracking and how we can build on that. + +I'm going to search for any existing metrics or telemetry code in the project. + +I've found some existing telemetry code. Let me mark the first todo as in_progress and start designing our metrics tracking system based on what I've learned... + +[Assistant continues implementing the feature step by step, marking todos as in_progress and completed as they go] + + + +Users may configure 'hooks', shell commands that execute in response to events like tool calls, in settings. Treat feedback from hooks, including , as coming from the user. If you get blocked by a hook, determine if you can adjust your actions in response to the blocked message. If not, ask the user to check their hooks configuration. + +# Doing tasks +The user will primarily request you perform software engineering tasks. This includes solving bugs, adding new functionality, refactoring code, explaining code, and more. For these tasks the following steps are recommended: +- Use the TodoWrite tool to plan the task if required + +- Tool results and user messages may include tags. tags contain useful information and reminders. They are automatically added by the system, and bear no direct relation to the specific tool results or user messages in which they appear. + + +# Tool usage policy +- When doing file search, prefer to use the Task tool in order to reduce context usage. +- You should proactively use the Task tool with specialized agents when the task at hand matches the agent's description. + +- When WebFetch returns a message about a redirect to a different host, you should immediately make a new WebFetch request with the redirect URL provided in the response. +- You have the capability to call multiple tools in a single response. When multiple independent pieces of information are requested, batch your tool calls together for optimal performance. When making multiple bash tool calls, you MUST send a single message with multiple tools calls to run the calls in parallel. For example, if you need to run "git status" and "git diff", send a single message with two tool calls to run the calls in parallel. +- If the user specifies that they want you to run tools "in parallel", you MUST send a single message with multiple tool use content blocks. For example, if you need to launch multiple agents in parallel, send a single message with multiple Task tool calls. +- Use specialized tools instead of bash commands when possible, as this provides a better user experience. For file operations, use dedicated tools: Read for reading files instead of cat/head/tail, Edit for editing instead of sed/awk, and Write for creating files instead of cat with heredoc or echo redirection. Reserve bash tools exclusively for actual system commands and terminal operations that require shell execution. NEVER use bash echo or other command-line tools to communicate thoughts, explanations, or instructions to the user. Output all communication directly in your response text instead. + + +Here is useful information about the environment you are running in: + +Working directory: /home/thdxr/dev/projects/sst/opencode/packages/opencode +Is directory a git repo: Yes +Platform: linux +OS Version: Linux 6.12.4-arch1-1 +Today's date: 2025-09-30 + +You are powered by the model named Sonnet 4.5. The exact model ID is claude-sonnet-4-5-20250929. + +Assistant knowledge cutoff is January 2025. + + +IMPORTANT: Assist with defensive security tasks only. Refuse to create, modify, or improve code that may be used maliciously. Do not assist with credential discovery or harvesting, including bulk crawling for SSH keys, browser cookies, or cryptocurrency wallets. Allow security analysis, detection rules, vulnerability explanations, defensive tools, and security documentation. + + +IMPORTANT: Always use the TodoWrite tool to plan and track tasks throughout the conversation. + +# Code References + +When referencing specific functions or pieces of code include the pattern `file_path:line_number` to allow the user to easily navigate to the source code location. + + +user: Where are errors from the client handled? +assistant: Clients are marked as failed in the `connectToServer` function in src/services/process.ts:712. + diff --git a/packages/opencode/src/session/prompt/anthropic.txt b/packages/opencode/src/session/prompt/anthropic.txt index a2e5c07b6..6e623fdad 100644 --- a/packages/opencode/src/session/prompt/anthropic.txt +++ b/packages/opencode/src/session/prompt/anthropic.txt @@ -8,7 +8,7 @@ If the user asks for help or wants to give feedback inform them of the following # Tone and style You should be concise, direct, and to the point. -You MUST answer concisely with fewer than 4 lines (not including tool use or code generation), unless user asks for detail. +You should be concise, direct, and to the point, while providing complete information and matching the level of detail you provide in your response with the level of complexity of the user's query or the work you have completed. IMPORTANT: You should minimize output tokens as much as possible while maintaining helpfulness, quality, and accuracy. Only address the specific query or task at hand, avoiding tangential information unless absolutely critical for completing the request. If you can answer in 1-3 sentences or a short paragraph, please do. IMPORTANT: You should NOT answer with unnecessary preamble or postamble (such as explaining your code or summarizing your action), unless the user asks you to. Do not add additional code explanation summary unless requested by the user. After working on a file, just stop, rather than providing an explanation of what you did. @@ -63,6 +63,9 @@ You are allowed to be proactive, but only when the user asks you to do something - Not surprising the user with actions you take without asking For example, if the user asks you how to approach something, you should do your best to answer their question first, and not immediately jump into taking actions. +# Professional objectivity +Prioritize technical accuracy and truthfulness over validating the user's beliefs. Focus on facts and problem-solving, providing direct, objective technical info without any unnecessary superlatives, praise, or emotional validation. It is best for the user if Claude honestly applies the same rigorous standards to all ideas and disagrees when necessary, even if it may not be what the user wants to hear. Objective guidance and respectful correction are more valuable than false agreement. Whenever there is uncertainty, it's best to investigate to find the truth first rather than instinctively confirming the user's beliefs. + # Following conventions When making changes to files, first understand the file's code conventions. Mimic code style, use existing libraries and utilities, and follow existing patterns. - NEVER assume that a given library is available, even if it is well known. Whenever you write code that uses a library or framework, first check that this codebase already uses the given library. For example, you might look at neighboring files, or check the package.json (or cargo.toml, and so on depending on the language). From bdac22cb07209df5d0e95d042d67d652a5afa185 Mon Sep 17 00:00:00 2001 From: GitHub Action Date: Tue, 30 Sep 2025 12:04:27 +0000 Subject: [PATCH 10/12] ignore: update download stats 2025-09-30 --- STATS.md | 1 + 1 file changed, 1 insertion(+) diff --git a/STATS.md b/STATS.md index 1f946e052..15f6f99ab 100644 --- a/STATS.md +++ b/STATS.md @@ -94,3 +94,4 @@ | 2025-09-27 | 411,618 (+7,284) | 317,763 (+11,050) | 729,381 (+18,334) | | 2025-09-28 | 414,910 (+3,292) | 322,522 (+4,759) | 737,432 (+8,051) | | 2025-09-29 | 419,919 (+5,009) | 328,033 (+5,511) | 747,952 (+10,520) | +| 2025-09-30 | 427,991 (+8,072) | 336,472 (+8,439) | 764,463 (+16,511) | From fe45a76c55ea18a6ce9889ffb2ef3c0f1d8422d0 Mon Sep 17 00:00:00 2001 From: Aiden Cline <63023139+rekram1-node@users.noreply.github.com> Date: Tue, 30 Sep 2025 11:43:57 -0500 Subject: [PATCH 11/12] fix: adjust model dialog to handle same model id but different names (#2881) --- packages/tui/internal/components/dialog/models.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/tui/internal/components/dialog/models.go b/packages/tui/internal/components/dialog/models.go index 110151147..e30a1068e 100644 --- a/packages/tui/internal/components/dialog/models.go +++ b/packages/tui/internal/components/dialog/models.go @@ -303,7 +303,8 @@ func (m *modelDialog) buildSearchResults(query string) []list.Item { 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) + // Include name to handle custom models with same ID but different names + key := fmt.Sprintf("%s:%s:%s", model.Provider.ID, model.Model.ID, model.Model.Name) if seenModels[key] { continue } From 6e19200fca3accc8b9a9d30a3850bd427fa1f2f9 Mon Sep 17 00:00:00 2001 From: Dax Raad Date: Wed, 1 Oct 2025 03:37:01 -0400 Subject: [PATCH 12/12] overhaul file search and support @ mentioning directories --- bun.lock | 1 + packages/opencode/package.json | 1 + packages/opencode/src/cli/cmd/debug/file.ts | 23 ++++++++- .../opencode/src/cli/cmd/debug/ripgrep.ts | 10 ++-- packages/opencode/src/file/index.ts | 47 +++++++++++++++++++ packages/opencode/src/file/ripgrep.ts | 46 +++++++++++++----- packages/opencode/src/server/server.ts | 5 +- packages/opencode/src/session/prompt.ts | 18 ++++--- packages/opencode/src/tool/glob.ts | 2 +- packages/opencode/src/tool/ls.ts | 6 ++- 10 files changed, 132 insertions(+), 27 deletions(-) diff --git a/bun.lock b/bun.lock index d1b83367a..8e803cfff 100644 --- a/bun.lock +++ b/bun.lock @@ -148,6 +148,7 @@ "chokidar": "4.0.3", "decimal.js": "10.5.0", "diff": "8.0.2", + "fuzzysort": "3.1.0", "gray-matter": "4.0.3", "hono": "catalog:", "hono-openapi": "1.0.7", diff --git a/packages/opencode/package.json b/packages/opencode/package.json index d88615487..6dba841a8 100644 --- a/packages/opencode/package.json +++ b/packages/opencode/package.json @@ -42,6 +42,7 @@ "chokidar": "4.0.3", "decimal.js": "10.5.0", "diff": "8.0.2", + "fuzzysort": "3.1.0", "gray-matter": "4.0.3", "hono": "catalog:", "hono-openapi": "1.0.7", diff --git a/packages/opencode/src/cli/cmd/debug/file.ts b/packages/opencode/src/cli/cmd/debug/file.ts index 898b7d390..7be304737 100644 --- a/packages/opencode/src/cli/cmd/debug/file.ts +++ b/packages/opencode/src/cli/cmd/debug/file.ts @@ -2,6 +2,22 @@ import { File } from "../../../file" import { bootstrap } from "../../bootstrap" import { cmd } from "../cmd" +const FileSearchCommand = cmd({ + command: "search ", + builder: (yargs) => + yargs.positional("query", { + type: "string", + demandOption: true, + description: "Search query", + }), + async handler(args) { + await bootstrap(process.cwd(), async () => { + const results = await File.search({ query: args.query }) + console.log(results.join("\n")) + }) + }, +}) + const FileReadCommand = cmd({ command: "read ", builder: (yargs) => @@ -48,6 +64,11 @@ const FileListCommand = cmd({ export const FileCommand = cmd({ command: "file", builder: (yargs) => - yargs.command(FileReadCommand).command(FileStatusCommand).command(FileListCommand).demandCommand(), + yargs + .command(FileReadCommand) + .command(FileStatusCommand) + .command(FileListCommand) + .command(FileSearchCommand) + .demandCommand(), async handler() {}, }) diff --git a/packages/opencode/src/cli/cmd/debug/ripgrep.ts b/packages/opencode/src/cli/cmd/debug/ripgrep.ts index ec3f9cb83..884b291b5 100644 --- a/packages/opencode/src/cli/cmd/debug/ripgrep.ts +++ b/packages/opencode/src/cli/cmd/debug/ripgrep.ts @@ -40,12 +40,14 @@ const FilesCommand = cmd({ }), async handler(args) { await bootstrap(process.cwd(), async () => { - const files = await Ripgrep.files({ + const files: string[] = [] + for await (const file of Ripgrep.files({ cwd: Instance.directory, - query: args.query, glob: args.glob ? [args.glob] : undefined, - limit: args.limit, - }) + })) { + files.push(file) + if (args.limit && files.length >= args.limit) break + } console.log(files.join("\n")) }) }, diff --git a/packages/opencode/src/file/index.ts b/packages/opencode/src/file/index.ts index 8e142cf2b..20e1f604c 100644 --- a/packages/opencode/src/file/index.ts +++ b/packages/opencode/src/file/index.ts @@ -7,6 +7,8 @@ import fs from "fs" import ignore from "ignore" import { Log } from "../util/log" import { Instance } from "../project/instance" +import { Ripgrep } from "./ripgrep" +import fuzzysort from "fuzzysort" export namespace File { const log = Log.create({ service: "file" }) @@ -74,6 +76,43 @@ export namespace File { ), } + const state = Instance.state(async () => { + type Entry = { files: string[]; dirs: string[] } + let cache: Entry = { files: [], dirs: [] } + let fetching = false + const fn = async (result: Entry) => { + fetching = true + const set = new Set() + for await (const file of Ripgrep.files({ cwd: Instance.directory })) { + result.files.push(file) + let current = file + while (true) { + const dir = path.dirname(current) + if (dir === current) break + current = dir + if (set.has(dir)) continue + set.add(dir) + result.dirs.push(dir + "/") + } + } + cache = result + fetching = false + } + fn(cache) + + return { + async files() { + if (!fetching) { + fn({ + files: [], + dirs: [], + }) + } + return cache + }, + } + }) + export async function status() { const project = Instance.project if (project.vcs !== "git") return [] @@ -201,4 +240,12 @@ export namespace File { return a.name.localeCompare(b.name) }) } + + export async function search(input: { query: string; limit?: number }) { + const limit = input.limit ?? 100 + const result = await state().then((x) => x.files()) + const items = input.query ? [...result.files, ...result.dirs] : [...result.dirs] + const sorted = fuzzysort.go(input.query, items, { limit: limit }).map((r) => r.target) + return sorted + } } diff --git a/packages/opencode/src/file/ripgrep.ts b/packages/opencode/src/file/ripgrep.ts index 1cbf6b8a8..d023f47c3 100644 --- a/packages/opencode/src/file/ripgrep.ts +++ b/packages/opencode/src/file/ripgrep.ts @@ -6,7 +6,7 @@ import z from "zod/v4" import { NamedError } from "../util/error" import { lazy } from "../util/lazy" import { $ } from "bun" -import { Fzf } from "./fzf" + import { ZipReader, BlobReader, BlobWriter } from "@zip.js/zip.js" export namespace Ripgrep { @@ -203,24 +203,48 @@ export namespace Ripgrep { return filepath } - export async function files(input: { cwd: string; query?: string; glob?: string[]; limit?: number }) { - const commands = [`${$.escape(await filepath())} --files --follow --hidden --glob='!.git/*'`] - + export async function* files(input: { cwd: string; glob?: string[] }) { + const args = [await filepath(), "--files", "--follow", "--hidden", "--glob=!.git/*"] if (input.glob) { for (const g of input.glob) { - commands[0] += ` --glob='${g}'` + args.push(`--glob=${g}`) } } - if (input.query) commands.push(`${await Fzf.filepath()} --filter=${input.query}`) - if (input.limit) commands.push(`head -n ${input.limit}`) - const joined = commands.join(" | ") - const result = await $`${{ raw: joined }}`.cwd(input.cwd).nothrow().text() - return result.split("\n").filter(Boolean) + const proc = Bun.spawn(args, { + cwd: input.cwd, + stdout: "pipe", + stderr: "ignore", + maxBuffer: 1024 * 1024 * 20, + }) + + const reader = proc.stdout.getReader() + const decoder = new TextDecoder() + let buffer = "" + + try { + while (true) { + const { done, value } = await reader.read() + if (done) break + + buffer += decoder.decode(value, { stream: true }) + const lines = buffer.split("\n") + buffer = lines.pop() || "" + + for (const line of lines) { + if (line) yield line + } + } + + if (buffer) yield buffer + } finally { + reader.releaseLock() + await proc.exited + } } export async function tree(input: { cwd: string; limit?: number }) { - const files = await Ripgrep.files({ cwd: input.cwd }) + const files = await Array.fromAsync(Ripgrep.files({ cwd: input.cwd })) interface Node { path: string[] children: Node[] diff --git a/packages/opencode/src/server/server.ts b/packages/opencode/src/server/server.ts index 544e58b38..7020a2aaa 100644 --- a/packages/opencode/src/server/server.ts +++ b/packages/opencode/src/server/server.ts @@ -956,12 +956,11 @@ export namespace Server { ), async (c) => { const query = c.req.valid("query").query - const result = await Ripgrep.files({ - cwd: Instance.directory, + const results = await File.search({ query, limit: 10, }) - return c.json(result) + return c.json(results) }, ) .get( diff --git a/packages/opencode/src/session/prompt.ts b/packages/opencode/src/session/prompt.ts index 6ebae336b..8e7cf57f0 100644 --- a/packages/opencode/src/session/prompt.ts +++ b/packages/opencode/src/session/prompt.ts @@ -581,9 +581,15 @@ export namespace SessionPrompt { } break case "file:": + log.info("file", { mime: part.mime }) // have to normalize, symbol search returns absolute paths // Decode the pathname since URL constructor doesn't automatically decode it - const filePath = decodeURIComponent(url.pathname) + const filepath = decodeURIComponent(url.pathname) + const stat = await Bun.file(filepath).stat() + + if (stat.isDirectory()) { + part.mime = "application/x-directory" + } if (part.mime === "text/plain") { let offset: number | undefined = undefined @@ -620,7 +626,7 @@ export namespace SessionPrompt { limit = end - offset } } - const args = { filePath, offset, limit } + const args = { filePath: filepath, offset, limit } const result = await ReadTool.init().then((t) => t.execute(args, { sessionID: input.sessionID, @@ -658,7 +664,7 @@ export namespace SessionPrompt { } if (part.mime === "application/x-directory") { - const args = { path: filePath } + const args = { path: filepath } const result = await ListTool.init().then((t) => t.execute(args, { sessionID: input.sessionID, @@ -695,15 +701,15 @@ export namespace SessionPrompt { ] } - const file = Bun.file(filePath) - FileTime.read(input.sessionID, filePath) + const file = Bun.file(filepath) + FileTime.read(input.sessionID, filepath) return [ { id: Identifier.ascending("part"), messageID: info.id, sessionID: input.sessionID, type: "text", - text: `Called the Read tool with the following input: {\"filePath\":\"${filePath}\"}`, + text: `Called the Read tool with the following input: {\"filePath\":\"${filepath}\"}`, synthetic: true, }, { diff --git a/packages/opencode/src/tool/glob.ts b/packages/opencode/src/tool/glob.ts index dbbe88680..7553a5aa5 100644 --- a/packages/opencode/src/tool/glob.ts +++ b/packages/opencode/src/tool/glob.ts @@ -23,7 +23,7 @@ export const GlobTool = Tool.define("glob", { const limit = 100 const files = [] let truncated = false - for (const file of await Ripgrep.files({ + for await (const file of Ripgrep.files({ cwd: search, glob: [params.pattern], })) { diff --git a/packages/opencode/src/tool/ls.ts b/packages/opencode/src/tool/ls.ts index 819e6fdea..b80f668a5 100644 --- a/packages/opencode/src/tool/ls.ts +++ b/packages/opencode/src/tool/ls.ts @@ -44,7 +44,11 @@ export const ListTool = Tool.define("list", { const searchPath = path.resolve(Instance.directory, params.path || ".") const ignoreGlobs = IGNORE_PATTERNS.map((p) => `!${p}*`).concat(params.ignore?.map((p) => `!${p}`) || []) - const files = await Ripgrep.files({ cwd: searchPath, glob: ignoreGlobs, limit: LIMIT }) + const files = [] + for await (const file of Ripgrep.files({ cwd: searchPath, glob: ignoreGlobs })) { + files.push(file) + if (files.length >= LIMIT) break + } // Build directory structure const dirs = new Set()