diff --git a/src/__tests__/opencode_client.spec.ts b/src/__tests__/opencode_client.spec.ts index 6027cac..4dd4a39 100644 --- a/src/__tests__/opencode_client.spec.ts +++ b/src/__tests__/opencode_client.spec.ts @@ -64,7 +64,6 @@ function mockResponse(overrides: { } const sampleRequest: OpenCodeRequest = { - mode: 'edit', prompt: 'add type hints', context: { notebookPath: 'foo.ipynb', @@ -86,7 +85,6 @@ describe('callOpenCodeEdit', () => { it('POSTs to /opencode-bridge/edit with JSON body', async () => { const respBody = { ok: true, - mode: 'edit', finalSource: 'def foo(x: int) -> int: return x', sessionId: 'sid', notebookPath: 'foo.ipynb', diff --git a/src/index.ts b/src/index.ts index cfae346..cf5fb97 100644 --- a/src/index.ts +++ b/src/index.ts @@ -49,17 +49,21 @@ const plugin: JupyterFrontEndPlugin = { // Load settings + push into the actions module. if (settingRegistry) { - void settingRegistry - .load(plugin.id) - .then(settings => { - const bridge = readOpenCodeSettings(settings.composite); - setOpenCodeRuntime({ - settings: bridge, - serverSettings: app.serviceManager.serverSettings - }); - console.log('opencode_bridge settings loaded:', bridge); + void settingRegistry + .load(plugin.id) + .then(settings => { + const apply = () => { + const bridge = readOpenCodeSettings(settings.composite); + setOpenCodeRuntime({ + settings: bridge, + serverSettings: app.serviceManager.serverSettings + }); + console.log('opencode_bridge settings applied:', bridge); + }; + apply(); + settings.changed.connect(apply); - void callOpenCodeProviders(app.serviceManager.serverSettings) + void callOpenCodeProviders(app.serviceManager.serverSettings) .then(data => { const lines: string[] = [ '[opencode_bridge] Available OpenCode providers:' diff --git a/src/types.ts b/src/types.ts index 98b5e0d..d1a119b 100644 --- a/src/types.ts +++ b/src/types.ts @@ -22,10 +22,7 @@ export interface CellContext { error: ErrorOutput | null; } -export type OpenCodeMode = 'optimize' | 'fix' | 'edit'; - export interface OpenCodeRequest { - mode: OpenCodeMode; prompt: string; context: CellContext; providerId?: string; @@ -34,7 +31,6 @@ export interface OpenCodeRequest { export interface OpenCodeSuccess { ok: true; - mode: OpenCodeMode; finalSource: string; sessionId: string; notebookPath: string;