eve 0.68.0 → 0.70.0

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 (1196) hide show
  1. package/CHANGELOG.md +132 -0
  2. package/bin/eve.js +15 -0
  3. package/dist/src/_virtual/_rolldown/runtime.js +1 -1
  4. package/dist/src/acp/adapter.js +1 -1
  5. package/dist/src/approval/definition.d.ts +19 -5
  6. package/dist/src/channel/adapter.d.ts +2 -0
  7. package/dist/src/channel/auth/oidc.js +1 -1
  8. package/dist/src/channel/channel-address.d.ts +1 -4
  9. package/dist/src/channel/channel-address.js +1 -1
  10. package/dist/src/channel/channel-operations.d.ts +4 -11
  11. package/dist/src/channel/channel-operations.js +1 -1
  12. package/dist/src/channel/compiled-channel.d.ts +0 -2
  13. package/dist/src/channel/compiled-channel.js +2 -2
  14. package/dist/src/channel/cross-channel-receive.d.ts +1 -3
  15. package/dist/src/channel/cross-channel-receive.js +1 -1
  16. package/dist/src/channel/forwarded-principal.js +1 -1
  17. package/dist/src/channel/schedule-auth.d.ts +16 -0
  18. package/dist/src/channel/schedule-auth.js +1 -1
  19. package/dist/src/channel/session-callback.js +1 -1
  20. package/dist/src/channel/session.d.ts +3 -8
  21. package/dist/src/channel/session.js +1 -1
  22. package/dist/src/channel/task-card.d.ts +121 -0
  23. package/dist/src/channel/task-card.js +1 -0
  24. package/dist/src/channel/types.d.ts +30 -57
  25. package/dist/src/chunks/{use-eve-agent-D4HVZBjn.js → use-eve-agent-CJQeE7-t.js} +2058 -1331
  26. package/dist/src/chunks/{use-eve-agent-DXcE_8Ja.js → use-eve-agent-DdemtY6C.js} +2061 -1331
  27. package/dist/src/cli/commands/info.d.ts +11 -0
  28. package/dist/src/cli/commands/info.js +1 -1
  29. package/dist/src/cli/commands/init-agent-workspace.js +1 -1
  30. package/dist/src/cli/commands/init.js +1 -1
  31. package/dist/src/cli/dev/command-options.d.ts +2 -2
  32. package/dist/src/cli/dev/command.js +1 -1
  33. package/dist/src/cli/dev/console-records-preload.d.ts +1 -0
  34. package/dist/src/cli/dev/console-records-preload.js +1 -0
  35. package/dist/src/cli/dev/console-records.d.ts +17 -0
  36. package/dist/src/cli/dev/console-records.js +3 -0
  37. package/dist/src/cli/dev/diagnostic-sink.d.ts +1 -0
  38. package/dist/src/cli/dev/local-server-process.js +1 -1
  39. package/dist/src/cli/dev/tui/blocks.d.ts +21 -19
  40. package/dist/src/cli/dev/tui/blocks.js +4 -4
  41. package/dist/src/cli/dev/tui/command-typeahead.d.ts +3 -6
  42. package/dist/src/cli/dev/tui/conversation-view.d.ts +54 -0
  43. package/dist/src/cli/dev/tui/conversation-view.js +1 -0
  44. package/dist/src/cli/dev/tui/diagnostic-presentation.d.ts +10 -0
  45. package/dist/src/cli/dev/tui/diagnostic-presentation.js +3 -2
  46. package/dist/src/cli/dev/tui/flow-drawer.d.ts +5 -2
  47. package/dist/src/cli/dev/tui/flow-drawer.js +1 -1
  48. package/dist/src/cli/dev/tui/log-display-mode.d.ts +4 -10
  49. package/dist/src/cli/dev/tui/log-display-mode.js +1 -1
  50. package/dist/src/cli/dev/tui/message-queue.d.ts +7 -63
  51. package/dist/src/cli/dev/tui/message-queue.js +3 -1
  52. package/dist/src/cli/dev/tui/prompt-commands.js +1 -1
  53. package/dist/src/cli/dev/tui/prompt-placeholder.d.ts +2 -0
  54. package/dist/src/cli/dev/tui/prompt-placeholder.js +1 -0
  55. package/dist/src/cli/dev/tui/question-panel.d.ts +3 -1
  56. package/dist/src/cli/dev/tui/question-panel.js +1 -1
  57. package/dist/src/cli/dev/tui/rail.d.ts +1 -1
  58. package/dist/src/cli/dev/tui/runner.d.ts +60 -174
  59. package/dist/src/cli/dev/tui/runner.js +3 -3
  60. package/dist/src/cli/dev/tui/status-line.d.ts +4 -2
  61. package/dist/src/cli/dev/tui/status-line.js +1 -1
  62. package/dist/src/cli/dev/tui/task-activity.d.ts +59 -0
  63. package/dist/src/cli/dev/tui/task-activity.js +1 -0
  64. package/dist/src/cli/dev/tui/terminal-renderer.d.ts +18 -57
  65. package/dist/src/cli/dev/tui/terminal-renderer.js +10 -13
  66. package/dist/src/cli/dev/tui/terminal-tool-part.d.ts +2 -0
  67. package/dist/src/cli/dev/tui/terminal-tool-part.js +1 -0
  68. package/dist/src/cli/dev/tui/test/fake-eve-server.d.ts +34 -0
  69. package/dist/src/cli/dev/tui/test/fake-eve-server.js +1 -0
  70. package/dist/src/cli/dev/tui/test/index.d.ts +1 -0
  71. package/dist/src/cli/dev/tui/test/index.js +1 -1
  72. package/dist/src/cli/dev/tui/theme.d.ts +1 -1
  73. package/dist/src/cli/dev/tui/theme.js +1 -1
  74. package/dist/src/cli/dev/tui/tool-block-groups.d.ts +6 -9
  75. package/dist/src/cli/dev/tui/tool-block-groups.js +1 -1
  76. package/dist/src/cli/dev/tui/tool-presentation.d.ts +17 -3
  77. package/dist/src/cli/dev/tui/tool-presentation.js +1 -1
  78. package/dist/src/cli/dev/tui/tool-rows.d.ts +1 -0
  79. package/dist/src/cli/dev/tui/tool-rows.js +2 -2
  80. package/dist/src/cli/dev/tui/traces/trace-conversation.js +3 -1
  81. package/dist/src/cli/dev/tui/traces/trace-view.js +1 -1
  82. package/dist/src/cli/dev/tui/transcript-parts.d.ts +73 -0
  83. package/dist/src/cli/dev/tui/transcript-parts.js +3 -0
  84. package/dist/src/cli/dev/tui/transcript.d.ts +47 -0
  85. package/dist/src/cli/dev/tui/transcript.js +1 -0
  86. package/dist/src/cli/dev/tui/tui.js +1 -1
  87. package/dist/src/cli/dev/tui/turn-clock.d.ts +11 -26
  88. package/dist/src/cli/dev/tui/turn-clock.js +1 -1
  89. package/dist/src/cli/dev/tui/types.d.ts +13 -9
  90. package/dist/src/cli/dev/ui-options.d.ts +2 -2
  91. package/dist/src/cli/dev/ui-options.js +1 -1
  92. package/dist/src/cli/option-parsers.d.ts +3 -1
  93. package/dist/src/cli/option-parsers.js +1 -1
  94. package/dist/src/cli/ui/terminal-text.js +1 -1
  95. package/dist/src/client/agent-info-schema.d.ts +150 -9
  96. package/dist/src/client/agent-info-schema.js +1 -1
  97. package/dist/src/client/agent-session.d.ts +28 -0
  98. package/dist/src/client/agent-session.js +1 -0
  99. package/dist/src/client/agent-stream-follower.d.ts +26 -0
  100. package/dist/src/client/agent-stream-follower.js +1 -0
  101. package/dist/src/client/authorization-message-parts.js +1 -1
  102. package/dist/src/client/conversation-client.d.ts +40 -0
  103. package/dist/src/client/conversation-client.js +1 -0
  104. package/dist/src/client/conversation-reducer.d.ts +29 -0
  105. package/dist/src/client/conversation-reducer.js +1 -0
  106. package/dist/src/client/conversation-state.d.ts +110 -0
  107. package/dist/src/client/conversation-state.js +1 -0
  108. package/dist/src/client/eve-agent-projection.d.ts +24 -7
  109. package/dist/src/client/eve-agent-projection.js +1 -1
  110. package/dist/src/client/eve-agent-store-helpers.d.ts +20 -1
  111. package/dist/src/client/eve-agent-store-helpers.js +2 -2
  112. package/dist/src/client/eve-agent-store-state.d.ts +15 -3
  113. package/dist/src/client/eve-agent-store.d.ts +10 -1
  114. package/dist/src/client/eve-agent-store.js +1 -1
  115. package/dist/src/client/index.d.ts +5 -1
  116. package/dist/src/client/index.js +1 -1
  117. package/dist/src/client/message-action-parts.js +1 -1
  118. package/dist/src/client/message-reducer-primitives.d.ts +1 -2
  119. package/dist/src/client/message-reducer-primitives.js +1 -1
  120. package/dist/src/client/message-reducer-types.d.ts +9 -2
  121. package/dist/src/client/message-reducer.js +1 -1
  122. package/dist/src/client/message-response.js +1 -1
  123. package/dist/src/client/message-run-parts.d.ts +10 -6
  124. package/dist/src/client/message-run-parts.js +1 -1
  125. package/dist/src/client/message-task-parts.d.ts +8 -0
  126. package/dist/src/client/message-task-parts.js +1 -0
  127. package/dist/src/client/optimistic-message-submissions.d.ts +6 -4
  128. package/dist/src/client/optimistic-message-submissions.js +1 -1
  129. package/dist/src/client/reducer.d.ts +5 -1
  130. package/dist/src/client/session-controls.d.ts +0 -1
  131. package/dist/src/client/session-turn-dispatch.d.ts +15 -0
  132. package/dist/src/client/session-turn-dispatch.js +1 -0
  133. package/dist/src/client/session-utils.d.ts +29 -2
  134. package/dist/src/client/session-utils.js +1 -1
  135. package/dist/src/client/session.d.ts +8 -16
  136. package/dist/src/client/session.js +1 -1
  137. package/dist/src/client/stream-version.js +1 -1
  138. package/dist/src/client/types.d.ts +4 -5
  139. package/dist/src/compiled/.vendor-stamp.json +3 -2
  140. package/dist/src/compiled/@eve/catalog/index.js +1 -1
  141. package/dist/src/compiled/@vercel/connect/LICENSE +202 -0
  142. package/dist/src/compiled/@vercel/connect/authorization-details.d.ts +11 -0
  143. package/dist/src/compiled/@vercel/connect/authorization.d.ts +47 -0
  144. package/dist/src/compiled/@vercel/connect/connector.d.ts +32 -0
  145. package/dist/src/compiled/@vercel/connect/index.d.ts +5 -0
  146. package/dist/src/compiled/@vercel/connect/index.js +26 -0
  147. package/dist/src/compiled/@vercel/connect/installation.d.ts +48 -0
  148. package/dist/src/compiled/@vercel/connect/token.d.ts +137 -0
  149. package/dist/src/compiled/@workflow/core/runtime.js +3 -3
  150. package/dist/src/compiler/bundled-extension.d.ts +7 -1
  151. package/dist/src/compiler/bundled-extension.js +1 -1
  152. package/dist/src/compiler/default-tool-policy.d.ts +2 -2
  153. package/dist/src/compiler/default-tool-policy.js +1 -1
  154. package/dist/src/compiler/development-extensions.js +1 -1
  155. package/dist/src/compiler/extension-compatibility.d.ts +54 -18
  156. package/dist/src/compiler/extension-compatibility.js +1 -1
  157. package/dist/src/compiler/extension-mount-bindings.d.ts +5 -0
  158. package/dist/src/compiler/extension-mount-bindings.js +1 -0
  159. package/dist/src/compiler/load-binding-namespace.d.ts +10 -2
  160. package/dist/src/compiler/load-binding-namespace.js +1 -1
  161. package/dist/src/compiler/manifest.d.ts +19 -17
  162. package/dist/src/compiler/manifest.js +1 -1
  163. package/dist/src/compiler/module-lifecycle.d.ts +2 -2
  164. package/dist/src/compiler/module-lifecycle.js +1 -1
  165. package/dist/src/compiler/module-map.d.ts +1 -1
  166. package/dist/src/compiler/module-map.js +3 -3
  167. package/dist/src/compiler/normalize-manifest-helpers.d.ts +18 -1
  168. package/dist/src/compiler/normalize-manifest-helpers.js +1 -1
  169. package/dist/src/compiler/normalize-manifest-types.d.ts +2 -0
  170. package/dist/src/compiler/normalize-manifest.js +1 -1
  171. package/dist/src/compiler/normalize-subagent.js +1 -1
  172. package/dist/src/compiler/normalize-tool.js +1 -1
  173. package/dist/src/compiler/project-sources.d.ts +4 -0
  174. package/dist/src/compiler/project-sources.js +1 -1
  175. package/dist/src/compiler/remote-agent-node.js +1 -1
  176. package/dist/src/compiler/source-graph.d.ts +5 -0
  177. package/dist/src/compiler/source-graph.js +1 -1
  178. package/dist/src/computer-use/extension/lib/computer-use-sandbox.d.ts +8 -0
  179. package/dist/src/computer-use/extension/lib/computer-use-sandbox.js +3 -3
  180. package/dist/src/computer-use/extension/lib/computer-use.d.ts +2 -0
  181. package/dist/src/computer-use/extension/lib/computer-use.js +2 -1
  182. package/dist/src/computer-use/extension/tools/computer_use.js +1 -1
  183. package/dist/src/context/build-dynamic-tools.js +1 -1
  184. package/dist/src/context/dynamic-subagent-lifecycle.d.ts +5 -0
  185. package/dist/src/context/dynamic-subagent-lifecycle.js +1 -1
  186. package/dist/src/context/dynamic-tool-lifecycle.js +1 -1
  187. package/dist/src/context/dynamic-tool-metadata.d.ts +1 -1
  188. package/dist/src/context/key-names.d.ts +0 -1
  189. package/dist/src/context/key-names.js +1 -1
  190. package/dist/src/context/keys.d.ts +12 -15
  191. package/dist/src/context/keys.js +1 -1
  192. package/dist/src/context/memory-lifecycle.js +1 -1
  193. package/dist/src/context/memory-tools.d.ts +0 -1
  194. package/dist/src/context/provider.d.ts +5 -11
  195. package/dist/src/context/run-step.d.ts +5 -6
  196. package/dist/src/context/run-step.js +1 -1
  197. package/dist/src/context/serialize.js +1 -1
  198. package/dist/src/discover/bundled-extension.js +1 -1
  199. package/dist/src/discover/discover-agent.js +1 -1
  200. package/dist/src/discover/extensions.d.ts +0 -7
  201. package/dist/src/discover/extensions.js +1 -1
  202. package/dist/src/discover/manifest.d.ts +4 -0
  203. package/dist/src/evals/assertions/run.d.ts +4 -3
  204. package/dist/src/evals/assertions/run.js +1 -1
  205. package/dist/src/evals/index.d.ts +1 -1
  206. package/dist/src/evals/match.d.ts +4 -4
  207. package/dist/src/evals/mock-model.js +1 -1
  208. package/dist/src/evals/runner/derive-run-facts.d.ts +3 -3
  209. package/dist/src/evals/runner/derive-run-facts.js +1 -1
  210. package/dist/src/evals/runner/execute-task.js +1 -1
  211. package/dist/src/evals/runner/reporters/assertion-scores.d.ts +19 -0
  212. package/dist/src/evals/runner/reporters/assertion-scores.js +1 -0
  213. package/dist/src/evals/runner/reporters/braintrust.js +1 -1
  214. package/dist/src/evals/runner/reporters/datadog-client.d.ts +123 -0
  215. package/dist/src/evals/runner/reporters/datadog-client.js +4 -0
  216. package/dist/src/evals/runner/reporters/datadog.d.ts +9 -98
  217. package/dist/src/evals/runner/reporters/datadog.js +2 -3
  218. package/dist/src/evals/session-content.js +1 -1
  219. package/dist/src/evals/session.d.ts +4 -4
  220. package/dist/src/evals/session.js +2 -2
  221. package/dist/src/evals/types.d.ts +34 -15
  222. package/dist/src/eve-channel/create-request.d.ts +5 -4
  223. package/dist/src/eve-channel/create-request.js +1 -1
  224. package/dist/src/eve-channel/index.d.ts +0 -9
  225. package/dist/src/eve-channel/index.js +1 -1
  226. package/dist/src/eve-channel/request.d.ts +3 -7
  227. package/dist/src/eve-channel/request.js +1 -1
  228. package/dist/src/eve-channel/support.d.ts +15 -5
  229. package/dist/src/eve-channel/support.js +1 -1
  230. package/dist/src/eve-channel/turn-policy-request.d.ts +2 -0
  231. package/dist/src/eve-channel/turn-policy-request.js +1 -0
  232. package/dist/src/eve-channel/types.d.ts +4 -0
  233. package/dist/src/execution/agent-sessions/context.d.ts +62 -0
  234. package/dist/src/execution/agent-sessions/context.js +1 -0
  235. package/dist/src/{subagents/remote-dispatch.d.ts → execution/agent-sessions/remote.d.ts} +17 -40
  236. package/dist/src/execution/agent-sessions/remote.js +1 -0
  237. package/dist/src/execution/agent-sessions/requests.d.ts +20 -0
  238. package/dist/src/execution/agent-sessions/requests.js +1 -0
  239. package/dist/src/execution/agent-sessions/session.d.ts +12 -0
  240. package/dist/src/execution/agent-sessions/session.js +1 -0
  241. package/dist/src/execution/agent-sessions/steps.d.ts +59 -0
  242. package/dist/src/execution/agent-sessions/steps.js +1 -0
  243. package/dist/src/execution/agent-sessions/target.d.ts +45 -0
  244. package/dist/src/execution/agent-sessions/target.js +1 -0
  245. package/dist/src/execution/agent-sessions/usage.d.ts +18 -0
  246. package/dist/src/execution/agent-sessions/usage.js +1 -0
  247. package/dist/src/execution/authorization-callback-match.d.ts +2 -4
  248. package/dist/src/execution/authorization-callback-match.js +1 -1
  249. package/dist/src/execution/cancel-descendant-turns-step.d.ts +1 -5
  250. package/dist/src/execution/cancel-descendant-turns-step.js +1 -1
  251. package/dist/src/execution/cancelled-model-call-batch.js +1 -1
  252. package/dist/src/execution/connection-announcement.d.ts +7 -0
  253. package/dist/src/execution/connection-announcement.js +4 -0
  254. package/dist/src/execution/continuation-conflict-step.d.ts +2 -3
  255. package/dist/src/execution/continuation-conflict-step.js +1 -1
  256. package/dist/src/execution/coordination-dispatch-shared.d.ts +12 -28
  257. package/dist/src/execution/coordination-dispatch-shared.js +1 -1
  258. package/dist/src/execution/coordination-dispatch-step.d.ts +3 -2
  259. package/dist/src/execution/coordination-dispatch-step.js +1 -1
  260. package/dist/src/execution/create-session-step.d.ts +4 -3
  261. package/dist/src/execution/create-session-step.js +1 -1
  262. package/dist/src/execution/deliver-payloads.js +1 -1
  263. package/dist/src/execution/durable-session-store.d.ts +10 -5
  264. package/dist/src/execution/durable-session-store.js +1 -1
  265. package/dist/src/execution/dynamic-connections.js +1 -1
  266. package/dist/src/execution/dynamic-workflow/program-step.js +1 -1
  267. package/dist/src/execution/dynamic-workflow/schema.d.ts +1 -3
  268. package/dist/src/execution/dynamic-workflow/schema.js +1 -1
  269. package/dist/src/execution/dynamic-workflow/tool.d.ts +1 -1
  270. package/dist/src/execution/dynamic-workflow/tool.js +1 -1
  271. package/dist/src/execution/dynamic-workflow/workflow.js +1 -1
  272. package/dist/src/execution/forward-session-input.d.ts +4 -0
  273. package/dist/src/execution/forward-session-input.js +1 -0
  274. package/dist/src/execution/legacy-remote-agent/protocol.d.ts +41 -0
  275. package/dist/src/execution/legacy-remote-agent/protocol.js +1 -0
  276. package/dist/src/execution/legacy-session/authorization.js +1 -1
  277. package/dist/src/execution/legacy-session/completion-step.d.ts +2 -0
  278. package/dist/src/execution/legacy-session/completion-step.js +1 -1
  279. package/dist/src/execution/legacy-session/inbox.js +1 -1
  280. package/dist/src/execution/legacy-session/input.js +1 -1
  281. package/dist/src/execution/legacy-session/interrupt-step.js +1 -1
  282. package/dist/src/execution/legacy-session/prepare-step.d.ts +1 -0
  283. package/dist/src/execution/legacy-session/prepare-step.js +1 -1
  284. package/dist/src/execution/legacy-session/snapshot.d.ts +8 -4
  285. package/dist/src/execution/legacy-session/snapshot.js +1 -1
  286. package/dist/src/execution/legacy-session/turn-workflow.js +1 -1
  287. package/dist/src/execution/model-call-batching.js +1 -1
  288. package/dist/src/execution/node-step.d.ts +1 -1
  289. package/dist/src/execution/node-step.js +1 -1
  290. package/dist/src/execution/proxied-deliver-step.d.ts +9 -6
  291. package/dist/src/execution/proxied-deliver-step.js +1 -1
  292. package/dist/src/execution/publish-session-events.d.ts +150 -0
  293. package/dist/src/execution/publish-session-events.js +1 -0
  294. package/dist/src/execution/reconcile-session-continuation-token.d.ts +2 -2
  295. package/dist/src/execution/route-child-delivery.d.ts +5 -4
  296. package/dist/src/execution/route-child-delivery.js +1 -3
  297. package/dist/src/execution/runtime-context.js +1 -1
  298. package/dist/src/execution/sandbox/prewarm.js +1 -1
  299. package/dist/src/execution/session/active-turn.d.ts +97 -0
  300. package/dist/src/execution/session/active-turn.js +1 -0
  301. package/dist/src/execution/session/admission.d.ts +1 -12
  302. package/dist/src/execution/session/admission.js +1 -1
  303. package/dist/src/execution/session/entry-input.d.ts +0 -2
  304. package/dist/src/execution/session/entry.js +1 -1
  305. package/dist/src/execution/session/finalization.js +1 -1
  306. package/dist/src/execution/session/handoff-steps.d.ts +13 -2
  307. package/dist/src/execution/session/handoff-steps.js +1 -1
  308. package/dist/src/execution/session/handoff.d.ts +21 -5
  309. package/dist/src/execution/session/handoff.js +1 -1
  310. package/dist/src/execution/session/input-queue.d.ts +44 -39
  311. package/dist/src/execution/session/input-queue.js +1 -1
  312. package/dist/src/execution/session/next-input.d.ts +7 -10
  313. package/dist/src/execution/session/next-input.js +1 -1
  314. package/dist/src/execution/session/pending-turn-state.d.ts +2 -0
  315. package/dist/src/execution/session/pending-turn-state.js +1 -1
  316. package/dist/src/execution/session/principal.d.ts +14 -0
  317. package/dist/src/execution/session/principal.js +1 -0
  318. package/dist/src/execution/session/program.d.ts +2 -0
  319. package/dist/src/execution/session/program.js +1 -1
  320. package/dist/src/execution/session/route-selected-delivery.js +1 -1
  321. package/dist/src/execution/session/state-cursor.d.ts +26 -18
  322. package/dist/src/execution/session/state-cursor.js +1 -1
  323. package/dist/src/execution/session/state-delta.d.ts +40 -0
  324. package/dist/src/execution/session/state-delta.js +1 -0
  325. package/dist/src/execution/session/timeout-steps.js +1 -1
  326. package/dist/src/execution/session/turn-event-handler.d.ts +2 -2
  327. package/dist/src/execution/session/turn-event-handler.js +1 -1
  328. package/dist/src/execution/session/turn-step-result.d.ts +1 -3
  329. package/dist/src/execution/session/turn-step-result.js +1 -1
  330. package/dist/src/execution/session/turn-step-types.d.ts +37 -19
  331. package/dist/src/execution/session/turn-step.d.ts +2 -2
  332. package/dist/src/execution/session/turn-step.js +1 -1
  333. package/dist/src/execution/session/turn-waiting-step.d.ts +4 -0
  334. package/dist/src/execution/session/turn-waiting-step.js +1 -0
  335. package/dist/src/execution/session/turn.d.ts +41 -3
  336. package/dist/src/execution/session/turn.js +1 -1
  337. package/dist/src/execution/session-callback-request.js +1 -1
  338. package/dist/src/execution/session-event-stream.d.ts +33 -0
  339. package/dist/src/execution/session-event-stream.js +1 -0
  340. package/dist/src/execution/session-inbox/inbox.d.ts +2 -0
  341. package/dist/src/execution/session-inbox/inbox.js +1 -1
  342. package/dist/src/execution/session-inbox/protocol.js +1 -1
  343. package/dist/src/execution/session-inbox/release-step.js +1 -1
  344. package/dist/src/execution/session-inbox/resume.js +1 -1
  345. package/dist/src/execution/session-workflow-tool-run.d.ts +11 -2
  346. package/dist/src/execution/session-workflow-tool-run.js +1 -1
  347. package/dist/src/execution/session.d.ts +5 -6
  348. package/dist/src/execution/session.js +2 -2
  349. package/dist/src/execution/settle-cancelled-turn-step.d.ts +23 -10
  350. package/dist/src/execution/settle-cancelled-turn-step.js +1 -1
  351. package/dist/src/execution/stable-workflow-names.d.ts +0 -1
  352. package/dist/src/execution/stable-workflow-names.js +1 -1
  353. package/dist/src/execution/tasks/calls.d.ts +42 -0
  354. package/dist/src/execution/tasks/calls.js +1 -0
  355. package/dist/src/execution/tasks/model-step.d.ts +58 -0
  356. package/dist/src/execution/tasks/model-step.js +1 -0
  357. package/dist/src/execution/tasks/render.d.ts +66 -0
  358. package/dist/src/execution/tasks/render.js +8 -0
  359. package/dist/src/execution/tasks/session.d.ts +19 -0
  360. package/dist/src/execution/tasks/session.js +1 -0
  361. package/dist/src/execution/tasks/start.d.ts +34 -0
  362. package/dist/src/execution/tasks/start.js +1 -0
  363. package/dist/src/execution/tasks/steps.d.ts +31 -0
  364. package/dist/src/execution/tasks/steps.js +1 -0
  365. package/dist/src/execution/tasks/table.d.ts +192 -0
  366. package/dist/src/execution/tasks/table.js +1 -0
  367. package/dist/src/execution/tasks/task-id-input.d.ts +19 -0
  368. package/dist/src/execution/tasks/task-id-input.js +1 -0
  369. package/dist/src/execution/tasks/tool-entry-point.d.ts +11 -0
  370. package/dist/src/execution/tasks/tool-entry-point.js +1 -0
  371. package/dist/src/execution/tasks/workflow-target.d.ts +2 -0
  372. package/dist/src/execution/tasks/workflow-target.js +1 -1
  373. package/dist/src/execution/terminal-session-completion-step.d.ts +2 -0
  374. package/dist/src/execution/terminal-session-completion-step.js +1 -1
  375. package/dist/src/execution/terminal-session-failure-step.d.ts +2 -0
  376. package/dist/src/execution/terminal-session-failure-step.js +1 -1
  377. package/dist/src/execution/terminate-child-sessions-step.d.ts +2 -9
  378. package/dist/src/execution/terminate-child-sessions-step.js +1 -1
  379. package/dist/src/execution/tool-auth.js +1 -1
  380. package/dist/src/execution/tools/agent-router-workflow.d.ts +1 -1
  381. package/dist/src/execution/tools/agent-router-workflow.js +1 -1
  382. package/dist/src/execution/tools/agent-router.d.ts +1 -1
  383. package/dist/src/execution/tools/agent-router.js +1 -1
  384. package/dist/src/execution/tools/connection-approval.d.ts +25 -0
  385. package/dist/src/execution/tools/connection-approval.js +1 -0
  386. package/dist/src/execution/tools/connection-search-rank.d.ts +21 -0
  387. package/dist/src/execution/tools/connection-search-rank.js +1 -0
  388. package/dist/src/execution/tools/connection-target.d.ts +18 -0
  389. package/dist/src/execution/tools/connection-target.js +1 -0
  390. package/dist/src/execution/tools/connection-tools.d.ts +10 -0
  391. package/dist/src/execution/tools/connection-tools.js +2 -0
  392. package/dist/src/execution/tools/load-skill.js +1 -1
  393. package/dist/src/execution/tools/workflow/answer.d.ts +7 -4
  394. package/dist/src/execution/tools/workflow/answer.js +1 -1
  395. package/dist/src/execution/tools/workflow/ask.d.ts +73 -10
  396. package/dist/src/execution/tools/workflow/ask.js +1 -1
  397. package/dist/src/execution/tools/workflow/body.d.ts +60 -19
  398. package/dist/src/execution/tools/workflow/body.js +1 -1
  399. package/dist/src/execution/tools/workflow/cancel.d.ts +7 -2
  400. package/dist/src/execution/tools/workflow/cancel.js +1 -1
  401. package/dist/src/execution/tools/workflow/emit-workflow-tool-run-report-step.d.ts +10 -4
  402. package/dist/src/execution/tools/workflow/emit-workflow-tool-run-report-step.js +1 -1
  403. package/dist/src/execution/tools/workflow/{background.d.ts → harness-definition.d.ts} +6 -6
  404. package/dist/src/execution/tools/workflow/harness-definition.js +1 -0
  405. package/dist/src/execution/tools/workflow/interrupt.d.ts +6 -0
  406. package/dist/src/execution/tools/workflow/interrupt.js +1 -0
  407. package/dist/src/execution/tools/workflow/messages.d.ts +135 -10
  408. package/dist/src/execution/tools/workflow/messages.js +1 -1
  409. package/dist/src/execution/tools/workflow/owner-inbox.js +1 -1
  410. package/dist/src/execution/tools/workflow/owner.d.ts +15 -4
  411. package/dist/src/execution/tools/workflow/owner.js +1 -1
  412. package/dist/src/execution/tools/workflow/serve.d.ts +3 -0
  413. package/dist/src/execution/tools/workflow/serve.js +1 -0
  414. package/dist/src/execution/tools/workflow/start.d.ts +18 -11
  415. package/dist/src/execution/tools/workflow/start.js +1 -1
  416. package/dist/src/execution/tools/workflow/step-execution.js +1 -1
  417. package/dist/src/execution/tools/workflow/step.js +1 -1
  418. package/dist/src/execution/tools/workflow/types.d.ts +0 -10
  419. package/dist/src/execution/tools/workflow/withdraw-step.d.ts +31 -0
  420. package/dist/src/execution/tools/workflow/withdraw-step.js +1 -0
  421. package/dist/src/execution/tools/workflow/workflow-owner-blocking.d.ts +3 -5
  422. package/dist/src/execution/tools/workflow/workflow-owner-blocking.js +1 -1
  423. package/dist/src/execution/tools/workflow/workflow.d.ts +3 -3
  424. package/dist/src/execution/tools/workflow/workflow.js +1 -1
  425. package/dist/src/execution/web-fetch/request.js +1 -1
  426. package/dist/src/execution/workflow-callback-url.d.ts +0 -5
  427. package/dist/src/execution/workflow-callback-url.js +1 -1
  428. package/dist/src/execution/workflow-runtime.d.ts +3 -5
  429. package/dist/src/execution/workflow-runtime.js +1 -1
  430. package/dist/src/execution/workflow-webhook-route.js +1 -1
  431. package/dist/src/extensions/code/extension/lib/connect-authentication.js +1 -1
  432. package/dist/src/extensions/code/extension/lib/github-shell.js +1 -1
  433. package/dist/src/extensions/code/extension/lib/prwatch-github.js +1 -1
  434. package/dist/src/framework/sources/modules/agent.d.ts +1 -0
  435. package/dist/src/framework/sources/modules/agent.js +1 -1
  436. package/dist/src/framework/sources/registry.js +1 -1
  437. package/dist/src/harness/action-presentation.js +1 -1
  438. package/dist/src/harness/action-result-helpers.d.ts +1 -0
  439. package/dist/src/harness/action-result-helpers.js +1 -1
  440. package/dist/src/harness/advertised-tools.d.ts +1 -1
  441. package/dist/src/harness/advertised-tools.js +1 -1
  442. package/dist/src/harness/announcements.d.ts +22 -0
  443. package/dist/src/harness/announcements.js +1 -0
  444. package/dist/src/harness/approval-candidates.d.ts +10 -2
  445. package/dist/src/harness/approval-candidates.js +1 -1
  446. package/dist/src/harness/approval-delivery-coordinator.d.ts +4 -5
  447. package/dist/src/harness/approval-delivery-coordinator.js +1 -1
  448. package/dist/src/harness/approval-recheck.d.ts +7 -0
  449. package/dist/src/harness/approval-recheck.js +1 -0
  450. package/dist/src/harness/authorization-event-fields.d.ts +13 -0
  451. package/dist/src/harness/authorization-event-fields.js +1 -0
  452. package/dist/src/harness/authorization.d.ts +17 -3
  453. package/dist/src/harness/authorization.js +1 -1
  454. package/dist/src/harness/cancelled-turn-emission.d.ts +2 -1
  455. package/dist/src/harness/cancelled-turn-emission.js +1 -1
  456. package/dist/src/harness/coordination.d.ts +36 -30
  457. package/dist/src/harness/coordination.js +1 -1
  458. package/dist/src/harness/current-messages.d.ts +6 -1
  459. package/dist/src/harness/current-messages.js +1 -1
  460. package/dist/src/harness/emission.d.ts +11 -2
  461. package/dist/src/harness/emission.js +1 -1
  462. package/dist/src/harness/execute-tool.d.ts +4 -15
  463. package/dist/src/harness/held-requests.d.ts +18 -0
  464. package/dist/src/harness/held-requests.js +1 -0
  465. package/dist/src/harness/hitl/approval-input-requests.d.ts +16 -0
  466. package/dist/src/harness/hitl/approval-input-requests.js +1 -1
  467. package/dist/src/harness/hitl/session-limit-input-requests.d.ts +2 -0
  468. package/dist/src/harness/hitl/session-limit-input-requests.js +1 -1
  469. package/dist/src/harness/input-extraction.js +1 -1
  470. package/dist/src/harness/input-request-resolution.d.ts +5 -2
  471. package/dist/src/harness/input-request-resolution.js +1 -1
  472. package/dist/src/harness/input-requests.d.ts +0 -4
  473. package/dist/src/harness/input-requests.js +1 -1
  474. package/dist/src/harness/messages.d.ts +11 -3
  475. package/dist/src/harness/messages.js +1 -1
  476. package/dist/src/harness/model-call-error.js +1 -1
  477. package/dist/src/harness/nested-actions.d.ts +23 -0
  478. package/dist/src/harness/nested-actions.js +1 -0
  479. package/dist/src/harness/pending-input-batches.d.ts +8 -6
  480. package/dist/src/harness/pending-input-batches.js +1 -1
  481. package/dist/src/harness/provider-tool-history.d.ts +7 -2
  482. package/dist/src/harness/provider-tool-history.js +1 -1
  483. package/dist/src/harness/proxy-input-requests.d.ts +45 -40
  484. package/dist/src/harness/proxy-input-requests.js +1 -1
  485. package/dist/src/harness/session-limit-enforcement.js +1 -1
  486. package/dist/src/harness/stale-input-responses.js +1 -1
  487. package/dist/src/harness/step-hooks.js +1 -1
  488. package/dist/src/harness/tool-loop.js +2 -2
  489. package/dist/src/harness/tool-model-output.js +1 -1
  490. package/dist/src/harness/tool-presentation.js +1 -1
  491. package/dist/src/harness/tools.d.ts +1 -5
  492. package/dist/src/harness/tools.js +1 -1
  493. package/dist/src/harness/turn-tag-state.d.ts +8 -5
  494. package/dist/src/harness/turn-tag-state.js +1 -1
  495. package/dist/src/harness/types.d.ts +25 -21
  496. package/dist/src/harness/workflow-dispatch.d.ts +30 -0
  497. package/dist/src/harness/workflow-dispatch.js +1 -0
  498. package/dist/src/harness/workflow-tool-runs.d.ts +5 -65
  499. package/dist/src/harness/workflow-tool-runs.js +1 -1
  500. package/dist/src/instrumentation/channel-delivery.d.ts +1 -0
  501. package/dist/src/instrumentation/channel-delivery.js +1 -1
  502. package/dist/src/instrumentation/lifecycle.d.ts +7 -0
  503. package/dist/src/instrumentation/memory.d.ts +2 -0
  504. package/dist/src/instrumentation/memory.js +1 -1
  505. package/dist/src/instrumentation/native-events.d.ts +1 -7
  506. package/dist/src/instrumentation/native-events.js +1 -1
  507. package/dist/src/instrumentation/runtime.d.ts +5 -7
  508. package/dist/src/instrumentation/runtime.js +1 -1
  509. package/dist/src/instrumentation/session-init.js +1 -1
  510. package/dist/src/instrumentation/state.d.ts +0 -6
  511. package/dist/src/instrumentation/state.js +1 -1
  512. package/dist/src/internal/application/package.js +1 -1
  513. package/dist/src/internal/authored-definition/schema-backed.d.ts +10 -0
  514. package/dist/src/internal/authored-definition/schema-backed.js +1 -1
  515. package/dist/src/internal/authored-module-loader.d.ts +20 -6
  516. package/dist/src/internal/authored-module-loader.js +2 -2
  517. package/dist/src/internal/authored-module-map-loader.js +1 -1
  518. package/dist/src/internal/authored-package-boundary.d.ts +3 -0
  519. package/dist/src/internal/authored-package-boundary.js +1 -1
  520. package/dist/src/internal/bundler/extension-mount-plugin.d.ts +14 -0
  521. package/dist/src/internal/bundler/extension-mount-plugin.js +1 -0
  522. package/dist/src/internal/bundler/extension-scope-plugin.d.ts +8 -11
  523. package/dist/src/internal/bundler/extension-scope-plugin.js +2 -3
  524. package/dist/src/internal/invocation/workflow-execution.d.ts +2 -2
  525. package/dist/src/internal/invocation/workflow-execution.js +1 -1
  526. package/dist/src/internal/mount-state.d.ts +1 -0
  527. package/dist/src/internal/mount-state.js +1 -0
  528. package/dist/src/internal/nitro/host/build-application.js +1 -1
  529. package/dist/src/internal/nitro/host/create-application-nitro.js +1 -1
  530. package/dist/src/internal/nitro/host/dev-host-fingerprint.js +1 -1
  531. package/dist/src/internal/nitro/host/extension-capability-requirements.js +1 -1
  532. package/dist/src/internal/nitro/host/workspace-extensions.js +1 -1
  533. package/dist/src/internal/nitro/routes/runtime-stack.js +1 -1
  534. package/dist/src/internal/node-esm-compat-banner.js +1 -1
  535. package/dist/src/internal/workflow/development-world-client.js +1 -1
  536. package/dist/src/internal/workflow-bundle/authored-workflow-directives.d.ts +4 -3
  537. package/dist/src/internal/workflow-bundle/authored-workflow-directives.js +1 -1
  538. package/dist/src/internal/workflow-bundle/builder.js +1 -1
  539. package/dist/src/internal/workflow-bundle/dynamic-capability-transform-plugin.js +1 -1
  540. package/dist/src/internal/workflow-bundle/dynamic-remote-agent-transform.js +1 -1
  541. package/dist/src/internal/workflow-bundle/dynamic-tool-ast-references.d.ts +27 -1
  542. package/dist/src/internal/workflow-bundle/dynamic-tool-ast-references.js +1 -1
  543. package/dist/src/internal/workflow-bundle/dynamic-tool-transform.js +2 -2
  544. package/dist/src/internal/workflow-bundle/workflow-builders.js +1 -1
  545. package/dist/src/models/auto.d.ts +6 -0
  546. package/dist/src/models/auto.js +2 -2
  547. package/dist/src/protocol/message-version.d.ts +1 -0
  548. package/dist/src/protocol/message-version.js +1 -1
  549. package/dist/src/protocol/message.d.ts +166 -69
  550. package/dist/src/protocol/message.js +2 -2
  551. package/dist/src/protocol/remote-agent-protocol.d.ts +16 -0
  552. package/dist/src/protocol/remote-agent-protocol.js +1 -0
  553. package/dist/src/protocol/routes.d.ts +0 -6
  554. package/dist/src/protocol/routes.js +1 -1
  555. package/dist/src/protocol/task-tools.d.ts +21 -0
  556. package/dist/src/protocol/task-tools.js +1 -0
  557. package/dist/src/public/channels/auth.js +1 -1
  558. package/dist/src/public/channels/chat-sdk/chatSdkChannel.d.ts +25 -16
  559. package/dist/src/public/channels/chat-sdk/chatSdkChannel.js +2 -2
  560. package/dist/src/public/channels/chat-sdk/index.d.ts +1 -1
  561. package/dist/src/public/channels/chat-sdk/input-actions.d.ts +8 -0
  562. package/dist/src/public/channels/chat-sdk/input-actions.js +1 -0
  563. package/dist/src/public/channels/index.d.ts +1 -1
  564. package/dist/src/public/channels/linq/linqChannel.js +1 -1
  565. package/dist/src/public/channels/photon/photonIMessageChannel.js +1 -1
  566. package/dist/src/public/channels/slack/action-status.d.ts +11 -12
  567. package/dist/src/public/channels/slack/action-status.js +1 -1
  568. package/dist/src/public/channels/slack/api.js +1 -1
  569. package/dist/src/public/channels/slack/approval-cards.d.ts +15 -0
  570. package/dist/src/public/channels/slack/approval-cards.js +2 -0
  571. package/dist/src/public/channels/slack/attachments.js +1 -1
  572. package/dist/src/public/channels/slack/auth.d.ts +5 -0
  573. package/dist/src/public/channels/slack/auth.js +1 -1
  574. package/dist/src/public/channels/slack/connections.d.ts +20 -16
  575. package/dist/src/public/channels/slack/connections.js +1 -1
  576. package/dist/src/public/channels/slack/defaults.d.ts +13 -33
  577. package/dist/src/public/channels/slack/defaults.js +3 -4
  578. package/dist/src/public/channels/slack/hitl.d.ts +22 -13
  579. package/dist/src/public/channels/slack/hitl.js +2 -2
  580. package/dist/src/public/channels/slack/inbound.d.ts +10 -2
  581. package/dist/src/public/channels/slack/inbound.js +1 -1
  582. package/dist/src/public/channels/slack/index.d.ts +6 -3
  583. package/dist/src/public/channels/slack/index.js +1 -1
  584. package/dist/src/public/channels/slack/input-response.d.ts +1 -5
  585. package/dist/src/public/channels/slack/input-response.js +1 -1
  586. package/dist/src/public/channels/slack/interaction-cards.js +1 -1
  587. package/dist/src/public/channels/slack/interactions.js +1 -1
  588. package/dist/src/public/channels/slack/limits.d.ts +5 -3
  589. package/dist/src/public/channels/slack/private-approval-delivery.js +1 -1
  590. package/dist/src/public/channels/slack/renderers.d.ts +76 -0
  591. package/dist/src/public/channels/slack/renderers.js +1 -0
  592. package/dist/src/public/channels/slack/reply-delivery.d.ts +72 -0
  593. package/dist/src/public/channels/slack/reply-delivery.js +1 -0
  594. package/dist/src/public/channels/slack/session-operations.d.ts +6 -0
  595. package/dist/src/public/channels/slack/session-operations.js +1 -1
  596. package/dist/src/public/channels/slack/sign-in-cancel.d.ts +20 -0
  597. package/dist/src/public/channels/slack/sign-in-cancel.js +1 -0
  598. package/dist/src/public/channels/slack/slackChannel.d.ts +62 -103
  599. package/dist/src/public/channels/slack/slackChannel.js +1 -1
  600. package/dist/src/public/channels/slack/task-card.d.ts +24 -0
  601. package/dist/src/public/channels/slack/task-card.js +1 -0
  602. package/dist/src/public/channels/teams/defaults.d.ts +1 -1
  603. package/dist/src/public/channels/teams/defaults.js +2 -2
  604. package/dist/src/public/channels/telegram/hitl.d.ts +7 -1
  605. package/dist/src/public/channels/telegram/hitl.js +2 -1
  606. package/dist/src/public/channels/telegram/state.js +1 -1
  607. package/dist/src/public/channels/telegram/telegramChannel.d.ts +5 -0
  608. package/dist/src/public/channels/telegram/telegramChannel.js +1 -1
  609. package/dist/src/public/definitions/channel.d.ts +7 -1
  610. package/dist/src/public/definitions/channel.js +1 -1
  611. package/dist/src/public/definitions/connections/mcp.d.ts +4 -6
  612. package/dist/src/public/definitions/connections/openapi.d.ts +7 -8
  613. package/dist/src/public/definitions/extension.d.ts +2 -2
  614. package/dist/src/public/definitions/extension.js +1 -1
  615. package/dist/src/public/definitions/hook.d.ts +4 -4
  616. package/dist/src/public/definitions/state.d.ts +4 -2
  617. package/dist/src/public/definitions/state.js +1 -1
  618. package/dist/src/public/memory/index.d.ts +0 -1
  619. package/dist/src/public/models/openai/index.d.ts +1 -1
  620. package/dist/src/public/models/openai/index.js +1 -1
  621. package/dist/src/public/next/index.js +1 -1
  622. package/dist/src/public/next/server.d.ts +2 -0
  623. package/dist/src/public/next/server.js +1 -2
  624. package/dist/src/public/nuxt/module.d.ts +6 -0
  625. package/dist/src/public/nuxt/module.js +1 -1
  626. package/dist/src/public/schedules/index.d.ts +1 -0
  627. package/dist/src/public/schedules/index.js +1 -1
  628. package/dist/src/public/server/index.d.ts +28 -0
  629. package/dist/src/public/server/index.js +1 -0
  630. package/dist/src/public/tools/index.d.ts +3 -2
  631. package/dist/src/public/tools/index.js +1 -1
  632. package/dist/src/public/tools/no-reply.d.ts +1 -0
  633. package/dist/src/public/tools/no-reply.js +1 -0
  634. package/dist/src/react/index.d.ts +3 -0
  635. package/dist/src/react/index.js +1 -1
  636. package/dist/src/react/use-eve-agent.d.ts +7 -5
  637. package/dist/src/react/use-eve-agent.js +1 -1
  638. package/dist/src/runtime/agent/bootstrap-model-utils.d.ts +6 -7
  639. package/dist/src/runtime/agent/bootstrap-model-utils.js +1 -1
  640. package/dist/src/runtime/agent/bootstrap.d.ts +0 -1
  641. package/dist/src/runtime/agent/bootstrap.js +1 -1
  642. package/dist/src/runtime/agent/mock-model-adapter.js +1 -1
  643. package/dist/src/runtime/agent/mock-model-fixtures.d.ts +1 -1
  644. package/dist/src/runtime/agent/mock-model-fixtures.js +2 -2
  645. package/dist/src/runtime/channels/registry.js +1 -1
  646. package/dist/src/runtime/connections/mcp-client.d.ts +1 -9
  647. package/dist/src/runtime/connections/mcp-client.js +1 -1
  648. package/dist/src/runtime/connections/openapi-client.js +1 -1
  649. package/dist/src/runtime/connections/scoped-authorization.d.ts +3 -1
  650. package/dist/src/runtime/connections/scoped-authorization.js +1 -1
  651. package/dist/src/runtime/connections/tool-result.d.ts +27 -0
  652. package/dist/src/runtime/connections/tool-result.js +2 -0
  653. package/dist/src/runtime/connections/tool-signature.d.ts +14 -0
  654. package/dist/src/runtime/connections/tool-signature.js +1 -0
  655. package/dist/src/runtime/local-dev-capability.js +1 -1
  656. package/dist/src/runtime/prompt/compose.d.ts +1 -3
  657. package/dist/src/runtime/prompt/compose.js +3 -3
  658. package/dist/src/runtime/resolve-agent-graph.js +1 -1
  659. package/dist/src/runtime/resolve-tool.js +1 -1
  660. package/dist/src/runtime/sessions/compiled-agent-cache.js +1 -1
  661. package/dist/src/runtime/sessions/runtime-context-keys.js +1 -1
  662. package/dist/src/runtime/sessions/turn.d.ts +1 -16
  663. package/dist/src/runtime/subagents/dynamic-remote-agent-config.js +1 -1
  664. package/dist/src/runtime/subagents/registry.js +1 -1
  665. package/dist/src/runtime/subagents/workflow-reference.d.ts +6 -3
  666. package/dist/src/runtime/subagents/workflow-reference.js +1 -1
  667. package/dist/src/runtime/subagents/workflow.d.ts +12 -6
  668. package/dist/src/runtime/subagents/workflow.js +1 -1
  669. package/dist/src/runtime/tools/registry.js +1 -1
  670. package/dist/src/self-modification/extension/classify-registry-item.d.ts +3 -0
  671. package/dist/src/self-modification/extension/classify-registry-item.js +1 -1
  672. package/dist/src/self-modification/extension/subagents/agent/agent.d.ts +1 -1
  673. package/dist/src/self-modification/extension/subagents/agent/agent.js +1 -1
  674. package/dist/src/self-modification/extension/subagents/agent/instructions.js +7 -7
  675. package/dist/src/self-modification/extension/subagents/agent/tools/registry_add.js +1 -1
  676. package/dist/src/self-modification/extension/subagents/agent/tools/search_registry.d.ts +2 -0
  677. package/dist/src/self-modification/extension/subagents/agent/tools/search_registry.js +1 -1
  678. package/dist/src/self-modification/scaffold.d.ts +2 -0
  679. package/dist/src/self-modification/scaffold.js +7 -0
  680. package/dist/src/self-modification/setup.js +1 -7
  681. package/dist/src/setup/boxes/deploy-project.js +1 -1
  682. package/dist/src/setup/boxes/select-model.js +1 -1
  683. package/dist/src/setup/integrations/shopify/templates.d.ts +1 -1
  684. package/dist/src/setup/integrations/shopify/templates.js +31 -19
  685. package/dist/src/setup/integrations/web/setup.js +6 -2
  686. package/dist/src/setup/scaffold/create/agent-paths.d.ts +5 -0
  687. package/dist/src/setup/scaffold/create/agent-paths.js +1 -0
  688. package/dist/src/setup/scaffold/create/instructions-template.d.ts +1 -0
  689. package/dist/src/setup/scaffold/create/instructions-template.js +8 -0
  690. package/dist/src/setup/scaffold/create/project.js +3 -10
  691. package/dist/src/setup/scaffold/create/web-template.d.ts +2 -2
  692. package/dist/src/setup/scaffold/create/web-template.js +28 -9
  693. package/dist/src/setup/vercel-project-framework.js +1 -1
  694. package/dist/src/shared/action-request-name.d.ts +3 -0
  695. package/dist/src/shared/action-request-name.js +1 -0
  696. package/dist/src/shared/action-types.d.ts +49 -21
  697. package/dist/src/shared/action-types.js +1 -1
  698. package/dist/src/shared/agent-definition.d.ts +0 -7
  699. package/dist/src/shared/chatgpt-model.d.ts +1 -1
  700. package/dist/src/shared/chatgpt-model.js +1 -1
  701. package/dist/src/shared/connection-types.d.ts +2 -8
  702. package/dist/src/shared/default-agent-model.d.ts +10 -1
  703. package/dist/src/shared/default-agent-model.js +1 -1
  704. package/dist/src/shared/display-name.d.ts +15 -0
  705. package/dist/src/shared/display-name.js +1 -0
  706. package/dist/src/shared/extension-mount.d.ts +2 -0
  707. package/dist/src/shared/extension-mount.js +1 -0
  708. package/dist/src/shared/format-duration.d.ts +2 -0
  709. package/dist/src/shared/format-duration.js +1 -0
  710. package/dist/src/shared/framework-eve-server.d.ts +43 -0
  711. package/dist/src/shared/framework-eve-server.js +2 -0
  712. package/dist/src/shared/input.d.ts +1 -0
  713. package/dist/src/shared/memory-state.d.ts +1 -0
  714. package/dist/src/shared/memory-state.js +1 -1
  715. package/dist/src/shared/model-helper.d.ts +2 -2
  716. package/dist/src/shared/model-helper.js +1 -1
  717. package/dist/src/shared/model-summary.d.ts +2 -6
  718. package/dist/src/shared/model-summary.js +1 -1
  719. package/dist/src/shared/presentation-text.d.ts +5 -0
  720. package/dist/src/shared/presentation-text.js +1 -1
  721. package/dist/src/shared/serialized-observability-state.d.ts +0 -4
  722. package/dist/src/shared/serialized-observability-state.js +1 -1
  723. package/dist/src/shared/token-usage.d.ts +2 -0
  724. package/dist/src/shared/token-usage.js +1 -1
  725. package/dist/src/shared/trace-root.d.ts +8 -0
  726. package/dist/src/shared/trace-root.js +1 -0
  727. package/dist/src/shared/value-delta.d.ts +39 -0
  728. package/dist/src/shared/value-delta.js +1 -0
  729. package/dist/src/subagents/adapter-state.d.ts +0 -2
  730. package/dist/src/subagents/adapter-state.js +1 -1
  731. package/dist/src/subagents/adapter.js +1 -1
  732. package/dist/src/subagents/callback-route.js +1 -1
  733. package/dist/src/subagents/event-proxy-step.d.ts +16 -29
  734. package/dist/src/subagents/event-proxy-step.js +1 -1
  735. package/dist/src/subagents/hitl-proxy.d.ts +38 -20
  736. package/dist/src/subagents/hitl-proxy.js +1 -1
  737. package/dist/src/subagents/invocation.d.ts +4 -3
  738. package/dist/src/subagents/parent-notification.d.ts +2 -1
  739. package/dist/src/subagents/parent-notification.js +1 -1
  740. package/dist/src/subagents/token-budget.d.ts +8 -9
  741. package/dist/src/subagents/token-budget.js +1 -1
  742. package/dist/src/subagents/tool.d.ts +6 -12
  743. package/dist/src/subagents/tool.js +1 -1
  744. package/dist/src/svelte/index.d.ts +3 -0
  745. package/dist/src/svelte/index.js +2 -2
  746. package/dist/src/svelte/use-eve-agent.d.ts +7 -4
  747. package/dist/src/svelte/use-eve-agent.js +1 -1
  748. package/dist/src/tools/behavior.d.ts +5 -5
  749. package/dist/src/tools/definition.d.ts +50 -14
  750. package/dist/src/tools/definition.js +1 -1
  751. package/dist/src/tools/durable-callbacks.d.ts +1 -1
  752. package/dist/src/tools/dynamic.d.ts +6 -0
  753. package/dist/src/tools/framework/agent-contract.d.ts +2 -5
  754. package/dist/src/tools/framework/agent-contract.js +1 -1
  755. package/dist/src/tools/framework/agent.d.ts +2 -5
  756. package/dist/src/tools/framework/agent.js +1 -1
  757. package/dist/src/tools/framework/connection-tools.d.ts +3 -0
  758. package/dist/src/tools/framework/connection-tools.js +1 -0
  759. package/dist/src/tools/provided/agent-router.d.ts +6 -3
  760. package/dist/src/tools/provided/agent-router.js +1 -1
  761. package/dist/src/{execution/tools → tools/provided}/ask-question-workflow.d.ts +3 -4
  762. package/dist/src/tools/provided/ask-question-workflow.js +1 -0
  763. package/dist/src/tools/provided/ask-question.d.ts +20 -5
  764. package/dist/src/tools/provided/ask-question.js +2 -1
  765. package/dist/src/tools/provided/interrupted.d.ts +18 -0
  766. package/dist/src/tools/provided/interrupted.js +1 -0
  767. package/dist/src/tools/provided/load-skill.js +1 -1
  768. package/dist/src/tools/provided/no-reply.d.ts +19 -0
  769. package/dist/src/tools/provided/no-reply.js +1 -0
  770. package/dist/src/tools/provided/sleep-workflow.d.ts +4 -0
  771. package/dist/src/tools/provided/sleep-workflow.js +1 -0
  772. package/dist/src/tools/provided/sleep.d.ts +11 -5
  773. package/dist/src/tools/provided/sleep.js +1 -1
  774. package/dist/src/tools/provided/task-cancel.d.ts +6 -0
  775. package/dist/src/tools/provided/task-cancel.js +1 -0
  776. package/dist/src/tools/provided/task-wait.d.ts +9 -0
  777. package/dist/src/tools/provided/task-wait.js +1 -0
  778. package/dist/src/tools/provided/workflow.d.ts +2 -2
  779. package/dist/src/tools/provided/workflow.js +1 -1
  780. package/dist/src/tools/schema-emission.d.ts +23 -0
  781. package/dist/src/tools/schema-emission.js +1 -0
  782. package/dist/src/tools/schema.d.ts +22 -8
  783. package/dist/src/tools/schema.js +1 -1
  784. package/dist/src/tools/workflow-definition.d.ts +187 -85
  785. package/dist/src/tools/workflow-definition.js +1 -1
  786. package/dist/src/tools/workflow-entry-point.d.ts +3 -0
  787. package/dist/src/tools/workflow-entry-point.js +1 -0
  788. package/dist/src/tracing/agent-action-instrumentation.d.ts +1 -3
  789. package/dist/src/tracing/agent-action-instrumentation.js +1 -1
  790. package/dist/src/tracing/agent-approval-instrumentation.js +1 -1
  791. package/dist/src/tracing/agent-invocation-coordinator.d.ts +9 -18
  792. package/dist/src/tracing/agent-invocation-coordinator.js +1 -1
  793. package/dist/src/tracing/agent-memory-instrumentation.js +1 -1
  794. package/dist/src/tracing/agent-otel-attributes.d.ts +6 -0
  795. package/dist/src/tracing/agent-otel-attributes.js +1 -1
  796. package/dist/src/tracing/agent-otel-content.d.ts +0 -2
  797. package/dist/src/tracing/agent-otel-content.js +3 -3
  798. package/dist/src/tracing/agent-otel-provider.js +2 -2
  799. package/dist/src/tracing/agent-otel-runtime-context.d.ts +20 -0
  800. package/dist/src/tracing/agent-otel-runtime-context.js +1 -1
  801. package/dist/src/tracing/agent-otel-session-context.js +1 -1
  802. package/dist/src/tracing/agent-otel-usage.js +1 -1
  803. package/dist/src/tracing/agent-span-contract.d.ts +1 -1
  804. package/dist/src/tracing/agent-span-contract.js +1 -1
  805. package/dist/src/tracing/agent-span-id-generator.d.ts +0 -1
  806. package/dist/src/tracing/agent-span-id-generator.js +1 -1
  807. package/dist/src/tracing/agent-tool-instrumentation.js +1 -1
  808. package/dist/src/tracing/agent-trace-context-codec.d.ts +5 -2
  809. package/dist/src/tracing/agent-trace-context-codec.js +1 -1
  810. package/dist/src/tracing/agent-trace-context-store.d.ts +2 -27
  811. package/dist/src/tracing/agent-trace-context-store.js +1 -1
  812. package/dist/src/tracing/agent-trace-span-processor.js +1 -1
  813. package/dist/src/tracing/agent-trace-state.d.ts +4 -19
  814. package/dist/src/tracing/content-attributes.js +1 -1
  815. package/dist/src/tracing/conversation-context.d.ts +10 -0
  816. package/dist/src/tracing/conversation-context.js +1 -1
  817. package/dist/src/tracing/install-instrumentation-runtime.js +1 -1
  818. package/dist/src/tracing/otel-registration.js +1 -1
  819. package/dist/src/vue/index.d.ts +3 -0
  820. package/dist/src/vue/index.js +2 -2
  821. package/dist/src/vue/use-eve-agent.d.ts +7 -3
  822. package/dist/src/vue/use-eve-agent.js +1 -1
  823. package/docs/agent-config.md +36 -13
  824. package/docs/channels/chat-sdk.mdx +15 -4
  825. package/docs/channels/custom.mdx +89 -17
  826. package/docs/channels/eve.mdx +1 -1
  827. package/docs/channels/mcp.mdx +1 -1
  828. package/docs/channels/overview.mdx +14 -56
  829. package/docs/channels/slack.mdx +287 -45
  830. package/docs/channels/telegram.mdx +2 -0
  831. package/docs/concepts/built-in-tools.md +37 -28
  832. package/docs/concepts/context-control.md +2 -2
  833. package/docs/concepts/execution-model-and-durability.mdx +10 -11
  834. package/docs/concepts/sessions-runs-and-streaming.md +69 -49
  835. package/docs/connections/mcp.mdx +4 -4
  836. package/docs/connections/openapi.mdx +2 -2
  837. package/docs/connections/overview.mdx +11 -5
  838. package/docs/evals/assertions.mdx +5 -5
  839. package/docs/evals/cases.mdx +1 -1
  840. package/docs/evals/reporters.mdx +10 -4
  841. package/docs/extensions.md +22 -2
  842. package/docs/guides/client/streaming.mdx +33 -12
  843. package/docs/guides/deployment/vercel.mdx +2 -1
  844. package/docs/guides/dev-tui.md +26 -16
  845. package/docs/guides/dynamic-capabilities.md +6 -4
  846. package/docs/guides/evaluate.md +29 -2
  847. package/docs/guides/frontend/nuxt.mdx +24 -4
  848. package/docs/guides/frontend/overview.mdx +45 -41
  849. package/docs/guides/frontend/use-eve-agent-svelte.mdx +4 -10
  850. package/docs/guides/frontend/use-eve-agent-vue.mdx +4 -10
  851. package/docs/guides/hooks.md +16 -12
  852. package/docs/guides/instrumentation/instrumentation.mdx +2 -0
  853. package/docs/guides/instrumentation/otel.mdx +24 -6
  854. package/docs/guides/remote-agents.md +38 -22
  855. package/docs/guides/self-modification.md +10 -0
  856. package/docs/instructions.mdx +1 -1
  857. package/docs/patterns/multi-tenant-approvals.md +1 -1
  858. package/docs/protocols/ucp.mdx +20 -16
  859. package/docs/reference/cli.md +64 -11
  860. package/docs/reference/typescript-api.md +43 -41
  861. package/docs/schedules.mdx +14 -34
  862. package/docs/subagents/index.mdx +24 -56
  863. package/docs/tools/human-in-the-loop.md +50 -15
  864. package/docs/tools/meta.json +1 -1
  865. package/docs/tools/overview.mdx +80 -60
  866. package/docs/tools/tasks-upgrade.md +201 -0
  867. package/docs/tools/tasks.md +315 -0
  868. package/docs/tools/workflows.mdx +368 -154
  869. package/package.json +18 -12
  870. package/dist/src/channel/activity-renderer.d.ts +0 -21
  871. package/dist/src/channel/activity-renderer.js +0 -1
  872. package/dist/src/channel/activity-sink.d.ts +0 -2
  873. package/dist/src/channel/activity-sink.js +0 -1
  874. package/dist/src/cli/dev/tui/steering-stream.d.ts +0 -15
  875. package/dist/src/cli/dev/tui/steering-stream.js +0 -1
  876. package/dist/src/cli/dev/tui/subagent-pump.d.ts +0 -142
  877. package/dist/src/cli/dev/tui/subagent-pump.js +0 -1
  878. package/dist/src/eve-channel/activity-observer-request.d.ts +0 -7
  879. package/dist/src/eve-channel/activity-observer-request.js +0 -1
  880. package/dist/src/eve-channel/delivery-policy-request.d.ts +0 -4
  881. package/dist/src/eve-channel/delivery-policy-request.js +0 -1
  882. package/dist/src/execution/activity-cohort.d.ts +0 -20
  883. package/dist/src/execution/activity-cohort.js +0 -1
  884. package/dist/src/execution/activity-collector.d.ts +0 -12
  885. package/dist/src/execution/activity-collector.js +0 -1
  886. package/dist/src/execution/activity-events.d.ts +0 -8
  887. package/dist/src/execution/activity-events.js +0 -1
  888. package/dist/src/execution/activity-route.d.ts +0 -2
  889. package/dist/src/execution/activity-route.js +0 -1
  890. package/dist/src/execution/activity-work-id.d.ts +0 -9
  891. package/dist/src/execution/activity-work-id.js +0 -1
  892. package/dist/src/execution/activity-work.d.ts +0 -30
  893. package/dist/src/execution/activity-work.js +0 -1
  894. package/dist/src/execution/cancel-indexed-session-tasks-step.d.ts +0 -7
  895. package/dist/src/execution/cancel-indexed-session-tasks-step.js +0 -1
  896. package/dist/src/execution/dispatch-action-failures.d.ts +0 -8
  897. package/dist/src/execution/dispatch-action-failures.js +0 -1
  898. package/dist/src/execution/dispatch-start-operation.d.ts +0 -15
  899. package/dist/src/execution/dispatch-start-operation.js +0 -1
  900. package/dist/src/execution/publish-channel-event.d.ts +0 -23
  901. package/dist/src/execution/publish-channel-event.js +0 -1
  902. package/dist/src/execution/scheduled-launch-delivery.d.ts +0 -7
  903. package/dist/src/execution/scheduled-launch-delivery.js +0 -1
  904. package/dist/src/execution/session/event-sink.d.ts +0 -26
  905. package/dist/src/execution/session/event-sink.js +0 -1
  906. package/dist/src/execution/session-activity-projection.d.ts +0 -16
  907. package/dist/src/execution/session-activity-projection.js +0 -1
  908. package/dist/src/execution/session-activity-renderer-step.d.ts +0 -15
  909. package/dist/src/execution/session-activity-renderer-step.js +0 -1
  910. package/dist/src/execution/session-activity.d.ts +0 -3
  911. package/dist/src/execution/session-activity.js +0 -1
  912. package/dist/src/execution/submit-activity.d.ts +0 -7
  913. package/dist/src/execution/submit-activity.js +0 -1
  914. package/dist/src/execution/task-event-callback.d.ts +0 -12
  915. package/dist/src/execution/task-event-callback.js +0 -1
  916. package/dist/src/execution/task-input-capability.d.ts +0 -4
  917. package/dist/src/execution/task-input-capability.js +0 -1
  918. package/dist/src/execution/task-input-response-route.d.ts +0 -2
  919. package/dist/src/execution/task-input-response-route.js +0 -1
  920. package/dist/src/execution/tasks/child/notify.d.ts +0 -44
  921. package/dist/src/execution/tasks/child/notify.js +0 -1
  922. package/dist/src/execution/tasks/parent/control-shared.d.ts +0 -23
  923. package/dist/src/execution/tasks/parent/control-shared.js +0 -1
  924. package/dist/src/execution/tasks/parent/delegate.d.ts +0 -35
  925. package/dist/src/execution/tasks/parent/delegate.js +0 -1
  926. package/dist/src/execution/tasks/parent/dispatch.d.ts +0 -22
  927. package/dist/src/execution/tasks/parent/dispatch.js +0 -1
  928. package/dist/src/execution/tasks/parent/hitl-proxy-steps.d.ts +0 -27
  929. package/dist/src/execution/tasks/parent/hitl-proxy-steps.js +0 -1
  930. package/dist/src/execution/tasks/parent/run-parent.d.ts +0 -58
  931. package/dist/src/execution/tasks/parent/run-parent.js +0 -1
  932. package/dist/src/execution/tasks/parent/subagent-task-projection.d.ts +0 -26
  933. package/dist/src/execution/tasks/parent/subagent-task-projection.js +0 -1
  934. package/dist/src/execution/tasks/parent/task-cancel.d.ts +0 -12
  935. package/dist/src/execution/tasks/parent/task-cancel.js +0 -1
  936. package/dist/src/execution/tasks/parent/tool-execution.d.ts +0 -45
  937. package/dist/src/execution/tasks/parent/tool-execution.js +0 -1
  938. package/dist/src/execution/terminal-session-event.d.ts +0 -13
  939. package/dist/src/execution/terminal-session-event.js +0 -1
  940. package/dist/src/execution/tools/ask-question-workflow.js +0 -1
  941. package/dist/src/execution/tools/ask-question.d.ts +0 -19
  942. package/dist/src/execution/tools/ask-question.js +0 -2
  943. package/dist/src/execution/tools/connection-search.d.ts +0 -2
  944. package/dist/src/execution/tools/connection-search.js +0 -2
  945. package/dist/src/execution/tools/sleep-workflow.d.ts +0 -3
  946. package/dist/src/execution/tools/sleep-workflow.js +0 -1
  947. package/dist/src/execution/tools/sleep.d.ts +0 -10
  948. package/dist/src/execution/tools/sleep.js +0 -1
  949. package/dist/src/execution/tools/subagent/accept-event-step.d.ts +0 -7
  950. package/dist/src/execution/tools/subagent/accept-event-step.js +0 -1
  951. package/dist/src/execution/tools/subagent/emit-event-step.d.ts +0 -12
  952. package/dist/src/execution/tools/subagent/emit-event-step.js +0 -1
  953. package/dist/src/execution/tools/subagent/invoke-agent.d.ts +0 -42
  954. package/dist/src/execution/tools/subagent/invoke-agent.js +0 -1
  955. package/dist/src/execution/tools/subagent/invoke-preparation.d.ts +0 -44
  956. package/dist/src/execution/tools/subagent/invoke-preparation.js +0 -1
  957. package/dist/src/execution/tools/subagent/invoke-step.d.ts +0 -64
  958. package/dist/src/execution/tools/subagent/invoke-step.js +0 -1
  959. package/dist/src/execution/tools/subagent/receipt-identity.d.ts +0 -11
  960. package/dist/src/execution/tools/subagent/receipt-identity.js +0 -1
  961. package/dist/src/execution/tools/subagent/start.d.ts +0 -51
  962. package/dist/src/execution/tools/subagent/start.js +0 -1
  963. package/dist/src/execution/tools/subagent/steer.d.ts +0 -13
  964. package/dist/src/execution/tools/subagent/steer.js +0 -1
  965. package/dist/src/execution/tools/subagent/task-agent-requests.d.ts +0 -24
  966. package/dist/src/execution/tools/subagent/task-agent-requests.js +0 -1
  967. package/dist/src/execution/tools/subagent/task-cancel.d.ts +0 -10
  968. package/dist/src/execution/tools/subagent/task-cancel.js +0 -1
  969. package/dist/src/execution/tools/tasks.d.ts +0 -3
  970. package/dist/src/execution/tools/tasks.js +0 -1
  971. package/dist/src/execution/tools/workflow/background.js +0 -1
  972. package/dist/src/execution/tools/workflow/workflow-owner-background.d.ts +0 -14
  973. package/dist/src/execution/tools/workflow/workflow-owner-background.js +0 -1
  974. package/dist/src/harness/background-tools.d.ts +0 -45
  975. package/dist/src/harness/background-tools.js +0 -1
  976. package/dist/src/instrumentation/background-task-runtime.d.ts +0 -18
  977. package/dist/src/instrumentation/background-task-runtime.js +0 -1
  978. package/dist/src/node_modules/.pnpm/@vercel_cli-config@0.3.0/node_modules/@vercel/cli-config/dist/index.js +0 -21
  979. package/dist/src/node_modules/.pnpm/@vercel_cli-exec@1.0.1/node_modules/@vercel/cli-exec/dist/envpath.js +0 -1
  980. package/dist/src/node_modules/.pnpm/@vercel_cli-exec@1.0.1/node_modules/@vercel/cli-exec/dist/errors.js +0 -2
  981. package/dist/src/node_modules/.pnpm/@vercel_cli-exec@1.0.1/node_modules/@vercel/cli-exec/dist/errutils.js +0 -1
  982. package/dist/src/node_modules/.pnpm/@vercel_cli-exec@1.0.1/node_modules/@vercel/cli-exec/dist/exec.js +0 -1
  983. package/dist/src/node_modules/.pnpm/@vercel_cli-exec@1.0.1/node_modules/@vercel/cli-exec/dist/fsutils.js +0 -1
  984. package/dist/src/node_modules/.pnpm/@vercel_cli-exec@1.0.1/node_modules/@vercel/cli-exec/dist/index.js +0 -1
  985. package/dist/src/node_modules/.pnpm/@vercel_cli-exec@1.0.1/node_modules/@vercel/cli-exec/dist/lookup.js +0 -1
  986. package/dist/src/node_modules/.pnpm/@vercel_cli-exec@1.0.1/node_modules/@vercel/cli-exec/dist/safety.js +0 -1
  987. package/dist/src/node_modules/.pnpm/@vercel_connect@2.3.3_@ai-sdk_mcp@2.0.52_zod@4.5.4__@auth_core@0.41.2_@chat-adapter_sla_a37674779346d612fa7d2ca9bd316494/node_modules/@vercel/connect/dist/authorization.js +0 -1
  988. package/dist/src/node_modules/.pnpm/@vercel_connect@2.3.3_@ai-sdk_mcp@2.0.52_zod@4.5.4__@auth_core@0.41.2_@chat-adapter_sla_a37674779346d612fa7d2ca9bd316494/node_modules/@vercel/connect/dist/connector.js +0 -1
  989. package/dist/src/node_modules/.pnpm/@vercel_connect@2.3.3_@ai-sdk_mcp@2.0.52_zod@4.5.4__@auth_core@0.41.2_@chat-adapter_sla_a37674779346d612fa7d2ca9bd316494/node_modules/@vercel/connect/dist/index.js +0 -1
  990. package/dist/src/node_modules/.pnpm/@vercel_connect@2.3.3_@ai-sdk_mcp@2.0.52_zod@4.5.4__@auth_core@0.41.2_@chat-adapter_sla_a37674779346d612fa7d2ca9bd316494/node_modules/@vercel/connect/dist/installation.js +0 -1
  991. package/dist/src/node_modules/.pnpm/@vercel_connect@2.3.3_@ai-sdk_mcp@2.0.52_zod@4.5.4__@auth_core@0.41.2_@chat-adapter_sla_a37674779346d612fa7d2ca9bd316494/node_modules/@vercel/connect/dist/internal/base-url.js +0 -1
  992. package/dist/src/node_modules/.pnpm/@vercel_connect@2.3.3_@ai-sdk_mcp@2.0.52_zod@4.5.4__@auth_core@0.41.2_@chat-adapter_sla_a37674779346d612fa7d2ca9bd316494/node_modules/@vercel/connect/dist/internal/default-scopes.js +0 -1
  993. package/dist/src/node_modules/.pnpm/@vercel_connect@2.3.3_@ai-sdk_mcp@2.0.52_zod@4.5.4__@auth_core@0.41.2_@chat-adapter_sla_a37674779346d612fa7d2ca9bd316494/node_modules/@vercel/connect/dist/internal/env.js +0 -1
  994. package/dist/src/node_modules/.pnpm/@vercel_connect@2.3.3_@ai-sdk_mcp@2.0.52_zod@4.5.4__@auth_core@0.41.2_@chat-adapter_sla_a37674779346d612fa7d2ca9bd316494/node_modules/@vercel/connect/dist/internal/url-validation.js +0 -1
  995. package/dist/src/node_modules/.pnpm/@vercel_connect@2.3.3_@ai-sdk_mcp@2.0.52_zod@4.5.4__@auth_core@0.41.2_@chat-adapter_sla_a37674779346d612fa7d2ca9bd316494/node_modules/@vercel/connect/dist/token.js +0 -1
  996. package/dist/src/node_modules/.pnpm/@vercel_oidc@3.8.9/node_modules/@vercel/oidc/dist/auth-errors.js +0 -1
  997. package/dist/src/node_modules/.pnpm/@vercel_oidc@3.8.9/node_modules/@vercel/oidc/dist/exchange-vercel-oidc-token.js +0 -1
  998. package/dist/src/node_modules/.pnpm/@vercel_oidc@3.8.9/node_modules/@vercel/oidc/dist/get-context.js +0 -1
  999. package/dist/src/node_modules/.pnpm/@vercel_oidc@3.8.9/node_modules/@vercel/oidc/dist/get-vercel-oidc-token-sync.js +0 -1
  1000. package/dist/src/node_modules/.pnpm/@vercel_oidc@3.8.9/node_modules/@vercel/oidc/dist/get-vercel-oidc-token-with-refresh.js +0 -2
  1001. package/dist/src/node_modules/.pnpm/@vercel_oidc@3.8.9/node_modules/@vercel/oidc/dist/index.js +0 -1
  1002. package/dist/src/node_modules/.pnpm/@vercel_oidc@3.8.9/node_modules/@vercel/oidc/dist/oauth.js +0 -1
  1003. package/dist/src/node_modules/.pnpm/@vercel_oidc@3.8.9/node_modules/@vercel/oidc/dist/token-error.js +0 -1
  1004. package/dist/src/node_modules/.pnpm/@vercel_oidc@3.8.9/node_modules/@vercel/oidc/dist/token-io.js +0 -1
  1005. package/dist/src/node_modules/.pnpm/@vercel_oidc@3.8.9/node_modules/@vercel/oidc/dist/token-util.js +0 -2
  1006. package/dist/src/node_modules/.pnpm/@vercel_oidc@3.8.9/node_modules/@vercel/oidc/dist/token.js +0 -1
  1007. package/dist/src/node_modules/.pnpm/@vercel_oidc@3.8.9/node_modules/@vercel/oidc/dist/verify-vercel-oidc-token.js +0 -1
  1008. package/dist/src/node_modules/.pnpm/@vercel_oidc@3.8.9/node_modules/@vercel/oidc/dist/version.js +0 -1
  1009. package/dist/src/node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/index.js +0 -1
  1010. package/dist/src/node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/enoent.js +0 -1
  1011. package/dist/src/node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/parse.js +0 -1
  1012. package/dist/src/node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/util/escape.js +0 -1
  1013. package/dist/src/node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/util/readShebang.js +0 -1
  1014. package/dist/src/node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/util/resolveCommand.js +0 -1
  1015. package/dist/src/node_modules/.pnpm/execa@5.1.1/node_modules/execa/index.js +0 -1
  1016. package/dist/src/node_modules/.pnpm/execa@5.1.1/node_modules/execa/lib/command.js +0 -1
  1017. package/dist/src/node_modules/.pnpm/execa@5.1.1/node_modules/execa/lib/error.js +0 -2
  1018. package/dist/src/node_modules/.pnpm/execa@5.1.1/node_modules/execa/lib/kill.js +0 -1
  1019. package/dist/src/node_modules/.pnpm/execa@5.1.1/node_modules/execa/lib/promise.js +0 -1
  1020. package/dist/src/node_modules/.pnpm/execa@5.1.1/node_modules/execa/lib/stdio.js +0 -1
  1021. package/dist/src/node_modules/.pnpm/execa@5.1.1/node_modules/execa/lib/stream.js +0 -1
  1022. package/dist/src/node_modules/.pnpm/get-stream@6.0.1/node_modules/get-stream/buffer-stream.js +0 -1
  1023. package/dist/src/node_modules/.pnpm/get-stream@6.0.1/node_modules/get-stream/index.js +0 -1
  1024. package/dist/src/node_modules/.pnpm/human-signals@2.1.0/node_modules/human-signals/build/src/core.js +0 -1
  1025. package/dist/src/node_modules/.pnpm/human-signals@2.1.0/node_modules/human-signals/build/src/main.js +0 -1
  1026. package/dist/src/node_modules/.pnpm/human-signals@2.1.0/node_modules/human-signals/build/src/realtime.js +0 -1
  1027. package/dist/src/node_modules/.pnpm/human-signals@2.1.0/node_modules/human-signals/build/src/signals.js +0 -1
  1028. package/dist/src/node_modules/.pnpm/is-stream@2.0.1/node_modules/is-stream/index.js +0 -1
  1029. package/dist/src/node_modules/.pnpm/isexe@2.0.0/node_modules/isexe/index.js +0 -1
  1030. package/dist/src/node_modules/.pnpm/isexe@2.0.0/node_modules/isexe/mode.js +0 -1
  1031. package/dist/src/node_modules/.pnpm/isexe@2.0.0/node_modules/isexe/windows.js +0 -1
  1032. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/index.js +0 -1
  1033. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/jwe/compact/decrypt.js +0 -1
  1034. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/jwe/compact/encrypt.js +0 -1
  1035. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/jwe/flattened/decrypt.js +0 -1
  1036. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/jwe/flattened/encrypt.js +0 -1
  1037. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/jwe/general/decrypt.js +0 -1
  1038. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/jwe/general/encrypt.js +0 -1
  1039. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/jwk/embedded.js +0 -1
  1040. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/jwk/thumbprint.js +0 -1
  1041. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/jwks/local.js +0 -1
  1042. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/jwks/remote.js +0 -1
  1043. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/jws/compact/sign.js +0 -1
  1044. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/jws/compact/verify.js +0 -1
  1045. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/jws/flattened/sign.js +0 -1
  1046. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/jws/flattened/verify.js +0 -1
  1047. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/jws/general/sign.js +0 -1
  1048. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/jws/general/verify.js +0 -1
  1049. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/jwt/decrypt.js +0 -1
  1050. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/jwt/encrypt.js +0 -1
  1051. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/jwt/produce.js +0 -1
  1052. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/jwt/sign.js +0 -1
  1053. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/jwt/unsecured.js +0 -1
  1054. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/jwt/verify.js +0 -1
  1055. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/key/export.js +0 -1
  1056. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/key/generate_key_pair.js +0 -1
  1057. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/key/generate_secret.js +0 -1
  1058. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/key/import.js +0 -1
  1059. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/lib/aesgcmkw.js +0 -1
  1060. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/lib/buffer_utils.js +0 -1
  1061. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/lib/cek.js +0 -1
  1062. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/lib/check_iv_length.js +0 -1
  1063. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/lib/check_key_type.js +0 -1
  1064. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/lib/check_p2s.js +0 -1
  1065. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/lib/crypto_key.js +0 -1
  1066. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/lib/decrypt_key_management.js +0 -1
  1067. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/lib/encrypt_key_management.js +0 -1
  1068. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/lib/epoch.js +0 -1
  1069. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/lib/invalid_key_input.js +0 -1
  1070. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/lib/is_disjoint.js +0 -1
  1071. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/lib/is_jwk.js +0 -1
  1072. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/lib/is_object.js +0 -1
  1073. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/lib/iv.js +0 -1
  1074. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/lib/jwt_claims_set.js +0 -1
  1075. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/lib/private_symbols.js +0 -1
  1076. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/lib/secs.js +0 -1
  1077. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/lib/validate_algorithms.js +0 -1
  1078. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/lib/validate_crit.js +0 -1
  1079. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/runtime/aeskw.js +0 -1
  1080. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/runtime/asn1.js +0 -1
  1081. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/runtime/base64url.js +0 -1
  1082. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/runtime/cbc_tag.js +0 -1
  1083. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/runtime/check_cek_length.js +0 -1
  1084. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/runtime/check_key_length.js +0 -1
  1085. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/runtime/ciphers.js +0 -1
  1086. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/runtime/decrypt.js +0 -1
  1087. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/runtime/digest.js +0 -1
  1088. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/runtime/dsa_digest.js +0 -1
  1089. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/runtime/ecdhes.js +0 -1
  1090. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/runtime/encrypt.js +0 -1
  1091. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/runtime/fetch_jwks.js +0 -1
  1092. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/runtime/generate.js +0 -1
  1093. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/runtime/get_named_curve.js +0 -1
  1094. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/runtime/get_sign_verify_key.js +0 -1
  1095. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/runtime/hmac_digest.js +0 -1
  1096. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/runtime/is_key_like.js +0 -1
  1097. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/runtime/is_key_object.js +0 -1
  1098. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/runtime/jwk_to_key.js +0 -1
  1099. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/runtime/key_to_jwk.js +0 -1
  1100. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/runtime/node_key.js +0 -1
  1101. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/runtime/normalize_key.js +0 -1
  1102. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/runtime/pbes2kw.js +0 -1
  1103. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/runtime/random.js +0 -1
  1104. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/runtime/rsaes.js +0 -1
  1105. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/runtime/runtime.js +0 -1
  1106. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/runtime/sign.js +0 -1
  1107. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/runtime/timing_safe_equal.js +0 -1
  1108. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/runtime/verify.js +0 -1
  1109. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/runtime/webcrypto.js +0 -1
  1110. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/util/base64url.js +0 -1
  1111. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/util/decode_jwt.js +0 -1
  1112. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/util/decode_protected_header.js +0 -1
  1113. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/util/errors.js +0 -1
  1114. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/util/runtime.js +0 -1
  1115. package/dist/src/node_modules/.pnpm/merge-stream@2.0.0/node_modules/merge-stream/index.js +0 -1
  1116. package/dist/src/node_modules/.pnpm/mimic-fn@2.1.0/node_modules/mimic-fn/index.js +0 -1
  1117. package/dist/src/node_modules/.pnpm/npm-run-path@4.0.1/node_modules/npm-run-path/index.js +0 -1
  1118. package/dist/src/node_modules/.pnpm/onetime@5.1.2/node_modules/onetime/index.js +0 -1
  1119. package/dist/src/node_modules/.pnpm/path-key@3.1.1/node_modules/path-key/index.js +0 -1
  1120. package/dist/src/node_modules/.pnpm/shebang-command@2.0.0/node_modules/shebang-command/index.js +0 -1
  1121. package/dist/src/node_modules/.pnpm/shebang-regex@3.0.0/node_modules/shebang-regex/index.js +0 -1
  1122. package/dist/src/node_modules/.pnpm/signal-exit@3.0.7/node_modules/signal-exit/index.js +0 -1
  1123. package/dist/src/node_modules/.pnpm/signal-exit@3.0.7/node_modules/signal-exit/signals.js +0 -1
  1124. package/dist/src/node_modules/.pnpm/strip-final-newline@2.0.0/node_modules/strip-final-newline/index.js +0 -2
  1125. package/dist/src/node_modules/.pnpm/which@2.0.2/node_modules/which/which.js +0 -1
  1126. package/dist/src/protocol/activity.d.ts +0 -112
  1127. package/dist/src/protocol/activity.js +0 -1
  1128. package/dist/src/protocol/agent-handle-error.d.ts +0 -13
  1129. package/dist/src/protocol/agent-handle-error.js +0 -1
  1130. package/dist/src/public/channels/slack/activity-plan.d.ts +0 -5
  1131. package/dist/src/public/channels/slack/activity-plan.js +0 -1
  1132. package/dist/src/public/channels/slack/activity.d.ts +0 -63
  1133. package/dist/src/public/channels/slack/activity.js +0 -2
  1134. package/dist/src/public/nuxt/dev-server.d.ts +0 -25
  1135. package/dist/src/public/nuxt/dev-server.js +0 -1
  1136. package/dist/src/public/tools/connection-search.d.ts +0 -1
  1137. package/dist/src/public/tools/connection-search.js +0 -1
  1138. package/dist/src/public/tools/task-cancel.d.ts +0 -1
  1139. package/dist/src/public/tools/task-cancel.js +0 -1
  1140. package/dist/src/runtime/prompt/connections.d.ts +0 -9
  1141. package/dist/src/runtime/prompt/connections.js +0 -2
  1142. package/dist/src/shared/empty-delivery.d.ts +0 -3
  1143. package/dist/src/shared/empty-delivery.js +0 -1
  1144. package/dist/src/subagents/agent-handle-errors.d.ts +0 -25
  1145. package/dist/src/subagents/agent-handle-errors.js +0 -1
  1146. package/dist/src/subagents/callback-step.d.ts +0 -11
  1147. package/dist/src/subagents/callback-step.js +0 -1
  1148. package/dist/src/subagents/continuation-bundle.d.ts +0 -13
  1149. package/dist/src/subagents/continuation-bundle.js +0 -1
  1150. package/dist/src/subagents/handle-dispatch.d.ts +0 -65
  1151. package/dist/src/subagents/handle-dispatch.js +0 -1
  1152. package/dist/src/subagents/handles/operation-id.d.ts +0 -15
  1153. package/dist/src/subagents/handles/operation-id.js +0 -1
  1154. package/dist/src/subagents/handles/prompt.d.ts +0 -52
  1155. package/dist/src/subagents/handles/prompt.js +0 -3
  1156. package/dist/src/subagents/handles/query.d.ts +0 -41
  1157. package/dist/src/subagents/handles/query.js +0 -1
  1158. package/dist/src/subagents/handles/state-key.d.ts +0 -8
  1159. package/dist/src/subagents/handles/state-key.js +0 -1
  1160. package/dist/src/subagents/handles/store.d.ts +0 -217
  1161. package/dist/src/subagents/handles/store.js +0 -1
  1162. package/dist/src/subagents/handles/transitions.d.ts +0 -103
  1163. package/dist/src/subagents/handles/transitions.js +0 -1
  1164. package/dist/src/subagents/remote-dispatch.js +0 -1
  1165. package/dist/src/subagents/start-local.d.ts +0 -29
  1166. package/dist/src/subagents/start-local.js +0 -1
  1167. package/dist/src/subagents/start-remote.d.ts +0 -21
  1168. package/dist/src/subagents/start-remote.js +0 -1
  1169. package/dist/src/tasks/delivery-context.d.ts +0 -32
  1170. package/dist/src/tasks/delivery-context.js +0 -4
  1171. package/dist/src/tasks/delivery-policy.d.ts +0 -14
  1172. package/dist/src/tasks/delivery-policy.js +0 -1
  1173. package/dist/src/tasks/json.d.ts +0 -88
  1174. package/dist/src/tasks/json.js +0 -1
  1175. package/dist/src/tasks/notification.d.ts +0 -10
  1176. package/dist/src/tasks/notification.js +0 -1
  1177. package/dist/src/tasks/task-id.d.ts +0 -31
  1178. package/dist/src/tasks/task-id.js +0 -1
  1179. package/dist/src/tasks/task-inbox-token.d.ts +0 -2
  1180. package/dist/src/tasks/task-inbox-token.js +0 -1
  1181. package/dist/src/tasks/transitions.d.ts +0 -17
  1182. package/dist/src/tasks/transitions.js +0 -1
  1183. package/dist/src/tasks/types.d.ts +0 -138
  1184. package/dist/src/tasks/types.js +0 -1
  1185. package/dist/src/tools/framework/connection-search.d.ts +0 -3
  1186. package/dist/src/tools/framework/connection-search.js +0 -1
  1187. package/dist/src/tools/framework/task-cancel.d.ts +0 -4
  1188. package/dist/src/tools/framework/task-cancel.js +0 -1
  1189. package/dist/src/tools/framework/task-contract.d.ts +0 -19
  1190. package/dist/src/tools/framework/task-contract.js +0 -1
  1191. package/dist/src/tools/native-definition.d.ts +0 -7
  1192. package/dist/src/tools/native-definition.js +0 -1
  1193. package/dist/src/tracing/agent-invocation-terminal.d.ts +0 -18
  1194. package/dist/src/tracing/agent-invocation-terminal.js +0 -1
  1195. /package/dist/src/execution/{tools/subagent → agent-sessions}/metadata.d.ts +0 -0
  1196. /package/dist/src/execution/{tools/subagent → agent-sessions}/metadata.js +0 -0
