eve 0.75.0 → 0.76.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 (658) hide show
  1. package/CHANGELOG.md +54 -0
  2. package/dist/src/_virtual/_rolldown/runtime.js +1 -1
  3. package/dist/src/acp/adapter.js +1 -1
  4. package/dist/src/channel/task-card.js +1 -1
  5. package/dist/src/channel/tool-eligibility.d.ts +1 -2
  6. package/dist/src/chunks/{use-eve-agent-B2Kne9z6.js → use-eve-agent-D2V9UhLt.js} +68 -10
  7. package/dist/src/chunks/{use-eve-agent-DK_T88EP.js → use-eve-agent-QmriPA-w.js} +68 -10
  8. package/dist/src/cli/commands/deploy.js +1 -1
  9. package/dist/src/cli/commands/link.d.ts +2 -1
  10. package/dist/src/cli/commands/link.js +1 -1
  11. package/dist/src/cli/commands/registry.js +1 -1
  12. package/dist/src/cli/commands/vercel-non-interactive.d.ts +6 -4
  13. package/dist/src/cli/commands/vercel-non-interactive.js +1 -1
  14. package/dist/src/cli/dev/environment.d.ts +0 -6
  15. package/dist/src/cli/dev/environment.js +1 -1
  16. package/dist/src/cli/dev/tui/conversation-view.js +1 -1
  17. package/dist/src/cli/dev/tui/runner.js +1 -1
  18. package/dist/src/cli/dev/tui/tool-presentation.js +1 -1
  19. package/dist/src/cli/dev/tui/transcript.js +1 -1
  20. package/dist/src/client/message-action-parts.d.ts +3 -0
  21. package/dist/src/client/message-action-parts.js +1 -1
  22. package/dist/src/client/message-reducer-types.d.ts +6 -1
  23. package/dist/src/client/message-reducer.js +1 -1
  24. package/dist/src/compiled/.vendor-stamp.json +9 -8
  25. package/dist/src/compiled/@eve/catalog/index.js +1 -1
  26. package/dist/src/compiled/@vercel/queue/index.d.ts +1066 -0
  27. package/dist/src/compiled/@vercel/queue/index.js +47 -0
  28. package/dist/src/compiled/@workflow/core/global.d.ts +10 -0
  29. package/dist/src/compiled/@workflow/core/index.js +1 -1
  30. package/dist/src/compiled/@workflow/core/private.d.ts +11 -0
  31. package/dist/src/compiled/@workflow/core/private.js +1 -1
  32. package/dist/src/compiled/@workflow/core/runtime/constants.d.ts +36 -8
  33. package/dist/src/compiled/@workflow/core/runtime/helpers.js +1 -1
  34. package/dist/src/compiled/@workflow/core/runtime/lifecycle-hooks.d.ts +10 -6
  35. package/dist/src/compiled/@workflow/core/runtime/out-of-band-observation.d.ts +159 -0
  36. package/dist/src/compiled/@workflow/core/runtime/vm-mode.d.ts +28 -4
  37. package/dist/src/compiled/@workflow/core/runtime.js +4 -4
  38. package/dist/src/compiled/@workflow/core/serialization.js +1 -1
  39. package/dist/src/compiled/@workflow/core/version.d.ts +1 -1
  40. package/dist/src/compiled/@workflow/core/workflow.js +1 -1
  41. package/dist/src/compiled/@workflow/world-local/index.js +5 -5
  42. package/dist/src/compiled/@workflow/world-vercel/index.js +4 -4
  43. package/dist/src/compiled/_chunks/workflow/{attribute-changes-CSqvJx6j.js → attribute-changes-BW-kbMMn.js} +1 -1
  44. package/dist/src/compiled/_chunks/workflow/dist-CyBgVS7g.js +1 -0
  45. package/dist/src/compiled/_chunks/workflow/{helpers-BXCuoPUb.js → helpers-DlLD3ov_.js} +1 -1
  46. package/dist/src/compiled/_chunks/workflow/private-tQUuwBoQ.js +1 -0
  47. package/dist/src/compiled/_chunks/workflow/{resume-hook-CvENCrxc.js → resume-hook-DMsV_b4n.js} +1 -1
  48. package/dist/src/compiled/_chunks/workflow/{run-8pLWuR2U.js → run-DzdAqdb1.js} +1 -1
  49. package/dist/src/compiled/_chunks/workflow/{serialization-vDozzDhh.js → serialization-DPdYS_w2.js} +2 -2
  50. package/dist/src/compiled/_chunks/workflow/sleep-BY6leHh8.js +1 -0
  51. package/dist/src/compiled/_chunks/workflow/{token-BKeK6DmC.js → token-D5ugC3PI.js} +1 -1
  52. package/dist/src/compiled/_chunks/workflow/{token-util-CddTZ_ef.js → token-util-Bla5Z0G9.js} +1 -1
  53. package/dist/src/compiled/_chunks/workflow/undici-D-ILjOKD.js +95 -0
  54. package/dist/src/compiled/_chunks/workflow/{wait-until-A344L2AG.js → wait-until-xbRRDuUf.js} +1 -1
  55. package/dist/src/compiler/connection-ownership.d.ts +6 -0
  56. package/dist/src/compiler/connection-ownership.js +1 -0
  57. package/dist/src/compiler/default-tool-policy.d.ts +0 -3
  58. package/dist/src/compiler/default-tool-policy.js +1 -1
  59. package/dist/src/compiler/extension-compatibility.d.ts +21 -20
  60. package/dist/src/compiler/extension-compatibility.js +1 -1
  61. package/dist/src/compiler/manifest.d.ts +9 -6
  62. package/dist/src/compiler/manifest.js +1 -1
  63. package/dist/src/compiler/normalize-connection.js +1 -1
  64. package/dist/src/compiler/normalize-manifest.js +1 -1
  65. package/dist/src/compiler/normalize-skill.d.ts +5 -0
  66. package/dist/src/compiler/normalize-skill.js +1 -1
  67. package/dist/src/compiler/normalize-subagent.d.ts +2 -1
  68. package/dist/src/compiler/normalize-subagent.js +1 -1
  69. package/dist/src/compiler/normalize-tool.js +1 -1
  70. package/dist/src/compiler/remote-agent-node.d.ts +2 -1
  71. package/dist/src/compiler/remote-agent-node.js +1 -1
  72. package/dist/src/connections/ownership.d.ts +18 -0
  73. package/dist/src/connections/ownership.js +1 -0
  74. package/dist/src/context/build-dynamic-tools.d.ts +3 -9
  75. package/dist/src/context/build-dynamic-tools.js +1 -1
  76. package/dist/src/context/dynamic-connection-lifecycle.js +1 -1
  77. package/dist/src/context/dynamic-skill-lifecycle.d.ts +2 -11
  78. package/dist/src/context/dynamic-skill-lifecycle.js +1 -1
  79. package/dist/src/context/dynamic-subagent-lifecycle.js +1 -1
  80. package/dist/src/context/dynamic-tool-lifecycle.js +1 -1
  81. package/dist/src/context/dynamic-tool-metadata.d.ts +1 -0
  82. package/dist/src/context/keys.d.ts +5 -4
  83. package/dist/src/context/memory-tools.js +1 -1
  84. package/dist/src/context/schedule-collection-tools.js +1 -1
  85. package/dist/src/discover/grammar.d.ts +11 -0
  86. package/dist/src/discover/grammar.js +1 -1
  87. package/dist/src/discover/manifest.d.ts +1 -0
  88. package/dist/src/discover/manifest.js +1 -1
  89. package/dist/src/discover/skills.d.ts +1 -0
  90. package/dist/src/discover/skills.js +1 -1
  91. package/dist/src/dynamic/definition.d.ts +7 -5
  92. package/dist/src/evals/assertions/collector.d.ts +4 -0
  93. package/dist/src/evals/assertions/collector.js +1 -1
  94. package/dist/src/evals/assertions/run.d.ts +2 -3
  95. package/dist/src/evals/assertions/run.js +2 -2
  96. package/dist/src/evals/assertions/scoped.js +1 -1
  97. package/dist/src/evals/index.d.ts +1 -1
  98. package/dist/src/evals/match.d.ts +9 -6
  99. package/dist/src/evals/reported-tool-name.d.ts +9 -0
  100. package/dist/src/evals/reported-tool-name.js +1 -0
  101. package/dist/src/evals/runner/derive-run-facts.d.ts +3 -3
  102. package/dist/src/evals/runner/derive-run-facts.js +1 -1
  103. package/dist/src/evals/runner/execute-task.js +1 -1
  104. package/dist/src/evals/runner/reporters/braintrust.js +1 -1
  105. package/dist/src/evals/runner/reporters/datadog-runtime-trace-links.d.ts +11 -0
  106. package/dist/src/evals/runner/reporters/datadog-runtime-trace-links.js +1 -0
  107. package/dist/src/evals/runner/reporters/datadog.js +2 -2
  108. package/dist/src/evals/session.js +2 -2
  109. package/dist/src/evals/target.d.ts +7 -0
  110. package/dist/src/evals/target.js +1 -1
  111. package/dist/src/evals/types.d.ts +17 -1
  112. package/dist/src/eve-channel/request.js +1 -1
  113. package/dist/src/execution/agent-sessions/remote.js +1 -1
  114. package/dist/src/execution/catalog/connection-auth.d.ts +41 -0
  115. package/dist/src/execution/catalog/connection-auth.js +1 -0
  116. package/dist/src/execution/catalog/connection-entry.d.ts +16 -0
  117. package/dist/src/execution/catalog/connection-entry.js +1 -0
  118. package/dist/src/execution/catalog/listing.d.ts +9 -0
  119. package/dist/src/execution/catalog/listing.js +3 -0
  120. package/dist/src/execution/catalog/rank.d.ts +44 -0
  121. package/dist/src/execution/catalog/rank.js +1 -0
  122. package/dist/src/execution/catalog/search.d.ts +28 -0
  123. package/dist/src/execution/catalog/search.js +1 -0
  124. package/dist/src/execution/catalog/signatures.d.ts +11 -0
  125. package/dist/src/execution/catalog/signatures.js +1 -0
  126. package/dist/src/execution/catalog/skills.d.ts +24 -0
  127. package/dist/src/execution/catalog/skills.js +1 -0
  128. package/dist/src/execution/catalog/step-catalog.d.ts +51 -0
  129. package/dist/src/execution/catalog/step-catalog.js +1 -0
  130. package/dist/src/execution/coordination-dispatch-shared.js +1 -1
  131. package/dist/src/execution/dynamic-connections.js +1 -1
  132. package/dist/src/execution/dynamic-workflow/tool.js +1 -1
  133. package/dist/src/execution/invoke-tool.js +1 -1
  134. package/dist/src/execution/ndjson-stream.d.ts +6 -6
  135. package/dist/src/execution/ndjson-stream.js +3 -3
  136. package/dist/src/execution/node-step.js +1 -1
  137. package/dist/src/execution/session/active-turn.d.ts +1 -1
  138. package/dist/src/execution/session/pending-turn-state.js +1 -1
  139. package/dist/src/execution/session/turn-step.js +1 -1
  140. package/dist/src/execution/session/turn.d.ts +5 -5
  141. package/dist/src/execution/session/turn.js +1 -1
  142. package/dist/src/execution/session.js +1 -1
  143. package/dist/src/execution/skills/instructions.d.ts +20 -10
  144. package/dist/src/execution/skills/instructions.js +2 -2
  145. package/dist/src/execution/tasks/calls.d.ts +6 -5
  146. package/dist/src/execution/tasks/calls.js +1 -1
  147. package/dist/src/execution/tasks/model-step.d.ts +10 -10
  148. package/dist/src/execution/tasks/model-step.js +1 -1
  149. package/dist/src/execution/tasks/render.d.ts +3 -3
  150. package/dist/src/execution/tasks/render.js +3 -3
  151. package/dist/src/execution/tasks/session.d.ts +2 -1
  152. package/dist/src/execution/tasks/table.d.ts +1 -1
  153. package/dist/src/execution/tasks/tool-entry-point.d.ts +1 -1
  154. package/dist/src/execution/tool-auth.js +1 -1
  155. package/dist/src/execution/tools/agent-router-workflow.js +1 -1
  156. package/dist/src/execution/tools/workflow/harness-definition.js +1 -1
  157. package/dist/src/extensions/code/extension/extension.d.ts +4 -18
  158. package/dist/src/extensions/code/extension/instructions/github.d.ts +3 -0
  159. package/dist/src/extensions/code/extension/instructions/github.js +1 -0
  160. package/dist/src/extensions/code/extension/instructions.md +1 -13
  161. package/dist/src/extensions/code/extension/lib/diagnostics.d.ts +4 -2
  162. package/dist/src/extensions/code/extension/lib/diagnostics.js +3 -3
  163. package/dist/src/extensions/code/extension/lib/github-compat.d.ts +28 -0
  164. package/dist/src/extensions/code/extension/lib/github-compat.js +1 -0
  165. package/dist/src/extensions/code/extension/lib/grep-search.d.ts +3 -13
  166. package/dist/src/extensions/code/extension/lib/grep-search.js +2 -2
  167. package/dist/src/extensions/code/extension/lib/patch.d.ts +8 -2
  168. package/dist/src/extensions/code/extension/lib/patch.js +4 -4
  169. package/dist/src/extensions/code/extension/lib/repository-root.d.ts +3 -4
  170. package/dist/src/extensions/code/extension/lib/repository-root.js +1 -1
  171. package/dist/src/extensions/code/extension/lib/sandbox.d.ts +2 -1
  172. package/dist/src/extensions/code/extension/lib/sandbox.js +1 -1
  173. package/dist/src/extensions/code/extension/lib/tooling.d.ts +4 -4
  174. package/dist/src/extensions/code/extension/lib/tooling.js +7 -7
  175. package/dist/src/extensions/code/extension/lib/workspace-root.d.ts +31 -0
  176. package/dist/src/extensions/code/extension/lib/workspace-root.js +1 -0
  177. package/dist/src/extensions/code/extension/skills/pr.d.ts +6 -0
  178. package/dist/src/extensions/code/extension/skills/pr.js +1 -0
  179. package/dist/src/extensions/code/extension/tools/apply_patch.d.ts +2 -2
  180. package/dist/src/extensions/code/extension/tools/apply_patch.js +2 -2
  181. package/dist/src/extensions/code/extension/tools/gh.d.ts +4 -3
  182. package/dist/src/extensions/code/extension/tools/gh.js +1 -1
  183. package/dist/src/extensions/code/extension/tools/grep.js +1 -1
  184. package/dist/src/extensions/code/tools.d.ts +2 -1
  185. package/dist/src/extensions/code/tools.js +1 -1
  186. package/dist/src/extensions/git/extension/extension.d.ts +12 -0
  187. package/dist/src/extensions/git/extension/extension.js +1 -0
  188. package/dist/src/extensions/git/extension/instructions/github.d.ts +2 -0
  189. package/dist/src/extensions/git/extension/instructions/github.js +1 -0
  190. package/dist/src/extensions/git/extension/lib/gh-tool.d.ts +29 -0
  191. package/dist/src/extensions/git/extension/lib/gh-tool.js +1 -0
  192. package/dist/src/extensions/git/extension/lib/github-guidance.d.ts +3 -0
  193. package/dist/src/extensions/git/extension/lib/github-guidance.js +49 -0
  194. package/dist/src/extensions/{code → git}/extension/lib/github-shell.d.ts +1 -1
  195. package/dist/src/extensions/git/extension/lib/github-shell.js +1 -0
  196. package/dist/src/extensions/git/extension/lib/repository-root.d.ts +5 -0
  197. package/dist/src/extensions/git/extension/lib/repository-root.js +1 -0
  198. package/dist/src/extensions/git/extension/lib/sandbox.d.ts +6 -0
  199. package/dist/src/extensions/git/extension/lib/sandbox.js +1 -0
  200. package/dist/src/extensions/git/extension/lib/shell.d.ts +1 -0
  201. package/dist/src/extensions/git/extension/lib/shell.js +1 -0
  202. package/dist/src/extensions/git/extension/lib/tooling.d.ts +4 -0
  203. package/dist/src/extensions/git/extension/lib/tooling.js +1 -0
  204. package/dist/src/extensions/git/extension/skills/pr.d.ts +5 -0
  205. package/dist/src/extensions/git/extension/skills/pr.js +1 -0
  206. package/dist/src/extensions/git/extension/tools/gh.d.ts +28 -0
  207. package/dist/src/extensions/git/extension/tools/gh.js +1 -0
  208. package/dist/src/extensions/git/tools.d.ts +27 -0
  209. package/dist/src/extensions/git/tools.js +1 -0
  210. package/dist/src/framework/sources/registry.js +1 -1
  211. package/dist/src/harness/action-presentation.d.ts +2 -2
  212. package/dist/src/harness/action-result-helpers.d.ts +10 -2
  213. package/dist/src/harness/action-result-helpers.js +1 -1
  214. package/dist/src/harness/announcements.d.ts +2 -8
  215. package/dist/src/harness/announcements.js +1 -1
  216. package/dist/src/harness/compaction/engine.d.ts +8 -19
  217. package/dist/src/harness/compaction/engine.js +1 -1
  218. package/dist/src/harness/compaction/step.d.ts +7 -1
  219. package/dist/src/harness/compaction/step.js +1 -1
  220. package/dist/src/harness/coordination.d.ts +11 -11
  221. package/dist/src/harness/coordination.js +1 -1
  222. package/dist/src/harness/current-messages.d.ts +1 -5
  223. package/dist/src/harness/current-messages.js +1 -1
  224. package/dist/src/harness/emission.d.ts +2 -2
  225. package/dist/src/harness/emission.js +1 -1
  226. package/dist/src/harness/execute-call.d.ts +48 -0
  227. package/dist/src/harness/execute-call.js +1 -0
  228. package/dist/src/harness/execute-tool.d.ts +3 -1
  229. package/dist/src/harness/final-output.d.ts +2 -6
  230. package/dist/src/harness/final-output.js +1 -1
  231. package/dist/src/harness/hitl/approvals.d.ts +5 -0
  232. package/dist/src/harness/hitl/approvals.js +1 -1
  233. package/dist/src/harness/hitl/approved-calls.d.ts +3 -2
  234. package/dist/src/harness/hitl/approved-calls.js +1 -1
  235. package/dist/src/harness/hitl/candidates.d.ts +13 -2
  236. package/dist/src/harness/hitl/candidates.js +1 -1
  237. package/dist/src/harness/hitl/coordinator.d.ts +3 -3
  238. package/dist/src/harness/hitl/coordinator.js +1 -1
  239. package/dist/src/harness/hitl/index.d.ts +6 -4
  240. package/dist/src/harness/hitl/index.js +1 -1
  241. package/dist/src/harness/hitl/intake.d.ts +3 -3
  242. package/dist/src/harness/hitl/intake.js +1 -1
  243. package/dist/src/harness/input-extraction.d.ts +4 -1
  244. package/dist/src/harness/input-extraction.js +1 -1
  245. package/dist/src/harness/input-request-resolution.d.ts +15 -0
  246. package/dist/src/harness/input-request-resolution.js +1 -1
  247. package/dist/src/harness/model-call/call.d.ts +5 -8
  248. package/dist/src/harness/model-call/call.js +1 -1
  249. package/dist/src/harness/model-call/errors.js +1 -1
  250. package/dist/src/harness/model-call/model.d.ts +4 -5
  251. package/dist/src/harness/model-call/model.js +1 -1
  252. package/dist/src/harness/model-call/request.d.ts +4 -4
  253. package/dist/src/harness/model-call/request.js +1 -1
  254. package/dist/src/harness/model-call/response.d.ts +2 -1
  255. package/dist/src/harness/model-call/response.js +1 -1
  256. package/dist/src/harness/model-call/retry.d.ts +1 -1
  257. package/dist/src/harness/model-call/retry.js +1 -1
  258. package/dist/src/harness/model-call/run.d.ts +5 -3
  259. package/dist/src/harness/model-call/run.js +1 -1
  260. package/dist/src/harness/model-call/tools.d.ts +14 -24
  261. package/dist/src/harness/model-call/tools.js +1 -1
  262. package/dist/src/harness/model-call/usage.js +1 -1
  263. package/dist/src/harness/model-profile.d.ts +28 -0
  264. package/dist/src/harness/model-profile.js +1 -0
  265. package/dist/src/harness/prompt-cache.d.ts +5 -53
  266. package/dist/src/harness/prompt-cache.js +1 -1
  267. package/dist/src/harness/provider-safety.d.ts +3 -5
  268. package/dist/src/harness/provider-safety.js +1 -1
  269. package/dist/src/harness/provider-tools.d.ts +7 -14
  270. package/dist/src/harness/provider-tools.js +1 -1
  271. package/dist/src/harness/session-machine/commit.js +1 -1
  272. package/dist/src/harness/session-machine/transitions.d.ts +5 -2
  273. package/dist/src/harness/session-machine/transitions.js +1 -1
  274. package/dist/src/harness/step/after-model.js +1 -1
  275. package/dist/src/harness/step-hooks.d.ts +6 -9
  276. package/dist/src/harness/step-hooks.js +1 -1
  277. package/dist/src/harness/tool-call-input-errors.d.ts +2 -2
  278. package/dist/src/harness/tool-call-io.d.ts +3 -0
  279. package/dist/src/harness/tool-call-io.js +1 -1
  280. package/dist/src/harness/tools.d.ts +24 -22
  281. package/dist/src/harness/tools.js +1 -1
  282. package/dist/src/harness/turn-tag-state.d.ts +12 -0
  283. package/dist/src/harness/turn-tag-state.js +1 -1
  284. package/dist/src/harness/types.d.ts +14 -0
  285. package/dist/src/instrumentation/lifecycle.d.ts +0 -1
  286. package/dist/src/instrumentation/native-events.js +1 -1
  287. package/dist/src/instrumentation/runtime.d.ts +2 -1
  288. package/dist/src/internal/application/package.js +1 -1
  289. package/dist/src/internal/authored-definition/core.js +1 -1
  290. package/dist/src/internal/authored-definition/schedule-collection.js +1 -1
  291. package/dist/src/internal/authored-definition/schema-backed.d.ts +2 -2
  292. package/dist/src/internal/authored-definition/schema-backed.js +1 -1
  293. package/dist/src/internal/authored-module.d.ts +2 -1
  294. package/dist/src/internal/authored-module.js +1 -1
  295. package/dist/src/internal/gateway.d.ts +0 -13
  296. package/dist/src/internal/gateway.js +1 -1
  297. package/dist/src/internal/helpers/markdown.js +1 -1
  298. package/dist/src/internal/mcp/skills.js +1 -1
  299. package/dist/src/internal/nitro/host/create-application-nitro.js +1 -1
  300. package/dist/src/internal/nitro/host/dev-host-fingerprint.js +1 -1
  301. package/dist/src/internal/nitro/host/local-schedules-runtime-plugin.d.ts +5 -0
  302. package/dist/src/internal/nitro/host/local-schedules-runtime-plugin.js +1 -0
  303. package/dist/src/internal/nitro/routes/schedule-collection-consumer.d.ts +6 -0
  304. package/dist/src/internal/nitro/routes/schedule-collection-consumer.js +1 -1
  305. package/dist/src/internal/schedules/consumer-route.d.ts +2 -0
  306. package/dist/src/internal/schedules/consumer-route.js +1 -1
  307. package/dist/src/internal/schedules/dev-environment.d.ts +2 -0
  308. package/dist/src/internal/schedules/dev-environment.js +1 -0
  309. package/dist/src/internal/vercel-agent-summary.d.ts +2 -2
  310. package/dist/src/internal/workflow/vercel-world-defaults.d.ts +1 -1
  311. package/dist/src/internal/workflow/vercel-world-defaults.js +1 -1
  312. package/dist/src/protocol/catalog-tools.d.ts +12 -0
  313. package/dist/src/protocol/catalog-tools.js +1 -0
  314. package/dist/src/protocol/message-version.js +1 -1
  315. package/dist/src/protocol/message.d.ts +1 -1
  316. package/dist/src/protocol/remote-agent-protocol.d.ts +2 -0
  317. package/dist/src/protocol/remote-agent-protocol.js +1 -1
  318. package/dist/src/protocol/reply-tool.d.ts +2 -0
  319. package/dist/src/protocol/reply-tool.js +1 -0
  320. package/dist/src/protocol/runtime-tools.d.ts +6 -0
  321. package/dist/src/protocol/runtime-tools.js +1 -0
  322. package/dist/src/protocol/session-projection.js +1 -1
  323. package/dist/src/protocol/task-tools.d.ts +4 -4
  324. package/dist/src/protocol/task-tools.js +1 -1
  325. package/dist/src/public/channels/chat-sdk/chatSdkChannel.js +1 -1
  326. package/dist/src/public/channels/linear/defaults.js +2 -2
  327. package/dist/src/public/channels/slack/action-status.d.ts +0 -9
  328. package/dist/src/public/channels/slack/action-status.js +1 -1
  329. package/dist/src/public/channels/slack/defaults.js +2 -2
  330. package/dist/src/public/channels/slack/task-card.d.ts +1 -1
  331. package/dist/src/public/definitions/connections/mcp.d.ts +4 -4
  332. package/dist/src/public/definitions/connections/openapi.d.ts +6 -7
  333. package/dist/src/public/definitions/remote-agent.d.ts +6 -3
  334. package/dist/src/public/definitions/workspace-agent.d.ts +6 -3
  335. package/dist/src/public/experimental/schedules/index.d.ts +1 -1
  336. package/dist/src/public/schedules/providers/in-memory.js +1 -1
  337. package/dist/src/public/schedules/providers/vercel.js +1 -1
  338. package/dist/src/public/schedules/subscription.d.ts +36 -16
  339. package/dist/src/public/tools/web-search.d.ts +1 -1
  340. package/dist/src/runtime/agent/bootstrap.d.ts +2 -1
  341. package/dist/src/runtime/agent/bootstrap.js +1 -1
  342. package/dist/src/runtime/agent/mock-model-adapter.js +2 -2
  343. package/dist/src/runtime/agent/mock-model-fixtures.js +2 -2
  344. package/dist/src/runtime/agent/mock-model-skill-selection.d.ts +2 -0
  345. package/dist/src/runtime/agent/mock-model-skill-selection.js +2 -2
  346. package/dist/src/runtime/agent/mock-structured-output.d.ts +1 -1
  347. package/dist/src/runtime/connections/mcp-client.js +1 -1
  348. package/dist/src/runtime/connections/registry.js +1 -1
  349. package/dist/src/runtime/connections/scoped-authorization.js +1 -1
  350. package/dist/src/runtime/connections/tool-result.d.ts +2 -2
  351. package/dist/src/runtime/resolve-agent-graph.js +1 -1
  352. package/dist/src/runtime/resolve-tool.js +1 -1
  353. package/dist/src/runtime/schedules/collection-client.d.ts +12 -3
  354. package/dist/src/runtime/schedules/collection-client.js +1 -1
  355. package/dist/src/runtime/subagents/dynamic-agent-config.d.ts +2 -2
  356. package/dist/src/runtime/subagents/dynamic-remote-agent-config.d.ts +2 -1
  357. package/dist/src/runtime/subagents/dynamic-remote-agent-config.js +1 -1
  358. package/dist/src/runtime/subagents/registry.d.ts +2 -1
  359. package/dist/src/runtime/subagents/registry.js +1 -1
  360. package/dist/src/runtime/tools/registry.d.ts +2 -0
  361. package/dist/src/runtime/tools/registry.js +1 -1
  362. package/dist/src/runtime/types.d.ts +3 -3
  363. package/dist/src/setup/connection-connector.js +1 -2
  364. package/dist/src/setup/index.d.ts +1 -1
  365. package/dist/src/setup/index.js +1 -1
  366. package/dist/src/setup/integrations/slack/setup.d.ts +23 -3
  367. package/dist/src/setup/integrations/slack/setup.js +1 -1
  368. package/dist/src/setup/primitives/process-output.d.ts +5 -0
  369. package/dist/src/setup/primitives/process-output.js +2 -1
  370. package/dist/src/setup/scaffold/create/project.js +1 -1
  371. package/dist/src/setup/scaffold/create/web-template.d.ts +3 -2
  372. package/dist/src/setup/scaffold/create/web-template.js +384 -412
  373. package/dist/src/setup/scaffold/update/update-slack-channel.d.ts +17 -0
  374. package/dist/src/setup/scaffold/update/update-slack-channel.js +1 -1
  375. package/dist/src/setup/slack-connect-create.d.ts +10 -2
  376. package/dist/src/setup/slack-connect-create.js +1 -1
  377. package/dist/src/setup/slack-connect-lifecycle.d.ts +92 -44
  378. package/dist/src/setup/slack-connect-lifecycle.js +1 -1
  379. package/dist/src/setup/slack-connect.d.ts +30 -11
  380. package/dist/src/setup/slack-connect.js +1 -1
  381. package/dist/src/setup/slack-setup-plan.d.ts +72 -0
  382. package/dist/src/setup/slack-setup-plan.js +1 -0
  383. package/dist/src/setup/slackbot.d.ts +75 -35
  384. package/dist/src/setup/slackbot.js +2 -1
  385. package/dist/src/setup/vercel-project.d.ts +1 -1
  386. package/dist/src/setup/vercel-project.js +0 -0
  387. package/dist/src/shared/action-label.d.ts +10 -0
  388. package/dist/src/shared/action-label.js +1 -0
  389. package/dist/src/shared/action-request-name.d.ts +3 -1
  390. package/dist/src/shared/action-request-name.js +1 -1
  391. package/dist/src/shared/action-types.d.ts +7 -8
  392. package/dist/src/shared/action-types.js +1 -1
  393. package/dist/src/shared/agent-definition.d.ts +11 -3
  394. package/dist/src/shared/development-env-files.d.ts +4 -0
  395. package/dist/src/shared/development-env-files.js +1 -0
  396. package/dist/src/shared/input.d.ts +0 -1
  397. package/dist/src/shared/map-with-concurrency.d.ts +2 -0
  398. package/dist/src/shared/map-with-concurrency.js +1 -0
  399. package/dist/src/shared/skill-definition.d.ts +6 -0
  400. package/dist/src/shared/skill-package.d.ts +1 -0
  401. package/dist/src/shared/skill-package.js +1 -1
  402. package/dist/src/shared/web-search.d.ts +15 -2
  403. package/dist/src/shared/web-search.js +1 -1
  404. package/dist/src/svelte/index.js +1 -1
  405. package/dist/src/svelte/use-eve-agent.js +1 -1
  406. package/dist/src/tool-stubs/execute.d.ts +0 -3
  407. package/dist/src/tool-stubs/execute.js +1 -1
  408. package/dist/src/tool-stubs/rules.js +1 -1
  409. package/dist/src/tool-stubs/validate-targets.js +1 -1
  410. package/dist/src/tools/behavior.d.ts +3 -6
  411. package/dist/src/tools/definition.d.ts +5 -0
  412. package/dist/src/tools/dynamic.d.ts +5 -2
  413. package/dist/src/tools/provided/ask-question-workflow.js +1 -1
  414. package/dist/src/tools/provided/sleep-workflow.js +1 -1
  415. package/dist/src/tools/provided/task-cancel.d.ts +1 -1
  416. package/dist/src/tools/provided/task-wait.d.ts +1 -1
  417. package/dist/src/tools/provided/web-search.d.ts +20 -7
  418. package/dist/src/tools/provided/web-search.js +1 -1
  419. package/dist/src/tools/schema.d.ts +5 -0
  420. package/dist/src/tools/schema.js +1 -1
  421. package/dist/src/{runtime/connections/tool-signature.d.ts → tools/signature.d.ts} +2 -2
  422. package/dist/src/tools/workflow-definition.d.ts +1 -1
  423. package/dist/src/tracing/agent-approval-instrumentation.js +1 -1
  424. package/dist/src/tracing/agent-otel-provider.js +2 -2
  425. package/dist/src/tracing/agent-otel-runtime-context.d.ts +1 -0
  426. package/dist/src/tracing/agent-otel-runtime-context.js +1 -1
  427. package/dist/src/tracing/agent-otel-turn-state.d.ts +6 -0
  428. package/dist/src/tracing/agent-otel-turn-state.js +1 -0
  429. package/dist/src/tracing/agent-tool-instrumentation.js +1 -1
  430. package/dist/src/tracing/agent-trace-context-codec.js +1 -1
  431. package/dist/src/tracing/agent-trace-state.d.ts +4 -1
  432. package/dist/src/vue/index.js +1 -1
  433. package/dist/src/vue/use-eve-agent.js +1 -1
  434. package/docs/agent-config.md +8 -8
  435. package/docs/channels/chat-sdk.mdx +1 -1
  436. package/docs/channels/slack.mdx +32 -82
  437. package/docs/code-extension.mdx +28 -7
  438. package/docs/concepts/built-in-tools.md +43 -43
  439. package/docs/concepts/context-control.md +1 -1
  440. package/docs/concepts/execution-model-and-durability.mdx +1 -1
  441. package/docs/concepts/sessions-runs-and-streaming.md +4 -4
  442. package/docs/connections/mcp.mdx +5 -5
  443. package/docs/connections/openapi.mdx +1 -1
  444. package/docs/connections/overview.mdx +4 -2
  445. package/docs/evals/assertions.mdx +5 -3
  446. package/docs/evals/reporters.mdx +3 -1
  447. package/docs/evals/tool-stubs.mdx +3 -1
  448. package/docs/extensions.md +2 -0
  449. package/docs/guides/dev-tui.md +2 -2
  450. package/docs/guides/dynamic-capabilities.md +14 -4
  451. package/docs/guides/frontend/overview.mdx +1 -1
  452. package/docs/guides/remote-agents.md +10 -3
  453. package/docs/instructions.mdx +5 -5
  454. package/docs/reference/cli.md +2 -2
  455. package/docs/reference/typescript-api.md +3 -3
  456. package/docs/skills.mdx +19 -4
  457. package/docs/subagents/index.mdx +5 -3
  458. package/docs/tools/overview.mdx +22 -1
  459. package/docs/tools/tasks-upgrade.md +1 -1
  460. package/docs/tools/tasks.md +32 -32
  461. package/docs/tools/workflows.mdx +6 -6
  462. package/docs/tutorial/team-playbooks.mdx +2 -2
  463. package/package.json +27 -11
  464. package/dist/src/compiled/_chunks/workflow/dist-DmXynLVH.js +0 -1
  465. package/dist/src/compiled/_chunks/workflow/private-Dlf90Zvn.js +0 -1
  466. package/dist/src/compiled/_chunks/workflow/signal-exit-iIdjQcCK.js +0 -95
  467. package/dist/src/compiled/_chunks/workflow/sleep-BMqbraZM.js +0 -1
  468. package/dist/src/execution/connection-announcement.d.ts +0 -7
  469. package/dist/src/execution/connection-announcement.js +0 -4
  470. package/dist/src/execution/tools/connection-approval.d.ts +0 -25
  471. package/dist/src/execution/tools/connection-approval.js +0 -1
  472. package/dist/src/execution/tools/connection-search-rank.d.ts +0 -21
  473. package/dist/src/execution/tools/connection-search-rank.js +0 -1
  474. package/dist/src/execution/tools/connection-target.d.ts +0 -18
  475. package/dist/src/execution/tools/connection-target.js +0 -1
  476. package/dist/src/execution/tools/connection-tools.d.ts +0 -4
  477. package/dist/src/execution/tools/connection-tools.js +0 -2
  478. package/dist/src/execution/tools/load-skill.d.ts +0 -10
  479. package/dist/src/execution/tools/load-skill.js +0 -1
  480. package/dist/src/extensions/code/extension/lib/github-shell.js +0 -1
  481. package/dist/src/extensions/code/extension/skills/pr/SKILL.md +0 -53
  482. package/dist/src/extensions/code/extension/subagents/worker/tools/load_skill.d.ts +0 -2
  483. package/dist/src/extensions/code/extension/subagents/worker/tools/load_skill.js +0 -1
  484. package/dist/src/harness/advertised-tools.d.ts +0 -26
  485. package/dist/src/harness/advertised-tools.js +0 -1
  486. package/dist/src/harness/nested-actions.d.ts +0 -23
  487. package/dist/src/harness/nested-actions.js +0 -1
  488. package/dist/src/node_modules/.pnpm/@vercel_cli-config@0.2.0/node_modules/@vercel/cli-config/dist/cli-config.js +0 -1
  489. package/dist/src/node_modules/.pnpm/@vercel_cli-config@0.2.0/node_modules/@vercel/cli-config/dist/cred-storage.js +0 -1
  490. package/dist/src/node_modules/.pnpm/@vercel_cli-config@0.2.0/node_modules/@vercel/cli-config/dist/index.js +0 -1
  491. package/dist/src/node_modules/.pnpm/@vercel_cli-config@0.2.0/node_modules/@vercel/cli-config/dist/schema.js +0 -1
  492. package/dist/src/node_modules/.pnpm/@vercel_cli-config@0.2.0/node_modules/@vercel/cli-config/dist/schema.zod.js +0 -1
  493. package/dist/src/node_modules/.pnpm/@vercel_cli-config@0.2.0/node_modules/@vercel/cli-config/dist/types.js +0 -1
  494. package/dist/src/node_modules/.pnpm/@vercel_cli-exec@1.0.0/node_modules/@vercel/cli-exec/dist/envpath.js +0 -1
  495. package/dist/src/node_modules/.pnpm/@vercel_cli-exec@1.0.0/node_modules/@vercel/cli-exec/dist/errors.js +0 -2
  496. package/dist/src/node_modules/.pnpm/@vercel_cli-exec@1.0.0/node_modules/@vercel/cli-exec/dist/errutils.js +0 -1
  497. package/dist/src/node_modules/.pnpm/@vercel_cli-exec@1.0.0/node_modules/@vercel/cli-exec/dist/exec.js +0 -1
  498. package/dist/src/node_modules/.pnpm/@vercel_cli-exec@1.0.0/node_modules/@vercel/cli-exec/dist/fsutils.js +0 -1
  499. package/dist/src/node_modules/.pnpm/@vercel_cli-exec@1.0.0/node_modules/@vercel/cli-exec/dist/index.js +0 -1
  500. package/dist/src/node_modules/.pnpm/@vercel_cli-exec@1.0.0/node_modules/@vercel/cli-exec/dist/lookup.js +0 -1
  501. package/dist/src/node_modules/.pnpm/@vercel_cli-exec@1.0.0/node_modules/@vercel/cli-exec/dist/safety.js +0 -1
  502. package/dist/src/node_modules/.pnpm/@vercel_oidc@3.8.0/node_modules/@vercel/oidc/dist/auth-errors.js +0 -1
  503. package/dist/src/node_modules/.pnpm/@vercel_oidc@3.8.0/node_modules/@vercel/oidc/dist/exchange-vercel-oidc-token.js +0 -1
  504. package/dist/src/node_modules/.pnpm/@vercel_oidc@3.8.0/node_modules/@vercel/oidc/dist/get-context.js +0 -1
  505. package/dist/src/node_modules/.pnpm/@vercel_oidc@3.8.0/node_modules/@vercel/oidc/dist/get-vercel-oidc-token-sync.js +0 -1
  506. package/dist/src/node_modules/.pnpm/@vercel_oidc@3.8.0/node_modules/@vercel/oidc/dist/get-vercel-oidc-token-with-refresh.js +0 -2
  507. package/dist/src/node_modules/.pnpm/@vercel_oidc@3.8.0/node_modules/@vercel/oidc/dist/index.js +0 -1
  508. package/dist/src/node_modules/.pnpm/@vercel_oidc@3.8.0/node_modules/@vercel/oidc/dist/oauth.js +0 -1
  509. package/dist/src/node_modules/.pnpm/@vercel_oidc@3.8.0/node_modules/@vercel/oidc/dist/token-error.js +0 -1
  510. package/dist/src/node_modules/.pnpm/@vercel_oidc@3.8.0/node_modules/@vercel/oidc/dist/token-io.js +0 -1
  511. package/dist/src/node_modules/.pnpm/@vercel_oidc@3.8.0/node_modules/@vercel/oidc/dist/token-util.js +0 -2
  512. package/dist/src/node_modules/.pnpm/@vercel_oidc@3.8.0/node_modules/@vercel/oidc/dist/token.js +0 -1
  513. package/dist/src/node_modules/.pnpm/@vercel_oidc@3.8.0/node_modules/@vercel/oidc/dist/verify-vercel-oidc-token.js +0 -1
  514. package/dist/src/node_modules/.pnpm/@vercel_oidc@3.8.0/node_modules/@vercel/oidc/dist/version.js +0 -1
  515. package/dist/src/node_modules/.pnpm/@vercel_queue@0.5.1_@opentelemetry_api@1.9.1/node_modules/@vercel/queue/dist/index.js +0 -36
  516. package/dist/src/node_modules/.pnpm/balanced-match@4.0.4/node_modules/balanced-match/dist/esm/index.js +0 -1
  517. package/dist/src/node_modules/.pnpm/brace-expansion@5.0.12/node_modules/brace-expansion/dist/esm/index.js +0 -1
  518. package/dist/src/node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/index.js +0 -1
  519. package/dist/src/node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/enoent.js +0 -1
  520. package/dist/src/node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/parse.js +0 -1
  521. package/dist/src/node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/util/escape.js +0 -1
  522. package/dist/src/node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/util/readShebang.js +0 -1
  523. package/dist/src/node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/util/resolveCommand.js +0 -1
  524. package/dist/src/node_modules/.pnpm/execa@5.1.1/node_modules/execa/index.js +0 -1
  525. package/dist/src/node_modules/.pnpm/execa@5.1.1/node_modules/execa/lib/command.js +0 -1
  526. package/dist/src/node_modules/.pnpm/execa@5.1.1/node_modules/execa/lib/error.js +0 -2
  527. package/dist/src/node_modules/.pnpm/execa@5.1.1/node_modules/execa/lib/kill.js +0 -1
  528. package/dist/src/node_modules/.pnpm/execa@5.1.1/node_modules/execa/lib/promise.js +0 -1
  529. package/dist/src/node_modules/.pnpm/execa@5.1.1/node_modules/execa/lib/stdio.js +0 -1
  530. package/dist/src/node_modules/.pnpm/execa@5.1.1/node_modules/execa/lib/stream.js +0 -1
  531. package/dist/src/node_modules/.pnpm/get-stream@6.0.1/node_modules/get-stream/buffer-stream.js +0 -1
  532. package/dist/src/node_modules/.pnpm/get-stream@6.0.1/node_modules/get-stream/index.js +0 -1
  533. package/dist/src/node_modules/.pnpm/human-signals@2.1.0/node_modules/human-signals/build/src/core.js +0 -1
  534. package/dist/src/node_modules/.pnpm/human-signals@2.1.0/node_modules/human-signals/build/src/main.js +0 -1
  535. package/dist/src/node_modules/.pnpm/human-signals@2.1.0/node_modules/human-signals/build/src/realtime.js +0 -1
  536. package/dist/src/node_modules/.pnpm/human-signals@2.1.0/node_modules/human-signals/build/src/signals.js +0 -1
  537. package/dist/src/node_modules/.pnpm/is-stream@2.0.1/node_modules/is-stream/index.js +0 -1
  538. package/dist/src/node_modules/.pnpm/isexe@2.0.0/node_modules/isexe/index.js +0 -1
  539. package/dist/src/node_modules/.pnpm/isexe@2.0.0/node_modules/isexe/mode.js +0 -1
  540. package/dist/src/node_modules/.pnpm/isexe@2.0.0/node_modules/isexe/windows.js +0 -1
  541. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/index.js +0 -1
  542. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/jwe/compact/decrypt.js +0 -1
  543. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/jwe/compact/encrypt.js +0 -1
  544. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/jwe/flattened/decrypt.js +0 -1
  545. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/jwe/flattened/encrypt.js +0 -1
  546. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/jwe/general/decrypt.js +0 -1
  547. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/jwe/general/encrypt.js +0 -1
  548. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/jwk/embedded.js +0 -1
  549. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/jwk/thumbprint.js +0 -1
  550. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/jwks/local.js +0 -1
  551. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/jwks/remote.js +0 -1
  552. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/jws/compact/sign.js +0 -1
  553. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/jws/compact/verify.js +0 -1
  554. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/jws/flattened/sign.js +0 -1
  555. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/jws/flattened/verify.js +0 -1
  556. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/jws/general/sign.js +0 -1
  557. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/jws/general/verify.js +0 -1
  558. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/jwt/decrypt.js +0 -1
  559. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/jwt/encrypt.js +0 -1
  560. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/jwt/produce.js +0 -1
  561. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/jwt/sign.js +0 -1
  562. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/jwt/unsecured.js +0 -1
  563. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/jwt/verify.js +0 -1
  564. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/key/export.js +0 -1
  565. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/key/generate_key_pair.js +0 -1
  566. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/key/generate_secret.js +0 -1
  567. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/key/import.js +0 -1
  568. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/lib/aesgcmkw.js +0 -1
  569. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/lib/buffer_utils.js +0 -1
  570. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/lib/cek.js +0 -1
  571. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/lib/check_iv_length.js +0 -1
  572. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/lib/check_key_type.js +0 -1
  573. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/lib/check_p2s.js +0 -1
  574. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/lib/crypto_key.js +0 -1
  575. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/lib/decrypt_key_management.js +0 -1
  576. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/lib/encrypt_key_management.js +0 -1
  577. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/lib/epoch.js +0 -1
  578. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/lib/invalid_key_input.js +0 -1
  579. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/lib/is_disjoint.js +0 -1
  580. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/lib/is_jwk.js +0 -1
  581. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/lib/is_object.js +0 -1
  582. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/lib/iv.js +0 -1
  583. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/lib/jwt_claims_set.js +0 -1
  584. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/lib/private_symbols.js +0 -1
  585. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/lib/secs.js +0 -1
  586. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/lib/validate_algorithms.js +0 -1
  587. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/lib/validate_crit.js +0 -1
  588. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/runtime/aeskw.js +0 -1
  589. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/runtime/asn1.js +0 -1
  590. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/runtime/base64url.js +0 -1
  591. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/runtime/cbc_tag.js +0 -1
  592. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/runtime/check_cek_length.js +0 -1
  593. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/runtime/check_key_length.js +0 -1
  594. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/runtime/ciphers.js +0 -1
  595. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/runtime/decrypt.js +0 -1
  596. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/runtime/digest.js +0 -1
  597. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/runtime/dsa_digest.js +0 -1
  598. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/runtime/ecdhes.js +0 -1
  599. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/runtime/encrypt.js +0 -1
  600. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/runtime/fetch_jwks.js +0 -1
  601. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/runtime/generate.js +0 -1
  602. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/runtime/get_named_curve.js +0 -1
  603. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/runtime/get_sign_verify_key.js +0 -1
  604. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/runtime/hmac_digest.js +0 -1
  605. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/runtime/is_key_like.js +0 -1
  606. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/runtime/is_key_object.js +0 -1
  607. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/runtime/jwk_to_key.js +0 -1
  608. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/runtime/key_to_jwk.js +0 -1
  609. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/runtime/node_key.js +0 -1
  610. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/runtime/normalize_key.js +0 -1
  611. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/runtime/pbes2kw.js +0 -1
  612. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/runtime/random.js +0 -1
  613. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/runtime/rsaes.js +0 -1
  614. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/runtime/runtime.js +0 -1
  615. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/runtime/sign.js +0 -1
  616. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/runtime/timing_safe_equal.js +0 -1
  617. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/runtime/verify.js +0 -1
  618. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/runtime/webcrypto.js +0 -1
  619. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/util/base64url.js +0 -1
  620. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/util/decode_jwt.js +0 -1
  621. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/util/decode_protected_header.js +0 -1
  622. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/util/errors.js +0 -1
  623. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/util/runtime.js +0 -1
  624. package/dist/src/node_modules/.pnpm/merge-stream@2.0.0/node_modules/merge-stream/index.js +0 -1
  625. package/dist/src/node_modules/.pnpm/mimic-fn@2.1.0/node_modules/mimic-fn/index.js +0 -1
  626. package/dist/src/node_modules/.pnpm/minimatch@10.2.6/node_modules/minimatch/dist/esm/assert-valid-pattern.js +0 -1
  627. package/dist/src/node_modules/.pnpm/minimatch@10.2.6/node_modules/minimatch/dist/esm/ast.js +0 -1
  628. package/dist/src/node_modules/.pnpm/minimatch@10.2.6/node_modules/minimatch/dist/esm/brace-expressions.js +0 -1
  629. package/dist/src/node_modules/.pnpm/minimatch@10.2.6/node_modules/minimatch/dist/esm/escape.js +0 -1
  630. package/dist/src/node_modules/.pnpm/minimatch@10.2.6/node_modules/minimatch/dist/esm/index.js +0 -1
  631. package/dist/src/node_modules/.pnpm/minimatch@10.2.6/node_modules/minimatch/dist/esm/unescape.js +0 -1
  632. package/dist/src/node_modules/.pnpm/mixpart@0.0.6/node_modules/mixpart/dist/index.js +0 -7
  633. package/dist/src/node_modules/.pnpm/npm-run-path@4.0.1/node_modules/npm-run-path/index.js +0 -1
  634. package/dist/src/node_modules/.pnpm/onetime@5.1.2/node_modules/onetime/index.js +0 -1
  635. package/dist/src/node_modules/.pnpm/os-paths@4.4.0/node_modules/os-paths/src/lib/index.js +0 -1
  636. package/dist/src/node_modules/.pnpm/path-key@3.1.1/node_modules/path-key/index.js +0 -1
  637. package/dist/src/node_modules/.pnpm/picocolors@1.1.1/node_modules/picocolors/picocolors.js +0 -1
  638. package/dist/src/node_modules/.pnpm/shebang-command@2.0.0/node_modules/shebang-command/index.js +0 -1
  639. package/dist/src/node_modules/.pnpm/shebang-regex@3.0.0/node_modules/shebang-regex/index.js +0 -1
  640. package/dist/src/node_modules/.pnpm/signal-exit@3.0.7/node_modules/signal-exit/index.js +0 -1
  641. package/dist/src/node_modules/.pnpm/signal-exit@3.0.7/node_modules/signal-exit/signals.js +0 -1
  642. package/dist/src/node_modules/.pnpm/strip-final-newline@2.0.0/node_modules/strip-final-newline/index.js +0 -2
  643. package/dist/src/node_modules/.pnpm/which@2.0.2/node_modules/which/which.js +0 -1
  644. package/dist/src/node_modules/.pnpm/xdg-app-paths@5.5.1/node_modules/xdg-app-paths/src/lib/index.js +0 -1
  645. package/dist/src/node_modules/.pnpm/xdg-portable@7.3.0/node_modules/xdg-portable/src/lib/index.js +0 -1
  646. package/dist/src/public/tools/load-skill.d.ts +0 -3
  647. package/dist/src/public/tools/load-skill.js +0 -1
  648. package/dist/src/runtime/skills/fragment-context.d.ts +0 -4
  649. package/dist/src/runtime/skills/fragment-context.js +0 -1
  650. package/dist/src/tools/framework/connection-tools.d.ts +0 -3
  651. package/dist/src/tools/framework/connection-tools.js +0 -1
  652. package/dist/src/tools/provided/load-skill.d.ts +0 -2
  653. package/dist/src/tools/provided/load-skill.js +0 -1
  654. /package/dist/src/extensions/{code → git}/extension/lib/github-shell-schema.d.ts +0 -0
  655. /package/dist/src/extensions/{code → git}/extension/lib/github-shell-schema.js +0 -0
  656. /package/dist/src/extensions/{code → git}/extension/lib/signed-commit.d.ts +0 -0
  657. /package/dist/src/extensions/{code → git}/extension/lib/signed-commit.js +0 -0
  658. /package/dist/src/{runtime/connections/tool-signature.js → tools/signature.js} +0 -0
