eve 0.91.0 → 1.0.0-rc.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.
Files changed (161) hide show
  1. package/CHANGELOG.md +21 -34
  2. package/README.md +1 -3
  3. package/dist/src/channel/routes.d.ts +7 -3
  4. package/dist/src/channel/skill-files.d.ts +22 -25
  5. package/dist/src/channel/skill-files.js +1 -1
  6. package/dist/src/cli/commands/registry.js +1 -1
  7. package/dist/src/compiled/.vendor-stamp.json +3 -3
  8. package/dist/src/compiled/semver/index.d.ts +5 -1
  9. package/dist/src/compiler/channel-route-plan.d.ts +2 -0
  10. package/dist/src/compiler/channel-route-plan.js +1 -1
  11. package/dist/src/compiler/normalize-agent-config.js +1 -1
  12. package/dist/src/execution/dynamic-workflow/tool.js +1 -1
  13. package/dist/src/execution/tools/agent-router-workflow.js +1 -1
  14. package/dist/src/extensions/git/extension/lib/gh-tool.js +1 -1
  15. package/dist/src/framework/host-inventory.js +1 -1
  16. package/dist/src/internal/application/compiled-artifacts.d.ts +0 -11
  17. package/dist/src/internal/application/compiled-artifacts.js +3 -3
  18. package/dist/src/internal/application/import-specifier.d.ts +6 -0
  19. package/dist/src/internal/application/import-specifier.js +1 -1
  20. package/dist/src/internal/application/paths.d.ts +2 -10
  21. package/dist/src/internal/application/paths.js +1 -1
  22. package/dist/src/internal/application/stamped-package-version.js +1 -1
  23. package/dist/src/internal/authored-asset-import-plugin.d.ts +18 -1
  24. package/dist/src/internal/authored-asset-import-plugin.js +1 -1
  25. package/dist/src/internal/authored-package-boundary.js +1 -1
  26. package/dist/src/internal/authored-package-tsconfig-paths.js +1 -1
  27. package/dist/src/internal/bundler/extension-mount-plugin.d.ts +19 -1
  28. package/dist/src/internal/bundler/extension-scope-plugin.d.ts +15 -5
  29. package/dist/src/internal/bundler/extension-scope-plugin.js +2 -2
  30. package/dist/src/internal/bundler/filters.d.ts +7 -0
  31. package/dist/src/internal/bundler/filters.js +1 -0
  32. package/dist/src/internal/bundler/pseudo-packages.d.ts +17 -7
  33. package/dist/src/internal/bundler/pseudo-packages.js +1 -1
  34. package/dist/src/internal/bundler/vendored-dependency-log.d.ts +1 -1
  35. package/dist/src/internal/nitro/dev-runtime-artifacts-retention.d.ts +0 -1
  36. package/dist/src/internal/nitro/dev-runtime-artifacts-retention.js +1 -1
  37. package/dist/src/internal/nitro/dev-runtime-artifacts.d.ts +2 -6
  38. package/dist/src/internal/nitro/dev-runtime-artifacts.js +1 -1
  39. package/dist/src/internal/nitro/dev-runtime-source-snapshot-local-roots.d.ts +0 -1
  40. package/dist/src/internal/nitro/dev-runtime-source-snapshot-local-roots.js +1 -1
  41. package/dist/src/internal/nitro/dev-runtime-source-snapshot.js +1 -1
  42. package/dist/src/internal/nitro/development-generation.d.ts +18 -6
  43. package/dist/src/internal/nitro/development-generation.js +1 -1
  44. package/dist/src/internal/nitro/host/build-application.js +1 -1
  45. package/dist/src/internal/nitro/host/create-host-nitro.d.ts +7 -0
  46. package/dist/src/internal/nitro/host/create-host-nitro.js +1 -0
  47. package/dist/src/internal/nitro/host/dev-authored-rebuild-coordinator.d.ts +2 -0
  48. package/dist/src/internal/nitro/host/dev-authored-rebuild-coordinator.js +1 -1
  49. package/dist/src/internal/nitro/host/dev-authored-source-watcher.js +1 -1
  50. package/dist/src/internal/nitro/host/dev-build-operations.js +1 -1
  51. package/dist/src/internal/nitro/host/dev-host-fingerprint.d.ts +4 -0
  52. package/dist/src/internal/nitro/host/dev-host-fingerprint.js +1 -1
  53. package/dist/src/internal/nitro/host/drained-nitro-dev-server.js +1 -1
  54. package/dist/src/internal/nitro/host/extension-external-dependencies.d.ts +7 -0
  55. package/dist/src/internal/nitro/host/extension-external-dependencies.js +1 -0
  56. package/dist/src/internal/nitro/host/{external-dependency-output-check-plugin.d.ts → external-dependency-output-check.d.ts} +4 -9
  57. package/dist/src/internal/nitro/host/external-dependency-output-check.js +3 -0
  58. package/dist/src/internal/nitro/host/externals-policy.d.ts +21 -0
  59. package/dist/src/internal/nitro/host/externals-policy.js +1 -0
  60. package/dist/src/internal/nitro/host/host-plugins.d.ts +41 -0
  61. package/dist/src/internal/nitro/host/host-plugins.js +1 -0
  62. package/dist/src/internal/nitro/host/host-routes.d.ts +90 -0
  63. package/dist/src/internal/nitro/host/host-routes.js +1 -0
  64. package/dist/src/internal/nitro/host/host-spec.d.ts +65 -0
  65. package/dist/src/internal/nitro/host/host-spec.js +1 -0
  66. package/dist/src/internal/nitro/host/hosted-graph-plugin.d.ts +41 -0
  67. package/dist/src/internal/nitro/host/hosted-graph-plugin.js +5 -0
  68. package/dist/src/internal/nitro/host/instrumentation-entry.d.ts +35 -3
  69. package/dist/src/internal/nitro/host/instrumentation-entry.js +2 -2
  70. package/dist/src/internal/nitro/host/nitro-bundler-config.d.ts +2 -5
  71. package/dist/src/internal/nitro/host/nitro-bundler-config.js +1 -1
  72. package/dist/src/internal/nitro/host/nitro-routing-import-specifier-plugin.d.ts +14 -4
  73. package/dist/src/internal/nitro/host/nitro-routing-import-specifier-plugin.js +1 -1
  74. package/dist/src/internal/nitro/host/ports.d.ts +10 -0
  75. package/dist/src/internal/nitro/host/ports.js +1 -1
  76. package/dist/src/internal/nitro/host/route-handlers.d.ts +62 -0
  77. package/dist/src/internal/nitro/host/route-handlers.js +9 -0
  78. package/dist/src/internal/nitro/host/skill-files-plugin.d.ts +21 -0
  79. package/dist/src/internal/nitro/host/skill-files-plugin.js +2 -0
  80. package/dist/src/internal/nitro/host/start-development-server.js +2 -2
  81. package/dist/src/internal/nitro/host/start-production-server.js +1 -1
  82. package/dist/src/internal/nitro/host/vercel-build-output-config.d.ts +16 -19
  83. package/dist/src/internal/nitro/host/vercel-build-output-config.js +1 -1
  84. package/dist/src/internal/nitro/host/vercel-output.d.ts +15 -0
  85. package/dist/src/internal/nitro/host/vercel-output.js +1 -0
  86. package/dist/src/internal/nitro/host/workspace-extensions.js +1 -1
  87. package/dist/src/internal/nitro/routes/channel-dispatch.d.ts +4 -3
  88. package/dist/src/internal/nitro/routes/channel-dispatch.js +1 -1
  89. package/dist/src/internal/nitro/routes/connection-events.js +1 -1
  90. package/dist/src/internal/nitro/routes/dev-schedule-dispatch.d.ts +1 -1
  91. package/dist/src/internal/nitro/routes/method-guard.d.ts +6 -0
  92. package/dist/src/internal/nitro/routes/method-guard.js +1 -0
  93. package/dist/src/internal/nitro/routes/schedule-collection-consumer.js +1 -1
  94. package/dist/src/internal/workflow-bundle/builder-support.d.ts +0 -9
  95. package/dist/src/internal/workflow-bundle/builder.d.ts +9 -5
  96. package/dist/src/internal/workflow-bundle/builder.js +2 -2
  97. package/dist/src/internal/workflow-bundle/flow-route.d.ts +2 -0
  98. package/dist/src/internal/workflow-bundle/flow-route.js +1 -0
  99. package/dist/src/internal/workflow-bundle/nitro-step-entry.d.ts +7 -5
  100. package/dist/src/internal/workflow-bundle/nitro-step-entry.js +2 -2
  101. package/dist/src/runtime/sessions/runtime-session.d.ts +3 -0
  102. package/dist/src/runtime/sessions/runtime-session.js +1 -1
  103. package/dist/src/runtime/subagents/workflow.js +1 -1
  104. package/dist/src/setup/scaffold/create/project.js +1 -1
  105. package/dist/src/shared/path-inside.d.ts +2 -0
  106. package/dist/src/shared/path-inside.js +1 -0
  107. package/dist/src/shared/workflow-sandbox.d.ts +5 -1
  108. package/dist/src/shared/workflow-sandbox.js +1 -1
  109. package/dist/src/tools/provided/ask-question-workflow.js +1 -1
  110. package/dist/src/tools/provided/sleep-workflow.js +1 -1
  111. package/docs/README.md +0 -2
  112. package/docs/channels/custom.mdx +6 -0
  113. package/docs/channels/mcp.mdx +1 -1
  114. package/docs/channels/slack.mdx +34 -58
  115. package/docs/concepts/meta.json +0 -1
  116. package/docs/getting-started.mdx +1 -1
  117. package/docs/guides/deployment/overview.md +2 -0
  118. package/docs/guides/upgrade/agent-files.md +178 -0
  119. package/docs/guides/upgrade/channels.md +61 -0
  120. package/docs/guides/upgrade/clients.md +130 -0
  121. package/docs/guides/upgrade/evals-and-cli.md +44 -0
  122. package/docs/guides/upgrade/index.md +90 -0
  123. package/docs/guides/upgrade/meta.json +13 -0
  124. package/docs/guides/upgrade/saved-history.md +86 -0
  125. package/docs/guides/upgrade/session-events.md +139 -0
  126. package/docs/meta.json +1 -1
  127. package/docs/reference/typescript-api.md +4 -2
  128. package/package.json +2 -2
  129. package/dist/src/internal/application/cache-metadata.d.ts +0 -9
  130. package/dist/src/internal/application/cache-metadata.js +0 -1
  131. package/dist/src/internal/nitro/host/application-route-registry.d.ts +0 -54
  132. package/dist/src/internal/nitro/host/application-route-registry.js +0 -1
  133. package/dist/src/internal/nitro/host/channel-routes.d.ts +0 -21
  134. package/dist/src/internal/nitro/host/channel-routes.js +0 -5
  135. package/dist/src/internal/nitro/host/compiled-sandbox-provider-prune-plugin.d.ts +0 -18
  136. package/dist/src/internal/nitro/host/compiled-sandbox-provider-prune-plugin.js +0 -3
  137. package/dist/src/internal/nitro/host/configure-nitro-routes.d.ts +0 -12
  138. package/dist/src/internal/nitro/host/configure-nitro-routes.js +0 -3
  139. package/dist/src/internal/nitro/host/create-application-nitro.d.ts +0 -34
  140. package/dist/src/internal/nitro/host/create-application-nitro.js +0 -1
  141. package/dist/src/internal/nitro/host/cron-handler-route.d.ts +0 -41
  142. package/dist/src/internal/nitro/host/cron-handler-route.js +0 -1
  143. package/dist/src/internal/nitro/host/development-runtime-prune-plugin.d.ts +0 -12
  144. package/dist/src/internal/nitro/host/development-runtime-prune-plugin.js +0 -3
  145. package/dist/src/internal/nitro/host/extension-external-dependency-plugin.d.ts +0 -16
  146. package/dist/src/internal/nitro/host/extension-external-dependency-plugin.js +0 -1
  147. package/dist/src/internal/nitro/host/external-dependency-output-check-plugin.js +0 -3
  148. package/dist/src/internal/nitro/host/optional-engine-dependency-plugin.d.ts +0 -28
  149. package/dist/src/internal/nitro/host/optional-engine-dependency-plugin.js +0 -1
  150. package/dist/src/internal/nitro/host/schedule-task-routes.d.ts +0 -36
  151. package/dist/src/internal/nitro/host/schedule-task-routes.js +0 -2
  152. package/dist/src/internal/nitro/host/skill-server-assets.d.ts +0 -29
  153. package/dist/src/internal/nitro/host/skill-server-assets.js +0 -1
  154. package/dist/src/internal/workflow-bundle/build-queue.d.ts +0 -1
  155. package/dist/src/internal/workflow-bundle/build-queue.js +0 -1
  156. package/dist/src/internal/workflow-bundle/eve-service-route-output.d.ts +0 -5
  157. package/dist/src/internal/workflow-bundle/eve-service-route-output.js +0 -1
  158. package/dist/src/internal/workflow-bundle/vercel-workflow-output.d.ts +0 -34
  159. package/dist/src/internal/workflow-bundle/vercel-workflow-output.js +0 -1
  160. package/docs/concepts/upgrade-to-v27-events.md +0 -197
  161. package/docs/guides/prepare-for-1-0.md +0 -277
package/CHANGELOG.md CHANGED
@@ -1,44 +1,31 @@
1
- # eve 0.91.0
1
+ # eve 1.0.0-rc.0
2
2
 
