jupyterlab_ai_code_assistants_extension 1.2.71 → 1.2.83

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (42) hide show
  1. package/README.md +7 -6
  2. package/lib/core/colour.d.ts +2 -10
  3. package/lib/core/colour.js +8 -18
  4. package/lib/core/modes.d.ts +2 -2
  5. package/lib/core/panel.d.ts +8 -43
  6. package/lib/core/panel.js +44 -229
  7. package/lib/core/popup.d.ts +1 -1
  8. package/lib/core/popup.js +52 -11
  9. package/lib/core/request.js +13 -6
  10. package/lib/core/terminals.d.ts +2 -33
  11. package/lib/core/terminals.js +24 -100
  12. package/lib/core/types.d.ts +13 -33
  13. package/lib/index.js +8 -0
  14. package/lib/providers/claude.js +4 -11
  15. package/lib/providers/codex.js +9 -12
  16. package/lib/providers/deepseek.d.ts +1 -2
  17. package/lib/providers/deepseek.js +14 -35
  18. package/lib/providers/gemini.js +1 -9
  19. package/lib/providers/kimi.js +0 -6
  20. package/package.json +1 -1
  21. package/src/__tests__/colour.spec.ts +11 -19
  22. package/src/__tests__/index.spec.ts +38 -5
  23. package/src/__tests__/launcher.spec.ts +1 -3
  24. package/src/__tests__/panel.spec.ts +105 -248
  25. package/src/__tests__/popup.spec.ts +105 -2
  26. package/src/__tests__/registry.spec.ts +1 -4
  27. package/src/__tests__/tab-colour-capture.spec.ts +48 -3
  28. package/src/__tests__/terminals.spec.ts +29 -143
  29. package/src/core/colour.ts +8 -23
  30. package/src/core/modes.ts +2 -2
  31. package/src/core/panel.ts +48 -272
  32. package/src/core/popup.ts +58 -12
  33. package/src/core/request.ts +13 -6
  34. package/src/core/terminals.ts +30 -118
  35. package/src/core/types.ts +13 -34
  36. package/src/index.ts +10 -2
  37. package/src/providers/claude.ts +4 -11
  38. package/src/providers/codex.ts +9 -12
  39. package/src/providers/deepseek.ts +15 -37
  40. package/src/providers/gemini.ts +1 -9
  41. package/src/providers/kimi.ts +0 -6
  42. package/style/base.css +48 -36
@@ -32,7 +32,7 @@ export declare namespace ManageSessionsPopup {
32
32
  /** Tooltip for one row's Open button. The panel owns it because the launch
33
33
  * mode in force is panel state, and every other surface that opens a
34
34
  * conversation names it. */
35
- openTitle: (sessionId: string) => string;
35
+ openTitle: () => string;
36
36
  /** Make a conversation the row's current one. */
37
37
  onSwitch: (sessionId: string) => void;
38
38
  /** Open a conversation in its own terminal. */
package/lib/core/popup.js CHANGED
@@ -17,6 +17,26 @@ function copyButton(sessionId, trans) {
17
17
  });
18
18
  return btn;
19
19
  }
