eve 0.47.7 → 0.48.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 (271) hide show
  1. package/CHANGELOG.md +20 -0
  2. package/dist/src/channel/delivery-metadata.d.ts +1 -0
  3. package/dist/src/channel/delivery-metadata.js +1 -1
  4. package/dist/src/channel/types.d.ts +10 -8
  5. package/dist/src/chunks/{use-eve-agent-Dg5S44kG.js → use-eve-agent-BZnOzAVd.js} +25 -5
  6. package/dist/src/chunks/{use-eve-agent-B5zw1dwj.js → use-eve-agent-Bgp6INfi.js} +25 -5
  7. package/dist/src/cli/commands/init.js +1 -1
  8. package/dist/src/cli/commands/integration-connect.d.ts +2 -1
  9. package/dist/src/cli/commands/integration-connect.js +1 -1
  10. package/dist/src/cli/commands/register-integration-commands.d.ts +3 -1
  11. package/dist/src/cli/commands/register-integration-commands.js +1 -1
  12. package/dist/src/cli/dev/command-options.d.ts +2 -0
  13. package/dist/src/cli/dev/run-interactive-ui.js +1 -1
  14. package/dist/src/cli/dev/tui/blocks.js +1 -1
  15. package/dist/src/cli/dev/tui/prompt-command-handler.js +1 -1
  16. package/dist/src/cli/dev/tui/registry-result-message.d.ts +17 -0
  17. package/dist/src/cli/dev/tui/registry-result-message.js +3 -0
  18. package/dist/src/cli/dev/tui/runner.d.ts +11 -4
  19. package/dist/src/cli/dev/tui/runner.js +1 -1
  20. package/dist/src/cli/dev/tui/setup-commands.d.ts +9 -3
  21. package/dist/src/cli/dev/tui/setup-commands.js +2 -3
  22. package/dist/src/cli/dev/tui/setup-flow.d.ts +15 -5
  23. package/dist/src/cli/dev/tui/setup-panel.d.ts +6 -1
  24. package/dist/src/cli/dev/tui/setup-panel.js +4 -4
  25. package/dist/src/cli/dev/tui/setup-selection-input.d.ts +1 -0
  26. package/dist/src/cli/dev/tui/setup-selection-input.js +1 -1
  27. package/dist/src/cli/dev/tui/terminal-renderer.js +12 -12
  28. package/dist/src/cli/dev/tui/tui-prompter.js +1 -1
  29. package/dist/src/cli/dev/tui/tui.d.ts +3 -4
  30. package/dist/src/cli/dev/tui/tui.js +1 -1
  31. package/dist/src/cli/run.js +2 -2
  32. package/dist/src/client/agent-info-schema.d.ts +1 -0
  33. package/dist/src/client/agent-info-schema.js +1 -1
  34. package/dist/src/client/open-stream.d.ts +1 -0
  35. package/dist/src/client/open-stream.js +1 -1
  36. package/dist/src/client/session.js +1 -1
  37. package/dist/src/compiled/.vendor-stamp.json +2 -1
  38. package/dist/src/compiled/@opentelemetry/api/index.d.ts +6 -0
  39. package/dist/src/compiled/@workflow/builders/LICENSE.md +201 -0
  40. package/dist/src/compiled/@workflow/builders/index.d.ts +62 -0
  41. package/dist/src/compiled/@workflow/builders/index.js +1 -0
  42. package/dist/src/compiler/extension-compatibility.d.ts +2 -2
  43. package/dist/src/compiler/extension-compatibility.js +1 -1
  44. package/dist/src/compiler/manifest.d.ts +2 -2
  45. package/dist/src/compiler/manifest.js +1 -1
  46. package/dist/src/compiler/normalize-tool.js +1 -1
  47. package/dist/src/context/keys.d.ts +3 -8
  48. package/dist/src/eve-channel/index.js +1 -1
  49. package/dist/src/eve-channel/types.d.ts +7 -7
  50. package/dist/src/execution/accepted-delivery-deployment.d.ts +7 -0
  51. package/dist/src/execution/accepted-delivery-deployment.js +1 -0
  52. package/dist/src/execution/cancel-descendant-turns-step.d.ts +4 -1
  53. package/dist/src/execution/cancel-descendant-turns-step.js +1 -1
  54. package/dist/src/execution/delegation-tool.js +1 -1
  55. package/dist/src/execution/dispatch-runtime-actions-shared.d.ts +7 -2
  56. package/dist/src/execution/dispatch-runtime-actions-shared.js +1 -1
  57. package/dist/src/execution/dispatch-runtime-actions-step.js +1 -1
  58. package/dist/src/execution/dispatch-turn-step.js +1 -1
  59. package/dist/src/execution/durable-session-migrations/turn-workflow-v1-to-v2.d.ts +2 -0
  60. package/dist/src/execution/durable-session-migrations/turn-workflow-v1-to-v2.js +1 -0
  61. package/dist/src/execution/durable-session-migrations/turn-workflow.d.ts +25 -3
  62. package/dist/src/execution/durable-session-migrations/turn-workflow.js +1 -1
  63. package/dist/src/execution/eve-workflow-attributes.js +1 -1
  64. package/dist/src/execution/finalize-terminal-session.d.ts +17 -0
  65. package/dist/src/execution/finalize-terminal-session.js +1 -0
  66. package/dist/src/execution/inline-turn.d.ts +29 -0
  67. package/dist/src/execution/inline-turn.js +1 -0
  68. package/dist/src/execution/next-driver-action.d.ts +4 -0
  69. package/dist/src/execution/node-step.js +1 -1
  70. package/dist/src/execution/parked-delivery-wait.js +1 -1
  71. package/dist/src/execution/pending-turn-state.d.ts +1 -0
  72. package/dist/src/execution/pending-turn-state.js +1 -1
  73. package/dist/src/execution/proxied-deliver-step.js +1 -1
  74. package/dist/src/execution/remote-agent-dispatch.d.ts +2 -0
  75. package/dist/src/execution/remote-agent-dispatch.js +1 -1
  76. package/dist/src/execution/session-command-token.d.ts +2 -0
  77. package/dist/src/execution/session-command-token.js +1 -1
  78. package/dist/src/execution/settle-cancelled-turn-step.js +1 -1
  79. package/dist/src/execution/stable-workflow-names.d.ts +12 -0
  80. package/dist/src/execution/stable-workflow-names.js +1 -0
  81. package/dist/src/execution/subagent-event-proxy-step.d.ts +3 -0
  82. package/dist/src/execution/subagent-event-proxy-step.js +1 -1
  83. package/dist/src/execution/subagent-hitl-proxy.d.ts +2 -1
  84. package/dist/src/execution/subagent-hitl-proxy.js +1 -1
  85. package/dist/src/execution/subagent-start-remote.d.ts +2 -0
  86. package/dist/src/execution/subagent-start-remote.js +1 -1
  87. package/dist/src/execution/tasks/child/steps.d.ts +2 -0
  88. package/dist/src/execution/tasks/child/steps.js +1 -1
  89. package/dist/src/execution/tasks/child/workflow.js +1 -1
  90. package/dist/src/execution/tasks/parent/dispatch-task-step.js +1 -1
  91. package/dist/src/execution/tasks/parent/dispatch.js +1 -1
  92. package/dist/src/execution/tasks/parent/hitl-proxy-steps.js +1 -1
  93. package/dist/src/execution/tasks/parent/tool-execution.js +1 -1
  94. package/dist/src/execution/terminal-session-completion-step.js +1 -1
  95. package/dist/src/execution/terminal-session-event.d.ts +13 -0
  96. package/dist/src/execution/terminal-session-event.js +1 -0
  97. package/dist/src/execution/terminal-session-failure-step.d.ts +1 -0
  98. package/dist/src/execution/terminal-session-failure-step.js +1 -1
  99. package/dist/src/execution/tool-run/answer.d.ts +3 -0
  100. package/dist/src/execution/tool-run/answer.js +1 -0
  101. package/dist/src/execution/tool-run/background.d.ts +14 -0
  102. package/dist/src/execution/tool-run/background.js +1 -0
  103. package/dist/src/execution/tool-run/cancel.d.ts +7 -0
  104. package/dist/src/execution/tool-run/cancel.js +1 -0
  105. package/dist/src/execution/tool-run/dispatch.d.ts +24 -0
  106. package/dist/src/execution/tool-run/dispatch.js +1 -0
  107. package/dist/src/execution/tool-run/emit-run-report-step.d.ts +7 -0
  108. package/dist/src/execution/tool-run/emit-run-report-step.js +1 -0
  109. package/dist/src/execution/tool-run/messages.d.ts +70 -0
  110. package/dist/src/execution/tool-run/messages.js +1 -0
  111. package/dist/src/execution/tool-run/owner-channels.d.ts +29 -0
  112. package/dist/src/execution/tool-run/owner-channels.js +1 -0
  113. package/dist/src/execution/tool-run/owner-inbox.d.ts +11 -0
  114. package/dist/src/execution/tool-run/owner-inbox.js +1 -0
  115. package/dist/src/execution/tool-run/owner.d.ts +13 -0
  116. package/dist/src/execution/tool-run/owner.js +1 -0
  117. package/dist/src/execution/tool-run/resume-hook-step.d.ts +4 -0
  118. package/dist/src/execution/tool-run/resume-hook-step.js +1 -0
  119. package/dist/src/execution/tool-run/run-control.d.ts +18 -0
  120. package/dist/src/execution/tool-run/run-control.js +1 -0
  121. package/dist/src/execution/tool-run/start.d.ts +11 -0
  122. package/dist/src/execution/tool-run/start.js +1 -0
  123. package/dist/src/execution/tool-run/types.d.ts +21 -0
  124. package/dist/src/execution/tool-run/types.js +1 -0
  125. package/dist/src/execution/tool-run/workflow.d.ts +9 -0
  126. package/dist/src/execution/tool-run/workflow.js +1 -0
  127. package/dist/src/execution/tools/subagent/local.js +1 -1
  128. package/dist/src/execution/turn-cancellation-control.d.ts +2 -0
  129. package/dist/src/execution/turn-cancellation-control.js +1 -1
  130. package/dist/src/execution/turn-control-receiver.js +1 -1
  131. package/dist/src/execution/turn-dispatch.d.ts +4 -2
  132. package/dist/src/execution/turn-dispatch.js +1 -1
  133. package/dist/src/execution/turn-execution-cursor.js +1 -1
  134. package/dist/src/execution/turn-workflow.js +1 -1
  135. package/dist/src/execution/wire/session-inbox-contract.d.ts +2 -2
  136. package/dist/src/execution/wire/session-inbox-contract.js +1 -1
  137. package/dist/src/execution/wire/session-inbox-encoder.d.ts +6 -2
  138. package/dist/src/execution/wire/session-inbox-encoder.js +1 -1
  139. package/dist/src/execution/wire/session-inbox-resume.js +1 -1
  140. package/dist/src/execution/wire/session-inbox-wire.js +1 -1
  141. package/dist/src/execution/wire/session-inbox-wire.v1.js +1 -1
  142. package/dist/src/execution/wire/session-inbox-wire.v2-migration.d.ts +0 -2
  143. package/dist/src/execution/wire/session-inbox-wire.v2-migration.js +1 -1
  144. package/dist/src/execution/wire/session-inbox-wire.v2.migration.d.ts +3 -0
  145. package/dist/src/execution/wire/session-inbox-wire.v2.migration.js +1 -0
  146. package/dist/src/execution/wire/session-inbox-wire.v3.d.ts +480 -0
  147. package/dist/src/execution/wire/session-inbox-wire.v3.js +1 -0
  148. package/dist/src/execution/wire/session-inbox-wire.v3.migration.d.ts +3 -0
  149. package/dist/src/execution/wire/session-inbox-wire.v3.migration.js +1 -0
  150. package/dist/src/execution/workflow-entry-finalization.js +1 -1
  151. package/dist/src/execution/workflow-entry.js +1 -1
  152. package/dist/src/execution/workflow-registry.d.ts +5 -0
  153. package/dist/src/execution/workflow-registry.js +1 -0
  154. package/dist/src/execution/workflow-runtime.d.ts +9 -11
  155. package/dist/src/execution/workflow-runtime.js +1 -1
  156. package/dist/src/execution/workflow-steps.js +1 -1
  157. package/dist/src/execution/workflow-webhook-route.d.ts +4 -0
  158. package/dist/src/execution/workflow-webhook-route.js +1 -0
  159. package/dist/src/harness/attachment-staging.js +1 -1
  160. package/dist/src/harness/emission.js +1 -1
  161. package/dist/src/harness/proxy-input-requests.d.ts +10 -0
  162. package/dist/src/harness/proxy-input-requests.js +1 -1
  163. package/dist/src/harness/runtime-actions.d.ts +2 -0
  164. package/dist/src/harness/runtime-actions.js +1 -1
  165. package/dist/src/harness/session-limit-enforcement.js +1 -1
  166. package/dist/src/harness/tool-loop.js +2 -2
  167. package/dist/src/harness/tool-runs.d.ts +21 -0
  168. package/dist/src/harness/tool-runs.js +1 -0
  169. package/dist/src/harness/tools.js +1 -1
  170. package/dist/src/instrumentation/content-policy.d.ts +3 -1
  171. package/dist/src/instrumentation/content-policy.js +1 -1
  172. package/dist/src/instrumentation/runtime.d.ts +2 -2
  173. package/dist/src/instrumentation/runtime.js +1 -1
  174. package/dist/src/internal/application/package.js +1 -1
  175. package/dist/src/internal/attachments/errors.d.ts +3 -0
  176. package/dist/src/internal/authored-module-loader.d.ts +7 -1
  177. package/dist/src/internal/authored-module-loader.js +3 -3
  178. package/dist/src/internal/authored-package-boundary.js +1 -1
  179. package/dist/src/internal/authored-runtime-modules.d.ts +2 -0
  180. package/dist/src/internal/authored-runtime-modules.js +1 -1
  181. package/dist/src/internal/nitro/development-generation.d.ts +2 -0
  182. package/dist/src/internal/nitro/development-generation.js +1 -1
  183. package/dist/src/internal/nitro/host/create-application-nitro.js +1 -1
  184. package/dist/src/internal/nitro/host/dev-host-fingerprint.js +1 -1
  185. package/dist/src/internal/nitro/routes/agent-info/build-agent-info-response.js +1 -1
  186. package/dist/src/internal/nitro/routes/channel-dispatch.js +1 -1
  187. package/dist/src/internal/workflow-bundle/authored-workflow-directives.d.ts +17 -0
  188. package/dist/src/internal/workflow-bundle/authored-workflow-directives.js +1 -0
  189. package/dist/src/internal/workflow-bundle/authored-workflow-modules.d.ts +19 -0
  190. package/dist/src/internal/workflow-bundle/authored-workflow-modules.js +1 -0
  191. package/dist/src/internal/workflow-bundle/builder-support.d.ts +17 -2
  192. package/dist/src/internal/workflow-bundle/builder-support.js +4 -3
  193. package/dist/src/internal/workflow-bundle/builder.d.ts +2 -2
  194. package/dist/src/internal/workflow-bundle/builder.js +2 -2
  195. package/dist/src/internal/workflow-bundle/dynamic-capability-transform-plugin.d.ts +2 -0
  196. package/dist/src/internal/workflow-bundle/dynamic-capability-transform-plugin.js +1 -1
  197. package/dist/src/internal/workflow-bundle/dynamic-tool-ast-references.d.ts +3 -0
  198. package/dist/src/internal/workflow-bundle/dynamic-tool-transform.d.ts +1 -1
  199. package/dist/src/internal/workflow-bundle/dynamic-tool-transform.js +1 -1
  200. package/dist/src/internal/workflow-bundle/workflow-builders.d.ts +6 -2
  201. package/dist/src/internal/workflow-bundle/workflow-builders.js +1 -1
  202. package/dist/src/internal/workflow-bundle/workflow-core-shim.d.ts +3 -0
  203. package/dist/src/internal/workflow-bundle/workflow-core-shim.js +1 -1
  204. package/dist/src/internal/workflow-bundle/workflow-directive-ast.d.ts +7 -0
  205. package/dist/src/internal/workflow-bundle/workflow-directive-ast.js +1 -0
  206. package/dist/src/internal/workflow-bundle/workflow-transformer.d.ts +15 -1
  207. package/dist/src/internal/workflow-bundle/workflow-transformer.js +4 -4
  208. package/dist/src/packages/eve-catalog/src/index.js +1 -1
  209. package/dist/src/protocol/baggage.d.ts +6 -0
  210. package/dist/src/protocol/baggage.js +1 -0
  211. package/dist/src/public/channels/slack/attachments.js +1 -1
  212. package/dist/src/public/channels/teams/attachments.d.ts +2 -2
  213. package/dist/src/public/channels/teams/attachments.js +1 -1
  214. package/dist/src/public/channels/teams/teamsChannel.js +1 -1
  215. package/dist/src/public/channels/telegram/attachments.js +1 -1
  216. package/dist/src/public/definitions/remote-agent.d.ts +6 -3
  217. package/dist/src/public/workflow/index.d.ts +3 -0
  218. package/dist/src/public/workflow/index.js +1 -0
  219. package/dist/src/public/workflow-modules.d.js +1 -0
  220. package/dist/src/public/workflow-modules.d.ts +11 -0
  221. package/dist/src/runtime/actions/keys.js +1 -1
  222. package/dist/src/runtime/tools/registry.js +1 -1
  223. package/dist/src/setup/connection-connector.d.ts +4 -2
  224. package/dist/src/setup/connection-connector.js +2 -2
  225. package/dist/src/setup/flows/login.js +1 -1
  226. package/dist/src/setup/flows/model.js +1 -1
  227. package/dist/src/setup/flows/provider.d.ts +5 -0
  228. package/dist/src/setup/flows/provider.js +4 -4
  229. package/dist/src/setup/flows/registry-session.d.ts +24 -7
  230. package/dist/src/setup/flows/registry-session.js +1 -1
  231. package/dist/src/setup/flows/registry.d.ts +35 -29
  232. package/dist/src/setup/flows/registry.js +2 -1
  233. package/dist/src/setup/integrations/web/setup.d.ts +0 -2
  234. package/dist/src/setup/integrations/web/setup.js +1 -1
  235. package/dist/src/setup/prompter.d.ts +24 -4
  236. package/dist/src/setup/prompter.js +1 -1
  237. package/dist/src/setup/scaffold/create/project.js +2 -2
  238. package/dist/src/setup/vercel-project.js +0 -0
  239. package/dist/src/shared/dispatch-action.d.ts +6 -0
  240. package/dist/src/shared/forwarded-trace-policy.d.ts +28 -0
  241. package/dist/src/shared/forwarded-trace-policy.js +1 -0
  242. package/dist/src/shared/instrumentation-decision.d.ts +3 -0
  243. package/dist/src/shared/instrumentation-decision.js +1 -1
  244. package/dist/src/svelte/index.js +1 -1
  245. package/dist/src/svelte/use-eve-agent.js +1 -1
  246. package/dist/src/tools/behavior.d.ts +6 -0
  247. package/dist/src/tools/definition.d.ts +39 -3
  248. package/dist/src/tracing/agent-otel-provider.js +2 -2
  249. package/dist/src/tracing/agent-otel-session-context.js +1 -1
  250. package/dist/src/tracing/agent-trace-context-store.d.ts +1 -1
  251. package/dist/src/tracing/agent-trace-context-store.js +1 -1
  252. package/dist/src/tracing/otel-declaration.d.ts +5 -3
  253. package/dist/src/tracing/otel-registration.d.ts +1 -1
  254. package/dist/src/tracing/otel-registration.js +1 -1
  255. package/dist/src/vue/index.js +1 -1
  256. package/dist/src/vue/use-eve-agent.js +1 -1
  257. package/docs/channels/custom.mdx +2 -0
  258. package/docs/channels/eve.mdx +5 -1
  259. package/docs/channels/teams.mdx +6 -1
  260. package/docs/concepts/sessions-runs-and-streaming.md +4 -2
  261. package/docs/guides/auth-and-route-protection.md +5 -1
  262. package/docs/guides/client/messages.mdx +6 -0
  263. package/docs/guides/dev-tui.md +30 -18
  264. package/docs/guides/remote-agents.md +25 -0
  265. package/docs/reference/cli.md +2 -2
  266. package/docs/tools/meta.json +1 -1
  267. package/docs/tools/overview.mdx +7 -0
  268. package/docs/tools/workflows.mdx +288 -0
  269. package/package.json +12 -1
  270. package/dist/src/internal/authored-directive-prologue.d.ts +0 -4
  271. package/dist/src/internal/authored-directive-prologue.js +0 -1
