@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
@@ -1,3 +1,5 @@
1
- export * from "./contracts.js";
2
- export * from "./host.js";
3
- export * from "./registry.js";
1
+ export { assertAppRegistration } from "./contracts.js";
2
+ export type { AppHostServices, AppRegistration, AppSize, UiApp, UiRouteHost, UiRouteSurface } from "./contracts.js";
3
+ export { UiAppHost } from "./host.js";
4
+ export type { AppHostOptions, AppHostSurface } from "./host.js";
5
+ export { UiAppRegistry } from "./registry.js";
@@ -1,3 +1,3 @@
1
- export * from "./contracts.js";
2
- export * from "./host.js";
3
- export * from "./registry.js";
1
+ export { assertAppRegistration } from "./contracts.js";
2
+ export { UiAppHost } from "./host.js";
3
+ export { UiAppRegistry } from "./registry.js";
@@ -1,25 +1,47 @@
1
- export * from "./dialog-panel.js";
2
- export * from "./frame.js";
3
- export * from "./label.js";
4
- export * from "./line-input.js";
5
- export * from "./prompt-input.js";
6
- export * from "./list-block.js";
7
- export * from "./list-view.js";
8
- export * from "./mouse.js";
9
- export * from "./pane.js";
10
- export * from "./progress-status.js";
11
- export * from "./revision.js";
12
- export * from "./selection-copy.js";
13
- export * from "./scrollbar.js";
14
- export * from "./shortcuts.js";
15
- export * from "./spans.js";
16
- export * from "./visible-hyperlinks.js";
17
- export * from "./status-line.js";
18
- export * from "./submitted-prompt.js";
19
- export * from "./stepper.js";
20
- export * from "./transcript-viewport.js";
21
- export * from "./surface.js";
22
- export * from "./text.js";
23
- export * from "./text-selection.js";
24
- export * from "./theme.js";
25
- export * from "./value-menu.js";
1
+ export { dialogRowAt, dialogValueColumn, renderDialogPanel } from "./dialog-panel.js";
2
+ export type { DialogPanelFrame, DialogPanelState, DialogRow } from "./dialog-panel.js";
3
+ export { FrameContractError, assertPaneRect, finalizeFrame, validateFrame } from "./frame.js";
4
+ export type { PaneRect } from "./frame.js";
5
+ export { humanizeLabel, humanizeTitle } from "./label.js";
6
+ export { LineInput, caretCell, handleLineInputKey, renderInputRow, wordLeft, wordRight } from "./line-input.js";
7
+ export type { InputRow, InputRowOptions, LineInputOutcome, LineInputView } from "./line-input.js";
8
+ export { PROMPT_GLYPH, PROMPT_PREFIX_WIDTH, PromptInput, promptArrow, promptRule, promptRuleText } from "./prompt-input.js";
9
+ export type { PromptInputBody, PromptInputMetrics } from "./prompt-input.js";
10
+ export { blockJumpTarget, blockRowSpan, clampScroll, indexOfKey, layoutList, maxScrollFor, moveSelection, rowKey, scrollForSelection, selectableIndexes, stickyHeaderFor, topPaddingRows, visibleRowCount, } from "./list-block.js";
11
+ export type { ListLayout, ListRow, ListRowSpan } from "./list-block.js";
12
+ export { STEPPER_RESERVE, placementFor, regionAt, renderGroupHeader, renderListRow, renderNote, valueColumnFor } from "./list-view.js";
13
+ export type { ListRegion, ListRowPlacement, ListRowState, ListViewRow } from "./list-view.js";
14
+ export { MOUSE_TRACKING_OFF, MOUSE_TRACKING_ON, parseMouseInput, routeMouseInput } from "./mouse.js";
15
+ export type { ParsedMouseInput, RoutedMouseInput } from "./mouse.js";
16
+ export { isInsidePane, toPaneLocalMouse } from "./pane.js";
17
+ export type { Pane, PaneInputResult, PaneMouseEvent } from "./pane.js";
18
+ export { progressStatusText } from "./progress-status.js";
19
+ export { FrameCache, RENDER_REVISION_KINDS, RenderRevisionTracker, ZERO_REVISIONS, normalizeRevisions, revisionsEqual } from "./revision.js";
20
+ export type { RenderCacheContract, RenderRevisionKind, RenderRevisions } from "./revision.js";
21
+ export { MAX_COPY_ROWS, MAX_COPY_SOURCE_UNITS, selectionCopyLineContent, selectionCopyRowText } from "./selection-copy.js";
22
+ export type { SelectionCopyPrompt, SelectionCopyRow, SelectionCopySnapshot } from "./selection-copy.js";
23
+ export { ScrollbarRails, isThumbRow, scrollForThumbRow, scrollForTrackPage, scrollbarGeometry, scrollbarPresentation, scrollbarReservesSpace, scrollbarSelectionRows, scrollbarWheelRows, } from "./scrollbar.js";
24
+ export type { RailPointer, RailPosition, ScrollbarAppearance, ScrollbarGeometry, ScrollbarInput, ScrollbarPresentation, ScrollbarPresentationInput, ScrollbarSpeed, ScrollbarStyle, } from "./scrollbar.js";
25
+ export { GLOBAL_SCOPE, ShortcutRegistry, assembleShortcuts, assertNoShortcutConflicts } from "./shortcuts.js";
26
+ export type { ShortcutConflict, ShortcutDeclaration, ShortcutRegistryResult } from "./shortcuts.js";
27
+ export { backgroundSgrSpan, heldNativeHyperlinkStyle, hyperlinkSgrSpan, hyperlinkTargetAtColumn, nativeHyperlinkStyle, overlaySpan } from "./spans.js";
28
+ export { readVisibleHyperlinks } from "./visible-hyperlinks.js";
29
+ export type { VisibleHyperlinkRange, VisibleHyperlinkRow } from "./visible-hyperlinks.js";
30
+ export { renderStatusLine, statusText } from "./status-line.js";
31
+ export type { StatusLineInput } from "./status-line.js";
32
+ export { SUBMITTED_PROMPT_PREFIX_WIDTH, composeSubmittedPromptRows, formatSubmittedPromptTime, submittedPromptLayout } from "./submitted-prompt.js";
33
+ export type { SubmittedPromptLayout, SubmittedPromptStyle } from "./submitted-prompt.js";
34
+ export { numericValues, steppedValue, stepperEnds } from "./stepper.js";
35
+ export type { NumericRange } from "./stepper.js";
36
+ export { TranscriptViewport, assertTranscriptViewportFrameDescriptor } from "./transcript-viewport.js";
37
+ export type { TranscriptPromptAnchor, TranscriptViewportConfig, TranscriptViewportFrame, TranscriptViewportFrameDescriptor, TranscriptViewportFrameInput, TranscriptViewportHitRegions, TranscriptViewportTheme, } from "./transcript-viewport.js";
38
+ export { RAIL_COLUMNS, renderEmptyState, withScrollbarRail } from "./surface.js";
39
+ export type { RailOptions } from "./surface.js";
40
+ export { displayColumnSlice, displayWidth, displayWordColumnRange, faint, padToWidth, stripAnsi, truncateToWidth } from "./text.js";
41
+ export type { DisplayColumnRange, DisplayColumnSlice } from "./text.js";
42
+ export { TEXT_SELECTION_MULTI_CLICK_MS, extendTextSelection, orderedTextSelection, plainTextBetweenColumns, pressTextSelection, releaseTextSelection, textSelectionLineExtendColumn, textSelectionPointAt, textSelectionText, usefulTextLineContent, } from "./text-selection.js";
43
+ export type { OrderedTextSelection, TextSelection, TextSelectionClick, TextSelectionLineContent, TextSelectionPoint, TextSelectionPressInput, } from "./text-selection.js";
44
+ export { PLAIN_THEME } from "./theme.js";
45
+ export type { UiTheme, UiThemeToken } from "./theme.js";
46
+ export { menuRowAt, renderValueMenu, valueMenuFrame } from "./value-menu.js";
47
+ export type { ValueMenuAnchor, ValueMenuFrame, ValueMenuLayout, ValueMenuState } from "./value-menu.js";
@@ -1,25 +1,25 @@
1
- export * from "./dialog-panel.js";
2
- export * from "./frame.js";
3
- export * from "./label.js";
4
- export * from "./line-input.js";
5
- export * from "./prompt-input.js";
6
- export * from "./list-block.js";
7
- export * from "./list-view.js";
8
- export * from "./mouse.js";
9
- export * from "./pane.js";
10
- export * from "./progress-status.js";
11
- export * from "./revision.js";
12
- export * from "./selection-copy.js";
13
- export * from "./scrollbar.js";
14
- export * from "./shortcuts.js";
15
- export * from "./spans.js";
16
- export * from "./visible-hyperlinks.js";
17
- export * from "./status-line.js";
18
- export * from "./submitted-prompt.js";
19
- export * from "./stepper.js";
20
- export * from "./transcript-viewport.js";
21
- export * from "./surface.js";
22
- export * from "./text.js";
23
- export * from "./text-selection.js";
24
- export * from "./theme.js";
25
- export * from "./value-menu.js";
1
+ export { dialogRowAt, dialogValueColumn, renderDialogPanel } from "./dialog-panel.js";
2
+ export { FrameContractError, assertPaneRect, finalizeFrame, validateFrame } from "./frame.js";
3
+ export { humanizeLabel, humanizeTitle } from "./label.js";
4
+ export { LineInput, caretCell, handleLineInputKey, renderInputRow, wordLeft, wordRight } from "./line-input.js";
5
+ export { PROMPT_GLYPH, PROMPT_PREFIX_WIDTH, PromptInput, promptArrow, promptRule, promptRuleText } from "./prompt-input.js";
6
+ export { blockJumpTarget, blockRowSpan, clampScroll, indexOfKey, layoutList, maxScrollFor, moveSelection, rowKey, scrollForSelection, selectableIndexes, stickyHeaderFor, topPaddingRows, visibleRowCount, } from "./list-block.js";
7
+ export { STEPPER_RESERVE, placementFor, regionAt, renderGroupHeader, renderListRow, renderNote, valueColumnFor } from "./list-view.js";
8
+ export { MOUSE_TRACKING_OFF, MOUSE_TRACKING_ON, parseMouseInput, routeMouseInput } from "./mouse.js";
9
+ export { isInsidePane, toPaneLocalMouse } from "./pane.js";
10
+ export { progressStatusText } from "./progress-status.js";
11
+ export { FrameCache, RENDER_REVISION_KINDS, RenderRevisionTracker, ZERO_REVISIONS, normalizeRevisions, revisionsEqual } from "./revision.js";
12
+ export { MAX_COPY_ROWS, MAX_COPY_SOURCE_UNITS, selectionCopyLineContent, selectionCopyRowText } from "./selection-copy.js";
13
+ export { ScrollbarRails, isThumbRow, scrollForThumbRow, scrollForTrackPage, scrollbarGeometry, scrollbarPresentation, scrollbarReservesSpace, scrollbarSelectionRows, scrollbarWheelRows, } from "./scrollbar.js";
14
+ export { GLOBAL_SCOPE, ShortcutRegistry, assembleShortcuts, assertNoShortcutConflicts } from "./shortcuts.js";
15
+ export { backgroundSgrSpan, heldNativeHyperlinkStyle, hyperlinkSgrSpan, hyperlinkTargetAtColumn, nativeHyperlinkStyle, overlaySpan } from "./spans.js";
16
+ export { readVisibleHyperlinks } from "./visible-hyperlinks.js";
17
+ export { renderStatusLine, statusText } from "./status-line.js";
18
+ export { SUBMITTED_PROMPT_PREFIX_WIDTH, composeSubmittedPromptRows, formatSubmittedPromptTime, submittedPromptLayout } from "./submitted-prompt.js";
19
+ export { numericValues, steppedValue, stepperEnds } from "./stepper.js";
20
+ export { TranscriptViewport, assertTranscriptViewportFrameDescriptor } from "./transcript-viewport.js";
21
+ export { RAIL_COLUMNS, renderEmptyState, withScrollbarRail } from "./surface.js";
22
+ export { displayColumnSlice, displayWidth, displayWordColumnRange, faint, padToWidth, stripAnsi, truncateToWidth } from "./text.js";
23
+ export { TEXT_SELECTION_MULTI_CLICK_MS, extendTextSelection, orderedTextSelection, plainTextBetweenColumns, pressTextSelection, releaseTextSelection, textSelectionLineExtendColumn, textSelectionPointAt, textSelectionText, usefulTextLineContent, } from "./text-selection.js";
24
+ export { PLAIN_THEME } from "./theme.js";
25
+ export { menuRowAt, renderValueMenu, valueMenuFrame } from "./value-menu.js";
@@ -15,10 +15,7 @@ export function promptArrow(text, theme) {
15
15
  export class PromptInput {
16
16
  theme;
17
17
  metrics;
18
- constructor(theme = PLAIN_THEME, metrics = { measure: displayWidth, truncate: truncateToWidth }) {
19
- this.theme = theme;
20
- this.metrics = metrics;
21
- }
18
+ constructor(theme = PLAIN_THEME, metrics = { measure: displayWidth, truncate: truncateToWidth }) { this.theme = theme; this.metrics = metrics; }
22
19
  styleRule(text) { return promptRuleText(text); }
23
20
  geometry(width, padding = 0) {
24
21
  const prefixWidth = Math.min(PROMPT_PREFIX_WIDTH, Math.max(0, width));
@@ -17,6 +17,125 @@ export interface OwnedUiSettingDeclaration {
17
17
  }
18
18
  /** Playback lengths the quit outro offers, in milliseconds. */
19
19
  export declare const QUIT_EFFECT_DURATIONS_MS: readonly number[];
20
+ /**
21
+ * Every A1 setting, keyed by its id. The table is the one declaration: ids, defaults, and allowed
22
+ * values are read from it, and `OwnedSettingValueOf` derives each getter's type from it.
23
+ */
24
+ export declare const OWNED_SETTING_DECLARATIONS: Readonly<{
25
+ readonly quitAnimation: Readonly<{
26
+ id: "quitAnimation";
27
+ label: "Exit animation";
28
+ section: Readonly<{
29
+ id: "generic";
30
+ title: "Generic";
31
+ }>;
32
+ description: "Play the quit effect when the session quits. Off returns to the terminal immediately.";
33
+ application: "live";
34
+ defaultValue: true;
35
+ allowedValues: readonly [true, false];
36
+ }>;
37
+ readonly scrollbarAppearance: Readonly<{
38
+ id: "scrollbarAppearance";
39
+ label: "Scrollbar mode";
40
+ section: Readonly<{
41
+ id: "scroll";
42
+ title: "Scroll";
43
+ }>;
44
+ description: "When the session transcript scrollbar is visible.";
45
+ application: "live";
46
+ defaultValue: "auto";
47
+ allowedValues: readonly ["auto", "always", "hidden"];
48
+ }>;
49
+ readonly scrollbarStyle: Readonly<{
50
+ id: "scrollbarStyle";
51
+ label: "Scrollbar style";
52
+ section: Readonly<{
53
+ id: "scroll";
54
+ title: "Scroll";
55
+ }>;
56
+ description: "Visual weight of the session transcript scrollbar.";
57
+ application: "live";
58
+ defaultValue: "thin";
59
+ allowedValues: readonly ["thin", "thick"];
60
+ }>;
61
+ readonly scrollbarSpeed: Readonly<{
62
+ id: "scrollbarSpeed";
63
+ label: "Speed";
64
+ section: Readonly<{
65
+ id: "scroll";
66
+ title: "Scroll";
67
+ }>;
68
+ description: "Distance moved by each session transcript wheel event.";
69
+ application: "live";
70
+ defaultValue: "normal";
71
+ allowedValues: readonly ["normal", "fast", "high"];
72
+ }>;
73
+ readonly promptHistoryEnabled: Readonly<{
74
+ id: "promptHistoryEnabled";
75
+ label: "Persistent history";
76
+ section: Readonly<{
77
+ id: "history";
78
+ title: "History";
79
+ }>;
80
+ description: "Retain reusable prompts across sessions. Applies on next start; disabling does not erase saved history or stop existing instances.";
81
+ application: "restart";
82
+ defaultValue: true;
83
+ allowedValues: readonly [true, false];
84
+ }>;
85
+ readonly promptHistoryMaxItems: Readonly<{
86
+ id: "promptHistoryMaxItems";
87
+ label: "History limit";
88
+ section: Readonly<{
89
+ id: "history";
90
+ title: "History";
91
+ }>;
92
+ description: "Maximum recent unique prompts after next start. Byte limits also apply; increasing the limit cannot restore pruned entries.";
93
+ application: "restart";
94
+ defaultValue: 100;
95
+ allowedValues: readonly [10, 20, 30, 40, 50, 60, 70, 80, 90, 100];
96
+ }>;
97
+ readonly quitEffect: Readonly<{
98
+ id: "quitEffect";
99
+ label: "Effect";
100
+ section: Readonly<{
101
+ id: "quit";
102
+ title: "Quit";
103
+ }>;
104
+ description: "Animation played over the last screen when the session quits.";
105
+ application: "live";
106
+ defaultValue: "fall";
107
+ allowedValues: readonly ["fall", "dissolve", "starburst", "waves"];
108
+ }>;
109
+ readonly quitEffectDurationMs: Readonly<{
110
+ id: "quitEffectDurationMs";
111
+ label: "Duration";
112
+ section: Readonly<{
113
+ id: "quit";
114
+ title: "Quit";
115
+ }>;
116
+ description: "Milliseconds the quit animation plays before the terminal is restored.";
117
+ application: "live";
118
+ defaultValue: 800;
119
+ allowedValues: readonly number[];
120
+ }>;
121
+ readonly promptSuggestions: Readonly<{
122
+ id: "promptSuggestions";
123
+ label: "Prompt suggestions";
124
+ section: Readonly<{
125
+ id: "agent";
126
+ title: "Agent";
127
+ }>;
128
+ description: "Predict likely next prompts with one additional background request using the selected model.";
129
+ application: "live";
130
+ defaultValue: true;
131
+ allowedValues: readonly [true, false];
132
+ }>;
133
+ }>;
134
+ export type OwnedSettingId = keyof typeof OWNED_SETTING_DECLARATIONS;
135
+ /** The value type a setting's declaration allows: a literal union for a choice, `number` for a stepped range. */
136
+ export type OwnedSettingValueOf<Id extends OwnedSettingId> = (typeof OWNED_SETTING_DECLARATIONS)[Id]["allowedValues"][number];
137
+ /** The declarations in declaration order, for resolution, persistence, and the settings screen. */
20
138
  export declare const OWNED_UI_SETTING_DECLARATIONS: readonly OwnedUiSettingDeclaration[];
139
+ export declare function isOwnedSettingId(id: string): id is OwnedSettingId;
21
140
  export declare function assertOwnedUiSettingDeclarations(declarations: readonly OwnedUiSettingDeclaration[]): void;
22
141
  export declare function findOwnedUiSettingDeclaration(declarations: readonly OwnedUiSettingDeclaration[], id: string): OwnedUiSettingDeclaration | null;
@@ -7,8 +7,12 @@ const SCROLL_SECTION = Object.freeze({ id: "scroll", title: "Scroll" });
7
7
  const QUIT_SECTION = Object.freeze({ id: "quit", title: "Quit" });
8
8
  /** Playback lengths the quit outro offers, in milliseconds. */
9
9
  export const QUIT_EFFECT_DURATIONS_MS = Object.freeze(Array.from({ length: 18 }, (_, index) => 300 + index * 100));
10
- export const OWNED_UI_SETTING_DECLARATIONS = Object.freeze([
11
- Object.freeze({
10
+ /**
11
+ * Every A1 setting, keyed by its id. The table is the one declaration: ids, defaults, and allowed
12
+ * values are read from it, and `OwnedSettingValueOf` derives each getter's type from it.
13
+ */
14
+ export const OWNED_SETTING_DECLARATIONS = Object.freeze({
15
+ quitAnimation: Object.freeze({
12
16
  id: "quitAnimation",
13
17
  label: "Exit animation",
14
18
  section: GENERIC_SECTION,
@@ -17,7 +21,7 @@ export const OWNED_UI_SETTING_DECLARATIONS = Object.freeze([
17
21
  defaultValue: true,
18
22
  allowedValues: Object.freeze([true, false]),
19
23
  }),
20
- Object.freeze({
24
+ scrollbarAppearance: Object.freeze({
21
25
  id: "scrollbarAppearance",
22
26
  label: "Scrollbar mode",
23
27
  section: SCROLL_SECTION,
@@ -26,7 +30,7 @@ export const OWNED_UI_SETTING_DECLARATIONS = Object.freeze([
26
30
  defaultValue: "auto",
27
31
  allowedValues: Object.freeze(["auto", "always", "hidden"]),
28
32
  }),
29
- Object.freeze({
33
+ scrollbarStyle: Object.freeze({
30
34
  id: "scrollbarStyle",
31
35
  label: "Scrollbar style",
32
36
  section: SCROLL_SECTION,
@@ -35,7 +39,7 @@ export const OWNED_UI_SETTING_DECLARATIONS = Object.freeze([
35
39
  defaultValue: "thin",
36
40
  allowedValues: Object.freeze(["thin", "thick"]),
37
41
  }),
38
- Object.freeze({
42
+ scrollbarSpeed: Object.freeze({
39
43
  id: "scrollbarSpeed",
40
44
  label: "Speed",
41
45
  section: SCROLL_SECTION,
@@ -44,7 +48,7 @@ export const OWNED_UI_SETTING_DECLARATIONS = Object.freeze([
44
48
  defaultValue: "normal",
45
49
  allowedValues: Object.freeze(["normal", "fast", "high"]),
46
50
  }),
47
- Object.freeze({
51
+ promptHistoryEnabled: Object.freeze({
48
52
  id: "promptHistoryEnabled",
49
53
  label: "Persistent history",
50
54
  section: Object.freeze({ id: "history", title: "History" }),
@@ -53,7 +57,7 @@ export const OWNED_UI_SETTING_DECLARATIONS = Object.freeze([
53
57
  defaultValue: true,
54
58
  allowedValues: Object.freeze([true, false]),
55
59
  }),
56
- Object.freeze({
60
+ promptHistoryMaxItems: Object.freeze({
57
61
  id: "promptHistoryMaxItems",
58
62
  label: "History limit",
59
63
  section: Object.freeze({ id: "history", title: "History" }),
@@ -62,7 +66,7 @@ export const OWNED_UI_SETTING_DECLARATIONS = Object.freeze([
62
66
  defaultValue: 100,
63
67
  allowedValues: Object.freeze([10, 20, 30, 40, 50, 60, 70, 80, 90, 100]),
64
68
  }),
65
- Object.freeze({
69
+ quitEffect: Object.freeze({
66
70
  id: "quitEffect",
67
71
  label: "Effect",
68
72
  section: QUIT_SECTION,
@@ -71,7 +75,7 @@ export const OWNED_UI_SETTING_DECLARATIONS = Object.freeze([
71
75
  defaultValue: "fall",
72
76
  allowedValues: Object.freeze(["fall", "dissolve", "starburst", "waves"]),
73
77
  }),
74
- Object.freeze({
78
+ quitEffectDurationMs: Object.freeze({
75
79
  id: "quitEffectDurationMs",
76
80
  label: "Duration",
77
81
  section: QUIT_SECTION,
@@ -80,7 +84,7 @@ export const OWNED_UI_SETTING_DECLARATIONS = Object.freeze([
80
84
  defaultValue: 800,
81
85
  allowedValues: QUIT_EFFECT_DURATIONS_MS,
82
86
  }),
83
- Object.freeze({
87
+ promptSuggestions: Object.freeze({
84
88
  id: "promptSuggestions",
85
89
  label: "Prompt suggestions",
86
90
  section: Object.freeze({ id: "agent", title: "Agent" }),
@@ -89,7 +93,12 @@ export const OWNED_UI_SETTING_DECLARATIONS = Object.freeze([
89
93
  defaultValue: true,
90
94
  allowedValues: Object.freeze([true, false]),
91
95
  }),
92
- ]);
96
+ });
97
+ /** The declarations in declaration order, for resolution, persistence, and the settings screen. */
98
+ export const OWNED_UI_SETTING_DECLARATIONS = Object.freeze(Object.values(OWNED_SETTING_DECLARATIONS));
99
+ export function isOwnedSettingId(id) {
100
+ return Object.hasOwn(OWNED_SETTING_DECLARATIONS, id);
101
+ }
93
102
  export function assertOwnedUiSettingDeclarations(declarations) {
94
103
  const seen = new Set();
95
104
  for (const declaration of declarations) {
@@ -1,6 +1,10 @@
1
- export * from "./declarations.js";
2
- export * from "./migrations.js";
3
- export * from "./resolution.js";
4
- export * from "./sections.js";
5
- export * from "./session.js";
6
- export * from "./store.js";
1
+ export { OWNED_SETTING_DECLARATIONS, OWNED_UI_SETTINGS_VERSION, OWNED_UI_SETTING_DECLARATIONS, QUIT_EFFECT_DURATIONS_MS, assertOwnedUiSettingDeclarations, findOwnedUiSettingDeclaration, isOwnedSettingId, } from "./declarations.js";
2
+ export type { OwnedSettingId, OwnedSettingValueOf, OwnedUiSettingApplication, OwnedUiSettingDeclaration, OwnedUiSettingValue } from "./declarations.js";
3
+ export { OWNED_UI_SETTINGS_MIGRATIONS, assertOwnedUiSettingsMigrations, migrationsFrom } from "./migrations.js";
4
+ export type { OwnedUiSettingsMigration } from "./migrations.js";
5
+ export { documentFrom, parseOwnedUiSettingsDocument, resolveOwnedUiSettings, settingValue } from "./resolution.js";
6
+ export type { OwnedUiResolvedSetting, OwnedUiSettingSource, OwnedUiSettingsDocument, OwnedUiSettingsNotice, OwnedUiSettingsNoticeCode, OwnedUiSettingsResolution, ResolveOwnedUiSettingsInput, } from "./resolution.js";
7
+ export { AGENT_SECTION_ID, buildOwnedUiSettingsSections, findOwnedUiSettingsEntry } from "./sections.js";
8
+ export type { AgentSettingsSnapshot, BuildOwnedUiSettingsSectionsInput, OwnedUiSettingsBackend, OwnedUiSettingsEntry, OwnedUiSettingsSection, } from "./sections.js";
9
+ export { OwnedSettingsManager } from "./manager.js";
10
+ export type { OwnedSettingsManagerOptions, OwnedUiSettingsChangeOutcome, OwnedUiSettingsListener } from "./manager.js";
@@ -1,6 +1,5 @@
1
- export * from "./declarations.js";
2
- export * from "./migrations.js";
3
- export * from "./resolution.js";
4
- export * from "./sections.js";
5
- export * from "./session.js";
6
- export * from "./store.js";
1
+ export { OWNED_SETTING_DECLARATIONS, OWNED_UI_SETTINGS_VERSION, OWNED_UI_SETTING_DECLARATIONS, QUIT_EFFECT_DURATIONS_MS, assertOwnedUiSettingDeclarations, findOwnedUiSettingDeclaration, isOwnedSettingId, } from "./declarations.js";
2
+ export { OWNED_UI_SETTINGS_MIGRATIONS, assertOwnedUiSettingsMigrations, migrationsFrom } from "./migrations.js";
3
+ export { documentFrom, parseOwnedUiSettingsDocument, resolveOwnedUiSettings, settingValue } from "./resolution.js";
4
+ export { AGENT_SECTION_ID, buildOwnedUiSettingsSections, findOwnedUiSettingsEntry } from "./sections.js";
5
+ export { OwnedSettingsManager } from "./manager.js";
@@ -0,0 +1,54 @@
1
+ import type { AgentJsonValue, AgentSettingApplicationBoundary, AgentSettingsPort } from "../../contracts/agent-engine/index.js";
2
+ import { type OwnedSettingId, type OwnedSettingValueOf, type OwnedUiSettingDeclaration, type OwnedUiSettingValue } from "./declarations.js";
3
+ import { type OwnedUiSettingsMigration } from "./migrations.js";
4
+ import { type OwnedUiSettingsResolution } from "./resolution.js";
5
+ import { type OwnedUiSettingsBackend, type OwnedUiSettingsSection } from "./sections.js";
6
+ export interface OwnedSettingsManagerOptions {
7
+ /** A1 configuration root. Settings live under `<configDir>/settings/`. */
8
+ readonly configDir: string;
9
+ readonly profileId: string;
10
+ readonly declarations?: readonly OwnedUiSettingDeclaration[];
11
+ readonly migrations?: readonly OwnedUiSettingsMigration[];
12
+ readonly agent?: AgentSettingsPort | null;
13
+ readonly agentProvider?: () => AgentSettingsPort | null;
14
+ readonly hiddenAgentSettingIds?: readonly string[];
15
+ }
16
+ export interface OwnedUiSettingsChangeOutcome {
17
+ readonly status: "applied" | "deferred" | "unavailable" | "failed";
18
+ readonly applied: boolean;
19
+ /** Compatibility projection for existing A1 restart-bound declarations. */
20
+ readonly pendingRestart: boolean;
21
+ readonly application: AgentSettingApplicationBoundary | null;
22
+ readonly storedValue: AgentJsonValue | null;
23
+ readonly effectiveValue: AgentJsonValue | null;
24
+ readonly limitationReason: string | null;
25
+ readonly failure: string | null;
26
+ }
27
+ export type OwnedUiSettingsListener = (manager: OwnedSettingsManager) => void;
28
+ /**
29
+ * One profile's A1 settings: resolves the declaration table against the stored document,
30
+ * persists each accepted change atomically without discarding unknown keys, offers the
31
+ * grouped sections a surface presents, and routes every accepted change only to its
32
+ * owning backend, with agent settings reached through the engine settings port.
33
+ */
34
+ export declare class OwnedSettingsManager {
35
+ #private;
36
+ constructor(options: OwnedSettingsManagerOptions);
37
+ get file(): string;
38
+ get resolution(): OwnedUiSettingsResolution;
39
+ /** Reads and resolves the stored document. Never throws: every failure becomes a notice. */
40
+ read(): OwnedUiSettingsResolution;
41
+ load(): Promise<void>;
42
+ sections(): readonly OwnedUiSettingsSection[];
43
+ /**
44
+ * The value in effect for a declared setting, typed by its declaration. A restart-bound
45
+ * setting reads as the value the session started with until the next start.
46
+ */
47
+ value<Id extends OwnedSettingId>(id: Id): OwnedSettingValueOf<Id>;
48
+ /** The value in effect for any setting id, or null when nothing declares it. */
49
+ valueOf(id: string): OwnedUiSettingValue | null;
50
+ pendingValue(id: string): OwnedUiSettingValue | null;
51
+ onChange(listener: OwnedUiSettingsListener): () => void;
52
+ changeStructured(backend: OwnedUiSettingsBackend, id: string, value: Readonly<Record<string, unknown>>): Promise<OwnedUiSettingsChangeOutcome>;
53
+ change(backend: OwnedUiSettingsBackend, id: string, value: OwnedUiSettingValue): Promise<OwnedUiSettingsChangeOutcome>;
54
+ }
@@ -1,8 +1,22 @@
1
+ import { mkdirSync, readFileSync, renameSync, rmSync, writeFileSync } from "node:fs";
2
+ import path from "node:path";
1
3
  import { assertAgentSettingDescriptor } from "../../contracts/agent-engine/index.js";
4
+ import { OWNED_SETTING_DECLARATIONS, OWNED_UI_SETTINGS_VERSION, OWNED_UI_SETTING_DECLARATIONS, } from "./declarations.js";
5
+ import { OWNED_UI_SETTINGS_MIGRATIONS } from "./migrations.js";
6
+ import { documentFrom, parseOwnedUiSettingsDocument, resolveOwnedUiSettings, } from "./resolution.js";
2
7
  import { buildOwnedUiSettingsSections, findOwnedUiSettingsEntry, } from "./sections.js";
3
- /** Routes every accepted setting change only to its owning backend. */
4
- export class OwnedUiSettingsSession {
5
- #store;
8
+ const PROFILE_ID_PATTERN = /^[a-z][a-z0-9-]{0,63}$/;
9
+ const MAX_DOCUMENT_BYTES = 256 * 1024;
10
+ /**
11
+ * One profile's A1 settings: resolves the declaration table against the stored document,
12
+ * persists each accepted change atomically without discarding unknown keys, offers the
13
+ * grouped sections a surface presents, and routes every accepted change only to its
14
+ * owning backend, with agent settings reached through the engine settings port.
15
+ */
16
+ export class OwnedSettingsManager {
17
+ #file;
18
+ #declarations;
19
+ #migrations;
6
20
  #agent;
7
21
  #agentProvider;
8
22
  #listeners = new Set();
@@ -12,21 +26,56 @@ export class OwnedUiSettingsSession {
12
26
  #pending = new Map();
13
27
  #restartEffective = new Map();
14
28
  constructor(options) {
15
- this.#store = options.store;
29
+ if (!PROFILE_ID_PATTERN.test(options.profileId)) {
30
+ throw new Error(`owned UI settings profile id is not a bounded slug: ${options.profileId}`);
31
+ }
32
+ this.#file = path.join(path.resolve(options.configDir), "settings", `${options.profileId}.json`);
33
+ this.#declarations = options.declarations ?? OWNED_UI_SETTING_DECLARATIONS;
34
+ this.#migrations = options.migrations ?? OWNED_UI_SETTINGS_MIGRATIONS;
16
35
  this.#agent = options.agent ?? null;
17
36
  this.#agentProvider = options.agentProvider ?? null;
18
37
  this.#hiddenAgentSettingIds = new Set(options.hiddenAgentSettingIds ?? []);
19
- this.#resolution = options.store.read();
38
+ this.#resolution = this.read();
20
39
  for (const setting of this.#resolution.settings) {
21
40
  if (setting.declaration.application === "restart")
22
41
  this.#restartEffective.set(setting.declaration.id, setting.value);
23
42
  }
24
43
  }
44
+ get file() {
45
+ return this.#file;
46
+ }
25
47
  get resolution() {
26
48
  return this.#resolution;
27
49
  }
50
+ /** Reads and resolves the stored document. Never throws: every failure becomes a notice. */
51
+ read() {
52
+ let raw = null;
53
+ let unreadable = null;
54
+ try {
55
+ raw = readFileSync(this.#file, "utf8");
56
+ }
57
+ catch (error) {
58
+ if (!isMissing(error))
59
+ unreadable = `${this.#file} could not be read: ${describe(error)}`;
60
+ }
61
+ if (raw !== null && Buffer.byteLength(raw, "utf8") > MAX_DOCUMENT_BYTES) {
62
+ unreadable = `${this.#file} exceeds the ${MAX_DOCUMENT_BYTES}-byte settings limit and was ignored`;
63
+ raw = null;
64
+ }
65
+ const document = raw === null ? null : parseOwnedUiSettingsDocument(raw);
66
+ if (raw !== null && document === null && unreadable === null) {
67
+ unreadable = `${this.#file} is not a valid settings document and was ignored`;
68
+ }
69
+ return resolveOwnedUiSettings({
70
+ declarations: this.#declarations,
71
+ migrations: this.#migrations,
72
+ document,
73
+ ...(unreadable === null ? {} : { unreadableDetail: unreadable }),
74
+ currentVersion: OWNED_UI_SETTINGS_VERSION,
75
+ });
76
+ }
28
77
  async load() {
29
- this.#resolution = this.#store.read();
78
+ this.#resolution = this.read();
30
79
  const agent = this.#currentAgent();
31
80
  this.#agentSnapshot = agent === null ? null : await snapshotOf(agent, this.#hiddenAgentSettingIds);
32
81
  this.#notify();
@@ -39,7 +88,15 @@ export class OwnedUiSettingsSession {
39
88
  : entry),
40
89
  }));
41
90
  }
91
+ /**
92
+ * The value in effect for a declared setting, typed by its declaration. A restart-bound
93
+ * setting reads as the value the session started with until the next start.
94
+ */
42
95
  value(id) {
96
+ return (this.valueOf(id) ?? OWNED_SETTING_DECLARATIONS[id].defaultValue);
97
+ }
98
+ /** The value in effect for any setting id, or null when nothing declares it. */
99
+ valueOf(id) {
43
100
  return this.#restartEffective.get(id) ?? this.#resolution.settings.find(setting => setting.declaration.id === id)?.value ?? null;
44
101
  }
45
102
  pendingValue(id) {
@@ -63,11 +120,11 @@ export class OwnedUiSettingsSession {
63
120
  return backend === "a1" ? this.#changeOwned(id, value) : await this.#changeAgentValue(id, value);
64
121
  }
65
122
  #changeOwned(id, value) {
66
- const outcome = this.#store.write(this.#resolution, id, value);
123
+ const outcome = this.#write(this.#resolution, id, value);
67
124
  if (!outcome.stored)
68
125
  return failed(outcome.failure ?? `${id} could not be stored`);
69
126
  const previous = this.#resolution;
70
- this.#resolution = this.#store.read();
127
+ this.#resolution = this.read();
71
128
  const previousSetting = previous.settings.find(setting => setting.declaration.id === id);
72
129
  if (previousSetting?.declaration.application === "restart") {
73
130
  this.#pending.set(id, value);
@@ -78,6 +135,38 @@ export class OwnedUiSettingsSession {
78
135
  this.#notify();
79
136
  return changed("applied", "live", value, value);
80
137
  }
138
+ // Invariant: the resolved form is written with `id` set to `value` and undeclared keys preserved.
139
+ // Concurrency: a temporary sibling is renamed over the target, so an interrupted write leaves
140
+ // either the complete previous document or the complete new one.
141
+ #write(resolution, id, value) {
142
+ const declaration = this.#declarations.find(candidate => candidate.id === id);
143
+ if (!declaration)
144
+ return { stored: false, failure: `unknown owned UI setting: ${id}` };
145
+ if (!declaration.allowedValues.includes(value)) {
146
+ return { stored: false, failure: `value ${JSON.stringify(value)} is not allowed for ${id}` };
147
+ }
148
+ const current = documentFrom(resolution);
149
+ const next = {
150
+ version: OWNED_UI_SETTINGS_VERSION,
151
+ values: { ...current.values, [id]: value },
152
+ };
153
+ const temporary = `${this.#file}.${process.pid}.tmp`;
154
+ try {
155
+ mkdirSync(path.dirname(this.#file), { recursive: true, mode: 0o700 });
156
+ writeFileSync(temporary, `${JSON.stringify(next, null, 2)}\n`, { encoding: "utf8", mode: 0o600 });
157
+ renameSync(temporary, this.#file);
158
+ return { stored: true, failure: null };
159
+ }
160
+ catch (error) {
161
+ try {
162
+ rmSync(temporary, { force: true });
163
+ }
164
+ catch {
165
+ // Security: a leftover temporary file is inert: read() only ever opens the target path.
166
+ }
167
+ return { stored: false, failure: `${this.#file} could not be written: ${describe(error)}` };
168
+ }
169
+ }
81
170
  async #changeAgentValue(id, value) {
82
171
  const agent = this.#currentAgent();
83
172
  if (agent === null)
@@ -87,7 +176,7 @@ export class OwnedUiSettingsSession {
87
176
  }
88
177
  let result;
89
178
  try {
90
- // Invariant: the coordinator behind the port owns effect installation, persistence,
179
+ // Invariant: the bridge behind the port owns effect installation, persistence,
91
180
  // flush, and rollback. A second surface-level flush would split authority.
92
181
  result = await agent.writeSetting(id, value);
93
182
  }
@@ -159,6 +248,9 @@ function fromAgentOutcome(result) {
159
248
  failure: result.failure,
160
249
  };
161
250
  }
251
+ function isMissing(error) {
252
+ return typeof error === "object" && error !== null && error.code === "ENOENT";
253
+ }
162
254
  function describe(error) {
163
255
  return error instanceof Error ? error.message : String(error);
164
256
  }