@timurproko/a1 0.1.8-dev.0b6d8cc → 0.1.8-dev.121

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 (387) hide show
  1. package/README.md +29 -23
  2. package/bin/cli.js +7 -7
  3. package/bin/guardian.js +1 -1
  4. package/bin/supervisor.js +1 -1
  5. package/bin/ui.js +3 -3
  6. package/dist/{src/cli → cli}/dispatch.js +14 -12
  7. package/dist/{src/cli → cli}/packages.d.ts +10 -2
  8. package/dist/{src/cli → cli}/packages.js +24 -20
  9. package/dist/{src/cli → cli}/version-stats.js +4 -4
  10. package/dist/composition/agent-engine-bridge.d.ts +3 -0
  11. package/dist/composition/agent-engine-bridge.js +108 -0
  12. package/dist/composition/index.d.ts +3 -0
  13. package/dist/composition/index.js +3 -0
  14. package/dist/composition/owned-ui.d.ts +25 -0
  15. package/dist/composition/owned-ui.js +40 -0
  16. package/dist/composition/process.d.ts +16 -0
  17. package/dist/composition/process.js +45 -0
  18. package/dist/composition/settings-route-host.d.ts +8 -0
  19. package/dist/composition/settings-route-host.js +73 -0
  20. package/dist/{src/features → features}/owned-ui/customization.d.ts +1 -1
  21. package/dist/{src/features → features}/owned-ui/customization.js +1 -1
  22. package/dist/{src/features → features}/owned-ui/diagnostics.d.ts +1 -1
  23. package/dist/{src/features → features}/owned-ui/run.d.ts +2 -2
  24. package/dist/{src/features → features}/owned-ui/settings-app.d.ts +3 -3
  25. package/dist/{src/features → features}/owned-ui/settings-app.js +1 -1
  26. package/dist/{src/features → features}/workspace/capabilities.d.ts +1 -1
  27. package/dist/{src/features → features}/workspace/reducer.d.ts +1 -1
  28. package/dist/{src/features → features}/workspace/reducer.js +1 -1
  29. package/dist/{src/features → features}/workspace/router.d.ts +1 -1
  30. package/dist/{src/features → features}/workspace/store.d.ts +1 -1
  31. package/dist/{src/foundation → foundation}/launch-guardian/main.js +8 -2
  32. package/dist/foundation/lifecycle/paths.d.ts +28 -0
  33. package/dist/{src/foundation → foundation}/lifecycle/paths.js +21 -0
  34. package/dist/{src/foundation → foundation}/native-host-protocol/messages.d.ts +1 -1
  35. package/dist/{src/foundation → foundation}/native-host-protocol/messages.js +1 -1
  36. package/dist/{src/foundation → foundation}/release/bootstrap.js +42 -10
  37. package/dist/foundation/release/endpoints.d.ts +20 -0
  38. package/dist/foundation/release/endpoints.js +50 -0
  39. package/dist/{src/foundation → foundation}/release/index.d.ts +1 -0
  40. package/dist/{src/foundation → foundation}/release/index.js +1 -0
  41. package/dist/{src/foundation → foundation}/release/release-gc.d.ts +4 -1
  42. package/dist/{src/foundation → foundation}/release/release-gc.js +9 -1
  43. package/dist/{src/foundation → foundation}/release/update.d.ts +9 -1
  44. package/dist/{src/foundation → foundation}/release/update.js +69 -35
  45. package/dist/{src/foundation → foundation}/storage/control-store.d.ts +1 -1
  46. package/dist/{src/foundation → foundation}/storage/control-store.js +1 -1
  47. package/dist/{src/foundation → foundation}/structured-agent-runtime/backpressure.d.ts +1 -1
  48. package/dist/{src/foundation → foundation}/structured-agent-runtime/backpressure.js +1 -1
  49. package/dist/{src/foundation → foundation}/structured-agent-runtime/commands.d.ts +1 -1
  50. package/dist/{src/foundation → foundation}/structured-agent-runtime/commands.js +1 -1
  51. package/dist/{src/foundation → foundation}/structured-agent-runtime/handshake.d.ts +1 -1
  52. package/dist/{src/foundation → foundation}/structured-agent-runtime/handshake.js +1 -1
  53. package/dist/{src/foundation → foundation}/structured-agent-runtime/reconnection.d.ts +1 -1
  54. package/dist/{src/foundation → foundation}/structured-agent-runtime/reconnection.js +1 -1
  55. package/dist/{src/foundation → foundation}/structured-agent-runtime/state.d.ts +1 -1
  56. package/dist/{src/foundation → foundation}/structured-agent-runtime/state.js +1 -1
  57. package/dist/foundation/supervision/index.d.ts +3 -0
  58. package/dist/foundation/supervision/index.js +3 -0
  59. package/dist/{src/foundation → foundation}/supervision/main.js +11 -5
  60. package/dist/foundation/supervision/paths.d.ts +1 -0
  61. package/dist/foundation/supervision/paths.js +1 -0
  62. package/dist/{src/foundation → foundation}/supervision/server.d.ts +18 -1
  63. package/dist/{src/foundation → foundation}/supervision/server.js +52 -1
  64. package/dist/{src/foundation/pi-component-adapter → integrations/pi/components}/components.d.ts +1 -1
  65. package/dist/{src/foundation/pi-component-adapter → integrations/pi/components}/conformance.js +2 -2
  66. package/dist/{src/foundation/pi-component-adapter → integrations/pi/components}/shell-extension-ui.d.ts +1 -1
  67. package/dist/{src/foundation/pi-component-adapter → integrations/pi/components}/shell-footer-status.d.ts +1 -1
  68. package/dist/{src/foundation/pi-component-adapter → integrations/pi/components}/shell-presenters-transcript.d.ts +1 -1
  69. package/dist/{src/foundation/pi-component-adapter → integrations/pi/components}/shell-presenters-transcript.js +1 -1
  70. package/dist/{src/foundation/pi-component-adapter → integrations/pi/components}/shell-selectors-dialogs.d.ts +1 -1
  71. package/dist/{src/foundation/pi-component-adapter → integrations/pi/components}/shell-shared-facade.d.ts +1 -1
  72. package/dist/{src/foundation/pi-component-adapter → integrations/pi/components}/upstream/components/session-footer.d.ts +1 -1
  73. package/dist/{src/foundation/pi-engine-adapter → integrations/pi/engine}/adapter.d.ts +2 -2
  74. package/dist/{src/foundation/pi-engine-adapter → integrations/pi/engine}/adapter.js +113 -16
  75. package/dist/{src/foundation/pi-engine-adapter → integrations/pi/engine}/conformance.js +2 -2
  76. package/dist/{src/foundation/pi-engine-adapter → integrations/pi/engine}/model-auth-integration.d.ts +1 -1
  77. package/dist/{src/foundation/pi-engine-adapter → integrations/pi/engine}/package-integration.d.ts +1 -1
  78. package/dist/{src/foundation/pi-engine-adapter → integrations/pi/engine}/package-integration.js +1 -1
  79. package/dist/{src/foundation/pi-engine-adapter → integrations/pi/engine}/resource-extension-integration.d.ts +1 -1
  80. package/dist/{src/foundation/pi-engine-adapter → integrations/pi/engine}/session-integration.d.ts +1 -1
  81. package/dist/{src/foundation/pi-engine-adapter → integrations/pi/engine}/session-integration.js +1 -1
  82. package/dist/{src/foundation/pi-engine-adapter → integrations/pi/engine}/settings-integration.d.ts +1 -1
  83. package/dist/{src/foundation/pi-engine-adapter → integrations/pi/engine}/workflow-controllers.d.ts +1 -1
  84. package/dist/{src/foundation/pi-owned-ui-integration → integrations/pi/owned-ui}/route-host.d.ts +1 -1
  85. package/dist/{src/foundation/pi-owned-ui-integration/session-shell.d.ts → integrations/pi/owned-ui/session-shell-root.d.ts} +13 -46
  86. package/dist/integrations/pi/owned-ui/session-shell-root.js +722 -0
  87. package/dist/integrations/pi/owned-ui/session-shell.d.ts +46 -0
  88. package/dist/{src/foundation/pi-owned-ui-integration → integrations/pi/owned-ui}/session-shell.js +24 -704
  89. package/dist/{src/foundation/pi-tui-runtime-adapter → integrations/pi/tui-runtime}/presentation-adapter.d.ts +1 -1
  90. package/dist/native/darwin-arm64/manifest.json +1 -1
  91. package/dist/native/linux-x64/manifest.json +1 -1
  92. package/dist/native/win32-x64/manifest.json +2 -2
  93. package/dist/native/win32-x64/process-guardian.exe +0 -0
  94. package/dist/{src/foundation/ui-apps → ui/apps}/contracts.d.ts +1 -1
  95. package/dist/{src/foundation/ui-apps → ui/apps}/host.d.ts +1 -1
  96. package/dist/{src/foundation/ui-apps → ui/apps}/host.js +1 -1
  97. package/dist/{src/foundation/owned-ui-settings → ui/settings}/session.d.ts +1 -1
  98. package/docs/architecture/boundaries.md +8 -8
  99. package/docs/architecture/project-structure.md +52 -29
  100. package/docs/architecture/toolchain.md +5 -5
  101. package/docs/ci-release-runbook.md +76 -79
  102. package/docs/features/launch-profiles.md +7 -9
  103. package/docs/manual-owned-ui-checkpoint.md +52 -0
  104. package/docs/manual-terminal-colour-check.md +1 -1
  105. package/package.json +24 -22
  106. package/dist/src/composition/index.d.ts +0 -48
  107. package/dist/src/composition/index.js +0 -258
  108. package/dist/src/foundation/lifecycle/paths.d.ts +0 -10
  109. package/dist/src/foundation/supervision/index.d.ts +0 -3
  110. package/dist/src/foundation/supervision/index.js +0 -3
  111. package/dist/src/foundation/supervision/paths.d.ts +0 -1
  112. package/dist/src/foundation/supervision/paths.js +0 -1
  113. package/docs/manual-transparent-checkpoint.md +0 -53
  114. /package/dist/{src/cli → cli}/capabilities.d.ts +0 -0
  115. /package/dist/{src/cli → cli}/capabilities.js +0 -0
  116. /package/dist/{src/cli → cli}/dispatch.d.ts +0 -0
  117. /package/dist/{src/cli → cli}/index.d.ts +0 -0
  118. /package/dist/{src/cli → cli}/index.js +0 -0
  119. /package/dist/{src/cli → cli}/version-stats.d.ts +0 -0
  120. /package/dist/{src/cli → cli}/version.d.ts +0 -0
  121. /package/dist/{src/cli → cli}/version.js +0 -0
  122. /package/dist/{src/foundation/agent-engine-contracts → contracts/agent-engine}/capability-ports.d.ts +0 -0
  123. /package/dist/{src/foundation/agent-engine-contracts → contracts/agent-engine}/capability-ports.js +0 -0
  124. /package/dist/{src/foundation/agent-engine-contracts → contracts/agent-engine}/domain-validation.d.ts +0 -0
  125. /package/dist/{src/foundation/agent-engine-contracts → contracts/agent-engine}/domain-validation.js +0 -0
  126. /package/dist/{src/foundation/agent-engine-contracts → contracts/agent-engine}/domain.d.ts +0 -0
  127. /package/dist/{src/foundation/agent-engine-contracts → contracts/agent-engine}/domain.js +0 -0
  128. /package/dist/{src/foundation/agent-engine-contracts → contracts/agent-engine}/index.d.ts +0 -0
  129. /package/dist/{src/foundation/agent-engine-contracts → contracts/agent-engine}/index.js +0 -0
  130. /package/dist/{src/foundation/agent-engine-contracts → contracts/agent-engine}/model.d.ts +0 -0
  131. /package/dist/{src/foundation/agent-engine-contracts → contracts/agent-engine}/model.js +0 -0
  132. /package/dist/{src/foundation/agent-engine-contracts → contracts/agent-engine}/package-ports.d.ts +0 -0
  133. /package/dist/{src/foundation/agent-engine-contracts → contracts/agent-engine}/package-ports.js +0 -0
  134. /package/dist/{src/foundation/agent-engine-contracts → contracts/agent-engine}/ports.d.ts +0 -0
  135. /package/dist/{src/foundation/agent-engine-contracts → contracts/agent-engine}/ports.js +0 -0
  136. /package/dist/{src/foundation/agent-engine-contracts → contracts/agent-engine}/serialization.d.ts +0 -0
  137. /package/dist/{src/foundation/agent-engine-contracts → contracts/agent-engine}/serialization.js +0 -0
  138. /package/dist/{src/foundation/agent-engine-contracts → contracts/agent-engine}/validation.d.ts +0 -0
  139. /package/dist/{src/foundation/agent-engine-contracts → contracts/agent-engine}/validation.js +0 -0
  140. /package/dist/{src/foundation/owned-ui-contracts → contracts/owned-ui}/extension-ui.d.ts +0 -0
  141. /package/dist/{src/foundation/owned-ui-contracts → contracts/owned-ui}/extension-ui.js +0 -0
  142. /package/dist/{src/foundation/owned-ui-contracts → contracts/owned-ui}/index.d.ts +0 -0
  143. /package/dist/{src/foundation/owned-ui-contracts → contracts/owned-ui}/index.js +0 -0
  144. /package/dist/{src/foundation/owned-ui-contracts → contracts/owned-ui}/model.d.ts +0 -0
  145. /package/dist/{src/foundation/owned-ui-contracts → contracts/owned-ui}/model.js +0 -0
  146. /package/dist/{src/foundation/owned-ui-contracts → contracts/owned-ui}/validation.d.ts +0 -0
  147. /package/dist/{src/foundation/owned-ui-contracts → contracts/owned-ui}/validation.js +0 -0
  148. /package/dist/{src/foundation/presentation-contracts → contracts/presentation}/index.d.ts +0 -0
  149. /package/dist/{src/foundation/presentation-contracts → contracts/presentation}/index.js +0 -0
  150. /package/dist/{src/foundation/workspace-contracts → contracts/workspace}/index.d.ts +0 -0
  151. /package/dist/{src/foundation/workspace-contracts → contracts/workspace}/index.js +0 -0
  152. /package/dist/{src/foundation/workspace-contracts → contracts/workspace}/model.d.ts +0 -0
  153. /package/dist/{src/foundation/workspace-contracts → contracts/workspace}/model.js +0 -0
  154. /package/dist/{src/foundation/workspace-contracts → contracts/workspace}/validation.d.ts +0 -0
  155. /package/dist/{src/foundation/workspace-contracts → contracts/workspace}/validation.js +0 -0
  156. /package/dist/{src/features → features}/launch/development-launch.d.ts +0 -0
  157. /package/dist/{src/features → features}/launch/development-launch.js +0 -0
  158. /package/dist/{src/features → features}/launch/index.d.ts +0 -0
  159. /package/dist/{src/features → features}/launch/index.js +0 -0
  160. /package/dist/{src/features → features}/launch/initialize-profile.d.ts +0 -0
  161. /package/dist/{src/features → features}/launch/initialize-profile.js +0 -0
  162. /package/dist/{src/features → features}/launch/intent.d.ts +0 -0
  163. /package/dist/{src/features → features}/launch/intent.js +0 -0
  164. /package/dist/{src/features → features}/launch/prepare-launch.d.ts +0 -0
  165. /package/dist/{src/features → features}/launch/prepare-launch.js +0 -0
  166. /package/dist/{src/features → features}/launch/profile-paths.d.ts +0 -0
  167. /package/dist/{src/features → features}/launch/profile-paths.js +0 -0
  168. /package/dist/{src/features → features}/launch/profiles.d.ts +0 -0
  169. /package/dist/{src/features → features}/launch/profiles.js +0 -0
  170. /package/dist/{src/features → features}/launch/runtime-selection.d.ts +0 -0
  171. /package/dist/{src/features → features}/launch/runtime-selection.js +0 -0
  172. /package/dist/{src/features → features}/owned-ui/diagnostics.js +0 -0
  173. /package/dist/{src/features → features}/owned-ui/index.d.ts +0 -0
  174. /package/dist/{src/features → features}/owned-ui/index.js +0 -0
  175. /package/dist/{src/features → features}/owned-ui/run.js +0 -0
  176. /package/dist/{src/features → features}/workspace/capabilities.js +0 -0
  177. /package/dist/{src/features → features}/workspace/index.d.ts +0 -0
  178. /package/dist/{src/features → features}/workspace/index.js +0 -0
  179. /package/dist/{src/features → features}/workspace/presentation.d.ts +0 -0
  180. /package/dist/{src/features → features}/workspace/presentation.js +0 -0
  181. /package/dist/{src/features → features}/workspace/reconciliation.d.ts +0 -0
  182. /package/dist/{src/features → features}/workspace/reconciliation.js +0 -0
  183. /package/dist/{src/features → features}/workspace/router.js +0 -0
  184. /package/dist/{src/features → features}/workspace/store.js +0 -0
  185. /package/dist/{src/foundation → foundation}/launch-guardian/index.d.ts +0 -0
  186. /package/dist/{src/foundation → foundation}/launch-guardian/index.js +0 -0
  187. /package/dist/{src/foundation → foundation}/launch-guardian/main.d.ts +0 -0
  188. /package/dist/{src/foundation → foundation}/lifecycle/commands.d.ts +0 -0
  189. /package/dist/{src/foundation → foundation}/lifecycle/commands.js +0 -0
  190. /package/dist/{src/foundation → foundation}/lifecycle/index.d.ts +0 -0
  191. /package/dist/{src/foundation → foundation}/lifecycle/index.js +0 -0
  192. /package/dist/{src/foundation → foundation}/lifecycle/launch-instance.d.ts +0 -0
  193. /package/dist/{src/foundation → foundation}/lifecycle/launch-instance.js +0 -0
  194. /package/dist/{src/foundation → foundation}/lifecycle/model.d.ts +0 -0
  195. /package/dist/{src/foundation → foundation}/lifecycle/model.js +0 -0
  196. /package/dist/{src/foundation → foundation}/native-host-protocol/codec.d.ts +0 -0
  197. /package/dist/{src/foundation → foundation}/native-host-protocol/codec.js +0 -0
  198. /package/dist/{src/foundation → foundation}/native-host-protocol/evidence.d.ts +0 -0
  199. /package/dist/{src/foundation → foundation}/native-host-protocol/evidence.js +0 -0
  200. /package/dist/{src/foundation → foundation}/native-host-protocol/index.d.ts +0 -0
  201. /package/dist/{src/foundation → foundation}/native-host-protocol/index.js +0 -0
  202. /package/dist/{src/foundation → foundation}/native-host-protocol/proof-gate.d.ts +0 -0
  203. /package/dist/{src/foundation → foundation}/native-host-protocol/proof-gate.js +0 -0
  204. /package/dist/{src/foundation → foundation}/process-containment/artifact.d.ts +0 -0
  205. /package/dist/{src/foundation → foundation}/process-containment/artifact.js +0 -0
  206. /package/dist/{src/foundation → foundation}/process-containment/contracts.d.ts +0 -0
  207. /package/dist/{src/foundation → foundation}/process-containment/contracts.js +0 -0
  208. /package/dist/{src/foundation → foundation}/process-containment/index.d.ts +0 -0
  209. /package/dist/{src/foundation → foundation}/process-containment/index.js +0 -0
  210. /package/dist/{src/foundation → foundation}/process-containment/linux-process-inspector.d.ts +0 -0
  211. /package/dist/{src/foundation → foundation}/process-containment/linux-process-inspector.js +0 -0
  212. /package/dist/{src/foundation → foundation}/process-containment/native-guardian-containment.d.ts +0 -0
  213. /package/dist/{src/foundation → foundation}/process-containment/native-guardian-containment.js +0 -0
  214. /package/dist/{src/foundation → foundation}/process-containment/windows-process-inspector.d.ts +0 -0
  215. /package/dist/{src/foundation → foundation}/process-containment/windows-process-inspector.js +0 -0
  216. /package/dist/{src/foundation → foundation}/protocol/client.d.ts +0 -0
  217. /package/dist/{src/foundation → foundation}/protocol/client.js +0 -0
  218. /package/dist/{src/foundation → foundation}/protocol/index.d.ts +0 -0
  219. /package/dist/{src/foundation → foundation}/protocol/index.js +0 -0
  220. /package/dist/{src/foundation → foundation}/protocol/messages.d.ts +0 -0
  221. /package/dist/{src/foundation → foundation}/protocol/messages.js +0 -0
  222. /package/dist/{src/foundation → foundation}/release/bootstrap.d.ts +0 -0
  223. /package/dist/{src/foundation → foundation}/release/cohort-selection.d.ts +0 -0
  224. /package/dist/{src/foundation → foundation}/release/cohort-selection.js +0 -0
  225. /package/dist/{src/foundation → foundation}/release/cohort-state.d.ts +0 -0
  226. /package/dist/{src/foundation → foundation}/release/cohort-state.js +0 -0
  227. /package/dist/{src/foundation → foundation}/release/concurrency.d.ts +0 -0
  228. /package/dist/{src/foundation → foundation}/release/concurrency.js +0 -0
  229. /package/dist/{src/foundation → foundation}/release/process-cleanup.d.ts +0 -0
  230. /package/dist/{src/foundation → foundation}/release/process-cleanup.js +0 -0
  231. /package/dist/{src/foundation → foundation}/release/release-store.d.ts +0 -0
  232. /package/dist/{src/foundation → foundation}/release/release-store.js +0 -0
  233. /package/dist/{src/foundation → foundation}/release/release.d.ts +0 -0
  234. /package/dist/{src/foundation → foundation}/release/release.js +0 -0
  235. /package/dist/{src/foundation → foundation}/release/stable-release.d.ts +0 -0
  236. /package/dist/{src/foundation → foundation}/release/stable-release.js +0 -0
  237. /package/dist/{src/foundation → foundation}/release/update-transaction.d.ts +0 -0
  238. /package/dist/{src/foundation → foundation}/release/update-transaction.js +0 -0
  239. /package/dist/{src/foundation → foundation}/storage/index.d.ts +0 -0
  240. /package/dist/{src/foundation → foundation}/storage/index.js +0 -0
  241. /package/dist/{src/foundation → foundation}/structured-agent-runtime/index.d.ts +0 -0
  242. /package/dist/{src/foundation → foundation}/structured-agent-runtime/index.js +0 -0
  243. /package/dist/{src/foundation → foundation}/supervision/main.d.ts +0 -0
  244. /package/dist/{src/foundation/pi-component-adapter → integrations/pi/components}/components.js +0 -0
  245. /package/dist/{src/foundation/pi-component-adapter → integrations/pi/components}/conformance.d.ts +0 -0
  246. /package/dist/{src/foundation/pi-component-adapter → integrations/pi/components}/index.d.ts +0 -0
  247. /package/dist/{src/foundation/pi-component-adapter → integrations/pi/components}/index.js +0 -0
  248. /package/dist/{src/foundation/pi-component-adapter → integrations/pi/components}/resources/builtin-themes.d.ts +0 -0
  249. /package/dist/{src/foundation/pi-component-adapter → integrations/pi/components}/resources/builtin-themes.js +0 -0
  250. /package/dist/{src/foundation/pi-component-adapter → integrations/pi/components}/shell-components.d.ts +0 -0
  251. /package/dist/{src/foundation/pi-component-adapter → integrations/pi/components}/shell-components.js +0 -0
  252. /package/dist/{src/foundation/pi-component-adapter → integrations/pi/components}/shell-editor-autocomplete.d.ts +0 -0
  253. /package/dist/{src/foundation/pi-component-adapter → integrations/pi/components}/shell-editor-autocomplete.js +0 -0
  254. /package/dist/{src/foundation/pi-component-adapter → integrations/pi/components}/shell-extension-ui.js +0 -0
  255. /package/dist/{src/foundation/pi-component-adapter → integrations/pi/components}/shell-footer-status.js +0 -0
  256. /package/dist/{src/foundation/pi-component-adapter → integrations/pi/components}/shell-selectors-dialogs.js +0 -0
  257. /package/dist/{src/foundation/pi-component-adapter → integrations/pi/components}/shell-shared-facade.js +0 -0
  258. /package/dist/{src/foundation/pi-component-adapter → integrations/pi/components}/theme.d.ts +0 -0
  259. /package/dist/{src/foundation/pi-component-adapter → integrations/pi/components}/theme.js +0 -0
  260. /package/dist/{src/foundation/pi-component-adapter → integrations/pi/components}/upstream/adjacent/core/keybindings.d.ts +0 -0
  261. /package/dist/{src/foundation/pi-component-adapter → integrations/pi/components}/upstream/adjacent/core/keybindings.js +0 -0
  262. /package/dist/{src/foundation/pi-component-adapter → integrations/pi/components}/upstream/components/countdown-timer.d.ts +0 -0
  263. /package/dist/{src/foundation/pi-component-adapter → integrations/pi/components}/upstream/components/countdown-timer.js +0 -0
  264. /package/dist/{src/foundation/pi-component-adapter → integrations/pi/components}/upstream/components/custom-entry.d.ts +0 -0
  265. /package/dist/{src/foundation/pi-component-adapter → integrations/pi/components}/upstream/components/custom-entry.js +0 -0
  266. /package/dist/{src/foundation/pi-component-adapter → integrations/pi/components}/upstream/components/daxnuts.d.ts +0 -0
  267. /package/dist/{src/foundation/pi-component-adapter → integrations/pi/components}/upstream/components/daxnuts.js +0 -0
  268. /package/dist/{src/foundation/pi-component-adapter → integrations/pi/components}/upstream/components/earendil-announcement.d.ts +0 -0
  269. /package/dist/{src/foundation/pi-component-adapter → integrations/pi/components}/upstream/components/earendil-announcement.js +0 -0
  270. /package/dist/{src/foundation/pi-component-adapter → integrations/pi/components}/upstream/components/extension-editor.d.ts +0 -0
  271. /package/dist/{src/foundation/pi-component-adapter → integrations/pi/components}/upstream/components/extension-editor.js +0 -0
  272. /package/dist/{src/foundation/pi-component-adapter → integrations/pi/components}/upstream/components/first-time-setup.d.ts +0 -0
  273. /package/dist/{src/foundation/pi-component-adapter → integrations/pi/components}/upstream/components/first-time-setup.js +0 -0
  274. /package/dist/{src/foundation/pi-component-adapter → integrations/pi/components}/upstream/components/markdown-transform.d.ts +0 -0
  275. /package/dist/{src/foundation/pi-component-adapter → integrations/pi/components}/upstream/components/markdown-transform.js +0 -0
  276. /package/dist/{src/foundation/pi-component-adapter → integrations/pi/components}/upstream/components/mermaid.d.ts +0 -0
  277. /package/dist/{src/foundation/pi-component-adapter → integrations/pi/components}/upstream/components/mermaid.js +0 -0
  278. /package/dist/{src/foundation/pi-component-adapter → integrations/pi/components}/upstream/components/owned-editor.d.ts +0 -0
  279. /package/dist/{src/foundation/pi-component-adapter → integrations/pi/components}/upstream/components/owned-editor.js +0 -0
  280. /package/dist/{src/foundation/pi-component-adapter → integrations/pi/components}/upstream/components/scoped-models-selector.d.ts +0 -0
  281. /package/dist/{src/foundation/pi-component-adapter → integrations/pi/components}/upstream/components/scoped-models-selector.js +0 -0
  282. /package/dist/{src/foundation/pi-component-adapter → integrations/pi/components}/upstream/components/session-footer.js +0 -0
  283. /package/dist/{src/foundation/pi-component-adapter → integrations/pi/components}/upstream/components/session-selector-search.d.ts +0 -0
  284. /package/dist/{src/foundation/pi-component-adapter → integrations/pi/components}/upstream/components/session-selector-search.js +0 -0
  285. /package/dist/{src/foundation/pi-component-adapter → integrations/pi/components}/upstream/components/session-selector.d.ts +0 -0
  286. /package/dist/{src/foundation/pi-component-adapter → integrations/pi/components}/upstream/components/session-selector.js +0 -0
  287. /package/dist/{src/foundation/pi-component-adapter → integrations/pi/components}/upstream/components/skill-invocation-message.d.ts +0 -0
  288. /package/dist/{src/foundation/pi-component-adapter → integrations/pi/components}/upstream/components/skill-invocation-message.js +0 -0
  289. /package/dist/{src/foundation/pi-component-adapter → integrations/pi/components}/upstream/components/status-indicator.d.ts +0 -0
  290. /package/dist/{src/foundation/pi-component-adapter → integrations/pi/components}/upstream/components/status-indicator.js +0 -0
  291. /package/dist/{src/foundation/pi-component-adapter → integrations/pi/components}/upstream/components/tree-selector.d.ts +0 -0
  292. /package/dist/{src/foundation/pi-component-adapter → integrations/pi/components}/upstream/components/tree-selector.js +0 -0
  293. /package/dist/{src/foundation/pi-component-adapter → integrations/pi/components}/upstream/components/trust-selector.d.ts +0 -0
  294. /package/dist/{src/foundation/pi-component-adapter → integrations/pi/components}/upstream/components/trust-selector.js +0 -0
  295. /package/dist/{src/foundation/pi-component-adapter → integrations/pi/components}/upstream/external-editor.d.ts +0 -0
  296. /package/dist/{src/foundation/pi-component-adapter → integrations/pi/components}/upstream/external-editor.js +0 -0
  297. /package/dist/{src/foundation/pi-component-adapter → integrations/pi/components}/upstream/model-search.d.ts +0 -0
  298. /package/dist/{src/foundation/pi-component-adapter → integrations/pi/components}/upstream/model-search.js +0 -0
  299. /package/dist/{src/foundation/pi-component-adapter → integrations/pi/components}/upstream/theme/theme-controller.d.ts +0 -0
  300. /package/dist/{src/foundation/pi-component-adapter → integrations/pi/components}/upstream/theme/theme-controller.js +0 -0
  301. /package/dist/{src/foundation/pi-component-adapter → integrations/pi/components}/upstream/theme/theme.d.ts +0 -0
  302. /package/dist/{src/foundation/pi-component-adapter → integrations/pi/components}/upstream/theme/theme.js +0 -0
  303. /package/dist/{src/foundation/pi-engine-adapter → integrations/pi/engine}/conformance.d.ts +0 -0
  304. /package/dist/{src/foundation/pi-engine-adapter → integrations/pi/engine}/index.d.ts +0 -0
  305. /package/dist/{src/foundation/pi-engine-adapter → integrations/pi/engine}/index.js +0 -0
  306. /package/dist/{src/foundation/pi-engine-adapter → integrations/pi/engine}/model-auth-integration.js +0 -0
  307. /package/dist/{src/foundation/pi-engine-adapter → integrations/pi/engine}/pi-settings-metadata.json +0 -0
  308. /package/dist/{src/foundation/pi-engine-adapter → integrations/pi/engine}/public-main-entry.d.ts +0 -0
  309. /package/dist/{src/foundation/pi-engine-adapter → integrations/pi/engine}/public-main-entry.js +0 -0
  310. /package/dist/{src/foundation/pi-engine-adapter → integrations/pi/engine}/resource-extension-integration.js +0 -0
  311. /package/dist/{src/foundation/pi-engine-adapter → integrations/pi/engine}/runtime-integration.d.ts +0 -0
  312. /package/dist/{src/foundation/pi-engine-adapter → integrations/pi/engine}/runtime-integration.js +0 -0
  313. /package/dist/{src/foundation/pi-engine-adapter → integrations/pi/engine}/settings-integration.js +0 -0
  314. /package/dist/{src/foundation/pi-engine-adapter → integrations/pi/engine}/workflow-controllers.js +0 -0
  315. /package/dist/{src/foundation/pi-engine-adapter → integrations/pi/engine}/workflows.d.ts +0 -0
  316. /package/dist/{src/foundation/pi-engine-adapter → integrations/pi/engine}/workflows.js +0 -0
  317. /package/dist/{src/foundation/pi-owned-ui-integration → integrations/pi/owned-ui}/index.d.ts +0 -0
  318. /package/dist/{src/foundation/pi-owned-ui-integration → integrations/pi/owned-ui}/index.js +0 -0
  319. /package/dist/{src/foundation/pi-owned-ui-integration → integrations/pi/owned-ui}/route-host.js +0 -0
  320. /package/dist/{src/foundation/pi-tui-runtime-adapter → integrations/pi/tui-runtime}/adapter.d.ts +0 -0
  321. /package/dist/{src/foundation/pi-tui-runtime-adapter → integrations/pi/tui-runtime}/adapter.js +0 -0
  322. /package/dist/{src/foundation/pi-tui-runtime-adapter → integrations/pi/tui-runtime}/conformance.d.ts +0 -0
  323. /package/dist/{src/foundation/pi-tui-runtime-adapter → integrations/pi/tui-runtime}/conformance.js +0 -0
  324. /package/dist/{src/foundation/pi-tui-runtime-adapter → integrations/pi/tui-runtime}/contracts.d.ts +0 -0
  325. /package/dist/{src/foundation/pi-tui-runtime-adapter → integrations/pi/tui-runtime}/contracts.js +0 -0
  326. /package/dist/{src/foundation/pi-tui-runtime-adapter → integrations/pi/tui-runtime}/index.d.ts +0 -0
  327. /package/dist/{src/foundation/pi-tui-runtime-adapter → integrations/pi/tui-runtime}/index.js +0 -0
  328. /package/dist/{src/foundation/pi-tui-runtime-adapter → integrations/pi/tui-runtime}/presentation-adapter.js +0 -0
  329. /package/dist/{src/product-identity.d.ts → product-identity.d.ts} +0 -0
  330. /package/dist/{src/product-identity.js → product-identity.js} +0 -0
  331. /package/dist/{src/product-identity.json → product-identity.json} +0 -0
  332. /package/dist/{src/foundation/ui-apps → ui/apps}/contracts.js +0 -0
  333. /package/dist/{src/foundation/ui-apps → ui/apps}/index.d.ts +0 -0
  334. /package/dist/{src/foundation/ui-apps → ui/apps}/index.js +0 -0
  335. /package/dist/{src/foundation/ui-apps → ui/apps}/registry.d.ts +0 -0
  336. /package/dist/{src/foundation/ui-apps → ui/apps}/registry.js +0 -0
  337. /package/dist/{src/foundation/ui-components → ui/components}/dialog-panel.d.ts +0 -0
  338. /package/dist/{src/foundation/ui-components → ui/components}/dialog-panel.js +0 -0
  339. /package/dist/{src/foundation/ui-components → ui/components}/frame.d.ts +0 -0
  340. /package/dist/{src/foundation/ui-components → ui/components}/frame.js +0 -0
  341. /package/dist/{src/foundation/ui-components → ui/components}/index.d.ts +0 -0
  342. /package/dist/{src/foundation/ui-components → ui/components}/index.js +0 -0
  343. /package/dist/{src/foundation/ui-components → ui/components}/label.d.ts +0 -0
  344. /package/dist/{src/foundation/ui-components → ui/components}/label.js +0 -0
  345. /package/dist/{src/foundation/ui-components → ui/components}/line-input.d.ts +0 -0
  346. /package/dist/{src/foundation/ui-components → ui/components}/line-input.js +0 -0
  347. /package/dist/{src/foundation/ui-components → ui/components}/list-block.d.ts +0 -0
  348. /package/dist/{src/foundation/ui-components → ui/components}/list-block.js +0 -0
  349. /package/dist/{src/foundation/ui-components → ui/components}/list-view.d.ts +0 -0
  350. /package/dist/{src/foundation/ui-components → ui/components}/list-view.js +0 -0
  351. /package/dist/{src/foundation/ui-components → ui/components}/mouse.d.ts +0 -0
  352. /package/dist/{src/foundation/ui-components → ui/components}/mouse.js +0 -0
  353. /package/dist/{src/foundation/ui-components → ui/components}/pane.d.ts +0 -0
  354. /package/dist/{src/foundation/ui-components → ui/components}/pane.js +0 -0
  355. /package/dist/{src/foundation/ui-components → ui/components}/revision.d.ts +0 -0
  356. /package/dist/{src/foundation/ui-components → ui/components}/revision.js +0 -0
  357. /package/dist/{src/foundation/ui-components → ui/components}/scrollbar.d.ts +0 -0
  358. /package/dist/{src/foundation/ui-components → ui/components}/scrollbar.js +0 -0
  359. /package/dist/{src/foundation/ui-components → ui/components}/shortcuts.d.ts +0 -0
  360. /package/dist/{src/foundation/ui-components → ui/components}/shortcuts.js +0 -0
  361. /package/dist/{src/foundation/ui-components → ui/components}/spans.d.ts +0 -0
  362. /package/dist/{src/foundation/ui-components → ui/components}/spans.js +0 -0
  363. /package/dist/{src/foundation/ui-components → ui/components}/status-line.d.ts +0 -0
  364. /package/dist/{src/foundation/ui-components → ui/components}/status-line.js +0 -0
  365. /package/dist/{src/foundation/ui-components → ui/components}/stepper.d.ts +0 -0
  366. /package/dist/{src/foundation/ui-components → ui/components}/stepper.js +0 -0
  367. /package/dist/{src/foundation/ui-components → ui/components}/surface.d.ts +0 -0
  368. /package/dist/{src/foundation/ui-components → ui/components}/surface.js +0 -0
  369. /package/dist/{src/foundation/ui-components → ui/components}/text.d.ts +0 -0
  370. /package/dist/{src/foundation/ui-components → ui/components}/text.js +0 -0
  371. /package/dist/{src/foundation/ui-components → ui/components}/theme.d.ts +0 -0
  372. /package/dist/{src/foundation/ui-components → ui/components}/theme.js +0 -0
  373. /package/dist/{src/foundation/ui-components → ui/components}/value-menu.d.ts +0 -0
  374. /package/dist/{src/foundation/ui-components → ui/components}/value-menu.js +0 -0
  375. /package/dist/{src/foundation/owned-ui-settings → ui/settings}/declarations.d.ts +0 -0
  376. /package/dist/{src/foundation/owned-ui-settings → ui/settings}/declarations.js +0 -0
  377. /package/dist/{src/foundation/owned-ui-settings → ui/settings}/index.d.ts +0 -0
  378. /package/dist/{src/foundation/owned-ui-settings → ui/settings}/index.js +0 -0
  379. /package/dist/{src/foundation/owned-ui-settings → ui/settings}/migrations.d.ts +0 -0
  380. /package/dist/{src/foundation/owned-ui-settings → ui/settings}/migrations.js +0 -0
  381. /package/dist/{src/foundation/owned-ui-settings → ui/settings}/resolution.d.ts +0 -0
  382. /package/dist/{src/foundation/owned-ui-settings → ui/settings}/resolution.js +0 -0
  383. /package/dist/{src/foundation/owned-ui-settings → ui/settings}/sections.d.ts +0 -0
  384. /package/dist/{src/foundation/owned-ui-settings → ui/settings}/sections.js +0 -0
  385. /package/dist/{src/foundation/owned-ui-settings → ui/settings}/session.js +0 -0
  386. /package/dist/{src/foundation/owned-ui-settings → ui/settings}/store.d.ts +0 -0
  387. /package/dist/{src/foundation/owned-ui-settings → ui/settings}/store.js +0 -0
