@timurproko/a1 0.2.6-dev.717 → 0.2.6-dev.734

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 (213) hide show
  1. package/bin/cli.js +13 -2
  2. package/bin/ui.js +13 -0
  3. package/dist/app/session-shell/clipboard-services.d.ts +19 -0
  4. package/dist/app/session-shell/clipboard-services.js +7 -0
  5. package/dist/app/session-shell/exit-notice.d.ts +9 -5
  6. package/dist/app/session-shell/exit-notice.js +5 -5
  7. package/dist/app/session-shell/index.d.ts +3 -1
  8. package/dist/app/session-shell/index.js +1 -0
  9. package/dist/app/session-shell/paste-preparation-client.d.ts +3 -0
  10. package/dist/app/session-shell/paste-preparation-client.js +5 -2
  11. package/dist/app/session-shell/path-chip-presentation.d.ts +10 -3
  12. package/dist/app/session-shell/path-chip-presentation.js +48 -6
  13. package/dist/app/session-shell/prompt-chips.js +30 -4
  14. package/dist/app/session-shell/prompt-suggestion-controller.d.ts +5 -4
  15. package/dist/app/session-shell/prompt-suggestion-controller.js +148 -58
  16. package/dist/app/session-shell/quit-outro.d.ts +3 -1
  17. package/dist/app/session-shell/quit-outro.js +23 -8
  18. package/dist/app/session-shell/response-copy-transport.d.ts +6 -1
  19. package/dist/app/session-shell/response-copy-transport.js +8 -2
  20. package/dist/app/session-shell/session-shell-root.d.ts +22 -11
  21. package/dist/app/session-shell/session-shell-root.js +19 -12
  22. package/dist/app/session-shell/session-shell.d.ts +19 -21
  23. package/dist/app/session-shell/session-shell.js +678 -840
  24. package/dist/app/session-shell/session-viewport-controller.js +33 -21
  25. package/dist/cli/dispatch.js +5 -3
  26. package/dist/cli/session-context.d.ts +5 -1
  27. package/dist/cli/session-context.js +25 -8
  28. package/dist/composition/owned-ui.d.ts +23 -2
  29. package/dist/composition/owned-ui.js +124 -33
  30. package/dist/composition/session-info-reference.d.ts +2 -2
  31. package/dist/composition/session-info-reference.js +2 -2
  32. package/dist/composition/settings-route-host.js +2 -1
  33. package/dist/contracts/agent-engine/capability-ports.d.ts +1 -85
  34. package/dist/contracts/agent-engine/capability-ports.js +1 -35
  35. package/dist/contracts/agent-engine/index.d.ts +1 -7
  36. package/dist/contracts/agent-engine/index.js +0 -4
  37. package/dist/contracts/owned-ui/index.d.ts +9 -3
  38. package/dist/contracts/owned-ui/index.js +2 -1
  39. package/dist/contracts/owned-ui/model.d.ts +10 -0
  40. package/dist/contracts/owned-ui/session-backend.d.ts +119 -0
  41. package/dist/contracts/owned-ui/session-presenters.d.ts +55 -0
  42. package/dist/contracts/owned-ui/session-presenters.js +1 -0
  43. package/dist/contracts/owned-ui/session-workflows.d.ts +342 -0
  44. package/dist/contracts/owned-ui/session-workflows.js +30 -0
  45. package/dist/contracts/owned-ui/suggestion-diagnostics.d.ts +5 -1
  46. package/dist/contracts/owned-ui/suggestion-diagnostics.js +3 -1
  47. package/dist/contracts/owned-ui/validation.js +7 -0
  48. package/dist/features/launch/index.d.ts +1 -1
  49. package/dist/features/launch/session-context.d.ts +17 -2
  50. package/dist/features/launch/session-context.js +9 -5
  51. package/dist/features/owned-ui/settings-app.js +56 -54
  52. package/dist/features/prompt-suggestions/diagnostics.js +4 -1
  53. package/dist/foundation/lifecycle/index.d.ts +2 -2
  54. package/dist/foundation/lifecycle/index.js +1 -1
  55. package/dist/foundation/lifecycle/session-repository-context.d.ts +19 -2
  56. package/dist/foundation/lifecycle/session-repository-context.js +434 -66
  57. package/dist/foundation/process-containment/index.d.ts +1 -0
  58. package/dist/foundation/process-containment/index.js +1 -0
  59. package/dist/foundation/process-containment/native-process-inspector.d.ts +3 -0
  60. package/dist/foundation/process-containment/native-process-inspector.js +21 -0
  61. package/dist/foundation/release/bootstrap.js +1 -2
  62. package/dist/foundation/release/progress-palette.generated.d.ts +2 -2
  63. package/dist/foundation/release/progress-palette.generated.js +2 -2
  64. package/dist/foundation/release/release-gc.js +1 -1
  65. package/dist/foundation/release/update.js +0 -4
  66. package/dist/foundation/startup/startup-descriptor.js +2 -2
  67. package/dist/foundation/storage/control-store.js +0 -12
  68. package/dist/integrations/pi/components/components.js +2 -18
  69. package/dist/integrations/pi/components/index.d.ts +4 -4
  70. package/dist/integrations/pi/components/index.js +2 -2
  71. package/dist/integrations/pi/components/modal-frame.js +3 -4
  72. package/dist/integrations/pi/components/models-dialog.js +6 -35
  73. package/dist/integrations/pi/components/prompt-input-port.d.ts +1 -0
  74. package/dist/integrations/pi/components/resources/builtin-themes.d.ts +2 -2
  75. package/dist/integrations/pi/components/resources/builtin-themes.js +2 -2
  76. package/dist/integrations/pi/components/share-operation-dialog.js +3 -3
  77. package/dist/integrations/pi/components/shell-editor-autocomplete.js +19 -16
  78. package/dist/integrations/pi/components/shell-extension-ui.d.ts +5 -3
  79. package/dist/integrations/pi/components/shell-extension-ui.js +26 -12
  80. package/dist/integrations/pi/components/shell-hotkey-sections.js +2 -2
  81. package/dist/integrations/pi/components/shell-presenters-info.js +10 -10
  82. package/dist/integrations/pi/components/shell-presenters-transcript.js +13 -13
  83. package/dist/integrations/pi/components/shell-selectors-dialogs.js +5 -6
  84. package/dist/integrations/pi/components/shell-shared-facade.d.ts +21 -1
  85. package/dist/integrations/pi/components/shell-shared-facade.js +19 -3
  86. package/dist/integrations/pi/components/skills-dialog.js +3 -3
  87. package/dist/integrations/pi/components/submitted-prompt-adapter.js +2 -3
  88. package/dist/integrations/pi/components/theme.d.ts +9 -0
  89. package/dist/integrations/pi/components/theme.js +30 -0
  90. package/dist/integrations/pi/components/tool-result-adapter.js +6 -1
  91. package/dist/integrations/pi/components/upstream/adjacent/core/keybindings.d.ts +1 -1
  92. package/dist/integrations/pi/components/upstream/adjacent/core/keybindings.js +1 -1
  93. package/dist/integrations/pi/components/upstream/assets/earendil-image.json +2 -2
  94. package/dist/integrations/pi/components/upstream/components/countdown-timer.d.ts +1 -1
  95. package/dist/integrations/pi/components/upstream/components/earendil-announcement.js +1 -1
  96. package/dist/integrations/pi/components/upstream/components/extension-editor.d.ts +1 -1
  97. package/dist/integrations/pi/components/upstream/components/extension-editor.js +6 -6
  98. package/dist/integrations/pi/components/upstream/components/extension-input.js +4 -4
  99. package/dist/integrations/pi/components/upstream/components/extension-selector.js +4 -4
  100. package/dist/integrations/pi/components/upstream/components/mermaid.js +1 -1
  101. package/dist/integrations/pi/components/upstream/components/owned-editor.d.ts +5 -5
  102. package/dist/integrations/pi/components/upstream/components/owned-editor.js +8 -5
  103. package/dist/integrations/pi/components/upstream/components/pi-logo.js +1 -1
  104. package/dist/integrations/pi/components/upstream/components/scoped-models-selector.d.ts +1 -1
  105. package/dist/integrations/pi/components/upstream/components/scoped-models-selector.js +3 -3
  106. package/dist/integrations/pi/components/upstream/components/session-footer.js +1 -1
  107. package/dist/integrations/pi/components/upstream/components/session-selector-search.js +1 -1
  108. package/dist/integrations/pi/components/upstream/components/session-selector.js +9 -9
  109. package/dist/integrations/pi/components/upstream/components/skill-invocation-message.d.ts +3 -2
  110. package/dist/integrations/pi/components/upstream/components/skill-invocation-message.js +6 -3
  111. package/dist/integrations/pi/components/upstream/components/status-indicator.d.ts +1 -1
  112. package/dist/integrations/pi/components/upstream/components/status-indicator.js +1 -1
  113. package/dist/integrations/pi/components/upstream/components/themed-text.d.ts +1 -1
  114. package/dist/integrations/pi/components/upstream/components/themed-text.js +1 -1
  115. package/dist/integrations/pi/components/upstream/components/thinking-selector.d.ts +1 -1
  116. package/dist/integrations/pi/components/upstream/components/thinking-selector.js +2 -2
  117. package/dist/integrations/pi/components/upstream/components/tool-execution.d.ts +4 -0
  118. package/dist/integrations/pi/components/upstream/components/tool-execution.js +11 -1
  119. package/dist/integrations/pi/components/upstream/components/tree-selector.d.ts +2 -2
  120. package/dist/integrations/pi/components/upstream/components/tree-selector.js +27 -18
  121. package/dist/integrations/pi/components/upstream/components/trust-selector.js +1 -1
  122. package/dist/integrations/pi/components/upstream/external-editor.js +1 -1
  123. package/dist/integrations/pi/components/upstream/history/editor-core.d.ts +4 -4
  124. package/dist/integrations/pi/components/upstream/history/editor-core.js +11 -7
  125. package/dist/integrations/pi/components/upstream/history/kill-ring.d.ts +1 -1
  126. package/dist/integrations/pi/components/upstream/history/kill-ring.js +1 -1
  127. package/dist/integrations/pi/components/upstream/history/printable-key.js +1 -1
  128. package/dist/integrations/pi/components/upstream/history/text-helpers.js +1 -1
  129. package/dist/integrations/pi/components/upstream/history/undo-stack.d.ts +1 -1
  130. package/dist/integrations/pi/components/upstream/history/undo-stack.js +1 -1
  131. package/dist/integrations/pi/components/upstream/history/word-navigation.js +1 -1
  132. package/dist/integrations/pi/components/upstream/model-search.d.ts +1 -1
  133. package/dist/integrations/pi/components/upstream/program-status-reporter.d.ts +31 -0
  134. package/dist/integrations/pi/components/upstream/program-status-reporter.js +89 -0
  135. package/dist/integrations/pi/components/upstream/theme/theme-controller.d.ts +1 -1
  136. package/dist/integrations/pi/components/upstream/theme/theme.d.ts +22 -1
  137. package/dist/integrations/pi/components/upstream/theme/theme.js +225 -10
  138. package/dist/integrations/pi/engine/adapter.d.ts +44 -24
  139. package/dist/integrations/pi/engine/adapter.js +130 -22
  140. package/dist/integrations/pi/engine/command-dispatch.d.ts +2 -5
  141. package/dist/integrations/pi/engine/extension-ui-binding.d.ts +2 -11
  142. package/dist/integrations/pi/engine/host-ports.d.ts +20 -0
  143. package/dist/integrations/pi/engine/host-ports.js +13 -0
  144. package/dist/integrations/pi/engine/host.d.ts +70 -0
  145. package/dist/integrations/pi/engine/host.js +147 -0
  146. package/dist/integrations/pi/engine/index.d.ts +8 -4
  147. package/dist/integrations/pi/engine/index.js +3 -1
  148. package/dist/integrations/pi/engine/pi-settings-metadata.json +1 -1
  149. package/dist/integrations/pi/engine/resource-catalog.d.ts +4 -23
  150. package/dist/integrations/pi/engine/resources/changelog.json +4 -4
  151. package/dist/integrations/pi/engine/runtime-integration.d.ts +8 -2
  152. package/dist/integrations/pi/engine/runtime-integration.js +12 -7
  153. package/dist/integrations/pi/engine/session-events.js +10 -2
  154. package/dist/integrations/pi/engine/session-integration.d.ts +3 -8
  155. package/dist/integrations/pi/engine/session-integration.js +0 -49
  156. package/dist/integrations/pi/engine/session-runtime.d.ts +18 -3
  157. package/dist/integrations/pi/engine/session-runtime.js +18 -7
  158. package/dist/integrations/pi/engine/settings-bridge.d.ts +2 -2
  159. package/dist/integrations/pi/engine/settings-bridge.js +0 -2
  160. package/dist/integrations/pi/engine/settings-port.d.ts +2 -0
  161. package/dist/integrations/pi/engine/settings-port.js +3 -5
  162. package/dist/integrations/pi/engine/transcript-projection.js +2 -1
  163. package/dist/integrations/pi/engine/workflows.d.ts +33 -260
  164. package/dist/integrations/pi/engine/workflows.js +6 -28
  165. package/dist/integrations/pi/session-presenters/index.d.ts +2 -0
  166. package/dist/integrations/pi/session-presenters/index.js +1 -0
  167. package/dist/integrations/pi/session-presenters/presenters.d.ts +16 -0
  168. package/dist/integrations/pi/session-presenters/presenters.js +341 -0
  169. package/dist/integrations/pi/startup-public.js +306 -290
  170. package/dist/integrations/pi/startup-public.manifest.json +289 -265
  171. package/dist/integrations/pi/tui-runtime/adapter.d.ts +2 -1
  172. package/dist/integrations/pi/tui-runtime/adapter.js +7 -2
  173. package/dist/integrations/pi/tui-runtime/contracts.d.ts +3 -1
  174. package/dist/integrations/pi/tui-runtime/damage-aware-terminal.d.ts +8 -1
  175. package/dist/integrations/pi/tui-runtime/damage-aware-terminal.js +67 -2
  176. package/dist/integrations/pi/tui-runtime/index.d.ts +1 -1
  177. package/dist/integrations/pi/tui-runtime/index.js +1 -1
  178. package/dist/native/darwin-arm64/manifest.json +1 -1
  179. package/dist/native/linux-x64/manifest.json +1 -1
  180. package/dist/native/win32-x64/manifest.json +2 -2
  181. package/dist/native/win32-x64/process-guardian.exe +0 -0
  182. package/dist/product-identity.d.ts +2 -2
  183. package/dist/product-identity.js +2 -2
  184. package/dist/product-identity.json +3 -1
  185. package/dist/runtime-payload-inventory.json +3092 -2878
  186. package/dist/ui/components/prompt-input.d.ts +2 -0
  187. package/dist/ui/components/prompt-input.js +5 -1
  188. package/dist/ui/components/text-selection.d.ts +1 -1
  189. package/dist/ui/components/text-selection.js +3 -1
  190. package/dist/ui/components/theme.d.ts +2 -0
  191. package/dist/ui/components/transcript-viewport.d.ts +6 -4
  192. package/dist/ui/components/transcript-viewport.js +94 -16
  193. package/dist/ui/components/value-menu.d.ts +2 -0
  194. package/dist/ui/components/value-menu.js +13 -8
  195. package/dist/ui/settings/declarations.d.ts +38 -14
  196. package/dist/ui/settings/declarations.js +35 -11
  197. package/dist/ui/settings/migrations.js +23 -0
  198. package/docs/architecture/boundaries.md +9 -1
  199. package/docs/architecture/project-structure.md +7 -5
  200. package/docs/architecture/prompt-suggestions.md +14 -10
  201. package/docs/local-worktree-cleanup.md +11 -5
  202. package/docs/openspec-archive-automation.md +6 -5
  203. package/package.json +3 -3
  204. package/dist/contracts/agent-engine/model.d.ts +0 -78
  205. package/dist/contracts/agent-engine/model.js +0 -1
  206. package/dist/contracts/agent-engine/ports.d.ts +0 -18
  207. package/dist/contracts/agent-engine/serialization.d.ts +0 -7
  208. package/dist/contracts/agent-engine/serialization.js +0 -58
  209. package/dist/contracts/agent-engine/validation.d.ts +0 -5
  210. package/dist/contracts/agent-engine/validation.js +0 -128
  211. package/dist/integrations/pi/components/upstream/theme/system-theme.d.ts +0 -61
  212. package/dist/integrations/pi/components/upstream/theme/system-theme.js +0 -709
  213. /package/dist/contracts/{agent-engine/ports.js → owned-ui/session-backend.js} +0 -0
