@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,152 +0,0 @@
1
- import { readdir, readFile, rm } from "node:fs/promises";
2
- import { connect } from "node:net";
3
- import { resolve } from "node:path";
4
- import { PRODUCT_IDENTITY } from "../../product-identity.js";
5
- import { encodeFrame, LineFrameDecoder } from "../protocol/index.js";
6
- import { supervisorProcessState } from "./supervisor-identity.js";
7
- import { withEndpointLock } from "./endpoint-lock.js";
8
- /**
9
- * Every endpoint recorded under this runtime directory: one per cohort, plus the single
10
- * endpoint published by releases that predate cohort-scoped identity. More than one can be
11
- * live at a time, and each is validated on its own identity rather than by being the only one.
12
- */
13
- export async function listRecordedEndpoints(paths) {
14
- const recorded = [];
15
- // Compatibility: a cohort listener passes its scoped paths here; legacy discovery still
16
- // names the runtime directory's fixed metadata path, not that listener's own record.
17
- const legacyPath = resolve(paths.runtimeDir, PRODUCT_IDENTITY.endpoint.metadataFilename);
18
- const legacy = await readEndpointMetadata(legacyPath);
19
- if (legacy) {
20
- recorded.push({ metadata: legacy, paths: { endpoint: legacy.endpoint, endpointMetadataPath: legacyPath } });
21
- }
22
- const names = await readdir(paths.endpointsDir).catch(() => []);
23
- for (const name of names) {
24
- if (!name.endsWith(".json"))
25
- continue;
26
- const endpointMetadataPath = resolve(paths.endpointsDir, name);
27
- const metadata = await readEndpointMetadata(endpointMetadataPath);
28
- if (metadata)
29
- recorded.push({ metadata, paths: { endpoint: metadata.endpoint, endpointMetadataPath } });
30
- }
31
- return recorded;
32
- }
33
- /**
34
- * Removes the records of cohorts whose processes are gone. A record left by a cohort that
35
- * exited without cleaning up is not evidence of ownership, and a later launch should not have
36
- * to reason about it. Returns the release ids whose records were removed.
37
- */
38
- export async function sweepDeadEndpoints(paths) {
39
- const swept = [];
40
- for (const recorded of await listRecordedEndpoints(paths)) {
41
- if (await supervisorProcessState(recorded.metadata) !== "gone")
42
- continue;
43
- if (await removeEndpointArtifacts(recorded.paths.endpointMetadataPath, recorded.paths.endpoint, recorded.metadata)) {
44
- swept.push(recorded.metadata.releaseId);
45
- }
46
- }
47
- return swept;
48
- }
49
- /** The releases that an identity-verified live cohort runs from and that must be retained. */
50
- export async function liveReleaseIds(paths) {
51
- const recorded = await listRecordedEndpoints(paths);
52
- const ownership = await Promise.all(recorded.map(async (endpoint) => ({
53
- releaseId: endpoint.metadata.releaseId,
54
- probe: await probeOwnership(endpoint.metadata),
55
- })));
56
- return [...new Set(ownership.filter(item => item.probe === "live-verified").map(item => item.releaseId))].sort();
57
- }
58
- export async function readEndpointMetadata(path) {
59
- try {
60
- const value = JSON.parse(await readFile(path, "utf8"));
61
- const ownership = value.ownership;
62
- const liveInstanceIds = Array.isArray(ownership?.liveInstanceIds)
63
- ? ownership.liveInstanceIds
64
- : Array.isArray(ownership?.liveGenerationIds) ? ownership.liveGenerationIds : null;
65
- const nonResumableInstanceIds = Array.isArray(ownership?.nonResumableInstanceIds)
66
- ? ownership.nonResumableInstanceIds
67
- : Array.isArray(ownership?.nonResumableGenerationIds) ? ownership.nonResumableGenerationIds : null;
68
- const uncertainInstanceIds = Array.isArray(ownership?.uncertainInstanceIds) ? ownership.uncertainInstanceIds : [];
69
- if (!value || value.schema !== PRODUCT_IDENTITY.protocol.supervisorSchema || typeof value.supervisorId !== "string" || typeof value.endpoint !== "string" || !Number.isSafeInteger(value.pid)
70
- || typeof value.pidStartIdentity !== "string" || typeof value.bootNonce !== "string" || typeof value.releaseId !== "string"
71
- || typeof value.releaseRoot !== "string" || typeof value.contentDigest !== "string" || !ownership
72
- || !isStringArray(liveInstanceIds) || !isStringArray(nonResumableInstanceIds) || !isStringArray(uncertainInstanceIds)) {
73
- return null;
74
- }
75
- return {
76
- ...value,
77
- ownership: {
78
- ...ownership,
79
- liveInstanceIds,
80
- nonResumableInstanceIds,
81
- uncertainInstanceIds,
82
- },
83
- };
84
- }
85
- catch {
86
- return null;
87
- }
88
- }
89
- /** Reprobe transient failures; only native absence or a replaced generation establishes death. */
90
- export async function probeOwnership(metadata, options = {}) {
91
- const attempts = options.attempts ?? 3;
92
- for (let attempt = 0; attempt < attempts; attempt++) {
93
- const identity = await requestIdentity(metadata.endpoint, options.timeoutMs ?? 500);
94
- if (identity) {
95
- return identity.supervisorId === metadata.supervisorId
96
- && identity.bootNonce === metadata.bootNonce
97
- && identity.pidStartIdentity === metadata.pidStartIdentity
98
- && identity.releaseId === metadata.releaseId
99
- ? "live-verified" : "identity-mismatch";
100
- }
101
- if (await supervisorProcessState(metadata, options.observe) === "gone")
102
- return "dead";
103
- if (attempt + 1 < attempts)
104
- await new Promise(resolvePromise => setTimeout(resolvePromise, 50));
105
- }
106
- return "unresponsive";
107
- }
108
- async function requestIdentity(endpoint, timeoutMs) {
109
- return await new Promise(resolvePromise => {
110
- const socket = connect(endpoint);
111
- const decoder = new LineFrameDecoder();
112
- let settled = false;
113
- const finish = (value) => {
114
- if (settled)
115
- return;
116
- settled = true;
117
- clearTimeout(timer);
118
- socket.destroy();
119
- resolvePromise(value);
120
- };
121
- socket.once("error", () => finish(null));
122
- socket.once("connect", () => socket.write(encodeFrame({ type: "identity-probe" })));
123
- socket.on("data", chunk => {
124
- try {
125
- const message = decoder.push(chunk)[0];
126
- if (message?.type === "identity" && typeof message.supervisorId === "string" && typeof message.bootNonce === "string"
127
- && typeof message.pidStartIdentity === "string" && typeof message.releaseId === "string") {
128
- finish({ supervisorId: message.supervisorId, bootNonce: message.bootNonce, pidStartIdentity: message.pidStartIdentity, releaseId: message.releaseId });
129
- }
130
- }
131
- catch {
132
- finish(null);
133
- }
134
- });
135
- const timer = setTimeout(() => finish(null), timeoutMs);
136
- });
137
- }
138
- function isStringArray(value) {
139
- return Array.isArray(value) && value.every(item => typeof item === "string" && item.length > 0);
140
- }
141
- /** Retire only a still-dead exact publication. Socket removal belongs to the gated listener. */
142
- export async function removeEndpointArtifacts(metadataPath, endpoint, expected) {
143
- return await withEndpointLock(metadataPath, async () => {
144
- const current = await readEndpointMetadata(metadataPath);
145
- if (!current || current.endpoint !== endpoint || JSON.stringify(current) !== JSON.stringify(expected))
146
- return false;
147
- if (await supervisorProcessState(current) !== "gone" || await probeOwnership(current, { attempts: 1 }) !== "dead")
148
- return false;
149
- await rm(metadataPath, { force: true });
150
- return true;
151
- });
152
- }
@@ -1,3 +0,0 @@
1
- import { type UpdateActivationCallbacks, type UpdateActivationRequest } from "./update-activation.js";
2
- /** Retry only the selection boundary for an exact candidate already materialized and certified. */
3
- export declare function activatePreparedRelease(request: Omit<UpdateActivationRequest, "packageRoot">, callbacks: UpdateActivationCallbacks): Promise<void>;
@@ -1,27 +0,0 @@
1
- import { resolve } from "node:path";
2
- import { PRODUCT_IDENTITY } from "../../product-identity.js";
3
- import { assertContinuityOrBlock } from "./update-activation.js";
4
- import { ensureSupervisor } from "./bootstrap.js";
5
- import { CohortStateStore } from "./cohort-state.js";
6
- import { resolveProductPaths } from "../lifecycle/index.js";
7
- import { readCertifiedReleaseManifest } from "./release-store.js";
8
- /** Retry only the selection boundary for an exact candidate already materialized and certified. */
9
- export async function activatePreparedRelease(request, callbacks) {
10
- const stateStore = new CohortStateStore(request.dataDir);
11
- const state = await stateStore.read();
12
- const releaseId = state.references.pending;
13
- const record = releaseId === null ? undefined : state.releases[releaseId];
14
- if (record === undefined || record.approval !== "approved" || record.packageVersion !== request.targetVersion
15
- || state.references.approved !== releaseId) {
16
- throw new Error(`no certified prepared release matches target ${request.targetVersion}`);
17
- }
18
- const candidate = await readCertifiedReleaseManifest(record, resolve(request.dataDir, "releases"));
19
- const paths = resolveProductPaths(request.environment);
20
- const continuity = { releaseRoot: candidate.releaseRoot, dataDir: request.dataDir, environment: request.environment,
21
- profileRoot: request.environment[PRODUCT_IDENTITY.environment.profileHome] ?? paths.configDir, runtimeDir: paths.runtimeDir };
22
- await assertContinuityOrBlock(continuity);
23
- await ensureSupervisor(candidate, request.environment);
24
- await assertContinuityOrBlock(continuity);
25
- await stateStore.activate(candidate.releaseId);
26
- await callbacks.phase("active-reference-committed");
27
- }
@@ -1,14 +0,0 @@
1
- import type { SupervisorEndpointMetadata } from "./cohort-state.js";
2
- export interface CleanupDiagnostics {
3
- readonly pid: number;
4
- readonly attempted: readonly string[];
5
- readonly terminated: boolean;
6
- readonly elapsedMs: number;
7
- }
8
- export declare function processIsAlive(pid: number): boolean;
9
- export declare function cleanupProvenIdleOwner(metadata: SupervisorEndpointMetadata, graceMs?: number): Promise<CleanupDiagnostics>;
10
- export declare function cleanupVerifiedOwner(metadata: SupervisorEndpointMetadata, options?: {
11
- readonly graceMs?: number;
12
- readonly allowLiveInstances?: boolean;
13
- readonly reason?: "stale-idle-owner" | "explicit-update" | "legacy-mutable-install";
14
- }): Promise<CleanupDiagnostics>;
@@ -1,76 +0,0 @@
1
- import { spawn } from "node:child_process";
2
- import { supervisorProcessState } from "./supervisor-identity.js";
3
- export function processIsAlive(pid) {
4
- if (!Number.isSafeInteger(pid) || pid <= 0)
5
- return false;
6
- try {
7
- process.kill(pid, 0);
8
- return true;
9
- }
10
- catch (error) {
11
- return error instanceof Error && "code" in error && error.code === "EPERM";
12
- }
13
- }
14
- export async function cleanupProvenIdleOwner(metadata, graceMs = 1_500) {
15
- return await cleanupVerifiedOwner(metadata, { graceMs, allowLiveInstances: false });
16
- }
17
- export async function cleanupVerifiedOwner(metadata, options = {}) {
18
- const graceMs = options.graceMs ?? 1_500;
19
- if (!options.allowLiveInstances && (metadata.ownership.liveInstanceIds.length > 0 || metadata.ownership.nonResumableInstanceIds.length > 0 || metadata.ownership.uncertainInstanceIds.length > 0)) {
20
- throw new Error("refusing to terminate an owner with recorded live generations");
21
- }
22
- const started = Date.now();
23
- const attempted = [];
24
- const state = await supervisorProcessState(metadata);
25
- if (state === "gone")
26
- return { pid: metadata.pid, attempted: ["owner-already-dead"], terminated: true, elapsedMs: Date.now() - started };
27
- // Security: ordinary recovery never signals a live owner, even with an empty durable list.
28
- // Explicit update cleanup also needs the exact native generation, not merely an old handshake.
29
- if (!options.allowLiveInstances || state !== "same") {
30
- return { pid: metadata.pid, attempted: ["live-owner-preserved"], terminated: false, elapsedMs: Date.now() - started };
31
- }
32
- attempted.push("graceful-termination");
33
- await terminate(metadata.pid, false);
34
- if (await waitUntilDead(metadata.pid, graceMs))
35
- return { pid: metadata.pid, attempted, terminated: true, elapsedMs: Date.now() - started };
36
- if (await supervisorProcessState(metadata) !== "same") {
37
- return { pid: metadata.pid, attempted, terminated: await supervisorProcessState(metadata) === "gone", elapsedMs: Date.now() - started };
38
- }
39
- attempted.push("forced-process-tree-termination");
40
- await terminate(metadata.pid, true);
41
- const terminated = await waitUntilDead(metadata.pid, graceMs);
42
- return { pid: metadata.pid, attempted, terminated, elapsedMs: Date.now() - started };
43
- }
44
- async function terminate(pid, force) {
45
- if (process.platform === "win32") {
46
- await new Promise(resolvePromise => {
47
- const child = spawn("taskkill.exe", ["/PID", String(pid), "/T", ...(force ? ["/F"] : [])], {
48
- shell: false,
49
- windowsHide: true,
50
- stdio: "ignore",
51
- });
52
- child.once("error", () => resolvePromise());
53
- child.once("close", () => resolvePromise());
54
- });
55
- return;
56
- }
57
- const signal = force ? "SIGKILL" : "SIGTERM";
58
- try {
59
- process.kill(-pid, signal);
60
- }
61
- catch {
62
- try {
63
- process.kill(pid, signal);
64
- }
65
- catch { }
66
- }
67
- }
68
- async function waitUntilDead(pid, timeoutMs) {
69
- const deadline = Date.now() + timeoutMs;
70
- while (Date.now() < deadline) {
71
- if (!processIsAlive(pid))
72
- return true;
73
- await new Promise(resolvePromise => setTimeout(resolvePromise, 25));
74
- }
75
- return !processIsAlive(pid);
76
- }
@@ -1,15 +0,0 @@
1
- import type { NativeProcessIdentity } from "../lifecycle/index.js";
2
- import type { SupervisorEndpointMetadata } from "./cohort-state.js";
3
- export type SupervisorProcessState = "same" | "gone" | "unknown";
4
- export type ObserveSupervisorProcess = (pid: number) => Promise<NativeProcessIdentity | null>;
5
- /** Inspection code comes from this runtime, never from a path in a stale endpoint record. */
6
- export declare function observeSupervisorProcess(pid: number): Promise<NativeProcessIdentity | null>;
7
- /** New supervisors use a native creation token as their opaque handshake identity as well. */
8
- export declare function currentSupervisorStartIdentity(): string;
9
- /** The current runtime also owns the OS gate ABI; metadata cannot choose a different addon. */
10
- export declare function acquireSupervisorGate(path: string): {
11
- readonly acquired: boolean;
12
- release(): void;
13
- };
14
- /** A failed inspection is uncertainty, never permission to erase a possibly live owner. */
15
- export declare function supervisorProcessState(metadata: SupervisorEndpointMetadata, observe?: ObserveSupervisorProcess): Promise<SupervisorProcessState>;
@@ -1,63 +0,0 @@
1
- import { fileURLToPath } from "node:url";
2
- import { createNativeProcessInspector, loadProcessGuardianAddon, resolveProcessGuardianPath } from "../process-containment/index.js";
3
- const ownRoot = fileURLToPath(new URL("../../../", import.meta.url));
4
- /** Inspection code comes from this runtime, never from a path in a stale endpoint record. */
5
- export async function observeSupervisorProcess(pid) {
6
- return await (await createNativeProcessInspector(process.env, process.platform, ownRoot)).observe(pid);
7
- }
8
- /** New supervisors use a native creation token as their opaque handshake identity as well. */
9
- export function currentSupervisorStartIdentity() {
10
- try {
11
- const token = loadProcessGuardianAddon(resolveProcessGuardianPath(ownRoot, process.env)).inspectProcessStart(process.pid);
12
- if (!validNativeToken(token))
13
- throw new Error("native process identity is unavailable");
14
- return token;
15
- }
16
- catch (cause) {
17
- throw Object.assign(new Error("cannot verify A1's background service process; check installation and process-inspection permissions", { cause }), { code: "SUPERVISOR_RECOVERY_UNAVAILABLE" });
18
- }
19
- }
20
- /** The current runtime also owns the OS gate ABI; metadata cannot choose a different addon. */
21
- export function acquireSupervisorGate(path) {
22
- const addon = loadProcessGuardianAddon(resolveProcessGuardianPath(ownRoot, process.env));
23
- if (!addon.tryAcquireProcessGate)
24
- throw new Error("this installation lacks startup recovery support; update or repair A1");
25
- return addon.tryAcquireProcessGate(path);
26
- }
27
- /** A failed inspection is uncertainty, never permission to erase a possibly live owner. */
28
- export async function supervisorProcessState(metadata, observe = observeSupervisorProcess) {
29
- let identity;
30
- try {
31
- identity = await observe(metadata.pid);
32
- }
33
- catch {
34
- return "unknown";
35
- }
36
- if (identity === null)
37
- return "gone";
38
- if (identity.pid !== metadata.pid)
39
- return "unknown";
40
- if (metadata.nativeStartIdentity !== undefined) {
41
- // Compatibility: only compare tokens of the same native format, not an old Node timestamp.
42
- if (!validNativeToken(metadata.nativeStartIdentity) || !validNativeToken(identity.startIdentity)
43
- || identity.startIdentity.split(":")[0] !== metadata.nativeStartIdentity.split(":")[0])
44
- return "unknown";
45
- return identity.startIdentity === metadata.nativeStartIdentity ? "same" : "gone";
46
- }
47
- // Compatibility: legacy publication happened after process creation. A native creation time
48
- // strictly later than that publication (with a one-second clock margin) disproves ownership;
49
- // a near timestamp is NOT proof of ownership. Linux tick-only tokens cannot prove this.
50
- const published = Date.parse(metadata.startedAt);
51
- const created = nativeCreationTime(identity.startIdentity);
52
- return Number.isFinite(published) && created !== null && created > published + 1_000 ? "gone" : "unknown";
53
- }
54
- function validNativeToken(value) {
55
- return typeof value === "string" && /^(?:windows-filetime:\d{1,20}|linux-proc-start:\d{1,20}|darwin-proc-start:\d{1,20}:\d{1,6})$/.test(value);
56
- }
57
- function nativeCreationTime(identity) {
58
- const windows = /^windows-filetime:(\d+)$/.exec(identity);
59
- if (windows)
60
- return Number(BigInt(windows[1]) / 10000n - 11644473600000n);
61
- const darwin = /^darwin-proc-start:(\d+):(\d+)$/.exec(identity);
62
- return darwin ? Number(darwin[1]) * 1_000 + Number(darwin[2]) / 1_000 : null;
63
- }
@@ -1,6 +0,0 @@
1
- /**
2
- * Mirrors the native boot matching rule. Legacy `macos-boot:<sec>:<usec>` records drift on clock
3
- * corrections, so two of them match within the tolerance; only the native host can prove one
4
- * against a current identity.
5
- */
6
- export declare function sameBootIdentity(left: string, right: string): boolean;
@@ -1,16 +0,0 @@
1
- /** Seconds a legacy clock-derived boot identity may drift and still name the same boot. */
2
- const LEGACY_BOOT_TOLERANCE_SECONDS = 2;
3
- const LEGACY_MACOS_BOOT = /^macos-boot:(\d+):\d+$/u;
4
- /**
5
- * Mirrors the native boot matching rule. Legacy `macos-boot:<sec>:<usec>` records drift on clock
6
- * corrections, so two of them match within the tolerance; only the native host can prove one
7
- * against a current identity.
8
- */
9
- export function sameBootIdentity(left, right) {
10
- if (left === right)
11
- return true;
12
- const first = LEGACY_MACOS_BOOT.exec(left)?.[1];
13
- const second = LEGACY_MACOS_BOOT.exec(right)?.[1];
14
- return first !== undefined && second !== undefined
15
- && Math.abs(Number(first) - Number(second)) <= LEGACY_BOOT_TOLERANCE_SECONDS;
16
- }
@@ -1,20 +0,0 @@
1
- import type { TerminalHostCommand } from "./ensure-terminal-host.js";
2
- export interface BoundedHostCommandResult {
3
- readonly code: number;
4
- readonly stdout: string;
5
- /** The command's last diagnostic line, bounded and stripped of control characters; never parsed. */
6
- readonly stderr: string;
7
- }
8
- export interface BoundedHostCommandLimits {
9
- /** Output beyond this many bytes fails the exchange instead of being parsed. */
10
- readonly maxStdoutBytes: number;
11
- readonly timeoutMs: number;
12
- /** Names the exchange in the timeout error. */
13
- readonly label: string;
14
- readonly environment?: NodeJS.ProcessEnv;
15
- }
16
- /**
17
- * Runs one terminal-host command whose report is small. An oversized report kills the command and
18
- * reports a failed exchange; a command that outlives its deadline is killed and rejected.
19
- */
20
- export declare function runBoundedHostCommand(command: TerminalHostCommand, arguments_: readonly string[], limits: BoundedHostCommandLimits): Promise<BoundedHostCommandResult>;
@@ -1,62 +0,0 @@
1
- import { spawn } from "node:child_process";
2
- /** Diagnostics beyond this many bytes are dropped rather than buffered. */
3
- const MAX_STDERR_BYTES = 4096;
4
- /**
5
- * Runs one terminal-host command whose report is small. An oversized report kills the command and
6
- * reports a failed exchange; a command that outlives its deadline is killed and rejected.
7
- */
8
- export async function runBoundedHostCommand(command, arguments_, limits) {
9
- return await new Promise((resolvePromise, rejectPromise) => {
10
- const child = spawn(command.executable, [command.entry, ...arguments_], {
11
- env: limits.environment,
12
- windowsHide: true,
13
- stdio: ["ignore", "pipe", "pipe"],
14
- });
15
- const stdout = [];
16
- const stderr = [];
17
- let stderrSize = 0;
18
- child.stderr.on("data", (chunk) => {
19
- if (stderrSize >= MAX_STDERR_BYTES)
20
- return;
21
- const kept = chunk.subarray(0, MAX_STDERR_BYTES - stderrSize);
22
- stderrSize += kept.length;
23
- stderr.push(Buffer.from(kept));
24
- });
25
- let size = 0;
26
- let overflowed = false;
27
- child.stdout.on("data", chunk => {
28
- size += chunk.length;
29
- // Security: an oversized answer is a failed exchange, never a truncated report to parse.
30
- if (size > limits.maxStdoutBytes) {
31
- overflowed = true;
32
- child.kill("SIGKILL");
33
- }
34
- else
35
- stdout.push(Buffer.from(chunk));
36
- });
37
- child.once("error", rejectPromise);
38
- child.once("close", code => {
39
- clearTimeout(timer);
40
- const diagnostic = lastDiagnosticLine(Buffer.concat(stderr).toString("utf8"));
41
- resolvePromise(overflowed
42
- ? { code: code === 0 || code === null ? 1 : code, stdout: "", stderr: diagnostic }
43
- : { code: code ?? 1, stdout: Buffer.concat(stdout).toString("utf8"), stderr: diagnostic });
44
- });
45
- const timer = setTimeout(() => {
46
- child.kill("SIGKILL");
47
- rejectPromise(new Error(`${limits.label} timed out`));
48
- }, limits.timeoutMs);
49
- timer.unref();
50
- });
51
- }
52
- /** Keeps one terminal-safe line: the native host reports its reason last. */
53
- function lastDiagnosticLine(text) {
54
- const lines = text.split(/\r?\n/u)
55
- // Security: diagnostics never carry terminal controls into a later message.
56
- .map(line => line
57
- .replace(/\u001b\[[0-?]*[ -/]*[@-~]/gu, "")
58
- .replace(/[\u0000-\u001f\u007f-\u009f]/gu, "")
59
- .trim())
60
- .filter(line => line.length > 0);
61
- return (lines.at(-1) ?? "").slice(0, 300);
62
- }
@@ -1,73 +0,0 @@
1
- import { type ResidentTabRoute } from "./routes.js";
2
- export type ResidentTabStatus = "starting" | "working" | "needs-input" | "done-unseen" | "done" | "aborted" | "error" | "idle" | "unresponsive" | "crashed" | "restarting" | "failed";
3
- export { residentUtilityRoute, type ResidentTabRoute } from "./routes.js";
4
- export interface TabBridgeCredentials {
5
- readonly tabId: string;
6
- readonly token: string;
7
- readonly endpoint: string;
8
- readonly releaseId?: string;
9
- }
10
- export interface TabAttachment {
11
- readonly clientId: string;
12
- readonly controllerRevision: number;
13
- }
14
- export type TabBridgeCommand = {
15
- readonly type: "visibility";
16
- readonly visible: boolean;
17
- } | {
18
- readonly type: "client";
19
- readonly version: string;
20
- } | {
21
- readonly type: "rename";
22
- readonly name: string;
23
- readonly nameSource: "default" | "user" | "auto";
24
- } | {
25
- readonly type: "route";
26
- readonly route: ResidentTabRoute;
27
- } | {
28
- readonly type: "stop";
29
- readonly deadlineMs: number;
30
- };
31
- interface BridgeTransport {
32
- write(bytes: Uint8Array): boolean;
33
- destroy(): void;
34
- once(event: "connect" | "error" | "close", listener: (...args: unknown[]) => void): unknown;
35
- on(event: "data", listener: (bytes: Buffer) => void): unknown;
36
- }
37
- export interface TabBridgeOptions {
38
- readonly credentials: TabBridgeCredentials;
39
- readonly pid?: number;
40
- readonly startIdentity?: string;
41
- readonly build?: string;
42
- readonly connect?: (endpoint: string) => BridgeTransport;
43
- readonly heartbeatIntervalMs?: number;
44
- readonly setInterval?: (callback: () => void, milliseconds: number) => unknown;
45
- readonly clearInterval?: (timer: unknown) => void;
46
- }
47
- /** Metadata-only advisory bridge. Terminal input and transcript bytes have no API here. */
48
- export declare class TabBridgeClient {
49
- #private;
50
- constructor(options: TabBridgeOptions);
51
- get tabId(): string;
52
- get available(): boolean;
53
- captureAttachment(): TabAttachment | null;
54
- onCommand(listener: (command: TabBridgeCommand) => void): () => void;
55
- start(timeoutMs?: number): Promise<boolean>;
56
- status(state: ResidentTabStatus, degraded?: boolean, pendingRequests?: number, queuedInput?: number): void;
57
- degraded(degraded: boolean): void;
58
- accent(accent: string): void;
59
- session(file: string | null, name: string | null, nameSource?: "default" | "user" | "auto"): void;
60
- prompt(interrupted: boolean): void;
61
- /** Publishes the effective tab shortcut assignments so the host dispatches and labels the same keys. */
62
- shortcuts(assignments: Readonly<Record<string, string | null>>): void;
63
- requestDetach(origin?: TabAttachment | null, timeoutMs?: number): Promise<boolean>;
64
- requestRestart(origin?: TabAttachment | null, timeoutMs?: number): Promise<boolean>;
65
- requestClose(origin?: TabAttachment | null, timeoutMs?: number): Promise<boolean>;
66
- consumeControllerBoundaryInput(data: string): string;
67
- close(): void;
68
- /**
69
- * Asks the server to act for the client that controls this tab, as `origin`: leave it, restart or close the tab,
70
- * or open the tab bar's Plus Menu dialog (`configure-plus`).
71
- */
72
- requestAction(action: "detach" | "restart" | "close" | "configure-plus", origin?: TabAttachment | null, timeoutMs?: number): Promise<boolean>;
73
- }