eve 0.47.2 → 0.47.5
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.
- package/CHANGELOG.md +36 -0
- package/bin/eve.js +4 -0
- package/dist/src/channel/activity-renderer.d.ts +21 -0
- package/dist/src/channel/activity-renderer.js +1 -0
- package/dist/src/channel/activity-sink.d.ts +2 -0
- package/dist/src/channel/activity-sink.js +1 -0
- package/dist/src/channel/auth/oidc.js +1 -1
- package/dist/src/channel/channel-address.js +1 -1
- package/dist/src/channel/compiled-channel.d.ts +2 -0
- package/dist/src/channel/compiled-channel.js +2 -2
- package/dist/src/channel/forwarded-principal.js +1 -1
- package/dist/src/channel/session.d.ts +3 -2
- package/dist/src/channel/session.js +1 -1
- package/dist/src/channel/types.d.ts +11 -0
- package/dist/src/chunks/{use-eve-agent-CacMaX4P.js → use-eve-agent-DjYwFJF7.js} +1 -0
- package/dist/src/chunks/{use-eve-agent-kmlFdOBB.js → use-eve-agent-DkUB0Ok4.js} +1 -0
- package/dist/src/cli/dev/tui/status-line.d.ts +6 -0
- package/dist/src/cli/dev/tui/status-line.js +1 -1
- package/dist/src/cli/dev/tui/terminal-renderer.js +12 -12
- package/dist/src/cli/dev/tui/traces/trace-conversation.js +1 -1
- package/dist/src/cli/dev/tui/tui.js +1 -1
- package/dist/src/compiled/.vendor-stamp.json +1 -1
- package/dist/src/compiled/@opentelemetry/api/index.d.ts +37 -0
- package/dist/src/compiled/@vercel/otel/index.d.ts +11 -0
- package/dist/src/compiler/extension-compatibility.d.ts +11 -9
- package/dist/src/compiler/extension-compatibility.js +1 -1
- package/dist/src/compiler/manifest.d.ts +14 -2
- package/dist/src/compiler/manifest.js +1 -1
- package/dist/src/compiler/normalize-connection.d.ts +9 -2
- package/dist/src/compiler/normalize-connection.js +1 -1
- package/dist/src/compiler/normalize-manifest.js +1 -1
- package/dist/src/compiler/normalize-subagent.js +1 -1
- package/dist/src/compiler/validate-artifact.js +1 -1
- package/dist/src/context/dynamic-connection-lifecycle.d.ts +9 -0
- package/dist/src/context/dynamic-connection-lifecycle.js +1 -0
- package/dist/src/context/keys.d.ts +5 -2
- package/dist/src/context/keys.js +1 -1
- package/dist/src/context/memory-tools.js +1 -1
- package/dist/src/context/providers/connection.js +1 -1
- package/dist/src/dynamic/definition.d.ts +6 -3
- package/dist/src/dynamic/definition.js +1 -1
- package/dist/src/eve-channel/activity-observer-request.d.ts +7 -0
- package/dist/src/eve-channel/activity-observer-request.js +1 -0
- package/dist/src/eve-channel/index.js +1 -1
- package/dist/src/eve-channel/request.d.ts +3 -1
- package/dist/src/eve-channel/request.js +1 -1
- package/dist/src/execution/activity-collector.d.ts +12 -0
- package/dist/src/execution/activity-collector.js +1 -0
- package/dist/src/execution/activity-events.d.ts +7 -0
- package/dist/src/execution/activity-events.js +1 -0
- package/dist/src/execution/activity-route.d.ts +2 -0
- package/dist/src/execution/activity-route.js +1 -0
- package/dist/src/execution/activity-text.d.ts +3 -0
- package/dist/src/execution/activity-text.js +1 -0
- package/dist/src/execution/activity-work-id.d.ts +9 -0
- package/dist/src/execution/activity-work-id.js +1 -0
- package/dist/src/execution/activity-work.d.ts +20 -0
- package/dist/src/execution/activity-work.js +1 -0
- package/dist/src/execution/agent-handle-dispatch.d.ts +3 -1
- package/dist/src/execution/agent-handle-dispatch.js +1 -1
- package/dist/src/execution/authorization-callback-match.js +1 -1
- package/dist/src/execution/cancelled-turn-message.d.ts +2 -0
- package/dist/src/execution/cancelled-turn-message.js +1 -0
- package/dist/src/execution/delegated-parent-notification.js +1 -1
- package/dist/src/execution/dispatch-runtime-actions-shared.d.ts +8 -0
- package/dist/src/execution/dispatch-runtime-actions-shared.js +1 -1
- package/dist/src/execution/dispatch-runtime-actions-step.js +1 -1
- package/dist/src/execution/dynamic-connections.d.ts +9 -0
- package/dist/src/execution/dynamic-connections.js +1 -0
- package/dist/src/execution/eve-workflow-attributes.js +1 -1
- package/dist/src/execution/node-step.d.ts +2 -0
- package/dist/src/execution/node-step.js +1 -1
- package/dist/src/execution/remote-agent-dispatch.d.ts +3 -1
- package/dist/src/execution/remote-agent-dispatch.js +1 -1
- package/dist/src/execution/runtime-context.js +1 -1
- package/dist/src/execution/sandbox/bindings/vercel-credentials.js +1 -1
- package/dist/src/execution/session-activity-projection.d.ts +14 -0
- package/dist/src/execution/session-activity-projection.js +1 -0
- package/dist/src/execution/session-activity-renderer-step.d.ts +15 -0
- package/dist/src/execution/session-activity-renderer-step.js +1 -0
- package/dist/src/execution/session-activity.d.ts +6 -0
- package/dist/src/execution/session-activity.js +1 -0
- package/dist/src/execution/session-callback-request.d.ts +1 -0
- package/dist/src/execution/session-callback-request.js +1 -1
- package/dist/src/execution/session-callback-route.js +1 -1
- package/dist/src/execution/settle-cancelled-turn-step.js +1 -1
- package/dist/src/execution/subagent-start-local.d.ts +1 -0
- package/dist/src/execution/subagent-start-local.js +1 -1
- package/dist/src/execution/subagent-start-remote.d.ts +1 -0
- package/dist/src/execution/subagent-start-remote.js +1 -1
- package/dist/src/execution/subagent-tool.d.ts +2 -1
- package/dist/src/execution/subagent-tool.js +1 -1
- package/dist/src/execution/submit-activity.d.ts +7 -0
- package/dist/src/execution/submit-activity.js +1 -0
- package/dist/src/execution/tasks/child/steps.d.ts +8 -0
- package/dist/src/execution/tasks/child/steps.js +1 -1
- package/dist/src/execution/tasks/child/update.js +1 -1
- package/dist/src/execution/tasks/child/workflow.d.ts +3 -0
- package/dist/src/execution/tasks/child/workflow.js +1 -1
- package/dist/src/execution/tasks/parent/delegate.d.ts +3 -0
- package/dist/src/execution/tasks/parent/delegate.js +1 -1
- package/dist/src/execution/tasks/parent/dispatch-task-step.js +1 -1
- package/dist/src/execution/tasks/parent/hitl-proxy-steps.js +1 -1
- package/dist/src/execution/tasks/parent/tool-execution.js +1 -1
- package/dist/src/execution/terminate-child-sessions-step.js +1 -1
- package/dist/src/execution/tools/connection-search.js +2 -2
- package/dist/src/execution/tools/load-skill.js +1 -1
- package/dist/src/execution/tools/subagent/local.js +1 -1
- package/dist/src/execution/turn-control-receiver.js +1 -1
- package/dist/src/execution/turn-workflow.js +1 -1
- package/dist/src/execution/web-fetch/request.js +1 -1
- package/dist/src/execution/wire/session-inbox-contract.d.ts +2 -2
- package/dist/src/execution/wire/session-inbox-contract.js +1 -1
- package/dist/src/execution/wire/session-inbox-encoder.d.ts +6 -2
- package/dist/src/execution/wire/session-inbox-encoder.js +1 -1
- package/dist/src/execution/wire/session-inbox-wire.js +1 -1
- package/dist/src/execution/wire/session-inbox-wire.v2-migration.d.ts +4 -0
- package/dist/src/execution/wire/session-inbox-wire.v2-migration.js +1 -0
- package/dist/src/execution/wire/session-inbox-wire.v2.d.ts +478 -0
- package/dist/src/execution/wire/session-inbox-wire.v2.js +1 -0
- package/dist/src/execution/workflow-entry.js +1 -1
- package/dist/src/execution/workflow-runtime.d.ts +4 -0
- package/dist/src/execution/workflow-runtime.js +1 -1
- package/dist/src/execution/workflow-steps.js +1 -1
- package/dist/src/execution/workflow-trace-context.d.ts +3 -6
- package/dist/src/execution/workflow-trace-context.js +1 -1
- package/dist/src/harness/approval-delivery-coordinator.js +1 -1
- package/dist/src/harness/authorization.d.ts +11 -4
- package/dist/src/harness/authorization.js +1 -1
- package/dist/src/harness/inline-tool-authorization.d.ts +13 -1
- package/dist/src/harness/inline-tool-authorization.js +1 -1
- package/dist/src/harness/model-call-error.js +1 -1
- package/dist/src/harness/semantic-errors/rule.d.ts +5 -2
- package/dist/src/harness/semantic-errors/rules/gateway.js +1 -1
- package/dist/src/harness/tool-loop.js +2 -2
- package/dist/src/harness/tool-model-output.js +1 -1
- package/dist/src/harness/turn-tag-state.d.ts +1 -1
- package/dist/src/harness/types.d.ts +2 -2
- package/dist/src/{harness → instrumentation}/ai-sdk-hook-bridge.d.ts +1 -1
- package/dist/src/instrumentation/ai-sdk-hook-bridge.js +1 -0
- package/dist/src/{harness → instrumentation}/ai-sdk-telemetry.d.ts +5 -1
- package/dist/src/instrumentation/ai-sdk-telemetry.js +1 -0
- package/dist/src/{harness/channel-delivery-instrumentation.d.ts → instrumentation/channel-delivery.d.ts} +5 -7
- package/dist/src/instrumentation/channel-delivery.js +1 -0
- package/dist/src/{harness/instrumentation → instrumentation}/config.d.ts +0 -10
- package/dist/src/instrumentation/config.js +1 -0
- package/dist/src/instrumentation/content-policy.d.ts +5 -0
- package/dist/src/instrumentation/content-policy.js +1 -0
- package/dist/src/{harness/instrumentation → instrumentation}/content.d.ts +1 -1
- package/dist/src/{harness/instrumentation → instrumentation}/dispatch.d.ts +1 -1
- package/dist/src/instrumentation/dispatch.js +1 -0
- package/dist/src/{harness/instrumentation → instrumentation}/lifecycle.d.ts +34 -35
- package/dist/src/instrumentation/lifecycle.js +1 -0
- package/dist/src/{harness/instrumentation → instrumentation}/native-events.d.ts +1 -1
- package/dist/src/instrumentation/native-events.js +1 -0
- package/dist/src/{harness → instrumentation}/parent-lineage.d.ts +1 -1
- package/dist/src/instrumentation/prepare-trace-context.d.ts +24 -0
- package/dist/src/instrumentation/prepare-trace-context.js +1 -0
- package/dist/src/instrumentation/provider.d.ts +13 -9
- package/dist/src/{harness/instrumentation → instrumentation}/providers.d.ts +1 -1
- package/dist/src/instrumentation/providers.js +1 -0
- package/dist/src/{harness/instrumentation → instrumentation}/runtime-context.d.ts +13 -2
- package/dist/src/instrumentation/runtime-context.js +1 -0
- package/dist/src/instrumentation/runtime.d.ts +100 -0
- package/dist/src/instrumentation/runtime.js +1 -0
- package/dist/src/{harness/instrumentation → instrumentation}/state.d.ts +2 -11
- package/dist/src/internal/application/compiled-artifacts.js +4 -4
- package/dist/src/internal/application/package.js +1 -1
- package/dist/src/internal/authored-definition/connection.js +1 -1
- package/dist/src/internal/instrumentation.d.ts +1 -1
- package/dist/src/internal/nitro/routes/channel-request-instrumentation.d.ts +4 -6
- package/dist/src/internal/nitro/routes/channel-request-instrumentation.js +1 -1
- package/dist/src/internal/user-agent.d.ts +2 -0
- package/dist/src/internal/user-agent.js +1 -1
- package/dist/src/packages/eve-catalog/src/index.js +1 -1
- package/dist/src/protocol/activity.d.ts +105 -0
- package/dist/src/protocol/activity.js +1 -0
- package/dist/src/protocol/message.js +2 -2
- package/dist/src/protocol/routes.d.ts +4 -0
- package/dist/src/protocol/routes.js +1 -1
- package/dist/src/public/channels/auth.js +1 -1
- package/dist/src/public/channels/slack/defaults.js +6 -3
- package/dist/src/public/channels/slack/index.d.ts +1 -1
- package/dist/src/public/channels/slack/interactions.d.ts +8 -5
- package/dist/src/public/channels/slack/interactions.js +1 -1
- package/dist/src/public/channels/slack/slackChannel.d.ts +66 -1
- package/dist/src/public/channels/slack/slash-command.d.ts +9 -0
- package/dist/src/public/channels/slack/slash-command.js +1 -0
- package/dist/src/public/connections/index.d.ts +2 -0
- package/dist/src/public/connections/index.js +1 -1
- package/dist/src/public/definitions/connections/dynamic.d.ts +23 -0
- package/dist/src/public/definitions/connections/dynamic.js +1 -0
- package/dist/src/public/definitions/connections/mcp.d.ts +8 -0
- package/dist/src/public/definitions/connections/openapi.d.ts +8 -0
- package/dist/src/public/definitions/connections/protocol.d.ts +6 -0
- package/dist/src/public/definitions/connections/protocol.js +1 -1
- package/dist/src/runtime/channels/registry.js +1 -1
- package/dist/src/runtime/connections/authorization-tokens.d.ts +11 -10
- package/dist/src/runtime/connections/instance-identity.d.ts +12 -0
- package/dist/src/runtime/connections/instance-identity.js +1 -0
- package/dist/src/runtime/connections/mcp-client.js +1 -1
- package/dist/src/runtime/connections/openapi-client.js +1 -1
- package/dist/src/runtime/connections/registry.d.ts +2 -0
- package/dist/src/runtime/connections/registry.js +1 -1
- package/dist/src/runtime/connections/scoped-authorization.d.ts +10 -6
- package/dist/src/runtime/connections/scoped-authorization.js +1 -1
- package/dist/src/runtime/resolve-agent.js +1 -1
- package/dist/src/runtime/resolve-connection.d.ts +5 -0
- package/dist/src/runtime/resolve-connection.js +1 -1
- package/dist/src/runtime/resolve-dynamic-connection.d.ts +5 -0
- package/dist/src/runtime/resolve-dynamic-connection.js +1 -0
- package/dist/src/runtime/subagents/dynamic-remote-agent-config.js +1 -1
- package/dist/src/runtime/types.d.ts +11 -0
- package/dist/src/setup/flows/registry.js +1 -1
- package/dist/src/setup/gateway-models.js +1 -1
- package/dist/src/setup/scaffold/create/project.js +1 -1
- package/dist/src/setup/scaffold/create/web-template.d.ts +1 -1
- package/dist/src/setup/scaffold/create/web-template.js +9 -5
- package/dist/src/shared/trace-policy.d.ts +20 -0
- package/dist/src/shared/trace-policy.js +1 -0
- package/dist/src/svelte/index.js +1 -1
- package/dist/src/svelte/use-eve-agent.js +1 -1
- package/dist/src/tracing/agent-action-instrumentation.d.ts +1 -1
- package/dist/src/tracing/agent-action-instrumentation.js +1 -1
- package/dist/src/tracing/agent-approval-instrumentation.d.ts +1 -3
- package/dist/src/tracing/agent-approval-instrumentation.js +1 -1
- package/dist/src/tracing/agent-channel-delivery-instrumentation.d.ts +1 -1
- package/dist/src/tracing/agent-channel-delivery-instrumentation.js +1 -1
- package/dist/src/tracing/agent-otel-provider.d.ts +4 -4
- package/dist/src/tracing/agent-otel-provider.js +2 -2
- package/dist/src/tracing/agent-otel-runtime-context.d.ts +5 -0
- package/dist/src/tracing/agent-otel-runtime-context.js +1 -0
- package/dist/src/tracing/agent-otel-session-context.d.ts +3 -3
- package/dist/src/tracing/agent-otel-session-context.js +1 -1
- package/dist/src/tracing/agent-otel-usage.d.ts +4 -2
- package/dist/src/tracing/agent-otel-usage.js +1 -1
- package/dist/src/tracing/agent-span-id-generator.d.ts +1 -1
- package/dist/src/tracing/agent-tool-instrumentation.d.ts +1 -1
- package/dist/src/tracing/agent-tool-instrumentation.js +1 -1
- package/dist/src/tracing/agent-trace-context-store.d.ts +6 -0
- package/dist/src/tracing/agent-trace-context-store.js +1 -1
- package/dist/src/tracing/agent-trace-context.d.ts +3 -0
- package/dist/src/tracing/agent-trace-context.js +1 -0
- package/dist/src/tracing/agent-trace-state.d.ts +10 -1
- package/dist/src/tracing/agent-trace-state.js +1 -1
- package/dist/src/tracing/install-instrumentation-runtime.d.ts +3 -2
- package/dist/src/tracing/install-instrumentation-runtime.js +1 -1
- package/dist/src/tracing/local-instrumentation-runtime.d.ts +1 -1
- package/dist/src/tracing/local-instrumentation-runtime.js +1 -1
- package/dist/src/tracing/local-trace-reader.d.ts +1 -0
- package/dist/src/tracing/local-trace-reader.js +1 -1
- package/dist/src/tracing/otel-declaration.d.ts +20 -19
- package/dist/src/tracing/otel-declaration.js +1 -1
- package/dist/src/tracing/otel-registration.js +1 -1
- package/dist/src/tracing/sampled-trace.d.ts +1 -14
- package/dist/src/tracing/sampled-trace.js +1 -1
- package/dist/src/vue/index.js +1 -1
- package/dist/src/vue/use-eve-agent.js +1 -1
- package/docs/channels/slack.mdx +25 -5
- package/docs/connections/overview.mdx +46 -2
- package/docs/extensions.md +2 -2
- package/docs/getting-started.mdx +1 -1
- package/docs/guides/dynamic-capabilities.md +91 -5
- package/docs/memory.md +7 -4
- package/docs/reference/cli.md +8 -8
- package/docs/reference/typescript-api.md +32 -23
- package/package.json +1 -1
- package/dist/src/execution/subagent-usage-span.d.ts +0 -9
- package/dist/src/execution/subagent-usage-span.js +0 -1
- package/dist/src/harness/ai-sdk-hook-bridge.js +0 -1
- package/dist/src/harness/ai-sdk-telemetry.js +0 -1
- package/dist/src/harness/channel-delivery-instrumentation.js +0 -1
- package/dist/src/harness/instrumentation/config.js +0 -1
- package/dist/src/harness/instrumentation/content-policy.d.ts +0 -7
- package/dist/src/harness/instrumentation/content-policy.js +0 -1
- package/dist/src/harness/instrumentation/dispatch.js +0 -1
- package/dist/src/harness/instrumentation/lifecycle.js +0 -1
- package/dist/src/harness/instrumentation/native-events.js +0 -1
- package/dist/src/harness/instrumentation/providers.js +0 -1
- package/dist/src/harness/instrumentation/runtime-context.js +0 -1
- package/dist/src/harness/instrumentation/runtime.d.ts +0 -21
- package/dist/src/harness/instrumentation/runtime.js +0 -1
- package/dist/src/harness/prepare-trace-context.d.ts +0 -21
- package/dist/src/harness/prepare-trace-context.js +0 -1
- /package/dist/src/{harness/instrumentation → instrumentation}/content.js +0 -0
- /package/dist/src/{harness → instrumentation}/parent-lineage.js +0 -0
- /package/dist/src/{harness/instrumentation → instrumentation}/setup-context.d.ts +0 -0
- /package/dist/src/{harness/instrumentation → instrumentation}/setup-context.js +0 -0
- /package/dist/src/{harness/instrumentation → instrumentation}/state.js +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
import{resolveWorkflowCallbackBaseUrl}from"#execution/workflow-callback-url.js";import{migrateTurnWorkflowInput}from"#execution/durable-session-migrations/turn-workflow.js";import{dispatchRuntimeActionsStep}from"#execution/dispatch-runtime-actions-step.js";import{dispatchTaskStep}from"#execution/tasks/parent/dispatch-task-step.js";import{routeDeliverToChildren}from"#execution/route-child-delivery.js";import{getRuntimeActionResultKey}from"#runtime/actions/keys.js";import{runProxySubagentEventStep}from"#execution/subagent-event-proxy-step.js";import{
|
|
1
|
+
import{createHook,getWorkflowMetadata,sleep}from"#compiled/@workflow/core/index.js";import{claimHookOwnership,disposeHook,isHookConflictError}from"#execution/hook-ownership.js";import{resolveWorkflowCallbackBaseUrl}from"#execution/workflow-callback-url.js";import{migrateTurnWorkflowInput}from"#execution/durable-session-migrations/turn-workflow.js";import{dispatchRuntimeActionsStep}from"#execution/dispatch-runtime-actions-step.js";import{dispatchTaskStep}from"#execution/tasks/parent/dispatch-task-step.js";import{activeTurnId}from"#harness/active-turn-id.js";import{routeDeliverToChildren}from"#execution/route-child-delivery.js";import{getRuntimeActionResultKey}from"#runtime/actions/keys.js";import{runProxySubagentEventStep}from"#execution/subagent-event-proxy-step.js";import{acknowledgeDelegatedTasksStep}from"#execution/tasks/parent/delegate.js";import{normalizeSerializableError}from"#execution/workflow-errors.js";import{sendTurnControlStep}from"#execution/turn-control-protocol.js";import{isInboxSubagentResultFromRunningHandle}from"#harness/handles/query.js";import{preserveSerializedSessionDynamicModelSelection}from"#context/serialized-dynamic-model-selection.js";import{cancelDescendantTurnsStep}from"#execution/cancel-descendant-turns-step.js";import{dispatchWorkflowRuntimeActionsStep}from"#execution/dispatch-workflow-runtime-actions-step.js";import{createTurnCancellationControl}from"#execution/turn-cancellation-control.js";import{TurnExecutionCursor}from"#execution/turn-execution-cursor.js";import{turnStep}from"#execution/workflow-steps.js";import{resolveRuntimeActionResultsForKeys}from"#runtime/actions/results.js";const TASK_MODE_WAIT_ERROR_MESSAGE="Task mode cannot wait for follow-up input (`next: null`).";async function turnWorkflow(e){"use workflow";let t=migrateTurnWorkflowInput(e);return t.driverCapabilities?.turnInbox===!0?runTurnOwnedWorkflow(t):runLegacyTurnWorkflow(t)}async function runTurnOwnedWorkflow(n){let s=createHook({token:`${n.completionToken}:inbox`}),l=s[Symbol.asyncIterator](),u=new TurnExecutionCursor({controlToken:n.completionToken,parentWritable:n.stepInput.parentWritable,serializedContext:n.stepInput.serializedContext,sessionState:n.stepInput.sessionState}),d=0,nextDeliveryRequestId=()=>`${s.token}:delivery:${String(d++)}`,f=[],p=n.stepInput.input,m=!1,h;try{try{await claimHookOwnership(s),m=!0}catch(e){if(isHookConflictError(e))return;throw e}for(n.driverCapabilities?.cancelledTurnSettle===!0&&(h=await createTurnCancellationControl({controlToken:n.completionToken,expectedTurnId:activeTurnId(n.stepInput.sessionState.emissionState)}));;){let e={serializedContext:u.serializedContext,sessionState:u.sessionState},r=await turnStep(u.createStepInput(p,h?.signal)),i=r.action===`dispatch-workflow-runtime-actions`||r.action===`park`?r.pendingRuntimeActionKeys:void 0,a=(r.backgroundTasks?.length??0)>0;if(a){if(r.backgroundTaskState===void 0)throw Error(`Background tasks were returned without their committed session state.`);await u.adopt({serializedContext:e.serializedContext,sessionState:r.backgroundTaskState}),await acknowledgeDelegatedTasksStep({tasks:r.backgroundTasks??[]})}if(r.action===`cancelled`){await u.adopt({serializedContext:r.serializedContext,sessionState:r.backgroundTaskState??r.sessionState}),await finishCancelledTurn({bufferedDeliveries:f,cancellation:h,cursor:u});return}if(h?.signal.aborted===!0&&(i===void 0||a)){await u.adopt({serializedContext:preserveSerializedSessionDynamicModelSelection(e.serializedContext,r.serializedContext),sessionState:u.sessionState}),await finishCancelledTurn({bufferedDeliveries:f,cancellation:h,cursor:u});return}if(r.sleepDurationMs!==void 0&&await waitForTurnSleep(r.sleepDurationMs,h)===`cancel`){await finishCancelledTurn({bufferedDeliveries:f,cancellation:h,cursor:u});return}if(r.action===`done`){await h?.dispose(),await u.finish(r,{kind:`done`,output:r.output??``,isError:r.isError,usage:r.usage,usageDelta:r.usageDelta},f);return}if(i!==void 0){await u.adopt(r);let e=r.action===`park`&&r.tasksEnabled,n;n=r.action===`dispatch-workflow-runtime-actions`?dispatchWorkflowRuntimeActionsStep:e?dispatchTaskStep:dispatchRuntimeActionsStep;let a=await n({callbackBaseUrl:resolveWorkflowCallbackBaseUrl(getWorkflowMetadata().url),parentContinuationToken:s.token,parentWritable:u.parentWritable,serializedContext:u.serializedContext,sessionState:u.sessionState}),c=a.results.length===0?void 0:Date.now();await u.adopt(a),await acknowledgeDelegatedTasksStep({tasks:a.pendingTasks});let d=await waitForRuntimeActionResults({bufferedDeliveries:f,cancellation:h,cursor:u,inboxToken:s.token,initialAcceptedAtMs:c,initialResults:a.results,iterator:l,nextDeliveryRequestId,pendingActionKeys:i});if(d===`cancelled`){p=void 0;continue}if(d===`cancel-turn`){await finishCancelledTurn({bufferedDeliveries:f,cancellation:h,cursor:u});return}p={kind:`runtime-action-result`,...d};continue}if(r.action===`park`){if(!(r.hasPendingAuthorization||r.hasPendingInputBatch&&n.capabilities?.requestInput===!0||n.mode===`conversation`))throw Error(TASK_MODE_WAIT_ERROR_MESSAGE);await h?.dispose(),await u.finish(r,{authorizationAttemptIds:r.authorizationAttemptIds,authorizationNames:r.authorizationNames,kind:`park`,settled:r.settled},f);return}await u.adopt(r),p=void 0}}catch(e){throw await u.send({error:normalizeSerializableError(e),kind:`turn-error`}),e}finally{h!==void 0&&await h.dispose(),m&&await disposeHook(s)}}async function finishCancelledTurn(e){await cancelDescendantTurnsStep({serializedContext:e.cursor.serializedContext,sessionState:e.cursor.sessionState}),await e.cancellation?.dispose(),await e.cursor.finish({sessionState:e.cursor.sessionState},{cancelled:!0,kind:`park`},e.bufferedDeliveries)}async function waitForTurnSleep(e,t){if(t?.signal.aborted===!0)return`cancel`;let r=sleep(e).then(()=>`slept`);return t===void 0?r:Promise.race([r,t.requested])}async function waitForRuntimeActionResults(e){let t,n=[...e.initialResults],r=new Map;if(e.initialAcceptedAtMs!==void 0)for(let t of e.initialResults)r.set(getRuntimeActionResultKey(t),e.initialAcceptedAtMs);for(;;){let i=resolveRuntimeActionResultsForKeys({pendingKeys:e.pendingActionKeys,results:n});if(i!==void 0)return t!==void 0&&await e.cursor.send({kind:`turn-delivery-cancelled`,requestId:t}),{acceptedAtMsByCallId:Object.fromEntries(i.map(e=>[e.callId,r.get(getRuntimeActionResultKey(e))])),results:i};e.cursor.sessionState.hasProxyInputRequests&&t===void 0&&(t=e.nextDeliveryRequestId(),await e.cursor.send({continuationToken:e.cursor.sessionState.continuationToken,inboxToken:e.inboxToken,kind:`turn-delivery-request`,requestId:t}));let a=e.iterator.next();a.catch(()=>{});let o=await(e.cancellation===void 0?a:Promise.race([a,e.cancellation.requested]));if(o===`cancel`)return t!==void 0&&await e.cursor.send({kind:`turn-delivery-cancelled`,requestId:t}),`cancelled`;if(o.done)throw Error(`Turn inbox closed before runtime actions completed.`);let s=o.value;if(s.kind===`runtime-action-result`){let t=e.cursor.sessionState.snapshot?.session.state,i=s.results.filter(e=>isInboxSubagentResultFromRunningHandle(t,e));if(i.length>0){let e=Date.now();n.push(...i);for(let t of i)r.set(getRuntimeActionResultKey(t),e)}continue}if(s.kind===`subagent-input-request`||s.kind===`subagent-authorization-event`){let t=await runProxySubagentEventStep({hookPayload:s,parentWritable:e.cursor.parentWritable,serializedContext:e.cursor.serializedContext,sessionState:e.cursor.sessionState});await e.cursor.adopt(t);continue}if(s.kind===`driver-delivery`&&s.requestId===t){await e.cursor.send({kind:`turn-delivery-accepted`,requestId:s.requestId}),t=void 0;let n=await routeDeliverToChildren({delivery:s.delivery,parentWritable:e.cursor.parentWritable,serializedContext:e.cursor.serializedContext,sessionState:e.cursor.sessionState});if(await e.cursor.adopt({serializedContext:n.serializedContext??e.cursor.serializedContext,sessionState:n.sessionState??e.cursor.sessionState}),n.kind===`cancel-turn`)return n.kind;n.remainder!==void 0&&e.bufferedDeliveries.push(n.remainder)}}}async function runLegacyTurnWorkflow(e){let t=e.stepInput;try{for(;;){let r=await turnStep(t);if(r.action!==`cancelled`&&r.sleepDurationMs!==void 0&&await sleep(r.sleepDurationMs),r.action===`done`){await sendTurnControlStep({controlToken:e.completionToken,payload:{action:{kind:`done`,output:r.output??``,isError:r.isError,serializedContext:r.serializedContext,sessionState:r.sessionState,usage:r.usage,usageDelta:r.usageDelta},kind:`turn-result`}});return}if(r.action===`dispatch-workflow-runtime-actions`){await sendTurnControlStep({controlToken:e.completionToken,payload:{action:{kind:`dispatch-workflow-runtime-actions`,pendingActionKeys:r.pendingRuntimeActionKeys,serializedContext:r.serializedContext,sessionState:r.sessionState},kind:`turn-result`}});return}if(r.action===`park`){let t=r.pendingRuntimeActionKeys;if(!(t!==void 0||r.hasPendingAuthorization||r.hasPendingInputBatch&&e.capabilities?.requestInput===!0||e.mode===`conversation`))throw Error(TASK_MODE_WAIT_ERROR_MESSAGE);let n=t===void 0?{kind:`park`,serializedContext:r.serializedContext,sessionState:r.sessionState,authorizationAttemptIds:r.authorizationAttemptIds,authorizationNames:r.authorizationNames,settled:r.settled}:{kind:`dispatch-runtime-actions`,pendingActionKeys:t,serializedContext:r.serializedContext,sessionState:r.sessionState};await sendTurnControlStep({controlToken:e.completionToken,payload:{action:n,kind:`turn-result`}});return}t={input:void 0,parentWritable:t.parentWritable,serializedContext:r.serializedContext,sessionState:r.sessionState}}}catch(t){throw await sendTurnControlStep({controlToken:e.completionToken,payload:{error:normalizeSerializableError(t),kind:`turn-error`}}),t}}export{turnWorkflow};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{isLoopbackHostname,isPrivateOrReservedIpAddress}from"#shared/network-address.js";import{isIP}from"node:net";import{lookup}from"node:dns";const REDIRECT_STATUSES=new Set([301,302,303,307,308]),UNSAFE_DESTINATION_ERROR=`URL must not target localhost, private, link-local, or reserved IP addresses.`;async function requestPublicUrl(e,t){let n=parseHttpsUrl(e);for(let e=0;;e++){let{dispatcher:r,response:a}=await requestOnce(n,t);try{let r=a.headers.get(`location`);if(r!==null&&REDIRECT_STATUSES.has(a.status)&&e<10){await cancelResponseBody(a),n=parseHttpsUrl(new URL(r,n).toString());continue}return await consumeResponse(a,t.maxResponseSize)}finally{await r.close()}}}function parseHttpsUrl(e){let t;try{t=new URL(e)}catch{throw Error(`URL must be a valid absolute https:// URL.`)}if(t.protocol!==`https:`)throw Error(`URL must start with https://`);return t}async function requestOnce(e,t){assertPublicHostname(e.hostname);let{Agent:n,Dispatcher1Wrapper:r}=await import(`undici`),i=new r(new n({connect:{lookup:createPublicLookup()}}));try{return{dispatcher:i,response:await fetchWithDispatcher(e,{dispatcher:i,headers:t.headers,redirect:`manual`,signal:t.signal})}}catch(e){throw await i.close(),e}}function fetchWithDispatcher(e,t){return fetch(e,t)}function assertPublicHostname(t){let r=t.replace(/^\[(.*)\]$/u,`$1`);if(isIP(r)!==0){assertPublicAddress(r);return}if(isLoopbackHostname(r))throw Error(UNSAFE_DESTINATION_ERROR)}function assertPublicAddress(e){if(isPrivateOrReservedIpAddress(e))throw Error(UNSAFE_DESTINATION_ERROR)}function createPublicLookup(){return(e,t,n)=>{lookup(e,{all:!0,verbatim:!0},(r,i)=>{if(r!==null){n(r,``,0);return}try{for(let{address:e}of i)assertPublicAddress(e)}catch(e){n(e,``,0);return}let a=t.family===void 0||t.family===0?i:i.filter(({family:e})=>e===t.family);if(a.length===0){let t=Error(`Unable to resolve URL hostname "${e}" in the requested IP family.`);Object.assign(t,{code:`ENOTFOUND`}),n(t,``,0);return}if(t.all===!0){n(null,a);return}let o=a[0];n(null,o.address,o.family)})}}async function consumeResponse(e,t){let n=parseContentLength(e.headers.get(`content-length`));if(n!==void 0&&n>t)throw await cancelResponseBody(e),createResponseTooLargeError();let r=await readBoundedBody(e,t),i=r.byteLength===0?null:Uint8Array.from(r).buffer;return new Response(i,{headers:e.headers,status:e.status,statusText:e.statusText})}function parseContentLength(e){if(e===null)return;let t=Number.parseInt(e,10);return Number.isFinite(t)&&t>=0?t:void 0}async function readBoundedBody(e,t){if(e.body===null)return new Uint8Array;let n=e.body.getReader(),r=[],i=0;try{for(;;){let{done:e,value:a}=await n.read();if(e)break;if(i+=a.byteLength,i>t)throw await n.cancel(),createResponseTooLargeError();r.push(a)}}finally{n.releaseLock()}let a=new Uint8Array(i),o=0;for(let e of r)a.set(e,o),o+=e.byteLength;return a}async function cancelResponseBody(e){try{await e.body?.cancel()}catch{}}function createResponseTooLargeError(){return Error(`Response too large (exceeds 5 MB limit).`)}export{requestPublicUrl};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/** Every explicit session-inbox wire version still supported by producers. */
|
|
2
|
-
export declare const SESSION_INBOX_WIRE_VERSIONS: readonly [1];
|
|
2
|
+
export declare const SESSION_INBOX_WIRE_VERSIONS: readonly [1, 2];
|
|
3
3
|
export type SessionInboxWireVersion = (typeof SESSION_INBOX_WIRE_VERSIONS)[number];
|
|
4
4
|
/** Current persisted session-inbox wire version. */
|
|
5
|
-
export declare const SESSION_INBOX_WIRE_VERSION: 1;
|
|
5
|
+
export declare const SESSION_INBOX_WIRE_VERSION: 1 | 2;
|
|
6
6
|
/** Hook metadata field advertising the consumer's inbox wire capability. */
|
|
7
7
|
export declare const SESSION_INBOX_WIRE_VERSION_METADATA_KEY = "sessionInboxWireVersion";
|
|
8
8
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const SESSION_INBOX_WIRE_VERSIONS=[1],SESSION_INBOX_WIRE_VERSION=SESSION_INBOX_WIRE_VERSIONS[SESSION_INBOX_WIRE_VERSIONS.length-1],SESSION_INBOX_WIRE_VERSION_METADATA_KEY=`sessionInboxWireVersion`;function isSessionInboxWireVersion(t){return SESSION_INBOX_WIRE_VERSIONS.some(e=>e===t)}var SessionInboxWireError=class extends Error{constructor(e){super(e),this.name=`SessionInboxWireError`}};export{SESSION_INBOX_WIRE_VERSION,SESSION_INBOX_WIRE_VERSIONS,SESSION_INBOX_WIRE_VERSION_METADATA_KEY,SessionInboxWireError,isSessionInboxWireVersion};
|
|
1
|
+
const SESSION_INBOX_WIRE_VERSIONS=[1,2],SESSION_INBOX_WIRE_VERSION=SESSION_INBOX_WIRE_VERSIONS[SESSION_INBOX_WIRE_VERSIONS.length-1],SESSION_INBOX_WIRE_VERSION_METADATA_KEY=`sessionInboxWireVersion`;function isSessionInboxWireVersion(t){return SESSION_INBOX_WIRE_VERSIONS.some(e=>e===t)}var SessionInboxWireError=class extends Error{constructor(e){super(e),this.name=`SessionInboxWireError`}};export{SESSION_INBOX_WIRE_VERSION,SESSION_INBOX_WIRE_VERSIONS,SESSION_INBOX_WIRE_VERSION_METADATA_KEY,SessionInboxWireError,isSessionInboxWireVersion};
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import type { DeliverHookPayload, SessionCommand, SessionTimeoutHookPayload } from "#channel/types.js";
|
|
2
2
|
import { type SessionInboxWireV1 } from "#execution/wire/session-inbox-wire.v1.js";
|
|
3
|
+
import { type SessionInboxWireV2 } from "#execution/wire/session-inbox-wire.v2.js";
|
|
3
4
|
import { type SessionInboxWireTarget, type SessionInboxWireVersion } from "#execution/wire/session-inbox-contract.js";
|
|
4
5
|
type SessionInboxCommand = DeliverHookPayload | SessionCommand | SessionTimeoutHookPayload;
|
|
5
6
|
/** Current wire type consumed after migration. */
|
|
6
|
-
export type SessionInboxWire =
|
|
7
|
+
export type SessionInboxWire = SessionInboxWireV2;
|
|
7
8
|
type LegacySessionInboxWireTarget = Extract<SessionInboxWireTarget, {
|
|
8
9
|
readonly version: 0;
|
|
9
10
|
}>;
|
|
@@ -11,11 +12,14 @@ type LegacySessionInboxWireTarget = Extract<SessionInboxWireTarget, {
|
|
|
11
12
|
declare function encode(command: SessionInboxCommand, target: {
|
|
12
13
|
readonly version: 1;
|
|
13
14
|
}): SessionInboxWireV1;
|
|
15
|
+
declare function encode(command: SessionInboxCommand, target: {
|
|
16
|
+
readonly version: 2;
|
|
17
|
+
}): SessionInboxWireV2;
|
|
14
18
|
declare function encode(command: SessionInboxCommand, target: {
|
|
15
19
|
readonly version: SessionInboxWireVersion;
|
|
16
20
|
}): unknown;
|
|
17
21
|
declare function encode(command: SessionInboxCommand, target: LegacySessionInboxWireTarget): Record<string, unknown>;
|
|
18
|
-
declare function encode(command: SessionInboxCommand, target: SessionInboxWireTarget): SessionInboxWireV1 | Record<string, unknown>;
|
|
22
|
+
declare function encode(command: SessionInboxCommand, target: SessionInboxWireTarget): SessionInboxWireV1 | SessionInboxWireV2 | Record<string, unknown>;
|
|
19
23
|
/** Server/step-safe producer facade. */
|
|
20
24
|
export declare const sessionInboxWire: {
|
|
21
25
|
readonly encode: typeof encode;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{SessionInboxWireError,isSessionInboxWireVersion}from"#execution/wire/session-inbox-contract.js";import{encodeSessionCommandV1}from"#execution/wire/session-inbox-wire.v1.js";import{encodeSessionCommandV0}from"#execution/wire/session-inbox-wire.v0.js";const versionedEncoders={1:encodeSessionCommandV1};function encode(
|
|
1
|
+
import{SessionInboxWireError,isSessionInboxWireVersion}from"#execution/wire/session-inbox-contract.js";import{encodeSessionCommandV1}from"#execution/wire/session-inbox-wire.v1.js";import{encodeSessionCommandV2}from"#execution/wire/session-inbox-wire.v2.js";import{encodeSessionCommandV0}from"#execution/wire/session-inbox-wire.v0.js";const versionedEncoders={1:e=>encodeSessionCommandV1(withoutActivityObserver(e)),2:encodeSessionCommandV2};function encode(r,i){if(i.version===0)return encodeSessionCommandV0(encodeSessionCommandV1(withoutActivityObserver(r)),i.variant);if(isSessionInboxWireVersion(i.version))return versionedEncoders[i.version](r);throw new SessionInboxWireError(`Cannot encode session inbox payload for unknown wire version ${JSON.stringify(i.version)}.`)}function withoutActivityObserver(e){if(!(`caller`in e)||e.caller?.activityObserver===void 0)return e;let{activityObserver:t,...n}=e.caller;return{...e,caller:n}}const sessionInboxWire={encode};export{sessionInboxWire};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{SESSION_INBOX_WIRE_VERSION,SessionInboxWireError,SessionInboxWireError as SessionInboxWireError$1}from"#execution/wire/session-inbox-contract.js";import{sessionInboxWireV0Migration}from"#execution/wire/session-inbox-wire.v0.js";import{runMigrationChain}from"#execution/durable-session-migrations/chain.js";const WIRE_LABEL=`session inbox payload`,sessionInboxMigrations=[sessionInboxWireV0Migration];function decode(t){let n;try{
|
|
1
|
+
import{SESSION_INBOX_WIRE_VERSION,SessionInboxWireError,SessionInboxWireError as SessionInboxWireError$1}from"#execution/wire/session-inbox-contract.js";import{sessionInboxWireV0Migration}from"#execution/wire/session-inbox-wire.v0.js";import{runMigrationChain}from"#execution/durable-session-migrations/chain.js";import{normalizeSessionInboxWireV2,sessionInboxWireV1Migration}from"#execution/wire/session-inbox-wire.v2-migration.js";const WIRE_LABEL=`session inbox payload`,sessionInboxMigrations=[sessionInboxWireV0Migration,sessionInboxWireV1Migration];function decode(t){let n=typeof t==`object`&&t&&`version`in t?t.version:void 0,r;try{r=runMigrationChain({initialVersion:0,label:WIRE_LABEL,migrations:sessionInboxMigrations,targetVersion:SESSION_INBOX_WIRE_VERSION,value:t})}catch(e){throw new SessionInboxWireError$1(e instanceof Error?e.message:String(e))}let i=normalizeSessionInboxWireV2(r);if(i.version!==SESSION_INBOX_WIRE_VERSION)throw new SessionInboxWireError$1(`${WIRE_LABEL} declares version ${JSON.stringify(i.version)}, expected ${SESSION_INBOX_WIRE_VERSION}.`);if(n===2&&i.kind===`deliver`&&!(`payload`in i))throw new SessionInboxWireError$1(`${WIRE_LABEL} does not match wire version 2.`);return normalizeWire(i)}const sessionInboxWire={decode};function normalizeWire(e){switch(e.kind){case`deliver`:return{auth:e.auth,caller:e.caller,deliveryMetadata:e.deliveryMetadata,kind:`deliver`,payloads:e.payloads,requestId:e.requestId,taskDeliveryId:e.taskDeliveryId,turnPolicy:e.turnPolicy};case`session-timeout`:return{kind:`session-timeout`};case`clear`:return{kind:`clear`};case`compact`:return{kind:`compact`};case`reset`:return{kind:`reset`,reason:e.reason};case`cancel`:return{kind:`cancel`,taskId:e.taskId,turnId:e.turnId};default:throw new SessionInboxWireError$1(`${WIRE_LABEL} has an unrecognized kind ${JSON.stringify(e.kind)}.`)}}export{SessionInboxWireError,sessionInboxWire};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { VersionMigration } from "#execution/durable-session-migrations/chain.js";
|
|
2
|
+
export declare const sessionInboxWireV1Migration: VersionMigration;
|
|
3
|
+
/** Converts Workflow-VM records into this realm before wire consumption. */
|
|
4
|
+
export declare function normalizeSessionInboxWireV2(value: unknown, arrayFallback?: boolean): unknown;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{isObject}from"#shared/guards.js";const sessionInboxWireV1Migration={from:1,migrate(e){let t=normalizeSessionInboxWireV2(e);return{...t,...t.kind===`deliver`&&!(`payload`in t)?{payload:{}}:{},version:2}},to:2};function normalizeSessionInboxWireV2(e,t=!1){return e===void 0?t?null:void 0:Array.isArray(e)?e.map(e=>normalizeSessionInboxWireV2(e,!0)):isPlainRecord$1(e)?Object.fromEntries(Object.entries(e).filter(e=>e[1]!==void 0).map(([e,t])=>[e,normalizeSessionInboxWireV2(t)])):e}function isPlainRecord$1(t){if(!isObject(t))return!1;let n=Object.getPrototypeOf(t);return n===null||n===Object.prototype||Object.getPrototypeOf(n)===null}export{normalizeSessionInboxWireV2,sessionInboxWireV1Migration};
|
|
@@ -0,0 +1,478 @@
|
|
|
1
|
+
import { z } from "#compiled/zod/index.js";
|
|
2
|
+
import type { DeliverHookPayload, SessionCommand, SessionTimeoutHookPayload } from "#channel/types.js";
|
|
3
|
+
/** Version 2 adds activity observer metadata to delegated callers. */
|
|
4
|
+
export declare const sessionInboxWireV2Schema: 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
|
+
deliveryMetadata: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
14
|
+
channelKind: z.ZodString;
|
|
15
|
+
channelName: z.ZodString;
|
|
16
|
+
deliveryId: z.ZodString;
|
|
17
|
+
payloadIndex: z.ZodNumber;
|
|
18
|
+
requestId: z.ZodOptional<z.ZodString>;
|
|
19
|
+
requestTraceContext: z.ZodOptional<z.ZodObject<{
|
|
20
|
+
spanId: z.ZodString;
|
|
21
|
+
traceFlags: z.ZodNumber;
|
|
22
|
+
traceId: z.ZodString;
|
|
23
|
+
}, z.core.$strict>>;
|
|
24
|
+
}, z.core.$strict>>>;
|
|
25
|
+
kind: z.ZodLiteral<"deliver">;
|
|
26
|
+
payloads: z.ZodArray<z.ZodObject<{
|
|
27
|
+
context: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
28
|
+
inputResponses: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
29
|
+
optionId: z.ZodOptional<z.ZodString>;
|
|
30
|
+
requestId: z.ZodString;
|
|
31
|
+
text: z.ZodOptional<z.ZodString>;
|
|
32
|
+
}, z.core.$strict>>>;
|
|
33
|
+
message: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
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
|
+
text: z.ZodString;
|
|
36
|
+
type: z.ZodLiteral<"text">;
|
|
37
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
38
|
+
image: z.ZodCustom<URL | import("ai").DataContent, URL | import("ai").DataContent>;
|
|
39
|
+
mediaType: z.ZodOptional<z.ZodString>;
|
|
40
|
+
providerOptions: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<import("../../shared/json.ts").JsonObject, unknown, z.core.$ZodTypeInternals<import("../../shared/json.ts").JsonObject, unknown>>>>;
|
|
41
|
+
type: z.ZodLiteral<"image">;
|
|
42
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
43
|
+
data: z.ZodCustom<URL | import("ai").DataContent, URL | import("ai").DataContent>;
|
|
44
|
+
filename: z.ZodOptional<z.ZodString>;
|
|
45
|
+
mediaType: z.ZodString;
|
|
46
|
+
providerOptions: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<import("../../shared/json.ts").JsonObject, unknown, z.core.$ZodTypeInternals<import("../../shared/json.ts").JsonObject, unknown>>>>;
|
|
47
|
+
type: z.ZodLiteral<"file">;
|
|
48
|
+
}, z.core.$strict>], "type">>]>>;
|
|
49
|
+
outputSchema: z.ZodOptional<z.ZodType<import("../../shared/json.ts").JsonObject, unknown, z.core.$ZodTypeInternals<import("../../shared/json.ts").JsonObject, unknown>>>;
|
|
50
|
+
task: z.ZodOptional<z.ZodObject<{
|
|
51
|
+
authorizationEvents: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
52
|
+
hookPayload: z.ZodObject<{
|
|
53
|
+
callId: z.ZodString;
|
|
54
|
+
childSessionId: z.ZodString;
|
|
55
|
+
event: z.ZodCustom<Record<string, unknown>, Record<string, unknown>>;
|
|
56
|
+
kind: z.ZodLiteral<"subagent-authorization-event">;
|
|
57
|
+
subagentName: z.ZodString;
|
|
58
|
+
}, z.core.$strict>;
|
|
59
|
+
taskId: z.ZodString;
|
|
60
|
+
}, z.core.$strict>>>;
|
|
61
|
+
inputRequests: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
62
|
+
hookPayload: z.ZodObject<{
|
|
63
|
+
callId: z.ZodString;
|
|
64
|
+
childContinuationToken: z.ZodString;
|
|
65
|
+
childSessionId: z.ZodString;
|
|
66
|
+
event: z.ZodObject<{
|
|
67
|
+
requests: z.ZodArray<z.ZodObject<{
|
|
68
|
+
action: z.ZodObject<{
|
|
69
|
+
callId: z.ZodString;
|
|
70
|
+
input: z.ZodType<import("../../shared/json.ts").JsonObject, unknown, z.core.$ZodTypeInternals<import("../../shared/json.ts").JsonObject, unknown>>;
|
|
71
|
+
kind: z.ZodLiteral<"tool-call">;
|
|
72
|
+
toolName: z.ZodString;
|
|
73
|
+
}, z.core.$strict>;
|
|
74
|
+
allowFreeform: z.ZodOptional<z.ZodBoolean>;
|
|
75
|
+
display: z.ZodOptional<z.ZodEnum<{
|
|
76
|
+
confirmation: "confirmation";
|
|
77
|
+
select: "select";
|
|
78
|
+
text: "text";
|
|
79
|
+
}>>;
|
|
80
|
+
kind: z.ZodEnum<{
|
|
81
|
+
question: "question";
|
|
82
|
+
"session-limit": "session-limit";
|
|
83
|
+
"tool-approval": "tool-approval";
|
|
84
|
+
}>;
|
|
85
|
+
options: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
86
|
+
description: z.ZodOptional<z.ZodString>;
|
|
87
|
+
id: z.ZodString;
|
|
88
|
+
label: z.ZodString;
|
|
89
|
+
style: z.ZodOptional<z.ZodEnum<{
|
|
90
|
+
danger: "danger";
|
|
91
|
+
default: "default";
|
|
92
|
+
primary: "primary";
|
|
93
|
+
}>>;
|
|
94
|
+
}, z.core.$strict>>>;
|
|
95
|
+
prompt: z.ZodString;
|
|
96
|
+
requestId: z.ZodString;
|
|
97
|
+
}, z.core.$strict>>;
|
|
98
|
+
sequence: z.ZodNumber;
|
|
99
|
+
stepIndex: z.ZodNumber;
|
|
100
|
+
turnId: z.ZodString;
|
|
101
|
+
}, z.core.$strict>;
|
|
102
|
+
kind: z.ZodLiteral<"subagent-input-request">;
|
|
103
|
+
subagentName: z.ZodString;
|
|
104
|
+
}, z.core.$strict>;
|
|
105
|
+
taskId: z.ZodString;
|
|
106
|
+
}, z.core.$strict>>>;
|
|
107
|
+
views: z.ZodOptional<z.ZodArray<z.ZodType<import("../../tasks/types.ts").TaskView, unknown, z.core.$ZodTypeInternals<import("../../tasks/types.ts").TaskView, unknown>>>>;
|
|
108
|
+
}, z.core.$strict>>;
|
|
109
|
+
}, z.core.$loose>>;
|
|
110
|
+
requestId: z.ZodOptional<z.ZodString>;
|
|
111
|
+
taskDeliveryId: z.ZodOptional<z.ZodString>;
|
|
112
|
+
turnPolicy: z.ZodOptional<z.ZodEnum<{
|
|
113
|
+
queue: "queue";
|
|
114
|
+
steer: "steer";
|
|
115
|
+
}>>;
|
|
116
|
+
caller: z.ZodOptional<z.ZodObject<{
|
|
117
|
+
callId: z.ZodString;
|
|
118
|
+
replyTo: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
119
|
+
kind: z.ZodLiteral<"hook">;
|
|
120
|
+
token: z.ZodString;
|
|
121
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
122
|
+
kind: z.ZodLiteral<"callback">;
|
|
123
|
+
token: z.ZodString;
|
|
124
|
+
url: z.ZodString;
|
|
125
|
+
}, z.core.$strict>], "kind">;
|
|
126
|
+
subagentName: z.ZodString;
|
|
127
|
+
taskId: z.ZodOptional<z.ZodString>;
|
|
128
|
+
activityObserver: z.ZodOptional<z.ZodObject<{
|
|
129
|
+
sink: z.ZodObject<{
|
|
130
|
+
url: z.ZodString;
|
|
131
|
+
version: z.ZodLiteral<1>;
|
|
132
|
+
}, z.core.$strict>;
|
|
133
|
+
workIdentity: z.ZodOptional<z.ZodObject<{
|
|
134
|
+
callId: z.ZodOptional<z.ZodString>;
|
|
135
|
+
id: z.ZodString;
|
|
136
|
+
kind: z.ZodEnum<{
|
|
137
|
+
"remote-agent": "remote-agent";
|
|
138
|
+
"root-turn": "root-turn";
|
|
139
|
+
subagent: "subagent";
|
|
140
|
+
task: "task";
|
|
141
|
+
}>;
|
|
142
|
+
name: z.ZodOptional<z.ZodString>;
|
|
143
|
+
parentId: z.ZodOptional<z.ZodString>;
|
|
144
|
+
rootSessionId: z.ZodString;
|
|
145
|
+
rootTurnId: z.ZodString;
|
|
146
|
+
sessionId: z.ZodOptional<z.ZodString>;
|
|
147
|
+
turnId: z.ZodOptional<z.ZodString>;
|
|
148
|
+
}, z.core.$strict>>;
|
|
149
|
+
}, z.core.$strict>>;
|
|
150
|
+
}, z.core.$strict>>;
|
|
151
|
+
payload: z.ZodObject<{
|
|
152
|
+
context: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
153
|
+
inputResponses: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
154
|
+
optionId: z.ZodOptional<z.ZodString>;
|
|
155
|
+
requestId: z.ZodString;
|
|
156
|
+
text: z.ZodOptional<z.ZodString>;
|
|
157
|
+
}, z.core.$strict>>>;
|
|
158
|
+
message: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
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
|
+
text: z.ZodString;
|
|
161
|
+
type: z.ZodLiteral<"text">;
|
|
162
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
163
|
+
image: z.ZodCustom<URL | import("ai").DataContent, URL | import("ai").DataContent>;
|
|
164
|
+
mediaType: z.ZodOptional<z.ZodString>;
|
|
165
|
+
providerOptions: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<import("../../shared/json.ts").JsonObject, unknown, z.core.$ZodTypeInternals<import("../../shared/json.ts").JsonObject, unknown>>>>;
|
|
166
|
+
type: z.ZodLiteral<"image">;
|
|
167
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
168
|
+
data: z.ZodCustom<URL | import("ai").DataContent, URL | import("ai").DataContent>;
|
|
169
|
+
filename: z.ZodOptional<z.ZodString>;
|
|
170
|
+
mediaType: z.ZodString;
|
|
171
|
+
providerOptions: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<import("../../shared/json.ts").JsonObject, unknown, z.core.$ZodTypeInternals<import("../../shared/json.ts").JsonObject, unknown>>>>;
|
|
172
|
+
type: z.ZodLiteral<"file">;
|
|
173
|
+
}, z.core.$strict>], "type">>]>>;
|
|
174
|
+
outputSchema: z.ZodOptional<z.ZodType<import("../../shared/json.ts").JsonObject, unknown, z.core.$ZodTypeInternals<import("../../shared/json.ts").JsonObject, unknown>>>;
|
|
175
|
+
task: z.ZodOptional<z.ZodObject<{
|
|
176
|
+
authorizationEvents: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
177
|
+
hookPayload: z.ZodObject<{
|
|
178
|
+
callId: z.ZodString;
|
|
179
|
+
childSessionId: z.ZodString;
|
|
180
|
+
event: z.ZodCustom<Record<string, unknown>, Record<string, unknown>>;
|
|
181
|
+
kind: z.ZodLiteral<"subagent-authorization-event">;
|
|
182
|
+
subagentName: z.ZodString;
|
|
183
|
+
}, z.core.$strict>;
|
|
184
|
+
taskId: z.ZodString;
|
|
185
|
+
}, z.core.$strict>>>;
|
|
186
|
+
inputRequests: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
187
|
+
hookPayload: z.ZodObject<{
|
|
188
|
+
callId: z.ZodString;
|
|
189
|
+
childContinuationToken: z.ZodString;
|
|
190
|
+
childSessionId: z.ZodString;
|
|
191
|
+
event: z.ZodObject<{
|
|
192
|
+
requests: z.ZodArray<z.ZodObject<{
|
|
193
|
+
action: z.ZodObject<{
|
|
194
|
+
callId: z.ZodString;
|
|
195
|
+
input: z.ZodType<import("../../shared/json.ts").JsonObject, unknown, z.core.$ZodTypeInternals<import("../../shared/json.ts").JsonObject, unknown>>;
|
|
196
|
+
kind: z.ZodLiteral<"tool-call">;
|
|
197
|
+
toolName: z.ZodString;
|
|
198
|
+
}, z.core.$strict>;
|
|
199
|
+
allowFreeform: z.ZodOptional<z.ZodBoolean>;
|
|
200
|
+
display: z.ZodOptional<z.ZodEnum<{
|
|
201
|
+
confirmation: "confirmation";
|
|
202
|
+
select: "select";
|
|
203
|
+
text: "text";
|
|
204
|
+
}>>;
|
|
205
|
+
kind: z.ZodEnum<{
|
|
206
|
+
question: "question";
|
|
207
|
+
"session-limit": "session-limit";
|
|
208
|
+
"tool-approval": "tool-approval";
|
|
209
|
+
}>;
|
|
210
|
+
options: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
211
|
+
description: z.ZodOptional<z.ZodString>;
|
|
212
|
+
id: z.ZodString;
|
|
213
|
+
label: z.ZodString;
|
|
214
|
+
style: z.ZodOptional<z.ZodEnum<{
|
|
215
|
+
danger: "danger";
|
|
216
|
+
default: "default";
|
|
217
|
+
primary: "primary";
|
|
218
|
+
}>>;
|
|
219
|
+
}, z.core.$strict>>>;
|
|
220
|
+
prompt: z.ZodString;
|
|
221
|
+
requestId: z.ZodString;
|
|
222
|
+
}, z.core.$strict>>;
|
|
223
|
+
sequence: z.ZodNumber;
|
|
224
|
+
stepIndex: z.ZodNumber;
|
|
225
|
+
turnId: z.ZodString;
|
|
226
|
+
}, z.core.$strict>;
|
|
227
|
+
kind: z.ZodLiteral<"subagent-input-request">;
|
|
228
|
+
subagentName: z.ZodString;
|
|
229
|
+
}, z.core.$strict>;
|
|
230
|
+
taskId: z.ZodString;
|
|
231
|
+
}, z.core.$strict>>>;
|
|
232
|
+
views: z.ZodOptional<z.ZodArray<z.ZodType<import("../../tasks/types.ts").TaskView, unknown, z.core.$ZodTypeInternals<import("../../tasks/types.ts").TaskView, unknown>>>>;
|
|
233
|
+
}, z.core.$strict>>;
|
|
234
|
+
}, z.core.$loose>;
|
|
235
|
+
version: z.ZodLiteral<2>;
|
|
236
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
237
|
+
kind: z.ZodLiteral<"session-timeout">;
|
|
238
|
+
version: z.ZodLiteral<2>;
|
|
239
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
240
|
+
kind: z.ZodLiteral<"clear">;
|
|
241
|
+
version: z.ZodLiteral<2>;
|
|
242
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
243
|
+
kind: z.ZodLiteral<"compact">;
|
|
244
|
+
version: z.ZodLiteral<2>;
|
|
245
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
246
|
+
kind: z.ZodLiteral<"reset">;
|
|
247
|
+
reason: z.ZodOptional<z.ZodString>;
|
|
248
|
+
version: z.ZodLiteral<2>;
|
|
249
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
250
|
+
kind: z.ZodLiteral<"cancel">;
|
|
251
|
+
taskId: z.ZodOptional<z.ZodString>;
|
|
252
|
+
turnId: z.ZodOptional<z.ZodString>;
|
|
253
|
+
version: z.ZodLiteral<2>;
|
|
254
|
+
}, z.core.$strict>], "kind">;
|
|
255
|
+
export type SessionInboxWireV2 = z.infer<typeof sessionInboxWireV2Schema>;
|
|
256
|
+
export declare function parseSessionInboxWireV2(value: unknown): z.ZodSafeParseResult<{
|
|
257
|
+
auth?: {
|
|
258
|
+
attributes: Record<string, string | string[]>;
|
|
259
|
+
authenticator: string;
|
|
260
|
+
issuer?: string | undefined;
|
|
261
|
+
principalId: string;
|
|
262
|
+
principalType: string;
|
|
263
|
+
subject?: string | undefined;
|
|
264
|
+
} | null | undefined;
|
|
265
|
+
deliveryMetadata?: {
|
|
266
|
+
channelKind: string;
|
|
267
|
+
channelName: string;
|
|
268
|
+
deliveryId: string;
|
|
269
|
+
payloadIndex: number;
|
|
270
|
+
requestId?: string | undefined;
|
|
271
|
+
requestTraceContext?: {
|
|
272
|
+
spanId: string;
|
|
273
|
+
traceFlags: number;
|
|
274
|
+
traceId: string;
|
|
275
|
+
} | undefined;
|
|
276
|
+
}[] | undefined;
|
|
277
|
+
kind: "deliver";
|
|
278
|
+
payloads: {
|
|
279
|
+
[x: string]: unknown;
|
|
280
|
+
context?: string[] | undefined;
|
|
281
|
+
inputResponses?: {
|
|
282
|
+
optionId?: string | undefined;
|
|
283
|
+
requestId: string;
|
|
284
|
+
text?: string | undefined;
|
|
285
|
+
}[] | undefined;
|
|
286
|
+
message?: string | ({
|
|
287
|
+
providerOptions?: Record<string, import("../../shared/json.ts").JsonObject> | undefined;
|
|
288
|
+
text: string;
|
|
289
|
+
type: "text";
|
|
290
|
+
} | {
|
|
291
|
+
image: URL | import("ai").DataContent;
|
|
292
|
+
mediaType?: string | undefined;
|
|
293
|
+
providerOptions?: Record<string, import("../../shared/json.ts").JsonObject> | undefined;
|
|
294
|
+
type: "image";
|
|
295
|
+
} | {
|
|
296
|
+
data: URL | import("ai").DataContent;
|
|
297
|
+
filename?: string | undefined;
|
|
298
|
+
mediaType: string;
|
|
299
|
+
providerOptions?: Record<string, import("../../shared/json.ts").JsonObject> | undefined;
|
|
300
|
+
type: "file";
|
|
301
|
+
})[] | undefined;
|
|
302
|
+
outputSchema?: import("../../shared/json.ts").JsonObject | undefined;
|
|
303
|
+
task?: {
|
|
304
|
+
authorizationEvents?: {
|
|
305
|
+
hookPayload: {
|
|
306
|
+
callId: string;
|
|
307
|
+
childSessionId: string;
|
|
308
|
+
event: Record<string, unknown>;
|
|
309
|
+
kind: "subagent-authorization-event";
|
|
310
|
+
subagentName: string;
|
|
311
|
+
};
|
|
312
|
+
taskId: string;
|
|
313
|
+
}[] | undefined;
|
|
314
|
+
inputRequests?: {
|
|
315
|
+
hookPayload: {
|
|
316
|
+
callId: string;
|
|
317
|
+
childContinuationToken: string;
|
|
318
|
+
childSessionId: string;
|
|
319
|
+
event: {
|
|
320
|
+
requests: {
|
|
321
|
+
action: {
|
|
322
|
+
callId: string;
|
|
323
|
+
input: import("../../shared/json.ts").JsonObject;
|
|
324
|
+
kind: "tool-call";
|
|
325
|
+
toolName: string;
|
|
326
|
+
};
|
|
327
|
+
allowFreeform?: boolean | undefined;
|
|
328
|
+
display?: "confirmation" | "select" | "text" | undefined;
|
|
329
|
+
kind: "question" | "session-limit" | "tool-approval";
|
|
330
|
+
options?: {
|
|
331
|
+
description?: string | undefined;
|
|
332
|
+
id: string;
|
|
333
|
+
label: string;
|
|
334
|
+
style?: "danger" | "default" | "primary" | undefined;
|
|
335
|
+
}[] | undefined;
|
|
336
|
+
prompt: string;
|
|
337
|
+
requestId: string;
|
|
338
|
+
}[];
|
|
339
|
+
sequence: number;
|
|
340
|
+
stepIndex: number;
|
|
341
|
+
turnId: string;
|
|
342
|
+
};
|
|
343
|
+
kind: "subagent-input-request";
|
|
344
|
+
subagentName: string;
|
|
345
|
+
};
|
|
346
|
+
taskId: string;
|
|
347
|
+
}[] | undefined;
|
|
348
|
+
views?: import("../../tasks/types.ts").TaskView[] | undefined;
|
|
349
|
+
} | undefined;
|
|
350
|
+
}[];
|
|
351
|
+
requestId?: string | undefined;
|
|
352
|
+
taskDeliveryId?: string | undefined;
|
|
353
|
+
turnPolicy?: "queue" | "steer" | undefined;
|
|
354
|
+
caller?: {
|
|
355
|
+
callId: string;
|
|
356
|
+
replyTo: {
|
|
357
|
+
kind: "hook";
|
|
358
|
+
token: string;
|
|
359
|
+
} | {
|
|
360
|
+
kind: "callback";
|
|
361
|
+
token: string;
|
|
362
|
+
url: string;
|
|
363
|
+
};
|
|
364
|
+
subagentName: string;
|
|
365
|
+
taskId?: string | undefined;
|
|
366
|
+
activityObserver?: {
|
|
367
|
+
sink: {
|
|
368
|
+
url: string;
|
|
369
|
+
version: 1;
|
|
370
|
+
};
|
|
371
|
+
workIdentity?: {
|
|
372
|
+
callId?: string | undefined;
|
|
373
|
+
id: string;
|
|
374
|
+
kind: "remote-agent" | "root-turn" | "subagent" | "task";
|
|
375
|
+
name?: string | undefined;
|
|
376
|
+
parentId?: string | undefined;
|
|
377
|
+
rootSessionId: string;
|
|
378
|
+
rootTurnId: string;
|
|
379
|
+
sessionId?: string | undefined;
|
|
380
|
+
turnId?: string | undefined;
|
|
381
|
+
} | undefined;
|
|
382
|
+
} | undefined;
|
|
383
|
+
} | undefined;
|
|
384
|
+
payload: {
|
|
385
|
+
[x: string]: unknown;
|
|
386
|
+
context?: string[] | undefined;
|
|
387
|
+
inputResponses?: {
|
|
388
|
+
optionId?: string | undefined;
|
|
389
|
+
requestId: string;
|
|
390
|
+
text?: string | undefined;
|
|
391
|
+
}[] | undefined;
|
|
392
|
+
message?: string | ({
|
|
393
|
+
providerOptions?: Record<string, import("../../shared/json.ts").JsonObject> | undefined;
|
|
394
|
+
text: string;
|
|
395
|
+
type: "text";
|
|
396
|
+
} | {
|
|
397
|
+
image: URL | import("ai").DataContent;
|
|
398
|
+
mediaType?: string | undefined;
|
|
399
|
+
providerOptions?: Record<string, import("../../shared/json.ts").JsonObject> | undefined;
|
|
400
|
+
type: "image";
|
|
401
|
+
} | {
|
|
402
|
+
data: URL | import("ai").DataContent;
|
|
403
|
+
filename?: string | undefined;
|
|
404
|
+
mediaType: string;
|
|
405
|
+
providerOptions?: Record<string, import("../../shared/json.ts").JsonObject> | undefined;
|
|
406
|
+
type: "file";
|
|
407
|
+
})[] | undefined;
|
|
408
|
+
outputSchema?: import("../../shared/json.ts").JsonObject | undefined;
|
|
409
|
+
task?: {
|
|
410
|
+
authorizationEvents?: {
|
|
411
|
+
hookPayload: {
|
|
412
|
+
callId: string;
|
|
413
|
+
childSessionId: string;
|
|
414
|
+
event: Record<string, unknown>;
|
|
415
|
+
kind: "subagent-authorization-event";
|
|
416
|
+
subagentName: string;
|
|
417
|
+
};
|
|
418
|
+
taskId: string;
|
|
419
|
+
}[] | undefined;
|
|
420
|
+
inputRequests?: {
|
|
421
|
+
hookPayload: {
|
|
422
|
+
callId: string;
|
|
423
|
+
childContinuationToken: string;
|
|
424
|
+
childSessionId: string;
|
|
425
|
+
event: {
|
|
426
|
+
requests: {
|
|
427
|
+
action: {
|
|
428
|
+
callId: string;
|
|
429
|
+
input: import("../../shared/json.ts").JsonObject;
|
|
430
|
+
kind: "tool-call";
|
|
431
|
+
toolName: string;
|
|
432
|
+
};
|
|
433
|
+
allowFreeform?: boolean | undefined;
|
|
434
|
+
display?: "confirmation" | "select" | "text" | undefined;
|
|
435
|
+
kind: "question" | "session-limit" | "tool-approval";
|
|
436
|
+
options?: {
|
|
437
|
+
description?: string | undefined;
|
|
438
|
+
id: string;
|
|
439
|
+
label: string;
|
|
440
|
+
style?: "danger" | "default" | "primary" | undefined;
|
|
441
|
+
}[] | undefined;
|
|
442
|
+
prompt: string;
|
|
443
|
+
requestId: string;
|
|
444
|
+
}[];
|
|
445
|
+
sequence: number;
|
|
446
|
+
stepIndex: number;
|
|
447
|
+
turnId: string;
|
|
448
|
+
};
|
|
449
|
+
kind: "subagent-input-request";
|
|
450
|
+
subagentName: string;
|
|
451
|
+
};
|
|
452
|
+
taskId: string;
|
|
453
|
+
}[] | undefined;
|
|
454
|
+
views?: import("../../tasks/types.ts").TaskView[] | undefined;
|
|
455
|
+
} | undefined;
|
|
456
|
+
};
|
|
457
|
+
version: 2;
|
|
458
|
+
} | {
|
|
459
|
+
kind: "session-timeout";
|
|
460
|
+
version: 2;
|
|
461
|
+
} | {
|
|
462
|
+
kind: "clear";
|
|
463
|
+
version: 2;
|
|
464
|
+
} | {
|
|
465
|
+
kind: "compact";
|
|
466
|
+
version: 2;
|
|
467
|
+
} | {
|
|
468
|
+
kind: "reset";
|
|
469
|
+
reason?: string | undefined;
|
|
470
|
+
version: 2;
|
|
471
|
+
} | {
|
|
472
|
+
kind: "cancel";
|
|
473
|
+
taskId?: string | undefined;
|
|
474
|
+
turnId?: string | undefined;
|
|
475
|
+
version: 2;
|
|
476
|
+
}>;
|
|
477
|
+
/** Builds and validates one complete version-2 wire value. */
|
|
478
|
+
export declare function encodeSessionCommandV2(command: DeliverHookPayload | SessionCommand | SessionTimeoutHookPayload): SessionInboxWireV2;
|
|
@@ -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{sessionInboxWireV1Schema}from"#execution/wire/session-inbox-wire.v1.js";import{normalizeSessionInboxWireV2}from"#execution/wire/session-inbox-wire.v2-migration.js";const activityWorkIdentitySchema=z.object({callId:z.string().optional(),id:z.string(),kind:z.enum([`root-turn`,`subagent`,`remote-agent`,`task`]),name:z.string().optional(),parentId:z.string().optional(),rootSessionId:z.string(),rootTurnId:z.string(),sessionId:z.string().optional(),turnId:z.string().optional()}).strict(),activityObserverSchema=z.object({sink:z.object({url:z.string(),version:z.literal(1)}).strict(),workIdentity:activityWorkIdentitySchema.optional()}).strict(),v1=sessionInboxWireV1Schema.options,v1Deliver=v1[0],v1Caller=v1Deliver.shape.caller.unwrap(),version=z.literal(2),sessionInboxWireV2Schema=z.discriminatedUnion(`kind`,[v1Deliver.extend({caller:v1Caller.extend({activityObserver:activityObserverSchema.optional()}).optional(),payload:v1Deliver.shape.payload.unwrap(),version}),v1[1].extend({version}),v1[2].extend({version}),v1[3].extend({version}),v1[4].extend({version}),v1[5].extend({version})]);function parseSessionInboxWireV2(e){return sessionInboxWireV2Schema.safeParse(normalizeSessionInboxWireV2(e))}function encodeSessionCommandV2(e){let t=parseSessionInboxWireV2(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:2}:e.kind===`deliver`?{...e,payload:coalesceDeliverPayloads(e.payloads),version:2}:{...e,version:2});if(!t.success)throw new SessionInboxWireError(`Produced a session inbox payload that does not match wire version 2: ${formatValidationError(t.error)}`);return t.data}export{encodeSessionCommandV2,parseSessionInboxWireV2,sessionInboxWireV2Schema};
|