eve 0.83.2 → 0.84.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 (1562) hide show
  1. package/CHANGELOG.md +61 -0
  2. package/README.md +1 -5
  3. package/dist/src/_virtual/_rolldown/runtime.js +1 -1
  4. package/dist/src/acp/adapter.d.ts +8 -5
  5. package/dist/src/acp/adapter.js +1 -1
  6. package/dist/src/ai/decide.d.ts +3 -7
  7. package/dist/src/ai/decide.js +1 -1
  8. package/dist/src/ai/decision-adapter.d.ts +7 -0
  9. package/dist/src/ai/decision-adapter.js +1 -0
  10. package/dist/src/ai/decision-types.d.ts +86 -0
  11. package/dist/src/approval/definition.d.ts +5 -12
  12. package/dist/src/approval/evaluation.d.ts +48 -0
  13. package/dist/src/approval/evaluation.js +1 -0
  14. package/dist/src/approval/status.d.ts +14 -0
  15. package/dist/src/approval/status.js +1 -0
  16. package/dist/src/channel/adapter-context.d.ts +1 -3
  17. package/dist/src/channel/adapter-context.js +1 -1
  18. package/dist/src/channel/adapter.d.ts +34 -26
  19. package/dist/src/channel/adapter.js +1 -1
  20. package/dist/src/channel/audience.d.ts +0 -3
  21. package/dist/src/channel/audience.js +1 -1
  22. package/dist/src/channel/auth/definitions.d.ts +532 -0
  23. package/dist/src/channel/auth/definitions.js +1 -0
  24. package/dist/src/channel/auth/jwt-ecdsa.js +1 -1
  25. package/dist/src/channel/auth/jwt-hmac.js +1 -1
  26. package/dist/src/channel/auth/oidc.js +1 -1
  27. package/dist/src/channel/channel-address.d.ts +12 -10
  28. package/dist/src/channel/channel-address.js +1 -1
  29. package/dist/src/channel/channel-operations.d.ts +21 -22
  30. package/dist/src/channel/channel-operations.js +1 -1
  31. package/dist/src/channel/compiled-channel.d.ts +4 -4
  32. package/dist/src/channel/conversation-context.js +1 -1
  33. package/dist/src/channel/cors.d.ts +2 -2
  34. package/dist/src/channel/cors.js +1 -1
  35. package/dist/src/channel/cross-channel-receive.d.ts +3 -3
  36. package/dist/src/channel/delivery-idempotency.d.ts +6 -0
  37. package/dist/src/channel/delivery-idempotency.js +1 -1
  38. package/dist/src/channel/delivery-metadata.d.ts +2 -2
  39. package/dist/src/channel/delivery.d.ts +8 -0
  40. package/dist/src/channel/delivery.js +1 -0
  41. package/dist/src/channel/interaction-prompts.d.ts +54 -0
  42. package/dist/src/channel/interaction-prompts.js +1 -0
  43. package/dist/src/channel/invoke-tool.d.ts +11 -18
  44. package/dist/src/channel/pending-authorization.d.ts +3 -14
  45. package/dist/src/channel/pending-authorization.js +1 -1
  46. package/dist/src/channel/prompt-queue.d.ts +11 -19
  47. package/dist/src/channel/prompt-queue.js +1 -1
  48. package/dist/src/channel/resolve-text.d.ts +11 -18
  49. package/dist/src/channel/resolve-text.js +2 -2
  50. package/dist/src/channel/resolved-prompt.d.ts +7 -5
  51. package/dist/src/channel/resolved-prompt.js +1 -1
  52. package/dist/src/channel/routes.d.ts +4 -4
  53. package/dist/src/channel/schedule.d.ts +2 -2
  54. package/dist/src/channel/schedule.js +1 -1
  55. package/dist/src/channel/send-input.d.ts +3 -3
  56. package/dist/src/channel/send-input.js +1 -1
  57. package/dist/src/channel/session-callback.js +1 -1
  58. package/dist/src/channel/session-not-active-error.d.ts +8 -12
  59. package/dist/src/channel/session-not-active-error.js +1 -1
  60. package/dist/src/channel/session.d.ts +33 -59
  61. package/dist/src/channel/session.js +1 -1
  62. package/dist/src/channel/sign-in.d.ts +61 -0
  63. package/dist/src/channel/sign-in.js +3 -0
  64. package/dist/src/channel/surface.d.ts +44 -0
  65. package/dist/src/channel/surface.js +1 -0
  66. package/dist/src/channel/task-card.d.ts +24 -114
  67. package/dist/src/channel/task-card.js +1 -1
  68. package/dist/src/channel/types.d.ts +116 -110
  69. package/dist/src/channel/types.js +1 -1
  70. package/dist/src/chunks/use-eve-agent-BbbguIdB.js +5030 -0
  71. package/dist/src/chunks/use-eve-agent-DWjyzplb.js +5077 -0
  72. package/dist/src/cli/commands/logs-events.d.ts +2 -0
  73. package/dist/src/cli/commands/logs-events.js +2 -2
  74. package/dist/src/cli/dev/command.js +1 -1
  75. package/dist/src/cli/dev/remote-print.d.ts +8 -0
  76. package/dist/src/cli/dev/remote-print.js +1 -0
  77. package/dist/src/cli/dev/tui/conversation-view.d.ts +24 -19
  78. package/dist/src/cli/dev/tui/conversation-view.js +1 -1
  79. package/dist/src/cli/dev/tui/diagnostic-presentation.d.ts +0 -10
  80. package/dist/src/cli/dev/tui/diagnostic-presentation.js +2 -3
  81. package/dist/src/cli/dev/tui/errors.d.ts +9 -65
  82. package/dist/src/cli/dev/tui/errors.js +1 -1
  83. package/dist/src/cli/dev/tui/prompt-command-handler.js +1 -1
  84. package/dist/src/cli/dev/tui/runner.js +3 -3
  85. package/dist/src/cli/dev/tui/task-records.d.ts +3 -3
  86. package/dist/src/cli/dev/tui/task-records.js +1 -1
  87. package/dist/src/cli/dev/tui/terminal-renderer.js +10 -10
  88. package/dist/src/cli/dev/tui/terminal-tool-part.d.ts +2 -2
  89. package/dist/src/cli/dev/tui/terminal-tool-part.js +1 -1
  90. package/dist/src/cli/dev/tui/test/fake-eve-server.d.ts +3 -3
  91. package/dist/src/cli/dev/tui/test/fake-eve-server.js +1 -1
  92. package/dist/src/cli/dev/tui/tool-presentation.js +1 -1
  93. package/dist/src/cli/dev/tui/transcript-parts.d.ts +16 -16
  94. package/dist/src/cli/dev/tui/transcript-parts.js +3 -3
  95. package/dist/src/cli/dev/tui/transcript.d.ts +0 -4
  96. package/dist/src/cli/dev/tui/transcript.js +1 -1
  97. package/dist/src/cli/dev/tui/tui.js +1 -1
  98. package/dist/src/cli/run.d.ts +0 -2
  99. package/dist/src/cli/run.js +1 -1
  100. package/dist/src/cli/telemetry/index.js +1 -1
  101. package/dist/src/client/agent-base-url.d.ts +4 -0
  102. package/dist/src/client/agent-base-url.js +1 -0
  103. package/dist/src/client/agent-info-schema.d.ts +1 -923
  104. package/dist/src/client/agent-info-schema.js +1 -1
  105. package/dist/src/client/agent-info-types.d.ts +281 -0
  106. package/dist/src/client/agent-session.d.ts +19 -22
  107. package/dist/src/client/agent-session.js +1 -1
  108. package/dist/src/client/agent-stream-follower.d.ts +11 -20
  109. package/dist/src/client/agent-stream-follower.js +1 -1
  110. package/dist/src/client/client-error.d.ts +2 -1
  111. package/dist/src/client/client-error.js +1 -1
  112. package/dist/src/client/client.d.ts +1 -1
  113. package/dist/src/client/client.js +1 -1
  114. package/dist/src/client/conversation-client.d.ts +37 -28
  115. package/dist/src/client/conversation-client.js +1 -1
  116. package/dist/src/client/conversation-state.d.ts +70 -73
  117. package/dist/src/client/conversation-state.js +1 -1
  118. package/dist/src/client/conversation.d.ts +51 -0
  119. package/dist/src/client/conversation.js +1 -0
  120. package/dist/src/client/delivery-events.d.ts +3 -0
  121. package/dist/src/client/delivery-events.js +1 -0
  122. package/dist/src/client/delivery.d.ts +36 -0
  123. package/dist/src/client/delivery.js +1 -0
  124. package/dist/src/client/file-parts.d.ts +9 -4
  125. package/dist/src/client/file-parts.js +1 -1
  126. package/dist/src/client/health-schema.d.ts +1 -1
  127. package/dist/src/client/health-types.d.ts +6 -0
  128. package/dist/src/client/index.d.ts +17 -23
  129. package/dist/src/client/index.js +1 -1
  130. package/dist/src/client/message-types.d.ts +92 -0
  131. package/dist/src/client/message-types.js +1 -0
  132. package/dist/src/client/messages.d.ts +30 -0
  133. package/dist/src/client/messages.js +1 -0
  134. package/dist/src/client/ndjson.d.ts +6 -11
  135. package/dist/src/client/ndjson.js +3 -3
  136. package/dist/src/client/open-stream.d.ts +47 -20
  137. package/dist/src/client/open-stream.js +1 -1
  138. package/dist/src/client/optimistic-message-submissions.d.ts +10 -19
  139. package/dist/src/client/optimistic-message-submissions.js +1 -1
  140. package/dist/src/client/session-controls.d.ts +23 -26
  141. package/dist/src/client/session-controls.js +1 -1
  142. package/dist/src/client/session-event-stream.d.ts +5 -16
  143. package/dist/src/client/session-event-stream.js +1 -1
  144. package/dist/src/client/session-store-helpers.d.ts +8 -0
  145. package/dist/src/client/session-store-helpers.js +2 -0
  146. package/dist/src/client/session-store-state.d.ts +80 -0
  147. package/dist/src/client/session-store-state.js +1 -0
  148. package/dist/src/client/session-store.d.ts +48 -0
  149. package/dist/src/client/session-store.js +1 -0
  150. package/dist/src/client/session-utils.d.ts +45 -41
  151. package/dist/src/client/session-utils.js +2 -1
  152. package/dist/src/client/session.d.ts +32 -23
  153. package/dist/src/client/session.js +1 -1
  154. package/dist/src/client/sessions.d.ts +2 -2
  155. package/dist/src/client/stream-version.d.ts +3 -1
  156. package/dist/src/client/stream-version.js +1 -1
  157. package/dist/src/client/transcript.d.ts +43 -0
  158. package/dist/src/client/transcript.js +2 -0
  159. package/dist/src/client/types.d.ts +21 -82
  160. package/dist/src/client/url.d.ts +3 -3
  161. package/dist/src/compiled/.vendor-stamp.json +1 -1
  162. package/dist/src/compiled/@ai-sdk/anthropic/index.d.ts +34 -34
  163. package/dist/src/compiled/@ai-sdk/google/index.d.ts +15 -15
  164. package/dist/src/compiled/@ai-sdk/openai/index.d.ts +38 -38
  165. package/dist/src/compiled/@chat-adapter/slack/fetch-QqNM_Ef3.d.ts +4 -0
  166. package/dist/src/compiled/@chat-adapter/twilio/types-BaIqtt65.d.ts +100 -0
  167. package/dist/src/compiled/@linqapp/chat-sdk-adapter/adapter.d.ts +129 -0
  168. package/dist/src/compiled/@linqapp/chat-sdk-adapter/message-parser.d.ts +14 -0
  169. package/dist/src/compiled/@linqapp/chat-sdk-adapter/text-decorations.d.ts +28 -0
  170. package/dist/src/compiled/@workflow/core/runtime/step-executor.d.ts +1 -1
  171. package/dist/src/compiled/@workflow/core/serialization/types.d.ts +1 -1
  172. package/dist/src/compiled/@workflow/core/serialization.d.ts +2 -2
  173. package/dist/src/compiled/@workflow/core/telemetry/semantic-conventions.d.ts +2 -2
  174. package/dist/src/compiled/semver/index.d.ts +2 -0
  175. package/dist/src/compiler/development-extensions.js +1 -1
  176. package/dist/src/compiler/extension-compatibility.d.ts +19 -290
  177. package/dist/src/compiler/extension-compatibility.js +1 -1
  178. package/dist/src/compiler/manifest.d.ts +1 -9
  179. package/dist/src/compiler/manifest.js +1 -1
  180. package/dist/src/compiler/normalize-agent-config.js +1 -1
  181. package/dist/src/compiler/normalize-connection.js +1 -1
  182. package/dist/src/compiler/normalize-hook.js +1 -1
  183. package/dist/src/compiler/normalize-instructions.js +1 -1
  184. package/dist/src/compiler/normalize-manifest.js +1 -1
  185. package/dist/src/compiler/normalize-memory.js +1 -1
  186. package/dist/src/compiler/normalize-schedule.js +1 -1
  187. package/dist/src/compiler/normalize-skill.js +1 -1
  188. package/dist/src/compiler/normalize-subagent.d.ts +0 -5
  189. package/dist/src/compiler/normalize-subagent.js +1 -1
  190. package/dist/src/compiler/normalize-tool.js +1 -1
  191. package/dist/src/compiler/remote-agent-node.d.ts +1 -6
  192. package/dist/src/compiler/source-graph.d.ts +0 -1
  193. package/dist/src/compiler/source-graph.js +1 -1
  194. package/dist/src/computer-use/extension/lib/computer-use-sandbox.js +1 -1
  195. package/dist/src/computer-use/extension/lib/sandbox.d.ts +1 -1
  196. package/dist/src/computer-use/extension/lib/sandbox.js +1 -1
  197. package/dist/src/computer-use/extension/tools/computer_use.js +1 -1
  198. package/dist/src/connections/errors.d.ts +3 -3
  199. package/dist/src/context/accessors.d.ts +0 -13
  200. package/dist/src/context/accessors.js +1 -1
  201. package/dist/src/context/container.d.ts +8 -11
  202. package/dist/src/context/container.js +1 -1
  203. package/dist/src/context/key-names.d.ts +1 -0
  204. package/dist/src/context/key-names.js +1 -1
  205. package/dist/src/context/keys.d.ts +20 -104
  206. package/dist/src/context/keys.js +1 -1
  207. package/dist/src/context/memory-tools.d.ts +4 -2
  208. package/dist/src/context/memory-tools.js +1 -1
  209. package/dist/src/context/providers/connection.js +1 -1
  210. package/dist/src/context/providers/session.js +1 -1
  211. package/dist/src/context/schedule-collection-tools.d.ts +2 -2
  212. package/dist/src/context/schedule-collection-tools.js +1 -1
  213. package/dist/src/context/session-context.d.ts +4 -2
  214. package/dist/src/discover/extensions.d.ts +2 -3
  215. package/dist/src/discover/extensions.js +1 -1
  216. package/dist/src/discover/manifest.js +1 -1
  217. package/dist/src/discover/skills.js +1 -1
  218. package/dist/src/dynamic/definition.d.ts +98 -108
  219. package/dist/src/dynamic/definition.js +1 -1
  220. package/dist/src/evals/assertions/collector.js +1 -1
  221. package/dist/src/evals/assertions/run.d.ts +12 -11
  222. package/dist/src/evals/assertions/run.js +2 -2
  223. package/dist/src/evals/assertions/scoped.js +1 -1
  224. package/dist/src/evals/cli/eval-client.js +1 -1
  225. package/dist/src/evals/cli/eval.js +2 -2
  226. package/dist/src/evals/context.js +1 -1
  227. package/dist/src/evals/expect/index.d.ts +0 -1
  228. package/dist/src/evals/index.d.ts +2 -5
  229. package/dist/src/evals/judge.js +1 -1
  230. package/dist/src/evals/match.d.ts +20 -17
  231. package/dist/src/evals/match.js +1 -1
  232. package/dist/src/evals/mock-model.d.ts +5 -1
  233. package/dist/src/evals/mock-model.js +1 -1
  234. package/dist/src/evals/output.d.ts +3 -0
  235. package/dist/src/evals/output.js +1 -0
  236. package/dist/src/evals/reported-tool-name.js +1 -1
  237. package/dist/src/evals/reporters/index.d.ts +4 -4
  238. package/dist/src/evals/reporters/index.js +1 -1
  239. package/dist/src/evals/runner/artifacts.js +1 -1
  240. package/dist/src/evals/runner/derive-run-facts.d.ts +8 -40
  241. package/dist/src/evals/runner/derive-run-facts.js +1 -1
  242. package/dist/src/evals/runner/execute-eval.js +1 -1
  243. package/dist/src/evals/runner/execute-task.d.ts +3 -1
  244. package/dist/src/evals/runner/execute-task.js +1 -1
  245. package/dist/src/evals/runner/reporters/braintrust.d.ts +1 -1
  246. package/dist/src/evals/runner/reporters/braintrust.js +2 -2
  247. package/dist/src/evals/runner/reporters/console.d.ts +1 -1
  248. package/dist/src/evals/runner/reporters/console.js +1 -1
  249. package/dist/src/evals/runner/reporters/datadog.d.ts +1 -1
  250. package/dist/src/evals/runner/reporters/datadog.js +2 -2
  251. package/dist/src/evals/runner/reporters/junit.d.ts +1 -1
  252. package/dist/src/evals/runner/reporters/junit.js +2 -2
  253. package/dist/src/evals/runner/reporters/types.d.ts +2 -2
  254. package/dist/src/evals/runner/run-evals.d.ts +1 -1
  255. package/dist/src/evals/session-cleanup.d.ts +1 -1
  256. package/dist/src/evals/session-cleanup.js +1 -1
  257. package/dist/src/evals/session-content.d.ts +2 -2
  258. package/dist/src/evals/session-content.js +2 -1
  259. package/dist/src/evals/session-manager.d.ts +3 -6
  260. package/dist/src/evals/session-manager.js +1 -1
  261. package/dist/src/evals/session.d.ts +33 -24
  262. package/dist/src/evals/session.js +2 -2
  263. package/dist/src/evals/target.js +1 -1
  264. package/dist/src/evals/types.d.ts +115 -94
  265. package/dist/src/eve-channel/create-request.d.ts +3 -5
  266. package/dist/src/eve-channel/descendant-stream.d.ts +9 -0
  267. package/dist/src/eve-channel/descendant-stream.js +1 -0
  268. package/dist/src/eve-channel/index.d.ts +2 -2
  269. package/dist/src/eve-channel/index.js +1 -1
  270. package/dist/src/eve-channel/request.d.ts +7 -6
  271. package/dist/src/eve-channel/request.js +1 -3
  272. package/dist/src/eve-channel/stream-headers.d.ts +1 -1
  273. package/dist/src/eve-channel/stream-headers.js +1 -1
  274. package/dist/src/eve-channel/support.d.ts +25 -13
  275. package/dist/src/eve-channel/support.js +2 -2
  276. package/dist/src/eve-channel/types.d.ts +7 -30
  277. package/dist/src/execution/agent-sessions/message.d.ts +4 -0
  278. package/dist/src/execution/agent-sessions/message.js +1 -0
  279. package/dist/src/execution/agent-sessions/metadata.js +1 -1
  280. package/dist/src/execution/agent-sessions/remote-credentials.d.ts +19 -0
  281. package/dist/src/execution/agent-sessions/remote-credentials.js +1 -0
  282. package/dist/src/execution/agent-sessions/remote.d.ts +35 -13
  283. package/dist/src/execution/agent-sessions/remote.js +1 -1
  284. package/dist/src/execution/agent-sessions/requests.d.ts +6 -6
  285. package/dist/src/execution/agent-sessions/requests.js +1 -1
  286. package/dist/src/execution/agent-sessions/session.js +1 -1
  287. package/dist/src/execution/agent-sessions/steps.d.ts +26 -4
  288. package/dist/src/execution/agent-sessions/steps.js +1 -1
  289. package/dist/src/execution/agent-sessions/target.d.ts +2 -1
  290. package/dist/src/execution/agent-sessions/target.js +1 -1
  291. package/dist/src/execution/agent-sessions/usage.d.ts +0 -8
  292. package/dist/src/execution/agent-sessions/usage.js +1 -1
  293. package/dist/src/execution/cancelled-model-call-batch.d.ts +4 -2
  294. package/dist/src/execution/cancelled-model-call-batch.js +1 -1
  295. package/dist/src/execution/cancelled-turn-message.d.ts +2 -2
  296. package/dist/src/execution/cancelled-turn-message.js +1 -1
  297. package/dist/src/execution/catalog/connection-auth.js +1 -1
  298. package/dist/src/execution/catalog/connection-entry.js +1 -1
  299. package/dist/src/execution/catalog/rank.js +1 -1
  300. package/dist/src/execution/catalog/search.js +1 -1
  301. package/dist/src/execution/catalog/skills.js +1 -1
  302. package/dist/src/execution/catalog/step-catalog.js +1 -1
  303. package/dist/src/execution/child-binding.d.ts +19 -0
  304. package/dist/src/execution/child-binding.js +1 -0
  305. package/dist/src/execution/close-session-stream-step.d.ts +9 -0
  306. package/dist/src/execution/close-session-stream-step.js +1 -0
  307. package/dist/src/execution/coordination-dispatch-shared.d.ts +13 -3
  308. package/dist/src/execution/coordination-dispatch-shared.js +1 -1
  309. package/dist/src/execution/coordination-dispatch-step.d.ts +9 -13
  310. package/dist/src/execution/coordination-dispatch-step.js +1 -1
  311. package/dist/src/execution/deliver-payloads.js +1 -1
  312. package/dist/src/execution/durable-session-store.d.ts +2 -5
  313. package/dist/src/execution/dynamic-workflow/tool.js +1 -1
  314. package/dist/src/execution/dynamic-workflow/workflow.js +1 -1
  315. package/dist/src/execution/failure-summary.d.ts +11 -0
  316. package/dist/src/execution/failure-summary.js +1 -0
  317. package/dist/src/execution/forward-session-input.d.ts +2 -2
  318. package/dist/src/execution/forward-session-input.js +1 -1
  319. package/dist/src/execution/invoke-tool.js +1 -1
  320. package/dist/src/execution/legacy-session/prepare-step.js +1 -1
  321. package/dist/src/execution/legacy-session/snapshot.d.ts +4 -1
  322. package/dist/src/execution/legacy-session/snapshot.js +1 -1
  323. package/dist/src/execution/model-call-batching.d.ts +3 -3
  324. package/dist/src/execution/model-call-batching.js +1 -1
  325. package/dist/src/execution/ndjson-stream.d.ts +1 -1
  326. package/dist/src/execution/node-step.d.ts +2 -8
  327. package/dist/src/execution/node-step.js +1 -1
  328. package/dist/src/execution/proxied-deliver-step.d.ts +8 -3
  329. package/dist/src/execution/proxied-deliver-step.js +1 -1
  330. package/dist/src/execution/public-destination.d.ts +34 -0
  331. package/dist/src/execution/public-destination.js +1 -0
  332. package/dist/src/execution/publish-session-events.d.ts +98 -36
  333. package/dist/src/execution/publish-session-events.js +1 -1
  334. package/dist/src/execution/runtime-context.js +1 -1
  335. package/dist/src/execution/sandbox/abort-bound-session.js +1 -1
  336. package/dist/src/execution/sandbox/bash.js +1 -1
  337. package/dist/src/execution/sandbox/bindings/docker-connection.js +1 -1
  338. package/dist/src/execution/sandbox/bindings/docker.js +1 -1
  339. package/dist/src/execution/sandbox/bindings/eve-image.d.ts +0 -2
  340. package/dist/src/execution/sandbox/bindings/eve-image.js +1 -1
  341. package/dist/src/execution/sandbox/bindings/just-bash-runtime.js +1 -1
  342. package/dist/src/execution/sandbox/bindings/vercel.js +1 -1
  343. package/dist/src/execution/sandbox/ensure.js +1 -1
  344. package/dist/src/{extensions/code/extension/lib → execution/sandbox}/grep-search.d.ts +3 -2
  345. package/dist/src/execution/sandbox/grep-search.js +6 -0
  346. package/dist/src/execution/sandbox/read-file.d.ts +1 -1
  347. package/dist/src/execution/sandbox/session.js +1 -1
  348. package/dist/src/execution/sandbox/workspace-root.d.ts +31 -0
  349. package/dist/src/execution/sandbox/workspace-root.js +1 -0
  350. package/dist/src/execution/session/active-turn.d.ts +12 -6
  351. package/dist/src/execution/session/active-turn.js +1 -1
  352. package/dist/src/execution/session/admission.d.ts +7 -2
  353. package/dist/src/execution/session/admission.js +1 -1
  354. package/dist/src/execution/session/answer-caller.d.ts +4 -4
  355. package/dist/src/execution/session/answer-caller.js +1 -1
  356. package/dist/src/execution/session/checkpoint-migrations.d.ts +4 -6
  357. package/dist/src/execution/session/checkpoint-migrations.js +1 -1
  358. package/dist/src/execution/session/control-delivery.d.ts +4 -0
  359. package/dist/src/execution/session/control-delivery.js +1 -0
  360. package/dist/src/execution/session/delivery-facts.d.ts +27 -0
  361. package/dist/src/execution/session/delivery-facts.js +1 -0
  362. package/dist/src/execution/session/end-sandbox-step.js +1 -1
  363. package/dist/src/execution/session/entry.js +1 -1
  364. package/dist/src/execution/session/finalization.d.ts +4 -0
  365. package/dist/src/execution/session/finalization.js +1 -1
  366. package/dist/src/execution/session/handoff-state.js +1 -1
  367. package/dist/src/execution/session/handoff-steps.d.ts +1 -8
  368. package/dist/src/execution/session/handoff-steps.js +1 -1
  369. package/dist/src/execution/session/handoff.d.ts +5 -3
  370. package/dist/src/execution/session/handoff.js +1 -1
  371. package/dist/src/execution/session/input-queue.d.ts +8 -2
  372. package/dist/src/execution/session/input-queue.js +1 -1
  373. package/dist/src/execution/session/interrupted-step.d.ts +64 -0
  374. package/dist/src/execution/session/interrupted-step.js +3 -0
  375. package/dist/src/execution/session/next-input.d.ts +7 -1
  376. package/dist/src/execution/session/next-input.js +1 -1
  377. package/dist/src/execution/session/pending-turn-state.d.ts +32 -12
  378. package/dist/src/execution/session/pending-turn-state.js +1 -1
  379. package/dist/src/execution/session/prewarm-step.d.ts +1 -1
  380. package/dist/src/execution/session/prewarm-step.js +1 -1
  381. package/dist/src/execution/session/program.js +1 -1
  382. package/dist/src/execution/session/settle-control-delivery-step.d.ts +8 -0
  383. package/dist/src/execution/session/settle-control-delivery-step.js +1 -0
  384. package/dist/src/execution/session/settle-duplicate-delivery-step.d.ts +8 -0
  385. package/dist/src/execution/session/settle-duplicate-delivery-step.js +1 -0
  386. package/dist/src/execution/session/state-delta.d.ts +2 -12
  387. package/dist/src/execution/session/state-delta.js +1 -1
  388. package/dist/src/execution/session/step-decision-check.d.ts +9 -0
  389. package/dist/src/execution/session/step-decision-check.js +1 -0
  390. package/dist/src/execution/session/step-state-delta.d.ts +16 -0
  391. package/dist/src/execution/session/step-state-delta.js +1 -0
  392. package/dist/src/execution/session/task-tool-tracing-step.d.ts +0 -3
  393. package/dist/src/execution/session/task-tool-tracing-step.js +1 -1
  394. package/dist/src/execution/session/turn-event-handler.d.ts +6 -16
  395. package/dist/src/execution/session/turn-event-handler.js +1 -1
  396. package/dist/src/execution/session/turn-step-result.d.ts +7 -2
  397. package/dist/src/execution/session/turn-step-result.js +1 -1
  398. package/dist/src/execution/session/turn-step-types.d.ts +35 -33
  399. package/dist/src/execution/session/turn-step.js +1 -1
  400. package/dist/src/execution/session/turn.d.ts +19 -32
  401. package/dist/src/execution/session/turn.js +1 -1
  402. package/dist/src/execution/session-callback-request.d.ts +7 -1
  403. package/dist/src/execution/session-callback-request.js +1 -1
  404. package/dist/src/execution/session-event-stream.d.ts +37 -16
  405. package/dist/src/execution/session-event-stream.js +1 -1
  406. package/dist/src/execution/session-inbox/end-stranded-session.d.ts +7 -1
  407. package/dist/src/execution/session-inbox/end-stranded-session.js +1 -1
  408. package/dist/src/execution/session-inbox/inbox.js +1 -1
  409. package/dist/src/execution/session-inbox/owner.d.ts +5 -2
  410. package/dist/src/execution/session-inbox/owner.js +1 -1
  411. package/dist/src/execution/session-inbox/pre-v27.d.ts +5 -0
  412. package/dist/src/execution/session-inbox/pre-v27.js +1 -0
  413. package/dist/src/execution/session-inbox/protocol.js +1 -1
  414. package/dist/src/execution/session-inbox/resume.js +1 -1
  415. package/dist/src/execution/session-inbox/stranded-replay-guard.js +1 -1
  416. package/dist/src/execution/session-workflow-tool-run.js +1 -1
  417. package/dist/src/execution/session.d.ts +3 -14
  418. package/dist/src/execution/session.js +2 -2
  419. package/dist/src/execution/settle-cancelled-turn-step.d.ts +3 -0
  420. package/dist/src/execution/settle-cancelled-turn-step.js +1 -1
  421. package/dist/src/execution/stop-runs.d.ts +35 -0
  422. package/dist/src/execution/stop-runs.js +1 -0
  423. package/dist/src/execution/tasks/model-step.d.ts +5 -9
  424. package/dist/src/execution/tasks/model-step.js +1 -1
  425. package/dist/src/execution/tasks/render.d.ts +5 -2
  426. package/dist/src/execution/tasks/render.js +1 -1
  427. package/dist/src/execution/tasks/session.d.ts +6 -3
  428. package/dist/src/execution/tasks/session.js +1 -1
  429. package/dist/src/execution/tasks/start.d.ts +9 -6
  430. package/dist/src/execution/tasks/start.js +1 -1
  431. package/dist/src/execution/tasks/steps.d.ts +11 -6
  432. package/dist/src/execution/tasks/steps.js +1 -1
  433. package/dist/src/execution/tasks/table.d.ts +18 -5
  434. package/dist/src/execution/tasks/table.js +1 -1
  435. package/dist/src/execution/tasks/task-id-input.js +1 -1
  436. package/dist/src/execution/terminal-session-completion-step.d.ts +11 -1
  437. package/dist/src/execution/terminal-session-completion-step.js +1 -1
  438. package/dist/src/execution/terminal-session-failure-step.d.ts +6 -1
  439. package/dist/src/execution/terminal-session-failure-step.js +1 -1
  440. package/dist/src/execution/terminate-child-sessions-step.d.ts +5 -1
  441. package/dist/src/execution/terminate-child-sessions-step.js +1 -1
  442. package/dist/src/execution/tools/agent-router-workflow.js +1 -1
  443. package/dist/src/execution/tools/workflow/answer.d.ts +4 -5
  444. package/dist/src/execution/tools/workflow/answer.js +1 -1
  445. package/dist/src/execution/tools/workflow/apply-run-messages-step.d.ts +1 -1
  446. package/dist/src/execution/tools/workflow/apply-run-messages-step.js +1 -1
  447. package/dist/src/execution/tools/workflow/ask.d.ts +3 -3
  448. package/dist/src/execution/tools/workflow/body.js +1 -1
  449. package/dist/src/execution/tools/workflow/harness-definition.js +1 -1
  450. package/dist/src/execution/tools/workflow/messages.d.ts +25 -33
  451. package/dist/src/execution/tools/workflow/messages.js +1 -1
  452. package/dist/src/execution/tools/workflow/owner-inbox.d.ts +9 -5
  453. package/dist/src/execution/tools/workflow/owner-inbox.js +1 -1
  454. package/dist/src/execution/tools/workflow/owner.d.ts +3 -3
  455. package/dist/src/execution/tools/workflow/owner.js +1 -1
  456. package/dist/src/execution/tools/workflow/serve.js +1 -1
  457. package/dist/src/execution/tools/workflow/step.js +1 -1
  458. package/dist/src/execution/tools/workflow/withdraw-step.d.ts +2 -2
  459. package/dist/src/execution/tools/workflow/withdraw-step.js +1 -1
  460. package/dist/src/execution/v26-history.d.ts +28 -0
  461. package/dist/src/execution/v26-history.fixtures.d.ts +4 -0
  462. package/dist/src/execution/v26-history.fixtures.js +2 -0
  463. package/dist/src/execution/v26-history.js +1 -0
  464. package/dist/src/execution/web-fetch/html.js +3 -4
  465. package/dist/src/execution/web-fetch/request.js +1 -1
  466. package/dist/src/execution/workflow-errors.d.ts +5 -0
  467. package/dist/src/execution/workflow-errors.js +1 -1
  468. package/dist/src/execution/workflow-runtime.js +1 -1
  469. package/dist/src/extensions/code/extension/extension.d.ts +1 -11
  470. package/dist/src/extensions/code/extension/extension.js +1 -1
  471. package/dist/src/extensions/code/extension/lib/prwatch-github.d.ts +5 -1
  472. package/dist/src/extensions/code/extension/lib/prwatch-github.js +1 -1
  473. package/dist/src/extensions/code/extension/lib/repository-root.js +1 -1
  474. package/dist/src/extensions/code/extension/lib/sandbox.d.ts +0 -4
  475. package/dist/src/extensions/code/extension/lib/sandbox.js +2 -2
  476. package/dist/src/extensions/code/extension/lib/tooling.d.ts +1 -1
  477. package/dist/src/extensions/code/extension/lib/tooling.js +1 -1
  478. package/dist/src/extensions/code/extension/lib/workspace-root.d.ts +1 -31
  479. package/dist/src/extensions/code/extension/lib/workspace-root.js +1 -1
  480. package/dist/src/extensions/code/extension/subagents/worker/agent.d.ts +1 -1
  481. package/dist/src/extensions/code/extension/subagents/worker/agent.js +1 -1
  482. package/dist/src/extensions/code/extension/tools/apply_patch.js +2 -2
  483. package/dist/src/extensions/code/extension/tools/grep.d.ts +1 -28
  484. package/dist/src/extensions/code/extension/tools/grep.js +1 -1
  485. package/dist/src/extensions/code/sandbox.d.ts +1 -0
  486. package/dist/src/extensions/code/sandbox.js +1 -0
  487. package/dist/src/extensions/code/tools.d.ts +1 -5
  488. package/dist/src/extensions/code/tools.js +1 -1
  489. package/dist/src/extensions/git/extension/extension.d.ts +3 -3
  490. package/dist/src/extensions/git/extension/instructions/github.d.ts +1 -1
  491. package/dist/src/extensions/git/extension/instructions/github.js +1 -1
  492. package/dist/src/extensions/git/extension/lib/gh-tool.d.ts +2 -11
  493. package/dist/src/extensions/git/extension/lib/gh-tool.js +1 -1
  494. package/dist/src/extensions/git/extension/lib/github-shell.d.ts +13 -3
  495. package/dist/src/extensions/git/extension/lib/sandbox.d.ts +0 -4
  496. package/dist/src/extensions/git/extension/lib/sandbox.js +1 -1
  497. package/dist/src/extensions/git/extension/skills/pr.d.ts +1 -4
  498. package/dist/src/extensions/git/extension/skills/pr.js +1 -1
  499. package/dist/src/extensions/git/extension/tools/gh.d.ts +1 -26
  500. package/dist/src/extensions/git/extension/tools/gh.js +1 -1
  501. package/dist/src/framework/sources/modules/schedule-collection-wrapper.js +1 -1
  502. package/dist/src/harness/action-presentation.d.ts +3 -5
  503. package/dist/src/harness/action-presentation.js +1 -1
  504. package/dist/src/harness/action-result-helpers.d.ts +2 -8
  505. package/dist/src/harness/action-result-helpers.js +1 -1
  506. package/dist/src/harness/approval-outcome.d.ts +32 -0
  507. package/dist/src/harness/approval-outcome.js +1 -0
  508. package/dist/src/harness/attachment-staging.js +1 -1
  509. package/dist/src/harness/authorization.d.ts +2 -3
  510. package/dist/src/harness/authorization.js +1 -1
  511. package/dist/src/harness/call-executor.d.ts +118 -0
  512. package/dist/src/harness/call-executor.js +1 -0
  513. package/dist/src/harness/call-facts.d.ts +31 -0
  514. package/dist/src/harness/call-facts.js +1 -0
  515. package/dist/src/harness/call-outcome.d.ts +6 -0
  516. package/dist/src/harness/call-outcome.js +1 -0
  517. package/dist/src/harness/compaction/engine.d.ts +11 -0
  518. package/dist/src/harness/compaction/engine.js +2 -2
  519. package/dist/src/harness/compaction/over-limit-error.d.ts +7 -0
  520. package/dist/src/harness/compaction/over-limit-error.js +1 -0
  521. package/dist/src/harness/compaction/prompt.js +1 -1
  522. package/dist/src/harness/compaction/step.d.ts +34 -5
  523. package/dist/src/harness/compaction/step.js +1 -1
  524. package/dist/src/harness/coordination.js +1 -1
  525. package/dist/src/harness/current-messages.d.ts +10 -0
  526. package/dist/src/harness/current-messages.js +1 -1
  527. package/dist/src/harness/emission.d.ts +9 -15
  528. package/dist/src/harness/emission.js +1 -1
  529. package/dist/src/harness/execute-call.d.ts +6 -23
  530. package/dist/src/harness/execute-call.js +1 -1
  531. package/dist/src/harness/execute-tool.d.ts +7 -3
  532. package/dist/src/harness/facts.d.ts +82 -0
  533. package/dist/src/harness/facts.js +1 -0
  534. package/dist/src/harness/finish-reason.d.ts +6 -1
  535. package/dist/src/harness/generation-steering.d.ts +4 -2
  536. package/dist/src/harness/generation-steering.js +1 -1
  537. package/dist/src/harness/hitl/approval-prompt.d.ts +3 -3
  538. package/dist/src/harness/hitl/approval-prompt.js +3 -3
  539. package/dist/src/harness/hitl/approvals.d.ts +66 -78
  540. package/dist/src/harness/hitl/approvals.js +2 -1
  541. package/dist/src/harness/hitl/approved-calls.d.ts +14 -36
  542. package/dist/src/harness/hitl/approved-calls.js +1 -1
  543. package/dist/src/harness/hitl/budget-request.d.ts +8 -46
  544. package/dist/src/harness/hitl/budget-request.js +1 -1
  545. package/dist/src/harness/hitl/budget.d.ts +9 -8
  546. package/dist/src/harness/hitl/budget.js +1 -1
  547. package/dist/src/harness/hitl/delivery.d.ts +16 -17
  548. package/dist/src/harness/hitl/delivery.js +1 -1
  549. package/dist/src/harness/hitl/index.d.ts +14 -19
  550. package/dist/src/harness/hitl/index.js +1 -1
  551. package/dist/src/harness/hitl/intake.d.ts +32 -43
  552. package/dist/src/harness/hitl/intake.js +1 -1
  553. package/dist/src/harness/hitl/relays.d.ts +7 -51
  554. package/dist/src/harness/hitl/relays.js +1 -1
  555. package/dist/src/harness/hitl/requests.d.ts +11 -53
  556. package/dist/src/harness/hitl/requests.js +1 -1
  557. package/dist/src/harness/hitl/responders.d.ts +50 -0
  558. package/dist/src/harness/hitl/responders.js +1 -0
  559. package/dist/src/harness/hitl/sign-ins.d.ts +7 -3
  560. package/dist/src/harness/hitl/sign-ins.js +1 -1
  561. package/dist/src/harness/hitl/stale-responses.d.ts +11 -11
  562. package/dist/src/harness/hitl/stale-responses.js +3 -3
  563. package/dist/src/harness/inline-tool-authorization.d.ts +8 -9
  564. package/dist/src/harness/inline-tool-authorization.js +1 -1
  565. package/dist/src/harness/interaction-facts.d.ts +36 -0
  566. package/dist/src/harness/interaction-facts.js +1 -0
  567. package/dist/src/harness/interaction-relay.d.ts +10 -0
  568. package/dist/src/harness/interaction-relay.js +1 -0
  569. package/dist/src/harness/interrupted-attempt.d.ts +19 -0
  570. package/dist/src/harness/interrupted-attempt.js +2 -0
  571. package/dist/src/harness/messages.d.ts +28 -15
  572. package/dist/src/harness/messages.js +1 -1
  573. package/dist/src/harness/model-call/call.d.ts +31 -13
  574. package/dist/src/harness/model-call/call.js +1 -1
  575. package/dist/src/harness/model-call/errors.js +1 -1
  576. package/dist/src/harness/model-call/failure.d.ts +10 -48
  577. package/dist/src/harness/model-call/failure.js +1 -1
  578. package/dist/src/harness/model-call/model.js +1 -1
  579. package/dist/src/harness/model-call/recovery.d.ts +4 -32
  580. package/dist/src/harness/model-call/recovery.js +1 -1
  581. package/dist/src/harness/model-call/request.d.ts +0 -1
  582. package/dist/src/harness/model-call/request.js +1 -1
  583. package/dist/src/harness/model-call/response.d.ts +22 -12
  584. package/dist/src/harness/model-call/response.js +1 -1
  585. package/dist/src/harness/model-call/retry.d.ts +23 -6
  586. package/dist/src/harness/model-call/retry.js +1 -1
  587. package/dist/src/harness/model-call/run.d.ts +4 -12
  588. package/dist/src/harness/model-call/run.js +1 -1
  589. package/dist/src/harness/model-call/tools.d.ts +0 -19
  590. package/dist/src/harness/model-call/tools.js +1 -1
  591. package/dist/src/harness/model-call/unique-call-ids.d.ts +13 -0
  592. package/dist/src/harness/model-call/unique-call-ids.js +1 -0
  593. package/dist/src/harness/model-call/usage.d.ts +7 -5
  594. package/dist/src/harness/model-call/usage.js +1 -1
  595. package/dist/src/harness/ordered-stream-emitter.d.ts +1 -0
  596. package/dist/src/harness/ordered-stream-emitter.js +1 -1
  597. package/dist/src/harness/provider-tool-history.js +1 -1
  598. package/dist/src/harness/publication.d.ts +4 -0
  599. package/dist/src/harness/publication.js +1 -0
  600. package/dist/src/harness/request-envelope.d.ts +0 -3
  601. package/dist/src/harness/request-envelope.js +1 -1
  602. package/dist/src/harness/running-work.d.ts +10 -0
  603. package/dist/src/harness/running-work.js +1 -0
  604. package/dist/src/harness/session-machine/cascade.d.ts +17 -0
  605. package/dist/src/harness/session-machine/cascade.js +1 -0
  606. package/dist/src/harness/session-machine/commit.d.ts +16 -16
  607. package/dist/src/harness/session-machine/commit.js +1 -1
  608. package/dist/src/harness/session-machine/current.d.ts +25 -9
  609. package/dist/src/harness/session-machine/current.js +1 -1
  610. package/dist/src/harness/session-machine/state.d.ts +43 -16
  611. package/dist/src/harness/session-machine/state.js +1 -1
  612. package/dist/src/harness/session-machine/suspended-steps.d.ts +22 -0
  613. package/dist/src/harness/session-machine/suspended-steps.js +1 -0
  614. package/dist/src/harness/session-machine/transitions.d.ts +144 -120
  615. package/dist/src/harness/session-machine/transitions.js +1 -1
  616. package/dist/src/harness/session-machine/view.d.ts +12 -8
  617. package/dist/src/harness/session-machine/view.js +1 -1
  618. package/dist/src/harness/session-machine/waiting.d.ts +16 -0
  619. package/dist/src/harness/session-machine/waiting.js +1 -0
  620. package/dist/src/harness/session-usage.d.ts +22 -0
  621. package/dist/src/harness/session-usage.js +1 -0
  622. package/dist/src/harness/step/after-model.d.ts +1 -4
  623. package/dist/src/harness/step/after-model.js +1 -1
  624. package/dist/src/harness/step/context.d.ts +21 -21
  625. package/dist/src/harness/step/context.js +1 -1
  626. package/dist/src/harness/step/intake.d.ts +7 -8
  627. package/dist/src/harness/step/intake.js +1 -1
  628. package/dist/src/harness/step/park.d.ts +19 -0
  629. package/dist/src/harness/step/park.js +1 -0
  630. package/dist/src/harness/step/prompt.d.ts +4 -5
  631. package/dist/src/harness/step/prompt.js +1 -1
  632. package/dist/src/harness/step-hooks.d.ts +24 -24
  633. package/dist/src/harness/step-hooks.js +1 -1
  634. package/dist/src/harness/stream-actions.d.ts +3 -9
  635. package/dist/src/harness/stream-actions.js +1 -1
  636. package/dist/src/harness/token-estimate.js +1 -1
  637. package/dist/src/harness/tool-history-repair.js +1 -1
  638. package/dist/src/harness/tool-loop.js +1 -1
  639. package/dist/src/harness/tools.d.ts +22 -38
  640. package/dist/src/harness/tools.js +1 -1
  641. package/dist/src/harness/types.d.ts +69 -67
  642. package/dist/src/harness/user-parts.d.ts +4 -0
  643. package/dist/src/harness/user-parts.js +1 -0
  644. package/dist/src/harness/workflow-tool-runs.d.ts +0 -1
  645. package/dist/src/harness/workflow-tool-runs.js +1 -1
  646. package/dist/src/instrumentation/ai-sdk-hook-bridge.d.ts +2 -2
  647. package/dist/src/instrumentation/ai-sdk-hook-bridge.js +1 -1
  648. package/dist/src/instrumentation/channel-delivery.d.ts +4 -23
  649. package/dist/src/instrumentation/channel-delivery.js +1 -1
  650. package/dist/src/instrumentation/content.d.ts +1 -7
  651. package/dist/src/instrumentation/content.js +1 -1
  652. package/dist/src/instrumentation/dispatch.js +1 -1
  653. package/dist/src/instrumentation/lifecycle.d.ts +135 -198
  654. package/dist/src/instrumentation/lifecycle.js +1 -1
  655. package/dist/src/instrumentation/memory.d.ts +4 -2
  656. package/dist/src/instrumentation/memory.js +1 -1
  657. package/dist/src/instrumentation/native-events.d.ts +17 -10
  658. package/dist/src/instrumentation/native-events.js +1 -1
  659. package/dist/src/instrumentation/prepare-trace-context.d.ts +3 -3
  660. package/dist/src/instrumentation/provider.d.ts +20 -28
  661. package/dist/src/instrumentation/providers.js +1 -1
  662. package/dist/src/instrumentation/runtime-context.d.ts +1 -0
  663. package/dist/src/instrumentation/runtime-context.js +1 -1
  664. package/dist/src/instrumentation/runtime.d.ts +9 -30
  665. package/dist/src/instrumentation/runtime.js +1 -1
  666. package/dist/src/instrumentation/scope.d.ts +6 -0
  667. package/dist/src/instrumentation/scope.js +1 -0
  668. package/dist/src/instrumentation/session-context.d.ts +1 -1
  669. package/dist/src/instrumentation/session-context.js +1 -1
  670. package/dist/src/instrumentation/session-init.js +1 -1
  671. package/dist/src/instrumentation/setup-context.d.ts +2 -2
  672. package/dist/src/instrumentation/setup-context.js +1 -1
  673. package/dist/src/instrumentation/state.d.ts +0 -21
  674. package/dist/src/instrumentation/state.js +1 -1
  675. package/dist/src/internal/application/dev-environment.d.ts +8 -2
  676. package/dist/src/internal/application/dev-environment.js +1 -1
  677. package/dist/src/internal/application/optional-package-install.js +1 -1
  678. package/dist/src/internal/application/stamped-package-version.js +1 -1
  679. package/dist/src/internal/authored-asset-import-plugin.d.ts +8 -7
  680. package/dist/src/internal/authored-asset-import-plugin.js +1 -1
  681. package/dist/src/internal/authored-definition/approval.d.ts +2 -4
  682. package/dist/src/internal/authored-definition/approval.js +1 -1
  683. package/dist/src/internal/authored-definition/connection.js +1 -1
  684. package/dist/src/internal/authored-definition/core.d.ts +1 -1
  685. package/dist/src/internal/authored-definition/core.js +1 -1
  686. package/dist/src/internal/authored-definition/memory.js +1 -1
  687. package/dist/src/internal/authored-definition/schema-backed.d.ts +0 -3
  688. package/dist/src/internal/authored-definition/schema-backed.js +1 -1
  689. package/dist/src/internal/authored-module-loader.d.ts +0 -1
  690. package/dist/src/internal/authored-module-loader.js +1 -1
  691. package/dist/src/internal/authored-package-boundary.js +1 -1
  692. package/dist/src/internal/git.d.ts +2 -0
  693. package/dist/src/internal/git.js +1 -0
  694. package/dist/src/internal/grep.d.ts +1 -0
  695. package/dist/src/internal/grep.js +1 -0
  696. package/dist/src/internal/helpers/markdown.js +1 -1
  697. package/dist/src/internal/invocation/agent-invocation.d.ts +16 -19
  698. package/dist/src/internal/invocation/metadata.d.ts +0 -2
  699. package/dist/src/internal/invocation/metadata.js +1 -1
  700. package/dist/src/internal/invocation/workflow-execution.d.ts +4 -4
  701. package/dist/src/internal/invocation/workflow-execution.js +1 -1
  702. package/dist/src/internal/legacy-events.d.ts +5 -0
  703. package/dist/src/internal/legacy-events.js +1 -0
  704. package/dist/src/internal/logging.d.ts +0 -12
  705. package/dist/src/internal/logging.js +1 -1
  706. package/dist/src/internal/mcp/protected-resource.js +1 -1
  707. package/dist/src/internal/mcp/published-tools.js +1 -1
  708. package/dist/src/internal/model-auth/api-key.js +1 -1
  709. package/dist/src/internal/model-auth/development-broker-client.js +1 -1
  710. package/dist/src/internal/model-auth/development-broker-server.js +1 -1
  711. package/dist/src/internal/model-auth/transport.js +1 -1
  712. package/dist/src/internal/nitro/dev-client-address.d.ts +12 -0
  713. package/dist/src/internal/nitro/dev-client-address.js +1 -1
  714. package/dist/src/internal/nitro/dev-runtime-artifacts.js +1 -1
  715. package/dist/src/internal/nitro/dev-runtime-generation-metadata.js +1 -1
  716. package/dist/src/internal/nitro/host/build-extension.js +2 -2
  717. package/dist/src/internal/nitro/host/create-application-nitro.js +1 -1
  718. package/dist/src/internal/nitro/host/dev-host-fingerprint.js +1 -1
  719. package/dist/src/internal/nitro/host/dev-server-state.js +1 -1
  720. package/dist/src/internal/nitro/host/drained-nitro-dev-server.js +1 -1
  721. package/dist/src/internal/nitro/host/start-development-server.js +1 -1
  722. package/dist/src/internal/nitro/routes/agent-info/build-agent-info-response.js +1 -1
  723. package/dist/src/internal/nitro/routes/channel-dispatch.js +1 -1
  724. package/dist/src/internal/nitro/routes/channel-request-instrumentation.d.ts +6 -3
  725. package/dist/src/internal/nitro/routes/channel-request-instrumentation.js +1 -1
  726. package/dist/src/internal/nitro/routes/channel-route-context.d.ts +8 -1
  727. package/dist/src/internal/nitro/routes/info.js +1 -1
  728. package/dist/src/internal/nitro/routes/schedule-task.js +1 -1
  729. package/dist/src/internal/scaffold.d.ts +5 -0
  730. package/dist/src/internal/scaffold.js +1 -0
  731. package/dist/src/internal/workflow/cancel-expired-development-run.js +1 -1
  732. package/dist/src/internal/workflow/development-world-client.js +1 -1
  733. package/dist/src/internal/workflow/development-world-server.js +1 -1
  734. package/dist/src/internal/workflow/local-world-data-directory.js +1 -1
  735. package/dist/src/internal/workspace.d.ts +1 -0
  736. package/dist/src/internal/workspace.js +1 -0
  737. package/dist/src/models/auto.d.ts +27 -14
  738. package/dist/src/models/auto.js +2 -2
  739. package/dist/src/protocol/delivery.d.ts +11 -0
  740. package/dist/src/protocol/delivery.js +1 -0
  741. package/dist/src/protocol/descendant-observation.d.ts +12 -0
  742. package/dist/src/protocol/descendant-observation.js +1 -0
  743. package/dist/src/protocol/interaction-json.d.ts +66 -0
  744. package/dist/src/protocol/interaction-json.js +1 -0
  745. package/dist/src/protocol/interaction-options.d.ts +4 -0
  746. package/dist/src/protocol/interaction-options.js +1 -0
  747. package/dist/src/protocol/remote-agent-protocol.d.ts +28 -1
  748. package/dist/src/protocol/remote-agent-protocol.js +1 -1
  749. package/dist/src/protocol/routes.d.ts +3 -2
  750. package/dist/src/protocol/routes.js +1 -1
  751. package/dist/src/protocol/session-event.d.ts +22 -0
  752. package/dist/src/protocol/session-event.js +1 -0
  753. package/dist/src/protocol/session-events/authoring.d.ts +2 -0
  754. package/dist/src/protocol/session-events/authoring.js +1 -0
  755. package/dist/src/protocol/session-events/catalog.d.ts +50 -0
  756. package/dist/src/protocol/session-events/catalog.js +1 -0
  757. package/dist/src/protocol/session-events/checker.d.ts +23 -0
  758. package/dist/src/protocol/session-events/checker.js +1 -0
  759. package/dist/src/protocol/session-events/common.d.ts +105 -0
  760. package/dist/src/protocol/session-events/common.js +1 -0
  761. package/dist/src/protocol/session-events/envelope.d.ts +174 -0
  762. package/dist/src/protocol/session-events/envelope.js +1 -0
  763. package/dist/src/protocol/session-events/facts.d.ts +24 -0
  764. package/dist/src/protocol/session-events/facts.js +1 -0
  765. package/dist/src/protocol/session-events/families/call.d.ts +142 -0
  766. package/dist/src/protocol/session-events/families/call.js +1 -0
  767. package/dist/src/protocol/session-events/families/child.d.ts +51 -0
  768. package/dist/src/protocol/session-events/families/child.js +1 -0
  769. package/dist/src/protocol/session-events/families/content.d.ts +56 -0
  770. package/dist/src/protocol/session-events/families/content.js +1 -0
  771. package/dist/src/protocol/session-events/families/context.d.ts +55 -0
  772. package/dist/src/protocol/session-events/families/context.js +1 -0
  773. package/dist/src/protocol/session-events/families/delivery.d.ts +86 -0
  774. package/dist/src/protocol/session-events/families/delivery.js +1 -0
  775. package/dist/src/protocol/session-events/families/interaction.d.ts +163 -0
  776. package/dist/src/protocol/session-events/families/interaction.js +1 -0
  777. package/dist/src/protocol/session-events/families/model.d.ts +88 -0
  778. package/dist/src/protocol/session-events/families/model.js +1 -0
  779. package/dist/src/protocol/session-events/families/response.d.ts +66 -0
  780. package/dist/src/protocol/session-events/families/response.js +1 -0
  781. package/dist/src/protocol/session-events/families/session.d.ts +73 -0
  782. package/dist/src/protocol/session-events/families/session.js +1 -0
  783. package/dist/src/protocol/session-events/families/task.d.ts +46 -0
  784. package/dist/src/protocol/session-events/families/task.js +1 -0
  785. package/dist/src/protocol/session-events/families/turn.d.ts +68 -0
  786. package/dist/src/protocol/session-events/families/turn.js +1 -0
  787. package/dist/src/protocol/session-events/families/usage.d.ts +30 -0
  788. package/dist/src/protocol/session-events/families/usage.js +1 -0
  789. package/dist/src/protocol/session-events/guards.d.ts +11 -0
  790. package/dist/src/protocol/session-events/guards.js +1 -0
  791. package/dist/src/protocol/session-events/index.d.ts +16 -0
  792. package/dist/src/protocol/session-events/index.js +1 -0
  793. package/dist/src/protocol/session-events/json.d.ts +20 -0
  794. package/dist/src/protocol/session-events/json.js +1 -0
  795. package/dist/src/protocol/session-events/schemas.d.ts +320 -0
  796. package/dist/src/protocol/session-events/schemas.js +1 -0
  797. package/dist/src/protocol/session-http.d.ts +7 -0
  798. package/dist/src/protocol/session-http.js +1 -0
  799. package/dist/src/protocol/session-lines.d.ts +19 -0
  800. package/dist/src/protocol/session-lines.js +1 -0
  801. package/dist/src/protocol/session-projection/fold.d.ts +75 -0
  802. package/dist/src/protocol/session-projection/fold.js +1 -0
  803. package/dist/src/protocol/session-projection/index.d.ts +4 -0
  804. package/dist/src/protocol/session-projection/index.js +1 -0
  805. package/dist/src/protocol/session-projection/observations.d.ts +150 -0
  806. package/dist/src/protocol/session-projection/observations.js +1 -0
  807. package/dist/src/protocol/session-projection/public-view.d.ts +74 -0
  808. package/dist/src/protocol/session-projection/public-view.js +1 -0
  809. package/dist/src/protocol/session-projection/reader.d.ts +62 -0
  810. package/dist/src/protocol/session-projection/reader.js +1 -0
  811. package/dist/src/protocol/session-projection/request-status.d.ts +7 -0
  812. package/dist/src/protocol/session-projection/request-status.js +1 -0
  813. package/dist/src/protocol/session-projection/selectors.d.ts +169 -0
  814. package/dist/src/protocol/session-projection/selectors.js +2 -0
  815. package/dist/src/protocol/session-projection/session-view.d.ts +18 -0
  816. package/dist/src/protocol/session-projection/session-view.js +1 -0
  817. package/dist/src/protocol/session-projection/tables.d.ts +237 -0
  818. package/dist/src/protocol/session-projection/tables.js +1 -0
  819. package/dist/src/protocol/session-projection/tree.d.ts +72 -0
  820. package/dist/src/protocol/session-projection/tree.js +1 -0
  821. package/dist/src/protocol/session-projection.d.ts +38 -157
  822. package/dist/src/protocol/session-projection.js +1 -1
  823. package/dist/src/protocol/task-tools.d.ts +8 -6
  824. package/dist/src/protocol/task-tools.js +1 -1
  825. package/dist/src/protocol/v26-interactions.d.ts +11 -0
  826. package/dist/src/protocol/v26-interactions.js +1 -0
  827. package/dist/src/protocol/v26-lines.d.ts +5 -0
  828. package/dist/src/protocol/v26-lines.js +1 -0
  829. package/dist/src/public/agents/auth.d.ts +2 -2
  830. package/dist/src/public/agents/auth.js +1 -1
  831. package/dist/src/public/ai/index.d.ts +1 -0
  832. package/dist/src/public/channels/auth.d.ts +2 -518
  833. package/dist/src/public/channels/auth.js +1 -1
  834. package/dist/src/public/channels/chat-sdk/authorization.d.ts +5 -2
  835. package/dist/src/public/channels/chat-sdk/authorization.js +1 -3
  836. package/dist/src/public/channels/chat-sdk/chatSdkChannel.d.ts +16 -11
  837. package/dist/src/public/channels/chat-sdk/chatSdkChannel.js +1 -3
  838. package/dist/src/public/channels/chat-sdk/index.d.ts +1 -1
  839. package/dist/src/public/channels/chat-sdk/index.js +1 -1
  840. package/dist/src/public/channels/chat-sdk/input-actions.d.ts +4 -4
  841. package/dist/src/public/channels/chat-sdk/input-actions.js +3 -3
  842. package/dist/src/public/channels/chat-sdk/{messageToUserContent.d.ts → message-content.d.ts} +3 -3
  843. package/dist/src/public/channels/chat-sdk/message-content.js +1 -0
  844. package/dist/src/public/channels/discord/api.d.ts +8 -11
  845. package/dist/src/public/channels/discord/api.js +1 -1
  846. package/dist/src/public/channels/discord/attachments.d.ts +2 -2
  847. package/dist/src/public/channels/discord/authorization.d.ts +3 -13
  848. package/dist/src/public/channels/discord/authorization.js +2 -2
  849. package/dist/src/public/channels/discord/credentials.d.ts +11 -0
  850. package/dist/src/public/channels/discord/credentials.js +1 -0
  851. package/dist/src/public/channels/discord/defaults.d.ts +7 -1
  852. package/dist/src/public/channels/discord/defaults.js +1 -3
  853. package/dist/src/public/channels/discord/discordChannel.d.ts +36 -48
  854. package/dist/src/public/channels/discord/discordChannel.js +1 -1
  855. package/dist/src/public/channels/discord/hitl.d.ts +5 -4
  856. package/dist/src/public/channels/discord/hitl.js +1 -1
  857. package/dist/src/public/channels/discord/index.d.ts +4 -12
  858. package/dist/src/public/channels/discord/index.js +1 -1
  859. package/dist/src/public/channels/discord/messages.js +1 -1
  860. package/dist/src/public/channels/github/defaults.js +2 -4
  861. package/dist/src/public/channels/github/githubChannel.d.ts +23 -36
  862. package/dist/src/public/channels/github/githubChannel.js +1 -1
  863. package/dist/src/public/channels/github/index.d.ts +3 -2
  864. package/dist/src/public/channels/github/index.js +1 -1
  865. package/dist/src/public/channels/github/state.d.ts +2 -0
  866. package/dist/src/public/channels/imessage-tapbacks.d.ts +1 -1
  867. package/dist/src/public/channels/index.d.ts +16 -37
  868. package/dist/src/public/channels/index.js +1 -1
  869. package/dist/src/public/channels/linear/defaults.js +2 -4
  870. package/dist/src/public/channels/linear/hitl.d.ts +3 -3
  871. package/dist/src/public/channels/linear/hitl.js +2 -2
  872. package/dist/src/public/channels/linear/inbound-uploads.d.ts +3 -3
  873. package/dist/src/public/channels/linear/inbound-uploads.js +1 -1
  874. package/dist/src/public/channels/linear/inbound.d.ts +5 -3
  875. package/dist/src/public/channels/linear/inbound.js +1 -1
  876. package/dist/src/public/channels/linear/index.d.ts +4 -6
  877. package/dist/src/public/channels/linear/index.js +1 -1
  878. package/dist/src/public/channels/linear/linearChannel.d.ts +19 -30
  879. package/dist/src/public/channels/linear/linearChannel.js +1 -1
  880. package/dist/src/public/channels/linq/inboundContent.d.ts +2 -2
  881. package/dist/src/public/channels/linq/inboundContent.js +1 -1
  882. package/dist/src/public/channels/linq/index.d.ts +1 -1
  883. package/dist/src/public/channels/linq/linqChannel.d.ts +1 -2
  884. package/dist/src/public/channels/mcp.d.ts +2 -2
  885. package/dist/src/public/channels/mcp.js +1 -1
  886. package/dist/src/public/channels/photon/inboundContent.d.ts +2 -2
  887. package/dist/src/public/channels/photon/inboundContent.js +1 -1
  888. package/dist/src/public/channels/photon/index.d.ts +1 -1
  889. package/dist/src/public/channels/photon/photonIMessageChannel.d.ts +1 -2
  890. package/dist/src/public/channels/reply.d.ts +22 -0
  891. package/dist/src/public/channels/reply.js +3 -0
  892. package/dist/src/public/channels/slack/action-status.js +1 -1
  893. package/dist/src/public/channels/slack/{input-response.d.ts → answers.d.ts} +5 -5
  894. package/dist/src/public/channels/slack/answers.js +1 -0
  895. package/dist/src/public/channels/slack/api.d.ts +5 -2
  896. package/dist/src/public/channels/slack/api.js +1 -1
  897. package/dist/src/public/channels/slack/approval-cards.d.ts +15 -5
  898. package/dist/src/public/channels/slack/approval-cards.js +2 -2
  899. package/dist/src/public/channels/slack/attachments.d.ts +6 -6
  900. package/dist/src/public/channels/slack/attachments.js +1 -1
  901. package/dist/src/public/channels/slack/blocks.d.ts +1 -1
  902. package/dist/src/public/channels/slack/blocks.js +1 -1
  903. package/dist/src/public/channels/slack/cards.d.ts +576 -0
  904. package/dist/src/public/channels/slack/cards.js +1 -0
  905. package/dist/src/public/channels/slack/connections.d.ts +4 -22
  906. package/dist/src/public/channels/slack/connections.js +1 -1
  907. package/dist/src/public/channels/slack/defaults.d.ts +13 -2
  908. package/dist/src/public/channels/slack/defaults.js +5 -5
  909. package/dist/src/public/channels/slack/hitl.d.ts +20 -19
  910. package/dist/src/public/channels/slack/hitl.js +3 -3
  911. package/dist/src/public/channels/slack/index.d.ts +7 -16
  912. package/dist/src/public/channels/slack/index.js +1 -1
  913. package/dist/src/public/channels/slack/interaction-cards.js +1 -1
  914. package/dist/src/public/channels/slack/interactions.d.ts +2 -2
  915. package/dist/src/public/channels/slack/interactions.js +1 -1
  916. package/dist/src/public/channels/slack/limits.js +1 -1
  917. package/dist/src/public/channels/slack/private-approval-delivery.d.ts +3 -3
  918. package/dist/src/public/channels/slack/private-approval-delivery.js +1 -1
  919. package/dist/src/public/channels/slack/renderers.d.ts +21 -27
  920. package/dist/src/public/channels/slack/renderers.js +1 -1
  921. package/dist/src/public/channels/slack/reply-delivery.d.ts +5 -11
  922. package/dist/src/public/channels/slack/reply-delivery.js +1 -1
  923. package/dist/src/public/channels/slack/session-operations.d.ts +4 -4
  924. package/dist/src/public/channels/slack/sign-in-cancel.js +1 -1
  925. package/dist/src/public/channels/slack/slackChannel.d.ts +32 -43
  926. package/dist/src/public/channels/slack/slackChannel.js +1 -1
  927. package/dist/src/public/channels/slack/task-card.d.ts +9 -9
  928. package/dist/src/public/channels/slack/task-card.js +1 -1
  929. package/dist/src/public/channels/teams/api.d.ts +3 -7
  930. package/dist/src/public/channels/teams/attachments.d.ts +4 -4
  931. package/dist/src/public/channels/teams/authorization.d.ts +5 -9
  932. package/dist/src/public/channels/teams/authorization.js +1 -1
  933. package/dist/src/public/channels/teams/credentials.d.ts +13 -0
  934. package/dist/src/public/channels/teams/credentials.js +1 -0
  935. package/dist/src/public/channels/teams/defaults.d.ts +2 -6
  936. package/dist/src/public/channels/teams/defaults.js +1 -3
  937. package/dist/src/public/channels/teams/hitl.d.ts +8 -7
  938. package/dist/src/public/channels/teams/hitl.js +1 -1
  939. package/dist/src/public/channels/teams/index.d.ts +6 -8
  940. package/dist/src/public/channels/teams/index.js +1 -1
  941. package/dist/src/public/channels/teams/teamsChannel.d.ts +25 -44
  942. package/dist/src/public/channels/teams/teamsChannel.js +1 -1
  943. package/dist/src/public/channels/telegram/api.d.ts +3 -4
  944. package/dist/src/public/channels/telegram/attachments.d.ts +5 -5
  945. package/dist/src/public/channels/telegram/authorization-callback.js +1 -1
  946. package/dist/src/public/channels/telegram/authorization.d.ts +4 -8
  947. package/dist/src/public/channels/telegram/authorization.js +2 -2
  948. package/dist/src/public/channels/telegram/credentials.d.ts +9 -0
  949. package/dist/src/public/channels/telegram/credentials.js +1 -0
  950. package/dist/src/public/channels/telegram/defaults.js +1 -3
  951. package/dist/src/public/channels/telegram/hitl.d.ts +22 -20
  952. package/dist/src/public/channels/telegram/hitl.js +2 -2
  953. package/dist/src/public/channels/telegram/index.d.ts +5 -7
  954. package/dist/src/public/channels/telegram/index.js +1 -1
  955. package/dist/src/public/channels/telegram/telegramChannel.d.ts +23 -36
  956. package/dist/src/public/channels/telegram/telegramChannel.js +1 -1
  957. package/dist/src/public/channels/text.d.ts +4 -0
  958. package/dist/src/public/channels/text.js +1 -0
  959. package/dist/src/public/channels/twilio/api.d.ts +8 -8
  960. package/dist/src/public/channels/twilio/api.js +1 -1
  961. package/dist/src/public/channels/twilio/credentials.d.ts +7 -0
  962. package/dist/src/public/channels/twilio/credentials.js +1 -0
  963. package/dist/src/public/channels/twilio/defaults.d.ts +0 -1
  964. package/dist/src/public/channels/twilio/defaults.js +1 -5
  965. package/dist/src/public/channels/twilio/inbound.d.ts +2 -2
  966. package/dist/src/public/channels/twilio/index.d.ts +4 -4
  967. package/dist/src/public/channels/twilio/index.js +1 -1
  968. package/dist/src/public/channels/twilio/twilioChannel.d.ts +24 -37
  969. package/dist/src/public/channels/twilio/twilioChannel.js +1 -1
  970. package/dist/src/public/channels/twilio/verify.d.ts +6 -4
  971. package/dist/src/public/channels/undelivered-reply.d.ts +30 -0
  972. package/dist/src/public/channels/undelivered-reply.js +1 -0
  973. package/dist/src/public/channels/upload-policy.d.ts +7 -7
  974. package/dist/src/public/connections/index.d.ts +3 -5
  975. package/dist/src/public/context/index.d.ts +3 -2
  976. package/dist/src/public/definitions/agent.d.ts +18 -18
  977. package/dist/src/public/definitions/agent.js +1 -1
  978. package/dist/src/public/definitions/approval.d.ts +1 -1
  979. package/dist/src/public/definitions/channel.d.ts +57 -60
  980. package/dist/src/public/definitions/channel.js +1 -1
  981. package/dist/src/public/definitions/connections/dynamic.d.ts +3 -15
  982. package/dist/src/public/definitions/connections/dynamic.js +1 -1
  983. package/dist/src/public/definitions/connections/events.d.ts +9 -9
  984. package/dist/src/public/definitions/connections/mcp.d.ts +5 -3
  985. package/dist/src/public/definitions/connections/openapi.d.ts +1 -1
  986. package/dist/src/public/definitions/extension.d.ts +2 -4
  987. package/dist/src/public/definitions/extension.js +1 -1
  988. package/dist/src/public/definitions/hook.d.ts +63 -85
  989. package/dist/src/public/definitions/hook.js +1 -1
  990. package/dist/src/public/definitions/instructions.d.ts +3 -10
  991. package/dist/src/public/definitions/instructions.js +1 -1
  992. package/dist/src/public/definitions/model.d.ts +21 -0
  993. package/dist/src/public/definitions/model.js +1 -0
  994. package/dist/src/public/definitions/removed-event-keys.d.ts +2 -0
  995. package/dist/src/public/definitions/removed-event-keys.js +1 -0
  996. package/dist/src/public/definitions/sandbox.d.ts +1 -1
  997. package/dist/src/public/definitions/schedule.d.ts +4 -4
  998. package/dist/src/public/definitions/skill.d.ts +5 -0
  999. package/dist/src/public/definitions/skill.js +1 -1
  1000. package/dist/src/public/events/index.d.ts +27 -0
  1001. package/dist/src/public/events/index.js +1 -0
  1002. package/dist/src/public/experimental/connections/index.d.ts +1 -0
  1003. package/dist/src/public/experimental/connections/index.js +1 -0
  1004. package/dist/src/public/experimental/schedules/client.js +1 -1
  1005. package/dist/src/public/hooks/index.d.ts +4 -3
  1006. package/dist/src/public/index.d.ts +3 -2
  1007. package/dist/src/public/instructions/index.d.ts +2 -2
  1008. package/dist/src/public/instrumentation/index.d.ts +9 -28
  1009. package/dist/src/public/instrumentation/index.js +1 -1
  1010. package/dist/src/public/instrumentation/otel.d.ts +1 -1
  1011. package/dist/src/public/instrumentation/otel.js +1 -1
  1012. package/dist/src/public/instrumentation/provider.d.ts +1 -1
  1013. package/dist/src/public/instrumentation/provider.js +1 -1
  1014. package/dist/src/public/local-dev.d.ts +3 -1
  1015. package/dist/src/public/memory/file/backend.d.ts +1 -1
  1016. package/dist/src/public/memory/file/backends/in-memory.js +1 -1
  1017. package/dist/src/public/memory/file/backends/vercel-blob.js +1 -1
  1018. package/dist/src/public/memory/file/provider.js +1 -1
  1019. package/dist/src/public/memory/index.d.ts +14 -20
  1020. package/dist/src/public/models/index.d.ts +3 -0
  1021. package/dist/src/public/models/index.js +1 -1
  1022. package/dist/src/public/models/openai/index.d.ts +0 -2
  1023. package/dist/src/public/models/openai/index.js +1 -1
  1024. package/dist/src/public/next/index.d.ts +5 -36
  1025. package/dist/src/public/next/index.js +1 -1
  1026. package/dist/src/public/nuxt/index.d.ts +1 -1
  1027. package/dist/src/public/nuxt/module.d.ts +5 -2
  1028. package/dist/src/public/sandbox/index.d.ts +1 -1
  1029. package/dist/src/public/sandbox/vercel-sandbox.d.ts +52 -12
  1030. package/dist/src/public/sandbox/vercel.d.ts +1 -1
  1031. package/dist/src/public/schedules/subscription.d.ts +5 -8
  1032. package/dist/src/public/server/index.d.ts +2 -14
  1033. package/dist/src/public/server/index.js +1 -1
  1034. package/dist/src/public/sessions/index.d.ts +6 -0
  1035. package/dist/src/public/sessions/index.js +1 -0
  1036. package/dist/src/public/skills/index.d.ts +2 -2
  1037. package/dist/src/public/skills/index.js +1 -1
  1038. package/dist/src/public/sveltekit/routing.d.ts +0 -4
  1039. package/dist/src/public/sveltekit/routing.js +1 -1
  1040. package/dist/src/public/tools/approval/index.d.ts +1 -1
  1041. package/dist/src/public/tools/bash.d.ts +1 -1
  1042. package/dist/src/public/tools/bash.js +1 -1
  1043. package/dist/src/public/tools/glob.d.ts +1 -1
  1044. package/dist/src/public/tools/glob.js +1 -1
  1045. package/dist/src/public/tools/grep.d.ts +1 -1
  1046. package/dist/src/public/tools/grep.js +1 -1
  1047. package/dist/src/public/tools/index.d.ts +5 -9
  1048. package/dist/src/public/tools/index.js +1 -1
  1049. package/dist/src/public/tools/read-file.d.ts +1 -1
  1050. package/dist/src/public/tools/read-file.js +1 -1
  1051. package/dist/src/public/tools/result.d.ts +17 -9
  1052. package/dist/src/public/tools/result.js +1 -1
  1053. package/dist/src/public/tools/web-fetch.d.ts +1 -1
  1054. package/dist/src/public/tools/web-fetch.js +1 -1
  1055. package/dist/src/public/tools/web-search.d.ts +1 -3
  1056. package/dist/src/public/tools/web-search.js +1 -1
  1057. package/dist/src/public/tools/write-file.d.ts +1 -1
  1058. package/dist/src/public/tools/write-file.js +1 -1
  1059. package/dist/src/public/workflow-modules.d.ts +8 -2
  1060. package/dist/src/react/index.d.ts +4 -7
  1061. package/dist/src/react/index.js +1 -1
  1062. package/dist/src/react/use-eve-agent.d.ts +68 -50
  1063. package/dist/src/react/use-eve-agent.js +1 -1
  1064. package/dist/src/reactions/bundle.d.ts +4 -0
  1065. package/dist/src/reactions/bundle.js +1 -0
  1066. package/dist/src/reactions/frame.d.ts +13 -0
  1067. package/dist/src/reactions/frame.js +1 -0
  1068. package/dist/src/reactions/intents.d.ts +22 -0
  1069. package/dist/src/reactions/intents.js +1 -0
  1070. package/dist/src/reactions/kinds/connection.d.ts +18 -0
  1071. package/dist/src/reactions/kinds/connection.js +1 -0
  1072. package/dist/src/reactions/kinds/hook.d.ts +8 -0
  1073. package/dist/src/reactions/kinds/hook.js +1 -0
  1074. package/dist/src/reactions/kinds/instructions.d.ts +21 -0
  1075. package/dist/src/reactions/kinds/instructions.js +1 -0
  1076. package/dist/src/reactions/kinds/memory.d.ts +72 -0
  1077. package/dist/src/reactions/kinds/memory.js +1 -0
  1078. package/dist/src/reactions/kinds/model.d.ts +21 -0
  1079. package/dist/src/reactions/kinds/model.js +1 -0
  1080. package/dist/src/reactions/kinds/skill.d.ts +27 -0
  1081. package/dist/src/reactions/kinds/skill.js +1 -0
  1082. package/dist/src/reactions/kinds/subagent.d.ts +16 -0
  1083. package/dist/src/reactions/kinds/subagent.js +1 -0
  1084. package/dist/src/reactions/kinds/tool.d.ts +16 -0
  1085. package/dist/src/reactions/kinds/tool.js +1 -0
  1086. package/dist/src/reactions/policy.d.ts +13 -0
  1087. package/dist/src/reactions/policy.js +1 -0
  1088. package/dist/src/reactions/reaction.d.ts +83 -0
  1089. package/dist/src/reactions/reaction.js +1 -0
  1090. package/dist/src/reactions/records.d.ts +40 -0
  1091. package/dist/src/reactions/records.js +1 -0
  1092. package/dist/src/reactions/remote.d.ts +25 -0
  1093. package/dist/src/reactions/remote.js +1 -0
  1094. package/dist/src/reactions/runner.d.ts +45 -0
  1095. package/dist/src/reactions/runner.js +1 -0
  1096. package/dist/src/reactions/state.d.ts +102 -0
  1097. package/dist/src/reactions/state.js +1 -0
  1098. package/dist/src/reactions/turn.d.ts +12 -0
  1099. package/dist/src/reactions/turn.js +2 -0
  1100. package/dist/src/runtime/agent/bootstrap.d.ts +1 -3
  1101. package/dist/src/runtime/agent/mock-model-adapter.js +1 -1
  1102. package/dist/src/runtime/agent/resolve-model.js +1 -1
  1103. package/dist/src/runtime/connections/mcp-client.d.ts +5 -2
  1104. package/dist/src/runtime/connections/mcp-client.js +1 -1
  1105. package/dist/src/runtime/connections/openapi-client.js +1 -1
  1106. package/dist/src/runtime/connections/openapi-operations.d.ts +4 -0
  1107. package/dist/src/runtime/connections/openapi-operations.js +1 -1
  1108. package/dist/src/runtime/connections/openapi-schema.d.ts +19 -14
  1109. package/dist/src/runtime/connections/openapi-schema.js +1 -1
  1110. package/dist/src/runtime/connections/principal.d.ts +2 -0
  1111. package/dist/src/runtime/connections/principal.js +1 -1
  1112. package/dist/src/runtime/connections/registry.d.ts +2 -2
  1113. package/dist/src/runtime/connections/registry.js +1 -1
  1114. package/dist/src/runtime/connections/scoped-authorization.d.ts +8 -1
  1115. package/dist/src/runtime/connections/scoped-authorization.js +1 -1
  1116. package/dist/src/runtime/graph.d.ts +0 -6
  1117. package/dist/src/runtime/local-dev-capability.d.ts +4 -5
  1118. package/dist/src/runtime/local-dev-capability.js +1 -1
  1119. package/dist/src/runtime/resolve-agent-graph.js +1 -1
  1120. package/dist/src/runtime/resolve-agent.js +1 -1
  1121. package/dist/src/runtime/resolve-connection.js +1 -1
  1122. package/dist/src/runtime/resolve-dynamic.d.ts +9 -0
  1123. package/dist/src/runtime/resolve-dynamic.js +1 -0
  1124. package/dist/src/runtime/resolve-hook.js +1 -1
  1125. package/dist/src/runtime/resolve-memory.js +1 -1
  1126. package/dist/src/runtime/resolve-tool.js +1 -1
  1127. package/dist/src/runtime/schedules/collection-client.js +1 -1
  1128. package/dist/src/runtime/schedules/dispatch-occurrence.js +1 -1
  1129. package/dist/src/runtime/sessions/compiled-agent-cache.d.ts +0 -2
  1130. package/dist/src/runtime/sessions/compiled-agent-cache.js +1 -1
  1131. package/dist/src/runtime/subagents/dynamic-agent-config.js +1 -1
  1132. package/dist/src/runtime/subagents/dynamic-remote-agent-config.d.ts +16 -3
  1133. package/dist/src/runtime/subagents/dynamic-remote-agent-config.js +1 -1
  1134. package/dist/src/runtime/subagents/workflow.js +1 -1
  1135. package/dist/src/runtime/types.d.ts +22 -39
  1136. package/dist/src/sandbox/provider.d.ts +3 -3
  1137. package/dist/src/sandbox/providers/default.d.ts +4 -2
  1138. package/dist/src/sandbox/providers/default.js +1 -1
  1139. package/dist/src/self-modification/agent.d.ts +3 -3
  1140. package/dist/src/self-modification/agent.js +1 -1
  1141. package/dist/src/self-modification/config.d.ts +1 -1
  1142. package/dist/src/self-modification/config.js +1 -1
  1143. package/dist/src/self-modification/deployed-sandbox.js +1 -1
  1144. package/dist/src/self-modification/extension/extension.d.ts +1 -0
  1145. package/dist/src/self-modification/extension/local-only.d.ts +1 -1
  1146. package/dist/src/self-modification/extension/local-only.js +1 -1
  1147. package/dist/src/self-modification/extension/subagents/agent/agent.d.ts +15 -4
  1148. package/dist/src/self-modification/extension/subagents/agent/agent.js +1 -1
  1149. package/dist/src/self-modification/extension/subagents/agent/instructions.d.ts +1 -1
  1150. package/dist/src/self-modification/extension/subagents/agent/instructions.js +2 -2
  1151. package/dist/src/self-modification/extension/subagents/agent/sandbox.d.ts +2 -2
  1152. package/dist/src/self-modification/extension/subagents/agent/sandbox.js +1 -1
  1153. package/dist/src/self-modification/extension/subagents/agent/skills/trace_analysis.d.ts +3 -3
  1154. package/dist/src/self-modification/extension/subagents/agent/skills/trace_analysis.js +1 -1
  1155. package/dist/src/self-modification/extension/subagents/agent/tools/inspect_trace.d.ts +1 -1
  1156. package/dist/src/self-modification/extension/subagents/agent/tools/inspect_trace_spans.d.ts +1 -1
  1157. package/dist/src/self-modification/extension/subagents/agent/tools/registry_add.d.ts +1 -1
  1158. package/dist/src/self-modification/extension/subagents/agent/tools/search_traces.d.ts +1 -1
  1159. package/dist/src/self-modification/mode.d.ts +8 -0
  1160. package/dist/src/self-modification/mode.js +1 -1
  1161. package/dist/src/self-modification/remote/config.d.ts +3 -6
  1162. package/dist/src/self-modification/remote/extension.d.ts +1 -0
  1163. package/dist/src/self-modification/remote/production-registry-add.js +1 -1
  1164. package/dist/src/self-modification/remote/subagents/agent/agent.d.ts +6 -3
  1165. package/dist/src/self-modification/remote/subagents/agent/agent.js +1 -1
  1166. package/dist/src/self-modification/remote/subagents/agent/instructions.d.ts +1 -1
  1167. package/dist/src/self-modification/remote/subagents/agent/instructions.js +2 -2
  1168. package/dist/src/self-modification/remote/subagents/agent/tools/publish.d.ts +1 -3
  1169. package/dist/src/self-modification/remote/subagents/agent/tools/publish.js +1 -1
  1170. package/dist/src/self-modification/remote/subagents/agent/tools/registry_add.d.ts +1 -3
  1171. package/dist/src/self-modification/remote/subagents/agent/tools/registry_add.js +1 -1
  1172. package/dist/src/self-modification/scaffold.js +1 -1
  1173. package/dist/src/self-modification/setup.js +3 -6
  1174. package/dist/src/services/dev-client/client-options.js +1 -1
  1175. package/dist/src/services/dev-client.d.ts +4 -4
  1176. package/dist/src/services/dev-client.js +1 -1
  1177. package/dist/src/setup/integrations/self-modification/setup.d.ts +1 -4
  1178. package/dist/src/setup/integrations/self-modification/setup.js +1 -1
  1179. package/dist/src/setup/scaffold/create/project.js +1 -1
  1180. package/dist/src/setup/scaffold/create/web-template.d.ts +9 -18
  1181. package/dist/src/setup/scaffold/create/web-template.js +1015 -2537
  1182. package/dist/src/setup/verified-remote-agent.js +1 -1
  1183. package/dist/src/shared/action-label.d.ts +5 -3
  1184. package/dist/src/shared/action-label.js +1 -1
  1185. package/dist/src/shared/action-types.d.ts +5 -0
  1186. package/dist/src/shared/action-types.js +1 -1
  1187. package/dist/src/shared/agent-definition.d.ts +14 -9
  1188. package/dist/src/shared/answers-delivery-id.d.ts +1 -0
  1189. package/dist/src/shared/answers-delivery-id.js +1 -0
  1190. package/dist/src/shared/channel-context.d.ts +12 -0
  1191. package/dist/src/shared/channel-context.js +1 -0
  1192. package/dist/src/shared/channel-definition.d.ts +19 -26
  1193. package/dist/src/shared/channel-delivery.d.ts +16 -0
  1194. package/dist/src/shared/channel-delivery.js +1 -0
  1195. package/dist/src/shared/connection-events.d.ts +2 -2
  1196. package/dist/src/shared/connection-types.d.ts +12 -32
  1197. package/dist/src/shared/conversation-context.d.ts +4 -13
  1198. package/dist/src/shared/delivery.d.ts +38 -0
  1199. package/dist/src/shared/delivery.js +1 -0
  1200. package/dist/src/shared/history-message.d.ts +190 -0
  1201. package/dist/src/shared/history-message.js +1 -0
  1202. package/dist/src/shared/input.d.ts +23 -97
  1203. package/dist/src/shared/input.js +1 -1
  1204. package/dist/src/shared/instructions-definition.d.ts +2 -8
  1205. package/dist/src/shared/instrumentation-channel-kind.d.ts +1 -1
  1206. package/dist/src/shared/instrumentation-channel.d.ts +12 -0
  1207. package/dist/src/shared/instrumentation-channel.js +1 -0
  1208. package/dist/src/shared/json.d.ts +2 -18
  1209. package/dist/src/shared/memory-state.d.ts +4 -40
  1210. package/dist/src/shared/memory-state.js +1 -1
  1211. package/dist/src/shared/message-content.d.ts +19 -0
  1212. package/dist/src/shared/message-content.js +1 -0
  1213. package/dist/src/shared/network-address.d.ts +9 -0
  1214. package/dist/src/shared/network-address.js +1 -1
  1215. package/dist/src/shared/sandbox-environment.d.ts +2 -2
  1216. package/dist/src/shared/sandbox-provider.d.ts +1 -1
  1217. package/dist/src/shared/sandbox-session.d.ts +60 -85
  1218. package/dist/src/shared/schedule-definition.d.ts +5 -5
  1219. package/dist/src/shared/serialized-observability-state.d.ts +0 -2
  1220. package/dist/src/shared/serialized-observability-state.js +1 -1
  1221. package/dist/src/shared/session-history.d.ts +2 -2
  1222. package/dist/src/shared/session.d.ts +22 -0
  1223. package/dist/src/shared/session.js +1 -0
  1224. package/dist/src/shared/skill-definition.d.ts +1 -1
  1225. package/dist/src/shared/skill-package.d.ts +2 -2
  1226. package/dist/src/shared/skill-package.js +1 -1
  1227. package/dist/src/shared/token-usage-math.d.ts +5 -0
  1228. package/dist/src/shared/token-usage-math.js +1 -0
  1229. package/dist/src/shared/token-usage.d.ts +0 -2
  1230. package/dist/src/shared/token-usage.js +1 -1
  1231. package/dist/src/shared/validate-authorization.js +1 -1
  1232. package/dist/src/shared/wait-with-signal.d.ts +2 -0
  1233. package/dist/src/shared/wait-with-signal.js +1 -0
  1234. package/dist/src/subagents/adapter.d.ts +3 -5
  1235. package/dist/src/subagents/adapter.js +1 -1
  1236. package/dist/src/subagents/callback-route.js +1 -1
  1237. package/dist/src/subagents/event-proxy-step.d.ts +6 -9
  1238. package/dist/src/subagents/event-proxy-step.js +1 -1
  1239. package/dist/src/subagents/hitl-proxy.d.ts +11 -23
  1240. package/dist/src/subagents/hitl-proxy.js +1 -1
  1241. package/dist/src/subagents/invocation.d.ts +8 -8
  1242. package/dist/src/subagents/invocation.js +2 -2
  1243. package/dist/src/subagents/parent-notification.d.ts +5 -0
  1244. package/dist/src/subagents/parent-notification.js +1 -1
  1245. package/dist/src/subagents/protocol-two-callback.d.ts +27 -0
  1246. package/dist/src/subagents/protocol-two-callback.js +1 -0
  1247. package/dist/src/svelte/index.d.ts +3 -6
  1248. package/dist/src/svelte/index.js +2 -39
  1249. package/dist/src/svelte/use-eve-agent.d.ts +67 -56
  1250. package/dist/src/svelte/use-eve-agent.js +1 -1
  1251. package/dist/src/tool-stubs/rules.js +1 -1
  1252. package/dist/src/tools/approval/policies.d.ts +4 -16
  1253. package/dist/src/tools/approval/policies.js +1 -1
  1254. package/dist/src/tools/auth.d.ts +3 -3
  1255. package/dist/src/tools/definition.d.ts +13 -35
  1256. package/dist/src/tools/definition.js +1 -1
  1257. package/dist/src/tools/dynamic.d.ts +13 -72
  1258. package/dist/src/tools/dynamic.js +1 -1
  1259. package/dist/src/tools/framework/agent.js +1 -1
  1260. package/dist/src/tools/provided/ask-question-workflow.d.ts +3 -3
  1261. package/dist/src/tools/provided/ask-question-workflow.js +1 -1
  1262. package/dist/src/tools/provided/ask-question.d.ts +2 -2
  1263. package/dist/src/tools/provided/ask-question.js +1 -1
  1264. package/dist/src/tools/provided/grep.d.ts +2 -15
  1265. package/dist/src/tools/provided/grep.js +1 -2
  1266. package/dist/src/tools/provided/no-reply.d.ts +2 -2
  1267. package/dist/src/tools/provided/no-reply.js +1 -1
  1268. package/dist/src/tools/provided/sleep-workflow.js +1 -1
  1269. package/dist/src/tools/provided/sleep.d.ts +2 -2
  1270. package/dist/src/tools/provided/sleep.js +1 -1
  1271. package/dist/src/tools/provided/workflow.js +1 -1
  1272. package/dist/src/tools/schema.d.ts +2 -0
  1273. package/dist/src/tools/schema.js +1 -1
  1274. package/dist/src/tools/signature.js +1 -1
  1275. package/dist/src/tools/workflow-definition.d.ts +17 -15
  1276. package/dist/src/tracing/eve/agent-approval-instrumentation.d.ts +1 -1
  1277. package/dist/src/tracing/eve/agent-approval-instrumentation.js +1 -1
  1278. package/dist/src/tracing/eve/agent-channel-delivery-instrumentation.d.ts +2 -2
  1279. package/dist/src/tracing/eve/agent-channel-delivery-instrumentation.js +1 -1
  1280. package/dist/src/tracing/eve/agent-invocation-coordinator.d.ts +2 -2
  1281. package/dist/src/tracing/eve/agent-otel-provider.js +1 -1
  1282. package/dist/src/tracing/eve/agent-tool-instrumentation.d.ts +6 -7
  1283. package/dist/src/tracing/eve/agent-tool-instrumentation.js +1 -1
  1284. package/dist/src/tracing/eve/agent-trace-context-store.d.ts +3 -3
  1285. package/dist/src/tracing/eve/agent-trace-state.d.ts +1 -6
  1286. package/dist/src/tracing/eve/delegation.d.ts +4 -4
  1287. package/dist/src/tracing/eve/install-instrumentation-runtime.js +1 -1
  1288. package/dist/src/tracing/eve/invoke-tool-span.d.ts +3 -2
  1289. package/dist/src/tracing/eve/invoke-tool-span.js +1 -1
  1290. package/dist/src/tracing/eve/otel-declaration.d.ts +9 -10
  1291. package/dist/src/tracing/eve/otel-declaration.js +1 -1
  1292. package/dist/src/tracing/eve/policy.d.ts +2 -2
  1293. package/dist/src/tracing/eve/policy.js +1 -1
  1294. package/dist/src/tracing/eve/session.d.ts +4 -3
  1295. package/dist/src/tracing/eve/session.js +1 -1
  1296. package/dist/src/vue/index.d.ts +3 -6
  1297. package/dist/src/vue/index.js +2 -39
  1298. package/dist/src/vue/use-eve-agent.d.ts +70 -59
  1299. package/dist/src/vue/use-eve-agent.js +1 -1
  1300. package/docs/agent-config.md +40 -44
  1301. package/docs/channels/chat-sdk.mdx +19 -13
  1302. package/docs/channels/custom.mdx +106 -85
  1303. package/docs/channels/discord.mdx +12 -12
  1304. package/docs/channels/eve.mdx +48 -15
  1305. package/docs/channels/github.mdx +2 -2
  1306. package/docs/channels/linear.mdx +8 -8
  1307. package/docs/channels/linq.mdx +1 -1
  1308. package/docs/channels/mcp.mdx +2 -2
  1309. package/docs/channels/overview.mdx +11 -1
  1310. package/docs/channels/photon.mdx +1 -1
  1311. package/docs/channels/slack.mdx +65 -58
  1312. package/docs/channels/teams.mdx +4 -4
  1313. package/docs/channels/telegram.mdx +1 -1
  1314. package/docs/channels/twilio.mdx +2 -2
  1315. package/docs/code-extension.mdx +19 -7
  1316. package/docs/concepts/built-in-tools.md +21 -9
  1317. package/docs/concepts/context-control.md +5 -8
  1318. package/docs/concepts/default-harness.md +8 -9
  1319. package/docs/concepts/execution-model-and-durability.mdx +119 -12
  1320. package/docs/concepts/meta.json +1 -0
  1321. package/docs/concepts/sessions-runs-and-streaming.md +244 -138
  1322. package/docs/concepts/state.md +1 -1
  1323. package/docs/concepts/upgrade-to-v27-events.md +128 -0
  1324. package/docs/connections/mcp.mdx +38 -34
  1325. package/docs/connections/openapi.mdx +24 -3
  1326. package/docs/connections/overview.mdx +66 -57
  1327. package/docs/evals/assertions.mdx +30 -24
  1328. package/docs/evals/cases.mdx +19 -24
  1329. package/docs/evals/judge.mdx +2 -2
  1330. package/docs/evals/overview.mdx +7 -7
  1331. package/docs/evals/reporters.mdx +15 -11
  1332. package/docs/evals/targets.mdx +5 -3
  1333. package/docs/evals/tool-stubs.mdx +2 -2
  1334. package/docs/extensions.md +6 -3
  1335. package/docs/guides/auth-and-route-protection.md +4 -0
  1336. package/docs/guides/client/continuations.mdx +10 -10
  1337. package/docs/guides/client/messages.mdx +50 -48
  1338. package/docs/guides/client/output-schema.mdx +13 -13
  1339. package/docs/guides/client/overview.mdx +12 -12
  1340. package/docs/guides/client/streaming.mdx +160 -123
  1341. package/docs/guides/decide.md +15 -9
  1342. package/docs/guides/deployment/self-hosting.md +5 -40
  1343. package/docs/guides/dynamic-capabilities.md +151 -406
  1344. package/docs/guides/frontend/nextjs.mdx +1 -1
  1345. package/docs/guides/frontend/nuxt.mdx +2 -2
  1346. package/docs/guides/frontend/overview.mdx +257 -181
  1347. package/docs/guides/frontend/sveltekit.mdx +4 -4
  1348. package/docs/guides/frontend/tanstack.mdx +5 -5
  1349. package/docs/guides/frontend/use-eve-agent-svelte.mdx +30 -38
  1350. package/docs/guides/frontend/use-eve-agent-vue.mdx +35 -36
  1351. package/docs/guides/hooks.md +67 -55
  1352. package/docs/guides/instrumentation/instrumentation.mdx +33 -27
  1353. package/docs/guides/instrumentation/otel.mdx +4 -2
  1354. package/docs/guides/remote-agents.md +116 -50
  1355. package/docs/guides/self-modification.md +11 -7
  1356. package/docs/instructions.mdx +4 -6
  1357. package/docs/memory/custom-provider.md +63 -56
  1358. package/docs/memory/file.md +1 -1
  1359. package/docs/memory/overview.mdx +10 -18
  1360. package/docs/patterns/durable-cross-channel-notifications.md +4 -3
  1361. package/docs/patterns/multi-tenant-approvals.md +3 -3
  1362. package/docs/patterns/multi-tenant-auth.md +3 -3
  1363. package/docs/patterns/multi-tenant-memory.md +6 -7
  1364. package/docs/patterns/voice-notes.md +1 -1
  1365. package/docs/reference/cli.md +11 -25
  1366. package/docs/reference/typescript-api.md +88 -61
  1367. package/docs/sandbox/custom-providers.mdx +13 -14
  1368. package/docs/sandbox/default.mdx +1 -1
  1369. package/docs/sandbox/docker.mdx +10 -0
  1370. package/docs/sandbox/index.mdx +4 -0
  1371. package/docs/sandbox/vercel.mdx +6 -6
  1372. package/docs/schedules.mdx +4 -4
  1373. package/docs/skills.mdx +6 -6
  1374. package/docs/subagents/index.mdx +25 -34
  1375. package/docs/tools/human-in-the-loop.md +42 -34
  1376. package/docs/tools/overview.mdx +14 -12
  1377. package/docs/tools/tasks-upgrade.md +13 -1
  1378. package/docs/tools/tasks.md +58 -89
  1379. package/docs/tools/workflows.mdx +44 -33
  1380. package/docs/tutorial/guard-the-spend.mdx +1 -1
  1381. package/docs/tutorial/run-analysis.mdx +15 -12
  1382. package/docs/tutorial/team-playbooks.mdx +19 -23
  1383. package/package.json +148 -93
  1384. package/dist/src/chunks/use-eve-agent-DnbG9c7c.js +0 -4921
  1385. package/dist/src/chunks/use-eve-agent-ZY7NQ2VW.js +0 -4963
  1386. package/dist/src/cli/invoke/command.d.ts +0 -19
  1387. package/dist/src/cli/invoke/command.js +0 -1
  1388. package/dist/src/cli/invoke/invoke.d.ts +0 -27
  1389. package/dist/src/cli/invoke/invoke.js +0 -1
  1390. package/dist/src/cli/invoke/result.d.ts +0 -137
  1391. package/dist/src/cli/invoke/result.js +0 -1
  1392. package/dist/src/client/agent-host.d.ts +0 -4
  1393. package/dist/src/client/agent-host.js +0 -1
  1394. package/dist/src/client/authorization-message-parts.d.ts +0 -4
  1395. package/dist/src/client/authorization-message-parts.js +0 -1
  1396. package/dist/src/client/conversation-projection.d.ts +0 -4
  1397. package/dist/src/client/conversation-projection.js +0 -1
  1398. package/dist/src/client/conversation-reducer.d.ts +0 -29
  1399. package/dist/src/client/conversation-reducer.js +0 -1
  1400. package/dist/src/client/eve-agent-projection.d.ts +0 -28
  1401. package/dist/src/client/eve-agent-projection.js +0 -1
  1402. package/dist/src/client/eve-agent-store-helpers.d.ts +0 -34
  1403. package/dist/src/client/eve-agent-store-helpers.js +0 -2
  1404. package/dist/src/client/eve-agent-store-state.d.ts +0 -96
  1405. package/dist/src/client/eve-agent-store.d.ts +0 -45
  1406. package/dist/src/client/eve-agent-store.js +0 -1
  1407. package/dist/src/client/message-action-parts.d.ts +0 -37
  1408. package/dist/src/client/message-action-parts.js +0 -1
  1409. package/dist/src/client/message-reducer-primitives.d.ts +0 -6
  1410. package/dist/src/client/message-reducer-primitives.js +0 -1
  1411. package/dist/src/client/message-reducer-types.d.ts +0 -244
  1412. package/dist/src/client/message-reducer.d.ts +0 -14
  1413. package/dist/src/client/message-reducer.js +0 -1
  1414. package/dist/src/client/message-response.d.ts +0 -74
  1415. package/dist/src/client/message-response.js +0 -1
  1416. package/dist/src/client/message-run-parts.d.ts +0 -22
  1417. package/dist/src/client/message-run-parts.js +0 -1
  1418. package/dist/src/client/output-schema.d.ts +0 -5
  1419. package/dist/src/client/output-schema.js +0 -1
  1420. package/dist/src/client/reducer.d.ts +0 -67
  1421. package/dist/src/client/session-turn-dispatch.d.ts +0 -15
  1422. package/dist/src/client/session-turn-dispatch.js +0 -1
  1423. package/dist/src/client/tool-call-state.d.ts +0 -23
  1424. package/dist/src/client/tool-call-state.js +0 -1
  1425. package/dist/src/client/tool-part-state.d.ts +0 -7
  1426. package/dist/src/client/tool-part-state.js +0 -1
  1427. package/dist/src/client/transcript-reducer.d.ts +0 -49
  1428. package/dist/src/client/transcript-reducer.js +0 -2
  1429. package/dist/src/context/build-dynamic-tools.d.ts +0 -10
  1430. package/dist/src/context/build-dynamic-tools.js +0 -1
  1431. package/dist/src/context/dynamic-connection-lifecycle.d.ts +0 -15
  1432. package/dist/src/context/dynamic-connection-lifecycle.js +0 -1
  1433. package/dist/src/context/dynamic-instruction-lifecycle.d.ts +0 -31
  1434. package/dist/src/context/dynamic-instruction-lifecycle.js +0 -1
  1435. package/dist/src/context/dynamic-model-lifecycle.d.ts +0 -19
  1436. package/dist/src/context/dynamic-model-lifecycle.js +0 -1
  1437. package/dist/src/context/dynamic-resolve-context.d.ts +0 -12
  1438. package/dist/src/context/dynamic-resolve-context.js +0 -1
  1439. package/dist/src/context/dynamic-skill-lifecycle.d.ts +0 -15
  1440. package/dist/src/context/dynamic-skill-lifecycle.js +0 -1
  1441. package/dist/src/context/dynamic-subagent-lifecycle.d.ts +0 -27
  1442. package/dist/src/context/dynamic-subagent-lifecycle.js +0 -1
  1443. package/dist/src/context/dynamic-tool-lifecycle.d.ts +0 -46
  1444. package/dist/src/context/dynamic-tool-lifecycle.js +0 -1
  1445. package/dist/src/context/dynamic-tool-metadata.d.ts +0 -47
  1446. package/dist/src/context/dynamic-tool-metadata.js +0 -1
  1447. package/dist/src/context/effective-model.d.ts +0 -5
  1448. package/dist/src/context/effective-model.js +0 -1
  1449. package/dist/src/context/hook-lifecycle.d.ts +0 -15
  1450. package/dist/src/context/hook-lifecycle.js +0 -1
  1451. package/dist/src/context/memory-event-lifecycle.d.ts +0 -15
  1452. package/dist/src/context/memory-event-lifecycle.js +0 -1
  1453. package/dist/src/context/memory-lifecycle.d.ts +0 -47
  1454. package/dist/src/context/memory-lifecycle.js +0 -1
  1455. package/dist/src/context/serialized-dynamic-model-selection.d.ts +0 -2
  1456. package/dist/src/context/serialized-dynamic-model-selection.js +0 -1
  1457. package/dist/src/execution/cancel-descendant-turns-step.d.ts +0 -6
  1458. package/dist/src/execution/cancel-descendant-turns-step.js +0 -1
  1459. package/dist/src/execution/dynamic-connection-recovery.d.ts +0 -14
  1460. package/dist/src/execution/dynamic-connection-recovery.js +0 -1
  1461. package/dist/src/execution/dynamic-connections.d.ts +0 -12
  1462. package/dist/src/execution/dynamic-connections.js +0 -1
  1463. package/dist/src/execution/history-view.d.ts +0 -10
  1464. package/dist/src/execution/history-view.js +0 -1
  1465. package/dist/src/execution/legacy-remote-agent/protocol.d.ts +0 -49
  1466. package/dist/src/execution/legacy-remote-agent/protocol.js +0 -1
  1467. package/dist/src/execution/runtime-errors.d.ts +0 -13
  1468. package/dist/src/execution/runtime-errors.js +0 -1
  1469. package/dist/src/execution/sandbox/grep-tool.d.ts +0 -26
  1470. package/dist/src/execution/sandbox/grep-tool.js +0 -3
  1471. package/dist/src/execution/session/turn-waiting-step.d.ts +0 -4
  1472. package/dist/src/execution/session/turn-waiting-step.js +0 -1
  1473. package/dist/src/execution/tools/workflow/cancel.d.ts +0 -13
  1474. package/dist/src/execution/tools/workflow/cancel.js +0 -1
  1475. package/dist/src/execution/workflow-trace-context.d.ts +0 -8
  1476. package/dist/src/execution/workflow-trace-context.js +0 -1
  1477. package/dist/src/extensions/code/extension/instructions/github.d.ts +0 -3
  1478. package/dist/src/extensions/code/extension/instructions/github.js +0 -1
  1479. package/dist/src/extensions/code/extension/lib/github-compat.d.ts +0 -28
  1480. package/dist/src/extensions/code/extension/lib/github-compat.js +0 -1
  1481. package/dist/src/extensions/code/extension/lib/grep-search.js +0 -6
  1482. package/dist/src/extensions/code/extension/skills/pr.d.ts +0 -6
  1483. package/dist/src/extensions/code/extension/skills/pr.js +0 -1
  1484. package/dist/src/extensions/code/extension/tools/gh.d.ts +0 -28
  1485. package/dist/src/extensions/code/extension/tools/gh.js +0 -1
  1486. package/dist/src/harness/approval-recheck.d.ts +0 -7
  1487. package/dist/src/harness/approval-recheck.js +0 -1
  1488. package/dist/src/harness/authorization-event-fields.d.ts +0 -16
  1489. package/dist/src/harness/authorization-event-fields.js +0 -1
  1490. package/dist/src/harness/hitl/candidates.d.ts +0 -139
  1491. package/dist/src/harness/hitl/candidates.js +0 -1
  1492. package/dist/src/harness/hitl/coordinator.d.ts +0 -35
  1493. package/dist/src/harness/hitl/coordinator.js +0 -1
  1494. package/dist/src/harness/input-extraction.d.ts +0 -13
  1495. package/dist/src/harness/input-extraction.js +0 -1
  1496. package/dist/src/harness/input-request-class.d.ts +0 -3
  1497. package/dist/src/harness/input-request-class.js +0 -1
  1498. package/dist/src/harness/input-request-resolution.d.ts +0 -39
  1499. package/dist/src/harness/input-request-resolution.js +0 -1
  1500. package/dist/src/harness/open-input-request.d.ts +0 -8
  1501. package/dist/src/harness/open-input-request.js +0 -1
  1502. package/dist/src/harness/session-machine/events.d.ts +0 -6
  1503. package/dist/src/harness/session-machine/events.js +0 -1
  1504. package/dist/src/harness/session-machine/resolver-events.d.ts +0 -12
  1505. package/dist/src/harness/session-machine/resolver-events.js +0 -1
  1506. package/dist/src/harness/tool-call-action.d.ts +0 -9
  1507. package/dist/src/harness/tool-call-action.js +0 -1
  1508. package/dist/src/harness/tool-interrupts.d.ts +0 -22
  1509. package/dist/src/harness/tool-interrupts.js +0 -1
  1510. package/dist/src/harness/tool-presentation.d.ts +0 -5
  1511. package/dist/src/harness/tool-presentation.js +0 -1
  1512. package/dist/src/harness/turn-tag-state.d.ts +0 -115
  1513. package/dist/src/harness/turn-tag-state.js +0 -1
  1514. package/dist/src/internal/dynamic-tool-rebind.d.ts +0 -3
  1515. package/dist/src/internal/dynamic-tool-rebind.js +0 -1
  1516. package/dist/src/internal/nitro/host/extension-capability-requirements.d.ts +0 -14
  1517. package/dist/src/internal/nitro/host/extension-capability-requirements.js +0 -1
  1518. package/dist/src/internal/workflow-bundle/dynamic-capability-transform-plugin.d.ts +0 -12
  1519. package/dist/src/internal/workflow-bundle/dynamic-capability-transform-plugin.js +0 -1
  1520. package/dist/src/internal/workflow-bundle/dynamic-remote-agent-transform.d.ts +0 -7
  1521. package/dist/src/internal/workflow-bundle/dynamic-remote-agent-transform.js +0 -3
  1522. package/dist/src/internal/workflow-bundle/dynamic-tool-ast-references.d.ts +0 -79
  1523. package/dist/src/internal/workflow-bundle/dynamic-tool-ast-references.js +0 -1
  1524. package/dist/src/internal/workflow-bundle/dynamic-tool-transform.d.ts +0 -14
  1525. package/dist/src/internal/workflow-bundle/dynamic-tool-transform.js +0 -3
  1526. package/dist/src/protocol/event-dedupe.d.ts +0 -26
  1527. package/dist/src/protocol/event-dedupe.js +0 -1
  1528. package/dist/src/protocol/event-id.d.ts +0 -10
  1529. package/dist/src/protocol/event-id.js +0 -1
  1530. package/dist/src/protocol/message-version.d.ts +0 -53
  1531. package/dist/src/protocol/message-version.js +0 -1
  1532. package/dist/src/protocol/message.d.ts +0 -1198
  1533. package/dist/src/protocol/message.js +0 -2
  1534. package/dist/src/public/channels/chat-sdk/messageToUserContent.js +0 -1
  1535. package/dist/src/public/channels/slack/input-response.js +0 -1
  1536. package/dist/src/runtime/hooks/registry.d.ts +0 -34
  1537. package/dist/src/runtime/hooks/registry.js +0 -1
  1538. package/dist/src/runtime/resolve-dynamic-connection.d.ts +0 -5
  1539. package/dist/src/runtime/resolve-dynamic-connection.js +0 -1
  1540. package/dist/src/runtime/resolve-dynamic-instructions.d.ts +0 -4
  1541. package/dist/src/runtime/resolve-dynamic-instructions.js +0 -1
  1542. package/dist/src/runtime/resolve-dynamic-skill.d.ts +0 -8
  1543. package/dist/src/runtime/resolve-dynamic-skill.js +0 -1
  1544. package/dist/src/runtime/resolve-dynamic-subagent.d.ts +0 -9
  1545. package/dist/src/runtime/resolve-dynamic-subagent.js +0 -1
  1546. package/dist/src/runtime/resolve-dynamic-tool.d.ts +0 -12
  1547. package/dist/src/runtime/resolve-dynamic-tool.js +0 -1
  1548. package/dist/src/self-modification/migration.d.ts +0 -9
  1549. package/dist/src/self-modification/migration.js +0 -28
  1550. package/dist/src/shared/history-view.d.ts +0 -22
  1551. package/dist/src/shared/history-view.js +0 -1
  1552. package/dist/src/shared/package-version.d.ts +0 -2
  1553. package/dist/src/shared/package-version.js +0 -1
  1554. package/dist/src/tools/durable-callbacks.d.ts +0 -118
  1555. package/dist/src/tools/durable-callbacks.js +0 -1
  1556. package/dist/src/tools/durable-schema.d.ts +0 -16
  1557. package/dist/src/tools/durable-schema.js +0 -1
  1558. /package/dist/src/{client/eve-agent-store-state.js → ai/decision-types.js} +0 -0
  1559. /package/dist/src/client/{message-reducer-types.js → agent-info-types.js} +0 -0
  1560. /package/dist/src/client/{reducer.js → health-types.js} +0 -0
  1561. /package/dist/src/{shared → protocol/session-projection}/display-name.d.ts +0 -0
  1562. /package/dist/src/{shared → protocol/session-projection}/display-name.js +0 -0
