@timurproko/a1 0.2.7-dev.1245 → 0.2.7-dev.1252

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 (342) hide show
  1. package/README.md +11 -36
  2. package/bin/cli.js +2 -17
  3. package/bin/ui.js +7 -48
  4. package/dist/app/session-shell/exit-notice.d.ts +2 -2
  5. package/dist/app/session-shell/exit-notice.js +10 -10
  6. package/dist/app/session-shell/prompt-submission.d.ts +2 -4
  7. package/dist/app/session-shell/prompt-submission.js +3 -23
  8. package/dist/app/session-shell/response-copy-transport.js +1 -2
  9. package/dist/app/session-shell/session-lifecycle.d.ts +1 -2
  10. package/dist/app/session-shell/session-lifecycle.js +2 -4
  11. package/dist/app/session-shell/session-shell-root.d.ts +0 -31
  12. package/dist/app/session-shell/session-shell-root.js +3 -4
  13. package/dist/app/session-shell/session-shell.js +6 -47
  14. package/dist/app/session-shell/session-viewport-controller.js +3 -6
  15. package/dist/app/session-shell/shell-host.js +2 -18
  16. package/dist/app/session-shell/transcript-document.d.ts +1 -2
  17. package/dist/app/session-shell/transcript-document.js +3 -28
  18. package/dist/app/session-shell/workflow-output.js +1 -1
  19. package/dist/app/session-shell/workflow-router.d.ts +1 -3
  20. package/dist/app/session-shell/workflow-router.js +1 -4
  21. package/dist/cli/dispatch.d.ts +1 -11
  22. package/dist/cli/dispatch.js +5 -92
  23. package/dist/cli/session-context.js +5 -7
  24. package/dist/cli/uninstall.d.ts +1 -5
  25. package/dist/cli/uninstall.js +6 -35
  26. package/dist/cli/version-stats.js +4 -7
  27. package/dist/composition/owned-settings.d.ts +0 -1
  28. package/dist/composition/owned-settings.js +0 -1
  29. package/dist/composition/owned-ui.d.ts +2 -24
  30. package/dist/composition/owned-ui.js +11 -87
  31. package/dist/composition/release-update-observation.d.ts +4 -4
  32. package/dist/composition/release-update-observation.js +17 -47
  33. package/dist/composition/session-backend.d.ts +0 -1
  34. package/dist/composition/session-runtime-registry.d.ts +3 -3
  35. package/dist/composition/settings-route-host.d.ts +0 -7
  36. package/dist/composition/settings-route-host.js +4 -10
  37. package/dist/composition/startup-route.d.ts +0 -1
  38. package/dist/composition/startup-route.js +0 -1
  39. package/dist/contracts/owned-ui/index.d.ts +1 -1
  40. package/dist/contracts/owned-ui/model.d.ts +0 -3
  41. package/dist/contracts/owned-ui/session-workflows.d.ts +1 -4
  42. package/dist/features/launch/development-launch.js +0 -1
  43. package/dist/features/launch/index.d.ts +1 -1
  44. package/dist/features/launch/intent.d.ts +1 -3
  45. package/dist/features/launch/intent.js +2 -4
  46. package/dist/features/launch/session-context.d.ts +2 -2
  47. package/dist/features/owned-ui/reference-screen-app.d.ts +0 -2
  48. package/dist/features/owned-ui/reference-screen-app.js +2 -9
  49. package/dist/features/owned-ui/settings-app.d.ts +0 -6
  50. package/dist/features/owned-ui/settings-app.js +5 -36
  51. package/dist/foundation/launch-context/index.d.ts +0 -12
  52. package/dist/foundation/launch-context/index.js +0 -26
  53. package/dist/foundation/lifecycle/claim-gate.d.ts +8 -0
  54. package/dist/foundation/lifecycle/claim-gate.js +37 -0
  55. package/dist/foundation/lifecycle/index.d.ts +5 -9
  56. package/dist/foundation/lifecycle/index.js +3 -4
  57. package/dist/foundation/lifecycle/model.d.ts +2 -59
  58. package/dist/foundation/lifecycle/model.js +0 -35
  59. package/dist/foundation/lifecycle/paths.d.ts +0 -24
  60. package/dist/foundation/lifecycle/paths.js +0 -40
  61. package/dist/foundation/lifecycle/process-liveness.d.ts +8 -0
  62. package/dist/foundation/lifecycle/process-liveness.js +18 -0
  63. package/dist/foundation/lifecycle/session-claim-lock.d.ts +1 -1
  64. package/dist/foundation/lifecycle/session-claim-lock.js +2 -2
  65. package/dist/foundation/lifecycle/session-repository-context.d.ts +6 -6
  66. package/dist/foundation/lifecycle/session-repository-context.js +2 -3
  67. package/dist/foundation/release/automatic-update.d.ts +1 -3
  68. package/dist/foundation/release/automatic-update.js +9 -30
  69. package/dist/foundation/release/bootstrap.d.ts +2 -25
  70. package/dist/foundation/release/bootstrap.js +33 -344
  71. package/dist/foundation/release/cohort-state.d.ts +21 -46
  72. package/dist/foundation/release/cohort-state.js +30 -62
  73. package/dist/foundation/release/dependency-certification.d.ts +1 -1
  74. package/dist/foundation/release/index.d.ts +10 -17
  75. package/dist/foundation/release/index.js +7 -11
  76. package/dist/foundation/release/latest-release.d.ts +1 -2
  77. package/dist/foundation/release/latest-release.js +1 -2
  78. package/dist/foundation/release/process-liveness.d.ts +2 -0
  79. package/dist/foundation/release/process-liveness.js +12 -0
  80. package/dist/foundation/release/release-gc.d.ts +12 -9
  81. package/dist/foundation/release/release-gc.js +34 -98
  82. package/dist/foundation/release/release-store.d.ts +2 -2
  83. package/dist/foundation/release/release-store.js +2 -2
  84. package/dist/foundation/release/restart-certification.js +1 -1
  85. package/dist/foundation/release/update-activation.d.ts +2 -9
  86. package/dist/foundation/release/update-activation.js +28 -43
  87. package/dist/foundation/release/update-execution-lease.js +1 -1
  88. package/dist/foundation/release/update-launch.d.ts +0 -2
  89. package/dist/foundation/release/update-launch.js +0 -7
  90. package/dist/foundation/release/update-recovery.js +1 -1
  91. package/dist/foundation/release/update-transaction.d.ts +1 -1
  92. package/dist/foundation/release/update-transaction.js +5 -2
  93. package/dist/foundation/release/update.d.ts +2 -10
  94. package/dist/foundation/release/update.js +23 -200
  95. package/dist/foundation/session-writer-lock/index.d.ts +14 -6
  96. package/dist/foundation/session-writer-lock/index.js +48 -103
  97. package/dist/foundation/startup/startup-runtime.d.ts +1 -1
  98. package/dist/foundation/terminal-cleanup/exit-notice.d.ts +6 -0
  99. package/dist/foundation/terminal-cleanup/exit-notice.js +36 -0
  100. package/dist/foundation/terminal-cleanup/index.d.ts +2 -1
  101. package/dist/foundation/terminal-cleanup/index.js +2 -1
  102. package/dist/foundation/terminal-cleanup/terminal-reset.d.ts +0 -5
  103. package/dist/foundation/terminal-cleanup/terminal-reset.js +0 -5
  104. package/dist/integrations/pi/components/index.d.ts +1 -1
  105. package/dist/integrations/pi/components/index.js +1 -1
  106. package/dist/integrations/pi/components/shell-editor-autocomplete.js +1 -4
  107. package/dist/integrations/pi/components/shell-footer-status.d.ts +1 -1
  108. package/dist/integrations/pi/components/shell-footer-status.js +2 -2
  109. package/dist/integrations/pi/components/shell-hotkey-sections.js +1 -1
  110. package/dist/integrations/pi/components/shell-presenters-info.d.ts +2 -5
  111. package/dist/integrations/pi/components/shell-presenters-info.js +4 -18
  112. package/dist/integrations/pi/components/shell-presenters-transcript.d.ts +1 -1
  113. package/dist/integrations/pi/components/shell-presenters-transcript.js +1 -1
  114. package/dist/integrations/pi/components/shell-shared-facade.d.ts +0 -2
  115. package/dist/integrations/pi/components/submitted-prompt-adapter.d.ts +2 -5
  116. package/dist/integrations/pi/components/submitted-prompt-adapter.js +2 -16
  117. package/dist/integrations/pi/components/upstream/components/session-footer.d.ts +1 -2
  118. package/dist/integrations/pi/components/upstream/components/session-footer.js +6 -8
  119. package/dist/integrations/pi/engine/adapter.d.ts +0 -1
  120. package/dist/integrations/pi/engine/adapter.js +1 -16
  121. package/dist/integrations/pi/engine/compaction-progress.js +13 -5
  122. package/dist/integrations/pi/engine/diagnostics-state.d.ts +0 -1
  123. package/dist/integrations/pi/engine/diagnostics-state.js +0 -14
  124. package/dist/integrations/pi/engine/prompt-suggestions.d.ts +0 -1
  125. package/dist/integrations/pi/engine/prompt-suggestions.js +0 -40
  126. package/dist/integrations/pi/engine/session-runtime.js +0 -2
  127. package/dist/integrations/pi/engine/workflow-runner.js +1 -1
  128. package/dist/integrations/pi/tui-runtime/adapter.d.ts +2 -2
  129. package/dist/integrations/pi/tui-runtime/adapter.js +2 -2
  130. package/dist/product-identity.d.ts +4 -6
  131. package/dist/product-identity.js +6 -11
  132. package/dist/product-identity.json +1 -40
  133. package/dist/runtime-payload-inventory.json +0 -3
  134. package/dist/ui/components/index.d.ts +2 -2
  135. package/dist/ui/components/index.js +1 -1
  136. package/dist/ui/components/submitted-prompt.d.ts +3 -13
  137. package/dist/ui/components/submitted-prompt.js +8 -41
  138. package/dist/ui/components/transcript-viewport.d.ts +1 -3
  139. package/dist/ui/components/transcript-viewport.js +1 -4
  140. package/dist/ui/settings/declarations.d.ts +3 -97
  141. package/dist/ui/settings/declarations.js +3 -78
  142. package/dist/ui/settings/migrations.js +18 -2
  143. package/docs/architecture/boundaries.md +22 -39
  144. package/docs/architecture/code-documentation.md +2 -2
  145. package/docs/architecture/internal-naming.md +9 -17
  146. package/docs/architecture/project-structure.md +30 -29
  147. package/docs/architecture/resource-and-data-policy.md +16 -31
  148. package/docs/architecture/toolchain.md +14 -19
  149. package/docs/architecture/ui-reference-provenance.md +2 -2
  150. package/docs/ci-release-runbook.md +6 -4
  151. package/docs/features/launch-profiles.md +11 -17
  152. package/docs/features/prompt-history.md +10 -11
  153. package/docs/local-worktree-cleanup.md +32 -1
  154. package/docs/manual-owned-ui-checkpoint.md +0 -1
  155. package/docs/openspec-archive-automation.md +11 -3
  156. package/docs/validation.md +5 -9
  157. package/docs/worktree-link-recovery.md +6 -6
  158. package/package.json +7 -19
  159. package/bin/guardian.js +0 -42
  160. package/bin/supervisor.js +0 -7
  161. package/bin/tab-launch-context.d.ts +0 -27
  162. package/bin/tab-launch-context.js +0 -94
  163. package/dist/app/session-shell/resident-tab-coordinator.d.ts +0 -38
  164. package/dist/app/session-shell/resident-tab-coordinator.js +0 -77
  165. package/dist/cli/tabs-request.d.ts +0 -7
  166. package/dist/cli/tabs-request.js +0 -1
  167. package/dist/cli/tabs.d.ts +0 -14
  168. package/dist/cli/tabs.js +0 -151
  169. package/dist/composition/resident-tab-bridge.d.ts +0 -41
  170. package/dist/composition/resident-tab-bridge.js +0 -209
  171. package/dist/composition/utility-tab.d.ts +0 -28
  172. package/dist/composition/utility-tab.js +0 -244
  173. package/dist/features/owned-ui/plus-menu-dialog.d.ts +0 -28
  174. package/dist/features/owned-ui/plus-menu-dialog.js +0 -89
  175. package/dist/features/resident-tab/auto-name.d.ts +0 -11
  176. package/dist/features/resident-tab/auto-name.js +0 -44
  177. package/dist/features/resident-tab/index.d.ts +0 -5
  178. package/dist/features/resident-tab/index.js +0 -7
  179. package/dist/features/resident-tab/shortcut-bindings-file.d.ts +0 -8
  180. package/dist/features/resident-tab/shortcut-bindings-file.js +0 -40
  181. package/dist/features/resident-tab/shortcut-declarations.d.ts +0 -13
  182. package/dist/features/resident-tab/shortcut-declarations.js +0 -26
  183. package/dist/features/resident-tab/shortcut-projection.d.ts +0 -29
  184. package/dist/features/resident-tab/shortcut-projection.js +0 -64
  185. package/dist/features/resident-tab/status-deriver.d.ts +0 -10
  186. package/dist/features/resident-tab/status-deriver.js +0 -12
  187. package/dist/foundation/launch-guardian/exit-watcher.d.ts +0 -14
  188. package/dist/foundation/launch-guardian/exit-watcher.js +0 -103
  189. package/dist/foundation/launch-guardian/index.d.ts +0 -2
  190. package/dist/foundation/launch-guardian/index.js +0 -1
  191. package/dist/foundation/launch-guardian/main.d.ts +0 -39
  192. package/dist/foundation/launch-guardian/main.js +0 -232
  193. package/dist/foundation/lifecycle/commands.d.ts +0 -40
  194. package/dist/foundation/lifecycle/commands.js +0 -1
  195. package/dist/foundation/lifecycle/launch-instance.d.ts +0 -46
  196. package/dist/foundation/lifecycle/launch-instance.js +0 -134
  197. package/dist/foundation/lifecycle/native-claim-gate.d.ts +0 -5
  198. package/dist/foundation/lifecycle/native-claim-gate.js +0 -41
  199. package/dist/foundation/lifecycle/supervisor-startup.d.ts +0 -30
  200. package/dist/foundation/lifecycle/supervisor-startup.js +0 -106
  201. package/dist/foundation/process-containment/addon-containment.d.ts +0 -20
  202. package/dist/foundation/process-containment/addon-containment.js +0 -139
  203. package/dist/foundation/process-containment/addon-process-inspector.d.ts +0 -11
  204. package/dist/foundation/process-containment/addon-process-inspector.js +0 -36
  205. package/dist/foundation/process-containment/addon.d.ts +0 -47
  206. package/dist/foundation/process-containment/addon.js +0 -57
  207. package/dist/foundation/process-containment/artifact.d.ts +0 -1
  208. package/dist/foundation/process-containment/artifact.js +0 -35
  209. package/dist/foundation/process-containment/contracts.d.ts +0 -33
  210. package/dist/foundation/process-containment/contracts.js +0 -35
  211. package/dist/foundation/process-containment/index.d.ts +0 -9
  212. package/dist/foundation/process-containment/index.js +0 -7
  213. package/dist/foundation/process-containment/linux-process-inspector.d.ts +0 -7
  214. package/dist/foundation/process-containment/linux-process-inspector.js +0 -27
  215. package/dist/foundation/process-containment/native-process-inspector.d.ts +0 -4
  216. package/dist/foundation/process-containment/native-process-inspector.js +0 -21
  217. package/dist/foundation/protocol/client.d.ts +0 -18
  218. package/dist/foundation/protocol/client.js +0 -130
  219. package/dist/foundation/protocol/index.d.ts +0 -3
  220. package/dist/foundation/protocol/index.js +0 -2
  221. package/dist/foundation/protocol/messages.d.ts +0 -90
  222. package/dist/foundation/protocol/messages.js +0 -100
  223. package/dist/foundation/release/cohort-selection.d.ts +0 -33
  224. package/dist/foundation/release/cohort-selection.js +0 -67
  225. package/dist/foundation/release/endpoint-lock.d.ts +0 -2
  226. package/dist/foundation/release/endpoint-lock.js +0 -37
  227. package/dist/foundation/release/endpoint-recovery.d.ts +0 -10
  228. package/dist/foundation/release/endpoint-recovery.js +0 -45
  229. package/dist/foundation/release/endpoints.d.ts +0 -32
  230. package/dist/foundation/release/endpoints.js +0 -152
  231. package/dist/foundation/release/prepared-update-activation.d.ts +0 -3
  232. package/dist/foundation/release/prepared-update-activation.js +0 -27
  233. package/dist/foundation/release/process-cleanup.d.ts +0 -14
  234. package/dist/foundation/release/process-cleanup.js +0 -76
  235. package/dist/foundation/release/supervisor-identity.d.ts +0 -15
  236. package/dist/foundation/release/supervisor-identity.js +0 -63
  237. package/dist/foundation/resident-tabs/boot-identity.d.ts +0 -6
  238. package/dist/foundation/resident-tabs/boot-identity.js +0 -16
  239. package/dist/foundation/resident-tabs/bounded-host-command.d.ts +0 -20
  240. package/dist/foundation/resident-tabs/bounded-host-command.js +0 -62
  241. package/dist/foundation/resident-tabs/bridge-client.d.ts +0 -73
  242. package/dist/foundation/resident-tabs/bridge-client.js +0 -327
  243. package/dist/foundation/resident-tabs/continuity.d.ts +0 -12
  244. package/dist/foundation/resident-tabs/continuity.js +0 -63
  245. package/dist/foundation/resident-tabs/doctor.d.ts +0 -28
  246. package/dist/foundation/resident-tabs/doctor.js +0 -166
  247. package/dist/foundation/resident-tabs/draft-checkpoint.d.ts +0 -27
  248. package/dist/foundation/resident-tabs/draft-checkpoint.js +0 -145
  249. package/dist/foundation/resident-tabs/ensure-terminal-host.d.ts +0 -36
  250. package/dist/foundation/resident-tabs/ensure-terminal-host.js +0 -151
  251. package/dist/foundation/resident-tabs/fault-injection.d.ts +0 -8
  252. package/dist/foundation/resident-tabs/fault-injection.js +0 -26
  253. package/dist/foundation/resident-tabs/fixture-control.d.ts +0 -7
  254. package/dist/foundation/resident-tabs/fixture-control.js +0 -35
  255. package/dist/foundation/resident-tabs/host-entry.d.ts +0 -1
  256. package/dist/foundation/resident-tabs/host-entry.js +0 -17
  257. package/dist/foundation/resident-tabs/index.d.ts +0 -15
  258. package/dist/foundation/resident-tabs/index.js +0 -10
  259. package/dist/foundation/resident-tabs/maintenance.d.ts +0 -39
  260. package/dist/foundation/resident-tabs/maintenance.js +0 -75
  261. package/dist/foundation/resident-tabs/progress-observation-schema.d.ts +0 -34
  262. package/dist/foundation/resident-tabs/progress-observation-schema.js +0 -1
  263. package/dist/foundation/resident-tabs/progress-observation.d.ts +0 -4
  264. package/dist/foundation/resident-tabs/progress-observation.js +0 -150
  265. package/dist/foundation/resident-tabs/prompt-journal.d.ts +0 -63
  266. package/dist/foundation/resident-tabs/prompt-journal.js +0 -213
  267. package/dist/foundation/resident-tabs/protocol.d.ts +0 -12
  268. package/dist/foundation/resident-tabs/protocol.js +0 -195
  269. package/dist/foundation/resident-tabs/recovery.d.ts +0 -26
  270. package/dist/foundation/resident-tabs/recovery.js +0 -205
  271. package/dist/foundation/resident-tabs/release-holds.d.ts +0 -28
  272. package/dist/foundation/resident-tabs/release-holds.js +0 -78
  273. package/dist/foundation/resident-tabs/routes.d.ts +0 -5
  274. package/dist/foundation/resident-tabs/routes.js +0 -5
  275. package/dist/foundation/resident-tabs/routing.d.ts +0 -11
  276. package/dist/foundation/resident-tabs/routing.js +0 -10
  277. package/dist/foundation/resident-tabs/runtime-control.d.ts +0 -38
  278. package/dist/foundation/resident-tabs/runtime-control.js +0 -74
  279. package/dist/foundation/resident-tabs/session-sync.d.ts +0 -14
  280. package/dist/foundation/resident-tabs/session-sync.js +0 -37
  281. package/dist/foundation/resident-tabs/settings.d.ts +0 -16
  282. package/dist/foundation/resident-tabs/settings.js +0 -60
  283. package/dist/foundation/resident-tabs/terminal-host-artifact.d.ts +0 -14
  284. package/dist/foundation/resident-tabs/terminal-host-artifact.js +0 -78
  285. package/dist/foundation/resident-tabs/zip-archive.d.ts +0 -9
  286. package/dist/foundation/resident-tabs/zip-archive.js +0 -56
  287. package/dist/foundation/storage/control-store.d.ts +0 -20
  288. package/dist/foundation/storage/control-store.js +0 -331
  289. package/dist/foundation/storage/index.d.ts +0 -1
  290. package/dist/foundation/storage/index.js +0 -1
  291. package/dist/foundation/supervision/index.d.ts +0 -3
  292. package/dist/foundation/supervision/index.js +0 -3
  293. package/dist/foundation/supervision/main.d.ts +0 -1
  294. package/dist/foundation/supervision/main.js +0 -86
  295. package/dist/foundation/supervision/paths.d.ts +0 -1
  296. package/dist/foundation/supervision/paths.js +0 -1
  297. package/dist/foundation/supervision/server.d.ts +0 -46
  298. package/dist/foundation/supervision/server.js +0 -606
  299. package/dist/integrations/pi/engine/offline-settings-port.d.ts +0 -23
  300. package/dist/integrations/pi/engine/offline-settings-port.js +0 -54
  301. package/dist/native/darwin-arm64/manifest.json +0 -23
  302. package/dist/native/darwin-arm64/process-guardian.node +0 -0
  303. package/dist/native/darwin-arm64/terminal-host-THIRD-PARTY-NOTICES.txt +0 -10500
  304. package/dist/native/darwin-arm64/terminal-host.manifest.json +0 -46
  305. package/dist/native/darwin-arm64/terminal-host.node +0 -0
  306. package/dist/native/darwin-x64/manifest.json +0 -23
  307. package/dist/native/darwin-x64/process-guardian.node +0 -0
  308. package/dist/native/darwin-x64/terminal-host-THIRD-PARTY-NOTICES.txt +0 -10737
  309. package/dist/native/darwin-x64/terminal-host.manifest.json +0 -46
  310. package/dist/native/darwin-x64/terminal-host.node +0 -0
  311. package/dist/native/linux-x64/manifest.json +0 -23
  312. package/dist/native/linux-x64/process-guardian.node +0 -0
  313. package/dist/native/linux-x64/terminal-host-THIRD-PARTY-NOTICES.txt +0 -11226
  314. package/dist/native/linux-x64/terminal-host.manifest.json +0 -46
  315. package/dist/native/linux-x64/terminal-host.node +0 -0
  316. package/dist/native/win32-x64/manifest.json +0 -23
  317. package/dist/native/win32-x64/process-guardian.node +0 -0
  318. package/dist/native/win32-x64/terminal-host-THIRD-PARTY-NOTICES.txt +0 -10757
  319. package/dist/native/win32-x64/terminal-host.manifest.json +0 -46
  320. package/dist/native/win32-x64/terminal-host.node +0 -0
  321. package/docs/architecture/evidence/resident-tabs/linux-x64.md +0 -37
  322. package/docs/architecture/evidence/resident-tabs/macos-arm64.md +0 -36
  323. package/docs/architecture/evidence/resident-tabs/macos-x64.md +0 -35
  324. package/docs/architecture/evidence/resident-tabs/windows-x64.md +0 -36
  325. package/docs/architecture/evidence/terminal-host-spike/manual-one-pane-terminal-host.md +0 -70
  326. package/docs/architecture/evidence/terminal-host-spike/manual-two-by-two-basic-terminal-host.md +0 -32
  327. package/docs/architecture/evidence/terminal-host-spike/milestone-baseline.json +0 -115
  328. package/docs/architecture/evidence/terminal-host-spike/owned-ui-foundation-prerequisite.json +0 -48
  329. package/docs/architecture/evidence/terminal-host-spike/terminal-host-provenance.json +0 -125
  330. package/docs/architecture/evidence/terminal-host-spike/terminal-host-task-5-1.json +0 -56
  331. package/docs/architecture/evidence/terminal-host-spike/terminal-host-task-5-3.json +0 -174
  332. package/docs/architecture/evidence/terminal-host-spike/terminal-spike-acceptance-record.json +0 -18
  333. package/docs/architecture/native-fixture-isolation.md +0 -23
  334. package/docs/architecture/process-guardian-provenance.md +0 -36
  335. package/docs/architecture/resident-tabs-requirements.md +0 -18
  336. package/docs/architecture/resident-tabs.md +0 -668
  337. package/docs/architecture/terminal-host-proof-gate.md +0 -34
  338. package/docs/architecture/terminal-host-provenance.md +0 -81
  339. package/docs/architecture/terminal-host-spike-evidence.md +0 -39
  340. package/docs/launch-recovery.md +0 -23
  341. package/docs/manual-launch-instance-acceptance.md +0 -43
  342. package/docs/manual-resident-tabs-acceptance.md +0 -51
