@timurproko/a1 0.1.8-dev.ece8cef → 0.2.1-dev.590

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 (922) hide show
  1. package/README.md +104 -58
  2. package/bin/activate.js +8 -0
  3. package/bin/cli.js +39 -13
  4. package/bin/guardian.js +21 -6
  5. package/bin/module-identity.js +76 -69
  6. package/bin/module-resolver.js +138 -0
  7. package/bin/pinned-pi-public.d.ts +3 -0
  8. package/bin/pinned-pi-public.js +93 -0
  9. package/bin/release-cleanup.js +8 -0
  10. package/bin/supervisor.js +2 -2
  11. package/bin/sync-pi-tui-proxy.js +7 -0
  12. package/bin/ui.js +67 -22
  13. package/bin/update-recovery.js +365 -0
  14. package/bin/warmup.js +28 -0
  15. package/dist/app/session-shell/clipboard-diagnostics.d.ts +16 -0
  16. package/dist/app/session-shell/clipboard-diagnostics.js +65 -0
  17. package/dist/app/session-shell/clipboard-image.d.ts +11 -0
  18. package/dist/app/session-shell/clipboard-image.js +38 -0
  19. package/dist/app/session-shell/editor-hyperlink-budget.d.ts +9 -0
  20. package/dist/app/session-shell/editor-hyperlink-budget.js +23 -0
  21. package/dist/app/session-shell/helper-pool.d.ts +33 -0
  22. package/dist/app/session-shell/helper-pool.js +98 -0
  23. package/dist/app/session-shell/image-preparation-client.d.ts +20 -0
  24. package/dist/app/session-shell/image-preparation-client.js +145 -0
  25. package/dist/app/session-shell/image-preparation.d.ts +18 -0
  26. package/dist/app/session-shell/image-preparation.js +126 -0
  27. package/dist/app/session-shell/image-source.d.ts +13 -0
  28. package/dist/app/session-shell/image-source.js +171 -0
  29. package/dist/app/session-shell/image-worker.d.ts +17 -0
  30. package/dist/app/session-shell/image-worker.js +23 -0
  31. package/dist/app/session-shell/index.d.ts +7 -0
  32. package/dist/app/session-shell/index.js +4 -0
  33. package/dist/app/session-shell/paste-executor.d.ts +18 -0
  34. package/dist/app/session-shell/paste-executor.js +253 -0
  35. package/dist/app/session-shell/paste-helper.js +173 -0
  36. package/dist/app/session-shell/paste-preparation-client.d.ts +31 -0
  37. package/dist/app/session-shell/paste-preparation-client.js +170 -0
  38. package/dist/app/session-shell/paste-protocol.d.ts +78 -0
  39. package/dist/app/session-shell/paste-protocol.js +18 -0
  40. package/dist/app/session-shell/paste-text-preparation.d.ts +6 -0
  41. package/dist/app/session-shell/paste-text-preparation.js +134 -0
  42. package/dist/app/session-shell/paste-text-worker.js +12 -0
  43. package/dist/app/session-shell/paste-types.d.ts +17 -0
  44. package/dist/app/session-shell/path-chip-presentation.d.ts +7 -0
  45. package/dist/app/session-shell/path-chip-presentation.js +24 -0
  46. package/dist/app/session-shell/prompt-chips.d.ts +76 -0
  47. package/dist/app/session-shell/prompt-chips.js +499 -0
  48. package/dist/app/session-shell/prompt-history-controller.d.ts +36 -0
  49. package/dist/app/session-shell/prompt-history-controller.js +170 -0
  50. package/dist/app/session-shell/prompt-suggestion-controller.d.ts +37 -0
  51. package/dist/app/session-shell/prompt-suggestion-controller.js +219 -0
  52. package/dist/app/session-shell/quit-outro-effects.d.ts +29 -0
  53. package/dist/app/session-shell/quit-outro-effects.js +242 -0
  54. package/dist/app/session-shell/quit-outro.d.ts +38 -0
  55. package/dist/app/session-shell/quit-outro.js +98 -0
  56. package/dist/app/session-shell/response-copy-coordinator.d.ts +27 -0
  57. package/dist/app/session-shell/response-copy-coordinator.js +187 -0
  58. package/dist/app/session-shell/response-copy-helper.js +122 -0
  59. package/dist/app/session-shell/response-copy-protocol.d.ts +56 -0
  60. package/dist/app/session-shell/response-copy-protocol.js +5 -0
  61. package/dist/app/session-shell/response-copy-transport.d.ts +39 -0
  62. package/dist/app/session-shell/response-copy-transport.js +217 -0
  63. package/dist/app/session-shell/session-shell-root.d.ts +278 -0
  64. package/dist/app/session-shell/session-shell-root.js +1442 -0
  65. package/dist/app/session-shell/session-shell.d.ts +66 -0
  66. package/dist/app/session-shell/session-shell.js +2151 -0
  67. package/dist/app/session-shell/session-viewport-controller.d.ts +62 -0
  68. package/dist/app/session-shell/session-viewport-controller.js +623 -0
  69. package/dist/app/session-shell/stream-presentation-coalescer.d.ts +29 -0
  70. package/dist/app/session-shell/stream-presentation-coalescer.js +79 -0
  71. package/dist/app/session-shell/system-clipboard.d.ts +20 -0
  72. package/dist/app/session-shell/system-clipboard.js +159 -0
  73. package/dist/app/session-shell/text-paste.d.ts +5 -0
  74. package/dist/app/session-shell/text-paste.js +16 -0
  75. package/dist/cli/capabilities.d.ts +6 -0
  76. package/dist/cli/capabilities.js +7 -0
  77. package/dist/cli/dispatch.d.ts +53 -0
  78. package/dist/cli/dispatch.js +287 -0
  79. package/dist/cli/index.d.ts +8 -0
  80. package/dist/cli/index.js +4 -0
  81. package/dist/cli/package-messages.d.ts +27 -0
  82. package/dist/cli/package-messages.js +83 -0
  83. package/dist/cli/packages.d.ts +32 -0
  84. package/dist/cli/packages.js +81 -0
  85. package/dist/cli/session-context.d.ts +9 -0
  86. package/dist/cli/session-context.js +29 -0
  87. package/dist/cli/version-stats.d.ts +22 -0
  88. package/dist/cli/version-stats.js +112 -0
  89. package/dist/composition/index.d.ts +2 -0
  90. package/dist/composition/index.js +2 -0
  91. package/dist/composition/owned-ui.d.ts +37 -0
  92. package/dist/composition/owned-ui.js +159 -0
  93. package/dist/composition/settings-route-host.d.ts +16 -0
  94. package/dist/composition/settings-route-host.js +141 -0
  95. package/dist/contracts/agent-engine/capability-ports.d.ts +95 -0
  96. package/dist/contracts/agent-engine/domain-validation.js +107 -0
  97. package/dist/contracts/agent-engine/domain.d.ts +138 -0
  98. package/dist/contracts/agent-engine/index.d.ts +11 -0
  99. package/dist/contracts/agent-engine/index.js +6 -0
  100. package/dist/contracts/agent-engine/package-ports.d.ts +60 -0
  101. package/dist/contracts/agent-engine/ports.js +1 -0
  102. package/dist/contracts/owned-ui/extension-ui.d.ts +310 -0
  103. package/dist/contracts/owned-ui/image-attachments.d.ts +36 -0
  104. package/dist/contracts/owned-ui/image-attachments.js +67 -0
  105. package/dist/contracts/owned-ui/index.d.ts +14 -0
  106. package/dist/contracts/owned-ui/index.js +9 -0
  107. package/dist/contracts/owned-ui/model.d.ts +383 -0
  108. package/dist/contracts/owned-ui/prompt-chips.d.ts +15 -0
  109. package/dist/contracts/owned-ui/prompt-chips.js +59 -0
  110. package/dist/contracts/owned-ui/prompt-history.d.ts +55 -0
  111. package/dist/contracts/owned-ui/prompt-history.js +23 -0
  112. package/dist/contracts/owned-ui/prompt-suggestions.d.ts +3 -0
  113. package/dist/contracts/owned-ui/prompt-suggestions.js +44 -0
  114. package/dist/contracts/owned-ui/suggestion-diagnostics.d.ts +22 -0
  115. package/dist/contracts/owned-ui/suggestion-diagnostics.js +9 -0
  116. package/dist/contracts/owned-ui/transcript-lifecycle.d.ts +5 -0
  117. package/dist/contracts/owned-ui/transcript-lifecycle.js +33 -0
  118. package/dist/contracts/owned-ui/validation.d.ts +15 -0
  119. package/dist/contracts/owned-ui/validation.js +554 -0
  120. package/dist/contracts/presentation/index.d.ts +117 -0
  121. package/dist/contracts/presentation/index.js +68 -0
  122. package/dist/features/launch/development-launch.js +36 -0
  123. package/dist/features/launch/index.d.ts +14 -0
  124. package/dist/features/launch/index.js +7 -0
  125. package/dist/features/launch/intent.d.ts +12 -0
  126. package/dist/features/launch/intent.js +8 -0
  127. package/dist/features/launch/prepare-launch.d.ts +11 -0
  128. package/dist/features/launch/prepare-launch.js +14 -0
  129. package/dist/features/launch/profile-paths.d.ts +16 -0
  130. package/dist/features/launch/profile-paths.js +36 -0
  131. package/dist/features/launch/runtime-selection.d.ts +16 -0
  132. package/dist/features/launch/runtime-selection.js +13 -0
  133. package/dist/features/launch/session-context.d.ts +8 -0
  134. package/dist/features/launch/session-context.js +8 -0
  135. package/dist/features/owned-ui/index.d.ts +9 -0
  136. package/dist/features/owned-ui/index.js +6 -0
  137. package/dist/features/owned-ui/project-trust-dialog.d.ts +2 -0
  138. package/dist/features/owned-ui/project-trust-dialog.js +55 -0
  139. package/dist/features/owned-ui/project-trust-prompt.d.ts +23 -0
  140. package/dist/features/owned-ui/project-trust-prompt.js +149 -0
  141. package/dist/features/owned-ui/reference-routes.d.ts +6 -0
  142. package/dist/features/owned-ui/reference-routes.js +6 -0
  143. package/dist/features/owned-ui/reference-screen-app.d.ts +43 -0
  144. package/dist/features/owned-ui/reference-screen-app.js +279 -0
  145. package/dist/features/owned-ui/run.d.ts +17 -0
  146. package/dist/features/owned-ui/run.js +64 -0
  147. package/dist/features/owned-ui/session-fork-prompt.d.ts +8 -0
  148. package/dist/features/owned-ui/session-fork-prompt.js +34 -0
  149. package/dist/features/owned-ui/settings-app.d.ts +21 -0
  150. package/dist/features/owned-ui/settings-app.js +851 -0
  151. package/dist/features/owned-ui/settings-route.d.ts +2 -0
  152. package/dist/features/owned-ui/settings-route.js +2 -0
  153. package/dist/features/prompt-history/image-sidecar.d.ts +32 -0
  154. package/dist/features/prompt-history/image-sidecar.js +130 -0
  155. package/dist/features/prompt-history/index.d.ts +4 -0
  156. package/dist/features/prompt-history/index.js +3 -0
  157. package/dist/features/prompt-history/paths.d.ts +5 -0
  158. package/dist/features/prompt-history/paths.js +17 -0
  159. package/dist/features/prompt-history/service.d.ts +54 -0
  160. package/dist/features/prompt-history/service.js +425 -0
  161. package/dist/features/prompt-history/store.d.ts +16 -0
  162. package/dist/features/prompt-history/store.js +219 -0
  163. package/dist/features/prompt-history/worker.d.ts +9 -0
  164. package/dist/features/prompt-history/worker.js +45 -0
  165. package/dist/features/prompt-suggestions/diagnostics.d.ts +18 -0
  166. package/dist/features/prompt-suggestions/diagnostics.js +82 -0
  167. package/dist/features/prompt-suggestions/index.d.ts +2 -0
  168. package/dist/features/prompt-suggestions/index.js +1 -0
  169. package/dist/foundation/launch-context/index.d.ts +59 -0
  170. package/dist/foundation/launch-context/index.js +136 -0
  171. package/dist/foundation/launch-guardian/index.d.ts +2 -0
  172. package/dist/foundation/launch-guardian/index.js +1 -0
  173. package/dist/foundation/launch-guardian/main.d.ts +33 -0
  174. package/dist/foundation/launch-guardian/main.js +179 -0
  175. package/dist/foundation/lifecycle/commands.js +1 -0
  176. package/dist/foundation/lifecycle/index.d.ts +13 -0
  177. package/dist/foundation/lifecycle/index.js +6 -0
  178. package/dist/foundation/lifecycle/model.d.ts +64 -0
  179. package/dist/foundation/lifecycle/model.js +40 -0
  180. package/dist/foundation/lifecycle/paths.d.ts +30 -0
  181. package/dist/foundation/lifecycle/paths.js +70 -0
  182. package/dist/foundation/lifecycle/session-repository-context.d.ts +18 -0
  183. package/dist/foundation/lifecycle/session-repository-context.js +173 -0
  184. package/dist/foundation/lifecycle/session-selection.d.ts +9 -0
  185. package/dist/foundation/lifecycle/session-selection.js +39 -0
  186. package/dist/foundation/lifecycle/supervisor-startup.d.ts +30 -0
  187. package/dist/foundation/lifecycle/supervisor-startup.js +106 -0
  188. package/dist/foundation/process-containment/darwin-process-inspector.d.ts +5 -0
  189. package/dist/foundation/process-containment/darwin-process-inspector.js +7 -0
  190. package/dist/foundation/process-containment/index.d.ts +8 -0
  191. package/dist/foundation/process-containment/index.js +6 -0
  192. package/dist/foundation/process-containment/linux-process-inspector.d.ts +7 -0
  193. package/dist/foundation/process-containment/linux-process-inspector.js +27 -0
  194. package/dist/foundation/process-containment/native-guardian-containment.d.ts +17 -0
  195. package/dist/foundation/process-containment/native-guardian-containment.js +140 -0
  196. package/dist/foundation/process-containment/windows-process-inspector.d.ts +19 -0
  197. package/dist/foundation/process-containment/windows-process-inspector.js +56 -0
  198. package/dist/foundation/protocol/client.d.ts +18 -0
  199. package/dist/foundation/protocol/client.js +130 -0
  200. package/dist/foundation/protocol/index.d.ts +3 -0
  201. package/dist/foundation/protocol/index.js +2 -0
  202. package/dist/foundation/protocol/messages.d.ts +90 -0
  203. package/dist/foundation/protocol/messages.js +100 -0
  204. package/dist/foundation/release/bootstrap.d.ts +51 -0
  205. package/dist/foundation/release/bootstrap.js +470 -0
  206. package/dist/foundation/release/cohort-state.d.ts +159 -0
  207. package/dist/foundation/release/cohort-state.js +507 -0
  208. package/dist/foundation/release/dependency-certification-retention.d.ts +7 -0
  209. package/dist/foundation/release/dependency-certification-retention.js +88 -0
  210. package/dist/foundation/release/dependency-certification.d.ts +24 -0
  211. package/dist/foundation/release/dependency-certification.js +266 -0
  212. package/dist/foundation/release/dependency-layer.d.ts +78 -0
  213. package/dist/foundation/release/dependency-layer.js +466 -0
  214. package/dist/foundation/release/endpoints.d.ts +24 -0
  215. package/dist/foundation/release/endpoints.js +134 -0
  216. package/dist/foundation/release/immutable-platform.d.ts +6 -0
  217. package/dist/foundation/release/immutable-platform.js +13 -0
  218. package/dist/foundation/release/index.d.ts +33 -0
  219. package/dist/foundation/release/index.js +18 -0
  220. package/dist/foundation/release/ordinary-launch-selection.d.ts +14 -0
  221. package/dist/foundation/release/ordinary-launch-selection.js +15 -0
  222. package/dist/foundation/release/release-gc.d.ts +71 -0
  223. package/dist/foundation/release/release-gc.js +764 -0
  224. package/dist/foundation/release/release-store.d.ts +49 -0
  225. package/dist/foundation/release/release-store.js +235 -0
  226. package/dist/foundation/release/release.d.ts +43 -0
  227. package/dist/foundation/release/release.js +215 -0
  228. package/dist/foundation/release/restart-certification.d.ts +68 -0
  229. package/dist/foundation/release/restart-certification.js +227 -0
  230. package/dist/foundation/release/types.d.ts +11 -0
  231. package/dist/foundation/release/types.js +1 -0
  232. package/dist/foundation/release/update-activation.d.ts +72 -0
  233. package/dist/foundation/release/update-activation.js +204 -0
  234. package/dist/foundation/release/update-launch.d.ts +6 -0
  235. package/dist/foundation/release/update-launch.js +17 -0
  236. package/dist/foundation/release/update-recovery.d.ts +82 -0
  237. package/dist/foundation/release/update-recovery.js +386 -0
  238. package/dist/foundation/release/update-transaction.d.ts +42 -0
  239. package/dist/foundation/release/update-transaction.js +101 -0
  240. package/dist/foundation/release/update.d.ts +142 -0
  241. package/dist/foundation/release/update.js +773 -0
  242. package/dist/foundation/release/warmup.d.ts +3 -0
  243. package/dist/foundation/release/warmup.js +47 -0
  244. package/dist/foundation/startup/index.d.ts +4 -0
  245. package/dist/foundation/startup/index.js +2 -0
  246. package/dist/foundation/startup/startup-budget.d.ts +46 -0
  247. package/dist/foundation/startup/startup-budget.js +42 -0
  248. package/dist/foundation/startup/startup-descriptor.js +34 -0
  249. package/dist/foundation/startup/startup-runtime.d.ts +27 -0
  250. package/dist/foundation/startup/startup-runtime.js +128 -0
  251. package/dist/foundation/storage/control-store.d.ts +18 -0
  252. package/dist/foundation/storage/control-store.js +342 -0
  253. package/dist/foundation/storage/index.d.ts +1 -0
  254. package/dist/foundation/storage/index.js +1 -0
  255. package/dist/foundation/supervision/index.d.ts +3 -0
  256. package/dist/foundation/supervision/index.js +3 -0
  257. package/dist/foundation/supervision/main.d.ts +1 -0
  258. package/dist/foundation/supervision/main.js +84 -0
  259. package/dist/foundation/supervision/paths.d.ts +1 -0
  260. package/dist/foundation/supervision/paths.js +1 -0
  261. package/dist/foundation/supervision/server.d.ts +46 -0
  262. package/dist/foundation/supervision/server.js +584 -0
  263. package/dist/foundation/terminal-cleanup/fatal-exit.d.ts +12 -0
  264. package/dist/foundation/terminal-cleanup/fatal-exit.js +87 -0
  265. package/dist/foundation/terminal-cleanup/index.d.ts +3 -0
  266. package/dist/foundation/terminal-cleanup/index.js +2 -0
  267. package/dist/foundation/terminal-cleanup/terminal-reset.d.ts +4 -0
  268. package/dist/foundation/terminal-cleanup/terminal-reset.js +40 -0
  269. package/dist/integrations/pi/components/components.d.ts +4 -0
  270. package/dist/integrations/pi/components/components.js +64 -0
  271. package/dist/integrations/pi/components/conformance.d.ts +18 -0
  272. package/dist/integrations/pi/components/conformance.js +70 -0
  273. package/dist/integrations/pi/components/editor-interaction.d.ts +38 -0
  274. package/dist/integrations/pi/components/editor-interaction.js +1 -0
  275. package/dist/integrations/pi/components/history-editor-loader.d.ts +5 -0
  276. package/dist/integrations/pi/components/history-editor-loader.js +5 -0
  277. package/dist/integrations/pi/components/index.d.ts +26 -0
  278. package/dist/integrations/pi/components/index.js +16 -0
  279. package/dist/integrations/pi/components/modal-frame.d.ts +41 -0
  280. package/dist/integrations/pi/components/modal-frame.js +110 -0
  281. package/dist/integrations/pi/components/models-dialog.d.ts +55 -0
  282. package/dist/integrations/pi/components/models-dialog.js +403 -0
  283. package/dist/integrations/pi/components/owned-editor-ux.d.ts +74 -0
  284. package/dist/integrations/pi/components/owned-editor-ux.js +1094 -0
  285. package/dist/integrations/pi/components/path-word-ranges.d.ts +2 -0
  286. package/dist/integrations/pi/components/path-word-ranges.js +37 -0
  287. package/dist/integrations/pi/components/prompt-input-port.d.ts +18 -0
  288. package/dist/integrations/pi/components/prompt-input-port.js +1 -0
  289. package/dist/integrations/pi/components/resources/builtin-themes.d.ts +167 -0
  290. package/dist/integrations/pi/components/resources/builtin-themes.js +168 -0
  291. package/dist/integrations/pi/components/shell-components.d.ts +7 -0
  292. package/dist/integrations/pi/components/shell-components.js +7 -0
  293. package/dist/integrations/pi/components/shell-editor-autocomplete.d.ts +23 -0
  294. package/dist/integrations/pi/components/shell-editor-autocomplete.js +357 -0
  295. package/dist/integrations/pi/components/shell-extension-ui.d.ts +35 -0
  296. package/dist/integrations/pi/components/shell-extension-ui.js +282 -0
  297. package/dist/integrations/pi/components/shell-footer-status.d.ts +8 -0
  298. package/dist/integrations/pi/components/shell-footer-status.js +287 -0
  299. package/dist/integrations/pi/components/shell-hotkey-sections.d.ts +7 -0
  300. package/dist/integrations/pi/components/shell-hotkey-sections.js +29 -0
  301. package/dist/integrations/pi/components/shell-presenters-info.d.ts +73 -0
  302. package/dist/integrations/pi/components/shell-presenters-info.js +188 -0
  303. package/dist/integrations/pi/components/shell-presenters-transcript.d.ts +29 -0
  304. package/dist/integrations/pi/components/shell-presenters-transcript.js +435 -0
  305. package/dist/integrations/pi/components/shell-selectors-dialogs.d.ts +134 -0
  306. package/dist/integrations/pi/components/shell-selectors-dialogs.js +286 -0
  307. package/dist/integrations/pi/components/shell-shared-facade.d.ts +233 -0
  308. package/dist/integrations/pi/components/shell-shared-facade.js +92 -0
  309. package/dist/integrations/pi/components/skills-command.d.ts +49 -0
  310. package/dist/integrations/pi/components/skills-command.js +119 -0
  311. package/dist/integrations/pi/components/skills-dialog.d.ts +9 -0
  312. package/dist/integrations/pi/components/skills-dialog.js +128 -0
  313. package/dist/integrations/pi/components/submitted-prompt-adapter.d.ts +17 -0
  314. package/dist/integrations/pi/components/submitted-prompt-adapter.js +52 -0
  315. package/dist/integrations/pi/components/theme.d.ts +5 -0
  316. package/dist/integrations/pi/components/theme.js +11 -0
  317. package/dist/integrations/pi/components/thinking-selector-dialog.d.ts +8 -0
  318. package/dist/integrations/pi/components/thinking-selector-dialog.js +22 -0
  319. package/dist/integrations/pi/components/tool-image-presentation.d.ts +21 -0
  320. package/dist/integrations/pi/components/tool-image-presentation.js +83 -0
  321. package/dist/integrations/pi/components/tool-result-adapter.d.ts +6 -0
  322. package/dist/integrations/pi/components/tool-result-adapter.js +27 -0
  323. package/dist/integrations/pi/components/transcript-image-resolver.d.ts +7 -0
  324. package/dist/integrations/pi/components/transcript-image-resolver.js +19 -0
  325. package/dist/integrations/pi/components/upstream/adjacent/core/keybindings.d.ts +445 -0
  326. package/dist/integrations/pi/components/upstream/adjacent/core/keybindings.js +371 -0
  327. package/dist/integrations/pi/components/upstream/assets/earendil-image.json +12 -0
  328. package/dist/integrations/pi/components/upstream/components/countdown-timer.d.ts +13 -0
  329. package/dist/integrations/pi/components/upstream/components/daxnuts.d.ts +29 -0
  330. package/dist/integrations/pi/components/upstream/components/daxnuts.js +146 -0
  331. package/dist/integrations/pi/components/upstream/components/earendil-announcement.d.ts +4 -0
  332. package/dist/integrations/pi/components/upstream/components/earendil-announcement.js +48 -0
  333. package/dist/integrations/pi/components/upstream/components/extension-editor.d.ts +22 -0
  334. package/dist/integrations/pi/components/upstream/components/extension-editor.js +89 -0
  335. package/dist/integrations/pi/components/upstream/components/extension-input.d.ts +17 -0
  336. package/dist/integrations/pi/components/upstream/components/extension-input.js +73 -0
  337. package/dist/integrations/pi/components/upstream/components/extension-selector.d.ts +15 -0
  338. package/dist/integrations/pi/components/upstream/components/extension-selector.js +93 -0
  339. package/dist/integrations/pi/components/upstream/components/mermaid.js +81 -0
  340. package/dist/integrations/pi/components/upstream/components/owned-editor.d.ts +52 -0
  341. package/dist/integrations/pi/components/upstream/components/owned-editor.js +222 -0
  342. package/dist/integrations/pi/components/upstream/components/scoped-models-selector.d.ts +60 -0
  343. package/dist/integrations/pi/components/upstream/components/scoped-models-selector.js +347 -0
  344. package/dist/integrations/pi/components/upstream/components/session-footer.d.ts +12 -0
  345. package/dist/integrations/pi/components/upstream/components/session-footer.js +150 -0
  346. package/dist/integrations/pi/components/upstream/components/session-selector-search.js +161 -0
  347. package/dist/integrations/pi/components/upstream/components/session-selector.d.ts +97 -0
  348. package/dist/integrations/pi/components/upstream/components/session-selector.js +935 -0
  349. package/dist/integrations/pi/components/upstream/components/skill-invocation-message.d.ts +21 -0
  350. package/dist/integrations/pi/components/upstream/components/skill-invocation-message.js +54 -0
  351. package/dist/integrations/pi/components/upstream/components/status-indicator.d.ts +35 -0
  352. package/dist/integrations/pi/components/upstream/components/status-indicator.js +69 -0
  353. package/dist/integrations/pi/components/upstream/components/thinking-selector.d.ts +36 -0
  354. package/dist/integrations/pi/components/upstream/components/thinking-selector.js +153 -0
  355. package/dist/integrations/pi/components/upstream/components/tool-execution.d.ts +67 -0
  356. package/dist/integrations/pi/components/upstream/components/tool-execution.js +365 -0
  357. package/dist/integrations/pi/components/upstream/components/tree-selector.d.ts +102 -0
  358. package/dist/integrations/pi/components/upstream/components/tree-selector.js +1294 -0
  359. package/dist/integrations/pi/components/upstream/components/trust-selector.d.ts +33 -0
  360. package/dist/integrations/pi/components/upstream/components/trust-selector.js +87 -0
  361. package/dist/integrations/pi/components/upstream/external-editor.js +43 -0
  362. package/dist/integrations/pi/components/upstream/history/editor-core.d.ts +289 -0
  363. package/dist/integrations/pi/components/upstream/history/editor-core.js +2145 -0
  364. package/dist/integrations/pi/components/upstream/history/kill-ring.d.ts +35 -0
  365. package/dist/integrations/pi/components/upstream/history/kill-ring.js +51 -0
  366. package/dist/integrations/pi/components/upstream/history/printable-key.d.ts +1 -0
  367. package/dist/integrations/pi/components/upstream/history/printable-key.js +43 -0
  368. package/dist/integrations/pi/components/upstream/history/text-helpers.d.ts +17 -0
  369. package/dist/integrations/pi/components/upstream/history/text-helpers.js +34 -0
  370. package/dist/integrations/pi/components/upstream/history/undo-stack.d.ts +25 -0
  371. package/dist/integrations/pi/components/upstream/history/undo-stack.js +39 -0
  372. package/dist/integrations/pi/components/upstream/history/word-navigation.d.ts +24 -0
  373. package/dist/integrations/pi/components/upstream/history/word-navigation.js +103 -0
  374. package/dist/integrations/pi/components/upstream/model-search.d.ts +18 -0
  375. package/dist/integrations/pi/components/upstream/theme/theme-controller.d.ts +33 -0
  376. package/dist/integrations/pi/components/upstream/theme/theme-controller.js +114 -0
  377. package/dist/integrations/pi/components/upstream/theme/theme.d.ts +61 -0
  378. package/dist/integrations/pi/components/upstream/theme/theme.js +337 -0
  379. package/dist/integrations/pi/engine/adapter.d.ts +140 -0
  380. package/dist/integrations/pi/engine/adapter.js +663 -0
  381. package/dist/integrations/pi/engine/changelog.d.ts +2 -0
  382. package/dist/integrations/pi/engine/changelog.js +63 -0
  383. package/dist/integrations/pi/engine/command-dispatch.d.ts +41 -0
  384. package/dist/integrations/pi/engine/command-dispatch.js +125 -0
  385. package/dist/integrations/pi/engine/compaction-progress.d.ts +24 -0
  386. package/dist/integrations/pi/engine/compaction-progress.js +97 -0
  387. package/dist/integrations/pi/engine/conformance.d.ts +39 -0
  388. package/dist/integrations/pi/engine/conformance.js +140 -0
  389. package/dist/integrations/pi/engine/event-delivery.d.ts +100 -0
  390. package/dist/integrations/pi/engine/event-delivery.js +184 -0
  391. package/dist/integrations/pi/engine/extension-ui-binding.d.ts +35 -0
  392. package/dist/integrations/pi/engine/extension-ui-binding.js +81 -0
  393. package/dist/integrations/pi/engine/http-dispatcher.d.ts +4 -0
  394. package/dist/integrations/pi/engine/http-dispatcher.js +25 -0
  395. package/dist/integrations/pi/engine/index.d.ts +18 -0
  396. package/dist/integrations/pi/engine/index.js +10 -0
  397. package/dist/integrations/pi/engine/message-values.d.ts +29 -0
  398. package/dist/integrations/pi/engine/message-values.js +169 -0
  399. package/dist/integrations/pi/engine/package-integration.d.ts +13 -0
  400. package/dist/integrations/pi/engine/package-integration.js +118 -0
  401. package/dist/integrations/pi/engine/pending-delivery.d.ts +30 -0
  402. package/dist/integrations/pi/engine/pending-delivery.js +156 -0
  403. package/dist/integrations/pi/engine/pi-settings-metadata.json +397 -0
  404. package/dist/integrations/pi/engine/project-trust-preflight.d.ts +21 -0
  405. package/dist/integrations/pi/engine/project-trust-preflight.js +46 -0
  406. package/dist/integrations/pi/engine/prompt-suggestions.d.ts +30 -0
  407. package/dist/integrations/pi/engine/prompt-suggestions.js +102 -0
  408. package/dist/integrations/pi/engine/provider-authentication.d.ts +34 -0
  409. package/dist/integrations/pi/engine/provider-authentication.js +209 -0
  410. package/dist/integrations/pi/engine/repository-pr-rest.d.ts +21 -0
  411. package/dist/integrations/pi/engine/repository-pr-rest.js +155 -0
  412. package/dist/integrations/pi/engine/repository-pr.d.ts +16 -0
  413. package/dist/integrations/pi/engine/repository-pr.js +79 -0
  414. package/dist/integrations/pi/engine/resource-catalog.d.ts +50 -0
  415. package/dist/integrations/pi/engine/resource-catalog.js +299 -0
  416. package/dist/integrations/pi/engine/resources/changelog.json +12 -0
  417. package/dist/integrations/pi/engine/runtime-integration.d.ts +53 -0
  418. package/dist/integrations/pi/engine/runtime-integration.js +118 -0
  419. package/dist/integrations/pi/engine/session-events.d.ts +48 -0
  420. package/dist/integrations/pi/engine/session-events.js +223 -0
  421. package/dist/integrations/pi/engine/session-integration.d.ts +67 -0
  422. package/dist/integrations/pi/engine/session-integration.js +195 -0
  423. package/dist/integrations/pi/engine/session-runtime.d.ts +98 -0
  424. package/dist/integrations/pi/engine/session-runtime.js +412 -0
  425. package/dist/integrations/pi/engine/session-selection.d.ts +28 -0
  426. package/dist/integrations/pi/engine/session-selection.js +90 -0
  427. package/dist/integrations/pi/engine/settings-bridge.d.ts +121 -0
  428. package/dist/integrations/pi/engine/settings-bridge.js +516 -0
  429. package/dist/integrations/pi/engine/settings-metadata.d.ts +31 -0
  430. package/dist/integrations/pi/engine/settings-metadata.js +67 -0
  431. package/dist/integrations/pi/engine/settings-port.d.ts +42 -0
  432. package/dist/integrations/pi/engine/settings-port.js +363 -0
  433. package/dist/integrations/pi/engine/tool-rendering.d.ts +13 -0
  434. package/dist/integrations/pi/engine/tool-rendering.js +145 -0
  435. package/dist/integrations/pi/engine/transcript-image-assets.d.ts +11 -0
  436. package/dist/integrations/pi/engine/transcript-image-assets.js +86 -0
  437. package/dist/integrations/pi/engine/transcript-projection.d.ts +39 -0
  438. package/dist/integrations/pi/engine/transcript-projection.js +440 -0
  439. package/dist/integrations/pi/engine/usage-view.d.ts +4 -0
  440. package/dist/integrations/pi/engine/usage-view.js +56 -0
  441. package/dist/integrations/pi/engine/windows-filesystem-hygiene.d.ts +21 -0
  442. package/dist/integrations/pi/engine/windows-filesystem-hygiene.js +55 -0
  443. package/dist/integrations/pi/engine/workflow-contexts.d.ts +66 -0
  444. package/dist/integrations/pi/engine/workflow-contexts.js +360 -0
  445. package/dist/integrations/pi/engine/workflow-runner.d.ts +60 -0
  446. package/dist/integrations/pi/engine/workflow-runner.js +536 -0
  447. package/dist/integrations/pi/engine/workflow-support.d.ts +38 -0
  448. package/dist/integrations/pi/engine/workflow-support.js +386 -0
  449. package/dist/integrations/pi/engine/workflows.d.ts +308 -0
  450. package/dist/integrations/pi/engine/workflows.js +81 -0
  451. package/dist/integrations/pi/startup-public.d.ts +2 -0
  452. package/dist/integrations/pi/startup-public.js +2254 -0
  453. package/dist/integrations/pi/startup-public.manifest.json +12679 -0
  454. package/dist/integrations/pi/tui-runtime/adapter.d.ts +58 -0
  455. package/dist/integrations/pi/tui-runtime/adapter.js +792 -0
  456. package/dist/integrations/pi/tui-runtime/contracts.d.ts +158 -0
  457. package/dist/integrations/pi/tui-runtime/contracts.js +1 -0
  458. package/dist/integrations/pi/tui-runtime/damage-aware-terminal.d.ts +88 -0
  459. package/dist/integrations/pi/tui-runtime/damage-aware-terminal.js +439 -0
  460. package/dist/integrations/pi/tui-runtime/index.d.ts +9 -0
  461. package/dist/integrations/pi/tui-runtime/index.js +5 -0
  462. package/dist/integrations/pi/tui-runtime/input-presentation-coordinator.d.ts +39 -0
  463. package/dist/integrations/pi/tui-runtime/input-presentation-coordinator.js +139 -0
  464. package/dist/integrations/pi/tui-runtime/mouse-report-input.d.ts +19 -0
  465. package/dist/integrations/pi/tui-runtime/mouse-report-input.js +91 -0
  466. package/dist/integrations/pi/tui-runtime/overlay-geometry.d.ts +32 -0
  467. package/dist/integrations/pi/tui-runtime/overlay-geometry.js +158 -0
  468. package/dist/integrations/pi/tui-runtime/presentation-adapter.d.ts +4 -0
  469. package/dist/integrations/pi/tui-runtime/presentation-adapter.js +48 -0
  470. package/dist/native/darwin-arm64/manifest.json +4 -4
  471. package/dist/native/darwin-arm64/process-guardian +0 -0
  472. package/dist/native/linux-x64/manifest.json +3 -3
  473. package/dist/native/linux-x64/process-guardian +0 -0
  474. package/dist/native/win32-x64/manifest.json +3 -3
  475. package/dist/native/win32-x64/process-guardian.exe +0 -0
  476. package/dist/product-identity.d.ts +37 -0
  477. package/dist/product-identity.js +119 -0
  478. package/dist/product-identity.json +87 -0
  479. package/dist/runtime-payload-inventory.json +134179 -0
  480. package/dist/ui/apps/contracts.d.ts +72 -0
  481. package/dist/ui/apps/host.d.ts +42 -0
  482. package/dist/ui/apps/host.js +156 -0
  483. package/dist/ui/apps/index.d.ts +5 -0
  484. package/dist/ui/apps/index.js +3 -0
  485. package/dist/ui/apps/registry.d.ts +12 -0
  486. package/dist/ui/apps/registry.js +33 -0
  487. package/dist/ui/components/dialog-panel.d.ts +37 -0
  488. package/dist/ui/components/dialog-panel.js +58 -0
  489. package/dist/ui/components/frame.d.ts +22 -0
  490. package/dist/ui/components/frame.js +55 -0
  491. package/dist/ui/components/index.d.ts +50 -0
  492. package/dist/ui/components/index.js +26 -0
  493. package/dist/ui/components/line-input.d.ts +68 -0
  494. package/dist/ui/components/line-input.js +224 -0
  495. package/dist/ui/components/list-block.d.ts +70 -0
  496. package/dist/ui/components/list-block.js +189 -0
  497. package/dist/ui/components/list-view.d.ts +60 -0
  498. package/dist/ui/components/list-view.js +84 -0
  499. package/dist/ui/components/mouse.d.ts +25 -0
  500. package/dist/ui/components/mouse.js +72 -0
  501. package/dist/ui/components/progress-status.d.ts +9 -0
  502. package/dist/ui/components/progress-status.js +25 -0
  503. package/dist/ui/components/prompt-input.d.ts +32 -0
  504. package/dist/ui/components/prompt-input.js +51 -0
  505. package/dist/ui/components/scrollbar.d.ts +88 -0
  506. package/dist/ui/components/scrollbar.js +137 -0
  507. package/dist/ui/components/selection-copy.d.ts +24 -0
  508. package/dist/ui/components/selection-copy.js +39 -0
  509. package/dist/ui/components/shortcut-hints.d.ts +7 -0
  510. package/dist/ui/components/shortcut-hints.js +12 -0
  511. package/dist/ui/components/shortcuts.d.ts +60 -0
  512. package/dist/ui/components/shortcuts.js +85 -0
  513. package/dist/ui/components/spans.d.ts +28 -0
  514. package/dist/ui/components/spans.js +266 -0
  515. package/dist/ui/components/submitted-prompt.d.ts +23 -0
  516. package/dist/ui/components/submitted-prompt.js +50 -0
  517. package/dist/ui/components/surface.d.ts +20 -0
  518. package/dist/ui/components/surface.js +44 -0
  519. package/dist/ui/components/text-selection.d.ts +62 -0
  520. package/dist/ui/components/text-selection.js +210 -0
  521. package/dist/ui/components/text.d.ts +38 -0
  522. package/dist/ui/components/text.js +185 -0
  523. package/dist/ui/components/theme.d.ts +19 -0
  524. package/dist/ui/components/theme.js +9 -0
  525. package/dist/ui/components/transcript-viewport.d.ts +187 -0
  526. package/dist/ui/components/transcript-viewport.js +886 -0
  527. package/dist/ui/components/value-menu.d.ts +43 -0
  528. package/dist/ui/components/value-menu.js +41 -0
  529. package/dist/ui/components/visible-hyperlinks.d.ts +26 -0
  530. package/dist/ui/components/visible-hyperlinks.js +97 -0
  531. package/dist/ui/settings/declarations.d.ts +127 -0
  532. package/dist/ui/settings/declarations.js +124 -0
  533. package/dist/ui/settings/index.d.ts +10 -0
  534. package/dist/ui/settings/index.js +5 -0
  535. package/dist/ui/settings/manager.d.ts +54 -0
  536. package/dist/ui/settings/manager.js +256 -0
  537. package/dist/ui/settings/migrations.d.ts +13 -0
  538. package/dist/ui/settings/migrations.js +92 -0
  539. package/dist/ui/settings/sections.d.ts +52 -0
  540. package/dist/ui/settings/sections.js +112 -0
  541. package/docs/architecture/boundaries.md +17 -13
  542. package/docs/architecture/code-documentation.md +77 -0
  543. package/docs/architecture/history-editor-provenance.md +100 -0
  544. package/docs/architecture/internal-naming.md +94 -0
  545. package/docs/architecture/process-guardian-provenance.md +3 -1
  546. package/docs/architecture/project-structure.md +72 -30
  547. package/docs/architecture/prompt-suggestions.md +68 -0
  548. package/docs/architecture/resource-and-data-policy.md +28 -2
  549. package/docs/architecture/response-copy-delivery.md +85 -0
  550. package/docs/architecture/terminal-host-proof-gate.md +1 -1
  551. package/docs/architecture/terminal-host-spike-evidence.md +1 -1
  552. package/docs/architecture/tool-image-presentation.md +62 -0
  553. package/docs/architecture/toolchain.md +34 -10
  554. package/docs/architecture/ui-reference-provenance.md +73 -6
  555. package/docs/ci-release-runbook.md +266 -77
  556. package/docs/features/launch-profiles.md +24 -17
  557. package/docs/features/modal-content-interaction.md +38 -0
  558. package/docs/features/prompt-history.md +149 -0
  559. package/docs/local-worktree-cleanup.md +214 -0
  560. package/docs/manual-code-streaming-cleanup.md +88 -0
  561. package/docs/manual-ghost-link-baseline.md +89 -0
  562. package/docs/manual-launch-instance-acceptance.md +12 -35
  563. package/docs/manual-owned-ui-checkpoint.md +79 -0
  564. package/docs/manual-pi-boundary-candidate.md +4 -5
  565. package/docs/manual-terminal-colour-check.md +4 -3
  566. package/docs/openspec-archive-automation.md +269 -0
  567. package/docs/repository-governance-live-acceptance.md +77 -0
  568. package/docs/validation.md +105 -0
  569. package/package.json +53 -34
  570. package/dist/src/cli/capabilities.d.ts +0 -15
  571. package/dist/src/cli/capabilities.js +0 -7
  572. package/dist/src/cli/dispatch.d.ts +0 -31
  573. package/dist/src/cli/dispatch.js +0 -123
  574. package/dist/src/cli/index.d.ts +0 -5
  575. package/dist/src/cli/index.js +0 -5
  576. package/dist/src/cli/packages.d.ts +0 -23
  577. package/dist/src/cli/packages.js +0 -84
  578. package/dist/src/cli/version-stats.d.ts +0 -16
  579. package/dist/src/cli/version-stats.js +0 -72
  580. package/dist/src/cli/version.d.ts +0 -2
  581. package/dist/src/cli/version.js +0 -23
  582. package/dist/src/composition/index.d.ts +0 -48
  583. package/dist/src/composition/index.js +0 -258
  584. package/dist/src/features/launch/development-launch.js +0 -28
  585. package/dist/src/features/launch/index.d.ts +0 -7
  586. package/dist/src/features/launch/index.js +0 -7
  587. package/dist/src/features/launch/intent.d.ts +0 -7
  588. package/dist/src/features/launch/intent.js +0 -4
  589. package/dist/src/features/launch/prepare-launch.d.ts +0 -13
  590. package/dist/src/features/launch/prepare-launch.js +0 -21
  591. package/dist/src/features/launch/profile-paths.d.ts +0 -15
  592. package/dist/src/features/launch/profile-paths.js +0 -31
  593. package/dist/src/features/launch/profiles.d.ts +0 -12
  594. package/dist/src/features/launch/profiles.js +0 -26
  595. package/dist/src/features/launch/runtime-selection.d.ts +0 -19
  596. package/dist/src/features/launch/runtime-selection.js +0 -13
  597. package/dist/src/features/owned-ui/customization.d.ts +0 -38
  598. package/dist/src/features/owned-ui/customization.js +0 -108
  599. package/dist/src/features/owned-ui/diagnostics.d.ts +0 -33
  600. package/dist/src/features/owned-ui/diagnostics.js +0 -94
  601. package/dist/src/features/owned-ui/index.d.ts +0 -4
  602. package/dist/src/features/owned-ui/index.js +0 -4
  603. package/dist/src/features/owned-ui/run.d.ts +0 -11
  604. package/dist/src/features/owned-ui/run.js +0 -15
  605. package/dist/src/features/owned-ui/settings-app.d.ts +0 -22
  606. package/dist/src/features/owned-ui/settings-app.js +0 -633
  607. package/dist/src/features/workspace/capabilities.d.ts +0 -31
  608. package/dist/src/features/workspace/capabilities.js +0 -75
  609. package/dist/src/features/workspace/index.d.ts +0 -6
  610. package/dist/src/features/workspace/index.js +0 -6
  611. package/dist/src/features/workspace/presentation.d.ts +0 -30
  612. package/dist/src/features/workspace/presentation.js +0 -70
  613. package/dist/src/features/workspace/reconciliation.d.ts +0 -15
  614. package/dist/src/features/workspace/reconciliation.js +0 -82
  615. package/dist/src/features/workspace/reducer.d.ts +0 -42
  616. package/dist/src/features/workspace/reducer.js +0 -213
  617. package/dist/src/features/workspace/router.d.ts +0 -31
  618. package/dist/src/features/workspace/router.js +0 -124
  619. package/dist/src/features/workspace/store.d.ts +0 -17
  620. package/dist/src/features/workspace/store.js +0 -54
  621. package/dist/src/foundation/agent-engine-contracts/capability-ports.d.ts +0 -95
  622. package/dist/src/foundation/agent-engine-contracts/domain-validation.js +0 -89
  623. package/dist/src/foundation/agent-engine-contracts/domain.d.ts +0 -116
  624. package/dist/src/foundation/agent-engine-contracts/index.d.ts +0 -8
  625. package/dist/src/foundation/agent-engine-contracts/index.js +0 -8
  626. package/dist/src/foundation/agent-engine-contracts/package-ports.d.ts +0 -54
  627. package/dist/src/foundation/launch-guardian/index.d.ts +0 -1
  628. package/dist/src/foundation/launch-guardian/index.js +0 -1
  629. package/dist/src/foundation/launch-guardian/main.d.ts +0 -31
  630. package/dist/src/foundation/launch-guardian/main.js +0 -165
  631. package/dist/src/foundation/lifecycle/index.d.ts +0 -4
  632. package/dist/src/foundation/lifecycle/index.js +0 -4
  633. package/dist/src/foundation/lifecycle/model.d.ts +0 -64
  634. package/dist/src/foundation/lifecycle/model.js +0 -40
  635. package/dist/src/foundation/lifecycle/paths.d.ts +0 -10
  636. package/dist/src/foundation/lifecycle/paths.js +0 -42
  637. package/dist/src/foundation/native-host-protocol/codec.d.ts +0 -11
  638. package/dist/src/foundation/native-host-protocol/codec.js +0 -56
  639. package/dist/src/foundation/native-host-protocol/evidence.d.ts +0 -67
  640. package/dist/src/foundation/native-host-protocol/evidence.js +0 -141
  641. package/dist/src/foundation/native-host-protocol/index.d.ts +0 -4
  642. package/dist/src/foundation/native-host-protocol/index.js +0 -4
  643. package/dist/src/foundation/native-host-protocol/messages.d.ts +0 -56
  644. package/dist/src/foundation/native-host-protocol/messages.js +0 -149
  645. package/dist/src/foundation/native-host-protocol/proof-gate.d.ts +0 -13
  646. package/dist/src/foundation/native-host-protocol/proof-gate.js +0 -33
  647. package/dist/src/foundation/owned-ui-contracts/extension-ui.d.ts +0 -302
  648. package/dist/src/foundation/owned-ui-contracts/index.d.ts +0 -3
  649. package/dist/src/foundation/owned-ui-contracts/index.js +0 -3
  650. package/dist/src/foundation/owned-ui-contracts/model.d.ts +0 -241
  651. package/dist/src/foundation/owned-ui-contracts/validation.d.ts +0 -11
  652. package/dist/src/foundation/owned-ui-contracts/validation.js +0 -395
  653. package/dist/src/foundation/owned-ui-settings/declarations.d.ts +0 -13
  654. package/dist/src/foundation/owned-ui-settings/declarations.js +0 -39
  655. package/dist/src/foundation/owned-ui-settings/index.d.ts +0 -6
  656. package/dist/src/foundation/owned-ui-settings/index.js +0 -6
  657. package/dist/src/foundation/owned-ui-settings/migrations.d.ts +0 -13
  658. package/dist/src/foundation/owned-ui-settings/migrations.js +0 -28
  659. package/dist/src/foundation/owned-ui-settings/sections.d.ts +0 -70
  660. package/dist/src/foundation/owned-ui-settings/sections.js +0 -93
  661. package/dist/src/foundation/owned-ui-settings/session.d.ts +0 -44
  662. package/dist/src/foundation/owned-ui-settings/session.js +0 -145
  663. package/dist/src/foundation/owned-ui-settings/store.d.ts +0 -28
  664. package/dist/src/foundation/owned-ui-settings/store.js +0 -90
  665. package/dist/src/foundation/pi-component-adapter/components.d.ts +0 -4
  666. package/dist/src/foundation/pi-component-adapter/components.js +0 -64
  667. package/dist/src/foundation/pi-component-adapter/conformance.d.ts +0 -17
  668. package/dist/src/foundation/pi-component-adapter/conformance.js +0 -69
  669. package/dist/src/foundation/pi-component-adapter/index.d.ts +0 -13
  670. package/dist/src/foundation/pi-component-adapter/index.js +0 -13
  671. package/dist/src/foundation/pi-component-adapter/resources/builtin-themes.d.ts +0 -165
  672. package/dist/src/foundation/pi-component-adapter/resources/builtin-themes.js +0 -166
  673. package/dist/src/foundation/pi-component-adapter/shell-components.d.ts +0 -6
  674. package/dist/src/foundation/pi-component-adapter/shell-components.js +0 -6
  675. package/dist/src/foundation/pi-component-adapter/shell-editor-autocomplete.d.ts +0 -11
  676. package/dist/src/foundation/pi-component-adapter/shell-editor-autocomplete.js +0 -162
  677. package/dist/src/foundation/pi-component-adapter/shell-extension-ui.d.ts +0 -35
  678. package/dist/src/foundation/pi-component-adapter/shell-extension-ui.js +0 -279
  679. package/dist/src/foundation/pi-component-adapter/shell-footer-status.d.ts +0 -7
  680. package/dist/src/foundation/pi-component-adapter/shell-footer-status.js +0 -189
  681. package/dist/src/foundation/pi-component-adapter/shell-presenters-transcript.d.ts +0 -57
  682. package/dist/src/foundation/pi-component-adapter/shell-presenters-transcript.js +0 -429
  683. package/dist/src/foundation/pi-component-adapter/shell-selectors-dialogs.d.ts +0 -113
  684. package/dist/src/foundation/pi-component-adapter/shell-selectors-dialogs.js +0 -235
  685. package/dist/src/foundation/pi-component-adapter/shell-shared-facade.d.ts +0 -116
  686. package/dist/src/foundation/pi-component-adapter/shell-shared-facade.js +0 -87
  687. package/dist/src/foundation/pi-component-adapter/theme.d.ts +0 -1
  688. package/dist/src/foundation/pi-component-adapter/theme.js +0 -1
  689. package/dist/src/foundation/pi-component-adapter/upstream/adjacent/core/keybindings.d.ts +0 -422
  690. package/dist/src/foundation/pi-component-adapter/upstream/adjacent/core/keybindings.js +0 -296
  691. package/dist/src/foundation/pi-component-adapter/upstream/components/countdown-timer.d.ts +0 -10
  692. package/dist/src/foundation/pi-component-adapter/upstream/components/custom-entry.d.ts +0 -17
  693. package/dist/src/foundation/pi-component-adapter/upstream/components/custom-entry.js +0 -51
  694. package/dist/src/foundation/pi-component-adapter/upstream/components/daxnuts.d.ts +0 -22
  695. package/dist/src/foundation/pi-component-adapter/upstream/components/daxnuts.js +0 -142
  696. package/dist/src/foundation/pi-component-adapter/upstream/components/earendil-announcement.d.ts +0 -4
  697. package/dist/src/foundation/pi-component-adapter/upstream/components/earendil-announcement.js +0 -19
  698. package/dist/src/foundation/pi-component-adapter/upstream/components/extension-editor.d.ts +0 -17
  699. package/dist/src/foundation/pi-component-adapter/upstream/components/extension-editor.js +0 -81
  700. package/dist/src/foundation/pi-component-adapter/upstream/components/first-time-setup.d.ts +0 -24
  701. package/dist/src/foundation/pi-component-adapter/upstream/components/first-time-setup.js +0 -105
  702. package/dist/src/foundation/pi-component-adapter/upstream/components/markdown-transform.d.ts +0 -2
  703. package/dist/src/foundation/pi-component-adapter/upstream/components/markdown-transform.js +0 -18
  704. package/dist/src/foundation/pi-component-adapter/upstream/components/mermaid.js +0 -77
  705. package/dist/src/foundation/pi-component-adapter/upstream/components/owned-editor.d.ts +0 -18
  706. package/dist/src/foundation/pi-component-adapter/upstream/components/owned-editor.js +0 -55
  707. package/dist/src/foundation/pi-component-adapter/upstream/components/scoped-models-selector.d.ts +0 -55
  708. package/dist/src/foundation/pi-component-adapter/upstream/components/scoped-models-selector.js +0 -342
  709. package/dist/src/foundation/pi-component-adapter/upstream/components/session-footer.d.ts +0 -10
  710. package/dist/src/foundation/pi-component-adapter/upstream/components/session-footer.js +0 -120
  711. package/dist/src/foundation/pi-component-adapter/upstream/components/session-selector-search.js +0 -159
  712. package/dist/src/foundation/pi-component-adapter/upstream/components/session-selector.d.ts +0 -95
  713. package/dist/src/foundation/pi-component-adapter/upstream/components/session-selector.js +0 -889
  714. package/dist/src/foundation/pi-component-adapter/upstream/components/skill-invocation-message.d.ts +0 -19
  715. package/dist/src/foundation/pi-component-adapter/upstream/components/skill-invocation-message.js +0 -44
  716. package/dist/src/foundation/pi-component-adapter/upstream/components/status-indicator.d.ts +0 -30
  717. package/dist/src/foundation/pi-component-adapter/upstream/components/status-indicator.js +0 -59
  718. package/dist/src/foundation/pi-component-adapter/upstream/components/tree-selector.d.ts +0 -98
  719. package/dist/src/foundation/pi-component-adapter/upstream/components/tree-selector.js +0 -1272
  720. package/dist/src/foundation/pi-component-adapter/upstream/components/trust-selector.d.ts +0 -33
  721. package/dist/src/foundation/pi-component-adapter/upstream/components/trust-selector.js +0 -76
  722. package/dist/src/foundation/pi-component-adapter/upstream/external-editor.js +0 -39
  723. package/dist/src/foundation/pi-component-adapter/upstream/model-search.d.ts +0 -15
  724. package/dist/src/foundation/pi-component-adapter/upstream/theme/theme-controller.d.ts +0 -25
  725. package/dist/src/foundation/pi-component-adapter/upstream/theme/theme-controller.js +0 -117
  726. package/dist/src/foundation/pi-component-adapter/upstream/theme/theme.d.ts +0 -61
  727. package/dist/src/foundation/pi-component-adapter/upstream/theme/theme.js +0 -326
  728. package/dist/src/foundation/pi-engine-adapter/adapter.d.ts +0 -164
  729. package/dist/src/foundation/pi-engine-adapter/adapter.js +0 -2367
  730. package/dist/src/foundation/pi-engine-adapter/conformance.d.ts +0 -37
  731. package/dist/src/foundation/pi-engine-adapter/conformance.js +0 -130
  732. package/dist/src/foundation/pi-engine-adapter/index.d.ts +0 -10
  733. package/dist/src/foundation/pi-engine-adapter/index.js +0 -10
  734. package/dist/src/foundation/pi-engine-adapter/model-auth-integration.d.ts +0 -30
  735. package/dist/src/foundation/pi-engine-adapter/model-auth-integration.js +0 -61
  736. package/dist/src/foundation/pi-engine-adapter/package-integration.d.ts +0 -13
  737. package/dist/src/foundation/pi-engine-adapter/package-integration.js +0 -112
  738. package/dist/src/foundation/pi-engine-adapter/pi-settings-metadata.json +0 -374
  739. package/dist/src/foundation/pi-engine-adapter/resource-extension-integration.d.ts +0 -31
  740. package/dist/src/foundation/pi-engine-adapter/resource-extension-integration.js +0 -80
  741. package/dist/src/foundation/pi-engine-adapter/runtime-integration.d.ts +0 -35
  742. package/dist/src/foundation/pi-engine-adapter/runtime-integration.js +0 -67
  743. package/dist/src/foundation/pi-engine-adapter/session-integration.d.ts +0 -43
  744. package/dist/src/foundation/pi-engine-adapter/session-integration.js +0 -97
  745. package/dist/src/foundation/pi-engine-adapter/settings-integration.d.ts +0 -55
  746. package/dist/src/foundation/pi-engine-adapter/settings-integration.js +0 -233
  747. package/dist/src/foundation/pi-engine-adapter/workflow-controllers.d.ts +0 -20
  748. package/dist/src/foundation/pi-engine-adapter/workflow-controllers.js +0 -48
  749. package/dist/src/foundation/pi-engine-adapter/workflows.d.ts +0 -173
  750. package/dist/src/foundation/pi-engine-adapter/workflows.js +0 -60
  751. package/dist/src/foundation/pi-owned-ui-integration/index.d.ts +0 -2
  752. package/dist/src/foundation/pi-owned-ui-integration/index.js +0 -2
  753. package/dist/src/foundation/pi-owned-ui-integration/route-host.d.ts +0 -29
  754. package/dist/src/foundation/pi-owned-ui-integration/session-shell.d.ts +0 -106
  755. package/dist/src/foundation/pi-owned-ui-integration/session-shell.js +0 -1518
  756. package/dist/src/foundation/pi-tui-runtime-adapter/adapter.d.ts +0 -39
  757. package/dist/src/foundation/pi-tui-runtime-adapter/adapter.js +0 -493
  758. package/dist/src/foundation/pi-tui-runtime-adapter/conformance.d.ts +0 -18
  759. package/dist/src/foundation/pi-tui-runtime-adapter/conformance.js +0 -145
  760. package/dist/src/foundation/pi-tui-runtime-adapter/contracts.d.ts +0 -120
  761. package/dist/src/foundation/pi-tui-runtime-adapter/index.d.ts +0 -4
  762. package/dist/src/foundation/pi-tui-runtime-adapter/index.js +0 -4
  763. package/dist/src/foundation/pi-tui-runtime-adapter/presentation-adapter.d.ts +0 -4
  764. package/dist/src/foundation/pi-tui-runtime-adapter/presentation-adapter.js +0 -48
  765. package/dist/src/foundation/presentation-contracts/index.d.ts +0 -96
  766. package/dist/src/foundation/presentation-contracts/index.js +0 -38
  767. package/dist/src/foundation/process-containment/index.d.ts +0 -5
  768. package/dist/src/foundation/process-containment/index.js +0 -5
  769. package/dist/src/foundation/process-containment/linux-process-inspector.d.ts +0 -6
  770. package/dist/src/foundation/process-containment/linux-process-inspector.js +0 -26
  771. package/dist/src/foundation/process-containment/native-guardian-containment.d.ts +0 -16
  772. package/dist/src/foundation/process-containment/native-guardian-containment.js +0 -139
  773. package/dist/src/foundation/process-containment/windows-process-inspector.d.ts +0 -17
  774. package/dist/src/foundation/process-containment/windows-process-inspector.js +0 -53
  775. package/dist/src/foundation/protocol/client.d.ts +0 -17
  776. package/dist/src/foundation/protocol/client.js +0 -129
  777. package/dist/src/foundation/protocol/index.d.ts +0 -2
  778. package/dist/src/foundation/protocol/index.js +0 -2
  779. package/dist/src/foundation/protocol/messages.d.ts +0 -89
  780. package/dist/src/foundation/protocol/messages.js +0 -99
  781. package/dist/src/foundation/release/bootstrap.d.ts +0 -29
  782. package/dist/src/foundation/release/bootstrap.js +0 -335
  783. package/dist/src/foundation/release/cohort-state.d.ts +0 -70
  784. package/dist/src/foundation/release/cohort-state.js +0 -202
  785. package/dist/src/foundation/release/development-preview-release.d.ts +0 -49
  786. package/dist/src/foundation/release/development-preview-release.js +0 -114
  787. package/dist/src/foundation/release/index.d.ts +0 -11
  788. package/dist/src/foundation/release/index.js +0 -11
  789. package/dist/src/foundation/release/release-gc.d.ts +0 -5
  790. package/dist/src/foundation/release/release-gc.js +0 -16
  791. package/dist/src/foundation/release/release-store.d.ts +0 -43
  792. package/dist/src/foundation/release/release-store.js +0 -175
  793. package/dist/src/foundation/release/release.d.ts +0 -38
  794. package/dist/src/foundation/release/release.js +0 -204
  795. package/dist/src/foundation/release/update-transaction.d.ts +0 -31
  796. package/dist/src/foundation/release/update-transaction.js +0 -89
  797. package/dist/src/foundation/release/update.d.ts +0 -80
  798. package/dist/src/foundation/release/update.js +0 -458
  799. package/dist/src/foundation/storage/control-store.d.ts +0 -61
  800. package/dist/src/foundation/storage/control-store.js +0 -530
  801. package/dist/src/foundation/storage/index.d.ts +0 -1
  802. package/dist/src/foundation/storage/index.js +0 -1
  803. package/dist/src/foundation/structured-agent-runtime/backpressure.d.ts +0 -46
  804. package/dist/src/foundation/structured-agent-runtime/backpressure.js +0 -118
  805. package/dist/src/foundation/structured-agent-runtime/commands.d.ts +0 -52
  806. package/dist/src/foundation/structured-agent-runtime/commands.js +0 -164
  807. package/dist/src/foundation/structured-agent-runtime/handshake.d.ts +0 -41
  808. package/dist/src/foundation/structured-agent-runtime/handshake.js +0 -151
  809. package/dist/src/foundation/structured-agent-runtime/index.d.ts +0 -5
  810. package/dist/src/foundation/structured-agent-runtime/index.js +0 -5
  811. package/dist/src/foundation/structured-agent-runtime/reconnection.d.ts +0 -37
  812. package/dist/src/foundation/structured-agent-runtime/reconnection.js +0 -129
  813. package/dist/src/foundation/structured-agent-runtime/state.d.ts +0 -56
  814. package/dist/src/foundation/structured-agent-runtime/state.js +0 -118
  815. package/dist/src/foundation/supervision/index.d.ts +0 -3
  816. package/dist/src/foundation/supervision/index.js +0 -3
  817. package/dist/src/foundation/supervision/main.d.ts +0 -1
  818. package/dist/src/foundation/supervision/main.js +0 -41
  819. package/dist/src/foundation/supervision/paths.d.ts +0 -1
  820. package/dist/src/foundation/supervision/paths.js +0 -1
  821. package/dist/src/foundation/supervision/server.d.ts +0 -22
  822. package/dist/src/foundation/supervision/server.js +0 -451
  823. package/dist/src/foundation/ui-apps/contracts.d.ts +0 -42
  824. package/dist/src/foundation/ui-apps/host.d.ts +0 -42
  825. package/dist/src/foundation/ui-apps/host.js +0 -152
  826. package/dist/src/foundation/ui-apps/index.d.ts +0 -3
  827. package/dist/src/foundation/ui-apps/index.js +0 -3
  828. package/dist/src/foundation/ui-apps/registry.d.ts +0 -11
  829. package/dist/src/foundation/ui-apps/registry.js +0 -32
  830. package/dist/src/foundation/ui-components/dialog-panel.d.ts +0 -36
  831. package/dist/src/foundation/ui-components/dialog-panel.js +0 -47
  832. package/dist/src/foundation/ui-components/frame.d.ts +0 -21
  833. package/dist/src/foundation/ui-components/frame.js +0 -54
  834. package/dist/src/foundation/ui-components/index.d.ts +0 -18
  835. package/dist/src/foundation/ui-components/index.js +0 -18
  836. package/dist/src/foundation/ui-components/line-input.d.ts +0 -74
  837. package/dist/src/foundation/ui-components/line-input.js +0 -245
  838. package/dist/src/foundation/ui-components/list-block.d.ts +0 -66
  839. package/dist/src/foundation/ui-components/list-block.js +0 -176
  840. package/dist/src/foundation/ui-components/list-view.d.ts +0 -66
  841. package/dist/src/foundation/ui-components/list-view.js +0 -76
  842. package/dist/src/foundation/ui-components/mouse.d.ts +0 -15
  843. package/dist/src/foundation/ui-components/mouse.js +0 -46
  844. package/dist/src/foundation/ui-components/scrollbar.d.ts +0 -62
  845. package/dist/src/foundation/ui-components/scrollbar.js +0 -102
  846. package/dist/src/foundation/ui-components/shortcuts.d.ts +0 -57
  847. package/dist/src/foundation/ui-components/shortcuts.js +0 -81
  848. package/dist/src/foundation/ui-components/spans.d.ts +0 -7
  849. package/dist/src/foundation/ui-components/spans.js +0 -59
  850. package/dist/src/foundation/ui-components/surface.d.ts +0 -20
  851. package/dist/src/foundation/ui-components/surface.js +0 -38
  852. package/dist/src/foundation/ui-components/text.d.ts +0 -24
  853. package/dist/src/foundation/ui-components/text.js +0 -123
  854. package/dist/src/foundation/ui-components/theme.d.ts +0 -23
  855. package/dist/src/foundation/ui-components/theme.js +0 -13
  856. package/dist/src/foundation/ui-components/value-menu.d.ts +0 -41
  857. package/dist/src/foundation/ui-components/value-menu.js +0 -33
  858. package/dist/src/foundation/workspace-contracts/index.d.ts +0 -2
  859. package/dist/src/foundation/workspace-contracts/index.js +0 -2
  860. package/dist/src/foundation/workspace-contracts/model.d.ts +0 -248
  861. package/dist/src/foundation/workspace-contracts/model.js +0 -2
  862. package/dist/src/foundation/workspace-contracts/validation.d.ts +0 -13
  863. package/dist/src/foundation/workspace-contracts/validation.js +0 -335
  864. package/dist/src/product-identity.d.ts +0 -37
  865. package/dist/src/product-identity.js +0 -150
  866. package/dist/src/product-identity.json +0 -99
  867. package/docs/manual-transparent-checkpoint.md +0 -53
  868. /package/dist/{src/foundation/agent-engine-contracts/domain.js → app/session-shell/paste-helper.d.ts} +0 -0
  869. /package/dist/{src/foundation/agent-engine-contracts/ports.js → app/session-shell/paste-text-worker.d.ts} +0 -0
  870. /package/dist/{src/foundation/lifecycle/commands.js → app/session-shell/paste-types.js} +0 -0
  871. /package/dist/{src/foundation/pi-owned-ui-integration/route-host.js → app/session-shell/response-copy-helper.d.ts} +0 -0
  872. /package/dist/{src/foundation/agent-engine-contracts → contracts/agent-engine}/capability-ports.js +0 -0
  873. /package/dist/{src/foundation/agent-engine-contracts → contracts/agent-engine}/domain-validation.d.ts +0 -0
  874. /package/dist/{src/foundation/pi-tui-runtime-adapter/contracts.js → contracts/agent-engine/domain.js} +0 -0
  875. /package/dist/{src/foundation/agent-engine-contracts → contracts/agent-engine}/model.d.ts +0 -0
  876. /package/dist/{src/foundation/agent-engine-contracts → contracts/agent-engine}/model.js +0 -0
  877. /package/dist/{src/foundation/agent-engine-contracts → contracts/agent-engine}/package-ports.js +0 -0
  878. /package/dist/{src/foundation/agent-engine-contracts → contracts/agent-engine}/ports.d.ts +0 -0
  879. /package/dist/{src/foundation/agent-engine-contracts → contracts/agent-engine}/serialization.d.ts +0 -0
  880. /package/dist/{src/foundation/agent-engine-contracts → contracts/agent-engine}/serialization.js +0 -0
  881. /package/dist/{src/foundation/agent-engine-contracts → contracts/agent-engine}/validation.d.ts +0 -0
  882. /package/dist/{src/foundation/agent-engine-contracts → contracts/agent-engine}/validation.js +0 -0
  883. /package/dist/{src/foundation/owned-ui-contracts → contracts/owned-ui}/extension-ui.js +0 -0
  884. /package/dist/{src/foundation/owned-ui-contracts → contracts/owned-ui}/model.js +0 -0
  885. /package/dist/{src/features → features}/launch/development-launch.d.ts +0 -0
  886. /package/dist/{src/features → features}/launch/initialize-profile.d.ts +0 -0
  887. /package/dist/{src/features → features}/launch/initialize-profile.js +0 -0
  888. /package/dist/{src/foundation → foundation}/lifecycle/commands.d.ts +0 -0
  889. /package/dist/{src/foundation → foundation}/lifecycle/launch-instance.d.ts +0 -0
  890. /package/dist/{src/foundation → foundation}/lifecycle/launch-instance.js +0 -0
  891. /package/dist/{src/foundation → foundation}/process-containment/artifact.d.ts +0 -0
  892. /package/dist/{src/foundation → foundation}/process-containment/artifact.js +0 -0
  893. /package/dist/{src/foundation → foundation}/process-containment/contracts.d.ts +0 -0
  894. /package/dist/{src/foundation → foundation}/process-containment/contracts.js +0 -0
  895. /package/dist/{src/foundation → foundation}/release/cohort-selection.d.ts +0 -0
  896. /package/dist/{src/foundation → foundation}/release/cohort-selection.js +0 -0
  897. /package/dist/{src/foundation → foundation}/release/concurrency.d.ts +0 -0
  898. /package/dist/{src/foundation → foundation}/release/concurrency.js +0 -0
  899. /package/dist/{src/foundation → foundation}/release/process-cleanup.d.ts +0 -0
  900. /package/dist/{src/foundation → foundation}/release/process-cleanup.js +0 -0
  901. /package/dist/{src/foundation → foundation}/release/stable-release.d.ts +0 -0
  902. /package/dist/{src/foundation → foundation}/release/stable-release.js +0 -0
  903. /package/dist/{src/foundation/pi-component-adapter → integrations/pi/components}/upstream/components/countdown-timer.js +0 -0
  904. /package/dist/{src/foundation/pi-component-adapter → integrations/pi/components}/upstream/components/mermaid.d.ts +0 -0
  905. /package/dist/{src/foundation/pi-component-adapter → integrations/pi/components}/upstream/components/session-selector-search.d.ts +0 -0
  906. /package/dist/{src/foundation/pi-component-adapter → integrations/pi/components}/upstream/external-editor.d.ts +0 -0
  907. /package/dist/{src/foundation/pi-component-adapter → integrations/pi/components}/upstream/model-search.js +0 -0
  908. /package/dist/{src/foundation/pi-engine-adapter → integrations/pi/engine}/public-main-entry.d.ts +0 -0
  909. /package/dist/{src/foundation/pi-engine-adapter → integrations/pi/engine}/public-main-entry.js +0 -0
  910. /package/dist/{src/foundation/ui-apps → ui/apps}/contracts.js +0 -0
  911. /package/dist/{src/foundation/ui-components → ui/components}/label.d.ts +0 -0
  912. /package/dist/{src/foundation/ui-components → ui/components}/label.js +0 -0
  913. /package/dist/{src/foundation/ui-components → ui/components}/pane.d.ts +0 -0
  914. /package/dist/{src/foundation/ui-components → ui/components}/pane.js +0 -0
  915. /package/dist/{src/foundation/ui-components → ui/components}/revision.d.ts +0 -0
  916. /package/dist/{src/foundation/ui-components → ui/components}/revision.js +0 -0
  917. /package/dist/{src/foundation/ui-components → ui/components}/status-line.d.ts +0 -0
  918. /package/dist/{src/foundation/ui-components → ui/components}/status-line.js +0 -0
  919. /package/dist/{src/foundation/ui-components → ui/components}/stepper.d.ts +0 -0
  920. /package/dist/{src/foundation/ui-components → ui/components}/stepper.js +0 -0
  921. /package/dist/{src/foundation/owned-ui-settings → ui/settings}/resolution.d.ts +0 -0
  922. /package/dist/{src/foundation/owned-ui-settings → ui/settings}/resolution.js +0 -0
