eve 0.67.2 → 0.69.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 (1116) hide show
  1. package/CHANGELOG.md +120 -0
  2. package/bin/eve.js +15 -0
  3. package/dist/src/_virtual/_rolldown/runtime.js +1 -1
  4. package/dist/src/approval/definition.d.ts +19 -5
  5. package/dist/src/channel/adapter.d.ts +2 -0
  6. package/dist/src/channel/auth/oidc.js +1 -1
  7. package/dist/src/channel/channel-address.d.ts +1 -4
  8. package/dist/src/channel/channel-address.js +1 -1
  9. package/dist/src/channel/channel-operations.d.ts +4 -11
  10. package/dist/src/channel/channel-operations.js +1 -1
  11. package/dist/src/channel/compiled-channel.d.ts +0 -2
  12. package/dist/src/channel/compiled-channel.js +2 -2
  13. package/dist/src/channel/cross-channel-receive.d.ts +1 -3
  14. package/dist/src/channel/cross-channel-receive.js +1 -1
  15. package/dist/src/channel/forwarded-principal.js +1 -1
  16. package/dist/src/channel/schedule-auth.d.ts +16 -0
  17. package/dist/src/channel/schedule-auth.js +1 -1
  18. package/dist/src/channel/session-callback.js +1 -1
  19. package/dist/src/channel/session.d.ts +3 -8
  20. package/dist/src/channel/session.js +1 -1
  21. package/dist/src/channel/task-card.d.ts +121 -0
  22. package/dist/src/channel/task-card.js +1 -0
  23. package/dist/src/channel/types.d.ts +12 -54
  24. package/dist/src/chunks/{use-eve-agent-DXcE_8Ja.js → use-eve-agent-D_5129A9.js} +295 -205
  25. package/dist/src/chunks/{use-eve-agent-D4HVZBjn.js → use-eve-agent-Dab2MnT2.js} +295 -205
  26. package/dist/src/cli/commands/info.d.ts +11 -0
  27. package/dist/src/cli/commands/info.js +1 -1
  28. package/dist/src/cli/commands/init-agent-workspace.js +1 -1
  29. package/dist/src/cli/commands/init.js +1 -1
  30. package/dist/src/cli/dev/command-options.d.ts +3 -2
  31. package/dist/src/cli/dev/command.js +1 -1
  32. package/dist/src/cli/dev/local-server-process.js +1 -1
  33. package/dist/src/cli/dev/tui/blocks.d.ts +19 -18
  34. package/dist/src/cli/dev/tui/blocks.js +3 -3
  35. package/dist/src/cli/dev/tui/command-typeahead.d.ts +3 -6
  36. package/dist/src/cli/dev/tui/diagnostic-presentation.d.ts +10 -0
  37. package/dist/src/cli/dev/tui/diagnostic-presentation.js +3 -2
  38. package/dist/src/cli/dev/tui/prompt-placeholder.d.ts +2 -0
  39. package/dist/src/cli/dev/tui/prompt-placeholder.js +1 -0
  40. package/dist/src/cli/dev/tui/rail.d.ts +1 -1
  41. package/dist/src/cli/dev/tui/runner.d.ts +25 -2
  42. package/dist/src/cli/dev/tui/runner.js +3 -3
  43. package/dist/src/cli/dev/tui/status-line.d.ts +4 -2
  44. package/dist/src/cli/dev/tui/status-line.js +1 -1
  45. package/dist/src/cli/dev/tui/subagent-pump.d.ts +44 -52
  46. package/dist/src/cli/dev/tui/subagent-pump.js +1 -1
  47. package/dist/src/cli/dev/tui/task-activity.d.ts +55 -0
  48. package/dist/src/cli/dev/tui/task-activity.js +1 -0
  49. package/dist/src/cli/dev/tui/terminal-renderer.d.ts +13 -30
  50. package/dist/src/cli/dev/tui/terminal-renderer.js +11 -11
  51. package/dist/src/cli/dev/tui/theme.d.ts +1 -1
  52. package/dist/src/cli/dev/tui/theme.js +1 -1
  53. package/dist/src/cli/dev/tui/tool-block-groups.d.ts +6 -9
  54. package/dist/src/cli/dev/tui/tool-block-groups.js +1 -1
  55. package/dist/src/cli/dev/tui/tool-presentation.d.ts +16 -3
  56. package/dist/src/cli/dev/tui/tool-presentation.js +1 -1
  57. package/dist/src/cli/dev/tui/traces/trace-conversation.js +3 -1
  58. package/dist/src/cli/dev/tui/traces/trace-view.js +1 -1
  59. package/dist/src/cli/dev/tui/tui.js +1 -1
  60. package/dist/src/cli/dev/tui/types.d.ts +11 -5
  61. package/dist/src/cli/dev/ui-options.d.ts +2 -2
  62. package/dist/src/cli/option-parsers.d.ts +3 -1
  63. package/dist/src/cli/option-parsers.js +1 -1
  64. package/dist/src/cli/ui/terminal-text.js +1 -1
  65. package/dist/src/client/agent-info-schema.d.ts +150 -9
  66. package/dist/src/client/agent-info-schema.js +1 -1
  67. package/dist/src/client/agent-session.d.ts +28 -0
  68. package/dist/src/client/agent-session.js +1 -0
  69. package/dist/src/client/eve-agent-store-helpers.d.ts +1 -1
  70. package/dist/src/client/eve-agent-store-helpers.js +2 -2
  71. package/dist/src/client/eve-agent-store.js +1 -1
  72. package/dist/src/client/index.d.ts +2 -1
  73. package/dist/src/client/index.js +1 -1
  74. package/dist/src/client/message-action-parts.js +1 -1
  75. package/dist/src/client/message-reducer.js +1 -1
  76. package/dist/src/client/message-task-parts.d.ts +8 -0
  77. package/dist/src/client/message-task-parts.js +1 -0
  78. package/dist/src/client/optimistic-message-submissions.js +1 -1
  79. package/dist/src/client/session-controls.d.ts +0 -1
  80. package/dist/src/client/session-utils.d.ts +10 -0
  81. package/dist/src/client/session-utils.js +1 -1
  82. package/dist/src/client/session.d.ts +8 -16
  83. package/dist/src/client/session.js +1 -1
  84. package/dist/src/client/stream-version.js +1 -1
  85. package/dist/src/client/types.d.ts +2 -4
  86. package/dist/src/compiled/.vendor-stamp.json +3 -2
  87. package/dist/src/compiled/@eve/catalog/index.js +1 -1
  88. package/dist/src/compiled/@photon-ai/chat-adapter-imessage/index.js +55 -55
  89. package/dist/src/compiled/@vercel/blob/index.js +1 -1
  90. package/dist/src/compiled/@vercel/connect/LICENSE +202 -0
  91. package/dist/src/compiled/@vercel/connect/authorization-details.d.ts +11 -0
  92. package/dist/src/compiled/@vercel/connect/authorization.d.ts +47 -0
  93. package/dist/src/compiled/@vercel/connect/connector.d.ts +32 -0
  94. package/dist/src/compiled/@vercel/connect/index.d.ts +5 -0
  95. package/dist/src/compiled/@vercel/connect/index.js +26 -0
  96. package/dist/src/compiled/@vercel/connect/installation.d.ts +48 -0
  97. package/dist/src/compiled/@vercel/connect/token.d.ts +137 -0
  98. package/dist/src/compiled/@vercel/oidc/index.js +1 -1
  99. package/dist/src/compiled/@workflow/core/runtime.js +3 -3
  100. package/dist/src/compiled/@workflow/world-vercel/index.js +1 -1
  101. package/dist/src/compiler/bundled-extension.d.ts +7 -1
  102. package/dist/src/compiler/bundled-extension.js +1 -1
  103. package/dist/src/compiler/default-tool-policy.d.ts +2 -2
  104. package/dist/src/compiler/default-tool-policy.js +1 -1
  105. package/dist/src/compiler/development-extensions.js +1 -1
  106. package/dist/src/compiler/extension-compatibility.d.ts +54 -18
  107. package/dist/src/compiler/extension-compatibility.js +1 -1
  108. package/dist/src/compiler/extension-mount-bindings.d.ts +5 -0
  109. package/dist/src/compiler/extension-mount-bindings.js +1 -0
  110. package/dist/src/compiler/load-binding-namespace.d.ts +10 -2
  111. package/dist/src/compiler/load-binding-namespace.js +1 -1
  112. package/dist/src/compiler/manifest.d.ts +19 -17
  113. package/dist/src/compiler/manifest.js +1 -1
  114. package/dist/src/compiler/module-lifecycle.d.ts +2 -2
  115. package/dist/src/compiler/module-lifecycle.js +1 -1
  116. package/dist/src/compiler/module-map.d.ts +1 -1
  117. package/dist/src/compiler/module-map.js +3 -3
  118. package/dist/src/compiler/normalize-manifest-helpers.d.ts +18 -1
  119. package/dist/src/compiler/normalize-manifest-helpers.js +1 -1
  120. package/dist/src/compiler/normalize-manifest-types.d.ts +2 -0
  121. package/dist/src/compiler/normalize-manifest.js +1 -1
  122. package/dist/src/compiler/normalize-subagent.js +1 -1
  123. package/dist/src/compiler/normalize-tool.js +1 -1
  124. package/dist/src/compiler/project-sources.d.ts +4 -0
  125. package/dist/src/compiler/project-sources.js +1 -1
  126. package/dist/src/compiler/remote-agent-node.js +1 -1
  127. package/dist/src/compiler/source-graph.d.ts +5 -0
  128. package/dist/src/compiler/source-graph.js +1 -1
  129. package/dist/src/computer-use/extension/extension.d.ts +2 -0
  130. package/dist/src/computer-use/extension/extension.js +1 -0
  131. package/dist/src/computer-use/extension/lib/command-failure.d.ts +7 -0
  132. package/dist/src/computer-use/extension/lib/command-failure.js +2 -0
  133. package/dist/src/{extensions/code → computer-use}/extension/lib/computer-use-sandbox.d.ts +8 -0
  134. package/dist/src/{extensions/code → computer-use}/extension/lib/computer-use-sandbox.js +3 -3
  135. package/dist/src/{extensions/code → computer-use}/extension/lib/computer-use.d.ts +2 -0
  136. package/dist/src/{extensions/code → computer-use}/extension/lib/computer-use.js +2 -1
  137. package/dist/src/computer-use/extension/lib/sandbox.d.ts +1 -0
  138. package/dist/src/computer-use/extension/lib/sandbox.js +1 -0
  139. package/dist/src/computer-use/extension/lib/shell.d.ts +1 -0
  140. package/dist/src/computer-use/extension/lib/shell.js +1 -0
  141. package/dist/src/computer-use/extension/tools/computer_use.js +1 -0
  142. package/dist/src/computer-use/tools.d.ts +1 -0
  143. package/dist/src/computer-use/tools.js +1 -0
  144. package/dist/src/context/build-dynamic-tools.js +1 -1
  145. package/dist/src/context/dynamic-subagent-lifecycle.d.ts +5 -0
  146. package/dist/src/context/dynamic-subagent-lifecycle.js +1 -1
  147. package/dist/src/context/dynamic-tool-lifecycle.d.ts +1 -1
  148. package/dist/src/context/dynamic-tool-lifecycle.js +1 -1
  149. package/dist/src/context/dynamic-tool-metadata.d.ts +1 -1
  150. package/dist/src/context/hook-lifecycle.d.ts +4 -3
  151. package/dist/src/context/hook-lifecycle.js +1 -1
  152. package/dist/src/context/key-names.d.ts +0 -1
  153. package/dist/src/context/key-names.js +1 -1
  154. package/dist/src/context/keys.d.ts +8 -14
  155. package/dist/src/context/keys.js +1 -1
  156. package/dist/src/context/memory-lifecycle.js +1 -1
  157. package/dist/src/context/memory-tools.d.ts +0 -1
  158. package/dist/src/context/provider.d.ts +1 -3
  159. package/dist/src/context/run-step.d.ts +2 -3
  160. package/dist/src/context/run-step.js +1 -1
  161. package/dist/src/context/serialize.js +1 -1
  162. package/dist/src/discover/bundled-extension.js +1 -1
  163. package/dist/src/discover/discover-agent.js +1 -1
  164. package/dist/src/discover/extensions.d.ts +0 -7
  165. package/dist/src/discover/extensions.js +1 -1
  166. package/dist/src/discover/manifest.d.ts +4 -0
  167. package/dist/src/evals/assertions/run.d.ts +4 -3
  168. package/dist/src/evals/assertions/run.js +1 -1
  169. package/dist/src/evals/index.d.ts +1 -1
  170. package/dist/src/evals/match.d.ts +4 -4
  171. package/dist/src/evals/mock-model.js +1 -1
  172. package/dist/src/evals/runner/derive-run-facts.d.ts +3 -3
  173. package/dist/src/evals/runner/derive-run-facts.js +1 -1
  174. package/dist/src/evals/runner/reporters/assertion-scores.d.ts +19 -0
  175. package/dist/src/evals/runner/reporters/assertion-scores.js +1 -0
  176. package/dist/src/evals/runner/reporters/braintrust.js +1 -1
  177. package/dist/src/evals/runner/reporters/datadog-client.d.ts +123 -0
  178. package/dist/src/evals/runner/reporters/datadog-client.js +4 -0
  179. package/dist/src/evals/runner/reporters/datadog.d.ts +9 -98
  180. package/dist/src/evals/runner/reporters/datadog.js +2 -3
  181. package/dist/src/evals/session-content.js +1 -1
  182. package/dist/src/evals/session.d.ts +4 -4
  183. package/dist/src/evals/session.js +2 -2
  184. package/dist/src/evals/types.d.ts +18 -15
  185. package/dist/src/eve-channel/create-request.d.ts +5 -4
  186. package/dist/src/eve-channel/create-request.js +1 -1
  187. package/dist/src/eve-channel/index.d.ts +0 -9
  188. package/dist/src/eve-channel/index.js +1 -1
  189. package/dist/src/eve-channel/request.d.ts +3 -7
  190. package/dist/src/eve-channel/request.js +1 -1
  191. package/dist/src/eve-channel/support.d.ts +15 -5
  192. package/dist/src/eve-channel/support.js +1 -1
  193. package/dist/src/eve-channel/turn-policy-request.d.ts +2 -0
  194. package/dist/src/eve-channel/turn-policy-request.js +1 -0
  195. package/dist/src/eve-channel/types.d.ts +4 -0
  196. package/dist/src/execution/agent-sessions/context.d.ts +60 -0
  197. package/dist/src/execution/agent-sessions/context.js +1 -0
  198. package/dist/src/{subagents/remote-dispatch.d.ts → execution/agent-sessions/remote.d.ts} +17 -40
  199. package/dist/src/execution/agent-sessions/remote.js +1 -0
  200. package/dist/src/execution/agent-sessions/requests.d.ts +20 -0
  201. package/dist/src/execution/agent-sessions/requests.js +1 -0
  202. package/dist/src/execution/agent-sessions/session.d.ts +12 -0
  203. package/dist/src/execution/agent-sessions/session.js +1 -0
  204. package/dist/src/execution/agent-sessions/steps.d.ts +59 -0
  205. package/dist/src/execution/agent-sessions/steps.js +1 -0
  206. package/dist/src/execution/agent-sessions/target.d.ts +45 -0
  207. package/dist/src/execution/agent-sessions/target.js +1 -0
  208. package/dist/src/execution/agent-sessions/usage.d.ts +18 -0
  209. package/dist/src/execution/agent-sessions/usage.js +1 -0
  210. package/dist/src/execution/authorization-callback-match.d.ts +2 -4
  211. package/dist/src/execution/authorization-callback-match.js +1 -1
  212. package/dist/src/execution/cancel-descendant-turns-step.d.ts +1 -5
  213. package/dist/src/execution/cancel-descendant-turns-step.js +1 -1
  214. package/dist/src/execution/cancelled-model-call-batch.js +1 -1
  215. package/dist/src/execution/connection-announcement.d.ts +7 -0
  216. package/dist/src/execution/connection-announcement.js +4 -0
  217. package/dist/src/execution/continuation-conflict-step.d.ts +2 -3
  218. package/dist/src/execution/continuation-conflict-step.js +1 -1
  219. package/dist/src/execution/coordination-dispatch-shared.d.ts +9 -27
  220. package/dist/src/execution/coordination-dispatch-shared.js +1 -1
  221. package/dist/src/execution/coordination-dispatch-step.d.ts +3 -2
  222. package/dist/src/execution/coordination-dispatch-step.js +1 -1
  223. package/dist/src/execution/create-session-step.d.ts +0 -1
  224. package/dist/src/execution/create-session-step.js +1 -1
  225. package/dist/src/execution/deliver-payloads.js +1 -1
  226. package/dist/src/execution/durable-session-store.d.ts +0 -1
  227. package/dist/src/execution/dynamic-connections.js +1 -1
  228. package/dist/src/execution/dynamic-workflow/program-step.js +1 -1
  229. package/dist/src/execution/dynamic-workflow/schema.d.ts +1 -3
  230. package/dist/src/execution/dynamic-workflow/schema.js +1 -1
  231. package/dist/src/execution/dynamic-workflow/tool.d.ts +1 -1
  232. package/dist/src/execution/dynamic-workflow/tool.js +1 -1
  233. package/dist/src/execution/dynamic-workflow/workflow.js +1 -1
  234. package/dist/src/execution/forward-session-input.d.ts +4 -0
  235. package/dist/src/execution/forward-session-input.js +1 -0
  236. package/dist/src/execution/legacy-remote-agent/protocol.d.ts +41 -0
  237. package/dist/src/execution/legacy-remote-agent/protocol.js +1 -0
  238. package/dist/src/execution/legacy-session/authorization.js +1 -1
  239. package/dist/src/execution/legacy-session/completion-step.js +1 -1
  240. package/dist/src/execution/legacy-session/inbox.js +1 -1
  241. package/dist/src/execution/legacy-session/input.js +1 -1
  242. package/dist/src/execution/legacy-session/interrupt-step.js +1 -1
  243. package/dist/src/execution/model-call-batching.js +1 -1
  244. package/dist/src/execution/node-step.d.ts +1 -1
  245. package/dist/src/execution/node-step.js +1 -1
  246. package/dist/src/execution/proxied-deliver-step.d.ts +9 -6
  247. package/dist/src/execution/proxied-deliver-step.js +1 -1
  248. package/dist/src/execution/publish-session-events.d.ts +130 -0
  249. package/dist/src/execution/publish-session-events.js +1 -0
  250. package/dist/src/execution/route-child-delivery.d.ts +5 -4
  251. package/dist/src/execution/route-child-delivery.js +1 -3
  252. package/dist/src/execution/runtime-context.js +1 -1
  253. package/dist/src/execution/sandbox/prewarm.js +1 -1
  254. package/dist/src/execution/session/admission.d.ts +1 -12
  255. package/dist/src/execution/session/admission.js +1 -1
  256. package/dist/src/execution/session/entry-input.d.ts +0 -2
  257. package/dist/src/execution/session/entry.js +1 -1
  258. package/dist/src/execution/session/finalization.js +1 -1
  259. package/dist/src/execution/session/handoff-steps.d.ts +13 -2
  260. package/dist/src/execution/session/handoff-steps.js +1 -1
  261. package/dist/src/execution/session/handoff.d.ts +17 -3
  262. package/dist/src/execution/session/handoff.js +1 -1
  263. package/dist/src/execution/session/input-queue.d.ts +27 -28
  264. package/dist/src/execution/session/input-queue.js +1 -1
  265. package/dist/src/execution/session/next-input.d.ts +5 -0
  266. package/dist/src/execution/session/next-input.js +1 -1
  267. package/dist/src/execution/session/pending-turn-state.d.ts +2 -0
  268. package/dist/src/execution/session/pending-turn-state.js +1 -1
  269. package/dist/src/execution/session/principal.d.ts +14 -0
  270. package/dist/src/execution/session/principal.js +1 -0
  271. package/dist/src/execution/session/program.js +1 -1
  272. package/dist/src/execution/session/route-selected-delivery.js +1 -1
  273. package/dist/src/execution/session/state-cursor.d.ts +17 -15
  274. package/dist/src/execution/session/state-cursor.js +1 -1
  275. package/dist/src/execution/session/state-delta.d.ts +33 -0
  276. package/dist/src/execution/session/state-delta.js +1 -0
  277. package/dist/src/execution/session/timeout-steps.js +1 -1
  278. package/dist/src/execution/session/turn-event-handler.d.ts +27 -0
  279. package/dist/src/execution/session/turn-event-handler.js +1 -0
  280. package/dist/src/execution/session/turn-step-result.d.ts +1 -3
  281. package/dist/src/execution/session/turn-step-result.js +1 -1
  282. package/dist/src/execution/session/turn-step-types.d.ts +24 -15
  283. package/dist/src/execution/session/turn-step.d.ts +2 -2
  284. package/dist/src/execution/session/turn-step.js +1 -1
  285. package/dist/src/execution/session/turn-waiting-step.d.ts +4 -0
  286. package/dist/src/execution/session/turn-waiting-step.js +1 -0
  287. package/dist/src/execution/session/turn.d.ts +33 -2
  288. package/dist/src/execution/session/turn.js +1 -1
  289. package/dist/src/execution/session-callback-request.js +1 -1
  290. package/dist/src/execution/session-event-stream.d.ts +33 -0
  291. package/dist/src/execution/session-event-stream.js +1 -0
  292. package/dist/src/execution/session-inbox/inbox.d.ts +2 -0
  293. package/dist/src/execution/session-inbox/inbox.js +1 -1
  294. package/dist/src/execution/session-inbox/protocol.js +1 -1
  295. package/dist/src/execution/session-inbox/release-step.js +1 -1
  296. package/dist/src/execution/session-inbox/resume.js +1 -1
  297. package/dist/src/execution/session-workflow-tool-run.d.ts +11 -2
  298. package/dist/src/execution/session-workflow-tool-run.js +1 -1
  299. package/dist/src/execution/session.d.ts +0 -1
  300. package/dist/src/execution/session.js +2 -2
  301. package/dist/src/execution/settle-cancelled-turn-step.d.ts +21 -9
  302. package/dist/src/execution/settle-cancelled-turn-step.js +1 -1
  303. package/dist/src/execution/stable-workflow-names.d.ts +0 -1
  304. package/dist/src/execution/stable-workflow-names.js +1 -1
  305. package/dist/src/execution/tasks/calls.d.ts +42 -0
  306. package/dist/src/execution/tasks/calls.js +1 -0
  307. package/dist/src/execution/tasks/model-step.d.ts +58 -0
  308. package/dist/src/execution/tasks/model-step.js +1 -0
  309. package/dist/src/execution/tasks/render.d.ts +66 -0
  310. package/dist/src/execution/tasks/render.js +8 -0
  311. package/dist/src/execution/tasks/session.d.ts +19 -0
  312. package/dist/src/execution/tasks/session.js +1 -0
  313. package/dist/src/execution/tasks/start.d.ts +34 -0
  314. package/dist/src/execution/tasks/start.js +1 -0
  315. package/dist/src/execution/tasks/steps.d.ts +31 -0
  316. package/dist/src/execution/tasks/steps.js +1 -0
  317. package/dist/src/execution/tasks/table.d.ts +192 -0
  318. package/dist/src/execution/tasks/table.js +1 -0
  319. package/dist/src/execution/tasks/task-id-input.d.ts +19 -0
  320. package/dist/src/execution/tasks/task-id-input.js +1 -0
  321. package/dist/src/execution/tasks/tool-entry-point.d.ts +11 -0
  322. package/dist/src/execution/tasks/tool-entry-point.js +1 -0
  323. package/dist/src/execution/tasks/workflow-target.d.ts +2 -0
  324. package/dist/src/execution/tasks/workflow-target.js +1 -1
  325. package/dist/src/execution/terminal-session-completion-step.js +1 -1
  326. package/dist/src/execution/terminal-session-failure-step.js +1 -1
  327. package/dist/src/execution/terminate-child-sessions-step.d.ts +2 -9
  328. package/dist/src/execution/terminate-child-sessions-step.js +1 -1
  329. package/dist/src/execution/tool-auth.js +1 -1
  330. package/dist/src/execution/tools/agent-router-workflow.d.ts +1 -1
  331. package/dist/src/execution/tools/agent-router-workflow.js +1 -1
  332. package/dist/src/execution/tools/agent-router.d.ts +1 -1
  333. package/dist/src/execution/tools/agent-router.js +1 -1
  334. package/dist/src/execution/tools/connection-approval.d.ts +25 -0
  335. package/dist/src/execution/tools/connection-approval.js +1 -0
  336. package/dist/src/execution/tools/connection-search-rank.d.ts +21 -0
  337. package/dist/src/execution/tools/connection-search-rank.js +1 -0
  338. package/dist/src/execution/tools/connection-target.d.ts +13 -0
  339. package/dist/src/execution/tools/connection-target.js +1 -0
  340. package/dist/src/execution/tools/connection-tools.d.ts +10 -0
  341. package/dist/src/execution/tools/connection-tools.js +2 -0
  342. package/dist/src/execution/tools/load-skill.js +1 -1
  343. package/dist/src/execution/tools/workflow/answer.d.ts +10 -4
  344. package/dist/src/execution/tools/workflow/answer.js +1 -1
  345. package/dist/src/execution/tools/workflow/ask.d.ts +73 -10
  346. package/dist/src/execution/tools/workflow/ask.js +1 -1
  347. package/dist/src/execution/tools/workflow/body.d.ts +60 -19
  348. package/dist/src/execution/tools/workflow/body.js +1 -1
  349. package/dist/src/execution/tools/workflow/cancel.d.ts +7 -2
  350. package/dist/src/execution/tools/workflow/cancel.js +1 -1
  351. package/dist/src/execution/tools/workflow/emit-workflow-tool-run-report-step.d.ts +10 -4
  352. package/dist/src/execution/tools/workflow/emit-workflow-tool-run-report-step.js +1 -1
  353. package/dist/src/execution/tools/workflow/{background.d.ts → harness-definition.d.ts} +6 -6
  354. package/dist/src/execution/tools/workflow/harness-definition.js +1 -0
  355. package/dist/src/execution/tools/workflow/interrupt.d.ts +6 -0
  356. package/dist/src/execution/tools/workflow/interrupt.js +1 -0
  357. package/dist/src/execution/tools/workflow/messages.d.ts +135 -10
  358. package/dist/src/execution/tools/workflow/messages.js +1 -1
  359. package/dist/src/execution/tools/workflow/owner-inbox.js +1 -1
  360. package/dist/src/execution/tools/workflow/owner.d.ts +15 -4
  361. package/dist/src/execution/tools/workflow/owner.js +1 -1
  362. package/dist/src/execution/tools/workflow/serve.d.ts +3 -0
  363. package/dist/src/execution/tools/workflow/serve.js +1 -0
  364. package/dist/src/execution/tools/workflow/start.d.ts +18 -11
  365. package/dist/src/execution/tools/workflow/start.js +1 -1
  366. package/dist/src/execution/tools/workflow/step-execution.js +1 -1
  367. package/dist/src/execution/tools/workflow/step.js +1 -1
  368. package/dist/src/execution/tools/workflow/types.d.ts +0 -10
  369. package/dist/src/execution/tools/workflow/withdraw-step.d.ts +31 -0
  370. package/dist/src/execution/tools/workflow/withdraw-step.js +1 -0
  371. package/dist/src/execution/tools/workflow/workflow-owner-blocking.d.ts +3 -5
  372. package/dist/src/execution/tools/workflow/workflow-owner-blocking.js +1 -1
  373. package/dist/src/execution/tools/workflow/workflow.d.ts +3 -3
  374. package/dist/src/execution/tools/workflow/workflow.js +1 -1
  375. package/dist/src/execution/web-fetch/request.js +1 -1
  376. package/dist/src/execution/workflow-callback-url.d.ts +0 -5
  377. package/dist/src/execution/workflow-callback-url.js +1 -1
  378. package/dist/src/execution/workflow-runtime.d.ts +3 -5
  379. package/dist/src/execution/workflow-runtime.js +1 -1
  380. package/dist/src/execution/workflow-webhook-route.js +1 -1
  381. package/dist/src/extensions/code/extension/lib/connect-authentication.js +1 -1
  382. package/dist/src/extensions/code/extension/lib/github-shell.js +1 -1
  383. package/dist/src/extensions/code/extension/lib/prwatch-github.js +1 -1
  384. package/dist/src/extensions/code/extension/lib/sandbox.d.ts +3 -2
  385. package/dist/src/extensions/code/extension/lib/sandbox.js +1 -1
  386. package/dist/src/extensions/code/extension/lib/signed-commit.d.ts +1 -1
  387. package/dist/src/extensions/code/extension/lib/signed-commit.js +2 -2
  388. package/dist/src/extensions/code/tools.d.ts +2 -1
  389. package/dist/src/extensions/code/tools.js +1 -1
  390. package/dist/src/framework/sources/modules/agent.d.ts +1 -0
  391. package/dist/src/framework/sources/modules/agent.js +1 -1
  392. package/dist/src/framework/sources/registry.js +1 -1
  393. package/dist/src/harness/action-presentation.js +1 -1
  394. package/dist/src/harness/action-result-helpers.d.ts +1 -0
  395. package/dist/src/harness/action-result-helpers.js +1 -1
  396. package/dist/src/harness/advertised-tools.d.ts +1 -1
  397. package/dist/src/harness/advertised-tools.js +1 -1
  398. package/dist/src/harness/announcements.d.ts +22 -0
  399. package/dist/src/harness/announcements.js +1 -0
  400. package/dist/src/harness/approval-candidates.d.ts +10 -2
  401. package/dist/src/harness/approval-candidates.js +1 -1
  402. package/dist/src/harness/approval-delivery-coordinator.d.ts +4 -5
  403. package/dist/src/harness/approval-delivery-coordinator.js +1 -1
  404. package/dist/src/harness/approval-recheck.d.ts +7 -0
  405. package/dist/src/harness/approval-recheck.js +1 -0
  406. package/dist/src/harness/authorization-event-fields.d.ts +13 -0
  407. package/dist/src/harness/authorization-event-fields.js +1 -0
  408. package/dist/src/harness/authorization.d.ts +2 -1
  409. package/dist/src/harness/authorization.js +1 -1
  410. package/dist/src/harness/coordination.d.ts +31 -27
  411. package/dist/src/harness/coordination.js +1 -1
  412. package/dist/src/harness/current-messages.d.ts +6 -1
  413. package/dist/src/harness/current-messages.js +1 -1
  414. package/dist/src/harness/emission.d.ts +7 -1
  415. package/dist/src/harness/emission.js +1 -1
  416. package/dist/src/harness/execute-tool.d.ts +4 -15
  417. package/dist/src/harness/hitl/session-limit-input-requests.d.ts +2 -0
  418. package/dist/src/harness/hitl/session-limit-input-requests.js +1 -1
  419. package/dist/src/harness/input-request-resolution.d.ts +5 -2
  420. package/dist/src/harness/input-request-resolution.js +1 -1
  421. package/dist/src/harness/input-requests.js +1 -1
  422. package/dist/src/harness/messages.d.ts +11 -3
  423. package/dist/src/harness/messages.js +1 -1
  424. package/dist/src/harness/nested-actions.d.ts +23 -0
  425. package/dist/src/harness/nested-actions.js +1 -0
  426. package/dist/src/harness/pending-input-batches.d.ts +8 -6
  427. package/dist/src/harness/pending-input-batches.js +1 -1
  428. package/dist/src/harness/provider-tool-history.d.ts +7 -2
  429. package/dist/src/harness/provider-tool-history.js +1 -1
  430. package/dist/src/harness/proxy-input-requests.d.ts +41 -36
  431. package/dist/src/harness/proxy-input-requests.js +1 -1
  432. package/dist/src/harness/session-limit-enforcement.js +1 -1
  433. package/dist/src/harness/stale-input-responses.js +1 -1
  434. package/dist/src/harness/step-hooks.js +1 -1
  435. package/dist/src/harness/tool-loop.js +2 -2
  436. package/dist/src/harness/tool-model-output.js +1 -1
  437. package/dist/src/harness/tool-presentation.js +1 -1
  438. package/dist/src/harness/tools.d.ts +1 -5
  439. package/dist/src/harness/tools.js +1 -1
  440. package/dist/src/harness/turn-tag-state.d.ts +6 -5
  441. package/dist/src/harness/types.d.ts +7 -15
  442. package/dist/src/harness/workflow-dispatch.d.ts +30 -0
  443. package/dist/src/harness/workflow-dispatch.js +1 -0
  444. package/dist/src/harness/workflow-tool-runs.d.ts +5 -65
  445. package/dist/src/harness/workflow-tool-runs.js +1 -1
  446. package/dist/src/instrumentation/ai-sdk-hook-bridge.js +1 -1
  447. package/dist/src/instrumentation/lifecycle.d.ts +5 -2
  448. package/dist/src/instrumentation/lifecycle.js +1 -1
  449. package/dist/src/instrumentation/native-events.d.ts +0 -7
  450. package/dist/src/instrumentation/native-events.js +1 -1
  451. package/dist/src/instrumentation/runtime.d.ts +1 -4
  452. package/dist/src/instrumentation/runtime.js +1 -1
  453. package/dist/src/instrumentation/state.d.ts +0 -6
  454. package/dist/src/instrumentation/state.js +1 -1
  455. package/dist/src/internal/application/package.js +1 -1
  456. package/dist/src/internal/authored-definition/schema-backed.d.ts +10 -0
  457. package/dist/src/internal/authored-definition/schema-backed.js +1 -1
  458. package/dist/src/internal/authored-module-loader.d.ts +12 -6
  459. package/dist/src/internal/authored-module-loader.js +2 -2
  460. package/dist/src/internal/authored-module-map-loader.js +1 -1
  461. package/dist/src/internal/authored-package-boundary.d.ts +3 -0
  462. package/dist/src/internal/authored-package-boundary.js +1 -1
  463. package/dist/src/internal/bundler/extension-mount-plugin.d.ts +14 -0
  464. package/dist/src/internal/bundler/extension-mount-plugin.js +1 -0
  465. package/dist/src/internal/bundler/extension-scope-plugin.d.ts +8 -11
  466. package/dist/src/internal/bundler/extension-scope-plugin.js +2 -3
  467. package/dist/src/internal/invocation/workflow-execution.d.ts +2 -2
  468. package/dist/src/internal/invocation/workflow-execution.js +1 -1
  469. package/dist/src/internal/mount-state.d.ts +1 -0
  470. package/dist/src/internal/mount-state.js +1 -0
  471. package/dist/src/internal/nitro/dev-runtime-artifacts-retention.d.ts +2 -2
  472. package/dist/src/internal/nitro/dev-runtime-artifacts-retention.js +1 -1
  473. package/dist/src/internal/nitro/dev-runtime-artifacts.d.ts +2 -4
  474. package/dist/src/internal/nitro/dev-runtime-artifacts.js +1 -1
  475. package/dist/src/internal/nitro/dev-runtime-generation-metadata.d.ts +13 -0
  476. package/dist/src/internal/nitro/dev-runtime-generation-metadata.js +1 -0
  477. package/dist/src/internal/nitro/development-generation.d.ts +2 -0
  478. package/dist/src/internal/nitro/development-generation.js +1 -1
  479. package/dist/src/internal/nitro/host/build-application.js +1 -1
  480. package/dist/src/internal/nitro/host/create-application-nitro.js +1 -1
  481. package/dist/src/internal/nitro/host/dev-authored-rebuild-coordinator.d.ts +1 -0
  482. package/dist/src/internal/nitro/host/dev-authored-rebuild-coordinator.js +1 -1
  483. package/dist/src/internal/nitro/host/dev-host-fingerprint.js +1 -1
  484. package/dist/src/internal/nitro/host/dev-workflow-world-setup.d.ts +1 -0
  485. package/dist/src/internal/nitro/host/dev-workflow-world-setup.js +1 -1
  486. package/dist/src/internal/nitro/host/extension-capability-requirements.js +1 -1
  487. package/dist/src/internal/nitro/host/start-development-server.js +1 -1
  488. package/dist/src/internal/nitro/host/types.d.ts +2 -0
  489. package/dist/src/internal/nitro/host/workspace-extensions.js +1 -1
  490. package/dist/src/internal/nitro/routes/runtime-stack.js +1 -1
  491. package/dist/src/internal/node-esm-compat-banner.js +1 -1
  492. package/dist/src/internal/workflow/cancel-expired-development-run.d.ts +2 -0
  493. package/dist/src/internal/workflow/cancel-expired-development-run.js +1 -0
  494. package/dist/src/internal/workflow/development-runtime-compatibility.d.ts +12 -0
  495. package/dist/src/internal/workflow/development-runtime-compatibility.js +1 -0
  496. package/dist/src/internal/workflow/development-world-client.js +1 -1
  497. package/dist/src/internal/workflow/development-world-protocol.d.ts +9 -0
  498. package/dist/src/internal/workflow/development-world-server.d.ts +2 -0
  499. package/dist/src/internal/workflow/development-world-server.js +1 -1
  500. package/dist/src/internal/workflow/is-inactive-workflow-run-error.d.ts +2 -0
  501. package/dist/src/internal/workflow/is-inactive-workflow-run-error.js +1 -0
  502. package/dist/src/internal/workflow-bundle/authored-workflow-directives.d.ts +4 -3
  503. package/dist/src/internal/workflow-bundle/authored-workflow-directives.js +1 -1
  504. package/dist/src/internal/workflow-bundle/builder.js +1 -1
  505. package/dist/src/internal/workflow-bundle/dynamic-capability-transform-plugin.js +1 -1
  506. package/dist/src/internal/workflow-bundle/workflow-builders.js +1 -1
  507. package/dist/src/models/auto.d.ts +6 -0
  508. package/dist/src/models/auto.js +2 -2
  509. package/dist/src/protocol/message-version.d.ts +1 -0
  510. package/dist/src/protocol/message-version.js +1 -1
  511. package/dist/src/protocol/message.d.ts +126 -67
  512. package/dist/src/protocol/message.js +2 -2
  513. package/dist/src/protocol/remote-agent-protocol.d.ts +16 -0
  514. package/dist/src/protocol/remote-agent-protocol.js +1 -0
  515. package/dist/src/protocol/routes.d.ts +0 -6
  516. package/dist/src/protocol/routes.js +1 -1
  517. package/dist/src/protocol/task-tools.d.ts +21 -0
  518. package/dist/src/protocol/task-tools.js +1 -0
  519. package/dist/src/public/channels/auth.js +1 -1
  520. package/dist/src/public/channels/chat-sdk/chatSdkChannel.d.ts +25 -16
  521. package/dist/src/public/channels/chat-sdk/chatSdkChannel.js +2 -2
  522. package/dist/src/public/channels/chat-sdk/index.d.ts +1 -1
  523. package/dist/src/public/channels/chat-sdk/input-actions.d.ts +8 -0
  524. package/dist/src/public/channels/chat-sdk/input-actions.js +1 -0
  525. package/dist/src/public/channels/index.d.ts +1 -1
  526. package/dist/src/public/channels/linq/linqChannel.js +1 -1
  527. package/dist/src/public/channels/photon/photonIMessageChannel.js +1 -1
  528. package/dist/src/public/channels/slack/action-status.d.ts +11 -12
  529. package/dist/src/public/channels/slack/action-status.js +1 -1
  530. package/dist/src/public/channels/slack/api.js +1 -1
  531. package/dist/src/public/channels/slack/attachments.js +1 -1
  532. package/dist/src/public/channels/slack/auth.d.ts +3 -0
  533. package/dist/src/public/channels/slack/auth.js +1 -1
  534. package/dist/src/public/channels/slack/connections.d.ts +6 -6
  535. package/dist/src/public/channels/slack/connections.js +1 -1
  536. package/dist/src/public/channels/slack/defaults.d.ts +13 -19
  537. package/dist/src/public/channels/slack/defaults.js +4 -4
  538. package/dist/src/public/channels/slack/hitl.d.ts +22 -13
  539. package/dist/src/public/channels/slack/hitl.js +2 -2
  540. package/dist/src/public/channels/slack/index.d.ts +4 -3
  541. package/dist/src/public/channels/slack/index.js +1 -1
  542. package/dist/src/public/channels/slack/input-response.d.ts +1 -5
  543. package/dist/src/public/channels/slack/input-response.js +1 -1
  544. package/dist/src/public/channels/slack/interaction-cards.js +1 -1
  545. package/dist/src/public/channels/slack/interactions.js +1 -1
  546. package/dist/src/public/channels/slack/renderers.d.ts +76 -0
  547. package/dist/src/public/channels/slack/renderers.js +1 -0
  548. package/dist/src/public/channels/slack/session-operations.d.ts +6 -0
  549. package/dist/src/public/channels/slack/session-operations.js +1 -1
  550. package/dist/src/public/channels/slack/slackChannel.d.ts +47 -103
  551. package/dist/src/public/channels/slack/slackChannel.js +1 -1
  552. package/dist/src/public/channels/slack/task-card.d.ts +24 -0
  553. package/dist/src/public/channels/slack/task-card.js +1 -0
  554. package/dist/src/public/channels/telegram/hitl.d.ts +7 -1
  555. package/dist/src/public/channels/telegram/hitl.js +2 -1
  556. package/dist/src/public/channels/telegram/state.js +1 -1
  557. package/dist/src/public/channels/telegram/telegramChannel.d.ts +5 -0
  558. package/dist/src/public/channels/telegram/telegramChannel.js +1 -1
  559. package/dist/src/public/definitions/channel.d.ts +6 -1
  560. package/dist/src/public/definitions/channel.js +1 -1
  561. package/dist/src/public/definitions/connections/mcp.d.ts +4 -6
  562. package/dist/src/public/definitions/connections/openapi.d.ts +7 -8
  563. package/dist/src/public/definitions/extension.d.ts +2 -2
  564. package/dist/src/public/definitions/extension.js +1 -1
  565. package/dist/src/public/definitions/hook.d.ts +16 -4
  566. package/dist/src/public/definitions/state.d.ts +4 -2
  567. package/dist/src/public/definitions/state.js +1 -1
  568. package/dist/src/public/memory/index.d.ts +0 -1
  569. package/dist/src/public/models/openai/index.d.ts +1 -1
  570. package/dist/src/public/models/openai/index.js +1 -1
  571. package/dist/src/public/schedules/index.d.ts +1 -0
  572. package/dist/src/public/schedules/index.js +1 -1
  573. package/dist/src/public/server/index.d.ts +28 -0
  574. package/dist/src/public/server/index.js +1 -0
  575. package/dist/src/public/tools/index.d.ts +3 -2
  576. package/dist/src/public/tools/index.js +1 -1
  577. package/dist/src/public/tools/no-reply.d.ts +1 -0
  578. package/dist/src/public/tools/no-reply.js +1 -0
  579. package/dist/src/runtime/agent/bootstrap-model-utils.d.ts +6 -7
  580. package/dist/src/runtime/agent/bootstrap-model-utils.js +1 -1
  581. package/dist/src/runtime/agent/bootstrap.d.ts +0 -1
  582. package/dist/src/runtime/agent/bootstrap.js +1 -1
  583. package/dist/src/runtime/agent/mock-model-adapter.js +1 -1
  584. package/dist/src/runtime/agent/mock-model-fixtures.d.ts +1 -1
  585. package/dist/src/runtime/agent/mock-model-fixtures.js +2 -2
  586. package/dist/src/runtime/channels/registry.js +1 -1
  587. package/dist/src/runtime/connections/mcp-client.d.ts +1 -2
  588. package/dist/src/runtime/connections/openapi-client.js +1 -1
  589. package/dist/src/runtime/connections/scoped-authorization.d.ts +1 -1
  590. package/dist/src/runtime/connections/scoped-authorization.js +1 -1
  591. package/dist/src/runtime/connections/tool-result.d.ts +27 -0
  592. package/dist/src/runtime/connections/tool-result.js +2 -0
  593. package/dist/src/runtime/connections/tool-signature.d.ts +14 -0
  594. package/dist/src/runtime/connections/tool-signature.js +1 -0
  595. package/dist/src/runtime/local-dev-capability.js +1 -1
  596. package/dist/src/runtime/prompt/compose.d.ts +1 -3
  597. package/dist/src/runtime/prompt/compose.js +3 -3
  598. package/dist/src/runtime/resolve-agent-graph.js +1 -1
  599. package/dist/src/runtime/resolve-tool.js +1 -1
  600. package/dist/src/runtime/sessions/compiled-agent-cache.js +1 -1
  601. package/dist/src/runtime/sessions/runtime-context-keys.js +1 -1
  602. package/dist/src/runtime/sessions/turn.d.ts +1 -16
  603. package/dist/src/runtime/subagents/dynamic-remote-agent-config.js +1 -1
  604. package/dist/src/runtime/subagents/registry.js +1 -1
  605. package/dist/src/runtime/subagents/workflow-reference.d.ts +6 -3
  606. package/dist/src/runtime/subagents/workflow-reference.js +1 -1
  607. package/dist/src/runtime/subagents/workflow.d.ts +12 -6
  608. package/dist/src/runtime/subagents/workflow.js +1 -1
  609. package/dist/src/runtime/tools/registry.js +1 -1
  610. package/dist/src/self-modification/extension/classify-registry-item.d.ts +3 -0
  611. package/dist/src/self-modification/extension/classify-registry-item.js +1 -1
  612. package/dist/src/self-modification/extension/subagents/agent/agent.d.ts +1 -1
  613. package/dist/src/self-modification/extension/subagents/agent/agent.js +1 -1
  614. package/dist/src/self-modification/extension/subagents/agent/instructions.js +7 -7
  615. package/dist/src/self-modification/extension/subagents/agent/tools/registry_add.js +1 -1
  616. package/dist/src/self-modification/extension/subagents/agent/tools/search_registry.d.ts +2 -0
  617. package/dist/src/self-modification/extension/subagents/agent/tools/search_registry.js +1 -1
  618. package/dist/src/self-modification/extension/subagents/agent/tools/search_traces.js +1 -1
  619. package/dist/src/self-modification/scaffold.d.ts +2 -0
  620. package/dist/src/self-modification/scaffold.js +7 -0
  621. package/dist/src/self-modification/setup.js +1 -7
  622. package/dist/src/setup/boxes/model-capabilities.d.ts +2 -2
  623. package/dist/src/setup/boxes/model-capabilities.js +1 -1
  624. package/dist/src/setup/boxes/select-model.js +1 -1
  625. package/dist/src/setup/integrations/shopify/templates.d.ts +1 -1
  626. package/dist/src/setup/integrations/shopify/templates.js +31 -19
  627. package/dist/src/setup/integrations/web/setup.d.ts +0 -2
  628. package/dist/src/setup/integrations/web/setup.js +3 -3
  629. package/dist/src/setup/scaffold/create/agent-paths.d.ts +5 -0
  630. package/dist/src/setup/scaffold/create/agent-paths.js +1 -0
  631. package/dist/src/setup/scaffold/create/instructions-template.d.ts +1 -0
  632. package/dist/src/setup/scaffold/create/instructions-template.js +8 -0
  633. package/dist/src/setup/scaffold/create/project.js +3 -10
  634. package/dist/src/setup/scaffold/create/web-template.d.ts +1 -1
  635. package/dist/src/setup/scaffold/create/web-template.js +1 -1
  636. package/dist/src/shared/action-request-name.d.ts +3 -0
  637. package/dist/src/shared/action-request-name.js +1 -0
  638. package/dist/src/shared/action-types.d.ts +49 -21
  639. package/dist/src/shared/action-types.js +1 -1
  640. package/dist/src/shared/agent-definition.d.ts +0 -7
  641. package/dist/src/shared/chatgpt-model.d.ts +1 -1
  642. package/dist/src/shared/chatgpt-model.js +1 -1
  643. package/dist/src/shared/connection-types.d.ts +2 -3
  644. package/dist/src/shared/default-agent-model.d.ts +10 -1
  645. package/dist/src/shared/default-agent-model.js +1 -1
  646. package/dist/src/shared/extension-mount.d.ts +2 -0
  647. package/dist/src/shared/extension-mount.js +1 -0
  648. package/dist/src/shared/format-duration.d.ts +2 -0
  649. package/dist/src/shared/format-duration.js +1 -0
  650. package/dist/src/shared/gateway-model-catalog.d.ts +25 -2
  651. package/dist/src/shared/gateway-model-catalog.js +1 -1
  652. package/dist/src/shared/input.d.ts +1 -0
  653. package/dist/src/shared/memory-state.d.ts +1 -0
  654. package/dist/src/shared/memory-state.js +1 -1
  655. package/dist/src/shared/model-helper.d.ts +2 -2
  656. package/dist/src/shared/model-helper.js +1 -1
  657. package/dist/src/shared/model-summary.d.ts +2 -6
  658. package/dist/src/shared/model-summary.js +1 -1
  659. package/dist/src/shared/presentation-text.d.ts +5 -0
  660. package/dist/src/shared/presentation-text.js +1 -1
  661. package/dist/src/shared/serialized-observability-state.d.ts +0 -4
  662. package/dist/src/shared/serialized-observability-state.js +1 -1
  663. package/dist/src/shared/value-delta.d.ts +39 -0
  664. package/dist/src/shared/value-delta.js +1 -0
  665. package/dist/src/subagents/adapter-state.d.ts +0 -2
  666. package/dist/src/subagents/adapter-state.js +1 -1
  667. package/dist/src/subagents/adapter.js +1 -1
  668. package/dist/src/subagents/callback-route.js +1 -1
  669. package/dist/src/subagents/event-proxy-step.d.ts +16 -29
  670. package/dist/src/subagents/event-proxy-step.js +1 -1
  671. package/dist/src/subagents/hitl-proxy.d.ts +35 -17
  672. package/dist/src/subagents/hitl-proxy.js +1 -1
  673. package/dist/src/subagents/invocation.d.ts +1 -2
  674. package/dist/src/subagents/parent-notification.d.ts +2 -1
  675. package/dist/src/subagents/parent-notification.js +1 -1
  676. package/dist/src/subagents/token-budget.d.ts +8 -9
  677. package/dist/src/subagents/token-budget.js +1 -1
  678. package/dist/src/subagents/tool.d.ts +6 -12
  679. package/dist/src/subagents/tool.js +1 -1
  680. package/dist/src/svelte/index.js +1 -1
  681. package/dist/src/svelte/use-eve-agent.js +1 -1
  682. package/dist/src/tools/behavior.d.ts +5 -5
  683. package/dist/src/tools/definition.d.ts +58 -14
  684. package/dist/src/tools/definition.js +1 -1
  685. package/dist/src/tools/durable-callbacks.d.ts +1 -1
  686. package/dist/src/tools/dynamic.d.ts +6 -0
  687. package/dist/src/tools/framework/agent-contract.d.ts +2 -5
  688. package/dist/src/tools/framework/agent-contract.js +1 -1
  689. package/dist/src/tools/framework/agent.d.ts +2 -5
  690. package/dist/src/tools/framework/agent.js +1 -1
  691. package/dist/src/tools/framework/connection-tools.d.ts +3 -0
  692. package/dist/src/tools/framework/connection-tools.js +1 -0
  693. package/dist/src/tools/provided/agent-router.d.ts +6 -3
  694. package/dist/src/tools/provided/agent-router.js +1 -1
  695. package/dist/src/{execution/tools → tools/provided}/ask-question-workflow.d.ts +3 -4
  696. package/dist/src/tools/provided/ask-question-workflow.js +1 -0
  697. package/dist/src/tools/provided/ask-question.d.ts +20 -5
  698. package/dist/src/tools/provided/ask-question.js +2 -1
  699. package/dist/src/tools/provided/interrupted.d.ts +18 -0
  700. package/dist/src/tools/provided/interrupted.js +1 -0
  701. package/dist/src/tools/provided/no-reply.d.ts +19 -0
  702. package/dist/src/tools/provided/no-reply.js +1 -0
  703. package/dist/src/tools/provided/sleep-workflow.d.ts +4 -0
  704. package/dist/src/tools/provided/sleep-workflow.js +1 -0
  705. package/dist/src/tools/provided/sleep.d.ts +11 -5
  706. package/dist/src/tools/provided/sleep.js +1 -1
  707. package/dist/src/tools/provided/task-cancel.d.ts +6 -0
  708. package/dist/src/tools/provided/task-cancel.js +1 -0
  709. package/dist/src/tools/provided/task-wait.d.ts +9 -0
  710. package/dist/src/tools/provided/task-wait.js +1 -0
  711. package/dist/src/tools/provided/workflow.d.ts +2 -2
  712. package/dist/src/tools/provided/workflow.js +1 -1
  713. package/dist/src/tools/schema-emission.d.ts +23 -0
  714. package/dist/src/tools/schema-emission.js +1 -0
  715. package/dist/src/tools/schema.d.ts +22 -8
  716. package/dist/src/tools/schema.js +1 -1
  717. package/dist/src/tools/workflow-definition.d.ts +187 -85
  718. package/dist/src/tools/workflow-definition.js +1 -1
  719. package/dist/src/tools/workflow-entry-point.d.ts +3 -0
  720. package/dist/src/tools/workflow-entry-point.js +1 -0
  721. package/dist/src/tracing/agent-action-instrumentation.d.ts +1 -3
  722. package/dist/src/tracing/agent-action-instrumentation.js +1 -1
  723. package/dist/src/tracing/agent-invocation-coordinator.d.ts +9 -18
  724. package/dist/src/tracing/agent-invocation-coordinator.js +1 -1
  725. package/dist/src/tracing/agent-otel-content.d.ts +0 -2
  726. package/dist/src/tracing/agent-otel-content.js +3 -3
  727. package/dist/src/tracing/agent-otel-provider.js +2 -2
  728. package/dist/src/tracing/agent-otel-runtime-context.d.ts +20 -0
  729. package/dist/src/tracing/agent-otel-runtime-context.js +1 -1
  730. package/dist/src/tracing/agent-otel-usage.js +1 -1
  731. package/dist/src/tracing/agent-span-contract.d.ts +1 -1
  732. package/dist/src/tracing/agent-span-contract.js +1 -1
  733. package/dist/src/tracing/agent-span-id-generator.d.ts +0 -1
  734. package/dist/src/tracing/agent-span-id-generator.js +1 -1
  735. package/dist/src/tracing/agent-trace-context-codec.d.ts +1 -2
  736. package/dist/src/tracing/agent-trace-context-codec.js +1 -1
  737. package/dist/src/tracing/agent-trace-context-store.d.ts +2 -27
  738. package/dist/src/tracing/agent-trace-context-store.js +1 -1
  739. package/dist/src/tracing/agent-trace-state.d.ts +1 -19
  740. package/dist/src/tracing/content-attributes.js +1 -1
  741. package/dist/src/tracing/install-instrumentation-runtime.js +1 -1
  742. package/dist/src/vue/index.js +1 -1
  743. package/dist/src/vue/use-eve-agent.js +1 -1
  744. package/docs/agent-config.md +36 -13
  745. package/docs/channels/chat-sdk.mdx +15 -4
  746. package/docs/channels/custom.mdx +89 -17
  747. package/docs/channels/eve.mdx +1 -1
  748. package/docs/channels/mcp.mdx +1 -1
  749. package/docs/channels/overview.mdx +14 -56
  750. package/docs/channels/slack.mdx +230 -35
  751. package/docs/channels/telegram.mdx +2 -0
  752. package/docs/concepts/built-in-tools.md +36 -28
  753. package/docs/concepts/context-control.md +2 -2
  754. package/docs/concepts/execution-model-and-durability.mdx +10 -11
  755. package/docs/concepts/project-structure.mdx +1 -1
  756. package/docs/concepts/sessions-runs-and-streaming.md +67 -47
  757. package/docs/connections/mcp.mdx +4 -4
  758. package/docs/connections/openapi.mdx +2 -2
  759. package/docs/connections/overview.mdx +2 -2
  760. package/docs/evals/assertions.mdx +5 -5
  761. package/docs/evals/cases.mdx +1 -1
  762. package/docs/evals/reporters.mdx +6 -4
  763. package/docs/extensions.md +11 -2
  764. package/docs/guides/auth-and-route-protection.md +1 -1
  765. package/docs/guides/client/streaming.mdx +31 -11
  766. package/docs/guides/deployment/vercel.mdx +1 -1
  767. package/docs/guides/dev-tui.md +13 -3
  768. package/docs/guides/dynamic-capabilities.md +15 -10
  769. package/docs/guides/evaluate.md +29 -2
  770. package/docs/guides/frontend/overview.mdx +5 -7
  771. package/docs/guides/hooks.md +48 -12
  772. package/docs/guides/instrumentation/instrumentation.mdx +2 -0
  773. package/docs/guides/remote-agents.md +12 -14
  774. package/docs/guides/self-modification.md +10 -0
  775. package/docs/install-integrations.mdx +1 -1
  776. package/docs/instructions.mdx +1 -1
  777. package/docs/patterns/multi-tenant-approvals.md +1 -1
  778. package/docs/protocols/ucp.mdx +20 -16
  779. package/docs/reference/cli.md +96 -22
  780. package/docs/reference/typescript-api.md +43 -41
  781. package/docs/schedules.mdx +14 -34
  782. package/docs/subagents/index.mdx +24 -56
  783. package/docs/tools/human-in-the-loop.md +50 -13
  784. package/docs/tools/meta.json +1 -1
  785. package/docs/tools/overview.mdx +79 -59
  786. package/docs/tools/tasks-upgrade.md +201 -0
  787. package/docs/tools/tasks.md +315 -0
  788. package/docs/tools/workflows.mdx +368 -154
  789. package/package.json +41 -14
  790. package/dist/src/channel/activity-renderer.d.ts +0 -21
  791. package/dist/src/channel/activity-renderer.js +0 -1
  792. package/dist/src/channel/activity-sink.d.ts +0 -2
  793. package/dist/src/channel/activity-sink.js +0 -1
  794. package/dist/src/eve-channel/activity-observer-request.d.ts +0 -7
  795. package/dist/src/eve-channel/activity-observer-request.js +0 -1
  796. package/dist/src/eve-channel/delivery-policy-request.d.ts +0 -4
  797. package/dist/src/eve-channel/delivery-policy-request.js +0 -1
  798. package/dist/src/execution/activity-cohort.d.ts +0 -20
  799. package/dist/src/execution/activity-cohort.js +0 -1
  800. package/dist/src/execution/activity-collector.d.ts +0 -12
  801. package/dist/src/execution/activity-collector.js +0 -1
  802. package/dist/src/execution/activity-events.d.ts +0 -8
  803. package/dist/src/execution/activity-events.js +0 -1
  804. package/dist/src/execution/activity-route.d.ts +0 -2
  805. package/dist/src/execution/activity-route.js +0 -1
  806. package/dist/src/execution/activity-work-id.d.ts +0 -9
  807. package/dist/src/execution/activity-work-id.js +0 -1
  808. package/dist/src/execution/activity-work.d.ts +0 -30
  809. package/dist/src/execution/activity-work.js +0 -1
  810. package/dist/src/execution/cancel-indexed-session-tasks-step.d.ts +0 -7
  811. package/dist/src/execution/cancel-indexed-session-tasks-step.js +0 -1
  812. package/dist/src/execution/dispatch-action-failures.d.ts +0 -8
  813. package/dist/src/execution/dispatch-action-failures.js +0 -1
  814. package/dist/src/execution/dispatch-start-operation.d.ts +0 -15
  815. package/dist/src/execution/dispatch-start-operation.js +0 -1
  816. package/dist/src/execution/publish-channel-event.d.ts +0 -23
  817. package/dist/src/execution/publish-channel-event.js +0 -1
  818. package/dist/src/execution/scheduled-launch-delivery.d.ts +0 -7
  819. package/dist/src/execution/scheduled-launch-delivery.js +0 -1
  820. package/dist/src/execution/session/event-sink.d.ts +0 -26
  821. package/dist/src/execution/session/event-sink.js +0 -1
  822. package/dist/src/execution/session-activity-projection.d.ts +0 -16
  823. package/dist/src/execution/session-activity-projection.js +0 -1
  824. package/dist/src/execution/session-activity-renderer-step.d.ts +0 -15
  825. package/dist/src/execution/session-activity-renderer-step.js +0 -1
  826. package/dist/src/execution/session-activity.d.ts +0 -3
  827. package/dist/src/execution/session-activity.js +0 -1
  828. package/dist/src/execution/submit-activity.d.ts +0 -7
  829. package/dist/src/execution/submit-activity.js +0 -1
  830. package/dist/src/execution/task-event-callback.d.ts +0 -12
  831. package/dist/src/execution/task-event-callback.js +0 -1
  832. package/dist/src/execution/task-input-capability.d.ts +0 -4
  833. package/dist/src/execution/task-input-capability.js +0 -1
  834. package/dist/src/execution/task-input-response-route.d.ts +0 -2
  835. package/dist/src/execution/task-input-response-route.js +0 -1
  836. package/dist/src/execution/tasks/child/notify.d.ts +0 -44
  837. package/dist/src/execution/tasks/child/notify.js +0 -1
  838. package/dist/src/execution/tasks/parent/control-shared.d.ts +0 -23
  839. package/dist/src/execution/tasks/parent/control-shared.js +0 -1
  840. package/dist/src/execution/tasks/parent/delegate.d.ts +0 -35
  841. package/dist/src/execution/tasks/parent/delegate.js +0 -1
  842. package/dist/src/execution/tasks/parent/dispatch.d.ts +0 -22
  843. package/dist/src/execution/tasks/parent/dispatch.js +0 -1
  844. package/dist/src/execution/tasks/parent/hitl-proxy-steps.d.ts +0 -27
  845. package/dist/src/execution/tasks/parent/hitl-proxy-steps.js +0 -1
  846. package/dist/src/execution/tasks/parent/run-parent.d.ts +0 -58
  847. package/dist/src/execution/tasks/parent/run-parent.js +0 -1
  848. package/dist/src/execution/tasks/parent/subagent-task-projection.d.ts +0 -26
  849. package/dist/src/execution/tasks/parent/subagent-task-projection.js +0 -1
  850. package/dist/src/execution/tasks/parent/task-cancel.d.ts +0 -12
  851. package/dist/src/execution/tasks/parent/task-cancel.js +0 -1
  852. package/dist/src/execution/tasks/parent/tool-execution.d.ts +0 -45
  853. package/dist/src/execution/tasks/parent/tool-execution.js +0 -1
  854. package/dist/src/execution/terminal-session-event.d.ts +0 -13
  855. package/dist/src/execution/terminal-session-event.js +0 -1
  856. package/dist/src/execution/tools/ask-question-workflow.js +0 -1
  857. package/dist/src/execution/tools/ask-question.d.ts +0 -19
  858. package/dist/src/execution/tools/ask-question.js +0 -2
  859. package/dist/src/execution/tools/connection-search.d.ts +0 -2
  860. package/dist/src/execution/tools/connection-search.js +0 -2
  861. package/dist/src/execution/tools/sleep-workflow.d.ts +0 -3
  862. package/dist/src/execution/tools/sleep-workflow.js +0 -1
  863. package/dist/src/execution/tools/sleep.d.ts +0 -10
  864. package/dist/src/execution/tools/sleep.js +0 -1
  865. package/dist/src/execution/tools/subagent/accept-event-step.d.ts +0 -7
  866. package/dist/src/execution/tools/subagent/accept-event-step.js +0 -1
  867. package/dist/src/execution/tools/subagent/emit-event-step.d.ts +0 -12
  868. package/dist/src/execution/tools/subagent/emit-event-step.js +0 -1
  869. package/dist/src/execution/tools/subagent/invoke-agent.d.ts +0 -42
  870. package/dist/src/execution/tools/subagent/invoke-agent.js +0 -1
  871. package/dist/src/execution/tools/subagent/invoke-preparation.d.ts +0 -44
  872. package/dist/src/execution/tools/subagent/invoke-preparation.js +0 -1
  873. package/dist/src/execution/tools/subagent/invoke-step.d.ts +0 -64
  874. package/dist/src/execution/tools/subagent/invoke-step.js +0 -1
  875. package/dist/src/execution/tools/subagent/receipt-identity.d.ts +0 -11
  876. package/dist/src/execution/tools/subagent/receipt-identity.js +0 -1
  877. package/dist/src/execution/tools/subagent/start.d.ts +0 -51
  878. package/dist/src/execution/tools/subagent/start.js +0 -1
  879. package/dist/src/execution/tools/subagent/steer.d.ts +0 -13
  880. package/dist/src/execution/tools/subagent/steer.js +0 -1
  881. package/dist/src/execution/tools/subagent/task-agent-requests.d.ts +0 -24
  882. package/dist/src/execution/tools/subagent/task-agent-requests.js +0 -1
  883. package/dist/src/execution/tools/subagent/task-cancel.d.ts +0 -10
  884. package/dist/src/execution/tools/subagent/task-cancel.js +0 -1
  885. package/dist/src/execution/tools/tasks.d.ts +0 -3
  886. package/dist/src/execution/tools/tasks.js +0 -1
  887. package/dist/src/execution/tools/workflow/background.js +0 -1
  888. package/dist/src/execution/tools/workflow/workflow-owner-background.d.ts +0 -14
  889. package/dist/src/execution/tools/workflow/workflow-owner-background.js +0 -1
  890. package/dist/src/extensions/code/extension/tools/computer_use.js +0 -1
  891. package/dist/src/harness/background-tools.d.ts +0 -45
  892. package/dist/src/harness/background-tools.js +0 -1
  893. package/dist/src/instrumentation/background-task-runtime.d.ts +0 -18
  894. package/dist/src/instrumentation/background-task-runtime.js +0 -1
  895. package/dist/src/node_modules/.pnpm/@vercel_cli-config@0.3.0/node_modules/@vercel/cli-config/dist/index.js +0 -21
  896. package/dist/src/node_modules/.pnpm/@vercel_cli-exec@1.0.1/node_modules/@vercel/cli-exec/dist/envpath.js +0 -1
  897. package/dist/src/node_modules/.pnpm/@vercel_cli-exec@1.0.1/node_modules/@vercel/cli-exec/dist/errors.js +0 -2
  898. package/dist/src/node_modules/.pnpm/@vercel_cli-exec@1.0.1/node_modules/@vercel/cli-exec/dist/errutils.js +0 -1
  899. package/dist/src/node_modules/.pnpm/@vercel_cli-exec@1.0.1/node_modules/@vercel/cli-exec/dist/exec.js +0 -1
  900. package/dist/src/node_modules/.pnpm/@vercel_cli-exec@1.0.1/node_modules/@vercel/cli-exec/dist/fsutils.js +0 -1
  901. package/dist/src/node_modules/.pnpm/@vercel_cli-exec@1.0.1/node_modules/@vercel/cli-exec/dist/index.js +0 -1
  902. package/dist/src/node_modules/.pnpm/@vercel_cli-exec@1.0.1/node_modules/@vercel/cli-exec/dist/lookup.js +0 -1
  903. package/dist/src/node_modules/.pnpm/@vercel_cli-exec@1.0.1/node_modules/@vercel/cli-exec/dist/safety.js +0 -1
  904. package/dist/src/node_modules/.pnpm/@vercel_connect@2.3.3_@ai-sdk_mcp@2.0.52_zod@4.5.4__@auth_core@0.41.2_@chat-adapter_sla_a37674779346d612fa7d2ca9bd316494/node_modules/@vercel/connect/dist/authorization.js +0 -1
  905. package/dist/src/node_modules/.pnpm/@vercel_connect@2.3.3_@ai-sdk_mcp@2.0.52_zod@4.5.4__@auth_core@0.41.2_@chat-adapter_sla_a37674779346d612fa7d2ca9bd316494/node_modules/@vercel/connect/dist/connector.js +0 -1
  906. package/dist/src/node_modules/.pnpm/@vercel_connect@2.3.3_@ai-sdk_mcp@2.0.52_zod@4.5.4__@auth_core@0.41.2_@chat-adapter_sla_a37674779346d612fa7d2ca9bd316494/node_modules/@vercel/connect/dist/index.js +0 -1
  907. package/dist/src/node_modules/.pnpm/@vercel_connect@2.3.3_@ai-sdk_mcp@2.0.52_zod@4.5.4__@auth_core@0.41.2_@chat-adapter_sla_a37674779346d612fa7d2ca9bd316494/node_modules/@vercel/connect/dist/installation.js +0 -1
  908. package/dist/src/node_modules/.pnpm/@vercel_connect@2.3.3_@ai-sdk_mcp@2.0.52_zod@4.5.4__@auth_core@0.41.2_@chat-adapter_sla_a37674779346d612fa7d2ca9bd316494/node_modules/@vercel/connect/dist/internal/base-url.js +0 -1
  909. package/dist/src/node_modules/.pnpm/@vercel_connect@2.3.3_@ai-sdk_mcp@2.0.52_zod@4.5.4__@auth_core@0.41.2_@chat-adapter_sla_a37674779346d612fa7d2ca9bd316494/node_modules/@vercel/connect/dist/internal/default-scopes.js +0 -1
  910. package/dist/src/node_modules/.pnpm/@vercel_connect@2.3.3_@ai-sdk_mcp@2.0.52_zod@4.5.4__@auth_core@0.41.2_@chat-adapter_sla_a37674779346d612fa7d2ca9bd316494/node_modules/@vercel/connect/dist/internal/env.js +0 -1
  911. package/dist/src/node_modules/.pnpm/@vercel_connect@2.3.3_@ai-sdk_mcp@2.0.52_zod@4.5.4__@auth_core@0.41.2_@chat-adapter_sla_a37674779346d612fa7d2ca9bd316494/node_modules/@vercel/connect/dist/internal/url-validation.js +0 -1
  912. package/dist/src/node_modules/.pnpm/@vercel_connect@2.3.3_@ai-sdk_mcp@2.0.52_zod@4.5.4__@auth_core@0.41.2_@chat-adapter_sla_a37674779346d612fa7d2ca9bd316494/node_modules/@vercel/connect/dist/token.js +0 -1
  913. package/dist/src/node_modules/.pnpm/@vercel_oidc@3.8.9/node_modules/@vercel/oidc/dist/auth-errors.js +0 -1
  914. package/dist/src/node_modules/.pnpm/@vercel_oidc@3.8.9/node_modules/@vercel/oidc/dist/exchange-vercel-oidc-token.js +0 -1
  915. package/dist/src/node_modules/.pnpm/@vercel_oidc@3.8.9/node_modules/@vercel/oidc/dist/get-context.js +0 -1
  916. package/dist/src/node_modules/.pnpm/@vercel_oidc@3.8.9/node_modules/@vercel/oidc/dist/get-vercel-oidc-token-sync.js +0 -1
  917. package/dist/src/node_modules/.pnpm/@vercel_oidc@3.8.9/node_modules/@vercel/oidc/dist/get-vercel-oidc-token-with-refresh.js +0 -2
  918. package/dist/src/node_modules/.pnpm/@vercel_oidc@3.8.9/node_modules/@vercel/oidc/dist/index.js +0 -1
  919. package/dist/src/node_modules/.pnpm/@vercel_oidc@3.8.9/node_modules/@vercel/oidc/dist/oauth.js +0 -1
  920. package/dist/src/node_modules/.pnpm/@vercel_oidc@3.8.9/node_modules/@vercel/oidc/dist/token-error.js +0 -1
  921. package/dist/src/node_modules/.pnpm/@vercel_oidc@3.8.9/node_modules/@vercel/oidc/dist/token-io.js +0 -1
  922. package/dist/src/node_modules/.pnpm/@vercel_oidc@3.8.9/node_modules/@vercel/oidc/dist/token-util.js +0 -2
  923. package/dist/src/node_modules/.pnpm/@vercel_oidc@3.8.9/node_modules/@vercel/oidc/dist/token.js +0 -1
  924. package/dist/src/node_modules/.pnpm/@vercel_oidc@3.8.9/node_modules/@vercel/oidc/dist/verify-vercel-oidc-token.js +0 -1
  925. package/dist/src/node_modules/.pnpm/@vercel_oidc@3.8.9/node_modules/@vercel/oidc/dist/version.js +0 -1
  926. package/dist/src/node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/index.js +0 -1
  927. package/dist/src/node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/enoent.js +0 -1
  928. package/dist/src/node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/parse.js +0 -1
  929. package/dist/src/node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/util/escape.js +0 -1
  930. package/dist/src/node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/util/readShebang.js +0 -1
  931. package/dist/src/node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/util/resolveCommand.js +0 -1
  932. package/dist/src/node_modules/.pnpm/execa@5.1.1/node_modules/execa/index.js +0 -1
  933. package/dist/src/node_modules/.pnpm/execa@5.1.1/node_modules/execa/lib/command.js +0 -1
  934. package/dist/src/node_modules/.pnpm/execa@5.1.1/node_modules/execa/lib/error.js +0 -2
  935. package/dist/src/node_modules/.pnpm/execa@5.1.1/node_modules/execa/lib/kill.js +0 -1
  936. package/dist/src/node_modules/.pnpm/execa@5.1.1/node_modules/execa/lib/promise.js +0 -1
  937. package/dist/src/node_modules/.pnpm/execa@5.1.1/node_modules/execa/lib/stdio.js +0 -1
  938. package/dist/src/node_modules/.pnpm/execa@5.1.1/node_modules/execa/lib/stream.js +0 -1
  939. package/dist/src/node_modules/.pnpm/get-stream@6.0.1/node_modules/get-stream/buffer-stream.js +0 -1
  940. package/dist/src/node_modules/.pnpm/get-stream@6.0.1/node_modules/get-stream/index.js +0 -1
  941. package/dist/src/node_modules/.pnpm/human-signals@2.1.0/node_modules/human-signals/build/src/core.js +0 -1
  942. package/dist/src/node_modules/.pnpm/human-signals@2.1.0/node_modules/human-signals/build/src/main.js +0 -1
  943. package/dist/src/node_modules/.pnpm/human-signals@2.1.0/node_modules/human-signals/build/src/realtime.js +0 -1
  944. package/dist/src/node_modules/.pnpm/human-signals@2.1.0/node_modules/human-signals/build/src/signals.js +0 -1
  945. package/dist/src/node_modules/.pnpm/is-stream@2.0.1/node_modules/is-stream/index.js +0 -1
  946. package/dist/src/node_modules/.pnpm/isexe@2.0.0/node_modules/isexe/index.js +0 -1
  947. package/dist/src/node_modules/.pnpm/isexe@2.0.0/node_modules/isexe/mode.js +0 -1
  948. package/dist/src/node_modules/.pnpm/isexe@2.0.0/node_modules/isexe/windows.js +0 -1
  949. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/index.js +0 -1
  950. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/jwe/compact/decrypt.js +0 -1
  951. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/jwe/compact/encrypt.js +0 -1
  952. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/jwe/flattened/decrypt.js +0 -1
  953. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/jwe/flattened/encrypt.js +0 -1
  954. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/jwe/general/decrypt.js +0 -1
  955. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/jwe/general/encrypt.js +0 -1
  956. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/jwk/embedded.js +0 -1
  957. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/jwk/thumbprint.js +0 -1
  958. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/jwks/local.js +0 -1
  959. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/jwks/remote.js +0 -1
  960. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/jws/compact/sign.js +0 -1
  961. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/jws/compact/verify.js +0 -1
  962. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/jws/flattened/sign.js +0 -1
  963. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/jws/flattened/verify.js +0 -1
  964. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/jws/general/sign.js +0 -1
  965. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/jws/general/verify.js +0 -1
  966. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/jwt/decrypt.js +0 -1
  967. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/jwt/encrypt.js +0 -1
  968. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/jwt/produce.js +0 -1
  969. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/jwt/sign.js +0 -1
  970. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/jwt/unsecured.js +0 -1
  971. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/jwt/verify.js +0 -1
  972. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/key/export.js +0 -1
  973. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/key/generate_key_pair.js +0 -1
  974. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/key/generate_secret.js +0 -1
  975. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/key/import.js +0 -1
  976. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/lib/aesgcmkw.js +0 -1
  977. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/lib/buffer_utils.js +0 -1
  978. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/lib/cek.js +0 -1
  979. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/lib/check_iv_length.js +0 -1
  980. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/lib/check_key_type.js +0 -1
  981. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/lib/check_p2s.js +0 -1
  982. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/lib/crypto_key.js +0 -1
  983. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/lib/decrypt_key_management.js +0 -1
  984. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/lib/encrypt_key_management.js +0 -1
  985. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/lib/epoch.js +0 -1
  986. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/lib/invalid_key_input.js +0 -1
  987. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/lib/is_disjoint.js +0 -1
  988. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/lib/is_jwk.js +0 -1
  989. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/lib/is_object.js +0 -1
  990. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/lib/iv.js +0 -1
  991. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/lib/jwt_claims_set.js +0 -1
  992. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/lib/private_symbols.js +0 -1
  993. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/lib/secs.js +0 -1
  994. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/lib/validate_algorithms.js +0 -1
  995. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/lib/validate_crit.js +0 -1
  996. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/runtime/aeskw.js +0 -1
  997. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/runtime/asn1.js +0 -1
  998. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/runtime/base64url.js +0 -1
  999. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/runtime/cbc_tag.js +0 -1
  1000. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/runtime/check_cek_length.js +0 -1
  1001. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/runtime/check_key_length.js +0 -1
  1002. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/runtime/ciphers.js +0 -1
  1003. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/runtime/decrypt.js +0 -1
  1004. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/runtime/digest.js +0 -1
  1005. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/runtime/dsa_digest.js +0 -1
  1006. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/runtime/ecdhes.js +0 -1
  1007. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/runtime/encrypt.js +0 -1
  1008. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/runtime/fetch_jwks.js +0 -1
  1009. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/runtime/generate.js +0 -1
  1010. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/runtime/get_named_curve.js +0 -1
  1011. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/runtime/get_sign_verify_key.js +0 -1
  1012. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/runtime/hmac_digest.js +0 -1
  1013. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/runtime/is_key_like.js +0 -1
  1014. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/runtime/is_key_object.js +0 -1
  1015. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/runtime/jwk_to_key.js +0 -1
  1016. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/runtime/key_to_jwk.js +0 -1
  1017. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/runtime/node_key.js +0 -1
  1018. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/runtime/normalize_key.js +0 -1
  1019. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/runtime/pbes2kw.js +0 -1
  1020. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/runtime/random.js +0 -1
  1021. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/runtime/rsaes.js +0 -1
  1022. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/runtime/runtime.js +0 -1
  1023. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/runtime/sign.js +0 -1
  1024. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/runtime/timing_safe_equal.js +0 -1
  1025. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/runtime/verify.js +0 -1
  1026. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/runtime/webcrypto.js +0 -1
  1027. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/util/base64url.js +0 -1
  1028. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/util/decode_jwt.js +0 -1
  1029. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/util/decode_protected_header.js +0 -1
  1030. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/util/errors.js +0 -1
  1031. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/util/runtime.js +0 -1
  1032. package/dist/src/node_modules/.pnpm/merge-stream@2.0.0/node_modules/merge-stream/index.js +0 -1
  1033. package/dist/src/node_modules/.pnpm/mimic-fn@2.1.0/node_modules/mimic-fn/index.js +0 -1
  1034. package/dist/src/node_modules/.pnpm/npm-run-path@4.0.1/node_modules/npm-run-path/index.js +0 -1
  1035. package/dist/src/node_modules/.pnpm/onetime@5.1.2/node_modules/onetime/index.js +0 -1
  1036. package/dist/src/node_modules/.pnpm/path-key@3.1.1/node_modules/path-key/index.js +0 -1
  1037. package/dist/src/node_modules/.pnpm/shebang-command@2.0.0/node_modules/shebang-command/index.js +0 -1
  1038. package/dist/src/node_modules/.pnpm/shebang-regex@3.0.0/node_modules/shebang-regex/index.js +0 -1
  1039. package/dist/src/node_modules/.pnpm/signal-exit@3.0.7/node_modules/signal-exit/index.js +0 -1
  1040. package/dist/src/node_modules/.pnpm/signal-exit@3.0.7/node_modules/signal-exit/signals.js +0 -1
  1041. package/dist/src/node_modules/.pnpm/strip-final-newline@2.0.0/node_modules/strip-final-newline/index.js +0 -2
  1042. package/dist/src/node_modules/.pnpm/which@2.0.2/node_modules/which/which.js +0 -1
  1043. package/dist/src/protocol/activity.d.ts +0 -112
  1044. package/dist/src/protocol/activity.js +0 -1
  1045. package/dist/src/protocol/agent-handle-error.d.ts +0 -13
  1046. package/dist/src/protocol/agent-handle-error.js +0 -1
  1047. package/dist/src/public/channels/slack/activity-plan.d.ts +0 -5
  1048. package/dist/src/public/channels/slack/activity-plan.js +0 -1
  1049. package/dist/src/public/channels/slack/activity.d.ts +0 -63
  1050. package/dist/src/public/channels/slack/activity.js +0 -2
  1051. package/dist/src/public/tools/connection-search.d.ts +0 -1
  1052. package/dist/src/public/tools/connection-search.js +0 -1
  1053. package/dist/src/public/tools/task-cancel.d.ts +0 -1
  1054. package/dist/src/public/tools/task-cancel.js +0 -1
  1055. package/dist/src/runtime/prompt/connections.d.ts +0 -9
  1056. package/dist/src/runtime/prompt/connections.js +0 -2
  1057. package/dist/src/shared/boundary-hook-error.d.ts +0 -4
  1058. package/dist/src/shared/boundary-hook-error.js +0 -1
  1059. package/dist/src/shared/empty-delivery.d.ts +0 -3
  1060. package/dist/src/shared/empty-delivery.js +0 -1
  1061. package/dist/src/subagents/agent-handle-errors.d.ts +0 -25
  1062. package/dist/src/subagents/agent-handle-errors.js +0 -1
  1063. package/dist/src/subagents/callback-step.d.ts +0 -11
  1064. package/dist/src/subagents/callback-step.js +0 -1
  1065. package/dist/src/subagents/continuation-bundle.d.ts +0 -13
  1066. package/dist/src/subagents/continuation-bundle.js +0 -1
  1067. package/dist/src/subagents/handle-dispatch.d.ts +0 -65
  1068. package/dist/src/subagents/handle-dispatch.js +0 -1
  1069. package/dist/src/subagents/handles/operation-id.d.ts +0 -15
  1070. package/dist/src/subagents/handles/operation-id.js +0 -1
  1071. package/dist/src/subagents/handles/prompt.d.ts +0 -52
  1072. package/dist/src/subagents/handles/prompt.js +0 -3
  1073. package/dist/src/subagents/handles/query.d.ts +0 -41
  1074. package/dist/src/subagents/handles/query.js +0 -1
  1075. package/dist/src/subagents/handles/state-key.d.ts +0 -8
  1076. package/dist/src/subagents/handles/state-key.js +0 -1
  1077. package/dist/src/subagents/handles/store.d.ts +0 -217
  1078. package/dist/src/subagents/handles/store.js +0 -1
  1079. package/dist/src/subagents/handles/transitions.d.ts +0 -103
  1080. package/dist/src/subagents/handles/transitions.js +0 -1
  1081. package/dist/src/subagents/remote-dispatch.js +0 -1
  1082. package/dist/src/subagents/start-local.d.ts +0 -29
  1083. package/dist/src/subagents/start-local.js +0 -1
  1084. package/dist/src/subagents/start-remote.d.ts +0 -21
  1085. package/dist/src/subagents/start-remote.js +0 -1
  1086. package/dist/src/tasks/delivery-context.d.ts +0 -32
  1087. package/dist/src/tasks/delivery-context.js +0 -4
  1088. package/dist/src/tasks/delivery-policy.d.ts +0 -14
  1089. package/dist/src/tasks/delivery-policy.js +0 -1
  1090. package/dist/src/tasks/json.d.ts +0 -88
  1091. package/dist/src/tasks/json.js +0 -1
  1092. package/dist/src/tasks/notification.d.ts +0 -10
  1093. package/dist/src/tasks/notification.js +0 -1
  1094. package/dist/src/tasks/task-id.d.ts +0 -31
  1095. package/dist/src/tasks/task-id.js +0 -1
  1096. package/dist/src/tasks/task-inbox-token.d.ts +0 -2
  1097. package/dist/src/tasks/task-inbox-token.js +0 -1
  1098. package/dist/src/tasks/transitions.d.ts +0 -17
  1099. package/dist/src/tasks/transitions.js +0 -1
  1100. package/dist/src/tasks/types.d.ts +0 -136
  1101. package/dist/src/tasks/types.js +0 -1
  1102. package/dist/src/tools/framework/connection-search.d.ts +0 -3
  1103. package/dist/src/tools/framework/connection-search.js +0 -1
  1104. package/dist/src/tools/framework/task-cancel.d.ts +0 -4
  1105. package/dist/src/tools/framework/task-cancel.js +0 -1
  1106. package/dist/src/tools/framework/task-contract.d.ts +0 -19
  1107. package/dist/src/tools/framework/task-contract.js +0 -1
  1108. package/dist/src/tools/native-definition.d.ts +0 -7
  1109. package/dist/src/tools/native-definition.js +0 -1
  1110. package/dist/src/tracing/agent-invocation-terminal.d.ts +0 -18
  1111. package/dist/src/tracing/agent-invocation-terminal.js +0 -1
  1112. /package/dist/src/{extensions/code → computer-use}/extension/lib/computer-use-driver-source.d.ts +0 -0
  1113. /package/dist/src/{extensions/code → computer-use}/extension/lib/computer-use-driver-source.js +0 -0
  1114. /package/dist/src/{extensions/code → computer-use}/extension/tools/computer_use.d.ts +0 -0
  1115. /package/dist/src/execution/{tools/subagent → agent-sessions}/metadata.d.ts +0 -0
  1116. /package/dist/src/execution/{tools/subagent → agent-sessions}/metadata.js +0 -0