@@ -0,0 +1,480 @@
1
+ import { z } from "#compiled/zod/index.js";
2
+ import type { DeliverHookPayload, SessionCommand, SessionTimeoutHookPayload } from "#channel/types.js";
3
+ /** Version 3 adds the trusted deployment that accepted each channel delivery. */
4
+ export declare const sessionInboxWireV3Schema: z.ZodDiscriminatedUnion<[z.ZodObject<{
5
+ auth: z.ZodOptional<z.ZodNullable<z.ZodObject<{
6
+ attributes: z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>>;
7
+ authenticator: z.ZodString;
8
+ issuer: z.ZodOptional<z.ZodString>;
9
+ principalId: z.ZodString;
10
+ principalType: z.ZodString;
11
+ subject: z.ZodOptional<z.ZodString>;
12
+ }, z.core.$strict>>>;
13
+ kind: z.ZodLiteral<"deliver">;
14
+ payloads: z.ZodArray<z.ZodObject<{
15
+ context: z.ZodOptional<z.ZodArray<z.ZodString>>;
16
+ inputResponses: z.ZodOptional<z.ZodArray<z.ZodObject<{
17
+ optionId: z.ZodOptional<z.ZodString>;
18
+ requestId: z.ZodString;
19
+ text: z.ZodOptional<z.ZodString>;
20
+ }, z.core.$strict>>>;
21
+ message: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
22
+ providerOptions: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<import("../../shared/json.ts").JsonObject, unknown, z.core.$ZodTypeInternals<import("../../shared/json.ts").JsonObject, unknown>>>>;
23
+ text: z.ZodString;
24
+ type: z.ZodLiteral<"text">;
25
+ }, z.core.$strict>, z.ZodObject<{
26
+ image: z.ZodCustom<URL | import("ai").DataContent, URL | import("ai").DataContent>;
27
+ mediaType: z.ZodOptional<z.ZodString>;
28
+ providerOptions: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<import("../../shared/json.ts").JsonObject, unknown, z.core.$ZodTypeInternals<import("../../shared/json.ts").JsonObject, unknown>>>>;
29
+ type: z.ZodLiteral<"image">;
30
+ }, z.core.$strict>, z.ZodObject<{
31
+ data: z.ZodCustom<URL | import("ai").DataContent, URL | import("ai").DataContent>;
32
+ filename: z.ZodOptional<z.ZodString>;
33
+ mediaType: z.ZodString;
34
+ providerOptions: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<import("../../shared/json.ts").JsonObject, unknown, z.core.$ZodTypeInternals<import("../../shared/json.ts").JsonObject, unknown>>>>;
35
+ type: z.ZodLiteral<"file">;
36
+ }, z.core.$strict>], "type">>]>>;
37
+ outputSchema: z.ZodOptional<z.ZodType<import("../../shared/json.ts").JsonObject, unknown, z.core.$ZodTypeInternals<import("../../shared/json.ts").JsonObject, unknown>>>;
38
+ task: z.ZodOptional<z.ZodObject<{
39
+ authorizationEvents: z.ZodOptional<z.ZodArray<z.ZodObject<{
40
+ hookPayload: z.ZodObject<{
41
+ callId: z.ZodString;
42
+ childSessionId: z.ZodString;
43
+ event: z.ZodCustom<Record<string, unknown>, Record<string, unknown>>;
44
+ kind: z.ZodLiteral<"subagent-authorization-event">;
45
+ subagentName: z.ZodString;
46
+ }, z.core.$strict>;
47
+ taskId: z.ZodString;
48
+ }, z.core.$strict>>>;
49
+ inputRequests: z.ZodOptional<z.ZodArray<z.ZodObject<{
50
+ hookPayload: z.ZodObject<{
51
+ callId: z.ZodString;
52
+ childContinuationToken: z.ZodString;
53
+ childSessionId: z.ZodString;
54
+ event: z.ZodObject<{
55
+ requests: z.ZodArray<z.ZodObject<{
56
+ action: z.ZodObject<{
57
+ callId: z.ZodString;
58
+ input: z.ZodType<import("../../shared/json.ts").JsonObject, unknown, z.core.$ZodTypeInternals<import("../../shared/json.ts").JsonObject, unknown>>;
59
+ kind: z.ZodLiteral<"tool-call">;
60
+ toolName: z.ZodString;
61
+ }, z.core.$strict>;
62
+ allowFreeform: z.ZodOptional<z.ZodBoolean>;
63
+ display: z.ZodOptional<z.ZodEnum<{
64
+ confirmation: "confirmation";
65
+ select: "select";
66
+ text: "text";
67
+ }>>;
68
+ kind: z.ZodEnum<{
69
+ question: "question";
70
+ "session-limit": "session-limit";
71
+ "tool-approval": "tool-approval";
72
+ }>;
73
+ options: z.ZodOptional<z.ZodArray<z.ZodObject<{
74
+ description: z.ZodOptional<z.ZodString>;
75
+ id: z.ZodString;
76
+ label: z.ZodString;
77
+ style: z.ZodOptional<z.ZodEnum<{
78
+ danger: "danger";
79
+ default: "default";
80
+ primary: "primary";
81
+ }>>;
82
+ }, z.core.$strict>>>;
83
+ prompt: z.ZodString;
84
+ requestId: z.ZodString;
85
+ }, z.core.$strict>>;
86
+ sequence: z.ZodNumber;
87
+ stepIndex: z.ZodNumber;
88
+ turnId: z.ZodString;
89
+ }, z.core.$strict>;
90
+ kind: z.ZodLiteral<"subagent-input-request">;
91
+ subagentName: z.ZodString;
92
+ }, z.core.$strict>;
93
+ taskId: z.ZodString;
94
+ }, z.core.$strict>>>;
95
+ views: z.ZodOptional<z.ZodArray<z.ZodType<import("../../tasks/types.ts").TaskView, unknown, z.core.$ZodTypeInternals<import("../../tasks/types.ts").TaskView, unknown>>>>;
96
+ }, z.core.$strict>>;
97
+ }, z.core.$loose>>;
98
+ requestId: z.ZodOptional<z.ZodString>;
99
+ taskDeliveryId: z.ZodOptional<z.ZodString>;
100
+ turnPolicy: z.ZodOptional<z.ZodEnum<{
101
+ queue: "queue";
102
+ steer: "steer";
103
+ }>>;
104
+ caller: z.ZodOptional<z.ZodObject<{
105
+ callId: z.ZodString;
106
+ replyTo: z.ZodDiscriminatedUnion<[z.ZodObject<{
107
+ kind: z.ZodLiteral<"hook">;
108
+ token: z.ZodString;
109
+ }, z.core.$strict>, z.ZodObject<{
110
+ kind: z.ZodLiteral<"callback">;
111
+ token: z.ZodString;
112
+ url: z.ZodString;
113
+ }, z.core.$strict>], "kind">;
114
+ subagentName: z.ZodString;
115
+ taskId: z.ZodOptional<z.ZodString>;
116
+ activityObserver: z.ZodOptional<z.ZodObject<{
117
+ sink: z.ZodObject<{
118
+ url: z.ZodString;
119
+ version: z.ZodLiteral<1>;
120
+ }, z.core.$strict>;
121
+ workIdentity: z.ZodOptional<z.ZodObject<{
122
+ callId: z.ZodOptional<z.ZodString>;
123
+ id: z.ZodString;
124
+ kind: z.ZodEnum<{
125
+ "remote-agent": "remote-agent";
126
+ "root-turn": "root-turn";
127
+ subagent: "subagent";
128
+ task: "task";
129
+ }>;
130
+ name: z.ZodOptional<z.ZodString>;
131
+ parentId: z.ZodOptional<z.ZodString>;
132
+ rootSessionId: z.ZodString;
133
+ rootTurnId: z.ZodString;
134
+ sessionId: z.ZodOptional<z.ZodString>;
135
+ turnId: z.ZodOptional<z.ZodString>;
136
+ }, z.core.$strict>>;
137
+ }, z.core.$strict>>;
138
+ }, z.core.$strict>>;
139
+ payload: z.ZodObject<{
140
+ context: z.ZodOptional<z.ZodArray<z.ZodString>>;
141
+ inputResponses: z.ZodOptional<z.ZodArray<z.ZodObject<{
142
+ optionId: z.ZodOptional<z.ZodString>;
143
+ requestId: z.ZodString;
144
+ text: z.ZodOptional<z.ZodString>;
145
+ }, z.core.$strict>>>;
146
+ message: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
147
+ providerOptions: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<import("../../shared/json.ts").JsonObject, unknown, z.core.$ZodTypeInternals<import("../../shared/json.ts").JsonObject, unknown>>>>;
148
+ text: z.ZodString;
149
+ type: z.ZodLiteral<"text">;
150
+ }, z.core.$strict>, z.ZodObject<{
151
+ image: z.ZodCustom<URL | import("ai").DataContent, URL | import("ai").DataContent>;
152
+ mediaType: z.ZodOptional<z.ZodString>;
153
+ providerOptions: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<import("../../shared/json.ts").JsonObject, unknown, z.core.$ZodTypeInternals<import("../../shared/json.ts").JsonObject, unknown>>>>;
154
+ type: z.ZodLiteral<"image">;
155
+ }, z.core.$strict>, z.ZodObject<{
156
+ data: z.ZodCustom<URL | import("ai").DataContent, URL | import("ai").DataContent>;
157
+ filename: z.ZodOptional<z.ZodString>;
158
+ mediaType: z.ZodString;
159
+ providerOptions: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<import("../../shared/json.ts").JsonObject, unknown, z.core.$ZodTypeInternals<import("../../shared/json.ts").JsonObject, unknown>>>>;
160
+ type: z.ZodLiteral<"file">;
161
+ }, z.core.$strict>], "type">>]>>;
162
+ outputSchema: z.ZodOptional<z.ZodType<import("../../shared/json.ts").JsonObject, unknown, z.core.$ZodTypeInternals<import("../../shared/json.ts").JsonObject, unknown>>>;
163
+ task: z.ZodOptional<z.ZodObject<{
164
+ authorizationEvents: z.ZodOptional<z.ZodArray<z.ZodObject<{
165
+ hookPayload: z.ZodObject<{
166
+ callId: z.ZodString;
167
+ childSessionId: z.ZodString;
168
+ event: z.ZodCustom<Record<string, unknown>, Record<string, unknown>>;
169
+ kind: z.ZodLiteral<"subagent-authorization-event">;
170
+ subagentName: z.ZodString;
171
+ }, z.core.$strict>;
172
+ taskId: z.ZodString;
173
+ }, z.core.$strict>>>;
174
+ inputRequests: z.ZodOptional<z.ZodArray<z.ZodObject<{
175
+ hookPayload: z.ZodObject<{
176
+ callId: z.ZodString;
177
+ childContinuationToken: z.ZodString;
178
+ childSessionId: z.ZodString;
179
+ event: z.ZodObject<{
180
+ requests: z.ZodArray<z.ZodObject<{
181
+ action: z.ZodObject<{
182
+ callId: z.ZodString;
183
+ input: z.ZodType<import("../../shared/json.ts").JsonObject, unknown, z.core.$ZodTypeInternals<import("../../shared/json.ts").JsonObject, unknown>>;
184
+ kind: z.ZodLiteral<"tool-call">;
185
+ toolName: z.ZodString;
186
+ }, z.core.$strict>;
187
+ allowFreeform: z.ZodOptional<z.ZodBoolean>;
188
+ display: z.ZodOptional<z.ZodEnum<{
189
+ confirmation: "confirmation";
190
+ select: "select";
191
+ text: "text";
192
+ }>>;
193
+ kind: z.ZodEnum<{
194
+ question: "question";
195
+ "session-limit": "session-limit";
196
+ "tool-approval": "tool-approval";
197
+ }>;
198
+ options: z.ZodOptional<z.ZodArray<z.ZodObject<{
199
+ description: z.ZodOptional<z.ZodString>;
200
+ id: z.ZodString;
201
+ label: z.ZodString;
202
+ style: z.ZodOptional<z.ZodEnum<{
203
+ danger: "danger";
204
+ default: "default";
205
+ primary: "primary";
206
+ }>>;
207
+ }, z.core.$strict>>>;
208
+ prompt: z.ZodString;
209
+ requestId: z.ZodString;
210
+ }, z.core.$strict>>;
211
+ sequence: z.ZodNumber;
212
+ stepIndex: z.ZodNumber;
213
+ turnId: z.ZodString;
214
+ }, z.core.$strict>;
215
+ kind: z.ZodLiteral<"subagent-input-request">;
216
+ subagentName: z.ZodString;
217
+ }, z.core.$strict>;
218
+ taskId: z.ZodString;
219
+ }, z.core.$strict>>>;
220
+ views: z.ZodOptional<z.ZodArray<z.ZodType<import("../../tasks/types.ts").TaskView, unknown, z.core.$ZodTypeInternals<import("../../tasks/types.ts").TaskView, unknown>>>>;
221
+ }, z.core.$strict>>;
222
+ }, z.core.$loose>;
223
+ deliveryMetadata: z.ZodOptional<z.ZodArray<z.ZodObject<{
224
+ channelKind: z.ZodString;
225
+ channelName: z.ZodString;
226
+ deliveryId: z.ZodString;
227
+ payloadIndex: z.ZodNumber;
228
+ requestId: z.ZodOptional<z.ZodString>;
229
+ requestTraceContext: z.ZodOptional<z.ZodObject<{
230
+ spanId: z.ZodString;
231
+ traceFlags: z.ZodNumber;
232
+ traceId: z.ZodString;
233
+ }, z.core.$strict>>;
234
+ acceptedDeploymentId: z.ZodOptional<z.ZodString>;
235
+ }, z.core.$strict>>>;
236
+ version: z.ZodLiteral<3>;
237
+ }, z.core.$strict>, z.ZodObject<{
238
+ kind: z.ZodLiteral<"session-timeout">;
239
+ version: z.ZodLiteral<3>;
240
+ }, z.core.$strict>, z.ZodObject<{
241
+ kind: z.ZodLiteral<"clear">;
242
+ version: z.ZodLiteral<3>;
243
+ }, z.core.$strict>, z.ZodObject<{
244
+ kind: z.ZodLiteral<"compact">;
245
+ version: z.ZodLiteral<3>;
246
+ }, z.core.$strict>, z.ZodObject<{
247
+ kind: z.ZodLiteral<"reset">;
248
+ reason: z.ZodOptional<z.ZodString>;
249
+ version: z.ZodLiteral<3>;
250
+ }, z.core.$strict>, z.ZodObject<{
251
+ kind: z.ZodLiteral<"cancel">;
252
+ taskId: z.ZodOptional<z.ZodString>;
253
+ turnId: z.ZodOptional<z.ZodString>;
254
+ version: z.ZodLiteral<3>;
255
+ }, z.core.$strict>], "kind">;
256
+ export type SessionInboxWireV3 = z.infer<typeof sessionInboxWireV3Schema>;
257
+ export declare function parseSessionInboxWireV3(value: unknown): z.ZodSafeParseResult<{
258
+ auth?: {
259
+ attributes: Record<string, string | string[]>;
260
+ authenticator: string;
261
+ issuer?: string | undefined;
262
+ principalId: string;
263
+ principalType: string;
264
+ subject?: string | undefined;
265
+ } | null | undefined;
266
+ kind: "deliver";
267
+ payloads: {
268
+ [x: string]: unknown;
269
+ context?: string[] | undefined;
270
+ inputResponses?: {
271
+ optionId?: string | undefined;
272
+ requestId: string;
273
+ text?: string | undefined;
274
+ }[] | undefined;
275
+ message?: string | ({
276
+ providerOptions?: Record<string, import("../../shared/json.ts").JsonObject> | undefined;
277
+ text: string;
278
+ type: "text";
279
+ } | {
280
+ image: URL | import("ai").DataContent;
281
+ mediaType?: string | undefined;
282
+ providerOptions?: Record<string, import("../../shared/json.ts").JsonObject> | undefined;
283
+ type: "image";
284
+ } | {
285
+ data: URL | import("ai").DataContent;
286
+ filename?: string | undefined;
287
+ mediaType: string;
288
+ providerOptions?: Record<string, import("../../shared/json.ts").JsonObject> | undefined;
289
+ type: "file";
290
+ })[] | undefined;
291
+ outputSchema?: import("../../shared/json.ts").JsonObject | undefined;
292
+ task?: {
293
+ authorizationEvents?: {
294
+ hookPayload: {
295
+ callId: string;
296
+ childSessionId: string;
297
+ event: Record<string, unknown>;
298
+ kind: "subagent-authorization-event";
299
+ subagentName: string;
300
+ };
301
+ taskId: string;
302
+ }[] | undefined;
303
+ inputRequests?: {
304
+ hookPayload: {
305
+ callId: string;
306
+ childContinuationToken: string;
307
+ childSessionId: string;
308
+ event: {
309
+ requests: {
310
+ action: {
311
+ callId: string;
312
+ input: import("../../shared/json.ts").JsonObject;
313
+ kind: "tool-call";
314
+ toolName: string;
315
+ };
316
+ allowFreeform?: boolean | undefined;
317
+ display?: "confirmation" | "select" | "text" | undefined;
318
+ kind: "question" | "session-limit" | "tool-approval";
319
+ options?: {
320
+ description?: string | undefined;
321
+ id: string;
322
+ label: string;
323
+ style?: "danger" | "default" | "primary" | undefined;
324
+ }[] | undefined;
325
+ prompt: string;
326
+ requestId: string;
327
+ }[];
328
+ sequence: number;
329
+ stepIndex: number;
330
+ turnId: string;
331
+ };
332
+ kind: "subagent-input-request";
333
+ subagentName: string;
334
+ };
335
+ taskId: string;
336
+ }[] | undefined;
337
+ views?: import("../../tasks/types.ts").TaskView[] | undefined;
338
+ } | undefined;
339
+ }[];
340
+ requestId?: string | undefined;
341
+ taskDeliveryId?: string | undefined;
342
+ turnPolicy?: "queue" | "steer" | undefined;
343
+ caller?: {
344
+ callId: string;
345
+ replyTo: {
346
+ kind: "hook";
347
+ token: string;
348
+ } | {
349
+ kind: "callback";
350
+ token: string;
351
+ url: string;
352
+ };
353
+ subagentName: string;
354
+ taskId?: string | undefined;
355
+ activityObserver?: {
356
+ sink: {
357
+ url: string;
358
+ version: 1;
359
+ };
360
+ workIdentity?: {
361
+ callId?: string | undefined;
362
+ id: string;
363
+ kind: "remote-agent" | "root-turn" | "subagent" | "task";
364
+ name?: string | undefined;
365
+ parentId?: string | undefined;
366
+ rootSessionId: string;
367
+ rootTurnId: string;
368
+ sessionId?: string | undefined;
369
+ turnId?: string | undefined;
370
+ } | undefined;
371
+ } | undefined;
372
+ } | undefined;
373
+ payload: {
374
+ [x: string]: unknown;
375
+ context?: string[] | undefined;
376
+ inputResponses?: {
377
+ optionId?: string | undefined;
378
+ requestId: string;
379
+ text?: string | undefined;
380
+ }[] | undefined;
381
+ message?: string | ({
382
+ providerOptions?: Record<string, import("../../shared/json.ts").JsonObject> | undefined;
383
+ text: string;
384
+ type: "text";
385
+ } | {
386
+ image: URL | import("ai").DataContent;
387
+ mediaType?: string | undefined;
388
+ providerOptions?: Record<string, import("../../shared/json.ts").JsonObject> | undefined;
389
+ type: "image";
390
+ } | {
391
+ data: URL | import("ai").DataContent;
392
+ filename?: string | undefined;
393
+ mediaType: string;
394
+ providerOptions?: Record<string, import("../../shared/json.ts").JsonObject> | undefined;
395
+ type: "file";
396
+ })[] | undefined;
397
+ outputSchema?: import("../../shared/json.ts").JsonObject | undefined;
398
+ task?: {
399
+ authorizationEvents?: {
400
+ hookPayload: {
401
+ callId: string;
402
+ childSessionId: string;
403
+ event: Record<string, unknown>;
404
+ kind: "subagent-authorization-event";
405
+ subagentName: string;
406
+ };
407
+ taskId: string;
408
+ }[] | undefined;
409
+ inputRequests?: {
410
+ hookPayload: {
411
+ callId: string;
412
+ childContinuationToken: string;
413
+ childSessionId: string;
414
+ event: {
415
+ requests: {
416
+ action: {
417
+ callId: string;
418
+ input: import("../../shared/json.ts").JsonObject;
419
+ kind: "tool-call";
420
+ toolName: string;
421
+ };
422
+ allowFreeform?: boolean | undefined;
423
+ display?: "confirmation" | "select" | "text" | undefined;
424
+ kind: "question" | "session-limit" | "tool-approval";
425
+ options?: {
426
+ description?: string | undefined;
427
+ id: string;
428
+ label: string;
429
+ style?: "danger" | "default" | "primary" | undefined;
430
+ }[] | undefined;
431
+ prompt: string;
432
+ requestId: string;
433
+ }[];
434
+ sequence: number;
435
+ stepIndex: number;
436
+ turnId: string;
437
+ };
438
+ kind: "subagent-input-request";
439
+ subagentName: string;
440
+ };
441
+ taskId: string;
442
+ }[] | undefined;
443
+ views?: import("../../tasks/types.ts").TaskView[] | undefined;
444
+ } | undefined;
445
+ };
446
+ deliveryMetadata?: {
447
+ channelKind: string;
448
+ channelName: string;
449
+ deliveryId: string;
450
+ payloadIndex: number;
451
+ requestId?: string | undefined;
452
+ requestTraceContext?: {
453
+ spanId: string;
454
+ traceFlags: number;
455
+ traceId: string;
456
+ } | undefined;
457
+ acceptedDeploymentId?: string | undefined;
458
+ }[] | undefined;
459
+ version: 3;
460
+ } | {
461
+ kind: "session-timeout";
462
+ version: 3;
463
+ } | {
464
+ kind: "clear";
465
+ version: 3;
466
+ } | {
467
+ kind: "compact";
468
+ version: 3;
469
+ } | {
470
+ kind: "reset";
471
+ reason?: string | undefined;
472
+ version: 3;
473
+ } | {
474
+ kind: "cancel";
475
+ taskId?: string | undefined;
476
+ turnId?: string | undefined;
477
+ version: 3;
478
+ }>;
479
+ /** Builds and validates one complete version-3 wire value. */
480
+ export declare function encodeSessionCommandV3(command: DeliverHookPayload | SessionCommand | SessionTimeoutHookPayload): SessionInboxWireV3;
@@ -0,0 +1 @@
1
+ import{z}from"#compiled/zod/index.js";import{formatValidationError}from"#runtime/validation.js";import{coalesceDeliverPayloads}from"#execution/deliver-payloads.js";import{SessionInboxWireError}from"#execution/wire/session-inbox-contract.js";import{sessionInboxWireV2Schema}from"#execution/wire/session-inbox-wire.v2.js";import{normalizeSessionInboxWireV2}from"#execution/wire/session-inbox-wire.v2-migration.js";const v2=sessionInboxWireV2Schema.options,v2Deliver=v2[0],v2DeliveryMetadata=v2Deliver.shape.deliveryMetadata.unwrap().element,version=z.literal(3),sessionInboxWireV3Schema=z.discriminatedUnion(`kind`,[v2Deliver.extend({deliveryMetadata:z.array(v2DeliveryMetadata.extend({acceptedDeploymentId:z.string().optional()})).optional(),version}),v2[1].extend({version}),v2[2].extend({version}),v2[3].extend({version}),v2[4].extend({version}),v2[5].extend({version})]);function parseSessionInboxWireV3(e){return sessionInboxWireV3Schema.safeParse(normalizeSessionInboxWireV2(e))}function encodeSessionCommandV3(e){let t=parseSessionInboxWireV3(e.kind===`send`?{auth:e.auth,caller:e.caller,deliveryMetadata:e.delivery===void 0?void 0:[{...e.delivery,payloadIndex:0}],kind:`deliver`,payload:e.payload,payloads:[e.payload],requestId:e.requestId,taskDeliveryId:e.taskDeliveryId,turnPolicy:e.turnPolicy,version:3}:e.kind===`deliver`?{...e,payload:coalesceDeliverPayloads(e.payloads),version:3}:{...e,version:3});if(!t.success)throw new SessionInboxWireError(`Produced a session inbox payload that does not match wire version 3: ${formatValidationError(t.error)}`);return t.data}export{encodeSessionCommandV3,parseSessionInboxWireV3,sessionInboxWireV3Schema};
@@ -0,0 +1,3 @@
1
+ import type { VersionMigration } from "#execution/durable-session-migrations/chain.js";
2
+ /** Pure shape migration from the immutable v2 wire contract to v3. */
3
+ export declare const sessionInboxWireV2Migration: VersionMigration;
@@ -0,0 +1 @@
1
+ const sessionInboxWireV2Migration={from:2,migrate(e){return{...e,version:3}},to:3};export{sessionInboxWireV2Migration};
@@ -1 +1 @@
1
- import{fireSessionCallbackStep}from"#execution/session-callback-step.js";import{notifyDelegatedParentStep,notifyTurnCallerStep}from"#execution/delegated-parent-notification.js";import{createDelegatedSubagentErrorResult,createDelegatedSubagentSuccessResult}from"#execution/delegated-parent-result.js";import{emitTerminalSessionCompletionStep}from"#execution/terminal-session-completion-step.js";import{terminateChildSessionsStep}from"#execution/terminate-child-sessions-step.js";async function finalizeExpiredSession(t){return await terminateChildSessionsStep({serializedContext:t.serializedContext,sessionState:t.sessionState}),await emitTerminalSessionCompletionStep({parentWritable:t.driverWritable,serializedContext:t.serializedContext}),t.mode===`task`?(await fireSessionCallbackStep({output:``,serializedContext:t.serializedContext,status:`completed`}),await notifyDelegatedParentStep({result:createDelegatedSubagentSuccessResult(t.serializedContext,``),serializedContext:t.serializedContext})):t.caller!==void 0&&await notifyTurnCallerStep({caller:t.caller,lifecycle:`terminal`,sessionId:t.sessionState.sessionId,settled:{output:``}}),{output:``}}async function finalizeDone(n){let{output:r,serializedContext:i}=n.action,a=n.action.isError===!0;if(await terminateChildSessionsStep({serializedContext:i,sessionState:n.action.sessionState}),n.mode===`task`)await fireSessionCallbackStep({error:a?r:void 0,output:a?void 0:r,serializedContext:i,status:a?`failed`:`completed`,usage:n.action.usage}),await notifyDelegatedParentStep({result:a?createDelegatedSubagentErrorResult(i,r):createDelegatedSubagentSuccessResult(i,r),serializedContext:i,usage:n.action.usage});else{let e={output:r,usage:n.action.usageDelta};a&&(e.isError=!0),n.caller!==void 0&&await notifyTurnCallerStep({caller:n.caller,lifecycle:`terminal`,sessionId:n.action.sessionState.sessionId,settled:e})}return{output:r}}export{finalizeDone,finalizeExpiredSession};
1
+ import{notifyDelegatedParentStep,notifyTurnCallerStep}from"#execution/delegated-parent-notification.js";import{createDelegatedSubagentErrorResult,createDelegatedSubagentSuccessResult}from"#execution/delegated-parent-result.js";import{fireSessionCallbackStep}from"#execution/session-callback-step.js";import{emitTerminalSessionCompletionStep}from"#execution/terminal-session-completion-step.js";import{terminateChildSessionsStep}from"#execution/terminate-child-sessions-step.js";async function finalizeExpiredSession(t){return await terminateChildSessionsStep({serializedContext:t.serializedContext,sessionState:t.sessionState}),await emitTerminalSessionCompletionStep({parentWritable:t.driverWritable,serializedContext:t.serializedContext}),t.mode===`task`?(await fireSessionCallbackStep({output:``,serializedContext:t.serializedContext,status:`completed`}),await notifyDelegatedParentStep({result:createDelegatedSubagentSuccessResult(t.serializedContext,``),serializedContext:t.serializedContext})):t.caller!==void 0&&await notifyTurnCallerStep({caller:t.caller,lifecycle:`terminal`,sessionId:t.sessionState.sessionId,settled:{output:``}}),{output:``}}async function finalizeDone(n){let{output:r,serializedContext:i}=n.action,a=n.action.isError===!0;if(await terminateChildSessionsStep({serializedContext:i,sessionState:n.action.sessionState}),n.mode===`task`)await fireSessionCallbackStep({error:a?r:void 0,output:a?void 0:r,serializedContext:i,status:a?`failed`:`completed`,usage:n.action.usage}),await notifyDelegatedParentStep({result:a?createDelegatedSubagentErrorResult(i,r):createDelegatedSubagentSuccessResult(i,r),serializedContext:i,usage:n.action.usage});else{let e={output:r,usage:n.action.usageDelta};a&&(e.isError=!0),n.caller!==void 0&&await notifyTurnCallerStep({caller:n.caller,lifecycle:`terminal`,sessionId:n.action.sessionState.sessionId,settled:e})}return{output:r}}export{finalizeDone,finalizeExpiredSession};
@@ -1 +1 @@
1
- import{attachClientContext,readClientContext}from"#internal/client-context.js";import{sessionCommandHookToken}from"#execution/session-command-token.js";import{CHANNEL_CONTEXT_KEY_NAME,SESSION_CALLBACK_CONTEXT_KEY_NAME}from"#context/key-names.js";import{getWorkflowMetadata,getWritable}from"#compiled/@workflow/core/index.js";import{isHookConflictError}from"#execution/hook-ownership.js";import{isTaskOwnedSerializedContext}from"#execution/tasks/child/instructions.js";import{SUBAGENT_ADAPTER_KIND}from"#execution/subagent-adapter-state.js";import{readSerializedSubagentDepth}from"#harness/subagent-depth.js";import{readChannelRequestId,readRootSessionId}from"#execution/eve-workflow-attributes.js";import{activeTurnId}from"#harness/active-turn-id.js";import{fireSessionCallbackStep}from"#execution/session-callback-step.js";import{normalizeSerializableError}from"#execution/workflow-errors.js";import{SessionStateCursor}from"#execution/session-state-cursor.js";import{cancelDescendantTurnsStep}from"#execution/cancel-descendant-turns-step.js";import{bindTurnCallerContextStep,notifyCancelledTaskCallerStep,notifyDelegatedParentStep,notifyTaskTurnStartedStep,notifyTurnCallerStep,resolveInitialTurnCallerStep}from"#execution/delegated-parent-notification.js";import{createDelegatedSubagentErrorResult}from"#execution/delegated-parent-result.js";import{terminateChildSessionsStep}from"#execution/terminate-child-sessions-step.js";import{nextTurnDelivery}from"#execution/parked-delivery-wait.js";import{dispatchAndAwaitTurn}from"#execution/turn-dispatch.js";import{finalizeDone,finalizeExpiredSession}from"#execution/workflow-entry-finalization.js";import{createSessionStep}from"#execution/create-session-step.js";import{settleCancelledTurnStep}from"#execution/settle-cancelled-turn-step.js";import{emitTerminalSessionFailureStep}from"#execution/terminal-session-failure-step.js";import{createSessionCommandInbox}from"#execution/session-command-inbox.js";import{DEFAULT_SESSION_TIMEOUT_MS}from"#execution/session-timeout.js";import{createSessionTimeoutControl}from"#execution/session-timeout-control.js";async function workflowEntry(n){"use workflow";let{workflowRunId:r,workflowStartedAt:i}=getWorkflowMetadata(),s=n.serializedContext[`eve.continuationToken`]||``,l=n.serializedContext[`eve.mode`],p=n.serializedContext[`eve.capabilities`],g=n.serializedContext[`eve.bundle`];n.serializedContext[`eve.sessionId`]=r;let _=getWritable(),v={caller:void 0,callerResolved:!1,lastSessionState:void 0};try{let a=readRootSessionId(n.serializedContext),o=readSerializedSubagentDepth(n.serializedContext),m=n.serializedContext[`eve.dynamicSubagentAgentConfig`],{state:h}=await createSessionStep({compiledArtifactsSource:g.source,continuationToken:s,dynamicSubagentAgentConfig:m,inheritedLimits:n.limits,nodeId:g.nodeId,outputSchema:n.input.outputSchema,rootSessionId:a,sessionId:r,subagentDepth:o,taskOwned:isTaskOwnedSerializedContext(n.serializedContext)});v.lastSessionState=h,hasGuaranteedRootLineage(n.serializedContext)||(v.caller=await resolveInitialTurnCallerStep({serializedContext:n.serializedContext})),v.callerResolved=!0;let y=await runDriverLoop({capabilities:p,driverWritable:_,initialInput:{deliveryMetadata:n.serializedContext[`eve.channelDelivery`]===void 0?void 0:[{...n.serializedContext[`eve.channelDelivery`],payloadIndex:0}],kind:`deliver`,payloads:[attachClientContext({message:n.input.message,context:n.input.context,outputSchema:n.input.outputSchema},readClientContext(n.input))],requestId:readChannelRequestId(n.serializedContext)},crashCleanupState:v,mode:l,serializedContext:n.serializedContext,sessionState:h,sessionTimeoutDeadline:n.sessionTimeoutMs===!1?void 0:new Date(i.getTime()+(n.sessionTimeoutMs??DEFAULT_SESSION_TIMEOUT_MS))});return y.kind===`result`?y.result:await finalizeExpiredSession({caller:v.caller,driverWritable:_,mode:l,serializedContext:y.serializedContext,sessionState:y.sessionState})}catch(e){if(v.lastSessionState!==void 0&&await terminateChildSessionsStep({serializedContext:n.serializedContext,sessionState:v.lastSessionState}),await emitTerminalSessionFailureStep({error:normalizeSerializableError(e),parentWritable:_,serializedContext:n.serializedContext}),l===`task`)await fireSessionCallbackStep({error:normalizeSerializableError(e),serializedContext:n.serializedContext,status:`failed`}),await notifyDelegatedParentStep({result:createDelegatedSubagentErrorResult(n.serializedContext,e),serializedContext:n.serializedContext});else{let t=await resolveCallerForCrash(v,n.serializedContext);t!==void 0&&await notifyTurnCallerStep({caller:t,lifecycle:`terminal`,sessionId:r,settled:{isError:!0,output:e}})}throw createSafeOuterWorkflowError()}}async function resolveCallerForCrash(e,t){if(e.callerResolved)return e.caller;try{return await resolveInitialTurnCallerStep({serializedContext:t})}catch{return}}function createSafeOuterWorkflowError(){let e=Error(`Agent workflow failed. Inspect the private session trace for details.`);return e.name=`EveWorkflowFailure`,e}function hasGuaranteedRootLineage(e){if(e[SESSION_CALLBACK_CONTEXT_KEY_NAME]!==void 0||e[`eve.parentSession`]!==void 0||e[`eve.subagentDepth`]!==void 0)return!1;let t=e[CHANNEL_CONTEXT_KEY_NAME];if(typeof t!=`object`||!t)return!1;let n=Reflect.get(t,`kind`);return typeof n==`string`&&n!==SUBAGENT_ADAPTER_KIND}async function runDriverLoop(e){let t=new Map,nextParkedActivity=async n=>{let r=new Set(n.expectedAttemptIds);for(let e of t.keys())r.has(e)||t.delete(e);for(;;){if(r.size>0&&[...r].every(e=>t.has(e))){let e=[...r].map(e=>t.get(e));return t.clear(),{kind:`authorization-resume`,payloads:e}}let n=await nextTurnDelivery({awaitAuthorizationCallbacks:r.size>0,bufferedDeliveries:i,bufferedSessionControls:a,cancelledTaskIds:o,commandInbox:l,deferDeliveries:e.mode===`task`&&r.size>0,driverWritable:e.driverWritable,seenTaskDeliveries:c,stateCursor:f});if(n.kind!==`authorization`)return n;for(let e of n.payloads){let n=e.authorizationCallback;typeof n?.attemptId==`string`&&r.has(n.attemptId)&&!t.has(n.attemptId)&&t.set(n.attemptId,e)}if(n.closed){let e=[...t.values()];return t.clear(),{kind:`authorization-resume`,payloads:e}}}},r=0,nextTurnControlToken=()=>`${e.sessionState.sessionId}:turn-control:${String(r++)}`,i=[],a=[],o=new Set,c=new Set,l=createSessionCommandInbox(),u=sessionCommandHookToken(e.sessionState.sessionId);await l.claimStable(u),await l.claimAuthorization(`${e.sessionState.sessionId}:auth`);let d=e.sessionTimeoutDeadline===void 0?void 0:createSessionTimeoutControl({deadline:e.sessionTimeoutDeadline,token:u}),f=new SessionStateCursor({serializedContext:e.serializedContext,sessionState:e.sessionState}),m,runTurn=async t=>{let n=e.crashCleanupState.caller;n?.taskId!==void 0&&(c.add(n.taskId),await notifyTaskTurnStartedStep({caller:n,childSessionId:f.sessionState.sessionId,childTurnId:activeTurnId(f.sessionState.emissionState)}));let r=n===void 0?f.serializedContext:await bindTurnCallerContextStep({caller:n,serializedContext:f.serializedContext}),s=await dispatchAndAwaitTurn({bufferedDeliveries:i,bufferedSessionControls:a,cancelledTaskIds:o,capabilities:e.capabilities,commandInbox:l,controlToken:nextTurnControlToken(),delivery:t,mode:e.mode,parentWritable:e.driverWritable,serializedContext:r,seenTaskDeliveries:c,sessionState:f.sessionState});return await m?.(),m=s.dispose,f.adoptState(s.action),e.crashCleanupState.lastSessionState=f.sessionState,s.action};try{if(e.sessionState.continuationToken)try{await l.rekeyContinuation(e.sessionState.continuationToken)}catch(e){if(!isHookConflictError(e))throw e;return{kind:`result`,result:{output:``}}}await d?.start();let t=await runTurn(e.initialInput);for(;;){if(t.kind===`done`)return{kind:`result`,result:await finalizeDone({action:t,caller:e.crashCleanupState.caller,mode:e.mode})};if(t.kind!==`park`)throw Error(`Driver received unexpected turn action "${t.kind}".`);if(t.cancelled===!0){let t=await settleCancelledTurnStep({parentWritable:e.driverWritable,serializedContext:f.serializedContext,sessionState:f.sessionState});f.adoptState(t);let n={caller:e.crashCleanupState.caller,sessionId:f.sessionState.sessionId};await notifyCancelledTaskCallerStep(t.usage===void 0?n:{...n,usage:t.usage}),e.crashCleanupState.lastSessionState=f.sessionState}f.sessionState.continuationToken&&await l.rekeyContinuation(f.sessionState.continuationToken);let n=t.settled;t.cancelled!==!0&&n!==void 0?(e.crashCleanupState.caller!==void 0&&await notifyTurnCallerStep({caller:e.crashCleanupState.caller,lifecycle:`parked`,sessionId:f.sessionState.sessionId,settled:n}),e.crashCleanupState.caller=void 0):t.cancelled===!0&&(e.crashCleanupState.caller=void 0);let r=await nextParkedActivity({expectedAttemptIds:t.authorizationAttemptIds??[]});if(e.crashCleanupState.lastSessionState=f.sessionState,r.kind===`authorization-resume`){t=await runTurn({kind:`deliver`,payloads:r.payloads});continue}if(r.kind===`expired`)return{kind:`expired`,serializedContext:f.serializedContext,sessionState:f.sessionState};if(r.kind===`reset`)return await terminateChildSessionsStep({serializedContext:f.serializedContext,sessionState:f.sessionState}),{kind:`result`,result:{output:``}};if(r.kind===`clear`||r.kind===`compact`){t=await runTurn({kind:r.kind});continue}if(r.kind===`closed`)return await terminateChildSessionsStep({serializedContext:f.serializedContext,sessionState:f.sessionState}),{kind:`result`,result:{output:``}};if(r.kind===`cancel-turn`){await cancelDescendantTurnsStep({serializedContext:f.serializedContext,sessionState:f.sessionState});let n=await settleCancelledTurnStep({parentWritable:e.driverWritable,serializedContext:f.serializedContext,sessionState:f.sessionState});f.adoptState(n),t={...t,settled:void 0},e.crashCleanupState.caller=void 0,e.crashCleanupState.lastSessionState=f.sessionState;continue}r.delivery.caller!==void 0&&(e.crashCleanupState.caller=r.delivery.caller),t=await runTurn(r.delivery)}}finally{await m?.(),await d?.dispose(),await l.dispose()}}export{workflowEntry};
1
+ import{attachClientContext,readClientContext}from"#internal/client-context.js";import{sessionCommandHookToken}from"#execution/session-command-token.js";import{CHANNEL_CONTEXT_KEY_NAME,SESSION_CALLBACK_CONTEXT_KEY_NAME}from"#context/key-names.js";import{getWorkflowMetadata,getWritable}from"#compiled/@workflow/core/index.js";import{isHookConflictError}from"#execution/hook-ownership.js";import{isTaskOwnedSerializedContext}from"#execution/tasks/child/instructions.js";import{SUBAGENT_ADAPTER_KIND}from"#execution/subagent-adapter-state.js";import{readSerializedSubagentDepth}from"#harness/subagent-depth.js";import{readChannelRequestId,readRootSessionId}from"#execution/eve-workflow-attributes.js";import{activeTurnId}from"#harness/active-turn-id.js";import{bindTurnCallerContextStep,notifyCancelledTaskCallerStep,notifyDelegatedParentStep,notifyTaskTurnStartedStep,notifyTurnCallerStep,resolveInitialTurnCallerStep}from"#execution/delegated-parent-notification.js";import{createDelegatedSubagentErrorResult}from"#execution/delegated-parent-result.js";import{fireSessionCallbackStep}from"#execution/session-callback-step.js";import{terminateChildSessionsStep}from"#execution/terminate-child-sessions-step.js";import{SessionStateCursor}from"#execution/session-state-cursor.js";import{normalizeSerializableError}from"#execution/workflow-errors.js";import{cancelDescendantTurnsStep}from"#execution/cancel-descendant-turns-step.js";import{nextTurnDelivery}from"#execution/parked-delivery-wait.js";import{dispatchAndAwaitTurn}from"#execution/turn-dispatch.js";import{finalizeDone}from"#execution/workflow-entry-finalization.js";import{createSessionStep}from"#execution/create-session-step.js";import{settleCancelledTurnStep}from"#execution/settle-cancelled-turn-step.js";import{emitTerminalSessionFailureStep}from"#execution/terminal-session-failure-step.js";import{finalizeTerminalSession}from"#execution/finalize-terminal-session.js";import{createSessionCommandInbox}from"#execution/session-command-inbox.js";import{DEFAULT_SESSION_TIMEOUT_MS}from"#execution/session-timeout.js";import{createSessionTimeoutControl}from"#execution/session-timeout-control.js";async function workflowEntry(r){"use workflow";let{workflowRunId:i,workflowStartedAt:l}=getWorkflowMetadata(),p=r.serializedContext[`eve.continuationToken`]||``,m=r.serializedContext[`eve.mode`],h=r.serializedContext[`eve.capabilities`],_=r.serializedContext[`eve.bundle`];r.serializedContext[`eve.sessionId`]=i;let S=getWritable(),w={activeTurnId:void 0,caller:void 0,callerResolved:!1,lastSessionState:void 0,serializedContext:r.serializedContext,terminalEmitted:!1};try{let a=readRootSessionId(r.serializedContext),o=readSerializedSubagentDepth(r.serializedContext),g=r.serializedContext[`eve.dynamicSubagentAgentConfig`],v=createSessionCommandInbox(),y=sessionCommandHookToken(i),b=`${i}:auth`,x,C;try{let[n,u,f,T]=await Promise.allSettled([createSessionStep({compiledArtifactsSource:_.source,continuationToken:p,dynamicSubagentAgentConfig:g,inheritedLimits:r.limits,nodeId:_.nodeId,outputSchema:r.input.outputSchema,rootSessionId:a,sessionId:i,subagentDepth:o,taskOwned:isTaskOwnedSerializedContext(r.serializedContext)}),v.claimStable(y),v.claimAuthorization(b),v.rekeyContinuation(p)]);if(n.status===`rejected`)throw n.reason;if(u.status===`rejected`)throw u.reason;if(f.status===`rejected`)throw f.reason;if(T.status===`rejected`){if(isHookConflictError(T.reason))return{output:``};throw T.reason}x=n.value.state,w.lastSessionState=x,hasGuaranteedRootLineage(r.serializedContext)||(w.caller=await resolveInitialTurnCallerStep({serializedContext:r.serializedContext})),w.callerResolved=!0,C=await runDriverLoop({capabilities:h,commandInbox:v,driverWritable:S,initialInput:{deliveryMetadata:r.serializedContext[`eve.channelDelivery`]===void 0?void 0:[{...r.serializedContext[`eve.channelDelivery`],payloadIndex:0}],kind:`deliver`,payloads:[attachClientContext({message:r.input.message,context:r.input.context,outputSchema:r.input.outputSchema},readClientContext(r.input))],requestId:readChannelRequestId(r.serializedContext)},crashCleanupState:w,mode:m,serializedContext:r.serializedContext,sessionState:x,sessionTimeoutDeadline:r.sessionTimeoutMs===!1?void 0:new Date(l.getTime()+(r.sessionTimeoutMs??DEFAULT_SESSION_TIMEOUT_MS)),stableCommandToken:y})}finally{await v.dispose()}return C.kind===`result`?C.result:await finalizeTerminalSession({caller:w.caller,driverWritable:S,mode:m,notifyCaller:C.notifyCaller,serializedContext:C.serializedContext,sessionState:C.sessionState,terminalState:w})}catch(e){if(w.lastSessionState!==void 0&&await terminateChildSessionsStep({serializedContext:w.serializedContext,sessionState:w.lastSessionState}),!w.terminalEmitted)if(await emitTerminalSessionFailureStep({error:normalizeSerializableError(e),parentWritable:S,serializedContext:w.serializedContext,turnId:w.activeTurnId}),m===`task`)await fireSessionCallbackStep({error:normalizeSerializableError(e),serializedContext:r.serializedContext,status:`failed`}),await notifyDelegatedParentStep({result:createDelegatedSubagentErrorResult(r.serializedContext,e),serializedContext:r.serializedContext});else{let t=await resolveCallerForCrash(w,r.serializedContext);t!==void 0&&await notifyTurnCallerStep({caller:t,lifecycle:`terminal`,sessionId:i,settled:{isError:!0,output:e}})}throw createSafeOuterWorkflowError()}}async function resolveCallerForCrash(e,t){if(e.callerResolved)return e.caller;try{return await resolveInitialTurnCallerStep({serializedContext:t})}catch{return}}function createSafeOuterWorkflowError(){let e=Error(`Agent workflow failed. Inspect the private session trace for details.`);return e.name=`EveWorkflowFailure`,e}function hasGuaranteedRootLineage(e){if(e[SESSION_CALLBACK_CONTEXT_KEY_NAME]!==void 0||e[`eve.parentSession`]!==void 0||e[`eve.subagentDepth`]!==void 0)return!1;let t=e[CHANNEL_CONTEXT_KEY_NAME];if(typeof t!=`object`||!t)return!1;let n=Reflect.get(t,`kind`);return typeof n==`string`&&n!==SUBAGENT_ADAPTER_KIND}async function runDriverLoop(e){let t=e.commandInbox,n=new Map,nextParkedActivity=async r=>{let c=new Set(r.expectedAttemptIds);for(let e of n.keys())c.has(e)||n.delete(e);for(;;){if(c.size>0&&[...c].every(e=>n.has(e))){let e=[...c].map(e=>n.get(e));return n.clear(),{kind:`authorization-resume`,payloads:e}}let r=await nextTurnDelivery({awaitAuthorizationCallbacks:c.size>0,bufferedDeliveries:i,bufferedSessionControls:a,cancelledTaskIds:o,commandInbox:t,deferDeliveries:e.mode===`task`&&c.size>0,driverWritable:e.driverWritable,seenTaskDeliveries:s,stateCursor:l});if(r.kind!==`authorization`)return r;for(let e of r.payloads){let t=e.authorizationCallback;typeof t?.attemptId==`string`&&c.has(t.attemptId)&&!n.has(t.attemptId)&&n.set(t.attemptId,e)}if(r.closed){let e=[...n.values()];return n.clear(),{kind:`authorization-resume`,payloads:e}}}},r=0,nextTurnControlToken=()=>`${e.sessionState.sessionId}:turn-control:${String(r++)}`,i=[],a=[],o=new Set,s=new Set,c=e.sessionTimeoutDeadline===void 0?void 0:createSessionTimeoutControl({deadline:e.sessionTimeoutDeadline,token:e.stableCommandToken}),l=new SessionStateCursor({serializedContext:e.serializedContext,sessionState:e.sessionState}),u,runTurn=async n=>{let r=e.crashCleanupState.caller;r?.taskId!==void 0&&(s.add(r.taskId),await notifyTaskTurnStartedStep({caller:r,childSessionId:l.sessionState.sessionId,childTurnId:activeTurnId(l.sessionState.emissionState)}));let c=r===void 0?l.serializedContext:await bindTurnCallerContextStep({caller:r,serializedContext:l.serializedContext}),d=activeTurnId(l.sessionState.emissionState);e.crashCleanupState.activeTurnId=d;let f=await dispatchAndAwaitTurn({bufferedDeliveries:i,bufferedSessionControls:a,cancelledTaskIds:o,capabilities:e.capabilities,commandInbox:t,controlToken:nextTurnControlToken(),delivery:n,mode:e.mode,parentWritable:e.driverWritable,serializedContext:c,seenTaskDeliveries:s,sessionState:l.sessionState});return e.crashCleanupState.activeTurnId=f.action.kind===`park`&&f.action.cancelled===!0?d:void 0,e.crashCleanupState.lastSessionState=f.action.sessionState,e.crashCleanupState.serializedContext=f.action.serializedContext,f.action.kind===`done`&&(e.crashCleanupState.terminalEmitted=!0),await u?.(),u=f.dispose,l.adoptState(f.action),f.action};try{await c?.start();let n=await runTurn(e.initialInput);for(;;){if(n.kind===`done`)return{kind:`result`,result:await finalizeDone({action:n,caller:e.crashCleanupState.caller,mode:e.mode})};if(n.kind!==`park`)throw Error(`Driver received unexpected turn action "${n.kind}".`);if(n.cancelled===!0){let t=await settleCancelledTurnStep({parentWritable:e.driverWritable,serializedContext:l.serializedContext,sessionState:l.sessionState});l.adoptState(t),e.crashCleanupState.activeTurnId=void 0,e.crashCleanupState.lastSessionState=l.sessionState,e.crashCleanupState.serializedContext=l.serializedContext;let n={caller:e.crashCleanupState.caller,sessionId:l.sessionState.sessionId};await notifyCancelledTaskCallerStep(t.usage===void 0?n:{...n,usage:t.usage})}l.sessionState.continuationToken&&await t.rekeyContinuation(l.sessionState.continuationToken);let r=n.settled;n.cancelled!==!0&&r!==void 0?(e.crashCleanupState.caller!==void 0&&await notifyTurnCallerStep({caller:e.crashCleanupState.caller,lifecycle:`parked`,sessionId:l.sessionState.sessionId,settled:r}),e.crashCleanupState.caller=void 0):n.cancelled===!0&&(e.crashCleanupState.caller=void 0);let i=await nextParkedActivity({expectedAttemptIds:n.authorizationAttemptIds??[]});if(e.crashCleanupState.lastSessionState=l.sessionState,e.crashCleanupState.serializedContext=l.serializedContext,i.kind===`authorization-resume`){n=await runTurn({kind:`deliver`,payloads:i.payloads});continue}if(i.kind===`expired`)return{kind:`terminal`,notifyCaller:!0,serializedContext:l.serializedContext,sessionState:l.sessionState};if(i.kind===`reset`)return{kind:`terminal`,notifyCaller:!1,serializedContext:l.serializedContext,sessionState:l.sessionState};if(i.kind===`clear`||i.kind===`compact`){n=await runTurn({kind:i.kind});continue}if(i.kind===`closed`)return{kind:`terminal`,notifyCaller:!1,serializedContext:l.serializedContext,sessionState:l.sessionState};if(i.kind===`cancel-turn`){await cancelDescendantTurnsStep({serializedContext:l.serializedContext,sessionState:l.sessionState});let t=await settleCancelledTurnStep({parentWritable:e.driverWritable,serializedContext:l.serializedContext,sessionState:l.sessionState});l.adoptState(t),n={...n,settled:void 0},e.crashCleanupState.caller=void 0,e.crashCleanupState.lastSessionState=l.sessionState,e.crashCleanupState.serializedContext=l.serializedContext;continue}i.delivery.caller!==void 0&&(e.crashCleanupState.caller=i.delivery.caller),n=await runTurn(i.delivery)}}finally{await u?.(),await c?.dispose()}}export{workflowEntry};
@@ -0,0 +1,5 @@
1
+ declare global {
2
+ var __private_workflows: Map<string, unknown> | undefined;
3
+ }
4
+ export declare const WORKFLOW_REGISTRY_GLOBAL = "__private_workflows";
5
+ export declare function readRegisteredWorkflow(workflowId: string): unknown;
@@ -0,0 +1 @@
1
+ const WORKFLOW_REGISTRY_GLOBAL=`__private_workflows`;function readRegisteredWorkflow(e){return globalThis[WORKFLOW_REGISTRY_GLOBAL]?.get(e)}export{WORKFLOW_REGISTRY_GLOBAL,readRegisteredWorkflow};
@@ -3,17 +3,6 @@ import { type Run, type StartOptionsWithoutDeploymentId, type WorkflowFunction,
3
3
  import type { RuntimeCompiledArtifactsSource } from "#runtime/compiled-artifacts-source.js";
4
4
  import type { DynamicSubagentAgentConfig } from "#runtime/subagents/dynamic-agent-config.js";
5
5
  export declare const LATEST_DEPLOYMENT_UNSUPPORTED_MESSAGE = "deploymentId 'latest' requires a World that implements resolveLatestDeploymentId()";
6
- /**
7
- * Workflow function names whose bundled id is stable across deployments
8
- * (no `@<pkg.version>` stamp). The bundler reads this set when emitting
9
- * the workflow id so cross-deployment routing — `start(ref, args, {
10
- * deploymentId: "latest" })` — finds the same workflow on a newer
11
- * deployment even when the eve version differs.
12
- *
13
- * Both halves of the contract (bundler output and runtime reference
14
- * template) read this single set so they cannot drift.
15
- */
16
- export declare const STABLE_WORKFLOW_NAMES: ReadonlySet<string>;
17
6
  interface WorkflowHookRecord {
18
7
  readonly runId: string;
19
8
  }
@@ -48,6 +37,10 @@ export declare const taskRunWorkflowReference: {
48
37
  export declare const activityCollectorWorkflowReference: {
49
38
  workflowId: string;
50
39
  };
40
+ /** Stable workflow reference for authored workflow tool runs. */
41
+ export declare const toolRunWorkflowReference: {
42
+ workflowId: string;
43
+ };
51
44
  /**
52
45
  * Creates a workflow-backed runtime whose long-lived driver owns the
53
46
  * event stream and dispatches each turn as a child workflow run.
@@ -65,4 +58,9 @@ export declare function waitForCommandHookOwner(token: string): Promise<Workflow
65
58
  * while preserving local/dev worlds that do not implement latest routing.
66
59
  */
67
60
  export declare function startWorkflowPreferLatest<TArgs extends unknown[], TResult>(workflow: WorkflowFunction<TArgs, TResult> | WorkflowMetadata, args: TArgs, options?: StartOptionsWithoutDeploymentId): Promise<Run<unknown> | Run<TResult>>;
61
+ /**
62
+ * Starts on the deployment that accepted a delivery when this step is running
63
+ * there, otherwise preserves latest-deployment routing.
64
+ */
65
+ export declare function startWorkflowPreferAcceptedDeployment<TArgs extends unknown[], TResult>(workflow: WorkflowFunction<TArgs, TResult> | WorkflowMetadata, args: TArgs, acceptedDeploymentId: string | undefined, options?: StartOptionsWithoutDeploymentId): Promise<Run<unknown> | Run<TResult>>;
68
66
  export {};