@timurproko/a1 0.2.7-dev.810 → 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 (166) 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/resident-tab-coordinator.d.ts +6 -9
  7. package/dist/app/session-shell/resident-tab-coordinator.js +9 -52
  8. package/dist/app/session-shell/session-shell-root.d.ts +14 -8
  9. package/dist/app/session-shell/session-shell-root.js +9 -5
  10. package/dist/app/session-shell/session-shell.js +70 -20
  11. package/dist/app/session-shell/session-viewport-controller.js +6 -4
  12. package/dist/app/session-shell/shell-host.js +6 -3
  13. package/dist/app/session-shell/transcript-document.js +1 -1
  14. package/dist/cli/tabs.d.ts +1 -1
  15. package/dist/cli/tabs.js +10 -14
  16. package/dist/composition/owned-settings.d.ts +12 -0
  17. package/dist/composition/owned-settings.js +36 -0
  18. package/dist/composition/owned-ui.d.ts +5 -14
  19. package/dist/composition/owned-ui.js +93 -64
  20. package/dist/composition/resident-tab-bridge.d.ts +10 -1
  21. package/dist/composition/resident-tab-bridge.js +21 -0
  22. package/dist/composition/settings-route-host.d.ts +12 -2
  23. package/dist/composition/settings-route-host.js +27 -9
  24. package/dist/composition/settings-search-input.d.ts +9 -0
  25. package/dist/composition/settings-search-input.js +58 -0
  26. package/dist/composition/utility-tab.d.ts +28 -0
  27. package/dist/composition/utility-tab.js +242 -0
  28. package/dist/contracts/owned-ui/session-backend.d.ts +2 -0
  29. package/dist/contracts/owned-ui/session-workflows.d.ts +7 -3
  30. package/dist/contracts/presentation/index.d.ts +11 -0
  31. package/dist/contracts/presentation/index.js +12 -0
  32. package/dist/features/launch/development-launch.js +6 -0
  33. package/dist/features/launch/profile-paths.js +4 -0
  34. package/dist/features/owned-ui/plus-menu-dialog.d.ts +22 -0
  35. package/dist/features/owned-ui/plus-menu-dialog.js +76 -0
  36. package/dist/features/owned-ui/project-trust-dialog.d.ts +1 -1
  37. package/dist/features/owned-ui/project-trust-dialog.js +6 -8
  38. package/dist/features/owned-ui/project-trust-prompt.d.ts +1 -0
  39. package/dist/features/owned-ui/project-trust-prompt.js +7 -3
  40. package/dist/features/owned-ui/reference-screen-app.d.ts +2 -0
  41. package/dist/features/owned-ui/reference-screen-app.js +12 -2
  42. package/dist/features/owned-ui/settings-app.d.ts +10 -3
  43. package/dist/features/owned-ui/settings-app.js +98 -45
  44. package/dist/features/owned-ui/settings-search-input.d.ts +29 -0
  45. package/dist/features/owned-ui/settings-search-input.js +1 -0
  46. package/dist/features/prompt-history/index.d.ts +1 -1
  47. package/dist/features/prompt-history/paths.d.ts +2 -1
  48. package/dist/features/prompt-history/paths.js +10 -2
  49. package/dist/features/prompt-history/service.d.ts +5 -0
  50. package/dist/features/prompt-history/service.js +1 -1
  51. package/dist/features/resident-tab/shortcut-declarations.d.ts +1 -1
  52. package/dist/features/resident-tab/shortcut-declarations.js +2 -0
  53. package/dist/foundation/launch-context/index.d.ts +2 -0
  54. package/dist/foundation/launch-context/index.js +1 -0
  55. package/dist/foundation/lifecycle/session-repository-context.js +16 -2
  56. package/dist/foundation/release/automatic-update.d.ts +37 -0
  57. package/dist/foundation/release/automatic-update.js +265 -0
  58. package/dist/foundation/release/bootstrap.d.ts +1 -9
  59. package/dist/foundation/release/bootstrap.js +7 -3
  60. package/dist/foundation/release/early-accent.d.ts +12 -0
  61. package/dist/foundation/release/early-accent.js +59 -0
  62. package/dist/foundation/release/index.d.ts +1 -1
  63. package/dist/foundation/release/index.js +1 -1
  64. package/dist/foundation/release/latest-release.d.ts +3 -2
  65. package/dist/foundation/release/latest-release.js +1 -1
  66. package/dist/foundation/release/progress-palette.generated.d.ts +137 -3
  67. package/dist/foundation/release/progress-palette.generated.js +137 -3
  68. package/dist/foundation/release/release-gc.js +19 -4
  69. package/dist/foundation/release/update-execution-lease.d.ts +36 -0
  70. package/dist/foundation/release/update-execution-lease.js +145 -0
  71. package/dist/foundation/release/update.d.ts +9 -7
  72. package/dist/foundation/release/update.js +244 -175
  73. package/dist/foundation/resident-tabs/bridge-client.d.ts +10 -3
  74. package/dist/foundation/resident-tabs/bridge-client.js +20 -8
  75. package/dist/foundation/resident-tabs/maintenance.d.ts +2 -6
  76. package/dist/foundation/resident-tabs/maintenance.js +5 -23
  77. package/dist/foundation/resident-tabs/progress-observation-schema.d.ts +34 -0
  78. package/dist/foundation/resident-tabs/progress-observation-schema.js +1 -0
  79. package/dist/foundation/resident-tabs/progress-observation.d.ts +3 -6
  80. package/dist/foundation/resident-tabs/progress-observation.js +43 -12
  81. package/dist/foundation/resident-tabs/release-holds.js +3 -14
  82. package/dist/foundation/resident-tabs/routes.d.ts +5 -0
  83. package/dist/foundation/resident-tabs/routes.js +5 -0
  84. package/dist/foundation/resident-tabs/settings.d.ts +0 -1
  85. package/dist/foundation/resident-tabs/settings.js +0 -2
  86. package/dist/integrations/pi/components/editor-interaction.d.ts +2 -0
  87. package/dist/integrations/pi/components/modal-frame.d.ts +17 -1
  88. package/dist/integrations/pi/components/modal-frame.js +48 -9
  89. package/dist/integrations/pi/components/models-dialog.js +4 -52
  90. package/dist/integrations/pi/components/owned-editor-ux.d.ts +3 -0
  91. package/dist/integrations/pi/components/owned-editor-ux.js +75 -4
  92. package/dist/integrations/pi/components/shell-editor-autocomplete.js +57 -37
  93. package/dist/integrations/pi/components/shell-footer-status.js +19 -3
  94. package/dist/integrations/pi/components/shell-presenters-transcript.js +4 -1
  95. package/dist/integrations/pi/components/shell-selectors-dialogs.js +4 -1
  96. package/dist/integrations/pi/components/shell-shared-facade.d.ts +9 -2
  97. package/dist/integrations/pi/components/skills-dialog.js +2 -2
  98. package/dist/integrations/pi/components/upstream/components/owned-editor.d.ts +7 -5
  99. package/dist/integrations/pi/components/upstream/components/owned-editor.js +15 -8
  100. package/dist/integrations/pi/components/upstream/components/scoped-models-selector.d.ts +3 -3
  101. package/dist/integrations/pi/components/upstream/components/scoped-models-selector.js +2 -2
  102. package/dist/integrations/pi/components/upstream/components/session-footer.js +26 -23
  103. package/dist/integrations/pi/components/upstream/components/session-selector.js +7 -6
  104. package/dist/integrations/pi/components/upstream/components/thinking-selector.d.ts +7 -6
  105. package/dist/integrations/pi/components/upstream/components/thinking-selector.js +9 -8
  106. package/dist/integrations/pi/components/upstream/components/tool-execution.js +6 -4
  107. package/dist/integrations/pi/components/upstream/components/tree-selector.d.ts +8 -8
  108. package/dist/integrations/pi/components/upstream/components/tree-selector.js +10 -10
  109. package/dist/integrations/pi/components/upstream/history/editor-core.js +2 -0
  110. package/dist/integrations/pi/components/upstream/theme/theme.d.ts +2 -0
  111. package/dist/integrations/pi/components/upstream/theme/theme.js +5 -1
  112. package/dist/integrations/pi/engine/adapter.js +7 -2
  113. package/dist/integrations/pi/engine/offline-settings-port.d.ts +23 -0
  114. package/dist/integrations/pi/engine/offline-settings-port.js +53 -0
  115. package/dist/integrations/pi/engine/ports.d.ts +1 -1
  116. package/dist/integrations/pi/engine/ports.js +4 -0
  117. package/dist/integrations/pi/engine/settings-bridge.d.ts +5 -0
  118. package/dist/integrations/pi/engine/settings-bridge.js +13 -0
  119. package/dist/integrations/pi/engine/settings-port.js +1 -14
  120. package/dist/integrations/pi/engine/workflow-runner.js +9 -2
  121. package/dist/native/darwin-arm64/manifest.json +1 -1
  122. package/dist/native/darwin-arm64/terminal-host.manifest.json +3 -3
  123. package/dist/native/darwin-arm64/terminal-host.node +0 -0
  124. package/dist/native/darwin-x64/manifest.json +1 -1
  125. package/dist/native/darwin-x64/terminal-host.manifest.json +3 -3
  126. package/dist/native/darwin-x64/terminal-host.node +0 -0
  127. package/dist/native/linux-x64/manifest.json +1 -1
  128. package/dist/native/linux-x64/terminal-host.manifest.json +3 -3
  129. package/dist/native/linux-x64/terminal-host.node +0 -0
  130. package/dist/native/win32-x64/manifest.json +2 -2
  131. package/dist/native/win32-x64/process-guardian.node +0 -0
  132. package/dist/native/win32-x64/terminal-host.manifest.json +3 -3
  133. package/dist/native/win32-x64/terminal-host.node +0 -0
  134. package/dist/product-identity.d.ts +1 -1
  135. package/dist/product-identity.js +2 -2
  136. package/dist/product-identity.json +2 -0
  137. package/dist/ui/apps/host.d.ts +2 -0
  138. package/dist/ui/apps/host.js +7 -1
  139. package/dist/ui/components/dialog-panel.js +35 -30
  140. package/dist/ui/components/line-input.d.ts +3 -0
  141. package/dist/ui/components/line-input.js +3 -1
  142. package/dist/ui/components/prompt-input.d.ts +5 -4
  143. package/dist/ui/components/prompt-input.js +8 -6
  144. package/dist/ui/components/spans.js +2 -2
  145. package/dist/ui/components/submitted-prompt.d.ts +2 -2
  146. package/dist/ui/components/submitted-prompt.js +3 -3
  147. package/dist/ui/components/surface.js +4 -2
  148. package/dist/ui/components/text.d.ts +3 -6
  149. package/dist/ui/components/text.js +6 -8
  150. package/dist/ui/components/transcript-viewport.d.ts +1 -1
  151. package/dist/ui/components/transcript-viewport.js +141 -24
  152. package/dist/ui/settings/declarations.d.ts +67 -17
  153. package/dist/ui/settings/declarations.js +47 -15
  154. package/dist/ui/settings/early-accent.d.ts +81 -0
  155. package/dist/ui/settings/early-accent.js +50 -0
  156. package/dist/ui/settings/manager.js +7 -3
  157. package/dist/ui/settings/migrations.js +22 -0
  158. package/dist/ui/settings/progress-palette.generated.d.ts +139 -0
  159. package/dist/ui/settings/progress-palette.generated.js +139 -0
  160. package/dist/ui/settings/sections.d.ts +4 -0
  161. package/dist/ui/settings/sections.js +9 -3
  162. package/docs/architecture/resident-tabs.md +52 -21
  163. package/docs/architecture/tool-image-presentation.md +2 -1
  164. package/docs/features/prompt-history.md +41 -20
  165. package/docs/validation.md +25 -5
  166. package/package.json +1 -1
