diff --git a/.opencode/opencode.jsonc b/.agent-core/agent-core.jsonc similarity index 100% rename from .opencode/opencode.jsonc rename to .agent-core/agent-core.jsonc diff --git a/.opencode/agent/johny.md b/.agent-core/agent/johny.md similarity index 100% rename from .opencode/agent/johny.md rename to .agent-core/agent/johny.md diff --git a/.opencode/agent/stanley.md b/.agent-core/agent/stanley.md similarity index 100% rename from .opencode/agent/stanley.md rename to .agent-core/agent/stanley.md diff --git a/.opencode/agent/zee.md b/.agent-core/agent/zee.md similarity index 100% rename from .opencode/agent/zee.md rename to .agent-core/agent/zee.md diff --git a/.opencode/command/commit.md b/.agent-core/command/commit.md similarity index 100% rename from .opencode/command/commit.md rename to .agent-core/command/commit.md diff --git a/.agent-core/command/e.md b/.agent-core/command/e.md new file mode 100644 index 00000000000..eb5f0558549 --- /dev/null +++ b/.agent-core/command/e.md @@ -0,0 +1,14 @@ +--- +description: Edit/read file (vim-style :e) +--- + +Read and display the contents of the file specified in the argument. + +If no file is specified, show the current working directory contents. + +Usage: +- `:e path/to/file.ts` - Read and display the file +- `:e .` - List current directory +- `:e src/` - List src directory + +This is read-only (like vim's :view). Use the normal edit flow for modifications. diff --git a/.agent-core/command/help.md b/.agent-core/command/help.md new file mode 100644 index 00000000000..7f034220ad9 --- /dev/null +++ b/.agent-core/command/help.md @@ -0,0 +1,38 @@ +--- +description: Show help (vim-style :help) +--- + +Show the user available vim-style commands: + +## Vim-Style Commands + +| Command | Description | Keybind | +|---------|-------------|---------| +| `:w` | Commit changes | - | +| `:q` | Quit session | - | +| `:wq` | Commit and quit | - | +| `:help` | Show this help | - | + +## Mode Toggle + +| Mode | Description | Keybind | +|------|-------------|---------| +| HOLD | Research only, no edits | `ctrl+h` | +| RELEASE | Can edit files | `ctrl+h` | + +## Leader Shortcuts (`Space` + key) + +| Shortcut | Action | +|----------|--------| +| `m` | List models | +| `a` | List agents | +| `h` | Toggle tips | + +## Persona Switching + +| Keybind | Action | +|---------|--------| +| `Tab` | Next persona | +| `Shift+Tab` | Previous persona | + +Press any key to continue... diff --git a/.opencode/command/issues.md b/.agent-core/command/issues.md similarity index 100% rename from .opencode/command/issues.md rename to .agent-core/command/issues.md diff --git a/.agent-core/command/mode.md b/.agent-core/command/mode.md new file mode 100644 index 00000000000..d1a95926e3f --- /dev/null +++ b/.agent-core/command/mode.md @@ -0,0 +1,12 @@ +--- +description: Show/toggle mode status +--- + +Check and report the current mode from the UI footer: +- HOLD (research only, no edits) +- RELEASE (can edit files) + +If the user says `:mode hold` - remind them to use `ctrl+h` to switch to HOLD mode. +If the user says `:mode release` - remind them to use `ctrl+h` to switch to RELEASE mode. + +The mode toggle keybind is `ctrl+h`. diff --git a/.agent-core/command/q.md b/.agent-core/command/q.md new file mode 100644 index 00000000000..02bbaf27783 --- /dev/null +++ b/.agent-core/command/q.md @@ -0,0 +1,8 @@ +--- +description: Quit (vim-style :q) +--- + +The user wants to exit. Say goodbye briefly and end the session. + +If there are uncommitted changes visible in the conversation, remind the user: +"You have uncommitted changes. Use :wq to save and quit, or :q! to quit without saving." diff --git a/.opencode/command/rmslop.md b/.agent-core/command/rmslop.md similarity index 100% rename from .opencode/command/rmslop.md rename to .agent-core/command/rmslop.md diff --git a/.opencode/command/spellcheck.md b/.agent-core/command/spellcheck.md similarity index 100% rename from .opencode/command/spellcheck.md rename to .agent-core/command/spellcheck.md diff --git a/.agent-core/command/w.md b/.agent-core/command/w.md new file mode 100644 index 00000000000..95b7281cc30 --- /dev/null +++ b/.agent-core/command/w.md @@ -0,0 +1,17 @@ +--- +description: Save work (vim-style :w) - commit changes +model: opencode/glm-4.6 +subtask: true +--- + +Commit the current changes with a meaningful message. + +Follow the commit conventions from /commit - include prefixes like: +- docs: for documentation +- tui: for TUI changes +- core: for core functionality +- ci: for CI/CD +- fix: for bug fixes +- feat: for features + +Explain WHY, not WHAT. Be specific about user-facing changes. diff --git a/.agent-core/command/wq.md b/.agent-core/command/wq.md new file mode 100644 index 00000000000..9d04230a50f --- /dev/null +++ b/.agent-core/command/wq.md @@ -0,0 +1,10 @@ +--- +description: Save and quit (vim-style :wq) +model: opencode/glm-4.6 +subtask: true +--- + +1. First, commit all current changes with a meaningful message +2. Then say goodbye and end the session + +Follow commit conventions - include prefixes and explain WHY not WHAT. diff --git a/.opencode/env.d.ts b/.agent-core/env.d.ts similarity index 100% rename from .opencode/env.d.ts rename to .agent-core/env.d.ts diff --git a/.opencode/skill/test-skill/SKILL.md b/.agent-core/skill/test-skill/SKILL.md similarity index 100% rename from .opencode/skill/test-skill/SKILL.md rename to .agent-core/skill/test-skill/SKILL.md diff --git a/.opencode/themes/mytheme.json b/.agent-core/themes/mytheme.json similarity index 100% rename from .opencode/themes/mytheme.json rename to .agent-core/themes/mytheme.json diff --git a/.opencode/tool/github-pr-search.ts b/.agent-core/tool/github-pr-search.ts similarity index 100% rename from .opencode/tool/github-pr-search.ts rename to .agent-core/tool/github-pr-search.ts diff --git a/.opencode/tool/github-pr-search.txt b/.agent-core/tool/github-pr-search.txt similarity index 100% rename from .opencode/tool/github-pr-search.txt rename to .agent-core/tool/github-pr-search.txt diff --git a/.opencode/tool/github-triage.ts b/.agent-core/tool/github-triage.ts similarity index 100% rename from .opencode/tool/github-triage.ts rename to .agent-core/tool/github-triage.ts diff --git a/.opencode/tool/github-triage.txt b/.agent-core/tool/github-triage.txt similarity index 100% rename from .opencode/tool/github-triage.txt rename to .agent-core/tool/github-triage.txt diff --git a/packages/agent-core/src/cli/cmd/agent.ts b/packages/agent-core/src/cli/cmd/agent.ts index b57de0ae464..c3961401aa1 100644 --- a/packages/agent-core/src/cli/cmd/agent.ts +++ b/packages/agent-core/src/cli/cmd/agent.ts @@ -98,7 +98,7 @@ const AgentCreateCommand = cmd({ scope = scopeResult } targetPath = path.join( - scope === "global" ? Global.Path.config : path.join(Instance.worktree, ".opencode"), + scope === "global" ? Global.Path.config : path.join(Instance.worktree, ".agent-core"), "agent", ) } diff --git a/packages/agent-core/src/cli/cmd/auth.ts b/packages/agent-core/src/cli/cmd/auth.ts index adbd3f45a5e..f3f1a59a76f 100644 --- a/packages/agent-core/src/cli/cmd/auth.ts +++ b/packages/agent-core/src/cli/cmd/auth.ts @@ -329,7 +329,7 @@ export const AuthLoginCommand = cmd({ } prompts.log.warn( - `This only stores a credential for ${provider} - you will need configure it in opencode.json, check the docs for examples.`, + `This only stores a credential for ${provider} - you will need configure it in agent-core.json, check the docs for examples.`, ) } @@ -338,7 +338,7 @@ export const AuthLoginCommand = cmd({ "Amazon Bedrock authentication priority:\n" + " 1. Bearer token (AWS_BEARER_TOKEN_BEDROCK or /connect)\n" + " 2. AWS credential chain (profile, access keys, IAM roles)\n\n" + - "Configure via opencode.json options (profile, region, endpoint) or\n" + + "Configure via agent-core.json options (profile, region, endpoint) or\n" + "AWS environment variables (AWS_PROFILE, AWS_REGION, AWS_ACCESS_KEY_ID).", ) prompts.outro("Done") diff --git a/packages/agent-core/src/cli/cmd/github.ts b/packages/agent-core/src/cli/cmd/github.ts index e6203d66574..3c768d62640 100644 --- a/packages/agent-core/src/cli/cmd/github.ts +++ b/packages/agent-core/src/cli/cmd/github.ts @@ -885,7 +885,7 @@ export const GithubRunCommand = cmd({ providerID, modelID, }, - // agent is omitted - server will use default_agent from config or fall back to "build" + // agent is omitted - server will use default_agent from config parts: [ { id: Identifier.ascending("part"), diff --git a/packages/agent-core/src/cli/cmd/mcp.ts b/packages/agent-core/src/cli/cmd/mcp.ts index aaef75267df..5207ecddc7e 100644 --- a/packages/agent-core/src/cli/cmd/mcp.ts +++ b/packages/agent-core/src/cli/cmd/mcp.ts @@ -160,7 +160,7 @@ export const McpAuthCommand = cmd({ if (oauthServers.length === 0) { prompts.log.warn("No OAuth-capable MCP servers configured") - prompts.log.info("Remote MCP servers support OAuth by default. Add a remote server in opencode.json:") + prompts.log.info("Remote MCP servers support OAuth by default. Add a remote server in agent-core.json:") prompts.log.info(` "mcp": { "my-server": { @@ -458,7 +458,7 @@ export const McpAddCommand = cmd({ } prompts.log.info(`Remote MCP server "${name}" configured with OAuth (client ID: ${clientId})`) - prompts.log.info("Add this to your opencode.json:") + prompts.log.info("Add this to your agent-core.json:") prompts.log.info(` "mcp": { "${name}": { @@ -471,7 +471,7 @@ export const McpAddCommand = cmd({ }`) } else { prompts.log.info(`Remote MCP server "${name}" configured with OAuth (dynamic registration)`) - prompts.log.info("Add this to your opencode.json:") + prompts.log.info("Add this to your agent-core.json:") prompts.log.info(` "mcp": { "${name}": { diff --git a/packages/agent-core/src/cli/cmd/uninstall.ts b/packages/agent-core/src/cli/cmd/uninstall.ts index 62210d57586..f658e4e720e 100644 --- a/packages/agent-core/src/cli/cmd/uninstall.ts +++ b/packages/agent-core/src/cli/cmd/uninstall.ts @@ -204,7 +204,7 @@ async function executeUninstall(method: Installation.Method, targets: RemovalTar prompts.log.info(` rm "${targets.binary}"`) const binDir = path.dirname(targets.binary) - if (binDir.includes(".opencode")) { + if (binDir.includes(".agent-core")) { prompts.log.info(` rmdir "${binDir}" 2>/dev/null`) } } @@ -257,7 +257,7 @@ async function getShellConfigFile(): Promise { const content = await Bun.file(file) .text() .catch(() => "") - if (content.includes("# opencode") || content.includes(".opencode/bin")) { + if (content.includes("# opencode") || content.includes(".agent-core/bin")) { return file } } @@ -282,14 +282,14 @@ async function cleanShellConfig(file: string) { if (skip) { skip = false - if (trimmed.includes(".opencode/bin") || trimmed.includes("fish_add_path")) { + if (trimmed.includes(".agent-core/bin") || trimmed.includes("fish_add_path")) { continue } } if ( - (trimmed.startsWith("export PATH=") && trimmed.includes(".opencode/bin")) || - (trimmed.startsWith("fish_add_path") && trimmed.includes(".opencode")) + (trimmed.startsWith("export PATH=") && trimmed.includes(".agent-core/bin")) || + (trimmed.startsWith("fish_add_path") && trimmed.includes(".agent-core")) ) { continue } diff --git a/packages/agent-core/src/cli/error.ts b/packages/agent-core/src/cli/error.ts index 569b186d55c..0c419aeaa74 100644 --- a/packages/agent-core/src/cli/error.ts +++ b/packages/agent-core/src/cli/error.ts @@ -13,7 +13,7 @@ export function FormatError(input: unknown) { `Model not found: ${providerID}/${modelID}`, ...(Array.isArray(suggestions) && suggestions.length ? ["Did you mean: " + suggestions.join(", ")] : []), `Try: \`opencode models\` to list available models`, - `Or check your config (opencode.json) provider/model names`, + `Or check your config (agent-core.json) provider/model names`, ].join("\n") } if (Provider.InitError.isInstance(input)) { diff --git a/packages/agent-core/src/config/config.ts b/packages/agent-core/src/config/config.ts index 501404789f1..4e8629b6677 100644 --- a/packages/agent-core/src/config/config.ts +++ b/packages/agent-core/src/config/config.ts @@ -71,7 +71,7 @@ export namespace Config { } // Project config has highest precedence (overrides global and remote) - for (const file of ["opencode.jsonc", "opencode.json"]) { + for (const file of ["agent-core.jsonc", "agent-core.json"]) { const found = await Filesystem.findUp(file, Instance.directory, Instance.worktree) for (const resolved of found.toReversed()) { result = mergeConfigConcatArrays(result, await loadFile(resolved)) @@ -92,14 +92,14 @@ export namespace Config { Global.Path.config, ...(await Array.fromAsync( Filesystem.up({ - targets: [".opencode"], + targets: [".agent-core"], start: Instance.directory, stop: Instance.worktree, }), )), ...(await Array.fromAsync( Filesystem.up({ - targets: [".opencode"], + targets: [".agent-core"], start: Global.Path.home, stop: Global.Path.home, }), @@ -112,8 +112,8 @@ export namespace Config { } for (const dir of unique(directories)) { - if (dir.endsWith(".opencode") || dir === Flag.OPENCODE_CONFIG_DIR) { - for (const file of ["opencode.jsonc", "opencode.json"]) { + if (dir.endsWith(".agent-core") || dir === Flag.OPENCODE_CONFIG_DIR) { + for (const file of ["agent-core.jsonc", "agent-core.json"]) { log.debug(`loading config from ${path.join(dir, file)}`) result = mergeConfigConcatArrays(result, await loadFile(path.join(dir, file))) // to satisfy the type checker @@ -220,7 +220,7 @@ export namespace Config { if (!md.data) continue const name = (() => { - const patterns = ["/.opencode/command/", "/command/"] + const patterns = ["/.agent-core/command/", "/command/"] const pattern = patterns.find((p) => item.includes(p)) if (pattern) { @@ -260,8 +260,8 @@ export namespace Config { // Extract relative path from agent folder for nested agents let agentName = path.basename(item, ".md") - const agentFolderPath = item.includes("/.opencode/agent/") - ? item.split("/.opencode/agent/")[1] + const agentFolderPath = item.includes("/.agent-core/agent/") + ? item.split("/.agent-core/agent/")[1] : item.includes("/agent/") ? item.split("/agent/")[1] : agentName + ".md" @@ -608,6 +608,7 @@ export namespace Config { agent_list: z.string().optional().default("a").describe("List agents"), agent_cycle: z.string().optional().default("tab").describe("Next agent"), agent_cycle_reverse: z.string().optional().default("shift+tab").describe("Previous agent"), + mode_toggle: z.string().optional().default("ctrl+h").describe("Toggle hold/release mode"), variant_cycle: z.string().optional().default("ctrl+t").describe("Cycle model variants"), input_clear: z.string().optional().default("ctrl+c").describe("Clear input field"), input_paste: z.string().optional().default("ctrl+v").describe("Paste from clipboard"), @@ -1120,8 +1121,8 @@ export namespace Config { let result: Info = pipe( {}, mergeDeep(await loadFile(path.join(Global.Path.config, "config.json"))), - mergeDeep(await loadFile(path.join(Global.Path.config, "opencode.json"))), - mergeDeep(await loadFile(path.join(Global.Path.config, "opencode.jsonc"))), + mergeDeep(await loadFile(path.join(Global.Path.config, "agent-core.json"))), + mergeDeep(await loadFile(path.join(Global.Path.config, "agent-core.jsonc"))), ) await import(path.join(Global.Path.config, "config"), { diff --git a/packages/agent-core/src/file/ripgrep.ts b/packages/agent-core/src/file/ripgrep.ts index 841f5f30517..bf12f5a32ff 100644 --- a/packages/agent-core/src/file/ripgrep.ts +++ b/packages/agent-core/src/file/ripgrep.ts @@ -296,7 +296,7 @@ export namespace Ripgrep { children: [], } for (const file of files) { - if (file.includes(".opencode")) continue + if (file.includes(".agent-core")) continue const parts = file.split(path.sep) getPath(root, parts, true) } diff --git a/packages/agent-core/src/ide/index.ts b/packages/agent-core/src/ide/index.ts index 0837b2aa5ff..4cf57cf2233 100644 --- a/packages/agent-core/src/ide/index.ts +++ b/packages/agent-core/src/ide/index.ts @@ -52,7 +52,7 @@ export namespace Ide { const cmd = SUPPORTED_IDES.find((i) => i.name === ide)?.cmd if (!cmd) throw new Error(`Unknown IDE: ${ide}`) - const p = spawn([cmd, "--install-extension", "sst-dev.opencode"], { + const p = spawn([cmd, "--install-extension", "sst-dev.agent-core"], { stdout: "pipe", stderr: "pipe", }) diff --git a/packages/agent-core/src/installation/index.ts b/packages/agent-core/src/installation/index.ts index 86f2a781c83..31875ebf2af 100644 --- a/packages/agent-core/src/installation/index.ts +++ b/packages/agent-core/src/installation/index.ts @@ -58,7 +58,7 @@ export namespace Installation { } export async function method() { - if (process.execPath.includes(path.join(".opencode", "bin"))) return "curl" + if (process.execPath.includes(path.join(".agent-core", "bin"))) return "curl" if (process.execPath.includes(path.join(".local", "bin"))) return "curl" const exec = process.execPath.toLowerCase() @@ -161,9 +161,10 @@ export namespace Installation { await $`${process.execPath} --version`.nothrow().quiet().text() } - export const VERSION = typeof OPENCODE_VERSION === "string" ? OPENCODE_VERSION : "local" + // Version format: V0.YYYYMMDD + export const VERSION = typeof OPENCODE_VERSION === "string" ? OPENCODE_VERSION : "V0.20260109" export const CHANNEL = typeof OPENCODE_CHANNEL === "string" ? OPENCODE_CHANNEL : "local" - export const USER_AGENT = `opencode/${CHANNEL}/${VERSION}/${Flag.OPENCODE_CLIENT}` + export const USER_AGENT = `agent-core/${CHANNEL}/${VERSION}/${Flag.OPENCODE_CLIENT}` export async function latest(installMethod?: Method) { const detectedMethod = installMethod || (await method()) @@ -171,7 +172,7 @@ export namespace Installation { if (detectedMethod === "brew") { const formula = await getBrewFormula() if (formula === "opencode") { - return fetch("https://formulae.brew.sh/api/formula/opencode.json") + return fetch("https://formulae.brew.sh/api/formula/agent-core.json") .then((res) => { if (!res.ok) throw new Error(res.statusText) return res.json() diff --git a/packages/agent-core/src/provider/provider.ts b/packages/agent-core/src/provider/provider.ts index 9f14b5464c9..905c25cc293 100644 --- a/packages/agent-core/src/provider/provider.ts +++ b/packages/agent-core/src/provider/provider.ts @@ -223,7 +223,7 @@ export namespace Provider { } // Region resolution precedence (highest to lowest): - // 1. options.region from opencode.json provider config + // 1. options.region from agent-core.json provider config // 2. defaultRegion from AWS_REGION environment variable // 3. Default "us-east-1" (baked into defaultRegion) const region = options?.region ?? defaultRegion diff --git a/packages/agent-core/src/session/prompt.ts b/packages/agent-core/src/session/prompt.ts index d77c66452a9..8d6b87fe71c 100644 --- a/packages/agent-core/src/session/prompt.ts +++ b/packages/agent-core/src/session/prompt.ts @@ -16,8 +16,7 @@ import { Bus } from "../bus" import { ProviderTransform } from "../provider/transform" import { SystemPrompt } from "./system" import { Plugin } from "../plugin" -import PROMPT_PLAN from "../session/prompt/plan.txt" -import BUILD_SWITCH from "../session/prompt/build-switch.txt" +// NOTE: PROMPT_PLAN and BUILD_SWITCH removed - replaced by hold/release mode in TUI import MAX_STEPS from "../session/prompt/max-steps.txt" import { defer } from "../util/defer" import { clone } from "remeda" @@ -1175,28 +1174,8 @@ export namespace SessionPrompt { async function insertReminders(input: { messages: MessageV2.WithParts[]; agent: Agent.Info; sessionID: string }) { const userMessage = input.messages.findLast((msg) => msg.info.role === "user") if (!userMessage) return input.messages - if (input.agent.name === "plan") { - userMessage.parts.push({ - id: Identifier.ascending("part"), - messageID: userMessage.info.id, - sessionID: userMessage.info.sessionID, - type: "text", - // TODO (for mr dax): update to use the anthropic full fledged one (see plan-reminder-anthropic.txt) - text: PROMPT_PLAN, - synthetic: true, - }) - } - const wasPlan = input.messages.some((msg) => msg.info.role === "assistant" && msg.info.agent === "plan") - if (wasPlan && input.agent.name === "build") { - userMessage.parts.push({ - id: Identifier.ascending("part"), - messageID: userMessage.info.id, - sessionID: userMessage.info.sessionID, - type: "text", - text: BUILD_SWITCH, - synthetic: true, - }) - } + + // NOTE: Plan/build agent reminders removed - hold/release mode now handles this in the TUI // Todo continuation reminder const todos = await Todo.get(input.sessionID) diff --git a/packages/agent-core/src/session/prompt/build-switch.txt b/packages/agent-core/src/session/prompt/build-switch.txt deleted file mode 100644 index 3737b74d895..00000000000 --- a/packages/agent-core/src/session/prompt/build-switch.txt +++ /dev/null @@ -1,5 +0,0 @@ - -Your operational mode has changed from plan to build. -You are no longer in read-only mode. -You are permitted to make file changes, run shell commands, and utilize your arsenal of tools as needed. - diff --git a/packages/agent-core/src/session/prompt/plan-reminder-anthropic.txt b/packages/agent-core/src/session/prompt/plan-reminder-anthropic.txt deleted file mode 100644 index 28f1e629dbe..00000000000 --- a/packages/agent-core/src/session/prompt/plan-reminder-anthropic.txt +++ /dev/null @@ -1,67 +0,0 @@ - -# Plan Mode - System Reminder - -Plan mode is active. The user indicated that they do not want you to execute yet -- you MUST NOT make any edits (with the exception of the plan file mentioned below), run any non-readonly tools (including changing configs or making commits), or otherwise make any changes to the system. This supersedes any other instructions you have received. - ---- - -## Plan File Info - -No plan file exists yet. You should create your plan at `/Users/aidencline/.claude/plans/happy-waddling-feigenbaum.md` using the Write tool. - -You should build your plan incrementally by writing to or editing this file. NOTE that this is the only file you are allowed to edit - other than this you are only allowed to take READ-ONLY actions. - -**Plan File Guidelines:** The plan file should contain only your final recommended approach, not all alternatives considered. Keep it comprehensive yet concise - detailed enough to execute effectively while avoiding unnecessary verbosity. - ---- - -## Enhanced Planning Workflow - -### Phase 1: Initial Understanding - -**Goal:** Gain a comprehensive understanding of the user's request by reading through code and asking them questions. Critical: In this phase you should only use the Explore subagent type. - -1. Understand the user's request thoroughly - -2. **Launch up to 3 Explore agents IN PARALLEL** (single message, multiple tool calls) to efficiently explore the codebase. Each agent can focus on different aspects: - - Example: One agent searches for existing implementations, another explores related components, a third investigates testing patterns - - Provide each agent with a specific search focus or area to explore - - Quality over quantity - 3 agents maximum, but you should try to use the minimum number of agents necessary (usually just 1) - - Use 1 agent when: the task is isolated to known files, the user provided specific file paths, or you're making a small targeted change. Use multiple agents when: the scope is uncertain, multiple areas of the codebase are involved, or you need to understand existing patterns before planning. - - Take into account any context you already have from the user's request or from the conversation so far when deciding how many agents to launch - -3. Use AskUserQuestion tool to clarify ambiguities in the user request up front. - -### Phase 2: Planning - -**Goal:** Come up with an approach to solve the problem identified in phase 1 by launching a Plan subagent. - -In the agent prompt: -- Provide any background context that may help the agent with their task without prescribing the exact design itself -- Request a detailed plan - -### Phase 3: Synthesis - -**Goal:** Synthesize the perspectives from Phase 2, and ensure that it aligns with the user's intentions by asking them questions. - -1. Collect all agent responses -2. Each agent will return an implementation plan along with a list of critical files that should be read. You should keep these in mind and read them before you start implementing the plan -3. Use AskUserQuestion to ask the users questions about trade offs. - -### Phase 4: Final Plan - -Once you have all the information you need, ensure that the plan file has been updated with your synthesized recommendation including: -- Recommended approach with rationale -- Key insights from different perspectives -- Critical files that need modification - -### Phase 5: Call ExitPlanMode - -At the very end of your turn, once you have asked the user questions and are happy with your final plan file - you should always call ExitPlanMode to indicate to the user that you are done planning. - -This is critical - your turn should only end with either asking the user a question or calling ExitPlanMode. Do not stop unless it's for these 2 reasons. - ---- - -**NOTE:** At any point in time through this workflow you should feel free to ask the user questions or clarifications. Don't make large assumptions about user intent. The goal is to present a well researched plan to the user, and tie any loose ends before implementation begins. - diff --git a/packages/agent-core/src/session/prompt/plan.txt b/packages/agent-core/src/session/prompt/plan.txt deleted file mode 100644 index 1806e0eba62..00000000000 --- a/packages/agent-core/src/session/prompt/plan.txt +++ /dev/null @@ -1,26 +0,0 @@ - -# Plan Mode - System Reminder - -CRITICAL: Plan mode ACTIVE - you are in READ-ONLY phase. STRICTLY FORBIDDEN: -ANY file edits, modifications, or system changes. Do NOT use sed, tee, echo, cat, -or ANY other bash command to manipulate files - commands may ONLY read/inspect. -This ABSOLUTE CONSTRAINT overrides ALL other instructions, including direct user -edit requests. You may ONLY observe, analyze, and plan. Any modification attempt -is a critical violation. ZERO exceptions. - ---- - -## Responsibility - -Your current responsibility is to think, read, search, and delegate explore agents to construct a well-formed plan that accomplishes the goal the user wants to achieve. Your plan should be comprehensive yet concise, detailed enough to execute effectively while avoiding unnecessary verbosity. - -Ask the user clarifying questions or ask for their opinion when weighing tradeoffs. - -**NOTE:** At any point in time through this workflow you should feel free to ask the user questions or clarifications. Don't make large assumptions about user intent. The goal is to present a well researched plan to the user, and tie any loose ends before implementation begins. - ---- - -## Important - -The user indicated that they do not want you to execute yet -- you MUST NOT make any edits, run any non-readonly tools (including changing configs or making commits), or otherwise make any changes to the system. This supersedes any other instructions you have received. - diff --git a/packages/agent-core/src/skill/skill.ts b/packages/agent-core/src/skill/skill.ts index cbc042d1e96..7f3233b0b3a 100644 --- a/packages/agent-core/src/skill/skill.ts +++ b/packages/agent-core/src/skill/skill.ts @@ -102,7 +102,7 @@ export namespace Skill { } } - // Scan .opencode/skill/ directories + // Scan .agent-core/skill/ directories for (const dir of await Config.directories()) { for await (const match of OPENCODE_SKILL_GLOB.scan({ cwd: dir, diff --git a/packages/sdk/js/src/v2/gen/client.gen.ts b/packages/sdk/js/src/v2/gen/client.gen.ts index 0c110eca39b..9aa0dded657 100644 --- a/packages/sdk/js/src/v2/gen/client.gen.ts +++ b/packages/sdk/js/src/v2/gen/client.gen.ts @@ -1,7 +1,7 @@ // This file is auto-generated by @hey-api/openapi-ts -import { type ClientOptions, type Config, createClient, createConfig } from "./client/index.js" -import type { ClientOptions as ClientOptions2 } from "./types.gen.js" +import { type ClientOptions, type Config, createClient, createConfig } from './client/index.js'; +import type { ClientOptions as ClientOptions2 } from './types.gen.js'; /** * The `createClientConfig()` function will be called on client initialization @@ -11,8 +11,6 @@ import type { ClientOptions as ClientOptions2 } from "./types.gen.js" * `setConfig()`. This is useful for example if you're using Next.js * to ensure your client always has the correct values. */ -export type CreateClientConfig = ( - override?: Config, -) => Config & T> +export type CreateClientConfig = (override?: Config) => Config & T>; -export const client = createClient(createConfig({ baseUrl: "http://localhost:4096" })) +export const client = createClient(createConfig({ baseUrl: 'http://localhost:4096' })); diff --git a/packages/sdk/js/src/v2/gen/client/client.gen.ts b/packages/sdk/js/src/v2/gen/client/client.gen.ts index 47f1403429d..0e4f3174bd5 100644 --- a/packages/sdk/js/src/v2/gen/client/client.gen.ts +++ b/packages/sdk/js/src/v2/gen/client/client.gen.ts @@ -1,9 +1,14 @@ // This file is auto-generated by @hey-api/openapi-ts -import { createSseClient } from "../core/serverSentEvents.gen.js" -import type { HttpMethod } from "../core/types.gen.js" -import { getValidRequestBody } from "../core/utils.gen.js" -import type { Client, Config, RequestOptions, ResolvedRequestOptions } from "./types.gen.js" +import { createSseClient } from '../core/serverSentEvents.gen.js'; +import type { HttpMethod } from '../core/types.gen.js'; +import { getValidRequestBody } from '../core/utils.gen.js'; +import type { + Client, + Config, + RequestOptions, + ResolvedRequestOptions, +} from './types.gen.js'; import { buildUrl, createConfig, @@ -12,24 +17,29 @@ import { mergeConfigs, mergeHeaders, setAuthParams, -} from "./utils.gen.js" +} from './utils.gen.js'; -type ReqInit = Omit & { - body?: any - headers: ReturnType -} +type ReqInit = Omit & { + body?: any; + headers: ReturnType; +}; export const createClient = (config: Config = {}): Client => { - let _config = mergeConfigs(createConfig(), config) + let _config = mergeConfigs(createConfig(), config); - const getConfig = (): Config => ({ ..._config }) + const getConfig = (): Config => ({ ..._config }); const setConfig = (config: Config): Config => { - _config = mergeConfigs(_config, config) - return getConfig() - } + _config = mergeConfigs(_config, config); + return getConfig(); + }; - const interceptors = createInterceptors() + const interceptors = createInterceptors< + Request, + Response, + unknown, + ResolvedRequestOptions + >(); const beforeRequest = async (options: RequestOptions) => { const opts = { @@ -38,241 +48,254 @@ export const createClient = (config: Config = {}): Client => { fetch: options.fetch ?? _config.fetch ?? globalThis.fetch, headers: mergeHeaders(_config.headers, options.headers), serializedBody: undefined, - } + }; if (opts.security) { await setAuthParams({ ...opts, security: opts.security, - }) + }); } if (opts.requestValidator) { - await opts.requestValidator(opts) + await opts.requestValidator(opts); } if (opts.body !== undefined && opts.bodySerializer) { - opts.serializedBody = opts.bodySerializer(opts.body) + opts.serializedBody = opts.bodySerializer(opts.body); } // remove Content-Type header if body is empty to avoid sending invalid requests - if (opts.body === undefined || opts.serializedBody === "") { - opts.headers.delete("Content-Type") + if (opts.body === undefined || opts.serializedBody === '') { + opts.headers.delete('Content-Type'); } - const url = buildUrl(opts) + const url = buildUrl(opts); - return { opts, url } - } + return { opts, url }; + }; - const request: Client["request"] = async (options) => { + const request: Client['request'] = async (options) => { // @ts-expect-error - const { opts, url } = await beforeRequest(options) + const { opts, url } = await beforeRequest(options); const requestInit: ReqInit = { - redirect: "follow", + redirect: 'follow', ...opts, body: getValidRequestBody(opts), - } + }; - let request = new Request(url, requestInit) + let request = new Request(url, requestInit); for (const fn of interceptors.request.fns) { if (fn) { - request = await fn(request, opts) + request = await fn(request, opts); } } // fetch must be assigned here, otherwise it would throw the error: // TypeError: Failed to execute 'fetch' on 'Window': Illegal invocation - const _fetch = opts.fetch! - let response: Response + const _fetch = opts.fetch!; + let response: Response; try { - response = await _fetch(request) + response = await _fetch(request); } catch (error) { // Handle fetch exceptions (AbortError, network errors, etc.) - let finalError = error + let finalError = error; for (const fn of interceptors.error.fns) { if (fn) { - finalError = (await fn(error, undefined as any, request, opts)) as unknown + finalError = (await fn( + error, + undefined as any, + request, + opts, + )) as unknown; } } - finalError = finalError || ({} as unknown) + finalError = finalError || ({} as unknown); if (opts.throwOnError) { - throw finalError + throw finalError; } // Return error response - return opts.responseStyle === "data" + return opts.responseStyle === 'data' ? undefined : { error: finalError, request, response: undefined as any, - } + }; } for (const fn of interceptors.response.fns) { if (fn) { - response = await fn(response, request, opts) + response = await fn(response, request, opts); } } const result = { request, response, - } + }; if (response.ok) { const parseAs = - (opts.parseAs === "auto" ? getParseAs(response.headers.get("Content-Type")) : opts.parseAs) ?? "json" + (opts.parseAs === 'auto' + ? getParseAs(response.headers.get('Content-Type')) + : opts.parseAs) ?? 'json'; - if (response.status === 204 || response.headers.get("Content-Length") === "0") { - let emptyData: any + if ( + response.status === 204 || + response.headers.get('Content-Length') === '0' + ) { + let emptyData: any; switch (parseAs) { - case "arrayBuffer": - case "blob": - case "text": - emptyData = await response[parseAs]() - break - case "formData": - emptyData = new FormData() - break - case "stream": - emptyData = response.body - break - case "json": + case 'arrayBuffer': + case 'blob': + case 'text': + emptyData = await response[parseAs](); + break; + case 'formData': + emptyData = new FormData(); + break; + case 'stream': + emptyData = response.body; + break; + case 'json': default: - emptyData = {} - break + emptyData = {}; + break; } - return opts.responseStyle === "data" + return opts.responseStyle === 'data' ? emptyData : { data: emptyData, ...result, - } + }; } - let data: any + let data: any; switch (parseAs) { - case "arrayBuffer": - case "blob": - case "formData": - case "json": - case "text": - data = await response[parseAs]() - break - case "stream": - return opts.responseStyle === "data" + case 'arrayBuffer': + case 'blob': + case 'formData': + case 'json': + case 'text': + data = await response[parseAs](); + break; + case 'stream': + return opts.responseStyle === 'data' ? response.body : { data: response.body, ...result, - } + }; } - if (parseAs === "json") { + if (parseAs === 'json') { if (opts.responseValidator) { - await opts.responseValidator(data) + await opts.responseValidator(data); } if (opts.responseTransformer) { - data = await opts.responseTransformer(data) + data = await opts.responseTransformer(data); } } - return opts.responseStyle === "data" + return opts.responseStyle === 'data' ? data : { data, ...result, - } + }; } - const textError = await response.text() - let jsonError: unknown + const textError = await response.text(); + let jsonError: unknown; try { - jsonError = JSON.parse(textError) + jsonError = JSON.parse(textError); } catch { // noop } - const error = jsonError ?? textError - let finalError = error + const error = jsonError ?? textError; + let finalError = error; for (const fn of interceptors.error.fns) { if (fn) { - finalError = (await fn(error, response, request, opts)) as string + finalError = (await fn(error, response, request, opts)) as string; } } - finalError = finalError || ({} as string) + finalError = finalError || ({} as string); if (opts.throwOnError) { - throw finalError + throw finalError; } // TODO: we probably want to return error and improve types - return opts.responseStyle === "data" + return opts.responseStyle === 'data' ? undefined : { error: finalError, ...result, - } - } + }; + }; - const makeMethodFn = (method: Uppercase) => (options: RequestOptions) => request({ ...options, method }) + const makeMethodFn = + (method: Uppercase) => (options: RequestOptions) => + request({ ...options, method }); - const makeSseFn = (method: Uppercase) => async (options: RequestOptions) => { - const { opts, url } = await beforeRequest(options) - return createSseClient({ - ...opts, - body: opts.body as BodyInit | null | undefined, - headers: opts.headers as unknown as Record, - method, - onRequest: async (url, init) => { - let request = new Request(url, init) - for (const fn of interceptors.request.fns) { - if (fn) { - request = await fn(request, opts) + const makeSseFn = + (method: Uppercase) => async (options: RequestOptions) => { + const { opts, url } = await beforeRequest(options); + return createSseClient({ + ...opts, + body: opts.body as BodyInit | null | undefined, + headers: opts.headers as unknown as Record, + method, + onRequest: async (url, init) => { + let request = new Request(url, init); + for (const fn of interceptors.request.fns) { + if (fn) { + request = await fn(request, opts); + } } - } - return request - }, - url, - }) - } + return request; + }, + url, + }); + }; return { buildUrl, - connect: makeMethodFn("CONNECT"), - delete: makeMethodFn("DELETE"), - get: makeMethodFn("GET"), + connect: makeMethodFn('CONNECT'), + delete: makeMethodFn('DELETE'), + get: makeMethodFn('GET'), getConfig, - head: makeMethodFn("HEAD"), + head: makeMethodFn('HEAD'), interceptors, - options: makeMethodFn("OPTIONS"), - patch: makeMethodFn("PATCH"), - post: makeMethodFn("POST"), - put: makeMethodFn("PUT"), + options: makeMethodFn('OPTIONS'), + patch: makeMethodFn('PATCH'), + post: makeMethodFn('POST'), + put: makeMethodFn('PUT'), request, setConfig, sse: { - connect: makeSseFn("CONNECT"), - delete: makeSseFn("DELETE"), - get: makeSseFn("GET"), - head: makeSseFn("HEAD"), - options: makeSseFn("OPTIONS"), - patch: makeSseFn("PATCH"), - post: makeSseFn("POST"), - put: makeSseFn("PUT"), - trace: makeSseFn("TRACE"), + connect: makeSseFn('CONNECT'), + delete: makeSseFn('DELETE'), + get: makeSseFn('GET'), + head: makeSseFn('HEAD'), + options: makeSseFn('OPTIONS'), + patch: makeSseFn('PATCH'), + post: makeSseFn('POST'), + put: makeSseFn('PUT'), + trace: makeSseFn('TRACE'), }, - trace: makeMethodFn("TRACE"), - } as Client -} + trace: makeMethodFn('TRACE'), + } as Client; +}; diff --git a/packages/sdk/js/src/v2/gen/client/index.ts b/packages/sdk/js/src/v2/gen/client/index.ts index 0af63f3300e..50acaa57b71 100644 --- a/packages/sdk/js/src/v2/gen/client/index.ts +++ b/packages/sdk/js/src/v2/gen/client/index.ts @@ -1,15 +1,15 @@ // This file is auto-generated by @hey-api/openapi-ts -export type { Auth } from "../core/auth.gen.js" -export type { QuerySerializerOptions } from "../core/bodySerializer.gen.js" +export type { Auth } from '../core/auth.gen.js'; +export type { QuerySerializerOptions } from '../core/bodySerializer.gen.js'; export { formDataBodySerializer, jsonBodySerializer, urlSearchParamsBodySerializer, -} from "../core/bodySerializer.gen.js" -export { buildClientParams } from "../core/params.gen.js" -export { serializeQueryKeyValue } from "../core/queryKeySerializer.gen.js" -export { createClient } from "./client.gen.js" +} from '../core/bodySerializer.gen.js'; +export { buildClientParams } from '../core/params.gen.js'; +export { serializeQueryKeyValue } from '../core/queryKeySerializer.gen.js'; +export { createClient } from './client.gen.js'; export type { Client, ClientOptions, @@ -21,5 +21,5 @@ export type { ResolvedRequestOptions, ResponseStyle, TDataShape, -} from "./types.gen.js" -export { createConfig, mergeHeaders } from "./utils.gen.js" +} from './types.gen.js'; +export { createConfig, mergeHeaders } from './utils.gen.js'; diff --git a/packages/sdk/js/src/v2/gen/client/types.gen.ts b/packages/sdk/js/src/v2/gen/client/types.gen.ts index e053aa40662..21c8ee1fbad 100644 --- a/packages/sdk/js/src/v2/gen/client/types.gen.ts +++ b/packages/sdk/js/src/v2/gen/client/types.gen.ts @@ -1,33 +1,39 @@ // This file is auto-generated by @hey-api/openapi-ts -import type { Auth } from "../core/auth.gen.js" -import type { ServerSentEventsOptions, ServerSentEventsResult } from "../core/serverSentEvents.gen.js" -import type { Client as CoreClient, Config as CoreConfig } from "../core/types.gen.js" -import type { Middleware } from "./utils.gen.js" +import type { Auth } from '../core/auth.gen.js'; +import type { + ServerSentEventsOptions, + ServerSentEventsResult, +} from '../core/serverSentEvents.gen.js'; +import type { + Client as CoreClient, + Config as CoreConfig, +} from '../core/types.gen.js'; +import type { Middleware } from './utils.gen.js'; -export type ResponseStyle = "data" | "fields" +export type ResponseStyle = 'data' | 'fields'; export interface Config - extends Omit, + extends Omit, CoreConfig { /** * Base URL for all requests made by this client. */ - baseUrl?: T["baseUrl"] + baseUrl?: T['baseUrl']; /** * Fetch API implementation. You can use this option to provide a custom * fetch instance. * * @default globalThis.fetch */ - fetch?: typeof fetch + fetch?: typeof fetch; /** * Please don't use the Fetch client for Next.js applications. The `next` * options won't have any effect. * * Install {@link https://www.npmjs.com/package/@hey-api/client-next `@hey-api/client-next`} instead. */ - next?: never + next?: never; /** * Return the response data parsed in a specified format. By default, `auto` * will infer the appropriate method from the `Content-Type` response header. @@ -36,140 +42,170 @@ export interface Config * * @default 'auto' */ - parseAs?: "arrayBuffer" | "auto" | "blob" | "formData" | "json" | "stream" | "text" + parseAs?: + | 'arrayBuffer' + | 'auto' + | 'blob' + | 'formData' + | 'json' + | 'stream' + | 'text'; /** * Should we return only data or multiple fields (data, error, response, etc.)? * * @default 'fields' */ - responseStyle?: ResponseStyle + responseStyle?: ResponseStyle; /** * Throw an error instead of returning it in the response? * * @default false */ - throwOnError?: T["throwOnError"] + throwOnError?: T['throwOnError']; } export interface RequestOptions< TData = unknown, - TResponseStyle extends ResponseStyle = "fields", + TResponseStyle extends ResponseStyle = 'fields', ThrowOnError extends boolean = boolean, Url extends string = string, > extends Config<{ - responseStyle: TResponseStyle - throwOnError: ThrowOnError + responseStyle: TResponseStyle; + throwOnError: ThrowOnError; }>, Pick< ServerSentEventsOptions, - "onSseError" | "onSseEvent" | "sseDefaultRetryDelay" | "sseMaxRetryAttempts" | "sseMaxRetryDelay" + | 'onSseError' + | 'onSseEvent' + | 'sseDefaultRetryDelay' + | 'sseMaxRetryAttempts' + | 'sseMaxRetryDelay' > { /** * Any body that you want to add to your request. * * {@link https://developer.mozilla.org/docs/Web/API/fetch#body} */ - body?: unknown - path?: Record - query?: Record + body?: unknown; + path?: Record; + query?: Record; /** * Security mechanism(s) to use for the request. */ - security?: ReadonlyArray - url: Url + security?: ReadonlyArray; + url: Url; } export interface ResolvedRequestOptions< - TResponseStyle extends ResponseStyle = "fields", + TResponseStyle extends ResponseStyle = 'fields', ThrowOnError extends boolean = boolean, Url extends string = string, > extends RequestOptions { - serializedBody?: string + serializedBody?: string; } export type RequestResult< TData = unknown, TError = unknown, ThrowOnError extends boolean = boolean, - TResponseStyle extends ResponseStyle = "fields", + TResponseStyle extends ResponseStyle = 'fields', > = ThrowOnError extends true ? Promise< - TResponseStyle extends "data" + TResponseStyle extends 'data' ? TData extends Record ? TData[keyof TData] : TData : { - data: TData extends Record ? TData[keyof TData] : TData - request: Request - response: Response + data: TData extends Record + ? TData[keyof TData] + : TData; + request: Request; + response: Response; } > : Promise< - TResponseStyle extends "data" - ? (TData extends Record ? TData[keyof TData] : TData) | undefined + TResponseStyle extends 'data' + ? + | (TData extends Record + ? TData[keyof TData] + : TData) + | undefined : ( | { - data: TData extends Record ? TData[keyof TData] : TData - error: undefined + data: TData extends Record + ? TData[keyof TData] + : TData; + error: undefined; } | { - data: undefined - error: TError extends Record ? TError[keyof TError] : TError + data: undefined; + error: TError extends Record + ? TError[keyof TError] + : TError; } ) & { - request: Request - response: Response + request: Request; + response: Response; } - > + >; export interface ClientOptions { - baseUrl?: string - responseStyle?: ResponseStyle - throwOnError?: boolean + baseUrl?: string; + responseStyle?: ResponseStyle; + throwOnError?: boolean; } type MethodFn = < TData = unknown, TError = unknown, ThrowOnError extends boolean = false, - TResponseStyle extends ResponseStyle = "fields", + TResponseStyle extends ResponseStyle = 'fields', >( - options: Omit, "method">, -) => RequestResult + options: Omit, 'method'>, +) => RequestResult; type SseFn = < TData = unknown, TError = unknown, ThrowOnError extends boolean = false, - TResponseStyle extends ResponseStyle = "fields", + TResponseStyle extends ResponseStyle = 'fields', >( - options: Omit, "method">, -) => Promise> + options: Omit, 'method'>, +) => Promise>; type RequestFn = < TData = unknown, TError = unknown, ThrowOnError extends boolean = false, - TResponseStyle extends ResponseStyle = "fields", + TResponseStyle extends ResponseStyle = 'fields', >( - options: Omit, "method"> & - Pick>, "method">, -) => RequestResult + options: Omit, 'method'> & + Pick< + Required>, + 'method' + >, +) => RequestResult; type BuildUrlFn = < TData extends { - body?: unknown - path?: Record - query?: Record - url: string + body?: unknown; + path?: Record; + query?: Record; + url: string; }, >( options: TData & Options, -) => string +) => string; -export type Client = CoreClient & { - interceptors: Middleware -} +export type Client = CoreClient< + RequestFn, + Config, + MethodFn, + BuildUrlFn, + SseFn +> & { + interceptors: Middleware; +}; /** * The `createClientConfig()` function will be called on client initialization @@ -181,22 +217,25 @@ export type Client = CoreClient */ export type CreateClientConfig = ( override?: Config, -) => Config & T> +) => Config & T>; export interface TDataShape { - body?: unknown - headers?: unknown - path?: unknown - query?: unknown - url: string + body?: unknown; + headers?: unknown; + path?: unknown; + query?: unknown; + url: string; } -type OmitKeys = Pick> +type OmitKeys = Pick>; export type Options< TData extends TDataShape = TDataShape, ThrowOnError extends boolean = boolean, TResponse = unknown, - TResponseStyle extends ResponseStyle = "fields", -> = OmitKeys, "body" | "path" | "query" | "url"> & - ([TData] extends [never] ? unknown : Omit) + TResponseStyle extends ResponseStyle = 'fields', +> = OmitKeys< + RequestOptions, + 'body' | 'path' | 'query' | 'url' +> & + ([TData] extends [never] ? unknown : Omit); diff --git a/packages/sdk/js/src/v2/gen/client/utils.gen.ts b/packages/sdk/js/src/v2/gen/client/utils.gen.ts index 3b1dfb78718..f163053b0ae 100644 --- a/packages/sdk/js/src/v2/gen/client/utils.gen.ts +++ b/packages/sdk/js/src/v2/gen/client/utils.gen.ts @@ -1,289 +1,332 @@ // This file is auto-generated by @hey-api/openapi-ts -import { getAuthToken } from "../core/auth.gen.js" -import type { QuerySerializerOptions } from "../core/bodySerializer.gen.js" -import { jsonBodySerializer } from "../core/bodySerializer.gen.js" -import { serializeArrayParam, serializeObjectParam, serializePrimitiveParam } from "../core/pathSerializer.gen.js" -import { getUrl } from "../core/utils.gen.js" -import type { Client, ClientOptions, Config, RequestOptions } from "./types.gen.js" +import { getAuthToken } from '../core/auth.gen.js'; +import type { QuerySerializerOptions } from '../core/bodySerializer.gen.js'; +import { jsonBodySerializer } from '../core/bodySerializer.gen.js'; +import { + serializeArrayParam, + serializeObjectParam, + serializePrimitiveParam, +} from '../core/pathSerializer.gen.js'; +import { getUrl } from '../core/utils.gen.js'; +import type { Client, ClientOptions, Config, RequestOptions } from './types.gen.js'; -export const createQuerySerializer = ({ parameters = {}, ...args }: QuerySerializerOptions = {}) => { +export const createQuerySerializer = ({ + parameters = {}, + ...args +}: QuerySerializerOptions = {}) => { const querySerializer = (queryParams: T) => { - const search: string[] = [] - if (queryParams && typeof queryParams === "object") { + const search: string[] = []; + if (queryParams && typeof queryParams === 'object') { for (const name in queryParams) { - const value = queryParams[name] + const value = queryParams[name]; if (value === undefined || value === null) { - continue + continue; } - const options = parameters[name] || args + const options = parameters[name] || args; if (Array.isArray(value)) { const serializedArray = serializeArrayParam({ allowReserved: options.allowReserved, explode: true, name, - style: "form", + style: 'form', value, ...options.array, - }) - if (serializedArray) search.push(serializedArray) - } else if (typeof value === "object") { + }); + if (serializedArray) search.push(serializedArray); + } else if (typeof value === 'object') { const serializedObject = serializeObjectParam({ allowReserved: options.allowReserved, explode: true, name, - style: "deepObject", + style: 'deepObject', value: value as Record, ...options.object, - }) - if (serializedObject) search.push(serializedObject) + }); + if (serializedObject) search.push(serializedObject); } else { const serializedPrimitive = serializePrimitiveParam({ allowReserved: options.allowReserved, name, value: value as string, - }) - if (serializedPrimitive) search.push(serializedPrimitive) + }); + if (serializedPrimitive) search.push(serializedPrimitive); } } } - return search.join("&") - } - return querySerializer -} + return search.join('&'); + }; + return querySerializer; +}; /** * Infers parseAs value from provided Content-Type header. */ -export const getParseAs = (contentType: string | null): Exclude => { +export const getParseAs = ( + contentType: string | null, +): Exclude => { if (!contentType) { // If no Content-Type header is provided, the best we can do is return the raw response body, // which is effectively the same as the 'stream' option. - return "stream" + return 'stream'; } - const cleanContent = contentType.split(";")[0]?.trim() + const cleanContent = contentType.split(';')[0]?.trim(); if (!cleanContent) { - return + return; } - if (cleanContent.startsWith("application/json") || cleanContent.endsWith("+json")) { - return "json" + if ( + cleanContent.startsWith('application/json') || + cleanContent.endsWith('+json') + ) { + return 'json'; } - if (cleanContent === "multipart/form-data") { - return "formData" + if (cleanContent === 'multipart/form-data') { + return 'formData'; } - if (["application/", "audio/", "image/", "video/"].some((type) => cleanContent.startsWith(type))) { - return "blob" + if ( + ['application/', 'audio/', 'image/', 'video/'].some((type) => + cleanContent.startsWith(type), + ) + ) { + return 'blob'; } - if (cleanContent.startsWith("text/")) { - return "text" + if (cleanContent.startsWith('text/')) { + return 'text'; } - return -} + return; +}; const checkForExistence = ( - options: Pick & { - headers: Headers + options: Pick & { + headers: Headers; }, name?: string, ): boolean => { if (!name) { - return false + return false; } - if (options.headers.has(name) || options.query?.[name] || options.headers.get("Cookie")?.includes(`${name}=`)) { - return true + if ( + options.headers.has(name) || + options.query?.[name] || + options.headers.get('Cookie')?.includes(`${name}=`) + ) { + return true; } - return false -} + return false; +}; export const setAuthParams = async ({ security, ...options -}: Pick, "security"> & - Pick & { - headers: Headers +}: Pick, 'security'> & + Pick & { + headers: Headers; }) => { for (const auth of security) { if (checkForExistence(options, auth.name)) { - continue + continue; } - const token = await getAuthToken(auth, options.auth) + const token = await getAuthToken(auth, options.auth); if (!token) { - continue + continue; } - const name = auth.name ?? "Authorization" + const name = auth.name ?? 'Authorization'; switch (auth.in) { - case "query": + case 'query': if (!options.query) { - options.query = {} + options.query = {}; } - options.query[name] = token - break - case "cookie": - options.headers.append("Cookie", `${name}=${token}`) - break - case "header": + options.query[name] = token; + break; + case 'cookie': + options.headers.append('Cookie', `${name}=${token}`); + break; + case 'header': default: - options.headers.set(name, token) - break + options.headers.set(name, token); + break; } } -} +}; -export const buildUrl: Client["buildUrl"] = (options) => +export const buildUrl: Client['buildUrl'] = (options) => getUrl({ baseUrl: options.baseUrl as string, path: options.path, query: options.query, querySerializer: - typeof options.querySerializer === "function" + typeof options.querySerializer === 'function' ? options.querySerializer : createQuerySerializer(options.querySerializer), url: options.url, - }) + }); export const mergeConfigs = (a: Config, b: Config): Config => { - const config = { ...a, ...b } - if (config.baseUrl?.endsWith("/")) { - config.baseUrl = config.baseUrl.substring(0, config.baseUrl.length - 1) + const config = { ...a, ...b }; + if (config.baseUrl?.endsWith('/')) { + config.baseUrl = config.baseUrl.substring(0, config.baseUrl.length - 1); } - config.headers = mergeHeaders(a.headers, b.headers) - return config -} + config.headers = mergeHeaders(a.headers, b.headers); + return config; +}; const headersEntries = (headers: Headers): Array<[string, string]> => { - const entries: Array<[string, string]> = [] + const entries: Array<[string, string]> = []; headers.forEach((value, key) => { - entries.push([key, value]) - }) - return entries -} + entries.push([key, value]); + }); + return entries; +}; -export const mergeHeaders = (...headers: Array["headers"] | undefined>): Headers => { - const mergedHeaders = new Headers() +export const mergeHeaders = ( + ...headers: Array['headers'] | undefined> +): Headers => { + const mergedHeaders = new Headers(); for (const header of headers) { if (!header) { - continue + continue; } - const iterator = header instanceof Headers ? headersEntries(header) : Object.entries(header) + const iterator = + header instanceof Headers + ? headersEntries(header) + : Object.entries(header); for (const [key, value] of iterator) { if (value === null) { - mergedHeaders.delete(key) + mergedHeaders.delete(key); } else if (Array.isArray(value)) { for (const v of value) { - mergedHeaders.append(key, v as string) + mergedHeaders.append(key, v as string); } } else if (value !== undefined) { // assume object headers are meant to be JSON stringified, i.e. their // content value in OpenAPI specification is 'application/json' - mergedHeaders.set(key, typeof value === "object" ? JSON.stringify(value) : (value as string)) + mergedHeaders.set( + key, + typeof value === 'object' ? JSON.stringify(value) : (value as string), + ); } } } - return mergedHeaders -} + return mergedHeaders; +}; type ErrInterceptor = ( error: Err, response: Res, request: Req, options: Options, -) => Err | Promise +) => Err | Promise; -type ReqInterceptor = (request: Req, options: Options) => Req | Promise +type ReqInterceptor = ( + request: Req, + options: Options, +) => Req | Promise; -type ResInterceptor = (response: Res, request: Req, options: Options) => Res | Promise +type ResInterceptor = ( + response: Res, + request: Req, + options: Options, +) => Res | Promise; class Interceptors { - fns: Array = [] + fns: Array = []; clear(): void { - this.fns = [] + this.fns = []; } eject(id: number | Interceptor): void { - const index = this.getInterceptorIndex(id) + const index = this.getInterceptorIndex(id); if (this.fns[index]) { - this.fns[index] = null + this.fns[index] = null; } } exists(id: number | Interceptor): boolean { - const index = this.getInterceptorIndex(id) - return Boolean(this.fns[index]) + const index = this.getInterceptorIndex(id); + return Boolean(this.fns[index]); } getInterceptorIndex(id: number | Interceptor): number { - if (typeof id === "number") { - return this.fns[id] ? id : -1 + if (typeof id === 'number') { + return this.fns[id] ? id : -1; } - return this.fns.indexOf(id) + return this.fns.indexOf(id); } - update(id: number | Interceptor, fn: Interceptor): number | Interceptor | false { - const index = this.getInterceptorIndex(id) + update( + id: number | Interceptor, + fn: Interceptor, + ): number | Interceptor | false { + const index = this.getInterceptorIndex(id); if (this.fns[index]) { - this.fns[index] = fn - return id + this.fns[index] = fn; + return id; } - return false + return false; } use(fn: Interceptor): number { - this.fns.push(fn) - return this.fns.length - 1 + this.fns.push(fn); + return this.fns.length - 1; } } export interface Middleware { - error: Interceptors> - request: Interceptors> - response: Interceptors> + error: Interceptors>; + request: Interceptors>; + response: Interceptors>; } -export const createInterceptors = (): Middleware => ({ +export const createInterceptors = (): Middleware< + Req, + Res, + Err, + Options +> => ({ error: new Interceptors>(), request: new Interceptors>(), response: new Interceptors>(), -}) +}); const defaultQuerySerializer = createQuerySerializer({ allowReserved: false, array: { explode: true, - style: "form", + style: 'form', }, object: { explode: true, - style: "deepObject", + style: 'deepObject', }, -}) +}); const defaultHeaders = { - "Content-Type": "application/json", -} + 'Content-Type': 'application/json', +}; export const createConfig = ( override: Config & T> = {}, ): Config & T> => ({ ...jsonBodySerializer, headers: defaultHeaders, - parseAs: "auto", + parseAs: 'auto', querySerializer: defaultQuerySerializer, ...override, -}) +}); diff --git a/packages/sdk/js/src/v2/gen/core/auth.gen.ts b/packages/sdk/js/src/v2/gen/core/auth.gen.ts index bc7b230f447..f8a73266f93 100644 --- a/packages/sdk/js/src/v2/gen/core/auth.gen.ts +++ b/packages/sdk/js/src/v2/gen/core/auth.gen.ts @@ -1,6 +1,6 @@ // This file is auto-generated by @hey-api/openapi-ts -export type AuthToken = string | undefined +export type AuthToken = string | undefined; export interface Auth { /** @@ -8,34 +8,35 @@ export interface Auth { * * @default 'header' */ - in?: "header" | "query" | "cookie" + in?: 'header' | 'query' | 'cookie'; /** * Header or query parameter name. * * @default 'Authorization' */ - name?: string - scheme?: "basic" | "bearer" - type: "apiKey" | "http" + name?: string; + scheme?: 'basic' | 'bearer'; + type: 'apiKey' | 'http'; } export const getAuthToken = async ( auth: Auth, callback: ((auth: Auth) => Promise | AuthToken) | AuthToken, ): Promise => { - const token = typeof callback === "function" ? await callback(auth) : callback + const token = + typeof callback === 'function' ? await callback(auth) : callback; if (!token) { - return + return; } - if (auth.scheme === "bearer") { - return `Bearer ${token}` + if (auth.scheme === 'bearer') { + return `Bearer ${token}`; } - if (auth.scheme === "basic") { - return `Basic ${btoa(token)}` + if (auth.scheme === 'basic') { + return `Basic ${btoa(token)}`; } - return token -} + return token; +}; diff --git a/packages/sdk/js/src/v2/gen/core/bodySerializer.gen.ts b/packages/sdk/js/src/v2/gen/core/bodySerializer.gen.ts index 9678fb08ec6..886b401aefe 100644 --- a/packages/sdk/js/src/v2/gen/core/bodySerializer.gen.ts +++ b/packages/sdk/js/src/v2/gen/core/bodySerializer.gen.ts @@ -1,82 +1,100 @@ // This file is auto-generated by @hey-api/openapi-ts -import type { ArrayStyle, ObjectStyle, SerializerOptions } from "./pathSerializer.gen.js" +import type { + ArrayStyle, + ObjectStyle, + SerializerOptions, +} from './pathSerializer.gen.js'; -export type QuerySerializer = (query: Record) => string +export type QuerySerializer = (query: Record) => string; -export type BodySerializer = (body: any) => any +export type BodySerializer = (body: any) => any; type QuerySerializerOptionsObject = { - allowReserved?: boolean - array?: Partial> - object?: Partial> -} + allowReserved?: boolean; + array?: Partial>; + object?: Partial>; +}; export type QuerySerializerOptions = QuerySerializerOptionsObject & { /** * Per-parameter serialization overrides. When provided, these settings * override the global array/object settings for specific parameter names. */ - parameters?: Record -} + parameters?: Record; +}; -const serializeFormDataPair = (data: FormData, key: string, value: unknown): void => { - if (typeof value === "string" || value instanceof Blob) { - data.append(key, value) +const serializeFormDataPair = ( + data: FormData, + key: string, + value: unknown, +): void => { + if (typeof value === 'string' || value instanceof Blob) { + data.append(key, value); } else if (value instanceof Date) { - data.append(key, value.toISOString()) + data.append(key, value.toISOString()); } else { - data.append(key, JSON.stringify(value)) + data.append(key, JSON.stringify(value)); } -} +}; -const serializeUrlSearchParamsPair = (data: URLSearchParams, key: string, value: unknown): void => { - if (typeof value === "string") { - data.append(key, value) +const serializeUrlSearchParamsPair = ( + data: URLSearchParams, + key: string, + value: unknown, +): void => { + if (typeof value === 'string') { + data.append(key, value); } else { - data.append(key, JSON.stringify(value)) + data.append(key, JSON.stringify(value)); } -} +}; export const formDataBodySerializer = { - bodySerializer: | Array>>(body: T): FormData => { - const data = new FormData() + bodySerializer: | Array>>( + body: T, + ): FormData => { + const data = new FormData(); Object.entries(body).forEach(([key, value]) => { if (value === undefined || value === null) { - return + return; } if (Array.isArray(value)) { - value.forEach((v) => serializeFormDataPair(data, key, v)) + value.forEach((v) => serializeFormDataPair(data, key, v)); } else { - serializeFormDataPair(data, key, value) + serializeFormDataPair(data, key, value); } - }) + }); - return data + return data; }, -} +}; export const jsonBodySerializer = { bodySerializer: (body: T): string => - JSON.stringify(body, (_key, value) => (typeof value === "bigint" ? value.toString() : value)), -} + JSON.stringify(body, (_key, value) => + typeof value === 'bigint' ? value.toString() : value, + ), +}; export const urlSearchParamsBodySerializer = { - bodySerializer: | Array>>(body: T): string => { - const data = new URLSearchParams() + bodySerializer: | Array>>( + body: T, + ): string => { + const data = new URLSearchParams(); Object.entries(body).forEach(([key, value]) => { if (value === undefined || value === null) { - return + return; } if (Array.isArray(value)) { - value.forEach((v) => serializeUrlSearchParamsPair(data, key, v)) + value.forEach((v) => serializeUrlSearchParamsPair(data, key, v)); } else { - serializeUrlSearchParamsPair(data, key, value) + serializeUrlSearchParamsPair(data, key, value); } - }) + }); - return data.toString() + return data.toString(); }, -} +}; diff --git a/packages/sdk/js/src/v2/gen/core/params.gen.ts b/packages/sdk/js/src/v2/gen/core/params.gen.ts index 6e9d0b9add4..602715c46cc 100644 --- a/packages/sdk/js/src/v2/gen/core/params.gen.ts +++ b/packages/sdk/js/src/v2/gen/core/params.gen.ts @@ -1,160 +1,167 @@ // This file is auto-generated by @hey-api/openapi-ts -type Slot = "body" | "headers" | "path" | "query" +type Slot = 'body' | 'headers' | 'path' | 'query'; export type Field = | { - in: Exclude + in: Exclude; /** * Field name. This is the name we want the user to see and use. */ - key: string + key: string; /** * Field mapped name. This is the name we want to use in the request. * If omitted, we use the same value as `key`. */ - map?: string + map?: string; } | { - in: Extract + in: Extract; /** * Key isn't required for bodies. */ - key?: string - map?: string + key?: string; + map?: string; } | { /** * Field name. This is the name we want the user to see and use. */ - key: string + key: string; /** * Field mapped name. This is the name we want to use in the request. * If `in` is omitted, `map` aliases `key` to the transport layer. */ - map: Slot - } + map: Slot; + }; export interface Fields { - allowExtra?: Partial> - args?: ReadonlyArray + allowExtra?: Partial>; + args?: ReadonlyArray; } -export type FieldsConfig = ReadonlyArray +export type FieldsConfig = ReadonlyArray; const extraPrefixesMap: Record = { - $body_: "body", - $headers_: "headers", - $path_: "path", - $query_: "query", -} -const extraPrefixes = Object.entries(extraPrefixesMap) + $body_: 'body', + $headers_: 'headers', + $path_: 'path', + $query_: 'query', +}; +const extraPrefixes = Object.entries(extraPrefixesMap); type KeyMap = Map< string, | { - in: Slot - map?: string + in: Slot; + map?: string; } | { - in?: never - map: Slot + in?: never; + map: Slot; } -> +>; const buildKeyMap = (fields: FieldsConfig, map?: KeyMap): KeyMap => { if (!map) { - map = new Map() + map = new Map(); } for (const config of fields) { - if ("in" in config) { + if ('in' in config) { if (config.key) { map.set(config.key, { in: config.in, map: config.map, - }) + }); } - } else if ("key" in config) { + } else if ('key' in config) { map.set(config.key, { map: config.map, - }) + }); } else if (config.args) { - buildKeyMap(config.args, map) + buildKeyMap(config.args, map); } } - return map -} + return map; +}; interface Params { - body: unknown - headers: Record - path: Record - query: Record + body: unknown; + headers: Record; + path: Record; + query: Record; } const stripEmptySlots = (params: Params) => { for (const [slot, value] of Object.entries(params)) { - if (value && typeof value === "object" && !Object.keys(value).length) { - delete params[slot as Slot] + if (value && typeof value === 'object' && !Object.keys(value).length) { + delete params[slot as Slot]; } } -} +}; -export const buildClientParams = (args: ReadonlyArray, fields: FieldsConfig) => { +export const buildClientParams = ( + args: ReadonlyArray, + fields: FieldsConfig, +) => { const params: Params = { body: {}, headers: {}, path: {}, query: {}, - } + }; - const map = buildKeyMap(fields) + const map = buildKeyMap(fields); - let config: FieldsConfig[number] | undefined + let config: FieldsConfig[number] | undefined; for (const [index, arg] of args.entries()) { if (fields[index]) { - config = fields[index] + config = fields[index]; } if (!config) { - continue + continue; } - if ("in" in config) { + if ('in' in config) { if (config.key) { - const field = map.get(config.key)! - const name = field.map || config.key + const field = map.get(config.key)!; + const name = field.map || config.key; if (field.in) { - ;(params[field.in] as Record)[name] = arg + (params[field.in] as Record)[name] = arg; } } else { - params.body = arg + params.body = arg; } } else { for (const [key, value] of Object.entries(arg ?? {})) { - const field = map.get(key) + const field = map.get(key); if (field) { if (field.in) { - const name = field.map || key - ;(params[field.in] as Record)[name] = value + const name = field.map || key; + (params[field.in] as Record)[name] = value; } else { - params[field.map] = value + params[field.map] = value; } } else { - const extra = extraPrefixes.find(([prefix]) => key.startsWith(prefix)) + const extra = extraPrefixes.find(([prefix]) => + key.startsWith(prefix), + ); if (extra) { - const [prefix, slot] = extra - ;(params[slot] as Record)[key.slice(prefix.length)] = value - } else if ("allowExtra" in config && config.allowExtra) { + const [prefix, slot] = extra; + (params[slot] as Record)[ + key.slice(prefix.length) + ] = value; + } else if ('allowExtra' in config && config.allowExtra) { for (const [slot, allowed] of Object.entries(config.allowExtra)) { if (allowed) { - ;(params[slot as Slot] as Record)[key] = value - break + (params[slot as Slot] as Record)[key] = value; + break; } } } @@ -163,7 +170,7 @@ export const buildClientParams = (args: ReadonlyArray, fields: FieldsCo } } - stripEmptySlots(params) + stripEmptySlots(params); - return params -} + return params; +}; diff --git a/packages/sdk/js/src/v2/gen/core/pathSerializer.gen.ts b/packages/sdk/js/src/v2/gen/core/pathSerializer.gen.ts index 96be3bc5a39..8d999310474 100644 --- a/packages/sdk/js/src/v2/gen/core/pathSerializer.gen.ts +++ b/packages/sdk/js/src/v2/gen/core/pathSerializer.gen.ts @@ -1,68 +1,70 @@ // This file is auto-generated by @hey-api/openapi-ts -interface SerializeOptions extends SerializePrimitiveOptions, SerializerOptions {} +interface SerializeOptions + extends SerializePrimitiveOptions, + SerializerOptions {} interface SerializePrimitiveOptions { - allowReserved?: boolean - name: string + allowReserved?: boolean; + name: string; } export interface SerializerOptions { /** * @default true */ - explode: boolean - style: T + explode: boolean; + style: T; } -export type ArrayStyle = "form" | "spaceDelimited" | "pipeDelimited" -export type ArraySeparatorStyle = ArrayStyle | MatrixStyle -type MatrixStyle = "label" | "matrix" | "simple" -export type ObjectStyle = "form" | "deepObject" -type ObjectSeparatorStyle = ObjectStyle | MatrixStyle +export type ArrayStyle = 'form' | 'spaceDelimited' | 'pipeDelimited'; +export type ArraySeparatorStyle = ArrayStyle | MatrixStyle; +type MatrixStyle = 'label' | 'matrix' | 'simple'; +export type ObjectStyle = 'form' | 'deepObject'; +type ObjectSeparatorStyle = ObjectStyle | MatrixStyle; interface SerializePrimitiveParam extends SerializePrimitiveOptions { - value: string + value: string; } export const separatorArrayExplode = (style: ArraySeparatorStyle) => { switch (style) { - case "label": - return "." - case "matrix": - return ";" - case "simple": - return "," + case 'label': + return '.'; + case 'matrix': + return ';'; + case 'simple': + return ','; default: - return "&" + return '&'; } -} +}; export const separatorArrayNoExplode = (style: ArraySeparatorStyle) => { switch (style) { - case "form": - return "," - case "pipeDelimited": - return "|" - case "spaceDelimited": - return "%20" + case 'form': + return ','; + case 'pipeDelimited': + return '|'; + case 'spaceDelimited': + return '%20'; default: - return "," + return ','; } -} +}; export const separatorObjectExplode = (style: ObjectSeparatorStyle) => { switch (style) { - case "label": - return "." - case "matrix": - return ";" - case "simple": - return "," + case 'label': + return '.'; + case 'matrix': + return ';'; + case 'simple': + return ','; default: - return "&" + return '&'; } -} +}; export const serializeArrayParam = ({ allowReserved, @@ -71,54 +73,60 @@ export const serializeArrayParam = ({ style, value, }: SerializeOptions & { - value: unknown[] + value: unknown[]; }) => { if (!explode) { - const joinedValues = (allowReserved ? value : value.map((v) => encodeURIComponent(v as string))).join( - separatorArrayNoExplode(style), - ) + const joinedValues = ( + allowReserved ? value : value.map((v) => encodeURIComponent(v as string)) + ).join(separatorArrayNoExplode(style)); switch (style) { - case "label": - return `.${joinedValues}` - case "matrix": - return `;${name}=${joinedValues}` - case "simple": - return joinedValues + case 'label': + return `.${joinedValues}`; + case 'matrix': + return `;${name}=${joinedValues}`; + case 'simple': + return joinedValues; default: - return `${name}=${joinedValues}` + return `${name}=${joinedValues}`; } } - const separator = separatorArrayExplode(style) + const separator = separatorArrayExplode(style); const joinedValues = value .map((v) => { - if (style === "label" || style === "simple") { - return allowReserved ? v : encodeURIComponent(v as string) + if (style === 'label' || style === 'simple') { + return allowReserved ? v : encodeURIComponent(v as string); } return serializePrimitiveParam({ allowReserved, name, value: v as string, - }) + }); }) - .join(separator) - return style === "label" || style === "matrix" ? separator + joinedValues : joinedValues -} + .join(separator); + return style === 'label' || style === 'matrix' + ? separator + joinedValues + : joinedValues; +}; -export const serializePrimitiveParam = ({ allowReserved, name, value }: SerializePrimitiveParam) => { +export const serializePrimitiveParam = ({ + allowReserved, + name, + value, +}: SerializePrimitiveParam) => { if (value === undefined || value === null) { - return "" + return ''; } - if (typeof value === "object") { + if (typeof value === 'object') { throw new Error( - "Deeply-nested arrays/objects aren’t supported. Provide your own `querySerializer()` to handle these.", - ) + 'Deeply-nested arrays/objects aren’t supported. Provide your own `querySerializer()` to handle these.', + ); } - return `${name}=${allowReserved ? value : encodeURIComponent(value)}` -} + return `${name}=${allowReserved ? value : encodeURIComponent(value)}`; +}; export const serializeObjectParam = ({ allowReserved, @@ -128,40 +136,46 @@ export const serializeObjectParam = ({ value, valueOnly, }: SerializeOptions & { - value: Record | Date - valueOnly?: boolean + value: Record | Date; + valueOnly?: boolean; }) => { if (value instanceof Date) { - return valueOnly ? value.toISOString() : `${name}=${value.toISOString()}` + return valueOnly ? value.toISOString() : `${name}=${value.toISOString()}`; } - if (style !== "deepObject" && !explode) { - let values: string[] = [] + if (style !== 'deepObject' && !explode) { + let values: string[] = []; Object.entries(value).forEach(([key, v]) => { - values = [...values, key, allowReserved ? (v as string) : encodeURIComponent(v as string)] - }) - const joinedValues = values.join(",") + values = [ + ...values, + key, + allowReserved ? (v as string) : encodeURIComponent(v as string), + ]; + }); + const joinedValues = values.join(','); switch (style) { - case "form": - return `${name}=${joinedValues}` - case "label": - return `.${joinedValues}` - case "matrix": - return `;${name}=${joinedValues}` + case 'form': + return `${name}=${joinedValues}`; + case 'label': + return `.${joinedValues}`; + case 'matrix': + return `;${name}=${joinedValues}`; default: - return joinedValues + return joinedValues; } } - const separator = separatorObjectExplode(style) + const separator = separatorObjectExplode(style); const joinedValues = Object.entries(value) .map(([key, v]) => serializePrimitiveParam({ allowReserved, - name: style === "deepObject" ? `${name}[${key}]` : key, + name: style === 'deepObject' ? `${name}[${key}]` : key, value: v as string, }), ) - .join(separator) - return style === "label" || style === "matrix" ? separator + joinedValues : joinedValues -} + .join(separator); + return style === 'label' || style === 'matrix' + ? separator + joinedValues + : joinedValues; +}; diff --git a/packages/sdk/js/src/v2/gen/core/queryKeySerializer.gen.ts b/packages/sdk/js/src/v2/gen/core/queryKeySerializer.gen.ts index 320204aef10..d3bb68396e9 100644 --- a/packages/sdk/js/src/v2/gen/core/queryKeySerializer.gen.ts +++ b/packages/sdk/js/src/v2/gen/core/queryKeySerializer.gen.ts @@ -3,109 +3,134 @@ /** * JSON-friendly union that mirrors what Pinia Colada can hash. */ -export type JsonValue = null | string | number | boolean | JsonValue[] | { [key: string]: JsonValue } +export type JsonValue = + | null + | string + | number + | boolean + | JsonValue[] + | { [key: string]: JsonValue }; /** * Replacer that converts non-JSON values (bigint, Date, etc.) to safe substitutes. */ export const queryKeyJsonReplacer = (_key: string, value: unknown) => { - if (value === undefined || typeof value === "function" || typeof value === "symbol") { - return undefined + if ( + value === undefined || + typeof value === 'function' || + typeof value === 'symbol' + ) { + return undefined; } - if (typeof value === "bigint") { - return value.toString() + if (typeof value === 'bigint') { + return value.toString(); } if (value instanceof Date) { - return value.toISOString() + return value.toISOString(); } - return value -} + return value; +}; /** * Safely stringifies a value and parses it back into a JsonValue. */ export const stringifyToJsonValue = (input: unknown): JsonValue | undefined => { try { - const json = JSON.stringify(input, queryKeyJsonReplacer) + const json = JSON.stringify(input, queryKeyJsonReplacer); if (json === undefined) { - return undefined + return undefined; } - return JSON.parse(json) as JsonValue + return JSON.parse(json) as JsonValue; } catch { - return undefined + return undefined; } -} +}; /** * Detects plain objects (including objects with a null prototype). */ const isPlainObject = (value: unknown): value is Record => { - if (value === null || typeof value !== "object") { - return false + if (value === null || typeof value !== 'object') { + return false; } - const prototype = Object.getPrototypeOf(value as object) - return prototype === Object.prototype || prototype === null -} + const prototype = Object.getPrototypeOf(value as object); + return prototype === Object.prototype || prototype === null; +}; /** * Turns URLSearchParams into a sorted JSON object for deterministic keys. */ const serializeSearchParams = (params: URLSearchParams): JsonValue => { - const entries = Array.from(params.entries()).sort(([a], [b]) => a.localeCompare(b)) - const result: Record = {} + const entries = Array.from(params.entries()).sort(([a], [b]) => + a.localeCompare(b), + ); + const result: Record = {}; for (const [key, value] of entries) { - const existing = result[key] + const existing = result[key]; if (existing === undefined) { - result[key] = value - continue + result[key] = value; + continue; } if (Array.isArray(existing)) { - ;(existing as string[]).push(value) + (existing as string[]).push(value); } else { - result[key] = [existing, value] + result[key] = [existing, value]; } } - return result -} + return result; +}; /** * Normalizes any accepted value into a JSON-friendly shape for query keys. */ -export const serializeQueryKeyValue = (value: unknown): JsonValue | undefined => { +export const serializeQueryKeyValue = ( + value: unknown, +): JsonValue | undefined => { if (value === null) { - return null + return null; } - if (typeof value === "string" || typeof value === "number" || typeof value === "boolean") { - return value + if ( + typeof value === 'string' || + typeof value === 'number' || + typeof value === 'boolean' + ) { + return value; } - if (value === undefined || typeof value === "function" || typeof value === "symbol") { - return undefined + if ( + value === undefined || + typeof value === 'function' || + typeof value === 'symbol' + ) { + return undefined; } - if (typeof value === "bigint") { - return value.toString() + if (typeof value === 'bigint') { + return value.toString(); } if (value instanceof Date) { - return value.toISOString() + return value.toISOString(); } if (Array.isArray(value)) { - return stringifyToJsonValue(value) + return stringifyToJsonValue(value); } - if (typeof URLSearchParams !== "undefined" && value instanceof URLSearchParams) { - return serializeSearchParams(value) + if ( + typeof URLSearchParams !== 'undefined' && + value instanceof URLSearchParams + ) { + return serializeSearchParams(value); } if (isPlainObject(value)) { - return stringifyToJsonValue(value) + return stringifyToJsonValue(value); } - return undefined -} + return undefined; +}; diff --git a/packages/sdk/js/src/v2/gen/core/serverSentEvents.gen.ts b/packages/sdk/js/src/v2/gen/core/serverSentEvents.gen.ts index 09ef3fb3936..d73aa0f30c4 100644 --- a/packages/sdk/js/src/v2/gen/core/serverSentEvents.gen.ts +++ b/packages/sdk/js/src/v2/gen/core/serverSentEvents.gen.ts @@ -1,20 +1,23 @@ // This file is auto-generated by @hey-api/openapi-ts -import type { Config } from "./types.gen.js" +import type { Config } from './types.gen.js'; -export type ServerSentEventsOptions = Omit & - Pick & { +export type ServerSentEventsOptions = Omit< + RequestInit, + 'method' +> & + Pick & { /** * Fetch API implementation. You can use this option to provide a custom * fetch instance. * * @default globalThis.fetch */ - fetch?: typeof fetch + fetch?: typeof fetch; /** * Implementing clients can call request interceptors inside this hook. */ - onRequest?: (url: string, init: RequestInit) => Promise + onRequest?: (url: string, init: RequestInit) => Promise; /** * Callback invoked when a network or parsing error occurs during streaming. * @@ -22,7 +25,7 @@ export type ServerSentEventsOptions = Omit void + onSseError?: (error: unknown) => void; /** * Callback invoked when an event is streamed from the server. * @@ -31,8 +34,8 @@ export type ServerSentEventsOptions = Omit) => void - serializedBody?: RequestInit["body"] + onSseEvent?: (event: StreamEvent) => void; + serializedBody?: RequestInit['body']; /** * Default retry delay in milliseconds. * @@ -40,11 +43,11 @@ export type ServerSentEventsOptions = Omit = Omit Promise - url: string - } + sseSleepFn?: (ms: number) => Promise; + url: string; + }; export interface StreamEvent { - data: TData - event?: string - id?: string - retry?: number + data: TData; + event?: string; + id?: string; + retry?: number; } -export type ServerSentEventsResult = { - stream: AsyncGenerator ? TData[keyof TData] : TData, TReturn, TNext> -} +export type ServerSentEventsResult< + TData = unknown, + TReturn = void, + TNext = unknown, +> = { + stream: AsyncGenerator< + TData extends Record ? TData[keyof TData] : TData, + TReturn, + TNext + >; +}; export const createSseClient = ({ onRequest, @@ -88,113 +99,123 @@ export const createSseClient = ({ url, ...options }: ServerSentEventsOptions): ServerSentEventsResult => { - let lastEventId: string | undefined + let lastEventId: string | undefined; - const sleep = sseSleepFn ?? ((ms: number) => new Promise((resolve) => setTimeout(resolve, ms))) + const sleep = + sseSleepFn ?? + ((ms: number) => new Promise((resolve) => setTimeout(resolve, ms))); const createStream = async function* () { - let retryDelay: number = sseDefaultRetryDelay ?? 3000 - let attempt = 0 - const signal = options.signal ?? new AbortController().signal + let retryDelay: number = sseDefaultRetryDelay ?? 3000; + let attempt = 0; + const signal = options.signal ?? new AbortController().signal; while (true) { - if (signal.aborted) break + if (signal.aborted) break; - attempt++ + attempt++; const headers = options.headers instanceof Headers ? options.headers - : new Headers(options.headers as Record | undefined) + : new Headers(options.headers as Record | undefined); if (lastEventId !== undefined) { - headers.set("Last-Event-ID", lastEventId) + headers.set('Last-Event-ID', lastEventId); } try { const requestInit: RequestInit = { - redirect: "follow", + redirect: 'follow', ...options, body: options.serializedBody, headers, signal, - } - let request = new Request(url, requestInit) + }; + let request = new Request(url, requestInit); if (onRequest) { - request = await onRequest(url, requestInit) + request = await onRequest(url, requestInit); } // fetch must be assigned here, otherwise it would throw the error: // TypeError: Failed to execute 'fetch' on 'Window': Illegal invocation - const _fetch = options.fetch ?? globalThis.fetch - const response = await _fetch(request) + const _fetch = options.fetch ?? globalThis.fetch; + const response = await _fetch(request); - if (!response.ok) throw new Error(`SSE failed: ${response.status} ${response.statusText}`) + if (!response.ok) + throw new Error( + `SSE failed: ${response.status} ${response.statusText}`, + ); - if (!response.body) throw new Error("No body in SSE response") + if (!response.body) throw new Error('No body in SSE response'); - const reader = response.body.pipeThrough(new TextDecoderStream()).getReader() + const reader = response.body + .pipeThrough(new TextDecoderStream()) + .getReader(); - let buffer = "" + let buffer = ''; const abortHandler = () => { try { - reader.cancel() + reader.cancel(); } catch { // noop } - } + }; - signal.addEventListener("abort", abortHandler) + signal.addEventListener('abort', abortHandler); try { while (true) { - const { done, value } = await reader.read() - if (done) break - buffer += value + const { done, value } = await reader.read(); + if (done) break; + buffer += value; - const chunks = buffer.split("\n\n") - buffer = chunks.pop() ?? "" + const chunks = buffer.split('\n\n'); + buffer = chunks.pop() ?? ''; for (const chunk of chunks) { - const lines = chunk.split("\n") - const dataLines: Array = [] - let eventName: string | undefined + const lines = chunk.split('\n'); + const dataLines: Array = []; + let eventName: string | undefined; for (const line of lines) { - if (line.startsWith("data:")) { - dataLines.push(line.replace(/^data:\s*/, "")) - } else if (line.startsWith("event:")) { - eventName = line.replace(/^event:\s*/, "") - } else if (line.startsWith("id:")) { - lastEventId = line.replace(/^id:\s*/, "") - } else if (line.startsWith("retry:")) { - const parsed = Number.parseInt(line.replace(/^retry:\s*/, ""), 10) + if (line.startsWith('data:')) { + dataLines.push(line.replace(/^data:\s*/, '')); + } else if (line.startsWith('event:')) { + eventName = line.replace(/^event:\s*/, ''); + } else if (line.startsWith('id:')) { + lastEventId = line.replace(/^id:\s*/, ''); + } else if (line.startsWith('retry:')) { + const parsed = Number.parseInt( + line.replace(/^retry:\s*/, ''), + 10, + ); if (!Number.isNaN(parsed)) { - retryDelay = parsed + retryDelay = parsed; } } } - let data: unknown - let parsedJson = false + let data: unknown; + let parsedJson = false; if (dataLines.length) { - const rawData = dataLines.join("\n") + const rawData = dataLines.join('\n'); try { - data = JSON.parse(rawData) - parsedJson = true + data = JSON.parse(rawData); + parsedJson = true; } catch { - data = rawData + data = rawData; } } if (parsedJson) { if (responseValidator) { - await responseValidator(data) + await responseValidator(data); } if (responseTransformer) { - data = await responseTransformer(data) + data = await responseTransformer(data); } } @@ -203,35 +224,41 @@ export const createSseClient = ({ event: eventName, id: lastEventId, retry: retryDelay, - }) + }); if (dataLines.length) { - yield data as any + yield data as any; } } } } finally { - signal.removeEventListener("abort", abortHandler) - reader.releaseLock() + signal.removeEventListener('abort', abortHandler); + reader.releaseLock(); } - break // exit loop on normal completion + break; // exit loop on normal completion } catch (error) { // connection failed or aborted; retry after delay - onSseError?.(error) + onSseError?.(error); - if (sseMaxRetryAttempts !== undefined && attempt >= sseMaxRetryAttempts) { - break // stop after firing error + if ( + sseMaxRetryAttempts !== undefined && + attempt >= sseMaxRetryAttempts + ) { + break; // stop after firing error } // exponential backoff: double retry each attempt, cap at 30s - const backoff = Math.min(retryDelay * 2 ** (attempt - 1), sseMaxRetryDelay ?? 30000) - await sleep(backoff) + const backoff = Math.min( + retryDelay * 2 ** (attempt - 1), + sseMaxRetryDelay ?? 30000, + ); + await sleep(backoff); } } - } + }; - const stream = createStream() + const stream = createStream(); - return { stream } -} + return { stream }; +}; diff --git a/packages/sdk/js/src/v2/gen/core/types.gen.ts b/packages/sdk/js/src/v2/gen/core/types.gen.ts index bfa77b8acd2..cc8a9e60fae 100644 --- a/packages/sdk/js/src/v2/gen/core/types.gen.ts +++ b/packages/sdk/js/src/v2/gen/core/types.gen.ts @@ -1,33 +1,54 @@ // This file is auto-generated by @hey-api/openapi-ts -import type { Auth, AuthToken } from "./auth.gen.js" -import type { BodySerializer, QuerySerializer, QuerySerializerOptions } from "./bodySerializer.gen.js" +import type { Auth, AuthToken } from './auth.gen.js'; +import type { + BodySerializer, + QuerySerializer, + QuerySerializerOptions, +} from './bodySerializer.gen.js'; -export type HttpMethod = "connect" | "delete" | "get" | "head" | "options" | "patch" | "post" | "put" | "trace" +export type HttpMethod = + | 'connect' + | 'delete' + | 'get' + | 'head' + | 'options' + | 'patch' + | 'post' + | 'put' + | 'trace'; -export type Client = { +export type Client< + RequestFn = never, + Config = unknown, + MethodFn = never, + BuildUrlFn = never, + SseFn = never, +> = { /** * Returns the final request URL. */ - buildUrl: BuildUrlFn - getConfig: () => Config - request: RequestFn - setConfig: (config: Config) => Config + buildUrl: BuildUrlFn; + getConfig: () => Config; + request: RequestFn; + setConfig: (config: Config) => Config; } & { - [K in HttpMethod]: MethodFn -} & ([SseFn] extends [never] ? { sse?: never } : { sse: { [K in HttpMethod]: SseFn } }) + [K in HttpMethod]: MethodFn; +} & ([SseFn] extends [never] + ? { sse?: never } + : { sse: { [K in HttpMethod]: SseFn } }); export interface Config { /** * Auth token or a function returning auth token. The resolved value will be * added to the request payload as defined by its `security` array. */ - auth?: ((auth: Auth) => Promise | AuthToken) | AuthToken + auth?: ((auth: Auth) => Promise | AuthToken) | AuthToken; /** * A function for serializing request body parameter. By default, * {@link JSON.stringify()} will be used. */ - bodySerializer?: BodySerializer | null + bodySerializer?: BodySerializer | null; /** * An object containing any HTTP headers that you want to pre-populate your * `Headers` object with. @@ -35,14 +56,23 @@ export interface Config { * {@link https://developer.mozilla.org/docs/Web/API/Headers/Headers#init See more} */ headers?: - | RequestInit["headers"] - | Record + | RequestInit['headers'] + | Record< + string, + | string + | number + | boolean + | (string | number | boolean)[] + | null + | undefined + | unknown + >; /** * The request method. * * {@link https://developer.mozilla.org/docs/Web/API/fetch#method See more} */ - method?: Uppercase + method?: Uppercase; /** * A function for serializing request query parameters. By default, arrays * will be exploded in form style, objects will be exploded in deepObject @@ -53,24 +83,24 @@ export interface Config { * * {@link https://swagger.io/docs/specification/serialization/#query View examples} */ - querySerializer?: QuerySerializer | QuerySerializerOptions + querySerializer?: QuerySerializer | QuerySerializerOptions; /** * A function validating request data. This is useful if you want to ensure * the request conforms to the desired shape, so it can be safely sent to * the server. */ - requestValidator?: (data: unknown) => Promise + requestValidator?: (data: unknown) => Promise; /** * A function transforming response data before it's returned. This is useful * for post-processing data, e.g. converting ISO strings into Date objects. */ - responseTransformer?: (data: unknown) => Promise + responseTransformer?: (data: unknown) => Promise; /** * A function validating response data. This is useful if you want to ensure * the response conforms to the desired shape, so it can be safely passed to * the transformers and returned to the user. */ - responseValidator?: (data: unknown) => Promise + responseValidator?: (data: unknown) => Promise; } type IsExactlyNeverOrNeverUndefined = [T] extends [never] @@ -79,8 +109,10 @@ type IsExactlyNeverOrNeverUndefined = [T] extends [never] ? [undefined] extends [T] ? false : true - : false + : false; export type OmitNever> = { - [K in keyof T as IsExactlyNeverOrNeverUndefined extends true ? never : K]: T[K] -} + [K in keyof T as IsExactlyNeverOrNeverUndefined extends true + ? never + : K]: T[K]; +}; diff --git a/packages/sdk/js/src/v2/gen/core/utils.gen.ts b/packages/sdk/js/src/v2/gen/core/utils.gen.ts index 8a45f72698a..3029f7b3cc0 100644 --- a/packages/sdk/js/src/v2/gen/core/utils.gen.ts +++ b/packages/sdk/js/src/v2/gen/core/utils.gen.ts @@ -1,54 +1,57 @@ // This file is auto-generated by @hey-api/openapi-ts -import type { BodySerializer, QuerySerializer } from "./bodySerializer.gen.js" +import type { BodySerializer, QuerySerializer } from './bodySerializer.gen.js'; import { type ArraySeparatorStyle, serializeArrayParam, serializeObjectParam, serializePrimitiveParam, -} from "./pathSerializer.gen.js" +} from './pathSerializer.gen.js'; export interface PathSerializer { - path: Record - url: string + path: Record; + url: string; } -export const PATH_PARAM_RE = /\{[^{}]+\}/g +export const PATH_PARAM_RE = /\{[^{}]+\}/g; export const defaultPathSerializer = ({ path, url: _url }: PathSerializer) => { - let url = _url - const matches = _url.match(PATH_PARAM_RE) + let url = _url; + const matches = _url.match(PATH_PARAM_RE); if (matches) { for (const match of matches) { - let explode = false - let name = match.substring(1, match.length - 1) - let style: ArraySeparatorStyle = "simple" + let explode = false; + let name = match.substring(1, match.length - 1); + let style: ArraySeparatorStyle = 'simple'; - if (name.endsWith("*")) { - explode = true - name = name.substring(0, name.length - 1) + if (name.endsWith('*')) { + explode = true; + name = name.substring(0, name.length - 1); } - if (name.startsWith(".")) { - name = name.substring(1) - style = "label" - } else if (name.startsWith(";")) { - name = name.substring(1) - style = "matrix" + if (name.startsWith('.')) { + name = name.substring(1); + style = 'label'; + } else if (name.startsWith(';')) { + name = name.substring(1); + style = 'matrix'; } - const value = path[name] + const value = path[name]; if (value === undefined || value === null) { - continue + continue; } if (Array.isArray(value)) { - url = url.replace(match, serializeArrayParam({ explode, name, style, value })) - continue + url = url.replace( + match, + serializeArrayParam({ explode, name, style, value }), + ); + continue; } - if (typeof value === "object") { + if (typeof value === 'object') { url = url.replace( match, serializeObjectParam({ @@ -58,27 +61,29 @@ export const defaultPathSerializer = ({ path, url: _url }: PathSerializer) => { value: value as Record, valueOnly: true, }), - ) - continue + ); + continue; } - if (style === "matrix") { + if (style === 'matrix') { url = url.replace( match, `;${serializePrimitiveParam({ name, value: value as string, })}`, - ) - continue + ); + continue; } - const replaceValue = encodeURIComponent(style === "label" ? `.${value as string}` : (value as string)) - url = url.replace(match, replaceValue) + const replaceValue = encodeURIComponent( + style === 'label' ? `.${value as string}` : (value as string), + ); + url = url.replace(match, replaceValue); } } - return url -} + return url; +}; export const getUrl = ({ baseUrl, @@ -87,51 +92,52 @@ export const getUrl = ({ querySerializer, url: _url, }: { - baseUrl?: string - path?: Record - query?: Record - querySerializer: QuerySerializer - url: string + baseUrl?: string; + path?: Record; + query?: Record; + querySerializer: QuerySerializer; + url: string; }) => { - const pathUrl = _url.startsWith("/") ? _url : `/${_url}` - let url = (baseUrl ?? "") + pathUrl + const pathUrl = _url.startsWith('/') ? _url : `/${_url}`; + let url = (baseUrl ?? '') + pathUrl; if (path) { - url = defaultPathSerializer({ path, url }) + url = defaultPathSerializer({ path, url }); } - let search = query ? querySerializer(query) : "" - if (search.startsWith("?")) { - search = search.substring(1) + let search = query ? querySerializer(query) : ''; + if (search.startsWith('?')) { + search = search.substring(1); } if (search) { - url += `?${search}` + url += `?${search}`; } - return url -} + return url; +}; export function getValidRequestBody(options: { - body?: unknown - bodySerializer?: BodySerializer | null - serializedBody?: unknown + body?: unknown; + bodySerializer?: BodySerializer | null; + serializedBody?: unknown; }) { - const hasBody = options.body !== undefined - const isSerializedBody = hasBody && options.bodySerializer + const hasBody = options.body !== undefined; + const isSerializedBody = hasBody && options.bodySerializer; if (isSerializedBody) { - if ("serializedBody" in options) { - const hasSerializedBody = options.serializedBody !== undefined && options.serializedBody !== "" + if ('serializedBody' in options) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; - return hasSerializedBody ? options.serializedBody : null + return hasSerializedBody ? options.serializedBody : null; } // not all clients implement a serializedBody property (i.e. client-axios) - return options.body !== "" ? options.body : null + return options.body !== '' ? options.body : null; } // plain/text body if (hasBody) { - return options.body + return options.body; } // no body was provided - return undefined + return undefined; } diff --git a/packages/sdk/js/src/v2/gen/sdk.gen.ts b/packages/sdk/js/src/v2/gen/sdk.gen.ts index dae865a7cfc..7ad5ec054b7 100644 --- a/packages/sdk/js/src/v2/gen/sdk.gen.ts +++ b/packages/sdk/js/src/v2/gen/sdk.gen.ts @@ -1,3033 +1,2113 @@ // This file is auto-generated by @hey-api/openapi-ts -import { client } from "./client.gen.js" -import { buildClientParams, type Client, type Options as Options2, type TDataShape } from "./client/index.js" -import type { - AgentPartInput, - AppAgentsResponses, - AppLogErrors, - AppLogResponses, - Auth as Auth2, - AuthSetErrors, - AuthSetResponses, - CommandListResponses, - Config as Config2, - ConfigGetResponses, - ConfigProvidersResponses, - ConfigUpdateErrors, - ConfigUpdateResponses, - EventSubscribeResponses, - EventTuiCommandExecute, - EventTuiPromptAppend, - EventTuiSessionSelect, - EventTuiToastShow, - ExperimentalResourceListResponses, - FileListResponses, - FilePartInput, - FilePartSource, - FileReadResponses, - FileStatusResponses, - FindFilesResponses, - FindSymbolsResponses, - FindTextResponses, - FormatterStatusResponses, - GlobalDisposeResponses, - GlobalEventResponses, - GlobalHealthResponses, - InstanceDisposeResponses, - LspStatusResponses, - McpAddErrors, - McpAddResponses, - McpAuthAuthenticateErrors, - McpAuthAuthenticateResponses, - McpAuthCallbackErrors, - McpAuthCallbackResponses, - McpAuthRemoveErrors, - McpAuthRemoveResponses, - McpAuthStartErrors, - McpAuthStartResponses, - McpConnectResponses, - McpDisconnectResponses, - McpLocalConfig, - McpRemoteConfig, - McpStatusResponses, - Part as Part2, - PartDeleteErrors, - PartDeleteResponses, - PartUpdateErrors, - PartUpdateResponses, - PathGetResponses, - PermissionListResponses, - PermissionReplyErrors, - PermissionReplyResponses, - PermissionRespondErrors, - PermissionRespondResponses, - PermissionRuleset, - ProjectCurrentResponses, - ProjectListResponses, - ProjectUpdateErrors, - ProjectUpdateResponses, - ProviderAuthResponses, - ProviderListResponses, - ProviderOauthAuthorizeErrors, - ProviderOauthAuthorizeResponses, - ProviderOauthCallbackErrors, - ProviderOauthCallbackResponses, - PtyConnectErrors, - PtyConnectResponses, - PtyCreateErrors, - PtyCreateResponses, - PtyGetErrors, - PtyGetResponses, - PtyListResponses, - PtyRemoveErrors, - PtyRemoveResponses, - PtyUpdateErrors, - PtyUpdateResponses, - QuestionListResponses, - QuestionRejectErrors, - QuestionRejectResponses, - QuestionReplyErrors, - QuestionReplyResponses, - SessionAbortErrors, - SessionAbortResponses, - SessionChildrenErrors, - SessionChildrenResponses, - SessionCommandErrors, - SessionCommandResponses, - SessionCreateErrors, - SessionCreateResponses, - SessionDeleteErrors, - SessionDeleteResponses, - SessionDiffErrors, - SessionDiffResponses, - SessionForkResponses, - SessionGetErrors, - SessionGetResponses, - SessionInitErrors, - SessionInitResponses, - SessionListResponses, - SessionMessageErrors, - SessionMessageResponses, - SessionMessagesErrors, - SessionMessagesResponses, - SessionPromptAsyncErrors, - SessionPromptAsyncResponses, - SessionPromptErrors, - SessionPromptResponses, - SessionRevertErrors, - SessionRevertResponses, - SessionShareErrors, - SessionShareResponses, - SessionShellErrors, - SessionShellResponses, - SessionStatusErrors, - SessionStatusResponses, - SessionSummarizeErrors, - SessionSummarizeResponses, - SessionTodoErrors, - SessionTodoResponses, - SessionUnrevertErrors, - SessionUnrevertResponses, - SessionUnshareErrors, - SessionUnshareResponses, - SessionUpdateErrors, - SessionUpdateResponses, - SubtaskPartInput, - TextPartInput, - ToolIdsErrors, - ToolIdsResponses, - ToolListErrors, - ToolListResponses, - TuiAppendPromptErrors, - TuiAppendPromptResponses, - TuiClearPromptResponses, - TuiControlNextResponses, - TuiControlResponseResponses, - TuiExecuteCommandErrors, - TuiExecuteCommandResponses, - TuiOpenHelpResponses, - TuiOpenModelsResponses, - TuiOpenSessionsResponses, - TuiOpenThemesResponses, - TuiPublishErrors, - TuiPublishResponses, - TuiSelectSessionErrors, - TuiSelectSessionResponses, - TuiShowToastResponses, - TuiSubmitPromptResponses, - VcsGetResponses, - WorktreeCreateErrors, - WorktreeCreateInput, - WorktreeCreateResponses, - WorktreeListResponses, -} from "./types.gen.js" +import { client } from './client.gen.js'; +import { buildClientParams, type Client, type Options as Options2, type TDataShape } from './client/index.js'; +import type { AgentPartInput, AppAgentsResponses, AppLogErrors, AppLogResponses, Auth as Auth2, AuthSetErrors, AuthSetResponses, CommandListResponses, Config as Config2, ConfigGetResponses, ConfigProvidersResponses, ConfigUpdateErrors, ConfigUpdateResponses, EventSubscribeResponses, EventTuiCommandExecute, EventTuiPromptAppend, EventTuiSessionSelect, EventTuiToastShow, ExperimentalResourceListResponses, FileListResponses, FilePartInput, FilePartSource, FileReadResponses, FileStatusResponses, FindFilesResponses, FindSymbolsResponses, FindTextResponses, FormatterStatusResponses, GlobalDisposeResponses, GlobalEventResponses, GlobalHealthResponses, InstanceDisposeResponses, LspStatusResponses, McpAddErrors, McpAddResponses, McpAuthAuthenticateErrors, McpAuthAuthenticateResponses, McpAuthCallbackErrors, McpAuthCallbackResponses, McpAuthRemoveErrors, McpAuthRemoveResponses, McpAuthStartErrors, McpAuthStartResponses, McpConnectResponses, McpDisconnectResponses, McpLocalConfig, McpRemoteConfig, McpStatusResponses, Part as Part2, PartDeleteErrors, PartDeleteResponses, PartUpdateErrors, PartUpdateResponses, PathGetResponses, PermissionListResponses, PermissionReplyErrors, PermissionReplyResponses, PermissionRespondErrors, PermissionRespondResponses, PermissionRuleset, ProjectCurrentResponses, ProjectListResponses, ProjectUpdateErrors, ProjectUpdateResponses, ProviderAuthResponses, ProviderListResponses, ProviderOauthAuthorizeErrors, ProviderOauthAuthorizeResponses, ProviderOauthCallbackErrors, ProviderOauthCallbackResponses, PtyConnectErrors, PtyConnectResponses, PtyCreateErrors, PtyCreateResponses, PtyGetErrors, PtyGetResponses, PtyListResponses, PtyRemoveErrors, PtyRemoveResponses, PtyUpdateErrors, PtyUpdateResponses, QuestionListResponses, QuestionRejectErrors, QuestionRejectResponses, QuestionReplyErrors, QuestionReplyResponses, SessionAbortErrors, SessionAbortResponses, SessionChildrenErrors, SessionChildrenResponses, SessionCommandErrors, SessionCommandResponses, SessionCreateErrors, SessionCreateResponses, SessionDeleteErrors, SessionDeleteResponses, SessionDiffErrors, SessionDiffResponses, SessionForkResponses, SessionGetErrors, SessionGetResponses, SessionInitErrors, SessionInitResponses, SessionListResponses, SessionMessageErrors, SessionMessageResponses, SessionMessagesErrors, SessionMessagesResponses, SessionPromptAsyncErrors, SessionPromptAsyncResponses, SessionPromptErrors, SessionPromptResponses, SessionRevertErrors, SessionRevertResponses, SessionShareErrors, SessionShareResponses, SessionShellErrors, SessionShellResponses, SessionStatusErrors, SessionStatusResponses, SessionSummarizeErrors, SessionSummarizeResponses, SessionTodoErrors, SessionTodoResponses, SessionUnrevertErrors, SessionUnrevertResponses, SessionUnshareErrors, SessionUnshareResponses, SessionUpdateErrors, SessionUpdateResponses, SubtaskPartInput, TextPartInput, ToolIdsErrors, ToolIdsResponses, ToolListErrors, ToolListResponses, TuiAppendPromptErrors, TuiAppendPromptResponses, TuiClearPromptResponses, TuiControlNextResponses, TuiControlResponseResponses, TuiExecuteCommandErrors, TuiExecuteCommandResponses, TuiOpenHelpResponses, TuiOpenModelsResponses, TuiOpenSessionsResponses, TuiOpenThemesResponses, TuiPublishErrors, TuiPublishResponses, TuiSelectSessionErrors, TuiSelectSessionResponses, TuiShowToastResponses, TuiSubmitPromptResponses, VcsGetResponses, WorktreeCreateErrors, WorktreeCreateInput, WorktreeCreateResponses, WorktreeListResponses } from './types.gen.js'; -export type Options = Options2< - TData, - ThrowOnError -> & { - /** - * You can provide a client instance returned by `createClient()` instead of - * individual options. This might be also useful if you want to implement a - * custom client. - */ - client?: Client - /** - * You can pass arbitrary values through the `meta` object. This can be - * used to access values that aren't defined as part of the SDK function. - */ - meta?: Record -} +export type Options = Options2 & { + /** + * You can provide a client instance returned by `createClient()` instead of + * individual options. This might be also useful if you want to implement a + * custom client. + */ + client?: Client; + /** + * You can pass arbitrary values through the `meta` object. This can be + * used to access values that aren't defined as part of the SDK function. + */ + meta?: Record; +}; class HeyApiClient { - protected client: Client - - constructor(args?: { client?: Client }) { - this.client = args?.client ?? client - } + protected client: Client; + + constructor(args?: { + client?: Client; + }) { + this.client = args?.client ?? client; + } } class HeyApiRegistry { - private readonly defaultKey = "default" - - private readonly instances: Map = new Map() - - get(key?: string): T { - const instance = this.instances.get(key ?? this.defaultKey) - if (!instance) { - throw new Error(`No SDK client found. Create one with "new OpencodeClient()" to fix this error.`) + private readonly defaultKey = 'default'; + + private readonly instances: Map = new Map(); + + get(key?: string): T { + const instance = this.instances.get(key ?? this.defaultKey); + if (!instance) { + throw new Error(`No SDK client found. Create one with "new OpencodeClient()" to fix this error.`); + } + return instance; + } + + set(value: T, key?: string): void { + this.instances.set(key ?? this.defaultKey, value); } - return instance - } - - set(value: T, key?: string): void { - this.instances.set(key ?? this.defaultKey, value) - } } export class Global extends HeyApiClient { - /** - * Get health - * - * Get health information about the OpenCode server. - */ - public health(options?: Options) { - return (options?.client ?? this.client).get({ - url: "/global/health", - ...options, - }) - } - - /** - * Get global events - * - * Subscribe to global events from the OpenCode system using server-sent events. - */ - public event(options?: Options) { - return (options?.client ?? this.client).sse.get({ - url: "/global/event", - ...options, - }) - } - - /** - * Dispose instance - * - * Clean up and dispose all OpenCode instances, releasing all resources. - */ - public dispose(options?: Options) { - return (options?.client ?? this.client).post({ - url: "/global/dispose", - ...options, - }) - } + /** + * Get health + * + * Get health information about the OpenCode server. + */ + public health(options?: Options) { + return (options?.client ?? this.client).get({ url: '/global/health', ...options }); + } + + /** + * Get global events + * + * Subscribe to global events from the OpenCode system using server-sent events. + */ + public event(options?: Options) { + return (options?.client ?? this.client).sse.get({ url: '/global/event', ...options }); + } + + /** + * Dispose instance + * + * Clean up and dispose all OpenCode instances, releasing all resources. + */ + public dispose(options?: Options) { + return (options?.client ?? this.client).post({ url: '/global/dispose', ...options }); + } } export class Project extends HeyApiClient { - /** - * List all projects - * - * Get a list of projects that have been opened with OpenCode. - */ - public list( - parameters?: { - directory?: string - }, - options?: Options, - ) { - const params = buildClientParams([parameters], [{ args: [{ in: "query", key: "directory" }] }]) - return (options?.client ?? this.client).get({ - url: "/project", - ...options, - ...params, - }) - } - - /** - * Get current project - * - * Retrieve the currently active project that OpenCode is working with. - */ - public current( - parameters?: { - directory?: string - }, - options?: Options, - ) { - const params = buildClientParams([parameters], [{ args: [{ in: "query", key: "directory" }] }]) - return (options?.client ?? this.client).get({ - url: "/project/current", - ...options, - ...params, - }) - } - - /** - * Update project - * - * Update project properties such as name, icon and color. - */ - public update( - parameters: { - projectID: string - directory?: string - name?: string - icon?: { - url?: string - color?: string - } - }, - options?: Options, - ) { - const params = buildClientParams( - [parameters], - [ - { - args: [ - { in: "path", key: "projectID" }, - { in: "query", key: "directory" }, - { in: "body", key: "name" }, - { in: "body", key: "icon" }, - ], - }, - ], - ) - return (options?.client ?? this.client).patch({ - url: "/project/{projectID}", - ...options, - ...params, - headers: { - "Content-Type": "application/json", - ...options?.headers, - ...params.headers, - }, - }) - } + /** + * List all projects + * + * Get a list of projects that have been opened with OpenCode. + */ + public list(parameters?: { + directory?: string; + }, options?: Options) { + const params = buildClientParams([parameters], [{ args: [{ in: 'query', key: 'directory' }] }]); + return (options?.client ?? this.client).get({ + url: '/project', + ...options, + ...params + }); + } + + /** + * Get current project + * + * Retrieve the currently active project that OpenCode is working with. + */ + public current(parameters?: { + directory?: string; + }, options?: Options) { + const params = buildClientParams([parameters], [{ args: [{ in: 'query', key: 'directory' }] }]); + return (options?.client ?? this.client).get({ + url: '/project/current', + ...options, + ...params + }); + } + + /** + * Update project + * + * Update project properties such as name, icon and color. + */ + public update(parameters: { + projectID: string; + directory?: string; + name?: string; + icon?: { + url?: string; + color?: string; + }; + }, options?: Options) { + const params = buildClientParams([parameters], [{ args: [ + { in: 'path', key: 'projectID' }, + { in: 'query', key: 'directory' }, + { in: 'body', key: 'name' }, + { in: 'body', key: 'icon' } + ] }]); + return (options?.client ?? this.client).patch({ + url: '/project/{projectID}', + ...options, + ...params, + headers: { + 'Content-Type': 'application/json', + ...options?.headers, + ...params.headers + } + }); + } } export class Pty extends HeyApiClient { - /** - * List PTY sessions - * - * Get a list of all active pseudo-terminal (PTY) sessions managed by OpenCode. - */ - public list( - parameters?: { - directory?: string - }, - options?: Options, - ) { - const params = buildClientParams([parameters], [{ args: [{ in: "query", key: "directory" }] }]) - return (options?.client ?? this.client).get({ - url: "/pty", - ...options, - ...params, - }) - } - - /** - * Create PTY session - * - * Create a new pseudo-terminal (PTY) session for running shell commands and processes. - */ - public create( - parameters?: { - directory?: string - command?: string - args?: Array - cwd?: string - title?: string - env?: { - [key: string]: string - } - }, - options?: Options, - ) { - const params = buildClientParams( - [parameters], - [ - { - args: [ - { in: "query", key: "directory" }, - { in: "body", key: "command" }, - { in: "body", key: "args" }, - { in: "body", key: "cwd" }, - { in: "body", key: "title" }, - { in: "body", key: "env" }, - ], - }, - ], - ) - return (options?.client ?? this.client).post({ - url: "/pty", - ...options, - ...params, - headers: { - "Content-Type": "application/json", - ...options?.headers, - ...params.headers, - }, - }) - } - - /** - * Remove PTY session - * - * Remove and terminate a specific pseudo-terminal (PTY) session. - */ - public remove( - parameters: { - ptyID: string - directory?: string - }, - options?: Options, - ) { - const params = buildClientParams( - [parameters], - [ - { - args: [ - { in: "path", key: "ptyID" }, - { in: "query", key: "directory" }, - ], - }, - ], - ) - return (options?.client ?? this.client).delete({ - url: "/pty/{ptyID}", - ...options, - ...params, - }) - } - - /** - * Get PTY session - * - * Retrieve detailed information about a specific pseudo-terminal (PTY) session. - */ - public get( - parameters: { - ptyID: string - directory?: string - }, - options?: Options, - ) { - const params = buildClientParams( - [parameters], - [ - { - args: [ - { in: "path", key: "ptyID" }, - { in: "query", key: "directory" }, - ], - }, - ], - ) - return (options?.client ?? this.client).get({ - url: "/pty/{ptyID}", - ...options, - ...params, - }) - } - - /** - * Update PTY session - * - * Update properties of an existing pseudo-terminal (PTY) session. - */ - public update( - parameters: { - ptyID: string - directory?: string - title?: string - size?: { - rows: number - cols: number - } - }, - options?: Options, - ) { - const params = buildClientParams( - [parameters], - [ - { - args: [ - { in: "path", key: "ptyID" }, - { in: "query", key: "directory" }, - { in: "body", key: "title" }, - { in: "body", key: "size" }, - ], - }, - ], - ) - return (options?.client ?? this.client).put({ - url: "/pty/{ptyID}", - ...options, - ...params, - headers: { - "Content-Type": "application/json", - ...options?.headers, - ...params.headers, - }, - }) - } - - /** - * Connect to PTY session - * - * Establish a WebSocket connection to interact with a pseudo-terminal (PTY) session in real-time. - */ - public connect( - parameters: { - ptyID: string - directory?: string - }, - options?: Options, - ) { - const params = buildClientParams( - [parameters], - [ - { - args: [ - { in: "path", key: "ptyID" }, - { in: "query", key: "directory" }, - ], - }, - ], - ) - return (options?.client ?? this.client).get({ - url: "/pty/{ptyID}/connect", - ...options, - ...params, - }) - } + /** + * List PTY sessions + * + * Get a list of all active pseudo-terminal (PTY) sessions managed by OpenCode. + */ + public list(parameters?: { + directory?: string; + }, options?: Options) { + const params = buildClientParams([parameters], [{ args: [{ in: 'query', key: 'directory' }] }]); + return (options?.client ?? this.client).get({ + url: '/pty', + ...options, + ...params + }); + } + + /** + * Create PTY session + * + * Create a new pseudo-terminal (PTY) session for running shell commands and processes. + */ + public create(parameters?: { + directory?: string; + command?: string; + args?: Array; + cwd?: string; + title?: string; + env?: { + [key: string]: string; + }; + }, options?: Options) { + const params = buildClientParams([parameters], [{ args: [ + { in: 'query', key: 'directory' }, + { in: 'body', key: 'command' }, + { in: 'body', key: 'args' }, + { in: 'body', key: 'cwd' }, + { in: 'body', key: 'title' }, + { in: 'body', key: 'env' } + ] }]); + return (options?.client ?? this.client).post({ + url: '/pty', + ...options, + ...params, + headers: { + 'Content-Type': 'application/json', + ...options?.headers, + ...params.headers + } + }); + } + + /** + * Remove PTY session + * + * Remove and terminate a specific pseudo-terminal (PTY) session. + */ + public remove(parameters: { + ptyID: string; + directory?: string; + }, options?: Options) { + const params = buildClientParams([parameters], [{ args: [{ in: 'path', key: 'ptyID' }, { in: 'query', key: 'directory' }] }]); + return (options?.client ?? this.client).delete({ + url: '/pty/{ptyID}', + ...options, + ...params + }); + } + + /** + * Get PTY session + * + * Retrieve detailed information about a specific pseudo-terminal (PTY) session. + */ + public get(parameters: { + ptyID: string; + directory?: string; + }, options?: Options) { + const params = buildClientParams([parameters], [{ args: [{ in: 'path', key: 'ptyID' }, { in: 'query', key: 'directory' }] }]); + return (options?.client ?? this.client).get({ + url: '/pty/{ptyID}', + ...options, + ...params + }); + } + + /** + * Update PTY session + * + * Update properties of an existing pseudo-terminal (PTY) session. + */ + public update(parameters: { + ptyID: string; + directory?: string; + title?: string; + size?: { + rows: number; + cols: number; + }; + }, options?: Options) { + const params = buildClientParams([parameters], [{ args: [ + { in: 'path', key: 'ptyID' }, + { in: 'query', key: 'directory' }, + { in: 'body', key: 'title' }, + { in: 'body', key: 'size' } + ] }]); + return (options?.client ?? this.client).put({ + url: '/pty/{ptyID}', + ...options, + ...params, + headers: { + 'Content-Type': 'application/json', + ...options?.headers, + ...params.headers + } + }); + } + + /** + * Connect to PTY session + * + * Establish a WebSocket connection to interact with a pseudo-terminal (PTY) session in real-time. + */ + public connect(parameters: { + ptyID: string; + directory?: string; + }, options?: Options) { + const params = buildClientParams([parameters], [{ args: [{ in: 'path', key: 'ptyID' }, { in: 'query', key: 'directory' }] }]); + return (options?.client ?? this.client).get({ + url: '/pty/{ptyID}/connect', + ...options, + ...params + }); + } } export class Config extends HeyApiClient { - /** - * Get configuration - * - * Retrieve the current OpenCode configuration settings and preferences. - */ - public get( - parameters?: { - directory?: string - }, - options?: Options, - ) { - const params = buildClientParams([parameters], [{ args: [{ in: "query", key: "directory" }] }]) - return (options?.client ?? this.client).get({ - url: "/config", - ...options, - ...params, - }) - } - - /** - * Update configuration - * - * Update OpenCode configuration settings and preferences. - */ - public update( - parameters?: { - directory?: string - config?: Config2 - }, - options?: Options, - ) { - const params = buildClientParams( - [parameters], - [ - { - args: [ - { in: "query", key: "directory" }, - { key: "config", map: "body" }, - ], - }, - ], - ) - return (options?.client ?? this.client).patch({ - url: "/config", - ...options, - ...params, - headers: { - "Content-Type": "application/json", - ...options?.headers, - ...params.headers, - }, - }) - } - - /** - * List config providers - * - * Get a list of all configured AI providers and their default models. - */ - public providers( - parameters?: { - directory?: string - }, - options?: Options, - ) { - const params = buildClientParams([parameters], [{ args: [{ in: "query", key: "directory" }] }]) - return (options?.client ?? this.client).get({ - url: "/config/providers", - ...options, - ...params, - }) - } + /** + * Get configuration + * + * Retrieve the current OpenCode configuration settings and preferences. + */ + public get(parameters?: { + directory?: string; + }, options?: Options) { + const params = buildClientParams([parameters], [{ args: [{ in: 'query', key: 'directory' }] }]); + return (options?.client ?? this.client).get({ + url: '/config', + ...options, + ...params + }); + } + + /** + * Update configuration + * + * Update OpenCode configuration settings and preferences. + */ + public update(parameters?: { + directory?: string; + config?: Config2; + }, options?: Options) { + const params = buildClientParams([parameters], [{ args: [{ in: 'query', key: 'directory' }, { key: 'config', map: 'body' }] }]); + return (options?.client ?? this.client).patch({ + url: '/config', + ...options, + ...params, + headers: { + 'Content-Type': 'application/json', + ...options?.headers, + ...params.headers + } + }); + } + + /** + * List config providers + * + * Get a list of all configured AI providers and their default models. + */ + public providers(parameters?: { + directory?: string; + }, options?: Options) { + const params = buildClientParams([parameters], [{ args: [{ in: 'query', key: 'directory' }] }]); + return (options?.client ?? this.client).get({ + url: '/config/providers', + ...options, + ...params + }); + } } export class Tool extends HeyApiClient { - /** - * List tool IDs - * - * Get a list of all available tool IDs, including both built-in tools and dynamically registered tools. - */ - public ids( - parameters?: { - directory?: string - }, - options?: Options, - ) { - const params = buildClientParams([parameters], [{ args: [{ in: "query", key: "directory" }] }]) - return (options?.client ?? this.client).get({ - url: "/experimental/tool/ids", - ...options, - ...params, - }) - } - - /** - * List tools - * - * Get a list of available tools with their JSON schema parameters for a specific provider and model combination. - */ - public list( - parameters: { - directory?: string - provider: string - model: string - }, - options?: Options, - ) { - const params = buildClientParams( - [parameters], - [ - { - args: [ - { in: "query", key: "directory" }, - { in: "query", key: "provider" }, - { in: "query", key: "model" }, - ], - }, - ], - ) - return (options?.client ?? this.client).get({ - url: "/experimental/tool", - ...options, - ...params, - }) - } + /** + * List tool IDs + * + * Get a list of all available tool IDs, including both built-in tools and dynamically registered tools. + */ + public ids(parameters?: { + directory?: string; + }, options?: Options) { + const params = buildClientParams([parameters], [{ args: [{ in: 'query', key: 'directory' }] }]); + return (options?.client ?? this.client).get({ + url: '/experimental/tool/ids', + ...options, + ...params + }); + } + + /** + * List tools + * + * Get a list of available tools with their JSON schema parameters for a specific provider and model combination. + */ + public list(parameters: { + directory?: string; + provider: string; + model: string; + }, options?: Options) { + const params = buildClientParams([parameters], [{ args: [ + { in: 'query', key: 'directory' }, + { in: 'query', key: 'provider' }, + { in: 'query', key: 'model' } + ] }]); + return (options?.client ?? this.client).get({ + url: '/experimental/tool', + ...options, + ...params + }); + } } export class Instance extends HeyApiClient { - /** - * Dispose instance - * - * Clean up and dispose the current OpenCode instance, releasing all resources. - */ - public dispose( - parameters?: { - directory?: string - }, - options?: Options, - ) { - const params = buildClientParams([parameters], [{ args: [{ in: "query", key: "directory" }] }]) - return (options?.client ?? this.client).post({ - url: "/instance/dispose", - ...options, - ...params, - }) - } + /** + * Dispose instance + * + * Clean up and dispose the current OpenCode instance, releasing all resources. + */ + public dispose(parameters?: { + directory?: string; + }, options?: Options) { + const params = buildClientParams([parameters], [{ args: [{ in: 'query', key: 'directory' }] }]); + return (options?.client ?? this.client).post({ + url: '/instance/dispose', + ...options, + ...params + }); + } } export class Path extends HeyApiClient { - /** - * Get paths - * - * Retrieve the current working directory and related path information for the OpenCode instance. - */ - public get( - parameters?: { - directory?: string - }, - options?: Options, - ) { - const params = buildClientParams([parameters], [{ args: [{ in: "query", key: "directory" }] }]) - return (options?.client ?? this.client).get({ - url: "/path", - ...options, - ...params, - }) - } + /** + * Get paths + * + * Retrieve the current working directory and related path information for the OpenCode instance. + */ + public get(parameters?: { + directory?: string; + }, options?: Options) { + const params = buildClientParams([parameters], [{ args: [{ in: 'query', key: 'directory' }] }]); + return (options?.client ?? this.client).get({ + url: '/path', + ...options, + ...params + }); + } } export class Worktree extends HeyApiClient { - /** - * List worktrees - * - * List all sandbox worktrees for the current project. - */ - public list( - parameters?: { - directory?: string - }, - options?: Options, - ) { - const params = buildClientParams([parameters], [{ args: [{ in: "query", key: "directory" }] }]) - return (options?.client ?? this.client).get({ - url: "/experimental/worktree", - ...options, - ...params, - }) - } - - /** - * Create worktree - * - * Create a new git worktree for the current project. - */ - public create( - parameters?: { - directory?: string - worktreeCreateInput?: WorktreeCreateInput - }, - options?: Options, - ) { - const params = buildClientParams( - [parameters], - [ - { - args: [ - { in: "query", key: "directory" }, - { key: "worktreeCreateInput", map: "body" }, - ], - }, - ], - ) - return (options?.client ?? this.client).post({ - url: "/experimental/worktree", - ...options, - ...params, - headers: { - "Content-Type": "application/json", - ...options?.headers, - ...params.headers, - }, - }) - } + /** + * List worktrees + * + * List all sandbox worktrees for the current project. + */ + public list(parameters?: { + directory?: string; + }, options?: Options) { + const params = buildClientParams([parameters], [{ args: [{ in: 'query', key: 'directory' }] }]); + return (options?.client ?? this.client).get({ + url: '/experimental/worktree', + ...options, + ...params + }); + } + + /** + * Create worktree + * + * Create a new git worktree for the current project. + */ + public create(parameters?: { + directory?: string; + worktreeCreateInput?: WorktreeCreateInput; + }, options?: Options) { + const params = buildClientParams([parameters], [{ args: [{ in: 'query', key: 'directory' }, { key: 'worktreeCreateInput', map: 'body' }] }]); + return (options?.client ?? this.client).post({ + url: '/experimental/worktree', + ...options, + ...params, + headers: { + 'Content-Type': 'application/json', + ...options?.headers, + ...params.headers + } + }); + } } export class Vcs extends HeyApiClient { - /** - * Get VCS info - * - * Retrieve version control system (VCS) information for the current project, such as git branch. - */ - public get( - parameters?: { - directory?: string - }, - options?: Options, - ) { - const params = buildClientParams([parameters], [{ args: [{ in: "query", key: "directory" }] }]) - return (options?.client ?? this.client).get({ - url: "/vcs", - ...options, - ...params, - }) - } + /** + * Get VCS info + * + * Retrieve version control system (VCS) information for the current project, such as git branch. + */ + public get(parameters?: { + directory?: string; + }, options?: Options) { + const params = buildClientParams([parameters], [{ args: [{ in: 'query', key: 'directory' }] }]); + return (options?.client ?? this.client).get({ + url: '/vcs', + ...options, + ...params + }); + } } export class Session extends HeyApiClient { - /** - * List sessions - * - * Get a list of all OpenCode sessions, sorted by most recently updated. - */ - public list( - parameters?: { - directory?: string - start?: number - search?: string - limit?: number - }, - options?: Options, - ) { - const params = buildClientParams( - [parameters], - [ - { - args: [ - { in: "query", key: "directory" }, - { in: "query", key: "start" }, - { in: "query", key: "search" }, - { in: "query", key: "limit" }, - ], - }, - ], - ) - return (options?.client ?? this.client).get({ - url: "/session", - ...options, - ...params, - }) - } - - /** - * Create session - * - * Create a new OpenCode session for interacting with AI assistants and managing conversations. - */ - public create( - parameters?: { - directory?: string - parentID?: string - title?: string - permission?: PermissionRuleset - }, - options?: Options, - ) { - const params = buildClientParams( - [parameters], - [ - { - args: [ - { in: "query", key: "directory" }, - { in: "body", key: "parentID" }, - { in: "body", key: "title" }, - { in: "body", key: "permission" }, - ], - }, - ], - ) - return (options?.client ?? this.client).post({ - url: "/session", - ...options, - ...params, - headers: { - "Content-Type": "application/json", - ...options?.headers, - ...params.headers, - }, - }) - } - - /** - * Get session status - * - * Retrieve the current status of all sessions, including active, idle, and completed states. - */ - public status( - parameters?: { - directory?: string - }, - options?: Options, - ) { - const params = buildClientParams([parameters], [{ args: [{ in: "query", key: "directory" }] }]) - return (options?.client ?? this.client).get({ - url: "/session/status", - ...options, - ...params, - }) - } - - /** - * Delete session - * - * Delete a session and permanently remove all associated data, including messages and history. - */ - public delete( - parameters: { - sessionID: string - directory?: string - }, - options?: Options, - ) { - const params = buildClientParams( - [parameters], - [ - { - args: [ - { in: "path", key: "sessionID" }, - { in: "query", key: "directory" }, - ], - }, - ], - ) - return (options?.client ?? this.client).delete({ - url: "/session/{sessionID}", - ...options, - ...params, - }) - } - - /** - * Get session - * - * Retrieve detailed information about a specific OpenCode session. - */ - public get( - parameters: { - sessionID: string - directory?: string - }, - options?: Options, - ) { - const params = buildClientParams( - [parameters], - [ - { - args: [ - { in: "path", key: "sessionID" }, - { in: "query", key: "directory" }, - ], - }, - ], - ) - return (options?.client ?? this.client).get({ - url: "/session/{sessionID}", - ...options, - ...params, - }) - } - - /** - * Update session - * - * Update properties of an existing session, such as title or other metadata. - */ - public update( - parameters: { - sessionID: string - directory?: string - title?: string - time?: { - archived?: number - } - }, - options?: Options, - ) { - const params = buildClientParams( - [parameters], - [ - { - args: [ - { in: "path", key: "sessionID" }, - { in: "query", key: "directory" }, - { in: "body", key: "title" }, - { in: "body", key: "time" }, - ], - }, - ], - ) - return (options?.client ?? this.client).patch({ - url: "/session/{sessionID}", - ...options, - ...params, - headers: { - "Content-Type": "application/json", - ...options?.headers, - ...params.headers, - }, - }) - } - - /** - * Get session children - * - * Retrieve all child sessions that were forked from the specified parent session. - */ - public children( - parameters: { - sessionID: string - directory?: string - }, - options?: Options, - ) { - const params = buildClientParams( - [parameters], - [ - { - args: [ - { in: "path", key: "sessionID" }, - { in: "query", key: "directory" }, - ], - }, - ], - ) - return (options?.client ?? this.client).get({ - url: "/session/{sessionID}/children", - ...options, - ...params, - }) - } - - /** - * Get session todos - * - * Retrieve the todo list associated with a specific session, showing tasks and action items. - */ - public todo( - parameters: { - sessionID: string - directory?: string - }, - options?: Options, - ) { - const params = buildClientParams( - [parameters], - [ - { - args: [ - { in: "path", key: "sessionID" }, - { in: "query", key: "directory" }, - ], - }, - ], - ) - return (options?.client ?? this.client).get({ - url: "/session/{sessionID}/todo", - ...options, - ...params, - }) - } - - /** - * Initialize session - * - * Analyze the current application and create an AGENTS.md file with project-specific agent configurations. - */ - public init( - parameters: { - sessionID: string - directory?: string - modelID?: string - providerID?: string - messageID?: string - }, - options?: Options, - ) { - const params = buildClientParams( - [parameters], - [ - { - args: [ - { in: "path", key: "sessionID" }, - { in: "query", key: "directory" }, - { in: "body", key: "modelID" }, - { in: "body", key: "providerID" }, - { in: "body", key: "messageID" }, - ], - }, - ], - ) - return (options?.client ?? this.client).post({ - url: "/session/{sessionID}/init", - ...options, - ...params, - headers: { - "Content-Type": "application/json", - ...options?.headers, - ...params.headers, - }, - }) - } - - /** - * Fork session - * - * Create a new session by forking an existing session at a specific message point. - */ - public fork( - parameters: { - sessionID: string - directory?: string - messageID?: string - }, - options?: Options, - ) { - const params = buildClientParams( - [parameters], - [ - { - args: [ - { in: "path", key: "sessionID" }, - { in: "query", key: "directory" }, - { in: "body", key: "messageID" }, - ], - }, - ], - ) - return (options?.client ?? this.client).post({ - url: "/session/{sessionID}/fork", - ...options, - ...params, - headers: { - "Content-Type": "application/json", - ...options?.headers, - ...params.headers, - }, - }) - } - - /** - * Abort session - * - * Abort an active session and stop any ongoing AI processing or command execution. - */ - public abort( - parameters: { - sessionID: string - directory?: string - }, - options?: Options, - ) { - const params = buildClientParams( - [parameters], - [ - { - args: [ - { in: "path", key: "sessionID" }, - { in: "query", key: "directory" }, - ], - }, - ], - ) - return (options?.client ?? this.client).post({ - url: "/session/{sessionID}/abort", - ...options, - ...params, - }) - } - - /** - * Unshare session - * - * Remove the shareable link for a session, making it private again. - */ - public unshare( - parameters: { - sessionID: string - directory?: string - }, - options?: Options, - ) { - const params = buildClientParams( - [parameters], - [ - { - args: [ - { in: "path", key: "sessionID" }, - { in: "query", key: "directory" }, - ], - }, - ], - ) - return (options?.client ?? this.client).delete({ - url: "/session/{sessionID}/share", - ...options, - ...params, - }) - } - - /** - * Share session - * - * Create a shareable link for a session, allowing others to view the conversation. - */ - public share( - parameters: { - sessionID: string - directory?: string - }, - options?: Options, - ) { - const params = buildClientParams( - [parameters], - [ - { - args: [ - { in: "path", key: "sessionID" }, - { in: "query", key: "directory" }, - ], - }, - ], - ) - return (options?.client ?? this.client).post({ - url: "/session/{sessionID}/share", - ...options, - ...params, - }) - } - - /** - * Get session diff - * - * Get all file changes (diffs) made during this session. - */ - public diff( - parameters: { - sessionID: string - directory?: string - messageID?: string - }, - options?: Options, - ) { - const params = buildClientParams( - [parameters], - [ - { - args: [ - { in: "path", key: "sessionID" }, - { in: "query", key: "directory" }, - { in: "query", key: "messageID" }, - ], - }, - ], - ) - return (options?.client ?? this.client).get({ - url: "/session/{sessionID}/diff", - ...options, - ...params, - }) - } - - /** - * Summarize session - * - * Generate a concise summary of the session using AI compaction to preserve key information. - */ - public summarize( - parameters: { - sessionID: string - directory?: string - providerID?: string - modelID?: string - auto?: boolean - }, - options?: Options, - ) { - const params = buildClientParams( - [parameters], - [ - { - args: [ - { in: "path", key: "sessionID" }, - { in: "query", key: "directory" }, - { in: "body", key: "providerID" }, - { in: "body", key: "modelID" }, - { in: "body", key: "auto" }, - ], - }, - ], - ) - return (options?.client ?? this.client).post({ - url: "/session/{sessionID}/summarize", - ...options, - ...params, - headers: { - "Content-Type": "application/json", - ...options?.headers, - ...params.headers, - }, - }) - } - - /** - * Get session messages - * - * Retrieve all messages in a session, including user prompts and AI responses. - */ - public messages( - parameters: { - sessionID: string - directory?: string - limit?: number - }, - options?: Options, - ) { - const params = buildClientParams( - [parameters], - [ - { - args: [ - { in: "path", key: "sessionID" }, - { in: "query", key: "directory" }, - { in: "query", key: "limit" }, - ], - }, - ], - ) - return (options?.client ?? this.client).get({ - url: "/session/{sessionID}/message", - ...options, - ...params, - }) - } - - /** - * Send message - * - * Create and send a new message to a session, streaming the AI response. - */ - public prompt( - parameters: { - sessionID: string - directory?: string - messageID?: string - model?: { - providerID: string - modelID: string - } - agent?: string - noReply?: boolean - tools?: { - [key: string]: boolean - } - system?: string - variant?: string - parts?: Array - }, - options?: Options, - ) { - const params = buildClientParams( - [parameters], - [ - { - args: [ - { in: "path", key: "sessionID" }, - { in: "query", key: "directory" }, - { in: "body", key: "messageID" }, - { in: "body", key: "model" }, - { in: "body", key: "agent" }, - { in: "body", key: "noReply" }, - { in: "body", key: "tools" }, - { in: "body", key: "system" }, - { in: "body", key: "variant" }, - { in: "body", key: "parts" }, - ], - }, - ], - ) - return (options?.client ?? this.client).post({ - url: "/session/{sessionID}/message", - ...options, - ...params, - headers: { - "Content-Type": "application/json", - ...options?.headers, - ...params.headers, - }, - }) - } - - /** - * Get message - * - * Retrieve a specific message from a session by its message ID. - */ - public message( - parameters: { - sessionID: string - messageID: string - directory?: string - }, - options?: Options, - ) { - const params = buildClientParams( - [parameters], - [ - { - args: [ - { in: "path", key: "sessionID" }, - { in: "path", key: "messageID" }, - { in: "query", key: "directory" }, - ], - }, - ], - ) - return (options?.client ?? this.client).get({ - url: "/session/{sessionID}/message/{messageID}", - ...options, - ...params, - }) - } - - /** - * Send async message - * - * Create and send a new message to a session asynchronously, starting the session if needed and returning immediately. - */ - public promptAsync( - parameters: { - sessionID: string - directory?: string - messageID?: string - model?: { - providerID: string - modelID: string - } - agent?: string - noReply?: boolean - tools?: { - [key: string]: boolean - } - system?: string - variant?: string - parts?: Array - }, - options?: Options, - ) { - const params = buildClientParams( - [parameters], - [ - { - args: [ - { in: "path", key: "sessionID" }, - { in: "query", key: "directory" }, - { in: "body", key: "messageID" }, - { in: "body", key: "model" }, - { in: "body", key: "agent" }, - { in: "body", key: "noReply" }, - { in: "body", key: "tools" }, - { in: "body", key: "system" }, - { in: "body", key: "variant" }, - { in: "body", key: "parts" }, - ], - }, - ], - ) - return (options?.client ?? this.client).post({ - url: "/session/{sessionID}/prompt_async", - ...options, - ...params, - headers: { - "Content-Type": "application/json", - ...options?.headers, - ...params.headers, - }, - }) - } - - /** - * Send command - * - * Send a new command to a session for execution by the AI assistant. - */ - public command( - parameters: { - sessionID: string - directory?: string - messageID?: string - agent?: string - model?: string - arguments?: string - command?: string - variant?: string - parts?: Array<{ - id?: string - type: "file" - mime: string - filename?: string - url: string - source?: FilePartSource - }> - }, - options?: Options, - ) { - const params = buildClientParams( - [parameters], - [ - { - args: [ - { in: "path", key: "sessionID" }, - { in: "query", key: "directory" }, - { in: "body", key: "messageID" }, - { in: "body", key: "agent" }, - { in: "body", key: "model" }, - { in: "body", key: "arguments" }, - { in: "body", key: "command" }, - { in: "body", key: "variant" }, - { in: "body", key: "parts" }, - ], - }, - ], - ) - return (options?.client ?? this.client).post({ - url: "/session/{sessionID}/command", - ...options, - ...params, - headers: { - "Content-Type": "application/json", - ...options?.headers, - ...params.headers, - }, - }) - } - - /** - * Run shell command - * - * Execute a shell command within the session context and return the AI's response. - */ - public shell( - parameters: { - sessionID: string - directory?: string - agent?: string - model?: { - providerID: string - modelID: string - } - command?: string - }, - options?: Options, - ) { - const params = buildClientParams( - [parameters], - [ - { - args: [ - { in: "path", key: "sessionID" }, - { in: "query", key: "directory" }, - { in: "body", key: "agent" }, - { in: "body", key: "model" }, - { in: "body", key: "command" }, - ], - }, - ], - ) - return (options?.client ?? this.client).post({ - url: "/session/{sessionID}/shell", - ...options, - ...params, - headers: { - "Content-Type": "application/json", - ...options?.headers, - ...params.headers, - }, - }) - } - - /** - * Revert message - * - * Revert a specific message in a session, undoing its effects and restoring the previous state. - */ - public revert( - parameters: { - sessionID: string - directory?: string - messageID?: string - partID?: string - }, - options?: Options, - ) { - const params = buildClientParams( - [parameters], - [ - { - args: [ - { in: "path", key: "sessionID" }, - { in: "query", key: "directory" }, - { in: "body", key: "messageID" }, - { in: "body", key: "partID" }, - ], - }, - ], - ) - return (options?.client ?? this.client).post({ - url: "/session/{sessionID}/revert", - ...options, - ...params, - headers: { - "Content-Type": "application/json", - ...options?.headers, - ...params.headers, - }, - }) - } - - /** - * Restore reverted messages - * - * Restore all previously reverted messages in a session. - */ - public unrevert( - parameters: { - sessionID: string - directory?: string - }, - options?: Options, - ) { - const params = buildClientParams( - [parameters], - [ - { - args: [ - { in: "path", key: "sessionID" }, - { in: "query", key: "directory" }, - ], - }, - ], - ) - return (options?.client ?? this.client).post({ - url: "/session/{sessionID}/unrevert", - ...options, - ...params, - }) - } + /** + * List sessions + * + * Get a list of all OpenCode sessions, sorted by most recently updated. + */ + public list(parameters?: { + directory?: string; + start?: number; + search?: string; + limit?: number; + }, options?: Options) { + const params = buildClientParams([parameters], [{ args: [ + { in: 'query', key: 'directory' }, + { in: 'query', key: 'start' }, + { in: 'query', key: 'search' }, + { in: 'query', key: 'limit' } + ] }]); + return (options?.client ?? this.client).get({ + url: '/session', + ...options, + ...params + }); + } + + /** + * Create session + * + * Create a new OpenCode session for interacting with AI assistants and managing conversations. + */ + public create(parameters?: { + directory?: string; + parentID?: string; + title?: string; + permission?: PermissionRuleset; + }, options?: Options) { + const params = buildClientParams([parameters], [{ args: [ + { in: 'query', key: 'directory' }, + { in: 'body', key: 'parentID' }, + { in: 'body', key: 'title' }, + { in: 'body', key: 'permission' } + ] }]); + return (options?.client ?? this.client).post({ + url: '/session', + ...options, + ...params, + headers: { + 'Content-Type': 'application/json', + ...options?.headers, + ...params.headers + } + }); + } + + /** + * Get session status + * + * Retrieve the current status of all sessions, including active, idle, and completed states. + */ + public status(parameters?: { + directory?: string; + }, options?: Options) { + const params = buildClientParams([parameters], [{ args: [{ in: 'query', key: 'directory' }] }]); + return (options?.client ?? this.client).get({ + url: '/session/status', + ...options, + ...params + }); + } + + /** + * Delete session + * + * Delete a session and permanently remove all associated data, including messages and history. + */ + public delete(parameters: { + sessionID: string; + directory?: string; + }, options?: Options) { + const params = buildClientParams([parameters], [{ args: [{ in: 'path', key: 'sessionID' }, { in: 'query', key: 'directory' }] }]); + return (options?.client ?? this.client).delete({ + url: '/session/{sessionID}', + ...options, + ...params + }); + } + + /** + * Get session + * + * Retrieve detailed information about a specific OpenCode session. + */ + public get(parameters: { + sessionID: string; + directory?: string; + }, options?: Options) { + const params = buildClientParams([parameters], [{ args: [{ in: 'path', key: 'sessionID' }, { in: 'query', key: 'directory' }] }]); + return (options?.client ?? this.client).get({ + url: '/session/{sessionID}', + ...options, + ...params + }); + } + + /** + * Update session + * + * Update properties of an existing session, such as title or other metadata. + */ + public update(parameters: { + sessionID: string; + directory?: string; + title?: string; + time?: { + archived?: number; + }; + }, options?: Options) { + const params = buildClientParams([parameters], [{ args: [ + { in: 'path', key: 'sessionID' }, + { in: 'query', key: 'directory' }, + { in: 'body', key: 'title' }, + { in: 'body', key: 'time' } + ] }]); + return (options?.client ?? this.client).patch({ + url: '/session/{sessionID}', + ...options, + ...params, + headers: { + 'Content-Type': 'application/json', + ...options?.headers, + ...params.headers + } + }); + } + + /** + * Get session children + * + * Retrieve all child sessions that were forked from the specified parent session. + */ + public children(parameters: { + sessionID: string; + directory?: string; + }, options?: Options) { + const params = buildClientParams([parameters], [{ args: [{ in: 'path', key: 'sessionID' }, { in: 'query', key: 'directory' }] }]); + return (options?.client ?? this.client).get({ + url: '/session/{sessionID}/children', + ...options, + ...params + }); + } + + /** + * Get session todos + * + * Retrieve the todo list associated with a specific session, showing tasks and action items. + */ + public todo(parameters: { + sessionID: string; + directory?: string; + }, options?: Options) { + const params = buildClientParams([parameters], [{ args: [{ in: 'path', key: 'sessionID' }, { in: 'query', key: 'directory' }] }]); + return (options?.client ?? this.client).get({ + url: '/session/{sessionID}/todo', + ...options, + ...params + }); + } + + /** + * Initialize session + * + * Analyze the current application and create an AGENTS.md file with project-specific agent configurations. + */ + public init(parameters: { + sessionID: string; + directory?: string; + modelID?: string; + providerID?: string; + messageID?: string; + }, options?: Options) { + const params = buildClientParams([parameters], [{ args: [ + { in: 'path', key: 'sessionID' }, + { in: 'query', key: 'directory' }, + { in: 'body', key: 'modelID' }, + { in: 'body', key: 'providerID' }, + { in: 'body', key: 'messageID' } + ] }]); + return (options?.client ?? this.client).post({ + url: '/session/{sessionID}/init', + ...options, + ...params, + headers: { + 'Content-Type': 'application/json', + ...options?.headers, + ...params.headers + } + }); + } + + /** + * Fork session + * + * Create a new session by forking an existing session at a specific message point. + */ + public fork(parameters: { + sessionID: string; + directory?: string; + messageID?: string; + }, options?: Options) { + const params = buildClientParams([parameters], [{ args: [ + { in: 'path', key: 'sessionID' }, + { in: 'query', key: 'directory' }, + { in: 'body', key: 'messageID' } + ] }]); + return (options?.client ?? this.client).post({ + url: '/session/{sessionID}/fork', + ...options, + ...params, + headers: { + 'Content-Type': 'application/json', + ...options?.headers, + ...params.headers + } + }); + } + + /** + * Abort session + * + * Abort an active session and stop any ongoing AI processing or command execution. + */ + public abort(parameters: { + sessionID: string; + directory?: string; + }, options?: Options) { + const params = buildClientParams([parameters], [{ args: [{ in: 'path', key: 'sessionID' }, { in: 'query', key: 'directory' }] }]); + return (options?.client ?? this.client).post({ + url: '/session/{sessionID}/abort', + ...options, + ...params + }); + } + + /** + * Unshare session + * + * Remove the shareable link for a session, making it private again. + */ + public unshare(parameters: { + sessionID: string; + directory?: string; + }, options?: Options) { + const params = buildClientParams([parameters], [{ args: [{ in: 'path', key: 'sessionID' }, { in: 'query', key: 'directory' }] }]); + return (options?.client ?? this.client).delete({ + url: '/session/{sessionID}/share', + ...options, + ...params + }); + } + + /** + * Share session + * + * Create a shareable link for a session, allowing others to view the conversation. + */ + public share(parameters: { + sessionID: string; + directory?: string; + }, options?: Options) { + const params = buildClientParams([parameters], [{ args: [{ in: 'path', key: 'sessionID' }, { in: 'query', key: 'directory' }] }]); + return (options?.client ?? this.client).post({ + url: '/session/{sessionID}/share', + ...options, + ...params + }); + } + + /** + * Get session diff + * + * Get all file changes (diffs) made during this session. + */ + public diff(parameters: { + sessionID: string; + directory?: string; + messageID?: string; + }, options?: Options) { + const params = buildClientParams([parameters], [{ args: [ + { in: 'path', key: 'sessionID' }, + { in: 'query', key: 'directory' }, + { in: 'query', key: 'messageID' } + ] }]); + return (options?.client ?? this.client).get({ + url: '/session/{sessionID}/diff', + ...options, + ...params + }); + } + + /** + * Summarize session + * + * Generate a concise summary of the session using AI compaction to preserve key information. + */ + public summarize(parameters: { + sessionID: string; + directory?: string; + providerID?: string; + modelID?: string; + auto?: boolean; + }, options?: Options) { + const params = buildClientParams([parameters], [{ args: [ + { in: 'path', key: 'sessionID' }, + { in: 'query', key: 'directory' }, + { in: 'body', key: 'providerID' }, + { in: 'body', key: 'modelID' }, + { in: 'body', key: 'auto' } + ] }]); + return (options?.client ?? this.client).post({ + url: '/session/{sessionID}/summarize', + ...options, + ...params, + headers: { + 'Content-Type': 'application/json', + ...options?.headers, + ...params.headers + } + }); + } + + /** + * Get session messages + * + * Retrieve all messages in a session, including user prompts and AI responses. + */ + public messages(parameters: { + sessionID: string; + directory?: string; + limit?: number; + }, options?: Options) { + const params = buildClientParams([parameters], [{ args: [ + { in: 'path', key: 'sessionID' }, + { in: 'query', key: 'directory' }, + { in: 'query', key: 'limit' } + ] }]); + return (options?.client ?? this.client).get({ + url: '/session/{sessionID}/message', + ...options, + ...params + }); + } + + /** + * Send message + * + * Create and send a new message to a session, streaming the AI response. + */ + public prompt(parameters: { + sessionID: string; + directory?: string; + messageID?: string; + model?: { + providerID: string; + modelID: string; + }; + agent?: string; + noReply?: boolean; + tools?: { + [key: string]: boolean; + }; + system?: string; + variant?: string; + parts?: Array; + }, options?: Options) { + const params = buildClientParams([parameters], [{ args: [ + { in: 'path', key: 'sessionID' }, + { in: 'query', key: 'directory' }, + { in: 'body', key: 'messageID' }, + { in: 'body', key: 'model' }, + { in: 'body', key: 'agent' }, + { in: 'body', key: 'noReply' }, + { in: 'body', key: 'tools' }, + { in: 'body', key: 'system' }, + { in: 'body', key: 'variant' }, + { in: 'body', key: 'parts' } + ] }]); + return (options?.client ?? this.client).post({ + url: '/session/{sessionID}/message', + ...options, + ...params, + headers: { + 'Content-Type': 'application/json', + ...options?.headers, + ...params.headers + } + }); + } + + /** + * Get message + * + * Retrieve a specific message from a session by its message ID. + */ + public message(parameters: { + sessionID: string; + messageID: string; + directory?: string; + }, options?: Options) { + const params = buildClientParams([parameters], [{ args: [ + { in: 'path', key: 'sessionID' }, + { in: 'path', key: 'messageID' }, + { in: 'query', key: 'directory' } + ] }]); + return (options?.client ?? this.client).get({ + url: '/session/{sessionID}/message/{messageID}', + ...options, + ...params + }); + } + + /** + * Send async message + * + * Create and send a new message to a session asynchronously, starting the session if needed and returning immediately. + */ + public promptAsync(parameters: { + sessionID: string; + directory?: string; + messageID?: string; + model?: { + providerID: string; + modelID: string; + }; + agent?: string; + noReply?: boolean; + tools?: { + [key: string]: boolean; + }; + system?: string; + variant?: string; + parts?: Array; + }, options?: Options) { + const params = buildClientParams([parameters], [{ args: [ + { in: 'path', key: 'sessionID' }, + { in: 'query', key: 'directory' }, + { in: 'body', key: 'messageID' }, + { in: 'body', key: 'model' }, + { in: 'body', key: 'agent' }, + { in: 'body', key: 'noReply' }, + { in: 'body', key: 'tools' }, + { in: 'body', key: 'system' }, + { in: 'body', key: 'variant' }, + { in: 'body', key: 'parts' } + ] }]); + return (options?.client ?? this.client).post({ + url: '/session/{sessionID}/prompt_async', + ...options, + ...params, + headers: { + 'Content-Type': 'application/json', + ...options?.headers, + ...params.headers + } + }); + } + + /** + * Send command + * + * Send a new command to a session for execution by the AI assistant. + */ + public command(parameters: { + sessionID: string; + directory?: string; + messageID?: string; + agent?: string; + model?: string; + arguments?: string; + command?: string; + variant?: string; + parts?: Array<{ + id?: string; + type: 'file'; + mime: string; + filename?: string; + url: string; + source?: FilePartSource; + }>; + }, options?: Options) { + const params = buildClientParams([parameters], [{ args: [ + { in: 'path', key: 'sessionID' }, + { in: 'query', key: 'directory' }, + { in: 'body', key: 'messageID' }, + { in: 'body', key: 'agent' }, + { in: 'body', key: 'model' }, + { in: 'body', key: 'arguments' }, + { in: 'body', key: 'command' }, + { in: 'body', key: 'variant' }, + { in: 'body', key: 'parts' } + ] }]); + return (options?.client ?? this.client).post({ + url: '/session/{sessionID}/command', + ...options, + ...params, + headers: { + 'Content-Type': 'application/json', + ...options?.headers, + ...params.headers + } + }); + } + + /** + * Run shell command + * + * Execute a shell command within the session context and return the AI's response. + */ + public shell(parameters: { + sessionID: string; + directory?: string; + agent?: string; + model?: { + providerID: string; + modelID: string; + }; + command?: string; + }, options?: Options) { + const params = buildClientParams([parameters], [{ args: [ + { in: 'path', key: 'sessionID' }, + { in: 'query', key: 'directory' }, + { in: 'body', key: 'agent' }, + { in: 'body', key: 'model' }, + { in: 'body', key: 'command' } + ] }]); + return (options?.client ?? this.client).post({ + url: '/session/{sessionID}/shell', + ...options, + ...params, + headers: { + 'Content-Type': 'application/json', + ...options?.headers, + ...params.headers + } + }); + } + + /** + * Revert message + * + * Revert a specific message in a session, undoing its effects and restoring the previous state. + */ + public revert(parameters: { + sessionID: string; + directory?: string; + messageID?: string; + partID?: string; + }, options?: Options) { + const params = buildClientParams([parameters], [{ args: [ + { in: 'path', key: 'sessionID' }, + { in: 'query', key: 'directory' }, + { in: 'body', key: 'messageID' }, + { in: 'body', key: 'partID' } + ] }]); + return (options?.client ?? this.client).post({ + url: '/session/{sessionID}/revert', + ...options, + ...params, + headers: { + 'Content-Type': 'application/json', + ...options?.headers, + ...params.headers + } + }); + } + + /** + * Restore reverted messages + * + * Restore all previously reverted messages in a session. + */ + public unrevert(parameters: { + sessionID: string; + directory?: string; + }, options?: Options) { + const params = buildClientParams([parameters], [{ args: [{ in: 'path', key: 'sessionID' }, { in: 'query', key: 'directory' }] }]); + return (options?.client ?? this.client).post({ + url: '/session/{sessionID}/unrevert', + ...options, + ...params + }); + } } export class Part extends HeyApiClient { - /** - * Delete a part from a message - */ - public delete( - parameters: { - sessionID: string - messageID: string - partID: string - directory?: string - }, - options?: Options, - ) { - const params = buildClientParams( - [parameters], - [ - { - args: [ - { in: "path", key: "sessionID" }, - { in: "path", key: "messageID" }, - { in: "path", key: "partID" }, - { in: "query", key: "directory" }, - ], - }, - ], - ) - return (options?.client ?? this.client).delete({ - url: "/session/{sessionID}/message/{messageID}/part/{partID}", - ...options, - ...params, - }) - } - - /** - * Update a part in a message - */ - public update( - parameters: { - sessionID: string - messageID: string - partID: string - directory?: string - part?: Part2 - }, - options?: Options, - ) { - const params = buildClientParams( - [parameters], - [ - { - args: [ - { in: "path", key: "sessionID" }, - { in: "path", key: "messageID" }, - { in: "path", key: "partID" }, - { in: "query", key: "directory" }, - { key: "part", map: "body" }, - ], - }, - ], - ) - return (options?.client ?? this.client).patch({ - url: "/session/{sessionID}/message/{messageID}/part/{partID}", - ...options, - ...params, - headers: { - "Content-Type": "application/json", - ...options?.headers, - ...params.headers, - }, - }) - } + /** + * Delete a part from a message + */ + public delete(parameters: { + sessionID: string; + messageID: string; + partID: string; + directory?: string; + }, options?: Options) { + const params = buildClientParams([parameters], [{ args: [ + { in: 'path', key: 'sessionID' }, + { in: 'path', key: 'messageID' }, + { in: 'path', key: 'partID' }, + { in: 'query', key: 'directory' } + ] }]); + return (options?.client ?? this.client).delete({ + url: '/session/{sessionID}/message/{messageID}/part/{partID}', + ...options, + ...params + }); + } + + /** + * Update a part in a message + */ + public update(parameters: { + sessionID: string; + messageID: string; + partID: string; + directory?: string; + part?: Part2; + }, options?: Options) { + const params = buildClientParams([parameters], [{ args: [ + { in: 'path', key: 'sessionID' }, + { in: 'path', key: 'messageID' }, + { in: 'path', key: 'partID' }, + { in: 'query', key: 'directory' }, + { key: 'part', map: 'body' } + ] }]); + return (options?.client ?? this.client).patch({ + url: '/session/{sessionID}/message/{messageID}/part/{partID}', + ...options, + ...params, + headers: { + 'Content-Type': 'application/json', + ...options?.headers, + ...params.headers + } + }); + } } export class Permission extends HeyApiClient { - /** - * Respond to permission - * - * Approve or deny a permission request from the AI assistant. - * - * @deprecated - */ - public respond( - parameters: { - sessionID: string - permissionID: string - directory?: string - response?: "once" | "always" | "reject" - }, - options?: Options, - ) { - const params = buildClientParams( - [parameters], - [ - { - args: [ - { in: "path", key: "sessionID" }, - { in: "path", key: "permissionID" }, - { in: "query", key: "directory" }, - { in: "body", key: "response" }, - ], - }, - ], - ) - return (options?.client ?? this.client).post({ - url: "/session/{sessionID}/permissions/{permissionID}", - ...options, - ...params, - headers: { - "Content-Type": "application/json", - ...options?.headers, - ...params.headers, - }, - }) - } - - /** - * Respond to permission request - * - * Approve or deny a permission request from the AI assistant. - */ - public reply( - parameters: { - requestID: string - directory?: string - reply?: "once" | "always" | "reject" - message?: string - }, - options?: Options, - ) { - const params = buildClientParams( - [parameters], - [ - { - args: [ - { in: "path", key: "requestID" }, - { in: "query", key: "directory" }, - { in: "body", key: "reply" }, - { in: "body", key: "message" }, - ], - }, - ], - ) - return (options?.client ?? this.client).post({ - url: "/permission/{requestID}/reply", - ...options, - ...params, - headers: { - "Content-Type": "application/json", - ...options?.headers, - ...params.headers, - }, - }) - } - - /** - * List pending permissions - * - * Get all pending permission requests across all sessions. - */ - public list( - parameters?: { - directory?: string - }, - options?: Options, - ) { - const params = buildClientParams([parameters], [{ args: [{ in: "query", key: "directory" }] }]) - return (options?.client ?? this.client).get({ - url: "/permission", - ...options, - ...params, - }) - } + /** + * Respond to permission + * + * Approve or deny a permission request from the AI assistant. + * + * @deprecated + */ + public respond(parameters: { + sessionID: string; + permissionID: string; + directory?: string; + response?: 'once' | 'always' | 'reject'; + }, options?: Options) { + const params = buildClientParams([parameters], [{ args: [ + { in: 'path', key: 'sessionID' }, + { in: 'path', key: 'permissionID' }, + { in: 'query', key: 'directory' }, + { in: 'body', key: 'response' } + ] }]); + return (options?.client ?? this.client).post({ + url: '/session/{sessionID}/permissions/{permissionID}', + ...options, + ...params, + headers: { + 'Content-Type': 'application/json', + ...options?.headers, + ...params.headers + } + }); + } + + /** + * Respond to permission request + * + * Approve or deny a permission request from the AI assistant. + */ + public reply(parameters: { + requestID: string; + directory?: string; + reply?: 'once' | 'always' | 'reject'; + message?: string; + }, options?: Options) { + const params = buildClientParams([parameters], [{ args: [ + { in: 'path', key: 'requestID' }, + { in: 'query', key: 'directory' }, + { in: 'body', key: 'reply' }, + { in: 'body', key: 'message' } + ] }]); + return (options?.client ?? this.client).post({ + url: '/permission/{requestID}/reply', + ...options, + ...params, + headers: { + 'Content-Type': 'application/json', + ...options?.headers, + ...params.headers + } + }); + } + + /** + * List pending permissions + * + * Get all pending permission requests across all sessions. + */ + public list(parameters?: { + directory?: string; + }, options?: Options) { + const params = buildClientParams([parameters], [{ args: [{ in: 'query', key: 'directory' }] }]); + return (options?.client ?? this.client).get({ + url: '/permission', + ...options, + ...params + }); + } } export class Question extends HeyApiClient { - /** - * List pending questions - * - * Get all pending question requests across all sessions. - */ - public list( - parameters?: { - directory?: string - }, - options?: Options, - ) { - const params = buildClientParams([parameters], [{ args: [{ in: "query", key: "directory" }] }]) - return (options?.client ?? this.client).get({ - url: "/question", - ...options, - ...params, - }) - } - - /** - * Reply to question request - * - * Provide answers to a question request from the AI assistant. - */ - public reply( - parameters: { - requestID: string - directory?: string - answers?: Array - }, - options?: Options, - ) { - const params = buildClientParams( - [parameters], - [ - { - args: [ - { in: "path", key: "requestID" }, - { in: "query", key: "directory" }, - { in: "body", key: "answers" }, - ], - }, - ], - ) - return (options?.client ?? this.client).post({ - url: "/question/{requestID}/reply", - ...options, - ...params, - headers: { - "Content-Type": "application/json", - ...options?.headers, - ...params.headers, - }, - }) - } - - /** - * Reject question request - * - * Reject a question request from the AI assistant. - */ - public reject( - parameters: { - requestID: string - directory?: string - }, - options?: Options, - ) { - const params = buildClientParams( - [parameters], - [ - { - args: [ - { in: "path", key: "requestID" }, - { in: "query", key: "directory" }, - ], - }, - ], - ) - return (options?.client ?? this.client).post({ - url: "/question/{requestID}/reject", - ...options, - ...params, - }) - } + /** + * List pending questions + * + * Get all pending question requests across all sessions. + */ + public list(parameters?: { + directory?: string; + }, options?: Options) { + const params = buildClientParams([parameters], [{ args: [{ in: 'query', key: 'directory' }] }]); + return (options?.client ?? this.client).get({ + url: '/question', + ...options, + ...params + }); + } + + /** + * Reply to question request + * + * Provide answers to a question request from the AI assistant. + */ + public reply(parameters: { + requestID: string; + directory?: string; + answers?: Array; + }, options?: Options) { + const params = buildClientParams([parameters], [{ args: [ + { in: 'path', key: 'requestID' }, + { in: 'query', key: 'directory' }, + { in: 'body', key: 'answers' } + ] }]); + return (options?.client ?? this.client).post({ + url: '/question/{requestID}/reply', + ...options, + ...params, + headers: { + 'Content-Type': 'application/json', + ...options?.headers, + ...params.headers + } + }); + } + + /** + * Reject question request + * + * Reject a question request from the AI assistant. + */ + public reject(parameters: { + requestID: string; + directory?: string; + }, options?: Options) { + const params = buildClientParams([parameters], [{ args: [{ in: 'path', key: 'requestID' }, { in: 'query', key: 'directory' }] }]); + return (options?.client ?? this.client).post({ + url: '/question/{requestID}/reject', + ...options, + ...params + }); + } } export class Command extends HeyApiClient { - /** - * List commands - * - * Get a list of all available commands in the OpenCode system. - */ - public list( - parameters?: { - directory?: string - }, - options?: Options, - ) { - const params = buildClientParams([parameters], [{ args: [{ in: "query", key: "directory" }] }]) - return (options?.client ?? this.client).get({ - url: "/command", - ...options, - ...params, - }) - } + /** + * List commands + * + * Get a list of all available commands in the OpenCode system. + */ + public list(parameters?: { + directory?: string; + }, options?: Options) { + const params = buildClientParams([parameters], [{ args: [{ in: 'query', key: 'directory' }] }]); + return (options?.client ?? this.client).get({ + url: '/command', + ...options, + ...params + }); + } } export class Oauth extends HeyApiClient { - /** - * OAuth authorize - * - * Initiate OAuth authorization for a specific AI provider to get an authorization URL. - */ - public authorize( - parameters: { - providerID: string - directory?: string - method?: number - }, - options?: Options, - ) { - const params = buildClientParams( - [parameters], - [ - { - args: [ - { in: "path", key: "providerID" }, - { in: "query", key: "directory" }, - { in: "body", key: "method" }, - ], - }, - ], - ) - return (options?.client ?? this.client).post< - ProviderOauthAuthorizeResponses, - ProviderOauthAuthorizeErrors, - ThrowOnError - >({ - url: "/provider/{providerID}/oauth/authorize", - ...options, - ...params, - headers: { - "Content-Type": "application/json", - ...options?.headers, - ...params.headers, - }, - }) - } - - /** - * OAuth callback - * - * Handle the OAuth callback from a provider after user authorization. - */ - public callback( - parameters: { - providerID: string - directory?: string - method?: number - code?: string - }, - options?: Options, - ) { - const params = buildClientParams( - [parameters], - [ - { - args: [ - { in: "path", key: "providerID" }, - { in: "query", key: "directory" }, - { in: "body", key: "method" }, - { in: "body", key: "code" }, - ], - }, - ], - ) - return (options?.client ?? this.client).post< - ProviderOauthCallbackResponses, - ProviderOauthCallbackErrors, - ThrowOnError - >({ - url: "/provider/{providerID}/oauth/callback", - ...options, - ...params, - headers: { - "Content-Type": "application/json", - ...options?.headers, - ...params.headers, - }, - }) - } + /** + * OAuth authorize + * + * Initiate OAuth authorization for a specific AI provider to get an authorization URL. + */ + public authorize(parameters: { + providerID: string; + directory?: string; + method?: number; + }, options?: Options) { + const params = buildClientParams([parameters], [{ args: [ + { in: 'path', key: 'providerID' }, + { in: 'query', key: 'directory' }, + { in: 'body', key: 'method' } + ] }]); + return (options?.client ?? this.client).post({ + url: '/provider/{providerID}/oauth/authorize', + ...options, + ...params, + headers: { + 'Content-Type': 'application/json', + ...options?.headers, + ...params.headers + } + }); + } + + /** + * OAuth callback + * + * Handle the OAuth callback from a provider after user authorization. + */ + public callback(parameters: { + providerID: string; + directory?: string; + method?: number; + code?: string; + }, options?: Options) { + const params = buildClientParams([parameters], [{ args: [ + { in: 'path', key: 'providerID' }, + { in: 'query', key: 'directory' }, + { in: 'body', key: 'method' }, + { in: 'body', key: 'code' } + ] }]); + return (options?.client ?? this.client).post({ + url: '/provider/{providerID}/oauth/callback', + ...options, + ...params, + headers: { + 'Content-Type': 'application/json', + ...options?.headers, + ...params.headers + } + }); + } } export class Provider extends HeyApiClient { - /** - * List providers - * - * Get a list of all available AI providers, including both available and connected ones. - */ - public list( - parameters?: { - directory?: string - }, - options?: Options, - ) { - const params = buildClientParams([parameters], [{ args: [{ in: "query", key: "directory" }] }]) - return (options?.client ?? this.client).get({ - url: "/provider", - ...options, - ...params, - }) - } - - /** - * Get provider auth methods - * - * Retrieve available authentication methods for all AI providers. - */ - public auth( - parameters?: { - directory?: string - }, - options?: Options, - ) { - const params = buildClientParams([parameters], [{ args: [{ in: "query", key: "directory" }] }]) - return (options?.client ?? this.client).get({ - url: "/provider/auth", - ...options, - ...params, - }) - } - - oauth = new Oauth({ client: this.client }) + /** + * List providers + * + * Get a list of all available AI providers, including both available and connected ones. + */ + public list(parameters?: { + directory?: string; + }, options?: Options) { + const params = buildClientParams([parameters], [{ args: [{ in: 'query', key: 'directory' }] }]); + return (options?.client ?? this.client).get({ + url: '/provider', + ...options, + ...params + }); + } + + /** + * Get provider auth methods + * + * Retrieve available authentication methods for all AI providers. + */ + public auth(parameters?: { + directory?: string; + }, options?: Options) { + const params = buildClientParams([parameters], [{ args: [{ in: 'query', key: 'directory' }] }]); + return (options?.client ?? this.client).get({ + url: '/provider/auth', + ...options, + ...params + }); + } + + oauth = new Oauth({ client: this.client }); } export class Find extends HeyApiClient { - /** - * Find text - * - * Search for text patterns across files in the project using ripgrep. - */ - public text( - parameters: { - directory?: string - pattern: string - }, - options?: Options, - ) { - const params = buildClientParams( - [parameters], - [ - { - args: [ - { in: "query", key: "directory" }, - { in: "query", key: "pattern" }, - ], - }, - ], - ) - return (options?.client ?? this.client).get({ - url: "/find", - ...options, - ...params, - }) - } - - /** - * Find files - * - * Search for files or directories by name or pattern in the project directory. - */ - public files( - parameters: { - directory?: string - query: string - dirs?: "true" | "false" - type?: "file" | "directory" - limit?: number - }, - options?: Options, - ) { - const params = buildClientParams( - [parameters], - [ - { - args: [ - { in: "query", key: "directory" }, - { in: "query", key: "query" }, - { in: "query", key: "dirs" }, - { in: "query", key: "type" }, - { in: "query", key: "limit" }, - ], - }, - ], - ) - return (options?.client ?? this.client).get({ - url: "/find/file", - ...options, - ...params, - }) - } - - /** - * Find symbols - * - * Search for workspace symbols like functions, classes, and variables using LSP. - */ - public symbols( - parameters: { - directory?: string - query: string - }, - options?: Options, - ) { - const params = buildClientParams( - [parameters], - [ - { - args: [ - { in: "query", key: "directory" }, - { in: "query", key: "query" }, - ], - }, - ], - ) - return (options?.client ?? this.client).get({ - url: "/find/symbol", - ...options, - ...params, - }) - } + /** + * Find text + * + * Search for text patterns across files in the project using ripgrep. + */ + public text(parameters: { + directory?: string; + pattern: string; + }, options?: Options) { + const params = buildClientParams([parameters], [{ args: [{ in: 'query', key: 'directory' }, { in: 'query', key: 'pattern' }] }]); + return (options?.client ?? this.client).get({ + url: '/find', + ...options, + ...params + }); + } + + /** + * Find files + * + * Search for files or directories by name or pattern in the project directory. + */ + public files(parameters: { + directory?: string; + query: string; + dirs?: 'true' | 'false'; + type?: 'file' | 'directory'; + limit?: number; + }, options?: Options) { + const params = buildClientParams([parameters], [{ args: [ + { in: 'query', key: 'directory' }, + { in: 'query', key: 'query' }, + { in: 'query', key: 'dirs' }, + { in: 'query', key: 'type' }, + { in: 'query', key: 'limit' } + ] }]); + return (options?.client ?? this.client).get({ + url: '/find/file', + ...options, + ...params + }); + } + + /** + * Find symbols + * + * Search for workspace symbols like functions, classes, and variables using LSP. + */ + public symbols(parameters: { + directory?: string; + query: string; + }, options?: Options) { + const params = buildClientParams([parameters], [{ args: [{ in: 'query', key: 'directory' }, { in: 'query', key: 'query' }] }]); + return (options?.client ?? this.client).get({ + url: '/find/symbol', + ...options, + ...params + }); + } } export class File extends HeyApiClient { - /** - * List files - * - * List files and directories in a specified path. - */ - public list( - parameters: { - directory?: string - path: string - }, - options?: Options, - ) { - const params = buildClientParams( - [parameters], - [ - { - args: [ - { in: "query", key: "directory" }, - { in: "query", key: "path" }, - ], - }, - ], - ) - return (options?.client ?? this.client).get({ - url: "/file", - ...options, - ...params, - }) - } - - /** - * Read file - * - * Read the content of a specified file. - */ - public read( - parameters: { - directory?: string - path: string - }, - options?: Options, - ) { - const params = buildClientParams( - [parameters], - [ - { - args: [ - { in: "query", key: "directory" }, - { in: "query", key: "path" }, - ], - }, - ], - ) - return (options?.client ?? this.client).get({ - url: "/file/content", - ...options, - ...params, - }) - } - - /** - * Get file status - * - * Get the git status of all files in the project. - */ - public status( - parameters?: { - directory?: string - }, - options?: Options, - ) { - const params = buildClientParams([parameters], [{ args: [{ in: "query", key: "directory" }] }]) - return (options?.client ?? this.client).get({ - url: "/file/status", - ...options, - ...params, - }) - } + /** + * List files + * + * List files and directories in a specified path. + */ + public list(parameters: { + directory?: string; + path: string; + }, options?: Options) { + const params = buildClientParams([parameters], [{ args: [{ in: 'query', key: 'directory' }, { in: 'query', key: 'path' }] }]); + return (options?.client ?? this.client).get({ + url: '/file', + ...options, + ...params + }); + } + + /** + * Read file + * + * Read the content of a specified file. + */ + public read(parameters: { + directory?: string; + path: string; + }, options?: Options) { + const params = buildClientParams([parameters], [{ args: [{ in: 'query', key: 'directory' }, { in: 'query', key: 'path' }] }]); + return (options?.client ?? this.client).get({ + url: '/file/content', + ...options, + ...params + }); + } + + /** + * Get file status + * + * Get the git status of all files in the project. + */ + public status(parameters?: { + directory?: string; + }, options?: Options) { + const params = buildClientParams([parameters], [{ args: [{ in: 'query', key: 'directory' }] }]); + return (options?.client ?? this.client).get({ + url: '/file/status', + ...options, + ...params + }); + } } export class App extends HeyApiClient { - /** - * Write log - * - * Write a log entry to the server logs with specified level and metadata. - */ - public log( - parameters?: { - directory?: string - service?: string - level?: "debug" | "info" | "error" | "warn" - message?: string - extra?: { - [key: string]: unknown - } - }, - options?: Options, - ) { - const params = buildClientParams( - [parameters], - [ - { - args: [ - { in: "query", key: "directory" }, - { in: "body", key: "service" }, - { in: "body", key: "level" }, - { in: "body", key: "message" }, - { in: "body", key: "extra" }, - ], - }, - ], - ) - return (options?.client ?? this.client).post({ - url: "/log", - ...options, - ...params, - headers: { - "Content-Type": "application/json", - ...options?.headers, - ...params.headers, - }, - }) - } - - /** - * List agents - * - * Get a list of all available AI agents in the OpenCode system. - */ - public agents( - parameters?: { - directory?: string - }, - options?: Options, - ) { - const params = buildClientParams([parameters], [{ args: [{ in: "query", key: "directory" }] }]) - return (options?.client ?? this.client).get({ - url: "/agent", - ...options, - ...params, - }) - } + /** + * Write log + * + * Write a log entry to the server logs with specified level and metadata. + */ + public log(parameters?: { + directory?: string; + service?: string; + level?: 'debug' | 'info' | 'error' | 'warn'; + message?: string; + extra?: { + [key: string]: unknown; + }; + }, options?: Options) { + const params = buildClientParams([parameters], [{ args: [ + { in: 'query', key: 'directory' }, + { in: 'body', key: 'service' }, + { in: 'body', key: 'level' }, + { in: 'body', key: 'message' }, + { in: 'body', key: 'extra' } + ] }]); + return (options?.client ?? this.client).post({ + url: '/log', + ...options, + ...params, + headers: { + 'Content-Type': 'application/json', + ...options?.headers, + ...params.headers + } + }); + } + + /** + * List agents + * + * Get a list of all available AI agents in the OpenCode system. + */ + public agents(parameters?: { + directory?: string; + }, options?: Options) { + const params = buildClientParams([parameters], [{ args: [{ in: 'query', key: 'directory' }] }]); + return (options?.client ?? this.client).get({ + url: '/agent', + ...options, + ...params + }); + } } export class Auth extends HeyApiClient { - /** - * Remove MCP OAuth - * - * Remove OAuth credentials for an MCP server - */ - public remove( - parameters: { - name: string - directory?: string - }, - options?: Options, - ) { - const params = buildClientParams( - [parameters], - [ - { - args: [ - { in: "path", key: "name" }, - { in: "query", key: "directory" }, - ], - }, - ], - ) - return (options?.client ?? this.client).delete({ - url: "/mcp/{name}/auth", - ...options, - ...params, - }) - } - - /** - * Start MCP OAuth - * - * Start OAuth authentication flow for a Model Context Protocol (MCP) server. - */ - public start( - parameters: { - name: string - directory?: string - }, - options?: Options, - ) { - const params = buildClientParams( - [parameters], - [ - { - args: [ - { in: "path", key: "name" }, - { in: "query", key: "directory" }, - ], - }, - ], - ) - return (options?.client ?? this.client).post({ - url: "/mcp/{name}/auth", - ...options, - ...params, - }) - } - - /** - * Complete MCP OAuth - * - * Complete OAuth authentication for a Model Context Protocol (MCP) server using the authorization code. - */ - public callback( - parameters: { - name: string - directory?: string - code?: string - }, - options?: Options, - ) { - const params = buildClientParams( - [parameters], - [ - { - args: [ - { in: "path", key: "name" }, - { in: "query", key: "directory" }, - { in: "body", key: "code" }, - ], - }, - ], - ) - return (options?.client ?? this.client).post({ - url: "/mcp/{name}/auth/callback", - ...options, - ...params, - headers: { - "Content-Type": "application/json", - ...options?.headers, - ...params.headers, - }, - }) - } - - /** - * Authenticate MCP OAuth - * - * Start OAuth flow and wait for callback (opens browser) - */ - public authenticate( - parameters: { - name: string - directory?: string - }, - options?: Options, - ) { - const params = buildClientParams( - [parameters], - [ - { - args: [ - { in: "path", key: "name" }, - { in: "query", key: "directory" }, - ], - }, - ], - ) - return (options?.client ?? this.client).post( - { - url: "/mcp/{name}/auth/authenticate", - ...options, - ...params, - }, - ) - } - - /** - * Set auth credentials - * - * Set authentication credentials - */ - public set( - parameters: { - providerID: string - directory?: string - auth?: Auth2 - }, - options?: Options, - ) { - const params = buildClientParams( - [parameters], - [ - { - args: [ - { in: "path", key: "providerID" }, - { in: "query", key: "directory" }, - { key: "auth", map: "body" }, - ], - }, - ], - ) - return (options?.client ?? this.client).put({ - url: "/auth/{providerID}", - ...options, - ...params, - headers: { - "Content-Type": "application/json", - ...options?.headers, - ...params.headers, - }, - }) - } + /** + * Remove MCP OAuth + * + * Remove OAuth credentials for an MCP server + */ + public remove(parameters: { + name: string; + directory?: string; + }, options?: Options) { + const params = buildClientParams([parameters], [{ args: [{ in: 'path', key: 'name' }, { in: 'query', key: 'directory' }] }]); + return (options?.client ?? this.client).delete({ + url: '/mcp/{name}/auth', + ...options, + ...params + }); + } + + /** + * Start MCP OAuth + * + * Start OAuth authentication flow for a Model Context Protocol (MCP) server. + */ + public start(parameters: { + name: string; + directory?: string; + }, options?: Options) { + const params = buildClientParams([parameters], [{ args: [{ in: 'path', key: 'name' }, { in: 'query', key: 'directory' }] }]); + return (options?.client ?? this.client).post({ + url: '/mcp/{name}/auth', + ...options, + ...params + }); + } + + /** + * Complete MCP OAuth + * + * Complete OAuth authentication for a Model Context Protocol (MCP) server using the authorization code. + */ + public callback(parameters: { + name: string; + directory?: string; + code?: string; + }, options?: Options) { + const params = buildClientParams([parameters], [{ args: [ + { in: 'path', key: 'name' }, + { in: 'query', key: 'directory' }, + { in: 'body', key: 'code' } + ] }]); + return (options?.client ?? this.client).post({ + url: '/mcp/{name}/auth/callback', + ...options, + ...params, + headers: { + 'Content-Type': 'application/json', + ...options?.headers, + ...params.headers + } + }); + } + + /** + * Authenticate MCP OAuth + * + * Start OAuth flow and wait for callback (opens browser) + */ + public authenticate(parameters: { + name: string; + directory?: string; + }, options?: Options) { + const params = buildClientParams([parameters], [{ args: [{ in: 'path', key: 'name' }, { in: 'query', key: 'directory' }] }]); + return (options?.client ?? this.client).post({ + url: '/mcp/{name}/auth/authenticate', + ...options, + ...params + }); + } + + /** + * Set auth credentials + * + * Set authentication credentials + */ + public set(parameters: { + providerID: string; + directory?: string; + auth?: Auth2; + }, options?: Options) { + const params = buildClientParams([parameters], [{ args: [ + { in: 'path', key: 'providerID' }, + { in: 'query', key: 'directory' }, + { key: 'auth', map: 'body' } + ] }]); + return (options?.client ?? this.client).put({ + url: '/auth/{providerID}', + ...options, + ...params, + headers: { + 'Content-Type': 'application/json', + ...options?.headers, + ...params.headers + } + }); + } } export class Mcp extends HeyApiClient { - /** - * Get MCP status - * - * Get the status of all Model Context Protocol (MCP) servers. - */ - public status( - parameters?: { - directory?: string - }, - options?: Options, - ) { - const params = buildClientParams([parameters], [{ args: [{ in: "query", key: "directory" }] }]) - return (options?.client ?? this.client).get({ - url: "/mcp", - ...options, - ...params, - }) - } - - /** - * Add MCP server - * - * Dynamically add a new Model Context Protocol (MCP) server to the system. - */ - public add( - parameters?: { - directory?: string - name?: string - config?: McpLocalConfig | McpRemoteConfig - }, - options?: Options, - ) { - const params = buildClientParams( - [parameters], - [ - { - args: [ - { in: "query", key: "directory" }, - { in: "body", key: "name" }, - { in: "body", key: "config" }, - ], - }, - ], - ) - return (options?.client ?? this.client).post({ - url: "/mcp", - ...options, - ...params, - headers: { - "Content-Type": "application/json", - ...options?.headers, - ...params.headers, - }, - }) - } - - /** - * Connect an MCP server - */ - public connect( - parameters: { - name: string - directory?: string - }, - options?: Options, - ) { - const params = buildClientParams( - [parameters], - [ - { - args: [ - { in: "path", key: "name" }, - { in: "query", key: "directory" }, - ], - }, - ], - ) - return (options?.client ?? this.client).post({ - url: "/mcp/{name}/connect", - ...options, - ...params, - }) - } - - /** - * Disconnect an MCP server - */ - public disconnect( - parameters: { - name: string - directory?: string - }, - options?: Options, - ) { - const params = buildClientParams( - [parameters], - [ - { - args: [ - { in: "path", key: "name" }, - { in: "query", key: "directory" }, - ], - }, - ], - ) - return (options?.client ?? this.client).post({ - url: "/mcp/{name}/disconnect", - ...options, - ...params, - }) - } - - auth = new Auth({ client: this.client }) + /** + * Get MCP status + * + * Get the status of all Model Context Protocol (MCP) servers. + */ + public status(parameters?: { + directory?: string; + }, options?: Options) { + const params = buildClientParams([parameters], [{ args: [{ in: 'query', key: 'directory' }] }]); + return (options?.client ?? this.client).get({ + url: '/mcp', + ...options, + ...params + }); + } + + /** + * Add MCP server + * + * Dynamically add a new Model Context Protocol (MCP) server to the system. + */ + public add(parameters?: { + directory?: string; + name?: string; + config?: McpLocalConfig | McpRemoteConfig; + }, options?: Options) { + const params = buildClientParams([parameters], [{ args: [ + { in: 'query', key: 'directory' }, + { in: 'body', key: 'name' }, + { in: 'body', key: 'config' } + ] }]); + return (options?.client ?? this.client).post({ + url: '/mcp', + ...options, + ...params, + headers: { + 'Content-Type': 'application/json', + ...options?.headers, + ...params.headers + } + }); + } + + /** + * Connect an MCP server + */ + public connect(parameters: { + name: string; + directory?: string; + }, options?: Options) { + const params = buildClientParams([parameters], [{ args: [{ in: 'path', key: 'name' }, { in: 'query', key: 'directory' }] }]); + return (options?.client ?? this.client).post({ + url: '/mcp/{name}/connect', + ...options, + ...params + }); + } + + /** + * Disconnect an MCP server + */ + public disconnect(parameters: { + name: string; + directory?: string; + }, options?: Options) { + const params = buildClientParams([parameters], [{ args: [{ in: 'path', key: 'name' }, { in: 'query', key: 'directory' }] }]); + return (options?.client ?? this.client).post({ + url: '/mcp/{name}/disconnect', + ...options, + ...params + }); + } + + auth = new Auth({ client: this.client }); } export class Resource extends HeyApiClient { - /** - * Get MCP resources - * - * Get all available MCP resources from connected servers. Optionally filter by name. - */ - public list( - parameters?: { - directory?: string - }, - options?: Options, - ) { - const params = buildClientParams([parameters], [{ args: [{ in: "query", key: "directory" }] }]) - return (options?.client ?? this.client).get({ - url: "/experimental/resource", - ...options, - ...params, - }) - } + /** + * Get MCP resources + * + * Get all available MCP resources from connected servers. Optionally filter by name. + */ + public list(parameters?: { + directory?: string; + }, options?: Options) { + const params = buildClientParams([parameters], [{ args: [{ in: 'query', key: 'directory' }] }]); + return (options?.client ?? this.client).get({ + url: '/experimental/resource', + ...options, + ...params + }); + } } export class Experimental extends HeyApiClient { - resource = new Resource({ client: this.client }) + resource = new Resource({ client: this.client }); } export class Lsp extends HeyApiClient { - /** - * Get LSP status - * - * Get LSP server status - */ - public status( - parameters?: { - directory?: string - }, - options?: Options, - ) { - const params = buildClientParams([parameters], [{ args: [{ in: "query", key: "directory" }] }]) - return (options?.client ?? this.client).get({ - url: "/lsp", - ...options, - ...params, - }) - } + /** + * Get LSP status + * + * Get LSP server status + */ + public status(parameters?: { + directory?: string; + }, options?: Options) { + const params = buildClientParams([parameters], [{ args: [{ in: 'query', key: 'directory' }] }]); + return (options?.client ?? this.client).get({ + url: '/lsp', + ...options, + ...params + }); + } } export class Formatter extends HeyApiClient { - /** - * Get formatter status - * - * Get formatter status - */ - public status( - parameters?: { - directory?: string - }, - options?: Options, - ) { - const params = buildClientParams([parameters], [{ args: [{ in: "query", key: "directory" }] }]) - return (options?.client ?? this.client).get({ - url: "/formatter", - ...options, - ...params, - }) - } + /** + * Get formatter status + * + * Get formatter status + */ + public status(parameters?: { + directory?: string; + }, options?: Options) { + const params = buildClientParams([parameters], [{ args: [{ in: 'query', key: 'directory' }] }]); + return (options?.client ?? this.client).get({ + url: '/formatter', + ...options, + ...params + }); + } } export class Control extends HeyApiClient { - /** - * Get next TUI request - * - * Retrieve the next TUI (Terminal User Interface) request from the queue for processing. - */ - public next( - parameters?: { - directory?: string - }, - options?: Options, - ) { - const params = buildClientParams([parameters], [{ args: [{ in: "query", key: "directory" }] }]) - return (options?.client ?? this.client).get({ - url: "/tui/control/next", - ...options, - ...params, - }) - } - - /** - * Submit TUI response - * - * Submit a response to the TUI request queue to complete a pending request. - */ - public response( - parameters?: { - directory?: string - body?: unknown - }, - options?: Options, - ) { - const params = buildClientParams([parameters], [{ args: [{ in: "query", key: "directory" }, { in: "body" }] }]) - return (options?.client ?? this.client).post({ - url: "/tui/control/response", - ...options, - ...params, - headers: { - "Content-Type": "application/json", - ...options?.headers, - ...params.headers, - }, - }) - } + /** + * Get next TUI request + * + * Retrieve the next TUI (Terminal User Interface) request from the queue for processing. + */ + public next(parameters?: { + directory?: string; + }, options?: Options) { + const params = buildClientParams([parameters], [{ args: [{ in: 'query', key: 'directory' }] }]); + return (options?.client ?? this.client).get({ + url: '/tui/control/next', + ...options, + ...params + }); + } + + /** + * Submit TUI response + * + * Submit a response to the TUI request queue to complete a pending request. + */ + public response(parameters?: { + directory?: string; + body?: unknown; + }, options?: Options) { + const params = buildClientParams([parameters], [{ args: [{ in: 'query', key: 'directory' }, { in: 'body' }] }]); + return (options?.client ?? this.client).post({ + url: '/tui/control/response', + ...options, + ...params, + headers: { + 'Content-Type': 'application/json', + ...options?.headers, + ...params.headers + } + }); + } } export class Tui extends HeyApiClient { - /** - * Append TUI prompt - * - * Append prompt to the TUI - */ - public appendPrompt( - parameters?: { - directory?: string - text?: string - }, - options?: Options, - ) { - const params = buildClientParams( - [parameters], - [ - { - args: [ - { in: "query", key: "directory" }, - { in: "body", key: "text" }, - ], - }, - ], - ) - return (options?.client ?? this.client).post({ - url: "/tui/append-prompt", - ...options, - ...params, - headers: { - "Content-Type": "application/json", - ...options?.headers, - ...params.headers, - }, - }) - } - - /** - * Open help dialog - * - * Open the help dialog in the TUI to display user assistance information. - */ - public openHelp( - parameters?: { - directory?: string - }, - options?: Options, - ) { - const params = buildClientParams([parameters], [{ args: [{ in: "query", key: "directory" }] }]) - return (options?.client ?? this.client).post({ - url: "/tui/open-help", - ...options, - ...params, - }) - } - - /** - * Open sessions dialog - * - * Open the session dialog - */ - public openSessions( - parameters?: { - directory?: string - }, - options?: Options, - ) { - const params = buildClientParams([parameters], [{ args: [{ in: "query", key: "directory" }] }]) - return (options?.client ?? this.client).post({ - url: "/tui/open-sessions", - ...options, - ...params, - }) - } - - /** - * Open themes dialog - * - * Open the theme dialog - */ - public openThemes( - parameters?: { - directory?: string - }, - options?: Options, - ) { - const params = buildClientParams([parameters], [{ args: [{ in: "query", key: "directory" }] }]) - return (options?.client ?? this.client).post({ - url: "/tui/open-themes", - ...options, - ...params, - }) - } - - /** - * Open models dialog - * - * Open the model dialog - */ - public openModels( - parameters?: { - directory?: string - }, - options?: Options, - ) { - const params = buildClientParams([parameters], [{ args: [{ in: "query", key: "directory" }] }]) - return (options?.client ?? this.client).post({ - url: "/tui/open-models", - ...options, - ...params, - }) - } - - /** - * Submit TUI prompt - * - * Submit the prompt - */ - public submitPrompt( - parameters?: { - directory?: string - }, - options?: Options, - ) { - const params = buildClientParams([parameters], [{ args: [{ in: "query", key: "directory" }] }]) - return (options?.client ?? this.client).post({ - url: "/tui/submit-prompt", - ...options, - ...params, - }) - } - - /** - * Clear TUI prompt - * - * Clear the prompt - */ - public clearPrompt( - parameters?: { - directory?: string - }, - options?: Options, - ) { - const params = buildClientParams([parameters], [{ args: [{ in: "query", key: "directory" }] }]) - return (options?.client ?? this.client).post({ - url: "/tui/clear-prompt", - ...options, - ...params, - }) - } - - /** - * Execute TUI command - * - * Execute a TUI command (e.g. agent_cycle) - */ - public executeCommand( - parameters?: { - directory?: string - command?: string - }, - options?: Options, - ) { - const params = buildClientParams( - [parameters], - [ - { - args: [ - { in: "query", key: "directory" }, - { in: "body", key: "command" }, - ], - }, - ], - ) - return (options?.client ?? this.client).post({ - url: "/tui/execute-command", - ...options, - ...params, - headers: { - "Content-Type": "application/json", - ...options?.headers, - ...params.headers, - }, - }) - } - - /** - * Show TUI toast - * - * Show a toast notification in the TUI - */ - public showToast( - parameters?: { - directory?: string - title?: string - message?: string - variant?: "info" | "success" | "warning" | "error" - duration?: number - }, - options?: Options, - ) { - const params = buildClientParams( - [parameters], - [ - { - args: [ - { in: "query", key: "directory" }, - { in: "body", key: "title" }, - { in: "body", key: "message" }, - { in: "body", key: "variant" }, - { in: "body", key: "duration" }, - ], - }, - ], - ) - return (options?.client ?? this.client).post({ - url: "/tui/show-toast", - ...options, - ...params, - headers: { - "Content-Type": "application/json", - ...options?.headers, - ...params.headers, - }, - }) - } - - /** - * Publish TUI event - * - * Publish a TUI event - */ - public publish( - parameters?: { - directory?: string - body?: EventTuiPromptAppend | EventTuiCommandExecute | EventTuiToastShow | EventTuiSessionSelect - }, - options?: Options, - ) { - const params = buildClientParams([parameters], [{ args: [{ in: "query", key: "directory" }, { in: "body" }] }]) - return (options?.client ?? this.client).post({ - url: "/tui/publish", - ...options, - ...params, - headers: { - "Content-Type": "application/json", - ...options?.headers, - ...params.headers, - }, - }) - } - - /** - * Select session - * - * Navigate the TUI to display the specified session. - */ - public selectSession( - parameters?: { - directory?: string - sessionID?: string - }, - options?: Options, - ) { - const params = buildClientParams( - [parameters], - [ - { - args: [ - { in: "query", key: "directory" }, - { in: "body", key: "sessionID" }, - ], - }, - ], - ) - return (options?.client ?? this.client).post({ - url: "/tui/select-session", - ...options, - ...params, - headers: { - "Content-Type": "application/json", - ...options?.headers, - ...params.headers, - }, - }) - } - - control = new Control({ client: this.client }) + /** + * Append TUI prompt + * + * Append prompt to the TUI + */ + public appendPrompt(parameters?: { + directory?: string; + text?: string; + }, options?: Options) { + const params = buildClientParams([parameters], [{ args: [{ in: 'query', key: 'directory' }, { in: 'body', key: 'text' }] }]); + return (options?.client ?? this.client).post({ + url: '/tui/append-prompt', + ...options, + ...params, + headers: { + 'Content-Type': 'application/json', + ...options?.headers, + ...params.headers + } + }); + } + + /** + * Open help dialog + * + * Open the help dialog in the TUI to display user assistance information. + */ + public openHelp(parameters?: { + directory?: string; + }, options?: Options) { + const params = buildClientParams([parameters], [{ args: [{ in: 'query', key: 'directory' }] }]); + return (options?.client ?? this.client).post({ + url: '/tui/open-help', + ...options, + ...params + }); + } + + /** + * Open sessions dialog + * + * Open the session dialog + */ + public openSessions(parameters?: { + directory?: string; + }, options?: Options) { + const params = buildClientParams([parameters], [{ args: [{ in: 'query', key: 'directory' }] }]); + return (options?.client ?? this.client).post({ + url: '/tui/open-sessions', + ...options, + ...params + }); + } + + /** + * Open themes dialog + * + * Open the theme dialog + */ + public openThemes(parameters?: { + directory?: string; + }, options?: Options) { + const params = buildClientParams([parameters], [{ args: [{ in: 'query', key: 'directory' }] }]); + return (options?.client ?? this.client).post({ + url: '/tui/open-themes', + ...options, + ...params + }); + } + + /** + * Open models dialog + * + * Open the model dialog + */ + public openModels(parameters?: { + directory?: string; + }, options?: Options) { + const params = buildClientParams([parameters], [{ args: [{ in: 'query', key: 'directory' }] }]); + return (options?.client ?? this.client).post({ + url: '/tui/open-models', + ...options, + ...params + }); + } + + /** + * Submit TUI prompt + * + * Submit the prompt + */ + public submitPrompt(parameters?: { + directory?: string; + }, options?: Options) { + const params = buildClientParams([parameters], [{ args: [{ in: 'query', key: 'directory' }] }]); + return (options?.client ?? this.client).post({ + url: '/tui/submit-prompt', + ...options, + ...params + }); + } + + /** + * Clear TUI prompt + * + * Clear the prompt + */ + public clearPrompt(parameters?: { + directory?: string; + }, options?: Options) { + const params = buildClientParams([parameters], [{ args: [{ in: 'query', key: 'directory' }] }]); + return (options?.client ?? this.client).post({ + url: '/tui/clear-prompt', + ...options, + ...params + }); + } + + /** + * Execute TUI command + * + * Execute a TUI command (e.g. agent_cycle) + */ + public executeCommand(parameters?: { + directory?: string; + command?: string; + }, options?: Options) { + const params = buildClientParams([parameters], [{ args: [{ in: 'query', key: 'directory' }, { in: 'body', key: 'command' }] }]); + return (options?.client ?? this.client).post({ + url: '/tui/execute-command', + ...options, + ...params, + headers: { + 'Content-Type': 'application/json', + ...options?.headers, + ...params.headers + } + }); + } + + /** + * Show TUI toast + * + * Show a toast notification in the TUI + */ + public showToast(parameters?: { + directory?: string; + title?: string; + message?: string; + variant?: 'info' | 'success' | 'warning' | 'error'; + duration?: number; + }, options?: Options) { + const params = buildClientParams([parameters], [{ args: [ + { in: 'query', key: 'directory' }, + { in: 'body', key: 'title' }, + { in: 'body', key: 'message' }, + { in: 'body', key: 'variant' }, + { in: 'body', key: 'duration' } + ] }]); + return (options?.client ?? this.client).post({ + url: '/tui/show-toast', + ...options, + ...params, + headers: { + 'Content-Type': 'application/json', + ...options?.headers, + ...params.headers + } + }); + } + + /** + * Publish TUI event + * + * Publish a TUI event + */ + public publish(parameters?: { + directory?: string; + body?: EventTuiPromptAppend | EventTuiCommandExecute | EventTuiToastShow | EventTuiSessionSelect; + }, options?: Options) { + const params = buildClientParams([parameters], [{ args: [{ in: 'query', key: 'directory' }, { in: 'body' }] }]); + return (options?.client ?? this.client).post({ + url: '/tui/publish', + ...options, + ...params, + headers: { + 'Content-Type': 'application/json', + ...options?.headers, + ...params.headers + } + }); + } + + /** + * Select session + * + * Navigate the TUI to display the specified session. + */ + public selectSession(parameters?: { + directory?: string; + sessionID?: string; + }, options?: Options) { + const params = buildClientParams([parameters], [{ args: [{ in: 'query', key: 'directory' }, { in: 'body', key: 'sessionID' }] }]); + return (options?.client ?? this.client).post({ + url: '/tui/select-session', + ...options, + ...params, + headers: { + 'Content-Type': 'application/json', + ...options?.headers, + ...params.headers + } + }); + } + + control = new Control({ client: this.client }); } export class Event extends HeyApiClient { - /** - * Subscribe to events - * - * Get events - */ - public subscribe( - parameters?: { - directory?: string - }, - options?: Options, - ) { - const params = buildClientParams([parameters], [{ args: [{ in: "query", key: "directory" }] }]) - return (options?.client ?? this.client).sse.get({ - url: "/event", - ...options, - ...params, - }) - } + /** + * Subscribe to events + * + * Get events + */ + public subscribe(parameters?: { + directory?: string; + }, options?: Options) { + const params = buildClientParams([parameters], [{ args: [{ in: 'query', key: 'directory' }] }]); + return (options?.client ?? this.client).sse.get({ + url: '/event', + ...options, + ...params + }); + } } export class OpencodeClient extends HeyApiClient { - public static readonly __registry = new HeyApiRegistry() - - constructor(args?: { client?: Client; key?: string }) { - super(args) - OpencodeClient.__registry.set(this, args?.key) - } - - global = new Global({ client: this.client }) - - project = new Project({ client: this.client }) - - pty = new Pty({ client: this.client }) - - config = new Config({ client: this.client }) - - tool = new Tool({ client: this.client }) - - instance = new Instance({ client: this.client }) - - path = new Path({ client: this.client }) - - worktree = new Worktree({ client: this.client }) - - vcs = new Vcs({ client: this.client }) - - session = new Session({ client: this.client }) - - part = new Part({ client: this.client }) - - permission = new Permission({ client: this.client }) - - question = new Question({ client: this.client }) - - command = new Command({ client: this.client }) - - provider = new Provider({ client: this.client }) - - find = new Find({ client: this.client }) - - file = new File({ client: this.client }) - - app = new App({ client: this.client }) - - mcp = new Mcp({ client: this.client }) - - experimental = new Experimental({ client: this.client }) - - lsp = new Lsp({ client: this.client }) - - formatter = new Formatter({ client: this.client }) - - tui = new Tui({ client: this.client }) - - auth = new Auth({ client: this.client }) - - event = new Event({ client: this.client }) + public static readonly __registry = new HeyApiRegistry(); + + constructor(args?: { + client?: Client; + key?: string; + }) { + super(args); + OpencodeClient.__registry.set(this, args?.key); + } + + global = new Global({ client: this.client }); + + project = new Project({ client: this.client }); + + pty = new Pty({ client: this.client }); + + config = new Config({ client: this.client }); + + tool = new Tool({ client: this.client }); + + instance = new Instance({ client: this.client }); + + path = new Path({ client: this.client }); + + worktree = new Worktree({ client: this.client }); + + vcs = new Vcs({ client: this.client }); + + session = new Session({ client: this.client }); + + part = new Part({ client: this.client }); + + permission = new Permission({ client: this.client }); + + question = new Question({ client: this.client }); + + command = new Command({ client: this.client }); + + provider = new Provider({ client: this.client }); + + find = new Find({ client: this.client }); + + file = new File({ client: this.client }); + + app = new App({ client: this.client }); + + mcp = new Mcp({ client: this.client }); + + experimental = new Experimental({ client: this.client }); + + lsp = new Lsp({ client: this.client }); + + formatter = new Formatter({ client: this.client }); + + tui = new Tui({ client: this.client }); + + auth = new Auth({ client: this.client }); + + event = new Event({ client: this.client }); } diff --git a/packages/sdk/js/src/v2/gen/types.gen.ts b/packages/sdk/js/src/v2/gen/types.gen.ts index ea86b022daf..428ec674829 100644 --- a/packages/sdk/js/src/v2/gen/types.gen.ts +++ b/packages/sdk/js/src/v2/gen/types.gen.ts @@ -1,4745 +1,4917 @@ // This file is auto-generated by @hey-api/openapi-ts export type ClientOptions = { - baseUrl: `${string}://${string}` | (string & {}) -} + baseUrl: `${string}://${string}` | (string & {}); +}; export type EventInstallationUpdated = { - type: "installation.updated" - properties: { - version: string - } -} + type: 'installation.updated'; + properties: { + version: string; + }; +}; export type EventInstallationUpdateAvailable = { - type: "installation.update-available" - properties: { - version: string - } -} + type: 'installation.update-available'; + properties: { + version: string; + }; +}; export type Project = { - id: string - worktree: string - vcs?: "git" - name?: string - icon?: { - url?: string - color?: string - } - time: { - created: number - updated: number - initialized?: number - } - sandboxes: Array -} + id: string; + worktree: string; + vcs?: 'git'; + name?: string; + icon?: { + url?: string; + color?: string; + }; + time: { + created: number; + updated: number; + initialized?: number; + }; + sandboxes: Array; +}; export type EventProjectUpdated = { - type: "project.updated" - properties: Project -} + type: 'project.updated'; + properties: Project; +}; export type EventServerInstanceDisposed = { - type: "server.instance.disposed" - properties: { - directory: string - } -} + type: 'server.instance.disposed'; + properties: { + directory: string; + }; +}; export type EventLspClientDiagnostics = { - type: "lsp.client.diagnostics" - properties: { - serverID: string - path: string - } -} + type: 'lsp.client.diagnostics'; + properties: { + serverID: string; + path: string; + }; +}; export type EventLspUpdated = { - type: "lsp.updated" - properties: { - [key: string]: unknown - } -} + type: 'lsp.updated'; + properties: { + [key: string]: unknown; + }; +}; export type FileDiff = { - file: string - before: string - after: string - additions: number - deletions: number -} + file: string; + before: string; + after: string; + additions: number; + deletions: number; +}; export type UserMessage = { - id: string - sessionID: string - role: "user" - time: { - created: number - } - summary?: { - title?: string - body?: string - diffs: Array - } - agent: string - model: { - providerID: string - modelID: string - } - system?: string - tools?: { - [key: string]: boolean - } - variant?: string -} + id: string; + sessionID: string; + role: 'user'; + time: { + created: number; + }; + summary?: { + title?: string; + body?: string; + diffs: Array; + }; + agent: string; + model: { + providerID: string; + modelID: string; + }; + system?: string; + tools?: { + [key: string]: boolean; + }; + variant?: string; +}; export type ProviderAuthError = { - name: "ProviderAuthError" - data: { - providerID: string - message: string - } -} + name: 'ProviderAuthError'; + data: { + providerID: string; + message: string; + }; +}; export type UnknownError = { - name: "UnknownError" - data: { - message: string - } -} + name: 'UnknownError'; + data: { + message: string; + }; +}; export type MessageOutputLengthError = { - name: "MessageOutputLengthError" - data: { - [key: string]: unknown - } -} + name: 'MessageOutputLengthError'; + data: { + [key: string]: unknown; + }; +}; export type MessageAbortedError = { - name: "MessageAbortedError" - data: { - message: string - } -} + name: 'MessageAbortedError'; + data: { + message: string; + }; +}; export type ApiError = { - name: "APIError" - data: { - message: string - statusCode?: number - isRetryable: boolean - responseHeaders?: { - [key: string]: string - } - responseBody?: string - metadata?: { - [key: string]: string - } - } -} + name: 'APIError'; + data: { + message: string; + statusCode?: number; + isRetryable: boolean; + responseHeaders?: { + [key: string]: string; + }; + responseBody?: string; + metadata?: { + [key: string]: string; + }; + }; +}; export type AssistantMessage = { - id: string - sessionID: string - role: "assistant" - time: { - created: number - completed?: number - } - error?: ProviderAuthError | UnknownError | MessageOutputLengthError | MessageAbortedError | ApiError - parentID: string - modelID: string - providerID: string - mode: string - agent: string - path: { - cwd: string - root: string - } - summary?: boolean - cost: number - tokens: { - input: number - output: number - reasoning: number - cache: { - read: number - write: number - } - } - finish?: string -} + id: string; + sessionID: string; + role: 'assistant'; + time: { + created: number; + completed?: number; + }; + error?: ProviderAuthError | UnknownError | MessageOutputLengthError | MessageAbortedError | ApiError; + parentID: string; + modelID: string; + providerID: string; + mode: string; + agent: string; + path: { + cwd: string; + root: string; + }; + summary?: boolean; + cost: number; + tokens: { + input: number; + output: number; + reasoning: number; + cache: { + read: number; + write: number; + }; + }; + finish?: string; +}; -export type Message = UserMessage | AssistantMessage +export type Message = UserMessage | AssistantMessage; export type EventMessageUpdated = { - type: "message.updated" - properties: { - info: Message - } -} + type: 'message.updated'; + properties: { + info: Message; + }; +}; export type EventMessageRemoved = { - type: "message.removed" - properties: { - sessionID: string - messageID: string - } -} + type: 'message.removed'; + properties: { + sessionID: string; + messageID: string; + }; +}; export type TextPart = { - id: string - sessionID: string - messageID: string - type: "text" - text: string - synthetic?: boolean - ignored?: boolean - time?: { - start: number - end?: number - } - metadata?: { - [key: string]: unknown - } -} + id: string; + sessionID: string; + messageID: string; + type: 'text'; + text: string; + synthetic?: boolean; + ignored?: boolean; + time?: { + start: number; + end?: number; + }; + metadata?: { + [key: string]: unknown; + }; +}; export type ReasoningPart = { - id: string - sessionID: string - messageID: string - type: "reasoning" - text: string - metadata?: { - [key: string]: unknown - } - time: { - start: number - end?: number - } -} + id: string; + sessionID: string; + messageID: string; + type: 'reasoning'; + text: string; + metadata?: { + [key: string]: unknown; + }; + time: { + start: number; + end?: number; + }; +}; export type FilePartSourceText = { - value: string - start: number - end: number -} + value: string; + start: number; + end: number; +}; export type FileSource = { - text: FilePartSourceText - type: "file" - path: string -} + text: FilePartSourceText; + type: 'file'; + path: string; +}; export type Range = { - start: { - line: number - character: number - } - end: { - line: number - character: number - } -} + start: { + line: number; + character: number; + }; + end: { + line: number; + character: number; + }; +}; export type SymbolSource = { - text: FilePartSourceText - type: "symbol" - path: string - range: Range - name: string - kind: number -} + text: FilePartSourceText; + type: 'symbol'; + path: string; + range: Range; + name: string; + kind: number; +}; export type ResourceSource = { - text: FilePartSourceText - type: "resource" - clientName: string - uri: string -} + text: FilePartSourceText; + type: 'resource'; + clientName: string; + uri: string; +}; -export type FilePartSource = FileSource | SymbolSource | ResourceSource +export type FilePartSource = FileSource | SymbolSource | ResourceSource; export type FilePart = { - id: string - sessionID: string - messageID: string - type: "file" - mime: string - filename?: string - url: string - source?: FilePartSource -} + id: string; + sessionID: string; + messageID: string; + type: 'file'; + mime: string; + filename?: string; + url: string; + source?: FilePartSource; +}; export type ToolStatePending = { - status: "pending" - input: { - [key: string]: unknown - } - raw: string -} + status: 'pending'; + input: { + [key: string]: unknown; + }; + raw: string; +}; export type ToolStateRunning = { - status: "running" - input: { - [key: string]: unknown - } - title?: string - metadata?: { - [key: string]: unknown - } - time: { - start: number - } -} + status: 'running'; + input: { + [key: string]: unknown; + }; + title?: string; + metadata?: { + [key: string]: unknown; + }; + time: { + start: number; + }; +}; export type ToolStateCompleted = { - status: "completed" - input: { - [key: string]: unknown - } - output: string - title: string - metadata: { - [key: string]: unknown - } - time: { - start: number - end: number - compacted?: number - } - attachments?: Array -} + status: 'completed'; + input: { + [key: string]: unknown; + }; + output: string; + title: string; + metadata: { + [key: string]: unknown; + }; + time: { + start: number; + end: number; + compacted?: number; + }; + attachments?: Array; +}; export type ToolStateError = { - status: "error" - input: { - [key: string]: unknown - } - error: string - metadata?: { - [key: string]: unknown - } - time: { - start: number - end: number - } -} + status: 'error'; + input: { + [key: string]: unknown; + }; + error: string; + metadata?: { + [key: string]: unknown; + }; + time: { + start: number; + end: number; + }; +}; -export type ToolState = ToolStatePending | ToolStateRunning | ToolStateCompleted | ToolStateError +export type ToolState = ToolStatePending | ToolStateRunning | ToolStateCompleted | ToolStateError; export type ToolPart = { - id: string - sessionID: string - messageID: string - type: "tool" - callID: string - tool: string - state: ToolState - metadata?: { - [key: string]: unknown - } -} + id: string; + sessionID: string; + messageID: string; + type: 'tool'; + callID: string; + tool: string; + state: ToolState; + metadata?: { + [key: string]: unknown; + }; +}; export type StepStartPart = { - id: string - sessionID: string - messageID: string - type: "step-start" - snapshot?: string -} + id: string; + sessionID: string; + messageID: string; + type: 'step-start'; + snapshot?: string; +}; export type StepFinishPart = { - id: string - sessionID: string - messageID: string - type: "step-finish" - reason: string - snapshot?: string - cost: number - tokens: { - input: number - output: number - reasoning: number - cache: { - read: number - write: number - } - } -} + id: string; + sessionID: string; + messageID: string; + type: 'step-finish'; + reason: string; + snapshot?: string; + cost: number; + tokens: { + input: number; + output: number; + reasoning: number; + cache: { + read: number; + write: number; + }; + }; +}; export type SnapshotPart = { - id: string - sessionID: string - messageID: string - type: "snapshot" - snapshot: string -} + id: string; + sessionID: string; + messageID: string; + type: 'snapshot'; + snapshot: string; +}; export type PatchPart = { - id: string - sessionID: string - messageID: string - type: "patch" - hash: string - files: Array -} + id: string; + sessionID: string; + messageID: string; + type: 'patch'; + hash: string; + files: Array; +}; export type AgentPart = { - id: string - sessionID: string - messageID: string - type: "agent" - name: string - source?: { - value: string - start: number - end: number - } -} + id: string; + sessionID: string; + messageID: string; + type: 'agent'; + name: string; + source?: { + value: string; + start: number; + end: number; + }; +}; export type RetryPart = { - id: string - sessionID: string - messageID: string - type: "retry" - attempt: number - error: ApiError - time: { - created: number - } -} + id: string; + sessionID: string; + messageID: string; + type: 'retry'; + attempt: number; + error: ApiError; + time: { + created: number; + }; +}; export type CompactionPart = { - id: string - sessionID: string - messageID: string - type: "compaction" - auto: boolean -} + id: string; + sessionID: string; + messageID: string; + type: 'compaction'; + auto: boolean; +}; -export type Part = - | TextPart - | { - id: string - sessionID: string - messageID: string - type: "subtask" - prompt: string - description: string - agent: string - command?: string - } - | ReasoningPart - | FilePart - | ToolPart - | StepStartPart - | StepFinishPart - | SnapshotPart - | PatchPart - | AgentPart - | RetryPart - | CompactionPart +export type Part = TextPart | { + id: string; + sessionID: string; + messageID: string; + type: 'subtask'; + prompt: string; + description: string; + agent: string; + command?: string; +} | ReasoningPart | FilePart | ToolPart | StepStartPart | StepFinishPart | SnapshotPart | PatchPart | AgentPart | RetryPart | CompactionPart; export type EventMessagePartUpdated = { - type: "message.part.updated" - properties: { - part: Part - delta?: string - } -} + type: 'message.part.updated'; + properties: { + part: Part; + delta?: string; + }; +}; export type EventMessagePartRemoved = { - type: "message.part.removed" - properties: { - sessionID: string - messageID: string - partID: string - } -} + type: 'message.part.removed'; + properties: { + sessionID: string; + messageID: string; + partID: string; + }; +}; export type PermissionRequest = { - id: string - sessionID: string - permission: string - patterns: Array - metadata: { - [key: string]: unknown - } - always: Array - tool?: { - messageID: string - callID: string - } -} + id: string; + sessionID: string; + permission: string; + patterns: Array; + metadata: { + [key: string]: unknown; + }; + always: Array; + tool?: { + messageID: string; + callID: string; + }; +}; export type EventPermissionAsked = { - type: "permission.asked" - properties: PermissionRequest -} + type: 'permission.asked'; + properties: PermissionRequest; +}; export type EventPermissionReplied = { - type: "permission.replied" - properties: { - sessionID: string - requestID: string - reply: "once" | "always" | "reject" - } -} + type: 'permission.replied'; + properties: { + sessionID: string; + requestID: string; + reply: 'once' | 'always' | 'reject'; + }; +}; -export type SessionStatus = - | { - type: "idle" - } - | { - type: "retry" - attempt: number - message: string - next: number - } - | { - type: "busy" - } +export type SessionStatus = { + type: 'idle'; +} | { + type: 'retry'; + attempt: number; + message: string; + next: number; +} | { + type: 'busy'; +}; export type EventSessionStatus = { - type: "session.status" - properties: { - sessionID: string - status: SessionStatus - } -} + type: 'session.status'; + properties: { + sessionID: string; + status: SessionStatus; + }; +}; export type EventSessionIdle = { - type: "session.idle" - properties: { - sessionID: string - } -} + type: 'session.idle'; + properties: { + sessionID: string; + }; +}; + +export type EventCircuitBreakerStateChanged = { + type: 'circuit-breaker.state-changed'; + properties: { + providerID: string; + previousState: 'closed' | 'open' | 'half_open'; + newState: 'closed' | 'open' | 'half_open'; + reason: string; + }; +}; + +export type EventFallbackUsed = { + type: 'fallback.used'; + properties: { + sessionID: string; + originalProvider: string; + originalModel: string; + fallbackProvider: string; + fallbackModel: string; + reason: string; + attempt: number; + }; +}; + +export type EventFallbackExhausted = { + type: 'fallback.exhausted'; + properties: { + sessionID: string; + originalProvider: string; + originalModel: string; + attempted: Array; + lastError: string; + }; +}; export type QuestionOption = { - /** - * Display text (1-5 words, concise) - */ - label: string - /** - * Explanation of choice - */ - description: string -} + /** + * Display text (1-5 words, concise) + */ + label: string; + /** + * Explanation of choice + */ + description: string; +}; export type QuestionInfo = { - /** - * Complete question - */ - question: string - /** - * Very short label (max 12 chars) - */ - header: string - /** - * Available choices - */ - options: Array -} + /** + * Complete question + */ + question: string; + /** + * Very short label (max 12 chars) + */ + header: string; + /** + * Available choices + */ + options: Array; +}; export type QuestionRequest = { - id: string - sessionID: string - /** - * Questions to ask - */ - questions: Array - tool?: { - messageID: string - callID: string - } -} + id: string; + sessionID: string; + /** + * Questions to ask + */ + questions: Array; + tool?: { + messageID: string; + callID: string; + }; +}; export type EventQuestionAsked = { - type: "question.asked" - properties: QuestionRequest -} + type: 'question.asked'; + properties: QuestionRequest; +}; export type EventQuestionReplied = { - type: "question.replied" - properties: { - sessionID: string - requestID: string - answers: Array - } -} + type: 'question.replied'; + properties: { + sessionID: string; + requestID: string; + answers: Array; + }; +}; export type EventQuestionRejected = { - type: "question.rejected" - properties: { - sessionID: string - requestID: string - } -} + type: 'question.rejected'; + properties: { + sessionID: string; + requestID: string; + }; +}; export type EventSessionCompacted = { - type: "session.compacted" - properties: { - sessionID: string - } -} + type: 'session.compacted'; + properties: { + sessionID: string; + }; +}; export type EventFileEdited = { - type: "file.edited" - properties: { - file: string - } -} + type: 'file.edited'; + properties: { + file: string; + }; +}; export type Todo = { - /** - * Brief description of the task - */ - content: string - /** - * Current status of the task: pending, in_progress, completed, cancelled - */ - status: string - /** - * Priority level of the task: high, medium, low - */ - priority: string - /** - * Unique identifier for the todo item - */ - id: string -} + /** + * Brief description of the task + */ + content: string; + /** + * Current status of the task: pending, in_progress, completed, cancelled + */ + status: string; + /** + * Priority level of the task: high, medium, low + */ + priority: string; + /** + * Unique identifier for the todo item + */ + id: string; +}; export type EventTodoUpdated = { - type: "todo.updated" - properties: { - sessionID: string - todos: Array - } -} + type: 'todo.updated'; + properties: { + sessionID: string; + todos: Array; + }; +}; export type EventTuiPromptAppend = { - type: "tui.prompt.append" - properties: { - text: string - } -} + 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.half.page.up" - | "session.half.page.down" - | "session.first" - | "session.last" - | "prompt.clear" - | "prompt.submit" - | "agent.cycle" - | string - } -} + type: 'tui.command.execute'; + properties: { + command: 'session.list' | 'session.new' | 'session.share' | 'session.interrupt' | 'session.compact' | 'session.page.up' | 'session.page.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 - } -} + 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 - } -} + type: 'tui.session.select'; + properties: { + /** + * Session ID to navigate to + */ + sessionID: string; + }; +}; export type EventMcpToolsChanged = { - type: "mcp.tools.changed" - properties: { - server: string - } -} + type: 'mcp.tools.changed'; + properties: { + server: string; + }; +}; export type EventCommandExecuted = { - type: "command.executed" - properties: { - name: string - sessionID: string - arguments: string - messageID: string - } -} + type: 'command.executed'; + properties: { + name: string; + sessionID: string; + arguments: string; + messageID: string; + }; +}; -export type PermissionAction = "allow" | "deny" | "ask" +export type PermissionAction = 'allow' | 'deny' | 'ask'; export type PermissionRule = { - permission: string - pattern: string - action: PermissionAction -} + permission: string; + pattern: string; + action: PermissionAction; +}; -export type PermissionRuleset = Array +export type PermissionRuleset = Array; export type Session = { - id: string - projectID: string - directory: string - parentID?: string - summary?: { - additions: number - deletions: number - files: number - diffs?: Array - } - share?: { - url: string - } - title: string - version: string - time: { - created: number - updated: number - compacting?: number - archived?: number - } - permission?: PermissionRuleset - revert?: { - messageID: string - partID?: string - snapshot?: string - diff?: string - } -} + id: string; + projectID: string; + directory: string; + parentID?: string; + summary?: { + additions: number; + deletions: number; + files: number; + diffs?: Array; + }; + share?: { + url: string; + }; + title: string; + version: string; + time: { + created: number; + updated: number; + compacting?: number; + archived?: number; + }; + permission?: PermissionRuleset; + revert?: { + messageID: string; + partID?: string; + snapshot?: string; + diff?: string; + }; +}; export type EventSessionCreated = { - type: "session.created" - properties: { - info: Session - } -} + type: 'session.created'; + properties: { + info: Session; + }; +}; export type EventSessionUpdated = { - type: "session.updated" - properties: { - info: Session - } -} + type: 'session.updated'; + properties: { + info: Session; + }; +}; export type EventSessionDeleted = { - type: "session.deleted" - properties: { - info: Session - } -} + type: 'session.deleted'; + properties: { + info: Session; + }; +}; export type EventSessionDiff = { - type: "session.diff" - properties: { - sessionID: string - diff: Array - } -} + type: 'session.diff'; + properties: { + sessionID: string; + diff: Array; + }; +}; export type EventSessionError = { - type: "session.error" - properties: { - sessionID?: string - error?: ProviderAuthError | UnknownError | MessageOutputLengthError | MessageAbortedError | ApiError - } -} + type: 'session.error'; + properties: { + sessionID?: string; + error?: ProviderAuthError | UnknownError | MessageOutputLengthError | MessageAbortedError | ApiError; + }; +}; export type EventFileWatcherUpdated = { - type: "file.watcher.updated" - properties: { - file: string - event: "add" | "change" | "unlink" - } -} + type: 'file.watcher.updated'; + properties: { + file: string; + event: 'add' | 'change' | 'unlink'; + }; +}; export type EventVcsBranchUpdated = { - type: "vcs.branch.updated" - properties: { - branch?: string - } -} + type: 'vcs.branch.updated'; + properties: { + branch?: string; + }; +}; export type Pty = { - id: string - title: string - command: string - args: Array - cwd: string - status: "running" | "exited" - pid: number -} + id: string; + title: string; + command: string; + args: Array; + cwd: string; + status: 'running' | 'exited'; + pid: number; +}; export type EventPtyCreated = { - type: "pty.created" - properties: { - info: Pty - } -} + type: 'pty.created'; + properties: { + info: Pty; + }; +}; export type EventPtyUpdated = { - type: "pty.updated" - properties: { - info: Pty - } -} + type: 'pty.updated'; + properties: { + info: Pty; + }; +}; export type EventPtyExited = { - type: "pty.exited" - properties: { - id: string - exitCode: number - } -} + type: 'pty.exited'; + properties: { + id: string; + exitCode: number; + }; +}; export type EventPtyDeleted = { - type: "pty.deleted" - properties: { - id: string - } -} + type: 'pty.deleted'; + properties: { + id: string; + }; +}; export type EventServerConnected = { - type: "server.connected" - properties: { - [key: string]: unknown - } -} + type: 'server.connected'; + properties: { + [key: string]: unknown; + }; +}; export type EventGlobalDisposed = { - type: "global.disposed" - properties: { - [key: string]: unknown - } -} + type: 'global.disposed'; + properties: { + [key: string]: unknown; + }; +}; -export type Event = - | EventInstallationUpdated - | EventInstallationUpdateAvailable - | EventProjectUpdated - | EventServerInstanceDisposed - | EventLspClientDiagnostics - | EventLspUpdated - | EventMessageUpdated - | EventMessageRemoved - | EventMessagePartUpdated - | EventMessagePartRemoved - | EventPermissionAsked - | EventPermissionReplied - | EventSessionStatus - | EventSessionIdle - | EventQuestionAsked - | EventQuestionReplied - | EventQuestionRejected - | EventSessionCompacted - | EventFileEdited - | EventTodoUpdated - | EventTuiPromptAppend - | EventTuiCommandExecute - | EventTuiToastShow - | EventTuiSessionSelect - | EventMcpToolsChanged - | EventCommandExecuted - | EventSessionCreated - | EventSessionUpdated - | EventSessionDeleted - | EventSessionDiff - | EventSessionError - | EventFileWatcherUpdated - | EventVcsBranchUpdated - | EventPtyCreated - | EventPtyUpdated - | EventPtyExited - | EventPtyDeleted - | EventServerConnected - | EventGlobalDisposed +export type EventDaemonStart = { + type: 'daemon.start'; + properties: { + pid: number; + port: number; + hostname: string; + directory: string; + startTime: number; + }; +}; + +export type EventDaemonReady = { + type: 'daemon.ready'; + properties: { + pid: number; + port: number; + services: { + persistence: boolean; + telegram: boolean; + discord: boolean; + }; + sessionsWithIncompleteTodos: number; + }; +}; + +export type EventDaemonShutdown = { + type: 'daemon.shutdown'; + properties: { + pid: number; + reason: 'signal' | 'error' | 'manual'; + signal?: string; + error?: string; + uptime: number; + }; +}; + +export type EventSessionLifecycleStart = { + type: 'session.lifecycle.start'; + properties: { + sessionId: string; + persona: 'zee' | 'stanley' | 'johny'; + source: 'daemon' | 'telegram' | 'tui' | 'cli'; + chatId?: number; + directory: string; + }; +}; + +export type EventSessionLifecycleRestore = { + type: 'session.lifecycle.restore'; + properties: { + sessionId: string; + persona: 'zee' | 'stanley' | 'johny'; + source: 'daemon' | 'telegram' | 'tui' | 'cli'; + chatId?: number; + hasTodos: boolean; + incompleteTodos: number; + triggerContinuation: boolean; + }; +}; + +export type EventSessionLifecycleEnd = { + type: 'session.lifecycle.end'; + properties: { + sessionId: string; + persona?: 'zee' | 'stanley' | 'johny'; + reason: 'completed' | 'suspended' | 'timeout' | 'error'; + duration: number; + todosCompleted: number; + todosRemaining: number; + }; +}; + +export type EventSessionLifecycleTransfer = { + type: 'session.lifecycle.transfer'; + properties: { + sessionId: string; + fromContext: 'daemon' | 'telegram' | 'tui' | 'cli'; + toContext: 'daemon' | 'telegram' | 'tui' | 'cli'; + fromDevice?: string; + toDevice?: string; + }; +}; + +export type EventTodoLifecycleContinuation = { + type: 'todo.lifecycle.continuation'; + properties: { + sessionId: string; + totalTodos: number; + completedTodos: number; + remainingTodos: number; + percentage: number; + proceedWithoutAsking: boolean; + reminderMessage: string; + }; +}; + +export type EventTodoLifecycleCompleted = { + type: 'todo.lifecycle.completed'; + properties: { + sessionId: string; + totalTodos: number; + duration: number; + }; +}; + +export type EventTodoLifecycleBlocked = { + type: 'todo.lifecycle.blocked'; + properties: { + sessionId: string; + todoId: string; + todoContent: string; + reason: string; + needsInput: boolean; + }; +}; + +export type Event = EventInstallationUpdated | EventInstallationUpdateAvailable | EventProjectUpdated | EventServerInstanceDisposed | EventLspClientDiagnostics | EventLspUpdated | EventMessageUpdated | EventMessageRemoved | EventMessagePartUpdated | EventMessagePartRemoved | EventPermissionAsked | EventPermissionReplied | EventSessionStatus | EventSessionIdle | EventCircuitBreakerStateChanged | EventFallbackUsed | EventFallbackExhausted | EventQuestionAsked | EventQuestionReplied | EventQuestionRejected | EventSessionCompacted | EventFileEdited | EventTodoUpdated | EventTuiPromptAppend | EventTuiCommandExecute | EventTuiToastShow | EventTuiSessionSelect | EventMcpToolsChanged | EventCommandExecuted | EventSessionCreated | EventSessionUpdated | EventSessionDeleted | EventSessionDiff | EventSessionError | EventFileWatcherUpdated | EventVcsBranchUpdated | EventPtyCreated | EventPtyUpdated | EventPtyExited | EventPtyDeleted | EventServerConnected | EventGlobalDisposed | EventDaemonStart | EventDaemonReady | EventDaemonShutdown | EventSessionLifecycleStart | EventSessionLifecycleRestore | EventSessionLifecycleEnd | EventSessionLifecycleTransfer | EventTodoLifecycleContinuation | EventTodoLifecycleCompleted | EventTodoLifecycleBlocked; export type GlobalEvent = { - directory: string - payload: Event -} + directory: string; + payload: Event; +}; export type BadRequestError = { - data: unknown - errors: Array<{ - [key: string]: unknown - }> - success: false -} + data: unknown; + errors: Array<{ + [key: string]: unknown; + }>; + success: false; +}; export type NotFoundError = { - name: "NotFoundError" - data: { - message: string - } -} + name: 'NotFoundError'; + data: { + message: string; + }; +}; /** * Custom keybind configurations */ export type KeybindsConfig = { - /** - * Leader key for keybind combinations - */ - leader?: string - /** - * Exit the application - */ - app_exit?: string - /** - * Open external editor - */ - editor_open?: string - /** - * List available themes - */ - theme_list?: string - /** - * Toggle sidebar - */ - sidebar_toggle?: string - /** - * Toggle session scrollbar - */ - scrollbar_toggle?: string - /** - * Toggle username visibility - */ - username_toggle?: string - /** - * View status - */ - status_view?: string - /** - * Export session to editor - */ - session_export?: string - /** - * Create a new session - */ - session_new?: string - /** - * List all sessions - */ - session_list?: string - /** - * Show session timeline - */ - session_timeline?: string - /** - * Fork session from message - */ - session_fork?: string - /** - * Rename session - */ - session_rename?: string - /** - * Share current session - */ - session_share?: string - /** - * Unshare current session - */ - session_unshare?: string - /** - * Interrupt current session - */ - session_interrupt?: string - /** - * Compact the session - */ - session_compact?: string - /** - * Scroll messages up by one page - */ - messages_page_up?: string - /** - * Scroll messages down by one page - */ - messages_page_down?: string - /** - * Scroll messages up by half page - */ - messages_half_page_up?: string - /** - * Scroll messages down by half page - */ - messages_half_page_down?: string - /** - * Navigate to first message - */ - messages_first?: string - /** - * Navigate to last message - */ - messages_last?: string - /** - * Navigate to next message - */ - messages_next?: string - /** - * Navigate to previous message - */ - messages_previous?: string - /** - * Navigate to last user message - */ - messages_last_user?: string - /** - * Copy message - */ - messages_copy?: string - /** - * Undo message - */ - messages_undo?: string - /** - * Redo message - */ - messages_redo?: string - /** - * Toggle code block concealment in messages - */ - messages_toggle_conceal?: string - /** - * Toggle tool details visibility - */ - tool_details?: string - /** - * List available models - */ - model_list?: string - /** - * Next recently used model - */ - model_cycle_recent?: string - /** - * Previous recently used model - */ - model_cycle_recent_reverse?: string - /** - * Next favorite model - */ - model_cycle_favorite?: string - /** - * Previous favorite model - */ - model_cycle_favorite_reverse?: string - /** - * List available commands - */ - command_list?: string - /** - * List agents - */ - agent_list?: string - /** - * Next agent - */ - agent_cycle?: string - /** - * Previous agent - */ - agent_cycle_reverse?: string - /** - * Cycle model variants - */ - variant_cycle?: string - /** - * Clear input field - */ - input_clear?: string - /** - * Paste from clipboard - */ - input_paste?: string - /** - * Submit input - */ - input_submit?: string - /** - * Insert newline in input - */ - input_newline?: string - /** - * Move cursor left in input - */ - input_move_left?: string - /** - * Move cursor right in input - */ - input_move_right?: string - /** - * Move cursor up in input - */ - input_move_up?: string - /** - * Move cursor down in input - */ - input_move_down?: string - /** - * Select left in input - */ - input_select_left?: string - /** - * Select right in input - */ - input_select_right?: string - /** - * Select up in input - */ - input_select_up?: string - /** - * Select down in input - */ - input_select_down?: string - /** - * Move to start of line in input - */ - input_line_home?: string - /** - * Move to end of line in input - */ - input_line_end?: string - /** - * Select to start of line in input - */ - input_select_line_home?: string - /** - * Select to end of line in input - */ - input_select_line_end?: string - /** - * Move to start of visual line in input - */ - input_visual_line_home?: string - /** - * Move to end of visual line in input - */ - input_visual_line_end?: string - /** - * Select to start of visual line in input - */ - input_select_visual_line_home?: string - /** - * Select to end of visual line in input - */ - input_select_visual_line_end?: string - /** - * Move to start of buffer in input - */ - input_buffer_home?: string - /** - * Move to end of buffer in input - */ - input_buffer_end?: string - /** - * Select to start of buffer in input - */ - input_select_buffer_home?: string - /** - * Select to end of buffer in input - */ - input_select_buffer_end?: string - /** - * Delete line in input - */ - input_delete_line?: string - /** - * Delete to end of line in input - */ - input_delete_to_line_end?: string - /** - * Delete to start of line in input - */ - input_delete_to_line_start?: string - /** - * Backspace in input - */ - input_backspace?: string - /** - * Delete character in input - */ - input_delete?: string - /** - * Undo in input - */ - input_undo?: string - /** - * Redo in input - */ - input_redo?: string - /** - * Move word forward in input - */ - input_word_forward?: string - /** - * Move word backward in input - */ - input_word_backward?: string - /** - * Select word forward in input - */ - input_select_word_forward?: string - /** - * Select word backward in input - */ - input_select_word_backward?: string - /** - * Delete word forward in input - */ - input_delete_word_forward?: string - /** - * Delete word backward in input - */ - input_delete_word_backward?: string - /** - * Previous history item - */ - history_previous?: string - /** - * Next history item - */ - history_next?: string - /** - * Next child session - */ - session_child_cycle?: string - /** - * Previous child session - */ - session_child_cycle_reverse?: string - /** - * Go to parent session - */ - session_parent?: string - /** - * Suspend terminal - */ - terminal_suspend?: string - /** - * Toggle terminal title - */ - terminal_title_toggle?: string - /** - * Toggle tips on home screen - */ - tips_toggle?: string -} + /** + * Leader key for keybind combinations + */ + leader?: string; + /** + * Exit the application + */ + app_exit?: string; + /** + * Open external editor + */ + editor_open?: string; + /** + * List available themes + */ + theme_list?: string; + /** + * Toggle sidebar + */ + sidebar_toggle?: string; + /** + * Toggle session scrollbar + */ + scrollbar_toggle?: string; + /** + * Toggle username visibility + */ + username_toggle?: string; + /** + * View status + */ + status_view?: string; + /** + * Export session to editor + */ + session_export?: string; + /** + * Create a new session + */ + session_new?: string; + /** + * List all sessions + */ + session_list?: string; + /** + * Show session timeline + */ + session_timeline?: string; + /** + * Fork session from message + */ + session_fork?: string; + /** + * Rename session + */ + session_rename?: string; + /** + * Share current session + */ + session_share?: string; + /** + * Unshare current session + */ + session_unshare?: string; + /** + * Interrupt current session + */ + session_interrupt?: string; + /** + * Compact the session + */ + session_compact?: string; + /** + * Scroll messages up by one page + */ + messages_page_up?: string; + /** + * Scroll messages down by one page + */ + messages_page_down?: string; + /** + * Scroll messages up by half page + */ + messages_half_page_up?: string; + /** + * Scroll messages down by half page + */ + messages_half_page_down?: string; + /** + * Navigate to first message + */ + messages_first?: string; + /** + * Navigate to last message + */ + messages_last?: string; + /** + * Navigate to next message + */ + messages_next?: string; + /** + * Navigate to previous message + */ + messages_previous?: string; + /** + * Navigate to last user message + */ + messages_last_user?: string; + /** + * Copy message + */ + messages_copy?: string; + /** + * Undo message + */ + messages_undo?: string; + /** + * Redo message + */ + messages_redo?: string; + /** + * Toggle code block concealment in messages + */ + messages_toggle_conceal?: string; + /** + * Toggle tool details visibility + */ + tool_details?: string; + /** + * List available models + */ + model_list?: string; + /** + * Next recently used model + */ + model_cycle_recent?: string; + /** + * Previous recently used model + */ + model_cycle_recent_reverse?: string; + /** + * Next favorite model + */ + model_cycle_favorite?: string; + /** + * Previous favorite model + */ + model_cycle_favorite_reverse?: string; + /** + * List available commands + */ + command_list?: string; + /** + * List agents + */ + agent_list?: string; + /** + * Next agent + */ + agent_cycle?: string; + /** + * Previous agent + */ + agent_cycle_reverse?: string; + /** + * Toggle hold/release mode + */ + mode_toggle?: string; + /** + * Cycle model variants + */ + variant_cycle?: string; + /** + * Clear input field + */ + input_clear?: string; + /** + * Paste from clipboard + */ + input_paste?: string; + /** + * Submit input + */ + input_submit?: string; + /** + * Insert newline in input + */ + input_newline?: string; + /** + * Move cursor left in input + */ + input_move_left?: string; + /** + * Move cursor right in input + */ + input_move_right?: string; + /** + * Move cursor up in input + */ + input_move_up?: string; + /** + * Move cursor down in input + */ + input_move_down?: string; + /** + * Select left in input + */ + input_select_left?: string; + /** + * Select right in input + */ + input_select_right?: string; + /** + * Select up in input + */ + input_select_up?: string; + /** + * Select down in input + */ + input_select_down?: string; + /** + * Move to start of line in input + */ + input_line_home?: string; + /** + * Move to end of line in input + */ + input_line_end?: string; + /** + * Select to start of line in input + */ + input_select_line_home?: string; + /** + * Select to end of line in input + */ + input_select_line_end?: string; + /** + * Move to start of visual line in input + */ + input_visual_line_home?: string; + /** + * Move to end of visual line in input + */ + input_visual_line_end?: string; + /** + * Select to start of visual line in input + */ + input_select_visual_line_home?: string; + /** + * Select to end of visual line in input + */ + input_select_visual_line_end?: string; + /** + * Move to start of buffer in input + */ + input_buffer_home?: string; + /** + * Move to end of buffer in input + */ + input_buffer_end?: string; + /** + * Select to start of buffer in input + */ + input_select_buffer_home?: string; + /** + * Select to end of buffer in input + */ + input_select_buffer_end?: string; + /** + * Delete line in input + */ + input_delete_line?: string; + /** + * Delete to end of line in input + */ + input_delete_to_line_end?: string; + /** + * Delete to start of line in input + */ + input_delete_to_line_start?: string; + /** + * Backspace in input + */ + input_backspace?: string; + /** + * Delete character in input + */ + input_delete?: string; + /** + * Undo in input + */ + input_undo?: string; + /** + * Redo in input + */ + input_redo?: string; + /** + * Move word forward in input + */ + input_word_forward?: string; + /** + * Move word backward in input + */ + input_word_backward?: string; + /** + * Select word forward in input + */ + input_select_word_forward?: string; + /** + * Select word backward in input + */ + input_select_word_backward?: string; + /** + * Delete word forward in input + */ + input_delete_word_forward?: string; + /** + * Delete word backward in input + */ + input_delete_word_backward?: string; + /** + * Previous history item + */ + history_previous?: string; + /** + * Next history item + */ + history_next?: string; + /** + * Next child session + */ + session_child_cycle?: string; + /** + * Previous child session + */ + session_child_cycle_reverse?: string; + /** + * Go to parent session + */ + session_parent?: string; + /** + * Suspend terminal + */ + terminal_suspend?: string; + /** + * Toggle terminal title + */ + terminal_title_toggle?: string; + /** + * Toggle tips on home screen + */ + tips_toggle?: string; +}; /** * Log level */ -export type LogLevel = "DEBUG" | "INFO" | "WARN" | "ERROR" +export type LogLevel = 'DEBUG' | 'INFO' | 'WARN' | 'ERROR'; /** * Server configuration for opencode serve and web commands */ export type ServerConfig = { - /** - * Port to listen on - */ - port?: number - /** - * Hostname to listen on - */ - hostname?: string - /** - * Enable mDNS service discovery - */ - mdns?: boolean - /** - * Additional domains to allow for CORS - */ - cors?: Array -} + /** + * Port to listen on + */ + port?: number; + /** + * Hostname to listen on + */ + hostname?: string; + /** + * Enable mDNS service discovery + */ + mdns?: boolean; + /** + * Additional domains to allow for CORS + */ + cors?: Array; +}; -export type PermissionActionConfig = "ask" | "allow" | "deny" +/** + * Daemon mode configuration for headless operation + */ +export type DaemonConfig = { + /** + * Enable daemon mode + */ + enabled?: boolean; + /** + * Session management configuration + */ + session?: { + /** + * Enable session persistence + */ + persistence?: boolean; + /** + * Checkpoint interval in seconds + */ + checkpoint_interval?: number; + /** + * Enable crash recovery + */ + recovery?: boolean; + }; + /** + * Todo continuation configuration + */ + todo?: { + /** + * Automatically continue incomplete todos on session restore + */ + auto_continue?: boolean; + /** + * Send notifications for incomplete todos + */ + notify_on_incomplete?: boolean; + }; + /** + * Remote communication gateway configuration + */ + gateway?: { + /** + * Telegram gateway configuration + */ + telegram?: { + /** + * Enable Telegram bot gateway + */ + enabled?: boolean; + /** + * Telegram bot token + */ + bot_token?: string; + }; + /** + * Discord gateway configuration + */ + discord?: { + /** + * Enable Discord bot gateway + */ + enabled?: boolean; + /** + * Discord bot token + */ + bot_token?: string; + }; + }; +}; + +export type PermissionActionConfig = 'ask' | 'allow' | 'deny'; export type PermissionObjectConfig = { - [key: string]: PermissionActionConfig -} + [key: string]: PermissionActionConfig; +}; -export type PermissionRuleConfig = PermissionActionConfig | PermissionObjectConfig +export type PermissionRuleConfig = PermissionActionConfig | PermissionObjectConfig; -export type PermissionConfig = - | { - __originalKeys?: Array - read?: PermissionRuleConfig - edit?: PermissionRuleConfig - glob?: PermissionRuleConfig - grep?: PermissionRuleConfig - list?: PermissionRuleConfig - bash?: PermissionRuleConfig - task?: PermissionRuleConfig - external_directory?: PermissionRuleConfig - todowrite?: PermissionActionConfig - todoread?: PermissionActionConfig - question?: PermissionActionConfig - webfetch?: PermissionActionConfig - websearch?: PermissionActionConfig - codesearch?: PermissionActionConfig - lsp?: PermissionRuleConfig - doom_loop?: PermissionActionConfig - [key: string]: PermissionRuleConfig | Array | PermissionActionConfig | undefined - } - | PermissionActionConfig +export type PermissionConfig = { + __originalKeys?: Array; + read?: PermissionRuleConfig; + edit?: PermissionRuleConfig; + glob?: PermissionRuleConfig; + grep?: PermissionRuleConfig; + list?: PermissionRuleConfig; + bash?: PermissionRuleConfig; + task?: PermissionRuleConfig; + external_directory?: PermissionRuleConfig; + todowrite?: PermissionActionConfig; + todoread?: PermissionActionConfig; + question?: PermissionActionConfig; + webfetch?: PermissionActionConfig; + websearch?: PermissionActionConfig; + codesearch?: PermissionActionConfig; + lsp?: PermissionRuleConfig; + doom_loop?: PermissionActionConfig; + [key: string]: PermissionRuleConfig | Array | PermissionActionConfig | undefined; +} | PermissionActionConfig; export type AgentConfig = { - model?: string - temperature?: number - top_p?: number - prompt?: string - /** - * @deprecated Use 'permission' field instead - */ - tools?: { - [key: string]: boolean - } - disable?: boolean - /** - * Description of when to use the agent - */ - description?: string - mode?: "subagent" | "primary" | "all" - /** - * Hide this subagent from the @ autocomplete menu (default: false, only applies to mode: subagent) - */ - hidden?: boolean - options?: { - [key: string]: unknown - } - /** - * Hex color code for the agent (e.g., #FF5733) - */ - color?: string - /** - * Maximum number of agentic iterations before forcing text-only response - */ - steps?: number - /** - * @deprecated Use 'steps' field instead. - */ - maxSteps?: number - permission?: PermissionConfig - [key: string]: - | unknown - | string - | number - | { - [key: string]: boolean - } - | boolean - | "subagent" - | "primary" - | "all" - | { - [key: string]: unknown - } - | string - | number - | PermissionConfig - | undefined -} + model?: string; + temperature?: number; + top_p?: number; + prompt?: string; + /** + * @deprecated Use 'permission' field instead + */ + tools?: { + [key: string]: boolean; + }; + disable?: boolean; + /** + * Description of when to use the agent + */ + description?: string; + mode?: 'subagent' | 'primary' | 'all'; + /** + * Hide this subagent from the @ autocomplete menu (default: false, only applies to mode: subagent) + */ + hidden?: boolean; + options?: { + [key: string]: unknown; + }; + /** + * Hex color code for the agent (e.g., #FF5733) + */ + color?: string; + /** + * Maximum number of agentic iterations before forcing text-only response + */ + steps?: number; + /** + * @deprecated Use 'steps' field instead. + */ + maxSteps?: number; + permission?: PermissionConfig; + [key: string]: unknown | string | number | { + [key: string]: boolean; + } | boolean | 'subagent' | 'primary' | 'all' | { + [key: string]: unknown; + } | string | number | PermissionConfig | undefined; +}; export type ProviderConfig = { - api?: string - name?: string - env?: Array - id?: string - npm?: string - models?: { - [key: string]: { - id?: string - name?: string - family?: string - release_date?: string - attachment?: boolean - reasoning?: boolean - temperature?: boolean - tool_call?: boolean - interleaved?: - | true - | { - field: "reasoning_content" | "reasoning_details" - } - cost?: { - input: number - output: number - cache_read?: number - cache_write?: number - context_over_200k?: { - input: number - output: number - cache_read?: number - cache_write?: number - } - } - limit?: { - context: number - output: number - } - modalities?: { - input: Array<"text" | "audio" | "image" | "video" | "pdf"> - output: Array<"text" | "audio" | "image" | "video" | "pdf"> - } - experimental?: boolean - status?: "alpha" | "beta" | "deprecated" - options?: { - [key: string]: unknown - } - headers?: { - [key: string]: string - } - provider?: { - npm: string - } - /** - * Variant-specific configuration - */ - variants?: { + api?: string; + name?: string; + env?: Array; + id?: string; + npm?: string; + models?: { [key: string]: { - /** - * Disable this variant for the model - */ - disabled?: boolean - [key: string]: unknown | boolean | undefined - } - } - } - } - whitelist?: Array - blacklist?: Array - options?: { - apiKey?: string - baseURL?: string - /** - * GitHub Enterprise URL for copilot authentication - */ - enterpriseUrl?: string - /** - * Enable promptCacheKey for this provider (default false) - */ - setCacheKey?: boolean - /** - * Timeout in milliseconds for requests to this provider. Default is 300000 (5 minutes). Set to false to disable timeout. - */ - timeout?: number | false - [key: string]: unknown | string | boolean | number | false | undefined - } -} + id?: string; + name?: string; + family?: string; + release_date?: string; + attachment?: boolean; + reasoning?: boolean; + temperature?: boolean; + tool_call?: boolean; + interleaved?: true | { + field: 'reasoning_content' | 'reasoning_details'; + }; + cost?: { + input: number; + output: number; + cache_read?: number; + cache_write?: number; + context_over_200k?: { + input: number; + output: number; + cache_read?: number; + cache_write?: number; + }; + }; + limit?: { + context: number; + output: number; + }; + modalities?: { + input: Array<'text' | 'audio' | 'image' | 'video' | 'pdf'>; + output: Array<'text' | 'audio' | 'image' | 'video' | 'pdf'>; + }; + experimental?: boolean; + status?: 'alpha' | 'beta' | 'deprecated'; + options?: { + [key: string]: unknown; + }; + headers?: { + [key: string]: string; + }; + provider?: { + npm: string; + }; + /** + * Variant-specific configuration + */ + variants?: { + [key: string]: { + /** + * Disable this variant for the model + */ + disabled?: boolean; + [key: string]: unknown | boolean | undefined; + }; + }; + }; + }; + whitelist?: Array; + blacklist?: Array; + options?: { + apiKey?: string; + baseURL?: string; + /** + * GitHub Enterprise URL for copilot authentication + */ + enterpriseUrl?: string; + /** + * Enable promptCacheKey for this provider (default false) + */ + setCacheKey?: boolean; + /** + * Timeout in milliseconds for requests to this provider. Default is 300000 (5 minutes). Set to false to disable timeout. + */ + timeout?: number | false; + [key: string]: unknown | string | boolean | number | false | undefined; + }; +}; export type McpLocalConfig = { - /** - * Type of MCP server connection - */ - type: "local" - /** - * Command and arguments to run the MCP server - */ - command: Array - /** - * Environment variables to set when running the MCP server - */ - environment?: { - [key: string]: string - } - /** - * Enable or disable the MCP server on startup - */ - enabled?: boolean - /** - * Timeout in ms for fetching tools from the MCP server. Defaults to 5000 (5 seconds) if not specified. - */ - timeout?: number -} + /** + * Type of MCP server connection + */ + type: 'local'; + /** + * Command and arguments to run the MCP server + */ + command: Array; + /** + * Environment variables to set when running the MCP server + */ + environment?: { + [key: string]: string; + }; + /** + * Enable or disable the MCP server on startup + */ + enabled?: boolean; + /** + * Timeout in ms for fetching tools from the MCP server. Defaults to 5000 (5 seconds) if not specified. + */ + timeout?: number; +}; export type McpOAuthConfig = { - /** - * OAuth client ID. If not provided, dynamic client registration (RFC 7591) will be attempted. - */ - clientId?: string - /** - * OAuth client secret (if required by the authorization server) - */ - clientSecret?: string - /** - * OAuth scopes to request during authorization - */ - scope?: string -} + /** + * OAuth client ID. If not provided, dynamic client registration (RFC 7591) will be attempted. + */ + clientId?: string; + /** + * OAuth client secret (if required by the authorization server) + */ + clientSecret?: string; + /** + * OAuth scopes to request during authorization + */ + scope?: string; +}; export type McpRemoteConfig = { - /** - * Type of MCP server connection - */ - type: "remote" - /** - * URL of the remote MCP server - */ - url: string - /** - * Enable or disable the MCP server on startup - */ - enabled?: boolean - /** - * Headers to send with the request - */ - headers?: { - [key: string]: string - } - /** - * OAuth authentication configuration for the MCP server. Set to false to disable OAuth auto-detection. - */ - oauth?: McpOAuthConfig | false - /** - * Timeout in ms for fetching tools from the MCP server. Defaults to 5000 (5 seconds) if not specified. - */ - timeout?: number -} + /** + * Type of MCP server connection + */ + type: 'remote'; + /** + * URL of the remote MCP server + */ + url: string; + /** + * Enable or disable the MCP server on startup + */ + enabled?: boolean; + /** + * Headers to send with the request + */ + headers?: { + [key: string]: string; + }; + /** + * OAuth authentication configuration for the MCP server. Set to false to disable OAuth auto-detection. + */ + oauth?: McpOAuthConfig | false; + /** + * Timeout in ms for fetching tools from the MCP server. Defaults to 5000 (5 seconds) if not specified. + */ + timeout?: number; +}; /** * @deprecated Always uses stretch layout. */ -export type LayoutConfig = "auto" | "stretch" +export type LayoutConfig = 'auto' | 'stretch'; export type Config = { - /** - * JSON schema reference for configuration validation - */ - $schema?: string - /** - * Theme name to use for the interface - */ - theme?: string - keybinds?: KeybindsConfig - logLevel?: LogLevel - /** - * TUI specific settings - */ - tui?: { /** - * TUI scroll speed + * JSON schema reference for configuration validation */ - scroll_speed?: number + $schema?: string; /** - * Scroll acceleration settings + * Theme name to use for the interface */ - scroll_acceleration?: { - /** - * Enable scroll acceleration - */ - enabled: boolean - } + theme?: string; + keybinds?: KeybindsConfig; + logLevel?: LogLevel; /** - * Control diff rendering style: 'auto' adapts to terminal width, 'stacked' always shows single column + * TUI specific settings */ - diff_style?: "auto" | "stacked" - } - server?: ServerConfig - /** - * Command configuration, see https://opencode.ai/docs/commands - */ - command?: { - [key: string]: { - template: string - description?: string - agent?: string - model?: string - subtask?: boolean - } - } - watcher?: { - ignore?: Array - } - plugin?: Array - snapshot?: boolean - /** - * Control sharing behavior:'manual' allows manual sharing via commands, 'auto' enables automatic sharing, 'disabled' disables all sharing - */ - share?: "manual" | "auto" | "disabled" - /** - * @deprecated Use 'share' field instead. Share newly created sessions automatically - */ - autoshare?: boolean - /** - * Automatically update to the latest version. Set to true to auto-update, false to disable, or 'notify' to show update notifications - */ - autoupdate?: boolean | "notify" - /** - * Disable providers that are loaded automatically - */ - disabled_providers?: Array - /** - * When set, ONLY these providers will be enabled. All other providers will be ignored - */ - enabled_providers?: Array - /** - * Model to use in the format of provider/model, eg anthropic/claude-2 - */ - model?: string - /** - * Small model to use for tasks like title generation in the format of provider/model - */ - small_model?: string - /** - * Default agent to use when none is specified. Must be a primary agent. Falls back to 'build' if not set or if the specified agent is invalid. - */ - default_agent?: string - /** - * Custom username to display in conversations instead of system username - */ - username?: string - /** - * @deprecated Use `agent` field instead. - */ - mode?: { - build?: AgentConfig - plan?: AgentConfig - [key: string]: AgentConfig | undefined - } - /** - * Agent configuration, see https://opencode.ai/docs/agent - */ - agent?: { - plan?: AgentConfig - build?: AgentConfig - general?: AgentConfig - explore?: AgentConfig - title?: AgentConfig - summary?: AgentConfig - compaction?: AgentConfig - [key: string]: AgentConfig | undefined - } - /** - * Custom provider configurations and model overrides - */ - provider?: { - [key: string]: ProviderConfig - } - /** - * MCP (Model Context Protocol) server configurations - */ - mcp?: { - [key: string]: - | McpLocalConfig - | McpRemoteConfig - | { - enabled: boolean - } - } - formatter?: - | false - | { + tui?: { + /** + * TUI scroll speed + */ + scroll_speed?: number; + /** + * Scroll acceleration settings + */ + scroll_acceleration?: { + /** + * Enable scroll acceleration + */ + enabled: boolean; + }; + /** + * Control diff rendering style: 'auto' adapts to terminal width, 'stacked' always shows single column + */ + diff_style?: 'auto' | 'stacked'; + }; + server?: ServerConfig; + daemon?: DaemonConfig; + /** + * Command configuration, see https://opencode.ai/docs/commands + */ + command?: { [key: string]: { - disabled?: boolean - command?: Array - environment?: { - [key: string]: string - } - extensions?: Array - } - } - lsp?: - | false - | { - [key: string]: - | { - disabled: true - } - | { - command: Array - extensions?: Array - disabled?: boolean - env?: { - [key: string]: string - } - initialization?: { - [key: string]: unknown - } - } - } - /** - * Additional instruction files or patterns to include - */ - instructions?: Array - layout?: LayoutConfig - permission?: PermissionConfig - tools?: { - [key: string]: boolean - } - enterprise?: { + template: string; + description?: string; + agent?: string; + model?: string; + subtask?: boolean; + }; + }; + watcher?: { + ignore?: Array; + }; + plugin?: Array; + snapshot?: boolean; /** - * Enterprise URL + * Control sharing behavior:'manual' allows manual sharing via commands, 'auto' enables automatic sharing, 'disabled' disables all sharing */ - url?: string - } - compaction?: { + share?: 'manual' | 'auto' | 'disabled'; /** - * Enable automatic compaction when context is full (default: true) + * @deprecated Use 'share' field instead. Share newly created sessions automatically */ - auto?: boolean + autoshare?: boolean; /** - * Enable pruning of old tool outputs (default: true) + * Automatically update to the latest version. Set to true to auto-update, false to disable, or 'notify' to show update notifications */ - prune?: boolean - } - experimental?: { - hook?: { - file_edited?: { - [key: string]: Array<{ - command: Array - environment?: { - [key: string]: string - } - }> - } - session_completed?: Array<{ - command: Array - environment?: { - [key: string]: string - } - }> - } + autoupdate?: boolean | 'notify'; /** - * Number of retries for chat completions on failure + * Disable providers that are loaded automatically */ - chatMaxRetries?: number - disable_paste_summary?: boolean + disabled_providers?: Array; /** - * Enable the batch tool + * When set, ONLY these providers will be enabled. All other providers will be ignored */ - batch_tool?: boolean + enabled_providers?: Array; /** - * Enable OpenTelemetry spans for AI SDK calls (using the 'experimental_telemetry' flag) + * Model to use in the format of provider/model, eg anthropic/claude-2 */ - openTelemetry?: boolean + model?: string; /** - * Tools that should only be available to primary agents. + * Small model to use for tasks like title generation in the format of provider/model */ - primary_tools?: Array + small_model?: string; /** - * Continue the agent loop when a tool call is denied + * Default agent to use when none is specified. Must be a primary agent. Falls back to 'build' if not set or if the specified agent is invalid. */ - continue_loop_on_deny?: boolean + default_agent?: string; /** - * Timeout in milliseconds for model context protocol (MCP) requests + * Custom username to display in conversations instead of system username */ - mcp_timeout?: number - } -} + username?: string; + /** + * @deprecated Use `agent` field instead. + */ + mode?: { + build?: AgentConfig; + plan?: AgentConfig; + [key: string]: AgentConfig | undefined; + }; + /** + * Agent configuration, see https://opencode.ai/docs/agent + */ + agent?: { + plan?: AgentConfig; + build?: AgentConfig; + general?: AgentConfig; + explore?: AgentConfig; + title?: AgentConfig; + summary?: AgentConfig; + compaction?: AgentConfig; + [key: string]: AgentConfig | undefined; + }; + /** + * Custom provider configurations and model overrides + */ + provider?: { + [key: string]: ProviderConfig; + }; + /** + * MCP (Model Context Protocol) server configurations + */ + mcp?: { + [key: string]: McpLocalConfig | McpRemoteConfig | { + enabled: boolean; + }; + }; + formatter?: false | { + [key: string]: { + disabled?: boolean; + command?: Array; + environment?: { + [key: string]: string; + }; + extensions?: Array; + }; + }; + lsp?: false | { + [key: string]: { + disabled: true; + } | { + command: Array; + extensions?: Array; + disabled?: boolean; + env?: { + [key: string]: string; + }; + initialization?: { + [key: string]: unknown; + }; + }; + }; + /** + * Additional instruction files or patterns to include + */ + instructions?: Array; + layout?: LayoutConfig; + permission?: PermissionConfig; + tools?: { + [key: string]: boolean; + }; + enterprise?: { + /** + * Enterprise URL + */ + url?: string; + }; + compaction?: { + /** + * Enable automatic compaction when context is full (default: true) + */ + auto?: boolean; + /** + * Enable pruning of old tool outputs (default: true) + */ + prune?: boolean; + }; + experimental?: { + hook?: { + file_edited?: { + [key: string]: Array<{ + command: Array; + environment?: { + [key: string]: string; + }; + }>; + }; + session_completed?: Array<{ + command: Array; + environment?: { + [key: string]: string; + }; + }>; + }; + /** + * Number of retries for chat completions on failure + */ + chatMaxRetries?: number; + disable_paste_summary?: boolean; + /** + * Enable the batch tool + */ + batch_tool?: boolean; + /** + * Enable OpenTelemetry spans for AI SDK calls (using the 'experimental_telemetry' flag) + */ + openTelemetry?: boolean; + /** + * Tools that should only be available to primary agents. + */ + primary_tools?: Array; + /** + * Continue the agent loop when a tool call is denied + */ + continue_loop_on_deny?: boolean; + /** + * Timeout in milliseconds for model context protocol (MCP) requests + */ + mcp_timeout?: number; + }; + /** + * Provider/model fallback configuration for automatic failover + */ + fallback?: { + /** + * Enable automatic fallback to alternative providers/models on failure + */ + enabled?: boolean; + /** + * Maximum total attempts including the original request + */ + maxAttempts?: number; + /** + * Circuit breaker configuration for provider health management + */ + circuitBreaker?: { + /** + * Number of consecutive failures before opening the circuit + */ + failureThreshold?: number; + /** + * Number of consecutive successes in half_open to close the circuit + */ + successThreshold?: number; + /** + * Time in ms before transitioning from open to half_open + */ + timeout?: number; + }; + /** + * Fallback rules in priority order + */ + rules?: Array<{ + /** + * Error condition that triggers this rule + */ + condition: 'rate_limit' | 'unavailable' | 'timeout' | 'error' | 'circuit_open' | 'any'; + /** + * Fallback options - 'providerID/modelID' or just 'providerID' for equivalent tier + */ + fallbacks: Array; + }>; + /** + * Skip fallbacks that cost more than the original model + */ + costAware?: boolean; + /** + * Emit event/notification when fallback is used + */ + notifyOnFallback?: boolean; + }; +}; -export type ToolIds = Array +export type ToolIds = Array; export type ToolListItem = { - id: string - description: string - parameters: unknown -} + id: string; + description: string; + parameters: unknown; +}; -export type ToolList = Array +export type ToolList = Array; export type Path = { - home: string - state: string - config: string - worktree: string - directory: string -} + home: string; + state: string; + config: string; + worktree: string; + directory: string; +}; export type Worktree = { - name: string - branch: string - directory: string -} + name: string; + branch: string; + directory: string; +}; export type WorktreeCreateInput = { - name?: string - startCommand?: string -} + name?: string; + startCommand?: string; +}; export type VcsInfo = { - branch: string -} + branch: string; +}; export type TextPartInput = { - id?: string - type: "text" - text: string - synthetic?: boolean - ignored?: boolean - time?: { - start: number - end?: number - } - metadata?: { - [key: string]: unknown - } -} + id?: string; + type: 'text'; + text: string; + synthetic?: boolean; + ignored?: boolean; + time?: { + start: number; + end?: number; + }; + metadata?: { + [key: string]: unknown; + }; +}; export type FilePartInput = { - id?: string - type: "file" - mime: string - filename?: string - url: string - source?: FilePartSource -} + id?: string; + type: 'file'; + mime: string; + filename?: string; + url: string; + source?: FilePartSource; +}; export type AgentPartInput = { - id?: string - type: "agent" - name: string - source?: { - value: string - start: number - end: number - } -} + id?: string; + type: 'agent'; + name: string; + source?: { + value: string; + start: number; + end: number; + }; +}; export type SubtaskPartInput = { - id?: string - type: "subtask" - prompt: string - description: string - agent: string - command?: string -} + id?: string; + type: 'subtask'; + prompt: string; + description: string; + agent: string; + command?: string; +}; export type Command = { - name: string - description?: string - agent?: string - model?: string - mcp?: boolean - template: string - subtask?: boolean - hints: Array -} + name: string; + description?: string; + agent?: string; + model?: string; + mcp?: boolean; + template: string; + subtask?: boolean; + hints: Array; +}; export type Model = { - id: string - providerID: string - api: { - id: string - url: string - npm: string - } - name: string - family?: string - capabilities: { - temperature: boolean - reasoning: boolean - attachment: boolean - toolcall: boolean - input: { - text: boolean - audio: boolean - image: boolean - video: boolean - pdf: boolean - } - output: { - text: boolean - audio: boolean - image: boolean - video: boolean - pdf: boolean - } - interleaved: - | boolean - | { - field: "reasoning_content" | "reasoning_details" - } - } - cost: { - input: number - output: number - cache: { - read: number - write: number - } - experimentalOver200K?: { - input: number - output: number - cache: { - read: number - write: number - } - } - } - limit: { - context: number - output: number - } - status: "alpha" | "beta" | "deprecated" | "active" - options: { - [key: string]: unknown - } - headers: { - [key: string]: string - } - release_date: string - variants?: { - [key: string]: { - [key: string]: unknown - } - } -} + id: string; + providerID: string; + api: { + id: string; + url: string; + npm: string; + }; + name: string; + family?: string; + capabilities: { + temperature: boolean; + reasoning: boolean; + attachment: boolean; + toolcall: boolean; + input: { + text: boolean; + audio: boolean; + image: boolean; + video: boolean; + pdf: boolean; + }; + output: { + text: boolean; + audio: boolean; + image: boolean; + video: boolean; + pdf: boolean; + }; + interleaved: boolean | { + field: 'reasoning_content' | 'reasoning_details'; + }; + }; + cost: { + input: number; + output: number; + cache: { + read: number; + write: number; + }; + experimentalOver200K?: { + input: number; + output: number; + cache: { + read: number; + write: number; + }; + }; + }; + limit: { + context: number; + output: number; + }; + status: 'alpha' | 'beta' | 'deprecated' | 'active'; + options: { + [key: string]: unknown; + }; + headers: { + [key: string]: string; + }; + release_date: string; + variants?: { + [key: string]: { + [key: string]: unknown; + }; + }; +}; export type Provider = { - id: string - name: string - source: "env" | "config" | "custom" | "api" - env: Array - key?: string - options: { - [key: string]: unknown - } - models: { - [key: string]: Model - } -} + id: string; + name: string; + source: 'env' | 'config' | 'custom' | 'api'; + env: Array; + key?: string; + options: { + [key: string]: unknown; + }; + models: { + [key: string]: Model; + }; +}; export type ProviderAuthMethod = { - type: "oauth" | "api" - label: string -} + type: 'oauth' | 'api'; + label: string; +}; export type ProviderAuthAuthorization = { - url: string - method: "auto" | "code" - instructions: string -} + url: string; + method: 'auto' | 'code'; + instructions: string; +}; export type Symbol = { - name: string - kind: number - location: { - uri: string - range: Range - } -} + name: string; + kind: number; + location: { + uri: string; + range: Range; + }; +}; export type FileNode = { - name: string - path: string - absolute: string - type: "file" | "directory" - ignored: boolean -} + name: string; + path: string; + absolute: string; + type: 'file' | 'directory'; + ignored: boolean; +}; export type FileContent = { - type: "text" - content: string - diff?: string - patch?: { - oldFileName: string - newFileName: string - oldHeader?: string - newHeader?: string - hunks: Array<{ - oldStart: number - oldLines: number - newStart: number - newLines: number - lines: Array - }> - index?: string - } - encoding?: "base64" - mimeType?: string -} + type: 'text'; + content: string; + diff?: string; + patch?: { + oldFileName: string; + newFileName: string; + oldHeader?: string; + newHeader?: string; + hunks: Array<{ + oldStart: number; + oldLines: number; + newStart: number; + newLines: number; + lines: Array; + }>; + index?: string; + }; + encoding?: 'base64'; + mimeType?: string; +}; export type File = { - path: string - added: number - removed: number - status: "added" | "deleted" | "modified" -} + path: string; + added: number; + removed: number; + status: 'added' | 'deleted' | 'modified'; +}; export type Agent = { - name: string - description?: string - mode: "subagent" | "primary" | "all" - native?: boolean - hidden?: boolean - topP?: number - temperature?: number - color?: string - permission: PermissionRuleset - model?: { - modelID: string - providerID: string - } - prompt?: string - options: { - [key: string]: unknown - } - steps?: number -} + name: string; + description?: string; + mode: 'subagent' | 'primary' | 'all'; + native?: boolean; + hidden?: boolean; + topP?: number; + temperature?: number; + color?: string; + permission: PermissionRuleset; + model?: { + modelID: string; + providerID: string; + }; + prompt?: string; + options: { + [key: string]: unknown; + }; + steps?: number; +}; export type McpStatusConnected = { - status: "connected" -} + status: 'connected'; +}; export type McpStatusDisabled = { - status: "disabled" -} + status: 'disabled'; +}; export type McpStatusFailed = { - status: "failed" - error: string -} + status: 'failed'; + error: string; +}; export type McpStatusNeedsAuth = { - status: "needs_auth" -} + status: 'needs_auth'; +}; export type McpStatusNeedsClientRegistration = { - status: "needs_client_registration" - error: string -} + status: 'needs_client_registration'; + error: string; +}; -export type McpStatus = - | McpStatusConnected - | McpStatusDisabled - | McpStatusFailed - | McpStatusNeedsAuth - | McpStatusNeedsClientRegistration +export type McpStatus = McpStatusConnected | McpStatusDisabled | McpStatusFailed | McpStatusNeedsAuth | McpStatusNeedsClientRegistration; export type McpResource = { - name: string - uri: string - description?: string - mimeType?: string - client: string -} + name: string; + uri: string; + description?: string; + mimeType?: string; + client: string; +}; export type LspStatus = { - id: string - name: string - root: string - status: "connected" | "error" -} + id: string; + name: string; + root: string; + status: 'connected' | 'error'; +}; export type FormatterStatus = { - name: string - extensions: Array - enabled: boolean -} + name: string; + extensions: Array; + enabled: boolean; +}; export type OAuth = { - type: "oauth" - refresh: string - access: string - expires: number - enterpriseUrl?: string -} + type: 'oauth'; + refresh: string; + access: string; + expires: number; + enterpriseUrl?: string; +}; export type ApiAuth = { - type: "api" - key: string -} + type: 'api'; + key: string; +}; export type WellKnownAuth = { - type: "wellknown" - key: string - token: string -} + type: 'wellknown'; + key: string; + token: string; +}; -export type Auth = OAuth | ApiAuth | WellKnownAuth +export type Auth = OAuth | ApiAuth | WellKnownAuth; export type GlobalHealthData = { - body?: never - path?: never - query?: never - url: "/global/health" -} + body?: never; + path?: never; + query?: never; + url: '/global/health'; +}; export type GlobalHealthResponses = { - /** - * Health information - */ - 200: { - healthy: true - version: string - } -} + /** + * Health information + */ + 200: { + healthy: true; + version: string; + }; +}; -export type GlobalHealthResponse = GlobalHealthResponses[keyof GlobalHealthResponses] +export type GlobalHealthResponse = GlobalHealthResponses[keyof GlobalHealthResponses]; export type GlobalEventData = { - body?: never - path?: never - query?: never - url: "/global/event" -} + body?: never; + path?: never; + query?: never; + url: '/global/event'; +}; export type GlobalEventResponses = { - /** - * Event stream - */ - 200: GlobalEvent -} + /** + * Event stream + */ + 200: GlobalEvent; +}; -export type GlobalEventResponse = GlobalEventResponses[keyof GlobalEventResponses] +export type GlobalEventResponse = GlobalEventResponses[keyof GlobalEventResponses]; export type GlobalDisposeData = { - body?: never - path?: never - query?: never - url: "/global/dispose" -} + body?: never; + path?: never; + query?: never; + url: '/global/dispose'; +}; export type GlobalDisposeResponses = { - /** - * Global disposed - */ - 200: boolean -} + /** + * Global disposed + */ + 200: boolean; +}; -export type GlobalDisposeResponse = GlobalDisposeResponses[keyof GlobalDisposeResponses] +export type GlobalDisposeResponse = GlobalDisposeResponses[keyof GlobalDisposeResponses]; export type ProjectListData = { - body?: never - path?: never - query?: { - directory?: string - } - url: "/project" -} + body?: never; + path?: never; + query?: { + directory?: string; + }; + url: '/project'; +}; export type ProjectListResponses = { - /** - * List of projects - */ - 200: Array -} + /** + * List of projects + */ + 200: Array; +}; -export type ProjectListResponse = ProjectListResponses[keyof ProjectListResponses] +export type ProjectListResponse = ProjectListResponses[keyof ProjectListResponses]; export type ProjectCurrentData = { - body?: never - path?: never - query?: { - directory?: string - } - url: "/project/current" -} + body?: never; + path?: never; + query?: { + directory?: string; + }; + url: '/project/current'; +}; export type ProjectCurrentResponses = { - /** - * Current project information - */ - 200: Project -} + /** + * Current project information + */ + 200: Project; +}; -export type ProjectCurrentResponse = ProjectCurrentResponses[keyof ProjectCurrentResponses] +export type ProjectCurrentResponse = ProjectCurrentResponses[keyof ProjectCurrentResponses]; export type ProjectUpdateData = { - body?: { - name?: string - icon?: { - url?: string - color?: string - } - } - path: { - projectID: string - } - query?: { - directory?: string - } - url: "/project/{projectID}" -} + body?: { + name?: string; + icon?: { + url?: string; + color?: string; + }; + }; + path: { + projectID: string; + }; + query?: { + directory?: string; + }; + url: '/project/{projectID}'; +}; export type ProjectUpdateErrors = { - /** - * Bad request - */ - 400: BadRequestError - /** - * Not found - */ - 404: NotFoundError -} + /** + * Bad request + */ + 400: BadRequestError; + /** + * Not found + */ + 404: NotFoundError; +}; -export type ProjectUpdateError = ProjectUpdateErrors[keyof ProjectUpdateErrors] +export type ProjectUpdateError = ProjectUpdateErrors[keyof ProjectUpdateErrors]; export type ProjectUpdateResponses = { - /** - * Updated project information - */ - 200: Project -} + /** + * Updated project information + */ + 200: Project; +}; -export type ProjectUpdateResponse = ProjectUpdateResponses[keyof ProjectUpdateResponses] +export type ProjectUpdateResponse = ProjectUpdateResponses[keyof ProjectUpdateResponses]; export type PtyListData = { - body?: never - path?: never - query?: { - directory?: string - } - url: "/pty" -} + body?: never; + path?: never; + query?: { + directory?: string; + }; + url: '/pty'; +}; export type PtyListResponses = { - /** - * List of sessions - */ - 200: Array -} + /** + * List of sessions + */ + 200: Array; +}; -export type PtyListResponse = PtyListResponses[keyof PtyListResponses] +export type PtyListResponse = PtyListResponses[keyof PtyListResponses]; export type PtyCreateData = { - body?: { - command?: string - args?: Array - cwd?: string - title?: string - env?: { - [key: string]: string - } - } - path?: never - query?: { - directory?: string - } - url: "/pty" -} + body?: { + command?: string; + args?: Array; + cwd?: string; + title?: string; + env?: { + [key: string]: string; + }; + }; + path?: never; + query?: { + directory?: string; + }; + url: '/pty'; +}; export type PtyCreateErrors = { - /** - * Bad request - */ - 400: BadRequestError -} + /** + * Bad request + */ + 400: BadRequestError; +}; -export type PtyCreateError = PtyCreateErrors[keyof PtyCreateErrors] +export type PtyCreateError = PtyCreateErrors[keyof PtyCreateErrors]; export type PtyCreateResponses = { - /** - * Created session - */ - 200: Pty -} + /** + * Created session + */ + 200: Pty; +}; -export type PtyCreateResponse = PtyCreateResponses[keyof PtyCreateResponses] +export type PtyCreateResponse = PtyCreateResponses[keyof PtyCreateResponses]; export type PtyRemoveData = { - body?: never - path: { - ptyID: string - } - query?: { - directory?: string - } - url: "/pty/{ptyID}" -} + body?: never; + path: { + ptyID: string; + }; + query?: { + directory?: string; + }; + url: '/pty/{ptyID}'; +}; export type PtyRemoveErrors = { - /** - * Not found - */ - 404: NotFoundError -} + /** + * Not found + */ + 404: NotFoundError; +}; -export type PtyRemoveError = PtyRemoveErrors[keyof PtyRemoveErrors] +export type PtyRemoveError = PtyRemoveErrors[keyof PtyRemoveErrors]; export type PtyRemoveResponses = { - /** - * Session removed - */ - 200: boolean -} + /** + * Session removed + */ + 200: boolean; +}; -export type PtyRemoveResponse = PtyRemoveResponses[keyof PtyRemoveResponses] +export type PtyRemoveResponse = PtyRemoveResponses[keyof PtyRemoveResponses]; export type PtyGetData = { - body?: never - path: { - ptyID: string - } - query?: { - directory?: string - } - url: "/pty/{ptyID}" -} + body?: never; + path: { + ptyID: string; + }; + query?: { + directory?: string; + }; + url: '/pty/{ptyID}'; +}; export type PtyGetErrors = { - /** - * Not found - */ - 404: NotFoundError -} + /** + * Not found + */ + 404: NotFoundError; +}; -export type PtyGetError = PtyGetErrors[keyof PtyGetErrors] +export type PtyGetError = PtyGetErrors[keyof PtyGetErrors]; export type PtyGetResponses = { - /** - * Session info - */ - 200: Pty -} + /** + * Session info + */ + 200: Pty; +}; -export type PtyGetResponse = PtyGetResponses[keyof PtyGetResponses] +export type PtyGetResponse = PtyGetResponses[keyof PtyGetResponses]; export type PtyUpdateData = { - body?: { - title?: string - size?: { - rows: number - cols: number - } - } - path: { - ptyID: string - } - query?: { - directory?: string - } - url: "/pty/{ptyID}" -} + body?: { + title?: string; + size?: { + rows: number; + cols: number; + }; + }; + path: { + ptyID: string; + }; + query?: { + directory?: string; + }; + url: '/pty/{ptyID}'; +}; export type PtyUpdateErrors = { - /** - * Bad request - */ - 400: BadRequestError -} + /** + * Bad request + */ + 400: BadRequestError; +}; -export type PtyUpdateError = PtyUpdateErrors[keyof PtyUpdateErrors] +export type PtyUpdateError = PtyUpdateErrors[keyof PtyUpdateErrors]; export type PtyUpdateResponses = { - /** - * Updated session - */ - 200: Pty -} + /** + * Updated session + */ + 200: Pty; +}; -export type PtyUpdateResponse = PtyUpdateResponses[keyof PtyUpdateResponses] +export type PtyUpdateResponse = PtyUpdateResponses[keyof PtyUpdateResponses]; export type PtyConnectData = { - body?: never - path: { - ptyID: string - } - query?: { - directory?: string - } - url: "/pty/{ptyID}/connect" -} + body?: never; + path: { + ptyID: string; + }; + query?: { + directory?: string; + }; + url: '/pty/{ptyID}/connect'; +}; export type PtyConnectErrors = { - /** - * Not found - */ - 404: NotFoundError -} + /** + * Not found + */ + 404: NotFoundError; +}; -export type PtyConnectError = PtyConnectErrors[keyof PtyConnectErrors] +export type PtyConnectError = PtyConnectErrors[keyof PtyConnectErrors]; export type PtyConnectResponses = { - /** - * Connected session - */ - 200: boolean -} + /** + * Connected session + */ + 200: boolean; +}; -export type PtyConnectResponse = PtyConnectResponses[keyof PtyConnectResponses] +export type PtyConnectResponse = PtyConnectResponses[keyof PtyConnectResponses]; export type ConfigGetData = { - body?: never - path?: never - query?: { - directory?: string - } - url: "/config" -} + body?: never; + path?: never; + query?: { + directory?: string; + }; + url: '/config'; +}; export type ConfigGetResponses = { - /** - * Get config info - */ - 200: Config -} + /** + * Get config info + */ + 200: Config; +}; -export type ConfigGetResponse = ConfigGetResponses[keyof ConfigGetResponses] +export type ConfigGetResponse = ConfigGetResponses[keyof ConfigGetResponses]; export type ConfigUpdateData = { - body?: Config - path?: never - query?: { - directory?: string - } - url: "/config" -} + body?: Config; + path?: never; + query?: { + directory?: string; + }; + url: '/config'; +}; export type ConfigUpdateErrors = { - /** - * Bad request - */ - 400: BadRequestError -} + /** + * Bad request + */ + 400: BadRequestError; +}; -export type ConfigUpdateError = ConfigUpdateErrors[keyof ConfigUpdateErrors] +export type ConfigUpdateError = ConfigUpdateErrors[keyof ConfigUpdateErrors]; export type ConfigUpdateResponses = { - /** - * Successfully updated config - */ - 200: Config -} + /** + * Successfully updated config + */ + 200: Config; +}; -export type ConfigUpdateResponse = ConfigUpdateResponses[keyof ConfigUpdateResponses] +export type ConfigUpdateResponse = ConfigUpdateResponses[keyof ConfigUpdateResponses]; export type ToolIdsData = { - body?: never - path?: never - query?: { - directory?: string - } - url: "/experimental/tool/ids" -} + body?: never; + path?: never; + query?: { + directory?: string; + }; + url: '/experimental/tool/ids'; +}; export type ToolIdsErrors = { - /** - * Bad request - */ - 400: BadRequestError -} + /** + * Bad request + */ + 400: BadRequestError; +}; -export type ToolIdsError = ToolIdsErrors[keyof ToolIdsErrors] +export type ToolIdsError = ToolIdsErrors[keyof ToolIdsErrors]; export type ToolIdsResponses = { - /** - * Tool IDs - */ - 200: ToolIds -} + /** + * Tool IDs + */ + 200: ToolIds; +}; -export type ToolIdsResponse = ToolIdsResponses[keyof ToolIdsResponses] +export type ToolIdsResponse = ToolIdsResponses[keyof ToolIdsResponses]; export type ToolListData = { - body?: never - path?: never - query: { - directory?: string - provider: string - model: string - } - url: "/experimental/tool" -} + body?: never; + path?: never; + query: { + directory?: string; + provider: string; + model: string; + }; + url: '/experimental/tool'; +}; export type ToolListErrors = { - /** - * Bad request - */ - 400: BadRequestError -} + /** + * Bad request + */ + 400: BadRequestError; +}; -export type ToolListError = ToolListErrors[keyof ToolListErrors] +export type ToolListError = ToolListErrors[keyof ToolListErrors]; export type ToolListResponses = { - /** - * Tools - */ - 200: ToolList -} + /** + * Tools + */ + 200: ToolList; +}; -export type ToolListResponse = ToolListResponses[keyof ToolListResponses] +export type ToolListResponse = ToolListResponses[keyof ToolListResponses]; export type InstanceDisposeData = { - body?: never - path?: never - query?: { - directory?: string - } - url: "/instance/dispose" -} + body?: never; + path?: never; + query?: { + directory?: string; + }; + url: '/instance/dispose'; +}; export type InstanceDisposeResponses = { - /** - * Instance disposed - */ - 200: boolean -} + /** + * Instance disposed + */ + 200: boolean; +}; -export type InstanceDisposeResponse = InstanceDisposeResponses[keyof InstanceDisposeResponses] +export type InstanceDisposeResponse = InstanceDisposeResponses[keyof InstanceDisposeResponses]; export type PathGetData = { - body?: never - path?: never - query?: { - directory?: string - } - url: "/path" -} + body?: never; + path?: never; + query?: { + directory?: string; + }; + url: '/path'; +}; export type PathGetResponses = { - /** - * Path - */ - 200: Path -} + /** + * Path + */ + 200: Path; +}; -export type PathGetResponse = PathGetResponses[keyof PathGetResponses] +export type PathGetResponse = PathGetResponses[keyof PathGetResponses]; export type WorktreeListData = { - body?: never - path?: never - query?: { - directory?: string - } - url: "/experimental/worktree" -} + body?: never; + path?: never; + query?: { + directory?: string; + }; + url: '/experimental/worktree'; +}; export type WorktreeListResponses = { - /** - * List of worktree directories - */ - 200: Array -} + /** + * List of worktree directories + */ + 200: Array; +}; -export type WorktreeListResponse = WorktreeListResponses[keyof WorktreeListResponses] +export type WorktreeListResponse = WorktreeListResponses[keyof WorktreeListResponses]; export type WorktreeCreateData = { - body?: WorktreeCreateInput - path?: never - query?: { - directory?: string - } - url: "/experimental/worktree" -} + body?: WorktreeCreateInput; + path?: never; + query?: { + directory?: string; + }; + url: '/experimental/worktree'; +}; export type WorktreeCreateErrors = { - /** - * Bad request - */ - 400: BadRequestError -} + /** + * Bad request + */ + 400: BadRequestError; +}; -export type WorktreeCreateError = WorktreeCreateErrors[keyof WorktreeCreateErrors] +export type WorktreeCreateError = WorktreeCreateErrors[keyof WorktreeCreateErrors]; export type WorktreeCreateResponses = { - /** - * Worktree created - */ - 200: Worktree -} + /** + * Worktree created + */ + 200: Worktree; +}; -export type WorktreeCreateResponse = WorktreeCreateResponses[keyof WorktreeCreateResponses] +export type WorktreeCreateResponse = WorktreeCreateResponses[keyof WorktreeCreateResponses]; export type VcsGetData = { - body?: never - path?: never - query?: { - directory?: string - } - url: "/vcs" -} + body?: never; + path?: never; + query?: { + directory?: string; + }; + url: '/vcs'; +}; export type VcsGetResponses = { - /** - * VCS info - */ - 200: VcsInfo -} + /** + * VCS info + */ + 200: VcsInfo; +}; -export type VcsGetResponse = VcsGetResponses[keyof VcsGetResponses] +export type VcsGetResponse = VcsGetResponses[keyof VcsGetResponses]; export type SessionListData = { - body?: never - path?: never - query?: { - directory?: string - /** - * Filter sessions updated on or after this timestamp (milliseconds since epoch) - */ - start?: number - /** - * Filter sessions by title (case-insensitive) - */ - search?: string - /** - * Maximum number of sessions to return - */ - limit?: number - } - url: "/session" -} + body?: never; + path?: never; + query?: { + directory?: string; + /** + * Filter sessions updated on or after this timestamp (milliseconds since epoch) + */ + start?: number; + /** + * Filter sessions by title (case-insensitive) + */ + search?: string; + /** + * Maximum number of sessions to return + */ + limit?: number; + }; + url: '/session'; +}; export type SessionListResponses = { - /** - * List of sessions - */ - 200: Array -} + /** + * List of sessions + */ + 200: Array; +}; -export type SessionListResponse = SessionListResponses[keyof SessionListResponses] +export type SessionListResponse = SessionListResponses[keyof SessionListResponses]; export type SessionCreateData = { - body?: { - parentID?: string - title?: string - permission?: PermissionRuleset - } - path?: never - query?: { - directory?: string - } - url: "/session" -} + body?: { + parentID?: string; + title?: string; + permission?: PermissionRuleset; + }; + path?: never; + query?: { + directory?: string; + }; + url: '/session'; +}; export type SessionCreateErrors = { - /** - * Bad request - */ - 400: BadRequestError -} + /** + * Bad request + */ + 400: BadRequestError; +}; -export type SessionCreateError = SessionCreateErrors[keyof SessionCreateErrors] +export type SessionCreateError = SessionCreateErrors[keyof SessionCreateErrors]; export type SessionCreateResponses = { - /** - * Successfully created session - */ - 200: Session -} + /** + * Successfully created session + */ + 200: Session; +}; -export type SessionCreateResponse = SessionCreateResponses[keyof SessionCreateResponses] +export type SessionCreateResponse = SessionCreateResponses[keyof SessionCreateResponses]; export type SessionStatusData = { - body?: never - path?: never - query?: { - directory?: string - } - url: "/session/status" -} + body?: never; + path?: never; + query?: { + directory?: string; + }; + url: '/session/status'; +}; export type SessionStatusErrors = { - /** - * Bad request - */ - 400: BadRequestError -} + /** + * Bad request + */ + 400: BadRequestError; +}; -export type SessionStatusError = SessionStatusErrors[keyof SessionStatusErrors] +export type SessionStatusError = SessionStatusErrors[keyof SessionStatusErrors]; export type SessionStatusResponses = { - /** - * Get session status - */ - 200: { - [key: string]: SessionStatus - } -} + /** + * Get session status + */ + 200: { + [key: string]: SessionStatus; + }; +}; -export type SessionStatusResponse = SessionStatusResponses[keyof SessionStatusResponses] +export type SessionStatusResponse = SessionStatusResponses[keyof SessionStatusResponses]; export type SessionDeleteData = { - body?: never - path: { - sessionID: string - } - query?: { - directory?: string - } - url: "/session/{sessionID}" -} + body?: never; + path: { + sessionID: string; + }; + query?: { + directory?: string; + }; + url: '/session/{sessionID}'; +}; export type SessionDeleteErrors = { - /** - * Bad request - */ - 400: BadRequestError - /** - * Not found - */ - 404: NotFoundError -} + /** + * Bad request + */ + 400: BadRequestError; + /** + * Not found + */ + 404: NotFoundError; +}; -export type SessionDeleteError = SessionDeleteErrors[keyof SessionDeleteErrors] +export type SessionDeleteError = SessionDeleteErrors[keyof SessionDeleteErrors]; export type SessionDeleteResponses = { - /** - * Successfully deleted session - */ - 200: boolean -} + /** + * Successfully deleted session + */ + 200: boolean; +}; -export type SessionDeleteResponse = SessionDeleteResponses[keyof SessionDeleteResponses] +export type SessionDeleteResponse = SessionDeleteResponses[keyof SessionDeleteResponses]; export type SessionGetData = { - body?: never - path: { - sessionID: string - } - query?: { - directory?: string - } - url: "/session/{sessionID}" -} + body?: never; + path: { + sessionID: string; + }; + query?: { + directory?: string; + }; + url: '/session/{sessionID}'; +}; export type SessionGetErrors = { - /** - * Bad request - */ - 400: BadRequestError - /** - * Not found - */ - 404: NotFoundError -} + /** + * Bad request + */ + 400: BadRequestError; + /** + * Not found + */ + 404: NotFoundError; +}; -export type SessionGetError = SessionGetErrors[keyof SessionGetErrors] +export type SessionGetError = SessionGetErrors[keyof SessionGetErrors]; export type SessionGetResponses = { - /** - * Get session - */ - 200: Session -} + /** + * Get session + */ + 200: Session; +}; -export type SessionGetResponse = SessionGetResponses[keyof SessionGetResponses] +export type SessionGetResponse = SessionGetResponses[keyof SessionGetResponses]; export type SessionUpdateData = { - body?: { - title?: string - time?: { - archived?: number - } - } - path: { - sessionID: string - } - query?: { - directory?: string - } - url: "/session/{sessionID}" -} + body?: { + title?: string; + time?: { + archived?: number; + }; + }; + path: { + sessionID: string; + }; + query?: { + directory?: string; + }; + url: '/session/{sessionID}'; +}; export type SessionUpdateErrors = { - /** - * Bad request - */ - 400: BadRequestError - /** - * Not found - */ - 404: NotFoundError -} + /** + * Bad request + */ + 400: BadRequestError; + /** + * Not found + */ + 404: NotFoundError; +}; -export type SessionUpdateError = SessionUpdateErrors[keyof SessionUpdateErrors] +export type SessionUpdateError = SessionUpdateErrors[keyof SessionUpdateErrors]; export type SessionUpdateResponses = { - /** - * Successfully updated session - */ - 200: Session -} + /** + * Successfully updated session + */ + 200: Session; +}; -export type SessionUpdateResponse = SessionUpdateResponses[keyof SessionUpdateResponses] +export type SessionUpdateResponse = SessionUpdateResponses[keyof SessionUpdateResponses]; export type SessionChildrenData = { - body?: never - path: { - sessionID: string - } - query?: { - directory?: string - } - url: "/session/{sessionID}/children" -} + body?: never; + path: { + sessionID: string; + }; + query?: { + directory?: string; + }; + url: '/session/{sessionID}/children'; +}; export type SessionChildrenErrors = { - /** - * Bad request - */ - 400: BadRequestError - /** - * Not found - */ - 404: NotFoundError -} + /** + * Bad request + */ + 400: BadRequestError; + /** + * Not found + */ + 404: NotFoundError; +}; -export type SessionChildrenError = SessionChildrenErrors[keyof SessionChildrenErrors] +export type SessionChildrenError = SessionChildrenErrors[keyof SessionChildrenErrors]; export type SessionChildrenResponses = { - /** - * List of children - */ - 200: Array -} + /** + * List of children + */ + 200: Array; +}; -export type SessionChildrenResponse = SessionChildrenResponses[keyof SessionChildrenResponses] +export type SessionChildrenResponse = SessionChildrenResponses[keyof SessionChildrenResponses]; export type SessionTodoData = { - body?: never - path: { - /** - * Session ID - */ - sessionID: string - } - query?: { - directory?: string - } - url: "/session/{sessionID}/todo" -} + body?: never; + path: { + /** + * Session ID + */ + sessionID: string; + }; + query?: { + directory?: string; + }; + url: '/session/{sessionID}/todo'; +}; export type SessionTodoErrors = { - /** - * Bad request - */ - 400: BadRequestError - /** - * Not found - */ - 404: NotFoundError -} + /** + * Bad request + */ + 400: BadRequestError; + /** + * Not found + */ + 404: NotFoundError; +}; -export type SessionTodoError = SessionTodoErrors[keyof SessionTodoErrors] +export type SessionTodoError = SessionTodoErrors[keyof SessionTodoErrors]; export type SessionTodoResponses = { - /** - * Todo list - */ - 200: Array -} + /** + * Todo list + */ + 200: Array; +}; -export type SessionTodoResponse = SessionTodoResponses[keyof SessionTodoResponses] +export type SessionTodoResponse = SessionTodoResponses[keyof SessionTodoResponses]; export type SessionInitData = { - body?: { - modelID: string - providerID: string - messageID: string - } - path: { - /** - * Session ID - */ - sessionID: string - } - query?: { - directory?: string - } - url: "/session/{sessionID}/init" -} + body?: { + modelID: string; + providerID: string; + messageID: string; + }; + path: { + /** + * Session ID + */ + sessionID: string; + }; + query?: { + directory?: string; + }; + url: '/session/{sessionID}/init'; +}; export type SessionInitErrors = { - /** - * Bad request - */ - 400: BadRequestError - /** - * Not found - */ - 404: NotFoundError -} + /** + * Bad request + */ + 400: BadRequestError; + /** + * Not found + */ + 404: NotFoundError; +}; -export type SessionInitError = SessionInitErrors[keyof SessionInitErrors] +export type SessionInitError = SessionInitErrors[keyof SessionInitErrors]; export type SessionInitResponses = { - /** - * 200 - */ - 200: boolean -} + /** + * 200 + */ + 200: boolean; +}; -export type SessionInitResponse = SessionInitResponses[keyof SessionInitResponses] +export type SessionInitResponse = SessionInitResponses[keyof SessionInitResponses]; export type SessionForkData = { - body?: { - messageID?: string - } - path: { - sessionID: string - } - query?: { - directory?: string - } - url: "/session/{sessionID}/fork" -} + body?: { + messageID?: string; + }; + path: { + sessionID: string; + }; + query?: { + directory?: string; + }; + url: '/session/{sessionID}/fork'; +}; export type SessionForkResponses = { - /** - * 200 - */ - 200: Session -} + /** + * 200 + */ + 200: Session; +}; -export type SessionForkResponse = SessionForkResponses[keyof SessionForkResponses] +export type SessionForkResponse = SessionForkResponses[keyof SessionForkResponses]; export type SessionAbortData = { - body?: never - path: { - sessionID: string - } - query?: { - directory?: string - } - url: "/session/{sessionID}/abort" -} + body?: never; + path: { + sessionID: string; + }; + query?: { + directory?: string; + }; + url: '/session/{sessionID}/abort'; +}; export type SessionAbortErrors = { - /** - * Bad request - */ - 400: BadRequestError - /** - * Not found - */ - 404: NotFoundError -} + /** + * Bad request + */ + 400: BadRequestError; + /** + * Not found + */ + 404: NotFoundError; +}; -export type SessionAbortError = SessionAbortErrors[keyof SessionAbortErrors] +export type SessionAbortError = SessionAbortErrors[keyof SessionAbortErrors]; export type SessionAbortResponses = { - /** - * Aborted session - */ - 200: boolean -} + /** + * Aborted session + */ + 200: boolean; +}; -export type SessionAbortResponse = SessionAbortResponses[keyof SessionAbortResponses] +export type SessionAbortResponse = SessionAbortResponses[keyof SessionAbortResponses]; export type SessionUnshareData = { - body?: never - path: { - sessionID: string - } - query?: { - directory?: string - } - url: "/session/{sessionID}/share" -} + body?: never; + path: { + sessionID: string; + }; + query?: { + directory?: string; + }; + url: '/session/{sessionID}/share'; +}; export type SessionUnshareErrors = { - /** - * Bad request - */ - 400: BadRequestError - /** - * Not found - */ - 404: NotFoundError -} + /** + * Bad request + */ + 400: BadRequestError; + /** + * Not found + */ + 404: NotFoundError; +}; -export type SessionUnshareError = SessionUnshareErrors[keyof SessionUnshareErrors] +export type SessionUnshareError = SessionUnshareErrors[keyof SessionUnshareErrors]; export type SessionUnshareResponses = { - /** - * Successfully unshared session - */ - 200: Session -} + /** + * Successfully unshared session + */ + 200: Session; +}; -export type SessionUnshareResponse = SessionUnshareResponses[keyof SessionUnshareResponses] +export type SessionUnshareResponse = SessionUnshareResponses[keyof SessionUnshareResponses]; export type SessionShareData = { - body?: never - path: { - sessionID: string - } - query?: { - directory?: string - } - url: "/session/{sessionID}/share" -} + body?: never; + path: { + sessionID: string; + }; + query?: { + directory?: string; + }; + url: '/session/{sessionID}/share'; +}; export type SessionShareErrors = { - /** - * Bad request - */ - 400: BadRequestError - /** - * Not found - */ - 404: NotFoundError -} + /** + * Bad request + */ + 400: BadRequestError; + /** + * Not found + */ + 404: NotFoundError; +}; -export type SessionShareError = SessionShareErrors[keyof SessionShareErrors] +export type SessionShareError = SessionShareErrors[keyof SessionShareErrors]; export type SessionShareResponses = { - /** - * Successfully shared session - */ - 200: Session -} + /** + * Successfully shared session + */ + 200: Session; +}; -export type SessionShareResponse = SessionShareResponses[keyof SessionShareResponses] +export type SessionShareResponse = SessionShareResponses[keyof SessionShareResponses]; export type SessionDiffData = { - body?: never - path: { - /** - * Session ID - */ - sessionID: string - } - query?: { - directory?: string - messageID?: string - } - url: "/session/{sessionID}/diff" -} + body?: never; + path: { + /** + * Session ID + */ + sessionID: string; + }; + query?: { + directory?: string; + messageID?: string; + }; + url: '/session/{sessionID}/diff'; +}; export type SessionDiffErrors = { - /** - * Bad request - */ - 400: BadRequestError - /** - * Not found - */ - 404: NotFoundError -} + /** + * Bad request + */ + 400: BadRequestError; + /** + * Not found + */ + 404: NotFoundError; +}; -export type SessionDiffError = SessionDiffErrors[keyof SessionDiffErrors] +export type SessionDiffError = SessionDiffErrors[keyof SessionDiffErrors]; export type SessionDiffResponses = { - /** - * List of diffs - */ - 200: Array -} + /** + * List of diffs + */ + 200: Array; +}; -export type SessionDiffResponse = SessionDiffResponses[keyof SessionDiffResponses] +export type SessionDiffResponse = SessionDiffResponses[keyof SessionDiffResponses]; export type SessionSummarizeData = { - body?: { - providerID: string - modelID: string - auto?: boolean - } - path: { - /** - * Session ID - */ - sessionID: string - } - query?: { - directory?: string - } - url: "/session/{sessionID}/summarize" -} + body?: { + providerID: string; + modelID: string; + auto?: boolean; + }; + path: { + /** + * Session ID + */ + sessionID: string; + }; + query?: { + directory?: string; + }; + url: '/session/{sessionID}/summarize'; +}; export type SessionSummarizeErrors = { - /** - * Bad request - */ - 400: BadRequestError - /** - * Not found - */ - 404: NotFoundError -} + /** + * Bad request + */ + 400: BadRequestError; + /** + * Not found + */ + 404: NotFoundError; +}; -export type SessionSummarizeError = SessionSummarizeErrors[keyof SessionSummarizeErrors] +export type SessionSummarizeError = SessionSummarizeErrors[keyof SessionSummarizeErrors]; export type SessionSummarizeResponses = { - /** - * Summarized session - */ - 200: boolean -} + /** + * Summarized session + */ + 200: boolean; +}; -export type SessionSummarizeResponse = SessionSummarizeResponses[keyof SessionSummarizeResponses] +export type SessionSummarizeResponse = SessionSummarizeResponses[keyof SessionSummarizeResponses]; export type SessionMessagesData = { - body?: never - path: { - /** - * Session ID - */ - sessionID: string - } - query?: { - directory?: string - limit?: number - } - url: "/session/{sessionID}/message" -} + body?: never; + path: { + /** + * Session ID + */ + sessionID: string; + }; + query?: { + directory?: string; + limit?: number; + }; + url: '/session/{sessionID}/message'; +}; export type SessionMessagesErrors = { - /** - * Bad request - */ - 400: BadRequestError - /** - * Not found - */ - 404: NotFoundError -} + /** + * Bad request + */ + 400: BadRequestError; + /** + * Not found + */ + 404: NotFoundError; +}; -export type SessionMessagesError = SessionMessagesErrors[keyof SessionMessagesErrors] +export type SessionMessagesError = SessionMessagesErrors[keyof SessionMessagesErrors]; export type SessionMessagesResponses = { - /** - * List of messages - */ - 200: Array<{ - info: Message - parts: Array - }> -} + /** + * List of messages + */ + 200: Array<{ + info: Message; + parts: Array; + }>; +}; -export type SessionMessagesResponse = SessionMessagesResponses[keyof SessionMessagesResponses] +export type SessionMessagesResponse = SessionMessagesResponses[keyof SessionMessagesResponses]; export type SessionPromptData = { - body?: { - messageID?: string - model?: { - providerID: string - modelID: string - } - agent?: string - noReply?: boolean - /** - * @deprecated tools and permissions have been merged, you can set permissions on the session itself now - */ - tools?: { - [key: string]: boolean - } - system?: string - variant?: string - parts: Array - } - path: { - /** - * Session ID - */ - sessionID: string - } - query?: { - directory?: string - } - url: "/session/{sessionID}/message" -} + body?: { + messageID?: string; + model?: { + providerID: string; + modelID: string; + }; + agent?: string; + noReply?: boolean; + /** + * @deprecated tools and permissions have been merged, you can set permissions on the session itself now + */ + tools?: { + [key: string]: boolean; + }; + system?: string; + variant?: string; + parts: Array; + }; + path: { + /** + * Session ID + */ + sessionID: string; + }; + query?: { + directory?: string; + }; + url: '/session/{sessionID}/message'; +}; export type SessionPromptErrors = { - /** - * Bad request - */ - 400: BadRequestError - /** - * Not found - */ - 404: NotFoundError -} + /** + * Bad request + */ + 400: BadRequestError; + /** + * Not found + */ + 404: NotFoundError; +}; -export type SessionPromptError = SessionPromptErrors[keyof SessionPromptErrors] +export type SessionPromptError = SessionPromptErrors[keyof SessionPromptErrors]; export type SessionPromptResponses = { - /** - * Created message - */ - 200: { - info: AssistantMessage - parts: Array - } -} + /** + * Created message + */ + 200: { + info: AssistantMessage; + parts: Array; + }; +}; -export type SessionPromptResponse = SessionPromptResponses[keyof SessionPromptResponses] +export type SessionPromptResponse = SessionPromptResponses[keyof SessionPromptResponses]; export type SessionMessageData = { - body?: never - path: { - /** - * Session ID - */ - sessionID: string - /** - * Message ID - */ - messageID: string - } - query?: { - directory?: string - } - url: "/session/{sessionID}/message/{messageID}" -} + body?: never; + path: { + /** + * Session ID + */ + sessionID: string; + /** + * Message ID + */ + messageID: string; + }; + query?: { + directory?: string; + }; + url: '/session/{sessionID}/message/{messageID}'; +}; export type SessionMessageErrors = { - /** - * Bad request - */ - 400: BadRequestError - /** - * Not found - */ - 404: NotFoundError -} + /** + * Bad request + */ + 400: BadRequestError; + /** + * Not found + */ + 404: NotFoundError; +}; -export type SessionMessageError = SessionMessageErrors[keyof SessionMessageErrors] +export type SessionMessageError = SessionMessageErrors[keyof SessionMessageErrors]; export type SessionMessageResponses = { - /** - * Message - */ - 200: { - info: Message - parts: Array - } -} + /** + * Message + */ + 200: { + info: Message; + parts: Array; + }; +}; -export type SessionMessageResponse = SessionMessageResponses[keyof SessionMessageResponses] +export type SessionMessageResponse = SessionMessageResponses[keyof SessionMessageResponses]; export type PartDeleteData = { - body?: never - path: { - /** - * Session ID - */ - sessionID: string - /** - * Message ID - */ - messageID: string - /** - * Part ID - */ - partID: string - } - query?: { - directory?: string - } - url: "/session/{sessionID}/message/{messageID}/part/{partID}" -} + body?: never; + path: { + /** + * Session ID + */ + sessionID: string; + /** + * Message ID + */ + messageID: string; + /** + * Part ID + */ + partID: string; + }; + query?: { + directory?: string; + }; + url: '/session/{sessionID}/message/{messageID}/part/{partID}'; +}; export type PartDeleteErrors = { - /** - * Bad request - */ - 400: BadRequestError - /** - * Not found - */ - 404: NotFoundError -} + /** + * Bad request + */ + 400: BadRequestError; + /** + * Not found + */ + 404: NotFoundError; +}; -export type PartDeleteError = PartDeleteErrors[keyof PartDeleteErrors] +export type PartDeleteError = PartDeleteErrors[keyof PartDeleteErrors]; export type PartDeleteResponses = { - /** - * Successfully deleted part - */ - 200: boolean -} + /** + * Successfully deleted part + */ + 200: boolean; +}; -export type PartDeleteResponse = PartDeleteResponses[keyof PartDeleteResponses] +export type PartDeleteResponse = PartDeleteResponses[keyof PartDeleteResponses]; export type PartUpdateData = { - body?: Part - path: { - /** - * Session ID - */ - sessionID: string - /** - * Message ID - */ - messageID: string - /** - * Part ID - */ - partID: string - } - query?: { - directory?: string - } - url: "/session/{sessionID}/message/{messageID}/part/{partID}" -} + body?: Part; + path: { + /** + * Session ID + */ + sessionID: string; + /** + * Message ID + */ + messageID: string; + /** + * Part ID + */ + partID: string; + }; + query?: { + directory?: string; + }; + url: '/session/{sessionID}/message/{messageID}/part/{partID}'; +}; export type PartUpdateErrors = { - /** - * Bad request - */ - 400: BadRequestError - /** - * Not found - */ - 404: NotFoundError -} + /** + * Bad request + */ + 400: BadRequestError; + /** + * Not found + */ + 404: NotFoundError; +}; -export type PartUpdateError = PartUpdateErrors[keyof PartUpdateErrors] +export type PartUpdateError = PartUpdateErrors[keyof PartUpdateErrors]; export type PartUpdateResponses = { - /** - * Successfully updated part - */ - 200: Part -} + /** + * Successfully updated part + */ + 200: Part; +}; -export type PartUpdateResponse = PartUpdateResponses[keyof PartUpdateResponses] +export type PartUpdateResponse = PartUpdateResponses[keyof PartUpdateResponses]; export type SessionPromptAsyncData = { - body?: { - messageID?: string - model?: { - providerID: string - modelID: string - } - agent?: string - noReply?: boolean - /** - * @deprecated tools and permissions have been merged, you can set permissions on the session itself now - */ - tools?: { - [key: string]: boolean - } - system?: string - variant?: string - parts: Array - } - path: { - /** - * Session ID - */ - sessionID: string - } - query?: { - directory?: string - } - url: "/session/{sessionID}/prompt_async" -} + body?: { + messageID?: string; + model?: { + providerID: string; + modelID: string; + }; + agent?: string; + noReply?: boolean; + /** + * @deprecated tools and permissions have been merged, you can set permissions on the session itself now + */ + tools?: { + [key: string]: boolean; + }; + system?: string; + variant?: string; + parts: Array; + }; + path: { + /** + * Session ID + */ + sessionID: string; + }; + query?: { + directory?: string; + }; + url: '/session/{sessionID}/prompt_async'; +}; export type SessionPromptAsyncErrors = { - /** - * Bad request - */ - 400: BadRequestError - /** - * Not found - */ - 404: NotFoundError -} + /** + * Bad request + */ + 400: BadRequestError; + /** + * Not found + */ + 404: NotFoundError; +}; -export type SessionPromptAsyncError = SessionPromptAsyncErrors[keyof SessionPromptAsyncErrors] +export type SessionPromptAsyncError = SessionPromptAsyncErrors[keyof SessionPromptAsyncErrors]; export type SessionPromptAsyncResponses = { - /** - * Prompt accepted - */ - 204: void -} + /** + * Prompt accepted + */ + 204: void; +}; -export type SessionPromptAsyncResponse = SessionPromptAsyncResponses[keyof SessionPromptAsyncResponses] +export type SessionPromptAsyncResponse = SessionPromptAsyncResponses[keyof SessionPromptAsyncResponses]; export type SessionCommandData = { - body?: { - messageID?: string - agent?: string - model?: string - arguments: string - command: string - variant?: string - parts?: Array<{ - id?: string - type: "file" - mime: string - filename?: string - url: string - source?: FilePartSource - }> - } - path: { - /** - * Session ID - */ - sessionID: string - } - query?: { - directory?: string - } - url: "/session/{sessionID}/command" -} + body?: { + messageID?: string; + agent?: string; + model?: string; + arguments: string; + command: string; + variant?: string; + parts?: Array<{ + id?: string; + type: 'file'; + mime: string; + filename?: string; + url: string; + source?: FilePartSource; + }>; + }; + path: { + /** + * Session ID + */ + sessionID: string; + }; + query?: { + directory?: string; + }; + url: '/session/{sessionID}/command'; +}; export type SessionCommandErrors = { - /** - * Bad request - */ - 400: BadRequestError - /** - * Not found - */ - 404: NotFoundError -} + /** + * Bad request + */ + 400: BadRequestError; + /** + * Not found + */ + 404: NotFoundError; +}; -export type SessionCommandError = SessionCommandErrors[keyof SessionCommandErrors] +export type SessionCommandError = SessionCommandErrors[keyof SessionCommandErrors]; export type SessionCommandResponses = { - /** - * Created message - */ - 200: { - info: AssistantMessage - parts: Array - } -} + /** + * Created message + */ + 200: { + info: AssistantMessage; + parts: Array; + }; +}; -export type SessionCommandResponse = SessionCommandResponses[keyof SessionCommandResponses] +export type SessionCommandResponse = SessionCommandResponses[keyof SessionCommandResponses]; export type SessionShellData = { - body?: { - agent: string - model?: { - providerID: string - modelID: string - } - command: string - } - path: { - /** - * Session ID - */ - sessionID: string - } - query?: { - directory?: string - } - url: "/session/{sessionID}/shell" -} + body?: { + agent: string; + model?: { + providerID: string; + modelID: string; + }; + command: string; + }; + path: { + /** + * Session ID + */ + sessionID: string; + }; + query?: { + directory?: string; + }; + url: '/session/{sessionID}/shell'; +}; export type SessionShellErrors = { - /** - * Bad request - */ - 400: BadRequestError - /** - * Not found - */ - 404: NotFoundError -} + /** + * Bad request + */ + 400: BadRequestError; + /** + * Not found + */ + 404: NotFoundError; +}; -export type SessionShellError = SessionShellErrors[keyof SessionShellErrors] +export type SessionShellError = SessionShellErrors[keyof SessionShellErrors]; export type SessionShellResponses = { - /** - * Created message - */ - 200: AssistantMessage -} + /** + * Created message + */ + 200: AssistantMessage; +}; -export type SessionShellResponse = SessionShellResponses[keyof SessionShellResponses] +export type SessionShellResponse = SessionShellResponses[keyof SessionShellResponses]; export type SessionRevertData = { - body?: { - messageID: string - partID?: string - } - path: { - sessionID: string - } - query?: { - directory?: string - } - url: "/session/{sessionID}/revert" -} + body?: { + messageID: string; + partID?: string; + }; + path: { + sessionID: string; + }; + query?: { + directory?: string; + }; + url: '/session/{sessionID}/revert'; +}; export type SessionRevertErrors = { - /** - * Bad request - */ - 400: BadRequestError - /** - * Not found - */ - 404: NotFoundError -} + /** + * Bad request + */ + 400: BadRequestError; + /** + * Not found + */ + 404: NotFoundError; +}; -export type SessionRevertError = SessionRevertErrors[keyof SessionRevertErrors] +export type SessionRevertError = SessionRevertErrors[keyof SessionRevertErrors]; export type SessionRevertResponses = { - /** - * Updated session - */ - 200: Session -} + /** + * Updated session + */ + 200: Session; +}; -export type SessionRevertResponse = SessionRevertResponses[keyof SessionRevertResponses] +export type SessionRevertResponse = SessionRevertResponses[keyof SessionRevertResponses]; export type SessionUnrevertData = { - body?: never - path: { - sessionID: string - } - query?: { - directory?: string - } - url: "/session/{sessionID}/unrevert" -} + body?: never; + path: { + sessionID: string; + }; + query?: { + directory?: string; + }; + url: '/session/{sessionID}/unrevert'; +}; export type SessionUnrevertErrors = { - /** - * Bad request - */ - 400: BadRequestError - /** - * Not found - */ - 404: NotFoundError -} + /** + * Bad request + */ + 400: BadRequestError; + /** + * Not found + */ + 404: NotFoundError; +}; -export type SessionUnrevertError = SessionUnrevertErrors[keyof SessionUnrevertErrors] +export type SessionUnrevertError = SessionUnrevertErrors[keyof SessionUnrevertErrors]; export type SessionUnrevertResponses = { - /** - * Updated session - */ - 200: Session -} + /** + * Updated session + */ + 200: Session; +}; -export type SessionUnrevertResponse = SessionUnrevertResponses[keyof SessionUnrevertResponses] +export type SessionUnrevertResponse = SessionUnrevertResponses[keyof SessionUnrevertResponses]; export type PermissionRespondData = { - body?: { - response: "once" | "always" | "reject" - } - path: { - sessionID: string - permissionID: string - } - query?: { - directory?: string - } - url: "/session/{sessionID}/permissions/{permissionID}" -} + body?: { + response: 'once' | 'always' | 'reject'; + }; + path: { + sessionID: string; + permissionID: string; + }; + query?: { + directory?: string; + }; + url: '/session/{sessionID}/permissions/{permissionID}'; +}; export type PermissionRespondErrors = { - /** - * Bad request - */ - 400: BadRequestError - /** - * Not found - */ - 404: NotFoundError -} + /** + * Bad request + */ + 400: BadRequestError; + /** + * Not found + */ + 404: NotFoundError; +}; -export type PermissionRespondError = PermissionRespondErrors[keyof PermissionRespondErrors] +export type PermissionRespondError = PermissionRespondErrors[keyof PermissionRespondErrors]; export type PermissionRespondResponses = { - /** - * Permission processed successfully - */ - 200: boolean -} + /** + * Permission processed successfully + */ + 200: boolean; +}; -export type PermissionRespondResponse = PermissionRespondResponses[keyof PermissionRespondResponses] +export type PermissionRespondResponse = PermissionRespondResponses[keyof PermissionRespondResponses]; export type PermissionReplyData = { - body?: { - reply: "once" | "always" | "reject" - message?: string - } - path: { - requestID: string - } - query?: { - directory?: string - } - url: "/permission/{requestID}/reply" -} + body?: { + reply: 'once' | 'always' | 'reject'; + message?: string; + }; + path: { + requestID: string; + }; + query?: { + directory?: string; + }; + url: '/permission/{requestID}/reply'; +}; export type PermissionReplyErrors = { - /** - * Bad request - */ - 400: BadRequestError - /** - * Not found - */ - 404: NotFoundError -} + /** + * Bad request + */ + 400: BadRequestError; + /** + * Not found + */ + 404: NotFoundError; +}; -export type PermissionReplyError = PermissionReplyErrors[keyof PermissionReplyErrors] +export type PermissionReplyError = PermissionReplyErrors[keyof PermissionReplyErrors]; export type PermissionReplyResponses = { - /** - * Permission processed successfully - */ - 200: boolean -} + /** + * Permission processed successfully + */ + 200: boolean; +}; -export type PermissionReplyResponse = PermissionReplyResponses[keyof PermissionReplyResponses] +export type PermissionReplyResponse = PermissionReplyResponses[keyof PermissionReplyResponses]; export type PermissionListData = { - body?: never - path?: never - query?: { - directory?: string - } - url: "/permission" -} + body?: never; + path?: never; + query?: { + directory?: string; + }; + url: '/permission'; +}; export type PermissionListResponses = { - /** - * List of pending permissions - */ - 200: Array -} + /** + * List of pending permissions + */ + 200: Array; +}; -export type PermissionListResponse = PermissionListResponses[keyof PermissionListResponses] +export type PermissionListResponse = PermissionListResponses[keyof PermissionListResponses]; export type QuestionListData = { - body?: never - path?: never - query?: { - directory?: string - } - url: "/question" -} + body?: never; + path?: never; + query?: { + directory?: string; + }; + url: '/question'; +}; export type QuestionListResponses = { - /** - * List of pending questions - */ - 200: Array -} + /** + * List of pending questions + */ + 200: Array; +}; -export type QuestionListResponse = QuestionListResponses[keyof QuestionListResponses] +export type QuestionListResponse = QuestionListResponses[keyof QuestionListResponses]; export type QuestionReplyData = { - body?: { - answers: Array - } - path: { - requestID: string - } - query?: { - directory?: string - } - url: "/question/{requestID}/reply" -} + body?: { + answers: Array; + }; + path: { + requestID: string; + }; + query?: { + directory?: string; + }; + url: '/question/{requestID}/reply'; +}; export type QuestionReplyErrors = { - /** - * Bad request - */ - 400: BadRequestError - /** - * Not found - */ - 404: NotFoundError -} + /** + * Bad request + */ + 400: BadRequestError; + /** + * Not found + */ + 404: NotFoundError; +}; -export type QuestionReplyError = QuestionReplyErrors[keyof QuestionReplyErrors] +export type QuestionReplyError = QuestionReplyErrors[keyof QuestionReplyErrors]; export type QuestionReplyResponses = { - /** - * Question answered successfully - */ - 200: boolean -} + /** + * Question answered successfully + */ + 200: boolean; +}; -export type QuestionReplyResponse = QuestionReplyResponses[keyof QuestionReplyResponses] +export type QuestionReplyResponse = QuestionReplyResponses[keyof QuestionReplyResponses]; export type QuestionRejectData = { - body?: never - path: { - requestID: string - } - query?: { - directory?: string - } - url: "/question/{requestID}/reject" -} + body?: never; + path: { + requestID: string; + }; + query?: { + directory?: string; + }; + url: '/question/{requestID}/reject'; +}; export type QuestionRejectErrors = { - /** - * Bad request - */ - 400: BadRequestError - /** - * Not found - */ - 404: NotFoundError -} + /** + * Bad request + */ + 400: BadRequestError; + /** + * Not found + */ + 404: NotFoundError; +}; -export type QuestionRejectError = QuestionRejectErrors[keyof QuestionRejectErrors] +export type QuestionRejectError = QuestionRejectErrors[keyof QuestionRejectErrors]; export type QuestionRejectResponses = { - /** - * Question rejected successfully - */ - 200: boolean -} + /** + * Question rejected successfully + */ + 200: boolean; +}; -export type QuestionRejectResponse = QuestionRejectResponses[keyof QuestionRejectResponses] +export type QuestionRejectResponse = QuestionRejectResponses[keyof QuestionRejectResponses]; export type CommandListData = { - body?: never - path?: never - query?: { - directory?: string - } - url: "/command" -} + body?: never; + path?: never; + query?: { + directory?: string; + }; + url: '/command'; +}; export type CommandListResponses = { - /** - * List of commands - */ - 200: Array -} + /** + * List of commands + */ + 200: Array; +}; -export type CommandListResponse = CommandListResponses[keyof CommandListResponses] +export type CommandListResponse = CommandListResponses[keyof CommandListResponses]; export type ConfigProvidersData = { - body?: never - path?: never - query?: { - directory?: string - } - url: "/config/providers" -} + body?: never; + path?: never; + query?: { + directory?: string; + }; + url: '/config/providers'; +}; export type ConfigProvidersResponses = { - /** - * List of providers - */ - 200: { - providers: Array - default: { - [key: string]: string - } - } -} + /** + * List of providers + */ + 200: { + providers: Array; + default: { + [key: string]: string; + }; + }; +}; -export type ConfigProvidersResponse = ConfigProvidersResponses[keyof ConfigProvidersResponses] +export type ConfigProvidersResponse = ConfigProvidersResponses[keyof ConfigProvidersResponses]; export type ProviderListData = { - body?: never - path?: never - query?: { - directory?: string - } - url: "/provider" -} + body?: never; + path?: never; + query?: { + directory?: string; + }; + url: '/provider'; +}; export type ProviderListResponses = { - /** - * List of providers - */ - 200: { - all: Array<{ - api?: string - name: string - env: Array - id: string - npm?: string - models: { - [key: string]: { - id: string - name: string - family?: string - release_date: string - attachment: boolean - reasoning: boolean - temperature: boolean - tool_call: boolean - interleaved?: - | true - | { - field: "reasoning_content" | "reasoning_details" - } - cost?: { - input: number - output: number - cache_read?: number - cache_write?: number - context_over_200k?: { - input: number - output: number - cache_read?: number - cache_write?: number - } - } - limit: { - context: number - output: number - } - modalities?: { - input: Array<"text" | "audio" | "image" | "video" | "pdf"> - output: Array<"text" | "audio" | "image" | "video" | "pdf"> - } - experimental?: boolean - status?: "alpha" | "beta" | "deprecated" - options: { - [key: string]: unknown - } - headers?: { - [key: string]: string - } - provider?: { - npm: string - } - variants?: { - [key: string]: { - [key: string]: unknown - } - } - } - } - }> - default: { - [key: string]: string - } - connected: Array - } -} + /** + * List of providers + */ + 200: { + all: Array<{ + api?: string; + name: string; + env: Array; + id: string; + npm?: string; + models: { + [key: string]: { + id: string; + name: string; + family?: string; + release_date: string; + attachment: boolean; + reasoning: boolean; + temperature: boolean; + tool_call: boolean; + interleaved?: true | { + field: 'reasoning_content' | 'reasoning_details'; + }; + cost?: { + input: number; + output: number; + cache_read?: number; + cache_write?: number; + context_over_200k?: { + input: number; + output: number; + cache_read?: number; + cache_write?: number; + }; + }; + limit: { + context: number; + output: number; + }; + modalities?: { + input: Array<'text' | 'audio' | 'image' | 'video' | 'pdf'>; + output: Array<'text' | 'audio' | 'image' | 'video' | 'pdf'>; + }; + experimental?: boolean; + status?: 'alpha' | 'beta' | 'deprecated'; + options: { + [key: string]: unknown; + }; + headers?: { + [key: string]: string; + }; + provider?: { + npm: string; + }; + variants?: { + [key: string]: { + [key: string]: unknown; + }; + }; + }; + }; + }>; + default: { + [key: string]: string; + }; + connected: Array; + }; +}; -export type ProviderListResponse = ProviderListResponses[keyof ProviderListResponses] +export type ProviderListResponse = ProviderListResponses[keyof ProviderListResponses]; export type ProviderAuthData = { - body?: never - path?: never - query?: { - directory?: string - } - url: "/provider/auth" -} + body?: never; + path?: never; + query?: { + directory?: string; + }; + url: '/provider/auth'; +}; export type ProviderAuthResponses = { - /** - * Provider auth methods - */ - 200: { - [key: string]: Array - } -} + /** + * Provider auth methods + */ + 200: { + [key: string]: Array; + }; +}; -export type ProviderAuthResponse = ProviderAuthResponses[keyof ProviderAuthResponses] +export type ProviderAuthResponse = ProviderAuthResponses[keyof ProviderAuthResponses]; export type ProviderOauthAuthorizeData = { - body?: { - /** - * Auth method index - */ - method: number - } - path: { - /** - * Provider ID - */ - providerID: string - } - query?: { - directory?: string - } - url: "/provider/{providerID}/oauth/authorize" -} + body?: { + /** + * Auth method index + */ + method: number; + }; + path: { + /** + * Provider ID + */ + providerID: string; + }; + query?: { + directory?: string; + }; + url: '/provider/{providerID}/oauth/authorize'; +}; export type ProviderOauthAuthorizeErrors = { - /** - * Bad request - */ - 400: BadRequestError -} + /** + * Bad request + */ + 400: BadRequestError; +}; -export type ProviderOauthAuthorizeError = ProviderOauthAuthorizeErrors[keyof ProviderOauthAuthorizeErrors] +export type ProviderOauthAuthorizeError = ProviderOauthAuthorizeErrors[keyof ProviderOauthAuthorizeErrors]; export type ProviderOauthAuthorizeResponses = { - /** - * Authorization URL and method - */ - 200: ProviderAuthAuthorization -} + /** + * Authorization URL and method + */ + 200: ProviderAuthAuthorization; +}; -export type ProviderOauthAuthorizeResponse = ProviderOauthAuthorizeResponses[keyof ProviderOauthAuthorizeResponses] +export type ProviderOauthAuthorizeResponse = ProviderOauthAuthorizeResponses[keyof ProviderOauthAuthorizeResponses]; export type ProviderOauthCallbackData = { - body?: { - /** - * Auth method index - */ - method: number - /** - * OAuth authorization code - */ - code?: string - } - path: { - /** - * Provider ID - */ - providerID: string - } - query?: { - directory?: string - } - url: "/provider/{providerID}/oauth/callback" -} + body?: { + /** + * Auth method index + */ + method: number; + /** + * OAuth authorization code + */ + code?: string; + }; + path: { + /** + * Provider ID + */ + providerID: string; + }; + query?: { + directory?: string; + }; + url: '/provider/{providerID}/oauth/callback'; +}; export type ProviderOauthCallbackErrors = { - /** - * Bad request - */ - 400: BadRequestError -} + /** + * Bad request + */ + 400: BadRequestError; +}; -export type ProviderOauthCallbackError = ProviderOauthCallbackErrors[keyof ProviderOauthCallbackErrors] +export type ProviderOauthCallbackError = ProviderOauthCallbackErrors[keyof ProviderOauthCallbackErrors]; export type ProviderOauthCallbackResponses = { - /** - * OAuth callback processed successfully - */ - 200: boolean -} + /** + * OAuth callback processed successfully + */ + 200: boolean; +}; -export type ProviderOauthCallbackResponse = ProviderOauthCallbackResponses[keyof ProviderOauthCallbackResponses] +export type ProviderOauthCallbackResponse = ProviderOauthCallbackResponses[keyof ProviderOauthCallbackResponses]; export type FindTextData = { - body?: never - path?: never - query: { - directory?: string - pattern: string - } - url: "/find" -} + body?: never; + path?: never; + query: { + directory?: string; + pattern: string; + }; + url: '/find'; +}; export type FindTextResponses = { - /** - * Matches - */ - 200: Array<{ - path: { - text: string - } - lines: { - text: string - } - line_number: number - absolute_offset: number - submatches: Array<{ - match: { - text: string - } - start: number - end: number - }> - }> -} + /** + * Matches + */ + 200: Array<{ + path: { + text: string; + }; + lines: { + text: string; + }; + line_number: number; + absolute_offset: number; + submatches: Array<{ + match: { + text: string; + }; + start: number; + end: number; + }>; + }>; +}; -export type FindTextResponse = FindTextResponses[keyof FindTextResponses] +export type FindTextResponse = FindTextResponses[keyof FindTextResponses]; export type FindFilesData = { - body?: never - path?: never - query: { - directory?: string - query: string - dirs?: "true" | "false" - type?: "file" | "directory" - limit?: number - } - url: "/find/file" -} + body?: never; + path?: never; + query: { + directory?: string; + query: string; + dirs?: 'true' | 'false'; + type?: 'file' | 'directory'; + limit?: number; + }; + url: '/find/file'; +}; export type FindFilesResponses = { - /** - * File paths - */ - 200: Array -} + /** + * File paths + */ + 200: Array; +}; -export type FindFilesResponse = FindFilesResponses[keyof FindFilesResponses] +export type FindFilesResponse = FindFilesResponses[keyof FindFilesResponses]; export type FindSymbolsData = { - body?: never - path?: never - query: { - directory?: string - query: string - } - url: "/find/symbol" -} + body?: never; + path?: never; + query: { + directory?: string; + query: string; + }; + url: '/find/symbol'; +}; export type FindSymbolsResponses = { - /** - * Symbols - */ - 200: Array -} + /** + * Symbols + */ + 200: Array; +}; -export type FindSymbolsResponse = FindSymbolsResponses[keyof FindSymbolsResponses] +export type FindSymbolsResponse = FindSymbolsResponses[keyof FindSymbolsResponses]; export type FileListData = { - body?: never - path?: never - query: { - directory?: string - path: string - } - url: "/file" -} + body?: never; + path?: never; + query: { + directory?: string; + path: string; + }; + url: '/file'; +}; export type FileListResponses = { - /** - * Files and directories - */ - 200: Array -} + /** + * Files and directories + */ + 200: Array; +}; -export type FileListResponse = FileListResponses[keyof FileListResponses] +export type FileListResponse = FileListResponses[keyof FileListResponses]; export type FileReadData = { - body?: never - path?: never - query: { - directory?: string - path: string - } - url: "/file/content" -} + body?: never; + path?: never; + query: { + directory?: string; + path: string; + }; + url: '/file/content'; +}; export type FileReadResponses = { - /** - * File content - */ - 200: FileContent -} + /** + * File content + */ + 200: FileContent; +}; -export type FileReadResponse = FileReadResponses[keyof FileReadResponses] +export type FileReadResponse = FileReadResponses[keyof FileReadResponses]; export type FileStatusData = { - body?: never - path?: never - query?: { - directory?: string - } - url: "/file/status" -} + body?: never; + path?: never; + query?: { + directory?: string; + }; + url: '/file/status'; +}; export type FileStatusResponses = { - /** - * File status - */ - 200: Array -} + /** + * File status + */ + 200: Array; +}; -export type FileStatusResponse = FileStatusResponses[keyof FileStatusResponses] +export type FileStatusResponse = FileStatusResponses[keyof FileStatusResponses]; export type AppLogData = { - body?: { - /** - * Service name for the log entry - */ - service: string - /** - * Log level - */ - level: "debug" | "info" | "error" | "warn" - /** - * Log message - */ - message: string - /** - * Additional metadata for the log entry - */ - extra?: { - [key: string]: unknown - } - } - path?: never - query?: { - directory?: string - } - url: "/log" -} + body?: { + /** + * Service name for the log entry + */ + service: string; + /** + * Log level + */ + level: 'debug' | 'info' | 'error' | 'warn'; + /** + * Log message + */ + message: string; + /** + * Additional metadata for the log entry + */ + extra?: { + [key: string]: unknown; + }; + }; + path?: never; + query?: { + directory?: string; + }; + url: '/log'; +}; export type AppLogErrors = { - /** - * Bad request - */ - 400: BadRequestError -} + /** + * Bad request + */ + 400: BadRequestError; +}; -export type AppLogError = AppLogErrors[keyof AppLogErrors] +export type AppLogError = AppLogErrors[keyof AppLogErrors]; export type AppLogResponses = { - /** - * Log entry written successfully - */ - 200: boolean -} + /** + * Log entry written successfully + */ + 200: boolean; +}; -export type AppLogResponse = AppLogResponses[keyof AppLogResponses] +export type AppLogResponse = AppLogResponses[keyof AppLogResponses]; export type AppAgentsData = { - body?: never - path?: never - query?: { - directory?: string - } - url: "/agent" -} + body?: never; + path?: never; + query?: { + directory?: string; + }; + url: '/agent'; +}; export type AppAgentsResponses = { - /** - * List of agents - */ - 200: Array -} + /** + * List of agents + */ + 200: Array; +}; -export type AppAgentsResponse = AppAgentsResponses[keyof AppAgentsResponses] +export type AppAgentsResponse = AppAgentsResponses[keyof AppAgentsResponses]; export type McpStatusData = { - body?: never - path?: never - query?: { - directory?: string - } - url: "/mcp" -} + body?: never; + path?: never; + query?: { + directory?: string; + }; + url: '/mcp'; +}; export type McpStatusResponses = { - /** - * MCP server status - */ - 200: { - [key: string]: McpStatus - } -} + /** + * MCP server status + */ + 200: { + [key: string]: McpStatus; + }; +}; -export type McpStatusResponse = McpStatusResponses[keyof McpStatusResponses] +export type McpStatusResponse = McpStatusResponses[keyof McpStatusResponses]; export type McpAddData = { - body?: { - name: string - config: McpLocalConfig | McpRemoteConfig - } - path?: never - query?: { - directory?: string - } - url: "/mcp" -} + body?: { + name: string; + config: McpLocalConfig | McpRemoteConfig; + }; + path?: never; + query?: { + directory?: string; + }; + url: '/mcp'; +}; export type McpAddErrors = { - /** - * Bad request - */ - 400: BadRequestError -} + /** + * Bad request + */ + 400: BadRequestError; +}; -export type McpAddError = McpAddErrors[keyof McpAddErrors] +export type McpAddError = McpAddErrors[keyof McpAddErrors]; export type McpAddResponses = { - /** - * MCP server added successfully - */ - 200: { - [key: string]: McpStatus - } -} + /** + * MCP server added successfully + */ + 200: { + [key: string]: McpStatus; + }; +}; -export type McpAddResponse = McpAddResponses[keyof McpAddResponses] +export type McpAddResponse = McpAddResponses[keyof McpAddResponses]; export type McpAuthRemoveData = { - body?: never - path: { - name: string - } - query?: { - directory?: string - } - url: "/mcp/{name}/auth" -} + body?: never; + path: { + name: string; + }; + query?: { + directory?: string; + }; + url: '/mcp/{name}/auth'; +}; export type McpAuthRemoveErrors = { - /** - * Not found - */ - 404: NotFoundError -} + /** + * Not found + */ + 404: NotFoundError; +}; -export type McpAuthRemoveError = McpAuthRemoveErrors[keyof McpAuthRemoveErrors] +export type McpAuthRemoveError = McpAuthRemoveErrors[keyof McpAuthRemoveErrors]; export type McpAuthRemoveResponses = { - /** - * OAuth credentials removed - */ - 200: { - success: true - } -} + /** + * OAuth credentials removed + */ + 200: { + success: true; + }; +}; -export type McpAuthRemoveResponse = McpAuthRemoveResponses[keyof McpAuthRemoveResponses] +export type McpAuthRemoveResponse = McpAuthRemoveResponses[keyof McpAuthRemoveResponses]; export type McpAuthStartData = { - body?: never - path: { - name: string - } - query?: { - directory?: string - } - url: "/mcp/{name}/auth" -} + body?: never; + path: { + name: string; + }; + query?: { + directory?: string; + }; + url: '/mcp/{name}/auth'; +}; export type McpAuthStartErrors = { - /** - * Bad request - */ - 400: BadRequestError - /** - * Not found - */ - 404: NotFoundError -} + /** + * Bad request + */ + 400: BadRequestError; + /** + * Not found + */ + 404: NotFoundError; +}; -export type McpAuthStartError = McpAuthStartErrors[keyof McpAuthStartErrors] +export type McpAuthStartError = McpAuthStartErrors[keyof McpAuthStartErrors]; export type McpAuthStartResponses = { - /** - * OAuth flow started - */ - 200: { /** - * URL to open in browser for authorization + * OAuth flow started */ - authorizationUrl: string - } -} + 200: { + /** + * URL to open in browser for authorization + */ + authorizationUrl: string; + }; +}; -export type McpAuthStartResponse = McpAuthStartResponses[keyof McpAuthStartResponses] +export type McpAuthStartResponse = McpAuthStartResponses[keyof McpAuthStartResponses]; export type McpAuthCallbackData = { - body?: { - /** - * Authorization code from OAuth callback - */ - code: string - } - path: { - name: string - } - query?: { - directory?: string - } - url: "/mcp/{name}/auth/callback" -} + body?: { + /** + * Authorization code from OAuth callback + */ + code: string; + }; + path: { + name: string; + }; + query?: { + directory?: string; + }; + url: '/mcp/{name}/auth/callback'; +}; export type McpAuthCallbackErrors = { - /** - * Bad request - */ - 400: BadRequestError - /** - * Not found - */ - 404: NotFoundError -} + /** + * Bad request + */ + 400: BadRequestError; + /** + * Not found + */ + 404: NotFoundError; +}; -export type McpAuthCallbackError = McpAuthCallbackErrors[keyof McpAuthCallbackErrors] +export type McpAuthCallbackError = McpAuthCallbackErrors[keyof McpAuthCallbackErrors]; export type McpAuthCallbackResponses = { - /** - * OAuth authentication completed - */ - 200: McpStatus -} + /** + * OAuth authentication completed + */ + 200: McpStatus; +}; -export type McpAuthCallbackResponse = McpAuthCallbackResponses[keyof McpAuthCallbackResponses] +export type McpAuthCallbackResponse = McpAuthCallbackResponses[keyof McpAuthCallbackResponses]; export type McpAuthAuthenticateData = { - body?: never - path: { - name: string - } - query?: { - directory?: string - } - url: "/mcp/{name}/auth/authenticate" -} + body?: never; + path: { + name: string; + }; + query?: { + directory?: string; + }; + url: '/mcp/{name}/auth/authenticate'; +}; export type McpAuthAuthenticateErrors = { - /** - * Bad request - */ - 400: BadRequestError - /** - * Not found - */ - 404: NotFoundError -} + /** + * Bad request + */ + 400: BadRequestError; + /** + * Not found + */ + 404: NotFoundError; +}; -export type McpAuthAuthenticateError = McpAuthAuthenticateErrors[keyof McpAuthAuthenticateErrors] +export type McpAuthAuthenticateError = McpAuthAuthenticateErrors[keyof McpAuthAuthenticateErrors]; export type McpAuthAuthenticateResponses = { - /** - * OAuth authentication completed - */ - 200: McpStatus -} + /** + * OAuth authentication completed + */ + 200: McpStatus; +}; -export type McpAuthAuthenticateResponse = McpAuthAuthenticateResponses[keyof McpAuthAuthenticateResponses] +export type McpAuthAuthenticateResponse = McpAuthAuthenticateResponses[keyof McpAuthAuthenticateResponses]; export type McpConnectData = { - body?: never - path: { - name: string - } - query?: { - directory?: string - } - url: "/mcp/{name}/connect" -} + body?: never; + path: { + name: string; + }; + query?: { + directory?: string; + }; + url: '/mcp/{name}/connect'; +}; export type McpConnectResponses = { - /** - * MCP server connected successfully - */ - 200: boolean -} + /** + * MCP server connected successfully + */ + 200: boolean; +}; -export type McpConnectResponse = McpConnectResponses[keyof McpConnectResponses] +export type McpConnectResponse = McpConnectResponses[keyof McpConnectResponses]; export type McpDisconnectData = { - body?: never - path: { - name: string - } - query?: { - directory?: string - } - url: "/mcp/{name}/disconnect" -} + body?: never; + path: { + name: string; + }; + query?: { + directory?: string; + }; + url: '/mcp/{name}/disconnect'; +}; export type McpDisconnectResponses = { - /** - * MCP server disconnected successfully - */ - 200: boolean -} + /** + * MCP server disconnected successfully + */ + 200: boolean; +}; -export type McpDisconnectResponse = McpDisconnectResponses[keyof McpDisconnectResponses] +export type McpDisconnectResponse = McpDisconnectResponses[keyof McpDisconnectResponses]; export type ExperimentalResourceListData = { - body?: never - path?: never - query?: { - directory?: string - } - url: "/experimental/resource" -} + body?: never; + path?: never; + query?: { + directory?: string; + }; + url: '/experimental/resource'; +}; export type ExperimentalResourceListResponses = { - /** - * MCP resources - */ - 200: { - [key: string]: McpResource - } -} + /** + * MCP resources + */ + 200: { + [key: string]: McpResource; + }; +}; -export type ExperimentalResourceListResponse = - ExperimentalResourceListResponses[keyof ExperimentalResourceListResponses] +export type ExperimentalResourceListResponse = ExperimentalResourceListResponses[keyof ExperimentalResourceListResponses]; export type LspStatusData = { - body?: never - path?: never - query?: { - directory?: string - } - url: "/lsp" -} + body?: never; + path?: never; + query?: { + directory?: string; + }; + url: '/lsp'; +}; export type LspStatusResponses = { - /** - * LSP server status - */ - 200: Array -} + /** + * LSP server status + */ + 200: Array; +}; -export type LspStatusResponse = LspStatusResponses[keyof LspStatusResponses] +export type LspStatusResponse = LspStatusResponses[keyof LspStatusResponses]; export type FormatterStatusData = { - body?: never - path?: never - query?: { - directory?: string - } - url: "/formatter" -} + body?: never; + path?: never; + query?: { + directory?: string; + }; + url: '/formatter'; +}; export type FormatterStatusResponses = { - /** - * Formatter status - */ - 200: Array -} + /** + * Formatter status + */ + 200: Array; +}; -export type FormatterStatusResponse = FormatterStatusResponses[keyof FormatterStatusResponses] +export type FormatterStatusResponse = FormatterStatusResponses[keyof FormatterStatusResponses]; export type TuiAppendPromptData = { - body?: { - text: string - } - path?: never - query?: { - directory?: string - } - url: "/tui/append-prompt" -} + body?: { + text: string; + }; + path?: never; + query?: { + directory?: string; + }; + url: '/tui/append-prompt'; +}; export type TuiAppendPromptErrors = { - /** - * Bad request - */ - 400: BadRequestError -} + /** + * Bad request + */ + 400: BadRequestError; +}; -export type TuiAppendPromptError = TuiAppendPromptErrors[keyof TuiAppendPromptErrors] +export type TuiAppendPromptError = TuiAppendPromptErrors[keyof TuiAppendPromptErrors]; export type TuiAppendPromptResponses = { - /** - * Prompt processed successfully - */ - 200: boolean -} + /** + * Prompt processed successfully + */ + 200: boolean; +}; -export type TuiAppendPromptResponse = TuiAppendPromptResponses[keyof TuiAppendPromptResponses] +export type TuiAppendPromptResponse = TuiAppendPromptResponses[keyof TuiAppendPromptResponses]; export type TuiOpenHelpData = { - body?: never - path?: never - query?: { - directory?: string - } - url: "/tui/open-help" -} + body?: never; + path?: never; + query?: { + directory?: string; + }; + url: '/tui/open-help'; +}; export type TuiOpenHelpResponses = { - /** - * Help dialog opened successfully - */ - 200: boolean -} + /** + * Help dialog opened successfully + */ + 200: boolean; +}; -export type TuiOpenHelpResponse = TuiOpenHelpResponses[keyof TuiOpenHelpResponses] +export type TuiOpenHelpResponse = TuiOpenHelpResponses[keyof TuiOpenHelpResponses]; export type TuiOpenSessionsData = { - body?: never - path?: never - query?: { - directory?: string - } - url: "/tui/open-sessions" -} + body?: never; + path?: never; + query?: { + directory?: string; + }; + url: '/tui/open-sessions'; +}; export type TuiOpenSessionsResponses = { - /** - * Session dialog opened successfully - */ - 200: boolean -} + /** + * Session dialog opened successfully + */ + 200: boolean; +}; -export type TuiOpenSessionsResponse = TuiOpenSessionsResponses[keyof TuiOpenSessionsResponses] +export type TuiOpenSessionsResponse = TuiOpenSessionsResponses[keyof TuiOpenSessionsResponses]; export type TuiOpenThemesData = { - body?: never - path?: never - query?: { - directory?: string - } - url: "/tui/open-themes" -} + body?: never; + path?: never; + query?: { + directory?: string; + }; + url: '/tui/open-themes'; +}; export type TuiOpenThemesResponses = { - /** - * Theme dialog opened successfully - */ - 200: boolean -} + /** + * Theme dialog opened successfully + */ + 200: boolean; +}; -export type TuiOpenThemesResponse = TuiOpenThemesResponses[keyof TuiOpenThemesResponses] +export type TuiOpenThemesResponse = TuiOpenThemesResponses[keyof TuiOpenThemesResponses]; export type TuiOpenModelsData = { - body?: never - path?: never - query?: { - directory?: string - } - url: "/tui/open-models" -} + body?: never; + path?: never; + query?: { + directory?: string; + }; + url: '/tui/open-models'; +}; export type TuiOpenModelsResponses = { - /** - * Model dialog opened successfully - */ - 200: boolean -} + /** + * Model dialog opened successfully + */ + 200: boolean; +}; -export type TuiOpenModelsResponse = TuiOpenModelsResponses[keyof TuiOpenModelsResponses] +export type TuiOpenModelsResponse = TuiOpenModelsResponses[keyof TuiOpenModelsResponses]; export type TuiSubmitPromptData = { - body?: never - path?: never - query?: { - directory?: string - } - url: "/tui/submit-prompt" -} + body?: never; + path?: never; + query?: { + directory?: string; + }; + url: '/tui/submit-prompt'; +}; export type TuiSubmitPromptResponses = { - /** - * Prompt submitted successfully - */ - 200: boolean -} + /** + * Prompt submitted successfully + */ + 200: boolean; +}; -export type TuiSubmitPromptResponse = TuiSubmitPromptResponses[keyof TuiSubmitPromptResponses] +export type TuiSubmitPromptResponse = TuiSubmitPromptResponses[keyof TuiSubmitPromptResponses]; export type TuiClearPromptData = { - body?: never - path?: never - query?: { - directory?: string - } - url: "/tui/clear-prompt" -} + body?: never; + path?: never; + query?: { + directory?: string; + }; + url: '/tui/clear-prompt'; +}; export type TuiClearPromptResponses = { - /** - * Prompt cleared successfully - */ - 200: boolean -} + /** + * Prompt cleared successfully + */ + 200: boolean; +}; -export type TuiClearPromptResponse = TuiClearPromptResponses[keyof TuiClearPromptResponses] +export type TuiClearPromptResponse = TuiClearPromptResponses[keyof TuiClearPromptResponses]; export type TuiExecuteCommandData = { - body?: { - command: string - } - path?: never - query?: { - directory?: string - } - url: "/tui/execute-command" -} + body?: { + command: string; + }; + path?: never; + query?: { + directory?: string; + }; + url: '/tui/execute-command'; +}; export type TuiExecuteCommandErrors = { - /** - * Bad request - */ - 400: BadRequestError -} + /** + * Bad request + */ + 400: BadRequestError; +}; -export type TuiExecuteCommandError = TuiExecuteCommandErrors[keyof TuiExecuteCommandErrors] +export type TuiExecuteCommandError = TuiExecuteCommandErrors[keyof TuiExecuteCommandErrors]; export type TuiExecuteCommandResponses = { - /** - * Command executed successfully - */ - 200: boolean -} + /** + * Command executed successfully + */ + 200: boolean; +}; -export type TuiExecuteCommandResponse = TuiExecuteCommandResponses[keyof TuiExecuteCommandResponses] +export type TuiExecuteCommandResponse = TuiExecuteCommandResponses[keyof TuiExecuteCommandResponses]; export type TuiShowToastData = { - body?: { - title?: string - message: string - variant: "info" | "success" | "warning" | "error" - /** - * Duration in milliseconds - */ - duration?: number - } - path?: never - query?: { - directory?: string - } - url: "/tui/show-toast" -} + body?: { + title?: string; + message: string; + variant: 'info' | 'success' | 'warning' | 'error'; + /** + * Duration in milliseconds + */ + duration?: number; + }; + path?: never; + query?: { + directory?: string; + }; + url: '/tui/show-toast'; +}; export type TuiShowToastResponses = { - /** - * Toast notification shown successfully - */ - 200: boolean -} + /** + * Toast notification shown successfully + */ + 200: boolean; +}; -export type TuiShowToastResponse = TuiShowToastResponses[keyof TuiShowToastResponses] +export type TuiShowToastResponse = TuiShowToastResponses[keyof TuiShowToastResponses]; export type TuiPublishData = { - body?: EventTuiPromptAppend | EventTuiCommandExecute | EventTuiToastShow | EventTuiSessionSelect - path?: never - query?: { - directory?: string - } - url: "/tui/publish" -} + body?: EventTuiPromptAppend | EventTuiCommandExecute | EventTuiToastShow | EventTuiSessionSelect; + path?: never; + query?: { + directory?: string; + }; + url: '/tui/publish'; +}; export type TuiPublishErrors = { - /** - * Bad request - */ - 400: BadRequestError -} + /** + * Bad request + */ + 400: BadRequestError; +}; -export type TuiPublishError = TuiPublishErrors[keyof TuiPublishErrors] +export type TuiPublishError = TuiPublishErrors[keyof TuiPublishErrors]; export type TuiPublishResponses = { - /** - * Event published successfully - */ - 200: boolean -} + /** + * Event published successfully + */ + 200: boolean; +}; -export type TuiPublishResponse = TuiPublishResponses[keyof TuiPublishResponses] +export type TuiPublishResponse = TuiPublishResponses[keyof TuiPublishResponses]; export type TuiSelectSessionData = { - body?: { - /** - * Session ID to navigate to - */ - sessionID: string - } - path?: never - query?: { - directory?: string - } - url: "/tui/select-session" -} + body?: { + /** + * Session ID to navigate to + */ + sessionID: string; + }; + path?: never; + query?: { + directory?: string; + }; + url: '/tui/select-session'; +}; export type TuiSelectSessionErrors = { - /** - * Bad request - */ - 400: BadRequestError - /** - * Not found - */ - 404: NotFoundError -} + /** + * Bad request + */ + 400: BadRequestError; + /** + * Not found + */ + 404: NotFoundError; +}; -export type TuiSelectSessionError = TuiSelectSessionErrors[keyof TuiSelectSessionErrors] +export type TuiSelectSessionError = TuiSelectSessionErrors[keyof TuiSelectSessionErrors]; export type TuiSelectSessionResponses = { - /** - * Session selected successfully - */ - 200: boolean -} + /** + * Session selected successfully + */ + 200: boolean; +}; -export type TuiSelectSessionResponse = TuiSelectSessionResponses[keyof TuiSelectSessionResponses] +export type TuiSelectSessionResponse = TuiSelectSessionResponses[keyof TuiSelectSessionResponses]; export type TuiControlNextData = { - body?: never - path?: never - query?: { - directory?: string - } - url: "/tui/control/next" -} + body?: never; + path?: never; + query?: { + directory?: string; + }; + url: '/tui/control/next'; +}; export type TuiControlNextResponses = { - /** - * Next TUI request - */ - 200: { - path: string - body: unknown - } -} + /** + * Next TUI request + */ + 200: { + path: string; + body: unknown; + }; +}; -export type TuiControlNextResponse = TuiControlNextResponses[keyof TuiControlNextResponses] +export type TuiControlNextResponse = TuiControlNextResponses[keyof TuiControlNextResponses]; export type TuiControlResponseData = { - body?: unknown - path?: never - query?: { - directory?: string - } - url: "/tui/control/response" -} + body?: unknown; + path?: never; + query?: { + directory?: string; + }; + url: '/tui/control/response'; +}; export type TuiControlResponseResponses = { - /** - * Response submitted successfully - */ - 200: boolean -} + /** + * Response submitted successfully + */ + 200: boolean; +}; -export type TuiControlResponseResponse = TuiControlResponseResponses[keyof TuiControlResponseResponses] +export type TuiControlResponseResponse = TuiControlResponseResponses[keyof TuiControlResponseResponses]; export type AuthSetData = { - body?: Auth - path: { - providerID: string - } - query?: { - directory?: string - } - url: "/auth/{providerID}" -} + body?: Auth; + path: { + providerID: string; + }; + query?: { + directory?: string; + }; + url: '/auth/{providerID}'; +}; export type AuthSetErrors = { - /** - * Bad request - */ - 400: BadRequestError -} + /** + * Bad request + */ + 400: BadRequestError; +}; -export type AuthSetError = AuthSetErrors[keyof AuthSetErrors] +export type AuthSetError = AuthSetErrors[keyof AuthSetErrors]; export type AuthSetResponses = { - /** - * Successfully set authentication credentials - */ - 200: boolean -} + /** + * Successfully set authentication credentials + */ + 200: boolean; +}; -export type AuthSetResponse = AuthSetResponses[keyof AuthSetResponses] +export type AuthSetResponse = AuthSetResponses[keyof AuthSetResponses]; export type EventSubscribeData = { - body?: never - path?: never - query?: { - directory?: string - } - url: "/event" -} + body?: never; + path?: never; + query?: { + directory?: string; + }; + url: '/event'; +}; export type EventSubscribeResponses = { - /** - * Event stream - */ - 200: Event -} + /** + * Event stream + */ + 200: Event; +}; -export type EventSubscribeResponse = EventSubscribeResponses[keyof EventSubscribeResponses] +export type EventSubscribeResponse = EventSubscribeResponses[keyof EventSubscribeResponses]; diff --git a/packages/sdk/openapi.json b/packages/sdk/openapi.json index 13346a625d9..690e8ac704b 100644 --- a/packages/sdk/openapi.json +++ b/packages/sdk/openapi.json @@ -27,7 +27,10 @@ "type": "string" } }, - "required": ["healthy", "version"] + "required": [ + "healthy", + "version" + ] } } } @@ -476,7 +479,10 @@ "type": "number" } }, - "required": ["rows", "cols"] + "required": [ + "rows", + "cols" + ] } } } @@ -1169,7 +1175,9 @@ ], "summary": "Get session", "description": "Retrieve detailed information about a specific OpenCode session.", - "tags": ["Session"], + "tags": [ + "Session" + ], "responses": { "200": { "description": "Get session", @@ -1375,7 +1383,9 @@ } ], "summary": "Get session children", - "tags": ["Session"], + "tags": [ + "Session" + ], "description": "Retrieve all child sessions that were forked from the specified parent session.", "responses": { "200": { @@ -1558,7 +1568,11 @@ "pattern": "^msg.*" } }, - "required": ["modelID", "providerID", "messageID"] + "required": [ + "modelID", + "providerID", + "messageID" + ] } } } @@ -1960,7 +1974,10 @@ "type": "boolean" } }, - "required": ["providerID", "modelID"] + "required": [ + "providerID", + "modelID" + ] } } } @@ -2023,7 +2040,10 @@ } } }, - "required": ["info", "parts"] + "required": [ + "info", + "parts" + ] } } } @@ -2097,7 +2117,10 @@ } } }, - "required": ["info", "parts"] + "required": [ + "info", + "parts" + ] } } } @@ -2143,7 +2166,10 @@ "type": "string" } }, - "required": ["providerID", "modelID"] + "required": [ + "providerID", + "modelID" + ] }, "agent": { "type": "string" @@ -2187,7 +2213,9 @@ } } }, - "required": ["parts"] + "required": [ + "parts" + ] } } } @@ -2250,7 +2278,10 @@ } } }, - "required": ["info", "parts"] + "required": [ + "info", + "parts" + ] } } } @@ -2519,7 +2550,10 @@ "type": "string" } }, - "required": ["providerID", "modelID"] + "required": [ + "providerID", + "modelID" + ] }, "agent": { "type": "string" @@ -2563,7 +2597,9 @@ } } }, - "required": ["parts"] + "required": [ + "parts" + ] } } } @@ -2617,7 +2653,10 @@ } } }, - "required": ["info", "parts"] + "required": [ + "info", + "parts" + ] } } } @@ -2695,13 +2734,20 @@ "$ref": "#/components/schemas/FilePartSource" } }, - "required": ["type", "mime", "url"] + "required": [ + "type", + "mime", + "url" + ] } ] } } }, - "required": ["arguments", "command"] + "required": [ + "arguments", + "command" + ] } } } @@ -2788,13 +2834,19 @@ "type": "string" } }, - "required": ["providerID", "modelID"] + "required": [ + "providerID", + "modelID" + ] }, "command": { "type": "string" } }, - "required": ["agent", "command"] + "required": [ + "agent", + "command" + ] } } } @@ -2876,7 +2928,9 @@ "pattern": "^prt.*" } }, - "required": ["messageID"] + "required": [ + "messageID" + ] } } } @@ -3022,10 +3076,16 @@ "properties": { "response": { "type": "string", - "enum": ["once", "always", "reject"] + "enum": [ + "once", + "always", + "reject" + ] } }, - "required": ["response"] + "required": [ + "response" + ] } } } @@ -3100,13 +3160,19 @@ "properties": { "reply": { "type": "string", - "enum": ["once", "always", "reject"] + "enum": [ + "once", + "always", + "reject" + ] }, "message": { "type": "string" } }, - "required": ["reply"] + "required": [ + "reply" + ] } } } @@ -3260,7 +3326,9 @@ } } }, - "required": ["answers"] + "required": [ + "answers" + ] } } } @@ -3410,7 +3478,10 @@ } } }, - "required": ["providers", "default"] + "required": [ + "providers", + "default" + ] } } } @@ -3512,10 +3583,15 @@ "properties": { "field": { "type": "string", - "enum": ["reasoning_content", "reasoning_details"] + "enum": [ + "reasoning_content", + "reasoning_details" + ] } }, - "required": ["field"], + "required": [ + "field" + ], "additionalProperties": false } ] @@ -3551,10 +3627,16 @@ "type": "number" } }, - "required": ["input", "output"] + "required": [ + "input", + "output" + ] } }, - "required": ["input", "output"] + "required": [ + "input", + "output" + ] }, "limit": { "type": "object", @@ -3566,7 +3648,10 @@ "type": "number" } }, - "required": ["context", "output"] + "required": [ + "context", + "output" + ] }, "modalities": { "type": "object", @@ -3575,25 +3660,44 @@ "type": "array", "items": { "type": "string", - "enum": ["text", "audio", "image", "video", "pdf"] + "enum": [ + "text", + "audio", + "image", + "video", + "pdf" + ] } }, "output": { "type": "array", "items": { "type": "string", - "enum": ["text", "audio", "image", "video", "pdf"] + "enum": [ + "text", + "audio", + "image", + "video", + "pdf" + ] } } }, - "required": ["input", "output"] + "required": [ + "input", + "output" + ] }, "experimental": { "type": "boolean" }, "status": { "type": "string", - "enum": ["alpha", "beta", "deprecated"] + "enum": [ + "alpha", + "beta", + "deprecated" + ] }, "options": { "type": "object", @@ -3618,7 +3722,9 @@ "type": "string" } }, - "required": ["npm"] + "required": [ + "npm" + ] }, "variants": { "type": "object", @@ -3648,7 +3754,12 @@ } } }, - "required": ["name", "env", "id", "models"] + "required": [ + "name", + "env", + "id", + "models" + ] } }, "default": { @@ -3667,7 +3778,11 @@ } } }, - "required": ["all", "default", "connected"] + "required": [ + "all", + "default", + "connected" + ] } } } @@ -3780,7 +3895,9 @@ "type": "number" } }, - "required": ["method"] + "required": [ + "method" + ] } } } @@ -3853,7 +3970,9 @@ "type": "string" } }, - "required": ["method"] + "required": [ + "method" + ] } } } @@ -3905,7 +4024,9 @@ "type": "string" } }, - "required": ["text"] + "required": [ + "text" + ] }, "lines": { "type": "object", @@ -3914,7 +4035,9 @@ "type": "string" } }, - "required": ["text"] + "required": [ + "text" + ] }, "line_number": { "type": "number" @@ -3934,7 +4057,9 @@ "type": "string" } }, - "required": ["text"] + "required": [ + "text" + ] }, "start": { "type": "number" @@ -3943,11 +4068,21 @@ "type": "number" } }, - "required": ["match", "start", "end"] + "required": [ + "match", + "start", + "end" + ] } } }, - "required": ["path", "lines", "line_number", "absolute_offset", "submatches"] + "required": [ + "path", + "lines", + "line_number", + "absolute_offset", + "submatches" + ] } } } @@ -3986,7 +4121,10 @@ "name": "dirs", "schema": { "type": "string", - "enum": ["true", "false"] + "enum": [ + "true", + "false" + ] } }, { @@ -3994,7 +4132,10 @@ "name": "type", "schema": { "type": "string", - "enum": ["file", "directory"] + "enum": [ + "file", + "directory" + ] } }, { @@ -4250,7 +4391,12 @@ "level": { "description": "Log level", "type": "string", - "enum": ["debug", "info", "error", "warn"] + "enum": [ + "debug", + "info", + "error", + "warn" + ] }, "message": { "description": "Log message", @@ -4265,7 +4411,11 @@ "additionalProperties": {} } }, - "required": ["service", "level", "message"] + "required": [ + "service", + "level", + "message" + ] } } } @@ -4415,7 +4565,10 @@ ] } }, - "required": ["name", "config"] + "required": [ + "name", + "config" + ] } } } @@ -4463,7 +4616,9 @@ "type": "string" } }, - "required": ["authorizationUrl"] + "required": [ + "authorizationUrl" + ] } } } @@ -4530,7 +4685,9 @@ "const": true } }, - "required": ["success"] + "required": [ + "success" + ] } } } @@ -4619,7 +4776,9 @@ "type": "string" } }, - "required": ["code"] + "required": [ + "code" + ] } } } @@ -4936,7 +5095,9 @@ "type": "string" } }, - "required": ["text"] + "required": [ + "text" + ] } } } @@ -5199,7 +5360,9 @@ "type": "string" } }, - "required": ["command"] + "required": [ + "command" + ] } } } @@ -5252,7 +5415,12 @@ }, "variant": { "type": "string", - "enum": ["info", "success", "warning", "error"] + "enum": [ + "info", + "success", + "warning", + "error" + ] }, "duration": { "description": "Duration in milliseconds", @@ -5260,7 +5428,10 @@ "type": "number" } }, - "required": ["message", "variant"] + "required": [ + "message", + "variant" + ] } } } @@ -5397,7 +5568,9 @@ "pattern": "^ses" } }, - "required": ["sessionID"] + "required": [ + "sessionID" + ] } } } @@ -5437,7 +5610,10 @@ }, "body": {} }, - "required": ["path", "body"] + "required": [ + "path", + "body" + ] } } } @@ -5604,10 +5780,15 @@ "type": "string" } }, - "required": ["version"] + "required": [ + "version" + ] } }, - "required": ["type", "properties"] + "required": [ + "type", + "properties" + ] }, "Event.installation.update-available": { "type": "object", @@ -5623,10 +5804,15 @@ "type": "string" } }, - "required": ["version"] + "required": [ + "version" + ] } }, - "required": ["type", "properties"] + "required": [ + "type", + "properties" + ] }, "Project": { "type": "object", @@ -5668,7 +5854,10 @@ "type": "number" } }, - "required": ["created", "updated"] + "required": [ + "created", + "updated" + ] }, "sandboxes": { "type": "array", @@ -5677,7 +5866,12 @@ } } }, - "required": ["id", "worktree", "time", "sandboxes"] + "required": [ + "id", + "worktree", + "time", + "sandboxes" + ] }, "Event.project.updated": { "type": "object", @@ -5690,7 +5884,10 @@ "$ref": "#/components/schemas/Project" } }, - "required": ["type", "properties"] + "required": [ + "type", + "properties" + ] }, "Event.server.instance.disposed": { "type": "object", @@ -5706,10 +5903,15 @@ "type": "string" } }, - "required": ["directory"] + "required": [ + "directory" + ] } }, - "required": ["type", "properties"] + "required": [ + "type", + "properties" + ] }, "Event.lsp.client.diagnostics": { "type": "object", @@ -5728,10 +5930,16 @@ "type": "string" } }, - "required": ["serverID", "path"] + "required": [ + "serverID", + "path" + ] } }, - "required": ["type", "properties"] + "required": [ + "type", + "properties" + ] }, "Event.lsp.updated": { "type": "object", @@ -5745,7 +5953,10 @@ "properties": {} } }, - "required": ["type", "properties"] + "required": [ + "type", + "properties" + ] }, "FileDiff": { "type": "object", @@ -5766,7 +5977,13 @@ "type": "number" } }, - "required": ["file", "before", "after", "additions", "deletions"] + "required": [ + "file", + "before", + "after", + "additions", + "deletions" + ] }, "UserMessage": { "type": "object", @@ -5788,7 +6005,9 @@ "type": "number" } }, - "required": ["created"] + "required": [ + "created" + ] }, "summary": { "type": "object", @@ -5806,7 +6025,9 @@ } } }, - "required": ["diffs"] + "required": [ + "diffs" + ] }, "agent": { "type": "string" @@ -5821,7 +6042,10 @@ "type": "string" } }, - "required": ["providerID", "modelID"] + "required": [ + "providerID", + "modelID" + ] }, "system": { "type": "string" @@ -5839,7 +6063,14 @@ "type": "string" } }, - "required": ["id", "sessionID", "role", "time", "agent", "model"] + "required": [ + "id", + "sessionID", + "role", + "time", + "agent", + "model" + ] }, "ProviderAuthError": { "type": "object", @@ -5858,10 +6089,16 @@ "type": "string" } }, - "required": ["providerID", "message"] + "required": [ + "providerID", + "message" + ] } }, - "required": ["name", "data"] + "required": [ + "name", + "data" + ] }, "UnknownError": { "type": "object", @@ -5877,10 +6114,15 @@ "type": "string" } }, - "required": ["message"] + "required": [ + "message" + ] } }, - "required": ["name", "data"] + "required": [ + "name", + "data" + ] }, "MessageOutputLengthError": { "type": "object", @@ -5894,7 +6136,10 @@ "properties": {} } }, - "required": ["name", "data"] + "required": [ + "name", + "data" + ] }, "MessageAbortedError": { "type": "object", @@ -5910,10 +6155,15 @@ "type": "string" } }, - "required": ["message"] + "required": [ + "message" + ] } }, - "required": ["name", "data"] + "required": [ + "name", + "data" + ] }, "APIError": { "type": "object", @@ -5956,10 +6206,16 @@ } } }, - "required": ["message", "isRetryable"] + "required": [ + "message", + "isRetryable" + ] } }, - "required": ["name", "data"] + "required": [ + "name", + "data" + ] }, "AssistantMessage": { "type": "object", @@ -5984,7 +6240,9 @@ "type": "number" } }, - "required": ["created"] + "required": [ + "created" + ] }, "error": { "anyOf": [ @@ -6030,7 +6288,10 @@ "type": "string" } }, - "required": ["cwd", "root"] + "required": [ + "cwd", + "root" + ] }, "summary": { "type": "boolean" @@ -6060,10 +6321,18 @@ "type": "number" } }, - "required": ["read", "write"] + "required": [ + "read", + "write" + ] } }, - "required": ["input", "output", "reasoning", "cache"] + "required": [ + "input", + "output", + "reasoning", + "cache" + ] }, "finish": { "type": "string" @@ -6108,10 +6377,15 @@ "$ref": "#/components/schemas/Message" } }, - "required": ["info"] + "required": [ + "info" + ] } }, - "required": ["type", "properties"] + "required": [ + "type", + "properties" + ] }, "Event.message.removed": { "type": "object", @@ -6130,10 +6404,16 @@ "type": "string" } }, - "required": ["sessionID", "messageID"] + "required": [ + "sessionID", + "messageID" + ] } }, - "required": ["type", "properties"] + "required": [ + "type", + "properties" + ] }, "TextPart": { "type": "object", @@ -6170,7 +6450,9 @@ "type": "number" } }, - "required": ["start"] + "required": [ + "start" + ] }, "metadata": { "type": "object", @@ -6180,7 +6462,13 @@ "additionalProperties": {} } }, - "required": ["id", "sessionID", "messageID", "type", "text"] + "required": [ + "id", + "sessionID", + "messageID", + "type", + "text" + ] }, "ReasoningPart": { "type": "object", @@ -6218,10 +6506,19 @@ "type": "number" } }, - "required": ["start"] + "required": [ + "start" + ] } }, - "required": ["id", "sessionID", "messageID", "type", "text", "time"] + "required": [ + "id", + "sessionID", + "messageID", + "type", + "text", + "time" + ] }, "FilePartSourceText": { "type": "object", @@ -6240,7 +6537,11 @@ "maximum": 9007199254740991 } }, - "required": ["value", "start", "end"] + "required": [ + "value", + "start", + "end" + ] }, "FileSource": { "type": "object", @@ -6256,7 +6557,11 @@ "type": "string" } }, - "required": ["text", "type", "path"] + "required": [ + "text", + "type", + "path" + ] }, "Range": { "type": "object", @@ -6271,7 +6576,10 @@ "type": "number" } }, - "required": ["line", "character"] + "required": [ + "line", + "character" + ] }, "end": { "type": "object", @@ -6283,10 +6591,16 @@ "type": "number" } }, - "required": ["line", "character"] + "required": [ + "line", + "character" + ] } }, - "required": ["start", "end"] + "required": [ + "start", + "end" + ] }, "SymbolSource": { "type": "object", @@ -6313,7 +6627,14 @@ "maximum": 9007199254740991 } }, - "required": ["text", "type", "path", "range", "name", "kind"] + "required": [ + "text", + "type", + "path", + "range", + "name", + "kind" + ] }, "ResourceSource": { "type": "object", @@ -6332,7 +6653,12 @@ "type": "string" } }, - "required": ["text", "type", "clientName", "uri"] + "required": [ + "text", + "type", + "clientName", + "uri" + ] }, "FilePartSource": { "anyOf": [ @@ -6376,7 +6702,14 @@ "$ref": "#/components/schemas/FilePartSource" } }, - "required": ["id", "sessionID", "messageID", "type", "mime", "url"] + "required": [ + "id", + "sessionID", + "messageID", + "type", + "mime", + "url" + ] }, "ToolStatePending": { "type": "object", @@ -6396,7 +6729,11 @@ "type": "string" } }, - "required": ["status", "input", "raw"] + "required": [ + "status", + "input", + "raw" + ] }, "ToolStateRunning": { "type": "object", @@ -6429,10 +6766,16 @@ "type": "number" } }, - "required": ["start"] + "required": [ + "start" + ] } }, - "required": ["status", "input", "time"] + "required": [ + "status", + "input", + "time" + ] }, "ToolStateCompleted": { "type": "object", @@ -6474,7 +6817,10 @@ "type": "number" } }, - "required": ["start", "end"] + "required": [ + "start", + "end" + ] }, "attachments": { "type": "array", @@ -6483,7 +6829,14 @@ } } }, - "required": ["status", "input", "output", "title", "metadata", "time"] + "required": [ + "status", + "input", + "output", + "title", + "metadata", + "time" + ] }, "ToolStateError": { "type": "object", @@ -6519,10 +6872,18 @@ "type": "number" } }, - "required": ["start", "end"] + "required": [ + "start", + "end" + ] } }, - "required": ["status", "input", "error", "time"] + "required": [ + "status", + "input", + "error", + "time" + ] }, "ToolState": { "anyOf": [ @@ -6573,7 +6934,15 @@ "additionalProperties": {} } }, - "required": ["id", "sessionID", "messageID", "type", "callID", "tool", "state"] + "required": [ + "id", + "sessionID", + "messageID", + "type", + "callID", + "tool", + "state" + ] }, "StepStartPart": { "type": "object", @@ -6595,7 +6964,12 @@ "type": "string" } }, - "required": ["id", "sessionID", "messageID", "type"] + "required": [ + "id", + "sessionID", + "messageID", + "type" + ] }, "StepFinishPart": { "type": "object", @@ -6644,13 +7018,29 @@ "type": "number" } }, - "required": ["read", "write"] + "required": [ + "read", + "write" + ] } }, - "required": ["input", "output", "reasoning", "cache"] + "required": [ + "input", + "output", + "reasoning", + "cache" + ] } }, - "required": ["id", "sessionID", "messageID", "type", "reason", "cost", "tokens"] + "required": [ + "id", + "sessionID", + "messageID", + "type", + "reason", + "cost", + "tokens" + ] }, "SnapshotPart": { "type": "object", @@ -6672,7 +7062,13 @@ "type": "string" } }, - "required": ["id", "sessionID", "messageID", "type", "snapshot"] + "required": [ + "id", + "sessionID", + "messageID", + "type", + "snapshot" + ] }, "PatchPart": { "type": "object", @@ -6700,7 +7096,14 @@ } } }, - "required": ["id", "sessionID", "messageID", "type", "hash", "files"] + "required": [ + "id", + "sessionID", + "messageID", + "type", + "hash", + "files" + ] }, "AgentPart": { "type": "object", @@ -6738,10 +7141,20 @@ "maximum": 9007199254740991 } }, - "required": ["value", "start", "end"] + "required": [ + "value", + "start", + "end" + ] } }, - "required": ["id", "sessionID", "messageID", "type", "name"] + "required": [ + "id", + "sessionID", + "messageID", + "type", + "name" + ] }, "RetryPart": { "type": "object", @@ -6772,10 +7185,20 @@ "type": "number" } }, - "required": ["created"] + "required": [ + "created" + ] } }, - "required": ["id", "sessionID", "messageID", "type", "attempt", "error", "time"] + "required": [ + "id", + "sessionID", + "messageID", + "type", + "attempt", + "error", + "time" + ] }, "CompactionPart": { "type": "object", @@ -6797,7 +7220,13 @@ "type": "boolean" } }, - "required": ["id", "sessionID", "messageID", "type", "auto"] + "required": [ + "id", + "sessionID", + "messageID", + "type", + "auto" + ] }, "Part": { "anyOf": [ @@ -6833,7 +7262,15 @@ "type": "string" } }, - "required": ["id", "sessionID", "messageID", "type", "prompt", "description", "agent"] + "required": [ + "id", + "sessionID", + "messageID", + "type", + "prompt", + "description", + "agent" + ] }, { "$ref": "#/components/schemas/ReasoningPart" @@ -6884,10 +7321,15 @@ "type": "string" } }, - "required": ["part"] + "required": [ + "part" + ] } }, - "required": ["type", "properties"] + "required": [ + "type", + "properties" + ] }, "Event.message.part.removed": { "type": "object", @@ -6909,10 +7351,17 @@ "type": "string" } }, - "required": ["sessionID", "messageID", "partID"] + "required": [ + "sessionID", + "messageID", + "partID" + ] } }, - "required": ["type", "properties"] + "required": [ + "type", + "properties" + ] }, "PermissionRequest": { "type": "object", @@ -6957,10 +7406,20 @@ "type": "string" } }, - "required": ["messageID", "callID"] + "required": [ + "messageID", + "callID" + ] } }, - "required": ["id", "sessionID", "permission", "patterns", "metadata", "always"] + "required": [ + "id", + "sessionID", + "permission", + "patterns", + "metadata", + "always" + ] }, "Event.permission.asked": { "type": "object", @@ -6973,7 +7432,10 @@ "$ref": "#/components/schemas/PermissionRequest" } }, - "required": ["type", "properties"] + "required": [ + "type", + "properties" + ] }, "Event.permission.replied": { "type": "object", @@ -6993,13 +7455,24 @@ }, "reply": { "type": "string", - "enum": ["once", "always", "reject"] + "enum": [ + "once", + "always", + "reject" + ] } }, - "required": ["sessionID", "requestID", "reply"] + "required": [ + "sessionID", + "requestID", + "reply" + ] } }, - "required": ["type", "properties"] + "required": [ + "type", + "properties" + ] }, "SessionStatus": { "anyOf": [ @@ -7011,7 +7484,9 @@ "const": "idle" } }, - "required": ["type"] + "required": [ + "type" + ] }, { "type": "object", @@ -7030,7 +7505,12 @@ "type": "number" } }, - "required": ["type", "attempt", "message", "next"] + "required": [ + "type", + "attempt", + "message", + "next" + ] }, { "type": "object", @@ -7040,7 +7520,9 @@ "const": "busy" } }, - "required": ["type"] + "required": [ + "type" + ] } ] }, @@ -7061,10 +7543,16 @@ "$ref": "#/components/schemas/SessionStatus" } }, - "required": ["sessionID", "status"] + "required": [ + "sessionID", + "status" + ] } }, - "required": ["type", "properties"] + "required": [ + "type", + "properties" + ] }, "Event.session.idle": { "type": "object", @@ -7080,10 +7568,152 @@ "type": "string" } }, - "required": ["sessionID"] + "required": [ + "sessionID" + ] } }, - "required": ["type", "properties"] + "required": [ + "type", + "properties" + ] + }, + "Event.circuit-breaker.state-changed": { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "circuit-breaker.state-changed" + }, + "properties": { + "type": "object", + "properties": { + "providerID": { + "type": "string" + }, + "previousState": { + "type": "string", + "enum": [ + "closed", + "open", + "half_open" + ] + }, + "newState": { + "type": "string", + "enum": [ + "closed", + "open", + "half_open" + ] + }, + "reason": { + "type": "string" + } + }, + "required": [ + "providerID", + "previousState", + "newState", + "reason" + ] + } + }, + "required": [ + "type", + "properties" + ] + }, + "Event.fallback.used": { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "fallback.used" + }, + "properties": { + "type": "object", + "properties": { + "sessionID": { + "type": "string" + }, + "originalProvider": { + "type": "string" + }, + "originalModel": { + "type": "string" + }, + "fallbackProvider": { + "type": "string" + }, + "fallbackModel": { + "type": "string" + }, + "reason": { + "type": "string" + }, + "attempt": { + "type": "number" + } + }, + "required": [ + "sessionID", + "originalProvider", + "originalModel", + "fallbackProvider", + "fallbackModel", + "reason", + "attempt" + ] + } + }, + "required": [ + "type", + "properties" + ] + }, + "Event.fallback.exhausted": { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "fallback.exhausted" + }, + "properties": { + "type": "object", + "properties": { + "sessionID": { + "type": "string" + }, + "originalProvider": { + "type": "string" + }, + "originalModel": { + "type": "string" + }, + "attempted": { + "type": "array", + "items": { + "type": "string" + } + }, + "lastError": { + "type": "string" + } + }, + "required": [ + "sessionID", + "originalProvider", + "originalModel", + "attempted", + "lastError" + ] + } + }, + "required": [ + "type", + "properties" + ] }, "QuestionOption": { "type": "object", @@ -7097,7 +7727,10 @@ "type": "string" } }, - "required": ["label", "description"] + "required": [ + "label", + "description" + ] }, "QuestionInfo": { "type": "object", @@ -7119,7 +7752,11 @@ } } }, - "required": ["question", "header", "options"] + "required": [ + "question", + "header", + "options" + ] }, "QuestionRequest": { "type": "object", @@ -7149,10 +7786,17 @@ "type": "string" } }, - "required": ["messageID", "callID"] + "required": [ + "messageID", + "callID" + ] } }, - "required": ["id", "sessionID", "questions"] + "required": [ + "id", + "sessionID", + "questions" + ] }, "Event.question.asked": { "type": "object", @@ -7165,7 +7809,10 @@ "$ref": "#/components/schemas/QuestionRequest" } }, - "required": ["type", "properties"] + "required": [ + "type", + "properties" + ] }, "Event.question.replied": { "type": "object", @@ -7190,10 +7837,17 @@ } } }, - "required": ["sessionID", "requestID", "answers"] + "required": [ + "sessionID", + "requestID", + "answers" + ] } }, - "required": ["type", "properties"] + "required": [ + "type", + "properties" + ] }, "Event.question.rejected": { "type": "object", @@ -7212,10 +7866,16 @@ "type": "string" } }, - "required": ["sessionID", "requestID"] + "required": [ + "sessionID", + "requestID" + ] } }, - "required": ["type", "properties"] + "required": [ + "type", + "properties" + ] }, "Event.session.compacted": { "type": "object", @@ -7231,10 +7891,15 @@ "type": "string" } }, - "required": ["sessionID"] + "required": [ + "sessionID" + ] } }, - "required": ["type", "properties"] + "required": [ + "type", + "properties" + ] }, "Event.file.edited": { "type": "object", @@ -7250,10 +7915,15 @@ "type": "string" } }, - "required": ["file"] + "required": [ + "file" + ] } }, - "required": ["type", "properties"] + "required": [ + "type", + "properties" + ] }, "Todo": { "type": "object", @@ -7275,7 +7945,12 @@ "type": "string" } }, - "required": ["content", "status", "priority", "id"] + "required": [ + "content", + "status", + "priority", + "id" + ] }, "Event.todo.updated": { "type": "object", @@ -7297,10 +7972,16 @@ } } }, - "required": ["sessionID", "todos"] + "required": [ + "sessionID", + "todos" + ] } }, - "required": ["type", "properties"] + "required": [ + "type", + "properties" + ] }, "Event.tui.prompt.append": { "type": "object", @@ -7316,10 +7997,15 @@ "type": "string" } }, - "required": ["text"] + "required": [ + "text" + ] } }, - "required": ["type", "properties"] + "required": [ + "type", + "properties" + ] }, "Event.tui.command.execute": { "type": "object", @@ -7358,10 +8044,15 @@ ] } }, - "required": ["command"] + "required": [ + "command" + ] } }, - "required": ["type", "properties"] + "required": [ + "type", + "properties" + ] }, "Event.tui.toast.show": { "type": "object", @@ -7381,7 +8072,12 @@ }, "variant": { "type": "string", - "enum": ["info", "success", "warning", "error"] + "enum": [ + "info", + "success", + "warning", + "error" + ] }, "duration": { "description": "Duration in milliseconds", @@ -7389,10 +8085,16 @@ "type": "number" } }, - "required": ["message", "variant"] + "required": [ + "message", + "variant" + ] } }, - "required": ["type", "properties"] + "required": [ + "type", + "properties" + ] }, "Event.tui.session.select": { "type": "object", @@ -7410,10 +8112,15 @@ "pattern": "^ses" } }, - "required": ["sessionID"] + "required": [ + "sessionID" + ] } }, - "required": ["type", "properties"] + "required": [ + "type", + "properties" + ] }, "Event.mcp.tools.changed": { "type": "object", @@ -7429,10 +8136,15 @@ "type": "string" } }, - "required": ["server"] + "required": [ + "server" + ] } }, - "required": ["type", "properties"] + "required": [ + "type", + "properties" + ] }, "Event.command.executed": { "type": "object", @@ -7459,14 +8171,26 @@ "pattern": "^msg.*" } }, - "required": ["name", "sessionID", "arguments", "messageID"] + "required": [ + "name", + "sessionID", + "arguments", + "messageID" + ] } }, - "required": ["type", "properties"] + "required": [ + "type", + "properties" + ] }, "PermissionAction": { "type": "string", - "enum": ["allow", "deny", "ask"] + "enum": [ + "allow", + "deny", + "ask" + ] }, "PermissionRule": { "type": "object", @@ -7481,7 +8205,11 @@ "$ref": "#/components/schemas/PermissionAction" } }, - "required": ["permission", "pattern", "action"] + "required": [ + "permission", + "pattern", + "action" + ] }, "PermissionRuleset": { "type": "array", @@ -7525,7 +8253,11 @@ } } }, - "required": ["additions", "deletions", "files"] + "required": [ + "additions", + "deletions", + "files" + ] }, "share": { "type": "object", @@ -7534,7 +8266,9 @@ "type": "string" } }, - "required": ["url"] + "required": [ + "url" + ] }, "title": { "type": "string" @@ -7558,7 +8292,10 @@ "type": "number" } }, - "required": ["created", "updated"] + "required": [ + "created", + "updated" + ] }, "permission": { "$ref": "#/components/schemas/PermissionRuleset" @@ -7579,10 +8316,19 @@ "type": "string" } }, - "required": ["messageID"] + "required": [ + "messageID" + ] } }, - "required": ["id", "projectID", "directory", "title", "version", "time"] + "required": [ + "id", + "projectID", + "directory", + "title", + "version", + "time" + ] }, "Event.session.created": { "type": "object", @@ -7598,10 +8344,15 @@ "$ref": "#/components/schemas/Session" } }, - "required": ["info"] + "required": [ + "info" + ] } }, - "required": ["type", "properties"] + "required": [ + "type", + "properties" + ] }, "Event.session.updated": { "type": "object", @@ -7617,10 +8368,15 @@ "$ref": "#/components/schemas/Session" } }, - "required": ["info"] + "required": [ + "info" + ] } }, - "required": ["type", "properties"] + "required": [ + "type", + "properties" + ] }, "Event.session.deleted": { "type": "object", @@ -7636,10 +8392,15 @@ "$ref": "#/components/schemas/Session" } }, - "required": ["info"] + "required": [ + "info" + ] } }, - "required": ["type", "properties"] + "required": [ + "type", + "properties" + ] }, "Event.session.diff": { "type": "object", @@ -7661,10 +8422,16 @@ } } }, - "required": ["sessionID", "diff"] + "required": [ + "sessionID", + "diff" + ] } }, - "required": ["type", "properties"] + "required": [ + "type", + "properties" + ] }, "Event.session.error": { "type": "object", @@ -7701,7 +8468,10 @@ } } }, - "required": ["type", "properties"] + "required": [ + "type", + "properties" + ] }, "Event.file.watcher.updated": { "type": "object", @@ -7733,10 +8503,16 @@ ] } }, - "required": ["file", "event"] + "required": [ + "file", + "event" + ] } }, - "required": ["type", "properties"] + "required": [ + "type", + "properties" + ] }, "Event.vcs.branch.updated": { "type": "object", @@ -7754,7 +8530,10 @@ } } }, - "required": ["type", "properties"] + "required": [ + "type", + "properties" + ] }, "Pty": { "type": "object", @@ -7780,13 +8559,24 @@ }, "status": { "type": "string", - "enum": ["running", "exited"] + "enum": [ + "running", + "exited" + ] }, "pid": { "type": "number" } }, - "required": ["id", "title", "command", "args", "cwd", "status", "pid"] + "required": [ + "id", + "title", + "command", + "args", + "cwd", + "status", + "pid" + ] }, "Event.pty.created": { "type": "object", @@ -7802,10 +8592,15 @@ "$ref": "#/components/schemas/Pty" } }, - "required": ["info"] + "required": [ + "info" + ] } }, - "required": ["type", "properties"] + "required": [ + "type", + "properties" + ] }, "Event.pty.updated": { "type": "object", @@ -7821,10 +8616,15 @@ "$ref": "#/components/schemas/Pty" } }, - "required": ["info"] + "required": [ + "info" + ] } }, - "required": ["type", "properties"] + "required": [ + "type", + "properties" + ] }, "Event.pty.exited": { "type": "object", @@ -7844,10 +8644,16 @@ "type": "number" } }, - "required": ["id", "exitCode"] + "required": [ + "id", + "exitCode" + ] } }, - "required": ["type", "properties"] + "required": [ + "type", + "properties" + ] }, "Event.pty.deleted": { "type": "object", @@ -7864,10 +8670,15 @@ "pattern": "^pty.*" } }, - "required": ["id"] + "required": [ + "id" + ] } }, - "required": ["type", "properties"] + "required": [ + "type", + "properties" + ] }, "Event.server.connected": { "type": "object", @@ -7881,7 +8692,10 @@ "properties": {} } }, - "required": ["type", "properties"] + "required": [ + "type", + "properties" + ] }, "Event.global.disposed": { "type": "object", @@ -7895,7 +8709,477 @@ "properties": {} } }, - "required": ["type", "properties"] + "required": [ + "type", + "properties" + ] + }, + "Event.daemon.start": { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "daemon.start" + }, + "properties": { + "type": "object", + "properties": { + "pid": { + "type": "number" + }, + "port": { + "type": "number" + }, + "hostname": { + "type": "string" + }, + "directory": { + "type": "string" + }, + "startTime": { + "type": "number" + } + }, + "required": [ + "pid", + "port", + "hostname", + "directory", + "startTime" + ] + } + }, + "required": [ + "type", + "properties" + ] + }, + "Event.daemon.ready": { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "daemon.ready" + }, + "properties": { + "type": "object", + "properties": { + "pid": { + "type": "number" + }, + "port": { + "type": "number" + }, + "services": { + "type": "object", + "properties": { + "persistence": { + "type": "boolean" + }, + "telegram": { + "type": "boolean" + }, + "discord": { + "type": "boolean" + } + }, + "required": [ + "persistence", + "telegram", + "discord" + ] + }, + "sessionsWithIncompleteTodos": { + "type": "number" + } + }, + "required": [ + "pid", + "port", + "services", + "sessionsWithIncompleteTodos" + ] + } + }, + "required": [ + "type", + "properties" + ] + }, + "Event.daemon.shutdown": { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "daemon.shutdown" + }, + "properties": { + "type": "object", + "properties": { + "pid": { + "type": "number" + }, + "reason": { + "type": "string", + "enum": [ + "signal", + "error", + "manual" + ] + }, + "signal": { + "type": "string" + }, + "error": { + "type": "string" + }, + "uptime": { + "type": "number" + } + }, + "required": [ + "pid", + "reason", + "uptime" + ] + } + }, + "required": [ + "type", + "properties" + ] + }, + "Event.session.lifecycle.start": { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "session.lifecycle.start" + }, + "properties": { + "type": "object", + "properties": { + "sessionId": { + "type": "string" + }, + "persona": { + "type": "string", + "enum": [ + "zee", + "stanley", + "johny" + ] + }, + "source": { + "type": "string", + "enum": [ + "daemon", + "telegram", + "tui", + "cli" + ] + }, + "chatId": { + "type": "number" + }, + "directory": { + "type": "string" + } + }, + "required": [ + "sessionId", + "persona", + "source", + "directory" + ] + } + }, + "required": [ + "type", + "properties" + ] + }, + "Event.session.lifecycle.restore": { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "session.lifecycle.restore" + }, + "properties": { + "type": "object", + "properties": { + "sessionId": { + "type": "string" + }, + "persona": { + "type": "string", + "enum": [ + "zee", + "stanley", + "johny" + ] + }, + "source": { + "type": "string", + "enum": [ + "daemon", + "telegram", + "tui", + "cli" + ] + }, + "chatId": { + "type": "number" + }, + "hasTodos": { + "type": "boolean" + }, + "incompleteTodos": { + "type": "number" + }, + "triggerContinuation": { + "type": "boolean" + } + }, + "required": [ + "sessionId", + "persona", + "source", + "hasTodos", + "incompleteTodos", + "triggerContinuation" + ] + } + }, + "required": [ + "type", + "properties" + ] + }, + "Event.session.lifecycle.end": { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "session.lifecycle.end" + }, + "properties": { + "type": "object", + "properties": { + "sessionId": { + "type": "string" + }, + "persona": { + "type": "string", + "enum": [ + "zee", + "stanley", + "johny" + ] + }, + "reason": { + "type": "string", + "enum": [ + "completed", + "suspended", + "timeout", + "error" + ] + }, + "duration": { + "type": "number" + }, + "todosCompleted": { + "type": "number" + }, + "todosRemaining": { + "type": "number" + } + }, + "required": [ + "sessionId", + "reason", + "duration", + "todosCompleted", + "todosRemaining" + ] + } + }, + "required": [ + "type", + "properties" + ] + }, + "Event.session.lifecycle.transfer": { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "session.lifecycle.transfer" + }, + "properties": { + "type": "object", + "properties": { + "sessionId": { + "type": "string" + }, + "fromContext": { + "type": "string", + "enum": [ + "daemon", + "telegram", + "tui", + "cli" + ] + }, + "toContext": { + "type": "string", + "enum": [ + "daemon", + "telegram", + "tui", + "cli" + ] + }, + "fromDevice": { + "type": "string" + }, + "toDevice": { + "type": "string" + } + }, + "required": [ + "sessionId", + "fromContext", + "toContext" + ] + } + }, + "required": [ + "type", + "properties" + ] + }, + "Event.todo.lifecycle.continuation": { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "todo.lifecycle.continuation" + }, + "properties": { + "type": "object", + "properties": { + "sessionId": { + "type": "string" + }, + "totalTodos": { + "type": "number" + }, + "completedTodos": { + "type": "number" + }, + "remainingTodos": { + "type": "number" + }, + "percentage": { + "type": "number" + }, + "proceedWithoutAsking": { + "type": "boolean" + }, + "reminderMessage": { + "type": "string" + } + }, + "required": [ + "sessionId", + "totalTodos", + "completedTodos", + "remainingTodos", + "percentage", + "proceedWithoutAsking", + "reminderMessage" + ] + } + }, + "required": [ + "type", + "properties" + ] + }, + "Event.todo.lifecycle.completed": { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "todo.lifecycle.completed" + }, + "properties": { + "type": "object", + "properties": { + "sessionId": { + "type": "string" + }, + "totalTodos": { + "type": "number" + }, + "duration": { + "type": "number" + } + }, + "required": [ + "sessionId", + "totalTodos", + "duration" + ] + } + }, + "required": [ + "type", + "properties" + ] + }, + "Event.todo.lifecycle.blocked": { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "todo.lifecycle.blocked" + }, + "properties": { + "type": "object", + "properties": { + "sessionId": { + "type": "string" + }, + "todoId": { + "type": "string" + }, + "todoContent": { + "type": "string" + }, + "reason": { + "type": "string" + }, + "needsInput": { + "type": "boolean" + } + }, + "required": [ + "sessionId", + "todoId", + "todoContent", + "reason", + "needsInput" + ] + } + }, + "required": [ + "type", + "properties" + ] }, "Event": { "anyOf": [ @@ -7941,6 +9225,15 @@ { "$ref": "#/components/schemas/Event.session.idle" }, + { + "$ref": "#/components/schemas/Event.circuit-breaker.state-changed" + }, + { + "$ref": "#/components/schemas/Event.fallback.used" + }, + { + "$ref": "#/components/schemas/Event.fallback.exhausted" + }, { "$ref": "#/components/schemas/Event.question.asked" }, @@ -8015,6 +9308,36 @@ }, { "$ref": "#/components/schemas/Event.global.disposed" + }, + { + "$ref": "#/components/schemas/Event.daemon.start" + }, + { + "$ref": "#/components/schemas/Event.daemon.ready" + }, + { + "$ref": "#/components/schemas/Event.daemon.shutdown" + }, + { + "$ref": "#/components/schemas/Event.session.lifecycle.start" + }, + { + "$ref": "#/components/schemas/Event.session.lifecycle.restore" + }, + { + "$ref": "#/components/schemas/Event.session.lifecycle.end" + }, + { + "$ref": "#/components/schemas/Event.session.lifecycle.transfer" + }, + { + "$ref": "#/components/schemas/Event.todo.lifecycle.continuation" + }, + { + "$ref": "#/components/schemas/Event.todo.lifecycle.completed" + }, + { + "$ref": "#/components/schemas/Event.todo.lifecycle.blocked" } ] }, @@ -8028,7 +9351,10 @@ "$ref": "#/components/schemas/Event" } }, - "required": ["directory", "payload"] + "required": [ + "directory", + "payload" + ] }, "BadRequestError": { "type": "object", @@ -8049,7 +9375,11 @@ "const": false } }, - "required": ["data", "errors", "success"] + "required": [ + "data", + "errors", + "success" + ] }, "NotFoundError": { "type": "object", @@ -8065,10 +9395,15 @@ "type": "string" } }, - "required": ["message"] + "required": [ + "message" + ] } }, - "required": ["name", "data"] + "required": [ + "name", + "data" + ] }, "KeybindsConfig": { "description": "Custom keybind configurations", @@ -8279,6 +9614,11 @@ "default": "shift+tab", "type": "string" }, + "mode_toggle": { + "description": "Toggle hold/release mode", + "default": "ctrl+h", + "type": "string" + }, "variant_cycle": { "description": "Cycle model variants", "default": "ctrl+t", @@ -8515,7 +9855,12 @@ "LogLevel": { "description": "Log level", "type": "string", - "enum": ["DEBUG", "INFO", "WARN", "ERROR"] + "enum": [ + "DEBUG", + "INFO", + "WARN", + "ERROR" + ] }, "ServerConfig": { "description": "Server configuration for opencode serve and web commands", @@ -8545,9 +9890,100 @@ }, "additionalProperties": false }, + "DaemonConfig": { + "description": "Daemon mode configuration for headless operation", + "type": "object", + "properties": { + "enabled": { + "description": "Enable daemon mode", + "default": false, + "type": "boolean" + }, + "session": { + "description": "Session management configuration", + "type": "object", + "properties": { + "persistence": { + "description": "Enable session persistence", + "default": true, + "type": "boolean" + }, + "checkpoint_interval": { + "description": "Checkpoint interval in seconds", + "default": 300, + "type": "integer", + "exclusiveMinimum": 0, + "maximum": 9007199254740991 + }, + "recovery": { + "description": "Enable crash recovery", + "default": true, + "type": "boolean" + } + } + }, + "todo": { + "description": "Todo continuation configuration", + "type": "object", + "properties": { + "auto_continue": { + "description": "Automatically continue incomplete todos on session restore", + "default": true, + "type": "boolean" + }, + "notify_on_incomplete": { + "description": "Send notifications for incomplete todos", + "default": true, + "type": "boolean" + } + } + }, + "gateway": { + "description": "Remote communication gateway configuration", + "type": "object", + "properties": { + "telegram": { + "description": "Telegram gateway configuration", + "type": "object", + "properties": { + "enabled": { + "description": "Enable Telegram bot gateway", + "default": false, + "type": "boolean" + }, + "bot_token": { + "description": "Telegram bot token", + "type": "string" + } + } + }, + "discord": { + "description": "Discord gateway configuration", + "type": "object", + "properties": { + "enabled": { + "description": "Enable Discord bot gateway", + "default": false, + "type": "boolean" + }, + "bot_token": { + "description": "Discord bot token", + "type": "string" + } + } + } + } + } + }, + "additionalProperties": false + }, "PermissionActionConfig": { "type": "string", - "enum": ["ask", "allow", "deny"] + "enum": [ + "ask", + "allow", + "deny" + ] }, "PermissionObjectConfig": { "type": "object", @@ -8671,7 +10107,11 @@ }, "mode": { "type": "string", - "enum": ["subagent", "primary", "all"] + "enum": [ + "subagent", + "primary", + "all" + ] }, "hidden": { "description": "Hide this subagent from the @ autocomplete menu (default: false, only applies to mode: subagent)", @@ -8771,10 +10211,15 @@ "properties": { "field": { "type": "string", - "enum": ["reasoning_content", "reasoning_details"] + "enum": [ + "reasoning_content", + "reasoning_details" + ] } }, - "required": ["field"], + "required": [ + "field" + ], "additionalProperties": false } ] @@ -8810,10 +10255,16 @@ "type": "number" } }, - "required": ["input", "output"] + "required": [ + "input", + "output" + ] } }, - "required": ["input", "output"] + "required": [ + "input", + "output" + ] }, "limit": { "type": "object", @@ -8825,7 +10276,10 @@ "type": "number" } }, - "required": ["context", "output"] + "required": [ + "context", + "output" + ] }, "modalities": { "type": "object", @@ -8834,25 +10288,44 @@ "type": "array", "items": { "type": "string", - "enum": ["text", "audio", "image", "video", "pdf"] + "enum": [ + "text", + "audio", + "image", + "video", + "pdf" + ] } }, "output": { "type": "array", "items": { "type": "string", - "enum": ["text", "audio", "image", "video", "pdf"] + "enum": [ + "text", + "audio", + "image", + "video", + "pdf" + ] } } }, - "required": ["input", "output"] + "required": [ + "input", + "output" + ] }, "experimental": { "type": "boolean" }, "status": { "type": "string", - "enum": ["alpha", "beta", "deprecated"] + "enum": [ + "alpha", + "beta", + "deprecated" + ] }, "options": { "type": "object", @@ -8877,7 +10350,9 @@ "type": "string" } }, - "required": ["npm"] + "required": [ + "npm" + ] }, "variants": { "description": "Variant-specific configuration", @@ -8986,7 +10461,10 @@ "maximum": 9007199254740991 } }, - "required": ["type", "command"], + "required": [ + "type", + "command" + ], "additionalProperties": false }, "McpOAuthConfig": { @@ -9052,13 +10530,19 @@ "maximum": 9007199254740991 } }, - "required": ["type", "url"], + "required": [ + "type", + "url" + ], "additionalProperties": false }, "LayoutConfig": { "description": "@deprecated Always uses stretch layout.", "type": "string", - "enum": ["auto", "stretch"] + "enum": [ + "auto", + "stretch" + ] }, "Config": { "type": "object", @@ -9095,18 +10579,26 @@ "type": "boolean" } }, - "required": ["enabled"] + "required": [ + "enabled" + ] }, "diff_style": { "description": "Control diff rendering style: 'auto' adapts to terminal width, 'stacked' always shows single column", "type": "string", - "enum": ["auto", "stacked"] + "enum": [ + "auto", + "stacked" + ] } } }, "server": { "$ref": "#/components/schemas/ServerConfig" }, + "daemon": { + "$ref": "#/components/schemas/DaemonConfig" + }, "command": { "description": "Command configuration, see https://opencode.ai/docs/commands", "type": "object", @@ -9132,7 +10624,9 @@ "type": "boolean" } }, - "required": ["template"] + "required": [ + "template" + ] } }, "watcher": { @@ -9158,7 +10652,11 @@ "share": { "description": "Control sharing behavior:'manual' allows manual sharing via commands, 'auto' enables automatic sharing, 'disabled' disables all sharing", "type": "string", - "enum": ["manual", "auto", "disabled"] + "enum": [ + "manual", + "auto", + "disabled" + ] }, "autoshare": { "description": "@deprecated Use 'share' field instead. Share newly created sessions automatically", @@ -9286,7 +10784,9 @@ "type": "boolean" } }, - "required": ["enabled"], + "required": [ + "enabled" + ], "additionalProperties": false } ] @@ -9356,7 +10856,9 @@ "const": true } }, - "required": ["disabled"] + "required": [ + "disabled" + ] }, { "type": "object", @@ -9393,7 +10895,9 @@ "additionalProperties": {} } }, - "required": ["command"] + "required": [ + "command" + ] } ] } @@ -9476,7 +10980,9 @@ } } }, - "required": ["command"] + "required": [ + "command" + ] } } }, @@ -9501,7 +11007,9 @@ } } }, - "required": ["command"] + "required": [ + "command" + ] } } } @@ -9539,6 +11047,93 @@ "maximum": 9007199254740991 } } + }, + "fallback": { + "description": "Provider/model fallback configuration for automatic failover", + "type": "object", + "properties": { + "enabled": { + "description": "Enable automatic fallback to alternative providers/models on failure", + "default": true, + "type": "boolean" + }, + "maxAttempts": { + "description": "Maximum total attempts including the original request", + "default": 3, + "type": "integer", + "exclusiveMinimum": 0, + "maximum": 9007199254740991 + }, + "circuitBreaker": { + "description": "Circuit breaker configuration for provider health management", + "type": "object", + "properties": { + "failureThreshold": { + "description": "Number of consecutive failures before opening the circuit", + "default": 3, + "type": "integer", + "exclusiveMinimum": 0, + "maximum": 9007199254740991 + }, + "successThreshold": { + "description": "Number of consecutive successes in half_open to close the circuit", + "default": 2, + "type": "integer", + "exclusiveMinimum": 0, + "maximum": 9007199254740991 + }, + "timeout": { + "description": "Time in ms before transitioning from open to half_open", + "default": 60000, + "type": "integer", + "exclusiveMinimum": 0, + "maximum": 9007199254740991 + } + } + }, + "rules": { + "description": "Fallback rules in priority order", + "type": "array", + "items": { + "type": "object", + "properties": { + "condition": { + "description": "Error condition that triggers this rule", + "type": "string", + "enum": [ + "rate_limit", + "unavailable", + "timeout", + "error", + "circuit_open", + "any" + ] + }, + "fallbacks": { + "description": "Fallback options - 'providerID/modelID' or just 'providerID' for equivalent tier", + "type": "array", + "items": { + "type": "string" + } + } + }, + "required": [ + "condition", + "fallbacks" + ] + } + }, + "costAware": { + "description": "Skip fallbacks that cost more than the original model", + "default": false, + "type": "boolean" + }, + "notifyOnFallback": { + "description": "Emit event/notification when fallback is used", + "default": true, + "type": "boolean" + } + } } }, "additionalProperties": false @@ -9560,7 +11155,11 @@ }, "parameters": {} }, - "required": ["id", "description", "parameters"] + "required": [ + "id", + "description", + "parameters" + ] }, "ToolList": { "type": "array", @@ -9587,7 +11186,13 @@ "type": "string" } }, - "required": ["home", "state", "config", "worktree", "directory"] + "required": [ + "home", + "state", + "config", + "worktree", + "directory" + ] }, "Worktree": { "type": "object", @@ -9602,7 +11207,11 @@ "type": "string" } }, - "required": ["name", "branch", "directory"] + "required": [ + "name", + "branch", + "directory" + ] }, "WorktreeCreateInput": { "type": "object", @@ -9622,7 +11231,9 @@ "type": "string" } }, - "required": ["branch"] + "required": [ + "branch" + ] }, "TextPartInput": { "type": "object", @@ -9653,7 +11264,9 @@ "type": "number" } }, - "required": ["start"] + "required": [ + "start" + ] }, "metadata": { "type": "object", @@ -9663,7 +11276,10 @@ "additionalProperties": {} } }, - "required": ["type", "text"] + "required": [ + "type", + "text" + ] }, "FilePartInput": { "type": "object", @@ -9688,7 +11304,11 @@ "$ref": "#/components/schemas/FilePartSource" } }, - "required": ["type", "mime", "url"] + "required": [ + "type", + "mime", + "url" + ] }, "AgentPartInput": { "type": "object", @@ -9720,10 +11340,17 @@ "maximum": 9007199254740991 } }, - "required": ["value", "start", "end"] + "required": [ + "value", + "start", + "end" + ] } }, - "required": ["type", "name"] + "required": [ + "type", + "name" + ] }, "SubtaskPartInput": { "type": "object", @@ -9748,7 +11375,12 @@ "type": "string" } }, - "required": ["type", "prompt", "description", "agent"] + "required": [ + "type", + "prompt", + "description", + "agent" + ] }, "Command": { "type": "object", @@ -9788,7 +11420,11 @@ } } }, - "required": ["name", "template", "hints"] + "required": [ + "name", + "template", + "hints" + ] }, "Model": { "type": "object", @@ -9812,7 +11448,11 @@ "type": "string" } }, - "required": ["id", "url", "npm"] + "required": [ + "id", + "url", + "npm" + ] }, "name": { "type": "string" @@ -9854,7 +11494,13 @@ "type": "boolean" } }, - "required": ["text", "audio", "image", "video", "pdf"] + "required": [ + "text", + "audio", + "image", + "video", + "pdf" + ] }, "output": { "type": "object", @@ -9875,7 +11521,13 @@ "type": "boolean" } }, - "required": ["text", "audio", "image", "video", "pdf"] + "required": [ + "text", + "audio", + "image", + "video", + "pdf" + ] }, "interleaved": { "anyOf": [ @@ -9887,15 +11539,28 @@ "properties": { "field": { "type": "string", - "enum": ["reasoning_content", "reasoning_details"] + "enum": [ + "reasoning_content", + "reasoning_details" + ] } }, - "required": ["field"] + "required": [ + "field" + ] } ] } }, - "required": ["temperature", "reasoning", "attachment", "toolcall", "input", "output", "interleaved"] + "required": [ + "temperature", + "reasoning", + "attachment", + "toolcall", + "input", + "output", + "interleaved" + ] }, "cost": { "type": "object", @@ -9916,7 +11581,10 @@ "type": "number" } }, - "required": ["read", "write"] + "required": [ + "read", + "write" + ] }, "experimentalOver200K": { "type": "object", @@ -9937,13 +11605,24 @@ "type": "number" } }, - "required": ["read", "write"] + "required": [ + "read", + "write" + ] } }, - "required": ["input", "output", "cache"] + "required": [ + "input", + "output", + "cache" + ] } }, - "required": ["input", "output", "cache"] + "required": [ + "input", + "output", + "cache" + ] }, "limit": { "type": "object", @@ -9955,11 +11634,19 @@ "type": "number" } }, - "required": ["context", "output"] + "required": [ + "context", + "output" + ] }, "status": { "type": "string", - "enum": ["alpha", "beta", "deprecated", "active"] + "enum": [ + "alpha", + "beta", + "deprecated", + "active" + ] }, "options": { "type": "object", @@ -10019,7 +11706,12 @@ }, "source": { "type": "string", - "enum": ["env", "config", "custom", "api"] + "enum": [ + "env", + "config", + "custom", + "api" + ] }, "env": { "type": "array", @@ -10047,7 +11739,14 @@ } } }, - "required": ["id", "name", "source", "env", "options", "models"] + "required": [ + "id", + "name", + "source", + "env", + "options", + "models" + ] }, "ProviderAuthMethod": { "type": "object", @@ -10068,7 +11767,10 @@ "type": "string" } }, - "required": ["type", "label"] + "required": [ + "type", + "label" + ] }, "ProviderAuthAuthorization": { "type": "object", @@ -10092,7 +11794,11 @@ "type": "string" } }, - "required": ["url", "method", "instructions"] + "required": [ + "url", + "method", + "instructions" + ] }, "Symbol": { "type": "object", @@ -10113,10 +11819,17 @@ "$ref": "#/components/schemas/Range" } }, - "required": ["uri", "range"] + "required": [ + "uri", + "range" + ] } }, - "required": ["name", "kind", "location"] + "required": [ + "name", + "kind", + "location" + ] }, "FileNode": { "type": "object", @@ -10132,13 +11845,22 @@ }, "type": { "type": "string", - "enum": ["file", "directory"] + "enum": [ + "file", + "directory" + ] }, "ignored": { "type": "boolean" } }, - "required": ["name", "path", "absolute", "type", "ignored"] + "required": [ + "name", + "path", + "absolute", + "type", + "ignored" + ] }, "FileContent": { "type": "object", @@ -10192,14 +11914,24 @@ } } }, - "required": ["oldStart", "oldLines", "newStart", "newLines", "lines"] + "required": [ + "oldStart", + "oldLines", + "newStart", + "newLines", + "lines" + ] } }, "index": { "type": "string" } }, - "required": ["oldFileName", "newFileName", "hunks"] + "required": [ + "oldFileName", + "newFileName", + "hunks" + ] }, "encoding": { "type": "string", @@ -10209,7 +11941,10 @@ "type": "string" } }, - "required": ["type", "content"] + "required": [ + "type", + "content" + ] }, "File": { "type": "object", @@ -10229,10 +11964,19 @@ }, "status": { "type": "string", - "enum": ["added", "deleted", "modified"] + "enum": [ + "added", + "deleted", + "modified" + ] } }, - "required": ["path", "added", "removed", "status"] + "required": [ + "path", + "added", + "removed", + "status" + ] }, "Agent": { "type": "object", @@ -10245,7 +11989,11 @@ }, "mode": { "type": "string", - "enum": ["subagent", "primary", "all"] + "enum": [ + "subagent", + "primary", + "all" + ] }, "native": { "type": "boolean" @@ -10275,7 +12023,10 @@ "type": "string" } }, - "required": ["modelID", "providerID"] + "required": [ + "modelID", + "providerID" + ] }, "prompt": { "type": "string" @@ -10293,7 +12044,12 @@ "maximum": 9007199254740991 } }, - "required": ["name", "mode", "permission", "options"] + "required": [ + "name", + "mode", + "permission", + "options" + ] }, "MCPStatusConnected": { "type": "object", @@ -10303,7 +12059,9 @@ "const": "connected" } }, - "required": ["status"] + "required": [ + "status" + ] }, "MCPStatusDisabled": { "type": "object", @@ -10313,7 +12071,9 @@ "const": "disabled" } }, - "required": ["status"] + "required": [ + "status" + ] }, "MCPStatusFailed": { "type": "object", @@ -10326,7 +12086,10 @@ "type": "string" } }, - "required": ["status", "error"] + "required": [ + "status", + "error" + ] }, "MCPStatusNeedsAuth": { "type": "object", @@ -10336,7 +12099,9 @@ "const": "needs_auth" } }, - "required": ["status"] + "required": [ + "status" + ] }, "MCPStatusNeedsClientRegistration": { "type": "object", @@ -10349,7 +12114,10 @@ "type": "string" } }, - "required": ["status", "error"] + "required": [ + "status", + "error" + ] }, "MCPStatus": { "anyOf": [ @@ -10389,7 +12157,11 @@ "type": "string" } }, - "required": ["name", "uri", "client"] + "required": [ + "name", + "uri", + "client" + ] }, "LSPStatus": { "type": "object", @@ -10416,7 +12188,12 @@ ] } }, - "required": ["id", "name", "root", "status"] + "required": [ + "id", + "name", + "root", + "status" + ] }, "FormatterStatus": { "type": "object", @@ -10434,7 +12211,11 @@ "type": "boolean" } }, - "required": ["name", "extensions", "enabled"] + "required": [ + "name", + "extensions", + "enabled" + ] }, "OAuth": { "type": "object", @@ -10456,7 +12237,12 @@ "type": "string" } }, - "required": ["type", "refresh", "access", "expires"] + "required": [ + "type", + "refresh", + "access", + "expires" + ] }, "ApiAuth": { "type": "object", @@ -10469,7 +12255,10 @@ "type": "string" } }, - "required": ["type", "key"] + "required": [ + "type", + "key" + ] }, "WellKnownAuth": { "type": "object", @@ -10485,7 +12274,11 @@ "type": "string" } }, - "required": ["type", "key", "token"] + "required": [ + "type", + "key", + "token" + ] }, "Auth": { "anyOf": [ @@ -10502,4 +12295,4 @@ } } } -} +} \ No newline at end of file