eve 1.0.0-rc.6 → 1.0.0-rc.8
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 +22 -26
- package/dist/src/acp/adapter.js +1 -1
- package/dist/src/acp/server.js +1 -1
- package/dist/src/ai/decide.js +1 -1
- package/dist/src/ai/decision-adapter.d.ts +12 -2
- package/dist/src/ai/decision-adapter.js +1 -1
- package/dist/src/approval/agent.js +1 -1
- package/dist/src/approval/evaluation.js +1 -1
- package/dist/src/approval/status.js +1 -1
- package/dist/src/channel/adapter-context.js +1 -1
- package/dist/src/channel/adapter.js +1 -1
- package/dist/src/channel/agent-description.js +1 -1
- package/dist/src/channel/auth/definitions.js +1 -1
- package/dist/src/channel/auth/http-basic.js +1 -1
- package/dist/src/channel/auth/jwt-ecdsa.js +1 -1
- package/dist/src/channel/auth/oidc.js +1 -1
- package/dist/src/channel/auth/token-claims.js +1 -1
- package/dist/src/channel/auth/vercel-oidc-project.js +1 -1
- package/dist/src/channel/channel-address.js +1 -1
- package/dist/src/channel/compiled-channel.js +1 -1
- package/dist/src/channel/conversation-context.js +1 -1
- package/dist/src/channel/cors.js +1 -1
- package/dist/src/channel/delivery-idempotency.js +1 -1
- package/dist/src/channel/forwarded-principal.js +1 -1
- package/dist/src/channel/http.js +1 -1
- package/dist/src/channel/inactive-prompt.js +1 -1
- package/dist/src/channel/interaction-prompts.js +1 -1
- package/dist/src/channel/ip-allow-list.js +1 -1
- package/dist/src/channel/resolve-text.js +1 -1
- package/dist/src/channel/resolved-prompt.d.ts +10 -2
- package/dist/src/channel/resolved-prompt.js +1 -1
- package/dist/src/channel/schedule.js +1 -1
- package/dist/src/channel/send-input.js +1 -1
- package/dist/src/channel/session-callback.js +1 -1
- package/dist/src/channel/session.js +1 -1
- package/dist/src/channel/sign-in.d.ts +2 -0
- package/dist/src/channel/sign-in.js +2 -2
- package/dist/src/channel/skill-files.js +1 -1
- package/dist/src/channel/surface.js +1 -1
- package/dist/src/channel/task-card.js +1 -1
- package/dist/src/channel/types.d.ts +2 -2
- package/dist/src/channel/websocket-upgrade-server.js +1 -1
- package/dist/src/chunks/{use-eve-agent-Cmg8590o.js → use-eve-agent-CaMLdv1n.js} +6 -1
- package/dist/src/chunks/{use-eve-agent-ycPyvX_c.js → use-eve-agent-DQtKP7gy.js} +6 -1
- package/dist/src/cli/acp/command.js +1 -1
- package/dist/src/cli/agent-command.js +1 -1
- package/dist/src/cli/commands/agent-instructions.js +2 -2
- package/dist/src/cli/commands/agent-prompt/build-and-verify.md +1 -1
- package/dist/src/cli/commands/build.js +1 -1
- package/dist/src/cli/commands/extension-build.js +1 -1
- package/dist/src/cli/commands/extension-init.js +1 -1
- package/dist/src/cli/commands/info.js +1 -1
- package/dist/src/cli/commands/init-agent-workspace.js +1 -1
- package/dist/src/cli/commands/init-git.js +1 -1
- package/dist/src/cli/commands/init-install.js +1 -1
- package/dist/src/cli/commands/init-target.js +1 -1
- package/dist/src/cli/commands/init.js +1 -1
- package/dist/src/cli/commands/integration-connect.js +1 -1
- package/dist/src/cli/commands/integration-setup.js +1 -1
- package/dist/src/cli/commands/logs-events.js +1 -1
- package/dist/src/cli/commands/logs.js +3 -3
- package/dist/src/cli/commands/register-integration-commands.js +1 -1
- package/dist/src/cli/commands/register-registry-commands.js +2 -2
- package/dist/src/cli/commands/registry-declared-setups.js +1 -1
- package/dist/src/cli/commands/registry-install-transaction.js +1 -1
- package/dist/src/cli/commands/registry-metadata.js +1 -1
- package/dist/src/cli/commands/registry-pnpm-build-policy-flow.js +1 -1
- package/dist/src/cli/commands/registry-presentation.js +4 -4
- package/dist/src/cli/commands/registry-project.js +2 -2
- package/dist/src/cli/commands/registry-setup-command.js +1 -1
- package/dist/src/cli/commands/registry.js +1 -1
- package/dist/src/cli/commands/setup-answers.js +1 -1
- package/dist/src/cli/commands/setup-headless.js +1 -1
- package/dist/src/cli/commands/trace-detail.js +1 -1
- package/dist/src/cli/commands/trace.js +3 -3
- package/dist/src/cli/commands/vercel-non-interactive.js +1 -1
- package/dist/src/cli/dev/command.js +1 -1
- package/dist/src/cli/dev/diagnostic-dump.js +1 -1
- package/dist/src/cli/dev/diagnostic-sink.js +1 -1
- package/dist/src/cli/dev/environment.js +1 -1
- package/dist/src/cli/dev/local-server-child.js +1 -1
- package/dist/src/cli/dev/local-server-cleanup.js +1 -1
- package/dist/src/cli/dev/local-server-process.js +1 -1
- package/dist/src/cli/dev/remote-print.js +1 -1
- package/dist/src/cli/dev/run-interactive-ui.js +1 -1
- package/dist/src/cli/dev/tui/agent-header.js +1 -1
- package/dist/src/cli/dev/tui/argument-typeahead.js +2 -2
- package/dist/src/cli/dev/tui/blocks.js +7 -7
- package/dist/src/cli/dev/tui/command-typeahead.js +1 -1
- package/dist/src/cli/dev/tui/conversation-view.js +1 -1
- package/dist/src/cli/dev/tui/dev-rebuild-status.js +1 -1
- package/dist/src/cli/dev/tui/diagnostic-presentation.js +1 -1
- package/dist/src/cli/dev/tui/file-content-cache.js +1 -1
- package/dist/src/cli/dev/tui/flow-drawer.js +1 -1
- package/dist/src/cli/dev/tui/line-diff.js +1 -1
- package/dist/src/cli/dev/tui/line-editor.js +3 -3
- package/dist/src/cli/dev/tui/log-display-mode.js +1 -1
- package/dist/src/cli/dev/tui/markdown.js +4 -4
- package/dist/src/cli/dev/tui/mcp-connection-status.js +1 -1
- package/dist/src/cli/dev/tui/message-queue.js +1 -1
- package/dist/src/cli/dev/tui/prompt-command-handler.js +1 -1
- package/dist/src/cli/dev/tui/prompt-commands.js +1 -1
- package/dist/src/cli/dev/tui/prompt-placeholder.js +1 -1
- package/dist/src/cli/dev/tui/question-panel.js +1 -1
- package/dist/src/cli/dev/tui/registry-result-message.js +2 -2
- package/dist/src/cli/dev/tui/remote-auth.js +1 -1
- package/dist/src/cli/dev/tui/remote-connection.js +1 -1
- package/dist/src/cli/dev/tui/remote-startup.js +1 -1
- package/dist/src/cli/dev/tui/runner.js +3 -3
- package/dist/src/cli/dev/tui/setup-commands.js +2 -2
- package/dist/src/cli/dev/tui/setup-issues.js +1 -1
- package/dist/src/cli/dev/tui/setup-panel.js +6 -6
- package/dist/src/cli/dev/tui/setup-selection-input.js +1 -1
- package/dist/src/cli/dev/tui/status-line.js +1 -1
- package/dist/src/cli/dev/tui/stranded-session.js +1 -1
- package/dist/src/cli/dev/tui/stream-format.js +3 -3
- package/dist/src/cli/dev/tui/task-activity.js +1 -1
- package/dist/src/cli/dev/tui/task-records.js +1 -1
- package/dist/src/cli/dev/tui/terminal-renderer.js +7 -7
- package/dist/src/cli/dev/tui/test/fake-eve-server.js +1 -1
- package/dist/src/cli/dev/tui/test/mock-terminal.js +3 -3
- package/dist/src/cli/dev/tui/theme.js +1 -1
- package/dist/src/cli/dev/tui/tool-block-groups.js +1 -1
- package/dist/src/cli/dev/tui/tool-presentation.js +1 -1
- package/dist/src/cli/dev/tui/tool-rows.js +1 -1
- package/dist/src/cli/dev/tui/traces/trace-content.js +2 -2
- package/dist/src/cli/dev/tui/traces/trace-conversation.js +2 -2
- package/dist/src/cli/dev/tui/traces/trace-surfaces.js +1 -1
- package/dist/src/cli/dev/tui/traces/trace-view.js +2 -2
- package/dist/src/cli/dev/tui/traces/trace-viewer-session.js +1 -1
- package/dist/src/cli/dev/tui/traces/trace-viewer-state.js +1 -1
- package/dist/src/cli/dev/tui/transcript-parts.js +2 -2
- package/dist/src/cli/dev/tui/transcript.js +1 -1
- package/dist/src/cli/dev/tui/tui-prompter.js +1 -1
- package/dist/src/cli/dev/tui/tui.js +1 -1
- package/dist/src/cli/dev/tui/vercel-status.js +1 -1
- package/dist/src/cli/dev/tui/vercel-trusted-sources-policy.js +1 -1
- package/dist/src/cli/dev/tui/vercel-trusted-sources.js +1 -1
- package/dist/src/cli/dev/url-target.js +1 -1
- package/dist/src/cli/format-elapsed.js +1 -1
- package/dist/src/cli/option-parsers.js +1 -1
- package/dist/src/cli/run.js +2 -2
- package/dist/src/cli/shutdown.js +1 -1
- package/dist/src/cli/telemetry/identity.js +1 -1
- package/dist/src/cli/telemetry/index.js +2 -2
- package/dist/src/cli/telemetry/preference.js +1 -1
- package/dist/src/cli/ui/alt-screen.js +1 -1
- package/dist/src/cli/ui/live-row.js +1 -1
- package/dist/src/cli/ui/output.js +2 -2
- package/dist/src/cli/ui/progress-pulse.js +1 -1
- package/dist/src/cli/ui/terminal-text.js +1 -1
- package/dist/src/cli/vercel-service-output.js +1 -1
- package/dist/src/client/agent-info-schema.js +1 -1
- package/dist/src/client/agent-stream-follower.js +1 -1
- package/dist/src/client/client-error.js +1 -1
- package/dist/src/client/client.js +1 -1
- package/dist/src/client/conversation-client.js +1 -1
- package/dist/src/client/conversation-state.js +1 -1
- package/dist/src/client/conversation.js +1 -1
- package/dist/src/client/delivery-events.js +1 -1
- package/dist/src/client/delivery.js +1 -1
- package/dist/src/client/message-types.d.ts +2 -0
- package/dist/src/client/messages.js +1 -1
- package/dist/src/client/ndjson.js +1 -1
- package/dist/src/client/open-stream.js +1 -1
- package/dist/src/client/session-controls.js +1 -1
- package/dist/src/client/session-store.js +1 -1
- package/dist/src/client/session-utils.js +2 -2
- package/dist/src/client/session.js +1 -1
- package/dist/src/client/transcript.js +1 -1
- package/dist/src/client/url.js +1 -1
- package/dist/src/compiled/.vendor-stamp.json +4 -4
- package/dist/src/compiled/@opentelemetry/api/index.d.ts +2 -0
- package/dist/src/compiled/@vercel/agent-runs/agent-run.d.ts +19 -2
- package/dist/src/compiled/@vercel/agent-runs/core/memory.d.ts +10 -0
- package/dist/src/compiled/@vercel/agent-runs/core/scopes.d.ts +3 -0
- package/dist/src/compiled/@vercel/agent-runs/core/types.d.ts +14 -1
- package/dist/src/compiled/@vercel/agent-runs/index.d.ts +2 -2
- package/dist/src/compiled/@vercel/agent-runs/index.js +2 -2
- package/dist/src/compiled/@vercel/agent-runs/operations.d.ts +1 -0
- package/dist/src/compiled/@vercel/agent-runs/otel.js +1 -1
- package/dist/src/compiled/@vercel/schedules/index.d.ts +98 -5
- package/dist/src/compiled/@vercel/schedules/index.js +1 -1
- package/dist/src/compiled/@workflow/world-local/index.js +5 -5
- package/dist/src/compiled/_chunks/client/core-BiEkysdn.js +52 -0
- package/dist/src/compiled/_chunks/client/rolldown-runtime-CKPSJRnw.js +1 -0
- package/dist/src/compiled/_chunks/workflow/mcp-p-bUlnLA.js +5 -0
- package/dist/src/compiled/zod/index.js +1 -1
- package/dist/src/compiled/zod/v3.js +1 -1
- package/dist/src/compiled/zod/v4/core.js +1 -1
- package/dist/src/compiled/zod-validation-error/index.js +1 -1
- package/dist/src/compiler/artifacts.js +1 -1
- package/dist/src/compiler/bundled-extension.js +1 -1
- package/dist/src/compiler/channel-route-plan.js +1 -1
- package/dist/src/compiler/compile-agent.js +1 -1
- package/dist/src/compiler/connection-ownership.js +1 -1
- package/dist/src/compiler/development-extensions.js +1 -1
- package/dist/src/compiler/diagnostics.js +1 -1
- package/dist/src/compiler/extension-compatibility.js +1 -1
- package/dist/src/compiler/load-binding-namespace.js +1 -1
- package/dist/src/compiler/manifest-schema.d.ts +880 -0
- package/dist/src/compiler/manifest-schema.js +1 -0
- package/dist/src/compiler/manifest.d.ts +10 -511
- package/dist/src/compiler/manifest.js +1 -1
- package/dist/src/compiler/model-catalog.js +1 -1
- package/dist/src/compiler/module-lifecycle.js +1 -1
- package/dist/src/compiler/module-map.js +3 -3
- package/dist/src/compiler/node-source-state.js +1 -1
- package/dist/src/compiler/normalize-agent-config.js +1 -1
- package/dist/src/compiler/normalize-channel.js +1 -1
- package/dist/src/compiler/normalize-connection.js +1 -1
- package/dist/src/compiler/normalize-definitions.js +1 -1
- package/dist/src/compiler/normalize-helpers.js +1 -1
- package/dist/src/compiler/normalize-instructions.js +1 -1
- package/dist/src/compiler/normalize-manifest-helpers.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/normalize-schedule-collection.js +1 -1
- package/dist/src/compiler/normalize-schedule.js +1 -1
- package/dist/src/compiler/normalize-skill.js +1 -1
- package/dist/src/compiler/normalize-subagent.js +1 -1
- package/dist/src/compiler/normalize-tool.js +1 -1
- package/dist/src/compiler/project-sources.js +1 -1
- package/dist/src/compiler/resolve-workspace-subagent.js +1 -1
- package/dist/src/compiler/source-graph-paths.js +1 -1
- package/dist/src/compiler/source-graph.js +1 -1
- package/dist/src/compiler/validate-artifact.js +1 -1
- package/dist/src/compiler/workspace-resources.js +1 -1
- package/dist/src/computer-use/extension/lib/computer-use-driver-source.js +4 -4
- package/dist/src/computer-use/extension/lib/computer-use-sandbox.d.ts +1 -1
- package/dist/src/computer-use/extension/lib/computer-use-sandbox.js +3 -11
- package/dist/src/computer-use/extension/lib/computer-use.js +18 -9
- package/dist/src/computer-use/extension/tools/computer_use.js +1 -1
- package/dist/src/connections/errors.js +1 -1
- package/dist/src/context/build-base-tool-context.js +1 -1
- package/dist/src/context/build-callback-context.js +1 -1
- package/dist/src/context/container.js +1 -1
- package/dist/src/context/key-names.js +1 -1
- package/dist/src/context/key.js +1 -1
- package/dist/src/context/keys.js +1 -1
- package/dist/src/context/prewarm.js +1 -1
- package/dist/src/context/providers/sandbox.js +1 -1
- package/dist/src/context/providers/session.js +1 -1
- package/dist/src/context/run-step.js +1 -1
- package/dist/src/context/schedule-collection-tools.js +1 -1
- package/dist/src/context/serialize.js +1 -1
- package/dist/src/context/session-schedule.js +1 -1
- package/dist/src/context/turn-principals.js +1 -1
- package/dist/src/definitions/agent.js +1 -1
- package/dist/src/definitions/approvals.js +1 -1
- package/dist/src/definitions/builtins.js +1 -1
- package/dist/src/definitions/catalog.js +1 -1
- package/dist/src/definitions/connections.js +1 -1
- package/dist/src/definitions/definition.js +1 -1
- package/dist/src/definitions/frame.js +1 -1
- package/dist/src/definitions/hooks.js +1 -1
- package/dist/src/definitions/instructions.js +1 -1
- package/dist/src/definitions/intents.js +1 -1
- package/dist/src/definitions/kernel.js +1 -1
- package/dist/src/definitions/memos.js +1 -1
- package/dist/src/definitions/messages.js +1 -1
- package/dist/src/definitions/model.js +1 -1
- package/dist/src/definitions/named.js +1 -1
- package/dist/src/definitions/remote.js +1 -1
- package/dist/src/definitions/skills.js +1 -1
- package/dist/src/definitions/state.js +1 -1
- package/dist/src/definitions/step.js +1 -1
- package/dist/src/definitions/subagents.js +1 -1
- package/dist/src/definitions/tools.js +1 -1
- package/dist/src/definitions/turn.js +1 -1
- package/dist/src/discover/bundled-extension.js +1 -1
- package/dist/src/discover/connections.js +1 -1
- package/dist/src/discover/diagnostics.js +1 -1
- package/dist/src/discover/discover-agent.js +1 -1
- package/dist/src/discover/discover-subagent.js +1 -1
- package/dist/src/discover/extensions.js +1 -1
- package/dist/src/discover/filesystem.js +1 -1
- package/dist/src/discover/grammar.js +1 -1
- package/dist/src/discover/lib.js +1 -1
- package/dist/src/discover/manifest.js +1 -1
- package/dist/src/discover/memory.js +1 -1
- package/dist/src/discover/named-source-directory.js +1 -1
- package/dist/src/discover/project-source.js +1 -1
- package/dist/src/discover/project.js +1 -1
- package/dist/src/discover/sandbox.js +1 -1
- package/dist/src/discover/schedules.js +1 -1
- package/dist/src/discover/skills.js +1 -1
- package/dist/src/discover/slots.js +1 -1
- package/dist/src/evals/abort.js +1 -1
- package/dist/src/evals/assertions/run.js +2 -2
- package/dist/src/evals/assertions/scoped.js +1 -1
- package/dist/src/evals/cli/eval-client.js +1 -1
- package/dist/src/evals/cli/eval-state-directory.js +1 -1
- package/dist/src/evals/cli/eval.js +2 -2
- package/dist/src/evals/context.js +1 -1
- package/dist/src/evals/control-flow.js +1 -1
- package/dist/src/evals/judge.js +1 -1
- package/dist/src/evals/loaders/json.js +1 -1
- package/dist/src/evals/loaders/yaml.js +1 -1
- package/dist/src/evals/match.js +1 -1
- package/dist/src/evals/mock-model.js +1 -1
- package/dist/src/evals/reported-tool-name.js +1 -1
- package/dist/src/evals/runner/derive-run-facts.js +1 -1
- package/dist/src/evals/runner/discover.js +1 -1
- package/dist/src/evals/runner/execute-eval.js +1 -1
- package/dist/src/evals/runner/execute-task.js +1 -1
- package/dist/src/evals/runner/reporters/assertion-diagnostics.js +3 -3
- package/dist/src/evals/runner/reporters/assertion-scores.js +1 -1
- package/dist/src/evals/runner/reporters/braintrust.js +1 -1
- package/dist/src/evals/runner/reporters/console.js +1 -1
- package/dist/src/evals/runner/reporters/datadog-client.js +1 -1
- package/dist/src/evals/runner/reporters/datadog-runtime-trace-links.js +1 -1
- package/dist/src/evals/runner/reporters/datadog.js +1 -1
- package/dist/src/evals/runner/reporters/junit.js +1 -1
- package/dist/src/evals/runner/run-evals.js +1 -1
- package/dist/src/evals/session-content.js +1 -1
- package/dist/src/evals/session-manager.js +1 -1
- package/dist/src/evals/session.js +2 -2
- package/dist/src/evals/target.js +1 -1
- package/dist/src/eve-channel/auth.js +1 -1
- package/dist/src/eve-channel/descendant-stream.js +1 -1
- package/dist/src/eve-channel/index.js +1 -1
- package/dist/src/eve-channel/request.js +1 -1
- package/dist/src/eve-channel/stream-headers.js +1 -1
- package/dist/src/eve-channel/support.js +1 -1
- package/dist/src/execution/agent-sessions/remote-credentials.js +1 -1
- package/dist/src/execution/agent-sessions/remote.d.ts +1 -1
- package/dist/src/execution/agent-sessions/remote.js +1 -1
- package/dist/src/execution/agent-sessions/requests.d.ts +2 -0
- package/dist/src/execution/agent-sessions/requests.js +1 -1
- package/dist/src/execution/agent-sessions/session.js +1 -1
- package/dist/src/execution/agent-sessions/steps.js +1 -1
- package/dist/src/execution/agent-sessions/target.js +1 -1
- package/dist/src/execution/authorization-callback-match.js +1 -1
- package/dist/src/execution/cancelled-model-call-batch.js +1 -1
- package/dist/src/execution/cancelled-turn-message.js +1 -1
- package/dist/src/execution/catalog/catalog-tools.js +1 -1
- package/dist/src/execution/catalog/connection-auth.js +1 -1
- package/dist/src/execution/catalog/connection-entry.js +1 -1
- package/dist/src/execution/catalog/listing.js +2 -2
- package/dist/src/execution/catalog/rank.js +1 -1
- package/dist/src/execution/catalog/search.js +1 -1
- package/dist/src/execution/catalog/skills.js +1 -1
- package/dist/src/execution/catalog/step-catalog.js +1 -1
- package/dist/src/execution/channel-context.js +1 -1
- package/dist/src/execution/child-binding.js +1 -1
- package/dist/src/execution/connections/callback-route.js +1 -1
- package/dist/src/execution/coordination-dispatch-shared.js +1 -1
- package/dist/src/execution/coordination-dispatch-step.js +1 -1
- package/dist/src/execution/create-session-step.js +1 -1
- package/dist/src/execution/deliver-payloads.js +1 -1
- package/dist/src/execution/dynamic-workflow/program-step.js +1 -1
- 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.js +1 -1
- package/dist/src/execution/failure-summary.js +1 -1
- package/dist/src/execution/forward-session-input.js +1 -1
- package/dist/src/execution/install-workflow-world.js +1 -1
- package/dist/src/execution/invoke-tool.js +1 -1
- package/dist/src/execution/legacy-session/inbox.js +1 -1
- package/dist/src/execution/legacy-session/input.js +1 -1
- package/dist/src/execution/legacy-session/interrupt-step.js +1 -1
- package/dist/src/execution/legacy-session/prepare-step.js +1 -1
- package/dist/src/execution/legacy-session/snapshot.js +1 -1
- package/dist/src/execution/legacy-session/turn-workflow.js +1 -1
- package/dist/src/execution/model-call-batching.js +1 -1
- package/dist/src/execution/ndjson-stream.js +1 -1
- package/dist/src/execution/node-step.js +1 -1
- package/dist/src/execution/proxied-deliver-step.d.ts +7 -0
- package/dist/src/execution/proxied-deliver-step.js +1 -1
- package/dist/src/execution/public-destination.js +1 -1
- package/dist/src/execution/publish-session-events.js +1 -1
- package/dist/src/execution/runtime-context.js +1 -1
- package/dist/src/execution/sandbox/bash.js +4 -4
- package/dist/src/execution/sandbox/bindings/docker-cli.js +1 -1
- package/dist/src/execution/sandbox/bindings/docker-connection.js +1 -1
- package/dist/src/execution/sandbox/bindings/docker-container.js +1 -1
- package/dist/src/execution/sandbox/bindings/docker-templates.js +1 -1
- package/dist/src/execution/sandbox/bindings/docker.js +1 -1
- package/dist/src/execution/sandbox/bindings/eve-image.js +1 -1
- package/dist/src/execution/sandbox/bindings/just-bash-runtime.js +1 -1
- package/dist/src/execution/sandbox/bindings/just-bash.js +1 -1
- package/dist/src/execution/sandbox/bindings/local-template-prune.js +1 -1
- package/dist/src/execution/sandbox/bindings/vercel-base-runtime.js +1 -1
- package/dist/src/execution/sandbox/bindings/vercel-create-sdk.js +1 -1
- package/dist/src/execution/sandbox/bindings/vercel-credentials.js +1 -1
- package/dist/src/execution/sandbox/bindings/vercel-errors.js +1 -1
- package/dist/src/execution/sandbox/bindings/vercel-options.js +1 -1
- package/dist/src/execution/sandbox/bindings/vercel.js +1 -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.js +1 -1
- package/dist/src/execution/sandbox/dockerfile.js +1 -1
- 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-search.js +4 -4
- package/dist/src/execution/sandbox/multiplexed-command.js +1 -1
- package/dist/src/execution/sandbox/prewarm.js +1 -1
- package/dist/src/execution/sandbox/provider-files.js +1 -1
- package/dist/src/execution/sandbox/read-file.js +3 -3
- package/dist/src/execution/sandbox/session.js +2 -2
- package/dist/src/execution/sandbox/truncate-output.js +2 -2
- package/dist/src/execution/sandbox/write-file.js +1 -1
- package/dist/src/execution/session/active-turn.js +1 -1
- package/dist/src/execution/session/answer-caller.js +1 -1
- package/dist/src/execution/session/checkpoint-migrations.js +1 -1
- package/dist/src/execution/session/delivery-facts.js +1 -1
- package/dist/src/execution/session/end-sandbox-step.js +1 -1
- package/dist/src/execution/session/entry.js +1 -1
- package/dist/src/execution/session/finalization.js +1 -1
- package/dist/src/execution/session/handoff-state.js +1 -1
- package/dist/src/execution/session/handoff-steps.js +1 -1
- package/dist/src/execution/session/handoff.js +1 -1
- package/dist/src/execution/session/handover-tracing.js +1 -1
- package/dist/src/execution/session/hook-tokens.js +1 -1
- package/dist/src/execution/session/imported-conversation.js +1 -1
- package/dist/src/execution/session/input-queue.js +1 -1
- package/dist/src/execution/session/interrupted-step.js +2 -2
- package/dist/src/execution/session/next-input.js +1 -1
- package/dist/src/execution/session/pre-v27-checkpoint.js +1 -1
- package/dist/src/execution/session/prewarm-step.js +1 -1
- package/dist/src/execution/session/program.js +1 -1
- package/dist/src/execution/session/settle-duplicate-delivery-step.js +1 -1
- package/dist/src/execution/session/state-cursor.js +1 -1
- package/dist/src/execution/session/step-decision-check.js +1 -1
- package/dist/src/execution/session/step-state-delta.js +1 -1
- package/dist/src/execution/session/timeout-control.js +1 -1
- package/dist/src/execution/session/turn-event-handler.js +1 -1
- package/dist/src/execution/session/turn-step-result.js +1 -1
- package/dist/src/execution/session/turn-step.js +1 -1
- package/dist/src/execution/session/turn.js +1 -1
- package/dist/src/execution/session-callback-request.js +1 -1
- package/dist/src/execution/session-event-stream.js +1 -1
- package/dist/src/execution/session-inbox/address.js +1 -1
- package/dist/src/execution/session-inbox/end-stranded-session.d.ts +8 -0
- package/dist/src/execution/session-inbox/end-stranded-session.js +1 -1
- package/dist/src/execution/session-inbox/handle.js +1 -1
- package/dist/src/execution/session-inbox/inbox.js +1 -1
- package/dist/src/execution/session-inbox/owner.d.ts +22 -4
- package/dist/src/execution/session-inbox/owner.js +1 -1
- package/dist/src/execution/session-inbox/resume.d.ts +4 -0
- package/dist/src/execution/session-inbox/resume.js +1 -1
- package/dist/src/execution/session-inbox/stranded-replay-guard.js +1 -1
- package/dist/src/execution/session-workflow-tool-run.js +1 -1
- package/dist/src/execution/settle-cancelled-turn-step.js +1 -1
- package/dist/src/execution/stable-workflow-names.js +1 -1
- package/dist/src/execution/stop-runs.js +1 -1
- package/dist/src/execution/tasks/calls.d.ts +3 -1
- package/dist/src/execution/tasks/calls.js +1 -1
- package/dist/src/execution/tasks/model-step.js +1 -1
- package/dist/src/execution/tasks/render.d.ts +1 -1
- package/dist/src/execution/tasks/render.js +6 -6
- package/dist/src/execution/tasks/session.js +1 -1
- package/dist/src/execution/tasks/start.js +1 -1
- package/dist/src/execution/tasks/steps.js +1 -1
- package/dist/src/execution/tasks/table.js +1 -1
- package/dist/src/execution/tasks/task-id-input.js +1 -1
- package/dist/src/execution/terminal-session-failure-step.js +1 -1
- package/dist/src/execution/tool-auth.js +1 -1
- package/dist/src/execution/tool-stubs/playback.js +1 -1
- package/dist/src/execution/tool-stubs/steps.js +1 -1
- package/dist/src/execution/tools/agent-router-workflow.js +1 -1
- package/dist/src/execution/tools/agent-router.js +1 -1
- package/dist/src/execution/tools/channel-to.js +1 -1
- package/dist/src/execution/tools/workflow/answer.js +1 -1
- package/dist/src/execution/tools/workflow/apply-run-messages-step.js +1 -1
- package/dist/src/execution/tools/workflow/ask.js +1 -1
- package/dist/src/execution/tools/workflow/authorization-completion.js +1 -1
- package/dist/src/execution/tools/workflow/body.js +1 -1
- package/dist/src/execution/tools/workflow/cancellation-policy.js +1 -1
- package/dist/src/execution/tools/workflow/interrupt.js +1 -1
- package/dist/src/execution/tools/workflow/messages.js +1 -1
- package/dist/src/execution/tools/workflow/owner-inbox.js +1 -1
- package/dist/src/execution/tools/workflow/owner.js +1 -1
- package/dist/src/execution/tools/workflow/serve.js +1 -1
- package/dist/src/execution/tools/workflow/step-execution.js +1 -1
- package/dist/src/execution/tools/workflow/step.js +1 -1
- package/dist/src/execution/tools/workflow/withdraw-step.js +1 -1
- package/dist/src/execution/tools/workflow/workflow-owner-blocking.js +1 -1
- package/dist/src/execution/tools/workflow/workflow.js +1 -1
- package/dist/src/execution/v26-history.fixtures.js +1 -1
- package/dist/src/execution/v26-history.js +1 -1
- package/dist/src/execution/web-fetch/execute.js +1 -1
- package/dist/src/execution/web-fetch/html.js +2 -2
- package/dist/src/execution/web-fetch/request.js +1 -1
- package/dist/src/execution/workflow-callback-url.js +1 -1
- package/dist/src/execution/workflow-errors.js +1 -1
- package/dist/src/execution/workflow-runtime.js +1 -1
- package/dist/src/extensions/code/extension/extension.js +1 -1
- package/dist/src/extensions/code/extension/lib/connect-authentication.js +1 -1
- package/dist/src/extensions/code/extension/lib/credentials.js +1 -1
- package/dist/src/extensions/code/extension/lib/project-instructions.js +2 -2
- package/dist/src/extensions/code/extension/lib/sandbox.js +1 -1
- package/dist/src/extensions/git/extension/extension.d.ts +1 -0
- package/dist/src/extensions/git/extension/extension.js +1 -1
- package/dist/src/extensions/git/extension/lib/attribution.js +2 -2
- package/dist/src/extensions/git/extension/lib/connect-user-auth.js +1 -1
- package/dist/src/extensions/git/extension/lib/gh-tool.js +1 -1
- package/dist/src/extensions/git/extension/lib/github-guidance.js +1 -1
- package/dist/src/extensions/git/extension/lib/github-shell-schema.js +1 -1
- package/dist/src/extensions/git/extension/lib/github-shell.d.ts +12 -1
- package/dist/src/extensions/git/extension/lib/github-shell.js +1 -1
- package/dist/src/extensions/git/extension/lib/repository-root.js +1 -1
- package/dist/src/extensions/git/extension/lib/sandbox-lease-lock.d.ts +32 -0
- package/dist/src/extensions/git/extension/lib/sandbox-lease-lock.js +4 -0
- package/dist/src/extensions/git/extension/lib/signed-commit.js +1 -1
- package/dist/src/extensions/git/extension/lib/tooling.js +1 -1
- package/dist/src/framework/sources/registry.js +1 -1
- package/dist/src/harness/action-presentation.d.ts +2 -0
- package/dist/src/harness/action-presentation.js +1 -1
- package/dist/src/harness/action-result-helpers.js +1 -1
- package/dist/src/harness/announcements.js +1 -1
- package/dist/src/harness/attachment-staging.js +1 -1
- package/dist/src/harness/authorization.d.ts +7 -0
- package/dist/src/harness/authorization.js +1 -1
- package/dist/src/harness/call-executor.js +1 -1
- package/dist/src/harness/call-facts.d.ts +6 -2
- package/dist/src/harness/call-facts.js +1 -1
- package/dist/src/harness/call-outcome.js +1 -1
- package/dist/src/harness/compaction/config.js +1 -1
- package/dist/src/harness/compaction/engine.js +2 -2
- package/dist/src/harness/compaction/prompt.js +3 -3
- package/dist/src/harness/compaction/step.js +1 -1
- package/dist/src/harness/coordination.js +1 -1
- package/dist/src/harness/emission.js +1 -1
- package/dist/src/harness/execute-tool.d.ts +1 -1
- package/dist/src/harness/facts.js +1 -1
- package/dist/src/harness/generation-steering.js +1 -1
- package/dist/src/harness/hitl/approvals.d.ts +3 -0
- package/dist/src/harness/hitl/approvals.js +2 -2
- package/dist/src/harness/hitl/approved-calls.d.ts +19 -0
- package/dist/src/harness/hitl/approved-calls.js +1 -1
- package/dist/src/harness/hitl/budget.js +1 -1
- package/dist/src/harness/hitl/delivery.js +1 -1
- package/dist/src/harness/hitl/index.d.ts +1 -0
- package/dist/src/harness/hitl/index.js +1 -1
- package/dist/src/harness/hitl/intake.js +1 -1
- package/dist/src/harness/hitl/relays.d.ts +16 -0
- package/dist/src/harness/hitl/relays.js +1 -1
- package/dist/src/harness/hitl/requests.js +1 -1
- package/dist/src/harness/hitl/responders.js +1 -1
- package/dist/src/harness/hitl/sign-in-callbacks.d.ts +66 -0
- package/dist/src/harness/hitl/sign-in-callbacks.js +1 -0
- package/dist/src/harness/hitl/sign-ins.d.ts +21 -2
- package/dist/src/harness/hitl/sign-ins.js +1 -1
- package/dist/src/harness/hitl/stale-responses.js +1 -1
- package/dist/src/harness/interaction-facts.js +1 -1
- package/dist/src/harness/interaction-relay.js +1 -1
- package/dist/src/harness/interruptible-stream.js +1 -1
- package/dist/src/harness/kernel.js +1 -1
- package/dist/src/harness/messages.js +1 -1
- package/dist/src/harness/model-call/call.d.ts +2 -2
- package/dist/src/harness/model-call/call.js +2 -2
- package/dist/src/harness/model-call/errors.js +1 -1
- package/dist/src/harness/model-call/failure.js +1 -1
- package/dist/src/harness/model-call/model.js +1 -1
- package/dist/src/harness/model-call/recovery.js +1 -1
- package/dist/src/harness/model-call/response.d.ts +4 -1
- package/dist/src/harness/model-call/response.js +1 -1
- package/dist/src/harness/model-call/retry.js +1 -1
- package/dist/src/harness/model-call/run.js +1 -1
- package/dist/src/harness/model-call/tools.js +1 -1
- package/dist/src/harness/model-call/unique-call-ids.js +1 -1
- package/dist/src/harness/model-profile.js +1 -1
- package/dist/src/harness/ordered-stream-emitter.js +1 -1
- package/dist/src/harness/prompt-cache.js +1 -1
- package/dist/src/harness/provider-safety.js +1 -1
- package/dist/src/harness/provider-tool-history.js +1 -1
- package/dist/src/harness/provider-tool-schemas.js +1 -1
- package/dist/src/harness/request-envelope.js +1 -1
- package/dist/src/harness/running-work.js +1 -1
- package/dist/src/harness/semantic-errors/rule.js +1 -1
- package/dist/src/harness/semantic-errors/rules/gateway.js +1 -1
- package/dist/src/harness/semantic-errors/rules/sandbox.js +1 -1
- package/dist/src/harness/semantic-errors/rules/system.js +1 -1
- package/dist/src/harness/semantic-errors/signals.js +1 -1
- package/dist/src/harness/session-machine/cascade.js +1 -1
- package/dist/src/harness/session-machine/context-changes.js +1 -1
- package/dist/src/harness/session-machine/current.js +1 -1
- package/dist/src/harness/session-machine/history.js +1 -1
- package/dist/src/harness/session-machine/lines.js +1 -1
- package/dist/src/harness/session-machine/runs.js +1 -1
- package/dist/src/harness/session-machine/state.js +1 -1
- package/dist/src/harness/session-machine/suspended-steps.js +1 -1
- package/dist/src/harness/session-machine/transitions.d.ts +14 -4
- package/dist/src/harness/session-machine/transitions.js +1 -1
- package/dist/src/harness/session-machine/view.js +1 -1
- package/dist/src/harness/session-machine/waiting.js +1 -1
- package/dist/src/harness/session-usage.js +1 -1
- package/dist/src/harness/step/after-model.js +1 -1
- package/dist/src/harness/step/context.js +1 -1
- package/dist/src/harness/step/intake.js +1 -1
- package/dist/src/harness/step/prompt.js +1 -1
- package/dist/src/harness/step-hooks.js +1 -1
- package/dist/src/harness/stream-actions.js +1 -1
- package/dist/src/harness/token-estimate.js +1 -1
- package/dist/src/harness/tool-call-input-errors.js +1 -1
- package/dist/src/harness/tool-history-repair.js +1 -1
- package/dist/src/harness/tool-model-output.js +1 -1
- package/dist/src/harness/tools.js +1 -1
- package/dist/src/harness/turn-cancellation.js +1 -1
- package/dist/src/harness/usage-sink.js +1 -1
- package/dist/src/harness/user-parts.js +1 -1
- package/dist/src/harness/workflow-stream-error.js +1 -1
- package/dist/src/harness/workflow-tool-runs.js +1 -1
- package/dist/src/instrumentation/ai-sdk-hook-bridge.js +1 -1
- package/dist/src/instrumentation/ai-sdk-telemetry.js +1 -1
- package/dist/src/instrumentation/ai-sdk-warnings.js +1 -1
- package/dist/src/instrumentation/channel-delivery.js +1 -1
- package/dist/src/instrumentation/content.js +1 -1
- package/dist/src/instrumentation/decide.d.ts +3 -0
- package/dist/src/instrumentation/decide.js +1 -0
- package/dist/src/instrumentation/dispatch.js +1 -1
- package/dist/src/instrumentation/lifecycle.d.ts +5 -0
- package/dist/src/instrumentation/memory.js +1 -1
- package/dist/src/instrumentation/native-events.js +1 -1
- package/dist/src/instrumentation/parent-lineage.js +1 -1
- package/dist/src/instrumentation/prepare-trace-context.js +1 -1
- package/dist/src/instrumentation/principal-summary.js +1 -1
- package/dist/src/instrumentation/provider.js +1 -1
- package/dist/src/instrumentation/providers.js +1 -1
- package/dist/src/instrumentation/runtime-context.js +1 -1
- package/dist/src/instrumentation/runtime-global.js +1 -1
- package/dist/src/instrumentation/runtime.d.ts +4 -0
- package/dist/src/instrumentation/runtime.js +1 -1
- package/dist/src/instrumentation/scope.js +1 -1
- package/dist/src/instrumentation/session-context.js +1 -1
- package/dist/src/instrumentation/session-init.js +1 -1
- package/dist/src/instrumentation/state.js +1 -1
- package/dist/src/instrumentation/trace-decision.d.ts +5 -0
- package/dist/src/instrumentation/trace-decision.js +1 -0
- package/dist/src/internal/application/build-output-environment.js +1 -1
- package/dist/src/internal/application/build-profile.js +1 -1
- package/dist/src/internal/application/build-workspace.js +1 -1
- package/dist/src/internal/application/compiled-artifacts.js +5 -5
- package/dist/src/internal/application/dev-environment.js +1 -1
- package/dist/src/internal/application/import-specifier.js +1 -1
- package/dist/src/internal/application/optional-package-import.js +1 -1
- package/dist/src/internal/application/optional-package-install.js +2 -2
- package/dist/src/internal/application/output-publication-lock.js +1 -1
- package/dist/src/internal/application/output-publication.js +1 -1
- package/dist/src/internal/application/package.js +1 -1
- package/dist/src/internal/application/paths.js +1 -1
- package/dist/src/internal/application/stamped-package-version.js +1 -1
- package/dist/src/internal/application/tsconfig-dependencies.js +1 -1
- package/dist/src/internal/attachments/data.js +1 -1
- package/dist/src/internal/attachments/limited-read.js +1 -1
- package/dist/src/internal/attachments/media-metadata.js +1 -1
- package/dist/src/internal/attachments/public-link.js +1 -1
- package/dist/src/internal/attachments/read-media-metadata.js +1 -1
- package/dist/src/internal/attachments/sandbox-refs.js +1 -1
- package/dist/src/internal/authored-asset-import-plugin.d.ts +5 -4
- package/dist/src/internal/authored-asset-import-plugin.js +1 -1
- package/dist/src/internal/authored-definition/connection.js +1 -1
- package/dist/src/internal/authored-definition/core.js +1 -1
- package/dist/src/internal/authored-definition/hook.js +1 -1
- package/dist/src/internal/authored-definition/schedule-collection.js +1 -1
- package/dist/src/internal/authored-definition/schema-backed.js +1 -1
- package/dist/src/internal/authored-definition/source-identity.js +1 -1
- package/dist/src/internal/authored-module-bundle.js +1 -1
- package/dist/src/internal/authored-module-cache.js +1 -1
- package/dist/src/internal/authored-module-conditions.js +1 -1
- 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-module-map-loader.js +1 -1
- package/dist/src/internal/authored-module.js +1 -1
- package/dist/src/internal/authored-package-tsconfig-paths.js +1 -1
- package/dist/src/internal/authored-relative-extension-resolver.js +1 -1
- package/dist/src/internal/authored-runtime-modules.js +1 -1
- package/dist/src/internal/bundler/authored-plugins.js +1 -1
- package/dist/src/internal/bundler/extension-mount-plugin.js +1 -1
- package/dist/src/internal/bundler/extension-scope-plugin.js +1 -1
- package/dist/src/internal/bundler/pseudo-packages.js +1 -1
- package/dist/src/internal/bundler/rolldown.js +1 -1
- package/dist/src/internal/bundler/vendored-dependency-log.js +1 -1
- package/dist/src/internal/classify-model-routing.js +1 -1
- package/dist/src/internal/eve-project-root.js +1 -1
- package/dist/src/internal/external-resources-snapshot.js +1 -1
- package/dist/src/internal/external-resources.js +1 -1
- package/dist/src/internal/gateway.js +1 -1
- package/dist/src/internal/helpers/frontmatter.js +1 -1
- package/dist/src/internal/helpers/markdown.js +1 -1
- package/dist/src/internal/host-traced-dependencies.js +1 -1
- package/dist/src/internal/http/basic-auth.js +1 -1
- package/dist/src/internal/installed-packages.js +1 -1
- package/dist/src/internal/instrumentation-layout.js +1 -1
- package/dist/src/internal/instrumentation.js +1 -1
- package/dist/src/internal/invocation/attributes.js +1 -1
- package/dist/src/internal/invocation/workflow-execution.js +1 -1
- package/dist/src/internal/logging.js +1 -1
- package/dist/src/internal/materialized-authored-modules.js +1 -1
- package/dist/src/internal/mcp/forwarded-principal-header.js +1 -1
- package/dist/src/internal/mcp/http-security.js +1 -1
- package/dist/src/internal/mcp/published-tools.js +1 -1
- package/dist/src/internal/mcp/request-trace-context.js +1 -1
- package/dist/src/internal/mcp/skills.js +1 -1
- package/dist/src/internal/mcp/streamable-http-server.js +1 -1
- package/dist/src/internal/model-auth/api-key.js +1 -1
- package/dist/src/internal/model-auth/available-models.js +1 -1
- package/dist/src/internal/model-auth/development-broker-protocol.js +1 -1
- package/dist/src/internal/model-auth/development-broker-server.js +1 -1
- package/dist/src/internal/model-auth/store.js +1 -1
- package/dist/src/internal/model-auth/transport.js +1 -1
- package/dist/src/internal/model-auth/vercel-cli.js +1 -1
- package/dist/src/internal/model-auth/vercel-team.js +1 -1
- package/dist/src/internal/model-auth/vercel.js +1 -1
- package/dist/src/internal/model-catalog.js +1 -1
- package/dist/src/internal/nitro/dev-client-address.js +1 -1
- package/dist/src/internal/nitro/dev-runtime-artifacts-retention.js +1 -1
- package/dist/src/internal/nitro/dev-runtime-artifacts.js +1 -1
- package/dist/src/internal/nitro/dev-runtime-source-snapshot-local-roots.js +1 -1
- package/dist/src/internal/nitro/dev-runtime-source-snapshot.js +1 -1
- package/dist/src/internal/nitro/development-generation.js +1 -1
- package/dist/src/internal/nitro/host/build-application.js +1 -1
- package/dist/src/internal/nitro/host/build-deployment-id.js +1 -1
- package/dist/src/internal/nitro/host/build-extension.js +2 -2
- package/dist/src/internal/nitro/host/copy-host-middleware.js +1 -1
- package/dist/src/internal/nitro/host/create-host-nitro.js +1 -1
- 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.js +1 -1
- package/dist/src/internal/nitro/host/dev-host-candidate.js +1 -1
- package/dist/src/internal/nitro/host/dev-host-fingerprint.js +1 -1
- package/dist/src/internal/nitro/host/dev-host-supervisor.js +1 -1
- package/dist/src/internal/nitro/host/dev-host-workspace.js +1 -1
- package/dist/src/internal/nitro/host/dev-server-http.js +1 -1
- package/dist/src/internal/nitro/host/dev-server-url.js +1 -1
- package/dist/src/internal/nitro/host/dev-watcher-log.js +1 -1
- package/dist/src/internal/nitro/host/dev-workflow-world-setup.js +1 -1
- package/dist/src/internal/nitro/host/dispatch-schedule-in-dev.js +1 -1
- package/dist/src/internal/nitro/host/extension-build-config.js +1 -1
- package/dist/src/internal/nitro/host/extension-declarations.js +2 -2
- package/dist/src/internal/nitro/host/extension-distribution.js +1 -1
- package/dist/src/internal/nitro/host/extension-external-dependencies.js +1 -1
- package/dist/src/internal/nitro/host/extension-state-usage.js +1 -1
- package/dist/src/internal/nitro/host/external-dependency-output-check.js +2 -2
- package/dist/src/internal/nitro/host/externals-policy.js +1 -1
- package/dist/src/internal/nitro/host/host-plugins.js +1 -1
- package/dist/src/internal/nitro/host/host-routes.js +1 -1
- package/dist/src/internal/nitro/host/host-spec.js +1 -1
- package/dist/src/internal/nitro/host/hosted-graph-plugin.js +1 -1
- package/dist/src/internal/nitro/host/instrumentation-entry.js +1 -1
- package/dist/src/internal/nitro/host/local-schedules-runtime-plugin.js +1 -1
- package/dist/src/internal/nitro/host/normalize-vercel-service-crons.js +1 -1
- package/dist/src/internal/nitro/host/ports.js +1 -1
- package/dist/src/internal/nitro/host/prepare-application-host.js +1 -1
- package/dist/src/internal/nitro/host/route-handlers.js +3 -3
- package/dist/src/internal/nitro/host/sandbox-shutdown-plugin.js +1 -1
- package/dist/src/internal/nitro/host/skill-files-plugin.js +1 -1
- package/dist/src/internal/nitro/host/stage-build-deployment-id.js +1 -1
- package/dist/src/internal/nitro/host/start-development-server.js +1 -1
- package/dist/src/internal/nitro/host/start-production-server.js +2 -2
- package/dist/src/internal/nitro/host/vercel-build-output-config.js +1 -1
- package/dist/src/internal/nitro/host/vercel-output.js +1 -1
- package/dist/src/internal/nitro/host/workspace-extensions.js +1 -1
- package/dist/src/internal/nitro/routes/agent-info/build-agent-info-response.js +1 -1
- package/dist/src/internal/nitro/routes/channel-dispatch.js +1 -1
- package/dist/src/internal/nitro/routes/channel-request-instrumentation.js +1 -1
- package/dist/src/internal/nitro/routes/channel-route-context.js +1 -1
- package/dist/src/internal/nitro/routes/connection-events.js +1 -1
- package/dist/src/internal/nitro/routes/index.js +3 -3
- package/dist/src/internal/nitro/routes/info.js +1 -1
- package/dist/src/internal/nitro/routes/route-invoke-tool.js +1 -1
- package/dist/src/internal/nitro/routes/runtime-stack.js +1 -1
- package/dist/src/internal/nitro/routes/schedule-collection-consumer.js +1 -1
- package/dist/src/internal/nitro/routes/schedule-task.js +1 -1
- package/dist/src/internal/node-esm-compat-banner.js +2 -2
- package/dist/src/internal/project-context.js +1 -1
- package/dist/src/internal/resolve-model-endpoint-status.js +1 -1
- package/dist/src/internal/runtime-registry.js +1 -1
- package/dist/src/internal/schedules/consumer-route.js +1 -1
- package/dist/src/internal/schedules/verify-delivery.js +1 -1
- package/dist/src/internal/vercel/assemble-eve-services.js +1 -1
- package/dist/src/internal/vercel/build-agent-workspace.js +1 -1
- package/dist/src/internal/vercel/eve-service-contribution.js +1 -1
- package/dist/src/internal/vercel/project-link.js +1 -1
- package/dist/src/internal/vercel/vercel-service-config-operations.d.ts +1 -1
- package/dist/src/internal/vercel/vercel-service-config-operations.js +1 -1
- package/dist/src/internal/vercel/vercel-service-name.js +1 -1
- package/dist/src/internal/vercel/vercel-services-config.js +1 -1
- package/dist/src/internal/vercel-agent-summary.d.ts +3 -0
- package/dist/src/internal/vercel-agent-summary.js +1 -1
- package/dist/src/internal/workflow/builtins.js +1 -1
- package/dist/src/internal/workflow/development-world-client.js +1 -1
- package/dist/src/internal/workflow/development-world-codec.js +1 -1
- package/dist/src/internal/workflow/development-world-protocol.js +1 -1
- package/dist/src/internal/workflow/development-world-server.js +1 -1
- package/dist/src/internal/workflow/local-world-delivery-auth.js +1 -1
- package/dist/src/internal/workflow/owner-deployment-deleted.d.ts +9 -0
- package/dist/src/internal/workflow/owner-deployment-deleted.js +1 -0
- package/dist/src/internal/workflow/start-claim.js +1 -1
- package/dist/src/internal/workflow/world-compatibility.js +1 -1
- package/dist/src/internal/workflow-bundle/authored-workflow-directives.js +1 -1
- package/dist/src/internal/workflow-bundle/builder-support.d.ts +9 -1
- package/dist/src/internal/workflow-bundle/builder-support.js +6 -7
- package/dist/src/internal/workflow-bundle/builder.js +2 -2
- package/dist/src/internal/workflow-bundle/nitro-step-entry.js +2 -2
- package/dist/src/internal/workflow-bundle/stable-module-id.js +1 -1
- package/dist/src/internal/workflow-bundle/workflow-builders.js +1 -1
- package/dist/src/internal/workflow-bundle/workflow-core-shim.js +1 -1
- package/dist/src/internal/workflow-bundle/workflow-directive-ast.js +1 -1
- package/dist/src/internal/workflow-bundle/workflow-transformer.js +4 -4
- package/dist/src/memory/definition.d.ts +14 -0
- package/dist/src/memory/definition.js +1 -1
- package/dist/src/models/auto.js +2 -2
- package/dist/src/protocol/baggage.js +1 -1
- package/dist/src/protocol/catalog-tools.js +1 -1
- package/dist/src/protocol/descendant-observation.js +1 -1
- package/dist/src/protocol/interaction-json.d.ts +1 -0
- package/dist/src/protocol/interaction-options.js +1 -1
- package/dist/src/protocol/remote-agent-protocol.js +1 -1
- package/dist/src/protocol/routes.d.ts +9 -0
- package/dist/src/protocol/routes.js +1 -1
- package/dist/src/protocol/session-events/catalog.js +1 -1
- package/dist/src/protocol/session-events/checker.js +1 -1
- package/dist/src/protocol/session-events/common.js +1 -1
- package/dist/src/protocol/session-events/envelope.js +1 -1
- package/dist/src/protocol/session-events/families/call.d.ts +5 -0
- package/dist/src/protocol/session-events/families/call.js +1 -1
- package/dist/src/protocol/session-events/families/content.js +1 -1
- package/dist/src/protocol/session-events/families/delivery.js +1 -1
- package/dist/src/protocol/session-events/families/interaction.d.ts +6 -0
- package/dist/src/protocol/session-events/families/interaction.js +1 -1
- package/dist/src/protocol/session-events/families/model.js +1 -1
- package/dist/src/protocol/session-events/families/session.js +1 -1
- package/dist/src/protocol/session-events/schemas.js +1 -1
- package/dist/src/protocol/session-http.js +1 -1
- package/dist/src/protocol/session-lines.js +1 -1
- package/dist/src/protocol/session-projection/fold.js +1 -1
- package/dist/src/protocol/session-projection/observations.d.ts +2 -0
- package/dist/src/protocol/session-projection/public-view.d.ts +1 -0
- package/dist/src/protocol/session-projection/public-view.js +1 -1
- package/dist/src/protocol/session-projection/reader.js +1 -1
- package/dist/src/protocol/session-projection/selectors.d.ts +6 -0
- package/dist/src/protocol/session-projection/selectors.js +2 -2
- package/dist/src/protocol/session-projection/session-view.js +1 -1
- package/dist/src/protocol/session-projection/tree.js +1 -1
- package/dist/src/protocol/session-projection.js +1 -1
- package/dist/src/protocol/task-tools.js +1 -1
- package/dist/src/protocol/traceparent.js +1 -1
- package/dist/src/protocol/v26-interactions.js +1 -1
- package/dist/src/public/channels/chat-sdk/attachment-refs.js +1 -1
- package/dist/src/public/channels/chat-sdk/chatSdkChannel.js +1 -1
- package/dist/src/public/channels/chat-sdk/input-actions.d.ts +3 -2
- package/dist/src/public/channels/chat-sdk/input-actions.js +2 -2
- package/dist/src/public/channels/chat-sdk/reply-context.js +1 -1
- package/dist/src/public/channels/discord/api.js +1 -1
- package/dist/src/public/channels/discord/authorization.js +2 -2
- package/dist/src/public/channels/discord/defaults.js +1 -1
- package/dist/src/public/channels/discord/discordChannel.js +1 -1
- package/dist/src/public/channels/discord/gateway/connection.js +1 -1
- package/dist/src/public/channels/discord/gateway/forwarder.js +1 -1
- package/dist/src/public/channels/discord/gateway/relay.js +1 -1
- package/dist/src/public/channels/discord/hitl.js +1 -1
- package/dist/src/public/channels/discord/inbound.js +2 -2
- package/dist/src/public/channels/discord/messages.js +2 -2
- package/dist/src/public/channels/discord/verify.js +1 -1
- package/dist/src/public/channels/github/api.js +1 -1
- package/dist/src/public/channels/github/auth.js +2 -2
- package/dist/src/public/channels/github/binding.js +1 -1
- package/dist/src/public/channels/github/checkout.js +1 -1
- package/dist/src/public/channels/github/defaults.js +1 -1
- package/dist/src/public/channels/github/dispatch.js +1 -1
- package/dist/src/public/channels/github/githubChannel.js +1 -1
- package/dist/src/public/channels/github/inbound.js +2 -2
- package/dist/src/public/channels/github/limits.js +1 -1
- package/dist/src/public/channels/github/pr-context.js +2 -2
- package/dist/src/public/channels/github/state.js +1 -1
- package/dist/src/public/channels/github/verify.js +1 -1
- package/dist/src/public/channels/imessage-tapbacks.js +1 -1
- package/dist/src/public/channels/linear/api.js +3 -3
- package/dist/src/public/channels/linear/defaults.js +1 -1
- package/dist/src/public/channels/linear/inbound-uploads.js +1 -1
- package/dist/src/public/channels/linear/inbound.js +2 -2
- package/dist/src/public/channels/linear/linearChannel.js +1 -1
- package/dist/src/public/channels/linear/verify.js +1 -1
- package/dist/src/public/channels/linq/linqChannel.js +1 -1
- package/dist/src/public/channels/mcp.js +1 -1
- package/dist/src/public/channels/photon/attachments.js +1 -1
- package/dist/src/public/channels/photon/inboundContent.js +1 -1
- package/dist/src/public/channels/photon/photonIMessageChannel.js +1 -1
- package/dist/src/public/channels/reply.js +1 -1
- package/dist/src/public/channels/slack/answers.js +1 -1
- package/dist/src/public/channels/slack/api.js +1 -1
- package/dist/src/public/channels/slack/app-manifest.js +1 -1
- package/dist/src/public/channels/slack/attachments.js +1 -1
- package/dist/src/public/channels/slack/auth.d.ts +2 -0
- package/dist/src/public/channels/slack/auth.js +1 -1
- package/dist/src/public/channels/slack/cards.js +1 -1
- package/dist/src/public/channels/slack/code-channel.js +1 -1
- package/dist/src/public/channels/slack/connections.d.ts +5 -0
- package/dist/src/public/channels/slack/connections.js +1 -1
- package/dist/src/public/channels/slack/defaults.d.ts +3 -0
- package/dist/src/public/channels/slack/defaults.js +4 -4
- package/dist/src/public/channels/slack/hitl.js +2 -2
- package/dist/src/public/channels/slack/inbound-content.js +2 -2
- package/dist/src/public/channels/slack/inbound.d.ts +7 -0
- package/dist/src/public/channels/slack/inbound.js +1 -1
- package/dist/src/public/channels/slack/interaction-cards.js +1 -1
- package/dist/src/public/channels/slack/interactions.js +1 -1
- package/dist/src/public/channels/slack/limits.js +1 -1
- package/dist/src/public/channels/slack/model-context.js +3 -3
- package/dist/src/public/channels/slack/mrkdwn.js +1 -1
- package/dist/src/public/channels/slack/private-approval-delivery.js +1 -1
- package/dist/src/public/channels/slack/renderers.js +1 -1
- package/dist/src/public/channels/slack/reply-delivery.js +1 -1
- package/dist/src/public/channels/slack/request-card-render.d.ts +7 -1
- package/dist/src/public/channels/slack/request-card-render.js +1 -1
- package/dist/src/public/channels/slack/request-cards.js +3 -3
- package/dist/src/public/channels/slack/session-operations.js +1 -1
- package/dist/src/public/channels/slack/sign-in-cancel.js +1 -1
- package/dist/src/public/channels/slack/slackChannel.js +1 -1
- package/dist/src/public/channels/slack/slash-command.js +1 -1
- package/dist/src/public/channels/slack/task-card.js +1 -1
- package/dist/src/public/channels/slack/thread-status.js +1 -1
- package/dist/src/public/channels/slack/transport.js +1 -1
- package/dist/src/public/channels/slack/user-info.js +1 -1
- package/dist/src/public/channels/teams/api.js +1 -1
- package/dist/src/public/channels/teams/attachments.js +1 -1
- package/dist/src/public/channels/teams/authorization.js +1 -1
- package/dist/src/public/channels/teams/defaults.js +1 -1
- package/dist/src/public/channels/teams/hitl.d.ts +2 -0
- package/dist/src/public/channels/teams/hitl.js +1 -1
- package/dist/src/public/channels/teams/inbound.js +2 -2
- package/dist/src/public/channels/teams/limits.js +1 -1
- package/dist/src/public/channels/teams/teamsChannel.js +1 -1
- package/dist/src/public/channels/teams/verify.js +1 -1
- package/dist/src/public/channels/telegram/api.js +2 -2
- package/dist/src/public/channels/telegram/attachments.js +1 -1
- package/dist/src/public/channels/telegram/defaults.js +1 -1
- package/dist/src/public/channels/telegram/hitl.d.ts +3 -3
- package/dist/src/public/channels/telegram/hitl.js +2 -2
- package/dist/src/public/channels/telegram/inbound.js +1 -1
- package/dist/src/public/channels/telegram/state.d.ts +3 -1
- package/dist/src/public/channels/telegram/state.js +1 -1
- package/dist/src/public/channels/telegram/telegramChannel.js +1 -1
- package/dist/src/public/channels/telegram/verify.js +1 -1
- package/dist/src/public/channels/twilio/api.js +1 -1
- package/dist/src/public/channels/twilio/twilioChannel.js +1 -1
- package/dist/src/public/channels/upload-policy.js +1 -1
- package/dist/src/public/definitions/agent.js +1 -1
- package/dist/src/public/definitions/channel.js +1 -1
- package/dist/src/public/definitions/extension.js +1 -1
- package/dist/src/public/definitions/hook.js +1 -1
- package/dist/src/public/definitions/sandbox.js +1 -1
- package/dist/src/public/definitions/state.js +1 -1
- package/dist/src/public/definitions/workspace-agent.js +1 -1
- package/dist/src/public/events/index.d.ts +1 -1
- package/dist/src/public/events/index.js +1 -1
- package/dist/src/public/experimental/schedules/client.js +1 -1
- package/dist/src/public/memory/file/backends/default.js +1 -1
- package/dist/src/public/memory/file/backends/in-memory.js +1 -1
- package/dist/src/public/memory/file/backends/lazy.js +1 -1
- package/dist/src/public/memory/file/backends/vercel-blob.js +1 -1
- package/dist/src/public/memory/file/provider.js +2 -2
- package/dist/src/public/memory/index.js +1 -1
- package/dist/src/public/models/openai/chatgpt/auth.js +1 -1
- package/dist/src/public/models/openai/chatgpt/codex-app-server.js +1 -1
- package/dist/src/public/models/openai/chatgpt/credential-store.js +1 -1
- package/dist/src/public/models/openai/chatgpt/model.js +1 -1
- package/dist/src/public/models/openai/chatgpt/oauth.js +1 -1
- package/dist/src/public/models/openai/chatgpt/token-broker.js +1 -1
- package/dist/src/public/models/openai/chatgpt/transport.js +1 -1
- package/dist/src/public/next/index.d.ts +4 -1
- package/dist/src/public/next/index.js +1 -1
- package/dist/src/public/next/server.js +1 -1
- package/dist/src/public/next/vercel-output-config.js +1 -1
- package/dist/src/public/nuxt/module.d.ts +12 -14
- package/dist/src/public/nuxt/module.js +1 -1
- package/dist/src/public/nuxt/production-origin.d.ts +12 -0
- package/dist/src/public/nuxt/production-origin.js +1 -0
- package/dist/src/public/sandbox/vercel-sandbox.d.ts +6 -5
- package/dist/src/public/schedules/providers/in-memory.js +1 -1
- package/dist/src/public/schedules/providers/vercel.js +1 -1
- package/dist/src/public/sveltekit/index.d.ts +10 -18
- package/dist/src/public/sveltekit/index.js +1 -1
- package/dist/src/public/tanstack/index.d.ts +12 -28
- package/dist/src/public/tanstack/index.js +1 -1
- package/dist/src/public/tools/agent.js +2 -2
- package/dist/src/public/vercel/index.js +1 -1
- package/dist/src/public/vite/index.d.ts +22 -0
- package/dist/src/public/vite/index.js +1 -0
- package/dist/src/public/workflow/api.js +1 -1
- package/dist/src/public/workflow/index.js +1 -1
- package/dist/src/react/use-eve-agent.js +1 -1
- package/dist/src/runtime/actions/results.js +1 -1
- package/dist/src/runtime/agent/bootstrap.js +1 -1
- package/dist/src/runtime/agent/mock-model-adapter.js +3 -3
- package/dist/src/runtime/agent/mock-model-fixtures.js +3 -3
- package/dist/src/runtime/agent/mock-model-skill-selection.js +1 -1
- package/dist/src/runtime/agent/mock-structured-output.js +1 -1
- package/dist/src/runtime/agent/resolve-model.js +1 -1
- package/dist/src/runtime/authorization-context.js +1 -1
- package/dist/src/runtime/cache-key.js +1 -1
- package/dist/src/runtime/channels/registry.js +1 -1
- package/dist/src/runtime/connections/approval-scope.js +1 -1
- package/dist/src/runtime/connections/authorization-complete-page.js +1 -1
- package/dist/src/runtime/connections/authorization-tokens.js +1 -1
- package/dist/src/runtime/connections/events/actions.js +1 -1
- package/dist/src/runtime/connections/events/dispatch-step.js +1 -1
- package/dist/src/runtime/connections/events/lifecycle-step.js +1 -1
- package/dist/src/runtime/connections/events/owner.js +1 -1
- package/dist/src/runtime/connections/events/workflow.js +1 -1
- package/dist/src/runtime/connections/mcp-client.js +1 -1
- package/dist/src/runtime/connections/openapi-client.js +1 -1
- package/dist/src/runtime/connections/openapi-operations.js +1 -1
- package/dist/src/runtime/connections/openapi-schema.js +1 -1
- package/dist/src/runtime/connections/openapi-security.js +1 -1
- package/dist/src/runtime/connections/openapi-spec.js +1 -1
- package/dist/src/runtime/connections/provided-arguments.js +1 -1
- package/dist/src/runtime/connections/registry.js +1 -1
- package/dist/src/runtime/connections/resolve-authorization.js +1 -1
- package/dist/src/runtime/connections/scoped-authorization.d.ts +2 -0
- package/dist/src/runtime/connections/scoped-authorization.js +1 -1
- package/dist/src/runtime/connections/tool-result.js +2 -2
- package/dist/src/runtime/loaders/artifact-paths.js +1 -1
- package/dist/src/runtime/loaders/compile-metadata.js +1 -1
- package/dist/src/runtime/loaders/manifest.d.ts +1 -1
- package/dist/src/runtime/loaders/manifest.js +1 -1
- package/dist/src/runtime/local-dev-capability.js +1 -1
- package/dist/src/runtime/prompt/compose.js +1 -1
- package/dist/src/runtime/resolve-agent-graph.js +1 -1
- package/dist/src/runtime/resolve-agent.js +1 -1
- package/dist/src/runtime/resolve-channel.js +1 -1
- package/dist/src/runtime/resolve-connection.js +1 -1
- package/dist/src/runtime/resolve-definition.js +1 -1
- package/dist/src/runtime/resolve-helpers.js +1 -1
- package/dist/src/runtime/resolve-sandbox.js +1 -1
- package/dist/src/runtime/resolve-tool.js +1 -1
- package/dist/src/runtime/sandbox/prepared-artifacts.js +1 -1
- package/dist/src/runtime/schedules/collection-client.js +1 -1
- package/dist/src/runtime/schedules/dispatch-occurrence.js +1 -1
- package/dist/src/runtime/schedules/payload.js +1 -1
- package/dist/src/runtime/schedules/resolve-schedule.js +1 -1
- package/dist/src/runtime/schedules/validation.js +1 -1
- package/dist/src/runtime/sessions/compiled-agent-cache.js +1 -1
- package/dist/src/runtime/sessions/runtime-context-keys.js +1 -1
- package/dist/src/runtime/sessions/runtime-session.js +1 -1
- package/dist/src/runtime/subagents/dynamic-remote-agent-config.js +1 -1
- package/dist/src/runtime/subagents/registry.js +1 -1
- package/dist/src/runtime/subagents/workflow-reference.js +1 -1
- package/dist/src/runtime/subagents/workflow.js +1 -1
- package/dist/src/runtime/tools/registry.js +1 -1
- package/dist/src/runtime/types.d.ts +1 -1
- package/dist/src/runtime/workspace/seed-files.js +1 -1
- package/dist/src/sandbox/providers/default.js +1 -1
- package/dist/src/sandbox/providers/docker.js +1 -1
- package/dist/src/self-modification/deployed-sandbox.js +1 -1
- package/dist/src/self-modification/extension/eve-add.js +2 -2
- package/dist/src/self-modification/extension/subagents/agent/agent.js +1 -1
- package/dist/src/self-modification/extension/subagents/agent/tools/edit_file.js +1 -1
- package/dist/src/self-modification/extension/subagents/agent/tools/inspect_trace.js +1 -1
- package/dist/src/self-modification/extension/subagents/agent/tools/inspect_trace_spans.js +1 -1
- package/dist/src/self-modification/extension/subagents/agent/tools/registry_add.js +1 -1
- package/dist/src/self-modification/extension/subagents/agent/tools/search_models.js +1 -1
- package/dist/src/self-modification/extension/subagents/agent/tools/search_registry.js +1 -1
- package/dist/src/self-modification/extension/subagents/agent/tools/search_traces.js +1 -1
- package/dist/src/self-modification/extension/trace-inspection.js +1 -1
- package/dist/src/self-modification/filesystem.js +1 -1
- package/dist/src/self-modification/git-workspace.js +1 -1
- package/dist/src/self-modification/git.js +1 -1
- package/dist/src/self-modification/github-publisher.js +2 -2
- package/dist/src/self-modification/proposal.js +1 -1
- package/dist/src/self-modification/remote/config.js +1 -1
- package/dist/src/self-modification/remote/production-registry-add.js +1 -1
- package/dist/src/self-modification/remote/subagents/agent/agent.js +1 -1
- package/dist/src/self-modification/remote/subagents/agent/tools/publish.js +1 -1
- package/dist/src/self-modification/remote/subagents/agent/tools/registry_add.js +1 -1
- package/dist/src/self-modification/setup.js +3 -3
- package/dist/src/self-modification/subagent-guidance.js +7 -7
- package/dist/src/self-modification/workspace-lock.js +1 -1
- package/dist/src/services/dev-client/agent-info-probe.js +1 -1
- package/dist/src/services/dev-client/client-options.js +1 -1
- package/dist/src/services/dev-client/credential-gate.js +1 -1
- package/dist/src/services/dev-client/request-headers.js +1 -1
- package/dist/src/services/dev-client/runtime-artifacts.js +1 -1
- package/dist/src/services/dev-client/vercel-auth-error.js +3 -3
- package/dist/src/setup/ai-gateway-api-key.js +1 -1
- package/dist/src/setup/append-env.js +1 -1
- package/dist/src/setup/ask-editable.js +1 -1
- package/dist/src/setup/ask-signals.js +1 -1
- package/dist/src/setup/ask.js +1 -1
- package/dist/src/setup/boxes/apply-ai-gateway-credential.js +1 -1
- package/dist/src/setup/boxes/deploy-project.js +1 -1
- package/dist/src/setup/boxes/link-project.js +1 -1
- package/dist/src/setup/boxes/model-capabilities.js +1 -1
- package/dist/src/setup/boxes/resolve-provisioning.js +1 -1
- package/dist/src/setup/boxes/select-model.js +1 -1
- package/dist/src/setup/cli/option-row.js +1 -1
- package/dist/src/setup/cli/prompt-ui.js +3 -3
- package/dist/src/setup/cli/rail-log.js +2 -2
- package/dist/src/setup/cli/select-component.js +1 -1
- package/dist/src/setup/cli/select-option-codec.js +1 -1
- package/dist/src/setup/cli/select-state.js +1 -1
- package/dist/src/setup/cli/whimsy.js +1 -1
- package/dist/src/setup/connect-provisioning.js +1 -1
- package/dist/src/setup/connection-connector.js +2 -2
- package/dist/src/setup/flows/chatgpt-auth.js +1 -1
- package/dist/src/setup/flows/deploy.js +1 -1
- package/dist/src/setup/flows/ensure-vercel-project.js +1 -1
- package/dist/src/setup/flows/install-vercel-cli.js +1 -1
- package/dist/src/setup/flows/link.js +1 -1
- package/dist/src/setup/flows/login.js +1 -1
- package/dist/src/setup/flows/model-login-connection.js +1 -1
- package/dist/src/setup/flows/model-login-options.js +1 -1
- package/dist/src/setup/flows/model-login.js +1 -1
- package/dist/src/setup/flows/model-source-change.js +1 -1
- package/dist/src/setup/flows/model.js +1 -1
- package/dist/src/setup/flows/registry-session.js +1 -1
- package/dist/src/setup/flows/registry.js +1 -1
- package/dist/src/setup/flows/vercel-model-login.js +1 -1
- package/dist/src/setup/integrations/discord/connect.js +1 -1
- package/dist/src/setup/integrations/discord/daemon.js +1 -1
- package/dist/src/setup/integrations/discord/setup.js +1 -1
- package/dist/src/setup/integrations/file-memory/setup.js +1 -1
- package/dist/src/setup/integrations/file-memory/vercel.js +1 -1
- package/dist/src/setup/integrations/github/connect.js +1 -1
- package/dist/src/setup/integrations/github/setup.js +2 -2
- package/dist/src/setup/integrations/linear/connect.js +1 -1
- package/dist/src/setup/integrations/linear/setup.js +1 -1
- package/dist/src/setup/integrations/linq/connect.js +1 -1
- package/dist/src/setup/integrations/linq/management.js +1 -1
- package/dist/src/setup/integrations/linq/setup.js +1 -1
- package/dist/src/setup/integrations/photon/connect.js +1 -1
- package/dist/src/setup/integrations/photon/management.js +1 -1
- package/dist/src/setup/integrations/photon/setup-flow.js +1 -1
- package/dist/src/setup/integrations/runner.js +1 -1
- package/dist/src/setup/integrations/self-modification/setup.js +1 -1
- package/dist/src/setup/integrations/shared/scaffold.js +1 -1
- package/dist/src/setup/integrations/shared/ui.js +1 -1
- package/dist/src/setup/integrations/slack/setup.js +1 -1
- package/dist/src/setup/integrations/teams/connect.js +1 -1
- package/dist/src/setup/integrations/teams/setup.js +1 -1
- package/dist/src/setup/integrations/telegram/connect.js +1 -1
- package/dist/src/setup/integrations/telegram/management.js +1 -1
- package/dist/src/setup/integrations/telegram/setup.js +2 -2
- package/dist/src/setup/integrations/web/auth-options.js +1 -1
- package/dist/src/setup/integrations/web/auth-scaffold.js +1 -1
- package/dist/src/setup/integrations/web/framework.js +1 -1
- package/dist/src/setup/integrations/web/hosting.js +2 -2
- package/dist/src/setup/integrations/web/provision-auth.js +1 -1
- package/dist/src/setup/integrations/web/setup.js +4 -4
- package/dist/src/setup/node-engine.js +1 -1
- package/dist/src/setup/primitives/pm/pnpm-build-policy.js +3 -3
- package/dist/src/setup/primitives/pm/pnpm.js +8 -8
- package/dist/src/setup/primitives/pm/process-result.js +1 -1
- package/dist/src/setup/primitives/pm/run.js +1 -1
- package/dist/src/setup/primitives/pm/shared.js +1 -1
- package/dist/src/setup/primitives/process-abort.js +1 -1
- package/dist/src/setup/primitives/run-vercel.js +1 -1
- package/dist/src/setup/project-name.js +1 -1
- package/dist/src/setup/prompter.js +1 -1
- package/dist/src/setup/registry-setup-client.js +1 -1
- package/dist/src/setup/runner.js +1 -1
- package/dist/src/setup/scaffold/channels-catalog.js +1 -1
- package/dist/src/setup/scaffold/connections/catalog.js +1 -1
- package/dist/src/setup/scaffold/create/add-to-project.js +1 -1
- package/dist/src/setup/scaffold/create/extension.js +1 -1
- package/dist/src/setup/scaffold/create/project.js +4 -4
- package/dist/src/setup/scaffold/create/web-template.js +4 -4
- package/dist/src/setup/scaffold/create-in-place.js +1 -1
- package/dist/src/setup/scaffold/update/channels.js +3 -3
- package/dist/src/setup/scaffold/update/connections.js +3 -3
- package/dist/src/setup/scaffold/update/dependencies.js +1 -1
- package/dist/src/setup/scaffold/update/package-json.js +1 -1
- package/dist/src/setup/scaffold/update/update-connection-connector.js +1 -1
- package/dist/src/setup/scaffold/version-tokens.js +1 -1
- package/dist/src/setup/scaffold/workspace-glob.js +1 -1
- package/dist/src/setup/scaffold/workspace-root.js +1 -1
- package/dist/src/setup/setup-question-wire.js +1 -1
- package/dist/src/setup/slack-connect-create.js +1 -1
- package/dist/src/setup/slack-connect-lifecycle.js +1 -1
- package/dist/src/setup/slack-connect.js +1 -1
- package/dist/src/setup/slack-setup-plan.js +1 -1
- package/dist/src/setup/slackbot.js +2 -2
- package/dist/src/setup/validate-gateway-key.js +1 -1
- package/dist/src/setup/vercel-deployment.js +1 -1
- package/dist/src/setup/vercel-project-api.js +1 -1
- package/dist/src/setup/vercel-project-framework.js +1 -1
- package/dist/src/setup/vercel-project.js +0 -0
- package/dist/src/setup/verified-remote-agent.js +1 -1
- package/dist/src/setup/verified-remote-client.js +1 -1
- package/dist/src/setup/with-spinner.js +1 -1
- package/dist/src/shared/action-types.js +1 -1
- package/dist/src/shared/agent-turn-outcome.js +1 -1
- package/dist/src/shared/built-server-start-failure.js +1 -1
- package/dist/src/shared/chatgpt-model.js +1 -1
- package/dist/src/shared/conversation-context.js +1 -1
- package/dist/src/shared/conversation-identity.js +1 -1
- package/dist/src/shared/default-agent-model.js +1 -1
- package/dist/src/shared/errors.js +1 -1
- package/dist/src/shared/eve-route-path.js +1 -1
- package/dist/src/shared/format-duration.js +1 -1
- package/dist/src/shared/forwarded-trace-policy.js +1 -1
- package/dist/src/shared/framework-eve-integration.d.ts +33 -0
- package/dist/src/shared/framework-eve-integration.js +1 -0
- package/dist/src/shared/framework-eve-server.js +2 -2
- package/dist/src/shared/gateway-model-catalog.js +1 -1
- package/dist/src/shared/gateway-routing.js +1 -1
- package/dist/src/shared/json-schemas.js +1 -1
- package/dist/src/shared/json.js +1 -1
- package/dist/src/shared/line-diff.js +1 -1
- package/dist/src/shared/map-concurrent.js +1 -1
- package/dist/src/shared/map-with-concurrency.js +1 -1
- package/dist/src/shared/memory-state.js +1 -1
- package/dist/src/shared/model-helper.js +1 -1
- package/dist/src/shared/network-address.js +1 -1
- package/dist/src/shared/read-optional-file.d.ts +2 -0
- package/dist/src/shared/read-optional-file.js +1 -0
- package/dist/src/shared/sandbox-environment.js +1 -1
- package/dist/src/shared/sandbox-network-policy.js +1 -1
- package/dist/src/shared/sandbox-prepared-artifacts.js +1 -1
- package/dist/src/shared/schedule-collection-definition.js +1 -1
- package/dist/src/shared/session-history.js +1 -1
- package/dist/src/shared/skill-paths.js +1 -1
- package/dist/src/shared/ulid.js +1 -1
- package/dist/src/shared/validate-authorization.js +1 -1
- package/dist/src/shared/value-delta.js +1 -1
- package/dist/src/shared/vercel-project.js +1 -1
- package/dist/src/shared/vite-eve-plugin.d.ts +59 -0
- package/dist/src/shared/vite-eve-plugin.js +1 -0
- package/dist/src/shared/wait-with-signal.js +1 -1
- package/dist/src/shared/web-search.js +1 -1
- package/dist/src/source-change/agent-config-string-path.js +2 -2
- package/dist/src/source-change/apply-agent-model-settings.js +1 -1
- package/dist/src/source-change/apply-model-selection.js +1 -1
- package/dist/src/source-change/static-source-change.js +1 -1
- package/dist/src/subagents/adapter.js +1 -1
- package/dist/src/subagents/callback-route.js +1 -1
- package/dist/src/subagents/event-proxy-step.d.ts +19 -0
- package/dist/src/subagents/event-proxy-step.js +1 -1
- package/dist/src/subagents/hitl-proxy.js +1 -1
- package/dist/src/subagents/parent-notification.js +1 -1
- package/dist/src/subagents/protocol-two-callback.js +1 -1
- package/dist/src/subagents/remote-route-url.js +1 -1
- package/dist/src/subagents/tool.js +1 -1
- package/dist/src/svelte/index.js +1 -1
- package/dist/src/svelte/use-eve-agent.js +1 -1
- package/dist/src/tool-stubs/execute.js +1 -1
- package/dist/src/tool-stubs/playback.js +1 -1
- package/dist/src/tool-stubs/rules.js +1 -1
- package/dist/src/tool-stubs/schema.js +1 -1
- package/dist/src/tool-stubs/types.js +1 -1
- package/dist/src/tools/approval/policies.js +1 -1
- package/dist/src/tools/definition.d.ts +7 -3
- package/dist/src/tools/dynamic.js +1 -1
- package/dist/src/tools/framework/agent-contract.js +1 -1
- 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/ask-question.js +1 -1
- package/dist/src/tools/provided/bash.js +1 -1
- package/dist/src/tools/provided/edit-file.js +4 -4
- 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 +2 -2
- package/dist/src/tools/provided/sleep-workflow.js +1 -1
- package/dist/src/tools/provided/sleep.js +1 -1
- package/dist/src/tools/provided/web-fetch.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/schema.js +1 -1
- package/dist/src/tools/signature.js +1 -1
- package/dist/src/tools/workflow-definition.js +1 -1
- package/dist/src/tracing/eve/agent-approval-instrumentation.js +1 -1
- package/dist/src/tracing/eve/agent-invocation-coordinator.js +1 -1
- package/dist/src/tracing/eve/agent-memory-instrumentation.d.ts +5 -0
- package/dist/src/tracing/eve/agent-memory-instrumentation.js +1 -1
- package/dist/src/tracing/eve/agent-otel-provider.d.ts +4 -2
- package/dist/src/tracing/eve/agent-otel-provider.js +1 -1
- package/dist/src/tracing/eve/agent-tool-instrumentation.js +1 -1
- package/dist/src/tracing/eve/agent-trace-context-store.js +1 -1
- package/dist/src/tracing/eve/batch-span-processor.js +1 -1
- package/dist/src/tracing/eve/connection-authorization.d.ts +11 -0
- package/dist/src/tracing/eve/connection-authorization.js +1 -0
- package/dist/src/tracing/eve/connection-events.js +1 -1
- package/dist/src/tracing/eve/content-span-processor.js +1 -1
- package/dist/src/tracing/eve/conversation-context.js +1 -1
- package/dist/src/tracing/eve/delegation.js +1 -1
- package/dist/src/tracing/eve/gateway.js +1 -1
- package/dist/src/tracing/eve/install-instrumentation-runtime.js +1 -1
- package/dist/src/tracing/eve/invoke-tool-span.js +1 -1
- package/dist/src/tracing/eve/mcp.js +1 -1
- package/dist/src/tracing/eve/metadata.js +1 -1
- package/dist/src/tracing/eve/otel-declaration.js +1 -1
- package/dist/src/tracing/eve/otel-registration.js +1 -1
- package/dist/src/tracing/eve/policy.js +1 -1
- package/dist/src/tracing/eve/session.d.ts +2 -1
- package/dist/src/tracing/eve/session.js +1 -1
- package/dist/src/tracing/eve/vercel-runtime-span-exporter.js +1 -1
- package/dist/src/tracing/local/agent-trace-span-processor.js +1 -1
- package/dist/src/tracing/local/inspection.js +1 -1
- package/dist/src/tracing/local/trace-analysis.js +1 -1
- package/dist/src/tracing/local/trace-discovery-index.js +1 -1
- package/dist/src/tracing/local/trace-operations.js +1 -1
- package/dist/src/tracing/local/trace-reader.js +1 -1
- package/dist/src/tracing/local/trace-retention.js +1 -1
- package/dist/src/tracing/local/trace-span-processor.js +1 -1
- package/dist/src/tracing/local/trace-summary.js +1 -1
- package/dist/src/tracing/local/traces.js +1 -1
- package/dist/src/vue/index.js +1 -1
- package/dist/src/vue/use-eve-agent.js +1 -1
- package/docs/README.md +1 -0
- package/docs/channels/chat-sdk/reference.mdx +1 -1
- package/docs/channels/slack/reference.mdx +24 -2
- package/docs/code-extension.mdx +3 -0
- package/docs/concepts/execution-model-and-durability.mdx +18 -6
- package/docs/concepts/sessions-runs-and-streaming.md +15 -15
- package/docs/connections/index.mdx +1 -1
- package/docs/extensions/index.md +1 -1
- package/docs/guides/deployment/index.md +15 -2
- package/docs/guides/frontend/index.mdx +2 -0
- package/docs/guides/frontend/meta.json +1 -1
- package/docs/guides/frontend/nextjs.mdx +1 -1
- package/docs/guides/frontend/nuxt.mdx +4 -4
- package/docs/guides/frontend/sveltekit.mdx +5 -5
- package/docs/guides/frontend/tanstack.mdx +4 -4
- package/docs/guides/frontend/vite.mdx +78 -0
- package/docs/guides/hooks.md +2 -0
- package/docs/guides/instrumentation/otel.mdx +14 -8
- package/docs/sandbox/vercel.mdx +4 -4
- package/docs/tools/human-in-the-loop.md +1 -1
- package/docs/tools/index.mdx +17 -1
- package/package.json +8 -3
- package/dist/src/compiled/_chunks/client/core-BBvrU4Ut.js +0 -52
- package/dist/src/compiled/_chunks/client/rolldown-runtime-DK3Fl9T5.js +0 -1
- package/dist/src/compiled/_chunks/workflow/mcp-LeXvhyIJ.js +0 -5
- package/dist/src/public/nuxt/routing.d.ts +0 -21
- package/dist/src/public/nuxt/routing.js +0 -1
- package/dist/src/public/sveltekit/dev-server.d.ts +0 -25
- package/dist/src/public/sveltekit/dev-server.js +0 -1
- package/dist/src/public/sveltekit/routing.d.ts +0 -4
- package/dist/src/public/sveltekit/routing.js +0 -1
- package/dist/src/shared/vercel-services.d.ts +0 -117
- package/dist/src/shared/vercel-services.js +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,33 +1,29 @@
|
|
|
1
|
-
# eve 1.0.0-rc.
|
|
1
|
+
# eve 1.0.0-rc.8
|
|
2
2
|
|
|
3
|
-
Released 2026-11-
|
|
4
|
-
|
|
5
|
-
## Breaking Changes
|
|
6
|
-
|
|
7
|
-
- Replace `agentWithModel` with `agent({ models })` from `eve/tools/agent`, which lists the models a root-copy task may run on.
|
|
8
|
-
`agentWithModel` let the model pass any AI Gateway model ID and did not tell it which models exist. `agent({ models })` takes the same entries as `auto()` from `eve/models`: a string entry is the description, and its key is the AI Gateway model ID; an object entry holds an AI Gateway model ID or an AI SDK model, with its description and optional `reasoning`, `modelContextWindowTokens`, and `modelOptions`. The model sees each key with its description and can choose only those keys. A call without `model` runs on the current model, and `agent()` with no `models` is the default tool, with no `model` input. A task keeps the model it started with, so a continuation can omit `model`. Copies and declared subagents never get this tool.
|
|
9
|
-
To migrate, replace `export { agentWithModel as default } from "eve/tools/agent"` with `export default agent({ models: { "<gateway-model-id>": "<when to use it>" } })`. `agent` is now this function; re-export `default` from `eve/tools/agent` to keep the default tool object. ([#5959](https://github.com/vercel/eve/pull/5959))
|
|
10
|
-
- New sessions now claim an address as they start, so racing first messages to a channel address reach one session, keyed sends and `create()` respond without waiting for the session to boot, and a session accepts commands as soon as it is created.
|
|
11
|
-
Previously, two unkeyed first messages to the same new address could each get a receipt naming a different session: the losing run forwarded its message and exited, but its caller kept the dead session's ID. A cancel or `end()` sent by session ID before the session finished booting was answered with "no active turn" or "no active session" while the session kept running, and an early send had to retry `409 session_not_ready`. A send by session ID to a session that is shutting down now gets `409 session_not_active` at once instead of `session_not_ready` retries.
|
|
12
|
-
eve now requires a Workflow world with atomic start hooks: the local world, Vercel Workflow, or `@workflow/world-postgres` 5.1.1 or later. On another world, starting a session fails with an error that names the requirement. Upgrade `@workflow/world-postgres` and run its `bootstrap` command before deploying this release.
|
|
13
|
-
A session can no longer move to this release from an owner on eve before 0.83, which released its addresses before handing off. Finish or end those sessions before upgrading.
|
|
14
|
-
`useEveAgent` and the other framework bindings now send `end()`, `clear()`, and `compact()` called while the store is still creating its session to that session, instead of throwing `SessionNotActiveError`. ([#5948](https://github.com/vercel/eve/pull/5948))
|
|
3
|
+
Released 2026-11-10 · [Compare with 1.0.0-rc.7](https://github.com/vercel/eve/compare/eve%401.0.0-rc.7...eve%401.0.0-rc.8)
|
|
15
4
|
|
|
16
5
|
## Features
|
|
17
6
|
|
|
18
|
-
-
|
|
19
|
-
|
|
7
|
+
- Add Slack's `action_token` to `defaultSlackAuth` as the `action_token` attribute, so tools can call the Real-time Search API without channel code.
|
|
8
|
+
eve also exposes the token as `message.actionToken`, read from the top level of the event or from `assistant_thread`, where Slack sends it in app threads. ([#6088](https://github.com/vercel/eve/pull/6088))
|
|
9
|
+
- Chat SDK, Discord, Telegram, and Teams now say who answered a question or approval when they edit its prompt, as Slack already does: `Approved by Alice` or `Answered by Alice: Saturday`.
|
|
10
|
+
Each channel records the person behind a principal when that principal sends a message or presses a button, then names them from the settlement's responder. Discord shows a mention, which doesn't notify anyone because the edit allows no mentions. Teams already named who pressed Approve; it now also names people who approve by text or answer questions. A prompt withdrawn without an answer, or answered by someone the channel never saw, reads as before. ([#6110](https://github.com/vercel/eve/pull/6110))
|
|
20
11
|
|
|
21
12
|
## Bug Fixes
|
|
22
13
|
|
|
23
|
-
-
|
|
24
|
-
|
|
25
|
-
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
-
|
|
32
|
-
|
|
33
|
-
|
|
14
|
+
- Computer use recordings show the dark address bar again on Firefox ESR 153, which renders the address-bar background as an HTML element that the old style rule missed. ([#6161](https://github.com/vercel/eve/pull/6161))
|
|
15
|
+
- Fixed a parent session crediting or refusing the wrong person's answer when several people answer a subagent's approval before the subagent settles it, including for remote and protocol 2 subagents. ([#6165](https://github.com/vercel/eve/pull/6165))
|
|
16
|
+
- When AI Gateway cuts a model stream at its maximum duration, eve now retries it once instead of up to three times.
|
|
17
|
+
The error hint now says that eve already retried the request and suggests smaller turns or another model. ([#6159](https://github.com/vercel/eve/pull/6159))
|
|
18
|
+
- Subagents that share a sandbox no longer trigger spurious GitHub sign-ins when they run `gh` commands at the same time.
|
|
19
|
+
The `gh` tool's credential lease replaces the sandbox's network policy for the duration of one command. Leases were serialized per session, so sessions sharing a sandbox, such as parallel subagents, could replace or clear each other's credential mid-command; the stranded command got a 401 from GitHub, which asked the user to sign in again even though their grant was valid. Leases are now serialized per sandbox by a lock inside the sandbox, which works across processes. A command waits up to a minute for another to finish, then fails with a retryable error. ([#6029](https://github.com/vercel/eve/pull/6029))
|
|
20
|
+
- Name the memory store on memory provider tool calls, so a trace query by `gen_ai.memory.store.id` finds a scope's tool reads and writes as well as its recall and capture.
|
|
21
|
+
The `execute_tool` span of a memory provider tool, such as `profile__save`, now carries `gen_ai.memory.store.id` and `agent.memory.slot`, matching the `search_memory` and `upsert_memory` spans of the same slot. The store ID is the slot's opaque scope key, so it is recorded whatever the trace policy captures. `@vercel/agent-runs` adds an optional `memory` lifecycle to `ActiveOperation` on tool operations to record it. ([#6147](https://github.com/vercel/eve/pull/6147))
|
|
22
|
+
- Agent builds now build a workspace extension that only another workspace extension mounts or depends on, instead of failing with a missing compatibility manifest on a clean checkout. ([#6160](https://github.com/vercel/eve/pull/6160))
|
|
23
|
+
- The Vercel project overview card now shows the agents' tools, schedules, and connections for a Next.js app that hosts an `agents/` workspace through `withEve` from `eve/next`.
|
|
24
|
+
During `next build`, `withEve` now writes the workspace's `.eve/agent-summary.json` index, the same index that `withEve` from `eve/vercel` writes since #5710. Standalone agents and agents configured with the `agents` option do not change. ([#6163](https://github.com/vercel/eve/pull/6163))
|
|
25
|
+
- Send a Slack sign-in prompt to the person's DM when the session has no thread, instead of posting a status top-level in the channel.
|
|
26
|
+
The DM names the channel the request came from, is edited in place with the outcome, and needs no Slack scope beyond `chat:write`. If the DM can't be sent, eve posts in the channel as before. Threaded sessions and code channels are unchanged. ([#6007](https://github.com/vercel/eve/pull/6007))
|
|
27
|
+
- `eve__task_wait` now waits at most 30 minutes when a call omits `timeoutSeconds`, so a task that never reports can't hold a turn open indefinitely. ([#5300](https://github.com/vercel/eve/pull/5300))
|
|
28
|
+
|
|
29
|
+
For an upgrade across multiple releases, review each version between the installed and target versions in the [target version's changelog](https://raw.githubusercontent.com/vercel/eve/refs/tags/eve%401.0.0-rc.8/packages/eve/CHANGELOG.md).
|
package/dist/src/acp/adapter.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{randomUUID}from"node:crypto";import{realpath}from"node:fs/promises";import{PROTOCOL_VERSION,RequestError,methods}from"#compiled/@agentclientprotocol/sdk/index.js";import{Client,ClientError}from"#client/index.js";import{isFactType}from"#protocol/session-events/catalog.js";import{emptySessionView,foldReceivedEvent}from"#protocol/session-projection/fold.js";import{interaction}from"#protocol/session-projection/reader.js";import{callLabel,callOutputSource,callState}from"#protocol/session-projection/selectors.js";import{actionLabel}from"#shared/action-label.js";import{failureOf}from"#client/session-utils.js";const ANSWER_FIELD=`answer`,ERROR_CODE_EVE=-32002;function acpStatus(e,t){switch(callState(e,t)){case void 0:return;case`requested`:case`approval`:return`pending`;case`running`:case`blocked`:return`in_progress`;case`completed`:return`completed`;default:return`failed`}}var EveAcpAdapter=class{#e;#t;#n;#r=!1;#i=new Map;constructor(e){this.#t=e.eveVersion,this.#n=e.workspaceRoot,this.#e=e.client??new Client({auth:e.auth,headers:e.headers,baseUrl:e.serverUrl,redirect:`manual`})}initialize(e){return this.#r=e.clientCapabilities?.elicitation?.form!==void 0,{protocolVersion:PROTOCOL_VERSION,agentCapabilities:{loadSession:!1,promptCapabilities:{},sessionCapabilities:{close:{}}},agentInfo:{name:`eve`,title:`eve`,version:this.#t},authMethods:[]}}async newSession(e){if(e.mcpServers.length>0)throw unsupported(`Client-provided MCP servers are not supported by eve ACP mode.`);if((e.additionalDirectories?.length??0)>0)throw unsupported(`Additional workspace directories are not supported by eve ACP mode.`);if(this.#n!==void 0){let t=await normalizedRealpath(e.cwd,`session/new.cwd`),n=await normalizedRealpath(this.#n,`the eve application root`);if(t!==n)throw RequestError.invalidParams({cwd:e.cwd,workspaceRoot:n},`ACP cwd must be the eve application root`)}let t=randomUUID();return this.#i.set(t,{view:emptySessionView(),tools:new Map,parts:new Map}),{sessionId:t}}async prompt(e,t,n){let r=this.#s(e.sessionId);if(r.active!==void 0)throw new RequestError(-32001,`ACP session ${e.sessionId} already has an active prompt.`);let i=promptContent(e);r.tools.clear(),r.parts.clear();let a=Promise.withResolvers(),o={cancelRequested:!1,protocolCancelled:!1,outboundController:new AbortController,settled:a.promise,resolveSettled:a.resolve};r.active=o;let onProtocolCancel=()=>{o.protocolCancelled=!0,this.#o(r).catch(()=>void 0)};n.aborted?onProtocolCancel():n.addEventListener(`abort`,onProtocolCancel,{once:!0});try{if(o.protocolCancelled)throw RequestError.requestCancelled({sessionId:e.sessionId});let a={message:i};for(;;){let i;if(r.client===void 0){if(a.message===void 0)throw Error(`ACP session has not started.`);let e=await this.#e.sessions.create({...a,message:a.message});r.client=e.session,i=e.delivery}else i=a.answers===void 0?await r.client.send(a.message):await r.client.respond(a.answers);(o.cancelRequested||o.protocolCancelled)&&await this.#o(r);let s=[],c=!1,l,u;for await(let n of i.stream()){let i=`data`in n?n.data:void 0,a=i!==void 0&&`turnId`in i?i.turnId:void 0;if(typeof a==`string`&&(o.turnId=a),n.type===`interaction.opened`&&n.data.request.kind===`sign-in`&&(u=unsupported(`Connection authorization cannot be completed through eve ACP mode.`)),n.type===`turn.settled`&&n.data.outcome===`cancelled`&&(c=!0),l=failureOf(n)??l,await this.#c(e.sessionId,r,n,t),n.type===`interaction.opened`){let e=interaction(r.view,n.data.interactionId);e!==void 0&&e.request.kind!==`sign-in`&&s.push(e)}}if(o.protocolCancelled)throw RequestError.requestCancelled({sessionId:e.sessionId});if(o.cancelRequested||c&&l===void 0)return{stopReason:`cancelled`};if(l!==void 0)throw await this.#l(e.sessionId,r,t),eveFailure(l);if(u!==void 0)throw u;if(s.length===0)return{stopReason:`end_turn`};let d;try{d=await Promise.all(s.map(i=>this.#d(e.sessionId,r,i,t,n)))}catch(t){if(o.protocolCancelled)throw RequestError.requestCancelled({sessionId:e.sessionId});if(o.cancelRequested)return{stopReason:`cancelled`};throw t}if(o.protocolCancelled)throw RequestError.requestCancelled({sessionId:e.sessionId});if(o.cancelRequested)return{stopReason:`cancelled`};a={answers:d}}}catch(e){throw acpRequestError(e)}finally{n.removeEventListener(`abort`,onProtocolCancel),r.tools.clear(),o.resolveSettled(),r.active===o&&(r.active=void 0)}}async cancel(e){let t=this.#i.get(e);t!==void 0&&t.active!==void 0&&(t.active.cancelRequested=!0,await this.#o(t))}async closeSession(e){let t=this.#s(e);this.#i.delete(e),await this.#a(t)}async close(){let e=[...this.#i.values()];this.#i.clear(),await Promise.allSettled(e.map(e=>this.#a(e)))}async#a(e){let t;if(e.active!==void 0){let n=e.active;n.cancelRequested=!0;try{await this.#o(e)}catch(e){t=e}await n.settled}try{await e.client?.end()}catch(e){throw t===void 0?e:AggregateError([t,e],`Could not cancel or end the eve session`)}if(t!==void 0)throw t}async#o(e){e.active?.outboundController.abort(),e.client!==void 0&&await e.client.cancel(e.active?.turnId===void 0?void 0:{turnId:e.active.turnId})}#s(e){let t=this.#i.get(e);if(t===void 0)throw RequestError.invalidParams({sessionId:e},`Unknown or closed ACP session`);return t}async#c(e,t,n,r){if(!isFactType(n.type)){await this.#u(e,t,n,r);return}if(foldReceivedEvent(t.view,n),await this.#u(e,t,n,r),n.type===`call.requested`)return;let i=n.type===`call.settled`?n.data.callId:void 0;for(let[a,o]of t.tools){let s=acpStatus(t.view,a);if(s===void 0)continue;let c=callOutput(n,a,t.view);(s!==o.status||a===i&&`content`in c)&&(t.tools.set(a,{...o,status:s}),await notifyUpdate(r,e,{sessionUpdate:`tool_call_update`,toolCallId:a,status:s,...c,...resultTitle(n,a)}))}}async#l(e,t,n){for(let r of t.tools.keys())acpStatus(t.view,r)===`in_progress`&&await notifyUpdate(n,e,{sessionUpdate:`tool_call_update`,toolCallId:r,status:`failed`})}async#u(e,t,n,r){switch(n.type){case`content.delta`:{let{partId:i,kind:a,delta:o}=n.data;a===`text`?t.parts.set(i,`text`):a===`reasoning`&&t.parts.set(i,`reasoning`);let s=t.parts.get(i);if(s===void 0||o===void 0)return;await notifyUpdate(r,e,{sessionUpdate:s===`text`?`agent_message_chunk`:`agent_thought_chunk`,content:{type:`text`,text:o},messageId:i});return}case`content.completed`:{let{partId:i,kind:a,value:o}=n.data;if(t.parts.has(i)||typeof o!=`string`||a!==`text`&&a!==`reasoning`)return;t.parts.set(i,a===`text`?`text`:`reasoning`),await notifyUpdate(r,e,{sessionUpdate:a===`text`?`agent_message_chunk`:`agent_thought_chunk`,content:{type:`text`,text:o},messageId:i});return}case`call.requested`:{let{callId:i,capability:a,input:o}=n.data,s=t.view.calls[i];if(a.kind===`control`||s===void 0)return;let c={toolCallId:i,title:callLabel(s),kind:`other`,status:`pending`,rawInput:o};t.tools.set(i,c),await notifyUpdate(r,e,{sessionUpdate:`tool_call`,...c});return}default:return}}async#d(e,t,n,r,i){let a=AbortSignal.any([i,t.active.outboundController.signal]);if(n.request.display===`confirmation`){let i=`${n.interactionId}:approve`,o=`${n.interactionId}:deny`,s=(n.call===void 0?void 0:t.tools.get(n.call.callId))??toolCallForAsked(n),c=await r.request(methods.client.session.requestPermission,{sessionId:e,toolCall:s,options:[{kind:`allow_once`,name:`Approve`,optionId:i},{kind:`reject_once`,name:`Deny`,optionId:o}]},{cancellationSignal:a});if(c.outcome.outcome===`cancelled`)return this.#f(t),{interactionId:n.interactionId};if(c.outcome.optionId===i)return{interactionId:n.interactionId,optionId:`approve`};if(c.outcome.optionId===o)return{interactionId:n.interactionId,optionId:`deny`};throw RequestError.invalidParams({optionId:c.outcome.optionId},`Unknown ACP permission option`)}if(!this.#r)throw unsupported(`The ACP client does not support form elicitation required by this eve question.`);let o=elicitationProperty(n),s=await r.request(methods.client.elicitation.create,{mode:`form`,sessionId:e,message:n.request.prompt,requestedSchema:{type:`object`,properties:{[ANSWER_FIELD]:o},required:[ANSWER_FIELD]}},{cancellationSignal:a});if(s.action!==`accept`)return this.#f(t),{interactionId:n.interactionId};let c=s.content?.[ANSWER_FIELD];if(typeof c!=`string`)throw RequestError.invalidParams(s.content,`ACP elicitation response must contain a string answer`);if(n.request.display===`select`){if(!n.request.options?.some(e=>e.id===c))throw RequestError.invalidParams({answer:c},`Unknown eve question option`);return{interactionId:n.interactionId,optionId:c}}return{interactionId:n.interactionId,text:c}}#f(e){let t=e.active;t.cancelRequested=!0,t.outboundController.abort()}};async function normalizedRealpath(e,t){try{return await realpath(e)}catch(n){throw RequestError.invalidParams({path:e},`Could not resolve ${t}: ${errorMessage(n)}`)}}function promptContent(e){let t=e.prompt.map(e=>{if(e.type!==`text`)throw unsupported(`ACP prompt content type ${JSON.stringify(e.type)} is not supported.`);return{type:`text`,text:e.text}});if(t.every(e=>e.text.length===0))throw RequestError.invalidParams(e.prompt,`ACP prompt must contain at least one non-empty text block`);return t}function toolCallForAsked(e){let t=e.call?.name??e.request.kind;return{toolCallId:e.call?.callId??e.interactionId,title:actionLabel({callId:e.call?.callId??``,input:{},kind:`tool-call`,toolName:t},void 0),kind:`other`,status:`pending`,rawInput:e.call?.input??{}}}function elicitationProperty(e){if(e.request.display===`select`&&e.request.allowFreeform!==!0&&e.request.options?.length)return{type:`string`,title:e.request.prompt,oneOf:e.request.options.map(e=>({const:e.id,title:e.label,description:e.description}))};if(e.request.display===`text`&&e.request.allowFreeform!==!1)return{type:`string`,title:e.request.prompt,minLength:1};throw unsupported(`This eve question shape cannot be represented by ACP form elicitation.`)}async function notifyUpdate(e,t,n){await e.notify(methods.client.session.update,{sessionId:t,update:n})}function stringifyOutput(e){return typeof e==`string`?e:JSON.stringify(e,null,2)}function unsupported(e){return new RequestError(-32003,e)}function eveFailure(e){return new RequestError(ERROR_CODE_EVE,e.message,{code:e.code,id:e.id,hint:e.hint})}function acpRequestError(e){return e instanceof RequestError?e:e instanceof ClientError?new RequestError(ERROR_CODE_EVE,e.message,{httpStatus:e.status}):new RequestError(ERROR_CODE_EVE,errorMessage(e))}function errorMessage(e){return e instanceof Error?e.message:String(e)}function resultTitle(e,t){let n=e.type===`call.settled`&&e.data.callId===t?e.data.label:void 0;return n===void 0?{}:{title:n}}function callOutput(e,t,n){if(e.type!==`call.settled`||e.data.callId!==t)return{};let r=e.data.outputOf,i=r===void 0?void 0:callOutputSource(n,r.callId)?.output,a=e.data.output===void 0?i===void 0?e.data.error?.message:i:e.data.output;return a===void 0?{}:{content:[{type:`content`,content:{type:`text`,text:stringifyOutput(a)}}],rawOutput:a}}export{EveAcpAdapter};
|
|
1
|
+
import{randomUUID}from"node:crypto";import{realpath}from"node:fs/promises";import{PROTOCOL_VERSION,RequestError,methods}from"#compiled/@agentclientprotocol/sdk/index.js";import{Client,ClientError}from"#client/index.js";import{isFactType}from"#protocol/session-events/catalog.js";import{emptySessionView,foldReceivedEvent}from"#protocol/session-projection/fold.js";import{interaction}from"#protocol/session-projection/reader.js";import{callLabel,callOutputSource,callState,showsActivity}from"#protocol/session-projection/selectors.js";import{actionLabel}from"#shared/action-label.js";import{failureOf}from"#client/session-utils.js";const ANSWER_FIELD=`answer`;const ERROR_CODE_EVE=-32002;function acpStatus(e,t){switch(callState(e,t)){case void 0:return;case`requested`:case`approval`:return`pending`;case`running`:case`blocked`:return`in_progress`;case`completed`:return`completed`;default:return`failed`}}var EveAcpAdapter=class{#e;#t;#n;#r=!1;#i=new Map;constructor(e){this.#t=e.eveVersion,this.#n=e.workspaceRoot,this.#e=e.client??new Client({auth:e.auth,headers:e.headers,baseUrl:e.serverUrl,redirect:`manual`})}initialize(e){return this.#r=e.clientCapabilities?.elicitation?.form!==void 0,{protocolVersion:PROTOCOL_VERSION,agentCapabilities:{loadSession:!1,promptCapabilities:{},sessionCapabilities:{close:{}}},agentInfo:{name:`eve`,title:`eve`,version:this.#t},authMethods:[]}}async newSession(e){if(e.mcpServers.length>0)throw unsupported(`Client-provided MCP servers are not supported by eve ACP mode.`);if((e.additionalDirectories?.length??0)>0)throw unsupported(`Additional workspace directories are not supported by eve ACP mode.`);if(this.#n!==void 0){let t=await normalizedRealpath(e.cwd,`session/new.cwd`);let n=await normalizedRealpath(this.#n,`the eve application root`);if(t!==n)throw RequestError.invalidParams({cwd:e.cwd,workspaceRoot:n},`ACP cwd must be the eve application root`)}let t=randomUUID();return this.#i.set(t,{view:emptySessionView(),tools:new Map,parts:new Map}),{sessionId:t}}async prompt(e,t,n){let r=this.#s(e.sessionId);if(r.active!==void 0)throw new RequestError(-32001,`ACP session ${e.sessionId} already has an active prompt.`);let i=promptContent(e);r.tools.clear(),r.parts.clear();let a=Promise.withResolvers();let o={cancelRequested:!1,protocolCancelled:!1,outboundController:new AbortController,settled:a.promise,resolveSettled:a.resolve};r.active=o;let onProtocolCancel=()=>{o.protocolCancelled=!0,this.#o(r).catch(()=>void 0)};n.aborted?onProtocolCancel():n.addEventListener(`abort`,onProtocolCancel,{once:!0});try{if(o.protocolCancelled)throw RequestError.requestCancelled({sessionId:e.sessionId});let a={message:i};for(;;){let i;if(r.client===void 0){if(a.message===void 0)throw Error(`ACP session has not started.`);let e=await this.#e.sessions.create({...a,message:a.message});r.client=e.session,i=e.delivery}else i=a.answers===void 0?await r.client.send(a.message):await r.client.respond(a.answers);(o.cancelRequested||o.protocolCancelled)&&await this.#o(r);let s=[];let c=!1;let l;let u;for await(let n of i.stream()){let i=`data`in n?n.data:void 0;let a=i!==void 0&&`turnId`in i?i.turnId:void 0;if(typeof a==`string`&&(o.turnId=a),n.type===`interaction.opened`&&n.data.request.kind===`sign-in`&&(u=unsupported(`Connection authorization cannot be completed through eve ACP mode.`)),n.type===`turn.settled`&&n.data.outcome===`cancelled`&&(c=!0),l=failureOf(n)??l,await this.#c(e.sessionId,r,n,t),n.type===`interaction.opened`){let e=interaction(r.view,n.data.interactionId);e!==void 0&&e.request.kind!==`sign-in`&&s.push(e)}}if(o.protocolCancelled)throw RequestError.requestCancelled({sessionId:e.sessionId});if(o.cancelRequested||c&&l===void 0)return{stopReason:`cancelled`};if(l!==void 0)throw await this.#l(e.sessionId,r,t),eveFailure(l);if(u!==void 0)throw u;if(s.length===0)return{stopReason:`end_turn`};let d;try{d=await Promise.all(s.map(i=>this.#d(e.sessionId,r,i,t,n)))}catch(t){if(o.protocolCancelled)throw RequestError.requestCancelled({sessionId:e.sessionId});if(o.cancelRequested)return{stopReason:`cancelled`};throw t}if(o.protocolCancelled)throw RequestError.requestCancelled({sessionId:e.sessionId});if(o.cancelRequested)return{stopReason:`cancelled`};a={answers:d}}}catch(e){throw acpRequestError(e)}finally{n.removeEventListener(`abort`,onProtocolCancel),r.tools.clear(),o.resolveSettled(),r.active===o&&(r.active=void 0)}}async cancel(e){let t=this.#i.get(e);t!==void 0&&t.active!==void 0&&(t.active.cancelRequested=!0,await this.#o(t))}async closeSession(e){let t=this.#s(e);this.#i.delete(e),await this.#a(t)}async close(){let e=[...this.#i.values()];this.#i.clear(),await Promise.allSettled(e.map(e=>this.#a(e)))}async#a(e){let t;if(e.active!==void 0){let n=e.active;n.cancelRequested=!0;try{await this.#o(e)}catch(e){t=e}await n.settled}try{await e.client?.end()}catch(e){throw t===void 0?e:AggregateError([t,e],`Could not cancel or end the eve session`)}if(t!==void 0)throw t}async#o(e){e.active?.outboundController.abort(),e.client!==void 0&&await e.client.cancel(e.active?.turnId===void 0?void 0:{turnId:e.active.turnId})}#s(e){let t=this.#i.get(e);if(t===void 0)throw RequestError.invalidParams({sessionId:e},`Unknown or closed ACP session`);return t}async#c(e,t,n,r){if(!isFactType(n.type)){await this.#u(e,t,n,r);return}if(foldReceivedEvent(t.view,n),await this.#u(e,t,n,r),n.type===`call.requested`)return;let i=n.type===`call.settled`?n.data.callId:void 0;for(let[a,o]of t.tools){let s=acpStatus(t.view,a);if(s===void 0)continue;let c=callOutput(n,a,t.view);(s!==o.status||a===i&&`content`in c)&&(t.tools.set(a,{...o,status:s}),await notifyUpdate(r,e,{sessionUpdate:`tool_call_update`,toolCallId:a,status:s,...c,...resultTitle(n,a)}))}}async#l(e,t,n){for(let r of t.tools.keys())acpStatus(t.view,r)===`in_progress`&&await notifyUpdate(n,e,{sessionUpdate:`tool_call_update`,toolCallId:r,status:`failed`})}async#u(e,t,n,r){switch(n.type){case`content.delta`:{let{partId:i,kind:a,delta:o}=n.data;a===`text`?t.parts.set(i,`text`):a===`reasoning`&&t.parts.set(i,`reasoning`);let s=t.parts.get(i);if(s===void 0||o===void 0)return;await notifyUpdate(r,e,{sessionUpdate:s===`text`?`agent_message_chunk`:`agent_thought_chunk`,content:{type:`text`,text:o},messageId:i});return}case`content.completed`:{let{partId:i,kind:a,value:o}=n.data;if(t.parts.has(i)||typeof o!=`string`||a!==`text`&&a!==`reasoning`)return;t.parts.set(i,a===`text`?`text`:`reasoning`),await notifyUpdate(r,e,{sessionUpdate:a===`text`?`agent_message_chunk`:`agent_thought_chunk`,content:{type:`text`,text:o},messageId:i});return}case`call.requested`:{let{callId:i,capability:a,input:o}=n.data;let s=t.view.calls[i];if(!showsActivity(a)||s===void 0)return;let c={toolCallId:i,title:callLabel(s),kind:`other`,status:`pending`,rawInput:o};t.tools.set(i,c),await notifyUpdate(r,e,{sessionUpdate:`tool_call`,...c});return}default:return}}async#d(e,t,n,r,i){let a=AbortSignal.any([i,t.active.outboundController.signal]);if(n.request.display===`confirmation`){let i=`${n.interactionId}:approve`;let o=`${n.interactionId}:deny`;let s=(n.call===void 0?void 0:t.tools.get(n.call.callId))??toolCallForAsked(n);let c=await r.request(methods.client.session.requestPermission,{sessionId:e,toolCall:s,options:[{kind:`allow_once`,name:`Approve`,optionId:i},{kind:`reject_once`,name:`Deny`,optionId:o}]},{cancellationSignal:a});if(c.outcome.outcome===`cancelled`)return this.#f(t),{interactionId:n.interactionId};if(c.outcome.optionId===i)return{interactionId:n.interactionId,optionId:`approve`};if(c.outcome.optionId===o)return{interactionId:n.interactionId,optionId:`deny`};throw RequestError.invalidParams({optionId:c.outcome.optionId},`Unknown ACP permission option`)}if(!this.#r)throw unsupported(`The ACP client does not support form elicitation required by this eve question.`);let o=elicitationProperty(n);let s=await r.request(methods.client.elicitation.create,{mode:`form`,sessionId:e,message:n.request.prompt,requestedSchema:{type:`object`,properties:{[ANSWER_FIELD]:o},required:[ANSWER_FIELD]}},{cancellationSignal:a});if(s.action!==`accept`)return this.#f(t),{interactionId:n.interactionId};let c=s.content?.[ANSWER_FIELD];if(typeof c!=`string`)throw RequestError.invalidParams(s.content,`ACP elicitation response must contain a string answer`);if(n.request.display===`select`){if(!n.request.options?.some(e=>e.id===c))throw RequestError.invalidParams({answer:c},`Unknown eve question option`);return{interactionId:n.interactionId,optionId:c}}return{interactionId:n.interactionId,text:c}}#f(e){let t=e.active;t.cancelRequested=!0,t.outboundController.abort()}};async function normalizedRealpath(e,t){try{return await realpath(e)}catch(n){throw RequestError.invalidParams({path:e},`Could not resolve ${t}: ${errorMessage(n)}`)}}function promptContent(e){let t=e.prompt.map(e=>{if(e.type!==`text`)throw unsupported(`ACP prompt content type ${JSON.stringify(e.type)} is not supported.`);return{type:`text`,text:e.text}});if(t.every(e=>e.text.length===0))throw RequestError.invalidParams(e.prompt,`ACP prompt must contain at least one non-empty text block`);return t}function toolCallForAsked(e){let t=e.call?.name??e.request.kind;return{toolCallId:e.call?.callId??e.interactionId,title:actionLabel({callId:e.call?.callId??``,input:{},kind:`tool-call`,toolName:t},void 0),kind:`other`,status:`pending`,rawInput:e.call?.input??{}}}function elicitationProperty(e){if(e.request.display===`select`&&e.request.allowFreeform!==!0&&e.request.options?.length)return{type:`string`,title:e.request.prompt,oneOf:e.request.options.map(e=>({const:e.id,title:e.label,description:e.description}))};if(e.request.display===`text`&&e.request.allowFreeform!==!1)return{type:`string`,title:e.request.prompt,minLength:1};throw unsupported(`This eve question shape cannot be represented by ACP form elicitation.`)}async function notifyUpdate(e,t,n){await e.notify(methods.client.session.update,{sessionId:t,update:n})}function stringifyOutput(e){return typeof e==`string`?e:JSON.stringify(e,null,2)}function unsupported(e){return new RequestError(-32003,e)}function eveFailure(e){return new RequestError(ERROR_CODE_EVE,e.message,{code:e.code,id:e.id,hint:e.hint})}function acpRequestError(e){return e instanceof RequestError?e:e instanceof ClientError?new RequestError(ERROR_CODE_EVE,e.message,{httpStatus:e.status}):new RequestError(ERROR_CODE_EVE,errorMessage(e))}function errorMessage(e){return e instanceof Error?e.message:String(e)}function resultTitle(e,t){let n=e.type===`call.settled`&&e.data.callId===t?e.data.label:void 0;return n===void 0?{}:{title:n}}function callOutput(e,t,n){if(e.type!==`call.settled`||e.data.callId!==t)return{};let r=e.data.outputOf;let i=r===void 0?void 0:callOutputSource(n,r.callId)?.output;let a=e.data.output===void 0?i===void 0?e.data.error?.message:i:e.data.output;return a===void 0?{}:{content:[{type:`content`,content:{type:`text`,text:stringifyOutput(a)}}],rawOutput:a}}export{EveAcpAdapter};
|
package/dist/src/acp/server.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{agent,methods,ndJsonStream}from"#compiled/@agentclientprotocol/sdk/index.js";import{Readable,Writable}from"node:stream";import{EveAcpAdapter}from"#acp/adapter.js";import{limitAcpLineBytes}from"#acp/line-limit.js";async function runAcpServer(e){await runAcpServerOnStreams(e,{input:process.stdin,output:process.stdout})}async function runAcpServerOnStreams(e,t){let n=new EveAcpAdapter(e)
|
|
1
|
+
import{agent,methods,ndJsonStream}from"#compiled/@agentclientprotocol/sdk/index.js";import{Readable,Writable}from"node:stream";import{EveAcpAdapter}from"#acp/adapter.js";import{limitAcpLineBytes}from"#acp/line-limit.js";async function runAcpServer(e){await runAcpServerOnStreams(e,{input:process.stdin,output:process.stdout})}async function runAcpServerOnStreams(e,t){let n=new EveAcpAdapter(e);let r=agent({name:`eve`}).onRequest(methods.agent.initialize,({params:e})=>n.initialize(e)).onRequest(methods.agent.session.new,({params:e})=>n.newSession(e)).onRequest(methods.agent.session.prompt,({params:e,client:t,signal:r})=>n.prompt(e,t,r)).onRequest(methods.agent.session.close,({params:e})=>n.closeSession(e.sessionId)).onNotification(methods.agent.session.cancel,({params:e})=>n.cancel(e.sessionId));let i=Writable.toWeb(t.output);let a=Readable.toWeb(t.input).pipeThrough(limitAcpLineBytes());let o=r.connect(ndJsonStream(i,a));let close=()=>o.close();e.signal?.aborted?close():e.signal?.addEventListener(`abort`,close,{once:!0});try{await o.closed}finally{e.signal?.removeEventListener(`abort`,close),await n.close()}}export{runAcpServer,runAcpServerOnStreams};
|
package/dist/src/ai/decide.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{recordUsage}from"#harness/usage-sink.js";import{extractGatewayCostUsd}from"#harness/model-call/usage.js";import{decideWithTracing}from"#instrumentation/decide.js";async function decide(e){let t=await decideWithTracing(e);return await recordUsage({costUsd:extractGatewayCostUsd(t.providerMetadata),inputTokens:t.usage.inputTokens,outputTokens:t.usage.outputTokens},{kind:`decision`}),{answers:t.answers,usage:{inputTokens:t.usage.inputTokens,outputTokens:t.usage.outputTokens,totalTokens:t.usage.totalTokens}}}export{decide};
|
|
@@ -1,5 +1,15 @@
|
|
|
1
1
|
import * as aiSdk from "ai";
|
|
2
|
-
import type { DecisionOptions, DecisionQuestion } from "#ai/decision-types.js";
|
|
2
|
+
import type { DecisionModel, DecisionOptions, DecisionQuestion } from "#ai/decision-types.js";
|
|
3
3
|
export declare const DEFAULT_DECISION_MODEL = "typesafe-ai/jev";
|
|
4
|
+
type AiSdkDecide = typeof aiSdk.experimental_decide;
|
|
5
|
+
type AiSdkDecideOptions = Parameters<AiSdkDecide>[0];
|
|
6
|
+
/** eve-owned instrumentation passed to the AI SDK; never part of the public options. */
|
|
7
|
+
export type DecisionInstrumentation = Pick<AiSdkDecideOptions, "telemetry">;
|
|
8
|
+
/**
|
|
9
|
+
* Resolves a model ID as the AI SDK would, so a trace names the model that answers. An ID no
|
|
10
|
+
* provider resolves stays a string, and the AI SDK reports why when it is called.
|
|
11
|
+
*/
|
|
12
|
+
export declare function resolveDecisionModel(model: DecisionModel): DecisionModel;
|
|
4
13
|
/** Internal eval diagnostics retain SDK metadata without promising it to applications. */
|
|
5
|
-
export declare function decideWithMetadata<const Questions extends Readonly<Record<string, DecisionQuestion>>>({ model, state, questions, maxRetries, signal, providerOptions, }: DecisionOptions<Questions
|
|
14
|
+
export declare function decideWithMetadata<const Questions extends Readonly<Record<string, DecisionQuestion>>>({ model, state, questions, maxRetries, signal, providerOptions, }: DecisionOptions<Questions>, instrumentation?: DecisionInstrumentation): Promise<aiSdk.Experimental_DecisionResult<Questions>>;
|
|
15
|
+
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import*as aiSdk from"ai";import{ensureAiSdkWarningLogger}from"#instrumentation/ai-sdk-warnings.js";import{localGatewayDecisionModel}from"#internal/model-auth/transport.js";const DEFAULT_DECISION_MODEL=`typesafe-ai/jev`;function resolveAiSdkDecide(){let e=Reflect.get(aiSdk,`decide`)??Reflect.get(aiSdk,`experimental_decide`);if(typeof e!=`function`)throw Error(`decide requires an installed "ai" package that exports decide or experimental_decide. Install a version of "ai" supported by eve, such as ai@^7.0.137.`);return e}function decideWithMetadata({model:e=DEFAULT_DECISION_MODEL,state:t,questions:n,maxRetries:r,signal:i,providerOptions:a}){let
|
|
1
|
+
import*as aiSdk from"ai";import{ensureAiSdkWarningLogger}from"#instrumentation/ai-sdk-warnings.js";import{localGatewayDecisionModel}from"#internal/model-auth/transport.js";const DEFAULT_DECISION_MODEL=`typesafe-ai/jev`;function resolveDecisionModel(e){if(typeof e!=`string`)return e;let t=localGatewayDecisionModel(e);if(t!==void 0)return t;let n=Reflect.get(globalThis,`AI_SDK_DEFAULT_PROVIDER`)??Reflect.get(aiSdk,`gateway`);let r=n==null?void 0:Reflect.get(n,`decisionModel`)??Reflect.get(n,`evaluationModel`);if(typeof r!=`function`)return e;try{return r.call(n,e)??e}catch{return e}}function resolveAiSdkDecide(){let e=Reflect.get(aiSdk,`decide`)??Reflect.get(aiSdk,`experimental_decide`);if(typeof e!=`function`)throw Error(`decide requires an installed "ai" package that exports decide or experimental_decide. Install a version of "ai" supported by eve, such as ai@^7.0.137.`);return e}function decideWithMetadata({model:e=DEFAULT_DECISION_MODEL,state:t,questions:n,maxRetries:r,signal:i,providerOptions:a},o){let s=resolveAiSdkDecide();if(ensureAiSdkWarningLogger(),typeof e!=`string`&&typeof Reflect.get(e,`doDecide`)!=`function`&&typeof Reflect.get(e,`doEvaluate`)!=`function`)throw TypeError(`decide requires a provider decision model implementation, not just its identity.`);return s({model:typeof e==`string`?localGatewayDecisionModel(e)??e:e,state:t,questions:n,maxRetries:r,abortSignal:i,providerOptions:a,...o})}export{DEFAULT_DECISION_MODEL,decideWithMetadata,resolveDecisionModel};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{resolveApprovalPolicy}from"#approval/definition.js";import{normalizeApprovalStatus}from"#approval/status.js";function rank(e){let t=normalizeApprovalStatus(e)
|
|
1
|
+
import{resolveApprovalPolicy}from"#approval/definition.js";import{normalizeApprovalStatus}from"#approval/status.js";function rank(e){let t=normalizeApprovalStatus(e);let n=typeof t==`object`?t.type:t;return n===`denied`?3:n===`user-approval`?2:+(n===`approved`)}function strictestApproval(e){return async t=>{let n;for(let r of e){let e=await r(t);if(rank(e)>=rank(n)&&(n=e),rank(n)===3)break}return n}}function withAgentApproval(e,t){if(e===void 0)return t;if(t===void 0)return e;let n=strictestApproval([e,resolveApprovalPolicy(t)]);return typeof t==`function`?n:{...t,request:n}}function withAgentApprovalOnEntries(e,t){return t===void 0?new Map(e):new Map([...e].map(([e,n])=>[e,n.frameworkAction!==void 0||n.interactionOnly===!0?n:{...n,approval:withAgentApproval(t,n.approval)}]))}export{strictestApproval,withAgentApproval,withAgentApprovalOnEntries};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{approvalDecision}from"#approval/status.js";const NO_MEMORY={pending:[],remembered:{}}
|
|
1
|
+
import{approvalDecision}from"#approval/status.js";const NO_MEMORY={pending:[],remembered:{}};const evaluationKey=Symbol.for(`eve.approval-evaluation`);function approvalEvaluation(e){return e[evaluationKey]}async function evaluateApproval(e,t,n={}){let{memory:r=NO_MEMORY,recheck:i=!1}=n;let a=new WeakMap;let scoped=e=>JSON.stringify([t.toolName,e]);let o=Object.freeze({ask:e=>{let t=Object.freeze({type:`user-approval`});return a.set(t,{...e,key:scoped(e.key)}),t},read:e=>({entry:r.remembered[scoped(e)],pending:r.pending.includes(scoped(e))}),recheck:i});let s=await e({...t,[evaluationKey]:o});let c=approvalDecision(s);if(c.awaitsPerson!==!0)return c;if(i)return{denied:!1};let l=typeof s==`object`&&s?a.get(s):void 0;return l===void 0?c:{...c,remember:l}}function rememberDecision(e,t,n){let{remember:r}=t;return r===void 0?e:{...e,[r.key]:{interactionId:t.interactionId,outcome:n,...r.state!==void 0&&{state:r.state}}}}function inheritApprovalContext(e,t){let n=approvalEvaluation(e);return n===void 0||approvalEvaluation(t)===n?t:{...t,[evaluationKey]:n}}function isApprovalRecheck(e){return approvalEvaluation(e)?.recheck===!0}export{approvalEvaluation,evaluateApproval,inheritApprovalContext,isApprovalRecheck,rememberDecision};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
function normalizeApprovalStatus(e){if(e===void 0)return;if(e===!1)return`not-applicable`;if(e===!0)return`user-approval`;let t=typeof e==`object`&&e?Reflect.get(e,`type`):e;if(t!==`not-applicable`&&t!==`approved`&&t!==`denied`&&t!==`user-approval`)throw Error(`An approval policy must return an approval status, a boolean, or undefined.`);if(typeof e!=`object`||!e)return t;let n=Reflect.get(e,`reason`);if(n!==void 0&&(typeof n!=`string`||t!==`approved`&&t!==`denied`))throw Error(`Only approved and denied approval statuses accept a string reason.`);return t===`approved`||t===`denied`?n===void 0?{type:t}:{type:t,reason:n}:{type:t}}function approvalDecision(e){let t=normalizeApprovalStatus(e)
|
|
1
|
+
function normalizeApprovalStatus(e){if(e===void 0)return;if(e===!1)return`not-applicable`;if(e===!0)return`user-approval`;let t=typeof e==`object`&&e?Reflect.get(e,`type`):e;if(t!==`not-applicable`&&t!==`approved`&&t!==`denied`&&t!==`user-approval`)throw Error(`An approval policy must return an approval status, a boolean, or undefined.`);if(typeof e!=`object`||!e)return t;let n=Reflect.get(e,`reason`);if(n!==void 0&&(typeof n!=`string`||t!==`approved`&&t!==`denied`))throw Error(`Only approved and denied approval statuses accept a string reason.`);return t===`approved`||t===`denied`?n===void 0?{type:t}:{type:t,reason:n}:{type:t}}function approvalDecision(e){let t=normalizeApprovalStatus(e);let n=typeof t==`object`?t.type:t;let r=typeof t==`object`?t.reason:void 0;return n===`user-approval`?{denied:!1,awaitsPerson:!0}:n===`denied`?{denied:!0,reason:r}:n===`approved`?{denied:!1,clearedBy:{policy:`approval`}}:{denied:!1}}export{approvalDecision,normalizeApprovalStatus};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{buildChannelContext}from"#channel/session.js";function buildAdapterContext(e,t){let n=buildChannelContext(t)
|
|
1
|
+
import{buildChannelContext}from"#channel/session.js";function buildAdapterContext(e,t){let n=buildChannelContext(t);let r={ctx:t,state:e.state??{},session:n.session,get continuation(){return n.continuation}};return e.createAdapterContext?e.createAdapterContext(r):r}export{buildAdapterContext};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{attachClientContext,readClientContext}from"#internal/client-context.js";import{attachInputText,readInputText}from"#internal/input-text.js";import{createLogger}from"#internal/logging.js";const log=createLogger(`channel.adapter`);function defaultDeliverResult(e){if(e.message!==void 0)return attachClientContext(attachInputText({answers:e.answers,message:e.message,context:e.context,outputSchema:e.outputSchema},readInputText(e)),readClientContext(e));if(e.answers!==void 0&&e.answers.length>0)return attachClientContext({answers:e.answers,context:e.context,outputSchema:e.outputSchema},readClientContext(e));if(e.context!==void 0&&e.context.length>0||(readClientContext(e)?.length??0)>0)return attachClientContext({context:e.context,outputSchema:e.outputSchema},readClientContext(e));if(e.outputSchema!==void 0)return{outputSchema:e.outputSchema}}function getAdapterKind(e){return e.kind}function seedChannelState(e,t){return{...structuredClone(e),...t}}async function callAdapterEventHandler(e,t,n){let r=`facts`in t?`committed`:t.type
|
|
1
|
+
import{attachClientContext,readClientContext}from"#internal/client-context.js";import{attachInputText,readInputText}from"#internal/input-text.js";import{createLogger}from"#internal/logging.js";const log=createLogger(`channel.adapter`);function defaultDeliverResult(e){if(e.message!==void 0)return attachClientContext(attachInputText({answers:e.answers,message:e.message,context:e.context,outputSchema:e.outputSchema},readInputText(e)),readClientContext(e));if(e.answers!==void 0&&e.answers.length>0)return attachClientContext({answers:e.answers,context:e.context,outputSchema:e.outputSchema},readClientContext(e));if(e.context!==void 0&&e.context.length>0||(readClientContext(e)?.length??0)>0)return attachClientContext({context:e.context,outputSchema:e.outputSchema},readClientContext(e));if(e.outputSchema!==void 0)return{outputSchema:e.outputSchema}}function getAdapterKind(e){return e.kind}function seedChannelState(e,t){return{...structuredClone(e),...t}}async function callAdapterEventHandler(e,t,n){let r=`facts`in t?`committed`:t.type;let i=e[r];if(i!==void 0)try{await i(t,n)}catch(t){log.error(`adapter event handler threw — event swallowed`,{adapterKind:getAdapterKind(e),eventType:r,error:t})}}export{callAdapterEventHandler,defaultDeliverResult,getAdapterKind,seedChannelState};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{SkillReadError,comparePaths,createCompiledSkillFileSource,readSkillFile}from"#channel/skill-files.js";import{isInvocableCompiledTool}from"#channel/tool-eligibility.js";import{resolveRuntimeCompiledArtifactsVersionedCacheKey}from"#runtime/cache-key.js";import{getRuntimeCompiledArtifactsCacheKey}from"#runtime/compiled-artifacts-source.js";import{loadCompiledManifest}from"#runtime/loaders/manifest.js";import{getActiveRuntimeSession}from"#runtime/sessions/runtime-session.js";async function loadDescribedAgent(e){let t=getActiveRuntimeSession()
|
|
1
|
+
import{SkillReadError,comparePaths,createCompiledSkillFileSource,readSkillFile}from"#channel/skill-files.js";import{isInvocableCompiledTool}from"#channel/tool-eligibility.js";import{resolveRuntimeCompiledArtifactsVersionedCacheKey}from"#runtime/cache-key.js";import{getRuntimeCompiledArtifactsCacheKey}from"#runtime/compiled-artifacts-source.js";import{loadCompiledManifest}from"#runtime/loaders/manifest.js";import{getActiveRuntimeSession}from"#runtime/sessions/runtime-session.js";async function loadDescribedAgent(e){let t=getActiveRuntimeSession();let n=getRuntimeCompiledArtifactsCacheKey(e);let r=await resolveRuntimeCompiledArtifactsVersionedCacheKey(e);let i=t.describedAgents.get(n);if(i?.version===r)return await i.agent;let a=loadCompiledManifest({compiledArtifactsSource:e}).then(t=>({description:describeCompiledAgent(t),files:createCompiledSkillFileSource({compiledArtifactsSource:e,workspaceResourceRoot:t.workspaceResourceRoot})}));return a.catch(()=>{t.describedAgents.get(n)?.agent===a&&t.describedAgents.delete(n)}),t.describedAgents.set(n,{agent:a,version:r}),await a}function createAgentDescriptionRouteArgs(e){let load=()=>loadDescribedAgent(e());let t={listFiles:async e=>await(await load()).files.listFiles(e),listDirectories:async e=>await(await load()).files.listDirectories(e),readFile:async(e,t)=>await(await load()).files.readFile(e,t)};let assertSkill=async e=>{let{description:t}=await load();if(!t.skills.some(t=>t.name===e))throw new SkillReadError(`unknown-skill`,`Unknown skill "${e}".`)};return{args:{describe:async()=>(await load()).description,async listSkillFiles(e){return await assertSkill(e),await t.listFiles(e)},async readSkill(e,n){return await assertSkill(e),await readSkillFile({path:n,skill:e,source:t})}},skillFiles:t}}function describeCompiledAgent(e){let t=e.tools.filter(t=>isInvocableCompiledTool(e,t)).sort((e,t)=>comparePaths(e.name,t.name)).map(describeTool);let n=[...e.skills].sort((e,t)=>comparePaths(e.name,t.name)).map(({name:e,description:t})=>({name:e,description:t}));let r={name:e.config.name,tools:t,skills:n};return e.config.description!==void 0&&(r.description=e.config.description),r}function describeTool(e){let t={name:e.name,description:e.description,inputSchema:e.inputSchema??{},approval:e.requiresApproval};return e.outputSchema!==void 0&&(t.outputSchema=e.outputSchema),t}export{createAgentDescriptionRouteArgs,describeCompiledAgent,loadDescribedAgent};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{createLogger}from"#internal/logging.js";import{decodeJwt}from"#compiled/jose/index.js";import{ANONYMOUS_SESSION_AUTH_CONTEXT}from"#channel/principal-identity.js";import{isEveDevEnvironment,isLocalDevelopmentServer}from"#internal/application/dev-environment.js";import{isLocalMachineAddress,readTrustedDevelopmentPeer}from"#internal/nitro/dev-client-address.js";import{authenticateHttpBasicStrategy}from"#channel/auth/http-basic.js";import{authenticateJwtEcdsaStrategy}from"#channel/auth/jwt-ecdsa.js";import{authenticateJwtHmacStrategy}from"#channel/auth/jwt-hmac.js";import{authenticateOidcStrategy}from"#channel/auth/oidc.js";import{resolveVercelOidcCurrentProject}from"#channel/auth/vercel-oidc-project.js";import{createRuntimeSessionAuthContext}from"#channel/auth/types.js";import{isVercelOidcIssuer}from"#shared/vercel-project.js";import{createRuntimeIpAllowList,isRuntimeIpAllowed}from"#channel/ip-allow-list.js";import{isLoopbackHostname}from"#shared/network-address.js";const vercelOidcLog=createLogger(`auth.vercel-oidc`);function verifyHttpBasic(e,t){if(e===null)return{ok:!1};let n=authenticateHttpBasicStrategy({authorization:e,strategy:{kind:`http-basic`,password:t.password,username:t.username}});return n.kind===`authenticated`?{ok:!0,sessionAuth:createRuntimeSessionAuthContext(n.principal)}:{ok:!1}}async function verifyJwtHmac(e,t){if(e===null||e.length===0)return{ok:!1};let n={algorithm:t.algorithm,audiences:[...t.audiences],clockSkewSeconds:t.clockSkewSeconds??30,issuer:t.issuer,kind:`jwt-hmac`,secret:t.secret,claims:t.claims,subjects:t.subjects},r=await authenticateJwtHmacStrategy({strategy:n,token:e});return r.kind===`authenticated`?{ok:!0,sessionAuth:createRuntimeSessionAuthContext(r.principal)}:{ok:!1}}async function verifyJwtEcdsa(e,t){if(e===null||e.length===0)return{ok:!1};let n={algorithm:t.algorithm,audiences:[...t.audiences],clockSkewSeconds:t.clockSkewSeconds??30,issuer:t.issuer,kind:`jwt-ecdsa`,publicKey:t.publicKey,claims:t.claims,subjects:t.subjects},r=await authenticateJwtEcdsaStrategy({strategy:n,token:e});return r.kind===`authenticated`?{ok:!0,sessionAuth:createRuntimeSessionAuthContext(r.principal)}:{ok:!1}}async function verifyOidc(e,t){let n=await runOidcVerification(e,{...t,acceptCurrentVercelProject:!1,currentVercelProject:void 0});return n.kind===`authenticated`?{ok:!0,sessionAuth:createRuntimeSessionAuthContext(n.principal)}:{ok:!1}}async function runOidcVerification(e,t){if(e===null||e.length===0)return{kind:`not-authenticated`};let n={acceptCurrentVercelProject:t.acceptCurrentVercelProject,audiences:[...t.audiences],clockSkewSeconds:t.clockSkewSeconds??30,discoveryUrl:t.discoveryUrl??`${t.issuer.replace(/\/$/,``)}/.well-known/openid-configuration`,issuer:t.issuer,kind:`oidc`,claims:t.claims,subjects:t.subjects},r=t.currentVercelProject===void 0?n:{...n,currentVercelProject:t.currentVercelProject};return await authenticateOidcStrategy({strategy:r,token:e})}function extractBearerToken(e){if(e===null)return null;let t=/^Bearer\s+(.+)$/i.exec(e)?.[1]?.trim();return t===void 0||t.length===0?null:t}function createIpAllowList(e){return createRuntimeIpAllowList(e)}function isIpAllowed(e,t){return e!==null&&isRuntimeIpAllowed(e,t)}function createUnauthorizedResponse(e={}){let t=e.status??401,n=e.code??(t===403?`forbidden`:`unauthorized`),r=e.message??(t===403?`Forbidden.`:`Authorization is required for this route.`),i=e.challenges??[],a=new Headers({"cache-control":`no-store`});for(let e of i)a.append(`www-authenticate`,formatChallenge(e));return Response.json({code:n,error:r,ok:!1},{headers:a,status:t})}function formatChallenge(e){if(e.parameters===void 0||Object.keys(e.parameters).length===0)return e.scheme;let t=Object.entries(e.parameters).map(([e,t])=>`${e}="${escapeAuthChallengeParameter(t)}"`).join(`, `);return`${e.scheme} ${t}`}function escapeAuthChallengeParameter(e){return e.replaceAll(`\\`,`\\\\`).replaceAll(`"`,`\\"`)}function isValidOAuthIdentifierUrl(e){try{let t=new URL(e);return(t.protocol===`https:`||t.protocol===`http:`&&isLoopbackHostname(t.hostname))&&t.username.length===0&&t.password.length===0&&t.search.length===0&&t.hash.length===0}catch{return!1}}function isValidMetadataPath(e){if(!e.startsWith(`/`)||e.startsWith(`//`))return!1;let t=new URL(e,`https://eve.invalid`);return t.origin===`https://eve.invalid`&&t.search.length===0&&t.hash.length===0}var UnauthenticatedError=class extends Error{response;constructor(e={}){super(e.message??`Authorization is required for this route.`),this.name=`UnauthenticatedError`,this.response=createUnauthorizedResponse({...e,status:401})}},ForbiddenError=class extends Error{response;constructor(e={}){super(e.message??`Forbidden.`),this.name=`ForbiddenError`,this.response=createUnauthorizedResponse({...e,status:403})}};const OAUTH_RESOURCE_SYMBOL=Symbol.for(`eve.channels.auth.oauthResource`);function oauthResource(e,t){let n=t.issuer===void 0?t.authorizationServers:[t.issuer];if(n.length===0||n.some(e=>!isValidOAuthIdentifierUrl(e)))throw Error(`oauthResource requires at least one HTTPS authorization server URL (HTTP is allowed only on loopback).`);if(t.resource!==void 0&&!isValidOAuthIdentifierUrl(t.resource))throw Error(`oauthResource resource must be an HTTPS URL without credentials, query, or fragment (HTTP is allowed only on loopback).`);if(t.metadataPath!==void 0&&!isValidMetadataPath(t.metadataPath))throw Error(`oauthResource metadataPath must be an absolute path without a host, query, or fragment.`);let r=Array.isArray(e)?e:[e],composed=async e=>{for(let t of r){let n=await t(e);if(n)return n}return null},i=collectDeclaredChallenges(r),a=withAuthChallenges(composed,i.length>0?i:[{scheme:`Bearer`}]);return Object.defineProperty(a,OAUTH_RESOURCE_SYMBOL,{enumerable:!1,value:t}),a}function readOAuthResourceOptions(e){if(!Array.isArray(e))return e[OAUTH_RESOURCE_SYMBOL]}const AUTH_CHALLENGES_SYMBOL=Symbol.for(`eve.channels.auth.challenges`);function withAuthChallenges(e,t){let wrapped=t=>e(t);return Object.defineProperty(wrapped,AUTH_CHALLENGES_SYMBOL,{value:t}),wrapped}function getDeclaredChallenges(e){return e[AUTH_CHALLENGES_SYMBOL]}function collectDeclaredChallenges(e){let t=new Set,n=[];for(let r of e)for(let e of getDeclaredChallenges(r)??[]){let r=formatChallenge(e);t.has(r)||(t.add(r),n.push(e))}return n}async function routeAuth(e,t){let n=Array.isArray(t)?t:[t];try{for(let t of n){let n=await t(e);if(n)return n}}catch(e){if(typeof e==`object`&&e&&`response`in e&&e.response instanceof Response)return e.response;throw e}let r=collectDeclaredChallenges(n);return createUnauthorizedResponse({challenges:r.length>0?addInvalidBearerTokenError(e,r):[{scheme:`Bearer`}]})}function addInvalidBearerTokenError(e,t){let n=e.headers.get(`authorization`);return n===null||!/^Bearer(?:\s|$)/i.test(n.trim())||!t.some(e=>e.scheme===`Bearer`)?t:t.map(e=>e.scheme!==`Bearer`||e.parameters?.error!==void 0?e:{...e,parameters:{...e.parameters,error:`invalid_token`}})}function placeholderAuth(){return()=>{if(process.env.VERCEL_ENV!==`production`)return null;throw new UnauthenticatedError({code:`eve_production_auth_not_configured`,message:`Production auth is not configured. Replace placeholderAuth() in agent/channels/eve.ts with your app's auth provider.`})}}function none(){return()=>ANONYMOUS_SESSION_AUTH_CONTEXT}const LOCAL_DEV_AUTH_SYMBOL=Symbol.for(`eve.channels.auth.localDev`);function localDev(){let authenticate=e=>isLocalDevelopmentServer()&&!isCrossSiteBrowserRequest(e)&&!isFromRemotePeer(e)?LOCAL_DEV_SESSION_AUTH_CONTEXT:null;return Object.defineProperty(authenticate,LOCAL_DEV_AUTH_SYMBOL,{value:!0}),authenticate}function isLocalDevAuth(e){return e[LOCAL_DEV_AUTH_SYMBOL]===!0}function isCrossSiteBrowserRequest(e){if(!isLocalMachineAddress(new URL(e.url).hostname))return!0;let t=e.headers.get(`origin`);if(t===null)return!1;let n=URL.parse(t)?.hostname;return n===void 0||!isLocalMachineAddress(n)}function isFromRemotePeer(e){return readTrustedDevelopmentPeer(e.headers)===`remote`}const LOCAL_DEV_SESSION_AUTH_CONTEXT={attributes:{},authenticator:`local-dev`,principalId:`local-dev`,principalType:`local-dev`};async function verifyVercelOidc(e,t={}){if(e===null||e.length===0)return{ok:!1};let n=decodeUnverifiedJwtClaims(e);if(n===null)return vercelOidcLog.debug(`Rejected token that failed to decode as a JWT.`),{ok:!1};if(!isVercelOidcIssuer(n.issuer))return vercelOidcLog.debug(`Rejected token whose issuer is not a Vercel OIDC issuer.`,{issuer:n.issuer}),{ok:!1};if(n.audiences.length===0)return vercelOidcLog.debug(`Rejected token with no audience claim.`,{issuer:n.issuer}),{ok:!1};if(!n.audiences.some(e=>e.startsWith(`https://vercel.com/`)))return vercelOidcLog.debug(`Rejected token whose audience is not a Vercel audience.`,{audiences:n.audiences,issuer:n.issuer}),{ok:!1};let r=resolveCurrentVercelProject(t),i=await runOidcVerification(e,{acceptCurrentVercelProject:!0,audiences:n.audiences,currentVercelProject:r,issuer:n.issuer,subjects:t.subjects??[]});return i.kind===`authenticated`?(vercelOidcLog.debug(`Accepted Vercel OIDC token.`,{issuer:n.issuer,principalType:i.principal.principalType,subject:i.principal.subject}),{ok:!0,sessionAuth:createRuntimeSessionAuthContext(i.principal)}):(vercelOidcLog.debug(`Rejected Vercel OIDC token after verification.`,{audiences:n.audiences,issuer:n.issuer,reason:i.kind,subjectsConfigured:(t.subjects??[]).length>0,detail:i.kind===`misconfigured`?i.message:void 0}),{ok:!1})}function resolveCurrentVercelProject(e){if(e.currentVercelProject!==void 0)return e.currentVercelProject;let t=process.env.VERCEL_PROJECT_ID?.trim();if(t===void 0||t.length===0)return;let n=process.env.VERCEL_TARGET_ENV?.trim()||process.env.VERCEL_ENV?.trim();return n===void 0||n.length===0?{projectId:t}:{environment:n,projectId:t}}function vercelSubject(e){assertVercelSubjectSegment(`teamSlug`,e.teamSlug),assertVercelSubjectSegment(`projectName`,e.projectName);let t=e.environment??`production`;if(t!==`production`&&t!==`preview`&&t!==`development`&&t!==`*`)throw Error(`vercelSubject: invalid environment ${JSON.stringify(t)}; expected "production", "preview", "development", or "*".`);return`owner:${e.teamSlug}:project:${e.projectName}:environment:${t}`}function assertVercelSubjectSegment(e,t){if(t.length===0)throw Error(`vercelSubject: ${e} must be a non-empty string.`);if(t.includes(`*`)||t.includes(`:`))throw Error(`vercelSubject: ${e} ${JSON.stringify(t)} may not contain ${t.includes(`:`)?`':'`:`'*'`}. Hand-write the subject string when wildcards are intentional.`)}function vercelOidc(e={}){if(e.subjects?.some(e=>typeof e!=`string`))throw TypeError(`vercelOidc: every subjects entry must be a string. For entries such as { subject, allowToolStubs: true }, use eveVercelOidc from "eve/channels/eve".`);return withAuthChallenges(async t=>{let n=extractBearerToken(t.headers.get(`authorization`)),r=e.currentVercelProject??(n!==null&&isLocalDevelopmentVercelOidc()?await resolveVercelOidcCurrentProject(t):void 0),i=await verifyVercelOidc(n,r===void 0?e:{...e,currentVercelProject:r});return i.ok?i.sessionAuth:null},[{scheme:`Bearer`}])}function isLocalDevelopmentVercelOidc(){return process.env.VERCEL_ENV===`development`?!0:process.env.VERCEL_ENV===`preview`||process.env.VERCEL_ENV===`production`?!1:isEveDevEnvironment()}function httpBasic(e,t){return withAuthChallenges(t=>{let n=verifyHttpBasic(t.headers.get(`authorization`),e);return n.ok?n.sessionAuth:null},[{parameters:{realm:t?.realm??`eve`,charset:`UTF-8`},scheme:`Basic`}])}function jwtHmac(e){return withAuthChallenges(async t=>{let n=await verifyJwtHmac(extractBearerToken(t.headers.get(`authorization`)),e);return n.ok?n.sessionAuth:null},[{scheme:`Bearer`}])}function jwtEcdsa(e){return withAuthChallenges(async t=>{let n=await verifyJwtEcdsa(extractBearerToken(t.headers.get(`authorization`)),e);return n.ok?n.sessionAuth:null},[{scheme:`Bearer`}])}function oidc(e){return withAuthChallenges(async t=>{let n=await verifyOidc(extractBearerToken(t.headers.get(`authorization`)),e);return n.ok?n.sessionAuth:null},[{scheme:`Bearer`}])}function decodeUnverifiedJwtClaims(e){let t;try{t=decodeJwt(e)}catch{return null}return typeof t.iss!=`string`||t.iss.length===0?null:{audiences:typeof t.aud==`string`?[t.aud]:Array.isArray(t.aud)?t.aud.filter(e=>typeof e==`string`):[],issuer:t.iss}}export{ForbiddenError,UnauthenticatedError,createIpAllowList,createUnauthorizedResponse,escapeAuthChallengeParameter,extractBearerToken,httpBasic,isIpAllowed,isLocalDevAuth,jwtEcdsa,jwtHmac,localDev,none,oauthResource,oidc,placeholderAuth,readOAuthResourceOptions,routeAuth,vercelOidc,vercelSubject,verifyHttpBasic,verifyJwtEcdsa,verifyJwtHmac,verifyOidc,verifyVercelOidc,withAuthChallenges};
|
|
1
|
+
import{createLogger}from"#internal/logging.js";import{decodeJwt}from"#compiled/jose/index.js";import{ANONYMOUS_SESSION_AUTH_CONTEXT}from"#channel/principal-identity.js";import{isEveDevEnvironment,isLocalDevelopmentServer}from"#internal/application/dev-environment.js";import{isLocalMachineAddress,readTrustedDevelopmentPeer}from"#internal/nitro/dev-client-address.js";import{authenticateHttpBasicStrategy}from"#channel/auth/http-basic.js";import{authenticateJwtEcdsaStrategy}from"#channel/auth/jwt-ecdsa.js";import{authenticateJwtHmacStrategy}from"#channel/auth/jwt-hmac.js";import{authenticateOidcStrategy}from"#channel/auth/oidc.js";import{resolveVercelOidcCurrentProject}from"#channel/auth/vercel-oidc-project.js";import{createRuntimeSessionAuthContext}from"#channel/auth/types.js";import{isVercelOidcIssuer}from"#shared/vercel-project.js";import{createRuntimeIpAllowList,isRuntimeIpAllowed}from"#channel/ip-allow-list.js";import{isLoopbackHostname}from"#shared/network-address.js";const vercelOidcLog=createLogger(`auth.vercel-oidc`);function verifyHttpBasic(e,t){if(e===null)return{ok:!1};let n=authenticateHttpBasicStrategy({authorization:e,strategy:{kind:`http-basic`,password:t.password,username:t.username}});return n.kind===`authenticated`?{ok:!0,sessionAuth:createRuntimeSessionAuthContext(n.principal)}:{ok:!1}}async function verifyJwtHmac(e,t){if(e===null||e.length===0)return{ok:!1};let n={algorithm:t.algorithm,audiences:[...t.audiences],clockSkewSeconds:t.clockSkewSeconds??30,issuer:t.issuer,kind:`jwt-hmac`,secret:t.secret,claims:t.claims,subjects:t.subjects};let r=await authenticateJwtHmacStrategy({strategy:n,token:e});return r.kind===`authenticated`?{ok:!0,sessionAuth:createRuntimeSessionAuthContext(r.principal)}:{ok:!1}}async function verifyJwtEcdsa(e,t){if(e===null||e.length===0)return{ok:!1};let n={algorithm:t.algorithm,audiences:[...t.audiences],clockSkewSeconds:t.clockSkewSeconds??30,issuer:t.issuer,kind:`jwt-ecdsa`,publicKey:t.publicKey,claims:t.claims,subjects:t.subjects};let r=await authenticateJwtEcdsaStrategy({strategy:n,token:e});return r.kind===`authenticated`?{ok:!0,sessionAuth:createRuntimeSessionAuthContext(r.principal)}:{ok:!1}}async function verifyOidc(e,t){let n=await runOidcVerification(e,{...t,acceptCurrentVercelProject:!1,currentVercelProject:void 0});return n.kind===`authenticated`?{ok:!0,sessionAuth:createRuntimeSessionAuthContext(n.principal)}:{ok:!1}}async function runOidcVerification(e,t){if(e===null||e.length===0)return{kind:`not-authenticated`};let n={acceptCurrentVercelProject:t.acceptCurrentVercelProject,audiences:[...t.audiences],clockSkewSeconds:t.clockSkewSeconds??30,discoveryUrl:t.discoveryUrl??`${t.issuer.replace(/\/$/,``)}/.well-known/openid-configuration`,issuer:t.issuer,kind:`oidc`,claims:t.claims,subjects:t.subjects};let r=t.currentVercelProject===void 0?n:{...n,currentVercelProject:t.currentVercelProject};return await authenticateOidcStrategy({strategy:r,token:e})}function extractBearerToken(e){if(e===null)return null;let t=/^Bearer\s+(.+)$/i.exec(e)?.[1]?.trim();return t===void 0||t.length===0?null:t}function createIpAllowList(e){return createRuntimeIpAllowList(e)}function isIpAllowed(e,t){return e!==null&&isRuntimeIpAllowed(e,t)}function createUnauthorizedResponse(e={}){let t=e.status??401;let n=e.code??(t===403?`forbidden`:`unauthorized`);let r=e.message??(t===403?`Forbidden.`:`Authorization is required for this route.`);let i=e.challenges??[];let a=new Headers({"cache-control":`no-store`});for(let e of i)a.append(`www-authenticate`,formatChallenge(e));return Response.json({code:n,error:r,ok:!1},{headers:a,status:t})}function formatChallenge(e){if(e.parameters===void 0||Object.keys(e.parameters).length===0)return e.scheme;let t=Object.entries(e.parameters).map(([e,t])=>`${e}="${escapeAuthChallengeParameter(t)}"`).join(`, `);return`${e.scheme} ${t}`}function escapeAuthChallengeParameter(e){return e.replaceAll(`\\`,`\\\\`).replaceAll(`"`,`\\"`)}function isValidOAuthIdentifierUrl(e){try{let t=new URL(e);return(t.protocol===`https:`||t.protocol===`http:`&&isLoopbackHostname(t.hostname))&&t.username.length===0&&t.password.length===0&&t.search.length===0&&t.hash.length===0}catch{return!1}}function isValidMetadataPath(e){if(!e.startsWith(`/`)||e.startsWith(`//`))return!1;let t=new URL(e,`https://eve.invalid`);return t.origin===`https://eve.invalid`&&t.search.length===0&&t.hash.length===0}var UnauthenticatedError=class extends Error{response;constructor(e={}){super(e.message??`Authorization is required for this route.`),this.name=`UnauthenticatedError`,this.response=createUnauthorizedResponse({...e,status:401})}};var ForbiddenError=class extends Error{response;constructor(e={}){super(e.message??`Forbidden.`),this.name=`ForbiddenError`,this.response=createUnauthorizedResponse({...e,status:403})}};const OAUTH_RESOURCE_SYMBOL=Symbol.for(`eve.channels.auth.oauthResource`);function oauthResource(e,t){let n=t.issuer===void 0?t.authorizationServers:[t.issuer];if(n.length===0||n.some(e=>!isValidOAuthIdentifierUrl(e)))throw Error(`oauthResource requires at least one HTTPS authorization server URL (HTTP is allowed only on loopback).`);if(t.resource!==void 0&&!isValidOAuthIdentifierUrl(t.resource))throw Error(`oauthResource resource must be an HTTPS URL without credentials, query, or fragment (HTTP is allowed only on loopback).`);if(t.metadataPath!==void 0&&!isValidMetadataPath(t.metadataPath))throw Error(`oauthResource metadataPath must be an absolute path without a host, query, or fragment.`);let r=Array.isArray(e)?e:[e];let composed=async e=>{for(let t of r){let n=await t(e);if(n)return n}return null};let i=collectDeclaredChallenges(r);let a=withAuthChallenges(composed,i.length>0?i:[{scheme:`Bearer`}]);return Object.defineProperty(a,OAUTH_RESOURCE_SYMBOL,{enumerable:!1,value:t}),a}function readOAuthResourceOptions(e){if(!Array.isArray(e))return e[OAUTH_RESOURCE_SYMBOL]}const AUTH_CHALLENGES_SYMBOL=Symbol.for(`eve.channels.auth.challenges`);function withAuthChallenges(e,t){let wrapped=t=>e(t);return Object.defineProperty(wrapped,AUTH_CHALLENGES_SYMBOL,{value:t}),wrapped}function getDeclaredChallenges(e){return e[AUTH_CHALLENGES_SYMBOL]}function collectDeclaredChallenges(e){let t=new Set;let n=[];for(let r of e)for(let e of getDeclaredChallenges(r)??[]){let r=formatChallenge(e);t.has(r)||(t.add(r),n.push(e))}return n}async function routeAuth(e,t){let n=Array.isArray(t)?t:[t];try{for(let t of n){let n=await t(e);if(n)return n}}catch(e){if(typeof e==`object`&&e&&`response`in e&&e.response instanceof Response)return e.response;throw e}let r=collectDeclaredChallenges(n);return createUnauthorizedResponse({challenges:r.length>0?addInvalidBearerTokenError(e,r):[{scheme:`Bearer`}]})}function addInvalidBearerTokenError(e,t){let n=e.headers.get(`authorization`);return n===null||!/^Bearer(?:\s|$)/i.test(n.trim())||!t.some(e=>e.scheme===`Bearer`)?t:t.map(e=>e.scheme!==`Bearer`||e.parameters?.error!==void 0?e:{...e,parameters:{...e.parameters,error:`invalid_token`}})}function placeholderAuth(){return()=>{if(process.env.VERCEL_ENV!==`production`)return null;throw new UnauthenticatedError({code:`eve_production_auth_not_configured`,message:`Production auth is not configured. Replace placeholderAuth() in agent/channels/eve.ts with your app's auth provider.`})}}function none(){return()=>ANONYMOUS_SESSION_AUTH_CONTEXT}const LOCAL_DEV_AUTH_SYMBOL=Symbol.for(`eve.channels.auth.localDev`);function localDev(){let authenticate=e=>isLocalDevelopmentServer()&&!isCrossSiteBrowserRequest(e)&&!isFromRemotePeer(e)?LOCAL_DEV_SESSION_AUTH_CONTEXT:null;return Object.defineProperty(authenticate,LOCAL_DEV_AUTH_SYMBOL,{value:!0}),authenticate}function isLocalDevAuth(e){return e[LOCAL_DEV_AUTH_SYMBOL]===!0}function isCrossSiteBrowserRequest(e){if(!isLocalMachineAddress(new URL(e.url).hostname))return!0;let t=e.headers.get(`origin`);if(t===null)return!1;let n=URL.parse(t)?.hostname;return n===void 0||!isLocalMachineAddress(n)}function isFromRemotePeer(e){return readTrustedDevelopmentPeer(e.headers)===`remote`}const LOCAL_DEV_SESSION_AUTH_CONTEXT={attributes:{},authenticator:`local-dev`,principalId:`local-dev`,principalType:`local-dev`};async function verifyVercelOidc(e,t={}){if(e===null||e.length===0)return{ok:!1};let n=decodeUnverifiedJwtClaims(e);if(n===null)return vercelOidcLog.debug(`Rejected token that failed to decode as a JWT.`),{ok:!1};if(!isVercelOidcIssuer(n.issuer))return vercelOidcLog.debug(`Rejected token whose issuer is not a Vercel OIDC issuer.`,{issuer:n.issuer}),{ok:!1};if(n.audiences.length===0)return vercelOidcLog.debug(`Rejected token with no audience claim.`,{issuer:n.issuer}),{ok:!1};if(!n.audiences.some(e=>e.startsWith(`https://vercel.com/`)))return vercelOidcLog.debug(`Rejected token whose audience is not a Vercel audience.`,{audiences:n.audiences,issuer:n.issuer}),{ok:!1};let r=resolveCurrentVercelProject(t);let i=await runOidcVerification(e,{acceptCurrentVercelProject:!0,audiences:n.audiences,currentVercelProject:r,issuer:n.issuer,subjects:t.subjects??[]});return i.kind===`authenticated`?(vercelOidcLog.debug(`Accepted Vercel OIDC token.`,{issuer:n.issuer,principalType:i.principal.principalType,subject:i.principal.subject}),{ok:!0,sessionAuth:createRuntimeSessionAuthContext(i.principal)}):(vercelOidcLog.debug(`Rejected Vercel OIDC token after verification.`,{audiences:n.audiences,issuer:n.issuer,reason:i.kind,subjectsConfigured:(t.subjects??[]).length>0,detail:i.kind===`misconfigured`?i.message:void 0}),{ok:!1})}function resolveCurrentVercelProject(e){if(e.currentVercelProject!==void 0)return e.currentVercelProject;let t=process.env.VERCEL_PROJECT_ID?.trim();if(t===void 0||t.length===0)return;let n=process.env.VERCEL_TARGET_ENV?.trim()||process.env.VERCEL_ENV?.trim();return n===void 0||n.length===0?{projectId:t}:{environment:n,projectId:t}}function vercelSubject(e){assertVercelSubjectSegment(`teamSlug`,e.teamSlug),assertVercelSubjectSegment(`projectName`,e.projectName);let t=e.environment??`production`;if(t!==`production`&&t!==`preview`&&t!==`development`&&t!==`*`)throw Error(`vercelSubject: invalid environment ${JSON.stringify(t)}; expected "production", "preview", "development", or "*".`);return`owner:${e.teamSlug}:project:${e.projectName}:environment:${t}`}function assertVercelSubjectSegment(e,t){if(t.length===0)throw Error(`vercelSubject: ${e} must be a non-empty string.`);if(t.includes(`*`)||t.includes(`:`))throw Error(`vercelSubject: ${e} ${JSON.stringify(t)} may not contain ${t.includes(`:`)?`':'`:`'*'`}. Hand-write the subject string when wildcards are intentional.`)}function vercelOidc(e={}){if(e.subjects?.some(e=>typeof e!=`string`))throw TypeError(`vercelOidc: every subjects entry must be a string. For entries such as { subject, allowToolStubs: true }, use eveVercelOidc from "eve/channels/eve".`);return withAuthChallenges(async t=>{let n=extractBearerToken(t.headers.get(`authorization`));let r=e.currentVercelProject??(n!==null&&isLocalDevelopmentVercelOidc()?await resolveVercelOidcCurrentProject(t):void 0);let i=await verifyVercelOidc(n,r===void 0?e:{...e,currentVercelProject:r});return i.ok?i.sessionAuth:null},[{scheme:`Bearer`}])}function isLocalDevelopmentVercelOidc(){return process.env.VERCEL_ENV===`development`?!0:process.env.VERCEL_ENV===`preview`||process.env.VERCEL_ENV===`production`?!1:isEveDevEnvironment()}function httpBasic(e,t){return withAuthChallenges(t=>{let n=verifyHttpBasic(t.headers.get(`authorization`),e);return n.ok?n.sessionAuth:null},[{parameters:{realm:t?.realm??`eve`,charset:`UTF-8`},scheme:`Basic`}])}function jwtHmac(e){return withAuthChallenges(async t=>{let n=await verifyJwtHmac(extractBearerToken(t.headers.get(`authorization`)),e);return n.ok?n.sessionAuth:null},[{scheme:`Bearer`}])}function jwtEcdsa(e){return withAuthChallenges(async t=>{let n=await verifyJwtEcdsa(extractBearerToken(t.headers.get(`authorization`)),e);return n.ok?n.sessionAuth:null},[{scheme:`Bearer`}])}function oidc(e){return withAuthChallenges(async t=>{let n=await verifyOidc(extractBearerToken(t.headers.get(`authorization`)),e);return n.ok?n.sessionAuth:null},[{scheme:`Bearer`}])}function decodeUnverifiedJwtClaims(e){let t;try{t=decodeJwt(e)}catch{return null}return typeof t.iss!=`string`||t.iss.length===0?null:{audiences:typeof t.aud==`string`?[t.aud]:Array.isArray(t.aud)?t.aud.filter(e=>typeof e==`string`):[],issuer:t.iss}}export{ForbiddenError,UnauthenticatedError,createIpAllowList,createUnauthorizedResponse,escapeAuthChallengeParameter,extractBearerToken,httpBasic,isIpAllowed,isLocalDevAuth,jwtEcdsa,jwtHmac,localDev,none,oauthResource,oidc,placeholderAuth,readOAuthResourceOptions,routeAuth,vercelOidc,vercelSubject,verifyHttpBasic,verifyJwtEcdsa,verifyJwtHmac,verifyOidc,verifyVercelOidc,withAuthChallenges};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{createHash,timingSafeEqual}from"node:crypto";function authenticateHttpBasicStrategy(e){let t=parseBasicAuthorizationHeader(e.authorization);if(t===null)return{kind:`not-authenticated`};let n=timingSafeStringEquals(normalizeCredential(t.username),normalizeCredential(e.strategy.username))
|
|
1
|
+
import{createHash,timingSafeEqual}from"node:crypto";function authenticateHttpBasicStrategy(e){let t=parseBasicAuthorizationHeader(e.authorization);if(t===null)return{kind:`not-authenticated`};let n=timingSafeStringEquals(normalizeCredential(t.username),normalizeCredential(e.strategy.username));let r=timingSafeStringEquals(normalizeCredential(t.password),normalizeCredential(e.strategy.password));return!n||!r?{kind:`not-authenticated`}:{kind:`authenticated`,principal:{attributes:Object.freeze({}),authenticator:`http-basic`,claims:Object.freeze({}),principalId:e.strategy.username,principalType:`user`}}}function parseBasicAuthorizationHeader(e){let t=/^Basic\s+(.+)$/i.exec(e);if(t===null)return null;let n=t[1];if(n===void 0)return null;let r;try{r=Buffer.from(n,`base64`).toString(`utf8`)}catch{return null}let i=r.indexOf(`:`);return i===-1?null:{password:r.slice(i+1),username:r.slice(0,i)}}function normalizeCredential(e){return e.normalize(`NFC`)}function timingSafeStringEquals(e,t){return timingSafeEqual(hashString(e),hashString(t))}function hashString(e){return createHash(`sha256`).update(e,`utf8`).digest()}export{authenticateHttpBasicStrategy};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{importJWK,importSPKI,jwtVerify}from"#compiled/jose/index.js";import{areTokenClaimMatchersSatisfied,createJwtAuthenticatedCallerPrincipal}from"#channel/auth/token-claims.js";const importedJwtPublicKeyCache=new Map;async function authenticateJwtEcdsaStrategy(e){let t;try{t=await getImportedJwtPublicKey(e.strategy)}catch(e){return{kind:`misconfigured`,message:`Failed to import JWT ECDSA public key. ${e instanceof Error?e.message:`Unknown key import failure.`}`}}try{let n=await jwtVerify(e.token,t,{algorithms:[e.strategy.algorithm],audience:[...e.strategy.audiences],clockTolerance:e.strategy.clockSkewSeconds,issuer:e.strategy.issuer});return typeof n.payload.sub!=`string`||n.payload.sub.length===0?{kind:`not-authenticated`}:areTokenClaimMatchersSatisfied(n.payload,e.strategy)?{kind:`authenticated`,principal:createJwtAuthenticatedCallerPrincipal({authenticator:`jwt-ecdsa`,payload:n.payload,principalType:`service`})}:{kind:`caller-not-allowed`}}catch{return{kind:`not-authenticated`}}}async function getImportedJwtPublicKey(e){let t=`${e.algorithm}:${e.publicKey}
|
|
1
|
+
import{importJWK,importSPKI,jwtVerify}from"#compiled/jose/index.js";import{areTokenClaimMatchersSatisfied,createJwtAuthenticatedCallerPrincipal}from"#channel/auth/token-claims.js";const importedJwtPublicKeyCache=new Map;async function authenticateJwtEcdsaStrategy(e){let t;try{t=await getImportedJwtPublicKey(e.strategy)}catch(e){return{kind:`misconfigured`,message:`Failed to import JWT ECDSA public key. ${e instanceof Error?e.message:`Unknown key import failure.`}`}}try{let n=await jwtVerify(e.token,t,{algorithms:[e.strategy.algorithm],audience:[...e.strategy.audiences],clockTolerance:e.strategy.clockSkewSeconds,issuer:e.strategy.issuer});return typeof n.payload.sub!=`string`||n.payload.sub.length===0?{kind:`not-authenticated`}:areTokenClaimMatchersSatisfied(n.payload,e.strategy)?{kind:`authenticated`,principal:createJwtAuthenticatedCallerPrincipal({authenticator:`jwt-ecdsa`,payload:n.payload,principalType:`service`})}:{kind:`caller-not-allowed`}}catch{return{kind:`not-authenticated`}}}async function getImportedJwtPublicKey(e){let t=`${e.algorithm}:${e.publicKey}`;let n=importedJwtPublicKeyCache.get(t);if(n!==void 0)return await n;let r=importJwtPublicKey(e.publicKey,e.algorithm).catch(e=>{throw importedJwtPublicKeyCache.delete(t),e});return importedJwtPublicKeyCache.set(t,r),await r}async function importJwtPublicKey(e,t){let n=e.trim();return n.startsWith(`{`)?await importJWK(JSON.parse(n),t):await importSPKI(n,t)}export{authenticateJwtEcdsaStrategy};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{createRemoteJWKSet,jwtVerify}from"#compiled/jose/index.js";import{isVercelOidcIssuer}from"#shared/vercel-project.js";import{areTokenClaimMatchersSatisfied,createJwtAuthenticatedCallerPrincipal}from"#channel/auth/token-claims.js";import{z}from"#compiled/zod/index.js";const oidcDiscoveryDocumentSchema=z.object({issuer:z.string().optional(),jwks_uri:z.string().url()}).passthrough()
|
|
1
|
+
import{createRemoteJWKSet,jwtVerify}from"#compiled/jose/index.js";import{isVercelOidcIssuer}from"#shared/vercel-project.js";import{areTokenClaimMatchersSatisfied,createJwtAuthenticatedCallerPrincipal}from"#channel/auth/token-claims.js";import{z}from"#compiled/zod/index.js";const oidcDiscoveryDocumentSchema=z.object({issuer:z.string().optional(),jwks_uri:z.string().url()}).passthrough();const oidcDiscoveryDocumentCache=new Map;const oidcJwksCache=new Map;async function authenticateOidcStrategy(e){let t;try{t=await getOidcRemoteJwks(e.strategy)}catch(e){return{kind:`misconfigured`,message:`Failed to load OIDC discovery metadata. ${e instanceof Error?e.message:`Unknown discovery failure.`}`}}try{let n=await jwtVerify(e.token,t,{audience:[...e.strategy.audiences],clockTolerance:e.strategy.clockSkewSeconds,issuer:e.strategy.issuer});if(e.strategy.acceptCurrentVercelProject&&isVercelOidcIssuer(e.strategy.issuer)&&n.payload.external_sub!==void 0)return typeof n.payload.external_sub!=`string`||n.payload.external_sub.length===0||!currentVercelProjectMatches({payload:n.payload,strategy:e.strategy})||!currentVercelEnvironmentMatches({payload:n.payload,strategy:e.strategy})?{kind:`caller-not-allowed`}:{kind:`authenticated`,principal:createJwtAuthenticatedCallerPrincipal({authenticator:`oidc`,issuerClaims:[`external_iss`,`connector_id`],payload:n.payload,principalType:`user`,subjectClaim:`external_sub`})};if(e.strategy.acceptCurrentVercelProject&&isVercelOidcIssuer(e.strategy.issuer)&&n.payload.user_id!==void 0){if(typeof n.payload.user_id!=`string`||n.payload.user_id.length===0||n.payload.environment!==`development`||!currentVercelProjectMatches({payload:n.payload,strategy:e.strategy}))return{kind:`caller-not-allowed`};if(currentVercelEnvironmentMatches({payload:n.payload,strategy:e.strategy}))return{kind:`authenticated`,principal:createJwtAuthenticatedCallerPrincipal({authenticator:`oidc`,payload:n.payload,principalType:`user`,subjectClaim:`user_id`})}}if(typeof n.payload.sub!=`string`||n.payload.sub.length===0)return{kind:`not-authenticated`};let r=e.strategy.acceptCurrentVercelProject&&isCurrentVercelProjectToken({issuer:e.strategy.issuer,payload:n.payload,strategy:e.strategy});let i=r&&isCurrentVercelEnvironmentToken({payload:n.payload,strategy:e.strategy});return!r&&!areTokenClaimMatchersSatisfied(n.payload,e.strategy)?{kind:`caller-not-allowed`}:{kind:`authenticated`,principal:createJwtAuthenticatedCallerPrincipal({authenticator:`oidc`,payload:n.payload,principalType:i?`runtime`:`service`})}}catch{return{kind:`not-authenticated`}}}async function getOidcRemoteJwks(e){let t=await getOidcDiscoveryDocument(e.discoveryUrl);let n=oidcJwksCache.get(t.jwks_uri);if(n!==void 0)return n;let r=createRemoteJWKSet(new URL(t.jwks_uri));return oidcJwksCache.set(t.jwks_uri,r),r}async function getOidcDiscoveryDocument(e){let t=oidcDiscoveryDocumentCache.get(e);if(t!==void 0)return await t;let n=fetch(e,{headers:{accept:`application/json`}}).then(async e=>{if(!e.ok)throw Error(`Discovery route returned HTTP ${e.status}.`);return oidcDiscoveryDocumentSchema.parse(await e.json())}).catch(t=>{throw oidcDiscoveryDocumentCache.delete(e),t});return oidcDiscoveryDocumentCache.set(e,n),await n}function isCurrentVercelProjectToken(e){if(!isVercelOidcIssuer(e.issuer))return!1;let t=e.strategy.currentVercelProject;return t!==void 0&&typeof e.payload.project_id==`string`&&e.payload.project_id===t.projectId}function currentVercelProjectMatches(e){let t=e.strategy.currentVercelProject;return t!==void 0&&typeof e.payload.project_id==`string`&&e.payload.project_id===t.projectId}function isCurrentVercelEnvironmentToken(e){let t=e.strategy.currentVercelProject?.environment;return t===void 0||t.length===0?!1:typeof e.payload.environment==`string`&&e.payload.environment===t}function currentVercelEnvironmentMatches(e){let t=e.strategy.currentVercelProject?.environment;return t===void 0||t.length===0?!1:typeof e.payload.environment==`string`&&e.payload.environment===t}export{authenticateOidcStrategy};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const STANDARD_PROJECTED_CLAIM_KEYS=new Set([`aud`,`exp`,`iat`,`iss`,`jti`,`nbf`,`sub`]);function normalizeJwtClaims(e){let t={};for(let[n,r]of Object.entries(e))typeof r==`string`?t[n]=r:Array.isArray(r)&&r.every(e=>typeof e==`string`)&&(t[n]=Object.freeze([...r]));return Object.freeze(t)}function createJwtAttributeProjection(e){let t=normalizeJwtClaims(e);return Object.freeze(Object.fromEntries(Object.entries(t).filter(([e])=>!STANDARD_PROJECTED_CLAIM_KEYS.has(e))))}function areTokenClaimMatchersSatisfied(e,t){let n=normalizeJwtClaims(e);if(t.subjects!==void 0){let n=typeof e.sub==`string`?e.sub:null;if(n===null||!t.subjects.some(e=>matchesWildcardPattern(e,n)))return!1}return t.claims===void 0||Object.entries(t.claims).every(([e,t])=>{let r=n[e];return r===void 0?!1:typeof r==`string`?t.includes(r):r.some(e=>t.includes(e))})}function createJwtAuthenticatedCallerPrincipal(e){let t=readFirstStringClaim(e.payload,[...e.issuerClaims??[],`iss`])
|
|
1
|
+
const STANDARD_PROJECTED_CLAIM_KEYS=new Set([`aud`,`exp`,`iat`,`iss`,`jti`,`nbf`,`sub`]);function normalizeJwtClaims(e){let t={};for(let[n,r]of Object.entries(e))typeof r==`string`?t[n]=r:Array.isArray(r)&&r.every(e=>typeof e==`string`)&&(t[n]=Object.freeze([...r]));return Object.freeze(t)}function createJwtAttributeProjection(e){let t=normalizeJwtClaims(e);return Object.freeze(Object.fromEntries(Object.entries(t).filter(([e])=>!STANDARD_PROJECTED_CLAIM_KEYS.has(e))))}function areTokenClaimMatchersSatisfied(e,t){let n=normalizeJwtClaims(e);if(t.subjects!==void 0){let n=typeof e.sub==`string`?e.sub:null;if(n===null||!t.subjects.some(e=>matchesWildcardPattern(e,n)))return!1}return t.claims===void 0||Object.entries(t.claims).every(([e,t])=>{let r=n[e];return r===void 0?!1:typeof r==`string`?t.includes(r):r.some(e=>t.includes(e))})}function createJwtAuthenticatedCallerPrincipal(e){let t=readFirstStringClaim(e.payload,[...e.issuerClaims??[],`iss`]);let n=e.subjectClaim??`sub`;let r=readFirstStringClaim(e.payload,[n]);if(t===void 0||r===void 0)throw Error(`Expected verified JWT payloads to include string iss and ${n} claims.`);let i=normalizeJwtClaims(e.payload);return{attributes:createJwtAttributeProjection(e.payload),authenticator:e.authenticator,claims:i,issuer:t,principalId:`${t}:${r}`,principalType:e.principalType,subject:r}}function readFirstStringClaim(e,t){for(let n of t){let t=e[n];if(typeof t==`string`&&t.length>0)return t}}function matchesWildcardPattern(e,t){if(!e.includes(`*`))return e===t;let n=e.replaceAll(/[.+?^${}()|[\]\\]/g,`\\$&`).replaceAll(`*`,`.*`);return RegExp(`^${n}$`).test(t)}export{areTokenClaimMatchersSatisfied,createJwtAuthenticatedCallerPrincipal};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const VERCEL_OIDC_PROJECT_RESOLVERS=Symbol.for(`eve.vercel-oidc-project-resolvers`)
|
|
1
|
+
const VERCEL_OIDC_PROJECT_RESOLVERS=Symbol.for(`eve.vercel-oidc-project-resolvers`);const globalResolverRegistry=globalThis;globalResolverRegistry[VERCEL_OIDC_PROJECT_RESOLVERS]===void 0&&(globalResolverRegistry[VERCEL_OIDC_PROJECT_RESOLVERS]=new WeakMap);const projectResolvers=globalResolverRegistry[VERCEL_OIDC_PROJECT_RESOLVERS];async function withVercelOidcProjectResolver(e,t){let n=projectResolvers.get(e.request);projectResolvers.set(e.request,e.resolveCurrentProject);try{return await t()}finally{n===void 0?projectResolvers.delete(e.request):projectResolvers.set(e.request,n)}}async function resolveVercelOidcCurrentProject(e){let t=projectResolvers.get(e);return t===void 0?void 0:await t()}export{resolveVercelOidcCurrentProject,withVercelOidcProjectResolver};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{createSession,sessionCallbackToTurnCaller}from"#channel/session.js";import{commandDelivery}from"#channel/delivery.js";import{seedChannelState}from"#channel/adapter.js";import{validateDeliveryIdempotencyKey}from"#channel/delivery-idempotency.js";import{createChannelDeliveryMetadata}from"#channel/delivery-metadata.js";import{normalizeSendInput,serializeFilePartsInMessage}from"#channel/send-input.js";import{SessionNotActiveError}from"#channel/session-not-active-error.js";import{SessionStrandedError,describeStrandedSession}from"#channel/session-stranded-error.js";import{DEFAULT_TURN_POLICY,controlCommand}from"#channel/types.js";import{isReservedSessionCommandToken}from"#execution/session-inbox/address.js";import{contextStorage}from"#context/container.js";import{readSessionSchedule}from"#context/session-schedule.js";import{validateSessionHistory}from"#shared/session-history.js";function createChannelAddress(e){let t=e.metadata??{}
|
|
1
|
+
import{createSession,sessionCallbackToTurnCaller}from"#channel/session.js";import{commandDelivery}from"#channel/delivery.js";import{seedChannelState}from"#channel/adapter.js";import{validateDeliveryIdempotencyKey}from"#channel/delivery-idempotency.js";import{createChannelDeliveryMetadata}from"#channel/delivery-metadata.js";import{normalizeSendInput,serializeFilePartsInMessage}from"#channel/send-input.js";import{SessionNotActiveError}from"#channel/session-not-active-error.js";import{SessionStrandedError,describeStrandedSession}from"#channel/session-stranded-error.js";import{DEFAULT_TURN_POLICY,controlCommand}from"#channel/types.js";import{isReservedSessionCommandToken}from"#execution/session-inbox/address.js";import{contextStorage}from"#context/container.js";import{readSessionSchedule}from"#context/session-schedule.js";import{validateSessionHistory}from"#shared/session-history.js";function createChannelAddress(e){let t=e.metadata??{};let n=`${e.channelName}:${e.continuationToken}`;if(isReservedSessionCommandToken(n))throw Error(`Channel address "${n}" uses eve's reserved session namespace.`);return{continuationToken:e.continuationToken,async deliver(r,i){validateDeliveryIdempotencyKey(i.idempotencyKey);let a=createChannelDeliveryMetadata({channelKind:`channel:${e.channelName}`,channelName:e.channelName,...t});let o=withValidatedHistory(normalizeSendInput(r));let s=sessionCallbackToTurnCaller(i.callback);let c=contextStorage.getStore();let l=c===void 0?void 0:readSessionSchedule(c);let u={...l!==void 0&&{schedule:l},idempotencyKey:i.idempotencyKey,auth:i.auth,delivery:a,kind:`send`,payload:{...o,message:serializeFilePartsInMessage(o.message)},requestId:t.requestId,turnPolicy:o.message===void 0?void 0:i.turnPolicy??e.turnPolicy??DEFAULT_TURN_POLICY};let d=s===void 0?u:{...u,caller:s};let f=i.state;let p={...e.adapter,state:seedChannelState(e.adapter.state,f)};let m={idempotencyKey:i.idempotencyKey,adapter:p,auth:i.auth,capabilities:{requestInput:!0},callback:i.callback,channelName:e.channelName,continuationConflictCommand:d,continuationToken:n,delivery:a,initiatorAuth:i.initiatorAuth,input:{context:o.context,history:o.history,message:serializeFilePartsInMessage(o.message)??``,outputSchema:o.outputSchema,state:o.state},requestId:t.requestId,title:i.title};let h=await e.runtime.dispatchContinuation({command:d,continuationToken:n,successor:m});if(h.status===`accepted`)return commandDelivery(e.runtime,h,a.deliveryId);if(o.answers&&o.answers.length>0)throw new SessionNotActiveError;let g=await e.runtime.createSession(m);return commandDelivery(e.runtime,{status:`accepted`,sessionId:g.sessionId},a.deliveryId)},async create(r){let i=validateSessionHistory(r.history);let toSession=n=>createSession(n,e.runtime,{...t,turnPolicy:e.turnPolicy});let a;try{a=await e.runtime.resolveContinuation(n,{runnable:!0})}catch(e){throw SessionStrandedError.is(e)?new SessionStrandedError(e.owner,describeStrandedSession(e.owner,`Call end() on the address, then create() again to start a session from your history.`)):e}if(a!==void 0)return{created:!1,session:toSession(a.sessionId)};let o=r.state;let s=await e.runtime.createSession({adapter:{...e.adapter,state:seedChannelState(e.adapter.state,o)},auth:r.auth,capabilities:{requestInput:!0},channelName:e.channelName,continuationToken:n,initiatorAuth:r.initiatorAuth,input:i===void 0?{}:{history:i},requestId:t.requestId,title:r.title});return{created:s.claimedContinuation!==!1,session:toSession(s.sessionId)}},async send(e,t){return await this.deliver({message:e},t)},async respond(e,t){if(e===void 0||e.length===0)throw Error(`respond() requires at least one answer.`);return await this.deliver({answers:e},t)},async cancel(t){let r=controlCommand({kind:`cancel`,turnId:t?.turnId},t);let i=await e.runtime.dispatchContinuation({command:r,continuationToken:n});return commandDelivery(e.runtime,i,r.deliveryId)},async compact(t){let r=controlCommand({kind:`compact`},t);let i=await e.runtime.dispatchContinuation({command:r,continuationToken:n});return commandDelivery(e.runtime,i,r.deliveryId)},async clear(t){let r=controlCommand({kind:`clear`},t);let i=await e.runtime.dispatchContinuation({command:r,continuationToken:n});return commandDelivery(e.runtime,i,r.deliveryId)},async end(t){let r=controlCommand({kind:`reset`,reason:t?.reason},t);let i=await e.runtime.dispatchContinuation({command:r,continuationToken:n});return commandDelivery(e.runtime,i,r.deliveryId,{follow:!1})},async resolveSession(){let r=await e.runtime.resolveContinuation(n);return r===void 0?void 0:createSession(r.sessionId,e.runtime,{...t,turnPolicy:e.turnPolicy})}}}function createChannelAddressFn(e){return t=>createChannelAddress({...e,continuationToken:t})}function withValidatedHistory(e){let{history:t,...n}=e;let r=validateSessionHistory(t);return r===void 0?n:{...n,history:r}}export{createChannelAddress,createChannelAddressFn};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
const CHANNEL_SENTINEL=`eve:channel
|
|
1
|
+
const CHANNEL_SENTINEL=`eve:channel`;const CHANNEL_BUILD_METADATA=Symbol.for(`eve.channel.buildMetadata`);const CHANNEL_INSTRUMENTATION_KIND=Symbol.for(`eve.channel.instrumentationKind`);const CHANNEL_INSTRUMENTATION_KINDS=Symbol.for(`eve.channel.instrumentationKinds`);const channelInstrumentationKindGlobal=globalThis;channelInstrumentationKindGlobal[CHANNEL_INSTRUMENTATION_KINDS]??=new Map;const channelInstrumentationKinds=channelInstrumentationKindGlobal[CHANNEL_INSTRUMENTATION_KINDS];function isCompiledChannel(e){return typeof e==`object`&&!!e&&e.__kind===`eve:channel`}function getChannelBuildMetadata(e,t){if(!isCompiledChannel(e))return;let n=Reflect.get(e,CHANNEL_BUILD_METADATA);return typeof n==`function`?n(t):void 0}function setChannelBuildMetadata(e,t){if(!isCompiledChannel(e))throw TypeError(`Expected a compiled channel.`);Object.defineProperty(e,CHANNEL_BUILD_METADATA,{configurable:!0,enumerable:!0,value:t})}function getChannelInstrumentationKind(e){if(!isCompiledChannel(e))return;let t=Reflect.get(e,CHANNEL_INSTRUMENTATION_KIND);if(typeof t==`string`&&t.length>0)return t;let n=e.adapter.kind;if(typeof n==`string`&&n.startsWith(`channel:`))return n;let r=channelRouteSignature(e);return r===void 0?void 0:channelInstrumentationKinds.get(r)}function setChannelInstrumentationKind(e,t){Object.defineProperty(e,CHANNEL_INSTRUMENTATION_KIND,{configurable:!0,enumerable:!1,value:t});let n=channelRouteSignature(e);n!==void 0&&channelInstrumentationKinds.set(n,t)}function channelRouteSignature(e){if(e.routes.length!==0)return e.routes.map(e=>`${e.method.toUpperCase()} ${e.path}`).sort().join(`
|
|
2
2
|
`)}export{CHANNEL_SENTINEL,getChannelBuildMetadata,getChannelInstrumentationKind,isCompiledChannel,setChannelBuildMetadata,setChannelInstrumentationKind};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{resolveAudience}from"#channel/audience.js";import{buildChannelInstrumentationProjection}from"#channel/instrumentation.js";import{normalizeInstrumentationChannelKind}from"#shared/instrumentation-channel-kind.js";import{resolveConversationContext}from"#shared/conversation-context.js";import{readForwardedTraceAssertion}from"#shared/forwarded-trace-policy.js";function buildConversationContext(e,t){let n=Object.hasOwn(e,`audienceAuth`)?e.audienceAuth??null:e.auth
|
|
1
|
+
import{resolveAudience}from"#channel/audience.js";import{buildChannelInstrumentationProjection}from"#channel/instrumentation.js";import{normalizeInstrumentationChannelKind}from"#shared/instrumentation-channel-kind.js";import{resolveConversationContext}from"#shared/conversation-context.js";import{readForwardedTraceAssertion}from"#shared/forwarded-trace-policy.js";function buildConversationContext(e,t){let n=Object.hasOwn(e,`audienceAuth`)?e.audienceAuth??null:e.auth;let r=buildChannelInstrumentationProjection({adapter:e.adapter,channelName:e.channelName});let i={kind:normalizeInstrumentationChannelKind(r.kind),name:e.channelName};let a=e.inheritedConversation;let o=readForwardedTraceAssertion(e.parentTraceContext?.forwardedTracePolicy);let s=o?.originAudience??a?.audience??resolveAudience(e.adapter,{state:e.adapter.state,caller:toAudienceCaller(n),channel:i,environment:t});return{...resolveConversationContext(void 0,{channelKind:r.kind,environment:t,forwardedTracePolicy:o,principalType:n?.principalType}),audience:s,channel:i}}function toAudienceCaller(e){return e==null||e.principalType===`anonymous`?{type:`anonymous`}:{type:`principal`,principal:{attributes:e.attributes,authenticator:e.authenticator,kind:e.principalType}}}export{buildConversationContext,toAudienceCaller};
|
package/dist/src/channel/cors.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
function normalizeChannelCors(e){if(e===void 0||e===!1)return;if(e===!0)return{};if(typeof e!=`object`||!e||Array.isArray(e))throw Error(`Expected channel cors to be a boolean or a serializable CORS options object.`);assertSupportedCorsKeys(e);let t={};if(e.origin!==void 0&&(t.origin=normalizeOrigin(e.origin)),e.methods!==void 0&&(t.methods=normalizeWildcardOrStringList(e.methods,`methods`)),e.allowHeaders!==void 0&&(t.allowHeaders=normalizeWildcardOrStringList(e.allowHeaders,`allowHeaders`)),e.exposeHeaders!==void 0&&(t.exposeHeaders=normalizeWildcardOrStringList(e.exposeHeaders,`exposeHeaders`)),e.credentials!==void 0){if(typeof e.credentials!=`boolean`)throw Error(`Expected channel cors.credentials to be a boolean.`);t.credentials=e.credentials}return e.maxAge!==void 0&&(t.maxAge=normalizeMaxAge(e.maxAge)),e.preflight!==void 0&&(t.preflight=normalizePreflight(e.preflight)),t}const SUPPORTED_CORS_KEYS=new Set([`origin`,`methods`,`allowHeaders`,`exposeHeaders`,`credentials`,`maxAge`,`preflight`])
|
|
1
|
+
function normalizeChannelCors(e){if(e===void 0||e===!1)return;if(e===!0)return{};if(typeof e!=`object`||!e||Array.isArray(e))throw Error(`Expected channel cors to be a boolean or a serializable CORS options object.`);assertSupportedCorsKeys(e);let t={};if(e.origin!==void 0&&(t.origin=normalizeOrigin(e.origin)),e.methods!==void 0&&(t.methods=normalizeWildcardOrStringList(e.methods,`methods`)),e.allowHeaders!==void 0&&(t.allowHeaders=normalizeWildcardOrStringList(e.allowHeaders,`allowHeaders`)),e.exposeHeaders!==void 0&&(t.exposeHeaders=normalizeWildcardOrStringList(e.exposeHeaders,`exposeHeaders`)),e.credentials!==void 0){if(typeof e.credentials!=`boolean`)throw Error(`Expected channel cors.credentials to be a boolean.`);t.credentials=e.credentials}return e.maxAge!==void 0&&(t.maxAge=normalizeMaxAge(e.maxAge)),e.preflight!==void 0&&(t.preflight=normalizePreflight(e.preflight)),t}const SUPPORTED_CORS_KEYS=new Set([`origin`,`methods`,`allowHeaders`,`exposeHeaders`,`credentials`,`maxAge`,`preflight`]);const RENAMED_CORS_KEYS={allowedHeaders:`allowHeaders`,exposedHeaders:`exposeHeaders`,preflightStatus:`preflight.statusCode`};function assertSupportedCorsKeys(e){for(let t of Object.keys(e)){if(SUPPORTED_CORS_KEYS.has(t))continue;let e=Object.hasOwn(RENAMED_CORS_KEYS,t)?RENAMED_CORS_KEYS[t]:void 0;throw Error(e===void 0?`Unknown channel cors option "${t}". Supported options: ${[...SUPPORTED_CORS_KEYS].join(`, `)}.`:`The channel cors option "${t}" is no longer supported. Use "${e}".`)}}function normalizeOrigin(e){if(e===`*`||e===`null`)return e;if(typeof e==`string`&&e.length>0)return[e];if(!Array.isArray(e))throw Error(`Expected channel cors.origin to be a non-empty origin string or an array of origins.`);return e.map(e=>{if(typeof e!=`string`||e.length===0)throw Error(`Expected channel cors.origin entries to be non-empty strings.`);return e})}function normalizeWildcardOrStringList(e,t){if(e===`*`)return e;if(!Array.isArray(e))throw Error(`Expected channel cors.${t} to be "*" or an array of strings.`);return e.map(e=>{if(typeof e!=`string`||e.length===0)throw Error(`Expected channel cors.${t} entries to be non-empty strings.`);return e})}function normalizeMaxAge(e){if(e===!1)return!1;if(typeof e==`number`){if(!Number.isFinite(e)||e<0)throw Error(`Expected channel cors.maxAge to be a non-negative finite number.`);return String(e)}if(typeof e==`string`&&e.length>0)return e;throw Error(`Expected channel cors.maxAge to be false, a string, or a number.`)}function normalizePreflight(e){if(typeof e!=`object`||!e||Array.isArray(e))throw Error(`Expected channel cors.preflight to be an object.`);let t=e.statusCode;if(t===void 0)return{};if(!Number.isInteger(t)||t<100||t>599)throw Error(`Expected channel cors.preflight.statusCode to be an HTTP status code.`);return{statusCode:t}}export{normalizeChannelCors};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const DELIVERY_IDEMPOTENCY_WINDOW=1024
|
|
1
|
+
const DELIVERY_IDEMPOTENCY_WINDOW=1024;const MAX_DELIVERY_IDEMPOTENCY_KEY_LENGTH=256;function validateDeliveryIdempotencyKey(e){if(e!==void 0&&(typeof e!=`string`||e.length===0||e.length>256))throw Error(`idempotencyKey must be a nonempty string of at most 256 characters.`)}async function deliveryIdForIdempotencyKey(e){let t=new Uint8Array(await crypto.subtle.digest(`SHA-256`,new TextEncoder().encode(`eve:delivery:${e}`)));t[6]=t[6]&15|128,t[8]=t[8]&63|128;let n=Array.from(t.subarray(0,16),e=>e.toString(16).padStart(2,`0`)).join(``);return`${n.slice(0,8)}-${n.slice(8,12)}-${n.slice(12,16)}-${n.slice(16,20)}-${n.slice(20,32)}`}export{DELIVERY_IDEMPOTENCY_WINDOW,MAX_DELIVERY_IDEMPOTENCY_KEY_LENGTH,deliveryIdForIdempotencyKey,validateDeliveryIdempotencyKey};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{createLogger,logError}from"#internal/logging.js";import{z}from"#compiled/zod/index.js";const log=createLogger(`channel.forwarded-principal`)
|
|
1
|
+
import{createLogger,logError}from"#internal/logging.js";import{z}from"#compiled/zod/index.js";const log=createLogger(`channel.forwarded-principal`);const FORWARDED_BY_ATTRIBUTE=`eve:forwarded-by`;const attributeValueSchema=z.union([z.string(),z.array(z.string()).readonly()]);const forwardedPrincipalContextSchema=z.object({attributes:z.record(z.string(),attributeValueSchema).readonly(),authenticator:z.string().min(1),issuer:z.string().min(1).optional(),principalId:z.string().min(1),principalType:z.string().min(1),subject:z.string().min(1).optional()}).strict();const forwardedPrincipalSchema=z.object({current:forwardedPrincipalContextSchema,initiator:forwardedPrincipalContextSchema.optional()}).strict();async function resolveForwardedPrincipal(e){let t=e.payload.forwardedPrincipal;if(t===void 0)return{accepted:!1,auth:e.forwarder};if(e.trustedForwarders===void 0)return Response.json({error:`This deployment does not accept a forwarded principal.`,ok:!1},{status:403});let n=parseForwardedPrincipal(t);if(!n.ok)return Response.json({error:n.message,ok:!1},{status:400});let r=stampForwardedBy(n.forwardedPrincipal.current,e.forwarder.principalId);let i=n.forwardedPrincipal.initiator===void 0?r:stampForwardedBy(n.forwardedPrincipal.initiator,e.forwarder.principalId);let a;try{a=await e.trustedForwarders(e.forwarder,{principal:{current:r,initiator:i}})}catch(t){let n=logError(log,`trustedForwarders handler failed`,t,{forwarder:e.forwarder.principalId});return Response.json({error:`trustedForwarders handler failed.`,errorId:n,ok:!1},{status:500})}return a?{accepted:!0,auth:r,initiatorAuth:i}:Response.json({error:`Caller is not authorized to assert a forwarded principal.`,ok:!1},{status:403})}function parseForwardedPrincipal(e){let t=forwardedPrincipalSchema.safeParse(e);if(t.success){let e=toSessionAuthContext(t.data.current);return{forwardedPrincipal:t.data.initiator===void 0?{current:e}:{current:e,initiator:toSessionAuthContext(t.data.initiator)},ok:!0}}return{cause:t.error,message:formatForwardedPrincipalParseError(t.error),ok:!1}}function stampForwardedBy(e,t){return{...e,attributes:{...e.attributes,[FORWARDED_BY_ATTRIBUTE]:t}}}function toSessionAuthContext(e){let t={attributes:e.attributes,authenticator:e.authenticator,principalId:e.principalId,principalType:e.principalType};return e.issuer!==void 0&&(t.issuer=e.issuer),e.subject!==void 0&&(t.subject=e.subject),t}function formatForwardedPrincipalParseError(e){return`Invalid forwardedPrincipal metadata: ${e.issues.map(e=>`${e.path.length===0?`forwardedPrincipal`:`forwardedPrincipal.${e.path.join(`.`)}`}: ${e.message}`).join(`; `)}`}export{FORWARDED_BY_ATTRIBUTE,parseForwardedPrincipal,resolveForwardedPrincipal,stampForwardedBy};
|
package/dist/src/channel/http.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const HTTP_ADAPTER_KIND=`http
|
|
1
|
+
const HTTP_ADAPTER_KIND=`http`;const HTTP_ADAPTER={kind:HTTP_ADAPTER_KIND};export{HTTP_ADAPTER,HTTP_ADAPTER_KIND};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{isUnanswerableResponseError}from"#channel/session-not-active-error.js";const INACTIVE_REQUEST_NOTICE=`This request is no longer active. Send a new message to start again
|
|
1
|
+
import{isUnanswerableResponseError}from"#channel/session-not-active-error.js";const INACTIVE_REQUEST_NOTICE=`This request is no longer active. Send a new message to start again.`;const INACTIVE_PROMPT_LABEL=`No longer active`;async function respondOrRetireInactivePrompt(e,t,n){try{return await e(),{outcome:`delivered`}}catch(e){if(!isUnanswerableResponseError(e))return n.error(`input response delivery failed`,{error:e}),{outcome:`failed`,error:e};n.warn(`input response reached no active session`,{error:e})}return{outcome:`inactive`,retirement:t.retirePrompt(INACTIVE_PROMPT_LABEL).catch(e=>n.error(`inactive prompt edit failed`,{error:e}))}}export{INACTIVE_PROMPT_LABEL,INACTIVE_REQUEST_NOTICE,respondOrRetireInactivePrompt};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{decidingAnswer,interaction,interaction as interaction$1,promptQueueHead,responderOf,signInEnding}from"#protocol/session-projection/reader.js";import{interactionBatches,interactionOwner}from"#protocol/session-projection/selectors.js";function requestBatchOf(e,t){let n=e.interactions[t.interactionId]
|
|
1
|
+
import{decidingAnswer,interaction,interaction as interaction$1,promptQueueHead,responderOf,signInEnding}from"#protocol/session-projection/reader.js";import{interactionBatches,interactionOwner}from"#protocol/session-projection/selectors.js";function requestBatchOf(e,t){let n=e.interactions[t.interactionId];let r=interactionBatches(e).find(e=>e[0]===n);if(n===void 0||r===void 0)return;let i=r.flatMap(t=>interaction$1(e,t.interactionId)??[]);if(i.length===0)return;let a=interactionOwner(e,n);let o={requests:i,turnId:a.turnId??``};return a.taskId!==void 0&&(o.taskId=a.taskId),(n.origin!==void 0||n.request.kind===`question`)&&`callId`in n.subject&&(o.callId=n.subject.callId),o}function firstOpenRequest(e){let t=promptQueueHead(e);return t===void 0?void 0:interaction$1(e,t.interactionId)}function requestSettlementOf(e,t){let n=e.interactions[t.interactionId];if(n===void 0||n.request.kind===`sign-in`)return;let r={interactionId:n.interactionId,kind:n.request.kind,outcome:t.outcome};let i=decidingAnswer({...n,response:t.response});i!==void 0&&(r.answer=i),t.reason!==void 0&&(r.reason=t.reason);let a=t.cause!==void 0&&`responseId`in t.cause?responderOf(e,t.cause.responseId):void 0;return a!==void 0&&(r.responder=a),r}function refusedAnswerOf(e,t){if(t.outcome!==`refused`&&t.outcome!==`failed`)return;let n=e.responses[t.responseId];if(n===void 0)return;let r={interactionId:n.interactionId,outcome:t.outcome};t.reason!==void 0&&(r.reason=t.reason);let i=responderOf(e,t.responseId);return i!==void 0&&(r.responder=i),r}function optionStyle(e){let{style:t}=e;return t===`primary`||t===`danger`||t==="default"?t:void 0}export{firstOpenRequest,interaction,optionStyle,refusedAnswerOf,requestBatchOf,requestSettlementOf,signInEnding};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{BlockList,isIP}from"node:net";function createRuntimeIpAllowList(e){let t=new BlockList;for(let n of e){let e=n.trim();if(e.length===0)throw Error(`Expected every network.ipAllowList entry to be non-empty.`);if(e.includes(`*`))throw Error(`Expected "${e}" to use exact IP or CIDR syntax instead of "*".`);let r=e.indexOf(`/`);if(r===-1){let n=normalizeIpAddress(e)
|
|
1
|
+
import{BlockList,isIP}from"node:net";function createRuntimeIpAllowList(e){let t=new BlockList;for(let n of e){let e=n.trim();if(e.length===0)throw Error(`Expected every network.ipAllowList entry to be non-empty.`);if(e.includes(`*`))throw Error(`Expected "${e}" to use exact IP or CIDR syntax instead of "*".`);let r=e.indexOf(`/`);if(r===-1){let n=normalizeIpAddress(e);let r=getIpFamily(n);t.addAddress(n,r);continue}let i=normalizeIpAddress(e.slice(0,r));let a=Number.parseInt(e.slice(r+1),10);let o=getIpFamily(i);let s=o===`ipv4`?32:128;if(!Number.isInteger(a)||a<0||a>s)throw Error(`Expected "${e}" to use a valid ${o} CIDR prefix length.`);t.addSubnet(i,a,o)}return{blockList:t,entries:[...e]}}function isRuntimeIpAllowed(e,t){let n=normalizeIpAddress(e);let r=getIpFamily(n);return t.blockList.check(n,r)}function normalizeIpAddress(e){let t=e.trim().replace(/^\[(.*)\]$/,`$1`);let n=t.indexOf(`%`);let r=n===-1?t:t.slice(0,n);if(r.startsWith(`::ffff:`)){let e=r.slice(7);if(isIP(e)===4)return e}return r}function getIpFamily(e){switch(isIP(e)){case 4:return`ipv4`;case 6:return`ipv6`;default:throw Error(`Expected "${e}" to be a valid IP address.`)}}export{createRuntimeIpAllowList,isRuntimeIpAllowed};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
function renderTextInteraction(e){let t=[e.prompt];return e.options!==void 0&&e.options.length>0&&t.push(``,...e.options.map((e,t)=>{let n=e.description?` - ${e.description}`:``;return`${t+1}. ${e.label}${n}`})),t.join(`
|
|
2
|
-
`)}function answerFromText(e,t){let{interactionId:n,request:r}=t
|
|
2
|
+
`)}function answerFromText(e,t){let{interactionId:n,request:r}=t;let i=e.trim();if(i.length===0)return;let a=i.toLowerCase();if(r.options!==void 0&&r.options.length>0){let e=matchOption(a,r.options);if(e!==void 0)return{interactionId:n,optionId:e.id}}if(r.allowFreeform===!0||r.options===void 0||r.options.length===0)return{interactionId:n,text:i}}function matchOption(e,t){let n=t.find(t=>t.id.toLowerCase()===e);if(n!==void 0)return n;let r=t.find(t=>t.label.toLowerCase()===e);if(r!==void 0)return r;let i=Number(e);if(Number.isInteger(i)&&i>0&&i<=t.length)return t[i-1]}export{answerFromText,renderTextInteraction};
|
|
@@ -7,8 +7,16 @@ type PromptOption = Pick<InteractionOption, "id" | "label">;
|
|
|
7
7
|
* turn is cancelled, is no longer needed.
|
|
8
8
|
*/
|
|
9
9
|
export declare function resolvedPromptAnswer(resolution: RequestSettlement, options?: readonly PromptOption[]): string | undefined;
|
|
10
|
-
/**
|
|
11
|
-
|
|
10
|
+
/**
|
|
11
|
+
* The line a prompt shows once resolved, such as `Approved` or `Answered: Saturday`. `by` names
|
|
12
|
+
* who gave the deciding answer, as in `Approved by Alice` or `Answered by Alice: Saturday`.
|
|
13
|
+
*/
|
|
14
|
+
export declare function resolvedPromptLabel(resolution: RequestSettlement, options?: readonly PromptOption[], by?: string): string;
|
|
15
|
+
/**
|
|
16
|
+
* The name a channel recorded for whoever gave a settlement's deciding answer, from the names it
|
|
17
|
+
* keeps by principal id as people send messages and press buttons.
|
|
18
|
+
*/
|
|
19
|
+
export declare function responderName(names: Readonly<Record<string, string>> | undefined, resolution: RequestSettlement): string | undefined;
|
|
12
20
|
/** A question or budget prompt someone answered. */
|
|
13
21
|
export declare function isAnswered(resolution: RequestSettlement): boolean;
|
|
14
22
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
function resolvedPromptAnswer(e,t=[]){if(e.outcome!==`accepted`&&e.outcome!==`declined`)return`No longer needed`;if(e.kind===`approval`)return e.outcome===`accepted`?`Approved`:`Cancelled`;let{answer:n}=e;return t.find(e=>e.id===n?.optionId)?.label??n?.text}function resolvedPromptLabel(e,t=[]){let
|
|
1
|
+
function resolvedPromptAnswer(e,t=[]){if(e.outcome!==`accepted`&&e.outcome!==`declined`)return`No longer needed`;if(e.kind===`approval`)return e.outcome===`accepted`?`Approved`:`Cancelled`;let{answer:n}=e;return t.find(e=>e.id===n?.optionId)?.label??n?.text}function resolvedPromptLabel(e,t=[],n){let r=resolvedPromptAnswer(e,t);let i=e.outcome===`accepted`||e.outcome===`declined`;let a=n===void 0||n===``||!i?``:` by ${n}`;return isAnswered(e)?r===void 0?`Answered${a}`:`Answered${a}: ${r}`:r===void 0?``:`${r}${a}`}function responderName(e,t){let n=t.responder?.id;return n===void 0?void 0:e?.[n]}function isAnswered(e){return e.kind!==`approval`&&(e.outcome===`accepted`||e.outcome===`declined`)}export{isAnswered,resolvedPromptAnswer,resolvedPromptLabel,responderName};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{createHash,randomUUID}from"node:crypto";import{commandDelivery}from"#channel/delivery.js";import{createChannelDeliveryMetadata}from"#channel/delivery-metadata.js";import{ContextContainer,contextStorage}from"#context/container.js";import{scheduleDisplayName}from"#runtime/schedules/record.js";import{SCHEDULE_APP_AUTH,SCHEDULE_APP_AUTH as SCHEDULE_APP_AUTH$1}from"#channel/schedule-auth.js";import{createCrossChannelToFn,toCrossChannelTargets}from"#channel/cross-channel-receive.js";import{AuthKey,OccurrenceIdKey,ScheduleIdKey,ScheduleInstanceKey}from"#context/keys.js";import{expectFunction}from"#internal/authored-module.js";import{parseSchedulePayload,validateSchedulePayload}from"#runtime/schedules/payload.js";const SCHEDULE_ADAPTER_KIND=`schedule
|
|
1
|
+
import{createHash,randomUUID}from"node:crypto";import{commandDelivery}from"#channel/delivery.js";import{createChannelDeliveryMetadata}from"#channel/delivery-metadata.js";import{ContextContainer,contextStorage}from"#context/container.js";import{scheduleDisplayName}from"#runtime/schedules/record.js";import{SCHEDULE_APP_AUTH,SCHEDULE_APP_AUTH as SCHEDULE_APP_AUTH$1}from"#channel/schedule-auth.js";import{createCrossChannelToFn,toCrossChannelTargets}from"#channel/cross-channel-receive.js";import{AuthKey,OccurrenceIdKey,ScheduleIdKey,ScheduleInstanceKey}from"#context/keys.js";import{expectFunction}from"#internal/authored-module.js";import{parseSchedulePayload,validateSchedulePayload}from"#runtime/schedules/payload.js";const SCHEDULE_ADAPTER_KIND=`schedule`;const SCHEDULE_ADAPTER={kind:SCHEDULE_ADAPTER_KIND};var ScheduleDispatcher=class{runtime;channels;constructor(e){this.runtime=e.runtime,this.channels=e.channels}async trigger(e){let t=new ContextContainer;return t.set(ScheduleIdKey,e.scheduleId),await contextStorage.run(t,()=>this.triggerInScope(e))}async triggerCollection(e){let{envelope:t}=parseSchedulePayload(e.payload,{application:e.payload.eve.application,collection:e.collectionId});let{definition:n}=e;let r={...e.occurrence,displayName:scheduleDisplayName(e.occurrence.name)};let i=n.preparePayload===void 0?await validateSchedulePayload(n.inputSchema,t.payload):t.payload;await e.verifyDelivery?.();let a=await n.auth({principal:t.principal,payload:i,occurrence:r});if(a===null)throw Error(`Scheduled execution is no longer authorized.`);if(a.principalId!==t.principal.principalId||a.principalType!==t.principal.type||a.authenticator!==t.principal.authenticator||a.issuer!==t.principal.issuer||a.subject!==t.principal.subject)throw Error(`Scheduled execution auth must resolve the schedule creator.`);let o=a;let s=new ContextContainer;s.set(ScheduleIdKey,e.collectionId),s.set(AuthKey,o),s.set(OccurrenceIdKey,r.executionId),s.set(ScheduleInstanceKey,r.name);let scheduledToken=(e,t)=>t===void 0?`eve-scheduled-send:${randomUUID()}`:`eve-scheduled-send:${createHash(`sha256`).update(JSON.stringify([r.scheduleId,e,t])).digest(`hex`)}`;let freshRun=e=>({...e,auth:o,initiatorAuth:o,capabilities:{requestInput:!1},continuationToken:scheduledToken(e.continuationToken,e.idempotencyKey),continuationConflictCommand:e.idempotencyKey===void 0?void 0:e.continuationConflictCommand});return await contextStorage.run(s,async()=>{let e={...this.runtime,resolveContinuation:async()=>void 0,dispatchContinuation:async e=>{if(e.command.kind!==`send`)throw Error(`Scheduled channel receive can only start a fresh session.`);return{status:`session_not_active`}},createSession:async e=>await this.runtime.createSession(freshRun(e))};let{args:t,sessions:a,waitUntilTasks:s}=this.createHandlerContext(e);return await n.run({payload:i,occurrence:r,auth:o,to:(e,n)=>({send:(r,i)=>t.to(e,n).send(r,{...i,auth:o})}),waitUntil:t.waitUntil}),await Promise.all(s),{sessions:a,waitUntilTasks:s}})}async triggerInScope(e){let{args:t,sessions:n,waitUntilTasks:r}=this.createHandlerContext();if(e.run)await e.run(t);else if(e.markdown!==void 0)n.push(await this.runMarkdown(e.markdown));else throw Error(`Schedule "${e.scheduleId}" has neither "run" nor "markdown" — at least one must be set.`);return{sessions:n,waitUntilTasks:r}}createHandlerContext(e=this.runtime){let t=[];let n=[];let r=createCrossChannelToFn(e,toCrossChannelTargets(this.channels),{acceptedDeploymentId:process.env.VERCEL_DEPLOYMENT_ID?.trim()||void 0});return{args:{appAuth:SCHEDULE_APP_AUTH$1,to(e,n){let i=r(e,n);return{async send(e,n){let r=await i.send(e,n);return t.push(r),r}}},waitUntil(e){n.push(e)}},sessions:t,waitUntilTasks:n}}async runMarkdown(e){let t=createChannelDeliveryMetadata({channelKind:`schedule`,channelName:`schedule`});let n=await this.runtime.createSession({delivery:t,adapter:SCHEDULE_ADAPTER,auth:SCHEDULE_APP_AUTH$1,input:{message:e}});return commandDelivery(this.runtime,{status:`accepted`,sessionId:n.sessionId},t.deliveryId)}};function expectScheduleRun(e,t,n){let r=e;if(typeof r!=`object`||!r)throw Error(`Schedule export "${n??`default`}" from "${t}" must be an object.`);return expectFunction(r.run,`Expected the schedule export "${n??`default`}" from "${t}" to export a \`run\` handler function.`)}export{SCHEDULE_ADAPTER,SCHEDULE_ADAPTER_KIND,SCHEDULE_APP_AUTH,ScheduleDispatcher,expectScheduleRun};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{serializeUrlFilePart}from"#internal/attachments/url-refs.js";function normalizeSendInput(e){return isMessageContent(e)?{message:e}:e}function isMessageContent(e){return typeof e==`string`||Array.isArray(e)}function serializeFilePartsInMessage(e){if(e===void 0||typeof e==`string`)return e;let t=!1
|
|
1
|
+
import{serializeUrlFilePart}from"#internal/attachments/url-refs.js";function normalizeSendInput(e){return isMessageContent(e)?{message:e}:e}function isMessageContent(e){return typeof e==`string`||Array.isArray(e)}function serializeFilePartsInMessage(e){if(e===void 0||typeof e==`string`)return e;let t=!1;let n=e.map(e=>{if(e.type!==`file`)return e;if(e.data instanceof URL&&e.data.protocol!==`data:`)return t=!0,{...e,data:serializeUrlFilePart(e.data)};if(e.data instanceof Uint8Array||e.data instanceof ArrayBuffer){t=!0;let n=Buffer.from(new Uint8Array(e.data)).toString(`base64`);return{...e,data:`data:${e.mediaType};base64,${n}`}}return e});return t?n:e}export{normalizeSendInput,serializeFilePartsInMessage};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{isLocalDevelopmentServer}from"#internal/application/dev-environment.js";import{isBlockedDestinationHost}from"#shared/network-address.js";import{z}from"#compiled/zod/index.js";import{createEveCallbackRoutePath}from"#protocol/routes.js";import{normalizePublicEveRoutePath}from"#shared/eve-route-path.js";const sessionCallbackSchema=z.object({callId:z.string().min(1),subagentName:z.string().min(1),token:z.string().min(1),url:z.string().min(1)}).strict().superRefine((e,t)=>{let n;try{n=new URL(e.url)}catch{t.addIssue({code:`custom`,message:`Callback url must be absolute.`,path:[`url`]});return}readCallbackUrlToken(n)!==e.token&&t.addIssue({code:`custom`,message:`Callback url token must match callback token.`,path:[`url`]}),n.protocol!==`http:`&&n.protocol!==`https:`&&t.addIssue({code:`custom`,message:`Callback url must use http or https.`,path:[`url`]}),isBlockedDestinationHost(n.hostname,{allowLoopback:isLocalDevelopmentServer()})&&t.addIssue({code:`custom`,message:`Callback url host must not be a loopback, private, link-local, or reserved address. Loopback is allowed only on local development servers.`,path:[`url`]})});function parseSessionCallback(e){let t=sessionCallbackSchema.safeParse(e);return t.success?{callback:t.data,ok:!0}:{cause:t.error,message:formatSessionCallbackParseError(t.error),ok:!1}}function readCallbackUrlToken(e){let t=createEveCallbackRoutePath(``)
|
|
1
|
+
import{isLocalDevelopmentServer}from"#internal/application/dev-environment.js";import{isBlockedDestinationHost}from"#shared/network-address.js";import{z}from"#compiled/zod/index.js";import{createEveCallbackRoutePath}from"#protocol/routes.js";import{normalizePublicEveRoutePath}from"#shared/eve-route-path.js";const sessionCallbackSchema=z.object({callId:z.string().min(1),subagentName:z.string().min(1),token:z.string().min(1),url:z.string().min(1)}).strict().superRefine((e,t)=>{let n;try{n=new URL(e.url)}catch{t.addIssue({code:`custom`,message:`Callback url must be absolute.`,path:[`url`]});return}readCallbackUrlToken(n)!==e.token&&t.addIssue({code:`custom`,message:`Callback url token must match callback token.`,path:[`url`]}),n.protocol!==`http:`&&n.protocol!==`https:`&&t.addIssue({code:`custom`,message:`Callback url must use http or https.`,path:[`url`]}),isBlockedDestinationHost(n.hostname,{allowLoopback:isLocalDevelopmentServer()})&&t.addIssue({code:`custom`,message:`Callback url host must not be a loopback, private, link-local, or reserved address. Loopback is allowed only on local development servers.`,path:[`url`]})});function parseSessionCallback(e){let t=sessionCallbackSchema.safeParse(e);return t.success?{callback:t.data,ok:!0}:{cause:t.error,message:formatSessionCallbackParseError(t.error),ok:!1}}function readCallbackUrlToken(e){let t=createEveCallbackRoutePath(``);let n=normalizePublicEveRoutePath(e.pathname);let r=n.lastIndexOf(t);if(r===-1)return null;let i=n.slice(r+t.length);if(i.length===0||i.includes(`/`))return null;try{return decodeURIComponent(i)}catch{return null}}function formatSessionCallbackParseError(e){return`Invalid callback metadata: ${e.issues.map(e=>`${e.path.length===0?`callback`:`callback.${e.path.join(`.`)}`}: ${e.message}`).join(`; `)}`}export{parseSessionCallback};
|