Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/docs-locale-sync.yml
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ jobs:
}
}
run: |
opencode run --agent docs --model opencode/gpt-5.3-codex <<'EOF'
opencode run --agent docs --model openai/gpt-5.6-terra --variant medium <<'EOF'
Update localized docs to match the latest English docs changes.

Changed English doc files:
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/docs-update.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,8 @@ jobs:
env:
OPENCODE_API_KEY: ${{ secrets.OPENCODE_API_KEY }}
with:
model: opencode/gpt-5.2
model: openai/gpt-5.6-terra
variant: medium
agent: docs
prompt: |
Review the following commits from the last ${{ env.LOOKBACK_HOURS }} hours and identify any new features that may need documentation.
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/opencode.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,3 +32,4 @@ jobs:
OPENCODE_PERMISSION: '{"bash": "deny"}'
with:
model: opencode/claude-opus-4-5
variant: high
3 changes: 2 additions & 1 deletion .opencode/agent/translator.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
---
description: Translate content for a specified locale while preserving technical terms
mode: subagent
model: opencode/gpt-5.4
model: openai/gpt-5.6-luna
variant: low
---

You are a professional translator and localization specialist.
Expand Down
3 changes: 2 additions & 1 deletion .opencode/command/changelog.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
---
model: opencode/gpt-5.4
model: openai/gpt-5.6-terra
variant: medium
---

Create `UPCOMING_CHANGELOG.md` from the structured changelog input below.
Expand Down
2 changes: 2 additions & 0 deletions packages/opencode/src/command/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ export namespace Command {
description: z.string().optional(),
agent: z.string().optional(),
model: z.string().optional(),
variant: z.string().optional(),
source: z.enum(["command", "mcp", "skill"]).optional(),
// workaround for zod not supporting async functions natively so we use getters
// https://zod.dev/v4/changelog?id=zfunction
Expand Down Expand Up @@ -108,6 +109,7 @@ export namespace Command {
name,
agent: command.agent,
model: command.model,
variant: command.variant,
description: command.description,
source: "command",
get template() {
Expand Down
1 change: 1 addition & 0 deletions packages/opencode/src/config/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -504,6 +504,7 @@ export namespace Config {
description: z.string().optional(),
agent: z.string().optional(),
model: ModelId.optional(),
variant: z.string().optional(),
subtask: z.boolean().optional(),
})
export type Command = z.infer<typeof Command>
Expand Down
2 changes: 1 addition & 1 deletion packages/opencode/src/session/prompt.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1686,7 +1686,7 @@ NOTE: At any point in time through this workflow you should feel free to ask the
model: userModel,
agent: userAgent,
parts,
variant: input.variant,
variant: input.variant ?? cmd.variant,
})
yield* bus.publish(Command.Event.Executed, {
name: input.command,
Expand Down
2 changes: 2 additions & 0 deletions packages/opencode/test/config/config.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -457,6 +457,7 @@ test("handles command configuration", async () => {
template: "test template",
description: "test command",
agent: "test_agent",
variant: "medium",
},
},
})
Expand All @@ -470,6 +471,7 @@ test("handles command configuration", async () => {
template: "test template",
description: "test command",
agent: "test_agent",
variant: "medium",
})
},
})
Expand Down
26 changes: 26 additions & 0 deletions packages/opencode/test/config/routing.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import { expect, test } from "bun:test"
import path from "path"
import { ConfigMarkdown } from "../../src/config/markdown"

const root = path.resolve(import.meta.dir, "../../../..")
const routes = [
[".opencode/agent/translator.md", "openai/gpt-5.6-luna", "low"],
[".opencode/command/changelog.md", "openai/gpt-5.6-terra", "medium"],
] as const

for (const [file, model, variant] of routes) {
test(`${file} pairs its model with reasoning`, async () => {
const data = (await ConfigMarkdown.parse(path.join(root, file))).data
expect(data.model).toBe(model)
expect(data.variant).toBe(variant)
})
}

test("the beta release gate does not request commands from a shell-denied route", async () => {
const source = await Bun.file(path.join(root, "script/beta.ts")).text()
const gate = source.slice(source.indexOf("async function gate"), source.indexOf("async function smoke"))

expect(gate).toContain("do not run shell commands")
expect(gate).toContain("immediately before this gate")
expect(gate).not.toContain('"Inspect the final diff and run `bun typecheck`')
})
150 changes: 76 additions & 74 deletions packages/sdk/js/src/v2/gen/types.gen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,74 @@ export type ClientOptions = {
baseUrl: `${string}://${string}` | (string & {})
}

