eve 0.82.0 → 0.83.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +69 -0
- package/NOTICE +1 -1
- package/dist/src/channel/pending-authorization.d.ts +5 -0
- package/dist/src/channel/pending-authorization.js +1 -1
- package/dist/src/channel/session.d.ts +2 -0
- package/dist/src/channel/session.js +1 -1
- package/dist/src/channel/types.d.ts +5 -0
- package/dist/src/chunks/{use-eve-agent-DlznYwQk.js → use-eve-agent-3-WRmJkd.js} +40 -5
- package/dist/src/chunks/{use-eve-agent-DTu78IAF.js → use-eve-agent-Ci5dr0aR.js} +40 -5
- package/dist/src/cli/dev/local-server-child.js +1 -1
- package/dist/src/cli/dev/local-server-cleanup.js +1 -1
- package/dist/src/cli/dev/tui/question-panel.d.ts +4 -1
- package/dist/src/cli/dev/tui/question-panel.js +1 -1
- package/dist/src/cli/dev/tui/terminal-renderer.js +4 -4
- package/dist/src/client/eve-agent-store.d.ts +1 -1
- package/dist/src/client/eve-agent-store.js +1 -1
- package/dist/src/client/index.d.ts +1 -0
- package/dist/src/client/session-controls.d.ts +6 -0
- package/dist/src/client/session-controls.js +1 -1
- package/dist/src/client/session.d.ts +4 -0
- package/dist/src/client/session.js +1 -1
- package/dist/src/compiled/.vendor-stamp.json +8 -8
- package/dist/src/compiled/@eve/catalog/index.js +1 -1
- package/dist/src/compiled/@workflow/core/events-consumer.d.ts +2 -0
- package/dist/src/compiled/@workflow/core/index.js +2 -2
- package/dist/src/compiled/@workflow/core/private.d.ts +5 -3
- package/dist/src/compiled/@workflow/core/private.js +1 -1
- package/dist/src/compiled/@workflow/core/runtime/constants.d.ts +1 -37
- package/dist/src/compiled/@workflow/core/runtime/event-limit-warning.d.ts +32 -0
- package/dist/src/compiled/@workflow/core/runtime/helpers.d.ts +5 -6
- package/dist/src/compiled/@workflow/core/runtime/helpers.js +1 -1
- package/dist/src/compiled/@workflow/core/runtime/runs.d.ts +8 -0
- package/dist/src/compiled/@workflow/core/runtime/start.d.ts +16 -0
- package/dist/src/compiled/@workflow/core/runtime/suspension-handler.d.ts +15 -18
- package/dist/src/compiled/@workflow/core/runtime/vm-mode.d.ts +20 -0
- package/dist/src/compiled/@workflow/core/runtime.js +4 -4
- package/dist/src/compiled/@workflow/core/seeded-nanoid.d.ts +2 -0
- package/dist/src/compiled/@workflow/core/serialization/compression.d.ts +14 -3
- package/dist/src/compiled/@workflow/core/serialization.d.ts +1 -1
- package/dist/src/compiled/@workflow/core/serialization.js +1 -1
- package/dist/src/compiled/@workflow/core/telemetry/semantic-conventions.d.ts +0 -18
- package/dist/src/compiled/@workflow/core/version.d.ts +1 -1
- package/dist/src/compiled/@workflow/core/workflow.js +1 -1
- package/dist/src/compiled/@workflow/errors/index.d.ts +48 -0
- package/dist/src/compiled/@workflow/errors/index.js +1 -1
- package/dist/src/compiled/@workflow/world/env-config.d.ts +24 -0
- package/dist/src/compiled/@workflow/world/events.d.ts +126 -7
- package/dist/src/compiled/@workflow/world/index.d.ts +3 -3
- package/dist/src/compiled/@workflow/world/interfaces.d.ts +59 -8
- package/dist/src/compiled/@workflow/world/queue.d.ts +71 -9
- package/dist/src/compiled/@workflow/world/recovery.d.ts +6 -0
- package/dist/src/compiled/@workflow/world/test-support/duplicate-event-fixtures.d.ts +3 -0
- package/dist/src/compiled/@workflow/world/test-support/in-band-fence-conformance.d.ts +46 -0
- package/dist/src/compiled/@workflow/world-local/index.js +5 -5
- package/dist/src/compiled/@workflow/world-vercel/index.js +18 -18
- package/dist/src/compiled/_chunks/workflow/{attribute-changes-BW-kbMMn.js → attribute-changes-7se_SE2q.js} +3 -3
- package/dist/src/compiled/_chunks/workflow/dist-CcnNPAp4.js +1 -0
- package/dist/src/compiled/_chunks/workflow/dist-S9cZRway.js +3 -0
- package/dist/src/compiled/_chunks/workflow/helpers-CxNRXH0a.js +1 -0
- package/dist/src/compiled/_chunks/workflow/private-DLYTSBbu.js +1 -0
- package/dist/src/compiled/_chunks/workflow/resume-hook-CPiIfe8r.js +1 -0
- package/dist/src/compiled/_chunks/workflow/{run-DzdAqdb1.js → run-BJSLCXR4.js} +6 -6
- package/dist/src/compiled/_chunks/workflow/serialization-B9gneT9Z.js +15 -0
- package/dist/src/compiled/_chunks/workflow/sleep-BL0oQs3R.js +1 -0
- package/dist/src/compiled/_chunks/workflow/{wait-until-xbRRDuUf.js → wait-until-BPou0RGO.js} +1 -1
- package/dist/src/compiled/_chunks/workflow/workflow-routes-BaljomCk.js +1 -0
- package/dist/src/compiled/{@ai-sdk/code-mode → run}/LICENSE +1 -1
- package/dist/src/compiled/run/index.d.ts +384 -0
- package/dist/src/compiled/run/index.js +650 -0
- package/dist/src/compiler/extension-compatibility.d.ts +21 -14
- package/dist/src/compiler/extension-compatibility.js +1 -1
- package/dist/src/compiler/manifest.js +1 -1
- package/dist/src/compiler/normalize-agent-config.js +1 -1
- package/dist/src/compiler/normalize-manifest.js +1 -1
- package/dist/src/compiler/normalize-sandbox.js +1 -1
- package/dist/src/compiler/workspace-resources.js +1 -1
- package/dist/src/context/build-callback-context.js +1 -1
- package/dist/src/context/dynamic-skill-lifecycle.js +1 -1
- package/dist/src/context/providers/sandbox.js +1 -1
- package/dist/src/discover/extension-specifier.d.ts +1 -0
- package/dist/src/discover/extension-specifier.js +1 -1
- package/dist/src/evals/cli/eval.js +2 -2
- package/dist/src/evals/runner/artifacts.js +1 -1
- package/dist/src/evals/runner/derive-run-facts.d.ts +12 -0
- package/dist/src/evals/runner/derive-run-facts.js +1 -1
- package/dist/src/evals/runner/execute-task.js +1 -1
- package/dist/src/evals/types.d.ts +3 -2
- package/dist/src/eve-channel/index.js +1 -1
- package/dist/src/eve-channel/request.d.ts +0 -1
- package/dist/src/eve-channel/request.js +2 -2
- package/dist/src/execution/agent-sessions/context.d.ts +1 -1
- package/dist/src/execution/agent-sessions/context.js +1 -1
- package/dist/src/execution/coordination-dispatch-shared.d.ts +3 -0
- package/dist/src/execution/coordination-dispatch-shared.js +1 -1
- package/dist/src/execution/dynamic-workflow/program-step.d.ts +7 -7
- package/dist/src/execution/dynamic-workflow/program-step.js +1 -1
- package/dist/src/execution/dynamic-workflow/schema.d.ts +18 -11
- package/dist/src/execution/dynamic-workflow/schema.js +1 -1
- package/dist/src/execution/dynamic-workflow/tool.js +1 -1
- package/dist/src/execution/dynamic-workflow/workflow.js +1 -1
- package/dist/src/execution/eve-workflow-attributes.d.ts +3 -1
- package/dist/src/execution/eve-workflow-attributes.js +1 -1
- package/dist/src/execution/invoke-tool.js +1 -1
- package/dist/src/execution/sandbox/abort-bound-session.js +1 -1
- package/dist/src/execution/sandbox/active-connections.d.ts +28 -0
- package/dist/src/execution/sandbox/active-connections.js +1 -0
- package/dist/src/execution/sandbox/bindings/docker-cli.d.ts +10 -2
- package/dist/src/execution/sandbox/bindings/docker-cli.js +2 -2
- package/dist/src/execution/sandbox/bindings/docker-connection.d.ts +15 -0
- package/dist/src/execution/sandbox/bindings/docker-connection.js +2 -0
- package/dist/src/execution/sandbox/bindings/docker-container.d.ts +2 -0
- package/dist/src/execution/sandbox/bindings/docker-container.js +1 -1
- package/dist/src/execution/sandbox/bindings/docker-network.d.ts +5 -0
- package/dist/src/execution/sandbox/bindings/docker-network.js +1 -1
- package/dist/src/execution/sandbox/bindings/docker-templates.js +1 -1
- package/dist/src/execution/sandbox/bindings/docker.d.ts +12 -15
- package/dist/src/execution/sandbox/bindings/docker.js +1 -1
- package/dist/src/execution/sandbox/bindings/just-bash-runtime.d.ts +19 -29
- package/dist/src/execution/sandbox/bindings/just-bash-runtime.js +1 -1
- package/dist/src/execution/sandbox/bindings/just-bash.d.ts +2 -4
- package/dist/src/execution/sandbox/bindings/just-bash.js +1 -1
- package/dist/src/execution/sandbox/bindings/local-provider-utils.d.ts +0 -20
- package/dist/src/execution/sandbox/bindings/local-provider-utils.js +1 -1
- package/dist/src/execution/sandbox/bindings/local.d.ts +4 -6
- package/dist/src/execution/sandbox/bindings/local.js +1 -1
- package/dist/src/execution/sandbox/bindings/vercel-base-runtime.d.ts +2 -0
- package/dist/src/execution/sandbox/bindings/vercel-base-runtime.js +2 -2
- package/dist/src/execution/sandbox/bindings/vercel-errors.js +2 -2
- package/dist/src/execution/sandbox/bindings/vercel-lifecycle.d.ts +7 -5
- package/dist/src/execution/sandbox/bindings/vercel-lifecycle.js +1 -1
- package/dist/src/execution/sandbox/bindings/vercel.d.ts +5 -11
- package/dist/src/execution/sandbox/bindings/vercel.js +1 -2
- package/dist/src/execution/sandbox/development-cleanup.d.ts +0 -1
- package/dist/src/execution/sandbox/development-cleanup.js +1 -1
- package/dist/src/execution/sandbox/development-lazy-prewarm.js +1 -1
- package/dist/src/execution/sandbox/development-run.d.ts +0 -2
- package/dist/src/execution/sandbox/development-run.js +1 -1
- package/dist/src/execution/sandbox/dockerfile.d.ts +0 -4
- package/dist/src/execution/sandbox/dockerfile.js +1 -1
- package/dist/src/execution/sandbox/ensure.d.ts +23 -11
- package/dist/src/execution/sandbox/ensure.js +1 -1
- package/dist/src/execution/sandbox/glob-tool.js +3 -3
- package/dist/src/execution/sandbox/grep-tool.js +1 -1
- package/dist/src/execution/sandbox/logging-session.js +1 -1
- package/dist/src/execution/sandbox/prewarm.d.ts +23 -3
- package/dist/src/execution/sandbox/prewarm.js +2 -1
- package/dist/src/execution/sandbox/read-file.js +1 -1
- package/dist/src/execution/sandbox/require-sandbox.d.ts +3 -2
- package/dist/src/execution/sandbox/require-sandbox.js +1 -1
- package/dist/src/execution/sandbox/ripgrep-probe.js +1 -1
- package/dist/src/execution/sandbox/session.d.ts +10 -20
- package/dist/src/execution/sandbox/session.js +2 -2
- package/dist/src/execution/session/admission.js +1 -1
- package/dist/src/execution/session/checkpoint-migrations.js +1 -1
- package/dist/src/execution/session/entry-input.d.ts +5 -4
- package/dist/src/execution/session/entry.js +1 -1
- package/dist/src/execution/session/handoff-state.d.ts +5 -0
- package/dist/src/execution/session/handoff-state.js +1 -0
- package/dist/src/execution/session/handoff-steps.d.ts +0 -5
- package/dist/src/execution/session/handoff-steps.js +1 -1
- package/dist/src/execution/session/handoff.d.ts +2 -1
- package/dist/src/execution/session/handoff.js +1 -1
- package/dist/src/execution/session/input-queue.d.ts +3 -0
- package/dist/src/execution/session/input-queue.js +1 -1
- package/dist/src/execution/session/next-input.d.ts +3 -0
- package/dist/src/execution/session/next-input.js +1 -1
- package/dist/src/execution/session/program.js +1 -1
- package/dist/src/execution/session/timeout-control.d.ts +4 -0
- package/dist/src/execution/session/timeout-control.js +1 -1
- package/dist/src/execution/session/turn-control.d.ts +5 -2
- package/dist/src/execution/session/turn-control.js +1 -1
- package/dist/src/execution/session/turn.js +1 -1
- package/dist/src/execution/session-inbox/inbox.d.ts +9 -1
- package/dist/src/execution/session-inbox/inbox.js +1 -1
- package/dist/src/execution/session-inbox/protocol.d.ts +2 -1
- package/dist/src/execution/session-inbox/protocol.js +1 -1
- package/dist/src/execution/session-inbox/resume.d.ts +2 -1
- package/dist/src/execution/session-inbox/resume.js +1 -1
- package/dist/src/execution/session-prewarm.d.ts +8 -0
- package/dist/src/execution/session-prewarm.js +1 -0
- package/dist/src/execution/skills/instructions.js +1 -1
- package/dist/src/execution/tools/agent-router-workflow.js +1 -1
- package/dist/src/execution/tools/workflow/body.js +1 -1
- package/dist/src/execution/tools/workflow/step-context.d.ts +11 -0
- package/dist/src/execution/tools/workflow/step-execution.js +1 -1
- package/dist/src/execution/tools/workflow/step.js +1 -1
- package/dist/src/execution/workflow-runtime.js +1 -1
- package/dist/src/extensions/git/extension/lib/github-shell-schema.js +1 -1
- package/dist/src/framework/sources/modules/sandbox.d.ts +1 -1
- package/dist/src/harness/attachment-staging.d.ts +0 -7
- package/dist/src/harness/attachment-staging.js +1 -1
- package/dist/src/harness/hitl/index.d.ts +2 -1
- package/dist/src/harness/hitl/index.js +1 -1
- package/dist/src/harness/hitl/view.d.ts +1 -0
- package/dist/src/harness/hitl/view.js +1 -0
- package/dist/src/harness/model-call/run.js +1 -1
- package/dist/src/harness/semantic-errors/rules/sandbox.d.ts +3 -5
- package/dist/src/harness/semantic-errors/rules/sandbox.js +1 -1
- package/dist/src/harness/step/prompt.js +1 -1
- package/dist/src/harness/tool-history-repair.d.ts +9 -0
- package/dist/src/harness/tool-history-repair.js +1 -0
- package/dist/src/harness/tool-model-output.d.ts +19 -3
- package/dist/src/harness/tool-model-output.js +1 -1
- package/dist/src/internal/application/compiled-artifacts.js +8 -4
- package/dist/src/internal/application/optional-package-import.d.ts +10 -0
- package/dist/src/internal/application/optional-package-import.js +1 -1
- package/dist/src/internal/application/stamped-package-version.js +1 -1
- package/dist/src/internal/attachments/limited-read.d.ts +2 -2
- package/dist/src/internal/authored-module-build-options.d.ts +6 -0
- package/dist/src/internal/authored-module-build-options.js +1 -1
- package/dist/src/internal/authored-module-cache.d.ts +10 -0
- package/dist/src/internal/authored-module-cache.js +1 -0
- package/dist/src/internal/authored-module-graph.js +1 -1
- package/dist/src/internal/authored-module-loader.js +1 -1
- package/dist/src/internal/authored-relative-extension-resolver.js +1 -1
- package/dist/src/internal/bundler/nitro-rolldown.d.ts +3 -1
- package/dist/src/internal/bundler/nitro-rolldown.js +1 -1
- package/dist/src/internal/bundler/pseudo-packages.d.ts +11 -0
- package/dist/src/internal/bundler/pseudo-packages.js +1 -0
- package/dist/src/internal/nitro/host/build-extension.d.ts +6 -0
- package/dist/src/internal/nitro/host/build-extension.js +2 -2
- package/dist/src/internal/nitro/host/compiled-sandbox-provider-prune-plugin.d.ts +3 -1
- package/dist/src/internal/nitro/host/compiled-sandbox-provider-prune-plugin.js +3 -5
- package/dist/src/internal/nitro/host/create-application-nitro.d.ts +2 -3
- package/dist/src/internal/nitro/host/create-application-nitro.js +1 -1
- package/dist/src/internal/nitro/host/dev-authored-rebuild-coordinator.d.ts +2 -0
- package/dist/src/internal/nitro/host/dev-authored-rebuild-coordinator.js +1 -1
- package/dist/src/internal/nitro/host/dev-authored-source-watcher.js +1 -1
- package/dist/src/internal/nitro/host/dev-build-host.d.ts +83 -0
- package/dist/src/internal/nitro/host/dev-build-host.js +1 -0
- package/dist/src/internal/nitro/host/dev-build-operations.d.ts +6 -0
- package/dist/src/internal/nitro/host/dev-build-operations.js +1 -0
- package/dist/src/internal/nitro/host/dev-build-process.d.ts +1 -0
- package/dist/src/internal/nitro/host/dev-build-process.js +1 -0
- package/dist/src/internal/nitro/host/development-runtime-prune-plugin.d.ts +4 -1
- package/dist/src/internal/nitro/host/development-runtime-prune-plugin.js +3 -2
- package/dist/src/internal/nitro/host/drained-nitro-dev-server.d.ts +13 -0
- package/dist/src/internal/nitro/host/drained-nitro-dev-server.js +1 -1
- package/dist/src/internal/nitro/host/optional-engine-dependency-plugin.js +1 -1
- package/dist/src/internal/nitro/host/prepare-application-host.d.ts +3 -0
- package/dist/src/internal/nitro/host/prepare-application-host.js +1 -1
- package/dist/src/internal/nitro/host/sandbox-shutdown-plugin.js +1 -1
- package/dist/src/internal/nitro/host/start-development-server.js +2 -2
- package/dist/src/internal/nitro/host/start-production-server.js +3 -3
- package/dist/src/internal/nitro/host/workflow-sandbox-runtime-plugin.js +1 -1
- package/dist/src/internal/nitro/host.js +1 -1
- package/dist/src/internal/workflow/local-world-delivery-auth.d.ts +17 -0
- package/dist/src/internal/workflow/local-world-delivery-auth.js +1 -0
- package/dist/src/internal/workflow/queue-namespace.d.ts +2 -0
- package/dist/src/internal/workflow/queue-namespace.js +1 -1
- package/dist/src/internal/workflow-bundle/builder-support.d.ts +0 -1
- package/dist/src/internal/workflow-bundle/builder-support.js +2 -2
- package/dist/src/internal/workflow-bundle/builder.js +2 -2
- package/dist/src/internal/workflow-bundle/vercel-workflow-output.d.ts +1 -1
- package/dist/src/internal/workflow-bundle/vercel-workflow-output.js +1 -1
- package/dist/src/protocol/prewarm-session.d.ts +14 -0
- package/dist/src/protocol/prewarm-session.js +1 -0
- package/dist/src/protocol/routes.d.ts +2 -2
- package/dist/src/public/channels/discord/authorization.d.ts +45 -0
- package/dist/src/public/channels/discord/authorization.js +3 -0
- package/dist/src/public/channels/discord/defaults.d.ts +14 -3
- package/dist/src/public/channels/discord/defaults.js +2 -2
- package/dist/src/public/channels/discord/discordChannel.d.ts +15 -1
- package/dist/src/public/channels/discord/discordChannel.js +1 -1
- package/dist/src/public/channels/discord/gateway/connection.d.ts +26 -0
- package/dist/src/public/channels/discord/gateway/connection.js +1 -0
- package/dist/src/public/channels/discord/gateway/forwarder.d.ts +14 -0
- package/dist/src/public/channels/discord/gateway/forwarder.js +1 -0
- package/dist/src/public/channels/discord/gateway/index.d.ts +59 -0
- package/dist/src/public/channels/discord/gateway/index.js +1 -0
- package/dist/src/public/channels/discord/inbound.d.ts +10 -3
- package/dist/src/public/channels/discord/inbound.js +2 -2
- package/dist/src/public/channels/discord/index.d.ts +3 -2
- package/dist/src/public/channels/discord/index.js +1 -1
- package/dist/src/public/channels/discord/messages.d.ts +116 -0
- package/dist/src/public/channels/discord/messages.js +2 -0
- package/dist/src/public/channels/github/checkout.js +1 -1
- package/dist/src/public/channels/linq/linqChannel.d.ts +4 -1
- package/dist/src/public/channels/linq/linqChannel.js +1 -1
- package/dist/src/public/channels/photon/photonIMessageChannel.js +1 -1
- package/dist/src/public/channels/same-environment-oidc.d.ts +7 -0
- package/dist/src/public/channels/same-environment-oidc.js +1 -0
- package/dist/src/public/definitions/channel.js +1 -1
- package/dist/src/public/definitions/sandbox.d.ts +1 -1
- package/dist/src/public/next/server.js +1 -1
- package/dist/src/public/sandbox/docker-sandbox.d.ts +6 -1
- package/dist/src/public/sandbox/docker.d.ts +1 -8
- package/dist/src/public/sandbox/index.d.ts +3 -3
- package/dist/src/public/sandbox/just-bash-sandbox.d.ts +87 -7
- package/dist/src/public/sandbox/just-bash.d.ts +1 -1
- package/dist/src/public/sandbox/provider.d.ts +5 -1
- package/dist/src/public/sandbox/provider.js +1 -1
- package/dist/src/public/sandbox/vercel-sandbox.d.ts +16 -9
- package/dist/src/public/sandbox/vercel.d.ts +0 -1
- package/dist/src/public/sandbox/vercel.js +1 -1
- package/dist/src/public/tools/agent.d.ts +8 -1
- package/dist/src/public/tools/agent.js +1 -1
- package/dist/src/react/use-eve-agent.d.ts +1 -1
- package/dist/src/runtime/agent/resolve-model.js +1 -1
- package/dist/src/runtime/connections/openapi-client.d.ts +2 -0
- package/dist/src/runtime/connections/openapi-client.js +1 -1
- package/dist/src/runtime/resolve-agent-graph.js +1 -1
- package/dist/src/runtime/resolve-agent.js +1 -1
- package/dist/src/runtime/resolve-channel.js +1 -1
- package/dist/src/runtime/resolve-sandbox.js +1 -1
- package/dist/src/runtime/sandbox/prepared-artifacts.js +1 -1
- package/dist/src/runtime/sandbox/registry.d.ts +2 -0
- package/dist/src/runtime/sandbox/registry.js +1 -1
- package/dist/src/runtime/subagents/workflow.d.ts +6 -0
- package/dist/src/runtime/subagents/workflow.js +1 -1
- package/dist/src/runtime/workspace/seed-files.d.ts +9 -12
- package/dist/src/runtime/workspace/seed-files.js +1 -1
- package/dist/src/runtime/workspace/spec.d.ts +1 -1
- package/dist/src/runtime/workspace/spec.js +1 -1
- package/dist/src/runtime/workspace/types.d.ts +2 -6
- package/dist/src/sandbox/provider.d.ts +185 -0
- package/dist/src/sandbox/provider.js +1 -0
- package/dist/src/sandbox/providers/default.d.ts +20 -19
- package/dist/src/sandbox/providers/default.js +1 -1
- package/dist/src/sandbox/providers/docker.d.ts +5 -2
- package/dist/src/sandbox/providers/docker.js +1 -1
- package/dist/src/sandbox/providers/just-bash.d.ts +4 -3
- package/dist/src/sandbox/providers/just-bash.js +1 -1
- package/dist/src/sandbox/providers/vercel.d.ts +4 -10
- package/dist/src/sandbox/providers/vercel.js +1 -1
- package/dist/src/sandbox/providers.d.ts +0 -1
- package/dist/src/sandbox/providers.js +1 -1
- package/dist/src/sandbox/state.d.ts +44 -0
- package/dist/src/sandbox/state.js +1 -1
- package/dist/src/self-modification/deployed-sandbox.d.ts +4 -9
- package/dist/src/self-modification/deployed-sandbox.js +1 -1
- package/dist/src/self-modification/filesystem.d.ts +3 -3
- package/dist/src/self-modification/remote/config.d.ts +2 -2
- package/dist/src/self-modification/remote/config.js +1 -1
- package/dist/src/self-modification/setup.d.ts +0 -1
- package/dist/src/self-modification/setup.js +8 -8
- package/dist/src/setup/integrations/discord/api.d.ts +7 -0
- package/dist/src/setup/integrations/discord/api.js +1 -1
- package/dist/src/setup/integrations/discord/daemon.d.ts +18 -0
- package/dist/src/setup/integrations/discord/daemon.js +21 -0
- package/dist/src/setup/integrations/discord/setup.d.ts +24 -4
- package/dist/src/setup/integrations/discord/setup.js +5 -4
- package/dist/src/setup/integrations/self-modification/setup.js +1 -1
- package/dist/src/setup/scaffold/create/project.js +1 -1
- package/dist/src/setup/scaffold/update/web-options.js +1 -1
- package/dist/src/setup/scaffold/version-tokens.d.ts +0 -1
- package/dist/src/setup/scaffold/version-tokens.js +1 -1
- package/dist/src/shared/agent-definition.d.ts +2 -0
- package/dist/src/shared/built-server-start-failure.d.ts +12 -0
- package/dist/src/shared/built-server-start-failure.js +3 -0
- package/dist/src/shared/framework-eve-server.d.ts +2 -0
- package/dist/src/shared/framework-eve-server.js +2 -2
- package/dist/src/shared/sandbox-environment.d.ts +4 -10
- package/dist/src/shared/sandbox-environment.js +1 -1
- package/dist/src/shared/sandbox-network-policy.d.ts +45 -9
- package/dist/src/shared/sandbox-provider.d.ts +0 -103
- package/dist/src/shared/sandbox-provider.js +1 -1
- package/dist/src/shared/sandbox-recorded-data-error.d.ts +4 -0
- package/dist/src/shared/sandbox-recorded-data-error.js +1 -0
- package/dist/src/shared/sandbox-session-gone-error.d.ts +12 -0
- package/dist/src/shared/sandbox-session-gone-error.js +1 -0
- package/dist/src/shared/sandbox-session.d.ts +97 -83
- package/dist/src/shared/sandbox-template-error.d.ts +19 -4
- package/dist/src/shared/sandbox-template-error.js +1 -1
- package/dist/src/shared/sandbox-tool-session-error.d.ts +4 -0
- package/dist/src/shared/sandbox-tool-session-error.js +1 -0
- package/dist/src/shared/skill-package.js +1 -1
- package/dist/src/shared/skill-paths.d.ts +4 -5
- package/dist/src/shared/skill-paths.js +2 -2
- package/dist/src/shared/workflow-sandbox.d.ts +4 -41
- package/dist/src/shared/workflow-sandbox.js +1 -1
- package/dist/src/svelte/index.js +1 -1
- package/dist/src/svelte/use-eve-agent.d.ts +1 -1
- package/dist/src/svelte/use-eve-agent.js +1 -1
- package/dist/src/tools/model-output.d.ts +23 -5
- package/dist/src/tools/model-output.js +1 -1
- package/dist/src/tools/provided/ask-question-workflow.js +1 -1
- package/dist/src/tools/provided/glob.js +1 -1
- package/dist/src/tools/provided/grep.js +1 -1
- package/dist/src/tools/provided/read-file.js +1 -1
- package/dist/src/tools/provided/sleep-workflow.js +1 -1
- package/dist/src/tools/provided/workflow.js +1 -1
- package/dist/src/tools/provided/write-file.js +1 -1
- package/dist/src/tools/workflow-definition.d.ts +19 -4
- package/dist/src/vue/index.js +1 -1
- package/dist/src/vue/use-eve-agent.d.ts +1 -1
- package/dist/src/vue/use-eve-agent.js +1 -1
- package/docs/channels/custom.mdx +3 -3
- package/docs/channels/discord.mdx +279 -7
- package/docs/channels/eve.mdx +13 -2
- package/docs/channels/linq.mdx +2 -2
- package/docs/channels/mcp.mdx +2 -2
- package/docs/channels/overview.mdx +1 -1
- package/docs/channels/photon.mdx +1 -1
- package/docs/concepts/built-in-tools.md +31 -8
- package/docs/concepts/execution-model-and-durability.mdx +6 -101
- package/docs/concepts/security-model.md +2 -0
- package/docs/concepts/sessions-runs-and-streaming.md +44 -36
- package/docs/connections/openapi.mdx +2 -0
- package/docs/evals/reporters.mdx +1 -1
- package/docs/evals/running.mdx +1 -1
- package/docs/guides/client/messages.mdx +1 -1
- package/docs/guides/deployment/overview.md +4 -4
- package/docs/guides/deployment/self-hosting.md +50 -1
- package/docs/guides/dev-tui.md +1 -1
- package/docs/guides/dynamic-capabilities.md +1 -1
- package/docs/guides/frontend/overview.mdx +26 -6
- package/docs/guides/instrumentation/agent-runs.mdx +16 -0
- package/docs/guides/self-modification.md +1 -1
- package/docs/guides/session-context.md +1 -1
- package/docs/instructions.mdx +1 -1
- package/docs/reference/agent-files.md +3 -3
- package/docs/reference/cli.md +7 -2
- package/docs/reference/typescript-api.md +9 -3
- package/docs/sandbox/custom-providers.mdx +254 -0
- package/docs/sandbox/default.mdx +71 -4
- package/docs/sandbox/docker.mdx +15 -3
- package/docs/sandbox/index.mdx +27 -103
- package/docs/sandbox/just-bash.mdx +54 -0
- package/docs/sandbox/meta.json +9 -1
- package/docs/sandbox/troubleshooting.mdx +215 -0
- package/docs/sandbox/vercel.mdx +48 -7
- package/docs/skills.mdx +1 -1
- package/docs/subagents/index.mdx +2 -2
- package/docs/tools/overview.mdx +19 -0
- package/docs/tools/workflows.mdx +73 -5
- package/docs/tutorial/run-analysis.mdx +2 -2
- package/package.json +14 -20
- package/dist/src/compiled/@ai-sdk/code-mode/_run.d.ts +0 -1
- package/dist/src/compiled/@ai-sdk/code-mode/index.d.ts +0 -325
- package/dist/src/compiled/@ai-sdk/code-mode/index.js +0 -660
- package/dist/src/compiled/_chunks/workflow/dist-CyBgVS7g.js +0 -1
- package/dist/src/compiled/_chunks/workflow/dist-T5NnW-0k.js +0 -3
- package/dist/src/compiled/_chunks/workflow/helpers-DlLD3ov_.js +0 -1
- package/dist/src/compiled/_chunks/workflow/private-tQUuwBoQ.js +0 -1
- package/dist/src/compiled/_chunks/workflow/resume-hook-DMsV_b4n.js +0 -1
- package/dist/src/compiled/_chunks/workflow/serialization-DPdYS_w2.js +0 -16
- package/dist/src/compiled/_chunks/workflow/sleep-BY6leHh8.js +0 -1
- package/dist/src/compiled/_chunks/workflow/workflow-routes-CwqB063q.js +0 -1
- package/dist/src/execution/sandbox/active-handles.d.ts +0 -32
- package/dist/src/execution/sandbox/active-handles.js +0 -1
- package/dist/src/execution/sandbox/bindings/docker-session.d.ts +0 -6
- package/dist/src/execution/sandbox/bindings/docker-session.js +0 -2
- package/dist/src/execution/sandbox/bindings/immutable-resources.d.ts +0 -15
- package/dist/src/execution/sandbox/bindings/immutable-resources.js +0 -2
- package/dist/src/execution/sandbox/bindings/microsandbox-create.d.ts +0 -12
- package/dist/src/execution/sandbox/bindings/microsandbox-create.js +0 -1
- package/dist/src/execution/sandbox/bindings/microsandbox-lifecycle.d.ts +0 -42
- package/dist/src/execution/sandbox/bindings/microsandbox-lifecycle.js +0 -1
- package/dist/src/execution/sandbox/bindings/microsandbox-metadata.d.ts +0 -29
- package/dist/src/execution/sandbox/bindings/microsandbox-metadata.js +0 -1
- package/dist/src/execution/sandbox/bindings/microsandbox-network.d.ts +0 -18
- package/dist/src/execution/sandbox/bindings/microsandbox-network.js +0 -1
- package/dist/src/execution/sandbox/bindings/microsandbox-options.d.ts +0 -37
- package/dist/src/execution/sandbox/bindings/microsandbox-options.js +0 -1
- package/dist/src/execution/sandbox/bindings/microsandbox-platform.d.ts +0 -21
- package/dist/src/execution/sandbox/bindings/microsandbox-platform.js +0 -21
- package/dist/src/execution/sandbox/bindings/microsandbox-process.d.ts +0 -3
- package/dist/src/execution/sandbox/bindings/microsandbox-process.js +0 -1
- package/dist/src/execution/sandbox/bindings/microsandbox-provider-state.d.ts +0 -11
- package/dist/src/execution/sandbox/bindings/microsandbox-provider-state.js +0 -1
- package/dist/src/execution/sandbox/bindings/microsandbox-runtime.d.ts +0 -82
- package/dist/src/execution/sandbox/bindings/microsandbox-runtime.js +0 -1
- package/dist/src/execution/sandbox/bindings/microsandbox-templates.d.ts +0 -12
- package/dist/src/execution/sandbox/bindings/microsandbox-templates.js +0 -1
- package/dist/src/execution/sandbox/bindings/microsandbox.d.ts +0 -16
- package/dist/src/execution/sandbox/bindings/microsandbox.js +0 -1
- package/dist/src/execution/sandbox/provider-host-development.d.ts +0 -2
- package/dist/src/execution/sandbox/provider-host-development.js +0 -1
- package/dist/src/execution/sandbox/provider-host.d.ts +0 -2
- package/dist/src/execution/sandbox/provider-host.js +0 -1
- package/dist/src/execution/tool-session/sandbox.d.ts +0 -22
- package/dist/src/execution/tool-session/sandbox.js +0 -1
- package/dist/src/public/sandbox/microsandbox-sandbox.d.ts +0 -48
- package/dist/src/public/sandbox/microsandbox-sandbox.js +0 -1
- package/dist/src/public/sandbox/microsandbox.d.ts +0 -9
- package/dist/src/public/sandbox/microsandbox.js +0 -1
- package/dist/src/sandbox/providers/microsandbox.d.ts +0 -12
- package/dist/src/sandbox/providers/microsandbox.js +0 -1
- package/docs/sandbox/microsandbox.mdx +0 -31
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import{setConsoleRecordSubscriber}from"../console-records.js";import{buildAgentHeader}from"./agent-header.js";import{PROMPT_COMMANDS,isPromptControlCommand,parsePromptCommand,promptCommandSpec}from"./prompt-commands.js";import{argumentTypeaheadCompletion,argumentTypeaheadFor,argumentTypeaheadLoadingLabel,argumentTypeaheadQuery,moveArgumentTypeaheadSelection,renderArgumentSuggestions,selectedArgumentSuggestion}from"./argument-typeahead.js";import{detectMarkdownRendering}from"./markdown.js";import{renderAttentionRows,renderBlockLines}from"./blocks.js";import{copyTextToClipboard}from"./clipboard.js";import{dismissTypeahead,inlineCommandHint,isTypeaheadOpen,moveTypeaheadSelection,renderCommandSuggestions,selectedTypeaheadCommand,typeaheadCompletion,typeaheadFor}from"./command-typeahead.js";import{interruptedError}from"./errors.js";import{formatDevRebuildStatus,summarizeChangedFiles}from"./dev-rebuild-status.js";import{formatStoredDiagnostic,presentDiagnostic}from"./diagnostic-presentation.js";import{EMPTY_LINE,KillRing,PromptHistory,applyLineEditorKey,deleteForward,layoutPromptInput,lineOf,movePromptLine,visibleLine}from"./line-editor.js";import{enterBadge,flowMessageRows,renderAcknowledgeQuestion,renderSelectQuestion,renderTextQuestion}from"./setup-panel.js";import{renderFlowDrawer,renderTransientDrawer}from"./flow-drawer.js";import{isLogVisible,nextLogDisplayMode}from"./log-display-mode.js";import{MessageQueue,renderMessageQueueRows}from"./message-queue.js";import{initialPromptPlaceholder}from"./prompt-placeholder.js";import{initialProviderPickerState,transitionProviderPicker}from"./provider-picker.js";import{inputContextLabel,
|
|
2
|
-
`);if(this.#P){t!==this.#F&&(this.#F=t,this.#en({kind:`agent-header`,body:t,live:!1})),this.#on();return}this.#P=!0,this.#F=t,this.#n.flush(this.#dn(),this.#gn(this.#Cn()))}beginStartupDraft(e){this.#Mt({title:e.title}),this.#W=!0,this.#X=!0,this.#k=`starting`,this.#N={name:e.title},this.#M=Date.now();let t=lineOf(stripPromptControlCharacters(e.initialDraft??``));this.#A=t,this.#et(t),this.#Ut(),this.#Kt(),this.#on();let apply=e=>{t=e,this.#A=e,this.#Gt(),this.#et(t),this.#on()};this.#j=e=>{if(e.type===`escape`&&this.#We!==void 0){this.#We(`escape`);return}if(e.type===`ctrl-c`&&this.#We!==void 0){this.#Ot(),this.#We(`ctrl-c`);return}let n=this.#U.apply(t,e,{multiline:!0});if(n!==void 0){apply(n);return}if(e.type===`enter`&&t.text.trim().length>0){this.#He.enqueue(t.text)&&apply(EMPTY_LINE);return}e.type===`ctrl-c`&&this.#fe?.()},this.#Xe()}#Xe(){this.#A!==void 0&&this.#j!==void 0&&(this.#Ht(),this.#et(this.#A),this.#W=!0,this.#be=this.#j,this.#Ft())}finishStartupDraft(){let e={draft:this.#A?.text??this.#B,queuedPrompt:this.#He.takePrompt()};return this.#A=void 0,this.#j=void 0,this.#It(),this.#Wt(),this.#W=!1,this.#X=!1,e}async readInput(e){this.#Mt(e),this.#C?.working!==!0&&this.#tn(),this.#W=!0,this.#X=!0,this.#ue=this.#de,this.#de=!1;let t=e?.initialDraft===void 0?this.#ee:lineOf(stripPromptControlCharacters(e.initialDraft));return this.#H.begin(t.text),this.#et(t),this.#Je(t.text),this.#Ut(),this.#on(),await new Promise((n,r)=>{let i=e?.signal,release=()=>{this.#te=void 0,i?.removeEventListener(`abort`,onAbort),this.#G=void 0,this.#K=void 0,this.#W=!1,this.#Wt(),this.#It(),this.#on()},finish=e=>{release(),n(e)},onAbort=()=>finish(void 0);if(i?.addEventListener(`abort`,onAbort,{once:!0}),i?.aborted){onAbort();return}this.#re=e=>{i?.removeEventListener(`abort`,onAbort),r(e)};let apply=e=>{t=e,this.#ee=e,this.#Gt(),this.#et(t),this.#Je(e.text),this.#on()};this.#te=apply;let recall=e=>{e!==void 0&&apply(lineOf(e))},interrupt=()=>{this.#G=void 0,this.#Wt(),this.#Pt(),r(interruptedError())},cancel=()=>{this.#ne=!0,finish({type:`cancel`})},suggestions=()=>this.#G!==void 0&&isTypeaheadOpen(this.#G)?this.#G:void 0,argumentSuggestions=()=>this.#K?.suggestions.length?this.#K:void 0,highlighted=()=>{let e=suggestions();return e===void 0?void 0:selectedTypeaheadCommand(e)};this.#be=e=>{e.type!==`ctrl-c`&&this.#ue&&(this.#ue=!1,this.#on());let n=this.#U.apply(t,e,{multiline:!0});if(n!==void 0){apply(n);return}let r=this.#C?.working===!0;switch(e.type){case`up`:case`ctrl-p`:{let e=argumentSuggestions();if(e!==void 0){this.#K=moveArgumentTypeaheadSelection(e,-1),this.#on();break}let n=suggestions();if(n!==void 0){this.#G=moveTypeaheadSelection(n,-1),this.#on();break}let r=movePromptLine(t,`up`);r===void 0?recall(this.#H.previous(t.text)):apply(r);break}case`down`:case`ctrl-n`:{let e=argumentSuggestions();if(e!==void 0){this.#K=moveArgumentTypeaheadSelection(e,1),this.#on();break}let n=suggestions();if(n!==void 0){this.#G=moveTypeaheadSelection(n,1),this.#on();break}let r=movePromptLine(t,`down`);r===void 0?recall(this.#H.next()):apply(r);break}case`tab`:{let e=argumentSuggestions(),t=e===void 0?void 0:selectedArgumentSuggestion(e);if(e!==void 0&&t!==void 0){apply(lineOf(argumentTypeaheadCompletion(e,t)));break}let n=highlighted();n!==void 0&&apply(lineOf(typeaheadCompletion(n)));break}case`escape`:{if(this.#K!==void 0){this.#K=void 0,this.#on();break}let e=suggestions();if(e!==void 0){this.#G=dismissTypeahead(e),this.#on();break}r&&!this.#ne&&cancel();break}case`enter`:{let e=argumentSuggestions(),n=e===void 0?void 0:selectedArgumentSuggestion(e),i=highlighted();if(e!==void 0&&n?.next!==void 0&&e.completed.length===0){apply(lineOf(`${argumentTypeaheadCompletion(e,n)} `));break}if(e===void 0&&i!==void 0&&this.#q!==void 0&&(i.name===`add`||i.name===`login`||i.name===`loglevel`||i.name===`model`)){apply(lineOf(typeaheadCompletion(i)));break}let a=e!==void 0&&n!==void 0?argumentTypeaheadCompletion(e,n):i!==void 0&&parsePromptCommand(t.text)===null?typeaheadCompletion(i).trimEnd():t.text;if(a.trim().length===0)break;promptCommandSpec(a)?.spec.history!==`omit`&&this.#H.add(a),this.#ee=EMPTY_LINE,this.#et(EMPTY_LINE),isPromptControlCommand(a)?(this.#at(stripTerminalControls(a.trim())),r&&parsePromptCommand(a)?.type===`cancel`&&(this.#ne=!0)):(this.#Z=!0,this.#f?.recordPrompt(),r&&this.#T.push(a)),finish({type:`submit`,text:a});break}case`ctrl-d`:t.text.length===0?(this.#Ot(),interrupt()):apply(deleteForward(t));break;case`ctrl-l`:this.#ln();break;case`ctrl-r`:this.#on();break;case`ctrl-c`:if(r){if(!this.#ne){cancel();break}this.#ne=!1,this.#de=!0,finish({type:`interrupt`});break}if(this.#ue){this.#Ot(),interrupt();break}this.#ue=!0,apply(EMPTY_LINE)}},this.#Ft()})}renderConversation(e){let t=this.#C?.working===!0;this.#C=e,e.conversation.messages.some(e=>e.role===`user`)&&(this.#Z=!0);let n=this.#x.project(e,this.#Qe());this.#Xt();let r=new Set;for(let[e,t]of n.entries()){let i=t.id;if(this.#v.has(i))continue;r.add(i);let a=this.#g.get(i);if(a!==t){if(t.updateSeq=++this.#b,a!==void 0){this.#h[this.#h.indexOf(a)]=t,this.#g.set(i,t);continue}if(t.kind===`user`){let e=this.#T.indexOf(t.body??``);e!==-1&&(this.#T.splice(e,1),t.promptOrigin=`steer`)}this.#Ze(t,n.slice(e+1))}}for(let e of this.#w)r.has(e)||this.#an(e);this.#w=r,e.working&&!t?this.#Q.armed||this.#Q.arm(e.data.usage):!e.working&&t&&(this.#ne=!1,this.#W&&this.#tn()),this.#$t(),this.#on()}#Ze(e,t){let n=t.find(e=>this.#g.has(e.id)),r=n===void 0?-1:this.#h.indexOf(this.#g.get(n.id));if(r===-1){this.#en(e);return}e.id!==this.#Me?.id&&this.#Ln(),this.#h.splice(r,0,e),this.#g.set(e.id,e)}#Qe(){return{tools:this.#o,reasoning:this.#s,subagents:this.#c,connectionAuth:this.#l,subagentNames:this.#O,diagnosticsPath:this.#f?.displayPath,dot:this.#i.glyph.dot}}#$e(e){if(e?.taskId===void 0||e.requester!==void 0||this.#C===void 0)return inputContextLabel(e,this.#i);let t=this.#x.taskLabel(this.#C.conversation,e.taskId);return inputContextLabel(t===void 0?e:{...e,requester:t},this.#i)}#et(e){this.#B=e.text,this.#V=e.cursor}async readToolApproval(e,t){this.#Mt(t),this.#W=!1;let n=0;return this.#Le=t=>renderTransientDrawer([` ${this.#i.colors.bold(stripTerminalControls(e.prompt))}`,``,...renderQuestionChoices([{id:`yes`,label:`Yes`},{id:`no`,label:`No`}],n,this.#i)],[`y yes · n no · Ctrl-C cancel`],this.#i,t,this.#$e(e.context),!1,`left`),this.#on(),await new Promise((e,t)=>{let approve=()=>{this.#Le=void 0,this.#It(),this.#on(),e({approved:!0})},deny=()=>{this.#Le=void 0,this.#It(),this.#on(),e({approved:!1,reason:`Denied by user.`})};this.#re=t,this.#be=e=>{switch(e.type){case`text`:{if(e.framing!==`unframed`)break;let t=e.value.toLowerCase();t===`y`?approve():t===`n`&&deny();break}case`up`:case`ctrl-p`:n=0,this.#on();break;case`down`:case`ctrl-n`:n=1,this.#on();break;case`enter`:n===0?approve():deny();break;case`ctrl-r`:this.#on();break;case`ctrl-c`:this.#Le=void 0,this.#Pt(),t(interruptedError())}},this.#Ft()})}async readInputQuestion(e,t){this.#Mt(t),this.#W=!1,this.#X=!1;let n=e.options??[],r=n.length>0,i=(e.allowFreeform===!0||!r)&&r,a=n.length+ +!!i,o=questionSectionId(e.requestId),s=r?`select`:`text`,c=0,l=EMPTY_LINE,isOnFreeformRow=()=>i&&c===n.length,selectDrawer=t=>renderTransientDrawer([...renderQuestionPanel({prompt:stripTerminalControls(e.prompt),options:n,cursor:c,allowFreeform:i,editor:l,caretVisible:this.#pe},this.#i,t)],[`↑/↓ move · enter to select · esc to dismiss`],this.#i,t,this.#$e(e.context),!1,`left`),textPanel=t=>{let n=promptInputRows({text:l.text,cursor:l.cursor,width:Math.max(1,t-2),theme:this.#i,caretVisible:this.#pe,ghost:``,maxRows:3});return n.at(-1)===``&&n.pop(),renderTransientDrawer([` ${this.#i.colors.bold(stripTerminalControls(e.prompt))}`,``,...n.map(e=>` ${e}`)],[`Enter submit · Esc dismiss`],this.#i,t,this.#$e(e.context),!1,`left`)},syncFreeformCaret=()=>{isOnFreeformRow()?this.#Ut():(this.#Wt(),this.#Gt())};s===`select`?(s=`select`,this.#W=!1,this.#an(o),this.#Le=selectDrawer,syncFreeformCaret(),this.#on()):(s=`text`,this.#Le=textPanel,this.#W=!0,this.#et(l),this.#Ut(),this.#on());let finalize=t=>{this.#Le=void 0,this.#in({id:o,kind:`question`,title:stripTerminalControls(e.prompt),body:`${this.#i.colors.dim(this.#i.glyph.elbow)} ${stripTerminalControls(t.label)}`,preformatted:!0,live:!1}),this.#W=!1,this.#Wt(),this.#It(),this.#on();let n={};return t.optionId!==void 0&&(n.optionId=t.optionId),t.text!==void 0&&(n.text=t.text),n},dismiss=()=>{this.#Le=void 0,this.#in({id:o,kind:`question`,title:stripTerminalControls(e.prompt),body:`${this.#i.colors.dim(this.#i.glyph.elbow)} ${this.#i.colors.dim(`Skipped. The question stays open.`)}`,preformatted:!0,live:!1}),this.#W=!1,this.#Wt(),this.#It(),this.#on(),u(void 0)},moveCursor=e=>{a!==0&&(c=(c+e+a)%a,syncFreeformCaret(),this.#on())},selectOptionAt=e=>{let t=n[e];t&&u(finalize({optionId:t.id,label:t.label}))},u;return await new Promise((t,n)=>{this.#re=n,u=t,this.#be=t=>{if(t.type===`ctrl-c`){if((s===`text`||isOnFreeformRow())&&l.text.length>0){l=EMPTY_LINE,this.#Gt(),s===`text`&&this.#et(l),this.#on();return}this.#Le=void 0,this.#Wt(),this.#Pt(),n(interruptedError());return}if(t.type===`ctrl-r`){this.#on();return}if(s===`select`){let n=setupSelectionIntent(t,{textNavigation:!isOnFreeformRow()});if(n?.kind===`move`){moveCursor(n.direction===`up`?-1:1);return}switch(t.type){case`up`:case`ctrl-p`:moveCursor(-1);break;case`down`:case`ctrl-n`:moveCursor(1);break;case`enter`:if(isOnFreeformRow()){let t=resolveQuestionText(l.text,e);t!==void 0&&u(finalize(t));break}selectOptionAt(c);break;case`escape`:if(isOnFreeformRow()&&l.text.length>0){l=EMPTY_LINE,this.#Gt(),this.#on();break}dismiss();break;default:if(isOnFreeformRow()){let e=this.#U.apply(l,t);e!==void 0&&(l=e,this.#Gt(),this.#on())}}return}let r=this.#U.apply(l,t,{multiline:!0});if(r!==void 0){l=r,this.#Gt(),this.#et(l),this.#on();return}switch(t.type){case`up`:case`down`:{let e=movePromptLine(l,t.type);e!==void 0&&(l=e,this.#Gt(),this.#et(l),this.#on());break}case`enter`:{let t=resolveQuestionText(l.text,e);if(t===void 0)break;u(finalize(t));break}case`escape`:if(l.text.length>0){l=EMPTY_LINE,this.#Gt(),this.#et(l),this.#on();break}dismiss()}},this.#Ft()})}setVercelStatus(e){this.#R=e,this.#on()}setRemoteConnectionStatus(e){this.#z=e,this.#on()}reset(){this.#h=[],this.#g.clear(),this.#v.clear(),this.#L=void 0,this.#I.length=0,this.#y.length=0,this.#P=!1,this.#F=void 0,this.#tt(),this.#Z=!1,this.#Me=void 0,this.#oe&&(this.#n.clearAll(),this.#on())}renderSessionBoundary(){this.#tn();let e=this.#x.stopWorking(this.#Qe());for(let e of this.#w){let t=this.#g.get(e);if(t===void 0)continue;this.#g.delete(e);let n=this.#h.indexOf(t),{id:r,...i}=t;this.#h[n]={...i,live:!1}}for(let{id:t,...n}of e)this.#en(n);this.#v.clear(),this.#tt();let t=this.#i.colors,n=this.#i.glyph,r=t.dim(`${n.cornerOpen}${n.dash.repeat(2)} Session restarted, clear context.`);this.#en({kind:`session-boundary`,body:r,live:!1}),this.#on()}#tt(){this.#x.reset(),this.#Zt(),this.#C=void 0,this.#w=new Set,this.#T.length=0,this.#ne=!1,this.#Q.reset(),this.#$t()}renderNotice(e){let t=stripTerminalControls(e);t.trim().length!==0&&(this.#Mt(),this.#en({kind:`notice`,body:t,live:!1}),this.#on())}restoreDraft(e){let t=this.#W?this.#te:void 0;if((t===void 0?this.#ee.text:this.#B).length>0)return;let n=lineOf(stripPromptControlCharacters(e));t===void 0?this.#ee=n:t(n),this.renderNotice(`The turn was cancelled from outside this prompt, so its message is back in the input.`)}renderSetupWarning(e){let t=stripTerminalControls(e);if(t.trim().length===0){this.#nt();return}this.#Mt(),this.#Ve=t,this.#on()}clearSetupWarning(){this.#nt()}#nt(){this.#Ve!==void 0&&(this.#Ve=void 0,this.#on())}renderCommandInvocation(e){let t=stripTerminalControls(e);t.trim().length!==0&&(this.#Mt(),this.#at(t),this.#on())}async choosePromptCommand(e){this.#Mt(),this.#W=!1;let t=typeaheadFor(e,`/`);return this.#Re=e=>{let n=renderCommandSuggestions(t,this.#i,e),r=Math.max(1,this.#wn()-7),i=Math.max(0,Math.min(t.selectedIndex-r+1,n.length-r));return renderTransientDrawer(n.slice(i,i+r),[`↑/↓ move · Enter select · Esc close`],this.#i,e)},this.#on(),await new Promise(e=>{this.#ze=()=>e(void 0),this.#be=n=>{if(n.type===`up`||n.type===`ctrl-p`)t=moveTypeaheadSelection(t,-1),this.#on();else if(n.type===`down`||n.type===`ctrl-n`)t=moveTypeaheadSelection(t,1),this.#on();else if(n.type===`enter`){let n=selectedTypeaheadCommand(t);this.#rt(),e(n===void 0?void 0:typeaheadCompletion(n))}else(n.type===`escape`||n.type===`ctrl-c`)&&(this.#rt(),e(void 0))},this.#Ft()})}async showInfoPanel(e){this.#Mt(),this.#W=!1;let t=stripAnsi(e),n=0,infoRows=e=>t.split(`
|
|
1
|
+
import{setConsoleRecordSubscriber}from"../console-records.js";import{buildAgentHeader}from"./agent-header.js";import{PROMPT_COMMANDS,isPromptControlCommand,parsePromptCommand,promptCommandSpec}from"./prompt-commands.js";import{argumentTypeaheadCompletion,argumentTypeaheadFor,argumentTypeaheadLoadingLabel,argumentTypeaheadQuery,moveArgumentTypeaheadSelection,renderArgumentSuggestions,selectedArgumentSuggestion}from"./argument-typeahead.js";import{detectMarkdownRendering}from"./markdown.js";import{renderAttentionRows,renderBlockLines}from"./blocks.js";import{copyTextToClipboard}from"./clipboard.js";import{dismissTypeahead,inlineCommandHint,isTypeaheadOpen,moveTypeaheadSelection,renderCommandSuggestions,selectedTypeaheadCommand,typeaheadCompletion,typeaheadFor}from"./command-typeahead.js";import{interruptedError}from"./errors.js";import{formatDevRebuildStatus,summarizeChangedFiles}from"./dev-rebuild-status.js";import{formatStoredDiagnostic,presentDiagnostic}from"./diagnostic-presentation.js";import{EMPTY_LINE,KillRing,PromptHistory,applyLineEditorKey,deleteForward,layoutPromptInput,lineOf,movePromptLine,visibleLine}from"./line-editor.js";import{enterBadge,flowMessageRows,renderAcknowledgeQuestion,renderSelectQuestion,renderTextQuestion}from"./setup-panel.js";import{renderFlowDrawer,renderTransientDrawer}from"./flow-drawer.js";import{isLogVisible,nextLogDisplayMode}from"./log-display-mode.js";import{MessageQueue,renderMessageQueueRows}from"./message-queue.js";import{initialPromptPlaceholder}from"./prompt-placeholder.js";import{initialProviderPickerState,transitionProviderPicker}from"./provider-picker.js";import{fitQuestionPanel,inputContextLabel,renderQuestionPanel,renderQuestionPrompt}from"./question-panel.js";import{formatAssistantResponseStats,formatTokenFlow,formatTurnDuration,isIncompleteOsc,isIncompletePaste,nextKey,sanitizePastedText,stripPasteStart,stripPromptControlCharacters}from"./stream-format.js";import{groupToolBlocksForDisplay}from"./tool-block-groups.js";import{renderTaskPanelRows}from"./task-activity.js";import{ConversationTranscript,TASK_END_GRACE_MS,turnActivity}from"./transcript.js";import{TraceViewerSession}from"./traces/trace-viewer-session.js";import{buildStatusLine}from"./status-line.js";import{createTheme,detectUnicode}from"./theme.js";import{TurnClock}from"./turn-clock.js";import{reduceSetupSelectInput,setupSelectionIntent}from"./setup-selection-input.js";import{BACKGROUND_COLOR_QUERY,parseBackgroundColorReply}from"./terminal-background.js";import{eveVersionTag}from"#cli/banner.js";import{format}from"node:util";import{clipVisible,renderInputText,renderInputWithBlockCursor,stripAnsi,stripTerminalControls,wrapVisibleLine}from"#cli/ui/terminal-text.js";import{initialSelectState,orderedSelection,reduceSelect,searchActionQuery,selectValueAtCursor}from"#setup/cli/select-state.js";import{toErrorMessage}from"#shared/errors.js";import{StringDecoder}from"node:string_decoder";import{parseDevRebuildLogLine}from"#internal/nitro/host/dev-watcher-log.js";import{LiveRegion}from"#cli/ui/live-region.js";import{AltScreen}from"#cli/ui/alt-screen.js";import{PROGRESS_PULSE_ASCII_GLYPH,PROGRESS_PULSE_GLYPH,isProgressPulseVisible}from"#cli/ui/progress-pulse.js";import{readGatewayServiceTier}from"#shared/gateway-service-tier.js";function isMultiSelectRequest(e){return e.kind===`multi`||e.kind===`searchable-multi`}function moveActionCursor(e,t,n){return n===0?void 0:e===void 0?t===`down`?0:n-1:(e+(t===`down`?1:-1)+n)%n}const incompletePasteFlushMs=1e3;var TerminalRenderer=class{#e;#t;#n;#r;#i;#a;#o;#s;#c;#l;#u;#d;#f;#p;#m;#h=[];#g=new Map;#_;#v=new Set;#y=[];#b=0;#x=new ConversationTranscript;#S;#C;#w=new Set;#T=[];#E;#D=`Send a message…`;#O;#k;#A;#j;#M=0;#N;#P=!1;#F;#I=[];#L;#R;#z;#B=``;#V=0;#H=new PromptHistory;#U=new KillRing;#W=!1;#G;#K;#q;#J=new Map;#Y=new Map;#X=!1;#Z=!1;#Q=new TurnClock;#$;#ee=EMPTY_LINE;#te;#ne=!1;#re;#ie;#ae=`eve`;#oe=!1;#se=!1;#ce=!1;#le=!1;#ue=!1;#de=!1;#fe;#pe=!0;#me=0;#he=Date.now();#ge;#_e;#ve;#ye=!1;#be;#xe=``;#Se=new StringDecoder(`utf8`);#Ce;#we;#Te=!1;#Ee=!1;#De;#Oe;#ke=``;#Ae=``;#je;#Me;#Ne;#Pe=!1;#Fe;#Ie=0;#Le;#Re;#ze;#Be;#Ve;#He=new MessageQueue;#Ue;#We;#Ge;#Ke;#qe;setupFlow={begin:e=>this.#st(e),setNavigation:e=>this.#ct(e),end:e=>this.#lt(e?.preserveDiagnostics??!0),readSelect:e=>this.#ut(e),readEditableSelect:e=>this.#ft(e),readProviderPicker:e=>this.#pt(e),readText:e=>this.#mt(e),readAcknowledge:e=>this.#ht(e),readChoice:e=>this.#dt(e),setStatus:e=>this.#Ct(e),renderLine:(e,t)=>this.#wt(e,t),replaceContent:e=>this.#Tt(e),renderOutput:e=>this.#Et(e),withInheritedStdio:e=>this.#Dt(e),withExclusiveTerminal:e=>this.#Dt(e),waitForInterrupt:e=>this.#bt(e)};traceViewer={open:e=>this.#kt(e)};constructor(e){this.#e=e?.input??process.stdin,this.#t=e?.output??process.stdout,this.#n=new LiveRegion(this.#t),this.#r=new AltScreen(this.#t),this.#i=createTheme({color:e?.color??!0,unicode:e?.unicode??detectUnicode()}),this.#a=e?.renderMarkdown??detectMarkdownRendering(),this.#o=e?.tools??`auto-collapsed`,this.#s=e?.reasoning??`auto-collapsed`,this.#c=e?.subagents??`collapsed`,this.#l=e?.connectionAuth??`full`,this.#u=e?.assistantResponseStats??`tokensPerSecond`,this.#De=e?.contextSize,this.#d=e?.captureForeignOutput??this.#t===process.stdout,this.#f=e?.diagnostics,this.#fe=e?.onExitRequest,this.#q=e?.argumentSuggestions,this.#m=e?.logs??`error`,this.#p=e?.availablePromptCommands??PROMPT_COMMANDS}#Je(e){this.#G=typeaheadFor(this.#p,e,this.#G);let t=argumentTypeaheadQuery(e);if(t===void 0||this.#q===void 0){this.#K=void 0;return}let n=this.#J.get(t.command);if(n===void 0){this.#J.set(t.command,{kind:`loading`,visible:!1});let e=t.command;this.#Y.set(e,setTimeout(()=>{this.#Y.delete(e),this.#J.get(e)?.kind===`loading`&&(this.#J.set(e,{kind:`loading`,visible:!0}),this.#on())},500)),this.#q(e).catch(()=>[]).then(t=>{let n=this.#Y.get(e);n!==void 0&&clearTimeout(n),this.#Y.delete(e),this.#J.set(e,{kind:`ready`,suggestions:t}),this.#W&&this.#Je(this.#B),this.#on()}),this.#K=void 0;return}if(n.kind===`loading`){this.#K=void 0;return}this.#K=argumentTypeaheadFor(t,n.suggestions,this.#K)}#Ye(e){let t=argumentTypeaheadQuery(this.#B),n=t===void 0?void 0:this.#J.get(t.command);return n?.kind===`loading`&&n.visible&&t!==void 0?[clip(this.#i.colors.dim(`Loading ${argumentTypeaheadLoadingLabel(t.command)}…`),e)]:this.#K===void 0?this.#G!==void 0&&isTypeaheadOpen(this.#G)?renderCommandSuggestions(this.#G,this.#i,e):[]:renderArgumentSuggestions(this.#K,this.#i,e)}setStartupPhase(e){this.#k=e,e===void 0?this.#qt():this.#Kt(),this.#on()}renderAgentHeader(e){this.#N=void 0,this.#ae=e.name,this.#E=e,this.#O=e.info?.subagents.local.map(e=>e.name),this.#D=initialPromptPlaceholder(e.info,e.localDevelopment===!0),this.#Mt();let t=this.#dn().join(`
|
|
2
|
+
`);if(this.#P){t!==this.#F&&(this.#F=t,this.#en({kind:`agent-header`,body:t,live:!1})),this.#on();return}this.#P=!0,this.#F=t,this.#n.flush(this.#dn(),this.#gn(this.#Cn()))}beginStartupDraft(e){this.#Mt({title:e.title}),this.#W=!0,this.#X=!0,this.#k=`starting`,this.#N={name:e.title},this.#M=Date.now();let t=lineOf(stripPromptControlCharacters(e.initialDraft??``));this.#A=t,this.#et(t),this.#Ut(),this.#Kt(),this.#on();let apply=e=>{t=e,this.#A=e,this.#Gt(),this.#et(t),this.#on()};this.#j=e=>{if(e.type===`escape`&&this.#We!==void 0){this.#We(`escape`);return}if(e.type===`ctrl-c`&&this.#We!==void 0){this.#Ot(),this.#We(`ctrl-c`);return}let n=this.#U.apply(t,e,{multiline:!0});if(n!==void 0){apply(n);return}if(e.type===`enter`&&t.text.trim().length>0){this.#He.enqueue(t.text)&&apply(EMPTY_LINE);return}e.type===`ctrl-c`&&this.#fe?.()},this.#Xe()}#Xe(){this.#A!==void 0&&this.#j!==void 0&&(this.#Ht(),this.#et(this.#A),this.#W=!0,this.#be=this.#j,this.#Ft())}finishStartupDraft(){let e={draft:this.#A?.text??this.#B,queuedPrompt:this.#He.takePrompt()};return this.#A=void 0,this.#j=void 0,this.#It(),this.#Wt(),this.#W=!1,this.#X=!1,e}async readInput(e){this.#Mt(e),this.#C?.working!==!0&&this.#tn(),this.#W=!0,this.#X=!0,this.#ue=this.#de,this.#de=!1;let t=e?.initialDraft===void 0?this.#ee:lineOf(stripPromptControlCharacters(e.initialDraft));return this.#H.begin(t.text),this.#et(t),this.#Je(t.text),this.#Ut(),this.#on(),await new Promise((n,r)=>{let i=e?.signal,release=()=>{this.#te=void 0,i?.removeEventListener(`abort`,onAbort),this.#G=void 0,this.#K=void 0,this.#W=!1,this.#Wt(),this.#It(),this.#on()},finish=e=>{release(),n(e)},onAbort=()=>finish(void 0);if(i?.addEventListener(`abort`,onAbort,{once:!0}),i?.aborted){onAbort();return}this.#re=e=>{i?.removeEventListener(`abort`,onAbort),r(e)};let apply=e=>{t=e,this.#ee=e,this.#Gt(),this.#et(t),this.#Je(e.text),this.#on()};this.#te=apply;let recall=e=>{e!==void 0&&apply(lineOf(e))},interrupt=()=>{this.#G=void 0,this.#Wt(),this.#Pt(),r(interruptedError())},cancel=()=>{this.#ne=!0,finish({type:`cancel`})},suggestions=()=>this.#G!==void 0&&isTypeaheadOpen(this.#G)?this.#G:void 0,argumentSuggestions=()=>this.#K?.suggestions.length?this.#K:void 0,highlighted=()=>{let e=suggestions();return e===void 0?void 0:selectedTypeaheadCommand(e)};this.#be=e=>{e.type!==`ctrl-c`&&this.#ue&&(this.#ue=!1,this.#on());let n=this.#U.apply(t,e,{multiline:!0});if(n!==void 0){apply(n);return}let r=this.#C?.working===!0;switch(e.type){case`up`:case`ctrl-p`:{let e=argumentSuggestions();if(e!==void 0){this.#K=moveArgumentTypeaheadSelection(e,-1),this.#on();break}let n=suggestions();if(n!==void 0){this.#G=moveTypeaheadSelection(n,-1),this.#on();break}let r=movePromptLine(t,`up`);r===void 0?recall(this.#H.previous(t.text)):apply(r);break}case`down`:case`ctrl-n`:{let e=argumentSuggestions();if(e!==void 0){this.#K=moveArgumentTypeaheadSelection(e,1),this.#on();break}let n=suggestions();if(n!==void 0){this.#G=moveTypeaheadSelection(n,1),this.#on();break}let r=movePromptLine(t,`down`);r===void 0?recall(this.#H.next()):apply(r);break}case`tab`:{let e=argumentSuggestions(),t=e===void 0?void 0:selectedArgumentSuggestion(e);if(e!==void 0&&t!==void 0){apply(lineOf(argumentTypeaheadCompletion(e,t)));break}let n=highlighted();n!==void 0&&apply(lineOf(typeaheadCompletion(n)));break}case`escape`:{if(this.#K!==void 0){this.#K=void 0,this.#on();break}let e=suggestions();if(e!==void 0){this.#G=dismissTypeahead(e),this.#on();break}r&&!this.#ne&&cancel();break}case`enter`:{let e=argumentSuggestions(),n=e===void 0?void 0:selectedArgumentSuggestion(e),i=highlighted();if(e!==void 0&&n?.next!==void 0&&e.completed.length===0){apply(lineOf(`${argumentTypeaheadCompletion(e,n)} `));break}if(e===void 0&&i!==void 0&&this.#q!==void 0&&(i.name===`add`||i.name===`login`||i.name===`loglevel`||i.name===`model`)){apply(lineOf(typeaheadCompletion(i)));break}let a=e!==void 0&&n!==void 0?argumentTypeaheadCompletion(e,n):i!==void 0&&parsePromptCommand(t.text)===null?typeaheadCompletion(i).trimEnd():t.text;if(a.trim().length===0)break;promptCommandSpec(a)?.spec.history!==`omit`&&this.#H.add(a),this.#ee=EMPTY_LINE,this.#et(EMPTY_LINE),isPromptControlCommand(a)?(this.#at(stripTerminalControls(a.trim())),r&&parsePromptCommand(a)?.type===`cancel`&&(this.#ne=!0)):(this.#Z=!0,this.#f?.recordPrompt(),r&&this.#T.push(a)),finish({type:`submit`,text:a});break}case`ctrl-d`:t.text.length===0?(this.#Ot(),interrupt()):apply(deleteForward(t));break;case`ctrl-l`:this.#ln();break;case`ctrl-r`:this.#on();break;case`ctrl-c`:if(r){if(!this.#ne){cancel();break}this.#ne=!1,this.#de=!0,finish({type:`interrupt`});break}if(this.#ue){this.#Ot(),interrupt();break}this.#ue=!0,apply(EMPTY_LINE)}},this.#Ft()})}renderConversation(e){let t=this.#C?.working===!0;this.#C=e,e.conversation.messages.some(e=>e.role===`user`)&&(this.#Z=!0);let n=this.#x.project(e,this.#Qe());this.#Xt();let r=new Set;for(let[e,t]of n.entries()){let i=t.id;if(this.#v.has(i))continue;r.add(i);let a=this.#g.get(i);if(a!==t){if(t.updateSeq=++this.#b,a!==void 0){this.#h[this.#h.indexOf(a)]=t,this.#g.set(i,t);continue}if(t.kind===`user`){let e=this.#T.indexOf(t.body??``);e!==-1&&(this.#T.splice(e,1),t.promptOrigin=`steer`)}this.#Ze(t,n.slice(e+1))}}for(let e of this.#w)r.has(e)||this.#an(e);this.#w=r,e.working&&!t?this.#Q.armed||this.#Q.arm(e.data.usage):!e.working&&t&&(this.#ne=!1,this.#W&&this.#tn()),this.#$t(),this.#on()}#Ze(e,t){let n=t.find(e=>this.#g.has(e.id)),r=n===void 0?-1:this.#h.indexOf(this.#g.get(n.id));if(r===-1){this.#en(e);return}e.id!==this.#Me?.id&&this.#Ln(),this.#h.splice(r,0,e),this.#g.set(e.id,e)}#Qe(){return{tools:this.#o,reasoning:this.#s,subagents:this.#c,connectionAuth:this.#l,subagentNames:this.#O,diagnosticsPath:this.#f?.displayPath,dot:this.#i.glyph.dot}}#$e(e){if(e?.taskId===void 0||e.requester!==void 0||this.#C===void 0)return inputContextLabel(e,this.#i);let t=this.#x.taskLabel(this.#C.conversation,e.taskId);return inputContextLabel(t===void 0?e:{...e,requester:t},this.#i)}#et(e){this.#B=e.text,this.#V=e.cursor}async readToolApproval(e,t){this.#Mt(t),this.#W=!1;let n=0;return this.#Le=t=>renderTransientDrawer(renderQuestionPanel({prompt:e.prompt,options:[{id:`yes`,label:`Yes`},{id:`no`,label:`No`}],cursor:n,allowFreeform:!1,editor:EMPTY_LINE,caretVisible:!1,maxRows:this.#wn()-5},this.#i,t),[`y yes · n no · Ctrl-C cancel`],this.#i,t,this.#$e(e.context),!1,`left`),this.#on(),await new Promise((e,t)=>{let approve=()=>{this.#Le=void 0,this.#It(),this.#on(),e({approved:!0})},deny=()=>{this.#Le=void 0,this.#It(),this.#on(),e({approved:!1,reason:`Denied by user.`})};this.#re=t,this.#be=e=>{switch(e.type){case`text`:{if(e.framing!==`unframed`)break;let t=e.value.toLowerCase();t===`y`?approve():t===`n`&&deny();break}case`up`:case`ctrl-p`:n=0,this.#on();break;case`down`:case`ctrl-n`:n=1,this.#on();break;case`enter`:n===0?approve():deny();break;case`ctrl-r`:this.#on();break;case`ctrl-c`:this.#Le=void 0,this.#Pt(),t(interruptedError())}},this.#Ft()})}async readInputQuestion(e,t){this.#Mt(t),this.#W=!1,this.#X=!1;let n=e.options??[],r=n.length>0,i=(e.allowFreeform===!0||!r)&&r,a=n.length+ +!!i,o=questionSectionId(e.requestId),s=r?`select`:`text`,c=0,l=EMPTY_LINE,isOnFreeformRow=()=>i&&c===n.length,selectDrawer=t=>renderTransientDrawer([...renderQuestionPanel({prompt:stripTerminalControls(e.prompt),options:n,cursor:c,allowFreeform:i,editor:l,caretVisible:this.#pe,maxRows:this.#wn()-5},this.#i,t)],[`↑/↓ move · enter to select · esc to dismiss`],this.#i,t,this.#$e(e.context),!1,`left`),textPanel=t=>{let n=promptInputRows({text:l.text,cursor:l.cursor,width:Math.max(1,t-2),theme:this.#i,caretVisible:this.#pe,ghost:``,maxRows:3});return n.at(-1)===``&&n.pop(),renderTransientDrawer(fitQuestionPanel([...renderQuestionPrompt(e.prompt,this.#i,t),``,...n.map(e=>` ${e}`)],this.#wn()-5),[`Enter submit · Esc dismiss`],this.#i,t,this.#$e(e.context),!1,`left`)},syncFreeformCaret=()=>{isOnFreeformRow()?this.#Ut():(this.#Wt(),this.#Gt())};s===`select`?(s=`select`,this.#W=!1,this.#an(o),this.#Le=selectDrawer,syncFreeformCaret(),this.#on()):(s=`text`,this.#Le=textPanel,this.#W=!0,this.#et(l),this.#Ut(),this.#on());let finalize=t=>{this.#Le=void 0,this.#in({id:o,kind:`question`,title:stripTerminalControls(e.prompt),body:`${this.#i.colors.dim(this.#i.glyph.elbow)} ${stripTerminalControls(t.label)}`,preformatted:!0,live:!1}),this.#W=!1,this.#Wt(),this.#It(),this.#on();let n={};return t.optionId!==void 0&&(n.optionId=t.optionId),t.text!==void 0&&(n.text=t.text),n},dismiss=()=>{this.#Le=void 0,this.#in({id:o,kind:`question`,title:stripTerminalControls(e.prompt),body:`${this.#i.colors.dim(this.#i.glyph.elbow)} ${this.#i.colors.dim(`Skipped. The question stays open.`)}`,preformatted:!0,live:!1}),this.#W=!1,this.#Wt(),this.#It(),this.#on(),u(void 0)},moveCursor=e=>{a!==0&&(c=(c+e+a)%a,syncFreeformCaret(),this.#on())},selectOptionAt=e=>{let t=n[e];t&&u(finalize({optionId:t.id,label:t.label}))},u;return await new Promise((t,n)=>{this.#re=n,u=t,this.#be=t=>{if(t.type===`ctrl-c`){if((s===`text`||isOnFreeformRow())&&l.text.length>0){l=EMPTY_LINE,this.#Gt(),s===`text`&&this.#et(l),this.#on();return}this.#Le=void 0,this.#Wt(),this.#Pt(),n(interruptedError());return}if(t.type===`ctrl-r`){this.#on();return}if(s===`select`){let n=setupSelectionIntent(t,{textNavigation:!isOnFreeformRow()});if(n?.kind===`move`){moveCursor(n.direction===`up`?-1:1);return}switch(t.type){case`up`:case`ctrl-p`:moveCursor(-1);break;case`down`:case`ctrl-n`:moveCursor(1);break;case`enter`:if(isOnFreeformRow()){let t=resolveQuestionText(l.text,e);t!==void 0&&u(finalize(t));break}selectOptionAt(c);break;case`escape`:if(isOnFreeformRow()&&l.text.length>0){l=EMPTY_LINE,this.#Gt(),this.#on();break}dismiss();break;default:if(isOnFreeformRow()){let e=this.#U.apply(l,t);e!==void 0&&(l=e,this.#Gt(),this.#on())}}return}let r=this.#U.apply(l,t,{multiline:!0});if(r!==void 0){l=r,this.#Gt(),this.#et(l),this.#on();return}switch(t.type){case`up`:case`down`:{let e=movePromptLine(l,t.type);e!==void 0&&(l=e,this.#Gt(),this.#et(l),this.#on());break}case`enter`:{let t=resolveQuestionText(l.text,e);if(t===void 0)break;u(finalize(t));break}case`escape`:if(l.text.length>0){l=EMPTY_LINE,this.#Gt(),this.#et(l),this.#on();break}dismiss()}},this.#Ft()})}setVercelStatus(e){this.#R=e,this.#on()}setRemoteConnectionStatus(e){this.#z=e,this.#on()}reset(){this.#h=[],this.#g.clear(),this.#v.clear(),this.#L=void 0,this.#I.length=0,this.#y.length=0,this.#P=!1,this.#F=void 0,this.#tt(),this.#Z=!1,this.#Me=void 0,this.#oe&&(this.#n.clearAll(),this.#on())}renderSessionBoundary(){this.#tn();let e=this.#x.stopWorking(this.#Qe());for(let e of this.#w){let t=this.#g.get(e);if(t===void 0)continue;this.#g.delete(e);let n=this.#h.indexOf(t),{id:r,...i}=t;this.#h[n]={...i,live:!1}}for(let{id:t,...n}of e)this.#en(n);this.#v.clear(),this.#tt();let t=this.#i.colors,n=this.#i.glyph,r=t.dim(`${n.cornerOpen}${n.dash.repeat(2)} Session restarted, clear context.`);this.#en({kind:`session-boundary`,body:r,live:!1}),this.#on()}#tt(){this.#x.reset(),this.#Zt(),this.#C=void 0,this.#w=new Set,this.#T.length=0,this.#ne=!1,this.#Q.reset(),this.#$t()}renderNotice(e){let t=stripTerminalControls(e);t.trim().length!==0&&(this.#Mt(),this.#en({kind:`notice`,body:t,live:!1}),this.#on())}restoreDraft(e){let t=this.#W?this.#te:void 0;if((t===void 0?this.#ee.text:this.#B).length>0)return;let n=lineOf(stripPromptControlCharacters(e));t===void 0?this.#ee=n:t(n),this.renderNotice(`The turn was cancelled from outside this prompt, so its message is back in the input.`)}renderSetupWarning(e){let t=stripTerminalControls(e);if(t.trim().length===0){this.#nt();return}this.#Mt(),this.#Ve=t,this.#on()}clearSetupWarning(){this.#nt()}#nt(){this.#Ve!==void 0&&(this.#Ve=void 0,this.#on())}renderCommandInvocation(e){let t=stripTerminalControls(e);t.trim().length!==0&&(this.#Mt(),this.#at(t),this.#on())}async choosePromptCommand(e){this.#Mt(),this.#W=!1;let t=typeaheadFor(e,`/`);return this.#Re=e=>{let n=renderCommandSuggestions(t,this.#i,e),r=Math.max(1,this.#wn()-7),i=Math.max(0,Math.min(t.selectedIndex-r+1,n.length-r));return renderTransientDrawer(n.slice(i,i+r),[`↑/↓ move · Enter select · Esc close`],this.#i,e)},this.#on(),await new Promise(e=>{this.#ze=()=>e(void 0),this.#be=n=>{if(n.type===`up`||n.type===`ctrl-p`)t=moveTypeaheadSelection(t,-1),this.#on();else if(n.type===`down`||n.type===`ctrl-n`)t=moveTypeaheadSelection(t,1),this.#on();else if(n.type===`enter`){let n=selectedTypeaheadCommand(t);this.#rt(),e(n===void 0?void 0:typeaheadCompletion(n))}else(n.type===`escape`||n.type===`ctrl-c`)&&(this.#rt(),e(void 0))},this.#Ft()})}async showInfoPanel(e){this.#Mt(),this.#W=!1;let t=stripAnsi(e),n=0,infoRows=e=>t.split(`
|
|
3
3
|
`).flatMap(t=>wrapVisibleLine(t,Math.max(1,e-4)).map(e=>` ${e}`));this.#Re=e=>{let t=infoRows(e),r=Math.max(1,this.#wn()-7);return n=Math.min(n,Math.max(0,t.length-r)),renderTransientDrawer(t.slice(n,n+r),[t.length>r?`↑/↓ scroll · Esc close`:`Esc to close`],this.#i,e)},this.#on(),await new Promise(e=>{this.#ze=e,this.#be=t=>{if(t.type===`up`||t.type===`ctrl-p`)n=Math.max(0,n-1),this.#on();else if(t.type===`down`||t.type===`ctrl-n`){let e=Math.max(1,this.#wn()-7);n=Math.min(n+1,Math.max(0,infoRows(this.#Cn()).length-e)),this.#on()}else(t.type===`escape`||t.type===`ctrl-c`||t.type===`enter`)&&(this.#rt(),e())},this.#Ft()})}#rt(){this.#Re=void 0,this.finishCommand({kind:`dismiss`}),this.#be=void 0,this.#ze=void 0,this.#It(),this.#on()}finishCommand(e){if(e.kind===`dismiss`){this.#it()&&this.#on();return}let t=this.#ot(e.summary);t!==void 0&&(t.status=`done`);let n=e.message===void 0?``:stripAnsi(e.message);if(n.trim().length===0){t!==void 0&&this.#on();return}this.#Mt();let r={kind:`result`,body:n,live:!1};this.#en(r);let i=t===void 0?-1:this.#h.indexOf(t);i!==-1&&(this.#h.pop(),this.#h.splice(i+1,0,r)),this.#on()}#it(){let e=this.#_;return e!==void 0&&(this.#_=void 0,this.#h=this.#h.filter(t=>t!==e),!0)}#at(e){this.#_!==void 0&&this.#ot();let t={kind:`command`,body:e,live:!0};this.#_=t,this.#en(t)}#ot(e){let t=this.#_;if(t!==void 0)return this.#_=void 0,t.live=!1,e!==void 0&&(t.result=stripTerminalControls(e)),t}#st(e){this.#Mt(),this.#A===void 0&&(this.#W=!1),this.#Be={title:stripTerminalControls(e),startedAtMs:Date.now(),lines:[],outputBuffer:[]},this.#Kt(),this.#on()}#ct(e){this.#Be!==void 0&&(this.#Be.navigation=e,this.#on())}#lt(e){this.#We=void 0,this.#St();let t=this.#Be;if(t!==void 0){if(this.#Be=void 0,this.#A===void 0?this.#qt():this.#Xe(),e){let e=[];for(let n of t.lines){if(n.evidence===!0){e.push(n.text);continue}(n.tone===`warning`||n.tone===`error`)&&(e.length>0&&this.#en({kind:`flow`,title:`info`,body:e.join(`
|
|
4
|
-
`),live:!1}),this.#en({kind:`flow`,title:n.tone,body:n.text,live:!1})),e=[]}}this.#on()}}async#ut(e){let t=this.#gt(e.message),n=isMultiSelectRequest(e),r=e.kind===`search`?e.searchAction:void 0,i=e.kind===`search`&&e.layout===void 0,a=e.options,o=e.navigation?.kind===`planner`,s={options:a,searchAction:r,submitRow:n&&!o};`initialValue`in e&&e.initialValue!==void 0&&(s.defaultValue=e.initialValue),`initialValues`in e&&e.initialValues!==void 0&&(s.initialValues=e.initialValues);let c=initialSelectState(s),l,u=!1,d=0,isCurrentSearch=e=>e===d,clearSearch=()=>{d+=1,u=!1,c=reduceSelect(c,{type:`clear`},{options:a,searchAction:r,submitRow:n&&!o}),this.#on()},loadSearch=async(e,t)=>{u=!0,l=void 0;let i=++d;this.#on();try{let s=await t(e);if(!isCurrentSearch(i))return;let l=c.filter;a=s,c={...initialSelectState({options:s,searchAction:r,submitRow:n&&!o}),filter:l}}catch(e){isCurrentSearch(i)&&(l=toErrorMessage(e))}finally{isCurrentSearch(i)&&(u=!1,this.#on())}},f=e.notices;if(e.kind===`task-list`||e.kind===`search`&&e.layout===`task-list`){let n=t.taskListLineStart??t.lines.length,r=t.lines.slice(n).filter(e=>e.tone===`success`||e.tone===`warning`||e.tone===`error`).map(e=>({tone:e.tone,text:e.text}));f=e.notices??r,t.taskListLineStart=t.lines.length,t.hideLinesWhileQuestion=!0}let panelState=()=>{let t={...e,message:``,options:a,select:c};return f!==void 0&&f.length>0&&(t.notices=f),l!==void 0&&(t.error=l),u&&(t.loadingFrame=this.#pn()),i&&(t.caretVisible=this.#pe),t};return t.question=e=>renderSelectQuestion(panelState(),this.#i,e),i&&this.#Ut(),this.#on(),await this.#yt((t,s)=>{let close=e=>{d+=1,s(e)};if(u){t.type===`ctrl-c`?close(void 0):t.type===`escape`?clearSearch():t.type===`ctrl-r`&&this.#on();return}let f=e.navigation?.kind===`planner`?e.navigation:void 0,p=t.type===`left`&&(f?.activeStep??0)>(f?.firstNavigableStep??0)?`back`:t.type===`right`&&f!==void 0&&f.activeStep>=(f.firstNavigableStep??0)&&f.activeStep<f.steps.length-1?`forward`:void 0;if(p!==void 0){close({kind:`navigate`,direction:p,values:n?orderedSelection(a,c.selected):[]});return}let m={key:t,options:a,searchAction:r,select:c},h=reduceSetupSelectInput(n?{...m,kind:e.kind,required:e.required,plannerNavigation:o||void 0}:{...m,kind:e.kind});switch(h.kind){case`cancel`:close(void 0);return;case`repaint`:this.#on();return;case`update`:c=h.select,l=void 0,i&&this.#Gt(),this.#on();return;case`submit`:{let e=searchActionQuery(h.values[0]??``),t=r?.load;if(e===void 0||t===void 0){close(h.values);return}loadSearch(e,t);return}case`error`:l=h.message,this.#on();return;case`ignore`:return}},i?()=>this.#Wt():void 0).promise}#dt(e){this.#Mt();let t=this.#_t();t.status={text:stripTerminalControls(e.status),startedAtMs:Date.now()};let n;t.question=t=>renderSelectQuestion({kind:`actions`,context:e.context,actions:e.actions,cursor:n},this.#i,t),this.#on();let r=this.#yt((t,r)=>{let i=setupSelectionIntent(t,{textNavigation:!0});switch(i?.kind){case`cancel`:r(void 0);return;case`move`:n=moveActionCursor(n,i.direction,e.actions.length),this.#on();return;case`repaint`:this.#on();return;case`submit`:n!==void 0&&r(e.actions[n].value);return;case void 0:return}},()=>{t.status=void 0});return{choice:r.promise,close:()=>r.settle(void 0)}}async#ft(e){let t=this.#gt(e.message),n={options:e.options};e.initialValue!==void 0&&(n.defaultValue=e.initialValue);let r=initialSelectState(n),i=lineOf(``),a;t.question=t=>{let n={kind:`inline-edit`,layout:`task-list`,message:``,options:e.options,select:r,edit:{optionValue:e.editable.value,caretVisible:this.#pe,editor:{kind:`rename`,editor:i,defaultValue:e.editable.defaultValue,formatHint:e.editable.formatHint}}};return a!==void 0&&(n.error=a),renderSelectQuestion(n,this.#i,t)};let onEditableRow=()=>selectValueAtCursor([...e.options],r.cursor)===e.editable.value,syncEditableRow=()=>{onEditableRow()?this.#Ut():(i=lineOf(``),this.#Wt())};return syncEditableRow(),this.#on(),await this.#yt((t,n)=>{let applyEditor=e=>{i=e,a=void 0,this.#Gt(),this.#on()},applySelect=t=>{r=reduceSelect(r,t,{options:e.options}),a=void 0,syncEditableRow(),this.#on()},submit=()=>{let t=selectValueAtCursor([...e.options],r.cursor);if(t===void 0)return;if(t!==e.editable.value){n({kind:`selected`,value:t});return}let o=(i.text||e.editable.defaultValue).trim(),s=e.editable.validate?.(o);if(s!==void 0){a=s,this.#on();return}n(o===e.editable.defaultValue?{kind:`selected`,value:t}:{kind:`edited`,value:t,text:o})},o=setupSelectionIntent(t,{textNavigation:!onEditableRow()});switch(o?.kind){case`cancel`:n(void 0);return;case`move`:applySelect({type:o.direction});return;case`submit`:submit();return;case`repaint`:this.#on();return;case void 0:}if(!onEditableRow())return;let s=this.#U.apply(i,t);s!==void 0&&applyEditor(s)},()=>this.#Wt()).promise}async#pt(e){this.#U.clear();let t=this.#gt(e.message),n=initialProviderPickerState(e.options,e.initialValue),r,cursorBadge=()=>{if(n.phase.kind!==`inactive`)return;let t=selectValueAtCursor([...e.options],n.select.cursor),r=e.options.find(e=>e.value===t);if(r!==void 0)return enterBadge(this.#i,r.checked===!0?`change`:void 0)};t.question=t=>{let r=cursorBadge(),i={kind:`inline-edit`,layout:`stacked`,message:``,options:e.options,select:n.select,edit:{optionValue:`ai-gateway-key`,caretVisible:this.#pe,editor:{kind:`key`,phase:n.phase}}};return r!==void 0&&(i.cursorBadge=r),renderSelectQuestion(i,this.#i,t)};let syncCaret=()=>{n.phase.kind===`editing`||n.phase.kind===`invalid`?this.#Ut():this.#Wt()};return syncCaret(),this.#on(),await this.#yt((t,i,a)=>{let dispatch=t=>{let o=transitionProviderPicker(n,t,e.options);switch(o.kind){case`ignore`:return;case`clear`:r?.abort(),r=void 0,n=o.state,syncCaret(),this.#on();return;case`cancel`:i(void 0);return;case`render`:n=o.state,syncCaret(),this.#on();return;case`validate`:{n=o.state,syncCaret(),this.#on();let t=new AbortController;r=t;let i;try{i=e.validateInlineKey(o.key,t.signal)}catch(e){a(e);return}i.then(e=>{r!==t||t.signal.aborted||(r=void 0,dispatch({type:`validated`,validation:e}))},e=>{r!==t||t.signal.aborted||(r=void 0,a(e))});return}case`settle`:i(o.result);return}},o=setupSelectionIntent(t,{textNavigation:n.phase.kind===`inactive`});switch(o?.kind){case`cancel`:dispatch({type:`cancel`});return;case`move`:dispatch({type:`move`,direction:o.direction});return;case`submit`:dispatch({type:`submit`});return;case`repaint`:this.#on();return;case void 0:}if(n.phase.kind!==`editing`&&n.phase.kind!==`invalid`)return;let s=applyLineEditorKey(n.phase.editor,t);s!==void 0&&(this.#Gt(),dispatch({type:`edit`,editor:s}))},()=>{r?.abort(),r=void 0,this.#Wt()}).promise}async#mt(e){e.mask===!0&&this.#U.clear();let t=this.#gt(e.message),n=lineOf(``),r;return t.question=t=>{let i={message:``,editor:n,mask:e.mask===!0};return e.placeholder===void 0?e.defaultValue!==void 0&&(i.placeholder=e.defaultValue):i.placeholder=e.placeholder,e.notices!==void 0&&(i.notices=e.notices),r!==void 0&&(i.error=r),renderTextQuestion(i,this.#i,t,this.#pe)},this.#Ut(),this.#on(),await this.#yt((t,i)=>{let apply=e=>{n=e,r=void 0,this.#Gt(),this.#on()},a=e.mask?applyLineEditorKey(n,t):this.#U.apply(n,t);if(a!==void 0){apply(a);return}switch(t.type){case`ctrl-c`:case`escape`:i(void 0);return;case`ctrl-r`:this.#on();return;case`enter`:{let t=n.text.length>0?n.text:e.defaultValue??``,a=e.validate?.(t);if(a!==void 0){r=a,this.#on();return}i(t);return}default:return}},()=>this.#Wt()).promise}async#ht(e){let t=this.#gt(e.message);return t.question=t=>renderAcknowledgeQuestion({message:``,lines:e.lines},this.#i,t),this.#on(),await this.#yt((e,t)=>{switch(e.type){case`enter`:case`escape`:case`ctrl-c`:t();return;case`ctrl-r`:this.#on();return;default:return}}).promise}#gt(e){this.#Mt(),this.#W=!1;let t=this.#_t();return t.questionTitle=stripTerminalControls(e),t.status!==void 0&&(t.status=void 0,t.summary=void 0,t.preview=void 0),t}#_t(){return this.#Be===void 0&&(this.#Be={title:``,startedAtMs:Date.now(),lines:[],outputBuffer:[],implicit:!0}),this.#Be}#vt(){this.#Be?.implicit===!0?this.#Be=void 0:this.#Be!==void 0&&(this.#Be.question=void 0,this.#Be.questionTitle=void 0,this.#Be.hideLinesWhileQuestion=!1),this.#be=void 0,this.#It(),this.#A===void 0?this.#Be!==void 0&&this.#xt():this.#Xe(),this.#Be===void 0&&this.#on()}#yt(e,t){let n=!1,r,i,a=new Promise((e,t)=>{r=e,i=t}),settle=e=>{n||(n=!0,t?.(),this.#vt(),r(e))},reject=e=>{n||(n=!0,t?.(),this.#vt(),i(e))};return this.#Ht(),this.#be=t=>{t.type===`ctrl-c`&&this.#Ot(),e(t,settle,reject)},this.#Ft(),{promise:a,settle}}#bt(e){let t,n=new Promise(e=>{t=e});return this.#We=t,this.#xt(e?.interruptible??!0),{promise:n,dispose:()=>{this.#We===t&&(this.#We=void 0,this.#St())}}}#xt(e=!0){if(this.#A!==void 0){this.#Xe();return}if(this.#We===void 0)return;let consumer=t=>{if(e&&(t.type===`ctrl-c`||t.type===`escape`)){t.type===`ctrl-c`&&this.#Ot();let e=this.#We;this.#We=void 0,this.#St(),e?.(t.type===`ctrl-c`?`ctrl-c`:`escape`);return}t.type===`ctrl-r`&&this.#on()};this.#Ge=consumer,this.#Ht(),this.#be=consumer,this.#Ft()}#St(){this.#Ge!==void 0&&(this.#be===this.#Ge&&this.#It(),this.#Ge=void 0)}#Ct(e){let t=e===void 0?void 0:{text:stripTerminalControls(e),startedAtMs:Date.now()};if(this.#Be!==void 0){this.#Be.status=t,t===void 0&&(this.#Be.preview=void 0),this.#on();return}if(!(this.#W||this.#C?.working===!0)){if(t===void 0){this.#ie=void 0,this.#qt(),this.#on();return}this.#Mt(),this.#he=Date.now(),this.#Kt(),this.#ie=t.text,this.#on()}}#wt(e,t){let n=stripTerminalControls(e);if(n.trim().length===0)return;let r=this.#Be;if(r!==void 0){if(r.preview=void 0,t===`warning`||t===`error`)for(let e of r.outputBuffer)r.lines.push({text:e,tone:`info`,evidence:!0});r.outputBuffer=[],r.lines.push({text:n,tone:t}),this.#on();return}this.#Mt(),this.#en({kind:`flow`,title:t,body:n,live:!1}),this.#on()}#Tt(e){let t=this.#Be;t!==void 0&&(t.lines=[],t.outputBuffer=[],t.preview=void 0,t.status=void 0,t.summary=e===void 0?void 0:{headline:stripTerminalControls(e.headline),facts:e.facts.map(e=>({label:stripTerminalControls(e.label),value:stripTerminalControls(e.value)}))},this.#on())}#Et(e){let t=stripTerminalControls(e);if(t.trim().length===0)return;let n=this.#Be;if(n===void 0){this.#wt(t,`info`);return}n.preview=t,n.outputBuffer.push(t),n.outputBuffer.length>40&&n.outputBuffer.shift(),this.#on()}async#Dt(e){this.#xe=``,this.#Ht(),this.#We=void 0,this.#St(),this.#It(),this.#Jt(),this.#n.clear(),this.#En(),this.#r.enter({cursor:`visible`,mouse:!1}),this.#e.isTTY&&this.#e.setRawMode?.(!1),this.#e.pause();try{return await e()}finally{this.#r.exit(),this.#e.isTTY&&this.#e.setRawMode?.(!0),this.#e.resume(),this.#xe=``,this.#Ht(),this.#n.hideCursor(),this.#Tn(),this.#Be===void 0?this.#$t():(this.#Kt(),this.#xt()),this.#n.reset(),this.#on()}}setSessionId(e){this.#Ue=e}shutdown(){this.#Pt();for(let e of this.#Y.values())clearTimeout(e);if(this.#Y.clear(),this.#se&&!this.#ce){this.#ce=!0;let e=this.#Ue===void 0?``:` ${this.#i.glyph.dot} session ${this.#Ue}`;this.#t.write(`${this.#i.colors.dim(`${eveVersionTag()}${e}`)}\n`)}}requestInterrupt(){this.#Be!==void 0&&this.#be?.({type:`ctrl-c`}),this.#Pt()}exitRequested(){return this.#le}#Ot(){this.#le=!0,this.#fe?.()}async#kt(e){if(this.#Ke!==void 0||!this.#oe)return;let t=new TraceViewerSession({...e,theme:this.#i,dimensions:()=>({width:this.#Cn(),height:this.#wn()}),paint:e=>this.#r.paint(e,this.#wn()),tracingDisabled:process.env.EVE_TRACES===`off`,copyText:e=>copyTextToClipboard(e,e=>this.#r.writeRaw(e)),terminalBackground:this.#qe});this.#Ke=t,this.#r.enter(),this.#i.color&&this.#r.writeRaw(BACKGROUND_COLOR_QUERY),await new Promise(e=>{this.#jt=e,this.#be=e=>{t.handleKey(e)===`close`&&this.#At()},this.#Ft(),t.start()})}#At(){let e=this.#Ke;if(e===void 0)return;this.#Ke=void 0,e.dispose(),this.#It(),this.#r.exit(),this.#n.hideCursor(),this.#on(),this.#n.showCursor();let t=this.#jt;this.#jt=void 0,t?.()}#jt;#Mt(e){this.#ae=e?.title??this.#ae,!this.#oe&&(this.#oe=!0,this.#se=!0,this.#n.reset(),this.#n.hideCursor(),this.#Tn(),this.#e.isTTY&&(this.#e.setRawMode?.(!0),this.#e.resume(),this.#n.emitBracketedPaste(!0)),this.#we=()=>this.#on(),this.#t.on(`resize`,this.#we),process.on(`exit`,this.#Nt))}#Nt=()=>{this.#oe&&(this.#r.exit(),this.#e.isTTY&&(this.#n.emitBracketedPaste(!1),this.#e.setRawMode?.(!1)),this.#n.showCursor())};#Pt(){this.#Le=void 0;let e=this.#ze;e!==void 0&&(this.#ze=void 0,this.#Re=void 0,this.finishCommand({kind:`dismiss`}),this.#be=void 0,e()),this.#At();let t=this.#re;if(this.#re=void 0,t?.(interruptedError()),this.#It(),this.#Wt(),this.#Jt(),this.#ve!==void 0&&(clearTimeout(this.#ve),this.#ve=void 0),this.#ye=!1,this.#Fn(),this.#oe){this.#Ln(),this.#ot();for(let e of this.#h)e.kind===`log`&&e.id===void 0&&(e.live=!1);this.#on(),this.#n.clear(),this.#n.showCursor(),this.#En(),this.#n.newline(),this.#e.isTTY&&(this.#n.emitBracketedPaste(!1),this.#e.setRawMode?.(!1),this.#e.pause()),this.#we&&=(this.#t.off(`resize`,this.#we),void 0),process.off(`exit`,this.#Nt),this.#oe=!1}}#Ft(){this.#e.off(`data`,this.#Lt),this.#e.on(`data`,this.#Lt),this.#xe.length>0&&queueMicrotask(()=>{this.#be!==void 0&&this.#xe.length>0&&(this.#Bt(),this.#Rt())})}#It(){this.#e.off(`data`,this.#Lt),this.#Ht(),this.#be=void 0}#Lt=e=>{this.#Ht(),this.#xe+=this.#Se.write(e),this.#Bt(),this.#Rt()};#Rt(){if(this.#xe===`\x1B`){this.#Ce=setTimeout(()=>{this.#xe===`\x1B`&&(this.#xe=``,this.#zt({type:`escape`}))},30),this.#Ce.unref?.();return}if(isIncompletePaste(this.#xe)){let e=this.#xe;this.#Ce=setTimeout(()=>{if(this.#xe!==e)return;let t=sanitizePastedText(stripPasteStart(e));this.#xe=``,t.length>0&&this.#zt({type:`text`,value:t,framing:`bracketed-paste`})},incompletePasteFlushMs),this.#Ce.unref?.();return}if(isIncompleteOsc(this.#xe)){let e=this.#xe;this.#Ce=setTimeout(()=>{this.#xe===e&&(this.#xe=``)},incompletePasteFlushMs),this.#Ce.unref?.()}}#zt(e){this.#U.interruptYank(e),this.#be?.(e)}#Bt(){for(;this.#xe.length>0;){let e=nextKey(this.#xe);if(e.incomplete)return;if(this.#xe=this.#xe.slice(e.consumed),e.key!==void 0&&e.key.type!==`ignore`){if(e.key.type===`osc`){this.#Vt(e.key.value);continue}this.#zt(e.key)}}}#Vt(e){let t=parseBackgroundColorReply(e);t!==void 0&&(this.#qe=t,this.#Ke?.setTerminalBackground(t))}#Ht(){this.#Ce&&=(clearTimeout(this.#Ce),void 0)}#Ut(){this.#Wt(),this.#Gt(),this.#ge=setInterval(()=>{this.#pe=!this.#pe,this.#on()},500),this.#ge.unref?.()}#Wt(){this.#ge&&=(clearInterval(this.#ge),void 0),this.#pe=!0}#Gt(){this.#pe=!0}#Kt(){this.#Jt(),this.#_e=setInterval(()=>{this.#me+=1,this.#on()},90),this.#_e.unref?.()}#qt(){this.#Yt()||this.#Jt()}#Jt(){this.#_e&&=(clearInterval(this.#_e),void 0)}#Yt(){return this.#C?.working===!0||this.#x.tasks.length>0}#Xt(){this.#x.finishing&&this.#S===void 0&&(this.#S=setTimeout(()=>{this.#S=void 0,this.#C!==void 0&&this.renderConversation(this.#C)},TASK_END_GRACE_MS),this.#S.unref?.())}#Zt(){this.#S!==void 0&&(clearTimeout(this.#S),this.#S=void 0)}#Qt(e,t=Math.max(8,Math.floor(this.#wn()/2))){let n=this.#x.tasks;if(n.length===0)return[];let r=this.#C?.working===!0&&this.#ie===void 0,i=Date.now(),a=r&&this.#C!==void 0?turnActivity(this.#C,n):`Working`;return renderTaskPanelRows(n,{width:e,theme:this.#i,nowMs:i,maxRows:t,activity:a.startsWith(`Waiting for `)?`Waiting`:a,turnElapsedMs:r?Math.max(0,i-(this.#Q.startedAtMs??i)):void 0})}#$t(){this.#Yt()?this.#_e===void 0&&(this.#he=Date.now(),this.#Kt()):this.#Be===void 0&&this.#k===void 0&&this.#ie===void 0&&this.#Jt()}#en(e){e.id!==this.#Me?.id&&this.#Ln(),e.updateSeq=++this.#b,this.#h.push(e),e.id&&this.#g.set(e.id,e)}#tn(){let e=this.#Q.settle(this.#nn());if(e===void 0||(this.#$=e,this.#f?.reportStats(),e.elapsedMs<=1e4&&e.inputTokens<=2e4))return;let t=`Done in ${this.#vn(e)}`,n=this.#C?.data.lastStepUsage?.inputTokens??0;if(this.#De!==void 0&&this.#De>0&&n>0){let e=Math.round(n/this.#De*100);t+=` ${this.#i.glyph.dot} ${e}% context`}this.#en({kind:`turn-stats`,body:t,live:!1})}#nn(){return this.#C?.data.usage??{inputTokens:0,outputTokens:0}}renderError(e,t){this.#Mt(),this.#rn(e,t)}#rn(e,t,n={}){let r=stripTerminalControls(e),i=stripTerminalControls(t),a=n.detail===void 0?void 0:stripTerminalControls(n.detail),o=n.hint===void 0?void 0:stripTerminalControls(n.hint),s={source:`workflow`,summary:`${r}: ${i}`,detail:a??i};this.#f?.append(o===void 0?s:{...s,hint:o});let c={kind:`error`,title:r,body:i,live:!1};o!==void 0&&(c.hint=o),a!==void 0&&(c.detail=this.#f===void 0?a:`details: ${this.#f.displayPath}`),this.#en(c),this.#on()}#in(e){if(e.id&&this.#v.has(e.id))return;let t=e.id?this.#g.get(e.id):void 0;if(t){Object.assign(t,e),t.updateSeq=++this.#b;return}this.#en(e)}#an(e){this.#h=this.#h.filter(t=>t.id!==e),this.#g.delete(e)}#on(){if(this.#oe){if(this.#Te){this.#Ee=!0;return}this.#Te=!0;try{do this.#Ee=!1,this.#sn();while(this.#Ee)}finally{this.#Te=!1}}}#sn(){if(!this.#oe)return;if(this.#Ke!==void 0){this.#Ke.repaint();return}let e=this.#Cn(),t=this.#gn(e),n=this.#N===void 0?[]:this.#dn(),r=Math.max(1,this.#wn()-n.length-t.length),i=[],a=this.#L,o=groupToolBlocksForDisplay(this.#h),s=0;for(;s<o.length&&o[s].display.live===!1;)s+=1;if(s>0){let e=new Set(o.slice(0,s).flatMap(e=>e.members));for(let t=this.#h.length-1;t>=0;--t)e.has(this.#h[t])&&this.#h.splice(t,1)}for(let t of o.slice(0,s)){for(let e of t.members)this.#y.push(e),e.id&&(this.#v.add(e.id),this.#g.delete(e.id));if(this.#zn(t.display))continue;let n=this.#fn(t.display,e,a);a=previousBlockOf(t.display),this.#L=a,i.push(...n),this.#I.push(...n)}let c=[];for(let{display:t}of o.slice(s)){if(this.#zn(t))continue;let n=this.#fn(t,e,a);a=previousBlockOf(t);for(let e=0;e<n.length;e+=1)c.push({block:t,row:n[e]})}let l=[...n,...clipLiveRows(c.map(e=>e.row),r,e,this.#i),...t];i.length>0?this.#n.flush(i,l):this.#n.update(l)}#cn(){if(!this.#oe)return;let e=this.#Cn(),t=this.#gn(e),n=Math.max(1,this.#wn()-t.length),r=this.#L,i=[];for(let{display:t}of groupToolBlocksForDisplay(this.#h)){if(this.#zn(t))continue;let n=this.#fn(t,e,r);r=previousBlockOf(t),i.push(...n)}let a=[...clipLiveRows(i,n,e,this.#i),...t];this.#n.clearAll(),this.#n.flush([...this.#dn(),...this.#I],a)}logDisplayMode(){return this.#m}setLogDisplayMode(e){e!==this.#m&&(this.#m=e,e===`all`&&this.flushDelayedDevBuildErrors(),this.#un(),this.#oe&&this.#cn())}flushDelayedDevBuildErrors(){let e=this.#je;e!==void 0&&(this.#je=void 0,this.#en({kind:`log`,title:`stderr`,logLevel:`error`,body:e,live:!1}),this.#on())}#ln(){this.#ye=!0,this.#ve!==void 0&&clearTimeout(this.#ve),this.#ve=setTimeout(()=>{this.#ye=!1,this.#ve=void 0,this.#on()},5e3),this.setLogDisplayMode(nextLogDisplayMode(this.#m)),this.#on()}#un(){let e=this.#Cn();this.#I.length=0;let t;for(let{display:n}of groupToolBlocksForDisplay(this.#y,{logCoalescing:`runs`})){if(this.#zn(n))continue;let r=this.#fn(n,e,t);t=previousBlockOf(n),this.#I.push(...r)}this.#L=t}#dn(){let e=this.#E,t=this.#N;if(e===void 0&&t===void 0)return[];let n={name:e?.name??t?.name,theme:this.#i,width:this.#Cn()};return e?.info!==void 0&&(n.info=e.info),buildAgentHeader(n)}#fn(e,t,n){let r={renderMarkdown:this.#a,activityPulse:this.#mn(this.#he,this.#i.unicode?PROGRESS_PULSE_GLYPH:PROGRESS_PULSE_ASCII_GLYPH)};n!==void 0&&(r.previous=n),this.#Be!==void 0&&(r.setupFlowOpen=!0),this.#Re!==void 0&&(r.transientPanelOpen=!0);let i=renderBlockLines(e,t,this.#i,r);return(e.depth??0)===0&&leadsWithGap(e,n)?[``,...i]:i}#pn(){return this.#i.spinner[this.#me%this.#i.spinner.length]??``}#mn(e,t){return isProgressPulseVisible(Date.now()-e)?t:` `}#hn(e){return{glyph:this.#mn(e.startedAtMs,this.#i.unicode?PROGRESS_PULSE_GLYPH:PROGRESS_PULSE_ASCII_GLYPH)}}#gn(e){let t=this.#i.colors,n=[``];if(this.#Re!==void 0){let t=this.#Re(e);return[...t.rows,...t.controls]}if(this.#Le!==void 0){let t=this.#Le(e),n=this.#wn()-t.rows.length-t.controls.length-1;return[...(n>=4?this.#Qt(e,n+1):[]).slice(0,-1),...t.rows,...t.controls]}let r=this.#Be;if(r!==void 0&&(this.#A===void 0||r.question!==void 0)){let t=this.#hn(r),i;if(r.status!==void 0){let{startedAtMs:e,...n}=r.status,a=Date.now()-e,o=a>=5e3?` ${formatTurnDuration(a)}`:``;i={...n,text:`${n.text}${o}`,indicator:t}}let a;if(r.question!==void 0){let t=r.question(e);a={kind:`question`,title:r.questionTitle,rows:t},i!==void 0&&(a={kind:`question`,title:r.questionTitle,rows:t,status:i})}else i===void 0?a=r.preview===void 0?{kind:`idle`,indicator:t}:{kind:`preview`,text:r.preview,indicator:t}:(a={kind:`status`,status:i},r.preview!==void 0&&(a={kind:`status`,status:i,preview:r.preview}));let o={title:r.title,navigation:r.navigation,lines:r.summary===void 0?r.hideLinesWhileQuestion===!0?[]:r.lines:[{text:r.summary.headline,tone:`success`},...r.summary.facts.map(e=>({text:`${e.label}: ${e.value}`,tone:`info`}))],content:a},s=renderFlowDrawer(o,this.#i,e);return n.length===1&&n[0]===``&&(n.length=0),n.push(...s.rows),s.controls.length>0&&n.push(...s.controls),this.#xn(n,e),n}r!==void 0&&n.push(...flowMessageRows(r.lines,this.#i).map(t=>t.length===0?``:clip(` ${t}`,e))),this.#k===void 0&&this.#Ve!==void 0&&n.push(...renderAttentionRows(this.#Ve,e,this.#i),``);let i=this.#C?.working===!0&&this.#ie===void 0,a=this.#Qt(e);a.length>0&&n.push(...a);let o=renderMessageQueueRows({view:this.#He.view(),width:e,theme:this.#i});if(o.length>0&&n.push(...o,``),i&&(a.length===0&&n.push(this.#_n(e)),this.#ne&&n.push(clip(`${t.yellow(this.#i.glyph.dotActive)} ${t.dim(`Cancelling turn… · Ctrl+C to stop waiting, then again to exit`)}`,e)),(a.length===0||this.#ne)&&n.push(``)),this.#W){let r=this.#G===void 0?void 0:inlineCommandHint(this.#G),a=this.#Ye(e);this.#ue&&n.push(clip(t.dim(`Press Ctrl+C again to exit`),e),``);let o=r?t.dim(` ${r}`):``,s=[];this.#bn(s,e);let c=Math.max(1,this.#wn()-1-n.length-1-a.length-s.length-(a.length>0?2:0)),l={text:this.#B,cursor:this.#V,width:e,theme:this.#i,caretVisible:this.#pe,ghost:o,maxRows:c};this.#X&&this.#B.length===0&&(l.placeholder=this.#A===void 0?this.#Z||i?``:this.#D:`Message · Enter to queue`);let u=promptInputRows(l);return a.length>0&&u.at(-1)===``&&u.pop(),n.push(...u),a.length>0&&n.push(t.dim(this.#i.glyph.dash.repeat(e))),n.push(...a),a.length>0&&s.length>0&&n.push(t.dim(this.#i.glyph.dash.repeat(e))),n.push(...s),n}if(i||this.#ee.text.length>0)return this.#yn(n,e,{inert:i,adjacent:a.length>0}),this.#bn(n,e),n;let s=this.#ie??`Ready`,c=this.#Sn(),l=t.dim(this.#i.glyph.dot),u=c?`${l} ${s} ${t.dim(this.#i.glyph.dot)} ${c}`:`${l} ${s}`;return n.push(clip(u,e)),this.#bn(n,e),n}#_n(e){let t=this.#i.colors,n=this.#Q.startedAtMs??Date.now(),r=Math.max(0,Date.now()-n),i=r%1e3<500?this.#i.unicode?`•`:`*`:` `,a=r<1e3?`0s`:formatTurnDuration(Math.floor(r/1e3)*1e3),o=`${this.#C===void 0?`Thinking`:turnActivity(this.#C,this.#x.tasks)} (${a})`,{inputTokens:s,outputTokens:c}=this.#Q.usage(this.#nn());return clip(`${i} ${o}${s>0||c>0?t.dim(` (${formatTokenFlow({inputTokens:s,outputTokens:c},this.#i.glyph)})`):``}`,e)}#vn(e){let{inputTokens:t,outputTokens:n}=e,r=t===0&&n===0?``:` (${formatTokenFlow({inputTokens:t,outputTokens:n},this.#i.glyph)})`;return`${formatTurnDuration(e.elapsedMs)}${r}`}#yn(e,t,n){!n.adjacent&&e.at(-1)!==``&&e.push(``);let r={text:this.#ee.text,cursor:this.#ee.cursor,width:t,theme:this.#i,caretVisible:!0,ghost:``,maxRows:4,inert:n.inert};n.inert&&this.#ee.text.length===0&&(r.placeholder=``),e.push(...promptInputRows(r))}#bn(e,t){if(this.#k!==void 0){let n=this.#Be?.status?.text??{starting:`Starting agent…`,connecting:`Reading saved connection…`,updating:`Loading selected model…`}[this.#k],r=this.#mn(this.#M,this.#i.unicode?PROGRESS_PULSE_GLYPH:PROGRESS_PULSE_ASCII_GLYPH);e.push(clip(this.#i.colors.dim(`${r} ${n}`),t));return}let n=this.#z===void 0?``:` `,r=Math.max(1,t-n.length),i={theme:this.#i,width:r};this.#Pe&&this.#Ne!==void 0&&(i.devBuild=this.#Ne),this.#ye&&(i.logLevel=this.#m);let a=this.#E?.info?.agent.model;if(a?.routing.kind===`dynamic`){let e=this.#C?.data.modelId;i.dynamicModel=!0,e!==void 0&&(i.model=e)}else a?.id!==void 0&&(i.model=a.id);a?.reasoning!==void 0&&a.reasoning!==`provider-default`&&(i.reasoning=a.reasoning),readGatewayServiceTier(a?.providerOptions).kind===`priority`&&(i.fastMode=!0);let o=a?.endpoint;o!==void 0&&(i.endpoint=o),this.#R!==void 0&&(i.vercel=this.#R),this.#z!==void 0&&(i.remote=this.#z);let s=buildStatusLine(i);s!==void 0&&e.push(clip(`${n}${s}`,t))}#xn(e,t){if(this.#z===void 0)return;let n=Math.max(1,t-2),r=buildStatusLine({remote:this.#z,theme:this.#i,width:n});r!==void 0&&e.push(``,clip(` ${r}`,t))}#Sn(){let e=this.#i.colors,t=[],n=this.#$,r=n===void 0?void 0:formatAssistantResponseStats({totalTokens:n.inputTokens+n.outputTokens,outputTokens:n.outputTokens,tokensPerSecond:n.elapsedMs>0?n.outputTokens/(n.elapsedMs/1e3):void 0},this.#u);return r&&t.push(r),t.length>0?e.dim(t.join(` ${this.#i.glyph.dot} `)):``}#Cn(){return Math.max(20,this.#t.columns||80)}#wn(){return Math.max(8,this.#t.rows||24)}#Tn(){if(this.#Oe!==void 0||!this.#d)return;this.#ke=``,this.#Ae=``;let capture=(e,t)=>{let n=e.write.bind(e);return e.write=((e,n,r)=>{let i=typeof n==`string`?n:void 0,a=typeof n==`function`?n:r;return this.#kn(t,chunkToString(e,i)),a?.(),!0}),()=>{e.write=n}},e=[`error`,`warn`,`log`,`info`,`debug`],t=e.map(e=>[e,console[e]]);for(let t of e)console[t]=(...e)=>this.#On({level:t===`log`?`info`:t,text:format(...e)});setConsoleRecordSubscriber(e=>this.#On(e));let n=capture(process.stdout,`stdout`),r=capture(process.stderr,`stderr`);this.#f?.subscribeLogRecords(e=>this.#Dn(e)),this.#Oe=()=>{this.#f?.unsubscribeLogRecords(),setConsoleRecordSubscriber(void 0);for(let[e,n]of t)console[e]=n;n(),r()}}#En(){let e=this.#Oe;e!==void 0&&(this.#Oe=void 0,e(),this.#ke.length>0&&(this.#f?.append({source:`stdout`,detail:this.#ke}),this.#Rn()&&process.stdout.write(`${this.#ke}\n`),this.#ke=``),this.#Ae.length>0&&(this.#f?.append({source:`stderr`,detail:this.#Ae}),this.#Rn()&&process.stderr.write(`${this.#Ae}\n`),this.#Ae=``))}#Dn(e){let t=e.fields===void 0?``:` ${JSON.stringify(e.fields)}`;this.#jn(`[eve:${e.namespace}] ${e.message}${t}`,e.level),this.#on()}#On(e){let t=e.level===`error`||e.level===`warn`?`stderr`:`stdout`;this.#f?.append({source:t,level:e.level,detail:e.text}),t===`stderr`?this.#jn(stripAnsi(e.text),e.level):this.#An(stripAnsi(e.text),e.level),this.#on()}#kn(e,t){let n=(e===`stdout`?this.#ke:this.#Ae)+t;if(e===`stdout`&&parseDevRebuildLogLine(n.trimEnd())!==void 0){this.#ke=``,this.#f?.append({source:e,detail:n.trimEnd()}),this.#An(n.trimEnd()),this.#on();return}let r=n.lastIndexOf(`
|
|
4
|
+
`),live:!1}),this.#en({kind:`flow`,title:n.tone,body:n.text,live:!1})),e=[]}}this.#on()}}async#ut(e){let t=this.#gt(e.message),n=isMultiSelectRequest(e),r=e.kind===`search`?e.searchAction:void 0,i=e.kind===`search`&&e.layout===void 0,a=e.options,o=e.navigation?.kind===`planner`,s={options:a,searchAction:r,submitRow:n&&!o};`initialValue`in e&&e.initialValue!==void 0&&(s.defaultValue=e.initialValue),`initialValues`in e&&e.initialValues!==void 0&&(s.initialValues=e.initialValues);let c=initialSelectState(s),l,u=!1,d=0,isCurrentSearch=e=>e===d,clearSearch=()=>{d+=1,u=!1,c=reduceSelect(c,{type:`clear`},{options:a,searchAction:r,submitRow:n&&!o}),this.#on()},loadSearch=async(e,t)=>{u=!0,l=void 0;let i=++d;this.#on();try{let s=await t(e);if(!isCurrentSearch(i))return;let l=c.filter;a=s,c={...initialSelectState({options:s,searchAction:r,submitRow:n&&!o}),filter:l}}catch(e){isCurrentSearch(i)&&(l=toErrorMessage(e))}finally{isCurrentSearch(i)&&(u=!1,this.#on())}},f=e.notices;if(e.kind===`task-list`||e.kind===`search`&&e.layout===`task-list`){let n=t.taskListLineStart??t.lines.length,r=t.lines.slice(n).filter(e=>e.tone===`success`||e.tone===`warning`||e.tone===`error`).map(e=>({tone:e.tone,text:e.text}));f=e.notices??r,t.taskListLineStart=t.lines.length,t.hideLinesWhileQuestion=!0}let panelState=()=>{let t={...e,message:``,options:a,select:c};return f!==void 0&&f.length>0&&(t.notices=f),l!==void 0&&(t.error=l),u&&(t.loadingFrame=this.#pn()),i&&(t.caretVisible=this.#pe),t};return t.question=e=>renderSelectQuestion(panelState(),this.#i,e),i&&this.#Ut(),this.#on(),await this.#yt((t,s)=>{let close=e=>{d+=1,s(e)};if(u){t.type===`ctrl-c`?close(void 0):t.type===`escape`?clearSearch():t.type===`ctrl-r`&&this.#on();return}let f=e.navigation?.kind===`planner`?e.navigation:void 0,p=t.type===`left`&&(f?.activeStep??0)>(f?.firstNavigableStep??0)?`back`:t.type===`right`&&f!==void 0&&f.activeStep>=(f.firstNavigableStep??0)&&f.activeStep<f.steps.length-1?`forward`:void 0;if(p!==void 0){close({kind:`navigate`,direction:p,values:n?orderedSelection(a,c.selected):[]});return}let m={key:t,options:a,searchAction:r,select:c},h=reduceSetupSelectInput(n?{...m,kind:e.kind,required:e.required,plannerNavigation:o||void 0}:{...m,kind:e.kind});switch(h.kind){case`cancel`:close(void 0);return;case`repaint`:this.#on();return;case`update`:c=h.select,l=void 0,i&&this.#Gt(),this.#on();return;case`submit`:{let e=searchActionQuery(h.values[0]??``),t=r?.load;if(e===void 0||t===void 0){close(h.values);return}loadSearch(e,t);return}case`error`:l=h.message,this.#on();return;case`ignore`:return}},i?()=>this.#Wt():void 0).promise}#dt(e){this.#Mt();let t=this.#_t();t.status={text:stripTerminalControls(e.status),startedAtMs:Date.now()};let n;t.question=t=>renderSelectQuestion({kind:`actions`,context:e.context,actions:e.actions,cursor:n},this.#i,t),this.#on();let r=this.#yt((t,r)=>{let i=setupSelectionIntent(t,{textNavigation:!0});switch(i?.kind){case`cancel`:r(void 0);return;case`move`:n=moveActionCursor(n,i.direction,e.actions.length),this.#on();return;case`repaint`:this.#on();return;case`submit`:n!==void 0&&r(e.actions[n].value);return;case void 0:return}},()=>{t.status=void 0});return{choice:r.promise,close:()=>r.settle(void 0)}}async#ft(e){let t=this.#gt(e.message),n={options:e.options};e.initialValue!==void 0&&(n.defaultValue=e.initialValue);let r=initialSelectState(n),i=lineOf(``),a;t.question=t=>{let n={kind:`inline-edit`,layout:`task-list`,message:``,options:e.options,select:r,edit:{optionValue:e.editable.value,caretVisible:this.#pe,editor:{kind:`rename`,editor:i,defaultValue:e.editable.defaultValue,formatHint:e.editable.formatHint}}};return a!==void 0&&(n.error=a),renderSelectQuestion(n,this.#i,t)};let onEditableRow=()=>selectValueAtCursor([...e.options],r.cursor)===e.editable.value,syncEditableRow=()=>{onEditableRow()?this.#Ut():(i=lineOf(``),this.#Wt())};return syncEditableRow(),this.#on(),await this.#yt((t,n)=>{let applyEditor=e=>{i=e,a=void 0,this.#Gt(),this.#on()},applySelect=t=>{r=reduceSelect(r,t,{options:e.options}),a=void 0,syncEditableRow(),this.#on()},submit=()=>{let t=selectValueAtCursor([...e.options],r.cursor);if(t===void 0)return;if(t!==e.editable.value){n({kind:`selected`,value:t});return}let o=(i.text||e.editable.defaultValue).trim(),s=e.editable.validate?.(o);if(s!==void 0){a=s,this.#on();return}n(o===e.editable.defaultValue?{kind:`selected`,value:t}:{kind:`edited`,value:t,text:o})},o=setupSelectionIntent(t,{textNavigation:!onEditableRow()});switch(o?.kind){case`cancel`:n(void 0);return;case`move`:applySelect({type:o.direction});return;case`submit`:submit();return;case`repaint`:this.#on();return;case void 0:}if(!onEditableRow())return;let s=this.#U.apply(i,t);s!==void 0&&applyEditor(s)},()=>this.#Wt()).promise}async#pt(e){this.#U.clear();let t=this.#gt(e.message),n=initialProviderPickerState(e.options,e.initialValue),r,cursorBadge=()=>{if(n.phase.kind!==`inactive`)return;let t=selectValueAtCursor([...e.options],n.select.cursor),r=e.options.find(e=>e.value===t);if(r!==void 0)return enterBadge(this.#i,r.checked===!0?`change`:void 0)};t.question=t=>{let r=cursorBadge(),i={kind:`inline-edit`,layout:`stacked`,message:``,options:e.options,select:n.select,edit:{optionValue:`ai-gateway-key`,caretVisible:this.#pe,editor:{kind:`key`,phase:n.phase}}};return r!==void 0&&(i.cursorBadge=r),renderSelectQuestion(i,this.#i,t)};let syncCaret=()=>{n.phase.kind===`editing`||n.phase.kind===`invalid`?this.#Ut():this.#Wt()};return syncCaret(),this.#on(),await this.#yt((t,i,a)=>{let dispatch=t=>{let o=transitionProviderPicker(n,t,e.options);switch(o.kind){case`ignore`:return;case`clear`:r?.abort(),r=void 0,n=o.state,syncCaret(),this.#on();return;case`cancel`:i(void 0);return;case`render`:n=o.state,syncCaret(),this.#on();return;case`validate`:{n=o.state,syncCaret(),this.#on();let t=new AbortController;r=t;let i;try{i=e.validateInlineKey(o.key,t.signal)}catch(e){a(e);return}i.then(e=>{r!==t||t.signal.aborted||(r=void 0,dispatch({type:`validated`,validation:e}))},e=>{r!==t||t.signal.aborted||(r=void 0,a(e))});return}case`settle`:i(o.result);return}},o=setupSelectionIntent(t,{textNavigation:n.phase.kind===`inactive`});switch(o?.kind){case`cancel`:dispatch({type:`cancel`});return;case`move`:dispatch({type:`move`,direction:o.direction});return;case`submit`:dispatch({type:`submit`});return;case`repaint`:this.#on();return;case void 0:}if(n.phase.kind!==`editing`&&n.phase.kind!==`invalid`)return;let s=applyLineEditorKey(n.phase.editor,t);s!==void 0&&(this.#Gt(),dispatch({type:`edit`,editor:s}))},()=>{r?.abort(),r=void 0,this.#Wt()}).promise}async#mt(e){e.mask===!0&&this.#U.clear();let t=this.#gt(e.message),n=lineOf(``),r;return t.question=t=>{let i={message:``,editor:n,mask:e.mask===!0};return e.placeholder===void 0?e.defaultValue!==void 0&&(i.placeholder=e.defaultValue):i.placeholder=e.placeholder,e.notices!==void 0&&(i.notices=e.notices),r!==void 0&&(i.error=r),renderTextQuestion(i,this.#i,t,this.#pe)},this.#Ut(),this.#on(),await this.#yt((t,i)=>{let apply=e=>{n=e,r=void 0,this.#Gt(),this.#on()},a=e.mask?applyLineEditorKey(n,t):this.#U.apply(n,t);if(a!==void 0){apply(a);return}switch(t.type){case`ctrl-c`:case`escape`:i(void 0);return;case`ctrl-r`:this.#on();return;case`enter`:{let t=n.text.length>0?n.text:e.defaultValue??``,a=e.validate?.(t);if(a!==void 0){r=a,this.#on();return}i(t);return}default:return}},()=>this.#Wt()).promise}async#ht(e){let t=this.#gt(e.message);return t.question=t=>renderAcknowledgeQuestion({message:``,lines:e.lines},this.#i,t),this.#on(),await this.#yt((e,t)=>{switch(e.type){case`enter`:case`escape`:case`ctrl-c`:t();return;case`ctrl-r`:this.#on();return;default:return}}).promise}#gt(e){this.#Mt(),this.#W=!1;let t=this.#_t();return t.questionTitle=stripTerminalControls(e),t.status!==void 0&&(t.status=void 0,t.summary=void 0,t.preview=void 0),t}#_t(){return this.#Be===void 0&&(this.#Be={title:``,startedAtMs:Date.now(),lines:[],outputBuffer:[],implicit:!0}),this.#Be}#vt(){this.#Be?.implicit===!0?this.#Be=void 0:this.#Be!==void 0&&(this.#Be.question=void 0,this.#Be.questionTitle=void 0,this.#Be.hideLinesWhileQuestion=!1),this.#be=void 0,this.#It(),this.#A===void 0?this.#Be!==void 0&&this.#xt():this.#Xe(),this.#Be===void 0&&this.#on()}#yt(e,t){let n=!1,r,i,a=new Promise((e,t)=>{r=e,i=t}),settle=e=>{n||(n=!0,t?.(),this.#vt(),r(e))},reject=e=>{n||(n=!0,t?.(),this.#vt(),i(e))};return this.#Ht(),this.#be=t=>{t.type===`ctrl-c`&&this.#Ot(),e(t,settle,reject)},this.#Ft(),{promise:a,settle}}#bt(e){let t,n=new Promise(e=>{t=e});return this.#We=t,this.#xt(e?.interruptible??!0),{promise:n,dispose:()=>{this.#We===t&&(this.#We=void 0,this.#St())}}}#xt(e=!0){if(this.#A!==void 0){this.#Xe();return}if(this.#We===void 0)return;let consumer=t=>{if(e&&(t.type===`ctrl-c`||t.type===`escape`)){t.type===`ctrl-c`&&this.#Ot();let e=this.#We;this.#We=void 0,this.#St(),e?.(t.type===`ctrl-c`?`ctrl-c`:`escape`);return}t.type===`ctrl-r`&&this.#on()};this.#Ge=consumer,this.#Ht(),this.#be=consumer,this.#Ft()}#St(){this.#Ge!==void 0&&(this.#be===this.#Ge&&this.#It(),this.#Ge=void 0)}#Ct(e){let t=e===void 0?void 0:{text:stripTerminalControls(e),startedAtMs:Date.now()};if(this.#Be!==void 0){this.#Be.status=t,t===void 0&&(this.#Be.preview=void 0),this.#on();return}if(!(this.#W||this.#C?.working===!0)){if(t===void 0){this.#ie=void 0,this.#qt(),this.#on();return}this.#Mt(),this.#he=Date.now(),this.#Kt(),this.#ie=t.text,this.#on()}}#wt(e,t){let n=stripTerminalControls(e);if(n.trim().length===0)return;let r=this.#Be;if(r!==void 0){if(r.preview=void 0,t===`warning`||t===`error`)for(let e of r.outputBuffer)r.lines.push({text:e,tone:`info`,evidence:!0});r.outputBuffer=[],r.lines.push({text:n,tone:t}),this.#on();return}this.#Mt(),this.#en({kind:`flow`,title:t,body:n,live:!1}),this.#on()}#Tt(e){let t=this.#Be;t!==void 0&&(t.lines=[],t.outputBuffer=[],t.preview=void 0,t.status=void 0,t.summary=e===void 0?void 0:{headline:stripTerminalControls(e.headline),facts:e.facts.map(e=>({label:stripTerminalControls(e.label),value:stripTerminalControls(e.value)}))},this.#on())}#Et(e){let t=stripTerminalControls(e);if(t.trim().length===0)return;let n=this.#Be;if(n===void 0){this.#wt(t,`info`);return}n.preview=t,n.outputBuffer.push(t),n.outputBuffer.length>40&&n.outputBuffer.shift(),this.#on()}async#Dt(e){this.#xe=``,this.#Ht(),this.#We=void 0,this.#St(),this.#It(),this.#Jt(),this.#n.clear(),this.#En(),this.#r.enter({cursor:`visible`,mouse:!1}),this.#e.isTTY&&this.#e.setRawMode?.(!1),this.#e.pause();try{return await e()}finally{this.#r.exit(),this.#e.isTTY&&this.#e.setRawMode?.(!0),this.#e.resume(),this.#xe=``,this.#Ht(),this.#n.hideCursor(),this.#Tn(),this.#Be===void 0?this.#$t():(this.#Kt(),this.#xt()),this.#n.reset(),this.#on()}}setSessionId(e){this.#Ue=e}shutdown(){this.#Pt();for(let e of this.#Y.values())clearTimeout(e);if(this.#Y.clear(),this.#se&&!this.#ce){this.#ce=!0;let e=this.#Ue===void 0?``:` ${this.#i.glyph.dot} session ${this.#Ue}`;this.#t.write(`${this.#i.colors.dim(`${eveVersionTag()}${e}`)}\n`)}}requestInterrupt(){this.#Be!==void 0&&this.#be?.({type:`ctrl-c`}),this.#Pt()}exitRequested(){return this.#le}#Ot(){this.#le=!0,this.#fe?.()}async#kt(e){if(this.#Ke!==void 0||!this.#oe)return;let t=new TraceViewerSession({...e,theme:this.#i,dimensions:()=>({width:this.#Cn(),height:this.#wn()}),paint:e=>this.#r.paint(e,this.#wn()),tracingDisabled:process.env.EVE_TRACES===`off`,copyText:e=>copyTextToClipboard(e,e=>this.#r.writeRaw(e)),terminalBackground:this.#qe});this.#Ke=t,this.#r.enter(),this.#i.color&&this.#r.writeRaw(BACKGROUND_COLOR_QUERY),await new Promise(e=>{this.#jt=e,this.#be=e=>{t.handleKey(e)===`close`&&this.#At()},this.#Ft(),t.start()})}#At(){let e=this.#Ke;if(e===void 0)return;this.#Ke=void 0,e.dispose(),this.#It(),this.#r.exit(),this.#n.hideCursor(),this.#on(),this.#n.showCursor();let t=this.#jt;this.#jt=void 0,t?.()}#jt;#Mt(e){this.#ae=e?.title??this.#ae,!this.#oe&&(this.#oe=!0,this.#se=!0,this.#n.reset(),this.#n.hideCursor(),this.#Tn(),this.#e.isTTY&&(this.#e.setRawMode?.(!0),this.#e.resume(),this.#n.emitBracketedPaste(!0)),this.#we=()=>this.#on(),this.#t.on(`resize`,this.#we),process.on(`exit`,this.#Nt))}#Nt=()=>{this.#oe&&(this.#r.exit(),this.#e.isTTY&&(this.#n.emitBracketedPaste(!1),this.#e.setRawMode?.(!1)),this.#n.showCursor())};#Pt(){this.#Le=void 0;let e=this.#ze;e!==void 0&&(this.#ze=void 0,this.#Re=void 0,this.finishCommand({kind:`dismiss`}),this.#be=void 0,e()),this.#At();let t=this.#re;if(this.#re=void 0,t?.(interruptedError()),this.#It(),this.#Wt(),this.#Jt(),this.#ve!==void 0&&(clearTimeout(this.#ve),this.#ve=void 0),this.#ye=!1,this.#Fn(),this.#oe){this.#Ln(),this.#ot();for(let e of this.#h)e.kind===`log`&&e.id===void 0&&(e.live=!1);this.#on(),this.#n.clear(),this.#n.showCursor(),this.#En(),this.#n.newline(),this.#e.isTTY&&(this.#n.emitBracketedPaste(!1),this.#e.setRawMode?.(!1),this.#e.pause()),this.#we&&=(this.#t.off(`resize`,this.#we),void 0),process.off(`exit`,this.#Nt),this.#oe=!1}}#Ft(){this.#e.off(`data`,this.#Lt),this.#e.on(`data`,this.#Lt),this.#xe.length>0&&queueMicrotask(()=>{this.#be!==void 0&&this.#xe.length>0&&(this.#Bt(),this.#Rt())})}#It(){this.#e.off(`data`,this.#Lt),this.#Ht(),this.#be=void 0}#Lt=e=>{this.#Ht(),this.#xe+=this.#Se.write(e),this.#Bt(),this.#Rt()};#Rt(){if(this.#xe===`\x1B`){this.#Ce=setTimeout(()=>{this.#xe===`\x1B`&&(this.#xe=``,this.#zt({type:`escape`}))},30),this.#Ce.unref?.();return}if(isIncompletePaste(this.#xe)){let e=this.#xe;this.#Ce=setTimeout(()=>{if(this.#xe!==e)return;let t=sanitizePastedText(stripPasteStart(e));this.#xe=``,t.length>0&&this.#zt({type:`text`,value:t,framing:`bracketed-paste`})},incompletePasteFlushMs),this.#Ce.unref?.();return}if(isIncompleteOsc(this.#xe)){let e=this.#xe;this.#Ce=setTimeout(()=>{this.#xe===e&&(this.#xe=``)},incompletePasteFlushMs),this.#Ce.unref?.()}}#zt(e){this.#U.interruptYank(e),this.#be?.(e)}#Bt(){for(;this.#xe.length>0;){let e=nextKey(this.#xe);if(e.incomplete)return;if(this.#xe=this.#xe.slice(e.consumed),e.key!==void 0&&e.key.type!==`ignore`){if(e.key.type===`osc`){this.#Vt(e.key.value);continue}this.#zt(e.key)}}}#Vt(e){let t=parseBackgroundColorReply(e);t!==void 0&&(this.#qe=t,this.#Ke?.setTerminalBackground(t))}#Ht(){this.#Ce&&=(clearTimeout(this.#Ce),void 0)}#Ut(){this.#Wt(),this.#Gt(),this.#ge=setInterval(()=>{this.#pe=!this.#pe,this.#on()},500),this.#ge.unref?.()}#Wt(){this.#ge&&=(clearInterval(this.#ge),void 0),this.#pe=!0}#Gt(){this.#pe=!0}#Kt(){this.#Jt(),this.#_e=setInterval(()=>{this.#me+=1,this.#on()},90),this.#_e.unref?.()}#qt(){this.#Yt()||this.#Jt()}#Jt(){this.#_e&&=(clearInterval(this.#_e),void 0)}#Yt(){return this.#C?.working===!0||this.#x.tasks.length>0}#Xt(){this.#x.finishing&&this.#S===void 0&&(this.#S=setTimeout(()=>{this.#S=void 0,this.#C!==void 0&&this.renderConversation(this.#C)},TASK_END_GRACE_MS),this.#S.unref?.())}#Zt(){this.#S!==void 0&&(clearTimeout(this.#S),this.#S=void 0)}#Qt(e,t=Math.max(8,Math.floor(this.#wn()/2))){let n=this.#x.tasks;if(n.length===0)return[];let r=this.#C?.working===!0&&this.#ie===void 0,i=Date.now(),a=r&&this.#C!==void 0?turnActivity(this.#C,n):`Working`;return renderTaskPanelRows(n,{width:e,theme:this.#i,nowMs:i,maxRows:t,activity:a.startsWith(`Waiting for `)?`Waiting`:a,turnElapsedMs:r?Math.max(0,i-(this.#Q.startedAtMs??i)):void 0})}#$t(){this.#Yt()?this.#_e===void 0&&(this.#he=Date.now(),this.#Kt()):this.#Be===void 0&&this.#k===void 0&&this.#ie===void 0&&this.#Jt()}#en(e){e.id!==this.#Me?.id&&this.#Ln(),e.updateSeq=++this.#b,this.#h.push(e),e.id&&this.#g.set(e.id,e)}#tn(){let e=this.#Q.settle(this.#nn());if(e===void 0||(this.#$=e,this.#f?.reportStats(),e.elapsedMs<=1e4&&e.inputTokens<=2e4))return;let t=`Done in ${this.#vn(e)}`,n=this.#C?.data.lastStepUsage?.inputTokens??0;if(this.#De!==void 0&&this.#De>0&&n>0){let e=Math.round(n/this.#De*100);t+=` ${this.#i.glyph.dot} ${e}% context`}this.#en({kind:`turn-stats`,body:t,live:!1})}#nn(){return this.#C?.data.usage??{inputTokens:0,outputTokens:0}}renderError(e,t){this.#Mt(),this.#rn(e,t)}#rn(e,t,n={}){let r=stripTerminalControls(e),i=stripTerminalControls(t),a=n.detail===void 0?void 0:stripTerminalControls(n.detail),o=n.hint===void 0?void 0:stripTerminalControls(n.hint),s={source:`workflow`,summary:`${r}: ${i}`,detail:a??i};this.#f?.append(o===void 0?s:{...s,hint:o});let c={kind:`error`,title:r,body:i,live:!1};o!==void 0&&(c.hint=o),a!==void 0&&(c.detail=this.#f===void 0?a:`details: ${this.#f.displayPath}`),this.#en(c),this.#on()}#in(e){if(e.id&&this.#v.has(e.id))return;let t=e.id?this.#g.get(e.id):void 0;if(t){Object.assign(t,e),t.updateSeq=++this.#b;return}this.#en(e)}#an(e){this.#h=this.#h.filter(t=>t.id!==e),this.#g.delete(e)}#on(){if(this.#oe){if(this.#Te){this.#Ee=!0;return}this.#Te=!0;try{do this.#Ee=!1,this.#sn();while(this.#Ee)}finally{this.#Te=!1}}}#sn(){if(!this.#oe)return;if(this.#Ke!==void 0){this.#Ke.repaint();return}let e=this.#Cn(),t=this.#gn(e),n=this.#N===void 0?[]:this.#dn(),r=Math.max(0,this.#wn()-n.length-t.length),i=[],a=this.#L,o=groupToolBlocksForDisplay(this.#h),s=0;for(;s<o.length&&o[s].display.live===!1;)s+=1;if(s>0){let e=new Set(o.slice(0,s).flatMap(e=>e.members));for(let t=this.#h.length-1;t>=0;--t)e.has(this.#h[t])&&this.#h.splice(t,1)}for(let t of o.slice(0,s)){for(let e of t.members)this.#y.push(e),e.id&&(this.#v.add(e.id),this.#g.delete(e.id));if(this.#zn(t.display))continue;let n=this.#fn(t.display,e,a);a=previousBlockOf(t.display),this.#L=a,i.push(...n),this.#I.push(...n)}let c=[];for(let{display:t}of o.slice(s)){if(this.#zn(t))continue;let n=this.#fn(t,e,a);a=previousBlockOf(t);for(let e=0;e<n.length;e+=1)c.push({block:t,row:n[e]})}let l=[...n,...clipLiveRows(c.map(e=>e.row),r,e,this.#i),...t];i.length>0?this.#n.flush(i,l):this.#n.update(l)}#cn(){if(!this.#oe)return;let e=this.#Cn(),t=this.#gn(e),n=Math.max(0,this.#wn()-t.length),r=this.#L,i=[];for(let{display:t}of groupToolBlocksForDisplay(this.#h)){if(this.#zn(t))continue;let n=this.#fn(t,e,r);r=previousBlockOf(t),i.push(...n)}let a=[...clipLiveRows(i,n,e,this.#i),...t];this.#n.clearAll(),this.#n.flush([...this.#dn(),...this.#I],a)}logDisplayMode(){return this.#m}setLogDisplayMode(e){e!==this.#m&&(this.#m=e,e===`all`&&this.flushDelayedDevBuildErrors(),this.#un(),this.#oe&&this.#cn())}flushDelayedDevBuildErrors(){let e=this.#je;e!==void 0&&(this.#je=void 0,this.#en({kind:`log`,title:`stderr`,logLevel:`error`,body:e,live:!1}),this.#on())}#ln(){this.#ye=!0,this.#ve!==void 0&&clearTimeout(this.#ve),this.#ve=setTimeout(()=>{this.#ye=!1,this.#ve=void 0,this.#on()},5e3),this.setLogDisplayMode(nextLogDisplayMode(this.#m)),this.#on()}#un(){let e=this.#Cn();this.#I.length=0;let t;for(let{display:n}of groupToolBlocksForDisplay(this.#y,{logCoalescing:`runs`})){if(this.#zn(n))continue;let r=this.#fn(n,e,t);t=previousBlockOf(n),this.#I.push(...r)}this.#L=t}#dn(){let e=this.#E,t=this.#N;if(e===void 0&&t===void 0)return[];let n={name:e?.name??t?.name,theme:this.#i,width:this.#Cn()};return e?.info!==void 0&&(n.info=e.info),buildAgentHeader(n)}#fn(e,t,n){let r={renderMarkdown:this.#a,activityPulse:this.#mn(this.#he,this.#i.unicode?PROGRESS_PULSE_GLYPH:PROGRESS_PULSE_ASCII_GLYPH)};n!==void 0&&(r.previous=n),this.#Be!==void 0&&(r.setupFlowOpen=!0),this.#Re!==void 0&&(r.transientPanelOpen=!0);let i=renderBlockLines(e,t,this.#i,r);return(e.depth??0)===0&&leadsWithGap(e,n)?[``,...i]:i}#pn(){return this.#i.spinner[this.#me%this.#i.spinner.length]??``}#mn(e,t){return isProgressPulseVisible(Date.now()-e)?t:` `}#hn(e){return{glyph:this.#mn(e.startedAtMs,this.#i.unicode?PROGRESS_PULSE_GLYPH:PROGRESS_PULSE_ASCII_GLYPH)}}#gn(e){let t=this.#i.colors,n=[``];if(this.#Re!==void 0){let t=this.#Re(e);return[...t.rows,...t.controls]}if(this.#Le!==void 0){let t=this.#Le(e),n=this.#wn()-t.rows.length-t.controls.length-1;return[...(n>=4?this.#Qt(e,n+1):[]).slice(0,-1),...t.rows,...t.controls].map(t=>clip(t,e))}let r=this.#Be;if(r!==void 0&&(this.#A===void 0||r.question!==void 0)){let t=this.#hn(r),i;if(r.status!==void 0){let{startedAtMs:e,...n}=r.status,a=Date.now()-e,o=a>=5e3?` ${formatTurnDuration(a)}`:``;i={...n,text:`${n.text}${o}`,indicator:t}}let a;if(r.question!==void 0){let t=r.question(e);a={kind:`question`,title:r.questionTitle,rows:t},i!==void 0&&(a={kind:`question`,title:r.questionTitle,rows:t,status:i})}else i===void 0?a=r.preview===void 0?{kind:`idle`,indicator:t}:{kind:`preview`,text:r.preview,indicator:t}:(a={kind:`status`,status:i},r.preview!==void 0&&(a={kind:`status`,status:i,preview:r.preview}));let o={title:r.title,navigation:r.navigation,lines:r.summary===void 0?r.hideLinesWhileQuestion===!0?[]:r.lines:[{text:r.summary.headline,tone:`success`},...r.summary.facts.map(e=>({text:`${e.label}: ${e.value}`,tone:`info`}))],content:a},s=renderFlowDrawer(o,this.#i,e);return n.length===1&&n[0]===``&&(n.length=0),n.push(...s.rows),s.controls.length>0&&n.push(...s.controls),this.#xn(n,e),n}r!==void 0&&n.push(...flowMessageRows(r.lines,this.#i).map(t=>t.length===0?``:clip(` ${t}`,e))),this.#k===void 0&&this.#Ve!==void 0&&n.push(...renderAttentionRows(this.#Ve,e,this.#i),``);let i=this.#C?.working===!0&&this.#ie===void 0,a=this.#Qt(e);a.length>0&&n.push(...a);let o=renderMessageQueueRows({view:this.#He.view(),width:e,theme:this.#i});if(o.length>0&&n.push(...o,``),i&&(a.length===0&&n.push(this.#_n(e)),this.#ne&&n.push(clip(`${t.yellow(this.#i.glyph.dotActive)} ${t.dim(`Cancelling turn… · Ctrl+C to stop waiting, then again to exit`)}`,e)),(a.length===0||this.#ne)&&n.push(``)),this.#W){let r=this.#G===void 0?void 0:inlineCommandHint(this.#G),a=this.#Ye(e);this.#ue&&n.push(clip(t.dim(`Press Ctrl+C again to exit`),e),``);let o=r?t.dim(` ${r}`):``,s=[];this.#bn(s,e);let c=Math.max(1,this.#wn()-1-n.length-1-a.length-s.length-(a.length>0?2:0)),l={text:this.#B,cursor:this.#V,width:e,theme:this.#i,caretVisible:this.#pe,ghost:o,maxRows:c};this.#X&&this.#B.length===0&&(l.placeholder=this.#A===void 0?this.#Z||i?``:this.#D:`Message · Enter to queue`);let u=promptInputRows(l);return a.length>0&&u.at(-1)===``&&u.pop(),n.push(...u),a.length>0&&n.push(t.dim(this.#i.glyph.dash.repeat(e))),n.push(...a),a.length>0&&s.length>0&&n.push(t.dim(this.#i.glyph.dash.repeat(e))),n.push(...s),n}if(i||this.#ee.text.length>0)return this.#yn(n,e,{inert:i,adjacent:a.length>0}),this.#bn(n,e),n;let s=this.#ie??`Ready`,c=this.#Sn(),l=t.dim(this.#i.glyph.dot),u=c?`${l} ${s} ${t.dim(this.#i.glyph.dot)} ${c}`:`${l} ${s}`;return n.push(clip(u,e)),this.#bn(n,e),n}#_n(e){let t=this.#i.colors,n=this.#Q.startedAtMs??Date.now(),r=Math.max(0,Date.now()-n),i=r%1e3<500?this.#i.unicode?`•`:`*`:` `,a=r<1e3?`0s`:formatTurnDuration(Math.floor(r/1e3)*1e3),o=`${this.#C===void 0?`Thinking`:turnActivity(this.#C,this.#x.tasks)} (${a})`,{inputTokens:s,outputTokens:c}=this.#Q.usage(this.#nn());return clip(`${i} ${o}${s>0||c>0?t.dim(` (${formatTokenFlow({inputTokens:s,outputTokens:c},this.#i.glyph)})`):``}`,e)}#vn(e){let{inputTokens:t,outputTokens:n}=e,r=t===0&&n===0?``:` (${formatTokenFlow({inputTokens:t,outputTokens:n},this.#i.glyph)})`;return`${formatTurnDuration(e.elapsedMs)}${r}`}#yn(e,t,n){!n.adjacent&&e.at(-1)!==``&&e.push(``);let r={text:this.#ee.text,cursor:this.#ee.cursor,width:t,theme:this.#i,caretVisible:!0,ghost:``,maxRows:4,inert:n.inert};n.inert&&this.#ee.text.length===0&&(r.placeholder=``),e.push(...promptInputRows(r))}#bn(e,t){if(this.#k!==void 0){let n=this.#Be?.status?.text??{starting:`Starting agent…`,connecting:`Reading saved connection…`,updating:`Loading selected model…`}[this.#k],r=this.#mn(this.#M,this.#i.unicode?PROGRESS_PULSE_GLYPH:PROGRESS_PULSE_ASCII_GLYPH);e.push(clip(this.#i.colors.dim(`${r} ${n}`),t));return}let n=this.#z===void 0?``:` `,r=Math.max(1,t-n.length),i={theme:this.#i,width:r};this.#Pe&&this.#Ne!==void 0&&(i.devBuild=this.#Ne),this.#ye&&(i.logLevel=this.#m);let a=this.#E?.info?.agent.model;if(a?.routing.kind===`dynamic`){let e=this.#C?.data.modelId;i.dynamicModel=!0,e!==void 0&&(i.model=e)}else a?.id!==void 0&&(i.model=a.id);a?.reasoning!==void 0&&a.reasoning!==`provider-default`&&(i.reasoning=a.reasoning),readGatewayServiceTier(a?.providerOptions).kind===`priority`&&(i.fastMode=!0);let o=a?.endpoint;o!==void 0&&(i.endpoint=o),this.#R!==void 0&&(i.vercel=this.#R),this.#z!==void 0&&(i.remote=this.#z);let s=buildStatusLine(i);s!==void 0&&e.push(clip(`${n}${s}`,t))}#xn(e,t){if(this.#z===void 0)return;let n=Math.max(1,t-2),r=buildStatusLine({remote:this.#z,theme:this.#i,width:n});r!==void 0&&e.push(``,clip(` ${r}`,t))}#Sn(){let e=this.#i.colors,t=[],n=this.#$,r=n===void 0?void 0:formatAssistantResponseStats({totalTokens:n.inputTokens+n.outputTokens,outputTokens:n.outputTokens,tokensPerSecond:n.elapsedMs>0?n.outputTokens/(n.elapsedMs/1e3):void 0},this.#u);return r&&t.push(r),t.length>0?e.dim(t.join(` ${this.#i.glyph.dot} `)):``}#Cn(){return Math.max(20,this.#t.columns||80)}#wn(){return Math.max(8,this.#t.rows||24)}#Tn(){if(this.#Oe!==void 0||!this.#d)return;this.#ke=``,this.#Ae=``;let capture=(e,t)=>{let n=e.write.bind(e);return e.write=((e,n,r)=>{let i=typeof n==`string`?n:void 0,a=typeof n==`function`?n:r;return this.#kn(t,chunkToString(e,i)),a?.(),!0}),()=>{e.write=n}},e=[`error`,`warn`,`log`,`info`,`debug`],t=e.map(e=>[e,console[e]]);for(let t of e)console[t]=(...e)=>this.#On({level:t===`log`?`info`:t,text:format(...e)});setConsoleRecordSubscriber(e=>this.#On(e));let n=capture(process.stdout,`stdout`),r=capture(process.stderr,`stderr`);this.#f?.subscribeLogRecords(e=>this.#Dn(e)),this.#Oe=()=>{this.#f?.unsubscribeLogRecords(),setConsoleRecordSubscriber(void 0);for(let[e,n]of t)console[e]=n;n(),r()}}#En(){let e=this.#Oe;e!==void 0&&(this.#Oe=void 0,e(),this.#ke.length>0&&(this.#f?.append({source:`stdout`,detail:this.#ke}),this.#Rn()&&process.stdout.write(`${this.#ke}\n`),this.#ke=``),this.#Ae.length>0&&(this.#f?.append({source:`stderr`,detail:this.#Ae}),this.#Rn()&&process.stderr.write(`${this.#Ae}\n`),this.#Ae=``))}#Dn(e){let t=e.fields===void 0?``:` ${JSON.stringify(e.fields)}`;this.#jn(`[eve:${e.namespace}] ${e.message}${t}`,e.level),this.#on()}#On(e){let t=e.level===`error`||e.level===`warn`?`stderr`:`stdout`;this.#f?.append({source:t,level:e.level,detail:e.text}),t===`stderr`?this.#jn(stripAnsi(e.text),e.level):this.#An(stripAnsi(e.text),e.level),this.#on()}#kn(e,t){let n=(e===`stdout`?this.#ke:this.#Ae)+t;if(e===`stdout`&&parseDevRebuildLogLine(n.trimEnd())!==void 0){this.#ke=``,this.#f?.append({source:e,detail:n.trimEnd()}),this.#An(n.trimEnd()),this.#on();return}let r=n.lastIndexOf(`
|
|
5
5
|
`),i=r===-1?n:n.slice(r+1);if(e===`stdout`?this.#ke=i:this.#Ae=i,r===-1)return;let a=stripAnsi(n.slice(0,r)).replace(/\s+$/u,``);a.trim().length!==0&&(this.#f?.append({source:e,detail:a}),e===`stdout`?this.#An(a):this.#jn(a),this.#on())}#An(e,t){let n=[],flushPending=()=>{if(n.length===0)return;let e=n.join(`
|
|
6
6
|
`);n=[],e.trim().length!==0&&this.#en({kind:`log`,title:`stdout`,logLevel:t,body:e,live:!1})};for(let r of e.split(`
|
|
7
7
|
`)){let e=parseSandboxLogLine(r.trimEnd());if(e!==void 0){flushPending(),this.#en({kind:`sandbox`,logLevel:t,body:e,live:!1});continue}let i=parseDevRebuildLogLine(r.trimEnd());if(i===void 0){n.push(r);continue}flushPending(),this.#Nn(i,r.trimEnd())}flushPending()}#jn(e,t){let n=e.split(`
|
|
8
8
|
`),r=n.findIndex(e=>parseDevRebuildLogLine(e.trimEnd())?.kind===`failed`);if(r===-1){if(this.#f===void 0){this.#en({kind:`log`,title:`stderr`,logLevel:t,body:e,live:!1});return}let n=presentDiagnostic(e,this.#f.displayPath);if(n.kind===`inline`){this.#en({kind:`log`,title:`stderr`,logLevel:t,body:n.text,live:!1});return}this.#en({kind:`log`,title:`stderr`,body:formatStoredDiagnostic(n),logVisibility:`summary`,logLevel:t,live:!1}),this.#en({kind:`log`,title:`stderr`,body:e,logVisibility:`all-only`,logLevel:t,live:!1});return}let i=n.slice(0,r).join(`
|
|
9
9
|
`);i.trim().length>0&&this.#en({kind:`log`,title:`stderr`,logLevel:t,body:i,live:!1});let a=n.slice(r).join(`
|
|
10
|
-
`);this.#Mn(a)}#Mn(e){if(this.#Fn(),this.#m===`all`){if(e.trim().length===0)return;this.#en({kind:`log`,title:`stderr`,logLevel:`error`,body:e,live:!1});return}this.#je=e}#Nn(e,t){let n=this.#In();if(e.kind===`failed`){this.#Mn(t);return}if(e.kind===`rebuilding`){let t=summarizeChangedFiles(e.events,e.more);if(this.#Pn({phase:`building`,summary:t}),n!==void 0){n.state.summary=t,n.block.body=formatDevRebuildStatus(t,`rebuilding`);return}let r=`dev-rebuild:${this.#Ie}`;this.#Ie+=1,this.#Me={id:r,summary:t},this.#en({kind:`log`,id:r,title:`stdout`,body:formatDevRebuildStatus(t,`rebuilding`),live:!0});return}let r=n?.state.summary??this.#Ne?.summary;if(r!==void 0&&this.#Pn({phase:`complete`,summary:r}),n!==void 0){n.block.body=formatDevRebuildStatus(n.state.summary,e.kind),e.kind===`rebuilt`&&(this.#je=void 0);return}e.kind===`rebuilt`&&(this.#je=void 0),this.#en({kind:`log`,title:`stdout`,body:t,live:!1})}#Pn(e){this.#Fe!==void 0&&clearTimeout(this.#Fe),this.#Ne=e,this.#Pe=e.phase===`complete`,this.#Fe=setTimeout(()=>{e.phase===`building`?(this.#Pe=!0,this.#Fe=void 0):this.#Fn(),this.#on()},e.phase===`building`?250:4e3)}#Fn(){this.#Fe!==void 0&&clearTimeout(this.#Fe),this.#Ne=void 0,this.#Pe=!1,this.#Fe=void 0}#In(){let e=this.#Me;if(e===void 0)return;let t=this.#g.get(e.id);if(t!==void 0&&t.live===!0)return{state:e,block:t}}#Ln(){let e=this.#Me;if(e===void 0)return;this.#Me=void 0;let t=this.#g.get(e.id);t!==void 0&&(t.live=!1)}#Rn(e){return isLogVisible(this.#m,e)}#zn(e){return e.kind===`sandbox`?!this.#Rn(e.logLevel):e.kind===`log`?e.logVisibility===`summary`&&this.#m===`all`?!0:e.logVisibility===`all-only`?this.#m!==`all`:!this.#Rn(e.logLevel):!1}};function chunkToString(e,t){return typeof e==`string`?e:Buffer.from(e).toString(t)}function clip(e,t){return clipVisible(e,t)}function promptInputRows({text:e,cursor:t,width:n,theme:r,caretVisible:i,ghost:a,maxRows:o,placeholder:s,inert:c}){let l=r.colors;if(e.length===0&&s!==void 0){let e=renderInputWithBlockCursor({...visibleLine({text:s,cursor:0},Math.max(1,n-3),r.glyph.ellipsis),visible:i,inverse:l.inverse,render:e=>l.dim(renderInputText(e))});return[clip(`${r.glyph.prompt} ${e}`,n),``]}let u=renderInputText,d=layoutPromptInput({text:e,cursor:t}),f=Math.min(Math.max(1,o),d.rows.length),p=Math.max(0,Math.min(d.caretRow-f+1,d.rows.length-f)),m=c===!0?l.dim(r.glyph.prompt):e.startsWith(`/`)?r.glyph.user:r.glyph.prompt,h=l.dim(r.glyph.ellipsis),g=Math.max(1,n-3),_=[];for(let e=p;e<p+f;e+=1){let t=d.rows[e],o=e===0?m:` `;(e===p&&p>0||e===p+f-1&&p+f<d.rows.length)&&(o=h);let s;if(e===d.caretRow){let{before:e,under:n,after:o}=visibleLine({text:t.text,cursor:d.caretOffset},g,r.glyph.ellipsis);s=renderInputWithBlockCursor({before:e,under:n,after:o,visible:i,inverse:l.inverse,render:u}),a.length>0&&d.rows.length===1&&(s+=a)}else s=u(t.text);_.push(clip(`${o} ${s}`,n))}return _.push(``),_}function previousBlockOf(e){let t={kind:e.kind};return e.title!==void 0&&(t.title=e.title),e.subagentCallId!==void 0&&(t.subagentCallId=e.subagentCallId),t}function leadsWithGap(e,t){if((e.kind===`tool`||e.kind===`task`)&&(t?.kind===`user`||t?.kind===`assistant`||t?.kind===`question`))return!0;if(e.kind===`sandbox`&&t?.kind===`sandbox`)return!1;if(t?.kind===`sandbox`&&e.kind!==`sandbox`||t?.kind===`log`)return!0;switch(e.kind){case`user`:case`assistant`:case`reasoning`:case`error`:case`notice`:case`question`:case`connection-auth`:case`sandbox`:case`log`:case`command`:case`warning`:case`flow`:case`turn-stats`:case`session-boundary`:case`agent-header`:return!0;default:return!1}}function parseSandboxLogLine(e){let t=e.trim();if(!t.startsWith(`eve: `))return;let n=t.slice(5);return/\bsandbox\b/i.test(n)&&!isLowValueSandboxLogLine(n)?n:void 0}function isLowValueSandboxLogLine(e){return/^initializing (?:\d+ )?sandbox templates?\b/i.test(e)||/^initialized \d+ sandbox\b/i.test(e)||/^reused cached sandbox template\b/i.test(e)||/^sandbox template "[^"]+" \([^)]+\): (checking|reusing
|
|
10
|
+
`);this.#Mn(a)}#Mn(e){if(this.#Fn(),this.#m===`all`){if(e.trim().length===0)return;this.#en({kind:`log`,title:`stderr`,logLevel:`error`,body:e,live:!1});return}this.#je=e}#Nn(e,t){let n=this.#In();if(e.kind===`failed`){this.#Mn(t);return}if(e.kind===`rebuilding`){let t=summarizeChangedFiles(e.events,e.more);if(this.#Pn({phase:`building`,summary:t}),n!==void 0){n.state.summary=t,n.block.body=formatDevRebuildStatus(t,`rebuilding`);return}let r=`dev-rebuild:${this.#Ie}`;this.#Ie+=1,this.#Me={id:r,summary:t},this.#en({kind:`log`,id:r,title:`stdout`,body:formatDevRebuildStatus(t,`rebuilding`),live:!0});return}let r=n?.state.summary??this.#Ne?.summary;if(r!==void 0&&this.#Pn({phase:`complete`,summary:r}),n!==void 0){n.block.body=formatDevRebuildStatus(n.state.summary,e.kind),e.kind===`rebuilt`&&(this.#je=void 0);return}e.kind===`rebuilt`&&(this.#je=void 0),this.#en({kind:`log`,title:`stdout`,body:t,live:!1})}#Pn(e){this.#Fe!==void 0&&clearTimeout(this.#Fe),this.#Ne=e,this.#Pe=e.phase===`complete`,this.#Fe=setTimeout(()=>{e.phase===`building`?(this.#Pe=!0,this.#Fe=void 0):this.#Fn(),this.#on()},e.phase===`building`?250:4e3)}#Fn(){this.#Fe!==void 0&&clearTimeout(this.#Fe),this.#Ne=void 0,this.#Pe=!1,this.#Fe=void 0}#In(){let e=this.#Me;if(e===void 0)return;let t=this.#g.get(e.id);if(t!==void 0&&t.live===!0)return{state:e,block:t}}#Ln(){let e=this.#Me;if(e===void 0)return;this.#Me=void 0;let t=this.#g.get(e.id);t!==void 0&&(t.live=!1)}#Rn(e){return isLogVisible(this.#m,e)}#zn(e){return e.kind===`sandbox`?!this.#Rn(e.logLevel):e.kind===`log`?e.logVisibility===`summary`&&this.#m===`all`?!0:e.logVisibility===`all-only`?this.#m!==`all`:!this.#Rn(e.logLevel):!1}};function chunkToString(e,t){return typeof e==`string`?e:Buffer.from(e).toString(t)}function clip(e,t){return clipVisible(e,t)}function promptInputRows({text:e,cursor:t,width:n,theme:r,caretVisible:i,ghost:a,maxRows:o,placeholder:s,inert:c}){let l=r.colors;if(e.length===0&&s!==void 0){let e=renderInputWithBlockCursor({...visibleLine({text:s,cursor:0},Math.max(1,n-3),r.glyph.ellipsis),visible:i,inverse:l.inverse,render:e=>l.dim(renderInputText(e))});return[clip(`${r.glyph.prompt} ${e}`,n),``]}let u=renderInputText,d=layoutPromptInput({text:e,cursor:t}),f=Math.min(Math.max(1,o),d.rows.length),p=Math.max(0,Math.min(d.caretRow-f+1,d.rows.length-f)),m=c===!0?l.dim(r.glyph.prompt):e.startsWith(`/`)?r.glyph.user:r.glyph.prompt,h=l.dim(r.glyph.ellipsis),g=Math.max(1,n-3),_=[];for(let e=p;e<p+f;e+=1){let t=d.rows[e],o=e===0?m:` `;(e===p&&p>0||e===p+f-1&&p+f<d.rows.length)&&(o=h);let s;if(e===d.caretRow){let{before:e,under:n,after:o}=visibleLine({text:t.text,cursor:d.caretOffset},g,r.glyph.ellipsis);s=renderInputWithBlockCursor({before:e,under:n,after:o,visible:i,inverse:l.inverse,render:u}),a.length>0&&d.rows.length===1&&(s+=a)}else s=u(t.text);_.push(clip(`${o} ${s}`,n))}return _.push(``),_}function previousBlockOf(e){let t={kind:e.kind};return e.title!==void 0&&(t.title=e.title),e.subagentCallId!==void 0&&(t.subagentCallId=e.subagentCallId),t}function leadsWithGap(e,t){if((e.kind===`tool`||e.kind===`task`)&&(t?.kind===`user`||t?.kind===`assistant`||t?.kind===`question`))return!0;if(e.kind===`sandbox`&&t?.kind===`sandbox`)return!1;if(t?.kind===`sandbox`&&e.kind!==`sandbox`||t?.kind===`log`)return!0;switch(e.kind){case`user`:case`assistant`:case`reasoning`:case`error`:case`notice`:case`question`:case`connection-auth`:case`sandbox`:case`log`:case`command`:case`warning`:case`flow`:case`turn-stats`:case`session-boundary`:case`agent-header`:return!0;default:return!1}}function parseSandboxLogLine(e){let t=e.trim();if(!t.startsWith(`eve: `))return;let n=t.slice(5);return/\bsandbox\b/i.test(n)&&!isLowValueSandboxLogLine(n)?n:void 0}function isLowValueSandboxLogLine(e){return/^initializing (?:\d+ )?sandbox templates?\b/i.test(e)||/^initialized \d+ sandbox\b/i.test(e)||/^reused cached sandbox template\b/i.test(e)||/^sandbox template "[^"]+" \([^)]+\): (checking|reusing)\b/i.test(e)}function clipLiveRows(e,t,n,r){if(t<=0)return[];if(e.length<=t)return[...e];if(t<=1)return[clip(hiddenRowsMarker(e.length,r),n)];let i=t-1;return[clip(hiddenRowsMarker(e.length-i,r),n),...e.slice(e.length-i)]}function hiddenRowsMarker(e,t){let n=e.toLocaleString(),r=e===1?`row`:`rows`;return t.colors.dim(`${t.glyph.dot} ${t.glyph.ellipsis} ${n} earlier ${r} hidden while streaming`)}function questionSectionId(e){return`question:${e}`}function resolveQuestionText(e,t){let n=e.trim();if(n.length===0)return;let r=n.toLowerCase(),i=t.options??[];if(i.length>0){let e=matchQuestionOption(r,i);if(e!==void 0)return{optionId:e.id,label:e.label}}if(t.allowFreeform===!0||i.length===0)return{text:n,label:n}}function matchQuestionOption(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{TerminalRenderer};
|
|
@@ -14,7 +14,7 @@ export declare class EveAgentStore<TData> {
|
|
|
14
14
|
get snapshot(): EveAgentStoreSnapshot<TData>;
|
|
15
15
|
setCallbacks(callbacks: EveAgentStoreCallbacks<TData>): void;
|
|
16
16
|
subscribe(callback: () => void): () => void;
|
|
17
|
-
/** Creates
|
|
17
|
+
/** Creates a session or prepares its idle owner without starting a turn. */
|
|
18
18
|
prewarm(): Promise<void>;
|
|
19
19
|
send<TOutput = unknown>(input: SendTurnPayload<TOutput>): Promise<void>;
|
|
20
20
|
/** Replays this store's attached durable session and follows an in-flight turn. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{toError}from"#shared/errors.js";import{activeTurnForOptimisticFollowUp,assertAnswerable,assertExclusiveTurnInput,assertInFlightFollowUp,countFollowUpDeliveries,createAbortSignal,createActiveTurn,followSteeredTurns,isAbortError,isResponseBoundary,isSettledSessionTail,settledStatus,toTerminalStreamFailureError,validateFollowUp,waitWithSignal}from"#client/eve-agent-store-helpers.js";import{EveAgentProjection}from"#client/eve-agent-projection.js";import{throwIfAborted}from"#client/abort-signal.js";import{Client}from"#client/client.js";import{consumeMessageResponse,getMessageResponseDeliveryId}from"#client/message-response.js";import{OptimisticMessageSubmissions}from"#client/optimistic-message-submissions.js";import{ConversationClient}from"#client/conversation-client.js";import{dispatchSessionTurn}from"#client/session-turn-dispatch.js";const detachStore=Symbol(`detachEveAgentStore`),attachStore=Symbol(`attachEveAgentStore`);var EveAgentStore=class{#e;#t;#n=!1;#r;#i;#a;#o;#s=new Set;#c;#l={};#u;#d;#f;#p=0;#m;#h;#g;#_;#v;#y=`ready`;constructor(e){this.#t=e.prewarm??!1,this.#i=e.followSubagents??!1,this.#a=e.followIdle??!0,this.#o=e.session!==void 0,this.#e=this.#o?void 0:e.client??new Client({auth:e.auth,headers:e.headers,host:e.host??``}),this.#r=new ConversationClient(new EveAgentProjection(e.reducer,[]),()=>this.#L(),()=>this.#L()),this.#d=(e.initialEvents??[]).filter(e=>this.#r.hydrate(e)),this.#f=new OptimisticMessageSubmissions(this.#r.projections,e.optimistic??!0),this.#_=e.session??(e.initialSession===void 0?void 0:this.#e?.sessions.attach(e.initialSession.sessionId,{streamIndex:e.initialSession.streamIndex})),this.#v=this.#I()}get snapshot(){return this.#v}setCallbacks(e){this.#l=e}subscribe(e){return this.#s.add(e),()=>void this.#s.delete(e)}prewarm(){if(this.#m!==void 0)return this.#m;if(this.#_!==void 0||this.#o)return Promise.resolve();if(this.#c!==void 0)return this.#c.response.then(e=>{if(e===void 0)throw this.#u??new DOMException(`Session creation was aborted.`,`AbortError`)});let e=this.#e;if(e===void 0)return Promise.reject(Error(`This eve agent store does not own a session client.`));let t=this.#p,n=new AbortController;this.#h=n;let r=(async()=>{try{let r=await e.sessions.create({signal:n.signal});if(t!==this.#p)return;this.#u=void 0,this.#y===`error`&&(this.#y=`ready`),this.#T(r.session),this.#a&&this.#w()}catch(e){throw t===this.#p&&this.#c===void 0&&this.#u===void 0&&this.#E(e),e}})();this.#m=r;let clear=()=>{this.#m===r&&(this.#m=void 0,this.#h=void 0)};return r.then(clear,clear),r}async send(e){return await this.#b(e,this.#l.prepareSend)}async#b(e,t){if(assertAnswerable(e,this.#r.conversation),this.#c!==void 0){if(this.#y===`resuming`)throw Error(`eve session is resuming.`);return await this.#S(this.#c,e,t)}let n=createActiveTurn(e=>e.acceptedFollowUps>0&&this.#_!==void 0?this.#_.cancel():e.response.then(e=>e===void 0?{status:`no_active_turn`}:e.cancel()));this.#c=n,this.#u=void 0,this.#y=`submitted`;let r,i,a;try{assertExclusiveTurnInput(e),i=this.#f.submit(e,this.#d.length),a=this.#r.projectResponses(e.inputResponses),this.#L();let o=await(t===void 0?e:waitWithSignal(Promise.resolve(t(e)),createAbortSignal(e.signal,n.abortController.signal)));if(assertExclusiveTurnInput(o),!this.#A(n))return;o!==e&&(i=this.#f.resubmit(i,o),a=this.#r.replaceResponses(a,o),this.#L());let s={...o,signal:createAbortSignal(o.signal,n.abortController.signal)},c=await this.#C(s);a=void 0;let l=c.response;if(r=c.reader,!this.#A(n))return;n.resolveResponse(l),this.#N(i,l);for await(let e of consumeMessageResponse(l,r)){if(!this.#A(n))return;n.receivedFollowUps+=n.receivedFollowUpEvents.get(e)??0,n.receivedFollowUpEvents.delete(e)}if(!this.#A(n)||(await followSteeredTurns(n,r,()=>this.#A(n)),!this.#A(n)))return;this.#y=settledStatus(this.#u,this.#r.conversation)}catch(e){if(!this.#A(n))return;if(a?.(),isAbortError(e))this.#y=`ready`,this.#f.fail(toError(e),i);else{let t=this.#u!==void 0;this.#u??=toError(e),this.#y=`error`,this.#f.fail(this.#u,i),t||this.#l.onError?.(this.#u)}}finally{r?.[Symbol.dispose](),this.#k(n)}}resume(){if(this.#g!==void 0)return this.#g;let e=this.#x();this.#g=e;let clear=()=>{this.#g===e&&(this.#g=void 0)};return e.then(clear,clear),e}async#x(){if(this.#y!==`ready`&&this.#y!==`error`)throw Error(`eve session is already processing a turn.`);if(this.#_===void 0)throw Error(`An eve session is required before resuming.`);let e=this.#_,t=createActiveTurn(()=>e.cancel());this.#c=t,t.resolveResponse(void 0),this.#u=void 0,this.#y=`resuming`,this.#L();let n;try{let r=this.#w({catchUp:!0,startIndex:this.#d.length===e.state.streamIndex?e.state.streamIndex:0});if(n=r.subscribe(t.abortController.signal),await r.caughtUp,!this.#A(t))return;n.discard();let i=this.#d.at(-1);if(i!==void 0&&this.#F(i),i&&!this.#u&&!isSettledSessionTail(this.#d,this.#r.conversation)){this.#y=`streaming`,this.#L();for await(let e of n){if(!this.#A(t))return;if(t.receivedFollowUps+=t.receivedFollowUpEvents.get(e)??0,t.receivedFollowUpEvents.delete(e),isResponseBoundary(e,this.#r.conversation))break}}await followSteeredTurns(t,n,()=>this.#A(t)),this.#A(t)&&(this.#y=settledStatus(this.#u,this.#r.conversation))}catch(e){if(!this.#A(t))return;isAbortError(e)?this.#y=`ready`:(this.#u=toError(e),this.#y=`error`,this.#l.onError?.(this.#u))}finally{n?.[Symbol.dispose](),this.#k(t)}}cancel(){let e=this.#c;return e===void 0?this.#y===`streaming`&&this.#_!==void 0?this.#_.cancel():Promise.resolve({status:`no_active_turn`}):e.cancel()}async compact(){return await this.#_?.compact()??{status:`no_active_session`}}async clear(){return await this.#_?.clear()??{status:`no_active_session`}}async retire(){if(this.#o)throw Error(`retire() needs a store-owned session. Call reset() on the session you supplied, then create a new store for the next session.`);let e=await this.#_?.reset()??{status:`no_active_session`};return this.reset(),e}[attachStore](){this.#n=!0,this.#i&&!this.#r.following&&this.#D(),this.#t&&this.#_===void 0&&this.prewarm().catch(()=>{})}[detachStore](){this.#n=!1,this.#r.stop(),this.#c?.abortController.abort(),this.#O(),this.#g=void 0}reset(){this.#r.stop();let e=this.#c;this.#c=void 0,e?.resolveResponse(void 0),e?.resolveCompletion(),e?.abortController.abort(),this.#O(),this.#g=void 0,this.#o||(this.#_=void 0),this.#d=[],this.#r.reset(),this.#f.reset(),this.#i&&this.#n&&this.#D(),this.#u=void 0,this.#y=`ready`,this.#l.onSessionChange?.(this.#_?.state),this.#L(),this.#t&&this.#n&&this.prewarm().catch(()=>{})}async#S(e,t,n){assertInFlightFollowUp(t);let r=this.#p,i=createAbortSignal(t.signal,e.abortController.signal),a=this.#r.projectResponses(t.inputResponses),o=await waitWithSignal(Promise.resolve(n?.(t)),i).then(e=>{let n=validateFollowUp(e??t);return n===t||(a=this.#r.replaceResponses(a,n)),n}).catch(e=>{throw a?.(),e});if(r!==this.#p)return;if(!this.#A(e))return a?.(),await this.#b(o);let s=this.#f.submit(o,this.#d.length,activeTurnForOptimisticFollowUp(this.#d));s!==void 0&&e.followUpSubmissionIds.add(s),this.#L();let c;c=(async()=>{try{let t=createAbortSignal(o.signal,e.abortController.signal);if(await waitWithSignal(e.response,t),!this.#A(e)||this.#_===void 0)throw Error(`The active eve turn ended before the follow-up could be sent.`);this.#w({headers:o.headers,streamReconnectPolicy:o.streamReconnectPolicy});let n=(await dispatchSessionTurn({session:this.#_,turn:{...o,signal:t}})).response;if(a=void 0,o.message===void 0)return;e.acceptedFollowUps+=1,this.#N(s,n)}catch(t){throw this.#A(e)&&(this.#f.fail(toError(t),s),a?.(),this.#L()),t}finally{e.followUpDispatches.delete(c)}})(),e.followUpDispatches.add(c),await c,await e.completion}async#C(e){let t={headers:e.headers,streamReconnectPolicy:e.streamReconnectPolicy};this.#m!==void 0&&(await waitWithSignal(this.#m.catch(e=>{if(this.#_!==void 0)throw e}),e.signal),throwIfAborted(e.signal));let n=this.#_,r;try{let i=await dispatchSessionTurn({client:this.#e,session:n,turn:e,beforeSend:()=>{r=this.#w(t).subscribe(e.signal)}});return i.created&&(this.#T(i.session),r=this.#w(t).subscribe(e.signal)),{response:i.response,reader:r}}catch(e){throw r?.[Symbol.dispose](),e}}#w(e={}){if(this.#_===void 0)throw Error(`A session is required before opening its stream.`);let t=this.#p;return this.#i&&!this.#r.following&&this.#D(),this.#r.stream(this.#_,{...e,onEvent:e=>{t===this.#p&&this.#j(e)},onError:e=>{t===this.#p&&this.#c===void 0&&this.#E(e)}})}#T(e){this.#_=e,this.#i&&this.#n&&this.#D(),this.#l.onSessionChange?.(e.state),this.#L()}#E(e){this.#u=toError(e),this.#y=`error`,this.#l.onError?.(this.#u),this.#L()}#D(){this.#_&&this.#r.follow(this.#_,this.#d)}#O(){this.#p+=1,this.#h?.abort(),this.#h=void 0,this.#m=void 0}#k(e){if(this.#A(e)){e.resolveResponse(void 0),this.#c=void 0,this.#M();try{this.#l.onSessionChange?.(this.#_?.state),this.#L(),this.#l.onFinish?.(this.#v)}finally{e.resolveCompletion()}}}#A(e){return this.#c===e}#j(e){let t=this.#y===`streaming`;if(!this.#r.observe(e,{onAccepted:()=>{this.#d=[...this.#d,e]},project:e=>{this.#P(this.#f.apply(e))},notify:!1}))return!1;this.#l.onEvent?.(e),this.#F(e);let{conversation:n}=this.#r,r=isSettledSessionTail(this.#d,n)&&n.activeTurnId===void 0;return this.#y!==`resuming`&&this.#u===void 0&&(`data`in e&&e.data!==void 0&&`turnId`in e.data&&(this.#y=`streaming`),this.#c===void 0&&r&&(this.#y=`ready`)),this.#l.onSessionChange?.(this.#_?.state),this.#y!==`resuming`&&this.#L(),this.#c===void 0&&t&&r&&this.#l.onFinish?.(this.#v),this.#c===void 0&&this.#M(),!0}#M(){if(this.#a)return;let{conversation:e}=this.#r;e.activeTurnId!==void 0||this.#d.length>0&&!isSettledSessionTail(this.#d,e)||Object.values(e.tasks).some(e=>Object.values(e.calls).some(e=>e.status===`working`))||this.#r.closeStream()}#N(e,t){let n=getMessageResponseDeliveryId(t),r=this.#f.correlate(e,n,this.#d);this.#P(r)&&this.#L()}#P(e){return e!==void 0&&(this.#c!==void 0&&countFollowUpDeliveries(this.#c,e),!0)}#F(e){let t=toTerminalStreamFailureError(e);t!==void 0&&(this.#y=`error`,this.#f.failAll(t),this.#u===void 0&&(this.#u=t,this.#l.onError?.(t)))}#I(){return{data:this.#r.data,conversation:this.#r.conversation,error:this.#u,events:this.#d,session:this.#_?.state,status:this.#y}}#L(){this.#v=this.#I();for(let e of this.#s)e()}};function detachEveAgentStore(e){e[detachStore]()}function attachEveAgentStore(e){e[attachStore]()}export{EveAgentStore,attachEveAgentStore,detachEveAgentStore};
|
|
1
|
+
import{toError}from"#shared/errors.js";import{activeTurnForOptimisticFollowUp,assertAnswerable,assertExclusiveTurnInput,assertInFlightFollowUp,countFollowUpDeliveries,createAbortSignal,createActiveTurn,followSteeredTurns,isAbortError,isResponseBoundary,isSettledSessionTail,settledStatus,toTerminalStreamFailureError,validateFollowUp,waitWithSignal}from"#client/eve-agent-store-helpers.js";import{EveAgentProjection}from"#client/eve-agent-projection.js";import{throwIfAborted}from"#client/abort-signal.js";import{Client}from"#client/client.js";import{consumeMessageResponse,getMessageResponseDeliveryId}from"#client/message-response.js";import{OptimisticMessageSubmissions}from"#client/optimistic-message-submissions.js";import{ConversationClient}from"#client/conversation-client.js";import{dispatchSessionTurn}from"#client/session-turn-dispatch.js";const detachStore=Symbol(`detachEveAgentStore`),attachStore=Symbol(`attachEveAgentStore`);var EveAgentStore=class{#e;#t;#n=!1;#r;#i;#a;#o;#s=new Set;#c;#l={};#u;#d;#f;#p=0;#m;#h;#g;#_;#v;#y=`ready`;constructor(e){this.#t=e.prewarm??!1,this.#i=e.followSubagents??!1,this.#a=e.followIdle??!0,this.#o=e.session!==void 0,this.#e=this.#o?void 0:e.client??new Client({auth:e.auth,headers:e.headers,host:e.host??``}),this.#r=new ConversationClient(new EveAgentProjection(e.reducer,[]),()=>this.#L(),()=>this.#L()),this.#d=(e.initialEvents??[]).filter(e=>this.#r.hydrate(e)),this.#f=new OptimisticMessageSubmissions(this.#r.projections,e.optimistic??!0),this.#_=e.session??(e.initialSession===void 0?void 0:this.#e?.sessions.attach(e.initialSession.sessionId,{streamIndex:e.initialSession.streamIndex})),this.#v=this.#I()}get snapshot(){return this.#v}setCallbacks(e){this.#l=e}subscribe(e){return this.#s.add(e),()=>void this.#s.delete(e)}prewarm(){if(this.#m!==void 0)return this.#m;if(this.#_===void 0&&this.#o)return Promise.resolve();if(this.#c!==void 0&&this.#_===void 0)return this.#c.response.then(e=>{if(e===void 0)throw this.#u??new DOMException(`Session creation was aborted.`,`AbortError`)});let e=this.#e,t=this.#_;if(e===void 0&&t===void 0)return Promise.reject(Error(`This eve agent store does not own a session client.`));let n=this.#p,r=new AbortController;this.#h=r;let i=(async()=>{try{if(t!==void 0){await t.prewarm({signal:r.signal});return}let i=await e.sessions.create({signal:r.signal});if(n!==this.#p)return;this.#u=void 0,this.#y===`error`&&(this.#y=`ready`),this.#T(i.session),this.#a&&this.#w()}catch(e){throw t===void 0&&n===this.#p&&this.#c===void 0&&this.#u===void 0&&this.#E(e),e}})();this.#m=i;let clear=()=>{this.#m===i&&(this.#m=void 0,this.#h=void 0)};return i.then(clear,clear),i}async send(e){return await this.#b(e,this.#l.prepareSend)}async#b(e,t){if(assertAnswerable(e,this.#r.conversation),this.#c!==void 0){if(this.#y===`resuming`)throw Error(`eve session is resuming.`);return await this.#S(this.#c,e,t)}let n=createActiveTurn(e=>e.acceptedFollowUps>0&&this.#_!==void 0?this.#_.cancel():e.response.then(e=>e===void 0?{status:`no_active_turn`}:e.cancel()));this.#c=n,this.#u=void 0,this.#y=`submitted`;let r,i,a;try{assertExclusiveTurnInput(e),i=this.#f.submit(e,this.#d.length),a=this.#r.projectResponses(e.inputResponses),this.#L();let o=await(t===void 0?e:waitWithSignal(Promise.resolve(t(e)),createAbortSignal(e.signal,n.abortController.signal)));if(assertExclusiveTurnInput(o),!this.#A(n))return;o!==e&&(i=this.#f.resubmit(i,o),a=this.#r.replaceResponses(a,o),this.#L());let s={...o,signal:createAbortSignal(o.signal,n.abortController.signal)},c=await this.#C(s);a=void 0;let l=c.response;if(r=c.reader,!this.#A(n))return;n.resolveResponse(l),this.#N(i,l);for await(let e of consumeMessageResponse(l,r)){if(!this.#A(n))return;n.receivedFollowUps+=n.receivedFollowUpEvents.get(e)??0,n.receivedFollowUpEvents.delete(e)}if(!this.#A(n)||(await followSteeredTurns(n,r,()=>this.#A(n)),!this.#A(n)))return;this.#y=settledStatus(this.#u,this.#r.conversation)}catch(e){if(!this.#A(n))return;if(a?.(),isAbortError(e))this.#y=`ready`,this.#f.fail(toError(e),i);else{let t=this.#u!==void 0;this.#u??=toError(e),this.#y=`error`,this.#f.fail(this.#u,i),t||this.#l.onError?.(this.#u)}}finally{r?.[Symbol.dispose](),this.#k(n)}}resume(){if(this.#g!==void 0)return this.#g;let e=this.#x();this.#g=e;let clear=()=>{this.#g===e&&(this.#g=void 0)};return e.then(clear,clear),e}async#x(){if(this.#y!==`ready`&&this.#y!==`error`)throw Error(`eve session is already processing a turn.`);if(this.#_===void 0)throw Error(`An eve session is required before resuming.`);let e=this.#_,t=createActiveTurn(()=>e.cancel());this.#c=t,t.resolveResponse(void 0),this.#u=void 0,this.#y=`resuming`,this.#L();let n;try{let r=this.#w({catchUp:!0,startIndex:this.#d.length===e.state.streamIndex?e.state.streamIndex:0});if(n=r.subscribe(t.abortController.signal),await r.caughtUp,!this.#A(t))return;n.discard();let i=this.#d.at(-1);if(i!==void 0&&this.#F(i),i&&!this.#u&&!isSettledSessionTail(this.#d,this.#r.conversation)){this.#y=`streaming`,this.#L();for await(let e of n){if(!this.#A(t))return;if(t.receivedFollowUps+=t.receivedFollowUpEvents.get(e)??0,t.receivedFollowUpEvents.delete(e),isResponseBoundary(e,this.#r.conversation))break}}await followSteeredTurns(t,n,()=>this.#A(t)),this.#A(t)&&(this.#y=settledStatus(this.#u,this.#r.conversation))}catch(e){if(!this.#A(t))return;isAbortError(e)?this.#y=`ready`:(this.#u=toError(e),this.#y=`error`,this.#l.onError?.(this.#u))}finally{n?.[Symbol.dispose](),this.#k(t)}}cancel(){let e=this.#c;return e===void 0?this.#y===`streaming`&&this.#_!==void 0?this.#_.cancel():Promise.resolve({status:`no_active_turn`}):e.cancel()}async compact(){return await this.#_?.compact()??{status:`no_active_session`}}async clear(){return await this.#_?.clear()??{status:`no_active_session`}}async retire(){if(this.#o)throw Error(`retire() needs a store-owned session. Call reset() on the session you supplied, then create a new store for the next session.`);let e=await this.#_?.reset()??{status:`no_active_session`};return this.reset(),e}[attachStore](){this.#n=!0,this.#i&&!this.#r.following&&this.#D(),this.#t&&this.#_===void 0&&this.prewarm().catch(()=>{})}[detachStore](){this.#n=!1,this.#r.stop(),this.#c?.abortController.abort(),this.#O(),this.#g=void 0}reset(){this.#r.stop();let e=this.#c;this.#c=void 0,e?.resolveResponse(void 0),e?.resolveCompletion(),e?.abortController.abort(),this.#O(),this.#g=void 0,this.#o||(this.#_=void 0),this.#d=[],this.#r.reset(),this.#f.reset(),this.#i&&this.#n&&this.#D(),this.#u=void 0,this.#y=`ready`,this.#l.onSessionChange?.(this.#_?.state),this.#L(),this.#t&&this.#n&&this.prewarm().catch(()=>{})}async#S(e,t,n){assertInFlightFollowUp(t);let r=this.#p,i=createAbortSignal(t.signal,e.abortController.signal),a=this.#r.projectResponses(t.inputResponses),o=await waitWithSignal(Promise.resolve(n?.(t)),i).then(e=>{let n=validateFollowUp(e??t);return n===t||(a=this.#r.replaceResponses(a,n)),n}).catch(e=>{throw a?.(),e});if(r!==this.#p)return;if(!this.#A(e))return a?.(),await this.#b(o);let s=this.#f.submit(o,this.#d.length,activeTurnForOptimisticFollowUp(this.#d));s!==void 0&&e.followUpSubmissionIds.add(s),this.#L();let c;c=(async()=>{try{let t=createAbortSignal(o.signal,e.abortController.signal);if(await waitWithSignal(e.response,t),!this.#A(e)||this.#_===void 0)throw Error(`The active eve turn ended before the follow-up could be sent.`);this.#w({headers:o.headers,streamReconnectPolicy:o.streamReconnectPolicy});let n=(await dispatchSessionTurn({session:this.#_,turn:{...o,signal:t}})).response;if(a=void 0,o.message===void 0)return;e.acceptedFollowUps+=1,this.#N(s,n)}catch(t){throw this.#A(e)&&(this.#f.fail(toError(t),s),a?.(),this.#L()),t}finally{e.followUpDispatches.delete(c)}})(),e.followUpDispatches.add(c),await c,await e.completion}async#C(e){let t={headers:e.headers,streamReconnectPolicy:e.streamReconnectPolicy};this.#_===void 0&&this.#m!==void 0&&(await waitWithSignal(this.#m.catch(e=>{if(this.#_!==void 0)throw e}),e.signal),throwIfAborted(e.signal));let n=this.#_,r;try{let i=await dispatchSessionTurn({client:this.#e,session:n,turn:e,beforeSend:()=>{r=this.#w(t).subscribe(e.signal)}});return i.created&&(this.#T(i.session),r=this.#w(t).subscribe(e.signal)),{response:i.response,reader:r}}catch(e){throw r?.[Symbol.dispose](),e}}#w(e={}){if(this.#_===void 0)throw Error(`A session is required before opening its stream.`);let t=this.#p;return this.#i&&!this.#r.following&&this.#D(),this.#r.stream(this.#_,{...e,onEvent:e=>{t===this.#p&&this.#j(e)},onError:e=>{t===this.#p&&this.#c===void 0&&this.#E(e)}})}#T(e){this.#_=e,this.#i&&this.#n&&this.#D(),this.#l.onSessionChange?.(e.state),this.#L()}#E(e){this.#u=toError(e),this.#y=`error`,this.#l.onError?.(this.#u),this.#L()}#D(){this.#_&&this.#r.follow(this.#_,this.#d)}#O(){this.#p+=1,this.#h?.abort(),this.#h=void 0,this.#m=void 0}#k(e){if(this.#A(e)){e.resolveResponse(void 0),this.#c=void 0,this.#M();try{this.#l.onSessionChange?.(this.#_?.state),this.#L(),this.#l.onFinish?.(this.#v)}finally{e.resolveCompletion()}}}#A(e){return this.#c===e}#j(e){let t=this.#y===`streaming`;if(!this.#r.observe(e,{onAccepted:()=>{this.#d=[...this.#d,e]},project:e=>{this.#P(this.#f.apply(e))},notify:!1}))return!1;this.#l.onEvent?.(e),this.#F(e);let{conversation:n}=this.#r,r=isSettledSessionTail(this.#d,n)&&n.activeTurnId===void 0;return this.#y!==`resuming`&&this.#u===void 0&&(`data`in e&&e.data!==void 0&&`turnId`in e.data&&(this.#y=`streaming`),this.#c===void 0&&r&&(this.#y=`ready`)),this.#l.onSessionChange?.(this.#_?.state),this.#y!==`resuming`&&this.#L(),this.#c===void 0&&t&&r&&this.#l.onFinish?.(this.#v),this.#c===void 0&&this.#M(),!0}#M(){if(this.#a)return;let{conversation:e}=this.#r;e.activeTurnId!==void 0||this.#d.length>0&&!isSettledSessionTail(this.#d,e)||Object.values(e.tasks).some(e=>Object.values(e.calls).some(e=>e.status===`working`))||this.#r.closeStream()}#N(e,t){let n=getMessageResponseDeliveryId(t),r=this.#f.correlate(e,n,this.#d);this.#P(r)&&this.#L()}#P(e){return e!==void 0&&(this.#c!==void 0&&countFollowUpDeliveries(this.#c,e),!0)}#F(e){let t=toTerminalStreamFailureError(e);t!==void 0&&(this.#y=`error`,this.#f.failAll(t),this.#u===void 0&&(this.#u=t,this.#l.onError?.(t)))}#I(){return{data:this.#r.data,conversation:this.#r.conversation,error:this.#u,events:this.#d,session:this.#_?.state,status:this.#y}}#L(){this.#v=this.#I();for(let e of this.#s)e()}};function detachEveAgentStore(e){e[detachStore]()}function attachEveAgentStore(e){e[attachStore]()}export{EveAgentStore,attachEveAgentStore,detachEveAgentStore};
|
|
@@ -12,6 +12,7 @@ export type { AgentObservation, ConversationAgentSession, ConversationInput, Con
|
|
|
12
12
|
export { createDataUrlFilePart, createTextWithFileContent } from "#client/file-parts.js";
|
|
13
13
|
export { MessageResponse } from "#client/message-response.js";
|
|
14
14
|
export { ClientAgentSession } from "#client/agent-session.js";
|
|
15
|
+
export type { PrewarmSessionResult } from "#protocol/prewarm-session.js";
|
|
15
16
|
export { ClientSession } from "#client/session.js";
|
|
16
17
|
export { ClientSessions, type CreatedClientSession, type CreatedIdleClientSession, } from "#client/sessions.js";
|
|
17
18
|
export type { EveAgentStoreCallbacks, EveAgentStoreInit, EveAgentStoreSnapshot, EveAgentStoreStatus, PrepareSend, } from "#client/eve-agent-store.js";
|
|
@@ -1,9 +1,15 @@
|
|
|
1
|
+
import { type PrewarmSessionResult } from "#protocol/prewarm-session.js";
|
|
1
2
|
import type { CancelSessionResult, ClearResult, ClientRedirectPolicy, CompactResult, ResetResult } from "#client/types.js";
|
|
2
3
|
interface SessionControlContext {
|
|
3
4
|
readonly host: string;
|
|
4
5
|
readonly redirect?: ClientRedirectPolicy;
|
|
5
6
|
resolveHeaders(): Promise<Headers>;
|
|
6
7
|
}
|
|
8
|
+
export declare function prewarmClientSession(input: {
|
|
9
|
+
readonly context: SessionControlContext;
|
|
10
|
+
readonly sessionId: string;
|
|
11
|
+
readonly signal?: AbortSignal;
|
|
12
|
+
}): Promise<PrewarmSessionResult>;
|
|
7
13
|
export declare function cancelClientSession(input: {
|
|
8
14
|
readonly context: SessionControlContext;
|
|
9
15
|
readonly options?: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{createEveSessionCancelRoutePath,createEveSessionClearRoutePath,createEveSessionCompactRoutePath,createEveSessionResetRoutePath}from"#protocol/routes.js";import{createClientError}from"#client/client-error.js";import{createClientUrl}from"#client/url.js";import{CancelTurnResponseSchema}from"#protocol/cancel-turn.js";import{ClearResponseSchema}from"#protocol/clear-session.js";import{CompactResponseSchema}from"#protocol/compact-session.js";import{ResetResponseSchema}from"#protocol/reset-session.js";async function cancelClientSession(e){let{signal:t,...n}=e.options??{},{payload:r,response:i}=await postJson({body:n,context:e.context,operation:`Cancel`,path:createEveSessionCancelRoutePath(e.sessionId),signal:t}),a=CancelTurnResponseSchema.safeParse(r);if(!a.success||a.data.status===`accepted`&&a.data.sessionId!==e.sessionId)throw Error(`Cancel route returned an invalid response (${i.status}).`);return a.data.status===`accepted`?{sessionId:a.data.sessionId,status:`accepted`}:{status:`no_active_turn`}}async function clearClientSession(e){let{payload:t}=await postJson({context:e.context,operation:`Clear`,path:createEveSessionClearRoutePath(e.sessionId)}),n=ClearResponseSchema.safeParse(t);if(!n.success||n.data.status===`accepted`&&n.data.sessionId!==e.sessionId)throw Error(`Clear route returned an invalid response.`);return n.data.status===`accepted`?{sessionId:n.data.sessionId,status:`accepted`}:{status:`no_active_session`}}async function compactClientSession(e){let{payload:t}=await postJson({context:e.context,operation:`Compact`,path:createEveSessionCompactRoutePath(e.sessionId)}),n=CompactResponseSchema.safeParse(t);if(!n.success||n.data.status===`accepted`&&n.data.sessionId!==e.sessionId)throw Error(`Compact route returned an invalid response.`);return n.data.status===`accepted`?{sessionId:n.data.sessionId,status:`accepted`}:{status:`no_active_session`}}async function resetClientSession(e){let{signal:t,...n}=e.options??{},{payload:r}=await postJson({body:n,context:e.context,operation:`Reset`,path:createEveSessionResetRoutePath(e.sessionId),signal:t}),i=ResetResponseSchema.safeParse(r);if(!i.success||i.data.status===`reset`&&i.data.previousSessionId!==e.sessionId)throw Error(`Reset route returned an invalid response.`);return i.data.status===`reset`?{previousSessionId:i.data.previousSessionId,status:`reset`}:{status:`no_active_session`}}async function postJson(e){let t=await e.context.resolveHeaders();t.set(`content-type`,`application/json`);let n=await fetch(createClientUrl(e.context.host,e.path),withRedirectPolicy({body:e.body===void 0?void 0:JSON.stringify(e.body),headers:t,method:`POST`,signal:e.signal},e.context.redirect)),r=await n.text();if(!n.ok)throw createClientError(n.status,r,n.headers);try{return{payload:JSON.parse(r),response:n}}catch{throw Error(`${e.operation} route returned invalid JSON (${n.status}).`)}}function withRedirectPolicy(e,t){return t===void 0?e:{...e,redirect:t}}export{cancelClientSession,clearClientSession,compactClientSession,resetClientSession};
|
|
1
|
+
import{createEveSessionCancelRoutePath,createEveSessionClearRoutePath,createEveSessionCompactRoutePath,createEveSessionResetRoutePath,createEveSessionRoutePath}from"#protocol/routes.js";import{createClientError}from"#client/client-error.js";import{createClientUrl}from"#client/url.js";import{PrewarmResponseSchema}from"#protocol/prewarm-session.js";import{CancelTurnResponseSchema}from"#protocol/cancel-turn.js";import{ClearResponseSchema}from"#protocol/clear-session.js";import{CompactResponseSchema}from"#protocol/compact-session.js";import{ResetResponseSchema}from"#protocol/reset-session.js";async function prewarmClientSession(e){let{payload:t}=await postJson({context:e.context,operation:`Prewarm`,path:createEveSessionRoutePath(e.sessionId),signal:e.signal}),n=PrewarmResponseSchema.safeParse(t);if(!n.success)throw Error(`Prewarm route returned an invalid response.`);return{status:n.data.status}}async function cancelClientSession(e){let{signal:t,...n}=e.options??{},{payload:r,response:i}=await postJson({body:n,context:e.context,operation:`Cancel`,path:createEveSessionCancelRoutePath(e.sessionId),signal:t}),a=CancelTurnResponseSchema.safeParse(r);if(!a.success||a.data.status===`accepted`&&a.data.sessionId!==e.sessionId)throw Error(`Cancel route returned an invalid response (${i.status}).`);return a.data.status===`accepted`?{sessionId:a.data.sessionId,status:`accepted`}:{status:`no_active_turn`}}async function clearClientSession(e){let{payload:t}=await postJson({context:e.context,operation:`Clear`,path:createEveSessionClearRoutePath(e.sessionId)}),n=ClearResponseSchema.safeParse(t);if(!n.success||n.data.status===`accepted`&&n.data.sessionId!==e.sessionId)throw Error(`Clear route returned an invalid response.`);return n.data.status===`accepted`?{sessionId:n.data.sessionId,status:`accepted`}:{status:`no_active_session`}}async function compactClientSession(e){let{payload:t}=await postJson({context:e.context,operation:`Compact`,path:createEveSessionCompactRoutePath(e.sessionId)}),n=CompactResponseSchema.safeParse(t);if(!n.success||n.data.status===`accepted`&&n.data.sessionId!==e.sessionId)throw Error(`Compact route returned an invalid response.`);return n.data.status===`accepted`?{sessionId:n.data.sessionId,status:`accepted`}:{status:`no_active_session`}}async function resetClientSession(e){let{signal:t,...n}=e.options??{},{payload:r}=await postJson({body:n,context:e.context,operation:`Reset`,path:createEveSessionResetRoutePath(e.sessionId),signal:t}),i=ResetResponseSchema.safeParse(r);if(!i.success||i.data.status===`reset`&&i.data.previousSessionId!==e.sessionId)throw Error(`Reset route returned an invalid response.`);return i.data.status===`reset`?{previousSessionId:i.data.previousSessionId,status:`reset`}:{status:`no_active_session`}}async function postJson(e){let t=await e.context.resolveHeaders();t.set(`content-type`,`application/json`);let n=await fetch(createClientUrl(e.context.host,e.path),withRedirectPolicy({body:e.body===void 0?void 0:JSON.stringify(e.body),headers:t,method:`POST`,signal:e.signal},e.context.redirect)),r=await n.text();if(!n.ok)throw createClientError(n.status,r,n.headers);try{return{payload:JSON.parse(r),response:n}}catch{throw Error(`${e.operation} route returned invalid JSON (${n.status}).`)}}function withRedirectPolicy(e,t){return t===void 0?e:{...e,redirect:t}}export{cancelClientSession,clearClientSession,compactClientSession,prewarmClientSession,resetClientSession};
|
|
@@ -41,6 +41,10 @@ export declare class ClientSession {
|
|
|
41
41
|
send<TOutput = unknown>(message: SendTurnInput<TOutput>["message"], options?: SendTurnOptions<TOutput>): Promise<MessageResponse<TOutput>>;
|
|
42
42
|
/** Answers pending input requests on this exact session ID. */
|
|
43
43
|
respond<TOutput = unknown>(inputResponses: readonly InputResponse[], options?: RespondTurnOptions<TOutput>): Promise<MessageResponse<TOutput>>;
|
|
44
|
+
/** Requests preparation of an existing idle session; never starts a model turn. */
|
|
45
|
+
prewarm(options?: {
|
|
46
|
+
readonly signal?: AbortSignal;
|
|
47
|
+
}): Promise<import("#protocol/prewarm-session.js").PrewarmSessionResult>;
|
|
44
48
|
/** Requests cooperative cancellation of this session's active turn. */
|
|
45
49
|
cancel(options?: {
|
|
46
50
|
readonly signal?: AbortSignal;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{EVE_SESSION_ROUTE_PATH,createEveSessionRoutePath,createEveSessionStreamRoutePath}from"#protocol/routes.js";import{ClientError,createClientError}from"#client/client-error.js";import{TurnSegment}from"#client/session-utils.js";import{EVE_SESSION_ID_HEADER}from"#protocol/message.js";import{followStreamIterable,sleep}from"#client/open-stream.js";import{createClientUrl}from"#client/url.js";import{throwIfAborted}from"#client/abort-signal.js";import{MessageResponse}from"#client/message-response.js";import{ClientAgentSession}from"#client/agent-session.js";import{cancelClientSession,clearClientSession,compactClientSession,resetClientSession}from"#client/session-controls.js";import{serializeOutputSchema}from"#tools/schema.js";const followSession=Symbol(`followClientSession`);var ClientSession=class ClientSession{#e;#t;constructor(e,t){this.#e=e,this.#t=t}static async create(e,t){let n=await postTurn(e,EVE_SESSION_ROUTE_PATH,t,!0,t.stubs),{sessionId:r}=await readAcceptedMessage(n),i=new ClientSession(e,{sessionId:r,streamIndex:0});return{response:i.#r(n,t,0),session:i}}static async prewarm(e,t={}){let{sessionId:n}=await readAcceptedMessage(await postCreateSession(e,t));return new ClientSession(e,{sessionId:n,streamIndex:0})}get state(){return this.#t}async snapshot(e){throwIfAborted(e?.signal);let t=[];for await(let n of this.#s({follow:!1,signal:e?.signal,startIndex:0}))t.push(n);return throwIfAborted(e?.signal),{events:t,session:{sessionId:this.#t.sessionId,streamIndex:t.length}}}async send(e,t={}){return await this.#n({...t,message:e},!0)}async respond(e,t={}){if(e.length===0)throw Error(`ClientSession.respond() requires at least one input response.`);return await this.#n({...t,inputResponses:e},!1)}async#n(e,t){let n=this.#t.streamIndex,r=createEveSessionRoutePath(this.#t.sessionId),i=t?await postSessionSend(this.#e,r,e):await postTurn(this.#e,r,e,!1),{sessionId:a,deliveryId:o}=await readAcceptedMessage(i,this.#t.sessionId);if(a!==this.#t.sessionId)throw Error(`Message route returned a different session id.`);if(e.message!==void 0&&o===void 0)throw Error(`Message route did not return a delivery id. Update the server before sending with this client.`);return this.#r(i,e,n,e.message===void 0?void 0:o)}async cancel(e){return await cancelClientSession({context:this.#e,options:e,sessionId:this.#t.sessionId})}async clear(){return await clearClientSession({context:this.#e,sessionId:this.#t.sessionId})}async compact(){return await compactClientSession({context:this.#e,sessionId:this.#t.sessionId})}async reset(e){return await resetClientSession({context:this.#e,options:e,sessionId:this.#t.sessionId})}stream(e){if(e?.follow===!1&&(e.startIndex??this.#t.streamIndex)<0)throw Error(`stream({ follow: false }) requires a nonnegative startIndex; a tail-relative cursor cannot be bounded.`);return this.#a(e)}agent(e){return new ClientAgentSession(this.#e,e)}[followSession](e){return this.#a({...e,keepAlive:!0})}#r(e,t,n,r){return e.body?.cancel().catch(()=>{}),new MessageResponse({cancelTurn:async e=>await this.cancel({turnId:e}),createStream:e=>this.#i(n,t,r,e),deliveryId:r,resumesTurn:t.inputResponses!==void 0,sessionId:this.#t.sessionId})}async*#i(e,t,n,r){let i=0,a=n===void 0,o=!1,s=new TurnSegment({followCallbacks:!0});try{for await(let c of r??this.#s({headers:t.headers,keepAlive:!0,signal:t.signal,startIndex:e,streamReconnectPolicy:t.streamReconnectPolicy})){if(i+=1,n!==void 0){let e=c.meta?.deliveryIds?.includes(n)===!0,t=c.type===`session.failed`||c.type===`session.completed`;if(!e&&t&&(!a||c.type===`session.completed`))throw Error(`The session ended before the accepted message reached its turn boundary.`);if(!a&&!e)continue;let r=c.meta?.deliveryIds!==void 0;if(!t&&r&&!e)continue;a=!0}if(o=s.observe(c),yield c,o)break}if(n!==void 0&&!o&&!t.signal?.aborted)throw Error(`The response stream ended before the accepted message reached its turn boundary.`)}finally{this.#o(e+i)}}async*#a(e){let t=e?.startIndex??this.#t.streamIndex,n=0;for await(let r of this.#s({follow:e?.follow,headers:e?.headers,keepAlive:e?.keepAlive,onCaughtUp:e?.onCaughtUp,resolveHeaders:e?.resolveHeaders,resolveReconnectPolicy:e?.resolveReconnectPolicy,signal:e?.signal,startIndex:t,streamReconnectPolicy:e?.streamReconnectPolicy}))n+=1,t>=0&&this.#o(t+n),yield r}#o(e){this.#t={sessionId:this.#t.sessionId,streamIndex:Math.max(this.#t.streamIndex,e)}}#s(e){return followStreamIterable({onCaughtUp:e.onCaughtUp,follow:e.follow,host:this.#e.host,keepAlive:e.keepAlive,resolveHeaders:()=>this.#e.resolveHeaders(e.resolveHeaders?.()??e.headers),path:createEveSessionStreamRoutePath(this.#t.sessionId),redirect:this.#e.redirect,signal:e.signal,startIndex:e.startIndex,streamReconnectPolicy:e.streamReconnectPolicy,resolveReconnectPolicy:e.resolveReconnectPolicy})}};function followClientSession(e,t){return e[followSession](t)}async function postSessionSend(e,t,n){let r=Date.now()+2e4,i=250;for(;;){try{return await postTurn(e,t,n,!1)}catch(e){if(!isSessionNotReady(e))throw e;let t=r-Date.now();if(t<=0)throw e;await sleep(Math.min(i,t),n.signal)}throwIfAborted(n.signal),i=Math.min(i*2,2e3)}}async function postCreateSession(e,t){let n=await e.resolveHeaders(t.headers),r=t.stubs===void 0?void 0:JSON.stringify({stubs:t.stubs});r!==void 0&&n.set(`content-type`,`application/json`);let i=await fetch(createClientUrl(e.host,EVE_SESSION_ROUTE_PATH),{body:r,headers:n,method:`POST`,redirect:e.redirect,signal:t.signal??null});if(!i.ok){let e=await i.text();throw new ClientError(i.status,e,i.headers)}return i}function isSessionNotReady(e){return e instanceof ClientError&&e.status===409&&e.code===`session_not_ready`}async function postTurn(e,t,n,r,i){let a=createMessageBody(n,r);if(a===null)throw Error(r?`Creating a session requires a non-empty message.`:`A session turn requires a non-empty message or inputResponses.`);i!==void 0&&(a.stubs=i);let o=await e.resolveHeaders(n.headers);o.set(`content-type`,`application/json`);let s=await fetch(createClientUrl(e.host,t),{body:JSON.stringify(a),headers:o,method:`POST`,redirect:e.redirect,signal:n.signal??null});if(!s.ok){let e=await s.text();throw createClientError(s.status,e,s.headers)}return s}async function readAcceptedMessage(e,t){let n=await e.json(),r=(typeof n.sessionId==`string`?n.sessionId:void 0)??e.headers.get(EVE_SESSION_ID_HEADER)?.trim()??t;if(!r)throw Error(`Message route did not return a session id.`);return{sessionId:r,deliveryId:typeof n.deliveryId==`string`&&n.deliveryId.length>0?n.deliveryId:void 0}}function createMessageBody(e,t){let n={};e.message!==void 0&&(n.message=e.message),e.inputResponses!==void 0&&e.inputResponses.length>0&&(n.inputResponses=e.inputResponses),!t&&e.message!==void 0&&e.turnPolicy!==void 0&&(n.turnPolicy=e.turnPolicy),e.clientContext!==void 0&&(n.clientContext=e.clientContext);let r=serializeOutputSchema(e.outputSchema);return r!==void 0&&(n.outputSchema=r),t&&n.message===void 0||n.message===void 0&&n.inputResponses===void 0?null:n}export{ClientSession,followClientSession};
|
|
1
|
+
import{EVE_SESSION_ROUTE_PATH,createEveSessionRoutePath,createEveSessionStreamRoutePath}from"#protocol/routes.js";import{ClientError,createClientError}from"#client/client-error.js";import{TurnSegment}from"#client/session-utils.js";import{EVE_SESSION_ID_HEADER}from"#protocol/message.js";import{followStreamIterable,sleep}from"#client/open-stream.js";import{createClientUrl}from"#client/url.js";import{throwIfAborted}from"#client/abort-signal.js";import{MessageResponse}from"#client/message-response.js";import{ClientAgentSession}from"#client/agent-session.js";import{cancelClientSession,clearClientSession,compactClientSession,prewarmClientSession,resetClientSession}from"#client/session-controls.js";import{serializeOutputSchema}from"#tools/schema.js";const followSession=Symbol(`followClientSession`);var ClientSession=class ClientSession{#e;#t;constructor(e,t){this.#e=e,this.#t=t}static async create(e,t){let n=await postTurn(e,EVE_SESSION_ROUTE_PATH,t,!0,t.stubs),{sessionId:r}=await readAcceptedMessage(n),i=new ClientSession(e,{sessionId:r,streamIndex:0});return{response:i.#r(n,t,0),session:i}}static async prewarm(e,t={}){let{sessionId:n}=await readAcceptedMessage(await postCreateSession(e,t));return new ClientSession(e,{sessionId:n,streamIndex:0})}get state(){return this.#t}async snapshot(e){throwIfAborted(e?.signal);let t=[];for await(let n of this.#s({follow:!1,signal:e?.signal,startIndex:0}))t.push(n);return throwIfAborted(e?.signal),{events:t,session:{sessionId:this.#t.sessionId,streamIndex:t.length}}}async send(e,t={}){return await this.#n({...t,message:e},!0)}async respond(e,t={}){if(e.length===0)throw Error(`ClientSession.respond() requires at least one input response.`);return await this.#n({...t,inputResponses:e},!1)}async#n(e,t){let n=this.#t.streamIndex,r=createEveSessionRoutePath(this.#t.sessionId),i=t?await postSessionSend(this.#e,r,e):await postTurn(this.#e,r,e,!1),{sessionId:a,deliveryId:o}=await readAcceptedMessage(i,this.#t.sessionId);if(a!==this.#t.sessionId)throw Error(`Message route returned a different session id.`);if(e.message!==void 0&&o===void 0)throw Error(`Message route did not return a delivery id. Update the server before sending with this client.`);return this.#r(i,e,n,e.message===void 0?void 0:o)}async prewarm(e){return await prewarmClientSession({context:this.#e,sessionId:this.#t.sessionId,signal:e?.signal})}async cancel(e){return await cancelClientSession({context:this.#e,options:e,sessionId:this.#t.sessionId})}async clear(){return await clearClientSession({context:this.#e,sessionId:this.#t.sessionId})}async compact(){return await compactClientSession({context:this.#e,sessionId:this.#t.sessionId})}async reset(e){return await resetClientSession({context:this.#e,options:e,sessionId:this.#t.sessionId})}stream(e){if(e?.follow===!1&&(e.startIndex??this.#t.streamIndex)<0)throw Error(`stream({ follow: false }) requires a nonnegative startIndex; a tail-relative cursor cannot be bounded.`);return this.#a(e)}agent(e){return new ClientAgentSession(this.#e,e)}[followSession](e){return this.#a({...e,keepAlive:!0})}#r(e,t,n,r){return e.body?.cancel().catch(()=>{}),new MessageResponse({cancelTurn:async e=>await this.cancel({turnId:e}),createStream:e=>this.#i(n,t,r,e),deliveryId:r,resumesTurn:t.inputResponses!==void 0,sessionId:this.#t.sessionId})}async*#i(e,t,n,r){let i=0,a=n===void 0,o=!1,s=new TurnSegment({followCallbacks:!0});try{for await(let c of r??this.#s({headers:t.headers,keepAlive:!0,signal:t.signal,startIndex:e,streamReconnectPolicy:t.streamReconnectPolicy})){if(i+=1,n!==void 0){let e=c.meta?.deliveryIds?.includes(n)===!0,t=c.type===`session.failed`||c.type===`session.completed`;if(!e&&t&&(!a||c.type===`session.completed`))throw Error(`The session ended before the accepted message reached its turn boundary.`);if(!a&&!e)continue;let r=c.meta?.deliveryIds!==void 0;if(!t&&r&&!e)continue;a=!0}if(o=s.observe(c),yield c,o)break}if(n!==void 0&&!o&&!t.signal?.aborted)throw Error(`The response stream ended before the accepted message reached its turn boundary.`)}finally{this.#o(e+i)}}async*#a(e){let t=e?.startIndex??this.#t.streamIndex,n=0;for await(let r of this.#s({follow:e?.follow,headers:e?.headers,keepAlive:e?.keepAlive,onCaughtUp:e?.onCaughtUp,resolveHeaders:e?.resolveHeaders,resolveReconnectPolicy:e?.resolveReconnectPolicy,signal:e?.signal,startIndex:t,streamReconnectPolicy:e?.streamReconnectPolicy}))n+=1,t>=0&&this.#o(t+n),yield r}#o(e){this.#t={sessionId:this.#t.sessionId,streamIndex:Math.max(this.#t.streamIndex,e)}}#s(e){return followStreamIterable({onCaughtUp:e.onCaughtUp,follow:e.follow,host:this.#e.host,keepAlive:e.keepAlive,resolveHeaders:()=>this.#e.resolveHeaders(e.resolveHeaders?.()??e.headers),path:createEveSessionStreamRoutePath(this.#t.sessionId),redirect:this.#e.redirect,signal:e.signal,startIndex:e.startIndex,streamReconnectPolicy:e.streamReconnectPolicy,resolveReconnectPolicy:e.resolveReconnectPolicy})}};function followClientSession(e,t){return e[followSession](t)}async function postSessionSend(e,t,n){let r=Date.now()+2e4,i=250;for(;;){try{return await postTurn(e,t,n,!1)}catch(e){if(!isSessionNotReady(e))throw e;let t=r-Date.now();if(t<=0)throw e;await sleep(Math.min(i,t),n.signal)}throwIfAborted(n.signal),i=Math.min(i*2,2e3)}}async function postCreateSession(e,t){let n=await e.resolveHeaders(t.headers),r=t.stubs===void 0?void 0:JSON.stringify({stubs:t.stubs});r!==void 0&&n.set(`content-type`,`application/json`);let i=await fetch(createClientUrl(e.host,EVE_SESSION_ROUTE_PATH),{body:r,headers:n,method:`POST`,redirect:e.redirect,signal:t.signal??null});if(!i.ok){let e=await i.text();throw new ClientError(i.status,e,i.headers)}return i}function isSessionNotReady(e){return e instanceof ClientError&&e.status===409&&e.code===`session_not_ready`}async function postTurn(e,t,n,r,i){let a=createMessageBody(n,r);if(a===null)throw Error(r?`Creating a session requires a non-empty message.`:`A session turn requires a non-empty message or inputResponses.`);i!==void 0&&(a.stubs=i);let o=await e.resolveHeaders(n.headers);o.set(`content-type`,`application/json`);let s=await fetch(createClientUrl(e.host,t),{body:JSON.stringify(a),headers:o,method:`POST`,redirect:e.redirect,signal:n.signal??null});if(!s.ok){let e=await s.text();throw createClientError(s.status,e,s.headers)}return s}async function readAcceptedMessage(e,t){let n=await e.json(),r=(typeof n.sessionId==`string`?n.sessionId:void 0)??e.headers.get(EVE_SESSION_ID_HEADER)?.trim()??t;if(!r)throw Error(`Message route did not return a session id.`);return{sessionId:r,deliveryId:typeof n.deliveryId==`string`&&n.deliveryId.length>0?n.deliveryId:void 0}}function createMessageBody(e,t){let n={};e.message!==void 0&&(n.message=e.message),e.inputResponses!==void 0&&e.inputResponses.length>0&&(n.inputResponses=e.inputResponses),!t&&e.message!==void 0&&e.turnPolicy!==void 0&&(n.turnPolicy=e.turnPolicy),e.clientContext!==void 0&&(n.clientContext=e.clientContext);let r=serializeOutputSchema(e.outputSchema);return r!==void 0&&(n.outputSchema=r),t&&n.message===void 0||n.message===void 0&&n.inputResponses===void 0?null:n}export{ClientSession,followClientSession};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"moduleFingerprints": {
|
|
3
|
-
"@eve/catalog": "
|
|
3
|
+
"@eve/catalog": "c1311c1420a1d2c475448db7956763f0eafbda990efe6c050d39fa9ee8b68a58",
|
|
4
4
|
"just-secrets": "1ce67d437d0bb06df02e4e99180a3c5f5edf0010314010226e97b96d462bba5d",
|
|
5
5
|
"@vercel/agent-runs": "94231f05d03adf6e62c1c56a941d763e7ed8a25a7c2f3c17a920f68225319325",
|
|
6
6
|
"@workflow/world-local": "a10e78551f65fc607cf75261a569d852c40bc9cfac13a7fb6e15c88bf1ccf429"
|
|
@@ -9,7 +9,6 @@
|
|
|
9
9
|
"@agentclientprotocol/sdk": "1.3.0",
|
|
10
10
|
"@ai-sdk/anthropic": "4.0.78",
|
|
11
11
|
"@cfworker/json-schema": "4.1.1",
|
|
12
|
-
"@ai-sdk/code-mode": "1.0.94",
|
|
13
12
|
"chat": "4.42.0",
|
|
14
13
|
"@chat-adapter/slack": "4.42.0",
|
|
15
14
|
"@chat-adapter/state-memory": "4.42.0",
|
|
@@ -38,6 +37,7 @@
|
|
|
38
37
|
"picocolors": "1.1.1",
|
|
39
38
|
"@ai-sdk/provider": "4.0.26",
|
|
40
39
|
"@ai-sdk/provider-utils": "5.0.58",
|
|
40
|
+
"run": "2.1.8",
|
|
41
41
|
"semver": "7.8.4",
|
|
42
42
|
"@shadcn/registry": "0.1.3",
|
|
43
43
|
"@standard-schema/spec": "1.1.0",
|
|
@@ -52,16 +52,16 @@
|
|
|
52
52
|
"@vercel/sandbox": "3.3.0",
|
|
53
53
|
"@vercel/sdk": "1.28.8",
|
|
54
54
|
"@vercel/schedules": "0.0.0-alpha.11",
|
|
55
|
-
"@workflow/core": "5.2.
|
|
56
|
-
"@workflow/errors": "5.0.
|
|
55
|
+
"@workflow/core": "5.2.3",
|
|
56
|
+
"@workflow/errors": "5.0.5",
|
|
57
57
|
"@workflow/serde": "5.0.0",
|
|
58
|
-
"@workflow/world": "5.0.
|
|
59
|
-
"@workflow/world-local": "5.1.
|
|
60
|
-
"@workflow/world-vercel": "5.2.
|
|
58
|
+
"@workflow/world": "5.0.5",
|
|
59
|
+
"@workflow/world-local": "5.1.2",
|
|
60
|
+
"@workflow/world-vercel": "5.2.3",
|
|
61
61
|
"zod": "4.5.4",
|
|
62
62
|
"zod-validation-error": "5.0.0"
|
|
63
63
|
},
|
|
64
|
-
"scriptHash": "
|
|
64
|
+
"scriptHash": "e2d7091001b88f60679e1c4e5f30a7bf18dc36281ca6edcc8a77a41dfd4614d7",
|
|
65
65
|
"toolVersions": {
|
|
66
66
|
"rolldown": "1.2.9",
|
|
67
67
|
"typescript": "7.0.2"
|
|
@@ -1 +1 @@
|
|
|
1
|
-
function e(e){return[e.mcp?`mcp`:null,e.openapi?`openapi`:null].filter(e=>e!==null)}const t=[{slug:`eve`,name:`Web Chat`,kind:`channel`,tagline:`Embed a first-party web chat UI backed by your agent.`,surfaces:{scaffoldable:!0,registry:!0,gallery:!0}},{slug:`slack`,name:`Slack`,kind:`channel`,tagline:`Mention your agent in channels and DMs, with Connect-managed auth.`,surfaces:{scaffoldable:!0,registry:!0,gallery:!0}},{slug:`discord`,name:`Discord`,kind:`channel`,tagline:`Run your agent as a Discord bot across servers and threads.`,surfaces:{scaffoldable:!1,registry:!0,gallery:!0}},{slug:`teams`,name:`Microsoft Teams`,kind:`channel`,tagline:`Bring your agent into Teams chats and channels.`,surfaces:{scaffoldable:!1,registry:!0,gallery:!0}},{slug:`telegram`,name:`Telegram`,kind:`channel`,tagline:`Connect your agent to a Telegram bot for 1:1 and group chats.`,surfaces:{scaffoldable:!1,registry:!0,gallery:!0}},{slug:`twilio`,name:`Twilio`,kind:`channel`,tagline:`Put your agent on a phone number: SMS and speech-transcribed calls.`,surfaces:{scaffoldable:!1,registry:!0,gallery:!0}},{slug:`blooio`,name:`Blooio`,kind:`channel`,tagline:`Send and receive iMessage, RCS, and SMS through Blooio.`,surfaces:{scaffoldable:!1,registry:!0,gallery:!0}},{slug:`github`,name:`GitHub`,kind:`channel`,tagline:`Drive your agent from issues, pull requests, and comments, with guided Connect setup.`,surfaces:{scaffoldable:!1,registry:!0,gallery:!0}},{slug:`linear-agent`,name:`Linear Agent`,kind:`channel`,tagline:`Delegate Linear issues and comments through Agent Sessions, with guided Connect setup.`,surfaces:{scaffoldable:!1,registry:!0,gallery:!0}},{slug:`chat-sdk-gchat`,name:`Google Chat`,kind:`channel`,tagline:`Google Chat spaces and DMs via the Chat SDK.`,surfaces:{scaffoldable:!1,registry:!0,gallery:!0}},{slug:`chat-sdk-whatsapp`,name:`WhatsApp`,kind:`channel`,tagline:`Customer messaging through WhatsApp Business Cloud via the Chat SDK.`,surfaces:{scaffoldable:!1,registry:!0,gallery:!0}},{slug:`chat-sdk-x`,name:`X`,kind:`channel`,tagline:`Public mentions and DMs on X via the Chat SDK.`,surfaces:{scaffoldable:!1,registry:!0,gallery:!0}},{slug:`chat-sdk-messenger`,name:`Messenger`,kind:`channel`,tagline:`Facebook Messenger bots with templates, buttons, and reactions via the Chat SDK.`,surfaces:{scaffoldable:!1,registry:!0,gallery:!0}},{slug:`chat-sdk-zernio`,name:`Zernio`,kind:`channel`,tagline:`Reach seven social and messaging platforms through one Zernio integration.`,surfaces:{scaffoldable:!1,registry:!0,gallery:!0}},{slug:`chat-sdk-velt`,name:`Velt`,kind:`channel`,tagline:`Add agents to anchored comments across documents, canvases, PDFs, and video.`,surfaces:{scaffoldable:!1,registry:!0,gallery:!0}},{slug:`chat-sdk-sendblue`,name:`Sendblue`,kind:`channel`,tagline:`Send and receive iMessage, SMS, and RCS through Sendblue.`,surfaces:{scaffoldable:!1,registry:!0,gallery:!0}},{slug:`chat-sdk-novu`,name:`Novu`,kind:`channel`,tagline:`Reach Slack, Teams, WhatsApp, Telegram, and email through Novu.`,surfaces:{scaffoldable:!1,registry:!0,gallery:!0}},{slug:`chat-sdk-liveblocks`,name:`Liveblocks`,kind:`channel`,tagline:`Bring your agent into Liveblocks comment threads, mentions, and reactions.`,surfaces:{scaffoldable:!1,registry:!0,gallery:!0}},{slug:`linq`,name:`Linq`,kind:`channel`,tagline:`iMessage and SMS conversations through Linq, with guided Connect or portable setup.`,surfaces:{scaffoldable:!1,registry:!0,gallery:!0}},{slug:`chat-sdk-kapso`,name:`Kapso`,kind:`channel`,tagline:`Managed WhatsApp conversations, media, buttons, and history through Kapso.`,surfaces:{scaffoldable:!1,registry:!0,gallery:!0}},{slug:`photon`,name:`Photon`,kind:`channel`,tagline:`iMessage through Photon, with guided project and phone setup.`,surfaces:{scaffoldable:!1,registry:!0,gallery:!0}},{slug:`chat-sdk-dial`,name:`Dial`,kind:`channel`,tagline:`Give your agent a phone number for SMS, MMS, iMessage, and voice transcripts.`,surfaces:{scaffoldable:!1,registry:!0,gallery:!0}},{slug:`chat-sdk-agentphone`,name:`AgentPhone`,kind:`channel`,tagline:`SMS, MMS, iMessage, and voice conversations through AgentPhone.`,surfaces:{scaffoldable:!1,registry:!0,gallery:!0}},{slug:`chat-sdk-lark`,name:`Lark / Feishu`,kind:`channel`,tagline:`Lark and Feishu chats with native card streaming via the Chat SDK.`,surfaces:{scaffoldable:!1,registry:!0,gallery:!0}},{slug:`chat-sdk-beeper`,name:`Beeper`,kind:`channel`,tagline:`Matrix rooms and bridged messaging networks through Beeper.`,surfaces:{scaffoldable:!1,registry:!0,gallery:!0}},{slug:`chat-sdk-resend`,name:`Resend`,kind:`channel`,tagline:`Send and receive threaded email through Resend via the Chat SDK.`,surfaces:{scaffoldable:!1,registry:!0,gallery:!0}},{slug:`chat-sdk-gmail`,name:`Gmail`,kind:`channel`,tagline:`Turn labelled Gmail threads into agent conversations via the Chat SDK.`,surfaces:{scaffoldable:!1,registry:!0,gallery:!0}},{slug:`agent-browser`,name:`agent-browser`,kind:`extension`,tagline:`Add browser automation tools backed by agent-browser to an eve agent.`,surfaces:{scaffoldable:!1,registry:!0,gallery:!0}},{slug:`blitzreels`,name:`BlitzReels`,kind:`extension`,tagline:`Turn long videos into short clips, generate media, repair edits, and export.`,surfaces:{scaffoldable:!1,registry:!0,gallery:!0}},{slug:`mux-video`,name:`Mux Video`,kind:`extension`,tagline:`Create and inspect video assets, make clips, and run Mux Robots workflows.`,surfaces:{scaffoldable:!1,registry:!1,gallery:!0}},{slug:`browserbase`,name:`Browserbase`,kind:`extension`,tagline:`Search, fetch, and automate the web with Browserbase and Stagehand.`,surfaces:{scaffoldable:!1,registry:!0,gallery:!0}},{slug:`github-tools`,name:`GitHub Tools`,kind:`extension`,tagline:`Add scoped GitHub tools with Vercel Connect authentication and approval rules.`,surfaces:{scaffoldable:!1,registry:!0,gallery:!0}},{slug:`jetty`,name:`Jetty`,kind:`extension`,tagline:`Grade agent turns, compare experiments, and store durable evaluation trajectories.`,surfaces:{scaffoldable:!1,registry:!0,gallery:!0}},{slug:`link`,name:`Link`,kind:`extension`,tagline:`Give your eve agent guarded access to Link wallet and purchase tools.`,surfaces:{scaffoldable:!1,registry:!0,gallery:!0}},{slug:`kernel`,name:`KERNEL`,kind:`extension`,tagline:`Let your eve agent use the Internet with KERNEL browser infra, o11y, and stealth. Integrated natively with Vercel Connect and AI Gateway.`,surfaces:{scaffoldable:!1,registry:!0,gallery:!0}},{slug:`file`,name:`File memory`,kind:`memory`,tagline:`Store durable per-principal memory in a private Vercel Blob store provisioned for the agent.`,surfaces:{scaffoldable:!1,registry:!0,gallery:!0}},{slug:`supermemory`,name:`Supermemory`,kind:`memory`,tagline:`Give your agents long-term memory, user profiles, and SuperRAG across conversations and context.`,surfaces:{scaffoldable:!1,registry:!0,gallery:!0}},{slug:`upstash-agentkit`,name:`Upstash AgentKit`,kind:`memory`,tagline:`Give your agents ranked recall and automatic capture on Upstash Redis, or a Redis backend for file memory.`,surfaces:{scaffoldable:!1,registry:!0,gallery:!0}},{slug:`arcana`,name:`Kybernesis Arcana`,kind:`memory`,tagline:`Give your agents workspace-scoped long-term memory with automatic recall and deliberate storage.`,surfaces:{scaffoldable:!1,registry:!0,gallery:!0}},{slug:`hindsight`,name:`Hindsight`,kind:`memory`,tagline:`Recall relevant context before every turn and retain each exchange automatically.`,surfaces:{scaffoldable:!1,registry:!0,gallery:!0}},{slug:`browser-use`,name:`Browser Use`,kind:`connection`,tagline:`Run managed browser automation tasks through Browser Use's MCP server.`,surfaces:{scaffoldable:!0,registry:!0,gallery:!0},connection:{description:`Browser Use: run browser automation tasks, inspect sessions, and manage browser profiles.`,mcp:{url:`https://api.browser-use.com/v3/mcp`}}},{slug:`dataforseo`,name:`DataForSEO`,kind:`connection`,tagline:`Run SEO, keyword, and SERP data lookups through DataForSEO's MCP server.`,surfaces:{scaffoldable:!1,registry:!0,gallery:!1},connection:{description:`DataForSEO: run SEO, keyword, and SERP data lookups through DataForSEO's MCP server.`,mcp:{url:`https://mcp.dataforseo.com/v3/mcp`}}},{slug:`vercel`,name:`Vercel`,kind:`connection`,tagline:`Manage Vercel projects, deployments, and logs through Vercel's MCP server.`,surfaces:{scaffoldable:!1,registry:!0,gallery:!0},connection:{description:`Vercel: manage projects and deployments, inspect logs, and search documentation.`,mcp:{url:`https://mcp.vercel.com`}}},{slug:`linear`,name:`Linear`,kind:`connection`,tagline:`Issues, projects, cycles, and comments via Linear's MCP server.`,surfaces:{scaffoldable:!0,registry:!0,gallery:!0},connection:{description:`Linear workspace: issues, projects, cycles, and comments.`,mcp:{url:`https://mcp.linear.app/mcp`}}},{slug:`notion`,name:`Notion`,kind:`connection`,tagline:`Search and edit Notion pages and databases over MCP or OpenAPI.`,surfaces:{scaffoldable:!0,registry:!0,gallery:!0},connection:{description:`Notion workspace: search and edit pages and databases.`,mcp:{url:`https://mcp.notion.com/mcp`},openapi:{spec:`https://developers.notion.com/openapi.json`,baseUrl:`https://api.notion.com`,headers:{"Notion-Version":`2022-06-28`}}}},{slug:`datadog`,name:`Datadog`,kind:`connection`,tagline:`Query metrics, monitors, and logs through Datadog's MCP server.`,surfaces:{scaffoldable:!0,registry:!0,gallery:!0},connection:{description:`Datadog: query metrics, monitors, logs, and incidents.`,mcp:{url:`https://mcp.datadoghq.com/api/mcp`}}},{slug:`honeycomb`,name:`Honeycomb`,kind:`connection`,tagline:`Explore traces and run queries through Honeycomb's MCP server.`,surfaces:{scaffoldable:!0,registry:!0,gallery:!0},connection:{description:`Honeycomb: explore traces, run queries, and inspect datasets.`,mcp:{url:`https://mcp.honeycomb.io/mcp`}}},{slug:`agentcard`,name:`Agentcard`,kind:`connection`,tagline:`let agents buy online`,surfaces:{scaffoldable:!1,registry:!0,gallery:!0},connection:{description:"Agentcard: the agent's wallet. Shop and check out at real merchants (DoorDash, Good Eggs, flights) with the conversational `buy` tool (thread conversation_id on follow-ups), issue a single-use virtual card to pay at any checkout, let the user add their own card, and manage the cash that funds it: balance, top-ups, transactions, KYC, human support.",mcp:{url:`https://mcp.agentcard.sh/mcp`}}},{slug:`airtable`,name:`Airtable`,kind:`connection`,tagline:`Bases, tables, and records through Airtable's MCP server.`,surfaces:{scaffoldable:!1,registry:!0,gallery:!0},connection:{description:`Airtable: bases, tables, and records.`,mcp:{url:`https://mcp.airtable.com/mcp`}}},{slug:`bitly`,name:`Bitly`,kind:`connection`,tagline:`Shorten links, generate QR Codes, and track performance.`,surfaces:{scaffoldable:!1,registry:!0,gallery:!0},connection:{description:`Bitly: shorten links, generate QR Codes, and track link performance.`,mcp:{url:`https://api-ssl.bitly.com/v4/mcp`}}},{slug:`brex`,name:`Brex`,kind:`connection`,tagline:`Expenses, cards, and cash through Brex's finance automation.`,surfaces:{scaffoldable:!1,registry:!0,gallery:!0},connection:{description:`Brex: expenses, cards, budgets, and cash.`,mcp:{url:`https://api.brex.com/mcp`}}},{slug:`candid`,name:`Candid`,kind:`connection`,tagline:`Research nonprofits and funders using Candid's data.`,surfaces:{scaffoldable:!1,registry:!0,gallery:!0},connection:{description:`Candid: research nonprofits, funders, and grants.`,mcp:{url:`https://mcp.candid.org/mcp`}}},{slug:`clickhouse`,name:`ClickHouse`,kind:`connection`,tagline:`Query and explore your ClickHouse Cloud data.`,surfaces:{scaffoldable:!1,registry:!0,gallery:!0},connection:{description:`ClickHouse Cloud: query and explore databases and tables.`,mcp:{url:`https://mcp.clickhouse.cloud/mcp`}}},{slug:`cloudinary`,name:`Cloudinary`,kind:`connection`,tagline:`Manage, transform, and deliver your images and videos.`,surfaces:{scaffoldable:!1,registry:!0,gallery:!0},connection:{description:`Cloudinary: manage, transform, and deliver image and video assets.`,mcp:{url:`https://asset-management.mcp.cloudinary.com/sse`}}},{slug:`coda`,name:`Coda`,kind:`connection`,tagline:`Create, search, and update docs and tables.`,surfaces:{scaffoldable:!1,registry:!0,gallery:!0},connection:{description:`Coda: create, search, and update docs and tables.`,mcp:{url:`https://coda.io/apis/mcp`}}},{slug:`context`,name:`context.dev`,kind:`connection`,tagline:`search, scrape, extract, and monitor live web data.`,surfaces:{scaffoldable:!1,registry:!0,gallery:!0},connection:{description:`context.dev: search the live web, scrape and crawl sites, extract structured data, parse files, retrieve brand intelligence, monitor changes, and run batch jobs.`,mcp:{url:`https://mcp.context.dev/mcp`}}},{slug:`egnyte`,name:`Egnyte`,kind:`connection`,tagline:`Securely access and analyze Egnyte content.`,surfaces:{scaffoldable:!1,registry:!0,gallery:!0},connection:{description:`Egnyte: search, access, and analyze governed content.`,mcp:{url:`https://mcp-server.egnyte.com/mcp`}}},{slug:`embat`,name:`Embat`,kind:`connection`,tagline:`Ask Embat about cash, debt, payments, and accounting.`,surfaces:{scaffoldable:!1,registry:!0,gallery:!0},connection:{description:`Embat: cash, debt, payments, and accounting.`,mcp:{url:`https://tellme.embat.io/mcp`}}},{slug:`hugging-face`,name:`Hugging Face`,kind:`connection`,tagline:`Access the Hugging Face Hub and thousands of Gradio apps.`,surfaces:{scaffoldable:!1,registry:!0,gallery:!0},connection:{description:`Hugging Face: models, datasets, Spaces, and Gradio apps on the Hub.`,mcp:{url:`https://huggingface.co/mcp?login&gradio=none`}}},{slug:`local-falcon`,name:`Local Falcon`,kind:`connection`,tagline:`AI visibility and local search intelligence.`,surfaces:{scaffoldable:!1,registry:!0,gallery:!0},connection:{description:`Local Falcon: local search rankings and AI visibility reports.`,mcp:{url:`https://mcp.localfalcon.com`}}},{slug:`make`,name:`Make`,kind:`connection`,tagline:`Run Make scenarios and manage your Make account.`,surfaces:{scaffoldable:!1,registry:!0,gallery:!0},connection:{description:`Make: run scenarios and manage automations.`,mcp:{url:`https://mcp.make.com`}}},{slug:`manufact`,name:`Manufact`,kind:`connection`,tagline:`Deploy and monitor MCP servers with Manufact.`,surfaces:{scaffoldable:!1,registry:!0,gallery:!0},connection:{description:`Manufact: deploy and monitor MCP servers.`,mcp:{url:`https://mcp.manufact.com/mcp`}}},{slug:`mem0`,name:`Mem0`,kind:`connection`,tagline:`Persistent memory for AI agents and assistants.`,surfaces:{scaffoldable:!1,registry:!0,gallery:!0},connection:{description:`Mem0: store and retrieve persistent agent memory.`,mcp:{url:`https://mcp.mem0.ai/mcp`}}},{slug:`miro`,name:`Miro`,kind:`connection`,tagline:`Access and create content on Miro boards.`,surfaces:{scaffoldable:!1,registry:!0,gallery:!0},connection:{description:`Miro: read and create content on boards.`,mcp:{url:`https://mcp.miro.com/`}}},{slug:`mixpanel`,name:`Mixpanel`,kind:`connection`,tagline:`Analyze, query, and manage your Mixpanel data.`,surfaces:{scaffoldable:!1,registry:!0,gallery:!0},connection:{description:`Mixpanel: analyze, query, and manage analytics data.`,mcp:{url:`https://mcp.mixpanel.com/mcp`}}},{slug:`natural`,name:`Natural`,kind:`connection`,tagline:`Send, request, and manage payments with Natural.`,surfaces:{scaffoldable:!1,registry:!0,gallery:!0},connection:{description:`Natural: agentic payments — send and request payments, check balances, and move funds.`,mcp:{url:`https://mcp.natural.com/mcp`}}},{slug:`neon`,name:`Neon`,kind:`connection`,tagline:`Manage Neon projects, run queries, and make schema changes.`,surfaces:{scaffoldable:!1,registry:!0,gallery:!0},connection:{description:`Neon: manage projects, run queries, and make schema changes.`,mcp:{url:`https://mcp.neon.tech/mcp`}}},{slug:`netlify`,name:`Netlify`,kind:`connection`,tagline:`Create, deploy, manage, and secure websites on Netlify.`,surfaces:{scaffoldable:!1,registry:!0,gallery:!0},connection:{description:`Netlify: create, deploy, manage, and secure sites.`,mcp:{url:`https://netlify-mcp.netlify.app/mcp`}}},{slug:`oreilly`,name:`O'Reilly`,kind:`connection`,tagline:`Discover O'Reilly's expert learning content.`,surfaces:{scaffoldable:!1,registry:!0,gallery:!0},connection:{description:`O'Reilly: search books, courses, and learning content.`,mcp:{url:`https://api.oreilly.com/api/content-discovery/v1/mcp/`}}},{slug:`planetscale`,name:`PlanetScale`,kind:`connection`,tagline:`Authenticated access to your PlanetScale Postgres and MySQL databases.`,surfaces:{scaffoldable:!1,registry:!0,gallery:!0},connection:{description:`PlanetScale: query Postgres and MySQL databases.`,mcp:{url:`https://mcp.pscale.dev/mcp/planetscale`}}},{slug:`posthog`,name:`PostHog`,kind:`connection`,tagline:`Query, analyze, and manage your PostHog insights.`,surfaces:{scaffoldable:!1,registry:!0,gallery:!0},connection:{description:`PostHog: insights, events, and feature flags.`,mcp:{url:`https://mcp.posthog.com/mcp`}}},{slug:`postman`,name:`Postman`,kind:`connection`,tagline:`Give API context to your coding agents with Postman.`,surfaces:{scaffoldable:!1,registry:!0,gallery:!0},connection:{description:`Postman: APIs, collections, and workspaces.`,mcp:{url:`https://mcp.postman.com/minimal`}}},{slug:`razorpay`,name:`Razorpay`,kind:`connection`,tagline:`Razorpay payments, settlements, and dashboard data.`,surfaces:{scaffoldable:!1,registry:!0,gallery:!0},connection:{description:`Razorpay: payments, settlements, and dashboard data.`,mcp:{url:`https://mcp.razorpay.com/mcp`}}},{slug:`sanity`,name:`Sanity`,kind:`connection`,tagline:`Query and edit Sanity content, inspect schemas, and manage releases.`,surfaces:{scaffoldable:!1,registry:!0,gallery:!0},connection:{description:`Sanity: query content with GROQ, edit documents, inspect schemas, and manage releases.`,mcp:{url:`https://mcp.sanity.io`}}},{slug:`sentry`,name:`Sentry`,kind:`connection`,tagline:`Search, query, and debug errors intelligently.`,surfaces:{scaffoldable:!1,registry:!0,gallery:!0},connection:{description:`Sentry: search, query, and debug errors and issues.`,mcp:{url:`https://mcp.sentry.dev/mcp`}}},{slug:`similarweb`,name:`Similarweb`,kind:`connection`,tagline:`Real-time web, mobile app, and market data.`,surfaces:{scaffoldable:!1,registry:!0,gallery:!0},connection:{description:`Similarweb: web traffic, app, and market intelligence data.`,mcp:{url:`https://mcp.similarweb.com`}}},{slug:`shopify`,name:`Shopify`,kind:`connection`,tagline:`Search products and manage carts and checkouts on a Shopify storefront.`,surfaces:{scaffoldable:!1,registry:!0,gallery:!0},connection:{description:`Search products and build carts and checkouts on a Shopify storefront.`,mcp:{url:`https://{shop}.myshopify.com/api/ucp/mcp`}}},{slug:`stripe`,name:`Stripe`,kind:`connection`,tagline:`Payment processing and financial infrastructure tools.`,surfaces:{scaffoldable:!1,registry:!0,gallery:!0},connection:{description:`Stripe: payments, customers, billing, and financial infrastructure.`,mcp:{url:`https://mcp.stripe.com`}}},{slug:`supabase`,name:`Supabase`,kind:`connection`,tagline:`Manage databases, authentication, and storage.`,surfaces:{scaffoldable:!1,registry:!0,gallery:!0},connection:{description:`Supabase: databases, authentication, and storage.`,mcp:{url:`https://mcp.supabase.com/mcp`}}},{slug:`ticket-tailor`,name:`Ticket Tailor`,kind:`connection`,tagline:`Manage tickets, orders, and events with Ticket Tailor.`,surfaces:{scaffoldable:!1,registry:!0,gallery:!0},connection:{description:`Ticket Tailor: events, tickets, and orders.`,mcp:{url:`https://mcp.tickettailor.ai/mcp`}}},{slug:`ticktick`,name:`TickTick`,kind:`connection`,tagline:`Search, create, and manage your tasks and habits in TickTick.`,surfaces:{scaffoldable:!1,registry:!0,gallery:!0},connection:{description:`TickTick: tasks, habits, and lists.`,mcp:{url:`https://mcp.ticktick.com`}}},{slug:`tinybird`,name:`Tinybird`,kind:`connection`,tagline:`Query pipes and data sources in your Tinybird Workspace.`,surfaces:{scaffoldable:!1,registry:!0,gallery:!0},connection:{description:`Tinybird: query pipes and data sources, and run SQL. A token grants one Workspace, so add a connection per Workspace.`,mcp:{url:`https://mcp.tinybird.co`}}},{slug:`todoist`,name:`Todoist`,kind:`connection`,tagline:`Search, complete, and manage your tasks in Todoist.`,surfaces:{scaffoldable:!1,registry:!0,gallery:!0},connection:{description:`Todoist: search, complete, and manage tasks.`,mcp:{url:`https://ai.todoist.net/mcp`}}},{slug:`webflow`,name:`Webflow`,kind:`connection`,tagline:`Manage Webflow CMS, pages, assets, and sites.`,surfaces:{scaffoldable:!1,registry:!0,gallery:!0},connection:{description:`Webflow: CMS items, pages, assets, and sites.`,mcp:{url:`https://mcp.webflow.com/mcp`}}},{slug:`wix`,name:`Wix`,kind:`connection`,tagline:`Manage and build sites and apps on Wix.`,surfaces:{scaffoldable:!1,registry:!0,gallery:!0},connection:{description:`Wix: manage and build sites and apps.`,mcp:{url:`https://mcp.wix.com/mcp`}}},{slug:`zapier`,name:`Zapier`,kind:`connection`,tagline:`Automate workflows across thousands of apps.`,surfaces:{scaffoldable:!1,registry:!0,gallery:!0},connection:{description:`Zapier: run and manage automations across apps.`,mcp:{url:`https://mcp.zapier.com/api/v1/connect`}}},{slug:`zomato`,name:`Zomato`,kind:`connection`,tagline:`Online food ordering and delivery through Zomato.`,surfaces:{scaffoldable:!1,registry:!0,gallery:!0},connection:{description:`Zomato: food ordering and delivery.`,mcp:{url:`https://mcp-server.zomato.com/mcp`}}},{slug:`braintrust`,name:`Braintrust`,kind:`instrumentation`,tagline:`Export AI SDK spans to Braintrust for tracing, evals, and monitoring.`,surfaces:{scaffoldable:!1,registry:!0,gallery:!0}},{slug:`posthog-instrumentation`,name:`PostHog`,kind:`instrumentation`,tagline:`Send agent traces and generations to PostHog AI Observability.`,surfaces:{scaffoldable:!1,registry:!0,gallery:!0}},{slug:`sentry-instrumentation`,name:`Sentry`,kind:`instrumentation`,tagline:`Send agent traces to Sentry's OTLP endpoint for tracing and debugging.`,surfaces:{scaffoldable:!1,registry:!0,gallery:!0}},{slug:`datadog-instrumentation`,name:`Datadog`,kind:`instrumentation`,tagline:`Export agent traces to Datadog APM alongside the rest of your stack.`,surfaces:{scaffoldable:!1,registry:!0,gallery:!0}},{slug:`honeycomb-instrumentation`,name:`Honeycomb`,kind:`instrumentation`,tagline:`Send OpenTelemetry traces to Honeycomb and query every agent turn.`,surfaces:{scaffoldable:!1,registry:!0,gallery:!0}},{slug:`arize`,name:`Arize`,kind:`instrumentation`,tagline:`Export traces to Arize AX for LLM observability and evaluation.`,surfaces:{scaffoldable:!1,registry:!0,gallery:!0}},{slug:`raindrop`,name:`Raindrop`,kind:`instrumentation`,tagline:`Send agent traces to Raindrop to detect and debug AI product issues.`,surfaces:{scaffoldable:!1,registry:!0,gallery:!0}},{slug:`jaeger`,name:`Jaeger`,kind:`instrumentation`,tagline:`Trace your agent with a local or self-hosted Jaeger OTLP backend.`,surfaces:{scaffoldable:!1,registry:!0,gallery:!0}}],n=new Map(t.map(e=>[e.slug,e]));function r(e){return n.get(e)}function i(e){return t.filter(t=>t.kind===e)}function a(){return i(`connection`)}function o(){return i(`channel`)}function s(){return i(`extension`)}function c(){return i(`instrumentation`)}function l(){return i(`memory`)}export{t as INTEGRATIONS,o as channelEntries,a as connectionEntries,e as connectionProtocols,s as extensionEntries,r as getIntegrationEntry,c as instrumentationEntries,i as integrationsByKind,l as memoryEntries};
|
|
1
|
+
function e(e){return[e.mcp?`mcp`:null,e.openapi?`openapi`:null].filter(e=>e!==null)}const t=[{slug:`eve`,name:`Web Chat`,kind:`channel`,tagline:`Embed a first-party web chat UI backed by your agent.`,surfaces:{scaffoldable:!0,registry:!0,gallery:!0}},{slug:`slack`,name:`Slack`,kind:`channel`,tagline:`Mention your agent in channels and DMs, with Connect-managed auth.`,surfaces:{scaffoldable:!0,registry:!0,gallery:!0}},{slug:`discord`,name:`Discord`,kind:`channel`,tagline:`Run your agent as a Discord bot across servers and threads.`,surfaces:{scaffoldable:!1,registry:!0,gallery:!0}},{slug:`teams`,name:`Microsoft Teams`,kind:`channel`,tagline:`Bring your agent into Teams chats and channels.`,surfaces:{scaffoldable:!1,registry:!0,gallery:!0}},{slug:`telegram`,name:`Telegram`,kind:`channel`,tagline:`Connect your agent to a Telegram bot for 1:1 and group chats.`,surfaces:{scaffoldable:!1,registry:!0,gallery:!0}},{slug:`twilio`,name:`Twilio`,kind:`channel`,tagline:`Put your agent on a phone number: SMS and speech-transcribed calls.`,surfaces:{scaffoldable:!1,registry:!0,gallery:!0}},{slug:`blooio`,name:`Blooio`,kind:`channel`,tagline:`Send and receive iMessage, RCS, and SMS through Blooio.`,surfaces:{scaffoldable:!1,registry:!0,gallery:!0}},{slug:`github`,name:`GitHub`,kind:`channel`,tagline:`Drive your agent from issues, pull requests, and comments, with guided Connect setup.`,surfaces:{scaffoldable:!1,registry:!0,gallery:!0}},{slug:`linear-agent`,name:`Linear Agent`,kind:`channel`,tagline:`Delegate Linear issues and comments through Agent Sessions, with guided Connect setup.`,surfaces:{scaffoldable:!1,registry:!0,gallery:!0}},{slug:`chat-sdk-gchat`,name:`Google Chat`,kind:`channel`,tagline:`Google Chat spaces and DMs via the Chat SDK.`,surfaces:{scaffoldable:!1,registry:!0,gallery:!0}},{slug:`chat-sdk-whatsapp`,name:`WhatsApp`,kind:`channel`,tagline:`Customer messaging through WhatsApp Business Cloud via the Chat SDK.`,surfaces:{scaffoldable:!1,registry:!0,gallery:!0}},{slug:`chat-sdk-x`,name:`X`,kind:`channel`,tagline:`Public mentions and DMs on X via the Chat SDK.`,surfaces:{scaffoldable:!1,registry:!0,gallery:!0}},{slug:`chat-sdk-messenger`,name:`Messenger`,kind:`channel`,tagline:`Facebook Messenger bots with templates, buttons, and reactions via the Chat SDK.`,surfaces:{scaffoldable:!1,registry:!0,gallery:!0}},{slug:`chat-sdk-zernio`,name:`Zernio`,kind:`channel`,tagline:`Reach seven social and messaging platforms through one Zernio integration.`,surfaces:{scaffoldable:!1,registry:!0,gallery:!0}},{slug:`chat-sdk-velt`,name:`Velt`,kind:`channel`,tagline:`Add agents to anchored comments across documents, canvases, PDFs, and video.`,surfaces:{scaffoldable:!1,registry:!0,gallery:!0}},{slug:`chat-sdk-sendblue`,name:`Sendblue`,kind:`channel`,tagline:`Send and receive iMessage, SMS, and RCS through Sendblue.`,surfaces:{scaffoldable:!1,registry:!0,gallery:!0}},{slug:`chat-sdk-novu`,name:`Novu`,kind:`channel`,tagline:`Reach Slack, Teams, WhatsApp, Telegram, and email through Novu.`,surfaces:{scaffoldable:!1,registry:!0,gallery:!0}},{slug:`chat-sdk-liveblocks`,name:`Liveblocks`,kind:`channel`,tagline:`Bring your agent into Liveblocks comment threads, mentions, and reactions.`,surfaces:{scaffoldable:!1,registry:!0,gallery:!0}},{slug:`linq`,name:`Linq`,kind:`channel`,tagline:`iMessage and SMS conversations through Linq, with guided Connect or portable setup.`,surfaces:{scaffoldable:!1,registry:!0,gallery:!0}},{slug:`chat-sdk-kapso`,name:`Kapso`,kind:`channel`,tagline:`Managed WhatsApp conversations, media, buttons, and history through Kapso.`,surfaces:{scaffoldable:!1,registry:!0,gallery:!0}},{slug:`photon`,name:`Photon`,kind:`channel`,tagline:`iMessage through Photon, with guided project and phone setup.`,surfaces:{scaffoldable:!1,registry:!0,gallery:!0}},{slug:`chat-sdk-dial`,name:`Dial`,kind:`channel`,tagline:`Give your agent a phone number for SMS, MMS, iMessage, and voice transcripts.`,surfaces:{scaffoldable:!1,registry:!0,gallery:!0}},{slug:`chat-sdk-agentphone`,name:`AgentPhone`,kind:`channel`,tagline:`SMS, MMS, iMessage, and voice conversations through AgentPhone.`,surfaces:{scaffoldable:!1,registry:!0,gallery:!0}},{slug:`chat-sdk-lark`,name:`Lark / Feishu`,kind:`channel`,tagline:`Lark and Feishu chats with native card streaming via the Chat SDK.`,surfaces:{scaffoldable:!1,registry:!0,gallery:!0}},{slug:`chat-sdk-beeper`,name:`Beeper`,kind:`channel`,tagline:`Matrix rooms and bridged messaging networks through Beeper.`,surfaces:{scaffoldable:!1,registry:!0,gallery:!0}},{slug:`chat-sdk-resend`,name:`Resend`,kind:`channel`,tagline:`Send and receive threaded email through Resend via the Chat SDK.`,surfaces:{scaffoldable:!1,registry:!0,gallery:!0}},{slug:`chat-sdk-gmail`,name:`Gmail`,kind:`channel`,tagline:`Turn labelled Gmail threads into agent conversations via the Chat SDK.`,surfaces:{scaffoldable:!1,registry:!0,gallery:!0}},{slug:`agent-browser`,name:`agent-browser`,kind:`extension`,tagline:`Add browser automation tools backed by agent-browser to an eve agent.`,surfaces:{scaffoldable:!1,registry:!0,gallery:!0}},{slug:`blitzreels`,name:`BlitzReels`,kind:`extension`,tagline:`Turn long videos into short clips, generate media, repair edits, and export.`,surfaces:{scaffoldable:!1,registry:!0,gallery:!0}},{slug:`mux-video`,name:`Mux Video`,kind:`extension`,tagline:`Create and inspect video assets, make clips, and run Mux Robots workflows.`,surfaces:{scaffoldable:!1,registry:!1,gallery:!0}},{slug:`browserbase`,name:`Browserbase`,kind:`extension`,tagline:`Search, fetch, and automate the web with Browserbase and Stagehand.`,surfaces:{scaffoldable:!1,registry:!0,gallery:!0}},{slug:`github-tools`,name:`GitHub Tools`,kind:`extension`,tagline:`Add scoped GitHub tools with Vercel Connect authentication and approval rules.`,surfaces:{scaffoldable:!1,registry:!0,gallery:!0}},{slug:`jetty`,name:`Jetty`,kind:`extension`,tagline:`Grade agent turns, compare experiments, and store durable evaluation trajectories.`,surfaces:{scaffoldable:!1,registry:!0,gallery:!0}},{slug:`link`,name:`Link`,kind:`extension`,tagline:`Give your eve agent guarded access to Link wallet and purchase tools.`,surfaces:{scaffoldable:!1,registry:!0,gallery:!0}},{slug:`kernel`,name:`KERNEL`,kind:`extension`,tagline:`Let your eve agent use the Internet with KERNEL browser infra, o11y, and stealth. Integrated natively with Vercel Connect and AI Gateway.`,surfaces:{scaffoldable:!1,registry:!0,gallery:!0}},{slug:`file`,name:`File memory`,kind:`memory`,tagline:`Store durable per-principal memory in a private Vercel Blob store provisioned for the agent.`,surfaces:{scaffoldable:!1,registry:!0,gallery:!0}},{slug:`supermemory`,name:`Supermemory`,kind:`memory`,tagline:`Give your agents long-term memory, user profiles, and SuperRAG across conversations and context.`,surfaces:{scaffoldable:!1,registry:!0,gallery:!0}},{slug:`upstash-agentkit`,name:`Upstash AgentKit`,kind:`memory`,tagline:`Give your agents ranked recall and automatic capture on Upstash Redis, or a Redis backend for file memory.`,surfaces:{scaffoldable:!1,registry:!0,gallery:!0}},{slug:`arcana`,name:`Kybernesis Arcana`,kind:`memory`,tagline:`Give your agents workspace-scoped long-term memory with automatic recall and deliberate storage.`,surfaces:{scaffoldable:!1,registry:!0,gallery:!0}},{slug:`hindsight`,name:`Hindsight`,kind:`memory`,tagline:`Recall relevant context before every turn and retain each exchange automatically.`,surfaces:{scaffoldable:!1,registry:!0,gallery:!0}},{slug:`memanto`,name:`Memanto`,kind:`memory`,tagline:`Recall relevant long-term context and let agents deliberately save durable user memories.`,surfaces:{scaffoldable:!1,registry:!0,gallery:!0}},{slug:`browser-use`,name:`Browser Use`,kind:`connection`,tagline:`Run managed browser automation tasks through Browser Use's MCP server.`,surfaces:{scaffoldable:!0,registry:!0,gallery:!0},connection:{description:`Browser Use: run browser automation tasks, inspect sessions, and manage browser profiles.`,mcp:{url:`https://api.browser-use.com/v3/mcp`}}},{slug:`dataforseo`,name:`DataForSEO`,kind:`connection`,tagline:`Run SEO, keyword, and SERP data lookups through DataForSEO's MCP server.`,surfaces:{scaffoldable:!1,registry:!0,gallery:!1},connection:{description:`DataForSEO: run SEO, keyword, and SERP data lookups through DataForSEO's MCP server.`,mcp:{url:`https://mcp.dataforseo.com/v3/mcp`}}},{slug:`waydock`,name:`Waydock`,kind:`connection`,tagline:`Access mail, calendar, meetings, tasks, and follow-ups through Waydock's MCP server.`,surfaces:{scaffoldable:!1,registry:!0,gallery:!0},connection:{description:`Waydock: access the user's mail, calendar, meetings, tasks, and follow-ups through its MCP server.`,mcp:{url:`https://mcp.waydock.ai/mcp`}}},{slug:`vercel`,name:`Vercel`,kind:`connection`,tagline:`Manage Vercel projects, deployments, and logs through Vercel's MCP server.`,surfaces:{scaffoldable:!1,registry:!0,gallery:!0},connection:{description:`Vercel: manage projects and deployments, inspect logs, and search documentation.`,mcp:{url:`https://mcp.vercel.com`}}},{slug:`linear`,name:`Linear`,kind:`connection`,tagline:`Issues, projects, cycles, and comments via Linear's MCP server.`,surfaces:{scaffoldable:!0,registry:!0,gallery:!0},connection:{description:`Linear workspace: issues, projects, cycles, and comments.`,mcp:{url:`https://mcp.linear.app/mcp`}}},{slug:`sent`,name:`Sent`,kind:`connection`,tagline:`Send and track SMS, WhatsApp, and RCS through Sent's MCP server.`,surfaces:{scaffoldable:!1,registry:!0,gallery:!0},connection:{description:`Sent business messaging: send and track SMS, WhatsApp, and RCS; manage contacts and templates; inspect analytics, balance, and account readiness.`,mcp:{url:`https://mcp.sent.dm/mcp`}}},{slug:`notion`,name:`Notion`,kind:`connection`,tagline:`Search and edit Notion pages and databases over MCP or OpenAPI.`,surfaces:{scaffoldable:!0,registry:!0,gallery:!0},connection:{description:`Notion workspace: search and edit pages and databases.`,mcp:{url:`https://mcp.notion.com/mcp`},openapi:{spec:`https://developers.notion.com/openapi.json`,baseUrl:`https://api.notion.com`,headers:{"Notion-Version":`2022-06-28`}}}},{slug:`datadog`,name:`Datadog`,kind:`connection`,tagline:`Query metrics, monitors, and logs through Datadog's MCP server.`,surfaces:{scaffoldable:!0,registry:!0,gallery:!0},connection:{description:`Datadog: query metrics, monitors, logs, and incidents.`,mcp:{url:`https://mcp.datadoghq.com/api/mcp`}}},{slug:`honeycomb`,name:`Honeycomb`,kind:`connection`,tagline:`Explore traces and run queries through Honeycomb's MCP server.`,surfaces:{scaffoldable:!0,registry:!0,gallery:!0},connection:{description:`Honeycomb: explore traces, run queries, and inspect datasets.`,mcp:{url:`https://mcp.honeycomb.io/mcp`}}},{slug:`agentcard`,name:`Agentcard`,kind:`connection`,tagline:`let agents buy online`,surfaces:{scaffoldable:!1,registry:!0,gallery:!0},connection:{description:"Agentcard: the agent's wallet. Shop and check out at real merchants (DoorDash, Good Eggs, flights) with the conversational `buy` tool (thread conversation_id on follow-ups), issue a single-use virtual card to pay at any checkout, let the user add their own card, and manage the cash that funds it: balance, top-ups, transactions, KYC, human support.",mcp:{url:`https://mcp.agentcard.sh/mcp`}}},{slug:`airtable`,name:`Airtable`,kind:`connection`,tagline:`Bases, tables, and records through Airtable's MCP server.`,surfaces:{scaffoldable:!1,registry:!0,gallery:!0},connection:{description:`Airtable: bases, tables, and records.`,mcp:{url:`https://mcp.airtable.com/mcp`}}},{slug:`bitly`,name:`Bitly`,kind:`connection`,tagline:`Shorten links, generate QR Codes, and track performance.`,surfaces:{scaffoldable:!1,registry:!0,gallery:!0},connection:{description:`Bitly: shorten links, generate QR Codes, and track link performance.`,mcp:{url:`https://api-ssl.bitly.com/v4/mcp`}}},{slug:`brex`,name:`Brex`,kind:`connection`,tagline:`Expenses, cards, and cash through Brex's finance automation.`,surfaces:{scaffoldable:!1,registry:!0,gallery:!0},connection:{description:`Brex: expenses, cards, budgets, and cash.`,mcp:{url:`https://api.brex.com/mcp`}}},{slug:`candid`,name:`Candid`,kind:`connection`,tagline:`Research nonprofits and funders using Candid's data.`,surfaces:{scaffoldable:!1,registry:!0,gallery:!0},connection:{description:`Candid: research nonprofits, funders, and grants.`,mcp:{url:`https://mcp.candid.org/mcp`}}},{slug:`clickhouse`,name:`ClickHouse`,kind:`connection`,tagline:`Query and explore your ClickHouse Cloud data.`,surfaces:{scaffoldable:!1,registry:!0,gallery:!0},connection:{description:`ClickHouse Cloud: query and explore databases and tables.`,mcp:{url:`https://mcp.clickhouse.cloud/mcp`}}},{slug:`cloudinary`,name:`Cloudinary`,kind:`connection`,tagline:`Manage, transform, and deliver your images and videos.`,surfaces:{scaffoldable:!1,registry:!0,gallery:!0},connection:{description:`Cloudinary: manage, transform, and deliver image and video assets.`,mcp:{url:`https://asset-management.mcp.cloudinary.com/sse`}}},{slug:`coda`,name:`Coda`,kind:`connection`,tagline:`Create, search, and update docs and tables.`,surfaces:{scaffoldable:!1,registry:!0,gallery:!0},connection:{description:`Coda: create, search, and update docs and tables.`,mcp:{url:`https://coda.io/apis/mcp`}}},{slug:`context`,name:`context.dev`,kind:`connection`,tagline:`search, scrape, extract, and monitor live web data.`,surfaces:{scaffoldable:!1,registry:!0,gallery:!0},connection:{description:`context.dev: search the live web, scrape and crawl sites, extract structured data, parse files, retrieve brand intelligence, monitor changes, and run batch jobs.`,mcp:{url:`https://mcp.context.dev/mcp`}}},{slug:`flora`,name:`FLORA`,kind:`connection`,tagline:`Generate image, video, audio, text, and 3D assets through FLORA's MCP server.`,surfaces:{scaffoldable:!1,registry:!0,gallery:!0},connection:{description:`FLORA: generate image, video, audio, text, and 3D assets on a canvas.`,mcp:{url:`https://agents.flora.ai/mcp`}}},{slug:`egnyte`,name:`Egnyte`,kind:`connection`,tagline:`Securely access and analyze Egnyte content.`,surfaces:{scaffoldable:!1,registry:!0,gallery:!0},connection:{description:`Egnyte: search, access, and analyze governed content.`,mcp:{url:`https://mcp-server.egnyte.com/mcp`}}},{slug:`embat`,name:`Embat`,kind:`connection`,tagline:`Ask Embat about cash, debt, payments, and accounting.`,surfaces:{scaffoldable:!1,registry:!0,gallery:!0},connection:{description:`Embat: cash, debt, payments, and accounting.`,mcp:{url:`https://tellme.embat.io/mcp`}}},{slug:`firecrawl`,name:`Firecrawl`,kind:`connection`,tagline:`Search, scrape, map, crawl, parse, and monitor web content.`,surfaces:{scaffoldable:!1,registry:!0,gallery:!0},connection:{description:`Firecrawl: search, scrape, map, crawl, parse, and monitor web content.`,mcp:{url:`https://mcp.firecrawl.dev/v2/mcp`}}},{slug:`hugging-face`,name:`Hugging Face`,kind:`connection`,tagline:`Access the Hugging Face Hub and thousands of Gradio apps.`,surfaces:{scaffoldable:!1,registry:!0,gallery:!0},connection:{description:`Hugging Face: models, datasets, Spaces, and Gradio apps on the Hub.`,mcp:{url:`https://huggingface.co/mcp?login&gradio=none`}}},{slug:`local-falcon`,name:`Local Falcon`,kind:`connection`,tagline:`AI visibility and local search intelligence.`,surfaces:{scaffoldable:!1,registry:!0,gallery:!0},connection:{description:`Local Falcon: local search rankings and AI visibility reports.`,mcp:{url:`https://mcp.localfalcon.com`}}},{slug:`make`,name:`Make`,kind:`connection`,tagline:`Run Make scenarios and manage your Make account.`,surfaces:{scaffoldable:!1,registry:!0,gallery:!0},connection:{description:`Make: run scenarios and manage automations.`,mcp:{url:`https://mcp.make.com`}}},{slug:`manufact`,name:`Manufact`,kind:`connection`,tagline:`Deploy and monitor MCP servers with Manufact.`,surfaces:{scaffoldable:!1,registry:!0,gallery:!0},connection:{description:`Manufact: deploy and monitor MCP servers.`,mcp:{url:`https://mcp.manufact.com/mcp`}}},{slug:`mem0`,name:`Mem0`,kind:`connection`,tagline:`Persistent memory for AI agents and assistants.`,surfaces:{scaffoldable:!1,registry:!0,gallery:!0},connection:{description:`Mem0: store and retrieve persistent agent memory.`,mcp:{url:`https://mcp.mem0.ai/mcp`}}},{slug:`miro`,name:`Miro`,kind:`connection`,tagline:`Access and create content on Miro boards.`,surfaces:{scaffoldable:!1,registry:!0,gallery:!0},connection:{description:`Miro: read and create content on boards.`,mcp:{url:`https://mcp.miro.com/`}}},{slug:`mixpanel`,name:`Mixpanel`,kind:`connection`,tagline:`Analyze, query, and manage your Mixpanel data.`,surfaces:{scaffoldable:!1,registry:!0,gallery:!0},connection:{description:`Mixpanel: analyze, query, and manage analytics data.`,mcp:{url:`https://mcp.mixpanel.com/mcp`}}},{slug:`natural`,name:`Natural`,kind:`connection`,tagline:`Send, request, and manage payments with Natural.`,surfaces:{scaffoldable:!1,registry:!0,gallery:!0},connection:{description:`Natural: agentic payments — send and request payments, check balances, and move funds.`,mcp:{url:`https://mcp.natural.com/mcp`}}},{slug:`neon`,name:`Neon`,kind:`connection`,tagline:`Manage Neon projects, run queries, and make schema changes.`,surfaces:{scaffoldable:!1,registry:!0,gallery:!0},connection:{description:`Neon: manage projects, run queries, and make schema changes.`,mcp:{url:`https://mcp.neon.tech/mcp`}}},{slug:`netlify`,name:`Netlify`,kind:`connection`,tagline:`Create, deploy, manage, and secure websites on Netlify.`,surfaces:{scaffoldable:!1,registry:!0,gallery:!0},connection:{description:`Netlify: create, deploy, manage, and secure sites.`,mcp:{url:`https://netlify-mcp.netlify.app/mcp`}}},{slug:`oreilly`,name:`O'Reilly`,kind:`connection`,tagline:`Discover O'Reilly's expert learning content.`,surfaces:{scaffoldable:!1,registry:!0,gallery:!0},connection:{description:`O'Reilly: search books, courses, and learning content.`,mcp:{url:`https://api.oreilly.com/api/content-discovery/v1/mcp/`}}},{slug:`planetscale`,name:`PlanetScale`,kind:`connection`,tagline:`Authenticated access to your PlanetScale Postgres and MySQL databases.`,surfaces:{scaffoldable:!1,registry:!0,gallery:!0},connection:{description:`PlanetScale: query Postgres and MySQL databases.`,mcp:{url:`https://mcp.pscale.dev/mcp/planetscale`}}},{slug:`posthog`,name:`PostHog`,kind:`connection`,tagline:`Query, analyze, and manage your PostHog insights.`,surfaces:{scaffoldable:!1,registry:!0,gallery:!0},connection:{description:`PostHog: insights, events, and feature flags.`,mcp:{url:`https://mcp.posthog.com/mcp`}}},{slug:`postman`,name:`Postman`,kind:`connection`,tagline:`Give API context to your coding agents with Postman.`,surfaces:{scaffoldable:!1,registry:!0,gallery:!0},connection:{description:`Postman: APIs, collections, and workspaces.`,mcp:{url:`https://mcp.postman.com/minimal`}}},{slug:`razorpay`,name:`Razorpay`,kind:`connection`,tagline:`Razorpay payments, settlements, and dashboard data.`,surfaces:{scaffoldable:!1,registry:!0,gallery:!0},connection:{description:`Razorpay: payments, settlements, and dashboard data.`,mcp:{url:`https://mcp.razorpay.com/mcp`}}},{slug:`sanity`,name:`Sanity`,kind:`connection`,tagline:`Query and edit Sanity content, inspect schemas, and manage releases.`,surfaces:{scaffoldable:!1,registry:!0,gallery:!0},connection:{description:`Sanity: query content with GROQ, edit documents, inspect schemas, and manage releases.`,mcp:{url:`https://mcp.sanity.io`}}},{slug:`sentry`,name:`Sentry`,kind:`connection`,tagline:`Search, query, and debug errors intelligently.`,surfaces:{scaffoldable:!1,registry:!0,gallery:!0},connection:{description:`Sentry: search, query, and debug errors and issues.`,mcp:{url:`https://mcp.sentry.dev/mcp`}}},{slug:`similarweb`,name:`Similarweb`,kind:`connection`,tagline:`Real-time web, mobile app, and market data.`,surfaces:{scaffoldable:!1,registry:!0,gallery:!0},connection:{description:`Similarweb: web traffic, app, and market intelligence data.`,mcp:{url:`https://mcp.similarweb.com`}}},{slug:`shopify`,name:`Shopify`,kind:`connection`,tagline:`Search products and manage carts and checkouts on a Shopify storefront.`,surfaces:{scaffoldable:!1,registry:!0,gallery:!0},connection:{description:`Search products and build carts and checkouts on a Shopify storefront.`,mcp:{url:`https://{shop}.myshopify.com/api/ucp/mcp`}}},{slug:`stripe`,name:`Stripe`,kind:`connection`,tagline:`Payment processing and financial infrastructure tools.`,surfaces:{scaffoldable:!1,registry:!0,gallery:!0},connection:{description:`Stripe: payments, customers, billing, and financial infrastructure.`,mcp:{url:`https://mcp.stripe.com`}}},{slug:`supabase`,name:`Supabase`,kind:`connection`,tagline:`Manage databases, authentication, and storage.`,surfaces:{scaffoldable:!1,registry:!0,gallery:!0},connection:{description:`Supabase: databases, authentication, and storage.`,mcp:{url:`https://mcp.supabase.com/mcp`}}},{slug:`ticket-tailor`,name:`Ticket Tailor`,kind:`connection`,tagline:`Manage tickets, orders, and events with Ticket Tailor.`,surfaces:{scaffoldable:!1,registry:!0,gallery:!0},connection:{description:`Ticket Tailor: events, tickets, and orders.`,mcp:{url:`https://mcp.tickettailor.ai/mcp`}}},{slug:`ticktick`,name:`TickTick`,kind:`connection`,tagline:`Search, create, and manage your tasks and habits in TickTick.`,surfaces:{scaffoldable:!1,registry:!0,gallery:!0},connection:{description:`TickTick: tasks, habits, and lists.`,mcp:{url:`https://mcp.ticktick.com`}}},{slug:`tinybird`,name:`Tinybird`,kind:`connection`,tagline:`Query pipes and data sources in your Tinybird Workspace.`,surfaces:{scaffoldable:!1,registry:!0,gallery:!0},connection:{description:`Tinybird: query pipes and data sources, and run SQL. A token grants one Workspace, so add a connection per Workspace.`,mcp:{url:`https://mcp.tinybird.co`}}},{slug:`todoist`,name:`Todoist`,kind:`connection`,tagline:`Search, complete, and manage your tasks in Todoist.`,surfaces:{scaffoldable:!1,registry:!0,gallery:!0},connection:{description:`Todoist: search, complete, and manage tasks.`,mcp:{url:`https://ai.todoist.net/mcp`}}},{slug:`webflow`,name:`Webflow`,kind:`connection`,tagline:`Manage Webflow CMS, pages, assets, and sites.`,surfaces:{scaffoldable:!1,registry:!0,gallery:!0},connection:{description:`Webflow: CMS items, pages, assets, and sites.`,mcp:{url:`https://mcp.webflow.com/mcp`}}},{slug:`wix`,name:`Wix`,kind:`connection`,tagline:`Manage and build sites and apps on Wix.`,surfaces:{scaffoldable:!1,registry:!0,gallery:!0},connection:{description:`Wix: manage and build sites and apps.`,mcp:{url:`https://mcp.wix.com/mcp`}}},{slug:`zapier`,name:`Zapier`,kind:`connection`,tagline:`Automate workflows across thousands of apps.`,surfaces:{scaffoldable:!1,registry:!0,gallery:!0},connection:{description:`Zapier: run and manage automations across apps.`,mcp:{url:`https://mcp.zapier.com/api/v1/connect`}}},{slug:`zomato`,name:`Zomato`,kind:`connection`,tagline:`Online food ordering and delivery through Zomato.`,surfaces:{scaffoldable:!1,registry:!0,gallery:!0},connection:{description:`Zomato: food ordering and delivery.`,mcp:{url:`https://mcp-server.zomato.com/mcp`}}},{slug:`braintrust`,name:`Braintrust`,kind:`instrumentation`,tagline:`Export AI SDK spans to Braintrust for tracing, evals, and monitoring.`,surfaces:{scaffoldable:!1,registry:!0,gallery:!0}},{slug:`posthog-instrumentation`,name:`PostHog`,kind:`instrumentation`,tagline:`Send agent traces and generations to PostHog AI Observability.`,surfaces:{scaffoldable:!1,registry:!0,gallery:!0}},{slug:`sentry-instrumentation`,name:`Sentry`,kind:`instrumentation`,tagline:`Send agent traces to Sentry's OTLP endpoint for tracing and debugging.`,surfaces:{scaffoldable:!1,registry:!0,gallery:!0}},{slug:`datadog-instrumentation`,name:`Datadog`,kind:`instrumentation`,tagline:`Export agent traces to Datadog APM alongside the rest of your stack.`,surfaces:{scaffoldable:!1,registry:!0,gallery:!0}},{slug:`honeycomb-instrumentation`,name:`Honeycomb`,kind:`instrumentation`,tagline:`Send OpenTelemetry traces to Honeycomb and query every agent turn.`,surfaces:{scaffoldable:!1,registry:!0,gallery:!0}},{slug:`arize`,name:`Arize`,kind:`instrumentation`,tagline:`Export traces to Arize AX for LLM observability and evaluation.`,surfaces:{scaffoldable:!1,registry:!0,gallery:!0}},{slug:`raindrop`,name:`Raindrop`,kind:`instrumentation`,tagline:`Send agent traces to Raindrop to detect and debug AI product issues.`,surfaces:{scaffoldable:!1,registry:!0,gallery:!0}},{slug:`oodle`,name:`Oodle`,kind:`instrumentation`,tagline:`Send agent traces to Oodle over OpenTelemetry.`,surfaces:{scaffoldable:!1,registry:!0,gallery:!0}},{slug:`jaeger`,name:`Jaeger`,kind:`instrumentation`,tagline:`Trace your agent with a local or self-hosted Jaeger OTLP backend.`,surfaces:{scaffoldable:!1,registry:!0,gallery:!0}}],n=new Map(t.map(e=>[e.slug,e]));function r(e){return n.get(e)}function i(e){return t.filter(t=>t.kind===e)}function a(){return i(`connection`)}function o(){return i(`channel`)}function s(){return i(`extension`)}function c(){return i(`instrumentation`)}function l(){return i(`memory`)}export{t as INTEGRATIONS,o as channelEntries,a as connectionEntries,e as connectionProtocols,s as extensionEntries,r as getIntegrationEntry,c as instrumentationEntries,i as integrationsByKind,l as memoryEntries};
|