eve 0.82.0 → 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 +69 -0
- package/NOTICE +1 -1
- package/dist/src/channel/pending-authorization.d.ts +5 -0
- package/dist/src/channel/pending-authorization.js +1 -1
- package/dist/src/channel/session.d.ts +2 -0
- package/dist/src/channel/session.js +1 -1
- package/dist/src/channel/types.d.ts +5 -0
- package/dist/src/chunks/{use-eve-agent-DlznYwQk.js → use-eve-agent-3-WRmJkd.js} +40 -5
- package/dist/src/chunks/{use-eve-agent-DTu78IAF.js → use-eve-agent-Ci5dr0aR.js} +40 -5
- 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/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 +1 -0
- 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/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 +21 -14
- package/dist/src/compiler/extension-compatibility.js +1 -1
- package/dist/src/compiler/manifest.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/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/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.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/execution/agent-sessions/context.d.ts +1 -1
- package/dist/src/execution/agent-sessions/context.js +1 -1
- package/dist/src/execution/coordination-dispatch-shared.d.ts +3 -0
- package/dist/src/execution/coordination-dispatch-shared.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/eve-workflow-attributes.d.ts +3 -1
- package/dist/src/execution/eve-workflow-attributes.js +1 -1
- package/dist/src/execution/invoke-tool.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/admission.js +1 -1
- package/dist/src/execution/session/checkpoint-migrations.js +1 -1
- package/dist/src/execution/session/entry-input.d.ts +5 -4
- package/dist/src/execution/session/entry.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 +2 -1
- package/dist/src/execution/session/handoff.js +1 -1
- package/dist/src/execution/session/input-queue.d.ts +3 -0
- 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/program.js +1 -1
- package/dist/src/execution/session/timeout-control.d.ts +4 -0
- package/dist/src/execution/session/timeout-control.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.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/skills/instructions.js +1 -1
- package/dist/src/execution/tools/agent-router-workflow.js +1 -1
- 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.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/index.d.ts +2 -1
- package/dist/src/harness/hitl/index.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/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/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-model-output.d.ts +19 -3
- package/dist/src/harness/tool-model-output.js +1 -1
- package/dist/src/internal/application/compiled-artifacts.js +8 -4
- 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-module-build-options.d.ts +6 -0
- package/dist/src/internal/authored-module-build-options.js +1 -1
- 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.js +1 -1
- package/dist/src/internal/authored-module-loader.js +1 -1
- package/dist/src/internal/authored-relative-extension-resolver.js +1 -1
- package/dist/src/internal/bundler/nitro-rolldown.d.ts +3 -1
- 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/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/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/start-development-server.js +2 -2
- 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/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/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/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 +15 -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/linq/linqChannel.d.ts +4 -1
- package/dist/src/public/channels/linq/linqChannel.js +1 -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/definitions/channel.js +1 -1
- package/dist/src/public/definitions/sandbox.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/react/use-eve-agent.d.ts +1 -1
- 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/subagents/workflow.d.ts +6 -0
- package/dist/src/runtime/subagents/workflow.js +1 -1
- 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 +2 -0
- 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/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/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 +19 -4
- 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/channels/custom.mdx +3 -3
- package/docs/channels/discord.mdx +279 -7
- package/docs/channels/eve.mdx +13 -2
- package/docs/channels/linq.mdx +2 -2
- package/docs/channels/mcp.mdx +2 -2
- package/docs/channels/overview.mdx +1 -1
- package/docs/channels/photon.mdx +1 -1
- package/docs/concepts/built-in-tools.md +31 -8
- package/docs/concepts/execution-model-and-durability.mdx +6 -101
- package/docs/concepts/security-model.md +2 -0
- package/docs/concepts/sessions-runs-and-streaming.md +44 -36
- package/docs/connections/openapi.mdx +2 -0
- package/docs/evals/reporters.mdx +1 -1
- package/docs/evals/running.mdx +1 -1
- package/docs/guides/client/messages.mdx +1 -1
- package/docs/guides/deployment/overview.md +4 -4
- package/docs/guides/deployment/self-hosting.md +50 -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/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/reference/agent-files.md +3 -3
- package/docs/reference/cli.md +7 -2
- 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/skills.mdx +1 -1
- package/docs/subagents/index.mdx +2 -2
- package/docs/tools/overview.mdx +19 -0
- package/docs/tools/workflows.mdx +73 -5
- package/docs/tutorial/run-analysis.mdx +2 -2
- 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/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/public/sandbox/microsandbox-sandbox.d.ts +0 -48
- package/dist/src/public/sandbox/microsandbox-sandbox.js +0 -1
- 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/docs/sandbox/microsandbox.mdx +0 -31
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Ordinary Discord messages, which Discord delivers only over its Gateway
|
|
3
|
+
* WebSocket. A relay such as `experimental_runDiscordGatewayRelay` from
|
|
4
|
+
* `eve/channels/discord/gateway` holds that connection and forwards each
|
|
5
|
+
* dispatch, unchanged, to the route this module mounts.
|
|
6
|
+
*/
|
|
7
|
+
import type { SessionAuthContext } from "#channel/types.js";
|
|
8
|
+
import { type AuthFn } from "#public/channels/auth.js";
|
|
9
|
+
import type { DiscordChannelConfig, DiscordChannelState, DiscordContext } from "#public/channels/discord/discordChannel.js";
|
|
10
|
+
import { type DiscordAttachment, type DiscordUser } from "#public/channels/discord/inbound.js";
|
|
11
|
+
import { type HttpRouteDefinition } from "#channel/routes.js";
|
|
12
|
+
/** An ordinary Discord message forwarded from the Gateway. */
|
|
13
|
+
export interface DiscordGatewayMessage {
|
|
14
|
+
readonly id: string;
|
|
15
|
+
readonly channelId: string;
|
|
16
|
+
/** Absent for direct messages. */
|
|
17
|
+
readonly guildId?: string;
|
|
18
|
+
/**
|
|
19
|
+
* Message text with the bot's own mention removed. Discord sends an empty
|
|
20
|
+
* string for messages that neither mention the bot nor arrive as a DM unless
|
|
21
|
+
* the bot has the Message Content intent.
|
|
22
|
+
*/
|
|
23
|
+
readonly content: string;
|
|
24
|
+
readonly author: DiscordUser;
|
|
25
|
+
readonly attachments: readonly DiscordAttachment[];
|
|
26
|
+
/** ID of the message this one replies to, if any. */
|
|
27
|
+
readonly referencedMessageId?: string;
|
|
28
|
+
/**
|
|
29
|
+
* Whether the message is meant for the bot: a direct message, a mention, a
|
|
30
|
+
* reply to one of the bot's messages, or a message in a thread where the bot
|
|
31
|
+
* already has a conversation.
|
|
32
|
+
*/
|
|
33
|
+
readonly addressed: boolean;
|
|
34
|
+
/** Discord's raw message object. */
|
|
35
|
+
readonly raw: Record<string, unknown>;
|
|
36
|
+
}
|
|
37
|
+
/** Minutes of inactivity before Discord archives a thread; the values Discord accepts. */
|
|
38
|
+
export type DiscordThreadAutoArchiveMinutes = 60 | 1440 | 4320 | 10080;
|
|
39
|
+
/** Options for starting a thread from a message; see {@link DiscordMessageResult.startThread}. */
|
|
40
|
+
export interface DiscordStartThreadOptions {
|
|
41
|
+
/** Thread name. Defaults to the message's first line, then its first attachment's filename. */
|
|
42
|
+
readonly name?: string;
|
|
43
|
+
/** Defaults to the channel's own setting. */
|
|
44
|
+
readonly autoArchiveMinutes?: DiscordThreadAutoArchiveMinutes;
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Result of the Gateway message hook. Return `null` to ignore the message.
|
|
48
|
+
* - `auth`: session auth context for the dispatched turn, or `null` for anonymous.
|
|
49
|
+
* - `context`: model-visible context lines appended after the Discord context block.
|
|
50
|
+
* - `title`: workflow run title override that does not change model input.
|
|
51
|
+
* - `conversation`: which session in the channel the message joins; see
|
|
52
|
+
* {@link DiscordMessageResult.conversation}.
|
|
53
|
+
* - `startThread`: answer in a new thread off the message; see
|
|
54
|
+
* {@link DiscordMessageResult.startThread}.
|
|
55
|
+
*/
|
|
56
|
+
export type DiscordMessageResult = {
|
|
57
|
+
readonly auth: SessionAuthContext | null;
|
|
58
|
+
readonly context?: readonly string[];
|
|
59
|
+
readonly title?: string;
|
|
60
|
+
/**
|
|
61
|
+
* Key of the session the message joins within its Discord channel. Messages
|
|
62
|
+
* with the same key share a session. A message ID is the key of the
|
|
63
|
+
* session that owns that message: the one it started, or the one whose bot
|
|
64
|
+
* reply it is. `"channel"` is one session for the whole channel. Any other
|
|
65
|
+
* string is your own grouping, such as `` `user:${message.author.id}` ``.
|
|
66
|
+
*
|
|
67
|
+
* Defaults to `"channel"` in DMs and threads, which includes the thread a
|
|
68
|
+
* text-channel mention starts; elsewhere, to the replied-to message's session
|
|
69
|
+
* when one owns it, or else a new session keyed by this message.
|
|
70
|
+
*/
|
|
71
|
+
readonly conversation?: string;
|
|
72
|
+
/**
|
|
73
|
+
* Starts a thread from the message and moves the conversation into it, as
|
|
74
|
+
* one session for the thread. Applies only when the message would start a
|
|
75
|
+
* new session in a text channel: DMs, messages already in a thread, and
|
|
76
|
+
* replies that continue a session are left as they are. eve adds the author
|
|
77
|
+
* to the thread. When Discord refuses, for example because the bot lacks the
|
|
78
|
+
* Create Public Threads permission, the message is handled as if
|
|
79
|
+
* `startThread` were `false`. Defaults to `gateway.startThread`.
|
|
80
|
+
*/
|
|
81
|
+
readonly startThread?: boolean | DiscordStartThreadOptions;
|
|
82
|
+
} | null;
|
|
83
|
+
/** Sync or async {@link DiscordMessageResult}. */
|
|
84
|
+
export type DiscordMessageResultOrPromise = DiscordMessageResult | Promise<DiscordMessageResult>;
|
|
85
|
+
/** Configuration for `discordChannel({ gateway })`. */
|
|
86
|
+
export interface DiscordGatewayConfig {
|
|
87
|
+
/** Override the route that accepts forwarded dispatches (`/eve/v1/discord/gateway`). */
|
|
88
|
+
readonly route?: string;
|
|
89
|
+
/**
|
|
90
|
+
* Authenticates the relay. The body names the message author, so whoever
|
|
91
|
+
* passes can act as any Discord user. Defaults to `localDev()` plus Vercel
|
|
92
|
+
* OIDC tokens from this project's own runtime in the same environment,
|
|
93
|
+
* which is what `experimental_runDiscordGatewayRelay` sends from a Vercel Daemon.
|
|
94
|
+
*/
|
|
95
|
+
readonly auth?: AuthFn<Request> | readonly AuthFn<Request>[];
|
|
96
|
+
/**
|
|
97
|
+
* Decides whether a message dispatches, under what `auth`, and which
|
|
98
|
+
* session it joins. Called for every conversational message from a person;
|
|
99
|
+
* bot authors never reach it. Defaults to dispatching addressed messages
|
|
100
|
+
* with `defaultDiscordMessageAuth` and the default `conversation`.
|
|
101
|
+
*/
|
|
102
|
+
onMessage?(ctx: DiscordContext, message: DiscordGatewayMessage): DiscordMessageResultOrPromise;
|
|
103
|
+
/**
|
|
104
|
+
* Default for each accepted message's `startThread`. Defaults to `true`, so
|
|
105
|
+
* the bot answers a mention in a text channel in a new thread; set `false`
|
|
106
|
+
* to answer in the channel, where replies continue the conversation. An
|
|
107
|
+
* `onMessage` result's own `startThread` overrides it.
|
|
108
|
+
*/
|
|
109
|
+
readonly startThread?: boolean | DiscordStartThreadOptions;
|
|
110
|
+
}
|
|
111
|
+
/** Mounts the route that turns forwarded `MESSAGE_CREATE` dispatches into turns. */
|
|
112
|
+
export declare function createDiscordGatewayRoute(input: {
|
|
113
|
+
readonly config: DiscordChannelConfig;
|
|
114
|
+
readonly gateway: DiscordGatewayConfig;
|
|
115
|
+
readonly buildContext: (state: DiscordChannelState) => DiscordContext;
|
|
116
|
+
}): HttpRouteDefinition<DiscordChannelState>;
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{createLogger,logError}from"#internal/logging.js";import{isNonEmptyString,isObject}from"#shared/guards.js";import{localDev,routeAuth}from"#public/channels/auth.js";import{EveAttachmentError}from"#internal/attachments/errors.js";import{readLimitedBytes}from"#internal/attachments/limited-read.js";import{callDiscordApi,discordContinuationToken,resolveDiscordApplicationId,resolveDiscordBotToken}from"#public/channels/discord/api.js";import{defaultOnMessage}from"#public/channels/discord/defaults.js";import{formatDiscordContextBlock,parseDiscordAttachment,parseDiscordUser}from"#public/channels/discord/inbound.js";import{discordCommandContent}from"#public/channels/discord/attachments.js";import{sameEnvironmentVercelOidc}from"#public/channels/same-environment-oidc.js";import{discordAudience}from"#public/channels/discord/audience.js";import{POST}from"#channel/routes.js";const log=createLogger(`discord.gateway`),WHOLE_CHANNEL_CONVERSATION=`channel`,CONVERSATIONAL_MESSAGE_TYPES=new Set([0,19]),THREAD_CHANNEL_TYPES=new Set([10,11,12]);function createDiscordGatewayRoute(e){let{config:t,gateway:n}=e,r=n.auth??[localDev(),sameEnvironmentVercelOidc()],i=n.onMessage??defaultOnMessage;return POST(n.route??`/eve/v1/discord/gateway`,async(a,{from:o,resolveSession:s})=>{let c=await routeAuth(a,r);if(c instanceof Response)return c;let l;try{l=await readLimitedBytes(a,1048576,`discord`)}catch(e){if(!(e instanceof EveAttachmentError))throw e;return Response.json({error:`Body exceeds 1 MB.`},{status:413})}let u;try{u=JSON.parse(l.toString(`utf8`))}catch{return Response.json({error:`Body is not JSON.`},{status:400})}if(!isObject(u)||u.t!==`MESSAGE_CREATE`)return ignored(`unsupported_event`);let d=isObject(u.d)?u.d:null,f=d===null?null:parseGatewayMessage(d);if(f===null)return ignored(`invalid_message`);if(f.author.isBot)return ignored(`bot_author`);let p=await resolveDiscordApplicationId(t.credentials?.applicationId),m=stripMention(f.content,p);if(!m&&f.attachments.length===0)return ignored(`empty_message`);let h=f.guildId===void 0,g=h?void 0:await s(discordContinuationToken(f.channelId,WHOLE_CHANNEL_CONVERSATION)),_={...f,addressed:h||g!==void 0||mentions(f.raw,p)||repliesTo(f.raw,p),content:m},v={applicationId:p,channelId:_.channelId,conversationId:null,guildId:_.guildId??null,hasMessageAnchor:!0,initialResponseSent:!0,interactionToken:null};h&&(v.audience=discordAudience(1),v.directMessage=!0);let y;try{y=await i(e.buildContext(v),_)}catch(e){return logError(log,`Discord message handler failed`,e,{messageId:_.id}),Response.json({error:`The message handler failed.`},{status:500})}if(y===null)return ignored(`not_accepted`);let b=isNonEmptyString(y.conversation)?y.conversation:void 0,x=y.startThread??n.startThread??!0;v.conversationId=await routeMessage();async function routeMessage(){if(h||g!==void 0)return b??WHOLE_CHANNEL_CONVERSATION;if(b===void 0){let e=_.referencedMessageId;if(e!==void 0&&await s(discordContinuationToken(_.channelId,e))!==void 0)return e}else if(x===!1)return b;let e=await lookUpChannelType(t,_.channelId);if(e!==void 0&&(v.audience=discordAudience(e)),e!==void 0&&THREAD_CHANNEL_TYPES.has(e))return b??WHOLE_CHANNEL_CONVERSATION;if(x!==!1){let e=await startThreadFrom(t,_,x===!0?{}:x);if(e!==void 0)return v.channelId=e,v.audience=`unknown`,b??WHOLE_CHANNEL_CONVERSATION}return b??_.id}let S=formatDiscordContextBlock({applicationId:p,channelId:_.channelId,guildId:_.guildId,messageId:_.id,userId:_.author.id,username:_.author.username}),C=await o(discordContinuationToken(v.channelId??_.channelId,v.conversationId)).send(discordCommandContent(m,_.attachments),{auth:y.auth,context:[S,...y.context??[]],state:v,title:y.title});return Response.json({accepted:!0,sessionId:C.id},{status:202})})}function ignored(e){return Response.json({accepted:!1,reason:e})}function parseGatewayMessage(e){if(!isNonEmptyString(e.id)||!isNonEmptyString(e.channel_id)||typeof e.type==`number`&&!CONVERSATIONAL_MESSAGE_TYPES.has(e.type))return null;let t=parseDiscordUser(e.author);return t===null?null:{attachments:Array.isArray(e.attachments)?e.attachments.flatMap(e=>parseDiscordAttachment(e)??[]):[],author:t,channelId:e.channel_id,content:typeof e.content==`string`?e.content:``,guildId:isNonEmptyString(e.guild_id)?e.guild_id:void 0,id:e.id,raw:e,referencedMessageId:referencedMessageId(e)}}function referencedMessageId(e){let t=isObject(e.message_reference)?e.message_reference:null;if(!(t===null||t.type!==void 0&&t.type!==0))return isNonEmptyString(t.message_id)?t.message_id:void 0}function mentions(e,t){return Array.isArray(e.mentions)&&e.mentions.some(e=>isObject(e)&&e.id===t)}function repliesTo(e,t){let n=isObject(e.referenced_message)?e.referenced_message:null;return isObject(n?.author)&&n.author.id===t}function stripMention(e,t){return e.replaceAll(`<@${t}>`,``).replaceAll(`<@!${t}>`,``).trim()}async function startThreadFrom(e,t,n){let r={name:(n.name?.trim()||t.content.split(`
|
|
2
|
+
`,1)[0]?.trim()||t.attachments[0]?.filename||`Conversation`).slice(0,100)};n.autoArchiveMinutes!==void 0&&(r.auto_archive_duration=n.autoArchiveMinutes);try{let n=await resolveDiscordBotToken(e.credentials?.botToken),i={apiBaseUrl:e.api?.apiBaseUrl,botToken:n,fetch:e.api?.fetch},a=await callDiscordApi({...i,body:r,path:`/channels/${encodeURIComponent(t.channelId)}/messages/${encodeURIComponent(t.id)}/threads`}),o=isObject(a.body)?a.body.id:void 0;if(!a.ok||!isNonEmptyString(o)){log.warn(`Discord thread creation failed; answering in the channel`,{channelId:t.channelId,status:a.status});return}let s=await callDiscordApi({...i,method:`PUT`,path:`/channels/${encodeURIComponent(o)}/thread-members/${encodeURIComponent(t.author.id)}`});return s.ok||log.warn(`Adding the author to a Discord thread failed`,{status:s.status,threadId:o}),o}catch(e){log.warn(`Discord thread creation failed; answering in the channel`,{channelId:t.channelId,error:e});return}}async function lookUpChannelType(e,t){try{let n=await callDiscordApi({apiBaseUrl:e.api?.apiBaseUrl,botToken:await resolveDiscordBotToken(e.credentials?.botToken),fetch:e.api?.fetch,method:`GET`,path:`/channels/${encodeURIComponent(t)}`});if(n.ok&&isObject(n.body)&&typeof n.body.type==`number`)return n.body.type;log.warn(`Discord channel lookup failed; treating the channel as a non-thread`,{channelId:t,status:n.status})}catch(e){log.warn(`Discord channel lookup failed; treating the channel as a non-thread`,{channelId:t,error:e})}}export{createDiscordGatewayRoute};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{shellQuote}from"#shared/shell-quote.js";import{resolveGitHubInstallationToken}from"#public/channels/github/auth.js";import{getGitHubPullRequest,getGitHubRepository}from"#public/channels/github/api.js";import{gitHubGitBrokerNetworkPolicy,gitHubRemoteUrl,isFullGitSha}from"#shared/git.js";async function checkoutGitHubRepository(e,t){let n=await resolveCheckoutDescriptor(t),r=e.resolvePath(t.path
|
|
1
|
+
import{shellQuote}from"#shared/shell-quote.js";import{resolveGitHubInstallationToken}from"#public/channels/github/auth.js";import{getGitHubPullRequest,getGitHubRepository}from"#public/channels/github/api.js";import{gitHubGitBrokerNetworkPolicy,gitHubRemoteUrl,isFullGitSha}from"#shared/git.js";async function checkoutGitHubRepository(e,t){let n=await resolveCheckoutDescriptor(t),r=e.resolvePath(t.path??`.`),i=resolveCheckoutRef(t.ref,n);if(isFullGitSha(i)){let t=await readCheckoutHead(e,r);if(t===i)return{baseRef:n.baseRef,path:r,ref:i,sha:t}}let a=normalizeCheckoutDepth(t.depth),o=t.mode===`full`?``:` --depth ${a}`,s=await resolveGitHubInstallationToken({api:t.api,credentials:t.credentials,installationId:n.installationId}),c=gitHubRemoteUrl({owner:n.owner,repo:n.repo}),l=isFullGitSha(i)?i:`FETCH_HEAD`;await e.setNetworkPolicy(gitHubGitBrokerNetworkPolicy(s)),await runCheckoutCommand({command:`mkdir -p ${shellQuote(r)}`,label:`create checkout directory`,sandbox:e}),await runCheckoutCommand({command:`cd ${shellQuote(r)} && git init`,label:`initialize git repository`,sandbox:e}),await runCheckoutCommand({command:`cd ${shellQuote(r)} && git remote remove origin >/dev/null 2>&1 || true`,label:`reset git remote`,sandbox:e}),await runCheckoutCommand({command:`cd ${shellQuote(r)} && git remote add origin ${shellQuote(c)}`,label:`configure git remote`,sandbox:e}),await runCheckoutCommand({command:`cd ${shellQuote(r)} && GIT_TERMINAL_PROMPT=0 git fetch${o} origin ${shellQuote(i)}`,label:`fetch GitHub ref`,sandbox:e}),await runCheckoutCommand({command:`cd ${shellQuote(r)} && git checkout --detach ${shellQuote(l)}`,label:`checkout GitHub ref`,sandbox:e}),t.includeBase===!0&&n.baseSha!==null&&await runCheckoutCommand({command:`cd ${shellQuote(r)} && GIT_TERMINAL_PROMPT=0 git fetch${o} origin ${shellQuote(n.baseSha)}`,label:`fetch GitHub base ref`,sandbox:e});let u=(await runCheckoutCommand({command:`cd ${shellQuote(r)} && git rev-parse HEAD`,label:`resolve checked out commit`,sandbox:e})).stdout.trim()||n.headSha||i;return{baseRef:n.baseRef,path:r,ref:i,sha:u}}async function resolveCheckoutDescriptor(e){let t=readNonEmptyString(e.owner),n=readNonEmptyString(e.repo);if(t===void 0||n===void 0)throw Error(`GitHub checkout requires a repository owner and name.`);if(e.installationId===void 0||e.installationId===null)throw Error(`GitHub checkout requires a GitHub App installation id.`);let r=e.pullRequestNumber??null,i=readNonEmptyString(e.ref),a=null;r!==null&&(i===void 0&&((e.headSha===void 0||e.headSha===null)&&(e.headRef===void 0||e.headRef===null)||e.defaultBranch===void 0||e.defaultBranch===null)||e.includeBase===!0&&(e.baseSha===void 0||e.baseSha===null)||e.includeBase===!0&&(e.baseRef===void 0||e.baseRef===null))&&(a=await getGitHubPullRequest({api:e.api,credentials:e.credentials,installationId:e.installationId,owner:t,pullRequestNumber:r,repo:n}));let o=readNonEmptyString(e.defaultBranch)??a?.defaultBranch??await resolveRepositoryDefaultBranch(e,{owner:t,pullRequestNumber:r,repo:n});return{baseRef:e.baseRef??a?.base.ref??null,baseSha:e.baseSha??a?.base.sha??null,defaultBranch:o,headRef:e.headRef??a?.head.ref??null,headSha:e.headSha??a?.head.sha??null,installationId:e.installationId,owner:t,pullRequestNumber:r,repo:n}}async function resolveRepositoryDefaultBranch(e,t){return t.pullRequestNumber!==null||readNonEmptyString(e.ref)!==void 0||readNonEmptyString(e.headSha)!==void 0||readNonEmptyString(e.headRef)!==void 0?null:(await getGitHubRepository({api:e.api,credentials:e.credentials,installationId:e.installationId??void 0,owner:t.owner,repo:t.repo})).defaultBranch??null}function resolveCheckoutRef(e,t){if(e!==void 0&&e.trim().length>0)return e.trim();if(t.headSha!==null)return t.headSha;if(t.pullRequestNumber!==null)return`refs/pull/${t.pullRequestNumber}/head`;if(t.headRef!==null)return t.headRef;if(t.defaultBranch!==null)return t.defaultBranch;throw Error(`GitHub checkout could not resolve a ref to fetch.`)}async function readCheckoutHead(e,t){let n=await e.run({command:`cd ${shellQuote(t)} && git rev-parse HEAD 2>/dev/null`});if(n.exitCode!==0)return null;let r=String(n.stdout??``).trim();return isFullGitSha(r)?r:null}async function runCheckoutCommand(e){let t=await e.sandbox.run({command:e.command}),n=String(t.stderr??``),r=String(t.stdout??``);if(t.exitCode===0)return{stderr:n,stdout:r};throw Error([`GitHub checkout failed during ${e.label} (exit ${t.exitCode}).`,n?`stderr: ${n}`:void 0,r?`stdout: ${r}`:void 0,`Verify the GitHub App installation has access to this repository.`].filter(e=>e!==void 0).join(` `))}function normalizeCheckoutDepth(e){if(e===void 0)return 1;if(!Number.isFinite(e)||e<1)throw Error(`GitHub checkout depth must be a positive number.`);return Math.floor(e)}function readNonEmptyString(e){return typeof e==`string`&&e.trim().length>0?e.trim():void 0}export{checkoutGitHubRepository};
|
|
@@ -30,7 +30,10 @@ export interface LinqChannelCredentials {
|
|
|
30
30
|
readonly apiKey?: LinqCredentialValue;
|
|
31
31
|
/** Signing secret for direct Linq webhook delivery. */
|
|
32
32
|
readonly signingSecret?: LinqCredentialValue;
|
|
33
|
-
/**
|
|
33
|
+
/**
|
|
34
|
+
* Trusted verifier for webhooks forwarded by a provider such as Vercel Connect.
|
|
35
|
+
* Return a falsy value or throw to reject the request.
|
|
36
|
+
*/
|
|
34
37
|
readonly webhookVerifier?: LinqWebhookVerifier;
|
|
35
38
|
}
|
|
36
39
|
/** Configuration for {@link linqChannel}. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{sameEnvironmentVercelOidc}from"#public/channels/same-environment-oidc.js";import{chatSdkChannel}from"#public/channels/chat-sdk/index.js";import{dispatchIMessageTapbacks,iMessageTapbackTool}from"#public/channels/imessage-tapbacks.js";import{createMemoryState}from"#compiled/@chat-adapter/state-memory/index.js";import{createLinqAdapter}from"#compiled/@linqapp/chat-sdk-adapter/index.js";import{formatReplyContext}from"#public/channels/chat-sdk/reply-context.js";import{linqInboundContent,linqQuotedMessage,rehydrateLinqAttachment}from"#public/channels/linq/inboundContent.js";function linqChannel(e){let t=normalizeCredentials(e.credentials);e.baseURL!==void 0&&(t.baseURL=e.baseURL);let n=createLinqAdapter(t);n.rehydrateAttachment=rehydrateLinqAttachment;let r=chatSdkChannel({adapters:{linq:n},concurrency:`concurrent`,events:e.events,routes:{linq:e.route??`/eve/v1/linq`},state:createMemoryState(),streaming:!1,turnPolicy:e.turnPolicy,userName:e.userName??`eve`}),i=e.onMessage??defaultOnMessage;r.bot.onDirectMessage(async(e,t)=>{await dispatchMessage(r,i,e,t)}),r.bot.onNewMessage(/[\s\S]*/,async(e,t)=>{await dispatchMessage(r,i,e,t)}),e.onTapback&&dispatchIMessageTapbacks(r,e.onTapback);let a=Object.assign(r.channel,{tapbackTool:()=>iMessageTapbackTool({adapterName:`linq`,bot:r.bot,channel:a,channelLabel:`Linq`})});return a}function normalizeCredentials(e){let{apiKey:t,signingSecret:n,webhookVerifier:r}=e??{},i={};t!==void 0&&(i.credentials=createCredentialProvider(t,n));let a=r??(n===void 0?sameEnvironmentVercelOidc():void 0);return a!==void 0&&(i.webhookVerifier=rejectFalsyResults(a)),i}function rejectFalsyResults(e){return async(t,n)=>await e(t,n)||!1}function createCredentialProvider(e,t){return async()=>{let n={apiKey:await resolveCredentialValue(e)};return t!==void 0&&(n.signingSecret=await resolveCredentialValue(t)),n}}async function resolveCredentialValue(e){return typeof e==`function`?await e():e}function defaultLinqAuth(e){let t={};return e.author.userName!==void 0&&(t.user_name=e.author.userName),{attributes:t,authenticator:`linq-message`,issuer:`linq`,principalId:`linq:${e.author.userId}`,principalType:e.author.isBot?`service`:`user`,subject:e.author.userId}}async function defaultOnMessage(e,t){return{auth:defaultLinqAuth(t)}}async function dispatchMessage(e,t,n,r){let i=await t({thread:n},r);if(i===null)return;let a=e.bot.getAdapter(`linq`),o=linqInboundContent(r),[,s]=await Promise.all([markReadBestEffort(a,n,r),o===void 0?void 0:linqQuotedMessage(a,r)]);o!==void 0&&await e.send(o,{auth:i.auth,context:[...i.context??[],...s?[formatReplyContext(s,r.text)]:[]],history:i.history,thread:n,title:i.title})}async function markReadBestEffort(e,t,n){try{await e.markRead(t.id,n.id)}catch{}}export{defaultLinqAuth,linqChannel};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{sameEnvironmentVercelOidc}from"#public/channels/same-environment-oidc.js";import{chatSdkChannel}from"#public/channels/chat-sdk/index.js";import{dispatchIMessageTapbacks,iMessageTapbackTool}from"#public/channels/imessage-tapbacks.js";import{createMemoryState}from"#compiled/@chat-adapter/state-memory/index.js";import{formatReplyContext}from"#public/channels/chat-sdk/reply-context.js";import{createiMessageAdapter}from"#compiled/@photon-ai/chat-adapter-imessage/index.js";import{addPhotonAttachmentDownloads,addPhotonAttachmentRehydration}from"#public/channels/photon/attachments.js";import{photonInboundContent,photonQuotedMessage}from"#public/channels/photon/inboundContent.js";function photonIMessageChannel(e){let t=e.webhookSecret??process.env.IMESSAGE_WEBHOOK_SECRET,n=createiMessageAdapter({credentials:e.credentials,...e.webhookVerifier?{webhookVerifier:e.webhookVerifier}:t?{webhookSecret:t}:{webhookVerifier:sameEnvironmentVercelOidc()}});addPhotonAttachmentRehydration(n);let r=chatSdkChannel({adapters:{imessage:n},concurrency:`concurrent`,events:e.events,routes:{imessage:e.route??`/eve/v1/photon`},state:createMemoryState(),streaming:!1,turnPolicy:e.turnPolicy,userName:e.userName??`eve`}),i=e.onMessage??defaultOnMessage;r.bot.onDirectMessage(async(e,t)=>{await dispatchMessage(r,i,e,t)}),r.bot.onNewMessage(/[\s\S]*/,async(e,t)=>{await dispatchMessage(r,i,e,t)}),e.onTapback&&dispatchIMessageTapbacks(r,e.onTapback);let a=Object.assign(r.channel,{tapbackTool:()=>iMessageTapbackTool({adapterName:`imessage`,bot:r.bot,channel:a,channelLabel:`Photon iMessage`,sendEmoji:sendPhotonEmojiTapback})});return a}async function sendPhotonEmojiTapback(e,t,n,r){let i=(await e.fetchMessage?.(t,n))?.raw;if(typeof i?.react!=`function`)throw Error(`Photon could not find the message to react to.`);await i.react(r)}function defaultPhotonAuth(e){let t={};return e.author.userName!==void 0&&(t.user_name=e.author.userName),{attributes:t,authenticator:`photon-imessage`,issuer:`photon`,principalId:`photon:${e.author.userId}`,principalType:e.author.isBot?`service`:`user`,subject:e.author.userId}}async function defaultOnMessage(e,t){return{auth:defaultPhotonAuth(t)}}async function dispatchMessage(e,t,n,r){let i=await t({thread:n},r);if(i===null)return;let a=e.bot.getAdapter(`imessage`);await markReadBestEffort(a,n,r),await addPhotonAttachmentDownloads(r,a);let o=photonInboundContent(r);if(o===void 0)return;let s=photonQuotedMessage(r);await e.send(o,{idempotencyKey:r.id,auth:i.auth,context:[...i.context??[],...s?[formatReplyContext(s,r.text)]:[]],history:i.history,thread:n,title:i.title})}async function markReadBestEffort(e,t,n){try{await e.markRead(t.id,n.id)}catch{}}export{defaultPhotonAuth,photonIMessageChannel};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { type AuthFn } from "#public/channels/auth.js";
|
|
2
|
+
/**
|
|
3
|
+
* Vercel OIDC from this project in the current environment only. Tokens from
|
|
4
|
+
* the project's other environments, such as a preview deployment, authenticate
|
|
5
|
+
* as `service` and must not reach this deployment's inbound channel routes.
|
|
6
|
+
*/
|
|
7
|
+
export declare function sameEnvironmentVercelOidc(): AuthFn<Request>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{vercelOidc}from"#public/channels/auth.js";function sameEnvironmentVercelOidc(){let e=vercelOidc();return async t=>{let n=await e(t);return n?.principalType===`runtime`?n:null}}export{sameEnvironmentVercelOidc};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{SessionStrandedError}from"#channel/session-stranded-error.js";import{createMetadataAudienceProjector}from"#channel/audience.js";import{CHANNEL_SENTINEL}from"#channel/compiled-channel.js";import{defaultDeliverResult}from"#channel/adapter.js";import{buildCallbackContext}from"#context/build-callback-context.js";import{mergeUploadPolicy}from"#public/channels/upload-policy.js";import{
|
|
1
|
+
import{SessionStrandedError}from"#channel/session-stranded-error.js";import{createMetadataAudienceProjector}from"#channel/audience.js";import{CHANNEL_SENTINEL}from"#channel/compiled-channel.js";import{defaultDeliverResult}from"#channel/adapter.js";import{buildCallbackContext}from"#context/build-callback-context.js";import{mergeUploadPolicy}from"#public/channels/upload-policy.js";import{DELETE,GET,HEAD,OPTIONS,PATCH,POST,PUT,WS}from"#channel/routes.js";import{normalizeChannelCors}from"#channel/cors.js";import{HTTP_ADAPTER_KIND}from"#channel/http.js";const DISABLED_ROUTE_SENTINEL_KIND=`eve:disabled-channel`;function disableRoute(){return{kind:DISABLED_ROUTE_SENTINEL_KIND}}function isDisabledRouteSentinel(e){return typeof e==`object`&&!!e&&e.kind===DISABLED_ROUTE_SENTINEL_KIND}function defineChannel(e){let t=buildAdapter(e),n=normalizeChannelCors(e.cors);return{__kind:CHANNEL_SENTINEL,routes:e.routes,adapter:t,cors:n,receive:e.receive,turnPolicy:e.turnPolicy}}const eventTypes=Object.keys({"approval.candidate":null,"approval.settled":null,"context.cleared":null,"compaction.requested":null,"compaction.completed":null,"turn.started":null,"actions.requested":null,"action.partial":null,"action.result":null,"message.completed":null,"message.appended":null,"reasoning.appended":null,"reasoning.completed":null,"step.started":null,"step.completed":null,"input.requested":null,"input.resolved":null,"task.started":null,"task.settled":null,"turn.waiting":null,"turn.failed":null,"turn.completed":null,"turn.cancelled":null,"session.failed":null,"session.completed":null,"session.waiting":null,"authorization.required":null,"authorization.completed":null});function buildAdapter(e){let t=e.state!=null,n=e.context!=null,r=e.fetchFile!==void 0,i=e.metadata,a=i!==void 0,o=e.audience,s=e.uploadPolicy===void 0?void 0:mergeUploadPolicy(e.uploadPolicy),c=t||n||a||s!==void 0,l={},u=!1,d={kind:e.kindHint??`defineChannel`},f=e.events;for(let e of eventTypes){let t=f?.[e];t&&(u=!0,l[e]=(n,r)=>{let{session:i,...a}=r,o={...a,continuation:i?.continuation===void 0?void 0:{token:i.continuation.token,alias:e=>i.continuation?.alias(e)}};if(e===`session.failed`)return t(n,o);let s=buildCallbackContext();return t(n,o,s)})}return!c&&!u&&!r?{kind:e.kindHint??HTTP_ADAPTER_KIND,...o===void 0?void 0:{instrumentation:{audience:o}}}:{kind:e.kindHint??`defineChannel`,state:t?{...e.state}:{},fetchFile:e.fetchFile,uploadPolicy:s,instrumentation:i===void 0&&o===void 0?void 0:{...i===void 0?void 0:{metadata(e){let{audience:t,...n}=i(e);return n}},...o===void 0?i===void 0?void 0:{audience:createMetadataAudienceProjector(d,i)}:{audience:o}},createAdapterContext(t){let r=t.state,i=t.session;return{...n?e.context(r,i):{},state:r,ctx:t.ctx,session:i}},deliver(t,n){return e.deliver===void 0?defaultDeliverResult(t):e.deliver(t,n)},...l}}export{DELETE,GET,HEAD,OPTIONS,PATCH,POST,PUT,SessionStrandedError,WS,defineChannel,disableRoute,isDisabledRouteSentinel};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { SandboxSelector } from "#shared/sandbox-environment.js";
|
|
2
|
-
export type { SandboxCommandResult, SandboxProcess, SandboxReadBinaryFileOptions, SandboxReadFileOptions, SandboxRemovePathOptions, SandboxReadTextFileOptions, SandboxRunOptions, SandboxSession, RuntimeSandboxSession, RuntimeSandboxSessionFor, SandboxSpawnOptions, SandboxWriteBinaryFileOptions, SandboxWriteFileOptions, SandboxWriteTextFileOptions, } from "#shared/sandbox-session.js";
|
|
2
|
+
export type { SandboxCommandResult, SandboxProcess, SandboxReadBinaryFileOptions, SandboxReadFileOptions, SandboxRemovePathOptions, SandboxReadTextFileOptions, SandboxRunOptions, SandboxSession, RuntimeSandboxSession, RuntimeSandboxSessionFor, SandboxSpawnOptions, SandboxWriteBinaryFileOptions, SandboxWriteFileOptions, SandboxWriteFilesOptions, SandboxWriteTextFileOptions, } from "#shared/sandbox-session.js";
|
|
3
3
|
export type { SandboxOpenArguments, SandboxEnvironment, SandboxSelector, SandboxSelectorContext, } from "#shared/sandbox-environment.js";
|
|
4
4
|
export declare function defineSandbox(definition: SandboxSelector): SandboxSelector;
|
|
5
5
|
export declare function defineParentSandbox(): SandboxSelector;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{resolveSharedEveDevServer,startEveProductionServer}from"#shared/framework-eve-server.js";const NEXT_PHASE_PRODUCTION_BUILD=`phase-production-build`,NEXT_PHASE_PRODUCTION_SERVER=`phase-production-server`,EVE_NEXT_HOST={label:`Next.js`,slug:`next`},globalStateSymbol=Symbol.for(`eve.next.state`);function getGlobalState(){let e=globalThis;return e[globalStateSymbol]??={servers:new Map},e[globalStateSymbol]}function readEveBaseUrlEnvironment(){let e=process.env.EVE_BASE_URL;if(e!==void 0&&e.trim().length!==0)return new URL(e).origin}async function ensureEveProductionServer(e){let t=getGlobalState(),n=`production:${e.appRoot}:${e.origin}`,r=t.servers.get(n);r===void 0&&(r=startEveProductionServer({appRoot:e.appRoot,host:EVE_NEXT_HOST,origin:e.origin}).catch(e=>{throw t.servers.delete(n),e}),t.servers.set(n,r)),await r}async function resolveEveDestinationPrefix(e){if(process.env.NODE_ENV===`production`)return e.productionDestinationPrefix;let t=readEveBaseUrlEnvironment();if(t!==void 0)return t;if(process.env.NODE_ENV!==`development`)return e.productionDestinationPrefix;let n=getGlobalState(),r=`dev:${e.appRoot}`,i=n.servers.get(r);return i===void 0&&(i=resolveSharedEveDevServer({appRoot:e.appRoot,host:EVE_NEXT_HOST,logLabel:e.logLabel,timeoutMs:e.devServerTimeoutMs,workspaceAgentName:e.workspaceAgentName}).catch(e=>{throw n.servers.delete(r),e}),n.servers.set(r,i)),(await i).origin}export{EVE_NEXT_HOST,NEXT_PHASE_PRODUCTION_BUILD,NEXT_PHASE_PRODUCTION_SERVER,ensureEveProductionServer,resolveEveDestinationPrefix};
|
|
1
|
+
import{resolveSharedEveDevServer,startEveProductionServer}from"#shared/framework-eve-server.js";const NEXT_PHASE_PRODUCTION_BUILD=`phase-production-build`,NEXT_PHASE_PRODUCTION_SERVER=`phase-production-server`,EVE_NEXT_HOST={label:`Next.js`,slug:`next`},globalStateSymbol=Symbol.for(`eve.next.state`);function getGlobalState(){let e=globalThis;return e[globalStateSymbol]??={servers:new Map},e[globalStateSymbol]}function readEveBaseUrlEnvironment(){let e=process.env.EVE_BASE_URL;if(e!==void 0&&e.trim().length!==0)return new URL(e).origin}async function ensureEveProductionServer(e){let t=getGlobalState(),n=`production:${e.appRoot}:${e.origin}`,r=t.servers.get(n);r===void 0&&(r=startEveProductionServer({appRoot:e.appRoot,host:EVE_NEXT_HOST,origin:e.origin,portRetryHint:`set EVE_NEXT_PRODUCTION_PORT to another port`}).catch(e=>{throw t.servers.delete(n),e}),t.servers.set(n,r)),await r}async function resolveEveDestinationPrefix(e){if(process.env.NODE_ENV===`production`)return e.productionDestinationPrefix;let t=readEveBaseUrlEnvironment();if(t!==void 0)return t;if(process.env.NODE_ENV!==`development`)return e.productionDestinationPrefix;let n=getGlobalState(),r=`dev:${e.appRoot}`,i=n.servers.get(r);return i===void 0&&(i=resolveSharedEveDevServer({appRoot:e.appRoot,host:EVE_NEXT_HOST,logLabel:e.logLabel,timeoutMs:e.devServerTimeoutMs,workspaceAgentName:e.workspaceAgentName}).catch(e=>{throw n.servers.delete(r),e}),n.servers.set(r,i)),(await i).origin}export{EVE_NEXT_HOST,NEXT_PHASE_PRODUCTION_BUILD,NEXT_PHASE_PRODUCTION_SERVER,ensureEveProductionServer,resolveEveDestinationPrefix};
|
|
@@ -4,6 +4,11 @@ import type { SandboxNetworkOptions, SandboxNetworkPolicy } from "#shared/sandbo
|
|
|
4
4
|
export type DockerSandboxPullPolicy = "if-not-present" | "always" | "never";
|
|
5
5
|
/** Coarse-grained egress policy for one live Docker sandbox. */
|
|
6
6
|
export type DockerSandboxNetworkPolicy = Extract<SandboxNetworkPolicy, "allow-all" | "deny-all">;
|
|
7
|
+
/** Live sandbox capabilities exposed by a Docker environment. */
|
|
8
|
+
export interface DockerSandboxSession extends SandboxSession {
|
|
9
|
+
/** Applies a coarse egress policy to the live container. */
|
|
10
|
+
setNetworkPolicy(policy: DockerSandboxNetworkPolicy): Promise<void>;
|
|
11
|
+
}
|
|
7
12
|
/** Options shared by every sandbox created from one Docker environment. */
|
|
8
13
|
export interface DockerSandboxEnvironmentOptions {
|
|
9
14
|
/** Base container image. Defaults to eve's published sandbox image. */
|
|
@@ -13,7 +18,7 @@ export interface DockerSandboxEnvironmentOptions {
|
|
|
13
18
|
/** Base image pull behavior. @default "if-not-present" */
|
|
14
19
|
readonly pullPolicy?: DockerSandboxPullPolicy;
|
|
15
20
|
/** Idempotent setup captured in the prepared image. */
|
|
16
|
-
readonly prepare?: (sandbox:
|
|
21
|
+
readonly prepare?: (sandbox: DockerSandboxSession) => Promise<void> | void;
|
|
17
22
|
}
|
|
18
23
|
/** Options applied when eve creates one live Docker sandbox. */
|
|
19
24
|
export interface DockerSandboxRuntimeOptions extends SandboxNetworkOptions {
|
|
@@ -1,9 +1,2 @@
|
|
|
1
|
-
import type { SandboxSession } from "#shared/sandbox-session.js";
|
|
2
|
-
import type { DockerSandboxNetworkPolicy } from "#public/sandbox/docker-sandbox.js";
|
|
3
|
-
/** Live sandbox capabilities exposed by a Docker environment. */
|
|
4
|
-
export interface DockerSandboxSession extends SandboxSession {
|
|
5
|
-
/** Applies a coarse egress policy to the live container. */
|
|
6
|
-
setNetworkPolicy(policy: DockerSandboxNetworkPolicy): Promise<void>;
|
|
7
|
-
}
|
|
8
1
|
export { DockerSandbox, type DockerSandboxEnvironmentOptions, type DockerSandboxRuntimeOptions, } from "#sandbox/providers/docker.js";
|
|
9
|
-
export type { DockerSandboxNetworkPolicy, DockerSandboxPullPolicy, } from "#public/sandbox/docker-sandbox.js";
|
|
2
|
+
export type { DockerSandboxNetworkPolicy, DockerSandboxPullPolicy, DockerSandboxSession, } from "#public/sandbox/docker-sandbox.js";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { defineParentSandbox, defineSandbox, type SandboxOpenArguments, type SandboxEnvironment, type SandboxSelector, type SandboxSelectorContext, type SandboxCommandResult, type SandboxProcess, type SandboxReadBinaryFileOptions, type SandboxReadFileOptions, type SandboxReadTextFileOptions, type SandboxRunOptions, type SandboxSession, type RuntimeSandboxSession, type RuntimeSandboxSessionFor, type SandboxSpawnOptions, type SandboxWriteBinaryFileOptions, type SandboxWriteFileOptions, type SandboxWriteTextFileOptions, } from "#public/definitions/sandbox.js";
|
|
1
|
+
export { defineParentSandbox, defineSandbox, type SandboxOpenArguments, type SandboxEnvironment, type SandboxSelector, type SandboxSelectorContext, type SandboxCommandResult, type SandboxProcess, type SandboxReadBinaryFileOptions, type SandboxReadFileOptions, type SandboxReadTextFileOptions, type SandboxRunOptions, type SandboxSession, type RuntimeSandboxSession, type RuntimeSandboxSessionFor, type SandboxSpawnOptions, type SandboxRemovePathOptions, type SandboxWriteBinaryFileOptions, type SandboxWriteFileOptions, type SandboxWriteFilesOptions, type SandboxWriteTextFileOptions, } from "#public/definitions/sandbox.js";
|
|
2
2
|
export { DefaultSandbox } from "#sandbox/providers/default.js";
|
|
3
|
-
export type { DefaultSandboxEnvironmentOptions } from "#sandbox/providers/default.js";
|
|
4
|
-
export type { SandboxNetworkOptions, SandboxNetworkPolicy, } from "#shared/sandbox-network-policy.js";
|
|
3
|
+
export type { DefaultSandboxEnvironmentOptions, DefaultSandboxRuntimeOptions, DefaultSandboxSession, } from "#sandbox/providers/default.js";
|
|
4
|
+
export type { SandboxNetworkMatch, SandboxNetworkMatcher, SandboxNetworkOptions, SandboxNetworkPolicy, SandboxNetworkRule, } from "#shared/sandbox-network-policy.js";
|
|
@@ -1,5 +1,86 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
/**
|
|
2
|
+
* The filesystem a just-bash interpreter runs on. just-bash's own filesystems,
|
|
3
|
+
* such as `ReadWriteFs`, `OverlayFs`, and `MountableFs`, satisfy it.
|
|
4
|
+
*/
|
|
5
|
+
export interface JustBashFilesystem {
|
|
6
|
+
readFile(path: string, options?: {
|
|
7
|
+
encoding?: JustBashEncoding | null;
|
|
8
|
+
} | JustBashEncoding): Promise<string>;
|
|
9
|
+
readFileBuffer(path: string): Promise<Uint8Array>;
|
|
10
|
+
writeFile(path: string, content: string | Uint8Array, options?: {
|
|
11
|
+
encoding?: JustBashEncoding;
|
|
12
|
+
} | JustBashEncoding): Promise<void>;
|
|
13
|
+
appendFile(path: string, content: string | Uint8Array, options?: {
|
|
14
|
+
encoding?: JustBashEncoding;
|
|
15
|
+
} | JustBashEncoding): Promise<void>;
|
|
16
|
+
exists(path: string): Promise<boolean>;
|
|
17
|
+
stat(path: string): Promise<JustBashFileStat>;
|
|
18
|
+
lstat(path: string): Promise<JustBashFileStat>;
|
|
19
|
+
mkdir(path: string, options?: {
|
|
20
|
+
recursive?: boolean;
|
|
21
|
+
}): Promise<void>;
|
|
22
|
+
readdir(path: string): Promise<string[]>;
|
|
23
|
+
readdirWithFileTypes?(path: string): Promise<JustBashDirectoryEntry[]>;
|
|
24
|
+
rm(path: string, options?: {
|
|
25
|
+
force?: boolean;
|
|
26
|
+
recursive?: boolean;
|
|
27
|
+
}): Promise<void>;
|
|
28
|
+
cp(source: string, destination: string, options?: {
|
|
29
|
+
recursive?: boolean;
|
|
30
|
+
}): Promise<void>;
|
|
31
|
+
mv(source: string, destination: string): Promise<void>;
|
|
32
|
+
resolvePath(base: string, path: string): string;
|
|
33
|
+
getAllPaths(): string[];
|
|
34
|
+
chmod(path: string, mode: number): Promise<void>;
|
|
35
|
+
symlink(target: string, linkPath: string): Promise<void>;
|
|
36
|
+
link(existingPath: string, newPath: string): Promise<void>;
|
|
37
|
+
readlink(path: string): Promise<string>;
|
|
38
|
+
realpath(path: string): Promise<string>;
|
|
39
|
+
utimes(path: string, accessTime: Date, modificationTime: Date): Promise<void>;
|
|
40
|
+
}
|
|
41
|
+
type JustBashEncoding = "ascii" | "base64" | "binary" | "hex" | "latin1" | "utf-8" | "utf8";
|
|
42
|
+
export interface JustBashFileStat {
|
|
43
|
+
isDirectory: boolean;
|
|
44
|
+
isFile: boolean;
|
|
45
|
+
isSymbolicLink: boolean;
|
|
46
|
+
mode: number;
|
|
47
|
+
mtime: Date;
|
|
48
|
+
size: number;
|
|
49
|
+
}
|
|
50
|
+
export interface JustBashDirectoryEntry {
|
|
51
|
+
isDirectory: boolean;
|
|
52
|
+
isFile: boolean;
|
|
53
|
+
isSymbolicLink: boolean;
|
|
54
|
+
name: string;
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* A command registered in each live just-bash interpreter. just-bash's
|
|
58
|
+
* `defineCommand()` returns one; use it when a command needs the rest of
|
|
59
|
+
* just-bash's command context, such as standard input or `exec`.
|
|
60
|
+
*/
|
|
61
|
+
export interface JustBashCommand {
|
|
62
|
+
readonly name: string;
|
|
63
|
+
/** Runs the command with direct access to Node.js globals, as `defineCommand()` does. */
|
|
64
|
+
readonly trusted?: boolean;
|
|
65
|
+
execute(args: string[], context: JustBashCommandContext): Promise<JustBashCommandResult>;
|
|
66
|
+
}
|
|
67
|
+
/** A command that just-bash loads on its first run. */
|
|
68
|
+
export interface JustBashLazyCommand {
|
|
69
|
+
readonly name: string;
|
|
70
|
+
load(): Promise<JustBashCommand>;
|
|
71
|
+
}
|
|
72
|
+
export type JustBashCustomCommand = JustBashCommand | JustBashLazyCommand;
|
|
73
|
+
export interface JustBashCommandContext {
|
|
74
|
+
readonly cwd: string;
|
|
75
|
+
readonly env: ReadonlyMap<string, string>;
|
|
76
|
+
readonly fs: JustBashFilesystem;
|
|
77
|
+
readonly signal?: AbortSignal;
|
|
78
|
+
}
|
|
79
|
+
export interface JustBashCommandResult {
|
|
80
|
+
readonly exitCode: number;
|
|
81
|
+
readonly stderr: string;
|
|
82
|
+
readonly stdout: string;
|
|
83
|
+
}
|
|
3
84
|
/**
|
|
4
85
|
* Context passed to a custom just-bash filesystem factory for each live handle.
|
|
5
86
|
*/
|
|
@@ -9,7 +90,7 @@ export interface JustBashFilesystemContext {
|
|
|
9
90
|
/** Stable provider-private storage directory for this sandbox. */
|
|
10
91
|
readonly storagePath: string;
|
|
11
92
|
/** eve's durable, session-owned filesystem, including `/workspace`. */
|
|
12
|
-
readonly defaultFilesystem:
|
|
93
|
+
readonly defaultFilesystem: JustBashFilesystem;
|
|
13
94
|
/** The just-bash engine resolved by eve after its optional installation check. */
|
|
14
95
|
readonly justBash: typeof import("just-bash");
|
|
15
96
|
}
|
|
@@ -39,7 +120,7 @@ export interface JustBashSandboxCreateOptions {
|
|
|
39
120
|
* are responsible for validating their own inputs and cleaning up host
|
|
40
121
|
* resources.
|
|
41
122
|
*/
|
|
42
|
-
readonly customCommands?: ReadonlyArray<
|
|
123
|
+
readonly customCommands?: ReadonlyArray<JustBashCustomCommand>;
|
|
43
124
|
/**
|
|
44
125
|
* Composes the filesystem used by each live sandbox handle. The factory is
|
|
45
126
|
* called when a handle opens with eve's durable default filesystem; return a
|
|
@@ -50,7 +131,6 @@ export interface JustBashSandboxCreateOptions {
|
|
|
50
131
|
* a compatible `just-bash` version. It is not invoked during template
|
|
51
132
|
* preparation.
|
|
52
133
|
*/
|
|
53
|
-
readonly filesystem?: (context: JustBashFilesystemContext) =>
|
|
54
|
-
/** Idempotent setup captured in the prepared virtual filesystem. */
|
|
55
|
-
readonly prepare?: (sandbox: SandboxSession) => Promise<void> | void;
|
|
134
|
+
readonly filesystem?: (context: JustBashFilesystemContext) => JustBashFilesystem | Promise<JustBashFilesystem>;
|
|
56
135
|
}
|
|
136
|
+
export {};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export { JustBashSandbox, type JustBashEnvironmentOptions } from "#sandbox/providers/just-bash.js";
|
|
2
|
-
export type { JustBashFilesystemContext } from "#public/sandbox/just-bash-sandbox.js";
|
|
2
|
+
export type { JustBashCommand, JustBashCommandContext, JustBashCommandResult, JustBashCustomCommand, JustBashDirectoryEntry, JustBashFileStat, JustBashFilesystem, JustBashFilesystemContext, JustBashLazyCommand, } from "#public/sandbox/just-bash-sandbox.js";
|
|
@@ -1 +1,5 @@
|
|
|
1
|
-
export { defineSandboxProvider, type
|
|
1
|
+
export { defineSandboxProvider, type SandboxConnection, type SandboxIdentity, type SandboxJson, type SandboxPrepareContext, type SandboxPrepareOption, type SandboxProvider, type SandboxProviderDefinition, type SandboxProviderImplementation, type SandboxSessionContext, type SandboxSessionEndOptions, type WithPrepareOption, } from "#sandbox/provider.js";
|
|
2
|
+
export type { SandboxDeleteOptions, SandboxProviderFiles } from "#shared/sandbox-provider.js";
|
|
3
|
+
export { SANDBOX_AGENT_ENV } from "#execution/sandbox/session.js";
|
|
4
|
+
export { SandboxSessionGoneError } from "#shared/sandbox-session-gone-error.js";
|
|
5
|
+
export { SandboxTemplateNotProvisionedError } from "#shared/sandbox-template-error.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{SANDBOX_AGENT_ENV}from"#execution/sandbox/session.js";import{SandboxSessionGoneError}from"#shared/sandbox-session-gone-error.js";import{SandboxTemplateNotProvisionedError}from"#shared/sandbox-template-error.js";import{defineSandboxProvider}from"#sandbox/provider.js";export{SANDBOX_AGENT_ENV,SandboxSessionGoneError,SandboxTemplateNotProvisionedError,defineSandboxProvider};
|
|
@@ -42,15 +42,22 @@ type VercelSandboxAuthorCreateOptions<T> = T extends unknown ? Omit<T, "mounts"
|
|
|
42
42
|
*/
|
|
43
43
|
export type VercelSandboxCreateOptions = VercelSandboxAuthorCreateOptions<VercelCreateOptions>;
|
|
44
44
|
/** Access mode for a Drive mounted into a Vercel Sandbox. */
|
|
45
|
-
export type VercelSandboxMountMode =
|
|
46
|
-
/**
|
|
47
|
-
|
|
45
|
+
export type VercelSandboxMountMode = "read-write" | "snapshot";
|
|
46
|
+
/**
|
|
47
|
+
* A Drive mounted at one absolute path in a Vercel Sandbox: a `Drive` from
|
|
48
|
+
* `@vercel/sandbox`, mounted read-write, or a `{ drive, mode }` reference to
|
|
49
|
+
* a Drive by name, such as the one `drive.snapshot()` returns.
|
|
50
|
+
*/
|
|
51
|
+
export type VercelSandboxMount = {
|
|
52
|
+
readonly name: string;
|
|
53
|
+
} | {
|
|
54
|
+
readonly drive: string;
|
|
55
|
+
readonly mode: VercelSandboxMountMode;
|
|
56
|
+
};
|
|
48
57
|
/** Drive mounts keyed by absolute sandbox path. */
|
|
49
|
-
export type VercelSandboxMounts =
|
|
50
|
-
/** Options resolved when eve creates a fresh live session sandbox. */
|
|
51
|
-
export interface VercelSandboxMountOptions {
|
|
52
|
-
readonly mounts?: VercelSandboxMounts;
|
|
53
|
-
}
|
|
58
|
+
export type VercelSandboxMounts = Readonly<Record<string, VercelSandboxMount>>;
|
|
54
59
|
/** Options accepted when creating one live Vercel sandbox from an environment. */
|
|
55
|
-
export type VercelSandboxRuntimeOptions = Omit<VercelSandboxCreateOptions, "fetch" | "image" | "projectId" | "source" | "tags" | "teamId" | "token"> & SandboxNetworkOptions &
|
|
60
|
+
export type VercelSandboxRuntimeOptions = Omit<VercelSandboxCreateOptions, "fetch" | "image" | "projectId" | "source" | "tags" | "teamId" | "token"> & SandboxNetworkOptions & {
|
|
61
|
+
readonly mounts?: VercelSandboxMounts;
|
|
62
|
+
};
|
|
56
63
|
export {};
|
|
@@ -8,5 +8,4 @@ export interface VercelSandboxSession extends SandboxSession {
|
|
|
8
8
|
setNetworkPolicy(policy: SandboxNetworkPolicy): Promise<void>;
|
|
9
9
|
}
|
|
10
10
|
export { VercelSandbox, type VercelSandboxEnvironmentOptions, type VercelSandboxRuntimeOptions, } from "#sandbox/providers/vercel.js";
|
|
11
|
-
export { Drive } from "#compiled/@vercel/sandbox/index.js";
|
|
12
11
|
export type { VercelSandboxMount, VercelSandboxMountMode, VercelSandboxMounts, } from "#public/sandbox/vercel-sandbox.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{VercelSandbox}from"#sandbox/providers/vercel.js";
|
|
1
|
+
import{VercelSandbox}from"#sandbox/providers/vercel.js";export{VercelSandbox};
|
|
@@ -1 +1,8 @@
|
|
|
1
|
-
|
|
1
|
+
import { type AgentWithModelToolInput } from "#runtime/subagents/workflow.js";
|
|
2
|
+
import { agent } from "#tools/framework/agent.js";
|
|
3
|
+
import { type WorkflowServeToolDefinition } from "#tools/workflow-definition.js";
|
|
4
|
+
export { agent, agent as default };
|
|
5
|
+
export type { AgentWithModelToolInput };
|
|
6
|
+
export type AgentWithModelTool = WorkflowServeToolDefinition<AgentWithModelToolInput, unknown>;
|
|
7
|
+
/** Root-copy agent tool whose model-facing input selects the model for each new task. */
|
|
8
|
+
export declare const agentWithModel: AgentWithModelTool;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{agent
|
|
1
|
+
import{defineJsonSchema}from"#tools/schema.js";import{frameworkTool}from"#tools/provided/framework-tool.js";import{defineWorkflowTool}from"#tools/workflow-definition.js";import{agentWithModelServeWorkflow}from"#runtime/subagents/workflow.js";import{agent}from"#tools/framework/agent.js";const inputSchema=defineJsonSchema({type:`object`,properties:{message:{type:`string`,description:`The message to send to the agent, with everything it needs to do the work.`},model:{type:`string`,minLength:1,description:`AI Gateway model id for a new child session. When continuing a task, use its original model.`}},required:[`message`,`model`],additionalProperties:!1}),agentWithModel=frameworkTool(defineWorkflowTool({availableInSubagents:!1,description:[`Delegate a focused subtask to a copy of yourself using the selected AI Gateway model.`,`Each call starts a task, so start independent tasks before waiting for them.`,`A continuation keeps its task's original model.`,`In message, state the goal, what to return, and whether it may change files.`].join(` `),inputSchema,serve:agentWithModelServeWorkflow}));export{agent,agent as default,agentWithModel};
|
|
@@ -91,7 +91,7 @@ export interface UseEveAgentOptions<TData> extends EveAgentStoreCallbacks<TData>
|
|
|
91
91
|
*/
|
|
92
92
|
readonly followIdle?: boolean;
|
|
93
93
|
/**
|
|
94
|
-
*
|
|
94
|
+
* Create a session or prepare its existing idle owner when true. React observes this value across renders;
|
|
95
95
|
* changing it from false to true prepares the current session, and reset checks
|
|
96
96
|
* the latest rendered value before preparing the next session.
|
|
97
97
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{localGatewayModel}from"#internal/model-auth/transport.js";import{RuntimeModelMetadataCacheKey}from"#context/keys.js";import{parseJsonObject}from"#shared/json.js";import{isDynamicModelDefinition}from"#shared/agent-definition.js";import{normalizeAgentDefinition,normalizeAgentPromptCache}from"#internal/authored-definition/core.js";import{formatLanguageModelGatewayId,isAgentReasoningDefinition,isRuntimeLanguageModel}from"#internal/runtime-model.js";import{loadResolvedModuleExport}from"#runtime/resolve-helpers.js";import{resolveBootstrapRuntimeModel}from"#runtime/agent/bootstrap-model.js";import{resolveMockAuthoredRuntimeModel,shouldMockAuthoredRuntimeModels}from"#runtime/agent/mock-model-adapter.js";import{createRuntimeModelCatalog}from"#runtime/agent/model-catalog.js";var InvalidRuntimeModelSelectionError=class extends Error{constructor(e,t){super(e,t),this.name=`InvalidRuntimeModelSelectionError`}};async function resolveRuntimeModelReference(e,t){let n=resolveBootstrapRuntimeModel(e);if(n!==null)return n;let r=resolveMockAuthoredRuntimeModel(e);return r===null?isSourceBackedRuntimeModelReference(e)?await loadSourceBackedRuntimeModelReference(e,t):localGatewayModel(e.id)??e.id:r}async function loadSourceBackedRuntimeModelReference(e,t){if(t===void 0)throw Error(`Expected a compiled module-map scope to resolve the authored runtime model "${e.id}".`);let n=await loadResolvedModuleExport({definition:e.source,kindLabel:`runtime model "${e.id}"`,moduleMap:t.moduleMap,nodeId:t.nodeId}),r=normalizeAgentDefinition(n,`Expected the authored agent config export "${e.source.exportName??`default`}" from "${e.source.logicalPath}" to match the public eve shape.`).model;if(
|
|
1
|
+
import{localGatewayModel}from"#internal/model-auth/transport.js";import{RuntimeModelMetadataCacheKey}from"#context/keys.js";import{parseJsonObject}from"#shared/json.js";import{isDynamicModelDefinition}from"#shared/agent-definition.js";import{normalizeAgentDefinition,normalizeAgentPromptCache}from"#internal/authored-definition/core.js";import{formatLanguageModelGatewayId,isAgentReasoningDefinition,isRuntimeLanguageModel}from"#internal/runtime-model.js";import{loadResolvedModuleExport}from"#runtime/resolve-helpers.js";import{resolveBootstrapRuntimeModel}from"#runtime/agent/bootstrap-model.js";import{resolveMockAuthoredRuntimeModel,shouldMockAuthoredRuntimeModels}from"#runtime/agent/mock-model-adapter.js";import{createRuntimeModelCatalog}from"#runtime/agent/model-catalog.js";var InvalidRuntimeModelSelectionError=class extends Error{constructor(e,t){super(e,t),this.name=`InvalidRuntimeModelSelectionError`}};async function resolveRuntimeModelReference(e,t){let n=resolveBootstrapRuntimeModel(e);if(n!==null)return n;let r=resolveMockAuthoredRuntimeModel(e);return r===null?isSourceBackedRuntimeModelReference(e)?await loadSourceBackedRuntimeModelReference(e,t):localGatewayModel(e.id)??e.id:r}async function loadSourceBackedRuntimeModelReference(e,t){if(t===void 0)throw Error(`Expected a compiled module-map scope to resolve the authored runtime model "${e.id}".`);let n=await loadResolvedModuleExport({definition:e.source,kindLabel:`runtime model "${e.id}"`,moduleMap:t.moduleMap,nodeId:t.nodeId}),r=normalizeAgentDefinition(n,`Expected the authored agent config export "${e.source.exportName??`default`}" from "${e.source.logicalPath}" to match the public eve shape.`),i=e.sourceField===`compaction.model`?r.compaction?.model:r.model;if(i===void 0)throw Error(`Expected the authored agent config export "${e.source.exportName??`default`}" from "${e.source.logicalPath}" to provide a runtime model at "${e.sourceField??`model`}".`);if(isDynamicModelDefinition(i))throw Error(`Expected the authored agent config export "${e.source.exportName??`default`}" from "${e.source.logicalPath}" to provide a static runtime model.`);return i}function isSourceBackedRuntimeModelReference(e){return e.source!==void 0}async function loadDynamicRuntimeModelDefinition(e){let t=await loadResolvedModuleExport({definition:e.dynamicModel,kindLabel:`dynamic runtime model`,moduleMap:e.scope.moduleMap,nodeId:e.scope.nodeId}),n=normalizeAgentDefinition(t,`Expected the authored agent config export "${e.dynamicModel.exportName??`default`}" from "${e.dynamicModel.logicalPath}" to match the public eve shape.`).model;if(!isDynamicModelDefinition(n))throw Error(`Expected the authored agent config export "${e.dynamicModel.exportName??`default`}" from "${e.dynamicModel.logicalPath}" to provide a dynamic model definition.`);return n}async function resolveRuntimeModelSelection(e){if(e.selection===null||e.selection===void 0)throw new InvalidRuntimeModelSelectionError(`Dynamic model resolver returned no model. Every matching dynamic model handler must return a concrete model selection.`);let t,n,r;try{t=normalizeDynamicModelSelection(e.selection),validateDynamicModelSelection(t),n=t.modelOptions?.providerOptions===void 0?void 0:parseProviderOptionsRecord(t.modelOptions.providerOptions),r=t.modelOptions?.promptCache===void 0?void 0:normalizeAgentPromptCache(t.modelOptions.promptCache,`Dynamic model resolver returned an invalid selection.`)}catch(e){throw invalidSelectionError(e)}let i=t.model,a=e.catalog??runtimeModelCatalogForState(e.state);if(typeof i==`string`){let o=formatLanguageModelGatewayId(i);if(r!==void 0)throw gatewayPromptCacheError(o);let s=await resolveSelectionMetadata({cacheKey:`gateway:${o}`,catalog:a,contextWindowTokens:t.modelContextWindowTokens,load:e=>e.getByGatewayId(o),modelLabel:o,state:e.state});return{reference:{id:s.resolvedModelId,contextWindowTokens:s.contextWindowTokens,maxOutputTokens:s.maxOutputTokens,providerOptions:n,reasoning:t.reasoning}}}if(validateRuntimeLanguageModel(i),e.durability===`durable`)throw new InvalidRuntimeModelSelectionError(`Dynamic model selection returned a provider object, but durable model selections must be serializable. Return a model id string, or use a "step.started" model resolver.`);let o=formatLanguageModelGatewayId(i),s=i.provider.split(`.`)[0];if(r!==void 0&&s===`gateway`)throw gatewayPromptCacheError(o);let c=await resolveSelectionMetadata({cacheKey:s===`gateway`?`gateway:${i.modelId}`:`provider:${i.provider}:${i.modelId}`,catalog:a,contextWindowTokens:t.modelContextWindowTokens,load:e=>s===`gateway`?e.getByGatewayId(i.modelId):e.getByProviderModelId(i.provider,i.modelId),modelLabel:o,state:e.state});return{model:i,reference:{id:c.resolvedModelId,contextWindowTokens:c.contextWindowTokens,maxOutputTokens:c.maxOutputTokens,promptCache:r,providerOptions:n,reasoning:t.reasoning}}}function invalidSelectionError(e){return e instanceof InvalidRuntimeModelSelectionError?e:new InvalidRuntimeModelSelectionError(e instanceof Error?e.message:String(e),{cause:e})}function gatewayPromptCacheError(e){return new InvalidRuntimeModelSelectionError(`Dynamic model resolver returned modelOptions.promptCache for "${e}", which routes through AI Gateway. promptCache applies only to models eve calls directly; Gateway manages its own prompt caching through providerOptions.gateway.caching.`)}const runtimeModelCatalogsByState=new WeakMap;function runtimeModelCatalogForState(e){let t=runtimeModelCatalogsByState.get(e);if(t!==void 0)return t;let n=createRuntimeModelCatalog();return runtimeModelCatalogsByState.set(e,n),n}async function resolveSelectionMetadata(e){if(e.contextWindowTokens!==void 0)return{contextWindowTokens:e.contextWindowTokens,resolvedModelId:e.modelLabel};let t=Date.now(),n=e.state.get(RuntimeModelMetadataCacheKey)?.[e.cacheKey];if(n!==void 0&&n.expiresAt>t)return n;let r=await e.load(e.catalog);if(r===null)throw new InvalidRuntimeModelSelectionError(`Cannot select model "${e.modelLabel}" because AI Gateway did not provide context window metadata. Return modelContextWindowTokens with this selection for an unlisted or custom model.`);let i={...r,expiresAt:t+864e5};return e.state.set(RuntimeModelMetadataCacheKey,n=>({...Object.fromEntries(Object.entries(n??{}).filter(([,e])=>e.expiresAt>t)),[e.cacheKey]:i})),i}const DYNAMIC_MODEL_SELECTION_KEYS=new Set([`model`,`modelContextWindowTokens`,`modelOptions`,`reasoning`]);function validateDynamicModelSelection(e){let t=Object.keys(e).filter(e=>!DYNAMIC_MODEL_SELECTION_KEYS.has(e));if(t.length>0)throw Error(`Dynamic model resolver returned a selection with unknown key(s): ${t.join(`, `)}. Expected { model, reasoning?, modelContextWindowTokens?, modelOptions? }.`);if(e.reasoning!==void 0&&!isAgentReasoningDefinition(e.reasoning))throw Error(`Dynamic model resolver returned an invalid reasoning effort. Expected provider-default, none, minimal, low, medium, high, or xhigh.`);let n=e.modelContextWindowTokens;if(n!==void 0&&(!Number.isInteger(n)||n<=0))throw Error(`Dynamic model resolver returned an invalid modelContextWindowTokens value. Expected a positive integer.`);if(typeof e.model==`string`&&e.model.trim()===``)throw Error(`Dynamic model resolver returned an empty model id.`)}function normalizeDynamicModelSelection(e){return isModelSelectionDefinition(e)?e:{model:e}}function isModelSelectionDefinition(e){return typeof e==`object`&&!!e&&`model`in e&&!isRuntimeLanguageModel(e)}function validateRuntimeLanguageModel(e){if(!isRuntimeLanguageModel(e))throw new InvalidRuntimeModelSelectionError(`Dynamic model resolver returned an invalid model. Return an AI Gateway model id string, an AI SDK language model, or { model, modelContextWindowTokens?, modelOptions? }.`)}function parseProviderOptionsRecord(e){if(e===void 0)return;let t={};for(let[n,r]of Object.entries(e))t[n]=parseJsonObject(r);return t}export{InvalidRuntimeModelSelectionError,loadDynamicRuntimeModelDefinition,resolveRuntimeModelReference,resolveRuntimeModelSelection,shouldMockAuthoredRuntimeModels};
|
|
@@ -15,6 +15,8 @@ interface OpenApiToolResult {
|
|
|
15
15
|
readonly status: number;
|
|
16
16
|
readonly statusText: string;
|
|
17
17
|
readonly body: unknown;
|
|
18
|
+
/** Target of a redirect to another origin, which eve returns instead of following. */
|
|
19
|
+
location?: string;
|
|
18
20
|
}
|
|
19
21
|
/**
|
|
20
22
|
* A {@link ConnectionClient} that turns an OpenAPI 3.x or Swagger 2.0
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{createLogger}from"#internal/logging.js";import{isObject}from"#shared/guards.js";import{isLoopbackHostname}from"#shared/network-address.js";import{parseJsonObject}from"#shared/json.js";import{resolveHeaders}from"#runtime/connections/mcp-client.js";import{omitProvidedArgumentsFromSchema,resolveProvidedArguments}from"#runtime/connections/provided-arguments.js";import{HTTP_METHODS,operationDescription,operationName,uniqueName}from"#runtime/connections/openapi-operations.js";import{buildInputSchema,deref,derefSchema,isArray}from"#runtime/connections/openapi-schema.js";import{applySecurity,resolveSecurity}from"#runtime/connections/openapi-security.js";import{extractServerUrl,parseSpecDocument}from"#runtime/connections/openapi-spec.js";const log=createLogger(`runtime.connections.openapi-client`),SWAGGER_PARAMETER_SCHEMA_KEYS=[`default`,`enum`,`exclusiveMaximum`,`exclusiveMinimum`,`format`,`items`,`maximum`,`maxItems`,`maxLength`,`minimum`,`minItems`,`minLength`,`multipleOf`,`pattern`,`type`,`uniqueItems`];var OpenApiConnectionClient=class{#e;#t;#n;constructor(e){this.#n=e}async connect(){return this.#r()}async getToolMetadata(){return(await this.#r()).metadata}async executeTool(e,t,n){let r=await this.#r(),i=r.operations.get(e);if(i===void 0)throw Error(`Tool "${e}" not found in connection "${this.#n.connectionName}".`);return this.#f(i,r.baseUrl,isObject(t)?t:{},{abortSignal:n.abortSignal,callId:n.callId})}async close(){this.#e=void 0,this.#t=void 0}async#r(){if(this.#t!==void 0)return this.#t;if(this.#e!==void 0)return this.#e;this.#e=this.#i();try{return this.#t=await this.#e,this.#t}catch(e){throw this.#e=void 0,e}}async#i(){let e=await this.#o(),t=this.#a(e),n=this.#s(e),r=[],i=new Map,a=Object.keys(this.#n.toolCall?.providedArguments??{});for(let e of n){let t;try{t=parseJsonObject(omitProvidedArgumentsFromSchema(e.inputSchema,a))}catch(t){log.warn(`omitting OpenAPI operation with an invalid input schema`,{connectionName:this.#n.connectionName,error:t,toolName:e.toolName});continue}i.set(e.toolName,e),r.push({description:e.description,inputSchema:t,name:e.toolName})}return{metadata:r,operations:i,baseUrl:t}}#a(e){let t=this.#n.url,n=typeof t==`string`&&t.trim().length>0?t:extractServerUrl(e,this.#n.spec);if(n===void 0)throw Error(`OpenAPI connection "${this.#n.connectionName}" has no base URL: set "baseUrl" or ensure the document declares an absolute "servers" entry or Swagger "host".`);return assertSecureUrl(n,this.#n.connectionName,`base`),n}async#o(){let e=this.#n.spec;if(e===void 0)throw Error(`OpenAPI connection "${this.#n.connectionName}" is missing its "spec" source.`);if(typeof e!=`string`)return e;assertSecureUrl(e,this.#n.connectionName,`spec`);let t;try{t=await fetch(e,{headers:{accept:`application/json, application/yaml, text/yaml, */*`}})}catch(t){throw Error(`OpenAPI connection "${this.#n.connectionName}" failed to fetch its spec from "${e}": ${String(t)}`)}if(t.redirected&&assertSecureUrl(t.url,this.#n.connectionName,`spec`),!t.ok)throw Error(`OpenAPI connection "${this.#n.connectionName}" failed to fetch its spec from "${e}": HTTP ${t.status}.`);let n=await t.text(),r;try{r=parseSpecDocument(n)}catch(t){throw Error(`OpenAPI connection "${this.#n.connectionName}" spec at "${e}" could not be parsed as JSON or YAML: ${String(t)}`)}if(!isObject(r))throw Error(`OpenAPI connection "${this.#n.connectionName}" spec at "${e}" is not an OpenAPI document object.`);return r}#s(e){let t=e.paths;if(!isObject(t))return[];let n=[],r=new Set;for(let[i,a]of Object.entries(t)){if(!isObject(a))continue;let t=isArray(a.parameters)?a.parameters:[];for(let o of HTTP_METHODS){let s=a[o];if(!isObject(s))continue;let c=uniqueName(operationName(s,o,i),r),l=isArray(s.parameters)?s.parameters:[],u=[...t,...l],d=this.#c(e,u),f=this.#l(e,s.requestBody,u);n.push({toolName:c,method:o,pathTemplate:i,description:operationDescription(s),parameters:d,requestBody:f,inputSchema:buildInputSchema(d,f),security:resolveSecurity(e,s)})}}return n}#c(e,t){let n=[];for(let r of t){let t=isObject(r)?deref(e,r):r;if(!isObject(t))continue;let i=t.in;if(i!==`path`&&i!==`query`&&i!==`header`&&i!==`cookie`||typeof t.name!=`string`)continue;let a=this.#u(e,t);n.push({name:t.name,location:i,required:t.required===!0||i===`path`,schema:a,description:typeof t.description==`string`?t.description:void 0})}return n}#l(e,t,n=[]){if(isObject(t)){let n=deref(e,t);if(isObject(n)&&isObject(n.content)){let t=n.content,r=`application/json`in t?`application/json`:Object.keys(t)[0];if(r!==void 0){let i=t[r],a=isObject(i)&&isObject(i.schema)?derefSchema(e,i.schema):{};return{required:n.required===!0,contentType:r,schema:a}}}}return this.#d(e,n)}#u(e,t){if(isObject(t.schema))return derefSchema(e,t.schema);let n={};for(let e of SWAGGER_PARAMETER_SCHEMA_KEYS)t[e]!==void 0&&(n[e]=t[e]);return derefSchema(e,n)}#d(e,t){for(let n of t){let t=isObject(n)?deref(e,n):n;if(!isObject(t)||t.in!==`body`)continue;let r=isObject(t.schema)?derefSchema(e,t.schema):{};return{required:t.required===!0,contentType:`application/json`,schema:r}}}async#f(e,t,n,r){let i=await resolveProvidedArguments({args:n,callId:r.callId,connection:this.#n,toolName:e.toolName}),a=await resolveHeaders(this.#n),o=e.pathTemplate,s=new URLSearchParams,c=[];for(let t of e.parameters){let n=i[t.name];if(n!=null){if(t.location===`path`){let r=String(n);if(r===`.`||r===`..`)throw Error(`Path parameter "${t.name}" for tool "${e.toolName}" in connection "${this.#n.connectionName}" must not be "." or "..".`);o=o.replace(`{${t.name}}`,encodeURIComponent(r))}else t.location===`query`?appendQuery(s,t.name,n):t.location===`cookie`?c.push(`${t.name}=${encodeURIComponent(String(n))}`):a[t.name]=String(n)}}if(applySecurity(e.security,this.#n,a,s,c),c.length>0){let e=a.cookie??a.Cookie;delete a.Cookie,a.cookie=[e,...c].filter(e=>!!e).join(`; `)}let l=new URL(joinPath(t,o));l.search=s.toString();let u;e.requestBody!==void 0&&i.body!==void 0&&(u=JSON.stringify(i.body),a[`content-type`]=e.requestBody.contentType);let
|
|
1
|
+
import{createLogger}from"#internal/logging.js";import{isObject}from"#shared/guards.js";import{isLoopbackHostname}from"#shared/network-address.js";import{parseJsonObject}from"#shared/json.js";import{resolveHeaders}from"#runtime/connections/mcp-client.js";import{omitProvidedArgumentsFromSchema,resolveProvidedArguments}from"#runtime/connections/provided-arguments.js";import{HTTP_METHODS,operationDescription,operationName,uniqueName}from"#runtime/connections/openapi-operations.js";import{buildInputSchema,deref,derefSchema,isArray}from"#runtime/connections/openapi-schema.js";import{applySecurity,resolveSecurity}from"#runtime/connections/openapi-security.js";import{extractServerUrl,parseSpecDocument}from"#runtime/connections/openapi-spec.js";const log=createLogger(`runtime.connections.openapi-client`),SWAGGER_PARAMETER_SCHEMA_KEYS=[`default`,`enum`,`exclusiveMaximum`,`exclusiveMinimum`,`format`,`items`,`maximum`,`maxItems`,`maxLength`,`minimum`,`minItems`,`minLength`,`multipleOf`,`pattern`,`type`,`uniqueItems`];var OpenApiConnectionClient=class{#e;#t;#n;constructor(e){this.#n=e}async connect(){return this.#r()}async getToolMetadata(){return(await this.#r()).metadata}async executeTool(e,t,n){let r=await this.#r(),i=r.operations.get(e);if(i===void 0)throw Error(`Tool "${e}" not found in connection "${this.#n.connectionName}".`);return this.#f(i,r.baseUrl,isObject(t)?t:{},{abortSignal:n.abortSignal,callId:n.callId})}async close(){this.#e=void 0,this.#t=void 0}async#r(){if(this.#t!==void 0)return this.#t;if(this.#e!==void 0)return this.#e;this.#e=this.#i();try{return this.#t=await this.#e,this.#t}catch(e){throw this.#e=void 0,e}}async#i(){let e=await this.#o(),t=this.#a(e),n=this.#s(e),r=[],i=new Map,a=Object.keys(this.#n.toolCall?.providedArguments??{});for(let e of n){let t;try{t=parseJsonObject(omitProvidedArgumentsFromSchema(e.inputSchema,a))}catch(t){log.warn(`omitting OpenAPI operation with an invalid input schema`,{connectionName:this.#n.connectionName,error:t,toolName:e.toolName});continue}i.set(e.toolName,e),r.push({description:e.description,inputSchema:t,name:e.toolName})}return{metadata:r,operations:i,baseUrl:t}}#a(e){let t=this.#n.url,n=typeof t==`string`&&t.trim().length>0?t:extractServerUrl(e,this.#n.spec);if(n===void 0)throw Error(`OpenAPI connection "${this.#n.connectionName}" has no base URL: set "baseUrl" or ensure the document declares an absolute "servers" entry or Swagger "host".`);return assertSecureUrl(n,this.#n.connectionName,`base`),n}async#o(){let e=this.#n.spec;if(e===void 0)throw Error(`OpenAPI connection "${this.#n.connectionName}" is missing its "spec" source.`);if(typeof e!=`string`)return e;assertSecureUrl(e,this.#n.connectionName,`spec`);let t;try{t=await fetch(e,{headers:{accept:`application/json, application/yaml, text/yaml, */*`}})}catch(t){throw Error(`OpenAPI connection "${this.#n.connectionName}" failed to fetch its spec from "${e}": ${String(t)}`)}if(t.redirected&&assertSecureUrl(t.url,this.#n.connectionName,`spec`),!t.ok)throw Error(`OpenAPI connection "${this.#n.connectionName}" failed to fetch its spec from "${e}": HTTP ${t.status}.`);let n=await t.text(),r;try{r=parseSpecDocument(n)}catch(t){throw Error(`OpenAPI connection "${this.#n.connectionName}" spec at "${e}" could not be parsed as JSON or YAML: ${String(t)}`)}if(!isObject(r))throw Error(`OpenAPI connection "${this.#n.connectionName}" spec at "${e}" is not an OpenAPI document object.`);return r}#s(e){let t=e.paths;if(!isObject(t))return[];let n=[],r=new Set;for(let[i,a]of Object.entries(t)){if(!isObject(a))continue;let t=isArray(a.parameters)?a.parameters:[];for(let o of HTTP_METHODS){let s=a[o];if(!isObject(s))continue;let c=uniqueName(operationName(s,o,i),r),l=isArray(s.parameters)?s.parameters:[],u=[...t,...l],d=this.#c(e,u),f=this.#l(e,s.requestBody,u);n.push({toolName:c,method:o,pathTemplate:i,description:operationDescription(s),parameters:d,requestBody:f,inputSchema:buildInputSchema(d,f),security:resolveSecurity(e,s)})}}return n}#c(e,t){let n=[];for(let r of t){let t=isObject(r)?deref(e,r):r;if(!isObject(t))continue;let i=t.in;if(i!==`path`&&i!==`query`&&i!==`header`&&i!==`cookie`||typeof t.name!=`string`)continue;let a=this.#u(e,t);n.push({name:t.name,location:i,required:t.required===!0||i===`path`,schema:a,description:typeof t.description==`string`?t.description:void 0})}return n}#l(e,t,n=[]){if(isObject(t)){let n=deref(e,t);if(isObject(n)&&isObject(n.content)){let t=n.content,r=`application/json`in t?`application/json`:Object.keys(t)[0];if(r!==void 0){let i=t[r],a=isObject(i)&&isObject(i.schema)?derefSchema(e,i.schema):{};return{required:n.required===!0,contentType:r,schema:a}}}}return this.#d(e,n)}#u(e,t){if(isObject(t.schema))return derefSchema(e,t.schema);let n={};for(let e of SWAGGER_PARAMETER_SCHEMA_KEYS)t[e]!==void 0&&(n[e]=t[e]);return derefSchema(e,n)}#d(e,t){for(let n of t){let t=isObject(n)?deref(e,n):n;if(!isObject(t)||t.in!==`body`)continue;let r=isObject(t.schema)?derefSchema(e,t.schema):{};return{required:t.required===!0,contentType:`application/json`,schema:r}}}async#f(e,t,n,r){let i=await resolveProvidedArguments({args:n,callId:r.callId,connection:this.#n,toolName:e.toolName}),a=await resolveHeaders(this.#n),o=e.pathTemplate,s=new URLSearchParams,c=[];for(let t of e.parameters){let n=i[t.name];if(n!=null){if(t.location===`path`){let r=String(n);if(r===`.`||r===`..`)throw Error(`Path parameter "${t.name}" for tool "${e.toolName}" in connection "${this.#n.connectionName}" must not be "." or "..".`);o=o.replace(`{${t.name}}`,encodeURIComponent(r))}else t.location===`query`?appendQuery(s,t.name,n):t.location===`cookie`?c.push(`${t.name}=${encodeURIComponent(String(n))}`):a[t.name]=String(n)}}if(applySecurity(e.security,this.#n,a,s,c),c.length>0){let e=a.cookie??a.Cookie;delete a.Cookie,a.cookie=[e,...c].filter(e=>!!e).join(`; `)}let l=new URL(joinPath(t,o));l.search=s.toString();let u;e.requestBody!==void 0&&i.body!==void 0&&(u=JSON.stringify(i.body),a[`content-type`]=e.requestBody.contentType);let{response:d,location:f}=await fetchWithinOrigin(l,{method:e.method.toUpperCase(),headers:a,body:u,signal:r?.abortSignal},this.#n.connectionName),p={status:d.status,statusText:d.statusText,body:await readResponseBody(d)};return f!==void 0&&(p.location=f),p}};const REDIRECT_STATUSES=new Set([301,302,303,307,308]);async function fetchWithinOrigin(e,t,n){let r=e,i=t;for(let t=0;;t++){let a=await fetch(r,{...i,redirect:`manual`}),o=a.headers.get(`location`);if(!REDIRECT_STATUSES.has(a.status)||o===null)return{response:a};let s=URL.parse(o,r.href);if(s===null)return{response:a};if(s.origin!==e.origin)return{response:a,location:s.href};if(await a.body?.cancel(),t>=10)throw Error(`OpenAPI connection "${n}" stopped after 10 redirects from "${e.origin}${e.pathname}", last to "${s.pathname}". The API may be redirecting in a loop.`);r=s,i=redirectedRequest(i,a.status)}}function redirectedRequest(e,t){if(!(t===303&&e.method!==`GET`&&e.method!==`HEAD`||(t===301||t===302)&&e.method===`POST`))return e;let n=Object.fromEntries(Object.entries(e.headers).filter(([e])=>e.toLowerCase()!==`content-type`));return{...e,method:`GET`,headers:n,body:void 0}}function appendQuery(e,t,n){if(isArray(n)){for(let r of n)e.append(t,String(r));return}e.append(t,String(n))}function joinPath(e,t){return`${e.endsWith(`/`)?e.slice(0,-1):e}${t.startsWith(`/`)?t:`/${t}`}`}function assertSecureUrl(e,t,n){let r;try{r=new URL(e)}catch{throw Error(`OpenAPI connection "${t}" has an invalid ${n} URL "${e}".`)}if(r.protocol!==`https:`&&!(r.protocol===`http:`&&isLoopbackHostname(r.hostname)))throw Error(`OpenAPI connection "${t}" must use https for its ${n} (got "${r.protocol}//${r.host}").`)}async function readResponseBody(e){let t=await e.text();if(t.length===0)return null;if((e.headers.get(`content-type`)??``).includes(`application/json`))try{return JSON.parse(t)}catch{return t}return t}export{OpenApiConnectionClient};
|