@@ -1,28 +0,0 @@
1
- import type { OwnedUiApplicationPort, PresentationTerminalPort } from "../contracts/presentation/index.js";
2
- import type { TabBridgeClient } from "../foundation/resident-tabs/bridge-client.js";
3
- import type { ResidentTabRoute } from "../foundation/resident-tabs/routes.js";
4
- import type { ReleaseNoteCatalog } from "../features/owned-ui/release-notes.js";
5
- import type { UiRouteHost } from "../ui/apps/contracts.js";
6
- import type { OwnedSettingsManager } from "../ui/settings/manager.js";
7
- import { terminateOwnedUiProcess } from "../features/owned-ui/run.js";
8
- export { terminateOwnedUiProcess };
9
- export interface UtilityTabOptions {
10
- readonly route: ResidentTabRoute;
11
- readonly bridge: TabBridgeClient;
12
- readonly cwd?: string;
13
- readonly profileId?: string;
14
- readonly terminal?: PresentationTerminalPort;
15
- readonly agentDir?: string;
16
- readonly settings?: OwnedSettingsManager;
17
- readonly routeHost?: UiRouteHost;
18
- readonly releaseNotes?: ReleaseNoteCatalog;
19
- readonly onApplication?: (application: OwnedUiApplicationPort) => void;
20
- }
21
- export interface UtilityTabComposition {
22
- readonly application: OwnedUiApplicationPort;
23
- readonly settings: OwnedSettingsManager;
24
- }
25
- /** Runs one pinned Settings or Changelog screen without constructing an Agent engine or session. */
26
- export declare function runUtilityTab(options: UtilityTabOptions): Promise<number>;
27
- export declare function composeUtilityTab(options: UtilityTabOptions): Promise<UtilityTabComposition>;
28
- export declare function utilityAgentDir(environment?: NodeJS.ProcessEnv): string;
@@ -1,244 +0,0 @@
1
- import { homedir } from "node:os";
2
- import { resolve } from "node:path";
3
- import { MAX_CLIPBOARD_TEXT_BYTES } from "../contracts/owned-ui/index.js";
4
- import { writeSystemClipboardText } from "../app/session-shell/system-clipboard.js";
5
- import { OwnedUiTerminalHost, } from "../app/session-shell/shell-host.js";
6
- import { nativeHyperlinkStyle } from "../ui/components/spans.js";
7
- import { createPiKeybindingsHost } from "../integrations/pi/components/shell-shared-facade.js";
8
- import { applyConfiguredPiTheme, setPiAccentColor, setPiPackageBorderProjectionEnabled } from "../integrations/pi/components/upstream/theme/theme.js";
9
- import { createPiTerminalBridge } from "../integrations/pi/tui-runtime/presentation-adapter.js";
10
- import { resolveLaunchProfilePaths } from "../features/launch/profile-paths.js";
11
- import { createOwnedSettingsManager, watchSharedSettings } from "./owned-settings.js";
12
- import { residentRouteHostOptions, residentTabKeybindings } from "./resident-tab-bridge.js";
13
- import { createOwnedRouteHost } from "./settings-route-host.js";
14
- import { runOwnedUi, terminateOwnedUiProcess } from "../features/owned-ui/run.js";
15
- export { terminateOwnedUiProcess };
16
- /** Runs one pinned Settings or Changelog screen without constructing an Agent engine or session. */
17
- export async function runUtilityTab(options) {
18
- const composition = await composeUtilityTab(options);
19
- options.onApplication?.(composition.application);
20
- return await runOwnedUi(composition);
21
- }
22
- export async function composeUtilityTab(options) {
23
- const cwd = options.cwd ?? process.cwd();
24
- const agentDir = options.agentDir ?? utilityAgentDir();
25
- const { settings, offline } = await prepareUtilitySettings(options, cwd, agentDir);
26
- await options.bridge.start().catch(() => false);
27
- options.bridge.status("starting");
28
- applyUtilityTheme(settings, options.bridge);
29
- const keybindings = residentTabKeybindings(options.bridge, agentDir, createPiKeybindingsHost({ profile: "a1", agentDir }));
30
- const routeHost = options.routeHost ?? createUtilityRouteHost(options, settings, keybindings, cwd, agentDir);
31
- return {
32
- settings,
33
- application: createUtilityApplication(options, settings, offline, routeHost),
34
- };
35
- }
36
- async function prepareUtilitySettings(options, cwd, agentDir) {
37
- const offline = options.settings === undefined && options.route === "settings"
38
- ? await import("../integrations/pi/engine/offline-settings-port.js")
39
- .then(module => module.createOfflinePiSettingsPort({ cwd, agentDir }))
40
- : null;
41
- return {
42
- offline,
43
- settings: options.settings ?? createOwnedSettingsManager({
44
- profileId: options.profileId ?? "a1",
45
- agent: offline?.port ?? null,
46
- }),
47
- };
48
- }
49
- function applyUtilityTheme(settings, bridge) {
50
- setPiPackageBorderProjectionEnabled(true);
51
- setPiAccentColor(settings.value("accentColor"));
52
- applyConfiguredPiTheme("dark");
53
- bridge.accent(settings.value("accentColor"));
54
- }
55
- function createUtilityRouteHost(options, settings, keybindings, cwd, agentDir) {
56
- let catalog;
57
- const releaseNoteCatalog = () => catalog ??= options.releaseNotes === undefined
58
- ? import("../features/owned-ui/release-notes.js").then(module => module.readPackagedReleaseNotes())
59
- : Promise.resolve(options.releaseNotes);
60
- return pinnedRouteHost(options.route, createOwnedRouteHost(settings, {
61
- changelog: async () => {
62
- const [notes, { renderPiShellChangelogLines }] = await Promise.all([
63
- releaseNoteCatalog(),
64
- import("../integrations/pi/components/shell-presenters-info.js"),
65
- ]);
66
- return { rows: width => renderPiShellChangelogLines(notes.completeMarkdown, width).map(row => nativeHyperlinkStyle(row)) };
67
- },
68
- hotkeys: async () => { throw new Error("hotkeys are unavailable in a utility tab"); },
69
- session: async () => { throw new Error("session information is unavailable in a utility tab"); },
70
- }, {
71
- ...residentRouteHostOptions(options.bridge),
72
- keybindings,
73
- agentDir,
74
- cwd,
75
- copyText: text => {
76
- if (Buffer.byteLength(text) > MAX_CLIPBOARD_TEXT_BYTES)
77
- return false;
78
- void writeSystemClipboardText(text).catch(() => { });
79
- return true;
80
- },
81
- }));
82
- }
83
- function createUtilityApplication(options, settings, offline, routeHost) {
84
- const backgroundSettings = {
85
- snapshot: () => settings.value("backgroundStyle"),
86
- onChange: listener => settings.onChange(current => listener(current.value("backgroundStyle"))),
87
- };
88
- const terminalHost = new OwnedUiTerminalHost({
89
- layout: "custom-viewport", mode: "fullscreen", hardwareCursor: false,
90
- ...(options.terminal === undefined ? {} : { terminal: createPiTerminalBridge(options.terminal) }),
91
- backgroundSettings,
92
- });
93
- const presenter = new UtilityTabPresenter(terminalHost, routeHost, options.route, options.bridge);
94
- const removeBoundaryInput = terminalHost.runtime.addPreInputListener(data => ({ data: options.bridge.consumeControllerBoundaryInput(data) }));
95
- const unwatchSettings = watchSharedSettings(settings);
96
- const unsubscribeAccent = settings.onChange(current => {
97
- const accent = current.value("accentColor");
98
- setPiAccentColor(accent);
99
- options.bridge.accent(accent);
100
- });
101
- let disposed = false;
102
- let started = false;
103
- let stopResolve;
104
- let unsubscribeBridge = () => { };
105
- const stopped = new Promise(resolvePromise => { stopResolve = resolvePromise; });
106
- return {
107
- get disposed() { return disposed; },
108
- start: () => {
109
- if (started || disposed)
110
- return;
111
- started = true;
112
- presenter.start();
113
- terminalHost.attach(presenter);
114
- unsubscribeBridge = options.bridge.onCommand(command => handleBridgeCommand(command, presenter, options.route, () => {
115
- stopResolve();
116
- void terminalHost.dispose().catch(() => undefined);
117
- }));
118
- options.bridge.status("idle");
119
- void offline?.modelsReady.then(() => settings.load()).catch(() => undefined);
120
- },
121
- flush: async () => { },
122
- waitUntilStopped: () => stopped,
123
- dispose: async () => {
124
- if (disposed)
125
- return;
126
- disposed = true;
127
- stopResolve();
128
- unsubscribeBridge();
129
- unsubscribeAccent();
130
- unwatchSettings();
131
- removeBoundaryInput();
132
- try {
133
- await terminalHost.dispose();
134
- }
135
- finally {
136
- options.bridge.close();
137
- }
138
- },
139
- };
140
- }
141
- function pinnedRouteHost(route, host) {
142
- return {
143
- claims: candidate => candidate === route && host.claims(candidate),
144
- open: (candidate, input) => candidate === route ? host.open(candidate, input) : null,
145
- };
146
- }
147
- function handleBridgeCommand(command, presenter, route, stop) {
148
- if (command.type === "stop")
149
- stop();
150
- else if (command.type === "route" && command.route === route)
151
- presenter.presentRoute();
152
- }
153
- export function utilityAgentDir(environment = process.env) {
154
- const configured = environment.PI_CODING_AGENT_DIR;
155
- if (configured !== undefined && configured.trim().length > 0) {
156
- return resolve(configured.startsWith("~/") || configured.startsWith("~\\")
157
- ? `${homedir()}${configured.slice(1)}`
158
- : configured);
159
- }
160
- return resolveLaunchProfilePaths().agentProfile;
161
- }
162
- class UtilityTabPresenter {
163
- #host;
164
- #terminal;
165
- #routeHost;
166
- #route;
167
- #bridge;
168
- #surface = null;
169
- #routeHandle = null;
170
- #released = false;
171
- constructor(host, routeHost, route, bridge) {
172
- this.#host = host;
173
- this.#routeHost = routeHost;
174
- this.#route = route;
175
- this.#bridge = bridge;
176
- this.#terminal = host.connect(this);
177
- }
178
- render(_width) { return []; }
179
- handleInput(_data) { }
180
- invalidate() { this.#terminal.requestRender(); }
181
- setFocused(_focused) { }
182
- inputCoordinationSurface() { return "owned"; }
183
- setOverlaySurfaces(_surfaces) { }
184
- noteImmediatePresentation() { }
185
- handleViewportInput(_data) { return undefined; }
186
- layoutPart(_part) { return EMPTY_COMPONENT; }
187
- activated() { this.presentRoute(); }
188
- start() { this.#terminal.start(); }
189
- waitUntilStopped() { return new Promise(() => { }); }
190
- dispose() { return this.#host.close(this); }
191
- presentRoute() {
192
- if (this.#released || this.#routeHandle !== null)
193
- return;
194
- if (!this.#terminal.running || !this.#terminal.attached)
195
- return;
196
- const surface = this.#routeHost.open(this.#route);
197
- if (surface === null)
198
- throw new Error(`utility route is unavailable: ${this.#route}`);
199
- this.#surface = surface;
200
- let exitRequested = false;
201
- const handle = this.#terminal.openRoute(surface, {
202
- closed: rendered => {
203
- if (this.#routeHandle === handle)
204
- this.#routeHandle = null;
205
- this.#surface = null;
206
- queueMicrotask(() => {
207
- if (rendered && !exitRequested)
208
- void this.#bridge.requestClose();
209
- });
210
- },
211
- exit: () => {
212
- exitRequested = true;
213
- void this.#bridge.requestDetach().then(() => this.presentRoute(), () => this.presentRoute());
214
- },
215
- });
216
- this.#routeHandle = handle;
217
- }
218
- release() {
219
- if (this.#released)
220
- return { exitText: "", failures: [], settle: async () => [] };
221
- this.#released = true;
222
- const failures = [];
223
- try {
224
- this.#routeHandle?.hide();
225
- }
226
- catch (error) {
227
- failures.push(error);
228
- }
229
- try {
230
- this.#surface?.close();
231
- }
232
- catch (error) {
233
- failures.push(error);
234
- }
235
- this.#routeHandle = null;
236
- this.#surface = null;
237
- return { exitText: "", failures, settle: async () => [] };
238
- }
239
- }
240
- const EMPTY_COMPONENT = {
241
- render: () => [],
242
- handleInput: () => { },
243
- invalidate: () => { },
244
- };
@@ -1,28 +0,0 @@
1
- import type { UiTheme } from "../../ui/components/index.js";
2
- /** The A1 setting holding the tab kinds the strip's `+` offers. */
3
- export declare const PLUS_MENU_SETTING_ID = "tabBarPlusMenu";
4
- /** One tab kind the plus menu can offer. */
5
- export interface PlusMenuKind {
6
- readonly key: string;
7
- readonly label: string;
8
- }
9
- /** Presentation copy for a searchable ordered flag multi-select dialog. */
10
- export interface FlagToggleDialogPresentation {
11
- readonly title: string;
12
- readonly description: string;
13
- readonly empty: string;
14
- }
15
- /** Owns only filtering and selection; the Settings screen owns enabled state and persistence. */
16
- export declare class FlagToggleDialog {
17
- #private;
18
- constructor(kinds: readonly PlusMenuKind[], presentation: FlagToggleDialogPresentation);
19
- /** The kinds the filter keeps, in kind order. */
20
- shown(): readonly PlusMenuKind[];
21
- /** Handles one key by its resolved name; `toggle` flips a kind. Returns whether the dialog closed. */
22
- handle(name: string, data: string, toggle: (key: string) => void): "close" | "handled";
23
- lines(enabled: Readonly<Record<string, boolean | string>>, width: number, theme: UiTheme): readonly string[];
24
- }
25
- /** The tab bar's specialized flag dialog, retained as the public Plus Menu surface. */
26
- export declare class PlusMenuDialog extends FlagToggleDialog {
27
- constructor(kinds: readonly PlusMenuKind[]);
28
- }
@@ -1,89 +0,0 @@
1
- import { LineInput, handleLineInputKey, padToWidth, renderInputRow, renderShortcutHintsWithClose, truncateToWidth, } from "../../ui/components/index.js";
2
- /** The A1 setting holding the tab kinds the strip's `+` offers. */
3
- export const PLUS_MENU_SETTING_ID = "tabBarPlusMenu";
4
- const PLUS_MENU_PRESENTATION = Object.freeze({
5
- title: "Plus Menu",
6
- description: "Choose what the + button in the tab bar can add.",
7
- empty: "No tabs match",
8
- });
9
- const HINTS = [
10
- { key: "Type", action: "search" },
11
- { key: "↑↓", action: "navigate" },
12
- { key: "Space", action: "toggle" },
13
- { key: "esc", action: "close" },
14
- ];
15
- const PADDING_X = 2;
16
- /** Owns only filtering and selection; the Settings screen owns enabled state and persistence. */
17
- export class FlagToggleDialog {
18
- #kinds;
19
- #presentation;
20
- #filter = new LineInput("");
21
- #index = 0;
22
- constructor(kinds, presentation) {
23
- this.#kinds = kinds;
24
- this.#presentation = presentation;
25
- }
26
- /** The kinds the filter keeps, in kind order. */
27
- shown() {
28
- const needle = this.#filter.value.trim().toLowerCase();
29
- return this.#kinds.filter(kind => needle.length === 0 || kind.label.toLowerCase().includes(needle));
30
- }
31
- /** Handles one key by its resolved name; `toggle` flips a kind. Returns whether the dialog closed. */
32
- handle(name, data, toggle) {
33
- const shown = this.shown();
34
- if (name === "escape")
35
- return "close";
36
- if (name === "up" || name === "down") {
37
- this.#index = Math.min(Math.max(0, shown.length - 1), Math.max(0, this.#index + (name === "down" ? 1 : -1)));
38
- return "handled";
39
- }
40
- if (name === "space") {
41
- const kind = shown[this.#index];
42
- if (kind !== undefined)
43
- toggle(kind.key);
44
- return "handled";
45
- }
46
- handleLineInputKey(this.#filter, data);
47
- this.#index = 0;
48
- return "handled";
49
- }
50
- lines(enabled, width, theme) {
51
- const frameWidth = Math.max(0, width);
52
- const left = Math.min(PADDING_X, frameWidth);
53
- const right = Math.min(PADDING_X, frameWidth - left);
54
- const contentWidth = Math.max(0, frameWidth - left - right);
55
- const blank = " ".repeat(frameWidth);
56
- const row = (painted, selected = false) => {
57
- const content = padToWidth(truncateToWidth(painted, contentWidth), contentWidth);
58
- const rightPadding = " ".repeat(right);
59
- return `${" ".repeat(left)}${selected ? theme.highlight(content) : content}${selected ? theme.panel(rightPadding) : rightPadding}`;
60
- };
61
- const shown = this.shown();
62
- const index = Math.min(this.#index, Math.max(0, shown.length - 1));
63
- const rows = shown.length === 0
64
- ? [row(theme.fg("dim", this.#presentation.empty))]
65
- : shown.map((kind, position) => {
66
- const selected = position === index;
67
- const cursor = selected ? "→ " : " ";
68
- const marker = enabled[kind.key] === true ? "●" : "○";
69
- const content = `${selected ? theme.fg("accent", cursor) : cursor}${theme.fg("text", marker)} ${theme.fg("text", kind.label)}`;
70
- return row(content, selected);
71
- });
72
- return [
73
- blank,
74
- row(theme.bold(theme.fg("accent", this.#presentation.title))),
75
- row(theme.fg("dim", this.#presentation.description)),
76
- blank,
77
- ...renderInputRow(this.#filter, contentWidth, { ruled: false, promptGlyph: "> ", theme }).lines.map(line => row(line)),
78
- blank,
79
- ...rows,
80
- blank,
81
- row(renderShortcutHintsWithClose(HINTS, theme, contentWidth)),
82
- blank,
83
- ];
84
- }
85
- }
86
- /** The tab bar's specialized flag dialog, retained as the public Plus Menu surface. */
87
- export class PlusMenuDialog extends FlagToggleDialog {
88
- constructor(kinds) { super(kinds, PLUS_MENU_PRESENTATION); }
89
- }
@@ -1,11 +0,0 @@
1
- export declare const AUTO_NAME_MAX_LENGTH = 16;
2
- export declare const AUTO_NAME_TIMEOUT_MS = 30000;
3
- export declare const AUTO_NAME_TOKEN_BUDGETS: readonly [4096, 32768];
4
- export declare function normalizeAutoName(value: string): string | null;
5
- export declare function fallbackAutoName(prompt: string): string;
6
- export interface AutoNameCompletion {
7
- readonly prompt: string;
8
- readonly maxTokens: number;
9
- readonly signal: AbortSignal;
10
- }
11
- export declare function generateAutoName(firstPrompt: string, complete: (request: AutoNameCompletion) => Promise<string | null>, timeoutMs?: number): Promise<string>;
@@ -1,44 +0,0 @@
1
- export const AUTO_NAME_MAX_LENGTH = 16;
2
- export const AUTO_NAME_TIMEOUT_MS = 30_000;
3
- // Rationale: reasoning models can spend a small ceiling on hidden thinking and emit no title, so an
4
- // answerless attempt retries with a larger bound; budgets stay strictly increasing, as in v2.
5
- export const AUTO_NAME_TOKEN_BUDGETS = [4_096, 32_768];
6
- export function normalizeAutoName(value) {
7
- const normalized = value.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "").replace(/-+/g, "-");
8
- if (!normalized)
9
- return null;
10
- if (normalized.length <= AUTO_NAME_MAX_LENGTH)
11
- return normalized;
12
- const clipped = normalized.slice(0, AUTO_NAME_MAX_LENGTH + 1);
13
- const boundary = clipped.lastIndexOf("-");
14
- const result = (boundary >= 4 ? clipped.slice(0, boundary) : normalized.slice(0, AUTO_NAME_MAX_LENGTH)).replace(/-+$/g, "");
15
- return result || null;
16
- }
17
- export function fallbackAutoName(prompt) {
18
- const words = prompt.toLowerCase().match(/[a-z0-9]+/g) ?? [];
19
- return normalizeAutoName(words.slice(0, 3).join("-")) ?? "new-task";
20
- }
21
- export async function generateAutoName(firstPrompt, complete, timeoutMs = AUTO_NAME_TIMEOUT_MS) {
22
- for (const maxTokens of AUTO_NAME_TOKEN_BUDGETS) {
23
- const controller = new AbortController();
24
- const timer = setTimeout(() => controller.abort(), timeoutMs);
25
- timer.unref?.();
26
- try {
27
- const response = await complete({
28
- prompt: `Name this coding task with a lowercase hyphenated title of at most ${AUTO_NAME_MAX_LENGTH} characters. Reply only with the title.\n\n${firstPrompt.slice(0, 500)}`,
29
- maxTokens,
30
- signal: controller.signal,
31
- });
32
- const name = response === null ? null : normalizeAutoName(response);
33
- if (name !== null)
34
- return name;
35
- }
36
- catch {
37
- // Rationale: naming is best effort; the larger bounded attempt precedes the deterministic fallback.
38
- }
39
- finally {
40
- clearTimeout(timer);
41
- }
42
- }
43
- return fallbackAutoName(firstPrompt);
44
- }
@@ -1,5 +0,0 @@
1
- export { AUTO_NAME_MAX_LENGTH, AUTO_NAME_TIMEOUT_MS, AUTO_NAME_TOKEN_BUDGETS, fallbackAutoName, generateAutoName, normalizeAutoName, type AutoNameCompletion, } from "./auto-name.js";
2
- export { RESIDENT_TAB_SHORTCUTS, type ResidentTabAction, type ResidentTabShortcut, } from "./shortcut-declarations.js";
3
- export { projectResidentTabShortcuts, RESIDENT_TAB_GLOBAL_SHORTCUTS, type ResidentTabGlobalAction, type ResidentTabShortcutConflict, type ResidentTabShortcutProjection, type ShortcutBindings, } from "./shortcut-projection.js";
4
- export { readShortcutBindingsFile } from "./shortcut-bindings-file.js";
5
- export { deriveResidentTabStatus, type ResidentTabDerivedStatus, type ResidentTabFacts, } from "./status-deriver.js";
@@ -1,7 +0,0 @@
1
- export { AUTO_NAME_MAX_LENGTH, AUTO_NAME_TIMEOUT_MS, AUTO_NAME_TOKEN_BUDGETS, fallbackAutoName, generateAutoName, normalizeAutoName, } from "./auto-name.js";
2
- // Performance: the registry builder lives in `shortcuts.ts`, outside this barrel, so startup
3
- // presentation can read the declarations without loading the component registry.
4
- export { RESIDENT_TAB_SHORTCUTS, } from "./shortcut-declarations.js";
5
- export { projectResidentTabShortcuts, RESIDENT_TAB_GLOBAL_SHORTCUTS, } from "./shortcut-projection.js";
6
- export { readShortcutBindingsFile } from "./shortcut-bindings-file.js";
7
- export { deriveResidentTabStatus, } from "./status-deriver.js";
@@ -1,8 +0,0 @@
1
- import type { ShortcutBindings } from "./shortcut-projection.js";
2
- /** Largest `keybindings.json` the projection reads; a larger file counts as absent. */
3
- export declare const MAX_SHORTCUT_BINDINGS_BYTES: number;
4
- /**
5
- * Reads the user's `keybindings.json` as shortcut bindings, keeping `null` entries so an
6
- * explicit unbind survives, and treating any unreadable or malformed file as empty.
7
- */
8
- export declare function readShortcutBindingsFile(agentDir: string): ShortcutBindings;
@@ -1,40 +0,0 @@
1
- import { readFileSync } from "node:fs";
2
- import { join } from "node:path";
3
- /** Largest `keybindings.json` the projection reads; a larger file counts as absent. */
4
- export const MAX_SHORTCUT_BINDINGS_BYTES = 256 * 1024;
5
- /**
6
- * Reads the user's `keybindings.json` as shortcut bindings, keeping `null` entries so an
7
- * explicit unbind survives, and treating any unreadable or malformed file as empty.
8
- */
9
- export function readShortcutBindingsFile(agentDir) {
10
- let text;
11
- try {
12
- text = readFileSync(join(agentDir, "keybindings.json"), "utf8");
13
- }
14
- catch {
15
- return {};
16
- }
17
- if (text.length > MAX_SHORTCUT_BINDINGS_BYTES)
18
- return {};
19
- let parsed;
20
- try {
21
- parsed = JSON.parse(text.replace(/^/u, ""));
22
- }
23
- catch {
24
- return {};
25
- }
26
- if (typeof parsed !== "object" || parsed === null || Array.isArray(parsed))
27
- return {};
28
- const bindings = {};
29
- for (const [action, value] of Object.entries(parsed)) {
30
- if (action === "$schema")
31
- continue;
32
- if (value === null || typeof value === "string") {
33
- bindings[action] = value;
34
- continue;
35
- }
36
- if (Array.isArray(value))
37
- bindings[action] = value.filter((key) => typeof key === "string");
38
- }
39
- return bindings;
40
- }
@@ -1,13 +0,0 @@
1
- export type ResidentTabAction = "tabs.new" | "tabs.close" | "tabs.rename" | "tabs.settings" | "tabs.changelog" | "tabs.commands" | "tabs.retry" | "tabs.fresh" | "tabs.next" | "tabs.previous" | "tabs.moveRight" | "tabs.moveLeft" | `tabs.jump${1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10}`;
2
- export interface ResidentTabShortcut {
3
- readonly id: ResidentTabAction;
4
- readonly defaultKey: string | null;
5
- readonly scope: "global" | "failed-banner";
6
- readonly description: string;
7
- }
8
- /**
9
- * The tab shortcut declarations, in the order that decides which action keeps a duplicated key.
10
- * This module stays dependency-free so startup presentation and the resident projection can
11
- * read it without loading the component registry.
12
- */
13
- export declare const RESIDENT_TAB_SHORTCUTS: readonly ResidentTabShortcut[];
@@ -1,26 +0,0 @@
1
- const jumps = Array.from({ length: 10 }, (_, index) => ({
2
- id: `tabs.jump${index + 1}`,
3
- defaultKey: `alt+${(index + 1) % 10}`,
4
- scope: "global",
5
- description: `View A1 tab ${index + 1}`,
6
- }));
7
- /**
8
- * The tab shortcut declarations, in the order that decides which action keeps a duplicated key.
9
- * This module stays dependency-free so startup presentation and the resident projection can
10
- * read it without loading the component registry.
11
- */
12
- export const RESIDENT_TAB_SHORTCUTS = Object.freeze([
13
- { id: "tabs.new", defaultKey: "alt+a", scope: "global", description: "New A1 tab" },
14
- { id: "tabs.close", defaultKey: "alt+w", scope: "global", description: "Close A1 tab" },
15
- { id: "tabs.rename", defaultKey: "f2", scope: "global", description: "Rename A1 tab" },
16
- { id: "tabs.settings", defaultKey: "alt+,", scope: "global", description: "Open Settings tab" },
17
- { id: "tabs.changelog", defaultKey: null, scope: "global", description: "Open Changelog tab" },
18
- { id: "tabs.commands", defaultKey: "alt+/", scope: "global", description: "Open command palette" },
19
- ...jumps,
20
- { id: "tabs.next", defaultKey: null, scope: "global", description: "View next A1 tab" },
21
- { id: "tabs.previous", defaultKey: null, scope: "global", description: "View previous A1 tab" },
22
- { id: "tabs.moveRight", defaultKey: null, scope: "global", description: "Move A1 tab right" },
23
- { id: "tabs.moveLeft", defaultKey: null, scope: "global", description: "Move A1 tab left" },
24
- { id: "tabs.retry", defaultKey: "r", scope: "failed-banner", description: "Retry failed A1 tab" },
25
- { id: "tabs.fresh", defaultKey: "f", scope: "failed-banner", description: "Start failed A1 tab fresh" },
26
- ]);
@@ -1,29 +0,0 @@
1
- import { type ResidentTabAction } from "./shortcut-declarations.js";
2
- /** Key assignments as `keybindings.json` and the keybinding manager express them. */
3
- export type ShortcutBindings = Readonly<Record<string, string | readonly string[] | null | undefined>>;
4
- export type ResidentTabGlobalAction = Exclude<ResidentTabAction, "tabs.retry" | "tabs.fresh">;
5
- export interface ResidentTabShortcutConflict {
6
- readonly id: ResidentTabGlobalAction;
7
- readonly key: string;
8
- /** `reserved` keys belong to an A1 action; `duplicate` keys were claimed by an earlier tab action. */
9
- readonly reason: "reserved" | "duplicate";
10
- }
11
- /** The effective tab shortcuts the resident shell dispatches and every presentation shows. */
12
- export interface ResidentTabShortcutProjection {
13
- readonly assignments: Readonly<Record<ResidentTabGlobalAction, string | null>>;
14
- readonly conflicts: readonly ResidentTabShortcutConflict[];
15
- }
16
- export interface ResidentTabShortcutInput {
17
- /** The user's `keybindings.json`, including any `tabs.*` entries; `null` unbinds an action. */
18
- readonly configured?: ShortcutBindings | undefined;
19
- /** The effective A1 declarations (defaults plus customization) whose keys tab actions may not take. */
20
- readonly reserved?: ShortcutBindings | undefined;
21
- }
22
- /** The declarations the projection covers, in the order that decides duplicate claims. */
23
- export declare const RESIDENT_TAB_GLOBAL_SHORTCUTS: import("./shortcut-declarations.js").ResidentTabShortcut[];
24
- /**
25
- * Projects the effective A1 declarations and the user's customization into one tab shortcut
26
- * assignment per action. A key an A1 action holds after customization never becomes a tab
27
- * shortcut; between tab actions the earlier declaration keeps a duplicated key.
28
- */
29
- export declare function projectResidentTabShortcuts(input?: ResidentTabShortcutInput): ResidentTabShortcutProjection;
@@ -1,64 +0,0 @@
1
- import { RESIDENT_TAB_SHORTCUTS } from "./shortcut-declarations.js";
2
- /** The declarations the projection covers, in the order that decides duplicate claims. */
3
- export const RESIDENT_TAB_GLOBAL_SHORTCUTS = RESIDENT_TAB_SHORTCUTS.filter(shortcut => shortcut.scope === "global");
4
- function normalizeKey(key) {
5
- return key.trim().toLowerCase();
6
- }
7
- function keysOf(value) {
8
- if (value === null || value === undefined)
9
- return value;
10
- if (typeof value === "string")
11
- return [value];
12
- return value.filter((key) => typeof key === "string");
13
- }
14
- /**
15
- * Projects the effective A1 declarations and the user's customization into one tab shortcut
16
- * assignment per action. A key an A1 action holds after customization never becomes a tab
17
- * shortcut; between tab actions the earlier declaration keeps a duplicated key.
18
- */
19
- export function projectResidentTabShortcuts(input = {}) {
20
- const configured = input.configured ?? {};
21
- const claimedByOwnedActions = new Map();
22
- for (const [action, value] of Object.entries(input.reserved ?? {})) {
23
- if (action.startsWith("tabs."))
24
- continue;
25
- claimedByOwnedActions.set(action, keysOf(value) ?? []);
26
- }
27
- for (const [action, value] of Object.entries(configured)) {
28
- if (action.startsWith("tabs.") || action === "$schema")
29
- continue;
30
- claimedByOwnedActions.set(action, keysOf(value) ?? []);
31
- }
32
- const reserved = new Set();
33
- for (const keys of claimedByOwnedActions.values())
34
- for (const key of keys)
35
- reserved.add(normalizeKey(key));
36
- const claimed = new Set();
37
- const conflicts = [];
38
- const assignments = {};
39
- for (const shortcut of RESIDENT_TAB_GLOBAL_SHORTCUTS) {
40
- const id = shortcut.id;
41
- const custom = configured[id];
42
- const candidates = custom === undefined
43
- ? (shortcut.defaultKey === null ? [] : [shortcut.defaultKey])
44
- : (keysOf(custom) ?? []);
45
- let assigned = null;
46
- for (const candidate of candidates.map(normalizeKey)) {
47
- if (candidate.length === 0)
48
- continue;
49
- if (reserved.has(candidate)) {
50
- conflicts.push({ id, key: candidate, reason: "reserved" });
51
- continue;
52
- }
53
- if (claimed.has(candidate)) {
54
- conflicts.push({ id, key: candidate, reason: "duplicate" });
55
- continue;
56
- }
57
- assigned = candidate;
58
- claimed.add(candidate);
59
- break;
60
- }
61
- assignments[id] = assigned;
62
- }
63
- return { assignments, conflicts };
64
- }
@@ -1,10 +0,0 @@
1
- /** How the tab's last agent turn settled; it persists until the next turn starts. */
2
- export type ResidentTabTurnSettlement = "done" | "aborted" | "error";
3
- export type ResidentTabDerivedStatus = "starting" | "working" | "needs-input" | "idle" | "failed" | ResidentTabTurnSettlement;
4
- export interface ResidentTabFacts {
5
- readonly lifecycle: string;
6
- readonly pendingRequests: number;
7
- readonly queuedInput: number;
8
- readonly lastTurn?: ResidentTabTurnSettlement;
9
- }
10
- export declare function deriveResidentTabStatus(facts: ResidentTabFacts): ResidentTabDerivedStatus;