eve 0.37.0 → 0.38.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 +32 -0
- package/dist/src/channel/routes.d.ts +13 -3
- package/dist/src/channel/routes.js +1 -1
- package/dist/src/channel/session-callback.js +1 -1
- package/dist/src/channel/session.d.ts +2 -1
- package/dist/src/channel/session.js +1 -1
- package/dist/src/channel/types.d.ts +41 -0
- package/dist/src/chunks/{use-eve-agent-COmP-H8R.js → use-eve-agent-BbSsu99c.js} +79 -32
- package/dist/src/chunks/{use-eve-agent-CnppTEFk.js → use-eve-agent-Dt8Y5QtW.js} +78 -31
- package/dist/src/cli/acp/command.d.ts +2 -1
- package/dist/src/cli/acp/command.js +2 -2
- package/dist/src/cli/application-command.d.ts +8 -0
- package/dist/src/cli/application-command.js +1 -0
- package/dist/src/cli/application-root.d.ts +8 -0
- package/dist/src/cli/application-root.js +1 -0
- package/dist/src/cli/commands/build.d.ts +2 -1
- package/dist/src/cli/commands/build.js +1 -1
- package/dist/src/cli/commands/init-git.js +1 -1
- package/dist/src/cli/commands/init-recovery.d.ts +3 -0
- package/dist/src/cli/commands/init-recovery.js +3 -0
- package/dist/src/cli/commands/init-repl.js +1 -1
- package/dist/src/cli/commands/init-target.d.ts +21 -0
- package/dist/src/cli/commands/init-target.js +1 -0
- package/dist/src/cli/commands/init.js +1 -1
- package/dist/src/cli/commands/register-integration-commands.d.ts +2 -1
- package/dist/src/cli/commands/register-integration-commands.js +1 -1
- package/dist/src/cli/commands/register-project-commands.d.ts +2 -1
- package/dist/src/cli/commands/register-project-commands.js +1 -1
- package/dist/src/cli/commands/register-registry-commands.d.ts +2 -1
- package/dist/src/cli/commands/register-registry-commands.js +4 -1
- package/dist/src/cli/commands/registry-recovery.d.ts +14 -0
- package/dist/src/cli/commands/registry-recovery.js +1 -0
- package/dist/src/cli/commands/registry.d.ts +2 -5
- package/dist/src/cli/commands/registry.js +1 -1
- package/dist/src/cli/dev/diagnostic-dump.js +1 -1
- package/dist/src/cli/dev/environment.js +1 -1
- package/dist/src/cli/dev/tui/runner.d.ts +8 -0
- package/dist/src/cli/dev/tui/runner.js +1 -1
- package/dist/src/cli/dev/tui/subagent-pump.d.ts +27 -22
- package/dist/src/cli/dev/tui/subagent-pump.js +1 -1
- package/dist/src/cli/dev/tui/terminal-renderer.d.ts +16 -0
- package/dist/src/cli/dev/tui/terminal-renderer.js +12 -12
- package/dist/src/cli/dev/tui/tool-presentation.js +1 -1
- package/dist/src/cli/invoke/command.d.ts +3 -2
- package/dist/src/cli/invoke/command.js +1 -1
- package/dist/src/cli/run.d.ts +3 -2
- package/dist/src/cli/run.js +3 -3
- package/dist/src/client/eve-agent-store.d.ts +15 -3
- package/dist/src/client/eve-agent-store.js +2 -2
- package/dist/src/client/message-response.d.ts +10 -2
- package/dist/src/client/message-response.js +1 -1
- package/dist/src/client/open-stream.d.ts +2 -0
- package/dist/src/client/open-stream.js +1 -1
- package/dist/src/client/session.js +1 -1
- package/dist/src/compiled/.vendor-stamp.json +5 -1
- package/dist/src/compiled/@ai-sdk/otel/index.js +3 -3
- package/dist/src/compiled/@chat-adapter/slack/index.js +25 -25
- package/dist/src/compiled/@modelcontextprotocol/server/LICENSE +216 -0
- package/dist/src/compiled/@modelcontextprotocol/server/index.d.ts +98 -0
- package/dist/src/compiled/@modelcontextprotocol/server/index.js +80 -0
- package/dist/src/compiled/@opentelemetry/api/index.js +1 -1
- package/dist/src/compiled/@opentelemetry/otlp-transformer/index.js +1 -1
- package/dist/src/compiled/@photon-ai/chat-adapter-imessage/index.js +61 -61
- package/dist/src/compiled/@vercel/oidc/index.js +14 -14
- package/dist/src/compiled/@vercel/otel/index.js +1 -1
- package/dist/src/compiled/@vercel/sandbox/index.js +1 -1
- package/dist/src/compiled/@workflow/core/index.js +1 -1
- package/dist/src/compiled/@workflow/core/private.js +1 -1
- package/dist/src/compiled/@workflow/core/runtime.js +2 -2
- package/dist/src/compiled/@workflow/core/workflow.js +1 -1
- package/dist/src/compiled/@workflow/errors/index.js +1 -1
- package/dist/src/compiled/@workflow/world-local/index.js +5 -5
- package/dist/src/compiled/@workflow/world-vercel/index.js +13 -13
- package/dist/src/compiled/_chunks/workflow/{attribute-changes-BoH7JsWp.js → attribute-changes-DZtQkszH.js} +1 -1
- package/dist/src/compiled/_chunks/workflow/chunk-5MU5Z6L3-B_3nkJFi.js +1 -0
- package/dist/src/compiled/_chunks/workflow/{chunk-NWCAEW5Y-Oxw40oRR.js → chunk-NWCAEW5Y-BgbcH0OK.js} +1 -1
- package/dist/src/compiled/_chunks/workflow/{dist-DlFv0aHY.js → dist-CPlyFOVo.js} +1 -1
- package/dist/src/compiled/_chunks/workflow/{dist-tJoQXAF6.js → dist-DpYyXbJv.js} +1 -1
- package/dist/src/compiled/_chunks/workflow/{dist-CRTn4Sg8.js → dist-xQXN70ED.js} +1 -1
- package/dist/src/compiled/_chunks/workflow/esm-seIr7a6j.js +1 -0
- package/dist/src/compiled/_chunks/workflow/{frames-CTpeJYEQ.js → frames-BBs-9k1d.js} +2 -2
- package/dist/src/compiled/_chunks/workflow/{functions-CeeNvKsq.js → functions-DAYiHNti.js} +1 -1
- package/dist/src/compiled/_chunks/workflow/{getMachineId-bsd-WEBNKY2R-CEYkx6Nv.js → getMachineId-bsd-WEBNKY2R-BTaxrQ52.js} +1 -1
- package/dist/src/compiled/_chunks/workflow/{getMachineId-darwin-LT47KAXP-DPwWlhif.js → getMachineId-darwin-LT47KAXP-DhYmwE_R.js} +1 -1
- package/dist/src/compiled/_chunks/workflow/{getMachineId-linux-LTVQO6VW-DAFXHwZp.js → getMachineId-linux-LTVQO6VW-Dru_L5ru.js} +1 -1
- package/dist/src/compiled/_chunks/workflow/{getMachineId-unsupported-UKWBA27G-BZKOI8mG.js → getMachineId-unsupported-UKWBA27G-DGfoqVW1.js} +1 -1
- package/dist/src/compiled/_chunks/workflow/{getMachineId-win-NLJKOPY6-r7_CJB5o.js → getMachineId-win-NLJKOPY6-CLM98q4X.js} +1 -1
- package/dist/src/compiled/_chunks/workflow/{private-tvMBynnC.js → private-UQtz8ZcW.js} +1 -1
- package/dist/src/compiled/_chunks/workflow/{resume-hook-BPQHjeY5.js → resume-hook-CYtSorp6.js} +1 -1
- package/dist/src/compiled/_chunks/workflow/{rolldown-runtime-DaDcL9Zw.js → rolldown-runtime-8V8biNmG.js} +1 -1
- package/dist/src/compiled/_chunks/workflow/{run-DQ5dOyjm.js → run-Cjo0A3NO.js} +1 -1
- package/dist/src/compiled/_chunks/workflow/{signal-exit-C8vsI6zj.js → signal-exit-o3IPQwwv.js} +1 -1
- package/dist/src/compiled/_chunks/workflow/sleep-C1P0OWBm.js +1 -0
- package/dist/src/compiled/_chunks/workflow/{token-DHD-q-fS.js → token-DGzfw-Vb.js} +1 -1
- package/dist/src/compiled/_chunks/workflow/{token-DtCUEpJs.js → token-DNbxVpeq.js} +1 -1
- package/dist/src/compiled/_chunks/workflow/token-util-BneBe0g5.js +27 -0
- package/dist/src/compiled/_chunks/workflow/{token-util-Ldar52H7.js → token-util-DjMgNdXS.js} +1 -1
- package/dist/src/compiled/_chunks/workflow/{undici-CUIybhQ2.js → undici-BBG5cZTy.js} +1 -1
- package/dist/src/compiled/_chunks/workflow/{wait-until-DK2lnH6U.js → wait-until-CT1ve8qB.js} +3 -3
- package/dist/src/compiled/_chunks/workflow/{wrapper-CMGju7QA.js → wrapper-CQNxP9mU.js} +3 -3
- package/dist/src/compiled/_chunks/workflow/{ws-transport-Csi6Cydc.js → ws-transport-beXxD0s_.js} +1 -1
- package/dist/src/compiled/env-runner/node-worker.js +1 -1
- package/dist/src/compiled/jose/index.js +1 -1
- package/dist/src/compiled/shadcn-registry/index.js +403 -403
- package/dist/src/compiler/artifacts.js +1 -1
- package/dist/src/compiler/compile-agent.js +2 -2
- package/dist/src/compiler/extension-compatibility.d.ts +20 -10
- 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-extension.d.ts +8 -5
- package/dist/src/compiler/normalize-extension.js +1 -1
- package/dist/src/compiler/normalize-manifest.js +1 -1
- package/dist/src/compiler/normalize-subagent.d.ts +1 -1
- package/dist/src/compiler/normalize-subagent.js +1 -1
- package/dist/src/context/serialized-dynamic-model-selection.d.ts +2 -0
- package/dist/src/context/serialized-dynamic-model-selection.js +1 -0
- package/dist/src/discover/discover-agent.js +1 -1
- package/dist/src/discover/extensions.d.ts +0 -6
- package/dist/src/discover/extensions.js +1 -1
- package/dist/src/evals/cli/eval.d.ts +1 -1
- package/dist/src/evals/cli/eval.js +1 -1
- package/dist/src/execution/agent-handle-dispatch.d.ts +15 -1
- package/dist/src/execution/agent-handle-dispatch.js +1 -1
- package/dist/src/execution/cancel-descendant-turns-step.js +1 -1
- package/dist/src/execution/delegated-parent-notification.d.ts +17 -0
- package/dist/src/execution/delegated-parent-notification.js +1 -1
- package/dist/src/execution/deliver-payloads.js +1 -1
- package/dist/src/execution/dispatch-runtime-actions-shared.d.ts +155 -0
- package/dist/src/execution/dispatch-runtime-actions-shared.js +1 -0
- package/dist/src/execution/dispatch-runtime-actions-step.d.ts +18 -14
- package/dist/src/execution/dispatch-runtime-actions-step.js +1 -1
- package/dist/src/execution/dispatch-workflow-runtime-actions-step.d.ts +7 -2
- package/dist/src/execution/dispatch-workflow-runtime-actions-step.js +1 -1
- package/dist/src/execution/effective-output-schema.d.ts +21 -0
- package/dist/src/execution/effective-output-schema.js +1 -0
- package/dist/src/execution/eve-workflow-attributes.d.ts +2 -0
- package/dist/src/execution/node-step.js +1 -1
- package/dist/src/execution/parked-delivery-wait.d.ts +8 -12
- package/dist/src/execution/parked-delivery-wait.js +1 -1
- package/dist/src/execution/{route-proxied-deliver-step.d.ts → proxied-deliver-step.d.ts} +7 -4
- package/dist/src/execution/proxied-deliver-step.js +1 -0
- package/dist/src/execution/remote-agent-dispatch.d.ts +32 -0
- package/dist/src/execution/remote-agent-dispatch.js +1 -1
- package/dist/src/execution/remote-agent-route-url.d.ts +2 -0
- package/dist/src/execution/remote-agent-route-url.js +1 -0
- package/dist/src/execution/route-child-delivery.d.ts +2 -1
- package/dist/src/execution/route-child-delivery.js +1 -1
- package/dist/src/execution/sandbox/bindings/docker-templates.js +1 -1
- package/dist/src/execution/sandbox/bindings/just-bash.js +1 -1
- package/dist/src/execution/sandbox/bindings/microsandbox-templates.js +1 -1
- package/dist/src/execution/sandbox/prewarm.js +1 -1
- package/dist/src/execution/session-callback-step.d.ts +11 -0
- package/dist/src/execution/session-callback-step.js +1 -1
- package/dist/src/execution/session-command-wire.js +1 -1
- package/dist/src/execution/session-state-cursor.d.ts +25 -0
- package/dist/src/execution/session-state-cursor.js +1 -0
- package/dist/src/execution/settle-cancelled-turn-step.d.ts +2 -0
- package/dist/src/execution/settle-cancelled-turn-step.js +1 -1
- package/dist/src/execution/subagent-event-proxy-step.d.ts +15 -0
- package/dist/src/execution/subagent-event-proxy-step.js +1 -1
- package/dist/src/execution/subagent-hitl-proxy.d.ts +14 -7
- package/dist/src/execution/subagent-hitl-proxy.js +1 -1
- package/dist/src/execution/subagent-start-local.d.ts +29 -0
- package/dist/src/execution/subagent-start-local.js +1 -0
- package/dist/src/execution/subagent-start-remote.d.ts +23 -0
- package/dist/src/execution/subagent-start-remote.js +1 -0
- package/dist/src/execution/task-event-callback.d.ts +13 -0
- package/dist/src/execution/task-event-callback.js +1 -0
- package/dist/src/execution/task-input-capability.d.ts +4 -0
- package/dist/src/execution/task-input-capability.js +1 -0
- package/dist/src/execution/tasks/child/steps.d.ts +46 -0
- package/dist/src/execution/tasks/child/steps.js +1 -0
- package/dist/src/execution/tasks/child/workflow.d.ts +31 -0
- package/dist/src/execution/tasks/child/workflow.js +1 -0
- package/dist/src/execution/tasks/parent/agent-identity.d.ts +13 -0
- package/dist/src/execution/tasks/parent/agent-identity.js +1 -0
- package/dist/src/execution/tasks/parent/agent-views.d.ts +6 -0
- package/dist/src/execution/tasks/parent/agent-views.js +1 -0
- package/dist/src/execution/tasks/parent/continuation-dispatch.d.ts +37 -0
- package/dist/src/execution/tasks/parent/continuation-dispatch.js +1 -0
- package/dist/src/execution/tasks/parent/control-shared.d.ts +36 -0
- package/dist/src/execution/tasks/parent/control-shared.js +1 -0
- package/dist/src/execution/tasks/parent/delegate.d.ts +70 -0
- package/dist/src/execution/tasks/parent/delegate.js +1 -0
- package/dist/src/execution/tasks/parent/dispatch-task-step.d.ts +19 -0
- package/dist/src/execution/tasks/parent/dispatch-task-step.js +1 -0
- package/dist/src/execution/tasks/parent/dispatch.d.ts +33 -0
- package/dist/src/execution/tasks/parent/dispatch.js +1 -0
- package/dist/src/execution/tasks/parent/hitl-proxy-steps.d.ts +29 -0
- package/dist/src/execution/tasks/parent/hitl-proxy-steps.js +1 -0
- package/dist/src/execution/tasks/parent/run-parent.d.ts +72 -0
- package/dist/src/execution/tasks/parent/run-parent.js +1 -0
- package/dist/src/execution/tasks/parent/send.d.ts +25 -0
- package/dist/src/execution/tasks/parent/send.js +1 -0
- package/dist/src/execution/tasks/workflow-target.d.ts +2 -0
- package/dist/src/execution/tasks/workflow-target.js +1 -0
- package/dist/src/execution/terminate-child-sessions-step.d.ts +1 -0
- package/dist/src/execution/terminate-child-sessions-step.js +1 -1
- package/dist/src/execution/turn-control-receiver.d.ts +10 -0
- package/dist/src/execution/turn-control-receiver.js +1 -1
- package/dist/src/execution/turn-dispatch.d.ts +2 -0
- package/dist/src/execution/turn-dispatch.js +1 -1
- package/dist/src/execution/turn-execution-cursor.d.ts +2 -8
- package/dist/src/execution/turn-execution-cursor.js +1 -1
- package/dist/src/execution/turn-workflow.js +1 -1
- package/dist/src/execution/workflow-callback-url.d.ts +5 -0
- package/dist/src/execution/workflow-callback-url.js +1 -1
- package/dist/src/execution/workflow-entry.js +1 -1
- package/dist/src/execution/workflow-runtime.d.ts +9 -0
- package/dist/src/execution/workflow-runtime.js +1 -1
- package/dist/src/execution/workflow-steps.d.ts +7 -21
- package/dist/src/execution/workflow-steps.js +1 -1
- package/dist/src/harness/advertised-tools.js +1 -1
- package/dist/src/harness/authorization.js +1 -1
- package/dist/src/harness/execute-tool.d.ts +7 -0
- package/dist/src/harness/handles/prompt.d.ts +12 -0
- package/dist/src/harness/handles/prompt.js +2 -1
- package/dist/src/harness/handles/query.js +1 -1
- package/dist/src/harness/handles/store.d.ts +9 -2
- package/dist/src/harness/handles/store.js +1 -1
- package/dist/src/harness/handles/transitions.d.ts +10 -1
- package/dist/src/harness/handles/transitions.js +1 -1
- package/dist/src/harness/instrumentation/providers.js +1 -1
- package/dist/src/harness/instrumentation/runtime-context.d.ts +2 -0
- package/dist/src/harness/instrumentation/runtime-context.js +1 -1
- package/dist/src/harness/instrumentation/runtime.d.ts +3 -1
- package/dist/src/harness/proxy-input-requests.d.ts +21 -4
- package/dist/src/harness/proxy-input-requests.js +1 -1
- package/dist/src/harness/runtime-actions.d.ts +2 -0
- package/dist/src/harness/runtime-actions.js +1 -1
- package/dist/src/harness/session-limit-enforcement.js +1 -1
- package/dist/src/harness/tool-loop.js +2 -2
- package/dist/src/harness/workflow-runtime-action-state.js +1 -1
- package/dist/src/internal/application/cache-metadata.js +1 -1
- package/dist/src/internal/application/compiled-artifacts.js +2 -2
- package/dist/src/internal/application/optional-package-install.js +1 -1
- package/dist/src/internal/application/output-publication-lock.js +1 -1
- package/dist/src/internal/application/package.js +1 -1
- package/dist/src/internal/application/paths.js +1 -1
- package/dist/src/internal/application/tsconfig-dependencies.js +1 -1
- package/dist/src/internal/authored-definition/core.js +1 -1
- package/dist/src/internal/authored-module-evaluation-error.js +4 -4
- package/dist/src/internal/authored-module-loader.js +3 -3
- package/dist/src/internal/authored-package-boundary.js +1 -1
- package/dist/src/internal/authored-relative-extension-resolver.js +1 -1
- package/dist/src/internal/bundler/extension-scope-plugin.js +1 -1
- package/dist/src/internal/bundler/nitro-rolldown.js +1 -1
- package/dist/src/internal/instrumentation-layout.js +1 -1
- package/dist/src/internal/invocation/agent-invocation.d.ts +54 -0
- package/dist/src/internal/invocation/agent-invocation.js +1 -0
- package/dist/src/internal/invocation/attributes.d.ts +2 -0
- package/dist/src/internal/invocation/attributes.js +1 -0
- package/dist/src/internal/invocation/metadata.d.ts +9 -0
- package/dist/src/internal/invocation/metadata.js +1 -0
- package/dist/src/internal/invocation/workflow-execution.d.ts +32 -0
- package/dist/src/internal/invocation/workflow-execution.js +1 -0
- package/dist/src/internal/materialized-authored-modules.js +1 -1
- package/dist/src/internal/mcp/http-security.d.ts +12 -0
- package/dist/src/internal/mcp/http-security.js +1 -0
- package/dist/src/internal/mcp/protected-resource.d.ts +9 -0
- package/dist/src/internal/mcp/protected-resource.js +1 -0
- package/dist/src/internal/mcp/streamable-http-server.d.ts +51 -0
- package/dist/src/internal/mcp/streamable-http-server.js +1 -0
- package/dist/src/internal/nitro/dev-runtime-artifacts-retention.js +1 -1
- package/dist/src/internal/nitro/dev-runtime-artifacts.js +1 -1
- package/dist/src/internal/nitro/dev-runtime-source-snapshot-copy.js +1 -1
- package/dist/src/internal/nitro/dev-runtime-source-snapshot-local-roots.js +1 -1
- package/dist/src/internal/nitro/dev-runtime-source-snapshot.js +1 -1
- package/dist/src/internal/nitro/host/application-route-registry.d.ts +88 -0
- package/dist/src/internal/nitro/host/application-route-registry.js +1 -0
- package/dist/src/internal/nitro/host/build-application.js +1 -1
- package/dist/src/internal/nitro/host/build-extension.js +1 -1
- package/dist/src/internal/nitro/host/build-vercel-agent-summary.js +1 -1
- package/dist/src/internal/nitro/host/channel-routes.d.ts +4 -11
- package/dist/src/internal/nitro/host/channel-routes.js +3 -3
- package/dist/src/internal/nitro/host/configure-nitro-routes.js +3 -3
- package/dist/src/internal/nitro/host/create-application-nitro.js +1 -1
- package/dist/src/internal/nitro/host/dev-authored-source-watcher.js +1 -1
- package/dist/src/internal/nitro/host/dev-runner.js +1 -1
- package/dist/src/internal/nitro/host/dev-workspace-extensions.js +1 -1
- package/dist/src/internal/nitro/host/extension-capability-requirements.js +1 -1
- package/dist/src/internal/nitro/host/local-tracing-runtime-plugin.js +1 -1
- package/dist/src/internal/nitro/host/nitro-bundler-config.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 +2 -2
- package/dist/src/internal/nitro/host/vercel-build-output-config.js +1 -1
- package/dist/src/internal/nitro/routes/channel-dispatch.js +1 -1
- package/dist/src/internal/nitro/routes/channel-route-context.d.ts +14 -0
- package/dist/src/internal/nitro/routes/channel-route-context.js +1 -1
- package/dist/src/internal/nitro/routes/runtime-stack.d.ts +2 -0
- package/dist/src/internal/nitro/routes/runtime-stack.js +1 -1
- package/dist/src/internal/process/pnpm.js +1 -1
- package/dist/src/internal/vercel-agent-summary.d.ts +1 -1
- package/dist/src/internal/workflow/development-world-client.js +1 -1
- package/dist/src/internal/workflow/development-world-server.js +1 -1
- package/dist/src/internal/workflow-bundle/builder-support.d.ts +12 -8
- package/dist/src/internal/workflow-bundle/builder-support.js +8 -7
- package/dist/src/internal/workflow-bundle/builder.d.ts +1 -1
- package/dist/src/internal/workflow-bundle/builder.js +2 -3
- package/dist/src/internal/workflow-bundle/workflow-builders.js +1 -1
- package/dist/src/protocol/message.d.ts +28 -0
- package/dist/src/protocol/message.js +2 -2
- package/dist/src/protocol/routes.d.ts +14 -0
- package/dist/src/protocol/routes.js +1 -1
- package/dist/src/public/channels/auth.d.ts +36 -0
- package/dist/src/public/channels/auth.js +1 -1
- package/dist/src/public/channels/discord/discordChannel.d.ts +2 -0
- package/dist/src/public/channels/discord/discordChannel.js +1 -1
- package/dist/src/public/channels/eve.d.ts +2 -0
- package/dist/src/public/channels/eve.js +1 -1
- package/dist/src/public/channels/github/dispatch.js +1 -1
- package/dist/src/public/channels/github/githubChannel.d.ts +2 -0
- package/dist/src/public/channels/linear/linearChannel.d.ts +2 -0
- package/dist/src/public/channels/linear/linearChannel.js +1 -1
- package/dist/src/public/channels/mcp.d.ts +19 -0
- package/dist/src/public/channels/mcp.js +1 -0
- package/dist/src/public/channels/photon/photonIMessageChannel.d.ts +2 -0
- package/dist/src/public/channels/photon/photonIMessageChannel.js +1 -1
- package/dist/src/public/channels/slack/slackChannel.d.ts +3 -1
- package/dist/src/public/channels/slack/slackChannel.js +1 -1
- package/dist/src/public/channels/teams/teamsChannel.d.ts +2 -0
- package/dist/src/public/channels/teams/teamsChannel.js +1 -1
- package/dist/src/public/channels/telegram/telegramChannel.d.ts +2 -0
- package/dist/src/public/channels/telegram/telegramChannel.js +1 -1
- package/dist/src/public/channels/twilio/twilioChannel.d.ts +2 -0
- package/dist/src/public/channels/twilio/twilioChannel.js +1 -1
- package/dist/src/public/definitions/channel.d.ts +2 -2
- package/dist/src/public/definitions/channel.js +1 -1
- package/dist/src/public/instrumentation/index.d.ts +9 -3
- package/dist/src/public/next/server.js +1 -1
- package/dist/src/public/nuxt/dev-server.js +1 -1
- package/dist/src/public/sveltekit/dev-server.js +1 -1
- package/dist/src/react/use-eve-agent.d.ts +4 -4
- package/dist/src/react/use-eve-agent.js +1 -1
- package/dist/src/runtime/actions/types.d.ts +9 -0
- package/dist/src/runtime/actions/types.js +1 -1
- package/dist/src/runtime/agent/bootstrap.js +1 -1
- package/dist/src/runtime/connections/authorization-complete-page.js +70 -28
- package/dist/src/runtime/framework-channels/index.js +1 -1
- package/dist/src/runtime/framework-tools/index.js +1 -1
- package/dist/src/runtime/framework-tools/tasks.d.ts +95 -0
- package/dist/src/runtime/framework-tools/tasks.js +1 -0
- package/dist/src/runtime/prompt/compose.d.ts +1 -0
- package/dist/src/runtime/prompt/compose.js +1 -1
- package/dist/src/runtime/resolve-agent-graph.js +1 -1
- package/dist/src/runtime/resolve-agent.js +1 -1
- package/dist/src/runtime/session-callback-route.js +1 -1
- package/dist/src/runtime/task-input-response-route.d.ts +5 -0
- package/dist/src/runtime/task-input-response-route.js +1 -0
- package/dist/src/services/inspect-application.js +1 -1
- package/dist/src/setup/primitives/pm/pnpm.js +2 -2
- package/dist/src/setup/primitives/run-vercel.js +1 -1
- package/dist/src/setup/scaffold/create/add-to-project.js +1 -1
- package/dist/src/setup/scaffold/create/extension.js +1 -1
- package/dist/src/setup/scaffold/create/project.js +1 -1
- package/dist/src/setup/scaffold/create/web-template.d.ts +1 -1
- package/dist/src/setup/scaffold/create/web-template.js +8 -86
- package/dist/src/setup/scaffold/version-tokens.js +1 -1
- package/dist/src/setup/scaffold/workspace-root.js +1 -1
- package/dist/src/shared/agent-definition.d.ts +7 -0
- package/dist/src/svelte/index.js +1 -1
- package/dist/src/svelte/use-eve-agent.d.ts +3 -3
- package/dist/src/svelte/use-eve-agent.js +1 -1
- package/dist/src/tasks/json.d.ts +88 -0
- package/dist/src/tasks/json.js +1 -0
- package/dist/src/tasks/session-index.d.ts +48 -0
- package/dist/src/tasks/session-index.js +1 -0
- package/dist/src/tasks/task-id.d.ts +34 -0
- package/dist/src/tasks/task-id.js +1 -0
- package/dist/src/tasks/transitions.d.ts +23 -0
- package/dist/src/tasks/transitions.js +1 -0
- package/dist/src/tasks/types.d.ts +295 -0
- package/dist/src/tasks/types.js +1 -0
- package/dist/src/tasks/wire.d.ts +26 -0
- package/dist/src/tasks/wire.js +1 -0
- package/dist/src/tracing/install-instrumentation-runtime.d.ts +2 -1
- package/dist/src/tracing/install-instrumentation-runtime.js +1 -1
- package/dist/src/tracing/otel-declaration.d.ts +32 -3
- package/dist/src/tracing/otel-declaration.js +1 -1
- package/dist/src/tracing/otel-registration.js +1 -1
- package/dist/src/vue/index.js +1 -1
- package/dist/src/vue/use-eve-agent.d.ts +3 -3
- package/dist/src/vue/use-eve-agent.js +1 -1
- package/docs/channels/custom.mdx +1 -1
- package/docs/channels/discord.mdx +1 -1
- package/docs/channels/eve.mdx +15 -2
- package/docs/channels/github.mdx +1 -1
- package/docs/channels/linear.mdx +1 -1
- package/docs/channels/overview.mdx +1 -1
- package/docs/channels/photon.mdx +1 -1
- package/docs/channels/slack.mdx +1 -1
- package/docs/channels/teams.mdx +1 -1
- package/docs/channels/telegram.mdx +1 -1
- package/docs/channels/twilio.mdx +1 -1
- package/docs/extensions.md +10 -6
- package/docs/guides/client/streaming.mdx +7 -6
- package/docs/guides/frontend/overview.mdx +10 -8
- package/docs/guides/frontend/use-eve-agent-svelte.mdx +10 -10
- package/docs/guides/frontend/use-eve-agent-vue.mdx +10 -10
- package/docs/install-integrations.mdx +4 -0
- package/docs/reference/cli.md +1 -1
- package/docs/schedules.mdx +2 -2
- package/docs/tools/human-in-the-loop.md +3 -1
- package/package.json +7 -1
- package/dist/src/compiled/_chunks/workflow/chunk-5MU5Z6L3-CaJgXkVg.js +0 -1
- package/dist/src/compiled/_chunks/workflow/sleep-CzdoBiqy.js +0 -1
- package/dist/src/compiled/_chunks/workflow/src-Cj3P1ChQ.js +0 -1
- package/dist/src/compiled/_chunks/workflow/token-util-DNwIAn_u.js +0 -27
- package/dist/src/execution/route-proxied-deliver-step.js +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{createHash}from"node:crypto";import{expectObjectRecord}from"#internal/authored-module.js";import{
|
|
2
|
-
`),moduleType:`js`}}}:null,...n.plugins,t.extensionScopeNamespace===void 0?null:createFixedNamespaceScopePlugin(t.extensionScopeNamespace),createAuthoredRelativeExtensionResolverPlugin({extensions:RESOLVE_EXTENSIONS}),createAuthoredAssetImportPlugin(),createAuthoredPackageTsConfigPathsPlugin({appPackageRoot:
|
|
1
|
+
import{createHash}from"node:crypto";import{expectObjectRecord}from"#internal/authored-module.js";import{dirname,join,resolve}from"node:path";import{existsSync,mkdirSync,writeFileSync}from"node:fs";import{createCompiledModuleMapSource}from"#compiler/module-map.js";import{buildSingleRolldownChunk,buildWithNitroRolldown}from"#internal/bundler/nitro-rolldown.js";import{createAuthoredAssetImportPlugin}from"#internal/authored-asset-import-plugin.js";import{assertNoWorkflowDirectivePrologue}from"#internal/authored-directive-prologue.js";import{createAuthoredModuleBundleError}from"#internal/authored-module-bundle.js";import{createAuthoredModuleEvaluationError}from"#internal/authored-module-evaluation-error.js";import{createAuthoredPackageTsConfigPathsPlugin}from"#internal/authored-package-tsconfig-paths.js";import{createAuthoredRelativeExtensionResolverPlugin}from"#internal/authored-relative-extension-resolver.js";import{createExtensionScopePlugin,createFixedNamespaceScopePlugin}from"#internal/bundler/extension-scope-plugin.js";import{CACHED_CHANNEL_PREFIX,RESOLVE_EXTENSIONS,createDistributionPackageBoundaryPlugin,createGenerationPackageBoundaryPlugin,createRuntimeLoaderPackageBoundaryPlugin,isNodeModulesPath,normalizeExternalDependencies}from"#internal/authored-package-boundary.js";import{createNodeEsmCompatBannerPlugin}from"#internal/node-esm-compat-banner.js";import{createDynamicCapabilityTransformPlugin}from"#internal/workflow-bundle/dynamic-capability-transform-plugin.js";const AUTHORED_BUNDLED_MODULE_EXTENSION=/\.[cm]?[jt]sx?$/,AUTHORED_MODULE_BUNDLE_DIRECTORY_PATH=join(`node_modules`,`.cache`,`eve`,`authored-modules`),CHANNEL_MODULE_CACHE_KEY=`__eveChannelModuleCache__`;function getChannelModuleCache(){return globalThis[CHANNEL_MODULE_CACHE_KEY]}const inFlightModuleLoads=new Map;function loadAuthoredModuleNamespace(e,t={}){let n=createInFlightModuleLoadKey(resolve(e),t),r=inFlightModuleLoads.get(n);if(r!==void 0)return r;let a=(async()=>{try{return await doLoadAuthoredModuleNamespace(e,t)}finally{inFlightModuleLoads.delete(n)}})();return inFlightModuleLoads.set(n,a),a}async function doLoadAuthoredModuleNamespace(e,n){return expectObjectRecord(AUTHORED_BUNDLED_MODULE_EXTENSION.test(e)?await loadBundledAuthoredModule(e,n):await import(createFileImportSpecifier(e)),`Expected "${e}" to export a module namespace object.`)}function createFileImportSpecifier(e){let t=e.replaceAll(`\\`,`/`);return/^[A-Za-z]:\//.test(t)?`file:///${encodeURI(t)}`:t.startsWith(`/`)?`file://${encodeURI(t)}`:t}async function bundleAuthoredModuleCode(e,t={}){return await buildAuthoredModuleBundle(e,t,{channelIdentity:!0,packageBoundaryPlugin:createRuntimeLoaderPackageBoundaryPlugin({externalDependencies:normalizeExternalDependencies(t.externalDependencies),packageRoot:resolveAuthoredPackageRoot(e)}),plugins:[],sourcemap:`inline`})}async function bundleAuthoredModuleForGeneration(e,t={}){return removeRolldownModuleRegionComments(await buildAuthoredModuleBundle(e,t,{channelIdentity:!1,packageBoundaryPlugin:createGenerationPackageBoundaryPlugin({externalDependencies:normalizeExternalDependencies(t.externalDependencies),packageRoot:resolveAuthoredPackageRoot(e)}),plugins:[createAuthoredDirectiveGuardPlugin()],sourcemap:!1}))}async function bundleExtensionDistributionGraph(e){let t=[createAuthoredDirectiveGuardPlugin(),createAuthoredRelativeExtensionResolverPlugin({extensions:RESOLVE_EXTENSIONS}),createAuthoredAssetImportPlugin(),createAuthoredPackageTsConfigPathsPlugin({appPackageRoot:e.packageRoot,extensions:RESOLVE_EXTENSIONS}),createNodeEsmCompatBannerPlugin({includeRequire:!0}),createDistributionPackageBoundaryPlugin({packageRoot:e.packageRoot,runtimeDependencies:e.runtimeDependencies})];try{let n=await buildWithNitroRolldown({cwd:e.packageRoot,input:Object.fromEntries(e.entries.map(e=>[e.name,e.path])),platform:`node`,plugins:t,resolve:{extensions:[...RESOLVE_EXTENSIONS]},tsconfig:resolveAuthoredTsConfigPath(e.packageRoot),write:!1,output:{chunkFileNames:`_chunks/[name]-[hash].mjs`,codeSplitting:!0,comments:!1,entryFileNames:`[name].mjs`,format:`esm`,sourcemap:!1}}),r=new Map;for(let e of n.output)e.type===`chunk`&&r.set(e.fileName,removeRolldownModuleRegionComments(e.code));return r}catch(t){throw createAuthoredModuleBundleError(e.packageRoot,t)}}async function bundleAuthoredModuleMapForGeneration(e){let t=resolveAuthoredPackageRoot(e.manifest.agentRoot),n=normalizeExternalDependencies([...e.manifest.config.build?.externalDependencies??[],...e.manifest.subagents.flatMap(e=>e.configResolver===void 0?e.agent.config.build?.externalDependencies??[]:e.configResolver.build?.externalDependencies??[])]),r=createCompiledModuleMapSource({manifest:e.manifest,moduleMapPath:e.moduleMapPath}),i=createExtensionScopePlugin([e.manifest,...e.manifest.subagents.map(e=>e.agent)].flatMap(e=>e.extensionMounts.map(e=>({packageNamespace:e.packageNamespace,sourceRoot:e.sourceRoot})))),a=[createVirtualGenerationModuleMapPlugin({id:e.moduleMapPath,source:r}),createDynamicCapabilityTransformPlugin({dynamicTools:!1}),createAuthoredDirectiveGuardPlugin(),i,createAuthoredRelativeExtensionResolverPlugin({extensions:RESOLVE_EXTENSIONS}),createAuthoredAssetImportPlugin(),createAuthoredPackageTsConfigPathsPlugin({appPackageRoot:t,extensions:RESOLVE_EXTENSIONS}),createNodeEsmCompatBannerPlugin({includeRequire:!0}),createGenerationPackageBoundaryPlugin({externalDependencies:n,packageRoot:t})].filter(e=>e!==null);try{return removeRolldownModuleRegionComments((await buildSingleRolldownChunk(`authored module map`,{cwd:t,input:e.moduleMapPath,platform:`node`,plugins:a,resolve:{extensions:[...RESOLVE_EXTENSIONS]},tsconfig:resolveAuthoredTsConfigPath(t),output:{comments:!1,format:`esm`,sourcemap:!1}})).code)}catch(t){throw createAuthoredModuleBundleError(e.moduleMapPath,t)}}function createVirtualGenerationModuleMapPlugin(e){return{name:`eve-generation-module-map`,resolveId(t){return t===e.id?t:void 0},load(t){return t===e.id?{code:e.source,moduleType:`js`}:void 0}}}async function buildAuthoredModuleBundle(e,t,n){let r=n.channelIdentity?getChannelModuleCache():void 0,a=resolveAuthoredPackageRoot(e),o=resolveAuthoredTsConfigPath(a),s=[r&&r.size>0?{name:`eve-channel-identity`,async resolveId(e,t,n){if(!/channels[/\\]/.test(e)||n.kind!==`import-statement`)return;let a=await this.resolve(e,t,{kind:n.kind,skipSelf:!0});if(a===null||typeof a.id!=`string`)return;let o=resolve(a.id);if(r.has(o))return{id:`${CACHED_CHANNEL_PREFIX}${o}`}},load(e){if(!e.startsWith(CACHED_CHANNEL_PREFIX))return;let t=e.slice(CACHED_CHANNEL_PREFIX.length);return{code:[`const cache = globalThis["${CHANNEL_MODULE_CACHE_KEY}"];`,`export default cache.get(${JSON.stringify(t)});`].join(`
|
|
2
|
+
`),moduleType:`js`}}}:null,...n.plugins,t.extensionScopeNamespace===void 0?null:createFixedNamespaceScopePlugin(t.extensionScopeNamespace),createAuthoredRelativeExtensionResolverPlugin({extensions:RESOLVE_EXTENSIONS}),createAuthoredAssetImportPlugin(),createAuthoredPackageTsConfigPathsPlugin({appPackageRoot:a,extensions:RESOLVE_EXTENSIONS}),createNodeEsmCompatBannerPlugin({includeRequire:!0}),n.packageBoundaryPlugin].filter(e=>e!==null);try{return(await buildSingleRolldownChunk(`authored module for "${e}"`,{cwd:a,input:e,platform:`node`,plugins:s,resolve:{extensions:[...RESOLVE_EXTENSIONS]},tsconfig:o,output:{comments:!1,format:`esm`,sourcemap:n.sourcemap}})).code}catch(t){throw createAuthoredModuleBundleError(e,t)}}function createAuthoredDirectiveGuardPlugin(){return{name:`eve-authored-directive-guard`,async transform(e,t){!AUTHORED_BUNDLED_MODULE_EXTENSION.test(t)||isNodeModulesPath(t)||await assertNoWorkflowDirectivePrologue({filePath:t,source:e})}}}function removeRolldownModuleRegionComments(e){return e.split(`
|
|
3
3
|
`).filter(e=>!e.startsWith(`//#region `)&&e!==`//#endregion`).join(`
|
|
4
|
-
`)}async function loadBundledAuthoredModule(t,
|
|
4
|
+
`)}async function loadBundledAuthoredModule(t,n){let i=await bundleAuthoredModuleCode(t,n),c=normalizeExternalDependencies(n.externalDependencies),l=createHash(`sha1`).update(t).update(`\0`).update(c.join(`\0`)).update(`\0`).update(n.extensionScopeNamespace??``).update(`\0`).update(i).digest(`hex`),u=join(resolveAuthoredPackageRoot(t),AUTHORED_MODULE_BUNDLE_DIRECTORY_PATH),d=join(u,`${l}.mjs`);existsSync(d)||(mkdirSync(u,{recursive:!0}),writeFileSync(d,i));try{return await import(`${createFileImportSpecifier(d)}?v=${l}`)}catch(e){throw createAuthoredModuleEvaluationError(t,e)}}function createInFlightModuleLoadKey(e,t){return`${e}\0${normalizeExternalDependencies(t.externalDependencies).join(`\0`)}\0${t.extensionScopeNamespace??``}`}function resolveAuthoredTsConfigPath(e){for(let t of[`tsconfig.json`,`jsconfig.json`]){let n=join(e,t);if(existsSync(n))return n}return!1}function resolveAuthoredPackageRoot(e){let t=dirname(e);for(;;){if(existsSync(join(t,`package.json`)))return t;let i=dirname(t);if(i===t)throw Error(`Failed to resolve the authored package root for "${e}".`);t=i}}export{bundleAuthoredModuleCode,bundleAuthoredModuleForGeneration,bundleAuthoredModuleMapForGeneration,bundleExtensionDistributionGraph,loadAuthoredModuleNamespace};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{isBuiltin}from"node:module";import{
|
|
1
|
+
import{isBuiltin}from"node:module";import{dirname,join,resolve,sep}from"node:path";import{existsSync,readFileSync,realpathSync}from"node:fs";import{normalizeEsmImportSpecifier}from"#internal/application/import-specifier.js";const CACHED_CHANNEL_PREFIX=`eve-cached-channel:`,RESOLVE_EXTENSIONS=[`.ts`,`.tsx`,`.mts`,`.cts`,`.js`,`.jsx`,`.mjs`,`.cjs`,`.json`];function createGenerationPackageBoundaryPlugin(e){return{name:`eve-generation-package-boundary`,async resolveId(t,n,r){if(isPackageImport(t)&&(isFrameworkRuntimeImport(t,n)||await resolveConfiguredExternalModule.call(this,{externalDependencies:e.externalDependencies,importer:n,kind:r.kind,packageRoot:e.packageRoot,source:t})!==void 0))return{external:!0,id:t}}}}function createRuntimeLoaderPackageBoundaryPlugin(e){let t=toCanonicalPath(e.packageRoot);return{name:`eve-runtime-loader-package-boundary`,async resolveId(n,i,a){if(!isPackageImport(n))return;if(isFrameworkRuntimeImport(n,i))return{external:!0,id:n};let o=await resolveConfiguredExternalModule.call(this,{externalDependencies:e.externalDependencies,importer:i,kind:a.kind,packageRoot:e.packageRoot,source:n});if(o!==void 0)return{external:!0,id:normalizeEsmImportSpecifier(resolveExistingExternalFilePath(o.resolvedId)??o.resolvedId)};let s=i===void 0||i.startsWith(`\0`)||i.startsWith(`eve-cached-channel:`)?void 0:resolve(i);if(s!==void 0&&isPathInsideOrEqual(toCanonicalPath(s),t)){let e=await this.resolve(n,i,{kind:a.kind,skipSelf:!0});if(e===null||typeof e.id!=`string`)throw Error(`Cannot resolve package "${n}" imported from "${s}". Install it with your package manager (e.g. \`pnpm install\`); a running \`eve dev\` retries on the next rebuild.`);if(isNodeModulesPath(e.id))return{external:!0,id:n}}}}}function createDistributionPackageBoundaryPlugin(t){let r=new Set(t.runtimeDependencies);return{name:`eve-extension-distribution-package-boundary`,async resolveId(i,a,o){if(!isPackageImport(i))return;if(i.startsWith(`#`)){let e=await this.resolve(i,a,{kind:o.kind,skipSelf:!0});if(e!==null&&typeof e.id==`string`&&!isPathInsideOrEqual(toCanonicalPath(e.id),toCanonicalPath(t.packageRoot))){let t=nearestPackageName(e.id);if(t!==void 0&&!r.has(t))throw Error(`Package import "${i}" resolves to undeclared package "${t}". Add "${t}" to dependencies, optionalDependencies, or peerDependencies.`)}return}if(isBuiltin(i))return{external:!0,id:i};let s=packageImportName(i);if(!r.has(s))throw Error(`Package "${i}" is not declared by the extension. Add "${s}" to dependencies, optionalDependencies, or peerDependencies.`);let c=await this.resolve(i,a,{kind:o.kind,skipSelf:!0});if(c===null&&(c=await this.resolve(i,join(t.packageRoot,`package.json`),{kind:o.kind,skipSelf:!0})),c===null||typeof c.id!=`string`)throw Error(`Cannot resolve declared package "${i}". Install the extension's dependencies before building.`);return{external:!0,id:i}}}}async function resolveConfiguredExternalModule(e){let t=resolveConfiguredExternalDependency(e.source,e.externalDependencies);if(t===void 0)return;let r=await this.resolve(e.source,e.importer,{kind:e.kind,skipSelf:!0});if(r===null&&(r=await this.resolve(e.source,join(e.packageRoot,`package.json`),{kind:e.kind,skipSelf:!0})),r===null||typeof r.id!=`string`)throw Error(`Cannot resolve external package "${e.source}".`);return{packageName:t,resolvedId:r.id}}function normalizeExternalDependencies(e=[]){return[...new Set(e)].sort()}function resolveConfiguredExternalDependency(e,t){return t.find(t=>e===t||e.startsWith(`${t}/`))}function packageImportName(e){return e.startsWith(`@`)?e.split(`/`,2).join(`/`):e.split(`/`,1)[0]}function nearestPackageName(e){let r=dirname(toCanonicalPath(e));for(;;){let e=join(r,`package.json`);if(existsSync(e))try{let t=JSON.parse(readFileSync(e,`utf8`));return typeof t.name==`string`&&t.name.length>0?t.name:void 0}catch{return}let i=dirname(r);if(i===r)return;r=i}}function resolveExistingExternalFilePath(e){if(existsSync(e))return e;for(let t of RESOLVE_EXTENSIONS){let n=`${e}${t}`;if(existsSync(n))return n}}function isPackageImport(e){return isPathImport(e)||/^(?:node|data|file):/.test(e)||e.startsWith(`@/`)?!1:!e.startsWith(CACHED_CHANNEL_PREFIX)}function isPathImport(e){return e.startsWith(`.`)||e.startsWith(`/`)||/^[A-Za-z]:[\\/]/.test(e)}function isFrameworkRuntimeImport(e,t){return e===`eve`||e.startsWith(`eve/`)?!0:e===`workflow`||e.startsWith(`workflow/`)||e.startsWith(`@workflow/`)?t===void 0||!isNodeModulesPath(t):!1}function isNodeModulesPath(e){return e.replaceAll(`\\`,`/`).includes(`/node_modules/`)}function toCanonicalPath(e){try{return realpathSync(e)}catch{return resolve(e)}}function isPathInsideOrEqual(e,t){let n=resolve(e),a=resolve(t);return n===a||n.startsWith(`${a}${sep}`)}export{CACHED_CHANNEL_PREFIX,RESOLVE_EXTENSIONS,createDistributionPackageBoundaryPlugin,createGenerationPackageBoundaryPlugin,createRuntimeLoaderPackageBoundaryPlugin,isNodeModulesPath,isPathImport,normalizeExternalDependencies};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{dirname,isAbsolute,join,resolve}from"node:path";import{realpathSync,statSync}from"node:fs";import{CACHED_CHANNEL_PREFIX,isNodeModulesPath,isPathImport}from"#internal/authored-package-boundary.js";const PATH_IMPORT_FILTER=/^(?:\.|\/|[A-Za-z]:[\\/])/;function createAuthoredRelativeExtensionResolverPlugin(n){let i=createCachedFileProbe();return{name:`eve-authored-relative-extension-resolver`,resolveId:{filter:{id:PATH_IMPORT_FILTER},handler(a,o){if(o===void 0||o.startsWith(`\0`)||o.startsWith(CACHED_CHANNEL_PREFIX)||!isPathImport(a))return;let s=resolveExistingImportPath(isAbsolute(a)?a:resolve(dirname(o),a),n.extensions,i);if(s!==void 0)return{id:isNodeModulesPath(s)?toRealModulePath(s):s}}}}}function createCachedFileProbe(){let e=new Map;return t=>{let n=e.get(t);if(n!==void 0)return n;let r=!1;try{r=statSync(t).isFile()}catch{}return e.set(t,r),r}}function resolveExistingImportPath(e,t,r){if(r(e))return e;for(let n of t){let t=`${e}${n}`;if(r(t))return t}for(let i of t){let t=join(e,`index${i}`);if(r(t))return t}}function toRealModulePath(e){try{return realpathSync(e)}catch{return e}}export{createAuthoredRelativeExtensionResolverPlugin};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{resolve,sep}from"node:path";import{realpathSync}from"node:fs";const VIRTUAL_PREFIX=`\0eve-ext-scope:`,SCOPED_FRAMEWORK_MODULES={"eve/context":`context`,"eve/extension":`extension`};function canonicalize(t){try{return realpathSync(t)}catch{return resolve(t)}}function importerPath(e){let t=e.indexOf(`?`);return canonicalize(t===-1?e:e.slice(0,t))}function isUnder(e,n){return e===n||e.startsWith(`${n}${sep}`)}function shimSource(e,t){let n=JSON.stringify(t);return e===`context`?[`import { defineState as __eveScopedDefineState } from "eve/context";`,`export function defineState(name, initial) {`,` return __eveScopedDefineState(${n} + "." + name, initial);`,`}`,``].join(`
|
|
2
2
|
`):[`import { defineExtension as __eveScopedDefineExtension } from "eve/extension";`,`export function defineExtension(options, namespace) {`,` return __eveScopedDefineExtension(options, namespace === undefined ? ${n} : namespace);`,`}`,``].join(`
|
|
3
3
|
`)}function scopeHooks(e,t){return{name:e,resolveId(e,n){let r=SCOPED_FRAMEWORK_MODULES[e];if(r===void 0||n===void 0||n.startsWith(`\0`))return;let i=t(n);if(i!==void 0)return`${VIRTUAL_PREFIX}${r}:${i}`},load(e){if(!e.startsWith(VIRTUAL_PREFIX))return;let t=e.slice(15),n=t.indexOf(`:`);return{code:shimSource(t.slice(0,n),t.slice(n+1)),moduleType:`js`}}}}function createExtensionScopePlugin(e){if(e.length===0)return null;let t=e.map(e=>({root:canonicalize(e.sourceRoot),packageNamespace:e.packageNamespace}));return scopeHooks(`eve-extension-scope`,e=>{let n=importerPath(e);for(let e of t)if(isUnder(n,e.root))return e.packageNamespace})}function createFixedNamespaceScopePlugin(e){return scopeHooks(`eve-extension-scope-fixed`,()=>e)}export{createExtensionScopePlugin,createFixedNamespaceScopePlugin};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{createRequire}from"node:module";import{pathToFileURL}from"node:url";let rolldownPromise,rolldownParseAstPromise;function loadNitroRolldown(){return rolldownPromise??=(async()=>await import(pathToFileURL(createRequire(createRequire(import.meta.url).resolve(`nitro/package.json`)).resolve(`rolldown`)).href))(),rolldownPromise}function loadNitroRolldownParseAst(){return rolldownParseAstPromise??=(async()=>await import(pathToFileURL(createRequire(createRequire(import.meta.url).resolve(`nitro/package.json`)).resolve(`rolldown/parseAst`)).href))(),rolldownParseAstPromise}function inferRolldownParserLanguage(e){return e.endsWith(`.tsx`)?`tsx`:e.endsWith(`.jsx`)?`jsx`:/\.[cm]?ts$/.test(e)?`ts`:`js`}async function parseWithNitroRolldownAst(e,t){let{parseAst:n}=await loadNitroRolldownParseAst();return n(t,{astType:`ts`,lang:inferRolldownParserLanguage(e),range:!0,sourceType:`module`},e)}async function buildWithNitroRolldown(e){let{build:t}=await loadNitroRolldown();return await t(e)}async function buildSingleRolldownChunk(e,t){return getSingleRolldownChunk(await buildWithNitroRolldown({...t,write:!1,output:{...t.output,codeSplitting:!1}}),e)}function getSingleRolldownChunk(e,t){let n=e.output.filter(e=>e.type===`chunk`),r=n[0];if(r===void 0||n.length!==1)throw Error(`Expected one bundled ${t}.`);return r}export{buildSingleRolldownChunk,buildWithNitroRolldown,inferRolldownParserLanguage,loadNitroRolldownParseAst,parseWithNitroRolldownAst};
|
|
1
|
+
import{createRequire}from"node:module";import{pathToFileURL}from"node:url";let rolldownPromise,rolldownParseAstPromise;function loadNitroRolldown(){return rolldownPromise??=(async()=>await import(pathToFileURL(createRequire(createRequire(import.meta.url).resolve(`nitro/package.json`)).resolve(`rolldown`)).href))(),rolldownPromise}function loadNitroRolldownParseAst(){return rolldownParseAstPromise??=(async()=>await import(pathToFileURL(createRequire(createRequire(import.meta.url).resolve(`nitro/package.json`)).resolve(`rolldown/parseAst`)).href))(),rolldownParseAstPromise}function inferRolldownParserLanguage(e){return e.endsWith(`.tsx`)?`tsx`:e.endsWith(`.jsx`)?`jsx`:/\.[cm]?ts$/.test(e)?`ts`:`js`}async function parseWithNitroRolldownAst(e,t){let{parseAst:n}=await loadNitroRolldownParseAst();return n(t,{astType:`ts`,lang:inferRolldownParserLanguage(e),range:!0,sourceType:`module`},e)}async function buildWithNitroRolldown(e){assertCustomRolldownConditionNames(e);let{build:t}=await loadNitroRolldown();return await t(e)}const ROLLDOWN_STANDARD_CONDITION_NAMES=new Set([`browser`,`default`,`import`,`node`,`require`]);function assertCustomRolldownConditionNames(e){let t=e.resolve;if(typeof t!=`object`||!t)return;let n=Reflect.get(t,`conditionNames`);if(Array.isArray(n)){for(let e of n)if(typeof e==`string`&&ROLLDOWN_STANDARD_CONDITION_NAMES.has(e))throw Error(`Rolldown resolves the standard condition ${JSON.stringify(e)} per import edge; conditionNames may contain only eve-specific additions.`)}}async function buildSingleRolldownChunk(e,t){return getSingleRolldownChunk(await buildWithNitroRolldown({...t,write:!1,output:{...t.output,codeSplitting:!1}}),e)}function getSingleRolldownChunk(e,t){let n=e.output.filter(e=>e.type===`chunk`),r=n[0];if(r===void 0||n.length!==1)throw Error(`Expected one bundled ${t}.`);return r}export{buildSingleRolldownChunk,buildWithNitroRolldown,inferRolldownParserLanguage,loadNitroRolldownParseAst,parseWithNitroRolldownAst};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{createLogger}from"#internal/logging.js";import{
|
|
1
|
+
import{createLogger}from"#internal/logging.js";import{join}from"node:path";import{existsSync,readdirSync,statSync}from"node:fs";const INSTRUMENTATION_EXTENSIONS=[`.ts`,`.mts`,`.js`,`.mjs`],INSTRUMENTATION_DIRECTORY=`instrumentation`,PROVIDERS_FLAG=`experimental.instrumentationProviders`,log=createLogger(`internal.instrumentation-layout`);function resolveInstrumentationLayout(e){let r=resolveInstrumentationFile(e.agentRoot),a=join(e.agentRoot,INSTRUMENTATION_DIRECTORY),s=existsSync(a)&&statSync(a).isDirectory();if(!e.providersEnabled)return s&&log.warn(`ignoring instrumentation provider directory because providers are off`,{agentRoot:e.agentRoot,flag:PROVIDERS_FLAG}),r===void 0?void 0:{kind:`file`,modulePath:r};if(r!==void 0)throw Error(`Found "${r}", but \`${PROVIDERS_FLAG}\` is on. Move it into the "${INSTRUMENTATION_DIRECTORY}/" directory as one file per provider.`);return s?{kind:`directory`,modulePathsBySlot:collectInstrumentationProviderModules(a)}:{kind:`directory`,modulePathsBySlot:{}}}function collectInstrumentationProviderModules(e){let n=new Map;for(let i of readdirSync(e,{withFileTypes:!0})){if(!i.isFile())continue;let r=INSTRUMENTATION_EXTENSIONS.find(e=>i.name.endsWith(e));if(r===void 0)continue;let o=i.name.slice(0,-r.length);if(o!==``){if(n.get(o)!==void 0)throw Error(`Two files declare the "${o}" instrumentation provider in "${e}". Keep one of them.`);n.set(o,join(e,i.name))}}return Object.fromEntries([...n].sort(([e],[t])=>e.localeCompare(t)))}function resolveInstrumentationFile(e){for(let r of INSTRUMENTATION_EXTENSIONS){let i=join(e,`${INSTRUMENTATION_DIRECTORY}${r}`);if(existsSync(i))return i}}export{resolveInstrumentationLayout};
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import type { ConnectionAuthorizationChallenge } from "#public/connections/errors.js";
|
|
2
|
+
import type { InputRequest } from "#runtime/input/types.js";
|
|
3
|
+
import type { JsonValue } from "#shared/json.js";
|
|
4
|
+
export interface AgentInvocationAuthorizationRequest {
|
|
5
|
+
readonly authorization?: ConnectionAuthorizationChallenge;
|
|
6
|
+
readonly description: string;
|
|
7
|
+
readonly name: string;
|
|
8
|
+
readonly webhookUrl?: string;
|
|
9
|
+
}
|
|
10
|
+
interface AgentInvocationBase {
|
|
11
|
+
readonly invocationId: string;
|
|
12
|
+
readonly createdAt: string;
|
|
13
|
+
readonly expiresAt?: string;
|
|
14
|
+
}
|
|
15
|
+
export type AgentInvocation = (AgentInvocationBase & {
|
|
16
|
+
readonly status: "working";
|
|
17
|
+
readonly pollAfterMs: number;
|
|
18
|
+
readonly result?: JsonValue;
|
|
19
|
+
}) | (AgentInvocationBase & {
|
|
20
|
+
readonly status: "input_required";
|
|
21
|
+
readonly inputRequests: Readonly<Record<string, InputRequest>>;
|
|
22
|
+
readonly result?: JsonValue;
|
|
23
|
+
}) | (AgentInvocationBase & {
|
|
24
|
+
readonly status: "authorization_required";
|
|
25
|
+
readonly authorizations: readonly [
|
|
26
|
+
AgentInvocationAuthorizationRequest,
|
|
27
|
+
...AgentInvocationAuthorizationRequest[]
|
|
28
|
+
];
|
|
29
|
+
readonly pollAfterMs: number;
|
|
30
|
+
readonly result?: JsonValue;
|
|
31
|
+
}) | (AgentInvocationBase & {
|
|
32
|
+
readonly status: "completed";
|
|
33
|
+
readonly result?: JsonValue;
|
|
34
|
+
}) | (AgentInvocationBase & {
|
|
35
|
+
readonly status: "failed";
|
|
36
|
+
readonly error: {
|
|
37
|
+
readonly code: number;
|
|
38
|
+
readonly message: string;
|
|
39
|
+
readonly data?: JsonValue;
|
|
40
|
+
};
|
|
41
|
+
}) | (AgentInvocationBase & {
|
|
42
|
+
readonly status: "cancelled";
|
|
43
|
+
});
|
|
44
|
+
export type AgentInvocationStatus = AgentInvocation["status"];
|
|
45
|
+
export type AgentInvocationMutationResult = {
|
|
46
|
+
readonly type: "success";
|
|
47
|
+
readonly invocation: AgentInvocation;
|
|
48
|
+
} | {
|
|
49
|
+
readonly type: "conflict";
|
|
50
|
+
readonly message: string;
|
|
51
|
+
} | {
|
|
52
|
+
readonly type: "not_found";
|
|
53
|
+
};
|
|
54
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export{};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const INVOCATION_TOKEN_ATTRIBUTE=`$eve.invocation_token`,INVOCATION_OWNER_ATTRIBUTE=`$eve.invocation_owner`;export{INVOCATION_OWNER_ATTRIBUTE,INVOCATION_TOKEN_ATTRIBUTE};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { RunInput, SessionAuthContext } from "#channel/types.js";
|
|
2
|
+
import { INVOCATION_OWNER_ATTRIBUTE, INVOCATION_TOKEN_ATTRIBUTE } from "#internal/invocation/attributes.js";
|
|
3
|
+
export { INVOCATION_OWNER_ATTRIBUTE, INVOCATION_TOKEN_ATTRIBUTE };
|
|
4
|
+
export type ExternalInvocationMetadata = NonNullable<RunInput["externalInvocation"]>;
|
|
5
|
+
/** Batch-scoped request id exposed to MCP clients for one durable pending-input event. */
|
|
6
|
+
export declare function invocationInputRequestId(pendingBatchId: string, requestId: string): string;
|
|
7
|
+
/** Fixed-width fingerprint used to bind an invocation to its initiating principal. */
|
|
8
|
+
export declare function invocationOwnerKey(auth: SessionAuthContext | null): string;
|
|
9
|
+
export declare function buildInvocationAttributes(metadata: ExternalInvocationMetadata): Readonly<Record<string, string>>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{createHash}from"node:crypto";import{INVOCATION_OWNER_ATTRIBUTE,INVOCATION_TOKEN_ATTRIBUTE}from"#internal/invocation/attributes.js";function invocationInputRequestId(t,n){return createHash(`sha256`).update(JSON.stringify([t,n]),`utf8`).digest(`hex`)}function invocationOwnerKey(t){let n=t===null?[`anonymous`]:[t.authenticator,t.issuer??``,t.principalType,t.principalId,t.subject??``];return createHash(`sha256`).update(JSON.stringify(n),`utf8`).digest(`hex`)}function buildInvocationAttributes(e){return{[INVOCATION_OWNER_ATTRIBUTE]:e.ownerKey,[INVOCATION_TOKEN_ATTRIBUTE]:e.continuationToken}}export{INVOCATION_OWNER_ATTRIBUTE,INVOCATION_TOKEN_ATTRIBUTE,buildInvocationAttributes,invocationInputRequestId,invocationOwnerKey};
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import type { UserContent } from "ai";
|
|
2
|
+
import type { SessionAuthContext } from "#channel/types.js";
|
|
3
|
+
import { type ChannelFrom } from "#channel/channel-operations.js";
|
|
4
|
+
import type { AgentInvocation, AgentInvocationMutationResult } from "#internal/invocation/agent-invocation.js";
|
|
5
|
+
import type { RouteSessionCreator } from "#internal/nitro/routes/channel-route-context.js";
|
|
6
|
+
import type { InputResponse } from "#runtime/input/types.js";
|
|
7
|
+
import type { JsonObject } from "#shared/json.js";
|
|
8
|
+
export declare class WorkflowAgentInvocationExecution {
|
|
9
|
+
#private;
|
|
10
|
+
constructor(input: {
|
|
11
|
+
readonly createSession: RouteSessionCreator;
|
|
12
|
+
readonly from: ChannelFrom;
|
|
13
|
+
});
|
|
14
|
+
create(input: {
|
|
15
|
+
readonly auth: SessionAuthContext | null;
|
|
16
|
+
readonly message: string | UserContent;
|
|
17
|
+
readonly outputSchema?: JsonObject;
|
|
18
|
+
}): Promise<AgentInvocation>;
|
|
19
|
+
read(input: {
|
|
20
|
+
readonly auth: SessionAuthContext | null;
|
|
21
|
+
readonly invocationId: string;
|
|
22
|
+
}): Promise<AgentInvocation | undefined>;
|
|
23
|
+
update(input: {
|
|
24
|
+
readonly auth: SessionAuthContext | null;
|
|
25
|
+
readonly invocationId: string;
|
|
26
|
+
readonly responses: readonly InputResponse[];
|
|
27
|
+
}): Promise<AgentInvocationMutationResult>;
|
|
28
|
+
cancel(input: {
|
|
29
|
+
readonly auth: SessionAuthContext | null;
|
|
30
|
+
readonly invocationId: string;
|
|
31
|
+
}): Promise<AgentInvocation | undefined>;
|
|
32
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{INTERNAL_CHANNEL_DELIVER}from"#channel/channel-operations.js";import{parseJsonValue}from"#shared/json.js";import{RunExpiredError,WorkflowRunNotFoundError}from"#compiled/@workflow/errors/index.js";import{getRun,getWorld}from"#internal/workflow/runtime.js";import{parseNdjsonStream}from"#execution/ndjson-stream.js";import{INVOCATION_OWNER_ATTRIBUTE,INVOCATION_TOKEN_ATTRIBUTE,invocationInputRequestId,invocationOwnerKey}from"#internal/invocation/metadata.js";var WorkflowAgentInvocationExecution=class{#e;#t;constructor(e){this.#e=e.createSession,this.#t=e.from}async create(e){let t=`invocation:${crypto.randomUUID()}`,n=await this.#e({auth:e.auth,capabilities:{requestInput:!0},continuationToken:t,externalInvocation:{continuationToken:t,ownerKey:invocationOwnerKey(e.auth)},input:{message:e.message,outputSchema:e.outputSchema},mode:`task`}),r=await this.#n(n.sessionId,e.auth);if(r===void 0)throw Error(`Invocation run was unavailable after durable creation.`);return workingInvocation(n.sessionId,r.createdAt.toISOString(),r.expiredAt?.toISOString())}async read(e){let t=await this.#n(e.invocationId,e.auth);if(t===void 0)return;if(isTerminalRunStatus(t.status))return await terminalInvocation(t);let n=await readRecentPersistedEvents(e.invocationId);return projectNonterminal(t.runId,t.createdAt.toISOString(),t.expiredAt?.toISOString(),n)}async update(t){let r=await this.read(t);if(r===void 0)return{type:`not_found`};if(r.status!==`input_required`)return conflict(`Invocation is not waiting for input.`);let i=await this.#n(t.invocationId,t.auth);if(i===void 0)return{type:`not_found`};let a=latestPendingInputBatch(await readRecentPersistedEvents(t.invocationId));if(a===void 0)return conflict(`Invocation input changed before the update could be applied.`);let o=new Set,s=[];for(let e of t.responses){let t=a.rawRequestIds[e.requestId];if(t===void 0)return conflict(`Unknown input request: ${e.requestId}`);o.add(e.requestId),s.push({...e,requestId:t})}if(o.size!==t.responses.length||o.size!==Object.keys(a.requests).length)return conflict(`Responses must answer the complete pending input batch exactly once.`);let l=i.attributes[INVOCATION_TOKEN_ATTRIBUTE];if(l===void 0)return{type:`not_found`};try{await this.#t(l)[INTERNAL_CHANNEL_DELIVER]({inputResponses:s},{auth:t.auth})}catch(e){if(RunExpiredError.is(e))return{type:`not_found`};throw e}return{invocation:workingInvocation(t.invocationId,r.createdAt,r.expiresAt),type:`success`}}async cancel(e){let t=await this.read(e);if(t===void 0||isTerminal(t.status))return t;try{await getRun(e.invocationId).cancel()}catch(e){if(WorkflowRunNotFoundError.is(e)||RunExpiredError.is(e))return;throw e}return await this.read(e)}async#n(e,t){let i=await getWorld();try{let n=await i.runs.get(e);return n.attributes[INVOCATION_TOKEN_ATTRIBUTE]===void 0?void 0:n.attributes[INVOCATION_OWNER_ATTRIBUTE]===invocationOwnerKey(t)?n:void 0}catch(e){if(WorkflowRunNotFoundError.is(e)||RunExpiredError.is(e))return;throw e}}};async function readRecentPersistedEvents(e){let t=getRun(e).getReadable({startIndex:-64}),n=await t.getTailIndex();if(n<0)return await t.cancel(`invocation event stream is empty`).catch(()=>{}),[];let r=Math.min(n+1,64),a=parseNdjsonStream(()=>t).getReader(),s=[];try{for(;s.length<r;){let{done:e,value:t}=await a.read();if(e)break;s.push(t)}}finally{await a.cancel(`invocation event window read complete`).catch(()=>{}),a.releaseLock()}return s}function pendingInputBatch(e){let t={},n={};for(let r of e.data.requests){let i=invocationInputRequestId(e.meta.id,r.requestId);t[i]=r.requestId,n[i]={...r,requestId:i}}return{id:e.meta.id,rawRequestIds:t,requests:n}}function latestPendingInputBatch(e){let t;for(let n of e)n.type===`input.requested`?t=pendingInputBatch(n):n.type===`turn.started`&&(t=void 0);return t}function projectNonterminal(e,t,n,r){let i=new Map,a,o;for(let e of r)if(e.type===`input.requested`)a=pendingInputBatch(e);else if(e.type===`turn.started`)i.clear(),a=void 0,o=void 0;else if(e.type===`authorization.required`){let t={description:e.data.description,name:e.data.name};e.data.authorization!==void 0&&(t.authorization=e.data.authorization),e.data.webhookUrl!==void 0&&(t.webhookUrl=e.data.webhookUrl),i.set(e.data.name,t)}else e.type===`authorization.completed`?i.delete(e.data.name):e.type===`message.completed`&&e.data.finishReason!==`tool-calls`&&e.data.message!==null&&(o=safeJson(e.data.message));let s=[...i.values()],c={createdAt:t,expiresAt:n,invocationId:e,result:o};return s.length>0?{...c,authorizations:s,pollAfterMs:1e3,status:`authorization_required`}:a===void 0?{...c,pollAfterMs:1e3,status:`working`}:{...c,inputRequests:a.requests,status:`input_required`}}async function terminalInvocation(e){let t={createdAt:e.createdAt.toISOString(),expiresAt:e.expiredAt?.toISOString(),invocationId:e.runId};if(e.status===`cancelled`)return{...t,status:`cancelled`};if(e.status===`failed`)return{...t,error:{code:-32603,data:safeJson(e.error),message:errorMessage(e.error)},status:`failed`};let n=await getRun(e.runId).returnValue;return{...t,result:safeJson(n.output),status:`completed`}}function workingInvocation(e,t,n){return{createdAt:t,expiresAt:n,invocationId:e,pollAfterMs:1e3,status:`working`}}function safeJson(e){try{return parseJsonValue(e)}catch{return String(e)}}function errorMessage(e){return e instanceof Error?e.message:`Session failed.`}function conflict(e){return{message:e,type:`conflict`}}function isTerminal(e){return e===`completed`||e===`failed`||e===`cancelled`}function isTerminalRunStatus(e){return e===`completed`||e===`failed`||e===`cancelled`}export{WorkflowAgentInvocationExecution};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{createHash}from"node:crypto";import{lstat,mkdir,readFile,readdir,readlink,writeFile}from"node:fs/promises";import{
|
|
1
|
+
import{createHash}from"node:crypto";import{lstat,mkdir,readFile,readdir,readlink,writeFile}from"node:fs/promises";import{join,relative,sep}from"node:path";import{existsSync}from"node:fs";import{COMPILED_AGENT_MANIFEST_KIND,ROOT_COMPILED_AGENT_NODE_ID}from"#compiler/manifest.js";import{bundleAuthoredModuleForGeneration,bundleAuthoredModuleMapForGeneration}from"#internal/authored-module-loader.js";import{resolveInstrumentationLayout}from"#internal/instrumentation-layout.js";import{serializeCompiledManifestForFingerprint}from"#internal/compiled-manifest-fingerprint.js";const MATERIALIZED_MODULES_DIRECTORY=`authored-modules`,MATERIALIZED_MODULES_INDEX=`authored-modules.json`;async function materializeAuthoredModules(t){let r=join(t.runtimeAppRoot,`.eve`,`compile`),i=await readCompiledManifest(join(r,`compiled-agent-manifest.json`)),a=join(r,MATERIALIZED_MODULES_DIRECTORY),s=createHash(`sha256`);await mkdir(a,{recursive:!0}),s.update(`manifest\0`).update(serializeCompiledManifestForFingerprint({manifest:i,runtimeAppRoot:t.runtimeAppRoot})).update(`\0`);let c=await bundleAuthoredModuleMapForGeneration({manifest:i,moduleMapPath:join(r,`module-map.mjs`)}),l=createMaterializedModuleFileName(ROOT_COMPILED_AGENT_NODE_ID,`module-map`,c),u=join(MATERIALIZED_MODULES_DIRECTORY,l);await writeFile(join(a,l),c),s.update(`module-map\0`).update(c).update(`\0`);let d=resolveInstrumentationLayout({agentRoot:i.agentRoot,providersEnabled:i.config.experimental?.instrumentationProviders??!1}),f=i.config.build?.externalDependencies??[],materializeInstrumentationModule=async(e,t)=>{let n=await bundleAuthoredModuleForGeneration(t,{externalDependencies:f}),r=createMaterializedModuleFileName(ROOT_COMPILED_AGENT_NODE_ID,`instrumentation:${e}`,n);return await writeFile(join(a,r),n),s.update(`instrumentation:${e}\0`).update(n).update(`\0`),join(MATERIALIZED_MODULES_DIRECTORY,r)},p;if(d?.kind===`file`)p={kind:`file`,modulePath:await materializeInstrumentationModule(`file`,d.modulePath)};else if(d?.kind===`directory`){let e={};for(let[t,n]of Object.entries(d.modulePathsBySlot))e[t]=await materializeInstrumentationModule(t,n);p={kind:`directory`,modulePathsBySlot:e}}await hashDirectoryIfPresent({fingerprint:s,path:join(r,`workspace-resources`),root:join(r,`workspace-resources`)});let m={fingerprint:s.digest(`hex`),moduleMap:u,version:3};return p!==void 0&&(m.instrumentation=p),await writeFile(join(r,MATERIALIZED_MODULES_INDEX),`${JSON.stringify(m)}\n`),m}async function readMaterializedAuthoredModuleIndex(e){let t=join(e,`.eve`,`compile`,MATERIALIZED_MODULES_INDEX);if(!existsSync(t))return;let n=JSON.parse(await readFile(t,`utf8`));if(n.version!==3||typeof n.fingerprint!=`string`||n.fingerprint.length===0||typeof n.moduleMap!=`string`||n.moduleMap.length===0||!isMaterializedInstrumentation(n.instrumentation))throw Error(`Invalid materialized authored module index at "${t}".`);return n}function isMaterializedInstrumentation(e){if(e===void 0)return!0;if(typeof e!=`object`||!e)return!1;let t=e;if(t.kind===`file`)return typeof t.modulePath==`string`;if(t.kind===`directory`){let e=t.modulePathsBySlot;return typeof e==`object`&&!!e&&Object.values(e).every(e=>typeof e==`string`)}return!1}async function readCompiledManifest(e){let t=JSON.parse(await readFile(e,`utf8`));if(t.kind!==COMPILED_AGENT_MANIFEST_KIND)throw Error(`Invalid compiled agent manifest at "${e}".`);return t}function createMaterializedModuleFileName(t,n,r){return`${createHash(`sha256`).update(t).update(`\0`).update(n).update(`\0`).update(r).digest(`hex`)}.mjs`}async function hashDirectoryIfPresent(e){if(!existsSync(e.path))return;let n=await lstat(e.path),o=toPortablePath(relative(e.root,e.path));if(n.isSymbolicLink()){e.fingerprint.update(o).update(`\0link\0`).update(await readlink(e.path)).update(`\0`);return}if(n.isDirectory()){for(let t of(await readdir(e.path)).sort())await hashDirectoryIfPresent({...e,path:join(e.path,t)});return}n.isFile()&&e.fingerprint.update(o).update(`\0file\0`).update(await readFile(e.path)).update(`\0`)}function toPortablePath(e){return e.split(sep).join(`/`)}export{materializeAuthoredModules,readMaterializedAuthoredModuleIndex};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Applies the fetch-native HTTP guards required in front of the MCP SDK.
|
|
3
|
+
*
|
|
4
|
+
* Non-browser clients normally omit `Origin`; browser requests are restricted
|
|
5
|
+
* to the endpoint's exact origin. Plain HTTP is accepted only on loopback.
|
|
6
|
+
*/
|
|
7
|
+
export declare function validateMcpHttpRequest(request: Request): Response | undefined;
|
|
8
|
+
/**
|
|
9
|
+
* Applies transport and Host validation to the public OAuth discovery route
|
|
10
|
+
* without restricting its Origin. The route itself supplies permissive CORS.
|
|
11
|
+
*/
|
|
12
|
+
export declare function validateMcpMetadataRequest(request: Request): Response | undefined;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{isLoopbackHostname}from"#shared/network-address.js";function validateMcpHttpRequest(e){let t=validateMcpHttpRequestBase(e);if(t!==void 0)return t;let n=new URL(e.url),r=e.headers.get(`origin`);if(r===null||r.length===0)return;let i;try{i=new URL(r)}catch{return securityError(`Invalid Origin header.`)}if(i.origin!==n.origin)return securityError(`Invalid Origin: ${i.origin}`)}function validateMcpMetadataRequest(e){return validateMcpHttpRequestBase(e)}function validateMcpHttpRequestBase(t){let n;try{n=new URL(t.url)}catch{return securityError(`Invalid MCP request URL.`,400)}if(n.protocol!==`https:`&&!(n.protocol===`http:`&&isLoopbackHostname(n.hostname)))return securityError(`MCP endpoints require HTTPS except on loopback.`);let r=validateHostHeader(t,n);if(r!==void 0)return r}function validateHostHeader(e,t){let n=e.headers.get(`host`);if(n===null||n.length===0)return securityError(`Missing Host header`);let r;try{r=new URL(`${t.protocol}//${n}`)}catch{return securityError(`Invalid Host header`)}if(r.username!==``||r.password!==``||r.pathname!==`/`||r.search!==``||r.hash!==``||r.host!==t.host)return securityError(`Invalid Host header: ${n}`)}function securityError(e,t=403){return Response.json({error:{code:-32e3,message:e},id:null,jsonrpc:`2.0`},{headers:{"content-type":`application/json`},status:t})}export{validateMcpHttpRequest,validateMcpMetadataRequest};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export interface McpProtectedResourceMetadataOptions {
|
|
2
|
+
readonly authorizationServers: readonly string[];
|
|
3
|
+
readonly resource: string;
|
|
4
|
+
readonly scopesSupported?: readonly string[];
|
|
5
|
+
}
|
|
6
|
+
/** Creates RFC 9728 protected-resource metadata for an MCP endpoint. */
|
|
7
|
+
export declare function createMcpProtectedResourceMetadata(options: McpProtectedResourceMetadataOptions): Readonly<Record<string, unknown>>;
|
|
8
|
+
/** Creates the RFC 9728 bearer discovery challenge for an MCP resource. */
|
|
9
|
+
export declare function createMcpResourceChallenge(resourceMetadataUrl: string, scopes?: readonly string[]): string;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{escapeAuthChallengeParameter}from"#public/channels/auth.js";function createMcpProtectedResourceMetadata(e){let t={authorization_servers:e.authorizationServers,resource:e.resource};return e.scopesSupported!==void 0&&(t.scopes_supported=e.scopesSupported),t}function createMcpResourceChallenge(t,n){let r=[`resource_metadata="${escapeAuthChallengeParameter(t)}"`];return n?.length&&r.push(`scope="${escapeAuthChallengeParameter(n.join(` `))}"`),`Bearer ${r.join(`, `)}`}export{createMcpProtectedResourceMetadata,createMcpResourceChallenge};
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { McpServer, type McpToolAnnotations, type StandardSchemaWithJSON } from "#compiled/@modelcontextprotocol/server/index.js";
|
|
2
|
+
import type { SessionAuthContext } from "#channel/types.js";
|
|
3
|
+
export declare const MCP_PROTOCOL_VERSION = "2026-07-28";
|
|
4
|
+
export declare const MCP_LEGACY_PROTOCOL_VERSION = "2025-11-25";
|
|
5
|
+
export interface McpToolDefinition<TInputSchema extends StandardSchemaWithJSON = StandardSchemaWithJSON> {
|
|
6
|
+
readonly name: string;
|
|
7
|
+
readonly description?: string;
|
|
8
|
+
readonly annotations?: McpToolAnnotations;
|
|
9
|
+
readonly inputSchema: TInputSchema;
|
|
10
|
+
readonly outputSchema?: StandardSchemaWithJSON;
|
|
11
|
+
}
|
|
12
|
+
export interface McpCallToolResult<TStructured extends Readonly<Record<string, unknown>> = Readonly<Record<string, unknown>>> {
|
|
13
|
+
readonly content: readonly McpContent[];
|
|
14
|
+
readonly isError?: boolean;
|
|
15
|
+
readonly structuredContent?: TStructured;
|
|
16
|
+
}
|
|
17
|
+
export type McpContent = {
|
|
18
|
+
readonly type: "text";
|
|
19
|
+
readonly text: string;
|
|
20
|
+
} | {
|
|
21
|
+
readonly type: "resource_link";
|
|
22
|
+
readonly name: string;
|
|
23
|
+
readonly uri: string;
|
|
24
|
+
};
|
|
25
|
+
export interface McpServerTool {
|
|
26
|
+
readonly name: string;
|
|
27
|
+
register(server: McpServer, auth: SessionAuthContext | null): void;
|
|
28
|
+
}
|
|
29
|
+
type InferSchemaOutput<TSchema> = TSchema extends StandardSchemaWithJSON<unknown, infer TOutput> ? TOutput : never;
|
|
30
|
+
/** Keeps a schema and its inferred handler input coupled while erasing heterogeneous storage. */
|
|
31
|
+
export declare function defineMcpTool<const TInputSchema extends StandardSchemaWithJSON<unknown, unknown>, TStructured extends Readonly<Record<string, unknown>> = Readonly<Record<string, unknown>>>(input: {
|
|
32
|
+
readonly definition: McpToolDefinition<TInputSchema>;
|
|
33
|
+
call(value: InferSchemaOutput<TInputSchema>, context: {
|
|
34
|
+
readonly auth: SessionAuthContext | null;
|
|
35
|
+
readonly signal: AbortSignal;
|
|
36
|
+
}): Promise<McpCallToolResult<TStructured>>;
|
|
37
|
+
}): McpServerTool;
|
|
38
|
+
export interface McpStreamableHttpServerOptions {
|
|
39
|
+
readonly name: string;
|
|
40
|
+
readonly version: string;
|
|
41
|
+
readonly tools: readonly McpServerTool[];
|
|
42
|
+
authenticate(request: Request): Promise<SessionAuthContext | null | Response>;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Creates a dual-era, stateless MCP HTTP request handler.
|
|
46
|
+
*
|
|
47
|
+
* Current clients use MCP 2026-07-28's per-request envelope. Older clients
|
|
48
|
+
* fall back to the SDK's stateless 2025 Streamable HTTP implementation.
|
|
49
|
+
*/
|
|
50
|
+
export declare function createMcpStreamableHttpServer(options: McpStreamableHttpServerOptions): (request: Request) => Promise<Response>;
|
|
51
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{McpServer,createMcpHandler}from"#compiled/@modelcontextprotocol/server/index.js";const MCP_PROTOCOL_VERSION=`2026-07-28`,MCP_LEGACY_PROTOCOL_VERSION=`2025-11-25`;function defineMcpTool(e){return{name:e.definition.name,register(t,n){t.registerTool(e.definition.name,{...e.definition.annotations===void 0?{}:{annotations:e.definition.annotations},...e.definition.description===void 0?{}:{description:e.definition.description},inputSchema:e.definition.inputSchema,...e.definition.outputSchema===void 0?{}:{outputSchema:e.definition.outputSchema}},async(t,r)=>await callTool(e.call,t,r.mcpReq.signal,n))}}}function createMcpStreamableHttpServer(e){let n=new Map(e.tools.map(e=>[e.name,e]));if(n.size!==e.tools.length)throw Error(`MCP tool names must be unique.`);return async r=>{let i=await e.authenticate(r);if(i instanceof Response)return i;let a=await preflightModernRequest(r);return a.response===void 0?await createMcpHandler(()=>createServer(e,n,i),{legacy:`stateless`}).fetch(r,a.parsedBody===void 0?void 0:{parsedBody:a.parsedBody}):a.response}}async function preflightModernRequest(e){if(e.method.toUpperCase()!==`POST`||e.headers.has(`mcp-protocol-version`))return{};let t=await inspectRequestBody(e);if(t.tooLarge)return{response:requestBodyTooLargeResponse()};if(t.invalidJson)return{response:invalidJsonResponse()};let n=t.value;if(n===void 0)return{};if(!claimsCurrentProtocolVersion(n))return{parsedBody:n};let r=await probeEarlierValidationFailure(e,n);return r===void 0?{parsedBody:n,response:headerMismatchResponse(n)}:{parsedBody:n,response:r}}async function inspectRequestBody(e){let t=e.body;if(t===null)return{tooLarge:!1};let n=t.getReader(),r=[],i=0;try{for(;;){let e=await n.read();if(e.done)break;if(i+=e.value.byteLength,i>4194304)return await n.cancel(),{tooLarge:!0};r.push(e.value)}let e=new Uint8Array(i),t=0;for(let n of r)e.set(n,t),t+=n.byteLength;return{tooLarge:!1,value:JSON.parse(new TextDecoder().decode(e))}}catch{return{invalidJson:!0,tooLarge:!1}}}function invalidJsonResponse(){return Response.json({error:{code:-32700,message:`Parse error`},id:null,jsonrpc:`2.0`},{status:400})}function requestBodyTooLargeResponse(){return Response.json({error:{code:-32e3,message:`Request body too large`},id:null,jsonrpc:`2.0`},{status:413,statusText:`Request Entity Too Large`})}function claimsCurrentProtocolVersion(e){return isPlainRecord(e)&&isPlainRecord(e.params)&&isPlainRecord(e.params._meta)&&e.params._meta[`io.modelcontextprotocol/protocolVersion`]===`2026-07-28`}function isPlainRecord(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}async function probeEarlierValidationFailure(r,i){let a=new Headers(r.headers);a.set(`mcp-protocol-version`,MCP_PROTOCOL_VERSION);let o=new Request(r.url,{body:JSON.stringify(i),headers:a,method:r.method}),s=createMcpHandler(()=>new McpServer({name:`eve-mcp-preflight`,version:`0`}),{legacy:`reject`});try{let e=await s.fetch(o,{parsedBody:i});if(e.status===406||e.status===415)return e;if(e.status===400){let t=await e.clone().json().catch(()=>void 0);if(t?.error?.code===-32700||t?.error?.code===-32600||t?.error?.code===-32602||t?.error?.code===-32022)return e}await e.body?.cancel();return}finally{await s.close().catch(()=>{})}}function headerMismatchResponse(e){let t=`the body carries a modern MCP envelope but the required MCP-Protocol-Version header is absent`;return Response.json({error:{code:-32020,data:{mismatch:{body:t,header:`(missing)`}},message:`Bad Request: the request headers and body disagree: ${t}`},id:readJsonRpcRequestId(e),jsonrpc:`2.0`},{status:400})}function readJsonRpcRequestId(e){if(typeof e!=`object`||!e||Array.isArray(e))return null;let t=Reflect.get(e,`id`);return typeof t==`string`||typeof t==`number`?t:null}function createServer(t,n,r){let i=new McpServer({name:t.name,version:t.version},{capabilities:{tools:{listChanged:!1}}});for(let e of n.values())e.register(i,r);return i}async function callTool(e,t,n,r){try{return await e(t,{auth:r,signal:n})}catch(e){return toolError(e instanceof Error?e.message:`Tool call failed.`)}}function toolError(e){return{content:[{type:`text`,text:e}],isError:!0}}export{MCP_LEGACY_PROTOCOL_VERSION,MCP_PROTOCOL_VERSION,createMcpStreamableHttpServer,defineMcpTool};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{readFile,readdir,rm,stat,writeFile}from"node:fs/promises";import{
|
|
1
|
+
import{readFile,readdir,rm,stat,writeFile}from"node:fs/promises";import{join,resolve}from"node:path";import{existsSync}from"node:fs";const DEVELOPMENT_RUNTIME_ARTIFACTS_ACTIVATED_MARKER=`activated`,DEVELOPMENT_RUNTIME_ARTIFACTS_RETIRED_METADATA=`retired.json`;async function recordRetiredDevelopmentRuntimeArtifactsSnapshot(e,t=Date.now()){await writeFile(join(e,DEVELOPMENT_RUNTIME_ARTIFACTS_RETIRED_METADATA),`${JSON.stringify({retiredAt:t})}\n`)}async function pruneDevelopmentRuntimeArtifactsSnapshotDirectory(e){if(e.protectAll)return;let i=e.now??Date.now(),a=Math.max(0,e.gracePeriodMs??18e5),o=Math.max(0,Math.trunc(e.retainCount??5)),s;try{s=await readdir(e.snapshotsDirectory,{withFileTypes:!0})}catch(e){if(e instanceof Error&&`code`in e&&e.code===`ENOENT`)return;throw e}let c=e.activeSnapshotRoot===void 0?void 0:resolve(e.activeSnapshotRoot),l=await Promise.all(s.filter(e=>e.isDirectory()).map(async t=>{let n=join(e.snapshotsDirectory,t.name),a=c===resolve(n),o=existsSync(join(n,DEVELOPMENT_RUNTIME_ARTIFACTS_ACTIVATED_MARKER)),s;if(o&&!a)try{s=await readRetiredAt(n),s===void 0&&(await recordRetiredDevelopmentRuntimeArtifactsSnapshot(n,i),s=i)}catch(e){console.warn(`[eve:dev] failed to read or initialize runtime generation retirement metadata for "${n}": ${String(e)}`)}return{activated:o,active:a,path:n,retiredAt:s,mtimeMs:(await stat(n)).mtimeMs}})),u=new Set(l.flatMap(e=>e.retiredAt===void 0?[]:[{path:e.path,retiredAt:e.retiredAt}]).sort((e,t)=>t.retiredAt-e.retiredAt).slice(0,o).map(e=>e.path)),d=new Set(l.filter(e=>!e.activated).sort((e,t)=>t.mtimeMs-e.mtimeMs).slice(0,o).map(e=>e.path));await Promise.all(l.map(async e=>{e.active||e.activated&&e.retiredAt===void 0||u.has(e.path)||d.has(e.path)||e.retiredAt!==void 0&&i-e.retiredAt<=a||!e.activated&&i-e.mtimeMs<=a||await rm(e.path,{force:!0,recursive:!0})}))}async function readRetiredAt(t){let n;try{n=await readFile(join(t,DEVELOPMENT_RUNTIME_ARTIFACTS_RETIRED_METADATA),`utf8`)}catch(e){if(e instanceof Error&&`code`in e&&e.code===`ENOENT`)return;throw e}let r;try{r=JSON.parse(n)}catch{return}if(typeof r==`object`&&r&&!Array.isArray(r)&&`retiredAt`in r&&typeof r.retiredAt==`number`&&Number.isFinite(r.retiredAt)&&r.retiredAt>=0)return r.retiredAt}export{DEVELOPMENT_RUNTIME_ARTIFACTS_ACTIVATED_MARKER,pruneDevelopmentRuntimeArtifactsSnapshotDirectory,recordRetiredDevelopmentRuntimeArtifactsSnapshot};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{randomUUID}from"node:crypto";import{cp,mkdir,readFile,rm,writeFile}from"node:fs/promises";import{
|
|
1
|
+
import{randomUUID}from"node:crypto";import{cp,mkdir,readFile,rm,writeFile}from"node:fs/promises";import{dirname,join,relative,resolve,sep}from"node:path";import{existsSync,readFileSync}from"node:fs";import{renameWithTransientBusyRetry}from"#shared/rename-with-retry.js";import{copyDevelopmentSourceSnapshot}from"#internal/nitro/dev-runtime-source-snapshot-copy.js";import{createDevelopmentSourceSnapshotPlan,toDevelopmentSourceSnapshotPath}from"#internal/nitro/dev-runtime-source-snapshot.js";import{DEVELOPMENT_RUNTIME_ARTIFACTS_ACTIVATED_MARKER,pruneDevelopmentRuntimeArtifactsSnapshotDirectory,recordRetiredDevelopmentRuntimeArtifactsSnapshot}from"#internal/nitro/dev-runtime-artifacts-retention.js";const DEV_RUNTIME_ARTIFACTS_DIRECTORY=`dev-runtime`;function resolveDevelopmentRuntimeArtifactsPointerPath(e){return join(e,`.eve`,DEV_RUNTIME_ARTIFACTS_DIRECTORY,`current.json`)}function resolveDevelopmentRuntimeArtifactsSnapshotsDirectory(e){return join(e,`.eve`,DEV_RUNTIME_ARTIFACTS_DIRECTORY,`snapshots`)}function isDevelopmentRuntimeArtifactsSnapshotRoot(e,t){return dirname(resolve(t))===resolve(resolveDevelopmentRuntimeArtifactsSnapshotsDirectory(e))}async function stageDevelopmentRuntimeArtifactsSnapshot(n){let r=join(resolveDevelopmentRuntimeArtifactsSnapshotsDirectory(n.project.appRoot),`${Date.now().toString(36)}-${randomUUID()}`),a=await createDevelopmentSourceSnapshotPlan({appRoot:n.project.appRoot,authoredSourceRoots:collectExtensionMountSourceRoots(n.manifest),snapshotRoot:r});try{await copyDevelopmentSourceSnapshot(a),await cp(n.paths.compileDirectoryPath,join(a.runtimeAppRoot,`.eve`,`compile`),{recursive:!0}),await rewriteSnapshotCompiledManifest({appRoot:n.project.appRoot,manifestPath:join(a.runtimeAppRoot,`.eve`,`compile`,`compiled-agent-manifest.json`),runtimeAppRoot:a.runtimeAppRoot,snapshotSourceRoot:a.snapshotSourceRoot,sourceRoot:a.sourceRoot}),await validateSnapshotCompiledManifestRoots({manifestPath:join(a.runtimeAppRoot,`.eve`,`compile`,`compiled-agent-manifest.json`),runtimeAppRoot:a.runtimeAppRoot}),await writeFile(join(r,`generation.json`),`${JSON.stringify({runtimeAppRoot:a.runtimeAppRoot})}\n`)}catch(e){throw await rm(r,{force:!0,recursive:!0}).catch(()=>{}),e}return{runtimeAppRoot:a.runtimeAppRoot,snapshotRoot:r,snapshotSourceRoot:a.snapshotSourceRoot,sourceRoot:a.sourceRoot}}async function activateDevelopmentRuntimeArtifactsSnapshot(e){(await activateDevelopmentRuntimeArtifactsSnapshotTransaction(e)).commit()}async function activateDevelopmentRuntimeArtifactsSnapshotTransaction(e){let t=join(e.snapshot.snapshotRoot,DEVELOPMENT_RUNTIME_ARTIFACTS_ACTIVATED_MARKER),n=resolveDevelopmentRuntimeArtifactsPointerPath(e.appRoot),r=readDevelopmentRuntimeArtifactsPointer(n),i=await readOptionalFile(n);try{await writeFile(t,``),await writeDevelopmentRuntimeArtifactsPointer(e),r?.version===2&&r.snapshotRoot!==e.snapshot.snapshotRoot&&isDevelopmentRuntimeArtifactsSnapshotRoot(e.appRoot,r.snapshotRoot)&&await recordRetiredDevelopmentRuntimeArtifactsSnapshot(r.snapshotRoot).catch(e=>{console.warn(`[eve:dev] failed to record retired runtime generation "${r.snapshotRoot}": ${String(e)}`)})}catch(e){throw await rollbackFailedActivation({cause:e,markerPath:t,pointerPath:n,previousPointerSource:i})}let a=!1;return{commit(){a=!0},async rollback(){if(a)return;a=!0;let e=await restoreDevelopmentRuntimeArtifactsActivation({markerPath:t,pointerPath:n,previousPointerSource:i});if(e!==void 0)throw e}}}function readDevelopmentRuntimeArtifactsSnapshotRoot(e){let t=readDevelopmentRuntimeArtifactsPointer(e);if(t!==void 0)return t.version===1?t.appRoot:t.runtimeAppRoot}function readActiveDevelopmentRuntimeArtifactsSnapshot(e){let t=readDevelopmentRuntimeArtifactsPointer(resolveDevelopmentRuntimeArtifactsPointerPath(e));if(!(t===void 0||t.version===1))return{runtimeAppRoot:t.runtimeAppRoot,snapshotRoot:t.snapshotRoot}}function readDevelopmentRuntimeArtifactsRevision(e){return{revision:readDevelopmentRuntimeArtifactsSnapshotRoot(resolveDevelopmentRuntimeArtifactsPointerPath(e))??e}}async function pruneDevelopmentRuntimeArtifactsSnapshots(e){let t=readDevelopmentRuntimeArtifactsPointer(resolveDevelopmentRuntimeArtifactsPointerPath(e.appRoot));await pruneDevelopmentRuntimeArtifactsSnapshotDirectory({activeSnapshotRoot:t?.version===2?t.snapshotRoot:void 0,gracePeriodMs:e.gracePeriodMs,now:e.now,protectAll:t?.version===1,retainCount:e.retainCount,snapshotsDirectory:resolveDevelopmentRuntimeArtifactsSnapshotsDirectory(e.appRoot)})}function collectExtensionMountSourceRoots(e){return e===void 0?[]:[e,...(e.subagents??[]).map(e=>e.agent)].flatMap(e=>(e.extensionMounts??[]).map(e=>e.sourceRoot))}function readDevelopmentRuntimeArtifactsPointer(e){if(!(e===void 0||!existsSync(e)))try{let t=JSON.parse(readFileSync(e,`utf8`));return t.kind!==`eve-dev-runtime-artifacts-pointer`||typeof t.version!=`number`?void 0:t.version===1&&typeof t.appRoot==`string`&&t.appRoot.length>0?{appRoot:t.appRoot,kind:`eve-dev-runtime-artifacts-pointer`,version:1}:t.version===2&&typeof t.appRoot==`string`&&typeof t.runtimeAppRoot==`string`&&t.runtimeAppRoot.length>0&&typeof t.snapshotRoot==`string`&&t.snapshotRoot.length>0?{appRoot:t.appRoot,kind:`eve-dev-runtime-artifacts-pointer`,runtimeAppRoot:t.runtimeAppRoot,snapshotRoot:t.snapshotRoot,version:2}:void 0}catch{return}}async function rewriteSnapshotCompiledManifest(e){let t=JSON.parse(await readFile(e.manifestPath,`utf8`)),n=rewriteManifestRoots({appRoot:e.appRoot,runtimeAppRoot:e.runtimeAppRoot,snapshotSourceRoot:e.snapshotSourceRoot,sourceRoot:e.sourceRoot,value:t});await writeFile(e.manifestPath,`${JSON.stringify(n,null,2)}\n`)}function rewriteManifestRoots(e){if(Array.isArray(e.value))return e.value.map(t=>rewriteManifestRoots({...e,value:t}));if(e.value===null||typeof e.value!=`object`)return e.value;let t={};for(let[n,r]of Object.entries(e.value)){if(typeof r==`string`&&(n===`appRoot`||n===`agentRoot`)){t[n]=rewritePathWithinAppRoot({appRoot:e.appRoot,path:r,runtimeAppRoot:e.runtimeAppRoot});continue}if(typeof r==`string`&&n===`sourceRoot`){t[n]=rewritePathWithinSourceRoot({path:r,snapshotSourceRoot:e.snapshotSourceRoot,sourceRoot:e.sourceRoot});continue}t[n]=rewriteManifestRoots({appRoot:e.appRoot,runtimeAppRoot:e.runtimeAppRoot,snapshotSourceRoot:e.snapshotSourceRoot,sourceRoot:e.sourceRoot,value:r})}return t}function rewritePathWithinSourceRoot(e){return isPathInsideOrEqual(e.path,e.sourceRoot)?toDevelopmentSourceSnapshotPath({snapshotSourceRoot:e.snapshotSourceRoot,sourcePath:e.path,sourceRoot:e.sourceRoot}):e.path}function rewritePathWithinAppRoot(e){if(!isPathInsideOrEqual(e.path,e.appRoot))return e.path;let t=relative(e.appRoot,e.path);return t.length===0?e.runtimeAppRoot:join(e.runtimeAppRoot,t)}async function writeDevelopmentRuntimeArtifactsPointer(e){let t=resolveDevelopmentRuntimeArtifactsPointerPath(e.appRoot),n={appRoot:e.appRoot,kind:`eve-dev-runtime-artifacts-pointer`,runtimeAppRoot:e.snapshot.runtimeAppRoot,snapshotRoot:e.snapshot.snapshotRoot,version:2};await writeDevelopmentRuntimeArtifactsPointerSource(t,`${JSON.stringify(n,null,2)}\n`)}async function writeDevelopmentRuntimeArtifactsPointerSource(t,r){let o=`${t}.${randomUUID()}.tmp`;await mkdir(dirname(t),{recursive:!0}),await writeFile(o,r);try{await renameWithTransientBusyRetry(o,t)}catch(e){throw await rm(o,{force:!0}).catch(()=>{}),e}}async function readOptionalFile(e){try{return await readFile(e,`utf8`)}catch(e){if(e instanceof Error&&`code`in e&&e.code===`ENOENT`)return;throw e}}async function rollbackFailedActivation(e){let t=await restoreDevelopmentRuntimeArtifactsActivation(e);return t===void 0?e.cause:AggregateError([e.cause,t],`Development runtime activation and rollback failed.`,{cause:e.cause})}async function restoreDevelopmentRuntimeArtifactsActivation(e){let t=(await Promise.allSettled([e.previousPointerSource===void 0?rm(e.pointerPath,{force:!0}):writeDevelopmentRuntimeArtifactsPointerSource(e.pointerPath,e.previousPointerSource),rm(e.markerPath,{force:!0})])).flatMap(e=>e.status===`rejected`?[e.reason]:[]);if(t.length!==0)return AggregateError(t,`Failed to restore development runtime activation.`)}async function validateSnapshotCompiledManifestRoots(e){let t=collectManifestRootPaths(JSON.parse(await readFile(e.manifestPath,`utf8`)));for(let n of t)if(!isPathInsideOrEqual(n,e.runtimeAppRoot))throw Error(`Development runtime snapshot manifest root "${n}" is outside runtime app root "${e.runtimeAppRoot}".`)}function collectManifestRootPaths(e){if(Array.isArray(e))return e.flatMap(e=>collectManifestRootPaths(e));if(typeof e!=`object`||!e)return[];let t=[];for(let[n,r]of Object.entries(e)){if((n===`appRoot`||n===`agentRoot`)&&typeof r==`string`){t.push(r);continue}t.push(...collectManifestRootPaths(r))}return t}function isPathInsideOrEqual(e,t){let n=resolve(e),r=resolve(t);return n===r||n.startsWith(`${r}${sep}`)}export{activateDevelopmentRuntimeArtifactsSnapshot,activateDevelopmentRuntimeArtifactsSnapshotTransaction,pruneDevelopmentRuntimeArtifactsSnapshots,readActiveDevelopmentRuntimeArtifactsSnapshot,readDevelopmentRuntimeArtifactsRevision,readDevelopmentRuntimeArtifactsSnapshotRoot,resolveDevelopmentRuntimeArtifactsPointerPath,stageDevelopmentRuntimeArtifactsSnapshot};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{cp,lstat,mkdir,readFile,readdir,symlink,writeFile}from"node:fs/promises";import{
|
|
1
|
+
import{cp,lstat,mkdir,readFile,readdir,symlink,writeFile}from"node:fs/promises";import{dirname,join,relative,resolve,sep}from"node:path";import{constants,existsSync}from"node:fs";import{DevelopmentRuntimeSourceSnapshotError,toDevelopmentSourceSnapshotPath}from"#internal/nitro/dev-runtime-source-snapshot.js";import{extractTsConfigExtendsSpecifiers,isTsConfigFilePath,parseTsConfigObject,readTextFileIfExists,resolveFirstExistingTsConfigExtendsTarget,resolveTsConfigExtendsTargetPaths}from"#internal/application/tsconfig-dependencies.js";const SNAPSHOT_SKIP_NAMES=new Set([`.devtools`,`.generated`,`.eve`,`.git`,`.next`,`.output`,`.turbo`,`.vercel`,`.workflow-data`,`.workflow-vitest`,`node_modules`]),SNAPSHOT_APP_ROOT_SKIP_NAMES=new Set([`build`,`dist`]),SNAPSHOT_COPY_MODE=constants.COPYFILE_FICLONE;async function copyDevelopmentSourceSnapshot(e){await mkdir(e.snapshotSourceRoot,{recursive:!0});for(let t of e.copyRoots)await copySnapshotPath({plan:e,sourcePath:t,targetPath:toSnapshotPathForPlan(e,t)});for(let t of e.copyFiles)existsSync(t)&&await copySnapshotPath({plan:e,sourcePath:t,targetPath:toSnapshotPathForPlan(e,t)});await rewriteSnapshotTsConfigAbsoluteExtends(e),await createSnapshotDependencyMounts(e),await ensureRuntimePackageJson(e),await validateDevelopmentSourceSnapshot(e)}async function copySnapshotPath(r){try{if((await lstat(r.sourcePath)).isDirectory()){await copySnapshotDirectory(r);return}await mkdir(dirname(r.targetPath),{recursive:!0}),await cp(r.sourcePath,r.targetPath,{mode:SNAPSHOT_COPY_MODE,recursive:!0})}catch(e){throw new DevelopmentRuntimeSourceSnapshotError(`Failed to copy development runtime source snapshot path "${r.sourcePath}" to "${r.targetPath}": ${formatErrorMessage(e)}`)}}async function copySnapshotDirectory(t){await mkdir(t.targetPath,{recursive:!0});for(let n of await readdir(t.sourcePath,{withFileTypes:!0})){let r=join(t.sourcePath,n.name);shouldSkipSnapshotSource(t.plan,r)||await cp(r,join(t.targetPath,n.name),{filter:e=>!shouldSkipSnapshotSource(t.plan,e),mode:SNAPSHOT_COPY_MODE,recursive:!0})}}function shouldSkipSnapshotSource(e,t){let n=relative(e.sourceRoot,t);return n.length===0?!1:n.split(/[\\/]/).some(e=>SNAPSHOT_SKIP_NAMES.has(e)||e.startsWith(`.env`))||existsSync(join(t,`.git`))?!0:isDirectAppRootSkipPath({appRoot:e.appRoot,sourcePath:t})}function isDirectAppRootSkipPath(e){if(!isPathInsideOrEqual(e.sourcePath,e.appRoot))return!1;let t=relative(e.appRoot,e.sourcePath);if(t.length===0)return!1;let n=t.split(/[\\/]/)[0];return n!==void 0&&SNAPSHOT_APP_ROOT_SKIP_NAMES.has(n)}async function rewriteSnapshotTsConfigAbsoluteExtends(e){for(let t of e.tsconfigPaths){let n=await readTextFileIfExists(t);if(n===void 0)continue;let r=rewriteTsConfigAbsoluteExtends({configPath:t,snapshotConfigPath:toSnapshotPathForPlan(e,t),snapshotSourceRoot:e.snapshotSourceRoot,source:n,sourceRoot:e.sourceRoot});r!==void 0&&await writeFile(toSnapshotPathForPlan(e,t),r)}}function rewriteTsConfigAbsoluteExtends(e){let t=parseTsConfigObject(e.source);if(t===void 0)return;let n=rewriteTsConfigExtendsValue({configPath:e.configPath,snapshotConfigPath:e.snapshotConfigPath,snapshotSourceRoot:e.snapshotSourceRoot,sourceRoot:e.sourceRoot,value:t.extends});if(n.changed===!0)return`${JSON.stringify({...t,extends:n.value},null,2)}\n`}function rewriteTsConfigExtendsValue(e){if(typeof e.value==`string`){let t=rewriteTsConfigExtendsSpecifier({configPath:e.configPath,snapshotConfigPath:e.snapshotConfigPath,snapshotSourceRoot:e.snapshotSourceRoot,sourceRoot:e.sourceRoot,value:e.value});return t===void 0?{changed:!1,value:e.value}:{changed:!0,value:t}}if(!Array.isArray(e.value))return{changed:!1,value:e.value};let t=!1,n=e.value.map(n=>{if(typeof n!=`string`)return n;let r=rewriteTsConfigExtendsSpecifier({configPath:e.configPath,snapshotConfigPath:e.snapshotConfigPath,snapshotSourceRoot:e.snapshotSourceRoot,sourceRoot:e.sourceRoot,value:n});return r===void 0?n:(t=!0,r)});return{changed:t,value:n}}function rewriteTsConfigExtendsSpecifier(e){if(!isTsConfigFilePath(e.value)||!isAbsoluteFilePath(e.value))return;let t=resolveFirstExistingTsConfigExtendsTarget({configPath:e.configPath,extendsSpecifier:e.value});if(!(t===void 0||!isPathInsideOrEqual(t,e.sourceRoot)))return toDevelopmentSourceSnapshotPath({snapshotSourceRoot:e.snapshotSourceRoot,sourcePath:t,sourceRoot:e.sourceRoot})}async function createSnapshotDependencyMounts(e){for(let t of e.dependencyMounts){let r=toSnapshotPathForPlan(e,t.mountPath),i=t.copied?toSnapshotPathForPlan(e,t.sourcePath):t.sourcePath,a=t.copied?relative(dirname(r),i)||`.`:i;await mkdir(dirname(r),{recursive:!0}),await symlink(a,r,`junction`)}}async function ensureRuntimePackageJson(e){let t=join(e.runtimeAppRoot,`package.json`);existsSync(t)||(await mkdir(e.runtimeAppRoot,{recursive:!0}),await writeFile(t,`${JSON.stringify({private:!0,type:`module`},null,2)}\n`))}async function validateDevelopmentSourceSnapshot(e){let t=join(e.runtimeAppRoot,`package.json`);if(!existsSync(t))throw new DevelopmentRuntimeSourceSnapshotError(`Development runtime source snapshot is missing the runtime app package.json at "${t}".`);for(let t of e.tsconfigPaths){let n=toSnapshotPathForPlan(e,t);if(!existsSync(n))throw new DevelopmentRuntimeSourceSnapshotError(`Development runtime source snapshot is missing tsconfig dependency "${n}".`);await validateSnapshotTsConfigExtends(n)}}async function validateSnapshotTsConfigExtends(e){let t=extractTsConfigExtendsSpecifiers(await readFile(e,`utf8`));for(let n of t)if(!(!isTsConfigFilePath(n)||resolveTsConfigExtendsTargetPaths({configPath:e,extendsSpecifier:n}).some(e=>existsSync(e))))throw new DevelopmentRuntimeSourceSnapshotError(`Development runtime source snapshot cannot resolve tsconfig extends "${n}" from "${e}".`)}function toSnapshotPathForPlan(e,t){return toDevelopmentSourceSnapshotPath({snapshotSourceRoot:e.snapshotSourceRoot,sourcePath:t,sourceRoot:e.sourceRoot})}function isPathInsideOrEqual(e,t){let n=resolve(e),r=resolve(t);return n===r||n.startsWith(`${r}${sep}`)}function isAbsoluteFilePath(e){return e.startsWith(`/`)||/^[A-Za-z]:[\\/]/.test(e)}function formatErrorMessage(e){return e instanceof Error?e.message:String(e)}export{copyDevelopmentSourceSnapshot};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{lstat}from"node:fs/promises";import{
|
|
1
|
+
import{lstat}from"node:fs/promises";import{dirname,join,relative,resolve,sep}from"node:path";import{existsSync}from"node:fs";import{parseTsConfigObject,readTextFileIfExists}from"#internal/application/tsconfig-dependencies.js";async function resolveLocalTsConfigPathTargetRoots(e){let n=await readTextFileIfExists(e.configPath);if(n===void 0)return[];let r=parseTsConfigObject(n),i=isObjectRecord(r?.compilerOptions)?r.compilerOptions:void 0,a=isObjectRecord(i?.paths)?i.paths:void 0;if(i===void 0||a===void 0)return[];let s=typeof i.baseUrl==`string`?resolve(dirname(e.configPath),i.baseUrl):dirname(e.configPath),c=new Set;for(let t of Object.values(a))if(Array.isArray(t))for(let n of t){if(typeof n!=`string`||n.length===0)continue;let t=await resolveLocalTsConfigPathTargetRoot({baseDirectory:s,sourceRoot:e.sourceRoot,target:n});t!==void 0&&c.add(t)}return[...c].sort((e,t)=>e.localeCompare(t))}async function resolveNearestPackageRoot(r,i){let o=resolve(r);try{(await lstat(o)).isDirectory()||(o=dirname(o))}catch{o=dirname(o)}for(;isAuthoredSourcePath(o,i);){if(existsSync(join(o,`package.json`)))return o;let e=dirname(o);if(e===o)return;o=e}}function isAuthoredSourcePath(e,t){return isPathInsideOrEqual(e,t)?!relative(t,e).split(/[\\/]/).includes(`node_modules`):!1}function isPathInsideOrEqual(e,t){let n=resolve(e),r=resolve(t);return n===r||n.startsWith(`${r}${sep}`)}async function resolveLocalTsConfigPathTargetRoot(e){let t=e.target.includes(`*`),n=t?e.target.slice(0,e.target.indexOf(`*`)):e.target;if(n.length===0||n===`.`||n===`./`)return;let r=resolve(e.baseDirectory,n);if(!isAuthoredSourcePath(r,e.sourceRoot))return;let i=await resolveExistingPathOrAncestor({path:r,stopDirectory:e.sourceRoot});if(i===void 0)return;let a=await resolveNearestPackageRoot(i,e.sourceRoot);if(a!==void 0&&a!==e.sourceRoot)return a;if(!t)return i===e.sourceRoot?void 0:i}async function resolveExistingPathOrAncestor(e){let n=resolve(e.path);for(;isAuthoredSourcePath(n,e.stopDirectory);){if(existsSync(n))return n;let e=dirname(n);if(e===n)return;n=e}}function isObjectRecord(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}export{isAuthoredSourcePath,isPathInsideOrEqual,resolveLocalTsConfigPathTargetRoots,resolveNearestPackageRoot};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{lstat,readlink,realpath}from"node:fs/promises";import{
|
|
1
|
+
import{lstat,readlink,realpath}from"node:fs/promises";import{dirname,join,relative,resolve}from"node:path";import{existsSync,readFileSync}from"node:fs";import{readTextFileIfExists,resolveTsConfigDependencyPaths}from"#internal/application/tsconfig-dependencies.js";import{isAuthoredSourcePath,isAuthoredSourcePath as isAuthoredSourcePath$1,isPathInsideOrEqual,resolveLocalTsConfigPathTargetRoots,resolveNearestPackageRoot}from"#internal/nitro/dev-runtime-source-snapshot-local-roots.js";const DEV_RUNTIME_SOURCE_DIRECTORY=`source`,SOURCE_ROOT_MARKER_NAMES=[`.git`,`pnpm-workspace.yaml`],WORKSPACE_METADATA_FILE_NAMES=[`package.json`,`pnpm-workspace.yaml`,`pnpm-lock.yaml`,`package-lock.json`,`yarn.lock`,`bun.lock`,`bun.lockb`,`.npmrc`],PACKAGE_DEPENDENCY_FIELDS=[`dependencies`,`devDependencies`,`optionalDependencies`,`peerDependencies`];var DevelopmentRuntimeSourceSnapshotError=class extends Error{constructor(e){super(e),this.name=`DevelopmentRuntimeSourceSnapshotError`}};async function createDevelopmentSourceSnapshotPlan(e){let t=resolve(e.appRoot),n=resolve(e.snapshotRoot),r=resolveDevelopmentSourceRoot(t),a=join(n,DEV_RUNTIME_SOURCE_DIRECTORY),o={appRoot:t,authoredLocalRoots:new Set([t]),copyFiles:new Set,dependencyMountsByPath:new Map,localRootsToProcess:[t],processedLocalRoots:new Set,snapshotRoot:n,snapshotSourceRoot:a,sourceRoot:r,tsconfigPaths:new Set};for(addWorkspaceMetadataFiles(o),await addAuthoredSourceRoots(o,e.authoredSourceRoots??[]);o.localRootsToProcess.length>0;){let e=o.localRootsToProcess.shift();if(e===void 0)continue;let t=resolve(e);o.processedLocalRoots.has(t)||!isAuthoredSourcePath$1(t,r)||(o.processedLocalRoots.add(t),await addTsConfigDependenciesForRoot(o,t),await addDependencyMountsForRoot(o,t))}let s=normalizeCopyRoots([...o.processedLocalRoots].filter(e=>o.authoredLocalRoots.has(e))),c=[...o.copyFiles].filter(e=>isPathInsideOrEqual(e,r)).sort((e,t)=>e.localeCompare(t)),l=[...o.tsconfigPaths].filter(e=>isPathInsideOrEqual(e,r)).sort((e,t)=>e.localeCompare(t)),u=[...o.dependencyMountsByPath.values()].map(e=>({...e,copied:e.sourceKind===`workspace`&&[...o.authoredLocalRoots].some(t=>isPathInsideOrEqual(e.sourcePath,t))})).sort((e,t)=>e.mountPath.localeCompare(t.mountPath)),d=createWatchPaths({appRoot:t,copyFiles:c,copyRoots:s,dependencyMounts:u,sourceRoot:r,tsconfigPaths:l});return{appRoot:t,copyFiles:c,copyRoots:s,dependencyMounts:u,runtimeAppRoot:toSnapshotPath({sourcePath:t,sourceRoot:r,snapshotSourceRoot:a}),snapshotRoot:n,snapshotSourceRoot:a,sourceRoot:r,tsconfigPaths:l,watchPaths:d}}async function resolveDevelopmentSourceSnapshotWatchPaths(e){return[...(await createDevelopmentSourceSnapshotPlan({appRoot:e,snapshotRoot:join(resolve(e),`.eve`,`dev-runtime`,`__watch-plan__`)})).watchPaths]}function toDevelopmentSourceSnapshotPath(e){return toSnapshotPath(e)}function resolveDevelopmentSourceRoot(e){let t=resolve(e);for(;;){if(SOURCE_ROOT_MARKER_NAMES.some(e=>existsSync(join(t,e)))||isWorkspaceManifestRoot(t))return t;let n=dirname(t);if(n===t)return resolve(e);t=n}}function addWorkspaceMetadataFiles(e){for(let t of WORKSPACE_METADATA_FILE_NAMES){let n=join(e.sourceRoot,t);existsSync(n)&&e.copyFiles.add(n)}}async function addAuthoredSourceRoots(e,t){for(let n of t){let t=resolve(n);if(!isAuthoredSourcePath$1(t,e.sourceRoot))continue;let r=await resolveNearestPackageRoot(t,e.sourceRoot)??t;e.authoredLocalRoots.add(r),enqueueLocalRoot(e,r)}}async function addTsConfigDependenciesForRoot(e,t){let n=await resolveTsConfigDependencyPaths(t);for(let t of n)if(isPathInsideOrEqual(t,e.sourceRoot)){e.tsconfigPaths.add(t),e.copyFiles.add(t);for(let n of await resolveLocalTsConfigPathTargetRoots({configPath:t,sourceRoot:e.sourceRoot}))e.authoredLocalRoots.add(n),enqueueLocalRoot(e,n)}}async function addDependencyMountsForRoot(e,t){let n=await readPackageDependencyNames(resolveDependencyDeclarationRoot(t,e.sourceRoot));for(let r of n)for(let n of listAncestorNodeModulesRoots(t,e.sourceRoot))await addDependencyMount(e,joinNodeModulesPackagePath(n,r))}function resolveDependencyDeclarationRoot(e,t){let n=resolve(e),a=resolve(t);for(;isPathInsideOrEqual(n,a);){if(existsSync(join(n,`package.json`)))return n;let e=dirname(n);if(e===n)break;n=e}return e}function listAncestorNodeModulesRoots(e,t){let n=resolve(t),i=new Set,a=resolve(e);for(;isPathInsideOrEqual(a,n);){i.add(a);let e=dirname(a);if(e===a)break;a=e}return i.add(resolve(e)),i.add(n),[...i]}function isWorkspaceManifestRoot(e){let t=join(e,`package.json`);if(!existsSync(t))return!1;try{let e=JSON.parse(readFileSync(t,`utf8`));return isObjectRecord(e)&&e.workspaces!==void 0}catch{return!1}}async function addDependencyMount(t,n){let r;try{r=await lstat(n)}catch{return}if(!r.isDirectory()&&!r.isSymbolicLink())return;let i=await resolveDependencySourcePathCandidates(n),a=i.find(e=>isAuthoredSourcePath$1(e,t.sourceRoot));if(a!==void 0){await addWorkspaceDependencyMount({mountPath:n,state:t,sourcePath:a});return}let s=i.find(e=>existsSync(e));s!==void 0&&t.dependencyMountsByPath.set(resolve(n),{mountPath:resolve(n),sourceKind:`installed`,sourcePath:s})}async function addWorkspaceDependencyMount(e){let t=await resolveNearestPackageRoot(e.sourcePath,e.state.sourceRoot);if(t===void 0||!isAuthoredSourcePath$1(t,e.state.sourceRoot))return;let{state:n}=e;enqueueLocalRoot(n,t),n.dependencyMountsByPath.set(resolve(e.mountPath),{mountPath:resolve(e.mountPath),sourceKind:`workspace`,sourcePath:t})}async function resolveDependencySourcePathCandidates(e){let i=new Set;try{let n=await readlink(e);i.add(resolve(dirname(e),n))}catch{}try{i.add(await realpath(e))}catch{}return[...i]}function enqueueLocalRoot(e,t){let n=resolve(t);e.processedLocalRoots.has(n)||e.localRootsToProcess.includes(n)||!isAuthoredSourcePath$1(n,e.sourceRoot)||e.localRootsToProcess.push(n)}async function readPackageDependencyNames(e){let t=await readTextFileIfExists(join(e,`package.json`));if(t===void 0)return[];let n;try{n=JSON.parse(t)}catch{return[]}if(!isObjectRecord(n))return[];let r=new Set;for(let e of PACKAGE_DEPENDENCY_FIELDS){let t=n[e];if(isObjectRecord(t))for(let e of Object.keys(t))r.add(e)}return[...r].sort((e,t)=>e.localeCompare(t))}function normalizeCopyRoots(e){let t=[...new Set(e.map(e=>resolve(e)))].sort((e,t)=>{let n=e.length-t.length;return n===0?e.localeCompare(t):n}),n=[];for(let e of t)n.some(t=>isPathInsideOrEqual(e,t))||n.push(e);return n.sort((e,t)=>e.localeCompare(t))}function createWatchPaths(e){let t=new Set([join(e.appRoot,`package.json`),...e.copyFiles,...e.tsconfigPaths]);for(let n of e.copyRoots)n!==e.appRoot&&t.add(n);for(let n of e.dependencyMounts)n.sourceKind===`workspace`&&n.sourcePath!==e.appRoot&&t.add(n.sourcePath);if(e.sourceRoot!==e.appRoot)for(let n of WORKSPACE_METADATA_FILE_NAMES){let r=join(e.sourceRoot,n);existsSync(r)&&t.add(r)}return[...t].sort((e,t)=>e.localeCompare(t))}function joinNodeModulesPackagePath(e,t){return join(e,`node_modules`,...t.split(`/`))}function toSnapshotPath(e){if(!isPathInsideOrEqual(e.sourcePath,e.sourceRoot))throw new DevelopmentRuntimeSourceSnapshotError(`Cannot map source path "${e.sourcePath}" into a development runtime snapshot because it is outside source root "${e.sourceRoot}".`);return join(e.snapshotSourceRoot,relative(e.sourceRoot,e.sourcePath))}function isObjectRecord(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}export{DEV_RUNTIME_SOURCE_DIRECTORY,DevelopmentRuntimeSourceSnapshotError,createDevelopmentSourceSnapshotPlan,isAuthoredSourcePath,resolveDevelopmentSourceRoot,resolveDevelopmentSourceSnapshotWatchPaths,toDevelopmentSourceSnapshotPath};
|