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

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 (1357) hide show
  1. package/CHANGELOG.md +5 -1
  2. package/dist/builtin/cursor/CHANGELOG.md +4 -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 +3 -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 +1 -1
  26. package/dist/builtin/intercom/subagent-relay.ts +137 -0
  27. package/dist/builtin/mcp/CHANGELOG.md +3 -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 +1 -1
  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 +3 -0
  45. package/dist/builtin/subagents/package.json +1 -1
  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 +3 -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 +2 -1
  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 +4 -1
  176. package/dist/builtin/workflows/builtin/deep-research-codebase-runner.ts +492 -0
  177. package/dist/builtin/workflows/builtin/deep-research-codebase-utils.ts +346 -0
  178. package/dist/builtin/workflows/builtin/deep-research-codebase.ts +6 -822
  179. package/dist/builtin/workflows/builtin/goal-artifacts.ts +43 -0
  180. package/dist/builtin/workflows/builtin/goal-ledger.ts +54 -0
  181. package/dist/builtin/workflows/builtin/goal-prompts.ts +360 -0
  182. package/dist/builtin/workflows/builtin/goal-reducer.ts +141 -0
  183. package/dist/builtin/workflows/builtin/goal-reports.ts +56 -0
  184. package/dist/builtin/workflows/builtin/goal-review.ts +84 -0
  185. package/dist/builtin/workflows/builtin/goal-runner.ts +343 -0
  186. package/dist/builtin/workflows/builtin/goal-schemas.ts +60 -0
  187. package/dist/builtin/workflows/builtin/goal-types.ts +132 -0
  188. package/dist/builtin/workflows/builtin/goal.ts +4 -1160
  189. package/dist/builtin/workflows/builtin/open-claude-design-phases.ts +432 -0
  190. package/dist/builtin/workflows/builtin/open-claude-design-runner.ts +477 -0
  191. package/dist/builtin/workflows/builtin/open-claude-design-utils.ts +312 -0
  192. package/dist/builtin/workflows/builtin/open-claude-design.ts +7 -1083
  193. package/dist/builtin/workflows/builtin/ralph-core.ts +408 -0
  194. package/dist/builtin/workflows/builtin/ralph-models.ts +123 -0
  195. package/dist/builtin/workflows/builtin/ralph-runner.ts +499 -0
  196. package/dist/builtin/workflows/builtin/ralph.ts +7 -979
  197. package/dist/builtin/workflows/package.json +1 -1
  198. package/dist/builtin/workflows/skills/impeccable/scripts/detector/detect-antipatterns-browser.js +2 -2
  199. package/dist/builtin/workflows/skills/impeccable/scripts/detector/engines/regex/detect-text.mjs +2 -2
  200. package/dist/builtin/workflows/skills/impeccable/scripts/detector/rules/checks.mjs +2 -2
  201. package/dist/builtin/workflows/skills/impeccable/scripts/detector/shared/page.mjs +8 -1
  202. package/dist/builtin/workflows/skills/impeccable/scripts/live-accept.mjs +13 -15
  203. package/dist/builtin/workflows/skills/impeccable/scripts/live-manual-edit-evidence.mjs +2 -2
  204. package/dist/builtin/workflows/skills/impeccable/scripts/live-server.mjs +9 -0
  205. package/dist/builtin/workflows/src/extension/atomic-stage-session.ts +186 -0
  206. package/dist/builtin/workflows/src/extension/config-file-loader.ts +152 -0
  207. package/dist/builtin/workflows/src/extension/config-loader.ts +2 -167
  208. package/dist/builtin/workflows/src/extension/discovery-loaders.ts +115 -0
  209. package/dist/builtin/workflows/src/extension/discovery.ts +3 -117
  210. package/dist/builtin/workflows/src/extension/extension-factory.ts +120 -0
  211. package/dist/builtin/workflows/src/extension/extension-lifecycle.ts +109 -0
  212. package/dist/builtin/workflows/src/extension/extension-runtime-state.ts +270 -0
  213. package/dist/builtin/workflows/src/extension/index.ts +42 -4166
  214. package/dist/builtin/workflows/src/extension/public-types.ts +295 -0
  215. package/dist/builtin/workflows/src/extension/render-component.ts +14 -0
  216. package/dist/builtin/workflows/src/extension/runtime-direct.ts +96 -0
  217. package/dist/builtin/workflows/src/extension/runtime.ts +1 -92
  218. package/dist/builtin/workflows/src/extension/ui-surface.ts +286 -0
  219. package/dist/builtin/workflows/src/extension/wiring.ts +6 -475
  220. package/dist/builtin/workflows/src/extension/workflow-command-completions.ts +111 -0
  221. package/dist/builtin/workflows/src/extension/workflow-command-registration.ts +213 -0
  222. package/dist/builtin/workflows/src/extension/workflow-command-surfaces.ts +81 -0
  223. package/dist/builtin/workflows/src/extension/workflow-command-utils.ts +181 -0
  224. package/dist/builtin/workflows/src/extension/workflow-policy.ts +15 -0
  225. package/dist/builtin/workflows/src/extension/workflow-ports.ts +41 -0
  226. package/dist/builtin/workflows/src/extension/workflow-prompts.ts +23 -0
  227. package/dist/builtin/workflows/src/extension/workflow-run-control-command.ts +286 -0
  228. package/dist/builtin/workflows/src/extension/workflow-schema.ts +1 -1
  229. package/dist/builtin/workflows/src/extension/workflow-stage-results.ts +264 -0
  230. package/dist/builtin/workflows/src/extension/workflow-targets.ts +181 -0
  231. package/dist/builtin/workflows/src/extension/workflow-tool-content.ts +175 -0
  232. package/dist/builtin/workflows/src/extension/workflow-tool-control.ts +205 -0
  233. package/dist/builtin/workflows/src/extension/workflow-tool-helpers.ts +66 -0
  234. package/dist/builtin/workflows/src/extension/workflow-tool-inspection.ts +164 -0
  235. package/dist/builtin/workflows/src/extension/workflow-tool-registration.ts +54 -0
  236. package/dist/builtin/workflows/src/extension/workflow-tool-send.ts +164 -0
  237. package/dist/builtin/workflows/src/extension/workflow-tool.ts +102 -0
  238. package/dist/builtin/workflows/src/runs/foreground/executor-abort.ts +431 -0
  239. package/dist/builtin/workflows/src/runs/foreground/executor-child-boundary.ts +232 -0
  240. package/dist/builtin/workflows/src/runs/foreground/executor-child-helpers.ts +74 -0
  241. package/dist/builtin/workflows/src/runs/foreground/executor-child-workflow.ts +158 -0
  242. package/dist/builtin/workflows/src/runs/foreground/executor-continuation.ts +167 -0
  243. package/dist/builtin/workflows/src/runs/foreground/executor-direct-helpers.ts +450 -0
  244. package/dist/builtin/workflows/src/runs/foreground/executor-direct.ts +233 -0
  245. package/dist/builtin/workflows/src/runs/foreground/executor-exit-manager.ts +195 -0
  246. package/dist/builtin/workflows/src/runs/foreground/executor-hil.ts +368 -0
  247. package/dist/builtin/workflows/src/runs/foreground/executor-inputs.ts +83 -0
  248. package/dist/builtin/workflows/src/runs/foreground/executor-lifecycle.ts +441 -0
  249. package/dist/builtin/workflows/src/runs/foreground/executor-outputs.ts +160 -0
  250. package/dist/builtin/workflows/src/runs/foreground/executor-prompt-nodes.ts +274 -0
  251. package/dist/builtin/workflows/src/runs/foreground/executor-run-finalizers.ts +122 -0
  252. package/dist/builtin/workflows/src/runs/foreground/executor-run.ts +359 -0
  253. package/dist/builtin/workflows/src/runs/foreground/executor-scheduler.ts +204 -0
  254. package/dist/builtin/workflows/src/runs/foreground/executor-stage-call.ts +197 -0
  255. package/dist/builtin/workflows/src/runs/foreground/executor-stage-context.ts +120 -0
  256. package/dist/builtin/workflows/src/runs/foreground/executor-stage-control.ts +126 -0
  257. package/dist/builtin/workflows/src/runs/foreground/executor-stage-factory.ts +351 -0
  258. package/dist/builtin/workflows/src/runs/foreground/executor-stage-replay.ts +134 -0
  259. package/dist/builtin/workflows/src/runs/foreground/executor-stage-types.ts +54 -0
  260. package/dist/builtin/workflows/src/runs/foreground/executor-task-context.ts +132 -0
  261. package/dist/builtin/workflows/src/runs/foreground/executor-task-prompts.ts +293 -0
  262. package/dist/builtin/workflows/src/runs/foreground/executor-types.ts +109 -0
  263. package/dist/builtin/workflows/src/runs/foreground/executor.ts +19 -5354
  264. package/dist/builtin/workflows/src/runs/foreground/stage-runner-context.ts +219 -0
  265. package/dist/builtin/workflows/src/runs/foreground/stage-runner-controller.ts +500 -0
  266. package/dist/builtin/workflows/src/runs/foreground/stage-runner-messages.ts +129 -0
  267. package/dist/builtin/workflows/src/runs/foreground/stage-runner-options.ts +53 -0
  268. package/dist/builtin/workflows/src/runs/foreground/stage-runner-output.ts +146 -0
  269. package/dist/builtin/workflows/src/runs/foreground/stage-runner-session.ts +55 -0
  270. package/dist/builtin/workflows/src/runs/foreground/stage-runner-structured-output.ts +82 -0
  271. package/dist/builtin/workflows/src/runs/foreground/stage-runner-types.ts +141 -0
  272. package/dist/builtin/workflows/src/runs/foreground/stage-runner.ts +13 -1355
  273. package/dist/builtin/workflows/src/runs/shared/model-fallback-candidates.ts +453 -0
  274. package/dist/builtin/workflows/src/runs/shared/model-fallback-failures.ts +442 -0
  275. package/dist/builtin/workflows/src/runs/shared/model-fallback.ts +2 -836
  276. package/dist/builtin/workflows/src/runs/shared/worktree-diff.ts +165 -0
  277. package/dist/builtin/workflows/src/runs/shared/worktree-git.ts +220 -0
  278. package/dist/builtin/workflows/src/runs/shared/worktree-setup.ts +335 -0
  279. package/dist/builtin/workflows/src/runs/shared/worktree-types.ts +92 -0
  280. package/dist/builtin/workflows/src/runs/shared/worktree.ts +18 -791
  281. package/dist/builtin/workflows/src/shared/authoring-contract-stage.d.ts +365 -0
  282. package/dist/builtin/workflows/src/shared/authoring-contract-stage.ts +425 -0
  283. package/dist/builtin/workflows/src/shared/authoring-contract-ui.d.ts +236 -0
  284. package/dist/builtin/workflows/src/shared/authoring-contract-ui.ts +354 -0
  285. package/dist/builtin/workflows/src/shared/authoring-contract.d.ts +5 -598
  286. package/dist/builtin/workflows/src/shared/persistence-restore-helpers.ts +428 -0
  287. package/dist/builtin/workflows/src/shared/persistence-restore.ts +9 -431
  288. package/dist/builtin/workflows/src/shared/store-factory.ts +16 -0
  289. package/dist/builtin/workflows/src/shared/store-internal.ts +219 -0
  290. package/dist/builtin/workflows/src/shared/store-prompt-methods.ts +219 -0
  291. package/dist/builtin/workflows/src/shared/store-public-types.ts +215 -0
  292. package/dist/builtin/workflows/src/shared/store-run-methods.ts +223 -0
  293. package/dist/builtin/workflows/src/shared/store-stage-methods.ts +305 -0
  294. package/dist/builtin/workflows/src/shared/store.ts +11 -1138
  295. package/dist/builtin/workflows/src/shared/workflow-failures-classifier.ts +266 -0
  296. package/dist/builtin/workflows/src/shared/workflow-failures-contract.ts +75 -0
  297. package/dist/builtin/workflows/src/shared/workflow-failures-decisions.ts +477 -0
  298. package/dist/builtin/workflows/src/shared/workflow-failures-signals.ts +248 -0
  299. package/dist/builtin/workflows/src/shared/workflow-failures.ts +13 -1001
  300. package/dist/builtin/workflows/src/tui/chat-surface.ts +0 -66
  301. package/dist/builtin/workflows/src/tui/graph-view-constants.ts +45 -0
  302. package/dist/builtin/workflows/src/tui/graph-view-graph-render.ts +161 -0
  303. package/dist/builtin/workflows/src/tui/graph-view-input.ts +333 -0
  304. package/dist/builtin/workflows/src/tui/graph-view-render-helpers.ts +336 -0
  305. package/dist/builtin/workflows/src/tui/graph-view-render.ts +194 -0
  306. package/dist/builtin/workflows/src/tui/graph-view-state.ts +306 -0
  307. package/dist/builtin/workflows/src/tui/graph-view-types.ts +70 -0
  308. package/dist/builtin/workflows/src/tui/graph-view.ts +4 -1386
  309. package/dist/builtin/workflows/src/tui/inline-form-editor-text.ts +121 -0
  310. package/dist/builtin/workflows/src/tui/inline-form-editor.ts +11 -223
  311. package/dist/builtin/workflows/src/tui/inputs-picker-editing.ts +151 -0
  312. package/dist/builtin/workflows/src/tui/inputs-picker-input.ts +305 -0
  313. package/dist/builtin/workflows/src/tui/inputs-picker-render.ts +300 -0
  314. package/dist/builtin/workflows/src/tui/inputs-picker-types.ts +190 -0
  315. package/dist/builtin/workflows/src/tui/inputs-picker.ts +19 -997
  316. package/dist/builtin/workflows/src/tui/prompt-card-input.ts +226 -0
  317. package/dist/builtin/workflows/src/tui/prompt-card-render.ts +373 -0
  318. package/dist/builtin/workflows/src/tui/prompt-card-select.ts +116 -0
  319. package/dist/builtin/workflows/src/tui/prompt-card-state.ts +61 -0
  320. package/dist/builtin/workflows/src/tui/prompt-card-text.ts +129 -0
  321. package/dist/builtin/workflows/src/tui/prompt-card.ts +8 -910
  322. package/dist/builtin/workflows/src/tui/stage-chat-view-archive-history.ts +315 -0
  323. package/dist/builtin/workflows/src/tui/stage-chat-view-custom-ui.ts +127 -0
  324. package/dist/builtin/workflows/src/tui/stage-chat-view-footer-status.ts +187 -0
  325. package/dist/builtin/workflows/src/tui/stage-chat-view-input.ts +222 -0
  326. package/dist/builtin/workflows/src/tui/stage-chat-view-render-helpers.ts +152 -0
  327. package/dist/builtin/workflows/src/tui/stage-chat-view-state.ts +464 -0
  328. package/dist/builtin/workflows/src/tui/stage-chat-view-transcript.ts +242 -0
  329. package/dist/builtin/workflows/src/tui/stage-chat-view-types.ts +151 -0
  330. package/dist/builtin/workflows/src/tui/stage-chat-view.ts +141 -1777
  331. package/dist/builtin/workflows/src/tui/workflow-attach-pane-types.ts +85 -0
  332. package/dist/builtin/workflows/src/tui/workflow-attach-pane.ts +1 -129
  333. package/dist/config-self-update.d.ts +21 -0
  334. package/dist/config-self-update.d.ts.map +1 -0
  335. package/dist/config-self-update.js +265 -0
  336. package/dist/config-self-update.js.map +1 -0
  337. package/dist/config.d.ts +3 -12
  338. package/dist/config.d.ts.map +1 -1
  339. package/dist/config.js +15 -252
  340. package/dist/config.js.map +1 -1
  341. package/dist/core/agent-session-accessors.d.ts +3 -0
  342. package/dist/core/agent-session-accessors.d.ts.map +1 -0
  343. package/dist/core/agent-session-accessors.js +36 -0
  344. package/dist/core/agent-session-accessors.js.map +1 -0
  345. package/dist/core/agent-session-auto-compaction.d.ts +32 -0
  346. package/dist/core/agent-session-auto-compaction.d.ts.map +1 -0
  347. package/dist/core/agent-session-auto-compaction.js +214 -0
  348. package/dist/core/agent-session-auto-compaction.js.map +1 -0
  349. package/dist/core/agent-session-bash.d.ts +30 -0
  350. package/dist/core/agent-session-bash.d.ts.map +1 -0
  351. package/dist/core/agent-session-bash.js +84 -0
  352. package/dist/core/agent-session-bash.js.map +1 -0
  353. package/dist/core/agent-session-compaction.d.ts +44 -0
  354. package/dist/core/agent-session-compaction.d.ts.map +1 -0
  355. package/dist/core/agent-session-compaction.js +282 -0
  356. package/dist/core/agent-session-compaction.js.map +1 -0
  357. package/dist/core/agent-session-events.d.ts +65 -0
  358. package/dist/core/agent-session-events.d.ts.map +1 -0
  359. package/dist/core/agent-session-events.js +373 -0
  360. package/dist/core/agent-session-events.js.map +1 -0
  361. package/dist/core/agent-session-export.d.ts +42 -0
  362. package/dist/core/agent-session-export.d.ts.map +1 -0
  363. package/dist/core/agent-session-export.js +199 -0
  364. package/dist/core/agent-session-export.js.map +1 -0
  365. package/dist/core/agent-session-extension-bindings.d.ts +37 -0
  366. package/dist/core/agent-session-extension-bindings.d.ts.map +1 -0
  367. package/dist/core/agent-session-extension-bindings.js +231 -0
  368. package/dist/core/agent-session-extension-bindings.js.map +1 -0
  369. package/dist/core/agent-session-message-queue.d.ts +85 -0
  370. package/dist/core/agent-session-message-queue.d.ts.map +1 -0
  371. package/dist/core/agent-session-message-queue.js +264 -0
  372. package/dist/core/agent-session-message-queue.js.map +1 -0
  373. package/dist/core/agent-session-methods.d.ts +302 -0
  374. package/dist/core/agent-session-methods.d.ts.map +1 -0
  375. package/dist/core/agent-session-methods.js +2 -0
  376. package/dist/core/agent-session-methods.js.map +1 -0
  377. package/dist/core/agent-session-models.d.ts +111 -0
  378. package/dist/core/agent-session-models.d.ts.map +1 -0
  379. package/dist/core/agent-session-models.js +368 -0
  380. package/dist/core/agent-session-models.js.map +1 -0
  381. package/dist/core/agent-session-prompt.d.ts +61 -0
  382. package/dist/core/agent-session-prompt.d.ts.map +1 -0
  383. package/dist/core/agent-session-prompt.js +330 -0
  384. package/dist/core/agent-session-prompt.js.map +1 -0
  385. package/dist/core/agent-session-retry.d.ts +62 -0
  386. package/dist/core/agent-session-retry.d.ts.map +1 -0
  387. package/dist/core/agent-session-retry.js +202 -0
  388. package/dist/core/agent-session-retry.js.map +1 -0
  389. package/dist/core/agent-session-skill-block.d.ts +13 -0
  390. package/dist/core/agent-session-skill-block.d.ts.map +1 -0
  391. package/dist/core/agent-session-skill-block.js +37 -0
  392. package/dist/core/agent-session-skill-block.js.map +1 -0
  393. package/dist/core/agent-session-state.d.ts +48 -0
  394. package/dist/core/agent-session-state.d.ts.map +1 -0
  395. package/dist/core/agent-session-state.js +129 -0
  396. package/dist/core/agent-session-state.js.map +1 -0
  397. package/dist/core/agent-session-tool-hooks.d.ts +7 -0
  398. package/dist/core/agent-session-tool-hooks.d.ts.map +1 -0
  399. package/dist/core/agent-session-tool-hooks.js +72 -0
  400. package/dist/core/agent-session-tool-hooks.js.map +1 -0
  401. package/dist/core/agent-session-tool-registry.d.ts +15 -0
  402. package/dist/core/agent-session-tool-registry.d.ts.map +1 -0
  403. package/dist/core/agent-session-tool-registry.js +151 -0
  404. package/dist/core/agent-session-tool-registry.js.map +1 -0
  405. package/dist/core/agent-session-tree.d.ts +46 -0
  406. package/dist/core/agent-session-tree.d.ts.map +1 -0
  407. package/dist/core/agent-session-tree.js +217 -0
  408. package/dist/core/agent-session-tree.js.map +1 -0
  409. package/dist/core/agent-session-types.d.ts +159 -0
  410. package/dist/core/agent-session-types.d.ts.map +1 -0
  411. package/dist/core/agent-session-types.js +41 -0
  412. package/dist/core/agent-session-types.js.map +1 -0
  413. package/dist/core/agent-session.d.ts +68 -688
  414. package/dist/core/agent-session.d.ts.map +1 -1
  415. package/dist/core/agent-session.js +26 -3152
  416. package/dist/core/agent-session.js.map +1 -1
  417. package/dist/core/auth-storage-backends.d.ts +49 -0
  418. package/dist/core/auth-storage-backends.d.ts.map +1 -0
  419. package/dist/core/auth-storage-backends.js +185 -0
  420. package/dist/core/auth-storage-backends.js.map +1 -0
  421. package/dist/core/auth-storage.d.ts +2 -49
  422. package/dist/core/auth-storage.d.ts.map +1 -1
  423. package/dist/core/auth-storage.js +3 -183
  424. package/dist/core/auth-storage.js.map +1 -1
  425. package/dist/core/compaction/context-compaction-metrics.d.ts +16 -0
  426. package/dist/core/compaction/context-compaction-metrics.d.ts.map +1 -0
  427. package/dist/core/compaction/context-compaction-metrics.js +58 -0
  428. package/dist/core/compaction/context-compaction-metrics.js.map +1 -0
  429. package/dist/core/compaction/context-compaction-prompt.d.ts +9 -0
  430. package/dist/core/compaction/context-compaction-prompt.d.ts.map +1 -0
  431. package/dist/core/compaction/context-compaction-prompt.js +161 -0
  432. package/dist/core/compaction/context-compaction-prompt.js.map +1 -0
  433. package/dist/core/compaction/context-compaction-runner.d.ts +5 -0
  434. package/dist/core/compaction/context-compaction-runner.d.ts.map +1 -0
  435. package/dist/core/compaction/context-compaction-runner.js +181 -0
  436. package/dist/core/compaction/context-compaction-runner.js.map +1 -0
  437. package/dist/core/compaction/context-compaction-strategy.d.ts +5 -0
  438. package/dist/core/compaction/context-compaction-strategy.d.ts.map +1 -0
  439. package/dist/core/compaction/context-compaction-strategy.js +27 -0
  440. package/dist/core/compaction/context-compaction-strategy.js.map +1 -0
  441. package/dist/core/compaction/context-compaction-types.d.ts +73 -0
  442. package/dist/core/compaction/context-compaction-types.d.ts.map +1 -0
  443. package/dist/core/compaction/context-compaction-types.js +6 -0
  444. package/dist/core/compaction/context-compaction-types.js.map +1 -0
  445. package/dist/core/compaction/context-compaction.d.ts +9 -200
  446. package/dist/core/compaction/context-compaction.d.ts.map +1 -1
  447. package/dist/core/compaction/context-compaction.js +7 -1943
  448. package/dist/core/compaction/context-compaction.js.map +1 -1
  449. package/dist/core/compaction/context-deletion-application.d.ts +13 -0
  450. package/dist/core/compaction/context-deletion-application.d.ts.map +1 -0
  451. package/dist/core/compaction/context-deletion-application.js +259 -0
  452. package/dist/core/compaction/context-deletion-application.js.map +1 -0
  453. package/dist/core/compaction/context-deletion-store.d.ts +78 -0
  454. package/dist/core/compaction/context-deletion-store.d.ts.map +1 -0
  455. package/dist/core/compaction/context-deletion-store.js +162 -0
  456. package/dist/core/compaction/context-deletion-store.js.map +1 -0
  457. package/dist/core/compaction/context-deletion-targets.d.ts +40 -0
  458. package/dist/core/compaction/context-deletion-targets.d.ts.map +1 -0
  459. package/dist/core/compaction/context-deletion-targets.js +267 -0
  460. package/dist/core/compaction/context-deletion-targets.js.map +1 -0
  461. package/dist/core/compaction/context-deletion-tool-definitions.d.ts +187 -0
  462. package/dist/core/compaction/context-deletion-tool-definitions.d.ts.map +1 -0
  463. package/dist/core/compaction/context-deletion-tool-definitions.js +98 -0
  464. package/dist/core/compaction/context-deletion-tool-definitions.js.map +1 -0
  465. package/dist/core/compaction/context-deletion-tool-helpers.d.ts +19 -0
  466. package/dist/core/compaction/context-deletion-tool-helpers.d.ts.map +1 -0
  467. package/dist/core/compaction/context-deletion-tool-helpers.js +137 -0
  468. package/dist/core/compaction/context-deletion-tool-helpers.js.map +1 -0
  469. package/dist/core/compaction/context-deletion-tools.d.ts +4 -0
  470. package/dist/core/compaction/context-deletion-tools.d.ts.map +1 -0
  471. package/dist/core/compaction/context-deletion-tools.js +395 -0
  472. package/dist/core/compaction/context-deletion-tools.js.map +1 -0
  473. package/dist/core/compaction/context-transcript-analysis.d.ts +9 -0
  474. package/dist/core/compaction/context-transcript-analysis.d.ts.map +1 -0
  475. package/dist/core/compaction/context-transcript-analysis.js +234 -0
  476. package/dist/core/compaction/context-transcript-analysis.js.map +1 -0
  477. package/dist/core/export-html/index.d.ts.map +1 -1
  478. package/dist/core/export-html/index.js +2 -1
  479. package/dist/core/export-html/index.js.map +1 -1
  480. package/dist/core/export-html/template-js/data-tree.js +287 -0
  481. package/dist/core/export-html/template-js/entries-navigation.js +424 -0
  482. package/dist/core/export-html/template-js/initialization.js +312 -0
  483. package/dist/core/export-html/template-js/message-tools.js +415 -0
  484. package/dist/core/export-html/template-js/tree-filter-render.js +421 -0
  485. package/dist/core/export-html/template-script.d.ts +3 -0
  486. package/dist/core/export-html/template-script.d.ts.map +1 -0
  487. package/dist/core/export-html/template-script.js +13 -0
  488. package/dist/core/export-html/template-script.js.map +1 -0
  489. package/dist/core/export-html/template.js +3 -1
  490. package/dist/core/extensions/agent-events.d.ts +159 -0
  491. package/dist/core/extensions/agent-events.d.ts.map +1 -0
  492. package/dist/core/extensions/agent-events.js +2 -0
  493. package/dist/core/extensions/agent-events.js.map +1 -0
  494. package/dist/core/extensions/api-types.d.ts +189 -0
  495. package/dist/core/extensions/api-types.d.ts.map +1 -0
  496. package/dist/core/extensions/api-types.js +2 -0
  497. package/dist/core/extensions/api-types.js.map +1 -0
  498. package/dist/core/extensions/command-types.d.ts +14 -0
  499. package/dist/core/extensions/command-types.d.ts.map +1 -0
  500. package/dist/core/extensions/command-types.js +2 -0
  501. package/dist/core/extensions/command-types.js.map +1 -0
  502. package/dist/core/extensions/context-types.d.ts +130 -0
  503. package/dist/core/extensions/context-types.d.ts.map +1 -0
  504. package/dist/core/extensions/context-types.js +2 -0
  505. package/dist/core/extensions/context-types.js.map +1 -0
  506. package/dist/core/extensions/event-results.d.ts +61 -0
  507. package/dist/core/extensions/event-results.d.ts.map +1 -0
  508. package/dist/core/extensions/event-results.js +2 -0
  509. package/dist/core/extensions/event-results.js.map +1 -0
  510. package/dist/core/extensions/event-types.d.ts +6 -0
  511. package/dist/core/extensions/event-types.d.ts.map +1 -0
  512. package/dist/core/extensions/event-types.js +2 -0
  513. package/dist/core/extensions/event-types.js.map +1 -0
  514. package/dist/core/extensions/loader-api.d.ts +10 -0
  515. package/dist/core/extensions/loader-api.d.ts.map +1 -0
  516. package/dist/core/extensions/loader-api.js +143 -0
  517. package/dist/core/extensions/loader-api.js.map +1 -0
  518. package/dist/core/extensions/loader-core.d.ts +12 -0
  519. package/dist/core/extensions/loader-core.d.ts.map +1 -0
  520. package/dist/core/extensions/loader-core.js +91 -0
  521. package/dist/core/extensions/loader-core.js.map +1 -0
  522. package/dist/core/extensions/loader-discovery.d.ts +7 -0
  523. package/dist/core/extensions/loader-discovery.d.ts.map +1 -0
  524. package/dist/core/extensions/loader-discovery.js +139 -0
  525. package/dist/core/extensions/loader-discovery.js.map +1 -0
  526. package/dist/core/extensions/loader-resources.d.ts +11 -0
  527. package/dist/core/extensions/loader-resources.d.ts.map +1 -0
  528. package/dist/core/extensions/loader-resources.js +10 -0
  529. package/dist/core/extensions/loader-resources.js.map +1 -0
  530. package/dist/core/extensions/loader-runtime.d.ts +7 -0
  531. package/dist/core/extensions/loader-runtime.d.ts.map +1 -0
  532. package/dist/core/extensions/loader-runtime.js +51 -0
  533. package/dist/core/extensions/loader-runtime.js.map +1 -0
  534. package/dist/core/extensions/loader-virtual-modules.d.ts +3 -0
  535. package/dist/core/extensions/loader-virtual-modules.d.ts.map +1 -0
  536. package/dist/core/extensions/loader-virtual-modules.js +92 -0
  537. package/dist/core/extensions/loader-virtual-modules.js.map +1 -0
  538. package/dist/core/extensions/loader.d.ts +4 -28
  539. package/dist/core/extensions/loader.d.ts.map +1 -1
  540. package/dist/core/extensions/loader.js +3 -542
  541. package/dist/core/extensions/loader.js.map +1 -1
  542. package/dist/core/extensions/message-types.d.ts +34 -0
  543. package/dist/core/extensions/message-types.d.ts.map +1 -0
  544. package/dist/core/extensions/message-types.js +2 -0
  545. package/dist/core/extensions/message-types.js.map +1 -0
  546. package/dist/core/extensions/provider-types.d.ts +71 -0
  547. package/dist/core/extensions/provider-types.d.ts.map +1 -0
  548. package/dist/core/extensions/provider-types.js +2 -0
  549. package/dist/core/extensions/provider-types.js.map +1 -0
  550. package/dist/core/extensions/runner-context.d.ts +42 -0
  551. package/dist/core/extensions/runner-context.d.ts.map +1 -0
  552. package/dist/core/extensions/runner-context.js +112 -0
  553. package/dist/core/extensions/runner-context.js.map +1 -0
  554. package/dist/core/extensions/runner-events.d.ts +47 -0
  555. package/dist/core/extensions/runner-events.d.ts.map +1 -0
  556. package/dist/core/extensions/runner-events.js +280 -0
  557. package/dist/core/extensions/runner-events.js.map +1 -0
  558. package/dist/core/extensions/runner-handlers.d.ts +32 -0
  559. package/dist/core/extensions/runner-handlers.d.ts.map +1 -0
  560. package/dist/core/extensions/runner-handlers.js +2 -0
  561. package/dist/core/extensions/runner-handlers.js.map +1 -0
  562. package/dist/core/extensions/runner-project-trust.d.ts +6 -0
  563. package/dist/core/extensions/runner-project-trust.d.ts.map +1 -0
  564. package/dist/core/extensions/runner-project-trust.js +27 -0
  565. package/dist/core/extensions/runner-project-trust.js.map +1 -0
  566. package/dist/core/extensions/runner-registries.d.ts +8 -0
  567. package/dist/core/extensions/runner-registries.d.ts.map +1 -0
  568. package/dist/core/extensions/runner-registries.js +76 -0
  569. package/dist/core/extensions/runner-registries.js.map +1 -0
  570. package/dist/core/extensions/runner-shortcuts.d.ts +10 -0
  571. package/dist/core/extensions/runner-shortcuts.d.ts.map +1 -0
  572. package/dist/core/extensions/runner-shortcuts.js +71 -0
  573. package/dist/core/extensions/runner-shortcuts.js.map +1 -0
  574. package/dist/core/extensions/runner-ui.d.ts +3 -0
  575. package/dist/core/extensions/runner-ui.d.ts.map +1 -0
  576. package/dist/core/extensions/runner-ui.js +50 -0
  577. package/dist/core/extensions/runner-ui.js.map +1 -0
  578. package/dist/core/extensions/runner.d.ts +7 -74
  579. package/dist/core/extensions/runner.d.ts.map +1 -1
  580. package/dist/core/extensions/runner.js +67 -673
  581. package/dist/core/extensions/runner.js.map +1 -1
  582. package/dist/core/extensions/runtime-types.d.ts +179 -0
  583. package/dist/core/extensions/runtime-types.d.ts.map +1 -0
  584. package/dist/core/extensions/runtime-types.js +2 -0
  585. package/dist/core/extensions/runtime-types.js.map +1 -0
  586. package/dist/core/extensions/session-events.d.ts +89 -0
  587. package/dist/core/extensions/session-events.d.ts.map +1 -0
  588. package/dist/core/extensions/session-events.js +2 -0
  589. package/dist/core/extensions/session-events.js.map +1 -0
  590. package/dist/core/extensions/tool-events.d.ts +127 -0
  591. package/dist/core/extensions/tool-events.d.ts.map +1 -0
  592. package/dist/core/extensions/tool-events.js +26 -0
  593. package/dist/core/extensions/tool-events.js.map +1 -0
  594. package/dist/core/extensions/tool-types.d.ts +100 -0
  595. package/dist/core/extensions/tool-types.d.ts.map +1 -0
  596. package/dist/core/extensions/tool-types.js +11 -0
  597. package/dist/core/extensions/tool-types.js.map +1 -0
  598. package/dist/core/extensions/types.d.ts +20 -1288
  599. package/dist/core/extensions/types.d.ts.map +1 -1
  600. package/dist/core/extensions/types.js +4 -34
  601. package/dist/core/extensions/types.js.map +1 -1
  602. package/dist/core/extensions/ui-types.d.ts +200 -0
  603. package/dist/core/extensions/ui-types.d.ts.map +1 -0
  604. package/dist/core/extensions/ui-types.js +2 -0
  605. package/dist/core/extensions/ui-types.js.map +1 -0
  606. package/dist/core/model-registry-auth.d.ts +7 -0
  607. package/dist/core/model-registry-auth.d.ts.map +1 -0
  608. package/dist/core/model-registry-auth.js +64 -0
  609. package/dist/core/model-registry-auth.js.map +1 -0
  610. package/dist/core/model-registry-builtins.d.ts +9 -0
  611. package/dist/core/model-registry-builtins.d.ts.map +1 -0
  612. package/dist/core/model-registry-builtins.js +120 -0
  613. package/dist/core/model-registry-builtins.js.map +1 -0
  614. package/dist/core/model-registry-custom-loader.d.ts +3 -0
  615. package/dist/core/model-registry-custom-loader.d.ts.map +1 -0
  616. package/dist/core/model-registry-custom-loader.js +213 -0
  617. package/dist/core/model-registry-custom-loader.js.map +1 -0
  618. package/dist/core/model-registry-dynamic.d.ts +6 -0
  619. package/dist/core/model-registry-dynamic.d.ts.map +1 -0
  620. package/dist/core/model-registry-dynamic.js +155 -0
  621. package/dist/core/model-registry-dynamic.js.map +1 -0
  622. package/dist/core/model-registry-loader.d.ts +4 -0
  623. package/dist/core/model-registry-loader.d.ts.map +1 -0
  624. package/dist/core/model-registry-loader.js +20 -0
  625. package/dist/core/model-registry-loader.js.map +1 -0
  626. package/dist/core/model-registry-schemas.d.ts +1084 -0
  627. package/dist/core/model-registry-schemas.d.ts.map +1 -0
  628. package/dist/core/model-registry-schemas.js +161 -0
  629. package/dist/core/model-registry-schemas.js.map +1 -0
  630. package/dist/core/model-registry-types.d.ts +74 -0
  631. package/dist/core/model-registry-types.d.ts.map +1 -0
  632. package/dist/core/model-registry-types.js +2 -0
  633. package/dist/core/model-registry-types.js.map +1 -0
  634. package/dist/core/model-registry.d.ts +3 -76
  635. package/dist/core/model-registry.d.ts.map +1 -1
  636. package/dist/core/model-registry.js +24 -733
  637. package/dist/core/model-registry.js.map +1 -1
  638. package/dist/core/model-resolver-cli.d.ts +19 -0
  639. package/dist/core/model-resolver-cli.d.ts.map +1 -0
  640. package/dist/core/model-resolver-cli.js +118 -0
  641. package/dist/core/model-resolver-cli.js.map +1 -0
  642. package/dist/core/model-resolver-defaults.d.ts +5 -0
  643. package/dist/core/model-resolver-defaults.d.ts.map +1 -0
  644. package/dist/core/model-resolver-defaults.js +47 -0
  645. package/dist/core/model-resolver-defaults.js.map +1 -0
  646. package/dist/core/model-resolver-initial.d.ts +31 -0
  647. package/dist/core/model-resolver-initial.d.ts.map +1 -0
  648. package/dist/core/model-resolver-initial.js +116 -0
  649. package/dist/core/model-resolver-initial.js.map +1 -0
  650. package/dist/core/model-resolver-patterns.d.ts +26 -0
  651. package/dist/core/model-resolver-patterns.d.ts.map +1 -0
  652. package/dist/core/model-resolver-patterns.js +139 -0
  653. package/dist/core/model-resolver-patterns.js.map +1 -0
  654. package/dist/core/model-resolver-scope.d.ts +15 -0
  655. package/dist/core/model-resolver-scope.d.ts.map +1 -0
  656. package/dist/core/model-resolver-scope.js +66 -0
  657. package/dist/core/model-resolver-scope.js.map +1 -0
  658. package/dist/core/model-resolver-types.d.ts +29 -0
  659. package/dist/core/model-resolver-types.d.ts.map +1 -0
  660. package/dist/core/model-resolver-types.js +2 -0
  661. package/dist/core/model-resolver-types.js.map +1 -0
  662. package/dist/core/model-resolver.d.ts +6 -107
  663. package/dist/core/model-resolver.d.ts.map +1 -1
  664. package/dist/core/model-resolver.js +5 -549
  665. package/dist/core/model-resolver.js.map +1 -1
  666. package/dist/core/package-manager-auto-resources.d.ts +5 -0
  667. package/dist/core/package-manager-auto-resources.d.ts.map +1 -0
  668. package/dist/core/package-manager-auto-resources.js +109 -0
  669. package/dist/core/package-manager-auto-resources.js.map +1 -0
  670. package/dist/core/package-manager-command.d.ts +11 -0
  671. package/dist/core/package-manager-command.d.ts.map +1 -0
  672. package/dist/core/package-manager-command.js +102 -0
  673. package/dist/core/package-manager-command.js.map +1 -0
  674. package/dist/core/package-manager-constants.d.ts +4 -0
  675. package/dist/core/package-manager-constants.d.ts.map +1 -0
  676. package/dist/core/package-manager-constants.js +4 -0
  677. package/dist/core/package-manager-constants.js.map +1 -0
  678. package/dist/core/package-manager-env.d.ts +4 -0
  679. package/dist/core/package-manager-env.d.ts.map +1 -0
  680. package/dist/core/package-manager-env.js +40 -0
  681. package/dist/core/package-manager-env.js.map +1 -0
  682. package/dist/core/package-manager-git.d.ts +10 -0
  683. package/dist/core/package-manager-git.d.ts.map +1 -0
  684. package/dist/core/package-manager-git.js +271 -0
  685. package/dist/core/package-manager-git.js.map +1 -0
  686. package/dist/core/package-manager-manifest.d.ts +7 -0
  687. package/dist/core/package-manager-manifest.d.ts.map +1 -0
  688. package/dist/core/package-manager-manifest.js +45 -0
  689. package/dist/core/package-manager-manifest.js.map +1 -0
  690. package/dist/core/package-manager-npm.d.ts +25 -0
  691. package/dist/core/package-manager-npm.d.ts.map +1 -0
  692. package/dist/core/package-manager-npm.js +252 -0
  693. package/dist/core/package-manager-npm.js.map +1 -0
  694. package/dist/core/package-manager-operations.d.ts +11 -0
  695. package/dist/core/package-manager-operations.d.ts.map +1 -0
  696. package/dist/core/package-manager-operations.js +196 -0
  697. package/dist/core/package-manager-operations.js.map +1 -0
  698. package/dist/core/package-manager-paths.d.ts +14 -0
  699. package/dist/core/package-manager-paths.d.ts.map +1 -0
  700. package/dist/core/package-manager-paths.js +61 -0
  701. package/dist/core/package-manager-paths.js.map +1 -0
  702. package/dist/core/package-manager-progress.d.ts +4 -0
  703. package/dist/core/package-manager-progress.d.ts.map +1 -0
  704. package/dist/core/package-manager-progress.js +16 -0
  705. package/dist/core/package-manager-progress.js.map +1 -0
  706. package/dist/core/package-manager-resolver.d.ts +5 -0
  707. package/dist/core/package-manager-resolver.d.ts.map +1 -0
  708. package/dist/core/package-manager-resolver.js +149 -0
  709. package/dist/core/package-manager-resolver.js.map +1 -0
  710. package/dist/core/package-manager-resource-accumulator.d.ts +6 -0
  711. package/dist/core/package-manager-resource-accumulator.d.ts.map +1 -0
  712. package/dist/core/package-manager-resource-accumulator.js +67 -0
  713. package/dist/core/package-manager-resource-accumulator.js.map +1 -0
  714. package/dist/core/package-manager-resource-collector.d.ts +5 -0
  715. package/dist/core/package-manager-resource-collector.d.ts.map +1 -0
  716. package/dist/core/package-manager-resource-collector.js +148 -0
  717. package/dist/core/package-manager-resource-collector.js.map +1 -0
  718. package/dist/core/package-manager-resource-files.d.ts +14 -0
  719. package/dist/core/package-manager-resource-files.d.ts.map +1 -0
  720. package/dist/core/package-manager-resource-files.js +265 -0
  721. package/dist/core/package-manager-resource-files.js.map +1 -0
  722. package/dist/core/package-manager-resource-patterns.d.ts +12 -0
  723. package/dist/core/package-manager-resource-patterns.d.ts.map +1 -0
  724. package/dist/core/package-manager-resource-patterns.js +136 -0
  725. package/dist/core/package-manager-resource-patterns.js.map +1 -0
  726. package/dist/core/package-manager-settings.d.ts +10 -0
  727. package/dist/core/package-manager-settings.d.ts.map +1 -0
  728. package/dist/core/package-manager-settings.js +91 -0
  729. package/dist/core/package-manager-settings.js.map +1 -0
  730. package/dist/core/package-manager-source.d.ts +21 -0
  731. package/dist/core/package-manager-source.d.ts.map +1 -0
  732. package/dist/core/package-manager-source.js +146 -0
  733. package/dist/core/package-manager-source.js.map +1 -0
  734. package/dist/core/package-manager-types.d.ts +169 -0
  735. package/dist/core/package-manager-types.d.ts.map +1 -0
  736. package/dist/core/package-manager-types.js +9 -0
  737. package/dist/core/package-manager-types.js.map +1 -0
  738. package/dist/core/package-manager.d.ts +9 -174
  739. package/dist/core/package-manager.d.ts.map +1 -1
  740. package/dist/core/package-manager.js +56 -2100
  741. package/dist/core/package-manager.js.map +1 -1
  742. package/dist/core/resource-loader-assets.d.ts +6 -0
  743. package/dist/core/resource-loader-assets.d.ts.map +1 -0
  744. package/dist/core/resource-loader-assets.js +209 -0
  745. package/dist/core/resource-loader-assets.js.map +1 -0
  746. package/dist/core/resource-loader-context-files.d.ts +10 -0
  747. package/dist/core/resource-loader-context-files.d.ts.map +1 -0
  748. package/dist/core/resource-loader-context-files.js +74 -0
  749. package/dist/core/resource-loader-context-files.js.map +1 -0
  750. package/dist/core/resource-loader-core.d.ts +82 -0
  751. package/dist/core/resource-loader-core.d.ts.map +1 -0
  752. package/dist/core/resource-loader-core.js +168 -0
  753. package/dist/core/resource-loader-core.js.map +1 -0
  754. package/dist/core/resource-loader-discovery.d.ts +4 -0
  755. package/dist/core/resource-loader-discovery.d.ts.map +1 -0
  756. package/dist/core/resource-loader-discovery.js +28 -0
  757. package/dist/core/resource-loader-discovery.js.map +1 -0
  758. package/dist/core/resource-loader-extensions.d.ts +13 -0
  759. package/dist/core/resource-loader-extensions.d.ts.map +1 -0
  760. package/dist/core/resource-loader-extensions.js +110 -0
  761. package/dist/core/resource-loader-extensions.js.map +1 -0
  762. package/dist/core/resource-loader-helpers.d.ts +4 -0
  763. package/dist/core/resource-loader-helpers.d.ts.map +1 -0
  764. package/dist/core/resource-loader-helpers.js +23 -0
  765. package/dist/core/resource-loader-helpers.js.map +1 -0
  766. package/dist/core/resource-loader-internals.d.ts +96 -0
  767. package/dist/core/resource-loader-internals.d.ts.map +1 -0
  768. package/dist/core/resource-loader-internals.js +4 -0
  769. package/dist/core/resource-loader-internals.js.map +1 -0
  770. package/dist/core/resource-loader-package-resources.d.ts +31 -0
  771. package/dist/core/resource-loader-package-resources.d.ts.map +1 -0
  772. package/dist/core/resource-loader-package-resources.js +112 -0
  773. package/dist/core/resource-loader-package-resources.js.map +1 -0
  774. package/dist/core/resource-loader-paths.d.ts +4 -0
  775. package/dist/core/resource-loader-paths.d.ts.map +1 -0
  776. package/dist/core/resource-loader-paths.js +22 -0
  777. package/dist/core/resource-loader-paths.js.map +1 -0
  778. package/dist/core/resource-loader-reload.d.ts +6 -0
  779. package/dist/core/resource-loader-reload.d.ts.map +1 -0
  780. package/dist/core/resource-loader-reload.js +226 -0
  781. package/dist/core/resource-loader-reload.js.map +1 -0
  782. package/dist/core/resource-loader-source-info.d.ts +9 -0
  783. package/dist/core/resource-loader-source-info.d.ts.map +1 -0
  784. package/dist/core/resource-loader-source-info.js +101 -0
  785. package/dist/core/resource-loader-source-info.js.map +1 -0
  786. package/dist/core/resource-loader-types.d.ts +130 -0
  787. package/dist/core/resource-loader-types.d.ts.map +1 -0
  788. package/dist/core/resource-loader-types.js +2 -0
  789. package/dist/core/resource-loader-types.js.map +1 -0
  790. package/dist/core/resource-loader.d.ts +3 -242
  791. package/dist/core/resource-loader.d.ts.map +1 -1
  792. package/dist/core/resource-loader.js +2 -976
  793. package/dist/core/resource-loader.js.map +1 -1
  794. package/dist/core/sdk-exports.d.ts +7 -0
  795. package/dist/core/sdk-exports.d.ts.map +1 -0
  796. package/dist/core/sdk-exports.js +5 -0
  797. package/dist/core/sdk-exports.js.map +1 -0
  798. package/dist/core/sdk-types.d.ts +86 -0
  799. package/dist/core/sdk-types.d.ts.map +1 -0
  800. package/dist/core/sdk-types.js +2 -0
  801. package/dist/core/sdk-types.js.map +1 -0
  802. package/dist/core/sdk.d.ts +3 -91
  803. package/dist/core/sdk.d.ts.map +1 -1
  804. package/dist/core/sdk.js +2 -6
  805. package/dist/core/sdk.js.map +1 -1
  806. package/dist/core/session-manager-archive.d.ts +27 -0
  807. package/dist/core/session-manager-archive.d.ts.map +1 -0
  808. package/dist/core/session-manager-archive.js +114 -0
  809. package/dist/core/session-manager-archive.js.map +1 -0
  810. package/dist/core/session-manager-core.d.ts +104 -0
  811. package/dist/core/session-manager-core.d.ts.map +1 -0
  812. package/dist/core/session-manager-core.js +346 -0
  813. package/dist/core/session-manager-core.js.map +1 -0
  814. package/dist/core/session-manager-entries.d.ts +38 -0
  815. package/dist/core/session-manager-entries.d.ts.map +1 -0
  816. package/dist/core/session-manager-entries.js +124 -0
  817. package/dist/core/session-manager-entries.js.map +1 -0
  818. package/dist/core/session-manager-history.d.ts +38 -0
  819. package/dist/core/session-manager-history.d.ts.map +1 -0
  820. package/dist/core/session-manager-history.js +378 -0
  821. package/dist/core/session-manager-history.js.map +1 -0
  822. package/dist/core/session-manager-list.d.ts +5 -0
  823. package/dist/core/session-manager-list.d.ts.map +1 -0
  824. package/dist/core/session-manager-list.js +196 -0
  825. package/dist/core/session-manager-list.js.map +1 -0
  826. package/dist/core/session-manager-migrations.d.ts +11 -0
  827. package/dist/core/session-manager-migrations.d.ts.map +1 -0
  828. package/dist/core/session-manager-migrations.js +80 -0
  829. package/dist/core/session-manager-migrations.js.map +1 -0
  830. package/dist/core/session-manager-paths.d.ts +7 -0
  831. package/dist/core/session-manager-paths.d.ts.map +1 -0
  832. package/dist/core/session-manager-paths.js +22 -0
  833. package/dist/core/session-manager-paths.js.map +1 -0
  834. package/dist/core/session-manager-storage.d.ts +15 -0
  835. package/dist/core/session-manager-storage.d.ts.map +1 -0
  836. package/dist/core/session-manager-storage.js +127 -0
  837. package/dist/core/session-manager-storage.js.map +1 -0
  838. package/dist/core/session-manager-types.d.ts +172 -0
  839. package/dist/core/session-manager-types.d.ts.map +1 -0
  840. package/dist/core/session-manager-types.js +2 -0
  841. package/dist/core/session-manager-types.js.map +1 -0
  842. package/dist/core/session-manager-validation.d.ts +7 -0
  843. package/dist/core/session-manager-validation.d.ts.map +1 -0
  844. package/dist/core/session-manager-validation.js +34 -0
  845. package/dist/core/session-manager-validation.js.map +1 -0
  846. package/dist/core/session-manager.d.ts +8 -390
  847. package/dist/core/session-manager.d.ts.map +1 -1
  848. package/dist/core/session-manager.js +7 -1418
  849. package/dist/core/session-manager.js.map +1 -1
  850. package/dist/core/settings-manager-basic-accessors.d.ts +65 -0
  851. package/dist/core/settings-manager-basic-accessors.d.ts.map +1 -0
  852. package/dist/core/settings-manager-basic-accessors.js +253 -0
  853. package/dist/core/settings-manager-basic-accessors.js.map +1 -0
  854. package/dist/core/settings-manager-core.d.ts +57 -0
  855. package/dist/core/settings-manager-core.d.ts.map +1 -0
  856. package/dist/core/settings-manager-core.js +387 -0
  857. package/dist/core/settings-manager-core.js.map +1 -0
  858. package/dist/core/settings-manager-internals.d.ts +13 -0
  859. package/dist/core/settings-manager-internals.d.ts.map +1 -0
  860. package/dist/core/settings-manager-internals.js +4 -0
  861. package/dist/core/settings-manager-internals.js.map +1 -0
  862. package/dist/core/settings-manager-resource-accessors.d.ts +43 -0
  863. package/dist/core/settings-manager-resource-accessors.d.ts.map +1 -0
  864. package/dist/core/settings-manager-resource-accessors.js +172 -0
  865. package/dist/core/settings-manager-resource-accessors.js.map +1 -0
  866. package/dist/core/settings-manager-ui-accessors.d.ts +44 -0
  867. package/dist/core/settings-manager-ui-accessors.d.ts.map +1 -0
  868. package/dist/core/settings-manager-ui-accessors.js +208 -0
  869. package/dist/core/settings-manager-ui-accessors.js.map +1 -0
  870. package/dist/core/settings-manager.d.ts +6 -321
  871. package/dist/core/settings-manager.d.ts.map +1 -1
  872. package/dist/core/settings-manager.js +5 -1060
  873. package/dist/core/settings-manager.js.map +1 -1
  874. package/dist/core/settings-merge.d.ts +4 -0
  875. package/dist/core/settings-merge.d.ts.map +1 -0
  876. package/dist/core/settings-merge.js +26 -0
  877. package/dist/core/settings-merge.js.map +1 -0
  878. package/dist/core/settings-storage.d.ts +20 -0
  879. package/dist/core/settings-storage.d.ts.map +1 -0
  880. package/dist/core/settings-storage.js +100 -0
  881. package/dist/core/settings-storage.js.map +1 -0
  882. package/dist/core/settings-types.d.ts +123 -0
  883. package/dist/core/settings-types.d.ts.map +1 -0
  884. package/dist/core/settings-types.js +2 -0
  885. package/dist/core/settings-types.js.map +1 -0
  886. package/dist/core/system-prompt.d.ts.map +1 -1
  887. package/dist/core/system-prompt.js +7 -0
  888. package/dist/core/system-prompt.js.map +1 -1
  889. package/dist/core/tools/bash-policy-compile.d.ts +5 -0
  890. package/dist/core/tools/bash-policy-compile.d.ts.map +1 -0
  891. package/dist/core/tools/bash-policy-compile.js +241 -0
  892. package/dist/core/tools/bash-policy-compile.js.map +1 -0
  893. package/dist/core/tools/bash-policy-evaluate.d.ts +3 -0
  894. package/dist/core/tools/bash-policy-evaluate.d.ts.map +1 -0
  895. package/dist/core/tools/bash-policy-evaluate.js +92 -0
  896. package/dist/core/tools/bash-policy-evaluate.js.map +1 -0
  897. package/dist/core/tools/bash-policy-format.d.ts +5 -0
  898. package/dist/core/tools/bash-policy-format.d.ts.map +1 -0
  899. package/dist/core/tools/bash-policy-format.js +49 -0
  900. package/dist/core/tools/bash-policy-format.js.map +1 -0
  901. package/dist/core/tools/bash-policy-parser.d.ts +4 -0
  902. package/dist/core/tools/bash-policy-parser.d.ts.map +1 -0
  903. package/dist/core/tools/bash-policy-parser.js +155 -0
  904. package/dist/core/tools/bash-policy-parser.js.map +1 -0
  905. package/dist/core/tools/bash-policy-segment.d.ts +3 -0
  906. package/dist/core/tools/bash-policy-segment.d.ts.map +1 -0
  907. package/dist/core/tools/bash-policy-segment.js +275 -0
  908. package/dist/core/tools/bash-policy-segment.js.map +1 -0
  909. package/dist/core/tools/bash-policy-shell.d.ts +11 -0
  910. package/dist/core/tools/bash-policy-shell.d.ts.map +1 -0
  911. package/dist/core/tools/bash-policy-shell.js +267 -0
  912. package/dist/core/tools/bash-policy-shell.js.map +1 -0
  913. package/dist/core/tools/bash-policy-types.d.ts +146 -0
  914. package/dist/core/tools/bash-policy-types.d.ts.map +1 -0
  915. package/dist/core/tools/bash-policy-types.js +2 -0
  916. package/dist/core/tools/bash-policy-types.js.map +1 -0
  917. package/dist/core/tools/bash-policy.d.ts +5 -61
  918. package/dist/core/tools/bash-policy.d.ts.map +1 -1
  919. package/dist/core/tools/bash-policy.js +4 -1068
  920. package/dist/core/tools/bash-policy.js.map +1 -1
  921. package/dist/core/tools/todos-execute.d.ts +5 -0
  922. package/dist/core/tools/todos-execute.d.ts.map +1 -0
  923. package/dist/core/tools/todos-execute.js +200 -0
  924. package/dist/core/tools/todos-execute.js.map +1 -0
  925. package/dist/core/tools/todos-locks.d.ts +4 -0
  926. package/dist/core/tools/todos-locks.d.ts.map +1 -0
  927. package/dist/core/tools/todos-locks.js +80 -0
  928. package/dist/core/tools/todos-locks.js.map +1 -0
  929. package/dist/core/tools/todos-model.d.ts +21 -0
  930. package/dist/core/tools/todos-model.d.ts.map +1 -0
  931. package/dist/core/tools/todos-model.js +71 -0
  932. package/dist/core/tools/todos-model.js.map +1 -0
  933. package/dist/core/tools/todos-mutations.d.ts +6 -0
  934. package/dist/core/tools/todos-mutations.d.ts.map +1 -0
  935. package/dist/core/tools/todos-mutations.js +85 -0
  936. package/dist/core/tools/todos-mutations.js.map +1 -0
  937. package/dist/core/tools/todos-paths.d.ts +5 -0
  938. package/dist/core/tools/todos-paths.d.ts.map +1 -0
  939. package/dist/core/tools/todos-paths.js +25 -0
  940. package/dist/core/tools/todos-paths.js.map +1 -0
  941. package/dist/core/tools/todos-render.d.ts +10 -0
  942. package/dist/core/tools/todos-render.d.ts.map +1 -0
  943. package/dist/core/tools/todos-render.js +159 -0
  944. package/dist/core/tools/todos-render.js.map +1 -0
  945. package/dist/core/tools/todos-storage.d.ts +9 -0
  946. package/dist/core/tools/todos-storage.d.ts.map +1 -0
  947. package/dist/core/tools/todos-storage.js +183 -0
  948. package/dist/core/tools/todos-storage.js.map +1 -0
  949. package/dist/core/tools/todos-types.d.ts +46 -0
  950. package/dist/core/tools/todos-types.d.ts.map +1 -0
  951. package/dist/core/tools/todos-types.js +27 -0
  952. package/dist/core/tools/todos-types.js.map +1 -0
  953. package/dist/core/tools/todos.d.ts +12 -32
  954. package/dist/core/tools/todos.d.ts.map +1 -1
  955. package/dist/core/tools/todos.js +7 -893
  956. package/dist/core/tools/todos.js.map +1 -1
  957. package/dist/index-extensions.d.ts +3 -0
  958. package/dist/index-extensions.d.ts.map +1 -0
  959. package/dist/index-extensions.js +2 -0
  960. package/dist/index-extensions.js.map +1 -0
  961. package/dist/index.d.ts +1 -2
  962. package/dist/index.d.ts.map +1 -1
  963. package/dist/index.js +1 -1
  964. package/dist/index.js.map +1 -1
  965. package/dist/main-app-mode.d.ts +15 -0
  966. package/dist/main-app-mode.d.ts.map +1 -0
  967. package/dist/main-app-mode.js +51 -0
  968. package/dist/main-app-mode.js.map +1 -0
  969. package/dist/main-session-options.d.ts +12 -0
  970. package/dist/main-session-options.d.ts.map +1 -0
  971. package/dist/main-session-options.js +87 -0
  972. package/dist/main-session-options.js.map +1 -0
  973. package/dist/main-session.d.ts +9 -0
  974. package/dist/main-session.d.ts.map +1 -0
  975. package/dist/main-session.js +188 -0
  976. package/dist/main-session.js.map +1 -0
  977. package/dist/main-stdio.d.ts +12 -0
  978. package/dist/main-stdio.d.ts.map +1 -0
  979. package/dist/main-stdio.js +68 -0
  980. package/dist/main-stdio.js.map +1 -0
  981. package/dist/main.d.ts +2 -3
  982. package/dist/main.d.ts.map +1 -1
  983. package/dist/main.js +11 -388
  984. package/dist/main.js.map +1 -1
  985. package/dist/migrations-config-values.d.ts +9 -0
  986. package/dist/migrations-config-values.d.ts.map +1 -0
  987. package/dist/migrations-config-values.js +298 -0
  988. package/dist/migrations-config-values.js.map +1 -0
  989. package/dist/migrations.d.ts.map +1 -1
  990. package/dist/migrations.js +2 -296
  991. package/dist/migrations.js.map +1 -1
  992. package/dist/modes/interactive/components/chat-message-renderer.d.ts.map +1 -1
  993. package/dist/modes/interactive/components/chat-message-renderer.js +0 -7
  994. package/dist/modes/interactive/components/chat-message-renderer.js.map +1 -1
  995. package/dist/modes/interactive/components/chat-session-host-actions.d.ts +9 -0
  996. package/dist/modes/interactive/components/chat-session-host-actions.d.ts.map +1 -0
  997. package/dist/modes/interactive/components/chat-session-host-actions.js +244 -0
  998. package/dist/modes/interactive/components/chat-session-host-actions.js.map +1 -0
  999. package/dist/modes/interactive/components/chat-session-host-editor.d.ts +18 -0
  1000. package/dist/modes/interactive/components/chat-session-host-editor.d.ts.map +1 -0
  1001. package/dist/modes/interactive/components/chat-session-host-editor.js +165 -0
  1002. package/dist/modes/interactive/components/chat-session-host-editor.js.map +1 -0
  1003. package/dist/modes/interactive/components/chat-session-host-events.d.ts +5 -0
  1004. package/dist/modes/interactive/components/chat-session-host-events.d.ts.map +1 -0
  1005. package/dist/modes/interactive/components/chat-session-host-events.js +200 -0
  1006. package/dist/modes/interactive/components/chat-session-host-events.js.map +1 -0
  1007. package/dist/modes/interactive/components/chat-session-host-rendering.d.ts +13 -0
  1008. package/dist/modes/interactive/components/chat-session-host-rendering.d.ts.map +1 -0
  1009. package/dist/modes/interactive/components/chat-session-host-rendering.js +185 -0
  1010. package/dist/modes/interactive/components/chat-session-host-rendering.js.map +1 -0
  1011. package/dist/modes/interactive/components/chat-session-host-runtime.d.ts +13 -0
  1012. package/dist/modes/interactive/components/chat-session-host-runtime.d.ts.map +1 -0
  1013. package/dist/modes/interactive/components/chat-session-host-runtime.js +101 -0
  1014. package/dist/modes/interactive/components/chat-session-host-runtime.js.map +1 -0
  1015. package/dist/modes/interactive/components/chat-session-host-state.d.ts +53 -0
  1016. package/dist/modes/interactive/components/chat-session-host-state.d.ts.map +1 -0
  1017. package/dist/modes/interactive/components/chat-session-host-state.js +42 -0
  1018. package/dist/modes/interactive/components/chat-session-host-state.js.map +1 -0
  1019. package/dist/modes/interactive/components/chat-session-host-types.d.ts +63 -0
  1020. package/dist/modes/interactive/components/chat-session-host-types.d.ts.map +1 -0
  1021. package/dist/modes/interactive/components/chat-session-host-types.js +2 -0
  1022. package/dist/modes/interactive/components/chat-session-host-types.js.map +1 -0
  1023. package/dist/modes/interactive/components/chat-session-host-utils.d.ts +28 -0
  1024. package/dist/modes/interactive/components/chat-session-host-utils.d.ts.map +1 -0
  1025. package/dist/modes/interactive/components/chat-session-host-utils.js +103 -0
  1026. package/dist/modes/interactive/components/chat-session-host-utils.js.map +1 -0
  1027. package/dist/modes/interactive/components/chat-session-host.d.ts +6 -129
  1028. package/dist/modes/interactive/components/chat-session-host.d.ts.map +1 -1
  1029. package/dist/modes/interactive/components/chat-session-host.js +50 -1022
  1030. package/dist/modes/interactive/components/chat-session-host.js.map +1 -1
  1031. package/dist/modes/interactive/components/config-selector-list.d.ts +65 -0
  1032. package/dist/modes/interactive/components/config-selector-list.d.ts.map +1 -0
  1033. package/dist/modes/interactive/components/config-selector-list.js +458 -0
  1034. package/dist/modes/interactive/components/config-selector-list.js.map +1 -0
  1035. package/dist/modes/interactive/components/config-selector.d.ts +3 -58
  1036. package/dist/modes/interactive/components/config-selector.d.ts.map +1 -1
  1037. package/dist/modes/interactive/components/config-selector.js +2 -457
  1038. package/dist/modes/interactive/components/config-selector.js.map +1 -1
  1039. package/dist/modes/interactive/components/session-selector-delete.d.ts +10 -0
  1040. package/dist/modes/interactive/components/session-selector-delete.d.ts.map +1 -0
  1041. package/dist/modes/interactive/components/session-selector-delete.js +40 -0
  1042. package/dist/modes/interactive/components/session-selector-delete.js.map +1 -0
  1043. package/dist/modes/interactive/components/session-selector-header.d.ts +33 -0
  1044. package/dist/modes/interactive/components/session-selector-header.d.ts.map +1 -0
  1045. package/dist/modes/interactive/components/session-selector-header.js +117 -0
  1046. package/dist/modes/interactive/components/session-selector-header.js.map +1 -0
  1047. package/dist/modes/interactive/components/session-selector-list.d.ts +49 -0
  1048. package/dist/modes/interactive/components/session-selector-list.d.ts.map +1 -0
  1049. package/dist/modes/interactive/components/session-selector-list.js +307 -0
  1050. package/dist/modes/interactive/components/session-selector-list.js.map +1 -0
  1051. package/dist/modes/interactive/components/session-selector-tree.d.ts +25 -0
  1052. package/dist/modes/interactive/components/session-selector-tree.d.ts.map +1 -0
  1053. package/dist/modes/interactive/components/session-selector-tree.js +53 -0
  1054. package/dist/modes/interactive/components/session-selector-tree.js.map +1 -0
  1055. package/dist/modes/interactive/components/session-selector-types.d.ts +4 -0
  1056. package/dist/modes/interactive/components/session-selector-types.d.ts.map +1 -0
  1057. package/dist/modes/interactive/components/session-selector-types.js +2 -0
  1058. package/dist/modes/interactive/components/session-selector-types.js.map +1 -0
  1059. package/dist/modes/interactive/components/session-selector-utils.d.ts +4 -0
  1060. package/dist/modes/interactive/components/session-selector-utils.d.ts.map +1 -0
  1061. package/dist/modes/interactive/components/session-selector-utils.js +37 -0
  1062. package/dist/modes/interactive/components/session-selector-utils.js.map +1 -0
  1063. package/dist/modes/interactive/components/session-selector.d.ts +3 -49
  1064. package/dist/modes/interactive/components/session-selector.d.ts.map +1 -1
  1065. package/dist/modes/interactive/components/session-selector.js +5 -542
  1066. package/dist/modes/interactive/components/session-selector.js.map +1 -1
  1067. package/dist/modes/interactive/components/settings-selector-handlers.d.ts +3 -0
  1068. package/dist/modes/interactive/components/settings-selector-handlers.d.ts.map +1 -0
  1069. package/dist/modes/interactive/components/settings-selector-handlers.js +84 -0
  1070. package/dist/modes/interactive/components/settings-selector-handlers.js.map +1 -0
  1071. package/dist/modes/interactive/components/settings-selector-items.d.ts +4 -0
  1072. package/dist/modes/interactive/components/settings-selector-items.d.ts.map +1 -0
  1073. package/dist/modes/interactive/components/settings-selector-items.js +211 -0
  1074. package/dist/modes/interactive/components/settings-selector-items.js.map +1 -0
  1075. package/dist/modes/interactive/components/settings-selector-options.d.ts +6 -0
  1076. package/dist/modes/interactive/components/settings-selector-options.d.ts.map +1 -0
  1077. package/dist/modes/interactive/components/settings-selector-options.js +14 -0
  1078. package/dist/modes/interactive/components/settings-selector-options.js.map +1 -0
  1079. package/dist/modes/interactive/components/settings-selector-submenus.d.ts +44 -0
  1080. package/dist/modes/interactive/components/settings-selector-submenus.d.ts.map +1 -0
  1081. package/dist/modes/interactive/components/settings-selector-submenus.js +228 -0
  1082. package/dist/modes/interactive/components/settings-selector-submenus.js.map +1 -0
  1083. package/dist/modes/interactive/components/settings-selector-types.d.ts +67 -0
  1084. package/dist/modes/interactive/components/settings-selector-types.d.ts.map +1 -0
  1085. package/dist/modes/interactive/components/settings-selector-types.js +2 -0
  1086. package/dist/modes/interactive/components/settings-selector-types.js.map +1 -0
  1087. package/dist/modes/interactive/components/settings-selector.d.ts +2 -63
  1088. package/dist/modes/interactive/components/settings-selector.d.ts.map +1 -1
  1089. package/dist/modes/interactive/components/settings-selector.js +5 -538
  1090. package/dist/modes/interactive/components/settings-selector.js.map +1 -1
  1091. package/dist/modes/interactive/components/tree-selector-component.d.ts +21 -0
  1092. package/dist/modes/interactive/components/tree-selector-component.d.ts.map +1 -0
  1093. package/dist/modes/interactive/components/tree-selector-component.js +80 -0
  1094. package/dist/modes/interactive/components/tree-selector-component.js.map +1 -0
  1095. package/dist/modes/interactive/components/tree-selector-content.d.ts +8 -0
  1096. package/dist/modes/interactive/components/tree-selector-content.d.ts.map +1 -0
  1097. package/dist/modes/interactive/components/tree-selector-content.js +263 -0
  1098. package/dist/modes/interactive/components/tree-selector-content.js.map +1 -0
  1099. package/dist/modes/interactive/components/tree-selector-help.d.ts +16 -0
  1100. package/dist/modes/interactive/components/tree-selector-help.d.ts.map +1 -0
  1101. package/dist/modes/interactive/components/tree-selector-help.js +103 -0
  1102. package/dist/modes/interactive/components/tree-selector-help.js.map +1 -0
  1103. package/dist/modes/interactive/components/tree-selector-label-input.d.ts +16 -0
  1104. package/dist/modes/interactive/components/tree-selector-label-input.d.ts.map +1 -0
  1105. package/dist/modes/interactive/components/tree-selector-label-input.js +46 -0
  1106. package/dist/modes/interactive/components/tree-selector-label-input.js.map +1 -0
  1107. package/dist/modes/interactive/components/tree-selector-list.d.ts +33 -0
  1108. package/dist/modes/interactive/components/tree-selector-list.d.ts.map +1 -0
  1109. package/dist/modes/interactive/components/tree-selector-list.js +336 -0
  1110. package/dist/modes/interactive/components/tree-selector-list.js.map +1 -0
  1111. package/dist/modes/interactive/components/tree-selector-model.d.ts +7 -0
  1112. package/dist/modes/interactive/components/tree-selector-model.d.ts.map +1 -0
  1113. package/dist/modes/interactive/components/tree-selector-model.js +358 -0
  1114. package/dist/modes/interactive/components/tree-selector-model.js.map +1 -0
  1115. package/dist/modes/interactive/components/tree-selector-types.d.ts +57 -0
  1116. package/dist/modes/interactive/components/tree-selector-types.d.ts.map +1 -0
  1117. package/dist/modes/interactive/components/tree-selector-types.js +6 -0
  1118. package/dist/modes/interactive/components/tree-selector-types.js.map +1 -0
  1119. package/dist/modes/interactive/components/tree-selector-viewport.d.ts +10 -0
  1120. package/dist/modes/interactive/components/tree-selector-viewport.d.ts.map +1 -0
  1121. package/dist/modes/interactive/components/tree-selector-viewport.js +32 -0
  1122. package/dist/modes/interactive/components/tree-selector-viewport.js.map +1 -0
  1123. package/dist/modes/interactive/components/tree-selector.d.ts +2 -88
  1124. package/dist/modes/interactive/components/tree-selector.d.ts.map +1 -1
  1125. package/dist/modes/interactive/components/tree-selector.js +1 -1200
  1126. package/dist/modes/interactive/components/tree-selector.js.map +1 -1
  1127. package/dist/modes/interactive/interactive-agent-events.d.ts +2 -0
  1128. package/dist/modes/interactive/interactive-agent-events.d.ts.map +1 -0
  1129. package/dist/modes/interactive/interactive-agent-events.js +370 -0
  1130. package/dist/modes/interactive/interactive-agent-events.js.map +1 -0
  1131. package/dist/modes/interactive/interactive-auth-login.d.ts +2 -0
  1132. package/dist/modes/interactive/interactive-auth-login.d.ts.map +1 -0
  1133. package/dist/modes/interactive/interactive-auth-login.js +214 -0
  1134. package/dist/modes/interactive/interactive-auth-login.js.map +1 -0
  1135. package/dist/modes/interactive/interactive-auth-routing.d.ts +2 -0
  1136. package/dist/modes/interactive/interactive-auth-routing.d.ts.map +1 -0
  1137. package/dist/modes/interactive/interactive-auth-routing.js +128 -0
  1138. package/dist/modes/interactive/interactive-auth-routing.js.map +1 -0
  1139. package/dist/modes/interactive/interactive-autocomplete.d.ts +2 -0
  1140. package/dist/modes/interactive/interactive-autocomplete.d.ts.map +1 -0
  1141. package/dist/modes/interactive/interactive-autocomplete.js +140 -0
  1142. package/dist/modes/interactive/interactive-autocomplete.js.map +1 -0
  1143. package/dist/modes/interactive/interactive-bash-compact.d.ts +2 -0
  1144. package/dist/modes/interactive/interactive-bash-compact.d.ts.map +1 -0
  1145. package/dist/modes/interactive/interactive-bash-compact.js +112 -0
  1146. package/dist/modes/interactive/interactive-bash-compact.js.map +1 -0
  1147. package/dist/modes/interactive/interactive-editor-actions.d.ts +2 -0
  1148. package/dist/modes/interactive/interactive-editor-actions.d.ts.map +1 -0
  1149. package/dist/modes/interactive/interactive-editor-actions.js +131 -0
  1150. package/dist/modes/interactive/interactive-editor-actions.js.map +1 -0
  1151. package/dist/modes/interactive/interactive-extension-context.d.ts +2 -0
  1152. package/dist/modes/interactive/interactive-extension-context.d.ts.map +1 -0
  1153. package/dist/modes/interactive/interactive-extension-context.js +159 -0
  1154. package/dist/modes/interactive/interactive-extension-context.js.map +1 -0
  1155. package/dist/modes/interactive/interactive-extension-custom-ui.d.ts +2 -0
  1156. package/dist/modes/interactive/interactive-extension-custom-ui.d.ts.map +1 -0
  1157. package/dist/modes/interactive/interactive-extension-custom-ui.js +208 -0
  1158. package/dist/modes/interactive/interactive-extension-custom-ui.js.map +1 -0
  1159. package/dist/modes/interactive/interactive-extension-dialogs.d.ts +2 -0
  1160. package/dist/modes/interactive/interactive-extension-dialogs.d.ts.map +1 -0
  1161. package/dist/modes/interactive/interactive-extension-dialogs.js +162 -0
  1162. package/dist/modes/interactive/interactive-extension-dialogs.js.map +1 -0
  1163. package/dist/modes/interactive/interactive-extension-runtime.d.ts +2 -0
  1164. package/dist/modes/interactive/interactive-extension-runtime.d.ts.map +1 -0
  1165. package/dist/modes/interactive/interactive-extension-runtime.js +179 -0
  1166. package/dist/modes/interactive/interactive-extension-runtime.js.map +1 -0
  1167. package/dist/modes/interactive/interactive-extension-widgets.d.ts +2 -0
  1168. package/dist/modes/interactive/interactive-extension-widgets.d.ts.map +1 -0
  1169. package/dist/modes/interactive/interactive-extension-widgets.js +113 -0
  1170. package/dist/modes/interactive/interactive-extension-widgets.js.map +1 -0
  1171. package/dist/modes/interactive/interactive-hotkeys-debug.d.ts +2 -0
  1172. package/dist/modes/interactive/interactive-hotkeys-debug.d.ts.map +1 -0
  1173. package/dist/modes/interactive/interactive-hotkeys-debug.js +186 -0
  1174. package/dist/modes/interactive/interactive-hotkeys-debug.js.map +1 -0
  1175. package/dist/modes/interactive/interactive-input-handling.d.ts +2 -0
  1176. package/dist/modes/interactive/interactive-input-handling.d.ts.map +1 -0
  1177. package/dist/modes/interactive/interactive-input-handling.js +275 -0
  1178. package/dist/modes/interactive/interactive-input-handling.js.map +1 -0
  1179. package/dist/modes/interactive/interactive-mode-base.d.ts +103 -0
  1180. package/dist/modes/interactive/interactive-mode-base.d.ts.map +1 -0
  1181. package/dist/modes/interactive/interactive-mode-base.js +130 -0
  1182. package/dist/modes/interactive/interactive-mode-base.js.map +1 -0
  1183. package/dist/modes/interactive/interactive-mode-deps.d.ts +81 -0
  1184. package/dist/modes/interactive/interactive-mode-deps.d.ts.map +1 -0
  1185. package/dist/modes/interactive/interactive-mode-deps.js +74 -0
  1186. package/dist/modes/interactive/interactive-mode-deps.js.map +1 -0
  1187. package/dist/modes/interactive/interactive-mode-helpers.d.ts +21 -0
  1188. package/dist/modes/interactive/interactive-mode-helpers.d.ts.map +1 -0
  1189. package/dist/modes/interactive/interactive-mode-helpers.js +77 -0
  1190. package/dist/modes/interactive/interactive-mode-helpers.js.map +1 -0
  1191. package/dist/modes/interactive/interactive-mode-surface.d.ts +313 -0
  1192. package/dist/modes/interactive/interactive-mode-surface.d.ts.map +1 -0
  1193. package/dist/modes/interactive/interactive-mode-surface.js +2 -0
  1194. package/dist/modes/interactive/interactive-mode-surface.js.map +1 -0
  1195. package/dist/modes/interactive/interactive-mode-types.d.ts +29 -0
  1196. package/dist/modes/interactive/interactive-mode-types.d.ts.map +1 -0
  1197. package/dist/modes/interactive/interactive-mode-types.js +2 -0
  1198. package/dist/modes/interactive/interactive-mode-types.js.map +1 -0
  1199. package/dist/modes/interactive/interactive-mode.d.ts +30 -404
  1200. package/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
  1201. package/dist/modes/interactive/interactive-mode.js +29 -5260
  1202. package/dist/modes/interactive/interactive-mode.js.map +1 -1
  1203. package/dist/modes/interactive/interactive-model-routing.d.ts +2 -0
  1204. package/dist/modes/interactive/interactive-model-routing.d.ts.map +1 -0
  1205. package/dist/modes/interactive/interactive-model-routing.js +269 -0
  1206. package/dist/modes/interactive/interactive-model-routing.js.map +1 -0
  1207. package/dist/modes/interactive/interactive-process-lifecycle.d.ts +2 -0
  1208. package/dist/modes/interactive/interactive-process-lifecycle.d.ts.map +1 -0
  1209. package/dist/modes/interactive/interactive-process-lifecycle.js +189 -0
  1210. package/dist/modes/interactive/interactive-process-lifecycle.js.map +1 -0
  1211. package/dist/modes/interactive/interactive-queueing.d.ts +2 -0
  1212. package/dist/modes/interactive/interactive-queueing.d.ts.map +1 -0
  1213. package/dist/modes/interactive/interactive-queueing.js +163 -0
  1214. package/dist/modes/interactive/interactive-queueing.js.map +1 -0
  1215. package/dist/modes/interactive/interactive-render-chat.d.ts +2 -0
  1216. package/dist/modes/interactive/interactive-render-chat.d.ts.map +1 -0
  1217. package/dist/modes/interactive/interactive-render-chat.js +170 -0
  1218. package/dist/modes/interactive/interactive-render-chat.js.map +1 -0
  1219. package/dist/modes/interactive/interactive-resource-disclosure.d.ts +2 -0
  1220. package/dist/modes/interactive/interactive-resource-disclosure.d.ts.map +1 -0
  1221. package/dist/modes/interactive/interactive-resource-disclosure.js +101 -0
  1222. package/dist/modes/interactive/interactive-resource-disclosure.js.map +1 -0
  1223. package/dist/modes/interactive/interactive-resource-paths.d.ts +2 -0
  1224. package/dist/modes/interactive/interactive-resource-paths.d.ts.map +1 -0
  1225. package/dist/modes/interactive/interactive-resource-paths.js +228 -0
  1226. package/dist/modes/interactive/interactive-resource-paths.js.map +1 -0
  1227. package/dist/modes/interactive/interactive-resource-rendering.d.ts +2 -0
  1228. package/dist/modes/interactive/interactive-resource-rendering.d.ts.map +1 -0
  1229. package/dist/modes/interactive/interactive-resource-rendering.js +181 -0
  1230. package/dist/modes/interactive/interactive-resource-rendering.js.map +1 -0
  1231. package/dist/modes/interactive/interactive-selectors.d.ts +2 -0
  1232. package/dist/modes/interactive/interactive-selectors.d.ts.map +1 -0
  1233. package/dist/modes/interactive/interactive-selectors.js +198 -0
  1234. package/dist/modes/interactive/interactive-selectors.js.map +1 -0
  1235. package/dist/modes/interactive/interactive-session-routing.d.ts +2 -0
  1236. package/dist/modes/interactive/interactive-session-routing.d.ts.map +1 -0
  1237. package/dist/modes/interactive/interactive-session-routing.js +232 -0
  1238. package/dist/modes/interactive/interactive-session-routing.js.map +1 -0
  1239. package/dist/modes/interactive/interactive-session-runtime.d.ts +2 -0
  1240. package/dist/modes/interactive/interactive-session-runtime.d.ts.map +1 -0
  1241. package/dist/modes/interactive/interactive-session-runtime.js +131 -0
  1242. package/dist/modes/interactive/interactive-session-runtime.js.map +1 -0
  1243. package/dist/modes/interactive/interactive-slash-commands.d.ts +2 -0
  1244. package/dist/modes/interactive/interactive-slash-commands.d.ts.map +1 -0
  1245. package/dist/modes/interactive/interactive-slash-commands.js +338 -0
  1246. package/dist/modes/interactive/interactive-slash-commands.js.map +1 -0
  1247. package/dist/modes/interactive/interactive-startup.d.ts +2 -0
  1248. package/dist/modes/interactive/interactive-startup.d.ts.map +1 -0
  1249. package/dist/modes/interactive/interactive-startup.js +348 -0
  1250. package/dist/modes/interactive/interactive-startup.js.map +1 -0
  1251. package/dist/modes/interactive/theme/color-utils.d.ts +20 -0
  1252. package/dist/modes/interactive/theme/color-utils.d.ts.map +1 -0
  1253. package/dist/modes/interactive/theme/color-utils.js +204 -0
  1254. package/dist/modes/interactive/theme/color-utils.js.map +1 -0
  1255. package/dist/modes/interactive/theme/export-colors.d.ts +19 -0
  1256. package/dist/modes/interactive/theme/export-colors.d.ts.map +1 -0
  1257. package/dist/modes/interactive/theme/export-colors.js +69 -0
  1258. package/dist/modes/interactive/theme/export-colors.js.map +1 -0
  1259. package/dist/modes/interactive/theme/global-theme.d.ts +12 -0
  1260. package/dist/modes/interactive/theme/global-theme.d.ts.map +1 -0
  1261. package/dist/modes/interactive/theme/global-theme.js +150 -0
  1262. package/dist/modes/interactive/theme/global-theme.js.map +1 -0
  1263. package/dist/modes/interactive/theme/terminal-detection.d.ts +30 -0
  1264. package/dist/modes/interactive/theme/terminal-detection.d.ts.map +1 -0
  1265. package/dist/modes/interactive/theme/terminal-detection.js +89 -0
  1266. package/dist/modes/interactive/theme/terminal-detection.js.map +1 -0
  1267. package/dist/modes/interactive/theme/theme-class.d.ts +30 -0
  1268. package/dist/modes/interactive/theme/theme-class.d.ts.map +1 -0
  1269. package/dist/modes/interactive/theme/theme-class.js +83 -0
  1270. package/dist/modes/interactive/theme/theme-class.js.map +1 -0
  1271. package/dist/modes/interactive/theme/theme-loading.d.ts +17 -0
  1272. package/dist/modes/interactive/theme/theme-loading.d.ts.map +1 -0
  1273. package/dist/modes/interactive/theme/theme-loading.js +155 -0
  1274. package/dist/modes/interactive/theme/theme-loading.js.map +1 -0
  1275. package/dist/modes/interactive/theme/theme-parse.d.ts +5 -0
  1276. package/dist/modes/interactive/theme/theme-parse.d.ts.map +1 -0
  1277. package/dist/modes/interactive/theme/theme-parse.js +52 -0
  1278. package/dist/modes/interactive/theme/theme-parse.js.map +1 -0
  1279. package/dist/modes/interactive/theme/theme-schema.d.ts +255 -0
  1280. package/dist/modes/interactive/theme/theme-schema.d.ts.map +1 -0
  1281. package/dist/modes/interactive/theme/theme-schema.js +78 -0
  1282. package/dist/modes/interactive/theme/theme-schema.js.map +1 -0
  1283. package/dist/modes/interactive/theme/theme.d.ts +6 -108
  1284. package/dist/modes/interactive/theme/theme.d.ts.map +1 -1
  1285. package/dist/modes/interactive/theme/theme.js +6 -1065
  1286. package/dist/modes/interactive/theme/theme.js.map +1 -1
  1287. package/dist/modes/interactive/theme/tui-theme.d.ts +15 -0
  1288. package/dist/modes/interactive/theme/tui-theme.d.ts.map +1 -0
  1289. package/dist/modes/interactive/theme/tui-theme.js +199 -0
  1290. package/dist/modes/interactive/theme/tui-theme.js.map +1 -0
  1291. package/dist/modes/rpc/rpc-client.d.ts +1 -61
  1292. package/dist/modes/rpc/rpc-client.d.ts.map +1 -1
  1293. package/dist/modes/rpc/rpc-client.js +1 -72
  1294. package/dist/modes/rpc/rpc-client.js.map +1 -1
  1295. package/dist/modes/rpc/rpc-command-handler.d.ts +14 -0
  1296. package/dist/modes/rpc/rpc-command-handler.d.ts.map +1 -0
  1297. package/dist/modes/rpc/rpc-command-handler.js +226 -0
  1298. package/dist/modes/rpc/rpc-command-handler.js.map +1 -0
  1299. package/dist/modes/rpc/rpc-extension-ui.d.ts +15 -0
  1300. package/dist/modes/rpc/rpc-extension-ui.d.ts.map +1 -0
  1301. package/dist/modes/rpc/rpc-extension-ui.js +196 -0
  1302. package/dist/modes/rpc/rpc-extension-ui.js.map +1 -0
  1303. package/dist/modes/rpc/rpc-input.d.ts +12 -0
  1304. package/dist/modes/rpc/rpc-input.d.ts.map +1 -0
  1305. package/dist/modes/rpc/rpc-input.js +54 -0
  1306. package/dist/modes/rpc/rpc-input.js.map +1 -0
  1307. package/dist/modes/rpc/rpc-mode.d.ts.map +1 -1
  1308. package/dist/modes/rpc/rpc-mode.js +43 -607
  1309. package/dist/modes/rpc/rpc-mode.js.map +1 -1
  1310. package/dist/modes/rpc/rpc-responses.d.ts +8 -0
  1311. package/dist/modes/rpc/rpc-responses.d.ts.map +1 -0
  1312. package/dist/modes/rpc/rpc-responses.js +27 -0
  1313. package/dist/modes/rpc/rpc-responses.js.map +1 -0
  1314. package/dist/modes/rpc/rpc-session-binding.d.ts +25 -0
  1315. package/dist/modes/rpc/rpc-session-binding.d.ts.map +1 -0
  1316. package/dist/modes/rpc/rpc-session-binding.js +70 -0
  1317. package/dist/modes/rpc/rpc-session-binding.js.map +1 -0
  1318. package/dist/package-manager-cli-parser.d.ts +28 -0
  1319. package/dist/package-manager-cli-parser.d.ts.map +1 -0
  1320. package/dist/package-manager-cli-parser.js +269 -0
  1321. package/dist/package-manager-cli-parser.js.map +1 -0
  1322. package/dist/package-manager-cli.d.ts +0 -1
  1323. package/dist/package-manager-cli.d.ts.map +1 -1
  1324. package/dist/package-manager-cli.js +2 -267
  1325. package/dist/package-manager-cli.js.map +1 -1
  1326. package/dist/utils/git.d.ts.map +1 -1
  1327. package/dist/utils/git.js +10 -0
  1328. package/dist/utils/git.js.map +1 -1
  1329. package/dist/utils/version-check.d.ts +1 -0
  1330. package/dist/utils/version-check.d.ts.map +1 -1
  1331. package/dist/utils/version-check.js +17 -0
  1332. package/dist/utils/version-check.js.map +1 -1
  1333. package/docs/development.md +4 -0
  1334. package/docs/workflows.md +8 -6
  1335. package/examples/extensions/custom-provider-anthropic/index.ts +1 -106
  1336. package/examples/extensions/gondolin/index.ts +0 -23
  1337. package/examples/extensions/overlay-qa-animation-components.ts +255 -0
  1338. package/examples/extensions/overlay-qa-focus-components.ts +222 -0
  1339. package/examples/extensions/overlay-qa-position-components.ts +433 -0
  1340. package/examples/extensions/overlay-qa-shared.ts +37 -0
  1341. package/examples/extensions/overlay-qa-streaming-input-components.ts +205 -0
  1342. package/examples/extensions/overlay-qa-tests.ts +17 -1156
  1343. package/examples/extensions/overlay-qa-toggle-passive-components.ts +169 -0
  1344. package/examples/extensions/space-invaders.ts +0 -60
  1345. package/examples/extensions/subagent/display.ts +148 -0
  1346. package/examples/extensions/subagent/index.ts +11 -858
  1347. package/examples/extensions/subagent/render.ts +383 -0
  1348. package/examples/extensions/subagent/runner.ts +252 -0
  1349. package/examples/extensions/subagent/schemas.ts +59 -0
  1350. package/examples/extensions/subagent/types.ts +36 -0
  1351. package/examples/extensions/tic-tac-toe-instructions.ts +65 -0
  1352. package/examples/extensions/tic-tac-toe-rendering.ts +414 -0
  1353. package/examples/extensions/tic-tac-toe-state.ts +158 -0
  1354. package/examples/extensions/tic-tac-toe.ts +92 -754
  1355. package/examples/rpc-extension-ui-components.ts +189 -0
  1356. package/examples/rpc-extension-ui.ts +2 -179
  1357. package/package.json +4 -4