@@ -1,704 +1,9 @@
1
- import { MOUSE_TRACKING_OFF, MOUSE_TRACKING_ON, parseMouseInput } from "../ui-components/index.js";
2
- import { PINNED_PI_HIDDEN_COMMAND_NAMES, PINNED_PI_WORKFLOW_COMMAND_NAMES, } from "../pi-engine-adapter/index.js";
3
- import { createPiExtensionUiBridge, createPiQueuedInputStatus, createPiShellArmin, createPiShellAuthProviderSelector, createPiShellChangelog, createPiShellDaxnuts, createPiShellDialog, createPiShellEarendilAnnouncement, createPiShellEditor, createPiShellExtensionSelector, createPiShellFooter, createPiShellHeader, createPiShellHotkeys, createPiShellLoadedResources, createPiShellLoginDialog, createPiShellModelSelector, createPiShellOperationLoader, createPiShellReloadBox, createPiShellScopedModelsSelector, createPiShellSelector, createPiShellSessionInfo, createPiShellSessionSelector, createPiShellSettingsSelector, createPiShellStatus, createPiShellTranscriptComponent, createPiShellTreeSelector, createPiShellTrustSelector, createPiShellUserMessageSelector, onPiThemeChange, piTheme, renderPiShellPackageUpdateNotice, renderPiShellStartupDiagnostic, renderPiShellStatusText, renderPiShellTranscriptBlock, } from "../pi-component-adapter/index.js";
4
- import { PiTuiRuntimeAdapter, } from "../pi-tui-runtime-adapter/index.js";
5
- export class OwnedUiSessionShellRoot {
6
- editor;
7
- header;
8
- resources;
9
- #cwd;
10
- #transcript = new Map();
11
- #blocksById = new Map();
12
- #renderedRows = new Map();
13
- #themeUnsubscribe;
14
- #transcriptOrder = [];
15
- #view;
16
- #status;
17
- #footer;
18
- #queued;
19
- #extensionRenderers;
20
- #componentRuntime;
21
- #toolsExpanded = false;
22
- #thinkingVisible = true;
23
- #workflowTranscriptSequence = 0;
24
- #workflowStatusAnchors = new Map();
25
- #workflowStatusMessages = new Map();
26
- #lastWorkflowStatusId;
27
- #inputSurface;
28
- #extensionHeader = null;
29
- #extensionFooter = null;
30
- #extensionWidgets = new Map();
31
- #extensionStatuses = new Map();
32
- #extensionWorkingMessage;
33
- #extensionWorkingVisible = true;
34
- constructor(view, cwd, handlers, startup = {}, agentDir, extensionRenderers = {
35
- getMessageRenderer: () => undefined,
36
- getToolDefinition: () => undefined,
37
- }) {
38
- this.#view = view;
39
- this.#cwd = cwd;
40
- this.#extensionRenderers = extensionRenderers;
41
- this.#componentRuntime = handlers;
42
- this.header = createPiShellHeader(startup);
43
- this.resources = createPiShellLoadedResources(startup.resources ?? [], startup.expanded ?? false);
44
- this.#status = createPiShellStatus(view, handlers);
45
- this.#footer = createPiShellFooter(this.#viewWithExtensionStatuses(view), cwd);
46
- this.#queued = createPiQueuedInputStatus(view.editor.queuedSubmissions);
47
- this.editor = createPiShellEditor({
48
- ...handlers,
49
- cwd,
50
- ...(agentDir === undefined ? {} : { agentDir }),
51
- onToolsExpand: () => this.#setToolsExpanded(!this.#toolsExpanded),
52
- });
53
- this.editor.setThinkingLevel(view.thinkingLevel);
54
- this.#inputSurface = this.editor;
55
- for (const block of view.transcript) {
56
- if (block.kind === "user")
57
- this.editor.addToHistory(block.text);
58
- }
59
- this.#syncTranscript(view.transcript);
60
- // Colours come from the active theme, so rendered rows outlive their revision only
61
- // until the theme under them changes.
62
- this.#themeUnsubscribe = onPiThemeChange(() => this.#renderedRows.clear());
63
- }
64
- update(view) {
65
- this.#view = view;
66
- this.#status.update(view);
67
- this.#footer.update(this.#viewWithExtensionStatuses(view));
68
- this.#queued.update(view.editor.queuedSubmissions);
69
- this.#syncTranscript(view.transcript);
70
- this.editor.setSubmitEnabled(view.lifecycle !== "stopping" && view.lifecycle !== "stopped" && view.lifecycle !== "failed");
71
- this.editor.setThinkingLevel(view.thinkingLevel);
72
- this.invalidate();
73
- }
74
- render(width) {
75
- const queued = this.#view.editor.queuedSubmissions.length === 0 ? [] : this.#queued.render(width);
76
- return [
77
- ...this.#renderDocument(width),
78
- ...queued,
79
- ...this.#renderStatus(width),
80
- ...this.#renderWidgets("aboveEditor", width),
81
- ...this.#inputSurface.render(width),
82
- ...this.#renderWidgets("belowEditor", width),
83
- ...this.#renderFooter(width),
84
- ];
85
- }
86
- layoutRoot() {
87
- const document = layoutPort(width => this.#renderDocument(width), () => this.invalidate());
88
- const queued = layoutPort(width => this.#view.editor.queuedSubmissions.length === 0 ? [] : this.#queued.render(width), () => this.#queued.invalidate());
89
- const aboveWidgets = layoutPort(width => this.#renderWidgets("aboveEditor", width), () => this.#invalidateExtensions());
90
- const status = layoutPort(width => this.#renderStatus(width), () => this.#status.invalidate());
91
- const editor = layoutPort(width => this.#inputSurface.render(width), () => this.#inputSurface.invalidate(), data => this.#inputSurface.handleInput?.(data));
92
- const belowWidgets = layoutPort(width => this.#renderWidgets("belowEditor", width), () => this.#invalidateExtensions());
93
- const footer = layoutPort(width => this.#renderFooter(width), () => (this.#extensionFooter ?? this.#footer).invalidate());
94
- return {
95
- type: "stack",
96
- direction: "vertical",
97
- children: [
98
- {
99
- basis: 0,
100
- grow: 1,
101
- shrink: 1,
102
- minSize: 1,
103
- node: {
104
- type: "scroll",
105
- id: "transcript",
106
- follow: "end",
107
- primary: true,
108
- overscroll: "chain",
109
- scrollbar: "auto",
110
- scrollbarStyle: text => piTheme().bg("scrollbarThumb", text),
111
- child: { type: "component", component: document },
112
- },
113
- },
114
- {
115
- basis: "auto",
116
- grow: 0,
117
- shrink: 1,
118
- minSize: 1,
119
- node: {
120
- type: "stack",
121
- direction: "vertical",
122
- children: [
123
- { shrink: 1, minSize: 0, node: { type: "component", component: queued } },
124
- { shrink: 1, minSize: 0, node: { type: "component", component: status } },
125
- { shrink: 1, minSize: 0, node: { type: "component", component: aboveWidgets } },
126
- { shrink: 1, minSize: 3, node: { type: "component", component: editor } },
127
- { shrink: 1, minSize: 0, node: { type: "component", component: belowWidgets } },
128
- { shrink: 1, minSize: 1, node: { type: "component", component: footer } },
129
- ],
130
- },
131
- },
132
- ],
133
- };
134
- }
135
- #renderDocument(width) {
136
- const transcript = this.#transcriptOrder.flatMap((id, index) => {
137
- const block = this.#blocksById.get(id);
138
- if (!this.#thinkingVisible && block?.kind === "thinking")
139
- return [];
140
- const rows = this.#blockRows(id, block, width);
141
- if (index > 0 && block?.kind === "user")
142
- return ["", ...rows];
143
- return rows;
144
- });
145
- const diagnostics = this.#view.diagnostics;
146
- const startupRows = diagnostics
147
- .filter(diagnostic => diagnostic.code === "engine-startup")
148
- .flatMap(diagnostic => renderPiShellStartupDiagnostic(diagnostic, width));
149
- const packageUpdateRows = diagnostics
150
- .filter(diagnostic => diagnostic.code === "package-updates")
151
- .flatMap(diagnostic => renderPiShellPackageUpdateNotice(diagnostic.message.split("\n").filter(line => line.startsWith("- ")).map(line => line.slice(2)), width));
152
- const diagnosticRows = diagnostics
153
- .filter(diagnostic => diagnostic.code !== "engine-startup" && diagnostic.code !== "package-updates")
154
- .slice(-3)
155
- .flatMap(diagnostic => renderPiShellTranscriptBlock({
156
- id: `diagnostic-${diagnostic.sequence}`,
157
- kind: diagnostic.severity === "error" ? "error" : "system",
158
- status: "finalized",
159
- revision: diagnostic.sequence,
160
- title: diagnostic.code,
161
- text: diagnostic.message,
162
- payload: {},
163
- }, width, this.#cwd));
164
- const resourceRows = [...this.resources.render(width)];
165
- if (resourceRows.at(-1) === "")
166
- resourceRows.pop();
167
- return [
168
- ...startupRows,
169
- ...(this.#extensionHeader ?? this.header).render(width),
170
- ...resourceRows,
171
- ...transcript,
172
- ...packageUpdateRows,
173
- ...diagnosticRows,
174
- ];
175
- }
176
- /**
177
- * Rows for one transcript block. A finalized block renders once for a given revision
178
- * and width and is reused after that, so a frame costs what changed rather than what
179
- * the session has accumulated. A live block, and anything the shell drives itself, is
180
- * rendered every time because its content is still moving.
181
- */
182
- #blockRows(id, block, width) {
183
- const component = this.#transcript.get(id);
184
- if (component === undefined)
185
- return [];
186
- if (block === undefined || block.status !== "finalized")
187
- return component.render(width);
188
- const cached = this.#renderedRows.get(id);
189
- if (cached && cached.width === width && cached.revision === block.revision)
190
- return cached.rows;
191
- const rows = component.render(width);
192
- this.#renderedRows.set(id, { width, revision: block.revision, rows });
193
- return rows;
194
- }
195
- transcriptComponent(id) {
196
- return this.#transcript.get(id);
197
- }
198
- appendWorkflowStatus(message) {
199
- const previousId = this.#lastWorkflowStatusId;
200
- if (previousId !== undefined
201
- && this.#transcriptOrder.at(-1) === previousId
202
- && this.#workflowStatusAnchors.get(previousId) === this.#view.transcript.length) {
203
- this.#workflowStatusMessages.set(previousId, message);
204
- this.invalidate();
205
- return;
206
- }
207
- const id = this.#appendAnchoredWorkflowComponent(width => [
208
- "",
209
- ...renderPiShellStatusText(this.#workflowStatusMessages.get(id) ?? message, width),
210
- ]);
211
- this.#workflowStatusMessages.set(id, message);
212
- this.#lastWorkflowStatusId = id;
213
- }
214
- appendWorkflowResult(result) {
215
- if (result.command === "reload" && result.outcome === "completed") {
216
- this.appendWorkflowStatus(result.message);
217
- return;
218
- }
219
- if (result.command === "session" && result.outcome === "completed" && result.presentation?.kind === "session-info") {
220
- this.#lastWorkflowStatusId = undefined;
221
- const sessionInfo = createPiShellSessionInfo(result.presentation);
222
- this.#appendAnchoredWorkflowComponent(width => sessionInfo.render(width), () => sessionInfo.dispose?.());
223
- return;
224
- }
225
- if (result.command === "hotkeys" && result.outcome === "completed") {
226
- this.#lastWorkflowStatusId = undefined;
227
- const hotkeys = createPiShellHotkeys();
228
- this.#appendAnchoredWorkflowComponent(width => hotkeys.render(width), () => hotkeys.dispose?.());
229
- return;
230
- }
231
- if (result.command === "changelog" && result.outcome === "completed") {
232
- this.#lastWorkflowStatusId = undefined;
233
- const changelog = createPiShellChangelog(result.detail ?? "No changelog entries found.");
234
- this.#appendAnchoredWorkflowComponent(width => changelog.render(width), () => changelog.dispose?.());
235
- return;
236
- }
237
- if (result.outcome === "failed") {
238
- this.#lastWorkflowStatusId = undefined;
239
- const warning = (result.command === "name" && result.message.startsWith("Usage:"))
240
- || (result.command === "reload" && result.message.startsWith("Wait for "));
241
- const prefix = warning ? "Warning" : "Error";
242
- const color = warning ? "warning" : "error";
243
- this.#appendAnchoredWorkflowComponent(() => ["", ` ${piTheme().fg(color, `${prefix}: ${result.message}`)}`]);
244
- return;
245
- }
246
- if (result.outcome === "completed" && (result.command === "quit" || result.command === "compact"))
247
- return;
248
- if (result.command === "new" && result.outcome === "completed") {
249
- this.#lastWorkflowStatusId = undefined;
250
- this.#appendAnchoredWorkflowComponent(() => ["", ` ${piTheme().fg("accent", result.message)}`]);
251
- return;
252
- }
253
- if (result.command === "name" && result.outcome === "completed") {
254
- this.#lastWorkflowStatusId = undefined;
255
- this.#appendAnchoredWorkflowComponent(() => [
256
- ...(result.detail ? ["", ` ${piTheme().fg("warning", `Warning: ${result.detail}`)}`] : []),
257
- "",
258
- ` ${piTheme().fg("dim", result.message)}`,
259
- ]);
260
- return;
261
- }
262
- if (result.command === "debug" && result.outcome === "completed") {
263
- this.#lastWorkflowStatusId = undefined;
264
- this.#appendAnchoredWorkflowComponent(() => [
265
- "",
266
- ` ${piTheme().fg("accent", result.message)}`,
267
- ...(result.detail ? [` ${piTheme().fg("muted", result.detail)}`] : []),
268
- ]);
269
- return;
270
- }
271
- if (result.command === "arminsayshi" && result.outcome === "completed") {
272
- this.#lastWorkflowStatusId = undefined;
273
- const armin = createPiShellArmin(this.#componentRuntime);
274
- this.#appendAnchoredWorkflowComponent(width => ["", ...armin.render(width)], () => armin.dispose?.());
275
- return;
276
- }
277
- if (result.command === "dementedelves" && result.outcome === "completed") {
278
- this.#lastWorkflowStatusId = undefined;
279
- const announcement = createPiShellEarendilAnnouncement();
280
- this.#appendAnchoredWorkflowComponent(width => ["", ...announcement.render(width)], () => announcement.dispose?.());
281
- return;
282
- }
283
- const message = result.command === "share" && result.detail
284
- ? `${result.message}\nGist: ${result.detail}`
285
- : result.message;
286
- this.appendWorkflowStatus(message);
287
- }
288
- appendDaxnuts() {
289
- this.#lastWorkflowStatusId = undefined;
290
- const daxnuts = createPiShellDaxnuts(this.#componentRuntime);
291
- this.#appendAnchoredWorkflowComponent(width => ["", ...daxnuts.render(width)], () => daxnuts.dispose?.());
292
- }
293
- toggleThinkingVisibility() {
294
- this.#thinkingVisible = !this.#thinkingVisible;
295
- this.invalidate();
296
- }
297
- get toolsExpanded() {
298
- return this.#toolsExpanded;
299
- }
300
- setToolsExpanded(expanded) {
301
- this.#setToolsExpanded(expanded);
302
- }
303
- setExtensionWidget(key, component, placement) {
304
- const previous = this.#extensionWidgets.get(key)?.component;
305
- if (component === null)
306
- this.#extensionWidgets.delete(key);
307
- else
308
- this.#extensionWidgets.set(key, { component, placement });
309
- if (previous !== undefined && previous !== component)
310
- previous.dispose?.();
311
- this.invalidate();
312
- }
313
- setExtensionHeader(component) {
314
- if (this.#extensionHeader !== component)
315
- this.#extensionHeader?.dispose?.();
316
- this.#extensionHeader = component;
317
- this.invalidate();
318
- }
319
- setExtensionFooter(component) {
320
- if (this.#extensionFooter !== component)
321
- this.#extensionFooter?.dispose?.();
322
- this.#extensionFooter = component;
323
- this.invalidate();
324
- }
325
- setExtensionStatus(key, text) {
326
- if (text === undefined)
327
- this.#extensionStatuses.delete(key);
328
- else
329
- this.#extensionStatuses.set(key, text);
330
- this.#footer.update(this.#viewWithExtensionStatuses(this.#view));
331
- this.invalidate();
332
- }
333
- setExtensionWorking(message, visible = this.#extensionWorkingVisible) {
334
- this.#extensionWorkingMessage = message;
335
- this.#extensionWorkingVisible = visible;
336
- this.#status.setWorkingOverride(visible ? message : undefined);
337
- this.invalidate();
338
- }
339
- resetWorkflowPresentation() {
340
- for (const id of this.#workflowStatusAnchors.keys()) {
341
- this.#transcript.get(id)?.dispose?.();
342
- this.#transcript.delete(id);
343
- }
344
- this.#workflowStatusAnchors.clear();
345
- this.#workflowStatusMessages.clear();
346
- this.#transcriptOrder = this.#transcriptOrder.filter(id => !id.startsWith("workflow-status-"));
347
- this.#lastWorkflowStatusId = undefined;
348
- this.invalidate();
349
- }
350
- resetExtensionUi() {
351
- this.#extensionHeader?.dispose?.();
352
- this.#extensionFooter?.dispose?.();
353
- for (const { component } of this.#extensionWidgets.values())
354
- component.dispose?.();
355
- this.#extensionHeader = null;
356
- this.#extensionFooter = null;
357
- this.#extensionWidgets.clear();
358
- this.#extensionStatuses.clear();
359
- this.#extensionWorkingMessage = undefined;
360
- this.#status.setWorkingOverride(undefined);
361
- this.#footer.update(this.#viewWithExtensionStatuses(this.#view));
362
- // An extension renderer may have drawn transcript blocks that are now unrendered by it.
363
- this.#renderedRows.clear();
364
- this.invalidate();
365
- }
366
- addExtensionNotification(message, type) {
367
- if (type === "info") {
368
- this.appendWorkflowStatus(message);
369
- return;
370
- }
371
- this.#lastWorkflowStatusId = undefined;
372
- const prefix = type === "warning" ? "Warning" : "Error";
373
- this.#appendAnchoredWorkflowComponent(() => ["", ` ${piTheme().fg(type, `${prefix}: ${message}`)}`]);
374
- }
375
- extensionFooterData() {
376
- return {
377
- getGitBranch: () => this.#view.status.footer?.branch ?? null,
378
- getExtensionStatuses: () => new Map(this.#extensionStatuses),
379
- getAvailableProviderCount: () => this.#view.status.footer?.availableProviderCount ?? 1,
380
- onBranchChange: () => () => { },
381
- };
382
- }
383
- setInputSurface(component, disposePrevious = true) {
384
- const next = component ?? this.editor;
385
- if (next === this.#inputSurface)
386
- return;
387
- this.#inputSurface.setFocused?.(false);
388
- if (disposePrevious && this.#inputSurface !== this.editor)
389
- this.#inputSurface.dispose?.();
390
- this.#inputSurface = next;
391
- this.#inputSurface.setFocused?.(true);
392
- this.invalidate();
393
- }
394
- handleInput(data) {
395
- this.#inputSurface.handleInput?.(data);
396
- }
397
- invalidate() {
398
- this.header.invalidate();
399
- this.resources.invalidate();
400
- for (const component of this.#transcript.values())
401
- component.invalidate();
402
- this.editor.invalidate();
403
- if (this.#inputSurface !== this.editor)
404
- this.#inputSurface.invalidate();
405
- this.#invalidateExtensions();
406
- this.#status.invalidate();
407
- this.#footer.invalidate();
408
- this.#queued.invalidate();
409
- }
410
- setFocused(focused) {
411
- this.#inputSurface.setFocused?.(focused);
412
- }
413
- dispose() {
414
- this.#themeUnsubscribe();
415
- this.header.dispose?.();
416
- this.resources.dispose?.();
417
- for (const component of this.#transcript.values())
418
- component.dispose?.();
419
- this.#transcript.clear();
420
- this.#renderedRows.clear();
421
- if (this.#inputSurface !== this.editor)
422
- this.#inputSurface.dispose?.();
423
- this.#extensionHeader?.dispose?.();
424
- this.#extensionFooter?.dispose?.();
425
- for (const { component } of this.#extensionWidgets.values())
426
- component.dispose?.();
427
- this.#extensionWidgets.clear();
428
- this.editor.dispose?.();
429
- this.#status.dispose?.();
430
- this.#footer.dispose?.();
431
- this.#queued.dispose?.();
432
- }
433
- #syncTranscript(blocks) {
434
- this.#blocksById.clear();
435
- for (const block of blocks)
436
- this.#blocksById.set(block.id, block);
437
- const nextIds = new Set(blocks.map(block => block.id));
438
- for (const [id, component] of this.#transcript) {
439
- if (id.startsWith("workflow-status-") || nextIds.has(id))
440
- continue;
441
- component.dispose?.();
442
- this.#transcript.delete(id);
443
- this.#renderedRows.delete(id);
444
- }
445
- for (const block of blocks) {
446
- const component = this.#transcript.get(block.id);
447
- if (component === undefined) {
448
- const created = createPiShellTranscriptComponent(block, this.#cwd, this.#extensionRenderers);
449
- created.setExpanded(this.#toolsExpanded);
450
- this.#transcript.set(block.id, created);
451
- }
452
- else if (component.revision !== block.revision) {
453
- component.update(block);
454
- }
455
- }
456
- const statusIds = [...this.#workflowStatusAnchors.keys()];
457
- const order = [];
458
- for (let index = 0; index <= blocks.length; index += 1) {
459
- for (const statusId of statusIds) {
460
- if (this.#workflowStatusAnchors.get(statusId) === index)
461
- order.push(statusId);
462
- }
463
- const block = blocks[index];
464
- if (block !== undefined)
465
- order.push(block.id);
466
- }
467
- const placed = new Set(order);
468
- for (const statusId of statusIds) {
469
- if (!placed.has(statusId))
470
- order.push(statusId);
471
- }
472
- this.#transcriptOrder = order;
473
- }
474
- #appendAnchoredWorkflowComponent(render, dispose) {
475
- this.#workflowTranscriptSequence += 1;
476
- const id = `workflow-status-${this.#workflowTranscriptSequence}`;
477
- const component = {
478
- id,
479
- revision: 1,
480
- render,
481
- handleInput() { },
482
- invalidate() { },
483
- update() { },
484
- setExpanded() { },
485
- ...(dispose === undefined ? {} : { dispose }),
486
- };
487
- this.#transcript.set(id, component);
488
- this.#workflowStatusAnchors.set(id, this.#view.transcript.length);
489
- this.#transcriptOrder.push(id);
490
- this.invalidate();
491
- return id;
492
- }
493
- #renderWidgets(placement, width) {
494
- const rows = [...this.#extensionWidgets.values()]
495
- .filter(widget => widget.placement === placement)
496
- .flatMap(widget => widget.component.render(width));
497
- return placement === "aboveEditor" ? ["", ...rows] : rows;
498
- }
499
- #renderStatus(width) {
500
- return this.#status.render(width);
501
- }
502
- #renderFooter(width) {
503
- return (this.#extensionFooter ?? this.#footer).render(width);
504
- }
505
- #viewWithExtensionStatuses(view) {
506
- const footer = view.status.footer;
507
- const statuses = new Map(footer?.extensionStatuses ?? []);
508
- for (const [key, text] of this.#extensionStatuses)
509
- statuses.set(key, text);
510
- return {
511
- ...view,
512
- status: {
513
- ...view.status,
514
- footer: {
515
- branch: footer?.branch ?? null,
516
- sessionName: footer?.sessionName ?? null,
517
- availableProviderCount: footer?.availableProviderCount ?? 1,
518
- extensionStatuses: [...statuses],
519
- },
520
- },
521
- };
522
- }
523
- #invalidateExtensions() {
524
- this.#extensionHeader?.invalidate();
525
- this.#extensionFooter?.invalidate();
526
- for (const { component } of this.#extensionWidgets.values())
527
- component.invalidate();
528
- }
529
- #setToolsExpanded(expanded) {
530
- this.#toolsExpanded = expanded;
531
- this.header.setExpanded(expanded);
532
- this.resources.setExpanded(expanded);
533
- for (const component of this.#transcript.values())
534
- component.setExpanded(expanded);
535
- // Expansion changes what a block draws without changing its revision.
536
- this.#renderedRows.clear();
537
- this.invalidate();
538
- }
539
- }
540
- function layoutPort(render, invalidate, handleInput) {
541
- return {
542
- render,
543
- invalidate,
544
- ...(handleInput === undefined ? {} : { handleInput }),
545
- };
546
- }
547
- function shellResourceEntries(backend) {
548
- const resources = backend.nonVisualResources().map(resource => ({
549
- section: resource.kind === "skill"
550
- ? "Skills"
551
- : resource.kind === "prompt-template"
552
- ? "Prompts"
553
- : resource.kind === "theme"
554
- ? "Themes"
555
- : "Context",
556
- label: resource.kind === "prompt-template"
557
- ? `/${resource.label}`
558
- : resource.kind === "agent-context" || resource.kind === "system-prompt"
559
- ? compactResourceLabel(resource.sourcePath ?? resource.label)
560
- : resource.label,
561
- sourcePath: resource.sourcePath,
562
- diagnostic: resource.diagnostic,
563
- }));
564
- const extensions = backend.extensionResources().filter(extension => !extension.hidden);
565
- const loadedExtensions = extensions.filter(extension => extension.diagnostic === null);
566
- const extensionLabels = compactExtensionLabels(loadedExtensions);
567
- for (const extension of extensions) {
568
- const labelIndex = loadedExtensions.indexOf(extension);
569
- resources.push({
570
- section: "Extensions",
571
- label: extensionLabels[labelIndex] ?? compactResourceLabel(extension.sourcePath ?? extension.resolvedPath ?? "extension"),
572
- sourcePath: extension.sourcePath ?? extension.resolvedPath,
573
- diagnostic: extension.diagnostic,
574
- });
575
- }
576
- return resources;
577
- }
578
- function compactResourceLabel(path) {
579
- const segments = compactPathSegments(path);
580
- const leaf = segments.at(-1) ?? path;
581
- if ((leaf === "index.ts" || leaf === "index.js") && segments.length > 1)
582
- return segments.at(-2) ?? leaf;
583
- return leaf;
584
- }
585
- /**
586
- * Pinned from InteractiveMode's compact extension-label helpers at Pi commit
587
- * 914cf1472e715297caa30db4b9535d534a9eb718. The source metadata crosses an
588
- * A1-owned boundary first; the owned shell never inspects Pi's private root.
589
- */
590
- function compactExtensionLabels(extensions) {
591
- const localExtensions = extensions
592
- .filter(extension => !isPackageExtensionSource(extension.sourceInfo))
593
- .map(extension => {
594
- const path = extension.sourcePath ?? extension.resolvedPath ?? "extension";
595
- const segments = compactPathSegments(path);
596
- if (segments.length > 1 && (segments.at(-1) === "index.ts" || segments.at(-1) === "index.js"))
597
- segments.pop();
598
- return { extension, segments };
599
- });
600
- return extensions.map(extension => {
601
- const resourcePath = extension.sourcePath ?? extension.resolvedPath ?? "extension";
602
- if (isPackageExtensionSource(extension.sourceInfo)) {
603
- return compactPackageExtensionLabel(resourcePath, extension.sourceInfo);
604
- }
605
- const localIndex = localExtensions.findIndex(item => item.extension === extension);
606
- const segments = localExtensions[localIndex]?.segments;
607
- if (!segments || segments.length === 0)
608
- return compactResourceLabel(resourcePath);
609
- for (let count = 1; count <= segments.length; count += 1) {
610
- const candidate = segments.slice(-count).join("/");
611
- if (localExtensions.every((item, itemIndex) => itemIndex === localIndex || item.segments.slice(-count).join("/") !== candidate)) {
612
- return candidate;
613
- }
614
- }
615
- return segments.join("/");
616
- });
617
- }
618
- function compactPackageExtensionLabel(resourcePath, sourceInfo) {
619
- const sourceLabel = compactPackageSourceLabel(sourceInfo.source);
620
- if (!sourceLabel)
621
- return compactResourceLabel(resourcePath);
622
- const shortPath = shortPackagePath(resourcePath, sourceInfo).replaceAll("\\", "/");
623
- const packagePath = shortPath.startsWith("extensions/") ? shortPath.slice("extensions/".length) : shortPath;
624
- const slash = packagePath.lastIndexOf("/");
625
- const fileName = slash < 0 ? packagePath : packagePath.slice(slash + 1);
626
- const directory = slash < 0 ? "" : packagePath.slice(0, slash);
627
- const extension = fileName.lastIndexOf(".");
628
- const name = extension <= 0 ? fileName : fileName.slice(0, extension);
629
- if (name === "index")
630
- return !directory || directory === "." ? sourceLabel : `${sourceLabel}:${directory}`;
631
- return `${sourceLabel}:${packagePath}`;
632
- }
633
- function compactPackageSourceLabel(source) {
634
- if (source.startsWith("npm:"))
635
- return source.slice("npm:".length) || source;
636
- if (!source.startsWith("git:"))
637
- return source;
638
- const gitSource = source.slice("git:".length).trim();
639
- let repositoryPath;
640
- const scpLike = gitSource.match(/^git@[^:]+:(.+)$/);
641
- if (scpLike?.[1]) {
642
- repositoryPath = scpLike[1];
643
- }
644
- else if (/^[a-z]+:\/\//i.test(gitSource)) {
645
- try {
646
- repositoryPath = new URL(gitSource).pathname.replace(/^\/+/, "");
647
- }
648
- catch {
649
- return source;
650
- }
651
- }
652
- else {
653
- const slash = gitSource.indexOf("/");
654
- if (slash >= 0)
655
- repositoryPath = gitSource.slice(slash + 1);
656
- }
657
- if (!repositoryPath)
658
- return source;
659
- const ref = repositoryPath.indexOf("@");
660
- const withoutRef = ref < 0 ? repositoryPath : repositoryPath.slice(0, ref);
661
- return withoutRef.replace(/\.git$/, "") || source;
662
- }
663
- function shortPackagePath(resourcePath, sourceInfo) {
664
- const fullPath = normalizeResourcePath(resourcePath);
665
- const baseDir = sourceInfo.baseDir === null ? undefined : normalizeResourcePath(sourceInfo.baseDir).replace(/\/$/, "");
666
- if (baseDir) {
667
- const npmRoot = baseDir.match(/^(.*\/node_modules)\/(@?[^/]+(?:\/[^/]+)?)$/);
668
- if (npmRoot?.[1] && fullPath.startsWith(`${npmRoot[1]}/`))
669
- return relativeResourcePath(baseDir, fullPath);
670
- if (fullPath === baseDir)
671
- return ".";
672
- if (fullPath.startsWith(`${baseDir}/`))
673
- return fullPath.slice(baseDir.length + 1);
674
- }
675
- const npmMatch = fullPath.match(/node_modules\/(@?[^/]+(?:\/[^/]+)?)\/(.*)/);
676
- if (npmMatch?.[2] && sourceInfo.source.startsWith("npm:"))
677
- return npmMatch[2];
678
- const gitMatch = fullPath.match(/git\/[^/]+\/[^/]+\/(.*)/);
679
- if (gitMatch?.[1] && sourceInfo.source.startsWith("git:"))
680
- return gitMatch[1];
681
- return resourcePath;
682
- }
683
- function relativeResourcePath(from, to) {
684
- const fromSegments = from.split("/").filter(Boolean);
685
- const toSegments = to.split("/").filter(Boolean);
686
- let common = 0;
687
- while (common < fromSegments.length && common < toSegments.length
688
- && fromSegments[common]?.toLowerCase() === toSegments[common]?.toLowerCase())
689
- common += 1;
690
- return [...fromSegments.slice(common).map(() => ".."), ...toSegments.slice(common)].join("/") || ".";
691
- }
692
- function compactPathSegments(path) {
693
- return normalizeResourcePath(path).split("/").filter(segment => segment.length > 0 && segment !== "~");
694
- }
695
- function normalizeResourcePath(path) {
696
- return path.replaceAll("\\", "/");
697
- }
698
- function isPackageExtensionSource(sourceInfo) {
699
- const source = sourceInfo?.source ?? "";
700
- return source.startsWith("npm:") || source.startsWith("git:");
701
- }
1
+ import { MOUSE_TRACKING_OFF, MOUSE_TRACKING_ON, parseMouseInput } from "../../../ui/components/index.js";
2
+ import { PINNED_PI_HIDDEN_COMMAND_NAMES, PINNED_PI_WORKFLOW_COMMAND_NAMES, } from "../engine/index.js";
3
+ import { createPiExtensionUiBridge, createPiQueuedInputStatus, createPiShellArmin, createPiShellAuthProviderSelector, createPiShellChangelog, createPiShellDaxnuts, createPiShellDialog, createPiShellEarendilAnnouncement, createPiShellEditor, createPiShellExtensionSelector, createPiShellFooter, createPiShellHeader, createPiShellHotkeys, createPiShellLoadedResources, createPiShellLoginDialog, createPiShellModelSelector, createPiShellOperationLoader, createPiShellReloadBox, createPiShellScopedModelsSelector, createPiShellSelector, createPiShellSessionInfo, createPiShellSessionSelector, createPiShellSettingsSelector, createPiShellStatus, createPiShellTranscriptComponent, createPiShellTreeSelector, createPiShellTrustSelector, createPiShellUserMessageSelector, onPiThemeChange, piTheme, renderPiShellPackageUpdateNotice, renderPiShellStartupDiagnostic, renderPiShellStatusText, renderPiShellTranscriptBlock, } from "../components/index.js";
4
+ import { PiTuiRuntimeAdapter, } from "../tui-runtime/index.js";
5
+ import { OwnedUiSessionShellRoot, shellResourceEntries, } from "./session-shell-root.js";
6
+ export { OwnedUiSessionShellRoot } from "./session-shell-root.js";
702
7
  export class OwnedUiSessionShell {
703
8
  backend;
704
9
  root;
@@ -794,9 +99,12 @@ export class OwnedUiSessionShell {
794
99
  });
795
100
  this.root.editor.setAutocompleteCommands(this.backend.workflowAutocompleteCommands());
796
101
  this.#unsubscribe = this.backend.onEvent(event => {
797
- // One view read per event: the model is built by the backend, and building it
798
- // twice per streamed chunk is what made a long session cost more per chunk.
799
- const view = this.#syncView();
102
+ // A streamed chunk names one block, and touching only that block is what keeps the
103
+ // cost of a chunk the same in a long session as in a new one. Everything else
104
+ // resynchronizes the view, which is cheap next to re-reading the transcript.
105
+ const view = event.type === "transcript-block" && this.#sessionGeneration === this.backend.sessionGeneration
106
+ ? this.#syncBlock(event.block)
107
+ : this.#syncView();
800
108
  if (view.lifecycle === "ready" && this.#compactionQueue.length > 0)
801
109
  void this.#flushCompactionQueue();
802
110
  if (event.type === "session-lifecycle" && event.lifecycle === "stopped")
@@ -1415,6 +723,18 @@ export class OwnedUiSessionShell {
1415
723
  this.#extensionBridge.dispose();
1416
724
  await this.runtime.dispose();
1417
725
  }
726
+ /**
727
+ * Applies one transcript block without re-reading the session. The listeners still hear
728
+ * the view they would have heard, so nothing downstream can tell the difference.
729
+ */
730
+ #syncBlock(block) {
731
+ this.root.applyTranscriptBlock(block);
732
+ this.runtime.requestRender();
733
+ const view = this.view();
734
+ for (const listener of this.#listeners)
735
+ listener(view);
736
+ return view;
737
+ }
1418
738
  #syncView() {
1419
739
  const view = this.view();
1420
740
  if (this.backend.sessionGeneration !== this.#sessionGeneration) {