export type EventServerConnected = {
type: "server.connected"
properties: {
[key: string]: unknown
}
}

export type EventGlobalDisposed = {
type: "global.disposed"
properties: {
[key: string]: unknown
}
}

export type EventTuiPromptAppend = {
type: "tui.prompt.append"
properties: {
text: string
}
}

export type EventTuiCommandExecute = {
type: "tui.command.execute"
properties: {
command:
| "session.list"
| "session.new"
| "session.share"
| "session.interrupt"
| "session.compact"
| "session.page.up"
| "session.page.down"
| "session.line.up"
| "session.line.down"
| "session.half.page.up"
| "session.half.page.down"
| "session.first"
| "session.last"
| "prompt.clear"
| "prompt.submit"
| "agent.cycle"
| string
}
}

export type EventTuiToastShow = {
type: "tui.toast.show"
properties: {
title?: string
message: string
variant: "info" | "success" | "warning" | "error"
/**
* Duration in milliseconds
*/
duration?: number
}
}

export type EventTuiSessionSelect = {
type: "tui.session.select"
properties: {
/**
* Session ID to navigate to
*/
sessionID: string
}
}

export type Project = {
id: string
worktree: string
Expand Down Expand Up @@ -54,20 +122,6 @@ export type EventServerInstanceDisposed = {
}
}

export type EventServerConnected = {
type: "server.connected"
properties: {
[key: string]: unknown
}
}

export type EventGlobalDisposed = {
type: "global.disposed"
properties: {
[key: string]: unknown
}
}

export type EventLspClientDiagnostics = {
type: "lsp.client.diagnostics"
properties: {
Expand Down Expand Up @@ -268,60 +322,6 @@ export type EventTodoUpdated = {
}
}

export type EventTuiPromptAppend = {
type: "tui.prompt.append"
properties: {
text: string
}
}

export type EventTuiCommandExecute = {
type: "tui.command.execute"
properties: {
command:
| "session.list"
| "session.new"
| "session.share"
| "session.interrupt"
| "session.compact"
| "session.page.up"
| "session.page.down"
| "session.line.up"
| "session.line.down"
| "session.half.page.up"
| "session.half.page.down"
| "session.first"
| "session.last"
| "prompt.clear"
| "prompt.submit"
| "agent.cycle"
| string
}
}

export type EventTuiToastShow = {
type: "tui.toast.show"
properties: {
title?: string
message: string
variant: "info" | "success" | "warning" | "error"
/**
* Duration in milliseconds
*/
duration?: number
}
}

export type EventTuiSessionSelect = {
type: "tui.session.select"
properties: {
/**
* Session ID to navigate to
*/
sessionID: string
}
}

export type EventMcpToolsChanged = {
type: "mcp.tools.changed"
properties: {
Expand Down Expand Up @@ -964,12 +964,16 @@ export type EventSessionDeleted = {
}

export type Event =
| EventServerConnected
| EventGlobalDisposed
| EventTuiPromptAppend
| EventTuiCommandExecute
| EventTuiToastShow
| EventTuiSessionSelect
| EventProjectUpdated
| EventInstallationUpdated
| EventInstallationUpdateAvailable
| EventServerInstanceDisposed
| EventServerConnected
| EventGlobalDisposed
| EventLspClientDiagnostics
| EventLspUpdated
| EventMessagePartDelta
Expand All @@ -984,10 +988,6 @@ export type Event =
| EventFileEdited
| EventFileWatcherUpdated
| EventTodoUpdated
| EventTuiPromptAppend
| EventTuiCommandExecute
| EventTuiToastShow
| EventTuiSessionSelect
| EventMcpToolsChanged
| EventMcpBrowserOpenFailed
| EventCommandExecuted
Expand Down Expand Up @@ -1428,6 +1428,7 @@ export type Config = {
description?: string
agent?: string
model?: string
variant?: string
subtask?: boolean
}
}
Expand Down Expand Up @@ -2011,6 +2012,7 @@ export type Command = {
description?: string
agent?: string
model?: string
variant?: string
source?: "command" | "mcp" | "skill"
template: string
subtask?: boolean
Expand Down
Loading
Loading