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

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 (124) hide show
  1. package/README.md +7 -1
  2. package/bin/automatic-update.js +7 -0
  3. package/bin/ui.js +1 -0
  4. package/dist/app/session-shell/session-shell-root.d.ts +8 -1
  5. package/dist/app/session-shell/session-shell.js +68 -18
  6. package/dist/app/session-shell/shell-host.js +6 -3
  7. package/dist/app/session-shell/transcript-document.js +1 -1
  8. package/dist/composition/owned-ui.d.ts +3 -11
  9. package/dist/composition/owned-ui.js +93 -42
  10. package/dist/composition/resident-tab-bridge.d.ts +10 -1
  11. package/dist/composition/resident-tab-bridge.js +21 -0
  12. package/dist/composition/settings-route-host.d.ts +12 -2
  13. package/dist/composition/settings-route-host.js +27 -9
  14. package/dist/composition/settings-search-input.d.ts +9 -0
  15. package/dist/composition/settings-search-input.js +58 -0
  16. package/dist/contracts/owned-ui/session-backend.d.ts +2 -0
  17. package/dist/contracts/owned-ui/session-workflows.d.ts +7 -3
  18. package/dist/contracts/presentation/index.d.ts +11 -0
  19. package/dist/contracts/presentation/index.js +12 -0
  20. package/dist/features/launch/development-launch.js +6 -0
  21. package/dist/features/launch/profile-paths.js +4 -0
  22. package/dist/features/owned-ui/plus-menu-dialog.d.ts +22 -0
  23. package/dist/features/owned-ui/plus-menu-dialog.js +76 -0
  24. package/dist/features/owned-ui/reference-screen-app.d.ts +2 -0
  25. package/dist/features/owned-ui/reference-screen-app.js +12 -2
  26. package/dist/features/owned-ui/settings-app.d.ts +10 -3
  27. package/dist/features/owned-ui/settings-app.js +98 -45
  28. package/dist/features/owned-ui/settings-search-input.d.ts +29 -0
  29. package/dist/features/owned-ui/settings-search-input.js +1 -0
  30. package/dist/features/prompt-history/index.d.ts +1 -1
  31. package/dist/features/prompt-history/paths.d.ts +2 -1
  32. package/dist/features/prompt-history/paths.js +10 -2
  33. package/dist/features/prompt-history/service.d.ts +5 -0
  34. package/dist/features/prompt-history/service.js +1 -1
  35. package/dist/features/resident-tab/shortcut-declarations.d.ts +1 -1
  36. package/dist/features/resident-tab/shortcut-declarations.js +2 -0
  37. package/dist/foundation/launch-context/index.d.ts +2 -0
  38. package/dist/foundation/launch-context/index.js +1 -0
  39. package/dist/foundation/release/automatic-update.d.ts +37 -0
  40. package/dist/foundation/release/automatic-update.js +265 -0
  41. package/dist/foundation/release/bootstrap.d.ts +1 -9
  42. package/dist/foundation/release/bootstrap.js +7 -3
  43. package/dist/foundation/release/index.d.ts +1 -1
  44. package/dist/foundation/release/index.js +1 -1
  45. package/dist/foundation/release/latest-release.d.ts +3 -2
  46. package/dist/foundation/release/latest-release.js +1 -1
  47. package/dist/foundation/release/update-execution-lease.d.ts +36 -0
  48. package/dist/foundation/release/update-execution-lease.js +145 -0
  49. package/dist/foundation/release/update.d.ts +8 -6
  50. package/dist/foundation/release/update.js +232 -167
  51. package/dist/foundation/resident-tabs/bridge-client.d.ts +8 -2
  52. package/dist/foundation/resident-tabs/bridge-client.js +13 -6
  53. package/dist/foundation/resident-tabs/progress-observation-schema.d.ts +34 -0
  54. package/dist/foundation/resident-tabs/progress-observation-schema.js +1 -0
  55. package/dist/foundation/resident-tabs/progress-observation.d.ts +3 -6
  56. package/dist/foundation/resident-tabs/progress-observation.js +42 -12
  57. package/dist/foundation/resident-tabs/routes.d.ts +5 -0
  58. package/dist/foundation/resident-tabs/routes.js +5 -0
  59. package/dist/integrations/pi/components/editor-interaction.d.ts +2 -0
  60. package/dist/integrations/pi/components/modal-frame.d.ts +17 -1
  61. package/dist/integrations/pi/components/modal-frame.js +48 -9
  62. package/dist/integrations/pi/components/models-dialog.js +4 -52
  63. package/dist/integrations/pi/components/owned-editor-ux.d.ts +3 -0
  64. package/dist/integrations/pi/components/owned-editor-ux.js +75 -4
  65. package/dist/integrations/pi/components/shell-editor-autocomplete.js +57 -37
  66. package/dist/integrations/pi/components/shell-footer-status.js +19 -3
  67. package/dist/integrations/pi/components/shell-presenters-transcript.js +4 -1
  68. package/dist/integrations/pi/components/shell-selectors-dialogs.js +4 -1
  69. package/dist/integrations/pi/components/shell-shared-facade.d.ts +9 -2
  70. package/dist/integrations/pi/components/skills-dialog.js +2 -2
  71. package/dist/integrations/pi/components/upstream/components/owned-editor.d.ts +7 -5
  72. package/dist/integrations/pi/components/upstream/components/owned-editor.js +15 -8
  73. package/dist/integrations/pi/components/upstream/components/scoped-models-selector.d.ts +3 -3
  74. package/dist/integrations/pi/components/upstream/components/scoped-models-selector.js +2 -2
  75. package/dist/integrations/pi/components/upstream/components/session-footer.js +26 -23
  76. package/dist/integrations/pi/components/upstream/components/session-selector.js +7 -6
  77. package/dist/integrations/pi/components/upstream/components/thinking-selector.d.ts +7 -6
  78. package/dist/integrations/pi/components/upstream/components/thinking-selector.js +9 -8
  79. package/dist/integrations/pi/components/upstream/components/tool-execution.js +6 -4
  80. package/dist/integrations/pi/components/upstream/components/tree-selector.d.ts +8 -8
  81. package/dist/integrations/pi/components/upstream/components/tree-selector.js +10 -10
  82. package/dist/integrations/pi/components/upstream/history/editor-core.js +2 -0
  83. package/dist/integrations/pi/engine/adapter.js +7 -2
  84. package/dist/integrations/pi/engine/ports.d.ts +1 -1
  85. package/dist/integrations/pi/engine/ports.js +4 -0
  86. package/dist/integrations/pi/engine/workflow-runner.js +9 -2
  87. package/dist/native/darwin-arm64/manifest.json +1 -1
  88. package/dist/native/darwin-arm64/terminal-host.manifest.json +3 -3
  89. package/dist/native/darwin-arm64/terminal-host.node +0 -0
  90. package/dist/native/darwin-x64/manifest.json +1 -1
  91. package/dist/native/darwin-x64/terminal-host.manifest.json +3 -3
  92. package/dist/native/darwin-x64/terminal-host.node +0 -0
  93. package/dist/native/linux-x64/manifest.json +1 -1
  94. package/dist/native/linux-x64/terminal-host.manifest.json +3 -3
  95. package/dist/native/linux-x64/terminal-host.node +0 -0
  96. package/dist/native/win32-x64/manifest.json +2 -2
  97. package/dist/native/win32-x64/process-guardian.node +0 -0
  98. package/dist/native/win32-x64/terminal-host.manifest.json +3 -3
  99. package/dist/native/win32-x64/terminal-host.node +0 -0
  100. package/dist/product-identity.d.ts +1 -1
  101. package/dist/product-identity.js +1 -1
  102. package/dist/product-identity.json +1 -0
  103. package/dist/ui/apps/host.d.ts +2 -0
  104. package/dist/ui/apps/host.js +7 -1
  105. package/dist/ui/components/dialog-panel.js +35 -30
  106. package/dist/ui/components/line-input.d.ts +3 -0
  107. package/dist/ui/components/line-input.js +3 -1
  108. package/dist/ui/components/prompt-input.d.ts +3 -2
  109. package/dist/ui/components/prompt-input.js +6 -4
  110. package/dist/ui/components/spans.js +2 -2
  111. package/dist/ui/components/surface.js +4 -2
  112. package/dist/ui/components/text.d.ts +3 -6
  113. package/dist/ui/components/text.js +6 -8
  114. package/dist/ui/settings/declarations.d.ts +54 -8
  115. package/dist/ui/settings/declarations.js +36 -7
  116. package/dist/ui/settings/manager.js +7 -3
  117. package/dist/ui/settings/migrations.js +15 -0
  118. package/dist/ui/settings/sections.d.ts +4 -0
  119. package/dist/ui/settings/sections.js +9 -3
  120. package/docs/architecture/resident-tabs.md +36 -8
  121. package/docs/architecture/tool-image-presentation.md +2 -1
  122. package/docs/features/prompt-history.md +41 -20
  123. package/docs/validation.md +25 -5
  124. package/package.json +1 -1
