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