@@ -1,6 +1,6 @@
1
1
  import { DIALOG_BACK_SHORTCUT_HINT, DIALOG_CLOSE_SHORTCUT_HINT } from "../../contracts/presentation/index.js";
2
- import { GLOBAL_SCOPE, LineInput, PLAIN_THEME, ShortcutRegistry, assertNoShortcutConflicts, blockJumpTarget, numericValues, RAIL_COLUMNS, renderDialogPanel, renderSteppedDialogPanel, renderEmptyState, renderGroupHeader, renderInputRow, renderListRow, renderNote, renderShortcutHintsWithClose, menuRowAt, regionAt, renderValueMenu, withScrollbarRail, stepperEnds, steppedValue, truncateToWidth, valueColumnFor, valueMenuFrame, blockRowSpan, displayWidth, handleLineInputKey, humanizeLabel, humanizeTitle, indexOfKey, isThumbRow, layoutList, moveSelection, rowKey, scrollForSelection, scrollForTrackPage, scrollbarGeometry, scrollbarPresentation, ScrollbarRails, scrollbarWheelRows, selectableIndexes, } from "../../ui/components/index.js";
3
- import { SETTINGS_APP_ID, SETTINGS_ROUTE } from "./settings-route.js";
2
+ import { GLOBAL_SCOPE, LineInput, PLAIN_THEME, ShortcutRegistry, assertNoShortcutConflicts, blockJumpTarget, numericValues, RAIL_COLUMNS, renderDialogPanel, renderSteppedDialogPanel, renderEmptyState, renderGroupHeader, renderInputRow, renderListRow, renderNote, renderShortcutHintsWithClose, menuRowAt, regionAt, renderValueMenu, withScrollbarRail, stepperEnds, steppedValue, truncateToWidth, valueColumnFor, valueMenuFrame, blockRowSpan, displayWidth, handleLineInputKey, humanizeLabel, humanizeTitle, indexOfKey, layoutList, moveSelection, rowKey, scrollForSelection, scrollForTrackPage, scrollbarGeometry, scrollbarPresentation, ScrollbarRails, scrollbarWheelRows, selectableIndexes, } from "../../ui/components/index.js";
3
+ import { SETTINGS_APP_ID } from "./settings-route.js";
4
4
  export { SETTINGS_APP_ID, SETTINGS_ROUTE } from "./settings-route.js";
