@timurproko/a1 0.1.8-dev.235df0e → 0.1.8-dev.260

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 (485) hide show
  1. package/README.md +107 -67
  2. package/bin/cli.js +28 -10
  3. package/bin/guardian.js +8 -3
  4. package/bin/module-identity.js +69 -35
  5. package/bin/pi-tui.d.ts +6 -0
  6. package/bin/pi-tui.js +28 -0
  7. package/bin/release-cleanup.js +8 -0
  8. package/bin/supervisor.js +2 -2
  9. package/bin/sync-pi-tui-proxy.js +97 -0
  10. package/bin/ui.js +47 -20
  11. package/bin/warmup.js +27 -0
  12. package/dist/cli/capabilities.d.ts +6 -0
  13. package/dist/{src/cli → cli}/capabilities.js +1 -1
  14. package/dist/{src/cli → cli}/dispatch.d.ts +15 -1
  15. package/dist/cli/dispatch.js +261 -0
  16. package/dist/cli/package-messages.d.ts +26 -0
  17. package/dist/cli/package-messages.js +71 -0
  18. package/dist/{src/cli → cli}/packages.d.ts +11 -2
  19. package/dist/{src/cli → cli}/packages.js +24 -27
  20. package/dist/{src/cli → cli}/version-stats.d.ts +6 -0
  21. package/dist/cli/version-stats.js +112 -0
  22. package/dist/composition/agent-engine-bridge.d.ts +3 -0
  23. package/dist/composition/agent-engine-bridge.js +108 -0
  24. package/dist/composition/index.d.ts +3 -0
  25. package/dist/composition/index.js +3 -0
  26. package/dist/composition/owned-ui.d.ts +31 -0
  27. package/dist/composition/owned-ui.js +66 -0
  28. package/dist/composition/process.d.ts +16 -0
  29. package/dist/composition/process.js +45 -0
  30. package/dist/composition/settings-route-host.d.ts +8 -0
  31. package/dist/composition/settings-route-host.js +75 -0
  32. package/dist/{src/foundation/agent-engine-contracts → contracts/agent-engine}/capability-ports.d.ts +2 -2
  33. package/dist/{src/foundation/agent-engine-contracts → contracts/agent-engine}/domain-validation.js +22 -4
  34. package/dist/{src/foundation/agent-engine-contracts → contracts/agent-engine}/domain.d.ts +17 -0
  35. package/dist/{src/foundation/agent-engine-contracts → contracts/agent-engine}/package-ports.d.ts +6 -0
  36. package/dist/{src/foundation/owned-ui-contracts → contracts/owned-ui}/model.d.ts +36 -0
  37. package/dist/{src/foundation/owned-ui-contracts → contracts/owned-ui}/validation.js +25 -0
  38. package/dist/{src/features → features}/launch/development-launch.js +11 -3
  39. package/dist/{src/features → features}/launch/index.d.ts +0 -1
  40. package/dist/{src/features → features}/launch/index.js +0 -1
  41. package/dist/features/launch/intent.d.ts +10 -0
  42. package/dist/features/launch/intent.js +8 -0
  43. package/dist/{src/features → features}/launch/prepare-launch.d.ts +0 -2
  44. package/dist/{src/features → features}/launch/prepare-launch.js +2 -9
  45. package/dist/{src/features → features}/launch/profile-paths.d.ts +1 -2
  46. package/dist/{src/features → features}/launch/profile-paths.js +2 -8
  47. package/dist/{src/features → features}/launch/runtime-selection.d.ts +2 -5
  48. package/dist/{src/features → features}/owned-ui/customization.d.ts +3 -1
  49. package/dist/{src/features → features}/owned-ui/customization.js +3 -1
  50. package/dist/{src/features → features}/owned-ui/diagnostics.d.ts +2 -1
  51. package/dist/{src/features → features}/owned-ui/diagnostics.js +1 -0
  52. package/dist/{src/features → features}/owned-ui/index.d.ts +2 -0
  53. package/dist/{src/features → features}/owned-ui/index.js +2 -0
  54. package/dist/features/owned-ui/project-trust-prompt.d.ts +25 -0
  55. package/dist/features/owned-ui/project-trust-prompt.js +149 -0
  56. package/dist/{src/features → features}/owned-ui/run.d.ts +2 -2
  57. package/dist/{src/features → features}/owned-ui/run.js +2 -0
  58. package/dist/features/owned-ui/session-fork-prompt.d.ts +8 -0
  59. package/dist/features/owned-ui/session-fork-prompt.js +34 -0
  60. package/dist/{src/features → features}/owned-ui/settings-app.d.ts +3 -3
  61. package/dist/{src/features → features}/owned-ui/settings-app.js +103 -54
  62. package/dist/{src/features → features}/workspace/capabilities.d.ts +1 -1
  63. package/dist/{src/features → features}/workspace/reducer.d.ts +2 -1
  64. package/dist/{src/features → features}/workspace/reducer.js +2 -1
  65. package/dist/{src/features → features}/workspace/router.d.ts +2 -1
  66. package/dist/{src/features → features}/workspace/router.js +1 -0
  67. package/dist/{src/features → features}/workspace/store.d.ts +2 -1
  68. package/dist/{src/features → features}/workspace/store.js +1 -0
  69. package/dist/{src/foundation → foundation}/launch-guardian/main.d.ts +2 -0
  70. package/dist/{src/foundation → foundation}/launch-guardian/main.js +18 -5
  71. package/dist/{src/foundation → foundation}/lifecycle/index.d.ts +2 -0
  72. package/dist/{src/foundation → foundation}/lifecycle/index.js +2 -0
  73. package/dist/{src/foundation → foundation}/lifecycle/model.d.ts +1 -1
  74. package/dist/{src/foundation → foundation}/lifecycle/model.js +1 -1
  75. package/dist/foundation/lifecycle/paths.d.ts +30 -0
  76. package/dist/{src/foundation → foundation}/lifecycle/paths.js +29 -1
  77. package/dist/foundation/lifecycle/session-selection.d.ts +9 -0
  78. package/dist/foundation/lifecycle/session-selection.js +39 -0
  79. package/dist/foundation/lifecycle/supervisor-startup.d.ts +30 -0
  80. package/dist/foundation/lifecycle/supervisor-startup.js +106 -0
  81. package/dist/{src/foundation → foundation}/native-host-protocol/codec.d.ts +2 -0
  82. package/dist/{src/foundation → foundation}/native-host-protocol/codec.js +2 -0
  83. package/dist/{src/foundation → foundation}/native-host-protocol/messages.d.ts +1 -1
  84. package/dist/{src/foundation → foundation}/native-host-protocol/messages.js +1 -1
  85. package/dist/foundation/process-containment/darwin-process-inspector.d.ts +5 -0
  86. package/dist/foundation/process-containment/darwin-process-inspector.js +7 -0
  87. package/dist/{src/foundation → foundation}/process-containment/index.d.ts +1 -0
  88. package/dist/{src/foundation → foundation}/process-containment/index.js +1 -0
  89. package/dist/{src/foundation → foundation}/process-containment/linux-process-inspector.d.ts +1 -0
  90. package/dist/{src/foundation → foundation}/process-containment/linux-process-inspector.js +1 -0
  91. package/dist/{src/foundation → foundation}/process-containment/native-guardian-containment.d.ts +1 -0
  92. package/dist/{src/foundation → foundation}/process-containment/native-guardian-containment.js +1 -0
  93. package/dist/{src/foundation → foundation}/process-containment/windows-process-inspector.d.ts +3 -1
  94. package/dist/{src/foundation → foundation}/process-containment/windows-process-inspector.js +5 -2
  95. package/dist/{src/foundation → foundation}/protocol/client.d.ts +1 -0
  96. package/dist/{src/foundation → foundation}/protocol/client.js +1 -0
  97. package/dist/{src/foundation → foundation}/protocol/messages.d.ts +1 -0
  98. package/dist/{src/foundation → foundation}/protocol/messages.js +1 -0
  99. package/dist/{src/foundation → foundation}/release/bootstrap.d.ts +25 -6
  100. package/dist/{src/foundation → foundation}/release/bootstrap.js +124 -34
  101. package/dist/foundation/release/cohort-state.d.ts +156 -0
  102. package/dist/foundation/release/cohort-state.js +471 -0
  103. package/dist/foundation/release/dependency-layer.d.ts +82 -0
  104. package/dist/foundation/release/dependency-layer.js +497 -0
  105. package/dist/foundation/release/endpoints.d.ts +20 -0
  106. package/dist/foundation/release/endpoints.js +50 -0
  107. package/dist/foundation/release/immutable-platform.d.ts +6 -0
  108. package/dist/foundation/release/immutable-platform.js +13 -0
  109. package/dist/{src/foundation → foundation}/release/index.d.ts +4 -0
  110. package/dist/{src/foundation → foundation}/release/index.js +4 -0
  111. package/dist/foundation/release/release-gc.d.ts +71 -0
  112. package/dist/foundation/release/release-gc.js +734 -0
  113. package/dist/{src/foundation → foundation}/release/release-store.d.ts +7 -3
  114. package/dist/{src/foundation → foundation}/release/release-store.js +65 -13
  115. package/dist/{src/foundation → foundation}/release/release.d.ts +4 -1
  116. package/dist/{src/foundation → foundation}/release/release.js +10 -3
  117. package/dist/foundation/release/restart-certification.d.ts +67 -0
  118. package/dist/foundation/release/restart-certification.js +211 -0
  119. package/dist/{src/foundation → foundation}/release/update-transaction.d.ts +1 -0
  120. package/dist/{src/foundation → foundation}/release/update-transaction.js +1 -0
  121. package/dist/{src/foundation → foundation}/release/update.d.ts +19 -3
  122. package/dist/{src/foundation → foundation}/release/update.js +116 -56
  123. package/dist/foundation/release/warmup.d.ts +3 -0
  124. package/dist/foundation/release/warmup.js +35 -0
  125. package/dist/foundation/startup/index.d.ts +1 -0
  126. package/dist/foundation/startup/index.js +1 -0
  127. package/dist/foundation/startup/startup-runtime.d.ts +36 -0
  128. package/dist/foundation/startup/startup-runtime.js +140 -0
  129. package/dist/{src/foundation → foundation}/storage/control-store.d.ts +2 -1
  130. package/dist/{src/foundation → foundation}/storage/control-store.js +39 -4
  131. package/dist/{src/foundation → foundation}/structured-agent-runtime/backpressure.d.ts +2 -1
  132. package/dist/{src/foundation → foundation}/structured-agent-runtime/backpressure.js +2 -1
  133. package/dist/{src/foundation → foundation}/structured-agent-runtime/commands.d.ts +2 -1
  134. package/dist/{src/foundation → foundation}/structured-agent-runtime/commands.js +2 -1
  135. package/dist/{src/foundation → foundation}/structured-agent-runtime/handshake.d.ts +1 -1
  136. package/dist/{src/foundation → foundation}/structured-agent-runtime/handshake.js +1 -1
  137. package/dist/{src/foundation → foundation}/structured-agent-runtime/reconnection.d.ts +2 -1
  138. package/dist/{src/foundation → foundation}/structured-agent-runtime/reconnection.js +2 -1
  139. package/dist/{src/foundation → foundation}/structured-agent-runtime/state.d.ts +2 -1
  140. package/dist/{src/foundation → foundation}/structured-agent-runtime/state.js +2 -1
  141. package/dist/foundation/supervision/index.d.ts +3 -0
  142. package/dist/foundation/supervision/index.js +3 -0
  143. package/dist/foundation/supervision/main.d.ts +1 -0
  144. package/dist/foundation/supervision/main.js +80 -0
  145. package/dist/foundation/supervision/paths.d.ts +1 -0
  146. package/dist/foundation/supervision/paths.js +1 -0
  147. package/dist/{src/foundation → foundation}/supervision/server.d.ts +19 -1
  148. package/dist/{src/foundation → foundation}/supervision/server.js +65 -3
  149. package/dist/{src/foundation/pi-component-adapter → integrations/pi/components}/components.d.ts +1 -1
  150. package/dist/{src/foundation/pi-component-adapter → integrations/pi/components}/conformance.d.ts +1 -0
  151. package/dist/{src/foundation/pi-component-adapter → integrations/pi/components}/conformance.js +3 -2
  152. package/dist/{src/foundation/pi-component-adapter → integrations/pi/components}/index.d.ts +1 -1
  153. package/dist/{src/foundation/pi-component-adapter → integrations/pi/components}/index.js +1 -1
  154. package/dist/integrations/pi/components/owned-editor-ux.d.ts +55 -0
  155. package/dist/integrations/pi/components/owned-editor-ux.js +778 -0
  156. package/dist/{src/foundation/pi-component-adapter → integrations/pi/components}/shell-components.d.ts +1 -0
  157. package/dist/{src/foundation/pi-component-adapter → integrations/pi/components}/shell-components.js +1 -0
  158. package/dist/{src/foundation/pi-component-adapter → integrations/pi/components}/shell-editor-autocomplete.js +54 -6
  159. package/dist/{src/foundation/pi-component-adapter → integrations/pi/components}/shell-extension-ui.d.ts +1 -1
  160. package/dist/{src/foundation/pi-component-adapter → integrations/pi/components}/shell-footer-status.d.ts +3 -3
  161. package/dist/{src/foundation/pi-component-adapter → integrations/pi/components}/shell-footer-status.js +49 -18
  162. package/dist/integrations/pi/components/shell-presenters-info.d.ts +36 -0
  163. package/dist/integrations/pi/components/shell-presenters-info.js +78 -0
  164. package/dist/integrations/pi/components/shell-presenters-transcript.d.ts +25 -0
  165. package/dist/{src/foundation/pi-component-adapter → integrations/pi/components}/shell-presenters-transcript.js +92 -131
  166. package/dist/{src/foundation/pi-component-adapter → integrations/pi/components}/shell-selectors-dialogs.d.ts +5 -2
  167. package/dist/{src/foundation/pi-component-adapter → integrations/pi/components}/shell-selectors-dialogs.js +2 -1
  168. package/dist/{src/foundation/pi-component-adapter → integrations/pi/components}/shell-shared-facade.d.ts +57 -8
  169. package/dist/{src/foundation/pi-component-adapter → integrations/pi/components}/shell-shared-facade.js +4 -2
  170. package/dist/integrations/pi/components/submitted-prompt-adapter.d.ts +13 -0
  171. package/dist/integrations/pi/components/submitted-prompt-adapter.js +27 -0
  172. package/dist/{src/foundation/pi-component-adapter → integrations/pi/components}/upstream/adjacent/core/keybindings.d.ts +10 -2
  173. package/dist/{src/foundation/pi-component-adapter → integrations/pi/components}/upstream/adjacent/core/keybindings.js +36 -3
  174. package/dist/{src/foundation/pi-component-adapter → integrations/pi/components}/upstream/components/session-footer.d.ts +1 -1
  175. package/dist/{src/foundation/pi-engine-adapter → integrations/pi/engine}/adapter.d.ts +28 -4
  176. package/dist/{src/foundation/pi-engine-adapter → integrations/pi/engine}/adapter.js +714 -127
  177. package/dist/{src/foundation/pi-engine-adapter → integrations/pi/engine}/conformance.d.ts +2 -0
  178. package/dist/{src/foundation/pi-engine-adapter → integrations/pi/engine}/conformance.js +4 -2
  179. package/dist/integrations/pi/engine/http-dispatcher.d.ts +4 -0
  180. package/dist/integrations/pi/engine/http-dispatcher.js +25 -0
  181. package/dist/{src/foundation/pi-engine-adapter → integrations/pi/engine}/index.d.ts +4 -0
  182. package/dist/{src/foundation/pi-engine-adapter → integrations/pi/engine}/index.js +4 -0
  183. package/dist/{src/foundation/pi-engine-adapter → integrations/pi/engine}/model-auth-integration.d.ts +2 -1
  184. package/dist/{src/foundation/pi-engine-adapter → integrations/pi/engine}/model-auth-integration.js +1 -0
  185. package/dist/{src/foundation/pi-engine-adapter → integrations/pi/engine}/package-integration.d.ts +1 -1
  186. package/dist/{src/foundation/pi-engine-adapter → integrations/pi/engine}/package-integration.js +32 -26
  187. package/dist/integrations/pi/engine/project-trust-preflight.d.ts +22 -0
  188. package/dist/integrations/pi/engine/project-trust-preflight.js +50 -0
  189. package/dist/{src/foundation/pi-engine-adapter → integrations/pi/engine}/resource-extension-integration.d.ts +2 -1
  190. package/dist/{src/foundation/pi-engine-adapter → integrations/pi/engine}/resource-extension-integration.js +1 -0
  191. package/dist/{src/foundation/pi-engine-adapter → integrations/pi/engine}/runtime-integration.d.ts +19 -1
  192. package/dist/{src/foundation/pi-engine-adapter → integrations/pi/engine}/runtime-integration.js +47 -5
  193. package/dist/{src/foundation/pi-engine-adapter → integrations/pi/engine}/session-integration.d.ts +4 -2
  194. package/dist/{src/foundation/pi-engine-adapter → integrations/pi/engine}/session-integration.js +19 -4
  195. package/dist/integrations/pi/engine/session-selection.d.ts +28 -0
  196. package/dist/integrations/pi/engine/session-selection.js +90 -0
  197. package/dist/integrations/pi/engine/settings-effects.d.ts +66 -0
  198. package/dist/integrations/pi/engine/settings-effects.js +249 -0
  199. package/dist/integrations/pi/engine/settings-integration.d.ts +43 -0
  200. package/dist/{src/foundation/pi-engine-adapter → integrations/pi/engine}/settings-integration.js +102 -108
  201. package/dist/{src/foundation/pi-engine-adapter → integrations/pi/engine}/workflow-controllers.d.ts +3 -2
  202. package/dist/{src/foundation/pi-engine-adapter → integrations/pi/engine}/workflow-controllers.js +1 -0
  203. package/dist/{src/foundation/pi-engine-adapter → integrations/pi/engine}/workflows.d.ts +18 -1
  204. package/dist/integrations/pi/session-ui/clipboard-image.d.ts +11 -0
  205. package/dist/integrations/pi/session-ui/clipboard-image.js +29 -0
  206. package/dist/{src/foundation/pi-owned-ui-integration → integrations/pi/session-ui}/index.d.ts +1 -0
  207. package/dist/{src/foundation/pi-owned-ui-integration → integrations/pi/session-ui}/index.js +1 -0
  208. package/dist/integrations/pi/session-ui/prompt-chips.d.ts +23 -0
  209. package/dist/integrations/pi/session-ui/prompt-chips.js +246 -0
  210. package/dist/integrations/pi/session-ui/route-host.d.ts +5 -0
  211. package/dist/integrations/pi/session-ui/session-shell-root.d.ts +141 -0
  212. package/dist/integrations/pi/session-ui/session-shell-root.js +1158 -0
  213. package/dist/integrations/pi/session-ui/session-shell.d.ts +55 -0
  214. package/dist/{src/foundation/pi-owned-ui-integration → integrations/pi/session-ui}/session-shell.js +479 -719
  215. package/dist/integrations/pi/session-ui/session-viewport-controller.d.ts +45 -0
  216. package/dist/integrations/pi/session-ui/session-viewport-controller.js +463 -0
  217. package/dist/integrations/pi/session-ui/stream-presentation-coalescer.d.ts +29 -0
  218. package/dist/integrations/pi/session-ui/stream-presentation-coalescer.js +79 -0
  219. package/dist/integrations/pi/session-ui/system-clipboard.d.ts +20 -0
  220. package/dist/integrations/pi/session-ui/system-clipboard.js +130 -0
  221. package/dist/{src/foundation/pi-tui-runtime-adapter → integrations/pi/tui-runtime}/adapter.d.ts +8 -1
  222. package/dist/{src/foundation/pi-tui-runtime-adapter → integrations/pi/tui-runtime}/adapter.js +216 -9
  223. package/dist/{src/foundation/pi-tui-runtime-adapter → integrations/pi/tui-runtime}/contracts.d.ts +29 -6
  224. package/dist/integrations/pi/tui-runtime/damage-aware-terminal.d.ts +74 -0
  225. package/dist/integrations/pi/tui-runtime/damage-aware-terminal.js +380 -0
  226. package/dist/{src/foundation/pi-tui-runtime-adapter → integrations/pi/tui-runtime}/index.d.ts +2 -0
  227. package/dist/{src/foundation/pi-tui-runtime-adapter → integrations/pi/tui-runtime}/index.js +2 -0
  228. package/dist/integrations/pi/tui-runtime/input-presentation-coordinator.d.ts +39 -0
  229. package/dist/integrations/pi/tui-runtime/input-presentation-coordinator.js +139 -0
  230. package/dist/{src/foundation/pi-tui-runtime-adapter → integrations/pi/tui-runtime}/presentation-adapter.d.ts +1 -1
  231. package/dist/native/darwin-arm64/manifest.json +4 -4
  232. package/dist/native/darwin-arm64/process-guardian +0 -0
  233. package/dist/native/linux-x64/manifest.json +3 -3
  234. package/dist/native/linux-x64/process-guardian +0 -0
  235. package/dist/native/win32-x64/manifest.json +3 -3
  236. package/dist/native/win32-x64/process-guardian.exe +0 -0
  237. package/dist/{src/product-identity.d.ts → product-identity.d.ts} +3 -3
  238. package/dist/{src/product-identity.js → product-identity.js} +7 -5
  239. package/dist/{src/product-identity.json → product-identity.json} +11 -6
  240. package/dist/runtime-payload-inventory.json +122328 -0
  241. package/dist/{src/foundation/ui-apps → ui/apps}/contracts.d.ts +23 -1
  242. package/dist/{src/foundation/ui-apps → ui/apps}/host.d.ts +1 -1
  243. package/dist/{src/foundation/ui-apps → ui/apps}/host.js +14 -10
  244. package/dist/{src/foundation/ui-apps → ui/apps}/registry.d.ts +1 -0
  245. package/dist/{src/foundation/ui-apps → ui/apps}/registry.js +1 -0
  246. package/dist/{src/foundation/ui-components → ui/components}/dialog-panel.js +5 -3
  247. package/dist/{src/foundation/ui-components → ui/components}/frame.d.ts +1 -0
  248. package/dist/{src/foundation/ui-components → ui/components}/frame.js +1 -0
  249. package/dist/{src/foundation/ui-components → ui/components}/index.d.ts +5 -0
  250. package/dist/{src/foundation/ui-components → ui/components}/index.js +5 -0
  251. package/dist/{src/foundation/ui-components → ui/components}/line-input.d.ts +1 -6
  252. package/dist/{src/foundation/ui-components → ui/components}/line-input.js +4 -9
  253. package/dist/{src/foundation/ui-components → ui/components}/list-view.d.ts +0 -6
  254. package/dist/{src/foundation/ui-components → ui/components}/list-view.js +14 -7
  255. package/dist/{src/foundation/ui-components → ui/components}/mouse.d.ts +10 -0
  256. package/dist/{src/foundation/ui-components → ui/components}/mouse.js +23 -0
  257. package/dist/ui/components/progress-status.d.ts +2 -0
  258. package/dist/ui/components/progress-status.js +4 -0
  259. package/dist/ui/components/prompt-row.d.ts +14 -0
  260. package/dist/ui/components/prompt-row.js +20 -0
  261. package/dist/{src/foundation/ui-components → ui/components}/scrollbar.d.ts +26 -0
  262. package/dist/{src/foundation/ui-components → ui/components}/scrollbar.js +35 -0
  263. package/dist/{src/foundation/ui-components → ui/components}/shortcuts.d.ts +1 -0
  264. package/dist/{src/foundation/ui-components → ui/components}/shortcuts.js +1 -0
  265. package/dist/ui/components/spans.d.ts +25 -0
  266. package/dist/ui/components/spans.js +257 -0
  267. package/dist/ui/components/submitted-prompt.d.ts +23 -0
  268. package/dist/ui/components/submitted-prompt.js +50 -0
  269. package/dist/{src/foundation/ui-components → ui/components}/surface.d.ts +0 -5
  270. package/dist/{src/foundation/ui-components → ui/components}/surface.js +1 -5
  271. package/dist/ui/components/text-selection.d.ts +62 -0
  272. package/dist/ui/components/text-selection.js +208 -0
  273. package/dist/{src/foundation/ui-components → ui/components}/text.d.ts +14 -0
  274. package/dist/{src/foundation/ui-components → ui/components}/text.js +66 -4
  275. package/dist/ui/components/transcript-viewport.d.ts +152 -0
  276. package/dist/ui/components/transcript-viewport.js +631 -0
  277. package/dist/ui/components/visible-hyperlinks.d.ts +19 -0
  278. package/dist/ui/components/visible-hyperlinks.js +64 -0
  279. package/dist/{src/foundation/owned-ui-settings → ui/settings}/declarations.d.ts +8 -1
  280. package/dist/{src/foundation/owned-ui-settings → ui/settings}/declarations.js +33 -5
  281. package/dist/{src/foundation/owned-ui-settings → ui/settings}/migrations.d.ts +1 -1
  282. package/dist/{src/foundation/owned-ui-settings → ui/settings}/migrations.js +21 -2
  283. package/dist/{src/foundation/owned-ui-settings → ui/settings}/sections.d.ts +6 -19
  284. package/dist/{src/foundation/owned-ui-settings → ui/settings}/sections.js +32 -23
  285. package/dist/{src/foundation/owned-ui-settings → ui/settings}/session.d.ts +9 -17
  286. package/dist/{src/foundation/owned-ui-settings → ui/settings}/session.js +65 -55
  287. package/dist/{src/foundation/owned-ui-settings → ui/settings}/store.d.ts +1 -0
  288. package/dist/{src/foundation/owned-ui-settings → ui/settings}/store.js +2 -1
  289. package/docs/architecture/boundaries.md +9 -9
  290. package/docs/architecture/code-documentation.md +77 -0
  291. package/docs/architecture/process-guardian-provenance.md +3 -1
  292. package/docs/architecture/project-structure.md +67 -30
  293. package/docs/architecture/resource-and-data-policy.md +1 -1
  294. package/docs/architecture/toolchain.md +10 -10
  295. package/docs/architecture/ui-reference-provenance.md +36 -5
  296. package/docs/ci-release-runbook.md +186 -79
  297. package/docs/features/launch-profiles.md +24 -17
  298. package/docs/manual-ghost-link-baseline.md +89 -0
  299. package/docs/manual-launch-instance-acceptance.md +12 -35
  300. package/docs/manual-owned-ui-checkpoint.md +78 -0
  301. package/docs/manual-pi-boundary-candidate.md +4 -5
  302. package/docs/manual-terminal-colour-check.md +4 -3
  303. package/docs/repository-governance-live-acceptance.md +77 -0
  304. package/package.json +37 -27
  305. package/dist/src/cli/capabilities.d.ts +0 -15
  306. package/dist/src/cli/dispatch.js +0 -177
  307. package/dist/src/cli/version-stats.js +0 -72
  308. package/dist/src/composition/index.d.ts +0 -48
  309. package/dist/src/composition/index.js +0 -258
  310. package/dist/src/features/launch/intent.d.ts +0 -7
  311. package/dist/src/features/launch/intent.js +0 -4
  312. package/dist/src/features/launch/profiles.d.ts +0 -12
  313. package/dist/src/features/launch/profiles.js +0 -26
  314. package/dist/src/foundation/lifecycle/paths.d.ts +0 -10
  315. package/dist/src/foundation/pi-component-adapter/shell-presenters-transcript.d.ts +0 -57
  316. package/dist/src/foundation/pi-engine-adapter/settings-integration.d.ts +0 -55
  317. package/dist/src/foundation/pi-owned-ui-integration/route-host.d.ts +0 -29
  318. package/dist/src/foundation/pi-owned-ui-integration/session-shell.d.ts +0 -106
  319. package/dist/src/foundation/release/cohort-state.d.ts +0 -70
  320. package/dist/src/foundation/release/cohort-state.js +0 -202
  321. package/dist/src/foundation/release/release-gc.d.ts +0 -5
  322. package/dist/src/foundation/release/release-gc.js +0 -16
  323. package/dist/src/foundation/supervision/index.d.ts +0 -3
  324. package/dist/src/foundation/supervision/index.js +0 -3
  325. package/dist/src/foundation/supervision/main.d.ts +0 -1
  326. package/dist/src/foundation/supervision/main.js +0 -41
  327. package/dist/src/foundation/supervision/paths.d.ts +0 -1
  328. package/dist/src/foundation/supervision/paths.js +0 -1
  329. package/dist/src/foundation/ui-components/spans.d.ts +0 -7
  330. package/dist/src/foundation/ui-components/spans.js +0 -59
  331. package/docs/manual-transparent-checkpoint.md +0 -53
  332. /package/dist/{src/cli → cli}/index.d.ts +0 -0
  333. /package/dist/{src/cli → cli}/index.js +0 -0
  334. /package/dist/{src/cli → cli}/version.d.ts +0 -0
  335. /package/dist/{src/cli → cli}/version.js +0 -0
  336. /package/dist/{src/foundation/agent-engine-contracts → contracts/agent-engine}/capability-ports.js +0 -0
  337. /package/dist/{src/foundation/agent-engine-contracts → contracts/agent-engine}/domain-validation.d.ts +0 -0
  338. /package/dist/{src/foundation/agent-engine-contracts → contracts/agent-engine}/domain.js +0 -0
  339. /package/dist/{src/foundation/agent-engine-contracts → contracts/agent-engine}/index.d.ts +0 -0
  340. /package/dist/{src/foundation/agent-engine-contracts → contracts/agent-engine}/index.js +0 -0
  341. /package/dist/{src/foundation/agent-engine-contracts → contracts/agent-engine}/model.d.ts +0 -0
  342. /package/dist/{src/foundation/agent-engine-contracts → contracts/agent-engine}/model.js +0 -0
  343. /package/dist/{src/foundation/agent-engine-contracts → contracts/agent-engine}/package-ports.js +0 -0
  344. /package/dist/{src/foundation/agent-engine-contracts → contracts/agent-engine}/ports.d.ts +0 -0
  345. /package/dist/{src/foundation/agent-engine-contracts → contracts/agent-engine}/ports.js +0 -0
  346. /package/dist/{src/foundation/agent-engine-contracts → contracts/agent-engine}/serialization.d.ts +0 -0
  347. /package/dist/{src/foundation/agent-engine-contracts → contracts/agent-engine}/serialization.js +0 -0
  348. /package/dist/{src/foundation/agent-engine-contracts → contracts/agent-engine}/validation.d.ts +0 -0
  349. /package/dist/{src/foundation/agent-engine-contracts → contracts/agent-engine}/validation.js +0 -0
  350. /package/dist/{src/foundation/owned-ui-contracts → contracts/owned-ui}/extension-ui.d.ts +0 -0
  351. /package/dist/{src/foundation/owned-ui-contracts → contracts/owned-ui}/extension-ui.js +0 -0
  352. /package/dist/{src/foundation/owned-ui-contracts → contracts/owned-ui}/index.d.ts +0 -0
  353. /package/dist/{src/foundation/owned-ui-contracts → contracts/owned-ui}/index.js +0 -0
  354. /package/dist/{src/foundation/owned-ui-contracts → contracts/owned-ui}/model.js +0 -0
  355. /package/dist/{src/foundation/owned-ui-contracts → contracts/owned-ui}/validation.d.ts +0 -0
  356. /package/dist/{src/foundation/presentation-contracts → contracts/presentation}/index.d.ts +0 -0
  357. /package/dist/{src/foundation/presentation-contracts → contracts/presentation}/index.js +0 -0
  358. /package/dist/{src/foundation/workspace-contracts → contracts/workspace}/index.d.ts +0 -0
  359. /package/dist/{src/foundation/workspace-contracts → contracts/workspace}/index.js +0 -0
  360. /package/dist/{src/foundation/workspace-contracts → contracts/workspace}/model.d.ts +0 -0
  361. /package/dist/{src/foundation/workspace-contracts → contracts/workspace}/model.js +0 -0
  362. /package/dist/{src/foundation/workspace-contracts → contracts/workspace}/validation.d.ts +0 -0
  363. /package/dist/{src/foundation/workspace-contracts → contracts/workspace}/validation.js +0 -0
  364. /package/dist/{src/features → features}/launch/development-launch.d.ts +0 -0
  365. /package/dist/{src/features → features}/launch/initialize-profile.d.ts +0 -0
  366. /package/dist/{src/features → features}/launch/initialize-profile.js +0 -0
  367. /package/dist/{src/features → features}/launch/runtime-selection.js +0 -0
  368. /package/dist/{src/features → features}/workspace/capabilities.js +0 -0
  369. /package/dist/{src/features → features}/workspace/index.d.ts +0 -0
  370. /package/dist/{src/features → features}/workspace/index.js +0 -0
  371. /package/dist/{src/features → features}/workspace/presentation.d.ts +0 -0
  372. /package/dist/{src/features → features}/workspace/presentation.js +0 -0
  373. /package/dist/{src/features → features}/workspace/reconciliation.d.ts +0 -0
  374. /package/dist/{src/features → features}/workspace/reconciliation.js +0 -0
  375. /package/dist/{src/foundation → foundation}/launch-guardian/index.d.ts +0 -0
  376. /package/dist/{src/foundation → foundation}/launch-guardian/index.js +0 -0
  377. /package/dist/{src/foundation → foundation}/lifecycle/commands.d.ts +0 -0
  378. /package/dist/{src/foundation → foundation}/lifecycle/commands.js +0 -0
  379. /package/dist/{src/foundation → foundation}/lifecycle/launch-instance.d.ts +0 -0
  380. /package/dist/{src/foundation → foundation}/lifecycle/launch-instance.js +0 -0
  381. /package/dist/{src/foundation → foundation}/native-host-protocol/evidence.d.ts +0 -0
  382. /package/dist/{src/foundation → foundation}/native-host-protocol/evidence.js +0 -0
  383. /package/dist/{src/foundation → foundation}/native-host-protocol/index.d.ts +0 -0
  384. /package/dist/{src/foundation → foundation}/native-host-protocol/index.js +0 -0
  385. /package/dist/{src/foundation → foundation}/native-host-protocol/proof-gate.d.ts +0 -0
  386. /package/dist/{src/foundation → foundation}/native-host-protocol/proof-gate.js +0 -0
  387. /package/dist/{src/foundation → foundation}/process-containment/artifact.d.ts +0 -0
  388. /package/dist/{src/foundation → foundation}/process-containment/artifact.js +0 -0
  389. /package/dist/{src/foundation → foundation}/process-containment/contracts.d.ts +0 -0
  390. /package/dist/{src/foundation → foundation}/process-containment/contracts.js +0 -0
  391. /package/dist/{src/foundation → foundation}/protocol/index.d.ts +0 -0
  392. /package/dist/{src/foundation → foundation}/protocol/index.js +0 -0
  393. /package/dist/{src/foundation → foundation}/release/cohort-selection.d.ts +0 -0
  394. /package/dist/{src/foundation → foundation}/release/cohort-selection.js +0 -0
  395. /package/dist/{src/foundation → foundation}/release/concurrency.d.ts +0 -0
  396. /package/dist/{src/foundation → foundation}/release/concurrency.js +0 -0
  397. /package/dist/{src/foundation → foundation}/release/process-cleanup.d.ts +0 -0
  398. /package/dist/{src/foundation → foundation}/release/process-cleanup.js +0 -0
  399. /package/dist/{src/foundation → foundation}/release/stable-release.d.ts +0 -0
  400. /package/dist/{src/foundation → foundation}/release/stable-release.js +0 -0
  401. /package/dist/{src/foundation → foundation}/storage/index.d.ts +0 -0
  402. /package/dist/{src/foundation → foundation}/storage/index.js +0 -0
  403. /package/dist/{src/foundation → foundation}/structured-agent-runtime/index.d.ts +0 -0
  404. /package/dist/{src/foundation → foundation}/structured-agent-runtime/index.js +0 -0
  405. /package/dist/{src/foundation/pi-component-adapter → integrations/pi/components}/components.js +0 -0
  406. /package/dist/{src/foundation/pi-component-adapter → integrations/pi/components}/resources/builtin-themes.d.ts +0 -0
  407. /package/dist/{src/foundation/pi-component-adapter → integrations/pi/components}/resources/builtin-themes.js +0 -0
  408. /package/dist/{src/foundation/pi-component-adapter → integrations/pi/components}/shell-editor-autocomplete.d.ts +0 -0
  409. /package/dist/{src/foundation/pi-component-adapter → integrations/pi/components}/shell-extension-ui.js +0 -0
  410. /package/dist/{src/foundation/pi-component-adapter → integrations/pi/components}/theme.d.ts +0 -0
  411. /package/dist/{src/foundation/pi-component-adapter → integrations/pi/components}/theme.js +0 -0
  412. /package/dist/{src/foundation/pi-component-adapter → integrations/pi/components}/upstream/components/countdown-timer.d.ts +0 -0
  413. /package/dist/{src/foundation/pi-component-adapter → integrations/pi/components}/upstream/components/countdown-timer.js +0 -0
  414. /package/dist/{src/foundation/pi-component-adapter → integrations/pi/components}/upstream/components/custom-entry.d.ts +0 -0
  415. /package/dist/{src/foundation/pi-component-adapter → integrations/pi/components}/upstream/components/custom-entry.js +0 -0
  416. /package/dist/{src/foundation/pi-component-adapter → integrations/pi/components}/upstream/components/daxnuts.d.ts +0 -0
  417. /package/dist/{src/foundation/pi-component-adapter → integrations/pi/components}/upstream/components/daxnuts.js +0 -0
  418. /package/dist/{src/foundation/pi-component-adapter → integrations/pi/components}/upstream/components/earendil-announcement.d.ts +0 -0
  419. /package/dist/{src/foundation/pi-component-adapter → integrations/pi/components}/upstream/components/earendil-announcement.js +0 -0
  420. /package/dist/{src/foundation/pi-component-adapter → integrations/pi/components}/upstream/components/extension-editor.d.ts +0 -0
  421. /package/dist/{src/foundation/pi-component-adapter → integrations/pi/components}/upstream/components/extension-editor.js +0 -0
  422. /package/dist/{src/foundation/pi-component-adapter → integrations/pi/components}/upstream/components/first-time-setup.d.ts +0 -0
  423. /package/dist/{src/foundation/pi-component-adapter → integrations/pi/components}/upstream/components/first-time-setup.js +0 -0
  424. /package/dist/{src/foundation/pi-component-adapter → integrations/pi/components}/upstream/components/markdown-transform.d.ts +0 -0
  425. /package/dist/{src/foundation/pi-component-adapter → integrations/pi/components}/upstream/components/markdown-transform.js +0 -0
  426. /package/dist/{src/foundation/pi-component-adapter → integrations/pi/components}/upstream/components/mermaid.d.ts +0 -0
  427. /package/dist/{src/foundation/pi-component-adapter → integrations/pi/components}/upstream/components/mermaid.js +0 -0
  428. /package/dist/{src/foundation/pi-component-adapter → integrations/pi/components}/upstream/components/owned-editor.d.ts +0 -0
  429. /package/dist/{src/foundation/pi-component-adapter → integrations/pi/components}/upstream/components/owned-editor.js +0 -0
  430. /package/dist/{src/foundation/pi-component-adapter → integrations/pi/components}/upstream/components/scoped-models-selector.d.ts +0 -0
  431. /package/dist/{src/foundation/pi-component-adapter → integrations/pi/components}/upstream/components/scoped-models-selector.js +0 -0
  432. /package/dist/{src/foundation/pi-component-adapter → integrations/pi/components}/upstream/components/session-footer.js +0 -0
  433. /package/dist/{src/foundation/pi-component-adapter → integrations/pi/components}/upstream/components/session-selector-search.d.ts +0 -0
  434. /package/dist/{src/foundation/pi-component-adapter → integrations/pi/components}/upstream/components/session-selector-search.js +0 -0
  435. /package/dist/{src/foundation/pi-component-adapter → integrations/pi/components}/upstream/components/session-selector.d.ts +0 -0
  436. /package/dist/{src/foundation/pi-component-adapter → integrations/pi/components}/upstream/components/session-selector.js +0 -0
  437. /package/dist/{src/foundation/pi-component-adapter → integrations/pi/components}/upstream/components/skill-invocation-message.d.ts +0 -0
  438. /package/dist/{src/foundation/pi-component-adapter → integrations/pi/components}/upstream/components/skill-invocation-message.js +0 -0
  439. /package/dist/{src/foundation/pi-component-adapter → integrations/pi/components}/upstream/components/status-indicator.d.ts +0 -0
  440. /package/dist/{src/foundation/pi-component-adapter → integrations/pi/components}/upstream/components/status-indicator.js +0 -0
  441. /package/dist/{src/foundation/pi-component-adapter → integrations/pi/components}/upstream/components/tree-selector.d.ts +0 -0
  442. /package/dist/{src/foundation/pi-component-adapter → integrations/pi/components}/upstream/components/tree-selector.js +0 -0
  443. /package/dist/{src/foundation/pi-component-adapter → integrations/pi/components}/upstream/components/trust-selector.d.ts +0 -0
  444. /package/dist/{src/foundation/pi-component-adapter → integrations/pi/components}/upstream/components/trust-selector.js +0 -0
  445. /package/dist/{src/foundation/pi-component-adapter → integrations/pi/components}/upstream/external-editor.d.ts +0 -0
  446. /package/dist/{src/foundation/pi-component-adapter → integrations/pi/components}/upstream/external-editor.js +0 -0
  447. /package/dist/{src/foundation/pi-component-adapter → integrations/pi/components}/upstream/model-search.d.ts +0 -0
  448. /package/dist/{src/foundation/pi-component-adapter → integrations/pi/components}/upstream/model-search.js +0 -0
  449. /package/dist/{src/foundation/pi-component-adapter → integrations/pi/components}/upstream/theme/theme-controller.d.ts +0 -0
  450. /package/dist/{src/foundation/pi-component-adapter → integrations/pi/components}/upstream/theme/theme-controller.js +0 -0
  451. /package/dist/{src/foundation/pi-component-adapter → integrations/pi/components}/upstream/theme/theme.d.ts +0 -0
  452. /package/dist/{src/foundation/pi-component-adapter → integrations/pi/components}/upstream/theme/theme.js +0 -0
  453. /package/dist/{src/foundation/pi-engine-adapter → integrations/pi/engine}/pi-settings-metadata.json +0 -0
  454. /package/dist/{src/foundation/pi-engine-adapter → integrations/pi/engine}/public-main-entry.d.ts +0 -0
  455. /package/dist/{src/foundation/pi-engine-adapter → integrations/pi/engine}/public-main-entry.js +0 -0
  456. /package/dist/{src/foundation/pi-engine-adapter → integrations/pi/engine}/workflows.js +0 -0
  457. /package/dist/{src/foundation/pi-owned-ui-integration → integrations/pi/session-ui}/route-host.js +0 -0
  458. /package/dist/{src/foundation/pi-tui-runtime-adapter → integrations/pi/tui-runtime}/conformance.d.ts +0 -0
  459. /package/dist/{src/foundation/pi-tui-runtime-adapter → integrations/pi/tui-runtime}/conformance.js +0 -0
  460. /package/dist/{src/foundation/pi-tui-runtime-adapter → integrations/pi/tui-runtime}/contracts.js +0 -0
  461. /package/dist/{src/foundation/pi-tui-runtime-adapter → integrations/pi/tui-runtime}/presentation-adapter.js +0 -0
  462. /package/dist/{src/foundation/ui-apps → ui/apps}/contracts.js +0 -0
  463. /package/dist/{src/foundation/ui-apps → ui/apps}/index.d.ts +0 -0
  464. /package/dist/{src/foundation/ui-apps → ui/apps}/index.js +0 -0
  465. /package/dist/{src/foundation/ui-components → ui/components}/dialog-panel.d.ts +0 -0
  466. /package/dist/{src/foundation/ui-components → ui/components}/label.d.ts +0 -0
  467. /package/dist/{src/foundation/ui-components → ui/components}/label.js +0 -0
  468. /package/dist/{src/foundation/ui-components → ui/components}/list-block.d.ts +0 -0
  469. /package/dist/{src/foundation/ui-components → ui/components}/list-block.js +0 -0
  470. /package/dist/{src/foundation/ui-components → ui/components}/pane.d.ts +0 -0
  471. /package/dist/{src/foundation/ui-components → ui/components}/pane.js +0 -0
  472. /package/dist/{src/foundation/ui-components → ui/components}/revision.d.ts +0 -0
  473. /package/dist/{src/foundation/ui-components → ui/components}/revision.js +0 -0
  474. /package/dist/{src/foundation/ui-components → ui/components}/status-line.d.ts +0 -0
  475. /package/dist/{src/foundation/ui-components → ui/components}/status-line.js +0 -0
  476. /package/dist/{src/foundation/ui-components → ui/components}/stepper.d.ts +0 -0
  477. /package/dist/{src/foundation/ui-components → ui/components}/stepper.js +0 -0
  478. /package/dist/{src/foundation/ui-components → ui/components}/theme.d.ts +0 -0
  479. /package/dist/{src/foundation/ui-components → ui/components}/theme.js +0 -0
  480. /package/dist/{src/foundation/ui-components → ui/components}/value-menu.d.ts +0 -0
  481. /package/dist/{src/foundation/ui-components → ui/components}/value-menu.js +0 -0
  482. /package/dist/{src/foundation/owned-ui-settings → ui/settings}/index.d.ts +0 -0
  483. /package/dist/{src/foundation/owned-ui-settings → ui/settings}/index.js +0 -0
  484. /package/dist/{src/foundation/owned-ui-settings → ui/settings}/resolution.d.ts +0 -0
  485. /package/dist/{src/foundation/owned-ui-settings → ui/settings}/resolution.js +0 -0