@@ -7,7 +7,7 @@
7
7
  "platform": "linux",
8
8
  "architecture": "x64",
9
9
  "capability": "supported",
10
- "builtAt": "2026-10-23T09:16:44.112Z",
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-23T09:18:34.630Z",
12
+ "builtAt": "2026-10-27T13:53:30.629Z",
13
13
  "artifact": {
14
14
  "filename": "terminal-host.node",
15
- "sha256": "707e4140e1c1b4b2c78c45373d8471bbbcc6232e7ad5d14ad8f5a76a90b6265b",
16
- "size": 6997376
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-23T09:17:41.474Z",
10
+ "builtAt": "2026-10-27T13:50:41.076Z",
11
11
  "artifact": {
12
12
  "filename": "process-guardian.node",
13
- "sha256": "f0fb48d96ea06a21d77a4df332ec863d3830caf8ce6adfebcb2a4bb4d86fabdf",
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-23T09:20:49.040Z",
12
+ "builtAt": "2026-10-27T13:54:43.955Z",
13
13
  "artifact": {
14
14
  "filename": "terminal-host.node",
15
- "sha256": "f511333451655f6fdef1da7710c54c9e65058e367f6e8be3b8ac0420fcc70fa1",
16
- "size": 6078464
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 };
@@ -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
  }
@@ -1,10 +1,11 @@
1
1
  import { type UiTheme } from "./theme.js";
2
- export declare const PROMPT_GLYPH = "\u276F ";
3
- export declare const PROMPT_PREFIX_WIDTH = 2;
2
+ export declare const PROMPT_GLYPH = "";
3
+ 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 {};
@@ -1,15 +1,17 @@
1
1
  import { displayWidth, truncateToWidth } from "./text.js";
2
2
  import { PLAIN_THEME } from "./theme.js";
3
- export const PROMPT_GLYPH = "❯ ";
4
- export const PROMPT_PREFIX_WIDTH = 2;
3
+ export const PROMPT_GLYPH = "";
4
+ export const PROMPT_PREFIX_WIDTH = 0;
5
5
  export function promptRuleText(text, theme) {
6
6
  return theme.fg("border", text);
7
7
  }
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)
@@ -1,8 +1,8 @@
1
1
  export type UiTimeFormat = "20:00" | "8:00 PM";
