@timurproko/a1 0.1.8-dev.472 → 0.1.8-dev.508

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 (370) hide show
  1. package/bin/cli.js +4 -5
  2. package/bin/guardian.js +5 -1
  3. package/bin/module-identity.js +53 -98
  4. package/bin/module-resolver.js +138 -0
  5. package/bin/pinned-pi-public.js +25 -6
  6. package/bin/ui.js +7 -2
  7. package/bin/update-recovery.js +76 -7
  8. package/bin/warmup.js +3 -0
  9. package/dist/{integrations/pi/session-ui → app/session-shell}/clipboard-diagnostics.d.ts +1 -1
  10. package/dist/{integrations/pi/session-ui → app/session-shell}/clipboard-image.js +1 -1
  11. package/dist/app/session-shell/helper-pool.d.ts +33 -0
  12. package/dist/app/session-shell/helper-pool.js +98 -0
  13. package/dist/{integrations/pi/session-ui → app/session-shell}/image-preparation-client.d.ts +1 -1
  14. package/dist/{integrations/pi/session-ui → app/session-shell}/image-preparation-client.js +1 -1
  15. package/dist/{integrations/pi/session-ui → app/session-shell}/image-preparation.js +1 -1
  16. package/dist/{integrations/pi/session-ui → app/session-shell}/image-source.js +1 -1
  17. package/dist/{integrations/pi/session-ui → app/session-shell}/image-worker.js +1 -1
  18. package/dist/app/session-shell/index.d.ts +7 -0
  19. package/dist/app/session-shell/index.js +4 -0
  20. package/dist/app/session-shell/paste-executor.d.ts +18 -0
  21. package/dist/{integrations/pi/session-ui → app/session-shell}/paste-executor.js +50 -29
  22. package/dist/{integrations/pi/session-ui → app/session-shell}/paste-helper.js +1 -1
  23. package/dist/app/session-shell/paste-preparation-client.d.ts +31 -0
  24. package/dist/{integrations/pi/session-ui → app/session-shell}/paste-preparation-client.js +19 -8
  25. package/dist/{integrations/pi/session-ui → app/session-shell}/paste-protocol.d.ts +1 -1
  26. package/dist/{integrations/pi/session-ui → app/session-shell}/paste-protocol.js +1 -1
  27. package/dist/app/session-shell/paste-text-preparation.d.ts +6 -0
  28. package/dist/{integrations/pi/session-ui/paste-text-preparation.d.ts → app/session-shell/paste-types.d.ts} +1 -4
  29. package/dist/{integrations/pi/session-ui → app/session-shell}/path-chip-presentation.d.ts +1 -1
  30. package/dist/{integrations/pi/session-ui → app/session-shell}/prompt-chips.d.ts +5 -1
  31. package/dist/{integrations/pi/session-ui → app/session-shell}/prompt-chips.js +6 -2
  32. package/dist/{integrations/pi/session-ui → app/session-shell}/prompt-history-controller.d.ts +2 -2
  33. package/dist/{integrations/pi/session-ui → app/session-shell}/prompt-history-controller.js +2 -2
  34. package/dist/{integrations/pi/session-ui → app/session-shell}/prompt-suggestion-controller.d.ts +1 -1
  35. package/dist/{integrations/pi/session-ui → app/session-shell}/prompt-suggestion-controller.js +2 -2
  36. package/dist/{integrations/pi/session-ui → app/session-shell}/quit-outro.js +1 -1
  37. package/dist/{integrations/pi/session-ui → app/session-shell}/response-copy-coordinator.d.ts +1 -1
  38. package/dist/{integrations/pi/session-ui → app/session-shell}/response-copy-coordinator.js +3 -5
  39. package/dist/{integrations/pi/session-ui → app/session-shell}/response-copy-helper.js +1 -1
  40. package/dist/{integrations/pi/session-ui → app/session-shell}/response-copy-protocol.d.ts +1 -1
  41. package/dist/{integrations/pi/session-ui → app/session-shell}/response-copy-transport.d.ts +10 -2
  42. package/dist/{integrations/pi/session-ui → app/session-shell}/response-copy-transport.js +45 -19
  43. package/dist/{integrations/pi/session-ui → app/session-shell}/session-shell-root.d.ts +75 -53
  44. package/dist/{integrations/pi/session-ui → app/session-shell}/session-shell-root.js +30 -20
  45. package/dist/{integrations/pi/session-ui → app/session-shell}/session-shell.d.ts +9 -8
  46. package/dist/{integrations/pi/session-ui → app/session-shell}/session-shell.js +108 -67
  47. package/dist/{integrations/pi/session-ui → app/session-shell}/session-viewport-controller.d.ts +5 -5
  48. package/dist/{integrations/pi/session-ui → app/session-shell}/session-viewport-controller.js +5 -5
  49. package/dist/{integrations/pi/session-ui → app/session-shell}/system-clipboard.d.ts +1 -1
  50. package/dist/{integrations/pi/session-ui → app/session-shell}/system-clipboard.js +1 -1
  51. package/dist/cli/index.d.ts +8 -5
  52. package/dist/cli/index.js +4 -5
  53. package/dist/composition/index.d.ts +0 -1
  54. package/dist/composition/index.js +0 -1
  55. package/dist/composition/owned-ui.d.ts +2 -2
  56. package/dist/composition/owned-ui.js +35 -36
  57. package/dist/composition/settings-route-host.d.ts +2 -2
  58. package/dist/contracts/agent-engine/domain.d.ts +6 -1
  59. package/dist/contracts/agent-engine/index.d.ts +11 -8
  60. package/dist/contracts/agent-engine/index.js +6 -8
  61. package/dist/contracts/owned-ui/extension-ui.d.ts +8 -0
  62. package/dist/contracts/owned-ui/index.d.ts +12 -8
  63. package/dist/contracts/owned-ui/index.js +8 -8
  64. package/dist/features/launch/index.d.ts +12 -6
  65. package/dist/features/launch/index.js +6 -6
  66. package/dist/features/launch/intent.d.ts +5 -5
  67. package/dist/features/launch/intent.js +2 -2
  68. package/dist/features/owned-ui/index.d.ts +6 -6
  69. package/dist/features/owned-ui/index.js +4 -6
  70. package/dist/features/owned-ui/run.d.ts +2 -2
  71. package/dist/features/owned-ui/settings-app.d.ts +2 -2
  72. package/dist/features/owned-ui/settings-app.js +18 -5
  73. package/dist/features/prompt-history/service.d.ts +1 -1
  74. package/dist/features/prompt-history/service.js +1 -1
  75. package/dist/features/prompt-history/store.js +3 -7
  76. package/dist/features/prompt-suggestions/diagnostics.js +1 -1
  77. package/dist/features/prompt-suggestions/index.d.ts +2 -1
  78. package/dist/features/prompt-suggestions/index.js +1 -1
  79. package/dist/foundation/launch-guardian/index.d.ts +2 -1
  80. package/dist/foundation/launch-guardian/index.js +1 -1
  81. package/dist/foundation/lifecycle/index.d.ts +11 -6
  82. package/dist/foundation/lifecycle/index.js +5 -6
  83. package/dist/foundation/process-containment/index.d.ts +8 -6
  84. package/dist/foundation/process-containment/index.js +6 -6
  85. package/dist/foundation/process-containment/native-guardian-containment.js +3 -3
  86. package/dist/foundation/protocol/index.d.ts +3 -2
  87. package/dist/foundation/protocol/index.js +2 -2
  88. package/dist/foundation/release/bootstrap.d.ts +0 -4
  89. package/dist/foundation/release/bootstrap.js +1 -82
  90. package/dist/foundation/release/dependency-layer.d.ts +2 -5
  91. package/dist/foundation/release/endpoints.d.ts +4 -0
  92. package/dist/foundation/release/endpoints.js +86 -2
  93. package/dist/foundation/release/index.d.ts +30 -16
  94. package/dist/foundation/release/index.js +16 -16
  95. package/dist/foundation/release/release.d.ts +1 -1
  96. package/dist/foundation/release/types.d.ts +11 -0
  97. package/dist/foundation/release/types.js +1 -0
  98. package/dist/foundation/release/update-transaction.d.ts +1 -1
  99. package/dist/foundation/release/update.d.ts +2 -1
  100. package/dist/foundation/release/update.js +3 -18
  101. package/dist/foundation/startup/index.d.ts +4 -2
  102. package/dist/foundation/startup/index.js +2 -2
  103. package/dist/foundation/startup/startup-descriptor.js +2 -2
  104. package/dist/foundation/storage/control-store.d.ts +1 -45
  105. package/dist/foundation/storage/control-store.js +54 -277
  106. package/dist/foundation/storage/index.d.ts +1 -1
  107. package/dist/foundation/storage/index.js +1 -1
  108. package/dist/foundation/supervision/index.d.ts +2 -2
  109. package/dist/foundation/supervision/index.js +2 -2
  110. package/dist/foundation/supervision/server.d.ts +5 -10
  111. package/dist/foundation/supervision/server.js +7 -7
  112. package/dist/foundation/terminal-cleanup/index.d.ts +3 -2
  113. package/dist/foundation/terminal-cleanup/index.js +2 -2
  114. package/dist/integrations/pi/components/editor-interaction.d.ts +1 -1
  115. package/dist/integrations/pi/components/history-editor-loader.d.ts +1 -1
  116. package/dist/integrations/pi/components/index.d.ts +20 -13
  117. package/dist/integrations/pi/components/index.js +12 -13
  118. package/dist/integrations/pi/components/owned-editor-ux.js +5 -8
  119. package/dist/integrations/pi/components/resources/builtin-themes.d.ts +7 -5
  120. package/dist/integrations/pi/components/resources/builtin-themes.js +7 -5
  121. package/dist/integrations/pi/components/shell-editor-autocomplete.js +1 -1
  122. package/dist/integrations/pi/components/shell-extension-ui.js +2 -1
  123. package/dist/integrations/pi/components/shell-footer-status.js +1 -1
  124. package/dist/integrations/pi/components/shell-presenters-info.d.ts +1 -1
  125. package/dist/integrations/pi/components/shell-presenters-info.js +1 -1
  126. package/dist/integrations/pi/components/shell-presenters-transcript.js +1 -1
  127. package/dist/integrations/pi/components/shell-selectors-dialogs.d.ts +9 -3
  128. package/dist/integrations/pi/components/shell-selectors-dialogs.js +9 -6
  129. package/dist/integrations/pi/components/shell-shared-facade.d.ts +3 -1
  130. package/dist/integrations/pi/components/shell-shared-facade.js +4 -2
  131. package/dist/integrations/pi/components/submitted-prompt-adapter.d.ts +1 -1
  132. package/dist/integrations/pi/components/submitted-prompt-adapter.js +1 -1
  133. package/dist/integrations/pi/components/tool-image-presentation.d.ts +1 -1
  134. package/dist/integrations/pi/components/tool-image-presentation.js +4 -7
  135. package/dist/integrations/pi/components/upstream/adjacent/core/keybindings.d.ts +36 -22
  136. package/dist/integrations/pi/components/upstream/adjacent/core/keybindings.js +43 -7
  137. package/dist/integrations/pi/components/upstream/assets/earendil-image.json +2 -2
  138. package/dist/integrations/pi/components/upstream/components/countdown-timer.d.ts +6 -3
  139. package/dist/integrations/pi/components/upstream/components/daxnuts.d.ts +8 -1
  140. package/dist/integrations/pi/components/upstream/components/daxnuts.js +7 -3
  141. package/dist/integrations/pi/components/upstream/components/earendil-announcement.d.ts +1 -1
  142. package/dist/integrations/pi/components/upstream/components/earendil-announcement.js +10 -4
  143. package/dist/integrations/pi/components/upstream/components/extension-editor.d.ts +7 -4
  144. package/dist/integrations/pi/components/upstream/components/extension-editor.js +7 -4
  145. package/dist/integrations/pi/components/upstream/components/mermaid.js +8 -4
  146. package/dist/integrations/pi/components/upstream/components/owned-editor.d.ts +9 -5
  147. package/dist/integrations/pi/components/upstream/components/owned-editor.js +10 -6
  148. package/dist/integrations/pi/components/upstream/components/scoped-models-selector.d.ts +8 -4
  149. package/dist/integrations/pi/components/upstream/components/scoped-models-selector.js +27 -25
  150. package/dist/integrations/pi/components/upstream/components/session-footer.d.ts +1 -1
  151. package/dist/integrations/pi/components/upstream/components/session-footer.js +8 -10
  152. package/dist/integrations/pi/components/upstream/components/session-selector-search.js +6 -4
  153. package/dist/integrations/pi/components/upstream/components/session-selector.d.ts +1 -1
  154. package/dist/integrations/pi/components/upstream/components/session-selector.js +8 -4
  155. package/dist/integrations/pi/components/upstream/components/skill-invocation-message.d.ts +7 -5
  156. package/dist/integrations/pi/components/upstream/components/skill-invocation-message.js +8 -6
  157. package/dist/integrations/pi/components/upstream/components/status-indicator.d.ts +9 -4
  158. package/dist/integrations/pi/components/upstream/components/status-indicator.js +15 -5
  159. package/dist/integrations/pi/components/upstream/components/tool-execution.d.ts +8 -2
  160. package/dist/integrations/pi/components/upstream/components/tool-execution.js +58 -37
  161. package/dist/integrations/pi/components/upstream/components/tree-selector.d.ts +7 -4
  162. package/dist/integrations/pi/components/upstream/components/tree-selector.js +7 -4
  163. package/dist/integrations/pi/components/upstream/components/trust-selector.d.ts +1 -1
  164. package/dist/integrations/pi/components/upstream/components/trust-selector.js +10 -5
  165. package/dist/integrations/pi/components/upstream/external-editor.js +8 -4
  166. package/dist/integrations/pi/components/upstream/history/editor-core.d.ts +13 -4
  167. package/dist/integrations/pi/components/upstream/history/editor-core.js +112 -30
  168. package/dist/integrations/pi/components/upstream/history/kill-ring.d.ts +6 -3
  169. package/dist/integrations/pi/components/upstream/history/kill-ring.js +6 -3
  170. package/dist/integrations/pi/components/upstream/history/printable-key.js +7 -4
  171. package/dist/integrations/pi/components/upstream/history/text-helpers.js +6 -3
  172. package/dist/integrations/pi/components/upstream/history/undo-stack.d.ts +6 -3
  173. package/dist/integrations/pi/components/upstream/history/undo-stack.js +6 -3
  174. package/dist/integrations/pi/components/upstream/history/word-navigation.js +6 -3
  175. package/dist/integrations/pi/components/upstream/model-search.d.ts +5 -2
  176. package/dist/integrations/pi/components/upstream/theme/theme-controller.d.ts +8 -0
  177. package/dist/integrations/pi/components/upstream/theme/theme-controller.js +0 -3
  178. package/dist/integrations/pi/components/upstream/theme/theme.d.ts +2 -2
  179. package/dist/integrations/pi/components/upstream/theme/theme.js +17 -6
  180. package/dist/integrations/pi/engine/adapter.d.ts +39 -138
  181. package/dist/integrations/pi/engine/adapter.js +338 -3226
  182. package/dist/integrations/pi/engine/command-dispatch.d.ts +41 -0
  183. package/dist/integrations/pi/engine/command-dispatch.js +125 -0
  184. package/dist/integrations/pi/engine/event-delivery.d.ts +100 -0
  185. package/dist/integrations/pi/engine/event-delivery.js +184 -0
  186. package/dist/integrations/pi/engine/extension-ui-binding.d.ts +35 -0
  187. package/dist/integrations/pi/engine/extension-ui-binding.js +81 -0
  188. package/dist/integrations/pi/engine/index.d.ts +18 -14
  189. package/dist/integrations/pi/engine/index.js +10 -14
  190. package/dist/integrations/pi/engine/message-values.d.ts +29 -0
  191. package/dist/integrations/pi/engine/message-values.js +168 -0
  192. package/dist/integrations/pi/engine/pending-delivery.d.ts +2 -2
  193. package/dist/integrations/pi/engine/pending-delivery.js +2 -4
  194. package/dist/integrations/pi/engine/pi-settings-metadata.json +382 -371
  195. package/dist/integrations/pi/engine/prompt-suggestions.d.ts +30 -0
  196. package/dist/integrations/pi/engine/prompt-suggestions.js +102 -0
  197. package/dist/integrations/pi/engine/provider-authentication.d.ts +34 -0
  198. package/dist/integrations/pi/engine/provider-authentication.js +209 -0
  199. package/dist/integrations/pi/engine/resource-catalog.d.ts +49 -0
  200. package/dist/integrations/pi/engine/resource-catalog.js +289 -0
  201. package/dist/integrations/pi/engine/resources/changelog.json +4 -4
  202. package/dist/integrations/pi/engine/session-events.d.ts +48 -0
  203. package/dist/integrations/pi/engine/session-events.js +223 -0
  204. package/dist/integrations/pi/engine/session-integration.js +2 -4
  205. package/dist/integrations/pi/engine/session-runtime.d.ts +84 -0
  206. package/dist/integrations/pi/engine/session-runtime.js +249 -0
  207. package/dist/integrations/pi/engine/{settings-effects.d.ts → settings-bridge.d.ts} +57 -2
  208. package/dist/integrations/pi/engine/settings-bridge.js +514 -0
  209. package/dist/integrations/pi/engine/settings-metadata.d.ts +31 -0
  210. package/dist/integrations/pi/engine/settings-metadata.js +67 -0
  211. package/dist/integrations/pi/engine/settings-port.d.ts +42 -0
  212. package/dist/integrations/pi/engine/settings-port.js +353 -0
  213. package/dist/integrations/pi/engine/transcript-projection.d.ts +39 -0
  214. package/dist/integrations/pi/engine/transcript-projection.js +405 -0
  215. package/dist/integrations/pi/engine/usage-view.d.ts +4 -0
  216. package/dist/integrations/pi/engine/usage-view.js +56 -0
  217. package/dist/integrations/pi/engine/workflow-contexts.d.ts +59 -0
  218. package/dist/integrations/pi/engine/workflow-contexts.js +316 -0
  219. package/dist/integrations/pi/engine/workflow-runner.d.ts +60 -0
  220. package/dist/integrations/pi/engine/workflow-runner.js +509 -0
  221. package/dist/integrations/pi/engine/workflow-support.d.ts +33 -0
  222. package/dist/integrations/pi/engine/workflow-support.js +352 -0
  223. package/dist/integrations/pi/engine/workflows.d.ts +63 -2
  224. package/dist/integrations/pi/engine/workflows.js +5 -2
  225. package/dist/integrations/pi/startup-public.js +576 -554
  226. package/dist/integrations/pi/startup-public.manifest.json +1730 -984
  227. package/dist/integrations/pi/tui-runtime/adapter.js +10 -13
  228. package/dist/integrations/pi/tui-runtime/contracts.d.ts +11 -1
  229. package/dist/integrations/pi/tui-runtime/damage-aware-terminal.d.ts +1 -1
  230. package/dist/integrations/pi/tui-runtime/damage-aware-terminal.js +4 -7
  231. package/dist/integrations/pi/tui-runtime/index.d.ts +8 -6
  232. package/dist/integrations/pi/tui-runtime/index.js +4 -6
  233. package/dist/integrations/pi/tui-runtime/mouse-report-input.js +2 -4
  234. package/dist/integrations/pi/tui-runtime/overlay-geometry.d.ts +2 -2
  235. package/dist/integrations/pi/tui-runtime/overlay-geometry.js +4 -5
  236. package/dist/integrations/pi/tui-runtime/presentation-adapter.js +1 -1
  237. package/dist/native/darwin-arm64/manifest.json +1 -1
  238. package/dist/native/linux-x64/manifest.json +1 -1
  239. package/dist/native/win32-x64/manifest.json +2 -2
  240. package/dist/native/win32-x64/process-guardian.exe +0 -0
  241. package/dist/runtime-payload-inventory.json +51320 -46509
  242. package/dist/ui/apps/index.d.ts +5 -3
  243. package/dist/ui/apps/index.js +3 -3
  244. package/dist/ui/components/index.d.ts +47 -25
  245. package/dist/ui/components/index.js +25 -25
  246. package/dist/ui/components/prompt-input.js +1 -4
  247. package/dist/ui/settings/declarations.d.ts +119 -0
  248. package/dist/ui/settings/declarations.js +20 -11
  249. package/dist/ui/settings/index.d.ts +10 -6
  250. package/dist/ui/settings/index.js +5 -6
  251. package/dist/ui/settings/manager.d.ts +54 -0
  252. package/dist/ui/settings/{session.js → manager.js} +101 -9
  253. package/dist/ui/settings/sections.d.ts +2 -7
  254. package/docs/architecture/boundaries.md +4 -4
  255. package/docs/architecture/history-editor-provenance.md +1 -1
  256. package/docs/architecture/project-structure.md +6 -6
  257. package/docs/architecture/prompt-suggestions.md +1 -1
  258. package/docs/architecture/terminal-host-proof-gate.md +1 -1
  259. package/docs/architecture/terminal-host-spike-evidence.md +1 -1
  260. package/docs/architecture/toolchain.md +8 -0
  261. package/docs/architecture/ui-reference-provenance.md +4 -4
  262. package/docs/ci-release-runbook.md +7 -1
  263. package/docs/features/modal-content-interaction.md +2 -2
  264. package/docs/local-worktree-cleanup.md +4 -2
  265. package/docs/validation.md +6 -4
  266. package/package.json +7 -11
  267. package/bin/pi-tui.d.ts +0 -6
  268. package/bin/pi-tui.js +0 -28
  269. package/bin/sync-pi-tui-proxy.js +0 -97
  270. package/dist/cli/version.d.ts +0 -2
  271. package/dist/cli/version.js +0 -23
  272. package/dist/composition/agent-engine-bridge.d.ts +0 -3
  273. package/dist/composition/agent-engine-bridge.js +0 -108
  274. package/dist/composition/process.d.ts +0 -16
  275. package/dist/composition/process.js +0 -45
  276. package/dist/contracts/workspace/index.d.ts +0 -2
  277. package/dist/contracts/workspace/index.js +0 -2
  278. package/dist/contracts/workspace/model.d.ts +0 -248
  279. package/dist/contracts/workspace/model.js +0 -2
  280. package/dist/contracts/workspace/validation.d.ts +0 -13
  281. package/dist/contracts/workspace/validation.js +0 -335
  282. package/dist/features/owned-ui/customization.d.ts +0 -40
  283. package/dist/features/owned-ui/customization.js +0 -110
  284. package/dist/features/owned-ui/diagnostics.d.ts +0 -34
  285. package/dist/features/owned-ui/diagnostics.js +0 -95
  286. package/dist/features/workspace/capabilities.d.ts +0 -31
  287. package/dist/features/workspace/capabilities.js +0 -75
  288. package/dist/features/workspace/index.d.ts +0 -6
  289. package/dist/features/workspace/index.js +0 -6
  290. package/dist/features/workspace/presentation.d.ts +0 -30
  291. package/dist/features/workspace/presentation.js +0 -70
  292. package/dist/features/workspace/reconciliation.d.ts +0 -15
  293. package/dist/features/workspace/reconciliation.js +0 -82
  294. package/dist/features/workspace/reducer.d.ts +0 -43
  295. package/dist/features/workspace/reducer.js +0 -214
  296. package/dist/features/workspace/router.d.ts +0 -32
  297. package/dist/features/workspace/router.js +0 -125
  298. package/dist/features/workspace/store.d.ts +0 -18
  299. package/dist/features/workspace/store.js +0 -55
  300. package/dist/foundation/native-host-protocol/codec.d.ts +0 -13
  301. package/dist/foundation/native-host-protocol/codec.js +0 -58
  302. package/dist/foundation/native-host-protocol/evidence.d.ts +0 -67
  303. package/dist/foundation/native-host-protocol/evidence.js +0 -141
  304. package/dist/foundation/native-host-protocol/index.d.ts +0 -4
  305. package/dist/foundation/native-host-protocol/index.js +0 -4
  306. package/dist/foundation/native-host-protocol/messages.d.ts +0 -56
  307. package/dist/foundation/native-host-protocol/messages.js +0 -149
  308. package/dist/foundation/native-host-protocol/proof-gate.d.ts +0 -13
  309. package/dist/foundation/native-host-protocol/proof-gate.js +0 -33
  310. package/dist/foundation/structured-agent-runtime/backpressure.d.ts +0 -47
  311. package/dist/foundation/structured-agent-runtime/backpressure.js +0 -119
  312. package/dist/foundation/structured-agent-runtime/commands.d.ts +0 -53
  313. package/dist/foundation/structured-agent-runtime/commands.js +0 -165
  314. package/dist/foundation/structured-agent-runtime/handshake.d.ts +0 -41
  315. package/dist/foundation/structured-agent-runtime/handshake.js +0 -151
  316. package/dist/foundation/structured-agent-runtime/index.d.ts +0 -5
  317. package/dist/foundation/structured-agent-runtime/index.js +0 -5
  318. package/dist/foundation/structured-agent-runtime/reconnection.d.ts +0 -38
  319. package/dist/foundation/structured-agent-runtime/reconnection.js +0 -130
  320. package/dist/foundation/structured-agent-runtime/state.d.ts +0 -57
  321. package/dist/foundation/structured-agent-runtime/state.js +0 -119
  322. package/dist/integrations/pi/components/upstream/components/custom-entry.d.ts +0 -17
  323. package/dist/integrations/pi/components/upstream/components/custom-entry.js +0 -51
  324. package/dist/integrations/pi/components/upstream/components/first-time-setup.d.ts +0 -24
  325. package/dist/integrations/pi/components/upstream/components/first-time-setup.js +0 -105
  326. package/dist/integrations/pi/components/upstream/components/markdown-transform.d.ts +0 -2
  327. package/dist/integrations/pi/components/upstream/components/markdown-transform.js +0 -18
  328. package/dist/integrations/pi/engine/model-auth-integration.d.ts +0 -31
  329. package/dist/integrations/pi/engine/model-auth-integration.js +0 -62
  330. package/dist/integrations/pi/engine/resource-extension-integration.d.ts +0 -32
  331. package/dist/integrations/pi/engine/resource-extension-integration.js +0 -81
  332. package/dist/integrations/pi/engine/settings-effects.js +0 -249
  333. package/dist/integrations/pi/engine/settings-integration.d.ts +0 -43
  334. package/dist/integrations/pi/engine/settings-integration.js +0 -227
  335. package/dist/integrations/pi/engine/workflow-controllers.d.ts +0 -21
  336. package/dist/integrations/pi/engine/workflow-controllers.js +0 -49
  337. package/dist/integrations/pi/session-ui/index.d.ts +0 -5
  338. package/dist/integrations/pi/session-ui/index.js +0 -5
  339. package/dist/integrations/pi/session-ui/paste-executor.d.ts +0 -10
  340. package/dist/integrations/pi/session-ui/paste-preparation-client.d.ts +0 -16
  341. package/dist/integrations/pi/session-ui/route-host.d.ts +0 -5
  342. package/dist/integrations/pi/tui-runtime/conformance.d.ts +0 -18
  343. package/dist/integrations/pi/tui-runtime/conformance.js +0 -145
  344. package/dist/ui/components/prompt-row.d.ts +0 -14
  345. package/dist/ui/components/prompt-row.js +0 -20
  346. package/dist/ui/settings/session.d.ts +0 -36
  347. package/dist/ui/settings/store.d.ts +0 -29
  348. package/dist/ui/settings/store.js +0 -91
  349. package/dist/{integrations/pi/session-ui → app/session-shell}/clipboard-diagnostics.js +2 -2
  350. package/dist/{integrations/pi/session-ui → app/session-shell}/clipboard-image.d.ts +0 -0
  351. package/dist/{integrations/pi/session-ui → app/session-shell}/editor-hyperlink-budget.d.ts +0 -0
  352. package/dist/{integrations/pi/session-ui → app/session-shell}/editor-hyperlink-budget.js +0 -0
  353. package/dist/{integrations/pi/session-ui → app/session-shell}/image-preparation.d.ts +0 -0
  354. package/dist/{integrations/pi/session-ui → app/session-shell}/image-source.d.ts +0 -0
  355. package/dist/{integrations/pi/session-ui → app/session-shell}/image-worker.d.ts +0 -0
  356. package/dist/{integrations/pi/session-ui → app/session-shell}/paste-helper.d.ts +0 -0
  357. package/dist/{integrations/pi/session-ui → app/session-shell}/paste-text-preparation.js +0 -0
  358. package/dist/{integrations/pi/session-ui → app/session-shell}/paste-text-worker.d.ts +0 -0
  359. package/dist/{integrations/pi/session-ui → app/session-shell}/paste-text-worker.js +0 -0
  360. package/dist/{integrations/pi/session-ui/response-copy-helper.d.ts → app/session-shell/paste-types.js} +0 -0
  361. package/dist/{integrations/pi/session-ui → app/session-shell}/path-chip-presentation.js +0 -0
  362. package/dist/{integrations/pi/session-ui → app/session-shell}/quit-outro-effects.d.ts +0 -0
  363. package/dist/{integrations/pi/session-ui → app/session-shell}/quit-outro-effects.js +0 -0
  364. package/dist/{integrations/pi/session-ui → app/session-shell}/quit-outro.d.ts +0 -0
  365. package/dist/{integrations/pi/session-ui/route-host.js → app/session-shell/response-copy-helper.d.ts} +0 -0
  366. package/dist/{integrations/pi/session-ui → app/session-shell}/response-copy-protocol.js +0 -0
  367. package/dist/{integrations/pi/session-ui → app/session-shell}/stream-presentation-coalescer.d.ts +0 -0
  368. package/dist/{integrations/pi/session-ui → app/session-shell}/stream-presentation-coalescer.js +3 -3
  369. /package/dist/{integrations/pi/session-ui → app/session-shell}/text-paste.d.ts +0 -0
  370. /package/dist/{integrations/pi/session-ui → app/session-shell}/text-paste.js +0 -0
