refactor: drop mode from frontend types; react to settings changes
This commit is contained in:
@@ -64,7 +64,6 @@ function mockResponse(overrides: {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const sampleRequest: OpenCodeRequest = {
|
const sampleRequest: OpenCodeRequest = {
|
||||||
mode: 'edit',
|
|
||||||
prompt: 'add type hints',
|
prompt: 'add type hints',
|
||||||
context: {
|
context: {
|
||||||
notebookPath: 'foo.ipynb',
|
notebookPath: 'foo.ipynb',
|
||||||
@@ -86,7 +85,6 @@ describe('callOpenCodeEdit', () => {
|
|||||||
it('POSTs to /opencode-bridge/edit with JSON body', async () => {
|
it('POSTs to /opencode-bridge/edit with JSON body', async () => {
|
||||||
const respBody = {
|
const respBody = {
|
||||||
ok: true,
|
ok: true,
|
||||||
mode: 'edit',
|
|
||||||
finalSource: 'def foo(x: int) -> int: return x',
|
finalSource: 'def foo(x: int) -> int: return x',
|
||||||
sessionId: 'sid',
|
sessionId: 'sid',
|
||||||
notebookPath: 'foo.ipynb',
|
notebookPath: 'foo.ipynb',
|
||||||
|
|||||||
+5
-1
@@ -52,12 +52,16 @@ const plugin: JupyterFrontEndPlugin<void> = {
|
|||||||
void settingRegistry
|
void settingRegistry
|
||||||
.load(plugin.id)
|
.load(plugin.id)
|
||||||
.then(settings => {
|
.then(settings => {
|
||||||
|
const apply = () => {
|
||||||
const bridge = readOpenCodeSettings(settings.composite);
|
const bridge = readOpenCodeSettings(settings.composite);
|
||||||
setOpenCodeRuntime({
|
setOpenCodeRuntime({
|
||||||
settings: bridge,
|
settings: bridge,
|
||||||
serverSettings: app.serviceManager.serverSettings
|
serverSettings: app.serviceManager.serverSettings
|
||||||
});
|
});
|
||||||
console.log('opencode_bridge settings loaded:', bridge);
|
console.log('opencode_bridge settings applied:', bridge);
|
||||||
|
};
|
||||||
|
apply();
|
||||||
|
settings.changed.connect(apply);
|
||||||
|
|
||||||
void callOpenCodeProviders(app.serviceManager.serverSettings)
|
void callOpenCodeProviders(app.serviceManager.serverSettings)
|
||||||
.then(data => {
|
.then(data => {
|
||||||
|
|||||||
@@ -22,10 +22,7 @@ export interface CellContext {
|
|||||||
error: ErrorOutput | null;
|
error: ErrorOutput | null;
|
||||||
}
|
}
|
||||||
|
|
||||||
export type OpenCodeMode = 'optimize' | 'fix' | 'edit';
|
|
||||||
|
|
||||||
export interface OpenCodeRequest {
|
export interface OpenCodeRequest {
|
||||||
mode: OpenCodeMode;
|
|
||||||
prompt: string;
|
prompt: string;
|
||||||
context: CellContext;
|
context: CellContext;
|
||||||
providerId?: string;
|
providerId?: string;
|
||||||
@@ -34,7 +31,6 @@ export interface OpenCodeRequest {
|
|||||||
|
|
||||||
export interface OpenCodeSuccess {
|
export interface OpenCodeSuccess {
|
||||||
ok: true;
|
ok: true;
|
||||||
mode: OpenCodeMode;
|
|
||||||
finalSource: string;
|
finalSource: string;
|
||||||
sessionId: string;
|
sessionId: string;
|
||||||
notebookPath: string;
|
notebookPath: string;
|
||||||
|
|||||||
Reference in New Issue
Block a user