@timurproko/a1 0.2.7-dev.820 → 0.2.7-dev.828

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 (157) hide show
  1. package/README.md +7 -1
  2. package/bin/automatic-update.js +7 -0
  3. package/bin/tab-launch-context.d.ts +1 -0
  4. package/bin/tab-launch-context.js +3 -3
  5. package/bin/ui.js +96 -66
  6. package/dist/app/session-shell/session-shell-root.d.ts +13 -6
  7. package/dist/app/session-shell/session-shell-root.js +9 -5
  8. package/dist/app/session-shell/session-shell.js +68 -18
  9. package/dist/app/session-shell/shell-host.js +6 -3
  10. package/dist/app/session-shell/transcript-document.js +1 -1
  11. package/dist/cli/tabs.d.ts +1 -1
  12. package/dist/cli/tabs.js +10 -14
  13. package/dist/composition/owned-settings.d.ts +12 -0
  14. package/dist/composition/owned-settings.js +36 -0
  15. package/dist/composition/owned-ui.d.ts +5 -14
  16. package/dist/composition/owned-ui.js +93 -63
  17. package/dist/composition/resident-tab-bridge.d.ts +10 -1
  18. package/dist/composition/resident-tab-bridge.js +21 -0
  19. package/dist/composition/settings-route-host.d.ts +12 -2
  20. package/dist/composition/settings-route-host.js +27 -9
  21. package/dist/composition/settings-search-input.d.ts +9 -0
  22. package/dist/composition/settings-search-input.js +58 -0
  23. package/dist/composition/utility-tab.d.ts +28 -0
  24. package/dist/composition/utility-tab.js +242 -0
  25. package/dist/contracts/owned-ui/session-backend.d.ts +2 -0
  26. package/dist/contracts/owned-ui/session-workflows.d.ts +7 -3
  27. package/dist/contracts/presentation/index.d.ts +11 -0
  28. package/dist/contracts/presentation/index.js +12 -0
  29. package/dist/features/launch/development-launch.js +6 -0
  30. package/dist/features/launch/profile-paths.js +4 -0
  31. package/dist/features/owned-ui/plus-menu-dialog.d.ts +22 -0
  32. package/dist/features/owned-ui/plus-menu-dialog.js +76 -0
  33. package/dist/features/owned-ui/project-trust-dialog.d.ts +1 -1
  34. package/dist/features/owned-ui/project-trust-dialog.js +6 -8
  35. package/dist/features/owned-ui/project-trust-prompt.d.ts +1 -0
  36. package/dist/features/owned-ui/project-trust-prompt.js +7 -3
  37. package/dist/features/owned-ui/reference-screen-app.d.ts +2 -0
  38. package/dist/features/owned-ui/reference-screen-app.js +12 -2
  39. package/dist/features/owned-ui/settings-app.d.ts +10 -3
  40. package/dist/features/owned-ui/settings-app.js +98 -45
  41. package/dist/features/owned-ui/settings-search-input.d.ts +29 -0
  42. package/dist/features/owned-ui/settings-search-input.js +1 -0
  43. package/dist/features/prompt-history/index.d.ts +1 -1
  44. package/dist/features/prompt-history/paths.d.ts +2 -1
  45. package/dist/features/prompt-history/paths.js +10 -2
  46. package/dist/features/prompt-history/service.d.ts +5 -0
  47. package/dist/features/prompt-history/service.js +1 -1
  48. package/dist/features/resident-tab/shortcut-declarations.d.ts +1 -1
  49. package/dist/features/resident-tab/shortcut-declarations.js +2 -0
  50. package/dist/foundation/launch-context/index.d.ts +2 -0
  51. package/dist/foundation/launch-context/index.js +1 -0
  52. package/dist/foundation/lifecycle/session-repository-context.js +16 -2
  53. package/dist/foundation/release/automatic-update.d.ts +37 -0
  54. package/dist/foundation/release/automatic-update.js +265 -0
  55. package/dist/foundation/release/bootstrap.d.ts +1 -9
  56. package/dist/foundation/release/bootstrap.js +7 -3
  57. package/dist/foundation/release/early-accent.d.ts +12 -0
  58. package/dist/foundation/release/early-accent.js +59 -0
  59. package/dist/foundation/release/index.d.ts +1 -1
  60. package/dist/foundation/release/index.js +1 -1
  61. package/dist/foundation/release/latest-release.d.ts +3 -2
  62. package/dist/foundation/release/latest-release.js +1 -1
  63. package/dist/foundation/release/progress-palette.generated.d.ts +137 -3
  64. package/dist/foundation/release/progress-palette.generated.js +137 -3
  65. package/dist/foundation/release/release-gc.js +19 -4
  66. package/dist/foundation/release/update-execution-lease.d.ts +36 -0
  67. package/dist/foundation/release/update-execution-lease.js +145 -0
  68. package/dist/foundation/release/update.d.ts +9 -7
  69. package/dist/foundation/release/update.js +244 -175
  70. package/dist/foundation/resident-tabs/bridge-client.d.ts +9 -2
  71. package/dist/foundation/resident-tabs/bridge-client.js +19 -7
  72. package/dist/foundation/resident-tabs/maintenance.d.ts +2 -6
  73. package/dist/foundation/resident-tabs/maintenance.js +5 -23
  74. package/dist/foundation/resident-tabs/progress-observation-schema.d.ts +34 -0
  75. package/dist/foundation/resident-tabs/progress-observation-schema.js +1 -0
  76. package/dist/foundation/resident-tabs/progress-observation.d.ts +3 -6
  77. package/dist/foundation/resident-tabs/progress-observation.js +43 -12
  78. package/dist/foundation/resident-tabs/release-holds.js +3 -14
  79. package/dist/foundation/resident-tabs/routes.d.ts +5 -0
  80. package/dist/foundation/resident-tabs/routes.js +5 -0
  81. package/dist/integrations/pi/components/editor-interaction.d.ts +2 -0
  82. package/dist/integrations/pi/components/modal-frame.d.ts +17 -1
  83. package/dist/integrations/pi/components/modal-frame.js +48 -9
  84. package/dist/integrations/pi/components/models-dialog.js +4 -52
  85. package/dist/integrations/pi/components/owned-editor-ux.d.ts +3 -0
  86. package/dist/integrations/pi/components/owned-editor-ux.js +75 -4
  87. package/dist/integrations/pi/components/shell-editor-autocomplete.js +57 -37
  88. package/dist/integrations/pi/components/shell-footer-status.js +19 -3
  89. package/dist/integrations/pi/components/shell-presenters-transcript.js +4 -1
  90. package/dist/integrations/pi/components/shell-selectors-dialogs.js +4 -1
  91. package/dist/integrations/pi/components/shell-shared-facade.d.ts +9 -2
  92. package/dist/integrations/pi/components/skills-dialog.js +2 -2
  93. package/dist/integrations/pi/components/upstream/components/owned-editor.d.ts +7 -5
  94. package/dist/integrations/pi/components/upstream/components/owned-editor.js +15 -8
  95. package/dist/integrations/pi/components/upstream/components/scoped-models-selector.d.ts +3 -3
  96. package/dist/integrations/pi/components/upstream/components/scoped-models-selector.js +2 -2
  97. package/dist/integrations/pi/components/upstream/components/session-footer.js +26 -23
  98. package/dist/integrations/pi/components/upstream/components/session-selector.js +7 -6
  99. package/dist/integrations/pi/components/upstream/components/thinking-selector.d.ts +7 -6
  100. package/dist/integrations/pi/components/upstream/components/thinking-selector.js +9 -8
  101. package/dist/integrations/pi/components/upstream/components/tool-execution.js +6 -4
  102. package/dist/integrations/pi/components/upstream/components/tree-selector.d.ts +8 -8
  103. package/dist/integrations/pi/components/upstream/components/tree-selector.js +10 -10
  104. package/dist/integrations/pi/components/upstream/history/editor-core.js +2 -0
  105. package/dist/integrations/pi/components/upstream/theme/theme.d.ts +2 -0
  106. package/dist/integrations/pi/components/upstream/theme/theme.js +5 -1
  107. package/dist/integrations/pi/engine/adapter.js +7 -2
  108. package/dist/integrations/pi/engine/offline-settings-port.d.ts +23 -0
  109. package/dist/integrations/pi/engine/offline-settings-port.js +53 -0
  110. package/dist/integrations/pi/engine/ports.d.ts +1 -1
  111. package/dist/integrations/pi/engine/ports.js +4 -0
  112. package/dist/integrations/pi/engine/settings-bridge.d.ts +5 -0
  113. package/dist/integrations/pi/engine/settings-bridge.js +13 -0
  114. package/dist/integrations/pi/engine/settings-port.js +1 -14
  115. package/dist/integrations/pi/engine/workflow-runner.js +9 -2
  116. package/dist/native/darwin-arm64/manifest.json +1 -1
  117. package/dist/native/darwin-arm64/terminal-host.manifest.json +3 -3
  118. package/dist/native/darwin-arm64/terminal-host.node +0 -0
  119. package/dist/native/darwin-x64/manifest.json +1 -1
  120. package/dist/native/darwin-x64/terminal-host.manifest.json +3 -3
  121. package/dist/native/darwin-x64/terminal-host.node +0 -0
  122. package/dist/native/linux-x64/manifest.json +1 -1
  123. package/dist/native/linux-x64/terminal-host.manifest.json +3 -3
  124. package/dist/native/linux-x64/terminal-host.node +0 -0
  125. package/dist/native/win32-x64/manifest.json +2 -2
  126. package/dist/native/win32-x64/process-guardian.node +0 -0
  127. package/dist/native/win32-x64/terminal-host.manifest.json +3 -3
  128. package/dist/native/win32-x64/terminal-host.node +0 -0
  129. package/dist/product-identity.d.ts +1 -1
  130. package/dist/product-identity.js +2 -2
  131. package/dist/product-identity.json +2 -0
  132. package/dist/ui/apps/host.d.ts +2 -0
  133. package/dist/ui/apps/host.js +7 -1
  134. package/dist/ui/components/dialog-panel.js +35 -30
  135. package/dist/ui/components/line-input.d.ts +3 -0
  136. package/dist/ui/components/line-input.js +3 -1
  137. package/dist/ui/components/prompt-input.d.ts +3 -2
  138. package/dist/ui/components/prompt-input.js +6 -4
  139. package/dist/ui/components/spans.js +2 -2
  140. package/dist/ui/components/surface.js +4 -2
  141. package/dist/ui/components/text.d.ts +3 -6
  142. package/dist/ui/components/text.js +6 -8
  143. package/dist/ui/settings/declarations.d.ts +56 -10
  144. package/dist/ui/settings/declarations.js +38 -9
  145. package/dist/ui/settings/early-accent.d.ts +81 -0
  146. package/dist/ui/settings/early-accent.js +50 -0
  147. package/dist/ui/settings/manager.js +7 -3
  148. package/dist/ui/settings/migrations.js +15 -0
  149. package/dist/ui/settings/progress-palette.generated.d.ts +139 -0
  150. package/dist/ui/settings/progress-palette.generated.js +139 -0
  151. package/dist/ui/settings/sections.d.ts +4 -0
  152. package/dist/ui/settings/sections.js +9 -3
  153. package/docs/architecture/resident-tabs.md +48 -17
  154. package/docs/architecture/tool-image-presentation.md +2 -1
  155. package/docs/features/prompt-history.md +41 -20
  156. package/docs/validation.md +25 -5
  157. package/package.json +1 -1