@@ -2,14 +2,34 @@ import { DatabaseSync } from "node:sqlite";
2
2
  import { mkdirSync } from "node:fs";
3
3
  import { dirname } from "node:path";
4
4
  import { PRODUCT_IDENTITY } from "../../product-identity.js";
5
- import { assertManagedAgentDescriptor, assertRecoveryAuthority, assertTerminalSessionLaunch, assertTerminalTopologySnapshot, } from "../../contracts/workspace/index.js";
6
5
  import { assertLaunchInstance, assertLaunchInstanceOutcome, assertNativeProcessIdentity, assertProcessContainmentIdentity, } from "../lifecycle/index.js";
7
- export const DEFAULT_WORKSPACE_ID = "workspace-default";
8
- const INITIAL_WORKSPACE_ID = DEFAULT_WORKSPACE_ID;
6
+ const CONTROL_SCHEMA_VERSION = 7;
7
+ const LAUNCH_INSTANCES_TABLE = `
8
+ CREATE TABLE launch_instances (
9
+ id TEXT PRIMARY KEY,
10
+ owner_client_id TEXT NOT NULL,
11
+ profile_id TEXT NOT NULL CHECK (profile_id IN ('a1', 'pi')),
12
+ state TEXT NOT NULL CHECK (state IN ('requested', 'active', 'stopping', 'completed', 'interrupted')),
13
+ shutdown_policy TEXT NOT NULL CHECK (shutdown_policy = 'terminate-tree-on-close'),
14
+ guardian_identity_json TEXT NOT NULL CHECK (json_valid(guardian_identity_json)),
15
+ root_identity_json TEXT CHECK (root_identity_json IS NULL OR json_valid(root_identity_json)),
16
+ containment_identity_json TEXT CHECK (containment_identity_json IS NULL OR json_valid(containment_identity_json)),
17
+ created_at TEXT NOT NULL,
18
+ activated_at TEXT,
19
+ stopping_at TEXT,
20
+ completed_at TEXT,
21
+ outcome_json TEXT CHECK (outcome_json IS NULL OR json_valid(outcome_json)),
22
+ owner_boot_nonce TEXT NOT NULL,
23
+ CHECK ((state = 'requested' AND root_identity_json IS NULL AND containment_identity_json IS NULL AND activated_at IS NULL AND stopping_at IS NULL AND completed_at IS NULL AND outcome_json IS NULL)
24
+ OR (state = 'active' AND root_identity_json IS NOT NULL AND containment_identity_json IS NOT NULL AND activated_at IS NOT NULL AND stopping_at IS NULL AND completed_at IS NULL AND outcome_json IS NULL)
25
+ OR (state = 'stopping' AND root_identity_json IS NOT NULL AND containment_identity_json IS NOT NULL AND activated_at IS NOT NULL AND stopping_at IS NOT NULL AND completed_at IS NULL AND outcome_json IS NULL)
26
+ OR (state IN ('completed', 'interrupted') AND completed_at IS NOT NULL AND outcome_json IS NOT NULL))
27
+ );
28
+ `;
9
29
  /** Owns WAL-backed control persistence and reconciles prior-boot records before current use. */