5
5
  const SCOPE = SETTINGS_APP_ID;
6
6
  const SETTINGS_TOP_RULE_ROWS = 1;
@@ -265,8 +265,10 @@ export class SettingsApp {
265
265
  const row = rows[selected];
266
266
  if (row?.kind === "element" && row.value.structured)
267
267
  this.#openStructured(row.value);
268
- else
268
+ else if (row?.kind === "element" && typeof this.#shownValue(row.value) === "number")
269
269
  this.#cycle(rows, selected, 1);
270
+ else
271
+ this.#openMenu(rows, selected, true);
270
272
  return { consumed: true };
271
273
  }
272
274
  case "move-up":
@@ -334,34 +336,36 @@ export class SettingsApp {
334
336
  return { consumed: true, render: false };
335
337
  if (overRow === null) {
336
338
  // Invariant: a press anywhere else dismisses the menu rather than acting through it.
337
- this.#menu = null;
339
+ this.#closeMenu(menu);
338
340
  return { consumed: true };
339
341
  }
340
342
  const value = menu.choices[overRow];
341
- this.#menu = null;
343
+ this.#closeMenu(menu);
342
344
  if (value !== undefined)
343
345
  this.#apply(menu.entry, value);
344
346
  return { consumed: true };
345
347
  }
346
- if (this.#structured !== null) {
347
- // Invariant: the structured surface is keyboard-only. It owns every pointer report so
348
- // neither its selection nor the Settings list behind it can react.
349
- return { consumed: true, render: false };
350
- }
351
348
  if (event.kind === "wheel-up" || event.kind === "wheel-down") {
352
349
  // Invariant: the whole list pane owns wheel scrolling, including blank space beside
353
- // short labels. It must not depend on finding an item under the pointer.
350
+ // short labels. A fixed structured dialog keeps that content interaction available.
354
351
  const screenRow = event.row - 1;
355
352
  const wheelBottom = this.#filter === null
356
353
  ? this.#bodyTopForFrame + this.#bodyHeightForFrame
357
354
  : this.#panelTopForFrame + SETTINGS_SEARCH_INPUT_ROWS + SETTINGS_STATUS_ROWS;
358
- if (screenRow < 0 || screenRow >= wheelBottom)
355
+ if (screenRow >= 0 && screenRow < wheelBottom) {
356
+ const distance = scrollbarWheelRows(this.#scrollbarSpeed());
357
+ if (this.#filter !== null)
358
+ this.#scrollBeforeFilter = null;
359
+ this.#scroll = Math.max(0, this.#scroll + (event.kind === "wheel-down" ? distance : -distance));
360
+ return { consumed: true };
361
+ }
362
+ if (this.#structured === null)
359
363
  return { consumed: false };
360
- const distance = scrollbarWheelRows(this.#scrollbarSpeed());
361
- if (this.#filter !== null)
362
- this.#scrollBeforeFilter = null;
363
- this.#scroll = Math.max(0, this.#scroll + (event.kind === "wheel-down" ? distance : -distance));
364
- return { consumed: true };
364
+ }
365
+ if (this.#structured !== null) {
366
+ // Invariant: the structured surface is keyboard-only. Non-content-wheel pointer reports
367
+ // cannot change its selection or act on the Settings list behind it.
368
+ return { consumed: true, render: false };
365
369
  }
366
370
  const rail = this.#railPointer(event);
367
371
  if (rail.owned)
@@ -440,7 +444,7 @@ export class SettingsApp {
440
444
  clearTimeout(this.#activityTimer);
441
445
  this.#activityTimer = undefined;
442
446
  }
443
- #openMenu(rows, selected) {
447
+ #openMenu(rows, selected, selectCurrent = false) {
444
448
  const row = rows[selected];
445
449
  if (row === undefined || row.kind !== "element")
446
450
  return;
@@ -459,9 +463,30 @@ export class SettingsApp {
459
463
  return;
460
464
  }
461
465
  const current = shown === null ? 0 : Math.max(0, entry.choices.indexOf(shown));
462
- // Invariant: the opening press targeted the setting value, not an option. Keep the
463
- // effective value as the keyboard origin without painting it as pointer-picked.
464
- this.#menu = { entry, current, anchorKey: `${entry.backend}:${entry.id}`, choices: entry.choices, index: -1 };
466
+ const anchorKey = `${entry.backend}:${entry.id}`;
467
+ // Compatibility: pointer opening already brightens the source value. Enter borrows that
468
+ // same value-region state for the life of its menu rather than inventing a keyboard color.
469
+ if (selectCurrent) {
470
+ this.#hoverKey = anchorKey;
471
+ this.#hoverRegion = "value";
472
+ }
473
+ // Invariant: pointer opening stays inactive because it targeted the setting value, while
474
+ // Enter explicitly starts keyboard choice navigation at the value already in effect.
475
+ this.#menu = {
476
+ entry,
477
+ current,
478
+ anchorKey,
479
+ choices: entry.choices,
480
+ keyboardOpened: selectCurrent,
481
+ index: selectCurrent ? current : -1,
482
+ };
483
+ }
484
+ #closeMenu(menu) {
485
+ this.#menu = null;
486
+ if (!menu.keyboardOpened || this.#hoverKey !== menu.anchorKey)
487
+ return;
488
+ this.#hoverKey = null;
489
+ this.#hoverRegion = "label";
465
490
  }
466
491
  // Rationale: a structured setting opens as its own flag list rather than a value menu.
467
492
  #openStructured(entry) {
@@ -623,9 +648,7 @@ export class SettingsApp {
623
648
  const failure = changeFailure(outcome);
624
649
  if (failure === null) {
625
650
  this.#recordUndo({ kind: "structured", sequence, entry: open.entry, previous, forward });
626
- this.#notice = outcome.status === "deferred" && outcome.application !== null
627
- ? `${labelOf(open.entry)} is stored and applies ${applicationLabel(outcome.application)}`
628
- : null;
651
+ this.#notice = null;
629
652
  return;
630
653
  }
631
654
  // Concurrency: only roll back the dialog if no later press has moved the record on.
@@ -640,12 +663,12 @@ export class SettingsApp {
640
663
  return { consumed: false };
641
664
  const key = KEYS[data] ?? data;
642
665
  if (SETTINGS_SHORTCUTS.resolve(key, SCOPE) === "undo") {
643
- this.#menu = null;
666
+ this.#closeMenu(menu);
644
667
  this.#undo();
645
668
  return { consumed: true };
646
669
  }
647
670
  if (key === "escape") {
648
- this.#menu = null;
671
+ this.#closeMenu(menu);
649
672
  return { consumed: true };
650
673
  }
651
674
  if (key === "up" || key === "down") {
@@ -656,7 +679,7 @@ export class SettingsApp {
656
679
  }
657
680
  else if (key === "enter") {
658
681
  const value = menu.choices[menu.index];
659
- this.#menu = null;
682
+ this.#closeMenu(menu);
660
683
  if (value !== undefined)
661
684
  this.#apply(menu.entry, value);
662
685
  }
@@ -766,9 +789,7 @@ export class SettingsApp {
766
789
  // Concurrency: a later press may have moved on; only the last request clears itself.
767
790
  if (this.#pending.get(key) === value)
768
791
  this.#pending.delete(key);
769
- this.#notice = outcome.status === "deferred" && outcome.application !== null
770
- ? `${labelOf(entry)} is stored and applies ${applicationLabel(outcome.application)}`
771
- : null;
792
+ this.#notice = null;
772
793
  });
773
794
  }
774
795
  #shownValue(entry) {
@@ -825,9 +846,7 @@ export class SettingsApp {
825
846
  this.#notice = `Could not restore ${labelOf(record.entry)}: ${failure}`;
826
847
  }
827
848
  else {
828
- this.#notice = outcome.status === "deferred" && outcome.application !== null
829
- ? `${labelOf(record.entry)} is restored and applies ${applicationLabel(outcome.application)}`
830
- : null;
849
+ this.#notice = null;
831
850
  }
832
851
  this.#undoActive = false;
833
852
  this.#drainUndo();
@@ -925,7 +944,7 @@ export class SettingsApp {
925
944
  ? CONFIGURE
926
945
  : shown === null
927
946
  ? describeRaw(entry.rawValue)
928
- : this.#pending.has(key) ? displayValue(shown) : effectiveDisplay(entry, shown);
947
+ : displayValue(shown);
929
948
  const range = rangeOf(entry);
930
949
  return {
931
950
  key,
@@ -943,6 +962,9 @@ export class SettingsApp {
943
962
  }
944
963
  const state = {
945
964
  choices: menu.choices.map(choice => displayValue(choice)),
965
+ ...(menu.entry.id === "accentColor" ? {
966
+ previews: menu.choices.map(choice => theme.accentPreview?.(String(choice), "■") ?? ""),
967
+ } : {}),
946
968
  current: this.#shownValue(menu.entry) === null ? null : displayValue(this.#shownValue(menu.entry)),
947
969
  index: menu.index,
948
970
  };
@@ -1085,9 +1107,6 @@ function changeFailure(outcome) {
1085
1107
  function labelOf(entry) {
1086
1108
  return entry.label ?? humanizeLabel(entry.id);
1087
1109
  }
1088
- function isStepper(entry, shown = entry.value) {
1089
- return typeof shown === "number" && entry.editable;
1090
- }
1091
1110
  /** Where a setting's number may go: what the engine states, or what it offers. */
1092
1111
  function rangeOf(entry) {
1093
1112
  return { minimum: entry.minimum, maximum: entry.maximum, values: numericValues(entry.choices) };
@@ -1098,23 +1117,6 @@ function displayValue(value) {
1098
1117
  return value ? "yes" : "no";
1099
1118
  return String(value);
1100
1119
  }
1101
- function effectiveDisplay(entry, stored) {
1102
- const effective = entry.effectiveValue;
1103
- if (effective === stored)
1104
- return displayValue(stored);
1105
- const shownEffective = typeof effective === "string" || typeof effective === "number" || typeof effective === "boolean"
1106
- ? displayValue(effective)
1107
- : describeRaw(effective);
1108
- return `${displayValue(stored)} (effective ${shownEffective}; ${applicationLabel(entry.application)})`;
1109
- }
1110
- function applicationLabel(application) {
1111
- switch (application) {
1112
- case "live": return "live";
1113
- case "next-session": return "in the next session";
1114
- case "next-start": return "on the next start";
1115
- case "current-exit": return "when the current session exits";
1116
- }
1117
- }
1118
1120
  function describeRaw(value) {
1119
1121
  if (value === null || value === undefined)
1120
1122
  return "unset";
@@ -1,5 +1,5 @@
1
1
  import { writeFile } from "node:fs/promises";
2
- import { SUGGESTION_DECISION_REASONS, SUGGESTION_DIAGNOSTIC_EVENTS, } from "../../contracts/owned-ui/index.js";
2
+ import { SUGGESTION_ATTEMPT_TRIGGERS, SUGGESTION_DECISION_REASONS, SUGGESTION_DIAGNOSTIC_EVENTS, } from "../../contracts/owned-ui/index.js";
3
3
  /** Bounded metadata snapshots; one in-flight write and one replaceable latest snapshot. */
4
4
  export class SuggestionDiagnosticCapture {
5
5
  #records = [];
@@ -63,9 +63,12 @@ function sanitize(record) {
63
63
  const reasoning = ["ordinary", "off", "minimal", "low", "medium", "high", "xhigh", "max", "unavailable"].includes(record.reasoning)
64
64
  ? record.reasoning : "unavailable";
65
65
  const reason = record.reason !== undefined && SUGGESTION_DECISION_REASONS.includes(record.reason) ? record.reason : undefined;
66
+ const trigger = record.trigger !== undefined && SUGGESTION_ATTEMPT_TRIGGERS.includes(record.trigger) ? record.trigger : undefined;
67
+ const attempt = record.attempt === undefined ? undefined : boundedNumber(record.attempt);
66
68
  // Security: explicit projection prevents arbitrary extra fields, including raw error payloads, from escaping.
67
69
  return {
68
70
  event: record.event, ...(reason === undefined ? {} : { reason }),
71
+ ...(attempt === undefined ? {} : { attempt }), ...(trigger === undefined ? {} : { trigger }),
69
72
  session: boundedNumber(record.session), run: boundedNumber(record.run), response: boundedNumber(record.response),
70
73
  request: boundedNumber(record.request), provider: identifier(record.provider), model: identifier(record.model),
71
74
  reasoning, elapsedMs: boundedNumber(record.elapsedMs),
@@ -7,7 +7,7 @@ export { resolveCohortEndpoint, resolveProductPaths } from "./paths.js";
7
7
  export type { CohortEndpointPaths, ProductPaths } from "./paths.js";
8
8
  export { parseSessionSelection, sessionSelectionArguments } from "./session-selection.js";
9
9
  export type { SessionSelection } from "./session-selection.js";
10
- export { clearSessionRepositoryContext, readSessionRepositoryContext, setSessionRepositoryContext } from "./session-repository-context.js";
11
- export type { SessionRepositoryContext, SessionRepositoryContextOptions, SessionRepositoryIdentity } from "./session-repository-context.js";
10
+ export { activateSessionRepositoryContext, clearSessionRepositoryContext, listSessionRepositoryWorktrees, readSessionRepositoryContext, registerSessionRepositoryRuntime, releaseSessionRepositoryRuntime, setSessionRepositoryContext, } from "./session-repository-context.js";
11
+ export type { SessionRepositoryContext, SessionRepositoryContextOptions, SessionRepositoryIdentity, SessionWorktreeInventoryEntry, SessionWorktreeStatus, } from "./session-repository-context.js";
12
12
  export { createSupervisorStartupAttempt, publishSupervisorStartupResult, readSupervisorStartupResult, supervisorStartupFailure, supervisorStartupReady, supervisorStartupResultPath, } from "./supervisor-startup.js";
13
13
  export type { SupervisorStartupAttemptIdentity, SupervisorStartupResult } from "./supervisor-startup.js";
@@ -2,5 +2,5 @@ export { assertLaunchInstance, assertLaunchInstanceOutcome, assertLaunchInstance
2
2
  export { assertDimensions, assertLaunchProfileId, assertNativeProcessIdentity, assertTransparentTerminalLaunchProfile } from "./model.js";
3
3
  export { resolveCohortEndpoint, resolveProductPaths } from "./paths.js";
4
4
  export { parseSessionSelection, sessionSelectionArguments } from "./session-selection.js";
5
- export { clearSessionRepositoryContext, readSessionRepositoryContext, setSessionRepositoryContext } from "./session-repository-context.js";
5
+ export { activateSessionRepositoryContext, clearSessionRepositoryContext, listSessionRepositoryWorktrees, readSessionRepositoryContext, registerSessionRepositoryRuntime, releaseSessionRepositoryRuntime, setSessionRepositoryContext, } from "./session-repository-context.js";
6
6
  export { createSupervisorStartupAttempt, publishSupervisorStartupResult, readSupervisorStartupResult, supervisorStartupFailure, supervisorStartupReady, supervisorStartupResultPath, } from "./supervisor-startup.js";
@@ -1,3 +1,4 @@
1
+ import type { NativeProcessIdentity } from "./model.js";
1
2
  export interface SessionRepositoryIdentity {
2
3
  readonly sessionId: string;
3
4
  readonly sessionFile: string;
@@ -6,13 +7,29 @@ export interface SessionRepositoryContext {
6
7
  readonly cwd: string;
7
8
  readonly branch: string;
8
9
  }
10
+ export type SessionWorktreeStatus = "current" | "busy" | "available" | "unverifiable";
11
+ export interface SessionWorktreeInventoryEntry extends SessionRepositoryContext {
12
+ readonly status: SessionWorktreeStatus;
13
+ }
9
14
  export interface SessionRepositoryContextOptions {
10
15
  readonly dataDir?: string;
11
16
  readonly signal?: AbortSignal;
17
+ readonly runtimeId?: string;
18
+ readonly runtimeIdentity?: NativeProcessIdentity;
19
+ readonly inspectProcess?: (pid: number) => Promise<NativeProcessIdentity | null>;
20
+ readonly lockTimeoutMs?: number;
12
21
  }
13
- /** Persist one explicit same-repository worktree association for a stable Pi session. */
22
+ /** Publish the exact live runtime that may acquire a delivery worktree. */
23
+ export declare function registerSessionRepositoryRuntime(identity: SessionRepositoryIdentity, runtimeId: string, runtimeIdentity: NativeProcessIdentity, options?: SessionRepositoryContextOptions): Promise<void>;
24
+ /** Revalidate a durable association and acquire its live claim for this runtime. */
25
+ export declare function activateSessionRepositoryContext(identity: SessionRepositoryIdentity, runtimeId: string, runtimeIdentity: NativeProcessIdentity, options?: SessionRepositoryContextOptions): Promise<SessionRepositoryContext | null>;
26
+ /** Release only this exact runtime generation's cooperative editing claims. */
27
+ export declare function releaseSessionRepositoryRuntime(runtimeId: string, runtimeIdentity: NativeProcessIdentity, options?: SessionRepositoryContextOptions): Promise<void>;
28
+ /** Persist one explicit same-repository worktree association after atomically claiming it. */
14
29
  export declare function setSessionRepositoryContext(identity: SessionRepositoryIdentity, worktreePath: string, options?: SessionRepositoryContextOptions): Promise<SessionRepositoryContext>;
15
- /** Remove only the association belonging to the supplied stable session. */
30
+ /** Remove only the association and live claim belonging to the supplied stable session/runtime. */
16
31
  export declare function clearSessionRepositoryContext(identity: SessionRepositoryIdentity, options?: SessionRepositoryContextOptions): Promise<void>;
17
32
  /** Read and revalidate a persisted association; malformed or stale state fails closed to absence. */
18
33
  export declare function readSessionRepositoryContext(identity: SessionRepositoryIdentity, options?: SessionRepositoryContextOptions): Promise<SessionRepositoryContext | null>;
34
+ /** List same-repository worktrees without acquiring, releasing, or repairing a claim. */
35
+ export declare function listSessionRepositoryWorktrees(identity: SessionRepositoryIdentity, options?: SessionRepositoryContextOptions): Promise<readonly SessionWorktreeInventoryEntry[]>;