@bastani/atomic 0.8.31-alpha.5 → 0.9.0-alpha.2

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 (1401) hide show
  1. package/CHANGELOG.md +28 -1
  2. package/dist/builtin/cursor/CHANGELOG.md +10 -1
  3. package/dist/builtin/cursor/package.json +2 -2
  4. package/dist/builtin/cursor/src/proto/protobuf-codec-json.ts +44 -0
  5. package/dist/builtin/cursor/src/proto/protobuf-codec-request.ts +271 -0
  6. package/dist/builtin/cursor/src/proto/protobuf-codec-wire.ts +231 -0
  7. package/dist/builtin/cursor/src/proto/protobuf-codec.ts +5 -523
  8. package/dist/builtin/cursor/src/stream.ts +6 -70
  9. package/dist/builtin/cursor/src/transport-errors.ts +74 -0
  10. package/dist/builtin/cursor/src/transport-frame.ts +56 -0
  11. package/dist/builtin/cursor/src/transport-http2.ts +122 -0
  12. package/dist/builtin/cursor/src/transport-native-client.ts +161 -0
  13. package/dist/builtin/cursor/src/transport-run-stream.ts +188 -0
  14. package/dist/builtin/cursor/src/transport-timeouts.ts +87 -0
  15. package/dist/builtin/cursor/src/transport-types.ts +140 -0
  16. package/dist/builtin/cursor/src/transport.ts +24 -790
  17. package/dist/builtin/intercom/CHANGELOG.md +9 -0
  18. package/dist/builtin/intercom/broker/client.ts +0 -35
  19. package/dist/builtin/intercom/contact-supervisor-tool.ts +289 -0
  20. package/dist/builtin/intercom/index-heavy.ts +77 -1336
  21. package/dist/builtin/intercom/intercom-tool.ts +409 -0
  22. package/dist/builtin/intercom/intercom-utils.ts +401 -0
  23. package/dist/builtin/intercom/lifecycle.ts +133 -0
  24. package/dist/builtin/intercom/overlay.ts +96 -0
  25. package/dist/builtin/intercom/package.json +2 -2
  26. package/dist/builtin/intercom/subagent-relay.ts +137 -0
  27. package/dist/builtin/mcp/CHANGELOG.md +9 -0
  28. package/dist/builtin/mcp/config-write-utils.ts +104 -0
  29. package/dist/builtin/mcp/config.ts +4 -180
  30. package/dist/builtin/mcp/mcp-panel-renderer.ts +243 -0
  31. package/dist/builtin/mcp/mcp-panel-state.ts +227 -0
  32. package/dist/builtin/mcp/mcp-panel-types.ts +86 -0
  33. package/dist/builtin/mcp/mcp-panel.ts +145 -579
  34. package/dist/builtin/mcp/mcp-setup-panel.ts +4 -81
  35. package/dist/builtin/mcp/package.json +3 -3
  36. package/dist/builtin/mcp/proxy-auth.ts +61 -0
  37. package/dist/builtin/mcp/proxy-call.ts +373 -0
  38. package/dist/builtin/mcp/proxy-connect.ts +58 -0
  39. package/dist/builtin/mcp/proxy-info-modes.ts +326 -0
  40. package/dist/builtin/mcp/proxy-modes.ts +3 -805
  41. package/dist/builtin/mcp/proxy-types.ts +3 -0
  42. package/dist/builtin/mcp/ui-server-http.ts +81 -0
  43. package/dist/builtin/mcp/ui-server.ts +2 -127
  44. package/dist/builtin/subagents/CHANGELOG.md +9 -0
  45. package/dist/builtin/subagents/package.json +4 -4
  46. package/dist/builtin/subagents/src/agents/agent-discovery.ts +127 -0
  47. package/dist/builtin/subagents/src/agents/agent-loaders.ts +175 -0
  48. package/dist/builtin/subagents/src/agents/agent-management-helpers.ts +310 -0
  49. package/dist/builtin/subagents/src/agents/agent-management.ts +3 -309
  50. package/dist/builtin/subagents/src/agents/agent-overrides.ts +397 -0
  51. package/dist/builtin/subagents/src/agents/agent-paths.ts +88 -0
  52. package/dist/builtin/subagents/src/agents/agent-types.ts +136 -0
  53. package/dist/builtin/subagents/src/agents/agents.ts +22 -895
  54. package/dist/builtin/subagents/src/agents/skills-paths.ts +333 -0
  55. package/dist/builtin/subagents/src/agents/skills.ts +3 -326
  56. package/dist/builtin/subagents/src/extension/index.ts +4 -118
  57. package/dist/builtin/subagents/src/extension/prompt-guidance.ts +13 -0
  58. package/dist/builtin/subagents/src/runs/background/async-execution-chain.ts +401 -0
  59. package/dist/builtin/subagents/src/runs/background/async-execution-common.ts +131 -0
  60. package/dist/builtin/subagents/src/runs/background/async-execution-single.ts +213 -0
  61. package/dist/builtin/subagents/src/runs/background/async-execution-types.ts +84 -0
  62. package/dist/builtin/subagents/src/runs/background/async-execution.ts +13 -795
  63. package/dist/builtin/subagents/src/runs/background/subagent-runner-dynamic.ts +215 -0
  64. package/dist/builtin/subagents/src/runs/background/subagent-runner-finalize.ts +136 -0
  65. package/dist/builtin/subagents/src/runs/background/subagent-runner-output.ts +105 -0
  66. package/dist/builtin/subagents/src/runs/background/subagent-runner-parallel-helpers.ts +112 -0
  67. package/dist/builtin/subagents/src/runs/background/subagent-runner-parallel.ts +159 -0
  68. package/dist/builtin/subagents/src/runs/background/subagent-runner-sequential.ts +127 -0
  69. package/dist/builtin/subagents/src/runs/background/subagent-runner-state.ts +427 -0
  70. package/dist/builtin/subagents/src/runs/background/subagent-runner-step.ts +273 -0
  71. package/dist/builtin/subagents/src/runs/background/subagent-runner-streaming.ts +269 -0
  72. package/dist/builtin/subagents/src/runs/background/subagent-runner-types.ts +196 -0
  73. package/dist/builtin/subagents/src/runs/background/subagent-runner-utils.ts +70 -0
  74. package/dist/builtin/subagents/src/runs/background/subagent-runner.ts +44 -2233
  75. package/dist/builtin/subagents/src/runs/foreground/chain-clarify-behavior.ts +75 -0
  76. package/dist/builtin/subagents/src/runs/foreground/chain-clarify-component.ts +202 -0
  77. package/dist/builtin/subagents/src/runs/foreground/chain-clarify-edit.ts +97 -0
  78. package/dist/builtin/subagents/src/runs/foreground/chain-clarify-editor.ts +160 -0
  79. package/dist/builtin/subagents/src/runs/foreground/chain-clarify-frame.ts +72 -0
  80. package/dist/builtin/subagents/src/runs/foreground/chain-clarify-render-modes.ts +161 -0
  81. package/dist/builtin/subagents/src/runs/foreground/chain-clarify-render-selectors.ts +203 -0
  82. package/dist/builtin/subagents/src/runs/foreground/chain-clarify-selectors.ts +234 -0
  83. package/dist/builtin/subagents/src/runs/foreground/chain-clarify-state.ts +103 -0
  84. package/dist/builtin/subagents/src/runs/foreground/chain-clarify-types.ts +29 -0
  85. package/dist/builtin/subagents/src/runs/foreground/chain-clarify.ts +4 -1328
  86. package/dist/builtin/subagents/src/runs/foreground/chain-execution-clarify.ts +117 -0
  87. package/dist/builtin/subagents/src/runs/foreground/chain-execution-details.ts +35 -0
  88. package/dist/builtin/subagents/src/runs/foreground/chain-execution-dynamic-step.ts +194 -0
  89. package/dist/builtin/subagents/src/runs/foreground/chain-execution-parallel-runner.ts +183 -0
  90. package/dist/builtin/subagents/src/runs/foreground/chain-execution-parallel-step.ts +185 -0
  91. package/dist/builtin/subagents/src/runs/foreground/chain-execution-sequential-step.ts +229 -0
  92. package/dist/builtin/subagents/src/runs/foreground/chain-execution-types.ts +194 -0
  93. package/dist/builtin/subagents/src/runs/foreground/chain-execution.ts +94 -1043
  94. package/dist/builtin/subagents/src/runs/foreground/execution-attempt-control.ts +135 -0
  95. package/dist/builtin/subagents/src/runs/foreground/execution-attempt-finalize.ts +107 -0
  96. package/dist/builtin/subagents/src/runs/foreground/execution-attempt-types.ts +17 -0
  97. package/dist/builtin/subagents/src/runs/foreground/execution-attempt.ts +454 -0
  98. package/dist/builtin/subagents/src/runs/foreground/execution-run-sync.ts +219 -0
  99. package/dist/builtin/subagents/src/runs/foreground/execution-structured-retries.ts +77 -0
  100. package/dist/builtin/subagents/src/runs/foreground/execution-updates.ts +34 -0
  101. package/dist/builtin/subagents/src/runs/foreground/execution-utils.ts +56 -0
  102. package/dist/builtin/subagents/src/runs/foreground/execution.ts +6 -1082
  103. package/dist/builtin/subagents/src/runs/foreground/subagent-executor-async.ts +207 -0
  104. package/dist/builtin/subagents/src/runs/foreground/subagent-executor-chain.ts +140 -0
  105. package/dist/builtin/subagents/src/runs/foreground/subagent-executor-context.ts +266 -0
  106. package/dist/builtin/subagents/src/runs/foreground/subagent-executor-input.ts +270 -0
  107. package/dist/builtin/subagents/src/runs/foreground/subagent-executor-parallel-task.ts +157 -0
  108. package/dist/builtin/subagents/src/runs/foreground/subagent-executor-parallel.ts +375 -0
  109. package/dist/builtin/subagents/src/runs/foreground/subagent-executor-resume.ts +463 -0
  110. package/dist/builtin/subagents/src/runs/foreground/subagent-executor-runtime.ts +17 -0
  111. package/dist/builtin/subagents/src/runs/foreground/subagent-executor-single.ts +320 -0
  112. package/dist/builtin/subagents/src/runs/foreground/subagent-executor-status.ts +207 -0
  113. package/dist/builtin/subagents/src/runs/foreground/subagent-executor-types.ts +121 -0
  114. package/dist/builtin/subagents/src/runs/foreground/subagent-executor-worktree.ts +113 -0
  115. package/dist/builtin/subagents/src/runs/foreground/subagent-executor.ts +150 -2522
  116. package/dist/builtin/subagents/src/runs/shared/model-fallback.ts +0 -16
  117. package/dist/builtin/subagents/src/runs/shared/nested-events-control.ts +167 -0
  118. package/dist/builtin/subagents/src/runs/shared/nested-events-core.ts +219 -0
  119. package/dist/builtin/subagents/src/runs/shared/nested-events-projection.ts +121 -0
  120. package/dist/builtin/subagents/src/runs/shared/nested-events-registry.ts +289 -0
  121. package/dist/builtin/subagents/src/runs/shared/nested-events-sanitize.ts +201 -0
  122. package/dist/builtin/subagents/src/runs/shared/nested-events.ts +50 -935
  123. package/dist/builtin/subagents/src/runs/shared/worktree.ts +0 -78
  124. package/dist/builtin/subagents/src/shared/types-async.ts +265 -0
  125. package/dist/builtin/subagents/src/shared/types-config.ts +125 -0
  126. package/dist/builtin/subagents/src/shared/types-depth.ts +121 -0
  127. package/dist/builtin/subagents/src/shared/types-output.ts +63 -0
  128. package/dist/builtin/subagents/src/shared/types-results.ts +318 -0
  129. package/dist/builtin/subagents/src/shared/types-runtime.ts +136 -0
  130. package/dist/builtin/subagents/src/shared/types.ts +10 -975
  131. package/dist/builtin/subagents/src/slash/slash-commands.ts +0 -12
  132. package/dist/builtin/subagents/src/tui/render-chain-graph.ts +247 -0
  133. package/dist/builtin/subagents/src/tui/render-event-formatting.ts +259 -0
  134. package/dist/builtin/subagents/src/tui/render-layout.ts +120 -0
  135. package/dist/builtin/subagents/src/tui/render-result-animation.ts +56 -0
  136. package/dist/builtin/subagents/src/tui/render-result-compact.ts +154 -0
  137. package/dist/builtin/subagents/src/tui/render-result.ts +390 -0
  138. package/dist/builtin/subagents/src/tui/render-stable-output.ts +83 -0
  139. package/dist/builtin/subagents/src/tui/render-status-progress.ts +133 -0
  140. package/dist/builtin/subagents/src/tui/render-widget-graph.ts +166 -0
  141. package/dist/builtin/subagents/src/tui/render-widget.ts +273 -0
  142. package/dist/builtin/subagents/src/tui/render.ts +14 -1801
  143. package/dist/builtin/web-access/CHANGELOG.md +9 -0
  144. package/dist/builtin/web-access/content-tools.ts +348 -0
  145. package/dist/builtin/web-access/curator-page-assets/script-1.ts +400 -0
  146. package/dist/builtin/web-access/curator-page-assets/script-2.ts +400 -0
  147. package/dist/builtin/web-access/curator-page-assets/script-3.ts +400 -0
  148. package/dist/builtin/web-access/curator-page-assets/script-4.ts +400 -0
  149. package/dist/builtin/web-access/curator-page-assets/script-5.ts +398 -0
  150. package/dist/builtin/web-access/curator-page-assets/styles-1.ts +394 -0
  151. package/dist/builtin/web-access/curator-page-assets/styles-2.ts +394 -0
  152. package/dist/builtin/web-access/curator-page-assets/styles-3.ts +393 -0
  153. package/dist/builtin/web-access/curator-page.ts +17 -3180
  154. package/dist/builtin/web-access/curator-server-helpers.ts +115 -0
  155. package/dist/builtin/web-access/curator-server.ts +2 -113
  156. package/dist/builtin/web-access/exa-mcp.ts +218 -0
  157. package/dist/builtin/web-access/exa.ts +2 -207
  158. package/dist/builtin/web-access/extract-frames.ts +228 -0
  159. package/dist/builtin/web-access/extract.ts +13 -214
  160. package/dist/builtin/web-access/github-config.ts +156 -0
  161. package/dist/builtin/web-access/github-extract.ts +3 -154
  162. package/dist/builtin/web-access/index-heavy.ts +8 -1904
  163. package/dist/builtin/web-access/package.json +3 -2
  164. package/dist/builtin/web-access/web-search-activity.ts +102 -0
  165. package/dist/builtin/web-access/web-search-browser.ts +116 -0
  166. package/dist/builtin/web-access/web-search-command.ts +242 -0
  167. package/dist/builtin/web-access/web-search-config.ts +163 -0
  168. package/dist/builtin/web-access/web-search-curator.ts +214 -0
  169. package/dist/builtin/web-access/web-search-features.ts +165 -0
  170. package/dist/builtin/web-access/web-search-formatting.ts +117 -0
  171. package/dist/builtin/web-access/web-search-return.ts +136 -0
  172. package/dist/builtin/web-access/web-search-summary.ts +170 -0
  173. package/dist/builtin/web-access/web-search-tool.ts +290 -0
  174. package/dist/builtin/web-access/web-search-types.ts +50 -0
  175. package/dist/builtin/workflows/CHANGELOG.md +16 -1
  176. package/dist/builtin/workflows/README.md +189 -122
  177. package/dist/builtin/workflows/builtin/deep-research-codebase-runner.ts +492 -0
  178. package/dist/builtin/workflows/builtin/deep-research-codebase-utils.ts +346 -0
  179. package/dist/builtin/workflows/builtin/deep-research-codebase.ts +36 -849
  180. package/dist/builtin/workflows/builtin/goal-artifacts.ts +43 -0
  181. package/dist/builtin/workflows/builtin/goal-ledger.ts +54 -0
  182. package/dist/builtin/workflows/builtin/goal-prompts.ts +360 -0
  183. package/dist/builtin/workflows/builtin/goal-reducer.ts +141 -0
  184. package/dist/builtin/workflows/builtin/goal-reports.ts +56 -0
  185. package/dist/builtin/workflows/builtin/goal-review.ts +84 -0
  186. package/dist/builtin/workflows/builtin/goal-runner.ts +336 -0
  187. package/dist/builtin/workflows/builtin/goal-schemas.ts +60 -0
  188. package/dist/builtin/workflows/builtin/goal-types.ts +132 -0
  189. package/dist/builtin/workflows/builtin/goal.ts +40 -1201
  190. package/dist/builtin/workflows/builtin/index.d.ts +1 -0
  191. package/dist/builtin/workflows/builtin/open-claude-design-phases.ts +432 -0
  192. package/dist/builtin/workflows/builtin/open-claude-design-runner.ts +476 -0
  193. package/dist/builtin/workflows/builtin/open-claude-design-utils.ts +312 -0
  194. package/dist/builtin/workflows/builtin/open-claude-design.d.ts +1 -0
  195. package/dist/builtin/workflows/builtin/open-claude-design.ts +47 -1131
  196. package/dist/builtin/workflows/builtin/ralph-core.ts +408 -0
  197. package/dist/builtin/workflows/builtin/ralph-models.ts +123 -0
  198. package/dist/builtin/workflows/builtin/ralph-runner.ts +499 -0
  199. package/dist/builtin/workflows/builtin/ralph.ts +50 -1019
  200. package/dist/builtin/workflows/package.json +2 -2
  201. package/dist/builtin/workflows/skills/impeccable/scripts/detector/detect-antipatterns-browser.js +2 -2
  202. package/dist/builtin/workflows/skills/impeccable/scripts/detector/engines/regex/detect-text.mjs +2 -2
  203. package/dist/builtin/workflows/skills/impeccable/scripts/detector/rules/checks.mjs +2 -2
  204. package/dist/builtin/workflows/skills/impeccable/scripts/detector/shared/page.mjs +8 -1
  205. package/dist/builtin/workflows/skills/impeccable/scripts/live-accept.mjs +13 -15
  206. package/dist/builtin/workflows/skills/impeccable/scripts/live-manual-edit-evidence.mjs +2 -2
  207. package/dist/builtin/workflows/skills/impeccable/scripts/live-server.mjs +9 -0
  208. package/dist/builtin/workflows/src/authoring/typebox-defaults.d.ts +41 -0
  209. package/dist/builtin/workflows/src/authoring/typebox-defaults.ts +217 -0
  210. package/dist/builtin/workflows/src/authoring/workflow.ts +184 -0
  211. package/dist/builtin/workflows/src/authoring.d.ts +14 -66
  212. package/dist/builtin/workflows/src/engine/graph-inference.ts +100 -0
  213. package/dist/builtin/workflows/src/engine/options.ts +40 -0
  214. package/dist/builtin/workflows/src/engine/primitives/chain.ts +29 -0
  215. package/dist/builtin/workflows/src/engine/primitives/exit.ts +2 -0
  216. package/dist/builtin/workflows/src/engine/primitives/parallel.ts +47 -0
  217. package/dist/builtin/workflows/src/engine/primitives/task.ts +108 -0
  218. package/dist/builtin/workflows/src/engine/primitives/ui.ts +41 -0
  219. package/dist/builtin/workflows/src/engine/primitives/workflow.ts +159 -0
  220. package/dist/builtin/workflows/src/engine/replay.ts +8 -0
  221. package/dist/builtin/workflows/src/engine/run.ts +356 -0
  222. package/dist/builtin/workflows/src/engine/runtime.ts +160 -0
  223. package/dist/builtin/workflows/src/extension/atomic-stage-session.ts +186 -0
  224. package/dist/builtin/workflows/src/extension/config-file-loader.ts +152 -0
  225. package/dist/builtin/workflows/src/extension/config-loader.ts +2 -167
  226. package/dist/builtin/workflows/src/extension/discovery-loaders.ts +115 -0
  227. package/dist/builtin/workflows/src/extension/discovery.ts +3 -117
  228. package/dist/builtin/workflows/src/extension/extension-factory.ts +120 -0
  229. package/dist/builtin/workflows/src/extension/extension-lifecycle.ts +109 -0
  230. package/dist/builtin/workflows/src/extension/extension-runtime-state.ts +270 -0
  231. package/dist/builtin/workflows/src/extension/index.ts +42 -4166
  232. package/dist/builtin/workflows/src/extension/public-types.ts +295 -0
  233. package/dist/builtin/workflows/src/extension/render-component.ts +14 -0
  234. package/dist/builtin/workflows/src/extension/runtime-direct.ts +96 -0
  235. package/dist/builtin/workflows/src/extension/runtime.ts +1 -92
  236. package/dist/builtin/workflows/src/extension/ui-surface.ts +286 -0
  237. package/dist/builtin/workflows/src/extension/wiring.ts +6 -475
  238. package/dist/builtin/workflows/src/extension/workflow-command-completions.ts +111 -0
  239. package/dist/builtin/workflows/src/extension/workflow-command-registration.ts +213 -0
  240. package/dist/builtin/workflows/src/extension/workflow-command-surfaces.ts +81 -0
  241. package/dist/builtin/workflows/src/extension/workflow-command-utils.ts +181 -0
  242. package/dist/builtin/workflows/src/extension/workflow-module-loader.ts +9 -3
  243. package/dist/builtin/workflows/src/extension/workflow-policy.ts +15 -0
  244. package/dist/builtin/workflows/src/extension/workflow-ports.ts +41 -0
  245. package/dist/builtin/workflows/src/extension/workflow-prompts.ts +23 -0
  246. package/dist/builtin/workflows/src/extension/workflow-run-control-command.ts +286 -0
  247. package/dist/builtin/workflows/src/extension/workflow-schema.ts +1 -19
  248. package/dist/builtin/workflows/src/extension/workflow-stage-results.ts +264 -0
  249. package/dist/builtin/workflows/src/extension/workflow-targets.ts +181 -0
  250. package/dist/builtin/workflows/src/extension/workflow-tool-content.ts +175 -0
  251. package/dist/builtin/workflows/src/extension/workflow-tool-control.ts +205 -0
  252. package/dist/builtin/workflows/src/extension/workflow-tool-helpers.ts +66 -0
  253. package/dist/builtin/workflows/src/extension/workflow-tool-inspection.ts +164 -0
  254. package/dist/builtin/workflows/src/extension/workflow-tool-registration.ts +54 -0
  255. package/dist/builtin/workflows/src/extension/workflow-tool-send.ts +164 -0
  256. package/dist/builtin/workflows/src/extension/workflow-tool.ts +102 -0
  257. package/dist/builtin/workflows/src/index.ts +0 -2
  258. package/dist/builtin/workflows/src/runs/background/runner.ts +6 -3
  259. package/dist/builtin/workflows/src/runs/foreground/executor-abort.ts +431 -0
  260. package/dist/builtin/workflows/src/runs/foreground/executor-child-boundary.ts +232 -0
  261. package/dist/builtin/workflows/src/runs/foreground/executor-child-helpers.ts +74 -0
  262. package/dist/builtin/workflows/src/runs/foreground/executor-child-workflow.ts +1 -0
  263. package/dist/builtin/workflows/src/runs/foreground/executor-continuation.ts +167 -0
  264. package/dist/builtin/workflows/src/runs/foreground/executor-direct-helpers.ts +450 -0
  265. package/dist/builtin/workflows/src/runs/foreground/executor-direct.ts +233 -0
  266. package/dist/builtin/workflows/src/runs/foreground/executor-exit-manager.ts +195 -0
  267. package/dist/builtin/workflows/src/runs/foreground/executor-hil.ts +368 -0
  268. package/dist/builtin/workflows/src/runs/foreground/executor-inputs.ts +83 -0
  269. package/dist/builtin/workflows/src/runs/foreground/executor-lifecycle.ts +441 -0
  270. package/dist/builtin/workflows/src/runs/foreground/executor-outputs.ts +160 -0
  271. package/dist/builtin/workflows/src/runs/foreground/executor-prompt-nodes.ts +274 -0
  272. package/dist/builtin/workflows/src/runs/foreground/executor-run-finalizers.ts +122 -0
  273. package/dist/builtin/workflows/src/runs/foreground/executor-run.ts +1 -0
  274. package/dist/builtin/workflows/src/runs/foreground/executor-scheduler.ts +204 -0
  275. package/dist/builtin/workflows/src/runs/foreground/executor-stage-call.ts +194 -0
  276. package/dist/builtin/workflows/src/runs/foreground/executor-stage-context.ts +120 -0
  277. package/dist/builtin/workflows/src/runs/foreground/executor-stage-control.ts +126 -0
  278. package/dist/builtin/workflows/src/runs/foreground/executor-stage-factory.ts +359 -0
  279. package/dist/builtin/workflows/src/runs/foreground/executor-stage-replay.ts +135 -0
  280. package/dist/builtin/workflows/src/runs/foreground/executor-stage-types.ts +61 -0
  281. package/dist/builtin/workflows/src/runs/foreground/executor-task-context.ts +2 -0
  282. package/dist/builtin/workflows/src/runs/foreground/executor-task-prompts.ts +293 -0
  283. package/dist/builtin/workflows/src/runs/foreground/executor-types.ts +109 -0
  284. package/dist/builtin/workflows/src/runs/foreground/executor.ts +19 -5354
  285. package/dist/builtin/workflows/src/runs/foreground/stage-runner-context.ts +219 -0
  286. package/dist/builtin/workflows/src/runs/foreground/stage-runner-controller.ts +500 -0
  287. package/dist/builtin/workflows/src/runs/foreground/stage-runner-messages.ts +129 -0
  288. package/dist/builtin/workflows/src/runs/foreground/stage-runner-options.ts +53 -0
  289. package/dist/builtin/workflows/src/runs/foreground/stage-runner-output.ts +146 -0
  290. package/dist/builtin/workflows/src/runs/foreground/stage-runner-session.ts +55 -0
  291. package/dist/builtin/workflows/src/runs/foreground/stage-runner-structured-output.ts +82 -0
  292. package/dist/builtin/workflows/src/runs/foreground/stage-runner-types.ts +141 -0
  293. package/dist/builtin/workflows/src/runs/foreground/stage-runner.ts +13 -1355
  294. package/dist/builtin/workflows/src/runs/shared/graph-inference.ts +2 -100
  295. package/dist/builtin/workflows/src/runs/shared/model-fallback-candidates.ts +453 -0
  296. package/dist/builtin/workflows/src/runs/shared/model-fallback-failures.ts +442 -0
  297. package/dist/builtin/workflows/src/runs/shared/model-fallback.ts +2 -836
  298. package/dist/builtin/workflows/src/runs/shared/worktree-diff.ts +165 -0
  299. package/dist/builtin/workflows/src/runs/shared/worktree-git.ts +220 -0
  300. package/dist/builtin/workflows/src/runs/shared/worktree-setup.ts +335 -0
  301. package/dist/builtin/workflows/src/runs/shared/worktree-types.ts +92 -0
  302. package/dist/builtin/workflows/src/runs/shared/worktree.ts +18 -791
  303. package/dist/builtin/workflows/src/sdk-surface.ts +6 -9
  304. package/dist/builtin/workflows/src/shared/authoring-contract-stage.d.ts +371 -0
  305. package/dist/builtin/workflows/src/shared/authoring-contract-stage.ts +439 -0
  306. package/dist/builtin/workflows/src/shared/authoring-contract-ui.d.ts +206 -0
  307. package/dist/builtin/workflows/src/shared/authoring-contract-ui.ts +282 -0
  308. package/dist/builtin/workflows/src/shared/authoring-contract.d.ts +5 -598
  309. package/dist/builtin/workflows/src/shared/persistence-restore-helpers.ts +428 -0
  310. package/dist/builtin/workflows/src/shared/persistence-restore.ts +9 -431
  311. package/dist/builtin/workflows/src/shared/store-factory.ts +16 -0
  312. package/dist/builtin/workflows/src/shared/store-internal.ts +219 -0
  313. package/dist/builtin/workflows/src/shared/store-prompt-methods.ts +219 -0
  314. package/dist/builtin/workflows/src/shared/store-public-types.ts +215 -0
  315. package/dist/builtin/workflows/src/shared/store-run-methods.ts +223 -0
  316. package/dist/builtin/workflows/src/shared/store-stage-methods.ts +305 -0
  317. package/dist/builtin/workflows/src/shared/store.ts +11 -1138
  318. package/dist/builtin/workflows/src/shared/types.ts +25 -8
  319. package/dist/builtin/workflows/src/shared/workflow-authoring-types.d.ts +49 -0
  320. package/dist/builtin/workflows/src/shared/workflow-authoring-types.ts +84 -0
  321. package/dist/builtin/workflows/src/shared/workflow-failures-classifier.ts +266 -0
  322. package/dist/builtin/workflows/src/shared/workflow-failures-contract.ts +75 -0
  323. package/dist/builtin/workflows/src/shared/workflow-failures-decisions.ts +477 -0
  324. package/dist/builtin/workflows/src/shared/workflow-failures-signals.ts +248 -0
  325. package/dist/builtin/workflows/src/shared/workflow-failures.ts +13 -1001
  326. package/dist/builtin/workflows/src/tui/chat-surface.ts +0 -66
  327. package/dist/builtin/workflows/src/tui/graph-view-constants.ts +45 -0
  328. package/dist/builtin/workflows/src/tui/graph-view-graph-render.ts +161 -0
  329. package/dist/builtin/workflows/src/tui/graph-view-input.ts +333 -0
  330. package/dist/builtin/workflows/src/tui/graph-view-render-helpers.ts +336 -0
  331. package/dist/builtin/workflows/src/tui/graph-view-render.ts +194 -0
  332. package/dist/builtin/workflows/src/tui/graph-view-state.ts +306 -0
  333. package/dist/builtin/workflows/src/tui/graph-view-types.ts +70 -0
  334. package/dist/builtin/workflows/src/tui/graph-view.ts +4 -1386
  335. package/dist/builtin/workflows/src/tui/inline-form-editor-text.ts +121 -0
  336. package/dist/builtin/workflows/src/tui/inline-form-editor.ts +11 -223
  337. package/dist/builtin/workflows/src/tui/inputs-picker-editing.ts +151 -0
  338. package/dist/builtin/workflows/src/tui/inputs-picker-input.ts +305 -0
  339. package/dist/builtin/workflows/src/tui/inputs-picker-render.ts +300 -0
  340. package/dist/builtin/workflows/src/tui/inputs-picker-types.ts +190 -0
  341. package/dist/builtin/workflows/src/tui/inputs-picker.ts +19 -997
  342. package/dist/builtin/workflows/src/tui/prompt-card-input.ts +226 -0
  343. package/dist/builtin/workflows/src/tui/prompt-card-render.ts +373 -0
  344. package/dist/builtin/workflows/src/tui/prompt-card-select.ts +116 -0
  345. package/dist/builtin/workflows/src/tui/prompt-card-state.ts +61 -0
  346. package/dist/builtin/workflows/src/tui/prompt-card-text.ts +129 -0
  347. package/dist/builtin/workflows/src/tui/prompt-card.ts +8 -910
  348. package/dist/builtin/workflows/src/tui/stage-chat-view-archive-history.ts +315 -0
  349. package/dist/builtin/workflows/src/tui/stage-chat-view-custom-ui.ts +127 -0
  350. package/dist/builtin/workflows/src/tui/stage-chat-view-footer-status.ts +187 -0
  351. package/dist/builtin/workflows/src/tui/stage-chat-view-input.ts +222 -0
  352. package/dist/builtin/workflows/src/tui/stage-chat-view-render-helpers.ts +152 -0
  353. package/dist/builtin/workflows/src/tui/stage-chat-view-state.ts +464 -0
  354. package/dist/builtin/workflows/src/tui/stage-chat-view-transcript.ts +242 -0
  355. package/dist/builtin/workflows/src/tui/stage-chat-view-types.ts +151 -0
  356. package/dist/builtin/workflows/src/tui/stage-chat-view.ts +141 -1777
  357. package/dist/builtin/workflows/src/tui/workflow-attach-pane-types.ts +85 -0
  358. package/dist/builtin/workflows/src/tui/workflow-attach-pane.ts +1 -129
  359. package/dist/builtin/workflows/src/workflows/registry.ts +7 -3
  360. package/dist/config-self-update.d.ts +21 -0
  361. package/dist/config-self-update.d.ts.map +1 -0
  362. package/dist/config-self-update.js +265 -0
  363. package/dist/config-self-update.js.map +1 -0
  364. package/dist/config.d.ts +3 -12
  365. package/dist/config.d.ts.map +1 -1
  366. package/dist/config.js +15 -252
  367. package/dist/config.js.map +1 -1
  368. package/dist/core/agent-session-accessors.d.ts +3 -0
  369. package/dist/core/agent-session-accessors.d.ts.map +1 -0
  370. package/dist/core/agent-session-accessors.js +36 -0
  371. package/dist/core/agent-session-accessors.js.map +1 -0
  372. package/dist/core/agent-session-auto-compaction.d.ts +32 -0
  373. package/dist/core/agent-session-auto-compaction.d.ts.map +1 -0
  374. package/dist/core/agent-session-auto-compaction.js +219 -0
  375. package/dist/core/agent-session-auto-compaction.js.map +1 -0
  376. package/dist/core/agent-session-bash.d.ts +30 -0
  377. package/dist/core/agent-session-bash.d.ts.map +1 -0
  378. package/dist/core/agent-session-bash.js +79 -0
  379. package/dist/core/agent-session-bash.js.map +1 -0
  380. package/dist/core/agent-session-compaction.d.ts +44 -0
  381. package/dist/core/agent-session-compaction.d.ts.map +1 -0
  382. package/dist/core/agent-session-compaction.js +282 -0
  383. package/dist/core/agent-session-compaction.js.map +1 -0
  384. package/dist/core/agent-session-events.d.ts +65 -0
  385. package/dist/core/agent-session-events.d.ts.map +1 -0
  386. package/dist/core/agent-session-events.js +373 -0
  387. package/dist/core/agent-session-events.js.map +1 -0
  388. package/dist/core/agent-session-export.d.ts +42 -0
  389. package/dist/core/agent-session-export.d.ts.map +1 -0
  390. package/dist/core/agent-session-export.js +199 -0
  391. package/dist/core/agent-session-export.js.map +1 -0
  392. package/dist/core/agent-session-extension-bindings.d.ts +37 -0
  393. package/dist/core/agent-session-extension-bindings.d.ts.map +1 -0
  394. package/dist/core/agent-session-extension-bindings.js +231 -0
  395. package/dist/core/agent-session-extension-bindings.js.map +1 -0
  396. package/dist/core/agent-session-message-queue.d.ts +85 -0
  397. package/dist/core/agent-session-message-queue.d.ts.map +1 -0
  398. package/dist/core/agent-session-message-queue.js +264 -0
  399. package/dist/core/agent-session-message-queue.js.map +1 -0
  400. package/dist/core/agent-session-methods.d.ts +300 -0
  401. package/dist/core/agent-session-methods.d.ts.map +1 -0
  402. package/dist/core/agent-session-methods.js +2 -0
  403. package/dist/core/agent-session-methods.js.map +1 -0
  404. package/dist/core/agent-session-models.d.ts +111 -0
  405. package/dist/core/agent-session-models.d.ts.map +1 -0
  406. package/dist/core/agent-session-models.js +368 -0
  407. package/dist/core/agent-session-models.js.map +1 -0
  408. package/dist/core/agent-session-prompt.d.ts +61 -0
  409. package/dist/core/agent-session-prompt.d.ts.map +1 -0
  410. package/dist/core/agent-session-prompt.js +330 -0
  411. package/dist/core/agent-session-prompt.js.map +1 -0
  412. package/dist/core/agent-session-retry.d.ts +62 -0
  413. package/dist/core/agent-session-retry.d.ts.map +1 -0
  414. package/dist/core/agent-session-retry.js +202 -0
  415. package/dist/core/agent-session-retry.js.map +1 -0
  416. package/dist/core/agent-session-services.d.ts +0 -1
  417. package/dist/core/agent-session-services.d.ts.map +1 -1
  418. package/dist/core/agent-session-services.js +0 -1
  419. package/dist/core/agent-session-services.js.map +1 -1
  420. package/dist/core/agent-session-skill-block.d.ts +13 -0
  421. package/dist/core/agent-session-skill-block.d.ts.map +1 -0
  422. package/dist/core/agent-session-skill-block.js +37 -0
  423. package/dist/core/agent-session-skill-block.js.map +1 -0
  424. package/dist/core/agent-session-state.d.ts +48 -0
  425. package/dist/core/agent-session-state.d.ts.map +1 -0
  426. package/dist/core/agent-session-state.js +129 -0
  427. package/dist/core/agent-session-state.js.map +1 -0
  428. package/dist/core/agent-session-tool-hooks.d.ts +7 -0
  429. package/dist/core/agent-session-tool-hooks.d.ts.map +1 -0
  430. package/dist/core/agent-session-tool-hooks.js +72 -0
  431. package/dist/core/agent-session-tool-hooks.js.map +1 -0
  432. package/dist/core/agent-session-tool-registry.d.ts +15 -0
  433. package/dist/core/agent-session-tool-registry.d.ts.map +1 -0
  434. package/dist/core/agent-session-tool-registry.js +149 -0
  435. package/dist/core/agent-session-tool-registry.js.map +1 -0
  436. package/dist/core/agent-session-tree.d.ts +46 -0
  437. package/dist/core/agent-session-tree.d.ts.map +1 -0
  438. package/dist/core/agent-session-tree.js +217 -0
  439. package/dist/core/agent-session-tree.js.map +1 -0
  440. package/dist/core/agent-session-types.d.ts +157 -0
  441. package/dist/core/agent-session-types.d.ts.map +1 -0
  442. package/dist/core/agent-session-types.js +41 -0
  443. package/dist/core/agent-session-types.js.map +1 -0
  444. package/dist/core/agent-session.d.ts +66 -688
  445. package/dist/core/agent-session.d.ts.map +1 -1
  446. package/dist/core/agent-session.js +26 -3153
  447. package/dist/core/agent-session.js.map +1 -1
  448. package/dist/core/atomic-guide-command.d.ts.map +1 -1
  449. package/dist/core/atomic-guide-command.js +1 -1
  450. package/dist/core/atomic-guide-command.js.map +1 -1
  451. package/dist/core/auth-storage-backends.d.ts +49 -0
  452. package/dist/core/auth-storage-backends.d.ts.map +1 -0
  453. package/dist/core/auth-storage-backends.js +185 -0
  454. package/dist/core/auth-storage-backends.js.map +1 -0
  455. package/dist/core/auth-storage.d.ts +2 -49
  456. package/dist/core/auth-storage.d.ts.map +1 -1
  457. package/dist/core/auth-storage.js +3 -183
  458. package/dist/core/auth-storage.js.map +1 -1
  459. package/dist/core/compaction/context-compaction-metrics.d.ts +16 -0
  460. package/dist/core/compaction/context-compaction-metrics.d.ts.map +1 -0
  461. package/dist/core/compaction/context-compaction-metrics.js +58 -0
  462. package/dist/core/compaction/context-compaction-metrics.js.map +1 -0
  463. package/dist/core/compaction/context-compaction-prompt.d.ts +9 -0
  464. package/dist/core/compaction/context-compaction-prompt.d.ts.map +1 -0
  465. package/dist/core/compaction/context-compaction-prompt.js +161 -0
  466. package/dist/core/compaction/context-compaction-prompt.js.map +1 -0
  467. package/dist/core/compaction/context-compaction-runner.d.ts +5 -0
  468. package/dist/core/compaction/context-compaction-runner.d.ts.map +1 -0
  469. package/dist/core/compaction/context-compaction-runner.js +181 -0
  470. package/dist/core/compaction/context-compaction-runner.js.map +1 -0
  471. package/dist/core/compaction/context-compaction-strategy.d.ts +5 -0
  472. package/dist/core/compaction/context-compaction-strategy.d.ts.map +1 -0
  473. package/dist/core/compaction/context-compaction-strategy.js +27 -0
  474. package/dist/core/compaction/context-compaction-strategy.js.map +1 -0
  475. package/dist/core/compaction/context-compaction-types.d.ts +73 -0
  476. package/dist/core/compaction/context-compaction-types.d.ts.map +1 -0
  477. package/dist/core/compaction/context-compaction-types.js +6 -0
  478. package/dist/core/compaction/context-compaction-types.js.map +1 -0
  479. package/dist/core/compaction/context-compaction.d.ts +9 -200
  480. package/dist/core/compaction/context-compaction.d.ts.map +1 -1
  481. package/dist/core/compaction/context-compaction.js +7 -1943
  482. package/dist/core/compaction/context-compaction.js.map +1 -1
  483. package/dist/core/compaction/context-deletion-application.d.ts +13 -0
  484. package/dist/core/compaction/context-deletion-application.d.ts.map +1 -0
  485. package/dist/core/compaction/context-deletion-application.js +259 -0
  486. package/dist/core/compaction/context-deletion-application.js.map +1 -0
  487. package/dist/core/compaction/context-deletion-store.d.ts +78 -0
  488. package/dist/core/compaction/context-deletion-store.d.ts.map +1 -0
  489. package/dist/core/compaction/context-deletion-store.js +162 -0
  490. package/dist/core/compaction/context-deletion-store.js.map +1 -0
  491. package/dist/core/compaction/context-deletion-targets.d.ts +40 -0
  492. package/dist/core/compaction/context-deletion-targets.d.ts.map +1 -0
  493. package/dist/core/compaction/context-deletion-targets.js +267 -0
  494. package/dist/core/compaction/context-deletion-targets.js.map +1 -0
  495. package/dist/core/compaction/context-deletion-tool-definitions.d.ts +187 -0
  496. package/dist/core/compaction/context-deletion-tool-definitions.d.ts.map +1 -0
  497. package/dist/core/compaction/context-deletion-tool-definitions.js +98 -0
  498. package/dist/core/compaction/context-deletion-tool-definitions.js.map +1 -0
  499. package/dist/core/compaction/context-deletion-tool-helpers.d.ts +19 -0
  500. package/dist/core/compaction/context-deletion-tool-helpers.d.ts.map +1 -0
  501. package/dist/core/compaction/context-deletion-tool-helpers.js +137 -0
  502. package/dist/core/compaction/context-deletion-tool-helpers.js.map +1 -0
  503. package/dist/core/compaction/context-deletion-tools.d.ts +4 -0
  504. package/dist/core/compaction/context-deletion-tools.d.ts.map +1 -0
  505. package/dist/core/compaction/context-deletion-tools.js +395 -0
  506. package/dist/core/compaction/context-deletion-tools.js.map +1 -0
  507. package/dist/core/compaction/context-transcript-analysis.d.ts +9 -0
  508. package/dist/core/compaction/context-transcript-analysis.d.ts.map +1 -0
  509. package/dist/core/compaction/context-transcript-analysis.js +234 -0
  510. package/dist/core/compaction/context-transcript-analysis.js.map +1 -0
  511. package/dist/core/export-html/index.d.ts.map +1 -1
  512. package/dist/core/export-html/index.js +2 -1
  513. package/dist/core/export-html/index.js.map +1 -1
  514. package/dist/core/export-html/template-js/data-tree.js +287 -0
  515. package/dist/core/export-html/template-js/entries-navigation.js +424 -0
  516. package/dist/core/export-html/template-js/initialization.js +312 -0
  517. package/dist/core/export-html/template-js/message-tools.js +415 -0
  518. package/dist/core/export-html/template-js/tree-filter-render.js +421 -0
  519. package/dist/core/export-html/template-script.d.ts +3 -0
  520. package/dist/core/export-html/template-script.d.ts.map +1 -0
  521. package/dist/core/export-html/template-script.js +13 -0
  522. package/dist/core/export-html/template-script.js.map +1 -0
  523. package/dist/core/export-html/template.js +3 -1
  524. package/dist/core/extensions/agent-events.d.ts +159 -0
  525. package/dist/core/extensions/agent-events.d.ts.map +1 -0
  526. package/dist/core/extensions/agent-events.js +2 -0
  527. package/dist/core/extensions/agent-events.js.map +1 -0
  528. package/dist/core/extensions/api-types.d.ts +189 -0
  529. package/dist/core/extensions/api-types.d.ts.map +1 -0
  530. package/dist/core/extensions/api-types.js +2 -0
  531. package/dist/core/extensions/api-types.js.map +1 -0
  532. package/dist/core/extensions/command-types.d.ts +14 -0
  533. package/dist/core/extensions/command-types.d.ts.map +1 -0
  534. package/dist/core/extensions/command-types.js +2 -0
  535. package/dist/core/extensions/command-types.js.map +1 -0
  536. package/dist/core/extensions/context-types.d.ts +130 -0
  537. package/dist/core/extensions/context-types.d.ts.map +1 -0
  538. package/dist/core/extensions/context-types.js +2 -0
  539. package/dist/core/extensions/context-types.js.map +1 -0
  540. package/dist/core/extensions/event-results.d.ts +61 -0
  541. package/dist/core/extensions/event-results.d.ts.map +1 -0
  542. package/dist/core/extensions/event-results.js +2 -0
  543. package/dist/core/extensions/event-results.js.map +1 -0
  544. package/dist/core/extensions/event-types.d.ts +6 -0
  545. package/dist/core/extensions/event-types.d.ts.map +1 -0
  546. package/dist/core/extensions/event-types.js +2 -0
  547. package/dist/core/extensions/event-types.js.map +1 -0
  548. package/dist/core/extensions/loader-api.d.ts +10 -0
  549. package/dist/core/extensions/loader-api.d.ts.map +1 -0
  550. package/dist/core/extensions/loader-api.js +143 -0
  551. package/dist/core/extensions/loader-api.js.map +1 -0
  552. package/dist/core/extensions/loader-core.d.ts +10 -0
  553. package/dist/core/extensions/loader-core.d.ts.map +1 -0
  554. package/dist/core/extensions/loader-core.js +98 -0
  555. package/dist/core/extensions/loader-core.js.map +1 -0
  556. package/dist/core/extensions/loader-discovery.d.ts +7 -0
  557. package/dist/core/extensions/loader-discovery.d.ts.map +1 -0
  558. package/dist/core/extensions/loader-discovery.js +139 -0
  559. package/dist/core/extensions/loader-discovery.js.map +1 -0
  560. package/dist/core/extensions/loader-resources.d.ts +11 -0
  561. package/dist/core/extensions/loader-resources.d.ts.map +1 -0
  562. package/dist/core/extensions/loader-resources.js +10 -0
  563. package/dist/core/extensions/loader-resources.js.map +1 -0
  564. package/dist/core/extensions/loader-runtime.d.ts +7 -0
  565. package/dist/core/extensions/loader-runtime.d.ts.map +1 -0
  566. package/dist/core/extensions/loader-runtime.js +51 -0
  567. package/dist/core/extensions/loader-runtime.js.map +1 -0
  568. package/dist/core/extensions/loader-virtual-modules.d.ts +9 -0
  569. package/dist/core/extensions/loader-virtual-modules.d.ts.map +1 -0
  570. package/dist/core/extensions/loader-virtual-modules.js +124 -0
  571. package/dist/core/extensions/loader-virtual-modules.js.map +1 -0
  572. package/dist/core/extensions/loader.d.ts +5 -28
  573. package/dist/core/extensions/loader.d.ts.map +1 -1
  574. package/dist/core/extensions/loader.js +4 -542
  575. package/dist/core/extensions/loader.js.map +1 -1
  576. package/dist/core/extensions/message-types.d.ts +34 -0
  577. package/dist/core/extensions/message-types.d.ts.map +1 -0
  578. package/dist/core/extensions/message-types.js +2 -0
  579. package/dist/core/extensions/message-types.js.map +1 -0
  580. package/dist/core/extensions/provider-types.d.ts +71 -0
  581. package/dist/core/extensions/provider-types.d.ts.map +1 -0
  582. package/dist/core/extensions/provider-types.js +2 -0
  583. package/dist/core/extensions/provider-types.js.map +1 -0
  584. package/dist/core/extensions/runner-context.d.ts +42 -0
  585. package/dist/core/extensions/runner-context.d.ts.map +1 -0
  586. package/dist/core/extensions/runner-context.js +112 -0
  587. package/dist/core/extensions/runner-context.js.map +1 -0
  588. package/dist/core/extensions/runner-events.d.ts +47 -0
  589. package/dist/core/extensions/runner-events.d.ts.map +1 -0
  590. package/dist/core/extensions/runner-events.js +280 -0
  591. package/dist/core/extensions/runner-events.js.map +1 -0
  592. package/dist/core/extensions/runner-handlers.d.ts +32 -0
  593. package/dist/core/extensions/runner-handlers.d.ts.map +1 -0
  594. package/dist/core/extensions/runner-handlers.js +2 -0
  595. package/dist/core/extensions/runner-handlers.js.map +1 -0
  596. package/dist/core/extensions/runner-project-trust.d.ts +6 -0
  597. package/dist/core/extensions/runner-project-trust.d.ts.map +1 -0
  598. package/dist/core/extensions/runner-project-trust.js +27 -0
  599. package/dist/core/extensions/runner-project-trust.js.map +1 -0
  600. package/dist/core/extensions/runner-registries.d.ts +8 -0
  601. package/dist/core/extensions/runner-registries.d.ts.map +1 -0
  602. package/dist/core/extensions/runner-registries.js +76 -0
  603. package/dist/core/extensions/runner-registries.js.map +1 -0
  604. package/dist/core/extensions/runner-shortcuts.d.ts +10 -0
  605. package/dist/core/extensions/runner-shortcuts.d.ts.map +1 -0
  606. package/dist/core/extensions/runner-shortcuts.js +71 -0
  607. package/dist/core/extensions/runner-shortcuts.js.map +1 -0
  608. package/dist/core/extensions/runner-ui.d.ts +3 -0
  609. package/dist/core/extensions/runner-ui.d.ts.map +1 -0
  610. package/dist/core/extensions/runner-ui.js +50 -0
  611. package/dist/core/extensions/runner-ui.js.map +1 -0
  612. package/dist/core/extensions/runner.d.ts +7 -74
  613. package/dist/core/extensions/runner.d.ts.map +1 -1
  614. package/dist/core/extensions/runner.js +67 -673
  615. package/dist/core/extensions/runner.js.map +1 -1
  616. package/dist/core/extensions/runtime-types.d.ts +179 -0
  617. package/dist/core/extensions/runtime-types.d.ts.map +1 -0
  618. package/dist/core/extensions/runtime-types.js +2 -0
  619. package/dist/core/extensions/runtime-types.js.map +1 -0
  620. package/dist/core/extensions/session-events.d.ts +89 -0
  621. package/dist/core/extensions/session-events.d.ts.map +1 -0
  622. package/dist/core/extensions/session-events.js +2 -0
  623. package/dist/core/extensions/session-events.js.map +1 -0
  624. package/dist/core/extensions/tool-events.d.ts +127 -0
  625. package/dist/core/extensions/tool-events.d.ts.map +1 -0
  626. package/dist/core/extensions/tool-events.js +26 -0
  627. package/dist/core/extensions/tool-events.js.map +1 -0
  628. package/dist/core/extensions/tool-types.d.ts +100 -0
  629. package/dist/core/extensions/tool-types.d.ts.map +1 -0
  630. package/dist/core/extensions/tool-types.js +11 -0
  631. package/dist/core/extensions/tool-types.js.map +1 -0
  632. package/dist/core/extensions/types.d.ts +20 -1288
  633. package/dist/core/extensions/types.d.ts.map +1 -1
  634. package/dist/core/extensions/types.js +4 -34
  635. package/dist/core/extensions/types.js.map +1 -1
  636. package/dist/core/extensions/ui-types.d.ts +200 -0
  637. package/dist/core/extensions/ui-types.d.ts.map +1 -0
  638. package/dist/core/extensions/ui-types.js +2 -0
  639. package/dist/core/extensions/ui-types.js.map +1 -0
  640. package/dist/core/index.d.ts +0 -1
  641. package/dist/core/index.d.ts.map +1 -1
  642. package/dist/core/index.js +0 -1
  643. package/dist/core/index.js.map +1 -1
  644. package/dist/core/model-registry-auth.d.ts +7 -0
  645. package/dist/core/model-registry-auth.d.ts.map +1 -0
  646. package/dist/core/model-registry-auth.js +64 -0
  647. package/dist/core/model-registry-auth.js.map +1 -0
  648. package/dist/core/model-registry-builtins.d.ts +9 -0
  649. package/dist/core/model-registry-builtins.d.ts.map +1 -0
  650. package/dist/core/model-registry-builtins.js +126 -0
  651. package/dist/core/model-registry-builtins.js.map +1 -0
  652. package/dist/core/model-registry-custom-loader.d.ts +3 -0
  653. package/dist/core/model-registry-custom-loader.d.ts.map +1 -0
  654. package/dist/core/model-registry-custom-loader.js +213 -0
  655. package/dist/core/model-registry-custom-loader.js.map +1 -0
  656. package/dist/core/model-registry-dynamic.d.ts +6 -0
  657. package/dist/core/model-registry-dynamic.d.ts.map +1 -0
  658. package/dist/core/model-registry-dynamic.js +155 -0
  659. package/dist/core/model-registry-dynamic.js.map +1 -0
  660. package/dist/core/model-registry-loader.d.ts +4 -0
  661. package/dist/core/model-registry-loader.d.ts.map +1 -0
  662. package/dist/core/model-registry-loader.js +20 -0
  663. package/dist/core/model-registry-loader.js.map +1 -0
  664. package/dist/core/model-registry-schemas.d.ts +1136 -0
  665. package/dist/core/model-registry-schemas.d.ts.map +1 -0
  666. package/dist/core/model-registry-schemas.js +171 -0
  667. package/dist/core/model-registry-schemas.js.map +1 -0
  668. package/dist/core/model-registry-types.d.ts +74 -0
  669. package/dist/core/model-registry-types.d.ts.map +1 -0
  670. package/dist/core/model-registry-types.js +2 -0
  671. package/dist/core/model-registry-types.js.map +1 -0
  672. package/dist/core/model-registry.d.ts +3 -76
  673. package/dist/core/model-registry.d.ts.map +1 -1
  674. package/dist/core/model-registry.js +24 -733
  675. package/dist/core/model-registry.js.map +1 -1
  676. package/dist/core/model-resolver-cli.d.ts +19 -0
  677. package/dist/core/model-resolver-cli.d.ts.map +1 -0
  678. package/dist/core/model-resolver-cli.js +118 -0
  679. package/dist/core/model-resolver-cli.js.map +1 -0
  680. package/dist/core/model-resolver-defaults.d.ts +5 -0
  681. package/dist/core/model-resolver-defaults.d.ts.map +1 -0
  682. package/dist/core/model-resolver-defaults.js +47 -0
  683. package/dist/core/model-resolver-defaults.js.map +1 -0
  684. package/dist/core/model-resolver-initial.d.ts +31 -0
  685. package/dist/core/model-resolver-initial.d.ts.map +1 -0
  686. package/dist/core/model-resolver-initial.js +116 -0
  687. package/dist/core/model-resolver-initial.js.map +1 -0
  688. package/dist/core/model-resolver-patterns.d.ts +26 -0
  689. package/dist/core/model-resolver-patterns.d.ts.map +1 -0
  690. package/dist/core/model-resolver-patterns.js +139 -0
  691. package/dist/core/model-resolver-patterns.js.map +1 -0
  692. package/dist/core/model-resolver-scope.d.ts +15 -0
  693. package/dist/core/model-resolver-scope.d.ts.map +1 -0
  694. package/dist/core/model-resolver-scope.js +66 -0
  695. package/dist/core/model-resolver-scope.js.map +1 -0
  696. package/dist/core/model-resolver-types.d.ts +29 -0
  697. package/dist/core/model-resolver-types.d.ts.map +1 -0
  698. package/dist/core/model-resolver-types.js +2 -0
  699. package/dist/core/model-resolver-types.js.map +1 -0
  700. package/dist/core/model-resolver.d.ts +6 -107
  701. package/dist/core/model-resolver.d.ts.map +1 -1
  702. package/dist/core/model-resolver.js +5 -549
  703. package/dist/core/model-resolver.js.map +1 -1
  704. package/dist/core/package-manager-auto-resources.d.ts +5 -0
  705. package/dist/core/package-manager-auto-resources.d.ts.map +1 -0
  706. package/dist/core/package-manager-auto-resources.js +109 -0
  707. package/dist/core/package-manager-auto-resources.js.map +1 -0
  708. package/dist/core/package-manager-command.d.ts +11 -0
  709. package/dist/core/package-manager-command.d.ts.map +1 -0
  710. package/dist/core/package-manager-command.js +102 -0
  711. package/dist/core/package-manager-command.js.map +1 -0
  712. package/dist/core/package-manager-constants.d.ts +4 -0
  713. package/dist/core/package-manager-constants.d.ts.map +1 -0
  714. package/dist/core/package-manager-constants.js +4 -0
  715. package/dist/core/package-manager-constants.js.map +1 -0
  716. package/dist/core/package-manager-env.d.ts +4 -0
  717. package/dist/core/package-manager-env.d.ts.map +1 -0
  718. package/dist/core/package-manager-env.js +40 -0
  719. package/dist/core/package-manager-env.js.map +1 -0
  720. package/dist/core/package-manager-git.d.ts +10 -0
  721. package/dist/core/package-manager-git.d.ts.map +1 -0
  722. package/dist/core/package-manager-git.js +271 -0
  723. package/dist/core/package-manager-git.js.map +1 -0
  724. package/dist/core/package-manager-manifest.d.ts +7 -0
  725. package/dist/core/package-manager-manifest.d.ts.map +1 -0
  726. package/dist/core/package-manager-manifest.js +45 -0
  727. package/dist/core/package-manager-manifest.js.map +1 -0
  728. package/dist/core/package-manager-npm.d.ts +25 -0
  729. package/dist/core/package-manager-npm.d.ts.map +1 -0
  730. package/dist/core/package-manager-npm.js +252 -0
  731. package/dist/core/package-manager-npm.js.map +1 -0
  732. package/dist/core/package-manager-operations.d.ts +11 -0
  733. package/dist/core/package-manager-operations.d.ts.map +1 -0
  734. package/dist/core/package-manager-operations.js +196 -0
  735. package/dist/core/package-manager-operations.js.map +1 -0
  736. package/dist/core/package-manager-paths.d.ts +14 -0
  737. package/dist/core/package-manager-paths.d.ts.map +1 -0
  738. package/dist/core/package-manager-paths.js +61 -0
  739. package/dist/core/package-manager-paths.js.map +1 -0
  740. package/dist/core/package-manager-progress.d.ts +4 -0
  741. package/dist/core/package-manager-progress.d.ts.map +1 -0
  742. package/dist/core/package-manager-progress.js +16 -0
  743. package/dist/core/package-manager-progress.js.map +1 -0
  744. package/dist/core/package-manager-resolver.d.ts +5 -0
  745. package/dist/core/package-manager-resolver.d.ts.map +1 -0
  746. package/dist/core/package-manager-resolver.js +149 -0
  747. package/dist/core/package-manager-resolver.js.map +1 -0
  748. package/dist/core/package-manager-resource-accumulator.d.ts +6 -0
  749. package/dist/core/package-manager-resource-accumulator.d.ts.map +1 -0
  750. package/dist/core/package-manager-resource-accumulator.js +67 -0
  751. package/dist/core/package-manager-resource-accumulator.js.map +1 -0
  752. package/dist/core/package-manager-resource-collector.d.ts +5 -0
  753. package/dist/core/package-manager-resource-collector.d.ts.map +1 -0
  754. package/dist/core/package-manager-resource-collector.js +148 -0
  755. package/dist/core/package-manager-resource-collector.js.map +1 -0
  756. package/dist/core/package-manager-resource-files.d.ts +14 -0
  757. package/dist/core/package-manager-resource-files.d.ts.map +1 -0
  758. package/dist/core/package-manager-resource-files.js +265 -0
  759. package/dist/core/package-manager-resource-files.js.map +1 -0
  760. package/dist/core/package-manager-resource-patterns.d.ts +12 -0
  761. package/dist/core/package-manager-resource-patterns.d.ts.map +1 -0
  762. package/dist/core/package-manager-resource-patterns.js +136 -0
  763. package/dist/core/package-manager-resource-patterns.js.map +1 -0
  764. package/dist/core/package-manager-settings.d.ts +10 -0
  765. package/dist/core/package-manager-settings.d.ts.map +1 -0
  766. package/dist/core/package-manager-settings.js +91 -0
  767. package/dist/core/package-manager-settings.js.map +1 -0
  768. package/dist/core/package-manager-source.d.ts +21 -0
  769. package/dist/core/package-manager-source.d.ts.map +1 -0
  770. package/dist/core/package-manager-source.js +146 -0
  771. package/dist/core/package-manager-source.js.map +1 -0
  772. package/dist/core/package-manager-types.d.ts +169 -0
  773. package/dist/core/package-manager-types.d.ts.map +1 -0
  774. package/dist/core/package-manager-types.js +9 -0
  775. package/dist/core/package-manager-types.js.map +1 -0
  776. package/dist/core/package-manager.d.ts +9 -174
  777. package/dist/core/package-manager.d.ts.map +1 -1
  778. package/dist/core/package-manager.js +56 -2100
  779. package/dist/core/package-manager.js.map +1 -1
  780. package/dist/core/resource-loader-assets.d.ts +6 -0
  781. package/dist/core/resource-loader-assets.d.ts.map +1 -0
  782. package/dist/core/resource-loader-assets.js +209 -0
  783. package/dist/core/resource-loader-assets.js.map +1 -0
  784. package/dist/core/resource-loader-context-files.d.ts +10 -0
  785. package/dist/core/resource-loader-context-files.d.ts.map +1 -0
  786. package/dist/core/resource-loader-context-files.js +74 -0
  787. package/dist/core/resource-loader-context-files.js.map +1 -0
  788. package/dist/core/resource-loader-core.d.ts +83 -0
  789. package/dist/core/resource-loader-core.d.ts.map +1 -0
  790. package/dist/core/resource-loader-core.js +170 -0
  791. package/dist/core/resource-loader-core.js.map +1 -0
  792. package/dist/core/resource-loader-discovery.d.ts +4 -0
  793. package/dist/core/resource-loader-discovery.d.ts.map +1 -0
  794. package/dist/core/resource-loader-discovery.js +28 -0
  795. package/dist/core/resource-loader-discovery.js.map +1 -0
  796. package/dist/core/resource-loader-extensions.d.ts +13 -0
  797. package/dist/core/resource-loader-extensions.d.ts.map +1 -0
  798. package/dist/core/resource-loader-extensions.js +110 -0
  799. package/dist/core/resource-loader-extensions.js.map +1 -0
  800. package/dist/core/resource-loader-helpers.d.ts +4 -0
  801. package/dist/core/resource-loader-helpers.d.ts.map +1 -0
  802. package/dist/core/resource-loader-helpers.js +23 -0
  803. package/dist/core/resource-loader-helpers.js.map +1 -0
  804. package/dist/core/resource-loader-internals.d.ts +97 -0
  805. package/dist/core/resource-loader-internals.d.ts.map +1 -0
  806. package/dist/core/resource-loader-internals.js +4 -0
  807. package/dist/core/resource-loader-internals.js.map +1 -0
  808. package/dist/core/resource-loader-package-resources.d.ts +31 -0
  809. package/dist/core/resource-loader-package-resources.d.ts.map +1 -0
  810. package/dist/core/resource-loader-package-resources.js +112 -0
  811. package/dist/core/resource-loader-package-resources.js.map +1 -0
  812. package/dist/core/resource-loader-paths.d.ts +4 -0
  813. package/dist/core/resource-loader-paths.d.ts.map +1 -0
  814. package/dist/core/resource-loader-paths.js +22 -0
  815. package/dist/core/resource-loader-paths.js.map +1 -0
  816. package/dist/core/resource-loader-reload.d.ts +6 -0
  817. package/dist/core/resource-loader-reload.d.ts.map +1 -0
  818. package/dist/core/resource-loader-reload.js +230 -0
  819. package/dist/core/resource-loader-reload.js.map +1 -0
  820. package/dist/core/resource-loader-source-info.d.ts +9 -0
  821. package/dist/core/resource-loader-source-info.d.ts.map +1 -0
  822. package/dist/core/resource-loader-source-info.js +101 -0
  823. package/dist/core/resource-loader-source-info.js.map +1 -0
  824. package/dist/core/resource-loader-types.d.ts +130 -0
  825. package/dist/core/resource-loader-types.d.ts.map +1 -0
  826. package/dist/core/resource-loader-types.js +2 -0
  827. package/dist/core/resource-loader-types.js.map +1 -0
  828. package/dist/core/resource-loader.d.ts +3 -242
  829. package/dist/core/resource-loader.d.ts.map +1 -1
  830. package/dist/core/resource-loader.js +2 -976
  831. package/dist/core/resource-loader.js.map +1 -1
  832. package/dist/core/sdk-exports.d.ts +7 -0
  833. package/dist/core/sdk-exports.d.ts.map +1 -0
  834. package/dist/core/sdk-exports.js +5 -0
  835. package/dist/core/sdk-exports.js.map +1 -0
  836. package/dist/core/sdk-types.d.ts +83 -0
  837. package/dist/core/sdk-types.d.ts.map +1 -0
  838. package/dist/core/sdk-types.js +2 -0
  839. package/dist/core/sdk-types.js.map +1 -0
  840. package/dist/core/sdk.d.ts +3 -91
  841. package/dist/core/sdk.d.ts.map +1 -1
  842. package/dist/core/sdk.js +2 -7
  843. package/dist/core/sdk.js.map +1 -1
  844. package/dist/core/session-manager-archive.d.ts +27 -0
  845. package/dist/core/session-manager-archive.d.ts.map +1 -0
  846. package/dist/core/session-manager-archive.js +114 -0
  847. package/dist/core/session-manager-archive.js.map +1 -0
  848. package/dist/core/session-manager-core.d.ts +104 -0
  849. package/dist/core/session-manager-core.d.ts.map +1 -0
  850. package/dist/core/session-manager-core.js +346 -0
  851. package/dist/core/session-manager-core.js.map +1 -0
  852. package/dist/core/session-manager-entries.d.ts +38 -0
  853. package/dist/core/session-manager-entries.d.ts.map +1 -0
  854. package/dist/core/session-manager-entries.js +124 -0
  855. package/dist/core/session-manager-entries.js.map +1 -0
  856. package/dist/core/session-manager-history.d.ts +38 -0
  857. package/dist/core/session-manager-history.d.ts.map +1 -0
  858. package/dist/core/session-manager-history.js +379 -0
  859. package/dist/core/session-manager-history.js.map +1 -0
  860. package/dist/core/session-manager-list.d.ts +5 -0
  861. package/dist/core/session-manager-list.d.ts.map +1 -0
  862. package/dist/core/session-manager-list.js +196 -0
  863. package/dist/core/session-manager-list.js.map +1 -0
  864. package/dist/core/session-manager-migrations.d.ts +11 -0
  865. package/dist/core/session-manager-migrations.d.ts.map +1 -0
  866. package/dist/core/session-manager-migrations.js +80 -0
  867. package/dist/core/session-manager-migrations.js.map +1 -0
  868. package/dist/core/session-manager-paths.d.ts +7 -0
  869. package/dist/core/session-manager-paths.d.ts.map +1 -0
  870. package/dist/core/session-manager-paths.js +22 -0
  871. package/dist/core/session-manager-paths.js.map +1 -0
  872. package/dist/core/session-manager-storage.d.ts +15 -0
  873. package/dist/core/session-manager-storage.d.ts.map +1 -0
  874. package/dist/core/session-manager-storage.js +127 -0
  875. package/dist/core/session-manager-storage.js.map +1 -0
  876. package/dist/core/session-manager-types.d.ts +172 -0
  877. package/dist/core/session-manager-types.d.ts.map +1 -0
  878. package/dist/core/session-manager-types.js +2 -0
  879. package/dist/core/session-manager-types.js.map +1 -0
  880. package/dist/core/session-manager-validation.d.ts +7 -0
  881. package/dist/core/session-manager-validation.d.ts.map +1 -0
  882. package/dist/core/session-manager-validation.js +34 -0
  883. package/dist/core/session-manager-validation.js.map +1 -0
  884. package/dist/core/session-manager.d.ts +8 -390
  885. package/dist/core/session-manager.d.ts.map +1 -1
  886. package/dist/core/session-manager.js +7 -1418
  887. package/dist/core/session-manager.js.map +1 -1
  888. package/dist/core/settings-manager-basic-accessors.d.ts +65 -0
  889. package/dist/core/settings-manager-basic-accessors.d.ts.map +1 -0
  890. package/dist/core/settings-manager-basic-accessors.js +253 -0
  891. package/dist/core/settings-manager-basic-accessors.js.map +1 -0
  892. package/dist/core/settings-manager-core.d.ts +57 -0
  893. package/dist/core/settings-manager-core.d.ts.map +1 -0
  894. package/dist/core/settings-manager-core.js +387 -0
  895. package/dist/core/settings-manager-core.js.map +1 -0
  896. package/dist/core/settings-manager-internals.d.ts +13 -0
  897. package/dist/core/settings-manager-internals.d.ts.map +1 -0
  898. package/dist/core/settings-manager-internals.js +4 -0
  899. package/dist/core/settings-manager-internals.js.map +1 -0
  900. package/dist/core/settings-manager-resource-accessors.d.ts +43 -0
  901. package/dist/core/settings-manager-resource-accessors.d.ts.map +1 -0
  902. package/dist/core/settings-manager-resource-accessors.js +172 -0
  903. package/dist/core/settings-manager-resource-accessors.js.map +1 -0
  904. package/dist/core/settings-manager-ui-accessors.d.ts +44 -0
  905. package/dist/core/settings-manager-ui-accessors.d.ts.map +1 -0
  906. package/dist/core/settings-manager-ui-accessors.js +208 -0
  907. package/dist/core/settings-manager-ui-accessors.js.map +1 -0
  908. package/dist/core/settings-manager.d.ts +6 -321
  909. package/dist/core/settings-manager.d.ts.map +1 -1
  910. package/dist/core/settings-manager.js +5 -1060
  911. package/dist/core/settings-manager.js.map +1 -1
  912. package/dist/core/settings-merge.d.ts +4 -0
  913. package/dist/core/settings-merge.d.ts.map +1 -0
  914. package/dist/core/settings-merge.js +26 -0
  915. package/dist/core/settings-merge.js.map +1 -0
  916. package/dist/core/settings-storage.d.ts +20 -0
  917. package/dist/core/settings-storage.d.ts.map +1 -0
  918. package/dist/core/settings-storage.js +100 -0
  919. package/dist/core/settings-storage.js.map +1 -0
  920. package/dist/core/settings-types.d.ts +123 -0
  921. package/dist/core/settings-types.d.ts.map +1 -0
  922. package/dist/core/settings-types.js +2 -0
  923. package/dist/core/settings-types.js.map +1 -0
  924. package/dist/core/system-prompt.d.ts.map +1 -1
  925. package/dist/core/system-prompt.js +7 -0
  926. package/dist/core/system-prompt.js.map +1 -1
  927. package/dist/core/tools/bash.d.ts +0 -5
  928. package/dist/core/tools/bash.d.ts.map +1 -1
  929. package/dist/core/tools/bash.js +10 -11
  930. package/dist/core/tools/bash.js.map +1 -1
  931. package/dist/core/tools/edit-diff-preserve.d.ts +18 -0
  932. package/dist/core/tools/edit-diff-preserve.d.ts.map +1 -0
  933. package/dist/core/tools/edit-diff-preserve.js +85 -0
  934. package/dist/core/tools/edit-diff-preserve.js.map +1 -0
  935. package/dist/core/tools/edit-diff.d.ts +3 -2
  936. package/dist/core/tools/edit-diff.d.ts.map +1 -1
  937. package/dist/core/tools/edit-diff.js +15 -18
  938. package/dist/core/tools/edit-diff.js.map +1 -1
  939. package/dist/core/tools/index.d.ts +0 -1
  940. package/dist/core/tools/index.d.ts.map +1 -1
  941. package/dist/core/tools/index.js +0 -1
  942. package/dist/core/tools/index.js.map +1 -1
  943. package/dist/core/tools/todos-execute.d.ts +5 -0
  944. package/dist/core/tools/todos-execute.d.ts.map +1 -0
  945. package/dist/core/tools/todos-execute.js +200 -0
  946. package/dist/core/tools/todos-execute.js.map +1 -0
  947. package/dist/core/tools/todos-locks.d.ts +4 -0
  948. package/dist/core/tools/todos-locks.d.ts.map +1 -0
  949. package/dist/core/tools/todos-locks.js +80 -0
  950. package/dist/core/tools/todos-locks.js.map +1 -0
  951. package/dist/core/tools/todos-model.d.ts +21 -0
  952. package/dist/core/tools/todos-model.d.ts.map +1 -0
  953. package/dist/core/tools/todos-model.js +71 -0
  954. package/dist/core/tools/todos-model.js.map +1 -0
  955. package/dist/core/tools/todos-mutations.d.ts +6 -0
  956. package/dist/core/tools/todos-mutations.d.ts.map +1 -0
  957. package/dist/core/tools/todos-mutations.js +85 -0
  958. package/dist/core/tools/todos-mutations.js.map +1 -0
  959. package/dist/core/tools/todos-paths.d.ts +5 -0
  960. package/dist/core/tools/todos-paths.d.ts.map +1 -0
  961. package/dist/core/tools/todos-paths.js +25 -0
  962. package/dist/core/tools/todos-paths.js.map +1 -0
  963. package/dist/core/tools/todos-render.d.ts +10 -0
  964. package/dist/core/tools/todos-render.d.ts.map +1 -0
  965. package/dist/core/tools/todos-render.js +159 -0
  966. package/dist/core/tools/todos-render.js.map +1 -0
  967. package/dist/core/tools/todos-storage.d.ts +9 -0
  968. package/dist/core/tools/todos-storage.d.ts.map +1 -0
  969. package/dist/core/tools/todos-storage.js +183 -0
  970. package/dist/core/tools/todos-storage.js.map +1 -0
  971. package/dist/core/tools/todos-types.d.ts +46 -0
  972. package/dist/core/tools/todos-types.d.ts.map +1 -0
  973. package/dist/core/tools/todos-types.js +27 -0
  974. package/dist/core/tools/todos-types.js.map +1 -0
  975. package/dist/core/tools/todos.d.ts +12 -32
  976. package/dist/core/tools/todos.d.ts.map +1 -1
  977. package/dist/core/tools/todos.js +7 -893
  978. package/dist/core/tools/todos.js.map +1 -1
  979. package/dist/index-extensions.d.ts +3 -0
  980. package/dist/index-extensions.d.ts.map +1 -0
  981. package/dist/index-extensions.js +2 -0
  982. package/dist/index-extensions.js.map +1 -0
  983. package/dist/index.d.ts +3 -4
  984. package/dist/index.d.ts.map +1 -1
  985. package/dist/index.js +2 -2
  986. package/dist/index.js.map +1 -1
  987. package/dist/main-app-mode.d.ts +15 -0
  988. package/dist/main-app-mode.d.ts.map +1 -0
  989. package/dist/main-app-mode.js +51 -0
  990. package/dist/main-app-mode.js.map +1 -0
  991. package/dist/main-session-options.d.ts +12 -0
  992. package/dist/main-session-options.d.ts.map +1 -0
  993. package/dist/main-session-options.js +87 -0
  994. package/dist/main-session-options.js.map +1 -0
  995. package/dist/main-session.d.ts +9 -0
  996. package/dist/main-session.d.ts.map +1 -0
  997. package/dist/main-session.js +188 -0
  998. package/dist/main-session.js.map +1 -0
  999. package/dist/main-stdio.d.ts +12 -0
  1000. package/dist/main-stdio.d.ts.map +1 -0
  1001. package/dist/main-stdio.js +68 -0
  1002. package/dist/main-stdio.js.map +1 -0
  1003. package/dist/main.d.ts +2 -3
  1004. package/dist/main.d.ts.map +1 -1
  1005. package/dist/main.js +11 -388
  1006. package/dist/main.js.map +1 -1
  1007. package/dist/migrations-config-values.d.ts +9 -0
  1008. package/dist/migrations-config-values.d.ts.map +1 -0
  1009. package/dist/migrations-config-values.js +298 -0
  1010. package/dist/migrations-config-values.js.map +1 -0
  1011. package/dist/migrations.d.ts.map +1 -1
  1012. package/dist/migrations.js +2 -296
  1013. package/dist/migrations.js.map +1 -1
  1014. package/dist/modes/interactive/components/chat-message-renderer.d.ts.map +1 -1
  1015. package/dist/modes/interactive/components/chat-message-renderer.js +0 -7
  1016. package/dist/modes/interactive/components/chat-message-renderer.js.map +1 -1
  1017. package/dist/modes/interactive/components/chat-session-host-actions.d.ts +9 -0
  1018. package/dist/modes/interactive/components/chat-session-host-actions.d.ts.map +1 -0
  1019. package/dist/modes/interactive/components/chat-session-host-actions.js +244 -0
  1020. package/dist/modes/interactive/components/chat-session-host-actions.js.map +1 -0
  1021. package/dist/modes/interactive/components/chat-session-host-editor.d.ts +18 -0
  1022. package/dist/modes/interactive/components/chat-session-host-editor.d.ts.map +1 -0
  1023. package/dist/modes/interactive/components/chat-session-host-editor.js +165 -0
  1024. package/dist/modes/interactive/components/chat-session-host-editor.js.map +1 -0
  1025. package/dist/modes/interactive/components/chat-session-host-events.d.ts +5 -0
  1026. package/dist/modes/interactive/components/chat-session-host-events.d.ts.map +1 -0
  1027. package/dist/modes/interactive/components/chat-session-host-events.js +200 -0
  1028. package/dist/modes/interactive/components/chat-session-host-events.js.map +1 -0
  1029. package/dist/modes/interactive/components/chat-session-host-rendering.d.ts +13 -0
  1030. package/dist/modes/interactive/components/chat-session-host-rendering.d.ts.map +1 -0
  1031. package/dist/modes/interactive/components/chat-session-host-rendering.js +185 -0
  1032. package/dist/modes/interactive/components/chat-session-host-rendering.js.map +1 -0
  1033. package/dist/modes/interactive/components/chat-session-host-runtime.d.ts +13 -0
  1034. package/dist/modes/interactive/components/chat-session-host-runtime.d.ts.map +1 -0
  1035. package/dist/modes/interactive/components/chat-session-host-runtime.js +101 -0
  1036. package/dist/modes/interactive/components/chat-session-host-runtime.js.map +1 -0
  1037. package/dist/modes/interactive/components/chat-session-host-state.d.ts +53 -0
  1038. package/dist/modes/interactive/components/chat-session-host-state.d.ts.map +1 -0
  1039. package/dist/modes/interactive/components/chat-session-host-state.js +42 -0
  1040. package/dist/modes/interactive/components/chat-session-host-state.js.map +1 -0
  1041. package/dist/modes/interactive/components/chat-session-host-types.d.ts +63 -0
  1042. package/dist/modes/interactive/components/chat-session-host-types.d.ts.map +1 -0
  1043. package/dist/modes/interactive/components/chat-session-host-types.js +2 -0
  1044. package/dist/modes/interactive/components/chat-session-host-types.js.map +1 -0
  1045. package/dist/modes/interactive/components/chat-session-host-utils.d.ts +28 -0
  1046. package/dist/modes/interactive/components/chat-session-host-utils.d.ts.map +1 -0
  1047. package/dist/modes/interactive/components/chat-session-host-utils.js +103 -0
  1048. package/dist/modes/interactive/components/chat-session-host-utils.js.map +1 -0
  1049. package/dist/modes/interactive/components/chat-session-host.d.ts +6 -129
  1050. package/dist/modes/interactive/components/chat-session-host.d.ts.map +1 -1
  1051. package/dist/modes/interactive/components/chat-session-host.js +50 -1022
  1052. package/dist/modes/interactive/components/chat-session-host.js.map +1 -1
  1053. package/dist/modes/interactive/components/config-selector-list.d.ts +65 -0
  1054. package/dist/modes/interactive/components/config-selector-list.d.ts.map +1 -0
  1055. package/dist/modes/interactive/components/config-selector-list.js +458 -0
  1056. package/dist/modes/interactive/components/config-selector-list.js.map +1 -0
  1057. package/dist/modes/interactive/components/config-selector.d.ts +3 -58
  1058. package/dist/modes/interactive/components/config-selector.d.ts.map +1 -1
  1059. package/dist/modes/interactive/components/config-selector.js +2 -457
  1060. package/dist/modes/interactive/components/config-selector.js.map +1 -1
  1061. package/dist/modes/interactive/components/model-selector.d.ts.map +1 -1
  1062. package/dist/modes/interactive/components/model-selector.js +2 -2
  1063. package/dist/modes/interactive/components/model-selector.js.map +1 -1
  1064. package/dist/modes/interactive/components/session-selector-delete.d.ts +10 -0
  1065. package/dist/modes/interactive/components/session-selector-delete.d.ts.map +1 -0
  1066. package/dist/modes/interactive/components/session-selector-delete.js +40 -0
  1067. package/dist/modes/interactive/components/session-selector-delete.js.map +1 -0
  1068. package/dist/modes/interactive/components/session-selector-header.d.ts +33 -0
  1069. package/dist/modes/interactive/components/session-selector-header.d.ts.map +1 -0
  1070. package/dist/modes/interactive/components/session-selector-header.js +117 -0
  1071. package/dist/modes/interactive/components/session-selector-header.js.map +1 -0
  1072. package/dist/modes/interactive/components/session-selector-list.d.ts +49 -0
  1073. package/dist/modes/interactive/components/session-selector-list.d.ts.map +1 -0
  1074. package/dist/modes/interactive/components/session-selector-list.js +307 -0
  1075. package/dist/modes/interactive/components/session-selector-list.js.map +1 -0
  1076. package/dist/modes/interactive/components/session-selector-tree.d.ts +25 -0
  1077. package/dist/modes/interactive/components/session-selector-tree.d.ts.map +1 -0
  1078. package/dist/modes/interactive/components/session-selector-tree.js +53 -0
  1079. package/dist/modes/interactive/components/session-selector-tree.js.map +1 -0
  1080. package/dist/modes/interactive/components/session-selector-types.d.ts +4 -0
  1081. package/dist/modes/interactive/components/session-selector-types.d.ts.map +1 -0
  1082. package/dist/modes/interactive/components/session-selector-types.js +2 -0
  1083. package/dist/modes/interactive/components/session-selector-types.js.map +1 -0
  1084. package/dist/modes/interactive/components/session-selector-utils.d.ts +4 -0
  1085. package/dist/modes/interactive/components/session-selector-utils.d.ts.map +1 -0
  1086. package/dist/modes/interactive/components/session-selector-utils.js +37 -0
  1087. package/dist/modes/interactive/components/session-selector-utils.js.map +1 -0
  1088. package/dist/modes/interactive/components/session-selector.d.ts +3 -49
  1089. package/dist/modes/interactive/components/session-selector.d.ts.map +1 -1
  1090. package/dist/modes/interactive/components/session-selector.js +5 -542
  1091. package/dist/modes/interactive/components/session-selector.js.map +1 -1
  1092. package/dist/modes/interactive/components/settings-selector-handlers.d.ts +3 -0
  1093. package/dist/modes/interactive/components/settings-selector-handlers.d.ts.map +1 -0
  1094. package/dist/modes/interactive/components/settings-selector-handlers.js +84 -0
  1095. package/dist/modes/interactive/components/settings-selector-handlers.js.map +1 -0
  1096. package/dist/modes/interactive/components/settings-selector-items.d.ts +4 -0
  1097. package/dist/modes/interactive/components/settings-selector-items.d.ts.map +1 -0
  1098. package/dist/modes/interactive/components/settings-selector-items.js +211 -0
  1099. package/dist/modes/interactive/components/settings-selector-items.js.map +1 -0
  1100. package/dist/modes/interactive/components/settings-selector-options.d.ts +6 -0
  1101. package/dist/modes/interactive/components/settings-selector-options.d.ts.map +1 -0
  1102. package/dist/modes/interactive/components/settings-selector-options.js +14 -0
  1103. package/dist/modes/interactive/components/settings-selector-options.js.map +1 -0
  1104. package/dist/modes/interactive/components/settings-selector-submenus.d.ts +44 -0
  1105. package/dist/modes/interactive/components/settings-selector-submenus.d.ts.map +1 -0
  1106. package/dist/modes/interactive/components/settings-selector-submenus.js +228 -0
  1107. package/dist/modes/interactive/components/settings-selector-submenus.js.map +1 -0
  1108. package/dist/modes/interactive/components/settings-selector-types.d.ts +67 -0
  1109. package/dist/modes/interactive/components/settings-selector-types.d.ts.map +1 -0
  1110. package/dist/modes/interactive/components/settings-selector-types.js +2 -0
  1111. package/dist/modes/interactive/components/settings-selector-types.js.map +1 -0
  1112. package/dist/modes/interactive/components/settings-selector.d.ts +2 -63
  1113. package/dist/modes/interactive/components/settings-selector.d.ts.map +1 -1
  1114. package/dist/modes/interactive/components/settings-selector.js +5 -538
  1115. package/dist/modes/interactive/components/settings-selector.js.map +1 -1
  1116. package/dist/modes/interactive/components/tree-selector-component.d.ts +21 -0
  1117. package/dist/modes/interactive/components/tree-selector-component.d.ts.map +1 -0
  1118. package/dist/modes/interactive/components/tree-selector-component.js +80 -0
  1119. package/dist/modes/interactive/components/tree-selector-component.js.map +1 -0
  1120. package/dist/modes/interactive/components/tree-selector-content.d.ts +8 -0
  1121. package/dist/modes/interactive/components/tree-selector-content.d.ts.map +1 -0
  1122. package/dist/modes/interactive/components/tree-selector-content.js +263 -0
  1123. package/dist/modes/interactive/components/tree-selector-content.js.map +1 -0
  1124. package/dist/modes/interactive/components/tree-selector-help.d.ts +16 -0
  1125. package/dist/modes/interactive/components/tree-selector-help.d.ts.map +1 -0
  1126. package/dist/modes/interactive/components/tree-selector-help.js +103 -0
  1127. package/dist/modes/interactive/components/tree-selector-help.js.map +1 -0
  1128. package/dist/modes/interactive/components/tree-selector-label-input.d.ts +16 -0
  1129. package/dist/modes/interactive/components/tree-selector-label-input.d.ts.map +1 -0
  1130. package/dist/modes/interactive/components/tree-selector-label-input.js +46 -0
  1131. package/dist/modes/interactive/components/tree-selector-label-input.js.map +1 -0
  1132. package/dist/modes/interactive/components/tree-selector-list.d.ts +33 -0
  1133. package/dist/modes/interactive/components/tree-selector-list.d.ts.map +1 -0
  1134. package/dist/modes/interactive/components/tree-selector-list.js +336 -0
  1135. package/dist/modes/interactive/components/tree-selector-list.js.map +1 -0
  1136. package/dist/modes/interactive/components/tree-selector-model.d.ts +7 -0
  1137. package/dist/modes/interactive/components/tree-selector-model.d.ts.map +1 -0
  1138. package/dist/modes/interactive/components/tree-selector-model.js +358 -0
  1139. package/dist/modes/interactive/components/tree-selector-model.js.map +1 -0
  1140. package/dist/modes/interactive/components/tree-selector-types.d.ts +57 -0
  1141. package/dist/modes/interactive/components/tree-selector-types.d.ts.map +1 -0
  1142. package/dist/modes/interactive/components/tree-selector-types.js +6 -0
  1143. package/dist/modes/interactive/components/tree-selector-types.js.map +1 -0
  1144. package/dist/modes/interactive/components/tree-selector-viewport.d.ts +10 -0
  1145. package/dist/modes/interactive/components/tree-selector-viewport.d.ts.map +1 -0
  1146. package/dist/modes/interactive/components/tree-selector-viewport.js +32 -0
  1147. package/dist/modes/interactive/components/tree-selector-viewport.js.map +1 -0
  1148. package/dist/modes/interactive/components/tree-selector.d.ts +2 -88
  1149. package/dist/modes/interactive/components/tree-selector.d.ts.map +1 -1
  1150. package/dist/modes/interactive/components/tree-selector.js +1 -1200
  1151. package/dist/modes/interactive/components/tree-selector.js.map +1 -1
  1152. package/dist/modes/interactive/interactive-agent-events.d.ts +2 -0
  1153. package/dist/modes/interactive/interactive-agent-events.d.ts.map +1 -0
  1154. package/dist/modes/interactive/interactive-agent-events.js +370 -0
  1155. package/dist/modes/interactive/interactive-agent-events.js.map +1 -0
  1156. package/dist/modes/interactive/interactive-auth-login.d.ts +2 -0
  1157. package/dist/modes/interactive/interactive-auth-login.d.ts.map +1 -0
  1158. package/dist/modes/interactive/interactive-auth-login.js +214 -0
  1159. package/dist/modes/interactive/interactive-auth-login.js.map +1 -0
  1160. package/dist/modes/interactive/interactive-auth-routing.d.ts +2 -0
  1161. package/dist/modes/interactive/interactive-auth-routing.d.ts.map +1 -0
  1162. package/dist/modes/interactive/interactive-auth-routing.js +128 -0
  1163. package/dist/modes/interactive/interactive-auth-routing.js.map +1 -0
  1164. package/dist/modes/interactive/interactive-autocomplete.d.ts +2 -0
  1165. package/dist/modes/interactive/interactive-autocomplete.d.ts.map +1 -0
  1166. package/dist/modes/interactive/interactive-autocomplete.js +140 -0
  1167. package/dist/modes/interactive/interactive-autocomplete.js.map +1 -0
  1168. package/dist/modes/interactive/interactive-bash-compact.d.ts +2 -0
  1169. package/dist/modes/interactive/interactive-bash-compact.d.ts.map +1 -0
  1170. package/dist/modes/interactive/interactive-bash-compact.js +112 -0
  1171. package/dist/modes/interactive/interactive-bash-compact.js.map +1 -0
  1172. package/dist/modes/interactive/interactive-editor-actions.d.ts +2 -0
  1173. package/dist/modes/interactive/interactive-editor-actions.d.ts.map +1 -0
  1174. package/dist/modes/interactive/interactive-editor-actions.js +131 -0
  1175. package/dist/modes/interactive/interactive-editor-actions.js.map +1 -0
  1176. package/dist/modes/interactive/interactive-extension-context.d.ts +2 -0
  1177. package/dist/modes/interactive/interactive-extension-context.d.ts.map +1 -0
  1178. package/dist/modes/interactive/interactive-extension-context.js +159 -0
  1179. package/dist/modes/interactive/interactive-extension-context.js.map +1 -0
  1180. package/dist/modes/interactive/interactive-extension-custom-ui.d.ts +2 -0
  1181. package/dist/modes/interactive/interactive-extension-custom-ui.d.ts.map +1 -0
  1182. package/dist/modes/interactive/interactive-extension-custom-ui.js +208 -0
  1183. package/dist/modes/interactive/interactive-extension-custom-ui.js.map +1 -0
  1184. package/dist/modes/interactive/interactive-extension-dialogs.d.ts +2 -0
  1185. package/dist/modes/interactive/interactive-extension-dialogs.d.ts.map +1 -0
  1186. package/dist/modes/interactive/interactive-extension-dialogs.js +162 -0
  1187. package/dist/modes/interactive/interactive-extension-dialogs.js.map +1 -0
  1188. package/dist/modes/interactive/interactive-extension-runtime.d.ts +2 -0
  1189. package/dist/modes/interactive/interactive-extension-runtime.d.ts.map +1 -0
  1190. package/dist/modes/interactive/interactive-extension-runtime.js +179 -0
  1191. package/dist/modes/interactive/interactive-extension-runtime.js.map +1 -0
  1192. package/dist/modes/interactive/interactive-extension-widgets.d.ts +2 -0
  1193. package/dist/modes/interactive/interactive-extension-widgets.d.ts.map +1 -0
  1194. package/dist/modes/interactive/interactive-extension-widgets.js +113 -0
  1195. package/dist/modes/interactive/interactive-extension-widgets.js.map +1 -0
  1196. package/dist/modes/interactive/interactive-hotkeys-debug.d.ts +2 -0
  1197. package/dist/modes/interactive/interactive-hotkeys-debug.d.ts.map +1 -0
  1198. package/dist/modes/interactive/interactive-hotkeys-debug.js +186 -0
  1199. package/dist/modes/interactive/interactive-hotkeys-debug.js.map +1 -0
  1200. package/dist/modes/interactive/interactive-input-handling.d.ts +2 -0
  1201. package/dist/modes/interactive/interactive-input-handling.d.ts.map +1 -0
  1202. package/dist/modes/interactive/interactive-input-handling.js +275 -0
  1203. package/dist/modes/interactive/interactive-input-handling.js.map +1 -0
  1204. package/dist/modes/interactive/interactive-mode-base.d.ts +103 -0
  1205. package/dist/modes/interactive/interactive-mode-base.d.ts.map +1 -0
  1206. package/dist/modes/interactive/interactive-mode-base.js +130 -0
  1207. package/dist/modes/interactive/interactive-mode-base.js.map +1 -0
  1208. package/dist/modes/interactive/interactive-mode-deps.d.ts +81 -0
  1209. package/dist/modes/interactive/interactive-mode-deps.d.ts.map +1 -0
  1210. package/dist/modes/interactive/interactive-mode-deps.js +74 -0
  1211. package/dist/modes/interactive/interactive-mode-deps.js.map +1 -0
  1212. package/dist/modes/interactive/interactive-mode-helpers.d.ts +21 -0
  1213. package/dist/modes/interactive/interactive-mode-helpers.d.ts.map +1 -0
  1214. package/dist/modes/interactive/interactive-mode-helpers.js +77 -0
  1215. package/dist/modes/interactive/interactive-mode-helpers.js.map +1 -0
  1216. package/dist/modes/interactive/interactive-mode-surface.d.ts +313 -0
  1217. package/dist/modes/interactive/interactive-mode-surface.d.ts.map +1 -0
  1218. package/dist/modes/interactive/interactive-mode-surface.js +2 -0
  1219. package/dist/modes/interactive/interactive-mode-surface.js.map +1 -0
  1220. package/dist/modes/interactive/interactive-mode-types.d.ts +29 -0
  1221. package/dist/modes/interactive/interactive-mode-types.d.ts.map +1 -0
  1222. package/dist/modes/interactive/interactive-mode-types.js +2 -0
  1223. package/dist/modes/interactive/interactive-mode-types.js.map +1 -0
  1224. package/dist/modes/interactive/interactive-mode.d.ts +30 -404
  1225. package/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
  1226. package/dist/modes/interactive/interactive-mode.js +29 -5260
  1227. package/dist/modes/interactive/interactive-mode.js.map +1 -1
  1228. package/dist/modes/interactive/interactive-model-routing.d.ts +2 -0
  1229. package/dist/modes/interactive/interactive-model-routing.d.ts.map +1 -0
  1230. package/dist/modes/interactive/interactive-model-routing.js +269 -0
  1231. package/dist/modes/interactive/interactive-model-routing.js.map +1 -0
  1232. package/dist/modes/interactive/interactive-process-lifecycle.d.ts +2 -0
  1233. package/dist/modes/interactive/interactive-process-lifecycle.d.ts.map +1 -0
  1234. package/dist/modes/interactive/interactive-process-lifecycle.js +189 -0
  1235. package/dist/modes/interactive/interactive-process-lifecycle.js.map +1 -0
  1236. package/dist/modes/interactive/interactive-queueing.d.ts +2 -0
  1237. package/dist/modes/interactive/interactive-queueing.d.ts.map +1 -0
  1238. package/dist/modes/interactive/interactive-queueing.js +163 -0
  1239. package/dist/modes/interactive/interactive-queueing.js.map +1 -0
  1240. package/dist/modes/interactive/interactive-render-chat.d.ts +2 -0
  1241. package/dist/modes/interactive/interactive-render-chat.d.ts.map +1 -0
  1242. package/dist/modes/interactive/interactive-render-chat.js +170 -0
  1243. package/dist/modes/interactive/interactive-render-chat.js.map +1 -0
  1244. package/dist/modes/interactive/interactive-resource-disclosure.d.ts +2 -0
  1245. package/dist/modes/interactive/interactive-resource-disclosure.d.ts.map +1 -0
  1246. package/dist/modes/interactive/interactive-resource-disclosure.js +101 -0
  1247. package/dist/modes/interactive/interactive-resource-disclosure.js.map +1 -0
  1248. package/dist/modes/interactive/interactive-resource-paths.d.ts +2 -0
  1249. package/dist/modes/interactive/interactive-resource-paths.d.ts.map +1 -0
  1250. package/dist/modes/interactive/interactive-resource-paths.js +228 -0
  1251. package/dist/modes/interactive/interactive-resource-paths.js.map +1 -0
  1252. package/dist/modes/interactive/interactive-resource-rendering.d.ts +2 -0
  1253. package/dist/modes/interactive/interactive-resource-rendering.d.ts.map +1 -0
  1254. package/dist/modes/interactive/interactive-resource-rendering.js +181 -0
  1255. package/dist/modes/interactive/interactive-resource-rendering.js.map +1 -0
  1256. package/dist/modes/interactive/interactive-selectors.d.ts +2 -0
  1257. package/dist/modes/interactive/interactive-selectors.d.ts.map +1 -0
  1258. package/dist/modes/interactive/interactive-selectors.js +198 -0
  1259. package/dist/modes/interactive/interactive-selectors.js.map +1 -0
  1260. package/dist/modes/interactive/interactive-session-routing.d.ts +2 -0
  1261. package/dist/modes/interactive/interactive-session-routing.d.ts.map +1 -0
  1262. package/dist/modes/interactive/interactive-session-routing.js +232 -0
  1263. package/dist/modes/interactive/interactive-session-routing.js.map +1 -0
  1264. package/dist/modes/interactive/interactive-session-runtime.d.ts +2 -0
  1265. package/dist/modes/interactive/interactive-session-runtime.d.ts.map +1 -0
  1266. package/dist/modes/interactive/interactive-session-runtime.js +131 -0
  1267. package/dist/modes/interactive/interactive-session-runtime.js.map +1 -0
  1268. package/dist/modes/interactive/interactive-slash-commands.d.ts +2 -0
  1269. package/dist/modes/interactive/interactive-slash-commands.d.ts.map +1 -0
  1270. package/dist/modes/interactive/interactive-slash-commands.js +338 -0
  1271. package/dist/modes/interactive/interactive-slash-commands.js.map +1 -0
  1272. package/dist/modes/interactive/interactive-startup.d.ts +2 -0
  1273. package/dist/modes/interactive/interactive-startup.d.ts.map +1 -0
  1274. package/dist/modes/interactive/interactive-startup.js +348 -0
  1275. package/dist/modes/interactive/interactive-startup.js.map +1 -0
  1276. package/dist/modes/interactive/model-search.d.ts +5 -0
  1277. package/dist/modes/interactive/model-search.d.ts.map +1 -1
  1278. package/dist/modes/interactive/model-search.js +9 -0
  1279. package/dist/modes/interactive/model-search.js.map +1 -1
  1280. package/dist/modes/interactive/theme/color-utils.d.ts +20 -0
  1281. package/dist/modes/interactive/theme/color-utils.d.ts.map +1 -0
  1282. package/dist/modes/interactive/theme/color-utils.js +204 -0
  1283. package/dist/modes/interactive/theme/color-utils.js.map +1 -0
  1284. package/dist/modes/interactive/theme/export-colors.d.ts +19 -0
  1285. package/dist/modes/interactive/theme/export-colors.d.ts.map +1 -0
  1286. package/dist/modes/interactive/theme/export-colors.js +69 -0
  1287. package/dist/modes/interactive/theme/export-colors.js.map +1 -0
  1288. package/dist/modes/interactive/theme/global-theme.d.ts +12 -0
  1289. package/dist/modes/interactive/theme/global-theme.d.ts.map +1 -0
  1290. package/dist/modes/interactive/theme/global-theme.js +150 -0
  1291. package/dist/modes/interactive/theme/global-theme.js.map +1 -0
  1292. package/dist/modes/interactive/theme/terminal-detection.d.ts +30 -0
  1293. package/dist/modes/interactive/theme/terminal-detection.d.ts.map +1 -0
  1294. package/dist/modes/interactive/theme/terminal-detection.js +89 -0
  1295. package/dist/modes/interactive/theme/terminal-detection.js.map +1 -0
  1296. package/dist/modes/interactive/theme/theme-class.d.ts +30 -0
  1297. package/dist/modes/interactive/theme/theme-class.d.ts.map +1 -0
  1298. package/dist/modes/interactive/theme/theme-class.js +83 -0
  1299. package/dist/modes/interactive/theme/theme-class.js.map +1 -0
  1300. package/dist/modes/interactive/theme/theme-loading.d.ts +17 -0
  1301. package/dist/modes/interactive/theme/theme-loading.d.ts.map +1 -0
  1302. package/dist/modes/interactive/theme/theme-loading.js +155 -0
  1303. package/dist/modes/interactive/theme/theme-loading.js.map +1 -0
  1304. package/dist/modes/interactive/theme/theme-parse.d.ts +5 -0
  1305. package/dist/modes/interactive/theme/theme-parse.d.ts.map +1 -0
  1306. package/dist/modes/interactive/theme/theme-parse.js +52 -0
  1307. package/dist/modes/interactive/theme/theme-parse.js.map +1 -0
  1308. package/dist/modes/interactive/theme/theme-schema.d.ts +255 -0
  1309. package/dist/modes/interactive/theme/theme-schema.d.ts.map +1 -0
  1310. package/dist/modes/interactive/theme/theme-schema.js +78 -0
  1311. package/dist/modes/interactive/theme/theme-schema.js.map +1 -0
  1312. package/dist/modes/interactive/theme/theme.d.ts +6 -108
  1313. package/dist/modes/interactive/theme/theme.d.ts.map +1 -1
  1314. package/dist/modes/interactive/theme/theme.js +6 -1065
  1315. package/dist/modes/interactive/theme/theme.js.map +1 -1
  1316. package/dist/modes/interactive/theme/tui-theme.d.ts +15 -0
  1317. package/dist/modes/interactive/theme/tui-theme.d.ts.map +1 -0
  1318. package/dist/modes/interactive/theme/tui-theme.js +199 -0
  1319. package/dist/modes/interactive/theme/tui-theme.js.map +1 -0
  1320. package/dist/modes/rpc/rpc-client.d.ts +1 -61
  1321. package/dist/modes/rpc/rpc-client.d.ts.map +1 -1
  1322. package/dist/modes/rpc/rpc-client.js +1 -72
  1323. package/dist/modes/rpc/rpc-client.js.map +1 -1
  1324. package/dist/modes/rpc/rpc-command-handler.d.ts +14 -0
  1325. package/dist/modes/rpc/rpc-command-handler.d.ts.map +1 -0
  1326. package/dist/modes/rpc/rpc-command-handler.js +226 -0
  1327. package/dist/modes/rpc/rpc-command-handler.js.map +1 -0
  1328. package/dist/modes/rpc/rpc-extension-ui.d.ts +15 -0
  1329. package/dist/modes/rpc/rpc-extension-ui.d.ts.map +1 -0
  1330. package/dist/modes/rpc/rpc-extension-ui.js +196 -0
  1331. package/dist/modes/rpc/rpc-extension-ui.js.map +1 -0
  1332. package/dist/modes/rpc/rpc-input.d.ts +12 -0
  1333. package/dist/modes/rpc/rpc-input.d.ts.map +1 -0
  1334. package/dist/modes/rpc/rpc-input.js +54 -0
  1335. package/dist/modes/rpc/rpc-input.js.map +1 -0
  1336. package/dist/modes/rpc/rpc-mode.d.ts.map +1 -1
  1337. package/dist/modes/rpc/rpc-mode.js +43 -607
  1338. package/dist/modes/rpc/rpc-mode.js.map +1 -1
  1339. package/dist/modes/rpc/rpc-responses.d.ts +8 -0
  1340. package/dist/modes/rpc/rpc-responses.d.ts.map +1 -0
  1341. package/dist/modes/rpc/rpc-responses.js +27 -0
  1342. package/dist/modes/rpc/rpc-responses.js.map +1 -0
  1343. package/dist/modes/rpc/rpc-session-binding.d.ts +25 -0
  1344. package/dist/modes/rpc/rpc-session-binding.d.ts.map +1 -0
  1345. package/dist/modes/rpc/rpc-session-binding.js +70 -0
  1346. package/dist/modes/rpc/rpc-session-binding.js.map +1 -0
  1347. package/dist/package-manager-cli-parser.d.ts +28 -0
  1348. package/dist/package-manager-cli-parser.d.ts.map +1 -0
  1349. package/dist/package-manager-cli-parser.js +269 -0
  1350. package/dist/package-manager-cli-parser.js.map +1 -0
  1351. package/dist/package-manager-cli.d.ts +0 -1
  1352. package/dist/package-manager-cli.d.ts.map +1 -1
  1353. package/dist/package-manager-cli.js +2 -267
  1354. package/dist/package-manager-cli.js.map +1 -1
  1355. package/dist/utils/git.d.ts.map +1 -1
  1356. package/dist/utils/git.js +10 -0
  1357. package/dist/utils/git.js.map +1 -1
  1358. package/dist/utils/shell.d.ts +1 -0
  1359. package/dist/utils/shell.d.ts.map +1 -1
  1360. package/dist/utils/shell.js +12 -5
  1361. package/dist/utils/shell.js.map +1 -1
  1362. package/dist/utils/version-check.d.ts +1 -0
  1363. package/dist/utils/version-check.d.ts.map +1 -1
  1364. package/dist/utils/version-check.js +17 -0
  1365. package/dist/utils/version-check.js.map +1 -1
  1366. package/docs/custom-provider.md +4 -3
  1367. package/docs/development.md +4 -0
  1368. package/docs/models.md +3 -2
  1369. package/docs/packages.md +2 -2
  1370. package/docs/quickstart.md +1 -1
  1371. package/docs/sdk.md +2 -40
  1372. package/docs/security.md +1 -1
  1373. package/docs/workflows.md +246 -179
  1374. package/examples/extensions/custom-provider-anthropic/index.ts +1 -106
  1375. package/examples/extensions/gondolin/index.ts +0 -23
  1376. package/examples/extensions/overlay-qa-animation-components.ts +255 -0
  1377. package/examples/extensions/overlay-qa-focus-components.ts +222 -0
  1378. package/examples/extensions/overlay-qa-position-components.ts +433 -0
  1379. package/examples/extensions/overlay-qa-shared.ts +37 -0
  1380. package/examples/extensions/overlay-qa-streaming-input-components.ts +205 -0
  1381. package/examples/extensions/overlay-qa-tests.ts +17 -1156
  1382. package/examples/extensions/overlay-qa-toggle-passive-components.ts +169 -0
  1383. package/examples/extensions/space-invaders.ts +0 -60
  1384. package/examples/extensions/subagent/display.ts +148 -0
  1385. package/examples/extensions/subagent/index.ts +11 -858
  1386. package/examples/extensions/subagent/render.ts +383 -0
  1387. package/examples/extensions/subagent/runner.ts +252 -0
  1388. package/examples/extensions/subagent/schemas.ts +59 -0
  1389. package/examples/extensions/subagent/types.ts +36 -0
  1390. package/examples/extensions/tic-tac-toe-instructions.ts +65 -0
  1391. package/examples/extensions/tic-tac-toe-rendering.ts +414 -0
  1392. package/examples/extensions/tic-tac-toe-state.ts +158 -0
  1393. package/examples/extensions/tic-tac-toe.ts +92 -754
  1394. package/examples/rpc-extension-ui-components.ts +189 -0
  1395. package/examples/rpc-extension-ui.ts +2 -179
  1396. package/package.json +7 -7
  1397. package/dist/builtin/workflows/src/workflows/define-workflow.ts +0 -277
  1398. package/dist/core/tools/bash-policy.d.ts +0 -62
  1399. package/dist/core/tools/bash-policy.d.ts.map +0 -1
  1400. package/dist/core/tools/bash-policy.js +0 -1069
  1401. package/dist/core/tools/bash-policy.js.map +0 -1