@@ -8,17 +8,18 @@
8
8
  * levels, and rendering exclusive radio-style default markers before level names, an item-adjacent
9
9
  * active checkmark, and aligned muted descriptions. Bare A1 persists defaults immediately on Space,
10
10
  * closes through the implicit Ctrl+C-capable selection-cancel action, and uses the shared compact
11
- * semantic shortcut row with Type/search guidance without advertising that alias. All list and border
12
- * colors use the owned theme and its explicit color mode. Selected rows use the shared bare-A1 blue
13
- * selection surface only around the rendered item span, with the existing accent arrow, normal-text
14
- * level, and preserved current/default/description roles. The comparison profile retains the public
15
- * pinned component.
11
+ * semantic shortcut row with Type/search guidance and an accent search marker without advertising that
12
+ * alias. All list and border colors use the owned theme and its explicit color mode. Selected rows use
13
+ * the shared bare-A1 blue selection surface only around the rendered item span, with the existing
14
+ * accent arrow, normal-text level, and preserved current/default/description roles. The comparison
15
+ * profile retains the public pinned component.
16
16
  * Deviations: owned-modal-shortcut-hints, owned-level-cycle-shortcut, owned-thinking-selector-heading,
17
- * owned-thinking-selector-controls, owned-dialog-ctrl-c-cancel, owned-standard-dialog-selection.
17
+ * owned-thinking-selector-controls, owned-dialog-ctrl-c-cancel, owned-standard-dialog-selection,
18
+ * owned-dialog-search-marker.
18
19
  */
