eve 0.55.0 → 0.57.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.
- package/CHANGELOG.md +58 -0
- package/dist/src/channel/adapter-context.d.ts +1 -1
- package/dist/src/channel/adapter.d.ts +2 -2
- package/dist/src/channel/audience.d.ts +3 -3
- package/dist/src/channel/channel-address.js +1 -1
- package/dist/src/channel/conversation-context.d.ts +4 -2
- package/dist/src/channel/conversation-context.js +1 -1
- package/dist/src/channel/session.d.ts +4 -3
- package/dist/src/channel/session.js +1 -1
- package/dist/src/channel/types.d.ts +7 -4
- package/dist/src/chunks/{use-eve-agent-D-KQzzyW.js → use-eve-agent-C2APNCdP.js} +45 -22
- package/dist/src/chunks/{use-eve-agent-CxPlg0KL.js → use-eve-agent-D0YnDLi_.js} +45 -22
- package/dist/src/cli/commands/init.d.ts +2 -6
- package/dist/src/cli/commands/init.js +1 -1
- package/dist/src/cli/commands/registry-metadata.d.ts +0 -18
- package/dist/src/cli/commands/registry-metadata.js +1 -1
- package/dist/src/cli/commands/registry-pnpm-build-policy-flow.js +1 -1
- package/dist/src/cli/commands/registry.js +1 -1
- package/dist/src/cli/commands/trace-detail.js +1 -1
- package/dist/src/cli/dev/environment.js +1 -1
- package/dist/src/cli/dev/run-interactive-ui.js +1 -1
- package/dist/src/cli/dev/tui/agent-header.js +1 -1
- package/dist/src/cli/dev/tui/blocks.d.ts +3 -6
- package/dist/src/cli/dev/tui/blocks.js +3 -3
- package/dist/src/cli/dev/tui/command-typeahead.js +1 -1
- package/dist/src/cli/dev/tui/markdown.d.ts +8 -1
- package/dist/src/cli/dev/tui/markdown.js +7 -7
- package/dist/src/cli/dev/tui/message-queue.d.ts +11 -7
- package/dist/src/cli/dev/tui/message-queue.js +1 -1
- package/dist/src/cli/dev/tui/model-editor.d.ts +1 -1
- package/dist/src/cli/dev/tui/model-editor.js +1 -1
- package/dist/src/cli/dev/tui/prompt-command-handler.d.ts +0 -3
- package/dist/src/cli/dev/tui/prompt-command-handler.js +1 -1
- package/dist/src/cli/dev/tui/prompt-commands.d.ts +1 -1
- package/dist/src/cli/dev/tui/prompt-commands.js +1 -1
- package/dist/src/cli/dev/tui/question-panel.js +1 -1
- package/dist/src/cli/dev/tui/remote-auth-result.js +1 -1
- package/dist/src/cli/dev/tui/remote-auth.js +1 -1
- package/dist/src/cli/dev/tui/remote-startup.d.ts +10 -0
- package/dist/src/cli/dev/tui/remote-startup.js +1 -0
- package/dist/src/cli/dev/tui/runner.d.ts +16 -19
- package/dist/src/cli/dev/tui/runner.js +3 -1
- package/dist/src/cli/dev/tui/setup-commands.d.ts +7 -13
- package/dist/src/cli/dev/tui/setup-commands.js +2 -2
- package/dist/src/cli/dev/tui/setup-issues.d.ts +1 -1
- package/dist/src/cli/dev/tui/setup-issues.js +1 -1
- package/dist/src/cli/dev/tui/setup-panel.d.ts +5 -17
- package/dist/src/cli/dev/tui/setup-panel.js +5 -6
- package/dist/src/cli/dev/tui/status-line.d.ts +1 -8
- package/dist/src/cli/dev/tui/status-line.js +1 -1
- package/dist/src/cli/dev/tui/steering-stream.d.ts +15 -0
- package/dist/src/cli/dev/tui/steering-stream.js +1 -0
- package/dist/src/cli/dev/tui/terminal-renderer.d.ts +8 -3
- package/dist/src/cli/dev/tui/terminal-renderer.js +12 -12
- package/dist/src/cli/dev/tui/test/mock-terminal.d.ts +2 -2
- package/dist/src/cli/dev/tui/test/mock-terminal.js +1 -1
- package/dist/src/cli/dev/tui/theme.d.ts +0 -2
- package/dist/src/cli/dev/tui/theme.js +1 -1
- package/dist/src/cli/dev/tui/tui.d.ts +4 -1
- package/dist/src/cli/dev/tui/vercel-status.d.ts +4 -2
- package/dist/src/cli/dev/tui/vercel-status.js +1 -1
- package/dist/src/cli/run.js +1 -1
- package/dist/src/cli/telemetry/index.d.ts +1 -1
- package/dist/src/cli/telemetry/index.js +1 -1
- package/dist/src/cli/ui/terminal-text.js +1 -1
- package/dist/src/client/agent-info-schema.d.ts +2 -57
- package/dist/src/client/agent-info-schema.js +1 -1
- package/dist/src/client/eve-agent-store-state.d.ts +19 -0
- package/dist/src/client/eve-agent-store.js +1 -1
- package/dist/src/client/ndjson.d.ts +2 -0
- package/dist/src/client/ndjson.js +3 -3
- package/dist/src/client/open-stream.d.ts +1 -0
- package/dist/src/client/open-stream.js +1 -1
- package/dist/src/compiled/.vendor-stamp.json +1 -1
- package/dist/src/compiled/@workflow/core/index.js +2 -2
- package/dist/src/compiled/@workflow/core/private.js +1 -1
- package/dist/src/compiled/@workflow/core/runtime/helpers.js +1 -0
- package/dist/src/compiled/@workflow/core/runtime.js +2 -2
- package/dist/src/compiled/@workflow/core/serialization.js +1 -0
- package/dist/src/compiled/@workflow/core/workflow.js +1 -1
- package/dist/src/compiled/@workflow/world-local/index.js +5 -5
- package/dist/src/compiled/@workflow/world-vercel/index.js +2 -2
- package/dist/src/compiled/_chunks/workflow/attribute-changes-DTFAjP0J.js +6 -0
- package/dist/src/compiled/_chunks/workflow/{dist-PLkAQ-U7.js → dist-C5KCXSdI.js} +1 -1
- package/dist/src/compiled/_chunks/workflow/{frames-BvATzM2t.js → frames-DJw9L4rO.js} +3 -3
- package/dist/src/compiled/_chunks/workflow/global-DFW-hO6M.js +1 -0
- package/dist/src/compiled/_chunks/workflow/helpers-ClCA9Lmc.js +1 -0
- package/dist/src/compiled/_chunks/workflow/logger-D6vwIEf9.js +13 -0
- package/dist/src/compiled/_chunks/workflow/resume-hook-_baK8jaT.js +1 -0
- package/dist/src/compiled/_chunks/workflow/run-CRdL17z4.js +1 -0
- package/dist/src/compiled/_chunks/workflow/serialization-CWYPL4Eq.js +3 -0
- package/dist/src/compiled/_chunks/workflow/sleep-BL0kgJnT.js +1 -0
- package/dist/src/compiled/_chunks/workflow/wait-until-DyIt9lEx.js +1 -0
- package/dist/src/compiled/_chunks/workflow/{ws-transport-CVezyWwZ.js → ws-transport-Dl5FG4Sw.js} +1 -1
- package/dist/src/compiler/extension-compatibility.d.ts +27 -8
- package/dist/src/compiler/extension-compatibility.js +1 -1
- package/dist/src/compiler/manifest.d.ts +12 -11
- package/dist/src/compiler/manifest.js +1 -1
- package/dist/src/compiler/normalize-manifest.js +1 -1
- package/dist/src/compiler/normalize-tool.d.ts +0 -3
- package/dist/src/compiler/normalize-tool.js +1 -1
- package/dist/src/compiler/validate-artifact.js +1 -1
- package/dist/src/context/dynamic-skill-lifecycle.js +1 -1
- package/dist/src/context/keys.d.ts +5 -1
- package/dist/src/context/keys.js +1 -1
- package/dist/src/eve-channel/audience.d.ts +2 -2
- package/dist/src/eve-channel/audience.js +1 -1
- package/dist/src/eve-channel/index.js +1 -1
- package/dist/src/eve-channel/request.js +4 -3
- package/dist/src/eve-channel/types.d.ts +5 -5
- package/dist/src/execution/activity-cohort.js +1 -1
- package/dist/src/execution/activity-collector.js +1 -1
- package/dist/src/execution/authorization-callback-match.d.ts +2 -1
- package/dist/src/execution/authorization-callback-match.js +1 -1
- package/dist/src/execution/cancel-descendant-turns-step.js +1 -1
- package/dist/src/execution/cancel-indexed-session-tasks-step.js +1 -1
- package/dist/src/execution/cancelled-model-call-batch.d.ts +1 -1
- package/dist/src/execution/connections/callback-route.d.ts +1 -11
- package/dist/src/execution/connections/callback-route.js +1 -1
- package/dist/src/execution/continuation-conflict-step.d.ts +0 -1
- package/dist/src/execution/continuation-conflict-step.js +1 -1
- package/dist/src/execution/coordination-dispatch-shared.d.ts +1 -1
- package/dist/src/execution/coordination-dispatch-shared.js +1 -1
- package/dist/src/execution/coordination-dispatch-step.d.ts +2 -2
- package/dist/src/execution/coordination-dispatch-step.js +1 -1
- package/dist/src/execution/create-session-step.d.ts +1 -1
- package/dist/src/execution/create-session-step.js +1 -1
- package/dist/src/execution/durable-session-store.d.ts +10 -49
- package/dist/src/execution/durable-session-store.js +1 -1
- package/dist/src/execution/dynamic-workflow/program-step.d.ts +21 -0
- package/dist/src/execution/dynamic-workflow/program-step.js +1 -0
- package/dist/src/execution/dynamic-workflow/schema.d.ts +36 -0
- package/dist/src/execution/dynamic-workflow/schema.js +1 -0
- package/dist/src/execution/dynamic-workflow/security-step.d.ts +3 -0
- package/dist/src/execution/dynamic-workflow/security-step.js +1 -0
- package/dist/src/execution/dynamic-workflow/tool.d.ts +8 -0
- package/dist/src/execution/dynamic-workflow/tool.js +1 -0
- package/dist/src/execution/dynamic-workflow/workflow.d.ts +10 -0
- package/dist/src/execution/dynamic-workflow/workflow.js +1 -0
- package/dist/src/execution/eve-workflow-attributes.d.ts +2 -17
- package/dist/src/execution/eve-workflow-attributes.js +1 -1
- package/dist/src/execution/hook-ownership.d.ts +2 -4
- package/dist/src/execution/hook-ownership.js +1 -1
- package/dist/src/execution/legacy-session/authorization.d.ts +9 -0
- package/dist/src/execution/legacy-session/authorization.js +1 -0
- package/dist/src/execution/legacy-session/completion-step.d.ts +10 -0
- package/dist/src/execution/legacy-session/completion-step.js +1 -0
- package/dist/src/execution/legacy-session/inbox.d.ts +24 -0
- package/dist/src/execution/legacy-session/inbox.js +1 -0
- package/dist/src/execution/legacy-session/input.d.ts +19 -0
- package/dist/src/execution/legacy-session/input.js +1 -0
- package/dist/src/execution/legacy-session/interrupt-step.d.ts +3 -0
- package/dist/src/execution/legacy-session/interrupt-step.js +1 -0
- package/dist/src/execution/legacy-session/prepare-step.d.ts +24 -0
- package/dist/src/execution/legacy-session/prepare-step.js +1 -0
- package/dist/src/execution/legacy-session/snapshot.d.ts +12 -0
- package/dist/src/execution/legacy-session/snapshot.js +1 -0
- package/dist/src/execution/legacy-session/turn-workflow.d.ts +8 -0
- package/dist/src/execution/legacy-session/turn-workflow.js +1 -0
- package/dist/src/execution/model-call-batching.d.ts +1 -0
- package/dist/src/execution/model-call-batching.js +1 -1
- package/dist/src/execution/node-step.d.ts +1 -5
- package/dist/src/execution/node-step.js +1 -1
- package/dist/src/execution/proxied-deliver-step.d.ts +2 -20
- package/dist/src/execution/proxied-deliver-step.js +1 -1
- package/dist/src/execution/reconcile-session-continuation-token.d.ts +1 -1
- package/dist/src/execution/report-dropped-wire-payload-step.d.ts +1 -1
- package/dist/src/execution/route-child-delivery.d.ts +2 -2
- package/dist/src/execution/route-child-delivery.js +1 -1
- package/dist/src/execution/runtime-context.js +1 -1
- package/dist/src/execution/sandbox/bindings/eve-image.js +1 -1
- package/dist/src/execution/session/accepted-deployment.d.ts +3 -0
- package/dist/src/execution/session/accepted-deployment.js +1 -0
- package/dist/src/execution/session/admission.d.ts +38 -0
- package/dist/src/execution/session/admission.js +1 -0
- package/dist/src/execution/session/entry-input.d.ts +42 -0
- package/dist/src/execution/session/entry-input.js +1 -0
- package/dist/src/execution/session/entry.d.ts +13 -0
- package/dist/src/execution/session/entry.js +1 -0
- package/dist/src/execution/session/event-sink.d.ts +31 -0
- package/dist/src/execution/session/event-sink.js +1 -0
- package/dist/src/execution/session/finalization.d.ts +33 -0
- package/dist/src/execution/session/finalization.js +1 -0
- package/dist/src/execution/session/handoff-steps.d.ts +22 -0
- package/dist/src/execution/session/handoff-steps.js +1 -0
- package/dist/src/execution/session/handoff.d.ts +69 -0
- package/dist/src/execution/session/handoff.js +1 -0
- package/dist/src/execution/session/hook-tokens.d.ts +11 -0
- package/dist/src/execution/session/hook-tokens.js +1 -0
- package/dist/src/execution/session/input-queue.d.ts +72 -0
- package/dist/src/execution/session/input-queue.js +1 -0
- package/dist/src/execution/session/next-input.d.ts +32 -0
- package/dist/src/execution/session/next-input.js +1 -0
- package/dist/src/execution/{pending-turn-state.d.ts → session/pending-turn-state.d.ts} +0 -1
- package/dist/src/execution/{pending-turn-state.js → session/pending-turn-state.js} +1 -1
- package/dist/src/execution/session/program.d.ts +47 -0
- package/dist/src/execution/session/program.js +1 -0
- package/dist/src/execution/session/route-selected-delivery.d.ts +9 -0
- package/dist/src/execution/session/route-selected-delivery.js +1 -0
- package/dist/src/execution/session/state-cursor.d.ts +31 -0
- package/dist/src/execution/session/state-cursor.js +1 -0
- package/dist/src/execution/{session-timeout-control.d.ts → session/timeout-control.d.ts} +1 -1
- package/dist/src/execution/session/timeout-control.js +1 -0
- package/dist/src/execution/{session-timeout-steps.d.ts → session/timeout-steps.d.ts} +3 -2
- package/dist/src/execution/session/timeout-steps.js +1 -0
- package/dist/src/execution/{session-timeout-workflow.d.ts → session/timeout-workflow.d.ts} +3 -1
- package/dist/src/execution/session/timeout-workflow.js +1 -0
- package/dist/src/execution/session/timeout.d.ts +3 -0
- package/dist/src/execution/session/timeout.js +1 -0
- package/dist/src/execution/session/turn-step-result.d.ts +4 -0
- package/dist/src/execution/session/turn-step-result.js +1 -0
- package/dist/src/execution/session/turn-step-types.d.ts +68 -0
- package/dist/src/execution/session/turn-step-types.js +1 -0
- package/dist/src/execution/{workflow-steps.d.ts → session/turn-step.d.ts} +1 -2
- package/dist/src/execution/session/turn-step.js +1 -0
- package/dist/src/execution/session/turn.d.ts +31 -0
- package/dist/src/execution/session/turn.js +1 -0
- package/dist/src/execution/session-inbox/address.d.ts +21 -0
- package/dist/src/execution/session-inbox/address.js +1 -0
- package/dist/src/execution/session-inbox/inbox.d.ts +54 -0
- package/dist/src/execution/session-inbox/inbox.js +1 -0
- package/dist/src/execution/session-inbox/protocol.d.ts +10 -0
- package/dist/src/execution/session-inbox/protocol.js +1 -0
- package/dist/src/execution/session-inbox/release-step.d.ts +5 -0
- package/dist/src/execution/session-inbox/release-step.js +1 -0
- package/dist/src/execution/session-inbox/resume.d.ts +21 -0
- package/dist/src/execution/session-inbox/resume.js +1 -0
- package/dist/src/execution/{turn-workflow-tool-run.d.ts → session-workflow-tool-run.d.ts} +2 -2
- package/dist/src/execution/session-workflow-tool-run.js +1 -0
- package/dist/src/execution/session.d.ts +0 -1
- package/dist/src/execution/session.js +2 -2
- package/dist/src/execution/settle-cancelled-turn-step.d.ts +2 -2
- package/dist/src/execution/settle-cancelled-turn-step.js +1 -1
- package/dist/src/execution/skills/instructions.js +1 -1
- package/dist/src/execution/stable-workflow-names.d.ts +1 -1
- package/dist/src/execution/stable-workflow-names.js +1 -1
- package/dist/src/execution/task-input-response-route.js +1 -1
- package/dist/src/execution/tasks/child/steps.d.ts +1 -1
- package/dist/src/execution/tasks/child/steps.js +1 -1
- package/dist/src/execution/tasks/child/workflow.js +1 -1
- package/dist/src/execution/tasks/parent/delegate.d.ts +7 -0
- package/dist/src/execution/tasks/parent/delegate.js +1 -1
- package/dist/src/execution/tasks/parent/dispatch.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/terminal-session-completion-step.d.ts +1 -1
- package/dist/src/execution/terminal-session-event.d.ts +1 -1
- package/dist/src/execution/terminal-session-event.js +1 -1
- package/dist/src/execution/terminal-session-failure-step.d.ts +1 -1
- package/dist/src/execution/terminal-session-failure-step.js +1 -1
- package/dist/src/execution/terminate-child-sessions-step.js +1 -1
- package/dist/src/execution/tools/sleep-workflow.js +1 -1
- package/dist/src/execution/tools/subagent/accept-event-step.js +1 -1
- package/dist/src/execution/tools/subagent/emit-called-step.d.ts +1 -1
- package/dist/src/execution/tools/subagent/emit-called-step.js +1 -1
- package/dist/src/execution/tools/subagent/invoke-agent.d.ts +1 -1
- package/dist/src/execution/tools/subagent/invoke-agent.js +1 -1
- package/dist/src/execution/tools/subagent/invoke-preparation.d.ts +6 -0
- package/dist/src/execution/tools/subagent/invoke-preparation.js +1 -1
- package/dist/src/execution/tools/subagent/invoke-step.d.ts +2 -0
- package/dist/src/execution/tools/subagent/invoke-step.js +1 -1
- package/dist/src/execution/tools/subagent/steer.d.ts +13 -0
- package/dist/src/execution/tools/subagent/steer.js +1 -0
- package/dist/src/execution/tools/subagent/task-agent-requests.d.ts +1 -1
- package/dist/src/execution/tools/subagent/task-agent-requests.js +1 -1
- package/dist/src/execution/tools/subagent/task-cancel.js +1 -1
- package/dist/src/execution/tools/workflow/ask.d.ts +0 -9
- package/dist/src/execution/tools/workflow/ask.js +1 -1
- package/dist/src/execution/tools/workflow/body.d.ts +0 -2
- package/dist/src/execution/tools/workflow/body.js +1 -1
- package/dist/src/execution/tools/workflow/emit-workflow-tool-run-report-step.d.ts +1 -1
- package/dist/src/execution/tools/workflow/emit-workflow-tool-run-report-step.js +1 -1
- package/dist/src/execution/tools/workflow/messages.d.ts +0 -1
- package/dist/src/execution/tools/workflow/messages.js +1 -1
- package/dist/src/execution/tools/workflow/owner.d.ts +3 -1
- package/dist/src/execution/tools/workflow/owner.js +1 -1
- package/dist/src/execution/tools/workflow/resume-hook-step.d.ts +1 -1
- package/dist/src/execution/tools/workflow/step-context.d.ts +0 -1
- package/dist/src/execution/tools/workflow/step-execution.js +1 -1
- package/dist/src/execution/tools/workflow/step.js +1 -1
- package/dist/src/execution/tools/workflow/workflow.js +1 -1
- package/dist/src/execution/workflow-runtime.d.ts +15 -18
- package/dist/src/execution/workflow-runtime.js +1 -1
- package/dist/src/harness/advertised-tools.d.ts +0 -3
- package/dist/src/harness/advertised-tools.js +1 -1
- package/dist/src/harness/authorization.d.ts +5 -37
- package/dist/src/harness/authorization.js +1 -1
- package/dist/src/harness/compaction.js +1 -1
- package/dist/src/harness/coordination.js +1 -1
- package/dist/src/harness/emission-state.d.ts +1 -0
- package/dist/src/harness/emission.js +1 -1
- package/dist/src/harness/generation-steering.d.ts +22 -0
- package/dist/src/harness/generation-steering.js +1 -0
- package/dist/src/harness/messages.d.ts +1 -1
- package/dist/src/harness/messages.js +1 -1
- package/dist/src/harness/prompt-cache.js +1 -1
- package/dist/src/harness/proxy-input-requests.d.ts +1 -1
- package/dist/src/harness/proxy-input-requests.js +1 -1
- package/dist/src/harness/semantic-errors/rules/gateway.js +1 -1
- package/dist/src/harness/semantic-errors/signals.js +1 -1
- package/dist/src/harness/session-limit-enforcement.js +1 -1
- package/dist/src/harness/tool-loop.js +2 -2
- package/dist/src/harness/types.d.ts +2 -21
- package/dist/src/instrumentation/ai-sdk-hook-bridge.js +1 -1
- package/dist/src/instrumentation/channel-delivery.js +1 -1
- package/dist/src/instrumentation/content.js +1 -1
- package/dist/src/instrumentation/lifecycle.d.ts +6 -7
- package/dist/src/instrumentation/native-events.d.ts +2 -0
- package/dist/src/instrumentation/native-events.js +1 -1
- package/dist/src/instrumentation/runtime.js +1 -1
- package/dist/src/instrumentation/session-context.d.ts +2 -0
- package/dist/src/instrumentation/session-context.js +1 -1
- package/dist/src/internal/application/compiled-artifacts.js +3 -2
- package/dist/src/internal/application/package.js +1 -1
- package/dist/src/internal/authored-definition/connection.js +1 -1
- package/dist/src/internal/authored-definition/schema-backed.d.ts +3 -4
- package/dist/src/internal/authored-definition/schema-backed.js +1 -1
- package/dist/src/internal/gateway.d.ts +1 -0
- package/dist/src/internal/gateway.js +1 -1
- package/dist/src/internal/model-auth/api-key.d.ts +7 -0
- package/dist/src/internal/model-auth/api-key.js +1 -0
- package/dist/src/internal/model-auth/available-models.d.ts +2 -0
- package/dist/src/internal/model-auth/available-models.js +1 -0
- package/dist/src/internal/model-auth/development-broker-client.d.ts +3 -0
- package/dist/src/internal/model-auth/development-broker-client.js +1 -0
- package/dist/src/internal/model-auth/development-broker-protocol.d.ts +12 -0
- package/dist/src/internal/model-auth/development-broker-protocol.js +1 -0
- package/dist/src/internal/model-auth/development-broker-server.d.ts +4 -0
- package/dist/src/internal/model-auth/development-broker-server.js +1 -0
- package/dist/src/internal/model-auth/gateway-credential.d.ts +2 -0
- package/dist/src/internal/model-auth/gateway-credential.js +1 -0
- package/dist/src/internal/model-auth/store.d.ts +16 -0
- package/dist/src/internal/model-auth/store.js +1 -0
- package/dist/src/internal/model-auth/transport.d.ts +6 -0
- package/dist/src/internal/model-auth/transport.js +1 -0
- package/dist/src/internal/model-auth/vercel-cli.d.ts +7 -0
- package/dist/src/internal/model-auth/vercel-cli.js +1 -0
- package/dist/src/internal/model-auth/vercel-team.d.ts +3 -0
- package/dist/src/internal/model-auth/vercel-team.js +1 -0
- package/dist/src/internal/model-auth/vercel.d.ts +13 -0
- package/dist/src/internal/model-auth/vercel.js +1 -0
- package/dist/src/internal/nitro/host/create-application-nitro.js +1 -1
- package/dist/src/internal/nitro/host/dev-authored-source-watcher.js +1 -1
- package/dist/src/internal/nitro/host/dev-host-fingerprint.js +1 -1
- package/dist/src/internal/nitro/host/drained-nitro-dev-server.js +1 -1
- package/dist/src/internal/nitro/host/start-development-server.js +2 -2
- package/dist/src/internal/nitro/host/workflow-sandbox-runtime-plugin.js +1 -1
- package/dist/src/internal/nitro/routes/agent-info/build-agent-info-response.js +1 -1
- package/dist/src/internal/nitro/routes/channel-dispatch.js +1 -1
- package/dist/src/internal/nitro/routes/info.js +1 -1
- package/dist/src/internal/resolve-model-endpoint-status.d.ts +2 -0
- package/dist/src/internal/resolve-model-endpoint-status.js +1 -1
- package/dist/src/internal/vercel/api-resource.d.ts +4 -0
- package/dist/src/internal/vercel/api-resource.js +1 -0
- package/dist/src/internal/vercel/eve-service-contribution.js +1 -1
- package/dist/src/internal/vercel/vercel-services-config.d.ts +2 -0
- package/dist/src/internal/vercel/vercel-services-config.js +1 -1
- package/dist/src/internal/workflow/development-world-client.js +1 -1
- package/dist/src/internal/workflow/development-world-server.js +1 -1
- package/dist/src/internal/workflow/local-world-delivery-timeouts.d.ts +1 -1
- package/dist/src/internal/workflow/runtime.d.ts +1 -6
- package/dist/src/internal/workflow/runtime.js +1 -1
- package/dist/src/internal/workflow/vercel-world-defaults.d.ts +4 -0
- package/dist/src/internal/workflow/vercel-world-defaults.js +1 -0
- package/dist/src/protocol/activity.js +1 -1
- package/dist/src/protocol/message.d.ts +8 -0
- package/dist/src/protocol/message.js +2 -2
- package/dist/src/protocol/routes.d.ts +0 -2
- package/dist/src/protocol/routes.js +1 -1
- package/dist/src/public/channels/chat-sdk/audience.d.ts +2 -2
- package/dist/src/public/channels/discord/discordChannel.js +1 -1
- package/dist/src/public/channels/index.d.ts +1 -1
- package/dist/src/public/channels/slack/slackChannel.js +1 -1
- package/dist/src/public/channels/teams/teamsChannel.js +1 -1
- package/dist/src/public/channels/telegram/audience.d.ts +2 -2
- package/dist/src/public/channels/telegram/telegramChannel.js +1 -1
- package/dist/src/public/connections/index.d.ts +1 -1
- package/dist/src/public/definitions/channel.d.ts +2 -2
- package/dist/src/public/definitions/channel.js +1 -1
- package/dist/src/public/definitions/connections/mcp.d.ts +1 -1
- package/dist/src/public/definitions/connections/openapi.d.ts +1 -1
- package/dist/src/public/models/anthropic/index.d.ts +3 -0
- package/dist/src/public/models/anthropic/index.js +1 -0
- package/dist/src/public/models/openai/chatgpt/codex-app-server.js +1 -1
- package/dist/src/public/models/openai/chatgpt/credential-store.js +1 -1
- package/dist/src/public/models/openai/chatgpt/oauth.js +1 -1
- package/dist/src/public/models/openai/chatgpt/transport.js +1 -1
- package/dist/src/public/models/openai/index.d.ts +4 -2
- package/dist/src/public/models/openai/index.js +1 -1
- package/dist/src/public/sandbox/docker-sandbox.d.ts +1 -1
- package/dist/src/public/sandbox/microsandbox-sandbox.d.ts +1 -1
- package/dist/src/public/sandbox/vercel-sandbox.d.ts +1 -1
- package/dist/src/public/tools/workflow.d.ts +1 -4
- package/dist/src/public/tools/workflow.js +1 -1
- package/dist/src/public/vercel/index.d.ts +2 -1
- package/dist/src/public/vercel/index.js +1 -1
- package/dist/src/runtime/agent/mock-model-adapter.js +1 -1
- package/dist/src/runtime/agent/resolve-model.js +1 -1
- package/dist/src/runtime/connections/authorization-tokens.d.ts +2 -4
- package/dist/src/runtime/connections/principal.d.ts +6 -6
- package/dist/src/runtime/connections/principal.js +1 -1
- package/dist/src/runtime/prompt/compose.js +1 -1
- package/dist/src/runtime/resolve-agent-graph.js +1 -1
- package/dist/src/runtime/resolve-agent.js +1 -1
- package/dist/src/runtime/resolve-tool.js +1 -1
- package/dist/src/runtime/tools/registry.js +1 -1
- package/dist/src/runtime/types.d.ts +3 -9
- package/dist/src/self-modification/agent.js +1 -1
- package/dist/src/self-modification/extension/classify-registry-item.d.ts +3 -3
- package/dist/src/self-modification/extension/classify-registry-item.js +1 -1
- package/dist/src/self-modification/extension/tools/search_registry.d.ts +1 -7
- package/dist/src/self-modification/extension/tools/search_registry.js +1 -1
- package/dist/src/self-modification/setup.d.ts +9 -3
- package/dist/src/self-modification/setup.js +2 -2
- package/dist/src/setup/cli/option-row.d.ts +2 -1
- package/dist/src/setup/cli/option-row.js +1 -1
- package/dist/src/setup/cli/prompt-ui.d.ts +2 -0
- package/dist/src/setup/cli/prompt-ui.js +1 -1
- package/dist/src/setup/cli/select-state.d.ts +1 -1
- package/dist/src/setup/cli/select-state.js +1 -1
- package/dist/src/setup/flows/chatgpt-auth.js +1 -1
- package/dist/src/setup/flows/deploy.d.ts +4 -9
- package/dist/src/setup/flows/deploy.js +1 -1
- package/dist/src/setup/flows/ensure-vercel-project.js +1 -1
- package/dist/src/setup/flows/install-vercel-cli.d.ts +2 -3
- package/dist/src/setup/flows/login.d.ts +3 -1
- package/dist/src/setup/flows/login.js +1 -1
- package/dist/src/setup/flows/model-login-connection.d.ts +36 -0
- package/dist/src/setup/flows/model-login-connection.js +1 -0
- package/dist/src/setup/flows/model-login-progress.d.ts +7 -0
- package/dist/src/setup/flows/model-login-progress.js +1 -0
- package/dist/src/setup/flows/model-login.d.ts +22 -0
- package/dist/src/setup/flows/model-login.js +1 -0
- package/dist/src/setup/flows/model-source-change.d.ts +7 -0
- package/dist/src/setup/flows/model-source-change.js +1 -1
- package/dist/src/setup/flows/model.d.ts +6 -24
- package/dist/src/setup/flows/model.js +1 -1
- package/dist/src/setup/flows/registry.d.ts +3 -19
- package/dist/src/setup/flows/registry.js +1 -1
- package/dist/src/setup/flows/vercel-model-login.d.ts +5 -0
- package/dist/src/setup/flows/vercel-model-login.js +1 -0
- package/dist/src/setup/integrations/self-modification/setup.d.ts +2 -0
- package/dist/src/setup/integrations/self-modification/setup.js +1 -1
- package/dist/src/setup/project-resolution.js +1 -1
- package/dist/src/setup/prompter.d.ts +3 -1
- package/dist/src/setup/provider-settings.d.ts +19 -6
- package/dist/src/setup/provider-settings.js +1 -1
- package/dist/src/setup/scaffold/create/project.js +6 -2
- package/dist/src/setup/vercel-project.js +0 -0
- package/dist/src/setup/with-spinner.d.ts +1 -1
- package/dist/src/setup/with-spinner.js +1 -1
- package/dist/src/shared/action-types.js +1 -1
- package/dist/src/shared/agent-definition.d.ts +6 -4
- package/dist/src/shared/channel-definition.d.ts +2 -2
- package/dist/src/shared/chatgpt-model.d.ts +2 -2
- package/dist/src/shared/chatgpt-model.js +1 -1
- package/dist/src/shared/connection-types.d.ts +20 -7
- package/dist/src/shared/conversation-context.d.ts +15 -0
- package/dist/src/shared/model-connection.d.ts +17 -0
- package/dist/src/shared/model-connection.js +1 -0
- package/dist/src/shared/model-endpoint-status.d.ts +2 -1
- package/dist/src/shared/model-helper.d.ts +26 -0
- package/dist/src/shared/model-helper.js +1 -0
- package/dist/src/shared/package-version.d.ts +2 -0
- package/dist/src/shared/package-version.js +1 -0
- package/dist/src/shared/validate-authorization.js +1 -1
- package/dist/src/shared/vercel-services.d.ts +1 -0
- package/dist/src/shared/vercel-services.js +1 -1
- package/dist/src/shared/workflow-sandbox.d.ts +18 -12
- package/dist/src/shared/workflow-sandbox.js +1 -1
- package/dist/src/source-change/agent-config-ast.d.ts +6 -0
- package/dist/src/source-change/agent-config-ast.js +1 -1
- package/dist/src/source-change/apply-model-selection.d.ts +3 -1
- package/dist/src/source-change/apply-model-selection.js +1 -2
- package/dist/src/source-change/static-source-change.js +1 -1
- package/dist/src/subagents/callback-route.js +1 -1
- package/dist/src/subagents/event-proxy-step.d.ts +3 -3
- package/dist/src/subagents/event-proxy-step.js +1 -1
- package/dist/src/subagents/handle-dispatch.d.ts +12 -2
- package/dist/src/subagents/handle-dispatch.js +1 -1
- package/dist/src/subagents/handles/operation-id.d.ts +1 -1
- package/dist/src/subagents/handles/query.d.ts +0 -6
- package/dist/src/subagents/handles/query.js +1 -1
- package/dist/src/subagents/handles/state-key.d.ts +1 -1
- package/dist/src/subagents/handles/store.d.ts +1 -1
- package/dist/src/subagents/handles/store.js +1 -1
- package/dist/src/subagents/hitl-proxy.d.ts +1 -1
- package/dist/src/subagents/parent-notification.d.ts +2 -2
- package/dist/src/subagents/parent-result.d.ts +1 -1
- package/dist/src/subagents/remote-dispatch.d.ts +1 -1
- package/dist/src/subagents/remote-dispatch.js +1 -1
- package/dist/src/subagents/start-local.js +1 -1
- package/dist/src/subagents/tool.js +1 -1
- package/dist/src/svelte/index.js +1 -1
- package/dist/src/svelte/use-eve-agent.js +1 -1
- package/dist/src/tasks/session-index.d.ts +11 -0
- package/dist/src/tasks/session-index.js +1 -1
- package/dist/src/tasks/types.d.ts +1 -1
- package/dist/src/tools/auth.d.ts +5 -6
- package/dist/src/tools/provided/workflow.d.ts +12 -0
- package/dist/src/tools/provided/workflow.js +1 -0
- package/dist/src/tools/workflow-program-input.d.ts +6 -0
- package/dist/src/tools/workflow-program-input.js +1 -0
- package/dist/src/tracing/agent-otel-provider.js +2 -2
- package/dist/src/tracing/agent-otel-runtime-context.d.ts +2 -1
- package/dist/src/tracing/agent-otel-runtime-context.js +1 -1
- package/dist/src/tracing/agent-otel-session-context.js +1 -1
- package/dist/src/tracing/agent-otel-usage.js +1 -1
- package/dist/src/tracing/agent-span-contract.d.ts +1 -0
- package/dist/src/tracing/agent-span-contract.js +1 -1
- package/dist/src/tracing/agent-tool-instrumentation.js +1 -1
- package/dist/src/tracing/agent-trace-context-codec.js +1 -1
- package/dist/src/tracing/agent-trace-state.d.ts +2 -0
- package/dist/src/tracing/content-attributes.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/vue/index.js +1 -1
- package/dist/src/vue/use-eve-agent.js +1 -1
- package/docs/agent-config.md +23 -23
- package/docs/channels/chat-sdk.mdx +11 -2
- package/docs/channels/custom.mdx +32 -16
- package/docs/channels/eve.mdx +21 -19
- package/docs/channels/linear.mdx +7 -3
- package/docs/channels/linq.mdx +1 -1
- package/docs/channels/overview.mdx +17 -2
- package/docs/channels/photon.mdx +4 -1
- package/docs/channels/slack.mdx +12 -2
- package/docs/concepts/execution-model-and-durability.mdx +62 -13
- package/docs/concepts/sessions-runs-and-streaming.md +14 -5
- package/docs/connections/mcp.mdx +4 -1
- package/docs/connections/openapi.mdx +8 -2
- package/docs/connections/overview.mdx +16 -13
- package/docs/getting-started.mdx +8 -4
- package/docs/guides/deployment/self-hosting.md +1 -1
- package/docs/guides/deployment/vercel.mdx +3 -3
- package/docs/guides/dev-tui.md +58 -31
- package/docs/guides/dynamic-capabilities.md +4 -4
- package/docs/guides/frontend/overview.mdx +3 -1
- package/docs/guides/hooks.md +1 -1
- package/docs/guides/instrumentation/meta.json +5 -0
- package/docs/guides/instrumentation/otel.mdx +149 -0
- package/docs/guides/instrumentation/overview.md +199 -0
- package/docs/guides/instrumentation/providers.mdx +169 -0
- package/docs/guides/meta.json +0 -1
- package/docs/guides/remote-agents.md +19 -21
- package/docs/install-integrations.mdx +2 -4
- package/docs/memory/custom-provider.md +1 -1
- package/docs/patterns/multi-tenant-auth.md +3 -3
- package/docs/protocols/acp.md +1 -1
- package/docs/reference/cli.md +16 -16
- package/docs/reference/telemetry.md +1 -1
- package/docs/reference/typescript-api.md +21 -14
- package/docs/sandbox.mdx +3 -3
- package/docs/subagents/index.mdx +4 -4
- package/docs/tools/workflows.mdx +57 -2
- package/docs/tutorial/how-it-runs.mdx +1 -1
- package/package.json +6 -1
- package/dist/src/cli/commands/init-repl.d.ts +0 -80
- package/dist/src/cli/commands/init-repl.js +0 -1
- package/dist/src/cli/commands/init-self-modification.d.ts +0 -7
- package/dist/src/cli/commands/init-self-modification.js +0 -1
- package/dist/src/cli/commands/registry-package.d.ts +0 -52
- package/dist/src/cli/commands/registry-package.js +0 -1
- package/dist/src/cli/dev/tui/prompt-placeholder.d.ts +0 -12
- package/dist/src/cli/dev/tui/prompt-placeholder.js +0 -1
- package/dist/src/cli/dev/tui/remote-auth-command.d.ts +0 -11
- package/dist/src/cli/dev/tui/remote-auth-command.js +0 -3
- package/dist/src/compiled/_chunks/workflow/attribute-changes-BAcgmlXp.js +0 -20
- package/dist/src/compiled/_chunks/workflow/private-CFJkQA7R.js +0 -1
- package/dist/src/compiled/_chunks/workflow/resume-hook-BEHe0Uut.js +0 -1
- package/dist/src/compiled/_chunks/workflow/run-ChHLjaCt.js +0 -1
- package/dist/src/compiled/_chunks/workflow/sleep-BB2HuVie.js +0 -1
- package/dist/src/execution/accepted-delivery-deployment.d.ts +0 -7
- package/dist/src/execution/accepted-delivery-deployment.js +0 -1
- package/dist/src/execution/dispatch-turn-step.d.ts +0 -5
- package/dist/src/execution/dispatch-turn-step.js +0 -1
- package/dist/src/execution/durable-session-migrations/chain.d.ts +0 -38
- package/dist/src/execution/durable-session-migrations/chain.js +0 -1
- package/dist/src/execution/durable-session-migrations/snapshot.d.ts +0 -6
- package/dist/src/execution/durable-session-migrations/snapshot.js +0 -1
- package/dist/src/execution/durable-session-migrations/turn-workflow-v0-to-v1.d.ts +0 -12
- package/dist/src/execution/durable-session-migrations/turn-workflow-v0-to-v1.js +0 -1
- package/dist/src/execution/durable-session-migrations/turn-workflow-v1-to-v2.d.ts +0 -2
- package/dist/src/execution/durable-session-migrations/turn-workflow-v1-to-v2.js +0 -1
- package/dist/src/execution/durable-session-migrations/turn-workflow.d.ts +0 -88
- package/dist/src/execution/durable-session-migrations/turn-workflow.js +0 -1
- package/dist/src/execution/forward-turn-cancellation-step.d.ts +0 -6
- package/dist/src/execution/forward-turn-cancellation-step.js +0 -1
- package/dist/src/execution/forward-turn-delivery-step.d.ts +0 -6
- package/dist/src/execution/forward-turn-delivery-step.js +0 -1
- package/dist/src/execution/inline-turn.d.ts +0 -31
- package/dist/src/execution/inline-turn.js +0 -1
- package/dist/src/execution/next-driver-action.d.ts +0 -93
- package/dist/src/execution/parked-delivery-wait.d.ts +0 -54
- package/dist/src/execution/parked-delivery-wait.js +0 -1
- package/dist/src/execution/session-command-inbox.d.ts +0 -52
- package/dist/src/execution/session-command-inbox.js +0 -1
- package/dist/src/execution/session-command-token.d.ts +0 -6
- package/dist/src/execution/session-command-token.js +0 -1
- package/dist/src/execution/session-state-cursor.d.ts +0 -25
- package/dist/src/execution/session-state-cursor.js +0 -1
- package/dist/src/execution/session-timeout-control.js +0 -1
- package/dist/src/execution/session-timeout-steps.js +0 -1
- package/dist/src/execution/session-timeout-workflow.js +0 -1
- package/dist/src/execution/session-timeout.d.ts +0 -2
- package/dist/src/execution/session-timeout.js +0 -1
- package/dist/src/execution/turn-cancellation-control.d.ts +0 -30
- package/dist/src/execution/turn-cancellation-control.js +0 -1
- package/dist/src/execution/turn-cancellation-token.d.ts +0 -10
- package/dist/src/execution/turn-cancellation-token.js +0 -1
- package/dist/src/execution/turn-control-protocol.d.ts +0 -36
- package/dist/src/execution/turn-control-protocol.js +0 -1
- package/dist/src/execution/turn-control-receiver.d.ts +0 -54
- package/dist/src/execution/turn-control-receiver.js +0 -1
- package/dist/src/execution/turn-dispatch.d.ts +0 -39
- package/dist/src/execution/turn-dispatch.js +0 -1
- package/dist/src/execution/turn-execution-cursor.d.ts +0 -49
- package/dist/src/execution/turn-execution-cursor.js +0 -1
- package/dist/src/execution/turn-workflow-tool-run.js +0 -1
- package/dist/src/execution/turn-workflow.d.ts +0 -13
- package/dist/src/execution/turn-workflow.js +0 -1
- package/dist/src/execution/wire/session-inbox-contract.d.ts +0 -38
- package/dist/src/execution/wire/session-inbox-contract.js +0 -1
- package/dist/src/execution/wire/session-inbox-encoder.d.ts +0 -47
- package/dist/src/execution/wire/session-inbox-encoder.js +0 -1
- package/dist/src/execution/wire/session-inbox-resume.d.ts +0 -12
- package/dist/src/execution/wire/session-inbox-resume.js +0 -1
- package/dist/src/execution/wire/session-inbox-wire.d.ts +0 -29
- package/dist/src/execution/wire/session-inbox-wire.js +0 -1
- package/dist/src/execution/wire/session-inbox-wire.v0.d.ts +0 -5
- package/dist/src/execution/wire/session-inbox-wire.v0.js +0 -1
- package/dist/src/execution/wire/session-inbox-wire.v1.d.ts +0 -237
- package/dist/src/execution/wire/session-inbox-wire.v1.js +0 -1
- package/dist/src/execution/wire/session-inbox-wire.v2-migration.d.ts +0 -2
- package/dist/src/execution/wire/session-inbox-wire.v2-migration.js +0 -1
- package/dist/src/execution/wire/session-inbox-wire.v2.d.ts +0 -478
- package/dist/src/execution/wire/session-inbox-wire.v2.js +0 -1
- package/dist/src/execution/wire/session-inbox-wire.v2.migration.d.ts +0 -3
- package/dist/src/execution/wire/session-inbox-wire.v2.migration.js +0 -1
- package/dist/src/execution/wire/session-inbox-wire.v3.d.ts +0 -480
- package/dist/src/execution/wire/session-inbox-wire.v3.js +0 -1
- package/dist/src/execution/wire/session-inbox-wire.v3.migration.d.ts +0 -3
- package/dist/src/execution/wire/session-inbox-wire.v3.migration.js +0 -1
- package/dist/src/execution/wire/session-inbox-wire.v4.d.ts +0 -267
- package/dist/src/execution/wire/session-inbox-wire.v4.js +0 -1
- package/dist/src/execution/wire/session-inbox-wire.v4.migration.d.ts +0 -3
- package/dist/src/execution/wire/session-inbox-wire.v4.migration.js +0 -1
- package/dist/src/execution/wire/session-inbox-wire.v5.d.ts +0 -341
- package/dist/src/execution/wire/session-inbox-wire.v5.js +0 -1
- package/dist/src/execution/wire/session-inbox-wire.v5.migration.d.ts +0 -3
- package/dist/src/execution/wire/session-inbox-wire.v5.migration.js +0 -1
- package/dist/src/execution/wire/session-inbox-wire.v6.d.ts +0 -341
- package/dist/src/execution/wire/session-inbox-wire.v6.js +0 -1
- package/dist/src/execution/wire/session-inbox-wire.v7.d.ts +0 -342
- package/dist/src/execution/wire/session-inbox-wire.v7.js +0 -1
- package/dist/src/execution/workflow-entry-crash.d.ts +0 -39
- package/dist/src/execution/workflow-entry-crash.js +0 -1
- package/dist/src/execution/workflow-entry-finalization.d.ts +0 -28
- package/dist/src/execution/workflow-entry-finalization.js +0 -1
- package/dist/src/execution/workflow-entry.d.ts +0 -37
- package/dist/src/execution/workflow-entry.js +0 -1
- package/dist/src/execution/workflow-steps.js +0 -1
- package/dist/src/harness/workflow-continuation-security.d.ts +0 -5
- package/dist/src/harness/workflow-continuation-security.js +0 -1
- package/dist/src/harness/workflow-interrupt-state.d.ts +0 -20
- package/dist/src/harness/workflow-interrupt-state.js +0 -1
- package/dist/src/harness/workflow-lifecycle.d.ts +0 -32
- package/dist/src/harness/workflow-lifecycle.js +0 -1
- package/dist/src/harness/workflow-sandbox.d.ts +0 -28
- package/dist/src/harness/workflow-sandbox.js +0 -2
- package/dist/src/harness/workflow-subagent-limit.d.ts +0 -28
- package/dist/src/harness/workflow-subagent-limit.js +0 -1
- package/dist/src/harness/workflow-task-state.d.ts +0 -9
- package/dist/src/harness/workflow-task-state.js +0 -1
- package/dist/src/harness/workflow-tool-description.d.ts +0 -22
- package/dist/src/harness/workflow-tool-description.js +0 -37
- package/dist/src/subagents/handles/rebase.d.ts +0 -4
- package/dist/src/subagents/handles/rebase.js +0 -1
- package/dist/src/tools/workflow.d.ts +0 -37
- package/dist/src/tools/workflow.js +0 -1
- package/docs/guides/instrumentation-providers.md +0 -249
- package/docs/guides/instrumentation.md +0 -453
- /package/dist/src/{execution/next-driver-action.js → client/eve-agent-store-state.js} +0 -0
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{runMigrationChain}from"./chain.js";import{turnWorkflowInputV0ToV1}from"./turn-workflow-v0-to-v1.js";import{turnWorkflowInputV1ToV2}from"./turn-workflow-v1-to-v2.js";const TURN_WORKFLOW_INPUT_VERSION=2,turnWorkflowInputMigrations=[turnWorkflowInputV0ToV1,turnWorkflowInputV1ToV2];function createTurnWorkflowInput(e){return{capabilities:e.capabilities,completionToken:e.completionToken,driverCapabilities:{cancelledTurnSettle:!0,turnInbox:!0},initialCancellation:e.initialCancellation,initialStep:e.initialStep,mode:e.mode,stepInput:{input:e.delivery,parentWritable:e.parentWritable,serializedContext:e.serializedContext,sessionState:e.sessionState},version:2}}function migrateTurnWorkflowInput(e){return runMigrationChain({initialVersion:0,label:`turn workflow input`,migrations:turnWorkflowInputMigrations,targetVersion:2,value:e})}export{TURN_WORKFLOW_INPUT_VERSION,createTurnWorkflowInput,migrateTurnWorkflowInput};
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import type { TurnCancelPayload } from "#execution/turn-cancellation-token.js";
|
|
2
|
-
/** Forwards an inbox cancellation command to one private active-turn hook. */
|
|
3
|
-
export declare function forwardTurnCancellationStep(input: {
|
|
4
|
-
readonly payload: TurnCancelPayload;
|
|
5
|
-
readonly token: string;
|
|
6
|
-
}): Promise<boolean>;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{resumeHook}from"#internal/workflow/runtime.js";import{HookNotFoundError}from"#compiled/@workflow/errors/index.js";async function forwardTurnCancellationStep(e){"use step";for(let t=0;t<50;t+=1)try{return await resumeHook(e.token,e.payload),!0}catch(e){if(!HookNotFoundError.is(e))throw e;if(t===49)return!1;await new Promise(e=>setTimeout(e,20))}return!1}export{forwardTurnCancellationStep};
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import type { TurnInboxPayload } from "#execution/turn-control-protocol.js";
|
|
2
|
-
/** Forwards one accepted public delivery to the private inbox of its requesting turn. */
|
|
3
|
-
export declare function forwardTurnDeliveryStep(input: {
|
|
4
|
-
readonly inboxToken: string;
|
|
5
|
-
readonly payload: TurnInboxPayload;
|
|
6
|
-
}): Promise<void>;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{resumeHook}from"#internal/workflow/runtime.js";async function forwardTurnDeliveryStep(e){"use step";await resumeHook(e.inboxToken,e.payload)}export{forwardTurnDeliveryStep};
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import type { DeliverHookPayload, HookPayload, SessionCapabilities } from "#channel/types.js";
|
|
2
|
-
import type { InitialTurnStep } from "#execution/durable-session-migrations/turn-workflow.js";
|
|
3
|
-
import type { DurableSessionState } from "#execution/durable-session-store.js";
|
|
4
|
-
import type { NextDriverAction } from "#execution/next-driver-action.js";
|
|
5
|
-
import type { SessionCommandInbox } from "#execution/session-command-inbox.js";
|
|
6
|
-
import { SessionStateCursor } from "#execution/session-state-cursor.js";
|
|
7
|
-
import type { TurnCancelPayload } from "#execution/turn-cancellation-token.js";
|
|
8
|
-
import type { RunMode } from "#shared/run-mode.js";
|
|
9
|
-
export type InlineTurnOutcome = {
|
|
10
|
-
readonly initialCancellation?: TurnCancelPayload;
|
|
11
|
-
readonly initialStep?: InitialTurnStep;
|
|
12
|
-
readonly kind: "child" | "continue";
|
|
13
|
-
} | {
|
|
14
|
-
readonly action: NextDriverAction;
|
|
15
|
-
readonly kind: "result";
|
|
16
|
-
};
|
|
17
|
-
/** Runs same-deployment steps directly until they need the shared turn runner. */
|
|
18
|
-
export declare function runInlineTurn(input: {
|
|
19
|
-
readonly bufferedDeliveries: DeliverHookPayload[];
|
|
20
|
-
readonly bufferedSessionControls: Array<"clear" | "compact" | "expired" | "reset">;
|
|
21
|
-
readonly cancelledTaskIds?: Set<string>;
|
|
22
|
-
readonly capabilities?: SessionCapabilities;
|
|
23
|
-
readonly commandInbox: SessionCommandInbox;
|
|
24
|
-
readonly delivery: HookPayload;
|
|
25
|
-
readonly mode: RunMode;
|
|
26
|
-
readonly parentWritable: WritableStream<Uint8Array>;
|
|
27
|
-
readonly seenTaskDeliveries?: Set<string>;
|
|
28
|
-
readonly serializedContext: Record<string, unknown>;
|
|
29
|
-
readonly sessionState: DurableSessionState;
|
|
30
|
-
readonly stateCursor?: SessionStateCursor;
|
|
31
|
-
}): Promise<InlineTurnOutcome>;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{activeTurnId}from"#harness/active-turn-id.js";import{readAcceptedDeploymentId}from"#execution/accepted-delivery-deployment.js";import{cancelAllIndexedSessionTasksStep}from"#execution/cancel-indexed-session-tasks-step.js";import{reportDroppedWirePayloadStep}from"#execution/report-dropped-wire-payload-step.js";import{SessionStateCursor}from"#execution/session-state-cursor.js";import{SessionInboxWireError,sessionInboxWire}from"#execution/wire/session-inbox-wire.js";import{turnStep}from"#execution/workflow-steps.js";import{TurnCancelledError}from"#harness/turn-cancellation.js";async function runInlineTurn(e){let t=readAcceptedDeploymentId(e.delivery);if(t===void 0)return{kind:`child`};let n=e.stateCursor??new SessionStateCursor({serializedContext:e.serializedContext,sessionState:e.sessionState}),r=new InlineTurnControl({bufferedDeliveries:e.bufferedDeliveries,bufferedSessionControls:e.bufferedSessionControls,cancelledTaskIds:e.cancelledTaskIds,commandInbox:e.commandInbox,expectedTurnId:activeTurnId(e.sessionState.emissionState),seenTaskDeliveries:e.seenTaskDeliveries,stateCursor:n}),i=e.delivery;for(;;){let a={serializedContext:n.serializedContext,sessionState:n.sessionState},o=await r.waitForStep(turnStep({abortSignal:r.signal,acceptedDeploymentId:t,input:i,parentWritable:e.parentWritable,serializedContext:n.serializedContext,sessionState:n.sessionState}));if(o.requiresChildDispatch===!0)return{initialCancellation:r.initialCancellation,kind:`child`};let s={beforeStep:a,result:o};if(r.initialCancellation!==void 0||o.action===`cancelled`||(o.backgroundTasks?.length??0)>0)return continueOutcome(r,s);if(o.action===`done`)return{action:{isError:o.isError,kind:`done`,output:o.output??``,serializedContext:o.serializedContext,sessionState:o.sessionState,usage:o.usage,usageDelta:o.usageDelta},kind:`result`};if(o.action===`dispatch-workflow-tasks`||o.action===`park`&&o.pendingCoordinationCallIds!==void 0)return continueOutcome(r,s);if(o.action===`park`)return o.hasPendingAuthorization||o.hasPendingInputBatch&&e.capabilities?.requestInput===!0||e.mode===`conversation`?{action:{authorizationAttemptIds:o.authorizationAttemptIds,authorizationNames:o.authorizationNames,kind:`park`,serializedContext:o.serializedContext,sessionState:o.sessionState,settled:o.settled},kind:`result`}:continueOutcome(r,s);let c=n.sessionState.continuationToken;n.adoptState(o),n.sessionState.continuationToken!==``&&n.sessionState.continuationToken!==c&&await e.commandInbox.rekeyContinuation(n.sessionState.continuationToken),i=void 0}}function continueOutcome(e,t){return{initialCancellation:e.initialCancellation,initialStep:t,kind:`continue`}}var InlineTurnControl=class{bufferedDeliveries;bufferedSessionControls;cancelledTaskIds;commandInbox;controller=new AbortController;expectedTurnId;seenTaskDeliveries;stateCursor;cancellation;constructor(e){this.bufferedDeliveries=e.bufferedDeliveries,this.bufferedSessionControls=e.bufferedSessionControls,this.cancelledTaskIds=e.cancelledTaskIds??new Set,this.commandInbox=e.commandInbox,this.expectedTurnId=e.expectedTurnId,this.seenTaskDeliveries=e.seenTaskDeliveries??new Set,this.stateCursor=e.stateCursor}get initialCancellation(){return this.cancellation}get signal(){return this.controller.signal}async waitForStep(e){let t=e.then(e=>({kind:`step`,result:e}));for(;;){let e=await Promise.race([t,this.commandInbox.next().then(e=>({kind:`command`,result:e}))]);if(e.kind===`step`)return e.result;if(e.result.done)throw Error(`Session command inbox closed before the inline turn step settled.`);this.commandInbox.consumeNext(),await this.handle(e.result.value)}}abort(e){this.controller.signal.aborted||(this.cancellation=e,this.controller.abort(new TurnCancelledError))}acceptTaskDelivery(e){let t=e.taskDeliveryId??e.caller?.taskId;return t===void 0?!0:this.originatesFromCancelledTask(t)||this.seenTaskDeliveries.has(t)?!1:(this.seenTaskDeliveries.add(t),!0)}async handle(e){if(e.kind===`runtime-action-result`)return;let t;try{t=sessionInboxWire.decode(e)}catch(e){if(!(e instanceof SessionInboxWireError))throw e;await reportDroppedWirePayloadStep({detail:e.message,family:`session-inbox`});return}if(t.kind===`deliver`){if(!this.acceptTaskDelivery(t))return;this.bufferedDeliveries.push(t),t.turnPolicy===`steer`&&deliveryHasMessage(t)&&this.abort({});return}if(t.kind===`clear`||t.kind===`compact`){this.bufferedSessionControls.push(t.kind);return}if(t.kind===`session-timeout`){this.bufferedSessionControls.push(`expired`);return}if(t.kind===`reset`){this.bufferedSessionControls.push(`reset`),this.abort({});return}if(t.kind===`cancel`){`tasks`in t&&t.tasks===!0&&await cancelAllIndexedSessionTasksStep({serializedContext:this.stateCursor.serializedContext,sessionState:this.stateCursor.sessionState}),t.taskId!==void 0&&this.discardTaskDeliveries(t.taskId);let e=t.taskId!==void 0&&t.turnId!==void 0&&t.turnId!==this.expectedTurnId?void 0:t.turnId;if(e===void 0||e===this.expectedTurnId){let n=e===void 0?{tasks:t.tasks}:{tasks:t.tasks,turnId:e};this.abort(n)}}}discardTaskDeliveries(e){this.cancelledTaskIds.add(e);let t=this.bufferedDeliveries.filter(e=>!this.shouldDiscard(e));this.bufferedDeliveries.splice(0,this.bufferedDeliveries.length,...t)}originatesFromCancelledTask(e){return[...this.cancelledTaskIds].some(t=>e===t||e.startsWith(`${t}:`))}shouldDiscard(e){let t=e.taskDeliveryId??e.caller?.taskId;return t!==void 0&&this.originatesFromCancelledTask(t)}};function deliveryHasMessage(e){return e.payloads.some(e=>e.message!==void 0)}export{runInlineTurn};
|
|
@@ -1,93 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Closed-contract dispatch surface between session-mutating step bodies
|
|
3
|
-
* (the accepting deployment when stamped, otherwise the driver's deployment)
|
|
4
|
-
* and the durable driver workflow (pinned to whichever deployment called
|
|
5
|
-
* `start()`).
|
|
6
|
-
*
|
|
7
|
-
* The driver matches on `kind` and follows a fixed playbook per arm.
|
|
8
|
-
* Adding a new arm is breaking (pinned drivers can't dispatch an
|
|
9
|
-
* unknown `kind`); adding optional fields inside an existing arm is
|
|
10
|
-
* forward-compatible because the driver passes the action through by
|
|
11
|
-
* reference and devalue preserves unknown POJO fields. Do not
|
|
12
|
-
* destructure-and-rebuild a `NextDriverAction` — full destructuring
|
|
13
|
-
* strips unknown fields.
|
|
14
|
-
*/
|
|
15
|
-
import type { DurableSessionState } from "#execution/durable-session-store.js";
|
|
16
|
-
import type { SettledTurn, StepResult } from "#harness/types.js";
|
|
17
|
-
import type { TokenUsage } from "#shared/token-usage.js";
|
|
18
|
-
interface DurableStepResultFields {
|
|
19
|
-
/** Pre-step context plus only the observability continuation owned by background tasks. */
|
|
20
|
-
readonly backgroundTaskContext?: Record<string, unknown>;
|
|
21
|
-
readonly backgroundTaskState?: DurableSessionState;
|
|
22
|
-
readonly backgroundTasks?: StepResult["backgroundTasks"];
|
|
23
|
-
/** The guarded inline step deferred before mutating state. */
|
|
24
|
-
readonly requiresChildDispatch?: true;
|
|
25
|
-
readonly serializedContext: Record<string, unknown>;
|
|
26
|
-
readonly sessionState: DurableSessionState;
|
|
27
|
-
}
|
|
28
|
-
/** Result returned by a turn step to its durable driver workflow. */
|
|
29
|
-
export type DurableStepResult = ({
|
|
30
|
-
readonly action: "continue" | "done";
|
|
31
|
-
readonly output?: unknown;
|
|
32
|
-
readonly isError?: boolean;
|
|
33
|
-
readonly usage?: TokenUsage;
|
|
34
|
-
readonly usageDelta?: TokenUsage;
|
|
35
|
-
} | {
|
|
36
|
-
readonly action: "cancelled";
|
|
37
|
-
} | {
|
|
38
|
-
readonly action: "park";
|
|
39
|
-
readonly authorizationAttemptIds?: readonly string[];
|
|
40
|
-
readonly authorizationNames?: readonly string[];
|
|
41
|
-
readonly hasPendingAuthorization: boolean;
|
|
42
|
-
readonly hasPendingInputBatch: boolean;
|
|
43
|
-
readonly pendingCoordinationCallIds?: readonly string[];
|
|
44
|
-
readonly settled?: SettledTurn;
|
|
45
|
-
} | {
|
|
46
|
-
readonly action: "dispatch-workflow-tasks";
|
|
47
|
-
readonly pendingTaskCallIds: readonly string[];
|
|
48
|
-
}) & DurableStepResultFields;
|
|
49
|
-
/** Discriminated union the driver workflow body dispatches on. */
|
|
50
|
-
export type NextDriverAction = {
|
|
51
|
-
readonly kind: "done";
|
|
52
|
-
readonly output: unknown;
|
|
53
|
-
readonly isError?: boolean;
|
|
54
|
-
readonly sessionState: DurableSessionState;
|
|
55
|
-
readonly serializedContext: Record<string, unknown>;
|
|
56
|
-
/** Session-total token usage spent by the completed session. */
|
|
57
|
-
readonly usage?: TokenUsage;
|
|
58
|
-
/**
|
|
59
|
-
* Usage the final turn added beyond what earlier settled turns already
|
|
60
|
-
* reported; forwarded through the same pinned-driver-safe
|
|
61
|
-
* optional-field pattern as `cancelled`.
|
|
62
|
-
*/
|
|
63
|
-
readonly usageDelta?: TokenUsage;
|
|
64
|
-
} | {
|
|
65
|
-
readonly kind: "park";
|
|
66
|
-
readonly sessionState: DurableSessionState;
|
|
67
|
-
readonly serializedContext: Record<string, unknown>;
|
|
68
|
-
readonly authorizationAttemptIds?: readonly string[];
|
|
69
|
-
readonly authorizationNames?: readonly string[];
|
|
70
|
-
/**
|
|
71
|
-
* Set when the parked turn was cancelled: the driver runs
|
|
72
|
-
* `settleCancelledTurnStep` before the normal park playbook. An
|
|
73
|
-
* optional field rather than a new arm so pinned drivers keep
|
|
74
|
-
* working.
|
|
75
|
-
*/
|
|
76
|
-
readonly cancelled?: true;
|
|
77
|
-
/**
|
|
78
|
-
* Settled user-facing answer forwarded through the same pinned-driver-safe
|
|
79
|
-
* optional-field pattern as `cancelled`.
|
|
80
|
-
*/
|
|
81
|
-
readonly settled?: SettledTurn;
|
|
82
|
-
} | {
|
|
83
|
-
readonly kind: "dispatch-coordination";
|
|
84
|
-
readonly pendingCallIds: readonly string[];
|
|
85
|
-
readonly sessionState: DurableSessionState;
|
|
86
|
-
readonly serializedContext: Record<string, unknown>;
|
|
87
|
-
} | {
|
|
88
|
-
readonly kind: "dispatch-workflow-tasks";
|
|
89
|
-
readonly pendingCallIds: readonly string[];
|
|
90
|
-
readonly sessionState: DurableSessionState;
|
|
91
|
-
readonly serializedContext: Record<string, unknown>;
|
|
92
|
-
};
|
|
93
|
-
export {};
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
import type { DeliverHookPayload, DeliverPayload } from "#channel/types.js";
|
|
2
|
-
import type { SessionCommandInbox } from "#execution/session-command-inbox.js";
|
|
3
|
-
import type { SessionStateCursor } from "#execution/session-state-cursor.js";
|
|
4
|
-
/** One authorization-callback read surfaced during a parked wait. */
|
|
5
|
-
export interface AuthorizationCallbackInstruction {
|
|
6
|
-
readonly kind: "authorization";
|
|
7
|
-
/** True when the authorization hook closed; no further callbacks can arrive. */
|
|
8
|
-
readonly closed: boolean;
|
|
9
|
-
readonly payloads: readonly DeliverPayload[];
|
|
10
|
-
}
|
|
11
|
-
/** What the parked driver should do with the next session activity. */
|
|
12
|
-
export type NextTurnInstruction = {
|
|
13
|
-
readonly kind: "clear";
|
|
14
|
-
} | {
|
|
15
|
-
readonly kind: "compact";
|
|
16
|
-
} | {
|
|
17
|
-
readonly kind: "expired";
|
|
18
|
-
} | {
|
|
19
|
-
readonly kind: "reset";
|
|
20
|
-
} | {
|
|
21
|
-
readonly kind: "closed";
|
|
22
|
-
} | {
|
|
23
|
-
readonly kind: "cancel-turn";
|
|
24
|
-
} | AuthorizationCallbackInstruction | {
|
|
25
|
-
readonly kind: "turn";
|
|
26
|
-
readonly delivery: DeliverHookPayload;
|
|
27
|
-
};
|
|
28
|
-
/**
|
|
29
|
-
* Awaits the next delivery that requires driver action while the session
|
|
30
|
-
* is parked. Deliveries fully routed to a descendant leave the parent with
|
|
31
|
-
* no turn to run, so this keeps waiting until a delivery produces a parent
|
|
32
|
-
* turn, a cancellation, expiry, or hook closure. The wait is unbounded by
|
|
33
|
-
* design: a parked session lives until something addresses it.
|
|
34
|
-
*
|
|
35
|
-
* With `awaitAuthorizationCallbacks`, the inbox's authorization window stays
|
|
36
|
-
* open for the whole wait — including iterations that consume activity
|
|
37
|
-
* without producing a parent turn (no-op cancels, fully-routed descendant
|
|
38
|
-
* deliveries) — so an open challenge's callback surfaces as an
|
|
39
|
-
* `"authorization"` instruction no matter when it arrives.
|
|
40
|
-
*
|
|
41
|
-
* Routing steps mutate durable state; each transition is adopted into the
|
|
42
|
-
* caller-owned `stateCursor`, so returns carry only the instruction kind.
|
|
43
|
-
*/
|
|
44
|
-
export declare function nextTurnDelivery(input: {
|
|
45
|
-
readonly awaitAuthorizationCallbacks?: boolean;
|
|
46
|
-
readonly bufferedDeliveries: DeliverHookPayload[];
|
|
47
|
-
readonly bufferedSessionControls: Array<"clear" | "compact" | "expired" | "reset">;
|
|
48
|
-
readonly cancelledTaskIds?: Set<string>;
|
|
49
|
-
readonly commandInbox: SessionCommandInbox;
|
|
50
|
-
readonly deferDeliveries?: boolean;
|
|
51
|
-
readonly driverWritable: WritableStream<Uint8Array>;
|
|
52
|
-
readonly seenTaskDeliveries?: Set<string>;
|
|
53
|
-
readonly stateCursor: SessionStateCursor;
|
|
54
|
-
}): Promise<NextTurnInstruction>;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{jsonValuesEqual}from"#shared/json.js";import{coalesceDeliveries}from"#harness/messages.js";import{cancelAllIndexedSessionTasksStep}from"#execution/cancel-indexed-session-tasks-step.js";import{reportDroppedWirePayloadStep}from"#execution/report-dropped-wire-payload-step.js";import{SessionInboxWireError,sessionInboxWire}from"#execution/wire/session-inbox-wire.js";import{routeDeliverToChildren}from"#execution/route-child-delivery.js";import{getSessionTaskCohorts}from"#tasks/session-task-cohorts.js";async function nextTurnDelivery(e){if(e.awaitAuthorizationCallbacks!==!0)return await awaitNextTurnDelivery(e);e.commandInbox.setAuthorizationWindow(!0);try{return await awaitNextTurnDelivery(e)}finally{e.commandInbox.setAuthorizationWindow(!1)}}async function awaitNextTurnDelivery(e){let t=e.cancelledTaskIds??new Set,n=e.seenTaskDeliveries??new Set;for(;;){let r=await waitForNextSessionAction({bufferedDeliveries:e.bufferedDeliveries,bufferedSessionControls:e.bufferedSessionControls,cancelledTaskIds:t,commandInbox:e.commandInbox,deferDeliveries:e.deferDeliveries,seenTaskDeliveries:n,stateCursor:e.stateCursor});if(r.kind===`authorization`)return r;if(r.kind!==`delivery`)return{kind:r.kind};let i=r.delivery;if(i===null)return{kind:`closed`};let a=await routeDeliverToChildren({delivery:i,parentWritable:e.driverWritable,serializedContext:e.stateCursor.serializedContext,sessionState:e.stateCursor.sessionState});if(e.stateCursor.adoptState(a),a.kind===`cancel-turn`)return{kind:`cancel-turn`};if(a.remainder!==void 0)return{delivery:a.remainder,kind:`turn`}}}async function waitForNextSessionAction(e){let t=e.bufferedSessionControls.shift();if(t!==void 0)return{kind:t};for(;;){if(e.deferDeliveries!==!0&&!e.commandInbox.hasReadyAuthorization()){let t=takeBufferedTurnDelivery(e.bufferedDeliveries,getSessionTaskCohorts(e.stateCursor.sessionState.snapshot?.session.state),e.cancelledTaskIds);if(t!==void 0)return{delivery:t,kind:`delivery`}}let{result:t,source:n}=await e.commandInbox.nextWithSource();if(e.commandInbox.consumeNext(),n===`authorization`)return t.done?{closed:!0,kind:`authorization`,payloads:[]}:{closed:!1,kind:`authorization`,payloads:t.value.kind===`deliver`?t.value.payloads:[]};if(t.done)return{delivery:null,kind:`delivery`};if(t.value.kind===`runtime-action-result`)continue;let r;try{r=sessionInboxWire.decode(t.value)}catch(e){if(!(e instanceof SessionInboxWireError))throw e;await reportDroppedWirePayloadStep({detail:e.message,family:`session-inbox`});continue}if(r.kind===`session-timeout`)return{kind:`expired`};if(r.kind===`clear`||r.kind===`compact`||r.kind===`reset`)return{kind:r.kind};if(r.kind===`cancel`){if(`tasks`in r&&r.tasks===!0&&await cancelAllIndexedSessionTasksStep({serializedContext:e.stateCursor.serializedContext,sessionState:e.stateCursor.sessionState}),r.taskId!==void 0){e.cancelledTaskIds.add(r.taskId);let t=e.bufferedDeliveries.filter(t=>!isCancelledTaskDelivery(t,e.cancelledTaskIds));e.bufferedDeliveries.splice(0,e.bufferedDeliveries.length,...t)}continue}let i=r.taskDeliveryId??r.caller?.taskId;if(!(i!==void 0&&isCancelledTaskDeliveryId(i,e.cancelledTaskIds))){if(i!==void 0){if(e.seenTaskDeliveries.has(i))continue;e.seenTaskDeliveries.add(i)}e.bufferedDeliveries.push(r)}}}function isCancelledTaskDelivery(e,t){let n=e.taskDeliveryId??e.caller?.taskId;return n!==void 0&&isCancelledTaskDeliveryId(n,t)}function isCancelledTaskDeliveryId(e,t){return[...t].some(t=>e===t||e.startsWith(`${t}:`))}function takeBufferedTurnDelivery(e,t,n){let r=e.filter(e=>!isCancelledTaskDelivery(e,n));e.splice(0,e.length,...r);let i=new Set(e.flatMap(e=>{let t=completionTaskId(e);return t===void 0?[]:[t]})),a=new Set;for(let[e,r]of t)!r.settled&&!i.has(e)&&!n.has(e)&&a.add(r.cohortId);let o=e.findIndex(e=>{let n=completionCohort(e,t);return n===void 0||!a.has(n)});if(o<0)return;let s=completionCohort(e[o],t);if(s!==void 0){let n=e.findLastIndex(e=>completionCohort(e,t)===s),r=e.findIndex((e,r)=>r>o&&r<n&&completionCohort(e,t)===void 0);r>=0&&(o=r)}let c=e.splice(o,1)[0],l=completionCohort(c,t);if(l!==void 0){let n=e.filter(e=>completionCohort(e,t)===l),r=e.filter(e=>completionCohort(e,t)!==l);return e.splice(0,e.length,...r),coalesceDeliveries([c,...n])}let u=c.auth!=null&&c.auth.principalType!==`anonymous`,d=[c],f=c.caller;for(;e.length>o;){let t=e[o];if(t===void 0||c.taskDeliveryId!==void 0||t.taskDeliveryId!==void 0||!u||!jsonValuesEqual(c.auth,t.auth)||f!==void 0&&t.caller!==void 0)break;let n=e.splice(o,1)[0];if(n===void 0)throw Error(`Buffered turn delivery disappeared while partitioning.`);d.push(n),f??=n.caller}return coalesceDeliveries(d)}function completionCohort(e,t){let n=completionTaskId(e);return n===void 0?void 0:t.get(n)?.cohortId}function completionTaskId(e){if(e.caller===void 0&&e.taskDeliveryId?.endsWith(`:ready:completed`))return e.taskDeliveryId.slice(0,-16)}export{nextTurnDelivery};
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
import type { DeliverHookPayload, RuntimeActionResultHookPayload, SessionCommand, SessionTimeoutHookPayload } from "#channel/types.js";
|
|
2
|
-
/**
|
|
3
|
-
* Payloads accepted by a session driver's stable and channel aliases.
|
|
4
|
-
*
|
|
5
|
-
* This union is the hook's transport typing only. The driver routes payloads
|
|
6
|
-
* after the inbox surfaces them; the inbox owns no command semantics.
|
|
7
|
-
*/
|
|
8
|
-
export type SessionInboxPayload = DeliverHookPayload | RuntimeActionResultHookPayload | SessionCommand | SessionTimeoutHookPayload;
|
|
9
|
-
/** Which hook family produced an inbox read. */
|
|
10
|
-
export type SessionInboxSource = "authorization" | "session";
|
|
11
|
-
/**
|
|
12
|
-
* Multiplexes one stable session hook, one rekeyable channel alias, and one
|
|
13
|
-
* window-gated authorization-callback hook.
|
|
14
|
-
*/
|
|
15
|
-
export interface SessionCommandInbox {
|
|
16
|
-
/**
|
|
17
|
-
* Claims the session's authorization-callback hook as an inbox source.
|
|
18
|
-
* Its reads stay stashed until {@link setAuthorizationWindow} opens, so
|
|
19
|
-
* callbacks never surface as ordinary session activity.
|
|
20
|
-
*/
|
|
21
|
-
claimAuthorization(token: string): Promise<void>;
|
|
22
|
-
claimStable(token: string): Promise<void>;
|
|
23
|
-
consumeNext(): void;
|
|
24
|
-
/** Whether an authorization read is already eligible to be consumed. */
|
|
25
|
-
hasReadyAuthorization(): boolean;
|
|
26
|
-
next(): Promise<IteratorResult<SessionInboxPayload>>;
|
|
27
|
-
/**
|
|
28
|
-
* Like {@link next} but reports which hook family produced the read.
|
|
29
|
-
* Reads surface in one arrival order across every source, which keeps
|
|
30
|
-
* waits that interleave authorization callbacks with ordinary session
|
|
31
|
-
* activity deterministic under workflow replay.
|
|
32
|
-
*/
|
|
33
|
-
nextWithSource(): Promise<{
|
|
34
|
-
result: IteratorResult<SessionInboxPayload>;
|
|
35
|
-
source: SessionInboxSource;
|
|
36
|
-
}>;
|
|
37
|
-
rekeyContinuation(token: string): Promise<void>;
|
|
38
|
-
/** Opens or closes the surfacing window for authorization-callback reads. */
|
|
39
|
-
setAuthorizationWindow(open: boolean): void;
|
|
40
|
-
}
|
|
41
|
-
/** Adds workflow-entry lifecycle ownership to a session command inbox. */
|
|
42
|
-
export interface SessionCommandInboxHandle extends SessionCommandInbox {
|
|
43
|
-
dispose(): Promise<void>;
|
|
44
|
-
}
|
|
45
|
-
/**
|
|
46
|
-
* Creates the command inbox owned by one session driver.
|
|
47
|
-
*
|
|
48
|
-
* The stable hook is retained for the session's lifetime. Rekeying replaces
|
|
49
|
-
* only the channel alias. Reads already committed to a retired alias remain in
|
|
50
|
-
* the multiplexed queue and are consumed exactly once.
|
|
51
|
-
*/
|
|
52
|
-
export declare function createSessionCommandInbox(): SessionCommandInboxHandle;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{SESSION_INBOX_WIRE_VERSION,SESSION_INBOX_WIRE_VERSION_METADATA_KEY,WORKFLOW_TASK_AUTHORIZATION_METADATA_KEY}from"#execution/wire/session-inbox-contract.js";import{createHook}from"#compiled/@workflow/core/index.js";import{claimHookOwnership,disposeHook}from"#execution/hook-ownership.js";function createSessionCommandInbox(){let e,t,n,r=[],i=[],a=0,o=null,s,c,enqueue=e=>{i.push(e),i.sort((e,t)=>e.order-t.order),c?.(),c=void 0},arm=e=>{e.closed||e.pending||(e.pending=!0,e.resolved=void 0,(e.retired?Promise.resolve(e.hook).then(e=>({done:!1,value:e})):e.iterator.next()).then(t=>{let n={order:a++,result:t,state:e};e.resolved=n,e.enabled&&enqueue(n)},()=>{}))},enable=e=>{e.enabled=!0,e.resolved!==void 0&&enqueue(e.resolved)},createState=e=>{let t=createHook({metadata:{[SESSION_INBOX_WIRE_VERSION_METADATA_KEY]:SESSION_INBOX_WIRE_VERSION,[WORKFLOW_TASK_AUTHORIZATION_METADATA_KEY]:!0},token:e});return{closed:!1,enabled:!1,hook:t,iterator:t[Symbol.asyncIterator](),pending:!1,retired:!1}},states=()=>[e,t,n,...r].filter(e=>e!==void 0),nextRead=()=>{if(e===void 0)throw Error(`Cannot wait for session commands before claiming the stable inbox.`);if(o!==null)return o;let t=states();for(let e of t)arm(e);return t.every(e=>e.closed)?(s={order:a++,result:{done:!0,value:void 0},state:e},o=Promise.resolve(s.result),o):(o=(async()=>{for(;i.length===0;)await new Promise(e=>{c=e});let e=i.shift();return s=e,e.result})(),o)};return{async claimAuthorization(e){if(n!==void 0){if(n.hook.token===e)return;throw Error(`A session command inbox cannot change its authorization token.`)}let t=createState(e);await claimHookOwnership(t.hook),n=t},async claimStable(t){if(e!==void 0){if(e.hook.token===t)return;throw Error(`A session command inbox cannot change its stable token.`)}let n=createState(t);await claimHookOwnership(n.hook),enable(n),e=n},consumeNext(){if(s===void 0)throw Error(`Cannot consume a session command before it resolves.`);s.state.pending=!1,s.state.resolved=void 0,s.result.done&&(s.state.closed=!0),s=void 0,o=null},async dispose(){let r=[t,e,n].filter(e=>e!==void 0);t=void 0,e=void 0,n=void 0,await Promise.all(r.map(async e=>await disposeHook(e.hook)))},hasReadyAuthorization(){return n?.enabled!==!0||n.resolved===void 0?!1:s===void 0?i[0]?.state===n:s.state===n},next:nextRead,async nextWithSource(){return{result:await nextRead(),source:s!==void 0&&s.state===n?`authorization`:`session`}},setAuthorizationWindow(e){if(n===void 0){if(e)throw Error(`Cannot open the authorization window before claiming its hook.`);return}if(e){n.enabled||enable(n),s!==void 0&&s.state!==n&&n.resolved!==void 0&&n.resolved.order<s.order&&(enqueue(s),s=void 0,o=null),o!==null&&arm(n);return}n.enabled=!1;let t=i.findIndex(e=>e.state===n);t!==-1&&i.splice(t,1)},async rekeyContinuation(e){if(!e||t?.hook.token===e)return;let n=createState(e);if(t===void 0){await claimHookOwnership(n.hook),enable(n),t=n,o!==null&&arm(n);return}arm(n),await claimHookOwnership(n.hook),enable(n);let i=t;t=n,arm(i);try{await disposeHook(i.hook)}catch(e){t=void 0;try{await disposeHook(n.hook)}catch{}throw e}i.retired=!0,r.push(i)}}}export{createSessionCommandInbox};
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
/** Returns whether a token belongs to eve's framework-reserved session command namespace. */
|
|
2
|
-
export declare function isReservedSessionCommandToken(token: string): boolean;
|
|
3
|
-
/** Returns whether a token is the stable command inbox for one workflow run. */
|
|
4
|
-
export declare function isSessionCommandHookToken(token: string): boolean;
|
|
5
|
-
/** Derives the framework-reserved stable command inbox token for a session. */
|
|
6
|
-
export declare function sessionCommandHookToken(sessionId: string): string;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
const SESSION_COMMAND_NAMESPACE=`eve:session`;function isReservedSessionCommandToken(e){return e.startsWith(`${SESSION_COMMAND_NAMESPACE}:`)}function isSessionCommandHookToken(e){let t=`${SESSION_COMMAND_NAMESPACE}:`;return!e.startsWith(t)||!e.endsWith(`:inbox`)?!1:!e.slice(t.length,-6).includes(`:`)}function sessionCommandHookToken(e){return`${SESSION_COMMAND_NAMESPACE}:${e}:inbox`}export{isReservedSessionCommandToken,isSessionCommandHookToken,sessionCommandHookToken};
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import type { DurableSessionState } from "#execution/durable-session-store.js";
|
|
2
|
-
/** A durable-state transition; absent fields keep the cursor's current value. */
|
|
3
|
-
export interface SessionStateTransition {
|
|
4
|
-
readonly serializedContext?: Record<string, unknown>;
|
|
5
|
-
readonly sessionState?: DurableSessionState;
|
|
6
|
-
}
|
|
7
|
-
/**
|
|
8
|
-
* Owns the mutable serialized-context / session-state pair that durable
|
|
9
|
-
* steps thread through a run. Holders adopt each step's transition instead
|
|
10
|
-
* of rebinding both values by hand at every callsite.
|
|
11
|
-
*/
|
|
12
|
-
export declare class SessionStateCursor {
|
|
13
|
-
private currentSerializedContext;
|
|
14
|
-
private currentSessionState;
|
|
15
|
-
constructor(input: {
|
|
16
|
-
readonly serializedContext: Record<string, unknown>;
|
|
17
|
-
readonly sessionState: DurableSessionState;
|
|
18
|
-
});
|
|
19
|
-
/** Latest adopted serialized runtime context. */
|
|
20
|
-
get serializedContext(): Record<string, unknown>;
|
|
21
|
-
/** Latest adopted durable session state. */
|
|
22
|
-
get sessionState(): DurableSessionState;
|
|
23
|
-
/** Adopts a state transition; fields a step did not change carry forward. */
|
|
24
|
-
adoptState(transition: SessionStateTransition): void;
|
|
25
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
var SessionStateCursor=class{currentSerializedContext;currentSessionState;constructor(e){this.currentSerializedContext=e.serializedContext,this.currentSessionState=e.sessionState}get serializedContext(){return this.currentSerializedContext}get sessionState(){return this.currentSessionState}adoptState(e){this.currentSerializedContext=e.serializedContext??this.currentSerializedContext,this.currentSessionState=e.sessionState??this.currentSessionState}};export{SessionStateCursor};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{cancelSessionTimeoutStep,startSessionTimeoutStep}from"#execution/session-timeout-steps.js";function createSessionTimeoutControl(e){let t;return{async dispose(){if(t===void 0)return;let e=t;t=void 0,await cancelSessionTimeoutStep({runId:e.runId})},async start(){t===void 0&&(t=await startSessionTimeoutStep(e))}}}export{createSessionTimeoutControl};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{walkCauseChain}from"#shared/errors.js";import{sessionTimeoutWorkflowReference,startWorkflowOnCurrentDeployment}from"#execution/workflow-runtime.js";import{cancelRun,getWorld}from"#internal/workflow/runtime.js";import{EntityConflictError,HookNotFoundError,RunExpiredError,WorkflowRunNotFoundError}from"#compiled/@workflow/errors/index.js";import{resumeSessionInbox}from"#execution/wire/session-inbox-resume.js";async function startSessionTimeoutStep(e){"use step";return{runId:(await startWorkflowOnCurrentDeployment(sessionTimeoutWorkflowReference,[e])).runId}}async function signalSessionTimeoutStep(e){"use step";try{await resumeSessionInbox(e.token,{kind:`session-timeout`})}catch(e){if(!isInactiveTimeoutTarget(e))throw e}}async function cancelSessionTimeoutStep(e){"use step";try{await cancelRun(await getWorld(),e.runId,{cancelReason:`Session ended before its timeout`})}catch(e){if(!isInactiveTimeoutTarget(e))throw e}}function isInactiveTimeoutTarget(e){for(let t of walkCauseChain(e))if(HookNotFoundError.is(t)||WorkflowRunNotFoundError.is(t)||RunExpiredError.is(t)||EntityConflictError.is(t))return!0;return!1}export{cancelSessionTimeoutStep,signalSessionTimeoutStep,startSessionTimeoutStep};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{sleep}from"#compiled/@workflow/core/index.js";import{signalSessionTimeoutStep}from"#execution/session-timeout-steps.js";async function sessionTimeoutWorkflow(e){"use workflow";await sleep(e.deadline),await signalSessionTimeoutStep({token:e.token})}sessionTimeoutWorkflow.workflowId=`workflow//eve//sessionTimeoutWorkflow`;export{sessionTimeoutWorkflow};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
const DEFAULT_SESSION_TIMEOUT_MS=2592e6;export{DEFAULT_SESSION_TIMEOUT_MS};
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import { type TurnCancelPayload } from "#execution/turn-cancellation-token.js";
|
|
2
|
-
/**
|
|
3
|
-
* Owns one turn's cancellation surface inside the turn workflow: the
|
|
4
|
-
* turn-private cancel hook and the durable `AbortController` whose
|
|
5
|
-
* signal is serialized into every `turnStep`. Must be created inside a
|
|
6
|
-
* `"use workflow"` body.
|
|
7
|
-
*/
|
|
8
|
-
export interface TurnCancellationControl {
|
|
9
|
-
/** Turn signal to serialize into each `turnStep` input. */
|
|
10
|
-
readonly signal: AbortSignal;
|
|
11
|
-
/**
|
|
12
|
-
* Resolves `"cancel"` once a matching cancel payload is consumed and
|
|
13
|
-
* the signal aborted. Race it against turn-owned awaits — never
|
|
14
|
-
* `await` it alone.
|
|
15
|
-
*/
|
|
16
|
-
readonly payload: Promise<TurnCancelPayload>;
|
|
17
|
-
readonly requested: Promise<"cancel">;
|
|
18
|
-
/** Disposes the hook, abandoning any outstanding read. Idempotent. */
|
|
19
|
-
dispose(): Promise<void>;
|
|
20
|
-
}
|
|
21
|
-
/**
|
|
22
|
-
* Creates and claims the private cancel hook for one turn workflow run.
|
|
23
|
-
* Returns `undefined` when the token is still claimed by a crashed prior
|
|
24
|
-
* run — the turn then runs uncancellable rather than failing.
|
|
25
|
-
*/
|
|
26
|
-
export declare function createTurnCancellationControl(input: {
|
|
27
|
-
readonly controlToken: string;
|
|
28
|
-
readonly expectedTurnId: string;
|
|
29
|
-
readonly initialPayload?: TurnCancelPayload;
|
|
30
|
-
}): Promise<TurnCancellationControl | undefined>;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{createHook}from"#compiled/@workflow/core/index.js";import{claimHookOwnership,disposeHook,isHookConflictError}from"#execution/hook-ownership.js";import{TurnCancelledError}from"#harness/turn-cancellation.js";import{turnCancellationHookToken}from"#execution/turn-cancellation-token.js";async function createTurnCancellationControl(e){let t=createHook({token:turnCancellationHookToken(e.controlToken)}),n=t[Symbol.asyncIterator]();try{await claimHookOwnership(t)}catch(e){if(isHookConflictError(e))return;throw e}let r=new AbortController,abort=()=>r.abort(new TurnCancelledError),i=e.initialPayload!==void 0&&matchesActiveTurn(e.initialPayload,e.expectedTurnId);i&&abort();let a=i?Promise.resolve(e.initialPayload):consumeMatchingCancel(n,e.expectedTurnId,abort),o=!1;return{payload:a,signal:r.signal,requested:a.then(()=>`cancel`),async dispose(){o||(o=!0,await disposeHook(t))}}}async function consumeMatchingCancel(e,t,n){for(;;){let r=await e.next();if(r.done)return await new Promise(()=>{});if(matchesActiveTurn(r.value,t))return n(),r.value}}function matchesActiveTurn(e,t){if(typeof e!=`object`||!e)return!0;let n=e.turnId;return n===void 0||n===t}export{createTurnCancellationControl};
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
/** Derives the private cancellation hook token for one dispatched turn. */
|
|
2
|
-
export declare function turnCancellationHookToken(controlToken: string): string;
|
|
3
|
-
/**
|
|
4
|
-
* Payload accepted by the private turn cancel hook. A mismatched `turnId` is a
|
|
5
|
-
* benign no-op; omitting it targets whichever turn owns the hook.
|
|
6
|
-
*/
|
|
7
|
-
export interface TurnCancelPayload {
|
|
8
|
-
readonly tasks?: boolean;
|
|
9
|
-
readonly turnId?: string;
|
|
10
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
function turnCancellationHookToken(e){return`${e}:cancel`}export{turnCancellationHookToken};
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import type { DeliverHookPayload, HookPayload } from "#channel/types.js";
|
|
2
|
-
import type { NextDriverAction } from "#execution/next-driver-action.js";
|
|
3
|
-
/** Payloads delivered to the private inbox owned by one active turn. */
|
|
4
|
-
export type TurnInboxPayload = Exclude<HookPayload, DeliverHookPayload> | {
|
|
5
|
-
readonly delivery: DeliverHookPayload;
|
|
6
|
-
readonly kind: "driver-delivery";
|
|
7
|
-
readonly requestId: string;
|
|
8
|
-
};
|
|
9
|
-
/** Control payloads emitted from an active turn to its session driver. */
|
|
10
|
-
export type TurnControlPayload = {
|
|
11
|
-
readonly action: NextDriverAction;
|
|
12
|
-
readonly bufferedDeliveries?: readonly DeliverHookPayload[];
|
|
13
|
-
readonly kind: "turn-result";
|
|
14
|
-
} | {
|
|
15
|
-
readonly kind: "turn-error";
|
|
16
|
-
readonly error: unknown;
|
|
17
|
-
} | {
|
|
18
|
-
readonly continuationToken: string;
|
|
19
|
-
readonly kind: "turn-continuation-token";
|
|
20
|
-
} | {
|
|
21
|
-
readonly continuationToken: string;
|
|
22
|
-
readonly inboxToken: string;
|
|
23
|
-
readonly kind: "turn-delivery-request";
|
|
24
|
-
readonly requestId: string;
|
|
25
|
-
} | {
|
|
26
|
-
readonly kind: "turn-delivery-accepted";
|
|
27
|
-
readonly requestId: string;
|
|
28
|
-
} | {
|
|
29
|
-
readonly kind: "turn-delivery-cancelled";
|
|
30
|
-
readonly requestId: string;
|
|
31
|
-
};
|
|
32
|
-
/** Sends one lifecycle payload to the session driver's control hook. */
|
|
33
|
-
export declare function sendTurnControlStep(input: {
|
|
34
|
-
readonly controlToken: string;
|
|
35
|
-
readonly payload: TurnControlPayload;
|
|
36
|
-
}): Promise<void>;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{resumeHook}from"#internal/workflow/runtime.js";import{HookNotFoundError}from"#compiled/@workflow/errors/index.js";async function sendTurnControlStep(e){"use step";try{await resumeHook(e.controlToken,e.payload)}catch(e){if(!HookNotFoundError.is(e))throw e}}export{sendTurnControlStep};
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
import type { DeliverHookPayload } from "#channel/types.js";
|
|
2
|
-
import type { NextDriverAction } from "#execution/next-driver-action.js";
|
|
3
|
-
import type { SessionCommandInbox } from "#execution/session-command-inbox.js";
|
|
4
|
-
import type { SessionStateCursor } from "#execution/session-state-cursor.js";
|
|
5
|
-
export type TurnDriverAction = NextDriverAction;
|
|
6
|
-
/** Owns one turn's driver-side control hook and public-delivery relay state. */
|
|
7
|
-
export declare class TurnControlReceiver {
|
|
8
|
-
private readonly bufferedDeliveries;
|
|
9
|
-
private readonly bufferedSessionControls;
|
|
10
|
-
private readonly commandInbox;
|
|
11
|
-
private readonly control;
|
|
12
|
-
private readonly controlIterator;
|
|
13
|
-
private readonly expectedTurnId;
|
|
14
|
-
private readonly cancelledTaskIds;
|
|
15
|
-
private readonly seenTaskDeliveries;
|
|
16
|
-
private readonly stateCursor;
|
|
17
|
-
private pendingControl;
|
|
18
|
-
constructor(input: {
|
|
19
|
-
readonly bufferedDeliveries: DeliverHookPayload[];
|
|
20
|
-
readonly bufferedSessionControls: Array<"clear" | "compact" | "expired" | "reset">;
|
|
21
|
-
readonly cancelledTaskIds?: Set<string>;
|
|
22
|
-
readonly commandInbox: SessionCommandInbox;
|
|
23
|
-
readonly expectedTurnId: string;
|
|
24
|
-
readonly seenTaskDeliveries?: Set<string>;
|
|
25
|
-
readonly stateCursor: SessionStateCursor;
|
|
26
|
-
readonly token: string;
|
|
27
|
-
});
|
|
28
|
-
/** Token passed to the turn workflow so it can publish control messages. */
|
|
29
|
-
get token(): string;
|
|
30
|
-
/** Releases the turn control hook and its iterator. */
|
|
31
|
-
dispose(): Promise<void>;
|
|
32
|
-
/** Services control messages until the active turn returns its terminal driver action. */
|
|
33
|
-
waitForAction(): Promise<TurnDriverAction>;
|
|
34
|
-
private handleSessionCommand;
|
|
35
|
-
private bufferDelivery;
|
|
36
|
-
private bufferTurnDeliveries;
|
|
37
|
-
private consumeControl;
|
|
38
|
-
private getControlPromise;
|
|
39
|
-
private nextControlOrCommand;
|
|
40
|
-
private readTerminalControl;
|
|
41
|
-
private serviceDeliveryRequest;
|
|
42
|
-
private takeInputResponseDelivery;
|
|
43
|
-
/**
|
|
44
|
-
* Waits for the active turn to resolve a forwarded delivery. The turn either
|
|
45
|
-
* accepts it (consumed) or releases it on cancellation or termination, in
|
|
46
|
-
* which case the delivery returns behind remainders from earlier deliveries
|
|
47
|
-
* accepted by the turn and ahead of deliveries that arrived later.
|
|
48
|
-
*/
|
|
49
|
-
private awaitForwardedDelivery;
|
|
50
|
-
private acceptTaskDelivery;
|
|
51
|
-
private discardTaskDeliveries;
|
|
52
|
-
private originatesFromCancelledTask;
|
|
53
|
-
private shouldDiscard;
|
|
54
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{createHook}from"#compiled/@workflow/core/index.js";import{closeHookIterator,disposeHook}from"#execution/hook-ownership.js";import{cancelAllIndexedSessionTasksStep}from"#execution/cancel-indexed-session-tasks-step.js";import{reportDroppedWirePayloadStep}from"#execution/report-dropped-wire-payload-step.js";import{SessionInboxWireError,sessionInboxWire}from"#execution/wire/session-inbox-wire.js";import{rebuildSerializableError}from"#execution/workflow-errors.js";import{turnCancellationHookToken}from"#execution/turn-cancellation-token.js";import{forwardTurnCancellationStep}from"#execution/forward-turn-cancellation-step.js";import{forwardTurnDeliveryStep}from"#execution/forward-turn-delivery-step.js";var TurnControlReceiver=class{bufferedDeliveries;bufferedSessionControls;commandInbox;control;controlIterator;expectedTurnId;cancelledTaskIds;seenTaskDeliveries;stateCursor;pendingControl=null;constructor(e){this.bufferedDeliveries=e.bufferedDeliveries,this.bufferedSessionControls=e.bufferedSessionControls,this.cancelledTaskIds=e.cancelledTaskIds??new Set,this.commandInbox=e.commandInbox,this.seenTaskDeliveries=e.seenTaskDeliveries??new Set,this.stateCursor=e.stateCursor,this.control=createHook({token:e.token}),this.controlIterator=this.control[Symbol.asyncIterator](),this.expectedTurnId=e.expectedTurnId}get token(){return this.control.token}async dispose(){await closeHookIterator(this.controlIterator),await disposeHook(this.control)}async waitForAction(){for(;;){let e=await this.nextControlOrCommand();if(e.kind===`command`){let t=await this.handleSessionCommand(e.command);if(t!==void 0)return t;continue}let t=e.payload,n=this.readTerminalControl(t);if(n!==void 0)return n;if(t.kind===`turn-delivery-request`){let e=await this.serviceDeliveryRequest(t);if(e!==void 0)return e}}}async handleSessionCommand(e){if(e.kind===`deliver`){if(!this.acceptTaskDelivery(e))return;await this.bufferDelivery(e);return}if(e.kind===`clear`||e.kind===`compact`){this.bufferedSessionControls.push(e.kind);return}if(e.kind===`session-timeout`){this.bufferedSessionControls.push(`expired`);return}if(e.kind===`cancel`){`tasks`in e&&e.tasks===!0&&await cancelAllIndexedSessionTasksStep({serializedContext:this.stateCursor.serializedContext,sessionState:this.stateCursor.sessionState}),e.taskId!==void 0&&this.discardTaskDeliveries(e.taskId);let t=e.taskId!==void 0&&e.turnId!==void 0&&e.turnId!==this.expectedTurnId?void 0:e.turnId,n={tasks:e.tasks};t!==void 0&&(n.turnId=t),await forwardTurnCancellationStep({payload:n,token:turnCancellationHookToken(this.control.token)});return}if(e.kind===`reset`){await forwardTurnCancellationStep({payload:{},token:turnCancellationHookToken(this.control.token)}),this.bufferedSessionControls.push(`reset`);return}return unsupportedSessionCommand(e)}async bufferDelivery(e){this.bufferedDeliveries.push(e),e.turnPolicy===`steer`&&deliveryHasMessage(e)&&await forwardTurnCancellationStep({payload:{},token:turnCancellationHookToken(this.control.token)})}bufferTurnDeliveries(e){e.bufferedDeliveries!==void 0&&this.bufferedDeliveries.unshift(...e.bufferedDeliveries.filter(e=>!this.shouldDiscard(e)))}consumeControl(){this.pendingControl=null}getControlPromise(){return this.pendingControl??=this.controlIterator.next(),this.pendingControl}async nextControlOrCommand(){let e=await Promise.race([this.getControlPromise().then(e=>({kind:`control`,value:e})),this.commandInbox.next().then(e=>({kind:`command`,value:e}))]);if(e.kind===`command`){if(e.value.done)throw Error(`Session command inbox closed before the active turn settled.`);if(this.commandInbox.consumeNext(),e.value.value.kind===`runtime-action-result`)return await this.nextControlOrCommand();try{return{command:sessionInboxWire.decode(e.value.value),kind:`command`}}catch(e){if(!(e instanceof SessionInboxWireError))throw e;return await reportDroppedWirePayloadStep({detail:e.message,family:`session-inbox`}),await this.nextControlOrCommand()}}if(this.consumeControl(),e.value.done)throw Error(`Turn control hook closed before delivering a result.`);let t=e.value.value;if(t.kind===`turn-error`)throw rebuildSerializableError(t.error);return t.kind===`turn-continuation-token`?(await this.commandInbox.rekeyContinuation(t.continuationToken),await this.nextControlOrCommand()):{kind:`control`,payload:t}}readTerminalControl(e){if(e.kind===`turn-error`)throw rebuildSerializableError(e.error);if(e.kind===`turn-result`)return this.bufferTurnDeliveries(e),e.action}async serviceDeliveryRequest(e){await this.commandInbox.rekeyContinuation(e.continuationToken);let t=this.takeInputResponseDelivery();for(;t===void 0;){let n=await Promise.race([this.getControlPromise().then(e=>({kind:`control`,value:e})),this.commandInbox.next().then(e=>({kind:`command`,value:e}))]);if(n.kind===`control`){if(this.consumeControl(),n.value.done)throw Error(`Turn control hook closed during a delivery request.`);if(n.value.value.kind===`turn-continuation-token`){await this.commandInbox.rekeyContinuation(n.value.value.continuationToken);continue}let t=this.readTerminalControl(n.value.value);if(t!==void 0)return t;if(n.value.value.kind===`turn-delivery-cancelled`&&n.value.value.requestId===e.requestId)return;continue}if(n.value.done)throw Error(`Session command inbox closed during a turn delivery request.`);if(this.commandInbox.consumeNext(),n.value.value.kind===`runtime-action-result`)continue;let r;try{r=sessionInboxWire.decode(n.value.value)}catch(e){if(!(e instanceof SessionInboxWireError))throw e;await reportDroppedWirePayloadStep({detail:e.message,family:`session-inbox`});continue}if(r.kind===`deliver`){if(!this.acceptTaskDelivery(r))continue;deliveryHasMessage(r)?await this.bufferDelivery(r):t=r;continue}let i=await this.handleSessionCommand(r);if(i!==void 0)return i}try{await forwardTurnDeliveryStep({inboxToken:e.inboxToken,payload:{delivery:t,kind:`driver-delivery`,requestId:e.requestId}})}catch(e){if(!(e instanceof Error&&e.name===`HookNotFoundError`))throw e}return await this.awaitForwardedDelivery(e.requestId,t)}takeInputResponseDelivery(){let e=this.bufferedDeliveries.findIndex(e=>!deliveryHasMessage(e));if(e!==-1)return this.bufferedDeliveries.splice(e,1)[0]}async awaitForwardedDelivery(e,t){for(;;){let n=await this.nextControlOrCommand();if(n.kind===`command`){let e=await this.handleSessionCommand(n.command);if(e!==void 0)return this.shouldDiscard(t)||this.bufferedDeliveries.unshift(t),e;continue}let r=n.payload;if(r.kind===`turn-delivery-accepted`){if(r.requestId===e)return;continue}if(r.kind===`turn-delivery-cancelled`&&r.requestId===e){this.shouldDiscard(t)||this.bufferedDeliveries.unshift(t);return}r.kind===`turn-result`&&(this.shouldDiscard(t)||this.bufferedDeliveries.unshift(t));let i=this.readTerminalControl(r);if(i!==void 0)return i}}acceptTaskDelivery(e){let t=e.taskDeliveryId??e.caller?.taskId;return t===void 0?!0:this.originatesFromCancelledTask(t)||this.seenTaskDeliveries.has(t)?!1:(this.seenTaskDeliveries.add(t),!0)}discardTaskDeliveries(e){this.cancelledTaskIds.add(e);let t=this.bufferedDeliveries.filter(e=>!this.shouldDiscard(e));this.bufferedDeliveries.splice(0,this.bufferedDeliveries.length,...t)}originatesFromCancelledTask(e){return[...this.cancelledTaskIds].some(t=>deliveryOriginatesFromTask(e,t))}shouldDiscard(e){let t=e.taskDeliveryId??e.caller?.taskId;return t!==void 0&&this.originatesFromCancelledTask(t)}};function deliveryOriginatesFromTask(e,t){return e===t||e.startsWith(`${t}:`)}function deliveryHasMessage(e){return e.payloads.some(e=>e.message!==void 0)}function unsupportedSessionCommand(e){throw Error(`Unsupported session command: ${JSON.stringify(e)}`)}export{TurnControlReceiver};
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import type { DeliverHookPayload, HookPayload, SessionCapabilities } from "#channel/types.js";
|
|
2
|
-
import type { DurableSessionState } from "#execution/durable-session-store.js";
|
|
3
|
-
import type { SessionCommandInbox } from "#execution/session-command-inbox.js";
|
|
4
|
-
import { SessionStateCursor } from "#execution/session-state-cursor.js";
|
|
5
|
-
import type { TurnDriverAction } from "#execution/turn-control-receiver.js";
|
|
6
|
-
import type { AgentWorkflowRetentionDefinition } from "#shared/agent-definition.js";
|
|
7
|
-
import type { RunMode } from "#shared/run-mode.js";
|
|
8
|
-
/** One settled turn: its terminal driver action plus deferred hook cleanup. */
|
|
9
|
-
export interface DispatchedTurn {
|
|
10
|
-
readonly action: TurnDriverAction;
|
|
11
|
-
/**
|
|
12
|
-
* Disposes the turn's control hook. Deferred until the *next* turn
|
|
13
|
-
* settles (or the session ends): the turn run's final control send is
|
|
14
|
-
* at-least-once, and `sendTurnControlStep` does not treat
|
|
15
|
-
* `HookNotFoundError` as benign, so a late duplicate resume must land
|
|
16
|
-
* on a live hook. By the next settle, the previous run has completed
|
|
17
|
-
* and can no longer re-send.
|
|
18
|
-
*/
|
|
19
|
-
dispose(): Promise<void>;
|
|
20
|
-
}
|
|
21
|
-
/** Dispatches one turn and services its private-inbox control protocol until it terminates. */
|
|
22
|
-
interface TurnDispatchInput {
|
|
23
|
-
readonly bufferedDeliveries: DeliverHookPayload[];
|
|
24
|
-
readonly bufferedSessionControls: Array<"clear" | "compact" | "expired" | "reset">;
|
|
25
|
-
readonly capabilities?: SessionCapabilities;
|
|
26
|
-
readonly cancelledTaskIds?: Set<string>;
|
|
27
|
-
readonly controlToken: string;
|
|
28
|
-
readonly delivery: HookPayload;
|
|
29
|
-
readonly commandInbox: SessionCommandInbox;
|
|
30
|
-
readonly mode: RunMode;
|
|
31
|
-
readonly parentWritable: WritableStream<Uint8Array>;
|
|
32
|
-
readonly retention?: AgentWorkflowRetentionDefinition;
|
|
33
|
-
readonly serializedContext: Record<string, unknown>;
|
|
34
|
-
readonly seenTaskDeliveries?: Set<string>;
|
|
35
|
-
readonly sessionState: DurableSessionState;
|
|
36
|
-
readonly stateCursor?: SessionStateCursor;
|
|
37
|
-
}
|
|
38
|
-
export declare function dispatchAndAwaitTurn(input: TurnDispatchInput): Promise<DispatchedTurn>;
|
|
39
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{activeTurnId}from"#harness/active-turn-id.js";import{createTurnWorkflowInput}from"#execution/durable-session-migrations/turn-workflow.js";import{SessionStateCursor}from"#execution/session-state-cursor.js";import{dispatchTurnStep}from"#execution/dispatch-turn-step.js";import{TurnControlReceiver}from"#execution/turn-control-receiver.js";import{runInlineTurn}from"#execution/inline-turn.js";import{runTurnOwnedWorkflow}from"#execution/turn-workflow.js";async function dispatchAndAwaitTurn(e){let t=e.stateCursor??new SessionStateCursor({serializedContext:e.serializedContext,sessionState:e.sessionState}),n=await runInlineTurn({...e,stateCursor:t});return n.kind===`result`?{action:n.action,async dispose(){}}:await runAndAwaitTurn({...e,inline:n.kind===`continue`,initialCancellation:n.initialCancellation,stateCursor:t,initialStep:n.initialStep})}async function runAndAwaitTurn(e){let t=new TurnControlReceiver({bufferedDeliveries:e.bufferedDeliveries,bufferedSessionControls:e.bufferedSessionControls,cancelledTaskIds:e.cancelledTaskIds,commandInbox:e.commandInbox,expectedTurnId:activeTurnId(e.sessionState.emissionState),seenTaskDeliveries:e.seenTaskDeliveries??new Set,stateCursor:e.stateCursor,token:e.controlToken});try{let n={capabilities:e.capabilities,completionToken:t.token,delivery:e.delivery,initialCancellation:e.initialCancellation,initialStep:e.initialStep,mode:e.mode,parentWritable:e.parentWritable,retention:e.retention,serializedContext:e.serializedContext,sessionState:e.sessionState},r;if(e.inline){let e=Promise.withResolvers();[r]=await Promise.all([e.promise.then(()=>t.waitForAction()),runTurnOwnedWorkflow(createTurnWorkflowInput(n),e.resolve)])}else await dispatchTurnStep(n),r=await t.waitForAction();return{action:r,dispose:()=>t.dispose()}}catch(e){throw await t.dispose(),e}}export{dispatchAndAwaitTurn};
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
import type { DeliverHookPayload } from "#channel/types.js";
|
|
2
|
-
import type { TurnControlPayload } from "#execution/turn-control-protocol.js";
|
|
3
|
-
import type { DurableSessionState } from "#execution/durable-session-store.js";
|
|
4
|
-
import type { TurnStepInput, TurnStepPayload } from "#execution/durable-session-migrations/turn-workflow.js";
|
|
5
|
-
import { SessionStateCursor } from "#execution/session-state-cursor.js";
|
|
6
|
-
import type { SettledTurn } from "#harness/types.js";
|
|
7
|
-
import type { TokenUsage } from "#shared/token-usage.js";
|
|
8
|
-
interface TurnTransition {
|
|
9
|
-
readonly serializedContext?: Record<string, unknown>;
|
|
10
|
-
readonly sessionState: DurableSessionState;
|
|
11
|
-
}
|
|
12
|
-
type TurnTerminalAction = {
|
|
13
|
-
readonly isError?: boolean;
|
|
14
|
-
readonly kind: "done";
|
|
15
|
-
readonly output: unknown;
|
|
16
|
-
readonly usage?: TokenUsage;
|
|
17
|
-
readonly usageDelta?: TokenUsage;
|
|
18
|
-
} | {
|
|
19
|
-
readonly authorizationAttemptIds?: readonly string[];
|
|
20
|
-
readonly authorizationNames?: readonly string[];
|
|
21
|
-
readonly cancelled?: true;
|
|
22
|
-
readonly kind: "park";
|
|
23
|
-
readonly settled?: SettledTurn;
|
|
24
|
-
};
|
|
25
|
-
/** Owns the mutable durable state cursor for one active turn workflow. */
|
|
26
|
-
export declare class TurnExecutionCursor extends SessionStateCursor {
|
|
27
|
-
readonly controlToken: string;
|
|
28
|
-
readonly parentWritable: WritableStream<Uint8Array>;
|
|
29
|
-
private lastReportedContinuationToken;
|
|
30
|
-
constructor(input: {
|
|
31
|
-
readonly controlToken: string;
|
|
32
|
-
readonly parentWritable: WritableStream<Uint8Array>;
|
|
33
|
-
readonly serializedContext: Record<string, unknown>;
|
|
34
|
-
readonly sessionState: DurableSessionState;
|
|
35
|
-
});
|
|
36
|
-
/** Adopts a state transition and reports any continuation-token change once. */
|
|
37
|
-
adopt(transition: TurnTransition): Promise<void>;
|
|
38
|
-
/** Builds the next atomic turn-step input from the cursor's current state. */
|
|
39
|
-
createStepInput(input: TurnStepPayload | undefined, abortSignal?: AbortSignal): TurnStepInput;
|
|
40
|
-
/**
|
|
41
|
-
* Adopts a terminal turn transition and publishes it as the turn result.
|
|
42
|
-
* The result already carries the final session state, so no separate
|
|
43
|
-
* continuation-token update is sent.
|
|
44
|
-
*/
|
|
45
|
-
finish(transition: TurnTransition, action: TurnTerminalAction, bufferedDeliveries: readonly DeliverHookPayload[]): Promise<void>;
|
|
46
|
-
/** Sends one control payload to the session driver. */
|
|
47
|
-
send(payload: TurnControlPayload): Promise<void>;
|
|
48
|
-
}
|
|
49
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{SessionStateCursor}from"#execution/session-state-cursor.js";import{sendTurnControlStep}from"#execution/turn-control-protocol.js";var TurnExecutionCursor=class extends SessionStateCursor{controlToken;parentWritable;lastReportedContinuationToken;constructor(e){super({serializedContext:e.serializedContext,sessionState:e.sessionState}),this.controlToken=e.controlToken,this.lastReportedContinuationToken=e.sessionState.continuationToken,this.parentWritable=e.parentWritable}async adopt(e){this.adoptState(e);let t=e.sessionState.continuationToken;t!==``&&t!==this.lastReportedContinuationToken&&(this.lastReportedContinuationToken=t,await this.send({continuationToken:t,kind:`turn-continuation-token`}))}createStepInput(e,t){return{abortSignal:t,input:e,parentWritable:this.parentWritable,serializedContext:this.serializedContext,sessionState:this.sessionState}}async finish(e,t,n){this.adoptState(e),await this.send({action:{...t,serializedContext:this.serializedContext,sessionState:this.sessionState},bufferedDeliveries:n.length===0?void 0:[...n],kind:`turn-result`})}async send(e){await sendTurnControlStep({controlToken:this.controlToken,payload:e})}};export{TurnExecutionCursor};
|