@@ -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-26T04:56:17.941Z",
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-26T04:59:18.364Z",
13
13
  "artifact": {
14
14
  "filename": "terminal-host.node",
15
- "sha256": "f7f580d5ded5e1efa26ae790488efc8284edd15fee620aed091564c0fc460d16",
16
- "size": 5812800
15
+ "sha256": "54bdccc28f03d9e974efb691f99ec2645c528748b1ea9832c9c1e059e111ce92",
16
+ "size": 5941872
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-26T04:56:23.732Z",
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-26T05:01:25.953Z",
13
13
  "artifact": {
14
14
  "filename": "terminal-host.node",
15
- "sha256": "f7f2a1c09ebf4dbd5d28de747497564cb252d253ab7a9009b7aae1fe26bba4ff",
16
- "size": 6340520
15
+ "sha256": "048fb157fd7f98770d7256ef66638ef5ed225ae42225af8f3095413f95d4957b",
16
+ "size": 6476992
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-26T04:56:11.560Z",
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-26T04:59:27.220Z",
13
13
  "artifact": {
14
14
  "filename": "terminal-host.node",
15
- "sha256": "3c2ed1d62404436ebe39000e93c5428dd9acff3f3158004b94af8a95e778e32a",
16
- "size": 7069736
15
+ "sha256": "9e59caca78d8e966e1a1d468e47ebba59fb242e43b86e4ee8893a8dd20cb9ab8",
16
+ "size": 7212552
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-26T04:57:24.731Z",
11
11
  "artifact": {
12
12
  "filename": "process-guardian.node",
13
- "sha256": "12f5a962bc427e82345170f1c4db2a875683d5cbb4e818bcc1a314a11c71bf31",
13
+ "sha256": "a51e98cbd97f0abfcd99b00101133bfe45509f4a620f275a696985a16f4e2312",
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-26T05:00:51.094Z",
13
13
  "artifact": {
14
14
  "filename": "terminal-host.node",
15
- "sha256": "9beb6edeb62b28ff7e55d419d724c98f8645a73977d85fbb2c1bd85b7b324916",
16
- "size": 6138880
15
+ "sha256": "2be0eb9858bbfde8dd6dddb8bfc5881918f6c7804f74cd51cc97b56112b1adad",
16
+ "size": 6294016
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", "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,6 +1,6 @@
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",
3
+ "clipboardDiagnostics", "configDir", "dataDir", "databasePath", "developmentHistoryDataDir", "developmentInstanceId", "developmentRoot", "endpoint", "exitNoticePath",
4
4
  "paneId", "probeTrace", "processGuardianPath", "prFooterPreview", "profileHome", "residentFixtureControlDir", "residentProgressObservationDir", "residentProgressRunId", "residentProgressTabId", "residentProgressTabIncarnation", "runtimeDir", "sessionRuntimeId", "skipVersionCheck", "startupTrace", "suggestionDiagnostics", "tabEndpoint", "tabId", "tabToken", "tabsEndpoint", "terminalHostPath", "terminalSessionId",
5
5
  ];
6
6
  const FILESYSTEM_KEYS = ["slug", "windowsDirectory", "unixDirectory", "temporaryPrefix"];
@@ -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",
@@ -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 };
@@ -1,8 +1,18 @@
1
+ import { dialogFrameGeometry, insetDialogContent } from "../../contracts/presentation/index.js";
1
2
  import { LineInput, renderInputRow } from "./line-input.js";
2
- import { renderShortcutHints, renderShortcutHintsWithClose, shortcutHintsText } from "./shortcut-hints.js";
3
+ import { renderShortcutHintsWithClose } from "./shortcut-hints.js";
3
4
  import { displayWidth, truncateToWidth } from "./text.js";
4
5
  const LABEL_COLUMN_CAP = 30;
5
6
  const STEPPED_LABEL_COLUMN_CAP = 46;
7
+ /** One frame path for every semantic row, regardless of which dialog supplies the content. */
8
+ function dialogPanelLayout(width, theme) {
9
+ const geometry = dialogFrameGeometry(width);
10
+ return {
11
+ rule: theme.fg("border", "─".repeat(geometry.frameWidth)),
12
+ contentWidth: geometry.contentWidth,
13
+ contentRow: (painted, raw = painted) => insetDialogContent(pad(truncateToWidth(painted, geometry.contentWidth), geometry.contentWidth, raw), geometry),
14
+ };
15
+ }
6
16
  /** The column values start at: past the widest label, capped so one long name cannot push them off. */
7
17
  export function dialogValueColumn(rows) {
8
18
  const widest = Math.min(LABEL_COLUMN_CAP, Math.max(0, ...rows.map(row => displayWidth(row.label))));
@@ -14,11 +24,7 @@ export function dialogValueColumn(rows) {
14
24
  */
15
25
  export function renderDialogPanel(state, width, theme) {
16
26
  const labelColumn = Math.min(LABEL_COLUMN_CAP, Math.max(0, ...state.rows.map(row => displayWidth(row.label))));
17
- const rule = theme.fg("border", "─".repeat(Math.max(0, width)));
18
- const contentPadding = Math.min(1, Math.max(0, width));
19
- const contentWidth = Math.max(0, width - contentPadding);
20
- const inset = " ".repeat(contentPadding);
21
- const contentRow = (painted, raw) => `${inset}${pad(truncateToWidth(painted, contentWidth), contentWidth, raw)}`;
27
+ const layout = dialogPanelLayout(width, theme);
22
28
  const rows = state.rows.map((row, index) => {
23
29
  const selected = index === state.index;
24
30
  const padded = `${row.label}${" ".repeat(Math.max(0, labelColumn - displayWidth(row.label)))}`;
@@ -28,31 +34,27 @@ export function renderDialogPanel(state, width, theme) {
28
34
  ? `${theme.fg("accent", cursor)}${theme.fg("text", padded)} ${theme.fg("muted", row.value)}`
29
35
  : `${cursor}${padded} ${theme.fg("muted", row.value)}`;
30
36
  const painted = selected ? theme.highlight(content) : content;
31
- return contentRow(painted, raw);
37
+ return layout.contentRow(painted, raw);
32
38
  });
33
39
  const description = state.rows[state.index]?.description ?? "";
34
40
  const hint = typeof state.hint === "string"
35
41
  ? theme.fg("dim", state.hint)
36
- : renderShortcutHintsWithClose(state.hint, theme, contentWidth, 0);
42
+ : renderShortcutHintsWithClose(state.hint, theme, layout.contentWidth, 0);
37
43
  const plainHint = typeof state.hint === "string" ? state.hint : " ".repeat(displayWidth(hint));
38
44
  return [
39
- rule,
40
- contentRow(theme.bold(theme.fg("accent", state.title)), state.title),
41
- contentRow(theme.fg("dim", description), description),
45
+ layout.rule,
46
+ layout.contentRow(theme.bold(theme.fg("accent", state.title)), state.title),
47
+ layout.contentRow(theme.fg("dim", description), description),
42
48
  "",
43
49
  ...rows,
44
50
  "",
45
- contentRow(hint, plainHint),
46
- rule,
51
+ layout.contentRow(hint, plainHint),
52
+ layout.rule,
47
53
  ];
48
54
  }
49
55
  /** Owned stepped-selector composition for structured settings with nested choices. */
50
56
  export function renderSteppedDialogPanel(state, width, theme) {
51
- const rule = theme.fg("border", "─".repeat(Math.max(0, width)));
52
- const contentPadding = Math.min(1, Math.max(0, width));
53
- const contentWidth = Math.max(0, width - contentPadding);
54
- const inset = " ".repeat(contentPadding);
55
- const contentRow = (painted, raw) => `${inset}${pad(truncateToWidth(painted, contentWidth), contentWidth, raw)}`;
57
+ const layout = dialogPanelLayout(width, theme);
56
58
  const labelColumn = Math.min(STEPPED_LABEL_COLUMN_CAP, Math.max(0, ...state.rows.map(row => displayWidth(`${row.label}${row.labelSuffix ?? ""}`))));
57
59
  const rows = state.rows.map((row, index) => {
58
60
  const selected = index === state.index;
@@ -65,31 +67,34 @@ export function renderSteppedDialogPanel(state, width, theme) {
65
67
  const content = selected
66
68
  ? `${theme.fg("accent", cursor)}${label}${theme.fg("muted", suffix)}`
67
69
  : `${cursor}${label}${theme.fg("muted", suffix)}`;
68
- return contentRow(selected ? theme.highlight(content) : content, raw);
70
+ return layout.contentRow(selected ? theme.highlight(content) : content, raw);
69
71
  });
70
72
  const input = state.input === undefined
71
73
  ? []
72
- : [...renderInputRow(state.input, width, { ruled: false, promptGlyph: "", theme }).lines, ""];
74
+ : [
75
+ ...renderInputRow(state.input, layout.contentWidth, {
76
+ ruled: false,
77
+ promptGlyph: "> ",
78
+ promptRole: "accent",
79
+ theme,
80
+ }).lines.map(row => layout.contentRow(row)),
81
+ "",
82
+ ];
73
83
  const step = `(step ${state.step}/${state.steps})`;
74
84
  const title = `${state.title} ${step}`;
75
85
  const paintedTitle = `${theme.bold(theme.fg("accent", state.title))} ${theme.fg("dim", step)}`;
76
86
  return [
77
- rule,
78
- contentRow(paintedTitle, title),
79
- contentRow(theme.fg("dim", state.description), state.description),
87
+ layout.rule,
88
+ layout.contentRow(paintedTitle, title),
89
+ layout.contentRow(theme.fg("dim", state.description), state.description),
80
90
  "",
81
91
  ...input,
82
92
  ...rows,
83
93
  "",
84
- renderSteppedHint(state.hint, width, theme),
85
- rule,
94
+ layout.contentRow(renderShortcutHintsWithClose(state.hint, theme, layout.contentWidth)),
95
+ layout.rule,
86
96
  ];
87
97
  }
88
- function renderSteppedHint(entries, width, theme) {
89
- const raw = shortcutHintsText(entries, 1, " · ");
90
- const painted = renderShortcutHints(entries, theme, 1, theme.fg("dim", " · "));
91
- return `${truncateToWidth(painted, width)}${" ".repeat(Math.max(0, width - displayWidth(raw)))}`;
92
- }
93
98
  /** The row a pointer report lands on, or null when it is not on one. */
94
99
  export function dialogRowAt(frame, row, column, valueWidth) {
95
100
  const at = row - frame.firstRow;
@@ -1,3 +1,4 @@
1
+ import { type PromptMarkerRole } from "./prompt-input.js";
1
2
  import type { UiTheme } from "./theme.js";
2
3
  export type LineInputOutcome = {
3
4
  readonly kind: "editing";
@@ -60,6 +61,8 @@ export interface InputRowOptions {
60
61
  readonly ruled?: boolean;
61
62
  /** Prompt marker including any following spacing. Defaults to the shared prompt glyph. */
62
63
  readonly promptGlyph?: string;
64
+ /** Semantic foreground for a configured prompt marker. */
65
+ readonly promptRole?: PromptMarkerRole;
63
66
  readonly theme?: Pick<UiTheme, "fg">;
64
67
  }
65
68
  export interface InputRow {
@@ -220,5 +220,7 @@ export function renderInputRow(input, width, options = {}) {
220
220
  const body = empty
221
221
  ? `${caretCell(placeholder.slice(0, 1))}${faint(placeholder.slice(1))}`
222
222
  : `${before}${caretCell(under)}${after}`;
223
- return { lines: presentation.render(width, () => ({ rows: [body] }), options.ruled, 0, options.promptGlyph) };
223
+ return {
224
+ lines: presentation.render(width, () => ({ rows: [body] }), options.ruled, 0, options.promptGlyph, options.promptRole),
225
+ };
224
226
  }
@@ -4,7 +4,8 @@ export declare const PROMPT_PREFIX_WIDTH = 0;
4
4
  type RuleTheme = Pick<UiTheme, "fg">;
5
5
  export declare function promptRuleText(text: string, theme: RuleTheme): string;
6
6
  export declare function promptRule(width: number, theme: RuleTheme): string;
7
- export declare function promptArrow(text: string, theme: RuleTheme): string;
7
+ export type PromptMarkerRole = "muted" | "accent";
8
+ export declare function promptArrow(text: string, theme: RuleTheme, role?: PromptMarkerRole): string;
8
9
  export interface PromptInputBody {
9
10
  readonly rows: readonly string[];
10
11
  /** Semantic border fragments retain editor history and scroll annotations. */
@@ -31,6 +32,6 @@ export declare class PromptInput {
31
32
  contentWidth: number;
32
33
  layoutWidth: number;
33
34
  };
34
- render(width: number, renderBody: (innerWidth: number) => PromptInputBody, ruled?: boolean, padding?: number, promptGlyph?: string): string[];
35
+ render(width: number, renderBody: (innerWidth: number) => PromptInputBody, ruled?: boolean, padding?: number, promptGlyph?: string, promptRole?: PromptMarkerRole): string[];
35
36
  }
36
37
  export {};
@@ -8,8 +8,10 @@ export function promptRuleText(text, theme) {
8
8
  export function promptRule(width, theme) {
9
9
  return promptRuleText("─".repeat(Math.max(0, width)), theme);
10
10
  }
11
- export function promptArrow(text, theme) {
12
- return theme.fg("muted", text);
11
+ export function promptArrow(text, theme, role = "muted") {
12
+ if (role === "accent" && text.startsWith(">"))
13
+ return `${theme.fg(role, ">")}${text.slice(1)}`;
14
+ return theme.fg(role, text);
13
15
  }
14
16
  /** Composes shared input chrome around controller-owned body rows without owning editing state. */
15
17
  export class PromptInput {
@@ -26,7 +28,7 @@ export class PromptInput {
26
28
  const contentWidth = Math.max(1, innerWidth - paddingX * 2);
27
29
  return { prefixWidth, innerWidth, paddingX, contentWidth, layoutWidth: Math.max(1, contentWidth - (paddingX ? 0 : 1)) };
28
30
  }
29
- render(width, renderBody, ruled = true, padding = 0, promptGlyph = PROMPT_GLYPH) {
31
+ render(width, renderBody, ruled = true, padding = 0, promptGlyph = PROMPT_GLYPH, promptRole = "muted") {
30
32
  if (width <= 0)
31
33
  return [];
32
34
  const { prefixWidth, innerWidth } = this.geometry(width, padding, promptGlyph);
@@ -40,7 +42,7 @@ export class PromptInput {
40
42
  return clipped + " ".repeat(Math.max(0, width - this.metrics.measure(clipped)));
41
43
  };
42
44
  const rows = body.rows.map((row, index) => fit(`${index === 0
43
- ? promptArrow(promptGlyph, this.theme)
45
+ ? promptArrow(promptGlyph, this.theme, promptRole)
44
46
  : " ".repeat(prefixWidth)}${row}`));
45
47
  const rule = (fragment) => fragment === undefined
46
48
  ? promptRule(width, this.theme)
@@ -1,4 +1,4 @@
1
- import { displayWidth } from "./text.js";
1
+ import { displayWidth, graphemeWidth } from "./text.js";
2
2
  /**
3
3
  * Ported from the A1 UI reference implementation (`core/presentation/spans.ts`).
4
4
  * Writing over part of a rendered row is not string slicing: the row carries
@@ -53,7 +53,7 @@ export function overlaySpan(line, from, to, span, options = {}) {
53
53
  continue;
54
54
  }
55
55
  for (const { segment } of GRAPHEMES.segment(token)) {
56
- const width = displayWidth(segment);
56
+ const width = graphemeWidth(segment);
57
57
  if (column + width <= from)
58
58
  head += segment;
59
59
  else if (column >= to)
@@ -29,10 +29,12 @@ export function withScrollbarRail(lines, geometry, contentWidth, theme, options
29
29
  */
30
30
  export function renderEmptyState(message, mark, height, width, theme) {
31
31
  const middle = Math.floor(height / 2);
32
+ const messageRow = Math.min(Math.max(0, height - 1), middle + 1);
33
+ const markRow = messageRow - 1;
32
34
  return Array.from({ length: Math.max(0, height) }, (_line, index) => {
33
- if (index === middle - 1)
35
+ if (index === markRow)
34
36
  return centre(theme.fg("muted", mark), mark, width);
35
- return index === middle ? centre(theme.fg("muted", message), message, width) : "";
37
+ return index === messageRow ? centre(theme.fg("muted", message), message, width) : "";
36
38
  });
37
39
  }
38
40
  function centre(painted, raw, width) {
@@ -1,11 +1,8 @@
1
- /**
2
- * Display-width text handling. Terminals lay out by column, not by code unit,
3
- * so measuring with `String.length` mis-sizes CJK, emoji, and combining marks,
4
- * and counting styling escapes as visible width breaks every layout that uses
5
- * colour.
6
- */
1
+ /** Terminal-column geometry: preserve graphemes, Unicode cell widths and ANSI styling. */
7
2
  /** Removes styling sequences so only visible characters remain. */
8
3
  export declare function stripAnsi(text: string): string;
4
+ /** Width of one grapheme cluster: two for emoji, else the widest code point it contains. */
5
+ export declare function graphemeWidth(grapheme: string): number;
9
6
  export interface DisplayColumnRange {
10
7
  readonly from: number;
11
8
  readonly to: number;
@@ -1,9 +1,4 @@
1
- /**
2
- * Display-width text handling. Terminals lay out by column, not by code unit,
3
- * so measuring with `String.length` mis-sizes CJK, emoji, and combining marks,
4
- * and counting styling escapes as visible width breaks every layout that uses
5
- * colour.
6
- */
1
+ /** Terminal-column geometry: preserve graphemes, Unicode cell widths and ANSI styling. */
7
2
  const ANSI_PATTERN = /\[[0-9;:?]*[ -/]*[@-~]|[\]_][^]*(?:|\\)|[@-Z\\-_]/g;
8
3
  const SEGMENTER = new Intl.Segmenter(undefined, { granularity: "grapheme" });
9
4
  const WORD_SEGMENTER = new Intl.Segmenter(undefined, { granularity: "word" });
@@ -76,7 +71,7 @@ function couldBeEmoji(grapheme) {
76
71
  grapheme.length > 1);
77
72
  }
78
73
  /** Width of one grapheme cluster: two for emoji, else the widest code point it contains. */
79
- function graphemeWidth(grapheme) {
74
+ export function graphemeWidth(grapheme) {
80
75
  if (couldBeEmoji(grapheme) && RGI_EMOJI_PATTERN.test(grapheme))
81
76
  return 2;
82
77
  let width = 0;
@@ -126,8 +121,11 @@ export function displayColumnSlice(text, requestedFrom, requestedTo) {
126
121
  }
127
122
  /** Columns this text occupies once styling is removed. */
128
123
  export function displayWidth(text) {
124
+ const plain = stripAnsi(text);
125
+ if (!/[^\x20-\x7e]/u.test(plain))
126
+ return plain.length;
129
127
  let width = 0;
130
- for (const { segment } of SEGMENTER.segment(stripAnsi(text)))
128
+ for (const { segment } of SEGMENTER.segment(plain))
131
129
  width += graphemeWidth(segment);
132
130
  return width;
133
131
  }
@@ -1,4 +1,4 @@
1
- export declare const OWNED_UI_SETTINGS_VERSION = 18;
1
+ export declare const OWNED_UI_SETTINGS_VERSION = 19;
2
2
  export type OwnedUiSettingValue = string | number | boolean;
3
3
  export type OwnedUiSettingApplication = "live" | "restart";
4
4
  export interface OwnedUiSettingDeclaration {
@@ -12,19 +12,28 @@ export interface OwnedUiSettingDeclaration {
12
12
  readonly application: OwnedUiSettingApplication;
13
13
  readonly defaultValue: OwnedUiSettingValue;
14
14
  readonly allowedValues: readonly OwnedUiSettingValue[];
15
+ /**
16
+ * Parts of a structured setting, edited through their own dialog: the value is the comma-separated
17
+ * keys of the enabled parts in this order.
18
+ */
19
+ readonly flags?: readonly {
20
+ readonly key: string;
21
+ readonly label: string;
22
+ readonly description: string;
23
+ }[];
15
24
  }
16
25
  export declare const OWNED_SETTING_DECLARATIONS: Readonly<{
17
26
  readonly updateCheck: Readonly<{
18
27
  id: "updateCheck";
19
- label: "Update check";
28
+ label: "Update";
20
29
  section: Readonly<{
21
30
  id: "generic";
22
31
  title: "Generic";
23
32
  }>;
24
- description: "Check once a day at startup whether a newer A1 release exists on this channel and show a notice. Uses the public npm registry; applies on next start.";
33
+ description: "Auto installs verified channel updates silently, Notify shows the current update notice, and No leaves updates manual. Checks use the public npm registry; applies on next start.";
25
34
  application: "restart";
26
- defaultValue: true;
27
- allowedValues: readonly [true, false];
35
+ defaultValue: "auto";
36
+ allowedValues: readonly ["auto", "notify", "no"];
28
37
  }>;
29
38
  readonly timeFormat: Readonly<{
30
39
  id: "timeFormat";
@@ -117,11 +126,23 @@ export declare const OWNED_SETTING_DECLARATIONS: Readonly<{
117
126
  id: "history";
118
127
  title: "History";
119
128
  }>;
120
- description: "Retain reusable prompts across sessions. Applies on next start; disabling does not erase saved history or stop existing instances.";
129
+ description: "Retain reusable prompts after restart. Applies on next start; disabling does not erase saved history or stop existing instances.";
121
130
  application: "restart";
122
131
  defaultValue: true;
123
132
  allowedValues: readonly [true, false];
124
133
  }>;
134
+ readonly promptHistoryScope: Readonly<{
135
+ id: "promptHistoryScope";
136
+ label: "History scope";
137
+ section: Readonly<{
138
+ id: "history";
139
+ title: "History";
140
+ }>;
141
+ description: "Unique shows each agent session's history; Shared shows the profile-wide history. Switches running agents without moving or erasing saved prompts.";
142
+ application: "live";
143
+ defaultValue: "unique";
144
+ allowedValues: readonly ["unique", "shared"];
145
+ }>;
125
146
  readonly promptHistoryMaxItems: Readonly<{
126
147
  id: "promptHistoryMaxItems";
127
148
  label: "History limit";
@@ -175,19 +196,44 @@ export declare const OWNED_SETTING_DECLARATIONS: Readonly<{
175
196
  label: "Position";
176
197
  section: Readonly<{
177
198
  id: "tabs";
178
- title: "Tabs";
199
+ title: "Tab Bar";
179
200
  }>;
180
201
  description: "Place the resident tab bar at the top or bottom of the terminal.";
181
202
  application: "live";
182
203
  defaultValue: "top";
183
204
  allowedValues: readonly ["top", "bottom"];
184
205
  }>;
206
+ readonly tabBarPlusMenu: Readonly<{
207
+ id: "tabBarPlusMenu";
208
+ label: "Plus menu";
209
+ section: Readonly<{
210
+ id: "tabs";
211
+ title: "Tab Bar";
212
+ }>;
213
+ description: "The tabs + offers. With only Agent, + adds an Agent at once; with more, it opens a menu; with none, + is hidden.";
214
+ application: "live";
215
+ defaultValue: "agent";
216
+ allowedValues: readonly ["", "agent", "settings", "changelog", "agent,settings", "agent,changelog", "settings,changelog", "agent,settings,changelog"];
217
+ flags: readonly (Readonly<{
218
+ key: "agent";
219
+ label: "Agent";
220
+ description: "Add a new Agent tab every time.";
221
+ }> | Readonly<{
222
+ key: "settings";
223
+ label: "Settings";
224
+ description: "Show the one Settings tab.";
225
+ }> | Readonly<{
226
+ key: "changelog";
227
+ label: "Changelog";
228
+ description: "Show the one Changelog tab.";
229
+ }>)[];
230
+ }>;
185
231
  readonly tabsAutoName: Readonly<{
186
232
  id: "tabsAutoName";
187
233
  label: "Auto name";
188
234
  section: Readonly<{
189
235
  id: "tabs";
190
- title: "Tabs";
236
+ title: "Tab Bar";
191
237
  }>;
192
238
  description: "Automatically name a new tab from its first completed turn with the tab's current model.";
193
239
  application: "live";