3
- Released 2026-10-30 · [Compare with 0.90.0](https://github.com/vercel/eve/compare/eve%400.90.0...eve%400.91.0)
3
+ Released 2026-10-30 · [Compare with 0.91.0](https://github.com/vercel/eve/compare/eve%400.91.0...eve%401.0.0-rc.0)
4
4
 
5
5
  ## Breaking Changes
6
6
 
7
- - `session.clear()` now cancels a running turn and every working task before it clears history, instead of waiting for the turn to finish.
8
- Previously a clear sent while a turn waited on tasks didn't run until the tasks finished, and never ran if one hung. Tasks a clear stops end with `task.ended` `outcome: "cancelled"`, and no task result the cleared conversation hadn't read reaches the next turn. ([#5619](https://github.com/vercel/eve/pull/5619))
7
+ - eve 1.0 puts stable APIs under semantic versioning: they change incompatibly only in a major release, and a deprecated API keeps working until the next one.
8
+ The [stability policy](https://eve.dev/docs/reference/typescript-api#stability-policy) lists which APIs are stable and which are experimental. To move an existing project, follow [Upgrade to 1.0](https://eve.dev/docs/guides/upgrade). ([#5620](https://github.com/vercel/eve/pull/5620))
9
9
 
10
10
  ## Features
11
11
 
12
- - Hooks can start a session's next turn with `ctx.continue()` from `turn.settled` and `*` handlers.
13
- Other handlers don't receive it. It continues a completed turn, or a turn the same hook cancelled, and hooks that continue one turn share its next turn. It takes `MessageContent` with `session.send()`'s `context` and an optional `auth`, returns `{ queued }` synchronously, and yields to any other turn, cancel, clear, or reset that comes first. `delivery.admitted` records `source: { channel, hook }`. ([#5555](https://github.com/vercel/eve/pull/5555))
12
+ - Setup prompts for coding agents from a prerelease eve CLI now use its dist-tag, such as `npx eve@rc init`, instead of `npx eve@latest`. ([#5620](https://github.com/vercel/eve/pull/5620))
13
+ - `eve add` now installs a registry item on an eve prerelease, such as `1.0.0-rc.0`, when that version meets the item's minimum eve version.
14
+ Previously no prerelease satisfied a requirement such as `>=0.62.0`, so every item that declared one failed with "This registry item requires eve". ([#5620](https://github.com/vercel/eve/pull/5620))
14
15
 
15
16
  ## Bug Fixes
16
17
 
17
- - The `bash` tool now keeps only the last 50 KiB of each output stream while a command runs, so a verbose command no longer holds its whole stdout and stderr in memory.
18
- Very large output no longer fails with `Cannot create a string longer than 0x1fffffe8 characters`. Output past the limit is noted as `earlier output omitted`, as it already was for commands left running.
19
- Thanks @mrud for reporting this in #5651. ([#5653](https://github.com/vercel/eve/pull/5653))
20
- - HTTP Basic auth now compares the username and password in constant time on every request, so response timing no longer reveals whether the username matched. ([#5521](https://github.com/vercel/eve/pull/5521))
21
- - Anthropic agents no longer fail with a 400 when the model calls a server tool, such as `web_search` or programmatic `code_execution`, beside a local tool.
22
- Anthropic runs that server tool after the local results arrive and returns its result at the start of the next response, so the next request must end on those local results. Until that result arrives, eve now holds a message that steers the turn for one model step, holds changed catalog or skill announcements, sends an empty-response retry's note as a system instruction, and keeps compaction from separating the deferred result from its call or adding a resumption message after the local results. When the result can no longer arrive, because the turn was cancelled, failed, or retried, or a new turn starts, eve answers the server call as one whose outcome is unknown, so the model reads the new message right away.
23
- Thanks @jam3gw for reporting this in #4890. ([#4891](https://github.com/vercel/eve/pull/4891))
24
- - A Discord `display: "select"` request with an option `id` longer than 100 characters now fails with a clear error instead of posting a select whose truncated value came back as an id the request never offered, which dropped or mismatched the user's choice. ([#5533](https://github.com/vercel/eve/pull/5533))
25
- - Sessions now fail controls their eve version does not support, so the control's delivery settles `failed` instead of never settling. ([#5622](https://github.com/vercel/eve/pull/5622))
26
- - A provider tool result that arrives in the response after its call, such as an Anthropic tool search the model started beside a local tool, now settles the call the earlier step introduced.
27
- Previously eve published that call a second time, so with the session-event checker on (`eve dev`, `eve eval`, or `EVE_CHECK_SESSION_EVENTS=1`) the step failed with `introduced-twice`, and without it the session log recorded one call introduced twice. ([#5648](https://github.com/vercel/eve/pull/5648))
28
- - A turn cancellation raised while the model is being resolved now cancels the turn instead of failing the session with `MODEL_SELECTION_FAILED`, even when it arrives before the turn's abort signal fires.
29
- Thanks @burn2delete for reporting this and proposing the fix in #4273. ([#4274](https://github.com/vercel/eve/pull/4274))
30
- - Session steps now return only the session projection rows they changed, instead of every row of each changed table, so a step's stored output no longer grows with the calls and parts the turn already settled.
31
- Thanks @mrud for reporting this in #5635. ([#5642](https://github.com/vercel/eve/pull/5642))
32
- - Slack approval and question cards now show their prompt, tool input, and answer as literal text.
33
- A model-written `<!channel>` or `<url|label>` in a prompt or tool input no longer notifies the channel or hides a link's real destination from the approver. `Card(...)` rendering is unchanged. ([#5517](https://github.com/vercel/eve/pull/5517))
34
- - A connection in `agent/connections/*.ts` now keeps an `approval` written as `{ request, response, prompt }`, so its tools ask for approval and run its `response` policy.
35
- Previously only the function form was kept and the object form was dropped, so the connection's tools ran without asking anyone. A malformed `approval` now fails resolution instead of being ignored. ([#5632](https://github.com/vercel/eve/pull/5632))
36
- - Teams approval and question cards now show the prompt, tool input, and answer as literal text.
37
- A model-written `[docs](https://evil.example)` no longer renders as a link whose label hides its destination. The cards use `RichTextBlock` text runs, and the message text is sent as plain text. ([#5529](https://github.com/vercel/eve/pull/5529))
38
- - Teams inbound verification now accepts only RS256-signed Bot Connector tokens, as Microsoft documents, instead of using the algorithm named in the token header. ([#5530](https://github.com/vercel/eve/pull/5530))
39
- - `ctx.turn.input` keeps the turn's input after the turn pauses for an approval, a question, a sign-in, or a budget answer.
40
- Dynamic values no longer see empty input after the pause, including `auto()` if its per-turn memo was invalidated. ([#5628](https://github.com/vercel/eve/pull/5628))
41
- - `web_fetch` now rejects a `timeout` of zero or less as invalid tool input, instead of throwing an opaque `RangeError` or aborting the request immediately. ([#5532](https://github.com/vercel/eve/pull/5532))
42
- - `eve` setup now opens browser URLs on Windows through `rundll32` instead of `cmd /c start`, so `&` or `|` in a URL is no longer interpreted by the shell. ([#5522](https://github.com/vercel/eve/pull/5522))
43
-
44
- For an upgrade across multiple releases, review each version between the installed and target versions in the [target version's changelog](https://raw.githubusercontent.com/vercel/eve/refs/tags/eve%400.91.0/packages/eve/CHANGELOG.md).
18
+ - A `HEAD` request to a channel path that declares `GET` but not `HEAD` now gets `405 Method Not Allowed` with an `Allow` header instead of `404`, and the `GET` handler doesn't run.
19
+ Declare `HEAD()` on a path to answer `HEAD` requests there, under any parameter name: `HEAD("/items/:itemId")` answers for `GET("/items/:id")`. Paths that already declare `HEAD()`, such as `/` and `/eve/v1/health`, are unchanged. On a CORS-enabled path, the `405` carries the CORS headers, so a browser can read it.
20
+ `eve build` and `eve dev` no longer merge the app root's `nitro.config`, `.nitrorc`, or `.env` files into eve's own Nitro host, and no longer serve an app-root `server.*` or `index.html` as a catch-all in front of eve's routes. A Nitro app that shares its root with an eve agent, such as a TanStack Start host, keeps its Nitro configuration to itself. eve still loads `.env`, `.env.local`, `.env.development`, and `.env.development.local` for `eve dev` through its own environment handling, and still serves files in an app-root `public/` directory as static files.
21
+ `eve dev` now rebuilds its host when a connection turns on events or an extension mount changes the package export it imports. Before, those edits reused the running host, so the event receiver route or the new mount stayed missing until `eve dev` restarted. ([#5692](https://github.com/vercel/eve/pull/5692))
22
+ - Background work a channel route registers with `waitUntil` while its streamed response is still being sent now runs to completion on hosted platforms, instead of being dropped.
23
+ Channel route `params` keep encoded path separators (`%2F` and `%5C`) encoded, so a param can no longer contain a `/` or `\` that the request path never had. Other percent-encoded characters are still decoded, so `/files/caf%C3%A9` gives `café`; a handler that expected `%2F` decoded to `/` must now decode it itself.
24
+ Agent text that mentions a Nitro build constant such as `import.meta.dev` now reaches production builds unchanged, instead of being rewritten to its value or failing the build. Skill files are embedded in the server bundle instead of Nitro server assets, so hosted output no longer ships Nitro's storage layer unless authored code imports Nitro storage itself.
25
+ A channel path that declares both `GET()` and `WS()` now accepts WebSocket upgrades, which the `GET` route used to answer as a plain HTTP request. WebSocket routes register for `GET` only, the method an upgrade uses. Because one handler serves both, the two routes must name their path parameters the same way; `eve build` rejects a pair such as `GET("/rooms/:id")` and `WS("/rooms/:room")`.
26
+ Vercel service builds keep the schedule consumer function and its queue trigger, so dynamic schedules deliver their occurrences.
27
+ `eve start` now runs the server's shutdown hooks, such as flushing instrumentation, when it stops the server in an environment that sets `CI`. The built server no longer inherits `CI` or `NITRO_UNIX_SOCKET` from `eve start`.
28
+ A server without eve's workflow program runtime installed now fails a generated workflow program with an error that explains why, instead of importing the runtime from a path hosted output can't resolve. ([#5698](https://github.com/vercel/eve/pull/5698))
29
+ - Show the expected GitHub-side result as the gh tool's activity label instead of the generic tool name. ([#5668](https://github.com/vercel/eve/pull/5668))
30
+
31
+ For an upgrade across multiple releases, review each version between the installed and target versions in the [target version's changelog](https://raw.githubusercontent.com/vercel/eve/refs/tags/eve%401.0.0-rc.0/packages/eve/CHANGELOG.md).
package/README.md CHANGED
@@ -10,9 +10,7 @@ The framework is called eve. The published npm package is `eve`. The CLI binary
10
10
 
11
11
  The installed package contains its release notes in `CHANGELOG.md`, with a link to the full changelog through that version. For an upgrade across releases, review the target version's history at `https://raw.githubusercontent.com/vercel/eve/refs/tags/eve%40<version>/packages/eve/CHANGELOG.md`.
12
12
 
13
- ## Preview Terms and Safeguards
14
-
15
- eve is currently a preview and subject to the Vercel beta terms; the framework, APIs, documentation, and behavior may change before general availability.
13
+ ## Safeguards
16
14
 
17
15
  As the deployer, it is your responsibility to ensure your agent complies with applicable laws.
18
16
 
@@ -26,7 +26,11 @@ export interface RouteHandlerArgs<TState = undefined> {
26
26
  * on the returned handle; the target channel owns its address and initial state.
27
27
  */
28
28
  readonly to: CrossChannelToFn;
29
- /** Path parameters matched for the current route. */
29
+ /**
30
+ * Path parameters matched for the current route, percent-decoded except
31
+ * `%2F` and `%5C`, which stay encoded so a parameter never gains a path
32
+ * separator.
33
+ */
30
34
  params: Readonly<Record<string, string>>;
31
35
  /** Keeps background work alive after the route returns its response. */
32
36
  waitUntil: (task: Promise<unknown>) => void;
@@ -49,8 +53,8 @@ export interface RouteHandlerArgs<TState = undefined> {
49
53
  * Reads one file of a compiled skill as raw bytes. `path` is relative to
50
54
  * the skill root and defaults to its `SKILL.md`. Rejects paths that are
51
55
  * absolute or contain `.`, `..`, or empty segments, files the skill does
52
- * not list, and files over 512 KiB. Production builds ship skill files as
53
- * server assets, so they count toward the deployed function's size.
56
+ * not list, and files over 512 KiB. Production builds embed skill files in
57
+ * the server bundle, so they count toward the deployed function's size.
54
58
  */
55
59
  readSkill(skill: string, path?: string): Promise<Uint8Array>;
56
60
  /** Runs one of the agent's tools as `auth`, outside any conversation. */
@@ -34,26 +34,17 @@ export interface SkillFileSource {
34
34
  listDirectories(skill: string): Promise<readonly string[]>;
35
35
  readFile(skill: string, path: string): Promise<Uint8Array>;
36
36
  }
37
- /** Nitro `serverAssets` base that holds the root agent's shipped skill files. */
38
- export declare const SKILL_FILES_SERVER_ASSET_BASE = "eve-skills";
39
- /** Nitro `serverAssets` base that holds {@link SKILL_FILES_INDEX_KEY}. */
40
- export declare const SKILL_FILES_INDEX_SERVER_ASSET_BASE = "eve-skill-index";
41
- /** Key of the skill file index inside {@link SKILL_FILES_INDEX_SERVER_ASSET_BASE}. */
42
- export declare const SKILL_FILES_INDEX_KEY = "skills.json";
43
37
  /**
44
38
  * One indexed file: `[path, size, sha256]`. `sha256` is `null` for files over
45
- * {@link MAX_SKILL_FILE_BYTES}, which are listed but not shipped. A shipped
46
- * file's storage key is {@link skillFileStorageKey} of its digest.
39
+ * {@link MAX_SKILL_FILE_BYTES}, which are listed but not shipped.
47
40
  */
48
41
  export type SkillFilesIndexEntry = readonly [path: string, size: number, sha256: string | null];
49
42
  /**
50
43
  * Index of the skill files a production build ships, written by `eve build`.
51
- * eve owns the listing rather than deriving it from storage keys, so real
52
- * paths never pass through unstorage key normalization. Entries are arrays,
53
- * not object keys, so names such as `__proto__` stay plain data.
44
+ * Entries are arrays, not object keys, so names such as `__proto__` stay
45
+ * plain data.
54
46
  */
55
47
  export interface SkillFilesIndex {
56
- readonly version: 1;
57
48
  /** `[skill, files, directories]`, sorted by skill then path. */
58
49
  readonly skills: readonly (readonly [
59
50
  skill: string,
@@ -61,30 +52,35 @@ export interface SkillFilesIndex {
61
52
  directories: readonly string[]
62
53
  ])[];
63
54
  }
64
- /**
65
- * Storage key of a shipped skill file: its SHA-256 with a `.bin` name. `.bin`
66
- * makes Nitro inline the file as a `Uint8Array` whatever its real extension,
67
- * and a hex name is left unchanged by unstorage key normalization.
68
- */
69
- export declare function skillFileStorageKey(sha256: string): string;
70
- /** The subset of an unstorage `Storage` the server asset source reads with. */
71
- export interface SkillFileStorage {
72
- getItemRaw(key: string): Promise<unknown>;
55
+ /** The skill files a production build embeds, as its generated Nitro plugin installs them. */
56
+ export interface BundledSkillFiles {
57
+ /** The JSON text of a {@link SkillFilesIndex}. */
58
+ readonly index: string;
59
+ /** Loads the shipped bytes with this SHA-256. Every file with that digest shares the array. */
60
+ readonly read: (sha256: string) => Promise<Uint8Array>;
61
+ }
62
+ /** The parsed form of {@link BundledSkillFiles} a runtime session holds. */
63
+ export interface InstalledSkillFiles {
64
+ readonly read: (sha256: string) => Promise<Uint8Array>;
65
+ readonly skills: ReadonlyMap<string, IndexedSkill>;
66
+ }
67
+ interface IndexedSkill {
68
+ readonly files: readonly SkillFilesIndexEntry[];
69
+ readonly directories: readonly string[];
73
70
  }
74
- /** Opens a Nitro server asset storage, e.g. `useStorage("assets:eve-skills")`. */
75
- export type OpenSkillFileStorage = (base: string) => Promise<SkillFileStorage>;
71
+ /** Installs a production build's embedded skill files on the active runtime session. */
72
+ export declare function installBundledSkillFiles(input: BundledSkillFiles): void;
76
73
  /**
77
74
  * Selects the skill file source for the active compiled artifacts.
78
75
  *
79
76
  * Skill files are materialized under the node's workspace resource root by
80
77
  * `compiler/workspace-resources.ts`. Disk artifacts (dev) read that tree with
81
78
  * {@link createDiskSkillFileSource}; bundled artifacts (production builds)
82
- * read the Nitro server assets `eve build` registers for the root agent.
79
+ * read the files `eve build` embedded for the root agent.
83
80
  */
84
81
  export declare function createCompiledSkillFileSource(input: {
85
82
  readonly compiledArtifactsSource: RuntimeCompiledArtifactsSource;
86
83
  readonly workspaceResourceRoot: CompiledWorkspaceResourceRoot;
87
- readonly openStorage?: OpenSkillFileStorage;
88
84
  }): SkillFileSource;
89
85
  /**
90
86
  * Reads skill files from a materialized `skills/<name>/` tree.
@@ -112,3 +108,4 @@ export declare function readSkillFile(input: {
112
108
  readonly source: SkillFileSource;
113
109
  }): Promise<Uint8Array>;
114
110
  export declare function comparePaths(left: string, right: string): number;
111
+ export {};
@@ -1 +1 @@
1
- import{createHash}from"node:crypto";import{lstat,open,readdir,realpath}from"node:fs/promises";import{constants}from"node:fs";import nodePath from"node:path";import{resolveRuntimeCompilerArtifactPaths}from"#runtime/loaders/artifact-paths.js";const MAX_SKILL_FILE_BYTES=524288,SKILL_ENTRY_FILE_NAME=`SKILL.md`;function isSkillEntryFileName(e){return e.toLowerCase()===`skill.md`}var SkillReadError=class extends Error{code;constructor(e,t){super(t),this.name=`SkillReadError`,this.code=e}};const SKILL_FILES_SERVER_ASSET_BASE=`eve-skills`,SKILL_FILES_INDEX_SERVER_ASSET_BASE=`eve-skill-index`,SKILL_FILES_INDEX_KEY=`skills.json`;function skillFileStorageKey(e){return`${e}.bin`}const openNitroStorage=async e=>{let{useStorage:t}=await import(`nitro/storage`);return t(`assets:${e}`)};function createCompiledSkillFileSource(e){if(e.compiledArtifactsSource.kind!==`disk`)return createServerAssetSkillFileSource(e.openStorage??openNitroStorage);let{compileDirectoryPath:t}=resolveRuntimeCompilerArtifactPaths(e.compiledArtifactsSource.appRoot);return createDiskSkillFileSource(`${t}/${e.workspaceResourceRoot.logicalPath}/skills`)}function createServerAssetSkillFileSource(e){let t,loadIndex=()=>(t??=e(SKILL_FILES_INDEX_SERVER_ASSET_BASE).then(e=>e.getItemRaw(SKILL_FILES_INDEX_KEY)).then(parseSkillFilesIndex),t.catch(()=>{t=void 0}),t);return{async listFiles(e){return((await loadIndex()).get(e)?.files??[]).map(([e,t])=>({path:e,size:t}))},async listDirectories(e){return(await loadIndex()).get(e)?.directories??[]},async readFile(t,n){let r=(await loadIndex()).get(t)?.files.find(([e])=>e===n);if(r===void 0)throw unknownFile(t,n);let[,i,a]=r;if(a===null)throw tooLarge(t,n,i);let o=await(await e(SKILL_FILES_SERVER_ASSET_BASE)).getItemRaw(skillFileStorageKey(a));if(!(o instanceof Uint8Array)||o.byteLength!==i||createHash(`sha256`).update(o).digest(`hex`)!==a)throw new SkillReadError(`unavailable`,`Skill "${t}" file "${n}" does not match its build index; this build did not ship it byte for byte.`);return o}}}function parseSkillFilesIndex(e){let t=typeof e==`string`?e:e instanceof Uint8Array?new TextDecoder().decode(e):``,n;try{n=t===``?void 0:JSON.parse(t)}catch{n=void 0}if(!isSkillFilesIndex(n))throw new SkillReadError(`unavailable`,"Skill files are not available: this server was not built by `eve build`, so it carries no skill files.");return new Map(n.skills.map(([e,t,n])=>[e,{directories:n,files:t}]))}function isSkillFilesIndex(e){if(typeof e!=`object`||!e)return!1;let{skills:t,version:n}=e;return n===1&&Array.isArray(t)&&t.every(e=>Array.isArray(e)&&typeof e[0]==`string`&&Array.isArray(e[1])&&e[1].every(e=>Array.isArray(e)&&e.length===3&&typeof e[0]==`string`&&Number.isSafeInteger(e[1])&&(typeof e[2]==`string`||e[2]===null))&&Array.isArray(e[2])&&e[2].every(e=>typeof e==`string`))}function createDiskSkillFileSource(e){return{async listFiles(t){let n=`${e}/${t}`;if(!await isRealDirectory(n))return[];let{files:r}=await walkSkill(n);return r.sort((e,t)=>comparePaths(e.path,t.path))},async listDirectories(t){let n=`${e}/${t}`;if(!await isRealDirectory(n))return[];let{directories:r}=await walkSkill(n);return r.sort(comparePaths)},async readFile(t,n){let r=`${e}/${t}`;if(!await isRealDirectory(r))throw unknownFile(t,n);let i=n.split(`/`),a=r;for(let[e,r]of i.entries()){a=`${a}/${r}`;let o=await lstatOrUndefined(a),s=e===i.length-1;if(o===void 0||(s?!o.isFile():!o.isDirectory()))throw unknownFile(t,n)}let[o,s]=await Promise.all([realpath(r),realpath(a)]),c=nodePath.relative(o,s);if(c===``||nodePath.isAbsolute(c)||c.split(nodePath.sep)[0]===`..`)throw unknownFile(t,n);let l=await open(a,constants.O_RDONLY|(constants.O_NOFOLLOW??0));try{let e=await l.stat();if(!e.isFile())throw unknownFile(t,n);if(e.size>524288)throw tooLarge(t,n,e.size);return new Uint8Array(await l.readFile())}finally{await l.close()}}}}async function lstatOrUndefined(e){try{return await lstat(e)}catch(e){if(e instanceof Error&&`code`in e&&(e.code===`ENOENT`||e.code===`ENOTDIR`))return;throw e}}async function isRealDirectory(e){return(await lstatOrUndefined(e))?.isDirectory()===!0}async function walkSkill(e){let t=[],n=[],walk=async(e,r)=>{for(let i of await readdir(e,{withFileTypes:!0})){let a=r===``?i.name:`${r}/${i.name}`;if(i.isDirectory())n.push(a),await walk(`${e}/${i.name}`,a);else if(i.isFile()){let n=await lstatOrUndefined(`${e}/${i.name}`);n?.isFile()===!0&&t.push({path:a,size:n.size})}}};return await walk(e,``),{directories:n,files:t}}function unknownFile(e,t){return new SkillReadError(`unknown-file`,`Skill "${e}" has no file "${t}".`)}function tooLarge(e,t,n){return new SkillReadError(`too-large`,`Skill "${e}" file "${t}" is ${n} bytes, over the ${MAX_SKILL_FILE_BYTES}-byte limit.`)}async function readSkillFile(e){let t=e.path??`SKILL.md`;assertRelativeSkillPath(t);let n=await e.source.listFiles(e.skill),r=n.find(e=>e.path===t)??(isSkillEntryFileName(t)?n.find(e=>isSkillEntryFileName(e.path)):void 0);if(r===void 0)throw unknownFile(e.skill,t);if(r.size>524288)throw tooLarge(e.skill,r.path,r.size);let i=await e.source.readFile(e.skill,r.path);if(i.byteLength>524288)throw tooLarge(e.skill,r.path,i.byteLength);return i}function assertRelativeSkillPath(e){let invalid=t=>new SkillReadError(`invalid-path`,`Skill file path "${e}" ${t}.`);if(e.length===0)throw invalid(`must not be empty`);if(e.startsWith(`/`)||/^[A-Za-z]:/.test(e))throw invalid(`must be relative to the skill root`);if(e.includes(`\\`)||e.includes(`\0`))throw invalid(`must use "/" separators and contain no NUL bytes`);if(e.split(`/`).some(e=>e===``||e===`.`||e===`..`))throw invalid(`must not contain empty, ".", or ".." segments`)}function comparePaths(e,t){return e<t?-1:+(e>t)}export{MAX_SKILL_FILE_BYTES,SKILL_ENTRY_FILE_NAME,SKILL_FILES_INDEX_KEY,SKILL_FILES_INDEX_SERVER_ASSET_BASE,SKILL_FILES_SERVER_ASSET_BASE,SkillReadError,comparePaths,createCompiledSkillFileSource,createDiskSkillFileSource,isSkillEntryFileName,readSkillFile,skillFileStorageKey};
1
+ import{lstat,open,readdir,realpath}from"node:fs/promises";import{getActiveRuntimeSession}from"#runtime/sessions/runtime-session.js";import{constants}from"node:fs";import nodePath from"node:path";import{resolveRuntimeCompilerArtifactPaths}from"#runtime/loaders/artifact-paths.js";const MAX_SKILL_FILE_BYTES=524288,SKILL_ENTRY_FILE_NAME=`SKILL.md`;function isSkillEntryFileName(e){return e.toLowerCase()===`skill.md`}var SkillReadError=class extends Error{code;constructor(e,t){super(t),this.name=`SkillReadError`,this.code=e}};function installBundledSkillFiles(e){let t=JSON.parse(e.index);getActiveRuntimeSession().skillFiles={read:e.read,skills:new Map(t.skills.map(([e,t,n])=>[e,{directories:n,files:t}]))}}function createCompiledSkillFileSource(e){if(e.compiledArtifactsSource.kind!==`disk`)return bundledSkillFileSource;let{compileDirectoryPath:t}=resolveRuntimeCompilerArtifactPaths(e.compiledArtifactsSource.appRoot);return createDiskSkillFileSource(`${t}/${e.workspaceResourceRoot.logicalPath}/skills`)}const bundledSkillFileSource={async listFiles(e){return(installedSkillFiles().skills.get(e)?.files??[]).map(([e,t])=>({path:e,size:t}))},async listDirectories(e){return installedSkillFiles().skills.get(e)?.directories??[]},async readFile(e,t){let n=installedSkillFiles(),r=n.skills.get(e)?.files.find(([e])=>e===t);if(r===void 0)throw unknownFile(e,t);let[,i,a]=r;if(a===null)throw tooLarge(e,t,i);return(await n.read(a)).slice()}};function installedSkillFiles(){let e=getActiveRuntimeSession().skillFiles;if(e===null)throw new SkillReadError(`unavailable`,"Skill files are not available: this server was not built by `eve build`, so it carries no skill files.");return e}function createDiskSkillFileSource(e){return{async listFiles(t){let n=`${e}/${t}`;if(!await isRealDirectory(n))return[];let{files:r}=await walkSkill(n);return r.sort((e,t)=>comparePaths(e.path,t.path))},async listDirectories(t){let n=`${e}/${t}`;if(!await isRealDirectory(n))return[];let{directories:r}=await walkSkill(n);return r.sort(comparePaths)},async readFile(t,n){let r=`${e}/${t}`;if(!await isRealDirectory(r))throw unknownFile(t,n);let i=n.split(`/`),a=r;for(let[e,r]of i.entries()){a=`${a}/${r}`;let o=await lstatOrUndefined(a),s=e===i.length-1;if(o===void 0||(s?!o.isFile():!o.isDirectory()))throw unknownFile(t,n)}let[o,s]=await Promise.all([realpath(r),realpath(a)]),c=nodePath.relative(o,s);if(c===``||nodePath.isAbsolute(c)||c.split(nodePath.sep)[0]===`..`)throw unknownFile(t,n);let l=await open(a,constants.O_RDONLY|(constants.O_NOFOLLOW??0));try{let e=await l.stat();if(!e.isFile())throw unknownFile(t,n);if(e.size>524288)throw tooLarge(t,n,e.size);return new Uint8Array(await l.readFile())}finally{await l.close()}}}}async function lstatOrUndefined(e){try{return await lstat(e)}catch(e){if(e instanceof Error&&`code`in e&&(e.code===`ENOENT`||e.code===`ENOTDIR`))return;throw e}}async function isRealDirectory(e){return(await lstatOrUndefined(e))?.isDirectory()===!0}async function walkSkill(e){let t=[],n=[],walk=async(e,r)=>{for(let i of await readdir(e,{withFileTypes:!0})){let a=r===``?i.name:`${r}/${i.name}`;if(i.isDirectory())n.push(a),await walk(`${e}/${i.name}`,a);else if(i.isFile()){let n=await lstatOrUndefined(`${e}/${i.name}`);n?.isFile()===!0&&t.push({path:a,size:n.size})}}};return await walk(e,``),{directories:n,files:t}}function unknownFile(e,t){return new SkillReadError(`unknown-file`,`Skill "${e}" has no file "${t}".`)}function tooLarge(e,t,n){return new SkillReadError(`too-large`,`Skill "${e}" file "${t}" is ${n} bytes, over the ${MAX_SKILL_FILE_BYTES}-byte limit.`)}async function readSkillFile(e){let t=e.path??`SKILL.md`;assertRelativeSkillPath(t);let n=await e.source.listFiles(e.skill),r=n.find(e=>e.path===t)??(isSkillEntryFileName(t)?n.find(e=>isSkillEntryFileName(e.path)):void 0);if(r===void 0)throw unknownFile(e.skill,t);if(r.size>524288)throw tooLarge(e.skill,r.path,r.size);let i=await e.source.readFile(e.skill,r.path);if(i.byteLength>524288)throw tooLarge(e.skill,r.path,i.byteLength);return i}function assertRelativeSkillPath(e){let invalid=t=>new SkillReadError(`invalid-path`,`Skill file path "${e}" ${t}.`);if(e.length===0)throw invalid(`must not be empty`);if(e.startsWith(`/`)||/^[A-Za-z]:/.test(e))throw invalid(`must be relative to the skill root`);if(e.includes(`\\`)||e.includes(`\0`))throw invalid(`must use "/" separators and contain no NUL bytes`);if(e.split(`/`).some(e=>e===``||e===`.`||e===`..`))throw invalid(`must not contain empty, ".", or ".." segments`)}function comparePaths(e,t){return e<t?-1:+(e>t)}export{MAX_SKILL_FILE_BYTES,SKILL_ENTRY_FILE_NAME,SkillReadError,comparePaths,createCompiledSkillFileSource,createDiskSkillFileSource,installBundledSkillFiles,isSkillEntryFileName,readSkillFile};
@@ -1 +1 @@
1
- import{hasInteractiveTerminal}from"./preconditions.js";import{headlessSetupContinuation,serializeHeadlessSetupEvent}from"./setup-headless.js";import{prepareWebChatProjectRoot,prepareWebRegistryProject,readRegistryConfig,resolveWebChatFramework}from"./registry-project.js";import{errorMessage,reportRegistryCompletion,resolveRegistryItemForAdd,runRegistryAction,setupReminder,setupResumeCommand}from"./registry-recovery.js";import{runRegistryAddCommand}from"./registry-add-command.js";import{RegistrySetupFailedError,runDeclaredSetups}from"./registry-declared-setups.js";import{installRegistryItemTransaction}from"./registry-install-transaction.js";import{eveMetadataFromRegistryItem,parseOfficialRegistrySearchMetadata}from"./registry-metadata.js";import{prepareDeclaredPnpmBuildPolicy}from"./registry-pnpm-build-policy-flow.js";import{printRegistrySearchResults,registryViewText}from"./registry-presentation.js";import{resolveInstalledPackageInfo}from"#internal/application/package.js";import{createPrompter}from"#setup/prompter.js";import{WizardCancelledError}from"#setup/step.js";import{InvalidAnswerError,headlessAsker,interactiveAsker,withAnswers,withPolicy}from"#setup/ask.js";import{setupQuestionToWire}from"#setup/setup-question-wire.js";import{addRegistryItems,getRegistryItems,searchRegistries}from"#compiled/shadcn-registry/index.js";import semver from"#compiled/semver/index.js";const defaultAddCommandDependencies={createPrompter,hasInteractiveTerminal,loadSetupCommandRunner:async()=>(await import(`./registry-setup-command.js`)).runRegistrySetupCommand,prepareWebRegistryProject};function resolveOfficialRegistryUrl(e=process.env.EVE_DEV_OFFICIAL_REGISTRY_URL){if(e===void 0)return`https://eve.dev/r`;let t;try{t=new URL(e)}catch{throw Error(`EVE_DEV_OFFICIAL_REGISTRY_URL must be an HTTP(S) URL.`)}if(t.protocol!==`http:`&&t.protocol!==`https:`)throw Error(`EVE_DEV_OFFICIAL_REGISTRY_URL must be an HTTP(S) URL.`);if(t.username!==``||t.password!==``)throw Error(`EVE_DEV_OFFICIAL_REGISTRY_URL must not include credentials.`);if(t.search!==``||t.hash!==``)throw Error(`EVE_DEV_OFFICIAL_REGISTRY_URL must not include a query or fragment.`);return t.pathname=t.pathname.replace(/\/+$/,``),t.toString().replace(/\/$/,``)}const OFFICIAL_REGISTRY=resolveOfficialRegistryUrl(),OFFICIAL_CATALOG=`${OFFICIAL_REGISTRY}/registry.json`,SKILLS_REGISTRY=`@skills`;function itemAddress(e){return e.startsWith(`@`)||/^https?:\/\//.test(e)?e:`${OFFICIAL_REGISTRY}/${e}.json`}const WEB_CHAT_ITEMS={next:`channel/web`,tanstack:`channel/web-tanstack`};async function askWebChatFramework(e,t,n,r,i){let a=r.nonInteractive===!0,o=r.setupAuthorized===!0||(i.hasInteractiveTerminal??defaultAddCommandDependencies.hasInteractiveTerminal)(),s=withAnswers(r.answers??{})(r.yes===!0||a||!o?withPolicy(`assume`)(headlessAsker()):interactiveAsker(r.prompter??i.createPrompter?.()??defaultAddCommandDependencies.createPrompter()));try{return await resolveWebChatFramework(t,s,r.answers)}catch(t){if(t instanceof WizardCancelledError)return!1;if(!a||!(t instanceof InvalidAnswerError))throw t;let i=setupQuestionToWire(t.question);e.error(serializeHeadlessSetupEvent({version:1,type:`blocked`,item:n,installed:!1,completedItems:[],status:`input_required`,question:i,issue:{code:`invalid_answer`,message:t.message},next:headlessSetupContinuation({item:n,installed:!1,answers:r.answers,question:i})})),process.exitCode=2;return}}function assertCompatibleEveVersion(e){if(e===void 0)return;let t=resolveInstalledPackageInfo().version;if(semver.validRange(e)===null)throw Error(`Registry item has an invalid eve version requirement: ${e}.`);if(!semver.subset(t,e))throw Error(`This registry item requires eve ${e}, but this project is using eve ${t}. Upgrade eve and run the command again.`)}function isOfficialItemAddress(e){return e.startsWith(`${OFFICIAL_REGISTRY}/`)}function withBuiltInRegistries(e){return{...e,registries:{[SKILLS_REGISTRY]:`https://www.skills.sh/r/{name}?agent=eve`,...e.registries}}}async function readEveRegistryConfig(e){return withBuiltInRegistries(await readRegistryConfig(e))}function configuredRegistrySources(e){return Object.keys(e.registries??{})}function validateRegistrySource(e){if(e!==void 0&&!e.startsWith(`@`)&&!/^https?:\/\//.test(e))throw Error(`Registry sources must be a namespace or URL: ${e}`)}async function loadOfficialSearchMetadata(){let e=await fetch(OFFICIAL_CATALOG);if(!e.ok)throw Error(`Could not read the eve registry (${e.status}).`);return parseOfficialRegistrySearchMetadata(await e.json())}function searchItemAddress(e){return e.registry===OFFICIAL_CATALOG?e.name:e.addCommandArgument}function enrichSearchItem(e,t){let n=searchItemAddress(e);return{item:e,address:n,...t.get(n)}}function registrySourceLabel(e){return e===OFFICIAL_CATALOG?`eve`:e===SKILLS_REGISTRY?`skills.sh`:e}function searchPresentationSections(e,t,n){return e.flatMap(e=>{let r=t.get(e);return r===void 0?[]:[{label:registrySourceLabel(e),items:r.items.map(e=>enrichSearchItem(e,n)),total:r.pagination.total}]})}async function printAddSuggestions(e,t,n){try{let r=n.split(`/`).at(-1)||n,{resultsBySource:i,sources:a,metadataByAddress:o}=await searchRegistryCatalog(t,{limit:5,query:r}),s=searchPresentationSections(a,i,o);if(s.every(e=>e.items.length===0))return;e.log(`Did you mean?`),printRegistrySearchResults(e,{query:r,sections:s})}catch{}}async function searchRegistryCatalog(e,t){validateRegistrySource(t.source);let n=await readEveRegistryConfig(e),r=t.source?[t.source]:[OFFICIAL_CATALOG,...configuredRegistrySources(n).filter(e=>t.query!==void 0||e!==SKILLS_REGISTRY)],i=await Promise.all(r.map(async e=>{try{return{result:await searchRegistries([e],{config:n,limit:t.limit??500,query:t.query}),source:e}}catch(t){return{error:t,source:e}}})),a=[],o=new Map;for(let e of i)if(`error`in e)a.push({message:errorMessage(e.error),registry:e.source});else{let t=e.result.errors??[];if(a.push(...t),t.length===0){let t=e.result.items.filter(t=>t.registry===e.source);o.set(e.source,{...e.result,items:t,pagination:{...e.result.pagination,total:e.result.items.length===t.length?e.result.pagination.total:0}})}}let s=new Map(a.map(e=>[`${e.registry}\0${e.message}`,e])),c=o.has(OFFICIAL_CATALOG)?await loadOfficialSearchMetadata():new Map,l=o.get(OFFICIAL_CATALOG);if(l!==void 0){let e=l.items.filter(e=>c.get(searchItemAddress(e))?.hidden!==!0);l.items=e,l.pagination={...l.pagination,total:e.length},l.items.sort((e,t)=>{let rank=e=>c.get(searchItemAddress(e))?.implementation===`native`?0:1;return rank(e)-rank(t)})}let u=[...o.values()];return{config:n,result:{items:u.flatMap(e=>e.items),pagination:{hasMore:u.some(e=>e.pagination.hasMore),limit:t.limit??500,offset:0,total:u.reduce((e,t)=>e+t.pagination.total,0)},...s.size>0?{errors:[...s.values()]}:{}},resultsBySource:o,sources:r,metadataByAddress:c}}async function browseRegistryCatalog(e,t={}){let{result:n}=await searchRegistryCatalog(e,t);return{items:n.items.map(e=>{let t={address:e.registry===OFFICIAL_CATALOG?e.name:e.addCommandArgument,name:e.name,source:e.registry===OFFICIAL_CATALOG?`Vercel`:e.registry};return e.title!==void 0&&(t.title=e.title),e.type!==void 0&&(t.type=e.type),e.description!==void 0&&(t.description=e.description),t}),total:n.pagination.total,errors:n.errors??[]}}async function browseRegistryItems(e,t,n,r,i={}){let{result:a,resultsBySource:o,sources:s,metadataByAddress:c}=await searchRegistryCatalog(t,{limit:i.limit,query:n,source:r}),l=a.errors??[];if(i.json||o.size>0){let t=a.items.map(e=>({...e,...c.get(searchItemAddress(e))})),r={query:n,sections:searchPresentationSections(s,o,c)};i.json&&(r.json={...a,items:t}),printRegistrySearchResults(e,r)}for(let t of l)e.error(`${t.registry}: ${t.message}`);l.length>0&&(process.exitCode=1)}async function installRegistryItem(e,t,n={},r=defaultAddCommandDependencies){let i,a=[],o={error:e=>{i=e},log:e=>a.push(e)},s=process.exitCode,c;try{c=await runAddCommand(o,e,t,{...n,yes:n.prompter===void 0||n.yes,setupAuthorized:n.prompter!==void 0,throwSetupFailures:!0},r)}catch(e){if(process.exitCode=s,!(e instanceof RegistrySetupFailedError))throw e;let t={resumeCommand:e.resumeCommand,reason:e.reason};return e.prerequisite!==void 0&&(t.prerequisite=e.prerequisite),{output:a,setupIncomplete:t}}if(process.exitCode=s,i!==void 0)throw Error(i);if(c===!1)throw new WizardCancelledError;if(c===`setup-incomplete`)return{output:a,setupIncomplete:{resumeCommand:setupResumeCommand(t)}};let l={output:a};return c!==void 0&&(l.setup=c),l}async function runAddCommand(e,t,n,r,i=defaultAddCommandDependencies){let setupIncomplete=t=>(r.silent!==!0&&e.log(setupReminder(n,t)),`setup-incomplete`);return runRegistryAction(e,t,async()=>{let a=itemAddress(n),o;if(a===itemAddress(WEB_CHAT_ITEMS.next)&&r.skipInstall!==!0){let a=await askWebChatFramework(e,t,n,r,i);if(a===!1||a===void 0)return a;o=a}let s=o===void 0?a:itemAddress(WEB_CHAT_ITEMS[o]),c=o===void 0?t:await prepareWebChatProjectRoot(t,o),l=await readEveRegistryConfig(t);if(r.skipInstall===!0){if(r.overwrite===!0)throw Error(`--overwrite cannot be used with --skip-install.`);if(r.skipSetup===!0)throw Error(`--skip-install cannot be used with --skip-setup.`);if(!isOfficialItemAddress(a))throw Error(`Setup flows are currently supported only for official eve registry items.`)}let u=await resolveRegistryItemForAdd(e,async()=>(await getRegistryItems([s],{config:l}))[0],()=>printAddSuggestions(e,t,n));if(!u.found)return;let d=u.item,f=isOfficialItemAddress(a)?eveMetadataFromRegistryItem(d):void 0;if(assertCompatibleEveVersion(f?.requires),r.skipInstall===!0){if(f?.setup===void 0)throw Error(`Registry item "${n}" does not declare a setup flow.`);let a=await runDeclaredSetups({logger:e,appRoot:t,item:n,setups:f.setup,options:r,dependencies:i,resumeCommand:setupResumeCommand(n)});return a===!1&&!r.nonInteractive?setupIncomplete(`cancelled`):reportRegistryCompletion(e,n,a,r)}if(!await prepareDeclaredPnpmBuildPolicy({logger:e,appRoot:c,item:n,policies:f?.install?.pnpm?.buildScripts,options:r}))return!1;if(o!==void 0&&await(i.prepareWebRegistryProject??prepareWebRegistryProject)(c,o),await installRegistryItemTransaction({appRoot:c,item:n,registryItem:d,nonInteractive:r.nonInteractive,logger:e,install:async()=>{await addRegistryItems([s],{config:l,cwd:c,overwrite:r.overwrite,silent:r.silent})}}),f?.setup===void 0)return reportRegistryCompletion(e,n,{facts:[]},r);let p=i.hasInteractiveTerminal?.()??defaultAddCommandDependencies.hasInteractiveTerminal();if(r.nonInteractive&&e.log(serializeHeadlessSetupEvent({version:1,type:`progress`,message:r.skipInstall?`Setup ${n}`:`Installed ${n}`})),r.skipSetup===!0)return r.nonInteractive?reportRegistryCompletion(e,n,{facts:[]},r):setupIncomplete(`skipped`);if(!r.nonInteractive&&!r.yes&&!p&&r.setupAuthorized!==!0)return setupIncomplete(`skipped`);if(!r.nonInteractive&&!r.yes&&r.setupAuthorized!==!0)try{if(await(r.prompter??i.createPrompter?.()??defaultAddCommandDependencies.createPrompter()).select({message:`Set up ${n} now?`,initialValue:`yes`,options:[{value:`yes`,label:`Yes`},{value:`no`,label:`No`}]})===`no`)return setupIncomplete(`skipped`)}catch(e){if(!(e instanceof WizardCancelledError))throw e;return setupIncomplete(`cancelled`)}let m=await runDeclaredSetups({logger:e,appRoot:t,item:n,setups:f.setup,options:{...r,force:r.overwrite},dependencies:i,resumeCommand:setupResumeCommand(n)});return m===!1&&!r.nonInteractive?setupIncomplete(`cancelled`):reportRegistryCompletion(e,n,m,r)},{rethrow:e=>r.throwSetupFailures===!0&&e instanceof RegistrySetupFailedError})}async function runRegistryListCommand(e,t,n,r={}){await runRegistryAction(e,t,()=>browseRegistryItems(e,t,void 0,n,r))}async function runRegistrySearchCommand(e,t,n,r,i={}){await runRegistryAction(e,t,()=>browseRegistryItems(e,t,n,r,{...i,limit:i.limit??10}))}async function runRegistryViewCommand(e,t,n,r={}){await runRegistryAction(e,t,async()=>{let i=await readEveRegistryConfig(t),a=await getRegistryItems([itemAddress(n)],{config:i}),o=a.length===1?a[0]:a;e.log(r.json?JSON.stringify(o,null,2):registryViewText(n,o))})}export{browseRegistryCatalog,installRegistryItem,resolveOfficialRegistryUrl,runAddCommand,runRegistryAddCommand,runRegistryListCommand,runRegistrySearchCommand,runRegistryViewCommand};
1
+ import{hasInteractiveTerminal}from"./preconditions.js";import{headlessSetupContinuation,serializeHeadlessSetupEvent}from"./setup-headless.js";import{prepareWebChatProjectRoot,prepareWebRegistryProject,readRegistryConfig,resolveWebChatFramework}from"./registry-project.js";import{errorMessage,reportRegistryCompletion,resolveRegistryItemForAdd,runRegistryAction,setupReminder,setupResumeCommand}from"./registry-recovery.js";import{runRegistryAddCommand}from"./registry-add-command.js";import{RegistrySetupFailedError,runDeclaredSetups}from"./registry-declared-setups.js";import{installRegistryItemTransaction}from"./registry-install-transaction.js";import{eveMetadataFromRegistryItem,parseOfficialRegistrySearchMetadata}from"./registry-metadata.js";import{prepareDeclaredPnpmBuildPolicy}from"./registry-pnpm-build-policy-flow.js";import{printRegistrySearchResults,registryViewText}from"./registry-presentation.js";import{resolveInstalledPackageInfo}from"#internal/application/package.js";import{createPrompter}from"#setup/prompter.js";import{WizardCancelledError}from"#setup/step.js";import{InvalidAnswerError,headlessAsker,interactiveAsker,withAnswers,withPolicy}from"#setup/ask.js";import{setupQuestionToWire}from"#setup/setup-question-wire.js";import{addRegistryItems,getRegistryItems,searchRegistries}from"#compiled/shadcn-registry/index.js";import semver from"#compiled/semver/index.js";const defaultAddCommandDependencies={createPrompter,hasInteractiveTerminal,loadSetupCommandRunner:async()=>(await import(`./registry-setup-command.js`)).runRegistrySetupCommand,prepareWebRegistryProject};function resolveOfficialRegistryUrl(e=process.env.EVE_DEV_OFFICIAL_REGISTRY_URL){if(e===void 0)return`https://eve.dev/r`;let t;try{t=new URL(e)}catch{throw Error(`EVE_DEV_OFFICIAL_REGISTRY_URL must be an HTTP(S) URL.`)}if(t.protocol!==`http:`&&t.protocol!==`https:`)throw Error(`EVE_DEV_OFFICIAL_REGISTRY_URL must be an HTTP(S) URL.`);if(t.username!==``||t.password!==``)throw Error(`EVE_DEV_OFFICIAL_REGISTRY_URL must not include credentials.`);if(t.search!==``||t.hash!==``)throw Error(`EVE_DEV_OFFICIAL_REGISTRY_URL must not include a query or fragment.`);return t.pathname=t.pathname.replace(/\/+$/,``),t.toString().replace(/\/$/,``)}const OFFICIAL_REGISTRY=resolveOfficialRegistryUrl(),OFFICIAL_CATALOG=`${OFFICIAL_REGISTRY}/registry.json`,SKILLS_REGISTRY=`@skills`;function itemAddress(e){return e.startsWith(`@`)||/^https?:\/\//.test(e)?e:`${OFFICIAL_REGISTRY}/${e}.json`}const WEB_CHAT_ITEMS={next:`channel/web`,tanstack:`channel/web-tanstack`};async function askWebChatFramework(e,t,n,r,i){let a=r.nonInteractive===!0,o=r.setupAuthorized===!0||(i.hasInteractiveTerminal??defaultAddCommandDependencies.hasInteractiveTerminal)(),s=withAnswers(r.answers??{})(r.yes===!0||a||!o?withPolicy(`assume`)(headlessAsker()):interactiveAsker(r.prompter??i.createPrompter?.()??defaultAddCommandDependencies.createPrompter()));try{return await resolveWebChatFramework(t,s,r.answers)}catch(t){if(t instanceof WizardCancelledError)return!1;if(!a||!(t instanceof InvalidAnswerError))throw t;let i=setupQuestionToWire(t.question);e.error(serializeHeadlessSetupEvent({version:1,type:`blocked`,item:n,installed:!1,completedItems:[],status:`input_required`,question:i,issue:{code:`invalid_answer`,message:t.message},next:headlessSetupContinuation({item:n,installed:!1,answers:r.answers,question:i})})),process.exitCode=2;return}}function assertCompatibleEveVersion(e){if(e===void 0)return;let t=resolveInstalledPackageInfo().version;if(semver.validRange(e)===null)throw Error(`Registry item has an invalid eve version requirement: ${e}.`);if(!semver.subset(t,e,{includePrerelease:!0}))throw Error(`This registry item requires eve ${e}, but this project is using eve ${t}. Upgrade eve and run the command again.`)}function isOfficialItemAddress(e){return e.startsWith(`${OFFICIAL_REGISTRY}/`)}function withBuiltInRegistries(e){return{...e,registries:{[SKILLS_REGISTRY]:`https://www.skills.sh/r/{name}?agent=eve`,...e.registries}}}async function readEveRegistryConfig(e){return withBuiltInRegistries(await readRegistryConfig(e))}function configuredRegistrySources(e){return Object.keys(e.registries??{})}function validateRegistrySource(e){if(e!==void 0&&!e.startsWith(`@`)&&!/^https?:\/\//.test(e))throw Error(`Registry sources must be a namespace or URL: ${e}`)}async function loadOfficialSearchMetadata(){let e=await fetch(OFFICIAL_CATALOG);if(!e.ok)throw Error(`Could not read the eve registry (${e.status}).`);return parseOfficialRegistrySearchMetadata(await e.json())}function searchItemAddress(e){return e.registry===OFFICIAL_CATALOG?e.name:e.addCommandArgument}function enrichSearchItem(e,t){let n=searchItemAddress(e);return{item:e,address:n,...t.get(n)}}function registrySourceLabel(e){return e===OFFICIAL_CATALOG?`eve`:e===SKILLS_REGISTRY?`skills.sh`:e}function searchPresentationSections(e,t,n){return e.flatMap(e=>{let r=t.get(e);return r===void 0?[]:[{label:registrySourceLabel(e),items:r.items.map(e=>enrichSearchItem(e,n)),total:r.pagination.total}]})}async function printAddSuggestions(e,t,n){try{let r=n.split(`/`).at(-1)||n,{resultsBySource:i,sources:a,metadataByAddress:o}=await searchRegistryCatalog(t,{limit:5,query:r}),s=searchPresentationSections(a,i,o);if(s.every(e=>e.items.length===0))return;e.log(`Did you mean?`),printRegistrySearchResults(e,{query:r,sections:s})}catch{}}async function searchRegistryCatalog(e,t){validateRegistrySource(t.source);let n=await readEveRegistryConfig(e),r=t.source?[t.source]:[OFFICIAL_CATALOG,...configuredRegistrySources(n).filter(e=>t.query!==void 0||e!==SKILLS_REGISTRY)],i=await Promise.all(r.map(async e=>{try{return{result:await searchRegistries([e],{config:n,limit:t.limit??500,query:t.query}),source:e}}catch(t){return{error:t,source:e}}})),a=[],o=new Map;for(let e of i)if(`error`in e)a.push({message:errorMessage(e.error),registry:e.source});else{let t=e.result.errors??[];if(a.push(...t),t.length===0){let t=e.result.items.filter(t=>t.registry===e.source);o.set(e.source,{...e.result,items:t,pagination:{...e.result.pagination,total:e.result.items.length===t.length?e.result.pagination.total:0}})}}let s=new Map(a.map(e=>[`${e.registry}\0${e.message}`,e])),c=o.has(OFFICIAL_CATALOG)?await loadOfficialSearchMetadata():new Map,l=o.get(OFFICIAL_CATALOG);if(l!==void 0){let e=l.items.filter(e=>c.get(searchItemAddress(e))?.hidden!==!0);l.items=e,l.pagination={...l.pagination,total:e.length},l.items.sort((e,t)=>{let rank=e=>c.get(searchItemAddress(e))?.implementation===`native`?0:1;return rank(e)-rank(t)})}let u=[...o.values()];return{config:n,result:{items:u.flatMap(e=>e.items),pagination:{hasMore:u.some(e=>e.pagination.hasMore),limit:t.limit??500,offset:0,total:u.reduce((e,t)=>e+t.pagination.total,0)},...s.size>0?{errors:[...s.values()]}:{}},resultsBySource:o,sources:r,metadataByAddress:c}}async function browseRegistryCatalog(e,t={}){let{result:n}=await searchRegistryCatalog(e,t);return{items:n.items.map(e=>{let t={address:e.registry===OFFICIAL_CATALOG?e.name:e.addCommandArgument,name:e.name,source:e.registry===OFFICIAL_CATALOG?`Vercel`:e.registry};return e.title!==void 0&&(t.title=e.title),e.type!==void 0&&(t.type=e.type),e.description!==void 0&&(t.description=e.description),t}),total:n.pagination.total,errors:n.errors??[]}}async function browseRegistryItems(e,t,n,r,i={}){let{result:a,resultsBySource:o,sources:s,metadataByAddress:c}=await searchRegistryCatalog(t,{limit:i.limit,query:n,source:r}),l=a.errors??[];if(i.json||o.size>0){let t=a.items.map(e=>({...e,...c.get(searchItemAddress(e))})),r={query:n,sections:searchPresentationSections(s,o,c)};i.json&&(r.json={...a,items:t}),printRegistrySearchResults(e,r)}for(let t of l)e.error(`${t.registry}: ${t.message}`);l.length>0&&(process.exitCode=1)}async function installRegistryItem(e,t,n={},r=defaultAddCommandDependencies){let i,a=[],o={error:e=>{i=e},log:e=>a.push(e)},s=process.exitCode,c;try{c=await runAddCommand(o,e,t,{...n,yes:n.prompter===void 0||n.yes,setupAuthorized:n.prompter!==void 0,throwSetupFailures:!0},r)}catch(e){if(process.exitCode=s,!(e instanceof RegistrySetupFailedError))throw e;let t={resumeCommand:e.resumeCommand,reason:e.reason};return e.prerequisite!==void 0&&(t.prerequisite=e.prerequisite),{output:a,setupIncomplete:t}}if(process.exitCode=s,i!==void 0)throw Error(i);if(c===!1)throw new WizardCancelledError;if(c===`setup-incomplete`)return{output:a,setupIncomplete:{resumeCommand:setupResumeCommand(t)}};let l={output:a};return c!==void 0&&(l.setup=c),l}async function runAddCommand(e,t,n,r,i=defaultAddCommandDependencies){let setupIncomplete=t=>(r.silent!==!0&&e.log(setupReminder(n,t)),`setup-incomplete`);return runRegistryAction(e,t,async()=>{let a=itemAddress(n),o;if(a===itemAddress(WEB_CHAT_ITEMS.next)&&r.skipInstall!==!0){let a=await askWebChatFramework(e,t,n,r,i);if(a===!1||a===void 0)return a;o=a}let s=o===void 0?a:itemAddress(WEB_CHAT_ITEMS[o]),c=o===void 0?t:await prepareWebChatProjectRoot(t,o),l=await readEveRegistryConfig(t);if(r.skipInstall===!0){if(r.overwrite===!0)throw Error(`--overwrite cannot be used with --skip-install.`);if(r.skipSetup===!0)throw Error(`--skip-install cannot be used with --skip-setup.`);if(!isOfficialItemAddress(a))throw Error(`Setup flows are currently supported only for official eve registry items.`)}let u=await resolveRegistryItemForAdd(e,async()=>(await getRegistryItems([s],{config:l}))[0],()=>printAddSuggestions(e,t,n));if(!u.found)return;let d=u.item,f=isOfficialItemAddress(a)?eveMetadataFromRegistryItem(d):void 0;if(assertCompatibleEveVersion(f?.requires),r.skipInstall===!0){if(f?.setup===void 0)throw Error(`Registry item "${n}" does not declare a setup flow.`);let a=await runDeclaredSetups({logger:e,appRoot:t,item:n,setups:f.setup,options:r,dependencies:i,resumeCommand:setupResumeCommand(n)});return a===!1&&!r.nonInteractive?setupIncomplete(`cancelled`):reportRegistryCompletion(e,n,a,r)}if(!await prepareDeclaredPnpmBuildPolicy({logger:e,appRoot:c,item:n,policies:f?.install?.pnpm?.buildScripts,options:r}))return!1;if(o!==void 0&&await(i.prepareWebRegistryProject??prepareWebRegistryProject)(c,o),await installRegistryItemTransaction({appRoot:c,item:n,registryItem:d,nonInteractive:r.nonInteractive,logger:e,install:async()=>{await addRegistryItems([s],{config:l,cwd:c,overwrite:r.overwrite,silent:r.silent})}}),f?.setup===void 0)return reportRegistryCompletion(e,n,{facts:[]},r);let p=i.hasInteractiveTerminal?.()??defaultAddCommandDependencies.hasInteractiveTerminal();if(r.nonInteractive&&e.log(serializeHeadlessSetupEvent({version:1,type:`progress`,message:r.skipInstall?`Setup ${n}`:`Installed ${n}`})),r.skipSetup===!0)return r.nonInteractive?reportRegistryCompletion(e,n,{facts:[]},r):setupIncomplete(`skipped`);if(!r.nonInteractive&&!r.yes&&!p&&r.setupAuthorized!==!0)return setupIncomplete(`skipped`);if(!r.nonInteractive&&!r.yes&&r.setupAuthorized!==!0)try{if(await(r.prompter??i.createPrompter?.()??defaultAddCommandDependencies.createPrompter()).select({message:`Set up ${n} now?`,initialValue:`yes`,options:[{value:`yes`,label:`Yes`},{value:`no`,label:`No`}]})===`no`)return setupIncomplete(`skipped`)}catch(e){if(!(e instanceof WizardCancelledError))throw e;return setupIncomplete(`cancelled`)}let m=await runDeclaredSetups({logger:e,appRoot:t,item:n,setups:f.setup,options:{...r,force:r.overwrite},dependencies:i,resumeCommand:setupResumeCommand(n)});return m===!1&&!r.nonInteractive?setupIncomplete(`cancelled`):reportRegistryCompletion(e,n,m,r)},{rethrow:e=>r.throwSetupFailures===!0&&e instanceof RegistrySetupFailedError})}async function runRegistryListCommand(e,t,n,r={}){await runRegistryAction(e,t,()=>browseRegistryItems(e,t,void 0,n,r))}async function runRegistrySearchCommand(e,t,n,r,i={}){await runRegistryAction(e,t,()=>browseRegistryItems(e,t,n,r,{...i,limit:i.limit??10}))}async function runRegistryViewCommand(e,t,n,r={}){await runRegistryAction(e,t,async()=>{let i=await readEveRegistryConfig(t),a=await getRegistryItems([itemAddress(n)],{config:i}),o=a.length===1?a[0]:a;e.log(r.json?JSON.stringify(o,null,2):registryViewText(n,o))})}export{browseRegistryCatalog,installRegistryItem,resolveOfficialRegistryUrl,runAddCommand,runRegistryAddCommand,runRegistryListCommand,runRegistrySearchCommand,runRegistryViewCommand};
@@ -2,7 +2,7 @@
2
2
  "moduleFingerprints": {
3
3
  "@eve/catalog": "29b7529f6044427c750e4c27fe91da792014c60c660db31b7ca1fff0afe7f603",
4
4
  "just-secrets": "1ce67d437d0bb06df02e4e99180a3c5f5edf0010314010226e97b96d462bba5d",
5
- "@vercel/agent-runs": "8a64c66bdfa39999f05321865b37e84aba509ff993db76e7fe988e8630d756b0",
5
+ "@vercel/agent-runs": "4fe062e4547dd55d36cfcc0ef0233894c4814d3208a0014ad08996eb474bfc79",
6
6
  "@workflow/world-local": "a10e78551f65fc607cf75261a569d852c40bc9cfac13a7fb6e15c88bf1ccf429"
7
7
  },
8
8
  "moduleVersions": {
@@ -42,7 +42,7 @@
42
42
  "@shadcn/registry": "0.1.3",
43
43
  "@standard-schema/spec": "1.1.0",
44
44
  "turndown": "7.2.4",
45
- "@vercel/agent-runs": "0.0.4",
45
+ "@vercel/agent-runs": "1.0.0-rc.0",
46
46
  "@vercel/blob": "2.8.0",
47
47
  "@vercel/connect": "2.5.2",
48
48
  "@vercel/detect-agent": "1.2.3",
@@ -61,7 +61,7 @@
61
61
  "zod": "4.5.4",
62
62
  "zod-validation-error": "5.0.0"
63
63
  },
64
- "scriptHash": "0c44438f4c2ccda237c573eb38e4a3243c1706bac80411b4f5424f8c969f9044",
64
+ "scriptHash": "27398ae2b7e55db0a3ae2cb9eeb8b9507f9ee326f652938412502cdda4395acc",
65
65
  "toolVersions": {
66
66
  "rolldown": "1.2.9",
67
67
  "typescript": "7.0.2"
@@ -15,7 +15,11 @@ export interface SemVerApi {
15
15
  gte(version: string, minimumVersion: string): boolean;
16
16
  intersects(rangeA: string, rangeB: string): boolean;
17
17
  minVersion(range: string): SemVer | null;
18
- subset(candidateRange: string, requiredRange: string): boolean;
18
+ subset(
19
+ candidateRange: string,
20
+ requiredRange: string,
21
+ options?: { includePrerelease?: boolean },
22
+ ): boolean;
19
23
  valid(version: string): string | null;
20
24
  validRange(range: string): string | null;
21
25
  }
@@ -8,3 +8,5 @@ export declare function createCompiledChannelRoutePlan(input: {
8
8
  readonly nodeId: string;
9
9
  readonly sources: Readonly<Record<string, AgentSourceDescriptor>>;
10
10
  }): CompiledChannelRoutePlan;
11
+ /** A route's identity for matching: `/items/:id` and `/items/:itemId` are one route. */
12
+ export declare function normalizeRoutePattern(path: string): string;
@@ -1 +1 @@
1
- import{createChannelRouteShadowedDiagnostic}from"#compiler/diagnostics.js";import{HOST_HTTP_INVENTORY}from"#framework/host-inventory.js";function createCompiledChannelRoutePlan(e){let t=[],n=[];for(let r of e.channels){let i=HOST_HTTP_INVENTORY.find(e=>routesOverlap(r,e));if(i!==void 0)throw Error(`compile/reserved-route-collision: ${r.method} ${r.urlPath} overlaps reserved ${i.method} ${i.path}.`);let a=t.find(e=>routesOverlap(r,e));if(a===void 0){t.push(r);continue}if(a.sourceId===r.sourceId)throw Error(`compile/channel-route-duplicate: source "${r.sourceId}" emits ${r.method} ${r.urlPath} more than once.`);let o=e.bindings[r.sourceId],s=e.sources[r.sourceId],c=e.sources[a.sourceId];if(o===void 0||s===void 0||c===void 0)throw Error(`Channel source "${r.sourceId}" has no compiled binding.`);n.push({method:r.method,source:s,urlPath:r.urlPath,winnerSourceId:a.sourceId}),e.diagnostics?.push(createChannelRouteShadowedDiagnostic({loser:s,method:r.method,nodeId:e.nodeId,urlPath:r.urlPath,winner:c}))}let r=derivePreflights(t);return{effective:Object.freeze(t),preflight:Object.freeze(r),shadowed:Object.freeze(n)}}function derivePreflights(e){let t=e.filter(e=>e.method!==`WEBSOCKET`&&e.cors!==void 0);for(let[e,n]of t.entries()){let r=t.slice(e+1).find(e=>routePatternsOverlap(n.urlPath,e.urlPath)&&JSON.stringify(n.cors)!==JSON.stringify(e.cors));if(r!==void 0)throw Error(`compile/channel-cors-conflict: overlapping routes at "${n.urlPath}" and "${r.urlPath}" declare different CORS policies.`)}let n=new Map;for(let e of t){let t=normalizeRoutePattern(e.urlPath),r=n.get(t)??[];r.push(e),n.set(t,r)}let r=[];for(let t of n.values()){let n=t[0],i=JSON.stringify(n.cors);if(t.some(e=>JSON.stringify(e.cors)!==i))throw Error(`compile/channel-cors-conflict: routes at "${n.urlPath}" declare different CORS policies.`);if(e.some(e=>e.method===`OPTIONS`&&routePatternsOverlap(e.urlPath,n.urlPath)))throw Error(`compile/channel-preflight-collision: explicit OPTIONS route overlaps generated preflight at "${n.urlPath}".`);r.push({cors:n.cors,method:`OPTIONS`,sourceIds:[...new Set(t.map(e=>e.sourceId))],urlPath:n.urlPath})}return r}function routesOverlap(e,t){return methodsOverlap(e.method,t.method)&&routePatternsOverlap(e.urlPath,t.path??t.urlPath)}function methodsOverlap(e,t){return e===`ALL`||t===`ALL`||e===t}function routePatternsOverlap(e,t){let n=splitRoute(e),r=splitRoute(t);return n.length===r.length&&n.every((e,t)=>isParameter(e)||isParameter(r[t])||e===r[t])}function normalizeRoutePattern(e){return splitRoute(e).map(e=>isParameter(e)?`:`:e).join(`/`)}function splitRoute(e){return e.replace(/^\/+|\/+$/g,``).split(`/`)}function isParameter(e){return e.startsWith(`:`)||/^\[[^\]]+\]$/.test(e)}export{createCompiledChannelRoutePlan};
1
+ import{createChannelRouteShadowedDiagnostic}from"#compiler/diagnostics.js";import{HOST_HTTP_INVENTORY}from"#framework/host-inventory.js";function createCompiledChannelRoutePlan(e){let t=[],n=[];for(let r of e.channels){let i=HOST_HTTP_INVENTORY.find(e=>routesOverlap(r,e));if(i!==void 0)throw Error(`compile/reserved-route-collision: ${r.method} ${r.urlPath} overlaps reserved ${i.method} ${i.path}.`);let a=t.find(e=>routesOverlap(r,e));if(a===void 0){t.push(r);continue}if(a.sourceId===r.sourceId)throw Error(`compile/channel-route-duplicate: source "${r.sourceId}" emits ${r.method} ${r.urlPath} more than once.`);let o=e.bindings[r.sourceId],s=e.sources[r.sourceId],c=e.sources[a.sourceId];if(o===void 0||s===void 0||c===void 0)throw Error(`Channel source "${r.sourceId}" has no compiled binding.`);n.push({method:r.method,source:s,urlPath:r.urlPath,winnerSourceId:a.sourceId}),e.diagnostics?.push(createChannelRouteShadowedDiagnostic({loser:s,method:r.method,nodeId:e.nodeId,urlPath:r.urlPath,winner:c}))}rejectWebSocketParameterMismatches(t);let r=derivePreflights(t);return{effective:Object.freeze(t),preflight:Object.freeze(r),shadowed:Object.freeze(n)}}function derivePreflights(e){let t=e.filter(e=>e.method!==`WEBSOCKET`&&e.cors!==void 0);for(let[e,n]of t.entries()){let r=t.slice(e+1).find(e=>routePatternsOverlap(n.urlPath,e.urlPath)&&JSON.stringify(n.cors)!==JSON.stringify(e.cors));if(r!==void 0)throw Error(`compile/channel-cors-conflict: overlapping routes at "${n.urlPath}" and "${r.urlPath}" declare different CORS policies.`)}let n=new Map;for(let e of t){let t=normalizeRoutePattern(e.urlPath),r=n.get(t)??[];r.push(e),n.set(t,r)}let r=[];for(let t of n.values()){let n=t[0],i=JSON.stringify(n.cors);if(t.some(e=>JSON.stringify(e.cors)!==i))throw Error(`compile/channel-cors-conflict: routes at "${n.urlPath}" declare different CORS policies.`);if(e.some(e=>e.method===`OPTIONS`&&routePatternsOverlap(e.urlPath,n.urlPath)))throw Error(`compile/channel-preflight-collision: explicit OPTIONS route overlaps generated preflight at "${n.urlPath}".`);r.push({cors:n.cors,method:`OPTIONS`,sourceIds:[...new Set(t.map(e=>e.sourceId))],urlPath:n.urlPath})}return r}function rejectWebSocketParameterMismatches(e){for(let t of e.filter(e=>e.method===`WEBSOCKET`)){let n=normalizeRoutePattern(t.urlPath),r=e.find(e=>e.method===`GET`&&normalizeRoutePattern(e.urlPath)===n);if(r===void 0)continue;let i=parameterNames(r.urlPath),a=parameterNames(t.urlPath);if(i.join(`/`)!==a.join(`/`))throw Error(`compile/channel-websocket-params-mismatch: GET ${r.urlPath} and WS ${t.urlPath} match the same requests but name their parameters differently (${i.join(`, `)} vs ${a.join(`, `)}). One handler serves both, so rename the parameters in one route to match the other.`)}}function parameterNames(e){return splitRoute(e).filter(isParameter).map(e=>e.replace(/^:|^\[|\]$/g,``))}function routesOverlap(e,t){return methodsOverlap(e.method,t.method)&&routePatternsOverlap(e.urlPath,t.path??t.urlPath)}function methodsOverlap(e,t){return e===`ALL`||t===`ALL`||e===t}function routePatternsOverlap(e,t){let n=splitRoute(e),r=splitRoute(t);return n.length===r.length&&n.every((e,t)=>isParameter(e)||isParameter(r[t])||e===r[t])}function normalizeRoutePattern(e){return splitRoute(e).map(e=>isParameter(e)?`:`:e).join(`/`)}function splitRoute(e){return e.replace(/^\/+|\/+$/g,``).split(`/`)}function isParameter(e){return e.startsWith(`:`)||/^\[[^\]]+\]$/.test(e)}export{createCompiledChannelRoutePlan,normalizeRoutePattern};
@@ -1 +1 @@
1
- import{isAbsolute,relative,resolve}from"node:path";import{normalizeLogicalPath}from"#discover/filesystem.js";import{toErrorMessage}from"#shared/errors.js";import{parseJsonObject}from"#shared/json.js";import{isDynamicModelDefinition}from"#shared/agent-definition.js";import{createCompiledBindingNamespaceLoader}from"#compiler/load-binding-namespace.js";import{normalizeAgentDefinition}from"#internal/authored-definition/core.js";import{isDefinedAgent}from"#public/definitions/agent.js";import{isDynamicSentinel}from"#dynamic/definition.js";import{formatLanguageModelGatewayId}from"#internal/runtime-model.js";import{classifyModelRouting}from"#internal/classify-model-routing.js";import{isMockModel}from"#internal/mock-model-identity.js";import{isChatGptModelRouting}from"#shared/chatgpt-model.js";import{loadModuleBackedDefinition}from"#compiler/normalize-helpers.js";async function compileAgentConfig(e,t,n){let r=n.source,i=formatAgentConfigModulePath(e,r,n.binding),a=Object.hasOwn(n,`definition`)?n.definition:await loadModuleBackedDefinition({binding:n.binding,displayPath:i,kind:`agent config`,loadNamespace:createCompiledBindingNamespaceLoader({appRoot:e.appRoot,bindings:{[r.sourceId]:n.binding},registries:t.registries}),source:r});if(!isDefinedAgent(a)&&!isDynamicSentinel(a))throw Error(`Export defineAgent({...}) from "${i}".`);let o=normalizeAgentDefinition(a,`Expected the agent config export "${r.exportName??`default`}" from "${i}" to match the public eve shape.`),s=isDynamicModelDefinition(o.model)?o.model:void 0,c=s===void 0?await normalizeAuthoredModelReference({modelCatalog:t.modelCatalog,purpose:`the primary compaction trigger model`,contextWindowTokens:o.modelContextWindowTokens,promptCache:o.modelOptions?.promptCache,providerOptions:o.modelOptions?.providerOptions,source:r,sourcePath:i,value:o.model}):void 0,l={},u={compaction:l,name:e.agentId,source:{...r}};o.defaultTools!==void 0&&(u.defaultTools=o.defaultTools),o.description!==void 0&&(u.description=o.description);let d;s!==void 0&&(d={exportName:r.exportName,sourceKind:`module`,logicalPath:r.logicalPath,sourceId:r.sourceId});let f=normalizeExperimentalDefinition(o.experimental);if(f!==void 0&&(u.experimental=f),o.build!==void 0&&(u.build={externalDependencies:o.build.externalDependencies===void 0?void 0:[...o.build.externalDependencies]}),o.reasoning!==void 0&&(u.reasoning=o.reasoning),o.tool!==void 0&&(u.tool=o.tool),o.limits!==void 0&&(u.limits={sessionTimeoutMs:o.limits.sessionTimeoutMs,sessionUsage:typeof o.limits.sessionUsage==`function`||o.limits.sessionUsage}),o.compaction?.model!==void 0&&(l.model=await normalizeAuthoredModelReference({modelCatalog:t.modelCatalog,purpose:`the compaction summary model`,contextWindowTokens:o.compaction.modelContextWindowTokens,providerOptions:o.modelOptions?.providerOptions,source:r,sourceField:`compaction.model`,sourcePath:i,value:o.compaction.model})),o.compaction?.threshold!==void 0&&(l.thresholdPercent=o.compaction.threshold),d!==void 0)return{...u,dynamicModel:d};if(c===void 0)throw Error(`Expected a static agent model to compile to a concrete model reference.`);return{...u,model:c}}function normalizeExperimentalDefinition(e){if(e===void 0)return;let t={};return e.workflow!==void 0&&(t.workflow={modelCallsPerStep:e.workflow.modelCallsPerStep,retention:e.workflow.retention,world:e.workflow.world}),t}async function normalizeAuthoredModelReference(e){if(typeof e.value==`string`){let t=classifyModelRouting(e.value,e.providerOptions);return rejectGatewayPromptCache(e,t),await withCompiledRuntimeModelLimits({id:formatLanguageModelGatewayId(e.value),providerOptions:parseProviderOptionsRecord(e.providerOptions),routing:t},e)}let t=e.source;if(t===void 0)throw Error(`Expected ${e.purpose} to provide a valid AI SDK language model reference.`);let n=e.value,r=n.specificationVersion;if(r!==`v2`&&r!==`v3`&&r!==`v4`||typeof n.provider!=`string`||typeof n.modelId!=`string`||typeof n.doGenerate!=`function`||typeof n.doStream!=`function`)throw Error(`Expected the authored agent config export "${t.exportName??`default`}" from "${e.sourcePath??t.logicalPath}" to provide a valid AI SDK language model.`);let i=classifyModelRouting(n,e.providerOptions);rejectGatewayPromptCache(e,i);let a={id:formatLanguageModelGatewayId(n),source:{exportName:t.exportName,sourceKind:`module`,logicalPath:t.logicalPath,sourceId:t.sourceId},providerOptions:parseProviderOptionsRecord(e.providerOptions),routing:i};if(e.sourceField!==void 0&&(a.sourceField=e.sourceField),e.promptCache!==void 0&&(a.promptCache=e.promptCache),e.contextWindowTokens===void 0){if(isChatGptModelRouting(a.routing))return{...a,contextWindowTokens:2e5};if(isMockModel(n))return{...a,contextWindowTokens:1e6};try{let t=await e.modelCatalog.getByProviderModelId(n.provider,n.modelId);if(t)return{...a,id:t.slug,contextWindowTokens:t.contextWindowTokens}}catch{}}return await withCompiledRuntimeModelLimits(a,e)}function rejectGatewayPromptCache(e,t){if(e.promptCache!==void 0&&t.kind===`gateway`)throw Error(`${e.sourcePath??`agent.ts`}: modelOptions.promptCache applies only to models eve calls directly, but "${formatLanguageModelGatewayId(e.value)}" routes through AI Gateway, which manages its own prompt caching. Remove promptCache, or configure Gateway caching with providerOptions.gateway.caching.`)}function formatAgentConfigModulePath(e,t,n){return n.backing.kind===`programmatic`?t.logicalPath:normalizeLogicalPath(relative(resolveTopLevelAgentRoot(e),n.backing.sourcePath))}function resolveTopLevelAgentRoot(e){let t=resolve(e.appRoot),n=resolve(t,`agent`);return isPathInsideOrEqual(n,resolve(e.agentRoot))?n:t}function isPathInsideOrEqual(e,t){let n=relative(e,t);return n===``||!n.startsWith(`..`)&&!isAbsolute(n)}async function withCompiledRuntimeModelLimits(e,t){if(t.contextWindowTokens!==void 0)return{...e,contextWindowTokens:t.contextWindowTokens};let n=await t.modelCatalog.getModelLimits(e.id).catch(n=>{throw Error(`Failed to load AI Gateway model metadata for ${t.purpose} "${e.id}". ${toErrorMessage(n)}`)});if(n===null)throw Error(`Cannot compile agent compaction because ${t.purpose} "${e.id}" does not have known AI Gateway context window metadata.`);return{...e,contextWindowTokens:n.contextWindowTokens}}function parseProviderOptionsRecord(e){if(e===void 0)return;let t={};for(let[n,r]of Object.entries(e))t[n]=parseJsonObject(r);return t}export{compileAgentConfig};
1
+ import{relative,resolve}from"node:path";import{normalizeLogicalPath}from"#discover/filesystem.js";import{toErrorMessage}from"#shared/errors.js";import{parseJsonObject}from"#shared/json.js";import{isDynamicModelDefinition}from"#shared/agent-definition.js";import{createCompiledBindingNamespaceLoader}from"#compiler/load-binding-namespace.js";import{normalizeAgentDefinition}from"#internal/authored-definition/core.js";import{isDefinedAgent}from"#public/definitions/agent.js";import{isDynamicSentinel}from"#dynamic/definition.js";import{formatLanguageModelGatewayId}from"#internal/runtime-model.js";import{classifyModelRouting}from"#internal/classify-model-routing.js";import{isMockModel}from"#internal/mock-model-identity.js";import{isChatGptModelRouting}from"#shared/chatgpt-model.js";import{loadModuleBackedDefinition}from"#compiler/normalize-helpers.js";import{isPathInsideOrEqual}from"#shared/path-inside.js";async function compileAgentConfig(e,t,n){let r=n.source,i=formatAgentConfigModulePath(e,r,n.binding),a=Object.hasOwn(n,`definition`)?n.definition:await loadModuleBackedDefinition({binding:n.binding,displayPath:i,kind:`agent config`,loadNamespace:createCompiledBindingNamespaceLoader({appRoot:e.appRoot,bindings:{[r.sourceId]:n.binding},registries:t.registries}),source:r});if(!isDefinedAgent(a)&&!isDynamicSentinel(a))throw Error(`Export defineAgent({...}) from "${i}".`);let o=normalizeAgentDefinition(a,`Expected the agent config export "${r.exportName??`default`}" from "${i}" to match the public eve shape.`),s=isDynamicModelDefinition(o.model)?o.model:void 0,c=s===void 0?await normalizeAuthoredModelReference({modelCatalog:t.modelCatalog,purpose:`the primary compaction trigger model`,contextWindowTokens:o.modelContextWindowTokens,promptCache:o.modelOptions?.promptCache,providerOptions:o.modelOptions?.providerOptions,source:r,sourcePath:i,value:o.model}):void 0,l={},u={compaction:l,name:e.agentId,source:{...r}};o.defaultTools!==void 0&&(u.defaultTools=o.defaultTools),o.description!==void 0&&(u.description=o.description);let d;s!==void 0&&(d={exportName:r.exportName,sourceKind:`module`,logicalPath:r.logicalPath,sourceId:r.sourceId});let f=normalizeExperimentalDefinition(o.experimental);if(f!==void 0&&(u.experimental=f),o.build!==void 0&&(u.build={externalDependencies:o.build.externalDependencies===void 0?void 0:[...o.build.externalDependencies]}),o.reasoning!==void 0&&(u.reasoning=o.reasoning),o.tool!==void 0&&(u.tool=o.tool),o.limits!==void 0&&(u.limits={sessionTimeoutMs:o.limits.sessionTimeoutMs,sessionUsage:typeof o.limits.sessionUsage==`function`||o.limits.sessionUsage}),o.compaction?.model!==void 0&&(l.model=await normalizeAuthoredModelReference({modelCatalog:t.modelCatalog,purpose:`the compaction summary model`,contextWindowTokens:o.compaction.modelContextWindowTokens,providerOptions:o.modelOptions?.providerOptions,source:r,sourceField:`compaction.model`,sourcePath:i,value:o.compaction.model})),o.compaction?.threshold!==void 0&&(l.thresholdPercent=o.compaction.threshold),d!==void 0)return{...u,dynamicModel:d};if(c===void 0)throw Error(`Expected a static agent model to compile to a concrete model reference.`);return{...u,model:c}}function normalizeExperimentalDefinition(e){if(e===void 0)return;let t={};return e.workflow!==void 0&&(t.workflow={modelCallsPerStep:e.workflow.modelCallsPerStep,retention:e.workflow.retention,world:e.workflow.world}),t}async function normalizeAuthoredModelReference(e){if(typeof e.value==`string`){let t=classifyModelRouting(e.value,e.providerOptions);return rejectGatewayPromptCache(e,t),await withCompiledRuntimeModelLimits({id:formatLanguageModelGatewayId(e.value),providerOptions:parseProviderOptionsRecord(e.providerOptions),routing:t},e)}let t=e.source;if(t===void 0)throw Error(`Expected ${e.purpose} to provide a valid AI SDK language model reference.`);let n=e.value,r=n.specificationVersion;if(r!==`v2`&&r!==`v3`&&r!==`v4`||typeof n.provider!=`string`||typeof n.modelId!=`string`||typeof n.doGenerate!=`function`||typeof n.doStream!=`function`)throw Error(`Expected the authored agent config export "${t.exportName??`default`}" from "${e.sourcePath??t.logicalPath}" to provide a valid AI SDK language model.`);let i=classifyModelRouting(n,e.providerOptions);rejectGatewayPromptCache(e,i);let a={id:formatLanguageModelGatewayId(n),source:{exportName:t.exportName,sourceKind:`module`,logicalPath:t.logicalPath,sourceId:t.sourceId},providerOptions:parseProviderOptionsRecord(e.providerOptions),routing:i};if(e.sourceField!==void 0&&(a.sourceField=e.sourceField),e.promptCache!==void 0&&(a.promptCache=e.promptCache),e.contextWindowTokens===void 0){if(isChatGptModelRouting(a.routing))return{...a,contextWindowTokens:2e5};if(isMockModel(n))return{...a,contextWindowTokens:1e6};try{let t=await e.modelCatalog.getByProviderModelId(n.provider,n.modelId);if(t)return{...a,id:t.slug,contextWindowTokens:t.contextWindowTokens}}catch{}}return await withCompiledRuntimeModelLimits(a,e)}function rejectGatewayPromptCache(e,t){if(e.promptCache!==void 0&&t.kind===`gateway`)throw Error(`${e.sourcePath??`agent.ts`}: modelOptions.promptCache applies only to models eve calls directly, but "${formatLanguageModelGatewayId(e.value)}" routes through AI Gateway, which manages its own prompt caching. Remove promptCache, or configure Gateway caching with providerOptions.gateway.caching.`)}function formatAgentConfigModulePath(e,t,n){return n.backing.kind===`programmatic`?t.logicalPath:normalizeLogicalPath(relative(resolveTopLevelAgentRoot(e),n.backing.sourcePath))}function resolveTopLevelAgentRoot(e){let t=resolve(e.appRoot),n=resolve(t,`agent`),r=resolve(e.agentRoot);return isPathInsideOrEqual(r,n)?n:t}async function withCompiledRuntimeModelLimits(e,t){if(t.contextWindowTokens!==void 0)return{...e,contextWindowTokens:t.contextWindowTokens};let n=await t.modelCatalog.getModelLimits(e.id).catch(n=>{throw Error(`Failed to load AI Gateway model metadata for ${t.purpose} "${e.id}". ${toErrorMessage(n)}`)});if(n===null)throw Error(`Cannot compile agent compaction because ${t.purpose} "${e.id}" does not have known AI Gateway context window metadata.`);return{...e,contextWindowTokens:n.contextWindowTokens}}function parseProviderOptionsRecord(e){if(e===void 0)return;let t={};for(let[n,r]of Object.entries(e))t[n]=parseJsonObject(r);return t}export{compileAgentConfig};
@@ -1 +1 @@
1
- import{runJsProgram}from"#execution/dynamic-workflow/workflow.js";async function runWorkflowProgramTask(e,t){"use workflow";return runJsProgram(e.js,t,{maxSubagents:e.maxSubagents??0})}runWorkflowProgramTask.workflowId=`workflow//eve@0.91.0//runWorkflowProgramTask`;export{runWorkflowProgramTask};
1
+ import{runJsProgram}from"#execution/dynamic-workflow/workflow.js";async function runWorkflowProgramTask(e,t){"use workflow";return runJsProgram(e.js,t,{maxSubagents:e.maxSubagents??0})}runWorkflowProgramTask.workflowId=`workflow//eve@1.0.0-rc.0//runWorkflowProgramTask`;export{runWorkflowProgramTask};
@@ -1 +1 @@
1
- import{decide}from"#ai/decide.js";async function runAgentRouterTask(e,t){"use workflow";let n=await chooseTarget(e.message,descriptions(t),t.abortSignal),{reply:r,status:i}=await(await t.agent(n).send(e.message,{signal:t.abortSignal})).result();if(i===`failed`)throw Error(`Agent "${n}" failed to handle the task.`);return r??null}async function chooseTarget(e,t,n){"use step";let r=Object.keys(t);if(r.length===0)throw Error(`agentRouter requires at least one available agent with a description.`);return r.length===1?r[0]:(await decide({signal:n,state:{message:e},questions:{route:{type:`choice`,instructions:`Which subagent should handle this task?`,criteria:t}}})).answers.route.choice}function descriptions(e){return Object.fromEntries(Object.entries(e.agents).flatMap(([e,t])=>{let n=t.description.trim();return n.length===0?[]:[[e,n]]}))}runAgentRouterTask.workflowId=`workflow//eve@0.91.0//runAgentRouterTask`;export{runAgentRouterTask};
1
+ import{decide}from"#ai/decide.js";async function runAgentRouterTask(e,t){"use workflow";let n=await chooseTarget(e.message,descriptions(t),t.abortSignal),{reply:r,status:i}=await(await t.agent(n).send(e.message,{signal:t.abortSignal})).result();if(i===`failed`)throw Error(`Agent "${n}" failed to handle the task.`);return r??null}async function chooseTarget(e,t,n){"use step";let r=Object.keys(t);if(r.length===0)throw Error(`agentRouter requires at least one available agent with a description.`);return r.length===1?r[0]:(await decide({signal:n,state:{message:e},questions:{route:{type:`choice`,instructions:`Which subagent should handle this task?`,criteria:t}}})).answers.route.choice}function descriptions(e){return Object.fromEntries(Object.entries(e.agents).flatMap(([e,t])=>{let n=t.description.trim();return n.length===0?[]:[[e,n]]}))}runAgentRouterTask.workflowId=`workflow//eve@1.0.0-rc.0//runAgentRouterTask`;export{runAgentRouterTask};
@@ -1 +1 @@
1
- import{githubShellInputSchema}from"./github-shell-schema.js";import{executeGitHubShell,githubShellApproval}from"./github-shell.js";import{z}from"#compiled/zod/index.js";import{defineTool}from"eve/tools";const GH_TOOL_SCOPE={repository:`Connect mints a GitHub App installation token for that repository, or for the owner's installation when repository is an owner.`,caller:`Connect resolves the caller's own GitHub token, which carries the caller's GitHub permissions, so GitHub allows whatever the caller can access.`},GH_TOOL_REPOSITORY={repository:`Set repository to the owner/name the command acts on, or to an owner for discovery such as gh repo list <owner> or gh search repos --owner <owner>.`,caller:`Set repository to the owner/name the command acts on, or omit it for commands that act on no single repository, such as gh repo list <owner>, gh search repos, or gh api user/repos.`};function ghToolDescription(e){return`Run one authenticated gh, git, or gh-signed-commit command in the sandbox. The full gh and git CLI surface is available. ${GH_TOOL_REPOSITORY[e]} The agent's access policy decides whether each command runs. ${GH_TOOL_SCOPE[e]} The sandbox process receives only a placeholder GH_TOKEN that the firewall exchanges on matching GitHub requests. Commands run without an approval prompt; description records the GitHub-side result the command intends to produce. Use simple argv quoting only, never environment assignments, pipes, redirects, substitutions, or other shell syntax. gh alias and extension commands may execute local code, but remain sandboxed. Use gh-signed-commit only with --repo. Use ordinary bash for local git status, diff, add, commit, and rebase.`}const GH_TOOL_DESCRIPTION=ghToolDescription(`repository`),ghOutputSchema=z.object({exitCode:z.number().int(),stderr:z.string(),stdout:z.string(),truncated:z.boolean()});function defineGhTool(e,t=ghToolDescription(e()?.principalType===`user`?`caller`:`repository`)){return defineTool({description:t,approval:({toolInput:e})=>githubShellApproval(e),inputSchema:githubShellInputSchema,outputSchema:ghOutputSchema,execute(t,n){return executeGitHubShell(t,e(),{context:n,auth:n.session.auth.current,getToken:(e,t)=>n.getToken(e,t),requireAuth:(e,t)=>n.requireAuth(e,t),getSandbox:()=>n.getSandbox(),sessionId:n.session.id})}})}export{GH_TOOL_DESCRIPTION,defineGhTool,ghToolDescription};
1
+ import{githubShellInputSchema}from"./github-shell-schema.js";import{executeGitHubShell,githubShellApproval}from"./github-shell.js";import{z}from"#compiled/zod/index.js";import{defineTool}from"eve/tools";const GH_TOOL_SCOPE={repository:`Connect mints a GitHub App installation token for that repository, or for the owner's installation when repository is an owner.`,caller:`Connect resolves the caller's own GitHub token, which carries the caller's GitHub permissions, so GitHub allows whatever the caller can access.`},GH_TOOL_REPOSITORY={repository:`Set repository to the owner/name the command acts on, or to an owner for discovery such as gh repo list <owner> or gh search repos --owner <owner>.`,caller:`Set repository to the owner/name the command acts on, or omit it for commands that act on no single repository, such as gh repo list <owner>, gh search repos, or gh api user/repos.`};function ghToolDescription(e){return`Run one authenticated gh, git, or gh-signed-commit command in the sandbox. The full gh and git CLI surface is available. ${GH_TOOL_REPOSITORY[e]} The agent's access policy decides whether each command runs. ${GH_TOOL_SCOPE[e]} The sandbox process receives only a placeholder GH_TOKEN that the firewall exchanges on matching GitHub requests. Commands run without an approval prompt; description records the GitHub-side result the command intends to produce. Use simple argv quoting only, never environment assignments, pipes, redirects, substitutions, or other shell syntax. gh alias and extension commands may execute local code, but remain sandboxed. Use gh-signed-commit only with --repo. Use ordinary bash for local git status, diff, add, commit, and rebase.`}const GH_TOOL_DESCRIPTION=ghToolDescription(`repository`),ghOutputSchema=z.object({exitCode:z.number().int(),stderr:z.string(),stdout:z.string(),truncated:z.boolean()});function defineGhTool(e,t=ghToolDescription(e()?.principalType===`user`?`caller`:`repository`)){return defineTool({description:t,approval:({toolInput:e})=>githubShellApproval(e),inputSchema:githubShellInputSchema,outputSchema:ghOutputSchema,label:{start:e=>e.description},execute(t,n){return executeGitHubShell(t,e(),{context:n,auth:n.session.auth.current,getToken:(e,t)=>n.getToken(e,t),requireAuth:(e,t)=>n.requireAuth(e,t),getSandbox:()=>n.getSandbox(),sessionId:n.session.id})}})}export{GH_TOOL_DESCRIPTION,defineGhTool,ghToolDescription};
@@ -1 +1 @@
1
- import{EVE_DEV_DISPATCH_SCHEDULE_ROUTE_PATTERN,EVE_DEV_RUNTIME_ARTIFACTS_REBUILD_ROUTE_PATH,EVE_DEV_RUNTIME_ARTIFACTS_RESUME_ROUTE_PATH,EVE_DEV_RUNTIME_ARTIFACTS_ROUTE_PATH,EVE_DEV_RUNTIME_ARTIFACTS_SUSPEND_ROUTE_PATH,EVE_PRODUCTION_CRON_ROUTE_PATTERN}from"#protocol/routes.js";import{EVE_WORKFLOW_FLOW_ROUTE_PATH}from"#internal/workflow-bundle/eve-service-route-output.js";import{DEVELOPMENT_WORKFLOW_STREAM_ROUTE,DEVELOPMENT_WORKFLOW_WORLD_ROUTE}from"#internal/workflow/development-world-protocol.js";const HOST_HTTP_INVENTORY=Object.freeze([{capability:`workflow`,method:`ALL`,path:EVE_WORKFLOW_FLOW_ROUTE_PATH},{capability:`development`,method:`GET`,path:EVE_DEV_RUNTIME_ARTIFACTS_ROUTE_PATH},{capability:`development`,method:`GET`,path:EVE_DEV_RUNTIME_ARTIFACTS_REBUILD_ROUTE_PATH},{capability:`development`,method:`POST`,path:EVE_DEV_RUNTIME_ARTIFACTS_REBUILD_ROUTE_PATH},{capability:`development`,method:`POST`,path:EVE_DEV_RUNTIME_ARTIFACTS_SUSPEND_ROUTE_PATH},{capability:`development`,method:`POST`,path:EVE_DEV_RUNTIME_ARTIFACTS_RESUME_ROUTE_PATH},{capability:`development`,method:`ALL`,path:DEVELOPMENT_WORKFLOW_WORLD_ROUTE},{capability:`development`,method:`ALL`,path:DEVELOPMENT_WORKFLOW_STREAM_ROUTE},{capability:`schedule`,method:`POST`,path:EVE_DEV_DISPATCH_SCHEDULE_ROUTE_PATTERN},{capability:`schedule`,method:`ALL`,path:EVE_PRODUCTION_CRON_ROUTE_PATTERN,reservationOnly:!0}]);export{HOST_HTTP_INVENTORY};
1
+ import{EVE_DEV_DISPATCH_SCHEDULE_ROUTE_PATTERN,EVE_DEV_RUNTIME_ARTIFACTS_REBUILD_ROUTE_PATH,EVE_DEV_RUNTIME_ARTIFACTS_RESUME_ROUTE_PATH,EVE_DEV_RUNTIME_ARTIFACTS_ROUTE_PATH,EVE_DEV_RUNTIME_ARTIFACTS_SUSPEND_ROUTE_PATH,EVE_PRODUCTION_CRON_ROUTE_PATTERN}from"#protocol/routes.js";import{EVE_WORKFLOW_FLOW_ROUTE_PATH}from"#internal/workflow-bundle/flow-route.js";import{DEVELOPMENT_WORKFLOW_STREAM_ROUTE,DEVELOPMENT_WORKFLOW_WORLD_ROUTE}from"#internal/workflow/development-world-protocol.js";const HOST_HTTP_INVENTORY=Object.freeze([{capability:`workflow`,method:`ALL`,path:EVE_WORKFLOW_FLOW_ROUTE_PATH},{capability:`development`,method:`GET`,path:EVE_DEV_RUNTIME_ARTIFACTS_ROUTE_PATH},{capability:`development`,method:`GET`,path:EVE_DEV_RUNTIME_ARTIFACTS_REBUILD_ROUTE_PATH},{capability:`development`,method:`POST`,path:EVE_DEV_RUNTIME_ARTIFACTS_REBUILD_ROUTE_PATH},{capability:`development`,method:`POST`,path:EVE_DEV_RUNTIME_ARTIFACTS_SUSPEND_ROUTE_PATH},{capability:`development`,method:`POST`,path:EVE_DEV_RUNTIME_ARTIFACTS_RESUME_ROUTE_PATH},{capability:`development`,method:`ALL`,path:DEVELOPMENT_WORKFLOW_WORLD_ROUTE},{capability:`development`,method:`ALL`,path:DEVELOPMENT_WORKFLOW_STREAM_ROUTE},{capability:`schedule`,method:`POST`,path:EVE_DEV_DISPATCH_SCHEDULE_ROUTE_PATTERN},{capability:`schedule`,method:`ALL`,path:EVE_PRODUCTION_CRON_ROUTE_PATTERN,reservationOnly:!0}]);export{HOST_HTTP_INVENTORY};
@@ -1,9 +1,6 @@
1
1
  import type { AuthoredWorkflowModules } from "#internal/workflow-bundle/builder-support.js";
2
- import type { CompileMetadata } from "#compiler/artifacts.js";
3
2
  import type { CompileAgentResult } from "#compiler/compile-agent.js";
4
- import { type ModelMetadata } from "#internal/model-catalog.js";
5
3
  import type { AgentWorkflowWorldDefinition } from "#shared/agent-definition.js";
6
- import { type SandboxPreparedArtifactsManifest } from "#shared/sandbox-prepared-artifacts.js";
7
4
  export type BuiltInWorkflowWorldTarget = "local" | "vercel";
8
5
  export interface GeneratedInstrumentationLayout {
9
6
  readonly kind: "directory";
@@ -53,14 +50,6 @@ export declare function writeDevelopmentCompiledArtifactsFiles(input: {
53
50
  readonly outDir: string;
54
51
  readonly runtimeAppRoot: string;
55
52
  }): Promise<GeneratedCompiledArtifactsFiles>;
56
- export declare function createCompiledArtifactsBootstrapSource(input: {
57
- compileResult: CompileAgentResult;
58
- installModulePath: string;
59
- metadata: CompileMetadata;
60
- modelMetadata: ModelMetadata;
61
- moduleMapImportPath: string;
62
- sandboxPreparedArtifacts: SandboxPreparedArtifactsManifest;
63
- }): string;
64
53
  export declare function createWorkflowWorldPluginSource(input: {
65
54
  compiledArtifactsBootstrapPath: string;
66
55
  configuredWorld: AgentWorkflowWorldDefinition | undefined;
@@ -1,5 +1,5 @@
1
- import{copyFile,mkdir,readFile,writeFile}from"node:fs/promises";import{join}from"node:path";import{resolvePackageCompiledFilePath,resolvePackageSourceFilePath}from"#internal/application/package.js";import{buildPackageUserAgent}from"#internal/user-agent.js";import{sandboxPreparedArtifactsManifestSchema}from"#shared/sandbox-prepared-artifacts.js";import{modelMetadataSchema}from"#internal/model-catalog.js";import{stringifyEsmImportSpecifier}from"#internal/application/import-specifier.js";import{usesParentDevelopmentWorkflowWorld}from"#internal/workflow/development-world-protocol.js";import{prepareAuthoredRuntimeModules}from"#internal/authored-runtime-modules.js";import{readMaterializedAuthoredModuleIndex}from"#internal/materialized-authored-modules.js";import"#internal/instrumentation-layout.js";import{resolveWorkflowWorldImport}from"#internal/workflow/world-target.js";import{BUILD_DEPLOYMENT_ID_PLACEHOLDER}from"#internal/nitro/host/build-deployment-id.js";async function writeCompiledArtifactsFiles(e){let t=join(e.outDir,`compiled-artifacts-bootstrap.mjs`),n=join(e.outDir,`compiled-artifacts-module-map.mjs`),r=join(e.outDir,`compiled-artifacts-instrumentation.mjs`),i=join(e.outDir,`compiled-artifacts-workflow-world.mjs`),a=sandboxPreparedArtifactsManifestSchema.parse(JSON.parse(await readFile(e.compileResult.paths.sandboxPreparedArtifactsPath,`utf8`))),o=modelMetadataSchema.parse(JSON.parse(await readFile(e.compileResult.paths.modelMetadataPath,`utf8`))),s=await prepareAuthoredRuntimeModules({appRoot:e.compileResult.project.appRoot,manifest:e.compileResult.manifest,moduleMapPath:e.compileResult.paths.moduleMapPath});await mkdir(e.outDir,{recursive:!0}),await writeFile(n,s.moduleMapCode),await writeFile(t,createCompiledArtifactsBootstrapSource({compileResult:e.compileResult,installModulePath:resolvePackageSourceFilePath(`src/runtime/loaders/bundled-artifacts.ts`),metadata:e.compileResult.metadata,modelMetadata:o,moduleMapImportPath:n,sandboxPreparedArtifacts:a})),await writeFile(i,createWorkflowWorldPluginSource({compiledArtifactsBootstrapPath:t,configuredWorld:e.compileResult.manifest.config.experimental?.workflow?.world,defaultWorld:e.defaultWorkflowWorld}));let c={authoredWorkflowModules:s.authoredWorkflowModules,bootstrapPath:t,workflowWorldPluginPath:i},l=await writePreparedInstrumentation({instrumentation:s.instrumentation,outDir:e.outDir});return await writeFile(r,createInstrumentationPluginSource({agentName:e.compileResult.manifest.config.name,layout:l})),c.instrumentationPluginPath=r,c.instrumentationLayout=generatedInstrumentationLayout(l),c.instrumentationSourcePaths=instrumentationSourcePathsOf(l),c}async function writePreparedInstrumentation(e){let writeOne=async(t,n)=>{let r=join(e.outDir,`compiled-artifacts-instrumentation-${t}.mjs`);return await writeFile(r,n),r},t={};for(let[n,r]of Object.entries(e.instrumentation.moduleCodeBySlot))t[n]=await writeOne(n,r);return{kind:`directory`,modulePathsBySlot:t}}function instrumentationSourcePathsOf(e){return Object.values(e.modulePathsBySlot)}async function writeDevelopmentCompiledArtifactsFiles(e){let t=join(e.outDir,`compiled-artifacts-bootstrap.mjs`),n=join(e.outDir,`compiled-artifacts-instrumentation.mjs`),r=join(e.outDir,`compiled-artifacts-workflow-world.mjs`),i=await readMaterializedAuthoredModuleIndex(e.runtimeAppRoot);if(i===void 0)throw Error(`Development generation at "${e.runtimeAppRoot}" is not materialized.`);await mkdir(e.outDir,{recursive:!0}),await writeFile(t,createDevelopmentCompiledArtifactsBootstrapSource(e.compileResult.manifest.config.name)),await writeFile(r,createDevelopmentWorkflowWorldPluginSource({compiledArtifactsBootstrapPath:t,configuredWorld:e.compileResult.manifest.config.experimental?.workflow?.world}));let a={authoredWorkflowModules:e.authoredWorkflowModules,bootstrapPath:t,workflowWorldPluginPath:r};if(i.instrumentation!==void 0){let t=await copyMaterializedInstrumentation({instrumentation:i.instrumentation,outDir:e.outDir,runtimeAppRoot:e.runtimeAppRoot});await writeFile(n,createInstrumentationPluginSource({agentName:e.compileResult.manifest.config.name,layout:t})),a.instrumentationPluginPath=n,a.instrumentationLayout=generatedInstrumentationLayout(t),a.instrumentationSourcePaths=instrumentationSourcePathsOf(t)}return a}function generatedInstrumentationLayout(e){return{kind:`directory`,slots:Object.keys(e.modulePathsBySlot)}}async function copyMaterializedInstrumentation(e){let t=join(e.runtimeAppRoot,`.eve`,`compile`),copyOne=async(n,r)=>{let i=join(e.outDir,`compiled-artifacts-instrumentation-${n}.mjs`);return await copyFile(join(t,r),i),i},n={};for(let[t,r]of Object.entries(e.instrumentation.modulePathsBySlot))n[t]=await copyOne(t,r);return{kind:`directory`,modulePathsBySlot:n}}function createDevelopmentCompiledArtifactsBootstrapSource(e){return[`// Generated by eve. Do not edit by hand.`,`import { installEveWorkflowQueueNamespace } from ${stringifyEsmImportSpecifier(resolvePackageSourceFilePath(`src/internal/workflow/queue-namespace.ts`))};`,``,`installEveWorkflowQueueNamespace(${JSON.stringify(e)});`,``,`export default function installDevelopmentCompiledArtifactsPlugin() {}`,``].join(`
2
- `)}function createCompiledArtifactsBootstrapSource(e){let t=e.compileResult.manifest.config.name;return[`// Generated by eve. Do not edit by hand.`,`import moduleMap from ${stringifyEsmImportSpecifier(e.moduleMapImportPath)};`,`import { installBundledCompiledArtifacts } from ${stringifyEsmImportSpecifier(e.installModulePath)};`,`import { installEveWorkflowQueueNamespace } from ${stringifyEsmImportSpecifier(resolvePackageSourceFilePath(`src/internal/workflow/queue-namespace.ts`))};`,``,`installEveWorkflowQueueNamespace(${JSON.stringify(t)});`,``,`const metadata = ${JSON.stringify(e.metadata,null,2)};`,``,`const manifest = ${JSON.stringify(e.compileResult.manifest,null,2)};`,``,`const sandboxPreparedArtifacts = ${JSON.stringify(e.sandboxPreparedArtifacts,null,2)};`,``,`const modelMetadata = ${JSON.stringify(e.modelMetadata)};`,``,`export { moduleMap };`,``,`export function installCompiledArtifactsBootstrap() {`,` installBundledCompiledArtifacts({`,` manifest,`,` metadata,`,` modelMetadata,`,` moduleMap,`,` sandboxPreparedArtifacts,`,` });`,`}`,``,`installCompiledArtifactsBootstrap();`,``,`// Default export satisfies the Nitro plugin contract so this file`,`// can be used directly as a Nitro plugin without a separate wrapper.`,`export default function installCompiledArtifactsPlugin() {`,` // Already installed on import above.`,`}`,``].join(`
1
+ import{copyFile,mkdir,readFile,writeFile}from"node:fs/promises";import{join}from"node:path";import{resolvePackageCompiledFilePath,resolvePackageSourceFilePath}from"#internal/application/package.js";import{buildPackageUserAgent}from"#internal/user-agent.js";import{sandboxPreparedArtifactsManifestSchema}from"#shared/sandbox-prepared-artifacts.js";import{modelMetadataSchema}from"#internal/model-catalog.js";import{stringifyEsmImportSpecifier,stringifyNitroDataImportSpecifier}from"#internal/application/import-specifier.js";import{usesParentDevelopmentWorkflowWorld}from"#internal/workflow/development-world-protocol.js";import{prepareAuthoredRuntimeModules}from"#internal/authored-runtime-modules.js";import{readMaterializedAuthoredModuleIndex}from"#internal/materialized-authored-modules.js";import"#internal/instrumentation-layout.js";import{resolveWorkflowWorldImport}from"#internal/workflow/world-target.js";import{BUILD_DEPLOYMENT_ID_PLACEHOLDER}from"#internal/nitro/host/build-deployment-id.js";async function writeCompiledArtifactsFiles(e){let t=join(e.outDir,`compiled-artifacts-bootstrap.mjs`),n=join(e.outDir,`compiled-artifacts-module-map.mjs`),r=join(e.outDir,`compiled-artifacts-data.json`),i=join(e.outDir,`compiled-artifacts-instrumentation.mjs`),a=join(e.outDir,`compiled-artifacts-workflow-world.mjs`),o=sandboxPreparedArtifactsManifestSchema.parse(JSON.parse(await readFile(e.compileResult.paths.sandboxPreparedArtifactsPath,`utf8`))),s=modelMetadataSchema.parse(JSON.parse(await readFile(e.compileResult.paths.modelMetadataPath,`utf8`))),c=await prepareAuthoredRuntimeModules({appRoot:e.compileResult.project.appRoot,manifest:e.compileResult.manifest,moduleMapPath:e.compileResult.paths.moduleMapPath});await mkdir(e.outDir,{recursive:!0}),await writeFile(n,c.moduleMapCode),await writeFile(r,JSON.stringify({manifest:e.compileResult.manifest,metadata:e.compileResult.metadata,modelMetadata:s,sandboxPreparedArtifacts:o})),await writeFile(t,createCompiledArtifactsBootstrapSource({dataPath:r,installModulePath:resolvePackageSourceFilePath(`src/runtime/loaders/bundled-artifacts.ts`),moduleMapImportPath:n})),await writeFile(a,createWorkflowWorldPluginSource({compiledArtifactsBootstrapPath:t,configuredWorld:e.compileResult.manifest.config.experimental?.workflow?.world,defaultWorld:e.defaultWorkflowWorld}));let l={authoredWorkflowModules:c.authoredWorkflowModules,bootstrapPath:t,workflowWorldPluginPath:a},u=await writePreparedInstrumentation({instrumentation:c.instrumentation,outDir:e.outDir});return await writeFile(i,createInstrumentationPluginSource({agentName:e.compileResult.manifest.config.name,layout:u})),l.instrumentationPluginPath=i,l.instrumentationLayout=generatedInstrumentationLayout(u),l.instrumentationSourcePaths=instrumentationSourcePathsOf(u),l}async function writePreparedInstrumentation(e){let writeOne=async(t,n)=>{let r=join(e.outDir,`compiled-artifacts-instrumentation-${t}.mjs`);return await writeFile(r,n),r},t={};for(let[n,r]of Object.entries(e.instrumentation.moduleCodeBySlot))t[n]=await writeOne(n,r);return{kind:`directory`,modulePathsBySlot:t}}function instrumentationSourcePathsOf(e){return Object.values(e.modulePathsBySlot)}async function writeDevelopmentCompiledArtifactsFiles(e){let t=join(e.outDir,`compiled-artifacts-bootstrap.mjs`),n=join(e.outDir,`compiled-artifacts-instrumentation.mjs`),r=join(e.outDir,`compiled-artifacts-workflow-world.mjs`),i=await readMaterializedAuthoredModuleIndex(e.runtimeAppRoot);if(i===void 0)throw Error(`Development generation at "${e.runtimeAppRoot}" is not materialized.`);await mkdir(e.outDir,{recursive:!0}),await writeFile(t,createDevelopmentCompiledArtifactsBootstrapSource(e.compileResult.manifest.config.name)),await writeFile(r,createDevelopmentWorkflowWorldPluginSource({compiledArtifactsBootstrapPath:t,configuredWorld:e.compileResult.manifest.config.experimental?.workflow?.world}));let a={authoredWorkflowModules:e.authoredWorkflowModules,bootstrapPath:t,workflowWorldPluginPath:r};if(i.instrumentation!==void 0){let t=await copyMaterializedInstrumentation({instrumentation:i.instrumentation,outDir:e.outDir,runtimeAppRoot:e.runtimeAppRoot});await writeFile(n,createInstrumentationPluginSource({agentName:e.compileResult.manifest.config.name,layout:t})),a.instrumentationPluginPath=n,a.instrumentationLayout=generatedInstrumentationLayout(t),a.instrumentationSourcePaths=instrumentationSourcePathsOf(t)}return a}function generatedInstrumentationLayout(e){return{kind:`directory`,slots:Object.keys(e.modulePathsBySlot)}}async function copyMaterializedInstrumentation(e){let t=join(e.runtimeAppRoot,`.eve`,`compile`),copyOne=async(n,r)=>{let i=join(e.outDir,`compiled-artifacts-instrumentation-${n}.mjs`);return await copyFile(join(t,r),i),i},n={};for(let[t,r]of Object.entries(e.instrumentation.modulePathsBySlot))n[t]=await copyOne(t,r);return{kind:`directory`,modulePathsBySlot:n}}function createDevelopmentCompiledArtifactsBootstrapSource(e){return[`// Generated by eve. Do not edit by hand.`,`import { installEveWorkflowQueueNamespace } from ${stringifyEsmImportSpecifier(resolvePackageSourceFilePath(`src/internal/workflow/queue-namespace.ts`))};`,``,`installEveWorkflowQueueNamespace(${JSON.stringify(e)});`,``,`export default function installDevelopmentCompiledArtifactsPlugin() {}`,``].join(`
2
+ `)}function createCompiledArtifactsBootstrapSource(e){return[`// Generated by eve. Do not edit by hand.`,`import data from ${stringifyNitroDataImportSpecifier(`text`,e.dataPath)};`,`import moduleMap from ${stringifyEsmImportSpecifier(e.moduleMapImportPath)};`,`import { installBundledCompiledArtifacts } from ${stringifyEsmImportSpecifier(e.installModulePath)};`,`import { installEveWorkflowQueueNamespace } from ${stringifyEsmImportSpecifier(resolvePackageSourceFilePath(`src/internal/workflow/queue-namespace.ts`))};`,``,`const artifacts = JSON.parse(data);`,`installEveWorkflowQueueNamespace(artifacts.manifest.config.name);`,`installBundledCompiledArtifacts({ ...artifacts, moduleMap });`,``,`// Default export satisfies the Nitro plugin contract so this file`,`// can be used directly as a Nitro plugin without a separate wrapper.`,`export default function installCompiledArtifactsPlugin() {`,` // Already installed on import above.`,`}`,``].join(`
3
3
  `)}function resolveInstallWorldImportSpecifier(){return resolvePackageSourceFilePath(`src/execution/install-workflow-world.ts`)}function resolveWorkflowWorldWiring(e){if(e===`@workflow/world-local`){let t=stringifyEsmImportSpecifier(resolvePackageSourceFilePath(`src/internal/workflow/local-world-data-directory.ts`)),n=stringifyEsmImportSpecifier(resolvePackageSourceFilePath(`src/internal/workflow/local-world-delivery-timeouts.ts`)),r=stringifyEsmImportSpecifier(resolvePackageSourceFilePath(`src/internal/workflow/local-world-delivery-auth.ts`));return{moduleImportSpecifier:resolvePackageCompiledFilePath(`src/compiled/${e}/index.js`),extraImportLines:`
4
4
  import { applyLocalWorkflowWorldDeliveryTimeoutDefaults } from ${n};
5
5
  import { authenticateLocalWorkflowDeliveries } from ${r};
@@ -17,4 +17,4 @@ const workflowWorld = await workflowWorldModule.createWorld({
17
17
  applyVercelWorkflowWorldDefaults(workflowWorld);`.trimStart();return{moduleImportSpecifier:n,extraImportLines:[`import { applyVercelWorkflowWorldDefaults } from ${t};`],createWorldSource:r}}return{moduleImportSpecifier:e,extraImportLines:[`import { createWorldFromModule } from ${stringifyEsmImportSpecifier(resolvePackageCompiledFilePath(`src/compiled/@workflow/core/runtime.js`))};`],createWorldSource:`const workflowWorld = await createWorldFromModule(workflowWorldModule);`}}function createWorkflowWorldPluginSource(e){let t=e.configuredWorld??e.defaultWorld,n=resolveWorkflowWorldWiring(resolveWorkflowWorldImport(t));return[`// Generated by eve. Do not edit by hand.`,`import ${stringifyEsmImportSpecifier(e.compiledArtifactsBootstrapPath)};`,`import * as workflowWorldModule from ${stringifyEsmImportSpecifier(n.moduleImportSpecifier)};`,...n.extraImportLines,`import { installWorkflowWorld } from ${stringifyEsmImportSpecifier(resolveInstallWorldImportSpecifier())};`,`import { installWorkflowDeploymentId } from ${stringifyEsmImportSpecifier(resolvePackageSourceFilePath(`src/execution/install-workflow-deployment-id.ts`))};`,``,`installWorkflowDeploymentId(${JSON.stringify(BUILD_DEPLOYMENT_ID_PLACEHOLDER)});`,n.createWorldSource,`await installWorkflowWorld({ packageName: ${JSON.stringify(e.configuredWorld)}, world: workflowWorld });`,``,`export default function installWorkflowWorldPlugin() {}`,``].join(`
18
18
  `)}function createDevelopmentWorkflowWorldPluginSource(e){if(!usesParentDevelopmentWorkflowWorld(e.configuredWorld))return createWorkflowWorldPluginSource({...e,defaultWorld:`local`});let t=resolvePackageSourceFilePath(`src/internal/workflow/development-world-client.ts`);return[`// Generated by eve. Do not edit by hand.`,`import ${stringifyEsmImportSpecifier(e.compiledArtifactsBootstrapPath)};`,`import { createDevelopmentWorkflowWorld } from ${stringifyEsmImportSpecifier(t)};`,`import { installWorkflowWorld } from ${stringifyEsmImportSpecifier(resolveInstallWorldImportSpecifier())};`,``,`await installWorkflowWorld({ world: createDevelopmentWorkflowWorld() });`,``,`export default function installDevelopmentWorkflowWorldPlugin() {}`,``].join(`
19
19
  `)}function createInstrumentationPluginSource(e){let t=JSON.stringify(e.agentName),n=resolvePackageSourceFilePath(`src/instrumentation/providers.ts`),r=Object.entries(e.layout.modulePathsBySlot);return[`// Generated by eve. Do not edit by hand.`,...r.map(([e,t],n)=>`import * as provider${n} from ${stringifyEsmImportSpecifier(t)}; // ${e}`),`import { finalizeInstrumentationProviders, registerInstrumentationProvider, seedInstrumentationProviders, shutdownInstrumentationProviders } from ${stringifyEsmImportSpecifier(n)};`,``,`seedInstrumentationProviders();`,``,...r.flatMap(([e],n)=>[`await registerInstrumentationProvider({`,` agentName: ${t},`,` slot: ${JSON.stringify(e)},`,` value: provider${n}.default,`,`});`]),``,`finalizeInstrumentationProviders({ serviceName: ${t} });`,``,`// Default export satisfies the Nitro plugin contract so this file`,`// can be used directly as a Nitro plugin without a separate wrapper.`,`export default function installInstrumentationPlugin(nitroApp) {`,` // The last point a buffered exporter can still reach the network.`,` nitroApp?.hooks?.hook('close', async () => {`,` await shutdownInstrumentationProviders();`,` });`,`}`,``].join(`
20
- `)}export{createCompiledArtifactsBootstrapSource,createDevelopmentWorkflowWorldPluginSource,createWorkflowWorldPluginSource,writeCompiledArtifactsFiles,writeDevelopmentCompiledArtifactsFiles};
20
+ `)}export{createDevelopmentWorkflowWorldPluginSource,createWorkflowWorldPluginSource,writeCompiledArtifactsFiles,writeDevelopmentCompiledArtifactsFiles};
@@ -11,6 +11,12 @@ export declare function normalizeEsmImportSpecifier(specifier: string): string;
11
11
  * Serializes an import specifier for direct insertion into generated ESM code.
12
12
  */
13
13
  export declare function stringifyEsmImportSpecifier(specifier: string): string;
14
+ /**
15
+ * Serializes a Nitro `text:` or `bytes:` import of a file for generated ESM.
16
+ * Nitro's `replace` skips these modules, so data loaded through them reaches
17
+ * the bundle exactly as written.
18
+ */
19
+ export declare function stringifyNitroDataImportSpecifier(kind: "bytes" | "text", path: string): string;
14
20
  /**
15
21
  * Rewrites generated ESM source containing raw Windows absolute imports.
16
22
  */
@@ -1 +1 @@
1
- const WINDOWS_DRIVE_ABSOLUTE_PATH_PATTERN=/^\/?[A-Za-z]:[\\/]/,WINDOWS_UNC_ABSOLUTE_PATH_PATTERN=/^\\\\[^\\]/,IMPORT_SPECIFIER_PATTERN=/(\b(?:from|import)\s*(?:\(\s*)?)(["'])([A-Za-z]:[\\/][^"'\n\r]*)\2/g;function isWindowsAbsolutePath(e){return WINDOWS_DRIVE_ABSOLUTE_PATH_PATTERN.test(e)||WINDOWS_UNC_ABSOLUTE_PATH_PATTERN.test(e)}function convertWindowsPathToFileUrl(e){let t=e.replaceAll(`\\`,`/`);return t.startsWith(`//`)?new URL(`file:${t}`).href:(/^\/[A-Za-z]:\//.test(t)&&(t=t.slice(1)),new URL(`file:///${t}`).href)}function splitPathSpecifierSuffix(e){let t=e.indexOf(`?`),n=e.indexOf(`#`),r=t===-1?n:n===-1?t:Math.min(t,n);return r===-1?{path:e,suffix:``}:{path:e.slice(0,r),suffix:e.slice(r)}}function normalizeEsmImportSpecifier(e){if(e.startsWith(`file://`))return e;let{path:t,suffix:n}=splitPathSpecifierSuffix(e);return isWindowsAbsolutePath(t)?`${convertWindowsPathToFileUrl(t)}${n}`:e.replaceAll(`\\`,`/`)}function stringifyEsmImportSpecifier(e){return JSON.stringify(normalizeEsmImportSpecifier(e))}function normalizeGeneratedEsmImportSpecifiers(e){return e.replace(IMPORT_SPECIFIER_PATTERN,(e,t,n,r)=>`${t}${n}${normalizeEsmImportSpecifier(r)}${n}`)}export{normalizeEsmImportSpecifier,normalizeGeneratedEsmImportSpecifiers,stringifyEsmImportSpecifier};
1
+ const WINDOWS_DRIVE_ABSOLUTE_PATH_PATTERN=/^\/?[A-Za-z]:[\\/]/,WINDOWS_UNC_ABSOLUTE_PATH_PATTERN=/^\\\\[^\\]/,IMPORT_SPECIFIER_PATTERN=/(\b(?:from|import)\s*(?:\(\s*)?)(["'])([A-Za-z]:[\\/][^"'\n\r]*)\2/g;function isWindowsAbsolutePath(e){return WINDOWS_DRIVE_ABSOLUTE_PATH_PATTERN.test(e)||WINDOWS_UNC_ABSOLUTE_PATH_PATTERN.test(e)}function convertWindowsPathToFileUrl(e){let t=e.replaceAll(`\\`,`/`);return t.startsWith(`//`)?new URL(`file:${t}`).href:(/^\/[A-Za-z]:\//.test(t)&&(t=t.slice(1)),new URL(`file:///${t}`).href)}function splitPathSpecifierSuffix(e){let t=e.indexOf(`?`),n=e.indexOf(`#`),r=t===-1?n:n===-1?t:Math.min(t,n);return r===-1?{path:e,suffix:``}:{path:e.slice(0,r),suffix:e.slice(r)}}function normalizeEsmImportSpecifier(e){if(e.startsWith(`file://`))return e;let{path:t,suffix:n}=splitPathSpecifierSuffix(e);return isWindowsAbsolutePath(t)?`${convertWindowsPathToFileUrl(t)}${n}`:e.replaceAll(`\\`,`/`)}function stringifyEsmImportSpecifier(e){return JSON.stringify(normalizeEsmImportSpecifier(e))}function stringifyNitroDataImportSpecifier(e,t){return JSON.stringify(`${e}:${t.replaceAll(`\\`,`/`)}`)}function normalizeGeneratedEsmImportSpecifiers(e){return e.replace(IMPORT_SPECIFIER_PATTERN,(e,t,n,r)=>`${t}${n}${normalizeEsmImportSpecifier(r)}${n}`)}export{normalizeEsmImportSpecifier,normalizeGeneratedEsmImportSpecifiers,stringifyEsmImportSpecifier,stringifyNitroDataImportSpecifier};
@@ -10,12 +10,6 @@ export interface ApplicationInfo {
10
10
  * Resolves an application root from the current working directory.
11
11
  */
12
12
  export declare function resolveApplicationRoot(cwd?: string): string;
13
- /**
14
- * Reports whether the current process is running inside a Vercel build or
15
- * deployment. Vercel sets `VERCEL` in both build and runtime environments, so
16
- * this is the canonical signal for "managed by Vercel" versus self-hosted.
17
- */
18
- export declare function isVercelBuildEnvironment(): boolean;
19
13
  /**
20
14
  * Resolves the package-owned Workflow DevKit bundle directory for a target app.
21
15
  *
@@ -25,10 +19,8 @@ export declare function isVercelBuildEnvironment(): boolean;
25
19
  *
26
20
  * Each application root receives a unique hash-keyed subdirectory so parallel
27
21
  * builds targeting different app roots never collide. The key is derived from
28
- * `appRoot` alone — version-keyed dirs are intentionally avoided so every code
29
- * path that resolves a cache directory converges on the same location and
30
- * `prepareEveVersionedCacheDirectory` remains the single source of truth for
31
- * version-based invalidation.
22
+ * `appRoot` alone, so every code path that resolves a cache directory
23
+ * converges on the same location.
32
24
  */
33
25
  export declare function resolveWorkflowBuildDirectory(appRoot: string): string;
34
26
  /**