19
20
  import { Container, fuzzyFilter, getKeybindings, Input, SelectList, Spacer, Text, } from "@earendil-works/pi-tui";
20
21
  import { DynamicBorder } from "../../../startup-public.js";
21
- import { addPiModalHeader, adoptPiModalFrame } from "../../modal-frame.js";
22
+ import { addPiModalHeader, addPiModalSearchInput, adoptPiModalFrame } from "../../modal-frame.js";
22
23
  import { DIALOG_CLOSE_SHORTCUT_HINT, piTheme, renderPiModalListRow, renderPiModalShortcutHints } from "../../theme.js";
23
24
  const THINKING_SELECT_LIST_LAYOUT = {
24
25
  minPrimaryColumnWidth: 12,
@@ -88,7 +89,7 @@ export class OwnedThinkingSelectorComponent extends Container {
88
89
  this.addChild(new Spacer(1));
89
90
  this.searchInput = new Input();
90
91
  this.searchInput.onSubmit = () => this.selectList.handleInput("\r");
91
- this.addChild(this.searchInput);
92
+ addPiModalSearchInput(this, this.searchInput);
92
93
  this.addChild(new Spacer(1));
93
94
  const initialList = this.buildSelectList(this.allItems, currentLevel);
94
95
  this.selectList = initialList.list;
@@ -3,13 +3,15 @@
3
3
  * packages/coding-agent/src/modes/interactive/components/tool-execution.ts.
4
4
  * Modifications: Retain pinned shell/public renderers. Own image conversion; replace private APIs with
5
5
  * public/local equivalents. Use bare-A1 secondary-accent read ranges and concise collapse shortcut
6
- * hints. Restore the enclosing default-shell background after nested renderer resets. See
6
+ * hints. Restore the enclosing default-shell background after nested renderer resets. Omit
7
+ * non-actionable image fallback rows when the terminal has no image protocol. See
7
8
  * docs/architecture/tool-image-presentation.md.
8
9
  * Deviations: current-tool-image-conversion-ownership, read-range-secondary-accent,
9
- * concise-tool-expand-shortcut-hint, default-shell-background-reset-scoping.
10
+ * concise-tool-expand-shortcut-hint, default-shell-background-reset-scoping,
11
+ * unsupported-image-fallback-omission.
10
12
  */
11
13
  import { stripVTControlCharacters } from "node:util";
12
- import { Box, Container, getCapabilities, getImageDimensions, imageFallback, MouseRegion, Spacer, Text } from "@earendil-works/pi-tui";
14
+ import { Box, Container, getImageDimensions, imageFallback, MouseRegion, Spacer, Text } from "@earendil-works/pi-tui";
13
15
  import { createReadToolDefinition, createBashToolDefinition, createEditToolDefinition, createWriteToolDefinition, createGrepToolDefinition, createFindToolDefinition, createLsToolDefinition, keyHint, keyText, } from "../../../startup-public.js";
14
16
  import { renderPiModalShortcutHints } from "../../theme.js";
15
17
  import { isPiAccentProjectionEnabled, piTheme } from "../theme/theme.js";
@@ -379,7 +381,7 @@ export class ToolExecutionComponent extends Container {
379
381
  if (!this.result)
380
382
  return "";
381
383
  const text = this.result.content.filter(part => part.type === "text").map(part => stripVTControlCharacters(part.text ?? "").replace(/[\u0000-\u0008\u000b-\u001f\ufff9-\ufffb]/gu, "")).join("\n");
382
- if (getCapabilities().images && this.showImages)
384
+ if (this.showImages)
383
385
  return text;
384
386
  const indicators = this.result.content.filter(part => part.type === "image").map(part => imageFallback(part.mimeType ?? "image/unknown", part.data && part.mimeType ? getImageDimensions(part.data, part.mimeType) ?? undefined : undefined)).join("\n");
385
387
  return text && indicators ? `${text}\n${indicators}` : text || indicators;
@@ -4,15 +4,15 @@
4
4
  * Modifications: Port remaps public types/components plus owned keybindings/theme helpers while
5
5
  * preserving tree behavior; bare A1 uses compact modal chrome and label editing, four-mode
6
6
  * Models-style filter status with Tab/Shift+Tab directional cycling and concise all-first presentation
7
- * excluding internal bookkeeping, standard search input, blue full-row menu-arrow selection that
8
- * preserves per-entry semantic foregrounds and has no path bullets, accent entry labels, bracketed
9
- * timestamps, numeric result counters without duplicate label-time status, and a stateful time on/off
10
- * shortcut, semantic role colors with session naming for the system root, standard
11
- * paging/first-last/non-root containing-branch folding keys with a permanently expanded system session
12
- * entry even behind hidden metadata, single-character ellipses on both clipped edges with
13
- * bracket-delimiter preservation and selected-fragment highlighting, and Models-ordered semantic
7
+ * excluding internal bookkeeping, a standard accent-marked search input, blue full-row menu-arrow
8
+ * selection that preserves per-entry semantic foregrounds and has no path bullets, accent entry
9
+ * labels, bracketed timestamps, numeric result counters without duplicate label-time status, and a
10
+ * stateful time on/off shortcut, semantic role colors with session naming for the system root,
11
+ * standard paging/first-last/non-root containing-branch folding keys with a permanently expanded
12
+ * system session entry even behind hidden metadata, single-character ellipses on both clipped edges
13
+ * with bracket-delimiter preservation and selected-fragment highlighting, and Models-ordered semantic
14
14
  * Type/search shortcut footers without a redundant select hint.
15
- * Deviations: owned-modal-shortcut-hints, owned-session-tree-dialog.
15
+ * Deviations: owned-modal-shortcut-hints, owned-session-tree-dialog, owned-dialog-search-marker.
16
16
  */
17
17
  import { type Component, Container, type Focusable } from "@earendil-works/pi-tui";
18
18
  import { type SessionTreeNode } from "@earendil-works/pi-coding-agent";
@@ -4,20 +4,20 @@
4
4
  * Modifications: Port remaps public types/components plus owned keybindings/theme helpers while
5
5
  * preserving tree behavior; bare A1 uses compact modal chrome and label editing, four-mode
6
6
  * Models-style filter status with Tab/Shift+Tab directional cycling and concise all-first presentation
7
- * excluding internal bookkeeping, standard search input, blue full-row menu-arrow selection that
8
- * preserves per-entry semantic foregrounds and has no path bullets, accent entry labels, bracketed
9
- * timestamps, numeric result counters without duplicate label-time status, and a stateful time on/off
10
- * shortcut, semantic role colors with session naming for the system root, standard
11
- * paging/first-last/non-root containing-branch folding keys with a permanently expanded system session
12
- * entry even behind hidden metadata, single-character ellipses on both clipped edges with
13
- * bracket-delimiter preservation and selected-fragment highlighting, and Models-ordered semantic
7
+ * excluding internal bookkeeping, a standard accent-marked search input, blue full-row menu-arrow
8
+ * selection that preserves per-entry semantic foregrounds and has no path bullets, accent entry
9
+ * labels, bracketed timestamps, numeric result counters without duplicate label-time status, and a
10
+ * stateful time on/off shortcut, semantic role colors with session naming for the system root,
11
+ * standard paging/first-last/non-root containing-branch folding keys with a permanently expanded
12
+ * system session entry even behind hidden metadata, single-character ellipses on both clipped edges
13
+ * with bracket-delimiter preservation and selected-fragment highlighting, and Models-ordered semantic
14
14
  * Type/search shortcut footers without a redundant select hint.
15
- * Deviations: owned-modal-shortcut-hints, owned-session-tree-dialog.
15
+ * Deviations: owned-modal-shortcut-hints, owned-session-tree-dialog, owned-dialog-search-marker.
16
16
  */
17
17
  import { Container, Input, matchesKey, Spacer, sliceByColumn, Text, truncateToWidth, visibleWidth, wrapTextWithAnsi, } from "@earendil-works/pi-tui";
18
18
  import { DynamicBorder, formatReadLineRange } from "../../../startup-public.js";
19
19
  import { KeybindingsManager } from "../adjacent/core/keybindings.js";
20
- import { addPiModalHeader, adoptPiModalFrame } from "../../modal-frame.js";
20
+ import { addPiModalHeader, adoptPiModalFrame, renderPiModalSearchInput } from "../../modal-frame.js";
21
21
  import { DIALOG_CLOSE_SHORTCUT_HINT, paintPiBorder, piTheme, renderPiModalShortcutHints } from "../../theme.js";
22
22
  const theme = new Proxy({}, {
23
23
  get(_target, property) {
@@ -1077,7 +1077,7 @@ class TreeSearchInput {
1077
1077
  this.input.handleInput(query);
1078
1078
  this.renderedQuery = query;
1079
1079
  }
1080
- return this.input.render(width);
1080
+ return renderPiModalSearchInput(this.input, width);
1081
1081
  }
1082
1082
  }
1083
1083
  /** Models-style summary of the active tree filter. */
@@ -287,6 +287,8 @@ export class HistoryEditorCore {
287
287
  delete this.onHistoryChange; };
288
288
  },
289
289
  reset: () => this.resetHistoryBrowsing(),
290
+ restoreDraft: () => { while (this.historyIndex >= 0)
291
+ this.navigateHistory(1); },
290
292
  };
291
293
  persistentHistory = false;
292
294
  styleHistoryLabel;
@@ -43,6 +43,8 @@ export interface PiAccentProjection {
43
43
  readonly selectedBg: Color;
44
44
  readonly userMessageBg: Color;
45
45
  }
46
+ /** Canonical named color used by both the interactive theme and pre-load palette generation. */
47
+ export declare function namedPiAccent(color: UiAccentColor, appearance: PiTerminalTheme): Color;
46
48
  /** Derive the complete semantic family from any primary accent, including future custom colors. */
47
49
  export declare function derivePiAccentProjection(accent: Color, appearance: PiTerminalTheme): PiAccentProjection;
48
50
  declare let packageBorderProjectionEnabled: boolean;
@@ -46,6 +46,10 @@ const ACCENT_PALETTE = Object.freeze({
46
46
  orange: Object.freeze({ dark: okhslColor(48, 0.75, 0.67), light: okhslColor(48, 0.90, 0.47) }),
47
47
  pink: Object.freeze({ dark: okhslColor(337, 0.72, 0.67), light: okhslColor(337, 0.75, 0.48) }),
48
48
  });
49
+ /** Canonical named color used by both the interactive theme and pre-load palette generation. */
50
+ export function namedPiAccent(color, appearance) {
51
+ return ACCENT_PALETTE[color][appearance];
52
+ }
49
53
  function clamp(value, minimum, maximum) {
50
54
  return Math.max(minimum, Math.min(maximum, value));
51
55
  }
@@ -75,7 +79,7 @@ let activeBaseTheme;
75
79
  let activeTheme;
76
80
  let activeThemeName;
77
81
  let activeThemeMode;
78
- let activeAccentColor = "purple";
82
+ let activeAccentColor = "blue";
79
83
  let packageBorderProjectionEnabled = true;
80
84
  let themeWatcher;
81
85
  let themeReloadTimer;
@@ -211,8 +211,13 @@ export class PiEngineAdapter {
211
211
  #announceReleaseUpdate(release) {
212
212
  if (this.#disposed)
213
213
  return;
214
- const changelog = release.changelogUrl === null ? "" : `\nChangelog: ${release.changelogUrl}`;
215
- this.#addDiagnostic("info", "release-update", `New version ${release.version} is available. Run ${release.command}${changelog}`, true);
214
+ if (release.status === "installed") {
215
+ this.#addDiagnostic("info", "release-update-installed", `Update ${release.version} installed; restart to update.`, true);
216
+ }
217
+ else {
218
+ const changelog = release.changelogUrl === null ? "" : `\nChangelog: ${release.changelogUrl}`;
219
+ this.#addDiagnostic("info", "release-update", `New version ${release.version} is available. Run ${release.command}${changelog}`, true);
220
+ }
216
221
  this.#emitView();
217
222
  }
218
223
  suggestionReasoningPolicy() {
@@ -0,0 +1,23 @@
1
+ import { resolvePiProjectTrustPreflight } from "./project-trust-preflight.js";
2
+ import { PiSettingsBridge, type PiSettingKey } from "./settings-bridge.js";
3
+ import { ModelRuntime, SettingsManager } from "../startup-public.js";
4
+ export interface OfflinePiSettingsPortOptions {
5
+ readonly cwd: string;
6
+ readonly agentDir: string;
7
+ readonly resolveTrust?: typeof resolvePiProjectTrustPreflight;
8
+ readonly createSettingsManager?: (cwd: string, agentDir: string, projectTrusted: boolean) => SettingsManager;
9
+ readonly createModelRuntime?: (options: Parameters<typeof ModelRuntime.create>[0]) => Promise<Pick<ModelRuntime, "getAvailableSnapshot">>;
10
+ }
11
+ export interface OfflinePiSettingsPort {
12
+ readonly port: PiSettingsBridge;
13
+ readonly manager: SettingsManager;
14
+ /** Resolves after the local auth/model catalog has populated the per-model choices. */
15
+ readonly modelsReady: Promise<void>;
16
+ }
17
+ /**
18
+ * Pi settings for the resident Settings utility tab. It reads the same persisted manager as an
19
+ * Agent, but every bound live effect is persistence-only because each Agent process owns its effect.
20
+ */
21
+ export declare function createOfflinePiSettingsPort(options: OfflinePiSettingsPortOptions): Promise<OfflinePiSettingsPort>;
22
+ /** Keys the slim Settings port intentionally binds and exposes in bare mode. */
23
+ export declare function offlinePiSettingKeys(): readonly PiSettingKey[];
@@ -0,0 +1,53 @@
1
+ import { join } from "node:path";
2
+ import { resolvePiProjectTrustPreflight } from "./project-trust-preflight.js";
3
+ import { PI_SETTING_EFFECTS, PiSettingsBridge, supportedThinkingLevels, } from "./settings-bridge.js";
4
+ import { ModelRuntime, SettingsManager } from "../startup-public.js";
5
+ const PERSIST_ONLY_OWNERS = ["shell", "startup", "agent", "terminal"];
6
+ /**
7
+ * Pi settings for the resident Settings utility tab. It reads the same persisted manager as an
8
+ * Agent, but every bound live effect is persistence-only because each Agent process owns its effect.
9
+ */
10
+ export async function createOfflinePiSettingsPort(options) {
11
+ let modelRuntime = null;
12
+ const createModelRuntime = options.createModelRuntime ?? (input => ModelRuntime.create(input));
13
+ const modelsReady = createModelRuntime({
14
+ authPath: join(options.agentDir, "auth.json"),
15
+ modelsPath: join(options.agentDir, "models.json"),
16
+ allowModelNetwork: false,
17
+ }).then(runtime => { modelRuntime = runtime; }, () => undefined);
18
+ const trust = await (options.resolveTrust ?? resolvePiProjectTrustPreflight)({
19
+ cwd: options.cwd,
20
+ agentDir: options.agentDir,
21
+ });
22
+ const manager = (options.createSettingsManager
23
+ ?? ((cwd, agentDir, projectTrusted) => SettingsManager.create(cwd, agentDir, { projectTrusted })))(options.cwd, options.agentDir, trust.trusted);
24
+ const port = new PiSettingsBridge(manager, {
25
+ productMode: "bare",
26
+ models: () => modelChoices(modelRuntime?.getAvailableSnapshot() ?? [], manager.getAllModelThinkingLevels?.() ?? {}),
27
+ });
28
+ for (const owner of PERSIST_ONLY_OWNERS)
29
+ port.bindOwner(owner, persistOnlyHandlers(owner));
30
+ return { port, manager, modelsReady };
31
+ }
32
+ function persistOnlyHandlers(owner) {
33
+ return Object.fromEntries(Object.entries(PI_SETTING_EFFECTS)
34
+ .filter(([, definition]) => definition.owner === owner && definition.hiddenInBare !== true)
35
+ .map(([key]) => [key, { apply() { } }]));
36
+ }
37
+ function modelChoices(models, overrides) {
38
+ return models.map(model => {
39
+ const key = `${model.provider}/${model.id}`;
40
+ return {
41
+ key,
42
+ label: `${model.id} [${model.provider}]`,
43
+ description: overrides[key] === undefined ? "global default" : `override: ${overrides[key]}`,
44
+ levels: supportedThinkingLevels(model),
45
+ };
46
+ });
47
+ }
48
+ /** Keys the slim Settings port intentionally binds and exposes in bare mode. */
49
+ export function offlinePiSettingKeys() {
50
+ return Object.entries(PI_SETTING_EFFECTS)
51
+ .filter(([, definition]) => PERSIST_ONLY_OWNERS.includes(definition.owner) && definition.hiddenInBare !== true)
52
+ .map(([key]) => key);
53
+ }
@@ -37,7 +37,7 @@ export interface PiEngineAdapterPorts {
37
37
  export interface EnginePortParts {
38
38
  readonly sessionId: string;
39
39
  readonly agentDir: string;
40
- readonly engine: Pick<PiEngineRuntime, "cwd" | "generation" | "bindingGeneration" | "currentSessionResumeMetadata" | "currentSessionFile">;
40
+ readonly engine: Pick<PiEngineRuntime, "cwd" | "generation" | "bindingGeneration" | "currentSessionResumeMetadata" | "currentSessionFile" | "session">;
41
41
  readonly contexts: PiWorkflowContexts;
42
42
  readonly workflows: PiWorkflowRunner;
43
43
  readonly settings: PiEngineSettings;
@@ -11,6 +11,10 @@ export function createEnginePorts(parts) {
11
11
  get disposed() { return parts.disposed(); },
12
12
  currentSessionResumeMetadata: () => engine.currentSessionResumeMetadata(),
13
13
  currentSessionFile: () => engine.currentSessionFile(),
14
+ currentHistorySessionId: () => {
15
+ const id = engine.session?.sessionManager?.getSessionId?.();
16
+ return typeof id === "string" && id.length > 0 && id.length <= 256 && !id.includes("\0") ? id : null;
17
+ },
14
18
  },
15
19
  session: parts.session,
16
20
  workflows: {
@@ -80,6 +80,11 @@ export interface PiSettingsModelChoice {
80
80
  readonly description: string;
81
81
  readonly levels: readonly string[];
82
82
  }
83
+ /** The engine's rule: no reasoning means "off" only; xhigh and max exist only where the model maps them. */
84
+ export declare function supportedThinkingLevels(model: {
85
+ readonly reasoning?: boolean;
86
+ readonly thinkingLevelMap?: Readonly<Record<string, unknown>>;
87
+ }): readonly string[];
83
88
  /** The choice that clears a per-model override; the engine then applies its global default. */
84
89
  export declare const MODEL_THINKING_DEFAULT = "default";
85
90
  export declare const AUTOMATIC_THEME = "automatic";
@@ -252,6 +252,19 @@ function outcome(status, application, storedValue, effectiveValue, failure, limi
252
252
  function describe(error) {
253
253
  return error instanceof Error ? error.message : String(error);
254
254
  }
255
+ /** The engine's rule: no reasoning means "off" only; xhigh and max exist only where the model maps them. */
256
+ export function supportedThinkingLevels(model) {
257
+ if (!model.reasoning)
258
+ return ["off"];
259
+ return ["off", "minimal", "low", "medium", "high", "xhigh", "max"].filter(level => {
260
+ const mapped = model.thinkingLevelMap?.[level];
261
+ if (mapped === null)
262
+ return false;
263
+ if (level === "xhigh" || level === "max")
264
+ return mapped !== undefined;
265
+ return true;
266
+ });
267
+ }
255
268
  /** The choice that clears a per-model override; the engine then applies its global default. */
256
269
  export const MODEL_THINKING_DEFAULT = "default";
257
270
  export const AUTOMATIC_THEME = "automatic";
@@ -1,6 +1,6 @@
1
1
  import { isRecord, readThinkingLevel, stringProperty } from "./message-values.js";
2
2
  import { collectionResult } from "./resource-catalog.js";
3
- import { MODEL_THINKING_DEFAULT, PiSettingsBridge } from "./settings-bridge.js";
3
+ import { MODEL_THINKING_DEFAULT, PiSettingsBridge, supportedThinkingLevels } from "./settings-bridge.js";
4
4
  import { workflowResult } from "./workflow-support.js";
5
5
  import { PINNED_PI_SETTINGS_CALLBACKS } from "./workflows.js";
6
6
  /**
@@ -361,19 +361,6 @@ function agentJsonValue(value) {
361
361
  function isThinkingLevel(value) {
362
362
  return typeof value === "string" && ["off", "minimal", "low", "medium", "high", "xhigh", "max"].includes(value);
363
363
  }
364
- /** The engine's own rule: no reasoning means "off" only; xhigh and max exist only where the model maps them. */
365
- function supportedThinkingLevels(model) {
366
- if (!model.reasoning)
367
- return ["off"];
368
- return ["off", "minimal", "low", "medium", "high", "xhigh", "max"].filter(level => {
369
- const mapped = model.thinkingLevelMap?.[level];
370
- if (mapped === null)
371
- return false;
372
- if (level === "xhigh" || level === "max")
373
- return mapped !== undefined;
374
- return true;
375
- });
376
- }
377
364
  function settingLabel(callback) {
378
365
  return callback
379
366
  .replace(/^on/, "")
@@ -456,8 +456,8 @@ export class PiWorkflowRunner {
456
456
  : workflowResult(request.command, "failed", "Usage: /name <name>", undefined, "warning");
457
457
  }
458
458
  requireCapability(session.setSessionName, "setSessionName").call(session, argument);
459
- const normalized = manager?.getSessionName();
460
- const actual = typeof normalized === "string" ? normalized : argument;
459
+ this.#ports.emitView();
460
+ const actual = sessionNameOr(manager?.getSessionName(), argument);
461
461
  return workflowResult(request.command, "completed", `Session name set: ${actual}`, actual === argument ? undefined : `Session name was normalized from ${JSON.stringify(argument)} to ${JSON.stringify(actual)}`);
462
462
  }
463
463
  case "session": {
@@ -597,3 +597,10 @@ export class PiWorkflowRunner {
597
597
  }
598
598
  }
599
599
  }
600
+ /**
601
+ * The name the session normalized the request to, or the request when it reports none. `/name`
602
+ * publishes a view right after setting it, so a resident tab takes the name as its tab name.
603
+ */
604
+ function sessionNameOr(normalized, requested) {
605
+ return typeof normalized === "string" ? normalized : requested;
606
+ }
@@ -7,7 +7,7 @@
7
7
  "platform": "darwin",
8
8
  "architecture": "arm64",
9
9
  "capability": "supported",
10
- "builtAt": "2026-10-24T04:45:15.222Z",
10
+ "builtAt": "2026-10-27T13:50:09.001Z",
11
11
  "artifact": {
12
12
  "filename": "process-guardian.node",
13
13
  "sha256": "a87eaaffcd986b624c8b044b756446cc1bdaf4334a1775b97820542fe34f9fb7",
@@ -9,11 +9,11 @@
9
9
  "architecture": "arm64",
10
10
  "target": "aarch64-apple-darwin",
11
11
  "capability": "supported",
12
- "builtAt": "2026-10-24T04:48:05.486Z",
12
+ "builtAt": "2026-10-27T13:53:57.855Z",
13
13
  "artifact": {
14
14
  "filename": "terminal-host.node",
15
- "sha256": "f7f580d5ded5e1efa26ae790488efc8284edd15fee620aed091564c0fc460d16",
16
- "size": 5812800
15
+ "sha256": "2e31d2b83999aec568d7b892e71b5590034d8322c574d773f347c494fc8fe2b8",
16
+ "size": 6001616
17
17
  },
18
18
  "entry": {
19
19
  "filename": "dist/foundation/resident-tabs/host-entry.js",
@@ -7,7 +7,7 @@
7
7
  "platform": "darwin",
8
8
  "architecture": "x64",
9
9
  "capability": "supported",
10
- "builtAt": "2026-10-24T04:45:23.346Z",
10
+ "builtAt": "2026-10-27T13:50:17.798Z",
11
11
  "artifact": {
12
12
  "filename": "process-guardian.node",
13
13
  "sha256": "783a65f0de287a1c02cd5429dbe97bc8633f4cc8a7b92e3e961180b9bdcff814",
@@ -9,11 +9,11 @@
9
9
  "architecture": "x64",
10
10
  "target": "x86_64-apple-darwin",
11
11
  "capability": "supported",
12
- "builtAt": "2026-10-24T04:50:05.116Z",
12
+ "builtAt": "2026-10-27T13:56:22.634Z",
13
13
  "artifact": {
14
14
  "filename": "terminal-host.node",
15
- "sha256": "f7f2a1c09ebf4dbd5d28de747497564cb252d253ab7a9009b7aae1fe26bba4ff",
16
- "size": 6340520
15
+ "sha256": "84ec54e9cc77f0f2b75f52e3618a5c2d02bbecdfa417d52ee1dc99243ea1fe5d",
16
+ "size": 6548664
17
17
  },
18
18
  "entry": {
19
19
  "filename": "dist/foundation/resident-tabs/host-entry.js",
@@ -7,7 +7,7 @@
7
7
  "platform": "linux",
8
8
  "architecture": "x64",
9
9
  "capability": "supported",
10
- "builtAt": "2026-10-24T04:45:06.148Z",
10
+ "builtAt": "2026-10-27T13:50:03.363Z",
11
11
  "artifact": {
12
12
  "filename": "process-guardian.node",
13
13
  "sha256": "118e5954e3864672bd8482ab7edf419cb27dcdf2533720316979b7f5cc5a53a5",
@@ -9,11 +9,11 @@
9
9
  "architecture": "x64",
10
10
  "target": "x86_64-unknown-linux-gnu",
11
11
  "capability": "supported",
12
- "builtAt": "2026-10-24T04:48:17.317Z",
12
+ "builtAt": "2026-10-27T13:53:30.629Z",
13
13
  "artifact": {
14
14
  "filename": "terminal-host.node",
15
- "sha256": "3c2ed1d62404436ebe39000e93c5428dd9acff3f3158004b94af8a95e778e32a",
16
- "size": 7069736
15
+ "sha256": "e0b59bb80d065f8c345ec0371bf90c8da2364f42082857d604491f83811574e6",
16
+ "size": 7292480
17
17
  },
18
18
  "entry": {
19
19
  "filename": "dist/foundation/resident-tabs/host-entry.js",
@@ -7,10 +7,10 @@
7
7
  "platform": "win32",
8
8
  "architecture": "x64",
9
9
  "capability": "supported",
10
- "builtAt": "2026-10-24T04:45:48.535Z",
10
+ "builtAt": "2026-10-27T13:50:41.076Z",
11
11
  "artifact": {
12
12
  "filename": "process-guardian.node",
13
- "sha256": "12f5a962bc427e82345170f1c4db2a875683d5cbb4e818bcc1a314a11c71bf31",
13
+ "sha256": "f6400de0c563ee49f8e7ad05d91f6ad3d016434e75963e1c427ff4e15cb2bffe",
14
14
  "size": 402432
15
15
  },
16
16
  "provenance": {
@@ -9,11 +9,11 @@
9
9
  "architecture": "x64",
10
10
  "target": "x86_64-pc-windows-msvc",
11
11
  "capability": "supported",
12
- "builtAt": "2026-10-24T04:48:40.147Z",
12
+ "builtAt": "2026-10-27T13:54:43.955Z",
13
13
  "artifact": {
14
14
  "filename": "terminal-host.node",
15
- "sha256": "9beb6edeb62b28ff7e55d419d724c98f8645a73977d85fbb2c1bd85b7b324916",
16
- "size": 6138880
15
+ "sha256": "d9aacaeaebb031a6647e07f9c99dcd414c95aa1aa8d50d10cc3541ad12a2e5a6",
16
+ "size": 6375936
17
17
  },
18
18
  "entry": {
19
19
  "filename": "dist/foundation/resident-tabs/host-entry.js",
@@ -1,4 +1,4 @@
1
- declare const ENVIRONMENT_KEYS: readonly ["clipboardDiagnostics", "configDir", "dataDir", "databasePath", "developmentInstanceId", "developmentRoot", "endpoint", "exitNoticePath", "paneId", "probeTrace", "processGuardianPath", "prFooterPreview", "profileHome", "residentFixtureControlDir", "residentProgressObservationDir", "residentProgressRunId", "residentProgressTabId", "residentProgressTabIncarnation", "runtimeDir", "sessionRuntimeId", "skipVersionCheck", "startupTrace", "suggestionDiagnostics", "tabEndpoint", "tabId", "tabToken", "tabsEndpoint", "terminalHostPath", "terminalSessionId"];
1
+ declare const ENVIRONMENT_KEYS: readonly ["clipboardDiagnostics", "configDir", "dataDir", "databasePath", "developmentHistoryDataDir", "developmentInstanceId", "developmentRoot", "endpoint", "exitNoticePath", "paneId", "probeTrace", "processGuardianPath", "prFooterPreview", "profileHome", "residentFixtureControlDir", "residentProgressObservationDir", "residentProgressRunId", "residentProgressTabId", "residentProgressTabIncarnation", "runtimeDir", "sessionRuntimeId", "skipVersionCheck", "startupTrace", "suggestionDiagnostics", "tabEndpoint", "tabId", "tabReleaseId", "tabToken", "tabsEndpoint", "terminalHostPath", "terminalSessionId"];
2
2
  declare const FILESYSTEM_KEYS: readonly ["slug", "windowsDirectory", "unixDirectory", "temporaryPrefix"];
3
3
  declare const STATE_KEYS: readonly ["windowsControlDirectory", "unixControlDirectory", "developmentDirectory", "piAgentProfile", "piVanillaProfile", "sessionRepositoryDirectory", "sessionWorktreeClaimDirectory"];
4
4
  declare const ENDPOINT_KEYS: readonly ["windowsPipeStem", "unixSocketFilename", "metadataFilename", "supervisorLogFilename", "databaseFilename"];
@@ -1,7 +1,7 @@
1
1
  import rawIdentity from "./product-identity.json" with { type: "json" };
2
2
  const ENVIRONMENT_KEYS = [
3
- "clipboardDiagnostics", "configDir", "dataDir", "databasePath", "developmentInstanceId", "developmentRoot", "endpoint", "exitNoticePath",
4
- "paneId", "probeTrace", "processGuardianPath", "prFooterPreview", "profileHome", "residentFixtureControlDir", "residentProgressObservationDir", "residentProgressRunId", "residentProgressTabId", "residentProgressTabIncarnation", "runtimeDir", "sessionRuntimeId", "skipVersionCheck", "startupTrace", "suggestionDiagnostics", "tabEndpoint", "tabId", "tabToken", "tabsEndpoint", "terminalHostPath", "terminalSessionId",
3
+ "clipboardDiagnostics", "configDir", "dataDir", "databasePath", "developmentHistoryDataDir", "developmentInstanceId", "developmentRoot", "endpoint", "exitNoticePath",
4
+ "paneId", "probeTrace", "processGuardianPath", "prFooterPreview", "profileHome", "residentFixtureControlDir", "residentProgressObservationDir", "residentProgressRunId", "residentProgressTabId", "residentProgressTabIncarnation", "runtimeDir", "sessionRuntimeId", "skipVersionCheck", "startupTrace", "suggestionDiagnostics", "tabEndpoint", "tabId", "tabReleaseId", "tabToken", "tabsEndpoint", "terminalHostPath", "terminalSessionId",
5
5
  ];
6
6
  const FILESYSTEM_KEYS = ["slug", "windowsDirectory", "unixDirectory", "temporaryPrefix"];
7
7
  const STATE_KEYS = ["windowsControlDirectory", "unixControlDirectory", "developmentDirectory", "piAgentProfile", "piVanillaProfile", "sessionRepositoryDirectory", "sessionWorktreeClaimDirectory"];
@@ -14,6 +14,7 @@
14
14
  "configDir": "A1_CONFIG_DIR",
15
15
  "dataDir": "A1_DATA_DIR",
16
16
  "databasePath": "A1_DATABASE_PATH",
17
+ "developmentHistoryDataDir": "A1_DEV_HISTORY_DATA_DIR",
17
18
  "developmentInstanceId": "A1_DEV_INSTANCE_ID",
18
19
  "developmentRoot": "A1_DEV_ROOT",
19
20
  "endpoint": "A1_ENDPOINT",
@@ -35,6 +36,7 @@
35
36
  "suggestionDiagnostics": "A1_SUGGESTION_DIAGNOSTICS",
36
37
  "tabEndpoint": "A1_TAB_ENDPOINT",
37
38
  "tabId": "A1_TAB_ID",
39
+ "tabReleaseId": "A1_TAB_RELEASE_ID",
38
40
  "tabToken": "A1_TAB_TOKEN",
39
41
  "tabsEndpoint": "A1_TABS_ENDPOINT",
40
42
  "terminalHostPath": "A1_TERMINAL_HOST_PATH",
@@ -20,6 +20,8 @@ export interface AppHostOptions {
20
20
  readonly closeOnInterrupt: boolean;
21
21
  /** Colours handed to every presented app. Absent renders plain text. */
22
22
  readonly theme?: UiTheme;
23
+ /** Lets a focused app claim the first interrupt for an editor selection before host close/exit policy. */
24
+ readonly appInputBeforeInterrupt?: boolean;
23
25
  }
24
26
  /**
25
27
  * Presents at most one app. An opted-in interrupt closes at the host boundary;
@@ -15,6 +15,7 @@ export class UiAppHost {
15
15
  #surface;
16
16
  #closeOnInterrupt;
17
17
  #theme;
18
+ #appInputBeforeInterrupt;
18
19
  // Invariant: the first interrupt timestamp is null whenever the chord is disarmed.
19
20
  #interruptArmedAt = null;
20
21
  #renderedInterruptArmed;
@@ -25,6 +26,7 @@ export class UiAppHost {
25
26
  this.#surface = options.surface;
26
27
  this.#closeOnInterrupt = options.closeOnInterrupt;
27
28
  this.#theme = options.theme;
29
+ this.#appInputBeforeInterrupt = options.appInputBeforeInterrupt === true;
28
30
  }
29
31
  get presented() {
30
32
  return this.#app;
@@ -71,7 +73,7 @@ export class UiAppHost {
71
73
  const app = this.#app;
72
74
  if (app === null)
73
75
  return { consumed: false };
74
- if (data === INTERRUPT && this.#closeOnInterrupt) {
76
+ if (data === INTERRUPT && this.#closeOnInterrupt && !this.#appInputBeforeInterrupt) {
75
77
  this.close();
76
78
  return { consumed: true, render: true };
77
79
  }
@@ -83,6 +85,10 @@ export class UiAppHost {
83
85
  this.render();
84
86
  return result;
85
87
  }
88
+ if (data === INTERRUPT && this.#closeOnInterrupt) {
89
+ this.close();
90
+ return { consumed: true, render: true };
91
+ }
86
92
  if (data === INTERRUPT)
87
93
  return this.#interrupt();
88
94
  return { consumed: false };