@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,105 +0,0 @@
1
- // Mechanically adapted from Pi commit 914cf14
2
- // packages/coding-agent/src/modes/interactive/components/first-time-setup.ts (MIT).
3
- // Local modifications: remap private imports to public package-root or owned theme boundaries.
4
- import { Container, getKeybindings, Spacer, Text } from "#pi-tui";
5
- import { DynamicBorder, keyHint, rawKeyHint } from "../../../startup-public.js";
6
- import { piTheme } from "../theme/theme.js";
7
- const APP_NAME = "pi";
8
- const THEME_OPTIONS = [
9
- { value: "dark", label: "Dark" },
10
- { value: "light", label: "Light" },
11
- ];
12
- const ANALYTICS_OPTIONS = [
13
- { value: true, label: "Share anonymous usage data" },
14
- { value: false, label: "Don't share" },
15
- ];
16
- const SETUP_LOGO_LINES = ["██████", "██ ██", "████ ██", "██ ██"];
17
- /** First-time setup dialog: theme choice and analytics opt-in. */
18
- export class FirstTimeSetupComponent extends Container {
19
- step = "theme";
20
- themeIndex;
21
- analyticsIndex = 0;
22
- options;
23
- constructor(options) {
24
- super();
25
- this.options = options;
26
- this.themeIndex = Math.max(0, THEME_OPTIONS.findIndex((option) => option.value === options.detectedTheme));
27
- this.update();
28
- }
29
- // Rebuild the whole dialog on every change so theme previews recolor all text.
30
- update() {
31
- this.clear();
32
- this.addChild(new DynamicBorder());
33
- this.addChild(new Spacer(1));
34
- this.addChild(new Text(piTheme().fg("accent", SETUP_LOGO_LINES.join("\n")), 1, 0));
35
- this.addChild(new Spacer(1));
36
- this.addChild(new Text(piTheme().fg("accent", piTheme().bold(`Welcome to ${APP_NAME}, the minimal coding agent.`)), 1, 0));
37
- this.addChild(new Spacer(1));
38
- if (this.step === "theme") {
39
- this.addChild(new Text(piTheme().fg("text", "Pick a theme."), 1, 0));
40
- this.addChild(new Text(piTheme().fg("muted", `Detected system appearance: ${this.options.detectedTheme}`), 1, 0));
41
- this.addChild(new Spacer(1));
42
- this.addOptionList(THEME_OPTIONS.map((option) => option.label), this.themeIndex);
43
- }
44
- else {
45
- this.addChild(new Text(piTheme().fg("text", "Opt-in to anonymous usage data sharing?"), 1, 0));
46
- this.addChild(new Text(piTheme().fg("muted", "Opting in stores a tracking identifier in settings.json and enables anonymous\nusage analytics. This helps us to better debug, reproduce, and resolve issues\nand bugs within Pi. You can observe what is shared using /privacy and make\nchanges anytime in settings.json."), 1, 0));
47
- this.addChild(new Spacer(1));
48
- this.addOptionList(ANALYTICS_OPTIONS.map((option) => option.label), this.analyticsIndex);
49
- }
50
- this.addChild(new Spacer(1));
51
- this.addChild(new Text(rawKeyHint("↑↓", "navigate") +
52
- " " +
53
- keyHint("tui.select.confirm", this.step === "theme" ? "continue" : "finish") +
54
- " " +
55
- keyHint("tui.select.cancel", "skip setup"), 1, 0));
56
- this.addChild(new Spacer(1));
57
- this.addChild(new DynamicBorder());
58
- }
59
- addOptionList(labels, selectedIndex) {
60
- for (let i = 0; i < labels.length; i++) {
61
- const isSelected = i === selectedIndex;
62
- const prefix = isSelected ? piTheme().fg("accent", "→ ") : " ";
63
- const optionLabel = labels[i] ?? "";
64
- const label = isSelected ? piTheme().fg("accent", optionLabel) : piTheme().fg("text", optionLabel);
65
- this.addChild(new Text(`${prefix}${label}`, 1, 0));
66
- }
67
- }
68
- moveSelection(delta) {
69
- if (this.step === "theme") {
70
- const next = Math.max(0, Math.min(THEME_OPTIONS.length - 1, this.themeIndex + delta));
71
- if (next !== this.themeIndex) {
72
- this.themeIndex = next;
73
- this.options.onThemePreview(THEME_OPTIONS[this.themeIndex]?.value ?? "dark");
74
- }
75
- }
76
- else {
77
- this.analyticsIndex = Math.max(0, Math.min(ANALYTICS_OPTIONS.length - 1, this.analyticsIndex + delta));
78
- }
79
- this.update();
80
- }
81
- handleInput(keyData) {
82
- const kb = getKeybindings();
83
- if (kb.matches(keyData, "tui.select.up") || keyData === "k") {
84
- this.moveSelection(-1);
85
- }
86
- else if (kb.matches(keyData, "tui.select.down") || keyData === "j") {
87
- this.moveSelection(1);
88
- }
89
- else if (kb.matches(keyData, "tui.select.confirm") || keyData === "\n") {
90
- if (this.step === "theme") {
91
- this.step = "analytics";
92
- this.update();
93
- }
94
- else {
95
- this.options.onSubmit({
96
- theme: THEME_OPTIONS[this.themeIndex]?.value ?? "dark",
97
- shareAnalytics: ANALYTICS_OPTIONS[this.analyticsIndex]?.value ?? true,
98
- });
99
- }
100
- }
101
- else if (kb.matches(keyData, "tui.select.cancel")) {
102
- this.options.onCancel();
103
- }
104
- }
105
- }
@@ -1,2 +0,0 @@
1
- import type { MarkdownTransformContext, MarkdownTransformer } from "@earendil-works/pi-coding-agent";
2
- export declare function createMarkdownTransform(messageType: MarkdownTransformContext["messageType"], isStreaming: boolean, transformers: readonly MarkdownTransformer[]): (markdown: string, availableWidth: number) => string;
@@ -1,18 +0,0 @@
1
- export function createMarkdownTransform(messageType, isStreaming, transformers) {
2
- return (markdown, availableWidth) => applyMarkdownTransformers(markdown, { messageType, isStreaming, availableWidth }, transformers);
3
- }
4
- function applyMarkdownTransformers(markdown, context, transformers) {
5
- let transformedMarkdown = markdown;
6
- for (const transformer of transformers) {
7
- try {
8
- const transformed = transformer(transformedMarkdown, context);
9
- if (typeof transformed === "string") {
10
- transformedMarkdown = transformed;
11
- }
12
- }
13
- catch {
14
- // Keep the current Markdown and continue with the next transformer.
15
- }
16
- }
17
- return transformedMarkdown;
18
- }
@@ -1,31 +0,0 @@
1
- import type { ModelRuntime } from "../startup-public.js";
2
- import type { AgentAuthenticationPort, AgentModelDescriptor, AgentModelPort } from "../../../contracts/agent-engine/index.js";
3
- export type PiDocumentedModelRuntime = Pick<ModelRuntime, "getAvailableSnapshot" | "getModel" | "getProvider" | "hasConfiguredAuth" | "refresh" | "logout">;
4
- export interface PiModelAuthenticationOptions {
5
- readonly runtime: PiDocumentedModelRuntime;
6
- readonly currentModel: () => AgentModelDescriptor | null;
7
- readonly selectModel: (model: ReturnType<PiDocumentedModelRuntime["getModel"]> extends infer T ? Exclude<T, undefined> : never) => Promise<void>;
8
- readonly login: (providerId: string, signal: AbortSignal) => Promise<void>;
9
- readonly timeoutMs?: number;
10
- readonly scopedModelIds?: () => readonly string[] | undefined;
11
- }
12
- /** Adapts the pinned model runtime to neutral model selection and authentication operations. */
13
- export declare class PiModelAuthenticationIntegration implements AgentModelPort, AgentAuthenticationPort {
14
- #private;
15
- private readonly options;
16
- readonly capabilities: {
17
- selection: boolean;
18
- refresh: boolean;
19
- scopedCatalog: boolean;
20
- login: boolean;
21
- logout: boolean;
22
- };
23
- constructor(options: PiModelAuthenticationOptions);
24
- listModels(): Promise<readonly AgentModelDescriptor[]>;
25
- currentModel(): Promise<AgentModelDescriptor | null>;
26
- selectModel(providerId: string, modelId: string): Promise<void>;
27
- refreshModels(): Promise<void>;
28
- status(providerId: string): Promise<"authenticated" | "unauthenticated" | "unavailable">;
29
- login(providerId: string, signal?: AbortSignal): Promise<void>;
30
- logout(providerId: string): Promise<void>;
31
- }
@@ -1,62 +0,0 @@
1
- /** Adapts the pinned model runtime to neutral model selection and authentication operations. */
2
- export class PiModelAuthenticationIntegration {
3
- options;
4
- capabilities = { selection: true, refresh: true, scopedCatalog: true, login: true, logout: true };
5
- #timeoutMs;
6
- constructor(options) {
7
- this.options = options;
8
- this.#timeoutMs = options.timeoutMs ?? 30_000;
9
- }
10
- async listModels() {
11
- const scope = this.options.scopedModelIds?.();
12
- const selected = scope ? new Set(scope) : null;
13
- return this.options.runtime.getAvailableSnapshot()
14
- .filter(model => !selected || selected.has(`${model.provider}/${model.id}`))
15
- .map(model => ({
16
- providerId: model.provider,
17
- modelId: model.id,
18
- displayName: model.name,
19
- contextWindow: model.contextWindow,
20
- thinkingLevels: [],
21
- }));
22
- }
23
- async currentModel() { return this.options.currentModel(); }
24
- async selectModel(providerId, modelId) {
25
- const model = this.options.runtime.getModel(providerId, modelId);
26
- if (!model)
27
- throw new Error(`model is unavailable: ${providerId}/${modelId}`);
28
- await this.options.selectModel(model);
29
- }
30
- async refreshModels() {
31
- await this.options.runtime.refresh();
32
- }
33
- async status(providerId) {
34
- return this.options.runtime.getProvider(providerId) === undefined
35
- ? "unavailable"
36
- : this.options.runtime.hasConfiguredAuth(providerId) ? "authenticated" : "unauthenticated";
37
- }
38
- async login(providerId, signal) {
39
- await boundedOperation(inner => this.options.login(providerId, inner), this.#timeoutMs, signal);
40
- }
41
- async logout(providerId) {
42
- await boundedOperation(signal => this.options.runtime.logout(providerId, { signal }), this.#timeoutMs);
43
- }
44
- }
45
- async function boundedOperation(operation, timeoutMs, outer) {
46
- const controller = new AbortController();
47
- const abort = () => controller.abort(outer?.reason);
48
- outer?.addEventListener("abort", abort, { once: true });
49
- const timer = setTimeout(() => controller.abort(new Error(`model/authentication operation timed out after ${timeoutMs}ms`)), timeoutMs);
50
- try {
51
- if (outer?.aborted)
52
- abort();
53
- await Promise.race([
54
- operation(controller.signal),
55
- new Promise((_, reject) => controller.signal.addEventListener("abort", () => reject(controller.signal.reason ?? new Error("model/authentication operation cancelled")), { once: true })),
56
- ]);
57
- }
58
- finally {
59
- clearTimeout(timer);
60
- outer?.removeEventListener("abort", abort);
61
- }
62
- }
@@ -1,32 +0,0 @@
1
- import type { AgentSession } from "../startup-public.js";
2
- import type { AgentExtensionBinding, AgentExtensionFailure, AgentExtensionPort, AgentResourceDescriptor, AgentResourcesPort, AgentSessionMetadata } from "../../../contracts/agent-engine/index.js";
3
- export interface PiResourceExtensionOptions {
4
- readonly session: AgentSession;
5
- readonly bindUi: () => Promise<void>;
6
- readonly unbindUi: () => Promise<void>;
7
- }
8
- /** Adapts Pi resource discovery and extension binding while containing extension failures at the port. */
9
- export declare class PiResourceExtensionIntegration implements AgentResourcesPort, AgentExtensionPort {
10
- #private;
11
- private readonly options;
12
- readonly capabilities: {
13
- reload: boolean;
14
- extensionBinding: boolean;
15
- binding: boolean;
16
- renderers: boolean;
17
- };
18
- constructor(options: PiResourceExtensionOptions);
19
- discoverResources(): Promise<readonly AgentResourceDescriptor[]>;
20
- discoverCommands(): Promise<{
21
- name: string;
22
- description: string;
23
- }[]>;
24
- sessionMetadata(): Promise<AgentSessionMetadata>;
25
- bind(sessionId: string): Promise<AgentExtensionBinding>;
26
- bindExtensions(sessionId: string): Promise<AgentExtensionBinding>;
27
- reload(): Promise<void>;
28
- resolveMessageRenderer(customType: string): unknown;
29
- resolveToolRenderer(toolName: string): unknown;
30
- subscribeFailures(listener: (failure: AgentExtensionFailure) => void): () => void;
31
- dispose(): Promise<void>;
32
- }
@@ -1,81 +0,0 @@
1
- /** Adapts Pi resource discovery and extension binding while containing extension failures at the port. */
2
- export class PiResourceExtensionIntegration {
3
- options;
4
- capabilities = { reload: true, extensionBinding: true, binding: true, renderers: true };
5
- #failures = new Set();
6
- #unsubscribeError;
7
- #binding;
8
- constructor(options) {
9
- this.options = options;
10
- this.#unsubscribeError = options.session.extensionRunner.onError(error => {
11
- const failure = {
12
- extensionPath: error.extensionPath || null,
13
- operation: error.event || "extension",
14
- message: error.error || "unknown extension failure",
15
- recoverable: true,
16
- };
17
- for (const listener of this.#failures)
18
- listener(failure);
19
- });
20
- }
21
- async discoverResources() {
22
- const loader = this.options.session.resourceLoader;
23
- const resources = [];
24
- for (const skill of loader.getSkills().skills)
25
- resources.push(resource(skill.name, "skill", skill.name, { source: skill.filePath }));
26
- for (const prompt of loader.getPrompts().prompts)
27
- resources.push(resource(prompt.name, "prompt", prompt.name, { source: prompt.filePath }));
28
- for (const theme of loader.getThemes().themes)
29
- resources.push(resource(theme.name ?? "theme", "other", theme.name ?? "Theme", { resourceType: "theme" }));
30
- for (const file of loader.getAgentsFiles().agentsFiles)
31
- resources.push(resource(file.path, "other", file.path, { resourceType: "agent-context" }));
32
- for (const command of this.options.session.extensionRunner.getRegisteredCommands())
33
- resources.push(resource(command.name, "command", command.name, { invocationName: command.invocationName }));
34
- return resources;
35
- }
36
- async discoverCommands() {
37
- return this.options.session.extensionRunner.getRegisteredCommands().map(command => ({
38
- name: command.name,
39
- description: command.description ?? "",
40
- }));
41
- }
42
- async sessionMetadata() {
43
- const manager = this.options.session.sessionManager;
44
- return {
45
- sessionId: this.options.session.sessionId,
46
- sessionName: manager.getSessionName() ?? null,
47
- sessionPath: manager.getSessionFile() ?? null,
48
- cwd: manager.getCwd(),
49
- };
50
- }
51
- async bind(sessionId) {
52
- if (sessionId !== this.options.session.sessionId)
53
- throw new Error("extension binding targets a different session");
54
- await this.#binding?.dispose();
55
- await this.options.bindUi();
56
- let disposed = false;
57
- const binding = {
58
- sessionId,
59
- dispose: async () => {
60
- if (disposed)
61
- return;
62
- disposed = true;
63
- if (this.#binding === binding)
64
- this.#binding = undefined;
65
- await this.options.unbindUi();
66
- },
67
- };
68
- this.#binding = binding;
69
- return binding;
70
- }
71
- async bindExtensions(sessionId) { return this.bind(sessionId); }
72
- async reload() { await this.options.session.reload(); }
73
- resolveMessageRenderer(customType) { return this.options.session.extensionRunner.getMessageRenderer(customType); }
74
- resolveToolRenderer(toolName) { return this.options.session.extensionRunner.getToolDefinition(toolName); }
75
- subscribeFailures(listener) { this.#failures.add(listener); return () => this.#failures.delete(listener); }
76
- async dispose() { await this.#binding?.dispose(); this.#unsubscribeError(); this.#failures.clear(); }
77
- }
78
- function resource(id, kind, label, metadata) {
79
- return { id: normalizeId(id), kind, label, metadata: Object.fromEntries(Object.entries(metadata).filter((entry) => typeof entry[1] === "string")) };
80
- }
81
- function normalizeId(value) { return value.replace(/[^A-Za-z0-9._:/-]/g, "-").slice(0, 128) || "resource"; }
@@ -1,249 +0,0 @@
1
- /**
2
- * Reviewed effect authority for every generated Pi setting. Presentation remains
3
- * generated; this table states who must make each accepted value observable.
4
- */
5
- export const PI_SETTING_EFFECTS = Object.freeze({
6
- autoCompact: effect("live", "agent", "transcript", "compaction status, summary, completion, and failure rows", "pinned-transcript-lifecycle-parity"),
7
- showImages: effect("live", "shell", "transcript", "pinned inline image and textual fallback components", "pinned-transcript-image-parity"),
8
- imageWidthCells: effect("live", "shell", "transcript-geometry", "pinned image component width and clipping", "pinned-transcript-image-parity"),
9
- autoResizeImages: effect("live", "agent", "none", "provider image preparation and pinned warning row", "settings-effects-provider-parity"),
10
- blockImages: effect("live", "agent", "none", "provider context conversion and pinned blocked-image notice", "settings-effects-provider-parity"),
11
- enableSkillCommands: effect("live", "shell", "editor-menu", "pinned command autocomplete list", "pinned-editor-input-parity"),
12
- steeringMode: effect("live", "agent", "queue-transcript", "pinned steering queue and submitted prompt rows", "pinned-status-indicator-parity"),
13
- followUpMode: effect("live", "agent", "queue-transcript", "pinned follow-up queue and submitted prompt rows", "pinned-status-indicator-parity"),
14
- transport: effect("live", "agent", "status-error", "pinned provider request status and failure rows", "settings-effects-provider-parity"),
15
- httpIdleTimeoutMs: effect("live", "agent", "retry-error", "pinned timeout, retry, and terminal failure rows", "pinned-transcript-lifecycle-parity"),
16
- thinkingLevel: effect("live", "agent", "footer-transcript", "pinned footer indicator, thinking rows, and clamp notice", "pinned-status-indicator-parity"),
17
- theme: hiddenEffect("live", "shell", "pinned theme selector and complete themed shell", "pinned-theme-parity"),
18
- hideThinkingBlock: effect("live", "shell", "transcript", "pinned thinking block presence and spacing", "pinned-transcript-lifecycle-parity"),
19
- mermaidRenderingMode: effect("live", "shell", "markdown", "pinned Mermaid Markdown transformation", "pinned-assistant-content-parity"),
20
- showCacheMissNotices: effect("live", "shell", "transcript-notice", "pinned cache-miss transcript notice", "pinned-transcript-lifecycle-parity"),
21
- collapseChangelog: effect("next-start", "startup", "startup-transcript", "pinned startup and command changelog components", "pi-startup-composition-parity"),
22
- enableInstallTelemetry: effect("next-start", "installation", "none", "install lifecycle and its pinned failure diagnostic", "settings-effects-installation-parity"),
23
- quietStartup: hiddenEffect("next-start", "startup", "pinned startup suppression lifecycle", "pi-startup-composition-parity"),
24
- defaultProjectTrust: effect("next-start", "startup", "startup-selector", "pinned pre-resource project trust selector", "project-trust-startup-parity"),
25
- doubleEscapeAction: effect("live", "shell", "selector", "pinned tree or fork selector", "pinned-selector-parity"),
26
- treeFilterMode: effect("live", "shell", "selector", "pinned tree selector filter, rows, and hints", "pinned-selector-parity"),
27
- showHardwareCursor: effect("live", "terminal", "terminal-cursor", "pinned editor, overlay, blur, failure, and exit cursor operations", "pi-terminal-operation-parity"),
28
- editorPaddingX: effect("live", "shell", "editor-geometry", "pinned editor border, padding, wrapping, and cursor column", "pinned-editor-input-parity"),
29
- outputPad: effect("live", "shell", "transcript-geometry", "pinned transcript, tool, status, and error horizontal padding", "pinned-transcript-lifecycle-parity"),
30
- autocompleteMaxVisible: effect("live", "shell", "menu-geometry", "pinned autocomplete clipping and editor anchoring", "pinned-editor-input-parity"),
31
- clearOnShrink: effect("live", "terminal", "terminal-frame", "pinned resize clearing and resulting terminal frame", "pi-terminal-operation-parity"),
32
- showTerminalProgress: effect("live", "terminal", "terminal-status", "pinned OSC progress lifecycle", "pi-terminal-operation-parity"),
33
- tuiMode: hiddenEffect("next-session", "shell", "pinned regular/fullscreen selector and terminal lifecycle", "pi-terminal-operation-parity"),
34
- fullscreenExitOutput: hiddenEffect("current-exit", "shutdown", "pinned styled transcript and compact dim resume hint", "pinned-fullscreen-exit-parity"),
35
- fullscreenScrollbar: hiddenEffect("live", "shell", "pinned fullscreen scrollbar reservation", "pi-terminal-operation-parity"),
36
- warnings: effect("live", "agent", "transcript-notice", "pinned warning rows by warning part", "pinned-transcript-lifecycle-parity"),
37
- });
38
- function effect(application, owner, visualClass, pinnedSurface, evidence) {
39
- return { application, owner, visual: { class: visualClass, pinnedSurface, evidence } };
40
- }
41
- function hiddenEffect(application, owner, pinnedSurface, evidence) {
42
- return { application, owner, hiddenInBare: true, visual: { class: "hidden", pinnedSurface, evidence } };
43
- }
44
- /**
45
- * One transactional authority for Pi setting validation, active effects,
46
- * persistence, durability, rollback, and owner lifecycle.
47
- */
48
- export class PiSettingsCoordinator {
49
- #operations;
50
- #handlers = new Map();
51
- #state = new Map();
52
- #productMode;
53
- #flushStorage;
54
- #drainErrors;
55
- constructor(operations, options) {
56
- this.#operations = new Map(operations.map(operation => [operation.key, operation]));
57
- this.#productMode = options.productMode ?? "bare";
58
- this.#flushStorage = options.flush;
59
- this.#drainErrors = options.drainErrors;
60
- for (const operation of operations) {
61
- const stored = operation.read();
62
- this.#state.set(operation.key, { stored, effective: stored, inconsistentReason: null });
63
- }
64
- }
65
- bindOwner(owner, handlers) {
66
- const bound = [];
67
- for (const [candidate, handler] of Object.entries(handlers)) {
68
- if (handler === undefined)
69
- continue;
70
- const key = candidate;
71
- const definition = PI_SETTING_EFFECTS[key];
72
- if (definition === undefined)
73
- throw new Error(`unknown Pi setting effect: ${key}`);
74
- if (definition.owner !== owner)
75
- throw new Error(`${key} belongs to ${definition.owner}, not ${owner}`);
76
- if (this.#productMode === "bare" && definition.hiddenInBare === true) {
77
- throw new Error(`${key} is hidden in bare A1`);
78
- }
79
- this.#handlers.set(key, handler);
80
- bound.push(key);
81
- }
82
- return () => this.unbindOwner(owner, bound);
83
- }
84
- unbindOwner(owner, keys) {
85
- const candidates = keys ?? [...this.#handlers.keys()];
86
- for (const key of candidates)
87
- if (PI_SETTING_EFFECTS[key].owner === owner)
88
- this.#handlers.delete(key);
89
- }
90
- definition(key) {
91
- return PI_SETTING_EFFECTS[key];
92
- }
93
- storedValue(key) {
94
- const operation = this.#requireOperation(key);
95
- const stored = operation.read();
96
- const state = this.#requireState(key);
97
- state.stored = stored;
98
- return stored;
99
- }
100
- effectiveValue(key) {
101
- return this.#requireState(key).effective;
102
- }
103
- limitationReason(key) {
104
- const definition = PI_SETTING_EFFECTS[key];
105
- if (this.#productMode === "bare" && definition.hiddenInBare === true)
106
- return "setting is not available in the active product mode";
107
- const inconsistent = this.#requireState(key).inconsistentReason;
108
- if (inconsistent !== null)
109
- return inconsistent;
110
- if (!this.#handlers.has(key))
111
- return `${definition.owner} effect is not bound for ${definition.application} application`;
112
- return null;
113
- }
114
- available(key) {
115
- return this.limitationReason(key) === null;
116
- }
117
- validate(key, value) {
118
- this.#requireOperation(key).validate(value);
119
- }
120
- async apply(key, value) {
121
- const operation = this.#requireOperation(key);
122
- operation.validate(value);
123
- const definition = PI_SETTING_EFFECTS[key];
124
- const previousStored = operation.read();
125
- const state = this.#requireState(key);
126
- const previousEffective = state.effective;
127
- const limitationReason = this.limitationReason(key);
128
- if (limitationReason !== null) {
129
- return outcome("unavailable", definition.application, previousStored, previousEffective, null, limitationReason);
130
- }
131
- const handler = this.#handlers.get(key);
132
- if (definition.application !== "live") {
133
- try {
134
- operation.write(value);
135
- await this.flush();
136
- state.stored = value;
137
- return outcome("deferred", definition.application, value, previousEffective, null, null);
138
- }
139
- catch (error) {
140
- const failure = await this.#restorePersistence(operation, previousStored, error);
141
- state.stored = operation.read();
142
- return outcome("failed", definition.application, state.stored, previousEffective, failure, null);
143
- }
144
- }
145
- try {
146
- await handler.apply(value);
147
- }
148
- catch (error) {
149
- return outcome("failed", definition.application, previousStored, previousEffective, describe(error), null);
150
- }
151
- state.effective = value;
152
- try {
153
- operation.write(value);
154
- await this.flush();
155
- state.stored = value;
156
- state.inconsistentReason = null;
157
- return outcome("applied", definition.application, value, value, null, null);
158
- }
159
- catch (error) {
160
- const persistenceFailure = await this.#restorePersistence(operation, previousStored, error);
161
- try {
162
- await handler.apply(previousEffective);
163
- state.effective = previousEffective;
164
- state.stored = operation.read();
165
- return outcome("failed", definition.application, state.stored, previousEffective, persistenceFailure, null);
166
- }
167
- catch (rollbackError) {
168
- state.stored = operation.read();
169
- state.inconsistentReason = `rollback failed after ${persistenceFailure}: ${describe(rollbackError)}`;
170
- return outcome("failed", definition.application, state.stored, state.effective, state.inconsistentReason, state.inconsistentReason);
171
- }
172
- }
173
- }
174
- async flush() {
175
- await this.#flushStorage();
176
- const errors = this.#drainErrors?.() ?? [];
177
- if (errors.length > 0)
178
- throw new Error(errors.map(value => value.error.message).join("; "));
179
- }
180
- async rollback(key, value) {
181
- const handler = this.#handlers.get(key);
182
- if (handler === undefined)
183
- throw new Error(`cannot roll back unbound setting: ${key}`);
184
- await handler.apply(value);
185
- this.#requireState(key).effective = value;
186
- }
187
- async #restorePersistence(operation, previous, cause) {
188
- const original = describe(cause);
189
- try {
190
- operation.write(previous);
191
- await this.flush();
192
- return original;
193
- }
194
- catch (rollbackError) {
195
- return `${original}; persistence rollback failed: ${describe(rollbackError)}`;
196
- }
197
- }
198
- #requireOperation(key) {
199
- const operation = this.#operations.get(key);
200
- if (operation === undefined)
201
- throw new Error(`setting is unavailable: ${key}`);
202
- return operation;
203
- }
204
- #requireState(key) {
205
- const state = this.#state.get(key);
206
- if (state === undefined)
207
- throw new Error(`setting state is unavailable: ${key}`);
208
- return state;
209
- }
210
- }
211
- export function settingsEffectInventoryDrift(presented, reviewed = Object.keys(PI_SETTING_EFFECTS)) {
212
- const reviewedSet = new Set(reviewed);
213
- const presentedSet = new Set(presented);
214
- const counts = new Map();
215
- for (const key of reviewed)
216
- counts.set(key, (counts.get(key) ?? 0) + 1);
217
- return {
218
- unmapped: presented.filter(key => !reviewedSet.has(key)),
219
- stale: reviewed.filter(key => !presentedSet.has(key)),
220
- duplicated: [...counts].filter(([, count]) => count > 1).map(([key]) => key),
221
- };
222
- }
223
- export function settingsVisualInventoryViolations(presented, reviewed = PI_SETTING_EFFECTS) {
224
- const violations = [];
225
- for (const candidate of presented) {
226
- const key = candidate;
227
- const definition = reviewed[key];
228
- if (definition === undefined) {
229
- violations.push(`${candidate}: missing visual classification`);
230
- continue;
231
- }
232
- const visual = definition.visual;
233
- if (!visual || visual.pinnedSurface.trim().length === 0)
234
- violations.push(`${candidate}: missing pinned visual source`);
235
- if (!visual || visual.evidence.trim().length === 0)
236
- violations.push(`${candidate}: missing independent visual evidence`);
237
- if (definition.hiddenInBare === true && visual?.class !== "hidden")
238
- violations.push(`${candidate}: hidden setting declares a visible frame`);
239
- if (definition.hiddenInBare !== true && visual?.class === "hidden")
240
- violations.push(`${candidate}: visible setting declares hidden evidence`);
241
- }
242
- return violations;
243
- }
244
- function outcome(status, application, storedValue, effectiveValue, failure, limitationReason) {
245
- return { status, application, storedValue, effectiveValue, failure, limitationReason };
246
- }
247
- function describe(error) {
248
- return error instanceof Error ? error.message : String(error);
249
- }
@@ -1,43 +0,0 @@
1
- import type { SettingsManager } from "../startup-public.js";
2
- import type { AgentJsonValue, AgentSettingChangeOutcome, AgentSettingDescriptor, AgentSettingOwner, AgentSettingsPort } from "../../../contracts/agent-engine/index.js";
3
- import { type PiSettingOwnerHandlers } from "./settings-effects.js";
4
- /** Values only the running engine knows. */
5
- export interface PiSettingsProviders {
6
- readonly themes?: () => readonly string[];
7
- readonly thinkingLevels?: () => readonly string[];
8
- readonly productMode?: "bare" | "comparison";
9
- }
10
- export declare const AUTOMATIC_THEME = "automatic";
11
- interface AutomaticTheme {
12
- readonly light: string;
13
- readonly dark: string;
14
- }
15
- export declare function parseAutomaticTheme(stored: string): AutomaticTheme | null;
16
- export declare const EXPOSED_SETTING_KEYS: readonly string[];
17
- export declare function settingsInventoryDrift(presented: readonly string[], mapped: readonly string[]): {
18
- readonly unmapped: readonly string[];
19
- readonly stale: readonly string[];
20
- };
21
- /**
22
- * Pi settings boundary backed by the transactional settings coordinator. The
23
- * generated metadata owns presentation while the reviewed effect registry owns
24
- * timing, availability, and active behavior.
25
- */
26
- export declare class PiSettingsIntegration implements AgentSettingsPort {
27
- #private;
28
- private readonly settings;
29
- readonly capabilities: {
30
- write: boolean;
31
- flush: boolean;
32
- };
33
- constructor(settings: SettingsManager, providers?: PiSettingsProviders);
34
- bindOwner(owner: AgentSettingOwner, handlers: PiSettingOwnerHandlers): () => void;
35
- unbindOwner(owner: AgentSettingOwner): void;
36
- listSettings(): Promise<readonly AgentSettingDescriptor[]>;
37
- readSetting(key: string): Promise<AgentJsonValue | undefined>;
38
- writeSetting(key: string, value: AgentJsonValue): Promise<AgentSettingChangeOutcome>;
39
- /** Shared route used by the pinned selector and owned settings surface. */
40
- writeSettingNow(key: string, value: AgentJsonValue): Promise<AgentSettingChangeOutcome>;
41
- flush(): Promise<void>;
42
- }
43
- export {};