@@ -1,1805 +1,18 @@
1
1
  /**
2
- * Rendering functions for subagent results
3
- */
4
-
5
- import * as path from "node:path";
6
- import type { AgentToolResult } from "@earendil-works/pi-agent-core";
7
- import { getMarkdownTheme, type ExtensionContext } from "@bastani/atomic";
8
- import { Container, Markdown, Spacer, Text, visibleWidth, type Component } from "@earendil-works/pi-tui";
9
- import {
10
- type AgentProgress,
11
- type AsyncJobState,
12
- type AsyncJobStep,
13
- type AsyncParallelGroupStatus,
14
- type Details,
15
- type NestedRunSummary,
16
- type NestedStepSummary,
17
- type WorkflowNodeStatus,
18
- MAX_WIDGET_JOBS,
19
- WIDGET_KEY,
20
- } from "../shared/types.ts";
21
- import { formatTokens, formatUsage, formatDuration, formatModelThinking, formatToolCall, shortenPath } from "../shared/formatters.ts";
22
- import { getDisplayItems, getSingleResultOutput } from "../shared/utils.ts";
23
- import { flatToLogicalStepIndex } from "../runs/background/parallel-groups.ts";
24
- import { formatNestedAggregate } from "../runs/shared/nested-render.ts";
25
- import { aggregateStepStatus, formatActivityLabel, formatAgentRunningLabel, formatParallelOutcome } from "../shared/status-format.ts";
26
-
27
- type Theme = ExtensionContext["ui"]["theme"];
28
-
29
- function getTermWidth(): number {
30
- return process.stdout.columns || 120;
31
- }
32
-
33
- const segmenter = new Intl.Segmenter(undefined, { granularity: "grapheme" });
34
-
35
- /**
36
- * Truncate a line to maxWidth, preserving ANSI styling through the ellipsis.
37
- *
38
- * pi-tui's truncateToWidth adds \x1b[0m before ellipsis which resets all styling,
39
- * causing background color bleed in the TUI. This implementation tracks active
40
- * ANSI styles and re-applies them before the ellipsis.
2
+ * Rendering functions for subagent results.
41
3
  *
42
- * Uses Intl.Segmenter for proper Unicode/emoji handling (not char-by-char).
43
- */
44
- function truncLine(text: string, maxWidth: number): string {
45
- if (visibleWidth(text) <= maxWidth) return text;
46
-
47
- const targetWidth = maxWidth - 1;
48
- let result = "";
49
- let currentWidth = 0;
50
- let activeStyles: string[] = [];
51
- let i = 0;
52
-
53
- while (i < text.length) {
54
- const ansiMatch = text.slice(i).match(/^\x1b\[[0-9;]*m/);
55
- if (ansiMatch) {
56
- const code = ansiMatch[0];
57
- result += code;
58
-
59
- if (code === "\x1b[0m" || code === "\x1b[m") {
60
- activeStyles = [];
61
- } else {
62
- activeStyles.push(code);
63
- }
64
- i += code.length;
65
- continue;
66
- }
67
-
68
- let end = i;
69
- while (end < text.length && !text.slice(end).match(/^\x1b\[[0-9;]*m/)) {
70
- end++;
71
- }
72
-
73
- const textPortion = text.slice(i, end);
74
- for (const seg of segmenter.segment(textPortion)) {
75
- const grapheme = seg.segment;
76
- const graphemeWidth = visibleWidth(grapheme);
77
-
78
- if (currentWidth + graphemeWidth > targetWidth) {
79
- return result + activeStyles.join("") + "…";
80
- }
81
-
82
- result += grapheme;
83
- currentWidth += graphemeWidth;
84
- }
85
- i = end;
86
- }
87
-
88
- return result + activeStyles.join("") + "…";
89
- }
90
-
91
- const RUNNING_FRAMES = ["⠋", "⠙", "⠹", "⠸", "⠼", "⠴", "⠦", "⠧", "⠇", "⠏"];
92
-
93
- /**
94
- * Spinner cadence (ms per frame). The running glyph is derived from wall-clock
95
- * time so every active spinner advances smoothly and in lockstep, independent
96
- * of how often (or how irregularly) progress data updates arrive. The animation
97
- * timers below only schedule re-renders; the displayed frame always comes from
98
- * the clock. This fixes the frozen/stuttering spinner from issue #1084 while
99
- * keeping per-frame diffs to a single glyph cell so the differential renderer
100
- * never needs a full-clear (no flicker).
101
- */
102
- export const RUNNING_ANIMATION_MS = 80;
103
-
104
- type ProgressSeedSource = Partial<Pick<AgentProgress, "index" | "toolCount" | "tokens" | "durationMs" | "lastActivityAt" | "currentToolStartedAt" | "turnCount">>;
105
-
106
- /**
107
- * Wall-clock-derived animation frame counter. Advances exactly one step every
108
- * `RUNNING_ANIMATION_MS`. Exposed for tests so they can pin a deterministic now.
4
+ * Public facade retained for existing imports; implementation is split by
5
+ * rendering responsibility across sibling modules.
109
6
  */
110
- export function currentRunningFrame(now: number = Date.now()): number {
111
- return Math.floor(now / RUNNING_ANIMATION_MS);
112
- }
113
-
114
- function runningSeed(...values: Array<number | undefined>): number | undefined {
115
- let seed: number | undefined;
116
- for (const value of values) {
117
- if (value === undefined || !Number.isFinite(value)) continue;
118
- seed = (seed ?? 0) + Math.trunc(value);
119
- }
120
- return seed;
121
- }
122
-
123
- function runningGlyph(seed?: number, now?: number): string {
124
- // Fold the wall-clock frame into the (optional) progress seed so the glyph
125
- // advances over time. Callers that render into chat scrollback can pass a
126
- // captured `now` so host re-renders do not mutate already-emitted lines.
127
- const animatedSeed = runningSeed(seed, currentRunningFrame(now)) ?? 0;
128
- return RUNNING_FRAMES[Math.abs(animatedSeed) % RUNNING_FRAMES.length]!;
129
- }
130
-
131
- function progressRunningSeed(progress: ProgressSeedSource | undefined): number | undefined {
132
- if (!progress) return undefined;
133
- return runningSeed(
134
- progress.index,
135
- progress.toolCount,
136
- progress.tokens,
137
- progress.durationMs,
138
- progress.lastActivityAt,
139
- progress.currentToolStartedAt,
140
- progress.turnCount,
141
- );
142
- }
143
-
144
- type ResultAnimationTimer = ReturnType<typeof setInterval>;
145
-
146
- export interface SubagentResultRenderState {
147
- subagentResultAnimationTimer?: ResultAnimationTimer;
148
- subagentResultSnapshotKey?: string;
149
- /** Stable semantic/content timestamp used for durations and activity text. */
150
- subagentResultSnapshotNow?: number;
151
- /** Timer-driven timestamp used only for spinner glyph frames. */
152
- subagentResultSpinnerFrameNow?: number;
153
- }
154
-
155
- type ResultAnimationContext = {
156
- state: SubagentResultRenderState;
157
- invalidate: () => void;
158
- };
159
- type LegacyResultAnimationContext = { state: { subagentResultAnimationTimer?: ResultAnimationTimer } };
160
-
161
- const activeResultAnimationTimers = new Map<ResultAnimationTimer, SubagentResultRenderState>();
162
-
163
- export function clearResultAnimationTimer(context: LegacyResultAnimationContext): void {
164
- const timer = context.state.subagentResultAnimationTimer;
165
- if (timer) {
166
- clearInterval(timer);
167
- activeResultAnimationTimers.delete(timer);
168
- }
169
- context.state.subagentResultAnimationTimer = undefined;
170
- }
171
-
172
- export function clearLegacyResultAnimationTimer(context: LegacyResultAnimationContext): void {
173
- clearResultAnimationTimer(context);
174
- }
175
-
176
- export function ensureResultAnimation(context: ResultAnimationContext): void {
177
- if (context.state.subagentResultAnimationTimer) return;
178
- const timer = setInterval(() => {
179
- context.state.subagentResultSpinnerFrameNow = Date.now();
180
- try {
181
- context.invalidate();
182
- } catch {
183
- clearResultAnimationTimer(context);
184
- }
185
- }, RUNNING_ANIMATION_MS);
186
- timer.unref?.();
187
- context.state.subagentResultAnimationTimer = timer;
188
- activeResultAnimationTimers.set(timer, context.state);
189
- }
190
-
191
- export function stopResultAnimations(): void {
192
- for (const [timer, state] of activeResultAnimationTimers) {
193
- clearInterval(timer);
194
- if (state.subagentResultAnimationTimer === timer) state.subagentResultAnimationTimer = undefined;
195
- }
196
- activeResultAnimationTimers.clear();
197
- }
198
-
199
- function extractOutputTarget(task: string): string | undefined {
200
- const writeToMatch = task.match(/\[Write to:\s*([^\]\n]+)\]/i);
201
- if (writeToMatch?.[1]?.trim()) return writeToMatch[1].trim();
202
- const findingsMatch = task.match(/Write your findings to:\s*(\S+)/i);
203
- if (findingsMatch?.[1]?.trim()) return findingsMatch[1].trim();
204
- const outputMatch = task.match(/[Oo]utput(?:\s+to)?\s*:\s*(\S+)/i);
205
- if (outputMatch?.[1]?.trim()) return outputMatch[1].trim();
206
- return undefined;
207
- }
208
-
209
- function hasEmptyTextOutputWithoutOutputTarget(task: string, output: string): boolean {
210
- if (output.trim()) return false;
211
- return !extractOutputTarget(task);
212
- }
213
-
214
- function getToolCallLines(
215
- result: Pick<Details["results"][number], "messages" | "toolCalls">,
216
- expanded: boolean,
217
- ): string[] {
218
- if (result.messages) {
219
- return getDisplayItems(result.messages)
220
- .filter((item): item is { type: "tool"; name: string; args: Record<string, unknown> } => item.type === "tool")
221
- .map((item) => formatToolCall(item.name, item.args, expanded));
222
- }
223
- return result.toolCalls?.map((toolCall) => expanded ? toolCall.expandedText : toolCall.text) ?? [];
224
- }
225
-
226
-
227
- function snapshotNowForProgress(progress: Pick<AgentProgress, "currentToolStartedAt" | "durationMs" | "lastActivityAt">, now?: number): number | undefined {
228
- if (now !== undefined) return now;
229
- if (progress.lastActivityAt !== undefined) return progress.lastActivityAt;
230
- if (progress.currentToolStartedAt !== undefined && progress.durationMs !== undefined) return progress.currentToolStartedAt + progress.durationMs;
231
- return undefined;
232
- }
233
-
234
- function formatCurrentToolLine(
235
- progress: Pick<AgentProgress, "currentTool" | "currentToolArgs" | "currentToolStartedAt">,
236
- availableWidth: number,
237
- expanded: boolean,
238
- snapshotNow?: number,
239
- ): string | undefined {
240
- if (!progress.currentTool) return undefined;
241
- const maxToolArgsLen = Math.max(50, availableWidth - 20);
242
- const toolArgsPreview = progress.currentToolArgs
243
- ? (expanded || progress.currentToolArgs.length <= maxToolArgsLen
244
- ? progress.currentToolArgs
245
- : `${progress.currentToolArgs.slice(0, maxToolArgsLen)}...`)
246
- : "";
247
- const durationSuffix = progress.currentToolStartedAt !== undefined && snapshotNow !== undefined
248
- ? ` | ${formatDuration(Math.max(0, snapshotNow - progress.currentToolStartedAt))}`
249
- : "";
250
- return toolArgsPreview
251
- ? `${progress.currentTool}: ${toolArgsPreview}${durationSuffix}`
252
- : `${progress.currentTool}${durationSuffix}`;
253
- }
254
-
255
- function buildLiveStatusLine(progress: Pick<AgentProgress, "activityState" | "lastActivityAt">, snapshotNow?: number): string | undefined {
256
- if (progress.lastActivityAt !== undefined && snapshotNow !== undefined) return formatActivityLabel(progress.lastActivityAt, progress.activityState, snapshotNow);
257
- if (progress.activityState === "needs_attention") return "needs attention";
258
- if (progress.activityState === "active_long_running") return "active but long-running";
259
- if (progress.lastActivityAt !== undefined) return "active";
260
- return undefined;
261
- }
262
-
263
- function themeBold(theme: Theme, text: string): string {
264
- return ((theme as { bold?: (value: string) => string }).bold?.(text)) ?? text;
265
- }
266
-
267
- function statJoin(theme: Theme, parts: string[]): string {
268
- return parts.filter(Boolean).map((part) => theme.fg("dim", part)).join(` ${theme.fg("dim", "·")} `);
269
- }
270
-
271
- function formatTokenStat(tokens: number): string {
272
- return `${formatTokens(tokens)} token`;
273
- }
274
-
275
- function formatToolUseStat(count: number): string {
276
- return `${count} tool use${count === 1 ? "" : "s"}`;
277
- }
278
-
279
- function displayProgressDurationMs(progress: Pick<AgentProgress, "durationMs"> & Partial<Pick<AgentProgress, "lastActivityAt" | "status">>, now?: number): number {
280
- if (progress.status === "running" && progress.lastActivityAt !== undefined && now !== undefined) {
281
- return progress.durationMs + Math.max(0, now - progress.lastActivityAt);
282
- }
283
- return progress.durationMs;
284
- }
285
-
286
- function formatProgressStats(
287
- theme: Theme,
288
- progress: (Pick<AgentProgress, "toolCount" | "tokens" | "durationMs"> & Partial<Pick<AgentProgress, "lastActivityAt" | "status">>) | undefined,
289
- includeDuration = true,
290
- now?: number,
291
- ): string {
292
- if (!progress) return "";
293
- const parts: string[] = [];
294
- if (progress.toolCount > 0) parts.push(formatToolUseStat(progress.toolCount));
295
- if (progress.tokens > 0) parts.push(formatTokenStat(progress.tokens));
296
- const durationMs = displayProgressDurationMs(progress, now);
297
- if (includeDuration && durationMs > 0) parts.push(formatDuration(durationMs));
298
- return statJoin(theme, parts);
299
- }
300
-
301
- function firstOutputLine(text: string): string {
302
- return text.split("\n").find((line) => line.trim())?.trim() ?? "";
303
- }
304
-
305
- function resultStatusLine(result: Details["results"][number], output: string): string {
306
- if (result.detached) return result.detachedReason ? `Detached: ${result.detachedReason}` : "Detached";
307
- if (result.interrupted) return "Paused";
308
- if (result.exitCode !== 0) return `Error: ${result.error ?? (firstOutputLine(output) || `exit ${result.exitCode}`)}`;
309
- if (hasEmptyTextOutputWithoutOutputTarget(result.task, output)) return "Done (no text output)";
310
- return "Done";
311
- }
312
-
313
- function resultGlyph(result: Details["results"][number], output: string, theme: Theme, running = result.progress?.status === "running", seed = progressRunningSeed(result.progress ?? result.progressSummary), now?: number): string {
314
- if (running) return theme.fg("accent", runningGlyph(seed, now));
315
- if (result.detached) return theme.fg("warning", "■");
316
- if (result.interrupted) return theme.fg("warning", "■");
317
- if (result.exitCode !== 0) return theme.fg("error", "✗");
318
- if (hasEmptyTextOutputWithoutOutputTarget(result.task, output)) return theme.fg("warning", "✓");
319
- return theme.fg("success", "✓");
320
- }
321
-
322
- function compactCurrentActivity(progress: AgentProgress, now?: number): string {
323
- const snapshotNow = snapshotNowForProgress(progress, now);
324
- return formatCurrentToolLine(progress, getTermWidth() - 4, false, snapshotNow) ?? buildLiveStatusLine(progress, snapshotNow) ?? "thinking…";
325
- }
326
-
327
- export function widgetRenderKey(job: AsyncJobState): string {
328
- return JSON.stringify({
329
- asyncDir: job.asyncDir,
330
- status: job.status,
331
- activityState: job.activityState,
332
- lastActivityAt: job.lastActivityAt,
333
- currentTool: job.currentTool,
334
- currentToolStartedAt: job.currentToolStartedAt,
335
- currentPath: job.currentPath,
336
- turnCount: job.turnCount,
337
- toolCount: job.toolCount,
338
- mode: job.mode,
339
- agents: job.agents,
340
- currentStep: job.currentStep,
341
- chainStepCount: job.chainStepCount,
342
- parallelGroups: job.parallelGroups,
343
- steps: job.steps,
344
- nestedChildren: job.nestedChildren,
345
- stepsTotal: job.stepsTotal,
346
- runningSteps: job.runningSteps,
347
- completedSteps: job.completedSteps,
348
- activeParallelGroup: job.activeParallelGroup,
349
- startedAt: job.startedAt,
350
- updatedAt: job.updatedAt,
351
- totalTokens: job.totalTokens,
352
- });
353
- }
354
-
355
- function formatWidgetAgents(agents: string[]): string {
356
- const distinct = [...new Set(agents)];
357
- if (distinct.length === 1 && agents.length > 1) return `${distinct[0]} ×${agents.length}`;
358
- if (agents.length > 3) return `${agents.slice(0, 2).join(", ")} +${agents.length - 2} more`;
359
- return agents.join(", ");
360
- }
361
-
362
- function widgetJobName(job: AsyncJobState): string {
363
- if (job.mode === "parallel") return "parallel";
364
- if (job.mode === "chain") return "chain";
365
- if (job.mode === "single" && job.agents?.length === 1) return job.agents[0]!;
366
- if (job.agents?.length) return formatWidgetAgents(job.agents);
367
- return job.mode ?? "subagent";
368
- }
369
-
370
- function widgetActivity(job: AsyncJobState): string {
371
- const facts: string[] = [];
372
- if (job.currentTool && job.currentToolStartedAt !== undefined && job.updatedAt !== undefined) facts.push(`${job.currentTool} ${formatDuration(Math.max(0, job.updatedAt - job.currentToolStartedAt))}`);
373
- else if (job.currentTool) facts.push(job.currentTool);
374
- if (job.currentPath) facts.push(shortenPath(job.currentPath));
375
- if (job.turnCount !== undefined) facts.push(`${job.turnCount} turns`);
376
- if (job.toolCount !== undefined) facts.push(`${job.toolCount} tools`);
377
- const activity = buildLiveStatusLine(job, job.updatedAt);
378
- if (activity && facts.length) return `${activity} · ${facts.join(" · ")}`;
379
- if (activity) return activity;
380
- if (facts.length) return facts.join(" · ");
381
- if (job.status === "running") return "thinking…";
382
- if (job.status === "queued") return "queued…";
383
- if (job.status === "paused") return "Paused";
384
- if (job.status === "failed") return "Failed";
385
- return "Done";
386
- }
387
-
388
- function widgetStepRunningSeed(step: NonNullable<AsyncJobState["steps"]>[number], fallbackIndex?: number): number | undefined {
389
- return runningSeed(
390
- fallbackIndex,
391
- step.index,
392
- step.toolCount,
393
- step.turnCount,
394
- step.tokens?.total,
395
- step.lastActivityAt,
396
- step.currentToolStartedAt,
397
- step.durationMs,
398
- );
399
- }
400
-
401
- function widgetStepsRunningSeed(steps: Array<NonNullable<AsyncJobState["steps"]>[number]> | undefined): number | undefined {
402
- let seed: number | undefined;
403
- for (const [index, step] of (steps ?? []).entries()) seed = runningSeed(seed, widgetStepRunningSeed(step, index));
404
- return seed;
405
- }
406
-
407
- function widgetJobRunningSeed(job: AsyncJobState): number | undefined {
408
- return runningSeed(
409
- job.updatedAt,
410
- job.lastActivityAt,
411
- job.toolCount,
412
- job.turnCount,
413
- job.totalTokens?.total,
414
- job.currentStep,
415
- job.runningSteps,
416
- job.completedSteps,
417
- widgetStepsRunningSeed(job.steps),
418
- );
419
- }
420
-
421
- function widgetJobsRunningSeed(jobs: AsyncJobState[]): number | undefined {
422
- let seed: number | undefined;
423
- for (const job of jobs) seed = runningSeed(seed, widgetJobRunningSeed(job));
424
- return seed;
425
- }
426
-
427
- function widgetStatusGlyph(job: AsyncJobState, theme: Theme, now?: number): string {
428
- if (job.status === "running") return theme.fg("accent", runningGlyph(widgetJobRunningSeed(job), now));
429
- if (job.status === "queued") return theme.fg("muted", "◦");
430
- if (job.status === "complete") return theme.fg("success", "✓");
431
- if (job.status === "paused") return theme.fg("warning", "■");
432
- return theme.fg("error", "✗");
433
- }
434
-
435
- function widgetStepGlyph(status: AsyncJobStep["status"], theme: Theme, seed?: number, now?: number): string {
436
- if (status === "running") return theme.fg("accent", runningGlyph(seed, now));
437
- if (status === "complete" || status === "completed") return theme.fg("success", "✓");
438
- if (status === "failed") return theme.fg("error", "✗");
439
- if (status === "paused") return theme.fg("warning", "■");
440
- return theme.fg("muted", "◦");
441
- }
442
-
443
- function widgetStepStatus(status: AsyncJobStep["status"], theme: Theme): string {
444
- if (status === "running") return theme.fg("accent", "running");
445
- if (status === "complete" || status === "completed") return theme.fg("success", "complete");
446
- if (status === "failed") return theme.fg("error", "failed");
447
- if (status === "paused") return theme.fg("warning", "paused");
448
- return theme.fg("dim", status);
449
- }
450
-
451
- function widgetStepActivity(step: NonNullable<AsyncJobState["steps"]>[number], snapshotNow?: number): string {
452
- const facts: string[] = [];
453
- if (step.currentTool && step.currentToolStartedAt !== undefined && snapshotNow !== undefined) facts.push(`${step.currentTool} ${formatDuration(Math.max(0, snapshotNow - step.currentToolStartedAt))}`);
454
- else if (step.currentTool) facts.push(step.currentTool);
455
- if (step.currentPath) facts.push(shortenPath(step.currentPath));
456
- if (step.turnCount !== undefined) facts.push(`${step.turnCount} turns`);
457
- if (step.toolCount !== undefined) facts.push(`${step.toolCount} tools`);
458
- if (step.tokens?.total) facts.push(formatTokenStat(step.tokens.total));
459
- const activity = buildLiveStatusLine(step, snapshotNow);
460
- if (activity && facts.length) return `${activity} · ${facts.join(" · ")}`;
461
- if (activity) return activity;
462
- return facts.join(" · ");
463
- }
464
-
465
-
466
- function widgetChainDetails(job: AsyncJobState, theme: Theme, expanded = false, width = getTermWidth(), now?: number): string[] {
467
- if (!job.steps?.length) return [];
468
- const total = job.chainStepCount ?? job.steps.length;
469
- const lines: string[] = [];
470
- for (const span of buildAsyncChainStepSpans(total, job.steps.length, job.parallelGroups)) {
471
- const steps = job.steps.slice(span.start, span.start + span.count);
472
- if (span.isParallel) {
473
- const status = aggregateStepStatus(steps);
474
- lines.push(` ${widgetStepGlyph(status, theme, widgetStepsRunningSeed(steps), now)} Step ${span.stepIndex + 1}/${total}: ${themeBold(theme, "parallel group")} ${theme.fg("dim", "·")} ${theme.fg("dim", formatParallelOutcome(steps, span.count))}`);
475
- continue;
476
- }
477
- const step = steps[0];
478
- if (!step) {
479
- lines.push(` ${theme.fg("dim", `◦ Step ${span.stepIndex + 1}/${total}: pending`)}`);
480
- continue;
481
- }
482
- lines.push(...foregroundStyleWidgetStepLines(job, theme, step, "Step", span.stepIndex + 1, total, expanded, width, now));
483
- }
484
- return lines;
485
- }
486
-
487
- function widgetParallelAgentDetails(job: AsyncJobState, theme: Theme, expanded = false, width = getTermWidth(), now?: number): string[] {
488
- if (!job.steps?.length) return [];
489
- if (job.mode !== "parallel" && job.mode !== "chain") return [];
490
- if (job.mode === "chain" && !job.activeParallelGroup && job.parallelGroups?.length) return widgetChainDetails(job, theme, expanded, width, now);
491
- const total = job.stepsTotal ?? job.steps.length;
492
- const lines: string[] = [];
493
- for (const [index, step] of job.steps.entries()) {
494
- const marker = index === job.steps.length - 1 ? "└" : "├";
495
- const activity = widgetStepActivity(step, job.updatedAt);
496
- const itemTitle = job.mode === "parallel" || job.activeParallelGroup ? "Agent" : "Step";
497
- const modelDisplay = modelThinkingBadge(theme, step.model, step.thinking, step.fastMode);
498
- lines.push(` ${theme.fg("dim", `${marker} ${widgetStepGlyph(step.status, theme, widgetStepRunningSeed(step, index), now)} ${itemTitle} ${index + 1}/${total}: ${step.agent} · ${widgetStepStatus(step.status, theme)}${modelDisplay}${activity ? ` · ${activity}` : ""}`)}`);
499
- for (const nestedLine of formatNestedWidgetLines(step.children, theme, width, expanded, job.updatedAt, expanded ? 8 : 1, now)) lines.push(` ${nestedLine}`);
500
- }
501
- return lines;
502
- }
503
-
504
- function parseParallelGroupAgentCount(label: string | undefined): number | undefined {
505
- if (!label || !label.startsWith("[") || !label.endsWith("]")) return undefined;
506
- const inner = label.slice(1, -1).trim();
507
- if (!inner) return 0;
508
- return inner.split("+").map((part) => part.trim()).filter(Boolean).length;
509
- }
510
-
511
- interface ChainStepSpan {
512
- stepIndex: number;
513
- start: number;
514
- count: number;
515
- isParallel: boolean;
516
- status?: WorkflowNodeStatus;
517
- label?: string;
518
- error?: string;
519
- }
520
-
521
- function buildChainStepSpans(details: Pick<Details, "chainAgents" | "workflowGraph">): ChainStepSpan[] {
522
- if (details.workflowGraph?.nodes?.length) {
523
- const spans: ChainStepSpan[] = [];
524
- let flatCursor = 0;
525
- for (const node of details.workflowGraph.nodes) {
526
- if (node.stepIndex === undefined) continue;
527
- if (node.kind === "parallel-group" || node.kind === "dynamic-parallel-group") {
528
- const childFlatIndexes = (node.children ?? [])
529
- .map((child) => child.flatIndex)
530
- .filter((value): value is number => typeof value === "number");
531
- const start = childFlatIndexes.length ? Math.min(...childFlatIndexes) : flatCursor;
532
- const count = node.children?.length ?? 0;
533
- spans.push({ stepIndex: node.stepIndex, start, count, isParallel: true, status: node.status, label: node.label, error: node.error });
534
- flatCursor = Math.max(flatCursor, start + count);
535
- continue;
536
- }
537
- const start = node.flatIndex ?? flatCursor;
538
- spans.push({ stepIndex: node.stepIndex, start, count: 1, isParallel: false, status: node.status, label: node.label, error: node.error });
539
- flatCursor = Math.max(flatCursor, start + 1);
540
- }
541
- if (spans.length) return spans.sort((left, right) => left.stepIndex - right.stepIndex);
542
- }
543
-
544
- if (!details.chainAgents?.length) return [];
545
- const spans: ChainStepSpan[] = [];
546
- let start = 0;
547
- for (let stepIndex = 0; stepIndex < details.chainAgents.length; stepIndex++) {
548
- const label = details.chainAgents[stepIndex]!;
549
- const parsedCount = parseParallelGroupAgentCount(label);
550
- const count = parsedCount ?? 1;
551
- spans.push({ stepIndex, start, count, isParallel: parsedCount !== undefined });
552
- start += count;
553
- }
554
- return spans;
555
- }
556
-
557
- function isChainParallelGroupActive(details: Pick<Details, "mode" | "chainAgents" | "currentStepIndex" | "workflowGraph">): boolean {
558
- if (details.mode !== "chain") return false;
559
- if (details.currentStepIndex === undefined) return false;
560
- return buildChainStepSpans(details).some((span) => span.stepIndex === details.currentStepIndex && span.isParallel);
561
- }
562
-
563
- function buildAsyncChainStepSpans(total: number, stepCount: number, parallelGroups: AsyncParallelGroupStatus[] = []): ChainStepSpan[] {
564
- const spans: ChainStepSpan[] = [];
565
- let flatIndex = 0;
566
- for (let stepIndex = 0; stepIndex < total; stepIndex++) {
567
- const group = parallelGroups.find((candidate) => candidate.stepIndex === stepIndex);
568
- if (group) {
569
- spans.push({ stepIndex, start: group.start, count: group.count, isParallel: true });
570
- flatIndex = Math.max(flatIndex, group.start + group.count);
571
- continue;
572
- }
573
- spans.push({ stepIndex, start: flatIndex, count: flatIndex < stepCount ? 1 : 0, isParallel: false });
574
- flatIndex++;
575
- }
576
- return spans;
577
- }
578
-
579
- function isDoneResult(result: Details["results"][number]): boolean {
580
- const status = result.progress?.status;
581
- if (status === "completed") return true;
582
- if (status === "running" || status === "pending") return false;
583
- if (result.interrupted || result.detached) return false;
584
- return result.exitCode === 0;
585
- }
586
-
587
- function workflowGraphHasStatus(details: Pick<Details, "workflowGraph">, statuses: WorkflowNodeStatus[]): boolean {
588
- return details.workflowGraph?.nodes.some((node) => statuses.includes(node.status)) ?? false;
589
- }
590
-
591
- interface ChainRenderResultEntry {
592
- kind: "result";
593
- resultIndex: number;
594
- rowNumber: number;
595
- agentName: string;
596
- }
597
-
598
- interface ChainRenderPlaceholderEntry {
599
- kind: "placeholder";
600
- rowNumber: number;
601
- stepLabel: string;
602
- agentName: string;
603
- status: WorkflowNodeStatus;
604
- error?: string;
605
- }
606
-
607
- type ChainRenderEntry = ChainRenderResultEntry | ChainRenderPlaceholderEntry;
608
-
609
- function buildChainRenderEntries(details: Details, label: MultiProgressLabel): ChainRenderEntry[] | undefined {
610
- if (details.mode !== "chain" || !label.hasParallelInChain || label.showActiveGroupOnly) return undefined;
611
- const entries: ChainRenderEntry[] = [];
612
- for (const span of buildChainStepSpans(details)) {
613
- if (span.isParallel && span.count === 0) {
614
- entries.push({
615
- kind: "placeholder",
616
- rowNumber: span.stepIndex + 1,
617
- stepLabel: `Step ${span.stepIndex + 1}`,
618
- agentName: span.label ?? details.chainAgents?.[span.stepIndex] ?? `step-${span.stepIndex + 1}`,
619
- status: span.status ?? "pending",
620
- error: span.error,
621
- });
622
- continue;
623
- }
624
- for (let index = span.start; index < span.start + span.count; index++) {
625
- entries.push({
626
- kind: "result",
627
- resultIndex: index,
628
- rowNumber: index + 1,
629
- agentName: details.results[index]?.agent ?? details.chainAgents?.[span.stepIndex] ?? `step-${span.stepIndex + 1}`,
630
- });
631
- }
632
- }
633
- return entries;
634
- }
635
-
636
- interface MultiProgressLabel {
637
- headerLabel: string;
638
- itemTitle: "Step" | "Agent";
639
- totalCount: number;
640
- hasParallelInChain: boolean;
641
- activeParallelGroup: boolean;
642
- groupStartIndex: number;
643
- groupEndIndex: number;
644
- showActiveGroupOnly: boolean;
645
- }
646
-
647
- function buildMultiProgressLabel(details: Pick<Details, "mode" | "results" | "progress" | "totalSteps" | "currentStepIndex" | "chainAgents" | "workflowGraph">, hasRunning: boolean): MultiProgressLabel {
648
- const stepSpans = buildChainStepSpans(details);
649
- const hasParallelInChain = details.mode === "chain" && stepSpans.some((span) => span.isParallel);
650
- const activeParallelGroup = isChainParallelGroupActive(details);
651
- const itemTitle: "Step" | "Agent" = details.mode === "parallel" || activeParallelGroup ? "Agent" : "Step";
652
-
653
- if (details.mode === "parallel") {
654
- const totalCount = details.totalSteps ?? details.results.length;
655
- const statuses = new Array(totalCount).fill("pending") as Array<"pending" | "running" | "completed" | "failed" | "detached">;
656
- for (const progress of details.progress ?? []) {
657
- if (progress.index >= 0 && progress.index < totalCount) statuses[progress.index] = progress.status;
658
- }
659
- for (let i = 0; i < details.results.length; i++) {
660
- const result = details.results[i]!;
661
- const progressFromArray = details.progress?.find((progress) => progress.index === i)
662
- || details.progress?.find((progress) => progress.agent === result.agent && progress.status === "running");
663
- const index = result.progress?.index ?? progressFromArray?.index ?? i;
664
- if (index < 0 || index >= totalCount) continue;
665
- const status = result.progress?.status
666
- ?? (result.interrupted || result.detached
667
- ? "detached"
668
- : result.exitCode === 0
669
- ? "completed"
670
- : "failed");
671
- statuses[index] = status;
672
- }
673
- const running = statuses.filter((status) => status === "running").length;
674
- const done = statuses.filter((status) => status === "completed").length;
675
- const headerLabel = hasRunning
676
- ? `${formatAgentRunningLabel(running)} · ${done}/${totalCount} done`
677
- : `${done}/${totalCount} done`;
678
- return { headerLabel, itemTitle, totalCount, hasParallelInChain, activeParallelGroup, groupStartIndex: 0, groupEndIndex: totalCount, showActiveGroupOnly: false };
679
- }
680
-
681
- if (activeParallelGroup) {
682
- const currentStepIndex = details.currentStepIndex!;
683
- const span = stepSpans[currentStepIndex];
684
- const groupSize = span?.count ?? 1;
685
- const groupStart = span?.start ?? 0;
686
- const groupEnd = groupStart + groupSize;
687
- let running = 0;
688
- let done = 0;
689
- for (let index = groupStart; index < groupEnd; index++) {
690
- const progressEntry = details.progress?.find((progress) => progress.index === index);
691
- const resultEntry = details.results.find((result) => result.progress?.index === index);
692
- if (progressEntry?.status === "running") {
693
- running++;
694
- continue;
695
- }
696
- if (progressEntry?.status === "completed") {
697
- done++;
698
- continue;
699
- }
700
- if (resultEntry && isDoneResult(resultEntry)) done++;
701
- }
702
- const totalSteps = details.totalSteps ?? details.chainAgents?.length ?? 1;
703
- const headerLabel = hasRunning
704
- ? `step ${currentStepIndex + 1}/${totalSteps} · parallel group: ${formatAgentRunningLabel(running)} · ${done}/${groupSize} done`
705
- : `step ${currentStepIndex + 1}/${totalSteps} · parallel group: ${done}/${groupSize} done`;
706
- return { headerLabel, itemTitle, totalCount: groupSize, hasParallelInChain, activeParallelGroup, groupStartIndex: groupStart, groupEndIndex: groupEnd, showActiveGroupOnly: true };
707
- }
708
-
709
- if (details.mode === "chain" && details.chainAgents?.length) {
710
- const totalCount = details.totalSteps ?? details.chainAgents.length;
711
- const doneLogical = stepSpans.filter((span) => {
712
- if (span.status && span.status !== "completed") return false;
713
- if (span.count === 0) return span.status === "completed";
714
- for (let index = span.start; index < span.start + span.count; index++) {
715
- const progressEntry = details.progress?.find((progress) => progress.index === index);
716
- const resultEntry = details.results.find((result) => result.progress?.index === index) ?? details.results[index];
717
- if (progressEntry?.status === "running" || progressEntry?.status === "pending" || progressEntry?.status === "failed") return false;
718
- if (!resultEntry || !isDoneResult(resultEntry)) return false;
719
- }
720
- return true;
721
- }).length;
722
- const currentStep = details.currentStepIndex !== undefined ? details.currentStepIndex + 1 : Math.min(totalCount, doneLogical + (hasRunning ? 1 : 0));
723
- const headerLabel = hasRunning ? `step ${currentStep}/${totalCount}` : `step ${doneLogical}/${totalCount}`;
724
- return { headerLabel, itemTitle, totalCount, hasParallelInChain, activeParallelGroup, groupStartIndex: 0, groupEndIndex: details.results.length, showActiveGroupOnly: false };
725
- }
726
-
727
- const totalCount = details.totalSteps ?? details.results.length;
728
- const currentStep = details.currentStepIndex !== undefined ? details.currentStepIndex + 1 : Math.min(totalCount, details.results.filter(isDoneResult).length + (hasRunning ? 1 : 0));
729
- const done = details.results.filter(isDoneResult).length;
730
- const headerLabel = hasRunning ? `step ${currentStep}/${totalCount}` : `step ${done}/${totalCount}`;
731
- return { headerLabel, itemTitle, totalCount, hasParallelInChain, activeParallelGroup, groupStartIndex: 0, groupEndIndex: details.results.length, showActiveGroupOnly: false };
732
- }
733
-
734
- function resultRowLabel(details: Pick<Details, "mode" | "chainAgents" | "workflowGraph">, label: MultiProgressLabel, resultIndex: number, stepNumber: number): string {
735
- if (details.mode === "chain" && label.hasParallelInChain) {
736
- const span = buildChainStepSpans(details).find((candidate) => resultIndex >= candidate.start && resultIndex < candidate.start + candidate.count);
737
- if (span?.isParallel) return `Agent ${resultIndex - span.start + 1}/${span.count}`;
738
- if (span) return `Step ${span.stepIndex + 1}`;
739
- }
740
- if (label.itemTitle === "Agent") {
741
- const localStepNumber = label.activeParallelGroup
742
- ? Math.max(1, stepNumber - label.groupStartIndex)
743
- : stepNumber;
744
- return `Agent ${localStepNumber}/${label.totalCount}`;
745
- }
746
- return `Step ${stepNumber}`;
747
- }
748
-
749
- function widgetStats(job: AsyncJobState, theme: Theme): string {
750
- const parts: string[] = [];
751
- const stepsTotal = job.stepsTotal ?? (job.agents?.length ?? 1);
752
- if (job.activeParallelGroup) {
753
- const running = job.runningSteps ?? (job.status === "running" ? 1 : 0);
754
- const done = job.completedSteps ?? (job.status === "complete" ? stepsTotal : 0);
755
- if (job.mode === "parallel") {
756
- if (job.status === "running" && running > 0) parts.push(formatAgentRunningLabel(running));
757
- if (stepsTotal > 0) parts.push(`${done}/${stepsTotal} done`);
758
- } else {
759
- const activeGroup = job.currentStep !== undefined
760
- ? job.parallelGroups?.find((group) => job.currentStep! >= group.start && job.currentStep! < group.start + group.count)
761
- : job.parallelGroups?.find((group) => group.start === 0);
762
- const logicalStep = activeGroup?.stepIndex ?? job.currentStep ?? 0;
763
- const total = job.chainStepCount ?? stepsTotal;
764
- const groupParts = [`${done}/${stepsTotal} done`];
765
- if (job.status === "running" && running > 0) groupParts.unshift(formatAgentRunningLabel(running));
766
- parts.push(`step ${logicalStep + 1}/${total} · parallel group: ${groupParts.join(" · ")}`);
767
- }
768
- } else if (job.currentStep !== undefined) {
769
- if (job.mode === "chain" && job.parallelGroups?.length) {
770
- const total = job.chainStepCount ?? stepsTotal;
771
- parts.push(`step ${flatToLogicalStepIndex(job.currentStep, total, job.parallelGroups) + 1}/${total}`);
772
- } else {
773
- parts.push(`step ${job.currentStep + 1}/${stepsTotal}`);
774
- }
775
- } else if (stepsTotal > 1) {
776
- parts.push(`steps ${stepsTotal}`);
777
- }
778
- if (job.toolCount !== undefined) parts.push(formatToolUseStat(job.toolCount));
779
- if (job.totalTokens?.total) parts.push(formatTokenStat(job.totalTokens.total));
780
- if (job.startedAt !== undefined && job.updatedAt !== undefined) parts.push(formatDuration(Math.max(0, job.updatedAt - job.startedAt)));
781
- return statJoin(theme, parts);
782
- }
783
-
784
- function widgetStepStats(theme: Theme, step: NonNullable<AsyncJobState["steps"]>[number]): string {
785
- return statJoin(theme, [
786
- step.turnCount !== undefined ? `${step.turnCount} turns` : "",
787
- step.toolCount !== undefined ? formatToolUseStat(step.toolCount) : "",
788
- step.tokens?.total ? formatTokenStat(step.tokens.total) : "",
789
- step.durationMs !== undefined ? formatDuration(step.durationMs) : "",
790
- ]);
791
- }
792
-
793
- function modelThinkingBadge(theme: Theme, model?: string, thinking?: string, fastMode?: boolean): string {
794
- const label = formatModelThinking(model, thinking, fastMode);
795
- return label ? theme.fg("dim", ` (${label})`) : "";
796
- }
797
-
798
- function widgetStepActivityLine(step: NonNullable<AsyncJobState["steps"]>[number], width: number, expanded: boolean, snapshotNow?: number): string {
799
- const toolLine = formatCurrentToolLine(step, width, expanded, snapshotNow);
800
- if (toolLine) return toolLine;
801
- const activity = buildLiveStatusLine(step, snapshotNow);
802
- if (activity) return activity;
803
- if (step.status === "running") return "thinking…";
804
- return "";
805
- }
806
-
807
- function widgetOutputPath(job: AsyncJobState, step: NonNullable<AsyncJobState["steps"]>[number]): string | undefined {
808
- if (typeof step.index !== "number") return undefined;
809
- return path.join(job.asyncDir, `output-${step.index}.log`);
810
- }
811
-
812
- function nestedRunName(run: NestedRunSummary): string {
813
- if (run.agent) return run.agent;
814
- if (run.agents?.length) return formatWidgetAgents(run.agents);
815
- return run.id;
816
- }
817
-
818
- function nestedStatusGlyph(state: NestedRunSummary["state"] | NestedStepSummary["status"], theme: Theme, seed?: number, now?: number): string {
819
- if (state === "running") return theme.fg("accent", runningGlyph(seed, now));
820
- if (state === "complete" || state === "completed") return theme.fg("success", "✓");
821
- if (state === "failed") return theme.fg("error", "✗");
822
- if (state === "paused") return theme.fg("warning", "■");
823
- return theme.fg("muted", "◦");
824
- }
825
-
826
- function nestedRunSeed(run: NestedRunSummary): number | undefined {
827
- return runningSeed(run.lastUpdate, run.lastActivityAt, run.currentStep, run.toolCount, run.turnCount, run.totalTokens?.total, run.currentToolStartedAt);
828
- }
829
-
830
- function nestedActivity(input: Pick<NestedRunSummary | NestedStepSummary, "activityState" | "lastActivityAt" | "currentTool" | "currentToolStartedAt" | "currentPath" | "turnCount" | "toolCount">, state: NestedRunSummary["state"] | NestedStepSummary["status"], snapshotNow?: number): string {
831
- const facts: string[] = [];
832
- if (input.currentTool && input.currentToolStartedAt !== undefined && snapshotNow !== undefined) facts.push(`${input.currentTool} ${formatDuration(Math.max(0, snapshotNow - input.currentToolStartedAt))}`);
833
- else if (input.currentTool) facts.push(input.currentTool);
834
- if (input.currentPath) facts.push(shortenPath(input.currentPath));
835
- if (input.turnCount !== undefined) facts.push(`${input.turnCount} turns`);
836
- if (input.toolCount !== undefined) facts.push(`${input.toolCount} tools`);
837
- const activity = buildLiveStatusLine(input, snapshotNow);
838
- if (activity && facts.length) return `${activity} · ${facts.join(" · ")}`;
839
- if (activity) return activity;
840
- if (facts.length) return facts.join(" · ");
841
- if (state === "running") return "thinking…";
842
- if (state === "queued" || state === "pending") return "queued…";
843
- if (state === "paused") return "Paused";
844
- if (state === "failed") return "Failed";
845
- return "Done";
846
- }
847
-
848
- function formatNestedWidgetLines(children: NestedRunSummary[] | undefined, theme: Theme, width: number, expanded: boolean, snapshotNow?: number, lineBudget = expanded ? 12 : 1, now?: number): string[] {
849
- if (!children?.length || lineBudget <= 0) return [];
850
- if (!expanded) {
851
- const aggregate = formatNestedAggregate(children);
852
- return aggregate ? [theme.fg("dim", `↳ ${aggregate}`)] : [];
853
- }
854
- const lines: string[] = [];
855
- const maxDepth = 2;
856
- const append = (items: NestedRunSummary[] | undefined, depth: number, prefix: string): void => {
857
- if (!items?.length || lines.length >= lineBudget) return;
858
- if (depth > maxDepth) {
859
- const aggregate = formatNestedAggregate(items);
860
- if (aggregate && lines.length < lineBudget) lines.push(theme.fg("dim", `${prefix}↳ ${aggregate}`));
861
- return;
862
- }
863
- for (let index = 0; index < items.length; index++) {
864
- const child = items[index]!;
865
- if (lines.length >= lineBudget) {
866
- const aggregate = formatNestedAggregate(items.slice(index));
867
- if (aggregate) lines[lines.length - 1] = theme.fg("dim", `${prefix}↳ ${aggregate}`);
868
- return;
869
- }
870
- const activity = nestedActivity(child, child.state, snapshotNow ?? child.lastUpdate);
871
- const error = child.error ? ` · ${child.error}` : "";
872
- lines.push(theme.fg("dim", `${prefix}↳ ${nestedStatusGlyph(child.state, theme, nestedRunSeed(child), now)} ${nestedRunName(child)} · ${child.state} · ${activity}${error}`));
873
- if (depth === maxDepth) {
874
- const aggregate = formatNestedAggregate([...(child.steps?.flatMap((step) => step.children ?? []) ?? []), ...(child.children ?? [])]);
875
- if (aggregate && lines.length < lineBudget) lines.push(theme.fg("dim", `${prefix} ↳ ${aggregate}`));
876
- continue;
877
- }
878
- for (const step of child.steps ?? []) {
879
- if (lines.length >= lineBudget) return;
880
- lines.push(theme.fg("dim", `${prefix} ↳ ${nestedStatusGlyph(step.status, theme, undefined, now)} ${step.agent} · ${step.status} · ${nestedActivity(step, step.status, snapshotNow ?? child.lastUpdate)}`));
881
- append(step.children, depth + 1, `${prefix} `);
882
- }
883
- append(child.children, depth + 1, `${prefix} `);
884
- }
885
- };
886
- append(children, 0, "");
887
- return lines.map((line) => truncLine(line, width));
888
- }
889
-
890
- function foregroundStyleWidgetStepLines(
891
- job: AsyncJobState,
892
- theme: Theme,
893
- step: NonNullable<AsyncJobState["steps"]>[number],
894
- itemTitle: "Agent" | "Step",
895
- index: number,
896
- total: number,
897
- expanded: boolean,
898
- width: number,
899
- now?: number,
900
- ): string[] {
901
- const status = widgetStepStatus(step.status, theme);
902
- const stats = widgetStepStats(theme, step);
903
- const modelDisplay = modelThinkingBadge(theme, step.model, step.thinking, step.fastMode);
904
- const lines = [` ${widgetStepGlyph(step.status, theme, widgetStepRunningSeed(step, index - 1), now)} ${itemTitle} ${index}/${total}: ${themeBold(theme, step.agent)} ${theme.fg("dim", "·")} ${status}${modelDisplay}${stats ? ` ${theme.fg("dim", "·")} ${stats}` : ""}`];
905
- const activity = widgetStepActivityLine(step, width, expanded, job.updatedAt);
906
- if (activity) lines.push(` ${theme.fg("dim", `⎿ ${activity}`)}`);
907
- for (const nestedLine of formatNestedWidgetLines(step.children, theme, width, expanded, job.updatedAt, undefined, now)) {
908
- lines.push(` ${nestedLine}`);
909
- }
910
- if (step.status === "running") {
911
- if (!expanded) lines.push(` ${theme.fg("accent", "Press ctrl+o for live detail")}`);
912
- const output = widgetOutputPath(job, step);
913
- if (output) lines.push(` ${theme.fg("dim", `output: ${shortenPath(output)}`)}`);
914
- if (expanded) {
915
- const liveStatus = buildLiveStatusLine(step, job.updatedAt);
916
- if (liveStatus && liveStatus !== activity) lines.push(` ${theme.fg("accent", liveStatus)}`);
917
- for (const tool of step.recentTools?.slice(-3) ?? []) {
918
- const maxArgsLen = Math.max(40, width - 30);
919
- const argsPreview = tool.args.length <= maxArgsLen ? tool.args : `${tool.args.slice(0, maxArgsLen)}...`;
920
- lines.push(` ${theme.fg("dim", `${tool.tool}${argsPreview ? `: ${argsPreview}` : ""}`)}`);
921
- }
922
- for (const line of step.recentOutput?.slice(-5) ?? []) {
923
- lines.push(` ${theme.fg("dim", line)}`);
924
- }
925
- }
926
- }
927
- return lines;
928
- }
929
-
930
- function foregroundStyleWidgetDetails(job: AsyncJobState, theme: Theme, expanded: boolean, width: number, now?: number): string[] {
931
- if (!job.steps?.length) return [
932
- ` ${theme.fg("dim", `⎿ ${widgetActivity(job)}`)}`,
933
- ...formatNestedWidgetLines(job.nestedChildren, theme, width, expanded, job.updatedAt, undefined, now).map((line) => ` ${line}`),
934
- ];
935
- if (job.mode === "chain" && !job.activeParallelGroup && job.parallelGroups?.length) return widgetChainDetails(job, theme, expanded, width, now);
936
- const total = job.stepsTotal ?? job.steps.length;
937
- const itemTitle = job.mode === "parallel" || job.activeParallelGroup ? "Agent" : "Step";
938
- const lines: string[] = [];
939
- for (const [index, step] of job.steps.entries()) {
940
- lines.push(...foregroundStyleWidgetStepLines(job, theme, step, itemTitle, index + 1, total, expanded, width, now));
941
- }
942
- const attached = new Set(job.steps.flatMap((step) => step.children?.map((child) => child.id) ?? []));
943
- const unattached = job.nestedChildren?.filter((child) => !attached.has(child.id)) ?? [];
944
- for (const nestedLine of formatNestedWidgetLines(unattached, theme, width, expanded, job.updatedAt, undefined, now)) {
945
- lines.push(` ${nestedLine}`);
946
- }
947
- return lines;
948
- }
949
-
950
- function buildSingleWidgetLines(job: AsyncJobState, theme: Theme, width: number, expanded: boolean, now?: number): string[] {
951
- const stats = widgetStats(job, theme);
952
- const count = job.mode === "chain" ? job.chainStepCount : job.stepsTotal ?? job.agents?.length ?? job.steps?.length;
953
- const mode = widgetJobName(job);
954
- const title = `async subagent ${mode}${count && count > 1 ? ` (${count})` : ""}`;
955
- return [
956
- `${theme.fg("toolTitle", themeBold(theme, title))} ${theme.fg("dim", "· background")}`,
957
- `${widgetStatusGlyph(job, theme, now)} ${themeBold(theme, mode)}${stats ? ` ${theme.fg("dim", "·")} ${stats}` : ""}`,
958
- ...foregroundStyleWidgetDetails(job, theme, expanded, width, now),
959
- ].map((line) => truncLine(line, width));
960
- }
961
-
962
- function compactSingleWidgetLines(job: AsyncJobState, theme: Theme, width: number, now?: number): string[] {
963
- const fullLines = buildSingleWidgetLines(job, theme, width, false, now);
964
- if (fullLines.length <= 10 || !job.steps?.length || (job.mode !== "parallel" && !job.activeParallelGroup)) return fullLines;
965
-
966
- const total = job.stepsTotal ?? job.steps.length;
967
- const itemTitle = job.mode === "parallel" || job.activeParallelGroup ? "Agent" : "Step";
968
- const lines = fullLines.slice(0, 2);
969
- for (const [index, step] of job.steps.entries()) {
970
- const status = widgetStepStatus(step.status, theme);
971
- const activity = widgetStepActivityLine(step, width, false, job.updatedAt);
972
- const stepStats = widgetStepStats(theme, step);
973
- const activitySuffix = activity ? ` ${theme.fg("dim", "·")} ${theme.fg("dim", activity)}` : "";
974
- const modelDisplay = modelThinkingBadge(theme, step.model, step.thinking, step.fastMode);
975
- lines.push(` ${widgetStepGlyph(step.status, theme, widgetStepRunningSeed(step, index), now)} ${itemTitle} ${index + 1}/${total}: ${themeBold(theme, step.agent)} ${theme.fg("dim", "·")} ${status}${modelDisplay}${activitySuffix}${stepStats ? ` ${theme.fg("dim", "·")} ${stepStats}` : ""}`);
976
- for (const nestedLine of formatNestedWidgetLines(step.children, theme, width, false, job.updatedAt, undefined, now)) lines.push(` ${nestedLine}`);
977
- }
978
- if (job.steps.some((step) => step.status === "running")) lines.push(theme.fg("accent", " Press ctrl+o for live detail"));
979
- return lines.map((line) => truncLine(line, width));
980
- }
981
-
982
- function fitWidgetLineBudget(lines: string[], theme: Theme, width: number, expanded: boolean): string[] {
983
- const rows = process.stdout.rows || 30;
984
- const budget = expanded
985
- ? Math.max(12, Math.min(24, Math.floor(rows * 0.55)))
986
- : Math.max(10, Math.min(14, Math.floor(rows * 0.35)));
987
- if (lines.length <= budget) return lines;
988
- const visibleLines = Math.max(1, budget - 1);
989
- const hiddenCount = lines.length - visibleLines;
990
- const hint = expanded
991
- ? `… ${hiddenCount} live-detail lines hidden`
992
- : `… ${hiddenCount} lines hidden · ctrl+o expands`;
993
- return [...lines.slice(0, visibleLines), truncLine(theme.fg("dim", hint), width)];
994
- }
995
-
996
- /**
997
- * Live async-agents widget. Recomputes its lines on every render from the latest
998
- * job snapshot, but reads animation time from the widget ticker/status-update
999
- * snapshot rather than Date.now(). That keeps arbitrary host re-renders from
1000
- * mutating widget bytes unless the widget itself intentionally advanced.
1001
- */
1002
- class LiveWidgetComponent implements Component {
1003
- private readonly container = new Container();
1004
-
1005
- constructor(
1006
- private readonly getJobs: () => AsyncJobState[],
1007
- private readonly theme: Theme,
1008
- private readonly getExpanded: () => boolean,
1009
- private readonly getNow: () => number,
1010
- ) {}
1011
-
1012
- render(width: number): string[] {
1013
- const jobs = this.getJobs();
1014
- const expanded = this.getExpanded();
1015
- const now = this.getNow();
1016
- const lines = this.buildLines(jobs, width, expanded, now);
1017
- this.container.clear();
1018
- for (const line of fitWidgetLineBudget(lines, this.theme, width, expanded)) this.container.addChild(new Text(line, 1, 0));
1019
- return this.container.render(width);
1020
- }
1021
-
1022
- private buildLines(jobs: AsyncJobState[], width: number, expanded: boolean, now: number): string[] {
1023
- if (expanded) return buildWidgetLines(jobs, this.theme, width, true, now);
1024
- if (jobs.length === 1) return compactSingleWidgetLines(jobs[0]!, this.theme, width, now);
1025
- return buildWidgetLines(jobs, this.theme, width, false, now);
1026
- }
1027
-
1028
- invalidate(): void {
1029
- this.container.invalidate();
1030
- }
1031
- }
1032
-
1033
- function buildWidgetComponent(getJobs: () => AsyncJobState[], getExpanded: () => boolean, getNow: () => number): (_tui: unknown, theme: Theme) => Component {
1034
- return (_tui, theme) => new LiveWidgetComponent(getJobs, theme, getExpanded, getNow);
1035
- }
1036
-
1037
- interface RenderRequestingContext {
1038
- ui: ExtensionContext["ui"] & { requestRender?: () => void };
1039
- }
1040
-
1041
- // There is only ever one async-agents widget per host process, so the widget
1042
- // ticker and mounted component read their driving context/jobs from module-level
1043
- // singletons instead of remounting the widget for every visible update.
1044
- let latestWidgetCtx: ExtensionContext | undefined;
1045
- let latestWidgetJobs: AsyncJobState[] = [];
1046
- let latestWidgetFrameNow = 0;
1047
- let widgetTimer: ReturnType<typeof setInterval> | undefined;
1048
- let mountedWidgetCtx: ExtensionContext | undefined;
1049
- let widgetMounted = false;
1050
-
1051
- function getLatestWidgetJobs(): AsyncJobState[] {
1052
- return latestWidgetJobs;
1053
- }
1054
-
1055
- function getLatestWidgetFrameNow(): number {
1056
- return latestWidgetFrameNow;
1057
- }
1058
-
1059
- function getLatestWidgetExpanded(): boolean {
1060
- // LiveWidgetComponent re-renders outside a specific renderWidget() call, so
1061
- // read expansion from the latest live singleton context. If that context was
1062
- // cleared or went stale, collapse safely instead of consulting a stale caller.
1063
- if (!latestWidgetCtx?.hasUI) return false;
1064
- return latestWidgetCtx.ui.getToolsExpanded?.() ?? false;
1065
- }
1066
-
1067
- function clearLatestWidgetState(): void {
1068
- latestWidgetCtx = undefined;
1069
- latestWidgetJobs = [];
1070
- latestWidgetFrameNow = 0;
1071
- mountedWidgetCtx = undefined;
1072
- widgetMounted = false;
1073
- }
1074
-
1075
- function requestWidgetRender(ctx: ExtensionContext): void {
1076
- (ctx as RenderRequestingContext).ui.requestRender?.();
1077
- }
1078
-
1079
- function unmountWidgetBestEffort(ctx: ExtensionContext | undefined): void {
1080
- if (!ctx?.hasUI) return;
1081
- try {
1082
- ctx.ui.setWidget(WIDGET_KEY, undefined);
1083
- } catch {
1084
- // Best-effort teardown only: stale host contexts can reject cleanup during
1085
- // reload/session rebinding, but local state still needs to move on so the
1086
- // next status update can mount cleanly on the active UI context.
1087
- }
1088
- }
1089
-
1090
- function hasAnimatedWidgetJobs(jobs: AsyncJobState[]): boolean {
1091
- // Animate while any job — or any of its nested steps — is still running so the
1092
- // header/step spinners never freeze before the work actually settles.
1093
- return jobs.some((job) => job.status === "running" || job.steps?.some((step) => step.status === "running"));
1094
- }
1095
-
1096
- function refreshAnimatedWidget(): void {
1097
- if (!latestWidgetCtx?.hasUI) return;
1098
- try {
1099
- latestWidgetFrameNow = Date.now();
1100
- requestWidgetRender(latestWidgetCtx);
1101
- } catch {
1102
- // A stale render context means the cosmetic ticker can no longer update the
1103
- // mounted widget safely; tear it down best-effort and let the next status
1104
- // update remount on the active host context.
1105
- stopWidgetAnimation();
1106
- }
1107
- }
1108
-
1109
- function ensureWidgetAnimation(): void {
1110
- if (widgetTimer) return;
1111
- widgetTimer = setInterval(() => {
1112
- if (!hasAnimatedWidgetJobs(latestWidgetJobs)) {
1113
- stopWidgetAnimation();
1114
- return;
1115
- }
1116
- refreshAnimatedWidget();
1117
- }, RUNNING_ANIMATION_MS);
1118
- widgetTimer.unref?.();
1119
- }
1120
-
1121
- // Stop only the ticker, keeping the last-rendered widget context/jobs intact.
1122
- function stopWidgetTicker(): void {
1123
- if (widgetTimer) {
1124
- clearInterval(widgetTimer);
1125
- widgetTimer = undefined;
1126
- }
1127
- }
1128
-
1129
- // Full teardown: stop the ticker, clear the mounted widget if possible, and
1130
- // forget the driving context/jobs entirely.
1131
- export function stopWidgetAnimation(): void {
1132
- stopWidgetTicker();
1133
- if (widgetMounted) unmountWidgetBestEffort(mountedWidgetCtx);
1134
- clearLatestWidgetState();
1135
- }
1136
-
1137
- export function buildWidgetLines(jobs: AsyncJobState[], theme: Theme, width = getTermWidth(), expanded = false, now: number = Date.now()): string[] {
1138
- if (jobs.length === 0) return [];
1139
- if (jobs.length === 1) return buildSingleWidgetLines(jobs[0]!, theme, width, expanded, now);
1140
- const running = jobs.filter((job) => job.status === "running");
1141
- const queued = jobs.filter((job) => job.status === "queued");
1142
- const finished = jobs.filter((job) => job.status !== "running" && job.status !== "queued");
1143
-
1144
- const lines: string[] = [];
1145
- const hasActive = running.length > 0 || queued.length > 0;
1146
- const headerGlyph = running.length > 0 ? runningGlyph(widgetJobsRunningSeed(running), now) : hasActive ? "●" : "○";
1147
- lines.push(truncLine(`${theme.fg(hasActive ? "accent" : "dim", headerGlyph)} ${theme.fg(hasActive ? "accent" : "dim", "Async agents")} ${theme.fg("dim", "· background")}`, width));
1148
-
1149
- const items: string[][] = [];
1150
- let hiddenRunning = 0;
1151
- let hiddenFinished = 0;
1152
- let queuedSummaryShown = false;
1153
- let slots = MAX_WIDGET_JOBS;
1154
-
1155
- for (const job of running) {
1156
- if (slots <= 0) { hiddenRunning++; continue; }
1157
- const stats = widgetStats(job, theme);
1158
- items.push([
1159
- `${widgetStatusGlyph(job, theme, now)} ${themeBold(theme, widgetJobName(job))}${stats ? ` ${theme.fg("dim", "·")} ${stats}` : ""}`,
1160
- ` ${theme.fg("dim", `⎿ ${widgetActivity(job)}`)}`,
1161
- ...widgetParallelAgentDetails(job, theme, expanded, width, now),
1162
- ]);
1163
- slots--;
1164
- }
1165
-
1166
- if (queued.length > 0 && slots > 0) {
1167
- items.push([`${theme.fg("muted", "◦")} ${theme.fg("dim", `${queued.length} queued`)}`]);
1168
- queuedSummaryShown = true;
1169
- slots--;
1170
- }
1171
-
1172
- for (const job of finished) {
1173
- if (slots <= 0) { hiddenFinished++; continue; }
1174
- const stats = widgetStats(job, theme);
1175
- items.push([
1176
- `${widgetStatusGlyph(job, theme, now)} ${themeBold(theme, widgetJobName(job))}${stats ? ` ${theme.fg("dim", "·")} ${stats}` : ""}`,
1177
- ` ${theme.fg("dim", `⎿ ${widgetActivity(job)}`)}`,
1178
- ...widgetParallelAgentDetails(job, theme, expanded, width, now),
1179
- ]);
1180
- slots--;
1181
- }
1182
-
1183
- const hiddenQueued = queued.length > 0 && !queuedSummaryShown ? queued.length : 0;
1184
- const hiddenTotal = hiddenRunning + hiddenFinished + hiddenQueued;
1185
- if (hiddenTotal > 0) {
1186
- const parts: string[] = [];
1187
- if (hiddenRunning > 0) parts.push(`${hiddenRunning} running`);
1188
- if (hiddenQueued > 0) parts.push(`${hiddenQueued} queued`);
1189
- if (hiddenFinished > 0) parts.push(`${hiddenFinished} finished`);
1190
- items.push([theme.fg("dim", `+${hiddenTotal} more (${parts.join(", ")})`)]);
1191
- }
1192
-
1193
- for (let i = 0; i < items.length; i++) {
1194
- const item = items[i]!;
1195
- const last = i === items.length - 1;
1196
- const branch = last ? "└─" : "├─";
1197
- const continuation = last ? " " : "│ ";
1198
- lines.push(truncLine(`${theme.fg("dim", branch)} ${item[0]}`, width));
1199
- for (const detail of item.slice(1)) {
1200
- lines.push(truncLine(`${theme.fg("dim", continuation)} ${detail}`, width));
1201
- }
1202
- }
1203
-
1204
- return lines;
1205
- }
1206
-
1207
- /**
1208
- * Render the async jobs widget
1209
- */
1210
- export function renderWidget(ctx: ExtensionContext, jobs: AsyncJobState[]): void {
1211
- if (jobs.length === 0) {
1212
- if (widgetMounted && mountedWidgetCtx !== ctx) {
1213
- // Empty updates from stale contexts must not clear the active context's
1214
- // widget. The mounted context owns the eventual teardown.
1215
- return;
1216
- }
1217
- stopWidgetAnimation();
1218
- return;
1219
- }
1220
- if (!ctx.hasUI) {
1221
- stopWidgetAnimation();
1222
- return;
1223
- }
1224
- latestWidgetCtx = ctx;
1225
- latestWidgetJobs = [...jobs];
1226
- latestWidgetFrameNow = Date.now();
1227
- if (widgetMounted && mountedWidgetCtx !== ctx) {
1228
- // Context rebinding can leave the previous host UI alive briefly; clear the
1229
- // old mount before installing the singleton widget on the new context.
1230
- unmountWidgetBestEffort(mountedWidgetCtx);
1231
- mountedWidgetCtx = undefined;
1232
- widgetMounted = false;
1233
- }
1234
- if (!widgetMounted) {
1235
- // belowEditor: the widget animates a running glyph / elapsed labels on a
1236
- // timer. pi-tui full-clears the screen+scrollback whenever a changed line
1237
- // sits above the viewport fold, so an aboveEditor widget flickers once the
1238
- // bottom region grows tall and pushes it above the fold. Rendering below the
1239
- // editor keeps the live line within the bottom viewport (flicker-free), and
1240
- // matches the workflow companion widget's placement (#1109).
1241
- ctx.ui.setWidget(WIDGET_KEY, buildWidgetComponent(getLatestWidgetJobs, getLatestWidgetExpanded, getLatestWidgetFrameNow), {
1242
- placement: "belowEditor",
1243
- });
1244
- mountedWidgetCtx = ctx;
1245
- widgetMounted = true;
1246
- } else {
1247
- // The mounted widget reads latestWidgetJobs via getLatestWidgetJobs(), so a
1248
- // visible->visible update only needs to ask the host to render in place.
1249
- requestWidgetRender(ctx);
1250
- }
1251
- // Keep the just-rendered ctx/jobs as the last-rendered state; only the ticker
1252
- // is conditional on whether anything is still animating.
1253
- if (hasAnimatedWidgetJobs(jobs)) ensureWidgetAnimation();
1254
- else stopWidgetTicker();
1255
- }
1256
-
1257
- function renderSingleCompact(d: Details, r: Details["results"][number], theme: Theme, now?: number, spinnerNow?: number): Component {
1258
- const output = r.truncation?.text || getSingleResultOutput(r);
1259
- const progress = r.progress || r.progressSummary;
1260
- const isRunning = r.progress?.status === "running";
1261
- const contextBadge = d.context === "fork" ? theme.fg("warning", " [fork]") : "";
1262
- const stats = statJoin(theme, [
1263
- r.usage?.turns ? `⟳ ${r.usage.turns}` : "",
1264
- formatProgressStats(theme, progress, true, now),
1265
- ]);
1266
- const c = new Container();
1267
- const width = getTermWidth() - 4;
1268
- const modelDisplay = modelThinkingBadge(theme, r.model, undefined, r.fastMode);
1269
- c.addChild(new Text(truncLine(`${resultGlyph(r, output, theme, isRunning, progressRunningSeed(r.progress ?? r.progressSummary), spinnerNow ?? now)} ${theme.fg("toolTitle", theme.bold(r.agent))}${modelDisplay}${contextBadge}${stats ? ` ${theme.fg("dim", "·")} ${stats}` : ""}`, width), 0, 0));
1270
-
1271
- if (isRunning && r.progress) {
1272
- const progressSnapshotNow = snapshotNowForProgress(r.progress, now);
1273
- const activity = compactCurrentActivity(r.progress, now);
1274
- c.addChild(new Text(truncLine(theme.fg("dim", ` ⎿ ${activity}`), width), 0, 0));
1275
- const liveStatus = buildLiveStatusLine(r.progress, progressSnapshotNow);
1276
- if (liveStatus && liveStatus !== activity) c.addChild(new Text(truncLine(theme.fg("dim", ` ${liveStatus}`), width), 0, 0));
1277
- c.addChild(new Text(truncLine(theme.fg("accent", " Press ctrl+o for live detail"), width), 0, 0));
1278
- if (r.artifactPaths) c.addChild(new Text(truncLine(theme.fg("dim", ` output: ${shortenPath(r.artifactPaths.outputPath)}`), width), 0, 0));
1279
- return c;
1280
- }
1281
-
1282
- c.addChild(new Text(truncLine(theme.fg("dim", ` ⎿ ${resultStatusLine(r, output)}`), width), 0, 0));
1283
- const preview = firstOutputLine(output);
1284
- if (preview && r.exitCode === 0 && !hasEmptyTextOutputWithoutOutputTarget(r.task, output)) {
1285
- c.addChild(new Text(truncLine(theme.fg("dim", ` ${preview}`), width), 0, 0));
1286
- }
1287
- if (r.sessionFile) c.addChild(new Text(truncLine(theme.fg("dim", ` session: ${shortenPath(r.sessionFile)}`), width), 0, 0));
1288
- if (r.artifactPaths) c.addChild(new Text(truncLine(theme.fg("dim", ` output: ${shortenPath(r.artifactPaths.outputPath)}`), width), 0, 0));
1289
- if (r.truncation?.artifactPath) c.addChild(new Text(truncLine(theme.fg("dim", ` full output: ${shortenPath(r.truncation.artifactPath)}`), width), 0, 0));
1290
- return c;
1291
- }
1292
-
1293
- function renderMultiCompact(d: Details, theme: Theme, now?: number, spinnerNow?: number): Component {
1294
- const hasRunning = d.progress?.some((p) => p.status === "running")
1295
- || d.results.some((r) => r.progress?.status === "running")
1296
- || workflowGraphHasStatus(d, ["running"]);
1297
- const failed = d.results.some((r) => r.exitCode !== 0 && r.progress?.status !== "running")
1298
- || workflowGraphHasStatus(d, ["failed"]);
1299
- const paused = d.results.some((r) => (r.interrupted || r.detached) && r.progress?.status !== "running")
1300
- || workflowGraphHasStatus(d, ["paused", "detached"]);
1301
- let totalSummary = d.progressSummary;
1302
- if (!totalSummary) {
1303
- let sawProgress = false;
1304
- const summary = { toolCount: 0, tokens: 0, durationMs: 0 };
1305
- for (const r of d.results) {
1306
- const prog = r.progress || r.progressSummary;
1307
- if (!prog) continue;
1308
- sawProgress = true;
1309
- summary.toolCount += prog.toolCount;
1310
- summary.tokens += prog.tokens;
1311
- summary.durationMs = d.mode === "chain" ? summary.durationMs + prog.durationMs : Math.max(summary.durationMs, prog.durationMs);
1312
- }
1313
- if (sawProgress) totalSummary = summary;
1314
- }
1315
- const multiLabel = buildMultiProgressLabel(d, hasRunning);
1316
- const itemTitle = multiLabel.itemTitle;
1317
- const stats = statJoin(theme, [multiLabel.headerLabel, formatProgressStats(theme, totalSummary, true, now)]);
1318
- const glyph = hasRunning
1319
- ? theme.fg("accent", runningGlyph(runningSeed(progressRunningSeed(totalSummary), d.currentStepIndex), spinnerNow ?? now))
1320
- : failed
1321
- ? theme.fg("error", "✗")
1322
- : paused
1323
- ? theme.fg("warning", "■")
1324
- : theme.fg("success", "✓");
1325
- const contextBadge = d.context === "fork" ? theme.fg("warning", " [fork]") : "";
1326
- const c = new Container();
1327
- const width = getTermWidth() - 4;
1328
- c.addChild(new Text(truncLine(`${glyph} ${theme.fg("toolTitle", theme.bold(d.mode))}${contextBadge}${stats ? ` ${theme.fg("dim", "·")} ${stats}` : ""}`, width), 0, 0));
1329
-
1330
- const useResultsDirectly = multiLabel.hasParallelInChain || !d.chainAgents?.length;
1331
- const displayStart = multiLabel.showActiveGroupOnly ? multiLabel.groupStartIndex : 0;
1332
- const displayEnd = multiLabel.showActiveGroupOnly ? multiLabel.groupEndIndex : (useResultsDirectly ? d.results.length : d.chainAgents!.length);
1333
- const chainEntries = buildChainRenderEntries(d, multiLabel);
1334
- const renderEntries = chainEntries ?? Array.from({ length: displayEnd - displayStart }, (_, offset): ChainRenderEntry => {
1335
- const i = displayStart + offset;
1336
- const r = d.results[i];
1337
- const fallbackLabel = itemTitle.toLowerCase();
1338
- const rowNumber = multiLabel.showActiveGroupOnly ? (i - multiLabel.groupStartIndex + 1) : (i + 1);
1339
- return { kind: "result", resultIndex: i, rowNumber, agentName: useResultsDirectly ? (r?.agent || `${fallbackLabel}-${rowNumber}`) : (d.chainAgents![i] || r?.agent || `${fallbackLabel}-${rowNumber}`) };
1340
- });
1341
- for (const entry of renderEntries) {
1342
- if (entry.kind === "placeholder") {
1343
- const glyph = widgetStepGlyph(entry.status as AsyncJobStep["status"], theme);
1344
- const statusLabel = widgetStepStatus(entry.status as AsyncJobStep["status"], theme);
1345
- c.addChild(new Text(truncLine(` ${glyph} ${entry.stepLabel}: ${themeBold(theme, entry.agentName)} ${theme.fg("dim", "·")} ${statusLabel}`, width), 0, 0));
1346
- if (entry.error) c.addChild(new Text(truncLine(theme.fg("error", ` ⎿ Error: ${entry.error}`), width), 0, 0));
1347
- continue;
1348
- }
1349
- const i = entry.resultIndex;
1350
- const r = d.results[i];
1351
- const rowNumber = entry.rowNumber;
1352
- const agentName = entry.agentName;
1353
- if (!r) {
1354
- const pendingLabel = chainEntries ? resultRowLabel(d, multiLabel, i, rowNumber) : `${itemTitle} ${rowNumber}`;
1355
- c.addChild(new Text(truncLine(theme.fg("dim", ` ◦ ${pendingLabel}: ${agentName} · pending`), width), 0, 0));
1356
- continue;
1357
- }
1358
- const output = getSingleResultOutput(r);
1359
- const progressFromArray = d.progress?.find((p) => p.index === i) || d.progress?.find((p) => p.agent === r.agent && p.status === "running");
1360
- const rProg = (r.progress || progressFromArray || r.progressSummary) as AgentProgress | undefined;
1361
- const rRunning = rProg && "status" in rProg && rProg.status === "running";
1362
- const rPending = rProg && "status" in rProg && rProg.status === "pending";
1363
- const stepNumber = r.progress?.index !== undefined ? r.progress.index + 1 : progressFromArray?.index !== undefined ? progressFromArray.index + 1 : i + 1;
1364
- const stepStats = formatProgressStats(theme, rProg, true, now);
1365
- const glyph = rPending ? theme.fg("dim", "◦") : resultGlyph(r, output, theme, rRunning, progressRunningSeed(rProg), spinnerNow ?? now);
1366
- const pendingLabel = rPending ? ` ${theme.fg("dim", "· pending")}` : "";
1367
- const stepLabel = resultRowLabel(d, multiLabel, i, stepNumber);
1368
- const line = `${glyph} ${stepLabel}: ${themeBold(theme, agentName)}${stepStats ? ` ${theme.fg("dim", "·")} ${stepStats}` : ""}${pendingLabel}`;
1369
- c.addChild(new Text(truncLine(` ${line}`, width), 0, 0));
1370
- if (rRunning && rProg && "status" in rProg) {
1371
- const activity = compactCurrentActivity(rProg, now);
1372
- c.addChild(new Text(truncLine(theme.fg("dim", ` ⎿ ${activity}`), width), 0, 0));
1373
- c.addChild(new Text(truncLine(theme.fg("accent", " Press ctrl+o for live detail"), width), 0, 0));
1374
- } else if (!rPending && (r.exitCode !== 0 || r.interrupted || r.detached || hasEmptyTextOutputWithoutOutputTarget(r.task, output))) {
1375
- c.addChild(new Text(truncLine(theme.fg(r.exitCode !== 0 ? "error" : "dim", ` ⎿ ${resultStatusLine(r, output)}`), width), 0, 0));
1376
- }
1377
- const outputTarget = extractOutputTarget(r.task);
1378
- if (outputTarget) c.addChild(new Text(truncLine(theme.fg("dim", ` output: ${outputTarget}`), width), 0, 0));
1379
- if (r.artifactPaths) c.addChild(new Text(truncLine(theme.fg("dim", ` output: ${shortenPath(r.artifactPaths.outputPath)}`), width), 0, 0));
1380
- }
1381
- if (d.artifacts) c.addChild(new Text(truncLine(theme.fg("dim", ` artifacts: ${shortenPath(d.artifacts.dir)}`), width), 0, 0));
1382
- return c;
1383
- }
1384
-
1385
- function progressRenderKey(progress: Partial<AgentProgress> | undefined): string {
1386
- if (!progress) return "";
1387
- return [
1388
- progress.index,
1389
- progress.agent,
1390
- progress.status,
1391
- progress.durationMs,
1392
- progress.toolCount,
1393
- progress.tokens,
1394
- progress.turnCount ?? "",
1395
- progress.lastActivityAt ?? "",
1396
- progress.currentTool ?? "",
1397
- progress.currentToolStartedAt ?? "",
1398
- progress.currentPath ?? "",
1399
- ].join(":");
1400
- }
1401
-
1402
- function isRunningSubagentResult(result: AgentToolResult<Details>): boolean {
1403
- return result.details?.progress?.some((entry) => entry.status === "running")
1404
- || result.details?.results.some((entry) => entry.progress?.status === "running")
1405
- || false;
1406
- }
1407
-
1408
- function subagentResultRenderKey(
1409
- result: AgentToolResult<Details>,
1410
- options: { expanded: boolean; isPartial: boolean },
1411
- ): string {
1412
- const details = result.details;
1413
- if (!details) return `${options.isPartial ? "partial" : "final"}:${result.content.length}`;
1414
- const progressKeys = [
1415
- ...(details.progress ?? []).map(progressRenderKey),
1416
- ...details.results.map((entry) => [
1417
- entry.agent,
1418
- entry.exitCode,
1419
- entry.interrupted === true ? "interrupted" : "",
1420
- entry.detached === true ? "detached" : "",
1421
- progressRenderKey(entry.progress),
1422
- progressRenderKey(entry.progressSummary),
1423
- entry.finalOutput?.length ?? "",
1424
- entry.error?.length ?? "",
1425
- ].join(":")),
1426
- ];
1427
- return [
1428
- options.isPartial ? "partial" : "final",
1429
- options.expanded ? "expanded" : "compact",
1430
- details.mode,
1431
- details.currentStepIndex ?? "",
1432
- details.totalSteps ?? "",
1433
- progressRenderKey(details.progressSummary),
1434
- progressKeys.join("|"),
1435
- ].join("|");
1436
- }
1437
-
1438
- export function renderLiveSubagentResult(
1439
- result: AgentToolResult<Details>,
1440
- options: { expanded: boolean; isPartial: boolean },
1441
- theme: Theme,
1442
- context: ResultAnimationContext,
1443
- ): Component {
1444
- const nextKey = subagentResultRenderKey(result, options);
1445
- if (context.state.subagentResultSnapshotKey !== nextKey) {
1446
- const frameNow = Date.now();
1447
- context.state.subagentResultSnapshotKey = nextKey;
1448
- context.state.subagentResultSnapshotNow = frameNow;
1449
- context.state.subagentResultSpinnerFrameNow = frameNow;
1450
- }
1451
- context.state.subagentResultSnapshotNow ??= Date.now();
1452
- context.state.subagentResultSpinnerFrameNow ??= context.state.subagentResultSnapshotNow;
1453
- // Foreground subagent results render inside chat scrollback. Keep semantic
1454
- // content time stable between tool/progress updates, but let the spinner tick
1455
- // independently. That limits timer-driven diffs to spinner glyph cells instead
1456
- // of updating elapsed/tool/activity text and causing broad chatbox churn.
1457
- if (options.isPartial && isRunningSubagentResult(result)) {
1458
- ensureResultAnimation(context);
1459
- } else {
1460
- clearResultAnimationTimer(context);
1461
- }
1462
- return renderSubagentResult(result, {
1463
- ...options,
1464
- now: context.state.subagentResultSnapshotNow,
1465
- spinnerNow: context.state.subagentResultSpinnerFrameNow,
1466
- }, theme);
1467
- }
1468
-
1469
- /**
1470
- * Render a subagent result
1471
- */
1472
- export function renderSubagentResult(
1473
- result: AgentToolResult<Details>,
1474
- options: { expanded: boolean; now?: number; spinnerNow?: number },
1475
- theme: Theme,
1476
- ): Component {
1477
- const d = result.details;
1478
- if (!d || !d.results.length) {
1479
- const t = result.content[0];
1480
- const text = t?.type === "text" ? t.text : "(no output)";
1481
- const contextPrefix = d?.context === "fork" ? `${theme.fg("warning", "[fork]")} ` : "";
1482
- return new Text(truncLine(`${contextPrefix}${text}`, getTermWidth() - 4), 0, 0);
1483
- }
1484
-
1485
- const expanded = options.expanded;
1486
- const mdTheme = getMarkdownTheme();
1487
-
1488
- if (d.mode === "single" && d.results.length === 1) {
1489
- const r = d.results[0];
1490
- if (!expanded) return renderSingleCompact(d, r, theme, options.now, options.spinnerNow);
1491
- const isRunning = r.progress?.status === "running";
1492
- const icon = isRunning
1493
- ? theme.fg("warning", "running")
1494
- : r.detached
1495
- ? theme.fg("warning", "detached")
1496
- : r.exitCode === 0
1497
- ? theme.fg("success", "ok")
1498
- : theme.fg("error", "failed");
1499
- const contextBadge = d.context === "fork" ? theme.fg("warning", " [fork]") : "";
1500
- const output = r.truncation?.text || getSingleResultOutput(r);
1501
-
1502
- const progressInfo = isRunning && r.progress
1503
- ? ` | ${r.progress.toolCount} tools, ${formatTokens(r.progress.tokens)} tok, ${formatDuration(displayProgressDurationMs(r.progress, options.now))}`
1504
- : r.progressSummary
1505
- ? ` | ${r.progressSummary.toolCount} tools, ${formatTokens(r.progressSummary.tokens)} tok, ${formatDuration(r.progressSummary.durationMs)}`
1506
- : "";
1507
-
1508
- const w = getTermWidth() - 4;
1509
- const fit = (text: string) => expanded ? text : truncLine(text, w);
1510
- const toolCallLines = getToolCallLines(r, expanded);
1511
- const c = new Container();
1512
- c.addChild(new Text(fit(`${icon} ${theme.fg("toolTitle", theme.bold(r.agent))}${contextBadge}${progressInfo}`), 0, 0));
1513
- c.addChild(new Spacer(1));
1514
- const taskMaxLen = Math.max(20, w - 8);
1515
- const taskPreview = expanded || r.task.length <= taskMaxLen
1516
- ? r.task
1517
- : `${r.task.slice(0, taskMaxLen)}...`;
1518
- c.addChild(
1519
- new Text(fit(theme.fg("dim", `Task: ${taskPreview}`)), 0, 0),
1520
- );
1521
- c.addChild(new Spacer(1));
1522
-
1523
- if (isRunning && r.progress) {
1524
- const progressSnapshotNow = snapshotNowForProgress(r.progress, options.now);
1525
- const toolLine = formatCurrentToolLine(r.progress, w, expanded, progressSnapshotNow);
1526
- if (toolLine) {
1527
- c.addChild(new Text(fit(theme.fg("warning", `> ${toolLine}`)), 0, 0));
1528
- }
1529
- const liveStatusLine = buildLiveStatusLine(r.progress, progressSnapshotNow);
1530
- if (liveStatusLine) {
1531
- c.addChild(new Text(fit(theme.fg("accent", liveStatusLine)), 0, 0));
1532
- }
1533
- c.addChild(new Text(fit(theme.fg("accent", "Press ctrl+o for live detail")), 0, 0));
1534
- if (r.artifactPaths) {
1535
- c.addChild(new Text(fit(theme.fg("dim", `Artifacts: ${shortenPath(r.artifactPaths.outputPath)}`)), 0, 0));
1536
- }
1537
- if (r.progress.recentTools?.length) {
1538
- for (const t of r.progress.recentTools.slice(-3)) {
1539
- const maxArgsLen = Math.max(40, w - 24);
1540
- const argsPreview = expanded || t.args.length <= maxArgsLen
1541
- ? t.args
1542
- : `${t.args.slice(0, maxArgsLen)}...`;
1543
- c.addChild(new Text(fit(theme.fg("dim", `${t.tool}: ${argsPreview}`)), 0, 0));
1544
- }
1545
- }
1546
- for (const line of (r.progress.recentOutput ?? []).slice(-5)) {
1547
- c.addChild(new Text(fit(theme.fg("dim", ` ${line}`)), 0, 0));
1548
- }
1549
- if (toolLine || liveStatusLine || r.progress.recentTools?.length || r.progress.recentOutput?.length || r.artifactPaths) {
1550
- c.addChild(new Spacer(1));
1551
- }
1552
- }
1553
-
1554
- if (expanded) {
1555
- for (const line of toolCallLines) {
1556
- c.addChild(new Text(fit(theme.fg("muted", line)), 0, 0));
1557
- }
1558
- if (toolCallLines.length) c.addChild(new Spacer(1));
1559
- }
1560
-
1561
- if (output) c.addChild(new Markdown(output, 0, 0, mdTheme));
1562
- c.addChild(new Spacer(1));
1563
- if (r.skills?.length) {
1564
- c.addChild(new Text(fit(theme.fg("dim", `Skills: ${r.skills.join(", ")}`)), 0, 0));
1565
- }
1566
- if (r.skillsWarning) {
1567
- c.addChild(new Text(fit(theme.fg("warning", `Warning: ${r.skillsWarning}`)), 0, 0));
1568
- }
1569
- if (r.attemptedModels && r.attemptedModels.length > 1) {
1570
- c.addChild(new Text(fit(theme.fg("dim", `Fallbacks: ${r.attemptedModels.join(" → ")}`)), 0, 0));
1571
- }
1572
- c.addChild(new Text(fit(theme.fg("dim", formatUsage(r.usage, r.model))), 0, 0));
1573
- if (r.sessionFile) {
1574
- c.addChild(new Text(fit(theme.fg("dim", `Session: ${shortenPath(r.sessionFile)}`)), 0, 0));
1575
- }
1576
-
1577
- if (!isRunning && r.artifactPaths) {
1578
- c.addChild(new Spacer(1));
1579
- c.addChild(new Text(fit(theme.fg("dim", `Artifacts: ${shortenPath(r.artifactPaths.outputPath)}`)), 0, 0));
1580
- }
1581
- return c;
1582
- }
1583
-
1584
- if (!expanded) return renderMultiCompact(d, theme, options.now, options.spinnerNow);
1585
-
1586
- const hasRunning = d.progress?.some((p) => p.status === "running")
1587
- || d.results.some((r) => r.progress?.status === "running")
1588
- || workflowGraphHasStatus(d, ["running"]);
1589
- const ok = d.results.filter((r) => r.progress?.status === "completed" || (r.exitCode === 0 && r.progress?.status !== "running")).length;
1590
- const hasEmptyWithoutTarget = d.results.some((r) =>
1591
- r.exitCode === 0
1592
- && r.progress?.status !== "running"
1593
- && hasEmptyTextOutputWithoutOutputTarget(r.task, getSingleResultOutput(r)),
1594
- );
1595
- const hasWorkflowFailure = workflowGraphHasStatus(d, ["failed"]);
1596
- const hasWorkflowPause = workflowGraphHasStatus(d, ["paused", "detached"]);
1597
- const icon = hasRunning
1598
- ? theme.fg("warning", "running")
1599
- : hasEmptyWithoutTarget
1600
- ? theme.fg("warning", "warning")
1601
- : hasWorkflowFailure
1602
- ? theme.fg("error", "failed")
1603
- : hasWorkflowPause
1604
- ? theme.fg("warning", "paused")
1605
- : ok === d.results.length
1606
- ? theme.fg("success", "ok")
1607
- : theme.fg("error", "failed");
1608
-
1609
- const totalSummary =
1610
- d.progressSummary ||
1611
- d.results.reduce(
1612
- (acc, r) => {
1613
- const prog = r.progress || r.progressSummary;
1614
- if (prog) {
1615
- acc.toolCount += prog.toolCount;
1616
- acc.tokens += prog.tokens;
1617
- acc.durationMs =
1618
- d.mode === "chain"
1619
- ? acc.durationMs + prog.durationMs
1620
- : Math.max(acc.durationMs, prog.durationMs);
1621
- }
1622
- return acc;
1623
- },
1624
- { toolCount: 0, tokens: 0, durationMs: 0 },
1625
- );
1626
-
1627
- const summaryStr =
1628
- totalSummary.toolCount || totalSummary.tokens
1629
- ? ` | ${totalSummary.toolCount} tools, ${formatTokens(totalSummary.tokens)} tok, ${formatDuration(totalSummary.durationMs)}`
1630
- : "";
1631
-
1632
- const modeLabel = d.mode;
1633
- const contextBadge = d.context === "fork" ? theme.fg("warning", " [fork]") : "";
1634
- const multiLabel = buildMultiProgressLabel(d, hasRunning);
1635
- const itemTitle = multiLabel.itemTitle;
1636
-
1637
- const chainVis = d.chainAgents?.length && !multiLabel.hasParallelInChain
1638
- ? d.chainAgents
1639
- .map((agent, i) => {
1640
- const result = d.results[i];
1641
- const isFailed = result && result.exitCode !== 0 && result.progress?.status !== "running";
1642
- const isComplete = result && result.exitCode === 0 && result.progress?.status !== "running";
1643
- const isEmptyWithoutTarget = Boolean(result)
1644
- && Boolean(isComplete)
1645
- && hasEmptyTextOutputWithoutOutputTarget(result.task, getSingleResultOutput(result));
1646
- const isCurrent = i === (d.currentStepIndex ?? d.results.length);
1647
- const stepIcon = isFailed
1648
- ? theme.fg("error", "failed")
1649
- : isEmptyWithoutTarget
1650
- ? theme.fg("warning", "warning")
1651
- : isComplete
1652
- ? theme.fg("success", "done")
1653
- : isCurrent && hasRunning
1654
- ? theme.fg("warning", "running")
1655
- : theme.fg("dim", "pending");
1656
- return `${stepIcon} ${agent}`;
1657
- })
1658
- .join(theme.fg("dim", " → "))
1659
- : null;
1660
-
1661
- const w = getTermWidth() - 4;
1662
- const fit = (text: string) => expanded ? text : truncLine(text, w);
1663
- const c = new Container();
1664
- c.addChild(
1665
- new Text(
1666
- fit(`${icon} ${theme.fg("toolTitle", theme.bold(modeLabel))}${contextBadge} · ${multiLabel.headerLabel}${summaryStr}`),
1667
- 0,
1668
- 0,
1669
- ),
1670
- );
1671
- if (chainVis) {
1672
- c.addChild(new Text(fit(` ${chainVis}`), 0, 0));
1673
- }
1674
-
1675
- const useResultsDirectly = multiLabel.hasParallelInChain || !d.chainAgents?.length;
1676
- const displayStart = multiLabel.showActiveGroupOnly ? multiLabel.groupStartIndex : 0;
1677
- const displayEnd = multiLabel.showActiveGroupOnly ? multiLabel.groupEndIndex : (useResultsDirectly ? d.results.length : d.chainAgents!.length);
1678
- const chainEntries = buildChainRenderEntries(d, multiLabel);
1679
- const renderEntries = chainEntries ?? Array.from({ length: displayEnd - displayStart }, (_, offset): ChainRenderEntry => {
1680
- const i = displayStart + offset;
1681
- const r = d.results[i];
1682
- const rowNumber = multiLabel.showActiveGroupOnly ? (i - multiLabel.groupStartIndex + 1) : (i + 1);
1683
- return { kind: "result", resultIndex: i, rowNumber, agentName: useResultsDirectly ? (r?.agent || `step-${rowNumber}`) : (d.chainAgents![i] || r?.agent || `step-${rowNumber}`) };
1684
- });
1685
-
1686
- c.addChild(new Spacer(1));
1687
-
1688
- for (const entry of renderEntries) {
1689
- if (entry.kind === "placeholder") {
1690
- const statusLabel = widgetStepStatus(entry.status as AsyncJobStep["status"], theme);
1691
- c.addChild(new Text(fit(` ${statusLabel} ${entry.stepLabel}: ${theme.bold(entry.agentName)}`), 0, 0));
1692
- c.addChild(new Text(theme.fg(entry.status === "failed" ? "error" : "dim", ` status: ${entry.status}`), 0, 0));
1693
- if (entry.error) c.addChild(new Text(theme.fg("error", ` error: ${entry.error}`), 0, 0));
1694
- c.addChild(new Spacer(1));
1695
- continue;
1696
- }
1697
- const i = entry.resultIndex;
1698
- const r = d.results[i];
1699
- const rowNumber = entry.rowNumber;
1700
- const agentName = entry.agentName;
1701
-
1702
- if (!r) {
1703
- const pendingLabel = chainEntries ? resultRowLabel(d, multiLabel, i, rowNumber) : `${itemTitle} ${rowNumber}`;
1704
- c.addChild(new Text(fit(theme.fg("dim", ` ${pendingLabel}: ${agentName}`)), 0, 0));
1705
- c.addChild(new Text(theme.fg("dim", ` status: pending`), 0, 0));
1706
- c.addChild(new Spacer(1));
1707
- continue;
1708
- }
1709
-
1710
- const progressFromArray = d.progress?.find((p) => p.index === i)
1711
- || d.progress?.find((p) => p.agent === r.agent && p.status === "running");
1712
- const rProg = (r.progress || progressFromArray || r.progressSummary) as AgentProgress | undefined;
1713
- const rRunning = rProg?.status === "running";
1714
- const stepNumber = typeof rProg?.index === "number" ? rProg.index + 1 : i + 1;
1715
-
1716
- const resultOutput = getSingleResultOutput(r);
1717
- const statusIcon = rRunning
1718
- ? theme.fg("warning", "running")
1719
- : r.exitCode !== 0
1720
- ? theme.fg("error", "failed")
1721
- : hasEmptyTextOutputWithoutOutputTarget(r.task, resultOutput)
1722
- ? theme.fg("warning", "warning")
1723
- : theme.fg("success", "done");
1724
- const stats = rProg ? ` | ${rProg.toolCount} tools, ${formatDuration(displayProgressDurationMs(rProg, options.now))}` : "";
1725
- const modelDisplay = modelThinkingBadge(theme, r.model, undefined, r.fastMode);
1726
- const stepLabel = resultRowLabel(d, multiLabel, i, stepNumber);
1727
- const stepHeader = rRunning
1728
- ? `${statusIcon} ${stepLabel}: ${theme.bold(theme.fg("warning", r.agent))}${modelDisplay}${stats}`
1729
- : `${statusIcon} ${stepLabel}: ${theme.bold(r.agent)}${modelDisplay}${stats}`;
1730
- const toolCallLines = getToolCallLines(r, expanded);
1731
- c.addChild(new Text(fit(stepHeader), 0, 0));
1732
-
1733
- const taskMaxLen = Math.max(20, w - 12);
1734
- const taskPreview = expanded || r.task.length <= taskMaxLen
1735
- ? r.task
1736
- : `${r.task.slice(0, taskMaxLen)}...`;
1737
- c.addChild(new Text(fit(theme.fg("dim", ` task: ${taskPreview}`)), 0, 0));
1738
-
1739
- const outputTarget = extractOutputTarget(r.task);
1740
- if (outputTarget) {
1741
- c.addChild(new Text(fit(theme.fg("dim", ` output: ${outputTarget}`)), 0, 0));
1742
- }
1743
-
1744
- if (r.skills?.length) {
1745
- c.addChild(new Text(fit(theme.fg("dim", ` skills: ${r.skills.join(", ")}`)), 0, 0));
1746
- }
1747
- if (r.skillsWarning) {
1748
- c.addChild(new Text(fit(theme.fg("warning", ` Warning: ${r.skillsWarning}`)), 0, 0));
1749
- }
1750
- if (r.attemptedModels && r.attemptedModels.length > 1) {
1751
- c.addChild(new Text(fit(theme.fg("dim", ` fallbacks: ${r.attemptedModels.join(" → ")}`)), 0, 0));
1752
- }
1753
-
1754
- if (rRunning && rProg) {
1755
- if (rProg.skills?.length) {
1756
- c.addChild(new Text(fit(theme.fg("accent", ` skills: ${rProg.skills.join(", ")}`)), 0, 0));
1757
- }
1758
- const progressSnapshotNow = snapshotNowForProgress(rProg, options.now);
1759
- const toolLine = formatCurrentToolLine(rProg, w, expanded, progressSnapshotNow);
1760
- if (toolLine) {
1761
- c.addChild(new Text(fit(theme.fg("warning", ` > ${toolLine}`)), 0, 0));
1762
- }
1763
- const liveStatusLine = buildLiveStatusLine(rProg, progressSnapshotNow);
1764
- if (liveStatusLine) {
1765
- c.addChild(new Text(fit(theme.fg("accent", ` ${liveStatusLine}`)), 0, 0));
1766
- }
1767
- c.addChild(new Text(fit(theme.fg("accent", " Press ctrl+o for live detail")), 0, 0));
1768
- if (r.artifactPaths) {
1769
- c.addChild(new Text(fit(theme.fg("dim", ` artifacts: ${shortenPath(r.artifactPaths.outputPath)}`)), 0, 0));
1770
- }
1771
- if (rProg.recentTools?.length) {
1772
- for (const t of rProg.recentTools.slice(-3)) {
1773
- const maxArgsLen = Math.max(40, w - 30);
1774
- const argsPreview = expanded || t.args.length <= maxArgsLen
1775
- ? t.args
1776
- : `${t.args.slice(0, maxArgsLen)}...`;
1777
- c.addChild(new Text(fit(theme.fg("dim", ` ${t.tool}: ${argsPreview}`)), 0, 0));
1778
- }
1779
- }
1780
- const recentLines = (rProg.recentOutput ?? []).slice(-5);
1781
- for (const line of recentLines) {
1782
- c.addChild(new Text(fit(theme.fg("dim", ` ${line}`)), 0, 0));
1783
- }
1784
- }
1785
-
1786
- if (!rRunning && r.artifactPaths) {
1787
- c.addChild(new Text(fit(theme.fg("dim", ` artifacts: ${shortenPath(r.artifactPaths.outputPath)}`)), 0, 0));
1788
- }
1789
-
1790
- if (expanded && !rRunning) {
1791
- for (const line of toolCallLines) {
1792
- c.addChild(new Text(fit(theme.fg("muted", ` ${line}`)), 0, 0));
1793
- }
1794
- if (toolCallLines.length) c.addChild(new Spacer(1));
1795
- }
1796
-
1797
- c.addChild(new Spacer(1));
1798
- }
1799
7
 
1800
- if (d.artifacts) {
1801
- c.addChild(new Spacer(1));
1802
- c.addChild(new Text(fit(theme.fg("dim", `Artifacts dir: ${shortenPath(d.artifacts.dir)}`)), 0, 0));
1803
- }
1804
- return c;
1805
- }
8
+ export { RUNNING_ANIMATION_MS, currentRunningFrame } from "./render-layout.ts";
9
+ export {
10
+ clearLegacyResultAnimationTimer,
11
+ clearResultAnimationTimer,
12
+ ensureResultAnimation,
13
+ stopResultAnimations,
14
+ } from "./render-result-animation.ts";
15
+ export type { SubagentResultRenderState } from "./render-result-animation.ts";
16
+ export { widgetRenderKey } from "./render-stable-output.ts";
17
+ export { buildWidgetLines, renderWidget, stopWidgetAnimation } from "./render-widget.ts";
18
+ export { renderLiveSubagentResult, renderSubagentResult } from "./render-result.ts";