@@ -1,12 +1,11 @@
1
1
  import type { UserContent } from "ai";
2
- import type { ChannelAddressDeliveryOptions } from "#channel/channel-address.js";
3
- import type { SendPayload } from "#channel/routes.js";
4
- import type { SessionAuthContext, TurnPolicy, TaskDeliveryPolicy } from "#channel/types.js";
2
+ import type { ChannelRespondOptions, ChannelSendOptions } from "#channel/channel-operations.js";
3
+ import type { SessionAuthContext, TurnPolicy } from "#channel/types.js";
4
+ import { type InputResponse, type StrictInputResponses } from "#shared/input.js";
5
5
  import type { ActionEvent, Adapter, ChatConfig, SerializedThread, Thread, WebhookOptions } from "#compiled/chat/index.js";
6
6
  import { Chat } from "#compiled/chat/index.js";
7
7
  import { type Channel, type ChannelEvents, type ChannelContinuationOps, type Session } from "#public/definitions/channel.js";
8
8
  type ChatSdkAdapters = Record<string, Adapter>;
9
- type ChatSdkSendInput = string | UserContent | SendPayload;
10
9
  /** Durable Chat SDK thread state plus default-handler streaming bookkeeping. */
11
10
  export interface ChatSdkChannelState extends Record<string, unknown> {
12
11
  thread: SerializedThread | null;
@@ -67,19 +66,10 @@ export interface ChatSdkEventContext<TAdapters extends ChatSdkAdapters = ChatSdk
67
66
  * replaces the built-in default for that event.
68
67
  */
69
68
  export type ChatSdkChannelEvents<TAdapters extends ChatSdkAdapters = ChatSdkAdapters> = ChannelEvents<ChatSdkChannelContext<TAdapters>>;
70
- /** The thread determines the eve continuation token and persisted channel state. */
71
- export interface ChatSdkSendOptions {
69
+ /** Selects the Chat SDK thread that owns the eve continuation token. */
70
+ interface ChatSdkThreadOptions {
72
71
  readonly auth?: SessionAuthContext | null;
73
- readonly callback?: ChannelAddressDeliveryOptions<ChatSdkChannelState>["callback"];
74
- /** Updates the session policy; omission preserves it. */
75
- readonly taskDeliveryPolicy?: TaskDeliveryPolicy;
76
72
  readonly thread: SerializedThread | Thread | string;
77
- readonly title?: string;
78
- /**
79
- * Controls how this input interacts with an active eve turn on the same
80
- * thread. Defaults to `"steer"`.
81
- */
82
- readonly turnPolicy?: TurnPolicy;
83
73
  /**
84
74
  * Required when `thread` is a string that does not include the Chat SDK
85
75
  * adapter prefix. Prefer passing the `Thread` object from the Chat SDK handler
@@ -87,6 +77,20 @@ export interface ChatSdkSendOptions {
87
77
  */
88
78
  readonly adapterName?: string;
89
79
  }
80
+ /**
81
+ * Options for `bridge.send`: channel send options plus the thread. The thread
82
+ * determines the eve continuation token and persisted channel state.
83
+ */
84
+ export interface ChatSdkSendOptions extends ChatSdkThreadOptions, Omit<ChannelSendOptions, "auth"> {
85
+ /**
86
+ * Controls how this input interacts with an active eve turn on the same
87
+ * thread. Defaults to the channel's `turnPolicy`, then `"steer"`.
88
+ */
89
+ readonly turnPolicy?: TurnPolicy;
90
+ }
91
+ /** Options for `bridge.respond`: channel respond options plus the thread. */
92
+ export interface ChatSdkRespondOptions extends ChatSdkThreadOptions, Omit<ChannelRespondOptions, "auth" | "state"> {
93
+ }
90
94
  /**
91
95
  * Configuration for {@link chatSdkChannel}. It accepts normal Chat SDK
92
96
  * `ChatConfig` fields, plus eve route and event settings.
@@ -150,7 +154,12 @@ export interface ChatSdkChannelBridge<TAdapters extends ChatSdkAdapters = ChatSd
150
154
  * Use `channel.receive(...)` for proactive sends that are not handling an
151
155
  * inbound Chat SDK webhook.
152
156
  */
153
- send(input: ChatSdkSendInput, options: ChatSdkSendOptions): Promise<Session>;
157
+ send(message: string | UserContent, options: ChatSdkSendOptions): Promise<Session>;
158
+ /**
159
+ * Answers pending input requests on the thread's session from inside a Chat
160
+ * SDK webhook handler. Never creates a session.
161
+ */
162
+ respond<const TResponses extends readonly InputResponse[]>(inputResponses: StrictInputResponses<TResponses>, options: ChatSdkRespondOptions): Promise<Session>;
154
163
  }
155
164
  /**
156
165
  * Creates an eve channel backed by one Chat SDK runtime and its adapters.
@@ -1,3 +1,3 @@
1
- import{createLogger,extractErrorId,formatErrorHint}from"#internal/logging.js";import{normalizeSendInput}from"#channel/send-input.js";import{INTERNAL_CHANNEL_DELIVER}from"#channel/channel-operations.js";import{ContextContainer,contextStorage}from"#context/container.js";import{GET,POST,defineChannel}from"#public/definitions/channel.js";import{ContextKey}from"#context/key.js";import{isNotImplemented}from"#public/channels/chat-sdk/notImplemented.js";import{Actions,Button,Card,CardText,Chat,Message,ThreadImpl}from"#compiled/chat/index.js";import{defaultAuthorizationEvents}from"#public/channels/chat-sdk/authorization.js";import{chatSdkInstrumentation}from"#public/channels/chat-sdk/audience.js";const log=createLogger(`chat-sdk.channel`),streamTextByState=new WeakMap,ActiveWebhookKey=new ContextKey(`chat-sdk.active-webhook`);function chatSdkChannel(e){let t=new Chat(e),n=e.inputActionPrefix??`eve_input:`,r=e.streaming??!0,i=e.streamingEditIntervalMs??1e3,a={...defaultEvents(n),...e.events};return t.onAction(async r=>{let i=decodeInputAction(r.actionId,n,r.value);if(i){if(!r.thread)throw Error(`chatSdkChannel input actions require a thread on the Chat SDK action event.`);await bridgeSend(t,{inputResponses:[i]},{auth:e.resolveInputAuth?await e.resolveInputAuth(r):null,thread:r.thread.toJSON()})}}),{bot:t,channel:defineChannel({kindHint:`chat-sdk`,turnPolicy:e.turnPolicy,state:initialState(),...chatSdkInstrumentation,context(e){return{bot:t,state:e,streaming:r,streamingEditIntervalMs:i,thread:threadFromState(t,e)}},routes:adapterNames(e.adapters).flatMap(n=>{let r=routeForAdapter(n,e),handler=async(r,i)=>{let a=t.webhooks[n],o=new ContextContainer;return o.setVirtualContext(ActiveWebhookKey,{from:i.from}),contextStorage.run(o,()=>a(r,{...e.webhook,waitUntil(e){i.waitUntil(e)}}))};return[GET(r,handler),POST(r,handler)]}),async receive(e,{from:n}){let r=serializeReceiveTarget(t,e.target);return n(r.id).send(e.message,{auth:e.auth,state:{thread:r}})},events:a}),send(e,n){return bridgeSend(t,e,n)}}}function defaultEvents(e){return{...defaultAuthorizationEvents(),async"turn.started"(e,t,n){t.state.pendingToolCallMessage=null,clearStream(t.state),await safeStartTyping(t.thread,`Working...`)},async"actions.requested"(e,t,n){let r=t.state.pendingToolCallMessage;if(t.state.pendingToolCallMessage=null,r){await safeStartTyping(t.thread,truncate(r));return}let i=e.actions.map(e=>e.kind===`tool-call`?e.toolName:e.kind);await safeStartTyping(t.thread,truncate(`Running ${i.join(`, `)}...`))},async"message.appended"(e,t,n){if(!t.thread||!canStream(t))return;let r=((t.state.streamStepIndex===e.stepIndex?streamTextByState.get(t.state):void 0)??``)+e.messageDelta;if(!r)return;streamTextByState.set(t.state,r);let i=t.state.anchorMessageId;if(!i||t.state.streamStepIndex!==e.stepIndex){let n=await t.thread.post({markdown:r});t.state.anchorMessageId=n.id,t.state.streamStepIndex=e.stepIndex,t.state.lastEditAtMs=Date.now();return}let a=t.state.lastEditAtMs??0;if(!(Date.now()-a<t.streamingEditIntervalMs))try{await editMessage(t.thread,i,r),t.state.lastEditAtMs=Date.now()}catch(e){if(!isNotImplemented(e))throw e;t.state.editSupported=!1,clearStream(t.state)}},async"input.requested"(t,n,r){n.thread&&t.requests.length!==0&&await n.thread.post(renderInputRequests(t.requests,e))},async"message.completed"(e,t,n){if(e.finishReason===`tool-calls`){t.state.pendingToolCallMessage=e.message?firstNonEmptyLine(e.message)??null:null,e.message?await finalizeStreamedMessage(t,e.message,!1):clearStream(t.state);return}if(t.state.pendingToolCallMessage=null,!e.message){clearStream(t.state);return}await finalizeStreamedMessage(t,e.message,!0)},async"turn.failed"(e,t,n){await postFailure(t.thread,`I hit an error while handling your request`,e)},async"session.failed"(e,t){await postFailure(t.thread,`This session could not recover from an error`,e)}}}async function safeStartTyping(e,t){if(e)try{await e.startTyping(t)}catch(e){if(!isNotImplemented(e))throw e}}async function editMessage(e,t,n){await e.adapter.editMessage(e.id,t,{markdown:n})}async function finalizeStreamedMessage(e,t,n){let r=e.thread;if(!r){clearStream(e.state);return}let i=e.state.anchorMessageId;if(canStream(e)&&i)try{await editMessage(r,i,t)}catch(i){if(!isNotImplemented(i))throw i;e.state.editSupported=!1,n&&await r.post({markdown:t})}else n&&await r.post({markdown:t});clearStream(e.state)}function canStream(e){return e.streaming&&e.state.editSupported!==!1}function clearStream(e){e.anchorMessageId=null,e.lastEditAtMs=null,e.streamStepIndex=null,streamTextByState.delete(e)}function firstNonEmptyLine(e){for(let t of e.split(/\r?\n/u)){let e=t.trim();if(e.length>0)return e}}function truncate(e,t=80){return e.length<=t?e:`${e.slice(0,t-1)}\u2026`}function renderInputRequests(e,t){return Card({children:e.flatMap(e=>renderInputRequest(e,t))})}function renderInputRequest(e,t){let n=[CardText(e.prompt)];return e.options&&e.options.length>0?(n.push(Actions(e.options.map(n=>Button({id:encodeInputAction(t,e.requestId,n.id),label:n.label,style:n.style,value:n.id})))),n):(n.push(CardText(`This request needs a freeform answer. Continue from the eve session UI.`)),n)}async function postFailure(e,t,n){if(!e)return;let r=formatErrorHint(n),i=extractErrorId(n.details);await e.post([`${t}${r}.`,`Please try again, rephrase, or reach out if it keeps failing.`,...i?[`Error id: ${i}`]:[]].join(`
1
+ import{createLogger,extractErrorId,formatErrorHint}from"#internal/logging.js";import{parseInputResponses}from"#shared/input.js";import{ContextContainer,contextStorage}from"#context/container.js";import{GET,POST,defineChannel}from"#public/definitions/channel.js";import{ContextKey}from"#context/key.js";import{isNotImplemented}from"#public/channels/chat-sdk/notImplemented.js";import{Chat,Message,ThreadImpl}from"#compiled/chat/index.js";import{defaultAuthorizationEvents}from"#public/channels/chat-sdk/authorization.js";import{decodeInputAction,renderInputRequests}from"#public/channels/chat-sdk/input-actions.js";import{chatSdkInstrumentation}from"#public/channels/chat-sdk/audience.js";const log=createLogger(`chat-sdk.channel`),streamTextByState=new WeakMap,ActiveWebhookKey=new ContextKey(`chat-sdk.active-webhook`);function chatSdkChannel(e){let t=new Chat(e),n=e.inputActionPrefix??`eve_input:`,r=e.streaming??!0,i=e.streamingEditIntervalMs??1e3,a={...defaultEvents(n),...e.events};return t.onAction(async r=>{let i=decodeInputAction(r.actionId,n,r.value);if(i){if(!r.thread)throw Error(`chatSdkChannel input actions require a thread on the Chat SDK action event.`);await bridgeRespond(t,[i],{auth:e.resolveInputAuth?await e.resolveInputAuth(r):null,thread:r.thread.toJSON()})}}),{bot:t,channel:defineChannel({kindHint:`chat-sdk`,turnPolicy:e.turnPolicy,state:initialState(),...chatSdkInstrumentation,context(e){return{bot:t,state:e,streaming:r,streamingEditIntervalMs:i,thread:threadFromState(t,e)}},routes:adapterNames(e.adapters).flatMap(n=>{let r=routeForAdapter(n,e),handler=async(r,i)=>{let a=t.webhooks[n],o=new ContextContainer;return o.setVirtualContext(ActiveWebhookKey,{from:i.from}),contextStorage.run(o,()=>a(r,{...e.webhook,waitUntil(e){i.waitUntil(e)}}))};return[GET(r,handler),POST(r,handler)]}),async receive(e,{from:n}){let r=serializeReceiveTarget(t,e.target);return n(r.id).send(e.message,{auth:e.auth,state:{thread:r}})},events:a}),send(e,n){return bridgeSend(t,e,n)},respond(e,n){return bridgeRespond(t,e,n)}}}function defaultEvents(e){return{...defaultAuthorizationEvents(),async"turn.started"(e,t,n){t.state.pendingToolCallMessage=null,clearStream(t.state),await safeStartTyping(t.thread,`Working...`)},async"actions.requested"(e,t,n){let r=t.state.pendingToolCallMessage;if(t.state.pendingToolCallMessage=null,r){await safeStartTyping(t.thread,truncate(r));return}let i=e.actions.map(e=>e.kind===`tool-call`?e.toolName:e.kind);await safeStartTyping(t.thread,truncate(`Running ${i.join(`, `)}...`))},async"message.appended"(e,t,n){if(!t.thread||!canStream(t))return;let r=((t.state.streamStepIndex===e.stepIndex?streamTextByState.get(t.state):void 0)??``)+e.messageDelta;if(!r)return;streamTextByState.set(t.state,r);let i=t.state.anchorMessageId;if(!i||t.state.streamStepIndex!==e.stepIndex){let n=await t.thread.post({markdown:r});t.state.anchorMessageId=n.id,t.state.streamStepIndex=e.stepIndex,t.state.lastEditAtMs=Date.now();return}let a=t.state.lastEditAtMs??0;if(!(Date.now()-a<t.streamingEditIntervalMs))try{await editMessage(t.thread,i,r),t.state.lastEditAtMs=Date.now()}catch(e){if(!isNotImplemented(e))throw e;t.state.editSupported=!1,clearStream(t.state)}},async"input.requested"(t,n,r){n.thread&&t.requests.length!==0&&await n.thread.post(renderInputRequests(t.requests,e))},async"message.completed"(e,t,n){if(e.finishReason===`tool-calls`){t.state.pendingToolCallMessage=e.message?firstNonEmptyLine(e.message)??null:null,e.message?await finalizeStreamedMessage(t,e.message,!1):clearStream(t.state);return}if(t.state.pendingToolCallMessage=null,!e.message){clearStream(t.state);return}await finalizeStreamedMessage(t,e.message,!0)},async"turn.failed"(e,t,n){await postFailure(t.thread,`I hit an error while handling your request`,e)},async"session.failed"(e,t){await postFailure(t.thread,`This session could not recover from an error`,e)}}}async function safeStartTyping(e,t){if(e)try{await e.startTyping(t)}catch(e){if(!isNotImplemented(e))throw e}}async function editMessage(e,t,n){await e.adapter.editMessage(e.id,t,{markdown:n})}async function finalizeStreamedMessage(e,t,n){let r=e.thread;if(!r){clearStream(e.state);return}let i=e.state.anchorMessageId;if(canStream(e)&&i)try{await editMessage(r,i,t)}catch(i){if(!isNotImplemented(i))throw i;e.state.editSupported=!1,n&&await r.post({markdown:t})}else n&&await r.post({markdown:t});clearStream(e.state)}function canStream(e){return e.streaming&&e.state.editSupported!==!1}function clearStream(e){e.anchorMessageId=null,e.lastEditAtMs=null,e.streamStepIndex=null,streamTextByState.delete(e)}function firstNonEmptyLine(e){for(let t of e.split(/\r?\n/u)){let e=t.trim();if(e.length>0)return e}}function truncate(e,t=80){return e.length<=t?e:`${e.slice(0,t-1)}\u2026`}async function postFailure(e,t,n){if(!e)return;let r=formatErrorHint(n),i=extractErrorId(n.details);await e.post([`${t}${r}.`,`Please try again, rephrase, or reach out if it keeps failing.`,...i?[`Error id: ${i}`]:[]].join(`
2
2
 
3
- `))}async function bridgeSend(e,t,n){let r=contextStorage.getStore()?.get(ActiveWebhookKey);if(!r)throw Error(`chatSdkChannel().send can only run during a Chat SDK webhook handler for this bridge.`);let i=serializeThread(e,n.thread,n.adapterName),a=normalizeSendInput(t),o={auth:n.auth??null,state:{thread:i}};return n.callback!==void 0&&(o.callback=n.callback),n.title!==void 0&&(o.title=n.title),n.turnPolicy!==void 0&&(o.turnPolicy=n.turnPolicy),n.taskDeliveryPolicy!==void 0&&(o.taskDeliveryPolicy=n.taskDeliveryPolicy),r.from(i.id)[INTERNAL_CHANNEL_DELIVER](a,o)}function initialState(){return{pendingAuthMessageIds:{},thread:null}}function threadFromState(e,t){if(!t.thread)return null;try{let n=t.thread;return new ThreadImpl({adapter:e.getAdapter(n.adapterName),channelId:n.channelId,channelVisibility:n.channelVisibility,currentMessage:n.currentMessage?Message.fromJSON(n.currentMessage):void 0,id:n.id,isDM:n.isDM,stateAdapter:e.getState()})}catch(e){return log.warn(`failed to rebuild Chat SDK thread from channel state`,{error:e}),null}}function serializeReceiveTarget(e,t){if(t.thread)return t.thread;if(!t.threadId)throw Error(`chatSdkChannel().receive requires target.thread or target.threadId.`);return serializeThread(e,t.threadId,t.adapterName)}function serializeThread(e,t,n){if(typeof t==`string`){let r=n??inferAdapterName(t),i=e.getAdapter(r);return{_type:`chat:Thread`,adapterName:r,channelId:i.channelIdFromThreadId(t),channelVisibility:i.getChannelVisibility?.(t),id:t,isDM:!1}}return isSerializedThread(t)?t:t.toJSON()}function isSerializedThread(e){return`_type`in e&&e._type===`chat:Thread`}function inferAdapterName(e){let t=e.indexOf(`:`);if(t<=0)throw Error(`chatSdkChannel string thread references require options.adapterName.`);return e.slice(0,t)}function adapterNames(e){return Object.keys(e)}function routeForAdapter(e,t){return t.routes?.[e]||`${(t.route??`/eve/v1`).replace(/\/$/u,``)}/${e}`}function encodeInputAction(e,t,n){return`${e}${encodeURIComponent(t)}:${encodeURIComponent(n)}`}function decodeInputAction(e,t,n){if(!e.startsWith(t))return null;let r=e.slice(t.length),i=r.indexOf(`:`);if(i<=0)return null;try{let e=decodeURIComponent(r.slice(0,i));return{optionId:n??decodeURIComponent(r.slice(i+1)),requestId:e}}catch{return null}}export{chatSdkChannel};
3
+ `))}async function bridgeSend(e,t,n){let r=activeFrom(`send`),{adapterName:i,auth:a,thread:o,...s}=n,c=serializeThread(e,o,i);return r(c.id).send(t,{...s,auth:a??null,state:{thread:c}})}async function bridgeRespond(e,t,n){let r=activeFrom(`respond`),{adapterName:i,auth:a,thread:o,...s}=n;return r(serializeThread(e,o,i).id).respond(parseInputResponses(t),{...s,auth:a??null})}function activeFrom(e){let t=contextStorage.getStore()?.get(ActiveWebhookKey);if(!t)throw Error(`chatSdkChannel().${e} can only run during a Chat SDK webhook handler for this bridge.`);return t.from}function initialState(){return{pendingAuthMessageIds:{},thread:null}}function threadFromState(e,t){if(!t.thread)return null;try{let n=t.thread;return new ThreadImpl({adapter:e.getAdapter(n.adapterName),channelId:n.channelId,channelVisibility:n.channelVisibility,currentMessage:n.currentMessage?Message.fromJSON(n.currentMessage):void 0,id:n.id,isDM:n.isDM,stateAdapter:e.getState()})}catch(e){return log.warn(`failed to rebuild Chat SDK thread from channel state`,{error:e}),null}}function serializeReceiveTarget(e,t){if(t.thread)return t.thread;if(!t.threadId)throw Error(`chatSdkChannel().receive requires target.thread or target.threadId.`);return serializeThread(e,t.threadId,t.adapterName)}function serializeThread(e,t,n){if(typeof t==`string`){let r=n??inferAdapterName(t),i=e.getAdapter(r);return{_type:`chat:Thread`,adapterName:r,channelId:i.channelIdFromThreadId(t),channelVisibility:i.getChannelVisibility?.(t),id:t,isDM:!1}}return isSerializedThread(t)?t:t.toJSON()}function isSerializedThread(e){return`_type`in e&&e._type===`chat:Thread`}function inferAdapterName(e){let t=e.indexOf(`:`);if(t<=0)throw Error(`chatSdkChannel string thread references require options.adapterName.`);return e.slice(0,t)}function adapterNames(e){return Object.keys(e)}function routeForAdapter(e,t){return t.routes?.[e]||`${(t.route??`/eve/v1`).replace(/\/$/u,``)}/${e}`}export{chatSdkChannel};
@@ -1,3 +1,3 @@
1
- export { chatSdkChannel, type ChatSdkChannel, type ChatSdkChannelBridge, type ChatSdkChannelConfig, type ChatSdkChannelContext, type ChatSdkChannelEvents, type ChatSdkChannelState, type ChatSdkEventContext, type ChatSdkInstrumentationMetadata, type ChatSdkReceiveTarget, type ChatSdkSendOptions, } from "#public/channels/chat-sdk/chatSdkChannel.js";
1
+ export { chatSdkChannel, type ChatSdkChannel, type ChatSdkChannelBridge, type ChatSdkChannelConfig, type ChatSdkChannelContext, type ChatSdkChannelEvents, type ChatSdkChannelState, type ChatSdkEventContext, type ChatSdkInstrumentationMetadata, type ChatSdkReceiveTarget, type ChatSdkRespondOptions, type ChatSdkSendOptions, } from "#public/channels/chat-sdk/chatSdkChannel.js";
2
2
  export { messageToUserContent } from "#public/channels/chat-sdk/messageToUserContent.js";
3
3
  export { isNotImplemented } from "#public/channels/chat-sdk/notImplemented.js";
@@ -0,0 +1,8 @@
1
+ import type { InputRequest } from "#shared/input.js";
2
+ /** Renders pending input requests as a Chat SDK card with one button per option. */
3
+ export declare function renderInputRequests(requests: readonly InputRequest[], inputActionPrefix: string): import("#compiled/chat/index.js").CardElement;
4
+ /** Decodes a default eve HITL button action back into an input response. */
5
+ export declare function decodeInputAction(actionId: string, prefix: string, value: string | undefined): {
6
+ optionId: string;
7
+ requestId: string;
8
+ } | null;
@@ -0,0 +1 @@
1
+ import{Actions,Button,Card,CardText}from"#compiled/chat/index.js";function renderInputRequests(e,t){return Card({children:e.flatMap(e=>renderInputRequest(e,t))})}function renderInputRequest(e,t){let n=[CardText(e.prompt)];return e.options&&e.options.length>0?(n.push(Actions(e.options.map(n=>Button({id:encodeInputAction(t,e.requestId,n.id),label:n.label,style:n.style,value:n.id})))),n):(n.push(CardText(`This request needs a freeform answer. Continue from the eve session UI.`)),n)}function encodeInputAction(e,t,n){return`${e}${encodeURIComponent(t)}:${encodeURIComponent(n)}`}function decodeInputAction(e,t,n){if(!e.startsWith(t))return null;let r=e.slice(t.length),i=r.indexOf(`:`);if(i<=0)return null;try{let e=decodeURIComponent(r.slice(0,i));return{optionId:n??decodeURIComponent(r.slice(i+1)),requestId:e}}catch{return null}}export{decodeInputAction,renderInputRequests};
@@ -1,4 +1,4 @@
1
- export { defineChannel, disableRoute, GET, HEAD, OPTIONS, POST, PUT, PATCH, DELETE, WS, type AttachSessionFn, type CancelTurnResult, type ClearSessionResult, type CompactSessionResult, type ResetSessionResult, type Channel, type ChannelAudience, type AudienceCaller, type AudienceContext, type AudienceInput, type AudiencePrincipal, type ConversationEnvironment, type ChannelFrom, type ChannelReceiveContext, type ChannelResolveSession, type ChannelRespondOptions, type ChannelSendOptions, type ChannelSource, type ChannelCors, type ChannelCorsOptions, type ChannelDefinition, type DisabledRouteSentinel, type ChannelContinuationOps, type ChannelEvents, type InferChannelMetadata, type Session, type SessionCallback, type SessionHandle, type SessionRespondOptions, type SessionSendOptions, type TurnPolicy, type TaskDeliveryPolicy, type RouteDefinition, type RouteHandlerArgs, type HttpRouteDefinition, type WebSocketMessage, type WebSocketPeer, type WebSocketRouteDefinition, type WebSocketRouteHandler, type WebSocketRouteHooks, type WebSocketUpgradeRequest, type WebSocketUpgradeResult, isDisabledRouteSentinel, } from "#public/definitions/channel.js";
1
+ export { defineChannel, disableRoute, GET, HEAD, OPTIONS, POST, PUT, PATCH, DELETE, WS, type AttachSessionFn, type CancelTurnResult, type ClearSessionResult, type CompactSessionResult, type ResetSessionResult, type Channel, type ChannelAudience, type AudienceCaller, type AudienceContext, type AudienceInput, type AudiencePrincipal, type ConversationEnvironment, type ChannelFrom, type ChannelReceiveContext, type ChannelResolveSession, type ChannelRespondOptions, type ChannelSendOptions, type ChannelSource, type ChannelCors, type ChannelCorsOptions, type ChannelDefinition, type DisabledRouteSentinel, type ChannelContinuationOps, type ChannelEvents, type InferChannelMetadata, type Session, type SessionCallback, type SessionHandle, type SessionRespondOptions, type SessionSendOptions, type TurnPolicy, type RouteDefinition, type RouteHandlerArgs, type HttpRouteDefinition, type WebSocketMessage, type WebSocketPeer, type WebSocketRouteDefinition, type WebSocketRouteHandler, type WebSocketRouteHooks, type WebSocketUpgradeRequest, type WebSocketUpgradeResult, isDisabledRouteSentinel, } from "#public/definitions/channel.js";
2
2
  export { createWebSocketUpgradeServer, type WebSocketUpgradeServerBridge, } from "#channel/websocket-upgrade-server.js";
3
3
  import type { Channel, InferChannelMetadata } from "#public/definitions/channel.js";
4
4
  /**
@@ -1 +1 @@
1
- import{vercelOidc}from"#public/channels/auth.js";import{chatSdkChannel}from"#public/channels/chat-sdk/index.js";import{createMemoryState}from"#compiled/@chat-adapter/state-memory/index.js";import{createLinqAdapter}from"#compiled/@linqapp/chat-sdk-adapter/index.js";import{linqInboundContent}from"#public/channels/linq/inboundContent.js";function linqChannel(e){let t=normalizeCredentials(e.credentials);e.baseURL!==void 0&&(t.baseURL=e.baseURL);let n=createLinqAdapter(t),r=chatSdkChannel({adapters:{linq:n},concurrency:`concurrent`,events:e.events,routes:{linq:e.route??`/eve/v1/linq`},state:createMemoryState(),streaming:!1,turnPolicy:e.turnPolicy,userName:e.userName??`eve`}),i=e.onMessage??defaultOnMessage;return r.bot.onDirectMessage(async(e,t)=>{await dispatchMessage(r,i,e,t)}),r.bot.onNewMessage(/[\s\S]*/,async(e,t)=>{await dispatchMessage(r,i,e,t)}),r.channel}function normalizeCredentials(e){let{apiKey:t,signingSecret:n,webhookVerifier:r}=e??{},i={};return t!==void 0&&(i.credentials=createCredentialProvider(t,n)),r===void 0?n===void 0&&(i.webhookVerifier=vercelOidc()):i.webhookVerifier=r,i}function createCredentialProvider(e,t){return async()=>{let n={apiKey:await resolveCredentialValue(e)};return t!==void 0&&(n.signingSecret=await resolveCredentialValue(t)),n}}async function resolveCredentialValue(e){return typeof e==`function`?await e():e}function defaultLinqAuth(e){let t={};return e.author.userName!==void 0&&(t.user_name=e.author.userName),{attributes:t,authenticator:`linq-message`,issuer:`linq`,principalId:`linq:${e.author.userId}`,principalType:e.author.isBot?`service`:`user`,subject:e.author.userId}}async function defaultOnMessage(e,t){return{auth:defaultLinqAuth(t)}}async function dispatchMessage(e,t,n,r){let i=await t({thread:n},r);if(i===null)return;await markReadBestEffort(e.bot.getAdapter(`linq`),n,r);let a=linqInboundContent(r);a!==void 0&&await e.send({context:[...i.context??[]],message:a},{auth:i.auth,thread:n,title:i.title})}async function markReadBestEffort(e,t,n){try{await e.markRead(t.id,n.id)}catch{}}export{defaultLinqAuth,linqChannel};
1
+ import{vercelOidc}from"#public/channels/auth.js";import{chatSdkChannel}from"#public/channels/chat-sdk/index.js";import{createMemoryState}from"#compiled/@chat-adapter/state-memory/index.js";import{createLinqAdapter}from"#compiled/@linqapp/chat-sdk-adapter/index.js";import{linqInboundContent}from"#public/channels/linq/inboundContent.js";function linqChannel(e){let t=normalizeCredentials(e.credentials);e.baseURL!==void 0&&(t.baseURL=e.baseURL);let n=createLinqAdapter(t),r=chatSdkChannel({adapters:{linq:n},concurrency:`concurrent`,events:e.events,routes:{linq:e.route??`/eve/v1/linq`},state:createMemoryState(),streaming:!1,turnPolicy:e.turnPolicy,userName:e.userName??`eve`}),i=e.onMessage??defaultOnMessage;return r.bot.onDirectMessage(async(e,t)=>{await dispatchMessage(r,i,e,t)}),r.bot.onNewMessage(/[\s\S]*/,async(e,t)=>{await dispatchMessage(r,i,e,t)}),r.channel}function normalizeCredentials(e){let{apiKey:t,signingSecret:n,webhookVerifier:r}=e??{},i={};return t!==void 0&&(i.credentials=createCredentialProvider(t,n)),r===void 0?n===void 0&&(i.webhookVerifier=vercelOidc()):i.webhookVerifier=r,i}function createCredentialProvider(e,t){return async()=>{let n={apiKey:await resolveCredentialValue(e)};return t!==void 0&&(n.signingSecret=await resolveCredentialValue(t)),n}}async function resolveCredentialValue(e){return typeof e==`function`?await e():e}function defaultLinqAuth(e){let t={};return e.author.userName!==void 0&&(t.user_name=e.author.userName),{attributes:t,authenticator:`linq-message`,issuer:`linq`,principalId:`linq:${e.author.userId}`,principalType:e.author.isBot?`service`:`user`,subject:e.author.userId}}async function defaultOnMessage(e,t){return{auth:defaultLinqAuth(t)}}async function dispatchMessage(e,t,n,r){let i=await t({thread:n},r);if(i===null)return;await markReadBestEffort(e.bot.getAdapter(`linq`),n,r);let a=linqInboundContent(r);a!==void 0&&await e.send(a,{auth:i.auth,context:[...i.context??[]],thread:n,title:i.title})}async function markReadBestEffort(e,t,n){try{await e.markRead(t.id,n.id)}catch{}}export{defaultLinqAuth,linqChannel};
@@ -1 +1 @@
1
- import{vercelOidc}from"#public/channels/auth.js";import{chatSdkChannel}from"#public/channels/chat-sdk/index.js";import{createMemoryState}from"#compiled/@chat-adapter/state-memory/index.js";import{createiMessageAdapter}from"#compiled/@photon-ai/chat-adapter-imessage/index.js";import{photonInboundContent}from"#public/channels/photon/inboundContent.js";function photonIMessageChannel(e){let t=e.webhookSecret??process.env.IMESSAGE_WEBHOOK_SECRET,n=createiMessageAdapter({credentials:e.credentials,...e.webhookVerifier?{webhookVerifier:e.webhookVerifier}:t?{webhookSecret:t}:{webhookVerifier:vercelOidc()}}),r=chatSdkChannel({adapters:{imessage:n},concurrency:`concurrent`,events:e.events,routes:{imessage:e.route??`/eve/v1/photon`},state:createMemoryState(),streaming:!1,turnPolicy:e.turnPolicy,userName:e.userName??`eve`}),i=e.onMessage??defaultOnMessage;return r.bot.onDirectMessage(async(e,t)=>{await dispatchMessage(r,i,e,t)}),r.bot.onNewMessage(/[\s\S]*/,async(e,t)=>{await dispatchMessage(r,i,e,t)}),r.channel}function defaultPhotonAuth(e){let t={};return e.author.userName!==void 0&&(t.user_name=e.author.userName),{attributes:t,authenticator:`photon-imessage`,issuer:`photon`,principalId:`photon:${e.author.userId}`,principalType:e.author.isBot?`service`:`user`,subject:e.author.userId}}async function defaultOnMessage(e,t){return{auth:defaultPhotonAuth(t)}}async function dispatchMessage(e,t,n,r){let i=await t({thread:n},r);if(i===null)return;await markReadBestEffort(e.bot.getAdapter(`imessage`),n,r);let a=photonInboundContent(r);a!==void 0&&await e.send({context:[...i.context??[]],message:a},{auth:i.auth,thread:n,title:i.title})}async function markReadBestEffort(e,t,n){try{await e.markRead(t.id,n.id)}catch{}}export{defaultPhotonAuth,photonIMessageChannel};
1
+ import{vercelOidc}from"#public/channels/auth.js";import{chatSdkChannel}from"#public/channels/chat-sdk/index.js";import{createMemoryState}from"#compiled/@chat-adapter/state-memory/index.js";import{createiMessageAdapter}from"#compiled/@photon-ai/chat-adapter-imessage/index.js";import{photonInboundContent}from"#public/channels/photon/inboundContent.js";function photonIMessageChannel(e){let t=e.webhookSecret??process.env.IMESSAGE_WEBHOOK_SECRET,n=createiMessageAdapter({credentials:e.credentials,...e.webhookVerifier?{webhookVerifier:e.webhookVerifier}:t?{webhookSecret:t}:{webhookVerifier:vercelOidc()}}),r=chatSdkChannel({adapters:{imessage:n},concurrency:`concurrent`,events:e.events,routes:{imessage:e.route??`/eve/v1/photon`},state:createMemoryState(),streaming:!1,turnPolicy:e.turnPolicy,userName:e.userName??`eve`}),i=e.onMessage??defaultOnMessage;return r.bot.onDirectMessage(async(e,t)=>{await dispatchMessage(r,i,e,t)}),r.bot.onNewMessage(/[\s\S]*/,async(e,t)=>{await dispatchMessage(r,i,e,t)}),r.channel}function defaultPhotonAuth(e){let t={};return e.author.userName!==void 0&&(t.user_name=e.author.userName),{attributes:t,authenticator:`photon-imessage`,issuer:`photon`,principalId:`photon:${e.author.userId}`,principalType:e.author.isBot?`service`:`user`,subject:e.author.userId}}async function defaultOnMessage(e,t){return{auth:defaultPhotonAuth(t)}}async function dispatchMessage(e,t,n,r){let i=await t({thread:n},r);if(i===null)return;await markReadBestEffort(e.bot.getAdapter(`imessage`),n,r);let a=photonInboundContent(r);a!==void 0&&await e.send(a,{auth:i.auth,context:[...i.context??[]],thread:n,title:i.title})}async function markReadBestEffort(e,t,n){try{await e.markRead(t.id,n.id)}catch{}}export{defaultPhotonAuth,photonIMessageChannel};
@@ -1,19 +1,18 @@
1
1
  /**
2
- * Typing-indicator labels for requested actions. The Slack indicator is
3
- * plain text (`assistant.threads.setStatus` renders no markdown), so the
4
- * label is the action's name plus its most telling argument — `grep useEve`
5
- * or `read_file agent/agent.ts` instead of `Running grep...`.
2
+ * Typing-indicator text for the turn's calls. It uses each call's start label,
3
+ * the same text its task card row shows, so both surfaces name a call the same
4
+ * way: `Run pnpm test`, `researcher: Find the March incidents`.
6
5
  */