@@ -0,0 +1,257 @@
1
+ import { displayWidth } from "./text.js";
2
+ /**
3
+ * Ported from the A1 UI reference implementation (`core/presentation/spans.ts`).
4
+ * Writing over part of a rendered row is not string slicing: the row carries
5
+ * styling and hyperlink sequences, and cutting through them either loses the
6
+ * styling of the tail or leaks the span's own reset into it.
7
+ */
8
+ const ANSI_SEQUENCE = "\\u001b(?:\\[[0-?]*[ -/]*[@-~]|[\\]_][^\\u0007\\u001b]*(?:\\u0007|\\u001b\\\\|$))";
9
+ const ANSI_SPLIT = new RegExp(`(${ANSI_SEQUENCE})`);
10
+ const HYPERLINK = /^\]8;;([^]*)(?:|\\)?$/;
11
+ const HYPERLINK_OFF = "]8;;\\";
12
+ const SGR = /^\[[0-9;]*m$/;
13
+ const BARE_URL = /https?:\/\/[^\s\u0000-\u001f\u007f<>"']+/giu;
14
+ const TRAILING_URL_PUNCTUATION = /[.,;:!?]/u;
15
+ const GRAPHEMES = new Intl.Segmenter(undefined, { granularity: "grapheme" });
16
+ /**
17
+ * Replaces the visible columns `[from, to)` of `line` with `span`, preserving
18
+ * the styling before it and re-asserting whatever was still open afterwards, so
19
+ * the tail keeps the colour it had. A wide character straddling either edge is
20
+ * replaced by spaces rather than split.
21
+ */
22
+ export function overlaySpan(line, from, to, span) {
23
+ let head = "";
24
+ let replay = "";
25
+ let tail = "";
26
+ let column = 0;
27
+ let hyperlinkOpen = false;
28
+ for (const token of line.split(ANSI_SPLIT)) {
29
+ if (!token)
30
+ continue;
31
+ if (token.startsWith("")) {
32
+ if (column >= to) {
33
+ tail += token;
34
+ continue;
35
+ }
36
+ if (column < from) {
37
+ head += token;
38
+ const link = HYPERLINK.exec(token);
39
+ if (link)
40
+ hyperlinkOpen = (link[1] ?? "").length > 0;
41
+ }
42
+ // Invariant: re-assert everything still active: the span's own reset clobbers the tail.
43
+ replay += token;
44
+ continue;
45
+ }
46
+ for (const { segment } of GRAPHEMES.segment(token)) {
47
+ const width = displayWidth(segment);
48
+ if (column + width <= from)
49
+ head += segment;
50
+ else if (column >= to)
51
+ tail += segment;
52
+ else if (column < from)
53
+ head += " ".repeat(from - column);
54
+ else if (column + width > to)
55
+ tail += " ".repeat(column + width - to);
56
+ column += width;
57
+ }
58
+ }
59
+ if (column < from)
60
+ head += " ".repeat(from - column);
61
+ return head + (hyperlinkOpen ? HYPERLINK_OFF : "") + span + replay + tail;
62
+ }
63
+ /** Wraps visible columns `[from,to)` in an explicit OSC 8 hyperlink. */
64
+ export function hyperlinkSgrSpan(line, from, to, target, widthOf = displayWidth) {
65
+ const on = `\u001b]8;;${target}\u001b\\`;
66
+ const off = "\u001b]8;;\u001b\\";
67
+ let output = "";
68
+ let column = 0;
69
+ let inside = false;
70
+ for (const token of line.split(ANSI_SPLIT)) {
71
+ if (!token)
72
+ continue;
73
+ if (token.startsWith("\u001b")) {
74
+ output += token;
75
+ continue;
76
+ }
77
+ for (const { segment } of GRAPHEMES.segment(token)) {
78
+ const shouldBeInside = column >= from && column < to;
79
+ if (shouldBeInside !== inside) {
80
+ output += shouldBeInside ? on : off;
81
+ inside = shouldBeInside;
82
+ }
83
+ output += segment;
84
+ column += widthOf(segment);
85
+ }
86
+ }
87
+ if (inside)
88
+ output += off;
89
+ return output;
90
+ }
91
+ /** Returns the OSC 8 target painted at a zero-based visible terminal column. */
92
+ export function hyperlinkTargetAtColumn(line, targetColumn, widthOf = displayWidth) {
93
+ if (targetColumn < 0)
94
+ return undefined;
95
+ let hyperlinkTarget;
96
+ let column = 0;
97
+ for (const token of line.split(ANSI_SPLIT)) {
98
+ if (!token)
99
+ continue;
100
+ const link = HYPERLINK.exec(token);
101
+ if (link) {
102
+ hyperlinkTarget = (link[1] ?? "") || undefined;
103
+ continue;
104
+ }
105
+ if (token.startsWith("\u001b"))
106
+ continue;
107
+ for (const { segment } of GRAPHEMES.segment(token)) {
108
+ const width = widthOf(segment);
109
+ if (targetColumn >= column && targetColumn < column + width)
110
+ return hyperlinkTarget;
111
+ column += width;
112
+ }
113
+ }
114
+ return undefined;
115
+ }
116
+ /**
117
+ * Gives existing and bare web links explicit, tightly bounded OSC 8 regions so
118
+ * the terminal owns dotted-idle/solid-hover decoration without leaking hover
119
+ * state into cells repainted during scrolling.
120
+ */
121
+ export function nativeHyperlinkStyle(line, color = text => text) {
122
+ let hyperlinkTarget;
123
+ let sgrReplay = "";
124
+ let output = "";
125
+ for (const token of line.split(ANSI_SPLIT)) {
126
+ if (!token)
127
+ continue;
128
+ const link = HYPERLINK.exec(token);
129
+ if (link) {
130
+ hyperlinkTarget = (link[1] ?? "") || undefined;
131
+ output += token;
132
+ continue;
133
+ }
134
+ if (!token.startsWith("\u001b")) {
135
+ output += hyperlinkTarget === undefined
136
+ ? decorateBareUrls(token, color, sgrReplay)
137
+ : color(token, hyperlinkTarget);
138
+ continue;
139
+ }
140
+ if (SGR.test(token)) {
141
+ if (token === "\u001b[0m")
142
+ sgrReplay = token;
143
+ else
144
+ sgrReplay += token;
145
+ }
146
+ if (hyperlinkTarget === undefined || (token !== "\u001b[4m" && token !== "\u001b[24m"))
147
+ output += token;
148
+ }
149
+ return hyperlinkTarget === undefined ? output : output + HYPERLINK_OFF;
150
+ }
151
+ /**
152
+ * Held-button paint for terminal-native links. OSC 8 is removed so the terminal
153
+ * cannot switch a selected link to its solid hover underline. A dotted SGR
154
+ * underline preserves the idle appearance, and VS15 transiently breaks native
155
+ * plain-text URL detection without changing visible width.
156
+ */
157
+ export function heldNativeHyperlinkStyle(line) {
158
+ let hyperlinkTarget;
159
+ let fileDetectorBroken = false;
160
+ let output = "";
161
+ for (const token of line.split(ANSI_SPLIT)) {
162
+ if (!token)
163
+ continue;
164
+ const link = HYPERLINK.exec(token);
165
+ if (link) {
166
+ const nextTarget = (link[1] ?? "") || undefined;
167
+ if ((nextTarget !== undefined) !== (hyperlinkTarget !== undefined)) {
168
+ output += nextTarget === undefined ? "\u001b[24m" : "\u001b[4:4m";
169
+ }
170
+ if (nextTarget !== hyperlinkTarget)
171
+ fileDetectorBroken = false;
172
+ hyperlinkTarget = nextTarget;
173
+ continue;
174
+ }
175
+ if (token.startsWith("\u001b")) {
176
+ output += token;
177
+ // Protocol: foreground helpers may reset every SGR attribute; restore the held
178
+ // dotted underline without disturbing the source colour or intensity.
179
+ if (hyperlinkTarget !== undefined && SGR.test(token))
180
+ output += "\u001b[4:4m";
181
+ continue;
182
+ }
183
+ if (hyperlinkTarget === undefined) {
184
+ output += token;
185
+ continue;
186
+ }
187
+ let painted = token.replaceAll("https://", "https:\uFE0E//").replaceAll("http://", "http:\uFE0E//");
188
+ // Platform: Windows Terminal also detects file-link labels such as package.json and
189
+ // D:/work/file.ts after OSC 8 is removed. Break that detector once inside
190
+ // the paint-only label; semantic transcript text remains untouched.
191
+ if (!fileDetectorBroken && /^file:/iu.test(hyperlinkTarget)) {
192
+ const firstVisible = /\S/u.exec(painted);
193
+ if (firstVisible?.index !== undefined) {
194
+ const index = firstVisible.index;
195
+ const codePoint = painted.codePointAt(index) ?? 0;
196
+ const end = index + (codePoint > 0xffff ? 2 : 1);
197
+ painted = `${painted.slice(0, end)}\uFE0E${painted.slice(end)}`;
198
+ fileDetectorBroken = true;
199
+ }
200
+ }
201
+ output += painted;
202
+ }
203
+ return hyperlinkTarget === undefined ? output : `${output}\u001b[24m`;
204
+ }
205
+ function decorateBareUrls(text, color, sgrReplay) {
206
+ return text.replace(BARE_URL, candidate => {
207
+ const { target, trailing } = splitUrlTrailingPunctuation(candidate);
208
+ if (target.length === 0)
209
+ return candidate;
210
+ return `\u001b]8;;${target}\u001b\\\u001b[24m${color(target, target)}${HYPERLINK_OFF}${sgrReplay}${trailing}`;
211
+ });
212
+ }
213
+ function splitUrlTrailingPunctuation(candidate) {
214
+ let end = candidate.length;
215
+ while (end > 0 && TRAILING_URL_PUNCTUATION.test(candidate[end - 1] ?? ""))
216
+ end -= 1;
217
+ for (const [opening, closing] of [["(", ")"], ["[", "]"], ["{", "}"]]) {
218
+ while (candidate.slice(0, end).endsWith(closing)
219
+ && occurrences(candidate.slice(0, end), closing) > occurrences(candidate.slice(0, end), opening)) {
220
+ end -= 1;
221
+ }
222
+ }
223
+ return { target: candidate.slice(0, end), trailing: candidate.slice(end) };
224
+ }
225
+ function occurrences(text, value) {
226
+ return text.split(value).length - 1;
227
+ }
228
+ export function backgroundSgrSpan(line, from, to, on = "\u001b[47m", off = "\u001b[49m", widthOf = displayWidth) {
229
+ let output = "";
230
+ let seen = "";
231
+ let column = 0;
232
+ let inside = false;
233
+ for (const token of line.split(ANSI_SPLIT)) {
234
+ if (!token)
235
+ continue;
236
+ if (token.startsWith("\u001b")) {
237
+ output += token;
238
+ if (SGR.test(token))
239
+ seen += token;
240
+ if (inside)
241
+ output += on;
242
+ continue;
243
+ }
244
+ for (const { segment } of GRAPHEMES.segment(token)) {
245
+ const shouldBeInside = column >= from && column < to;
246
+ if (shouldBeInside !== inside) {
247
+ output += shouldBeInside ? on : off + seen;
248
+ inside = shouldBeInside;
249
+ }
250
+ output += segment;
251
+ column += widthOf(segment);
252
+ }
253
+ }
254
+ if (inside)
255
+ output += off;
256
+ return output;
257
+ }
@@ -0,0 +1,23 @@
1
+ /** Visible width of the submitted-prompt prefix (`❯ `). */
2
+ export declare const SUBMITTED_PROMPT_PREFIX_WIDTH = 2;
3
+ export interface SubmittedPromptStyle {
4
+ readonly prefix?: (text: string) => string;
5
+ readonly timestamp?: (text: string) => string;
6
+ }
7
+ export interface SubmittedPromptLayout {
8
+ readonly contentWidth: number;
9
+ readonly timestamp: string | null;
10
+ }
11
+ /** Formats transcript metadata, never render time, as local 24-hour HH:mm. */
12
+ export declare function formatSubmittedPromptTime(source: Date | number): string | null;
13
+ /**
14
+ * Computes the width at which the prompt's Markdown body must be rendered.
15
+ * The timestamp is omitted rather than allowing it to crowd useful content.
16
+ */
17
+ export declare function submittedPromptLayout(width: number, source?: Date | number | null): SubmittedPromptLayout;
18
+ /**
19
+ * Composes already-rendered prompt content into the compact submitted bar.
20
+ * Continuations align below the content, not below the prefix, and no row can
21
+ * exceed the supplied terminal width even when the content renderer misbehaves.
22
+ */
23
+ export declare function composeSubmittedPromptRows(contentRows: readonly string[], width: number, source?: Date | number | null, style?: SubmittedPromptStyle): readonly string[];
@@ -0,0 +1,50 @@
1
+ import { displayWidth, truncateToWidth } from "./text.js";
2
+ /** Visible width of the submitted-prompt prefix (`❯ `). */
3
+ export const SUBMITTED_PROMPT_PREFIX_WIDTH = 2;
4
+ const TIMESTAMP_MARGIN = 3;
5
+ const MIN_USEFUL_CONTENT_WIDTH = 8;
6
+ /** Formats transcript metadata, never render time, as local 24-hour HH:mm. */
7
+ export function formatSubmittedPromptTime(source) {
8
+ const date = source instanceof Date ? source : new Date(source);
9
+ if (!Number.isFinite(date.getTime()))
10
+ return null;
11
+ return `${String(date.getHours()).padStart(2, "0")}:${String(date.getMinutes()).padStart(2, "0")}`;
12
+ }
13
+ /**
14
+ * Computes the width at which the prompt's Markdown body must be rendered.
15
+ * The timestamp is omitted rather than allowing it to crowd useful content.
16
+ */
17
+ export function submittedPromptLayout(width, source) {
18
+ const boundedWidth = Math.max(1, width);
19
+ const timestamp = source === undefined || source === null ? null : formatSubmittedPromptTime(source);
20
+ const timestampReserve = timestamp === null ? 0 : displayWidth(timestamp) + TIMESTAMP_MARGIN;
21
+ const canShowTimestamp = timestamp !== null
22
+ && boundedWidth - SUBMITTED_PROMPT_PREFIX_WIDTH - timestampReserve >= MIN_USEFUL_CONTENT_WIDTH;
23
+ return {
24
+ contentWidth: Math.max(1, boundedWidth - SUBMITTED_PROMPT_PREFIX_WIDTH - (canShowTimestamp ? timestampReserve : 0)),
25
+ timestamp: canShowTimestamp ? timestamp : null,
26
+ };
27
+ }
28
+ /**
29
+ * Composes already-rendered prompt content into the compact submitted bar.
30
+ * Continuations align below the content, not below the prefix, and no row can
31
+ * exceed the supplied terminal width even when the content renderer misbehaves.
32
+ */
33
+ export function composeSubmittedPromptRows(contentRows, width, source, style = {}) {
34
+ if (width <= 0)
35
+ return [];
36
+ const layout = submittedPromptLayout(width, source);
37
+ const prefix = (style.prefix ?? identity)("❯ ");
38
+ const rows = (contentRows.length === 0 ? [""] : contentRows).map((row, index) => {
39
+ const content = truncateToWidth(row, layout.contentWidth);
40
+ return `${index === 0 ? prefix : " ".repeat(SUBMITTED_PROMPT_PREFIX_WIDTH)}${content}`;
41
+ });
42
+ if (layout.timestamp !== null && rows[0] !== undefined) {
43
+ const gap = Math.max(1, width - displayWidth(rows[0]) - displayWidth(layout.timestamp));
44
+ rows[0] = `${rows[0]}${" ".repeat(gap)}${(style.timestamp ?? identity)(layout.timestamp)}`;
45
+ }
46
+ return rows.map(row => truncateToWidth(row, width));
47
+ }
48
+ function identity(text) {
49
+ return text;
50
+ }
@@ -1,10 +1,5 @@
1
1
  import { type ScrollbarGeometry } from "./scrollbar.js";
2
2
  import type { UiTheme } from "./theme.js";
3
- /**
4
- * The chrome around a list: the rail down its right edge, and what it shows when
5
- * there is nothing to list. Both are the same on any screen, so neither is a
6
- * screen's to draw.
7
- */
8
3
  /** Columns the rail occupies: its own, plus the gap before it. */
9
4
  export declare const RAIL_COLUMNS = 2;
10
5
  export interface RailOptions {
@@ -1,10 +1,6 @@
1
1
  import { isThumbRow } from "./scrollbar.js";
2
2
  import { displayWidth } from "./text.js";
3
- /**
4
- * The chrome around a list: the rail down its right edge, and what it shows when
5
- * there is nothing to list. Both are the same on any screen, so neither is a
6
- * screen's to draw.
7
- */
3
+ // Rationale: shared list chrome belongs here rather than in individual screens.
8
4
  /** Columns the rail occupies: its own, plus the gap before it. */
9
5
  export const RAIL_COLUMNS = 2;
10
6
  /** Draws the rail beside each row, padding the rows to a common width first. */
@@ -0,0 +1,62 @@
1
+ /** A reported pointer cell plus its grapheme-aligned zero-based boundaries. */
2
+ export interface TextSelectionPoint {
3
+ readonly line: number;
4
+ readonly column: number;
5
+ readonly from?: number;
6
+ readonly to?: number;
7
+ }
8
+ export interface TextSelection {
9
+ readonly anchor: TextSelectionPoint;
10
+ readonly head: TextSelectionPoint;
11
+ readonly selecting: boolean;
12
+ /** Ordinary point selection has received at least one distinct motion report. */
13
+ readonly dragged?: boolean;
14
+ /** Word selection uses inclusive pointer-cell endpoints supplied by its semantic range. */
15
+ readonly cell?: boolean;
16
+ readonly fullRow?: boolean;
17
+ /** Paint an edge whitespace run through the viewport's overlaid rail cell. */
18
+ readonly throughFinalColumn?: boolean;
19
+ }
20
+ export interface TextSelectionClick {
21
+ readonly time: number;
22
+ readonly line: number;
23
+ readonly column: number;
24
+ readonly count: number;
25
+ }
26
+ export interface TextSelectionLineContent {
27
+ readonly from?: number;
28
+ readonly to?: number;
29
+ readonly selectable?: boolean;
30
+ }
31
+ /** Ordered zero-based, half-open display-column boundaries. */
32
+ export interface OrderedTextSelection {
33
+ readonly start: TextSelectionPoint;
34
+ readonly end: TextSelectionPoint;
35
+ readonly fullRow?: boolean;
36
+ readonly throughFinalColumn?: boolean;
37
+ }
38
+ export interface TextSelectionPressInput {
39
+ readonly line: number;
40
+ readonly column: number;
41
+ readonly contentWidth: number;
42
+ readonly lineText: string;
43
+ readonly lineContent?: TextSelectionLineContent;
44
+ readonly previousClick?: TextSelectionClick;
45
+ readonly now?: number;
46
+ }
47
+ export declare const TEXT_SELECTION_MULTI_CLICK_MS = 500;
48
+ export declare function orderedTextSelection(selection: TextSelection | undefined): OrderedTextSelection | undefined;
49
+ export declare function pressTextSelection(input: TextSelectionPressInput): {
50
+ readonly selection?: TextSelection;
51
+ readonly click: TextSelectionClick;
52
+ readonly kind: "point" | "word" | "line";
53
+ };
54
+ export declare function extendTextSelection(selection: TextSelection | undefined, point: TextSelectionPoint): TextSelection | undefined;
55
+ export declare function releaseTextSelection(selection: TextSelection | undefined): TextSelection | undefined;
56
+ export declare function textSelectionLineExtendColumn(selection: TextSelection, line: number, contentWidth: number): number;
57
+ /** Resolves a reported one-based pointer cell to the complete grapheme it intersects. */
58
+ export declare function textSelectionPointAt(line: number, column: number, lineText: string): TextSelectionPoint;
59
+ export declare function textSelectionText(selection: OrderedTextSelection, rows: readonly string[], lineContent?: (line: number) => TextSelectionLineContent | undefined): string;
60
+ /** Returns the plain cells covered by [from,to), expanding at grapheme edges. */
61
+ export declare function plainTextBetweenColumns(line: string, from: number, to: number): string;
62
+ export declare function usefulTextLineContent(line: string, from?: number): TextSelectionLineContent;
@@ -0,0 +1,208 @@
1
+ import { displayWidth, stripAnsi } from "./text.js";
2
+ const GRAPHEMES = new Intl.Segmenter(undefined, { granularity: "grapheme" });
3
+ export const TEXT_SELECTION_MULTI_CLICK_MS = 500;
4
+ export function orderedTextSelection(selection) {
5
+ if (selection === undefined)
6
+ return undefined;
7
+ const { anchor, head } = selection;
8
+ if (selection.fullRow) {
9
+ const startLine = Math.min(anchor.line, head.line);
10
+ const endLine = Math.max(anchor.line, head.line);
11
+ return {
12
+ start: { line: startLine, column: 0 },
13
+ end: { line: endLine, column: Number.MAX_SAFE_INTEGER },
14
+ fullRow: true,
15
+ ...(selection.throughFinalColumn ? { throughFinalColumn: true } : {}),
16
+ };
17
+ }
18
+ if (!selection.cell && selection.dragged !== true)
19
+ return undefined;
20
+ // Invariant: an accepted drag includes both endpoint graphemes, even after returning
21
+ // to its anchor. Only an unextended point press is empty; paint and copy stay half-open.
22
+ const anchorFirst = comparePoints(anchor, head) <= 0;
23
+ const first = anchorFirst ? anchor : head;
24
+ const last = anchorFirst ? head : anchor;
25
+ return {
26
+ start: { line: first.line, column: pointBefore(first) },
27
+ end: { line: last.line, column: pointAfter(last) },
28
+ ...(selection.throughFinalColumn ? { throughFinalColumn: true } : {}),
29
+ };
30
+ }
31
+ export function pressTextSelection(input) {
32
+ const now = input.now ?? Date.now();
33
+ const previous = input.previousClick;
34
+ const count = previous !== undefined
35
+ && now - previous.time <= TEXT_SELECTION_MULTI_CLICK_MS
36
+ && previous.line === input.line
37
+ && Math.abs(previous.column - input.column) <= 1
38
+ ? previous.count + 1
39
+ : 1;
40
+ const click = { time: now, line: input.line, column: input.column, count };
41
+ const column = clamp(input.column, 1, Math.max(1, input.contentWidth));
42
+ const kind = ((count - 1) % 3) + 1;
43
+ if (kind === 2) {
44
+ const selection = selectWord(input.line, column, input.contentWidth, input.lineText);
45
+ return selection === undefined ? { click, kind: "word" } : { selection, click, kind: "word" };
46
+ }
47
+ if (kind === 3) {
48
+ if (input.lineContent?.selectable === false)
49
+ return { click, kind: "line" };
50
+ const from = clamp(input.lineContent?.from ?? 1, 1, Math.max(1, input.contentWidth));
51
+ const to = clamp(input.lineContent?.to ?? input.contentWidth, from, Math.max(1, input.contentWidth));
52
+ return {
53
+ selection: {
54
+ anchor: { line: input.line, column: from },
55
+ head: { line: input.line, column: to },
56
+ selecting: true,
57
+ cell: true,
58
+ fullRow: true,
59
+ },
60
+ click,
61
+ kind: "line",
62
+ };
63
+ }
64
+ const point = textSelectionPointAt(input.line, column, input.lineText);
65
+ return {
66
+ selection: {
67
+ anchor: point,
68
+ head: point,
69
+ selecting: true,
70
+ dragged: false,
71
+ },
72
+ click,
73
+ kind: "point",
74
+ };
75
+ }
76
+ export function extendTextSelection(selection, point) {
77
+ if (selection?.selecting !== true)
78
+ return selection;
79
+ const distinctMotion = comparePoints(selection.head, point) !== 0;
80
+ if (!distinctMotion)
81
+ return selection;
82
+ if (selection.fullRow)
83
+ return { ...selection, head: point };
84
+ return {
85
+ ...selection,
86
+ head: point,
87
+ dragged: true,
88
+ };
89
+ }
90
+ export function releaseTextSelection(selection) {
91
+ if (selection === undefined)
92
+ return undefined;
93
+ const released = selection.selecting ? { ...selection, selecting: false } : selection;
94
+ return orderedTextSelection(released) === undefined ? undefined : released;
95
+ }
96
+ export function textSelectionLineExtendColumn(selection, line, contentWidth) {
97
+ return line < selection.anchor.line ? 1 : Math.max(1, contentWidth);
98
+ }
99
+ /** Resolves a reported one-based pointer cell to the complete grapheme it intersects. */
100
+ export function textSelectionPointAt(line, column, lineText) {
101
+ const plain = stripAnsi(lineText);
102
+ const target = Math.max(0, column - 1);
103
+ let width = 0;
104
+ for (const { segment } of GRAPHEMES.segment(plain)) {
105
+ const cellWidth = displayWidth(segment);
106
+ const next = width + cellWidth;
107
+ if (cellWidth > 0 && target >= width && target < next) {
108
+ return { line, column, from: width, to: next };
109
+ }
110
+ width = next;
111
+ }
112
+ return { line, column, from: target, to: target + 1 };
113
+ }
114
+ export function textSelectionText(selection, rows, lineContent) {
115
+ const parts = [];
116
+ for (let line = selection.start.line; line <= selection.end.line && line < rows.length; line += 1) {
117
+ const plain = stripAnsi(rows[line] ?? "");
118
+ const content = lineContent?.(line);
119
+ if (content?.selectable === false) {
120
+ parts.push("");
121
+ continue;
122
+ }
123
+ const baseFrom = line === selection.start.line ? selection.start.column : 0;
124
+ const baseTo = line === selection.end.line ? selection.end.column : Number.MAX_SAFE_INTEGER;
125
+ const contentFrom = Math.max(0, (content?.from ?? 1) - 1);
126
+ const contentTo = Math.max(contentFrom, (content?.to ?? Number.MAX_SAFE_INTEGER) - 1);
127
+ const from = Math.max(baseFrom, contentFrom);
128
+ const to = Math.max(from, Math.min(baseTo, contentTo));
129
+ parts.push(plain.slice(indexAtDisplayBoundary(plain, from, "start"), indexAtDisplayBoundary(plain, to, "end")).trimEnd());
130
+ }
131
+ return parts.join("\n");
132
+ }
133
+ /** Returns the plain cells covered by [from,to), expanding at grapheme edges. */
134
+ export function plainTextBetweenColumns(line, from, to) {
135
+ const plain = stripAnsi(line);
136
+ return plain.slice(indexAtDisplayBoundary(plain, from, "start"), indexAtDisplayBoundary(plain, to, "end"));
137
+ }
138
+ export function usefulTextLineContent(line, from = 1) {
139
+ const start = Math.max(1, from);
140
+ const end = displayWidth(stripAnsi(line).replace(/\s+$/, "")) + 1;
141
+ return { from: start, to: Math.max(start, end) };
142
+ }
143
+ function selectWord(line, column, contentWidth, lineText) {
144
+ const plain = stripAnsi(lineText);
145
+ const segments = [];
146
+ let width = 0;
147
+ for (const { segment } of GRAPHEMES.segment(plain)) {
148
+ const cellWidth = displayWidth(segment);
149
+ if (cellWidth <= 0)
150
+ continue;
151
+ segments.push({ cls: characterClass(segment), from: width, to: width + cellWidth });
152
+ width += cellWidth;
153
+ }
154
+ const at = clamp(column, 1, Math.max(1, contentWidth)) - 1;
155
+ const index = segments.findIndex(segment => at >= segment.from && at < segment.to);
156
+ if (index < 0)
157
+ return undefined;
158
+ let low = index;
159
+ let high = index;
160
+ while (low > 0 && segments[low - 1]?.cls === segments[index]?.cls)
161
+ low -= 1;
162
+ while (high + 1 < segments.length && segments[high + 1]?.cls === segments[index]?.cls)
163
+ high += 1;
164
+ const end = segments[high]?.to ?? 1;
165
+ return {
166
+ anchor: { line, column: (segments[low]?.from ?? 0) + 1 },
167
+ head: { line, column: end },
168
+ selecting: true,
169
+ cell: true,
170
+ throughFinalColumn: segments[index]?.cls === 0 && end >= contentWidth,
171
+ };
172
+ }
173
+ function characterClass(character) {
174
+ if (/\s/u.test(character))
175
+ return 0;
176
+ if (/[\p{L}\p{N}_]/u.test(character))
177
+ return 1;
178
+ return 2;
179
+ }
180
+ function indexAtDisplayBoundary(plain, column, edge) {
181
+ if (column <= 0)
182
+ return 0;
183
+ let width = 0;
184
+ let index = 0;
185
+ for (const { segment } of GRAPHEMES.segment(plain)) {
186
+ const cellWidth = displayWidth(segment);
187
+ const next = width + cellWidth;
188
+ if (column < next)
189
+ return edge === "start" ? index : index + segment.length;
190
+ index += segment.length;
191
+ width = next;
192
+ if (width >= column)
193
+ return index;
194
+ }
195
+ return index;
196
+ }
197
+ function pointBefore(point) {
198
+ return point.from ?? Math.max(0, point.column - 1);
199
+ }
200
+ function pointAfter(point) {
201
+ return point.to ?? Math.max(0, point.column);
202
+ }
203
+ function comparePoints(left, right) {
204
+ return left.line === right.line ? left.column - right.column : left.line - right.line;
205
+ }
206
+ function clamp(value, minimum, maximum) {
207
+ return Math.max(minimum, Math.min(value, maximum));
208
+ }
@@ -6,6 +6,20 @@
6
6
  */
7
7
  /** Removes styling sequences so only visible characters remain. */
8
8
  export declare function stripAnsi(text: string): string;
9
+ export interface DisplayColumnRange {
10
+ readonly from: number;
11
+ readonly to: number;
12
+ }
13
+ /** Visible-column segment (word, whitespace, or punctuation) under a pointer column. */
14
+ export declare function displayWordColumnRange(text: string, pointerColumn: number): DisplayColumnRange | null;
15
+ export interface DisplayColumnSlice {
16
+ /** Grapheme-aligned visible bounds in the source row. */
17
+ readonly from: number;
18
+ readonly to: number;
19
+ readonly text: string;
20
+ }
21
+ /** Plain graphemes intersecting a visible-column range, expanded at wide-character edges. */
22
+ export declare function displayColumnSlice(text: string, requestedFrom: number, requestedTo: number): DisplayColumnSlice;
9
23
  /** Columns this text occupies once styling is removed. */
10
24
  export declare function displayWidth(text: string): number;
11
25
  /**