@@ -1,13 +1,10 @@
1
- import{buildAgentHeader}from"./agent-header.js";import{PROMPT_COMMANDS,isPromptControlCommand,parsePromptCommand,promptCommandSpec}from"./prompt-commands.js";import{argumentTypeaheadCompletion,argumentTypeaheadFor,argumentTypeaheadLoadingLabel,argumentTypeaheadQuery,moveArgumentTypeaheadSelection,renderArgumentSuggestions,selectedArgumentSuggestion}from"./argument-typeahead.js";import{detectMarkdownRendering}from"./markdown.js";import{renderAttentionRows,renderBlockLines}from"./blocks.js";import{copyTextToClipboard}from"./clipboard.js";import{dismissTypeahead,inlineCommandHint,isTypeaheadOpen,moveTypeaheadSelection,renderCommandSuggestions,selectedTypeaheadCommand,typeaheadCompletion,typeaheadFor}from"./command-typeahead.js";import{formatDevRebuildStatus,summarizeChangedFiles}from"./dev-rebuild-status.js";import{formatStoredDiagnostic,presentDiagnostic}from"./diagnostic-presentation.js";import{interruptedError}from"./errors.js";import{FileContentCache}from"./file-content-cache.js";import{EMPTY_LINE,KillRing,PromptHistory,applyLineEditorKey,deleteForward,layoutPromptInput,lineOf,movePromptLine,visibleLine}from"./line-editor.js";import{enterBadge,flowMessageRows,renderAcknowledgeQuestion,renderSelectQuestion,renderTextQuestion}from"./setup-panel.js";import{renderFlowDrawer,renderTransientDrawer}from"./flow-drawer.js";import{nextLogDisplayMode}from"./log-display-mode.js";import{MessageQueue,renderMessageQueueRows}from"./message-queue.js";import{initialProviderPickerState,transitionProviderPicker}from"./provider-picker.js";import{renderQuestionChoices,renderQuestionPanel}from"./question-panel.js";import{formatAssistantResponseStats,formatTokenFlow,formatTurnDuration,isIncompleteOsc,isIncompletePaste,nextKey,sanitizePastedText,stripPasteStart,stripPromptControlCharacters,takeUntil}from"./stream-format.js";import{TraceViewerSession}from"./traces/trace-viewer-session.js";import{buildStatusLine}from"./status-line.js";import{createTheme,detectUnicode}from"./theme.js";import{isPanelRoutedTool,presentPreparingTool,presentTool,readWriteFileInput,toolBaseName}from"./tool-presentation.js";import{groupToolBlocksForDisplay}from"./tool-block-groups.js";import{TurnClock}from"./turn-clock.js";import{reduceSetupSelectInput,setupSelectionIntent}from"./setup-selection-input.js";import{BACKGROUND_COLOR_QUERY,parseBackgroundColorReply}from"./terminal-background.js";import{inspectError}from"#internal/logging.js";import{eveVersionTag}from"#cli/banner.js";import{clipVisible,renderInputText,renderInputWithBlockCursor,stripAnsi,stripTerminalControls,wrapVisibleLine}from"#cli/ui/terminal-text.js";import{initialSelectState,orderedSelection,reduceSelect,searchActionQuery,selectValueAtCursor}from"#setup/cli/select-state.js";import{toErrorMessage}from"#shared/errors.js";import{StringDecoder}from"node:string_decoder";import{summarizeKnownError}from"#harness/semantic-errors/index.js";import{parseDevRebuildLogLine}from"#internal/nitro/host/dev-watcher-log.js";import{LiveRegion}from"#cli/ui/live-region.js";import{AltScreen}from"#cli/ui/alt-screen.js";import{PROGRESS_PULSE_ASCII_GLYPH,PROGRESS_PULSE_GLYPH,isProgressPulseVisible}from"#cli/ui/progress-pulse.js";import{readGatewayServiceTier}from"#shared/gateway-service-tier.js";function isMultiSelectRequest(e){return e.kind===`multi`||e.kind===`searchable-multi`}function moveActionCursor(e,t,n){return n===0?void 0:e===void 0?t===`down`?0:n-1:(e+(t===`down`?1:-1)+n)%n}function completedTurnStatus(e){return e.interrupted?`Interrupted`:e.cancelled?`Cancelled`:e.continueSession?`Ready`:`Done`}function turnActivityLabel(e){return e===void 0?`Thinking`:e.runningTools.size>0?`Running`:e.modelActivity}function updateTurnActivity(e,t){switch(t.type){case`turn-start`:case`step-start`:case`reasoning-delta`:e.modelActivity=`Thinking`;break;case`assistant-delta`:case`tool-call-preparing`:e.modelActivity=`Generating`;break;case`assistant-complete`:t.text?.trim()&&(e.modelActivity=`Generating`);break;case`tool-call`:e.runningTools.add(t.toolCallId),e.modelActivity=`Thinking`;break;case`tool-result`:case`tool-error`:case`tool-rejected`:e.runningTools.delete(t.toolCallId)}}const incompletePasteFlushMs=1e3,STATUS={processing:`Thinking`,connectionAuth:`Waiting for connection authorization…`};var TerminalRenderer=class{#e;#t;#n;#r;#i;#a;#o;#s;#c;#l;#u;#d;#f;#p;#m;#h=[];#g=new Map;#_;#v=new Set;#y=[];#b=new Set;#x=new Map;#S=0;#C=new Map;#w=new Set;#T=new Set;#E=new FileContentCache;#D=new Set;#O;#k;#A;#j;#M=0;#N;#P=!1;#F;#I=[];#L;#R=0;#z;#B;#V=``;#H=0;#U=new PromptHistory;#W=new KillRing;#G=!1;#K;#q;#J;#Y=new Map;#X=new Map;#Z=!1;#Q=!1;#$=new TurnClock;#ee;#te=EMPTY_LINE;#ne=!1;#re={kind:`idle`};#ie;#ae=STATUS.processing;#oe;#se=`eve`;#ce=!1;#le=!1;#ue=!1;#de=!1;#fe=!1;#pe=!1;#me=!1;#he;#ge=!0;#_e=0;#ve=Date.now();#ye;#be;#xe;#Se=!1;#Ce;#we=``;#Te=new StringDecoder(`utf8`);#Ee;#De;#Oe;#ke=!1;#Ae=!1;#je;#Me;#Ne;#Pe;#Fe;#Ie;#Le;#Re=``;#ze=``;#Be;#Ve;#He;#Ue=!1;#We;#Ge=0;#Ke;#qe;#Je;#Ye;#Xe;#Ze;#Qe;#$e;#et=new MessageQueue;#tt;#nt;#rt=!1;#it;#at;#ot=!1;#st;#ct;#lt;#ut;#dt;setupFlow={begin:e=>this.#wt(e),setNavigation:e=>this.#Tt(e),end:e=>this.#Et(e?.preserveDiagnostics??!0),readSelect:e=>this.#Dt(e),readEditableSelect:e=>this.#kt(e),readProviderPicker:e=>this.#At(e),readText:e=>this.#jt(e),readAcknowledge:e=>this.#Mt(e),readChoice:e=>this.#Ot(e),setStatus:e=>this.#Bt(e),renderLine:(e,t)=>this.#Vt(e,t),replaceContent:e=>this.#Ht(e),renderOutput:e=>this.#Ut(e),withInheritedStdio:e=>this.#Wt(e),withExclusiveTerminal:e=>this.#Wt(e),waitForInterrupt:e=>this.#Lt(e)};traceViewer={open:e=>this.#Kt(e)};constructor(e){this.#e=e?.input??process.stdin,this.#t=e?.output??process.stdout,this.#n=new LiveRegion(this.#t),this.#r=new AltScreen(this.#t),this.#i=createTheme({color:e?.color??!0,unicode:e?.unicode??detectUnicode()}),this.#a=e?.renderMarkdown??detectMarkdownRendering(),this.#o=e?.tools??`auto-collapsed`,this.#s=e?.reasoning??`auto-collapsed`,this.#c=e?.subagents??`auto-collapsed`,this.#l=e?.connectionAuth??`full`,this.#u=e?.assistantResponseStats??`tokensPerSecond`,this.#Ne=e?.contextSize,this.#d=e?.captureForeignOutput??this.#t===process.stdout,this.#f=e?.diagnostics,this.#he=e?.onExitRequest,this.#J=e?.argumentSuggestions,this.#m=e?.logs??`none`,this.#p=e?.availablePromptCommands??PROMPT_COMMANDS}#ft(e){this.#K=typeaheadFor(this.#p,e,this.#K);let t=argumentTypeaheadQuery(e);if(t===void 0||this.#J===void 0){this.#q=void 0;return}let n=this.#Y.get(t.command);if(n===void 0){this.#Y.set(t.command,{kind:`loading`,visible:!1});let e=t.command;this.#X.set(e,setTimeout(()=>{this.#X.delete(e),this.#Y.get(e)?.kind===`loading`&&(this.#Y.set(e,{kind:`loading`,visible:!0}),this.#zn())},500)),this.#J(e).catch(()=>[]).then(t=>{let n=this.#X.get(e);n!==void 0&&clearTimeout(n),this.#X.delete(e),this.#Y.set(e,{kind:`ready`,suggestions:t}),this.#G&&this.#ft(this.#V),this.#zn()}),this.#q=void 0;return}if(n.kind===`loading`){this.#q=void 0;return}this.#q=argumentTypeaheadFor(t,n.suggestions,this.#q)}#pt(e){let t=argumentTypeaheadQuery(this.#V),n=t===void 0?void 0:this.#Y.get(t.command);return n?.kind===`loading`&&n.visible&&t!==void 0?[clip(this.#i.colors.dim(`Loading ${argumentTypeaheadLoadingLabel(t.command)}…`),e)]:this.#q===void 0?(this.#K===void 0?void 0:inlineCommandHint(this.#K))===void 0&&this.#K!==void 0&&isTypeaheadOpen(this.#K)?renderCommandSuggestions(this.#K,this.#i,e):[]:renderArgumentSuggestions(this.#q,this.#i,e)}setStartupPhase(e){this.#k=e,e===void 0?this.#pn():this.#dn(),this.#zn()}renderAgentHeader(e){this.#N=void 0,this.#se=e.name,(this.#O?.info?.agent.model.routing.kind!==`dynamic`||e.info?.agent.model.routing.kind!==`dynamic`)&&(this.#Qe=void 0),this.#O=e,this.#Yt();let t=this.#Wn().join(`
2
- `);if(this.#P){t!==this.#F&&(this.#F=t,this.#_n({kind:`agent-header`,body:t,live:!1})),this.#zn();return}this.#P=!0,this.#F=t,this.#n.flush(this.#Wn(),this.#Yn(this.#rr()))}beginStartupDraft(e){this.#Yt({title:e.title}),this.#G=!0,this.#Z=!0,this.#k=`starting`,this.#N={name:e.title},this.#M=Date.now();let t=lineOf(stripPromptControlCharacters(e.initialDraft??``));this.#A=t,this.#ht(t),this.#cn(),this.#dn(),this.#zn();let apply=e=>{t=e,this.#A=e,this.#un(),this.#ht(t),this.#zn()};this.#j=e=>{if(e.type===`escape`&&this.#ct!==void 0){this.#ct(`escape`);return}if(e.type===`ctrl-c`&&this.#ct!==void 0){this.#Gt(),this.#ct(`ctrl-c`);return}let n=this.#W.apply(t,e,{multiline:!0});if(n!==void 0){apply(n);return}if(e.type===`enter`&&t.text.trim().length>0){this.#et.enqueue(t.text)&&apply(EMPTY_LINE);return}e.type===`ctrl-c`&&this.#he?.()},this.#mt()}#mt(){this.#A!==void 0&&this.#j!==void 0&&(this.#an(),this.#ht(this.#A),this.#G=!0,this.#Ce=this.#j,this.#Qt())}finishStartupDraft(){let e={draft:this.#A?.text??this.#V,queuedPrompt:this.#et.takePrompt()};return this.#A=void 0,this.#j=void 0,this.#$t(),this.#ln(),this.#G=!1,this.#Z=!1,e}async readPrompt(e){this.#Yt(e),this.#gn(),this.#yn(),this.#G=!0,this.#Z=!0,this.#re={kind:`idle`},this.#ae=``,this.#pe=this.#me,this.#me=!1;let t=this.#et.restoreDraft()?.split(`
3
- `).map(stripPromptControlCharacters).join(`
4
- `),n=stripPromptControlCharacters(e?.initialDraft??this.#te.text),r=t===void 0?n:n.length===0?t:`${t}\n\n${n}`,i=lineOf(r);return this.#te=EMPTY_LINE,this.#U.begin(i.text),this.#ht(i),this.#ft(i.text),this.#cn(),this.#zn(),await new Promise((e,t)=>{this.#ie=t;let apply=e=>{i=e,this.#un(),this.#ht(i),this.#ft(e.text),this.#zn()},recall=e=>{e!==void 0&&apply(lineOf(e))},interrupt=()=>{this.#K=void 0,this.#ln(),this.#Zt(),t(interruptedError())},suggestions=()=>this.#K!==void 0&&isTypeaheadOpen(this.#K)?this.#K:void 0,argumentSuggestions=()=>this.#q?.suggestions.length?this.#q:void 0,highlighted=()=>{let e=suggestions();return e===void 0?void 0:selectedTypeaheadCommand(e)};this.#Ce=t=>{t.type!==`ctrl-c`&&this.#pe&&(this.#pe=!1,this.#zn());let n=this.#W.apply(i,t,{multiline:!0});if(n!==void 0){apply(n);return}switch(t.type){case`up`:case`ctrl-p`:{let e=argumentSuggestions();if(e!==void 0){this.#q=moveArgumentTypeaheadSelection(e,-1),this.#zn();break}let t=suggestions();if(t!==void 0){this.#K=moveTypeaheadSelection(t,-1),this.#zn();break}let n=movePromptLine(i,`up`);n===void 0?recall(this.#U.previous(i.text)):apply(n);break}case`down`:case`ctrl-n`:{let e=argumentSuggestions();if(e!==void 0){this.#q=moveArgumentTypeaheadSelection(e,1),this.#zn();break}let t=suggestions();if(t!==void 0){this.#K=moveTypeaheadSelection(t,1),this.#zn();break}let n=movePromptLine(i,`down`);n===void 0?recall(this.#U.next()):apply(n);break}case`tab`:{let e=argumentSuggestions(),t=e===void 0?void 0:selectedArgumentSuggestion(e);if(e!==void 0&&t!==void 0){apply(lineOf(argumentTypeaheadCompletion(e,t)));break}let n=highlighted();n!==void 0&&apply(lineOf(typeaheadCompletion(n)));break}case`escape`:{if(this.#q!==void 0){this.#q=void 0,this.#zn();break}let e=suggestions();e!==void 0&&(this.#K=dismissTypeahead(e),this.#zn());break}case`enter`:{let t=argumentSuggestions(),n=t===void 0?void 0:selectedArgumentSuggestion(t),r=highlighted();if(t!==void 0&&n?.next!==void 0&&t.completed.length===0){apply(lineOf(`${argumentTypeaheadCompletion(t,n)} `));break}if(t===void 0&&r!==void 0&&this.#J!==void 0&&(r.name===`add`||r.name===`login`||r.name===`loglevel`||r.name===`model`)){apply(lineOf(typeaheadCompletion(r)));break}let a=t!==void 0&&n!==void 0?argumentTypeaheadCompletion(t,n):r!==void 0&&parsePromptCommand(i.text)===null?typeaheadCompletion(r).trimEnd():i.text;if(a.trim().length===0)break;this.#K=void 0,this.#q=void 0,promptCommandSpec(a)?.spec.history!==`omit`&&this.#U.add(a),this.#G=!1,this.#ln(),this.#ae=STATUS.processing,isPromptControlCommand(a)?this.#St(stripTerminalControls(a.trim())):(this.#fn(),this.#vn(a),this.#Ke=a,this.#$.arm()),this.#ht(EMPTY_LINE),this.#zn(),this.#$t(),e(a);break}case`ctrl-d`:i.text.length===0?(this.#Gt(),interrupt()):apply(deleteForward(i));break;case`ctrl-l`:this.#Hn();break;case`ctrl-r`:this.#zn();break;case`ctrl-c`:if(this.#pe){this.#Gt(),interrupt();break}this.#pe=!0,apply(EMPTY_LINE)}},this.#Qt()})}#ht(e){this.#V=e.text,this.#H=e.cursor}takeQueuedPrompt(){let e=this.#et.view().steering,t=this.#et.takePrompt();return t!==void 0&&(this.#at=e?`steer`:`queue`),t}async renderStream(e,t){this.#Yt(t),this.#v.clear(),this.#G=!1,this.#re.kind!==`waiting`&&(this.#re={kind:`waiting`,startedAtMs:Date.now()}),this.#ae=this.#R>0?STATUS.connectionAuth:STATUS.processing,this.#bn(t?.submittedPrompt),t?.submittedPrompt!==void 0&&this.#f?.recordPrompt(),t?.submittedPrompt!==void 0&&!this.#$.armed&&this.#$.arm(),this.#de=!1,this.#rt=!1,this.#ot=!1,this.#st=t?.submittedPrompt,this.#et.beginTurn(),this.#tt=e.cancel,this.#nt=e.steer,this.#je=void 0,this.#Me=void 0,this.#Pe=void 0,this.#Fe=void 0,this.#Ie=Date.now();let n={text:new Map,reasoning:new Map,tools:new Map,modelActivity:`Thinking`,runningTools:new Set,cancelled:!1,restoreCancelledPrompt:!0};this.#ee=n;let r={tools:t?.tools??this.#o,reasoning:t?.reasoning??this.#s,assistantResponseStats:t?.assistantResponseStats??this.#u};this.#dn(),this.#ne=!0,this.#zn();let i=new Promise(e=>{this.#Oe=e});this.#Ce=e=>this.#on(e),this.#Qt();try{for await(let t of takeUntil(iterateTUIStream(e.events),i)){if(this.#de)break;this.#On(t,r,n)}}catch(e){let t=summarizeKnownError(e);t===null?this.#xn(`Error`,toErrorMessage(e),{detail:inspectError(e)}):this.#xn(t.name,t.message,{detail:inspectError(e),hint:t.hint})}finally{this.#Oe=void 0,this.#de&&e.abort?.(),this.#tt=void 0,this.#nt=void 0,this.#$t(),this.#ne=!1,this.#ee=void 0,this.#re.kind===`waiting`&&(this.#re={kind:`idle`}),this.#gn(),this.#ae=completedTurnStatus({interrupted:this.#de,cancelled:this.#rt,continueSession:t?.continueSession===!0}),this.#Fn(n),(this.#de||n.cancelled)&&this.#Pn(n),this.#Dn(),this.#gn(),this.#f?.reportStats(),this.#zn(),t?.continueSession||this.#Zt()}}async renderIdleStream(e,t){let n={tools:t?.tools??this.#o,reasoning:t?.reasoning??this.#s,assistantResponseStats:t?.assistantResponseStats??this.#u},r={text:new Map,reasoning:new Map,tools:new Map,modelActivity:`Thinking`,runningTools:new Set,cancelled:!1,restoreCancelledPrompt:!1};try{for await(let t of iterateTUIStream(e.events))this.#On(t,n,r)}catch(e){let t=summarizeKnownError(e);t===null?this.#xn(`Error`,toErrorMessage(e),{detail:inspectError(e)}):this.#xn(t.name,t.message,{detail:inspectError(e),hint:t.hint})}finally{this.#Fn(r),r.cancelled&&this.#Pn(r),this.#Dn(),this.#gn(),this.#f?.reportStats(),this.#zn()}}async readToolApproval(e,t){this.#Yt(t),this.#pn(),this.#G=!1,this.#re={kind:`idle`},this.#de=!1;let n=0;return this.#qe=t=>renderTransientDrawer([` ${this.#i.colors.bold(`Approve ${formatToolApprovalTitle(e)}?`)}`,``,...renderQuestionChoices([{id:`yes`,label:`Yes`},{id:`no`,label:`No`}],n,this.#i)],[`y yes · n no · Ctrl-C cancel`],this.#i,t),this.#zn(),await new Promise((t,r)=>{let approve=()=>{this.#qe=void 0,this.#fn(),this.#ae=STATUS.processing,this.#$t(),this.#zn(),t({approved:!0})},deny=()=>{this.#qe=void 0,this.#fn(),this.#ae=STATUS.processing,this.#_t(e.toolCallId),this.#$t(),this.#zn(),t({approved:!1,reason:`Denied by user.`})};this.#ie=r,this.#Ce=e=>{switch(e.type){case`text`:{if(e.framing!==`unframed`)break;let t=e.value.toLowerCase();t===`y`?approve():t===`n`&&deny();break}case`up`:case`ctrl-p`:n=0,this.#zn();break;case`down`:case`ctrl-n`:n=1,this.#zn();break;case`enter`:n===0?approve():deny();break;case`ctrl-r`:this.#zn();break;case`ctrl-c`:this.#de=!0,this.#qe=void 0,this.#Zt(),r(interruptedError())}},this.#Qt()})}async readInputQuestion(e,t){this.#Yt(t),this.#pn(),this.#G=!1,this.#Z=!1,this.#re={kind:`idle`},this.#de=!1;let n=e.options??[],r=n.length>0,i=(e.allowFreeform===!0||!r)&&r,a=n.length+ +!!i,o=questionSectionId(e.requestId),s=r?`select`:`text`,c=0,l=EMPTY_LINE,isOnFreeformRow=()=>i&&c===n.length,selectDrawer=t=>renderTransientDrawer(renderQuestionPanel({prompt:stripTerminalControls(e.prompt),options:n,cursor:c,allowFreeform:i,editor:l,caretVisible:this.#ge},this.#i,t),[`↑/↓ move · enter to select · esc to dismiss`],this.#i,t),textPanel=t=>{let n=promptInputRows({text:l.text,cursor:l.cursor,width:Math.max(1,t-2),theme:this.#i,caretVisible:this.#ge,ghost:``,maxRows:3});return n.at(-1)===``&&n.pop(),renderTransientDrawer([` ${this.#i.colors.bold(stripTerminalControls(e.prompt))}`,``,...n.map(e=>` ${e}`)],[`Enter submit · Esc dismiss`],this.#i,t)},syncFreeformCaret=()=>{isOnFreeformRow()?this.#cn():(this.#ln(),this.#un())};s===`select`?(s=`select`,this.#G=!1,this.#Tn(o),this.#qe=selectDrawer,this.#ae=``,syncFreeformCaret(),this.#zn()):(s=`text`,this.#qe=textPanel,this.#G=!0,this.#ht(l),this.#ae=``,this.#cn(),this.#zn());let finalize=t=>{this.#qe=void 0,this.#Cn({id:o,kind:`question`,title:stripTerminalControls(e.prompt),body:`${this.#i.colors.dim(this.#i.glyph.elbow)} ${stripTerminalControls(t.label)}`,preformatted:!0,live:!1}),this.#G=!1,this.#fn(),this.#ae=STATUS.processing,this.#ln(),this.#$t(),this.#zn();let n={};return t.optionId!==void 0&&(n.optionId=t.optionId),t.text!==void 0&&(n.text=t.text),n},dismiss=()=>{this.#qe=void 0,this.#Cn({id:o,kind:`question`,title:stripTerminalControls(e.prompt),body:`${this.#i.colors.dim(this.#i.glyph.elbow)} ${this.#i.colors.dim(`Skipped. The question stays open.`)}`,preformatted:!0,live:!1}),this.#G=!1,this.#ae=``,this.#ln(),this.#$t(),this.#zn(),u(void 0)},moveCursor=e=>{a!==0&&(c=(c+e+a)%a,syncFreeformCaret(),this.#zn())},selectOptionAt=e=>{let t=n[e];t&&u(finalize({optionId:t.id,label:t.label}))},u;return await new Promise((t,n)=>{this.#ie=n,u=t,this.#Ce=t=>{if(t.type===`ctrl-c`){if((s===`text`||isOnFreeformRow())&&l.text.length>0){l=EMPTY_LINE,this.#un(),s===`text`&&this.#ht(l),this.#zn();return}this.#de=!0,this.#qe=void 0,this.#ln(),this.#Zt(),n(interruptedError());return}if(t.type===`ctrl-r`){this.#zn();return}if(s===`select`){let n=setupSelectionIntent(t,{textNavigation:!isOnFreeformRow()});if(n?.kind===`move`){moveCursor(n.direction===`up`?-1:1);return}switch(t.type){case`up`:case`ctrl-p`:moveCursor(-1);break;case`down`:case`ctrl-n`:moveCursor(1);break;case`enter`:if(isOnFreeformRow()){let t=resolveQuestionText(l.text,e);t!==void 0&&u(finalize(t));break}selectOptionAt(c);break;case`escape`:if(isOnFreeformRow()&&l.text.length>0){l=EMPTY_LINE,this.#un(),this.#zn();break}dismiss();break;default:if(isOnFreeformRow()){let e=this.#W.apply(l,t);e!==void 0&&(l=e,this.#un(),this.#zn())}}return}let r=this.#W.apply(l,t,{multiline:!0});if(r!==void 0){l=r,this.#un(),this.#ht(l),this.#zn();return}switch(t.type){case`up`:case`down`:{let e=movePromptLine(l,t.type);e!==void 0&&(l=e,this.#un(),this.#ht(l),this.#zn());break}case`enter`:{let t=resolveQuestionText(l.text,e);if(t===void 0)break;u(finalize(t));break}case`escape`:if(l.text.length>0){l=EMPTY_LINE,this.#un(),this.#ht(l),this.#zn();break}dismiss()}},this.#Qt()})}upsertSubagentStep(e){if(this.#f?.recordSubagentDispatch(e.callId),this.#c===`hidden`)return;let t=stripTerminalControls(e.reasoning??``).trim(),n=stripTerminalControls(e.message??``).trim();if(t.length!==0||n.length!==0){if(this.#Sn(e.callId,e.subagentName),this.#c===`collapsed`){this.#zn();return}this.#wn({id:subagentStepSectionId(e.callId,e.sectionKey),kind:`subagent-step`,subagentCallId:e.callId,depth:1,reasoning:t,body:n,collapsed:this.#c!==`full`,live:!e.finalized}),this.#zn()}}upsertSubagentTool(e){if(this.#f?.recordSubagentDispatch(e.callId),e.status===`failed`&&e.errorText!==void 0&&this.#f?.append({source:`tool`,summary:`${e.toolName} failed (subagent ${e.subagentName})`,detail:e.errorText}),this.#c===`hidden`)return;if(this.#Sn(e.callId,e.subagentName),this.#c===`collapsed`){this.#zn();return}let t=subagentToolStatus(e.status),n=e.status===`preparing`?presentPreparingTool(e.toolName):presentTool(e.toolName,e.input,this.#Mn({input:e.input,output:e.output,toolCallId:e.childCallId,toolName:e.toolName})),r={id:subagentToolSectionId(e.callId,e.childCallId),kind:`subagent-tool`,subagentCallId:e.callId,depth:1,title:stripTerminalControls(n.title),subtitle:stripTerminalControls(n.subtitle),status:t,live:t===`running`||t===`approval`,expanded:this.#c===`full`,toolName:e.toolName,toolGroup:n.group,toolInput:e.input};n.doneTitle!==void 0&&(r.doneTitle=stripTerminalControls(n.doneTitle)),n.detail!==void 0&&(r.detailLines=n.detail,r.keepDetailWhenDone=n.keepDetailWhenDone===!0),e.output===void 0?e.errorText!==void 0&&(r.result=stripTerminalControls(e.errorText)):(r.result=n.summarizeResult(e.output),r.toolOutput=e.output),this.#wn(r),this.#gt(e.callId),this.#zn()}#gt(e){applyCohortLiveness(this.#h.filter(t=>t.kind===`subagent-tool`&&t.subagentCallId===e).map(e=>({block:e,active:isActiveToolStatus(e.status)})))}removeSubagentTool(e){this.#Tn(subagentToolSectionId(e.callId,e.childCallId)),this.#zn()}subagents={begin:e=>this.beginSubagent(e),background:e=>this.backgroundSubagent(e),upsertStep:e=>this.upsertSubagentStep(e),upsertTool:e=>this.upsertSubagentTool(e),removeTool:e=>this.removeSubagentTool(e),complete:e=>this.completeSubagent(e),markChildToolCallId:e=>this.markChildToolCallId(e)};beginSubagent(e){if(this.#c===`hidden`)return;this.#Sn(e.callId,e.name);let t=this.#g.get(subagentHeaderId(e.callId));t!==void 0&&(t.status===`done`&&delete t.status,t.live=!0),this.#T.delete(e.callId),this.#zn()}backgroundSubagent(e){let t=this.#g.get(subagentHeaderId(e.callId));if(t===void 0||this.#v.has(subagentHeaderId(e.callId)))return;t.status=`running`,t.live=!0,t.updateSeq=++this.#S;let n=this.#w.has(e.callId);this.#w.add(e.callId),n||this.#En(e.callId),this.#gn(),this.#zn()}completeSubagent(e){let t=this.#g.get(subagentHeaderId(e.callId));if(t!==void 0){if(t.status=`done`,e.authoritative){this.#w.delete(e.callId),this.#T.delete(e.callId);for(let t of this.#h)t.subagentCallId===e.callId&&(t.live=!1)}else{this.#T.add(e.callId);for(let t of this.#h)t.subagentCallId===e.callId&&(t.live=!0)}this.#gn(),this.#zn()}}markChildToolCallId(e){this.#b.add(e);let t=this.#x.get(e);t!==void 0&&(this.#Tn(t),this.#x.delete(e),this.#zn())}#_t(e){let t=this.#g.get(toolSectionId(e));t!==void 0&&(t.status=`denied`,t.live=!1)}upsertConnectionAuth(e){if(this.#l===`hidden`)return;let t=connectionAuthTerminalMessage(e.state);this.#Cn({id:connectionAuthSectionId(e.name),kind:`connection-auth`,title:`${stripTerminalControls(e.name)} · authorization · ${e.state}`,body:formatConnectionAuthContent(e,t),preformatted:!0,live:t===void 0}),this.#zn()}setConnectionAuthPendingCount(e){let t=Math.max(0,e);if(t===this.#R)return;let n=this.#R>0;this.#R=t,t>0?(this.#ae=STATUS.connectionAuth,this.#zn()):n&&(this.#ae=STATUS.processing,this.#zn())}setVercelStatus(e){this.#z=e,this.#zn()}setRemoteConnectionStatus(e){this.#B=e,this.#zn()}reset(){this.#h=[],this.#g.clear(),this.#v.clear(),this.#L=void 0,this.#I.length=0,this.#y.length=0,this.#P=!1,this.#F=void 0,this.#vt(),this.#Q=!1,this.#Ke=void 0,this.#Ve=void 0,this.#R=0,this.#je=void 0,this.#Me=void 0,this.#Pe=void 0,this.#Fe=void 0,this.#Ie=void 0,this.#ce&&(this.#n.clearAll(),this.#zn())}renderSessionBoundary(){this.#yn(),this.#vt();let e=this.#i.colors,t=this.#i.glyph,n=e.dim(`${t.cornerOpen}${t.dash.repeat(2)} Session restarted, clear context.`);this.#_n({kind:`session-boundary`,body:n,live:!1}),this.#zn()}#vt(){this.#Qe=void 0,this.#$e=void 0,this.#b.clear(),this.#x.clear(),this.#D.clear(),this.#w.clear(),this.#T.clear(),this.#C.clear(),this.#et.reset(),this.#at=void 0,this.#E.clear(),this.#$.reset(),this.#gn()}renderNotice(e){let t=stripTerminalControls(e);t.trim().length!==0&&(this.#Yt(),this.#_n({kind:`notice`,body:t,live:!1}),this.#zn())}renderSetupWarning(e){let t=stripTerminalControls(e);if(t.trim().length===0){this.#yt();return}this.#Yt(),this.#Ze=t,this.#zn()}clearSetupWarning(){this.#yt()}#yt(){this.#Ze!==void 0&&(this.#Ze=void 0,this.#zn())}renderCommandInvocation(e){let t=stripTerminalControls(e);t.trim().length!==0&&(this.#Yt(),this.#St(t),this.#zn())}async choosePromptCommand(e){this.#Yt(),this.#G=!1;let t=typeaheadFor(e,`/`);return this.#Je=e=>{let n=renderCommandSuggestions(t,this.#i,e),r=Math.max(1,this.#ir()-7),i=Math.max(0,Math.min(t.selectedIndex-r+1,n.length-r));return renderTransientDrawer(n.slice(i,i+r),[`↑/↓ move · Enter select · Esc close`],this.#i,e)},this.#ae=``,this.#zn(),await new Promise(e=>{this.#Ye=()=>e(void 0),this.#Ce=n=>{if(n.type===`up`||n.type===`ctrl-p`)t=moveTypeaheadSelection(t,-1),this.#zn();else if(n.type===`down`||n.type===`ctrl-n`)t=moveTypeaheadSelection(t,1),this.#zn();else if(n.type===`enter`){let n=selectedTypeaheadCommand(t);this.#bt(),e(n===void 0?void 0:typeaheadCompletion(n))}else(n.type===`escape`||n.type===`ctrl-c`)&&(this.#bt(),e(void 0))},this.#Qt()})}async showInfoPanel(e){this.#Yt(),this.#G=!1;let t=stripAnsi(e),n=0,infoRows=e=>t.split(`
5
- `).flatMap(t=>wrapVisibleLine(t,Math.max(1,e-4)).map(e=>` ${e}`));this.#Je=e=>{let t=infoRows(e),r=Math.max(1,this.#ir()-7);return n=Math.min(n,Math.max(0,t.length-r)),renderTransientDrawer(t.slice(n,n+r),[t.length>r?`↑/↓ scroll · Esc close`:`Esc to close`],this.#i,e)},this.#ae=``,this.#zn(),await new Promise(e=>{this.#Ye=e,this.#Ce=t=>{if(t.type===`up`||t.type===`ctrl-p`)n=Math.max(0,n-1),this.#zn();else if(t.type===`down`||t.type===`ctrl-n`){let e=Math.max(1,this.#ir()-7);n=Math.min(n+1,Math.max(0,infoRows(this.#rr()).length-e)),this.#zn()}else(t.type===`escape`||t.type===`ctrl-c`||t.type===`enter`)&&(this.#bt(),e())},this.#Qt()})}#bt(){this.#Je=void 0,this.finishCommand({kind:`dismiss`}),this.#Ce=void 0,this.#Ye=void 0,this.#$t(),this.#zn()}finishCommand(e){if(e.kind===`dismiss`){this.#xt()&&this.#zn();return}let t=this.#Ct(e.summary);t!==void 0&&(t.status=`done`);let n=e.message===void 0?``:stripAnsi(e.message);if(n.trim().length===0){t!==void 0&&this.#zn();return}this.#Yt(),this.#_n({kind:`result`,body:n,live:!1}),this.#zn()}#xt(){let e=this.#_;return e!==void 0&&(this.#_=void 0,this.#h=this.#h.filter(t=>t!==e),!0)}#St(e){this.#_!==void 0&&this.#Ct();let t={kind:`command`,body:e,live:!0};this.#_=t,this.#_n(t)}#Ct(e){let t=this.#_;if(t!==void 0)return this.#_=void 0,t.live=!1,e!==void 0&&(t.result=stripTerminalControls(e)),t}#wt(e){this.#Yt(),this.#A===void 0&&(this.#G=!1),this.#re={kind:`idle`},this.#ae=``,this.#Xe={title:stripTerminalControls(e),startedAtMs:Date.now(),lines:[],outputBuffer:[]},this.#dn(),this.#zn()}#Tt(e){this.#Xe!==void 0&&(this.#Xe.navigation=e,this.#zn())}#Et(e){this.#ct=void 0,this.#zt();let t=this.#Xe;if(t!==void 0){if(this.#Xe=void 0,this.#A===void 0?this.#pn():this.#mt(),e){let e=[];for(let n of t.lines){if(n.evidence===!0){e.push(n.text);continue}(n.tone===`warning`||n.tone===`error`)&&(e.length>0&&this.#_n({kind:`flow`,title:`info`,body:e.join(`
6
- `),live:!1}),this.#_n({kind:`flow`,title:n.tone,body:n.text,live:!1})),e=[]}}this.#zn()}}async#Dt(e){let t=this.#Nt(e.message),n=isMultiSelectRequest(e),r=e.kind===`search`?e.searchAction:void 0,i=e.kind===`search`&&e.layout===void 0,a=e.options,o=e.navigation?.kind===`planner`,s={options:a,searchAction:r,submitRow:n&&!o};`initialValue`in e&&e.initialValue!==void 0&&(s.defaultValue=e.initialValue),`initialValues`in e&&e.initialValues!==void 0&&(s.initialValues=e.initialValues);let c=initialSelectState(s),l,u=!1,d=0,isCurrentSearch=e=>e===d,clearSearch=()=>{d+=1,u=!1,c=reduceSelect(c,{type:`clear`},{options:a,searchAction:r,submitRow:n&&!o}),this.#zn()},loadSearch=async(e,t)=>{u=!0,l=void 0;let i=++d;this.#zn();try{let s=await t(e);if(!isCurrentSearch(i))return;let l=c.filter;a=s,c={...initialSelectState({options:s,searchAction:r,submitRow:n&&!o}),filter:l}}catch(e){isCurrentSearch(i)&&(l=toErrorMessage(e))}finally{isCurrentSearch(i)&&(u=!1,this.#zn())}},f=e.notices;if(e.kind===`task-list`||e.kind===`search`&&e.layout===`task-list`){let n=t.taskListLineStart??t.lines.length,r=t.lines.slice(n).filter(e=>e.tone===`success`||e.tone===`warning`||e.tone===`error`).map(e=>({tone:e.tone,text:e.text}));f=e.notices??r,t.taskListLineStart=t.lines.length,t.hideLinesWhileQuestion=!0}let panelState=()=>{let t={...e,message:``,options:a,select:c};return f!==void 0&&f.length>0&&(t.notices=f),l!==void 0&&(t.error=l),u&&(t.loadingFrame=this.#Kn()),i&&(t.caretVisible=this.#ge),t};return t.question=e=>renderSelectQuestion(panelState(),this.#i,e),i&&this.#cn(),this.#zn(),await this.#It((t,s)=>{let close=e=>{d+=1,s(e)};if(u){t.type===`ctrl-c`?close(void 0):t.type===`escape`?clearSearch():t.type===`ctrl-r`&&this.#zn();return}let f=e.navigation?.kind===`planner`?e.navigation:void 0,p=t.type===`left`&&(f?.activeStep??0)>(f?.firstNavigableStep??0)?`back`:t.type===`right`&&f!==void 0&&f.activeStep>=(f.firstNavigableStep??0)&&f.activeStep<f.steps.length-1?`forward`:void 0;if(p!==void 0){close({kind:`navigate`,direction:p,values:n?orderedSelection(a,c.selected):[]});return}let m={key:t,options:a,searchAction:r,select:c},h=reduceSetupSelectInput(n?{...m,kind:e.kind,required:e.required,plannerNavigation:o||void 0}:{...m,kind:e.kind});switch(h.kind){case`cancel`:close(void 0);return;case`repaint`:this.#zn();return;case`update`:c=h.select,l=void 0,i&&this.#un(),this.#zn();return;case`submit`:{let e=searchActionQuery(h.values[0]??``),t=r?.load;if(e===void 0||t===void 0){close(h.values);return}loadSearch(e,t);return}case`error`:l=h.message,this.#zn();return;case`ignore`:return}},i?()=>this.#ln():void 0).promise}#Ot(e){this.#Yt();let t=this.#Pt();t.status={text:stripTerminalControls(e.status),startedAtMs:Date.now()};let n;t.question=t=>renderSelectQuestion({kind:`actions`,context:e.context,actions:e.actions,cursor:n},this.#i,t),this.#zn();let r=this.#It((t,r)=>{let i=setupSelectionIntent(t,{textNavigation:!0});switch(i?.kind){case`cancel`:r(void 0);return;case`move`:n=moveActionCursor(n,i.direction,e.actions.length),this.#zn();return;case`repaint`:this.#zn();return;case`submit`:n!==void 0&&r(e.actions[n].value);return;case void 0:return}},()=>{t.status=void 0});return{choice:r.promise,close:()=>r.settle(void 0)}}async#kt(e){let t=this.#Nt(e.message),n={options:e.options};e.initialValue!==void 0&&(n.defaultValue=e.initialValue);let r=initialSelectState(n),i=lineOf(``),a;t.question=t=>{let n={kind:`inline-edit`,layout:`task-list`,message:``,options:e.options,select:r,edit:{optionValue:e.editable.value,caretVisible:this.#ge,editor:{kind:`rename`,editor:i,defaultValue:e.editable.defaultValue,formatHint:e.editable.formatHint}}};return a!==void 0&&(n.error=a),renderSelectQuestion(n,this.#i,t)};let onEditableRow=()=>selectValueAtCursor([...e.options],r.cursor)===e.editable.value,syncEditableRow=()=>{onEditableRow()?this.#cn():(i=lineOf(``),this.#ln())};return syncEditableRow(),this.#zn(),await this.#It((t,n)=>{let applyEditor=e=>{i=e,a=void 0,this.#un(),this.#zn()},applySelect=t=>{r=reduceSelect(r,t,{options:e.options}),a=void 0,syncEditableRow(),this.#zn()},submit=()=>{let t=selectValueAtCursor([...e.options],r.cursor);if(t===void 0)return;if(t!==e.editable.value){n({kind:`selected`,value:t});return}let o=(i.text||e.editable.defaultValue).trim(),s=e.editable.validate?.(o);if(s!==void 0){a=s,this.#zn();return}n(o===e.editable.defaultValue?{kind:`selected`,value:t}:{kind:`edited`,value:t,text:o})},o=setupSelectionIntent(t,{textNavigation:!onEditableRow()});switch(o?.kind){case`cancel`:n(void 0);return;case`move`:applySelect({type:o.direction});return;case`submit`:submit();return;case`repaint`:this.#zn();return;case void 0:}if(!onEditableRow())return;let s=this.#W.apply(i,t);s!==void 0&&applyEditor(s)},()=>this.#ln()).promise}async#At(e){this.#W.clear();let t=this.#Nt(e.message),n=initialProviderPickerState(e.options,e.initialValue),r,cursorBadge=()=>{if(n.phase.kind!==`inactive`)return;let t=selectValueAtCursor([...e.options],n.select.cursor),r=e.options.find(e=>e.value===t);if(r!==void 0)return enterBadge(this.#i,r.checked===!0?`change`:void 0)};t.question=t=>{let r=cursorBadge(),i={kind:`inline-edit`,layout:`stacked`,message:``,options:e.options,select:n.select,edit:{optionValue:`ai-gateway-key`,caretVisible:this.#ge,editor:{kind:`key`,phase:n.phase}}};return r!==void 0&&(i.cursorBadge=r),renderSelectQuestion(i,this.#i,t)};let syncCaret=()=>{n.phase.kind===`editing`||n.phase.kind===`invalid`?this.#cn():this.#ln()};return syncCaret(),this.#zn(),await this.#It((t,i,a)=>{let dispatch=t=>{let o=transitionProviderPicker(n,t,e.options);switch(o.kind){case`ignore`:return;case`clear`:r?.abort(),r=void 0,n=o.state,syncCaret(),this.#zn();return;case`cancel`:i(void 0);return;case`render`:n=o.state,syncCaret(),this.#zn();return;case`validate`:{n=o.state,syncCaret(),this.#zn();let t=new AbortController;r=t;let i;try{i=e.validateInlineKey(o.key,t.signal)}catch(e){a(e);return}i.then(e=>{r!==t||t.signal.aborted||(r=void 0,dispatch({type:`validated`,validation:e}))},e=>{r!==t||t.signal.aborted||(r=void 0,a(e))});return}case`settle`:i(o.result);return}},o=setupSelectionIntent(t,{textNavigation:n.phase.kind===`inactive`});switch(o?.kind){case`cancel`:dispatch({type:`cancel`});return;case`move`:dispatch({type:`move`,direction:o.direction});return;case`submit`:dispatch({type:`submit`});return;case`repaint`:this.#zn();return;case void 0:}if(n.phase.kind!==`editing`&&n.phase.kind!==`invalid`)return;let s=applyLineEditorKey(n.phase.editor,t);s!==void 0&&(this.#un(),dispatch({type:`edit`,editor:s}))},()=>{r?.abort(),r=void 0,this.#ln()}).promise}async#jt(e){e.mask===!0&&this.#W.clear();let t=this.#Nt(e.message),n=lineOf(``),r;return t.question=t=>{let i={message:``,editor:n,mask:e.mask===!0};return e.placeholder===void 0?e.defaultValue!==void 0&&(i.placeholder=e.defaultValue):i.placeholder=e.placeholder,e.notices!==void 0&&(i.notices=e.notices),r!==void 0&&(i.error=r),renderTextQuestion(i,this.#i,t,this.#ge)},this.#cn(),this.#zn(),await this.#It((t,i)=>{let apply=e=>{n=e,r=void 0,this.#un(),this.#zn()},a=e.mask?applyLineEditorKey(n,t):this.#W.apply(n,t);if(a!==void 0){apply(a);return}switch(t.type){case`ctrl-c`:case`escape`:i(void 0);return;case`ctrl-r`:this.#zn();return;case`enter`:{let t=n.text.length>0?n.text:e.defaultValue??``,a=e.validate?.(t);if(a!==void 0){r=a,this.#zn();return}i(t);return}default:return}},()=>this.#ln()).promise}async#Mt(e){let t=this.#Nt(e.message);return t.question=t=>renderAcknowledgeQuestion({message:``,lines:e.lines},this.#i,t),this.#zn(),await this.#It((e,t)=>{switch(e.type){case`enter`:case`escape`:case`ctrl-c`:t();return;case`ctrl-r`:this.#zn();return;default:return}}).promise}#Nt(e){this.#Yt(),this.#G=!1,this.#re={kind:`idle`},this.#ae=``;let t=this.#Pt();return t.questionTitle=stripTerminalControls(e),t.status!==void 0&&(t.status=void 0,t.summary=void 0,t.preview=void 0),t}#Pt(){return this.#Xe===void 0&&(this.#Xe={title:``,startedAtMs:Date.now(),lines:[],outputBuffer:[],implicit:!0}),this.#Xe}#Ft(){this.#Xe?.implicit===!0?this.#Xe=void 0:this.#Xe!==void 0&&(this.#Xe.question=void 0,this.#Xe.questionTitle=void 0,this.#Xe.hideLinesWhileQuestion=!1),this.#Ce=void 0,this.#$t(),this.#A===void 0?this.#Xe!==void 0&&this.#Rt():this.#mt(),this.#Xe===void 0&&this.#zn()}#It(e,t){let n=!1,r,i,a=new Promise((e,t)=>{r=e,i=t}),settle=e=>{n||(n=!0,t?.(),this.#Ft(),r(e))},reject=e=>{n||(n=!0,t?.(),this.#Ft(),i(e))};return this.#an(),this.#Ce=t=>{t.type===`ctrl-c`&&this.#Gt(),e(t,settle,reject)},this.#Qt(),{promise:a,settle}}#Lt(e){let t,n=new Promise(e=>{t=e});return this.#ct=t,this.#Rt(e?.interruptible??!0),{promise:n,dispose:()=>{this.#ct===t&&(this.#ct=void 0,this.#zt())}}}#Rt(e=!0){if(this.#A!==void 0){this.#mt();return}if(this.#ct===void 0)return;let consumer=t=>{if(e&&(t.type===`ctrl-c`||t.type===`escape`)){t.type===`ctrl-c`&&this.#Gt();let e=this.#ct;this.#ct=void 0,this.#zt(),e?.(t.type===`ctrl-c`?`ctrl-c`:`escape`);return}t.type===`ctrl-r`&&this.#zn()};this.#lt=consumer,this.#an(),this.#Ce=consumer,this.#Qt()}#zt(){this.#lt!==void 0&&(this.#Ce===this.#lt&&this.#$t(),this.#lt=void 0)}#Bt(e){let t=e===void 0?void 0:{text:stripTerminalControls(e),startedAtMs:Date.now()};if(this.#Xe!==void 0){this.#Xe.status=t,t===void 0&&(this.#Xe.preview=void 0),this.#zn();return}if(!(this.#G||this.#ne)){if(t===void 0){this.#re={kind:`idle`},this.#oe=void 0,this.#pn(),this.#zn();return}this.#Yt(),this.#fn(),this.#oe=t.text,this.#zn()}}#Vt(e,t){let n=stripTerminalControls(e);if(n.trim().length===0)return;let r=this.#Xe;if(r!==void 0){if(r.preview=void 0,t===`warning`||t===`error`)for(let e of r.outputBuffer)r.lines.push({text:e,tone:`info`,evidence:!0});r.outputBuffer=[],r.lines.push({text:n,tone:t}),this.#zn();return}this.#Yt(),this.#_n({kind:`flow`,title:t,body:n,live:!1}),this.#zn()}#Ht(e){let t=this.#Xe;t!==void 0&&(t.lines=[],t.outputBuffer=[],t.preview=void 0,t.status=void 0,t.summary=e===void 0?void 0:{headline:stripTerminalControls(e.headline),facts:e.facts.map(e=>({label:stripTerminalControls(e.label),value:stripTerminalControls(e.value)}))},this.#zn())}#Ut(e){let t=stripTerminalControls(e);if(t.trim().length===0)return;let n=this.#Xe;if(n===void 0){this.#Vt(t,`info`);return}n.preview=t,n.outputBuffer.push(t),n.outputBuffer.length>40&&n.outputBuffer.shift(),this.#zn()}async#Wt(e){this.#we=``,this.#an(),this.#ct=void 0,this.#zt(),this.#$t(),this.#mn(),this.#n.clear(),this.#or(),this.#r.enter({cursor:`visible`,mouse:!1}),this.#e.isTTY&&this.#e.setRawMode?.(!1),this.#e.pause();try{return await e()}finally{this.#r.exit(),this.#e.isTTY&&this.#e.setRawMode?.(!0),this.#e.resume(),this.#we=``,this.#an(),this.#n.hideCursor(),this.#ar(),this.#Xe===void 0?this.#gn():(this.#dn(),this.#Rt()),this.#n.reset(),this.#zn()}}setSessionId(e){this.#it=e}shutdown(){this.#Zt();for(let e of this.#X.values())clearTimeout(e);if(this.#X.clear(),this.#le&&!this.#ue){this.#ue=!0;let e=this.#it===void 0?``:` ${this.#i.glyph.dot} session ${this.#it}`;this.#t.write(`${this.#i.colors.dim(`${eveVersionTag()}${e}`)}\n`)}}suspendPromptForInput(){this.#te={cursor:this.#H,text:this.#V},this.#Zt()}requestInterrupt(){this.#de=!0,this.#Xe!==void 0&&this.#Ce?.({type:`ctrl-c`}),this.#Oe?.(),this.#Zt()}exitRequested(){return this.#fe}#Gt(){this.#fe=!0,this.#he?.()}async#Kt(e){if(this.#ut!==void 0||!this.#ce)return;let t=new TraceViewerSession({...e,theme:this.#i,dimensions:()=>({width:this.#rr(),height:this.#ir()}),paint:e=>this.#r.paint(e,this.#ir()),tracingDisabled:process.env.EVE_TRACES===`off`,copyText:e=>copyTextToClipboard(e,e=>this.#r.writeRaw(e)),terminalBackground:this.#dt});this.#ut=t,this.#r.enter(),this.#i.color&&this.#r.writeRaw(BACKGROUND_COLOR_QUERY),await new Promise(e=>{this.#Jt=e,this.#Ce=e=>{t.handleKey(e)===`close`&&this.#qt()},this.#Qt(),t.start()})}#qt(){let e=this.#ut;if(e===void 0)return;this.#ut=void 0,e.dispose(),this.#$t(),this.#r.exit(),this.#n.hideCursor(),this.#zn(),this.#n.showCursor();let t=this.#Jt;this.#Jt=void 0,t?.()}#Jt;#Yt(e){this.#se=e?.title??this.#se,e?.contextSize!==void 0&&(this.#Ne=e.contextSize),!this.#ce&&(this.#ce=!0,this.#le=!0,this.#n.reset(),this.#n.hideCursor(),this.#ar(),this.#e.isTTY&&(this.#e.setRawMode?.(!0),this.#e.resume(),this.#n.emitBracketedPaste(!0)),this.#De=()=>this.#zn(),this.#t.on(`resize`,this.#De),process.on(`exit`,this.#Xt))}#Xt=()=>{this.#ce&&(this.#r.exit(),this.#e.isTTY&&(this.#n.emitBracketedPaste(!1),this.#e.setRawMode?.(!1)),this.#n.showCursor())};#Zt(){this.#qe=void 0;let e=this.#Ye;e!==void 0&&(this.#Ye=void 0,this.#Je=void 0,this.finishCommand({kind:`dismiss`}),this.#Ce=void 0,e()),this.#qt();let t=this.#ie;if(this.#ie=void 0,t?.(interruptedError()),this.#$t(),this.#ln(),this.#mn(),this.#xe!==void 0&&(clearTimeout(this.#xe),this.#xe=void 0),this.#Se=!1,this.#mr(),this.#ce){this.#gr(),this.#Ct();for(let e of this.#h)e.kind===`log`&&e.id===void 0&&(e.live=!1);this.#zn(),this.#n.clear(),this.#n.showCursor(),this.#or(),this.#n.newline(),this.#e.isTTY&&(this.#n.emitBracketedPaste(!1),this.#e.setRawMode?.(!1),this.#e.pause()),this.#De&&=(this.#t.off(`resize`,this.#De),void 0),process.off(`exit`,this.#Xt),this.#ce=!1}}#Qt(){this.#e.off(`data`,this.#en),this.#e.on(`data`,this.#en),this.#we.length>0&&queueMicrotask(()=>{this.#Ce!==void 0&&this.#we.length>0&&(this.#rn(),this.#tn())})}#$t(){this.#e.off(`data`,this.#en),this.#an(),this.#Ce=void 0}#en=e=>{this.#an(),this.#we+=this.#Te.write(e),this.#rn(),this.#tn()};#tn(){if(this.#we===`\x1B`){this.#Ee=setTimeout(()=>{this.#we===`\x1B`&&(this.#we=``,this.#nn({type:`escape`}))},30),this.#Ee.unref?.();return}if(isIncompletePaste(this.#we)){let e=this.#we;this.#Ee=setTimeout(()=>{if(this.#we!==e)return;let t=sanitizePastedText(stripPasteStart(e));this.#we=``,t.length>0&&this.#nn({type:`text`,value:t,framing:`bracketed-paste`})},incompletePasteFlushMs),this.#Ee.unref?.();return}if(isIncompleteOsc(this.#we)){let e=this.#we;this.#Ee=setTimeout(()=>{this.#we===e&&(this.#we=``)},incompletePasteFlushMs),this.#Ee.unref?.()}}#nn(e){this.#W.interruptYank(e),this.#Ce?.(e)}#rn(){for(;this.#we.length>0;){let e=nextKey(this.#we);if(e.incomplete)return;if(this.#we=this.#we.slice(e.consumed),e.key!==void 0&&e.key.type!==`ignore`){if(e.key.type===`osc`){this.#in(e.key.value);continue}this.#nn(e.key)}}}#in(e){let t=parseBackgroundColorReply(e);t!==void 0&&(this.#dt=t,this.#ut?.setTerminalBackground(t))}#an(){this.#Ee&&=(clearTimeout(this.#Ee),void 0)}#on(e){switch(e.type){case`ctrl-l`:case`ctrl-r`:this.#zn();break;case`enter`:{let e=this.#te.text;if(e.trim().length===0)break;if(parsePromptCommand(e)?.type===`cancel`&&this.#tt!==void 0){this.#te=EMPTY_LINE,this.#et.requestCancellation(),this.#ot=!0,this.renderCommandInvocation(e.trim()),this.finishCommand({kind:`result`,summary:`Cancellation requested`}),this.#tt(),this.#zn();break}let t=this.#nt;t!==void 0&&parsePromptCommand(e)===null?(this.#te=EMPTY_LINE,this.#sn(e,t)):this.#et.enqueue(e)&&(this.#te=EMPTY_LINE),this.#zn();break}case`ctrl-c`:case`escape`:if(e.type===`ctrl-c`&&this.#et.view().cancelling){this.#de=!0,this.#me=!0,this.#re={kind:`idle`},this.#ae=`Interrupted`,this.#Oe?.(),this.#zn();break}if(this.#et.idle&&this.#tt===void 0)break;if(this.#et.handleEscape()===`steer`){let e=this.#nt;if(e!==void 0){let t=this.#et.takeSteering();this.#sn(t,e)}}else this.#ot=!0,this.#tt?.();this.#zn();break;default:{let t=this.#W.apply(this.#te,e,{multiline:!0});t!==void 0&&(this.#te=t,this.#zn());break}}}#sn(e,t){this.#at=`steer`,this.#bn(e),t(e).catch(t=>{this.#et.restoreSteering(e),this.#xn(`Steering failed`,toErrorMessage(t)),this.#zn()})}#cn(){this.#ln(),this.#un(),this.#ye=setInterval(()=>{this.#ge=!this.#ge,this.#zn()},500),this.#ye.unref?.()}#ln(){this.#ye&&=(clearInterval(this.#ye),void 0),this.#ge=!0}#un(){this.#ge=!0}#dn(){this.#mn(),this.#be=setInterval(()=>{this.#_e+=1,this.#zn()},90),this.#be.unref?.()}#fn(){let e=Date.now();this.#ve=e,this.#re={kind:`waiting`,startedAtMs:e},this.#dn()}#pn(){this.#hn()||this.#mn()}#mn(){this.#be&&=(clearInterval(this.#be),void 0)}#hn(){return this.#h.some(e=>e.live&&e.subagentCallId!==void 0&&(this.#w.has(e.subagentCallId)||this.#T.has(e.subagentCallId)))}#gn(){this.#hn()?this.#dn():!this.#ne&&this.#re.kind===`idle`&&this.#mn()}#_n(e){e.id!==this.#Ve?.id&&this.#gr(),e.updateSeq=++this.#S;let t=e.subagentCallId!==void 0&&this.#w.has(e.subagentCallId)?-1:this.#h.findIndex(e=>e.subagentCallId!==void 0&&this.#w.has(e.subagentCallId));t<0?this.#h.push(e):this.#h.splice(t,0,e),e.id&&this.#g.set(e.id,e)}#vn(e){this.#Q=!0,this.#_n({kind:`user`,body:stripTerminalControls(e),live:!1}),this.#zn()}#yn(){let e=this.#$.settle();if(e===void 0||e.elapsedMs<=1e4&&e.inputTokens<=2e4)return;let t=`Done in ${this.#Zn(e.elapsedMs)}`,n=this.#Me??0;if(this.#Ne!==void 0&&this.#Ne>0&&n>0){let e=Math.round(n/this.#Ne*100);t+=` ${this.#i.glyph.dot} ${e}% context`}this.#_n({kind:`turn-stats`,body:t,live:!1})}#bn(e){if(e==null)return;let t=this.#at;if(this.#at=void 0,this.#Ke===e){this.#Ke=void 0;return}let n={kind:`user`,body:stripTerminalControls(e),live:!1};t!==void 0&&(n.promptOrigin=t),this.#_n(n)}#xn(e,t,n={}){let r=stripTerminalControls(e),i=stripTerminalControls(t),a=n.detail===void 0?void 0:stripTerminalControls(n.detail),o=n.hint===void 0?void 0:stripTerminalControls(n.hint),s={source:`workflow`,summary:`${r}: ${i}`,detail:a??i};this.#f?.append(o===void 0?s:{...s,hint:o});let c={kind:`error`,title:r,body:i,live:!1};o!==void 0&&(c.hint=o),a!==void 0&&(c.detail=this.#f===void 0?a:`details: ${this.#f.displayPath}`),this.#_n(c),this.#zn()}#Sn(e,t){if(this.#D.has(e))return;this.#D.add(e);let n=stripTerminalControls(t),r=this.#C.get(n)??[];if(r.push(e),this.#C.set(n,r),r.length===2){let e=this.#g.get(subagentHeaderId(r[0]));e!==void 0&&(e.subtitle=`#1`)}let i={id:subagentHeaderId(e),kind:`subagent`,subagentCallId:e,title:n,live:!0};r.length>1&&(i.subtitle=`#${r.length}`),this.#_n(i)}#Cn(e){if(e.id&&this.#v.has(e.id))return;let t=e.id?this.#g.get(e.id):void 0;if(t){Object.assign(t,e),t.updateSeq=++this.#S;return}this.#_n(e)}#wn(e){if(e.id&&this.#v.has(e.id))return;let t=e.id?this.#g.get(e.id):void 0;if(t!==void 0){Object.assign(t,e),t.updateSeq=++this.#S;return}let n=e.subagentCallId;if(n===void 0){this.#_n(e);return}e.id!==this.#Ve?.id&&this.#gr(),e.updateSeq=++this.#S;let r=-1;for(let e=0;e<this.#h.length;e+=1)this.#h[e]?.subagentCallId===n&&(r=e);this.#h.splice(r<0?this.#h.length:r+1,0,e),e.id!==void 0&&this.#g.set(e.id,e)}#Tn(e){this.#h=this.#h.filter(t=>t.id!==e),this.#g.delete(e)}#En(e){let t=this.#h.filter(t=>t.subagentCallId===e);t.length!==0&&(this.#h=this.#h.filter(t=>t.subagentCallId!==e),this.#h.push(...t))}#Dn(){for(let e of this.#h)e.subagentCallId!==void 0&&this.#T.has(e.subagentCallId)||e.status===`approval`||e.status===`running`||e.kind===`connection-auth`&&e.live||e===this.#_||(e.live=!1)}#On(e,t,n){let r=turnActivityLabel(n);switch(updateTurnActivity(n,e),e.type){case`turn-start`:e.turnId!==this.#$e&&(this.#$e=e.turnId,this.#Qe=void 0,this.#zn());break;case`step-start`:this.#Qe=typeof e.modelId==`string`&&stripTerminalControls(e.modelId.slice(0,256)).replace(/\s+/gu,` `).trim()||void 0,this.#zn();break;case`step-finish`:this.#f?.recordStepUsage(e.usage),e.usage!==void 0&&this.#$.addUsage(e.usage),this.#Fn(n),this.#Rn(e.usage),this.#zn();break;case`assistant-delta`:{let t=(n.text.get(e.id)??``)+stripTerminalControls(e.delta);n.text.set(e.id,t),this.#kn(e.id,t,!0);break}case`assistant-complete`:{let t=n.text.get(e.id)??``,r=typeof e.text==`string`?stripTerminalControls(e.text):t;n.text.set(e.id,r),this.#kn(e.id,r,!1);break}case`reasoning-delta`:{if(t.reasoning===`hidden`)break;let r=(n.reasoning.get(e.id)??``)+stripTerminalControls(e.delta);if(n.reasoning.set(e.id,r),t.reasoning===`full`){this.#An(e.id,r,!0,t);break}break}case`reasoning-complete`:{if(t.reasoning===`hidden`)break;let r=n.reasoning.get(e.id)??``;if(t.reasoning===`full`){this.#An(e.id,r,!1,t);break}break}case`tool-call-preparing`:if(t.tools===`hidden`||isPanelRoutedTool(e.toolName))break;this.#jn({input:void 0,preparing:!0,status:`running`,toolCallId:e.toolCallId,toolName:e.toolName},t,n);break;case`tool-call`:if(this.#f?.recordToolCall(e.toolName),t.tools===`hidden`)break;this.#jn({input:e.input,status:`running`,toolCallId:e.toolCallId,toolName:e.toolName},t,n);break;case`tool-approval-request`:{if(t.tools===`hidden`)break;let r=n.tools.get(e.toolCallId);if(r===void 0)break;this.#jn({...r,status:`approval`},t,n);break}case`tool-result`:{if(t.tools===`hidden`)break;let r=this.#Ln(e.toolCallId,n);if(r===void 0)break;this.#jn({...r,output:e.output,status:`done`},t,n);break}case`tool-error`:{let r=this.#Ln(e.toolCallId,n);if(this.#f?.append({source:`tool`,summary:`${r?.toolName??e.toolCallId} failed`,detail:e.errorText}),t.tools===`hidden`||r===void 0)break;this.#jn({...r,errorText:e.errorText,status:`error`},t,n);break}case`tool-rejected`:{if(t.tools===`hidden`)break;let r=this.#Ln(e.toolCallId,n);if(r===void 0)break;this.#jn({...r,errorText:e.reason,status:`denied`},t,n);break}case`error`:this.#xn(`Error`,e.errorText,{detail:e.detail,hint:e.hint});break;case`turn-cancelled`:if(n.cancelled=!0,!n.restoreCancelledPrompt)break;this.#rt=!0,!this.#ot&&this.#st!==void 0&&this.#te.text.length===0&&(this.#te=lineOf(this.#st),this.renderNotice(`The turn was cancelled from outside this prompt — the message was restored to the input.`));break;case`finish`:this.#Rn(e.usage),this.#zn()}n===this.#ee&&turnActivityLabel(n)!==r&&this.#zn()}#kn(e,t,n){let r=stripTerminalControls(t).trim();r.length!==0&&(this.#Cn({id:e,kind:`assistant`,body:r,live:n}),this.#zn())}#An(e,t,n,r){let i=stripTerminalControls(t).trim();i.length!==0&&(this.#Cn({id:e,kind:`reasoning`,body:i,collapsed:collapseReasoning(r.reasoning,n),live:n}),this.#zn())}#jn(e,t,n){if(n.tools.set(e.toolCallId,e),this.#b.has(e.toolCallId)||isPanelRoutedTool(e.toolName))return;let r=toolSectionId(e.toolCallId);this.#x.set(e.toolCallId,r);let i=this.#Mn(e);this.#Cn(renderNativeToolBlock(e,r,t.tools===`full`,i)),this.#In(n),this.#zn()}#Mn(e){e.output!==void 0&&this.#E.observeRead(e.output);let t={};this.#Nn(e.toolName)&&(t.isSubagent=!0);let n=readWriteFileInput(e.toolName,e.input);if(n===void 0)return t.isSubagent===!0?t:void 0;let r=this.#E.observeWrite({path:n.path,content:n.content,callId:e.toolCallId});r!==void 0&&(t.previousContent=r);let i=writeExistedFlag(e.output);return i!==void 0&&(t.existed=i),t}#Nn(e){let t=this.#O?.info?.subagents.local;if(t===void 0||t.length===0)return!1;let n=toolBaseName(e);return t.some(e=>e.name===n)}#Pn(e){for(let t of e.tools.keys()){if(this.#b.has(t))continue;let e=this.#x.get(t)??toolSectionId(t),n=this.#g.get(e);n?.kind===`tool`&&n.status===`running`&&(n.status=`error`,n.result=`interrupted`,n.live=!1)}}#Fn(e){for(let[t,n]of e.tools){if(n.preparing!==!0)continue;e.tools.delete(t);let r=this.#x.get(t)??toolSectionId(t);this.#Tn(r),this.#x.delete(t)}}#In(e){let t=[];for(let n of e.tools.values()){if(this.#b.has(n.toolCallId))continue;let e=this.#x.get(n.toolCallId)??toolSectionId(n.toolCallId),r=this.#g.get(e);r?.kind===`tool`&&t.push({block:r,active:isActiveToolStatus(n.status)})}applyCohortLiveness(t)}#Ln(e,t){let n=t.tools.get(e);if(n!==void 0)return n;let r=this.#x.get(e)??toolSectionId(e),i=this.#g.get(r);if(i!==void 0&&i.kind===`tool`)return{errorText:i.status===`error`&&typeof i.result==`string`?i.result:void 0,input:i.toolInput,output:i.toolOutput,status:i.status??`running`,toolCallId:e,toolName:i.toolName??i.title??`tool`}}#Rn(e){if(e===void 0)return;let{inputTokens:t,outputTokens:n}=e;if((t!=null||n!=null)&&(this.#je=(t??0)+(n??0)),this.#Me=t??this.#Me,this.#Pe=n??this.#Pe,this.#Pe!=null&&this.#Ie!==void 0){let e=(Date.now()-this.#Ie)/1e3;e>0&&(this.#Fe=this.#Pe/e)}}#zn(){if(this.#ce){if(this.#ke){this.#Ae=!0;return}this.#ke=!0;try{do this.#Ae=!1,this.#Bn();while(this.#Ae)}finally{this.#ke=!1}}}#Bn(){if(!this.#ce)return;if(this.#ut!==void 0){this.#ut.repaint();return}let e=this.#rr(),t=this.#Yn(e),n=this.#N===void 0?[]:this.#Wn(),r=Math.max(1,this.#ir()-n.length-t.length),i=[],a=this.#L,o=groupToolBlocksForDisplay(this.#h),s=0;for(;s<o.length&&o[s].display.live===!1;)s+=1;if(s>0){let e=new Set(o.slice(0,s).flatMap(e=>e.members));for(let t=this.#h.length-1;t>=0;--t)e.has(this.#h[t])&&this.#h.splice(t,1)}for(let t of o.slice(0,s)){for(let e of t.members)this.#y.push(e),e.id&&(this.#v.add(e.id),this.#g.delete(e.id));if(this.#vr(t.display))continue;let n=this.#Gn(t.display,e,a);a=previousBlockOf(t.display),this.#L=a,i.push(...n),this.#I.push(...n)}let c=[];for(let{display:t}of o.slice(s)){if(this.#vr(t))continue;let n=this.#Gn(t,e,a);a=previousBlockOf(t);for(let e=0;e<n.length;e+=1)c.push({block:t,row:n[e]})}let l=[...n,...clipLiveRows(c.map(e=>e.row),r,e,this.#i),...t];i.length>0?this.#n.flush(i,l):this.#n.update(l)}#Vn(){if(!this.#ce)return;let e=this.#rr(),t=this.#Yn(e),n=Math.max(1,this.#ir()-t.length),r=this.#L,i=[];for(let{display:t}of groupToolBlocksForDisplay(this.#h)){if(this.#vr(t))continue;let n=this.#Gn(t,e,r);r=previousBlockOf(t),i.push(...n)}let a=[...clipLiveRows(i,n,e,this.#i),...t];this.#n.clearAll(),this.#n.flush([...this.#Wn(),...this.#I],a)}logDisplayMode(){return this.#m}setLogDisplayMode(e){e!==this.#m&&(this.#m=e,e===`all`&&this.flushDelayedDevBuildErrors(),this.#Un(),this.#ce&&this.#Vn())}flushDelayedDevBuildErrors(){let e=this.#Be;e!==void 0&&(this.#Be=void 0,this.#_n({kind:`log`,title:`stderr`,body:e,live:!0}),this.#zn())}#Hn(){this.#Se=!0,this.#xe!==void 0&&clearTimeout(this.#xe),this.#xe=setTimeout(()=>{this.#Se=!1,this.#xe=void 0,this.#zn()},5e3),this.setLogDisplayMode(nextLogDisplayMode(this.#m)),this.#zn()}#Un(){let e=this.#rr();this.#I.length=0;let t;for(let{display:n}of groupToolBlocksForDisplay(this.#y,{logCoalescing:`runs`})){if(this.#vr(n))continue;let r=this.#Gn(n,e,t);t=previousBlockOf(n),this.#I.push(...r)}this.#L=t}#Wn(){let e=this.#O,t=this.#N;if(e===void 0&&t===void 0)return[];let n={name:e?.name??t?.name,theme:this.#i,width:this.#rr()};return e?.info!==void 0&&(n.info=e.info),buildAgentHeader(n)}#Gn(e,t,n){let r={renderMarkdown:this.#a,activityPulse:this.#qn(this.#ve,this.#i.unicode?PROGRESS_PULSE_GLYPH:PROGRESS_PULSE_ASCII_GLYPH)};n!==void 0&&(r.previous=n),this.#Xe!==void 0&&(r.setupFlowOpen=!0),this.#Je!==void 0&&(r.transientPanelOpen=!0);let i=renderBlockLines(e,t,this.#i,r);return(e.depth??0)===0&&leadsWithGap(e,n)?[``,...i]:i}#Kn(){return this.#i.spinner[this.#_e%this.#i.spinner.length]??``}#qn(e,t){return isProgressPulseVisible(Date.now()-e)?t:` `}#Jn(e){return{glyph:this.#qn(e.startedAtMs,this.#i.unicode?PROGRESS_PULSE_GLYPH:PROGRESS_PULSE_ASCII_GLYPH)}}#Yn(e){let t=this.#i.colors,n=[``];if(this.#Je!==void 0){let t=this.#Je(e);return[...t.rows,...t.controls]}if(this.#qe!==void 0){let t=this.#qe(e);return[...n,...t.rows,...t.controls]}let r=this.#Xe;if(r!==void 0&&(this.#A===void 0||r.question!==void 0)){let t=this.#Jn(r),i;if(r.status!==void 0){let{startedAtMs:e,...n}=r.status,a=Date.now()-e,o=a>=5e3?` ${formatTurnDuration(a)}`:``;i={...n,text:`${n.text}${o}`,indicator:t}}let a;if(r.question!==void 0){let t=r.question(e);a={kind:`question`,title:r.questionTitle,rows:t},i!==void 0&&(a={kind:`question`,title:r.questionTitle,rows:t,status:i})}else i===void 0?a=r.preview===void 0?{kind:`idle`,indicator:t}:{kind:`preview`,text:r.preview,indicator:t}:(a={kind:`status`,status:i},r.preview!==void 0&&(a={kind:`status`,status:i,preview:r.preview}));let o={title:r.title,navigation:r.navigation,lines:r.summary===void 0?r.hideLinesWhileQuestion===!0?[]:r.lines:[{text:r.summary.headline,tone:`success`},...r.summary.facts.map(e=>({text:`${e.label}: ${e.value}`,tone:`info`}))],content:a},s=renderFlowDrawer(o,this.#i,e);return n.length===1&&n[0]===``&&(n.length=0),n.push(...s.rows),s.controls.length>0&&n.push(...s.controls),this.#tr(n,e),n}r!==void 0&&n.push(...flowMessageRows(r.lines,this.#i).map(t=>t.length===0?``:clip(` ${t}`,e))),this.#k===void 0&&this.#Ze!==void 0&&n.push(...renderAttentionRows(this.#Ze,e,this.#i),``);let i=renderMessageQueueRows({view:this.#et.view(),width:e,theme:this.#i,working:this.#ne});if(i.length>0&&n.push(...i,``),this.#G){let r=this.#K===void 0?void 0:inlineCommandHint(this.#K),i=this.#pt(e);this.#pe&&n.push(clip(t.dim(`Press Ctrl+C again to exit`),e),``);let a=r?t.dim(` ${r}`):``,o=[];this.#er(o,e);let s=Math.max(1,this.#ir()-1-n.length-1-i.length-o.length-(i.length>0?2:0)),c={text:this.#V,cursor:this.#H,width:e,theme:this.#i,caretVisible:this.#ge,ghost:a,maxRows:s};this.#Z&&this.#V.length===0&&(c.placeholder=this.#A===void 0?this.#Q?``:`Send a message…`:`Message · Enter to queue`);let l=promptInputRows(c);return i.length>0&&l.at(-1)===``&&l.pop(),n.push(...l),i.length>0&&n.push(t.dim(this.#i.glyph.dash.repeat(e))),n.push(...i),i.length>0&&o.length>0&&n.push(t.dim(this.#i.glyph.dash.repeat(e))),n.push(...o),n}let a=this.#re.kind===`waiting`&&this.#oe===void 0;if(this.#ne||a){n.push(this.#Xn(e)),this.#Qn(n,e);let t=[];return this.#er(t,e),!this.#ne&&t.length>0&&n.push(``),n.push(...t),n}if(this.#te.text.length>0)return this.#$n(n,e,{inert:!1}),this.#er(n,e),n;let o=this.#oe??(this.#ae.length>0?this.#ae:`Ready`),s=this.#nr(),c=t.dim(this.#i.glyph.dot),l=s?`${c} ${o} ${t.dim(this.#i.glyph.dot)} ${s}`:`${c} ${o}`;return n.push(clip(l,e)),this.#er(n,e),n}#Xn(e){let t=this.#i.colors,n=this.#re,r=this.#$.startedAtMs??this.#Ie??(n.kind===`waiting`?n.startedAtMs:Date.now()),i=Math.max(0,Date.now()-r),a=i%1e3<500?this.#i.unicode?`•`:`*`:` `,o=i<1e3?`0s`:formatTurnDuration(Math.floor(i/1e3)*1e3),s=`${turnActivityLabel(this.#ee)} (${o})`,{inputTokens:c,outputTokens:l}=this.#$.usage;return clip(`${a} ${s}${c>0||l>0?t.dim(` (${formatTokenFlow({inputTokens:c,outputTokens:l},this.#i.glyph)})`):``}`,e)}#Zn(e){let{inputTokens:t,outputTokens:n}=this.#$.usage,r=t===0&&n===0?``:` (${formatTokenFlow({inputTokens:t,outputTokens:n},this.#i.glyph)})`;return`${formatTurnDuration(e)}${r}`}#Qn(e,t){this.#ne&&this.#$n(e,t,{inert:!0})}#$n(e,t,n){e.push(``);let r={text:this.#te.text,cursor:this.#te.cursor,width:t,theme:this.#i,caretVisible:!0,ghost:``,maxRows:4,inert:n.inert};n.inert&&this.#te.text.length===0&&(r.placeholder=``),e.push(...promptInputRows(r))}#er(e,t){if(this.#k!==void 0){let n=this.#Xe?.status?.text??{starting:`Starting agent…`,connecting:`Reading saved connection…`,updating:`Loading selected model…`}[this.#k],r=this.#qn(this.#M,this.#i.unicode?PROGRESS_PULSE_GLYPH:PROGRESS_PULSE_ASCII_GLYPH);e.push(clip(this.#i.colors.dim(`${r} ${n}`),t));return}let n=this.#B===void 0?``:` `,r=Math.max(1,t-n.length),i={theme:this.#i,width:r};this.#Ue&&this.#He!==void 0&&(i.devBuild=this.#He),this.#Se&&(i.logLevel=this.#m);let a=this.#O?.info?.agent.model;a?.routing.kind===`dynamic`?i.model=this.#Qe===void 0?`dynamic model`:`dynamic model · ${this.#Qe}`:a?.id!==void 0&&(i.model=a.id),a?.reasoning!==void 0&&a.reasoning!==`provider-default`&&(i.reasoning=a.reasoning),readGatewayServiceTier(a?.providerOptions).kind===`priority`&&(i.fastMode=!0);let o=a?.endpoint;o!==void 0&&(i.endpoint=o),this.#z!==void 0&&(i.vercel=this.#z),this.#B!==void 0&&(i.remote=this.#B);let s=buildStatusLine(i);s!==void 0&&e.push(clip(`${n}${s}`,t))}#tr(e,t){if(this.#B===void 0)return;let n=Math.max(1,t-2),r=buildStatusLine({remote:this.#B,theme:this.#i,width:n});r!==void 0&&e.push(``,clip(` ${r}`,t))}#nr(){let e=this.#i.colors,t=[],n=formatAssistantResponseStats({totalTokens:this.#je,outputTokens:this.#Pe,tokensPerSecond:this.#Fe},this.#u);return n&&t.push(n),t.length>0?e.dim(t.join(` ${this.#i.glyph.dot} `)):``}#rr(){return Math.max(20,this.#t.columns||80)}#ir(){return Math.max(8,this.#t.rows||24)}#ar(){if(this.#Le!==void 0||!this.#d)return;this.#Re=``,this.#ze=``;let capture=(e,t)=>{let n=e.write.bind(e);return e.write=((e,n,r)=>{let i=typeof n==`string`?n:void 0,a=typeof n==`function`?n:r;return this.#cr(t,chunkToString(e,i)),a?.(),!0}),()=>{e.write=n}},e=capture(process.stdout,`stdout`),t=capture(process.stderr,`stderr`);this.#f?.subscribeLogRecords(e=>this.#sr(e)),this.#Le=()=>{this.#f?.unsubscribeLogRecords(),e(),t()}}#or(){let e=this.#Le;e!==void 0&&(this.#Le=void 0,e(),this.#Re.length>0&&(this.#f?.append({source:`stdout`,detail:this.#Re}),this.#_r(`stdout`)&&process.stdout.write(`${this.#Re}\n`),this.#Re=``),this.#ze.length>0&&(this.#f?.append({source:`stderr`,detail:this.#ze}),this.#_r(`stderr`)&&process.stderr.write(`${this.#ze}\n`),this.#ze=``))}#sr(e){let t=e.fields===void 0?``:` ${JSON.stringify(e.fields)}`;this.#ur(`[eve:${e.namespace}] ${e.message}${t}`),this.#zn()}#cr(e,t){let n=(e===`stdout`?this.#Re:this.#ze)+t;if(e===`stdout`&&parseDevRebuildLogLine(n.trimEnd())!==void 0){this.#Re=``,this.#f?.append({source:e,detail:n.trimEnd()}),this.#lr(n.trimEnd()),this.#zn();return}let r=n.lastIndexOf(`
7
- `),i=r===-1?n:n.slice(r+1);if(e===`stdout`?this.#Re=i:this.#ze=i,r===-1)return;let a=stripAnsi(n.slice(0,r)).replace(/\s+$/u,``);a.trim().length!==0&&(this.#f?.append({source:e,detail:a}),e===`stdout`?this.#lr(a):this.#ur(a),this.#zn())}#lr(e){let t=[],flushPending=()=>{if(t.length===0)return;let e=t.join(`
8
- `);t=[],e.trim().length!==0&&this.#_n({kind:`log`,title:`stdout`,body:e,live:!0})};for(let n of e.split(`
9
- `)){let e=parseSandboxLogLine(n.trimEnd());if(e!==void 0){flushPending(),this.#_n({kind:`sandbox`,body:e,live:!1});continue}let r=parseDevRebuildLogLine(n.trimEnd());if(r===void 0){t.push(n);continue}flushPending(),this.#fr(r,n.trimEnd())}flushPending()}#ur(e){let t=e.split(`
10
- `),n=t.findIndex(e=>parseDevRebuildLogLine(e.trimEnd())?.kind===`failed`);if(n===-1){if(this.#f===void 0){this.#_n({kind:`log`,title:`stderr`,body:e,live:!0});return}let t=presentDiagnostic(e,this.#f.displayPath);if(t.kind===`inline`){this.#_n({kind:`log`,title:`stderr`,body:t.text,live:!0});return}this.#_n({kind:`log`,title:`stderr`,body:formatStoredDiagnostic(t),logVisibility:`stderr-only`,live:!0}),this.#_n({kind:`log`,title:`stderr`,body:e,logVisibility:`all-only`,live:!0});return}let r=t.slice(0,n).join(`
11
- `);r.trim().length>0&&this.#_n({kind:`log`,title:`stderr`,body:r,live:!0});let i=t.slice(n).join(`
12
- `);this.#dr(i)}#dr(e){if(this.#mr(),this.#m===`all`){if(e.trim().length===0)return;this.#_n({kind:`log`,title:`stderr`,body:e,live:!0});return}this.#Be=e}#fr(e,t){let n=this.#hr();if(e.kind===`failed`){this.#dr(t);return}if(e.kind===`rebuilding`){let t=summarizeChangedFiles(e.events,e.more);if(this.#pr({phase:`building`,summary:t}),n!==void 0){n.state.summary=t,n.block.body=formatDevRebuildStatus(t,`rebuilding`);return}let r=`dev-rebuild:${this.#Ge}`;this.#Ge+=1,this.#Ve={id:r,summary:t},this.#_n({kind:`log`,id:r,title:`stdout`,body:formatDevRebuildStatus(t,`rebuilding`),live:!0});return}let r=n?.state.summary??this.#He?.summary;if(r!==void 0&&this.#pr({phase:`complete`,summary:r}),n!==void 0){n.block.body=formatDevRebuildStatus(n.state.summary,e.kind),e.kind===`rebuilt`&&(this.#Be=void 0);return}e.kind===`rebuilt`&&(this.#Be=void 0),this.#_n({kind:`log`,title:`stdout`,body:t,live:!0})}#pr(e){this.#We!==void 0&&clearTimeout(this.#We),this.#He=e,this.#Ue=e.phase===`complete`,this.#We=setTimeout(()=>{e.phase===`building`?(this.#Ue=!0,this.#We=void 0):this.#mr(),this.#zn()},e.phase===`building`?250:4e3)}#mr(){this.#We!==void 0&&clearTimeout(this.#We),this.#He=void 0,this.#Ue=!1,this.#We=void 0}#hr(){let e=this.#Ve;if(e===void 0)return;let t=this.#g.get(e.id);if(t!==void 0&&t.live===!0)return{state:e,block:t}}#gr(){let e=this.#Ve;if(e===void 0)return;this.#Ve=void 0;let t=this.#g.get(e.id);t!==void 0&&(t.live=!1)}#_r(e){switch(this.#m){case`none`:return!1;case`stderr`:return e===`stderr`;case`sandbox`:return e===`sandbox`;case`all`:return!0}}#vr(e){return e.kind===`sandbox`?!this.#_r(`sandbox`):e.kind===`log`?e.logVisibility===`stderr-only`?this.#m!==`stderr`:e.logVisibility===`all-only`?this.#m!==`all`:!this.#_r(e.title===`stderr`?`stderr`:`stdout`):!1}};function chunkToString(e,t){return typeof e==`string`?e:Buffer.from(e).toString(t)}async function*iterateTUIStream(e){if(e instanceof ReadableStream){let t=e.getReader();try{for(;;){let{done:e,value:n}=await t.read();if(e)return;yield n}}finally{t.releaseLock()}return}yield*e}function clip(e,t){return clipVisible(e,t)}function promptInputRows({text:e,cursor:t,width:n,theme:r,caretVisible:i,ghost:a,maxRows:o,placeholder:s,inert:c}){let l=r.colors;if(e.length===0&&s!==void 0){let e=renderInputWithBlockCursor({...visibleLine({text:s,cursor:0},Math.max(1,n-3),r.glyph.ellipsis),visible:i,inverse:l.inverse,render:e=>l.dim(renderInputText(e))});return[clip(`${r.glyph.prompt} ${e}`,n),``]}let u=renderInputText,d=layoutPromptInput({text:e,cursor:t}),f=Math.min(Math.max(1,o),d.rows.length),p=Math.max(0,Math.min(d.caretRow-f+1,d.rows.length-f)),m=c===!0?l.dim(r.glyph.prompt):e.startsWith(`/`)?r.glyph.user:r.glyph.prompt,h=l.dim(r.glyph.ellipsis),g=Math.max(1,n-3),_=[];for(let e=p;e<p+f;e+=1){let t=d.rows[e],o=e===0?m:` `;(e===p&&p>0||e===p+f-1&&p+f<d.rows.length)&&(o=h);let s;if(e===d.caretRow){let{before:e,under:n,after:o}=visibleLine({text:t.text,cursor:d.caretOffset},g,r.glyph.ellipsis);s=renderInputWithBlockCursor({before:e,under:n,after:o,visible:i,inverse:l.inverse,render:u}),a.length>0&&d.rows.length===1&&(s+=a)}else s=u(t.text);_.push(clip(`${o} ${s}`,n))}return _.push(``),_}function previousBlockOf(e){let t={kind:e.kind};return e.title!==void 0&&(t.title=e.title),t}function isActiveToolStatus(e){return e===`running`||e===`approval`}function applyCohortLiveness(e){let t=e.some(e=>e.active);for(let n of e)n.block.live=t||n.active}function leadsWithGap(e,t){if(e.kind===`tool`&&(t?.kind===`user`||t?.kind===`assistant`||t?.kind===`question`))return!0;if(e.kind===`sandbox`&&t?.kind===`sandbox`)return!1;if(t?.kind===`sandbox`&&e.kind!==`sandbox`||t?.kind===`log`)return!0;switch(e.kind){case`user`:case`assistant`:case`reasoning`:case`subagent`:case`error`:case`notice`:case`question`:case`connection-auth`:case`sandbox`:case`log`:case`command`:case`warning`:case`flow`:case`turn-stats`:case`session-boundary`:case`agent-header`:return!0;default:return!1}}function parseSandboxLogLine(e){let t=e.trim();if(!t.startsWith(`eve: `))return;let n=t.slice(5);return/\bsandbox\b/i.test(n)&&!isLowValueSandboxLogLine(n)?n:void 0}function isLowValueSandboxLogLine(e){return/^initializing (?:\d+ )?sandbox templates?\b/i.test(e)||/^initialized \d+ sandbox\b/i.test(e)||/^reused cached sandbox template\b/i.test(e)||/^sandbox template "[^"]+" \([^)]+\): (checking|reusing|loading microsandbox runtime|microsandbox runtime ready)\b/i.test(e)}function clipLiveRows(e,t,n,r){if(e.length<=t)return[...e];if(t<=1)return[clip(hiddenRowsMarker(e.length,r),n)];let i=t-1;return[clip(hiddenRowsMarker(e.length-i,r),n),...e.slice(e.length-i)]}function hiddenRowsMarker(e,t){let n=e.toLocaleString(),r=e===1?`row`:`rows`;return t.colors.dim(`${t.glyph.dot} ${t.glyph.ellipsis} ${n} earlier ${r} hidden while streaming`)}function collapseReasoning(e,t){switch(e){case`collapsed`:return!0;case`auto-collapsed`:return!t;default:return!1}}function renderNativeToolBlock(e,t,n,r){let i=e.preparing===!0?presentPreparingTool(e.toolName,r):presentTool(e.toolName,e.input,r),a={id:t,kind:`tool`,title:stripTerminalControls(i.title),subtitle:stripTerminalControls(i.subtitle),status:e.status,live:e.status===`running`||e.status===`approval`,expanded:n,toolInput:e.input,toolName:e.toolName,toolGroup:i.group};return i.doneTitle!==void 0&&(a.doneTitle=stripTerminalControls(i.doneTitle)),i.detail!==void 0&&(a.detailLines=i.detail,a.keepDetailWhenDone=i.keepDetailWhenDone===!0),e.output===void 0?e.errorText!==void 0&&(a.result=stripTerminalControls(e.errorText)):(a.result=i.summarizeResult(e.output),a.toolOutput=e.output),a}function writeExistedFlag(e){if(typeof e!=`object`||!e||Array.isArray(e))return;let t=e.existed;return typeof t==`boolean`?t:void 0}function subagentToolStatus(e){switch(e){case`preparing`:return`running`;case`approval-requested`:return`approval`;case`executing`:return`running`;case`done`:return`done`;case`failed`:return`error`;case`rejected`:return`denied`}}function formatToolApprovalTitle(e){return stripTerminalControls(e.title??e.toolName)}function toolSectionId(e){return`tool:${e}`}function questionSectionId(e){return`question:${e}`}function subagentHeaderId(e){return`subagent:${e}:header`}function subagentStepSectionId(e,t){return`subagent:${e}:step:${t}`}function subagentToolSectionId(e,t){return`subagent:${e}:tool:${t}`}function connectionAuthSectionId(e){return`connection-auth:${e}`}function connectionAuthTerminalMessage(e){switch(e){case`authorized`:return`Authorization complete`;case`declined`:return`Authorization declined`;case`failed`:return`Authorization failed`;case`timed-out`:return`Authorization timed out`;case`required`:case`pending`:return}}function formatConnectionAuthContent(e,t){let n=[];if(t!==void 0)n.push(t);else{let t=stripTerminalControls(e.description);t.length>0&&n.push(t);let r=e.challenge;r?.url&&n.push(`URL: ${stripTerminalControls(r.url)}`),r?.userCode&&n.push(`Code: ${stripTerminalControls(r.userCode)}`),r?.expiresAt&&n.push(`Expires: ${stripTerminalControls(r.expiresAt)}`),r?.instructions&&n.push(stripTerminalControls(r.instructions))}if(e.reason!==void 0){let t=stripTerminalControls(e.reason);t.length>0&&n.push(`Reason: ${t}`)}return n.join(`
13
- `)}function resolveQuestionText(e,t){let n=e.trim();if(n.length===0)return;let r=n.toLowerCase(),i=t.options??[];if(i.length>0){let e=matchQuestionOption(r,i);if(e!==void 0)return{optionId:e.id,label:e.label}}if(t.allowFreeform===!0||i.length===0)return{text:n,label:n}}function matchQuestionOption(e,t){let n=t.find(t=>t.id.toLowerCase()===e);if(n!==void 0)return n;let r=t.find(t=>t.label.toLowerCase()===e);if(r!==void 0)return r;let i=Number(e);if(Number.isInteger(i)&&i>0&&i<=t.length)return t[i-1]}export{TerminalRenderer};
1
+ import{setConsoleRecordSubscriber}from"../console-records.js";import{buildAgentHeader}from"./agent-header.js";import{PROMPT_COMMANDS,isPromptControlCommand,parsePromptCommand,promptCommandSpec}from"./prompt-commands.js";import{argumentTypeaheadCompletion,argumentTypeaheadFor,argumentTypeaheadLoadingLabel,argumentTypeaheadQuery,moveArgumentTypeaheadSelection,renderArgumentSuggestions,selectedArgumentSuggestion}from"./argument-typeahead.js";import{detectMarkdownRendering}from"./markdown.js";import{renderAttentionRows,renderBlockLines}from"./blocks.js";import{copyTextToClipboard}from"./clipboard.js";import{dismissTypeahead,inlineCommandHint,isTypeaheadOpen,moveTypeaheadSelection,renderCommandSuggestions,selectedTypeaheadCommand,typeaheadCompletion,typeaheadFor}from"./command-typeahead.js";import{interruptedError}from"./errors.js";import{formatDevRebuildStatus,summarizeChangedFiles}from"./dev-rebuild-status.js";import{formatStoredDiagnostic,presentDiagnostic}from"./diagnostic-presentation.js";import{EMPTY_LINE,KillRing,PromptHistory,applyLineEditorKey,deleteForward,layoutPromptInput,lineOf,movePromptLine,visibleLine}from"./line-editor.js";import{enterBadge,flowMessageRows,renderAcknowledgeQuestion,renderSelectQuestion,renderTextQuestion}from"./setup-panel.js";import{renderFlowDrawer,renderTransientDrawer}from"./flow-drawer.js";import{isLogVisible,nextLogDisplayMode}from"./log-display-mode.js";import{MessageQueue,renderMessageQueueRows}from"./message-queue.js";import{initialPromptPlaceholder}from"./prompt-placeholder.js";import{initialProviderPickerState,transitionProviderPicker}from"./provider-picker.js";import{inputContextLabel,renderQuestionChoices,renderQuestionPanel}from"./question-panel.js";import{formatAssistantResponseStats,formatTokenFlow,formatTurnDuration,isIncompleteOsc,isIncompletePaste,nextKey,sanitizePastedText,stripPasteStart,stripPromptControlCharacters}from"./stream-format.js";import{groupToolBlocksForDisplay}from"./tool-block-groups.js";import{renderTaskPanelRows}from"./task-activity.js";import{ConversationTranscript,TASK_END_GRACE_MS,turnActivity}from"./transcript.js";import{TraceViewerSession}from"./traces/trace-viewer-session.js";import{buildStatusLine}from"./status-line.js";import{createTheme,detectUnicode}from"./theme.js";import{TurnClock}from"./turn-clock.js";import{reduceSetupSelectInput,setupSelectionIntent}from"./setup-selection-input.js";import{BACKGROUND_COLOR_QUERY,parseBackgroundColorReply}from"./terminal-background.js";import{eveVersionTag}from"#cli/banner.js";import{format}from"node:util";import{clipVisible,renderInputText,renderInputWithBlockCursor,stripAnsi,stripTerminalControls,wrapVisibleLine}from"#cli/ui/terminal-text.js";import{initialSelectState,orderedSelection,reduceSelect,searchActionQuery,selectValueAtCursor}from"#setup/cli/select-state.js";import{toErrorMessage}from"#shared/errors.js";import{StringDecoder}from"node:string_decoder";import{parseDevRebuildLogLine}from"#internal/nitro/host/dev-watcher-log.js";import{LiveRegion}from"#cli/ui/live-region.js";import{AltScreen}from"#cli/ui/alt-screen.js";import{PROGRESS_PULSE_ASCII_GLYPH,PROGRESS_PULSE_GLYPH,isProgressPulseVisible}from"#cli/ui/progress-pulse.js";import{readGatewayServiceTier}from"#shared/gateway-service-tier.js";function isMultiSelectRequest(e){return e.kind===`multi`||e.kind===`searchable-multi`}function moveActionCursor(e,t,n){return n===0?void 0:e===void 0?t===`down`?0:n-1:(e+(t===`down`?1:-1)+n)%n}const incompletePasteFlushMs=1e3;var TerminalRenderer=class{#e;#t;#n;#r;#i;#a;#o;#s;#c;#l;#u;#d;#f;#p;#m;#h=[];#g=new Map;#_;#v=new Set;#y=[];#b=0;#x=new ConversationTranscript;#S;#C;#w=new Set;#T=[];#E;#D=`Send a message…`;#O;#k;#A;#j;#M=0;#N;#P=!1;#F;#I=[];#L;#R;#z;#B=``;#V=0;#H=new PromptHistory;#U=new KillRing;#W=!1;#G;#K;#q;#J=new Map;#Y=new Map;#X=!1;#Z=!1;#Q=new TurnClock;#$;#ee=EMPTY_LINE;#te;#ne=!1;#re;#ie;#ae=`eve`;#oe=!1;#se=!1;#ce=!1;#le=!1;#ue=!1;#de=!1;#fe;#pe=!0;#me=0;#he=Date.now();#ge;#_e;#ve;#ye=!1;#be;#xe=``;#Se=new StringDecoder(`utf8`);#Ce;#we;#Te=!1;#Ee=!1;#De;#Oe;#ke=``;#Ae=``;#je;#Me;#Ne;#Pe=!1;#Fe;#Ie=0;#Le;#Re;#ze;#Be;#Ve;#He=new MessageQueue;#Ue;#We;#Ge;#Ke;#qe;setupFlow={begin:e=>this.#st(e),setNavigation:e=>this.#ct(e),end:e=>this.#lt(e?.preserveDiagnostics??!0),readSelect:e=>this.#ut(e),readEditableSelect:e=>this.#ft(e),readProviderPicker:e=>this.#pt(e),readText:e=>this.#mt(e),readAcknowledge:e=>this.#ht(e),readChoice:e=>this.#dt(e),setStatus:e=>this.#Ct(e),renderLine:(e,t)=>this.#wt(e,t),replaceContent:e=>this.#Tt(e),renderOutput:e=>this.#Et(e),withInheritedStdio:e=>this.#Dt(e),withExclusiveTerminal:e=>this.#Dt(e),waitForInterrupt:e=>this.#bt(e)};traceViewer={open:e=>this.#kt(e)};constructor(e){this.#e=e?.input??process.stdin,this.#t=e?.output??process.stdout,this.#n=new LiveRegion(this.#t),this.#r=new AltScreen(this.#t),this.#i=createTheme({color:e?.color??!0,unicode:e?.unicode??detectUnicode()}),this.#a=e?.renderMarkdown??detectMarkdownRendering(),this.#o=e?.tools??`auto-collapsed`,this.#s=e?.reasoning??`auto-collapsed`,this.#c=e?.subagents??`collapsed`,this.#l=e?.connectionAuth??`full`,this.#u=e?.assistantResponseStats??`tokensPerSecond`,this.#De=e?.contextSize,this.#d=e?.captureForeignOutput??this.#t===process.stdout,this.#f=e?.diagnostics,this.#fe=e?.onExitRequest,this.#q=e?.argumentSuggestions,this.#m=e?.logs??`error`,this.#p=e?.availablePromptCommands??PROMPT_COMMANDS}#Je(e){this.#G=typeaheadFor(this.#p,e,this.#G);let t=argumentTypeaheadQuery(e);if(t===void 0||this.#q===void 0){this.#K=void 0;return}let n=this.#J.get(t.command);if(n===void 0){this.#J.set(t.command,{kind:`loading`,visible:!1});let e=t.command;this.#Y.set(e,setTimeout(()=>{this.#Y.delete(e),this.#J.get(e)?.kind===`loading`&&(this.#J.set(e,{kind:`loading`,visible:!0}),this.#on())},500)),this.#q(e).catch(()=>[]).then(t=>{let n=this.#Y.get(e);n!==void 0&&clearTimeout(n),this.#Y.delete(e),this.#J.set(e,{kind:`ready`,suggestions:t}),this.#W&&this.#Je(this.#B),this.#on()}),this.#K=void 0;return}if(n.kind===`loading`){this.#K=void 0;return}this.#K=argumentTypeaheadFor(t,n.suggestions,this.#K)}#Ye(e){let t=argumentTypeaheadQuery(this.#B),n=t===void 0?void 0:this.#J.get(t.command);return n?.kind===`loading`&&n.visible&&t!==void 0?[clip(this.#i.colors.dim(`Loading ${argumentTypeaheadLoadingLabel(t.command)}…`),e)]:this.#K===void 0?this.#G!==void 0&&isTypeaheadOpen(this.#G)?renderCommandSuggestions(this.#G,this.#i,e):[]:renderArgumentSuggestions(this.#K,this.#i,e)}setStartupPhase(e){this.#k=e,e===void 0?this.#qt():this.#Kt(),this.#on()}renderAgentHeader(e){this.#N=void 0,this.#ae=e.name,this.#E=e,this.#O=e.info?.subagents.local.map(e=>e.name),this.#D=initialPromptPlaceholder(e.info,e.localDevelopment===!0),this.#Mt();let t=this.#dn().join(`
2
+ `);if(this.#P){t!==this.#F&&(this.#F=t,this.#en({kind:`agent-header`,body:t,live:!1})),this.#on();return}this.#P=!0,this.#F=t,this.#n.flush(this.#dn(),this.#gn(this.#Cn()))}beginStartupDraft(e){this.#Mt({title:e.title}),this.#W=!0,this.#X=!0,this.#k=`starting`,this.#N={name:e.title},this.#M=Date.now();let t=lineOf(stripPromptControlCharacters(e.initialDraft??``));this.#A=t,this.#et(t),this.#Ut(),this.#Kt(),this.#on();let apply=e=>{t=e,this.#A=e,this.#Gt(),this.#et(t),this.#on()};this.#j=e=>{if(e.type===`escape`&&this.#We!==void 0){this.#We(`escape`);return}if(e.type===`ctrl-c`&&this.#We!==void 0){this.#Ot(),this.#We(`ctrl-c`);return}let n=this.#U.apply(t,e,{multiline:!0});if(n!==void 0){apply(n);return}if(e.type===`enter`&&t.text.trim().length>0){this.#He.enqueue(t.text)&&apply(EMPTY_LINE);return}e.type===`ctrl-c`&&this.#fe?.()},this.#Xe()}#Xe(){this.#A!==void 0&&this.#j!==void 0&&(this.#Ht(),this.#et(this.#A),this.#W=!0,this.#be=this.#j,this.#Ft())}finishStartupDraft(){let e={draft:this.#A?.text??this.#B,queuedPrompt:this.#He.takePrompt()};return this.#A=void 0,this.#j=void 0,this.#It(),this.#Wt(),this.#W=!1,this.#X=!1,e}async readInput(e){this.#Mt(e),this.#C?.working!==!0&&this.#tn(),this.#W=!0,this.#X=!0,this.#ue=this.#de,this.#de=!1;let t=e?.initialDraft===void 0?this.#ee:lineOf(stripPromptControlCharacters(e.initialDraft));return this.#H.begin(t.text),this.#et(t),this.#Je(t.text),this.#Ut(),this.#on(),await new Promise((n,r)=>{let i=e?.signal,release=()=>{this.#te=void 0,i?.removeEventListener(`abort`,onAbort),this.#G=void 0,this.#K=void 0,this.#W=!1,this.#Wt(),this.#It(),this.#on()},finish=e=>{release(),n(e)},onAbort=()=>finish(void 0);if(i?.addEventListener(`abort`,onAbort,{once:!0}),i?.aborted){onAbort();return}this.#re=e=>{i?.removeEventListener(`abort`,onAbort),r(e)};let apply=e=>{t=e,this.#ee=e,this.#Gt(),this.#et(t),this.#Je(e.text),this.#on()};this.#te=apply;let recall=e=>{e!==void 0&&apply(lineOf(e))},interrupt=()=>{this.#G=void 0,this.#Wt(),this.#Pt(),r(interruptedError())},cancel=()=>{this.#ne=!0,finish({type:`cancel`})},suggestions=()=>this.#G!==void 0&&isTypeaheadOpen(this.#G)?this.#G:void 0,argumentSuggestions=()=>this.#K?.suggestions.length?this.#K:void 0,highlighted=()=>{let e=suggestions();return e===void 0?void 0:selectedTypeaheadCommand(e)};this.#be=e=>{e.type!==`ctrl-c`&&this.#ue&&(this.#ue=!1,this.#on());let n=this.#U.apply(t,e,{multiline:!0});if(n!==void 0){apply(n);return}let r=this.#C?.working===!0;switch(e.type){case`up`:case`ctrl-p`:{let e=argumentSuggestions();if(e!==void 0){this.#K=moveArgumentTypeaheadSelection(e,-1),this.#on();break}let n=suggestions();if(n!==void 0){this.#G=moveTypeaheadSelection(n,-1),this.#on();break}let r=movePromptLine(t,`up`);r===void 0?recall(this.#H.previous(t.text)):apply(r);break}case`down`:case`ctrl-n`:{let e=argumentSuggestions();if(e!==void 0){this.#K=moveArgumentTypeaheadSelection(e,1),this.#on();break}let n=suggestions();if(n!==void 0){this.#G=moveTypeaheadSelection(n,1),this.#on();break}let r=movePromptLine(t,`down`);r===void 0?recall(this.#H.next()):apply(r);break}case`tab`:{let e=argumentSuggestions(),t=e===void 0?void 0:selectedArgumentSuggestion(e);if(e!==void 0&&t!==void 0){apply(lineOf(argumentTypeaheadCompletion(e,t)));break}let n=highlighted();n!==void 0&&apply(lineOf(typeaheadCompletion(n)));break}case`escape`:{if(this.#K!==void 0){this.#K=void 0,this.#on();break}let e=suggestions();if(e!==void 0){this.#G=dismissTypeahead(e),this.#on();break}r&&!this.#ne&&cancel();break}case`enter`:{let e=argumentSuggestions(),n=e===void 0?void 0:selectedArgumentSuggestion(e),i=highlighted();if(e!==void 0&&n?.next!==void 0&&e.completed.length===0){apply(lineOf(`${argumentTypeaheadCompletion(e,n)} `));break}if(e===void 0&&i!==void 0&&this.#q!==void 0&&(i.name===`add`||i.name===`login`||i.name===`loglevel`||i.name===`model`)){apply(lineOf(typeaheadCompletion(i)));break}let a=e!==void 0&&n!==void 0?argumentTypeaheadCompletion(e,n):i!==void 0&&parsePromptCommand(t.text)===null?typeaheadCompletion(i).trimEnd():t.text;if(a.trim().length===0)break;promptCommandSpec(a)?.spec.history!==`omit`&&this.#H.add(a),this.#ee=EMPTY_LINE,this.#et(EMPTY_LINE),isPromptControlCommand(a)?(this.#at(stripTerminalControls(a.trim())),r&&parsePromptCommand(a)?.type===`cancel`&&(this.#ne=!0)):(this.#Z=!0,this.#f?.recordPrompt(),r&&this.#T.push(a)),finish({type:`submit`,text:a});break}case`ctrl-d`:t.text.length===0?(this.#Ot(),interrupt()):apply(deleteForward(t));break;case`ctrl-l`:this.#ln();break;case`ctrl-r`:this.#on();break;case`ctrl-c`:if(r){if(!this.#ne){cancel();break}this.#ne=!1,this.#de=!0,finish({type:`interrupt`});break}if(this.#ue){this.#Ot(),interrupt();break}this.#ue=!0,apply(EMPTY_LINE)}},this.#Ft()})}renderConversation(e){let t=this.#C?.working===!0;this.#C=e,e.conversation.messages.some(e=>e.role===`user`)&&(this.#Z=!0);let n=this.#x.project(e,this.#Qe());this.#Xt();let r=new Set;for(let[e,t]of n.entries()){let i=t.id;if(this.#v.has(i))continue;r.add(i);let a=this.#g.get(i);if(a!==t){if(t.updateSeq=++this.#b,a!==void 0){this.#h[this.#h.indexOf(a)]=t,this.#g.set(i,t);continue}if(t.kind===`user`){let e=this.#T.indexOf(t.body??``);e!==-1&&(this.#T.splice(e,1),t.promptOrigin=`steer`)}this.#Ze(t,n.slice(e+1))}}for(let e of this.#w)r.has(e)||this.#an(e);this.#w=r,e.working&&!t?this.#Q.armed||this.#Q.arm(e.data.usage):!e.working&&t&&(this.#ne=!1,this.#W&&this.#tn()),this.#$t(),this.#on()}#Ze(e,t){let n=t.find(e=>this.#g.has(e.id)),r=n===void 0?-1:this.#h.indexOf(this.#g.get(n.id));if(r===-1){this.#en(e);return}e.id!==this.#Me?.id&&this.#Ln(),this.#h.splice(r,0,e),this.#g.set(e.id,e)}#Qe(){return{tools:this.#o,reasoning:this.#s,subagents:this.#c,connectionAuth:this.#l,subagentNames:this.#O,diagnosticsPath:this.#f?.displayPath,dot:this.#i.glyph.dot}}#$e(e){if(e?.taskId===void 0||e.requester!==void 0||this.#C===void 0)return inputContextLabel(e,this.#i);let t=this.#x.taskLabel(this.#C.conversation,e.taskId);return inputContextLabel(t===void 0?e:{...e,requester:t},this.#i)}#et(e){this.#B=e.text,this.#V=e.cursor}async readToolApproval(e,t){this.#Mt(t),this.#W=!1;let n=0;return this.#Le=t=>renderTransientDrawer([` ${this.#i.colors.bold(`Approve ${formatToolApprovalTitle(e)}?`)}`,``,...renderQuestionChoices([{id:`yes`,label:`Yes`},{id:`no`,label:`No`}],n,this.#i)],[`y yes · n no · Ctrl-C cancel`],this.#i,t,this.#$e(e.context),!1,`left`),this.#on(),await new Promise((e,t)=>{let approve=()=>{this.#Le=void 0,this.#It(),this.#on(),e({approved:!0})},deny=()=>{this.#Le=void 0,this.#It(),this.#on(),e({approved:!1,reason:`Denied by user.`})};this.#re=t,this.#be=e=>{switch(e.type){case`text`:{if(e.framing!==`unframed`)break;let t=e.value.toLowerCase();t===`y`?approve():t===`n`&&deny();break}case`up`:case`ctrl-p`:n=0,this.#on();break;case`down`:case`ctrl-n`:n=1,this.#on();break;case`enter`:n===0?approve():deny();break;case`ctrl-r`:this.#on();break;case`ctrl-c`:this.#Le=void 0,this.#Pt(),t(interruptedError())}},this.#Ft()})}async readInputQuestion(e,t){this.#Mt(t),this.#W=!1,this.#X=!1;let n=e.options??[],r=n.length>0,i=(e.allowFreeform===!0||!r)&&r,a=n.length+ +!!i,o=questionSectionId(e.requestId),s=r?`select`:`text`,c=0,l=EMPTY_LINE,isOnFreeformRow=()=>i&&c===n.length,selectDrawer=t=>renderTransientDrawer([...renderQuestionPanel({prompt:stripTerminalControls(e.prompt),options:n,cursor:c,allowFreeform:i,editor:l,caretVisible:this.#pe},this.#i,t)],[`↑/↓ move · enter to select · esc to dismiss`],this.#i,t,this.#$e(e.context),!1,`left`),textPanel=t=>{let n=promptInputRows({text:l.text,cursor:l.cursor,width:Math.max(1,t-2),theme:this.#i,caretVisible:this.#pe,ghost:``,maxRows:3});return n.at(-1)===``&&n.pop(),renderTransientDrawer([` ${this.#i.colors.bold(stripTerminalControls(e.prompt))}`,``,...n.map(e=>` ${e}`)],[`Enter submit · Esc dismiss`],this.#i,t,this.#$e(e.context),!1,`left`)},syncFreeformCaret=()=>{isOnFreeformRow()?this.#Ut():(this.#Wt(),this.#Gt())};s===`select`?(s=`select`,this.#W=!1,this.#an(o),this.#Le=selectDrawer,syncFreeformCaret(),this.#on()):(s=`text`,this.#Le=textPanel,this.#W=!0,this.#et(l),this.#Ut(),this.#on());let finalize=t=>{this.#Le=void 0,this.#in({id:o,kind:`question`,title:stripTerminalControls(e.prompt),body:`${this.#i.colors.dim(this.#i.glyph.elbow)} ${stripTerminalControls(t.label)}`,preformatted:!0,live:!1}),this.#W=!1,this.#Wt(),this.#It(),this.#on();let n={};return t.optionId!==void 0&&(n.optionId=t.optionId),t.text!==void 0&&(n.text=t.text),n},dismiss=()=>{this.#Le=void 0,this.#in({id:o,kind:`question`,title:stripTerminalControls(e.prompt),body:`${this.#i.colors.dim(this.#i.glyph.elbow)} ${this.#i.colors.dim(`Skipped. The question stays open.`)}`,preformatted:!0,live:!1}),this.#W=!1,this.#Wt(),this.#It(),this.#on(),u(void 0)},moveCursor=e=>{a!==0&&(c=(c+e+a)%a,syncFreeformCaret(),this.#on())},selectOptionAt=e=>{let t=n[e];t&&u(finalize({optionId:t.id,label:t.label}))},u;return await new Promise((t,n)=>{this.#re=n,u=t,this.#be=t=>{if(t.type===`ctrl-c`){if((s===`text`||isOnFreeformRow())&&l.text.length>0){l=EMPTY_LINE,this.#Gt(),s===`text`&&this.#et(l),this.#on();return}this.#Le=void 0,this.#Wt(),this.#Pt(),n(interruptedError());return}if(t.type===`ctrl-r`){this.#on();return}if(s===`select`){let n=setupSelectionIntent(t,{textNavigation:!isOnFreeformRow()});if(n?.kind===`move`){moveCursor(n.direction===`up`?-1:1);return}switch(t.type){case`up`:case`ctrl-p`:moveCursor(-1);break;case`down`:case`ctrl-n`:moveCursor(1);break;case`enter`:if(isOnFreeformRow()){let t=resolveQuestionText(l.text,e);t!==void 0&&u(finalize(t));break}selectOptionAt(c);break;case`escape`:if(isOnFreeformRow()&&l.text.length>0){l=EMPTY_LINE,this.#Gt(),this.#on();break}dismiss();break;default:if(isOnFreeformRow()){let e=this.#U.apply(l,t);e!==void 0&&(l=e,this.#Gt(),this.#on())}}return}let r=this.#U.apply(l,t,{multiline:!0});if(r!==void 0){l=r,this.#Gt(),this.#et(l),this.#on();return}switch(t.type){case`up`:case`down`:{let e=movePromptLine(l,t.type);e!==void 0&&(l=e,this.#Gt(),this.#et(l),this.#on());break}case`enter`:{let t=resolveQuestionText(l.text,e);if(t===void 0)break;u(finalize(t));break}case`escape`:if(l.text.length>0){l=EMPTY_LINE,this.#Gt(),this.#et(l),this.#on();break}dismiss()}},this.#Ft()})}setVercelStatus(e){this.#R=e,this.#on()}setRemoteConnectionStatus(e){this.#z=e,this.#on()}reset(){this.#h=[],this.#g.clear(),this.#v.clear(),this.#L=void 0,this.#I.length=0,this.#y.length=0,this.#P=!1,this.#F=void 0,this.#tt(),this.#Z=!1,this.#Me=void 0,this.#oe&&(this.#n.clearAll(),this.#on())}renderSessionBoundary(){this.#tn();let e=this.#x.stopWorking(this.#Qe());for(let e of this.#w){let t=this.#g.get(e);if(t===void 0)continue;this.#g.delete(e);let n=this.#h.indexOf(t),{id:r,...i}=t;this.#h[n]={...i,live:!1}}for(let{id:t,...n}of e)this.#en(n);this.#v.clear(),this.#tt();let t=this.#i.colors,n=this.#i.glyph,r=t.dim(`${n.cornerOpen}${n.dash.repeat(2)} Session restarted, clear context.`);this.#en({kind:`session-boundary`,body:r,live:!1}),this.#on()}#tt(){this.#x.reset(),this.#Zt(),this.#C=void 0,this.#w=new Set,this.#T.length=0,this.#ne=!1,this.#Q.reset(),this.#$t()}renderNotice(e){let t=stripTerminalControls(e);t.trim().length!==0&&(this.#Mt(),this.#en({kind:`notice`,body:t,live:!1}),this.#on())}restoreDraft(e){let t=this.#W?this.#te:void 0;if((t===void 0?this.#ee.text:this.#B).length>0)return;let n=lineOf(stripPromptControlCharacters(e));t===void 0?this.#ee=n:t(n),this.renderNotice(`The turn was cancelled from outside this prompt, so its message is back in the input.`)}renderSetupWarning(e){let t=stripTerminalControls(e);if(t.trim().length===0){this.#nt();return}this.#Mt(),this.#Ve=t,this.#on()}clearSetupWarning(){this.#nt()}#nt(){this.#Ve!==void 0&&(this.#Ve=void 0,this.#on())}renderCommandInvocation(e){let t=stripTerminalControls(e);t.trim().length!==0&&(this.#Mt(),this.#at(t),this.#on())}async choosePromptCommand(e){this.#Mt(),this.#W=!1;let t=typeaheadFor(e,`/`);return this.#Re=e=>{let n=renderCommandSuggestions(t,this.#i,e),r=Math.max(1,this.#wn()-7),i=Math.max(0,Math.min(t.selectedIndex-r+1,n.length-r));return renderTransientDrawer(n.slice(i,i+r),[`↑/↓ move · Enter select · Esc close`],this.#i,e)},this.#on(),await new Promise(e=>{this.#ze=()=>e(void 0),this.#be=n=>{if(n.type===`up`||n.type===`ctrl-p`)t=moveTypeaheadSelection(t,-1),this.#on();else if(n.type===`down`||n.type===`ctrl-n`)t=moveTypeaheadSelection(t,1),this.#on();else if(n.type===`enter`){let n=selectedTypeaheadCommand(t);this.#rt(),e(n===void 0?void 0:typeaheadCompletion(n))}else(n.type===`escape`||n.type===`ctrl-c`)&&(this.#rt(),e(void 0))},this.#Ft()})}async showInfoPanel(e){this.#Mt(),this.#W=!1;let t=stripAnsi(e),n=0,infoRows=e=>t.split(`
3
+ `).flatMap(t=>wrapVisibleLine(t,Math.max(1,e-4)).map(e=>` ${e}`));this.#Re=e=>{let t=infoRows(e),r=Math.max(1,this.#wn()-7);return n=Math.min(n,Math.max(0,t.length-r)),renderTransientDrawer(t.slice(n,n+r),[t.length>r?`↑/↓ scroll · Esc close`:`Esc to close`],this.#i,e)},this.#on(),await new Promise(e=>{this.#ze=e,this.#be=t=>{if(t.type===`up`||t.type===`ctrl-p`)n=Math.max(0,n-1),this.#on();else if(t.type===`down`||t.type===`ctrl-n`){let e=Math.max(1,this.#wn()-7);n=Math.min(n+1,Math.max(0,infoRows(this.#Cn()).length-e)),this.#on()}else(t.type===`escape`||t.type===`ctrl-c`||t.type===`enter`)&&(this.#rt(),e())},this.#Ft()})}#rt(){this.#Re=void 0,this.finishCommand({kind:`dismiss`}),this.#be=void 0,this.#ze=void 0,this.#It(),this.#on()}finishCommand(e){if(e.kind===`dismiss`){this.#it()&&this.#on();return}let t=this.#ot(e.summary);t!==void 0&&(t.status=`done`);let n=e.message===void 0?``:stripAnsi(e.message);if(n.trim().length===0){t!==void 0&&this.#on();return}this.#Mt();let r={kind:`result`,body:n,live:!1};this.#en(r);let i=t===void 0?-1:this.#h.indexOf(t);i!==-1&&(this.#h.pop(),this.#h.splice(i+1,0,r)),this.#on()}#it(){let e=this.#_;return e!==void 0&&(this.#_=void 0,this.#h=this.#h.filter(t=>t!==e),!0)}#at(e){this.#_!==void 0&&this.#ot();let t={kind:`command`,body:e,live:!0};this.#_=t,this.#en(t)}#ot(e){let t=this.#_;if(t!==void 0)return this.#_=void 0,t.live=!1,e!==void 0&&(t.result=stripTerminalControls(e)),t}#st(e){this.#Mt(),this.#A===void 0&&(this.#W=!1),this.#Be={title:stripTerminalControls(e),startedAtMs:Date.now(),lines:[],outputBuffer:[]},this.#Kt(),this.#on()}#ct(e){this.#Be!==void 0&&(this.#Be.navigation=e,this.#on())}#lt(e){this.#We=void 0,this.#St();let t=this.#Be;if(t!==void 0){if(this.#Be=void 0,this.#A===void 0?this.#qt():this.#Xe(),e){let e=[];for(let n of t.lines){if(n.evidence===!0){e.push(n.text);continue}(n.tone===`warning`||n.tone===`error`)&&(e.length>0&&this.#en({kind:`flow`,title:`info`,body:e.join(`
4
+ `),live:!1}),this.#en({kind:`flow`,title:n.tone,body:n.text,live:!1})),e=[]}}this.#on()}}async#ut(e){let t=this.#gt(e.message),n=isMultiSelectRequest(e),r=e.kind===`search`?e.searchAction:void 0,i=e.kind===`search`&&e.layout===void 0,a=e.options,o=e.navigation?.kind===`planner`,s={options:a,searchAction:r,submitRow:n&&!o};`initialValue`in e&&e.initialValue!==void 0&&(s.defaultValue=e.initialValue),`initialValues`in e&&e.initialValues!==void 0&&(s.initialValues=e.initialValues);let c=initialSelectState(s),l,u=!1,d=0,isCurrentSearch=e=>e===d,clearSearch=()=>{d+=1,u=!1,c=reduceSelect(c,{type:`clear`},{options:a,searchAction:r,submitRow:n&&!o}),this.#on()},loadSearch=async(e,t)=>{u=!0,l=void 0;let i=++d;this.#on();try{let s=await t(e);if(!isCurrentSearch(i))return;let l=c.filter;a=s,c={...initialSelectState({options:s,searchAction:r,submitRow:n&&!o}),filter:l}}catch(e){isCurrentSearch(i)&&(l=toErrorMessage(e))}finally{isCurrentSearch(i)&&(u=!1,this.#on())}},f=e.notices;if(e.kind===`task-list`||e.kind===`search`&&e.layout===`task-list`){let n=t.taskListLineStart??t.lines.length,r=t.lines.slice(n).filter(e=>e.tone===`success`||e.tone===`warning`||e.tone===`error`).map(e=>({tone:e.tone,text:e.text}));f=e.notices??r,t.taskListLineStart=t.lines.length,t.hideLinesWhileQuestion=!0}let panelState=()=>{let t={...e,message:``,options:a,select:c};return f!==void 0&&f.length>0&&(t.notices=f),l!==void 0&&(t.error=l),u&&(t.loadingFrame=this.#pn()),i&&(t.caretVisible=this.#pe),t};return t.question=e=>renderSelectQuestion(panelState(),this.#i,e),i&&this.#Ut(),this.#on(),await this.#yt((t,s)=>{let close=e=>{d+=1,s(e)};if(u){t.type===`ctrl-c`?close(void 0):t.type===`escape`?clearSearch():t.type===`ctrl-r`&&this.#on();return}let f=e.navigation?.kind===`planner`?e.navigation:void 0,p=t.type===`left`&&(f?.activeStep??0)>(f?.firstNavigableStep??0)?`back`:t.type===`right`&&f!==void 0&&f.activeStep>=(f.firstNavigableStep??0)&&f.activeStep<f.steps.length-1?`forward`:void 0;if(p!==void 0){close({kind:`navigate`,direction:p,values:n?orderedSelection(a,c.selected):[]});return}let m={key:t,options:a,searchAction:r,select:c},h=reduceSetupSelectInput(n?{...m,kind:e.kind,required:e.required,plannerNavigation:o||void 0}:{...m,kind:e.kind});switch(h.kind){case`cancel`:close(void 0);return;case`repaint`:this.#on();return;case`update`:c=h.select,l=void 0,i&&this.#Gt(),this.#on();return;case`submit`:{let e=searchActionQuery(h.values[0]??``),t=r?.load;if(e===void 0||t===void 0){close(h.values);return}loadSearch(e,t);return}case`error`:l=h.message,this.#on();return;case`ignore`:return}},i?()=>this.#Wt():void 0).promise}#dt(e){this.#Mt();let t=this.#_t();t.status={text:stripTerminalControls(e.status),startedAtMs:Date.now()};let n;t.question=t=>renderSelectQuestion({kind:`actions`,context:e.context,actions:e.actions,cursor:n},this.#i,t),this.#on();let r=this.#yt((t,r)=>{let i=setupSelectionIntent(t,{textNavigation:!0});switch(i?.kind){case`cancel`:r(void 0);return;case`move`:n=moveActionCursor(n,i.direction,e.actions.length),this.#on();return;case`repaint`:this.#on();return;case`submit`:n!==void 0&&r(e.actions[n].value);return;case void 0:return}},()=>{t.status=void 0});return{choice:r.promise,close:()=>r.settle(void 0)}}async#ft(e){let t=this.#gt(e.message),n={options:e.options};e.initialValue!==void 0&&(n.defaultValue=e.initialValue);let r=initialSelectState(n),i=lineOf(``),a;t.question=t=>{let n={kind:`inline-edit`,layout:`task-list`,message:``,options:e.options,select:r,edit:{optionValue:e.editable.value,caretVisible:this.#pe,editor:{kind:`rename`,editor:i,defaultValue:e.editable.defaultValue,formatHint:e.editable.formatHint}}};return a!==void 0&&(n.error=a),renderSelectQuestion(n,this.#i,t)};let onEditableRow=()=>selectValueAtCursor([...e.options],r.cursor)===e.editable.value,syncEditableRow=()=>{onEditableRow()?this.#Ut():(i=lineOf(``),this.#Wt())};return syncEditableRow(),this.#on(),await this.#yt((t,n)=>{let applyEditor=e=>{i=e,a=void 0,this.#Gt(),this.#on()},applySelect=t=>{r=reduceSelect(r,t,{options:e.options}),a=void 0,syncEditableRow(),this.#on()},submit=()=>{let t=selectValueAtCursor([...e.options],r.cursor);if(t===void 0)return;if(t!==e.editable.value){n({kind:`selected`,value:t});return}let o=(i.text||e.editable.defaultValue).trim(),s=e.editable.validate?.(o);if(s!==void 0){a=s,this.#on();return}n(o===e.editable.defaultValue?{kind:`selected`,value:t}:{kind:`edited`,value:t,text:o})},o=setupSelectionIntent(t,{textNavigation:!onEditableRow()});switch(o?.kind){case`cancel`:n(void 0);return;case`move`:applySelect({type:o.direction});return;case`submit`:submit();return;case`repaint`:this.#on();return;case void 0:}if(!onEditableRow())return;let s=this.#U.apply(i,t);s!==void 0&&applyEditor(s)},()=>this.#Wt()).promise}async#pt(e){this.#U.clear();let t=this.#gt(e.message),n=initialProviderPickerState(e.options,e.initialValue),r,cursorBadge=()=>{if(n.phase.kind!==`inactive`)return;let t=selectValueAtCursor([...e.options],n.select.cursor),r=e.options.find(e=>e.value===t);if(r!==void 0)return enterBadge(this.#i,r.checked===!0?`change`:void 0)};t.question=t=>{let r=cursorBadge(),i={kind:`inline-edit`,layout:`stacked`,message:``,options:e.options,select:n.select,edit:{optionValue:`ai-gateway-key`,caretVisible:this.#pe,editor:{kind:`key`,phase:n.phase}}};return r!==void 0&&(i.cursorBadge=r),renderSelectQuestion(i,this.#i,t)};let syncCaret=()=>{n.phase.kind===`editing`||n.phase.kind===`invalid`?this.#Ut():this.#Wt()};return syncCaret(),this.#on(),await this.#yt((t,i,a)=>{let dispatch=t=>{let o=transitionProviderPicker(n,t,e.options);switch(o.kind){case`ignore`:return;case`clear`:r?.abort(),r=void 0,n=o.state,syncCaret(),this.#on();return;case`cancel`:i(void 0);return;case`render`:n=o.state,syncCaret(),this.#on();return;case`validate`:{n=o.state,syncCaret(),this.#on();let t=new AbortController;r=t;let i;try{i=e.validateInlineKey(o.key,t.signal)}catch(e){a(e);return}i.then(e=>{r!==t||t.signal.aborted||(r=void 0,dispatch({type:`validated`,validation:e}))},e=>{r!==t||t.signal.aborted||(r=void 0,a(e))});return}case`settle`:i(o.result);return}},o=setupSelectionIntent(t,{textNavigation:n.phase.kind===`inactive`});switch(o?.kind){case`cancel`:dispatch({type:`cancel`});return;case`move`:dispatch({type:`move`,direction:o.direction});return;case`submit`:dispatch({type:`submit`});return;case`repaint`:this.#on();return;case void 0:}if(n.phase.kind!==`editing`&&n.phase.kind!==`invalid`)return;let s=applyLineEditorKey(n.phase.editor,t);s!==void 0&&(this.#Gt(),dispatch({type:`edit`,editor:s}))},()=>{r?.abort(),r=void 0,this.#Wt()}).promise}async#mt(e){e.mask===!0&&this.#U.clear();let t=this.#gt(e.message),n=lineOf(``),r;return t.question=t=>{let i={message:``,editor:n,mask:e.mask===!0};return e.placeholder===void 0?e.defaultValue!==void 0&&(i.placeholder=e.defaultValue):i.placeholder=e.placeholder,e.notices!==void 0&&(i.notices=e.notices),r!==void 0&&(i.error=r),renderTextQuestion(i,this.#i,t,this.#pe)},this.#Ut(),this.#on(),await this.#yt((t,i)=>{let apply=e=>{n=e,r=void 0,this.#Gt(),this.#on()},a=e.mask?applyLineEditorKey(n,t):this.#U.apply(n,t);if(a!==void 0){apply(a);return}switch(t.type){case`ctrl-c`:case`escape`:i(void 0);return;case`ctrl-r`:this.#on();return;case`enter`:{let t=n.text.length>0?n.text:e.defaultValue??``,a=e.validate?.(t);if(a!==void 0){r=a,this.#on();return}i(t);return}default:return}},()=>this.#Wt()).promise}async#ht(e){let t=this.#gt(e.message);return t.question=t=>renderAcknowledgeQuestion({message:``,lines:e.lines},this.#i,t),this.#on(),await this.#yt((e,t)=>{switch(e.type){case`enter`:case`escape`:case`ctrl-c`:t();return;case`ctrl-r`:this.#on();return;default:return}}).promise}#gt(e){this.#Mt(),this.#W=!1;let t=this.#_t();return t.questionTitle=stripTerminalControls(e),t.status!==void 0&&(t.status=void 0,t.summary=void 0,t.preview=void 0),t}#_t(){return this.#Be===void 0&&(this.#Be={title:``,startedAtMs:Date.now(),lines:[],outputBuffer:[],implicit:!0}),this.#Be}#vt(){this.#Be?.implicit===!0?this.#Be=void 0:this.#Be!==void 0&&(this.#Be.question=void 0,this.#Be.questionTitle=void 0,this.#Be.hideLinesWhileQuestion=!1),this.#be=void 0,this.#It(),this.#A===void 0?this.#Be!==void 0&&this.#xt():this.#Xe(),this.#Be===void 0&&this.#on()}#yt(e,t){let n=!1,r,i,a=new Promise((e,t)=>{r=e,i=t}),settle=e=>{n||(n=!0,t?.(),this.#vt(),r(e))},reject=e=>{n||(n=!0,t?.(),this.#vt(),i(e))};return this.#Ht(),this.#be=t=>{t.type===`ctrl-c`&&this.#Ot(),e(t,settle,reject)},this.#Ft(),{promise:a,settle}}#bt(e){let t,n=new Promise(e=>{t=e});return this.#We=t,this.#xt(e?.interruptible??!0),{promise:n,dispose:()=>{this.#We===t&&(this.#We=void 0,this.#St())}}}#xt(e=!0){if(this.#A!==void 0){this.#Xe();return}if(this.#We===void 0)return;let consumer=t=>{if(e&&(t.type===`ctrl-c`||t.type===`escape`)){t.type===`ctrl-c`&&this.#Ot();let e=this.#We;this.#We=void 0,this.#St(),e?.(t.type===`ctrl-c`?`ctrl-c`:`escape`);return}t.type===`ctrl-r`&&this.#on()};this.#Ge=consumer,this.#Ht(),this.#be=consumer,this.#Ft()}#St(){this.#Ge!==void 0&&(this.#be===this.#Ge&&this.#It(),this.#Ge=void 0)}#Ct(e){let t=e===void 0?void 0:{text:stripTerminalControls(e),startedAtMs:Date.now()};if(this.#Be!==void 0){this.#Be.status=t,t===void 0&&(this.#Be.preview=void 0),this.#on();return}if(!(this.#W||this.#C?.working===!0)){if(t===void 0){this.#ie=void 0,this.#qt(),this.#on();return}this.#Mt(),this.#he=Date.now(),this.#Kt(),this.#ie=t.text,this.#on()}}#wt(e,t){let n=stripTerminalControls(e);if(n.trim().length===0)return;let r=this.#Be;if(r!==void 0){if(r.preview=void 0,t===`warning`||t===`error`)for(let e of r.outputBuffer)r.lines.push({text:e,tone:`info`,evidence:!0});r.outputBuffer=[],r.lines.push({text:n,tone:t}),this.#on();return}this.#Mt(),this.#en({kind:`flow`,title:t,body:n,live:!1}),this.#on()}#Tt(e){let t=this.#Be;t!==void 0&&(t.lines=[],t.outputBuffer=[],t.preview=void 0,t.status=void 0,t.summary=e===void 0?void 0:{headline:stripTerminalControls(e.headline),facts:e.facts.map(e=>({label:stripTerminalControls(e.label),value:stripTerminalControls(e.value)}))},this.#on())}#Et(e){let t=stripTerminalControls(e);if(t.trim().length===0)return;let n=this.#Be;if(n===void 0){this.#wt(t,`info`);return}n.preview=t,n.outputBuffer.push(t),n.outputBuffer.length>40&&n.outputBuffer.shift(),this.#on()}async#Dt(e){this.#xe=``,this.#Ht(),this.#We=void 0,this.#St(),this.#It(),this.#Jt(),this.#n.clear(),this.#En(),this.#r.enter({cursor:`visible`,mouse:!1}),this.#e.isTTY&&this.#e.setRawMode?.(!1),this.#e.pause();try{return await e()}finally{this.#r.exit(),this.#e.isTTY&&this.#e.setRawMode?.(!0),this.#e.resume(),this.#xe=``,this.#Ht(),this.#n.hideCursor(),this.#Tn(),this.#Be===void 0?this.#$t():(this.#Kt(),this.#xt()),this.#n.reset(),this.#on()}}setSessionId(e){this.#Ue=e}shutdown(){this.#Pt();for(let e of this.#Y.values())clearTimeout(e);if(this.#Y.clear(),this.#se&&!this.#ce){this.#ce=!0;let e=this.#Ue===void 0?``:` ${this.#i.glyph.dot} session ${this.#Ue}`;this.#t.write(`${this.#i.colors.dim(`${eveVersionTag()}${e}`)}\n`)}}requestInterrupt(){this.#Be!==void 0&&this.#be?.({type:`ctrl-c`}),this.#Pt()}exitRequested(){return this.#le}#Ot(){this.#le=!0,this.#fe?.()}async#kt(e){if(this.#Ke!==void 0||!this.#oe)return;let t=new TraceViewerSession({...e,theme:this.#i,dimensions:()=>({width:this.#Cn(),height:this.#wn()}),paint:e=>this.#r.paint(e,this.#wn()),tracingDisabled:process.env.EVE_TRACES===`off`,copyText:e=>copyTextToClipboard(e,e=>this.#r.writeRaw(e)),terminalBackground:this.#qe});this.#Ke=t,this.#r.enter(),this.#i.color&&this.#r.writeRaw(BACKGROUND_COLOR_QUERY),await new Promise(e=>{this.#jt=e,this.#be=e=>{t.handleKey(e)===`close`&&this.#At()},this.#Ft(),t.start()})}#At(){let e=this.#Ke;if(e===void 0)return;this.#Ke=void 0,e.dispose(),this.#It(),this.#r.exit(),this.#n.hideCursor(),this.#on(),this.#n.showCursor();let t=this.#jt;this.#jt=void 0,t?.()}#jt;#Mt(e){this.#ae=e?.title??this.#ae,!this.#oe&&(this.#oe=!0,this.#se=!0,this.#n.reset(),this.#n.hideCursor(),this.#Tn(),this.#e.isTTY&&(this.#e.setRawMode?.(!0),this.#e.resume(),this.#n.emitBracketedPaste(!0)),this.#we=()=>this.#on(),this.#t.on(`resize`,this.#we),process.on(`exit`,this.#Nt))}#Nt=()=>{this.#oe&&(this.#r.exit(),this.#e.isTTY&&(this.#n.emitBracketedPaste(!1),this.#e.setRawMode?.(!1)),this.#n.showCursor())};#Pt(){this.#Le=void 0;let e=this.#ze;e!==void 0&&(this.#ze=void 0,this.#Re=void 0,this.finishCommand({kind:`dismiss`}),this.#be=void 0,e()),this.#At();let t=this.#re;if(this.#re=void 0,t?.(interruptedError()),this.#It(),this.#Wt(),this.#Jt(),this.#ve!==void 0&&(clearTimeout(this.#ve),this.#ve=void 0),this.#ye=!1,this.#Fn(),this.#oe){this.#Ln(),this.#ot();for(let e of this.#h)e.kind===`log`&&e.id===void 0&&(e.live=!1);this.#on(),this.#n.clear(),this.#n.showCursor(),this.#En(),this.#n.newline(),this.#e.isTTY&&(this.#n.emitBracketedPaste(!1),this.#e.setRawMode?.(!1),this.#e.pause()),this.#we&&=(this.#t.off(`resize`,this.#we),void 0),process.off(`exit`,this.#Nt),this.#oe=!1}}#Ft(){this.#e.off(`data`,this.#Lt),this.#e.on(`data`,this.#Lt),this.#xe.length>0&&queueMicrotask(()=>{this.#be!==void 0&&this.#xe.length>0&&(this.#Bt(),this.#Rt())})}#It(){this.#e.off(`data`,this.#Lt),this.#Ht(),this.#be=void 0}#Lt=e=>{this.#Ht(),this.#xe+=this.#Se.write(e),this.#Bt(),this.#Rt()};#Rt(){if(this.#xe===`\x1B`){this.#Ce=setTimeout(()=>{this.#xe===`\x1B`&&(this.#xe=``,this.#zt({type:`escape`}))},30),this.#Ce.unref?.();return}if(isIncompletePaste(this.#xe)){let e=this.#xe;this.#Ce=setTimeout(()=>{if(this.#xe!==e)return;let t=sanitizePastedText(stripPasteStart(e));this.#xe=``,t.length>0&&this.#zt({type:`text`,value:t,framing:`bracketed-paste`})},incompletePasteFlushMs),this.#Ce.unref?.();return}if(isIncompleteOsc(this.#xe)){let e=this.#xe;this.#Ce=setTimeout(()=>{this.#xe===e&&(this.#xe=``)},incompletePasteFlushMs),this.#Ce.unref?.()}}#zt(e){this.#U.interruptYank(e),this.#be?.(e)}#Bt(){for(;this.#xe.length>0;){let e=nextKey(this.#xe);if(e.incomplete)return;if(this.#xe=this.#xe.slice(e.consumed),e.key!==void 0&&e.key.type!==`ignore`){if(e.key.type===`osc`){this.#Vt(e.key.value);continue}this.#zt(e.key)}}}#Vt(e){let t=parseBackgroundColorReply(e);t!==void 0&&(this.#qe=t,this.#Ke?.setTerminalBackground(t))}#Ht(){this.#Ce&&=(clearTimeout(this.#Ce),void 0)}#Ut(){this.#Wt(),this.#Gt(),this.#ge=setInterval(()=>{this.#pe=!this.#pe,this.#on()},500),this.#ge.unref?.()}#Wt(){this.#ge&&=(clearInterval(this.#ge),void 0),this.#pe=!0}#Gt(){this.#pe=!0}#Kt(){this.#Jt(),this.#_e=setInterval(()=>{this.#me+=1,this.#on()},90),this.#_e.unref?.()}#qt(){this.#Yt()||this.#Jt()}#Jt(){this.#_e&&=(clearInterval(this.#_e),void 0)}#Yt(){return this.#C?.working===!0||this.#x.tasks.length>0}#Xt(){this.#x.finishing&&this.#S===void 0&&(this.#S=setTimeout(()=>{this.#S=void 0,this.#C!==void 0&&this.renderConversation(this.#C)},TASK_END_GRACE_MS),this.#S.unref?.())}#Zt(){this.#S!==void 0&&(clearTimeout(this.#S),this.#S=void 0)}#Qt(e,t=Math.max(8,Math.floor(this.#wn()/2))){let n=this.#x.tasks;if(n.length===0)return[];let r=this.#C?.working===!0&&this.#ie===void 0,i=Date.now(),a=r&&this.#C!==void 0?turnActivity(this.#C,n):`Working`;return renderTaskPanelRows(n,{width:e,theme:this.#i,nowMs:i,maxRows:t,activity:a.startsWith(`Waiting for `)?`Waiting`:a,turnElapsedMs:r?Math.max(0,i-(this.#Q.startedAtMs??i)):void 0})}#$t(){this.#Yt()?this.#_e===void 0&&(this.#he=Date.now(),this.#Kt()):this.#Be===void 0&&this.#k===void 0&&this.#ie===void 0&&this.#Jt()}#en(e){e.id!==this.#Me?.id&&this.#Ln(),e.updateSeq=++this.#b,this.#h.push(e),e.id&&this.#g.set(e.id,e)}#tn(){let e=this.#Q.settle(this.#nn());if(e===void 0||(this.#$=e,this.#f?.reportStats(),e.elapsedMs<=1e4&&e.inputTokens<=2e4))return;let t=`Done in ${this.#vn(e)}`,n=this.#C?.data.lastStepUsage?.inputTokens??0;if(this.#De!==void 0&&this.#De>0&&n>0){let e=Math.round(n/this.#De*100);t+=` ${this.#i.glyph.dot} ${e}% context`}this.#en({kind:`turn-stats`,body:t,live:!1})}#nn(){return this.#C?.data.usage??{inputTokens:0,outputTokens:0}}renderError(e,t){this.#Mt(),this.#rn(e,t)}#rn(e,t,n={}){let r=stripTerminalControls(e),i=stripTerminalControls(t),a=n.detail===void 0?void 0:stripTerminalControls(n.detail),o=n.hint===void 0?void 0:stripTerminalControls(n.hint),s={source:`workflow`,summary:`${r}: ${i}`,detail:a??i};this.#f?.append(o===void 0?s:{...s,hint:o});let c={kind:`error`,title:r,body:i,live:!1};o!==void 0&&(c.hint=o),a!==void 0&&(c.detail=this.#f===void 0?a:`details: ${this.#f.displayPath}`),this.#en(c),this.#on()}#in(e){if(e.id&&this.#v.has(e.id))return;let t=e.id?this.#g.get(e.id):void 0;if(t){Object.assign(t,e),t.updateSeq=++this.#b;return}this.#en(e)}#an(e){this.#h=this.#h.filter(t=>t.id!==e),this.#g.delete(e)}#on(){if(this.#oe){if(this.#Te){this.#Ee=!0;return}this.#Te=!0;try{do this.#Ee=!1,this.#sn();while(this.#Ee)}finally{this.#Te=!1}}}#sn(){if(!this.#oe)return;if(this.#Ke!==void 0){this.#Ke.repaint();return}let e=this.#Cn(),t=this.#gn(e),n=this.#N===void 0?[]:this.#dn(),r=Math.max(1,this.#wn()-n.length-t.length),i=[],a=this.#L,o=groupToolBlocksForDisplay(this.#h),s=0;for(;s<o.length&&o[s].display.live===!1;)s+=1;if(s>0){let e=new Set(o.slice(0,s).flatMap(e=>e.members));for(let t=this.#h.length-1;t>=0;--t)e.has(this.#h[t])&&this.#h.splice(t,1)}for(let t of o.slice(0,s)){for(let e of t.members)this.#y.push(e),e.id&&(this.#v.add(e.id),this.#g.delete(e.id));if(this.#zn(t.display))continue;let n=this.#fn(t.display,e,a);a=previousBlockOf(t.display),this.#L=a,i.push(...n),this.#I.push(...n)}let c=[];for(let{display:t}of o.slice(s)){if(this.#zn(t))continue;let n=this.#fn(t,e,a);a=previousBlockOf(t);for(let e=0;e<n.length;e+=1)c.push({block:t,row:n[e]})}let l=[...n,...clipLiveRows(c.map(e=>e.row),r,e,this.#i),...t];i.length>0?this.#n.flush(i,l):this.#n.update(l)}#cn(){if(!this.#oe)return;let e=this.#Cn(),t=this.#gn(e),n=Math.max(1,this.#wn()-t.length),r=this.#L,i=[];for(let{display:t}of groupToolBlocksForDisplay(this.#h)){if(this.#zn(t))continue;let n=this.#fn(t,e,r);r=previousBlockOf(t),i.push(...n)}let a=[...clipLiveRows(i,n,e,this.#i),...t];this.#n.clearAll(),this.#n.flush([...this.#dn(),...this.#I],a)}logDisplayMode(){return this.#m}setLogDisplayMode(e){e!==this.#m&&(this.#m=e,e===`all`&&this.flushDelayedDevBuildErrors(),this.#un(),this.#oe&&this.#cn())}flushDelayedDevBuildErrors(){let e=this.#je;e!==void 0&&(this.#je=void 0,this.#en({kind:`log`,title:`stderr`,logLevel:`error`,body:e,live:!1}),this.#on())}#ln(){this.#ye=!0,this.#ve!==void 0&&clearTimeout(this.#ve),this.#ve=setTimeout(()=>{this.#ye=!1,this.#ve=void 0,this.#on()},5e3),this.setLogDisplayMode(nextLogDisplayMode(this.#m)),this.#on()}#un(){let e=this.#Cn();this.#I.length=0;let t;for(let{display:n}of groupToolBlocksForDisplay(this.#y,{logCoalescing:`runs`})){if(this.#zn(n))continue;let r=this.#fn(n,e,t);t=previousBlockOf(n),this.#I.push(...r)}this.#L=t}#dn(){let e=this.#E,t=this.#N;if(e===void 0&&t===void 0)return[];let n={name:e?.name??t?.name,theme:this.#i,width:this.#Cn()};return e?.info!==void 0&&(n.info=e.info),buildAgentHeader(n)}#fn(e,t,n){let r={renderMarkdown:this.#a,activityPulse:this.#mn(this.#he,this.#i.unicode?PROGRESS_PULSE_GLYPH:PROGRESS_PULSE_ASCII_GLYPH)};n!==void 0&&(r.previous=n),this.#Be!==void 0&&(r.setupFlowOpen=!0),this.#Re!==void 0&&(r.transientPanelOpen=!0);let i=renderBlockLines(e,t,this.#i,r);return(e.depth??0)===0&&leadsWithGap(e,n)?[``,...i]:i}#pn(){return this.#i.spinner[this.#me%this.#i.spinner.length]??``}#mn(e,t){return isProgressPulseVisible(Date.now()-e)?t:` `}#hn(e){return{glyph:this.#mn(e.startedAtMs,this.#i.unicode?PROGRESS_PULSE_GLYPH:PROGRESS_PULSE_ASCII_GLYPH)}}#gn(e){let t=this.#i.colors,n=[``];if(this.#Re!==void 0){let t=this.#Re(e);return[...t.rows,...t.controls]}if(this.#Le!==void 0){let t=this.#Le(e),n=this.#wn()-t.rows.length-t.controls.length-1;return[...(n>=4?this.#Qt(e,n+1):[]).slice(0,-1),...t.rows,...t.controls]}let r=this.#Be;if(r!==void 0&&(this.#A===void 0||r.question!==void 0)){let t=this.#hn(r),i;if(r.status!==void 0){let{startedAtMs:e,...n}=r.status,a=Date.now()-e,o=a>=5e3?` ${formatTurnDuration(a)}`:``;i={...n,text:`${n.text}${o}`,indicator:t}}let a;if(r.question!==void 0){let t=r.question(e);a={kind:`question`,title:r.questionTitle,rows:t},i!==void 0&&(a={kind:`question`,title:r.questionTitle,rows:t,status:i})}else i===void 0?a=r.preview===void 0?{kind:`idle`,indicator:t}:{kind:`preview`,text:r.preview,indicator:t}:(a={kind:`status`,status:i},r.preview!==void 0&&(a={kind:`status`,status:i,preview:r.preview}));let o={title:r.title,navigation:r.navigation,lines:r.summary===void 0?r.hideLinesWhileQuestion===!0?[]:r.lines:[{text:r.summary.headline,tone:`success`},...r.summary.facts.map(e=>({text:`${e.label}: ${e.value}`,tone:`info`}))],content:a},s=renderFlowDrawer(o,this.#i,e);return n.length===1&&n[0]===``&&(n.length=0),n.push(...s.rows),s.controls.length>0&&n.push(...s.controls),this.#xn(n,e),n}r!==void 0&&n.push(...flowMessageRows(r.lines,this.#i).map(t=>t.length===0?``:clip(` ${t}`,e))),this.#k===void 0&&this.#Ve!==void 0&&n.push(...renderAttentionRows(this.#Ve,e,this.#i),``);let i=this.#C?.working===!0&&this.#ie===void 0,a=this.#Qt(e);a.length>0&&n.push(...a);let o=renderMessageQueueRows({view:this.#He.view(),width:e,theme:this.#i});if(o.length>0&&n.push(...o,``),i&&(a.length===0&&n.push(this.#_n(e)),this.#ne&&n.push(clip(`${t.yellow(this.#i.glyph.dotActive)} ${t.dim(`Cancelling turn… · Ctrl+C to stop waiting, then again to exit`)}`,e)),(a.length===0||this.#ne)&&n.push(``)),this.#W){let r=this.#G===void 0?void 0:inlineCommandHint(this.#G),a=this.#Ye(e);this.#ue&&n.push(clip(t.dim(`Press Ctrl+C again to exit`),e),``);let o=r?t.dim(` ${r}`):``,s=[];this.#bn(s,e);let c=Math.max(1,this.#wn()-1-n.length-1-a.length-s.length-(a.length>0?2:0)),l={text:this.#B,cursor:this.#V,width:e,theme:this.#i,caretVisible:this.#pe,ghost:o,maxRows:c};this.#X&&this.#B.length===0&&(l.placeholder=this.#A===void 0?this.#Z||i?``:this.#D:`Message · Enter to queue`);let u=promptInputRows(l);return a.length>0&&u.at(-1)===``&&u.pop(),n.push(...u),a.length>0&&n.push(t.dim(this.#i.glyph.dash.repeat(e))),n.push(...a),a.length>0&&s.length>0&&n.push(t.dim(this.#i.glyph.dash.repeat(e))),n.push(...s),n}if(i||this.#ee.text.length>0)return this.#yn(n,e,{inert:i,adjacent:a.length>0}),this.#bn(n,e),n;let s=this.#ie??`Ready`,c=this.#Sn(),l=t.dim(this.#i.glyph.dot),u=c?`${l} ${s} ${t.dim(this.#i.glyph.dot)} ${c}`:`${l} ${s}`;return n.push(clip(u,e)),this.#bn(n,e),n}#_n(e){let t=this.#i.colors,n=this.#Q.startedAtMs??Date.now(),r=Math.max(0,Date.now()-n),i=r%1e3<500?this.#i.unicode?`•`:`*`:` `,a=r<1e3?`0s`:formatTurnDuration(Math.floor(r/1e3)*1e3),o=`${this.#C===void 0?`Thinking`:turnActivity(this.#C,this.#x.tasks)} (${a})`,{inputTokens:s,outputTokens:c}=this.#Q.usage(this.#nn());return clip(`${i} ${o}${s>0||c>0?t.dim(` (${formatTokenFlow({inputTokens:s,outputTokens:c},this.#i.glyph)})`):``}`,e)}#vn(e){let{inputTokens:t,outputTokens:n}=e,r=t===0&&n===0?``:` (${formatTokenFlow({inputTokens:t,outputTokens:n},this.#i.glyph)})`;return`${formatTurnDuration(e.elapsedMs)}${r}`}#yn(e,t,n){!n.adjacent&&e.at(-1)!==``&&e.push(``);let r={text:this.#ee.text,cursor:this.#ee.cursor,width:t,theme:this.#i,caretVisible:!0,ghost:``,maxRows:4,inert:n.inert};n.inert&&this.#ee.text.length===0&&(r.placeholder=``),e.push(...promptInputRows(r))}#bn(e,t){if(this.#k!==void 0){let n=this.#Be?.status?.text??{starting:`Starting agent…`,connecting:`Reading saved connection…`,updating:`Loading selected model…`}[this.#k],r=this.#mn(this.#M,this.#i.unicode?PROGRESS_PULSE_GLYPH:PROGRESS_PULSE_ASCII_GLYPH);e.push(clip(this.#i.colors.dim(`${r} ${n}`),t));return}let n=this.#z===void 0?``:` `,r=Math.max(1,t-n.length),i={theme:this.#i,width:r};this.#Pe&&this.#Ne!==void 0&&(i.devBuild=this.#Ne),this.#ye&&(i.logLevel=this.#m);let a=this.#E?.info?.agent.model;if(a?.routing.kind===`dynamic`){let e=this.#C?.data.modelId;i.dynamicModel=!0,e!==void 0&&(i.model=e)}else a?.id!==void 0&&(i.model=a.id);a?.reasoning!==void 0&&a.reasoning!==`provider-default`&&(i.reasoning=a.reasoning),readGatewayServiceTier(a?.providerOptions).kind===`priority`&&(i.fastMode=!0);let o=a?.endpoint;o!==void 0&&(i.endpoint=o),this.#R!==void 0&&(i.vercel=this.#R),this.#z!==void 0&&(i.remote=this.#z);let s=buildStatusLine(i);s!==void 0&&e.push(clip(`${n}${s}`,t))}#xn(e,t){if(this.#z===void 0)return;let n=Math.max(1,t-2),r=buildStatusLine({remote:this.#z,theme:this.#i,width:n});r!==void 0&&e.push(``,clip(` ${r}`,t))}#Sn(){let e=this.#i.colors,t=[],n=this.#$,r=n===void 0?void 0:formatAssistantResponseStats({totalTokens:n.inputTokens+n.outputTokens,outputTokens:n.outputTokens,tokensPerSecond:n.elapsedMs>0?n.outputTokens/(n.elapsedMs/1e3):void 0},this.#u);return r&&t.push(r),t.length>0?e.dim(t.join(` ${this.#i.glyph.dot} `)):``}#Cn(){return Math.max(20,this.#t.columns||80)}#wn(){return Math.max(8,this.#t.rows||24)}#Tn(){if(this.#Oe!==void 0||!this.#d)return;this.#ke=``,this.#Ae=``;let capture=(e,t)=>{let n=e.write.bind(e);return e.write=((e,n,r)=>{let i=typeof n==`string`?n:void 0,a=typeof n==`function`?n:r;return this.#kn(t,chunkToString(e,i)),a?.(),!0}),()=>{e.write=n}},e=[`error`,`warn`,`log`,`info`,`debug`],t=e.map(e=>[e,console[e]]);for(let t of e)console[t]=(...e)=>this.#On({level:t===`log`?`info`:t,text:format(...e)});setConsoleRecordSubscriber(e=>this.#On(e));let n=capture(process.stdout,`stdout`),r=capture(process.stderr,`stderr`);this.#f?.subscribeLogRecords(e=>this.#Dn(e)),this.#Oe=()=>{this.#f?.unsubscribeLogRecords(),setConsoleRecordSubscriber(void 0);for(let[e,n]of t)console[e]=n;n(),r()}}#En(){let e=this.#Oe;e!==void 0&&(this.#Oe=void 0,e(),this.#ke.length>0&&(this.#f?.append({source:`stdout`,detail:this.#ke}),this.#Rn()&&process.stdout.write(`${this.#ke}\n`),this.#ke=``),this.#Ae.length>0&&(this.#f?.append({source:`stderr`,detail:this.#Ae}),this.#Rn()&&process.stderr.write(`${this.#Ae}\n`),this.#Ae=``))}#Dn(e){let t=e.fields===void 0?``:` ${JSON.stringify(e.fields)}`;this.#jn(`[eve:${e.namespace}] ${e.message}${t}`,e.level),this.#on()}#On(e){let t=e.level===`error`||e.level===`warn`?`stderr`:`stdout`;this.#f?.append({source:t,level:e.level,detail:e.text}),t===`stderr`?this.#jn(stripAnsi(e.text),e.level):this.#An(stripAnsi(e.text),e.level),this.#on()}#kn(e,t){let n=(e===`stdout`?this.#ke:this.#Ae)+t;if(e===`stdout`&&parseDevRebuildLogLine(n.trimEnd())!==void 0){this.#ke=``,this.#f?.append({source:e,detail:n.trimEnd()}),this.#An(n.trimEnd()),this.#on();return}let r=n.lastIndexOf(`
5
+ `),i=r===-1?n:n.slice(r+1);if(e===`stdout`?this.#ke=i:this.#Ae=i,r===-1)return;let a=stripAnsi(n.slice(0,r)).replace(/\s+$/u,``);a.trim().length!==0&&(this.#f?.append({source:e,detail:a}),e===`stdout`?this.#An(a):this.#jn(a),this.#on())}#An(e,t){let n=[],flushPending=()=>{if(n.length===0)return;let e=n.join(`
6
+ `);n=[],e.trim().length!==0&&this.#en({kind:`log`,title:`stdout`,logLevel:t,body:e,live:!1})};for(let r of e.split(`
7
+ `)){let e=parseSandboxLogLine(r.trimEnd());if(e!==void 0){flushPending(),this.#en({kind:`sandbox`,logLevel:t,body:e,live:!1});continue}let i=parseDevRebuildLogLine(r.trimEnd());if(i===void 0){n.push(r);continue}flushPending(),this.#Nn(i,r.trimEnd())}flushPending()}#jn(e,t){let n=e.split(`
8
+ `),r=n.findIndex(e=>parseDevRebuildLogLine(e.trimEnd())?.kind===`failed`);if(r===-1){if(this.#f===void 0){this.#en({kind:`log`,title:`stderr`,logLevel:t,body:e,live:!1});return}let n=presentDiagnostic(e,this.#f.displayPath);if(n.kind===`inline`){this.#en({kind:`log`,title:`stderr`,logLevel:t,body:n.text,live:!1});return}this.#en({kind:`log`,title:`stderr`,body:formatStoredDiagnostic(n),logVisibility:`summary`,logLevel:t,live:!1}),this.#en({kind:`log`,title:`stderr`,body:e,logVisibility:`all-only`,logLevel:t,live:!1});return}let i=n.slice(0,r).join(`
9
+ `);i.trim().length>0&&this.#en({kind:`log`,title:`stderr`,logLevel:t,body:i,live:!1});let a=n.slice(r).join(`
10
+ `);this.#Mn(a)}#Mn(e){if(this.#Fn(),this.#m===`all`){if(e.trim().length===0)return;this.#en({kind:`log`,title:`stderr`,logLevel:`error`,body:e,live:!1});return}this.#je=e}#Nn(e,t){let n=this.#In();if(e.kind===`failed`){this.#Mn(t);return}if(e.kind===`rebuilding`){let t=summarizeChangedFiles(e.events,e.more);if(this.#Pn({phase:`building`,summary:t}),n!==void 0){n.state.summary=t,n.block.body=formatDevRebuildStatus(t,`rebuilding`);return}let r=`dev-rebuild:${this.#Ie}`;this.#Ie+=1,this.#Me={id:r,summary:t},this.#en({kind:`log`,id:r,title:`stdout`,body:formatDevRebuildStatus(t,`rebuilding`),live:!0});return}let r=n?.state.summary??this.#Ne?.summary;if(r!==void 0&&this.#Pn({phase:`complete`,summary:r}),n!==void 0){n.block.body=formatDevRebuildStatus(n.state.summary,e.kind),e.kind===`rebuilt`&&(this.#je=void 0);return}e.kind===`rebuilt`&&(this.#je=void 0),this.#en({kind:`log`,title:`stdout`,body:t,live:!1})}#Pn(e){this.#Fe!==void 0&&clearTimeout(this.#Fe),this.#Ne=e,this.#Pe=e.phase===`complete`,this.#Fe=setTimeout(()=>{e.phase===`building`?(this.#Pe=!0,this.#Fe=void 0):this.#Fn(),this.#on()},e.phase===`building`?250:4e3)}#Fn(){this.#Fe!==void 0&&clearTimeout(this.#Fe),this.#Ne=void 0,this.#Pe=!1,this.#Fe=void 0}#In(){let e=this.#Me;if(e===void 0)return;let t=this.#g.get(e.id);if(t!==void 0&&t.live===!0)return{state:e,block:t}}#Ln(){let e=this.#Me;if(e===void 0)return;this.#Me=void 0;let t=this.#g.get(e.id);t!==void 0&&(t.live=!1)}#Rn(e){return isLogVisible(this.#m,e)}#zn(e){return e.kind===`sandbox`?!this.#Rn(e.logLevel):e.kind===`log`?e.logVisibility===`summary`&&this.#m===`all`?!0:e.logVisibility===`all-only`?this.#m!==`all`:!this.#Rn(e.logLevel):!1}};function chunkToString(e,t){return typeof e==`string`?e:Buffer.from(e).toString(t)}function clip(e,t){return clipVisible(e,t)}function promptInputRows({text:e,cursor:t,width:n,theme:r,caretVisible:i,ghost:a,maxRows:o,placeholder:s,inert:c}){let l=r.colors;if(e.length===0&&s!==void 0){let e=renderInputWithBlockCursor({...visibleLine({text:s,cursor:0},Math.max(1,n-3),r.glyph.ellipsis),visible:i,inverse:l.inverse,render:e=>l.dim(renderInputText(e))});return[clip(`${r.glyph.prompt} ${e}`,n),``]}let u=renderInputText,d=layoutPromptInput({text:e,cursor:t}),f=Math.min(Math.max(1,o),d.rows.length),p=Math.max(0,Math.min(d.caretRow-f+1,d.rows.length-f)),m=c===!0?l.dim(r.glyph.prompt):e.startsWith(`/`)?r.glyph.user:r.glyph.prompt,h=l.dim(r.glyph.ellipsis),g=Math.max(1,n-3),_=[];for(let e=p;e<p+f;e+=1){let t=d.rows[e],o=e===0?m:` `;(e===p&&p>0||e===p+f-1&&p+f<d.rows.length)&&(o=h);let s;if(e===d.caretRow){let{before:e,under:n,after:o}=visibleLine({text:t.text,cursor:d.caretOffset},g,r.glyph.ellipsis);s=renderInputWithBlockCursor({before:e,under:n,after:o,visible:i,inverse:l.inverse,render:u}),a.length>0&&d.rows.length===1&&(s+=a)}else s=u(t.text);_.push(clip(`${o} ${s}`,n))}return _.push(``),_}function previousBlockOf(e){let t={kind:e.kind};return e.title!==void 0&&(t.title=e.title),e.subagentCallId!==void 0&&(t.subagentCallId=e.subagentCallId),t}function leadsWithGap(e,t){if((e.kind===`tool`||e.kind===`task`)&&(t?.kind===`user`||t?.kind===`assistant`||t?.kind===`question`))return!0;if(e.kind===`sandbox`&&t?.kind===`sandbox`)return!1;if(t?.kind===`sandbox`&&e.kind!==`sandbox`||t?.kind===`log`)return!0;switch(e.kind){case`user`:case`assistant`:case`reasoning`:case`error`:case`notice`:case`question`:case`connection-auth`:case`sandbox`:case`log`:case`command`:case`warning`:case`flow`:case`turn-stats`:case`session-boundary`:case`agent-header`:return!0;default:return!1}}function parseSandboxLogLine(e){let t=e.trim();if(!t.startsWith(`eve: `))return;let n=t.slice(5);return/\bsandbox\b/i.test(n)&&!isLowValueSandboxLogLine(n)?n:void 0}function isLowValueSandboxLogLine(e){return/^initializing (?:\d+ )?sandbox templates?\b/i.test(e)||/^initialized \d+ sandbox\b/i.test(e)||/^reused cached sandbox template\b/i.test(e)||/^sandbox template "[^"]+" \([^)]+\): (checking|reusing|loading microsandbox runtime|microsandbox runtime ready)\b/i.test(e)}function clipLiveRows(e,t,n,r){if(e.length<=t)return[...e];if(t<=1)return[clip(hiddenRowsMarker(e.length,r),n)];let i=t-1;return[clip(hiddenRowsMarker(e.length-i,r),n),...e.slice(e.length-i)]}function hiddenRowsMarker(e,t){let n=e.toLocaleString(),r=e===1?`row`:`rows`;return t.colors.dim(`${t.glyph.dot} ${t.glyph.ellipsis} ${n} earlier ${r} hidden while streaming`)}function formatToolApprovalTitle(e){return stripTerminalControls(e.title??e.toolName)}function questionSectionId(e){return`question:${e}`}function resolveQuestionText(e,t){let n=e.trim();if(n.length===0)return;let r=n.toLowerCase(),i=t.options??[];if(i.length>0){let e=matchQuestionOption(r,i);if(e!==void 0)return{optionId:e.id,label:e.label}}if(t.allowFreeform===!0||i.length===0)return{text:n,label:n}}function matchQuestionOption(e,t){let n=t.find(t=>t.id.toLowerCase()===e);if(n!==void 0)return n;let r=t.find(t=>t.label.toLowerCase()===e);if(r!==void 0)return r;let i=Number(e);if(Number.isInteger(i)&&i>0&&i<=t.length)return t[i-1]}export{TerminalRenderer};
@@ -0,0 +1,2 @@
1
+ import type { EveDynamicToolPart, EveMessagePart } from "#client/message-reducer-types.js";
2
+ export declare function isTerminalToolCallPart(part: EveMessagePart): part is EveDynamicToolPart;
@@ -0,0 +1 @@
1
+ function isTerminalToolCallPart(e){return e.type===`dynamic-tool`&&e.toolMetadata?.eve?.kind===`tool-call`}export{isTerminalToolCallPart};
@@ -0,0 +1,34 @@
1
+ import { type UnstampedMessageStreamEvent } from "#protocol/message.js";
2
+ export interface FakeEveRequest {
3
+ readonly method: string;
4
+ readonly path: string;
5
+ readonly sessionId?: string;
6
+ readonly body?: Record<string, unknown>;
7
+ }
8
+ /** Events a fake agent streams after it accepts one delivery. */
9
+ export type FakeEveTurn = (request: FakeEveRequest & {
10
+ readonly deliveryId: string;
11
+ readonly turnId: string;
12
+ }) => readonly UnstampedMessageStreamEvent[];
13
+ /**
14
+ * An in-memory eve HTTP server for driving real clients through `fetch`.
15
+ * Sessions keep a durable event log; streams replay from their cursor and then
16
+ * follow live emissions, so reconnects and late subscribers behave like eve.
17
+ */
18
+ export declare class FakeEveServer {
19
+ #private;
20
+ readonly requests: FakeEveRequest[];
21
+ /** `fallback` serves routes outside the session API, such as dev runtime artifacts. */
22
+ constructor(respond?: FakeEveTurn, fallback?: typeof fetch);
23
+ get sessionId(): string | undefined;
24
+ /** Requests to one route, such as `POST /cancel`. */
25
+ requestsTo(method: string, suffix: string): FakeEveRequest[];
26
+ /** Appends events to a session's durable stream; the current session by default. */
27
+ emit(events: readonly UnstampedMessageStreamEvent[], deliveryId?: string, sessionId?: string | undefined): void;
28
+ readonly fetch: (input: string | URL | Request, init?: RequestInit) => Promise<Response>;
29
+ close(): void;
30
+ }
31
+ /** A fake agent that answers every message with the same completed reply. */
32
+ export declare function reply(text: string): FakeEveTurn;
33
+ /** A fake agent that accepts deliveries and leaves their events to the test. */
34
+ export declare function silent(): FakeEveTurn;
@@ -0,0 +1 @@
1
+ import{EVE_MESSAGE_STREAM_VERSION,EVE_STREAM_VERSION_HEADER,createMessageCompletedEvent,createMessageReceivedEvent,createSessionWaitingEvent,createTurnCompletedEvent,createTurnStartedEvent}from"#protocol/message.js";const FAKE_USAGE={cacheReadTokens:0,cacheWriteTokens:0,inputTokens:1200,outputTokens:150},encoder=new TextEncoder;var FakeEveServer=class{requests=[];#e=new Map;#t;#n;#r=0;#i=0;#a=0;#o;constructor(e=reply(`Done.`),t){this.#t=e,t!==void 0&&(this.#n=t)}get sessionId(){return this.#o}requestsTo(e,t){return this.requests.filter(n=>n.method===e&&n.path.endsWith(t))}emit(e,t,n=this.#o){if(n===void 0)throw Error(`No fake eve session exists yet.`);let r=this.#c(n);for(let n of e){this.#a+=1;let e=new Date(Date.UTC(2026,0,1)+this.#a).toISOString(),i=`evt_fake_${String(this.#a).padStart(4,`0`)}`,a={...n,meta:t===void 0?{at:e,id:i}:{at:e,id:i,deliveryIds:[t]}};r.log.push(a);let o=encoder.encode(`${JSON.stringify(a)}\n`);for(let e of r.streams)e.enqueue(o)}}fetch=async(e,t)=>{let n=new URL(typeof e==`string`||e instanceof URL?e:e.url),r=t?.method??`GET`,i=typeof t?.body==`string`?JSON.parse(t.body):void 0,a=/^\/eve\/v1\/session(?:\/([^/]+))?(?:\/([a-z]+))?$/u.exec(n.pathname);if(a===null&&this.#n!==void 0)return await this.#n(e,t);let o=a?.[1],s={method:r,path:n.pathname};if(o!==void 0&&(s.sessionId=o),i!==void 0&&(s.body=i),this.requests.push(s),a===null)return new Response(`Not found`,{status:404});let c=a[2];if(r===`GET`&&c===`stream`&&o!==void 0)return this.#l(o,Number(n.searchParams.get(`startIndex`)??`0`));if(r===`POST`&&c===void 0){let e=o??this.#s();this.#o=e;let t=`delivery_${String(++this.#i)}`,n=`turn_${String(this.#i)}`;return queueMicrotask(()=>this.emit(this.#t({...s,deliveryId:t,turnId:n}),t)),Response.json({ok:!0,status:`accepted`,sessionId:e,deliveryId:t},{status:202})}return r===`POST`&&c===`reset`&&o!==void 0?Response.json({ok:!0,status:`reset`,previousSessionId:o}):r===`POST`&&o!==void 0?Response.json({ok:!0,status:`accepted`,sessionId:o}):new Response(`Not found`,{status:404})};close(){for(let e of this.#e.values()){for(let t of e.streams)t.close();e.streams.clear()}}#s(){let e=`session_${String(++this.#r)}`;return this.#c(e),e}#c(e){let t=this.#e.get(e);return t===void 0&&(t={log:[],streams:new Set},this.#e.set(e,t)),t}#l(e,t){let n=this.#c(e),r;return new Response(new ReadableStream({start(e){r=e;for(let e of n.log.slice(t))r.enqueue(encoder.encode(`${JSON.stringify(e)}\n`));n.streams.add(r)},cancel(){n.streams.delete(r)}}),{headers:{[EVE_STREAM_VERSION_HEADER]:EVE_MESSAGE_STREAM_VERSION}})}};function reply(e){return({body:t,turnId:n})=>[...typeof t?.message==`string`?[createMessageReceivedEvent({message:t.message,sequence:0,turnId:n})]:[],createTurnStartedEvent({sequence:1,turnId:n}),createMessageCompletedEvent({finishReason:`stop`,message:e,sequence:2,stepIndex:0,turnId:n}),createTurnCompletedEvent({sequence:3,turnId:n}),createSessionWaitingEvent(FAKE_USAGE)]}function silent(){return()=>[]}export{FakeEveServer,reply,silent};
@@ -11,4 +11,5 @@ export { createPromptCommandHandler } from "../prompt-command-handler.js";
11
11
  export { promptCommandsFor } from "../prompt-commands.js";
12
12
  export { TerminalRenderer } from "../terminal-renderer.js";
13
13
  export { MockScreen, MockUserInput } from "./mock-terminal.js";
14
+ export { FakeEveServer } from "./fake-eve-server.js";
14
15
  export { AUTHORED_ARTIFACTS_UPDATED_LOG_LINE, formatChangeDetectedLogLine, } from "#internal/nitro/host/dev-watcher-log.js";
@@ -1 +1 @@
1
- import{promptCommandsFor}from"../prompt-commands.js";import{createPromptCommandHandler}from"../prompt-command-handler.js";import{TerminalRenderer}from"../terminal-renderer.js";import{EveTUIRunner}from"../runner.js";import{MockScreen,MockUserInput}from"./mock-terminal.js";import{AUTHORED_ARTIFACTS_UPDATED_LOG_LINE,formatChangeDetectedLogLine}from"#internal/nitro/host/dev-watcher-log.js";export{AUTHORED_ARTIFACTS_UPDATED_LOG_LINE,EveTUIRunner,MockScreen,MockUserInput,TerminalRenderer,createPromptCommandHandler,formatChangeDetectedLogLine,promptCommandsFor};
1
+ import{promptCommandsFor}from"../prompt-commands.js";import{createPromptCommandHandler}from"../prompt-command-handler.js";import{TerminalRenderer}from"../terminal-renderer.js";import{EveTUIRunner}from"../runner.js";import{FakeEveServer}from"./fake-eve-server.js";import{MockScreen,MockUserInput}from"./mock-terminal.js";import{AUTHORED_ARTIFACTS_UPDATED_LOG_LINE,formatChangeDetectedLogLine}from"#internal/nitro/host/dev-watcher-log.js";export{AUTHORED_ARTIFACTS_UPDATED_LOG_LINE,EveTUIRunner,FakeEveServer,MockScreen,MockUserInput,TerminalRenderer,createPromptCommandHandler,formatChangeDetectedLogLine,promptCommandsFor};
@@ -92,7 +92,7 @@ export interface ThemeGlyphs {
92
92
  arrowUp: string;
93
93
  /** `↓` — output (response) tokens in the token-flow segment. */
94
94
  arrowDown: string;
95
- /** `↯` — Fast mode (Gateway priority tier) marker beside a model id. */
95
+ /** `⚡︎` — intrinsic speed or Fast mode (Gateway priority tier) marker. */
96
96
  fast: string;
97
97
  /** `↵` — the Enter affordance inside a selection badge. */
98
98
  enter: string;
@@ -1 +1 @@
1
- function ansi(e,t,n){if(!n)return e=>e;let r=`[${e}m`,i=`[${t}m`;return e=>`${r}${e}${i}`}function ansi256(e,t){if(!t)return e=>e;let n=`[38;5;${e}m`;return e=>`${n}${e}`}const UNICODE_GLYPHS={brand:`▲`,user:`│`,reasoning:`○`,square:`▪`,corner:`└`,cornerOpen:`┌`,external:`⌝`,dotActive:`⏺`,success:`✓`,error:`⨯`,warning:`⚠`,subagent:`※`,rule:`│`,question:`?`,connection:`●`,arrow:`→`,pointer:`›`,selectedPointer:`›`,option:` `,prompt:`❯`,elbow:`⎿`,hrule:`▔`,dash:`─`,caret:`▏`,dot:`·`,ellipsis:`…`,arrowUp:`↑`,arrowDown:`↓`,fast:`↯`,enter:`↵`,validating:`▪`},ASCII_GLYPHS={brand:`>`,user:`|`,reasoning:`o`,square:`*`,corner:"`",cornerOpen:`,`,external:`^`,dotActive:`*`,success:`+`,error:`x`,warning:`!`,subagent:`*`,rule:`|`,question:`?`,connection:`*`,arrow:`->`,pointer:`>`,selectedPointer:`>`,option:`.`,prompt:`>`,elbow:"`-",hrule:`=`,dash:`-`,caret:`_`,dot:`-`,ellipsis:`...`,arrowUp:`^`,arrowDown:`v`,fast:`>>`,enter:`<-'`,validating:`o`},UNICODE_SPINNER=[`⠋`,`⠙`,`⠹`,`⠸`,`⠼`,`⠴`,`⠦`,`⠧`,`⠇`,`⠏`],ASCII_SPINNER=[`-`,`\\`,`|`,`/`];function createTheme(e={}){let t=e.color??!0,n=e.unicode??!0;return{color:t,unicode:n,colors:{reset:ansi(0,0,t),bold:ansi(1,22,t),dim:ansi(2,22,t),inverse:ansi(7,27,t),italic:ansi(3,23,t),white:ansi(97,39,t),gray:ansi(90,39,t),cyan:ansi(36,39,t),green:ansi(32,39,t),red:ansi(31,39,t),yellow:ansi(33,39,t),magenta:ansi(35,39,t),blue:ansi(34,39,t),orange:ansi256(208,t)},glyph:n?UNICODE_GLYPHS:ASCII_GLYPHS,spinner:n?UNICODE_SPINNER:ASCII_SPINNER}}function detectUnicode(e=process.env){let t=e.EVE_TUI_UNICODE;return t===`0`||t===`false`?!1:t===`1`||t===`true`?!0:e.TERM===`dumb`?!1:process.platform!==`win32`||!!(e.WT_SESSION||e.TERM_PROGRAM===`vscode`)}export{createTheme,detectUnicode};
1
+ function ansi(e,t,n){if(!n)return e=>e;let r=`[${e}m`,i=`[${t}m`;return e=>`${r}${e}${i}`}function ansi256(e,t){if(!t)return e=>e;let n=`[38;5;${e}m`;return e=>`${n}${e}`}const UNICODE_GLYPHS={brand:`▲`,user:`│`,reasoning:`○`,square:`▪`,corner:`└`,cornerOpen:`┌`,external:`⌝`,dotActive:`⏺`,success:`✓`,error:`⨯`,warning:`⚠`,subagent:`※`,rule:`│`,question:`?`,connection:`●`,arrow:`→`,pointer:`›`,selectedPointer:`›`,option:` `,prompt:`❯`,elbow:`⎿`,hrule:`▔`,dash:`─`,caret:`▏`,dot:`·`,ellipsis:`…`,arrowUp:`↑`,arrowDown:`↓`,fast:`⚡︎`,enter:`↵`,validating:`▪`},ASCII_GLYPHS={brand:`>`,user:`|`,reasoning:`o`,square:`*`,corner:"`",cornerOpen:`,`,external:`^`,dotActive:`*`,success:`+`,error:`x`,warning:`!`,subagent:`*`,rule:`|`,question:`?`,connection:`*`,arrow:`->`,pointer:`>`,selectedPointer:`>`,option:`.`,prompt:`>`,elbow:"`-",hrule:`=`,dash:`-`,caret:`_`,dot:`-`,ellipsis:`...`,arrowUp:`^`,arrowDown:`v`,fast:`>>`,enter:`<-'`,validating:`o`},UNICODE_SPINNER=[`⠋`,`⠙`,`⠹`,`⠸`,`⠼`,`⠴`,`⠦`,`⠧`,`⠇`,`⠏`],ASCII_SPINNER=[`-`,`\\`,`|`,`/`];function createTheme(e={}){let t=e.color??!0,n=e.unicode??!0;return{color:t,unicode:n,colors:{reset:ansi(0,0,t),bold:ansi(1,22,t),dim:ansi(2,22,t),inverse:ansi(7,27,t),italic:ansi(3,23,t),white:ansi(97,39,t),gray:ansi(90,39,t),cyan:ansi(36,39,t),green:ansi(32,39,t),red:ansi(31,39,t),yellow:ansi(33,39,t),magenta:ansi(35,39,t),blue:ansi(34,39,t),orange:ansi256(208,t)},glyph:n?UNICODE_GLYPHS:ASCII_GLYPHS,spinner:n?UNICODE_SPINNER:ASCII_SPINNER}}function detectUnicode(e=process.env){let t=e.EVE_TUI_UNICODE;return t===`0`||t===`false`?!1:t===`1`||t===`true`?!0:e.TERM===`dumb`?!1:process.platform!==`win32`||!!(e.WT_SESSION||e.TERM_PROGRAM===`vscode`)}export{createTheme,detectUnicode};
@@ -8,11 +8,8 @@ interface ToolBlockDisplayGroup {
8
8
  *
9
9
  * A contiguous run of equivalent tool calls is partitioned by status, so a
10
10
  * batch with interleaved outcomes renders as one succeeded aggregate and one
11
- * failed aggregate instead of fragmenting on every status flip. A contiguous
12
- * run of same-named subagent calls coalesces the repeated headers into one
13
- * counted header, reorders the interleaved children call by call, and elides
14
- * all but the newest {@link maxVisibleSubagentRunChildren} children behind a
15
- * `… +N more` row. Captured log writes coalesce per
11
+ * failed aggregate instead of fragmenting on every status flip. Captured log
12
+ * writes coalesce per
16
13
  * {@link GroupToolBlocksOptions.logCoalescing}. Because of all this, a
17
14
  * group's members are not always contiguous in the input: callers that
18
15
  * consume a group must remove its members by identity, never by prefix
@@ -33,9 +30,9 @@ interface GroupToolBlocksOptions {
33
30
  }
34
31
  export declare function groupToolBlocksForDisplay(blocks: readonly Block[], options?: GroupToolBlocksOptions): ToolBlockDisplayGroup[];
35
32
  /**
36
- * A live subagent section shows only its most recently active child row;
37
- * everything earlier collapses into a single `… (N more)` line under the
38
- * header. The completed section's counted footnote carries the full story.
33
+ * What an agent did, for the line its task ends on: counted settled work plus
34
+ * a failure count, so an error folds into the summary without vanishing from
35
+ * it. `undefined` when the agent ran no tools.
39
36
  */
40
- export declare const maxVisibleSubagentRunChildren = 1;
37
+ export declare function summarizeChildTools(children: readonly Block[]): string | undefined;
41
38
  export {};
@@ -1 +1 @@
1
- import{toolBaseName}from"./tool-presentation.js";function groupToolBlocksForDisplay(e,t={}){if((t.logCoalescing??`window`)===`window`){let t=new Map;for(let n of e){if(!isGroupableLogWrite(n))continue;let e=logBucketKey(n),r=t.get(e);r===void 0?t.set(e,[n]):r.push(n)}let n=new Map;for(let e of t.values())n.set(e.at(-1),coalesceLogBucket(e));return groupBlocks(e,n)}return groupBlocks(e)}function groupBlocks(e,t){let n=[];for(let r=0;r<e.length;){let i=e[r];if(isGroupableLogWrite(i)){if(t!==void 0){let e=t.get(i);e!==void 0&&n.push(e),r+=1;continue}let a=[i];for(;r+a.length<e.length&&isGroupableLogWrite(e[r+a.length]);)a.push(e[r+a.length]);n.push(...coalesceLogWrites(a)),r+=a.length;continue}if(i.kind===`subagent`&&i.subagentCallId!==void 0){let i=collectSubagentRun(e,r,t);n.push(...i.groups),r+=i.consumed;continue}if(isCondensableChildTool(i)){let t=[i];for(;r+t.length<e.length;){let n=e[r+t.length];if(n.subagentCallId!==i.subagentCallId||!isCondensableChildTool(n)&&!isItemizedChildFailure(n))break;t.push(n)}let a=e[r+t.length],o=t.filter(isCondensableChildTool);if(o.length>=2&&a?.kind===`subagent-step`&&a.subagentCallId===i.subagentCallId){n.push({members:o,display:condenseChildToolRun(o)});for(let e of t)isCondensableChildTool(e)||n.push({members:[e],display:e});r+=t.length;continue}}if(!isGroupable(i)){n.push({members:[i],display:i}),r+=1;continue}let a=[i];for(;r+a.length<e.length;){let t=e[r+a.length];if(!isGroupable(t)||!sameRun(i,t))break;a.push(t)}a.some(e=>e.status===`running`)&&a.length>1?n.push({members:a,display:aggregateLiveToolBlocks(a)}):n.push(...partitionRunByStatus(a)),r+=a.length}return n}function isGroupable(e){return(e.kind===`tool`||e.kind===`subagent-tool`)&&e.toolGroup!==void 0&&e.expanded!==!0&&(e.status===`running`||e.status===`error`||e.status===`done`&&e.result===void 0)}function sameRun(e,t){return t.kind===e.kind&&t.depth===e.depth&&t.live===e.live&&t.toolName===e.toolName}function partitionRunByStatus(e){let t=new Map;for(let n of e){let e=t.get(n.status);e===void 0?t.set(n.status,[n]):e.push(n)}return[...t.values()].map(e=>({members:e,display:e.length===1?e[0]:e[0].status===`done`?collapseSettledToolBlocks(e):aggregateToolBlocks(e)}))}const maxVisibleSubagentRunChildren=1;function isGroupableLogWrite(e){return e.kind===`log`&&e.id===void 0}function logBucketKey(e){return`${e.title??``}\u0000${e.logVisibility??``}`}function coalesceLogWrites(e){let t=new Map;for(let n of e){let e=logBucketKey(n),r=t.get(e);r===void 0?t.set(e,[n]):r.push(n)}return[...t.values()].map(coalesceLogBucket)}function coalesceLogBucket(e){if(e.length===1)return{members:e,display:e[0]};let t=e.at(-1),n={kind:`log`,live:e.some(e=>e.live!==!1),body:t.body??``,elided:e.length-1};return t.title!==void 0&&(n.title=t.title),t.logVisibility!==void 0&&(n.logVisibility=t.logVisibility),{members:e,display:n}}const RUN_PASS_THROUGH_KINDS=new Set([`log`,`sandbox`,`error`,`warning`,`notice`]);function collectSubagentRun(e,t,n){let r=e[t],i=[r],a=new Map([[r.subagentCallId,[]]]),o=[],s=1;for(;t+s<e.length;s+=1){let n=e[t+s];if(RUN_PASS_THROUGH_KINDS.has(n.kind)){o.push(n);continue}if(n.kind===`subagent`){if(n.subagentCallId===void 0||a.has(n.subagentCallId))break;i.push(n),a.set(n.subagentCallId,[]);continue}let r=n.subagentCallId===void 0?void 0:a.get(n.subagentCallId);if(r===void 0)break;r.push(n)}for(;o.length>0&&e[t+s-1]===o.at(-1);)o.pop(),--s;let c=[];for(let e of i){let t=a.get(e.subagentCallId),n=e.live!==!1||t.some(e=>e.live!==!1),r=n===(e.live!==!1)?e:{...e,live:n};if(e.status===`done`){let i=condensedChildSummary(t);c.push({members:[e],display:r}),c.push({members:t,display:{kind:`subagent-close`,subagentCallId:e.subagentCallId,live:n,body:i===void 0?`Done`:`Done. ${i}`}});continue}c.push({members:[e],display:r});let recency=e=>e.members.reduce((e,t)=>Math.max(e,updateRecency(t)),-1),i=groupToolBlocksForDisplay(t).slice().sort((e,t)=>recency(e)-recency(t)),o=i.slice(0,Math.max(0,i.length-1)),s=i.slice(o.length),l=o.flatMap(e=>e.members);l.length>0&&c.push({members:l,display:{kind:`subagent-step`,depth:1,live:n,elided:l.length}}),c.push(...s.slice(0,-1));let u=s.at(-1);u!==void 0&&c.push({members:u.members,display:{...u.display,closesRail:!0}})}for(let e of o){if(n!==void 0&&isGroupableLogWrite(e)){let t=n.get(e);t!==void 0&&c.push(t);continue}c.push({members:[e],display:e})}return{consumed:s,groups:c}}function aggregateToolBlocks(e){let t=e[0],n=t.toolGroup,r=e.length;return{...t,id:void 0,result:void 0,title:`${n.verb} ${r} ${r===1?n.singularNoun:n.pluralNoun}`,toolGroupItems:newestFirstItems(e)}}function aggregateLiveToolBlocks(e){return{...aggregateToolBlocks(e),status:`running`,live:!0}}function collapseSettledToolBlocks(e){let t=e[0],n=t.toolGroup,r=e.length,i=r===1?n.singularNoun:n.pluralNoun;return{...t,id:void 0,result:void 0,title:`${n.verb} ${r} ${i}`,doneTitle:`${n.pastVerb} ${r} ${i}`}}function isCondensableChildTool(e){return e.kind===`subagent-tool`&&e.status===`done`&&e.expanded!==!0}function isItemizedChildFailure(e){return e.kind===`subagent-tool`&&e.status===`error`&&e.expanded!==!0}function condensedRunTitle(e){let t=new Map;for(let n of e){let e=condensedKindCopy(n),r=`${e.pastVerb} ${e.pluralNoun}`,i=t.get(r);i===void 0?t.set(r,{copy:e,count:1}):i.count+=1}let n=[...t.values()].sort((e,t)=>t.count-e.count),r=n.slice(0,3).map(({copy:e,count:t})=>`${e.pastVerb} ${t} ${t===1?e.singularNoun:e.pluralNoun}`);return n.length>3?`${r.join(`, `)}, and more`:r.join(`, `)}function condensedChildSummary(e){let t=e.filter(e=>e.kind===`subagent-tool`);if(t.length===0)return;let n=t.filter(e=>e.status===`done`),r=t.filter(e=>e.status===`error`).length,i=[];return n.length>0&&i.push(condensedRunTitle(n)),r>0&&i.push(`${r} failed`),i.length>0?i.join(`, `):void 0}function condenseChildToolRun(e){let t=condensedRunTitle(e),n=e[0];return{kind:`subagent-tool`,subagentCallId:n.subagentCallId,depth:n.depth,live:n.live,status:`done`,title:t,doneTitle:t,subtitle:``}}function condensedKindCopy(e){let t=e.toolGroup;return t===void 0?toolBaseName(e.toolName??``)===`write_file`?{pastVerb:`Wrote`,singularNoun:`file`,pluralNoun:`files`}:{pastVerb:`Made`,singularNoun:`tool call`,pluralNoun:`tool calls`}:{pastVerb:t.pastVerb,singularNoun:t.singularNoun,pluralNoun:t.pluralNoun}}function updateRecency(e){return e.updateSeq??0}function newestFirstItems(e){return e.map((e,t)=>({member:e,order:updateRecency(e),position:t})).sort((e,t)=>t.order-e.order||t.position-e.position).map(({member:e})=>{let t={text:e.toolGroup.item};return e.status===`error`&&e.result!==void 0?{...t,result:e.result}:t})}export{groupToolBlocksForDisplay,maxVisibleSubagentRunChildren};
1
+ import{toolBaseName}from"./tool-presentation.js";function groupToolBlocksForDisplay(e,t={}){if((t.logCoalescing??`window`)===`window`){let t=new Map;for(let n of e){if(!isGroupableLogWrite(n))continue;let e=logBucketKey(n),r=t.get(e);r===void 0?t.set(e,[n]):r.push(n)}let n=new Map;for(let e of t.values())n.set(e.at(-1),coalesceLogBucket(e));return groupBlocks(e,n)}return groupBlocks(e)}function groupBlocks(e,t){let n=[];for(let r=0;r<e.length;){let i=e[r];if(isGroupableLogWrite(i)){if(t!==void 0){let e=t.get(i);e!==void 0&&n.push(e),r+=1;continue}let a=[i];for(;r+a.length<e.length&&isGroupableLogWrite(e[r+a.length]);)a.push(e[r+a.length]);n.push(...coalesceLogWrites(a)),r+=a.length;continue}if(!isGroupable(i)){n.push({members:[i],display:i}),r+=1;continue}let a=[i];for(;r+a.length<e.length;){let t=e[r+a.length];if(!isGroupable(t)||!sameRun(i,t))break;a.push(t)}a.some(e=>e.status===`running`)&&a.length>1?n.push({members:a,display:aggregateLiveToolBlocks(a)}):n.push(...partitionRunByStatus(a)),r+=a.length}return n}function isGroupable(e){return(e.kind===`tool`||e.kind===`subagent-tool`)&&e.toolGroup!==void 0&&e.expanded!==!0&&(e.status===`running`||e.status===`error`||e.status===`done`&&e.result===void 0)}function sameRun(e,t){return t.kind===e.kind&&t.depth===e.depth&&t.live===e.live&&t.subagentCallId===e.subagentCallId&&t.toolName===e.toolName}function partitionRunByStatus(e){let t=new Map;for(let n of e){let e=t.get(n.status);e===void 0?t.set(n.status,[n]):e.push(n)}return[...t.values()].map(e=>({members:e,display:e.length===1?e[0]:e[0].status===`done`?collapseSettledToolBlocks(e):aggregateToolBlocks(e)}))}function isGroupableLogWrite(e){return e.kind===`log`&&e.id===void 0}function logBucketKey(e){return`${e.title??``}\u0000${e.logLevel??``}\u0000${e.logVisibility??``}`}function coalesceLogWrites(e){let t=new Map;for(let n of e){let e=logBucketKey(n),r=t.get(e);r===void 0?t.set(e,[n]):r.push(n)}return[...t.values()].map(coalesceLogBucket)}function coalesceLogBucket(e){if(e.length===1)return{members:e,display:e[0]};let t=e.at(-1),n={kind:`log`,live:e.some(e=>e.live!==!1),body:t.body??``,elided:e.length-1};return t.title!==void 0&&(n.title=t.title),t.logVisibility!==void 0&&(n.logVisibility=t.logVisibility),t.logLevel!==void 0&&(n.logLevel=t.logLevel),{members:e,display:n}}function aggregateToolBlocks(e){let t=e[0],n=t.toolGroup,r=e.length;return{...t,id:void 0,result:void 0,title:`${n.verb} ${r} ${r===1?n.singularNoun:n.pluralNoun}`,toolGroupItems:newestFirstItems(e)}}function aggregateLiveToolBlocks(e){return{...aggregateToolBlocks(e),status:`running`,live:!0}}function collapseSettledToolBlocks(e){let t=e[0],n=t.toolGroup,r=e.length,i=r===1?n.singularNoun:n.pluralNoun;return{...t,id:void 0,result:void 0,title:`${n.verb} ${r} ${i}`,doneTitle:`${n.pastVerb} ${r} ${i}`}}function condensedRunTitle(e){let t=new Map;for(let n of e){let e=condensedKindCopy(n),r=`${e.pastVerb} ${e.pluralNoun}`,i=t.get(r);i===void 0?t.set(r,{copy:e,count:1}):i.count+=1}let n=[...t.values()].sort((e,t)=>t.count-e.count),r=n.slice(0,3).map(({copy:e,count:t})=>`${e.pastVerb} ${t} ${t===1?e.singularNoun:e.pluralNoun}`);return n.length>3?`${r.join(`, `)}, and more`:r.join(`, `)}function summarizeChildTools(e){let t=e.filter(e=>e.kind===`subagent-tool`);if(t.length===0)return;let n=t.filter(e=>e.status===`done`),r=t.filter(e=>e.status===`error`).length,i=[];return n.length>0&&i.push(condensedRunTitle(n)),r>0&&i.push(`${r} failed`),i.length>0?i.join(`, `):void 0}function condensedKindCopy(e){let t=e.toolGroup;return t===void 0?toolBaseName(e.toolName??``)===`write_file`?{pastVerb:`Wrote`,singularNoun:`file`,pluralNoun:`files`}:{pastVerb:`Used`,singularNoun:`tool`,pluralNoun:`tools`}:{pastVerb:t.pastVerb,singularNoun:t.singularNoun,pluralNoun:t.pluralNoun}}function updateRecency(e){return e.updateSeq??0}function newestFirstItems(e){return e.map((e,t)=>({member:e,order:updateRecency(e),position:t})).sort((e,t)=>t.order-e.order||t.position-e.position).map(({member:e})=>{let t={text:e.toolGroup.item};return e.status===`error`&&e.result!==void 0?{...t,result:e.result}:t})}export{groupToolBlocksForDisplay,summarizeChildTools};
@@ -26,6 +26,10 @@ export interface ToolPresentationContext {
26
26
  * `Delegate stock-price` — instead of a generic tool call.
27
27
  */
28
28
  readonly isSubagent?: boolean;
29
+ /** The tool's own `label.start` copy, used when eve has no copy of its own for the tool. */
30
+ readonly label?: string;
31
+ /** The tool's own `label.complete` copy, shown once the call succeeds. */
32
+ readonly completeLabel?: string;
29
33
  }
30
34
  /** Copy needed to aggregate equivalent calls without merging their state. */
31
35
  export interface ToolGroupPresentation {
@@ -49,11 +53,21 @@ export declare function readWriteFileInput(toolName: string, input: unknown): {
49
53
  * calls keep the generic formatter, so presentation can never break execution.
50
54
  */
51
55
  export declare function presentTool(toolName: string, input: unknown, context?: ToolPresentationContext): ToolPresentation;
56
+ /**
57
+ * The bundled self-modification subagent's compiled name: its extension
58
+ * namespace joined to `subagents/agent` by the compiler's `__` rule.
59
+ */
60
+ export declare const SELF_MODIFICATION_AGENT_NAME = "self-modification__agent";
61
+ /** True for the bundled self-modification subagent's dispatch tool. */
62
+ export declare function isSelfModificationAgent(toolName: string): boolean;
63
+ /** The name an agent task goes by in the delegate row, task line, and task panel. */
64
+ export declare function agentTaskLabel(name: string): string;
65
+ export declare function agentDisplayName(toolName: string): string;
52
66
  /**
53
67
  * Placeholder copy for a call whose input is still streaming from the model
54
- * (`action.preparing`). Known tools lead with their activity verb so the row
55
- * already reads as intent (`Fetch …`); unknown tools keep their name with a
56
- * quiet hint. The full presentation replaces this once the input arrives.
68
+ * (`action.input.appended`). Known tools lead with their activity verb so the
69
+ * row already reads as intent (`Fetch …`); unknown tools lead with their name.
70
+ * The full presentation replaces this once the input arrives.
57
71
  */
58
72
  export declare function presentPreparingTool(toolName: string, context?: ToolPresentationContext): ToolPresentation;
59
73
  /**
@@ -1 +1 @@
1
- import{summarizeToolArgs,summarizeToolResult}from"./tool-format.js";import{diffWriteDetail}from"./line-diff.js";import{stripTerminalControls}from"#cli/ui/terminal-text.js";const WRITE_FILE_VERB=`Write`,DELEGATE_VERB=`Delegate`,FINAL_OUTPUT_TITLE=`Return final output`,BUILTIN_TOOL_COPY={agent:{verb:`Delegate`,pastVerb:`Delegated`,argKey:`message`,singularNoun:`task`,pluralNoun:`tasks`},ask_question:{verb:`Ask`,pastVerb:`Asked`,argKey:`question`,singularNoun:`question`,pluralNoun:`questions`},bash:{verb:`Run`,pastVerb:`Ran`,argKey:`command`,singularNoun:`command`,pluralNoun:`commands`},connection_search:{verb:`Discover`,pastVerb:`Discovered`,argKey:`keywords`,singularNoun:`tool search`,pluralNoun:`tool searches`},glob:{verb:`Glob`,pastVerb:`Globbed`,argKey:`pattern`,singularNoun:`pattern`,pluralNoun:`patterns`},grep:{verb:`Grep`,pastVerb:`Grepped`,argKey:`pattern`,singularNoun:`pattern`,pluralNoun:`patterns`},load_skill:{verb:`Load`,pastVerb:`Loaded`,argKey:`skill`,singularNoun:`skill`,pluralNoun:`skills`},read_file:{verb:`Read`,pastVerb:`Read`,argKey:`filePath`,singularNoun:`file`,pluralNoun:`files`},task_cancel:{verb:`Cancel`,pastVerb:`Cancelled`,argKey:`taskIds`,extractItem:taskIdsArg,singularNoun:`task`,pluralNoun:`tasks`},web_fetch:{verb:`Fetch`,pastVerb:`Fetched`,argKey:`url`,singularNoun:`URL`,pluralNoun:`URLs`},web_search:{verb:`Search`,pastVerb:`Searched`,argKey:`query`,extractItem:e=>salientArg(e,`objective`)??salientArg(e,`search_query`)??salientArg(e,`searchQuery`)??webSearchActionArg(e),singularNoun:`query`,pluralNoun:`queries`}};function presentWriteFileTool(e,t,n){let r=readWriteFileInput(e,t);if(r===void 0)return{title:e,subtitle:summarizeToolArgs(t),summarizeResult:summarizeToolResult};let i=diffWriteDetail(n?.previousContent,r.content,n?.existed).map(e=>e.kind===`gap`?e:{...e,text:stripTerminalControls(e.text)});return{title:`${WRITE_FILE_VERB} ${salientLine(r.path)??r.path}`,doneTitle:`Wrote ${salientLine(r.path)??r.path}`,subtitle:``,summarizeResult:()=>void 0,detail:i,keepDetailWhenDone:!0}}function readWriteFileInput(e,t){if(toolBaseName(e)!==`write_file`||typeof t!=`object`||!t||Array.isArray(t))return;let n=t,r=n.filePath,i=n.content;if(typeof r==`string`&&r.trim().length!==0&&typeof i==`string`)return{path:r,content:i}}function presentTool(e,t,n){let r=toolBaseName(e);if(r===`write_file`)return presentWriteFileTool(e,t,n);if(n?.isSubagent===!0)return{title:`${DELEGATE_VERB} ${r}`,doneTitle:`Delegated ${r}`,subtitle:salientArg(t,`message`)??``,summarizeResult:()=>void 0};if(r===`final_output`)return{title:FINAL_OUTPUT_TITLE,subtitle:``,summarizeResult:()=>void 0};let i=BUILTIN_TOOL_COPY[r];if(i!==void 0){let e=salientArg(t,i.argKey)??i.extractItem?.(t);if(e!==void 0)return{title:`${i.verb} ${e}`,doneTitle:`${i.pastVerb} ${e}`,subtitle:``,summarizeResult:()=>void 0,group:{verb:i.verb,pastVerb:i.pastVerb,singularNoun:i.singularNoun,pluralNoun:i.pluralNoun,item:e}}}return{title:e,subtitle:summarizeToolArgs(t),summarizeResult:summarizeToolResult}}function presentPreparingTool(e,t){let n=toolBaseName(e);if(n===`final_output`)return{title:FINAL_OUTPUT_TITLE,subtitle:``,summarizeResult:()=>void 0};if(t?.isSubagent===!0)return{title:`${DELEGATE_VERB} ${n} …`,subtitle:``,summarizeResult:()=>void 0};let r=n===`write_file`?WRITE_FILE_VERB:BUILTIN_TOOL_COPY[n]?.verb;return{title:r===void 0?e:`${r} …`,subtitle:r===void 0?`preparing…`:``,summarizeResult:()=>void 0}}function isPanelRoutedTool(e){return toolBaseName(e)===`ask_question`}function toolBaseName(e){return e.split(/[.:/]/u).at(-1)??e}function webSearchActionArg(e){if(typeof e!=`object`||!e||Array.isArray(e))return;let t=e.action;if(typeof t!=`object`||!t||Array.isArray(t))return;let n=t,r=n.queries;if(Array.isArray(r)){let e=r.filter(e=>typeof e==`string`).map(salientLine).filter(e=>e!==void 0).join(`, `);if(e.length>0)return e}for(let e of[`query`,`url`,`pattern`]){let t=n[e];if(typeof t==`string`){let e=salientLine(t);if(e!==void 0)return e}}}function taskIdsArg(e){if(typeof e!=`object`||!e||Array.isArray(e))return;let t=e.taskIds;if(!Array.isArray(t))return;let n=t.filter(e=>typeof e==`string`);if(n.length!==0)return salientLine(n.join(`, `))}function salientArg(e,t){if(typeof e!=`object`||!e||Array.isArray(e))return;let n=e[t];if(typeof n==`string`)return salientLine(n)}function salientLine(e){let t=stripTerminalControls(e).split(/\r?\n/u).find(e=>e.trim().length>0)?.trim()??``;return t.length>0?t:void 0}export{isPanelRoutedTool,presentPreparingTool,presentTool,readWriteFileInput,toolBaseName};
1
+ import{summarizeToolArgs,summarizeToolResult}from"./tool-format.js";import{diffWriteDetail}from"./line-diff.js";import{stripTerminalControls}from"#cli/ui/terminal-text.js";const WRITE_FILE_VERB=`Write`,DELEGATE_VERB=`Delegate`,FINAL_OUTPUT_TITLE=`Return final output`,BUILTIN_TOOL_COPY={agent:{verb:`Delegate`,pastVerb:`Delegated`,argKey:`message`,singularNoun:`task`,pluralNoun:`tasks`},ask_question:{verb:`Ask`,pastVerb:`Asked`,argKey:`question`,singularNoun:`question`,pluralNoun:`questions`},bash:{verb:`Run`,pastVerb:`Ran`,argKey:`command`,singularNoun:`command`,pluralNoun:`commands`},connection_execute:{verb:`Call`,pastVerb:`Called`,argKey:``,extractItem:e=>{let t=salientArg(e,`connection`),n=salientArg(e,`tool`);return t===void 0||n===void 0?void 0:`${t}.${n}`},singularNoun:`connection tool`,pluralNoun:`connection tools`},connection_search:{verb:`Search`,pastVerb:`Searched`,argKey:`query`,extractItem:e=>salientArg(e,`connection`),singularNoun:`tool search`,pluralNoun:`tool searches`},glob:{verb:`Glob`,pastVerb:`Globbed`,argKey:`pattern`,singularNoun:`pattern`,pluralNoun:`patterns`},grep:{verb:`Grep`,pastVerb:`Grepped`,argKey:`pattern`,singularNoun:`pattern`,pluralNoun:`patterns`},load_skill:{verb:`Load`,pastVerb:`Loaded`,argKey:`skill`,singularNoun:`skill`,pluralNoun:`skills`},read_file:{verb:`Read`,pastVerb:`Read`,argKey:`filePath`,singularNoun:`file`,pluralNoun:`files`},web_fetch:{verb:`Fetch`,pastVerb:`Fetched`,argKey:`url`,singularNoun:`URL`,pluralNoun:`URLs`},web_search:{verb:`Search`,pastVerb:`Searched`,argKey:`query`,extractItem:e=>salientArg(e,`objective`)??salientArg(e,`search_query`)??salientArg(e,`searchQuery`)??webSearchActionArg(e),singularNoun:`query`,pluralNoun:`queries`}};function presentWriteFileTool(e,t,n){let r=readWriteFileInput(e,t);if(r===void 0)return{title:e,subtitle:summarizeToolArgs(t),summarizeResult:summarizeToolResult};let i=diffWriteDetail(n?.previousContent,r.content,n?.existed).map(e=>e.kind===`gap`?e:{...e,text:stripTerminalControls(e.text)});return{title:`${WRITE_FILE_VERB} ${salientLine(r.path)??r.path}`,doneTitle:`Wrote ${salientLine(r.path)??r.path}`,subtitle:``,summarizeResult:()=>void 0,detail:i,keepDetailWhenDone:!0}}function readWriteFileInput(e,t){if(toolBaseName(e)!==`write_file`||typeof t!=`object`||!t||Array.isArray(t))return;let n=t,r=n.filePath,i=n.content;if(typeof r==`string`&&r.trim().length!==0&&typeof i==`string`)return{path:r,content:i}}function presentTool(e,t,n){let r=toolBaseName(e);if(r===`write_file`)return presentWriteFileTool(e,t,n);if(n?.isSubagent===!0){let n=isSelfModificationAgent(e)?agentDisplayName(e):agentTaskLabel(agentDisplayName(e));return{title:`${DELEGATE_VERB} ${n}`,doneTitle:`Delegated ${n}`,subtitle:salientArg(t,`message`)??``,summarizeResult:()=>void 0}}if(r===`final_output`)return{title:FINAL_OUTPUT_TITLE,subtitle:``,summarizeResult:()=>void 0};let i=BUILTIN_TOOL_COPY[r];if(i!==void 0){let e=salientArg(t,i.argKey)??i.extractItem?.(t);if(e!==void 0)return{title:`${i.verb} ${e}`,doneTitle:`${i.pastVerb} ${e}`,subtitle:``,summarizeResult:()=>void 0,group:{verb:i.verb,pastVerb:i.pastVerb,singularNoun:i.singularNoun,pluralNoun:i.pluralNoun,item:e}}}if(n?.label!==void 0){let e={title:n.label,subtitle:``,summarizeResult:summarizeToolResult};return n.completeLabel===void 0?e:{...e,doneTitle:n.completeLabel}}return{title:e,subtitle:summarizeToolArgs(t),summarizeResult:summarizeToolResult}}const SELF_MODIFICATION_AGENT_NAME=`self-modification__agent`,AGENT_DISPLAY_NAMES=new Map([[`agent`,`subagent`],[SELF_MODIFICATION_AGENT_NAME,`agent editor`]]);function isSelfModificationAgent(e){return toolBaseName(e)===SELF_MODIFICATION_AGENT_NAME}function agentTaskLabel(e){let t=e.replace(/^self-modification__agent(?=:\d+$|$)/u,`agent editor`).replace(/__agent(?=:\d+$|$)/u,``);return t===`subagent`||t.startsWith(`agent editor`)?t:`subagent(${t})`}function agentDisplayName(e){let t=toolBaseName(e);return AGENT_DISPLAY_NAMES.get(t)??t}function presentPreparingTool(e,t){let n=toolBaseName(e);return n===`final_output`?{title:FINAL_OUTPUT_TITLE,subtitle:``,summarizeResult:()=>void 0}:t?.isSubagent===!0?{title:`${DELEGATE_VERB} ${agentTaskLabel(agentDisplayName(e))} …`,subtitle:``,summarizeResult:()=>void 0}:{title:`${(n===`write_file`?WRITE_FILE_VERB:BUILTIN_TOOL_COPY[n]?.verb)??e} …`,subtitle:``,summarizeResult:()=>void 0}}function isPanelRoutedTool(e){return toolBaseName(e)===`ask_question`}function toolBaseName(e){return e.split(/[.:/]/u).at(-1)??e}function webSearchActionArg(e){if(typeof e!=`object`||!e||Array.isArray(e))return;let t=e.action;if(typeof t!=`object`||!t||Array.isArray(t))return;let n=t,r=n.queries;if(Array.isArray(r)){let e=r.filter(e=>typeof e==`string`).map(salientLine).filter(e=>e!==void 0).join(`, `);if(e.length>0)return e}for(let e of[`query`,`url`,`pattern`]){let t=n[e];if(typeof t==`string`){let e=salientLine(t);if(e!==void 0)return e}}}function salientArg(e,t){if(typeof e!=`object`||!e||Array.isArray(e))return;let n=e[t];if(typeof n==`string`)return salientLine(n)}function salientLine(e){let t=stripTerminalControls(e).split(/\r?\n/u).find(e=>e.trim().length>0)?.trim()??``;return t.length>0?t:void 0}export{SELF_MODIFICATION_AGENT_NAME,agentDisplayName,agentTaskLabel,isPanelRoutedTool,isSelfModificationAgent,presentPreparingTool,presentTool,readWriteFileInput,toolBaseName};
@@ -8,6 +8,7 @@
8
8
  import type { DisplayBlock, RenderBlockContext } from "./blocks.js";
9
9
  import type { Theme } from "./theme.js";
10
10
  export declare function renderTool(block: DisplayBlock, width: number, theme: Theme, context: RenderBlockContext): string[];
11
+ export declare function renderToolHeader(name: string, args: string, icon: string, width: number, theme: Theme): string;
11
12
  /**
12
13
  * An aggregated tool row lists at most this many member items; the rest
13
14
  * collapse into a single `… (N more)` line above the closing corner.
@@ -1,2 +1,2 @@
1
- import{formatValuePretty,truncate}from"./tool-format.js";import{elisionText}from"./rail.js";import{clipVisible,visibleLength,wrapVisibleLine}from"#cli/ui/terminal-text.js";function renderTool(e,t,n,r){return(e.depth??0)===0?renderToolRows(e,t-1,n,r).map(e=>` ${e}`):renderToolRows(e,t,n,r)}function renderToolRows(e,t,n,r){let{icon:i,accent:a}=toolGlyph(e.status??`running`,n,r),o=e.status===`done`&&e.doneTitle!==void 0?e.doneTitle:e.title??`tool`,s=t-3,c=clipVisible(o,s),l=` ${i} ${boldLeadingWord(c,n)}`,u=s-c.length-2,d=e.subtitle??``;d.length>0&&u>=6&&(l+=` ${n.colors.gray(truncate(d,u))}`);let f=[l],p=[];return e.toolGroupItems===void 0?!e.expanded&&showToolDetail(e)&&p.push(...detailLineRows(e.detailLines??[],t,n)):p.push(...toolGroupItemRows(e.toolGroupItems,t,n)),p.length>0&&f.push(...p,` ${n.colors.dim(n.glyph.corner)}`),e.expanded?f.push(...renderToolExpanded(e,t,n)):e.status===`done`&&e.result&&e.result.length>0?f.push(resultLine(n.glyph.arrow,e.result,t,n,a)):e.status===`error`&&e.result?f.push(errorDetailLine(e.result,t,n)):e.status===`denied`&&f.push(resultLine(n.glyph.arrow,`denied`,t,n,n.colors.yellow)),f}function boldLeadingWord(e,t){let n=e.indexOf(` `);return n===-1?t.colors.bold(e):`${t.colors.bold(e.slice(0,n))}${t.colors.dim(e.slice(n))}`}function showToolDetail(e){if(e.detailLines===void 0||e.detailLines.length===0)return!1;let t=e.status??`running`;return t===`running`||t===`approval`||e.keepDetailWhenDone===!0}const maxVisibleToolGroupItems=5;function railRow(e,t){return` ${t.colors.dim(t.glyph.rule)} ${e}`}function elisionRow(e,t){return railRow(elisionText(e,t),t)}function toolGroupItemRows(e,t,n){let r=e.slice(0,5),i=e.length-r.length,a=itemRows(r,t,n);return i>0&&a.push(elisionRow(i,n)),a}function detailLineRows(e,t,n){let r=n.colors,i=e.slice(0,10),a=e.length-i.length,o=i.some(e=>e.kind===`added`||e.kind===`removed`),s=Math.max(1,t-(o?5:4)),c=i.map(e=>{if(e.kind===`gap`)return railRow(r.dim(n.glyph.ellipsis),n);let t=clipVisible(e.text,s);switch(e.kind){case`added`:return` ${r.dim(n.glyph.rule)}${r.green(`+`)} ${r.green(t)}`;case`removed`:return` ${r.dim(n.glyph.rule)}${r.red(`-`)} ${r.red(t)}`;default:return o?` ${r.dim(n.glyph.rule)} ${r.gray(t)}`:railRow(r.gray(t),n)}});return a>0&&c.push(elisionRow(a,n)),c}function itemRows(e,t,n){let r=Math.max(1,t-4);if(!e.some(e=>e.result!==void 0&&e.result.length>0))return e.map(e=>railRow(n.colors.gray(truncate(e.text,r)),n));let i=Math.min(Math.max(...e.map(e=>visibleLength(e.text))),Math.max(8,r-9)),a=Math.max(8,r-i-1);return e.map(e=>{let t=truncate(e.text,i);if(e.result===void 0||e.result.length===0)return railRow(n.colors.gray(t),n);let r=t+` `.repeat(Math.max(0,i-visibleLength(t)));return railRow(`${n.colors.gray(r)} ${n.colors.red(truncate(e.result,a))}`,n)})}function renderToolExpanded(e,t,n){let r=[],push=(e,i,a)=>{if(i!==void 0){r.push(` ${n.colors.dim(e)}`);for(let e of formatValuePretty(i).split(`
2
- `))for(let n of wrapVisibleLine(e,Math.max(1,t-4)))r.push(` ${a(n)}`)}};return push(`input`,e.toolInput,n.colors.gray),e.status===`error`&&e.result?push(`error`,e.result,n.colors.red):push(`output`,e.toolOutput,n.colors.gray),r}function resultLine(e,t,n,r,i){let a=n-4;return` ${r.colors.dim(e)} ${i(truncate(t,a))}`}function errorDetailLine(e,t,n){let r=t-5;return` ${n.colors.dim(n.glyph.corner)} ${n.colors.red(truncate(e,r))}`}function toolGlyph(e,t,n){switch(e){case`done`:return{icon:t.colors.gray(t.glyph.square),accent:t.colors.gray};case`error`:return{icon:t.colors.red(t.glyph.error),accent:t.colors.red};case`denied`:return{icon:t.colors.yellow(t.glyph.warning),accent:t.colors.yellow};case`approval`:return{icon:t.colors.yellow(t.glyph.question),accent:t.colors.yellow};default:return{icon:t.colors.yellow(n.activityPulse),accent:t.colors.gray}}}export{maxVisibleToolGroupItems,renderTool};
1
+ import{formatValuePretty,truncate}from"./tool-format.js";import{elisionText}from"./rail.js";import{clipVisible,visibleLength,wrapVisibleLine}from"#cli/ui/terminal-text.js";function renderTool(e,t,n,r){return(e.depth??0)===0?renderToolRows(e,t-1,n,r).map(e=>` ${e}`):renderToolRows(e,t,n,r)}function renderToolRows(e,t,n,r){let{icon:i,accent:a}=toolGlyph(e.status??`running`,n,r),o=[renderToolHeader(e.status===`done`&&e.doneTitle!==void 0?e.doneTitle:e.title??`tool`,e.subtitle??``,i,t,n)],s=[];return e.toolGroupItems===void 0?!e.expanded&&showToolDetail(e)&&s.push(...detailLineRows(e.detailLines??[],t,n)):s.push(...toolGroupItemRows(e.toolGroupItems,t,n)),s.length>0&&o.push(...s,` ${n.colors.dim(n.glyph.corner)}`),e.expanded?o.push(...renderToolExpanded(e,t,n)):e.status===`done`&&e.result&&e.result.length>0?o.push(resultLine(n.glyph.arrow,e.result,t,n,a)):e.status===`error`&&e.result?o.push(errorDetailLine(e.result,t,n)):e.status===`denied`&&o.push(resultLine(n.glyph.arrow,`denied`,t,n,n.colors.yellow)),o}function renderToolHeader(e,t,n,r,i){let a=Math.max(0,r-3),o=clipVisible(e,a),s=` ${n} ${boldLeadingWord(o,i)}`,c=a-visibleLength(o)-2;return t.length>0&&c>=6&&(s+=` ${i.colors.gray(truncate(t,c))}`),clipVisible(s,r)}function boldLeadingWord(e,t){let n=e.indexOf(` `);return n===-1?t.colors.bold(e):`${t.colors.bold(e.slice(0,n))}${t.colors.dim(e.slice(n))}`}function showToolDetail(e){if(e.detailLines===void 0||e.detailLines.length===0)return!1;let t=e.status??`running`;return t===`running`||t===`approval`||e.keepDetailWhenDone===!0}const maxVisibleToolGroupItems=5;function railRow(e,t){return` ${t.colors.dim(t.glyph.rule)} ${e}`}function elisionRow(e,t){return railRow(elisionText(e,t),t)}function toolGroupItemRows(e,t,n){let r=e.slice(0,5),i=e.length-r.length,a=itemRows(r,t,n);return i>0&&a.push(elisionRow(i,n)),a}function detailLineRows(e,t,n){let r=n.colors,i=e.slice(0,10),a=e.length-i.length,o=i.some(e=>e.kind===`added`||e.kind===`removed`),s=Math.max(1,t-(o?5:4)),c=i.map(e=>{if(e.kind===`gap`)return railRow(r.dim(n.glyph.ellipsis),n);let t=clipVisible(e.text,s);switch(e.kind){case`added`:return` ${r.dim(n.glyph.rule)}${r.green(`+`)} ${r.green(t)}`;case`removed`:return` ${r.dim(n.glyph.rule)}${r.red(`-`)} ${r.red(t)}`;default:return o?` ${r.dim(n.glyph.rule)} ${r.gray(t)}`:railRow(r.gray(t),n)}});return a>0&&c.push(elisionRow(a,n)),c}function itemRows(e,t,n){let r=Math.max(1,t-4);if(!e.some(e=>e.result!==void 0&&e.result.length>0))return e.map(e=>railRow(n.colors.gray(truncate(e.text,r)),n));let i=Math.min(Math.max(...e.map(e=>visibleLength(e.text))),Math.max(8,r-9)),a=Math.max(8,r-i-1);return e.map(e=>{let t=truncate(e.text,i);if(e.result===void 0||e.result.length===0)return railRow(n.colors.gray(t),n);let r=t+` `.repeat(Math.max(0,i-visibleLength(t)));return railRow(`${n.colors.gray(r)} ${n.colors.red(truncate(e.result,a))}`,n)})}function renderToolExpanded(e,t,n){let r=[],push=(e,i,a)=>{if(i!==void 0){r.push(` ${n.colors.dim(e)}`);for(let e of formatValuePretty(i).split(`
2
+ `))for(let n of wrapVisibleLine(e,Math.max(1,t-4)))r.push(` ${a(n)}`)}};return push(`input`,e.toolInput,n.colors.gray),e.status===`error`&&e.result?push(`error`,e.result,n.colors.red):push(`output`,e.toolOutput,n.colors.gray),r}function resultLine(e,t,n,r,i){let a=n-4;return` ${r.colors.dim(e)} ${i(truncate(t,a))}`}function errorDetailLine(e,t,n){let r=t-5;return` ${n.colors.dim(n.glyph.corner)} ${n.colors.red(truncate(e,r))}`}function toolGlyph(e,t,n){switch(e){case`done`:return{icon:t.colors.gray(t.glyph.square),accent:t.colors.gray};case`error`:return{icon:t.colors.red(t.glyph.error),accent:t.colors.red};case`denied`:return{icon:t.colors.yellow(t.glyph.warning),accent:t.colors.yellow};case`approval`:return{icon:t.colors.yellow(t.glyph.question),accent:t.colors.yellow};default:return{icon:t.colors.yellow(n.activityPulse),accent:t.colors.gray}}}export{maxVisibleToolGroupItems,renderTool,renderToolHeader};