10
30
  export class ControlStore {
11
- bootNonce;
12
31
  database;
32
+ bootNonce;
13
33
  constructor(path, bootNonce = null) {
14
34
  this.bootNonce = bootNonce;
15
35
  mkdirSync(dirname(path), { recursive: true, mode: 0o700 });
@@ -18,10 +38,8 @@ export class ControlStore {
18
38
  this.database.exec("PRAGMA journal_mode = WAL");
19
39
  this.database.exec("PRAGMA foreign_keys = ON");
20
40
  this.migrate();
21
- if (bootNonce !== null) {
22
- this.reconcilePriorBootGenerations(bootNonce);
41
+ if (bootNonce !== null)
23
42
  this.reconcilePriorBootLaunchInstances(bootNonce);
24
- }
25
43
  }
26
44
  catch (error) {
27
45
  this.database.close();
@@ -31,58 +49,24 @@ export class ControlStore {
31
49
  migrate() {
32
50
  const versionRow = this.database.prepare("PRAGMA user_version").get();
33
51
  const version = versionRow.user_version;
34
- if (version > 6)
35
- throw new Error(`control database version ${version} is newer than supported version 6`);
52
+ if (version > CONTROL_SCHEMA_VERSION)
53
+ throw new Error(`control database version ${version} is newer than supported version ${CONTROL_SCHEMA_VERSION}`);
36
54
  if (version !== 0)
37
55
  this.#assertCurrentControlSchema();
38
56
  if (version === 0) {
57
+ // Rationale: a new database gets only the live schema; the historical chain below exists for
58
+ // databases created by earlier releases and ends by dropping the retired workspace tables.
39
59
  this.database.exec(`
40
60
  BEGIN IMMEDIATE;
41
- CREATE TABLE workspaces (
42
- id TEXT PRIMARY KEY,
43
- name TEXT NOT NULL,
44
- selected_agent_id TEXT,
45
- created_at TEXT NOT NULL
46
- );
47
- CREATE TABLE driver_profiles (
48
- id TEXT PRIMARY KEY,
49
- kind TEXT NOT NULL,
50
- profile_json TEXT NOT NULL,
51
- created_at TEXT NOT NULL
52
- );
53
- CREATE TABLE terminal_agents (
54
- id TEXT PRIMARY KEY,
55
- workspace_id TEXT NOT NULL REFERENCES workspaces(id) ON DELETE CASCADE,
56
- name TEXT NOT NULL,
57
- profile_id TEXT NOT NULL REFERENCES driver_profiles(id),
58
- profile_json TEXT NOT NULL,
59
- surface_json TEXT,
60
- created_at TEXT NOT NULL
61
- );
62
- CREATE TABLE process_generations (
63
- id TEXT PRIMARY KEY,
64
- agent_id TEXT NOT NULL REFERENCES terminal_agents(id) ON DELETE CASCADE,
65
- sequence INTEGER NOT NULL,
66
- profile_id TEXT NOT NULL REFERENCES driver_profiles(id),
67
- state TEXT NOT NULL,
68
- capabilities_json TEXT NOT NULL,
69
- started_at TEXT NOT NULL,
70
- exited_at TEXT,
71
- exit_code INTEGER,
72
- signal INTEGER,
73
- error TEXT,
74
- owner_boot_nonce TEXT,
75
- UNIQUE(agent_id, sequence)
76
- );
77
- CREATE INDEX idx_agents_workspace ON terminal_agents(workspace_id, created_at);
78
- CREATE INDEX idx_generations_agent ON process_generations(agent_id, sequence DESC);
79
- CREATE INDEX idx_generations_owner_boot ON process_generations(owner_boot_nonce, state);
80
- PRAGMA user_version = 1;
61
+ ${LAUNCH_INSTANCES_TABLE}
62
+ CREATE INDEX idx_launch_instances_owner ON launch_instances(owner_client_id, state);
63
+ CREATE INDEX idx_launch_instances_boot ON launch_instances(owner_boot_nonce, state);
64
+ CREATE TABLE product_identity (schema TEXT PRIMARY KEY NOT NULL);
65
+ PRAGMA user_version = ${CONTROL_SCHEMA_VERSION};
81
66
  COMMIT;
82
67
  `);
83
- const now = new Date().toISOString();
84
- this.database.prepare("INSERT INTO workspaces (id, name, selected_agent_id, created_at) VALUES (?, ?, NULL, ?)")
85
- .run(INITIAL_WORKSPACE_ID, "Workspace", now);
68
+ this.database.prepare("INSERT INTO product_identity (schema) VALUES (?)").run(PRODUCT_IDENTITY.protocol.controlStoreSchema);
69
+ return;
86
70
  }
87
71
  if (version <= 1) {
88
72
  const columns = this.database.prepare("PRAGMA table_info(process_generations)").all();
@@ -217,26 +201,7 @@ export class ControlStore {
217
201
  ALTER TABLE launch_instances RENAME TO launch_instances_v5;
218
202
  DROP INDEX idx_launch_instances_owner;
219
203
  DROP INDEX idx_launch_instances_boot;
220
- CREATE TABLE launch_instances (
221
- id TEXT PRIMARY KEY,
222
- owner_client_id TEXT NOT NULL,
223
- profile_id TEXT NOT NULL CHECK (profile_id IN ('a1', 'pi')),
224
- state TEXT NOT NULL CHECK (state IN ('requested', 'active', 'stopping', 'completed', 'interrupted')),
225
- shutdown_policy TEXT NOT NULL CHECK (shutdown_policy = 'terminate-tree-on-close'),
226
- guardian_identity_json TEXT NOT NULL CHECK (json_valid(guardian_identity_json)),
227
- root_identity_json TEXT CHECK (root_identity_json IS NULL OR json_valid(root_identity_json)),
228
- containment_identity_json TEXT CHECK (containment_identity_json IS NULL OR json_valid(containment_identity_json)),
229
- created_at TEXT NOT NULL,
230
- activated_at TEXT,
231
- stopping_at TEXT,
232
- completed_at TEXT,
233
- outcome_json TEXT CHECK (outcome_json IS NULL OR json_valid(outcome_json)),
234
- owner_boot_nonce TEXT NOT NULL,
235
- CHECK ((state = 'requested' AND root_identity_json IS NULL AND containment_identity_json IS NULL AND activated_at IS NULL AND stopping_at IS NULL AND completed_at IS NULL AND outcome_json IS NULL)
236
- OR (state = 'active' AND root_identity_json IS NOT NULL AND containment_identity_json IS NOT NULL AND activated_at IS NOT NULL AND stopping_at IS NULL AND completed_at IS NULL AND outcome_json IS NULL)
237
- OR (state = 'stopping' AND root_identity_json IS NOT NULL AND containment_identity_json IS NOT NULL AND activated_at IS NOT NULL AND stopping_at IS NOT NULL AND completed_at IS NULL AND outcome_json IS NULL)
238
- OR (state IN ('completed', 'interrupted') AND completed_at IS NOT NULL AND outcome_json IS NOT NULL))
239
- );
204
+ ${LAUNCH_INSTANCES_TABLE}
240
205
  INSERT INTO launch_instances SELECT * FROM launch_instances_v5 WHERE profile_id IN ('a1', 'pi');
241
206
  DROP TABLE launch_instances_v5;
242
207
  CREATE INDEX idx_launch_instances_owner ON launch_instances(owner_client_id, state);
@@ -245,9 +210,23 @@ export class ControlStore {
245
210
  COMMIT;
246
211
  `);
247
212
  }
248
- if (version === 0) {
249
- this.database.exec("CREATE TABLE product_identity (schema TEXT PRIMARY KEY NOT NULL)");
250
- this.database.prepare("INSERT INTO product_identity (schema) VALUES (?)").run(PRODUCT_IDENTITY.protocol.controlStoreSchema);
213
+ if (version <= 6) {
214
+ // Rationale: the multi-agent workspace, terminal-host topology, and recovery tables never had a
215
+ // production writer; children go before parents so foreign keys never see an orphan.
216
+ this.database.exec(`
217
+ BEGIN IMMEDIATE;
218
+ DROP TABLE IF EXISTS recovery_references;
219
+ DROP TABLE IF EXISTS terminal_sessions;
220
+ DROP TABLE IF EXISTS native_host_topology;
221
+ DROP TABLE IF EXISTS workspace_agents;
222
+ DROP TABLE IF EXISTS process_generations;
223
+ DROP TABLE IF EXISTS terminal_agents;
224
+ DROP TABLE IF EXISTS driver_profiles;
225
+ DROP TABLE IF EXISTS workspaces;
226
+ DROP TABLE IF EXISTS foreground_terminal_leases;
227
+ PRAGMA user_version = ${CONTROL_SCHEMA_VERSION};
228
+ COMMIT;
229
+ `);
251
230
  }
252
231
  }
253
232
  #assertCurrentControlSchema() {
@@ -259,17 +238,6 @@ export class ControlStore {
259
238
  throw new Error(`control database schema ${String(identity?.schema)} is unsupported; expected ${PRODUCT_IDENTITY.protocol.controlStoreSchema}`);
260
239
  }
261
240
  }
262
- reconcilePriorBootGenerations(bootNonce) {
263
- const now = new Date().toISOString();
264
- return this.#transaction(() => {
265
- const result = this.database.prepare(`UPDATE process_generations
266
- SET state = 'interrupted', exited_at = ?, error = COALESCE(error, 'supervisor ownership ended before a terminal outcome')
267
- WHERE state NOT IN ('exited', 'stopped', 'interrupted', 'error')
268
- AND (owner_boot_nonce IS NULL OR owner_boot_nonce <> ?)`)
269
- .run(now, bootNonce);
270
- return Number(result.changes);
271
- });
272
- }
273
241
  createLaunchInstance(instance) {
274
242
  if (this.bootNonce === null)
275
243
  throw new Error("launch instance storage requires a supervisor boot identity");
@@ -337,161 +305,6 @@ export class ControlStore {
337
305
  .run(reconciledAt, JSON.stringify(outcome), bootNonce);
338
306
  return Number(result.changes);
339
307
  }
340
- persistWorkspaceAgent(agent, updatedAt = new Date().toISOString()) {
341
- const existing = this.loadWorkspaceAgentRecord(agent.id);
342
- this.persistWorkspaceAgentRecord({
343
- agent,
344
- presentation: existing?.presentation ?? { unreadActivity: 0, attention: false, failure: null },
345
- }, updatedAt);
346
- }
347
- persistWorkspaceAgentRecord(record, updatedAt = new Date().toISOString()) {
348
- assertManagedAgentDescriptor(record.agent);
349
- assertWorkspaceAgentPresentation(record.presentation);
350
- this.#upsertWorkspaceAgentRecord(record, updatedAt);
351
- }
352
- replaceWorkspaceAgentRecords(records, selectedAgentId, revision, updatedAt = new Date().toISOString()) {
353
- if (!Number.isSafeInteger(revision) || revision < 0)
354
- throw new RangeError("workspace revision must be a non-negative safe integer");
355
- const ids = new Set();
356
- for (const record of records) {
357
- assertManagedAgentDescriptor(record.agent);
358
- assertWorkspaceAgentPresentation(record.presentation);
359
- if (ids.has(record.agent.id))
360
- throw new TypeError(`duplicate workspace agent id: ${record.agent.id}`);
361
- ids.add(record.agent.id);
362
- }
363
- if (selectedAgentId !== null && !ids.has(selectedAgentId))
364
- throw new TypeError("selected workspace agent must exist in the replacement set");
365
- this.#transaction(() => {
366
- if (records.length === 0)
367
- this.database.prepare("DELETE FROM workspace_agents").run();
368
- else {
369
- const placeholders = records.map(() => "?").join(", ");
370
- this.database.prepare(`DELETE FROM workspace_agents WHERE id NOT IN (${placeholders})`).run(...records.map(record => record.agent.id));
371
- }
372
- for (const record of records)
373
- this.#upsertWorkspaceAgentRecord(record, updatedAt);
374
- this.database.prepare("UPDATE workspaces SET selected_agent_id = ?, revision = ? WHERE id = ?").run(selectedAgentId, revision, INITIAL_WORKSPACE_ID);
375
- });
376
- }
377
- loadWorkspaceAgents() {
378
- return this.loadWorkspaceAgentRecords().map(record => record.agent);
379
- }
380
- loadWorkspaceAgentRecord(agentId) {
381
- const row = this.database.prepare("SELECT * FROM workspace_agents WHERE id = ?").get(agentId);
382
- return row ? workspaceAgentFromRow(row) : null;
383
- }
384
- loadWorkspaceAgentRecords() {
385
- const rows = this.database.prepare("SELECT * FROM workspace_agents ORDER BY created_at, id").all();
386
- return rows.map(workspaceAgentFromRow);
387
- }
388
- loadSelectedWorkspaceAgentId() {
389
- const row = this.database.prepare("SELECT selected_agent_id FROM workspaces WHERE id = ?").get(INITIAL_WORKSPACE_ID);
390
- return row?.selected_agent_id ?? null;
391
- }
392
- loadWorkspaceRevision() {
393
- const row = this.database.prepare("SELECT revision FROM workspaces WHERE id = ?").get(INITIAL_WORKSPACE_ID);
394
- return row?.revision ?? 0;
395
- }
396
- #upsertWorkspaceAgentRecord(record, updatedAt) {
397
- const agent = record.agent;
398
- this.database.prepare(`INSERT INTO workspace_agents
399
- (id, workspace_id, display_name, adapter_id, runtime_kind, lifecycle, capability_json, recovery_reference_id, unread_count, attention, failure_json, created_at, updated_at)
400
- VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
401
- ON CONFLICT(id) DO UPDATE SET
402
- workspace_id = excluded.workspace_id,
403
- display_name = excluded.display_name,
404
- adapter_id = excluded.adapter_id,
405
- runtime_kind = excluded.runtime_kind,
406
- lifecycle = excluded.lifecycle,
407
- capability_json = excluded.capability_json,
408
- recovery_reference_id = excluded.recovery_reference_id,
409
- unread_count = excluded.unread_count,
410
- attention = excluded.attention,
411
- failure_json = excluded.failure_json,
412
- updated_at = excluded.updated_at`)
413
- .run(agent.id, INITIAL_WORKSPACE_ID, agent.displayName, agent.adapterId, agent.runtime, agent.lifecycle, JSON.stringify(agent.capability), agent.recoveryReferenceId, record.presentation.unreadActivity, record.presentation.attention ? 1 : 0, record.presentation.failure === null ? null : JSON.stringify(record.presentation.failure), agent.createdAt, updatedAt);
414
- }
415
- saveNativeHostTopology(topology, rollbackTopology, updatedAt = new Date().toISOString()) {
416
- assertTerminalTopologySnapshot(topology);
417
- if (rollbackTopology !== null)
418
- assertTerminalTopologySnapshot(rollbackTopology);
419
- if (rollbackTopology !== null && rollbackTopology.hostInstanceId !== topology.hostInstanceId) {
420
- throw new TypeError("topology rollback metadata must identify the same native host");
421
- }
422
- const prior = this.loadNativeHostTopology(topology.hostInstanceId);
423
- if (prior !== null && topology.revision < prior.topology.revision) {
424
- throw new RangeError(`stale native-host topology revision ${topology.revision}; persisted revision is ${prior.topology.revision}`);
425
- }
426
- if (rollbackTopology !== null && rollbackTopology.revision > topology.revision) {
427
- throw new RangeError("topology rollback revision cannot be newer than the persisted topology");
428
- }
429
- const rollbackJson = rollbackTopology === null
430
- ? JSON.stringify({ contractVersion: 1, reason: "initial native-host topology", topology: null })
431
- : JSON.stringify({ contractVersion: 1, reason: "backward-readable prior authoritative topology", topology: rollbackTopology });
432
- this.database.prepare(`INSERT INTO native_host_topology
433
- (host_instance_id, protocol_version, revision, topology_json, rollback_json, updated_at)
434
- VALUES (?, 1, ?, ?, ?, ?)
435
- ON CONFLICT(host_instance_id) DO UPDATE SET
436
- revision = excluded.revision,
437
- topology_json = excluded.topology_json,
438
- rollback_json = excluded.rollback_json,
439
- updated_at = excluded.updated_at`)
440
- .run(topology.hostInstanceId, topology.revision, JSON.stringify(topology), rollbackJson, updatedAt);
441
- }
442
- loadNativeHostTopology(hostInstanceId) {
443
- const row = this.database.prepare("SELECT * FROM native_host_topology WHERE host_instance_id = ?").get(hostInstanceId);
444
- if (!row)
445
- return null;
446
- const topology = JSON.parse(row.topology_json);
447
- assertTerminalTopologySnapshot(topology);
448
- return { topology, rollback: JSON.parse(row.rollback_json), updatedAt: row.updated_at };
449
- }
450
- persistTerminalSession(session, hostInstanceId, paneId, lifecycle, recoveryReferenceId, updatedAt = new Date().toISOString()) {
451
- assertTerminalSessionLaunch(session);
452
- this.database.prepare(`INSERT INTO terminal_sessions
453
- (id, host_instance_id, pane_id, lifecycle, launch_json, recovery_reference_id, updated_at)
454
- VALUES (?, ?, ?, ?, ?, ?, ?)
455
- ON CONFLICT(id) DO UPDATE SET
456
- host_instance_id = excluded.host_instance_id,
457
- pane_id = excluded.pane_id,
458
- lifecycle = excluded.lifecycle,
459
- launch_json = excluded.launch_json,
460
- recovery_reference_id = excluded.recovery_reference_id,
461
- updated_at = excluded.updated_at`)
462
- .run(session.id, hostInstanceId, paneId, lifecycle, JSON.stringify(session), recoveryReferenceId, updatedAt);
463
- }
464
- loadTerminalSessions() {
465
- const rows = this.database.prepare("SELECT * FROM terminal_sessions ORDER BY id").all();
466
- return rows.map(row => {
467
- const session = JSON.parse(row.launch_json);
468
- assertTerminalSessionLaunch(session);
469
- return { session, hostInstanceId: row.host_instance_id, paneId: row.pane_id, lifecycle: row.lifecycle, recoveryReferenceId: row.recovery_reference_id };
470
- });
471
- }
472
- persistRecoveryReference(authority, status, rollbackMetadata, updatedAt = new Date().toISOString()) {
473
- assertRecoveryAuthority(authority);
474
- const createdAt = typeof rollbackMetadata.createdAt === "string" ? rollbackMetadata.createdAt : updatedAt;
475
- const rollbackJson = JSON.stringify({ contractVersion: 1, ...rollbackMetadata });
476
- this.database.prepare(`INSERT INTO recovery_references
477
- (id, agent_id, authority_json, status, rollback_json, created_at, updated_at)
478
- VALUES (?, ?, ?, ?, ?, ?, ?)
479
- ON CONFLICT(id) DO UPDATE SET
480
- agent_id = excluded.agent_id,
481
- authority_json = excluded.authority_json,
482
- status = excluded.status,
483
- rollback_json = excluded.rollback_json,
484
- updated_at = excluded.updated_at`)
485
- .run(authority.referenceId, authority.agentId, JSON.stringify(authority), status, rollbackJson, createdAt, updatedAt);
486
- }
487
- loadRecoveryReference(id) {
488
- const row = this.database.prepare("SELECT * FROM recovery_references WHERE id = ?").get(id);
489
- if (!row)
490
- return null;
491
- const authority = JSON.parse(row.authority_json);
492
- assertRecoveryAuthority(authority);
493
- return { authority, status: row.status, rollback: JSON.parse(row.rollback_json), updatedAt: row.updated_at };
494
- }
495
308
  close() {
496
309
  this.database.close();
497
310
  }
@@ -508,42 +321,6 @@ export class ControlStore {
508
321
  }
509
322
  }
510
323
  }
511
- function workspaceAgentFromRow(row) {
512
- const descriptor = {
513
- id: row.id,
514
- displayName: row.display_name,
515
- adapterId: row.adapter_id,
516
- runtime: row.runtime_kind,
517
- lifecycle: row.lifecycle,
518
- capability: JSON.parse(row.capability_json),
519
- createdAt: row.created_at,
520
- recoveryReferenceId: row.recovery_reference_id,
521
- };
522
- assertManagedAgentDescriptor(descriptor);
523
- const failure = row.failure_json === null ? null : JSON.parse(row.failure_json);
524
- const presentation = {
525
- unreadActivity: row.unread_count,
526
- attention: row.attention === 1,
527
- failure,
528
- };
529
- assertWorkspaceAgentPresentation(presentation);
530
- return { agent: descriptor, presentation };
531
- }
532
- function assertWorkspaceAgentPresentation(presentation) {
533
- if (!Number.isSafeInteger(presentation.unreadActivity) || presentation.unreadActivity < 0) {
534
- throw new RangeError("workspace unread activity must be a non-negative safe integer");
535
- }
536
- if (typeof presentation.attention !== "boolean")
537
- throw new TypeError("workspace attention must be boolean");
538
- if (presentation.failure !== null) {
539
- if (!presentation.failure.code || presentation.failure.code.length > 128 || presentation.failure.code.includes("\0")) {
540
- throw new TypeError("workspace failure code is invalid");
541
- }
542
- if (!presentation.failure.message || presentation.failure.message.length > 4_096 || presentation.failure.message.includes("\0")) {
543
- throw new TypeError("workspace failure message is invalid");
544
- }
545
- }
546
- }
547
324
  function launchInstanceFromRow(row) {
548
325
  const instance = {
549
326
  id: row.id,
@@ -1 +1 @@
1
- export * from "./control-store.js";
1
+ export { ControlStore } from "./control-store.js";
@@ -1 +1 @@
1
- export * from "./control-store.js";
1
+ export { ControlStore } from "./control-store.js";
@@ -1,3 +1,3 @@
1
- export * from "./main.js";
2
- export * from "./server.js";
1
+ export { runSupervisor } from "./main.js";
2
+ export { SupervisorServer, commitEndpointMetadata } from "./server.js";
3
3
  export { resolveCohortEndpoint, resolveProductPaths, type CohortEndpointPaths, type ProductPaths } from "../lifecycle/index.js";
@@ -1,3 +1,3 @@
1
- export * from "./main.js";
2
- export * from "./server.js";
1
+ export { runSupervisor } from "./main.js";
2
+ export { SupervisorServer, commitEndpointMetadata } from "./server.js";
3
3
  export { resolveCohortEndpoint, resolveProductPaths } from "../lifecycle/index.js";
@@ -15,23 +15,18 @@ export declare function commitEndpointMetadata(path: string, source: string, ope
15
15
  /** Owns one release-cohort endpoint and the authenticated launch instances registered through it. */
16
16
  export declare class SupervisorServer {
17
17
  #private;
18
+ readonly id: `${string}-${string}-${string}-${string}-${string}`;
19
+ readonly bootNonce: string;
20
+ readonly pidStartIdentity: string;
21
+ readonly startedAt: string;
22
+ readonly paths: ProductPaths;
18
23
  readonly store: ControlStore;
19
24
  readonly release: MaterializedRelease;
20
25
  readonly terminateProcess: (code: number) => void;
21
26
  readonly reconciliationDeadlineMs: number;
22
27
  readonly shutdownDeadlineMs: number;
23
- /**
24
- * Which release new sessions start on. A cohort that is no longer that release keeps
25
- * serving the instances it already has, takes no new ones, and exits when its last one
26
- * leaves. Absent, this supervisor never considers itself superseded.
27
- */
28
28
  readonly readActiveReleaseId: (() => Promise<string | null>) | null;
29
29
  readonly supersededPollMs: number;
30
- readonly id: `${string}-${string}-${string}-${string}-${string}`;
31
- readonly bootNonce: string;
32
- readonly pidStartIdentity: string;
33
- readonly startedAt: string;
34
- readonly paths: ProductPaths;
35
30
  constructor(store: ControlStore, paths: ProductPaths | undefined, release: MaterializedRelease, bootNonce?: string, terminateProcess?: (code: number) => void, reconciliationDeadlineMs?: number, shutdownDeadlineMs?: number,
36
31
  /**
37
32
  * Which release new sessions start on. A cohort that is no longer that release keeps
@@ -41,13 +41,6 @@ export async function commitEndpointMetadata(path, source, operations = {}) {
41
41
  }
42
42
  /** Owns one release-cohort endpoint and the authenticated launch instances registered through it. */
43
43
  export class SupervisorServer {
44
- store;
45
- release;
46
- terminateProcess;
47
- reconciliationDeadlineMs;
48
- shutdownDeadlineMs;
49
- readActiveReleaseId;
50
- supersededPollMs;
51
44
  id = randomUUID();
52
45
  bootNonce;
53
46
  pidStartIdentity = `${process.pid}:${Math.floor(Date.now() - process.uptime() * 1_000)}`;
@@ -68,6 +61,13 @@ export class SupervisorServer {
68
61
  #closing = false;
69
62
  #superseded = false;
70
63
  #supersededPoll = null;
64
+ store;
65
+ release;
66
+ terminateProcess;
67
+ reconciliationDeadlineMs;
68
+ shutdownDeadlineMs;
69
+ readActiveReleaseId;
70
+ supersededPollMs;
71
71
  constructor(store, paths = resolveProductPaths(), release, bootNonce = randomUUID(), terminateProcess = code => process.exit(code), reconciliationDeadlineMs = 3_000, shutdownDeadlineMs = 1_500,
72
72
  /**
73
73
  * Which release new sessions start on. A cohort that is no longer that release keeps
@@ -1,2 +1,3 @@
1
- export * from "./terminal-reset.js";
2
- export * from "./fatal-exit.js";
1
+ export { EMERGENCY_TERMINAL_RESET, boundedCleanup, restoreAfterOwnedExit, restoreProcessTerminal } from "./terminal-reset.js";
2
+ export { installFatalExit, writeFatalDiagnostic } from "./fatal-exit.js";
3
+ export type { FatalExitOptions } from "./fatal-exit.js";
@@ -1,2 +1,2 @@
1
- export * from "./terminal-reset.js";
2
- export * from "./fatal-exit.js";
1
+ export { EMERGENCY_TERMINAL_RESET, boundedCleanup, restoreAfterOwnedExit, restoreProcessTerminal } from "./terminal-reset.js";
2
+ export { installFatalExit, writeFatalDiagnostic } from "./fatal-exit.js";
@@ -1,4 +1,4 @@
1
- import type { Editor } from "#pi-tui";
1
+ import type { Editor } from "@earendil-works/pi-tui";
2
2
  export interface EditorInteractionState {
3
3
  lines: string[];
4
4
  cursorLine: number;
@@ -1,5 +1,5 @@
1
1
  import { type ShellEditorInstance, type OwnedEditorOptions } from "./upstream/components/owned-editor.js";
2
- import type { EditorTheme, TUI } from "#pi-tui";
2
+ import type { EditorTheme, TUI } from "@earendil-works/pi-tui";
3
3
  import type { KeybindingsManager } from "./upstream/adjacent/core/keybindings.js";
4
4
  export type HistoryEditorConstructor = new (tui: TUI, theme: EditorTheme, keybindings: KeybindingsManager, options?: OwnedEditorOptions) => ShellEditorInstance;
5
5
  export declare function loadHistoryEditor(): Promise<HistoryEditorConstructor>;
@@ -1,14 +1,21 @@
1
- export * from "./components.js";
1
+ export { adaptPiAssistantMessage, adaptPiToolExecution, adaptPiUserMessage } from "./components.js";
2
2
  export { loadHistoryEditor, type HistoryEditorConstructor } from "./history-editor-loader.js";
3
- export * from "./conformance.js";
4
- export * from "./shell-components.js";
5
- export * from "./theme.js";
6
- export * from "./upstream/theme/theme-controller.js";
7
- export { applyConfiguredPiTheme, getAvailablePiThemes, onPiThemeChange } from "./upstream/theme/theme.js";
8
- export * from "./upstream/components/countdown-timer.js";
9
- export * from "./upstream/components/extension-editor.js";
10
- export * from "./upstream/components/session-selector.js";
11
- export * from "./upstream/components/session-selector-search.js";
12
- export * from "./upstream/components/status-indicator.js";
13
- export * from "./upstream/components/tree-selector.js";
14
- export * from "./upstream/adjacent/core/keybindings.js";
3
+ export { PiComponentConformanceError, runPiComponentConformance } from "./conformance.js";
4
+ export type { PiComponentConformanceReport, PiComponentConformanceResult } from "./conformance.js";
5
+ export { PINNED_PI_BUILTIN_SLASH_COMMANDS, componentFromPort, componentPort, createPiExtensionUiBridge, createPiQueuedInputStatus, createPiShellArmin, createPiShellAuthProviderSelector, createPiShellChangelog, createPiShellCollapsedChangelog, createPiShellDaxnuts, createPiShellDialog, createPiShellEarendilAnnouncement, createPiShellEditor, createPiShellExtensionSelector, createPiShellFooter, createPiShellHeader, createPiShellHotkeys, createPiShellLoadedResources, createPiShellLoginDialog, createPiShellModelSelector, createPiShellOperationLoader, createPiShellReloadBox, createPiShellScopedModelsSelector, createPiShellSelector, createPiShellSessionInfo, createPiShellSessionSelector, createPiShellSettingsSelector, createPiShellShowImagesSelector, createPiShellStatus, createPiShellThemeSelector, createPiShellThinkingSelector, createPiShellTranscriptComponent, createPiShellTreeSelector, createPiShellTrustSelector, createPiShellUserMessageSelector, createTuiFacade, ensureTheme, formatSessionTokens, isAutocompleteProvider, isPiPromptStyleCompaction, isRecord, paintPiSubmittedPromptTimestamp, piShellHyperlink, piShellTruncateToWidth, piShellVisibleWidth, renderPiShellCommandMessage, renderPiShellPackageUpdateNotice, renderPiShellStartupDiagnostic, renderPiShellStatusText, renderPiShellTranscriptBlock, validatedAssistantMessage, } from "./shell-components.js";
6
+ export type { PiExtensionUiBridge, PiExtensionUiBridgeHost, PiShellAuthProviderOption, PiShellAutocompleteCommand, PiShellClipboardContent, PiShellCommandMessagePresentation, PiShellComponentPort, PiShellEditorBodyGeometry, PiShellEditorOptions, PiShellEditorPointerEvent, PiShellEditorPort, PiShellEditorTextRange, PiShellExtensionRendererResolver, PiShellHeaderOptions, PiShellHeaderPort, PiShellImageAssetResolver, PiShellLoadedResourcesPort, PiShellLoginDialogPort, PiShellModelSelectorOptions, PiShellOperationLoaderPort, PiShellPasteReservation, PiShellQueuedInputPort, PiShellResourceEntry, PiShellResourceSection, PiShellScopedModelDescriptor, PiShellScopedModelsSelectorOptions, PiShellScopedModelsSelectorPort, PiShellSelectorOption, PiShellSelectorOptions, PiShellSessionInfoPresentation, PiShellSettingsSelectorOptions, PiShellStartupNotice, PiShellStatusPlacement, PiShellStatusPort, PiShellSubmittedPromptComposer, PiShellTranscriptComponentPort, PiShellViewComponentPort, } from "./shell-components.js";
7
+ export { PINNED_PI_LAYOUT, applyConfiguredPiTheme, applyPiTheme, applyPiThemeInstance, currentPiThemeName, detectPiTerminalBackgroundFromEnv, detectPiTerminalBackgroundTheme, detectPiTerminalThemeForAuto, ensurePiTheme, getAvailablePiThemes, loadPiTheme, onPiThemeChange, parsePiAutoThemeSetting, piTheme, resolvePiThemeSetting, stopPiThemeWatcher, } from "./theme.js";
8
+ export type { PiColorMode, PiTerminalTheme, PiTerminalThemeDetection, PiTerminalThemeDetector, PiThemeBackground, PiThemeResult } from "./theme.js";
9
+ export { OwnedPiThemeController } from "./upstream/theme/theme-controller.js";
10
+ export type { PiThemeRuntimePort, PiThemeSettingsPort } from "./upstream/theme/theme-controller.js";
11
+ export { CountdownTimer } from "./upstream/components/countdown-timer.js";
12
+ export { ExtensionEditorComponent } from "./upstream/components/extension-editor.js";
13
+ export { SessionSelectorComponent } from "./upstream/components/session-selector.js";
14
+ export { filterAndSortSessions, hasSessionName, matchSession, parseSearchQuery } from "./upstream/components/session-selector-search.js";
15
+ export type { MatchResult, NameFilter, ParsedSearchQuery, SortMode } from "./upstream/components/session-selector-search.js";
16
+ export { BranchSummaryStatusIndicator, CompactionStatusIndicator, IdleStatus, RetryStatusIndicator, StatusIndicator, WorkingStatusIndicator, } from "./upstream/components/status-indicator.js";
17
+ export type { CompactionStatusReason, StatusIndicatorKind } from "./upstream/components/status-indicator.js";
18
+ export { TreeSelectorComponent } from "./upstream/components/tree-selector.js";
19
+ export type { FilterMode } from "./upstream/components/tree-selector.js";
20
+ export { KEYBINDINGS, KeybindingsManager, migrateKeybindingsConfig } from "./upstream/adjacent/core/keybindings.js";
21
+ export type { AppKeybinding, AppKeybindings, KeyId, Keybinding, KeybindingsConfig } from "./upstream/adjacent/core/keybindings.js";
@@ -1,14 +1,13 @@
1
- export * from "./components.js";
1
+ export { adaptPiAssistantMessage, adaptPiToolExecution, adaptPiUserMessage } from "./components.js";
2
2
  export { loadHistoryEditor } from "./history-editor-loader.js";
3
- export * from "./conformance.js";
4
- export * from "./shell-components.js";
5
- export * from "./theme.js";
6
- export * from "./upstream/theme/theme-controller.js";
7
- export { applyConfiguredPiTheme, getAvailablePiThemes, onPiThemeChange } from "./upstream/theme/theme.js";
8
- export * from "./upstream/components/countdown-timer.js";
9
- export * from "./upstream/components/extension-editor.js";
10
- export * from "./upstream/components/session-selector.js";
11
- export * from "./upstream/components/session-selector-search.js";
12
- export * from "./upstream/components/status-indicator.js";
13
- export * from "./upstream/components/tree-selector.js";
14
- export * from "./upstream/adjacent/core/keybindings.js";
3
+ export { PiComponentConformanceError, runPiComponentConformance } from "./conformance.js";
4
+ export { PINNED_PI_BUILTIN_SLASH_COMMANDS, componentFromPort, componentPort, createPiExtensionUiBridge, createPiQueuedInputStatus, createPiShellArmin, createPiShellAuthProviderSelector, createPiShellChangelog, createPiShellCollapsedChangelog, createPiShellDaxnuts, createPiShellDialog, createPiShellEarendilAnnouncement, createPiShellEditor, createPiShellExtensionSelector, createPiShellFooter, createPiShellHeader, createPiShellHotkeys, createPiShellLoadedResources, createPiShellLoginDialog, createPiShellModelSelector, createPiShellOperationLoader, createPiShellReloadBox, createPiShellScopedModelsSelector, createPiShellSelector, createPiShellSessionInfo, createPiShellSessionSelector, createPiShellSettingsSelector, createPiShellShowImagesSelector, createPiShellStatus, createPiShellThemeSelector, createPiShellThinkingSelector, createPiShellTranscriptComponent, createPiShellTreeSelector, createPiShellTrustSelector, createPiShellUserMessageSelector, createTuiFacade, ensureTheme, formatSessionTokens, isAutocompleteProvider, isPiPromptStyleCompaction, isRecord, paintPiSubmittedPromptTimestamp, piShellHyperlink, piShellTruncateToWidth, piShellVisibleWidth, renderPiShellCommandMessage, renderPiShellPackageUpdateNotice, renderPiShellStartupDiagnostic, renderPiShellStatusText, renderPiShellTranscriptBlock, validatedAssistantMessage, } from "./shell-components.js";
5
+ export { PINNED_PI_LAYOUT, applyConfiguredPiTheme, applyPiTheme, applyPiThemeInstance, currentPiThemeName, detectPiTerminalBackgroundFromEnv, detectPiTerminalBackgroundTheme, detectPiTerminalThemeForAuto, ensurePiTheme, getAvailablePiThemes, loadPiTheme, onPiThemeChange, parsePiAutoThemeSetting, piTheme, resolvePiThemeSetting, stopPiThemeWatcher, } from "./theme.js";
6
+ export { OwnedPiThemeController } from "./upstream/theme/theme-controller.js";
7
+ export { CountdownTimer } from "./upstream/components/countdown-timer.js";
8
+ export { ExtensionEditorComponent } from "./upstream/components/extension-editor.js";
9
+ export { SessionSelectorComponent } from "./upstream/components/session-selector.js";
10
+ export { filterAndSortSessions, hasSessionName, matchSession, parseSearchQuery } from "./upstream/components/session-selector-search.js";
11
+ export { BranchSummaryStatusIndicator, CompactionStatusIndicator, IdleStatus, RetryStatusIndicator, StatusIndicator, WorkingStatusIndicator, } from "./upstream/components/status-indicator.js";
12
+ export { TreeSelectorComponent } from "./upstream/components/tree-selector.js";
13
+ export { KEYBINDINGS, KeybindingsManager, migrateKeybindingsConfig } from "./upstream/adjacent/core/keybindings.js";
@@ -1,13 +1,10 @@
1
1
  import { ImageAttachmentError, MAX_CLIPBOARD_TEXT_BYTES } from "../../../contracts/owned-ui/index.js";
2
- import { CURSOR_MARKER, decodeKittyPrintable, visibleWidth, } from "#pi-tui";
2
+ import { CURSOR_MARKER, decodeKittyPrintable, visibleWidth, } from "@earendil-works/pi-tui";
3
3
  import { promptPathWordRanges } from "./path-word-ranges.js";
4
4
  export class OwnedEditorUxInterception {
5
5
  interceptors;
6
6
  fallback;
7
- constructor(interceptors, fallback) {
8
- this.interceptors = interceptors;
9
- this.fallback = fallback;
10
- }
7
+ constructor(interceptors, fallback) { this.interceptors = interceptors; this.fallback = fallback; }
11
8
  handleInput(data) {
12
9
  const invoke = (index, input) => {
13
10
  const interceptor = this.interceptors[index];
@@ -57,9 +54,6 @@ export function createPromptSelectionInterceptor(editor, keybindings, options) {
57
54
  return new PromptSelectionInterceptor(editor, keybindings, options);
58
55
  }
59
56
  class PromptSelectionInterceptor {
60
- editor;
61
- keybindings;
62
- options;
63
57
  #selection;
64
58
  #pointerSelecting = false;
65
59
  #lastClick;
@@ -69,6 +63,9 @@ class PromptSelectionInterceptor {
69
63
  #terminalPaste;
70
64
  #wordDirection;
71
65
  #geometry;
66
+ editor;
67
+ keybindings;
68
+ options;
72
69
  constructor(editor, keybindings, options) {
73
70
  this.editor = editor;
74
71
  this.keybindings = keybindings;