@@ -1,6 +1,15 @@
1
1
  const WEB_APP_TEMPLATE_FILES={"app/_components/agent-chat.tsx":`"use client";
2
2
 
3
- import type { UserContent } from "ai";
3
+ import { ClientError, type MessagePart } from "eve/client";
4
+ import {
5
+ activeTurn,
6
+ activity,
7
+ failure,
8
+ interaction,
9
+ interactions,
10
+ turns,
11
+ type Activity,
12
+ } from "eve/events";
4
13
  import { useEveAgent } from "eve/react";
5
14
  import { AlertCircleIcon, BrainIcon, PlusIcon, SquareIcon } from "lucide-react";
6
15
  import { useRef, useState } from "react";
@@ -19,8 +28,8 @@ import {
19
28
  PromptInputTextarea,
20
29
  usePromptInputAttachments,
21
30
  } from "@/components/ai-elements/prompt-input";
22
- import { Shimmer } from "@/components/ai-elements/shimmer";
23
31
  import { Button } from "@/components/ui/button";
32
+ import { Trace, TraceIcon, TraceLine, TraceTitle } from "@/components/ui/trace";
24
33
  import { cn } from "@/lib/utils";
25
34
  import { AgentMessage } from "./agent-message";
26
35
  import { WEB_CHAT_AGENT } from "@/app/eve-agent";
@@ -67,28 +76,41 @@ export function AgentChat({
67
76
  },
68
77
  });
69
78
 
70
- const isBusy = agent.status === "submitted" || agent.status === "streaming";
79
+ const isBusy = agent.status === "busy";
80
+ // A turn waiting on a person is open while the store is idle; it still takes steering and Stop.
81
+ const turnOpen = activeTurn(agent.view) !== undefined;
71
82
  const isResuming = agent.status === "resuming";
72
- const isEmpty = agent.data.messages.length === 0;
73
- const lastMessage = agent.data.messages.at(-1);
83
+ const isEmpty = agent.messages.length === 0;
84
+ const lastMessage = agent.messages.at(-1);
74
85
  const isPendingAssistantShell =
75
- lastMessage?.role === "assistant" &&
76
- lastMessage.parts.every((part) => part.type === "step-start");
86
+ lastMessage?.role === "assistant" && lastMessage.parts.length === 0;
87
+ const now = activity(agent.view);
88
+ // Show what the agent is doing until its message has something to show, unless it waits on you.
77
89
  const showPendingThinking =
78
90
  isBusy &&
79
- (agent.status === "submitted" || lastMessage?.role !== "assistant" || isPendingAssistantShell);
80
- const turnFailure = isBusy || isResuming ? undefined : getLatestTurnFailure(agent.events);
91
+ now.kind !== "waiting-on-interaction" &&
92
+ (lastMessage?.role !== "assistant" || isPendingAssistantShell);
93
+ const failed =
94
+ isBusy || isResuming ? undefined : failure(agent.view, turns(agent.view).at(-1)?.turnId);
95
+ const turnFailure =
96
+ failed?.code === "MODEL_CALL_FAILED"
97
+ ? "The model is temporarily unavailable. Please try again."
98
+ : failed?.message;
81
99
  const errorMessage = cancellationError ?? agent.error?.message ?? turnFailure;
82
100
  const hasConversationContent = sessionless || !isEmpty || errorMessage !== undefined;
83
101
  const showConversationLayout = isResuming || hasConversationContent;
84
102
  const activeSessionId = sessionId ?? agent.session?.sessionId;
103
+ // A session that ended outside eve never settles its requests, so they stay open, yet it
104
+ // accepts no answer. Once the server says so, stop offering them.
105
+ const sessionEnded =
106
+ agent.error instanceof ClientError && agent.error.code === "session_not_active";
85
107
  // Answers are accepted while work runs; the server's settlement closes each request.
86
- const canRespond = (requestId: string) =>
87
- !isResuming && agent.data.inputs[requestId]?.status === "open";
108
+ const canRespond = (interactionId: string) =>
109
+ !isResuming && !sessionEnded && interaction(agent.view, interactionId)?.status === "open";
88
110
  // A tool call can ask several questions at once, and its message part holds only the latest.
89
111
  const questionsFor = (callId: string) =>
90
- Object.values(agent.data.inputs).filter(
91
- (input) => input.request.kind === "question" && input.request.action.callId === callId,
112
+ interactions(agent.view).filter(
113
+ (input) => input.request.kind === "question" && input.call?.callId === callId,
92
114
  );
93
115
 
94
116
  const requestCancellation = () => {
@@ -106,14 +128,14 @@ export function AgentChat({
106
128
  setCancellationError(undefined);
107
129
  hasSubmittedMessage.current = true;
108
130
  if (agent.session !== undefined) replaceSessionRoute(agent.session.sessionId);
109
- const options = isBusy ? { turnPolicy: "steer" as const } : undefined;
131
+ const options = turnOpen ? { turnPolicy: "steer" as const } : undefined;
110
132
 
111
133
  if (message.files.length === 0) {
112
134
  await agent.send(text, options);
113
135
  return;
114
136
  }
115
137
 
116
- const parts: UserContent = [];
138
+ const parts: MessagePart[] = [];
117
139
  if (text.length > 0) {
118
140
  parts.push({ text, type: "text" });
119
141
  }
@@ -138,7 +160,7 @@ export function AgentChat({
138
160
  />
139
161
  <ComposerAction
140
162
  hasInputText={hasInputText}
141
- isBusy={isBusy}
163
+ canCancel={turnOpen}
142
164
  isResuming={isResuming}
143
165
  onCancel={requestCancellation}
144
166
  />
@@ -164,26 +186,28 @@ export function AgentChat({
164
186
  >
165
187
  <ConversationTopFade className="top-14" />
166
188
  <ConversationContent className="mx-auto w-full max-w-3xl gap-6 px-4 pt-20 pb-36 sm:px-6">
167
- {agent.data.messages.map((message, index) =>
189
+ {agent.messages.map((message) =>
168
190
  showPendingThinking &&
169
191
  isPendingAssistantShell &&
170
192
  message.id === lastMessage.id ? null : (
171
193
  <AgentMessage
172
194
  canRespond={canRespond}
173
- isStreaming={
174
- agent.status === "streaming" && index === agent.data.messages.length - 1
175
- }
176
195
  key={message.id}
177
196
  message={message}
178
197
  questionsFor={questionsFor}
179
- onInputResponses={(inputResponses) => {
198
+ view={agent.view}
199
+ onAnswers={async (answers) => {
180
200
  setCancellationError(undefined);
181
- return agent.respond(inputResponses);
201
+ await agent.respond(answers).catch((cause: unknown) => {
202
+ setCancellationError(
203
+ cause instanceof Error ? cause.message : "Unable to submit the answer.",
204
+ );
205
+ });
182
206
  }}
183
207
  />
184
208
  ),
185
209
  )}
186
- {showPendingThinking ? <PendingThinking /> : null}
210
+ {showPendingThinking ? <PendingActivity activity={now} /> : null}
187
211
  {errorMessage ? <ErrorMessage message={errorMessage} /> : null}
188
212
  </ConversationContent>
189
213
  <ConversationScrollButton />
@@ -211,19 +235,19 @@ export function AgentChat({
211
235
 
212
236
  function ComposerAction({
213
237
  hasInputText,
214
- isBusy,
238
+ canCancel,
215
239
  isResuming,
216
240
  onCancel,
217
241
  }: {
218
242
  readonly hasInputText: boolean;
219
- readonly isBusy: boolean;
243
+ readonly canCancel: boolean;
220
244
  readonly isResuming: boolean;
221
245
  readonly onCancel: () => void;
222
246
  }) {
223
247
  const attachments = usePromptInputAttachments();
224
248
  const canSubmit = hasInputText || attachments.files.length > 0;
225
249
 
226
- if (!isBusy || canSubmit) {
250
+ if (!canCancel || canSubmit) {
227
251
  return <PromptInputSubmit disabled={isResuming} />;
228
252
  }
229
253
 
@@ -281,75 +305,66 @@ function ChatHeader({ canStartNewChat }: { readonly canStartNewChat: boolean })
281
305
  );
282
306
  }
283
307
 
284
- function PendingThinking() {
308
+ function PendingActivity({ activity }: { readonly activity: Activity }) {
285
309
  return (
286
310
  <Message aria-live="polite" from="assistant">
287
311
  <MessageContent>
288
- <div className="mb-4 flex w-full items-center gap-2 text-muted-foreground text-sm">
289
- <BrainIcon className="size-4" />
290
- <Shimmer duration={1}>Thinking</Shimmer>
291
- </div>
312
+ <Trace>
313
+ <TraceLine status="running">
314
+ <TraceIcon>
315
+ <BrainIcon />
316
+ </TraceIcon>
317
+ <TraceTitle>{activityLabel(activity)}</TraceTitle>
318
+ </TraceLine>
319
+ </Trace>
292
320
  </MessageContent>
293
321
  </Message>
294
322
  );
295
323
  }
296
324
 
297
- function toErrorMessage(error: unknown): string {
298
- return error instanceof Error ? error.message : "Unable to cancel the response.";
299
- }
300
-
301
- function getLatestTurnFailure(
302
- events: ReturnType<typeof useEveAgent>["events"],
303
- ): string | undefined {
304
- for (let index = events.length - 1; index >= 0; index -= 1) {
305
- const event = events[index];
306
-
307
- if (event.type === "turn.failed") {
308
- return event.data.code === "MODEL_CALL_FAILED"
309
- ? "The model is temporarily unavailable. Please try again."
310
- : event.data.message;
311
- }
312
-
313
- if (event.type === "turn.completed" || event.type === "turn.cancelled") {
314
- return undefined;
315
- }
316
-
317
- if (event.type === "message.received") {
318
- return undefined;
319
- }
325
+ function activityLabel(activity: Activity): string {
326
+ switch (activity.kind) {
327
+ case "calling":
328
+ return activity.names.join(", ");
329
+ case "waiting-on-tasks":
330
+ return \`Waiting on \${activity.tasks.map((task) => task.name).join(", ")}\`;
331
+ case "compacting":
332
+ return "Compacting the conversation";
333
+ default:
334
+ return "Thinking";
320
335
  }
336
+ }
321
337
 
322
- return undefined;
338
+ function toErrorMessage(error: unknown): string {
339
+ return error instanceof Error ? error.message : "Unable to cancel the response.";
323
340
  }
324
341
  `,"app/_components/agent-message.tsx":`"use client";
325
342
 
343
+ import type { CallState, SessionView } from "eve/events";
344
+ import { callState, call, part } from "eve/events";
326
345
  import type {
327
- ConversationInput,
328
- EveAuthorizationPart,
329
- EveDynamicToolPart,
346
+ Interaction,
347
+ EveInteractionPart,
330
348
  EveMessage,
331
- EveMessageInputRequest,
332
349
  EveMessagePart,
350
+ EveToolPart,
333
351
  } from "eve/react";
334
- import type { FormEvent } from "react";
352
+ import { signInEnding } from "eve/events";
353
+ import { useState, type FormEvent } from "react";
335
354
  import {
355
+ BotIcon,
356
+ BrainIcon,
336
357
  CheckCircleIcon,
337
358
  ExternalLinkIcon,
338
359
  FileIcon,
339
360
  ImageIcon,
340
361
  KeyRoundIcon,
362
+ TerminalIcon,
363
+ WrenchIcon,
341
364
  XCircleIcon,
342
365
  } from "lucide-react";
343
366
  import { Message, MessageContent, MessageResponse } from "@/components/ai-elements/message";
344
- import { Reasoning, ReasoningContent, ReasoningTrigger } from "@/components/ai-elements/reasoning";
345
- import {
346
- BashToolContent,
347
- Tool,
348
- ToolContent,
349
- ToolHeader,
350
- ToolInput,
351
- ToolOutput,
352
- } from "@/components/ai-elements/tool";
367
+ import { BashToolContent, ToolInput, ToolOutput } from "@/components/ai-elements/tool";
353
368
  import { Button } from "@/components/ui/button";
354
369
  import {
355
370
  Questionnaire,
@@ -363,53 +378,51 @@ import {
363
378
  QuestionnaireSubmit,
364
379
  QuestionnaireTitle,
365
380
  } from "@/components/ui/questionnaire";
381
+ import {
382
+ Trace,
383
+ TraceCollapsible,
384
+ TraceCollapsibleContent,
385
+ TraceCollapsibleTrigger,
386
+ TraceDescription,
387
+ TraceIcon,
388
+ TraceLine,
389
+ TraceTitle,
390
+ } from "@/components/ui/trace";
366
391
  import { cn } from "@/lib/utils";
367
392
 
368
- export type AgentInputResponse = {
393
+ export type AgentAnswer = {
369
394
  readonly optionId?: string;
370
- readonly requestId: string;
395
+ readonly interactionId: string;
371
396
  readonly text?: string;
372
397
  };
373
398
 
399
+ /** How a message answers what the agent asks. */
400
+ interface Asks {
401
+ readonly canRespond: (interactionId: string) => boolean;
402
+ readonly onAnswers: (answers: readonly AgentAnswer[]) => void | Promise<void>;
403
+ /** Every question a call asked; its part holds only the latest. */
404
+ readonly questionsFor: (callId: string) => readonly Interaction[];
405
+ }
406
+
374
407
  type EveFilePart = Extract<EveMessagePart, { type: "file" }>;
408
+ type Step = Extract<EveMessagePart, { type: "reasoning" | "tool" }>;
375
409
 
376
410
  export function AgentMessage({
377
- canRespond,
378
- isStreaming,
379
411
  message,
380
- onInputResponses,
381
- questionsFor,
382
- }: {
383
- readonly canRespond: (requestId: string) => boolean;
384
- readonly isStreaming: boolean;
385
- readonly message: EveMessage;
386
- readonly onInputResponses: (responses: readonly AgentInputResponse[]) => void | Promise<void>;
387
- readonly questionsFor: (callId: string) => readonly ConversationInput[];
388
- }) {
389
- const lastTextIndex = message.parts.reduce(
390
- (last, part, index) => (part.type === "text" ? index : last),
391
- -1,
392
- );
393
- const hasAssistantText =
394
- message.role === "assistant" &&
395
- message.parts.some((part) => part.type === "text" && part.text.length > 0);
396
-
412
+ view,
413
+ ...asks
414
+ }: Asks & { readonly message: EveMessage; readonly view: SessionView }) {
397
415
  return (
398
416
  <Message
399
417
  data-optimistic={message.metadata?.optimistic ? "true" : undefined}
400
418
  from={message.role}
401
419
  >
402
420
  <MessageContent>
403
- {message.parts.map((part, index) =>
404
- hasAssistantText && part.type === "reasoning" ? null : (
405
- <AgentMessagePart
406
- canRespond={canRespond}
407
- key={partKey(part, index)}
408
- onInputResponses={onInputResponses}
409
- part={part}
410
- questionsFor={questionsFor}
411
- showCaret={isStreaming && message.role === "assistant" && index === lastTextIndex}
412
- />
421
+ {blocksOf(message.parts, asks).map((block, index) =>
422
+ Array.isArray(block) ? (
423
+ <Steps asks={asks} key={partKey(block[0]!, index)} steps={block} view={view} />
424
+ ) : (
425
+ <AgentMessagePart asks={asks} key={partKey(block, index)} part={block} />
413
426
  ),
414
427
  )}
415
428
  </MessageContent>
@@ -417,120 +430,268 @@ export function AgentMessage({
417
430
  );
418
431
  }
419
432
 
420
- function AgentMessagePart({
421
- canRespond,
422
- onInputResponses,
423
- part,
424
- questionsFor,
425
- showCaret,
426
- }: {
427
- readonly canRespond: (requestId: string) => boolean;
428
- readonly onInputResponses: (responses: readonly AgentInputResponse[]) => void | Promise<void>;
429
- readonly part: EveMessagePart;
430
- readonly questionsFor: (callId: string) => readonly ConversationInput[];
431
- readonly showCaret: boolean;
432
- }) {
433
+ /**
434
+ * A message's parts, with each run of steps (reasoning and calls) gathered into one list. A call
435
+ * that asks a question shows as that question instead, and the model waiting on or cancelling
436
+ * its own tasks isn't activity to show.
437
+ */
438
+ function blocksOf(parts: readonly EveMessagePart[], asks: Asks): (EveMessagePart | Step[])[] {
439
+ const blocks: (EveMessagePart | Step[])[] = [];
440
+ for (const part of parts) {
441
+ if (part.type === "tool" && part.kind === "control") continue;
442
+ const isStep =
443
+ part.type === "reasoning" ||
444
+ (part.type === "tool" && asks.questionsFor(part.callId).length === 0);
445
+ const last = blocks.at(-1);
446
+ if (!isStep) blocks.push(part);
447
+ else if (Array.isArray(last)) last.push(part as Step);
448
+ else blocks.push([part as Step]);
449
+ }
450
+ return blocks;
451
+ }
452
+
453
+ function AgentMessagePart({ asks, part }: { readonly asks: Asks; readonly part: EveMessagePart }) {
433
454
  switch (part.type) {
434
- case "step-start":
435
- return null;
436
455
  case "text":
437
456
  return (
438
- <MessageResponse caret="block" isAnimating={showCaret}>
457
+ <MessageResponse caret="block" isAnimating={part.state === "streaming"}>
439
458
  {part.text}
440
459
  </MessageResponse>
441
460
  );
442
- case "reasoning":
443
- return (
444
- <Reasoning defaultOpen isStreaming={part.state === "streaming"}>
445
- <ReasoningTrigger />
446
- <ReasoningContent>{part.text}</ReasoningContent>
447
- </Reasoning>
448
- );
449
461
  case "file":
450
462
  return <AttachmentPart part={part} />;
451
- case "authorization":
452
- return <AuthorizationPrompt part={part} />;
453
- case "dynamic-tool": {
454
- const questions = questionsFor(part.toolCallId);
455
- if (questions.length > 0) {
456
- return (
457
- <div className="space-y-4">
458
- {questions.map(({ request, response }) => (
463
+ case "interaction":
464
+ return <InteractionPrompt asks={asks} part={part} />;
465
+ case "tool":
466
+ return (
467
+ <div className="space-y-4">
468
+ {asks.questionsFor(part.callId).map((question) => {
469
+ // The call's part shows an answer this client sent at once; the view, once eve has it.
470
+ const { answer, ...request } =
471
+ part.interaction?.interactionId === question.interactionId
472
+ ? part.interaction
473
+ : question;
474
+ return (
459
475
  <QuestionRequest
460
- canRespond={canRespond(request.requestId)}
461
- inputRequest={request}
462
- inputResponse={response}
463
- key={request.requestId}
464
- onInputResponses={onInputResponses}
476
+ answer={answer}
477
+ canRespond={asks.canRespond(request.interactionId)}
478
+ interaction={request}
479
+ key={request.interactionId}
480
+ onAnswers={asks.onAnswers}
465
481
  />
466
- ))}
467
- </div>
468
- );
469
- }
470
-
471
- return (
472
- <>
473
- <Tool>
474
- <ToolHeader
475
- state={part.state}
476
- title={part.toolMetadata?.eve?.label ?? part.toolName}
477
- toolName={part.toolName}
478
- type="dynamic-tool"
479
- />
480
- <ToolContent>
481
- {part.toolName === "bash" ? (
482
- <BashToolContent
483
- errorText={part.errorText}
484
- input={part.input}
485
- output={part.output}
486
- />
487
- ) : (
488
- <>
489
- <ToolInput input={part.input} />
490
- <ToolOutput errorText={part.errorText} output={part.output} />
491
- </>
492
- )}
493
- </ToolContent>
494
- </Tool>
495
- {/* Kept outside the collapsed card so a pending approval is always visible. */}
496
- <InputRequestActions
497
- canRespond={canRespond}
498
- part={part}
499
- onInputResponses={onInputResponses}
500
- />
501
- </>
482
+ );
483
+ })}
484
+ </div>
502
485
  );
503
- }
486
+ default:
487
+ return null;
504
488
  }
505
489
  }
506
490
 
491
+ /**
492
+ * A run of steps. Several fold into one line that opens while they work; an approval waits
493
+ * below them, so it stays in view when the list is closed.
494
+ */
495
+ function Steps({
496
+ asks,
497
+ steps,
498
+ view,
499
+ }: {
500
+ readonly asks: Asks;
501
+ readonly steps: readonly Step[];
502
+ readonly view: SessionView;
503
+ }) {
504
+ const [open, setOpen] = useState<boolean>();
505
+ const states = steps.map((step) => stepState(step, view));
506
+ const working = states.some((state) => state === "working");
507
+ const waiting = states.some((state) => state === "waiting");
508
+ const failed = states.filter((state) => state === "failed").length;
509
+ const lines = (
510
+ <Trace>
511
+ {steps.map((step, index) =>
512
+ step.type === "reasoning" ? (
513
+ <ReasoningLine key={partKey(step, index)} part={step} />
514
+ ) : (
515
+ <ToolLine key={step.callId} part={step} state={callState(view, step.callId)} />
516
+ ),
517
+ )}
518
+ </Trace>
519
+ );
520
+ const approvals = steps.flatMap((step) =>
521
+ step.type === "tool" &&
522
+ step.interaction?.request.kind === "approval" &&
523
+ step.interaction.status !== "settled"
524
+ ? [step.interaction]
525
+ : [],
526
+ );
527
+
528
+ return (
529
+ <>
530
+ {steps.length === 1 ? (
531
+ lines
532
+ ) : (
533
+ <TraceCollapsible onOpenChange={setOpen} open={open ?? (working || waiting)}>
534
+ <TraceCollapsibleTrigger>
535
+ <TraceLine status={working ? "running" : failed > 0 ? "error" : undefined}>
536
+ <TraceTitle>
537
+ {working
538
+ ? "Working"
539
+ : waiting
540
+ ? "Waiting for you"
541
+ : \`Worked\${duration(steps, view) ?? ""}\`}
542
+ </TraceTitle>
543
+ <TraceDescription>
544
+ {failed > 0 ? \`\${failed} of \${steps.length} failed\` : \`\${steps.length} steps\`}
545
+ </TraceDescription>
546
+ </TraceLine>
547
+ </TraceCollapsibleTrigger>
548
+ <TraceCollapsibleContent>{lines}</TraceCollapsibleContent>
549
+ </TraceCollapsible>
550
+ )}
551
+ {approvals.map((interaction) => (
552
+ <InteractionActions
553
+ answer={interaction.answer}
554
+ asks={asks}
555
+ interaction={interaction}
556
+ key={interaction.interactionId}
557
+ />
558
+ ))}
559
+ </>
560
+ );
561
+ }
562
+
563
+ function stepState(step: Step, view: SessionView): "working" | "waiting" | "failed" | "done" {
564
+ if (step.type === "reasoning") return step.state === "streaming" ? "working" : "done";
565
+ const state = callState(view, step.callId);
566
+ if (state === "approval" || state === "blocked") return "waiting";
567
+ const status = state === undefined ? "running" : CALL_LINES[state].status;
568
+ return status === "error" ? "failed" : status === undefined ? "done" : "working";
569
+ }
570
+
571
+ /** " for 12s": from the first step's start to the last one's end, when facts report times. */
572
+ function duration(steps: readonly Step[], view: SessionView): string | undefined {
573
+ const times = steps.flatMap((step) => {
574
+ const observed = step.type === "tool" ? call(view, step.callId) : part(view, step.id ?? "");
575
+ if (observed?.startedAt === undefined) return [];
576
+ return [Date.parse(observed.startedAt), Date.parse(observed.endedAt ?? observed.startedAt)];
577
+ });
578
+ if (times.length === 0) return undefined;
579
+ const seconds = Math.round((Math.max(...times) - Math.min(...times)) / 1000);
580
+ if (seconds < 1) return undefined;
581
+ return seconds < 60 ? \` for \${seconds}s\` : \` for \${Math.floor(seconds / 60)}m \${seconds % 60}s\`;
582
+ }
583
+
584
+ /** How a call's line reads in each state: its status, and a word on why. */
585
+ const CALL_LINES: Record<
586
+ CallState,
587
+ { readonly status?: "running" | "error" | "pending"; readonly note?: string }
588
+ > = {
589
+ approval: { note: "Needs approval", status: "pending" },
590
+ blocked: { note: "Waiting for you", status: "running" },
591
+ cancelled: { note: "Stopped" },
592
+ completed: {},
593
+ failed: { note: "Failed", status: "error" },
594
+ rejected: { note: "Denied" },
595
+ requested: { status: "pending" },
596
+ running: { status: "running" },
597
+ };
598
+
599
+ function ToolLine({
600
+ part,
601
+ state,
602
+ }: {
603
+ readonly part: EveToolPart;
604
+ readonly state: CallState | undefined;
605
+ }) {
606
+ // A call the model is still writing has no row yet.
607
+ const { note, status } = state === undefined ? { status: "running" as const } : CALL_LINES[state];
608
+ // An answer waits on its approval until every approval asked with it is decided.
609
+ const answered =
610
+ state === "approval" && part.interaction?.answer !== undefined
611
+ ? "Response submitted"
612
+ : undefined;
613
+ const Icon = part.name === "bash" ? TerminalIcon : part.kind === "agent" ? BotIcon : WrenchIcon;
614
+ const line = (
615
+ <TraceLine status={status}>
616
+ <TraceIcon>
617
+ <Icon />
618
+ </TraceIcon>
619
+ <TraceTitle>{part.label}</TraceTitle>
620
+ {(answered ?? note) ? <TraceDescription>{answered ?? note}</TraceDescription> : null}
621
+ </TraceLine>
622
+ );
623
+ if (part.input === undefined && part.output === undefined && part.error === undefined)
624
+ return line;
625
+
626
+ return (
627
+ <TraceCollapsible>
628
+ <TraceCollapsibleTrigger>{line}</TraceCollapsibleTrigger>
629
+ <TraceCollapsibleContent className="space-y-2 text-foreground">
630
+ {part.name === "bash" ? (
631
+ <BashToolContent
632
+ errorText={part.error?.message}
633
+ input={part.input}
634
+ output={part.output}
635
+ />
636
+ ) : (
637
+ <>
638
+ {part.input === undefined ? null : <ToolInput input={part.input} />}
639
+ <ToolOutput errorText={part.error?.message} output={part.output} />
640
+ </>
641
+ )}
642
+ </TraceCollapsibleContent>
643
+ </TraceCollapsible>
644
+ );
645
+ }
646
+
647
+ function ReasoningLine({ part }: { readonly part: Extract<Step, { type: "reasoning" }> }) {
648
+ const [open, setOpen] = useState<boolean>();
649
+ const running = part.state === "streaming";
650
+ const line = (
651
+ <TraceLine status={running ? "running" : undefined}>
652
+ <TraceIcon>
653
+ <BrainIcon />
654
+ </TraceIcon>
655
+ <TraceTitle>{running ? "Thinking" : "Thought"}</TraceTitle>
656
+ </TraceLine>
657
+ );
658
+ if (part.text.length === 0) return line;
659
+
660
+ return (
661
+ <TraceCollapsible onOpenChange={setOpen} open={open ?? running}>
662
+ <TraceCollapsibleTrigger>{line}</TraceCollapsibleTrigger>
663
+ <TraceCollapsibleContent className="whitespace-pre-wrap">{part.text}</TraceCollapsibleContent>
664
+ </TraceCollapsible>
665
+ );
666
+ }
667
+
507
668
  function QuestionRequest({
508
669
  canRespond,
509
- inputRequest,
510
- inputResponse,
511
- onInputResponses,
670
+ interaction,
671
+ answer,
672
+ onAnswers,
512
673
  }: {
513
674
  readonly canRespond: boolean;
514
- readonly inputRequest: EveMessageInputRequest;
515
- readonly inputResponse?: AgentInputResponse;
516
- readonly onInputResponses: (responses: readonly AgentInputResponse[]) => void | Promise<void>;
675
+ readonly interaction: Interaction;
676
+ readonly answer?: AgentAnswer;
677
+ readonly onAnswers: (responses: readonly AgentAnswer[]) => void | Promise<void>;
517
678
  }) {
518
- const options = inputRequest.options ?? [];
519
- const acceptsFreeform = inputRequest.allowFreeform === true || options.length === 0;
520
- const disabled = !canRespond || inputResponse !== undefined;
679
+ const options = interaction.request.options ?? [];
680
+ const acceptsFreeform = interaction.request.allowFreeform === true || options.length === 0;
681
+ const disabled = !canRespond || answer !== undefined;
521
682
 
522
683
  const submitResponse = (event: FormEvent<HTMLFormElement>) => {
523
684
  event.preventDefault();
524
- const answer = new FormData(event.currentTarget).get(inputRequest.requestId);
525
- if (typeof answer !== "string") {
685
+ const value = new FormData(event.currentTarget).get(interaction.interactionId);
686
+ if (typeof value !== "string") {
526
687
  return;
527
688
  }
528
689
 
529
- const option = options.find(({ id }) => id === answer);
530
- void onInputResponses([
690
+ const option = options.find(({ id }) => id === value);
691
+ void onAnswers([
531
692
  option === undefined
532
- ? { requestId: inputRequest.requestId, text: answer.trim() }
533
- : { optionId: option.id, requestId: inputRequest.requestId },
693
+ ? { interactionId: interaction.interactionId, text: value.trim() }
694
+ : { optionId: option.id, interactionId: interaction.interactionId },
534
695
  ]);
535
696
  };
536
697
 
@@ -543,15 +704,15 @@ function QuestionRequest({
543
704
  onSubmit={submitResponse}
544
705
  shortcuts="numbers"
545
706
  >
546
- <QuestionnaireItem name={inputRequest.requestId} required>
707
+ <QuestionnaireItem name={interaction.interactionId} required>
547
708
  <QuestionnaireTitle className="text-sm font-medium">
548
- {inputRequest.prompt}
709
+ {interaction.request.prompt}
549
710
  </QuestionnaireTitle>
550
711
  <QuestionnaireChoices>
551
712
  {options.map((option) => (
552
713
  <QuestionnaireChoice
553
- className={cn(inputResponse?.optionId === option.id && "data-disabled:opacity-100")}
554
- defaultChecked={inputResponse?.optionId === option.id}
714
+ className={cn(answer?.optionId === option.id && "data-disabled:opacity-100")}
715
+ defaultChecked={answer?.optionId === option.id}
555
716
  disabled={disabled}
556
717
  key={option.id}
557
718
  value={option.id}
@@ -567,8 +728,8 @@ function QuestionRequest({
567
728
  {acceptsFreeform ? (
568
729
  <QuestionnaireInput
569
730
  aria-label="Answer"
570
- className={cn(inputResponse?.text !== undefined && "disabled:opacity-100")}
571
- defaultValue={inputResponse?.text}
731
+ className={cn(answer?.text !== undefined && "disabled:opacity-100")}
732
+ defaultValue={answer?.text}
572
733
  disabled={disabled}
573
734
  placeholder="Type your answer…"
574
735
  />
@@ -616,12 +777,43 @@ function AttachmentPart({ part }: { readonly part: EveFilePart }) {
616
777
  );
617
778
  }
618
779
 
619
- function AuthorizationPrompt({ part }: { readonly part: EveAuthorizationPart }) {
620
- const isAuthorized = part.state === "completed" && part.outcome === "authorized";
621
- const isCompleted = part.state === "completed";
780
+ /** An interaction no call carries: a sign-in, the budget prompt, or a question of its own. */
781
+ function InteractionPrompt({
782
+ asks,
783
+ part,
784
+ }: {
785
+ readonly asks: Asks;
786
+ readonly part: EveInteractionPart;
787
+ }) {
788
+ const { request } = part;
789
+ if (request.signIn !== undefined) return <SignInPrompt part={part} />;
790
+ if (request.kind === "question") {
791
+ return (
792
+ <QuestionRequest
793
+ answer={part.answer}
794
+ canRespond={asks.canRespond(part.interactionId)}
795
+ interaction={part}
796
+ onAnswers={asks.onAnswers}
797
+ />
798
+ );
799
+ }
800
+ return <InteractionActions answer={part.answer} asks={asks} interaction={part} />;
801
+ }
802
+
803
+ function SignInPrompt({ part }: { readonly part: EveInteractionPart }) {
804
+ const signIn = part.request.signIn;
805
+ const name = signIn?.displayName ?? signIn?.name ?? "the service";
806
+ const isAuthorized = part.outcome === "accepted";
807
+ const isCompleted = part.status === "settled";
622
808
  const Icon = isAuthorized ? CheckCircleIcon : isCompleted ? XCircleIcon : KeyRoundIcon;
623
- const instructions = part.authorization?.instructions;
624
- const shouldShowInstructions = instructions !== undefined && instructions !== part.description;
809
+ const instructions = signIn?.instructions;
810
+ const description = isCompleted
811
+ ? isAuthorized
812
+ ? \`\${name} connected.\`
813
+ : \`\${name} authorization \${signInEnding(part.outcome ?? "withdrawn")}\${
814
+ part.reason !== undefined ? \` (\${part.reason})\` : ""
815
+ }.\`
816
+ : part.request.prompt;
625
817
 
626
818
  return (
627
819
  <div
@@ -648,24 +840,30 @@ function AuthorizationPrompt({ part }: { readonly part: EveAuthorizationPart })
648
840
  <Icon className="size-4" />
649
841
  </span>
650
842
  <div className="min-w-0 flex-1 space-y-2">
651
- <p className="font-medium text-sm">{authorizationTitle(part)}</p>
652
- <p className="text-muted-foreground text-sm">{authorizationDescription(part)}</p>
653
- {shouldShowInstructions ? (
843
+ <p className="font-medium text-sm">
844
+ {isCompleted
845
+ ? isAuthorized
846
+ ? \`\${name} connected\`
847
+ : \`\${name} authorization \${signInEnding(part.outcome ?? "withdrawn")}\`
848
+ : \`Connect \${name}\`}
849
+ </p>
850
+ <p className="text-muted-foreground text-sm">{description}</p>
851
+ {!isCompleted && instructions !== undefined && instructions !== description ? (
654
852
  <p className="text-muted-foreground text-sm">{instructions}</p>
655
853
  ) : null}
656
- {part.state === "required" && part.authorization?.userCode ? (
854
+ {!isCompleted && signIn?.userCode ? (
657
855
  <div className="flex flex-wrap items-center gap-2 text-sm">
658
856
  <span className="text-muted-foreground">Code</span>
659
857
  <code className="rounded-md bg-background px-2 py-1 font-mono">
660
- {part.authorization.userCode}
858
+ {signIn.userCode}
661
859
  </code>
662
860
  </div>
663
861
  ) : null}
664
- {part.state === "required" && part.authorization?.url ? (
862
+ {!isCompleted && signIn?.url ? (
665
863
  <Button asChild size="sm">
666
- <a href={part.authorization.url} rel="noreferrer" target="_blank">
864
+ <a href={signIn.url} rel="noreferrer" target="_blank">
667
865
  <ExternalLinkIcon className="size-4" />
668
- Sign in with {part.displayName}
866
+ Sign in with {name}
669
867
  </a>
670
868
  </Button>
671
869
  ) : null}
@@ -675,40 +873,6 @@ function AuthorizationPrompt({ part }: { readonly part: EveAuthorizationPart })
675
873
  );
676
874
  }
677
875
 
678
- function authorizationTitle(part: EveAuthorizationPart): string {
679
- if (part.state === "required") {
680
- return \`Connect \${part.displayName}\`;
681
- }
682
- if (part.outcome === "authorized") {
683
- return \`\${part.displayName} connected\`;
684
- }
685
- return \`\${part.displayName} authorization \${formatAuthorizationOutcome(part.outcome)}\`;
686
- }
687
-
688
- function authorizationDescription(part: EveAuthorizationPart): string {
689
- if (part.state === "required") {
690
- return part.description;
691
- }
692
- if (part.outcome === "authorized") {
693
- return \`\${part.displayName} connected.\`;
694
- }
695
- const tail = part.reason !== undefined ? \` (\${part.reason})\` : "";
696
- return \`\${part.displayName} authorization \${formatAuthorizationOutcome(part.outcome)}\${tail}.\`;
697
- }
698
-
699
- function formatAuthorizationOutcome(outcome: NonNullable<EveAuthorizationPart["outcome"]>): string {
700
- switch (outcome) {
701
- case "authorized":
702
- return "authorized";
703
- case "declined":
704
- return "declined";
705
- case "failed":
706
- return "failed";
707
- case "timed-out":
708
- return "timed out";
709
- }
710
- }
711
-
712
876
  function formatBytes(size: number | undefined): string | undefined {
713
877
  if (size === undefined) {
714
878
  return undefined;
@@ -722,60 +886,46 @@ function formatBytes(size: number | undefined): string | undefined {
722
886
  return \`\${(size / (1024 * 1024)).toFixed(1)} MB\`;
723
887
  }
724
888
 
725
- function InputRequestActions({
726
- canRespond,
727
- onInputResponses,
728
- part,
889
+ /** An interaction's prompt with a button for each option, or how it was answered. */
890
+ function InteractionActions({
891
+ answer,
892
+ asks,
893
+ interaction,
729
894
  }: {
730
- readonly canRespond: (requestId: string) => boolean;
731
- readonly onInputResponses: (responses: readonly AgentInputResponse[]) => void | Promise<void>;
732
- readonly part: EveDynamicToolPart;
895
+ readonly answer?: AgentAnswer;
896
+ readonly asks: Asks;
897
+ readonly interaction: Interaction;
733
898
  }) {
734
- const inputRequest = part.toolMetadata?.eve?.inputRequest;
735
- if (!inputRequest) {
736
- return null;
737
- }
738
-
739
- const inputResponse = part.toolMetadata?.eve?.inputResponse;
740
- const selectedOption = inputRequest.options?.find(
741
- (option) => option.id === inputResponse?.optionId,
899
+ const selectedOption = interaction.request.options?.find(
900
+ (option) => option.id === answer?.optionId,
742
901
  );
743
- // An approval can settle before its batch resolves, without an input response.
744
- const settledApproval =
745
- part.approval?.approved === undefined
746
- ? undefined
747
- : part.approval.approved
748
- ? "Approved"
749
- : "Denied";
750
902
 
751
903
  return (
752
904
  <div className="space-y-3 rounded-md border border-yellow-500/30 bg-yellow-500/5 p-3">
753
- <p className="text-muted-foreground text-sm">{inputRequest.prompt}</p>
754
- {inputResponse || settledApproval ? (
905
+ <p className="text-muted-foreground text-sm">{interaction.request.prompt}</p>
906
+ {answer ? (
755
907
  <p className="font-medium text-sm">
756
- Responded:{" "}
757
- {selectedOption?.label ??
758
- inputResponse?.text ??
759
- inputResponse?.optionId ??
760
- settledApproval}
908
+ Responded: {selectedOption?.label ?? answer.text ?? answer.optionId}
761
909
  </p>
762
910
  ) : (
763
911
  <div className="flex flex-wrap gap-2">
764
- {inputRequest.options?.map((option) => (
912
+ {interaction.request.options?.map((option, index) => (
765
913
  <Button
766
- disabled={!canRespond(inputRequest.requestId)}
914
+ disabled={!asks.canRespond(interaction.interactionId)}
767
915
  key={option.id}
768
916
  onClick={() => {
769
- void onInputResponses([
917
+ void asks.onAnswers([
770
918
  {
771
919
  optionId: option.id,
772
- requestId: inputRequest.requestId,
920
+ interactionId: interaction.interactionId,
773
921
  },
774
922
  ]);
775
923
  }}
776
924
  size="sm"
777
925
  type="button"
778
- variant={option.style === "danger" ? "destructive" : "default"}
926
+ variant={
927
+ option.style === "danger" ? "destructive" : index === 0 ? "default" : "outline"
928
+ }
779
929
  >
780
930
  {option.label}
781
931
  </Button>
@@ -788,12 +938,10 @@ function InputRequestActions({
788
938
 
789
939
  function partKey(part: EveMessagePart, index: number): string {
790
940
  switch (part.type) {
791
- case "authorization":
792
- return part.attemptId === undefined
793
- ? \`authorization:\${part.turnId}:\${part.stepIndex}:\${part.name}\`
794
- : \`authorization:\${part.attemptId}\`;
795
- case "dynamic-tool":
796
- return part.toolCallId;
941
+ case "interaction":
942
+ return \`interaction:\${part.interactionId}\`;
943
+ case "tool":
944
+ return part.callId;
797
945
  case "reasoning":
798
946
  case "text":
799
947
  return \`\${part.type}:\${part.id ?? index}\`;
@@ -825,6 +973,7 @@ export default function AppleIcon() {
825
973
  `,"app/eve-agent.ts":`/** Named workspace agent selected by the Web Chat installer. */
826
974
  export const WEB_CHAT_AGENT: string | undefined = undefined;
827
975
  `,"app/globals.css":`@import "tailwindcss";
976
+ @import "tw-animate-css";
828
977
  @source "../node_modules/streamdown/dist/*.js";
829
978
 
830
979
  @theme inline {
@@ -928,6 +1077,94 @@ input,
928
1077
  textarea {
929
1078
  font: inherit;
930
1079
  }
1080
+
1081
+ /*
1082
+ * From shadcn/tailwind.css, for Trace: Radix marks open and closed parts with data-state, and a
1083
+ * running line's title shimmers.
1084
+ */
1085
+ @custom-variant data-open {
1086
+ &:where([data-state="open"]),
1087
+ &:where([data-open]:not([data-open="false"])) {
1088
+ @slot;
1089
+ }
1090
+ }
1091
+
1092
+ @custom-variant data-closed {
1093
+ &:where([data-state="closed"]),
1094
+ &:where([data-closed]:not([data-closed="false"])) {
1095
+ @slot;
1096
+ }
1097
+ }
1098
+
1099
+ @property --shimmer-angle {
1100
+ syntax: "<angle>";
1101
+ inherits: true;
1102
+ initial-value: 20deg;
1103
+ }
1104
+
1105
+ @property --shimmer-image {
1106
+ syntax: "*";
1107
+ inherits: false;
1108
+ }
1109
+
1110
+ @property --shimmer-text-fill {
1111
+ syntax: "*";
1112
+ inherits: false;
1113
+ }
1114
+
1115
+ @theme inline {
1116
+ @keyframes tw-shimmer {
1117
+ from {
1118
+ background-position: 100% 0;
1119
+ }
1120
+ to {
1121
+ background-position: 0 0;
1122
+ }
1123
+ }
1124
+ }
1125
+
1126
+ @utility shimmer {
1127
+ --_spread: var(--shimmer-spread, calc(3ch + 40px));
1128
+ --_base: currentColor;
1129
+ --_highlight: var(--shimmer-color, oklch(from currentColor l c h / calc(alpha * 0.2)));
1130
+
1131
+ background-image: var(
1132
+ --shimmer-image,
1133
+ linear-gradient(
1134
+ calc(90deg + var(--shimmer-angle)),
1135
+ var(--_base) calc(50% - var(--_spread)),
1136
+ color-mix(in oklch, var(--_highlight), var(--_base) 50%) calc(50% - var(--_spread) * 0.5),
1137
+ var(--_highlight) 50%,
1138
+ color-mix(in oklch, var(--_highlight), var(--_base) 50%) calc(50% + var(--_spread) * 0.5),
1139
+ var(--_base) calc(50% + var(--_spread))
1140
+ )
1141
+ );
1142
+ background-repeat: no-repeat;
1143
+ background-size: calc(200% + var(--_spread) * 2) 100%;
1144
+ background-position: 0 0;
1145
+ background-clip: text;
1146
+ -webkit-background-clip: text;
1147
+ -webkit-text-fill-color: var(--shimmer-text-fill, transparent);
1148
+ animation: tw-shimmer var(--shimmer-duration, 2s) linear infinite;
1149
+
1150
+ @variant dark {
1151
+ --_highlight: var(
1152
+ --shimmer-color,
1153
+ oklch(from currentColor max(0.8, calc(l + 0.4)) c h / calc(alpha + 0.4))
1154
+ );
1155
+ }
1156
+
1157
+ @media (prefers-reduced-motion: reduce) {
1158
+ animation: none;
1159
+ background-image: none;
1160
+ -webkit-text-fill-color: currentColor;
1161
+ }
1162
+ }
1163
+
1164
+ @utility shimmer-none {
1165
+ --shimmer-image: none;
1166
+ --shimmer-text-fill: currentColor;
1167
+ }
931
1168
  `,"app/icon.svg":`<svg width="102" height="102" viewBox="0 0 102 102" fill="none" xmlns="http://www.w3.org/2000/svg">
932
1169
  <path fill="#000" d="M0 0h102v102H0z" />
933
1170
  <path
@@ -990,203 +1227,6 @@ export default async function SessionPage({
990
1227
  export default function NewSessionPage() {
991
1228
  return <AgentChat sessionless />;
992
1229
  }
993
- `,"components/ai-elements/chain-of-thought.tsx":`"use client";
994
-
995
- import { useControllableState } from "@radix-ui/react-use-controllable-state";
996
- import { Badge } from "@/components/ui/badge";
997
- import { Collapsible, CollapsibleContent, CollapsibleTrigger } from "@/components/ui/collapsible";
998
- import { cn } from "@/lib/utils";
999
- import type { LucideIcon } from "lucide-react";
1000
- import { BrainIcon, ChevronDownIcon, DotIcon } from "lucide-react";
1001
- import type { ComponentProps, ReactNode } from "react";
1002
- import { createContext, memo, useContext, useMemo } from "react";
1003
-
1004
- interface ChainOfThoughtContextValue {
1005
- isOpen: boolean;
1006
- setIsOpen: (open: boolean) => void;
1007
- }
1008
-
1009
- const ChainOfThoughtContext = createContext<ChainOfThoughtContextValue | null>(null);
1010
-
1011
- const useChainOfThought = () => {
1012
- const context = useContext(ChainOfThoughtContext);
1013
- if (!context) {
1014
- throw new Error("ChainOfThought components must be used within ChainOfThought");
1015
- }
1016
- return context;
1017
- };
1018
-
1019
- export type ChainOfThoughtProps = ComponentProps<"div"> & {
1020
- open?: boolean;
1021
- defaultOpen?: boolean;
1022
- onOpenChange?: (open: boolean) => void;
1023
- };
1024
-
1025
- export const ChainOfThought = memo(
1026
- ({
1027
- className,
1028
- open,
1029
- defaultOpen = false,
1030
- onOpenChange,
1031
- children,
1032
- ...props
1033
- }: ChainOfThoughtProps) => {
1034
- const [isOpen, setIsOpen] = useControllableState({
1035
- defaultProp: defaultOpen,
1036
- onChange: onOpenChange,
1037
- prop: open,
1038
- });
1039
-
1040
- const chainOfThoughtContext = useMemo(() => ({ isOpen, setIsOpen }), [isOpen, setIsOpen]);
1041
-
1042
- return (
1043
- <ChainOfThoughtContext.Provider value={chainOfThoughtContext}>
1044
- <div className={cn("not-prose w-full space-y-4", className)} {...props}>
1045
- {children}
1046
- </div>
1047
- </ChainOfThoughtContext.Provider>
1048
- );
1049
- },
1050
- );
1051
-
1052
- export type ChainOfThoughtHeaderProps = ComponentProps<typeof CollapsibleTrigger>;
1053
-
1054
- export const ChainOfThoughtHeader = memo(
1055
- ({ className, children, ...props }: ChainOfThoughtHeaderProps) => {
1056
- const { isOpen, setIsOpen } = useChainOfThought();
1057
-
1058
- return (
1059
- <Collapsible onOpenChange={setIsOpen} open={isOpen}>
1060
- <CollapsibleTrigger
1061
- className={cn(
1062
- "flex w-full items-center gap-2 text-muted-foreground text-sm transition-colors hover:text-foreground",
1063
- className,
1064
- )}
1065
- {...props}
1066
- >
1067
- <BrainIcon className="size-4" />
1068
- <span className="flex-1 text-left">{children ?? "Chain of Thought"}</span>
1069
- <ChevronDownIcon
1070
- className={cn("size-4 transition-transform", isOpen ? "rotate-180" : "rotate-0")}
1071
- />
1072
- </CollapsibleTrigger>
1073
- </Collapsible>
1074
- );
1075
- },
1076
- );
1077
-
1078
- export type ChainOfThoughtStepProps = ComponentProps<"div"> & {
1079
- icon?: LucideIcon;
1080
- label: ReactNode;
1081
- description?: ReactNode;
1082
- status?: "complete" | "active" | "pending";
1083
- };
1084
-
1085
- const stepStatusStyles = {
1086
- active: "text-foreground",
1087
- complete: "text-muted-foreground",
1088
- pending: "text-muted-foreground/50",
1089
- };
1090
-
1091
- export const ChainOfThoughtStep = memo(
1092
- ({
1093
- className,
1094
- icon: Icon = DotIcon,
1095
- label,
1096
- description,
1097
- status = "complete",
1098
- children,
1099
- ...props
1100
- }: ChainOfThoughtStepProps) => (
1101
- <div
1102
- className={cn(
1103
- "flex gap-2 text-sm",
1104
- stepStatusStyles[status],
1105
- "fade-in-0 slide-in-from-top-2 animate-in",
1106
- className,
1107
- )}
1108
- {...props}
1109
- >
1110
- <div className="relative mt-0.5">
1111
- <Icon className="size-4" />
1112
- <div className="absolute top-7 bottom-0 left-1/2 -mx-px w-px bg-border" />
1113
- </div>
1114
- <div className="flex-1 space-y-2 overflow-hidden">
1115
- <div>{label}</div>
1116
- {description && <div className="text-muted-foreground text-xs">{description}</div>}
1117
- {children}
1118
- </div>
1119
- </div>
1120
- ),
1121
- );
1122
-
1123
- export type ChainOfThoughtSearchResultsProps = ComponentProps<"div">;
1124
-
1125
- export const ChainOfThoughtSearchResults = memo(
1126
- ({ className, ...props }: ChainOfThoughtSearchResultsProps) => (
1127
- <div className={cn("flex flex-wrap items-center gap-2", className)} {...props} />
1128
- ),
1129
- );
1130
-
1131
- export type ChainOfThoughtSearchResultProps = ComponentProps<typeof Badge>;
1132
-
1133
- export const ChainOfThoughtSearchResult = memo(
1134
- ({ className, children, ...props }: ChainOfThoughtSearchResultProps) => (
1135
- <Badge
1136
- className={cn("gap-1 px-2 py-0.5 font-normal text-xs", className)}
1137
- variant="secondary"
1138
- {...props}
1139
- >
1140
- {children}
1141
- </Badge>
1142
- ),
1143
- );
1144
-
1145
- export type ChainOfThoughtContentProps = ComponentProps<typeof CollapsibleContent>;
1146
-
1147
- export const ChainOfThoughtContent = memo(
1148
- ({ className, children, ...props }: ChainOfThoughtContentProps) => {
1149
- const { isOpen } = useChainOfThought();
1150
-
1151
- return (
1152
- <Collapsible open={isOpen}>
1153
- <CollapsibleContent
1154
- className={cn(
1155
- "mt-2 space-y-3",
1156
- "data-[state=closed]:fade-out-0 data-[state=closed]:slide-out-to-top-2 data-[state=open]:slide-in-from-top-2 text-popover-foreground outline-none data-[state=closed]:animate-out data-[state=open]:animate-in",
1157
- className,
1158
- )}
1159
- {...props}
1160
- >
1161
- {children}
1162
- </CollapsibleContent>
1163
- </Collapsible>
1164
- );
1165
- },
1166
- );
1167
-
1168
- export type ChainOfThoughtImageProps = ComponentProps<"div"> & {
1169
- caption?: string;
1170
- };
1171
-
1172
- export const ChainOfThoughtImage = memo(
1173
- ({ className, children, caption, ...props }: ChainOfThoughtImageProps) => (
1174
- <div className={cn("mt-2 space-y-2", className)} {...props}>
1175
- <div className="relative flex max-h-[22rem] items-center justify-center overflow-hidden rounded-lg bg-muted p-3">
1176
- {children}
1177
- </div>
1178
- {caption && <p className="text-muted-foreground text-xs">{caption}</p>}
1179
- </div>
1180
- ),
1181
- );
1182
-
1183
- ChainOfThought.displayName = "ChainOfThought";
1184
- ChainOfThoughtHeader.displayName = "ChainOfThoughtHeader";
1185
- ChainOfThoughtStep.displayName = "ChainOfThoughtStep";
1186
- ChainOfThoughtSearchResults.displayName = "ChainOfThoughtSearchResults";
1187
- ChainOfThoughtSearchResult.displayName = "ChainOfThoughtSearchResult";
1188
- ChainOfThoughtContent.displayName = "ChainOfThoughtContent";
1189
- ChainOfThoughtImage.displayName = "ChainOfThoughtImage";
1190
1230
  `,"components/ai-elements/code-block.tsx":`"use client";
1191
1231
 
1192
1232
  import { Button } from "@/components/ui/button";
@@ -2303,54 +2343,20 @@ export const MessageToolbar = ({ className, children, ...props }: MessageToolbar
2303
2343
  );
2304
2344
  `,"components/ai-elements/prompt-input.tsx":`"use client";
2305
2345
 
2306
- import {
2307
- Command,
2308
- CommandEmpty,
2309
- CommandGroup,
2310
- CommandInput,
2311
- CommandItem,
2312
- CommandList,
2313
- CommandSeparator,
2314
- } from "@/components/ui/command";
2315
- import {
2316
- DropdownMenu,
2317
- DropdownMenuContent,
2318
- DropdownMenuItem,
2319
- DropdownMenuTrigger,
2320
- } from "@/components/ui/dropdown-menu";
2321
- import { HoverCard, HoverCardContent, HoverCardTrigger } from "@/components/ui/hover-card";
2322
- import {
2323
- InputGroup,
2324
- InputGroupAddon,
2325
- InputGroupButton,
2326
- InputGroupTextarea,
2327
- } from "@/components/ui/input-group";
2328
- import {
2329
- Select,
2330
- SelectContent,
2331
- SelectItem,
2332
- SelectTrigger,
2333
- SelectValue,
2334
- } from "@/components/ui/select";
2335
- import { Spinner } from "@/components/ui/spinner";
2336
- import { Tooltip, TooltipContent, TooltipTrigger } from "@/components/ui/tooltip";
2337
- import { cn } from "@/lib/utils";
2338
- import type { ChatStatus, FileUIPart, SourceDocumentUIPart } from "ai";
2339
- import { ArrowUpIcon, ImageIcon, Monitor, PlusIcon, XIcon } from "lucide-react";
2340
- import { nanoid } from "nanoid";
2341
- import type {
2342
- ChangeEvent,
2343
- ChangeEventHandler,
2344
- ClipboardEventHandler,
2345
- ComponentProps,
2346
- FormEvent,
2347
- FormEventHandler,
2348
- HTMLAttributes,
2349
- KeyboardEventHandler,
2350
- PropsWithChildren,
2351
- ReactNode,
2352
- RefObject,
2353
- } from "react";
2346
+ import { InputGroup, InputGroupButton, InputGroupTextarea } from "@/components/ui/input-group";
2347
+ import { cn } from "@/lib/utils";
2348
+ import type { FileUIPart } from "ai";
2349
+ import { ArrowUpIcon } from "lucide-react";
2350
+ import { nanoid } from "nanoid";
2351
+ import type {
2352
+ ChangeEventHandler,
2353
+ ClipboardEventHandler,
2354
+ ComponentProps,
2355
+ FormEvent,
2356
+ FormEventHandler,
2357
+ HTMLAttributes,
2358
+ KeyboardEventHandler,
2359
+ } from "react";
2354
2360
  import {
2355
2361
  Children,
2356
2362
  createContext,
@@ -2362,15 +2368,10 @@ import {
2362
2368
  useState,
2363
2369
  } from "react";
2364
2370
 
2365
- // ============================================================================
2366
- // Helpers
2367
- // ============================================================================
2368
-
2369
2371
  const convertBlobUrlToDataUrl = async (url: string): Promise<string | null> => {
2370
2372
  try {
2371
2373
  const response = await fetch(url);
2372
2374
  const blob = await response.blob();
2373
- // FileReader uses callback-based API, wrapping in Promise is necessary
2374
2375
  // oxlint-disable-next-line eslint-plugin-promise(avoid-new)
2375
2376
  return new Promise((resolve) => {
2376
2377
  const reader = new FileReader();
@@ -2385,387 +2386,32 @@ const convertBlobUrlToDataUrl = async (url: string): Promise<string | null> => {
2385
2386
  }
2386
2387
  };
2387
2388
 
2388
- const captureScreenshot = async (): Promise<File | null> => {
2389
- if (typeof navigator === "undefined" || !navigator.mediaDevices?.getDisplayMedia) {
2390
- return null;
2391
- }
2392
-
2393
- let stream: MediaStream | null = null;
2394
- const video = document.createElement("video");
2395
- video.muted = true;
2396
- video.playsInline = true;
2397
-
2398
- try {
2399
- stream = await navigator.mediaDevices.getDisplayMedia({
2400
- audio: false,
2401
- video: true,
2402
- });
2403
-
2404
- video.srcObject = stream;
2405
-
2406
- // Video element uses callback-based API, wrapping in Promise is necessary
2407
- // oxlint-disable-next-line eslint-plugin-promise(avoid-new)
2408
- await new Promise<void>((resolve, reject) => {
2409
- // oxlint-disable-next-line eslint-plugin-unicorn(prefer-add-event-listener)
2410
- video.onloadedmetadata = () => resolve();
2411
- // oxlint-disable-next-line eslint-plugin-unicorn(prefer-add-event-listener)
2412
- video.onerror = () => reject(new Error("Failed to load screen stream"));
2413
- });
2414
-
2415
- await video.play();
2416
-
2417
- const width = video.videoWidth;
2418
- const height = video.videoHeight;
2419
- if (!width || !height) {
2420
- return null;
2421
- }
2422
-
2423
- const canvas = document.createElement("canvas");
2424
- canvas.width = width;
2425
- canvas.height = height;
2426
- const context = canvas.getContext("2d");
2427
- if (!context) {
2428
- return null;
2429
- }
2430
-
2431
- context.drawImage(video, 0, 0, width, height);
2432
- // canvas.toBlob uses callback-based API, wrapping in Promise is necessary
2433
- // oxlint-disable-next-line eslint-plugin-promise(avoid-new)
2434
- const blob = await new Promise<Blob | null>((resolve) => {
2435
- canvas.toBlob(resolve, "image/png");
2436
- });
2437
- if (!blob) {
2438
- return null;
2439
- }
2440
-
2441
- const timestamp = new Date()
2442
- .toISOString()
2443
- .replaceAll(/[:.]/g, "-")
2444
- .replace("T", "_")
2445
- .replace("Z", "");
2446
-
2447
- return new File([blob], \`screenshot-\${timestamp}.png\`, {
2448
- lastModified: Date.now(),
2449
- type: "image/png",
2450
- });
2451
- } finally {
2452
- if (stream) {
2453
- for (const track of stream.getTracks()) {
2454
- track.stop();
2455
- }
2456
- }
2457
- video.pause();
2458
- video.srcObject = null;
2459
- }
2460
- };
2461
-
2462
- // ============================================================================
2463
- // Provider Context & Types
2464
- // ============================================================================
2465
-
2466
- export interface AttachmentsContext {
2389
+ interface AttachmentsContext {
2467
2390
  files: (FileUIPart & { id: string })[];
2468
2391
  add: (files: File[] | FileList) => void;
2469
2392
  remove: (id: string) => void;
2470
2393
  clear: () => void;
2471
- openFileDialog: () => void;
2472
- fileInputRef: RefObject<HTMLInputElement | null>;
2473
- }
2474
-
2475
- export interface TextInputContext {
2476
- value: string;
2477
- setInput: (v: string) => void;
2478
- clear: () => void;
2479
- }
2480
-
2481
- export interface PromptInputControllerProps {
2482
- textInput: TextInputContext;
2483
- attachments: AttachmentsContext;
2484
- /** INTERNAL: Allows PromptInput to register its file textInput + "open" callback */
2485
- __registerFileInput: (ref: RefObject<HTMLInputElement | null>, open: () => void) => void;
2486
2394
  }
2487
2395
 
2488
- const PromptInputController = createContext<PromptInputControllerProps | null>(null);
2489
- const ProviderAttachmentsContext = createContext<AttachmentsContext | null>(null);
2490
-
2491
- export const usePromptInputController = () => {
2492
- const ctx = useContext(PromptInputController);
2493
- if (!ctx) {
2494
- throw new Error(
2495
- "Wrap your component inside <PromptInputProvider> to use usePromptInputController().",
2496
- );
2497
- }
2498
- return ctx;
2499
- };
2500
-
2501
- // Optional variants (do NOT throw). Useful for dual-mode components.
2502
- const useOptionalPromptInputController = () => useContext(PromptInputController);
2503
-
2504
- export const useProviderAttachments = () => {
2505
- const ctx = useContext(ProviderAttachmentsContext);
2506
- if (!ctx) {
2507
- throw new Error(
2508
- "Wrap your component inside <PromptInputProvider> to use useProviderAttachments().",
2509
- );
2510
- }
2511
- return ctx;
2512
- };
2513
-
2514
- const useOptionalProviderAttachments = () => useContext(ProviderAttachmentsContext);
2515
-
2516
- export type PromptInputProviderProps = PropsWithChildren<{
2517
- initialInput?: string;
2518
- }>;
2519
-
2520
- /**
2521
- * Optional global provider that lifts PromptInput state outside of PromptInput.
2522
- * If you don't use it, PromptInput stays fully self-managed.
2523
- */
2524
- export const PromptInputProvider = ({
2525
- initialInput: initialTextInput = "",
2526
- children,
2527
- }: PromptInputProviderProps) => {
2528
- // ----- textInput state
2529
- const [textInput, setTextInput] = useState(initialTextInput);
2530
- const clearInput = useCallback(() => setTextInput(""), []);
2531
-
2532
- // ----- attachments state (global when wrapped)
2533
- const [attachmentFiles, setAttachmentFiles] = useState<(FileUIPart & { id: string })[]>([]);
2534
- const fileInputRef = useRef<HTMLInputElement | null>(null);
2535
- // oxlint-disable-next-line eslint(no-empty-function)
2536
- const openRef = useRef<() => void>(() => {});
2537
-
2538
- const add = useCallback((files: File[] | FileList) => {
2539
- const incoming = [...files];
2540
- if (incoming.length === 0) {
2541
- return;
2542
- }
2543
-
2544
- setAttachmentFiles((prev) => [
2545
- ...prev,
2546
- ...incoming.map((file) => ({
2547
- filename: file.name,
2548
- id: nanoid(),
2549
- mediaType: file.type,
2550
- type: "file" as const,
2551
- url: URL.createObjectURL(file),
2552
- })),
2553
- ]);
2554
- }, []);
2555
-
2556
- const remove = useCallback((id: string) => {
2557
- setAttachmentFiles((prev) => {
2558
- const found = prev.find((f) => f.id === id);
2559
- if (found?.url) {
2560
- URL.revokeObjectURL(found.url);
2561
- }
2562
- return prev.filter((f) => f.id !== id);
2563
- });
2564
- }, []);
2565
-
2566
- const clear = useCallback(() => {
2567
- setAttachmentFiles((prev) => {
2568
- for (const f of prev) {
2569
- if (f.url) {
2570
- URL.revokeObjectURL(f.url);
2571
- }
2572
- }
2573
- return [];
2574
- });
2575
- }, []);
2576
-
2577
- // Keep a ref to attachments for cleanup on unmount (avoids stale closure)
2578
- const attachmentsRef = useRef(attachmentFiles);
2579
-
2580
- useEffect(() => {
2581
- attachmentsRef.current = attachmentFiles;
2582
- }, [attachmentFiles]);
2583
-
2584
- // Cleanup blob URLs on unmount to prevent memory leaks
2585
- useEffect(
2586
- () => () => {
2587
- for (const f of attachmentsRef.current) {
2588
- if (f.url) {
2589
- URL.revokeObjectURL(f.url);
2590
- }
2591
- }
2592
- },
2593
- [],
2594
- );
2595
-
2596
- const openFileDialog = useCallback(() => {
2597
- openRef.current?.();
2598
- }, []);
2599
-
2600
- const attachments = useMemo<AttachmentsContext>(
2601
- () => ({
2602
- add,
2603
- clear,
2604
- fileInputRef,
2605
- files: attachmentFiles,
2606
- openFileDialog,
2607
- remove,
2608
- }),
2609
- [attachmentFiles, add, remove, clear, openFileDialog],
2610
- );
2611
-
2612
- const __registerFileInput = useCallback(
2613
- (ref: RefObject<HTMLInputElement | null>, open: () => void) => {
2614
- fileInputRef.current = ref.current;
2615
- openRef.current = open;
2616
- },
2617
- [],
2618
- );
2619
-
2620
- const controller = useMemo<PromptInputControllerProps>(
2621
- () => ({
2622
- __registerFileInput,
2623
- attachments,
2624
- textInput: {
2625
- clear: clearInput,
2626
- setInput: setTextInput,
2627
- value: textInput,
2628
- },
2629
- }),
2630
- [textInput, clearInput, attachments, __registerFileInput],
2631
- );
2632
-
2633
- return (
2634
- <PromptInputController.Provider value={controller}>
2635
- <ProviderAttachmentsContext.Provider value={attachments}>
2636
- {children}
2637
- </ProviderAttachmentsContext.Provider>
2638
- </PromptInputController.Provider>
2639
- );
2640
- };
2641
-
2642
- // ============================================================================
2643
- // Component Context & Hooks
2644
- // ============================================================================
2645
-
2646
2396
  const LocalAttachmentsContext = createContext<AttachmentsContext | null>(null);
2647
2397
 
2648
2398
  export const usePromptInputAttachments = () => {
2649
- // Prefer local context (inside PromptInput) as it has validation, fall back to provider
2650
- const provider = useOptionalProviderAttachments();
2651
- const local = useContext(LocalAttachmentsContext);
2652
- const context = local ?? provider;
2399
+ const context = useContext(LocalAttachmentsContext);
2653
2400
  if (!context) {
2654
- throw new Error(
2655
- "usePromptInputAttachments must be used within a PromptInput or PromptInputProvider",
2656
- );
2401
+ throw new Error("usePromptInputAttachments must be used within a PromptInput");
2657
2402
  }
2658
2403
  return context;
2659
2404
  };
2660
2405
 
2661
- // ============================================================================
2662
- // Referenced Sources (Local to PromptInput)
2663
- // ============================================================================
2664
-
2665
- export interface ReferencedSourcesContext {
2666
- sources: (SourceDocumentUIPart & { id: string })[];
2667
- add: (sources: SourceDocumentUIPart[] | SourceDocumentUIPart) => void;
2668
- remove: (id: string) => void;
2669
- clear: () => void;
2670
- }
2671
-
2672
- export const LocalReferencedSourcesContext = createContext<ReferencedSourcesContext | null>(null);
2673
-
2674
- export const usePromptInputReferencedSources = () => {
2675
- const ctx = useContext(LocalReferencedSourcesContext);
2676
- if (!ctx) {
2677
- throw new Error(
2678
- "usePromptInputReferencedSources must be used within a LocalReferencedSourcesContext.Provider",
2679
- );
2680
- }
2681
- return ctx;
2682
- };
2683
-
2684
- export type PromptInputActionAddAttachmentsProps = ComponentProps<typeof DropdownMenuItem> & {
2685
- label?: string;
2686
- };
2687
-
2688
- export const PromptInputActionAddAttachments = ({
2689
- label = "Add photos or files",
2690
- ...props
2691
- }: PromptInputActionAddAttachmentsProps) => {
2692
- const attachments = usePromptInputAttachments();
2693
-
2694
- const handleSelect = useCallback(
2695
- (e: Event) => {
2696
- e.preventDefault();
2697
- attachments.openFileDialog();
2698
- },
2699
- [attachments],
2700
- );
2701
-
2702
- return (
2703
- <DropdownMenuItem {...props} onSelect={handleSelect}>
2704
- <ImageIcon className="mr-2 size-4" /> {label}
2705
- </DropdownMenuItem>
2706
- );
2707
- };
2708
-
2709
- export type PromptInputActionAddScreenshotProps = ComponentProps<typeof DropdownMenuItem> & {
2710
- label?: string;
2711
- };
2712
-
2713
- export const PromptInputActionAddScreenshot = ({
2714
- label = "Take screenshot",
2715
- onSelect,
2716
- ...props
2717
- }: PromptInputActionAddScreenshotProps) => {
2718
- const attachments = usePromptInputAttachments();
2719
-
2720
- const handleSelect = useCallback(
2721
- async (event: Event) => {
2722
- onSelect?.(event);
2723
- if (event.defaultPrevented) {
2724
- return;
2725
- }
2726
-
2727
- try {
2728
- const screenshot = await captureScreenshot();
2729
- if (screenshot) {
2730
- attachments.add([screenshot]);
2731
- }
2732
- } catch (error) {
2733
- if (
2734
- error instanceof DOMException &&
2735
- (error.name === "NotAllowedError" || error.name === "AbortError")
2736
- ) {
2737
- return;
2738
- }
2739
- throw error;
2740
- }
2741
- },
2742
- [onSelect, attachments],
2743
- );
2744
-
2745
- return (
2746
- <DropdownMenuItem {...props} onSelect={handleSelect}>
2747
- <Monitor className="mr-2 size-4" />
2748
- {label}
2749
- </DropdownMenuItem>
2750
- );
2751
- };
2752
-
2753
2406
  export interface PromptInputMessage {
2754
2407
  text: string;
2755
2408
  files: FileUIPart[];
2756
2409
  }
2757
2410
 
2758
- export type PromptInputProps = Omit<HTMLAttributes<HTMLFormElement>, "onSubmit" | "onError"> & {
2759
- // e.g., "image/*" or leave undefined for any
2411
+ type PromptInputProps = Omit<HTMLAttributes<HTMLFormElement>, "onSubmit" | "onError"> & {
2760
2412
  accept?: string;
2761
2413
  multiple?: boolean;
2762
- // When true, accepts drops anywhere on document. Default false (opt-in).
2763
- globalDrop?: boolean;
2764
- // Render a hidden input with given name and keep it in sync for native form posts. Default false.
2765
- syncHiddenInput?: boolean;
2766
- // Minimal constraints
2767
2414
  maxFiles?: number;
2768
- // bytes
2769
2415
  maxFileSize?: number;
2770
2416
  onError?: (err: { code: "max_files" | "max_file_size" | "accept"; message: string }) => void;
2771
2417
  onSubmit: (
@@ -2778,8 +2424,6 @@ export const PromptInput = ({
2778
2424
  className,
2779
2425
  accept,
2780
2426
  multiple,
2781
- globalDrop,
2782
- syncHiddenInput,
2783
2427
  maxFiles,
2784
2428
  maxFileSize,
2785
2429
  onError,
@@ -2787,223 +2431,94 @@ export const PromptInput = ({
2787
2431
  children,
2788
2432
  ...props
2789
2433
  }: PromptInputProps) => {
2790
- // Try to use a provider controller if present
2791
- const controller = useOptionalPromptInputController();
2792
- const usingProvider = !!controller;
2793
-
2794
- // Refs
2795
- const inputRef = useRef<HTMLInputElement | null>(null);
2796
2434
  const formRef = useRef<HTMLFormElement | null>(null);
2797
-
2798
- // ----- Local attachments (only used when no provider)
2799
- const [items, setItems] = useState<(FileUIPart & { id: string })[]>([]);
2800
- const files = usingProvider ? controller.attachments.files : items;
2801
-
2802
- // ----- Local referenced sources (always local to PromptInput)
2803
- const [referencedSources, setReferencedSources] = useState<
2804
- (SourceDocumentUIPart & { id: string })[]
2805
- >([]);
2806
-
2807
- // Keep a ref to files for cleanup on unmount (avoids stale closure)
2435
+ const [files, setFiles] = useState<(FileUIPart & { id: string })[]>([]);
2808
2436
  const filesRef = useRef(files);
2809
2437
 
2810
2438
  useEffect(() => {
2811
2439
  filesRef.current = files;
2812
2440
  }, [files]);
2813
2441
 
2814
- const openFileDialogLocal = useCallback(() => {
2815
- inputRef.current?.click();
2816
- }, []);
2817
-
2818
2442
  const matchesAccept = useCallback(
2819
- (f: File) => {
2820
- if (!accept || accept.trim() === "") {
2821
- return true;
2822
- }
2823
-
2443
+ (file: File) => {
2444
+ if (!accept || accept.trim() === "") return true;
2824
2445
  const patterns = accept
2825
2446
  .split(",")
2826
2447
  .map((s) => s.trim())
2827
2448
  .filter(Boolean);
2828
-
2829
- return patterns.some((pattern) => {
2830
- if (pattern.endsWith("/*")) {
2831
- // e.g: image/* -> image/
2832
- const prefix = pattern.slice(0, -1);
2833
- return f.type.startsWith(prefix);
2834
- }
2835
- return f.type === pattern;
2836
- });
2449
+ return patterns.some((pattern) =>
2450
+ pattern.endsWith("/*") ? file.type.startsWith(pattern.slice(0, -1)) : file.type === pattern,
2451
+ );
2837
2452
  },
2838
2453
  [accept],
2839
2454
  );
2840
2455
 
2841
- const addLocal = useCallback(
2456
+ const add = useCallback(
2842
2457
  (fileList: File[] | FileList) => {
2843
2458
  const incoming = [...fileList];
2844
- const accepted = incoming.filter((f) => matchesAccept(f));
2459
+ const accepted = incoming.filter(matchesAccept);
2845
2460
  if (incoming.length && accepted.length === 0) {
2846
- onError?.({
2847
- code: "accept",
2848
- message: "No files match the accepted types.",
2849
- });
2461
+ onError?.({ code: "accept", message: "No files match the accepted types." });
2850
2462
  return;
2851
2463
  }
2852
- const withinSize = (f: File) => (maxFileSize ? f.size <= maxFileSize : true);
2853
- const sized = accepted.filter(withinSize);
2464
+ const sized = accepted.filter((file) => (maxFileSize ? file.size <= maxFileSize : true));
2854
2465
  if (accepted.length > 0 && sized.length === 0) {
2855
- onError?.({
2856
- code: "max_file_size",
2857
- message: "All files exceed the maximum size.",
2858
- });
2466
+ onError?.({ code: "max_file_size", message: "All files exceed the maximum size." });
2859
2467
  return;
2860
2468
  }
2861
-
2862
- setItems((prev) => {
2469
+ setFiles((prev) => {
2863
2470
  const capacity =
2864
2471
  typeof maxFiles === "number" ? Math.max(0, maxFiles - prev.length) : undefined;
2865
2472
  const capped = typeof capacity === "number" ? sized.slice(0, capacity) : sized;
2866
2473
  if (typeof capacity === "number" && sized.length > capacity) {
2867
- onError?.({
2868
- code: "max_files",
2869
- message: "Too many files. Some were not added.",
2870
- });
2474
+ onError?.({ code: "max_files", message: "Too many files. Some were not added." });
2871
2475
  }
2872
- const next: (FileUIPart & { id: string })[] = [];
2873
- for (const file of capped) {
2874
- next.push({
2476
+ return [
2477
+ ...prev,
2478
+ ...capped.map((file) => ({
2875
2479
  filename: file.name,
2876
2480
  id: nanoid(),
2877
2481
  mediaType: file.type,
2878
- type: "file",
2482
+ type: "file" as const,
2879
2483
  url: URL.createObjectURL(file),
2880
- });
2881
- }
2882
- return [...prev, ...next];
2484
+ })),
2485
+ ];
2883
2486
  });
2884
2487
  },
2885
2488
  [matchesAccept, maxFiles, maxFileSize, onError],
2886
2489
  );
2887
2490
 
2888
- const removeLocal = useCallback(
2491
+ const remove = useCallback(
2889
2492
  (id: string) =>
2890
- setItems((prev) => {
2493
+ setFiles((prev) => {
2891
2494
  const found = prev.find((file) => file.id === id);
2892
- if (found?.url) {
2893
- URL.revokeObjectURL(found.url);
2894
- }
2495
+ if (found?.url) URL.revokeObjectURL(found.url);
2895
2496
  return prev.filter((file) => file.id !== id);
2896
2497
  }),
2897
2498
  [],
2898
2499
  );
2899
2500
 
2900
- // Wrapper that validates files before calling provider's add
2901
- const addWithProviderValidation = useCallback(
2902
- (fileList: File[] | FileList) => {
2903
- const incoming = [...fileList];
2904
- const accepted = incoming.filter((f) => matchesAccept(f));
2905
- if (incoming.length && accepted.length === 0) {
2906
- onError?.({
2907
- code: "accept",
2908
- message: "No files match the accepted types.",
2909
- });
2910
- return;
2911
- }
2912
- const withinSize = (f: File) => (maxFileSize ? f.size <= maxFileSize : true);
2913
- const sized = accepted.filter(withinSize);
2914
- if (accepted.length > 0 && sized.length === 0) {
2915
- onError?.({
2916
- code: "max_file_size",
2917
- message: "All files exceed the maximum size.",
2918
- });
2919
- return;
2920
- }
2921
-
2922
- const currentCount = files.length;
2923
- const capacity =
2924
- typeof maxFiles === "number" ? Math.max(0, maxFiles - currentCount) : undefined;
2925
- const capped = typeof capacity === "number" ? sized.slice(0, capacity) : sized;
2926
- if (typeof capacity === "number" && sized.length > capacity) {
2927
- onError?.({
2928
- code: "max_files",
2929
- message: "Too many files. Some were not added.",
2930
- });
2931
- }
2932
-
2933
- if (capped.length > 0) {
2934
- controller?.attachments.add(capped);
2935
- }
2936
- },
2937
- [matchesAccept, maxFileSize, maxFiles, onError, files.length, controller],
2938
- );
2939
-
2940
- const clearAttachments = useCallback(
2501
+ const clear = useCallback(
2941
2502
  () =>
2942
- usingProvider
2943
- ? controller?.attachments.clear()
2944
- : setItems((prev) => {
2945
- for (const file of prev) {
2946
- if (file.url) {
2947
- URL.revokeObjectURL(file.url);
2948
- }
2949
- }
2950
- return [];
2951
- }),
2952
- [usingProvider, controller],
2503
+ setFiles((prev) => {
2504
+ for (const file of prev) {
2505
+ if (file.url) URL.revokeObjectURL(file.url);
2506
+ }
2507
+ return [];
2508
+ }),
2509
+ [],
2953
2510
  );
2954
2511
 
2955
- const clearReferencedSources = useCallback(() => setReferencedSources([]), []);
2956
-
2957
- const add = usingProvider ? addWithProviderValidation : addLocal;
2958
- const remove = usingProvider ? controller.attachments.remove : removeLocal;
2959
- const openFileDialog = usingProvider
2960
- ? controller.attachments.openFileDialog
2961
- : openFileDialogLocal;
2962
-
2963
- const clear = useCallback(() => {
2964
- clearAttachments();
2965
- clearReferencedSources();
2966
- }, [clearAttachments, clearReferencedSources]);
2967
-
2968
- // Let provider know about our hidden file input so external menus can call openFileDialog()
2969
- useEffect(() => {
2970
- if (!usingProvider) {
2971
- return;
2972
- }
2973
- controller.__registerFileInput(inputRef, () => inputRef.current?.click());
2974
- }, [usingProvider, controller]);
2975
-
2976
- // Note: File input cannot be programmatically set for security reasons
2977
- // The syncHiddenInput prop is no longer functional
2978
- useEffect(() => {
2979
- if (syncHiddenInput && inputRef.current && files.length === 0) {
2980
- inputRef.current.value = "";
2981
- }
2982
- }, [files, syncHiddenInput]);
2983
-
2984
- // Attach drop handlers on nearest form and document (opt-in)
2985
2512
  useEffect(() => {
2986
2513
  const form = formRef.current;
2987
- if (!form) {
2988
- return;
2989
- }
2990
- if (globalDrop) {
2991
- // when global drop is on, let the document-level handler own drops
2992
- return;
2993
- }
2994
-
2995
- const onDragOver = (e: DragEvent) => {
2996
- if (e.dataTransfer?.types?.includes("Files")) {
2997
- e.preventDefault();
2998
- }
2514
+ if (!form) return;
2515
+ const onDragOver = (event: DragEvent) => {
2516
+ if (event.dataTransfer?.types?.includes("Files")) event.preventDefault();
2999
2517
  };
3000
- const onDrop = (e: DragEvent) => {
3001
- if (e.dataTransfer?.types?.includes("Files")) {
3002
- e.preventDefault();
3003
- }
3004
- if (e.dataTransfer?.files && e.dataTransfer.files.length > 0) {
3005
- add(e.dataTransfer.files);
3006
- }
2518
+ const onDrop = (event: DragEvent) => {
2519
+ if (event.dataTransfer?.types?.includes("Files")) event.preventDefault();
2520
+ if (event.dataTransfer?.files && event.dataTransfer.files.length > 0)
2521
+ add(event.dataTransfer.files);
3007
2522
  };
3008
2523
  form.addEventListener("dragover", onDragOver);
3009
2524
  form.addEventListener("drop", onDrop);
@@ -3011,156 +2526,62 @@ export const PromptInput = ({
3011
2526
  form.removeEventListener("dragover", onDragOver);
3012
2527
  form.removeEventListener("drop", onDrop);
3013
2528
  };
3014
- }, [add, globalDrop]);
3015
-
3016
- useEffect(() => {
3017
- if (!globalDrop) {
3018
- return;
3019
- }
3020
-
3021
- const onDragOver = (e: DragEvent) => {
3022
- if (e.dataTransfer?.types?.includes("Files")) {
3023
- e.preventDefault();
3024
- }
3025
- };
3026
- const onDrop = (e: DragEvent) => {
3027
- if (e.dataTransfer?.types?.includes("Files")) {
3028
- e.preventDefault();
3029
- }
3030
- if (e.dataTransfer?.files && e.dataTransfer.files.length > 0) {
3031
- add(e.dataTransfer.files);
3032
- }
3033
- };
3034
- document.addEventListener("dragover", onDragOver);
3035
- document.addEventListener("drop", onDrop);
3036
- return () => {
3037
- document.removeEventListener("dragover", onDragOver);
3038
- document.removeEventListener("drop", onDrop);
3039
- };
3040
- }, [add, globalDrop]);
2529
+ }, [add]);
3041
2530
 
3042
2531
  useEffect(
3043
2532
  () => () => {
3044
- if (!usingProvider) {
3045
- for (const f of filesRef.current) {
3046
- if (f.url) {
3047
- URL.revokeObjectURL(f.url);
3048
- }
3049
- }
2533
+ for (const file of filesRef.current) {
2534
+ if (file.url) URL.revokeObjectURL(file.url);
3050
2535
  }
3051
2536
  },
3052
- [usingProvider],
2537
+ [],
3053
2538
  );
3054
2539
 
3055
2540
  const handleChange: ChangeEventHandler<HTMLInputElement> = useCallback(
3056
2541
  (event) => {
3057
- if (event.currentTarget.files) {
3058
- add(event.currentTarget.files);
3059
- }
3060
- // Reset input value to allow selecting files that were previously removed
2542
+ if (event.currentTarget.files) add(event.currentTarget.files);
2543
+ // Reset so the same file can be selected again after removal.
3061
2544
  event.currentTarget.value = "";
3062
2545
  },
3063
2546
  [add],
3064
2547
  );
3065
2548
 
3066
- const attachmentsCtx = useMemo<AttachmentsContext>(
3067
- () => ({
3068
- add,
3069
- clear: clearAttachments,
3070
- fileInputRef: inputRef,
3071
- files: files.map((item) => ({ ...item, id: item.id })),
3072
- openFileDialog,
3073
- remove,
3074
- }),
3075
- [files, add, remove, clearAttachments, openFileDialog],
3076
- );
3077
-
3078
- const refsCtx = useMemo<ReferencedSourcesContext>(
3079
- () => ({
3080
- add: (incoming: SourceDocumentUIPart[] | SourceDocumentUIPart) => {
3081
- const array = Array.isArray(incoming) ? incoming : [incoming];
3082
- setReferencedSources((prev) => [...prev, ...array.map((s) => ({ ...s, id: nanoid() }))]);
3083
- },
3084
- clear: clearReferencedSources,
3085
- remove: (id: string) => {
3086
- setReferencedSources((prev) => prev.filter((s) => s.id !== id));
3087
- },
3088
- sources: referencedSources,
3089
- }),
3090
- [referencedSources, clearReferencedSources],
3091
- );
2549
+ const attachments = useMemo(() => ({ add, clear, files, remove }), [add, clear, files, remove]);
3092
2550
 
3093
2551
  const handleSubmit: FormEventHandler<HTMLFormElement> = useCallback(
3094
2552
  async (event) => {
3095
2553
  event.preventDefault();
3096
-
3097
2554
  const form = event.currentTarget;
3098
- const text = usingProvider
3099
- ? controller.textInput.value
3100
- : (() => {
3101
- const formData = new FormData(form);
3102
- return (formData.get("message") as string) || "";
3103
- })();
3104
-
3105
- // Reset form immediately after capturing text to avoid race condition
3106
- // where user input during async blob conversion would be lost
3107
- if (!usingProvider) {
3108
- form.reset();
3109
- }
3110
-
2555
+ const text = (new FormData(form).get("message") as string) || "";
2556
+ // Capture and reset before conversion so text typed while it runs isn't lost.
2557
+ form.reset();
3111
2558
  try {
3112
- // Convert blob URLs to data URLs asynchronously
3113
2559
  const convertedFiles: FileUIPart[] = await Promise.all(
3114
2560
  files.map(async ({ id: _id, ...item }) => {
3115
2561
  if (item.url?.startsWith("blob:")) {
3116
2562
  const dataUrl = await convertBlobUrlToDataUrl(item.url);
3117
- // If conversion failed, keep the original blob URL
3118
- return {
3119
- ...item,
3120
- url: dataUrl ?? item.url,
3121
- };
2563
+ return { ...item, url: dataUrl ?? item.url };
3122
2564
  }
3123
2565
  return item;
3124
2566
  }),
3125
2567
  );
3126
-
3127
- const result = onSubmit({ files: convertedFiles, text }, event);
3128
-
3129
- // Handle both sync and async onSubmit
3130
- if (result instanceof Promise) {
3131
- try {
3132
- await result;
3133
- clear();
3134
- if (usingProvider) {
3135
- controller.textInput.clear();
3136
- }
3137
- } catch {
3138
- // Don't clear on error - user may want to retry
3139
- }
3140
- } else {
3141
- // Sync function completed without throwing, clear inputs
3142
- clear();
3143
- if (usingProvider) {
3144
- controller.textInput.clear();
3145
- }
3146
- }
2568
+ await onSubmit({ files: convertedFiles, text }, event);
2569
+ clear();
3147
2570
  } catch {
3148
- // Don't clear on error - user may want to retry
2571
+ // Keep attachments available for a retry.
3149
2572
  }
3150
2573
  },
3151
- [usingProvider, controller, files, onSubmit, clear],
2574
+ [files, onSubmit, clear],
3152
2575
  );
3153
2576
 
3154
- // Render with or without local provider
3155
- const inner = (
3156
- <>
2577
+ return (
2578
+ <LocalAttachmentsContext.Provider value={attachments}>
3157
2579
  <input
3158
2580
  accept={accept}
3159
2581
  aria-label="Upload files"
3160
2582
  className="hidden"
3161
2583
  multiple={multiple}
3162
2584
  onChange={handleChange}
3163
- ref={inputRef}
3164
2585
  title="Upload files"
3165
2586
  type="file"
3166
2587
  />
@@ -3175,80 +2596,42 @@ export const PromptInput = ({
3175
2596
  {children}
3176
2597
  </InputGroup>
3177
2598
  </form>
3178
- </>
3179
- );
3180
-
3181
- const withReferencedSources = (
3182
- <LocalReferencedSourcesContext.Provider value={refsCtx}>
3183
- {inner}
3184
- </LocalReferencedSourcesContext.Provider>
3185
- );
3186
-
3187
- // Always provide LocalAttachmentsContext so children get validated add function
3188
- return (
3189
- <LocalAttachmentsContext.Provider value={attachmentsCtx}>
3190
- {withReferencedSources}
3191
2599
  </LocalAttachmentsContext.Provider>
3192
2600
  );
3193
2601
  };
3194
2602
 
3195
- export type PromptInputBodyProps = HTMLAttributes<HTMLDivElement>;
3196
-
3197
- export const PromptInputBody = ({ className, ...props }: PromptInputBodyProps) => (
3198
- <div className={cn("contents", className)} {...props} />
3199
- );
3200
-
3201
- export type PromptInputTextareaProps = ComponentProps<typeof InputGroupTextarea>;
3202
-
3203
2603
  export const PromptInputTextarea = ({
3204
2604
  onChange,
3205
2605
  onKeyDown,
3206
2606
  className,
3207
2607
  placeholder = "What would you like to know?",
3208
2608
  ...props
3209
- }: PromptInputTextareaProps) => {
3210
- const controller = useOptionalPromptInputController();
2609
+ }: ComponentProps<typeof InputGroupTextarea>) => {
3211
2610
  const attachments = usePromptInputAttachments();
3212
2611
  const [isComposing, setIsComposing] = useState(false);
3213
2612
 
3214
2613
  const handleKeyDown: KeyboardEventHandler<HTMLTextAreaElement> = useCallback(
3215
- (e) => {
3216
- // Call the external onKeyDown handler first
3217
- onKeyDown?.(e);
3218
-
3219
- // If the external handler prevented default, don't run internal logic
3220
- if (e.defaultPrevented) {
3221
- return;
3222
- }
3223
-
3224
- if (e.key === "Enter") {
3225
- if (isComposing || e.nativeEvent.isComposing) {
3226
- return;
3227
- }
3228
- if (e.shiftKey) {
3229
- return;
3230
- }
3231
- e.preventDefault();
3232
-
3233
- // Check if the submit button is disabled before submitting
3234
- const { form } = e.currentTarget;
2614
+ (event) => {
2615
+ onKeyDown?.(event);
2616
+ if (event.defaultPrevented) return;
2617
+ if (event.key === "Enter") {
2618
+ if (isComposing || event.nativeEvent.isComposing || event.shiftKey) return;
2619
+ event.preventDefault();
2620
+ const { form } = event.currentTarget;
3235
2621
  const submitButton = form?.querySelector(
3236
2622
  'button[type="submit"]',
3237
2623
  ) as HTMLButtonElement | null;
3238
- if (submitButton?.disabled) {
3239
- return;
3240
- }
3241
-
2624
+ if (submitButton?.disabled) return;
3242
2625
  form?.requestSubmit();
3243
2626
  }
3244
-
3245
- // Remove last attachment when Backspace is pressed and textarea is empty
3246
- if (e.key === "Backspace" && e.currentTarget.value === "" && attachments.files.length > 0) {
3247
- e.preventDefault();
2627
+ if (
2628
+ event.key === "Backspace" &&
2629
+ event.currentTarget.value === "" &&
2630
+ attachments.files.length > 0
2631
+ ) {
2632
+ event.preventDefault();
3248
2633
  const lastAttachment = attachments.files.at(-1);
3249
- if (lastAttachment) {
3250
- attachments.remove(lastAttachment.id);
3251
- }
2634
+ if (lastAttachment) attachments.remove(lastAttachment.id);
3252
2635
  }
3253
2636
  },
3254
2637
  [onKeyDown, isComposing, attachments],
@@ -3257,22 +2640,14 @@ export const PromptInputTextarea = ({
3257
2640
  const handlePaste: ClipboardEventHandler<HTMLTextAreaElement> = useCallback(
3258
2641
  (event) => {
3259
2642
  const items = event.clipboardData?.items;
3260
-
3261
- if (!items) {
3262
- return;
3263
- }
3264
-
2643
+ if (!items) return;
3265
2644
  const files: File[] = [];
3266
-
3267
2645
  for (const item of items) {
3268
2646
  if (item.kind === "file") {
3269
2647
  const file = item.getAsFile();
3270
- if (file) {
3271
- files.push(file);
3272
- }
2648
+ if (file) files.push(file);
3273
2649
  }
3274
2650
  }
3275
-
3276
2651
  if (files.length > 0) {
3277
2652
  event.preventDefault();
3278
2653
  attachments.add(files);
@@ -3284,18 +2659,6 @@ export const PromptInputTextarea = ({
3284
2659
  const handleCompositionEnd = useCallback(() => setIsComposing(false), []);
3285
2660
  const handleCompositionStart = useCallback(() => setIsComposing(true), []);
3286
2661
 
3287
- const controlledProps = controller
3288
- ? {
3289
- onChange: (e: ChangeEvent<HTMLTextAreaElement>) => {
3290
- controller.textInput.setInput(e.currentTarget.value);
3291
- onChange?.(e);
3292
- },
3293
- value: controller.textInput.value,
3294
- }
3295
- : {
3296
- onChange,
3297
- };
3298
-
3299
2662
  return (
3300
2663
  <InputGroupTextarea
3301
2664
  className={cn("field-sizing-content max-h-48 min-h-18 text-base md:text-sm", className)}
@@ -3306,1317 +2669,336 @@ export const PromptInputTextarea = ({
3306
2669
  onPaste={handlePaste}
3307
2670
  placeholder={placeholder}
3308
2671
  {...props}
3309
- {...controlledProps}
2672
+ onChange={onChange}
3310
2673
  />
3311
2674
  );
3312
2675
  };
3313
2676
 
3314
- export type PromptInputHeaderProps = Omit<ComponentProps<typeof InputGroupAddon>, "align">;
3315
-
3316
- export const PromptInputHeader = ({ className, ...props }: PromptInputHeaderProps) => (
3317
- <InputGroupAddon
3318
- align="block-end"
3319
- className={cn("order-first flex-wrap gap-1", className)}
2677
+ export const PromptInputButton = ({
2678
+ variant = "ghost",
2679
+ className,
2680
+ size,
2681
+ ...props
2682
+ }: ComponentProps<typeof InputGroupButton>) => (
2683
+ <InputGroupButton
2684
+ className={cn(
2685
+ "rounded-full",
2686
+ variant === "outline" && "bg-card hover:bg-card dark:hover:bg-input/30",
2687
+ className,
2688
+ )}
2689
+ size={size ?? (Children.count(props.children) > 1 ? "sm" : "icon-sm")}
2690
+ type="button"
2691
+ variant={variant}
3320
2692
  {...props}
3321
2693
  />
3322
2694
  );
3323
2695
 
3324
- export type PromptInputFooterProps = Omit<ComponentProps<typeof InputGroupAddon>, "align">;
3325
-
3326
- export const PromptInputFooter = ({ className, ...props }: PromptInputFooterProps) => (
3327
- <InputGroupAddon
3328
- align="block-end"
3329
- className={cn("justify-between gap-1", className)}
2696
+ export const PromptInputSubmit = ({
2697
+ className,
2698
+ variant = "default",
2699
+ size = "icon-sm",
2700
+ children,
2701
+ ...props
2702
+ }: ComponentProps<typeof InputGroupButton>) => (
2703
+ <InputGroupButton
2704
+ aria-label="Submit"
2705
+ className={cn("absolute right-2.5 bottom-2.5 rounded-full", className)}
2706
+ size={size}
2707
+ type="submit"
2708
+ variant={variant}
3330
2709
  {...props}
3331
- />
2710
+ >
2711
+ {children ?? <ArrowUpIcon className="size-4" />}
2712
+ </InputGroupButton>
3332
2713
  );
2714
+ `,"components/ai-elements/tool.tsx":`"use client";
3333
2715
 
3334
- export type PromptInputToolsProps = HTMLAttributes<HTMLDivElement>;
2716
+ import { cn } from "@/lib/utils";
2717
+ import type { ComponentProps, ReactNode } from "react";
2718
+ import { isValidElement } from "react";
3335
2719
 
3336
- export const PromptInputTools = ({ className, ...props }: PromptInputToolsProps) => (
3337
- <div className={cn("flex min-w-0 items-center gap-1", className)} {...props} />
3338
- );
2720
+ import { CodeBlock } from "./code-block";
3339
2721
 
3340
- export type PromptInputButtonTooltip =
3341
- | string
3342
- | {
3343
- content: ReactNode;
3344
- shortcut?: string;
3345
- side?: ComponentProps<typeof TooltipContent>["side"];
3346
- };
2722
+ const compactCodeBlockClassName =
2723
+ "rounded-none border-0 bg-transparent [&_pre]:!bg-transparent [&_pre]:px-3 [&_pre]:pt-2 [&_pre]:pb-3 [&_pre]:text-xs [&_code]:text-xs";
3347
2724
 
3348
- export type PromptInputButtonProps = ComponentProps<typeof InputGroupButton> & {
3349
- tooltip?: PromptInputButtonTooltip;
2725
+ export type BashToolContentProps = ComponentProps<"div"> & {
2726
+ input: unknown;
2727
+ output: unknown;
2728
+ errorText: string | undefined;
3350
2729
  };
3351
2730
 
3352
- export const PromptInputButton = ({
3353
- variant = "ghost",
2731
+ export const BashToolContent = ({
3354
2732
  className,
3355
- size,
3356
- tooltip,
2733
+ input,
2734
+ output,
2735
+ errorText,
3357
2736
  ...props
3358
- }: PromptInputButtonProps) => {
3359
- const newSize = size ?? (Children.count(props.children) > 1 ? "sm" : "icon-sm");
3360
-
3361
- const button = (
3362
- <InputGroupButton
3363
- className={cn(
3364
- "rounded-full",
3365
- variant === "outline" && "bg-card hover:bg-card dark:hover:bg-input/30",
3366
- className,
3367
- )}
3368
- size={newSize}
3369
- type="button"
3370
- variant={variant}
3371
- {...props}
3372
- />
3373
- );
3374
-
3375
- if (!tooltip) {
3376
- return button;
3377
- }
3378
-
3379
- const tooltipContent = typeof tooltip === "string" ? tooltip : tooltip.content;
3380
- const shortcut = typeof tooltip === "string" ? undefined : tooltip.shortcut;
3381
- const side = typeof tooltip === "string" ? "top" : (tooltip.side ?? "top");
2737
+ }: BashToolContentProps) => {
2738
+ const command = getRecordValue(input, "command");
2739
+ const stdout = getRecordValue(output, "stdout") ?? (typeof output === "string" ? output : "");
2740
+ const stderr = getRecordValue(output, "stderr") ?? errorText ?? "";
2741
+ const exitCode = getRecordValue(output, "exitCode");
2742
+ const hasResult = Boolean(stdout || stderr || (typeof exitCode === "number" && exitCode !== 0));
3382
2743
 
3383
2744
  return (
3384
- <Tooltip>
3385
- <TooltipTrigger asChild>{button}</TooltipTrigger>
3386
- <TooltipContent side={side}>
3387
- {tooltipContent}
3388
- {shortcut && <span className="ml-2 text-muted-foreground">{shortcut}</span>}
3389
- </TooltipContent>
3390
- </Tooltip>
2745
+ <div className={cn("space-y-2", className)} {...props}>
2746
+ <pre className="overflow-x-auto whitespace-pre-wrap rounded-md bg-muted/50 p-3 font-mono text-xs leading-relaxed">
2747
+ <code>
2748
+ <span className="text-muted-foreground">$ </span>
2749
+ {command ?? "…"}
2750
+ </code>
2751
+ </pre>
2752
+ {hasResult ? (
2753
+ <pre className="overflow-x-auto whitespace-pre-wrap rounded-md bg-muted/50 p-3 font-mono text-xs leading-relaxed">
2754
+ <code>
2755
+ <span className="mb-2 block font-sans text-[10px] text-muted-foreground uppercase tracking-wide">
2756
+ Output
2757
+ </span>
2758
+ {stdout ? <span className="block">{String(stdout).trimEnd()}</span> : null}
2759
+ {stderr ? (
2760
+ <span className="block text-destructive">{String(stderr).trimEnd()}</span>
2761
+ ) : null}
2762
+ {typeof exitCode === "number" && exitCode !== 0 ? (
2763
+ <span className="block text-muted-foreground">Exited with code {exitCode}</span>
2764
+ ) : null}
2765
+ </code>
2766
+ </pre>
2767
+ ) : null}
2768
+ </div>
3391
2769
  );
3392
2770
  };
3393
2771
 
3394
- export type PromptInputActionMenuProps = ComponentProps<typeof DropdownMenu>;
3395
- export const PromptInputActionMenu = (props: PromptInputActionMenuProps) => (
3396
- <DropdownMenu {...props} />
3397
- );
2772
+ const getRecordValue = (value: unknown, key: string): string | number | undefined => {
2773
+ if (typeof value !== "object" || value === null || !(key in value)) {
2774
+ return undefined;
2775
+ }
3398
2776
 
3399
- export type PromptInputActionMenuTriggerProps = PromptInputButtonProps;
2777
+ const property = value[key as keyof typeof value];
2778
+ return typeof property === "string" || typeof property === "number" ? property : undefined;
2779
+ };
3400
2780
 
3401
- export const PromptInputActionMenuTrigger = ({
3402
- className,
3403
- children,
3404
- ...props
3405
- }: PromptInputActionMenuTriggerProps) => (
3406
- <DropdownMenuTrigger asChild>
3407
- <PromptInputButton className={className} {...props}>
3408
- {children ?? <PlusIcon className="size-4" />}
3409
- </PromptInputButton>
3410
- </DropdownMenuTrigger>
3411
- );
2781
+ export type ToolInputProps = ComponentProps<"div"> & {
2782
+ input: unknown;
2783
+ };
3412
2784
 
3413
- export type PromptInputActionMenuContentProps = ComponentProps<typeof DropdownMenuContent>;
3414
- export const PromptInputActionMenuContent = ({
3415
- className,
3416
- ...props
3417
- }: PromptInputActionMenuContentProps) => (
3418
- <DropdownMenuContent align="start" className={cn(className)} {...props} />
2785
+ export const ToolInput = ({ className, input, ...props }: ToolInputProps) => (
2786
+ <div className={cn("overflow-hidden rounded-md bg-muted/50", className)} {...props}>
2787
+ <span className="block px-3 pt-3 font-sans text-[10px] text-muted-foreground uppercase tracking-wide">
2788
+ Parameters
2789
+ </span>
2790
+ <div>
2791
+ <CodeBlock
2792
+ className={compactCodeBlockClassName}
2793
+ code={JSON.stringify(input, null, 2)}
2794
+ language="json"
2795
+ />
2796
+ </div>
2797
+ </div>
3419
2798
  );
3420
2799
 
3421
- export type PromptInputActionMenuItemProps = ComponentProps<typeof DropdownMenuItem>;
3422
- export const PromptInputActionMenuItem = ({
3423
- className,
3424
- ...props
3425
- }: PromptInputActionMenuItemProps) => <DropdownMenuItem className={cn(className)} {...props} />;
3426
-
3427
- // Note: Actions that perform side-effects (like opening a file dialog)
3428
- // are provided in opt-in modules (e.g., prompt-input-attachments).
3429
-
3430
- export type PromptInputSubmitProps = ComponentProps<typeof InputGroupButton> & {
3431
- status?: ChatStatus;
3432
- onStop?: () => void;
2800
+ export type ToolOutputProps = ComponentProps<"div"> & {
2801
+ output: unknown;
2802
+ errorText: string | undefined;
3433
2803
  };
3434
2804
 
3435
- export const PromptInputSubmit = ({
3436
- className,
3437
- variant = "default",
3438
- size = "icon-sm",
3439
- status,
3440
- onStop,
3441
- onClick,
3442
- children,
3443
- ...props
3444
- }: PromptInputSubmitProps) => {
3445
- const isGenerating = status === "submitted" || status === "streaming";
2805
+ export const ToolOutput = ({ className, output, errorText, ...props }: ToolOutputProps) => {
2806
+ if (!(output || errorText)) {
2807
+ return null;
2808
+ }
3446
2809
 
3447
- let Icon = <ArrowUpIcon className="size-4" />;
2810
+ let Output = <div>{output as ReactNode}</div>;
3448
2811
 
3449
- if (status === "submitted") {
3450
- Icon = <Spinner />;
3451
- } else if (status === "streaming") {
3452
- Icon = <span aria-hidden className="size-2.5 rounded-[2px] bg-current" />;
3453
- } else if (status === "error") {
3454
- Icon = <XIcon className="size-4" />;
2812
+ if (typeof output === "object" && !isValidElement(output)) {
2813
+ Output = (
2814
+ <CodeBlock
2815
+ className={compactCodeBlockClassName}
2816
+ code={JSON.stringify(output, null, 2)}
2817
+ language="json"
2818
+ />
2819
+ );
2820
+ } else if (typeof output === "string") {
2821
+ Output = <CodeBlock className={compactCodeBlockClassName} code={output} language="json" />;
3455
2822
  }
3456
2823
 
3457
- const handleClick = useCallback(
3458
- (e: React.MouseEvent<HTMLButtonElement>) => {
3459
- if (isGenerating && onStop) {
3460
- e.preventDefault();
3461
- onStop();
3462
- return;
3463
- }
3464
- onClick?.(e);
3465
- },
3466
- [isGenerating, onStop, onClick],
3467
- );
3468
-
3469
2824
  return (
3470
- <InputGroupButton
3471
- aria-label={isGenerating ? "Stop" : "Submit"}
3472
- className={cn("absolute right-2.5 bottom-2.5 rounded-full", className)}
3473
- onClick={handleClick}
3474
- size={size}
3475
- type={isGenerating && onStop ? "button" : "submit"}
3476
- variant={variant}
2825
+ <div
2826
+ className={cn(
2827
+ "overflow-x-auto rounded-md text-xs [&_table]:w-full",
2828
+ errorText ? "bg-destructive/10 text-destructive" : "bg-muted/50 text-foreground",
2829
+ className,
2830
+ )}
3477
2831
  {...props}
3478
2832
  >
3479
- {children ?? Icon}
3480
- </InputGroupButton>
2833
+ <span className="block px-3 pt-3 font-sans text-[10px] text-muted-foreground uppercase tracking-wide">
2834
+ {errorText ? "Error" : "Result"}
2835
+ </span>
2836
+ {errorText && <div className="px-3 pt-2 pb-3">{errorText}</div>}
2837
+ {Output}
2838
+ </div>
3481
2839
  );
3482
2840
  };
2841
+ `,"components/ui/button-group.tsx":`import { cva, type VariantProps } from "class-variance-authority";
2842
+ import { Slot } from "radix-ui";
3483
2843
 
3484
- export type PromptInputSelectProps = ComponentProps<typeof Select>;
3485
-
3486
- export const PromptInputSelect = (props: PromptInputSelectProps) => <Select {...props} />;
3487
-
3488
- export type PromptInputSelectTriggerProps = ComponentProps<typeof SelectTrigger>;
3489
-
3490
- export const PromptInputSelectTrigger = ({
3491
- className,
3492
- ...props
3493
- }: PromptInputSelectTriggerProps) => (
3494
- <SelectTrigger
3495
- className={cn(
3496
- "border-none bg-transparent font-medium text-muted-foreground shadow-none transition-colors",
3497
- "hover:bg-accent hover:text-foreground aria-expanded:bg-accent aria-expanded:text-foreground",
3498
- className,
3499
- )}
3500
- {...props}
3501
- />
3502
- );
3503
-
3504
- export type PromptInputSelectContentProps = ComponentProps<typeof SelectContent>;
3505
-
3506
- export const PromptInputSelectContent = ({
3507
- className,
3508
- ...props
3509
- }: PromptInputSelectContentProps) => <SelectContent className={cn(className)} {...props} />;
3510
-
3511
- export type PromptInputSelectItemProps = ComponentProps<typeof SelectItem>;
3512
-
3513
- export const PromptInputSelectItem = ({ className, ...props }: PromptInputSelectItemProps) => (
3514
- <SelectItem className={cn(className)} {...props} />
3515
- );
3516
-
3517
- export type PromptInputSelectValueProps = ComponentProps<typeof SelectValue>;
3518
-
3519
- export const PromptInputSelectValue = ({ className, ...props }: PromptInputSelectValueProps) => (
3520
- <SelectValue className={cn(className)} {...props} />
3521
- );
3522
-
3523
- export type PromptInputHoverCardProps = ComponentProps<typeof HoverCard>;
3524
-
3525
- export const PromptInputHoverCard = ({
3526
- openDelay = 0,
3527
- closeDelay = 0,
3528
- ...props
3529
- }: PromptInputHoverCardProps) => (
3530
- <HoverCard closeDelay={closeDelay} openDelay={openDelay} {...props} />
3531
- );
3532
-
3533
- export type PromptInputHoverCardTriggerProps = ComponentProps<typeof HoverCardTrigger>;
3534
-
3535
- export const PromptInputHoverCardTrigger = (props: PromptInputHoverCardTriggerProps) => (
3536
- <HoverCardTrigger {...props} />
3537
- );
3538
-
3539
- export type PromptInputHoverCardContentProps = ComponentProps<typeof HoverCardContent>;
3540
-
3541
- export const PromptInputHoverCardContent = ({
3542
- align = "start",
3543
- ...props
3544
- }: PromptInputHoverCardContentProps) => <HoverCardContent align={align} {...props} />;
3545
-
3546
- export type PromptInputTabsListProps = HTMLAttributes<HTMLDivElement>;
3547
-
3548
- export const PromptInputTabsList = ({ className, ...props }: PromptInputTabsListProps) => (
3549
- <div className={cn(className)} {...props} />
3550
- );
3551
-
3552
- export type PromptInputTabProps = HTMLAttributes<HTMLDivElement>;
3553
-
3554
- export const PromptInputTab = ({ className, ...props }: PromptInputTabProps) => (
3555
- <div className={cn(className)} {...props} />
3556
- );
3557
-
3558
- export type PromptInputTabLabelProps = HTMLAttributes<HTMLHeadingElement>;
2844
+ import { cn } from "@/lib/utils";
2845
+ import { Separator } from "@/components/ui/separator";
3559
2846
 
3560
- export const PromptInputTabLabel = ({ className, ...props }: PromptInputTabLabelProps) => (
3561
- // Content provided via children in props
3562
- // oxlint-disable-next-line eslint-plugin-jsx-a11y(heading-has-content)
3563
- <h3 className={cn("mb-2 px-3 font-medium text-muted-foreground text-xs", className)} {...props} />
2847
+ const buttonGroupVariants = cva(
2848
+ "flex w-fit items-stretch has-[>[data-slot=button-group]]:gap-2 [&>*]:focus-visible:relative [&>*]:focus-visible:z-10 has-[select[aria-hidden=true]:last-child]:[&>[data-slot=select-trigger]:last-of-type]:rounded-r-md [&>[data-slot=select-trigger]:not([class*='w-'])]:w-fit [&>input]:flex-1",
2849
+ {
2850
+ variants: {
2851
+ orientation: {
2852
+ horizontal:
2853
+ "[&>*:not(:first-child)]:rounded-l-none [&>*:not(:first-child)]:border-l-0 [&>*:not(:last-child)]:rounded-r-none",
2854
+ vertical:
2855
+ "flex-col [&>*:not(:first-child)]:rounded-t-none [&>*:not(:first-child)]:border-t-0 [&>*:not(:last-child)]:rounded-b-none",
2856
+ },
2857
+ },
2858
+ defaultVariants: {
2859
+ orientation: "horizontal",
2860
+ },
2861
+ },
3564
2862
  );
3565
2863
 
3566
- export type PromptInputTabBodyProps = HTMLAttributes<HTMLDivElement>;
3567
-
3568
- export const PromptInputTabBody = ({ className, ...props }: PromptInputTabBodyProps) => (
3569
- <div className={cn("space-y-1", className)} {...props} />
3570
- );
3571
-
3572
- export type PromptInputTabItemProps = HTMLAttributes<HTMLDivElement>;
3573
-
3574
- export const PromptInputTabItem = ({ className, ...props }: PromptInputTabItemProps) => (
3575
- <div
3576
- className={cn("flex items-center gap-2 px-3 py-2 text-xs hover:bg-accent", className)}
3577
- {...props}
3578
- />
3579
- );
3580
-
3581
- export type PromptInputCommandProps = ComponentProps<typeof Command>;
3582
-
3583
- export const PromptInputCommand = ({ className, ...props }: PromptInputCommandProps) => (
3584
- <Command className={cn(className)} {...props} />
3585
- );
3586
-
3587
- export type PromptInputCommandInputProps = ComponentProps<typeof CommandInput>;
3588
-
3589
- export const PromptInputCommandInput = ({ className, ...props }: PromptInputCommandInputProps) => (
3590
- <CommandInput className={cn(className)} {...props} />
3591
- );
3592
-
3593
- export type PromptInputCommandListProps = ComponentProps<typeof CommandList>;
3594
-
3595
- export const PromptInputCommandList = ({ className, ...props }: PromptInputCommandListProps) => (
3596
- <CommandList className={cn(className)} {...props} />
3597
- );
3598
-
3599
- export type PromptInputCommandEmptyProps = ComponentProps<typeof CommandEmpty>;
3600
-
3601
- export const PromptInputCommandEmpty = ({ className, ...props }: PromptInputCommandEmptyProps) => (
3602
- <CommandEmpty className={cn(className)} {...props} />
3603
- );
3604
-
3605
- export type PromptInputCommandGroupProps = ComponentProps<typeof CommandGroup>;
3606
-
3607
- export const PromptInputCommandGroup = ({ className, ...props }: PromptInputCommandGroupProps) => (
3608
- <CommandGroup className={cn(className)} {...props} />
3609
- );
3610
-
3611
- export type PromptInputCommandItemProps = ComponentProps<typeof CommandItem>;
3612
-
3613
- export const PromptInputCommandItem = ({ className, ...props }: PromptInputCommandItemProps) => (
3614
- <CommandItem className={cn(className)} {...props} />
3615
- );
3616
-
3617
- export type PromptInputCommandSeparatorProps = ComponentProps<typeof CommandSeparator>;
3618
-
3619
- export const PromptInputCommandSeparator = ({
3620
- className,
3621
- ...props
3622
- }: PromptInputCommandSeparatorProps) => <CommandSeparator className={cn(className)} {...props} />;
3623
- `,"components/ai-elements/reasoning.tsx":`"use client";
3624
-
3625
- import { useControllableState } from "@radix-ui/react-use-controllable-state";
3626
- import { Collapsible, CollapsibleContent, CollapsibleTrigger } from "@/components/ui/collapsible";
3627
- import { cn } from "@/lib/utils";
3628
- import { cjk } from "@streamdown/cjk";
3629
- import { code } from "@streamdown/code";
3630
- import { math } from "@streamdown/math";
3631
- import { mermaid } from "@streamdown/mermaid";
3632
- import { BrainIcon, ChevronDownIcon } from "lucide-react";
3633
- import type { ComponentProps, ReactNode } from "react";
3634
- import {
3635
- createContext,
3636
- memo,
3637
- useCallback,
3638
- useContext,
3639
- useEffect,
3640
- useMemo,
3641
- useRef,
3642
- useState,
3643
- } from "react";
3644
- import { Streamdown } from "streamdown";
3645
-
3646
- import { Shimmer } from "./shimmer";
3647
-
3648
- interface ReasoningContextValue {
3649
- isStreaming: boolean;
3650
- isOpen: boolean;
3651
- setIsOpen: (open: boolean) => void;
3652
- duration: number | undefined;
3653
- }
3654
-
3655
- const ReasoningContext = createContext<ReasoningContextValue | null>(null);
3656
-
3657
- export const useReasoning = () => {
3658
- const context = useContext(ReasoningContext);
3659
- if (!context) {
3660
- throw new Error("Reasoning components must be used within Reasoning");
3661
- }
3662
- return context;
3663
- };
3664
-
3665
- export type ReasoningProps = ComponentProps<typeof Collapsible> & {
3666
- isStreaming?: boolean;
3667
- open?: boolean;
3668
- defaultOpen?: boolean;
3669
- onOpenChange?: (open: boolean) => void;
3670
- duration?: number;
3671
- };
3672
-
3673
- const MS_IN_S = 1000;
3674
-
3675
- export const Reasoning = memo(
3676
- ({
3677
- className,
3678
- isStreaming = false,
3679
- open,
3680
- defaultOpen,
3681
- onOpenChange,
3682
- duration: durationProp,
3683
- children,
3684
- ...props
3685
- }: ReasoningProps) => {
3686
- const resolvedDefaultOpen = defaultOpen ?? isStreaming;
3687
- // Track if defaultOpen was explicitly set to false (to prevent auto-open)
3688
- const isExplicitlyClosed = defaultOpen === false;
3689
-
3690
- const [isOpen, setIsOpen] = useControllableState<boolean>({
3691
- defaultProp: resolvedDefaultOpen,
3692
- onChange: onOpenChange,
3693
- prop: open,
3694
- });
3695
- const [duration, setDuration] = useControllableState<number | undefined>({
3696
- defaultProp: undefined,
3697
- prop: durationProp,
3698
- });
3699
-
3700
- const hasEverStreamedRef = useRef(isStreaming);
3701
- const [hasAutoClosed, setHasAutoClosed] = useState(false);
3702
- const startTimeRef = useRef<number | null>(null);
3703
-
3704
- // Track when streaming starts and compute duration
3705
- useEffect(() => {
3706
- if (isStreaming) {
3707
- hasEverStreamedRef.current = true;
3708
- if (startTimeRef.current === null) {
3709
- startTimeRef.current = Date.now();
3710
- }
3711
- } else if (startTimeRef.current !== null) {
3712
- setDuration(Math.ceil((Date.now() - startTimeRef.current) / MS_IN_S));
3713
- startTimeRef.current = null;
3714
- }
3715
- }, [isStreaming, setDuration]);
3716
-
3717
- // Auto-open when streaming starts (unless explicitly closed)
3718
- useEffect(() => {
3719
- if (isStreaming && !isOpen && !isExplicitlyClosed) {
3720
- setIsOpen(true);
3721
- }
3722
- }, [isStreaming, isOpen, setIsOpen, isExplicitlyClosed]);
3723
-
3724
- // Auto-close when streaming ends (once only, and only if it ever streamed)
3725
- useEffect(() => {
3726
- if (hasEverStreamedRef.current && !isStreaming && isOpen && !hasAutoClosed) {
3727
- setIsOpen(false);
3728
- setHasAutoClosed(true);
3729
- }
3730
- }, [isStreaming, isOpen, setIsOpen, hasAutoClosed]);
3731
-
3732
- const handleOpenChange = useCallback(
3733
- (newOpen: boolean) => {
3734
- setIsOpen(newOpen);
3735
- },
3736
- [setIsOpen],
3737
- );
3738
-
3739
- const contextValue = useMemo(
3740
- () => ({ duration, isOpen, isStreaming, setIsOpen }),
3741
- [duration, isOpen, isStreaming, setIsOpen],
3742
- );
3743
-
3744
- return (
3745
- <ReasoningContext.Provider value={contextValue}>
3746
- <Collapsible
3747
- className={cn("not-prose mb-4 w-full", className)}
3748
- onOpenChange={handleOpenChange}
3749
- open={isOpen}
3750
- {...props}
3751
- >
3752
- {children}
3753
- </Collapsible>
3754
- </ReasoningContext.Provider>
3755
- );
3756
- },
3757
- );
3758
-
3759
- export type ReasoningTriggerProps = ComponentProps<typeof CollapsibleTrigger> & {
3760
- getThinkingMessage?: (isStreaming: boolean, duration?: number) => ReactNode;
3761
- };
3762
-
3763
- const defaultGetThinkingMessage = (isStreaming: boolean, duration?: number) => {
3764
- if (isStreaming || duration === 0) {
3765
- return <Shimmer duration={1}>Thinking...</Shimmer>;
3766
- }
3767
- if (duration === undefined) {
3768
- return <p>Thought for a few seconds</p>;
3769
- }
3770
- return <p>Thought for {duration} seconds</p>;
3771
- };
3772
-
3773
- export const ReasoningTrigger = memo(
3774
- ({
3775
- className,
3776
- children,
3777
- getThinkingMessage = defaultGetThinkingMessage,
3778
- ...props
3779
- }: ReasoningTriggerProps) => {
3780
- const { isStreaming, isOpen, duration } = useReasoning();
3781
-
3782
- return (
3783
- <CollapsibleTrigger
3784
- className={cn(
3785
- "flex w-full items-center gap-2 text-muted-foreground text-sm transition-colors hover:text-foreground",
3786
- className,
3787
- )}
3788
- {...props}
3789
- >
3790
- {children ?? (
3791
- <>
3792
- <BrainIcon className="size-4" />
3793
- {getThinkingMessage(isStreaming, duration)}
3794
- <ChevronDownIcon
3795
- className={cn("size-4 transition-transform", isOpen ? "rotate-180" : "rotate-0")}
3796
- />
3797
- </>
3798
- )}
3799
- </CollapsibleTrigger>
3800
- );
3801
- },
3802
- );
3803
-
3804
- export type ReasoningContentProps = ComponentProps<typeof CollapsibleContent> & {
3805
- children: string;
3806
- };
3807
-
3808
- const streamdownPlugins = { cjk, code, math, mermaid };
3809
-
3810
- export const ReasoningContent = memo(({ className, children, ...props }: ReasoningContentProps) => (
3811
- <CollapsibleContent
3812
- className={cn(
3813
- "mt-4 text-sm",
3814
- "data-[state=closed]:fade-out-0 data-[state=closed]:slide-out-to-top-2 data-[state=open]:slide-in-from-top-2 text-muted-foreground outline-none data-[state=closed]:animate-out data-[state=open]:animate-in",
3815
- className,
3816
- )}
3817
- {...props}
3818
- >
3819
- <Streamdown plugins={streamdownPlugins}>{children}</Streamdown>
3820
- </CollapsibleContent>
3821
- ));
3822
-
3823
- Reasoning.displayName = "Reasoning";
3824
- ReasoningTrigger.displayName = "ReasoningTrigger";
3825
- ReasoningContent.displayName = "ReasoningContent";
3826
- `,"components/ai-elements/shimmer.tsx":`"use client";
3827
-
3828
- import { cn } from "@/lib/utils";
3829
- import type { MotionProps } from "motion/react";
3830
- import { motion } from "motion/react";
3831
- import type { CSSProperties, ElementType, JSX } from "react";
3832
- import { memo, useMemo } from "react";
3833
-
3834
- type MotionHTMLProps = MotionProps & Record<string, unknown>;
3835
-
3836
- // Cache motion components at module level to avoid creating during render
3837
- const motionComponentCache = new Map<
3838
- keyof JSX.IntrinsicElements,
3839
- React.ComponentType<MotionHTMLProps>
3840
- >();
3841
-
3842
- const getMotionComponent = (element: keyof JSX.IntrinsicElements) => {
3843
- let component = motionComponentCache.get(element);
3844
- if (!component) {
3845
- component = motion.create(element);
3846
- motionComponentCache.set(element, component);
3847
- }
3848
- return component;
3849
- };
3850
-
3851
- export interface TextShimmerProps {
3852
- children: string;
3853
- as?: ElementType;
3854
- className?: string;
3855
- duration?: number;
3856
- spread?: number;
3857
- }
3858
-
3859
- const ShimmerComponent = ({
3860
- children,
3861
- as: Component = "p",
3862
- className,
3863
- duration = 2,
3864
- spread = 2,
3865
- }: TextShimmerProps) => {
3866
- const MotionComponent = getMotionComponent(Component as keyof JSX.IntrinsicElements);
3867
-
3868
- const dynamicSpread = useMemo(() => (children?.length ?? 0) * spread, [children, spread]);
3869
-
3870
- return (
3871
- <MotionComponent
3872
- animate={{ backgroundPosition: "0% center" }}
3873
- className={cn(
3874
- "relative inline-block bg-[length:250%_100%,auto] bg-clip-text text-transparent",
3875
- "[--bg:linear-gradient(90deg,#0000_calc(50%-var(--spread)),var(--color-background),#0000_calc(50%+var(--spread)))] [background-repeat:no-repeat,padding-box]",
3876
- className,
3877
- )}
3878
- initial={{ backgroundPosition: "100% center" }}
3879
- style={
3880
- {
3881
- "--spread": \`\${dynamicSpread}px\`,
3882
- backgroundImage:
3883
- "var(--bg), linear-gradient(var(--color-muted-foreground), var(--color-muted-foreground))",
3884
- } as CSSProperties
3885
- }
3886
- transition={{
3887
- duration,
3888
- ease: "linear",
3889
- repeat: Number.POSITIVE_INFINITY,
3890
- }}
3891
- >
3892
- {children}
3893
- </MotionComponent>
3894
- );
3895
- };
3896
-
3897
- export const Shimmer = memo(ShimmerComponent);
3898
- `,"components/ai-elements/tool.tsx":`"use client";
3899
-
3900
- import { Collapsible, CollapsibleContent, CollapsibleTrigger } from "@/components/ui/collapsible";
3901
- import { cn } from "@/lib/utils";
3902
- import type { DynamicToolUIPart, ToolUIPart } from "ai";
3903
- import { ChevronRightIcon, TerminalIcon, WrenchIcon } from "lucide-react";
3904
- import type { ComponentProps, ReactNode } from "react";
3905
- import { isValidElement } from "react";
3906
-
3907
- import { CodeBlock } from "./code-block";
3908
-
3909
- const compactCodeBlockClassName =
3910
- "rounded-none border-0 bg-transparent [&_pre]:!bg-transparent [&_pre]:px-3 [&_pre]:pt-2 [&_pre]:pb-3 [&_pre]:text-xs [&_code]:text-xs";
3911
-
3912
- export type ToolProps = ComponentProps<typeof Collapsible>;
3913
-
3914
- export const Tool = ({ className, ...props }: ToolProps) => (
3915
- <Collapsible className={cn("group not-prose w-full", className)} {...props} />
3916
- );
3917
-
3918
- export type ToolPart = ToolUIPart | DynamicToolUIPart;
3919
-
3920
- export type ToolHeaderProps = {
3921
- title?: string;
3922
- className?: string;
3923
- } & (
3924
- | { type: ToolUIPart["type"]; state: ToolUIPart["state"]; toolName?: never }
3925
- | {
3926
- type: DynamicToolUIPart["type"];
3927
- state: DynamicToolUIPart["state"];
3928
- toolName: string;
3929
- }
3930
- );
3931
-
3932
- const statusLabels: Record<ToolPart["state"], string> = {
3933
- "approval-requested": "Awaiting Approval",
3934
- "approval-responded": "Responded",
3935
- "input-available": "Running",
3936
- "input-streaming": "Pending",
3937
- "output-available": "Completed",
3938
- "output-denied": "Denied",
3939
- "output-error": "Error",
3940
- };
3941
-
3942
- export const getStatusIndicator = (status: ToolPart["state"]) =>
3943
- status === "output-available" ? null : (
3944
- <span className={cn("text-sm", status === "output-error" && "text-destructive")}>
3945
- {statusLabels[status]}
3946
- </span>
3947
- );
3948
-
3949
- export const ToolHeader = ({
3950
- className,
3951
- title,
3952
- type,
3953
- state,
3954
- toolName,
3955
- ...props
3956
- }: ToolHeaderProps) => {
3957
- const derivedName = type === "dynamic-tool" ? toolName : type.split("-").slice(1).join("-");
3958
- const displayName = title ?? derivedName;
3959
-
3960
- return (
3961
- <CollapsibleTrigger
3962
- className={cn(
3963
- "flex w-full items-center gap-2 py-0.5 text-left text-muted-foreground transition-colors hover:text-foreground",
3964
- className,
3965
- )}
3966
- {...props}
3967
- >
3968
- {displayName === "bash" ? (
3969
- <TerminalIcon className="size-4 shrink-0" />
3970
- ) : (
3971
- <WrenchIcon className="size-4 shrink-0" />
3972
- )}
3973
- <span className="text-sm">{displayName}</span>
3974
- {getStatusIndicator(state)}
3975
- <ChevronRightIcon className="size-3.5 shrink-0 transition-transform group-data-[state=open]:rotate-90" />
3976
- </CollapsibleTrigger>
3977
- );
3978
- };
3979
-
3980
- export type ToolContentProps = ComponentProps<typeof CollapsibleContent>;
3981
-
3982
- export const ToolContent = ({ className, ...props }: ToolContentProps) => (
3983
- <CollapsibleContent
3984
- className={cn(
3985
- "data-[state=closed]:fade-out-0 data-[state=closed]:slide-out-to-top-2 data-[state=open]:slide-in-from-top-2 space-y-4 py-2 text-popover-foreground outline-none data-[state=closed]:animate-out data-[state=open]:animate-in",
3986
- className,
3987
- )}
3988
- {...props}
3989
- />
3990
- );
3991
-
3992
- export type BashToolContentProps = ComponentProps<"div"> & {
3993
- input: ToolPart["input"];
3994
- output: ToolPart["output"];
3995
- errorText: ToolPart["errorText"];
3996
- };
3997
-
3998
- export const BashToolContent = ({
3999
- className,
4000
- input,
4001
- output,
4002
- errorText,
4003
- ...props
4004
- }: BashToolContentProps) => {
4005
- const command = getRecordValue(input, "command");
4006
- const stdout = getRecordValue(output, "stdout") ?? (typeof output === "string" ? output : "");
4007
- const stderr = getRecordValue(output, "stderr") ?? errorText ?? "";
4008
- const exitCode = getRecordValue(output, "exitCode");
4009
- const hasResult = Boolean(stdout || stderr || (typeof exitCode === "number" && exitCode !== 0));
4010
-
4011
- return (
4012
- <div className={cn("space-y-2", className)} {...props}>
4013
- <pre className="overflow-x-auto whitespace-pre-wrap rounded-md bg-muted/50 p-3 font-mono text-xs leading-relaxed">
4014
- <code>
4015
- <span className="text-muted-foreground">$ </span>
4016
- {command ?? "…"}
4017
- </code>
4018
- </pre>
4019
- {hasResult ? (
4020
- <pre className="overflow-x-auto whitespace-pre-wrap rounded-md bg-muted/50 p-3 font-mono text-xs leading-relaxed">
4021
- <code>
4022
- <span className="mb-2 block font-sans text-[10px] text-muted-foreground uppercase tracking-wide">
4023
- Output
4024
- </span>
4025
- {stdout ? <span className="block">{String(stdout).trimEnd()}</span> : null}
4026
- {stderr ? (
4027
- <span className="block text-destructive">{String(stderr).trimEnd()}</span>
4028
- ) : null}
4029
- {typeof exitCode === "number" && exitCode !== 0 ? (
4030
- <span className="block text-muted-foreground">Exited with code {exitCode}</span>
4031
- ) : null}
4032
- </code>
4033
- </pre>
4034
- ) : null}
4035
- </div>
4036
- );
4037
- };
4038
-
4039
- const getRecordValue = (value: unknown, key: string): string | number | undefined => {
4040
- if (typeof value !== "object" || value === null || !(key in value)) {
4041
- return undefined;
4042
- }
4043
-
4044
- const property = value[key as keyof typeof value];
4045
- return typeof property === "string" || typeof property === "number" ? property : undefined;
4046
- };
4047
-
4048
- export type ToolInputProps = ComponentProps<"div"> & {
4049
- input: ToolPart["input"];
4050
- };
4051
-
4052
- export const ToolInput = ({ className, input, ...props }: ToolInputProps) => (
4053
- <div className={cn("overflow-hidden rounded-md bg-muted/50", className)} {...props}>
4054
- <span className="block px-3 pt-3 font-sans text-[10px] text-muted-foreground uppercase tracking-wide">
4055
- Parameters
4056
- </span>
4057
- <div>
4058
- <CodeBlock
4059
- className={compactCodeBlockClassName}
4060
- code={JSON.stringify(input, null, 2)}
4061
- language="json"
4062
- />
4063
- </div>
4064
- </div>
4065
- );
4066
-
4067
- export type ToolOutputProps = ComponentProps<"div"> & {
4068
- output: ToolPart["output"];
4069
- errorText: ToolPart["errorText"];
4070
- };
4071
-
4072
- export const ToolOutput = ({ className, output, errorText, ...props }: ToolOutputProps) => {
4073
- if (!(output || errorText)) {
4074
- return null;
4075
- }
4076
-
4077
- let Output = <div>{output as ReactNode}</div>;
4078
-
4079
- if (typeof output === "object" && !isValidElement(output)) {
4080
- Output = (
4081
- <CodeBlock
4082
- className={compactCodeBlockClassName}
4083
- code={JSON.stringify(output, null, 2)}
4084
- language="json"
4085
- />
4086
- );
4087
- } else if (typeof output === "string") {
4088
- Output = <CodeBlock className={compactCodeBlockClassName} code={output} language="json" />;
4089
- }
4090
-
4091
- return (
4092
- <div
4093
- className={cn(
4094
- "overflow-x-auto rounded-md text-xs [&_table]:w-full",
4095
- errorText ? "bg-destructive/10 text-destructive" : "bg-muted/50 text-foreground",
4096
- className,
4097
- )}
4098
- {...props}
4099
- >
4100
- <span className="block px-3 pt-3 font-sans text-[10px] text-muted-foreground uppercase tracking-wide">
4101
- {errorText ? "Error" : "Result"}
4102
- </span>
4103
- {errorText && <div className="px-3 pt-2 pb-3">{errorText}</div>}
4104
- {Output}
4105
- </div>
4106
- );
4107
- };
4108
- `,"components/ui/badge.tsx":`import * as React from "react";
4109
- import { cva, type VariantProps } from "class-variance-authority";
4110
- import { Slot } from "radix-ui";
4111
-
4112
- import { cn } from "@/lib/utils";
4113
-
4114
- const badgeVariants = cva(
4115
- "inline-flex w-fit shrink-0 items-center justify-center gap-1 overflow-hidden rounded-full border border-transparent px-2 py-0.5 text-xs font-medium whitespace-nowrap transition-[color,box-shadow] focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 [&>svg]:pointer-events-none [&>svg]:size-3",
4116
- {
4117
- variants: {
4118
- variant: {
4119
- default: "bg-primary text-primary-foreground [a&]:hover:bg-primary/90",
4120
- secondary: "bg-secondary text-secondary-foreground [a&]:hover:bg-secondary/90",
4121
- destructive:
4122
- "bg-destructive text-white focus-visible:ring-destructive/20 dark:bg-destructive/60 dark:focus-visible:ring-destructive/40 [a&]:hover:bg-destructive/90",
4123
- outline:
4124
- "border-border text-foreground [a&]:hover:bg-accent [a&]:hover:text-accent-foreground",
4125
- ghost: "[a&]:hover:bg-accent [a&]:hover:text-accent-foreground",
4126
- link: "text-primary underline-offset-4 [a&]:hover:underline",
4127
- },
4128
- },
4129
- defaultVariants: {
4130
- variant: "default",
4131
- },
4132
- },
4133
- );
4134
-
4135
- function Badge({
4136
- className,
4137
- variant = "default",
4138
- asChild = false,
4139
- ...props
4140
- }: React.ComponentProps<"span"> & VariantProps<typeof badgeVariants> & { asChild?: boolean }) {
4141
- const Comp = asChild ? Slot.Root : "span";
4142
-
4143
- return (
4144
- <Comp
4145
- data-slot="badge"
4146
- data-variant={variant}
4147
- className={cn(badgeVariants({ variant }), className)}
4148
- {...props}
4149
- />
4150
- );
4151
- }
4152
-
4153
- export { Badge, badgeVariants };
4154
- `,"components/ui/button-group.tsx":`import { cva, type VariantProps } from "class-variance-authority";
4155
- import { Slot } from "radix-ui";
4156
-
4157
- import { cn } from "@/lib/utils";
4158
- import { Separator } from "@/components/ui/separator";
4159
-
4160
- const buttonGroupVariants = cva(
4161
- "flex w-fit items-stretch has-[>[data-slot=button-group]]:gap-2 [&>*]:focus-visible:relative [&>*]:focus-visible:z-10 has-[select[aria-hidden=true]:last-child]:[&>[data-slot=select-trigger]:last-of-type]:rounded-r-md [&>[data-slot=select-trigger]:not([class*='w-'])]:w-fit [&>input]:flex-1",
4162
- {
4163
- variants: {
4164
- orientation: {
4165
- horizontal:
4166
- "[&>*:not(:first-child)]:rounded-l-none [&>*:not(:first-child)]:border-l-0 [&>*:not(:last-child)]:rounded-r-none",
4167
- vertical:
4168
- "flex-col [&>*:not(:first-child)]:rounded-t-none [&>*:not(:first-child)]:border-t-0 [&>*:not(:last-child)]:rounded-b-none",
4169
- },
4170
- },
4171
- defaultVariants: {
4172
- orientation: "horizontal",
4173
- },
4174
- },
4175
- );
4176
-
4177
- function ButtonGroup({
4178
- className,
4179
- orientation,
4180
- ...props
4181
- }: React.ComponentProps<"div"> & VariantProps<typeof buttonGroupVariants>) {
4182
- return (
4183
- <div
4184
- role="group"
4185
- data-slot="button-group"
4186
- data-orientation={orientation}
4187
- className={cn(buttonGroupVariants({ orientation }), className)}
4188
- {...props}
4189
- />
4190
- );
4191
- }
4192
-
4193
- function ButtonGroupText({
4194
- className,
4195
- asChild = false,
4196
- ...props
4197
- }: React.ComponentProps<"div"> & {
4198
- asChild?: boolean;
4199
- }) {
4200
- const Comp = asChild ? Slot.Root : "div";
4201
-
4202
- return (
4203
- <Comp
4204
- className={cn(
4205
- "flex items-center gap-2 rounded-md border bg-muted px-4 text-sm font-medium shadow-xs [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4",
4206
- className,
4207
- )}
4208
- {...props}
4209
- />
4210
- );
4211
- }
4212
-
4213
- function ButtonGroupSeparator({
4214
- className,
4215
- orientation = "vertical",
4216
- ...props
4217
- }: React.ComponentProps<typeof Separator>) {
4218
- return (
4219
- <Separator
4220
- data-slot="button-group-separator"
4221
- orientation={orientation}
4222
- className={cn(
4223
- "relative m-0! self-stretch bg-input data-[orientation=vertical]:h-auto",
4224
- className,
4225
- )}
4226
- {...props}
4227
- />
4228
- );
4229
- }
4230
-
4231
- export { ButtonGroup, ButtonGroupSeparator, ButtonGroupText, buttonGroupVariants };
4232
- `,"components/ui/button.tsx":`import * as React from "react";
4233
- import { cva, type VariantProps } from "class-variance-authority";
4234
- import { Slot } from "radix-ui";
4235
-
4236
- import { cn } from "@/lib/utils";
4237
-
4238
- const buttonVariants = cva(
4239
- "inline-flex shrink-0 items-center justify-center gap-2 rounded-md text-sm font-medium whitespace-nowrap transition-all outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:pointer-events-none disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
4240
- {
4241
- variants: {
4242
- variant: {
4243
- default: "bg-primary text-primary-foreground hover:bg-primary/90",
4244
- destructive:
4245
- "bg-destructive text-white hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:bg-destructive/60 dark:focus-visible:ring-destructive/40",
4246
- outline:
4247
- "border bg-background shadow-xs hover:bg-accent hover:text-accent-foreground dark:border-input dark:bg-input/30 dark:hover:bg-input/50",
4248
- secondary: "bg-secondary text-secondary-foreground hover:bg-secondary/80",
4249
- ghost: "hover:bg-accent hover:text-accent-foreground dark:hover:bg-accent/50",
4250
- link: "text-primary underline-offset-4 hover:underline",
4251
- },
4252
- size: {
4253
- default: "h-9 px-4 py-2 has-[>svg]:px-3",
4254
- xs: "h-6 gap-1 rounded-md px-2 text-xs has-[>svg]:px-1.5 [&_svg:not([class*='size-'])]:size-3",
4255
- sm: "h-8 gap-1.5 rounded-md px-3 has-[>svg]:px-2.5",
4256
- lg: "h-10 rounded-md px-6 has-[>svg]:px-4",
4257
- icon: "size-9",
4258
- "icon-xs": "size-6 rounded-md [&_svg:not([class*='size-'])]:size-3",
4259
- "icon-sm": "size-8",
4260
- "icon-lg": "size-10",
4261
- },
4262
- },
4263
- defaultVariants: {
4264
- variant: "default",
4265
- size: "default",
4266
- },
4267
- },
4268
- );
4269
-
4270
- function Button({
4271
- className,
4272
- variant = "default",
4273
- size = "default",
4274
- asChild = false,
4275
- ...props
4276
- }: React.ComponentProps<"button"> &
4277
- VariantProps<typeof buttonVariants> & {
4278
- asChild?: boolean;
4279
- }) {
4280
- const Comp = asChild ? Slot.Root : "button";
4281
-
4282
- return (
4283
- <Comp
4284
- data-slot="button"
4285
- data-variant={variant}
4286
- data-size={size}
4287
- className={cn(buttonVariants({ variant, size, className }))}
4288
- {...props}
4289
- />
4290
- );
4291
- }
4292
-
4293
- export { Button, buttonVariants };
4294
- `,"components/ui/collapsible.tsx":`"use client";
4295
-
4296
- import { Collapsible as CollapsiblePrimitive } from "radix-ui";
4297
-
4298
- function Collapsible({ ...props }: React.ComponentProps<typeof CollapsiblePrimitive.Root>) {
4299
- return <CollapsiblePrimitive.Root data-slot="collapsible" {...props} />;
4300
- }
4301
-
4302
- function CollapsibleTrigger({
4303
- ...props
4304
- }: React.ComponentProps<typeof CollapsiblePrimitive.CollapsibleTrigger>) {
4305
- return <CollapsiblePrimitive.CollapsibleTrigger data-slot="collapsible-trigger" {...props} />;
4306
- }
4307
-
4308
- function CollapsibleContent({
4309
- ...props
4310
- }: React.ComponentProps<typeof CollapsiblePrimitive.CollapsibleContent>) {
4311
- return <CollapsiblePrimitive.CollapsibleContent data-slot="collapsible-content" {...props} />;
4312
- }
4313
-
4314
- export { Collapsible, CollapsibleTrigger, CollapsibleContent };
4315
- `,"components/ui/command.tsx":`"use client";
4316
-
4317
- import * as React from "react";
4318
- import { Command as CommandPrimitive } from "cmdk";
4319
- import { SearchIcon } from "lucide-react";
4320
-
4321
- import { cn } from "@/lib/utils";
4322
- import {
4323
- Dialog,
4324
- DialogContent,
4325
- DialogDescription,
4326
- DialogHeader,
4327
- DialogTitle,
4328
- } from "@/components/ui/dialog";
4329
-
4330
- function Command({ className, ...props }: React.ComponentProps<typeof CommandPrimitive>) {
4331
- return (
4332
- <CommandPrimitive
4333
- data-slot="command"
4334
- className={cn(
4335
- "flex h-full w-full flex-col overflow-hidden rounded-md bg-popover text-popover-foreground",
4336
- className,
4337
- )}
4338
- {...props}
4339
- />
4340
- );
4341
- }
4342
-
4343
- function CommandDialog({
4344
- title = "Command Palette",
4345
- description = "Search for a command to run...",
4346
- children,
4347
- className,
4348
- showCloseButton = true,
4349
- ...props
4350
- }: React.ComponentProps<typeof Dialog> & {
4351
- title?: string;
4352
- description?: string;
4353
- className?: string;
4354
- showCloseButton?: boolean;
4355
- }) {
4356
- return (
4357
- <Dialog {...props}>
4358
- <DialogHeader className="sr-only">
4359
- <DialogTitle>{title}</DialogTitle>
4360
- <DialogDescription>{description}</DialogDescription>
4361
- </DialogHeader>
4362
- <DialogContent
4363
- className={cn("overflow-hidden p-0", className)}
4364
- showCloseButton={showCloseButton}
4365
- >
4366
- <Command className="**:data-[slot=command-input-wrapper]:h-12 [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground [&_[cmdk-group]]:px-2 [&_[cmdk-group]:not([hidden])_~[cmdk-group]]:pt-0 [&_[cmdk-input-wrapper]_svg]:h-5 [&_[cmdk-input-wrapper]_svg]:w-5 [&_[cmdk-input]]:h-12 [&_[cmdk-item]]:px-2 [&_[cmdk-item]]:py-3 [&_[cmdk-item]_svg]:h-5 [&_[cmdk-item]_svg]:w-5">
4367
- {children}
4368
- </Command>
4369
- </DialogContent>
4370
- </Dialog>
4371
- );
4372
- }
4373
-
4374
- function CommandInput({
4375
- className,
4376
- ...props
4377
- }: React.ComponentProps<typeof CommandPrimitive.Input>) {
4378
- return (
4379
- <div data-slot="command-input-wrapper" className="flex h-9 items-center gap-2 border-b px-3">
4380
- <SearchIcon className="size-4 shrink-0 opacity-50" />
4381
- <CommandPrimitive.Input
4382
- data-slot="command-input"
4383
- className={cn(
4384
- "flex h-10 w-full rounded-md bg-transparent py-3 text-sm outline-hidden placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50",
4385
- className,
4386
- )}
4387
- {...props}
4388
- />
4389
- </div>
4390
- );
4391
- }
4392
-
4393
- function CommandList({ className, ...props }: React.ComponentProps<typeof CommandPrimitive.List>) {
4394
- return (
4395
- <CommandPrimitive.List
4396
- data-slot="command-list"
4397
- className={cn("max-h-[300px] scroll-py-1 overflow-x-hidden overflow-y-auto", className)}
4398
- {...props}
4399
- />
4400
- );
4401
- }
4402
-
4403
- function CommandEmpty({ ...props }: React.ComponentProps<typeof CommandPrimitive.Empty>) {
4404
- return (
4405
- <CommandPrimitive.Empty
4406
- data-slot="command-empty"
4407
- className="py-6 text-center text-sm"
4408
- {...props}
4409
- />
4410
- );
4411
- }
4412
-
4413
- function CommandGroup({
4414
- className,
4415
- ...props
4416
- }: React.ComponentProps<typeof CommandPrimitive.Group>) {
4417
- return (
4418
- <CommandPrimitive.Group
4419
- data-slot="command-group"
4420
- className={cn(
4421
- "overflow-hidden p-1 text-foreground [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground",
4422
- className,
4423
- )}
4424
- {...props}
4425
- />
4426
- );
4427
- }
4428
-
4429
- function CommandSeparator({
4430
- className,
4431
- ...props
4432
- }: React.ComponentProps<typeof CommandPrimitive.Separator>) {
4433
- return (
4434
- <CommandPrimitive.Separator
4435
- data-slot="command-separator"
4436
- className={cn("-mx-1 h-px bg-border", className)}
4437
- {...props}
4438
- />
4439
- );
4440
- }
4441
-
4442
- function CommandItem({ className, ...props }: React.ComponentProps<typeof CommandPrimitive.Item>) {
4443
- return (
4444
- <CommandPrimitive.Item
4445
- data-slot="command-item"
4446
- className={cn(
4447
- "relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none data-[disabled=true]:pointer-events-none data-[disabled=true]:opacity-50 data-[selected=true]:bg-accent data-[selected=true]:text-accent-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 [&_svg:not([class*='text-'])]:text-muted-foreground",
4448
- className,
4449
- )}
4450
- {...props}
4451
- />
4452
- );
4453
- }
4454
-
4455
- function CommandShortcut({ className, ...props }: React.ComponentProps<"span">) {
4456
- return (
4457
- <span
4458
- data-slot="command-shortcut"
4459
- className={cn("ml-auto text-xs tracking-widest text-muted-foreground", className)}
4460
- {...props}
4461
- />
4462
- );
4463
- }
4464
-
4465
- export {
4466
- Command,
4467
- CommandDialog,
4468
- CommandInput,
4469
- CommandList,
4470
- CommandEmpty,
4471
- CommandGroup,
4472
- CommandItem,
4473
- CommandShortcut,
4474
- CommandSeparator,
4475
- };
4476
- `,"components/ui/dialog.tsx":`"use client";
4477
-
4478
- import * as React from "react";
4479
- import { XIcon } from "lucide-react";
4480
- import { Dialog as DialogPrimitive } from "radix-ui";
4481
-
4482
- import { cn } from "@/lib/utils";
4483
- import { Button } from "@/components/ui/button";
4484
-
4485
- function Dialog({ ...props }: React.ComponentProps<typeof DialogPrimitive.Root>) {
4486
- return <DialogPrimitive.Root data-slot="dialog" {...props} />;
4487
- }
4488
-
4489
- function DialogTrigger({ ...props }: React.ComponentProps<typeof DialogPrimitive.Trigger>) {
4490
- return <DialogPrimitive.Trigger data-slot="dialog-trigger" {...props} />;
4491
- }
4492
-
4493
- function DialogPortal({ ...props }: React.ComponentProps<typeof DialogPrimitive.Portal>) {
4494
- return <DialogPrimitive.Portal data-slot="dialog-portal" {...props} />;
4495
- }
4496
-
4497
- function DialogClose({ ...props }: React.ComponentProps<typeof DialogPrimitive.Close>) {
4498
- return <DialogPrimitive.Close data-slot="dialog-close" {...props} />;
4499
- }
4500
-
4501
- function DialogOverlay({
4502
- className,
4503
- ...props
4504
- }: React.ComponentProps<typeof DialogPrimitive.Overlay>) {
4505
- return (
4506
- <DialogPrimitive.Overlay
4507
- data-slot="dialog-overlay"
4508
- className={cn(
4509
- "fixed inset-0 z-50 bg-black/50 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:animate-in data-[state=open]:fade-in-0",
4510
- className,
4511
- )}
4512
- {...props}
4513
- />
4514
- );
4515
- }
4516
-
4517
- function DialogContent({
2864
+ function ButtonGroup({
4518
2865
  className,
4519
- children,
4520
- showCloseButton = true,
2866
+ orientation,
4521
2867
  ...props
4522
- }: React.ComponentProps<typeof DialogPrimitive.Content> & {
4523
- showCloseButton?: boolean;
4524
- }) {
4525
- return (
4526
- <DialogPortal data-slot="dialog-portal">
4527
- <DialogOverlay />
4528
- <DialogPrimitive.Content
4529
- data-slot="dialog-content"
4530
- className={cn(
4531
- "fixed top-[50%] left-[50%] z-50 grid w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-4 rounded-lg border bg-background p-6 shadow-lg duration-200 outline-none data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95 sm:max-w-lg",
4532
- className,
4533
- )}
4534
- {...props}
4535
- >
4536
- {children}
4537
- {showCloseButton && (
4538
- <DialogPrimitive.Close
4539
- data-slot="dialog-close"
4540
- className="absolute top-4 right-4 rounded-xs opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:ring-2 focus:ring-ring focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4"
4541
- >
4542
- <XIcon />
4543
- <span className="sr-only">Close</span>
4544
- </DialogPrimitive.Close>
4545
- )}
4546
- </DialogPrimitive.Content>
4547
- </DialogPortal>
4548
- );
4549
- }
4550
-
4551
- function DialogHeader({ className, ...props }: React.ComponentProps<"div">) {
2868
+ }: React.ComponentProps<"div"> & VariantProps<typeof buttonGroupVariants>) {
4552
2869
  return (
4553
2870
  <div
4554
- data-slot="dialog-header"
4555
- className={cn("flex flex-col gap-2 text-center sm:text-left", className)}
2871
+ role="group"
2872
+ data-slot="button-group"
2873
+ data-orientation={orientation}
2874
+ className={cn(buttonGroupVariants({ orientation }), className)}
4556
2875
  {...props}
4557
2876
  />
4558
2877
  );
4559
2878
  }
4560
2879
 
4561
- function DialogFooter({
2880
+ function ButtonGroupText({
4562
2881
  className,
4563
- showCloseButton = false,
4564
- children,
2882
+ asChild = false,
4565
2883
  ...props
4566
2884
  }: React.ComponentProps<"div"> & {
4567
- showCloseButton?: boolean;
2885
+ asChild?: boolean;
4568
2886
  }) {
2887
+ const Comp = asChild ? Slot.Root : "div";
2888
+
4569
2889
  return (
4570
- <div
4571
- data-slot="dialog-footer"
4572
- className={cn("flex flex-col-reverse gap-2 sm:flex-row sm:justify-end", className)}
4573
- {...props}
4574
- >
4575
- {children}
4576
- {showCloseButton && (
4577
- <DialogPrimitive.Close asChild>
4578
- <Button variant="outline">Close</Button>
4579
- </DialogPrimitive.Close>
2890
+ <Comp
2891
+ className={cn(
2892
+ "flex items-center gap-2 rounded-md border bg-muted px-4 text-sm font-medium shadow-xs [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4",
2893
+ className,
4580
2894
  )}
4581
- </div>
2895
+ {...props}
2896
+ />
4582
2897
  );
4583
2898
  }
4584
2899
 
4585
- function DialogTitle({ className, ...props }: React.ComponentProps<typeof DialogPrimitive.Title>) {
2900
+ function ButtonGroupSeparator({
2901
+ className,
2902
+ orientation = "vertical",
2903
+ ...props
2904
+ }: React.ComponentProps<typeof Separator>) {
4586
2905
  return (
4587
- <DialogPrimitive.Title
4588
- data-slot="dialog-title"
4589
- className={cn("text-lg leading-none font-semibold", className)}
2906
+ <Separator
2907
+ data-slot="button-group-separator"
2908
+ orientation={orientation}
2909
+ className={cn(
2910
+ "relative m-0! self-stretch bg-input data-[orientation=vertical]:h-auto",
2911
+ className,
2912
+ )}
4590
2913
  {...props}
4591
2914
  />
4592
2915
  );
4593
2916
  }
4594
2917
 
4595
- function DialogDescription({
2918
+ export { ButtonGroup, ButtonGroupSeparator, ButtonGroupText, buttonGroupVariants };
2919
+ `,"components/ui/button.tsx":`import * as React from "react";
2920
+ import { cva, type VariantProps } from "class-variance-authority";
2921
+ import { Slot } from "radix-ui";
2922
+
2923
+ import { cn } from "@/lib/utils";
2924
+
2925
+ const buttonVariants = cva(
2926
+ "inline-flex shrink-0 items-center justify-center gap-2 rounded-md text-sm font-medium whitespace-nowrap transition-all outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:pointer-events-none disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
2927
+ {
2928
+ variants: {
2929
+ variant: {
2930
+ default: "bg-primary text-primary-foreground hover:bg-primary/90",
2931
+ destructive:
2932
+ "bg-destructive text-white hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:bg-destructive/60 dark:focus-visible:ring-destructive/40",
2933
+ outline:
2934
+ "border bg-background shadow-xs hover:bg-accent hover:text-accent-foreground dark:border-input dark:bg-input/30 dark:hover:bg-input/50",
2935
+ secondary: "bg-secondary text-secondary-foreground hover:bg-secondary/80",
2936
+ ghost: "hover:bg-accent hover:text-accent-foreground dark:hover:bg-accent/50",
2937
+ link: "text-primary underline-offset-4 hover:underline",
2938
+ },
2939
+ size: {
2940
+ default: "h-9 px-4 py-2 has-[>svg]:px-3",
2941
+ xs: "h-6 gap-1 rounded-md px-2 text-xs has-[>svg]:px-1.5 [&_svg:not([class*='size-'])]:size-3",
2942
+ sm: "h-8 gap-1.5 rounded-md px-3 has-[>svg]:px-2.5",
2943
+ lg: "h-10 rounded-md px-6 has-[>svg]:px-4",
2944
+ icon: "size-9",
2945
+ "icon-xs": "size-6 rounded-md [&_svg:not([class*='size-'])]:size-3",
2946
+ "icon-sm": "size-8",
2947
+ "icon-lg": "size-10",
2948
+ },
2949
+ },
2950
+ defaultVariants: {
2951
+ variant: "default",
2952
+ size: "default",
2953
+ },
2954
+ },
2955
+ );
2956
+
2957
+ function Button({
4596
2958
  className,
2959
+ variant = "default",
2960
+ size = "default",
2961
+ asChild = false,
4597
2962
  ...props
4598
- }: React.ComponentProps<typeof DialogPrimitive.Description>) {
2963
+ }: React.ComponentProps<"button"> &
2964
+ VariantProps<typeof buttonVariants> & {
2965
+ asChild?: boolean;
2966
+ }) {
2967
+ const Comp = asChild ? Slot.Root : "button";
2968
+
4599
2969
  return (
4600
- <DialogPrimitive.Description
4601
- data-slot="dialog-description"
4602
- className={cn("text-sm text-muted-foreground", className)}
2970
+ <Comp
2971
+ data-slot="button"
2972
+ data-variant={variant}
2973
+ data-size={size}
2974
+ className={cn(buttonVariants({ variant, size, className }))}
4603
2975
  {...props}
4604
2976
  />
4605
2977
  );
4606
2978
  }
4607
2979
 
4608
- export {
4609
- Dialog,
4610
- DialogClose,
4611
- DialogContent,
4612
- DialogDescription,
4613
- DialogFooter,
4614
- DialogHeader,
4615
- DialogOverlay,
4616
- DialogPortal,
4617
- DialogTitle,
4618
- DialogTrigger,
4619
- };
2980
+ export { Button, buttonVariants };
2981
+ `,"components/ui/collapsible.tsx":`"use client";
2982
+
2983
+ import { Collapsible as CollapsiblePrimitive } from "radix-ui";
2984
+
2985
+ function Collapsible({ ...props }: React.ComponentProps<typeof CollapsiblePrimitive.Root>) {
2986
+ return <CollapsiblePrimitive.Root data-slot="collapsible" {...props} />;
2987
+ }
2988
+
2989
+ function CollapsibleTrigger({
2990
+ ...props
2991
+ }: React.ComponentProps<typeof CollapsiblePrimitive.CollapsibleTrigger>) {
2992
+ return <CollapsiblePrimitive.CollapsibleTrigger data-slot="collapsible-trigger" {...props} />;
2993
+ }
2994
+
2995
+ function CollapsibleContent({
2996
+ ...props
2997
+ }: React.ComponentProps<typeof CollapsiblePrimitive.CollapsibleContent>) {
2998
+ return <CollapsiblePrimitive.CollapsibleContent data-slot="collapsible-content" {...props} />;
2999
+ }
3000
+
3001
+ export { Collapsible, CollapsibleTrigger, CollapsibleContent };
4620
3002
  `,"components/ui/dropdown-menu.tsx":`"use client";
4621
3003
 
4622
3004
  import * as React from "react";
@@ -4845,44 +3227,6 @@ export {
4845
3227
  DropdownMenuSubTrigger,
4846
3228
  DropdownMenuSubContent,
4847
3229
  };
4848
- `,"components/ui/hover-card.tsx":`"use client";
4849
-
4850
- import * as React from "react";
4851
- import { HoverCard as HoverCardPrimitive } from "radix-ui";
4852
-
4853
- import { cn } from "@/lib/utils";
4854
-
4855
- function HoverCard({ ...props }: React.ComponentProps<typeof HoverCardPrimitive.Root>) {
4856
- return <HoverCardPrimitive.Root data-slot="hover-card" {...props} />;
4857
- }
4858
-
4859
- function HoverCardTrigger({ ...props }: React.ComponentProps<typeof HoverCardPrimitive.Trigger>) {
4860
- return <HoverCardPrimitive.Trigger data-slot="hover-card-trigger" {...props} />;
4861
- }
4862
-
4863
- function HoverCardContent({
4864
- className,
4865
- align = "center",
4866
- sideOffset = 4,
4867
- ...props
4868
- }: React.ComponentProps<typeof HoverCardPrimitive.Content>) {
4869
- return (
4870
- <HoverCardPrimitive.Portal data-slot="hover-card-portal">
4871
- <HoverCardPrimitive.Content
4872
- data-slot="hover-card-content"
4873
- align={align}
4874
- sideOffset={sideOffset}
4875
- className={cn(
4876
- "z-50 w-64 origin-(--radix-hover-card-content-transform-origin) rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-hidden data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95",
4877
- className,
4878
- )}
4879
- {...props}
4880
- />
4881
- </HoverCardPrimitive.Portal>
4882
- );
4883
- }
4884
-
4885
- export { HoverCard, HoverCardTrigger, HoverCardContent };
4886
3230
  `,"components/ui/input-group.tsx":`"use client";
4887
3231
 
4888
3232
  import * as React from "react";
@@ -5580,22 +3924,6 @@ function Separator({
5580
3924
  }
5581
3925
 
5582
3926
  export { Separator };
5583
- `,"components/ui/spinner.tsx":`import { Loader2Icon } from "lucide-react";
5584
-
5585
- import { cn } from "@/lib/utils";
5586
-
5587
- function Spinner({ className, ...props }: React.ComponentProps<"svg">) {
5588
- return (
5589
- <Loader2Icon
5590
- role="status"
5591
- aria-label="Loading"
5592
- className={cn("size-4 animate-spin", className)}
5593
- {...props}
5594
- />
5595
- );
5596
- }
5597
-
5598
- export { Spinner };
5599
3927
  `,"components/ui/textarea.tsx":`import * as React from "react";
5600
3928
 
5601
3929
  import { cn } from "@/lib/utils";
@@ -5667,6 +3995,155 @@ function TooltipContent({
5667
3995
  }
5668
3996
 
5669
3997
  export { Tooltip, TooltipTrigger, TooltipContent, TooltipProvider };
3998
+ `,"components/ui/trace.tsx":`import * as React from "react";
3999
+ import { cn } from "@/lib/utils";
4000
+
4001
+ import { Collapsible, CollapsibleContent, CollapsibleTrigger } from "@/components/ui/collapsible";
4002
+ import { ChevronRightIcon } from "lucide-react";
4003
+
4004
+ function Trace({ className, ...props }: React.ComponentProps<"div">) {
4005
+ return (
4006
+ <div
4007
+ data-slot="trace"
4008
+ className={cn(
4009
+ "flex w-full min-w-0 flex-col gap-2 *:has-[>[data-slot=trace-line]]:flex *:has-[>[data-slot=trace-line]]:w-fit *:has-[>[data-slot=trace-line]]:max-w-full *:has-[>[data-slot=trace-line]]:min-w-0 *:has-[>[data-slot=trace-line]]:rounded-md *:has-[>[data-slot=trace-line]]:text-left *:has-[>[data-slot=trace-line]]:outline-none *:has-[>[data-slot=trace-line]]:focus-visible:ring-3 *:has-[>[data-slot=trace-line]]:focus-visible:ring-ring/50",
4010
+ className,
4011
+ )}
4012
+ {...props}
4013
+ />
4014
+ );
4015
+ }
4016
+
4017
+ function TraceLine({
4018
+ className,
4019
+ status,
4020
+ ...props
4021
+ }: React.ComponentProps<"span"> & {
4022
+ status?: "running" | "error" | "pending";
4023
+ }) {
4024
+ return (
4025
+ <span
4026
+ data-slot="trace-line"
4027
+ data-status={status}
4028
+ className={cn(
4029
+ "flex w-fit max-w-full min-w-0 items-center gap-2 text-sm text-muted-foreground transition-colors in-[a,button]:cursor-pointer in-[a:hover,button:hover]:text-foreground data-[status=error]:text-destructive data-[status=error]:in-[a:hover,button:hover]:text-destructive data-[status=pending]:opacity-60 data-[status=running]:*:data-[slot=trace-title]:shimmer",
4030
+ className,
4031
+ )}
4032
+ {...props}
4033
+ />
4034
+ );
4035
+ }
4036
+
4037
+ function TraceIcon({ className, ...props }: React.ComponentProps<"span">) {
4038
+ return (
4039
+ <span
4040
+ data-slot="trace-icon"
4041
+ aria-hidden="true"
4042
+ className={cn(
4043
+ "flex size-4 shrink-0 items-center justify-center [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 [[data-slot=trace-title]~&]:-ml-1",
4044
+ className,
4045
+ )}
4046
+ {...props}
4047
+ />
4048
+ );
4049
+ }
4050
+
4051
+ function TraceTitle({ className, ...props }: React.ComponentProps<"span">) {
4052
+ return (
4053
+ <span
4054
+ data-slot="trace-title"
4055
+ className={cn("min-w-0 truncate motion-reduce:shimmer-none", className)}
4056
+ {...props}
4057
+ />
4058
+ );
4059
+ }
4060
+
4061
+ function TraceDescription({ className, ...props }: React.ComponentProps<"span">) {
4062
+ return (
4063
+ <span
4064
+ data-slot="trace-description"
4065
+ className={cn("shrink-0 text-muted-foreground/70 tabular-nums", className)}
4066
+ {...props}
4067
+ />
4068
+ );
4069
+ }
4070
+
4071
+ function TraceCollapsible({
4072
+ className,
4073
+ ...props
4074
+ }: Omit<React.ComponentProps<typeof Collapsible>, "asChild" | "open"> &
4075
+ (
4076
+ | { open?: undefined }
4077
+ | {
4078
+ open: boolean;
4079
+ onOpenChange: NonNullable<React.ComponentProps<typeof Collapsible>["onOpenChange"]>;
4080
+ }
4081
+ )) {
4082
+ return (
4083
+ <Collapsible
4084
+ data-slot="trace-collapsible"
4085
+ className={cn("flex w-full min-w-0 flex-col", className)}
4086
+ {...props}
4087
+ />
4088
+ );
4089
+ }
4090
+
4091
+ function TraceCollapsibleTrigger({
4092
+ className,
4093
+ children,
4094
+ ...props
4095
+ }: Omit<React.ComponentProps<typeof CollapsibleTrigger>, "asChild">) {
4096
+ return (
4097
+ <CollapsibleTrigger
4098
+ data-slot="trace-collapsible-trigger"
4099
+ className={cn(
4100
+ "group/trace-collapsible-trigger flex w-fit max-w-full min-w-0 cursor-pointer items-center gap-1 rounded-md text-left text-muted-foreground transition-colors outline-none hover:text-foreground focus-visible:ring-3 focus-visible:ring-ring/50 has-[[data-status=error]]:text-destructive",
4101
+ className,
4102
+ )}
4103
+ {...props}
4104
+ >
4105
+ {children}
4106
+ <TraceIcon className="transition-transform group-aria-expanded/trace-collapsible-trigger:rotate-90">
4107
+ <ChevronRightIcon />
4108
+ </TraceIcon>
4109
+ </CollapsibleTrigger>
4110
+ );
4111
+ }
4112
+
4113
+ function TraceCollapsibleContent({
4114
+ className,
4115
+ children,
4116
+ ...props
4117
+ }: Omit<React.ComponentProps<typeof CollapsibleContent>, "asChild">) {
4118
+ return (
4119
+ <CollapsibleContent
4120
+ data-slot="trace-collapsible-content"
4121
+ className="min-w-0 overflow-hidden duration-200 [--radix-accordion-content-height:var(--radix-collapsible-content-height)] data-open:animate-accordion-down data-closed:animate-accordion-up"
4122
+ {...props}
4123
+ >
4124
+ <div
4125
+ data-slot="trace-collapsible-content-inner"
4126
+ className={cn(
4127
+ "mt-2 mb-1 ml-[calc(--spacing(2)-1px)] min-w-0 border-l pr-1 pl-4 leading-relaxed wrap-break-word text-muted-foreground",
4128
+ className,
4129
+ )}
4130
+ >
4131
+ {children}
4132
+ </div>
4133
+ </CollapsibleContent>
4134
+ );
4135
+ }
4136
+
4137
+ export {
4138
+ Trace,
4139
+ TraceLine,
4140
+ TraceIcon,
4141
+ TraceTitle,
4142
+ TraceDescription,
4143
+ TraceCollapsible,
4144
+ TraceCollapsibleTrigger,
4145
+ TraceCollapsibleContent,
4146
+ };
5670
4147
  `,"components.json":`{
5671
4148
  "$schema": "https://ui.shadcn.com/schema.json",
5672
4149
  "style": "new-york",
@@ -5742,6 +4219,7 @@ export function proxy(request: NextRequest) {
5742
4219
  "esModuleInterop": true,
5743
4220
  "module": "esnext",
5744
4221
  "moduleResolution": "Bundler",
4222
+ "types": ["node", "eve/workflow-modules"],
5745
4223
  "resolveJsonModule": true,
5746
4224
  "isolatedModules": true,
5747
4225
  "jsx": "react-jsx",
@@ -6142,7 +4620,7 @@ export const auth = betterAuth({
6142
4620
  "resolveJsonModule": true,
6143
4621
  "isolatedModules": true,
6144
4622
  "jsx": "react-jsx",
6145
- "types": ["vite/client"],
4623
+ "types": ["node", "vite/client", "eve/workflow-modules"],
6146
4624
  "paths": {
6147
4625
  "@/*": ["./*"]
6148
4626
  }
@@ -6160,4 +4638,4 @@ export default defineConfig({
6160
4638
  resolve: { tsconfigPaths: true },
6161
4639
  plugins: [tailwindcss(), tanstackStart({ srcDirectory: "app" }), viteReact(), nitro()],
6162
4640
  });
6163
- `},WEB_APP_TEMPLATE_PACKAGE_JSON={scripts:{build:`next build`,"build:eve":`eve build`,dev:`next dev`,"dev:eve":`eve dev`,start:`next start`,"start:eve":`eve start`,typecheck:`tsc --noEmit -p tsconfig.json`},dependencies:{"@radix-ui/react-use-controllable-state":`1.2.2`,"@shadcn/react":`0.3.1`,"@shikijs/core":`3.23.0`,"@shikijs/engine-javascript":`3.23.0`,"@shikijs/engine-oniguruma":`3.23.0`,"@streamdown/cjk":`1.0.3`,"@streamdown/code":`1.1.1`,"@streamdown/math":`1.0.2`,"@streamdown/mermaid":`1.0.2`,"@tailwindcss/postcss":`4.3.0`,"class-variance-authority":`0.7.1`,clsx:`2.1.1`,cmdk:`1.1.1`,"lucide-react":`1.16.0`,motion:`12.40.0`,nanoid:`5.1.11`,next:`16.3.6`,"radix-ui":`1.4.3`,react:`19.2.6`,"react-dom":`19.2.6`,shiki:`3.23.0`,streamdown:`2.5.0`,"tailwind-merge":`3.6.0`,tailwindcss:`4.3.0`,"use-stick-to-bottom":`1.1.4`,zod:`4.5.4`},devDependencies:{"@types/node":`26`,"@types/react":`19.2.15`,"@types/react-dom":`19.2.3`,typescript:`6.0.3`}};export{WEB_APP_SIGN_IN_WITH_VERCEL_TEMPLATE_FILES,WEB_APP_TANSTACK_TEMPLATE_FILES,WEB_APP_TEMPLATE_FILES,WEB_APP_TEMPLATE_PACKAGE_JSON,WEB_CHANNEL_TEMPLATES};
4641
+ `},WEB_APP_TEMPLATE_PACKAGE_JSON={scripts:{build:`next build`,"build:eve":`eve build`,dev:`next dev`,"dev:eve":`eve dev`,start:`next start`,"start:eve":`eve start`,typecheck:`tsc --noEmit -p tsconfig.json`},dependencies:{"@shadcn/react":`0.3.1`,"@shikijs/core":`3.23.0`,"@shikijs/engine-javascript":`3.23.0`,"@shikijs/engine-oniguruma":`3.23.0`,"@streamdown/cjk":`1.0.3`,"@streamdown/code":`1.1.1`,"@streamdown/math":`1.0.2`,"@streamdown/mermaid":`1.0.2`,"@tailwindcss/postcss":`4.3.0`,"class-variance-authority":`0.7.1`,clsx:`2.1.1`,"lucide-react":`1.16.0`,nanoid:`5.1.11`,next:`16.3.6`,"radix-ui":`1.4.3`,react:`19.2.6`,"react-dom":`19.2.6`,shiki:`3.23.0`,streamdown:`2.5.0`,"tailwind-merge":`3.6.0`,tailwindcss:`4.3.0`,"tw-animate-css":`1.4.0`,"use-stick-to-bottom":`1.1.4`,zod:`4.5.4`},devDependencies:{"@types/node":`26`,"@types/react":`19.2.15`,"@types/react-dom":`19.2.3`,typescript:`6.0.3`}};export{WEB_APP_SIGN_IN_WITH_VERCEL_TEMPLATE_FILES,WEB_APP_TANSTACK_TEMPLATE_FILES,WEB_APP_TEMPLATE_FILES,WEB_APP_TEMPLATE_PACKAGE_JSON,WEB_CHANNEL_TEMPLATES};