@@ -0,0 +1,1442 @@
1
+ import { acceptsTranscriptUpdate } from "../../contracts/owned-ui/index.js";
2
+ import { caretCell } from "../../ui/components/line-input.js";
3
+ import { PromptInput, promptArrow } from "../../ui/components/prompt-input.js";
4
+ import { composeSubmittedPromptRows, formatSubmittedPromptTime, submittedPromptLayout, } from "../../ui/components/submitted-prompt.js";
5
+ import { backgroundSgrSpan, heldNativeHyperlinkStyle, hyperlinkSgrSpan, nativeHyperlinkStyle, overlaySpan, } from "../../ui/components/spans.js";
6
+ import { progressStatusFrame, progressStatusText } from "../../ui/components/progress-status.js";
7
+ import { displayWidth, faint, stripAnsi } from "../../ui/components/text.js";
8
+ import { PINNED_PI_HIDDEN_COMMAND_NAMES, PINNED_PI_WORKFLOW_COMMAND_NAMES } from "../../integrations/pi/engine/workflows.js";
9
+ import { createPiExtensionUiBridge } from "../../integrations/pi/components/shell-extension-ui.js";
10
+ import { createPiShellEditor } from "../../integrations/pi/components/shell-editor-autocomplete.js";
11
+ import { createPiQueuedInputStatus, createPiShellFooter, createPiShellHeader, createPiShellLoadedResources, createPiShellStatus, } from "../../integrations/pi/components/shell-footer-status.js";
12
+ import { createPiShellArmin, createPiShellAuthProviderSelector, createPiShellDaxnuts, createPiShellDialog, createPiShellEarendilAnnouncement, createPiShellExtensionSelector, createPiShellLoginDialog, createPiShellModelSelector, createPiShellOperationLoader, createPiShellReloadBox, createPiShellScopedModelsSelector, createPiShellSelector, createPiShellSessionSelector, createPiShellSettingsSelector, createPiShellTreeSelector, createPiShellTrustSelector, createPiShellUserMessageSelector, } from "../../integrations/pi/components/shell-selectors-dialogs.js";
13
+ import { createPiShellChangelog, createPiShellCollapsedChangelog, createPiShellHotkeys, createPiShellSessionInfo, renderPiShellCommandMessage, renderPiShellStatusText, } from "../../integrations/pi/components/shell-presenters-info.js";
14
+ import { createPiShellTranscriptComponent, isPiPromptStyleCompaction, paintPiSubmittedPromptTimestamp, renderPiShellPackageUpdateNotice, renderPiShellStartupDiagnostic, renderPiShellTranscriptBlock, } from "../../integrations/pi/components/shell-presenters-transcript.js";
15
+ import { onPiThemeChange, PINNED_PI_LAYOUT, piTheme } from "../../integrations/pi/components/upstream/theme/theme.js";
16
+ import { piShellHyperlink, piShellTruncateToWidth, piShellVisibleWidth, } from "../../integrations/pi/components/shell-shared-facade.js";
17
+ import { classifyPiTuiInput, } from "../../integrations/pi/tui-runtime/input-presentation-coordinator.js";
18
+ import { PromptChipStore } from "./prompt-chips.js";
19
+ import { EditorHyperlinkBudget } from "./editor-hyperlink-budget.js";
20
+ import { SessionViewportController } from "./session-viewport-controller.js";
21
+ import { canPreparePasteInline } from "./paste-text-preparation.js";
22
+ /** Composes backend session state into the owned transcript, viewport, editor, and dock presentation. */
23
+ export class OwnedUiSessionShellRoot {
24
+ editor;
25
+ header;
26
+ resources;
27
+ #cwd;
28
+ #transcript = new Map();
29
+ #blocksById = new Map();
30
+ #renderedRows = new Map();
31
+ // Performance: document layouts are shared by wheel, rail, jump, and selection frames.
32
+ #documentLayouts = new Map();
33
+ #themeUnsubscribe;
34
+ #transcriptOrder = [];
35
+ #view;
36
+ #status;
37
+ #footer;
38
+ #queued;
39
+ #extensionRenderers;
40
+ #imageAssets;
41
+ #promptChips;
42
+ #editorHyperlinks = new EditorHyperlinkBudget();
43
+ #pasteDiagnosticId = 0;
44
+ #terminalPasteDiagnosticRequest;
45
+ #customViewport;
46
+ #submittedPromptComposer;
47
+ #viewportController;
48
+ #viewportTheme;
49
+ #onViewportFrame;
50
+ #onInputSurfaceChanged;
51
+ #componentRuntime;
52
+ #toolsExpanded = false;
53
+ #thinkingVisible = true;
54
+ #footerLevel = true;
55
+ #mermaidRenderingMode = "off";
56
+ #showImages = true;
57
+ #imageWidthCells = 80;
58
+ #outputPad = 1;
59
+ #workflowTranscriptSequence = 0;
60
+ #workflowStatusAnchors = new Map();
61
+ #workflowStatusMessages = new Map();
62
+ #lastWorkflowStatusId;
63
+ // Invariant: the notice is dock chrome, never transcript content; the custom viewport alone uses it.
64
+ #dockNotice;
65
+ #copyAcknowledgement;
66
+ #copyAcknowledgementTimer;
67
+ #inputSurface;
68
+ #inputSurfaceCoordination = "editor";
69
+ #dockInputReuseEnabled;
70
+ #dockInputCandidate = false;
71
+ // Invariant: receipt-time eligibility is evidence, never authorization for composition-time reuse.
72
+ #dockInputRevision;
73
+ #visibleViewportSnapshot;
74
+ #fullViewportCompositions = 0;
75
+ #dockOnlyViewportCompositions = 0;
76
+ #transcriptBlockRenders = 0;
77
+ #extensionHeader = null;
78
+ #extensionFooter = null;
79
+ #extensionWidgets = new Map();
80
+ #extensionStatuses = new Map();
81
+ #extensionWorkingMessage;
82
+ #extensionWorkingVisible = true;
83
+ constructor(view, cwd, handlers, startup = {}, agentDir, extensionRenderers = {
84
+ getMessageRenderer: () => undefined,
85
+ getToolDefinition: () => undefined,
86
+ }, sessionLayout = "pinned", imageAssets) {
87
+ this.#view = view;
88
+ this.#customViewport = sessionLayout === "custom-viewport";
89
+ this.#promptChips = new PromptChipStore({ isolated: this.#customViewport,
90
+ ...(handlers.pasteDiagnostics === undefined ? {} : { onEvent: handlers.pasteDiagnostics }),
91
+ ...(handlers.pastePreparation === undefined ? {} : { preparation: handlers.pastePreparation }) });
92
+ this.#submittedPromptComposer = this.#customViewport
93
+ ? {
94
+ layout: submittedPromptLayout,
95
+ compose: (rows, width, source, style) => composeSubmittedPromptRows(rows, width, source, { ...style, prefix: text => promptArrow(text, piTheme()) })
96
+ .map(row => nativeHyperlinkStyle(row, nativeTranscriptLinkColor)),
97
+ }
98
+ : undefined;
99
+ this.#cwd = cwd;
100
+ this.#extensionRenderers = extensionRenderers;
101
+ this.#imageAssets = imageAssets;
102
+ this.#componentRuntime = handlers;
103
+ this.#onViewportFrame = handlers.onViewportFrame;
104
+ this.#onInputSurfaceChanged = handlers.onInputSurfaceChanged;
105
+ this.#dockInputReuseEnabled = handlers.enableDockInputReuse ?? true;
106
+ this.header = createPiShellHeader({
107
+ ...startup,
108
+ ...(this.#customViewport ? { getKeybindings: () => this.editor.keybindingConfig() } : {}),
109
+ });
110
+ this.resources = createPiShellLoadedResources(startup.resources ?? [], startup.expanded ?? false);
111
+ this.#status = createPiShellStatus(view, {
112
+ text: (message, mode) => progressStatusText(message, mode === "custom-viewport" ? "…" : "..."),
113
+ frame: progressStatusFrame,
114
+ }, handlers);
115
+ this.#status.setProgressPresentation(this.#customViewport ? "custom-viewport" : "pinned");
116
+ this.#footer = createPiShellFooter(this.#viewWithExtensionStatuses(view), cwd, this.#customViewport ? "a1" : "pi", () => this.#footerLevel);
117
+ this.editor = createPiShellEditor({
118
+ ...handlers,
119
+ keybindingProfile: this.#customViewport ? "a1" : "pi",
120
+ paintEditorSelection: (line, from, to, atomic) => backgroundSgrSpan(line, from, to, atomic ? "\u001b[7m" : "\u001b[27m\u001b[48;2;38;79;120m", atomic ? "\u001b[27m" : "\u001b[49m", piShellVisibleWidth),
121
+ transformPastedContent: content => {
122
+ try {
123
+ return this.#promptChips.transformPastedContent(content, this.editor.getText());
124
+ }
125
+ catch (error) {
126
+ handlers.onPasteRejected?.(error);
127
+ return "";
128
+ }
129
+ },
130
+ ...(this.#customViewport ? {
131
+ beginClipboardPaste: () => this.#promptChips.beginPaste(this.editor.getText(), handlers.captureClipboardPaste?.() ?? { kind: "provided", read: signal => handlers.readClipboardContent?.(signal) ?? Promise.resolve(null) }, error => handlers.onPasteRejected?.(error), () => handlers.requestRender()),
132
+ onPasteInput: (bytes, phase) => {
133
+ try {
134
+ if (phase === "framing")
135
+ this.#terminalPasteDiagnosticRequest = --this.#pasteDiagnosticId;
136
+ const request = this.#terminalPasteDiagnosticRequest ?? --this.#pasteDiagnosticId;
137
+ handlers.pasteDiagnostics?.({ request, phase, bytes, atMs: performance.now(), pending: 0, transport: "terminal",
138
+ ...(phase === "settled" ? { outcome: "ready" } : {}) });
139
+ if (phase === "settled")
140
+ this.#terminalPasteDiagnosticRequest = undefined;
141
+ }
142
+ catch { /* Invariant: payload-free diagnostics cannot interfere with the input path. */ }
143
+ },
144
+ deferTextPaste: text => !canPreparePasteInline(text),
145
+ beginTextPaste: text => this.#promptChips.beginPaste(this.editor.getText(), { kind: "text", text }, error => handlers.onPasteRejected?.(error)),
146
+ } : {}),
147
+ editorAtomicRanges: line => this.#promptChips.atomicRanges(line),
148
+ editorHiddenRanges: line => this.#promptChips.hiddenRanges(line),
149
+ decorateEditorRow: (row, width, rowIndex) => {
150
+ if (rowIndex === 0)
151
+ this.#editorHyperlinks.reset();
152
+ const plain = stripAnsi(row);
153
+ const ranges = this.#promptChips.hyperlinkRanges(plain);
154
+ if (ranges.length === 0 || !this.#editorHyperlinks.takeCleanup())
155
+ return row;
156
+ const linkResetAndTail = `\u001b]8;;\u001b\\\u001b[24m${" ".repeat(Math.max(0, width - piShellVisibleWidth(row)))}`;
157
+ // Platform: VS15 is zero-column and default-ignorable. It breaks Windows Terminal's
158
+ // plain-text URL detector only in the held-button paint; semantic text stays exact.
159
+ const paintRow = this.#viewportController.editorPointerSelecting
160
+ ? row.replaceAll("https://", "https:\uFE0E//").replaceAll("http://", "http:\uFE0E//")
161
+ : row;
162
+ const decorated = this.#viewportController.editorPointerSelecting
163
+ ? ranges.reduce((result, range) => backgroundSgrSpan(result, piShellVisibleWidth(plain.slice(0, range.start)), piShellVisibleWidth(plain.slice(0, range.end)), "\u001b[4:4m", "\u001b[24m", piShellVisibleWidth), paintRow)
164
+ : ranges.filter(range => this.#editorHyperlinks.take(range.target)).reduce((result, range) => hyperlinkSgrSpan(result, piShellVisibleWidth(plain.slice(0, range.start)), piShellVisibleWidth(plain.slice(0, range.end)), range.target, piShellVisibleWidth), row);
165
+ // Platform: Windows Terminal can retain stale native dotted-link cells when a mutable
166
+ // prompt replaces a longer URL. Explicit non-link spaces overwrite that tail.
167
+ return `${decorated}${linkResetAndTail}`;
168
+ },
169
+ expandCopiedEditorText: text => this.#promptChips.expandCopiedText(text),
170
+ cwd,
171
+ ...(agentDir === undefined ? {} : { agentDir }),
172
+ onToolsExpand: () => this.#setToolsExpanded(!this.#toolsExpanded),
173
+ ...(this.#customViewport ? {
174
+ promptPresentation: {
175
+ input: new PromptInput({ fg: (token, text) => piTheme().fg(token, text) }, {
176
+ measure: piShellVisibleWidth,
177
+ truncate: piShellTruncateToWidth,
178
+ }),
179
+ styleSuggestion: faint,
180
+ styleSuggestionCaret: caretCell,
181
+ },
182
+ } : {}),
183
+ onChange: text => {
184
+ handlers.onEditorChange?.(text);
185
+ // Concurrency: Pi clears before onSubmit; capture waiting references before pruning removed chips.
186
+ queueMicrotask(() => this.#promptChips.reconcileDraft(this.editor.getText()));
187
+ },
188
+ ...(handlers.onPromptSuggestionAccepted === undefined ? {} : { onPromptSuggestionAccepted: handlers.onPromptSuggestionAccepted }),
189
+ });
190
+ this.#queued = createPiQueuedInputStatus(view.editor.queuedSubmissions, this.#customViewport ? "custom-viewport" : "pinned", this.#customViewport ? () => this.editor.keybindingConfig() : undefined);
191
+ this.#viewportController = new SessionViewportController({
192
+ enabled: this.#customViewport,
193
+ editor: this.editor,
194
+ requestRender: force => this.#componentRuntime.requestRender(force),
195
+ requestHyperlinkCleanup: rows => handlers.requestHyperlinkCleanup?.(rows),
196
+ hasEditorLinks: () => this.#promptChips.hyperlinkRanges(this.editor.getText()).length > 0,
197
+ ...(handlers.pasteDiagnostics === undefined ? {} : { pasteDiagnostics: handlers.pasteDiagnostics }),
198
+ nextPasteDiagnosticRequest: () => --this.#pasteDiagnosticId,
199
+ });
200
+ // Performance: stable painter identities let the neutral viewport retain row-level
201
+ // selection variants while each callback still resolves the live Pi theme.
202
+ this.#viewportTheme = {
203
+ track: text => `${SCROLLBAR_CELL_RESET}${piTheme().fg("dim", text)}`,
204
+ thumb: text => `${SCROLLBAR_CELL_RESET}${piTheme().fg("accent", text)}`,
205
+ sticky: (text, hovered) => piTheme().bg(hovered ? "selectedBg" : "toolPendingBg", piTheme().fg("text", withoutTerminalBackground(text))),
206
+ quietSticky: text => `\u001b[2m${text.replace(/\u001b\[(?:0|22)m/g, "$&\u001b[2m")}\u001b[22m`,
207
+ bottomControl: (text, hovered) => piTheme().bg(hovered ? "selectedBg" : "toolPendingBg", piTheme().fg("text", text)),
208
+ selection: (line, from, to) => backgroundSgrSpan(line, from, to, "\u001b[48;2;38;79;120m", "\u001b[49m"),
209
+ };
210
+ this.editor.setThinkingLevel(view.thinkingLevel);
211
+ this.#inputSurface = this.editor;
212
+ for (const block of view.transcript) {
213
+ if (block.kind === "user")
214
+ this.editor.addToHistory(block.text);
215
+ }
216
+ this.#syncTranscript(view.transcript);
217
+ // Invariant: colours come from the active theme, so rendered rows outlive their revision only
218
+ // until the theme under them changes.
219
+ this.#themeUnsubscribe = onPiThemeChange(() => {
220
+ this.#renderedRows.clear();
221
+ this.#documentLayouts.clear();
222
+ });
223
+ }
224
+ setEditorPaddingX(padding) {
225
+ this.editor.setPaddingX(padding);
226
+ this.#documentLayouts.clear();
227
+ }
228
+ setAutocompleteMaxVisible(maxVisible) {
229
+ this.editor.setAutocompleteMaxVisible(maxVisible);
230
+ }
231
+ setOutputPad(padding) {
232
+ if (this.#outputPad === padding)
233
+ return;
234
+ this.#outputPad = padding;
235
+ this.#status.setOutputPad(padding);
236
+ for (const component of this.#transcript.values())
237
+ component.setOutputPad(padding);
238
+ this.#invalidateTranscriptPresentation();
239
+ }
240
+ setHideThinkingBlock(hidden) {
241
+ if (this.#thinkingVisible === !hidden)
242
+ return;
243
+ this.#thinkingVisible = !hidden;
244
+ for (const component of this.#transcript.values())
245
+ component.setHideThinkingBlock(hidden);
246
+ this.#invalidateTranscriptPresentation();
247
+ }
248
+ setMermaidRenderingMode(mode) {
249
+ if (this.#mermaidRenderingMode === mode)
250
+ return;
251
+ this.#mermaidRenderingMode = mode;
252
+ for (const component of this.#transcript.values())
253
+ component.setMermaidRenderingMode(mode);
254
+ this.#invalidateTranscriptPresentation();
255
+ }
256
+ setImagePresentation(showImages, imageWidthCells) {
257
+ if (this.#showImages === showImages && this.#imageWidthCells === imageWidthCells)
258
+ return;
259
+ this.#showImages = showImages;
260
+ this.#imageWidthCells = imageWidthCells;
261
+ for (const component of this.#transcript.values())
262
+ component.setImagePresentation(showImages, imageWidthCells);
263
+ this.#invalidateTranscriptPresentation();
264
+ }
265
+ prepareHistoryText(text) {
266
+ return this.#promptChips.prepareHistoryText(text);
267
+ }
268
+ rehydrateHistoryText(text, resolveImage) {
269
+ return this.#promptChips.rehydrateHistoryText(text, resolveImage);
270
+ }
271
+ imageChipAttachmentsFromEditor(text) {
272
+ return this.#promptChips.imageChipAttachments(text);
273
+ }
274
+ preparePromptSubmission(text) {
275
+ return this.#promptChips.prepareSubmission(text);
276
+ }
277
+ hasPendingPastes(text) { return this.#promptChips.hasPending(text); }
278
+ waitForPromptPastes(text, signal) {
279
+ return this.#promptChips.waitForPastes(text, signal, () => this.editor.getText());
280
+ }
281
+ resetPendingPastes() {
282
+ this.editor.cancelPendingPastes?.();
283
+ this.editor.setText(this.#promptChips.resetPastes(this.editor.getText()));
284
+ }
285
+ /** Forks the spare paste helper so the first paste of the session takes a live child. */
286
+ warmPastePreparation() { this.#promptChips.warm(); }
287
+ disposePendingPastes() {
288
+ this.resetPendingPastes();
289
+ return this.#promptChips.dispose();
290
+ }
291
+ promptSuggestionPrepareBlockReason() {
292
+ if (!this.usesDefaultInputSurface())
293
+ return "replacement-input";
294
+ if (this.#view.dialog !== null || this.#view.overlay !== null)
295
+ return "modal";
296
+ if (this.editor.getText().length > 0)
297
+ return "draft";
298
+ return null;
299
+ }
300
+ canPreparePromptSuggestion() { return this.promptSuggestionPrepareBlockReason() === null; }
301
+ promptSuggestionPresentationBlockReason() {
302
+ const reason = this.promptSuggestionPrepareBlockReason();
303
+ if (reason !== null)
304
+ return reason;
305
+ if (this.#view.lifecycle !== "ready")
306
+ return "not-ready";
307
+ return this.editor.promptSuggestionBlockReason?.()
308
+ ?? (this.editor.canPresentPromptSuggestion() ? null : "presentation-unavailable");
309
+ }
310
+ canPresentPromptSuggestion() { return this.promptSuggestionPresentationBlockReason() === null; }
311
+ setPromptSuggestion(text) {
312
+ this.editor.setPromptSuggestion(text);
313
+ }
314
+ update(view) {
315
+ if (view.diagnostics.length !== this.#view.diagnostics.length
316
+ || view.diagnostics.some((diagnostic, index) => diagnostic.sequence !== this.#view.diagnostics[index]?.sequence)) {
317
+ this.#documentLayouts.clear();
318
+ }
319
+ this.#view = view;
320
+ this.#status.update(view);
321
+ this.#footer.update(this.#viewWithExtensionStatuses(view));
322
+ this.#queued.update(view.editor.queuedSubmissions);
323
+ this.#syncTranscript(view.transcript);
324
+ this.editor.setSubmitEnabled(view.lifecycle !== "stopping" && view.lifecycle !== "stopped" && view.lifecycle !== "failed");
325
+ this.editor.setThinkingLevel(view.thinkingLevel);
326
+ // Performance: semantic updates already invalidate affected transcript blocks. Chrome is a separate authority.
327
+ this.#invalidateChrome();
328
+ }
329
+ /**
330
+ * Applies one block: its component is created or updated in place and the order grows
331
+ * only when the block is new. A streamed chunk costs one component update rather than a
332
+ * walk of the whole transcript.
333
+ */
334
+ applyTranscriptBlock(block) {
335
+ const current = this.#blocksById.get(block.id);
336
+ // Invariant: a full-view/final presentation may preempt queued partials. Never revive an older revision.
337
+ if (current !== undefined && !acceptsTranscriptUpdate(current, block))
338
+ return;
339
+ this.#blocksById.set(block.id, block);
340
+ const component = this.#transcript.get(block.id);
341
+ if (component === undefined) {
342
+ const created = this.#mountTranscript(block);
343
+ this.#transcript.set(block.id, created);
344
+ this.#transcriptOrder.push(block.id);
345
+ }
346
+ else if (component.revision !== block.revision) {
347
+ component.update(block);
348
+ }
349
+ // Performance: one chunk touches one block, and the updated component tracks its own dirtiness.
350
+ // Invalidating the whole shell here would re-wrap the entire transcript per chunk.
351
+ this.#renderedRows.delete(block.id);
352
+ this.#documentLayouts.clear();
353
+ }
354
+ #mountTranscript(block) {
355
+ // Invariant: the notice answers the reader's last command, so only their next prompt or
356
+ // shell command retires it; assistant, tool, and compaction blocks streaming in keep it.
357
+ if (block.kind === "user" || block.kind === "bash")
358
+ this.#dismissDockNotice();
359
+ const created = createPiShellTranscriptComponent(block, this.#cwd, this.#extensionRenderers, this.#submittedPromptComposer, this.#outputPad, !this.#thinkingVisible, this.#mermaidRenderingMode, this.#showImages, this.#imageWidthCells, this.#imageAssets, { ...this.#componentRuntime, changed: () => {
360
+ if (this.#transcript.get(block.id) !== created)
361
+ return;
362
+ this.#renderedRows.delete(block.id);
363
+ this.#documentLayouts.clear();
364
+ this.#visibleViewportSnapshot = undefined;
365
+ this.#dockInputCandidate = false;
366
+ this.#dockInputRevision = undefined;
367
+ this.#componentRuntime.requestRender();
368
+ } });
369
+ created.setExpanded(this.#toolsExpanded);
370
+ return created;
371
+ }
372
+ render(width) {
373
+ if (!this.#customViewport) {
374
+ this.#viewportController.setEditorPointerFrame(undefined);
375
+ return [...this.#renderDocument(width), ...this.#renderDock(width)];
376
+ }
377
+ const height = Math.max(0, this.#componentRuntime.getRows());
378
+ const dock = this.#renderDockLayout(width);
379
+ const copyAcknowledgement = this.#renderCopyAcknowledgement(width);
380
+ // Invariant: auto/always own one stable final-column gutter. Every scrollable
381
+ // surface ends before it; the dock remains full-width and hidden mode returns it.
382
+ const documentWidth = this.#viewportController.config.scrollbarAppearance === "hidden"
383
+ ? width
384
+ : Math.max(1, width - 1);
385
+ const document = this.#renderDocumentLayout(documentWidth);
386
+ const steeringRows = this.#renderQueued(documentWidth);
387
+ const statusRows = this.#renderStatus(documentWidth);
388
+ const transientSignature = transientRowsSignature(steeringRows, statusRows);
389
+ const snapshot = this.#visibleViewportSnapshot;
390
+ // Invariant: paint-only feedback may cover either viewport or dock cells, so
391
+ // ordinary dock-only reuse cannot safely omit its overlay composition.
392
+ const dockInputCandidate = this.#dockInputCandidate && copyAcknowledgement === undefined;
393
+ // Concurrency: input may change after a keyboard receipt but before its paint.
394
+ // Capture only the live inputs this composition will actually represent.
395
+ const inputSurface = this.#inputSurface;
396
+ const dockRows = dock.rows;
397
+ const selectableDocumentRowCount = document.rows.length;
398
+ const dockStartRow = height - dockRows.length + 1;
399
+ const editorOffset = dock.editorOffset;
400
+ this.#viewportController.setInputSurfaceFrame(this.usesDefaultInputSurface() ? undefined : {
401
+ component: this.#inputSurface,
402
+ columnStart: 1,
403
+ columnEnd: width,
404
+ rowStart: Math.max(1, dockStartRow + editorOffset),
405
+ rowEnd: Math.min(height, dockStartRow + editorOffset + dock.inputRows - 1),
406
+ });
407
+ this.#viewportController.setEditorPointerFrame(this.usesDefaultInputSurface()
408
+ ? {
409
+ rowStart: dockStartRow + editorOffset,
410
+ rowEnd: dockStartRow + editorOffset + dock.inputRows - 1,
411
+ }
412
+ : undefined);
413
+ const viewportRevision = this.#viewportController.presentationRevision;
414
+ const selectionRevision = this.#viewportController.selectionRevision;
415
+ const pointerPosition = this.#viewportController.pointerPosition;
416
+ this.#dockInputCandidate = false;
417
+ let frame = dockInputCandidate
418
+ && snapshot !== undefined
419
+ && snapshot.width === width
420
+ && snapshot.height === height
421
+ && snapshot.documentRows === document.rows
422
+ && snapshot.transientSignature === transientSignature
423
+ && snapshot.promptAnchors === document.promptAnchors
424
+ && snapshot.dockLength === dockRows.length
425
+ && snapshot.inputSurface === inputSurface
426
+ && snapshot.viewportRevision === viewportRevision
427
+ && snapshot.selectionRevision === selectionRevision
428
+ ? this.#viewportController.composeDockOnly(dockRows, width, height)
429
+ : null;
430
+ if (frame === null) {
431
+ frame = this.#viewportController.compose({
432
+ // Performance: do not copy the complete document on unchanged dock-only input.
433
+ // Steering and Working retain their one non-selectable viewport-tail ownership.
434
+ documentRows: [...document.rows, ...steeringRows, ...statusRows],
435
+ ...(this.#viewportController.transcriptPointerSelecting
436
+ ? { paintDocumentRow: heldNativeHyperlinkStyle }
437
+ : {}),
438
+ // Invariant: selection and copying stop at the real document tail; Steering,
439
+ // fitting alignment, and live Working remain transient presentation chrome.
440
+ selectableDocumentRowCount,
441
+ ...(document.liveTailStartRow === undefined ? {} : { liveTailStartRow: document.liveTailStartRow }),
442
+ bottomAlignedTailRowCount: steeringRows.length + statusRows.length,
443
+ dockRows,
444
+ promptAnchors: document.promptAnchors,
445
+ width,
446
+ height,
447
+ // Invariant: the control belongs immediately above the complete dock and
448
+ // floats over transient viewport content rather than consuming a dock row.
449
+ bottomControlRow: Math.max(0, height - Math.min(height, dockRows.length) - 1),
450
+ ...(copyAcknowledgement === undefined || height <= 0 ? {} : {
451
+ frameOverlay: {
452
+ row: Math.max(1, Math.min(height, dockStartRow + dock.inputOffset - 1)),
453
+ text: copyAcknowledgement,
454
+ },
455
+ }),
456
+ theme: this.#viewportTheme,
457
+ });
458
+ this.#fullViewportCompositions += 1;
459
+ }
460
+ else
461
+ this.#dockOnlyViewportCompositions += 1;
462
+ this.#visibleViewportSnapshot = {
463
+ width,
464
+ height,
465
+ documentRows: document.rows,
466
+ transientSignature,
467
+ promptAnchors: document.promptAnchors,
468
+ dockLength: dockRows.length,
469
+ inputSurface,
470
+ // Invariant: a callback during composition cannot bless older rows with its
471
+ // newer revision. Its ordinary pending render will publish the newer state.
472
+ viewportRevision,
473
+ selectionRevision: frame.descriptor.selectionRevision,
474
+ pointerPosition,
475
+ };
476
+ this.#onViewportFrame?.(frame);
477
+ return frame.rows;
478
+ }
479
+ viewportFrameDescriptor() {
480
+ return this.#viewportController.frame?.descriptor ?? null;
481
+ }
482
+ /** Read-only, payload-free evidence; observing a pending frame must never render or repair it. */
483
+ viewportPresentationEvidence() {
484
+ const frame = this.#viewportController.frame;
485
+ const snapshot = this.#visibleViewportSnapshot;
486
+ return {
487
+ candidate: this.#dockInputCandidate,
488
+ candidateRevision: this.#dockInputCandidate ? this.#dockInputRevision ?? null : null,
489
+ currentRevision: this.#viewportController.presentationRevision,
490
+ composedRevision: snapshot?.viewportRevision ?? null,
491
+ currentPointer: this.#viewportController.pointerPosition ?? null,
492
+ composedPointer: snapshot?.pointerPosition ?? null,
493
+ frameId: frame?.descriptor.frameId ?? null,
494
+ bottom: frame?.hits.bottom ?? null,
495
+ followingEnd: frame?.followingEnd ?? true,
496
+ scrollTop: frame?.scrollTop ?? 0,
497
+ maxScroll: frame?.maxScroll ?? 0,
498
+ cause: frame?.descriptor.cause ?? null,
499
+ };
500
+ }
501
+ /** Visible non-selectable Steering, alignment, and Working rows, for rendering evidence. */
502
+ viewportTransientTailRowCount() {
503
+ return this.#viewportController.frame?.hits.transientTail.length ?? 0;
504
+ }
505
+ hasActiveSelection() {
506
+ return this.#viewportController.hasSelection || this.editor.hasSelection();
507
+ }
508
+ setViewportConfig(config) {
509
+ if (this.#viewportController.setConfig(config))
510
+ this.#documentLayouts.clear();
511
+ }
512
+ setFullscreenCopyOnSelect(enabled) {
513
+ this.#viewportController.setCopyOnSelect(enabled);
514
+ }
515
+ showCopyAcknowledgement(message) {
516
+ this.#clearCopyAcknowledgement(false);
517
+ this.#copyAcknowledgement = message;
518
+ const timer = setTimeout(() => {
519
+ if (this.#copyAcknowledgementTimer !== timer)
520
+ return;
521
+ this.#copyAcknowledgementTimer = undefined;
522
+ this.#copyAcknowledgement = undefined;
523
+ this.#invalidateChrome();
524
+ this.#componentRuntime.requestRender();
525
+ }, COPY_ACKNOWLEDGEMENT_DURATION_MS);
526
+ timer.unref?.();
527
+ this.#copyAcknowledgementTimer = timer;
528
+ this.#invalidateChrome();
529
+ this.#componentRuntime.requestRender();
530
+ }
531
+ resumeViewportFollowing() {
532
+ this.#viewportController.resumeFollowing();
533
+ }
534
+ noteCompletedAssistantMessage() {
535
+ this.#viewportController.noteCompletedAssistantMessage();
536
+ }
537
+ /** A new session binding owns new mounts even when it reuses semantic invocation ids. */
538
+ resetTranscript() {
539
+ for (const component of this.#transcript.values())
540
+ component.dispose?.();
541
+ this.#transcript.clear();
542
+ this.#blocksById.clear();
543
+ this.#transcriptOrder = [];
544
+ this.#renderedRows.clear();
545
+ this.#documentLayouts.clear();
546
+ }
547
+ resetViewport() {
548
+ this.#viewportController.reset();
549
+ }
550
+ clearViewportPointerState() {
551
+ this.#viewportController.clearPointerState();
552
+ }
553
+ setViewportOverlaySurfaces(surfaces) {
554
+ this.#viewportController.setOverlaySurfaces(surfaces);
555
+ }
556
+ viewportInputGeometryReady(width, height) {
557
+ const frame = this.#viewportController.frame;
558
+ return this.#viewportController.inputGeometryReady && frame?.descriptor.width === width && frame.descriptor.height === height;
559
+ }
560
+ handleViewportPreInput(data, allowWheel = true, now = Date.now(), editorActive = this.usesDefaultInputSurface()) {
561
+ return this.#viewportController.handlePreInput(data, allowWheel, now, editorActive);
562
+ }
563
+ #renderDock(width) {
564
+ return this.#renderDockLayout(width).rows;
565
+ }
566
+ #renderDockLayout(width) {
567
+ const queued = this.#customViewport ? [] : this.#renderQueued(width);
568
+ const statusRows = this.#customViewport ? this.#status.renderDock(width) : this.#renderStatus(width);
569
+ const transientRows = [...queued, ...statusRows, ...this.#renderDockNotice(width)];
570
+ const aboveWidgets = this.#renderWidgets("aboveEditor", width);
571
+ const input = this.#inputSurface.render(width);
572
+ // Invariant: pointer rows describe the body, not the autocomplete block now preceding it.
573
+ const body = this.usesDefaultInputSurface() ? this.editor.bodyGeometry?.() : undefined;
574
+ const belowWidgets = this.#renderWidgets("belowEditor", width);
575
+ const footer = this.#renderFooter(width);
576
+ const rowsWithoutTransient = [...aboveWidgets, ...input, ...belowWidgets, ...footer];
577
+ const inputOffset = transientRows.length + aboveWidgets.length;
578
+ return {
579
+ rows: [...transientRows, ...rowsWithoutTransient],
580
+ inputOffset,
581
+ editorOffset: inputOffset + (body?.rowOffset ?? 0),
582
+ inputRows: body?.rowCount ?? input.length,
583
+ };
584
+ }
585
+ #renderCopyAcknowledgement(width) {
586
+ if (this.#copyAcknowledgement === undefined || width <= 0)
587
+ return undefined;
588
+ return piTheme().fg("accent", piShellTruncateToWidth(this.#copyAcknowledgement, width));
589
+ }
590
+ #clearCopyAcknowledgement(requestRender) {
591
+ if (this.#copyAcknowledgementTimer !== undefined)
592
+ clearTimeout(this.#copyAcknowledgementTimer);
593
+ this.#copyAcknowledgementTimer = undefined;
594
+ if (this.#copyAcknowledgement === undefined)
595
+ return;
596
+ this.#copyAcknowledgement = undefined;
597
+ this.#invalidateChrome();
598
+ if (requestRender)
599
+ this.#componentRuntime.requestRender();
600
+ }
601
+ #renderDockNotice(width) {
602
+ const notice = this.#dockNotice;
603
+ if (notice === undefined)
604
+ return [];
605
+ if (notice.kind === "status") {
606
+ // Compatibility: Pi pads its status text by one cell regardless of the output pad setting.
607
+ return ["", ...renderPiShellStatusText(notice.message, width, PINNED_PI_LAYOUT.outputPad)];
608
+ }
609
+ return renderPiShellCommandMessage({ kind: notice.kind, message: notice.message }, width, this.#outputPad);
610
+ }
611
+ #dismissDockNotice() {
612
+ if (this.#dockNotice === undefined)
613
+ return;
614
+ this.#dockNotice = undefined;
615
+ this.#invalidateChrome();
616
+ }
617
+ #renderQueued(width) {
618
+ return this.#view.editor.queuedSubmissions.length === 0 ? [] : this.#queued.render(width);
619
+ }
620
+ layoutRoot() {
621
+ const document = layoutPort(width => this.#renderDocument(width), () => this.invalidate());
622
+ const queued = layoutPort(width => this.#view.editor.queuedSubmissions.length === 0 ? [] : this.#queued.render(width), () => this.#queued.invalidate());
623
+ const aboveWidgets = layoutPort(width => this.#renderWidgets("aboveEditor", width), () => this.#invalidateExtensions());
624
+ const status = layoutPort(width => this.#renderStatus(width), () => this.#status.invalidate());
625
+ const editor = layoutPort(width => this.#inputSurface.render(width), () => this.#inputSurface.invalidate(), data => this.#inputSurface.handleInput?.(data));
626
+ const belowWidgets = layoutPort(width => this.#renderWidgets("belowEditor", width), () => this.#invalidateExtensions());
627
+ const footer = layoutPort(width => this.#renderFooter(width), () => (this.#extensionFooter ?? this.#footer).invalidate());
628
+ return {
629
+ type: "stack",
630
+ direction: "vertical",
631
+ children: [
632
+ {
633
+ basis: 0,
634
+ grow: 1,
635
+ shrink: 1,
636
+ minSize: 1,
637
+ node: {
638
+ type: "scroll",
639
+ id: "transcript",
640
+ follow: "end",
641
+ primary: true,
642
+ overscroll: "chain",
643
+ scrollbar: "auto",
644
+ scrollbarTrackStyle: text => piTheme().fg("scrollbarTrack", text),
645
+ scrollbarThumbStyle: text => piTheme().fg("scrollbarThumb", text),
646
+ child: { type: "component", component: document },
647
+ },
648
+ },
649
+ {
650
+ basis: "auto",
651
+ grow: 0,
652
+ shrink: 1,
653
+ minSize: 1,
654
+ node: {
655
+ type: "stack",
656
+ direction: "vertical",
657
+ children: [
658
+ { shrink: 1, minSize: 0, node: { type: "component", component: queued } },
659
+ { shrink: 1, minSize: 0, node: { type: "component", component: status } },
660
+ { shrink: 1, minSize: 0, node: { type: "component", component: aboveWidgets } },
661
+ { shrink: 1, minSize: 3, node: { type: "component", component: editor } },
662
+ { shrink: 1, minSize: 0, node: { type: "component", component: belowWidgets } },
663
+ { shrink: 1, minSize: 1, node: { type: "component", component: footer } },
664
+ ],
665
+ },
666
+ },
667
+ ],
668
+ };
669
+ }
670
+ #renderDocument(width) {
671
+ return this.#renderDocumentLayout(width).rows;
672
+ }
673
+ #renderDocumentLayout(width) {
674
+ // Performance: extension headers may animate independently of transcript revisions, so
675
+ // only the stable built-in document participates in this frame cache.
676
+ const cached = this.#extensionHeader === null ? this.#documentLayouts.get(width) : undefined;
677
+ if (cached !== undefined)
678
+ return cached;
679
+ const diagnostics = this.#view.diagnostics;
680
+ const startupRows = diagnostics
681
+ .filter(diagnostic => diagnostic.code === "engine-startup")
682
+ .flatMap(diagnostic => renderPiShellStartupDiagnostic(diagnostic, width));
683
+ const resourceRows = this.#customViewport ? [] : [...this.resources.render(width)];
684
+ if (resourceRows.at(-1) === "")
685
+ resourceRows.pop();
686
+ const headerRows = this.#extensionHeader !== null
687
+ ? this.#extensionHeader.render(width)
688
+ : this.#customViewport ? [] : this.header.render(width);
689
+ const rows = [
690
+ ...startupRows,
691
+ ...headerRows,
692
+ ...resourceRows,
693
+ ];
694
+ const promptAnchors = [];
695
+ // Rationale: a block that is still streaming re-renders every row it owns, so the frame
696
+ // reports where its rows begin. Damage-aware painting uses that to tell a live block's
697
+ // own reflow apart from a repaint that reaches settled rows.
698
+ let liveTailStartRow;
699
+ for (let index = 0; index < this.#transcriptOrder.length; index += 1) {
700
+ const id = this.#transcriptOrder[index];
701
+ const block = this.#blocksById.get(id);
702
+ if (!this.#thinkingVisible && block?.kind === "thinking")
703
+ continue;
704
+ const promptLike = block !== undefined
705
+ && (block.kind === "user" || this.#customViewport && isPiPromptStyleCompaction(block));
706
+ // Invariant: the custom viewport has already removed its rail gutter from this width.
707
+ // Prompt-like and ordinary blocks therefore share one right content edge.
708
+ const blockWidth = width;
709
+ const blockRows = this.#blockRows(id, block, blockWidth);
710
+ if (promptLike) {
711
+ // Compatibility: the first natural prompt gets one breathing row at the document top.
712
+ // Once scrolling advances, the prompt itself reaches row zero and then
713
+ // becomes sticky there, so the spacer is never pinned with it.
714
+ if (this.#customViewport && index === 0)
715
+ rows.push("");
716
+ else if (index > 0)
717
+ rows.push("");
718
+ }
719
+ const firstRow = rows.length;
720
+ if (liveTailStartRow === undefined && block !== undefined && block.status !== "finalized") {
721
+ liveTailStartRow = firstRow;
722
+ }
723
+ rows.push(...blockRows);
724
+ if (promptLike && blockRows[0] !== undefined) {
725
+ promptAnchors.push({
726
+ id: block.id,
727
+ firstRow,
728
+ lastRow: Math.max(firstRow, rows.length - 1),
729
+ sourceRow: pinnedPromptSourceRow(block, blockRows[0], blockWidth),
730
+ prominentSourceRow: blockRows[0],
731
+ });
732
+ }
733
+ }
734
+ rows.push(...diagnostics
735
+ .filter(diagnostic => diagnostic.code === "package-updates")
736
+ .flatMap(diagnostic => renderPiShellPackageUpdateNotice(diagnostic.message.split("\n").filter(line => line.startsWith("- ")).map(line => line.slice(2)), width)));
737
+ rows.push(...diagnostics
738
+ .filter(diagnostic => diagnostic.code === "changelog-collapsed" || diagnostic.code === "changelog-expanded")
739
+ // Rationale: bare A1 translates either startup diagnostic into transient dock chrome;
740
+ // the pinned layout retains Pi's collapsed hint or expanded document.
741
+ .flatMap(diagnostic => this.#customViewport
742
+ ? []
743
+ : diagnostic.code === "changelog-collapsed"
744
+ ? createPiShellCollapsedChangelog().render(width)
745
+ : createPiShellChangelog(diagnostic.message).render(width)));
746
+ rows.push(...diagnostics
747
+ .filter(diagnostic => diagnostic.code !== "engine-startup" && diagnostic.code !== "package-updates"
748
+ && diagnostic.code !== "changelog-collapsed" && diagnostic.code !== "changelog-expanded")
749
+ .slice(-3)
750
+ .flatMap(diagnostic => renderPiShellTranscriptBlock({
751
+ id: `diagnostic-${diagnostic.sequence}`,
752
+ kind: diagnostic.severity === "error" ? "error" : "system",
753
+ status: "finalized",
754
+ revision: diagnostic.sequence,
755
+ title: diagnostic.code,
756
+ text: diagnostic.message,
757
+ payload: {},
758
+ }, width, this.#cwd)));
759
+ const layout = { rows: Object.freeze(rows), promptAnchors: Object.freeze(promptAnchors), liveTailStartRow };
760
+ if (this.#extensionHeader === null) {
761
+ this.#documentLayouts.set(width, layout);
762
+ // Performance: the custom viewport commonly probes full width and reserved-rail width.
763
+ while (this.#documentLayouts.size > 2)
764
+ this.#documentLayouts.delete(this.#documentLayouts.keys().next().value);
765
+ }
766
+ return layout;
767
+ }
768
+ // Performance: finalized blocks cache by revision and width; live blocks always render.
769
+ #blockRows(id, block, width) {
770
+ const component = this.#transcript.get(id);
771
+ if (component === undefined)
772
+ return [];
773
+ const render = () => {
774
+ this.#transcriptBlockRenders += 1;
775
+ const rows = component.render(width);
776
+ if (!this.#customViewport || block?.kind === "user")
777
+ return rows;
778
+ return rows.map(row => nativeHyperlinkStyle(row, nativeTranscriptLinkColor));
779
+ };
780
+ if (block === undefined || block.status !== "finalized")
781
+ return render();
782
+ let byWidth = this.#renderedRows.get(id);
783
+ const cached = byWidth?.get(width);
784
+ const presentationRevision = component.presentationRevision ?? 0;
785
+ if (cached?.revision === block.revision && cached.presentationRevision === presentationRevision)
786
+ return cached.rows;
787
+ const rows = render();
788
+ if (byWidth === undefined) {
789
+ byWidth = new Map();
790
+ this.#renderedRows.set(id, byWidth);
791
+ }
792
+ byWidth.set(width, { revision: block.revision, presentationRevision, rows });
793
+ // Invariant: bare A1 probes full width before reserving the overflowing rail column;
794
+ // retain both widths without turning resize history into an unbounded cache.
795
+ while (byWidth.size > 2)
796
+ byWidth.delete(byWidth.keys().next().value);
797
+ return rows;
798
+ }
799
+ transcriptComponent(id) {
800
+ return this.#transcript.get(id);
801
+ }
802
+ exitTranscript(width) {
803
+ const rows = [];
804
+ for (const id of this.#transcriptOrder) {
805
+ const block = this.#blocksById.get(id);
806
+ if (block === undefined || (!this.#thinkingVisible && block.kind === "thinking"))
807
+ continue;
808
+ if (rows.length > 0 && (block.kind === "user" || this.#customViewport && isPiPromptStyleCompaction(block)))
809
+ rows.push("");
810
+ rows.push(...this.#blockRows(id, block, width).map(sanitizeExitTranscriptRow));
811
+ }
812
+ while (rows.at(-1) === "")
813
+ rows.pop();
814
+ return rows.join("\n");
815
+ }
816
+ appendWorkflowStatus(message) {
817
+ // Rationale: bare A1 acknowledges commands in one dock notice above the editor, where the
818
+ // reader's eye already is, instead of a transcript row that opens an empty session at the
819
+ // top-left or sinks into a long feed. The pinned route keeps Pi's chat placement.
820
+ if (this.#customViewport) {
821
+ this.#dockNotice = { kind: "status", message };
822
+ this.#invalidateChrome();
823
+ return;
824
+ }
825
+ const previousId = this.#lastWorkflowStatusId;
826
+ if (previousId !== undefined
827
+ && this.#transcriptOrder.at(-1) === previousId
828
+ && this.#workflowStatusAnchors.get(previousId) === this.#view.transcript.length) {
829
+ this.#workflowStatusMessages.set(previousId, message);
830
+ this.#documentLayouts.clear();
831
+ this.invalidate();
832
+ return;
833
+ }
834
+ const id = this.#appendAnchoredWorkflowComponent(width => [
835
+ "",
836
+ ...renderPiShellStatusText(this.#workflowStatusMessages.get(id) ?? message, width),
837
+ ]);
838
+ this.#workflowStatusMessages.set(id, message);
839
+ this.#lastWorkflowStatusId = id;
840
+ }
841
+ appendWorkflowMessage(message) {
842
+ if (message.kind === "status") {
843
+ this.appendWorkflowStatus(message.message);
844
+ return;
845
+ }
846
+ if (this.#customViewport && (message.kind === "warning" || message.kind === "error")) {
847
+ this.#dockNotice = { kind: message.kind, message: message.message };
848
+ this.#invalidateChrome();
849
+ return;
850
+ }
851
+ this.#lastWorkflowStatusId = undefined;
852
+ const presentation = { kind: message.kind, message: message.message };
853
+ this.#appendAnchoredWorkflowComponent(width => renderPiShellCommandMessage(presentation, width, this.#outputPad));
854
+ }
855
+ appendWorkflowResult(result) {
856
+ if (result.messages !== undefined) {
857
+ for (const message of result.messages)
858
+ this.appendWorkflowMessage(message);
859
+ return;
860
+ }
861
+ if (result.messageKind === "silent" || (result.outcome === "cancelled" && result.messageKind === undefined))
862
+ return;
863
+ if (result.command === "reload" && result.outcome === "completed") {
864
+ this.appendWorkflowStatus(result.message);
865
+ return;
866
+ }
867
+ if (result.command === "session" && result.outcome === "completed" && result.presentation?.kind === "session-info") {
868
+ this.#lastWorkflowStatusId = undefined;
869
+ const sessionInfo = createPiShellSessionInfo(result.presentation);
870
+ this.#appendAnchoredWorkflowComponent(width => sessionInfo.render(width), () => sessionInfo.dispose?.());
871
+ return;
872
+ }
873
+ if (result.command === "hotkeys" && result.outcome === "completed") {
874
+ this.#lastWorkflowStatusId = undefined;
875
+ const presentation = this.hotkeysPresentation();
876
+ const hotkeys = createPiShellHotkeys(presentation.bindings, presentation.getShortcuts, presentation.profile);
877
+ this.#appendAnchoredWorkflowComponent(width => hotkeys.render(width), () => hotkeys.dispose?.());
878
+ return;
879
+ }
880
+ if (result.command === "changelog" && result.outcome === "completed") {
881
+ this.#lastWorkflowStatusId = undefined;
882
+ const changelog = createPiShellChangelog(result.detail ?? "No changelog entries found.");
883
+ this.#appendAnchoredWorkflowComponent(width => changelog.render(width), () => changelog.dispose?.());
884
+ return;
885
+ }
886
+ if (result.outcome === "failed") {
887
+ this.appendWorkflowMessage({
888
+ kind: result.messageKind === "warning" ? "warning" : "error",
889
+ message: result.message,
890
+ });
891
+ return;
892
+ }
893
+ if (result.outcome === "completed" && (result.command === "quit" || result.command === "compact"))
894
+ return;
895
+ if (result.outcome === "completed" && (result.command === "new" || result.command === "name" || result.command === "debug")) {
896
+ this.#lastWorkflowStatusId = undefined;
897
+ const presentation = { kind: result.command, message: result.message, ...(result.detail === undefined ? {} : { detail: result.detail }) };
898
+ this.#appendAnchoredWorkflowComponent(width => renderPiShellCommandMessage(presentation, width, this.#outputPad));
899
+ return;
900
+ }
901
+ if (result.command === "arminsayshi" && result.outcome === "completed") {
902
+ this.#lastWorkflowStatusId = undefined;
903
+ const armin = createPiShellArmin(this.#componentRuntime);
904
+ this.#appendAnchoredWorkflowComponent(width => ["", ...armin.render(width)], () => armin.dispose?.());
905
+ return;
906
+ }
907
+ if (result.command === "dementedelves" && result.outcome === "completed") {
908
+ this.#lastWorkflowStatusId = undefined;
909
+ const announcement = createPiShellEarendilAnnouncement();
910
+ this.#appendAnchoredWorkflowComponent(width => ["", ...announcement.render(width)], () => announcement.dispose?.());
911
+ return;
912
+ }
913
+ // Rationale: the pinned engine links both share URLs; the workflow result carries the plain URLs.
914
+ const message = result.command === "share" && result.detail
915
+ ? `${linkShareUrl(result.message)}\nGist: ${piShellHyperlink(result.detail)}`
916
+ : result.message;
917
+ this.appendWorkflowStatus(message);
918
+ }
919
+ appendDaxnuts() {
920
+ this.#lastWorkflowStatusId = undefined;
921
+ const daxnuts = createPiShellDaxnuts(this.#componentRuntime);
922
+ this.#appendAnchoredWorkflowComponent(width => ["", ...daxnuts.render(width)], () => daxnuts.dispose?.());
923
+ }
924
+ toggleThinkingVisibility() {
925
+ this.setHideThinkingBlock(this.#thinkingVisible);
926
+ }
927
+ get toolsExpanded() {
928
+ return this.#toolsExpanded;
929
+ }
930
+ setToolsExpanded(expanded) {
931
+ this.#setToolsExpanded(expanded);
932
+ }
933
+ setExtensionWidget(key, component, placement) {
934
+ const previous = this.#extensionWidgets.get(key)?.component;
935
+ if (component === null)
936
+ this.#extensionWidgets.delete(key);
937
+ else
938
+ this.#extensionWidgets.set(key, { component, placement });
939
+ if (previous !== undefined && previous !== component)
940
+ previous.dispose?.();
941
+ this.invalidate();
942
+ }
943
+ setExtensionHeader(component) {
944
+ if (this.#extensionHeader !== component)
945
+ this.#extensionHeader?.dispose?.();
946
+ this.#extensionHeader = component;
947
+ this.#documentLayouts.clear();
948
+ this.invalidate();
949
+ }
950
+ setExtensionFooter(component) {
951
+ if (this.#extensionFooter !== component)
952
+ this.#extensionFooter?.dispose?.();
953
+ this.#extensionFooter = component;
954
+ this.invalidate();
955
+ }
956
+ setExtensionStatus(key, text) {
957
+ if (text === undefined)
958
+ this.#extensionStatuses.delete(key);
959
+ else
960
+ this.#extensionStatuses.set(key, text);
961
+ this.#footer.update(this.#viewWithExtensionStatuses(this.#view));
962
+ this.invalidate();
963
+ }
964
+ setExtensionWorking(message, visible = this.#extensionWorkingVisible) {
965
+ this.#extensionWorkingMessage = message;
966
+ this.#extensionWorkingVisible = visible;
967
+ this.#status.setWorkingOverride(visible ? message : undefined);
968
+ this.invalidate();
969
+ }
970
+ hotkeysPresentation() {
971
+ return {
972
+ bindings: this.editor.keybindingConfig(),
973
+ getShortcuts: bindings => this.#extensionRenderers.getShortcuts?.(bindings) ?? [],
974
+ profile: this.#customViewport ? "a1" : "pi",
975
+ };
976
+ }
977
+ resetWorkflowPresentation() {
978
+ this.#dockNotice = undefined;
979
+ this.#clearCopyAcknowledgement(false);
980
+ for (const id of this.#workflowStatusAnchors.keys()) {
981
+ this.#transcript.get(id)?.dispose?.();
982
+ this.#transcript.delete(id);
983
+ }
984
+ this.#workflowStatusAnchors.clear();
985
+ this.#workflowStatusMessages.clear();
986
+ this.#transcriptOrder = this.#transcriptOrder.filter(id => !id.startsWith("workflow-status-"));
987
+ this.#lastWorkflowStatusId = undefined;
988
+ this.#documentLayouts.clear();
989
+ this.invalidate();
990
+ }
991
+ resetExtensionUi() {
992
+ this.#extensionHeader?.dispose?.();
993
+ this.#extensionFooter?.dispose?.();
994
+ for (const { component } of this.#extensionWidgets.values())
995
+ component.dispose?.();
996
+ this.#extensionHeader = null;
997
+ this.#extensionFooter = null;
998
+ this.#extensionWidgets.clear();
999
+ this.#extensionStatuses.clear();
1000
+ this.#extensionWorkingMessage = undefined;
1001
+ this.#status.setWorkingOverride(undefined);
1002
+ this.#footer.update(this.#viewWithExtensionStatuses(this.#view));
1003
+ // Invariant: an extension renderer may have drawn transcript blocks that are now unrendered by it.
1004
+ this.#renderedRows.clear();
1005
+ this.#documentLayouts.clear();
1006
+ this.invalidate();
1007
+ }
1008
+ addExtensionNotification(message, type) {
1009
+ if (type === "info") {
1010
+ this.appendWorkflowStatus(message);
1011
+ return;
1012
+ }
1013
+ this.appendWorkflowMessage({ kind: type, message });
1014
+ }
1015
+ extensionFooterData() {
1016
+ return {
1017
+ getGitBranch: () => this.#view.status.footer?.branch ?? null,
1018
+ getExtensionStatuses: () => new Map(this.#extensionStatuses),
1019
+ getAvailableProviderCount: () => this.#view.status.footer?.availableProviderCount ?? 1,
1020
+ onBranchChange: () => () => { },
1021
+ };
1022
+ }
1023
+ usesDefaultInputSurface() {
1024
+ return this.#inputSurface === this.editor;
1025
+ }
1026
+ inputCoordinationSurface() {
1027
+ return this.#inputSurfaceCoordination;
1028
+ }
1029
+ viewportCompositionEvidence() {
1030
+ return { full: this.#fullViewportCompositions, dockOnly: this.#dockOnlyViewportCompositions };
1031
+ }
1032
+ transcriptRenderCount() {
1033
+ return this.#transcriptBlockRenders;
1034
+ }
1035
+ setFooterLevel(visible) { this.#footerLevel = visible; }
1036
+ setInputSurface(component, disposePrevious = true, coordination = "owned") {
1037
+ const next = component ?? this.editor;
1038
+ const nextCoordination = next === this.editor ? "editor" : coordination;
1039
+ if (next === this.#inputSurface) {
1040
+ this.#inputSurfaceCoordination = nextCoordination;
1041
+ return;
1042
+ }
1043
+ this.#dockInputCandidate = false;
1044
+ this.#viewportController.invalidateInputSurface();
1045
+ this.#inputSurface.setFocused?.(false);
1046
+ if (disposePrevious && this.#inputSurface !== this.editor)
1047
+ this.#inputSurface.dispose?.();
1048
+ this.#inputSurface = next;
1049
+ this.#inputSurfaceCoordination = nextCoordination;
1050
+ this.#onInputSurfaceChanged?.();
1051
+ this.#inputSurface.setFocused?.(true);
1052
+ this.invalidate();
1053
+ }
1054
+ handleInput(data) {
1055
+ this.#dockInputCandidate = this.#customViewport && this.#dockInputReuseEnabled
1056
+ && classifyPiTuiInput(data, this.#inputSurfaceCoordination) === "safe";
1057
+ this.#dockInputRevision = this.#dockInputCandidate ? this.#viewportController.presentationRevision : undefined;
1058
+ try {
1059
+ this.#inputSurface.handleInput?.(data);
1060
+ }
1061
+ catch (error) {
1062
+ this.#dockInputCandidate = false;
1063
+ throw error;
1064
+ }
1065
+ }
1066
+ invalidate() {
1067
+ this.#renderedRows.clear();
1068
+ this.#documentLayouts.clear();
1069
+ for (const component of this.#transcript.values())
1070
+ component.invalidate();
1071
+ this.#invalidateChrome();
1072
+ }
1073
+ #invalidateChrome() {
1074
+ this.header.invalidate();
1075
+ this.resources.invalidate();
1076
+ this.editor.invalidate();
1077
+ if (this.#inputSurface !== this.editor)
1078
+ this.#inputSurface.invalidate();
1079
+ this.#invalidateExtensions();
1080
+ this.#status.invalidate();
1081
+ this.#footer.invalidate();
1082
+ this.#queued.invalidate();
1083
+ }
1084
+ setFocused(focused) {
1085
+ this.#inputSurface.setFocused?.(focused);
1086
+ }
1087
+ dispose() {
1088
+ this.#clearCopyAcknowledgement(false);
1089
+ this.clearViewportPointerState();
1090
+ this.#themeUnsubscribe();
1091
+ this.header.dispose?.();
1092
+ this.resources.dispose?.();
1093
+ for (const component of this.#transcript.values())
1094
+ component.dispose?.();
1095
+ this.#transcript.clear();
1096
+ this.#renderedRows.clear();
1097
+ this.#documentLayouts.clear();
1098
+ this.#visibleViewportSnapshot = undefined;
1099
+ this.#dockInputCandidate = false;
1100
+ this.#dockInputRevision = undefined;
1101
+ if (this.#inputSurface !== this.editor)
1102
+ this.#inputSurface.dispose?.();
1103
+ this.#extensionHeader?.dispose?.();
1104
+ this.#extensionFooter?.dispose?.();
1105
+ for (const { component } of this.#extensionWidgets.values())
1106
+ component.dispose?.();
1107
+ this.#extensionWidgets.clear();
1108
+ this.editor.dispose?.();
1109
+ this.#status.dispose?.();
1110
+ this.#footer.dispose?.();
1111
+ this.#queued.dispose?.();
1112
+ }
1113
+ #invalidateTranscriptPresentation() {
1114
+ this.#renderedRows.clear();
1115
+ this.#documentLayouts.clear();
1116
+ this.invalidate();
1117
+ }
1118
+ #syncTranscript(blocks) {
1119
+ const previousIds = this.#transcriptOrder.filter(id => !id.startsWith("workflow-status-"));
1120
+ const transcriptChanged = previousIds.length !== blocks.length || blocks.some((block, index) => {
1121
+ const previous = this.#blocksById.get(block.id);
1122
+ return previousIds[index] !== block.id || previous?.revision !== block.revision;
1123
+ });
1124
+ if (transcriptChanged)
1125
+ this.#documentLayouts.clear();
1126
+ this.#blocksById.clear();
1127
+ for (const block of blocks)
1128
+ this.#blocksById.set(block.id, block);
1129
+ const nextIds = new Set(blocks.map(block => block.id));
1130
+ for (const [id, component] of this.#transcript) {
1131
+ if (id.startsWith("workflow-status-") || nextIds.has(id))
1132
+ continue;
1133
+ component.dispose?.();
1134
+ this.#transcript.delete(id);
1135
+ this.#renderedRows.delete(id);
1136
+ }
1137
+ for (const block of blocks) {
1138
+ const component = this.#transcript.get(block.id);
1139
+ if (component === undefined) {
1140
+ const created = this.#mountTranscript(block);
1141
+ this.#transcript.set(block.id, created);
1142
+ }
1143
+ else if (component.revision !== block.revision) {
1144
+ component.update(block);
1145
+ }
1146
+ }
1147
+ const statusIds = [...this.#workflowStatusAnchors.keys()];
1148
+ const order = [];
1149
+ for (let index = 0; index <= blocks.length; index += 1) {
1150
+ for (const statusId of statusIds) {
1151
+ if (this.#workflowStatusAnchors.get(statusId) === index)
1152
+ order.push(statusId);
1153
+ }
1154
+ const block = blocks[index];
1155
+ if (block !== undefined)
1156
+ order.push(block.id);
1157
+ }
1158
+ const placed = new Set(order);
1159
+ for (const statusId of statusIds) {
1160
+ if (!placed.has(statusId))
1161
+ order.push(statusId);
1162
+ }
1163
+ this.#transcriptOrder = order;
1164
+ }
1165
+ #appendAnchoredWorkflowComponent(render, dispose) {
1166
+ // Invariant: transcript-bound workflow output supersedes a pending acknowledgement.
1167
+ this.#dismissDockNotice();
1168
+ this.#workflowTranscriptSequence += 1;
1169
+ const id = `workflow-status-${this.#workflowTranscriptSequence}`;
1170
+ const component = {
1171
+ id,
1172
+ revision: 1,
1173
+ render,
1174
+ handleInput() { },
1175
+ invalidate() { },
1176
+ update() { },
1177
+ setExpanded() { },
1178
+ setOutputPad() { },
1179
+ setHideThinkingBlock() { },
1180
+ setMermaidRenderingMode() { },
1181
+ setImagePresentation() { },
1182
+ ...(dispose === undefined ? {} : { dispose }),
1183
+ };
1184
+ this.#transcript.set(id, component);
1185
+ this.#workflowStatusAnchors.set(id, this.#view.transcript.length);
1186
+ this.#transcriptOrder.push(id);
1187
+ this.#documentLayouts.clear();
1188
+ this.invalidate();
1189
+ return id;
1190
+ }
1191
+ #renderWidgets(placement, width) {
1192
+ const rows = [...this.#extensionWidgets.values()]
1193
+ .filter(widget => widget.placement === placement)
1194
+ .flatMap(widget => widget.component.render(width));
1195
+ return placement === "aboveEditor" ? ["", ...rows] : rows;
1196
+ }
1197
+ #renderStatus(width) {
1198
+ return this.#customViewport ? this.#status.renderLive(width) : this.#status.render(width);
1199
+ }
1200
+ #renderFooter(width) {
1201
+ return (this.#extensionFooter ?? this.#footer).render(width);
1202
+ }
1203
+ #viewWithExtensionStatuses(view) {
1204
+ const footer = view.status.footer;
1205
+ const statuses = new Map(footer?.extensionStatuses ?? []);
1206
+ for (const [key, text] of this.#extensionStatuses)
1207
+ statuses.set(key, text);
1208
+ return {
1209
+ ...view,
1210
+ status: {
1211
+ ...view.status,
1212
+ footer: {
1213
+ ...footer,
1214
+ branch: footer?.branch ?? null,
1215
+ sessionName: footer?.sessionName ?? null,
1216
+ availableProviderCount: footer?.availableProviderCount ?? 1,
1217
+ extensionStatuses: [...statuses],
1218
+ },
1219
+ },
1220
+ };
1221
+ }
1222
+ #invalidateExtensions() {
1223
+ this.#extensionHeader?.invalidate();
1224
+ this.#extensionFooter?.invalidate();
1225
+ for (const { component } of this.#extensionWidgets.values())
1226
+ component.invalidate();
1227
+ }
1228
+ #setToolsExpanded(expanded) {
1229
+ this.#toolsExpanded = expanded;
1230
+ this.header.setExpanded(expanded);
1231
+ this.resources.setExpanded(expanded);
1232
+ for (const component of this.#transcript.values())
1233
+ component.setExpanded(expanded);
1234
+ // Invariant: expansion changes what a block draws without changing its revision.
1235
+ this.#renderedRows.clear();
1236
+ this.#documentLayouts.clear();
1237
+ this.invalidate();
1238
+ }
1239
+ }
1240
+ const COPY_ACKNOWLEDGEMENT_DURATION_MS = 1_000;
1241
+ const SCROLLBAR_CELL_RESET = "\u001b[22;23;24;25;27;28;29;39;54;55m";
1242
+ const KITTY_IMAGE_CONTROL = /\u001b_G[\s\S]*?\u001b\\/g;
1243
+ const ITERM_IMAGE_CONTROL = /\u001b]1337;File=[^\u0007]*(?:\u0007|\u001b\\)/g;
1244
+ /** Keep semantic SGR/OSC styling while excluding non-replayable image payloads. */
1245
+ function sanitizeExitTranscriptRow(row) {
1246
+ return row.replace(KITTY_IMAGE_CONTROL, "").replace(ITERM_IMAGE_CONTROL, "");
1247
+ }
1248
+ const TERMINAL_BACKGROUND = /\u001b\[(?:4[0-9]|10[0-7]|48(?:[;:][0-9;:]*)?)m/g;
1249
+ /** Web URLs use link blue; file targets retain A1's cyan interactive accent. */
1250
+ function nativeTranscriptLinkColor(text, target) {
1251
+ return piTheme().fg(/^file:/iu.test(target) ? "accent" : "mdLink", text);
1252
+ }
1253
+ /** Repaint a source prompt with viewport chrome while preserving text, links, and foreground roles. */
1254
+ function withoutTerminalBackground(text) {
1255
+ return text.replace(TERMINAL_BACKGROUND, "");
1256
+ }
1257
+ /** Preserve the stable metadata-grey foreground for every pinned timestamp state. */
1258
+ function pinnedPromptSourceRow(block, sourceRow, width) {
1259
+ if (typeof block.payload !== "object" || block.payload === null)
1260
+ return sourceRow;
1261
+ const value = block.payload.timestamp;
1262
+ if (typeof value !== "number" || !Number.isFinite(value))
1263
+ return sourceRow;
1264
+ const timestamp = formatSubmittedPromptTime(value);
1265
+ if (timestamp === null || submittedPromptLayout(width, value).timestamp === null)
1266
+ return sourceRow;
1267
+ const rowWidth = displayWidth(sourceRow);
1268
+ const timestampWidth = displayWidth(timestamp);
1269
+ if (rowWidth < timestampWidth)
1270
+ return sourceRow;
1271
+ return overlaySpan(sourceRow, rowWidth - timestampWidth, rowWidth, paintPiSubmittedPromptTimestamp(timestamp));
1272
+ }
1273
+ function layoutPort(render, invalidate, handleInput) {
1274
+ return {
1275
+ render,
1276
+ invalidate,
1277
+ ...(handleInput === undefined ? {} : { handleInput }),
1278
+ };
1279
+ }
1280
+ export function shellResourceEntries(backend) {
1281
+ const resources = backend.nonVisualResources().map(resource => ({
1282
+ section: resource.kind === "skill"
1283
+ ? "Skills"
1284
+ : resource.kind === "prompt-template"
1285
+ ? "Prompts"
1286
+ : resource.kind === "theme"
1287
+ ? "Themes"
1288
+ : "Context",
1289
+ label: resource.kind === "prompt-template"
1290
+ ? `/${resource.label}`
1291
+ : resource.kind === "agent-context" || resource.kind === "system-prompt"
1292
+ ? compactResourceLabel(resource.sourcePath ?? resource.label)
1293
+ : resource.label,
1294
+ sourcePath: resource.sourcePath,
1295
+ diagnostic: resource.diagnostic,
1296
+ }));
1297
+ const extensions = backend.extensionResources().filter(extension => !extension.hidden);
1298
+ const loadedExtensions = extensions.filter(extension => extension.diagnostic === null);
1299
+ const extensionLabels = compactExtensionLabels(loadedExtensions);
1300
+ for (const extension of extensions) {
1301
+ const labelIndex = loadedExtensions.indexOf(extension);
1302
+ resources.push({
1303
+ section: "Extensions",
1304
+ label: extensionLabels[labelIndex] ?? compactResourceLabel(extension.sourcePath ?? extension.resolvedPath ?? "extension"),
1305
+ sourcePath: extension.sourcePath ?? extension.resolvedPath,
1306
+ diagnostic: extension.diagnostic,
1307
+ });
1308
+ }
1309
+ return resources;
1310
+ }
1311
+ function compactResourceLabel(path) {
1312
+ const segments = compactPathSegments(path);
1313
+ const leaf = segments.at(-1) ?? path;
1314
+ if ((leaf === "index.ts" || leaf === "index.js") && segments.length > 1)
1315
+ return segments.at(-2) ?? leaf;
1316
+ return leaf;
1317
+ }
1318
+ /**
1319
+ * Pinned from InteractiveMode's compact extension-label helpers at Pi commit
1320
+ * 914cf1472e715297caa30db4b9535d534a9eb718. The source metadata crosses an
1321
+ * A1-owned boundary first; the owned shell never inspects Pi's private root.
1322
+ */
1323
+ function compactExtensionLabels(extensions) {
1324
+ const localExtensions = extensions
1325
+ .filter(extension => !isPackageExtensionSource(extension.sourceInfo))
1326
+ .map(extension => {
1327
+ const path = extension.sourcePath ?? extension.resolvedPath ?? "extension";
1328
+ const segments = compactPathSegments(path);
1329
+ if (segments.length > 1 && (segments.at(-1) === "index.ts" || segments.at(-1) === "index.js"))
1330
+ segments.pop();
1331
+ return { extension, segments };
1332
+ });
1333
+ return extensions.map(extension => {
1334
+ const resourcePath = extension.sourcePath ?? extension.resolvedPath ?? "extension";
1335
+ if (isPackageExtensionSource(extension.sourceInfo)) {
1336
+ return compactPackageExtensionLabel(resourcePath, extension.sourceInfo);
1337
+ }
1338
+ const localIndex = localExtensions.findIndex(item => item.extension === extension);
1339
+ const segments = localExtensions[localIndex]?.segments;
1340
+ if (!segments || segments.length === 0)
1341
+ return compactResourceLabel(resourcePath);
1342
+ for (let count = 1; count <= segments.length; count += 1) {
1343
+ const candidate = segments.slice(-count).join("/");
1344
+ if (localExtensions.every((item, itemIndex) => itemIndex === localIndex || item.segments.slice(-count).join("/") !== candidate)) {
1345
+ return candidate;
1346
+ }
1347
+ }
1348
+ return segments.join("/");
1349
+ });
1350
+ }
1351
+ function compactPackageExtensionLabel(resourcePath, sourceInfo) {
1352
+ const sourceLabel = compactPackageSourceLabel(sourceInfo.source);
1353
+ if (!sourceLabel)
1354
+ return compactResourceLabel(resourcePath);
1355
+ const shortPath = shortPackagePath(resourcePath, sourceInfo).replaceAll("\\", "/");
1356
+ const packagePath = shortPath.startsWith("extensions/") ? shortPath.slice("extensions/".length) : shortPath;
1357
+ const slash = packagePath.lastIndexOf("/");
1358
+ const fileName = slash < 0 ? packagePath : packagePath.slice(slash + 1);
1359
+ const directory = slash < 0 ? "" : packagePath.slice(0, slash);
1360
+ const extension = fileName.lastIndexOf(".");
1361
+ const name = extension <= 0 ? fileName : fileName.slice(0, extension);
1362
+ if (name === "index")
1363
+ return !directory || directory === "." ? sourceLabel : `${sourceLabel}:${directory}`;
1364
+ return `${sourceLabel}:${packagePath}`;
1365
+ }
1366
+ function compactPackageSourceLabel(source) {
1367
+ if (source.startsWith("npm:"))
1368
+ return source.slice("npm:".length) || source;
1369
+ if (!source.startsWith("git:"))
1370
+ return source;
1371
+ const gitSource = source.slice("git:".length).trim();
1372
+ let repositoryPath;
1373
+ const scpLike = gitSource.match(/^git@[^:]+:(.+)$/);
1374
+ if (scpLike?.[1]) {
1375
+ repositoryPath = scpLike[1];
1376
+ }
1377
+ else if (/^[a-z]+:\/\//i.test(gitSource)) {
1378
+ try {
1379
+ repositoryPath = new URL(gitSource).pathname.replace(/^\/+/, "");
1380
+ }
1381
+ catch {
1382
+ return source;
1383
+ }
1384
+ }
1385
+ else {
1386
+ const slash = gitSource.indexOf("/");
1387
+ if (slash >= 0)
1388
+ repositoryPath = gitSource.slice(slash + 1);
1389
+ }
1390
+ if (!repositoryPath)
1391
+ return source;
1392
+ const ref = repositoryPath.indexOf("@");
1393
+ const withoutRef = ref < 0 ? repositoryPath : repositoryPath.slice(0, ref);
1394
+ return withoutRef.replace(/\.git$/, "") || source;
1395
+ }
1396
+ function shortPackagePath(resourcePath, sourceInfo) {
1397
+ const fullPath = normalizeResourcePath(resourcePath);
1398
+ const baseDir = sourceInfo.baseDir === null ? undefined : normalizeResourcePath(sourceInfo.baseDir).replace(/\/$/, "");
1399
+ if (baseDir) {
1400
+ const npmRoot = baseDir.match(/^(.*\/node_modules)\/(@?[^/]+(?:\/[^/]+)?)$/);
1401
+ if (npmRoot?.[1] && fullPath.startsWith(`${npmRoot[1]}/`))
1402
+ return relativeResourcePath(baseDir, fullPath);
1403
+ if (fullPath === baseDir)
1404
+ return ".";
1405
+ if (fullPath.startsWith(`${baseDir}/`))
1406
+ return fullPath.slice(baseDir.length + 1);
1407
+ }
1408
+ const npmMatch = fullPath.match(/node_modules\/(@?[^/]+(?:\/[^/]+)?)\/(.*)/);
1409
+ if (npmMatch?.[2] && sourceInfo.source.startsWith("npm:"))
1410
+ return npmMatch[2];
1411
+ const gitMatch = fullPath.match(/git\/[^/]+\/[^/]+\/(.*)/);
1412
+ if (gitMatch?.[1] && sourceInfo.source.startsWith("git:"))
1413
+ return gitMatch[1];
1414
+ return resourcePath;
1415
+ }
1416
+ function relativeResourcePath(from, to) {
1417
+ const fromSegments = from.split("/").filter(Boolean);
1418
+ const toSegments = to.split("/").filter(Boolean);
1419
+ let common = 0;
1420
+ while (common < fromSegments.length && common < toSegments.length
1421
+ && fromSegments[common]?.toLowerCase() === toSegments[common]?.toLowerCase())
1422
+ common += 1;
1423
+ return [...fromSegments.slice(common).map(() => ".."), ...toSegments.slice(common)].join("/") || ".";
1424
+ }
1425
+ function compactPathSegments(path) {
1426
+ return normalizeResourcePath(path).split("/").filter(segment => segment.length > 0 && segment !== "~");
1427
+ }
1428
+ function normalizeResourcePath(path) {
1429
+ return path.replaceAll("\\", "/");
1430
+ }
1431
+ function isPackageExtensionSource(sourceInfo) {
1432
+ const source = sourceInfo?.source ?? "";
1433
+ return source.startsWith("npm:") || source.startsWith("git:");
1434
+ }
1435
+ function transientRowsSignature(steeringRows, statusRows) {
1436
+ return `${steeringRows.length}\u0000${steeringRows.join("\u0000")}\u0001${statusRows.length}\u0000${statusRows.join("\u0000")}`;
1437
+ }
1438
+ /** "Share URL: <url>" with the URL made clickable; other share wordings pass through unchanged. */
1439
+ function linkShareUrl(message) {
1440
+ const match = /^Share URL: (\S+)$/.exec(message);
1441
+ return match === null ? message : `Share URL: ${piShellHyperlink(match[1])}`;
1442
+ }