6
+ import type { ActionPresentationByCallId } from "#protocol/message.js";
7
7
  import type { RuntimeActionRequest } from "#shared/action-types.js";
8
8
  /**
9
- * One action's typing-indicator label: `grep useEveAgent` for tool calls,
10
- * the subagent or remote-agent name for dispatched calls, and
11
- * `load_skill <name>` for skill loads.
9
+ * The first call's label, or its tool or agent name, plus `+N more` when the
10
+ * model requested several calls at once.
12
11
  */
13
- export declare function describeActionRequest(action: RuntimeActionRequest): string;
12
+ export declare function describeActionRequests(actions: readonly RuntimeActionRequest[], presentation: ActionPresentationByCallId | undefined): string;
14
13
  /**
15
- * Typing-indicator text for one requested batch: the first action's
16
- * {@link describeActionRequest} label, plus `+N more` when the model
17
- * requested several actions at once.
14
+ * `Waiting on researcher...` for one named task, otherwise a count such as
15
+ * `Waiting on 3 tasks...`. The agent's own copy is never named, since its
16
+ * name, `agent`, says nothing.
18
17
  */
19
- export declare function describeActionRequests(actions: readonly RuntimeActionRequest[]): string;
18
+ export declare function waitingOnTasks(names: readonly string[]): string;
@@ -1 +1 @@
1
- const SALIENT_KEYS={bash:[`command`],glob:[`pattern`],grep:[`pattern`,`path`],load_skill:[`skill`],read_file:[`filePath`],web_fetch:[`url`],web_search:[`query`],write_file:[`filePath`]},GENERIC_KEYS=[`filePath`,`path`,`pattern`,`command`,`query`,`name`,`repo`,`url`,`issueNumber`,`number`];function salientArg(e,t){for(let n of SALIENT_KEYS[e]??GENERIC_KEYS){let e=t[n];if(typeof e==`string`&&e.trim().length>0)return e;if(typeof e==`number`)return String(e)}return null}function shortenArg(e){let t=e.split(/\r?\n/u,1)[0]?.trim()??``;if(t.length<=40)return t;if(t.includes(`/`)&&!t.includes(` `)){let e=t.split(`/`).filter(e=>e.length>0).slice(-2).join(`/`);if(e.length<=40)return e}return`${t.slice(0,37).trimEnd()}...`}function toolCallLabel(e,t){let n=salientArg(e,t);return n===null?e:`${e} ${shortenArg(n)}`}function describeActionRequest(e){switch(e.kind){case`load-skill`:return toolCallLabel(`load_skill`,e.input);case`remote-agent-call`:return e.remoteAgentName;case`subagent-call`:return e.subagentName;case`tool-call`:case`workflow-tool-call`:return toolCallLabel(e.toolName,e.input)}}function describeActionRequests(e){let[t]=e;if(t===void 0)return`Working...`;let n=describeActionRequest(t);return e.length===1?n:`${n} +${e.length-1} more`}export{describeActionRequest,describeActionRequests};
1
+ import{actionRequestName}from"#shared/action-request-name.js";import{AGENT_TOOL_NAME}from"#tools/framework/agent-contract.js";function describeActionRequests(e,t){let[n]=e;if(n===void 0)return`Working...`;let r=t?.[n.callId]?.label??actionRequestName(n);return e.length===1?r:`${r} +${String(e.length-1)} more`}function waitingOnTasks(e){let[t]=e;return e.length===1&&t!==AGENT_TOOL_NAME?`Waiting on ${t}...`:e.length===1?`Waiting on a task...`:`Waiting on ${String(e.length)} tasks...`}export{describeActionRequests,waitingOnTasks};
@@ -1 +1 @@
1
- import{createLogger,logError}from"#internal/logging.js";import{isCardElement}from"#compiled/chat/index.js";import{truncateTypingStatus}from"#public/channels/slack/limits.js";import{fetchSlackThreadReplies,postSlackEphemeral,postSlackMessage,resolveSlackBotToken as resolveSlackBotToken$1,uploadSlackFiles}from"#compiled/@chat-adapter/slack/api.js";import{cardToBlocks,cardToFallbackText}from"#public/channels/slack/blocks.js";import{resolveSlackInboundMrkdwn}from"#public/channels/slack/inbound-content.js";import{slackMrkdwnToGfm}from"#public/channels/slack/mrkdwn.js";import{callSlackApiTrackingResponse,slackApiOptions}from"#public/channels/slack/transport.js";const log=createLogger(`slack.api`);function slackContinuationToken(e,t){return`${e}:${t}`}async function resolveSlackBotToken(e,t={}){let n=e??process.env.SLACK_BOT_TOKEN;if(!n)throw Error(`SLACK_BOT_TOKEN is required.`);return typeof n==`function`?n(t):resolveSlackBotToken$1(n)}async function callSlackApi(e){return callSlackApiTrackingResponse(e.operation,normalizeSlackApiBody(e.body),slackApiOptions(e.api,()=>resolveSlackBotToken(e.botToken,e.context)))}function createSlackRequester(e,t,n){return(r,i)=>callSlackApi({api:e,botToken:t,context:n,operation:r,body:i})}function buildSlackWorkspaceHandle(e){return{teamId:e.teamId,request:createSlackRequester(e.api,e.botToken,{teamId:e.installationTeamId})}}function buildSlackBinding(e){let t={teamId:e.installationTeamId},n=slackApiOptions(e.api,()=>resolveSlackBotToken(e.botToken,t)),r=createSlackRequester(e.api,e.botToken,t),i=[],a=e.threadTs,o;function handleMessageTs(t){a||t===a||(a=t,e.onThreadTsChanged?.(t))}async function uploadFiles(t,r){let i=r?.channelId??e.channelId,o=r?.threadTs??a,s=t.map(e=>toSlackFileUpload(e,r?.snippetType));return uploadSlackFiles(s,{...n,channelId:i||void 0,initialComment:r?.initialComment,threadTs:o||void 0})}function refreshMessages(){if(o!==void 0)return o;async function fetchAndReplace(){if(!e.channelId||!a){i=[];return}try{i=(await fetchSlackThreadReplies({...n,channel:e.channelId,limit:50,ts:a})).messages.map(t=>parseThreadMessage(t,a,{appId:e.appId,botUserId:e.botUserId}))}catch(t){logError(log,`refresh threw — swallowed`,t,{channelId:e.channelId})}}let t=fetchAndReplace().finally(()=>{o===t&&(o=void 0)});return o=t,t}let s={get recentMessages(){return i},async listParticipants(){await s.refresh();let e=new Set;for(let t of i)t.user!==void 0&&t.botId===void 0&&e.add(t.user);return[...e]},async post(t){let r=normalizePostInput(t),i=r.files??[],o=`blocks`in r||`card`in r||`markdown`in r;if(i.length>0&&!o){let e=await uploadFiles(i,{initialComment:`text`in r?r.text:void 0});return{id:Array.isArray(e.raw.files)&&e.raw.files.length>0?String(e.raw.files[0].id??``):``,raw:e.raw}}let s=await postSlackMessage(buildPostMessageOptions(r,e.channelId,a,n)),c=s.id;if(handleMessageTs(c),i.length>0&&o)try{await uploadFiles(i)}catch(e){log.warn(`file upload after message post failed`,{error:e})}return{id:c,raw:s.raw}},async postEphemeral(t,r){let i=normalizePostInput(r),o=await postSlackEphemeral({...buildPostMessageOptions(i,e.channelId,a,n),user:t});return{id:o.id,raw:o.raw}},async postDirectMessage(e,t){let i=await r(`conversations.open`,{users:e}),a=i.ok===!0?i.channel?.id:void 0;if(typeof a!=`string`||a.length===0)throw Error(`Slack conversations.open failed: ${i.error??`unknown_error`}`);let o=normalizePostInput(t),s=await postSlackMessage(buildPostMessageOptions(o,a,``,n));return{id:s.id,raw:s.raw}},async startTyping(t){if(e.channelId&&a)try{let n=t===void 0?``:truncateTypingStatus(t),i={channel_id:e.channelId,thread_ts:a,status:n};n.length>0&&(i.loading_messages=[n]);let o=await r(`assistant.threads.setStatus`,i);o.ok!==!0&&log.warn(`assistant.threads.setStatus returned not-ok`,{error:o.error})}catch(t){logError(log,`startTyping threw — swallowed`,t,{channelId:e.channelId})}},refresh(){return refreshMessages()},mentionUser(e){return`<@${e}>`}};return{thread:s,slack:{channelId:e.channelId,get threadTs(){return a},teamId:e.teamId,request:r,uploadFiles}}}function normalizePostInput(e){return typeof e==`string`?{markdown:e}:isCardElement(e)?{card:e}:e}function buildPostMessageOptions(e,t,n,r){let i={...r,channel:t,threadTs:n||void 0,unfurlLinks:!1,unfurlMedia:!1};return`card`in e?(i.blocks=cardToBlocks(e.card),i.text=e.fallbackText??cardToFallbackText(e.card),i):`blocks`in e?(i.blocks=[...e.blocks],e.text!==void 0&&(i.text=e.text),i):`markdown`in e?(i.markdownText=e.markdown,i):(i.text=e.text,i)}function normalizeSlackApiBody(e){return e&&typeof e==`object`&&!Array.isArray(e)?e:{}}function toSlackFileUpload(e,t){return{data:normalizeFileData(e.data),filename:e.filename,snippetType:t}}function normalizeFileData(e){if(e instanceof ArrayBuffer||typeof Blob<`u`&&e instanceof Blob)return e;if(ArrayBuffer.isView(e)){let t=e;return new Uint8Array(t.buffer,t.byteOffset,t.byteLength)}return e}function parseThreadMessage(e,t,n){let r=typeof e.text==`string`?e.text:``,i=resolveSlackInboundMrkdwn(r,e),a=typeof e.ts==`string`?e.ts:``,o=typeof e.thread_ts==`string`?e.thread_ts:t,s=typeof e.user==`string`?e.user:void 0,c=typeof e.bot_id==`string`?e.bot_id:void 0,l=typeof e.app_id==`string`?e.app_id:void 0,u=n.botUserId!==void 0&&s===n.botUserId||n.appId!==void 0&&l===n.appId;return{text:i,markdown:slackMrkdwnToGfm(i),user:s,botId:c,ts:a,threadTs:o,isMe:u,raw:e}}export{buildSlackBinding,buildSlackWorkspaceHandle,callSlackApi,resolveSlackBotToken,slackContinuationToken};
1
+ import{createLogger,logError}from"#internal/logging.js";import{isCardElement}from"#compiled/chat/index.js";import{fetchSlackThreadReplies,postSlackEphemeral,postSlackMessage,resolveSlackBotToken as resolveSlackBotToken$1,uploadSlackFiles}from"#compiled/@chat-adapter/slack/api.js";import{cardToBlocks,cardToFallbackText}from"#public/channels/slack/blocks.js";import{resolveSlackInboundMrkdwn}from"#public/channels/slack/inbound-content.js";import{truncateTypingStatus}from"#public/channels/slack/limits.js";import{slackMrkdwnToGfm}from"#public/channels/slack/mrkdwn.js";import{callSlackApiTrackingResponse,slackApiOptions}from"#public/channels/slack/transport.js";const log=createLogger(`slack.api`);function slackContinuationToken(e,t){return`${e}:${t}`}async function resolveSlackBotToken(e,t={}){let n=e??process.env.SLACK_BOT_TOKEN;if(!n)throw Error(`SLACK_BOT_TOKEN is required.`);return typeof n==`function`?n(t):resolveSlackBotToken$1(n)}async function callSlackApi(e){return callSlackApiTrackingResponse(e.operation,normalizeSlackApiBody(e.body),slackApiOptions(e.api,()=>resolveSlackBotToken(e.botToken,e.context)))}function createSlackRequester(e,t,n){return(r,i)=>callSlackApi({api:e,botToken:t,context:n,operation:r,body:i})}function buildSlackWorkspaceHandle(e){return{teamId:e.teamId,request:createSlackRequester(e.api,e.botToken,{teamId:e.installationTeamId})}}function buildSlackBinding(e){let t={teamId:e.installationTeamId},n=slackApiOptions(e.api,()=>resolveSlackBotToken(e.botToken,t)),r=createSlackRequester(e.api,e.botToken,t),i=[],a=e.threadTs,o;function handleMessageTs(t){a||t===a||(a=t,e.onThreadTsChanged?.(t))}async function uploadFiles(t,r){let i=r?.channelId??e.channelId,o=r?.threadTs??a,s=t.map(e=>toSlackFileUpload(e,r?.snippetType));return uploadSlackFiles(s,{...n,channelId:i||void 0,initialComment:r?.initialComment,threadTs:o||void 0})}function refreshMessages(){if(o!==void 0)return o;async function fetchAndReplace(){if(!e.channelId||!a){i=[];return}try{i=(await fetchSlackThreadReplies({...n,channel:e.channelId,limit:50,ts:a})).messages.map(t=>parseThreadMessage(t,a,{appId:e.appId,botUserId:e.botUserId}))}catch(t){logError(log,`refresh threw — swallowed`,t,{channelId:e.channelId})}}let t=fetchAndReplace().finally(()=>{o===t&&(o=void 0)});return o=t,t}let s={get recentMessages(){return i},async listParticipants(){await s.refresh();let e=new Set;for(let t of i)t.user!==void 0&&t.botId===void 0&&e.add(t.user);return[...e]},async post(t){let r=normalizePostInput(t),i=r.files??[],o=`blocks`in r||`card`in r||`markdown`in r;if(i.length>0&&!o){let e=await uploadFiles(i,{initialComment:`text`in r?r.text:void 0});return{id:Array.isArray(e.raw.files)&&e.raw.files.length>0?String(e.raw.files[0].id??``):``,raw:e.raw}}let s=await postSlackMessage(buildPostMessageOptions(r,e.channelId,a,n)),c=s.id;if(handleMessageTs(c),i.length>0&&o)try{await uploadFiles(i)}catch(e){log.warn(`file upload after message post failed`,{error:e})}return{id:c,raw:s.raw}},async postEphemeral(t,r){let i=normalizePostInput(r),o=await postSlackEphemeral({...buildPostMessageOptions(i,e.channelId,a,n),user:t});return{id:o.id,raw:o.raw}},async postDirectMessage(e,t){let i=await r(`conversations.open`,{users:e}),a=i.ok===!0?i.channel?.id:void 0;if(typeof a!=`string`||a.length===0)throw Error(`Slack conversations.open failed: ${i.error??`unknown_error`}`);let o=normalizePostInput(t),s=await postSlackMessage(buildPostMessageOptions(o,a,``,n));return{id:s.id,raw:s.raw}},async startTyping(t){if(e.channelId&&a)try{let n=t===void 0?``:truncateTypingStatus(t),i={channel_id:e.channelId,thread_ts:a,status:n};n.length>0&&(i.loading_messages=[n]);let o=await r(`assistant.threads.setStatus`,i);o.ok!==!0&&log.warn(`assistant.threads.setStatus returned not-ok`,{error:o.error})}catch(t){logError(log,`startTyping threw — swallowed`,t,{channelId:e.channelId})}},refresh(){return refreshMessages()},mentionUser(e){return`<@${e}>`}};return{thread:s,slack:{channelId:e.channelId,get threadTs(){return a},teamId:e.teamId,request:r,uploadFiles}}}function normalizePostInput(e){return typeof e==`string`?{markdown:e}:isCardElement(e)?{card:e}:e}function buildPostMessageOptions(e,t,n,r){let i={...r,channel:t,threadTs:n||void 0,unfurlLinks:!1,unfurlMedia:!1};return`card`in e?(i.blocks=cardToBlocks(e.card),i.text=e.fallbackText??cardToFallbackText(e.card),i):`blocks`in e?(i.blocks=[...e.blocks],e.text!==void 0&&(i.text=e.text),i):`markdown`in e?(i.markdownText=e.markdown,i):(i.text=e.text,i)}function normalizeSlackApiBody(e){return e&&typeof e==`object`&&!Array.isArray(e)?e:{}}function toSlackFileUpload(e,t){return{data:normalizeFileData(e.data),filename:e.filename,snippetType:t}}function normalizeFileData(e){if(e instanceof ArrayBuffer||typeof Blob<`u`&&e instanceof Blob)return e;if(ArrayBuffer.isView(e)){let t=e;return new Uint8Array(t.buffer,t.byteOffset,t.byteLength)}return e}function parseThreadMessage(e,t,n){let r=typeof e.text==`string`?e.text:``,i=resolveSlackInboundMrkdwn(r,e),a=typeof e.ts==`string`?e.ts:``,o=typeof e.thread_ts==`string`?e.thread_ts:t,s=typeof e.user==`string`?e.user:void 0,c=typeof e.bot_id==`string`?e.bot_id:void 0,l=typeof e.app_id==`string`?e.app_id:void 0,u=n.botUserId!==void 0&&s===n.botUserId||n.appId!==void 0&&l===n.appId;return{text:i,markdown:slackMrkdwnToGfm(i),user:s,botId:c,ts:a,threadTs:o,isMe:u,raw:e}}export{buildSlackBinding,buildSlackWorkspaceHandle,callSlackApi,resolveSlackBotToken,slackContinuationToken};
@@ -1 +1 @@
1
- import{createLogger}from"#internal/logging.js";import{evaluateFilePart,formatUploadPolicyViolation,isUploadsDisabled}from"#public/channels/upload-policy.js";import{EveAttachmentError}from"#internal/attachments/errors.js";import{resolveSlackBotToken}from"#public/channels/slack/api.js";import{isConfiguredSlackFileUrl,resolveSlackTransportOptions}from"#public/channels/slack/transport.js";const log=createLogger(`slack.attachments`);function collectSlackFileParts(e,t){let n=[];for(let r of e??[]){let e=toSlackFilePart(r,n.length);if(e===null)continue;let i=evaluateFilePart(e,t);if(i!==null){log.warn(`dropped attachment — ${formatUploadPolicyViolation(i)}`,{name:r.name});continue}n.push(e)}return n}function toSlackFilePart(e,t){return e.type===`audio`||e.type===`video`?null:e.url?{type:`file`,mediaType:e.mimeType??`application/octet-stream`,filename:e.name??`attachment-${t}`,data:new URL(e.url)}:(log.warn(`dropped attachment — no url available`,{name:e.name}),null)}async function collectInboundFileParts(e){let t=collectSlackFileParts(e.mention.attachments,e.policy);if(t.length>0)return t;if(isUploadsDisabled(e.policy))return[];if(e.thread.recentMessages.length===0)try{await e.thread.refresh()}catch(e){return log.warn(`slack thread refresh failed for attachment collection`,{error:e}),[]}let n=e.thread.recentMessages;for(let t=n.length-1;t>=0;--t){let r=n[t];if(!r||r.isMe)continue;let i=r.raw,a=collectSlackFileParts(extractAttachmentsFromRaw(i?.files),e.policy);return a.length>0?a:[]}return[]}function extractAttachmentsFromRaw(e){return Array.isArray(e)?e.map(e=>{let t=typeof e.mimetype==`string`?e.mimetype:void 0;return{id:typeof e.id==`string`?e.id:``,type:inferAttachmentType(t),url:typeof e.url_private==`string`?e.url_private:void 0,name:typeof e.name==`string`?e.name:void 0,mimeType:t,size:typeof e.size==`number`?e.size:void 0}}):[]}function inferAttachmentType(e){return e===void 0?`file`:e.startsWith(`image/`)?`image`:e.startsWith(`video/`)?`video`:e.startsWith(`audio/`)?`audio`:`file`}function buildSlackTurnMessage(e,t){return t.length===0?e:e.trim().length===0?[...t]:[{type:`text`,text:e},...t]}function createSlackFetchFile(e){let t=resolveSlackTransportOptions(e.api);return async(n,r)=>{if(!isConfiguredSlackFileUrl(t,n)&&!isSlackFileUrl(n))return null;let i=r?.state.installationTeamId,a=await resolveSlackBotToken(e.botToken,{teamId:typeof i==`string`?i:void 0}),o=await(t?.fetch??fetch)(n,{headers:{authorization:`Bearer ${a}`}});if(!o.ok)throw new EveAttachmentError({adapterKind:`slack`,kind:`resolver-threw`,message:`Slack file fetch returned HTTP ${o.status}.`});let s=o.headers.get(`content-type`)??void 0;if(s?.split(`;`,1)[0]?.trim().toLowerCase()===`text/html`)throw new EveAttachmentError({adapterKind:`slack`,kind:`resolver-threw`,message:`Slack returned an HTML sign-in page instead of file bytes. The bot token may be missing the files:read scope. Add the scope, reinstall the Slack app, and retry.`});return{bytes:Buffer.from(await o.arrayBuffer()),mediaType:s}}}function isSlackFileUrl(e){let t=URL.parse(e);return t?.protocol===`https:`?t.hostname===`files.slack.com`||(t.hostname===`enterprise.slack.com`||t.hostname.endsWith(`.enterprise.slack.com`))&&t.pathname.startsWith(`/files/`):!1}export{buildSlackTurnMessage,collectInboundFileParts,collectSlackFileParts,createSlackFetchFile};
1
+ import{createLogger}from"#internal/logging.js";import{evaluateFilePart,formatUploadPolicyViolation,isUploadsDisabled}from"#public/channels/upload-policy.js";import{EveAttachmentError}from"#internal/attachments/errors.js";import{isConfiguredSlackFileUrl,resolveSlackTransportOptions}from"#public/channels/slack/transport.js";import{resolveSlackBotToken}from"#public/channels/slack/api.js";const log=createLogger(`slack.attachments`);function collectSlackFileParts(e,t){let n=[];for(let r of e??[]){let e=toSlackFilePart(r,n.length);if(e===null)continue;let i=evaluateFilePart(e,t);if(i!==null){log.warn(`dropped attachment — ${formatUploadPolicyViolation(i)}`,{name:r.name});continue}n.push(e)}return n}function toSlackFilePart(e,t){return e.type===`audio`||e.type===`video`?null:e.url?{type:`file`,mediaType:e.mimeType??`application/octet-stream`,filename:e.name??`attachment-${t}`,data:new URL(e.url)}:(log.warn(`dropped attachment — no url available`,{name:e.name}),null)}async function collectInboundFileParts(e){let t=collectSlackFileParts(e.mention.attachments,e.policy);if(t.length>0)return t;if(isUploadsDisabled(e.policy))return[];if(e.thread.recentMessages.length===0)try{await e.thread.refresh()}catch(e){return log.warn(`slack thread refresh failed for attachment collection`,{error:e}),[]}let n=e.thread.recentMessages;for(let t=n.length-1;t>=0;--t){let r=n[t];if(!r||r.isMe)continue;let i=r.raw,a=collectSlackFileParts(extractAttachmentsFromRaw(i?.files),e.policy);return a.length>0?a:[]}return[]}function extractAttachmentsFromRaw(e){return Array.isArray(e)?e.map(e=>{let t=typeof e.mimetype==`string`?e.mimetype:void 0;return{id:typeof e.id==`string`?e.id:``,type:inferAttachmentType(t),url:typeof e.url_private==`string`?e.url_private:void 0,name:typeof e.name==`string`?e.name:void 0,mimeType:t,size:typeof e.size==`number`?e.size:void 0}}):[]}function inferAttachmentType(e){return e===void 0?`file`:e.startsWith(`image/`)?`image`:e.startsWith(`video/`)?`video`:e.startsWith(`audio/`)?`audio`:`file`}function buildSlackTurnMessage(e,t){return t.length===0?e:e.trim().length===0?[...t]:[{type:`text`,text:e},...t]}function createSlackFetchFile(e){let t=resolveSlackTransportOptions(e.api);return async(n,r)=>{if(!isConfiguredSlackFileUrl(t,n)&&!isSlackFileUrl(n))return null;let i=r?.state.installationTeamId,a=await resolveSlackBotToken(e.botToken,{teamId:typeof i==`string`?i:void 0}),o=await(t?.fetch??fetch)(n,{headers:{authorization:`Bearer ${a}`}});if(!o.ok)throw new EveAttachmentError({adapterKind:`slack`,kind:`resolver-threw`,message:`Slack file fetch returned HTTP ${o.status}.`});let s=o.headers.get(`content-type`)??void 0;if(s?.split(`;`,1)[0]?.trim().toLowerCase()===`text/html`)throw new EveAttachmentError({adapterKind:`slack`,kind:`resolver-threw`,message:`Slack returned an HTML sign-in page instead of file bytes. The bot token may be missing the files:read scope. Add the scope, reinstall the Slack app, and retry.`});return{bytes:Buffer.from(await o.arrayBuffer()),mediaType:s}}}function isSlackFileUrl(e){let t=URL.parse(e);return t?.protocol===`https:`?t.hostname===`files.slack.com`||(t.hostname===`enterprise.slack.com`||t.hostname.endsWith(`.enterprise.slack.com`))&&t.pathname.startsWith(`/files/`):!1}export{buildSlackTurnMessage,collectInboundFileParts,collectSlackFileParts,createSlackFetchFile};
@@ -1,4 +1,5 @@
1
1
  import type { SessionAuthContext } from "#channel/types.js";