@@ -15,7 +15,7 @@ import type { ScheduleProviderContext } from "#runtime/schedules/provider-types.
15
15
  export type ScheduleScopeValue = string | readonly string[];
16
16
  /** Return `null` to deny the current schedule operation. */
17
17
  export type ScheduleScopeResolverResult = ScheduleScopeValue | null;
18
- export type ScheduleOperation = "create" | "get" | "list" | "enable" | "disable" | "invoke" | "delete";
18
+ export type ScheduleOperation = "create" | "get" | "list" | "update" | "enable" | "disable" | "invoke" | "delete";
19
19
  /** Trusted caller context used to authorize each management operation. */
20
20
  export interface ScheduleScopeContext {
21
21
  readonly abortSignal: AbortSignal;
@@ -106,6 +106,10 @@ export interface ScheduleCreate<TPayload> {
106
106
  readonly payload: TPayload;
107
107
  readonly name: string;
108
108
  }
109
+ export interface SchedulePatch<TPayload> {
110
+ readonly expression?: ScheduleExpression;
111
+ readonly payload?: TPayload;
112
+ }
109
113
  export interface ScheduleList {
110
114
  readonly cursor?: string;
111
115
  readonly limit?: number;
@@ -122,6 +126,8 @@ export interface ScheduleProvider {
122
126
  create<TPayload>(context: ScheduleProviderContext, schedule: ScheduleCreate<TPayload>): Promise<ScheduleRecord>;
123
127
  list(context: ScheduleProviderContext, query: ScheduleList): Promise<SchedulePage>;
124
128
  get(context: ScheduleProviderContext, name: string): Promise<ScheduleRecord | null>;
129
+ /** Patch supplied fields; preserve identity, state, target, and omitted fields. */
130
+ update<TPayload>(context: ScheduleProviderContext, name: string, patch: SchedulePatch<TPayload>): Promise<ScheduleRecord>;
125
131
  enable(context: ScheduleProviderContext, name: string): Promise<ScheduleRecord>;
126
132
  disable(context: ScheduleProviderContext, name: string): Promise<ScheduleRecord>;
127
133
  invoke(context: ScheduleProviderContext, name: string): Promise<void>;
@@ -137,7 +143,15 @@ export interface SchedulePageResult {
137
143
  readonly cursor: string | null;
138
144
  readonly data: readonly ScheduleRecord[];
139
145
  }
140
- /** Authenticated client; payload and creator identity are immutable after creation. */
146
+ /** Requires timing or complete replacement input, which captures the updating caller as creator. */
147
+ export type ScheduleClientUpdate<TPayload> = {
148
+ readonly expression: ScheduleTiming;
149
+ readonly payload?: TPayload;
150
+ } | {
151
+ readonly expression?: ScheduleTiming;
152
+ readonly payload: TPayload;
153
+ };
154
+ /** Authenticated client; timing-only updates preserve payload and creator identity. */
141
155
  export interface ScheduleClient<TPayload> {
142
156
  create(input: ScheduleClientCreate<TPayload>): Promise<ScheduleRecord>;
143
157
  delete(name: string): Promise<boolean>;
@@ -146,12 +160,14 @@ export interface ScheduleClient<TPayload> {
146
160
  get(name: string): Promise<ScheduleRecord | null>;
147
161
  invoke(name: string): Promise<void>;
148
162
  list(input?: ScheduleList): Promise<SchedulePageResult>;
163
+ /** Requires timing or payload. Payload replacement captures the updating caller as creator. */
164
+ update(name: string, patch: ScheduleClientUpdate<TPayload>): Promise<ScheduleRecord>;
149
165
  }
150
166
  /** Starts fresh unattended work bound to the resolved creator; callers cannot choose another identity. */
151
167
  export type DynamicSchedulesToFn = <TChannel extends ChannelReference<unknown>>(channel: TChannel, target: InferReceiveTarget<TChannel>) => {
152
168
  send(message: string | UserContent): Promise<Session>;
153
169
  };
154
- export type ScheduleCreateApproval<TPrepared> = ((context: ApprovalContext & {
170
+ type SchedulePayloadApproval<TPrepared> = ((context: ApprovalContext & {
155
171
  readonly payload: TPrepared;
156
172
  }) => ApprovalStatus | Promise<ApprovalStatus>) | {
157
173
  readonly request: (context: ApprovalContext & {
@@ -161,8 +177,11 @@ export type ScheduleCreateApproval<TPrepared> = ((context: ApprovalContext & {
161
177
  readonly payload: TPrepared;
162
178
  }) => ApprovalResponseDecision | Promise<ApprovalResponseDecision>;
163
179
  };
164
- export type ScheduleApprovals<TPrepared> = Partial<Record<Exclude<ScheduleOperation, "create">, Approval>> & {
180
+ export type ScheduleCreateApproval<TPrepared> = SchedulePayloadApproval<TPrepared>;
181
+ export type ScheduleApprovals<TPrepared> = Partial<Record<Exclude<ScheduleOperation, "create" | "update">, Approval>> & {
165
182
  readonly create?: ScheduleCreateApproval<TPrepared>;
183
+ /** Prepared replacement payload, or undefined for timing-only updates. */
184
+ readonly update?: SchedulePayloadApproval<TPrepared | undefined>;
166
185
  };
167
186
  /** Execution context; `to` starts fresh, unattended sessions as the resolved creator. */
168
187
  export interface DynamicSchedulesRunArgs<TPayload> extends Pick<ScheduleHandlerArgs, "waitUntil"> {
@@ -179,29 +198,30 @@ export interface DynamicSchedulesDefinition<TPayload = unknown, TSchema extends
179
198
  /** Resolved backend. defineDynamicSchedules defaults omitted providers to Vercel Schedules. */
180
199
  readonly provider: ScheduleProvider;
181
200
  /**
182
- * Validates application policy and enriches a creation payload before the provider write.
183
- * The caller constructs input; eve validates it with `inputSchema`, authorizes creation
184
- * through `scope`, then calls `preparePayload` with trusted creation context. eve checks that the
201
+ * Validates application policy and enriches a creation or replacement payload before the provider write.
202
+ * The caller constructs input; eve validates it with `inputSchema`, authorizes the write
203
+ * through `scope`, then calls `preparePayload` with trusted caller context. eve checks that the
185
204
  * result is bounded JSON and persists it; `inputSchema` describes caller input, not stored prepared output.
186
- * Throw an actionable error to reject creation without writing a schedule.
205
+ * Throw an actionable error to reject the write without changing a schedule.
187
206
  *
188
207
  * A common use is capturing the current channel destination: derive channel/workspace
189
208
  * references from verified caller context, replace any model-supplied references, and
190
209
  * return them with the task. Keep captured fields out of the input schema.
191
210
  * Channel-less or delegated callers may lack that context; reject those cases explicitly.
192
211
  *
193
- * Runs only on creation. Model calls invoke preparePayload before approval and again before
194
- * writing; execution fails if the prepared result differs from the approved snapshot.
195
- * Authenticated clients invoke preparePayload once before writing without model approval. Reads, enable/disable operations, and occurrence execution do not call it. Omission
196
- * stores validated input unchanged. Creation retries may call it again, so avoid
197
- * irreversible side effects; state changes never recapture a different destination.
212
+ * Runs on creation and payload replacement. Model calls invoke preparePayload before approval
213
+ * and again before writing; execution fails if the prepared result differs from the approved snapshot.
214
+ * Authenticated clients invoke preparePayload once before writing without model approval.
215
+ * Reads, timing-only updates, state changes, and occurrence execution do not call it. Omission
216
+ * stores validated input unchanged. Write retries may call it again, so avoid irreversible
217
+ * side effects. Payload replacement recaptures the destination and creator from the updating caller.
198
218
  * `auth`, `run`, and occurrence events receive the inferred return type. Declare `preparePayload`
199
219
  * before those callbacks for contextual inference, or annotate its return type explicitly.
200
220
  * Prepared application data is not revalidated against the input schema at execution;
201
221
  * validate the application's persisted contract in authored code when necessary.
202
222
  */
203
223
  readonly preparePayload?: (payload: TPayload, context: ScheduleScopeContext & {
204
- readonly operation: "create";
224
+ readonly operation: "create" | "update";
205
225
  readonly name: string;
206
226
  }) => TPrepared | Promise<TPrepared>;
207
227
  /** Authorizes every management operation. Defaults to `byPrincipal`. */
@@ -224,7 +244,7 @@ export interface DynamicSchedulesDefinition<TPayload = unknown, TSchema extends
224
244
  };
225
245
  /** Expose operation tools directly (default true), or false for code-only scheduling. */
226
246
  readonly tool?: boolean;
227
- /** Model-call policies keyed by operation. Create receives the validated prepared payload. */
247
+ /** Model-call policies keyed by operation. Create and update receive the prepared payload. */
228
248
  readonly approval?: ScheduleApprovals<NoInfer<TPrepared>>;
229
249
  }
230
250
  export type DefinedDynamicSchedules<TPayload = unknown, TSchema extends StandardSchemaV1<unknown, TPayload> = StandardSchemaV1<unknown, TPayload>, TPrepared = TPayload> = DynamicSchedulesDefinition<TPayload, TSchema, TPrepared> & {
@@ -250,7 +270,7 @@ type DynamicSchedulesOptions<TInput, TSchema extends StandardSchemaV1<unknown, T
250
270
  */
251
271
  export declare function defineDynamicSchedules<TInput, TPrepared>(definition: Omit<DynamicSchedulesOptions<TInput, StandardSchemaV1<unknown, TInput>, TPrepared>, "preparePayload"> & {
252
272
  readonly preparePayload: (payload: TInput, context: ScheduleScopeContext & {
253
- readonly operation: "create";
273
+ readonly operation: "create" | "update";
254
274
  readonly name: string;
255
275
  }) => TPrepared | Promise<TPrepared>;
256
276
  }): DefinedDynamicSchedules<TInput, StandardSchemaV1<unknown, TInput>, TPrepared>;
@@ -1,3 +1,3 @@
1
1
  import webSearchDefinition from "#tools/provided/web-search.js";
2
- export { type WebSearchProvider, type WebSearchToolDefinition, type WebSearchToolInput, defaultWebSearch, isWebSearchToolDefinition, webSearch, } from "#tools/provided/web-search.js";
2
+ export { type WebSearchFallbackProvider, type WebSearchProvider, type WebSearchToolDefinition, type WebSearchToolInput, defaultWebSearch, isWebSearchToolDefinition, webSearch, } from "#tools/provided/web-search.js";
3
3
  export default webSearchDefinition;
@@ -26,7 +26,8 @@ export type RuntimeDynamicModelReference = Readonly<ModuleSourceRef & {
26
26
  * Minimal runtime-owned agent shape prepared for one harness turn.
27
27
  */
28
28
  interface RuntimeTurnAgentBase {
29
- readonly availableSkills?: readonly AvailableSkillDescription[];
29
+ /** The skills the system prompt lists: every authored skill that isn't deferred. */
30
+ readonly listedSkills?: readonly AvailableSkillDescription[];
30
31
  readonly id: string;
31
32
  readonly instructions: readonly string[];
32
33
  readonly initialMessages?: readonly HarnessModelMessage[];
@@ -1 +1 @@
1
- import{createFrameworkUserMessage}from"#harness/messages.js";import{composeRuntimeBasePrompt}from"#runtime/prompt/compose.js";const BOOTSTRAP_RUNTIME_MODEL_ID=`eve-bootstrap-model`,BOOTSTRAP_RUNTIME_SYSTEM_PROMPT=`You are the eve bootstrap agent. Be concise, stay grounded in the current conversation, and do not assume tools are available unless the runtime provides them.`;function createResolvedRuntimeTurnAgent(e){let t=e.agent,n=t.config,r=e.id??n?.name;if(r===void 0)throw Error(`Expected a path-derived agent id while resolving agent resources.`);let i={availableSkills:t.skills.map(e=>({description:e.description,name:e.name})),id:r,initialMessages:t.instructions.filter(e=>e.role===`user`&&e.content.trim().length>0).map(e=>createFrameworkUserMessage(`context.instruction`,e.content.trim())),instructions:composeRuntimeBasePrompt({instructions:t.instructions,toolsAvailable:e.tools.length>0,workspaceSpec:t.workspaceSpec}),compactionModel:n?.compaction?.model,nodeId:e.nodeId,reasoning:n?.reasoning,tools:[...e.tools],workspaceSpec:t.workspaceSpec};return n===void 0?{...i,configResolver:!0}:n.dynamicModel===void 0?{...i,model:n.model}:{...i,dynamicModel:n.dynamicModel}}export{BOOTSTRAP_RUNTIME_MODEL_ID,BOOTSTRAP_RUNTIME_SYSTEM_PROMPT,createResolvedRuntimeTurnAgent};
1
+ import{createFrameworkUserMessage}from"#harness/messages.js";import{composeRuntimeBasePrompt}from"#runtime/prompt/compose.js";const BOOTSTRAP_RUNTIME_MODEL_ID=`eve-bootstrap-model`,BOOTSTRAP_RUNTIME_SYSTEM_PROMPT=`You are the eve bootstrap agent. Be concise, stay grounded in the current conversation, and do not assume tools are available unless the runtime provides them.`;function createResolvedRuntimeTurnAgent(e){let t=e.agent,n=t.config,r=e.id??n?.name;if(r===void 0)throw Error(`Expected a path-derived agent id while resolving agent resources.`);let i={listedSkills:t.skills.filter(e=>e.deferred!==!0).map(e=>({description:e.description,name:e.name})),id:r,initialMessages:t.instructions.filter(e=>e.role===`user`&&e.content.trim().length>0).map(e=>createFrameworkUserMessage(`context.instruction`,e.content.trim())),instructions:composeRuntimeBasePrompt({instructions:t.instructions,toolsAvailable:e.tools.length>0,workspaceSpec:t.workspaceSpec}),compactionModel:n?.compaction?.model,nodeId:e.nodeId,reasoning:n?.reasoning,tools:[...e.tools],workspaceSpec:t.workspaceSpec};return n===void 0?{...i,configResolver:!0}:n.dynamicModel===void 0?{...i,model:n.model}:{...i,dynamicModel:n.dynamicModel}}export{BOOTSTRAP_RUNTIME_MODEL_ID,BOOTSTRAP_RUNTIME_SYSTEM_PROMPT,createResolvedRuntimeTurnAgent};
@@ -1,4 +1,4 @@
1
- import{createHash}from"node:crypto";import{z}from"#compiled/zod/index.js";import{LOAD_SKILL_TOOL_NAME}from"#runtime/skills/fragment-context.js";import{MockLanguageModelV3}from"ai/test";import{readTaskResults}from"#execution/tasks/render.js";import{FINAL_OUTPUT_TOOL_NAME}from"#harness/final-output.js";import{BOOTSTRAP_RUNTIME_MODEL_ID,BOOTSTRAP_RUNTIME_SYSTEM_PROMPT}from"#runtime/agent/bootstrap.js";import{createBootstrapGenerateResult,createBootstrapStreamResult,estimateTokenCount,getLastUserPromptText,getPromptContentText,getPromptText,isFrameworkAnnouncementText}from"#runtime/agent/bootstrap-model-utils.js";import{createMockAuthoredToolInput,formatToolOutput,resolveMockFixtureToken,resolveWeatherCity}from"#runtime/agent/mock-model-fixtures.js";import{findRelevantSkill,getActivatedSkillIds,getAvailableSkills}from"#runtime/agent/mock-model-skill-selection.js";import{createJsonSchemaSample}from"#runtime/agent/mock-structured-output.js";const authoredRuntimeModelMocks=new Map,bootstrapWeatherPayloadSchema=z.object({city:z.string(),condition:z.string(),summary:z.string(),temperatureF:z.number().finite()}).strict();function shouldMockAuthoredRuntimeModels(){return process.env.NODE_ENV===`test`||process.env.EVE_MOCK_AUTHORED_MODELS===`1`}function createMockAuthoredRuntimeModel(e){let t=authoredRuntimeModelMocks.get(e.id);if(t!==void 0)return t;let n=new MockLanguageModelV3({modelId:e.id,provider:`eve-runtime-mock`,doGenerate:async t=>createMockModelResult(t,e.id),doStream:async t=>createBootstrapStreamResult(createMockModelResult(t,e.id))});return authoredRuntimeModelMocks.set(e.id,n),n}function createMockModelResult(e,t){let n=getLastAuthoredToolResult(e.prompt);if(n!==null){let r=createFollowUpToolCallResult({modelId:t,options:e,result:n});if(r!==null)return r}else{let n=createParallelAuthoredToolCallsResult(e,t)??createSubagentDelegationResult(e,t)??createSkillLoadResult(e.prompt,t)??createAuthoredToolCallResult(e,t);if(n!==null)return n}let r=createFinalOutputResult(e,t);if(r!==null)return r;let i=n===null?createAssistantMessage(e.prompt):formatToolResultReply(n,e.prompt);return createBootstrapGenerateResult({inputTokens:estimateTokenCount(getPromptText(e.prompt)),modelId:t,outputTokens:estimateTokenCount(i),text:i})}function createFinalOutputResult(e,t){let n=getAvailableTools(e).find(e=>e.name===FINAL_OUTPUT_TOOL_NAME);if(n===void 0)return null;let r=createJsonSchemaSample(n.inputSchema);return createToolCallGenerateResult({input:r,inputTokens:estimateTokenCount(getPromptText(e.prompt)),modelId:t,outputTokens:estimateTokenCount(JSON.stringify(r)),toolCallId:createToolCallId(FINAL_OUTPUT_TOOL_NAME),toolName:FINAL_OUTPUT_TOOL_NAME})}function resolveMockAuthoredRuntimeModel(e){return!shouldMockAuthoredRuntimeModels()||e.id===BOOTSTRAP_RUNTIME_MODEL_ID?null:createMockAuthoredRuntimeModel(e)}function createSkillLoadResult(e,t){let n=getLastUserPromptText(e);if(n===null||getActivatedSkillIds(e).length>0)return null;let r=findRelevantSkill(getAvailableSkills(e),n);return r===null?null:createToolCallGenerateResult({input:{skill:r.name},inputTokens:estimateTokenCount(getPromptText(e)),modelId:t,outputTokens:estimateTokenCount(r.name),toolCallId:`call_load_skill`,toolName:LOAD_SKILL_TOOL_NAME})}const SUBAGENT_DELEGATION_DIRECTIVE=/\bdelegate\s+to\s+a\s+subagent\s*:\s*(.+)$/iu,PARALLEL_AUTHORED_TOOLS_DIRECTIVE=/^call tools in parallel:\s*(.+)$/imu;function createParallelAuthoredToolCallsResult(e,t){let n=getLastUserPromptText(e.prompt);if(n===null)return null;let r=PARALLEL_AUTHORED_TOOLS_DIRECTIVE.exec(n)?.[1]?.split(`,`).map(e=>e.trim()).filter(Boolean);if(r===void 0||r.length<2||new Set(r).size!==r.length)return null;let i=new Map(getAvailableTools(e).map(e=>[e.name,e])),a=[];for(let e of r){let t=i.get(e);if(t===void 0)return null;a.push(t)}let o=resolveWeatherCity(n);return createToolCallsGenerateResult({calls:a.map(e=>({input:createMockAuthoredToolInput(e,n,o),toolCallId:createToolCallId(e.name),toolName:e.name})),inputTokens:estimateTokenCount(getPromptText(e.prompt)),modelId:t,outputTokens:estimateTokenCount(n)})}function createSubagentDelegationResult(e,t){let n=getLastUserPromptText(e.prompt);if(n===null)return null;let r=SUBAGENT_DELEGATION_DIRECTIVE.exec(n);if(r?.[1]===void 0)return null;let i=`agent`;if(getAvailableTools(e).find(e=>e.name===i)===void 0)return null;let a=r[1].trim();return createToolCallGenerateResult({input:{message:a},inputTokens:estimateTokenCount(getPromptText(e.prompt)),modelId:t,outputTokens:estimateTokenCount(a),toolCallId:createToolCallId(i),toolName:i})}function createAuthoredToolCallResult(e,t){let n=getLastUserPromptText(e.prompt);if(n===null)return null;let r=findRelevantTool(getAvailableTools(e),n);if(r===null)return null;let i=resolveWeatherCity(n),a=createMockAuthoredToolInput(r,n,i);return createToolCallGenerateResult({input:a,inputTokens:estimateTokenCount(getPromptText(e.prompt)),modelId:t,outputTokens:estimateTokenCount(Object.values(a).join(` `)),toolCallId:createToolCallId(r.name),toolName:r.name})}function createFollowUpToolCallResult(e){let t=findNextExplicitToolAfterResult({previousToolName:e.result.toolName,prompt:e.options.prompt,tools:getAvailableTools(e.options)});if(t===null)return null;let n=createFollowUpToolInput(e.result.output);return n===null?null:createToolCallGenerateResult({input:n,inputTokens:estimateTokenCount(getPromptText(e.options.prompt)),modelId:e.modelId,outputTokens:estimateTokenCount(Object.values(n).join(` `)),toolCallId:createToolCallId(t.name),toolName:t.name})}const LIST_ATTACHMENTS_DIRECTIVE=/\blist the attachments\b/iu;function createAssistantMessage(e){let t=getLastUserPromptText(e)??`Hello from eve`;if(LIST_ATTACHMENTS_DIRECTIVE.test(t))return`Attachments: ${JSON.stringify(listPromptAttachments(e))}`;let n=getSystemPromptLabels(e),r=resolveSystemProbe(e),i=resolveMockFixtureToken(e);return i===null?n.length>0?r===null?`Bootstrap reply [${n.join(`, `)}]: ${t}`:`Bootstrap reply [${n.join(`, `)}; probe=${r}]: ${t}`:r===null?`Bootstrap reply: ${t}`:`Bootstrap reply [probe=${r}]: ${t}`:i}function formatToolResultReply(e,t){if(e.isError)return`Local weather tool failed: ${formatToolOutput(e.output)}`;if(isWeatherPayload(e.output))return`Used local weather tool for ${e.output.city}: ${e.output.condition}, ${e.output.temperatureF}F. ${e.output.summary}`;let n=getLastUserPromptText(t)??`Hello from eve`;return`Used ${e.toolName} for "${n}": ${formatToolOutput(e.output)}`}function createToolCallGenerateResult(e){return createToolCallsGenerateResult({calls:[{input:e.input,toolCallId:e.toolCallId,toolName:e.toolName}],inputTokens:e.inputTokens,modelId:e.modelId,outputTokens:e.outputTokens})}function createToolCallsGenerateResult(e){return{content:e.calls.map(e=>({input:JSON.stringify(e.input),toolCallId:e.toolCallId,toolName:e.toolName,type:`tool-call`})),finishReason:{raw:void 0,unified:`tool-calls`},response:{id:`bootstrap-response`,modelId:e.modelId,timestamp:new Date(`2026-03-16T00:00:00.000Z`)},usage:{inputTokens:{cacheRead:0,cacheWrite:0,noCache:e.inputTokens,total:e.inputTokens},outputTokens:{reasoning:0,text:e.outputTokens,total:e.outputTokens}},warnings:[]}}function getAvailableTools(e){return(e.tools??[]).flatMap(e=>e.type===`function`?[{description:e.description,inputSchema:`inputSchema`in e?e.inputSchema:void 0,name:e.name,outputSchema:`outputSchema`in e?e.outputSchema:void 0}]:[])}function getLastAuthoredToolResult(e){for(let t of[...e].reverse()){if(t.role===`user`){let e=getPromptContentText(t.content).trim(),n=readTaskResults(e).at(-1);if(n!==void 0){let{body:e,taskId:t,tool:r}=n;return{isError:n.status===`failed`,output:e,toolCallId:t,toolName:r}}if(isFrameworkAnnouncementText(e))continue;return null}if(t.role===`tool`||t.role===`assistant`){for(let e of[...t.content].reverse())if(typeof e!=`string`&&e.type===`tool-result`&&e.toolName!==LOAD_SKILL_TOOL_NAME)return{isError:e.output.type===`error-json`||e.output.type===`error-text`||e.output.type===`execution-denied`,output:e.output.type===`execution-denied`?{reason:e.output.reason??null,type:e.output.type}:e.output.value,toolCallId:e.toolCallId,toolName:e.toolName}}}return null}function findNextExplicitToolAfterResult(e){let t=getLastUserPromptText(e.prompt);if(t===null)return null;let n=normalizeText(t),r=n.indexOf(normalizeText(e.previousToolName));return r<0?null:e.tools.filter(t=>t.name!==e.previousToolName).flatMap(e=>{let t=n.indexOf(normalizeText(e.name),r+1);return t<0?[]:[{index:t,tool:e}]}).sort((e,t)=>e.index-t.index)[0]?.tool??null}function createFollowUpToolInput(e){return isRecord(e)&&typeof e.stepKey==`string`?{stepKey:e.stepKey}:null}function getSystemPromptLabels(e){let t=e.filter(e=>e.role===`system`);if(t.length===0)return[];let n=t.flatMap(e=>{let t=getPromptContentText(e.content);if(t.startsWith(`Available skills
1
+ import{createHash}from"node:crypto";import{z}from"#compiled/zod/index.js";import{REPLY_TOOL_NAME}from"#protocol/reply-tool.js";import{SKILL_TOOL_NAME}from"#protocol/catalog-tools.js";import{MockLanguageModelV3}from"ai/test";import{readTaskResults}from"#execution/tasks/render.js";import{BOOTSTRAP_RUNTIME_MODEL_ID,BOOTSTRAP_RUNTIME_SYSTEM_PROMPT}from"#runtime/agent/bootstrap.js";import{createBootstrapGenerateResult,createBootstrapStreamResult,estimateTokenCount,getLastUserPromptText,getPromptContentText,getPromptText,isFrameworkAnnouncementText}from"#runtime/agent/bootstrap-model-utils.js";import{createMockAuthoredToolInput,formatToolOutput,resolveMockFixtureToken,resolveWeatherCity}from"#runtime/agent/mock-model-fixtures.js";import{findRelevantSkill,getActivatedSkillIds,getAvailableSkills,getSkillLoads}from"#runtime/agent/mock-model-skill-selection.js";import{createJsonSchemaSample}from"#runtime/agent/mock-structured-output.js";const authoredRuntimeModelMocks=new Map,bootstrapWeatherPayloadSchema=z.object({city:z.string(),condition:z.string(),summary:z.string(),temperatureF:z.number().finite()}).strict();function shouldMockAuthoredRuntimeModels(){return process.env.NODE_ENV===`test`||process.env.EVE_MOCK_AUTHORED_MODELS===`1`}function createMockAuthoredRuntimeModel(e){let t=authoredRuntimeModelMocks.get(e.id);if(t!==void 0)return t;let n=new MockLanguageModelV3({modelId:e.id,provider:`eve-runtime-mock`,doGenerate:async t=>createMockModelResult(t,e.id),doStream:async t=>createBootstrapStreamResult(createMockModelResult(t,e.id))});return authoredRuntimeModelMocks.set(e.id,n),n}function createMockModelResult(e,t){let n=getLastAuthoredToolResult(e.prompt);if(n!==null){let r=createFollowUpToolCallResult({modelId:t,options:e,result:n});if(r!==null)return r}else{let n=createParallelAuthoredToolCallsResult(e,t)??createSubagentDelegationResult(e,t)??createSkillLoadResult(e.prompt,t)??createAuthoredToolCallResult(e,t);if(n!==null)return n}let r=createFinalOutputResult(e,t);if(r!==null)return r;let i=n===null?createAssistantMessage(e.prompt):formatToolResultReply(n,e.prompt);return createBootstrapGenerateResult({inputTokens:estimateTokenCount(getPromptText(e.prompt)),modelId:t,outputTokens:estimateTokenCount(i),text:i})}function createFinalOutputResult(e,t){let n=getAvailableTools(e).find(e=>e.name===REPLY_TOOL_NAME);if(n===void 0)return null;let r=createJsonSchemaSample(n.inputSchema);return createToolCallGenerateResult({input:r,inputTokens:estimateTokenCount(getPromptText(e.prompt)),modelId:t,outputTokens:estimateTokenCount(JSON.stringify(r)),toolCallId:createToolCallId(REPLY_TOOL_NAME),toolName:REPLY_TOOL_NAME})}function resolveMockAuthoredRuntimeModel(e){return!shouldMockAuthoredRuntimeModels()||e.id===BOOTSTRAP_RUNTIME_MODEL_ID?null:createMockAuthoredRuntimeModel(e)}function createSkillLoadResult(e,t){let n=getLastUserPromptText(e);if(n===null||getActivatedSkillIds(e).length>0)return null;let r=findRelevantSkill(getAvailableSkills(e),n);return r===null?null:createToolCallGenerateResult({input:{name:r.name},inputTokens:estimateTokenCount(getPromptText(e)),modelId:t,outputTokens:estimateTokenCount(r.name),toolCallId:`call_execute_skill`,toolName:SKILL_TOOL_NAME})}const SUBAGENT_DELEGATION_DIRECTIVE=/\bdelegate\s+to\s+a\s+subagent\s*:\s*(.+)$/iu,PARALLEL_AUTHORED_TOOLS_DIRECTIVE=/^call tools in parallel:\s*(.+)$/imu;function createParallelAuthoredToolCallsResult(e,t){let n=getLastUserPromptText(e.prompt);if(n===null)return null;let r=PARALLEL_AUTHORED_TOOLS_DIRECTIVE.exec(n)?.[1]?.split(`,`).map(e=>e.trim()).filter(Boolean);if(r===void 0||r.length<2||new Set(r).size!==r.length)return null;let i=new Map(getAvailableTools(e).map(e=>[e.name,e])),a=[];for(let e of r){let t=i.get(e);if(t===void 0)return null;a.push(t)}let o=resolveWeatherCity(n);return createToolCallsGenerateResult({calls:a.map(e=>({input:createMockAuthoredToolInput(e,n,o),toolCallId:createToolCallId(e.name),toolName:e.name})),inputTokens:estimateTokenCount(getPromptText(e.prompt)),modelId:t,outputTokens:estimateTokenCount(n)})}function createSubagentDelegationResult(e,t){let n=getLastUserPromptText(e.prompt);if(n===null)return null;let r=SUBAGENT_DELEGATION_DIRECTIVE.exec(n);if(r?.[1]===void 0)return null;let i=`agent`;if(getAvailableTools(e).find(e=>e.name===i)===void 0)return null;let a=r[1].trim();return createToolCallGenerateResult({input:{message:a},inputTokens:estimateTokenCount(getPromptText(e.prompt)),modelId:t,outputTokens:estimateTokenCount(a),toolCallId:createToolCallId(i),toolName:i})}function createAuthoredToolCallResult(e,t){let n=getLastUserPromptText(e.prompt);if(n===null)return null;let r=findRelevantTool(getAvailableTools(e),n);if(r===null)return null;let i=resolveWeatherCity(n),a=createMockAuthoredToolInput(r,n,i);return createToolCallGenerateResult({input:a,inputTokens:estimateTokenCount(getPromptText(e.prompt)),modelId:t,outputTokens:estimateTokenCount(Object.values(a).join(` `)),toolCallId:createToolCallId(r.name),toolName:r.name})}function createFollowUpToolCallResult(e){let t=findNextExplicitToolAfterResult({previousToolName:e.result.toolName,prompt:e.options.prompt,tools:getAvailableTools(e.options)});if(t===null)return null;let n=createFollowUpToolInput(e.result.output);return n===null?null:createToolCallGenerateResult({input:n,inputTokens:estimateTokenCount(getPromptText(e.options.prompt)),modelId:e.modelId,outputTokens:estimateTokenCount(Object.values(n).join(` `)),toolCallId:createToolCallId(t.name),toolName:t.name})}const LIST_ATTACHMENTS_DIRECTIVE=/\blist the attachments\b/iu;function createAssistantMessage(e){let t=getLastUserPromptText(e)??`Hello from eve`;if(LIST_ATTACHMENTS_DIRECTIVE.test(t))return`Attachments: ${JSON.stringify(listPromptAttachments(e))}`;let n=getSystemPromptLabels(e),r=resolveSystemProbe(e),i=resolveMockFixtureToken(e);return i===null?n.length>0?r===null?`Bootstrap reply [${n.join(`, `)}]: ${t}`:`Bootstrap reply [${n.join(`, `)}; probe=${r}]: ${t}`:r===null?`Bootstrap reply: ${t}`:`Bootstrap reply [probe=${r}]: ${t}`:i}function formatToolResultReply(e,t){if(e.isError)return`Local weather tool failed: ${formatToolOutput(e.output)}`;if(isWeatherPayload(e.output))return`Used local weather tool for ${e.output.city}: ${e.output.condition}, ${e.output.temperatureF}F. ${e.output.summary}`;let n=getLastUserPromptText(t)??`Hello from eve`;return`Used ${e.toolName} for "${n}": ${formatToolOutput(e.output)}`}function createToolCallGenerateResult(e){return createToolCallsGenerateResult({calls:[{input:e.input,toolCallId:e.toolCallId,toolName:e.toolName}],inputTokens:e.inputTokens,modelId:e.modelId,outputTokens:e.outputTokens})}function createToolCallsGenerateResult(e){return{content:e.calls.map(e=>({input:JSON.stringify(e.input),toolCallId:e.toolCallId,toolName:e.toolName,type:`tool-call`})),finishReason:{raw:void 0,unified:`tool-calls`},response:{id:`bootstrap-response`,modelId:e.modelId,timestamp:new Date(`2026-03-16T00:00:00.000Z`)},usage:{inputTokens:{cacheRead:0,cacheWrite:0,noCache:e.inputTokens,total:e.inputTokens},outputTokens:{reasoning:0,text:e.outputTokens,total:e.outputTokens}},warnings:[]}}function getAvailableTools(e){return(e.tools??[]).flatMap(e=>e.type===`function`?[{description:e.description,inputSchema:`inputSchema`in e?e.inputSchema:void 0,name:e.name,outputSchema:`outputSchema`in e?e.outputSchema:void 0}]:[])}function getLastAuthoredToolResult(e){let t=getSkillLoads(e);for(let n of[...e].reverse()){if(n.role===`user`){let e=getPromptContentText(n.content).trim(),t=readTaskResults(e).at(-1);if(t!==void 0){let{body:e,taskId:n,tool:r}=t;return{isError:t.status===`failed`,output:e,toolCallId:n,toolName:r}}if(isFrameworkAnnouncementText(e))continue;return null}if(n.role===`tool`||n.role===`assistant`){for(let e of[...n.content].reverse())if(typeof e!=`string`&&e.type===`tool-result`&&!t.has(e.toolCallId))return{isError:e.output.type===`error-json`||e.output.type===`error-text`||e.output.type===`execution-denied`,output:e.output.type===`execution-denied`?{reason:e.output.reason??null,type:e.output.type}:e.output.value,toolCallId:e.toolCallId,toolName:e.toolName}}}return null}function findNextExplicitToolAfterResult(e){let t=getLastUserPromptText(e.prompt);if(t===null)return null;let n=normalizeText(t),r=n.indexOf(normalizeText(e.previousToolName));return r<0?null:e.tools.filter(t=>t.name!==e.previousToolName).flatMap(e=>{let t=n.indexOf(normalizeText(e.name),r+1);return t<0?[]:[{index:t,tool:e}]}).sort((e,t)=>e.index-t.index)[0]?.tool??null}function createFollowUpToolInput(e){return isRecord(e)&&typeof e.stepKey==`string`?{stepKey:e.stepKey}:null}function getSystemPromptLabels(e){let t=e.filter(e=>e.role===`system`);if(t.length===0)return[];let n=t.flatMap(e=>{let t=getPromptContentText(e.content);if(t.startsWith(`Available skills
2
2
  `))return[];let n=t.split(`
3
- `).map(e=>e.trim()).filter(e=>e.length>0),r=[];for(let e of n){if(e===BOOTSTRAP_RUNTIME_SYSTEM_PROMPT||e===`Available skills`)continue;let t=/^System \((.+)\)$/.exec(e);if(t?.[1]){r.push(t[1]);continue}let n=/^Skill \((.+)\)$/.exec(e);n?.[1]&&r.push(n[1])}if(r.length>0)return r;let i=n.find(e=>e!==BOOTSTRAP_RUNTIME_SYSTEM_PROMPT&&e!==`Available skills`);return i===void 0?[]:[i]});return[...new Set(n)]}function findRelevantTool(e,t){let n=normalizeText(t),r=e.find(e=>e.name!==`agent`&&e.name!==LOAD_SKILL_TOOL_NAME&&n.includes(normalizeText(e.name)));return r===void 0?/\b(forecast|temperature|weather|wind|rain|snow)\b/u.test(n)?e.find(e=>/\b(forecast|temperature|weather|wind|rain|snow)\b/u.test(normalizeText(`${e.name} ${e.description??``}`)))??null:null:r}function normalizeText(e){return e.toLowerCase().replace(/[^a-z0-9]+/gu,` `).trim()}function createToolCallId(e){return`call_${e.toLowerCase().replace(/[^a-z0-9]+/gu,`_`).replace(/^_+|_+$/gu,``)||`tool`}`}function resolveSystemProbe(e){let t=e.filter(e=>e.role===`system`).map(e=>getPromptContentText(e.content)).join(`
3
+ `).map(e=>e.trim()).filter(e=>e.length>0),r=[];for(let e of n){if(e===BOOTSTRAP_RUNTIME_SYSTEM_PROMPT||e===`Available skills`)continue;let t=/^System \((.+)\)$/.exec(e);if(t?.[1]){r.push(t[1]);continue}let n=/^Skill \((.+)\)$/.exec(e);n?.[1]&&r.push(n[1])}if(r.length>0)return r;let i=n.find(e=>e!==BOOTSTRAP_RUNTIME_SYSTEM_PROMPT&&e!==`Available skills`);return i===void 0?[]:[i]});return[...new Set(n)]}function findRelevantTool(e,t){let n=normalizeText(t),r=e.find(e=>e.name!==`agent`&&n.includes(normalizeText(e.name)));return r===void 0?/\b(forecast|temperature|weather|wind|rain|snow)\b/u.test(n)?e.find(e=>/\b(forecast|temperature|weather|wind|rain|snow)\b/u.test(normalizeText(`${e.name} ${e.description??``}`)))??null:null:r}function normalizeText(e){return e.toLowerCase().replace(/[^a-z0-9]+/gu,` `).trim()}function createToolCallId(e){return`call_${e.toLowerCase().replace(/[^a-z0-9]+/gu,`_`).replace(/^_+|_+$/gu,``)||`tool`}`}function resolveSystemProbe(e){let t=e.filter(e=>e.role===`system`).map(e=>getPromptContentText(e.content)).join(`
4
4
  `);return/hmr-probe:\s*([^\n]+)/iu.exec(t)?.[1]?.trim()||null}function isWeatherPayload(e){return z.validate(bootstrapWeatherPayloadSchema,e)}function isRecord(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}const ATTACHMENT_NOTE=/^Attachment\b/u;function listPromptAttachments(e){return e.flatMap(e=>e.role!==`user`||typeof e.content==`string`?[]:e.content.flatMap(e=>{if(typeof e==`string`)return[];if(e.type===`text`)return ATTACHMENT_NOTE.test(e.text)?[{note:e.text.replaceAll(`"`,`'`)}]:[];if(e.type!==`file`)return[];let t=e.filename?.split(`/`).at(-1)??null,n=fileData(e.data);if(n instanceof URL)return[{mediaType:e.mediaType,name:t,url:n.href}];if(n===void 0)return[{mediaType:e.mediaType,name:t}];let r=typeof n==`string`?Buffer.from(n,`base64`):Buffer.from(n);return[{bytes:r.length,mediaType:e.mediaType,name:t,sha256:createHash(`sha256`).update(r).digest(`hex`).slice(0,16)}]}))}function fileData(e){if(typeof e==`string`||e instanceof Uint8Array||e instanceof URL)return e;if(typeof e!=`object`||!e)return;let t=e;if(t.type===`url`&&t.url instanceof URL)return t.url;if(t.type===`data`)return fileData(t.data)}export{createMockAuthoredRuntimeModel,resolveMockAuthoredRuntimeModel,shouldMockAuthoredRuntimeModels};
@@ -1,3 +1,3 @@
1
- import{LOAD_SKILL_TOOL_NAME}from"#runtime/skills/fragment-context.js";import{TASK_ID_INPUT}from"#execution/tasks/task-id-input.js";import{getPromptContentText,isFrameworkAnnouncementText}from"#runtime/agent/bootstrap-model-utils.js";import{createJsonSchemaSample}from"#runtime/agent/mock-structured-output.js";function createMockAuthoredToolInput(e,t,n){let r={...e,inputSchema:withoutTaskIdInput(e.inputSchema)},i=getToolInputPropertyNames(r.inputSchema);if(i.includes(`question`))return createQuestionInput(t);if(i.includes(`command`))return{command:resolveShellCommand(t)};if(i.includes(`topic`)||!hasDeclaredInputProperties(r.inputSchema)&&/\btopic\b/u.test(normalizeText(t)))return{topic:resolveLookupTopic(t)};let a=extractAnchoredInputs(i,t);if(Object.keys(a).length>0)return a;if(i.length===1&&i[0]===`message`)return{message:t};if(i.includes(`city`)||!hasDeclaredInputProperties(r.inputSchema))return{city:n};let o=createJsonSchemaSample(r.inputSchema);return isRecord(o)?o:{}}function withoutTaskIdInput(e){if(!isRecord(e)||!isRecord(e.properties))return e;let{[TASK_ID_INPUT]:t,...n}=e.properties;return{...e,properties:n}}function extractAnchoredInputs(e,t){let n={};for(let r of e){let e=RegExp(`\\b${escapeRegExp(r)}\\b\\s*(?:to|=|:)?\\s*(?:\`([^\`]+)\`|"([^"]+)"|'([^']+)')`,`iu`).exec(t),i=e?.[1]??e?.[2]??e?.[3];i!==void 0&&(n[r]=i.trim())}return n}function escapeRegExp(e){return e.replace(/[$()*+.?[\\\]^{|}]/gu,String.raw`\$&`)}function resolveMockFixtureToken(e){let t=e.filter(e=>e.role===`system`).map(e=>getPromptContentText(e.content)).join(`
1
+ import{TASK_ID_INPUT}from"#execution/tasks/task-id-input.js";import{getPromptContentText,isFrameworkAnnouncementText}from"#runtime/agent/bootstrap-model-utils.js";import{getSkillLoads}from"#runtime/agent/mock-model-skill-selection.js";import{createJsonSchemaSample}from"#runtime/agent/mock-structured-output.js";function createMockAuthoredToolInput(e,t,n){let r={...e,inputSchema:withoutTaskIdInput(e.inputSchema)},i=getToolInputPropertyNames(r.inputSchema);if(i.includes(`question`))return createQuestionInput(t);if(i.includes(`command`))return{command:resolveShellCommand(t)};if(i.includes(`topic`)||!hasDeclaredInputProperties(r.inputSchema)&&/\btopic\b/u.test(normalizeText(t)))return{topic:resolveLookupTopic(t)};let a=extractAnchoredInputs(i,t);if(Object.keys(a).length>0)return a;if(i.length===1&&i[0]===`message`)return{message:t};if(i.includes(`city`)||!hasDeclaredInputProperties(r.inputSchema))return{city:n};let o=createJsonSchemaSample(r.inputSchema);return isRecord(o)?o:{}}function withoutTaskIdInput(e){if(!isRecord(e)||!isRecord(e.properties))return e;let{[TASK_ID_INPUT]:t,...n}=e.properties;return{...e,properties:n}}function extractAnchoredInputs(e,t){let n={};for(let r of e){let e=RegExp(`\\b${escapeRegExp(r)}\\b\\s*(?:to|=|:)?\\s*(?:\`([^\`]+)\`|"([^"]+)"|'([^']+)')`,`iu`).exec(t),i=e?.[1]??e?.[2]??e?.[3];i!==void 0&&(n[r]=i.trim())}return n}function escapeRegExp(e){return e.replace(/[$()*+.?[\\\]^{|}]/gu,String.raw`\$&`)}function resolveMockFixtureToken(e){let t=e.filter(e=>e.role===`system`).map(e=>getPromptContentText(e.content)).join(`
2
2
  `),n=[...getLoadedSkillResultTexts(e),t,getTrailingUserText(e)];for(let e of n){let t=resolveExactFixtureReply(e);if(t!==null)return t}return null}function resolveWeatherCity(e){let t=/"city"\s*:\s*"([^"]+)"/u.exec(e);return t?.[1]?t[1].trim():(/\b(?:in|for)\s+([A-Za-z][A-Za-z\s.-]*?)(?:[?.!,]|$)/u.exec(e)??/\b([A-Z][a-z]+(?:\s+[A-Z][a-z]+)*)\b/u.exec(e))?.[1]?.trim()||`Brooklyn`}function formatToolOutput(e){if(typeof e==`string`)return e;try{return JSON.stringify(e)}catch{return String(e)}}function getTrailingUserText(e){let t=[];for(let n of[...e].reverse()){if(n.role===`system`)continue;if(n.role!==`user`)break;let e=getPromptContentText(n.content);isFrameworkAnnouncementText(e.trim())||t.unshift(e)}return t.join(`
3
- `)}function getLoadedSkillResultTexts(e){return e.flatMap(e=>e.role!==`tool`&&e.role!==`assistant`?[]:(typeof e.content==`string`?[e.content]:e.content).flatMap(e=>typeof e==`string`||e.type!==`tool-result`||e.toolName!==LOAD_SKILL_TOOL_NAME||e.output.type===`execution-denied`?[]:[formatToolOutput(e.output.value)]))}function resolveExactFixtureReply(e){let t=matchExactValue(/\breply\s+with\s+the\s+exact\s+string\s+(`([^`]+)`|"([^"]+)"|'([^']+)'|([^\s.]+))\s+and\s+nothing\s+else\b/iu,e);if(t!==null)return t;let n=e.split(/\r?\n/u);for(let e=0;e<n.length;e+=1){let t=n[e]?.trim()??``,r=/\breply\s+with\s+exactly(?:\s+the\s+following\s+text\s+and\s+nothing\s+else)?:\s*(.+)$/iu.exec(t);if(r?.[1])return cleanExactValue(r[1]);if(/\breply\s+with\s+exactly\s+the\s+following\s+text\s+and\s+nothing\s+else:\s*$/iu.test(t)||/\breply\s+with\s+exactly:\s*$/iu.test(t)){let t=n.slice(e+1).map(e=>e.trim()).find(e=>e.length>0);if(t!==void 0)return cleanExactValue(t)}}return matchExactValue(/\binclude\s+the\s+exact\s+token\s+(`([^`]+)`|"([^"]+)"|'([^']+)'|([^\s.]+))\s+verbatim\b/iu,e)}function matchExactValue(e,t){let n=e.exec(t);return n===null?null:cleanExactValue(n[2]??n[3]??n[4]??n[5]??n[1]??``)}function cleanExactValue(e){return e.trim()}function getToolInputPropertyNames(e){return!isRecord(e)||!isRecord(e.properties)?[]:Object.keys(e.properties)}function hasDeclaredInputProperties(e){return isRecord(e)&&isRecord(e.properties)}function createQuestionInput(e){let t=parseOptionLabels(e);return{question:resolveQuestionPrompt(e),...t.length>=2&&{options:t.map(e=>({description:`Choose ${e}.`,label:e}))}}}function parseOptionLabels(e){return[...e.matchAll(/\blabel\b\s*:?\s*"([^"]+)"/giu)].map(e=>e[1]??``)}function resolveQuestionPrompt(e){let t=/\b(?:set\s+)?question\s+to:\s*'([^']+)'/iu.exec(e)??/\b(?:set\s+)?question\s+to:\s*"([^"]+)"/iu.exec(e);return t?.[1]?t[1].trim():/\bask(?:\s+me)?\s+(?:to\s+)?(.+?)(?:\.|$)/iu.exec(e)?.[1]?.trim()||`Please choose an option.`}function resolveShellCommand(e){let t=/`([^`]+)`/u.exec(e);return t?.[1]?t[1].trim():(/\b(?:run|command)\s+["']([^"']+)["']/iu.exec(e)??/\bcommand\s+(.+?)(?:\.|$)/iu.exec(e))?.[1]?.trim()||`pwd`}function resolveLookupTopic(e){return/\btopic\s+['"]?([A-Za-z0-9_.-]+)['"]?/u.exec(e)?.[1]??`demo`}function normalizeText(e){return e.toLowerCase().replace(/[^a-z0-9]+/gu,` `).trim()}function isRecord(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}export{createMockAuthoredToolInput,formatToolOutput,resolveMockFixtureToken,resolveWeatherCity};
3
+ `)}function getLoadedSkillResultTexts(e){let t=getSkillLoads(e);return e.flatMap(e=>e.role!==`tool`&&e.role!==`assistant`?[]:(typeof e.content==`string`?[e.content]:e.content).flatMap(e=>typeof e==`string`||e.type!==`tool-result`||!t.has(e.toolCallId)||e.output.type===`execution-denied`?[]:[formatToolOutput(e.output.value)]))}function resolveExactFixtureReply(e){let t=matchExactValue(/\breply\s+with\s+the\s+exact\s+string\s+(`([^`]+)`|"([^"]+)"|'([^']+)'|([^\s.]+))\s+and\s+nothing\s+else\b/iu,e);if(t!==null)return t;let n=e.split(/\r?\n/u);for(let e=0;e<n.length;e+=1){let t=n[e]?.trim()??``,r=/\breply\s+with\s+exactly(?:\s+the\s+following\s+text\s+and\s+nothing\s+else)?:\s*(.+)$/iu.exec(t);if(r?.[1])return cleanExactValue(r[1]);if(/\breply\s+with\s+exactly\s+the\s+following\s+text\s+and\s+nothing\s+else:\s*$/iu.test(t)||/\breply\s+with\s+exactly:\s*$/iu.test(t)){let t=n.slice(e+1).map(e=>e.trim()).find(e=>e.length>0);if(t!==void 0)return cleanExactValue(t)}}return matchExactValue(/\binclude\s+the\s+exact\s+token\s+(`([^`]+)`|"([^"]+)"|'([^']+)'|([^\s.]+))\s+verbatim\b/iu,e)}function matchExactValue(e,t){let n=e.exec(t);return n===null?null:cleanExactValue(n[2]??n[3]??n[4]??n[5]??n[1]??``)}function cleanExactValue(e){return e.trim()}function getToolInputPropertyNames(e){return!isRecord(e)||!isRecord(e.properties)?[]:Object.keys(e.properties)}function hasDeclaredInputProperties(e){return isRecord(e)&&isRecord(e.properties)}function createQuestionInput(e){let t=parseOptionLabels(e);return{question:resolveQuestionPrompt(e),...t.length>=2&&{options:t.map(e=>({description:`Choose ${e}.`,label:e}))}}}function parseOptionLabels(e){return[...e.matchAll(/\blabel\b\s*:?\s*"([^"]+)"/giu)].map(e=>e[1]??``)}function resolveQuestionPrompt(e){let t=/\b(?:set\s+)?question\s+to:\s*'([^']+)'/iu.exec(e)??/\b(?:set\s+)?question\s+to:\s*"([^"]+)"/iu.exec(e);return t?.[1]?t[1].trim():/\bask(?:\s+me)?\s+(?:to\s+)?(.+?)(?:\.|$)/iu.exec(e)?.[1]?.trim()||`Please choose an option.`}function resolveShellCommand(e){let t=/`([^`]+)`/u.exec(e);return t?.[1]?t[1].trim():(/\b(?:run|command)\s+["']([^"']+)["']/iu.exec(e)??/\bcommand\s+(.+?)(?:\.|$)/iu.exec(e))?.[1]?.trim()||`pwd`}function resolveLookupTopic(e){return/\btopic\s+['"]?([A-Za-z0-9_.-]+)['"]?/u.exec(e)?.[1]??`demo`}function normalizeText(e){return e.toLowerCase().replace(/[^a-z0-9]+/gu,` `).trim()}function isRecord(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}export{createMockAuthoredToolInput,formatToolOutput,resolveMockFixtureToken,resolveWeatherCity};
@@ -6,4 +6,6 @@ interface AvailableBootstrapSkill {
6
6
  export declare function getAvailableSkills(prompt: BootstrapPrompt): AvailableBootstrapSkill[];
7
7
  export declare function findRelevantSkill(skills: readonly AvailableBootstrapSkill[], message: string): AvailableBootstrapSkill | null;
8
8
  export declare function getActivatedSkillIds(prompt: BootstrapPrompt): string[];
9
+ /** Skill loads in the history: each `eve__skill({ name })` call's id and skill. */
10
+ export declare function getSkillLoads(prompt: BootstrapPrompt): ReadonlyMap<string, string>;
9
11
  export {};
@@ -1,3 +1,3 @@
1
- import{getPromptContentText}from"#runtime/agent/bootstrap-model-utils.js";function getAvailableSkills(e){let t=new Map;for(let n of e){if(n.role!==`system`)continue;let e=getPromptContentText(n.content).split(`
1
+ import{SKILL_TOOL_NAME}from"#protocol/catalog-tools.js";import{getPromptContentText}from"#runtime/agent/bootstrap-model-utils.js";function getAvailableSkills(e){let t=new Map;for(let n of e){if(n.role!==`system`&&n.role!==`user`)continue;let e=getPromptContentText(n.content).split(`
2
2
  `),r=e.findIndex(e=>e.trim()===`Available skills`);if(!(r<0))for(let n of e.slice(r+1)){if(n.trim().length===0)break;let e=parseAvailableSkill(n);e!==null&&t.set(e.name,e)}}return[...t.values()]}function findRelevantSkill(e,t){let n=normalizeText(t);for(let t of e)if(n.includes(normalizeText(t.name)))return t;return/\b(forecast|temperature|weather|wind|rain|snow)\b/u.test(n)?e.find(e=>/\b(forecast|temperature|weather|wind|rain|snow)\b/u.test(normalizeText(`${e.name} ${e.description}`)))??null:null}function getActivatedSkillIds(e){return[...e.filter(e=>e.role===`system`).flatMap(e=>getPromptContentText(e.content).split(`
3
- `).map(e=>e.trim()).flatMap(e=>{let t=/^Skill \((.+)\)$/.exec(e);return t?.[1]===void 0?[]:[t[1]]})),...getLoadedSkillIdsFromHistory(e)]}function getLoadedSkillIdsFromHistory(e){let t=[];for(let n of e)if(n.role===`assistant`&&typeof n.content!=`string`)for(let e of n.content){if(typeof e==`string`||e.type!==`tool-call`||e.toolName!==`load_skill`)continue;let n=readSkillFromToolInput(e.input);n!==void 0&&t.push(n)}return t}function readSkillFromToolInput(e){let t=typeof e==`string`?safeJsonParse(e):e;if(typeof t==`object`&&t&&`skill`in t&&typeof t.skill==`string`)return t.skill}function safeJsonParse(e){try{return JSON.parse(e)}catch{return}}function parseAvailableSkill(e){let t=/^- (.+?): (.+?)(?: \(path: (.+)\))?$/.exec(e.trim());return t?.[1]&&t[2]?{description:t[2],name:t[1]}:null}function normalizeText(e){return e.toLowerCase().replace(/[^a-z0-9]+/gu,` `).trim()}export{findRelevantSkill,getActivatedSkillIds,getAvailableSkills};
3
+ `).map(e=>e.trim()).flatMap(e=>{let t=/^Skill \((.+)\)$/.exec(e);return t?.[1]===void 0?[]:[t[1]]})),...getSkillLoads(e).values()]}function getSkillLoads(e){let t=new Map;for(let n of e)if(n.role===`assistant`&&typeof n.content!=`string`)for(let e of n.content){if(typeof e==`string`||e.type!==`tool-call`||e.toolName!==SKILL_TOOL_NAME)continue;let n=readSkillFromToolInput(e.input);n!==void 0&&t.set(e.toolCallId,n)}return t}function readSkillFromToolInput(e){let t=typeof e==`string`?safeJsonParse(e):e;if(typeof t==`object`&&t&&`name`in t&&typeof t.name==`string`)return t.name}function safeJsonParse(e){try{return JSON.parse(e)}catch{return}}function parseAvailableSkill(e){let t=/^- (.+?): (.+?)(?: \(path: (.+)\))?$/.exec(e.trim());return t?.[1]&&t[2]?{description:t[2],name:t[1]}:null}function normalizeText(e){return e.toLowerCase().replace(/[^a-z0-9]+/gu,` `).trim()}export{findRelevantSkill,getActivatedSkillIds,getAvailableSkills,getSkillLoads};
@@ -1,5 +1,5 @@
1
1
  /**
2
2
  * Builds a deterministic sample value satisfying a JSON Schema, used by the
3
- * mock model to populate a `final_output` tool call in tests.
3
+ * mock model to populate an `eve__reply` tool call in tests.
4
4
  */
5
5
  export declare function createJsonSchemaSample(schema: unknown): unknown;
@@ -1 +1 @@
1
- import{isObject}from"#shared/guards.js";import{buildCallbackContext}from"#context/build-callback-context.js";import{ConnectionAuthorizationRequiredError,isConnectionAuthorizationRequiredError}from"#connections/errors.js";import{evictScopedToken,resolveScopedToken}from"#runtime/connections/scoped-authorization.js";import{resolveConnectionAuthorization}from"#runtime/connections/resolve-authorization.js";import{FORWARDED_PRINCIPAL_HEADER,encodeForwardedPrincipalHeader}from"#internal/mcp/forwarded-principal-header.js";import{createMCPClient}from"#compiled/@ai-sdk/mcp/index.js";import{readTurnPrincipals}from"#context/turn-principals.js";import{omitProvidedArgumentsFromSchema,resolveProvidedArguments}from"#runtime/connections/provided-arguments.js";import{createMcpTraceFetch,withMcpToolCallSpan,withMcpToolsListSpan}from"#runtime/connections/mcp-tracing.js";var McpConnectionClient=class{#e;#t;#n;#r;#i;#a=!1;constructor(e){this.#i=e}async connect(){if(this.#t!==void 0)return this.#t;if(this.#e!==void 0)return this.#e;this.#e=this.#o();try{return this.#t=await this.#e,this.#t}catch(e){throw this.#e=void 0,e}}async#o(){let{anonymous:e,headers:t}=await resolveConnectionHeaders(this.#i,{anonymousWhenAuthorizationRequired:!0});this.#a=e;let n=this.#i.url,r=createMcpTraceFetch({connectionName:this.#i.connectionName,fetcher:this.#s(),getProtocolVersion:()=>this.#t?.initializeResult?.protocolVersion});try{return await createMCPClient({protocolVersionDiscovery:this.#i.protocolVersionDiscovery,transport:{fetch:r,headers:t,type:`http`,url:n}})}catch(e){if(!isMcpHttpFallbackRetryableError(e))throw e;return await createMCPClient({protocolVersionDiscovery:this.#i.protocolVersionDiscovery,transport:{fetch:r,headers:t,type:`sse`,url:n}})}}#s(){if(this.#i.forwardPrincipal!==!0)return;let e=this.#i.connectionName;return async(t,n)=>{let r=readTurnPrincipals();if(r===void 0)return await globalThis.fetch(t,n);let i=new Headers(n?.headers);return i.set(FORWARDED_PRINCIPAL_HEADER,encodeForwardedPrincipalHeader(r,e)),await globalThis.fetch(t,{...n,headers:i,redirect:`error`})}}async getToolMetadata(){return(await this.#c()).metadata}async executeTool(e,t,n){let r;try{let{tools:i}=await this.#c(),a=i[e];if(a?.execute===void 0)throw Error(`Tool "${e}" not found in connection "${this.#i.connectionName}".`);let o=a.execute,s=await resolveProvidedArguments({args:t,callId:n.callId,connection:this.#i,toolName:e});r=await withMcpToolCallSpan({arguments:t,connectionName:this.#i.connectionName,execute:async()=>await o(s,{abortSignal:n.abortSignal}),protocolVersion:this.#t?.initializeResult?.protocolVersion,toolName:e})}catch(e){return await this.#d(e)}return isMcpAuthChallengeResult(r)?await this.#f(`the server asked for sign-in to call "${e}"`):r}async#c(){if(this.#r!==void 0)return this.#r;if(this.#n!==void 0)return this.#n;this.#n=this.#l();try{return this.#r=await this.#n,this.#r}catch(e){throw this.#n=void 0,e}}async#l(){try{return await this.#u()}catch(e){return await this.#d(e)}}async#u(){let e=await this.connect(),t=await withMcpToolsListSpan({connectionName:this.#i.connectionName,execute:()=>e.listTools(),protocolVersion:e.initializeResult?.protocolVersion}),n=this.#i.tools,r=n===void 0?t.tools:t.tools.filter(e=>passesToolFilter(e.name,n)),i=Object.keys(this.#i.toolCall?.providedArguments??{}),a=r.map(e=>({...e,inputSchema:omitProvidedArgumentsFromSchema(e.inputSchema,i)})),o=e.toolsFromDefinitions({tools:a});return{metadata:a.map(e=>({annotations:e.annotations,description:e.description??``,inputSchema:e.inputSchema??{},name:e.name,outputSchema:`outputSchema`in e&&e.outputSchema!==void 0?e.outputSchema:void 0})),tools:o}}async close(){this.#t!==void 0&&(await this.#t.close(),this.#t=void 0),this.#e=void 0,this.#n=void 0,this.#r=void 0,this.#a=!1}async#d(e){if(!isMcpAuthRequiredError(e))throw e;return await this.#f(this.#a?`the server requires sign-in`:`the server rejected the token`)}async#f(e){throw this.#a||await this.#p(),await this.close(),new ConnectionAuthorizationRequiredError(this.#i.connectionName,{message:`Connection "${this.#i.connectionName}" requires authorization (${e}).`})}async#p(){let e=await resolveConnectionAuthorization(this.#i);e!==void 0&&await evictScopedToken({authorization:e,connection:{url:this.#i.url},instanceId:this.#i.instanceId,scope:this.#i.connectionName})}};function isMcpAuthRequiredError(e){return readHttpStatus(e)===401}const MCP_WWW_AUTHENTICATE_META_KEY=`mcp/www_authenticate`;function isMcpAuthChallengeResult(e){if(!isObject(e)||e.isError!==!0||!isObject(e._meta))return!1;let t=e._meta[MCP_WWW_AUTHENTICATE_META_KEY];return(typeof t==`string`||Array.isArray(t))&&t.length>0}function isMcpHttpFallbackRetryableError(e){let t=readHttpStatus(e);return t===400||t===404||t===405}function readHttpStatus(e){for(let t of walkErrorChain(e)){if(!isObject(t))continue;let e=readStatusField(t);if(e!==void 0)return e;let n=t.response;if(isObject(n)){let e=readStatusField(n);if(e!==void 0)return e}if(typeof t.message==`string`){let e=/\bHTTP\s+(\d{3})\b/u.exec(t.message);if(e?.[1]!==void 0)return Number(e[1])}}}function readStatusField(e){if(typeof e.status==`number`)return e.status;if(typeof e.statusCode==`number`)return e.statusCode}function*walkErrorChain(e){let t=e,n=new Set;for(;t!=null&&!n.has(t);){if(n.add(t),yield t,!isObject(t)||!(`cause`in t))return;t=t.cause}}function passesToolFilter(e,t){return t===void 0?!0:`allow`in t?t.allow.includes(e):!t.block.includes(e)}async function resolveHeaders(e){let{headers:t}=await resolveConnectionHeaders(e,{anonymousWhenAuthorizationRequired:!1});return t}async function resolveConnectionHeaders(e,t){let n={},r=!1,i,getCallbackContext=()=>i??=buildCallbackContext(),a=await resolveConnectionAuthorization(e,typeof e.authorization==`function`?getCallbackContext():void 0);if(a!==void 0)try{n.Authorization=`Bearer ${(await resolveToken(e,a)).token}`}catch(e){if(!t.anonymousWhenAuthorizationRequired||!isConnectionAuthorizationRequiredError(e))throw e;r=!0}if(e.headers!==void 0){let t=await resolveHeadersDefinition(e.headers,getCallbackContext);for(let[r,i]of Object.entries(t)){if(a!==void 0&&r.toLowerCase()===`authorization`)throw Error(`Connection "${e.connectionName}" headers must not include an "Authorization" key when "authorization" is also provided.`);n[r]=i}}return{anonymous:r,headers:n}}async function resolveToken(e,t){return await resolveScopedToken({authorization:t,connection:{url:e.url},instanceId:e.instanceId,scope:e.connectionName})}async function resolveHeadersDefinition(e,t){if(typeof e==`function`)return{...await e(t())};let n={},r=Object.entries(e);for(let[e,i]of r)n[e]=await resolveHeaderValue(i,t);return n}async function resolveHeaderValue(e,t){return typeof e==`function`?await e(t()):await e}export{MCP_WWW_AUTHENTICATE_META_KEY,McpConnectionClient,isMcpAuthChallengeResult,isMcpAuthRequiredError,passesToolFilter,resolveHeaders};
1
+ import{isObject}from"#shared/guards.js";import{buildCallbackContext}from"#context/build-callback-context.js";import{ConnectionAuthorizationRequiredError,isConnectionAuthorizationRequiredError}from"#connections/errors.js";import{resolveConnectionAuthorization}from"#runtime/connections/resolve-authorization.js";import{evictScopedToken,resolveScopedToken}from"#runtime/connections/scoped-authorization.js";import{FORWARDED_PRINCIPAL_HEADER,encodeForwardedPrincipalHeader}from"#internal/mcp/forwarded-principal-header.js";import{createMCPClient}from"#compiled/@ai-sdk/mcp/index.js";import{readTurnPrincipals}from"#context/turn-principals.js";import{omitProvidedArgumentsFromSchema,resolveProvidedArguments}from"#runtime/connections/provided-arguments.js";import{createMcpTraceFetch,withMcpToolCallSpan,withMcpToolsListSpan}from"#runtime/connections/mcp-tracing.js";var McpConnectionClient=class{#e;#t;#n;#r;#i;#a=!1;constructor(e){this.#i=e}async connect(){if(this.#t!==void 0)return this.#t;if(this.#e!==void 0)return this.#e;this.#e=this.#o();try{return this.#t=await this.#e,this.#t}catch(e){throw this.#e=void 0,e}}async#o(){let{anonymous:e,headers:t}=await resolveConnectionHeaders(this.#i,{anonymousWhenAuthorizationRequired:!0});this.#a=e;let n=this.#i.url,r=createMcpTraceFetch({connectionName:this.#i.connectionName,fetcher:this.#s(),getProtocolVersion:()=>this.#t?.initializeResult?.protocolVersion});try{return await createMCPClient({protocolVersionDiscovery:this.#i.protocolVersionDiscovery,transport:{fetch:r,headers:t,type:`http`,url:n}})}catch(e){if(!isMcpHttpFallbackRetryableError(e))throw e;return await createMCPClient({protocolVersionDiscovery:this.#i.protocolVersionDiscovery,transport:{fetch:r,headers:t,type:`sse`,url:n}})}}#s(){if(this.#i.forwardPrincipal!==!0)return;let e=this.#i.connectionName;return async(t,n)=>{let r=readTurnPrincipals();if(r===void 0)return await globalThis.fetch(t,n);let i=new Headers(n?.headers);return i.set(FORWARDED_PRINCIPAL_HEADER,encodeForwardedPrincipalHeader(r,e)),await globalThis.fetch(t,{...n,headers:i,redirect:`error`})}}async getToolMetadata(){return(await this.#c()).metadata}async executeTool(e,t,n){let r;try{let{tools:i}=await this.#c(),a=i[e];if(a?.execute===void 0)throw Error(`Tool "${e}" not found in connection "${this.#i.connectionName}".`);let o=a.execute,s=await resolveProvidedArguments({args:t,callId:n.callId,connection:this.#i,toolName:e});r=await withMcpToolCallSpan({arguments:t,connectionName:this.#i.connectionName,execute:async()=>await o(s,{abortSignal:n.abortSignal}),protocolVersion:this.#t?.initializeResult?.protocolVersion,toolName:e})}catch(e){return await this.#d(e)}return isMcpAuthChallengeResult(r)?await this.#f(`the server asked for sign-in to call "${e}"`):r}async#c(){if(this.#r!==void 0)return this.#r;if(this.#n!==void 0)return this.#n;this.#n=this.#l();try{return this.#r=await this.#n,this.#r}catch(e){throw this.#n=void 0,e}}async#l(){try{return await this.#u()}catch(e){return await this.#d(e)}}async#u(){let e=await this.connect(),t=await withMcpToolsListSpan({connectionName:this.#i.connectionName,execute:()=>e.listTools(),protocolVersion:e.initializeResult?.protocolVersion}),n=this.#i.tools,r=n===void 0?t.tools:t.tools.filter(e=>passesToolFilter(e.name,n)),i=Object.keys(this.#i.toolCall?.providedArguments??{}),a=r.map(e=>({...e,inputSchema:omitProvidedArgumentsFromSchema(e.inputSchema,i)})),o=e.toolsFromDefinitions({tools:a});return{metadata:a.map(e=>({annotations:e.annotations,description:e.description??``,inputSchema:e.inputSchema??{},name:e.name,outputSchema:`outputSchema`in e&&e.outputSchema!==void 0?e.outputSchema:void 0})),tools:o}}async close(){this.#t!==void 0&&(await this.#t.close(),this.#t=void 0),this.#e=void 0,this.#n=void 0,this.#r=void 0,this.#a=!1}async#d(e){if(!isMcpAuthRequiredError(e))throw e;return await this.#f(this.#a?`the server requires sign-in`:`the server rejected the token`)}async#f(e){throw this.#a||await this.#p(),await this.close(),new ConnectionAuthorizationRequiredError(this.#i.connectionName,{message:`Connection "${this.#i.connectionName}" requires authorization (${e}).`})}async#p(){let e=await resolveConnectionAuthorization(this.#i);e!==void 0&&await evictScopedToken({authorization:e,connection:{url:this.#i.url},instanceId:this.#i.instanceId,scope:this.#i.connectionName})}};function isMcpAuthRequiredError(e){return readHttpStatus(e)===401}const MCP_WWW_AUTHENTICATE_META_KEY=`mcp/www_authenticate`;function isMcpAuthChallengeResult(e){if(!isObject(e)||e.isError!==!0||!isObject(e._meta))return!1;let t=e._meta[MCP_WWW_AUTHENTICATE_META_KEY];return(typeof t==`string`||Array.isArray(t))&&t.length>0}function isMcpHttpFallbackRetryableError(e){let t=readHttpStatus(e);return t===400||t===404||t===405}function readHttpStatus(e){for(let t of walkErrorChain(e)){if(!isObject(t))continue;let e=readStatusField(t);if(e!==void 0)return e;let n=t.response;if(isObject(n)){let e=readStatusField(n);if(e!==void 0)return e}if(typeof t.message==`string`){let e=/\bHTTP\s+(\d{3})\b/u.exec(t.message);if(e?.[1]!==void 0)return Number(e[1])}}}function readStatusField(e){if(typeof e.status==`number`)return e.status;if(typeof e.statusCode==`number`)return e.statusCode}function*walkErrorChain(e){let t=e,n=new Set;for(;t!=null&&!n.has(t);){if(n.add(t),yield t,!isObject(t)||!(`cause`in t))return;t=t.cause}}function passesToolFilter(e,t){return t===void 0?!0:`allow`in t?t.allow.includes(e):!t.block.includes(e)}async function resolveHeaders(e){let{headers:t}=await resolveConnectionHeaders(e,{anonymousWhenAuthorizationRequired:!1});return t}async function resolveConnectionHeaders(e,t){let n={},r=!1,i,getCallbackContext=()=>i??=buildCallbackContext(),a=await resolveConnectionAuthorization(e,typeof e.authorization==`function`?getCallbackContext():void 0);if(a!==void 0)try{n.Authorization=`Bearer ${(await resolveToken(e,a)).token}`}catch(e){if(!t.anonymousWhenAuthorizationRequired||!isConnectionAuthorizationRequiredError(e))throw e;r=!0}if(e.headers!==void 0){let t=await resolveHeadersDefinition(e.headers,getCallbackContext);for(let[r,i]of Object.entries(t)){if(a!==void 0&&r.toLowerCase()===`authorization`)throw Error(`Connection "${e.connectionName}" headers must not include an "Authorization" key when "authorization" is also provided.`);n[r]=i}}return{anonymous:r,headers:n}}async function resolveToken(e,t){return await resolveScopedToken({authorization:t,connection:{url:e.url},instanceId:e.instanceId,scope:e.connectionName})}async function resolveHeadersDefinition(e,t){if(typeof e==`function`)return{...await e(t())};let n={},r=Object.entries(e);for(let[e,i]of r)n[e]=await resolveHeaderValue(i,t);return n}async function resolveHeaderValue(e,t){return typeof e==`function`?await e(t()):await e}export{MCP_WWW_AUTHENTICATE_META_KEY,McpConnectionClient,isMcpAuthChallengeResult,isMcpAuthRequiredError,passesToolFilter,resolveHeaders};
@@ -1 +1 @@
1
- import{McpConnectionClient}from"#runtime/connections/mcp-client.js";import{OpenApiConnectionClient}from"#runtime/connections/openapi-client.js";var ConnectionRegistryImpl=class{#e=new Map;#t;#n;#r=new Map;#i=new Map;constructor(e){this.#n=e,this.#t=e}async replaceDynamicConnections(e,t){let n=e===`session`?new Map(t):this.#r,r=e===`turn`?new Map(t):this.#i,i=this.#a(n,r),a=new Map(this.#t.map(e=>[e.connectionName,e])),o=new Map(i.map(e=>[e.connectionName,e])),s=[];for(let[e,t]of this.#e)a.get(e)!==o.get(e)&&(this.#e.delete(e),s.push(t));this.#r=n,this.#i=r,this.#t=i,await Promise.allSettled(s.map(e=>e.close()))}#a(e,t){let n=new Map(e);for(let[e,r]of t)n.set(e,r);let r=new Map,i=new Map(this.#n.map(e=>[e.connectionName,e]));for(let[e,t]of n)for(let n of t){let t=r.get(n.connectionName);if(t!==void 0&&t!==e)throw Error(`Dynamic connection "${n.connectionName}" from resolver "${e}" collides with dynamic resolver "${t}". Namespace the map key manually.`);r.set(n.connectionName,e),i.set(n.connectionName,n)}return[...i.values()]}getClient(e){let t=this.#e.get(e);if(t!==void 0)return t;let n=this.#t.find(t=>t.connectionName===e);if(n===void 0)throw Error(`Connection "${e}" is not registered.`);let r=n.protocol===`openapi`?new OpenApiConnectionClient(n):new McpConnectionClient(n);return this.#e.set(e,r),r}getConnectionApproval(e){return this.#t.find(t=>t.connectionName===e)?.approval}getConnectionNames(){return this.#t.map(e=>e.connectionName)}getConnections(){return this.#t}async dispose(){let e=[...this.#e.values()].map(e=>e.close());await Promise.allSettled(e),this.#e.clear()}};export{ConnectionRegistryImpl};
1
+ import{assertNotConnectionOwned}from"#connections/ownership.js";import{McpConnectionClient}from"#runtime/connections/mcp-client.js";import{OpenApiConnectionClient}from"#runtime/connections/openapi-client.js";var ConnectionRegistryImpl=class{#e=new Map;#t;#n;#r=new Map;#i=new Map;constructor(e){this.#n=e,this.#t=e}async replaceDynamicConnections(e,t){let n=e===`session`?new Map(t):this.#r,r=e===`turn`?new Map(t):this.#i,i=this.#a(n,r),a=new Map(this.#t.map(e=>[e.connectionName,e])),o=new Map(i.map(e=>[e.connectionName,e])),s=[];for(let[e,t]of this.#e)a.get(e)!==o.get(e)&&(this.#e.delete(e),s.push(t));this.#r=n,this.#i=r,this.#t=i,await Promise.allSettled(s.map(e=>e.close()))}#a(e,t){let n=new Map(e);for(let[e,r]of t)n.set(e,r);let r=new Map,i=new Map(this.#n.map(e=>[e.connectionName,e]));for(let[e,t]of n)for(let n of t){let t=r.get(n.connectionName);if(t!==void 0&&t!==e)throw Error(`Dynamic connection "${n.connectionName}" from resolver "${e}" collides with dynamic resolver "${t}". Namespace the map key manually.`);r.set(n.connectionName,e),i.set(n.connectionName,n)}for(let e of r.keys())assertNoNestedConnection(e,i.keys());return[...i.values()]}getClient(e){let t=this.#e.get(e);if(t!==void 0)return t;let n=this.#t.find(t=>t.connectionName===e);if(n===void 0)throw Error(`Connection "${e}" is not registered.`);let r=n.protocol===`openapi`?new OpenApiConnectionClient(n):new McpConnectionClient(n);return this.#e.set(e,r),r}getConnectionApproval(e){return this.#t.find(t=>t.connectionName===e)?.approval}getConnectionNames(){return this.#t.map(e=>e.connectionName)}getConnections(){return this.#t}async dispose(){let e=[...this.#e.values()].map(e=>e.close());await Promise.allSettled(e),this.#e.clear()}};function assertNoNestedConnection(e,t){for(let n of t){if(n===e)continue;let[t,r]=n.length<e.length?[e,n]:[n,e];assertNotConnectionOwned({connectionNames:[r],name:t,remedy:`Rename the dynamic connection "${e}".`,subject:`Connection`})}}export{ConnectionRegistryImpl};
@@ -1 +1 @@
1
- import{contextStorage,loadContext}from"#context/container.js";import{AuthKey}from"#context/keys.js";import{ConnectionAuthorizationFailedError,ConnectionAuthorizationRequiredError,isConnectionAuthorizationRequiredError}from"#connections/errors.js";import{consumeAuthorizationResult,createAuthorizationAttempt,requestAuthorization}from"#harness/authorization.js";import{isAsyncIterable}from"#shared/async-iterable.js";import{supportsInteractiveAuthorization}from"#shared/connection-types.js";import{evictCachedToken,readCachedToken,writeCachedToken}from"#runtime/connections/authorization-tokens.js";import{principalKey,resolveConnectionPrincipal,resolveConnectionPrincipalFromAuth}from"#runtime/connections/principal.js";const LOCAL_HTTP_VERCEL_CONNECT_HOSTNAMES=new Set([`127.0.0.1`,`[::1]`]);function createAuthorizationExecution(e={}){let t=new Set;async function complete(n){let r=n.instanceId??n.scope;!t.has(r)&&await(e.completeAuthorization??completeScopedAuthorization)(n)&&t.add(r)}function requireAuth(e,n){throw new ScopedAuthorizationRequiredError(e,t.has(e.instanceId??e.scope),n)}return{complete,isJustAuthorized(e){return t.has(e.instanceId??e.scope)},async getToken(e){await complete(e);try{return await resolveScopedToken(e)}catch(t){if(!isConnectionAuthorizationRequiredError(t))throw t;return requireAuth(e,t)}},requireAuth,async handleError(e,n){return n!==void 0&&isConnectionAuthorizationRequiredError(e)?await handleAuthorizationError(new ScopedAuthorizationRequiredError(n,t.has(n.instanceId??n.scope),e),{evictToken:!1}):await handleAuthorizationError(e)},run:executeWithAuthorization}}var ScopedAuthorizationRequiredError=class extends Error{scoped;justAuthorized;constructor(e,t,n){super(`Authorization required.`,{cause:n}),this.name=`ScopedAuthorizationRequiredError`,this.scoped=e,this.justAuthorized=t}};function isScopedAuthorizationRequiredError(e){return e instanceof Error&&e.name===`ScopedAuthorizationRequiredError`}async function handleAuthorizationError(e,t={evictToken:!0}){if(!isScopedAuthorizationRequiredError(e))throw e;let{scoped:n}=e;if(e.justAuthorized)throw new ConnectionAuthorizationFailedError(n.scope,{message:`Authorization for "${n.scope}" failed: the service rejected the token immediately after authorization.`,reason:`token_rejected_after_authorization`,retryable:!1});t.evictToken&&await evictScopedToken(n);let r=await startScopedAuthorization(n);if(r!==void 0)return r;throw supportsInteractiveAuthorization(n.authorization)?new ConnectionAuthorizationFailedError(n.scope,{message:`Authorization for "${n.scope}" requires sign-in, but no authorization callback URL could be minted for this run (missing session context).`,reason:`authorization_callback_unavailable`,retryable:!1}):e.cause??new ConnectionAuthorizationRequiredError(n.scope)}function executeWithAuthorization(e){try{let t=e();return isAsyncIterable(t)?handleIterable(t):Promise.resolve(t).catch(handleAuthorizationError)}catch(e){return handleAuthorizationError(e)}}async function*handleIterable(e){try{for await(let t of e)yield t}catch(e){yield await handleAuthorizationError(e)}}async function resolveScopedToken(e){let{scope:t,authorization:n,connection:r}=e,i=e.instanceId??t,a=contextStorage.getStore(),o=resolveScopedPrincipal(e,a);if(a===void 0)return await n.getToken({connection:r,principal:o});let s=principalKey(o),c=readCachedToken(a,i,s);if(c!==void 0)return c;let l=await n.getToken({connection:r,principal:o});return writeCachedToken(a,i,s,l),l}async function evictScopedToken(e){let{scope:t,authorization:n,connection:r}=e,i=e.instanceId??t,a=contextStorage.getStore();if(a===void 0)return;let o;try{o=resolveScopedPrincipal(e,a),evictCachedToken(a,i,principalKey(o))}catch{return}try{await n.evict?.({connection:r,principal:o})}catch{}}async function completeScopedAuthorization(e){let{scope:t,authorization:n,connection:r}=e;if(!supportsInteractiveAuthorization(n))return!1;let i=consumeAuthorizationResult(t,e.instanceId);if(i===void 0)return!1;let a=n,o=loadContext(),s=i.principal??resolveScopedPrincipal(e,o),c=await a.completeAuthorization({callbackUrl:i.hookUrl,connection:r,principal:s,resume:i.resume,callback:i.callback});return writeCachedToken(o,e.instanceId??t,principalKey(s),c),!0}async function startScopedAuthorization(e){let{scope:t,authorization:n,connection:r}=e;if(!supportsInteractiveAuthorization(n))return;let i=createAuthorizationAttempt(t);if(i===void 0)return;let a=n,o=resolveScopedPrincipal(e),s=e.boundResponder??contextStorage.getStore()?.get(AuthKey)??void 0,c=resolveAuthorizationCallbackUrl({authorization:n,callbackUrl:i.hookUrl}),{challenge:l,resume:u}=await a.startAuthorization({callbackUrl:c,connection:r,principal:o});return requestAuthorization([{attemptId:i.attemptId,challenge:stampChallengeDisplayName(l,n),grant:n.vercelConnect?.connector,hookUrl:c,instanceId:e.instanceId,name:t,principal:o,principalId:s?.principalId,requester:s,resume:u}])}function resolveScopedPrincipal(e,t){return e.boundResponder===void 0?resolveConnectionPrincipal(e.scope,e.authorization,t):resolveConnectionPrincipalFromAuth(e.scope,e.authorization,e.boundResponder,t)}function resolveAuthorizationCallbackUrl(e){if(e.authorization.vercelConnect===void 0)return e.callbackUrl;let t;try{t=new URL(e.callbackUrl)}catch{return e.callbackUrl}return t.protocol!==`http:`||!LOCAL_HTTP_VERCEL_CONNECT_HOSTNAMES.has(t.hostname)?e.callbackUrl:(t.hostname=`localhost`,t.toString())}function stampChallengeDisplayName(e,t){let n=t.displayName??e.displayName;return n===e.displayName?e:{...e,displayName:n}}export{completeScopedAuthorization,createAuthorizationExecution,evictScopedToken,handleAuthorizationError,resolveAuthorizationCallbackUrl,resolveScopedToken,stampChallengeDisplayName};
1
+ import{contextStorage,loadContext}from"#context/container.js";import{AuthKey}from"#context/keys.js";import{ConnectionAuthorizationFailedError,ConnectionAuthorizationRequiredError,isConnectionAuthorizationRequiredError}from"#connections/errors.js";import{consumeAuthorizationResult,createAuthorizationAttempt,requestAuthorization}from"#harness/authorization.js";import{supportsInteractiveAuthorization}from"#shared/connection-types.js";import{isAsyncIterable}from"#shared/async-iterable.js";import{evictCachedToken,readCachedToken,writeCachedToken}from"#runtime/connections/authorization-tokens.js";import{principalKey,resolveConnectionPrincipal,resolveConnectionPrincipalFromAuth}from"#runtime/connections/principal.js";const LOCAL_HTTP_VERCEL_CONNECT_HOSTNAMES=new Set([`127.0.0.1`,`[::1]`]);function createAuthorizationExecution(e={}){let t=new Set;async function complete(n){let r=n.instanceId??n.scope;!t.has(r)&&await(e.completeAuthorization??completeScopedAuthorization)(n)&&t.add(r)}function requireAuth(e,n){throw new ScopedAuthorizationRequiredError(e,t.has(e.instanceId??e.scope),n)}return{complete,isJustAuthorized(e){return t.has(e.instanceId??e.scope)},async getToken(e){await complete(e);try{return await resolveScopedToken(e)}catch(t){if(!isConnectionAuthorizationRequiredError(t))throw t;return requireAuth(e,t)}},requireAuth,async handleError(e,n){return n!==void 0&&isConnectionAuthorizationRequiredError(e)?await handleAuthorizationError(new ScopedAuthorizationRequiredError(n,t.has(n.instanceId??n.scope),e),{evictToken:!1}):await handleAuthorizationError(e)},run:executeWithAuthorization}}var ScopedAuthorizationRequiredError=class extends Error{scoped;justAuthorized;constructor(e,t,n){super(`Authorization required.`,{cause:n}),this.name=`ScopedAuthorizationRequiredError`,this.scoped=e,this.justAuthorized=t}};function isScopedAuthorizationRequiredError(e){return e instanceof Error&&e.name===`ScopedAuthorizationRequiredError`}async function handleAuthorizationError(e,t={evictToken:!0}){if(!isScopedAuthorizationRequiredError(e))throw e;let{scoped:n}=e;if(e.justAuthorized)throw new ConnectionAuthorizationFailedError(n.scope,{message:`Authorization for "${n.scope}" failed: the service rejected the token immediately after authorization.`,reason:`token_rejected_after_authorization`,retryable:!1});t.evictToken&&await evictScopedToken(n);let r=await startScopedAuthorization(n);if(r!==void 0)return r;throw supportsInteractiveAuthorization(n.authorization)?new ConnectionAuthorizationFailedError(n.scope,{message:`Authorization for "${n.scope}" requires sign-in, but no authorization callback URL could be minted for this run (missing session context).`,reason:`authorization_callback_unavailable`,retryable:!1}):e.cause??new ConnectionAuthorizationRequiredError(n.scope)}function executeWithAuthorization(e){try{let t=e();return isAsyncIterable(t)?handleIterable(t):Promise.resolve(t).catch(handleAuthorizationError)}catch(e){return handleAuthorizationError(e)}}async function*handleIterable(e){try{for await(let t of e)yield t}catch(e){yield await handleAuthorizationError(e)}}async function resolveScopedToken(e){let{scope:t,authorization:n,connection:r}=e,i=e.instanceId??t,a=contextStorage.getStore(),o=resolveScopedPrincipal(e,a);if(a===void 0)return await n.getToken({connection:r,principal:o});let s=principalKey(o),c=readCachedToken(a,i,s);if(c!==void 0)return c;let l=await n.getToken({connection:r,principal:o});return writeCachedToken(a,i,s,l),l}async function evictScopedToken(e){let{scope:t,authorization:n,connection:r}=e,i=e.instanceId??t,a=contextStorage.getStore();if(a===void 0)return;let o;try{o=resolveScopedPrincipal(e,a),evictCachedToken(a,i,principalKey(o))}catch{return}try{await n.evict?.({connection:r,principal:o})}catch{}}async function completeScopedAuthorization(e){let{scope:t,authorization:n,connection:r}=e;if(!supportsInteractiveAuthorization(n))return!1;let i=consumeAuthorizationResult(t,e.instanceId);if(i===void 0)return!1;let a=n,o=loadContext(),s=i.principal??resolveScopedPrincipal(e,o),c=await a.completeAuthorization({callbackUrl:i.hookUrl,connection:r,principal:s,resume:i.resume,callback:i.callback});return writeCachedToken(o,e.instanceId??t,principalKey(s),c),!0}async function startScopedAuthorization(e){let{scope:t,authorization:n,connection:r}=e;if(!supportsInteractiveAuthorization(n))return;let i=createAuthorizationAttempt(t);if(i===void 0)return;let a=n,o=resolveScopedPrincipal(e),s=e.boundResponder??contextStorage.getStore()?.get(AuthKey)??void 0,c=resolveAuthorizationCallbackUrl({authorization:n,callbackUrl:i.hookUrl}),{challenge:l,resume:u}=await a.startAuthorization({callbackUrl:c,connection:r,principal:o});return requestAuthorization([{attemptId:i.attemptId,challenge:stampChallengeDisplayName(l,n),grant:n.vercelConnect?.connector,hookUrl:c,instanceId:e.instanceId,name:t,principal:o,principalId:s?.principalId,requester:s,resume:u}])}function resolveScopedPrincipal(e,t){return e.boundResponder===void 0?resolveConnectionPrincipal(e.scope,e.authorization,t):resolveConnectionPrincipalFromAuth(e.scope,e.authorization,e.boundResponder,t)}function resolveAuthorizationCallbackUrl(e){if(e.authorization.vercelConnect===void 0)return e.callbackUrl;let t;try{t=new URL(e.callbackUrl)}catch{return e.callbackUrl}return t.protocol!==`http:`||!LOCAL_HTTP_VERCEL_CONNECT_HOSTNAMES.has(t.hostname)?e.callbackUrl:(t.hostname=`localhost`,t.toString())}function stampChallengeDisplayName(e,t){let n=t.displayName??e.displayName;return n===e.displayName?e:{...e,displayName:n}}export{completeScopedAuthorization,createAuthorizationExecution,evictScopedToken,handleAuthorizationError,resolveAuthorizationCallbackUrl,resolveScopedToken,stampChallengeDisplayName};
@@ -1,6 +1,6 @@
1
1
  /**
2
- * The value a connection tool call returns: what `connection_execute` hands
3
- * the model today and what a code mode program receives later.
2
+ * The value a connection tool call returns: what the model receives for the
3
+ * call and what a code mode program receives later.
4
4
  *
5
5
  * - MCP results return `structuredContent` when present, otherwise their text,
6
6
  * parsed as JSON when the tool declares no output schema. Results with image,
@@ -1 +1 @@
1
- import{expectObjectRecord}from"#internal/authored-module.js";import{stripLogicalPathExtension}from"#discover/filesystem.js";import{ROOT_COMPILED_AGENT_NODE_ID}from"#compiler/manifest.js";import{validateCompiledModuleMap}from"#compiler/validate-artifact.js";import{createRuntimeSubagentRegistry}from"#runtime/subagents/registry.js";import{LOAD_SKILL_TOOL_NAME}from"#runtime/skills/fragment-context.js";import{ROOT_RUNTIME_AGENT_NODE_ID}from"#runtime/graph.js";import{createRuntimeToolRegistry}from"#runtime/tools/registry.js";import{loadResolvedModuleExport}from"#runtime/resolve-helpers.js";import{createResolvedRuntimeTurnAgent}from"#runtime/agent/bootstrap.js";import{createWorkspacePromptSection}from"#runtime/workspace/spec.js";import{createRuntimeHookRegistry}from"#runtime/hooks/registry.js";import{resolveAgent}from"#runtime/resolve-agent.js";import{resolveDynamicSubagentDefinition}from"#runtime/resolve-dynamic-subagent.js";import{createRuntimeSandboxRegistry}from"#runtime/sandbox/registry.js";var ResolveRuntimeAgentGraphError=class extends Error{logicalPath;nodeId;sourceId;constructor(e,t={}){super(e),this.name=`ResolveRuntimeAgentGraphError`,t.logicalPath!==void 0&&(this.logicalPath=t.logicalPath),t.nodeId!==void 0&&(this.nodeId=t.nodeId),t.sourceId!==void 0&&(this.sourceId=t.sourceId)}};async function resolveRuntimeAgentGraph(e){validateCompiledModuleMap(e.manifest,e.moduleMap);let t=new Map,n=createChildNodeIdsByParentNodeId(e.manifest),r=new Map(e.manifest.subagents.map(e=>[e.nodeId,e])),i=await resolveRuntimeAgentNode({childNodeIdsByParentNodeId:n,manifest:e.manifest,moduleMap:e.moduleMap,nodeId:ROOT_COMPILED_AGENT_NODE_ID,nodesByNodeId:t,subagentNodesById:r});return attachInheritedSandboxWorkspaceResources({manifest:e.manifest,nodesByNodeId:t}),{nodesByNodeId:t,root:i}}async function resolveRuntimeAgentNode(e){let t=toRuntimeNodeId(e.nodeId);if(e.nodesByNodeId.has(t))throw new ResolveRuntimeAgentGraphError(`Found multiple runtime agent nodes for node id "${t}".`,{nodeId:t,sourceId:e.sourceId});let n=await resolveAgent({manifest:e.manifest,moduleMap:e.moduleMap,nodeId:e.nodeId}),r=await createRuntimeToolRegistry({tools:n.tools},{nodeId:t}),i=createRuntimeSandboxRegistry({sandbox:n.sandbox,workspaceResourceRoot:n.workspaceResourceRoot}),a=createRuntimeSubagentRegistry({disabledToolNames:e.manifest.sourceComposition.entries.flatMap(e=>e.kind!==`disabled`||!e.source.logicalPath.startsWith(`tools/`)?[]:[stripLogicalPathExtension(e.source.logicalPath).replace(/^tools\//,``).replaceAll(`/`,`-`)]),reservedToolNames:[LOAD_SKILL_TOOL_NAME,...r.preparedTools.map(e=>e.name)],subagents:await resolveRuntimeSubagents({childNodeIdsByParentNodeId:e.childNodeIdsByParentNodeId,manifest:e.manifest,moduleMap:e.moduleMap,nodesByNodeId:e.nodesByNodeId,parentNodeId:e.nodeId,subagentNodesById:e.subagentNodesById})}),o={agent:n,channels:n.channels,hookRegistry:createRuntimeHookRegistry(n.hooks),nodeId:t,sandboxRegistry:i,sourceId:e.sourceId,subagentRegistry:a,toolRegistry:r,turnAgent:createResolvedRuntimeTurnAgent({agent:n,id:e.agentId,nodeId:t,tools:[...r.preparedTools,...a.preparedTools]})};return e.nodesByNodeId.set(t,o),o}async function resolveRuntimeSubagents(e){let t=[],n=e.childNodeIdsByParentNodeId.get(e.parentNodeId)??[];for(let r of n){let n=e.subagentNodesById.get(r);if(n===void 0)throw new ResolveRuntimeAgentGraphError(`Missing compiled subagent node "${r}" while resolving runtime subagents.`,{nodeId:toRuntimeNodeId(e.parentNodeId),sourceId:r});t.push(await resolveRuntimeSubagent({childNodeIdsByParentNodeId:e.childNodeIdsByParentNodeId,moduleMap:e.moduleMap,nodesByNodeId:e.nodesByNodeId,sourceRef:n,subagentNodesById:e.subagentNodesById}))}for(let n of e.manifest.remoteAgents)t.push(await resolveRuntimeRemoteAgent({moduleMap:e.moduleMap,nodeScopeId:e.parentNodeId,sourceRef:n}));return t}async function resolveRuntimeSubagent(e){let t={...e.sourceRef.configResolver===void 0?{description:e.sourceRef.description,tool:e.sourceRef.agent.config.tool}:{dynamic:await resolveDynamicSubagentDefinition({definition:e.sourceRef.configResolver,moduleMap:e.moduleMap,nodeId:e.sourceRef.nodeId})},kind:`subagent`,logicalPath:e.sourceRef.logicalPath,name:e.sourceRef.name,nodeId:toRuntimeNodeId(e.sourceRef.nodeId),sourceId:e.sourceRef.sourceId,sourceKind:`module`};return await resolveRuntimeAgentNode({agentId:e.sourceRef.name,childNodeIdsByParentNodeId:e.childNodeIdsByParentNodeId,manifest:e.sourceRef.agent,moduleMap:e.moduleMap,nodeId:e.sourceRef.nodeId,nodesByNodeId:e.nodesByNodeId,sourceId:e.sourceRef.sourceId,subagentNodesById:e.subagentNodesById}),t}async function resolveRuntimeRemoteAgent(e){let t=await loadResolvedModuleExport({definition:e.sourceRef,kindLabel:`remote agent`,moduleMap:e.moduleMap,nodeId:e.nodeScopeId}),n=expectObjectRecord(t,`Expected remote agent source "${e.sourceRef.logicalPath}" to export an object.`),r={description:e.sourceRef.description,kind:`remote`,logicalPath:e.sourceRef.logicalPath,name:e.sourceRef.name,nodeId:toRuntimeNodeId(e.sourceRef.nodeId),path:e.sourceRef.path,sourceId:e.sourceRef.sourceId,sourceKind:`module`,tool:e.sourceRef.tool,url:await resolveRemoteAgentUrl({bakedUrl:e.sourceRef.url,logicalPath:e.sourceRef.logicalPath,resolvedUrl:n.url})};typeof n.auth==`function`&&(r.auth=n.auth),n.forwardPrincipal===!0&&(r.forwardPrincipal=!0);let i=resolveRemoteAgentHeaders(n.headers);return i!==void 0&&(r.headers=i),r}async function resolveRemoteAgentUrl(e){if(typeof e.resolvedUrl==`function`){let t=await e.resolvedUrl();if(typeof t!=`string`||t.length===0)throw Error(`Remote agent "${e.logicalPath}" url function must return a non-empty string.`);return t}let t=e.bakedUrl??(typeof e.resolvedUrl==`string`?e.resolvedUrl:``);if(t.length===0)throw Error(`Remote agent "${e.logicalPath}" is missing a url.`);return t}function resolveRemoteAgentHeaders(e){if(e===void 0)return;if(typeof e==`function`)return e;if(typeof e!=`object`||!e||Array.isArray(e))return;let t={};for(let[n,r]of Object.entries(e))typeof r==`string`&&(t[n]=r);return t}function attachInheritedSandboxWorkspaceResources(e){let t=new Map(e.manifest.subagents.map(e=>[e.nodeId,e.parentNodeId]));for(let[n,r]of e.nodesByNodeId){if(r.sandboxRegistry.sandbox.definition.kind!==`parent`)continue;if(r.agent.dynamicSkillResolvers.length>0)throw new ResolveRuntimeAgentGraphError(`Sandbox "${r.sandboxRegistry.sandbox.definition.logicalPath}" selects parent.sandbox but agent node "${n}" defines dynamic skills. Remove the child dynamic skills or give the child its own sandbox.`,{nodeId:n});let i=t.get(n);if(i===void 0)throw new ResolveRuntimeAgentGraphError(`Sandbox "${r.sandboxRegistry.sandbox.definition.logicalPath}" selects parent.sandbox but agent node "${n}" has no parent.`,{nodeId:n});let a=resolveSandboxOwnerNode({nodeId:i,nodesByNodeId:e.nodesByNodeId,parentNodeIdByChildNodeId:t});r.sandboxRegistry.sandbox.inheritance={definition:a.sandboxRegistry.sandbox.definition,nodeId:a.nodeId,workspaceResourceRoot:a.sandboxRegistry.sandbox.workspaceResourceRoot};let o=createWorkspacePromptSection(a.agent.workspaceSpec);o!==void 0&&(r.turnAgent.instructions=[...r.turnAgent.instructions,o])}}function resolveSandboxOwnerNode(e){let t=e.nodesByNodeId.get(toRuntimeNodeId(e.nodeId));if(t===void 0)throw new ResolveRuntimeAgentGraphError(`Missing parent runtime node "${e.nodeId}".`,{nodeId:e.nodeId});if(t.sandboxRegistry.sandbox.definition.kind!==`parent`)return t;let n=e.parentNodeIdByChildNodeId.get(e.nodeId);if(n===void 0)throw new ResolveRuntimeAgentGraphError(`Inherited sandbox node "${e.nodeId}" has no parent.`,{nodeId:e.nodeId});return resolveSandboxOwnerNode({...e,nodeId:n})}function createChildNodeIdsByParentNodeId(e){let t=new Map;for(let n of e.subagents){let e=t.get(n.parentNodeId);if(e===void 0){t.set(n.parentNodeId,[n.nodeId]);continue}e.push(n.nodeId)}return t}function toRuntimeNodeId(e){return e===ROOT_COMPILED_AGENT_NODE_ID?ROOT_RUNTIME_AGENT_NODE_ID:e}export{resolveRuntimeAgentGraph};
1
+ import{expectObjectRecord}from"#internal/authored-module.js";import{stripLogicalPathExtension}from"#discover/filesystem.js";import{ROOT_COMPILED_AGENT_NODE_ID}from"#compiler/manifest.js";import{validateCompiledModuleMap}from"#compiler/validate-artifact.js";import{createRuntimeSubagentRegistry}from"#runtime/subagents/registry.js";import{ROOT_RUNTIME_AGENT_NODE_ID}from"#runtime/graph.js";import{createRuntimeToolRegistry}from"#runtime/tools/registry.js";import{loadResolvedModuleExport}from"#runtime/resolve-helpers.js";import{createResolvedRuntimeTurnAgent}from"#runtime/agent/bootstrap.js";import{createWorkspacePromptSection}from"#runtime/workspace/spec.js";import{createRuntimeHookRegistry}from"#runtime/hooks/registry.js";import{resolveAgent}from"#runtime/resolve-agent.js";import{resolveDynamicSubagentDefinition}from"#runtime/resolve-dynamic-subagent.js";import{createRuntimeSandboxRegistry}from"#runtime/sandbox/registry.js";var ResolveRuntimeAgentGraphError=class extends Error{logicalPath;nodeId;sourceId;constructor(e,t={}){super(e),this.name=`ResolveRuntimeAgentGraphError`,t.logicalPath!==void 0&&(this.logicalPath=t.logicalPath),t.nodeId!==void 0&&(this.nodeId=t.nodeId),t.sourceId!==void 0&&(this.sourceId=t.sourceId)}};async function resolveRuntimeAgentGraph(e){validateCompiledModuleMap(e.manifest,e.moduleMap);let t=new Map,n=createChildNodeIdsByParentNodeId(e.manifest),r=new Map(e.manifest.subagents.map(e=>[e.nodeId,e])),i=await resolveRuntimeAgentNode({childNodeIdsByParentNodeId:n,manifest:e.manifest,moduleMap:e.moduleMap,nodeId:ROOT_COMPILED_AGENT_NODE_ID,nodesByNodeId:t,subagentNodesById:r});return attachInheritedSandboxWorkspaceResources({manifest:e.manifest,nodesByNodeId:t}),{nodesByNodeId:t,root:i}}async function resolveRuntimeAgentNode(e){let t=toRuntimeNodeId(e.nodeId);if(e.nodesByNodeId.has(t))throw new ResolveRuntimeAgentGraphError(`Found multiple runtime agent nodes for node id "${t}".`,{nodeId:t,sourceId:e.sourceId});let n=await resolveAgent({manifest:e.manifest,moduleMap:e.moduleMap,nodeId:e.nodeId}),r=await createRuntimeToolRegistry({tools:n.tools},{deferSelfAgent:n.config?.tool===`deferred`,nodeId:t}),i=createRuntimeSandboxRegistry({sandbox:n.sandbox,workspaceResourceRoot:n.workspaceResourceRoot}),a=createRuntimeSubagentRegistry({disabledToolNames:e.manifest.sourceComposition.entries.flatMap(e=>e.kind!==`disabled`||!e.source.logicalPath.startsWith(`tools/`)?[]:[stripLogicalPathExtension(e.source.logicalPath).replace(/^tools\//,``).replaceAll(`/`,`-`)]),reservedToolNames:r.preparedTools.map(e=>e.name),subagents:await resolveRuntimeSubagents({childNodeIdsByParentNodeId:e.childNodeIdsByParentNodeId,manifest:e.manifest,moduleMap:e.moduleMap,nodesByNodeId:e.nodesByNodeId,parentNodeId:e.nodeId,subagentNodesById:e.subagentNodesById})}),o={agent:n,channels:n.channels,hookRegistry:createRuntimeHookRegistry(n.hooks),nodeId:t,sandboxRegistry:i,sourceId:e.sourceId,subagentRegistry:a,toolRegistry:r,turnAgent:createResolvedRuntimeTurnAgent({agent:n,id:e.agentId,nodeId:t,tools:[...r.preparedTools,...a.preparedTools]})};return e.nodesByNodeId.set(t,o),o}async function resolveRuntimeSubagents(e){let t=[],n=e.childNodeIdsByParentNodeId.get(e.parentNodeId)??[];for(let r of n){let n=e.subagentNodesById.get(r);if(n===void 0)throw new ResolveRuntimeAgentGraphError(`Missing compiled subagent node "${r}" while resolving runtime subagents.`,{nodeId:toRuntimeNodeId(e.parentNodeId),sourceId:r});t.push(await resolveRuntimeSubagent({childNodeIdsByParentNodeId:e.childNodeIdsByParentNodeId,moduleMap:e.moduleMap,nodesByNodeId:e.nodesByNodeId,sourceRef:n,subagentNodesById:e.subagentNodesById}))}for(let n of e.manifest.remoteAgents)t.push(await resolveRuntimeRemoteAgent({moduleMap:e.moduleMap,nodeScopeId:e.parentNodeId,sourceRef:n}));return t}async function resolveRuntimeSubagent(e){let t={...e.sourceRef.configResolver===void 0?{description:e.sourceRef.description,tool:e.sourceRef.agent.config.tool}:{dynamic:await resolveDynamicSubagentDefinition({definition:e.sourceRef.configResolver,moduleMap:e.moduleMap,nodeId:e.sourceRef.nodeId})},kind:`subagent`,logicalPath:e.sourceRef.logicalPath,name:e.sourceRef.name,nodeId:toRuntimeNodeId(e.sourceRef.nodeId),sourceId:e.sourceRef.sourceId,sourceKind:`module`};return await resolveRuntimeAgentNode({agentId:e.sourceRef.name,childNodeIdsByParentNodeId:e.childNodeIdsByParentNodeId,manifest:e.sourceRef.agent,moduleMap:e.moduleMap,nodeId:e.sourceRef.nodeId,nodesByNodeId:e.nodesByNodeId,sourceId:e.sourceRef.sourceId,subagentNodesById:e.subagentNodesById}),t}async function resolveRuntimeRemoteAgent(e){let t=await loadResolvedModuleExport({definition:e.sourceRef,kindLabel:`remote agent`,moduleMap:e.moduleMap,nodeId:e.nodeScopeId}),n=expectObjectRecord(t,`Expected remote agent source "${e.sourceRef.logicalPath}" to export an object.`),r={description:e.sourceRef.description,kind:`remote`,logicalPath:e.sourceRef.logicalPath,name:e.sourceRef.name,nodeId:toRuntimeNodeId(e.sourceRef.nodeId),path:e.sourceRef.path,sourceId:e.sourceRef.sourceId,sourceKind:`module`,tool:e.sourceRef.tool,url:await resolveRemoteAgentUrl({bakedUrl:e.sourceRef.url,logicalPath:e.sourceRef.logicalPath,resolvedUrl:n.url})};typeof n.auth==`function`&&(r.auth=n.auth),n.forwardPrincipal===!0&&(r.forwardPrincipal=!0);let i=resolveRemoteAgentHeaders(n.headers);return i!==void 0&&(r.headers=i),r}async function resolveRemoteAgentUrl(e){if(typeof e.resolvedUrl==`function`){let t=await e.resolvedUrl();if(typeof t!=`string`||t.length===0)throw Error(`Remote agent "${e.logicalPath}" url function must return a non-empty string.`);return t}let t=e.bakedUrl??(typeof e.resolvedUrl==`string`?e.resolvedUrl:``);if(t.length===0)throw Error(`Remote agent "${e.logicalPath}" is missing a url.`);return t}function resolveRemoteAgentHeaders(e){if(e===void 0)return;if(typeof e==`function`)return e;if(typeof e!=`object`||!e||Array.isArray(e))return;let t={};for(let[n,r]of Object.entries(e))typeof r==`string`&&(t[n]=r);return t}function attachInheritedSandboxWorkspaceResources(e){let t=new Map(e.manifest.subagents.map(e=>[e.nodeId,e.parentNodeId]));for(let[n,r]of e.nodesByNodeId){if(r.sandboxRegistry.sandbox.definition.kind!==`parent`)continue;if(r.agent.dynamicSkillResolvers.length>0)throw new ResolveRuntimeAgentGraphError(`Sandbox "${r.sandboxRegistry.sandbox.definition.logicalPath}" selects parent.sandbox but agent node "${n}" defines dynamic skills. Remove the child dynamic skills or give the child its own sandbox.`,{nodeId:n});let i=t.get(n);if(i===void 0)throw new ResolveRuntimeAgentGraphError(`Sandbox "${r.sandboxRegistry.sandbox.definition.logicalPath}" selects parent.sandbox but agent node "${n}" has no parent.`,{nodeId:n});let a=resolveSandboxOwnerNode({nodeId:i,nodesByNodeId:e.nodesByNodeId,parentNodeIdByChildNodeId:t});r.sandboxRegistry.sandbox.inheritance={definition:a.sandboxRegistry.sandbox.definition,nodeId:a.nodeId,workspaceResourceRoot:a.sandboxRegistry.sandbox.workspaceResourceRoot};let o=createWorkspacePromptSection(a.agent.workspaceSpec);o!==void 0&&(r.turnAgent.instructions=[...r.turnAgent.instructions,o])}}function resolveSandboxOwnerNode(e){let t=e.nodesByNodeId.get(toRuntimeNodeId(e.nodeId));if(t===void 0)throw new ResolveRuntimeAgentGraphError(`Missing parent runtime node "${e.nodeId}".`,{nodeId:e.nodeId});if(t.sandboxRegistry.sandbox.definition.kind!==`parent`)return t;let n=e.parentNodeIdByChildNodeId.get(e.nodeId);if(n===void 0)throw new ResolveRuntimeAgentGraphError(`Inherited sandbox node "${e.nodeId}" has no parent.`,{nodeId:e.nodeId});return resolveSandboxOwnerNode({...e,nodeId:n})}function createChildNodeIdsByParentNodeId(e){let t=new Map;for(let n of e.subagents){let e=t.get(n.parentNodeId);if(e===void 0){t.set(n.parentNodeId,[n.nodeId]);continue}e.push(n.nodeId)}return t}function toRuntimeNodeId(e){return e===ROOT_COMPILED_AGENT_NODE_ID?ROOT_RUNTIME_AGENT_NODE_ID:e}export{resolveRuntimeAgentGraph};
@@ -1 +1 @@
1
- import{expectFunction,expectObjectRecord}from"#internal/authored-module.js";import{toErrorMessage}from"#shared/errors.js";import{isToolSchema,toInputSchema,toOutputSchema}from"#tools/schema.js";import{frameworkTool,isFrameworkTool}from"#tools/provided/framework-tool.js";import{registerDefinitionSource}from"#internal/authored-definition/source-identity.js";import{normalizeApproval}from"#internal/authored-definition/approval.js";import{createWorkflowProgramExecuteInput}from"#tools/workflow-program-input.js";import{ResolveAgentError,loadResolvedModuleExport}from"#runtime/resolve-helpers.js";async function resolveToolDefinition(e,t,n,r){if(!e.hasExecute){let t={availableInSubagents:e.availableInSubagents,behavior:e.behavior,description:e.description,inputSchema:toInputSchema(e.inputSchema),logicalPath:e.logicalPath,name:e.name,outputSchema:toOutputSchema(e.outputSchema),owner:r,sourceId:e.sourceId,sourceKind:`module`};return e.behavior?.handling?.kind===`provider-tool`?frameworkTool(t):t}try{let i=await loadResolvedModuleExport({definition:e,kindLabel:`tool`,moduleMap:t,nodeId:n}),a=expectObjectRecord(i,describe(e,`to return an object`));registerDefinitionSource(a,{kind:`tool`,logicalPath:e.logicalPath,name:e.name},`tool:${a.description}`);let o=e.behavior?.handling?.kind===`workflow-tool`?void 0:expectFunction(a.execute,describe(e,`to provide an execute function`)),s=isToolSchema(a.inputSchema)?a.inputSchema:toInputSchema(e.inputSchema),c=isToolSchema(a.outputSchema)?a.outputSchema:toOutputSchema(e.outputSchema),l=e.workflowProgram,u=l===void 0?void 0:e=>createWorkflowProgramExecuteInput(l,e),d={availableInSubagents:e.availableInSubagents,behavior:e.behavior,description:e.description,execute:o,executeInput:u,exportName:e.exportName,inputSchema:s,logicalPath:e.logicalPath,name:e.name,owner:r,outputSchema:c,sourceId:e.sourceId,sourceKind:`module`,...extractOptionalHooks(a,e)};return isFrameworkTool(a)?frameworkTool(d):d}catch(t){throw t instanceof ResolveAgentError?t:new ResolveAgentError(`Failed to attach the tool execute function from "${e.logicalPath}": ${toErrorMessage(t)}`,{logicalPath:e.logicalPath,sourceId:e.sourceId})}}function extractOptionalHooks(e,t){let n={};if(e.label!==void 0){let r=expectObjectRecord(e.label,describe(t,`to provide a valid label definition`));n.label={complete:r.complete===void 0?void 0:expectFunction(r.complete,describe(t,`to provide an label complete function`)),delta:r.delta===void 0?void 0:expectFunction(r.delta,describe(t,`to provide an label delta function`)),start:expectFunction(r.start,describe(t,`to provide a label start callback function`))}}return e.approval!==void 0&&(n.approval=normalizeApproval(e.approval,describe(t,`to provide a valid approval definition`))),e.approvalKey!==void 0&&(n.approvalKey=expectFunction(e.approvalKey,describe(t,`to provide an approvalKey function`))),e.endsTurn!==void 0&&(n.endsTurn=typeof e.endsTurn==`boolean`?e.endsTurn:expectFunction(e.endsTurn,describe(t,`to provide endsTurn as a boolean or a function`))),e.toModelOutput!==void 0&&(n.toModelOutput=expectFunction(e.toModelOutput,describe(t,`to provide a toModelOutput function`))),n}function describe(e,t){return`Expected the tool export "${e.exportName??`default`}" from "${e.logicalPath}" ${t}.`}export{resolveToolDefinition};
1
+ import{expectFunction,expectObjectRecord}from"#internal/authored-module.js";import{toErrorMessage}from"#shared/errors.js";import{isToolSchema,toInputSchema,toOutputSchema}from"#tools/schema.js";import{frameworkTool,isFrameworkTool}from"#tools/provided/framework-tool.js";import{registerDefinitionSource}from"#internal/authored-definition/source-identity.js";import{normalizeApproval}from"#internal/authored-definition/approval.js";import{createWorkflowProgramExecuteInput}from"#tools/workflow-program-input.js";import{ResolveAgentError,loadResolvedModuleExport}from"#runtime/resolve-helpers.js";async function resolveToolDefinition(e,t,n,r){if(!e.hasExecute){let t={availableInSubagents:e.availableInSubagents,behavior:e.behavior,deferred:e.deferred,description:e.description,inputSchema:toInputSchema(e.inputSchema),logicalPath:e.logicalPath,name:e.name,outputSchema:toOutputSchema(e.outputSchema),owner:r,sourceId:e.sourceId,sourceKind:`module`};return e.behavior?.handling?.kind===`provider-tool`?frameworkTool(t):t}try{let i=await loadResolvedModuleExport({definition:e,kindLabel:`tool`,moduleMap:t,nodeId:n}),a=expectObjectRecord(i,describe(e,`to return an object`));registerDefinitionSource(a,{kind:`tool`,logicalPath:e.logicalPath,name:e.name},`tool:${a.description}`);let o=e.behavior?.handling?.kind===`workflow-tool`?void 0:expectFunction(a.execute,describe(e,`to provide an execute function`)),s=isToolSchema(a.inputSchema)?a.inputSchema:toInputSchema(e.inputSchema),c=isToolSchema(a.outputSchema)?a.outputSchema:toOutputSchema(e.outputSchema),l=e.workflowProgram,u=l===void 0?void 0:e=>createWorkflowProgramExecuteInput(l,e),d={availableInSubagents:e.availableInSubagents,behavior:e.behavior,deferred:e.deferred,description:e.description,execute:o,executeInput:u,exportName:e.exportName,inputSchema:s,logicalPath:e.logicalPath,name:e.name,owner:r,outputSchema:c,sourceId:e.sourceId,sourceKind:`module`,...extractOptionalHooks(a,e)};return isFrameworkTool(a)?frameworkTool(d):d}catch(t){throw t instanceof ResolveAgentError?t:new ResolveAgentError(`Failed to attach the tool execute function from "${e.logicalPath}": ${toErrorMessage(t)}`,{logicalPath:e.logicalPath,sourceId:e.sourceId})}}function extractOptionalHooks(e,t){let n={};if(e.label!==void 0){let r=expectObjectRecord(e.label,describe(t,`to provide a valid label definition`));n.label={complete:r.complete===void 0?void 0:expectFunction(r.complete,describe(t,`to provide an label complete function`)),delta:r.delta===void 0?void 0:expectFunction(r.delta,describe(t,`to provide an label delta function`)),start:expectFunction(r.start,describe(t,`to provide a label start callback function`))}}return e.approval!==void 0&&(n.approval=normalizeApproval(e.approval,describe(t,`to provide a valid approval definition`))),e.approvalKey!==void 0&&(n.approvalKey=expectFunction(e.approvalKey,describe(t,`to provide an approvalKey function`))),e.endsTurn!==void 0&&(n.endsTurn=typeof e.endsTurn==`boolean`?e.endsTurn:expectFunction(e.endsTurn,describe(t,`to provide endsTurn as a boolean or a function`))),e.toModelOutput!==void 0&&(n.toModelOutput=expectFunction(e.toModelOutput,describe(t,`to provide a toModelOutput function`))),n}function describe(e,t){return`Expected the tool export "${e.exportName??`default`}" from "${e.logicalPath}" ${t}.`}export{resolveToolDefinition};
@@ -1,6 +1,6 @@
1
1
  import type { StandardSchemaV1 } from "#compiled/@standard-schema/spec/index.js";
2
2
  import type { SessionSchedule } from "#context/session-schedule.js";
3
- import type { ScheduleClient, ScheduleClientCreate, DynamicSchedulesDefinition, ScheduleEnvelope, ScheduleScopeContext } from "#public/schedules/subscription.js";
3
+ import type { ScheduleClient, ScheduleClientCreate, ScheduleClientUpdate, DynamicSchedulesDefinition, ScheduleEnvelope, ScheduleScopeContext } from "#public/schedules/subscription.js";
4
4
  export interface ScheduleBoundCallContext extends ScheduleScopeContext {
5
5
  readonly application: string;
6
6
  readonly collection: string;
@@ -11,10 +11,19 @@ export interface PreparedScheduleCreate<TPrepared = unknown> {
11
11
  readonly expression: import("#public/schedules/subscription.js").ScheduleTiming;
12
12
  readonly envelope: ScheduleEnvelope<TPrepared>;
13
13
  }
14
- /** Internal capabilities used by generated create approval; authored clients expose only create. */
14
+ export interface PreparedScheduleUpdate<TPrepared = unknown> {
15
+ readonly name: string;
16
+ readonly namespace: string;
17
+ readonly expression?: import("#public/schedules/subscription.js").ScheduleTiming;
18
+ readonly envelope?: ScheduleEnvelope<TPrepared>;
19
+ }
20
+ export type PreparedScheduleWrite = PreparedScheduleCreate | PreparedScheduleUpdate;
21
+ /** Internal preparation capabilities used by generated write approval. */
15
22
  export interface ScheduleCollectionClient<TInput, TPrepared> extends ScheduleClient<TInput> {
16
- prepareCreate(input: ScheduleClientCreate<TInput>): Promise<PreparedScheduleCreate<TInput | TPrepared>>;
23
+ prepareCreate(input: ScheduleClientCreate<unknown>): Promise<PreparedScheduleCreate<TPrepared>>;
17
24
  create(input: ScheduleClientCreate<TInput>, approved?: PreparedScheduleCreate): Promise<import("#public/schedules/subscription.js").ScheduleRecord>;
25
+ prepareUpdate(name: string, patch: ScheduleClientUpdate<unknown>): Promise<PreparedScheduleUpdate<TPrepared>>;
26
+ update(name: string, patch: ScheduleClientUpdate<TInput>, approved?: PreparedScheduleUpdate): Promise<import("#public/schedules/subscription.js").ScheduleRecord>;
18
27
  }
19
28
  export declare function createScheduleCollectionClient<TPayload, TPrepared = TPayload>(definition: DynamicSchedulesDefinition<TPayload, StandardSchemaV1<unknown, TPayload>, TPrepared>, callContext: ScheduleBoundCallContext): ScheduleCollectionClient<TPayload, TPrepared>;
20
29
  export declare function assertScheduleManagementAllowed(schedule?: SessionSchedule): void;
@@ -1 +1 @@
1
- import{createHash,randomUUID}from"node:crypto";import{contextStorage,loadContext}from"#context/container.js";import{projectScheduleRecord}from"#runtime/schedules/record.js";import{createScheduleCollectionPayload,validateSchedulePayload}from"#runtime/schedules/payload.js";import{isDeepStrictEqual}from"node:util";import{readSessionSchedule}from"#context/session-schedule.js";import{BundleKey}from"#runtime/sessions/runtime-context-keys.js";import{resolveScheduleTiming,validateScheduleListLimit,validateScheduleName}from"#runtime/schedules/validation.js";import{dispatchScheduledOccurrence}from"#runtime/schedules/dispatch-occurrence.js";import{byPrincipal}from"#public/schedules/scope.js";function createScheduleCollectionClient(e,t){let n=t.operationId??randomUUID,contextFor=(e,n)=>{let r={...t,operation:e};return n!==void 0&&(r.name=n),r},resolveNamespace=async(r,i)=>{assertScheduleManagementAllowed(t.session.schedule);let a=contextFor(r,i),o=e.scope===void 0?byPrincipal(a):await e.scope({...a,operation:r});if(o===null)throw Error(`Schedule ${r} is not available in this context.`);return validateScope(o),{scope:o,provider:{abortSignal:t.abortSignal,collection:t.collection,namespace:deriveScheduleNamespace(t.application,t.collection,o),operationId:n(),target:{key:t.application,deliver:async({payload:n,occurrence:r})=>{await dispatchScheduledOccurrence({bundle:loadContext().require(BundleKey),collection:t.collection,definition:e,occurrence:{...r,collection:t.collection},payload:n})}}}}},prepareCreation=async n=>{let r=validateScheduleName(n.name);resolveScheduleTiming(n.expression);let{scope:i,provider:a}=await resolveNamespace(`create`,r),o=principalReference(t.session.auth.current);if(o===null)throw Error(`Creating a schedule requires an authenticated principal.`);let s=await validateSchedulePayload(e.inputSchema,n.payload),c={version:3,payload:e.preparePayload===void 0?s:await e.preparePayload(s,{...contextFor(`create`,r),operation:`create`,name:r}),scope:i,principal:o},l=createScheduleCollectionPayload({application:t.application,collection:t.collection,envelope:c}),u={displayName:r,expression:JSON.parse(JSON.stringify(n.expression)),envelope:l.envelope};if(Buffer.byteLength(JSON.stringify(u))>65536)throw Error(`Prepared schedule creation exceeds the 64 KB limit, including timing and payload.`);return{prepared:u,provider:a}};return{async prepareCreate(e){return(await prepareCreation(e)).prepared},async create(n,r){let{prepared:i,provider:a}=await prepareCreation(n);if(r!==void 0&&!isDeepStrictEqual(i,r))throw Error(`Schedule creation changed after approval. Request a new creation approval; no schedule was written.`);let o=`${i.displayName.slice(0,218)}--${randomUUID()}`,s=resolveScheduleTiming(n.expression),c=createScheduleCollectionPayload({application:t.application,collection:t.collection,envelope:i.envelope});return projectScheduleRecord(await e.provider.create(a,{expression:s,name:o,payload:c}))},async delete(t){let n=validateScheduleName(t),{provider:r}=await resolveNamespace(`delete`,n);return await e.provider.delete(r,n)},async disable(t){let n=validateScheduleName(t),{provider:r}=await resolveNamespace(`disable`,n);return projectScheduleRecord(await e.provider.disable(r,n))},async enable(t){let n=validateScheduleName(t),{provider:r}=await resolveNamespace(`enable`,n);return projectScheduleRecord(await e.provider.enable(r,n))},async get(t){let n=validateScheduleName(t),{provider:r}=await resolveNamespace(`get`,n),i=await e.provider.get(r,n);return i===null?null:projectScheduleRecord(i)},async invoke(t){let n=validateScheduleName(t),{provider:r}=await resolveNamespace(`invoke`,n);await e.provider.invoke(r,n)},async list(t={}){let n=validateScheduleListLimit(t.limit),{provider:r}=await resolveNamespace(`list`),i={};t.cursor?.trim()&&(i.cursor=t.cursor.trim()),n!==void 0&&(i.limit=n);let a=await e.provider.list(r,i);return{...a,data:a.data.map(projectScheduleRecord)}}}}function assertScheduleManagementAllowed(e){let t=contextStorage.getStore();if(e!==void 0||t!==void 0&&readSessionSchedule(t)!==void 0)throw Error(`Schedule management is unavailable during scheduled execution.`)}function principalReference(e){if(e===null||e.principalType===`anonymous`||e.principalType===`runtime`)return null;let t={type:e.principalType,authenticator:e.authenticator,principalId:e.principalId};return e.issuer!==void 0&&(t.issuer=e.issuer),e.subject!==void 0&&(t.subject=e.subject),t}function validateScope(e){let t=typeof e==`string`?[e]:e;if(t.length===0||t.some(e=>typeof e!=`string`||e.trim().length===0))throw Error(`Schedule scope must be a non-empty string or tuple of non-empty strings.`)}function deriveScheduleNamespace(e,t,n){if(e.trim().length===0)throw Error(`Schedule application must not be empty.`);return`eve-${createHash(`sha256`).update(JSON.stringify([`eve-schedule-namespace-v2`,e,t,n])).digest(`base64url`)}`}export{assertScheduleManagementAllowed,createScheduleCollectionClient};
1
+ import{createHash,randomUUID}from"node:crypto";import{contextStorage,loadContext}from"#context/container.js";import{projectScheduleRecord}from"#runtime/schedules/record.js";import{createScheduleCollectionPayload,validateSchedulePayload}from"#runtime/schedules/payload.js";import{isDeepStrictEqual}from"node:util";import{readSessionSchedule}from"#context/session-schedule.js";import{BundleKey}from"#runtime/sessions/runtime-context-keys.js";import{resolveScheduleTiming,validateScheduleListLimit,validateScheduleName}from"#runtime/schedules/validation.js";import{dispatchScheduledOccurrence}from"#runtime/schedules/dispatch-occurrence.js";import{byPrincipal}from"#public/schedules/scope.js";function createScheduleCollectionClient(e,t){let n=t.operationId??randomUUID,contextFor=(e,n)=>{let r={...t,operation:e};return n!==void 0&&(r.name=n),r},resolveNamespace=async(r,i)=>{assertScheduleManagementAllowed(t.session.schedule);let a=contextFor(r,i),o=e.scope===void 0?byPrincipal(a):await e.scope({...a,operation:r});if(o===null)throw Error(`Schedule ${r} is not available in this context.`);return validateScope(o),{scope:o,provider:{abortSignal:t.abortSignal,collection:t.collection,namespace:deriveScheduleNamespace(t.application,t.collection,o),operationId:n(),target:{key:t.application,deliver:async({payload:n,occurrence:r})=>{await dispatchScheduledOccurrence({bundle:loadContext().require(BundleKey),collection:t.collection,definition:e,occurrence:{...r,collection:t.collection},payload:n})}}}}},prepareEnvelope=async(n,r,i,a)=>{let o=principalReference(t.session.auth.current);if(o===null)throw Error(`Writing a schedule payload requires an authenticated principal.`);let s=await validateSchedulePayload(e.inputSchema,n),c=e.preparePayload===void 0?s:await e.preparePayload(s,{...contextFor(i,a),operation:i,name:a});return createScheduleCollectionPayload({application:t.application,collection:t.collection,envelope:{version:3,payload:c,scope:r,principal:o}}).envelope},prepareUpdate=async(t,n)=>{let r=Object.keys(n).filter(e=>e!==`expression`&&e!==`payload`);if(r.length>0)throw Error(`Schedule update does not support: ${r.join(`, `)}.`);if(n.expression===void 0&&n.payload===void 0)throw Error(`Schedule update requires an expression or replacement payload.`);let i=validateScheduleName(t);n.expression!==void 0&&resolveScheduleTiming(n.expression);let{scope:a,provider:o}=await resolveNamespace(`update`,i);if(await e.provider.get(o,i)===null)throw Error(`Schedule was not found in the authorized scope.`);return{prepared:snapshotPreparedWrite({name:i,namespace:o.namespace,expression:n.expression,envelope:n.payload===void 0?void 0:await prepareEnvelope(n.payload,a,`update`,i)}),provider:o}},prepareCreation=async e=>{let t=validateScheduleName(e.name);resolveScheduleTiming(e.expression);let{scope:n,provider:r}=await resolveNamespace(`create`,t);return{prepared:snapshotPreparedWrite({displayName:t,expression:e.expression,envelope:await prepareEnvelope(e.payload,n,`create`,t)}),provider:r}};return{async prepareCreate(e){return(await prepareCreation(e)).prepared},async create(n,r){let{prepared:i,provider:a}=await prepareCreation(n);if(r!==void 0&&!isDeepStrictEqual(i,r))throw Error(`Schedule creation changed after approval. Request a new creation approval; no schedule was written.`);let o=`${i.displayName.slice(0,218)}--${randomUUID()}`,s=resolveScheduleTiming(n.expression),c=createScheduleCollectionPayload({application:t.application,collection:t.collection,envelope:i.envelope});return projectScheduleRecord(await e.provider.create(a,{expression:s,name:o,payload:c}))},async prepareUpdate(e,t){return(await prepareUpdate(e,t)).prepared},async update(n,r,i){let{prepared:a,provider:o}=await prepareUpdate(n,r);if(i!==void 0&&!isDeepStrictEqual(a,i))throw Error(`Schedule update changed after approval. Request a new update approval; no schedule was written.`);let s={expression:a.expression===void 0?void 0:resolveScheduleTiming(a.expression),payload:a.envelope===void 0?void 0:createScheduleCollectionPayload({application:t.application,collection:t.collection,envelope:a.envelope})};return projectScheduleRecord(await e.provider.update(o,a.name,s))},async delete(t){let n=validateScheduleName(t),{provider:r}=await resolveNamespace(`delete`,n);return await e.provider.delete(r,n)},async disable(t){let n=validateScheduleName(t),{provider:r}=await resolveNamespace(`disable`,n);return projectScheduleRecord(await e.provider.disable(r,n))},async enable(t){let n=validateScheduleName(t),{provider:r}=await resolveNamespace(`enable`,n);return projectScheduleRecord(await e.provider.enable(r,n))},async get(t){let n=validateScheduleName(t),{provider:r}=await resolveNamespace(`get`,n),i=await e.provider.get(r,n);return i===null?null:projectScheduleRecord(i)},async invoke(t){let n=validateScheduleName(t),{provider:r}=await resolveNamespace(`invoke`,n);await e.provider.invoke(r,n)},async list(t={}){let n=validateScheduleListLimit(t.limit),{provider:r}=await resolveNamespace(`list`),i={};t.cursor?.trim()&&(i.cursor=t.cursor.trim()),n!==void 0&&(i.limit=n);let a=await e.provider.list(r,i);return{...a,data:a.data.map(projectScheduleRecord)}}}}function snapshotPreparedWrite(e){let t=JSON.stringify(e);if(Buffer.byteLength(t)>65536)throw Error(`Prepared schedule write exceeds the 64 KB limit, including timing and payload.`);return JSON.parse(t)}function assertScheduleManagementAllowed(e){let t=contextStorage.getStore();if(e!==void 0||t!==void 0&&readSessionSchedule(t)!==void 0)throw Error(`Schedule management is unavailable during scheduled execution.`)}function principalReference(e){if(e===null||e.principalType===`anonymous`||e.principalType===`runtime`)return null;let t={type:e.principalType,authenticator:e.authenticator,principalId:e.principalId};return e.issuer!==void 0&&(t.issuer=e.issuer),e.subject!==void 0&&(t.subject=e.subject),t}function validateScope(e){let t=typeof e==`string`?[e]:e;if(t.length===0||t.some(e=>typeof e!=`string`||e.trim().length===0))throw Error(`Schedule scope must be a non-empty string or tuple of non-empty strings.`)}function deriveScheduleNamespace(e,t,n){if(e.trim().length===0)throw Error(`Schedule application must not be empty.`);return`eve-${createHash(`sha256`).update(JSON.stringify([`eve-schedule-namespace-v2`,e,t,n])).digest(`base64url`)}`}export{assertScheduleManagementAllowed,createScheduleCollectionClient};
@@ -1,7 +1,7 @@
1
1
  import type { ContextAccessor } from "#context/key.js";
2
2
  import type { RuntimeModelReference } from "#runtime/agent/bootstrap.js";
3
3
  import type { RuntimeModelCatalog } from "#runtime/agent/model-catalog.js";
4
- import { type AgentLimitsDefinition, type AgentReasoningDefinition } from "#shared/agent-definition.js";
4
+ import { type AgentLimitsDefinition, type AgentReasoningDefinition, type AgentToolExposure } from "#shared/agent-definition.js";
5
5
  export interface DynamicSubagentAgentConfig {
6
6
  readonly compaction?: {
7
7
  readonly model?: DynamicSubagentModelReference;
@@ -11,7 +11,7 @@ export interface DynamicSubagentAgentConfig {
11
11
  readonly limits?: AgentLimitsDefinition;
12
12
  readonly model: DynamicSubagentModelReference;
13
13
  readonly reasoning?: AgentReasoningDefinition;
14
- readonly tool?: boolean;
14
+ readonly tool?: AgentToolExposure;
15
15
  }
16
16
  export type DynamicSubagentModelReference = RuntimeModelReference;
17
17
  export declare function normalizeDynamicSubagentAgentConfig(input: {
@@ -1,9 +1,10 @@
1
+ import type { AgentToolExposure } from "#shared/agent-definition.js";
1
2
  export interface DynamicRemoteAgentConfig {
2
3
  readonly credentialsStepId?: string;
3
4
  readonly description: string;
4
5
  readonly forwardPrincipal?: boolean;
5
6
  readonly path: string;
6
- readonly tool?: boolean;
7
+ readonly tool?: AgentToolExposure;
7
8
  readonly url: string;
8
9
  }
9
10
  export declare function normalizeDynamicRemoteAgentConfig(input: {
@@ -1 +1 @@
1
- import{expectBoolean,expectFunction,expectObjectRecord,expectOnlyKnownKeys,expectString,getOptionalStringRecordProperty}from"#internal/authored-module.js";import{EVE_SESSION_ROUTE_PATH}from"#protocol/routes.js";async function normalizeDynamicRemoteAgentConfig(e){let t=`Dynamic subagent "${e.name}" must return defineAgent(...), defineRemoteAgent(...), or null.`,n=expectObjectRecord(e.value,t);if(expectOnlyKnownKeys(n,[`auth`,`description`,`forwardPrincipal`,`headers`,`kind`,`path`,`tool`,`url`],t),n.kind!==`remote`)throw Error(t);let r=await resolveUrl(n.url,t),i=readCredentialsStepId(n);if(validateCredentials(n,t),(n.auth!==void 0||n.headers!==void 0)&&i===void 0)throw Error(`${t} Dynamic remote auth and headers must be compiled by eve so credentials stay out of durable workflow state.`);let a={description:expectString(n.description,t),path:n.path===void 0?EVE_SESSION_ROUTE_PATH:expectString(n.path,t),url:r};return i!==void 0&&(a.credentialsStepId=i),n.forwardPrincipal!==void 0&&(a.forwardPrincipal=expectBoolean(n.forwardPrincipal,t)),n.tool!==void 0&&(a.tool=expectBoolean(n.tool,t)),a}async function resolveUrl(e,t){let n=typeof e==`function`?await expectFunction(e,t)():expectString(e,t);if(n.length===0)throw Error(`${t} The "url" field must resolve to a non-empty string.`);return n}function validateCredentials(e,t){e.auth!==void 0&&expectFunction(e.auth,t),e.headers!==void 0&&typeof e.headers!=`function`&&getOptionalStringRecordProperty(e,`headers`,t)}function readCredentialsStepId(e){let t=e.__eveResolveRemoteAgentCredentials;if(typeof t!=`function`)return;let n=t.stepId;return typeof n==`string`?n:void 0}export{normalizeDynamicRemoteAgentConfig};
1
+ import{expectAgentToolExposure,expectBoolean,expectFunction,expectObjectRecord,expectOnlyKnownKeys,expectString,getOptionalStringRecordProperty}from"#internal/authored-module.js";import{EVE_SESSION_ROUTE_PATH}from"#protocol/routes.js";async function normalizeDynamicRemoteAgentConfig(e){let t=`Dynamic subagent "${e.name}" must return defineAgent(...), defineRemoteAgent(...), or null.`,n=expectObjectRecord(e.value,t);if(expectOnlyKnownKeys(n,[`auth`,`description`,`forwardPrincipal`,`headers`,`kind`,`path`,`tool`,`url`],t),n.kind!==`remote`)throw Error(t);let r=await resolveUrl(n.url,t),i=readCredentialsStepId(n);if(validateCredentials(n,t),(n.auth!==void 0||n.headers!==void 0)&&i===void 0)throw Error(`${t} Dynamic remote auth and headers must be compiled by eve so credentials stay out of durable workflow state.`);let a={description:expectString(n.description,t),path:n.path===void 0?EVE_SESSION_ROUTE_PATH:expectString(n.path,t),url:r};return i!==void 0&&(a.credentialsStepId=i),n.forwardPrincipal!==void 0&&(a.forwardPrincipal=expectBoolean(n.forwardPrincipal,t)),n.tool!==void 0&&(a.tool=expectAgentToolExposure(n.tool,t)),a}async function resolveUrl(e,t){let n=typeof e==`function`?await expectFunction(e,t)():expectString(e,t);if(n.length===0)throw Error(`${t} The "url" field must resolve to a non-empty string.`);return n}function validateCredentials(e,t){e.auth!==void 0&&expectFunction(e.auth,t),e.headers!==void 0&&typeof e.headers!=`function`&&getOptionalStringRecordProperty(e,`headers`,t)}function readCredentialsStepId(e){let t=e.__eveResolveRemoteAgentCredentials;if(typeof t!=`function`)return;let n=t.stepId;return typeof n==`string`?n:void 0}export{normalizeDynamicRemoteAgentConfig};
@@ -1,6 +1,7 @@
1
1
  import type { PreparedRuntimeDelegationTool } from "#runtime/sessions/turn.js";
2
2
  import type { ResolvedDynamicSubagentDefinition, ResolvedRuntimeDelegationNode } from "#runtime/types.js";
3
3
  import type { JsonObject } from "#shared/json.js";
4
+ import type { AgentToolExposure } from "#shared/agent-definition.js";
4
5
  /**
5
6
  * One runtime-owned subagent tracked by the prepared registry.
6
7
  */
@@ -12,7 +13,7 @@ export interface ResolvedDynamicSubagentResolver extends ResolvedDynamicSubagent
12
13
  readonly kind: "subagent";
13
14
  readonly name: string;
14
15
  readonly nodeId: string;
15
- readonly tool?: boolean;
16
+ readonly tool?: AgentToolExposure;
16
17
  }
17
18
  /**
18
19
  * Runtime-owned registry that keeps all resolved subagents addressable while
@@ -1 +1 @@
1
- import{serializeInputSchema}from"#tools/schema.js";import{SUBAGENT_TOOL_INPUT_SCHEMA}from"#tools/framework/agent-contract.js";import{RuntimeRegistry,RuntimeRegistryError}from"#internal/runtime-registry.js";const SUBAGENT_TOOL_INPUT_JSON_SCHEMA=serializeInputSchema(SUBAGENT_TOOL_INPUT_SCHEMA);function createRuntimeSubagentRegistry(e){let t=[],n=new Set,r=[],i=new RuntimeRegistry(`subagent`),a=new Set(e.reservedToolNames??[]),o=new Set(e.disabledToolNames??[]),s=new Map;for(let c of e.subagents){let e={logicalPath:c.logicalPath,sourceId:c.sourceId};if(s.has(c.nodeId))throw new RuntimeRegistryError(`subagent`,`Found multiple runtime subagents mapped to node id "${c.nodeId}".`,{...e,entryName:c.name});let l,u=c.kind===`subagent`?c.dynamic:void 0;if(u===void 0){let n=createPreparedRuntimeSubagentTool(c,SUBAGENT_TOOL_INPUT_JSON_SCHEMA);l={definition:c,prepared:n},i.register(c.name,l,{location:e,duplicateMessage:`Found multiple subagents named "${c.name}". Subagent names must be unique at runtime.`});let r=c.tool!==!1&&!o.has(c.name);if(r&&a.has(c.name))throw new RuntimeRegistryError(`subagent`,`Subagent "${c.name}" collides with another runtime-visible tool name.`,{...e,entryName:c.name});r&&t.push(n)}else n.add(c.nodeId),r.push({...u,kind:`subagent`,logicalPath:c.logicalPath,name:c.name,nodeId:c.nodeId,sourceId:c.sourceId,sourceKind:`module`,tool:!o.has(c.name)&&void 0}),l={definition:c};s.set(c.nodeId,l)}return{dynamicNodeIds:n,dynamicResolvers:r,preparedTools:t,subagentsByName:i.asMap(),subagentsByNodeId:s}}function createPreparedRuntimeSubagentTool(e,t=SUBAGENT_TOOL_INPUT_JSON_SCHEMA){if(e.description===void 0)throw Error(`Static subagent "${e.name}" is missing a description.`);return{behavior:{availability:[],handling:{kind:`dispatch`,target:e.kind===`remote`?{kind:`remote-agent-call`,nodeId:e.nodeId,remoteAgentName:e.name}:{kind:`subagent-call`,nodeId:e.nodeId,subagentName:e.name}}},description:e.description,inputSchema:t,kind:e.kind,logicalPath:e.logicalPath,name:e.name,nodeId:e.nodeId,sourceId:e.sourceId}}export{createPreparedRuntimeSubagentTool,createRuntimeSubagentRegistry};
1
+ import{serializeInputSchema}from"#tools/schema.js";import{eveNamespaceReservation}from"#protocol/runtime-tools.js";import{SUBAGENT_TOOL_INPUT_SCHEMA}from"#tools/framework/agent-contract.js";import{RuntimeRegistry,RuntimeRegistryError}from"#internal/runtime-registry.js";const SUBAGENT_TOOL_INPUT_JSON_SCHEMA=serializeInputSchema(SUBAGENT_TOOL_INPUT_SCHEMA);function createRuntimeSubagentRegistry(e){let t=[],n=new Set,r=[],i=new RuntimeRegistry(`subagent`),a=new Set(e.reservedToolNames??[]),o=new Set(e.disabledToolNames??[]),s=new Map;for(let c of e.subagents){let e={logicalPath:c.logicalPath,sourceId:c.sourceId};if(s.has(c.nodeId))throw new RuntimeRegistryError(`subagent`,`Found multiple runtime subagents mapped to node id "${c.nodeId}".`,{...e,entryName:c.name});let l,u=c.kind===`subagent`?c.dynamic:void 0;if(u===void 0){let n=createPreparedRuntimeSubagentTool(c,SUBAGENT_TOOL_INPUT_JSON_SCHEMA);l={definition:c,prepared:n},i.register(c.name,l,{location:e,duplicateMessage:duplicateSubagentMessage(c.name)});let r=c.tool!==!1&&!o.has(c.name),s=eveNamespaceReservation(c.name);if(s!==void 0)throw new RuntimeRegistryError(`subagent`,`Subagent "${c.logicalPath}" uses the reserved name "${c.name}". Rename its path; ${s}.`,{...e,entryName:c.name});if(r&&a.has(c.name))throw new RuntimeRegistryError(`subagent`,`Subagent "${c.name}" collides with another runtime-visible tool name.`,{...e,entryName:c.name});r&&t.push(n)}else n.add(c.nodeId),r.push({...u,kind:`subagent`,logicalPath:c.logicalPath,name:c.name,nodeId:c.nodeId,sourceId:c.sourceId,sourceKind:`module`,tool:!o.has(c.name)&&void 0}),l={definition:c};s.set(c.nodeId,l)}return assertUniqueDynamicSubagentNames(r,i.asMap()),{dynamicNodeIds:n,dynamicResolvers:r,preparedTools:t,subagentsByName:i.asMap(),subagentsByNodeId:s}}function createPreparedRuntimeSubagentTool(e,t=SUBAGENT_TOOL_INPUT_JSON_SCHEMA){if(e.description===void 0)throw Error(`Static subagent "${e.name}" is missing a description.`);return{behavior:{availability:[],handling:{kind:`dispatch`,target:e.kind===`remote`?{kind:`remote-agent-call`,nodeId:e.nodeId,remoteAgentName:e.name}:{kind:`subagent-call`,nodeId:e.nodeId,subagentName:e.name}}},deferred:e.tool===`deferred`||void 0,description:e.description,inputSchema:t,kind:e.kind,logicalPath:e.logicalPath,name:e.name,nodeId:e.nodeId,sourceId:e.sourceId}}function duplicateSubagentMessage(e){return`Found multiple subagents named "${e}". Subagent names must be unique at runtime.`}function assertUniqueDynamicSubagentNames(e,t){let n=new Set(t.keys());for(let{logicalPath:t,name:r,sourceId:i}of e){if(n.has(r))throw new RuntimeRegistryError(`subagent`,duplicateSubagentMessage(r),{entryName:r,logicalPath:t,sourceId:i});n.add(r)}}export{createPreparedRuntimeSubagentTool,createRuntimeSubagentRegistry};
@@ -21,6 +21,8 @@ export interface RuntimeToolRegistry {
21
21
  export declare function createRuntimeToolRegistry(definitions: {
22
22
  readonly tools: readonly ResolvedToolDefinition[];
23
23
  }, input?: {
24
+ /** Set by `tool: "deferred"` on the agent, which defers its built-in `agent` tool. */
25
+ readonly deferSelfAgent?: boolean;
24
26
  readonly nodeId?: string;
25
27
  readonly reservedToolNames?: readonly string[];
26
28
  }): Promise<RuntimeToolRegistry>;
@@ -1 +1 @@
1
- import{serializeInputSchema,serializeOutputSchema}from"#tools/schema.js";import{AGENT_TOOL_NAME}from"#tools/framework/agent-contract.js";import{RuntimeRegistry}from"#internal/runtime-registry.js";async function createRuntimeToolRegistry(e,t={}){let n=[],r=new RuntimeRegistry(`tool`,t.reservedToolNames??[]);for(let i of e.tools){let e=await createPreparedRuntimeTool(i,t.nodeId);r.register(i.name,{definition:i,prepared:e},{location:{logicalPath:i.logicalPath,sourceId:i.sourceId},duplicateMessage:`Found multiple authored tools named "${i.name}". Tool names must be unique at runtime.`,reservedMessage:`Tool "${i.name}" collides with another runtime-visible tool name.`}),n.push(e)}return{preparedTools:n,toolsByName:r.asMap()}}function findRegisteredRuntimeTool(e,t){return e.toolsByName.get(t)??null}async function createPreparedRuntimeTool(e,t){let n=e.behavior?.handling?.kind===`dispatch`&&e.behavior.handling.action===`self-agent`;return{availableInSubagents:e.availableInSubagents,behavior:prepareToolBehavior(e.behavior,t),description:e.description,inputSchema:serializeInputSchema(e.inputSchema),kind:`authored-tool`,logicalPath:e.logicalPath,name:e.name,owner:e.owner,outputSchema:serializeOutputSchema(e.outputSchema),rootOnly:n||void 0,sourceId:e.sourceId}}function prepareToolBehavior(e,t){if(e===void 0)return;let n;if(e.handling?.kind===`dispatch`){if(t===void 0)throw Error(`The self-agent tool requires a concrete runtime node id.`);n={kind:`dispatch`,target:{kind:`self-agent-call`,nodeId:t,subagentName:AGENT_TOOL_NAME}}}else n=e.handling?.kind===`workflow-tool`?{kind:`dispatch`,target:{entryPoint:e.handling.entryPoint,kind:`workflow-tool-call`,workflowId:e.handling.workflowId}}:e.handling;return{availability:e.availability,handling:n,presentation:e.presentation}}export{createRuntimeToolRegistry,findRegisteredRuntimeTool};
1
+ import{serializeInputSchema,serializeOutputSchema}from"#tools/schema.js";import{AGENT_TOOL_NAME}from"#tools/framework/agent-contract.js";import{RuntimeRegistry}from"#internal/runtime-registry.js";async function createRuntimeToolRegistry(e,t={}){let n=[],r=new RuntimeRegistry(`tool`,t.reservedToolNames??[]);for(let i of e.tools){let e=await createPreparedRuntimeTool(i,t);r.register(i.name,{definition:i,prepared:e},{location:{logicalPath:i.logicalPath,sourceId:i.sourceId},duplicateMessage:`Found multiple authored tools named "${i.name}". Tool names must be unique at runtime.`,reservedMessage:`Tool "${i.name}" collides with another runtime-visible tool name.`}),n.push(e)}return{preparedTools:n,toolsByName:r.asMap()}}function findRegisteredRuntimeTool(e,t){return e.toolsByName.get(t)??null}async function createPreparedRuntimeTool(e,t){let n=e.behavior?.handling?.kind===`dispatch`&&e.behavior.handling.action===`self-agent`;return{availableInSubagents:e.availableInSubagents,behavior:prepareToolBehavior(e.behavior,t.nodeId),deferred:e.deferred??(n&&t.deferSelfAgent||void 0),description:e.description,inputSchema:serializeInputSchema(e.inputSchema),kind:`authored-tool`,logicalPath:e.logicalPath,name:e.name,owner:e.owner,outputSchema:serializeOutputSchema(e.outputSchema),rootOnly:n||void 0,sourceId:e.sourceId}}function prepareToolBehavior(e,t){if(e===void 0)return;let n;if(e.handling?.kind===`dispatch`){if(t===void 0)throw Error(`The self-agent tool requires a concrete runtime node id.`);n={kind:`dispatch`,target:{kind:`self-agent-call`,nodeId:t,subagentName:AGENT_TOOL_NAME}}}else n=e.handling?.kind===`workflow-tool`?{kind:`dispatch`,target:{entryPoint:e.handling.entryPoint,kind:`workflow-tool-call`,workflowId:e.handling.workflowId}}:e.handling;return{availability:e.availability,handling:n}}export{createRuntimeToolRegistry,findRegisteredRuntimeTool};