The open source coding agent.
TypeScript
chore: createOpencodeServer expose `logLevel` (#6202)
Ayush Walekar155ba794cf97
diff --git a/packages/opencode/src/config/config.ts b/packages/opencode/src/config/config.tsindex 9187ed6745a..3350cf8f6a6 100644--- a/packages/opencode/src/config/config.ts+++ b/packages/opencode/src/config/config.ts@@ -644,6 +644,7 @@ export namespace Config {$schema: z.string().optional().describe("JSON schema reference for configuration validation"),theme: z.string().optional().describe("Theme name to use for the interface"),keybinds: Keybinds.optional().describe("Custom keybind configurations"),+ logLevel: Log.Level.optional().describe("Log level"),tui: TUI.optional().describe("TUI specific settings"),server: Server.optional().describe("Server configuration for opencode serve and web commands"),command: zdiff --git a/packages/sdk/js/src/gen/types.gen.ts b/packages/sdk/js/src/gen/types.gen.tsindex 06993d3f930..32f33f66219 100644--- a/packages/sdk/js/src/gen/types.gen.ts+++ b/packages/sdk/js/src/gen/types.gen.ts@@ -1174,6 +1174,10 @@ export type Config = {*/theme?: stringkeybinds?: KeybindsConfig+ /**+ * Log level+ */+ logLevel?: "DEBUG" | "INFO" | "WARN" | "ERROR"/*** TUI specific settings*/diff --git a/packages/sdk/js/src/server.ts b/packages/sdk/js/src/server.tsindex a09e14ab2aa..174131ccfd5 100644--- a/packages/sdk/js/src/server.ts+++ b/packages/sdk/js/src/server.ts@@ -28,7 +28,10 @@ export async function createOpencodeServer(options?: ServerOptions) {options ?? {},)- const proc = spawn(`opencode`, [`serve`, `--hostname=${options.hostname}`, `--port=${options.port}`], {+ const args = [`serve`, `--hostname=${options.hostname}`, `--port=${options.port}`]+ if (options.config?.logLevel) args.push(`--log-level=${options.config.logLevel}`)++ const proc = spawn(`opencode`, args, {signal: options.signal,env: {...process.env,diff --git a/packages/sdk/js/src/v2/gen/types.gen.ts b/packages/sdk/js/src/v2/gen/types.gen.tsindex 87aac3287e0..2fda3375e78 100644--- a/packages/sdk/js/src/v2/gen/types.gen.ts+++ b/packages/sdk/js/src/v2/gen/types.gen.ts@@ -1406,6 +1406,10 @@ export type Config = {*/theme?: stringkeybinds?: KeybindsConfig+ /**+ * Log level+ */+ logLevel?: "DEBUG" | "INFO" | "WARN" | "ERROR"/*** TUI specific settings*/diff --git a/packages/sdk/js/src/v2/server.ts b/packages/sdk/js/src/v2/server.tsindex a09e14ab2aa..174131ccfd5 100644--- a/packages/sdk/js/src/v2/server.ts+++ b/packages/sdk/js/src/v2/server.ts@@ -28,7 +28,10 @@ export async function createOpencodeServer(options?: ServerOptions) {options ?? {},)- const proc = spawn(`opencode`, [`serve`, `--hostname=${options.hostname}`, `--port=${options.port}`], {+ const args = [`serve`, `--hostname=${options.hostname}`, `--port=${options.port}`]+ if (options.config?.logLevel) args.push(`--log-level=${options.config.logLevel}`)++ const proc = spawn(`opencode`, args, {signal: options.signal,env: {...process.env,