2
2
  /** Deterministic local hour/minute presentation shared by A1-owned time labels. */
3
3
  export declare function formatLocalTime(source: Date | number, format?: UiTimeFormat): string | null;
4
- /** Visible width of the submitted-prompt prefix (`❯ `). */
5
- export declare const SUBMITTED_PROMPT_PREFIX_WIDTH = 2;
4
+ /** Visible width of the submitted-prompt prefix (` ❯ `). */
5
+ export declare const SUBMITTED_PROMPT_PREFIX_WIDTH = 3;
6
6
  export interface SubmittedPromptStyle {
7
7
  readonly prefix?: (text: string) => string;
8
8
  readonly timestamp?: (text: string) => string;
@@ -10,8 +10,8 @@ export function formatLocalTime(source, format = "8:00 PM") {
10
10
  return `${String(hour).padStart(2, "0")}:${minute}`;
11
11
  return `${hour % 12 || 12}:${minute} ${hour < 12 ? "AM" : "PM"}`;
12
12
  }
13
- /** Visible width of the submitted-prompt prefix (`❯ `). */
14
- export const SUBMITTED_PROMPT_PREFIX_WIDTH = 2;
13
+ /** Visible width of the submitted-prompt prefix (` ❯ `). */
14
+ export const SUBMITTED_PROMPT_PREFIX_WIDTH = 3;
15
15
  const TIMESTAMP_MARGIN = 3;
16
16
  const MIN_USEFUL_CONTENT_WIDTH = 8;
17
17
  /** Formats transcript metadata, never render time, in the active A1 time format. */
@@ -42,7 +42,7 @@ export function composeSubmittedPromptRows(contentRows, width, source, style = {
42
42
  if (width <= 0)
43
43
  return [];
44
44
  const layout = submittedPromptLayout(width, source, format);
45
- const prefix = (style.prefix ?? identity)("❯ ");
45
+ const prefix = (style.prefix ?? identity)(" ❯ ");
46
46
  const rows = (contentRows.length === 0 ? [""] : contentRows).map((row, index) => {
47
47
  const content = truncateToWidth(row, layout.contentWidth);
48
48
  return `${index === 0 ? prefix : " ".repeat(SUBMITTED_PROMPT_PREFIX_WIDTH)}${content}`;
@@ -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
  }
@@ -178,7 +178,7 @@ export declare class TranscriptViewport {
178
178
  releaseSelection(): boolean;
179
179
  clearSelection(): boolean;
180
180
  selectedText(): string | null;
181
- /** Captures visible selected text, not off-screen history. */
181
+ /** Captures selected text, including document rows of a visible selection scrolled off-screen. */
182
182
  captureSelectedText(): SelectionCopySnapshot | null;
183
183
  scrollBy(lines: number, now?: number): boolean;
184
184
  scrollTo(position: number, now?: number): boolean;