@@ -0,0 +1,28 @@
1
+ import type { ChatMessageEntry } from "./chat-message-renderer.ts";
2
+ import type { ChatTranscriptEntryLike } from "./chat-transcript.ts";
3
+ import type { CacheKeyPart, ChatSessionHostEntry } from "./chat-session-host-types.ts";
4
+ export declare const SPINNER_FRAMES: string[];
5
+ export declare const ANIMATION_FRAME_MS = 80;
6
+ export declare const STREAMING_RENDER_THROTTLE_MS = 80;
7
+ export declare function matchesKey(data: string, key: "enter" | "backspace" | "escape" | "ctrl+f" | "alt+up"): boolean;
8
+ export declare function parseBashInput(text: string): {
9
+ command: string;
10
+ excludeFromContext: boolean;
11
+ } | undefined;
12
+ export declare function cacheKey(parts: readonly CacheKeyPart[]): string;
13
+ export declare function isChatMessageEntry<TExtraEntry extends ChatTranscriptEntryLike>(entry: ChatSessionHostEntry<TExtraEntry>): entry is ChatMessageEntry;
14
+ export declare function isMessageLike(message: unknown): message is {
15
+ role?: unknown;
16
+ content?: unknown;
17
+ };
18
+ export declare function isUserMessageLike(message: unknown): message is {
19
+ role: "user";
20
+ content?: unknown;
21
+ };
22
+ export declare function userMessageSignature(text: string): string;
23
+ export declare function extractMessageText(content: unknown): string;
24
+ export declare function tailStreamingText(text: string): string;
25
+ export declare function spinnerFrame(): string;
26
+ export declare function stripAnsi(s: string): string;
27
+ export declare function errorMessage(error: unknown): string;
28
+ //# sourceMappingURL=chat-session-host-utils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"chat-session-host-utils.d.ts","sourceRoot":"","sources":["../../../../src/modes/interactive/components/chat-session-host-utils.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AACnE,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,sBAAsB,CAAC;AACpE,OAAO,KAAK,EACV,YAAY,EACZ,oBAAoB,EACrB,MAAM,8BAA8B,CAAC;AAEtC,eAAO,MAAM,cAAc,UAAqD,CAAC;AACjF,eAAO,MAAM,kBAAkB,KAAK,CAAC;AACrC,eAAO,MAAM,4BAA4B,KAAK,CAAC;AAI/C,wBAAgB,UAAU,CACxB,IAAI,EAAE,MAAM,EACZ,GAAG,EAAE,OAAO,GAAG,WAAW,GAAG,QAAQ,GAAG,QAAQ,GAAG,QAAQ,GAC1D,OAAO,CAMT;AAED,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,GACvC;IAAE,OAAO,EAAE,MAAM,CAAC;IAAC,kBAAkB,EAAE,OAAO,CAAA;CAAE,GAChD,SAAS,CAKZ;AAED,wBAAgB,QAAQ,CAAC,KAAK,EAAE,SAAS,YAAY,EAAE,GAAG,MAAM,CAE/D;AAED,wBAAgB,kBAAkB,CAAC,WAAW,SAAS,uBAAuB,EAC5E,KAAK,EAAE,oBAAoB,CAAC,WAAW,CAAC,GACvC,KAAK,IAAI,gBAAgB,CAqB3B;AAED,wBAAgB,aAAa,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,IAAI;IAAE,IAAI,CAAC,EAAE,OAAO,CAAC;IAAC,OAAO,CAAC,EAAE,OAAO,CAAA;CAAE,CAEhG;AAED,wBAAgB,iBAAiB,CAC/B,OAAO,EAAE,OAAO,GACf,OAAO,IAAI;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,OAAO,CAAC,EAAE,OAAO,CAAA;CAAE,CAEhD;AAED,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAEzD;AAED,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,OAAO,GAAG,MAAM,CAe3D;AAED,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CActD;AAED,wBAAgB,YAAY,IAAI,MAAM,CAGrC;AAED,wBAAgB,SAAS,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM,CAE3C;AAED,wBAAgB,YAAY,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,CAEnD","sourcesContent":["import { matchesKey as tuiMatchesKey } from \"@earendil-works/pi-tui\";\nimport type { ChatMessageEntry } from \"./chat-message-renderer.ts\";\nimport type { ChatTranscriptEntryLike } from \"./chat-transcript.ts\";\nimport type {\n CacheKeyPart,\n ChatSessionHostEntry,\n} from \"./chat-session-host-types.ts\";\n\nexport const SPINNER_FRAMES = [\"⠋\", \"⠙\", \"⠹\", \"⠸\", \"⠼\", \"⠴\", \"⠦\", \"⠧\", \"⠇\", \"⠏\"];\nexport const ANIMATION_FRAME_MS = 80;\nexport const STREAMING_RENDER_THROTTLE_MS = 80;\nconst STREAMING_TEXT_TAIL_LINES = 240;\nconst STREAMING_TEXT_TAIL_CHARS = 16_000;\n\nexport function matchesKey(\n data: string,\n key: \"enter\" | \"backspace\" | \"escape\" | \"ctrl+f\" | \"alt+up\",\n): boolean {\n if (key === \"enter\" && (data === \"\\r\" || data === \"\\n\")) return true;\n if (key === \"backspace\" && (data === \"\\x7f\" || data === \"\\b\")) return true;\n if (key === \"escape\" && data === \"\\x1b\") return true;\n if (key === \"ctrl+f\" && data === \"\\x06\") return true;\n return tuiMatchesKey(data, key);\n}\n\nexport function parseBashInput(text: string):\n | { command: string; excludeFromContext: boolean }\n | undefined {\n if (!text.startsWith(\"!\")) return undefined;\n const excludeFromContext = text.startsWith(\"!!\");\n const command = text.slice(excludeFromContext ? 2 : 1).trim();\n return { command, excludeFromContext };\n}\n\nexport function cacheKey(parts: readonly CacheKeyPart[]): string {\n return JSON.stringify(parts);\n}\n\nexport function isChatMessageEntry<TExtraEntry extends ChatTranscriptEntryLike>(\n entry: ChatSessionHostEntry<TExtraEntry>,\n): entry is ChatMessageEntry {\n if (!(\"role\" in entry) || !(\"kind\" in entry)) return false;\n const candidate = entry as { role?: unknown; kind?: unknown; message?: unknown; text?: unknown };\n switch (candidate.kind) {\n case \"assistant\":\n return candidate.role === \"assistant\" && candidate.message !== undefined;\n case \"tool\":\n return candidate.role === \"tool\" && \"toolName\" in candidate && \"toolCallId\" in candidate && \"args\" in candidate;\n case \"bashExecution\":\n return candidate.role === \"tool\" && candidate.message !== undefined;\n case \"user\":\n return candidate.role === \"user\" && typeof candidate.text === \"string\";\n case \"custom\":\n return candidate.role === \"custom\" && candidate.message !== undefined;\n case \"branchSummary\":\n return candidate.role === \"summary\" && candidate.message !== undefined;\n case \"system\":\n return candidate.role === \"system\" && candidate.message !== undefined;\n default:\n return false;\n }\n}\n\nexport function isMessageLike(message: unknown): message is { role?: unknown; content?: unknown } {\n return message !== null && typeof message === \"object\" && \"role\" in message;\n}\n\nexport function isUserMessageLike(\n message: unknown,\n): message is { role: \"user\"; content?: unknown } {\n return isMessageLike(message) && message.role === \"user\";\n}\n\nexport function userMessageSignature(text: string): string {\n return text.trim();\n}\n\nexport function extractMessageText(content: unknown): string {\n if (typeof content === \"string\") return content;\n if (!Array.isArray(content)) return \"\";\n const parts: string[] = [];\n for (const item of content) {\n if (item == null) continue;\n if (typeof item === \"string\") {\n parts.push(item);\n continue;\n }\n const obj = item as { type?: unknown; text?: unknown };\n if (typeof obj.text === \"string\") parts.push(obj.text);\n else if (obj.type === \"text\" && typeof obj.text === \"string\") parts.push(obj.text);\n }\n return parts.join(\"\");\n}\n\nexport function tailStreamingText(text: string): string {\n if (\n text.length <= STREAMING_TEXT_TAIL_CHARS &&\n text.split(\"\\n\").length <= STREAMING_TEXT_TAIL_LINES\n ) {\n return text;\n }\n const byChars = text.slice(-STREAMING_TEXT_TAIL_CHARS);\n const lines = byChars.split(\"\\n\");\n const tail =\n lines.length > STREAMING_TEXT_TAIL_LINES\n ? lines.slice(-STREAMING_TEXT_TAIL_LINES).join(\"\\n\")\n : byChars;\n return `[earlier streaming output hidden while attached]\\n\\n${tail.trimStart()}`;\n}\n\nexport function spinnerFrame(): string {\n const idx = Math.floor(Date.now() / ANIMATION_FRAME_MS) % SPINNER_FRAMES.length;\n return SPINNER_FRAMES[idx]!;\n}\n\nexport function stripAnsi(s: string): string {\n return s.replace(/\\x1B\\[[0-?]*[ -/]*[@-~]/g, \"\");\n}\n\nexport function errorMessage(error: unknown): string {\n return error instanceof Error ? error.message : String(error);\n}\n"]}
@@ -0,0 +1,103 @@
1
+ import { matchesKey as tuiMatchesKey } from "@earendil-works/pi-tui";
2
+ export const SPINNER_FRAMES = ["⠋", "⠙", "⠹", "⠸", "⠼", "⠴", "⠦", "⠧", "⠇", "⠏"];
3
+ export const ANIMATION_FRAME_MS = 80;
4
+ export const STREAMING_RENDER_THROTTLE_MS = 80;
5
+ const STREAMING_TEXT_TAIL_LINES = 240;
6
+ const STREAMING_TEXT_TAIL_CHARS = 16_000;
7
+ export function matchesKey(data, key) {
8
+ if (key === "enter" && (data === "\r" || data === "\n"))
9
+ return true;
10
+ if (key === "backspace" && (data === "\x7f" || data === "\b"))
11
+ return true;
12
+ if (key === "escape" && data === "\x1b")
13
+ return true;
14
+ if (key === "ctrl+f" && data === "\x06")
15
+ return true;
16
+ return tuiMatchesKey(data, key);
17
+ }
18
+ export function parseBashInput(text) {
19
+ if (!text.startsWith("!"))
20
+ return undefined;
21
+ const excludeFromContext = text.startsWith("!!");
22
+ const command = text.slice(excludeFromContext ? 2 : 1).trim();
23
+ return { command, excludeFromContext };
24
+ }
25
+ export function cacheKey(parts) {
26
+ return JSON.stringify(parts);
27
+ }
28
+ export function isChatMessageEntry(entry) {
29
+ if (!("role" in entry) || !("kind" in entry))
30
+ return false;
31
+ const candidate = entry;
32
+ switch (candidate.kind) {
33
+ case "assistant":
34
+ return candidate.role === "assistant" && candidate.message !== undefined;
35
+ case "tool":
36
+ return candidate.role === "tool" && "toolName" in candidate && "toolCallId" in candidate && "args" in candidate;
37
+ case "bashExecution":
38
+ return candidate.role === "tool" && candidate.message !== undefined;
39
+ case "user":
40
+ return candidate.role === "user" && typeof candidate.text === "string";
41
+ case "custom":
42
+ return candidate.role === "custom" && candidate.message !== undefined;
43
+ case "branchSummary":
44
+ return candidate.role === "summary" && candidate.message !== undefined;
45
+ case "system":
46
+ return candidate.role === "system" && candidate.message !== undefined;
47
+ default:
48
+ return false;
49
+ }
50
+ }
51
+ export function isMessageLike(message) {
52
+ return message !== null && typeof message === "object" && "role" in message;
53
+ }
54
+ export function isUserMessageLike(message) {
55
+ return isMessageLike(message) && message.role === "user";
56
+ }
57
+ export function userMessageSignature(text) {
58
+ return text.trim();
59
+ }
60
+ export function extractMessageText(content) {
61
+ if (typeof content === "string")
62
+ return content;
63
+ if (!Array.isArray(content))
64
+ return "";
65
+ const parts = [];
66
+ for (const item of content) {
67
+ if (item == null)
68
+ continue;
69
+ if (typeof item === "string") {
70
+ parts.push(item);
71
+ continue;
72
+ }
73
+ const obj = item;
74
+ if (typeof obj.text === "string")
75
+ parts.push(obj.text);
76
+ else if (obj.type === "text" && typeof obj.text === "string")
77
+ parts.push(obj.text);
78
+ }
79
+ return parts.join("");
80
+ }
81
+ export function tailStreamingText(text) {
82
+ if (text.length <= STREAMING_TEXT_TAIL_CHARS &&
83
+ text.split("\n").length <= STREAMING_TEXT_TAIL_LINES) {
84
+ return text;
85
+ }
86
+ const byChars = text.slice(-STREAMING_TEXT_TAIL_CHARS);
87
+ const lines = byChars.split("\n");
88
+ const tail = lines.length > STREAMING_TEXT_TAIL_LINES
89
+ ? lines.slice(-STREAMING_TEXT_TAIL_LINES).join("\n")
90
+ : byChars;
91
+ return `[earlier streaming output hidden while attached]\n\n${tail.trimStart()}`;
92
+ }
93
+ export function spinnerFrame() {
94
+ const idx = Math.floor(Date.now() / ANIMATION_FRAME_MS) % SPINNER_FRAMES.length;
95
+ return SPINNER_FRAMES[idx];
96
+ }
97
+ export function stripAnsi(s) {
98
+ return s.replace(/\x1B\[[0-?]*[ -/]*[@-~]/g, "");
99
+ }
100
+ export function errorMessage(error) {
101
+ return error instanceof Error ? error.message : String(error);
102
+ }
103
+ //# sourceMappingURL=chat-session-host-utils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"chat-session-host-utils.js","sourceRoot":"","sources":["../../../../src/modes/interactive/components/chat-session-host-utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,IAAI,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAQrE,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,CAAC;AACjF,MAAM,CAAC,MA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C;IAClC,MAAM,IAAI,GACR,KAAK,CAAC,MAAM,GAAG,yBAAyB;QACtC,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,yBAAyB,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC;QACpD,CAAC,CAAC,OAAO,CAAC;IACd,OAAO,uDAAuD,IAAI,CAAC,SAAS,EAAE,EAAE,CAAC;AACnF,CAAC;AAED,MAAM,UAAU,YAAY;IAC1B,MAAM,GAAG,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,EAAE,GAAG,kBAAkB,CAAC,GAAG,cAAc,CAAC,MAAM,CAAC;IAChF,OAAO,cAAc,CAAC,GAAG,CAAE,CAAC;AAC9B,CAAC;AAED,MAAM,UAAU,SAAS,CAAC,CAAS;IACjC,OAAO,CAAC,CAAC,OAAO,CAAC,0BAA0B,EAAE,EAAE,CAAC,CAAC;AACnD,CAAC;AAED,MAAM,UAAU,YAAY,CAAC,KAAc;IACzC,OAAO,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;AAChE,CAAC","sourcesContent":["import { matchesKey as tuiMatchesKey } from \"@earendil-works/pi-tui\";\nimport type { ChatMessageEntry } from \"./chat-message-renderer.ts\";\nimport type { ChatTranscriptEntryLike } from \"./chat-transcript.ts\";\nimport type {\n CacheKeyPart,\n ChatSessionHostEntry,\n} from \"./chat-session-host-types.ts\";\n\nexport const SPINNER_FRAMES = [\"⠋\", \"⠙\", \"⠹\", \"⠸\", \"⠼\", \"⠴\", \"⠦\", \"⠧\", \"⠇\", \"⠏\"];\nexport const ANIMATION_FRAME_MS = 80;\nexport const STREAMING_RENDER_THROTTLE_MS = 80;\nconst STREAMING_TEXT_TAIL_LINES = 240;\nconst STREAMING_TEXT_TAIL_CHARS = 16_000;\n\nexport function matchesKey(\n data: string,\n key: \"enter\" | \"backspace\" | \"escape\" | \"ctrl+f\" | \"alt+up\",\n): boolean {\n if (key === \"enter\" && (data === \"\\r\" || data === \"\\n\")) return true;\n if (key === \"backspace\" && (data === \"\\x7f\" || data === \"\\b\")) return true;\n if (key === \"escape\" && data === \"\\x1b\") return true;\n if (key === \"ctrl+f\" && data === \"\\x06\") return true;\n return tuiMatchesKey(data, key);\n}\n\nexport function parseBashInput(text: string):\n | { command: string; excludeFromContext: boolean }\n | undefined {\n if (!text.startsWith(\"!\")) return undefined;\n const excludeFromContext = text.startsWith(\"!!\");\n const command = text.slice(excludeFromContext ? 2 : 1).trim();\n return { command, excludeFromContext };\n}\n\nexport function cacheKey(parts: readonly CacheKeyPart[]): string {\n return JSON.stringify(parts);\n}\n\nexport function isChatMessageEntry<TExtraEntry extends ChatTranscriptEntryLike>(\n entry: ChatSessionHostEntry<TExtraEntry>,\n): entry is ChatMessageEntry {\n if (!(\"role\" in entry) || !(\"kind\" in entry)) return false;\n const candidate = entry as { role?: unknown; kind?: unknown; message?: unknown; text?: unknown };\n switch (candidate.kind) {\n case \"assistant\":\n return candidate.role === \"assistant\" && candidate.message !== undefined;\n case \"tool\":\n return candidate.role === \"tool\" && \"toolName\" in candidate && \"toolCallId\" in candidate && \"args\" in candidate;\n case \"bashExecution\":\n return candidate.role === \"tool\" && candidate.message !== undefined;\n case \"user\":\n return candidate.role === \"user\" && typeof candidate.text === \"string\";\n case \"custom\":\n return candidate.role === \"custom\" && candidate.message !== undefined;\n case \"branchSummary\":\n return candidate.role === \"summary\" && candidate.message !== undefined;\n case \"system\":\n return candidate.role === \"system\" && candidate.message !== undefined;\n default:\n return false;\n }\n}\n\nexport function isMessageLike(message: unknown): message is { role?: unknown; content?: unknown } {\n return message !== null && typeof message === \"object\" && \"role\" in message;\n}\n\nexport function isUserMessageLike(\n message: unknown,\n): message is { role: \"user\"; content?: unknown } {\n return isMessageLike(message) && message.role === \"user\";\n}\n\nexport function userMessageSignature(text: string): string {\n return text.trim();\n}\n\nexport function extractMessageText(content: unknown): string {\n if (typeof content === \"string\") return content;\n if (!Array.isArray(content)) return \"\";\n const parts: string[] = [];\n for (const item of content) {\n if (item == null) continue;\n if (typeof item === \"string\") {\n parts.push(item);\n continue;\n }\n const obj = item as { type?: unknown; text?: unknown };\n if (typeof obj.text === \"string\") parts.push(obj.text);\n else if (obj.type === \"text\" && typeof obj.text === \"string\") parts.push(obj.text);\n }\n return parts.join(\"\");\n}\n\nexport function tailStreamingText(text: string): string {\n if (\n text.length <= STREAMING_TEXT_TAIL_CHARS &&\n text.split(\"\\n\").length <= STREAMING_TEXT_TAIL_LINES\n ) {\n return text;\n }\n const byChars = text.slice(-STREAMING_TEXT_TAIL_CHARS);\n const lines = byChars.split(\"\\n\");\n const tail =\n lines.length > STREAMING_TEXT_TAIL_LINES\n ? lines.slice(-STREAMING_TEXT_TAIL_LINES).join(\"\\n\")\n : byChars;\n return `[earlier streaming output hidden while attached]\\n\\n${tail.trimStart()}`;\n}\n\nexport function spinnerFrame(): string {\n const idx = Math.floor(Date.now() / ANIMATION_FRAME_MS) % SPINNER_FRAMES.length;\n return SPINNER_FRAMES[idx]!;\n}\n\nexport function stripAnsi(s: string): string {\n return s.replace(/\\x1B\\[[0-?]*[ -/]*[@-~]/g, \"\");\n}\n\nexport function errorMessage(error: unknown): string {\n return error instanceof Error ? error.message : String(error);\n}\n"]}
@@ -1,113 +1,16 @@
1
1
  import type { AgentSessionEvent } from "../../../core/agent-session.ts";
2
- import type { AgentSession } from "../../../core/agent-session.ts";
3
- import type { BashResult } from "../../../core/bash-executor.ts";
4
- import type { ReadonlyFooterDataProvider } from "../../../core/footer-data-provider.ts";
5
- import { type Component, type EditorComponent, type EditorTheme, type Focusable, type MarkdownTheme, type TUI } from "@earendil-works/pi-tui";
6
- import { type ChatMessageEntry, type ChatMessageRenderOptions } from "./chat-message-renderer.ts";
7
- import { type ChatTranscriptEntryLike } from "./chat-transcript.ts";
8
- export interface ChatSessionHostStyle {
9
- dim(text: string): string;
10
- text(text: string): string;
11
- textMuted(text: string): string;
12
- accent(text: string): string;
13
- accentBold(text: string): string;
14
- rule(hex: string, text: string): string;
15
- cursor(): string;
16
- blank(width: number): string;
17
- editorRuleColor(disabled: boolean, agentSession: AgentSession | undefined, state?: {
18
- isBashMode: boolean;
19
- }): string;
20
- }
21
- export interface ChatSessionHostBashRequest {
22
- command: string;
23
- excludeFromContext: boolean;
24
- onChunk: (chunk: string) => void;
25
- }
26
- export interface ChatSessionHostCommands {
27
- ensureAttached?: () => Promise<void>;
28
- prompt?: (text: string) => Promise<void>;
29
- steer?: (text: string) => Promise<void>;
30
- followUp?: (text: string) => Promise<void>;
31
- interrupt?: () => Promise<void>;
32
- resume?: (message?: string) => Promise<void>;
33
- runBash?: (request: ChatSessionHostBashRequest) => Promise<BashResult>;
34
- abortBash?: () => void | Promise<void>;
35
- abortCompaction?: () => void | Promise<void>;
36
- handleSlashCommand?: (text: string) => Promise<boolean> | boolean;
37
- }
38
- export interface ChatSessionHostOpts<TExtraEntry extends ChatTranscriptEntryLike = never> {
39
- style: ChatSessionHostStyle;
40
- commands?: ChatSessionHostCommands;
41
- requestRender?: () => void;
42
- getAgentSession?: () => AgentSession | undefined;
43
- isStreaming?: () => boolean;
44
- isPaused?: () => boolean;
45
- isDisabled?: () => boolean;
46
- isBashRunning?: () => boolean;
47
- showWarning?: (message: string) => void;
48
- showStatus?: (message: string) => void;
49
- actions?: Record<string, () => void | Promise<void>>;
50
- getActionKeyDisplay?: (action: string) => string;
51
- getMarkdownTheme?: () => MarkdownTheme;
52
- tui?: TUI;
53
- keybindings?: unknown;
54
- editorFactory?: (tui: TUI, theme: EditorTheme, keybindings: unknown) => EditorComponent;
55
- editorTheme: EditorTheme;
56
- getChatRenderSettings?: () => Partial<Omit<ChatMessageRenderOptions, "ui" | "cwd">> | undefined;
57
- getCwd?: () => string;
58
- footerData?: ReadonlyFooterDataProvider;
59
- renderExtraEntry?: (entry: TExtraEntry) => Component;
60
- }
61
- export type ChatSessionHostEntry<TExtraEntry extends ChatTranscriptEntryLike = never> = ChatMessageEntry | TExtraEntry;
62
- type AgentSnapshotMessage = AgentSession["messages"][number];
2
+ import { type Component, type Focusable } from "@earendil-works/pi-tui";
3
+ import type { ChatTranscriptEntryLike } from "./chat-transcript.ts";
4
+ import type { AgentSnapshotMessage, ChatSessionHostEntry, ChatSessionHostOpts } from "./chat-session-host-types.ts";
5
+ export type { ChatSessionHostBashRequest, ChatSessionHostCommands, ChatSessionHostEntry, ChatSessionHostOpts, ChatSessionHostStyle, } from "./chat-session-host-types.ts";
63
6
  export declare class ChatSessionHost<TExtraEntry extends ChatTranscriptEntryLike = never> implements Component, Focusable {
64
7
  focused: boolean;
65
- private readonly style;
66
- private readonly commands;
67
- private readonly requestRender;
68
- private readonly getAgentSession;
69
- private readonly isStreamingOverride;
70
- private readonly isPaused;
71
- private readonly isDisabled;
72
- private readonly isBashRunningOverride;
73
- private readonly showWarning;
74
- private readonly showStatus;
75
- private readonly actions;
76
- private readonly getActionKeyDisplay;
77
- private readonly getMarkdownTheme;
78
- private readonly getChatRenderSettings;
79
- private readonly getCwd;
80
- private readonly footerData;
81
- private readonly renderExtraEntry;
82
- private readonly tui;
83
- private inputBuffer;
84
- private transcript;
85
- private statusMessage;
86
- private isBashMode;
87
- private localBashRunning;
88
- private sdkBusy;
89
- private workingMessage;
90
- private pendingSteeringMessages;
91
- private pendingFollowUpMessages;
92
- private compactionQueuedMessages;
93
- private compacting;
94
- private animationTimer;
95
- private renderThrottleTimer;
96
- private bodyViewport;
97
- private transcriptComponent;
98
- private transcriptRenderSettingsKey;
99
- private renderIdentityIds;
100
- private nextRenderIdentityId;
101
- private liveChat;
102
- private editor;
103
- private optimisticUserSignatureCounts;
8
+ private readonly state;
104
9
  constructor(opts: ChatSessionHostOpts<TExtraEntry>);
105
10
  appendMessages(messages: readonly AgentSnapshotMessage[]): void;
106
11
  loadSessionFile(sessionFile: string | undefined): void;
107
12
  appendExtraEntry(entry: TExtraEntry): void;
108
13
  entries(): readonly ChatSessionHostEntry<TExtraEntry>[];
109
- private incrementOptimisticUserSignature;
110
- private decrementOptimisticUserSignature;
111
14
  applyAgentEvent(event: AgentSessionEvent): boolean;
112
15
  render(width: number): string[];
113
16
  invalidate(): void;
@@ -133,33 +36,7 @@ export declare class ChatSessionHost<TExtraEntry extends ChatTranscriptEntryLike
133
36
  scrollToBottom(): void;
134
37
  syncAnimationTick(): void;
135
38
  dispose(): void;
136
- private createEditor;
137
- private createInheritedEditor;
138
- private editorAccess;
139
- private openExternalEditor;
140
- private tuiHost;
141
- private setEditorText;
142
- private renderEntry;
143
- private streamingWindowedEntry;
144
- private chatMessageRenderOptions;
145
- private toolTui;
146
- private chatRenderSettingsCacheKey;
147
- private transcriptCacheKey;
148
- private entryContentCacheKey;
149
- private renderIdentityKey;
150
- private pendingMessageLine;
151
- private abortCompaction;
152
- private abortBash;
153
- private runBashCommand;
154
- private flushCompactionQueue;
155
- private queueSteer;
156
- private queueFollowUp;
157
39
  restoreQueuedMessagesToEditor(): boolean;
158
- private notifyWarning;
159
- private notifyStatus;
160
- private requiredCommand;
161
- private afterEvent;
162
- private requestEventRender;
40
+ private editorCallbacks;
163
41
  }
164
- export {};
165
42
  //# sourceMappingURL=chat-session-host.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"chat-session-host.d.ts","sourceRoot":"","sources":["../../../../src/modes/interactive/components/chat-session-host.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAC;AACxE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,gCAAgC,CAAC;AACnE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gCAAgC,CAAC;AACjE,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,uCAAuC,CAAC;AAExF,OAAO,EACL,KAAK,SAAS,EACd,KAAK,eAAe,EACpB,KAAK,WAAW,EAChB,KAAK,SAAS,EACd,KAAK,aAAa,EAClB,KAAK,GAAG,EAMT,MAAM,wBAAwB,CAAC;AAG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AI,MAAM,CAEtB;IAED,SAAS,IAAI,MAAM,CAElB;IAED,UAAU,IAAI,MAAM,CAEnB;IAED,cAAc,IAAI,IAAI,CAErB;IAED,iBAAiB,IAAI,IAAI,CAcxB;IAED,OAAO,IAAI,IAAI,CAUd;IAED,OAAO,CAAC,YAAY;IA2EpB,OAAO,CAAC,qBAAqB;IAc7B,OAAO,CAAC,YAAY;IAkBpB,OAAO,CAAC,kBAAkB;IAW1B,OAAO,CAAC,OAAO;IAIf,OAAO,CAAC,aAAa;IAMrB,OAAO,CAAC,WAAW;IAanB,OAAO,CAAC,sBAAsB;IAa9B,OAAO,CAAC,wBAAwB;IAWhC,OAAO,CAAC,OAAO;IAIf,OAAO,CAAC,0BAA0B;IAelC,OAAO,CAAC,kBAAkB;IAa1B,OAAO,CAAC,oBAAoB;IAmC5B,OAAO,CAAC,iBAAiB;IASzB,OAAO,CAAC,kBAAkB;YAaZ,eAAe;YAcf,SAAS;YAYT,cAAc;YAyDd,oBAAoB;YAwBpB,UAAU;YASV,aAAa;IAS3B,6BAA6B,IAAI,OAAO,CAqBvC;IAED,OAAO,CAAC,aAAa;IAMrB,OAAO,CAAC,YAAY;IAMpB,OAAO,CAAC,eAAe;IA2BvB,OAAO,CAAC,UAAU;IAMlB,OAAO,CAAC,kBAAkB;CAY3B","sourcesContent":["import type { AgentSessionEvent } from \"../../../core/agent-session.ts\";\nimport type { AgentSession } from \"../../../core/agent-session.ts\";\nimport type { BashResult } from \"../../../core/bash-executor.ts\";\nimport type { ReadonlyFooterDataProvider } from \"../../../core/footer-data-provider.ts\";\nimport type { BashExecutionMessage } from \"../../../core/messages.ts\";\nimport {\n type Component,\n type EditorComponent,\n type EditorTheme,\n type Focusable,\n type MarkdownTheme,\n type TUI,\n Spacer,\n Text,\n matchesKey as tuiMatchesKey,\n truncateToWidth,\n visibleWidth,\n} from \"@earendil-works/pi-tui\";\nimport { SessionManager } from \"../../../core/session-manager.ts\";\nimport { CustomEditor } from \"./custom-editor.ts\";\nimport {\n LiveChatEntriesController,\n renderChatMessageEntry,\n type ChatMessageEntry,\n type ChatMessageRenderOptions,\n} from \"./chat-message-renderer.ts\";\nimport {\n ChatTranscriptComponent,\n ScrollableComponentViewport,\n type ChatTranscriptEntryLike,\n} from \"./chat-transcript.ts\";\nimport { UsageMeterComponent, FooterComponent } from \"./footer.ts\";\nimport { WorkingStatusComponent } from \"./working-status.ts\";\nimport {\n combineQueuedMessagesForEditor,\n openExternalEditorForText,\n pasteClipboardImageToEditor,\n} from \"../chat-input-actions.ts\";\nimport { pickWhimsicalWorkingMessage } from \"../whimsical-messages.ts\";\n\nconst SPINNER_FRAMES = [\"⠋\", \"⠙\", \"⠹\", \"⠸\", \"⠼\", \"⠴\", \"⠦\", \"⠧\", \"⠇\", \"⠏\"];\nconst ANIMATION_FRAME_MS = 80;\nconst STREAMING_RENDER_THROTTLE_MS = 80;\nconst STREAMING_TEXT_TAIL_LINES = 240;\nconst STREAMING_TEXT_TAIL_CHARS = 16_000;\n\nexport interface ChatSessionHostStyle {\n dim(text: string): string;\n text(text: string): string;\n textMuted(text: string): string;\n accent(text: string): string;\n accentBold(text: string): string;\n rule(hex: string, text: string): string;\n cursor(): string;\n blank(width: number): string;\n editorRuleColor(\n disabled: boolean,\n agentSession: AgentSession | undefined,\n state?: { isBashMode: boolean },\n ): string;\n}\n\nexport interface ChatSessionHostBashRequest {\n command: string;\n excludeFromContext: boolean;\n onChunk: (chunk: string) => void;\n}\n\nexport interface ChatSessionHostCommands {\n ensureAttached?: () => Promise<void>;\n prompt?: (text: string) => Promise<void>;\n steer?: (text: string) => Promise<void>;\n followUp?: (text: string) => Promise<void>;\n interrupt?: () => Promise<void>;\n resume?: (message?: string) => Promise<void>;\n runBash?: (request: ChatSessionHostBashRequest) => Promise<BashResult>;\n abortBash?: () => void | Promise<void>;\n abortCompaction?: () => void | Promise<void>;\n handleSlashCommand?: (text: string) => Promise<boolean> | boolean;\n}\n\nexport interface ChatSessionHostOpts<TExtraEntry extends ChatTranscriptEntryLike = never> {\n style: ChatSessionHostStyle;\n commands?: ChatSessionHostCommands;\n requestRender?: () => void;\n getAgentSession?: () => AgentSession | undefined;\n isStreaming?: () => boolean;\n isPaused?: () => boolean;\n isDisabled?: () => boolean;\n isBashRunning?: () => boolean;\n showWarning?: (message: string) => void;\n showStatus?: (message: string) => void;\n actions?: Record<string, () => void | Promise<void>>;\n getActionKeyDisplay?: (action: string) => string;\n getMarkdownTheme?: () => MarkdownTheme;\n tui?: TUI;\n keybindings?: unknown;\n editorFactory?: (\n tui: TUI,\n theme: EditorTheme,\n keybindings: unknown,\n ) => EditorComponent;\n editorTheme: EditorTheme;\n getChatRenderSettings?: () =>\n | Partial<Omit<ChatMessageRenderOptions, \"ui\" | \"cwd\">>\n | undefined;\n getCwd?: () => string;\n footerData?: ReadonlyFooterDataProvider;\n renderExtraEntry?: (entry: TExtraEntry) => Component;\n}\n\nexport type ChatSessionHostEntry<TExtraEntry extends ChatTranscriptEntryLike = never> =\n | ChatMessageEntry\n | TExtraEntry;\ntype AgentSnapshotMessage = AgentSession[\"messages\"][number];\ntype CacheKeyPart = string | number | boolean | null;\n\nexport class ChatSessionHost<TExtraEntry extends ChatTranscriptEntryLike = never>\n implements Component, Focusable\n{\n focused = true;\n\n private readonly style: ChatSessionHostStyle;\n private readonly commands: ChatSessionHostCommands;\n private readonly requestRender: (() => void) | undefined;\n private readonly getAgentSession: (() => AgentSession | undefined) | undefined;\n private readonly isStreamingOverride: (() => boolean) | undefined;\n private readonly isPaused: (() => boolean) | undefined;\n private readonly isDisabled: (() => boolean) | undefined;\n private readonly isBashRunningOverride: (() => boolean) | undefined;\n private readonly showWarning: ((message: string) => void) | undefined;\n private readonly showStatus: ((message: string) => void) | undefined;\n private readonly actions: Record<string, () => void | Promise<void>> | undefined;\n private readonly getActionKeyDisplay: ((action: string) => string) | undefined;\n private readonly getMarkdownTheme: (() => MarkdownTheme) | undefined;\n private readonly getChatRenderSettings: ChatSessionHostOpts<TExtraEntry>[\"getChatRenderSettings\"];\n private readonly getCwd: (() => string) | undefined;\n private readonly footerData: ReadonlyFooterDataProvider | undefined;\n private readonly renderExtraEntry: ((entry: TExtraEntry) => Component) | undefined;\n private readonly tui: TUI | undefined;\n\n private inputBuffer = \"\";\n private transcript: ChatSessionHostEntry<TExtraEntry>[] = [];\n private statusMessage = \"\";\n private isBashMode = false;\n private localBashRunning = false;\n private sdkBusy = false;\n private workingMessage: string | undefined;\n private pendingSteeringMessages: readonly string[] = [];\n private pendingFollowUpMessages: readonly string[] = [];\n private compactionQueuedMessages: readonly string[] = [];\n private compacting = false;\n private animationTimer: ReturnType<typeof setInterval> | undefined;\n private renderThrottleTimer: ReturnType<typeof setTimeout> | undefined;\n private bodyViewport = new ScrollableComponentViewport();\n private transcriptComponent: ChatTranscriptComponent<ChatSessionHostEntry<TExtraEntry>>;\n private transcriptRenderSettingsKey = \"\";\n private renderIdentityIds = new WeakMap<object, number>();\n private nextRenderIdentityId = 1;\n private liveChat: LiveChatEntriesController;\n private editor: EditorComponent | undefined;\n private optimisticUserSignatureCounts = new Map<string, number>();\n\n constructor(opts: ChatSessionHostOpts<TExtraEntry>) {\n this.style = opts.style;\n this.commands = opts.commands ?? {};\n this.requestRender = opts.requestRender;\n this.getAgentSession = opts.getAgentSession;\n this.isStreamingOverride = opts.isStreaming;\n this.isPaused = opts.isPaused;\n this.isDisabled = opts.isDisabled;\n this.isBashRunningOverride = opts.isBashRunning;\n this.showWarning = opts.showWarning;\n this.showStatus = opts.showStatus;\n this.actions = opts.actions;\n this.getActionKeyDisplay = opts.getActionKeyDisplay;\n this.getMarkdownTheme = opts.getMarkdownTheme;\n this.getChatRenderSettings = opts.getChatRenderSettings;\n this.getCwd = opts.getCwd;\n this.footerData = opts.footerData;\n this.renderExtraEntry = opts.renderExtraEntry;\n this.tui = opts.tui;\n this.liveChat = new LiveChatEntriesController(this.transcript);\n this.transcriptComponent = new ChatTranscriptComponent(\n this.transcript,\n (entry) => this.renderEntry(entry),\n (entry, index) => this.transcriptCacheKey(entry, index),\n );\n this.editor = this.createEditor(\n opts.tui,\n opts.keybindings,\n opts.editorTheme,\n opts.editorFactory,\n );\n this.syncAnimationTick();\n }\n\n appendMessages(messages: readonly AgentSnapshotMessage[]): void {\n this.liveChat.appendMessages(messages);\n }\n\n loadSessionFile(sessionFile: string | undefined): void {\n if (this.transcript.length > 0 || sessionFile === undefined) return;\n let messages: readonly AgentSnapshotMessage[];\n try {\n messages = SessionManager.open(sessionFile).buildSessionContext()\n .messages as readonly AgentSnapshotMessage[];\n } catch {\n return;\n }\n this.liveChat.appendMessages(messages);\n }\n\n appendExtraEntry(entry: TExtraEntry): void {\n this.transcript.push(entry);\n }\n\n entries(): readonly ChatSessionHostEntry<TExtraEntry>[] {\n return this.transcript;\n }\n\n private incrementOptimisticUserSignature(signature: string): void {\n this.optimisticUserSignatureCounts.set(\n signature,\n (this.optimisticUserSignatureCounts.get(signature) ?? 0) + 1,\n );\n }\n\n private decrementOptimisticUserSignature(signature: string): void {\n const count = this.optimisticUserSignatureCounts.get(signature) ?? 0;\n if (count <= 1) this.optimisticUserSignatureCounts.delete(signature);\n else this.optimisticUserSignatureCounts.set(signature, count - 1);\n }\n\n applyAgentEvent(event: AgentSessionEvent): boolean {\n const type = String((event as { type?: unknown }).type ?? \"\");\n if (type === \"message_start\") {\n const message = (event as { message?: unknown }).message;\n if (isUserMessageLike(message)) {\n const signature = userMessageSignature(\n extractMessageText(message.content),\n );\n const count = this.optimisticUserSignatureCounts.get(signature) ?? 0;\n if (count > 0) {\n this.decrementOptimisticUserSignature(signature);\n return false;\n }\n }\n }\n if (isSharedLiveChatEvent(type)) {\n const changed = this.liveChat.applyEvent(event);\n const toolCallEvent = assistantToolCallEvent(event);\n const changedByToolCall = toolCallEvent !== undefined\n ? this.liveChat.applyEvent(toolCallEvent)\n : false;\n this.afterEvent(changed || changedByToolCall);\n return changed || changedByToolCall;\n }\n let changed = false;\n switch (type) {\n case \"agent_start\":\n this.sdkBusy = true;\n this.liveChat.clearPendingTools();\n this.statusMessage = \"\";\n changed = true;\n break;\n case \"agent_end\":\n this.sdkBusy = false;\n this.workingMessage = undefined;\n this.liveChat.clearPendingTools();\n this.statusMessage = \"\";\n changed = true;\n break;\n case \"turn_start\":\n this.workingMessage = pickWhimsicalWorkingMessage();\n changed = true;\n break;\n case \"turn_end\":\n this.workingMessage = undefined;\n changed = true;\n break;\n case \"queue_update\": {\n const queue = event as { steering?: unknown; followUp?: unknown };\n this.pendingSteeringMessages = Array.isArray(queue.steering)\n ? queue.steering.filter((item): item is string => typeof item === \"string\")\n : [];\n this.pendingFollowUpMessages = Array.isArray(queue.followUp)\n ? queue.followUp.filter((item): item is string => typeof item === \"string\")\n : [];\n changed = true;\n break;\n }\n case \"tool_call\":\n case \"tool_use\":\n changed = this.liveChat.applyEvent(legacyToolStartEvent(event));\n break;\n case \"tool_result\":\n changed = this.liveChat.applyEvent(legacyToolResultEvent(event));\n break;\n case \"thinking_delta\":\n case \"thinking\":\n changed = this.liveChat.applyEvent(legacyThinkingEvent(event));\n break;\n case \"compaction_start\":\n this.compacting = true;\n this.sdkBusy = true;\n this.statusMessage = \"compacting context…\";\n changed = true;\n break;\n case \"context_compaction_start\":\n this.compacting = true;\n this.sdkBusy = true;\n this.statusMessage = \"compacting context…\";\n changed = true;\n break;\n case \"compaction_end\": {\n const compaction = event as Extract<AgentSessionEvent, { type: \"compaction_end\" }>;\n this.compacting = false;\n this.sdkBusy = false;\n this.statusMessage = compaction.errorMessage ?? \"\";\n if (!compaction.aborted && !compaction.errorMessage && this.compactionQueuedMessages.length > 0) {\n void this.flushCompactionQueue();\n }\n changed = true;\n break;\n }\n case \"context_compaction_end\": {\n const compaction = event as Extract<AgentSessionEvent, { type: \"context_compaction_end\" }>;\n this.compacting = false;\n this.sdkBusy = false;\n this.statusMessage = compaction.errorMessage ?? \"\";\n if (!compaction.aborted && !compaction.errorMessage && this.compactionQueuedMessages.length > 0) {\n void this.flushCompactionQueue();\n }\n changed = true;\n break;\n }\n case \"auto_retry_start\":\n this.sdkBusy = true;\n this.statusMessage = \"retrying…\";\n changed = true;\n break;\n case \"auto_retry_end\": {\n const retry = event as Extract<AgentSessionEvent, { type: \"auto_retry_end\" }>;\n this.statusMessage = \"\";\n if (!retry.success) {\n this.sdkBusy = false;\n this.workingMessage = undefined;\n }\n changed = true;\n break;\n }\n default:\n changed = false;\n }\n this.afterEvent(changed);\n return changed;\n }\n\n render(width: number): string[] {\n return this.renderBody(width, 1);\n }\n\n invalidate(): void {\n this.transcriptComponent.invalidate();\n this.bodyViewport.invalidate();\n this.editor?.invalidate();\n }\n\n renderBody(width: number, budget: number): string[] {\n const components: Component[] = [];\n this.transcriptRenderSettingsKey = this.chatRenderSettingsCacheKey();\n if (this.transcript.length > 0) {\n components.push(this.transcriptComponent);\n }\n if (this.statusMessage) {\n components.push(new Spacer(1));\n components.push(new Text(this.style.dim(this.statusMessage), 2, 0));\n }\n this.bodyViewport.setVisibleRows(budget);\n this.bodyViewport.setComponents(components);\n return this.bodyViewport.render(width);\n }\n\n renderPendingMessages(width: number): string[] {\n if (\n this.pendingSteeringMessages.length === 0 &&\n this.pendingFollowUpMessages.length === 0 &&\n this.compactionQueuedMessages.length === 0\n ) {\n return [];\n }\n const lines = [this.style.blank(width)];\n for (const message of this.pendingSteeringMessages) {\n lines.push(...this.pendingMessageLine(width, \"Steering\", message));\n }\n for (const message of this.pendingFollowUpMessages) {\n lines.push(...this.pendingMessageLine(width, \"Follow-up\", message));\n }\n for (const message of this.compactionQueuedMessages) {\n lines.push(...this.pendingMessageLine(width, \"Queued\", message));\n }\n const hint = this.getActionKeyDisplay?.(\"app.message.dequeue\") ?? \"alt+up\";\n lines.push(...new Text(this.style.dim(`↳ ${hint} to edit all queued messages`), 1, 0).render(width));\n return lines;\n }\n\n renderWorkingStatus(width: number): string[] {\n if (!this.isStreaming()) return [];\n const message = this.workingMessage ?? \"Working...\";\n return new WorkingStatusComponent({\n spinner: spinnerFrame(),\n message,\n spinnerColor: (text) => this.style.accentBold(text),\n messageColor: (text) => this.style.textMuted(text),\n }).render(width);\n }\n\n renderUsage(width: number): string[] {\n const agentSession = this.getAgentSession?.();\n if (!agentSession) return [];\n return new UsageMeterComponent(agentSession).render(width);\n }\n\n renderEditor(width: number): string[] {\n const disabled = this.isDisabled?.() === true;\n const agentSession = this.getAgentSession?.();\n const ruleHex = this.style.editorRuleColor(disabled, agentSession, {\n isBashMode: this.isBashMode,\n });\n if (!disabled && this.editor) {\n setEditorFocused(this.editor, this.focused);\n setEditorPlaceholder(this.editor, undefined);\n setEditorBorderColor(this.editor, (text) => this.style.rule(ruleHex, text));\n return this.editor.render(width);\n }\n if (this.editor) setEditorFocused(this.editor, false);\n const rule = this.style.rule(ruleHex, \"─\".repeat(width));\n const available = Math.max(1, width - 3);\n const value = this.inputBuffer\n ? this.style.text(truncateToWidth(this.inputBuffer, available)) + this.style.cursor()\n : disabled\n ? \"\"\n : this.style.cursor();\n const left = this.style.accentBold(\"❯\") + \" \" + value;\n const gap = Math.max(0, width - visibleWidth(stripAnsi(left)));\n const body = left + \" \".repeat(gap);\n return [rule, body, rule];\n }\n\n renderFooter(width: number): string[] {\n const agentSession = this.getAgentSession?.();\n if (agentSession && this.footerData) {\n return new FooterComponent(agentSession, this.footerData).render(width);\n }\n return [];\n }\n\n handleScrollInput(data: string): boolean {\n return this.bodyViewport.handleInput(data);\n }\n\n handleInput(data: string): boolean {\n if (this.handleScrollInput(data)) return true;\n if (matchesKey(data, \"alt+up\")) {\n this.restoreQueuedMessagesToEditor();\n return true;\n }\n if (matchesKey(data, \"ctrl+f\")) {\n void this.submit(\"followUp\");\n return true;\n }\n if (matchesKey(data, \"escape\")) {\n if (this.compacting) {\n void this.abortCompaction();\n return true;\n }\n if (this.isStreaming()) {\n void this.interrupt();\n return true;\n }\n if (this.isBashRunning()) {\n void this.abortBash();\n return true;\n }\n if (this.isBashMode) {\n this.setEditorText(\"\");\n this.notifyStatus(\"Bash mode cleared\");\n return true;\n }\n }\n if (this.editor) {\n this.editor.handleInput(data);\n return true;\n }\n if (matchesKey(data, \"enter\")) {\n void this.submit(\"auto\");\n return true;\n }\n if (matchesKey(data, \"backspace\")) {\n this.setEditorText(this.inputBuffer.slice(0, -1));\n return true;\n }\n if (data.length === 1 && data >= \" \" && data <= \"~\") {\n this.setEditorText(`${this.inputBuffer}${data}`);\n return true;\n }\n return false;\n }\n\n async interrupt(): Promise<void> {\n try {\n this.restoreQueuedMessagesToEditor();\n this.sdkBusy = false;\n this.workingMessage = undefined;\n await this.commands.interrupt?.();\n } catch (err) {\n this.statusMessage = errorMessage(err);\n } finally {\n this.syncAnimationTick();\n this.requestRender?.();\n }\n }\n\n async submit(mode: \"auto\" | \"followUp\" = \"auto\", submittedText?: string): Promise<void> {\n const text = (submittedText ?? this.inputBuffer).trim();\n if (!text) return;\n if (text.startsWith(\"/\") && this.commands.handleSlashCommand) {\n const handled = await this.commands.handleSlashCommand(text);\n if (handled) {\n this.setEditorText(\"\");\n this.requestRender?.();\n return;\n }\n }\n if (this.compacting) {\n this.setEditorText(\"\");\n this.compactionQueuedMessages = [...this.compactionQueuedMessages, text];\n this.notifyStatus(\"Queued message until compaction completes\");\n return;\n }\n const bash = parseBashInput(text);\n if (bash?.command) {\n if (this.isBashRunning()) {\n this.notifyWarning(\"A bash command is already running. esc cancel first.\");\n this.setEditorText(text);\n return;\n }\n this.setEditorText(\"\");\n await this.runBashCommand(bash.command, bash.excludeFromContext);\n return;\n }\n this.setEditorText(\"\");\n const isPaused = this.isPaused?.() === true;\n const isStreaming = this.isStreaming();\n const shouldAppendOptimisticUser = mode === \"auto\" && !isStreaming;\n const optimisticSignature = shouldAppendOptimisticUser\n ? userMessageSignature(text)\n : undefined;\n if (optimisticSignature !== undefined) {\n this.liveChat.appendUserText(text);\n this.bodyViewport.scrollToBottom();\n this.incrementOptimisticUserSignature(optimisticSignature);\n }\n this.requestRender?.();\n try {\n if (isPaused) {\n this.sdkBusy = true;\n this.statusMessage = \"resuming…\";\n this.syncAnimationTick();\n this.requestRender?.();\n await this.requiredCommand(\"resume\")(text);\n this.sdkBusy = false;\n this.statusMessage = \"\";\n this.syncAnimationTick();\n return;\n }\n if (mode === \"followUp\" && isStreaming) {\n await this.queueFollowUp(text);\n return;\n }\n if (isStreaming) {\n await this.queueSteer(text);\n } else {\n this.sdkBusy = true;\n this.syncAnimationTick();\n await this.commands.ensureAttached?.();\n await this.requiredCommand(\"prompt\")(text);\n this.sdkBusy = false;\n this.syncAnimationTick();\n }\n } catch (err) {\n if (optimisticSignature !== undefined) {\n this.decrementOptimisticUserSignature(optimisticSignature);\n }\n this.sdkBusy = false;\n this.statusMessage = errorMessage(err);\n this.syncAnimationTick();\n this.requestRender?.();\n }\n }\n\n isStreaming(): boolean {\n return this.sdkBusy || this.isStreamingOverride?.() === true;\n }\n\n isBashRunning(): boolean {\n return this.localBashRunning || this.isBashRunningOverride?.() === true;\n }\n\n isEditingBashCommand(): boolean {\n return this.isBashMode;\n }\n\n hasInputText(): boolean {\n return this.inputBuffer.length > 0;\n }\n\n hasAnimationTick(): boolean {\n return this.animationTimer !== undefined;\n }\n\n bodyScrollFromBottom(): number {\n return this.bodyViewport.getScrollFromBottom();\n }\n\n bodyMaxScroll(): number {\n return this.bodyViewport.getMaxScroll();\n }\n\n inputText(): string {\n return this.inputBuffer;\n }\n\n statusText(): string {\n return this.statusMessage;\n }\n\n scrollToBottom(): void {\n this.bodyViewport.scrollToBottom();\n }\n\n syncAnimationTick(): void {\n const shouldAnimate =\n this.isStreaming() || (this.sdkBusy && this.liveChat.pendingToolIds().length > 0);\n if (shouldAnimate && !this.animationTimer) {\n this.animationTimer = setInterval(() => {\n this.requestRender?.();\n }, ANIMATION_FRAME_MS);\n this.animationTimer.unref?.();\n return;\n }\n if (!shouldAnimate && this.animationTimer) {\n clearInterval(this.animationTimer);\n this.animationTimer = undefined;\n }\n }\n\n dispose(): void {\n if (this.animationTimer) {\n clearInterval(this.animationTimer);\n this.animationTimer = undefined;\n }\n if (this.renderThrottleTimer) {\n clearTimeout(this.renderThrottleTimer);\n this.renderThrottleTimer = undefined;\n }\n this.editor = undefined;\n }\n\n private createEditor(\n tui: TUI | undefined,\n keybindings: unknown,\n editorTheme: EditorTheme,\n editorFactory: ChatSessionHostOpts<TExtraEntry>[\"editorFactory\"],\n ): EditorComponent | undefined {\n if (!tui || !keybindings) return undefined;\n const editor = this.createInheritedEditor(tui, editorTheme, keybindings, editorFactory) ??\n new CustomEditor(\n tui,\n editorTheme,\n keybindings as ConstructorParameters<typeof CustomEditor>[2],\n { paddingX: 0, autocompleteMaxVisible: 5 },\n );\n editor.onChange = (text) => {\n this.inputBuffer = text;\n this.isBashMode = text.trimStart().startsWith(\"!\");\n };\n editor.onSubmit = (text) => {\n void this.submit(\"auto\", text);\n };\n const actionEditor = editor as EditorComponent & {\n onAction?: (action: string, handler: () => void) => void;\n onEscape?: () => void;\n onPasteImage?: () => void;\n };\n actionEditor.onAction?.(\"app.message.followUp\", () => {\n void this.submit(\"followUp\");\n });\n actionEditor.onAction?.(\"app.message.dequeue\", () => {\n this.restoreQueuedMessagesToEditor();\n });\n actionEditor.onAction?.(\"app.editor.external\", () => {\n this.openExternalEditor();\n });\n if (this.actions) {\n for (const [action, handler] of Object.entries(this.actions)) {\n actionEditor.onAction?.(action, () => {\n void handler();\n });\n }\n }\n const previousPasteImage = actionEditor.onPasteImage;\n actionEditor.onPasteImage = () => {\n previousPasteImage?.();\n void pasteClipboardImageToEditor(\n this.editorAccess(),\n () => this.requestRender?.(),\n { showWarning: (message) => this.notifyWarning(message) },\n );\n };\n const previousEscape = actionEditor.onEscape;\n actionEditor.onEscape = () => {\n if (this.compacting) {\n void this.abortCompaction();\n return;\n }\n if (this.isStreaming()) {\n void this.interrupt();\n return;\n }\n if (this.isBashRunning()) {\n void this.abortBash();\n return;\n }\n if (this.isBashMode) {\n this.setEditorText(\"\");\n this.notifyStatus(\"Bash mode cleared\");\n return;\n }\n previousEscape?.();\n };\n return editor;\n }\n\n private createInheritedEditor(\n tui: TUI,\n editorTheme: EditorTheme,\n keybindings: unknown,\n editorFactory: ChatSessionHostOpts<TExtraEntry>[\"editorFactory\"],\n ): EditorComponent | undefined {\n if (!editorFactory) return undefined;\n try {\n return editorFactory(tui, editorTheme, keybindings);\n } catch {\n return undefined;\n }\n }\n\n private editorAccess(): {\n insertTextAtCursor: (text: string) => void;\n getText: () => string;\n setText: (text: string) => void;\n } {\n return {\n insertTextAtCursor: (text: string) => {\n if (this.editor?.insertTextAtCursor) {\n this.editor.insertTextAtCursor(text);\n return;\n }\n this.setEditorText(`${this.inputBuffer}${text}`);\n },\n getText: () => this.inputBuffer,\n setText: (text: string) => this.setEditorText(text),\n };\n }\n\n private openExternalEditor(): void {\n if (!this.editor) return;\n const host = this.tuiHost();\n if (!host) return;\n const currentText = this.editor.getExpandedText?.() ?? this.editor.getText();\n const updated = openExternalEditorForText(currentText, host, {\n showWarning: (message) => this.notifyWarning(message),\n });\n if (updated !== undefined) this.setEditorText(updated);\n }\n\n private tuiHost(): Pick<TUI, \"stop\" | \"start\" | \"requestRender\"> | undefined {\n return this.tui;\n }\n\n private setEditorText(text: string): void {\n this.inputBuffer = text;\n this.isBashMode = text.trimStart().startsWith(\"!\");\n this.editor?.setText(text);\n }\n\n private renderEntry(entry: ChatSessionHostEntry<TExtraEntry>): Component {\n if (isChatMessageEntry(entry)) {\n return renderChatMessageEntry(\n this.streamingWindowedEntry(entry),\n this.chatMessageRenderOptions(),\n );\n }\n if (!this.renderExtraEntry) {\n return new Text(\"\", 0, 0);\n }\n return this.renderExtraEntry(entry);\n }\n\n private streamingWindowedEntry(entry: ChatMessageEntry): ChatMessageEntry {\n if (!this.isStreaming() || this.bodyViewport.getScrollFromBottom() !== 0) {\n return entry;\n }\n if (entry.kind !== \"assistant\") return entry;\n const content = entry.message.content.map((item) => {\n if (item.type === \"text\") return { ...item, text: tailStreamingText(item.text) };\n if (item.type === \"thinking\") return { ...item, thinking: tailStreamingText(item.thinking) };\n return item;\n });\n return { ...entry, message: { ...entry.message, content } };\n }\n\n private chatMessageRenderOptions(): ChatMessageRenderOptions {\n const inherited = this.getChatRenderSettings?.();\n return {\n ...inherited,\n ui: this.toolTui(),\n cwd: this.getCwd?.() ?? this.getAgentSession?.()?.sessionManager.getCwd() ?? process.cwd(),\n markdownTheme: inherited?.markdownTheme ?? this.getMarkdownTheme?.(),\n showImages: inherited?.showImages ?? true,\n };\n }\n\n private toolTui(): Pick<TUI, \"requestRender\"> {\n return { requestRender: () => this.requestRender?.() };\n }\n\n private chatRenderSettingsCacheKey(): string {\n const inherited = this.getChatRenderSettings?.();\n return cacheKey([\n \"settings\",\n inherited?.hideThinkingBlock === true,\n inherited?.hiddenThinkingLabel ?? \"\",\n inherited?.toolOutputExpanded === true,\n inherited?.showImages !== false,\n inherited?.imageWidthCells ?? null,\n this.getCwd?.() ?? this.getAgentSession?.()?.sessionManager.getCwd() ?? process.cwd(),\n this.bodyViewport.getScrollFromBottom() === 0,\n this.isStreaming(),\n ]);\n }\n\n private transcriptCacheKey(\n entry: ChatSessionHostEntry<TExtraEntry>,\n index: number,\n ): string {\n return cacheKey([\n this.transcriptRenderSettingsKey,\n index,\n entry.role,\n this.renderIdentityKey(entry),\n this.entryContentCacheKey(entry),\n ]);\n }\n\n private entryContentCacheKey(entry: ChatSessionHostEntry<TExtraEntry>): string {\n if (!isChatMessageEntry(entry)) return cacheKey([\"extra\"]);\n switch (entry.kind) {\n case \"assistant\":\n return cacheKey([\"assistant\", this.renderIdentityKey(entry.message)]);\n case \"tool\":\n return cacheKey([\n \"tool\",\n entry.toolCallId,\n entry.toolName,\n entry.isPartial === true,\n entry.result === undefined ? null : this.renderIdentityKey(entry.result),\n ]);\n case \"bashExecution\":\n return cacheKey([\n \"bashExecution\",\n entry.isPartial === true,\n entry.message.command,\n entry.message.output,\n entry.message.exitCode ?? null,\n entry.message.cancelled,\n entry.message.truncated,\n entry.message.fullOutputPath ?? null,\n ]);\n case \"user\":\n return cacheKey([\"user\", entry.text]);\n case \"custom\":\n return cacheKey([\"custom\", this.renderIdentityKey(entry.message)]);\n case \"branchSummary\":\n return cacheKey([\"branchSummary\", this.renderIdentityKey(entry.message)]);\n case \"system\":\n return cacheKey([\"system\", entry.text]);\n }\n }\n\n private renderIdentityKey(value: object): string {\n const existing = this.renderIdentityIds.get(value);\n if (existing !== undefined) return String(existing);\n const id = this.nextRenderIdentityId;\n this.nextRenderIdentityId += 1;\n this.renderIdentityIds.set(value, id);\n return String(id);\n }\n\n private pendingMessageLine(\n width: number,\n label: \"Steering\" | \"Follow-up\" | \"Queued\",\n message: string,\n ): string[] {\n const text = `${label}: ${message}`;\n return new Text(\n this.style.dim(truncateToWidth(text, Math.max(1, width - 2))),\n 1,\n 0,\n ).render(width);\n }\n\n private async abortCompaction(): Promise<void> {\n try {\n await this.commands.abortCompaction?.();\n this.compacting = false;\n this.sdkBusy = false;\n this.notifyStatus(\"Compaction cancelled\");\n } catch (err) {\n this.notifyWarning(errorMessage(err));\n } finally {\n this.syncAnimationTick();\n this.requestRender?.();\n }\n }\n\n private async abortBash(): Promise<void> {\n try {\n await this.commands.abortBash?.();\n this.localBashRunning = false;\n this.notifyStatus(\"Bash command cancelled\");\n } catch (err) {\n this.notifyWarning(errorMessage(err));\n } finally {\n this.requestRender?.();\n }\n }\n\n private async runBashCommand(\n command: string,\n excludeFromContext: boolean,\n ): Promise<void> {\n const runBash = this.commands.runBash;\n if (!runBash) {\n this.notifyWarning(\"no bash command configured for this chat session\");\n return;\n }\n const bashMessage: BashExecutionMessage = {\n role: \"bashExecution\",\n command,\n output: \"\",\n exitCode: undefined,\n cancelled: false,\n truncated: false,\n timestamp: Date.now(),\n ...(excludeFromContext ? { excludeFromContext: true } : {}),\n };\n const bashEntry: ChatMessageEntry = {\n role: \"tool\",\n kind: \"bashExecution\",\n message: bashMessage,\n isPartial: true,\n };\n this.transcript.push(bashEntry);\n this.localBashRunning = true;\n this.bodyViewport.scrollToBottom();\n this.requestRender?.();\n try {\n const result = await runBash({\n command,\n excludeFromContext,\n onChunk: (chunk) => {\n bashMessage.output += chunk;\n this.requestRender?.();\n },\n });\n bashMessage.output = result.output;\n bashMessage.exitCode = result.exitCode;\n bashMessage.cancelled = result.cancelled;\n bashMessage.truncated = result.truncated;\n if (result.fullOutputPath !== undefined) {\n bashMessage.fullOutputPath = result.fullOutputPath;\n }\n } catch (err) {\n bashMessage.output = errorMessage(err);\n bashMessage.exitCode = undefined;\n bashMessage.cancelled = false;\n bashMessage.truncated = false;\n } finally {\n bashEntry.isPartial = false;\n this.localBashRunning = false;\n this.requestRender?.();\n }\n }\n\n private async flushCompactionQueue(): Promise<void> {\n const queued = [...this.compactionQueuedMessages];\n this.compactionQueuedMessages = [];\n if (queued.length === 0) return;\n let nextIndex = 0;\n try {\n const first = queued[0];\n if (first !== undefined) {\n await this.requiredCommand(\"prompt\")(first);\n nextIndex = 1;\n }\n for (; nextIndex < queued.length; nextIndex++) {\n await this.queueFollowUp(queued[nextIndex]!);\n }\n } catch (err) {\n this.compactionQueuedMessages = [\n ...queued.slice(nextIndex),\n ...this.compactionQueuedMessages,\n ];\n this.notifyWarning(errorMessage(err));\n this.requestRender?.();\n }\n }\n\n private async queueSteer(text: string): Promise<void> {\n const agentSession = this.getAgentSession?.();\n if (agentSession?.isStreaming) {\n await agentSession.prompt(text, { streamingBehavior: \"steer\" });\n return;\n }\n await this.requiredCommand(\"steer\")(text);\n }\n\n private async queueFollowUp(text: string): Promise<void> {\n const agentSession = this.getAgentSession?.();\n if (agentSession?.isStreaming) {\n await agentSession.prompt(text, { streamingBehavior: \"followUp\" });\n return;\n }\n await this.requiredCommand(\"followUp\")(text);\n }\n\n restoreQueuedMessagesToEditor(): boolean {\n const queuedMessages = [\n ...this.pendingSteeringMessages,\n ...this.pendingFollowUpMessages,\n ...this.compactionQueuedMessages,\n ];\n if (queuedMessages.length === 0) {\n this.notifyStatus(\"No queued messages to restore\");\n return false;\n }\n const restoredText = combineQueuedMessagesForEditor(queuedMessages, this.inputBuffer);\n this.pendingSteeringMessages = [];\n this.pendingFollowUpMessages = [];\n this.compactionQueuedMessages = [];\n this.setEditorText(restoredText);\n this.getAgentSession?.()?.clearQueue();\n this.notifyStatus(\n `Restored ${queuedMessages.length} queued message${queuedMessages.length === 1 ? \"\" : \"s\"} to editor`,\n );\n this.requestRender?.();\n return true;\n }\n\n private notifyWarning(message: string): void {\n this.statusMessage = message;\n this.showWarning?.(message);\n this.requestRender?.();\n }\n\n private notifyStatus(message: string): void {\n this.statusMessage = message;\n this.showStatus?.(message);\n this.requestRender?.();\n }\n\n private requiredCommand(\n name: \"prompt\" | \"steer\" | \"followUp\" | \"resume\",\n ): (text?: string) => Promise<void> {\n switch (name) {\n case \"prompt\":\n return async (text) => {\n if (!this.commands.prompt) throw new Error(\"no prompt command configured for this chat session\");\n await this.commands.prompt(text ?? \"\");\n };\n case \"steer\":\n return async (text) => {\n if (!this.commands.steer) throw new Error(\"no steer command configured for this chat session\");\n await this.commands.steer(text ?? \"\");\n };\n case \"followUp\":\n return async (text) => {\n if (!this.commands.followUp) throw new Error(\"no followUp command configured for this chat session\");\n await this.commands.followUp(text ?? \"\");\n };\n case \"resume\":\n return async (text) => {\n if (!this.commands.resume) throw new Error(\"no resume command configured for this chat session\");\n await this.commands.resume(text);\n };\n }\n }\n\n private afterEvent(changed: boolean): void {\n this.syncAnimationTick();\n if (!changed) return;\n this.requestEventRender();\n }\n\n private requestEventRender(): void {\n if (!this.isStreaming()) {\n this.requestRender?.();\n return;\n }\n if (this.renderThrottleTimer) return;\n this.renderThrottleTimer = setTimeout(() => {\n this.renderThrottleTimer = undefined;\n this.requestRender?.();\n }, STREAMING_RENDER_THROTTLE_MS);\n this.renderThrottleTimer.unref?.();\n }\n}\n\nfunction setEditorPlaceholder(\n editor: EditorComponent,\n placeholder: string | undefined,\n): void {\n const candidate = editor as EditorComponent & {\n setPlaceholder?: (value: string | undefined) => void;\n };\n candidate.setPlaceholder?.(placeholder);\n}\n\nfunction setEditorBorderColor(\n editor: EditorComponent,\n borderColor: (text: string) => string,\n): void {\n const candidate = editor as EditorComponent & {\n borderColor?: (text: string) => string;\n };\n if (candidate.borderColor !== undefined) candidate.borderColor = borderColor;\n}\n\nfunction setEditorFocused(editor: EditorComponent, focused: boolean): void {\n const candidate = editor as EditorComponent & Partial<Focusable>;\n if (\"focused\" in candidate) candidate.focused = focused;\n}\n\nfunction matchesKey(\n data: string,\n key: \"enter\" | \"backspace\" | \"escape\" | \"ctrl+f\" | \"alt+up\",\n): boolean {\n if (key === \"enter\" && (data === \"\\r\" || data === \"\\n\")) return true;\n if (key === \"backspace\" && (data === \"\\x7f\" || data === \"\\b\")) return true;\n if (key === \"escape\" && data === \"\\x1b\") return true;\n if (key === \"ctrl+f\" && data === \"\\x06\") return true;\n return tuiMatchesKey(data, key);\n}\n\nfunction parseBashInput(text: string):\n | { command: string; excludeFromContext: boolean }\n | undefined {\n if (!text.startsWith(\"!\")) return undefined;\n const excludeFromContext = text.startsWith(\"!!\");\n const command = text.slice(excludeFromContext ? 2 : 1).trim();\n return { command, excludeFromContext };\n}\n\nfunction isSharedLiveChatEvent(type: string): boolean {\n return (\n type === \"message_start\" ||\n type === \"message_update\" ||\n type === \"message_end\" ||\n type === \"tool_execution_start\" ||\n type === \"tool_execution_update\" ||\n type === \"tool_execution_end\"\n );\n}\n\nfunction cacheKey(parts: readonly CacheKeyPart[]): string {\n return JSON.stringify(parts);\n}\n\nfunction isChatMessageEntry<TExtraEntry extends ChatTranscriptEntryLike>(\n entry: ChatSessionHostEntry<TExtraEntry>,\n): entry is ChatMessageEntry {\n if (!(\"role\" in entry) || !(\"kind\" in entry)) return false;\n const candidate = entry as { role?: unknown; kind?: unknown; message?: unknown; text?: unknown };\n switch (candidate.kind) {\n case \"assistant\":\n return candidate.role === \"assistant\" && candidate.message !== undefined;\n case \"tool\":\n return candidate.role === \"tool\" && \"toolName\" in candidate && \"toolCallId\" in candidate && \"args\" in candidate;\n case \"bashExecution\":\n return candidate.role === \"tool\" && candidate.message !== undefined;\n case \"user\":\n return candidate.role === \"user\" && typeof candidate.text === \"string\";\n case \"custom\":\n return candidate.role === \"custom\" && candidate.message !== undefined;\n case \"branchSummary\":\n return candidate.role === \"summary\" && candidate.message !== undefined;\n case \"system\":\n return candidate.role === \"system\" && candidate.message !== undefined;\n default:\n return false;\n }\n}\n\nfunction isMessageLike(message: unknown): message is { role?: unknown; content?: unknown } {\n return message !== null && typeof message === \"object\" && \"role\" in message;\n}\n\nfunction isUserMessageLike(\n message: unknown,\n): message is { role: \"user\"; content?: unknown } {\n return isMessageLike(message) && message.role === \"user\";\n}\n\nfunction userMessageSignature(text: string): string {\n return text.trim();\n}\n\nfunction assistantToolCallEvent(event: AgentSessionEvent): {\n type: \"tool_execution_start\";\n toolCallId: string;\n toolName: string;\n args: unknown;\n} | undefined {\n const assistantEvent = (event as {\n assistantMessageEvent?: {\n type?: unknown;\n contentIndex?: unknown;\n partial?: unknown;\n toolCall?: unknown;\n };\n }).assistantMessageEvent;\n const streamType = String(assistantEvent?.type ?? \"\");\n if (!streamType.startsWith(\"toolcall_\")) return undefined;\n const explicit = toolCallPayload(assistantEvent?.toolCall);\n if (explicit) return explicit;\n const contentIndex = typeof assistantEvent?.contentIndex === \"number\" ? assistantEvent.contentIndex : undefined;\n if (contentIndex === undefined) return undefined;\n const partial = assistantEvent?.partial;\n if (!isMessageLike(partial) || partial.role !== \"assistant\") return undefined;\n const content = partial.content;\n if (!Array.isArray(content)) return undefined;\n return toolCallPayload(content[contentIndex]);\n}\n\nfunction toolCallPayload(value: unknown): {\n type: \"tool_execution_start\";\n toolCallId: string;\n toolName: string;\n args: unknown;\n} | undefined {\n if (value === null || typeof value !== \"object\") return undefined;\n const candidate = value as { type?: unknown; id?: unknown; name?: unknown; arguments?: unknown };\n if (candidate.type !== \"toolCall\") return undefined;\n if (typeof candidate.id !== \"string\" || typeof candidate.name !== \"string\") return undefined;\n return {\n type: \"tool_execution_start\",\n toolCallId: candidate.id,\n toolName: candidate.name,\n args: candidate.arguments ?? {},\n };\n}\n\nfunction legacyToolStartEvent(event: AgentSessionEvent): {\n type: \"tool_execution_start\";\n toolCallId: string;\n toolName: string;\n args: unknown;\n} {\n const payload = event as { toolCallId?: unknown; name?: unknown; input?: unknown; args?: unknown };\n const toolName = typeof payload.name === \"string\" ? payload.name : \"tool\";\n const toolCallId =\n typeof payload.toolCallId === \"string\" ? payload.toolCallId : `live-${toolName}`;\n return {\n type: \"tool_execution_start\",\n toolCallId,\n toolName,\n args: payload.input ?? payload.args ?? {},\n };\n}\n\nfunction legacyToolResultEvent(event: AgentSessionEvent): {\n type: \"tool_execution_end\";\n toolCallId: string;\n toolName: string;\n result: unknown;\n isError: boolean;\n} {\n const payload = event as {\n toolCallId?: unknown;\n name?: unknown;\n output?: unknown;\n isError?: unknown;\n };\n const toolName = typeof payload.name === \"string\" ? payload.name : \"tool\";\n const toolCallId =\n typeof payload.toolCallId === \"string\" ? payload.toolCallId : `live-${toolName}`;\n const output = payload.output;\n return {\n type: \"tool_execution_end\",\n toolCallId,\n toolName,\n result:\n output !== null && typeof output === \"object\" && \"content\" in output\n ? output\n : { content: typeof output === \"string\" ? [{ type: \"text\", text: output }] : [] },\n isError: payload.isError === true,\n };\n}\n\nfunction legacyThinkingEvent(event: AgentSessionEvent): {\n type: \"message_update\";\n assistantMessageEvent: { type: \"thinking_delta\"; delta: string };\n message: { role: \"assistant\"; content: [] };\n} {\n const delta = String(\n (event as { delta?: unknown }).delta ??\n (event as { text?: unknown }).text ??\n \"\",\n );\n return {\n type: \"message_update\",\n assistantMessageEvent: { type: \"thinking_delta\", delta },\n message: { role: \"assistant\", content: [] },\n };\n}\n\nfunction extractMessageText(content: unknown): string {\n if (typeof content === \"string\") return content;\n if (!Array.isArray(content)) return \"\";\n const parts: string[] = [];\n for (const item of content) {\n if (item == null) continue;\n if (typeof item === \"string\") {\n parts.push(item);\n continue;\n }\n const obj = item as { type?: unknown; text?: unknown };\n if (typeof obj.text === \"string\") parts.push(obj.text);\n else if (obj.type === \"text\" && typeof obj.text === \"string\") parts.push(obj.text);\n }\n return parts.join(\"\");\n}\n\nfunction tailStreamingText(text: string): string {\n if (\n text.length <= STREAMING_TEXT_TAIL_CHARS &&\n text.split(\"\\n\").length <= STREAMING_TEXT_TAIL_LINES\n ) {\n return text;\n }\n const byChars = text.slice(-STREAMING_TEXT_TAIL_CHARS);\n const lines = byChars.split(\"\\n\");\n const tail =\n lines.length > STREAMING_TEXT_TAIL_LINES\n ? lines.slice(-STREAMING_TEXT_TAIL_LINES).join(\"\\n\")\n : byChars;\n return `[earlier streaming output hidden while attached]\\n\\n${tail.trimStart()}`;\n}\n\nfunction spinnerFrame(): string {\n const idx = Math.floor(Date.now() / 80) % SPINNER_FRAMES.length;\n return SPINNER_FRAMES[idx]!;\n}\n\nfunction stripAnsi(s: string): string {\n return s.replace(/\\x1B\\[[0-?]*[ -/]*[@-~]/g, \"\");\n}\n\nfunction errorMessage(error: unknown): string {\n return error instanceof Error ? error.message : String(error);\n}\n"]}
1
+ {"version":3,"file":"chat-session-host.d.ts","sourceRoot":"","sources":["../../../../src/modes/interactive/components/chat-session-host.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAC;AACxE,OAAO,EAAE,KAAK,SAAS,EAAE,KAAK,SAAS,EAAE,MAAM,wBAAwB,CAAC;AAExE,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,sBAAsB,CAAC;AA8BpE,OAAO,KAAK,EACV,oBAAoB,EACpB,oBAAoB,EACpB,mBAAmB,EACpB,MAAM,8BAA8B,CAAC;AAEtC,YAAY,EACV,0BAA0B,EAC1B,uBAAuB,EACvB,oBAAoB,EACpB,mBAAmB,EACnB,oBAAoB,GACrB,MAAM,8BAA8B,CAAC;AAEtC,qBAAa,eAAe,CAAC,WAAW,SAAS,uBAAuB,GAAG,KAAK,CAC9E,YAAW,SAAS,EAAE,SAAS;IAE/B,OAAO,UA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B;IAED,oBAAoB,IAAI,OAAO,CAE9B;IAED,YAAY,IAAI,OAAO,CAEtB;IAED,gBAAgB,IAAI,OAAO,CAE1B;IAED,oBAAoB,IAAI,MAAM,CAE7B;IAED,aAAa,IAAI,MAAM,CAEtB;IAED,SAAS,IAAI,MAAM,CAElB;IAED,UAAU,IAAI,MAAM,CAEnB;IAED,cAAc,IAAI,IAAI,CAErB;IAED,iBAAiB,IAAI,IAAI,CAExB;IAED,OAAO,IAAI,IAAI,CAEd;IAED,6BAA6B,IAAI,OAAO,CAEvC;IAED,OAAO,CAAC,eAAe;CAexB","sourcesContent":["import type { AgentSessionEvent } from \"../../../core/agent-session.ts\";\nimport { type Component, type Focusable } from \"@earendil-works/pi-tui\";\nimport { SessionManager } from \"../../../core/session-manager.ts\";\nimport type { ChatTranscriptEntryLike } from \"./chat-transcript.ts\";\nimport {\n abortChatSessionBash,\n abortChatSessionCompaction,\n interruptChatSession,\n restoreQueuedMessagesToEditor,\n submitChatSession,\n} from \"./chat-session-host-actions.ts\";\nimport {\n createChatSessionEditor,\n handleChatSessionInput,\n} from \"./chat-session-host-editor.ts\";\nimport { applyChatSessionAgentEvent } from \"./chat-session-host-events.ts\";\nimport {\n renderChatSessionBody,\n renderChatSessionEditor,\n renderChatSessionEntry,\n renderChatSessionFooter,\n renderChatSessionPendingMessages,\n renderChatSessionUsage,\n renderChatSessionWorkingStatus,\n transcriptCacheKey,\n} from \"./chat-session-host-rendering.ts\";\nimport {\n disposeChatSession,\n isChatSessionBashRunning,\n isChatSessionStreaming,\n syncChatSessionAnimationTick,\n} from \"./chat-session-host-runtime.ts\";\nimport { ChatSessionHostState } from \"./chat-session-host-state.ts\";\nimport type {\n AgentSnapshotMessage,\n ChatSessionHostEntry,\n ChatSessionHostOpts,\n} from \"./chat-session-host-types.ts\";\n\nexport type {\n ChatSessionHostBashRequest,\n ChatSessionHostCommands,\n ChatSessionHostEntry,\n ChatSessionHostOpts,\n ChatSessionHostStyle,\n} from \"./chat-session-host-types.ts\";\n\nexport class ChatSessionHost<TExtraEntry extends ChatTranscriptEntryLike = never>\n implements Component, Focusable\n{\n focused = true;\n\n private readonly state: ChatSessionHostState<TExtraEntry>;\n\n constructor(opts: ChatSessionHostOpts<TExtraEntry>) {\n this.state = new ChatSessionHostState(opts, {\n renderEntry: (state, entry) => renderChatSessionEntry(state, entry),\n transcriptCacheKey: (state, entry, index) => transcriptCacheKey(state, entry, index),\n });\n this.state.editor = createChatSessionEditor(\n this.state,\n opts.tui,\n opts.keybindings,\n opts.editorTheme,\n opts.editorFactory,\n this.editorCallbacks(),\n );\n this.syncAnimationTick();\n }\n\n appendMessages(messages: readonly AgentSnapshotMessage[]): void {\n this.state.liveChat.appendMessages(messages);\n }\n\n loadSessionFile(sessionFile: string | undefined): void {\n if (this.state.transcript.length > 0 || sessionFile === undefined) return;\n let messages: readonly AgentSnapshotMessage[];\n try {\n messages = SessionManager.open(sessionFile).buildSessionContext()\n .messages as readonly AgentSnapshotMessage[];\n } catch {\n return;\n }\n this.state.liveChat.appendMessages(messages);\n }\n\n appendExtraEntry(entry: TExtraEntry): void {\n this.state.transcript.push(entry);\n }\n\n entries(): readonly ChatSessionHostEntry<TExtraEntry>[] {\n return this.state.transcript;\n }\n\n applyAgentEvent(event: AgentSessionEvent): boolean {\n return applyChatSessionAgentEvent(this.state, event);\n }\n\n render(width: number): string[] {\n return this.renderBody(width, 1);\n }\n\n invalidate(): void {\n this.state.transcriptComponent.invalidate();\n this.state.bodyViewport.invalidate();\n this.state.editor?.invalidate();\n }\n\n renderBody(width: number, budget: number): string[] {\n return renderChatSessionBody(this.state, width, budget);\n }\n\n renderPendingMessages(width: number): string[] {\n return renderChatSessionPendingMessages(this.state, width);\n }\n\n renderWorkingStatus(width: number): string[] {\n return renderChatSessionWorkingStatus(this.state, width);\n }\n\n renderUsage(width: number): string[] {\n return renderChatSessionUsage(this.state, width);\n }\n\n renderEditor(width: number): string[] {\n return renderChatSessionEditor(this.state, width, this.focused);\n }\n\n renderFooter(width: number): string[] {\n return renderChatSessionFooter(this.state, width);\n }\n\n handleScrollInput(data: string): boolean {\n return this.state.bodyViewport.handleInput(data);\n }\n\n handleInput(data: string): boolean {\n return handleChatSessionInput(this.state, data, this.editorCallbacks());\n }\n\n async interrupt(): Promise<void> {\n await interruptChatSession(this.state);\n }\n\n async submit(mode: \"auto\" | \"followUp\" = \"auto\", submittedText?: string): Promise<void> {\n await submitChatSession(this.state, mode, submittedText);\n }\n\n isStreaming(): boolean {\n return isChatSessionStreaming(this.state);\n }\n\n isBashRunning(): boolean {\n return isChatSessionBashRunning(this.state);\n }\n\n isEditingBashCommand(): boolean {\n return this.state.isBashMode;\n }\n\n hasInputText(): boolean {\n return this.state.inputBuffer.length > 0;\n }\n\n hasAnimationTick(): boolean {\n return this.state.animationTimer !== undefined;\n }\n\n bodyScrollFromBottom(): number {\n return this.state.bodyViewport.getScrollFromBottom();\n }\n\n bodyMaxScroll(): number {\n return this.state.bodyViewport.getMaxScroll();\n }\n\n inputText(): string {\n return this.state.inputBuffer;\n }\n\n statusText(): string {\n return this.state.statusMessage;\n }\n\n scrollToBottom(): void {\n this.state.bodyViewport.scrollToBottom();\n }\n\n syncAnimationTick(): void {\n syncChatSessionAnimationTick(this.state);\n }\n\n dispose(): void {\n disposeChatSession(this.state);\n }\n\n restoreQueuedMessagesToEditor(): boolean {\n return restoreQueuedMessagesToEditor(this.state);\n }\n\n private editorCallbacks(): {\n submit: (mode: \"auto\" | \"followUp\", submittedText?: string) => void | Promise<void>;\n restoreQueuedMessagesToEditor: () => boolean;\n abortCompaction: () => void | Promise<void>;\n interrupt: () => void | Promise<void>;\n abortBash: () => void | Promise<void>;\n } {\n return {\n submit: (mode, submittedText) => this.submit(mode, submittedText),\n restoreQueuedMessagesToEditor: () => this.restoreQueuedMessagesToEditor(),\n abortCompaction: () => abortChatSessionCompaction(this.state),\n interrupt: () => this.interrupt(),\n abortBash: () => abortChatSessionBash(this.state),\n };\n }\n}\n"]}