2
+ import type { SlackChannelState } from "#public/channels/slack/slackChannel.js";
2
3
  interface SlackAuthContextInput {
3
4
  readonly channelId: string;
4
5
  readonly fullName?: string;
@@ -10,6 +11,8 @@ interface SlackAuthContextInput {
10
11
  }
11
12
  /** Returns the Slack user id carried by a Slack-derived auth context. */
12
13
  export declare function slackUserIdFromAuthContext(auth: SessionAuthContext | null): string | undefined;
14
+ /** Returns the Slack user recorded for a principal, if one has been seen in this thread. */
15
+ export declare function slackUserIdForPrincipal(state: Pick<SlackChannelState, "slackUsersByPrincipal">, principalId: string | undefined): string | undefined;
13
16
  /**
14
17
  * Builds the Slack-derived session auth context used by inbound
15
18
  * messages and signed interactivity callbacks.
@@ -1 +1 @@
1
- function slackUserIdFromAuthContext(e){if(e?.authenticator!==`slack-webhook`)return;let t=e.attributes.user_id;return typeof t==`string`&&t.length>0?t:void 0}function buildSlackAuthContext(e){let t=e.isBot===!0,n=e.teamId?t?`slack:${e.teamId}:bot:${e.userId}`:`slack:${e.teamId}:${e.userId}`:t?`slack:bot:${e.userId}`:`slack:${e.userId}`,r={author_type:t?`bot`:`user`,channel_id:e.channelId,thread_ts:e.threadTs,user_id:e.userId};return e.userName&&(r.user_name=e.userName),e.fullName&&(r.full_name=e.fullName),e.teamId&&(r.team_id=e.teamId),{attributes:r,authenticator:`slack-webhook`,issuer:e.teamId?`slack:${e.teamId}`:`slack`,principalId:n,principalType:t?`service`:`user`}}export{buildSlackAuthContext,slackUserIdFromAuthContext};
1
+ function slackUserIdFromAuthContext(e){if(e?.authenticator!==`slack-webhook`)return;let t=e.attributes.user_id;return typeof t==`string`&&t.length>0?t:void 0}function slackUserIdForPrincipal(e,t){return t===void 0?void 0:e.slackUsersByPrincipal?.[t]}function buildSlackAuthContext(e){let t=e.isBot===!0,n=e.teamId?t?`slack:${e.teamId}:bot:${e.userId}`:`slack:${e.teamId}:${e.userId}`:t?`slack:bot:${e.userId}`:`slack:${e.userId}`,r={author_type:t?`bot`:`user`,channel_id:e.channelId,thread_ts:e.threadTs,user_id:e.userId};return e.userName&&(r.user_name=e.userName),e.fullName&&(r.full_name=e.fullName),e.teamId&&(r.team_id=e.teamId),{attributes:r,authenticator:`slack-webhook`,issuer:e.teamId?`slack:${e.teamId}`:`slack`,principalId:n,principalType:t?`service`:`user`}}export{buildSlackAuthContext,slackUserIdForPrincipal,slackUserIdFromAuthContext};
@@ -7,9 +7,9 @@
7
7
  * posted sign-in link and bind their own identity to the session. The
8
8
  * default handler therefore posts a link-free public status while
9
9
  * delivering the actual challenge as an ephemeral "Sign in"
10
- * message visible only to the triggering user.
10
+ * message visible only to the Slack user behind the event's `principalId`.
11
11
  *
12
- * When no user can be targeted (no triggering user id, no challenge
12
+ * When no user can be targeted (no Slack user for the principal, no challenge
13
13
  * URL, or the ephemeral delivery fails), the public status still leaves
14
14
  * the shared thread with safe progress feedback. The matching
15
15
  * `authorization.completed` handler edits that status post in place to
@@ -27,13 +27,13 @@ export declare function formatConnectionDisplayName(connectionName: string): str
27
27
  /**
28
28
  * Public status text for an authorization challenge. Deliberately
29
29
  * link-free: it must stay safe to post in a shared thread. When the
30
- * channel cannot identify a triggering user (rare — schedule-initiated
31
- * sessions or events that lack actor metadata) the text drops the
32
- * "Connect with" call-to-action since there's no one to act on it.
30
+ * principal has no Slack user in this thread (schedule-initiated sessions,
31
+ * or principals never seen here) the text drops the "Connect with"
32
+ * call-to-action since no one received the link.
33
33
  */
34
34
  export declare function buildAuthRequiredPublicText(input: {
35
35
  readonly displayName: string;
36
- readonly hasUser: boolean;
36
+ readonly hasRecipient: boolean;
37
37
  }): string;
38
38
  /**
39
39
  * Final-state markdown for the public status message. Edited in place by
@@ -1 +1 @@
1
- function formatConnectionDisplayName(e){return e.length===0?e:e.charAt(0).toUpperCase()+e.slice(1)}function buildAuthRequiredPublicText(e){return e.hasUser?`Connect with ${e.displayName} to continue`:`Authorization required for ${e.displayName} (no triggering user)`}function buildAuthCompletedText(e){if(e.outcome===`authorized`)return`:white_check_mark: ${e.displayName} connected`;let t=e.reason===void 0?``:` (${e.reason})`;return`:x: ${e.displayName} authorization ${e.outcome}${t}`}function buildAuthEphemeralBlocks(e){let t=[];return e.userCode!==void 0&&e.userCode.length>0&&t.push({type:`section`,text:{type:`mrkdwn`,text:`Use code \`${e.userCode}\` when prompted.`}}),t.push({type:`actions`,elements:[{type:`button`,text:{type:`plain_text`,text:`Sign in`},url:e.url,style:`primary`}]}),t}export{buildAuthCompletedText,buildAuthEphemeralBlocks,buildAuthRequiredPublicText,formatConnectionDisplayName};
1
+ function formatConnectionDisplayName(e){return e.length===0?e:e.charAt(0).toUpperCase()+e.slice(1)}function buildAuthRequiredPublicText(e){return e.hasRecipient?`Connect with ${e.displayName} to continue`:`Authorization required for ${e.displayName} (couldn't send the sign-in link privately)`}function buildAuthCompletedText(e){if(e.outcome===`authorized`)return`:white_check_mark: ${e.displayName} connected`;let t=e.reason===void 0?``:` (${e.reason})`;return`:x: ${e.displayName} authorization ${e.outcome}${t}`}function buildAuthEphemeralBlocks(e){let t=[];return e.userCode!==void 0&&e.userCode.length>0&&t.push({type:`section`,text:{type:`mrkdwn`,text:`Use code \`${e.userCode}\` when prompted.`}}),t.push({type:`actions`,elements:[{type:`button`,text:{type:`plain_text`,text:`Sign in`},url:e.url,style:`primary`}]}),t}export{buildAuthCompletedText,buildAuthEphemeralBlocks,buildAuthRequiredPublicText,formatConnectionDisplayName};
@@ -4,30 +4,25 @@ import type { SlackApprovalChannelResolver, SlackChannelInternalEvents, SlackCon
4
4
  /**
5
5
  * Workspace-scoped projection of the Slack actor that produced
6
6
  * `message`, derived into a {@link SessionAuthContext}. Used by both
7
- * {@link defaultOnAppMention} and {@link defaultOnDirectMessage} when
7
+ * {@link defaultOnMessage} when
8
8
  * the customer hasn't supplied their own `onAppMention` /
9
9
  * `onDirectMessage`. Returns `null` when the message has no author.
10
10
  */
11
11
  export declare function defaultSlackAuth(message: SlackMessage, ctx: SlackContext): SessionAuthContext | null;
12
12
  /**
13
- * Default `onAppMention` — derives auth from the Slack actor and posts
14
- * a `"Thinking…"` typing indicator before the workflow runtime starts.
13
+ * Default `onAppMention` and `onDirectMessage`: dispatches with auth derived
14
+ * from the Slack actor. Acknowledging the message is the renderer chain's
15
+ * `received`, so replacing a message hook never drops it.
15
16
  */
16
- export declare function defaultOnAppMention(ctx: SlackContext, message: SlackMessage): Promise<SlackMentionResult>;
17
- /**
18
- * Default `onDirectMessage` — derives auth from the Slack actor and
19
- * posts a `"Thinking…"` typing indicator before the workflow runtime
20
- * starts. Matches the default mention behavior; replace the option to
21
- * customize gating, auth derivation, or pre-dispatch side effects.
22
- */
23
- export declare function defaultOnDirectMessage(ctx: SlackContext, message: SlackMessage): Promise<SlackMentionResult>;
17
+ export declare function defaultOnMessage(ctx: SlackContext, message: SlackMessage): SlackMentionResult;
18
+ /** eve's default `received`: the `Thinking...` status, set the moment a message arrives. */
19
+ export declare function defaultReceived(_message: SlackMessage, ctx: SlackContext): Promise<void>;
24
20
  /**
25
21
  * Default `input.requested` handler — renders each pending HITL
26
22
  * request as Slack `block_actions`. Buttons by default; radio for
27
23
  * ≤6-option select requests; static_select for >6-option select
28
24
  * requests. Batches split into multiple posts when they would exceed
29
- * Slack's 50-block message cap. Override by declaring
30
- * `events["input.requested"]`.
25
+ * Slack's 50-block message cap.
31
26
  */
32
27
  export declare function defaultInputRequestedHandler(approvalChannel?: SlackApprovalChannelResolver): NonNullable<SlackChannelInternalEvents["input.requested"]>;
33
28
  /**
@@ -37,11 +32,10 @@ export declare function defaultInputRequestedHandler(approvalChannel?: SlackAppr
37
32
  */
38
33
  export declare function postCompletedSlackReply(channel: SlackContext, message: string): Promise<void>;
39
34
  /**
40
- * Built-in Slack event handlers — typing indicators, error replies,
41
- * and the connection-authorization status flow. Each is overridable
42
- * per-event by passing the same key under `slackChannel({ events })`.
43
- * Typed as the internal full-context map because the default
44
- * `authorization.required` handler owns the public link-free status,
45
- * which user overrides cannot express.
35
+ * eve's default Slack event rendering: status lines, replies, errors, and the
36
+ * connection-authorization flow. It is the innermost link of every channel's
37
+ * renderer chain. Typed as the internal full-context map because the default
38
+ * `authorization.required` handler owns the public link-free status, which
39
+ * authored renderers cannot express.
46
40
  */
47
41
  export declare const defaultEvents: SlackChannelInternalEvents;
@@ -1,7 +1,7 @@
1
- import{createLogger,extractErrorId,formatErrorHint,logError}from"#internal/logging.js";import{SLACK_MARKDOWN_TEXT_MAX_LENGTH,SLACK_MAX_BLOCKS_PER_MESSAGE,truncateMessageText,truncateTypingStatus}from"#public/channels/slack/limits.js";import{describeActionRequests}from"#public/channels/slack/action-status.js";import{buildSlackAuthContext,slackUserIdFromAuthContext}from"#public/channels/slack/auth.js";import{buildAuthCompletedText,buildAuthEphemeralBlocks,buildAuthRequiredPublicText,formatConnectionDisplayName}from"#public/channels/slack/connections.js";import{buildAnsweredBlocks,decodeHitlActionId,renderInputRequestPostParts}from"#public/channels/slack/hitl.js";import{deliverPrivateInputRequest}from"#public/channels/slack/private-approval-delivery.js";const log=createLogger(`slack.defaults`),LONG_RESPONSE_NOTICE=`Here's a snippet with the full response.`,reasoningByState=new WeakMap;function extractSemanticErrorSummary(e){if(typeof e.details!=`object`||e.details===null)return null;let t=e.details;if(typeof t.semanticErrorId!=`string`||t.semanticErrorId.length===0||typeof t.name!=`string`||t.name.length===0)return null;let n=typeof t.message==`string`&&t.message.trim().length>0?t.message.trim():e.message?.trim();if(!n)return null;let r=typeof t.hint==`string`&&t.hint.trim().length>0?t.hint.trim():void 0;return r===void 0?{message:n,name:t.name}:{hint:r,message:n,name:t.name}}function formatSemanticErrorBlock(e,t){return[`### ${e.name}`,``,e.message,...e.hint?[``,`**How to fix**`,e.hint]:[],...t?[``,`**Error id:**`,`\`${t}\``]:[]].flatMap(e=>e.split(`
1
+ import{createLogger,extractErrorId,formatErrorHint,logError}from"#internal/logging.js";import{isTaskControlTool}from"#protocol/task-tools.js";import{SLACK_MARKDOWN_TEXT_MAX_LENGTH,SLACK_MAX_BLOCKS_PER_MESSAGE,truncateMessageText,truncateTypingStatus}from"#public/channels/slack/limits.js";import{workingTaskNames}from"#channel/task-card.js";import{describeActionRequests,waitingOnTasks}from"#public/channels/slack/action-status.js";import{buildSlackAuthContext,slackUserIdForPrincipal,slackUserIdFromAuthContext}from"#public/channels/slack/auth.js";import{buildAuthCompletedText,buildAuthEphemeralBlocks,buildAuthRequiredPublicText,formatConnectionDisplayName}from"#public/channels/slack/connections.js";import{buildAnsweredBlocks,decodeHitlActionId,renderInputRequestPostParts}from"#public/channels/slack/hitl.js";import{deliverPrivateInputRequest}from"#public/channels/slack/private-approval-delivery.js";const log=createLogger(`slack.defaults`),LONG_RESPONSE_NOTICE=`Here's a snippet with the full response.`,reasoningByState=new WeakMap;function extractSemanticErrorSummary(e){if(typeof e.details!=`object`||e.details===null)return null;let t=e.details;if(typeof t.semanticErrorId!=`string`||t.semanticErrorId.length===0||typeof t.name!=`string`||t.name.length===0)return null;let n=typeof t.message==`string`&&t.message.trim().length>0?t.message.trim():e.message?.trim();if(!n)return null;let r=typeof t.hint==`string`&&t.hint.trim().length>0?t.hint.trim():void 0;return r===void 0?{message:n,name:t.name}:{hint:r,message:n,name:t.name}}function formatSemanticErrorBlock(e,t){return[`### ${e.name}`,``,e.message,...e.hint?[``,`**How to fix**`,e.hint]:[],...t?[``,`**Error id:**`,`\`${t}\``]:[]].flatMap(e=>e.split(`
2
2
  `)).map(e=>e.length>0?`> ${e}`:`> `).join(`
3
3
  `)}function formatSemanticErrorReply(e){return[`${e.introduction}.`,``,formatSemanticErrorBlock(e.summary,e.errorId),...e.summary.hint?[]:[``,e.nextStep],...e.summary.hint&&e.followUp?[``,e.followUp]:[]].join(`
4
- `)}function blockContainsRequestAction(e,t){if(typeof e!=`object`||!e)return!1;let n=e;return[n.actions,n.elements].some(e=>Array.isArray(e)&&e.some(e=>{if(typeof e!=`object`||!e)return!1;let n=e.action_id;return typeof n==`string`&&decodeHitlActionId(n)?.requestId===t}))}function defaultSlackAuth(e,t){let n=e.author;return n?buildSlackAuthContext({channelId:t.slack.channelId,fullName:n.fullName,isBot:n.isBot,teamId:e.teamId,threadTs:t.slack.threadTs,userId:n.userId,userName:n.userName}):null}async function defaultOnAppMention(e,t){return await e.thread.startTyping(`Thinking...`),{auth:defaultSlackAuth(t,e)}}async function defaultOnDirectMessage(e,t){return await e.thread.startTyping(`Thinking...`),{auth:defaultSlackAuth(t,e)}}function firstNonEmptyLine(e){for(let t of e.split(/\r?\n/u)){let e=t.trim();if(e.length>0)return e}}function defaultInputRequestedHandler(e){return async(t,n,r)=>{let i=[],a=[];for(let n of t.requests)((e===void 0?`thread`:await e(n,r))===`direct-message`?i:a).push(n);await postPublicInputRequests(a,n);for(let e of i){let t=slackUserIdFromAuthContext(r.session.auth.current)??n.state.triggeringUserId;if(!t){log.warn(`direct-message input request not delivered because no reviewer was resolved`,{requestId:e.requestId,sessionId:r.session.id});continue}let i=await deliverPrivateInputRequest({previewMessageTs:n.state.triggeringMessageTs??n.slack.threadTs,request:e,reviewer:t,slack:n.slack});recordApprovalCards(n.state,[e],i);try{await n.thread.post(`Waiting on ${e.kind===`tool-approval`?`approval`:`a response`} from <@${t}>…`)}catch(t){logError(log,`failed to announce private input request`,t,{requestId:e.requestId,sessionId:r.session.id})}}}}async function postPublicInputRequests(e,t){for(let n of buildInputRequestPosts(e)){let e=await t.thread.post({blocks:n.blocks,text:n.text});recordApprovalCards(t.state,n.requests,{messageBlocks:n.blocks,messageTs:e.id})}}function recordApprovalCards(e,t,n){if(!n.messageTs)return;let r={...e.pendingApprovalCards};for(let e of t)e.kind===`tool-approval`&&(r[e.requestId]=n);e.pendingApprovalCards=r}function buildInputRequestPosts(e){let t=[],n=[];for(let r of e){let e=renderInputRequestPostParts(r);e.details&&t.push({...e.details,request:r}),n.push({...e.controls,request:r})}return[...groupInputRequestPostParts(t),...groupInputRequestPostParts(n)]}function groupInputRequestPostParts(e){let t=[];for(let n of e){let e=t.at(-1);e&&e.blocks.length+n.blocks.length<=SLACK_MAX_BLOCKS_PER_MESSAGE?(e.blocks.push(...n.blocks),e.fallbacks.push(n.text),e.requests.push(n.request)):t.push({blocks:[...n.blocks],fallbacks:[n.text],requests:[n.request]})}return t.map(e=>({blocks:e.blocks,requests:e.requests,text:truncateMessageText(e.fallbacks.join(`
5
- `))}))}async function postCompletedSlackReply(e,t){if(t.length<=SLACK_MARKDOWN_TEXT_MAX_LENGTH){await e.thread.post(t);return}let n={data:new Blob([t],{type:`text/markdown`}),filename:`eve-response.md`,mimeType:`text/markdown`},r=e.slack.threadTs.length>0;if(!r&&(!(await e.thread.post(LONG_RESPONSE_NOTICE)).id||e.slack.threadTs.length===0))throw Error(`Slack did not return a thread timestamp for the long response notice.`);await e.slack.uploadFiles([n],{initialComment:r?LONG_RESPONSE_NOTICE:void 0,snippetType:`markdown`})}const defaultEvents={async"approval.candidate"(e,t,n){let r=t.state.pendingApprovalCandidateUsers?.[e.candidateId];if(e.outcome===`pending`&&r!==void 0){await t.thread.postEphemeral(r,`Checking whether you can approve this action…`);return}r!==void 0&&(e.outcome===`rejected`||e.outcome===`failed`)&&await t.thread.postEphemeral(r,e.reason??`We couldn’t verify your approval. Please try again.`)},async"approval.settled"(e,t,n){let r=t.state.pendingApprovalCards??{},i=r[e.requestId];if(i===void 0)return;let a=i.messageChannelId??t.state.channelId;if(a===null)return;let o=e.outcome===`approved`?`Approve`:`Cancel`,s=t.state.approvalResponderUsers?.[e.responderPrincipalId],c=i.messageBlocks.flatMap(t=>{if(!blockContainsRequestAction(t,e.requestId))return[t];if(typeof t!=`object`||!t)return[];let n=t;if(n.type!==`card`)return buildAnsweredBlocks({answerLabel:o,promptBlocks:[],userId:s});let{actions:r,...i}=n;return buildAnsweredBlocks({answerLabel:o,promptBlocks:[i],userId:s})});await t.slack.request(`chat.update`,{blocks:c,channel:a,text:`Answered: ${o}`,ts:i.messageTs});let l={...r};delete l[e.requestId];for(let[e,t]of Object.entries(l))t.messageTs===i.messageTs&&(l[e]={...t,messageBlocks:c});t.state.pendingApprovalCards=l},async"turn.started"(e,t,n){t.state.pendingToolCallMessage=null,t.state.lastReasoningTypingAtMs=null,t.state.lastReasoningTypingStatus=null,reasoningByState.delete(t.state),await t.thread.startTyping(`Working...`)},async"reasoning.appended"(e,t,n){let r=reasoningByState.get(t.state),i=r?.turnId===e.turnId&&r.stepIndex===e.stepIndex;i||(t.state.lastReasoningTypingAtMs=null,t.state.lastReasoningTypingStatus=null);let a=(i?r.text:``)+e.reasoningDelta;reasoningByState.set(t.state,{stepIndex:e.stepIndex,text:a,turnId:e.turnId});let o=firstNonEmptyLine(a);if(o===void 0)return;let s=truncateTypingStatus(o),c=t.state.lastReasoningTypingStatus,l=c!=null&&s.startsWith(c)&&s.length>=c.length+4,u=Date.now(),d=t.state.lastReasoningTypingAtMs;if(!l&&d!=null){let e=u-d;if(e>=0&&e<5e3)return}await t.thread.startTyping(s),t.state.lastReasoningTypingAtMs=u,t.state.lastReasoningTypingStatus=s},async"reasoning.completed"(e,t,n){let r=reasoningByState.get(t.state);r?.turnId===e.turnId&&r.stepIndex===e.stepIndex&&(reasoningByState.delete(t.state),t.state.lastReasoningTypingAtMs=null,t.state.lastReasoningTypingStatus=null)},async"actions.requested"(e,t,n){let r=t.state.pendingToolCallMessage;if(t.state.pendingToolCallMessage=null,r){await t.thread.startTyping(truncateTypingStatus(r));return}await t.thread.startTyping(truncateTypingStatus(describeActionRequests(e.actions)))},async"message.completed"(e,t,n){if(e.finishReason===`tool-calls`){t.state.pendingToolCallMessage=e.message?firstNonEmptyLine(e.message)??null:null;return}if(t.state.pendingToolCallMessage=null,!e.message){await t.thread.startTyping();return}await postCompletedSlackReply(t,e.message)},async"turn.failed"(e,t,n){let r=extractErrorId(e.details),i=extractSemanticErrorSummary(e);if(i!==null){await t.thread.post(formatSemanticErrorReply({errorId:r,introduction:`I hit an error while handling your request`,nextStep:`Please try again, rephrase, or reach out if it keeps failing.`,summary:i}));return}let a=formatErrorHint(e);await t.thread.post([`I hit an error while handling your request${a}.`,``,`Please try again, rephrase, or reach out if it keeps failing.`,...r?[``,`_Error id: \`${r}\`_`]:[]].join(`
4
+ `)}function blockContainsRequestAction(e,t){if(typeof e!=`object`||!e)return!1;let n=e;return[n.actions,n.elements].some(e=>Array.isArray(e)&&e.some(e=>{if(typeof e!=`object`||!e)return!1;let n=e.action_id;return typeof n==`string`&&decodeHitlActionId(n)?.requestId===t}))}function defaultSlackAuth(e,t){let n=e.author;return n?buildSlackAuthContext({channelId:t.slack.channelId,fullName:n.fullName,isBot:n.isBot,teamId:e.teamId,threadTs:t.slack.threadTs,userId:n.userId,userName:n.userName}):null}function defaultOnMessage(e,t){return{auth:defaultSlackAuth(t,e)}}async function defaultReceived(e,t){await t.thread.startTyping(`Thinking...`)}function firstNonEmptyLine(e){for(let t of e.split(/\r?\n/u)){let e=t.trim();if(e.length>0)return e}}function defaultInputRequestedHandler(e){return async(t,n,r)=>{let i=[],a=[];for(let n of t.requests)((e===void 0?`thread`:await e(n,r))===`direct-message`?i:a).push(n);await postPublicInputRequests(a,n);for(let e of i){let t=slackUserIdFromAuthContext(r.session.auth.current)??n.state.triggeringUserId;if(!t){log.warn(`direct-message input request not delivered because no reviewer was resolved`,{requestId:e.requestId,sessionId:r.session.id});continue}let i=await deliverPrivateInputRequest({previewMessageTs:n.state.triggeringMessageTs??n.slack.threadTs,request:e,reviewer:t,slack:n.slack});recordApprovalCards(n.state,[e],i);try{await n.thread.post(`Waiting on ${e.kind===`tool-approval`?`approval`:`a response`} from <@${t}>…`)}catch(t){logError(log,`failed to announce private input request`,t,{requestId:e.requestId,sessionId:r.session.id})}}}}async function postPublicInputRequests(e,t){for(let n of buildInputRequestPosts(e)){let e=await t.thread.post({blocks:n.blocks,text:n.text});recordApprovalCards(t.state,n.requests,{messageBlocks:n.blocks,messageTs:e.id})}}function recordApprovalCards(e,t,n){if(!n.messageTs)return;let r={...e.pendingApprovalCards};for(let e of t)e.kind===`tool-approval`&&(r[e.requestId]=n);e.pendingApprovalCards=r}function buildInputRequestPosts(e){let t=[],n=[];for(let r of e){let e=renderInputRequestPostParts(r);e.details&&t.push({...e.details,request:r}),n.push({...e.controls,request:r})}return[...groupInputRequestPostParts(t),...groupInputRequestPostParts(n)]}function groupInputRequestPostParts(e){let t=[];for(let n of e){let e=t.at(-1);e&&e.blocks.length+n.blocks.length<=SLACK_MAX_BLOCKS_PER_MESSAGE?(e.blocks.push(...n.blocks),e.fallbacks.push(n.text),e.requests.push(n.request)):t.push({blocks:[...n.blocks],fallbacks:[n.text],requests:[n.request]})}return t.map(e=>({blocks:e.blocks,requests:e.requests,text:truncateMessageText(e.fallbacks.join(`
5
+ `))}))}async function postCompletedSlackReply(e,t){if(t.length<=SLACK_MARKDOWN_TEXT_MAX_LENGTH){await e.thread.post(t);return}let n={data:new Blob([t],{type:`text/markdown`}),filename:`eve-response.md`,mimeType:`text/markdown`},r=e.slack.threadTs.length>0;if(!r&&(!(await e.thread.post(LONG_RESPONSE_NOTICE)).id||e.slack.threadTs.length===0))throw Error(`Slack did not return a thread timestamp for the long response notice.`);await e.slack.uploadFiles([n],{initialComment:r?LONG_RESPONSE_NOTICE:void 0,snippetType:`markdown`})}const defaultEvents={async"approval.candidate"(e,t,n){let r=slackUserIdForPrincipal(t.state,e.responderPrincipalId);if(e.outcome===`pending`&&r!==void 0){await t.thread.postEphemeral(r,`Checking whether you can respond to this approval…`);return}r!==void 0&&(e.outcome===`rejected`||e.outcome===`failed`)&&await t.thread.postEphemeral(r,e.reason??`We couldn’t verify your response. Please try again.`)},async"approval.settled"(e,t,n){let r=t.state.pendingApprovalCards??{},i=r[e.requestId];if(i===void 0)return;let a=i.messageChannelId??t.state.channelId;if(a===null)return;let o=e.outcome===`approved`?`Approve`:`Cancel`,s=slackUserIdForPrincipal(t.state,e.responderPrincipalId),c=i.messageBlocks.flatMap(t=>{if(!blockContainsRequestAction(t,e.requestId))return[t];if(typeof t!=`object`||!t)return[];let n=t;if(n.type!==`card`)return buildAnsweredBlocks({answerLabel:o,promptBlocks:[],userId:s});let{actions:r,...i}=n;return buildAnsweredBlocks({answerLabel:o,promptBlocks:[i],userId:s})});await t.slack.request(`chat.update`,{blocks:c,channel:a,text:`Answered: ${o}`,ts:i.messageTs});let l={...r};delete l[e.requestId];for(let[e,t]of Object.entries(l))t.messageTs===i.messageTs&&(l[e]={...t,messageBlocks:c});t.state.pendingApprovalCards=l},async"turn.waiting"(e,t,n){let r=workingTaskNames(t.state.taskCards?.[e.turnId]?.turn);r.length>0&&await t.thread.startTyping(waitingOnTasks(r))},async"turn.started"(e,t,n){t.state.pendingToolCallMessage=null,t.state.lastReasoningTypingAtMs=null,t.state.lastReasoningTypingStatus=null,reasoningByState.delete(t.state),await t.thread.startTyping(`Working...`)},async"turn.completed"(e,t,n){await t.thread.startTyping()},async"reasoning.appended"(e,t,n){let r=reasoningByState.get(t.state),i=r?.turnId===e.turnId&&r.stepIndex===e.stepIndex;i||(t.state.lastReasoningTypingAtMs=null,t.state.lastReasoningTypingStatus=null);let a=(i?r.text:``)+e.reasoningDelta;reasoningByState.set(t.state,{stepIndex:e.stepIndex,text:a,turnId:e.turnId});let o=firstNonEmptyLine(a);if(o===void 0)return;let s=truncateTypingStatus(o),c=t.state.lastReasoningTypingStatus,l=c!=null&&s.startsWith(c)&&s.length>=c.length+4,u=Date.now(),d=t.state.lastReasoningTypingAtMs;if(!l&&d!=null){let e=u-d;if(e>=0&&e<5e3)return}await t.thread.startTyping(s),t.state.lastReasoningTypingAtMs=u,t.state.lastReasoningTypingStatus=s},async"reasoning.completed"(e,t,n){let r=reasoningByState.get(t.state);r?.turnId===e.turnId&&r.stepIndex===e.stepIndex&&(reasoningByState.delete(t.state),t.state.lastReasoningTypingAtMs=null,t.state.lastReasoningTypingStatus=null)},async"actions.requested"(e,t,n){let r=t.state.pendingToolCallMessage;if(t.state.pendingToolCallMessage=null,r){await t.thread.startTyping(truncateTypingStatus(r));return}let i=e.actions.filter(e=>e.kind!==`tool-call`||!isTaskControlTool(e.toolName));i.length!==0&&await t.thread.startTyping(truncateTypingStatus(describeActionRequests(i,e.presentation)))},async"message.completed"(e,t,n){if(e.finishReason===`tool-calls`){t.state.pendingToolCallMessage=e.message?firstNonEmptyLine(e.message)??null:null;return}if(t.state.pendingToolCallMessage=null,!e.message){await t.thread.startTyping();return}await postCompletedSlackReply(t,e.message)},async"turn.failed"(e,t,n){let r=extractErrorId(e.details),i=extractSemanticErrorSummary(e);if(i!==null){await t.thread.post(formatSemanticErrorReply({errorId:r,introduction:`I hit an error while handling your request`,nextStep:`Please try again, rephrase, or reach out if it keeps failing.`,summary:i}));return}let a=formatErrorHint(e);await t.thread.post([`I hit an error while handling your request${a}.`,``,`Please try again, rephrase, or reach out if it keeps failing.`,...r?[``,`_Error id: \`${r}\`_`]:[]].join(`
6
6
  `))},async"session.failed"(e,t){let n=extractErrorId(e.details),r=extractSemanticErrorSummary(e);if(r!==null){await t.thread.post(formatSemanticErrorReply({errorId:n,followUp:`Start a new thread to continue — I can't pick this one back up.`,introduction:`This session couldn't recover from an error`,nextStep:`Resolve the issue, then start a new thread — I can't pick this one back up.`,summary:r}));return}let i=formatErrorHint(e);await t.thread.post([`This session couldn't recover from an error${i}.`,``,`Start a new thread to continue — I can't pick this one back up.`,...n?[``,`_Error id: \`${n}\`_`]:[]].join(`
7
- `))},async"authorization.required"(e,t,n){let r=e.authorization?.displayName??formatConnectionDisplayName(e.name),i=e.candidateId===void 0?slackUserIdFromAuthContext(n.session.auth.current)??t.state.triggeringUserId??null:t.state.pendingApprovalCandidateUsers?.[e.candidateId]??null,a=e.authorization?.url,o=t.state.pendingAuthMessageTs??{};if(e.candidateId===void 0&&o[e.name]===void 0){let n=buildAuthRequiredPublicText({displayName:r,hasUser:i!==null});try{let r=await t.thread.post(n);r.id&&(t.state.pendingAuthMessageTs={...o,[e.name]:r.id})}catch(t){log.error(`Slack auth public message delivery failed`,{name:e.name,error:t})}}if(i&&a){let n=e.authorization?.userCode;try{await t.thread.postEphemeral(i,{blocks:buildAuthEphemeralBlocks({displayName:r,url:a,userCode:n}),text:n?`Sign in with ${r}: ${a} (code: ${n})`:`Sign in with ${r}: ${a}`})}catch(t){log.error(`Slack auth ephemeral delivery failed`,{name:e.name,error:t})}}},async"authorization.completed"(e,t,n){let r=e.authorization?.displayName??formatConnectionDisplayName(e.name);e.outcome===`authorized`&&e.candidateId===void 0&&await t.thread.startTyping(`Connected to ${r}. Resuming...`);let i=t.state.pendingAuthMessageTs??{},a=i[e.name];if(a===void 0)return;let o=buildAuthCompletedText({displayName:r,outcome:e.outcome,reason:e.reason});try{await t.slack.request(`chat.update`,{channel:t.slack.channelId,ts:a,text:o})}catch(t){log.error(`Slack auth status edit failed`,{name:e.name,error:t})}let s={...i};delete s[e.name],t.state.pendingAuthMessageTs=s}};export{defaultEvents,defaultInputRequestedHandler,defaultOnAppMention,defaultOnDirectMessage,defaultSlackAuth,postCompletedSlackReply};
7
+ `))},async"authorization.required"(e,t,n){let r=e.authorization?.displayName??formatConnectionDisplayName(e.name),i=slackUserIdForPrincipal(t.state,e.principalId)??null,a=e.authorization?.url,o=t.state.pendingAuthMessageTs??{};if(e.candidateId===void 0&&o[e.name]===void 0){let n=buildAuthRequiredPublicText({displayName:r,hasRecipient:i!==null});try{let r=await t.thread.post(n);r.id&&(t.state.pendingAuthMessageTs={...o,[e.name]:r.id})}catch(t){log.error(`Slack auth public message delivery failed`,{name:e.name,error:t})}}if(i&&a){let n=e.authorization?.userCode;try{await t.thread.postEphemeral(i,{blocks:buildAuthEphemeralBlocks({displayName:r,url:a,userCode:n}),text:n?`Sign in with ${r}: ${a} (code: ${n})`:`Sign in with ${r}: ${a}`})}catch(t){log.error(`Slack auth ephemeral delivery failed`,{name:e.name,error:t})}}},async"authorization.completed"(e,t,n){let r=e.authorization?.displayName??formatConnectionDisplayName(e.name);e.outcome===`authorized`&&e.candidateId===void 0&&await t.thread.startTyping(`Connected to ${r}. Resuming...`);let i=t.state.pendingAuthMessageTs??{},a=i[e.name];if(a===void 0)return;let o=buildAuthCompletedText({displayName:r,outcome:e.outcome,reason:e.reason});try{await t.slack.request(`chat.update`,{channel:t.slack.channelId,ts:a,text:o})}catch(t){log.error(`Slack auth status edit failed`,{name:e.name,error:t})}let s={...i};delete s[e.name],t.state.pendingAuthMessageTs=s}};export{defaultEvents,defaultInputRequestedHandler,defaultOnMessage,defaultReceived,defaultSlackAuth,postCompletedSlackReply};
@@ -11,7 +11,8 @@
11
11
  * picks whichever is set so the renderer can pick a widget kind on
12
12
  * UX grounds without changing the read path.
13
13
  */
14
- import { type InputRequest, type ValidatedInputResponse } from "#shared/input.js";
14
+ import type { BlockKitBlock } from "#public/channels/slack/blocks.js";
15
+ import { type InputRequest, type InputResponse, type ValidatedInputResponse } from "#shared/input.js";
15
16
  /**
16
17
  * Wire-format prefix every framework HITL widget mints onto its
17
18
  * `action_id`. Exposed so end-user adapters that render their own
@@ -40,6 +41,7 @@ export declare const HITL_FREEFORM_MODAL_BLOCK_ID = "eve_freeform_block";
40
41
  * `action_id` of the text input inside the freeform answer modal.
41
42
  */
42
43
  export declare const HITL_FREEFORM_MODAL_ACTION_ID = "eve_freeform_text";
44
+ /** Slack thread a routed HITL widget answers back to. */
43
45
  export interface SlackHitlRoute {
44
46
  readonly channelId: string;
45
47
  readonly threadTs: string;
@@ -48,7 +50,7 @@ export interface SlackHitlRoute {
48
50
  * Subset of one Slack interactivity action the HITL decoder reads.
49
51
  * Mirrors the relevant fields of `SlackInteractionAction`.
50
52
  */
51
- interface SlackHitlAction {
53
+ export interface SlackHitlAction {
52
54
  readonly actionId: string;
53
55
  /** `value` field on Slack `button` payloads. */
54
56
  readonly value?: string;
@@ -57,13 +59,17 @@ interface SlackHitlAction {
57
59
  }
58
60
  /**
59
61
  * Resolved HITL response derived from one Slack interactivity action.
60
- * Slack-local classification stays beside the typed eve input response so
62
+ * Slack-local classification stays beside the eve input response so
61
63
  * presentation metadata cannot cross the durable session-inbox boundary.
62
64
  */
63
- interface DerivedHitlResponse {
64
- kind?: "tool-approval";
65
- response: ValidatedInputResponse;
66
- route?: SlackHitlRoute;
65
+ export interface DerivedHitlResponse {
66
+ readonly kind?: "tool-approval";
67
+ readonly response: InputResponse;
68
+ readonly route?: SlackHitlRoute;
69
+ }
70
+ /** A derived response whose input response already passed schema validation. */
71
+ interface ValidatedHitlResponse extends DerivedHitlResponse {
72
+ readonly response: ValidatedInputResponse;
67
73
  }
68
74
  interface DecodedHitlActionId {
69
75
  button: boolean;
@@ -72,11 +78,13 @@ interface DecodedHitlActionId {
72
78
  route?: SlackHitlRoute;
73
79
  }
74
80
  /**
75
- * Decodes one Slack interactivity action into an HITL response, or
76
- * returns `null` when the action does not match an HITL widget the
77
- * framework rendered.
81
+ * Decodes one Slack interactivity action on a widget from
82
+ * {@link renderInputRequestBlocks} into an HITL response, or returns `null`
83
+ * when the action does not match an HITL widget eve rendered.
78
84
  */
79
- export declare function deriveHitlResponse(action: SlackHitlAction): DerivedHitlResponse | null;
85
+ export declare const deriveHitlResponse: (action: SlackHitlAction) => DerivedHitlResponse | null;
86
+ /** {@link deriveHitlResponse}, keeping the validated type `respond()` accepts. */
87
+ export declare function decodeHitlResponse(action: SlackHitlAction): ValidatedHitlResponse | null;
80
88
  /**
81
89
  * Returns `true` when the action id was minted by an HITL widget the
82
90
  * framework rendered. Used by the channel route to split inbound
@@ -86,7 +94,8 @@ export declare function isHitlAction(actionId: string): boolean;
86
94
  /** Decodes the framework-owned identity and optional return route from one action id. */
87
95
  export declare function decodeHitlActionId(actionId: string): DecodedHitlActionId | null;
88
96
  /**
89
- * Renders one `InputRequest` as Block Kit blocks:
97
+ * Renders one `InputRequest` as Block Kit blocks. Clicks on the rendered
98
+ * widgets decode with {@link deriveHitlResponse}:
90
99
  *
91
100
  * - `display === "select"` with ≤ {@link RADIO_SELECT_OPTION_LIMIT}
92
101
  * options → `radio_buttons`. Single-click answer, options stay
@@ -103,7 +112,7 @@ export declare function decodeHitlActionId(actionId: string): DecodedHitlActionI
103
112
  *
104
113
  * Always emits at least the prompt section.
105
114
  */
106
- export declare function renderInputRequestBlocks(request: InputRequest, route?: SlackHitlRoute): unknown[];
115
+ export declare function renderInputRequestBlocks(request: InputRequest, route?: SlackHitlRoute): BlockKitBlock[];
107
116
  export interface SlackInputRequestPostPart {
108
117
  readonly blocks: unknown[];
109
118
  readonly text: string;
@@ -1,4 +1,4 @@
1
- import{parseInputResponse}from"#shared/input.js";import{SLACK_SECTION_TEXT_MAX_LENGTH,truncateCardBodyText,truncateModalTitle,truncatePlainText,truncateSectionText}from"#public/channels/slack/limits.js";const HITL_ACTION_PREFIX=`eve_input:`,HITL_FREEFORM_ACTION_PREFIX=`eve_input_freeform:`,HITL_FREEFORM_MODAL_CALLBACK_ID=`eve_input_freeform_submit`,HITL_FREEFORM_MODAL_BLOCK_ID=`eve_freeform_block`,HITL_FREEFORM_MODAL_ACTION_ID=`eve_freeform_text`,HITL_ROUTE_PREFIX=`${HITL_ACTION_PREFIX}route:`,BUTTON_ACTION_ID_RE=/^(?:(?<kind>tool-approval):)?(?<requestId>.+):button:\d+$/u,TOOL_INPUT_SUFFIX="\n```";function deriveHitlResponse(e){if(!e.actionId.startsWith(`eve_input:`))return null;let t=decodeHitlActionId(e.actionId);if(t===null)return null;let n=e.selectedOptionValue??e.value;if(n===void 0||e.value!==void 0&&!t.button)return null;let r={response:parseInputResponse({optionId:n,requestId:t.requestId})};return t.kind!==void 0&&(r.kind=t.kind),t.route!==void 0&&(r.route=t.route),r}function splitEncodedRequest(e){return e.startsWith(`tool-approval:`)?{kind:`tool-approval`,requestId:e.slice(14)}:{requestId:e}}function isHitlAction(e){return e.startsWith(HITL_ACTION_PREFIX)}function decodeHitlActionId(e){if(!e.startsWith(`eve_input:`))return null;let t=e.slice(10),n;if(t.startsWith(`route:`)){t=t.slice(6);let e=t.indexOf(`:`),r=t.indexOf(`:`,e+1);if(e<=0||r<=e+1)return null;n={channelId:t.slice(0,e),threadTs:t.slice(e+1,r)},t=t.slice(r+1)}let r=BUTTON_ACTION_ID_RE.exec(t),i=splitEncodedRequest(r?.groups?.requestId??t);if(!i.requestId)return null;let a=r?.groups?.kind===`tool-approval`?`tool-approval`:i.kind,o={button:r!==null,requestId:i.requestId};return a!==void 0&&(o.kind=a),n!==void 0&&(o.route=n),o}function encodeHitlActionId(e,t){let n=`${e.kind===`tool-approval`?`tool-approval:`:``}${e.requestId}`;return t===void 0?`${HITL_ACTION_PREFIX}${n}`:`${HITL_ROUTE_PREFIX}${t.channelId}:${t.threadTs}:${n}`}function renderInputRequestBlocks(e,t){let n={text:{text:truncateSectionText(e.prompt),type:`mrkdwn`},type:`section`},r=renderInputRequestDetailBlocks(e),i=encodeHitlActionId(e,t),a=e.options,o=e.allowFreeform===!0||!a||a.length===0;if(a&&a.length>0&&e.display===`select`){let e=a.length<=6?{type:`radio_buttons`,action_id:i,options:a.map(buildOption)}:{type:`static_select`,action_id:i,options:a.map(buildOption),placeholder:{type:`plain_text`,text:`Choose an option`}};return[n,...r,{type:`actions`,elements:[e]}]}if(a&&a.length>0){let t=renderInputRequestCardBlock(e,i),n=renderToolInputContainerBlock(e);return n===void 0?[t]:[t,n]}if(o){let t=i.replace(HITL_ACTION_PREFIX,HITL_FREEFORM_ACTION_PREFIX);return[n,...r,{type:`actions`,elements:[{type:`button`,action_id:t,text:{type:`plain_text`,text:`Type your answer`},style:`primary`,value:e.requestId}]}]}return[n]}function renderInputRequestPostParts(e,t){let n=renderInputRequestBlocks(e,t),r=n[0];return!isApprovalRequest(e)||!isBlockType(r,`card`)||n.length===1?{controls:{blocks:n,text:formatInputRequestFallbackText(e)}}:{controls:{blocks:[r],text:e.prompt},details:{blocks:n.slice(1),text:formatInputRequestFallbackText(e)}}}function formatInputRequestFallbackText(e){let t=formatToolInputDetails(e);return t===void 0?e.prompt:`${e.prompt}\n${t}`}function buildFreeformModalView(e){let t=e.prompt?truncateModalTitle(e.prompt):`Your answer`,n=e.prompt?[{type:`section`,text:{type:`mrkdwn`,text:truncateSectionText(e.prompt)}}]:[];return{type:`modal`,callback_id:HITL_FREEFORM_MODAL_CALLBACK_ID,private_metadata:JSON.stringify(e.metadata),title:{type:`plain_text`,text:t},submit:{type:`plain_text`,text:`Submit`},close:{type:`plain_text`,text:`Cancel`},blocks:[...n,{type:`input`,block_id:HITL_FREEFORM_MODAL_BLOCK_ID,element:{type:`plain_text_input`,action_id:HITL_FREEFORM_MODAL_ACTION_ID,multiline:!0,placeholder:{type:`plain_text`,text:`Type your answer here...`}},label:{type:`plain_text`,text:`Answer`}}]}}function isFreeformAction(e){return e.startsWith(HITL_FREEFORM_ACTION_PREFIX)}function decodeFreeformHitlActionId(e){return isFreeformAction(e)?decodeHitlActionId(`${HITL_ACTION_PREFIX}${e.slice(19)}`):null}function buildCardButton(e,t,n){let r={type:`button`,text:{type:`plain_text`,text:truncatePlainText(e.label),emoji:!1},action_id:`${t}:button:${n}`,value:e.id};return(e.style===`primary`||e.style===`danger`)&&(r.style=e.style),r}function buildOption(e){let t={text:{text:truncatePlainText(e.label),type:`plain_text`},value:e.id},n=truncatePlainText(e.description);return n&&n.length>0&&(t.description={text:n,type:`plain_text`}),t}function renderInputRequestCardBlock(e,t){return{type:`card`,body:{type:`mrkdwn`,text:truncateCardBodyText(`*${e.prompt}*`),verbatim:!1},actions:cardButtonOptions(e).map((e,n)=>buildCardButton(e,t,n))}}function cardButtonOptions(e){let t=e.options??[];if(!isApprovalRequest(e))return t.map(toCardButtonOption);let n=t.find(e=>e.id===`approve`),r=t.find(e=>e.id===`cancel`);return!n||!r?t.map(toCardButtonOption):[{id:r.id,label:`Cancel`},{id:n.id,label:`Approve`,style:`primary`}]}function toCardButtonOption(e){let t={id:e.id,label:e.label};return e.style===`primary`||e.style===`danger`?{...t,style:e.style}:t}function buildAnsweredBlocks(e){let t=[];for(let n of e.promptBlocks)n!=null&&t.push(n);let n=truncateWithEllipsis(e.answerLabel,SLACK_SECTION_TEXT_MAX_LENGTH-20-1);return t.push({type:`section`,text:{type:`mrkdwn`,text:`:white_check_mark: *${n}*`}}),e.userId&&e.userId.length>0&&t.push({type:`context`,elements:[{type:`mrkdwn`,text:`Answered by <@${e.userId}>`}]}),t}function renderInputRequestDetailBlocks(e){let t=formatToolInputDetails(e);return t===void 0?[]:[{type:`section`,text:{type:`mrkdwn`,text:t}}]}function renderToolInputContainerBlock(e){let t=formatToolInputContainerText(e);if(t!==void 0)return{type:`container`,title:{type:`plain_text`,text:`Tool input`},is_collapsible:!0,default_collapsed:!1,child_blocks:[{type:`section`,text:{type:`mrkdwn`,text:t}}]}}function formatToolInputContainerText(e){if(!isApprovalRequest(e))return;let t=JSON.stringify(e.action.input,null,2);return t===`{}`?void 0:`\`\`\`
1
+ import{parseInputResponse}from"#shared/input.js";import{SLACK_SECTION_TEXT_MAX_LENGTH,truncateCardBodyText,truncateModalTitle,truncatePlainText,truncateSectionText}from"#public/channels/slack/limits.js";const HITL_ACTION_PREFIX=`eve_input:`,HITL_FREEFORM_ACTION_PREFIX=`eve_input_freeform:`,HITL_FREEFORM_MODAL_CALLBACK_ID=`eve_input_freeform_submit`,HITL_FREEFORM_MODAL_BLOCK_ID=`eve_freeform_block`,HITL_FREEFORM_MODAL_ACTION_ID=`eve_freeform_text`,HITL_ROUTE_PREFIX=`${HITL_ACTION_PREFIX}route:`,BUTTON_ACTION_ID_RE=/^(?:(?<kind>tool-approval):)?(?<requestId>.+):button:\d+$/u,TOOL_INPUT_SUFFIX="\n```",deriveHitlResponse=e=>decodeHitlResponse(e);function decodeHitlResponse(e){let t=decodeHitlActionId(e.actionId);if(t===null)return null;let n=e.selectedOptionValue??e.value;if(n===void 0||e.value!==void 0&&!t.button)return null;let r={response:parseInputResponse({optionId:n,requestId:t.requestId})};return t.kind!==void 0&&(r.kind=t.kind),t.route!==void 0&&(r.route=t.route),r}function splitEncodedRequest(e){return e.startsWith(`tool-approval:`)?{kind:`tool-approval`,requestId:e.slice(14)}:{requestId:e}}function isHitlAction(e){return e.startsWith(HITL_ACTION_PREFIX)}function decodeHitlActionId(e){if(!e.startsWith(`eve_input:`))return null;let t=e.slice(10),n;if(t.startsWith(`route:`)){t=t.slice(6);let e=t.indexOf(`:`),r=t.indexOf(`:`,e+1);if(e<=0||r<=e+1)return null;n={channelId:t.slice(0,e),threadTs:t.slice(e+1,r)},t=t.slice(r+1)}let r=BUTTON_ACTION_ID_RE.exec(t),i=splitEncodedRequest(r?.groups?.requestId??t);if(!i.requestId)return null;let a=r?.groups?.kind===`tool-approval`?`tool-approval`:i.kind,o={button:r!==null,requestId:i.requestId};return a!==void 0&&(o.kind=a),n!==void 0&&(o.route=n),o}function encodeHitlActionId(e,t){let n=`${e.kind===`tool-approval`?`tool-approval:`:``}${e.requestId}`;return t===void 0?`${HITL_ACTION_PREFIX}${n}`:`${HITL_ROUTE_PREFIX}${t.channelId}:${t.threadTs}:${n}`}function renderInputRequestBlocks(e,t){let n={text:{text:truncateSectionText(e.prompt),type:`mrkdwn`},type:`section`},r=renderInputRequestDetailBlocks(e),i=encodeHitlActionId(e,t),a=e.options,o=e.allowFreeform===!0||!a||a.length===0;if(a&&a.length>0&&e.display===`select`){let e=a.length<=6?{type:`radio_buttons`,action_id:i,options:a.map(buildOption)}:{type:`static_select`,action_id:i,options:a.map(buildOption),placeholder:{type:`plain_text`,text:`Choose an option`}};return[n,...r,{type:`actions`,elements:[e]}]}if(a&&a.length>0){let t=renderInputRequestCardBlock(e,i),n=renderToolInputContainerBlock(e);return n===void 0?[t]:[t,n]}if(o){let t=i.replace(HITL_ACTION_PREFIX,HITL_FREEFORM_ACTION_PREFIX);return[n,...r,{type:`actions`,elements:[{type:`button`,action_id:t,text:{type:`plain_text`,text:`Type your answer`},style:`primary`,value:e.requestId}]}]}return[n]}function renderInputRequestPostParts(e,t){let n=renderInputRequestBlocks(e,t),r=n[0];return!isApprovalRequest(e)||!isBlockType(r,`card`)||n.length===1?{controls:{blocks:n,text:formatInputRequestFallbackText(e)}}:{controls:{blocks:[r],text:e.prompt},details:{blocks:n.slice(1),text:formatInputRequestFallbackText(e)}}}function formatInputRequestFallbackText(e){let t=formatToolInputDetails(e);return t===void 0?e.prompt:`${e.prompt}\n${t}`}function buildFreeformModalView(e){let t=e.prompt?truncateModalTitle(e.prompt):`Your answer`,n=e.prompt?[{type:`section`,text:{type:`mrkdwn`,text:truncateSectionText(e.prompt)}}]:[];return{type:`modal`,callback_id:HITL_FREEFORM_MODAL_CALLBACK_ID,private_metadata:JSON.stringify(e.metadata),title:{type:`plain_text`,text:t},submit:{type:`plain_text`,text:`Submit`},close:{type:`plain_text`,text:`Cancel`},blocks:[...n,{type:`input`,block_id:HITL_FREEFORM_MODAL_BLOCK_ID,element:{type:`plain_text_input`,action_id:HITL_FREEFORM_MODAL_ACTION_ID,multiline:!0,placeholder:{type:`plain_text`,text:`Type your answer here...`}},label:{type:`plain_text`,text:`Answer`}}]}}function isFreeformAction(e){return e.startsWith(HITL_FREEFORM_ACTION_PREFIX)}function decodeFreeformHitlActionId(e){return isFreeformAction(e)?decodeHitlActionId(`${HITL_ACTION_PREFIX}${e.slice(19)}`):null}function buildCardButton(e,t,n){let r={type:`button`,text:{type:`plain_text`,text:truncatePlainText(e.label),emoji:!1},action_id:`${t}:button:${n}`,value:e.id};return(e.style===`primary`||e.style===`danger`)&&(r.style=e.style),r}function buildOption(e){let t={text:{text:truncatePlainText(e.label),type:`plain_text`},value:e.id},n=truncatePlainText(e.description);return n&&n.length>0&&(t.description={text:n,type:`plain_text`}),t}function renderInputRequestCardBlock(e,t){return{type:`card`,body:{type:`mrkdwn`,text:truncateCardBodyText(`*${e.prompt}*`),verbatim:!1},actions:cardButtonOptions(e).map((e,n)=>buildCardButton(e,t,n))}}function cardButtonOptions(e){let t=e.options??[];if(!isApprovalRequest(e))return t.map(toCardButtonOption);let n=t.find(e=>e.id===`approve`),r=t.find(e=>e.id===`cancel`);return!n||!r?t.map(toCardButtonOption):[{id:r.id,label:`Cancel`},{id:n.id,label:`Approve`,style:`primary`}]}function toCardButtonOption(e){let t={id:e.id,label:e.label};return e.style===`primary`||e.style===`danger`?{...t,style:e.style}:t}function buildAnsweredBlocks(e){let t=[];for(let n of e.promptBlocks)n!=null&&t.push(n);let n=truncateWithEllipsis(e.answerLabel,SLACK_SECTION_TEXT_MAX_LENGTH-20-1);return t.push({type:`section`,text:{type:`mrkdwn`,text:`:white_check_mark: *${n}*`}}),e.userId&&e.userId.length>0&&t.push({type:`context`,elements:[{type:`mrkdwn`,text:`Answered by <@${e.userId}>`}]}),t}function renderInputRequestDetailBlocks(e){let t=formatToolInputDetails(e);return t===void 0?[]:[{type:`section`,text:{type:`mrkdwn`,text:t}}]}function renderToolInputContainerBlock(e){let t=formatToolInputContainerText(e);if(t!==void 0)return{type:`container`,title:{type:`plain_text`,text:`Tool input`},is_collapsible:!0,default_collapsed:!1,child_blocks:[{type:`section`,text:{type:`mrkdwn`,text:t}}]}}function formatToolInputContainerText(e){if(!isApprovalRequest(e))return;let t=JSON.stringify(e.action.input,null,2);return t===`{}`?void 0:`\`\`\`
2
2
  ${truncateWithEllipsis(t,SLACK_SECTION_TEXT_MAX_LENGTH-4-4)}${TOOL_INPUT_SUFFIX}`}function formatToolInputDetails(e){if(!isApprovalRequest(e))return;let t=JSON.stringify(e.action.input,null,2);return t===`{}`?void 0:`*Tool input*
3
3
  \`\`\`
4
- ${truncateWithEllipsis(t,SLACK_SECTION_TEXT_MAX_LENGTH-17-4)}${TOOL_INPUT_SUFFIX}`}function truncateWithEllipsis(e,t){if(e.length<=t)return e;let n=Math.max(0,t-3);return`${e.slice(0,n).trimEnd()}...`}function isBlockType(e,t){return typeof e==`object`&&!!e&&e.type===t}function isApprovalRequest(e){return e.kind===`tool-approval`}export{HITL_ACTION_PREFIX,HITL_FREEFORM_ACTION_PREFIX,HITL_FREEFORM_MODAL_ACTION_ID,HITL_FREEFORM_MODAL_BLOCK_ID,HITL_FREEFORM_MODAL_CALLBACK_ID,buildAnsweredBlocks,buildFreeformModalView,decodeFreeformHitlActionId,decodeHitlActionId,deriveHitlResponse,formatInputRequestFallbackText,isFreeformAction,isHitlAction,renderInputRequestBlocks,renderInputRequestPostParts};
4
+ ${truncateWithEllipsis(t,SLACK_SECTION_TEXT_MAX_LENGTH-17-4)}${TOOL_INPUT_SUFFIX}`}function truncateWithEllipsis(e,t){if(e.length<=t)return e;let n=Math.max(0,t-3);return`${e.slice(0,n).trimEnd()}...`}function isBlockType(e,t){return typeof e==`object`&&!!e&&e.type===t}function isApprovalRequest(e){return e.kind===`tool-approval`}export{HITL_ACTION_PREFIX,HITL_FREEFORM_ACTION_PREFIX,HITL_FREEFORM_MODAL_ACTION_ID,HITL_FREEFORM_MODAL_BLOCK_ID,HITL_FREEFORM_MODAL_CALLBACK_ID,buildAnsweredBlocks,buildFreeformModalView,decodeFreeformHitlActionId,decodeHitlActionId,decodeHitlResponse,deriveHitlResponse,formatInputRequestFallbackText,isFreeformAction,isHitlAction,renderInputRequestBlocks,renderInputRequestPostParts};
@@ -5,15 +5,16 @@
5
5
  * without taking a direct `ai` dependency.
6
6
  */
7
7
  export type { ModelMessage } from "ai";
8
- export { slackChannel, type SlackApiResponse, type SlackAuthorizationEventContext, type SlackAuthorizationRequiredHandler, type SlackBotToken, type SlackChannel, type SlackChannelConfig, type SlackChannelCredentials, type SlackChannelEvents, type SlackChannelState, type SlackContext, type SlackEventContext, type SlackEventRespondFn, type SlackEventRespondOptions, type SlackEventSendFn, type SlackEventSendOptions, type SlackHandle, type SlackInboundEventContext, type SlackInboundMessageContext, type SlackInboundResult, type SlackInboundResultOrPromise, type SlackInitialMessage, type SlackInputRequestedDefaultDeliver, type SlackInputRequestedEvent, type SlackInputRequestedHandler, type SlackInputResponseContext, type SlackInputResponseResult, type SlackInputResponseSubmission, type SlackInstrumentationMetadata, type SlackInteractionAction, type SlackInteractionContext, type SlackSlashCommand, type SlackSlashCommandContext, type SlackShortcut, type SlackShortcutContext, type SlackShortcutMessage, type SlackMentionResult, type SlackMentionResultOrPromise, type SlackReceiveTarget, type SlackSessionTarget, type SlackRespondOptions, type SlackSendOptions, type SlackSessionOperations, type SlackThread, type SlackWebhookVerifier, type SlackWorkspaceHandle, } from "#public/channels/slack/slackChannel.js";
8
+ export { slackChannel, type SlackApiResponse, type SlackAuthorizationEventContext, type SlackBotToken, type SlackChannel, type SlackChannelConfig, type SlackChannelCredentials, type SlackChannelState, type SlackContext, type SlackEventContext, type SlackEventRespondFn, type SlackEventRespondOptions, type SlackEventSendFn, type SlackEventSendOptions, type SlackHandle, type SlackInboundEventContext, type SlackInboundMessageContext, type SlackInboundResult, type SlackInboundResultOrPromise, type SlackInitialMessage, type SlackInputResponseContext, type SlackInputResponseResult, type SlackInputResponseSubmission, type SlackInstrumentationMetadata, type SlackInteractionAction, type SlackInteractionContext, type SlackSlashCommand, type SlackSlashCommandContext, type SlackShortcut, type SlackShortcutContext, type SlackShortcutMessage, type SlackMentionResult, type SlackMentionResultOrPromise, type SlackReceiveTarget, type SlackSessionTarget, type SlackRespondOptions, type SlackSendOptions, type SlackSessionOperations, type SlackThread, type SlackWebhookVerifier, type SlackWorkspaceHandle, } from "#public/channels/slack/slackChannel.js";
9
9
  export type { SlackAttachment, SlackAuthor, SlackEvent, SlackEventEnvelope, SlackInboundContext, SlackMessage, } from "#public/channels/slack/inbound.js";
10
10
  export { callSlackApi, resolveSlackBotToken, slackContinuationToken, type SlackPostInput, type SlackPostedMessage, type SlackBotTokenContext, type SlackThreadMessage, type SlackUploadFilesOptions, type SlackUploadFilesResult, } from "#public/channels/slack/api.js";
11
11
  export { type SlackFetch, type SlackTransportOptions } from "#public/channels/slack/transport.js";
12
12
  export { defaultSlackAuth } from "#public/channels/slack/defaults.js";
13
- export { experimental_slackActivityPlan, experimental_slackActivityRenderer, experimental_slackActivityTree, experimental_slackActivityStatus, type ExperimentalSlackActivityDestination, type ExperimentalSlackActivityRenderer, type ExperimentalSlackActivitySnapshot, type SlackActivityRenderer, } from "#public/channels/slack/activity.js";
14
- export { describeActionRequest, describeActionRequests, } from "#public/channels/slack/action-status.js";
13
+ export { defineSlackRenderer, type SlackRenderer, type SlackRendererEvents, type SlackRenderHandler, type SlackRenderNext, type SlackTaskCard, } from "#public/channels/slack/renderers.js";
14
+ export type { TaskCardAction, TaskCardBlocker, TaskCardStatus, TaskCardTask, TaskCardView, } from "#channel/task-card.js";
15
15
  export { loadThreadContextMessages, type LoadThreadContextMessagesOptions, type ThreadContextSince, } from "#public/channels/slack/thread.js";
16
16
  export { cardToBlocks, cardToFallbackText, type BlockKitBlock, } from "#public/channels/slack/blocks.js";
17
+ export { deriveHitlResponse, HITL_ACTION_PREFIX, renderInputRequestBlocks, type DerivedHitlResponse, type SlackHitlAction, type SlackHitlRoute, } from "#public/channels/slack/hitl.js";
17
18
  /**
18
19
  * Card builders and element types re-exported from the vendored chat
19
20
  * SDK module. These are pure data factories. They return plain typed