Skip to content

an open-source alternative to the dots, bots and muses of the world, run an office of claude code/codex like agents on your laptop, sandboxes or anywhere, uses your existing subscriptions

feat(bridges): wire OpenCode plugin, pi extension, Crush proxy + BYOK config

Chaitanya Giri35fdb595f9f6
diff --git a/src/main/config.ts b/src/main/config.ts
index 87390f80..b270c32c 100644
--- a/src/main/config.ts
+++ b/src/main/config.ts
@@ -226,6 +226,13 @@ export interface HarnessConfig {
* `tvShowOffices` is on; otherwise the office theme is used. Unbuilt show
* themes fall back to 'office' in the loader. */
officeTheme?: 'office' | 'friends' | 'brooklyn99' | 'siliconvalley' | 'got' | 'hogwarts';
+ /** Per-CLI-provider local/self-hosted base URL (Ollama/LM Studio/vLLM, …) for the
+ * OpenCode/Crush/pi/qwen engines; applied at spawn (config-injection or proxy
+ * upstream). API KEYS are NOT stored here — they live write-only in the secret
+ * broker (integrations.ts), read MAIN-ONLY at spawn. */
+ providerBaseUrls?: Partial<Record<AgentProvider, string>>;
+ /** Per-CLI-provider default model slug, used to pre-fill the model picker. */
+ providerDefaultModels?: Partial<Record<AgentProvider, string>>;
/** Master toggle for the Slack → Michael's-queue integration. */
slackEnabled?: boolean;
/** Slack app signing secret (Basic Information → Signing Secret). Never logged. */
diff --git a/src/main/hive.ts b/src/main/hive.ts
index a5aaa2f3..6ddf97c9 100644
--- a/src/main/hive.ts
+++ b/src/main/hive.ts
@@ -418,6 +418,27 @@ export class HiveManager {
// never fire. Must precede the positional prompt.
preArgs.push('--dangerously-bypass-hook-trust');
}
+ else if (desc.shim === 'pi') {
+ // Pi (earendil-works) has a rich pi.on(event) lifecycle. We drop a
+ // bundled extension into a PER-AGENT PI_CODING_AGENT_DIR (so the user's
+ // global ~/.pi is never touched) that posts cth-hook-shaped payloads to
+ // HIVE_SOCK on tool_call/agent_end and auto-approves tools when the floor
+ // is in auto mode. HIVE_AUTO_APPROVE (set in spawnAgentCore from
+ // config.autoMode) gates the auto-allow — Pam guardrail #5.
+ // LIVE-UNVERIFIED: the exact extension API surface needs BYOK keys to
+ // prove; the renderer idle inbox-wake nudge is the guaranteed drain.
+ env.PI_CODING_AGENT_DIR = this.installPiHooks(dir);
+ }
+ else if (desc.shim === 'opencode') {
+ // OpenCode (anomalyco/opencode) has no Claude-shaped Stop hook, but its
+ // plugin API exposes a real session.idle event (god Decision 1). We drop
+ // a bundled plugin into a PER-AGENT OPENCODE config dir that posts
+ // HIVE_SOCK payloads on tool.execute.before/after + session.idle — the
+ // same Stop→drain semantics, provider-agnostic, no traffic interception.
+ // LIVE-UNVERIFIED (plugin auto-load + session.idle firing); the renderer
+ // idle inbox-wake nudge is the guaranteed drain fallback.
+ env.OPENCODE_CONFIG_DIR = this.installOpenCodePlugin(dir);
+ }
} else if (desc.kind === 'proxy') {
// Stable per-spawn session id, stamped on every synthesized payload so
// recordSession (registry resume key) and the cost ledger persist.
@@ -432,10 +453,26 @@ export class HiveManager {
|| (desc.api === 'anthropic' ? 'https://api.anthropic.com' : 'https://api.openai.com/v1');
const port = await this.startProxyBridge(meta.id, { sock, sessionId, api: desc.api, upstream });
// Only redirect the CLI through the proxy if the sidecar actually bound a
- // port. On failure leave `baseUrlEnv` untouched → the CLI talks to its
- // real upstream directly (degraded: no synthesized hive events, but it
- // still runs). The degradation is logged, not hidden (1e).
- if (port > 0) env[desc.baseUrlEnv] = `http://127.0.0.1:${port}`;
+ // port. On failure leave routing untouched → the CLI talks to its real
+ // upstream directly (degraded: no synthesized hive events, but it still
+ // runs). The degradation is logged, not hidden (1e).
+ if (port > 0) {
+ const loopback = `http://127.0.0.1:${port}`;
+ if (meta.provider === 'crush') {
+ // Crush has NO base-URL env override, so the generic env-rewrite is a
+ // no-op for it. Route it instead via a per-agent CRUSH_GLOBAL_CONFIG
+ // whose chosen provider's base_url points at the loopback proxy
+ // (installCrushConfig — sibling of installCodexHooks). `upstream`
+ // (captured above from the inert sentinel env or cloud default) is the
+ // proxy's real target. Per-agent CRUSH_GLOBAL_DATA isolates session
+ // state from the user's global ~/.config/crush.
+ const crush = this.installCrushConfig(dir, loopback, desc.api);
+ env.CRUSH_GLOBAL_CONFIG = crush.config;
+ env.CRUSH_GLOBAL_DATA = crush.data;
+ } else {
+ env[desc.baseUrlEnv] = loopback;
+ }
+ }
else console.error(`[hive] proxy bridge for ${meta.id} did not bind — spawning without hive events`);
}
} catch (e) { console.error(`[hive] install ${desc.kind} bridge failed:`, e); }
@@ -1151,6 +1188,89 @@ export class HiveManager {
return home;
}
+ /** Pi (earendil-works) bridge. Pi has a rich `pi.on(event, …)` lifecycle but no
+ * Claude-shaped hook file; instead we drop a bundled EXTENSION into a PER-AGENT
+ * PI_CODING_AGENT_DIR (so the user's global ~/.pi is never mutated) that, when Pi
+ * loads it, posts cth-hook-shaped payloads to HIVE_SOCK on tool_call/agent_end and
+ * auto-approves tool calls when the floor is in auto mode (HIVE_AUTO_APPROVE).
+ * Emitting an `agent_end`→`Stop` keeps the harness status in step (→ idle), which
+ * lets the renderer idle inbox-wake nudge deliver mail. Returns the per-agent dir
+ * for PI_CODING_AGENT_DIR.
+ *
+ * LIVE-UNVERIFIED: Pi's exact extension-discovery path + event API need BYOK keys
+ * to confirm; this is written best-effort and wrapped so a wrong guess can never
+ * break the spawn. The renderer nudge is the guaranteed drain regardless. */
+ private installPiHooks(dir: string): string {
+ const home = join(dir, '.pi-agent');
+ try {
+ // Pi discovers extensions under its agent dir; we write to the documented
+ // `extensions/` location (and keep it isolated per agent).
+ const extDir = join(home, 'extensions');
+ mkdirSync(extDir, { recursive: true });
+ writeFileSync(join(extDir, 'hive-bridge.js'), PI_EXTENSION, 'utf8');
+ // A manifest so Pi auto-loads the extension on start (best-effort; harmless if
+ // Pi ignores it). Kept minimal and hive-authored.
+ const manifest = { name: 'munder-hive-bridge', version: '0.3.1', main: 'extensions/hive-bridge.js', auto: true };
+ writeFileSync(join(home, 'extensions.json'), JSON.stringify(manifest, null, 2), 'utf8');
+ } catch (e) { console.error('[hive] installPiHooks failed:', e); }
+ return home;
+ }
+
+ /** OpenCode (anomalyco/opencode) bridge — god Decision 1 (native plugin, not proxy).
+ * OpenCode has no Claude-shaped Stop hook, but its plugin API exposes a real
+ * `session.idle` lifecycle event. We drop a bundled PLUGIN into a PER-AGENT config
+ * dir's `plugin/` folder (OpenCode auto-loads `*.js` plugins from there) that posts
+ * HIVE_SOCK payloads on tool.execute.before/after + session.idle — the same
+ * Stop→drain semantics as codex's hooks, provider-agnostic, no traffic interception.
+ * Returns the config dir for OPENCODE_CONFIG_DIR (isolates from ~/.config/opencode).
+ *
+ * LIVE-UNVERIFIED: plugin auto-load + session.idle firing + the inject path need
+ * BYOK keys to confirm; written best-effort, wrapped so it can't break the spawn.
+ * The renderer idle inbox-wake nudge is the guaranteed drain fallback. */
+ private installOpenCodePlugin(dir: string): string {
+ const home = join(dir, '.opencode');
+ try {
+ const pluginDir = join(home, 'plugin');
+ mkdirSync(pluginDir, { recursive: true });
+ writeFileSync(join(pluginDir, 'hive-bridge.js'), OPENCODE_PLUGIN, 'utf8');
+ } catch (e) { console.error('[hive] installOpenCodePlugin failed:', e); }
+ return home;
+ }
+
+ /** Crush (charmbracelet/crush) proxy routing. Crush has NO base-URL env override, so
+ * the generic proxy env-rewrite is a no-op for it; instead we write a per-agent
+ * CRUSH_GLOBAL_CONFIG whose standard providers' `base_url` all point at the loopback
+ * proxy (so whatever model the worker picks, its LLM traffic routes through the
+ * sidecar → synthesized Status/Stop/cost → status goes idle → the terminal
+ * work-order + renderer nudge deliver mail). A per-agent CRUSH_GLOBAL_DATA isolates
+ * session state from the user's global ~/.config/crush. Keys ride BYOK env vars
+ * (Crush reads ANTHROPIC_API_KEY/OPENAI_API_KEY/… directly), so none are written
+ * here. `api` follows the proxy's wire shape (advisory). Returns the config + data
+ * paths for the spawn env.
+ *
+ * LIVE-UNVERIFIED: the single-upstream proxy serves one provider/endpoint shape at a
+ * time — for full synthesized events pick a model whose provider matches the
+ * configured upstream (or a local OpenAI-compatible endpoint). Cross-provider mixing
+ * is humanQA; the renderer nudge still delivers mail regardless. */
+ private installCrushConfig(dir: string, loopbackUrl: string, _api: 'openai' | 'anthropic'): { config: string; data: string } {
+ const config = join(dir, 'crush.json');
+ const data = join(dir, '.crush-data');
+ try {
+ mkdirSync(data, { recursive: true });
+ // Override base_url for the common provider ids → loopback, so any selected
+ // model's traffic routes through the proxy. Crush merges config (later sources
+ // override conflicting keys), so this only rewrites base_url and leaves the
+ // user's keys/models intact. Literal loopback (Dwight's option b1 — no ${VAR}
+ // expansion edge cases).
+ const providers: Record<string, { base_url: string }> = {};
+ for (const id of ['anthropic', 'openai', 'openrouter', 'gemini', 'groq']) {
+ providers[id] = { base_url: loopbackUrl };
+ }
+ writeFileSync(config, JSON.stringify({ providers }, null, 2), 'utf8');
+ } catch (e) { console.error('[hive] installCrushConfig failed:', e); }
+ return { config, data };
+ }
+
/** Write the live fleet snapshot Michael reads (`fleet.json`, gitignored).
* Best-effort — called from a timer, must never throw. */
writeFleetSnapshot(snapshot: unknown): void {
@@ -1490,6 +1610,80 @@ process.stdin.on('end', () => {
});
`;
+// ─── pi bridge extension (written to <agentDir>/.pi-agent/extensions/) ───────
+// A bundled extension for Pi (earendil-works). Pi exposes a pi.on(event,…)
+// lifecycle; this posts cth-hook-shaped payloads to HIVE_SOCK on tool_call /
+// tool_result / agent_end and AUTO-APPROVES tool calls when the floor is in auto
+// mode (HIVE_AUTO_APPROVE, gated by config.autoMode — Pam guardrail #5). The
+// agent_end→Stop keeps the harness status in step (→ idle) so the renderer idle
+// inbox-wake nudge can deliver mail. Fully wrapped so a wrong API guess can never
+// break the spawn. LIVE-UNVERIFIED (Pi's exact extension surface needs BYOK keys).
+const PI_EXTENSION = `'use strict';
+var net = require('node:net');
+var SOCK = process.env.HIVE_SOCK;
+var AGENT = process.env.AGENT_ID || null;
+var AUTO = process.env.HIVE_AUTO_APPROVE === '1';
+function post(payload) {
+ try {
+ if (!SOCK) return;
+ payload.agent_id = payload.agent_id || AGENT;
+ var c = net.createConnection(SOCK, function () { try { c.end(JSON.stringify(payload) + '\\n'); } catch (e) {} });
+ c.on('error', function () {});
+ } catch (e) {}
+}
+function register(pi) {
+ if (!pi || typeof pi.on !== 'function') return false;
+ try {
+ pi.on('tool_call', function (ev) {
+ post({ hook_event_name: 'PreToolUse', tool_name: ev && (ev.name || (ev.tool && ev.tool.name)), tool_input: ev && (ev.args || ev.input) });
+ if (AUTO) { try { if (ev && typeof ev.approve === 'function') ev.approve(); } catch (e) {} return { approve: true }; }
+ return undefined;
+ });
+ pi.on('tool_result', function (ev) { post({ hook_event_name: 'PostToolUse', tool_name: ev && (ev.name || (ev.tool && ev.tool.name)) }); });
+ pi.on('agent_end', function () { post({ hook_event_name: 'Stop' }); });
+ return true;
+ } catch (e) { return false; }
+}
+try { if (typeof globalThis !== 'undefined' && globalThis.pi) register(globalThis.pi); } catch (e) {}
+module.exports = function (pi) { return register(pi); };
+module.exports.activate = function (pi) { return register(pi); };
+module.exports.default = module.exports;
+`;
+
+// ─── opencode bridge plugin (written to <agentDir>/.opencode/plugin/) ────────
+// A bundled plugin for OpenCode (anomalyco/opencode) — god Decision 1. OpenCode
+// has no Claude-shaped Stop hook but its plugin API exposes a real session.idle
+// event; this posts cth-hook-shaped payloads to HIVE_SOCK on tool.execute.before/
+// after + session.idle. The session.idle→Stop keeps status in step (→ idle) so the
+// renderer idle inbox-wake nudge delivers mail. ESM (OpenCode runs on Bun). Fully
+// wrapped. LIVE-UNVERIFIED (plugin auto-load + session.idle firing need BYOK keys).
+const OPENCODE_PLUGIN = `import { createConnection } from 'node:net';
+const SOCK = process.env.HIVE_SOCK;
+const AGENT = process.env.AGENT_ID || null;
+function post(payload) {
+ try {
+ if (!SOCK) return;
+ payload.agent_id = payload.agent_id || AGENT;
+ const c = createConnection(SOCK, () => { try { c.end(JSON.stringify(payload) + '\\n'); } catch (e) {} });
+ c.on('error', () => {});
+ } catch (e) {}
+}
+export const HiveBridge = async () => {
+ return {
+ event: async (input) => {
+ try { if (input && input.event && input.event.type === 'session.idle') post({ hook_event_name: 'Stop' }); } catch (e) {}
+ },
+ 'tool.execute.before': async (input) => {
+ try { post({ hook_event_name: 'PreToolUse', tool_name: input && (input.tool || input.name) }); } catch (e) {}
+ },
+ 'tool.execute.after': async (input) => {
+ try { post({ hook_event_name: 'PostToolUse', tool_name: input && (input.tool || input.name) }); } catch (e) {}
+ }
+ };
+};
+export default HiveBridge;
+`;
+
// ─── proxy-bridge sidecar (written to <hive>/bin/hive-proxy.cjs) ─────────────
// One per proxy-tier agent (qwen). A dependency-free, loopback-only reverse
// proxy: the agent's CLI is pointed at this (via ANTHROPIC_BASE_URL/OPENAI_BASE_URL),
diff --git a/src/main/index.ts b/src/main/index.ts
index 6d2b6a6a..7cbdabcd 100644
--- a/src/main/index.ts
+++ b/src/main/index.ts
@@ -187,6 +187,19 @@ const integrationBroker = new IntegrationBroker({
getSecret: integrations.getSecret
});
+/** BYOK backend model-providers whose API keys the non-Claude CLI engines
+ * (OpenCode/Crush/pi/qwen) read from standard env vars. Keys are stored
+ * WRITE-ONLY in the same encrypted secret broker as integrations, under
+ * `apikey:<backend>`, and materialized MAIN-ONLY at spawn (never over IPC). */
+const BACKEND_KEY_ENV: Record<string, string> = {
+ anthropic: 'ANTHROPIC_API_KEY',
+ openai: 'OPENAI_API_KEY',
+ google: 'GEMINI_API_KEY',
+ openrouter: 'OPENROUTER_API_KEY',
+ groq: 'GROQ_API_KEY'
+};
+const providerKeyRef = (backend: string): string => `apikey:${backend}`;
+
/** A worker worktree that teardown PRESERVED because it held unintegrated work.
* Tracked so the GC sweep can reclaim it (+ its scratch dir) once the work lands
* in base or the worktree is removed by hand — see gcPreservedWorktrees(). */
@@ -1792,6 +1805,17 @@ async function spawnAgentCore(opts: AgentSpawnOptions, owner: Electron.WebConten
console.error('[worktree] isolation failed:', e);
}
}
+ // Proxy-tier CLIs (qwen/crush) route their LLM traffic through a loopback sidecar
+ // whose UPSTREAM is read from the preset's bridge.baseUrlEnv inside hive.ensureAgent.
+ // For the local-LLM path, feed the user's configured base URL as that upstream so the
+ // proxy forwards to their endpoint (Ollama/LM Studio/vLLM). Set on process.env BEFORE
+ // ensureAgent reads it. (Crush's baseUrlEnv is an inert sentinel used ONLY as this
+ // upstream source; its real routing is the per-agent CRUSH_GLOBAL_CONFIG base_url.)
+ if (opts.hive && (provider === 'crush' || provider === 'qwen')) {
+ const bridge = providerPreset(provider).bridge;
+ const baseUrl = readConfig().providerBaseUrls?.[provider];
+ if (bridge && bridge.kind === 'proxy' && baseUrl) process.env[bridge.baseUrlEnv] = baseUrl;
+ }
// If the agent carries hive metadata, provision its workspace and add
// provider-specific spawn injection. Non-Claude providers get shared AGENT_*
// env only; Claude Code also gets prompt/settings hook args.
@@ -1901,6 +1925,38 @@ async function spawnAgentCore(opts: AgentSpawnOptions, owner: Electron.WebConten
if (Object.keys(nonInteractiveEnv).length > 0) {
opts.env = { ...(opts.env ?? {}), ...nonInteractiveEnv };
}
+ // ── BYOK keys + per-provider config for the non-Claude CLI engines (v0.3.1) ──
+ // OpenCode / Crush / pi / qwen read BYOK API keys from standard env vars and, for
+ // the local-LLM path, a per-provider base URL. Keys are write-only in the broker
+ // (read MAIN-ONLY here, never logged); base URLs ride HarnessConfig. Claude/codex
+ // use their own login, so they skip this. Pam guardrails #3/#4/#5.
+ if (opts.hive && (provider === 'opencode' || provider === 'crush' || provider === 'pi' || provider === 'qwen')) {
+ const cfg = readConfig();
+ const extra: Record<string, string> = {};
+ // 1) Inject every backend key the user has stored, so whichever model the CLI
+ // picks, the matching key is present (unused keys are harmless).
+ for (const [backend, envVar] of Object.entries(BACKEND_KEY_ENV)) {
+ const key = integrations.getSecret(providerKeyRef(backend));
+ if (key) extra[envVar] = key;
+ }
+ // 2) Floor auto-state for pi's bundled extension auto-allow (guardrail #5): it
+ // only auto-approves tool calls when this is '1' (i.e. floor auto mode on).
+ extra.HIVE_AUTO_APPROVE = cfg.autoMode ? '1' : '0';
+ // 3) OpenCode's auto-approve + local provider live in its single config-injection
+ // env var, built dynamically so permission:allow is GATED on autoMode (#2).
+ if (provider === 'opencode') {
+ const oc: Record<string, unknown> = { autoupdate: false };
+ if (cfg.autoMode) oc.permission = { edit: 'allow', bash: 'allow', webfetch: 'allow' };
+ const baseUrl = cfg.providerBaseUrls?.opencode;
+ if (baseUrl) {
+ oc.provider = {
+ local: { npm: '@ai-sdk/openai-compatible', name: 'Local (self-hosted)', options: { baseURL: baseUrl }, models: { local: { name: 'local' } } }
+ };
+ }
+ extra.OPENCODE_CONFIG_CONTENT = JSON.stringify(oc);
+ }
+ opts.env = { ...(opts.env ?? {}), ...extra };
+ }
const res = ptyManager.spawn(opts, owner);
syncKeepAwake(); // arm the power-save blocker while ≥1 agent PTY is alive (#18)
// Hand the resolved worktree path back to the renderer so it can persist it on
@@ -1993,6 +2049,25 @@ ipcMain.handle('integrations:remove', (_evt, payload: unknown) => {
if (typeof p.id !== 'string' || !p.id) return { ok: false, error: 'id required' };
return integrations.removeRecord(p.id);
});
+// ─── IPC: per-CLI-provider BYOK keys (write-only) ────────────────────────────
+// API keys for the backend model-providers the non-Claude CLIs use are stored
+// WRITE-ONLY under `apikey:<backend>` in the same encrypted broker. The renderer
+// can SET a key and ASK whether one is set (boolean) — it can never read the
+// plaintext back. Keys are materialized MAIN-ONLY at spawn (spawnAgentCore). Base
+// URLs are non-secret and ride HarnessConfig.providerBaseUrls (normal config save).
+ipcMain.handle('providerKey:set', (_evt, payload: unknown) => {
+ const p = (payload ?? {}) as { backend?: unknown; key?: unknown };
+ if (typeof p.backend !== 'string' || !(p.backend in BACKEND_KEY_ENV)) return { ok: false, error: 'unknown backend' };
+ if (typeof p.key !== 'string' || !p.key) return { ok: false, error: 'key required' };
+ return integrations.setSecret(providerKeyRef(p.backend), p.key);
+});
+ipcMain.handle('providerKey:has', (_evt, backend: unknown) =>
+ typeof backend === 'string' ? integrations.hasSecret(providerKeyRef(backend)) : false);
+ipcMain.handle('providerKey:clear', (_evt, backend: unknown) => {
+ if (typeof backend !== 'string' || !(backend in BACKEND_KEY_ENV)) return { ok: false, error: 'unknown backend' };
+ try { integrations.deleteSecret(providerKeyRef(backend)); return { ok: true }; }
+ catch (e) { return { ok: false, error: e instanceof Error ? e.message : String(e) }; }
+});
// Probe an integration's reachability through the broker's own auth path (admin-only;
// runs in main, so the secret is used but never returned — only the upstream status).
ipcMain.handle('integrations:test', async (_evt, payload: unknown) => {
diff --git a/src/preload/index.ts b/src/preload/index.ts
index 56af8a2c..d8f37cfb 100644
--- a/src/preload/index.ts
+++ b/src/preload/index.ts
@@ -215,6 +215,12 @@ export interface HarnessConfig {
tvShowOffices?: boolean;
/** Active office map/cast theme (honored only when tvShowOffices is on). */
officeTheme?: 'office' | 'friends' | 'brooklyn99' | 'siliconvalley' | 'got' | 'hogwarts';
+ /** Per-CLI-provider local/self-hosted base URL (Ollama/LM Studio/vLLM, …) for the
+ * OpenCode/Crush/pi/qwen engines; applied at spawn. API KEYS are NOT stored here —
+ * they live write-only in the secret broker. */
+ providerBaseUrls?: Partial<Record<AgentProvider, string>>;
+ /** Per-CLI-provider default model slug, used to pre-fill the model picker. */
+ providerDefaultModels?: Partial<Record<AgentProvider, string>>;
}
export interface MemoryStatus {
@@ -889,7 +895,16 @@ const api = {
integrationsRemove: (req: { id: string }): Promise<{ ok: boolean }> =>
ipcRenderer.invoke('integrations:remove', req),
integrationsTest: (req: { id: string; path?: string }): Promise<{ ok: boolean; status?: number; error?: string }> =>
- ipcRenderer.invoke('integrations:test', req)
+ ipcRenderer.invoke('integrations:test', req),
+ // Per-CLI-provider BYOK keys — WRITE-ONLY. `providerKeySet` stores a backend key one
+ // way (never echoed); `providerKeyHas` returns only a boolean; no method ever returns
+ // the plaintext. Keys are materialized MAIN-ONLY at spawn.
+ providerKeySet: (req: { backend: string; key: string }): Promise<{ ok: boolean; error?: string }> =>
+ ipcRenderer.invoke('providerKey:set', req),
+ providerKeyHas: (backend: string): Promise<boolean> =>
+ ipcRenderer.invoke('providerKey:has', backend),
+ providerKeyClear: (backend: string): Promise<{ ok: boolean; error?: string }> =>
+ ipcRenderer.invoke('providerKey:clear', backend)
};
contextBridge.exposeInMainWorld('cth', api);
diff --git a/src/renderer/src/store/config.ts b/src/renderer/src/store/config.ts
index 9807cad6..9407d6c3 100644
--- a/src/renderer/src/store/config.ts
+++ b/src/renderer/src/store/config.ts
@@ -101,6 +101,12 @@ export interface HarnessConfig {
tvShowOffices?: boolean;
/** Active office map/cast theme (honored only when tvShowOffices is on). */
officeTheme?: 'office' | 'friends' | 'brooklyn99' | 'siliconvalley' | 'got' | 'hogwarts';
+ /** Per-CLI-provider local/self-hosted base URL (Ollama/LM Studio/vLLM, …) for the
+ * OpenCode/Crush/pi/qwen engines; applied at spawn. API KEYS are NOT stored here —
+ * they live write-only in the secret broker. */
+ providerBaseUrls?: Partial<Record<AgentProvider, string>>;
+ /** Per-CLI-provider default model slug, used to pre-fill the model picker. */
+ providerDefaultModels?: Partial<Record<AgentProvider, string>>;
}
/** The Sonnet model with the 1M-token context window — used for Michael's prep