eve 0.81.1 → 0.83.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 +93 -0
- package/NOTICE +1 -1
- package/dist/src/channel/channel-address.d.ts +21 -2
- package/dist/src/channel/channel-address.js +1 -1
- package/dist/src/channel/channel-operations.d.ts +32 -1
- package/dist/src/channel/channel-operations.js +1 -1
- package/dist/src/channel/delivery-idempotency.d.ts +4 -0
- package/dist/src/channel/delivery-idempotency.js +1 -0
- package/dist/src/channel/pending-authorization.d.ts +5 -0
- package/dist/src/channel/pending-authorization.js +1 -1
- package/dist/src/channel/routes.d.ts +6 -0
- package/dist/src/channel/session.d.ts +7 -0
- package/dist/src/channel/session.js +1 -1
- package/dist/src/channel/types.d.ts +19 -11
- package/dist/src/chunks/{use-eve-agent-DLkjJIm3.js → use-eve-agent-3-WRmJkd.js} +76 -5
- package/dist/src/chunks/{use-eve-agent-Bp6nbhfV.js → use-eve-agent-Ci5dr0aR.js} +76 -5
- package/dist/src/cli/dev/command-options.d.ts +1 -0
- package/dist/src/cli/dev/diagnostic-dump.js +1 -1
- package/dist/src/cli/dev/local-server-child.js +1 -1
- package/dist/src/cli/dev/local-server-cleanup.js +1 -1
- package/dist/src/cli/dev/tui/question-panel.d.ts +4 -1
- package/dist/src/cli/dev/tui/question-panel.js +1 -1
- package/dist/src/cli/dev/tui/terminal-renderer.js +4 -4
- package/dist/src/cli/run.d.ts +1 -0
- package/dist/src/cli/run.js +1 -1
- package/dist/src/client/eve-agent-store.d.ts +1 -1
- package/dist/src/client/eve-agent-store.js +1 -1
- package/dist/src/client/index.d.ts +2 -1
- package/dist/src/client/message-reducer-types.d.ts +7 -3
- package/dist/src/client/message-reducer.js +1 -1
- package/dist/src/client/session-controls.d.ts +6 -0
- package/dist/src/client/session-controls.js +1 -1
- package/dist/src/client/session.d.ts +4 -0
- package/dist/src/client/session.js +1 -1
- package/dist/src/client/transcript-reducer.d.ts +6 -3
- package/dist/src/client/transcript-reducer.js +1 -1
- package/dist/src/compiled/.vendor-stamp.json +8 -8
- package/dist/src/compiled/@eve/catalog/index.js +1 -1
- package/dist/src/compiled/@workflow/core/events-consumer.d.ts +2 -0
- package/dist/src/compiled/@workflow/core/index.js +2 -2
- package/dist/src/compiled/@workflow/core/private.d.ts +5 -3
- package/dist/src/compiled/@workflow/core/private.js +1 -1
- package/dist/src/compiled/@workflow/core/runtime/constants.d.ts +1 -37
- package/dist/src/compiled/@workflow/core/runtime/event-limit-warning.d.ts +32 -0
- package/dist/src/compiled/@workflow/core/runtime/helpers.d.ts +5 -6
- package/dist/src/compiled/@workflow/core/runtime/helpers.js +1 -1
- package/dist/src/compiled/@workflow/core/runtime/runs.d.ts +8 -0
- package/dist/src/compiled/@workflow/core/runtime/start.d.ts +16 -0
- package/dist/src/compiled/@workflow/core/runtime/suspension-handler.d.ts +15 -18
- package/dist/src/compiled/@workflow/core/runtime/vm-mode.d.ts +20 -0
- package/dist/src/compiled/@workflow/core/runtime.js +4 -4
- package/dist/src/compiled/@workflow/core/seeded-nanoid.d.ts +2 -0
- package/dist/src/compiled/@workflow/core/serialization/compression.d.ts +14 -3
- package/dist/src/compiled/@workflow/core/serialization.d.ts +1 -1
- package/dist/src/compiled/@workflow/core/serialization.js +1 -1
- package/dist/src/compiled/@workflow/core/telemetry/semantic-conventions.d.ts +0 -18
- package/dist/src/compiled/@workflow/core/version.d.ts +1 -1
- package/dist/src/compiled/@workflow/core/workflow.js +1 -1
- package/dist/src/compiled/@workflow/errors/index.d.ts +48 -0
- package/dist/src/compiled/@workflow/errors/index.js +1 -1
- package/dist/src/compiled/@workflow/world/env-config.d.ts +24 -0
- package/dist/src/compiled/@workflow/world/events.d.ts +126 -7
- package/dist/src/compiled/@workflow/world/index.d.ts +3 -3
- package/dist/src/compiled/@workflow/world/interfaces.d.ts +59 -8
- package/dist/src/compiled/@workflow/world/queue.d.ts +71 -9
- package/dist/src/compiled/@workflow/world/recovery.d.ts +6 -0
- package/dist/src/compiled/@workflow/world/test-support/duplicate-event-fixtures.d.ts +3 -0
- package/dist/src/compiled/@workflow/world/test-support/in-band-fence-conformance.d.ts +46 -0
- package/dist/src/compiled/@workflow/world-local/index.js +5 -5
- package/dist/src/compiled/@workflow/world-vercel/index.js +18 -18
- package/dist/src/compiled/_chunks/workflow/{attribute-changes-BW-kbMMn.js → attribute-changes-7se_SE2q.js} +3 -3
- package/dist/src/compiled/_chunks/workflow/dist-CcnNPAp4.js +1 -0
- package/dist/src/compiled/_chunks/workflow/dist-S9cZRway.js +3 -0
- package/dist/src/compiled/_chunks/workflow/helpers-CxNRXH0a.js +1 -0
- package/dist/src/compiled/_chunks/workflow/private-DLYTSBbu.js +1 -0
- package/dist/src/compiled/_chunks/workflow/resume-hook-CPiIfe8r.js +1 -0
- package/dist/src/compiled/_chunks/workflow/{run-DzdAqdb1.js → run-BJSLCXR4.js} +6 -6
- package/dist/src/compiled/_chunks/workflow/serialization-B9gneT9Z.js +15 -0
- package/dist/src/compiled/_chunks/workflow/sleep-BL0oQs3R.js +1 -0
- package/dist/src/compiled/_chunks/workflow/{wait-until-xbRRDuUf.js → wait-until-BPou0RGO.js} +1 -1
- package/dist/src/compiled/_chunks/workflow/workflow-routes-BaljomCk.js +1 -0
- package/dist/src/compiled/{@ai-sdk/code-mode → run}/LICENSE +1 -1
- package/dist/src/compiled/run/index.d.ts +384 -0
- package/dist/src/compiled/run/index.js +650 -0
- package/dist/src/compiler/extension-compatibility.d.ts +28 -20
- package/dist/src/compiler/extension-compatibility.js +1 -1
- package/dist/src/compiler/load-binding-namespace.d.ts +2 -0
- package/dist/src/compiler/load-binding-namespace.js +1 -1
- package/dist/src/compiler/manifest.js +1 -1
- package/dist/src/compiler/module-lifecycle.d.ts +1 -1
- package/dist/src/compiler/module-lifecycle.js +1 -1
- package/dist/src/compiler/module-map.js +1 -1
- package/dist/src/compiler/normalize-agent-config.js +1 -1
- package/dist/src/compiler/normalize-manifest.js +1 -1
- package/dist/src/compiler/normalize-sandbox.js +1 -1
- package/dist/src/compiler/project-sources.d.ts +6 -0
- package/dist/src/compiler/project-sources.js +1 -1
- package/dist/src/compiler/workspace-resources.js +1 -1
- package/dist/src/context/build-callback-context.js +1 -1
- package/dist/src/context/dynamic-skill-lifecycle.js +1 -1
- package/dist/src/context/keys.d.ts +2 -0
- package/dist/src/context/keys.js +1 -1
- package/dist/src/context/providers/sandbox.js +1 -1
- package/dist/src/discover/extension-specifier.d.ts +1 -0
- package/dist/src/discover/extension-specifier.js +1 -1
- package/dist/src/evals/cli/eval-state-directory.d.ts +7 -0
- package/dist/src/evals/cli/eval-state-directory.js +1 -0
- package/dist/src/evals/cli/eval.js +2 -2
- package/dist/src/evals/runner/artifacts.js +1 -1
- package/dist/src/evals/runner/derive-run-facts.d.ts +12 -0
- package/dist/src/evals/runner/derive-run-facts.js +1 -1
- package/dist/src/evals/runner/execute-task.js +1 -1
- package/dist/src/evals/types.d.ts +3 -2
- package/dist/src/eve-channel/index.js +1 -1
- package/dist/src/eve-channel/request.d.ts +0 -1
- package/dist/src/eve-channel/request.js +2 -2
- package/dist/src/eve-channel/support.d.ts +2 -0
- package/dist/src/eve-channel/support.js +1 -1
- package/dist/src/eve-channel/types.d.ts +7 -0
- package/dist/src/execution/agent-sessions/context.d.ts +3 -14
- package/dist/src/execution/agent-sessions/context.js +1 -1
- package/dist/src/execution/agent-sessions/runtime-overrides.d.ts +5 -0
- package/dist/src/execution/agent-sessions/session.d.ts +2 -2
- package/dist/src/execution/agent-sessions/session.js +1 -1
- package/dist/src/execution/agent-sessions/steps.d.ts +2 -0
- package/dist/src/execution/agent-sessions/steps.js +1 -1
- package/dist/src/execution/coordination-dispatch-shared.d.ts +8 -5
- package/dist/src/execution/coordination-dispatch-shared.js +1 -1
- package/dist/src/execution/coordination-dispatch-step.d.ts +17 -2
- package/dist/src/execution/coordination-dispatch-step.js +1 -1
- package/dist/src/execution/create-session-step.d.ts +5 -2
- package/dist/src/execution/create-session-step.js +1 -1
- package/dist/src/execution/deliver-payloads.js +1 -1
- package/dist/src/execution/durable-session-store.d.ts +0 -1
- package/dist/src/execution/dynamic-connection-recovery.js +1 -1
- package/dist/src/execution/dynamic-workflow/program-step.d.ts +7 -7
- package/dist/src/execution/dynamic-workflow/program-step.js +1 -1
- package/dist/src/execution/dynamic-workflow/schema.d.ts +18 -11
- package/dist/src/execution/dynamic-workflow/schema.js +1 -1
- package/dist/src/execution/dynamic-workflow/tool.js +1 -1
- package/dist/src/execution/dynamic-workflow/workflow.js +1 -1
- package/dist/src/execution/effective-agent-config.d.ts +8 -2
- package/dist/src/execution/effective-agent-config.js +1 -1
- package/dist/src/execution/eve-workflow-attributes.d.ts +3 -1
- package/dist/src/execution/eve-workflow-attributes.js +1 -1
- package/dist/src/execution/install-workflow-deployment-id.d.ts +3 -0
- package/dist/src/execution/install-workflow-deployment-id.js +1 -0
- package/dist/src/execution/invoke-tool.js +1 -1
- package/dist/src/execution/legacy-session/turn-workflow.js +1 -1
- package/dist/src/execution/node-step.d.ts +1 -0
- package/dist/src/execution/node-step.js +1 -1
- package/dist/src/execution/runtime-context.d.ts +2 -0
- package/dist/src/execution/runtime-context.js +1 -1
- package/dist/src/execution/sandbox/abort-bound-session.js +1 -1
- package/dist/src/execution/sandbox/active-connections.d.ts +28 -0
- package/dist/src/execution/sandbox/active-connections.js +1 -0
- package/dist/src/execution/sandbox/bindings/docker-cli.d.ts +10 -2
- package/dist/src/execution/sandbox/bindings/docker-cli.js +2 -2
- package/dist/src/execution/sandbox/bindings/docker-connection.d.ts +15 -0
- package/dist/src/execution/sandbox/bindings/docker-connection.js +2 -0
- package/dist/src/execution/sandbox/bindings/docker-container.d.ts +2 -0
- package/dist/src/execution/sandbox/bindings/docker-container.js +1 -1
- package/dist/src/execution/sandbox/bindings/docker-network.d.ts +5 -0
- package/dist/src/execution/sandbox/bindings/docker-network.js +1 -1
- package/dist/src/execution/sandbox/bindings/docker-templates.js +1 -1
- package/dist/src/execution/sandbox/bindings/docker.d.ts +12 -15
- package/dist/src/execution/sandbox/bindings/docker.js +1 -1
- package/dist/src/execution/sandbox/bindings/just-bash-runtime.d.ts +19 -29
- package/dist/src/execution/sandbox/bindings/just-bash-runtime.js +1 -1
- package/dist/src/execution/sandbox/bindings/just-bash.d.ts +2 -4
- package/dist/src/execution/sandbox/bindings/just-bash.js +1 -1
- package/dist/src/execution/sandbox/bindings/local-provider-utils.d.ts +0 -20
- package/dist/src/execution/sandbox/bindings/local-provider-utils.js +1 -1
- package/dist/src/execution/sandbox/bindings/local.d.ts +4 -6
- package/dist/src/execution/sandbox/bindings/local.js +1 -1
- package/dist/src/execution/sandbox/bindings/vercel-base-runtime.d.ts +2 -0
- package/dist/src/execution/sandbox/bindings/vercel-base-runtime.js +2 -2
- package/dist/src/execution/sandbox/bindings/vercel-errors.js +2 -2
- package/dist/src/execution/sandbox/bindings/vercel-lifecycle.d.ts +7 -5
- package/dist/src/execution/sandbox/bindings/vercel-lifecycle.js +1 -1
- package/dist/src/execution/sandbox/bindings/vercel.d.ts +5 -11
- package/dist/src/execution/sandbox/bindings/vercel.js +1 -2
- package/dist/src/execution/sandbox/development-cleanup.d.ts +0 -1
- package/dist/src/execution/sandbox/development-cleanup.js +1 -1
- package/dist/src/execution/sandbox/development-lazy-prewarm.js +1 -1
- package/dist/src/execution/sandbox/development-run.d.ts +0 -2
- package/dist/src/execution/sandbox/development-run.js +1 -1
- package/dist/src/execution/sandbox/dockerfile.d.ts +0 -4
- package/dist/src/execution/sandbox/dockerfile.js +1 -1
- package/dist/src/execution/sandbox/ensure.d.ts +23 -11
- package/dist/src/execution/sandbox/ensure.js +1 -1
- package/dist/src/execution/sandbox/glob-tool.js +3 -3
- package/dist/src/execution/sandbox/grep-tool.js +1 -1
- package/dist/src/execution/sandbox/logging-session.js +1 -1
- package/dist/src/execution/sandbox/prewarm.d.ts +23 -3
- package/dist/src/execution/sandbox/prewarm.js +2 -1
- package/dist/src/execution/sandbox/read-file.js +1 -1
- package/dist/src/execution/sandbox/require-sandbox.d.ts +3 -2
- package/dist/src/execution/sandbox/require-sandbox.js +1 -1
- package/dist/src/execution/sandbox/ripgrep-probe.js +1 -1
- package/dist/src/execution/sandbox/session.d.ts +10 -20
- package/dist/src/execution/sandbox/session.js +2 -2
- package/dist/src/execution/session/active-turn.js +1 -1
- package/dist/src/execution/session/admission.js +1 -1
- package/dist/src/execution/session/checkpoint-migrations.js +1 -1
- package/dist/src/execution/session/entry-input.d.ts +5 -6
- package/dist/src/execution/session/entry.js +1 -1
- package/dist/src/execution/session/finalization.js +1 -1
- package/dist/src/execution/session/handoff-state.d.ts +5 -0
- package/dist/src/execution/session/handoff-state.js +1 -0
- package/dist/src/execution/session/handoff-steps.d.ts +0 -5
- package/dist/src/execution/session/handoff-steps.js +1 -1
- package/dist/src/execution/session/handoff.d.ts +7 -9
- package/dist/src/execution/session/handoff.js +1 -1
- package/dist/src/execution/session/input-queue.d.ts +8 -1
- package/dist/src/execution/session/input-queue.js +1 -1
- package/dist/src/execution/session/next-input.d.ts +3 -0
- package/dist/src/execution/session/next-input.js +1 -1
- package/dist/src/execution/session/pending-history.d.ts +5 -0
- package/dist/src/execution/session/pending-history.js +1 -0
- package/dist/src/execution/session/pending-turn-state.js +1 -1
- package/dist/src/execution/session/program.d.ts +1 -1
- package/dist/src/execution/session/program.js +1 -1
- package/dist/src/execution/session/timeout-control.d.ts +22 -4
- package/dist/src/execution/session/timeout-control.js +1 -1
- package/dist/src/execution/session/timeout.d.ts +1 -2
- package/dist/src/execution/session/timeout.js +1 -1
- package/dist/src/execution/session/turn-control.d.ts +5 -2
- package/dist/src/execution/session/turn-control.js +1 -1
- package/dist/src/execution/session/turn-event-handler.js +1 -1
- package/dist/src/execution/session/turn-step-result.js +1 -1
- package/dist/src/execution/session/turn-step.js +1 -1
- package/dist/src/execution/session/turn-waiting-step.js +1 -1
- package/dist/src/execution/session/turn.js +1 -1
- package/dist/src/execution/session-inbox/inbox.d.ts +9 -1
- package/dist/src/execution/session-inbox/inbox.js +1 -1
- package/dist/src/execution/session-inbox/protocol.d.ts +2 -1
- package/dist/src/execution/session-inbox/protocol.js +1 -1
- package/dist/src/execution/session-inbox/resume.d.ts +2 -1
- package/dist/src/execution/session-inbox/resume.js +1 -1
- package/dist/src/execution/session-prewarm.d.ts +8 -0
- package/dist/src/execution/session-prewarm.js +1 -0
- package/dist/src/execution/session.d.ts +0 -12
- package/dist/src/execution/session.js +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/tasks/model-step.js +1 -1
- package/dist/src/execution/tasks/start.d.ts +4 -4
- package/dist/src/execution/tasks/start.js +1 -1
- package/dist/src/execution/tasks/steps.js +1 -1
- package/dist/src/execution/terminate-child-sessions-step.js +1 -1
- package/dist/src/execution/tools/agent-router-workflow.js +1 -1
- package/dist/src/execution/tools/workflow/body.d.ts +2 -2
- package/dist/src/execution/tools/workflow/body.js +1 -1
- package/dist/src/execution/tools/workflow/step-context.d.ts +11 -0
- 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/workflow-runtime.d.ts +5 -1
- package/dist/src/execution/workflow-runtime.js +1 -1
- package/dist/src/extensions/git/extension/lib/github-shell-schema.js +1 -1
- package/dist/src/framework/sources/modules/sandbox.d.ts +1 -1
- package/dist/src/harness/attachment-staging.d.ts +0 -7
- package/dist/src/harness/attachment-staging.js +1 -1
- package/dist/src/harness/hitl/approvals.js +1 -1
- package/dist/src/harness/hitl/budget-request.d.ts +12 -6
- package/dist/src/harness/hitl/budget-request.js +1 -1
- package/dist/src/harness/hitl/budget.d.ts +7 -1
- package/dist/src/harness/hitl/budget.js +1 -1
- package/dist/src/harness/hitl/coordinator.js +1 -1
- package/dist/src/harness/hitl/delivery.d.ts +1 -1
- package/dist/src/harness/hitl/delivery.js +1 -1
- package/dist/src/harness/hitl/index.d.ts +2 -1
- package/dist/src/harness/hitl/index.js +1 -1
- package/dist/src/harness/hitl/intake.d.ts +2 -2
- package/dist/src/harness/hitl/intake.js +1 -1
- package/dist/src/harness/hitl/view.d.ts +1 -0
- package/dist/src/harness/hitl/view.js +1 -0
- package/dist/src/harness/messages.d.ts +5 -0
- package/dist/src/harness/messages.js +1 -1
- package/dist/src/harness/model-call/call.d.ts +2 -2
- package/dist/src/harness/model-call/request.d.ts +2 -2
- package/dist/src/harness/model-call/run.js +1 -1
- package/dist/src/harness/semantic-errors/rules/sandbox.d.ts +3 -5
- package/dist/src/harness/semantic-errors/rules/sandbox.js +1 -1
- package/dist/src/harness/session-machine/transitions.d.ts +3 -1
- package/dist/src/harness/session-machine/transitions.js +1 -1
- package/dist/src/harness/step/context.d.ts +3 -0
- package/dist/src/harness/step/context.js +1 -1
- package/dist/src/harness/step/intake.d.ts +5 -2
- package/dist/src/harness/step/intake.js +1 -1
- package/dist/src/harness/step/prompt.js +1 -1
- package/dist/src/harness/tool-history-repair.d.ts +9 -0
- package/dist/src/harness/tool-history-repair.js +1 -0
- package/dist/src/harness/tool-loop.js +1 -1
- package/dist/src/harness/tool-model-output.d.ts +19 -3
- package/dist/src/harness/tool-model-output.js +1 -1
- package/dist/src/harness/turn-tag-state.d.ts +7 -26
- package/dist/src/harness/turn-tag-state.js +1 -1
- package/dist/src/harness/types.d.ts +10 -25
- package/dist/src/internal/application/build-profile.d.ts +3 -0
- package/dist/src/internal/application/build-profile.js +1 -1
- package/dist/src/internal/application/compiled-artifacts.js +10 -6
- package/dist/src/internal/application/dev-environment.d.ts +13 -0
- package/dist/src/internal/application/dev-environment.js +1 -1
- package/dist/src/internal/application/optional-package-import.d.ts +10 -0
- package/dist/src/internal/application/optional-package-import.js +1 -1
- package/dist/src/internal/application/stamped-package-version.js +1 -1
- package/dist/src/internal/attachments/limited-read.d.ts +2 -2
- package/dist/src/internal/authored-definition/core.js +1 -1
- package/dist/src/internal/authored-module-build-options.d.ts +13 -0
- package/dist/src/internal/authored-module-build-options.js +1 -0
- package/dist/src/internal/authored-module-cache.d.ts +10 -0
- package/dist/src/internal/authored-module-cache.js +1 -0
- package/dist/src/internal/authored-module-graph.d.ts +13 -0
- package/dist/src/internal/authored-module-graph.js +1 -0
- package/dist/src/internal/authored-module-loader.d.ts +22 -1
- package/dist/src/internal/authored-module-loader.js +1 -3
- package/dist/src/internal/authored-module.d.ts +7 -0
- package/dist/src/internal/authored-module.js +1 -1
- package/dist/src/internal/authored-package-boundary.js +1 -1
- package/dist/src/internal/authored-relative-extension-resolver.js +1 -1
- package/dist/src/internal/bundler/nitro-rolldown.d.ts +8 -2
- package/dist/src/internal/bundler/nitro-rolldown.js +1 -1
- package/dist/src/internal/bundler/pseudo-packages.d.ts +11 -0
- package/dist/src/internal/bundler/pseudo-packages.js +1 -0
- package/dist/src/internal/development-programmatic-source-loader.d.ts +1 -0
- package/dist/src/internal/development-programmatic-source-loader.js +1 -1
- package/dist/src/internal/nitro/dev-runtime-artifacts.js +1 -1
- package/dist/src/internal/nitro/dev-runtime-generation-metadata.js +1 -1
- package/dist/src/internal/nitro/host/build-application.js +1 -1
- package/dist/src/internal/nitro/host/build-deployment-id.d.ts +8 -0
- package/dist/src/internal/nitro/host/build-deployment-id.js +1 -0
- package/dist/src/internal/nitro/host/build-extension.d.ts +6 -0
- package/dist/src/internal/nitro/host/build-extension.js +2 -2
- package/dist/src/internal/nitro/host/compiled-sandbox-provider-prune-plugin.d.ts +3 -1
- package/dist/src/internal/nitro/host/compiled-sandbox-provider-prune-plugin.js +3 -5
- package/dist/src/internal/nitro/host/create-application-nitro.d.ts +2 -3
- package/dist/src/internal/nitro/host/create-application-nitro.js +1 -1
- package/dist/src/internal/nitro/host/dev-authored-rebuild-coordinator.d.ts +2 -0
- package/dist/src/internal/nitro/host/dev-authored-rebuild-coordinator.js +1 -1
- package/dist/src/internal/nitro/host/dev-authored-source-watcher.js +1 -1
- package/dist/src/internal/nitro/host/dev-build-host.d.ts +83 -0
- package/dist/src/internal/nitro/host/dev-build-host.js +1 -0
- package/dist/src/internal/nitro/host/dev-build-operations.d.ts +6 -0
- package/dist/src/internal/nitro/host/dev-build-operations.js +1 -0
- package/dist/src/internal/nitro/host/dev-build-process.d.ts +1 -0
- package/dist/src/internal/nitro/host/dev-build-process.js +1 -0
- package/dist/src/internal/nitro/host/dev-server-state.js +1 -1
- package/dist/src/internal/nitro/host/development-runtime-prune-plugin.d.ts +4 -1
- package/dist/src/internal/nitro/host/development-runtime-prune-plugin.js +3 -2
- package/dist/src/internal/nitro/host/drained-nitro-dev-server.d.ts +13 -0
- package/dist/src/internal/nitro/host/drained-nitro-dev-server.js +1 -1
- package/dist/src/internal/nitro/host/optional-engine-dependency-plugin.js +1 -1
- package/dist/src/internal/nitro/host/prepare-application-host.d.ts +3 -0
- package/dist/src/internal/nitro/host/prepare-application-host.js +1 -1
- package/dist/src/internal/nitro/host/sandbox-shutdown-plugin.js +1 -1
- package/dist/src/internal/nitro/host/skill-server-assets.js +1 -1
- package/dist/src/internal/nitro/host/stage-build-deployment-id.d.ts +2 -0
- package/dist/src/internal/nitro/host/stage-build-deployment-id.js +1 -0
- package/dist/src/internal/nitro/host/start-development-server.js +2 -2
- package/dist/src/internal/nitro/host/start-production-server.d.ts +1 -0
- package/dist/src/internal/nitro/host/start-production-server.js +3 -3
- package/dist/src/internal/nitro/host/workflow-sandbox-runtime-plugin.js +1 -1
- package/dist/src/internal/nitro/host.js +1 -1
- package/dist/src/internal/nitro/routes/schedule-task.d.ts +3 -0
- package/dist/src/internal/nitro/routes/schedule-task.js +1 -1
- package/dist/src/internal/programmatic-source-loader.d.ts +1 -0
- package/dist/src/internal/programmatic-source-loader.js +1 -1
- package/dist/src/internal/schedules/disabled.d.ts +2 -0
- package/dist/src/internal/schedules/disabled.js +1 -0
- package/dist/src/internal/workflow/development-world-server.js +1 -1
- package/dist/src/internal/workflow/local-world-data-directory.d.ts +2 -1
- package/dist/src/internal/workflow/local-world-data-directory.js +1 -1
- package/dist/src/internal/workflow/local-world-delivery-auth.d.ts +17 -0
- package/dist/src/internal/workflow/local-world-delivery-auth.js +1 -0
- package/dist/src/internal/workflow/queue-namespace.d.ts +2 -0
- package/dist/src/internal/workflow/queue-namespace.js +1 -1
- package/dist/src/internal/workflow-bundle/builder-support.d.ts +0 -1
- package/dist/src/internal/workflow-bundle/builder-support.js +2 -2
- package/dist/src/internal/workflow-bundle/builder.js +2 -2
- package/dist/src/internal/workflow-bundle/vercel-workflow-output.d.ts +1 -1
- package/dist/src/internal/workflow-bundle/vercel-workflow-output.js +1 -1
- package/dist/src/protocol/message.d.ts +27 -1
- package/dist/src/protocol/message.js +2 -2
- package/dist/src/protocol/prewarm-session.d.ts +14 -0
- package/dist/src/protocol/prewarm-session.js +1 -0
- package/dist/src/protocol/routes.d.ts +2 -2
- package/dist/src/public/channels/chat-sdk/chatSdkChannel.d.ts +13 -0
- package/dist/src/public/channels/chat-sdk/chatSdkChannel.js +2 -2
- package/dist/src/public/channels/chat-sdk/fetch-message.d.ts +10 -0
- package/dist/src/public/channels/chat-sdk/fetch-message.js +1 -0
- package/dist/src/public/channels/chat-sdk/index.d.ts +1 -1
- package/dist/src/public/channels/chat-sdk/reply-context.d.ts +15 -0
- package/dist/src/public/channels/chat-sdk/reply-context.js +2 -0
- package/dist/src/public/channels/discord/authorization.d.ts +45 -0
- package/dist/src/public/channels/discord/authorization.js +3 -0
- package/dist/src/public/channels/discord/defaults.d.ts +14 -3
- package/dist/src/public/channels/discord/defaults.js +2 -2
- package/dist/src/public/channels/discord/discordChannel.d.ts +18 -1
- package/dist/src/public/channels/discord/discordChannel.js +1 -1
- package/dist/src/public/channels/discord/gateway/connection.d.ts +26 -0
- package/dist/src/public/channels/discord/gateway/connection.js +1 -0
- package/dist/src/public/channels/discord/gateway/forwarder.d.ts +14 -0
- package/dist/src/public/channels/discord/gateway/forwarder.js +1 -0
- package/dist/src/public/channels/discord/gateway/index.d.ts +59 -0
- package/dist/src/public/channels/discord/gateway/index.js +1 -0
- package/dist/src/public/channels/discord/inbound.d.ts +10 -3
- package/dist/src/public/channels/discord/inbound.js +2 -2
- package/dist/src/public/channels/discord/index.d.ts +3 -2
- package/dist/src/public/channels/discord/index.js +1 -1
- package/dist/src/public/channels/discord/messages.d.ts +116 -0
- package/dist/src/public/channels/discord/messages.js +2 -0
- package/dist/src/public/channels/github/checkout.js +1 -1
- package/dist/src/public/channels/github/dispatch.js +1 -1
- package/dist/src/public/channels/github/githubChannel.d.ts +3 -0
- package/dist/src/public/channels/imessage-tapbacks.d.ts +74 -0
- package/dist/src/public/channels/imessage-tapbacks.js +1 -0
- package/dist/src/public/channels/index.d.ts +2 -1
- package/dist/src/public/channels/index.js +1 -1
- package/dist/src/public/channels/linear/linearChannel.d.ts +3 -0
- package/dist/src/public/channels/linear/linearChannel.js +1 -1
- package/dist/src/public/channels/linq/inboundContent.d.ts +7 -0
- package/dist/src/public/channels/linq/inboundContent.js +1 -1
- package/dist/src/public/channels/linq/index.d.ts +1 -0
- package/dist/src/public/channels/linq/index.js +1 -1
- package/dist/src/public/channels/linq/linqChannel.d.ts +21 -2
- package/dist/src/public/channels/linq/linqChannel.js +1 -1
- package/dist/src/public/channels/photon/inboundContent.d.ts +7 -0
- package/dist/src/public/channels/photon/inboundContent.js +2 -1
- package/dist/src/public/channels/photon/index.d.ts +1 -0
- package/dist/src/public/channels/photon/index.js +1 -1
- package/dist/src/public/channels/photon/photonIMessageChannel.d.ts +17 -1
- package/dist/src/public/channels/photon/photonIMessageChannel.js +1 -1
- package/dist/src/public/channels/same-environment-oidc.d.ts +7 -0
- package/dist/src/public/channels/same-environment-oidc.js +1 -0
- package/dist/src/public/channels/slack/api.d.ts +6 -0
- package/dist/src/public/channels/slack/api.js +1 -1
- package/dist/src/public/channels/slack/model-context.d.ts +7 -0
- package/dist/src/public/channels/slack/model-context.js +1 -1
- package/dist/src/public/channels/slack/reply-delivery.d.ts +5 -0
- package/dist/src/public/channels/slack/reply-delivery.js +1 -1
- package/dist/src/public/channels/slack/slackChannel.d.ts +17 -3
- package/dist/src/public/channels/slack/slackChannel.js +1 -1
- package/dist/src/public/channels/teams/teamsChannel.d.ts +3 -0
- package/dist/src/public/channels/teams/teamsChannel.js +1 -1
- package/dist/src/public/channels/telegram/telegramChannel.d.ts +3 -0
- package/dist/src/public/channels/telegram/telegramChannel.js +1 -1
- package/dist/src/public/definitions/agent.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/hook.d.ts +1 -0
- package/dist/src/public/definitions/sandbox.d.ts +1 -1
- package/dist/src/public/index.d.ts +1 -1
- package/dist/src/public/next/server.js +1 -1
- package/dist/src/public/sandbox/docker-sandbox.d.ts +6 -1
- package/dist/src/public/sandbox/docker.d.ts +1 -8
- package/dist/src/public/sandbox/index.d.ts +3 -3
- package/dist/src/public/sandbox/just-bash-sandbox.d.ts +87 -7
- package/dist/src/public/sandbox/just-bash.d.ts +1 -1
- package/dist/src/public/sandbox/provider.d.ts +5 -1
- package/dist/src/public/sandbox/provider.js +1 -1
- package/dist/src/public/sandbox/vercel-sandbox.d.ts +16 -9
- package/dist/src/public/sandbox/vercel.d.ts +0 -1
- package/dist/src/public/sandbox/vercel.js +1 -1
- package/dist/src/public/tools/agent.d.ts +8 -1
- package/dist/src/public/tools/agent.js +1 -1
- package/dist/src/public/tools/index.d.ts +1 -1
- package/dist/src/react/use-eve-agent.d.ts +1 -1
- package/dist/src/runtime/agent/resolve-model.d.ts +4 -0
- package/dist/src/runtime/agent/resolve-model.js +1 -1
- package/dist/src/runtime/connections/openapi-client.d.ts +2 -0
- package/dist/src/runtime/connections/openapi-client.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-channel.js +1 -1
- package/dist/src/runtime/resolve-sandbox.js +1 -1
- package/dist/src/runtime/sandbox/prepared-artifacts.js +1 -1
- package/dist/src/runtime/sandbox/registry.d.ts +2 -0
- package/dist/src/runtime/sandbox/registry.js +1 -1
- package/dist/src/runtime/sessions/compiled-agent-cache.js +1 -1
- package/dist/src/runtime/subagents/dynamic-agent-config.d.ts +2 -1
- package/dist/src/runtime/subagents/dynamic-agent-config.js +1 -1
- package/dist/src/runtime/subagents/workflow.d.ts +6 -0
- package/dist/src/runtime/subagents/workflow.js +1 -1
- package/dist/src/runtime/types.d.ts +3 -2
- package/dist/src/runtime/workspace/seed-files.d.ts +9 -12
- package/dist/src/runtime/workspace/seed-files.js +1 -1
- package/dist/src/runtime/workspace/spec.d.ts +1 -1
- package/dist/src/runtime/workspace/spec.js +1 -1
- package/dist/src/runtime/workspace/types.d.ts +2 -6
- package/dist/src/sandbox/provider.d.ts +185 -0
- package/dist/src/sandbox/provider.js +1 -0
- package/dist/src/sandbox/providers/default.d.ts +20 -19
- package/dist/src/sandbox/providers/default.js +1 -1
- package/dist/src/sandbox/providers/docker.d.ts +5 -2
- package/dist/src/sandbox/providers/docker.js +1 -1
- package/dist/src/sandbox/providers/just-bash.d.ts +4 -3
- package/dist/src/sandbox/providers/just-bash.js +1 -1
- package/dist/src/sandbox/providers/vercel.d.ts +4 -10
- package/dist/src/sandbox/providers/vercel.js +1 -1
- package/dist/src/sandbox/providers.d.ts +0 -1
- package/dist/src/sandbox/providers.js +1 -1
- package/dist/src/sandbox/state.d.ts +44 -0
- package/dist/src/sandbox/state.js +1 -1
- package/dist/src/self-modification/deployed-sandbox.d.ts +4 -9
- package/dist/src/self-modification/deployed-sandbox.js +1 -1
- package/dist/src/self-modification/filesystem.d.ts +3 -3
- package/dist/src/self-modification/remote/config.d.ts +2 -2
- package/dist/src/self-modification/remote/config.js +1 -1
- package/dist/src/self-modification/setup.d.ts +0 -1
- package/dist/src/self-modification/setup.js +8 -8
- package/dist/src/setup/integrations/discord/api.d.ts +7 -0
- package/dist/src/setup/integrations/discord/api.js +1 -1
- package/dist/src/setup/integrations/discord/daemon.d.ts +18 -0
- package/dist/src/setup/integrations/discord/daemon.js +21 -0
- package/dist/src/setup/integrations/discord/setup.d.ts +24 -4
- package/dist/src/setup/integrations/discord/setup.js +5 -4
- package/dist/src/setup/integrations/self-modification/setup.js +1 -1
- package/dist/src/setup/scaffold/create/project.js +1 -1
- package/dist/src/setup/scaffold/update/web-options.js +1 -1
- package/dist/src/setup/scaffold/version-tokens.d.ts +0 -1
- package/dist/src/setup/scaffold/version-tokens.js +1 -1
- package/dist/src/shared/agent-definition.d.ts +33 -42
- package/dist/src/shared/built-server-start-failure.d.ts +12 -0
- package/dist/src/shared/built-server-start-failure.js +3 -0
- package/dist/src/shared/framework-eve-server.d.ts +2 -0
- package/dist/src/shared/framework-eve-server.js +2 -2
- package/dist/src/shared/sandbox-environment.d.ts +4 -10
- package/dist/src/shared/sandbox-environment.js +1 -1
- package/dist/src/shared/sandbox-network-policy.d.ts +45 -9
- package/dist/src/shared/sandbox-provider.d.ts +0 -103
- package/dist/src/shared/sandbox-provider.js +1 -1
- package/dist/src/shared/sandbox-recorded-data-error.d.ts +4 -0
- package/dist/src/shared/sandbox-recorded-data-error.js +1 -0
- package/dist/src/shared/sandbox-session-gone-error.d.ts +12 -0
- package/dist/src/shared/sandbox-session-gone-error.js +1 -0
- package/dist/src/shared/sandbox-session.d.ts +97 -83
- package/dist/src/shared/sandbox-template-error.d.ts +19 -4
- package/dist/src/shared/sandbox-template-error.js +1 -1
- package/dist/src/shared/sandbox-tool-session-error.d.ts +4 -0
- package/dist/src/shared/sandbox-tool-session-error.js +1 -0
- package/dist/src/shared/session-history.d.ts +22 -0
- package/dist/src/shared/session-history.js +1 -0
- package/dist/src/shared/skill-package.js +1 -1
- package/dist/src/shared/skill-paths.d.ts +4 -5
- package/dist/src/shared/skill-paths.js +2 -2
- package/dist/src/shared/workflow-sandbox.d.ts +4 -41
- package/dist/src/shared/workflow-sandbox.js +1 -1
- package/dist/src/subagents/tool.d.ts +1 -3
- package/dist/src/subagents/tool.js +1 -1
- package/dist/src/svelte/index.js +1 -1
- package/dist/src/svelte/use-eve-agent.d.ts +1 -1
- package/dist/src/svelte/use-eve-agent.js +1 -1
- package/dist/src/tools/model-output.d.ts +23 -5
- package/dist/src/tools/model-output.js +1 -1
- package/dist/src/tools/provided/ask-question-workflow.js +1 -1
- package/dist/src/tools/provided/glob.js +1 -1
- package/dist/src/tools/provided/grep.js +1 -1
- package/dist/src/tools/provided/read-file.js +1 -1
- package/dist/src/tools/provided/sleep-workflow.js +1 -1
- package/dist/src/tools/provided/workflow.js +1 -1
- package/dist/src/tools/provided/write-file.js +1 -1
- package/dist/src/tools/workflow-definition.d.ts +33 -5
- package/dist/src/tracing/eve/conversation-context.d.ts +4 -1
- package/dist/src/tracing/eve/conversation-context.js +1 -1
- package/dist/src/tracing/eve/invoke-tool-span.js +1 -1
- package/dist/src/tracing/eve/operation-input.d.ts +0 -5
- package/dist/src/tracing/eve/operation-input.js +1 -1
- package/dist/src/tracing/eve/otel-registration.js +1 -1
- package/dist/src/tracing/eve/session.d.ts +3 -2
- package/dist/src/tracing/eve/session.js +1 -1
- package/dist/src/vue/index.js +1 -1
- package/dist/src/vue/use-eve-agent.d.ts +1 -1
- package/dist/src/vue/use-eve-agent.js +1 -1
- package/docs/agent-config.md +86 -65
- package/docs/channels/chat-sdk.mdx +6 -1
- package/docs/channels/custom.mdx +41 -9
- package/docs/channels/discord.mdx +279 -7
- package/docs/channels/eve.mdx +58 -1
- package/docs/channels/linq.mdx +53 -2
- package/docs/channels/mcp.mdx +2 -2
- package/docs/channels/overview.mdx +1 -1
- package/docs/channels/photon.mdx +65 -1
- package/docs/channels/slack.mdx +4 -2
- package/docs/concepts/built-in-tools.md +32 -9
- package/docs/concepts/execution-model-and-durability.mdx +15 -103
- package/docs/concepts/security-model.md +2 -0
- package/docs/concepts/sessions-runs-and-streaming.md +52 -43
- package/docs/connections/openapi.mdx +2 -0
- package/docs/connections/overview.mdx +1 -1
- package/docs/evals/reporters.mdx +1 -1
- package/docs/evals/running.mdx +1 -1
- package/docs/experimental/dynamic-schedules.mdx +186 -0
- package/docs/experimental/meta.json +4 -0
- package/docs/guides/client/messages.mdx +1 -1
- package/docs/guides/client/streaming.mdx +1 -0
- package/docs/guides/deployment/overview.md +4 -4
- package/docs/guides/deployment/self-hosting.md +53 -1
- package/docs/guides/dev-tui.md +1 -1
- package/docs/guides/dynamic-capabilities.md +1 -1
- package/docs/guides/frontend/overview.mdx +26 -6
- package/docs/guides/hooks.md +21 -1
- package/docs/guides/instrumentation/agent-runs.mdx +16 -0
- package/docs/guides/self-modification.md +1 -1
- package/docs/guides/session-context.md +1 -1
- package/docs/instructions.mdx +1 -1
- package/docs/memory/overview.mdx +2 -1
- package/docs/patterns/dynamic-scheduling.md +3 -1
- package/docs/reference/agent-files.md +3 -3
- package/docs/reference/cli.md +21 -9
- package/docs/reference/typescript-api.md +9 -3
- package/docs/sandbox/custom-providers.mdx +254 -0
- package/docs/sandbox/default.mdx +71 -4
- package/docs/sandbox/docker.mdx +15 -3
- package/docs/sandbox/index.mdx +27 -103
- package/docs/sandbox/just-bash.mdx +54 -0
- package/docs/sandbox/meta.json +9 -1
- package/docs/sandbox/troubleshooting.mdx +215 -0
- package/docs/sandbox/vercel.mdx +48 -7
- package/docs/schedules.mdx +2 -0
- package/docs/skills.mdx +1 -1
- package/docs/subagents/index.mdx +3 -1
- package/docs/tools/overview.mdx +21 -1
- package/docs/tools/tasks-upgrade.md +12 -7
- package/docs/tools/tasks.md +10 -6
- package/docs/tools/workflows.mdx +109 -10
- package/docs/tutorial/connect-a-warehouse.mdx +1 -1
- package/docs/tutorial/run-analysis.mdx +3 -3
- package/package.json +14 -20
- package/dist/src/compiled/@ai-sdk/code-mode/_run.d.ts +0 -1
- package/dist/src/compiled/@ai-sdk/code-mode/index.d.ts +0 -325
- package/dist/src/compiled/@ai-sdk/code-mode/index.js +0 -660
- package/dist/src/compiled/_chunks/workflow/dist-CyBgVS7g.js +0 -1
- package/dist/src/compiled/_chunks/workflow/dist-T5NnW-0k.js +0 -3
- package/dist/src/compiled/_chunks/workflow/helpers-DlLD3ov_.js +0 -1
- package/dist/src/compiled/_chunks/workflow/private-tQUuwBoQ.js +0 -1
- package/dist/src/compiled/_chunks/workflow/resume-hook-DMsV_b4n.js +0 -1
- package/dist/src/compiled/_chunks/workflow/serialization-DPdYS_w2.js +0 -16
- package/dist/src/compiled/_chunks/workflow/sleep-BY6leHh8.js +0 -1
- package/dist/src/compiled/_chunks/workflow/workflow-routes-CwqB063q.js +0 -1
- package/dist/src/execution/run-session-limits.d.ts +0 -12
- package/dist/src/execution/run-session-limits.js +0 -1
- package/dist/src/execution/sandbox/active-handles.d.ts +0 -32
- package/dist/src/execution/sandbox/active-handles.js +0 -1
- package/dist/src/execution/sandbox/bindings/docker-session.d.ts +0 -6
- package/dist/src/execution/sandbox/bindings/docker-session.js +0 -2
- package/dist/src/execution/sandbox/bindings/immutable-resources.d.ts +0 -15
- package/dist/src/execution/sandbox/bindings/immutable-resources.js +0 -2
- package/dist/src/execution/sandbox/bindings/microsandbox-create.d.ts +0 -12
- package/dist/src/execution/sandbox/bindings/microsandbox-create.js +0 -1
- package/dist/src/execution/sandbox/bindings/microsandbox-lifecycle.d.ts +0 -42
- package/dist/src/execution/sandbox/bindings/microsandbox-lifecycle.js +0 -1
- package/dist/src/execution/sandbox/bindings/microsandbox-metadata.d.ts +0 -29
- package/dist/src/execution/sandbox/bindings/microsandbox-metadata.js +0 -1
- package/dist/src/execution/sandbox/bindings/microsandbox-network.d.ts +0 -18
- package/dist/src/execution/sandbox/bindings/microsandbox-network.js +0 -1
- package/dist/src/execution/sandbox/bindings/microsandbox-options.d.ts +0 -37
- package/dist/src/execution/sandbox/bindings/microsandbox-options.js +0 -1
- package/dist/src/execution/sandbox/bindings/microsandbox-platform.d.ts +0 -21
- package/dist/src/execution/sandbox/bindings/microsandbox-platform.js +0 -21
- package/dist/src/execution/sandbox/bindings/microsandbox-process.d.ts +0 -3
- package/dist/src/execution/sandbox/bindings/microsandbox-process.js +0 -1
- package/dist/src/execution/sandbox/bindings/microsandbox-provider-state.d.ts +0 -11
- package/dist/src/execution/sandbox/bindings/microsandbox-provider-state.js +0 -1
- package/dist/src/execution/sandbox/bindings/microsandbox-runtime.d.ts +0 -82
- package/dist/src/execution/sandbox/bindings/microsandbox-runtime.js +0 -1
- package/dist/src/execution/sandbox/bindings/microsandbox-templates.d.ts +0 -12
- package/dist/src/execution/sandbox/bindings/microsandbox-templates.js +0 -1
- package/dist/src/execution/sandbox/bindings/microsandbox.d.ts +0 -16
- package/dist/src/execution/sandbox/bindings/microsandbox.js +0 -1
- package/dist/src/execution/sandbox/provider-host-development.d.ts +0 -2
- package/dist/src/execution/sandbox/provider-host-development.js +0 -1
- package/dist/src/execution/sandbox/provider-host.d.ts +0 -2
- package/dist/src/execution/sandbox/provider-host.js +0 -1
- package/dist/src/execution/tool-session/sandbox.d.ts +0 -22
- package/dist/src/execution/tool-session/sandbox.js +0 -1
- package/dist/src/harness/session-usage-limits.d.ts +0 -49
- package/dist/src/harness/session-usage-limits.js +0 -1
- package/dist/src/public/sandbox/microsandbox-sandbox.d.ts +0 -48
- package/dist/src/public/sandbox/microsandbox.d.ts +0 -9
- package/dist/src/public/sandbox/microsandbox.js +0 -1
- package/dist/src/sandbox/providers/microsandbox.d.ts +0 -12
- package/dist/src/sandbox/providers/microsandbox.js +0 -1
- package/dist/src/subagents/token-budget.d.ts +0 -15
- package/dist/src/subagents/token-budget.js +0 -1
- package/docs/sandbox/microsandbox.mdx +0 -31
- /package/dist/src/{public/sandbox/microsandbox-sandbox.js → execution/agent-sessions/runtime-overrides.js} +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
import{sessionCommandHookToken,sessionInboxHookToken}from"#execution/session-inbox/address.js";import{TASK_WAIT_TOOL_NAME}from"#protocol/task-tools.js";import{renderTaskWaitResult}from"#execution/tasks/render.js";import{
|
|
1
|
+
import{sessionCommandHookToken,sessionInboxHookToken}from"#execution/session-inbox/address.js";import{TASK_WAIT_TOOL_NAME}from"#protocol/task-tools.js";import{renderTaskWaitResult}from"#execution/tasks/render.js";import{sleep}from"#compiled/@workflow/core/index.js";import{findBlockingWorkflowToolRun,getBlockingWorkflowToolRuns,isInboxToolResultFromRecordedWorkflowToolRun}from"#harness/workflow-tool-runs.js";import{taskWaitResult}from"#execution/tasks/table.js";import{handleWorkflowToolRunMessage,isAppliedRunMessage,takeLeadingAppliedRunMessages}from"#execution/session-workflow-tool-run.js";import{resolveTurnPrincipal}from"#execution/session/principal.js";import{answerTaskCancel,cancelWorkingTasks,sessionTaskTable}from"#execution/tasks/session.js";import{cancelDescendantTurnsStep}from"#execution/cancel-descendant-turns-step.js";import{dispatchCoordinationStep,publishTaskStartedStep}from"#execution/coordination-dispatch-step.js";import{taskToolResult}from"#execution/tasks/calls.js";import{publishTurnWaitingStep}from"#execution/session/turn-waiting-step.js";import{applyRunMessagesStep}from"#execution/tools/workflow/apply-run-messages-step.js";import{interruptWorkflowToolRun}from"#execution/tools/workflow/interrupt.js";import{turnStep}from"#execution/session/turn-step.js";import{ActiveTurn}from"#execution/session/active-turn.js";import{resolveRuntimeActionResultsForCallIds}from"#runtime/actions/results.js";import{startTaskToolCallsStep,traceTaskToolCallStep}from"#execution/session/task-tool-tracing-step.js";function hasDelegatedCallerContext(e){if(e[`eve.sessionCallback`]!==void 0)return!0;let t=e[`eve.channel`];return typeof t==`object`&&!!t&&Reflect.get(t,`kind`)===`subagent`}var SessionExecution=class{input;constructor(e){this.input=e}get cursor(){return this.input.cursor}async runTurn(e,t={}){let n=new ActiveTurn(this.input,{caller:t.caller,principal:resolveTurnPrincipal(e,this.input.cursor.serializedContext)},t.control);try{let t=await this.runTurnSteps(n,e);return await this.handleBoundaryMessages(n.takeBoundaryMessages(),t.kind===`done`),t.kind===`park`&&t.settled!==void 0&&await cancelWorkingTasks(this.input.cursor,`turn_ended`),{...t,...n.caller!==void 0&&{caller:n.caller},...n.compacted&&{compacted:!0}}}finally{n.dispose()}}async handleBoundaryMessages(e,t=!1,n){let r=[];for(let i of e)isAppliedRunMessage(i)?(!t||i.kind!==`agent-started`)&&r.push(i):(await this.applyRunMessages(r,n),r=[],await handleWorkflowToolRunMessage({cursor:this.input.cursor,message:i}));await this.applyRunMessages(r,n)}async applyRunMessages(e,t){if(e.length===0)return;let{cancelled:n}=await this.input.cursor.advance(n=>applyRunMessagesStep({...n,canCancelTurn:t!==void 0,messages:e}));n&&t?.abort()}async runTurnSteps(e,t){let n=t,r=e.caller;for(;;){let{cursor:t}=this.input,i=r;r=void 0;let a=await t.advanceWithHistory(t=>turnStep({...t,abortSignal:e.signal,caller:i,input:n,steeringSignal:e.steeringSignal}));a.compacted===!0&&(e.compacted=!0);let o=a.action===`park`?a.pendingCoordinationCallIds:void 0,s=a.action===`park`&&a.settled!==void 0,c=this.input.queue.nextAdmission;await e.admitBoundary();let l=a.action===`done`;if(await this.handleBoundaryMessages(e.takeBoundaryMessages(),l,l?void 0:e),a.action===`cancelled`||!s&&e.signal.aborted&&o===void 0)return await this.finishCancelledTurn(e);if(a.action===`done`)return{isError:a.isError,kind:`done`,output:a.output??``,usage:a.usage,usageDelta:a.usageDelta};if(a.action===`held`&&a.hold===`request`){if(a.hasPendingInputBatch&&this.input.capabilities?.requestInput!==!0&&!hasDelegatedCallerContext(this.input.cursor.serializedContext))throw Error(`This session cannot request human input, so it cannot wait for a tool approval or question. Configure unattended tools with an approval policy that does not require human input.`);let t=await this.waitForHeldRequest(e,a,c);if(t===`cancelled`)return await this.finishCancelledTurn(e);n={delivery:t};continue}if(a.action===`held`){if(await this.waitForHeldTurn(e)===`cancelled`)return await this.finishCancelledTurn(e);let t=await e.takeSteering();n=t===void 0?void 0:{delivery:t};continue}if(o!==void 0&&a.action===`park`){let t=a.hasRunsToDispatch===!1?[]:await this.dispatchRuns(),r=t.length===0?void 0:Date.now(),i=await this.waitForRuntimeActionResults({initialAcceptedAtMs:r,initialResults:t,taskToolCalls:a.pendingTaskToolCalls??[],pendingCallIds:o,turn:e});if(i===`cancelled`)return await this.finishCancelledTurn(e);n={delivery:await e.takeSteering(),runtimeResults:i};continue}if(a.action===`park`)return{kind:`park`,settled:a.settled};let u=await e.takeSteering();n=u===void 0?void 0:{delivery:u}}}async dispatchRuns(){let{cursor:e}=this.input,t=await e.advance(({serializedContext:e,sessionState:t})=>dispatchCoordinationStep({action:`park`,serializedContext:e,sessionState:t,workflowToolRunOwner:{inbox:sessionInboxHookToken(sessionCommandHookToken(this.input.sessionId))}}));return t.started.length>0&&await e.advance(e=>publishTaskStartedStep({...e,started:t.started})),t.results}async handleWorkflowMessage(e,t){if(isAppliedRunMessage(e)){let n=t?.takeAppliedRunMessages()??takeLeadingAppliedRunMessages(this.input.inbox);await this.applyRunMessages([e,...n],t);return}return await handleWorkflowToolRunMessage({cursor:this.input.cursor,message:e})}async cancelTurnWork(){let{cursor:e}=this.input;mayWaitOnWorkflowToolRuns(e.sessionState)&&await cancelDescendantTurnsStep({serializedContext:e.serializedContext,sessionState:e.sessionState}),await cancelWorkingTasks(e,`turn_cancelled`)}async finishCancelledTurn(e){return await this.handleBoundaryMessages(e.takeBoundaryMessages(`agent-started`)),await this.cancelTurnWork(),{cancelled:!0,kind:`park`}}async waitForHeldTurn(e){let t=!1;for(;;){let n={interrupted:t,timedOut:!1};if(taskWaitResult(sessionTaskTable(this.input.cursor),n)!==void 0)return`woke`;let r=await e.nextRuntimeEvent([]);if(r===`cancelled`)return r;switch(r.kind){case`steering`:t=!0;continue;case`workflow`:await this.handleWorkflowMessage(r.message,e);continue;case`input`:case`runtime-action-result`:case`timeout`:continue}}}async waitForHeldRequest(e,t,n){let r=new Set(t.authorizationAttemptIds),i=new Set(t.inputRequestIds);for(;;){let t=this.input.queue.takeAuthorizations(r);if(t!==void 0)return{kind:`deliver`,payloads:t};let a=await e.takeInputResponses(i);if(a!==void 0)return a;let o=await e.takeSteering({heldSince:n});if(o!==void 0)return o;let s=await e.nextRuntimeEvent([]);if(s===`cancelled`)return s;s.kind===`workflow`&&await this.handleWorkflowMessage(s.message,e)}}async waitForRuntimeActionResults(e){let t=[...e.initialResults],n=!1,r=new Map,i=new Map;if(e.initialAcceptedAtMs!==void 0)for(let n of t)r.set(n.callId,e.initialAcceptedAtMs);let accept=e=>{t.push(e),r.set(e.callId,Date.now())},a=await this.answerTaskToolCalls(e.taskToolCalls,accept);try{for(;;){a=await this.resolveTaskWaits(a,n,accept);let o=resolveRuntimeActionResultsForCallIds({pendingCallIds:e.pendingCallIds,results:t});if(o!==void 0){let e=o.flatMap(e=>{let t=i.get(e.callId);return t===void 0?[]:[t]});return{acceptedAtMsByCallId:Object.fromEntries(o.map(e=>[e.callId,r.get(e.callId)])),...e.length>0&&{delegatedUsage:e},results:o}}let s=a.flatMap(e=>e.timer===void 0?[]:[e.timer]),c=await e.turn.nextRuntimeEvent(s);if(c===`cancelled`)return c;if(c.kind===`timeout`){for(let e of a)e.callId===c.callId&&(e.timedOut=!0);continue}if(c.kind===`input`)continue;if(c.kind===`steering`){n||await this.interruptWaitedWorkflowCalls(e.pendingCallIds,t),n=!0;continue}if(c.kind===`runtime-action-result`){let e=this.input.cursor.sessionState.snapshot.session.state,n=c.results.filter(t=>t.kind===`tool-result`&&isInboxToolResultFromRecordedWorkflowToolRun(e,t));if(n.length>0){let e=Date.now();t.push(...n);for(let t of n)r.set(t.callId,e)}continue}let l=await this.handleWorkflowMessage(c.message,e.turn);l!==void 0&&(accept(l),c.message.kind===`outcome`&&c.message.usage!==void 0&&i.set(l.callId,c.message.usage))}}finally{for(let e of a)await this.traceTaskWait(e,void 0,!0)}}async resolveTaskWaits(e,t,n){let r=sessionTaskTable(this.input.cursor),i=[];for(let a of e){let e=taskWaitResult(r,{interrupted:t,timedOut:a.timedOut});if(e===void 0){i.push(a);continue}let o=renderTaskWaitResult(e,Date.now()-a.startedAtMs);await this.traceTaskWait(a,o,t),n(taskToolResult(a.callId,TASK_WAIT_TOOL_NAME,o))}return i}async answerTaskToolCalls(e,t){let n=[],r=e.length===0?0:await startTaskToolCallsStep();for(let i of e)if(i.kind===TASK_WAIT_TOOL_NAME)n.push(startTaskWait(i,r));else{let e;try{e=await answerTaskCancel(this.input.cursor,i)}catch(e){throw await this.input.cursor.advance(e=>traceTaskToolCallStep(e,{callId:i.callId,toolName:i.kind,startedAtMs:r,completedAtMs:Date.now(),input:{taskId:i.taskId},failed:!0})),e}await this.input.cursor.advance(t=>traceTaskToolCallStep(t,{callId:i.callId,toolName:i.kind,startedAtMs:r,completedAtMs:Date.now(),input:{taskId:i.taskId},output:e.output})),t(e)}let i=await this.resolveTaskWaits(n,!1,t);return i.length>0&&await this.input.cursor.advance(publishTurnWaitingStep),i}async traceTaskWait(e,t,n=!1){await this.input.cursor.advance(r=>traceTaskToolCallStep(r,{callId:e.callId,toolName:TASK_WAIT_TOOL_NAME,startedAtMs:e.startedAtMs,completedAtMs:Date.now(),input:e.input,output:t,failed:n}))}async interruptWaitedWorkflowCalls(e,t){let n=this.input.cursor.sessionState.snapshot.session.state,r=new Set(t.map(e=>e.callId)),i=e.filter(e=>!r.has(e)).flatMap(e=>{let t=findBlockingWorkflowToolRun(n,e);return t===void 0?[]:[t.address]});await Promise.all(i.map(e=>interruptWorkflowToolRun(e)))}};function startTaskWait(e,t){let{callId:n,timeoutMs:r}=e,i=r===void 0?void 0:sleep(r).then(()=>n);return{callId:n,startedAtMs:t,input:r===void 0?{}:{timeoutSeconds:r/1e3},timedOut:r===0,timer:i}}function mayWaitOnWorkflowToolRuns(e){try{return getBlockingWorkflowToolRuns(e.snapshot?.session?.state).length>0}catch{return!0}}export{SessionExecution,hasDelegatedCallerContext};
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { SessionPrewarmPayload } from "#execution/session-prewarm.js";
|
|
1
2
|
import type { DeliverPayload, HookPayload, SessionCommand } from "#channel/types.js";
|
|
2
3
|
import type { WorkflowToolRunMessage } from "#execution/tools/workflow/messages.js";
|
|
3
4
|
/** All session addresses accept the same protocol. Callback routes construct
|
|
@@ -26,7 +27,7 @@ export interface SessionHandoverPayload {
|
|
|
26
27
|
readonly final?: true;
|
|
27
28
|
readonly payloads: readonly Exclude<SessionInboxPayload, SessionHandoverPayload>[];
|
|
28
29
|
}
|
|
29
|
-
export type SessionInboxPayload = SessionFailurePayload | SessionHandoverPayload | HookPayload | SessionCommand | WorkflowToolRunMessage | AuthorizationCallbackPayload;
|
|
30
|
+
export type SessionInboxPayload = SessionPrewarmPayload | SessionFailurePayload | SessionHandoverPayload | HookPayload | SessionCommand | WorkflowToolRunMessage | AuthorizationCallbackPayload;
|
|
30
31
|
/**
|
|
31
32
|
* While a handover is awaited (see {@link SessionHookBatchClaimOptions.handover}),
|
|
32
33
|
* reads expose nothing; interrupt handlers still fire on arrival.
|
|
@@ -69,6 +70,13 @@ export interface SessionHookClaimOptions {
|
|
|
69
70
|
* token this inbox already holds is claimed again on a fresh hook.
|
|
70
71
|
*/
|
|
71
72
|
readonly force?: boolean;
|
|
73
|
+
/**
|
|
74
|
+
* Creates the hook at once but confirms its registration only after this
|
|
75
|
+
* settles. While a registration is awaited, Workflow queues every step
|
|
76
|
+
* started beside it instead of running it inline, so a claim made next to a
|
|
77
|
+
* step confirms after that step; the hook still commits alongside it.
|
|
78
|
+
*/
|
|
79
|
+
readonly confirmAfter?: Promise<unknown>;
|
|
72
80
|
}
|
|
73
81
|
export interface SessionHookBatchClaimOptions extends SessionHookClaimOptions {
|
|
74
82
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{sessionInboxHookToken}from"#execution/session-inbox/address.js";import{createHook,getWorkflowMetadata}from"#compiled/@workflow/core/index.js";import{claimHookOwnership,disposeHook,isHookForceClaimedError}from"#execution/hook-ownership.js";import{releaseSessionHooksStep}from"#execution/session-inbox/release-step.js";function isInterrupt(e){return e.kind===`cancel`||e.kind===`reset`||e.kind===`session-timeout`||e.kind===`session-failure`}function isDelivery(e){return e.kind===`send`||e.kind===`deliver`}function createSessionInbox(e){let t=[],n=[],r=new Set,i=new Set,a=new Set,o,s,c=new Set,l=new Set,u=!1,d=!1,notify=()=>{for(let e of r)e();r.clear()},wait=()=>new Promise(e=>r.add(e)),closed=()=>t.every(e=>e.closed||e.stopping),gated=()=>s!==void 0&&t.length>0,hasReadable=()=>!gated()&&n.length>0,throwIfFailed=()=>{if(o!==void 0)throw o.error},observe=(e,t,n)=>{for(let r of t)if(n(r))for(let t of e)t(r)},openHandover=()=>{s=void 0,observe(a,n,isDelivery),notify()},blockedOnHandover=()=>{if(gated()){for(let e of c)e();c.clear()}},acceptHandover=e=>{let t=s;if(t===void 0||e.attemptKey!==t.attemptKey||e.index<t.nextPart||t.parts.has(e.index))return;t.parts.set(e.index,e);let r=[];for(;;){let e=t.parts.get(t.nextPart);if(e===void 0)break;if(e.final===!0){observe(i,r,isInterrupt),openHandover();return}t.parts.delete(t.nextPart),t.nextPart+=1,n.splice(t.index,0,...e.payloads),t.index+=e.payloads.length,r.push(...e.payloads)}observe(i,r,isInterrupt),notify()},pump=async e=>{let r=e.hook[Symbol.asyncIterator]();try{for(;!e.stopping;){let e=await r.next();if(e.done)break;let t=e.value;for(let e of l)e();if(l.clear(),t.kind===`workflow-batch`){n.push(...t.messages),notify();continue}if(t.kind===`handover`){acceptHandover(t);continue}n.push(t),gated()||observe(a,[t],isDelivery),observe(i,[t],isInterrupt),notify()}}catch(n){if(e.stopping||e.replaced)return;isHookForceClaimedError(n)?(t.splice(t.indexOf(e),1),u=!0):o={error:n}}finally{e.closed=!0,notify()}},stop=async()=>{let e=t.splice(0);s=void 0,u=!1,d=!0;for(let t of e)t.stopping=!0;notify(),await Promise.all(e.map(({hook:e})=>disposeHook(e)));let r=n.splice(0);return notify(),r},claimSessionHook=async(n,r={})=>{if(!n)throw Error(`A session alias requires a nonempty continuation token.`);let i=r.force===!0,a=t.find(e=>e.token===n);if(a!==void 0&&!i)return await a.registered;if(a===void 0&&t.length>=256)throw Error(`A session may claim at most 256 addresses.`);let o={token:n,hook:createHook({token:sessionInboxHookToken(n),metadata:{sessionId:e},...i&&{experimental_force:!0}}),stopping:!1,closed:!1,replaced:!1};a===void 0?t.push(o):(a.replaced=!0,t.splice(t.indexOf(a),1,o)),d=!1;try{
|
|
1
|
+
import{sessionInboxHookToken}from"#execution/session-inbox/address.js";import{createHook,getWorkflowMetadata}from"#compiled/@workflow/core/index.js";import{claimHookOwnership,disposeHook,isHookForceClaimedError}from"#execution/hook-ownership.js";import{releaseSessionHooksStep}from"#execution/session-inbox/release-step.js";function isInterrupt(e){return e.kind===`cancel`||e.kind===`reset`||e.kind===`session-timeout`||e.kind===`session-failure`}function isDelivery(e){return e.kind===`send`||e.kind===`deliver`}function createSessionInbox(e){let t=[],n=[],r=new Set,i=new Set,a=new Set,o,s,c=new Set,l=new Set,u=!1,d=!1,notify=()=>{for(let e of r)e();r.clear()},wait=()=>new Promise(e=>r.add(e)),closed=()=>t.every(e=>e.closed||e.stopping),gated=()=>s!==void 0&&t.length>0,hasReadable=()=>!gated()&&n.length>0,throwIfFailed=()=>{if(o!==void 0)throw o.error},observe=(e,t,n)=>{for(let r of t)if(n(r))for(let t of e)t(r)},openHandover=()=>{s=void 0,observe(a,n,isDelivery),notify()},blockedOnHandover=()=>{if(gated()){for(let e of c)e();c.clear()}},acceptHandover=e=>{let t=s;if(t===void 0||e.attemptKey!==t.attemptKey||e.index<t.nextPart||t.parts.has(e.index))return;t.parts.set(e.index,e);let r=[];for(;;){let e=t.parts.get(t.nextPart);if(e===void 0)break;if(e.final===!0){observe(i,r,isInterrupt),openHandover();return}t.parts.delete(t.nextPart),t.nextPart+=1,n.splice(t.index,0,...e.payloads),t.index+=e.payloads.length,r.push(...e.payloads)}observe(i,r,isInterrupt),notify()},pump=async e=>{let r=e.hook[Symbol.asyncIterator]();try{for(;!e.stopping;){let e=await r.next();if(e.done)break;let t=e.value;for(let e of l)e();if(l.clear(),t.kind===`workflow-batch`){n.push(...t.messages),notify();continue}if(t.kind===`handover`){acceptHandover(t);continue}n.push(t),gated()||observe(a,[t],isDelivery),observe(i,[t],isInterrupt),notify()}}catch(n){if(e.stopping||e.replaced)return;isHookForceClaimedError(n)?(t.splice(t.indexOf(e),1),u=!0):o={error:n}}finally{e.closed=!0,notify()}},stop=async()=>{let e=t.splice(0);s=void 0,u=!1,d=!0;for(let t of e)t.stopping=!0;notify(),await Promise.all(e.map(({hook:e})=>disposeHook(e)));let r=n.splice(0);return notify(),r},claimSessionHook=async(n,r={})=>{if(!n)throw Error(`A session alias requires a nonempty continuation token.`);let i=r.force===!0,a=t.find(e=>e.token===n);if(a!==void 0&&!i)return await a.registered;if(a===void 0&&t.length>=256)throw Error(`A session may claim at most 256 addresses.`);let o={token:n,hook:createHook({token:sessionInboxHookToken(n),metadata:{sessionId:e},...i&&{experimental_force:!0}}),stopping:!1,closed:!1,replaced:!1};a===void 0?t.push(o):(a.replaced=!0,t.splice(t.indexOf(a),1,o)),d=!1;try{let confirm=()=>claimHookOwnership(o.hook);o.registered=r.confirmAfter?.then(confirm,confirm)??confirm(),await o.registered,u=!1,pump(o)}catch(e){throw a===void 0||a.closed?t.splice(t.indexOf(o),1):(a.replaced=!1,t.splice(t.indexOf(o),1,a)),e}};return{get claimedTokens(){return t.map(({token:e})=>e)},get awaitingHandover(){return s!==void 0},async whenHandoverSettled(){for(;s!==void 0;)await wait()},abandonHandover(e){s?.attemptKey===e&&openHandover()},whenBlockedOnHandover(){return new Promise(e=>c.add(e))},whenArrival(){return new Promise(e=>l.add(e))},get takenOver(){return u&&t.length===0},claimSessionHook,async claimSessionHooks(e,t={}){t.handover!==void 0&&(s={attemptKey:t.handover,index:n.length,nextPart:0,parts:new Map});let r=await Promise.allSettled([...new Set(e)].map(e=>claimSessionHook(e,t)));for(let e of r)if(e.status===`rejected`)throw e.reason},async whenTakenOver(e){for(e?.addEventListener(`abort`,notify,{once:!0});t.length>0||!u;){if(throwIfFailed(),d)throw Error(`The session inbox was released before a takeover.`);if(e?.aborted===!0)throw e.reason;await wait()}},async next(){for(;;){if(throwIfFailed(),hasReadable())return n.shift();if(closed())return;blockedOnHandover(),await wait()}},drain(){return throwIfFailed(),gated()?[]:n.splice(0)},takeLeading(e){throwIfFailed();let t=[];if(gated())return t;for(let r=n[0];r!==void 0&&e(r);r=n[0])t.push(r),n.shift();return t},hasPending(){return throwIfFailed(),hasReadable()},async whenPending(){for(;o===void 0&&!hasReadable()&&!closed();)blockedOnHandover(),await wait()},onInterrupt(e){return i.add(e),()=>i.delete(e)},onDelivery(e){if(a.add(e),!gated())for(let t of n)isDelivery(t)&&e(t);return()=>a.delete(e)},restore(e){if(t.length===0)throw Error(`Cannot restore session commands before reclaiming the session hooks.`);n.unshift(...e),s!==void 0&&(s.index+=e.length),notify()},async dispose(){await stop()},async release(){return t.length>0&&await releaseSessionHooksStep({ownerRunId:getWorkflowMetadata().workflowRunId,tokens:t.map(({hook:e})=>e.token)}),await stop()}}}function isWorkflowMessage(e){return e.kind===`agent-started`||e.kind===`started`||e.kind===`report`||e.kind===`reply`||e.kind===`request`||e.kind===`withdraw`||e.kind===`usage`||e.kind===`outcome`}export{createSessionInbox,isInterrupt,isWorkflowMessage};
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { DeliverHookPayload, SessionCommand, SessionTimeoutHookPayload } from "#channel/types.js";
|
|
2
|
-
type
|
|
2
|
+
import type { SessionPrewarmPayload } from "#execution/session-prewarm.js";
|
|
3
|
+
type DecodedSessionInbox = SessionPrewarmPayload | DeliverHookPayload | SessionTimeoutHookPayload | Extract<SessionCommand, {
|
|
3
4
|
readonly kind: "cancel" | "clear" | "compact" | "reset";
|
|
4
5
|
}>;
|
|
5
6
|
/** Invalid current-generation inbox payload. Historical wire shapes are not accepted. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var SessionInboxPayloadError=class extends Error{constructor(e){super(e),this.name=`SessionInboxPayloadError`}};function decodeSessionInboxPayload(e){if(typeof e!=`object`||!e||!(`kind`in e))throw new SessionInboxPayloadError(`Session inbox payload must be an object with a kind.`);let t=e;switch(t.kind){case`send`:{if(t.payload===null||typeof t.payload!=`object`)throw new SessionInboxPayloadError(`Session send payload must be an object.`);let n=e;return{auth:n.auth,schedule:n.schedule,title:n.title,caller:n.caller,deliveryMetadata:n.delivery===void 0?void 0:[{...n.delivery,payloadIndex:0}],kind:`deliver`,payloads:[n.payload],requestId:n.requestId,turnPolicy:n.turnPolicy}}case`deliver`:if(!Array.isArray(t.payloads))throw new SessionInboxPayloadError(`Session delivery payloads must be an array.`);return e;case`cancel`:case`clear`:case`compact`:case`reset`:case`session-timeout`:return e;default:throw new SessionInboxPayloadError(`Unsupported session inbox payload kind ${JSON.stringify(t.kind)}.`)}}export{SessionInboxPayloadError,decodeSessionInboxPayload};
|
|
1
|
+
import{validateDeliveryIdempotencyKey}from"#channel/delivery-idempotency.js";var SessionInboxPayloadError=class extends Error{constructor(e){super(e),this.name=`SessionInboxPayloadError`}};function decodeSessionInboxPayload(e){if(typeof e!=`object`||!e||!(`kind`in e))throw new SessionInboxPayloadError(`Session inbox payload must be an object with a kind.`);let t=e;if(t.kind===`send`||t.kind===`deliver`)try{validateDeliveryIdempotencyKey(t.idempotencyKey)}catch(e){throw new SessionInboxPayloadError(e.message)}switch(t.kind){case`send`:{if(t.payload===null||typeof t.payload!=`object`)throw new SessionInboxPayloadError(`Session send payload must be an object.`);let n=e;return{idempotencyKey:n.idempotencyKey,auth:n.auth,schedule:n.schedule,title:n.title,caller:n.caller,deliveryMetadata:n.delivery===void 0?void 0:[{...n.delivery,payloadIndex:0}],kind:`deliver`,payloads:[n.payload],requestId:n.requestId,turnPolicy:n.turnPolicy}}case`deliver`:if(!Array.isArray(t.payloads))throw new SessionInboxPayloadError(`Session delivery payloads must be an array.`);return e;case`session-prewarm`:if(typeof t.expectedOwnerRunId!=`string`||typeof t.targetDeploymentId!=`string`||t.targetDeploymentId.length===0||t.targetDeploymentId===`latest`)throw new SessionInboxPayloadError(`Invalid session prewarm hint.`);return e;case`cancel`:case`clear`:case`compact`:case`reset`:case`session-timeout`:return e;default:throw new SessionInboxPayloadError(`Unsupported session inbox payload kind ${JSON.stringify(t.kind)}.`)}}export{SessionInboxPayloadError,decodeSessionInboxPayload};
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { SessionPrewarmPayload } from "#execution/session-prewarm.js";
|
|
1
2
|
import type { SessionFailurePayload } from "#execution/session-inbox/inbox.js";
|
|
2
3
|
import type { DeliverHookPayload, SessionCommand, SessionTimeoutHookPayload } from "#channel/types.js";
|
|
3
4
|
import { type SessionInboxAddress } from "#execution/session-inbox/address.js";
|
|
@@ -15,7 +16,7 @@ export interface ResumedSessionInboxHook {
|
|
|
15
16
|
* The retry window bounds this request, not the handoff: a marker that
|
|
16
17
|
* outlives it throws {@link SessionHandoffPendingError}.
|
|
17
18
|
*/
|
|
18
|
-
export declare function resumeSessionInbox(address: string | SessionInboxAddress, command: DeliverHookPayload | SessionCommand | SessionTimeoutHookPayload | SessionFailurePayload): Promise<ResumedSessionInboxHook>;
|
|
19
|
+
export declare function resumeSessionInbox(address: string | SessionInboxAddress, command: DeliverHookPayload | SessionCommand | SessionTimeoutHookPayload | SessionFailurePayload | SessionPrewarmPayload): Promise<ResumedSessionInboxHook>;
|
|
19
20
|
/**
|
|
20
21
|
* The address's owner is still handing off after the request's retry window.
|
|
21
22
|
* Nothing was delivered. The address is not unowned, so callers must not start
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{isObject}from"#shared/guards.js";import{SESSION_INBOX_SESSION_ID_METADATA_KEY,isSessionInboxAddress,sessionCommandHookToken,sessionHandoffMarkerToken,sessionInboxHookToken}from"#execution/session-inbox/address.js";import{getHookByToken}from"#internal/workflow/runtime.js";import{HookNotFoundError}from"#compiled/@workflow/errors/index.js";import{assertRunnableSessionOwner,lookupSessionOwnerHook,resumeRunnableHook}from"#execution/session-inbox/owner.js";import{UnsupportedLegacySessionError,resolveLegacyInbox,resumeLegacyInbox}from"#execution/legacy-session/inbox.js";async function resumeSessionInbox(e,t){let n=logicalSessionToken(e),r=typeof e==`string`?void 0:e.sessionId,i=Date.now()+5e3;for(;;){let e;try{e=await resumeRunnableHook(sessionInboxHookToken(n),t)}catch(e){if(!HookNotFoundError.is(e))throw e;if(await waitWhileHandoffInProgress(n,i))continue;if(t.kind===`session-failure`)throw e;return await resumeLegacyInbox(n,t).catch(rethrowUnsupportedAsNotFound)}let a;return{ownerRunId:e.runId,get sessionId(){return a??=(async()=>{try{return r??requireSessionId(await e.metadata)}catch(e){throw new AcceptedSessionIdentityError(e)}})()}}}}var SessionHandoffPendingError=class extends Error{constructor(e){super(`Session address "${e}" is still changing owners. Nothing was delivered; retry the request.`),this.name=`SessionHandoffPendingError`}},AcceptedSessionIdentityError=class extends Error{constructor(e){super(`Session command accepted, but its session identity could not be resolved.`,{cause:e}),this.name=`AcceptedSessionIdentityError`}};function requireSessionId(e){let t=isObject(e)?e[SESSION_INBOX_SESSION_ID_METADATA_KEY]:void 0;if(typeof t!=`string`||t.length===0)throw Error(`Session hook metadata is missing its session ID.`);return t}async function resolveSessionInbox(e){try{return{sessionId:requireSessionId(await(await getHookByToken(sessionInboxHookToken(e))).metadata)}}catch(t){if(!HookNotFoundError.is(t))throw t;return{sessionId:(await resolveLegacyInbox(e)).sessionId}}}function rethrowUnsupportedAsNotFound(e){throw e instanceof UnsupportedLegacySessionError?new HookNotFoundError(e.message):e}function logicalSessionToken(e){if(typeof e==`string`)return e;if(!isSessionInboxAddress(e))throw Error(`Session inbox target has an invalid address.`);return sessionCommandHookToken(e.sessionId)}async function waitWhileHandoffInProgress(e,t){let n;try{n=await lookupSessionOwnerHook(sessionHandoffMarkerToken(e))}catch(e){if(HookNotFoundError.is(e))return!1;throw e}if(Date.now()>=t)throw await assertRunnableSessionOwner(n),new SessionHandoffPendingError(e);return await new Promise(e=>setTimeout(e,20)),!0}export{AcceptedSessionIdentityError,SessionHandoffPendingError,logicalSessionToken,requireSessionId,resolveSessionInbox,resumeSessionInbox};
|
|
1
|
+
import{isObject}from"#shared/guards.js";import{SESSION_INBOX_SESSION_ID_METADATA_KEY,isSessionInboxAddress,sessionCommandHookToken,sessionHandoffMarkerToken,sessionInboxHookToken}from"#execution/session-inbox/address.js";import{getHookByToken}from"#internal/workflow/runtime.js";import{HookNotFoundError}from"#compiled/@workflow/errors/index.js";import{assertRunnableSessionOwner,lookupSessionOwnerHook,resumeRunnableHook}from"#execution/session-inbox/owner.js";import{UnsupportedLegacySessionError,resolveLegacyInbox,resumeLegacyInbox}from"#execution/legacy-session/inbox.js";async function resumeSessionInbox(e,t){let n=logicalSessionToken(e),r=typeof e==`string`?void 0:e.sessionId,i=Date.now()+5e3;for(;;){let e;try{e=await resumeRunnableHook(sessionInboxHookToken(n),t)}catch(e){if(!HookNotFoundError.is(e))throw e;if(await waitWhileHandoffInProgress(n,i))continue;if(t.kind===`session-failure`||t.kind===`session-prewarm`)throw e;return await resumeLegacyInbox(n,t).catch(rethrowUnsupportedAsNotFound)}let a;return{ownerRunId:e.runId,get sessionId(){return a??=(async()=>{try{return r??requireSessionId(await e.metadata)}catch(e){throw new AcceptedSessionIdentityError(e)}})()}}}}var SessionHandoffPendingError=class extends Error{constructor(e){super(`Session address "${e}" is still changing owners. Nothing was delivered; retry the request.`),this.name=`SessionHandoffPendingError`}},AcceptedSessionIdentityError=class extends Error{constructor(e){super(`Session command accepted, but its session identity could not be resolved.`,{cause:e}),this.name=`AcceptedSessionIdentityError`}};function requireSessionId(e){let t=isObject(e)?e[SESSION_INBOX_SESSION_ID_METADATA_KEY]:void 0;if(typeof t!=`string`||t.length===0)throw Error(`Session hook metadata is missing its session ID.`);return t}async function resolveSessionInbox(e){try{return{sessionId:requireSessionId(await(await getHookByToken(sessionInboxHookToken(e))).metadata)}}catch(t){if(!HookNotFoundError.is(t))throw t;return{sessionId:(await resolveLegacyInbox(e)).sessionId}}}function rethrowUnsupportedAsNotFound(e){throw e instanceof UnsupportedLegacySessionError?new HookNotFoundError(e.message):e}function logicalSessionToken(e){if(typeof e==`string`)return e;if(!isSessionInboxAddress(e))throw Error(`Session inbox target has an invalid address.`);return sessionCommandHookToken(e.sessionId)}async function waitWhileHandoffInProgress(e,t){let n;try{n=await lookupSessionOwnerHook(sessionHandoffMarkerToken(e))}catch(e){if(HookNotFoundError.is(e))return!1;throw e}if(Date.now()>=t)throw await assertRunnableSessionOwner(n),new SessionHandoffPendingError(e);return await new Promise(e=>setTimeout(e,20)),!0}export{AcceptedSessionIdentityError,SessionHandoffPendingError,logicalSessionToken,requireSessionId,resolveSessionInbox,resumeSessionInbox};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { PrewarmSessionResult } from "#protocol/prewarm-session.js";
|
|
2
|
+
/** Internal hint, scoped to the owner inspected by ingress to avoid stale transfers. */
|
|
3
|
+
export interface SessionPrewarmPayload {
|
|
4
|
+
readonly kind: "session-prewarm";
|
|
5
|
+
readonly expectedOwnerRunId: string;
|
|
6
|
+
readonly targetDeploymentId: string;
|
|
7
|
+
}
|
|
8
|
+
export declare function prewarmWorkflowSession(sessionId: string, targetDeploymentId: string | undefined): Promise<PrewarmSessionResult>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{sessionCommandHookToken,sessionInboxHookToken}from"#execution/session-inbox/address.js";import{getHookByToken,getWorld}from"#internal/workflow/runtime.js";import{resumeSessionInbox}from"#execution/session-inbox/resume.js";import{HookNotFoundError}from"#compiled/@workflow/errors/index.js";import{EVE_PREWARM_ATTRIBUTE}from"#execution/eve-workflow-attributes.js";async function prewarmWorkflowSession(e,t){if(t===void 0||t.length===0||t===`latest`)return{status:`unsupported`};let n=await getWorld();if(n.capabilities?.deploymentAffinity!==!0)return{status:`unsupported`};let r;try{r=await getHookByToken(sessionInboxHookToken(sessionCommandHookToken(e)))}catch(e){if(HookNotFoundError.is(e))return{status:`no_active_session`};throw e}let i=await n.runs.get(r.runId,{resolveData:`none`});return i.status!==`running`&&i.status!==`pending`?{status:`no_active_session`}:i.deploymentId===t?{status:`ready`}:i.attributes[EVE_PREWARM_ATTRIBUTE]===`1`?(await resumeSessionInbox({sessionId:e},{kind:`session-prewarm`,expectedOwnerRunId:r.runId,targetDeploymentId:t}),{status:`accepted`}):{status:`unsupported`}}export{prewarmWorkflowSession};
|
|
@@ -1,17 +1,6 @@
|
|
|
1
1
|
import type { DurableSession } from "#execution/durable-session-store.js";
|
|
2
2
|
import type { HarnessSession, HarnessSessionBase } from "#harness/types.js";
|
|
3
3
|
import type { RuntimeTurnAgent } from "#runtime/agent/bootstrap.js";
|
|
4
|
-
export declare const DEFAULT_ROOT_MAX_INPUT_TOKENS_PER_SESSION = 40000000;
|
|
5
|
-
/**
|
|
6
|
-
* Authored session token limits before resolution. `false` means the author
|
|
7
|
-
* explicitly uncapped the axis (skipping the root default). Resolution maps
|
|
8
|
-
* this shape onto the numeric {@link SessionLimits} the harness checks.
|
|
9
|
-
*/
|
|
10
|
-
interface AuthoredSessionLimits {
|
|
11
|
-
readonly maxInputTokensPerSession?: number | false;
|
|
12
|
-
readonly maxOutputTokensPerSession?: number | false;
|
|
13
|
-
readonly maxTokenCostUsdPerSession?: number | false;
|
|
14
|
-
}
|
|
15
4
|
/**
|
|
16
5
|
* Creates the durable compaction configuration used by one harness session.
|
|
17
6
|
*/
|
|
@@ -44,7 +33,6 @@ interface CreateSessionInput {
|
|
|
44
33
|
readonly rootSessionId?: string;
|
|
45
34
|
readonly sessionId: string;
|
|
46
35
|
readonly turnAgent: RuntimeTurnAgent;
|
|
47
|
-
readonly limits?: AuthoredSessionLimits;
|
|
48
36
|
readonly outputSchema?: HarnessSession["outputSchema"];
|
|
49
37
|
}
|
|
50
38
|
/** Creates a fresh {@link HarnessSession} from the current `turnAgent`. */
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{formatAvailableSkillsSection}from"#execution/skills/instructions.js";
|
|
1
|
+
import{formatAvailableSkillsSection}from"#execution/skills/instructions.js";function createCompactionConfig(e={}){let t=e.thresholdPercent??.9,n={recentWindowSize:10,threshold:e.contextWindowTokens===void 0?1e5:Math.max(1,Math.floor(e.contextWindowTokens*t)),thresholdPercent:t};return e.lastKnownInputTokens===void 0?n:{...n,lastKnownInputTokens:e.lastKnownInputTokens,lastKnownPromptMessageCount:e.lastKnownPromptMessageCount}}function createSession(e){let{turnAgent:t}=e,n=createSessionToolDefinitions(t),r={agent:createSessionAgent(t,createSessionSystemPrompt(t),n),compaction:createCompactionConfig({contextWindowTokens:t.model?.contextWindowTokens,thresholdPercent:e.compactionOverrides?.thresholdPercent}),continuationToken:e.continuationToken,history:[...t.initialMessages??[]],sessionId:e.sessionId};return e.rootSessionId!==void 0&&(r.rootSessionId=e.rootSessionId),e.outputSchema!==void 0&&(r.outputSchema=e.outputSchema),r}function createSessionAgent(e,t,n){let r={compactionModelReference:e.compactionModel,reasoning:e.reasoning,system:t,tools:n};if(e.model!==void 0)return{...r,modelReference:e.model};if(e.dynamicModel!==void 0)return{...r,dynamicModel:!0};throw Error(`Cannot create a session before dynamic subagent config is selected.`)}function refreshSessionFromTurnAgent(e){return{...e.session,agent:createSessionAgent(e.turnAgent,createSessionSystemPrompt(e.turnAgent),createSessionToolDefinitions(e.turnAgent)),compaction:createCompactionConfig({contextWindowTokens:e.turnAgent.model?.contextWindowTokens,lastKnownInputTokens:e.session.compaction.lastKnownInputTokens,lastKnownPromptMessageCount:e.session.compaction.lastKnownPromptMessageCount,thresholdPercent:e.compactionOverrides?.thresholdPercent})}}function createSessionSystemPrompt(e){let t=formatAvailableSkillsSection(e.listedSkills??[]);return(t===null?e.instructions:[...e.instructions,t]).join(`
|
|
2
2
|
|
|
3
|
-
`)}function mintSubagentContinuationToken(e){return`subagent:${e??crypto.randomUUID()}`}function projectToDurableSession(e){let t={agent:{system:e.agent.system},continuationToken:e.continuationToken,sessionId:e.sessionId};return(e.compaction.lastKnownInputTokens!==void 0||e.compaction.lastKnownPromptMessageCount!==void 0)&&(t.compaction={lastKnownInputTokens:e.compaction.lastKnownInputTokens,lastKnownPromptMessageCount:e.compaction.lastKnownPromptMessageCount}),e.rootSessionId!==void 0&&(t.rootSessionId=e.rootSessionId),e.
|
|
3
|
+
`)}function mintSubagentContinuationToken(e){return`subagent:${e??crypto.randomUUID()}`}function projectToDurableSession(e){let t={agent:{system:e.agent.system},continuationToken:e.continuationToken,sessionId:e.sessionId};return(e.compaction.lastKnownInputTokens!==void 0||e.compaction.lastKnownPromptMessageCount!==void 0)&&(t.compaction={lastKnownInputTokens:e.compaction.lastKnownInputTokens,lastKnownPromptMessageCount:e.compaction.lastKnownPromptMessageCount}),e.rootSessionId!==void 0&&(t.rootSessionId=e.rootSessionId),e.outputSchema!==void 0&&(t.outputSchema=e.outputSchema),e.sandboxState!==void 0&&(t.sandboxState=e.sandboxState),e.state!==void 0&&(t.state=e.state),t}function hydrateDurableSession(e){let{durable:t,turnAgent:n}=e,r=createSessionToolDefinitions(n),i={agent:createSessionAgent(n,t.agent.system,r),compaction:createCompactionConfig({contextWindowTokens:n.model?.contextWindowTokens,lastKnownInputTokens:t.compaction?.lastKnownInputTokens,lastKnownPromptMessageCount:t.compaction?.lastKnownPromptMessageCount,thresholdPercent:e.compactionOverrides?.thresholdPercent}),continuationToken:t.continuationToken,sessionId:t.sessionId};return t.rootSessionId!==void 0&&(i.rootSessionId=t.rootSessionId),t.outputSchema!==void 0&&(i.outputSchema=t.outputSchema),t.sandboxState!==void 0&&(i.sandboxState=t.sandboxState),t.state!==void 0&&(i.state=t.state),i}function createSessionToolDefinitions(e){return e.tools.map(e=>({description:e.description??``,inputSchema:e.inputSchema,name:e.name,outputSchema:e.outputSchema}))}export{createCompactionConfig,createSession,hydrateDurableSession,mintSubagentContinuationToken,projectToDurableSession,refreshSessionFromTurnAgent};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{currentProjection}from"#harness/session-machine/current.js";import{runtimeWait,storedProjection}from"#harness/session-machine/view.js";import{getTurnUsageState,takeSessionUsageDelta}from"#harness/turn-tag-state.js";import{removeBlockingWorkflowToolRuns}from"#harness/workflow-tool-runs.js";import{retireCancelledCandidates}from"#harness/hitl/index.js";import{publishFromSessionStep,restoreSessionStep}from"#execution/publish-session-events.js";import{withSessionStateDelta}from"#execution/session/state-delta.js";import{
|
|
1
|
+
import{currentProjection}from"#harness/session-machine/current.js";import{runtimeWait,storedProjection}from"#harness/session-machine/view.js";import{getTurnUsageState,takeSessionUsageDelta}from"#harness/turn-tag-state.js";import{removeBlockingWorkflowToolRuns}from"#harness/workflow-tool-runs.js";import{retireCancelledCandidates}from"#harness/hitl/index.js";import{publishFromSessionStep,restoreSessionStep}from"#execution/publish-session-events.js";import{withSessionStateDelta}from"#execution/session/state-delta.js";import{cancel}from"#harness/session-machine/transitions.js";import{applyTransition,sessionView}from"#harness/session-machine/commit.js";async function settleCancelledTurnStep(e){"use step";return await withSessionStateDelta(e,settleCancelledTurn)}async function settleCancelledTurn(e){let t={...await restoreSessionStep(e),history:e.history},n=t.durableSession.state,r=runtimeWait(n)?.event.turnId??storedProjection(n).activeTurnId??``,{published:i,result:a}=await publishFromSessionStep(t,{origin:`own`,publish:(e,n)=>applyTransition(n,cancel(sessionView(currentProjection(t.ctx),n.state)),e),updateSession(t,n){let i=removeBlockingWorkflowToolRuns(retireCancelledCandidates({...n,outputSchema:void 0}),r);if(!e.reportUsage||getTurnUsageState(n.state)===void 0)return{session:i};let a=takeSessionUsageDelta(i);return{result:a.delta,session:a.session}}});return a===void 0?i:{...i,usage:a}}export{settleCancelledTurn,settleCancelledTurnStep};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{SKILL_TOOL_NAME}from"#protocol/catalog-tools.js";import{
|
|
1
|
+
import{SKILL_TOOL_NAME}from"#protocol/catalog-tools.js";import{MODEL_SKILL_ROOT}from"#shared/skill-paths.js";const ANNOUNCEMENT_KEY=`skills`;function formatAvailableSkillsSection(e){return e.length===0?null:[`Available skills`,`Listed skills are available in this run. Do not claim a listed skill is inaccessible unless activation or workspace inspection actually fails.`,`Dynamic skill announcements replace earlier dynamic skills and override static skills with the same name. Static skills omitted from a dynamic announcement remain available.`,`If the user names a skill or the request clearly matches one of the descriptions below, load it with ${SKILL_TOOL_NAME}({ name }) before proceeding.`,`If multiple skills match, activate the minimal set that covers the task. After activation, follow the returned instructions instead of improvising around them.`,`If activation fails, say so briefly and continue with the best available alternative.`,`Skill files live under \`${MODEL_SKILL_ROOT}/<skill>/\`, with \`skills/<skill>/\` under the workspace root as the fallback when \`$HOME\` is unavailable.`,"When a loaded SKILL.md mentions sibling files such as `references/foo.md`, resolve them relative to the directory containing that specific SKILL.md.",...e.map(formatAvailableSkillLine)].join(`
|
|
2
2
|
`)}function dynamicSkillAnnouncements(e,t){let n=Object.values(e??{}).flat().filter(e=>e.deferred!==!0);if(n.length===0&&t?.[ANNOUNCEMENT_KEY]===void 0)return{};let r=formatAvailableSkillsSection(n.map(({description:e,name:t,revision:n})=>({description:e,hasFiles:n!==void 0,name:t})))??`Available skills: none`;return{[ANNOUNCEMENT_KEY]:{value:r,render:()=>r}}}function formatAvailableSkillLine(e){let t=`- ${e.name}: ${e.description}`;return e.hasFiles===!1?t:`${t} (path: ${skillFilePath(e.name)})`}function skillFilePath(e){return`${MODEL_SKILL_ROOT}/${e}/SKILL.md`}export{dynamicSkillAnnouncements,formatAvailableSkillsSection,skillFilePath};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{TASK_CANCEL_TOOL_NAME,TASK_WAIT_TOOL_NAME}from"#protocol/task-tools.js";import{createFrameworkUserMessage}from"#harness/messages.js";import{FINAL_REPLY_TASK_SYSTEM_BLOCK,TASKS_NOTE_LABEL,TASK_SYSTEM_BLOCK,renderModelOutputText,renderTaskResults,renderTasksNote}from"#execution/tasks/render.js";import{
|
|
1
|
+
import{TASK_CANCEL_TOOL_NAME,TASK_WAIT_TOOL_NAME}from"#protocol/task-tools.js";import{createFrameworkUserMessage}from"#harness/messages.js";import{FINAL_REPLY_TASK_SYSTEM_BLOCK,TASKS_NOTE_LABEL,TASK_SYSTEM_BLOCK,renderModelOutputText,renderTaskResults,renderTasksNote}from"#execution/tasks/render.js";import{entryPointOf,isAgentTool}from"#execution/tasks/tool-entry-point.js";import{createTask,idleTasks,readTaskTable,takeTaskResults,workingTasks,writeTaskTable}from"#execution/tasks/table.js";import{observeToolOutput}from"#tool-stubs/execute.js";import{splitTaskIdInput}from"#execution/tasks/task-id-input.js";import{taskCancelTool}from"#tools/provided/task-cancel.js";import{taskWaitTool}from"#tools/provided/task-wait.js";function isTaskTool(e){return e?.frameworkAction===`task-wait`||e?.frameworkAction===`task-cancel`}function isWorkflowTool(e){return e?.workflowId!==void 0||isTaskTool(e)}function withTaskTools(e){return new Map([...e,[TASK_WAIT_TOOL_NAME,taskWaitTool],[TASK_CANCEL_TOOL_NAME,taskCancelTool]])}function taskSystemMessages(e,t){return e?[{content:t.finalReplyOnly?FINAL_REPLY_TASK_SYSTEM_BLOCK:TASK_SYSTEM_BLOCK,role:`system`}]:[]}function commitCallEntry(e,t){let n=entryPointOf(t.definition);switch(n){case`execute`:return{entry:{entryPoint:n},input:t.input,session:e};case`task`:return commitTask(e,t,n,t.input);case`serve`:{let{input:r,taskId:i}=splitTaskIdInput(t.input);return i===void 0?commitTask(e,t,n,r):{entry:{entryPoint:`receive`,taskId:i},input:r,session:e}}}}function commitTask(e,t,n,r){let i=createTask(readTaskTable(e.state),{callId:t.callId,kind:isAgentTool(t.definition)?`agent`:`tool`,name:t.toolName,resumable:n===`serve`,turnId:t.turnId});return{entry:{entryPoint:n,taskId:i.taskId},input:r,session:writeTaskTable(e,i.table)}}function workingTaskIds(e){return workingTasks(readTaskTable(e.state)).map(e=>e.id)}async function appendTaskContext(e){let t=[],n=await deliverTaskResults(e);n.message!==void 0&&t.push(createFrameworkUserMessage(`task.result`,n.message));let r=resolveTasksNote({messages:e.projectHistory([...e.messages,...t],n.session.state),session:n.session});return r!==void 0&&t.push(createFrameworkUserMessage(`context.state`,r)),{messages:t,session:n.session}}async function deliverTaskResults(e){let{table:t,taken:n}=takeTaskResults(readTaskTable(e.session.state));if(n.length===0)return{session:e.session};let r=[];for(let t of n)for(let n of t.results)r.push(await toResultBlock(t,n,e.tools.get(t.name)));return{message:renderTaskResults(r),session:writeTaskTable(e.session,t)}}async function toResultBlock(e,t,n){let r={taskId:e.id,tool:e.name};return t.status===`failed`?{...r,body:t.error,status:`failed`}:{...r,body:await projectOutput(e.name,t,n),status:`completed`}}async function projectOutput(e,t,n){return n?.toModelOutput===void 0?renderModelOutputText(t.output):await observeToolOutput(e,t.calls??[],async()=>renderModelOutputText(await n.toModelOutput(t.output)),()=>renderModelOutputText(t.output))}function resolveTasksNote(e){let t=readTaskTable(e.session.state),n=workingTasks(t).map(toListedTask),r=idleTasks(t).map(toListedTask),i=e.messages.findLast(isTasksNote);if(i===void 0&&n.length===0&&r.length===0)return;let a=renderTasksNote({idle:r,working:n});return i?.content===a?void 0:a}function toListedTask(e){return{id:e.id,tool:e.name}}function isTasksNote(e){return e.role===`user`&&typeof e.content==`string`&&e.content.startsWith(TASKS_NOTE_LABEL)}export{appendTaskContext,commitCallEntry,isTaskTool,isWorkflowTool,taskSystemMessages,withTaskTools,workingTaskIds};
|
|
@@ -6,7 +6,7 @@ import type { RuntimeToolResultActionResult, RuntimeWorkflowTaskRequest, Workflo
|
|
|
6
6
|
type TaskDispatchInput = StartWorkflowTaskInput & {
|
|
7
7
|
readonly taskId: string;
|
|
8
8
|
};
|
|
9
|
-
/** The call's answer, and the task start the dispatch
|
|
9
|
+
/** The call's answer, and the task start the dispatch reports for it. */
|
|
10
10
|
interface TaskDispatchResult {
|
|
11
11
|
readonly result: RuntimeToolResultActionResult;
|
|
12
12
|
readonly session: HarnessSessionBase;
|
|
@@ -18,9 +18,9 @@ type TaskRunEntry = Extract<WorkflowToolRunEntry, {
|
|
|
18
18
|
}>;
|
|
19
19
|
/**
|
|
20
20
|
* Starts the run for a task its model step committed, once, and answers the
|
|
21
|
-
* call with its receipt and the `task.started`
|
|
22
|
-
*
|
|
23
|
-
*
|
|
21
|
+
* call with its receipt and the `task.started` data the next step publishes.
|
|
22
|
+
* Runs inside the dispatch step, where the task's cap is enforced: past it,
|
|
23
|
+
* the record is dropped and the call fails.
|
|
24
24
|
*/
|
|
25
25
|
export declare function startTaskRun(input: StartWorkflowTaskInput & {
|
|
26
26
|
readonly entry: TaskRunEntry;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{createLogger,logError}from"#internal/logging.js";import{TOO_MANY_TASKS_CODE,UNKNOWN_TASK_CODE}from"#protocol/task-tools.js";import{renderTaskReceipt,renderTaskSentReceipt,renderTooManyTasksError,renderUnknownTaskError}from"#execution/tasks/render.js";import{MAX_WORKING_TASKS,findTask,isTaskAvailable,isTaskWorking,readTaskTable,recordTaskCall,recordTaskRun,removeTask,workingTasks,writeTaskTable}from"#execution/tasks/table.js";import{
|
|
1
|
+
import{createLogger,logError}from"#internal/logging.js";import{TOO_MANY_TASKS_CODE,UNKNOWN_TASK_CODE}from"#protocol/task-tools.js";import{renderTaskReceipt,renderTaskSentReceipt,renderTooManyTasksError,renderUnknownTaskError}from"#execution/tasks/render.js";import{startFailureResult,startWorkflowToolCallRun}from"#execution/tools/workflow/start.js";import{MAX_WORKING_TASKS,findTask,isTaskAvailable,isTaskWorking,readTaskTable,recordTaskCall,recordTaskRun,removeTask,workingTasks,writeTaskTable}from"#execution/tasks/table.js";import{sendTaskRunCommands}from"#execution/tasks/steps.js";import{createRuntimeToolResultFromValue}from"#harness/action-result-helpers.js";const log=createLogger(`execution.tasks`);async function startTaskRun(e){let{entry:t,session:n,task:r}=e,{taskId:i}=t,a={...e,taskId:i},o=startReceipt(a,t.entryPoint===`serve`),s=readTaskTable(n.state),c=startableTask(s,i);if(c===void 0)return{result:o,session:n};let l=tooManyTasks(a,s);if(l!==void 0)return{result:l,session:writeTaskTable(n,removeTask(s,i))};let u;try{u=await startWorkflowToolCallRun(e,t)}catch(e){return logError(log,`task run failed to start`,e,{taskId:i,toolName:r.toolName}),{result:startFailureResult(r,e),session:writeTaskTable(n,removeTask(s,i))}}return{result:o,session:writeTaskTable(n,recordTaskRun(s,i,u)),started:taskStartedEvent(a,c)}}async function sendToTask(e){let{session:t,task:n,taskId:r}=e,i=readTaskTable(t.state),a=findTask(i,r);if(!isTaskAvailable(a,n.toolName))return{result:unknownTaskResult(e),session:t};if(!isTaskWorking(a)){let n=tooManyTasks(e,i);if(n!==void 0)return{result:n,session:t}}let o=recordTaskCall(i,r,{agentContext:e.agentContext,auth:e.auth,callId:n.callId,executeInput:n.executeInput,input:n.input,sequence:e.batchEvent.sequence,stepIndex:e.batchEvent.stepIndex,turnId:e.batchEvent.turnId});return o.send!==void 0&&await sendTaskRunCommands(o.send),{result:toolResult(e,renderTaskSentReceipt(r)),session:writeTaskTable(t,o.table),started:taskStartedEvent(e,a)}}function runEntryToStart(e,t){let{entry:n}=t;switch(n.entryPoint){case`execute`:return{entryPoint:`execute`};case`task`:case`serve`:return startableTask(e,n.taskId)===void 0?void 0:n;case`receive`:return}}function startableTask(e,t){let n=findTask(e,t);return n!==void 0&&isTaskWorking(n)?n:void 0}function startsEveryRun(e,t){return!t.some(e=>e.entry.entryPoint===`receive`)&&hasTaskSlots(e,t.filter(t=>t.entry.entryPoint!==`execute`&&runEntryToStart(e,t)!==void 0).length)}function runningTasks(e){return workingTasks(e).filter(e=>e.run!==void 0)}function hasTaskSlots(e,t){return runningTasks(e).length+t<=MAX_WORKING_TASKS}function tooManyTasks(e,t){if(hasTaskSlots(t,1))return;let n=runningTasks(t).map(e=>e.id);return createRuntimeToolResultFromValue({callId:e.task.callId,isError:!0,output:{code:TOO_MANY_TASKS_CODE,message:renderTooManyTasksError(MAX_WORKING_TASKS,n)},toolName:e.task.toolName})}function unknownTaskResult(e){return createRuntimeToolResultFromValue({callId:e.task.callId,isError:!0,output:{code:UNKNOWN_TASK_CODE,message:renderUnknownTaskError(e.taskId,e.task.toolName)},toolName:e.task.toolName})}function taskStartedEvent(e,t){return{callId:e.task.callId,kind:t.kind,name:e.task.toolName,taskId:e.taskId,turnId:e.batchEvent.turnId}}function startReceipt(e,t){return toolResult(e,renderTaskReceipt({id:e.taskId,resumable:t,tool:e.task.toolName}))}function toolResult(e,t){return createRuntimeToolResultFromValue({callId:e.task.callId,output:t,toolName:e.task.toolName})}export{runEntryToStart,sendToTask,startTaskRun,startsEveryRun};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{resumeHook}from"#internal/workflow/runtime.js";import{
|
|
1
|
+
import{resumeHook}from"#internal/workflow/runtime.js";import{readDurableSession,replaceDurableSessionSnapshot}from"#execution/durable-session-store.js";import{readHitlState}from"#harness/hitl/index.js";import{commitSessionStep}from"#execution/publish-session-events.js";import{withSessionStateDelta}from"#execution/session/state-delta.js";import{cancelTask,findTask,finishTaskRun,markTaskRunStarted,readTaskTable,recordTaskRunUsage,settleRemainingTaskCalls,settleTaskCalls,writeTaskTable}from"#execution/tasks/table.js";import{finishRun,settleTask}from"#harness/session-machine/transitions.js";import{countRunUsage}from"#execution/agent-sessions/usage.js";import{workflowToolRunFailureOutput}from"#execution/tools/workflow/owner-inbox.js";import{ignoreGoneTarget}from"#execution/tasks/workflow-target.js";async function applyTaskRunMessage(e){let{message:t}=e,n=t.from.taskId,r=readDurableSession(e.sessionState);if(n===void 0)return{serializedContext:e.serializedContext,sessionState:e.sessionState};let i=readTaskTable(r.state),a=[],o=[];switch(t.kind){case`started`:{let e=markTaskRunStarted(i,n,t.from.runId);i=e.table,e.held!==void 0&&await sendTaskRunCommands(e.held);break}case`reply`:{({session:r,table:i}=countTaskRunUsage(r,i,n,t));let e={output:t.output,status:`completed`},o=findTask(i,n),s=settleTaskCalls(i,{callIds:t.callIds,outcome:e,taskId:n});i=s.table,a.push(...taskSettled(o,s.settled,e));break}case`usage`:({session:r,table:i}=countTaskRunUsage(r,i,n,t));break;case`outcome`:{({session:r,table:i}=countTaskRunUsage(r,i,n,t));let e=toOutcome(t),s=findTask(i,n),c=settleRemainingTaskCalls(i,n,e);a.push(...taskSettled(s,c.settled,e)),i=finishTaskRun(c.table,n,t.from.runId);let l=runRequestIds(r,t.from.runId);o.push(e=>finishRun(e,{requestIds:l,taskId:n}));break}}return await commitTaskDecisions(e,saveTable(e.sessionState,r,i),{settles:a,withdraws:o})}async function cancelTasksStep(e){"use step";return await withSessionStateDelta(e,cancelTasks)}async function cancelTasks(e){let t=readDurableSession(e.sessionState),n=readTaskTable(t.state),r=[],i=[],a={reason:e.reason,status:`cancelled`};for(let o of e.taskIds){let e=findTask(n,o),s=cancelTask(n,o);if(n=s.table,r.push(...taskSettled(e,s.settled,a)),s.send!==void 0){if(e?.resumable===!1){let e=runRequestIds(t,s.send.run.runId);i.push(t=>finishRun(t,{requestIds:e,taskId:o}))}await sendTaskRunCommands(s.send)}}return await commitTaskDecisions(e,saveTable(e.sessionState,t,n),{settles:r,withdraws:i})}async function commitTaskDecisions(e,t,n){let r=await commitSessionStep({...e,sessionState:t},e=>n.withdraws.map(t=>t(e)),{origin:`relayed`});return await commitSessionStep({...e,...r},e=>n.settles.map(t=>t(e)),{origin:`own`})}function taskSettled(e,t,n){return e===void 0?[]:[r=>settleTask(r,{calls:t,outcome:n,task:e})]}async function sendTaskRunCommands(e){for(let t of e.commands)await ignoreGoneTarget(resumeHook(e.run.hookToken,toControlMessage(t)))}function toControlMessage(e){switch(e.kind){case`cancel`:return{kind:`cancel`,reason:`The task was cancelled.`};case`call`:return{call:e.call,kind:`call`}}}function toOutcome(e){switch(e.result.status){case`completed`:return{output:e.result.output,status:`completed`};case`failed`:return{error:failureMessage(e),status:`failed`};case`cancelled`:return{status:`cancelled`}}}function failureMessage(e){let t=workflowToolRunFailureOutput(e);if(typeof t==`string`)return t;let n=typeof t==`object`&&t?Reflect.get(t,`message`):void 0;return typeof n==`string`?n:JSON.stringify(t)}function countTaskRunUsage(e,t,n,r){let i=findTask(t,n)?.run;return r.usage===void 0||i?.runId!==r.from.runId?{session:e,table:t}:{session:countRunUsage(e,r.usage,i.usage),table:recordTaskRunUsage(t,n,r.usage)}}function runRequestIds(e,t){return[...readHitlState(e.state).relays].filter(([,e])=>e.runId===t).map(([e])=>e)}function saveTable(e,t,n){return replaceDurableSessionSnapshot({session:writeTaskTable(t,n),state:e})}export{applyTaskRunMessage,cancelTasksStep,sendTaskRunCommands};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{createLogger,logError}from"#internal/logging.js";import{
|
|
1
|
+
import{createLogger,logError}from"#internal/logging.js";import{readDurableSession}from"#execution/durable-session-store.js";import{cancelWorkflowToolRun}from"#execution/tools/workflow/cancel.js";import{liveTaskRuns,readTaskTable}from"#execution/tasks/table.js";const log=createLogger(`execution.terminate-child-sessions`);async function terminateChildSessionsStep(e){"use step";let t;try{t=readDurableSession(e.sessionState)}catch(t){logError(log,`failed to read child sessions for termination`,t,{parentSessionId:e.sessionState.sessionId});return}await stopTaskRuns(t)}async function stopTaskRuns(e){let t=liveTaskRuns(readTaskTable(e.state));await Promise.all(t.map(e=>cancelWorkflowToolRun(e,{kind:`end`,reason:`The session ended.`})))}export{terminateChildSessionsStep};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{decide}from"#ai/decide.js";async function runAgentRouterTask(e,t){"use workflow";let n=await chooseTarget(e.message,descriptions(t),t.abortSignal),{message:r,status:i}=await(await t.agent(n).send(e.message,{signal:t.abortSignal})).result();if(i===`failed`)throw Error(`Agent "${n}" failed to handle the task.`);return r??null}async function chooseTarget(e,t,n){"use step";let r=Object.keys(t);if(r.length===0)throw Error(`agentRouter requires at least one available agent with a description.`);return r.length===1?r[0]:(await decide({abortSignal:n,state:{message:e},questions:{route:{type:`choice`,instructions:`Which subagent should handle this task?`,criteria:t}}})).answers.route.choice}function descriptions(e){return Object.fromEntries(Object.entries(e.agents).flatMap(([e,t])=>{let n=t.description.trim();return n.length===0?[]:[[e,n]]}))}runAgentRouterTask.workflowId=`workflow//eve@0.
|
|
1
|
+
import{decide}from"#ai/decide.js";async function runAgentRouterTask(e,t){"use workflow";let n=await chooseTarget(e.message,descriptions(t),t.abortSignal),{message:r,status:i}=await(await t.agent(n).send(e.message,{signal:t.abortSignal})).result();if(i===`failed`)throw Error(`Agent "${n}" failed to handle the task.`);return r??null}async function chooseTarget(e,t,n){"use step";let r=Object.keys(t);if(r.length===0)throw Error(`agentRouter requires at least one available agent with a description.`);return r.length===1?r[0]:(await decide({abortSignal:n,state:{message:e},questions:{route:{type:`choice`,instructions:`Which subagent should handle this task?`,criteria:t}}})).answers.route.choice}function descriptions(e){return Object.fromEntries(Object.entries(e.agents).flatMap(([e,t])=>{let n=t.description.trim();return n.length===0?[]:[[e,n]]}))}runAgentRouterTask.workflowId=`workflow//eve@0.83.0//runAgentRouterTask`;export{runAgentRouterTask};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { SessionContext } from "#context/session-context.js";
|
|
2
2
|
import type { AgentSessionContext } from "#execution/agent-sessions/context.js";
|
|
3
3
|
import { type RunUsageTally } from "#execution/agent-sessions/usage.js";
|
|
4
|
-
import type {
|
|
4
|
+
import type { WorkflowSharedContext } from "#tools/workflow-definition.js";
|
|
5
5
|
import { WorkflowToolRunAsks } from "#execution/tools/workflow/ask.js";
|
|
6
6
|
import type { WorkflowBodyCommand, WorkflowToolRunOutcome, WorkflowToolRunRef } from "#execution/tools/workflow/messages.js";
|
|
7
7
|
import type { WorkflowToolRunInbox } from "#execution/tools/workflow/owner.js";
|
|
@@ -74,7 +74,7 @@ export declare function resolveWorkflowEntryPoint<TEntryPoint>(input: WorkflowBo
|
|
|
74
74
|
* `session` (whose turn is the call's), come from the entry point, which
|
|
75
75
|
* knows its calls.
|
|
76
76
|
*/
|
|
77
|
-
export declare function createSharedContext(input: WorkflowBodyInput, agent:
|
|
77
|
+
export declare function createSharedContext(input: WorkflowBodyInput, agent: WorkflowSharedContext["agent"], askPerson: WorkflowSharedContext["ask"]): Omit<ToolContext & WorkflowSharedContext, "abortSignal" | "agents" | "callId" | "messages" | "session">;
|
|
78
78
|
/** `ctx.agents` for a call: the agents its context lists, frozen. */
|
|
79
79
|
export declare function createAgentsView(context: AgentSessionContext): WorkflowSharedContext["agents"];
|
|
80
80
|
export declare class WorkflowToolRunCancelledError extends Error {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{parseJsonValue}from"#shared/json.js";import{callToolStubStep}from"#execution/tool-stubs/steps.js";import{getWorkflowMetadata}from"#compiled/@workflow/core/index.js";import{findStubTarget,stubCallId}from"#tool-stubs/target.js";import{normalizeSerializableError}from"#execution/workflow-errors.js";import{createRunUsageTally}from"#execution/agent-sessions/usage.js";import{toolStubOutput}from"#tool-stubs/output.js";import{createAgentSessions}from"#execution/agent-sessions/session.js";import{WorkflowToolRunAsks,ask,attachWorkflowToolRunContext}from"#execution/tools/workflow/ask.js";import{readRegisteredWorkflow}from"#execution/workflow-registry.js";import{withToolOutputSerializationError}from"#harness/tool-output-serialization.js";const INTERRUPTED_OUTPUT={interrupted:!0};var WorkflowCallSignals=class{body=new AbortController;run=new AbortController;asks;constructor(e){this.asks=e}get abortSignal(){return this.body.signal}get runSignal(){return this.run.signal}get interrupted(){return this.body.signal.aborted&&!this.run.signal.aborted}get unwinding(){return this.run.signal.aborted}apply(e){switch(e.kind){case`cancel`:case`end`:this.asks.cancelAll(),this.run.abort(new WorkflowToolRunCancelledError(e.reason)),this.body.abort(this.run.signal.reason);return;case`interrupt`:this.body.abort(new WorkflowToolRunInterruptedError);return;case`call`:return}}};function startCallBody(e){let t=createWorkflowBodyRef(e),n=new WorkflowToolRunAsks(t.runId),r=new WorkflowCallSignals(n),i={agentContext:e.agentContext,asks:n,auth:e.session.auth,control:e.hookToken,from:t,owner:e.owner},a=createRunUsageTally(),o=createAgentSessions(i,a),s=createCallContext(e,r,o.open);return attachWorkflowToolRunContext(s,i),{asks:n,close:o.close,control:r,outcome:executeCallBody(e,s,r,t),usage:a}}async function executeCallBody(e,t,n,r){try{let n=findStubTarget(e.agentContext.toolStubs,e.toolName);if(n!==void 0){let t=await callToolStubStep(n.scope,{callId:stubCallId(e.session.id,e.session.turn.id,e.callId),tool:n.tool,input:e.input});if(t.kind===`error`)throw Error(t.error);if(t.kind===`stub`)return{output:toolStubOutput(t.outcome),status:`completed`}}let i=resolveWorkflowEntryPoint(e)(e.executeInput??e.input,t),a;if(!isAsyncIterable(i))a=await i;else{let t=i[Symbol.asyncIterator](),n,o=await t.next();for(;o.done!==!0;)n=o.value,await e.owner.send({from:r,kind:`report`,update:o.value}),o=await t.next();a=o.value??n}return{output:toWorkflowOutput(e,a),status:`completed`}}catch(e){return n.interrupted?{output:INTERRUPTED_OUTPUT,status:`completed`}:toFailedOutcome(e,n.runSignal)}}function toWorkflowOutput(e,t){return withToolOutputSerializationError({boundary:`execute`,toolCallId:e.callId,toolName:e.toolName},()=>parseJsonValue(t??null))}function toFailedOutcome(e,t){if(t.aborted){let{reason:e}=t;return{reason:e instanceof Error?e.message:String(e??``),status:`cancelled`}}return{error:normalizeSerializableError(e),status:`failed`}}function createWorkflowBodyRef(e){let t={callId:e.callId,input:e.input,runId:e.runId??getWorkflowMetadata().workflowRunId,sequence:e.session.turn.sequence,stepIndex:e.stepIndex,toolName:e.toolName,turnId:e.session.turn.id};return e.entry.entryPoint===`execute`?t:{...t,taskId:e.entry.taskId}}function resolveWorkflowEntryPoint(e){let t=readRegisteredWorkflow(e.workflowId);if(typeof t!=`function`)throw Error(`Tool "${e.toolName}" is not registered as a workflow in this deployment (${e.workflowId}). The tool was renamed or removed after this run started.`);return t}function createSharedContext(e,t,n){let unavailable=(t,n)=>{throw Error(`ctx.${t} is not available inside a workflow tool; ${n}. Tool "${e.toolName}" runs as a durable workflow body, which only replays deterministic code.`)};return{agent:t,ask:n,getSandbox:()=>unavailable(`getSandbox()`,`
|
|
1
|
+
import{parseJsonValue}from"#shared/json.js";import{callToolStubStep}from"#execution/tool-stubs/steps.js";import{getWorkflowMetadata}from"#compiled/@workflow/core/index.js";import{findStubTarget,stubCallId}from"#tool-stubs/target.js";import{normalizeSerializableError}from"#execution/workflow-errors.js";import{createRunUsageTally}from"#execution/agent-sessions/usage.js";import{toolStubOutput}from"#tool-stubs/output.js";import{createAgentSessions}from"#execution/agent-sessions/session.js";import{WorkflowToolRunAsks,ask,attachWorkflowToolRunContext}from"#execution/tools/workflow/ask.js";import{readRegisteredWorkflow}from"#execution/workflow-registry.js";import{withToolOutputSerializationError}from"#harness/tool-output-serialization.js";const INTERRUPTED_OUTPUT={interrupted:!0};var WorkflowCallSignals=class{body=new AbortController;run=new AbortController;asks;constructor(e){this.asks=e}get abortSignal(){return this.body.signal}get runSignal(){return this.run.signal}get interrupted(){return this.body.signal.aborted&&!this.run.signal.aborted}get unwinding(){return this.run.signal.aborted}apply(e){switch(e.kind){case`cancel`:case`end`:this.asks.cancelAll(),this.run.abort(new WorkflowToolRunCancelledError(e.reason)),this.body.abort(this.run.signal.reason);return;case`interrupt`:this.body.abort(new WorkflowToolRunInterruptedError);return;case`call`:return}}};function startCallBody(e){let t=createWorkflowBodyRef(e),n=new WorkflowToolRunAsks(t.runId),r=new WorkflowCallSignals(n),i={agentContext:e.agentContext,asks:n,auth:e.session.auth,control:e.hookToken,from:t,owner:e.owner},a=createRunUsageTally(),o=createAgentSessions(i,a),s=createCallContext(e,r,o.open);return attachWorkflowToolRunContext(s,i),{asks:n,close:o.close,control:r,outcome:executeCallBody(e,s,r,t),usage:a}}async function executeCallBody(e,t,n,r){try{let n=findStubTarget(e.agentContext.toolStubs,e.toolName);if(n!==void 0){let t=await callToolStubStep(n.scope,{callId:stubCallId(e.session.id,e.session.turn.id,e.callId),tool:n.tool,input:e.input});if(t.kind===`error`)throw Error(t.error);if(t.kind===`stub`)return{output:toolStubOutput(t.outcome),status:`completed`}}let i=resolveWorkflowEntryPoint(e)(e.executeInput??e.input,t),a;if(!isAsyncIterable(i))a=await i;else{let t=i[Symbol.asyncIterator](),n,o=await t.next();for(;o.done!==!0;)n=o.value,await e.owner.send({from:r,kind:`report`,update:o.value}),o=await t.next();a=o.value??n}return{output:toWorkflowOutput(e,a),status:`completed`}}catch(e){return n.interrupted?{output:INTERRUPTED_OUTPUT,status:`completed`}:toFailedOutcome(e,n.runSignal)}}function toWorkflowOutput(e,t){return withToolOutputSerializationError({boundary:`execute`,toolCallId:e.callId,toolName:e.toolName},()=>parseJsonValue(t??null))}function toFailedOutcome(e,t){if(t.aborted){let{reason:e}=t;return{reason:e instanceof Error?e.message:String(e??``),status:`cancelled`}}return{error:normalizeSerializableError(e),status:`failed`}}function createWorkflowBodyRef(e){let t={callId:e.callId,input:e.input,runId:e.runId??getWorkflowMetadata().workflowRunId,sequence:e.session.turn.sequence,stepIndex:e.stepIndex,toolName:e.toolName,turnId:e.session.turn.id};return e.entry.entryPoint===`execute`?t:{...t,taskId:e.entry.taskId}}function resolveWorkflowEntryPoint(e){let t=readRegisteredWorkflow(e.workflowId);if(typeof t!=`function`)throw Error(`Tool "${e.toolName}" is not registered as a workflow in this deployment (${e.workflowId}). The tool was renamed or removed after this run started.`);return t}function createSharedContext(e,t,n){let unavailable=(t,n)=>{throw Error(`ctx.${t} is not available inside a workflow tool; ${n}. Tool "${e.toolName}" runs as a durable workflow body, which only replays deterministic code.`)};return{agent:t,ask:n,getSandbox:()=>unavailable(`getSandbox()`,`pass ctx directly to a "use step" helper to open the session's sandbox`),getToken:()=>unavailable(`getToken()`,`pass ctx directly to a "use step" helper to resolve credentials`),requireAuth:()=>unavailable(`requireAuth()`,`pass ctx directly to a "use step" helper to request authorization`),toolName:e.toolName}}function createAgentsView(e){return Object.freeze(Object.fromEntries(Object.entries(e.agents).map(([e,t])=>[e,Object.freeze({...t})])))}function createCallContext(e,t,n){let r={...createSharedContext(e,n,(e,t)=>ask(r,e,t)),abortSignal:t.abortSignal,agents:createAgentsView(e.agentContext),callId:e.callId,session:e.session};return r}function isAsyncIterable(e){return typeof e==`object`&&!!e&&typeof e[Symbol.asyncIterator]==`function`}var WorkflowToolRunCancelledError=class extends Error{constructor(e){super(e),this.name=`WorkflowToolRunCancelledError`}},WorkflowToolRunInterruptedError=class extends Error{constructor(){super(`A new message arrived while the turn waited on this call.`),this.name=`WorkflowToolRunInterruptedError`}};export{WorkflowToolRunCancelledError,WorkflowToolRunInterruptedError,createAgentsView,createSharedContext,createWorkflowBodyRef,resolveWorkflowEntryPoint,startCallBody,toFailedOutcome,toWorkflowOutput};
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import type { SessionContext } from "#context/session-context.js";
|
|
2
|
+
import type { AgentSessionBundle } from "#execution/agent-sessions/context.js";
|
|
2
3
|
import type { AuthorizationResult, AuthorizationSignal } from "#harness/authorization.js";
|
|
4
|
+
import type { SandboxState } from "#sandbox/state.js";
|
|
3
5
|
export type WorkflowStepAuthorizationResult = AuthorizationResult & {
|
|
4
6
|
readonly attemptId: string;
|
|
5
7
|
readonly name: string;
|
|
@@ -12,6 +14,15 @@ export interface WorkflowStepContext {
|
|
|
12
14
|
readonly baseUrl: string;
|
|
13
15
|
readonly token: string;
|
|
14
16
|
readonly authorizationResults: readonly WorkflowStepAuthorizationResult[];
|
|
17
|
+
readonly sandbox: WorkflowStepSandbox;
|
|
18
|
+
}
|
|
19
|
+
/** Where `ctx.getSandbox()` finds the calling session's sandbox: its agent and sandbox key. */
|
|
20
|
+
export interface WorkflowStepSandbox {
|
|
21
|
+
readonly bundle: AgentSessionBundle;
|
|
22
|
+
/** The session that owns the sandbox the caller uses: its own, or the owner's it shares. */
|
|
23
|
+
readonly sessionId: string;
|
|
24
|
+
/** The caller's recorded sandbox state when the call was made, which the step resumes. */
|
|
25
|
+
readonly state?: SandboxState;
|
|
15
26
|
}
|
|
16
27
|
export type WorkflowStepResult = {
|
|
17
28
|
readonly authorized: readonly string[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{ContextContainer,contextStorage}from"#context/container.js";import{AuthKey,InitiatorAuthKey,SessionIdKey,SessionKey}from"#context/keys.js";import{getStepMetadata}from"#compiled/@workflow/core/index.js";import{resolveWorkflowCallbackBaseUrl}from"#execution/workflow-callback-url.js";import{isConnectionAuthorizationFailedError}from"#connections/errors.js";import{AuthorizationHookKey,CallbackBaseUrlKey,PendingAuthorizationResultKey,isAuthorizationSignal}from"#harness/authorization.js";import{buildBaseToolContext}from"#context/build-base-tool-context.js";import{createAuthorizationContext}from"#runtime/authorization-context.js";import{completeWorkflowStepAuthorization}from"#execution/tools/workflow/authorization-completion.js";import"#execution/tools/workflow/step-context.js";function withWorkflowStepAuthorization(e){let wrapped=async function(t){let{args:n,context:r}=t;getStepMetadata();let i=new ContextContainer;
|
|
1
|
+
import{createLogger,logError}from"#internal/logging.js";import{ContextContainer,contextStorage}from"#context/container.js";import{AuthKey,InitiatorAuthKey,SandboxKey,SessionIdKey,SessionKey}from"#context/keys.js";import{ensureSandboxAccess}from"#execution/sandbox/ensure.js";import{resolveDurableCompiledArtifactsSource}from"#runtime/durable-compiled-artifacts-source.js";import{getStepMetadata}from"#compiled/@workflow/core/index.js";import{resolveWorkflowCallbackBaseUrl}from"#execution/workflow-callback-url.js";import{getCompiledRuntimeAgentBundle}from"#runtime/sessions/compiled-agent-cache.js";import{isConnectionAuthorizationFailedError}from"#connections/errors.js";import{AuthorizationHookKey,CallbackBaseUrlKey,PendingAuthorizationResultKey,isAuthorizationSignal}from"#harness/authorization.js";import{buildBaseToolContext}from"#context/build-base-tool-context.js";import{createAuthorizationContext}from"#runtime/authorization-context.js";import{completeWorkflowStepAuthorization}from"#execution/tools/workflow/authorization-completion.js";import"#execution/tools/workflow/step-context.js";const log=createLogger(`workflow-step`);function withWorkflowStepAuthorization(e){let wrapped=async function(t){let{args:n,context:r}=t;getStepMetadata();let i=new ContextContainer;i.set(AuthKey,r.session.auth.current),i.set(InitiatorAuthKey,r.session.auth.initiator),i.set(SessionIdKey,r.session.id),i.setVirtualContext(SessionKey,{...r.session,sessionId:r.session.id}),i.set(CallbackBaseUrlKey,resolveWorkflowCallbackBaseUrl(r.baseUrl)),i.setVirtualContext(AuthorizationHookKey,r.token),i.setVirtualContext(PendingAuthorizationResultKey,r.authorizationResults);let a=openStepSandbox(r);return contextStorage.run(i,async()=>{let o=createAuthorizationContext({scope:r.toolName,completeAuthorization:completeWorkflowStepAuthorization}),s=buildBaseToolContext({toolName:r.toolName,options:{abortSignal:r.abortSignal,toolCallId:r.callId}}),c={...s,agent:()=>unavailableInStep(`ctx.agent()`,`Call ctx.agent() in the workflow body.`),ask:()=>unavailableInStep(`ctx.ask()`,`Call ctx.ask() in the workflow body.`),getSandbox:(async e=>{let t=await a.open();if(e!==void 0&&t.environment?.provider!==e.provider)throw fatal(`ctx.getSandbox() in a "use step" function received a sandbox environment the session's sandbox does not use. Pass the environment the agent's sandbox definition opens, or call ctx.getSandbox() without one.`);return i.setVirtualContext(SandboxKey,t),await s.getSandbox()}),getToken:o.getToken,requireAuth:o.requireAuth};Object.defineProperty(c,"agents",{get:()=>unavailableInStep(`ctx.agents`,`Read ctx.agents in the workflow body and pass the required serializable metadata into the step.`)});let l;try{l=await o.run(()=>Reflect.apply(e,this,n.map((e,n)=>t.contextIndexes.includes(n)?c:e)))}catch(e){throw isConnectionAuthorizationFailedError(e)&&!e.retryable&&Object.assign(e,{fatal:!0}),e}finally{await a.release()}let u=i.get(PendingAuthorizationResultKey)??[],d=r.authorizationResults.filter(e=>!u.includes(e)).map(e=>e.attemptId);return isAuthorizationSignal(l)?{kind:`authorization-required`,signal:l,authorized:d}:{kind:`result`,output:l,authorized:d}})};return Object.defineProperty(wrapped,"maxRetries",{get:()=>Reflect.get(e,`maxRetries`)}),wrapped}function openStepSandbox(e){let{bundle:t,sessionId:n,state:r}=e.sandbox,i=contextStorage.getStore(),resolveSource=()=>resolveDurableCompiledArtifactsSource(t.source),a,o=!1,open=async()=>{let e=await getCompiledRuntimeAgentBundle({compiledArtifactsSource:i===void 0?resolveSource():contextStorage.run(i,resolveSource),nodeId:t.nodeId}),a=e.graph.root;return await ensureSandboxAccess({compiledArtifactsSource:e.compiledArtifactsSource,nodeId:a.nodeId,ownsSandbox:!1,registry:a.sandboxRegistry,sessionId:n,state:r??null,shutdownTracking:`none`})},openOnce=()=>(a??=open().catch(e=>{throw a=void 0,e}),a);return{async open(){if(o)throw fatal(`ctx.getSandbox() was called after the "use step" function of tool "${e.toolName}" returned. Call it inside the step, which lets go of the sandbox when it ends.`);return{...await openOnce(),delete:()=>unavailableInStep(`sandbox.delete()`,`The step borrows the session's sandbox, and only the session can delete it.`),stop:()=>unavailableInStep(`sandbox.stop()`,`The session's turns may be using the sandbox; eve closes the step's connection when the step ends.`)}},async release(){o=!0;let t=await a?.catch(()=>void 0);try{await t?.release()}catch(t){logError(log,`failed to release a workflow step's sandbox`,t,{sessionId:n,toolName:e.toolName})}}}}function unavailableInStep(e,t){throw fatal(`${e} is unavailable inside a "use step" function. ${t}`)}function fatal(e){return Object.assign(Error(e),{fatal:!0})}export{withWorkflowStepAuthorization};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{createHook,getWorkflowMetadata}from"#compiled/@workflow/core/index.js";import{disposeHook}from"#execution/hook-ownership.js";import{runSignIn}from"#harness/session-machine/transitions.js";import{findWorkflowToolRunContext}from"#execution/tools/workflow/ask.js";function workflowToolStep(e,t){return new Proxy(e,{apply(e,n,r){let i=findWorkflowContextArgument(r);return i===void 0?Reflect.apply(e,n,r):executeAuthorizedStep(t,n,r,i)}})}function findWorkflowContextArgument(e){for(let t of e){let e=findWorkflowToolRunContext(t);if(e!==void 0)return{ctx:t,run:e}}}async function executeAuthorizedStep(e,t,n,r){let{ctx:i,run:a}=r,o=[],s=new Map;for(;;){let r=createHook();try{let c;try{c=await invokeAuthorizedStep({args:n,authorizationResults:o,callbackToken:r.token,ctx:i,execute:e,receiver:t})}catch(e){throw i.abortSignal.aborted||await reportPendingAsFailed(a,i.abortSignal,s),e}if(await reconcileCompletedAuthorizations(a,i.abortSignal,s,o,c.authorized),c.kind===`result`)return await reportPendingAsFailed(a,i.abortSignal,s),c.output;await collectAuthorizationCallbacks({authorizationResults:o,callback:r,challenges:c.signal.challenges,ctx:i,pending:s,run:a})}finally{await disposeHook(r)}}}async function invokeAuthorizedStep(e){let{args:t,authorizationResults:n,callbackToken:r,ctx:i,execute:a,receiver:o}=e,
|
|
1
|
+
import{createHook,getWorkflowMetadata}from"#compiled/@workflow/core/index.js";import{disposeHook}from"#execution/hook-ownership.js";import{runSignIn}from"#harness/session-machine/transitions.js";import{findWorkflowToolRunContext}from"#execution/tools/workflow/ask.js";function workflowToolStep(e,t){return new Proxy(e,{apply(e,n,r){let i=findWorkflowContextArgument(r);return i===void 0?Reflect.apply(e,n,r):executeAuthorizedStep(t,n,r,i)}})}function findWorkflowContextArgument(e){for(let t of e){let e=findWorkflowToolRunContext(t);if(e!==void 0)return{ctx:t,run:e}}}async function executeAuthorizedStep(e,t,n,r){let{ctx:i,run:a}=r,o=[],s=new Map;for(;;){let r=createHook();try{let c;try{c=await invokeAuthorizedStep({args:n,authorizationResults:o,callbackToken:r.token,ctx:i,execute:e,receiver:t,run:a})}catch(e){throw i.abortSignal.aborted||await reportPendingAsFailed(a,i.abortSignal,s),e}if(await reconcileCompletedAuthorizations(a,i.abortSignal,s,o,c.authorized),c.kind===`result`)return await reportPendingAsFailed(a,i.abortSignal,s),c.output;await collectAuthorizationCallbacks({authorizationResults:o,callback:r,challenges:c.signal.challenges,ctx:i,pending:s,run:a})}finally{await disposeHook(r)}}}async function invokeAuthorizedStep(e){let{args:t,authorizationResults:n,callbackToken:r,ctx:i,execute:a,receiver:o,run:s}=e,c={callId:i.callId,toolName:i.toolName,session:i.session,abortSignal:i.abortSignal,baseUrl:getWorkflowMetadata().url,token:r,authorizationResults:n,sandbox:{bundle:s.agentContext.bundle,sessionId:s.agentContext.sandbox.sessionId,state:s.agentContext.sandbox.state}},l={args:t.map(e=>e===i?null:e),context:c,contextIndexes:t.flatMap((e,t)=>e===i?[t]:[])};return await a.call(o,l)}async function reconcileCompletedAuthorizations(e,t,n,r,i){let a=new Set(i);for(let r of a){let i=n.get(r);i!==void 0&&await reportAuthorization(e,t,i,`authorized`),n.delete(r)}for(let e=r.length-1;e>=0;e--){let t=r[e];t!==void 0&&a.has(t.attemptId)&&r.splice(e,1)}}async function collectAuthorizationCallbacks(e){let{authorizationResults:t,callback:n,challenges:r,ctx:i,pending:a,run:o}=e;for(let e of r){let r=requireAttemptId(e);a.set(r.attemptId,r),await reportAuthorization(o,i.abortSignal,r);try{let e=await waitForCallback(n,r,i.abortSignal);t.push({name:r.name,instanceId:r.instanceId,attemptId:r.attemptId,hookUrl:r.hookUrl,principal:r.principal,resume:r.resume,callback:e})}catch(e){throw i.abortSignal.aborted||await reportAuthorization(o,i.abortSignal,r,`failed`),e}}}function requireAttemptId(e){if(e.attemptId===void 0)throw Error(`Workflow authorization challenge "${e.name}" has no attempt id.`);return e}async function reportPendingAsFailed(e,t,n){for(let r of n.values())await reportAuthorization(e,t,r,`failed`)}async function reportAuthorization(e,t,n,r){let i=runSignIn(e.from,n,r),a=createHook();try{await a.getConflict(),await withAbort(e.owner.send({kind:`request`,from:e.from,replyTo:a.token,request:{kind:`authorization-request`,event:{kind:`subagent-authorization-event`,callId:e.from.callId,childSessionId:e.from.runId,subagentName:e.from.toolName,event:i}}}),t),await withAbort(a,t)}finally{await disposeHook(a)}}async function waitForCallback(e,t,n){let r=e[Symbol.asyncIterator]();for(;;){let e=await withAbort(r.next(),n);if(e.done)throw Error(`Authorization callback closed before sign-in completed.`);let i=readCallback(e.value,t);if(i!==void 0)return i}}async function withAbort(e,t){let abort,n=new Promise((e,n)=>{abort=()=>n(t.reason??Error(`Workflow authorization cancelled.`)),t.addEventListener(`abort`,abort,{once:!0}),t.aborted&&abort()});try{return await Promise.race([e,n])}finally{t.removeEventListener(`abort`,abort)}}function readCallback(e,t){if(typeof e==`object`&&e&&`payloads`in e&&Array.isArray(e.payloads))for(let n of e.payloads){let e=n?.authorizationCallback;if(e?.attemptId!==t.attemptId||e?.connectionName!==t.name)continue;let r=e.callback;if(!(typeof r?.method!=`string`||typeof r.params!=`object`||r.params===null||Array.isArray(r.params))&&Object.values(r.params).every(e=>typeof e==`string`)&&(r.body===void 0||typeof r.body==`string`))return r}}export{workflowToolStep};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { DispatchSessionInput, Runtime, SessionCommand, SessionCommandResult } from "#channel/types.js";
|
|
2
2
|
import { type Run, type StartOptionsWithoutDeploymentId, type WorkflowFunction, type WorkflowMetadata } from "#internal/workflow/runtime.js";
|
|
3
3
|
import type { RuntimeCompiledArtifactsSource } from "#runtime/compiled-artifacts-source.js";
|
|
4
|
+
import type { AgentSessionRuntimeOverrides } from "#execution/agent-sessions/runtime-overrides.js";
|
|
4
5
|
import type { DynamicSubagentAgentConfig } from "#runtime/subagents/dynamic-agent-config.js";
|
|
5
6
|
interface WorkflowHookRecord {
|
|
6
7
|
readonly runId: string;
|
|
@@ -33,6 +34,7 @@ export declare const connectionEventDeliveryWorkflowReference: {
|
|
|
33
34
|
* whose original run retains the public event stream across owner handoffs.
|
|
34
35
|
*/
|
|
35
36
|
export declare function createWorkflowRuntime(config: {
|
|
37
|
+
readonly agentSessionRuntimeOverrides?: AgentSessionRuntimeOverrides;
|
|
36
38
|
readonly compiledArtifactsSource: RuntimeCompiledArtifactsSource;
|
|
37
39
|
readonly dynamicSubagentAgentConfig?: DynamicSubagentAgentConfig;
|
|
38
40
|
readonly nodeId?: string;
|
|
@@ -44,7 +46,9 @@ export declare function createWorkflowRuntime(config: {
|
|
|
44
46
|
*/
|
|
45
47
|
export declare function dispatchWorkflowSessionCommand<TCommand extends SessionCommand>(input: DispatchSessionInput<TCommand>): Promise<SessionCommandResult<TCommand>>;
|
|
46
48
|
/** The session holding a continuation token's inbox, if any does. */
|
|
47
|
-
export declare function resolveContinuation(continuationToken: string
|
|
49
|
+
export declare function resolveContinuation(continuationToken: string, options?: {
|
|
50
|
+
readonly runnable?: boolean;
|
|
51
|
+
}): Promise<{
|
|
48
52
|
sessionId: string;
|
|
49
53
|
} | undefined>;
|
|
50
54
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{createLogger,logError}from"#internal/logging.js";import{sessionCommandHookToken,sessionInboxHookToken}from"#execution/session-inbox/address.js";import{SessionPredecessorKey}from"#context/keys.js";import{SessionStrandedError,describeStrandedSession}from"#channel/session-stranded-error.js";import{resolveInstalledPackageInfo}from"#internal/application/package.js";import{walkCauseChain}from"#shared/errors.js";import{validateToolStubTargets}from"#tool-stubs/validate-targets.js";import{getHookByToken,getRun,getWorld,start}from"#internal/workflow/runtime.js";import{getCompiledRuntimeAgentBundle}from"#runtime/sessions/compiled-agent-cache.js";import{ROOT_RUNTIME_AGENT_NODE_ID}from"#runtime/graph.js";import{serializeContext}from"#context/serialize.js";import{AcceptedSessionIdentityError,SessionHandoffPendingError,logicalSessionToken,resolveSessionInbox,resumeSessionInbox}from"#execution/session-inbox/resume.js";import{resolveEffectiveAgentRuntime}from"#execution/effective-agent-config.js";import{context,trace}from"#compiled/@opentelemetry/api/index.js";import{EntityConflictError,HookNotFoundError,RunExpiredError,WorkflowRunNotFoundError}from"#compiled/@workflow/errors/index.js";import{StrandedSessionOwnerError,assertRunnableSessionInbox,findSessionHookHolder}from"#execution/session-inbox/owner.js";import{initializeSessionInstrumentation}from"#instrumentation/runtime.js";import{EVE_VERSION_ATTRIBUTE,buildSessionAttributes,buildSubagentRootAttributes,readParentLineage}from"#execution/eve-workflow-attributes.js";import{endStrandedSession}from"#execution/session-inbox/end-stranded-session.js";import{SESSION_HOOK_HANDOVER_TIMEOUT_MS,waitForSessionHooksRelease}from"#execution/session-inbox/hook-release.js";import{CONNECTION_EVENT_DELIVERY_WORKFLOW_NAME,CONNECTION_EVENT_WORKFLOW_NAME,SESSION_TIMEOUT_WORKFLOW_NAME,WORKFLOW_ENTRY_NAME,WORKFLOW_TOOL_RUN_WORKFLOW_NAME}from"#execution/stable-workflow-names.js";import{normalizeEveAttributes}from"#runtime/attributes/normalize.js";import{buildRunContext}from"#execution/runtime-context.js";import{readSessionEventHistory,readSessionEventStream,readSessionStreamTailIndex}from"#execution/session-event-stream.js";import{buildInvocationAttributes}from"#internal/invocation/metadata.js";import{isAgentTraceContext}from"#tracing/eve/agent-trace-context.js";const EVE_PACKAGE_INFO=resolveInstalledPackageInfo(),STABLE_ID_BASE=EVE_PACKAGE_INFO.name,log=createLogger(`execution.workflow-runtime`),workflowEntryReference={workflowId:`workflow//${STABLE_ID_BASE}//${WORKFLOW_ENTRY_NAME}`},sessionTimeoutWorkflowReference={workflowId:`workflow//${STABLE_ID_BASE}//${SESSION_TIMEOUT_WORKFLOW_NAME}`},workflowToolRunWorkflowReference={workflowId:`workflow//${STABLE_ID_BASE}//${WORKFLOW_TOOL_RUN_WORKFLOW_NAME}`},connectionEventWorkflowReference={workflowId:`workflow//${STABLE_ID_BASE}//${CONNECTION_EVENT_WORKFLOW_NAME}`},connectionEventDeliveryWorkflowReference={workflowId:`workflow//${STABLE_ID_BASE}//${CONNECTION_EVENT_DELIVERY_WORKFLOW_NAME}`};function createWorkflowRuntime(e){let startSession=async(t,n)=>{let r=await getCompiledRuntimeAgentBundle({compiledArtifactsSource:e.compiledArtifactsSource,nodeId:e.nodeId});t.toolStubs!==void 0&&t.toolStubs.rootSessionId===void 0&&validateToolStubTargets(t.toolStubs.rules,r.graph);let i=buildRunContext({bundle:r,dynamicSubagentAgentConfig:e.dynamicSubagentAgentConfig,run:t});n!==void 0&&i.set(SessionPredecessorKey,n);let a=resolveEffectiveAgentRuntime(r,i),o=initializeSessionInstrumentation({agentName:a.turnAgent.id,ctx:i}),s=a.limits?.sessionTimeoutMs,c=r.resolvedAgent.config?.experimental?.workflow?.retention??(o.action===`record`&&o.recordInputs&&o.recordOutputs?void 0:0),l=serializeContext(i),u=readParentLineage(l),d={kind:`initial`,input:t.input,ownerDeploymentId:await resolveCurrentWorkflowDeploymentId(),serializedContext:l};t.limits!==void 0&&(d.limits=t.limits),t.continuationConflictCommand!==void 0&&(d.continuationConflictCommand=t.continuationConflictCommand),s!==void 0&&(d.sessionTimeoutMs=s),c!==void 0&&(d.retention=c);let f={...u.sessionId===void 0?buildSessionAttributes({serializedContext:l}):buildSubagentRootAttributes({identity:{nodeId:r.nodeId??ROOT_RUNTIME_AGENT_NODE_ID},parentCallId:u.callId,parentSessionId:u.sessionId,parentTurnId:u.turnId,rootSessionId:u.rootSessionId??u.sessionId,serializedContext:l}),...t.externalInvocation===void 0?{}:buildInvocationAttributes(t.externalInvocation)},p;try{let e={allowReservedAttributes:!0,attributes:normalizeEveAttributes(f)};c!==void 0&&(e.experimental_retention=c),p=await startWorkflowOnDeployment(workflowEntryReference,[d],d.ownerDeploymentId,e)}catch(e){throw logError(log,`failed to start workflow run`,e,{continuationToken:t.continuationToken}),e}let m,getEvents=()=>(m??=readSessionEventStream(p.runId),m);return{get events(){return getEvents()},sessionId:p.runId}};return{async createSession(e){return await startSession(e)},async dispatchContinuation(e){let{command:t,continuationToken:n,successor:r}=e;try{return await dispatchWorkflowCommand(n,t)}catch(e){if(!(e instanceof StrandedSessionOwnerError))throw e;if(t.kind!==`send`||r===void 0)return await settleStrandedCommand(n,t,e);if((t.payload.inputResponses?.length??0)>0)throw sessionStrandedError(e,`Its pending requests can no longer be answered; send a new message to start a fresh session.`);let i=await endStrandedSession(e,n,`message`);return{sessionId:(await startSession(r,{sessionId:i})).sessionId,status:`accepted`}}},async dispatchSession(e){return await dispatchWorkflowSessionCommand(e)},async getEventStream(e,t){if(t?.follow===!1)return readSessionEventHistory(e,t.startIndex);try{await assertRunnableSessionInbox(sessionInboxHookToken(sessionCommandHookToken(e)))}catch(e){throw e instanceof StrandedSessionOwnerError?sessionStrandedError(e):e}return readSessionEventStream(e,t?.startIndex)},async getStreamTailIndex(e){return await readSessionStreamTailIndex(e)},resolveContinuation}}async function dispatchWorkflowCommand(e,t){let n;try{let r=await resumeSessionInbox(e,t);n={runId:r.ownerRunId,sessionId:await r.sessionId}}catch(n){if(n instanceof StrandedSessionOwnerError)throw n;let r=t.kind===`send`&&typeof e!=`string`,i={status:`session_not_active`,retryable:!0};if(n instanceof SessionHandoffPendingError){if(r)return i;throw n}if(isInactiveCommandTarget(n))return r&&await isRunActive(e.sessionId)?i:inactiveCommandResult(t);throw logError(log,`failed to dispatch session command`,n,{command:t.kind,token:e}),n}return t.kind===`reset`&&await waitForSessionHooksRelease([sessionCommandHookToken(n.sessionId),logicalSessionToken(e)],{ownerRunId:n.runId,sessionId:n.sessionId}),activeCommandResult(t,n.sessionId)}async function settleStrandedCommand(e,t,n){switch(t.kind){case`reset`:return{previousSessionId:await endStrandedSession(n,e,`reset`),status:`reset`};case`send`:case`clear`:throw sessionStrandedError(n);default:return inactiveCommandResult(t)}}function sessionStrandedError(e,t){let n=e.eveVersion===void 0?{}:{eveVersion:e.eveVersion};return new SessionStrandedError(n,describeStrandedSession(n,t))}function activeCommandResult(e,t){return e.kind===`reset`?{previousSessionId:t,status:`reset`}:e.kind===`send`&&e.delivery!==void 0?{sessionId:t,status:`accepted`,deliveryId:e.delivery.deliveryId}:{sessionId:t,status:`accepted`}}function inactiveCommandResult(e){return e.kind===`send`?{status:`session_not_active`}:e.kind===`cancel`?{status:`no_active_turn`}:{status:`no_active_session`}}async function dispatchWorkflowSessionCommand(e){let t={sessionId:e.sessionId};try{return await dispatchWorkflowCommand(t,e.command)}catch(n){if(!(n instanceof StrandedSessionOwnerError))throw n;return await settleStrandedCommand(t,e.command,n)}}async function isRunActive(e){try{let t=await getRun(e).status;return t===`pending`||t===`running`}catch(e){if(isInactiveCommandTarget(e))return!1;throw e}}function isInactiveCommandTarget(e){if(e instanceof AcceptedSessionIdentityError)return!1;if(HookNotFoundError.is(e))return!0;for(let t of walkCauseChain(e))if(WorkflowRunNotFoundError.is(t)||RunExpiredError.is(t)||EntityConflictError.is(t))return!0;return!1}async function resolveContinuation(e){try{return await resolveSessionInbox(e)}catch(t){if(HookNotFoundError.is(t))return;throw logError(log,`failed to resolve session by continuation token`,t,{continuationToken:e}),t}}async function waitForCommandHookOwner(e){let t=await pollUntil(async()=>{try{return normalizeWorkflowHook(await getHookByToken(e))}catch(e){if(!HookNotFoundError.is(e))throw e;return}},SESSION_HOOK_HANDOVER_TIMEOUT_MS);if(t===void 0)throw new HookNotFoundError(e);return t}async function waitForSessionInbox(e){let t=sessionInboxHookToken(sessionCommandHookToken(e)),n=await pollUntil(async()=>await findSessionHookHolder(t)!==void 0||!await hasRunEnded(e)&&void 0,SESSION_HOOK_HANDOVER_TIMEOUT_MS);if(n===void 0)throw Error(`Session "${e}" did not start taking commands within ${SESSION_HOOK_HANDOVER_TIMEOUT_MS/1e3} seconds.`);return n}async function pollUntil(e,t){let n=Date.now()+t;for(let t=20;;t=Math.min(t*2,200)){let r=await e();if(r!==void 0||Date.now()>=n)return r;await new Promise(e=>setTimeout(e,t))}}async function hasRunEnded(e){try{let t=await getRun(e).status;return t!==`pending`&&t!==`running`}catch(e){for(let t of walkCauseChain(e))if(WorkflowRunNotFoundError.is(t))return!1;if(isInactiveCommandTarget(e))return!0;throw e}}async function startWorkflowOnCurrentDeployment(e,t,n){return await startWorkflowOnDeployment(e,t,await resolveCurrentWorkflowDeploymentId(),n)}async function startWorkflowOnDeployment(e,t,n,r){return await withWorkflowStartContext(async()=>{if(n.length===0||n===`latest`)throw Error(`Workflow starts require an exact deployment id.`);return await start(e,t,{...r,allowReservedAttributes:!0,attributes:{...r?.attributes,[EVE_VERSION_ATTRIBUTE]:EVE_PACKAGE_INFO.version},deploymentId:n})})}async function resolveCurrentWorkflowDeploymentId(){let e=process.env.VERCEL_DEPLOYMENT_ID?.trim()||await(await getWorld()).getDeploymentId();if(e.length===0||e===`latest`)throw Error(`Workflow runtime could not resolve an exact deployment id.`);return e}async function withWorkflowStartContext(e){let t=context.active(),n=isAgentTraceContext(t)?trace.deleteSpan(t):t;return await context.with(n,e)}function normalizeWorkflowHook(e){if(typeof e!=`object`||!e||!(`runId`in e))throw Error(`Workflow hook did not include a run id.`);let t=e.runId;if(typeof t!=`string`||t.length===0)throw Error(`Workflow hook did not include a run id.`);return{runId:t}}export{connectionEventDeliveryWorkflowReference,connectionEventWorkflowReference,createWorkflowRuntime,dispatchWorkflowSessionCommand,hasRunEnded,pollUntil,resolveContinuation,sessionTimeoutWorkflowReference,startWorkflowOnCurrentDeployment,startWorkflowOnDeployment,waitForCommandHookOwner,waitForSessionInbox,workflowEntryReference,workflowToolRunWorkflowReference};
|
|
1
|
+
import{createLogger,logError}from"#internal/logging.js";import{validateDeliveryIdempotencyKey}from"#channel/delivery-idempotency.js";import{SessionStrandedError,describeStrandedSession}from"#channel/session-stranded-error.js";import{sessionCommandHookToken,sessionInboxHookToken}from"#execution/session-inbox/address.js";import{SessionPredecessorKey}from"#context/keys.js";import{resolveInstalledPackageInfo}from"#internal/application/package.js";import{walkCauseChain}from"#shared/errors.js";import{validateToolStubTargets}from"#tool-stubs/validate-targets.js";import{getHookByToken,getRun,getWorld,start}from"#internal/workflow/runtime.js";import{getCompiledRuntimeAgentBundle}from"#runtime/sessions/compiled-agent-cache.js";import{ROOT_RUNTIME_AGENT_NODE_ID}from"#runtime/graph.js";import{serializeContext}from"#context/serialize.js";import{AcceptedSessionIdentityError,SessionHandoffPendingError,logicalSessionToken,resolveSessionInbox,resumeSessionInbox}from"#execution/session-inbox/resume.js";import{resolveEffectiveAgentRuntime}from"#execution/effective-agent-config.js";import{context,trace}from"#compiled/@opentelemetry/api/index.js";import{EntityConflictError,HookNotFoundError,RunExpiredError,WorkflowRunNotFoundError}from"#compiled/@workflow/errors/index.js";import{StrandedSessionOwnerError,assertRunnableSessionInbox,findSessionHookHolder}from"#execution/session-inbox/owner.js";import{initializeSessionInstrumentation}from"#instrumentation/runtime.js";import{EVE_PREWARM_ATTRIBUTE,EVE_VERSION_ATTRIBUTE,buildSessionAttributes,buildSubagentRootAttributes,readParentLineage}from"#execution/eve-workflow-attributes.js";import{endStrandedSession}from"#execution/session-inbox/end-stranded-session.js";import{SESSION_HOOK_HANDOVER_TIMEOUT_MS,waitForSessionHooksRelease}from"#execution/session-inbox/hook-release.js";import{CONNECTION_EVENT_DELIVERY_WORKFLOW_NAME,CONNECTION_EVENT_WORKFLOW_NAME,SESSION_TIMEOUT_WORKFLOW_NAME,WORKFLOW_ENTRY_NAME,WORKFLOW_TOOL_RUN_WORKFLOW_NAME}from"#execution/stable-workflow-names.js";import{prewarmWorkflowSession}from"#execution/session-prewarm.js";import{normalizeEveAttributes}from"#runtime/attributes/normalize.js";import{buildRunContext}from"#execution/runtime-context.js";import{readSessionEventHistory,readSessionEventStream,readSessionStreamTailIndex}from"#execution/session-event-stream.js";import{buildInvocationAttributes}from"#internal/invocation/metadata.js";import{isAgentTraceContext}from"#tracing/eve/agent-trace-context.js";const EVE_PACKAGE_INFO=resolveInstalledPackageInfo(),STABLE_ID_BASE=EVE_PACKAGE_INFO.name,log=createLogger(`execution.workflow-runtime`),workflowEntryReference={workflowId:`workflow//${STABLE_ID_BASE}//${WORKFLOW_ENTRY_NAME}`},sessionTimeoutWorkflowReference={workflowId:`workflow//${STABLE_ID_BASE}//${SESSION_TIMEOUT_WORKFLOW_NAME}`},workflowToolRunWorkflowReference={workflowId:`workflow//${STABLE_ID_BASE}//${WORKFLOW_TOOL_RUN_WORKFLOW_NAME}`},connectionEventWorkflowReference={workflowId:`workflow//${STABLE_ID_BASE}//${CONNECTION_EVENT_WORKFLOW_NAME}`},connectionEventDeliveryWorkflowReference={workflowId:`workflow//${STABLE_ID_BASE}//${CONNECTION_EVENT_DELIVERY_WORKFLOW_NAME}`};function createWorkflowRuntime(e){let startSession=async(t,n)=>{validateDeliveryIdempotencyKey(t.idempotencyKey);let r=await getCompiledRuntimeAgentBundle({compiledArtifactsSource:e.compiledArtifactsSource,nodeId:e.nodeId});t.toolStubs!==void 0&&t.toolStubs.rootSessionId===void 0&&validateToolStubTargets(t.toolStubs.rules,r.graph);let i=buildRunContext({agentSessionRuntimeOverrides:e.agentSessionRuntimeOverrides,bundle:r,dynamicSubagentAgentConfig:e.dynamicSubagentAgentConfig,run:t});n!==void 0&&i.set(SessionPredecessorKey,n);let a=resolveEffectiveAgentRuntime(r,i),o=initializeSessionInstrumentation({agentName:a.turnAgent.id,ctx:i}),s=a.limits?.sessionTimeoutMs,c=r.resolvedAgent.config?.experimental?.workflow?.retention??(o.action===`record`&&o.recordInputs&&o.recordOutputs?void 0:0),l=serializeContext(i),u=readParentLineage(l),d={idempotencyKey:t.idempotencyKey,kind:`initial`,input:t.input,ownerDeploymentId:await resolveCurrentWorkflowDeploymentId(),serializedContext:l};t.continuationConflictCommand!==void 0&&(d.continuationConflictCommand=t.continuationConflictCommand),s!==void 0&&(d.sessionTimeoutMs=s),c!==void 0&&(d.retention=c);let f={...u.sessionId===void 0?buildSessionAttributes({serializedContext:l}):buildSubagentRootAttributes({identity:{nodeId:r.nodeId??ROOT_RUNTIME_AGENT_NODE_ID},parentCallId:u.callId,parentSessionId:u.sessionId,parentTurnId:u.turnId,rootSessionId:u.rootSessionId??u.sessionId,serializedContext:l}),[EVE_PREWARM_ATTRIBUTE]:`1`,...t.externalInvocation===void 0?{}:buildInvocationAttributes(t.externalInvocation)},p;try{let e={allowReservedAttributes:!0,attributes:normalizeEveAttributes(f)};c!==void 0&&(e.experimental_retention=c),p=await startWorkflowOnDeployment(workflowEntryReference,[d],d.ownerDeploymentId,e)}catch(e){throw logError(log,`failed to start workflow run`,e,{continuationToken:t.continuationToken}),e}let m=p.runId;if(t.idempotencyKey!==void 0&&t.continuationToken!==void 0){let e=await pollUntil(()=>resolveContinuation(t.continuationToken),SESSION_HOOK_HANDOVER_TIMEOUT_MS);if(e===void 0)throw Error(`Delivery accepted, but its session identity is not ready. Retry with the same idempotencyKey.`);m=e.sessionId}let h,getEvents=()=>(h??=readSessionEventStream(m),h);return{get events(){return getEvents()},sessionId:m}};return{async createSession(e){return await startSession(e)},async dispatchContinuation(e){let{command:t,continuationToken:n,successor:r}=e;try{return await dispatchWorkflowCommand(n,t)}catch(e){if(!(e instanceof StrandedSessionOwnerError))throw e;if(t.kind!==`send`||r===void 0)return await settleStrandedCommand(n,t,e);if((t.payload.inputResponses?.length??0)>0)throw sessionStrandedError(e,`Its pending requests can no longer be answered; send a new message to start a fresh session.`);let i=await endStrandedSession(e,n,`message`);return{sessionId:(await startSession(r,{sessionId:i})).sessionId,status:`accepted`}}},async dispatchSession(e){return await dispatchWorkflowSessionCommand(e)},async getEventStream(e,t){if(t?.follow===!1)return readSessionEventHistory(e,t.startIndex);try{await assertRunnableSessionInbox(sessionInboxHookToken(sessionCommandHookToken(e)))}catch(e){throw e instanceof StrandedSessionOwnerError?sessionStrandedError(e):e}return readSessionEventStream(e,t?.startIndex)},async getStreamTailIndex(e){return await readSessionStreamTailIndex(e)},resolveContinuation}}async function dispatchWorkflowCommand(e,t){if(t.kind===`prewarm`)return typeof e==`string`?{status:`unsupported`}:await prewarmWorkflowSession(e.sessionId,t.targetDeploymentId);let n;try{let r=await resumeSessionInbox(e,t);n={runId:r.ownerRunId,sessionId:await r.sessionId}}catch(n){if(n instanceof StrandedSessionOwnerError)throw n;let r=t.kind===`send`&&typeof e!=`string`,i={status:`session_not_active`,retryable:!0};if(n instanceof SessionHandoffPendingError){if(r)return i;throw n}if(isInactiveCommandTarget(n))return r&&await isRunActive(e.sessionId)?i:inactiveCommandResult(t);throw logError(log,`failed to dispatch session command`,n,{command:t.kind,token:e}),n}return t.kind===`reset`&&await waitForSessionHooksRelease([sessionCommandHookToken(n.sessionId),logicalSessionToken(e)],{ownerRunId:n.runId,sessionId:n.sessionId}),activeCommandResult(t,n.sessionId)}async function settleStrandedCommand(e,t,n){switch(t.kind){case`reset`:return{previousSessionId:await endStrandedSession(n,e,`reset`),status:`reset`};case`send`:case`clear`:throw sessionStrandedError(n);default:return inactiveCommandResult(t)}}function sessionStrandedError(e,t){let n=e.eveVersion===void 0?{}:{eveVersion:e.eveVersion};return new SessionStrandedError(n,describeStrandedSession(n,t))}function activeCommandResult(e,t){return e.kind===`reset`?{previousSessionId:t,status:`reset`}:e.kind===`send`&&e.delivery!==void 0?{sessionId:t,status:`accepted`,deliveryId:e.delivery.deliveryId}:{sessionId:t,status:`accepted`}}function inactiveCommandResult(e){return e.kind===`send`?{status:`session_not_active`}:e.kind===`cancel`?{status:`no_active_turn`}:{status:`no_active_session`}}async function dispatchWorkflowSessionCommand(e){let t={sessionId:e.sessionId};try{return await dispatchWorkflowCommand(t,e.command)}catch(n){if(!(n instanceof StrandedSessionOwnerError))throw n;return await settleStrandedCommand(t,e.command,n)}}async function isRunActive(e){try{let t=await getRun(e).status;return t===`pending`||t===`running`}catch(e){if(isInactiveCommandTarget(e))return!1;throw e}}function isInactiveCommandTarget(e){if(e instanceof AcceptedSessionIdentityError)return!1;if(HookNotFoundError.is(e))return!0;for(let t of walkCauseChain(e))if(WorkflowRunNotFoundError.is(t)||RunExpiredError.is(t)||EntityConflictError.is(t))return!0;return!1}async function resolveContinuation(e,t){let n;try{n=await resolveSessionInbox(e)}catch(t){if(HookNotFoundError.is(t))return;throw logError(log,`failed to resolve session by continuation token`,t,{continuationToken:e}),t}if(t?.runnable!==!0)return n;try{await assertRunnableSessionInbox(sessionInboxHookToken(sessionCommandHookToken(n.sessionId)))}catch(e){throw e instanceof StrandedSessionOwnerError?sessionStrandedError(e):e}return n}async function waitForCommandHookOwner(e){let t=await pollUntil(async()=>{try{return normalizeWorkflowHook(await getHookByToken(e))}catch(e){if(!HookNotFoundError.is(e))throw e;return}},SESSION_HOOK_HANDOVER_TIMEOUT_MS);if(t===void 0)throw new HookNotFoundError(e);return t}async function waitForSessionInbox(e){let t=sessionInboxHookToken(sessionCommandHookToken(e)),n=await pollUntil(async()=>await findSessionHookHolder(t)!==void 0||!await hasRunEnded(e)&&void 0,SESSION_HOOK_HANDOVER_TIMEOUT_MS);if(n===void 0)throw Error(`Session "${e}" did not start taking commands within ${SESSION_HOOK_HANDOVER_TIMEOUT_MS/1e3} seconds.`);return n}async function pollUntil(e,t){let n=Date.now()+t;for(let t=20;;t=Math.min(t*2,200)){let r=await e();if(r!==void 0||Date.now()>=n)return r;await new Promise(e=>setTimeout(e,t))}}async function hasRunEnded(e){try{let t=await getRun(e).status;return t!==`pending`&&t!==`running`}catch(e){for(let t of walkCauseChain(e))if(WorkflowRunNotFoundError.is(t))return!1;if(isInactiveCommandTarget(e))return!0;throw e}}async function startWorkflowOnCurrentDeployment(e,t,n){return await startWorkflowOnDeployment(e,t,await resolveCurrentWorkflowDeploymentId(),n)}async function startWorkflowOnDeployment(e,t,n,r){return await withWorkflowStartContext(async()=>{if(n.length===0||n===`latest`)throw Error(`Workflow starts require an exact deployment id.`);return await start(e,t,{...r,allowReservedAttributes:!0,attributes:{...r?.attributes,[EVE_VERSION_ATTRIBUTE]:EVE_PACKAGE_INFO.version},deploymentId:n})})}async function resolveCurrentWorkflowDeploymentId(){let e=process.env.VERCEL_DEPLOYMENT_ID?.trim()||await(await getWorld()).getDeploymentId();if(e.length===0||e===`latest`)throw Error(`Workflow runtime could not resolve an exact deployment id.`);return e}async function withWorkflowStartContext(e){let t=context.active(),n=isAgentTraceContext(t)?trace.deleteSpan(t):t;return await context.with(n,e)}function normalizeWorkflowHook(e){if(typeof e!=`object`||!e||!(`runId`in e))throw Error(`Workflow hook did not include a run id.`);let t=e.runId;if(typeof t!=`string`||t.length===0)throw Error(`Workflow hook did not include a run id.`);return{runId:t}}export{connectionEventDeliveryWorkflowReference,connectionEventWorkflowReference,createWorkflowRuntime,dispatchWorkflowSessionCommand,hasRunEnded,pollUntil,resolveContinuation,sessionTimeoutWorkflowReference,startWorkflowOnCurrentDeployment,startWorkflowOnDeployment,waitForCommandHookOwner,waitForSessionInbox,workflowEntryReference,workflowToolRunWorkflowReference};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{z}from"#compiled/zod/index.js";const permissionSchema=z.object({provider:z.literal(`github`),repositories:z.array(z.string().regex(/^[A-Za-z0-9-]+\/[A-Za-z0-9._-]+$/u)).length(1),access:z.literal(`write`)}),githubShellInputSchema=z.object({command:z.string().trim().min(1).max(2e4),permissions:z.array(permissionSchema).length(1),description:z.string().trim().min(1).max(500).describe(`the concrete GitHub-side result expected from this command`),workingDirectory:z.string().trim().min(1).max(1e3).optional().describe(`sandbox workspace directory; defaults to
|
|
1
|
+
import{z}from"#compiled/zod/index.js";const permissionSchema=z.object({provider:z.literal(`github`),repositories:z.array(z.string().regex(/^[A-Za-z0-9-]+\/[A-Za-z0-9._-]+$/u)).length(1),access:z.literal(`write`)}),githubShellInputSchema=z.object({command:z.string().trim().min(1).max(2e4),permissions:z.array(permissionSchema).length(1),description:z.string().trim().min(1).max(500).describe(`the concrete GitHub-side result expected from this command`),workingDirectory:z.string().trim().min(1).max(1e3).optional().describe(`sandbox workspace directory; defaults to the workspace root`)});export{githubShellInputSchema};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export declare const environment: import("#public/definitions/sandbox.js").SandboxEnvironment<
|
|
1
|
+
export declare const environment: import("#public/definitions/sandbox.js").SandboxEnvironment<import("../../../shared/sandbox-network-policy.ts").SandboxNetworkOptions, import("../../../sandbox/providers/default.ts").DefaultSandboxSession>;
|
|
2
2
|
declare const _default: import("#public/definitions/sandbox.js").SandboxSelector;
|
|
3
3
|
export default _default;
|
|
@@ -1,13 +1,6 @@
|
|
|
1
1
|
import type { ModelMessage, UserContent } from "ai";
|
|
2
2
|
import type { ChannelAdapterContext } from "#channel/adapter.js";
|
|
3
3
|
import type { SandboxSession } from "#public/definitions/sandbox.js";
|
|
4
|
-
/**
|
|
5
|
-
* Sandbox directory where eve stages message attachments and tool-result
|
|
6
|
-
* files. It sits under eve's own dot-directory so it never collides with an
|
|
7
|
-
* agent's `/workspace/attachments`. Authored canonical path —
|
|
8
|
-
* {@link SandboxSession.writeFile} translates to the backend-native location.
|
|
9
|
-
*/
|
|
10
|
-
export declare const ATTACHMENTS_ROOT = "/workspace/.eve/attachments";
|
|
11
4
|
/**
|
|
12
5
|
* Writes inbound `FilePart` bytes into the sandbox and rewrites each
|
|
13
6
|
* staged part to a compact `eve-sandbox:` ref. Links resolve through the
|