@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
@@ -1,723 +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
- /**
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
- this.invalidate();
92
- }
93
- render(width) {
94
- const queued = this.#view.editor.queuedSubmissions.length === 0 ? [] : this.#queued.render(width);
95
- return [
96
- ...this.#renderDocument(width),
97
- ...queued,
98
- ...this.#renderStatus(width),
99
- ...this.#renderWidgets("aboveEditor", width),
100
- ...this.#inputSurface.render(width),
101
- ...this.#renderWidgets("belowEditor", width),
102
- ...this.#renderFooter(width),
103
- ];
104
- }
105
- layoutRoot() {
106
- const document = layoutPort(width => this.#renderDocument(width), () => this.invalidate());
107
- const queued = layoutPort(width => this.#view.editor.queuedSubmissions.length === 0 ? [] : this.#queued.render(width), () => this.#queued.invalidate());
108
- const aboveWidgets = layoutPort(width => this.#renderWidgets("aboveEditor", width), () => this.#invalidateExtensions());
109
- const status = layoutPort(width => this.#renderStatus(width), () => this.#status.invalidate());
110
- const editor = layoutPort(width => this.#inputSurface.render(width), () => this.#inputSurface.invalidate(), data => this.#inputSurface.handleInput?.(data));
111
- const belowWidgets = layoutPort(width => this.#renderWidgets("belowEditor", width), () => this.#invalidateExtensions());
112
- const footer = layoutPort(width => this.#renderFooter(width), () => (this.#extensionFooter ?? this.#footer).invalidate());
113
- return {
114
- type: "stack",
115
- direction: "vertical",
116
- children: [
117
- {
118
- basis: 0,
119
- grow: 1,
120
- shrink: 1,
121
- minSize: 1,
122
- node: {
123
- type: "scroll",
124
- id: "transcript",
125
- follow: "end",
126
- primary: true,
127
- overscroll: "chain",
128
- scrollbar: "auto",
129
- scrollbarStyle: text => piTheme().bg("scrollbarThumb", text),
130
- child: { type: "component", component: document },
131
- },
132
- },
133
- {
134
- basis: "auto",
135
- grow: 0,
136
- shrink: 1,
137
- minSize: 1,
138
- node: {
139
- type: "stack",
140
- direction: "vertical",
141
- children: [
142
- { shrink: 1, minSize: 0, node: { type: "component", component: queued } },
143
- { shrink: 1, minSize: 0, node: { type: "component", component: status } },
144
- { shrink: 1, minSize: 0, node: { type: "component", component: aboveWidgets } },
145
- { shrink: 1, minSize: 3, node: { type: "component", component: editor } },
146
- { shrink: 1, minSize: 0, node: { type: "component", component: belowWidgets } },
147
- { shrink: 1, minSize: 1, node: { type: "component", component: footer } },
148
- ],
149
- },
150
- },
151
- ],
152
- };
153
- }
154
- #renderDocument(width) {
155
- const transcript = this.#transcriptOrder.flatMap((id, index) => {
156
- const block = this.#blocksById.get(id);
157
- if (!this.#thinkingVisible && block?.kind === "thinking")
158
- return [];
159
- const rows = this.#blockRows(id, block, width);
160
- if (index > 0 && block?.kind === "user")
161
- return ["", ...rows];
162
- return rows;
163
- });
164
- const diagnostics = this.#view.diagnostics;
165
- const startupRows = diagnostics
166
- .filter(diagnostic => diagnostic.code === "engine-startup")
167
- .flatMap(diagnostic => renderPiShellStartupDiagnostic(diagnostic, width));
168
- const packageUpdateRows = diagnostics
169
- .filter(diagnostic => diagnostic.code === "package-updates")
170
- .flatMap(diagnostic => renderPiShellPackageUpdateNotice(diagnostic.message.split("\n").filter(line => line.startsWith("- ")).map(line => line.slice(2)), width));
171
- const diagnosticRows = diagnostics
172
- .filter(diagnostic => diagnostic.code !== "engine-startup" && diagnostic.code !== "package-updates")
173
- .slice(-3)
174
- .flatMap(diagnostic => renderPiShellTranscriptBlock({
175
- id: `diagnostic-${diagnostic.sequence}`,
176
- kind: diagnostic.severity === "error" ? "error" : "system",
177
- status: "finalized",
178
- revision: diagnostic.sequence,
179
- title: diagnostic.code,
180
- text: diagnostic.message,
181
- payload: {},
182
- }, width, this.#cwd));
183
- const resourceRows = [...this.resources.render(width)];
184
- if (resourceRows.at(-1) === "")
185
- resourceRows.pop();
186
- return [
187
- ...startupRows,
188
- ...(this.#extensionHeader ?? this.header).render(width),
189
- ...resourceRows,
190
- ...transcript,
191
- ...packageUpdateRows,
192
- ...diagnosticRows,
193
- ];
194
- }
195
- /**
196
- * Rows for one transcript block. A finalized block renders once for a given revision
197
- * and width and is reused after that, so a frame costs what changed rather than what
198
- * the session has accumulated. A live block, and anything the shell drives itself, is
199
- * rendered every time because its content is still moving.
200
- */
201
- #blockRows(id, block, width) {
202
- const component = this.#transcript.get(id);
203
- if (component === undefined)
204
- return [];
205
- if (block === undefined || block.status !== "finalized")
206
- return component.render(width);
207
- const cached = this.#renderedRows.get(id);
208
- if (cached && cached.width === width && cached.revision === block.revision)
209
- return cached.rows;
210
- const rows = component.render(width);
211
- this.#renderedRows.set(id, { width, revision: block.revision, rows });
212
- return rows;
213
- }
214
- transcriptComponent(id) {
215
- return this.#transcript.get(id);
216
- }
217
- appendWorkflowStatus(message) {
218
- const previousId = this.#lastWorkflowStatusId;
219
- if (previousId !== undefined
220
- && this.#transcriptOrder.at(-1) === previousId
221
- && this.#workflowStatusAnchors.get(previousId) === this.#view.transcript.length) {
222
- this.#workflowStatusMessages.set(previousId, message);
223
- this.invalidate();
224
- return;
225
- }
226
- const id = this.#appendAnchoredWorkflowComponent(width => [
227
- "",
228
- ...renderPiShellStatusText(this.#workflowStatusMessages.get(id) ?? message, width),
229
- ]);
230
- this.#workflowStatusMessages.set(id, message);
231
- this.#lastWorkflowStatusId = id;
232
- }
233
- appendWorkflowResult(result) {
234
- if (result.command === "reload" && result.outcome === "completed") {
235
- this.appendWorkflowStatus(result.message);
236
- return;
237
- }
238
- if (result.command === "session" && result.outcome === "completed" && result.presentation?.kind === "session-info") {
239
- this.#lastWorkflowStatusId = undefined;
240
- const sessionInfo = createPiShellSessionInfo(result.presentation);
241
- this.#appendAnchoredWorkflowComponent(width => sessionInfo.render(width), () => sessionInfo.dispose?.());
242
- return;
243
- }
244
- if (result.command === "hotkeys" && result.outcome === "completed") {
245
- this.#lastWorkflowStatusId = undefined;
246
- const hotkeys = createPiShellHotkeys();
247
- this.#appendAnchoredWorkflowComponent(width => hotkeys.render(width), () => hotkeys.dispose?.());
248
- return;
249
- }
250
- if (result.command === "changelog" && result.outcome === "completed") {
251
- this.#lastWorkflowStatusId = undefined;
252
- const changelog = createPiShellChangelog(result.detail ?? "No changelog entries found.");
253
- this.#appendAnchoredWorkflowComponent(width => changelog.render(width), () => changelog.dispose?.());
254
- return;
255
- }
256
- if (result.outcome === "failed") {
257
- this.#lastWorkflowStatusId = undefined;
258
- const warning = (result.command === "name" && result.message.startsWith("Usage:"))
259
- || (result.command === "reload" && result.message.startsWith("Wait for "));
260
- const prefix = warning ? "Warning" : "Error";
261
- const color = warning ? "warning" : "error";
262
- this.#appendAnchoredWorkflowComponent(() => ["", ` ${piTheme().fg(color, `${prefix}: ${result.message}`)}`]);
263
- return;
264
- }
265
- if (result.outcome === "completed" && (result.command === "quit" || result.command === "compact"))
266
- return;
267
- if (result.command === "new" && result.outcome === "completed") {
268
- this.#lastWorkflowStatusId = undefined;
269
- this.#appendAnchoredWorkflowComponent(() => ["", ` ${piTheme().fg("accent", result.message)}`]);
270
- return;
271
- }
272
- if (result.command === "name" && result.outcome === "completed") {
273
- this.#lastWorkflowStatusId = undefined;
274
- this.#appendAnchoredWorkflowComponent(() => [
275
- ...(result.detail ? ["", ` ${piTheme().fg("warning", `Warning: ${result.detail}`)}`] : []),
276
- "",
277
- ` ${piTheme().fg("dim", result.message)}`,
278
- ]);
279
- return;
280
- }
281
- if (result.command === "debug" && result.outcome === "completed") {
282
- this.#lastWorkflowStatusId = undefined;
283
- this.#appendAnchoredWorkflowComponent(() => [
284
- "",
285
- ` ${piTheme().fg("accent", result.message)}`,
286
- ...(result.detail ? [` ${piTheme().fg("muted", result.detail)}`] : []),
287
- ]);
288
- return;
289
- }
290
- if (result.command === "arminsayshi" && result.outcome === "completed") {
291
- this.#lastWorkflowStatusId = undefined;
292
- const armin = createPiShellArmin(this.#componentRuntime);
293
- this.#appendAnchoredWorkflowComponent(width => ["", ...armin.render(width)], () => armin.dispose?.());
294
- return;
295
- }
296
- if (result.command === "dementedelves" && result.outcome === "completed") {
297
- this.#lastWorkflowStatusId = undefined;
298
- const announcement = createPiShellEarendilAnnouncement();
299
- this.#appendAnchoredWorkflowComponent(width => ["", ...announcement.render(width)], () => announcement.dispose?.());
300
- return;
301
- }
302
- const message = result.command === "share" && result.detail
303
- ? `${result.message}\nGist: ${result.detail}`
304
- : result.message;
305
- this.appendWorkflowStatus(message);
306
- }
307
- appendDaxnuts() {
308
- this.#lastWorkflowStatusId = undefined;
309
- const daxnuts = createPiShellDaxnuts(this.#componentRuntime);
310
- this.#appendAnchoredWorkflowComponent(width => ["", ...daxnuts.render(width)], () => daxnuts.dispose?.());
311
- }
312
- toggleThinkingVisibility() {
313
- this.#thinkingVisible = !this.#thinkingVisible;
314
- this.invalidate();
315
- }
316
- get toolsExpanded() {
317
- return this.#toolsExpanded;
318
- }
319
- setToolsExpanded(expanded) {
320
- this.#setToolsExpanded(expanded);
321
- }
322
- setExtensionWidget(key, component, placement) {
323
- const previous = this.#extensionWidgets.get(key)?.component;
324
- if (component === null)
325
- this.#extensionWidgets.delete(key);
326
- else
327
- this.#extensionWidgets.set(key, { component, placement });
328
- if (previous !== undefined && previous !== component)
329
- previous.dispose?.();
330
- this.invalidate();
331
- }
332
- setExtensionHeader(component) {
333
- if (this.#extensionHeader !== component)
334
- this.#extensionHeader?.dispose?.();
335
- this.#extensionHeader = component;
336
- this.invalidate();
337
- }
338
- setExtensionFooter(component) {
339
- if (this.#extensionFooter !== component)
340
- this.#extensionFooter?.dispose?.();
341
- this.#extensionFooter = component;
342
- this.invalidate();
343
- }
344
- setExtensionStatus(key, text) {
345
- if (text === undefined)
346
- this.#extensionStatuses.delete(key);
347
- else
348
- this.#extensionStatuses.set(key, text);
349
- this.#footer.update(this.#viewWithExtensionStatuses(this.#view));
350
- this.invalidate();
351
- }
352
- setExtensionWorking(message, visible = this.#extensionWorkingVisible) {
353
- this.#extensionWorkingMessage = message;
354
- this.#extensionWorkingVisible = visible;
355
- this.#status.setWorkingOverride(visible ? message : undefined);
356
- this.invalidate();
357
- }
358
- resetWorkflowPresentation() {
359
- for (const id of this.#workflowStatusAnchors.keys()) {
360
- this.#transcript.get(id)?.dispose?.();
361
- this.#transcript.delete(id);
362
- }
363
- this.#workflowStatusAnchors.clear();
364
- this.#workflowStatusMessages.clear();
365
- this.#transcriptOrder = this.#transcriptOrder.filter(id => !id.startsWith("workflow-status-"));
366
- this.#lastWorkflowStatusId = undefined;
367
- this.invalidate();
368
- }
369
- resetExtensionUi() {
370
- this.#extensionHeader?.dispose?.();
371
- this.#extensionFooter?.dispose?.();
372
- for (const { component } of this.#extensionWidgets.values())
373
- component.dispose?.();
374
- this.#extensionHeader = null;
375
- this.#extensionFooter = null;
376
- this.#extensionWidgets.clear();
377
- this.#extensionStatuses.clear();
378
- this.#extensionWorkingMessage = undefined;
379
- this.#status.setWorkingOverride(undefined);
380
- this.#footer.update(this.#viewWithExtensionStatuses(this.#view));
381
- // An extension renderer may have drawn transcript blocks that are now unrendered by it.
382
- this.#renderedRows.clear();
383
- this.invalidate();
384
- }
385
- addExtensionNotification(message, type) {
386
- if (type === "info") {
387
- this.appendWorkflowStatus(message);
388
- return;
389
- }
390
- this.#lastWorkflowStatusId = undefined;
391
- const prefix = type === "warning" ? "Warning" : "Error";
392
- this.#appendAnchoredWorkflowComponent(() => ["", ` ${piTheme().fg(type, `${prefix}: ${message}`)}`]);
393
- }
394
- extensionFooterData() {
395
- return {
396
- getGitBranch: () => this.#view.status.footer?.branch ?? null,
397
- getExtensionStatuses: () => new Map(this.#extensionStatuses),
398
- getAvailableProviderCount: () => this.#view.status.footer?.availableProviderCount ?? 1,
399
- onBranchChange: () => () => { },
400
- };
401
- }
402
- setInputSurface(component, disposePrevious = true) {
403
- const next = component ?? this.editor;
404
- if (next === this.#inputSurface)
405
- return;
406
- this.#inputSurface.setFocused?.(false);
407
- if (disposePrevious && this.#inputSurface !== this.editor)
408
- this.#inputSurface.dispose?.();
409
- this.#inputSurface = next;
410
- this.#inputSurface.setFocused?.(true);
411
- this.invalidate();
412
- }
413
- handleInput(data) {
414
- this.#inputSurface.handleInput?.(data);
415
- }
416
- invalidate() {
417
- this.header.invalidate();
418
- this.resources.invalidate();
419
- for (const component of this.#transcript.values())
420
- component.invalidate();
421
- this.editor.invalidate();
422
- if (this.#inputSurface !== this.editor)
423
- this.#inputSurface.invalidate();
424
- this.#invalidateExtensions();
425
- this.#status.invalidate();
426
- this.#footer.invalidate();
427
- this.#queued.invalidate();
428
- }
429
- setFocused(focused) {
430
- this.#inputSurface.setFocused?.(focused);
431
- }
432
- dispose() {
433
- this.#themeUnsubscribe();
434
- this.header.dispose?.();
435
- this.resources.dispose?.();
436
- for (const component of this.#transcript.values())
437
- component.dispose?.();
438
- this.#transcript.clear();
439
- this.#renderedRows.clear();
440
- if (this.#inputSurface !== this.editor)
441
- this.#inputSurface.dispose?.();
442
- this.#extensionHeader?.dispose?.();
443
- this.#extensionFooter?.dispose?.();
444
- for (const { component } of this.#extensionWidgets.values())
445
- component.dispose?.();
446
- this.#extensionWidgets.clear();
447
- this.editor.dispose?.();
448
- this.#status.dispose?.();
449
- this.#footer.dispose?.();
450
- this.#queued.dispose?.();
451
- }
452
- #syncTranscript(blocks) {
453
- this.#blocksById.clear();
454
- for (const block of blocks)
455
- this.#blocksById.set(block.id, block);
456
- const nextIds = new Set(blocks.map(block => block.id));
457
- for (const [id, component] of this.#transcript) {
458
- if (id.startsWith("workflow-status-") || nextIds.has(id))
459
- continue;
460
- component.dispose?.();
461
- this.#transcript.delete(id);
462
- this.#renderedRows.delete(id);
463
- }
464
- for (const block of blocks) {
465
- const component = this.#transcript.get(block.id);
466
- if (component === undefined) {
467
- const created = createPiShellTranscriptComponent(block, this.#cwd, this.#extensionRenderers);
468
- created.setExpanded(this.#toolsExpanded);
469
- this.#transcript.set(block.id, created);
470
- }
471
- else if (component.revision !== block.revision) {
472
- component.update(block);
473
- }
474
- }
475
- const statusIds = [...this.#workflowStatusAnchors.keys()];
476
- const order = [];
477
- for (let index = 0; index <= blocks.length; index += 1) {
478
- for (const statusId of statusIds) {
479
- if (this.#workflowStatusAnchors.get(statusId) === index)
480
- order.push(statusId);
481
- }
482
- const block = blocks[index];
483
- if (block !== undefined)
484
- order.push(block.id);
485
- }
486
- const placed = new Set(order);
487
- for (const statusId of statusIds) {
488
- if (!placed.has(statusId))
489
- order.push(statusId);
490
- }
491
- this.#transcriptOrder = order;
492
- }
493
- #appendAnchoredWorkflowComponent(render, dispose) {
494
- this.#workflowTranscriptSequence += 1;
495
- const id = `workflow-status-${this.#workflowTranscriptSequence}`;
496
- const component = {
497
- id,
498
- revision: 1,
499
- render,
500
- handleInput() { },
501
- invalidate() { },
502
- update() { },
503
- setExpanded() { },
504
- ...(dispose === undefined ? {} : { dispose }),
505
- };
506
- this.#transcript.set(id, component);
507
- this.#workflowStatusAnchors.set(id, this.#view.transcript.length);
508
- this.#transcriptOrder.push(id);
509
- this.invalidate();
510
- return id;
511
- }
512
- #renderWidgets(placement, width) {
513
- const rows = [...this.#extensionWidgets.values()]
514
- .filter(widget => widget.placement === placement)
515
- .flatMap(widget => widget.component.render(width));
516
- return placement === "aboveEditor" ? ["", ...rows] : rows;
517
- }
518
- #renderStatus(width) {
519
- return this.#status.render(width);
520
- }
521
- #renderFooter(width) {
522
- return (this.#extensionFooter ?? this.#footer).render(width);
523
- }
524
- #viewWithExtensionStatuses(view) {
525
- const footer = view.status.footer;
526
- const statuses = new Map(footer?.extensionStatuses ?? []);
527
- for (const [key, text] of this.#extensionStatuses)
528
- statuses.set(key, text);
529
- return {
530
- ...view,
531
- status: {
532
- ...view.status,
533
- footer: {
534
- branch: footer?.branch ?? null,
535
- sessionName: footer?.sessionName ?? null,
536
- availableProviderCount: footer?.availableProviderCount ?? 1,
537
- extensionStatuses: [...statuses],
538
- },
539
- },
540
- };
541
- }
542
- #invalidateExtensions() {
543
- this.#extensionHeader?.invalidate();
544
- this.#extensionFooter?.invalidate();
545
- for (const { component } of this.#extensionWidgets.values())
546
- component.invalidate();
547
- }
548
- #setToolsExpanded(expanded) {
549
- this.#toolsExpanded = expanded;
550
- this.header.setExpanded(expanded);
551
- this.resources.setExpanded(expanded);
552
- for (const component of this.#transcript.values())
553
- component.setExpanded(expanded);
554
- // Expansion changes what a block draws without changing its revision.
555
- this.#renderedRows.clear();
556
- this.invalidate();
557
- }
558
- }
559
- function layoutPort(render, invalidate, handleInput) {
560
- return {
561
- render,
562
- invalidate,
563
- ...(handleInput === undefined ? {} : { handleInput }),
564
- };
565
- }
566
- function shellResourceEntries(backend) {
567
- const resources = backend.nonVisualResources().map(resource => ({
568
- section: resource.kind === "skill"
569
- ? "Skills"
570
- : resource.kind === "prompt-template"
571
- ? "Prompts"
572
- : resource.kind === "theme"
573
- ? "Themes"
574
- : "Context",
575
- label: resource.kind === "prompt-template"
576
- ? `/${resource.label}`
577
- : resource.kind === "agent-context" || resource.kind === "system-prompt"
578
- ? compactResourceLabel(resource.sourcePath ?? resource.label)
579
- : resource.label,
580
- sourcePath: resource.sourcePath,
581
- diagnostic: resource.diagnostic,
582
- }));
583
- const extensions = backend.extensionResources().filter(extension => !extension.hidden);
584
- const loadedExtensions = extensions.filter(extension => extension.diagnostic === null);
585
- const extensionLabels = compactExtensionLabels(loadedExtensions);
586
- for (const extension of extensions) {
587
- const labelIndex = loadedExtensions.indexOf(extension);
588
- resources.push({
589
- section: "Extensions",
590
- label: extensionLabels[labelIndex] ?? compactResourceLabel(extension.sourcePath ?? extension.resolvedPath ?? "extension"),
591
- sourcePath: extension.sourcePath ?? extension.resolvedPath,
592
- diagnostic: extension.diagnostic,
593
- });
594
- }
595
- return resources;
596
- }
597
- function compactResourceLabel(path) {
598
- const segments = compactPathSegments(path);
599
- const leaf = segments.at(-1) ?? path;
600
- if ((leaf === "index.ts" || leaf === "index.js") && segments.length > 1)
601
- return segments.at(-2) ?? leaf;
602
- return leaf;
603
- }
604
- /**
605
- * Pinned from InteractiveMode's compact extension-label helpers at Pi commit
606
- * 914cf1472e715297caa30db4b9535d534a9eb718. The source metadata crosses an
607
- * A1-owned boundary first; the owned shell never inspects Pi's private root.
608
- */
609
- function compactExtensionLabels(extensions) {
610
- const localExtensions = extensions
611
- .filter(extension => !isPackageExtensionSource(extension.sourceInfo))
612
- .map(extension => {
613
- const path = extension.sourcePath ?? extension.resolvedPath ?? "extension";
614
- const segments = compactPathSegments(path);
615
- if (segments.length > 1 && (segments.at(-1) === "index.ts" || segments.at(-1) === "index.js"))
616
- segments.pop();
617
- return { extension, segments };
618
- });
619
- return extensions.map(extension => {
620
- const resourcePath = extension.sourcePath ?? extension.resolvedPath ?? "extension";
621
- if (isPackageExtensionSource(extension.sourceInfo)) {
622
- return compactPackageExtensionLabel(resourcePath, extension.sourceInfo);
623
- }
624
- const localIndex = localExtensions.findIndex(item => item.extension === extension);
625
- const segments = localExtensions[localIndex]?.segments;
626
- if (!segments || segments.length === 0)
627
- return compactResourceLabel(resourcePath);
628
- for (let count = 1; count <= segments.length; count += 1) {
629
- const candidate = segments.slice(-count).join("/");
630
- if (localExtensions.every((item, itemIndex) => itemIndex === localIndex || item.segments.slice(-count).join("/") !== candidate)) {
631
- return candidate;
632
- }
633
- }
634
- return segments.join("/");
635
- });
636
- }
637
- function compactPackageExtensionLabel(resourcePath, sourceInfo) {
638
- const sourceLabel = compactPackageSourceLabel(sourceInfo.source);
639
- if (!sourceLabel)
640
- return compactResourceLabel(resourcePath);
641
- const shortPath = shortPackagePath(resourcePath, sourceInfo).replaceAll("\\", "/");
642
- const packagePath = shortPath.startsWith("extensions/") ? shortPath.slice("extensions/".length) : shortPath;
643
- const slash = packagePath.lastIndexOf("/");
644
- const fileName = slash < 0 ? packagePath : packagePath.slice(slash + 1);
645
- const directory = slash < 0 ? "" : packagePath.slice(0, slash);
646
- const extension = fileName.lastIndexOf(".");
647
- const name = extension <= 0 ? fileName : fileName.slice(0, extension);
648
- if (name === "index")
649
- return !directory || directory === "." ? sourceLabel : `${sourceLabel}:${directory}`;
650
- return `${sourceLabel}:${packagePath}`;
651
- }
652
- function compactPackageSourceLabel(source) {
653
- if (source.startsWith("npm:"))
654
- return source.slice("npm:".length) || source;
655
- if (!source.startsWith("git:"))
656
- return source;
657
- const gitSource = source.slice("git:".length).trim();
658
- let repositoryPath;
659
- const scpLike = gitSource.match(/^git@[^:]+:(.+)$/);
660
- if (scpLike?.[1]) {
661
- repositoryPath = scpLike[1];
662
- }
663
- else if (/^[a-z]+:\/\//i.test(gitSource)) {
664
- try {
665
- repositoryPath = new URL(gitSource).pathname.replace(/^\/+/, "");
666
- }
667
- catch {
668
- return source;
669
- }
670
- }
671
- else {
672
- const slash = gitSource.indexOf("/");
673
- if (slash >= 0)
674
- repositoryPath = gitSource.slice(slash + 1);
675
- }
676
- if (!repositoryPath)
677
- return source;
678
- const ref = repositoryPath.indexOf("@");
679
- const withoutRef = ref < 0 ? repositoryPath : repositoryPath.slice(0, ref);
680
- return withoutRef.replace(/\.git$/, "") || source;
681
- }
682
- function shortPackagePath(resourcePath, sourceInfo) {
683
- const fullPath = normalizeResourcePath(resourcePath);
684
- const baseDir = sourceInfo.baseDir === null ? undefined : normalizeResourcePath(sourceInfo.baseDir).replace(/\/$/, "");
685
- if (baseDir) {
686
- const npmRoot = baseDir.match(/^(.*\/node_modules)\/(@?[^/]+(?:\/[^/]+)?)$/);
687
- if (npmRoot?.[1] && fullPath.startsWith(`${npmRoot[1]}/`))
688
- return relativeResourcePath(baseDir, fullPath);
689
- if (fullPath === baseDir)
690
- return ".";
691
- if (fullPath.startsWith(`${baseDir}/`))
692
- return fullPath.slice(baseDir.length + 1);
693
- }
694
- const npmMatch = fullPath.match(/node_modules\/(@?[^/]+(?:\/[^/]+)?)\/(.*)/);
695
- if (npmMatch?.[2] && sourceInfo.source.startsWith("npm:"))
696
- return npmMatch[2];
697
- const gitMatch = fullPath.match(/git\/[^/]+\/[^/]+\/(.*)/);
698
- if (gitMatch?.[1] && sourceInfo.source.startsWith("git:"))
699
- return gitMatch[1];
700
- return resourcePath;
701
- }
702
- function relativeResourcePath(from, to) {
703
- const fromSegments = from.split("/").filter(Boolean);
704
- const toSegments = to.split("/").filter(Boolean);
705
- let common = 0;
706
- while (common < fromSegments.length && common < toSegments.length
707
- && fromSegments[common]?.toLowerCase() === toSegments[common]?.toLowerCase())
708
- common += 1;
709
- return [...fromSegments.slice(common).map(() => ".."), ...toSegments.slice(common)].join("/") || ".";
710
- }
711
- function compactPathSegments(path) {
712
- return normalizeResourcePath(path).split("/").filter(segment => segment.length > 0 && segment !== "~");
713
- }
714
- function normalizeResourcePath(path) {
715
- return path.replaceAll("\\", "/");
716
- }
717
- function isPackageExtensionSource(sourceInfo) {
718
- const source = sourceInfo?.source ?? "";
719
- return source.startsWith("npm:") || source.startsWith("git:");
720
- }
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";
721
7
  export class OwnedUiSessionShell {
722
8
  backend;
723
9
  root;