20
+ /** The default dialog renderer with one extra node leading the footer.
21
+ * JupyterLab builds the footer in the Dialog constructor through
22
+ * `renderer.createFooter`, and `IOptions.renderer` is the public hook for
23
+ * changing it; its only built-in extra, `checkbox`, renders a checkbox, not a
24
+ * button. Leading the footer puts the node before Close in tab order, so the
25
+ * keyboard reaches the list, then Delete, then Close - and the Dialog's own Tab
26
+ * wrap, keyed on its last button, still wraps from Close. */
27
+ class FooterRenderer extends Dialog.Renderer {
28
+ constructor(_lead) {
29
+ super();
30
+ this._lead = _lead;
31
+ }
32
+ createFooter(buttons, checkbox) {
33
+ const footer = super.createFooter(buttons, checkbox);
34
+ // After super: its `Styling.styleNode` pass has run, so the lead keeps its
35
+ // own look instead of taking the `jp-mod-styled` dialog-button styling.
36
+ footer.node.prepend(this._lead);
37
+ return footer;
38
+ }
39
+ }
20
40
  export function showManageSessionsPopup(options) {
21
41
  var _a;
22
42
  const trans = (_a = options.trans) !== null && _a !== void 0 ? _a : nullTranslator.load('jupyterlab_ai_code_assistants_extension');
@@ -57,14 +77,12 @@ export function showManageSessionsPopup(options) {
57
77
  list.setAttribute('role', 'group');
58
78
  list.setAttribute('aria-label', trans.__('Conversations'));
59
79
  body.appendChild(list);
80
+ // Delete and its counter live in the dialog's own action row, not the body:
81
+ // a secondary destructive action sits on the left edge of the row that holds
82
+ // Close, as JupyterLab dialogs place one (DEF-PANE-307). It stays a plain
83
+ // button - a Dialog button resolves, and so closes, the dialog on click.
60
84
  const footer = document.createElement('div');
61
85
  footer.className = 'jp-AiAssistantsPanel-branchFooter';
62
- // Plain visual counter (selection, or the last action). The screen-reader
63
- // announcement lives in its own live region so per-checkbox ticks are not
64
- // announced on top of the native checkbox.
65
- const selCount = document.createElement('span');
66
- selCount.className = 'jp-AiAssistantsPanel-branchSelCount';
67
- footer.appendChild(selCount);
68
86
  const deleteBtn = document.createElement('button');
69
87
  deleteBtn.type = 'button';
70
88
  deleteBtn.className = 'jp-AiAssistantsPanel-branchDelete';
@@ -72,7 +90,13 @@ export function showManageSessionsPopup(options) {
72
90
  ? 'Deleted conversations move to the trash (recoverable)'
73
91
  : 'Deleted conversations are removed permanently';
74
92
  footer.appendChild(deleteBtn);
75
- body.appendChild(footer);
93
+ // Plain visual counter (selection, or the last action), beside the button
94
+ // whose count and result it reports. The screen-reader announcement lives in
95
+ // its own live region so per-checkbox ticks are not announced on top of the
96
+ // native checkbox.
97
+ const selCount = document.createElement('span');
98
+ selCount.className = 'jp-AiAssistantsPanel-branchSelCount';
99
+ footer.appendChild(selCount);
76
100
  // Visually hidden polite live region, announced only on delete.
77
101
  const srLive = document.createElement('div');
78
102
  srLive.className = 'jp-AiAssistantsPanel-srOnly';
@@ -86,8 +110,11 @@ export function showManageSessionsPopup(options) {
86
110
  // `Close`, not `Cancel`: deletions here are committed as they happen, so
87
111
  // the only exit must not read as an offer to undo them. The cleanup dialog
88
112
  // in the panel already says Close for the same reason.
89
- buttons: [Dialog.okButton({ label: trans.__('Close') })]
113
+ buttons: [Dialog.okButton({ label: trans.__('Close') })],
114
+ renderer: new FooterRenderer(footer)
90
115
  });
116
+ // Scopes the action-row layout in base.css to this one dialog.
117
+ dialog.addClass('jp-AiAssistantsPanel-branchDialog');
91
118
  // Per-row "Open" launches that conversation in its own terminal and closes
92
119
  // the popup. stopPropagation keeps the click from toggling selection or
93
120
  // switching the row.
@@ -96,7 +123,7 @@ export function showManageSessionsPopup(options) {
96
123
  btn.type = 'button';
97
124
  btn.className = 'jp-AiAssistantsPanel-branchOpen';
98
125
  btn.textContent = 'Open';
99
- btn.title = options.openTitle(sessionId);
126
+ btn.title = options.openTitle();
100
127
  btn.addEventListener('click', e => {
101
128
  e.stopPropagation();
102
129
  dialog.dispose();
@@ -292,7 +319,8 @@ export function showManageSessionsPopup(options) {
292
319
  // Busy-lock the whole body during the async delete, so a slow backend cannot
293
320
  // be double-clicked into deleting the same set twice and a mid-flight
294
321
  // selection cannot be silently discarded. The Dialog's Close button sits
295
- // outside the body and stays usable.
322
+ // outside the body and stays usable; Delete sits outside it too, and is held
323
+ // by its own `disabled` while `deleting` is set.
296
324
  const setDeleting = (on) => {
297
325
  deleting = on;
298
326
  body.classList.toggle('jp-mod-busy', on);
@@ -382,6 +410,15 @@ export function showManageSessionsPopup(options) {
382
410
  }
383
411
  });
384
412
  });
413
+ // Leaving the armed button disarms it, as the device bridge's two-step
414
+ // buttons do: the second click must follow the first, not come back to it
415
+ // after the focus has been somewhere else.
416
+ deleteBtn.addEventListener('blur', () => {
417
+ if (armed) {
418
+ disarm();
419
+ updateControls();
420
+ }
421
+ });
385
422
  search.addEventListener('input', () => {
386
423
  if (deleting) {
387
424
  return;
@@ -394,5 +431,9 @@ export function showManageSessionsPopup(options) {
394
431
  // dialog.dispose() (on open/switch) rejects this promise with `undefined`;
395
432
  // catch it so the teardown never surfaces as an unhandled rejection.
396
433
  dialog.launch().catch(() => undefined);
397
- search.focus();
434
+ // The Dialog focuses its primary button once attached; the filter takes the
435
+ // focus after that, so typing filters the list. Close stays the primary, so
436
+ // focus that leaves the dialog (Shift+Tab from the filter) returns to Close
437
+ // (DEF-PANE-314).
438
+ void dialog.ready.then(() => search.focus());
398
439
  }
@@ -133,12 +133,19 @@ export async function requestAPI(endPoint, serverSettings, init = {}) {
133
133
  }
134
134
  }
135
135
  if (!response.ok) {
136
- // `data.error` before `data`: every refusal this extension authors is
137
- // `{"error": "<code>"}` (14 sites in `core/routes.py`, none of which
138
- // writes `message`), so falling through to the object itself stringified
139
- // it and the user read the literal `[object Object]`. Tornado's own 500s
140
- // carry `message` and were never affected, which is why it survived - the
141
- // messages that broke were exactly the ones this server chose to send.
136
+ // `message`, then `error`, then `data`, because the server authors two
137
+ // refusal shapes. Every refusal in `core/routes.py` but one is
138
+ // `{"error": "<code>"}` - the `bad_request` helper plus its inline writes
139
+ // - and a code is a handle, not copy: the panel holds the words for the
140
+ // codes it knows (`cli_not_found`, `rename_failed`) and its own copy
141
+ // around the rest, so the chain's job there is only to keep `data` itself
142
+ // from being picked - falling to it stringified the object into the
143
+ // literal `[object Object]`. The holdout carries words: the launch
144
+ // preflight's 409 (`LaunchRefused`, the DeepSeek harness with no `tui`
145
+ // profile) answers `{"message": <the refusal in words for the user>}`
146
+ // with no code, and the panel prints it verbatim because it is already
147
+ // the sentence. Hence `message` outranks `error`; jupyter_server's own
148
+ // error bodies carry `message` too and need the same read.
142
149
  throw new ServerConnection.ResponseError(response, (_b = (_a = data === null || data === void 0 ? void 0 : data.message) !== null && _a !== void 0 ? _a : data === null || data === void 0 ? void 0 : data.error) !== null && _b !== void 0 ? _b : data);
143
150
  }
144
151
  return data;
@@ -46,11 +46,6 @@ export declare class TerminalManager {
46
46
  * Launch a terminal for one request and focus it. The returned widget is
47
47
  * tagged with `tagSessionId` in the microcache, so a later click on the row
48
48
  * that conversation now belongs to reuses this very terminal.
49
- *
50
- * For a project-scoped assistant the project's running terminal is the
51
- * answer instead, whatever the request asked for: every caller - row click,
52
- * `+`, fork, Launcher tile - lands here, so this one gate is what keeps a
53
- * second server off the project.
54
49
  */
55
50
  launch(request: ILaunchRequest, tagSessionId?: string): Promise<any>;
56
51
  /**
@@ -68,28 +63,11 @@ export declare class TerminalManager {
68
63
  * too, not only launches that carry an argv id. An id is globally unique to
69
64
  * one conversation, so a terminal holding it IS the one to focus, whatever
70
65
  * cwd it reports - a process that changed directory, or whose project dir
71
- * was recreated, must still be reused rather than duplicated.
72
- *
73
- * For a project-scoped assistant the id is not what a terminal holds; the
74
- * project's running terminal (see `_projectTerminal`) is the answer, so the
75
- * caller passes the project path. */
76
- findForSession(wantedSessionId: string | undefined, projectPath?: string): Promise<{
66
+ * was recreated, must still be reused rather than duplicated. */
67
+ findForSession(wantedSessionId: string | undefined): Promise<{
77
68
  widget: any;
78
69
  runningId: string | null;
79
70
  } | null>;
80
- /** The one terminal serving a project, for a project-scoped assistant, or
81
- * null. The project's microcache entry whatever conversation it was tagged
82
- * with, else the first live terminal the server confirms is running this
83
- * assistant with its working directory inside the project - the same
84
- * cwd-to-project rule the colour pass applies. The server's `running`
85
- * answer is what keeps a plain shell opened at the project from matching.
86
- *
87
- * The cached terminal is asked too, so a server the user stopped in it does
88
- * not hold every later open on a dead shell. Only a terminal the server has
89
- * once confirmed is evicted on a `running: false` answer: a fresh launch
90
- * answers that until its process is up, and evicting it then would start
91
- * the second server this method exists to prevent. */
92
- private _projectTerminal;
93
71
  /** Ask the server what a terminal is running. Null when the widget has no
94
72
  * session name yet, or the probe fails - a terminal can vanish between
95
73
  * enumeration and probe, which is a retry, not an error. */
@@ -122,15 +100,6 @@ export declare class TerminalManager {
122
100
  * the time - see `_pendingChoices`.
123
101
  */
124
102
  reconcileColours(): Promise<void>;
125
- /** Effective colour of one conversation as the cache currently reads it, for
126
- * branch inheritance at the fork sites.
127
- *
128
- * A snapshot, not the last word: the cache holds only server-confirmed
129
- * values, so a colour still being written is not in it. The fork path settles
130
- * the store and re-reads before it copies anything, and keeps this answer as
131
- * the fallback for a conversation the store holds nothing for - see
132
- * `_inheritColour` (DEF-31). */
133
- colourFor(session: ISession, sessionId?: string): string | null;
134
103
  /** Drop the tint from this assistant's terminals. Only its own terminals are
135
104
  * touched, so a tint the user set by hand on another tab survives.
136
105
  *
@@ -99,8 +99,7 @@ export class TerminalManager {
99
99
  // terminal is not painted, because painting is what destroys the pick.
100
100
  this._pendingChoices = new Map();
101
101
  // Most recent terminal per project, tagged with the conversation it runs so
102
- // reuse can tell a project's branches apart. `confirmed` records that the
103
- // server once answered `running: true` for it (project scope only).
102
+ // reuse can tell a project's branches apart.
104
103
  this._byProject = new Map();
105
104
  // In-flight launches keyed per CONVERSATION, so two branches of one project
106
105
  // open independently and concurrently.
@@ -178,17 +177,6 @@ export class TerminalManager {
178
177
  }
179
178
  async _doOpenSession(session, mode, wanted) {
180
179
  var _a;
181
- // A project-scoped assistant has no per-conversation terminal to find:
182
- // `launch` answers with the project's running one or starts it.
183
- if (this._descriptor.terminalScope === 'project') {
184
- await this.launch({
185
- project_path: session.project_path,
186
- encoded_path: session.encoded_path,
187
- session_id: wanted,
188
- mode
189
- }, wanted);
190
- return;
191
- }
192
180
  // 1. Microcache - the most recent terminal of this project, reused only
193
181
  // when it carries the wanted conversation.
194
182
  const cached = this._byProject.get(session.project_path);
@@ -223,26 +211,8 @@ export class TerminalManager {
223
211
  * Launch a terminal for one request and focus it. The returned widget is
224
212
  * tagged with `tagSessionId` in the microcache, so a later click on the row
225
213
  * that conversation now belongs to reuses this very terminal.
226
- *
227
- * For a project-scoped assistant the project's running terminal is the
228
- * answer instead, whatever the request asked for: every caller - row click,
229
- * `+`, fork, Launcher tile - lands here, so this one gate is what keeps a
230
- * second server off the project.
231
214
  */
232
215
  async launch(request, tagSessionId) {
233
- if (this._descriptor.terminalScope === 'project') {
234
- const running = await this._projectTerminal(request.project_path);
235
- if (running) {
236
- // A new conversation still settles the project's pin (DEF-9): the
237
- // argv route runs the launch's validation and pin bookkeeping without
238
- // spawning, and the argv it answers with is not needed here.
239
- if (request.session_id === undefined && request.encoded_path) {
240
- await requestProvider(this._descriptor.id, 'launch-argv', this._serverSettings, { method: 'POST', body: JSON.stringify(request) });
241
- }
242
- this.focus(running);
243
- return running;
244
- }
245
- }
246
216
  const spinner = showLaunchSpinner(`Opening ${this._descriptor.label}`, this._trans);
247
217
  try {
248
218
  const launched = await requestProvider(this._descriptor.id, 'launch', this._serverSettings, { method: 'POST', body: JSON.stringify(request) });
@@ -292,18 +262,8 @@ export class TerminalManager {
292
262
  * too, not only launches that carry an argv id. An id is globally unique to
293
263
  * one conversation, so a terminal holding it IS the one to focus, whatever
294
264
  * cwd it reports - a process that changed directory, or whose project dir
295
- * was recreated, must still be reused rather than duplicated.
296
- *
297
- * For a project-scoped assistant the id is not what a terminal holds; the
298
- * project's running terminal (see `_projectTerminal`) is the answer, so the
299
- * caller passes the project path. */
300
- async findForSession(wantedSessionId, projectPath) {
301
- if (this._descriptor.terminalScope === 'project') {
302
- const widget = projectPath
303
- ? await this._projectTerminal(projectPath)
304
- : null;
305
- return widget ? { widget, runningId: null } : null;
306
- }
265
+ * was recreated, must still be reused rather than duplicated. */
266
+ async findForSession(wantedSessionId) {
307
267
  if (!this._tracker || !wantedSessionId) {
308
268
  return null;
309
269
  }
@@ -315,50 +275,6 @@ export class TerminalManager {
315
275
  }
316
276
  return null;
317
277
  }
318
- /** The one terminal serving a project, for a project-scoped assistant, or
319
- * null. The project's microcache entry whatever conversation it was tagged
320
- * with, else the first live terminal the server confirms is running this
321
- * assistant with its working directory inside the project - the same
322
- * cwd-to-project rule the colour pass applies. The server's `running`
323
- * answer is what keeps a plain shell opened at the project from matching.
324
- *
325
- * The cached terminal is asked too, so a server the user stopped in it does
326
- * not hold every later open on a dead shell. Only a terminal the server has
327
- * once confirmed is evicted on a `running: false` answer: a fresh launch
328
- * answers that until its process is up, and evicting it then would start
329
- * the second server this method exists to prevent. */
330
- async _projectTerminal(projectPath) {
331
- var _a, _b;
332
- const cached = this._byProject.get(projectPath);
333
- if (cached && !cached.widget.isDisposed) {
334
- const info = await this.probe(cached.widget);
335
- if (info === null || info === void 0 ? void 0 : info.running) {
336
- cached.confirmed = true;
337
- }
338
- if ((info === null || info === void 0 ? void 0 : info.running) !== false || !cached.confirmed) {
339
- return cached.widget;
340
- }
341
- this._byProject.delete(projectPath);
342
- }
343
- if (!this._tracker) {
344
- return null;
345
- }
346
- for (const widget of this._liveTerminals()) {
347
- const info = await this.probe(widget);
348
- if ((info === null || info === void 0 ? void 0 : info.running) &&
349
- ((_b = sessionForCwds((_a = info.cwds) !== null && _a !== void 0 ? _a : [], this._sessions)) === null || _b === void 0 ? void 0 : _b.project_path) ===
350
- projectPath) {
351
- this._byProject.set(projectPath, {
352
- widget,
353
- sessionId: undefined,
354
- confirmed: true
355
- });
356
- this._wireDisposal(projectPath, widget);
357
- return widget;
358
- }
359
- }
360
- return null;
361
- }
362
278
  /** Ask the server what a terminal is running. Null when the widget has no
363
279
  * session name yet, or the probe fails - a terminal can vanish between
364
280
  * enumeration and probe, which is a retry, not an error. */
@@ -488,6 +404,27 @@ export class TerminalManager {
488
404
  }
489
405
  }
490
406
  const sessionId = (_e = (_b = info.session_id) !== null && _b !== void 0 ? _b : (_d = sessionForCwds((_c = info.cwds) !== null && _c !== void 0 ? _c : [], this._sessions)) === null || _d === void 0 ? void 0 : _d.session_id) !== null && _e !== void 0 ? _e : null;
407
+ // The server releases a stored colour that a later colour command of
408
+ // the assistant overtook (DEF-COLO-306), and the cache would go on
409
+ // painting it from the top of the ladder: only the panel's poll
410
+ // reloads it, and that poll stops while the panel is hidden. A probe
411
+ // naming this conversation answers its effective colour with every
412
+ // entry the server still holds on top, so a cached entry the probe
413
+ // disagrees with is no longer the server's - reload before painting.
414
+ // The reload queues behind every write of the store (DEF-30), so a
415
+ // pick confirmed after the probe answered survives it.
416
+ const cached = this._colours.get(sessionId);
417
+ if (cached !== null &&
418
+ info.session_id === sessionId &&
419
+ info.colour !== undefined &&
420
+ info.colour !== cached) {
421
+ await this._colours.load();
422
+ if (!this._colouredTabs ||
423
+ this._disposed ||
424
+ this._pass !== generation) {
425
+ return;
426
+ }
427
+ }
491
428
  const native = (_f = info.colour) !== null && _f !== void 0 ? _f : (sessionId
492
429
  ? ((_h = (_g = this._sessions.find(s => s.session_id === sessionId)) === null || _g === void 0 ? void 0 : _g.colour) !== null && _h !== void 0 ? _h : null)
493
430
  : null);
@@ -516,19 +453,6 @@ export class TerminalManager {
516
453
  this.startColourLoop();
517
454
  }
518
455
  }
519
- /** Effective colour of one conversation as the cache currently reads it, for
520
- * branch inheritance at the fork sites.
521
- *
522
- * A snapshot, not the last word: the cache holds only server-confirmed
523
- * values, so a colour still being written is not in it. The fork path settles
524
- * the store and re-reads before it copies anything, and keeps this answer as
525
- * the fallback for a conversation the store holds nothing for - see
526
- * `_inheritColour` (DEF-31). */
527
- colourFor(session, sessionId) {
528
- var _a;
529
- const id = sessionId !== null && sessionId !== void 0 ? sessionId : session.session_id;
530
- return effectiveColour(id, this._descriptor.colourSource, this._colours.get(id), (_a = session.colour) !== null && _a !== void 0 ? _a : null);
531
- }
532
456
  /** Drop the tint from this assistant's terminals. Only its own terminals are
533
457
  * touched, so a tint the user set by hand on another tab survives.
534
458
  *
@@ -1,12 +1,10 @@
1
1
  /** How a conversation is branched.
2
2
  *
3
- * - `native-flag` - the CLI forks in-process from a flag pair, and the new
4
- * conversation id is minted by the frontend, so the launch carries it and
5
- * the branch is watched for until its store entry materialises
6
- * - `native-command` - the CLI owns the fork verb AND mints the id itself, so
7
- * the id has to be discovered by diffing the branch list after launch
8
3
  * - `server-copy` - the CLI has no fork at all; the server copies the store
9
4
  * entry, answers with the new id, and the launch resumes that id
5
+ * - `server-native` - the store drives the CLI's own non-interactive fork
6
+ * path, so the fork exists with its id before any terminal opens and the
7
+ * launch resumes that id
10
8
  *
11
9
  * No `none` member. Python's `Capabilities` defaults `fork_strategy` to
12
10
  * `"none"` and answers a fork against it with 400 `fork_unsupported`, but
@@ -14,11 +12,11 @@
14
12
  * about it - and the flag never crosses the wire, so no TS code could produce
15
13
  * or read that value.
16
14
  */
17
- export type ForkStrategy = 'native-flag' | 'native-command' | 'server-copy';
18
- /** See `IProviderDescriptor.terminalScope`. */
19
- export type TerminalScope = 'conversation' | 'project';
15
+ export type ForkStrategy = 'server-copy' | 'server-native';
20
16
  /** Where a conversation's DEFAULT tab tint comes from. A user-set colour in
21
- * the extension's own write-back store always wins over all three. */
17
+ * the extension's own write-back store wins over `derived` and `none`. Over
18
+ * `native` the newer choice wins: the server releases a stored entry older
19
+ * than the assistant's newest run of its own colour command (DEF-COLO-306). */
22
20
  export type ColourSource = 'native' | 'derived' | 'none';
23
21
  /** One launch-behaviour setting of an assistant, in that assistant's own
24
22
  * terminology. A launch mode is a boolean skip-approval switch: it gets a
@@ -58,17 +56,6 @@ export interface IProviderDescriptor {
58
56
  cliBinary: string;
59
57
  forkStrategy: ForkStrategy;
60
58
  colourSource: ColourSource;
61
- /** What one terminal of this assistant holds. `conversation`: the process
62
- * runs exactly one conversation, so a terminal is reused only when the
63
- * server reads the wanted id off it. `project`: the process serves every
64
- * conversation of the project (a web UI chosen in the browser), so the
65
- * project's one running terminal is the answer to every open - a row click,
66
- * `+`, a fork, a Launcher tile - and a second process on the same project
67
- * is always a duplicate. */
68
- terminalScope: TerminalScope;
69
- /** Whether the branch flow asks the user to name the new conversation.
70
- * Where that name then GOES is `forkStrategy`'s job. */
71
- promptsForBranchName: boolean;
72
59
  /** The assistant keeps a conversation name this extension can write where
73
60
  * the assistant itself reads it back. False hides the rename action rather
74
61
  * than offering one that cannot land - which is the honest answer for an
@@ -207,26 +194,19 @@ export interface IRenameResponse {
207
194
  export interface ILaunchRequest {
208
195
  project_path: string;
209
196
  /** The project's store key. Carrying it arms the server's launch-time pin
210
- * bookkeeping (a native-flag fork pins itself current, a new session clears
211
- * a stale pin) and the session_not_found pre-flight - without it both are
212
- * silently skipped. Send it whenever the session row is in hand. */
197
+ * bookkeeping (a new session clears a stale pin) and the session_not_found
198
+ * pre-flight - without it both are silently skipped. Send it whenever the
199
+ * session row is in hand. */
213
200
  encoded_path?: string;
214
201
  /** Conversation to open. Omit to start a brand-new one. */
215
202
  session_id?: string;
216
203
  /** Frontend-minted id for a brand-new conversation, when the CLI accepts
217
204
  * one, so the terminal is identifiable from its argv on the first poll. */
218
205
  new_session_id?: string;
219
- /** Frontend-minted id for the fork (`forkStrategy: 'native-flag'`). */
220
- fork_session_id?: string;
221
- /** Parent conversation to fork from (`forkStrategy: 'native-command'`). */
222
- fork_from?: string;
223
- /** Name to stamp on the new conversation (`promptsForBranchName: true`). */
224
- name?: string;
225
206
  /** The launch mode this action runs under, as one token in the assistant's
226
- * own terminology: a boolean mode is its bare `ILaunchMode.id`, an enum mode
227
- * is `<id>=<value>`. One token, not a set - the server maps a single mode to
228
- * a single flag, and refuses any token the descriptor does not declare with
229
- * 400 `mode_unsupported`. */
207
+ * own terminology: the bare `ILaunchMode.id`. One token, not a set - the
208
+ * server maps a single mode to a single flag, and refuses any token the
209
+ * descriptor does not declare with 400 `mode_unsupported`. */
230
210
  mode?: string;
231
211
  }
232
212
  export interface ILaunchResponse {
package/lib/index.js CHANGED
@@ -347,6 +347,14 @@ const plugin = {
347
347
  const result = await requestAPI('migrate', serverSettings, { method: 'POST', body: '{}' });
348
348
  for (const entry of (_a = result.migrated) !== null && _a !== void 0 ? _a : []) {
349
349
  for (const [key, value] of Object.entries((_b = entry.keys) !== null && _b !== void 0 ? _b : {})) {
350
+ // A value already saved here is the user's newer choice and
351
+ // stays. The marker that stops a second migration lives in the
352
+ // Jupyter data folder, apart from these settings, so a server
353
+ // that shares only the settings folder migrates again and would
354
+ // put the retired extension's value back (DEF-RETI-299).
355
+ if ((settings === null || settings === void 0 ? void 0 : settings.get(key).user) !== undefined) {
356
+ continue;
357
+ }
350
358
  // Per key. The server marks EVERY provider migrated before it
351
359
  // answers, so one rejection aborting the loop used to drop the
352
360
  // remaining providers' values with no retry ever offered again -
@@ -33,20 +33,13 @@ export const descriptor = {
33
33
  iconName: 'jupyterlab_ai_code_assistants_extension:claude',
34
34
  iconSvg: claudeSvgStr,
35
35
  cliBinary: 'claude',
36
- // `claude --fork-session --session-id <uuid>`: the CLI forks in-process and
37
- // takes the new id from us, so the fork is known before it exists - and its
38
- // store entry is written lazily, on the first turn, which is what the core's
39
- // branch watcher waits for.
40
- forkStrategy: 'native-flag',
36
+ // The server forks with native /rename and /color before opening the CLI.
37
+ forkStrategy: 'server-native',
41
38
  // `/color` is Claude's own surface for a conversation's colour, recorded in
42
39
  // its transcript, so the assistant supplies the DEFAULT tint - a colour the
43
- // user then sets on the tab diverges from it deliberately and wins.
40
+ // user sets on the tab overrides it and is remembered, until a later
41
+ // `/color` takes over (`colour_choice_ms` in providers/claude.py).
44
42
  colourSource: 'native',
45
- terminalScope: 'conversation',
46
- // `-n <name>` at launch: Claude stamps the name itself and re-stamps it on
47
- // every turn, which is the only way a fork's name survives - a title written
48
- // after the fact loses to the parent title the fork inherits.
49
- promptsForBranchName: true,
50
43
  // `/rename` writes a `custom-title` record into the transcript, and the
51
44
  // store writes the same record.
52
45
  canRename: true,
@@ -6,9 +6,9 @@
6
6
  //
7
7
  // The three divergences that matter are capability flags, not code:
8
8
  //
9
- // * `forkStrategy: 'native-command'` - `codex fork <parent>` mints the fork's
10
- // id itself, so the panel snapshots the branch list, launches, and diffs to
11
- // discover the id (the shared 2s x 90 discovery watcher)
9
+ // * `forkStrategy: 'server-native'` - the store forks through Codex's own
10
+ // app-server (`thread/fork` plus `thread/name/set`) before its terminal
11
+ // opens, so the panel resumes the id the server answered with
12
12
  // * `colourSource: 'none'` - Codex has no colour concept at all, so a tab tint
13
13
  // only ever comes from the extension's own write-back store
14
14
  // * `hasLiveProcess: true` - a project row shows a dot when a `codex` process
@@ -34,17 +34,14 @@ export const descriptor = {
34
34
  iconName: 'jupyterlab_ai_code_assistants_extension:codex',
35
35
  iconSvg: codexSvgStr,
36
36
  cliBinary: 'codex',
37
- // `codex fork <parent>` owns both the verb and the new id.
38
- forkStrategy: 'native-command',
37
+ // The native metadata API returns a named fork before its terminal opens.
38
+ forkStrategy: 'server-native',
39
39
  // No `/color` equivalent, and nothing in the thread store records one.
40
40
  colourSource: 'none',
41
- terminalScope: 'conversation',
42
- // Forks are unnamed - Codex has no naming flag and no writable title field,
43
- // so the panel never asks for a name it could not stamp anywhere.
44
- promptsForBranchName: false,
45
- // No writable name: a thread's name lives in the sqlite index the CLI
46
- // owns, and Codex has no rename subcommand to shell to.
47
- canRename: false,
41
+ // The server writes the name through the app-server method `thread/name/set`
42
+ // - the same experimental stdio channel its fork already speaks - and the
43
+ // sqlite index the CLI reads follows it.
44
+ canRename: true,
48
45
  // A bare `codex` mints its own thread id; there is no `--session-id`.
49
46
  mintsNewSessionId: false,
50
47
  launchModes: [
@@ -1,3 +1,2 @@
1
- import { IProviderDescriptor, IProviderHooks } from '../core/types';
1
+ import { IProviderDescriptor } from '../core/types';
2
2
  export declare const descriptor: IProviderDescriptor;
3
- export declare const hooks: IProviderHooks;