eve 0.31.2 → 0.32.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +30 -0
- package/dist/src/chunks/{use-eve-agent-CF5D6jSV.js → use-eve-agent-CX87G1vU.js} +30 -5
- package/dist/src/chunks/{use-eve-agent-DbYZLG0h.js → use-eve-agent-DwyRde1N.js} +30 -5
- package/dist/src/cli/commands/integration-connect.d.ts +1 -0
- package/dist/src/cli/commands/integration-connect.js +1 -1
- package/dist/src/cli/commands/integration-setup.d.ts +4 -0
- package/dist/src/cli/commands/integration-setup.js +1 -1
- package/dist/src/cli/commands/register-integration-commands.js +1 -1
- package/dist/src/cli/commands/register-registry-commands.js +1 -1
- package/dist/src/cli/commands/registry-declared-setups.d.ts +23 -0
- package/dist/src/cli/commands/registry-declared-setups.js +1 -0
- package/dist/src/cli/commands/registry-metadata.d.ts +69 -0
- package/dist/src/cli/commands/registry-metadata.js +1 -1
- package/dist/src/cli/commands/registry-package.d.ts +3 -3
- package/dist/src/cli/commands/registry-package.js +1 -1
- package/dist/src/cli/commands/registry-presentation.d.ts +20 -0
- package/dist/src/cli/commands/registry-presentation.js +7 -0
- package/dist/src/cli/commands/registry-search-presentation.d.ts +16 -0
- package/dist/src/cli/commands/registry-search-presentation.js +6 -0
- package/dist/src/cli/commands/registry-setup-command.d.ts +5 -2
- package/dist/src/cli/commands/registry-setup-command.js +1 -2
- package/dist/src/cli/commands/registry.d.ts +16 -7
- package/dist/src/cli/commands/registry.js +1 -6
- package/dist/src/cli/commands/setup-answers.d.ts +2 -0
- package/dist/src/cli/commands/setup-answers.js +1 -0
- package/dist/src/cli/commands/setup-headless.d.ts +79 -0
- package/dist/src/cli/commands/setup-headless.js +1 -0
- package/dist/src/cli/dev/tui/runner.js +1 -1
- package/dist/src/cli/dev/tui/setup-commands.js +3 -3
- package/dist/src/cli/dev/tui/setup-flow.d.ts +8 -1
- package/dist/src/cli/dev/tui/terminal-renderer.js +12 -12
- package/dist/src/cli/dev/tui/traces/trace-conversation.d.ts +1 -1
- package/dist/src/cli/dev/tui/tui-prompter.js +1 -1
- package/dist/src/client/url.d.ts +5 -0
- package/dist/src/client/url.js +1 -1
- package/dist/src/compiled/.vendor-stamp.json +8 -8
- package/dist/src/compiled/@ai-sdk/anthropic/index.d.ts +33 -13
- package/dist/src/compiled/@ai-sdk/anthropic/index.js +4 -2
- package/dist/src/compiled/@ai-sdk/google/index.d.ts +50 -3
- package/dist/src/compiled/@ai-sdk/google/index.js +7 -7
- package/dist/src/compiled/@ai-sdk/mcp/index.d.ts +33 -3
- package/dist/src/compiled/@ai-sdk/mcp/index.js +1 -1
- package/dist/src/compiled/@ai-sdk/openai/index.d.ts +140 -9
- package/dist/src/compiled/@ai-sdk/openai/index.js +9 -6
- package/dist/src/compiled/@ai-sdk/otel/index.js +1 -1
- package/dist/src/compiled/@ai-sdk/provider/index.d.ts +300 -6
- package/dist/src/compiled/@ai-sdk/provider-utils/index.d.ts +70 -20
- package/dist/src/compiled/@opentelemetry/api/index.d.ts +2 -1
- package/dist/src/compiled/@photon-ai/chat-adapter-imessage/index.js +1 -1
- package/dist/src/compiled/@vercel/otel/index.d.ts +6 -0
- package/dist/src/compiled/@vercel/sandbox/index.js +1 -1
- package/dist/src/compiled/_chunks/node/undici-CUIybhQ2.js +95 -0
- package/dist/src/compiled/_chunks/workflow/dist-eUxFublw.js +77 -0
- package/dist/src/compiled/shadcn-registry/index.js +309 -215
- package/dist/src/compiler/extension-compatibility.d.ts +10 -10
- package/dist/src/compiler/extension-compatibility.js +1 -1
- package/dist/src/context/build-callback-context.js +1 -1
- package/dist/src/execution/authorization-callback-match.d.ts +14 -0
- package/dist/src/execution/authorization-callback-match.js +1 -0
- package/dist/src/execution/next-driver-action.d.ts +1 -0
- package/dist/src/execution/parked-delivery-wait.d.ts +16 -1
- package/dist/src/execution/parked-delivery-wait.js +1 -1
- package/dist/src/execution/sandbox/abort-bound-session.d.ts +1 -1
- package/dist/src/execution/sandbox/bindings/docker.js +1 -1
- package/dist/src/execution/sandbox/bindings/just-bash-runtime.js +1 -1
- package/dist/src/execution/sandbox/bindings/microsandbox-lifecycle.js +1 -1
- package/dist/src/execution/sandbox/bindings/microsandbox-runtime.d.ts +1 -0
- package/dist/src/execution/sandbox/bindings/microsandbox-runtime.js +1 -1
- package/dist/src/execution/sandbox/bindings/vercel.js +1 -1
- package/dist/src/execution/sandbox/ensure.js +1 -1
- package/dist/src/execution/session-command-inbox.d.ts +26 -1
- package/dist/src/execution/session-command-inbox.js +1 -1
- package/dist/src/execution/turn-execution-cursor.d.ts +1 -0
- package/dist/src/execution/turn-workflow.js +1 -1
- package/dist/src/execution/workflow-entry.js +1 -1
- package/dist/src/execution/workflow-steps.d.ts +3 -4
- package/dist/src/execution/workflow-steps.js +1 -1
- package/dist/src/harness/authorization.d.ts +24 -11
- package/dist/src/harness/authorization.js +1 -1
- package/dist/src/harness/input-extraction.js +1 -1
- package/dist/src/harness/input-requests.js +1 -1
- package/dist/src/harness/provider-tools.d.ts +1 -1
- package/dist/src/harness/provider-tools.js +1 -1
- package/dist/src/harness/tool-loop.js +2 -2
- package/dist/src/internal/application/package.js +1 -1
- package/dist/src/internal/authored-definition/connection.js +1 -1
- package/dist/src/packages/eve-catalog/src/index.js +1 -1
- package/dist/src/protocol/routes.d.ts +8 -6
- package/dist/src/protocol/routes.js +1 -1
- package/dist/src/public/channels/linear/linearChannel.d.ts +2 -0
- package/dist/src/public/channels/linear/linearChannel.js +1 -1
- package/dist/src/public/channels/linear/verify.js +1 -1
- package/dist/src/public/channels/slack/attachments.js +1 -1
- package/dist/src/public/channels/slack/defaults.js +1 -1
- package/dist/src/public/channels/slack/hitl.d.ts +14 -1
- package/dist/src/public/channels/slack/hitl.js +2 -2
- package/dist/src/public/connections/index.d.ts +1 -0
- package/dist/src/public/definitions/callback-context.d.ts +2 -2
- package/dist/src/public/definitions/connections/mcp.d.ts +9 -0
- package/dist/src/public/definitions/connections/openapi.d.ts +9 -0
- package/dist/src/public/definitions/connections/tool-call.d.ts +21 -0
- package/dist/src/public/definitions/connections/tool-call.js +1 -0
- package/dist/src/public/definitions/sandbox.d.ts +1 -1
- package/dist/src/public/definitions/tool.d.ts +9 -9
- package/dist/src/public/sandbox/index.d.ts +1 -1
- package/dist/src/public/tools/web-search.d.ts +2 -2
- package/dist/src/runtime/connections/callback-route.d.ts +4 -5
- package/dist/src/runtime/connections/callback-route.js +1 -1
- package/dist/src/runtime/connections/mcp-client.js +1 -1
- package/dist/src/runtime/connections/openapi-client.js +1 -1
- package/dist/src/runtime/connections/provided-arguments.d.ts +9 -0
- package/dist/src/runtime/connections/provided-arguments.js +1 -0
- package/dist/src/runtime/connections/scoped-authorization.js +1 -1
- package/dist/src/runtime/framework-tools/connection-search-dynamic.js +2 -2
- package/dist/src/runtime/framework-tools/todo.js +1 -1
- package/dist/src/runtime/input/types.d.ts +1 -4
- package/dist/src/runtime/resolve-connection.js +1 -1
- package/dist/src/runtime/types.d.ts +2 -0
- package/dist/src/sandbox/state.d.ts +1 -0
- package/dist/src/setup/ask-editable.d.ts +22 -0
- package/dist/src/setup/ask-editable.js +1 -0
- package/dist/src/setup/ask-signals.d.ts +23 -0
- package/dist/src/setup/ask-signals.js +1 -0
- package/dist/src/setup/ask.d.ts +24 -25
- package/dist/src/setup/ask.js +1 -1
- package/dist/src/setup/boxes/deploy-project.js +1 -1
- package/dist/src/setup/boxes/resolve-provisioning.js +1 -1
- package/dist/src/setup/connection-connector.js +3 -2
- package/dist/src/setup/flows/registry-session.d.ts +33 -0
- package/dist/src/setup/flows/registry-session.js +1 -0
- package/dist/src/setup/flows/registry.d.ts +16 -0
- package/dist/src/setup/flows/registry.js +1 -1
- package/dist/src/setup/index.js +1 -1
- package/dist/src/setup/integrations/discord/setup.d.ts +19 -7
- package/dist/src/setup/integrations/discord/setup.js +4 -3
- package/dist/src/setup/integrations/github/setup.d.ts +36 -7
- package/dist/src/setup/integrations/github/setup.js +2 -2
- package/dist/src/setup/integrations/linear/setup.d.ts +21 -9
- package/dist/src/setup/integrations/linear/setup.js +2 -2
- package/dist/src/setup/integrations/photon/management.d.ts +8 -1
- package/dist/src/setup/integrations/photon/management.js +1 -1
- package/dist/src/setup/integrations/photon/setup-flow.d.ts +28 -24
- package/dist/src/setup/integrations/photon/setup-flow.js +3 -3
- package/dist/src/setup/integrations/photon/setup.d.ts +1 -3
- package/dist/src/setup/integrations/photon/setup.js +1 -1
- package/dist/src/setup/integrations/registry.d.ts +1 -1
- package/dist/src/setup/integrations/registry.js +1 -1
- package/dist/src/setup/integrations/runner.d.ts +14 -11
- package/dist/src/setup/integrations/runner.js +1 -1
- package/dist/src/setup/integrations/shared/prerequisite.d.ts +17 -0
- package/dist/src/setup/integrations/shared/prerequisite.js +1 -0
- package/dist/src/setup/integrations/shared/ui.d.ts +22 -15
- package/dist/src/setup/integrations/shared/ui.js +2 -2
- package/dist/src/setup/integrations/shared/vercel-project.d.ts +11 -0
- package/dist/src/setup/integrations/shared/vercel-project.js +1 -0
- package/dist/src/setup/integrations/slack/setup.d.ts +25 -10
- package/dist/src/setup/integrations/slack/setup.js +1 -1
- package/dist/src/setup/integrations/types.d.ts +43 -13
- package/dist/src/setup/integrations/types.js +1 -1
- package/dist/src/setup/integrations/web/setup.d.ts +22 -3
- package/dist/src/setup/integrations/web/setup.js +1 -1
- package/dist/src/setup/prompter.d.ts +8 -0
- package/dist/src/setup/question-options.d.ts +15 -0
- package/dist/src/setup/question-options.js +1 -0
- package/dist/src/setup/registry-setup-client.d.ts +3 -4
- package/dist/src/setup/registry-setup-client.js +2 -2
- package/dist/src/setup/registry-setup-completion.d.ts +3 -0
- package/dist/src/setup/registry-setup-completion.js +1 -0
- package/dist/src/setup/registry-setup-protocol.d.ts +22 -3
- package/dist/src/setup/registry-setup-protocol.js +1 -1
- package/dist/src/setup/scaffold/create/add-to-project.js +1 -1
- package/dist/src/setup/scaffold/create/project.js +55 -3
- package/dist/src/setup/scaffold/update/channels.js +1 -1
- package/dist/src/setup/setup-question-wire.d.ts +48 -0
- package/dist/src/setup/setup-question-wire.js +1 -0
- package/dist/src/setup/slackbot.d.ts +5 -1
- package/dist/src/setup/slackbot.js +1 -1
- package/dist/src/setup/state.d.ts +2 -2
- package/dist/src/shared/sandbox-backend.d.ts +6 -0
- package/dist/src/shared/sandbox-session.d.ts +15 -0
- package/dist/src/shared/tool-definition.d.ts +2 -2
- package/dist/src/shared/tool-schema.d.ts +5 -4
- package/dist/src/shared/tool-schema.js +1 -1
- package/dist/src/svelte/index.js +1 -1
- package/dist/src/svelte/use-eve-agent.js +1 -1
- package/dist/src/tracing/agent-otel-provider.d.ts +5 -38
- package/dist/src/tracing/agent-otel-provider.js +2 -2
- package/dist/src/tracing/agent-span-id-generator.d.ts +15 -0
- package/dist/src/tracing/agent-span-id-generator.js +1 -0
- package/dist/src/tracing/agent-trace-context-store.d.ts +1 -1
- package/dist/src/tracing/agent-trace-context-store.js +1 -1
- package/dist/src/tracing/agent-trace-state.d.ts +41 -0
- package/dist/src/tracing/agent-trace-state.js +1 -0
- package/dist/src/tracing/local-instrumentation-runtime.js +1 -1
- package/dist/src/vue/index.js +1 -1
- package/dist/src/vue/use-eve-agent.js +1 -1
- package/docs/channels/chat-sdk.mdx +1 -1
- package/docs/channels/github.mdx +1 -1
- package/docs/channels/linear.mdx +4 -2
- package/docs/channels/overview.mdx +2 -2
- package/docs/channels/slack.mdx +154 -40
- package/docs/concepts/default-harness.md +3 -3
- package/docs/concepts/sessions-runs-and-streaming.md +1 -1
- package/docs/connections/mcp.mdx +35 -1
- package/docs/connections/openapi.mdx +24 -0
- package/docs/guides/dev-tui.md +58 -142
- package/docs/guides/dynamic-workflows.md +2 -0
- package/docs/guides/frontend/overview.mdx +4 -2
- package/docs/guides/hooks.md +25 -3
- package/docs/guides/session-context.md +18 -0
- package/docs/install-integrations.mdx +2 -0
- package/docs/reference/cli.md +5 -3
- package/docs/reference/typescript-api.md +1 -1
- package/docs/sandbox.mdx +25 -5
- package/docs/skills.mdx +12 -1
- package/docs/subagents.mdx +1 -1
- package/docs/tools/human-in-the-loop.md +1 -1
- package/docs/tutorial/ship-it.mdx +1 -1
- package/package.json +10 -10
- package/dist/src/compiled/_chunks/node/undici-DWL_MYmT.js +0 -95
- package/dist/src/compiled/_chunks/workflow/dist-CZxNEvEs.js +0 -79
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,35 @@
|
|
|
1
1
|
# eve
|
|
2
2
|
|
|
3
|
+
## 0.32.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- 1702f91: Tool approval responses now use `cancel` instead of `deny`, while retaining `approve` for the positive response, aligning the public protocol with the user-facing flow-control semantics.
|
|
8
|
+
- cbe7105: Allow authored hooks, tools, and channel callbacks to stop their active sandbox through `ctx.getSandbox().stop()`. Every built-in backend preserves the durable session for a later callback, and custom sandbox backend handles must now implement `stop()`.
|
|
9
|
+
|
|
10
|
+
### Patch Changes
|
|
11
|
+
|
|
12
|
+
- ea530ec: Update `eve add` to better support agent-based invocation of guided setup flows. Interactive setup links a Vercel project when needed; after each deployable setup, `/add` offers to add more by default, deploy to production, or finish.
|
|
13
|
+
- a29cc8e: Update the bundled AI SDK to 7.0.58 and the `@ai-sdk/*` providers to their latest minors.
|
|
14
|
+
- 39c76ca: AI Gateway models now use Exa by default for the built-in `web_search` tool. Agents can continue to select Parallel explicitly with `webSearch({ provider: "parallel" })`.
|
|
15
|
+
- 261af74: Photon setup now shows an existing project's dedicated number when available, rather than allocating and showing a shared fallback number.
|
|
16
|
+
- 55b5cc7: Teach newly scaffolded coding agents to discover integrations and follow the structured `eve add --headless` setup flow through completion.
|
|
17
|
+
- 91cca9a: Slack now posts tool input previews separately from approval controls so large inputs no longer inflate button callbacks and approvals remain responsive.
|
|
18
|
+
- 50f2d96: Conversation sessions no longer stall while an interactive authorization challenge is open: ordinary messages run as normal turns, while tasks defer unrelated input until their blocked authorization completes. Callbacks are bound to the exact challenge attempt and initiating connection principal, remain live across parked activity, and start a valid callback turn after the authorization park closes its boundary. Session timeouts are also honored during an open challenge, and `client.fetch` preserves query strings embedded in the request path.
|
|
19
|
+
- 7449917: Stop completed and cancelled todo lists from being re-injected as user messages after compaction. Lists that still contain active work continue to be preserved in full.
|
|
20
|
+
- 63a76f0: Local traces now record `agent.turn` with the turn's real duration instead of a zero-duration marker, and the separate `agent.turn.terminal` marker span is gone — terminal and transition events land on the turn span itself. `agent.session` window roots remain zero-duration markers because an idle session never closes.
|
|
21
|
+
- a159596: Export telemetry for every step of multi-step turns when an OpenTelemetry consumer groups spans by completed local segments.
|
|
22
|
+
- e1080e0: Reject HTML sign-in pages returned by Slack private file downloads and explain how to restore attachment access.
|
|
23
|
+
- 52000dd: Build tool input schemas authored with Zod 3 instead of crashing during JSON Schema conversion.
|
|
24
|
+
- f06e12e: Add a structured `eve add --non-interactive` flow with stable setup answers, component selection, and resumable setup blockers for coding agents.
|
|
25
|
+
|
|
26
|
+
## 0.31.3
|
|
27
|
+
|
|
28
|
+
### Patch Changes
|
|
29
|
+
|
|
30
|
+
- 0dbe7ef: Add `toolCall.providedArguments` to MCP and OpenAPI connections so applications can hide and supply application-owned arguments on every remote tool call.
|
|
31
|
+
- 53c05ff: Allow Linear channels to configure the accepted webhook timestamp skew for retry deliveries.
|
|
32
|
+
|
|
3
33
|
## 0.31.2
|
|
4
34
|
|
|
5
35
|
### Patch Changes
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { computed, onScopeDispose, shallowRef } from "vue";
|
|
2
2
|
import { z } from "#compiled/zod/index.js";
|
|
3
|
+
import { asSchema } from "ai";
|
|
3
4
|
|
|
4
5
|
//#region src/protocol/routes.ts
|
|
5
6
|
const EVE_ROUTE_PREFIX = "/eve/v1";
|
|
@@ -17,7 +18,8 @@ const EVE_DEV_RUNTIME_ARTIFACTS_ROUTE_PATH = `${EVE_ROUTE_PREFIX}/dev/runtime-ar
|
|
|
17
18
|
const EVE_DEV_RUNTIME_ARTIFACTS_REBUILD_ROUTE_PATH = `${EVE_DEV_RUNTIME_ARTIFACTS_ROUTE_PATH}/rebuild`;
|
|
18
19
|
const EVE_DEV_RUNTIME_ARTIFACTS_SUSPEND_ROUTE_PATH = `${EVE_DEV_RUNTIME_ARTIFACTS_ROUTE_PATH}/suspend`;
|
|
19
20
|
const EVE_DEV_RUNTIME_ARTIFACTS_RESUME_ROUTE_PATH = `${EVE_DEV_RUNTIME_ARTIFACTS_ROUTE_PATH}/resume`;
|
|
20
|
-
const EVE_CONNECTION_CALLBACK_ROUTE_PATTERN = `${EVE_ROUTE_PREFIX}/connections/:name/callback/:token`;
|
|
21
|
+
const EVE_CONNECTION_CALLBACK_ROUTE_PATTERN = `${EVE_ROUTE_PREFIX}/connections/:name/callback/:attemptId/:token`;
|
|
22
|
+
const EVE_LEGACY_CONNECTION_CALLBACK_ROUTE_PATTERN = `${EVE_ROUTE_PREFIX}/connections/:name/callback/:token`;
|
|
21
23
|
const EVE_CALLBACK_ROUTE_PATTERN = `${EVE_ROUTE_PREFIX}/callback/:token`;
|
|
22
24
|
function createEveSessionRoutePath(sessionId) {
|
|
23
25
|
return `${EVE_SESSION_ROUTE_PATH}/${encodeURIComponent(sessionId)}`;
|
|
@@ -503,19 +505,28 @@ async function* readNdjsonStream(body) {
|
|
|
503
505
|
//#endregion
|
|
504
506
|
//#region src/client/url.ts
|
|
505
507
|
function createClientUrl(host, routePath, searchParams) {
|
|
506
|
-
const
|
|
508
|
+
const queryIndex = routePath.indexOf("?");
|
|
509
|
+
const pathOnly = queryIndex === -1 ? routePath : routePath.slice(0, queryIndex);
|
|
510
|
+
const embeddedQuery = queryIndex === -1 ? "" : routePath.slice(queryIndex + 1);
|
|
511
|
+
const normalizedRoute = pathOnly.startsWith("/") ? pathOnly : `/${pathOnly}`;
|
|
507
512
|
if (isAbsoluteUrl(host)) {
|
|
508
513
|
const url = new URL(host);
|
|
509
514
|
url.pathname = `${trimTrailingSlash(url.pathname)}${normalizedRoute}`;
|
|
515
|
+
mergeEmbeddedQuery(url.searchParams, embeddedQuery);
|
|
510
516
|
mergeSearchParams(url.searchParams, searchParams);
|
|
511
517
|
url.hash = "";
|
|
512
518
|
return url.toString();
|
|
513
519
|
}
|
|
514
520
|
const url = new URL(host, "http://eve.local");
|
|
515
521
|
const basePath = trimTrailingSlash(url.pathname);
|
|
522
|
+
mergeEmbeddedQuery(url.searchParams, embeddedQuery);
|
|
516
523
|
mergeSearchParams(url.searchParams, searchParams);
|
|
517
524
|
return `${basePath}${normalizedRoute}${formatSearch(url.searchParams)}`;
|
|
518
525
|
}
|
|
526
|
+
function mergeEmbeddedQuery(target, embeddedQuery) {
|
|
527
|
+
if (embeddedQuery.length === 0) return;
|
|
528
|
+
for (const [name, value] of new URLSearchParams(embeddedQuery)) target.append(name, value);
|
|
529
|
+
}
|
|
519
530
|
function isAbsoluteUrl(value) {
|
|
520
531
|
return /^[a-z][a-z\d+\-.]*:/i.test(value);
|
|
521
532
|
}
|
|
@@ -888,11 +899,25 @@ function serializeSchema(source, direction) {
|
|
|
888
899
|
return toJsonObject(source, direction);
|
|
889
900
|
}
|
|
890
901
|
function toJsonObject(source, direction) {
|
|
891
|
-
const
|
|
902
|
+
const standard = getStandardSchemaProperties(source);
|
|
903
|
+
const jsonSchema = standard?.jsonSchema;
|
|
904
|
+
const emit = typeof jsonSchema === "object" && jsonSchema !== null ? jsonSchema[direction] : void 0;
|
|
905
|
+
const vendor = typeof standard?.vendor === "string" ? standard.vendor : "unknown";
|
|
906
|
+
if (standard !== void 0 && typeof emit !== "function" && vendor === "zod") {
|
|
907
|
+
if (direction === "input") {
|
|
908
|
+
const { $schema: _schemaVersion, ...canonical } = parseJsonObject(asSchema(source).jsonSchema);
|
|
909
|
+
return canonical;
|
|
910
|
+
}
|
|
911
|
+
throw new Error("Zod 3 cannot emit an output JSON Schema. Upgrade to Zod 4 or provide a plain JSON Schema object.");
|
|
912
|
+
}
|
|
913
|
+
if (standard !== void 0 && typeof emit !== "function") throw new Error(`Standard Schema vendor "${vendor}" does not support JSON Schema conversion. Provide a Standard Schema implementation with JSON Schema conversion or a plain JSON Schema object.`);
|
|
914
|
+
const { $schema: _schemaVersion, ...canonical } = standard === void 0 ? parseJsonObject(source) : parseJsonObject(emit({ target: JSON_SCHEMA_TARGET }));
|
|
892
915
|
return canonical;
|
|
893
916
|
}
|
|
894
|
-
function
|
|
895
|
-
|
|
917
|
+
function getStandardSchemaProperties(value) {
|
|
918
|
+
if (typeof value !== "object" || value === null || !("~standard" in value)) return void 0;
|
|
919
|
+
const standard = value["~standard"];
|
|
920
|
+
return typeof standard === "object" && standard !== null ? standard : void 0;
|
|
896
921
|
}
|
|
897
922
|
|
|
898
923
|
//#endregion
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { createSubscriber } from "svelte/reactivity";
|
|
2
2
|
import { z } from "#compiled/zod/index.js";
|
|
3
|
+
import { asSchema } from "ai";
|
|
3
4
|
|
|
4
5
|
//#region src/protocol/routes.ts
|
|
5
6
|
const EVE_ROUTE_PREFIX = "/eve/v1";
|
|
@@ -17,7 +18,8 @@ const EVE_DEV_RUNTIME_ARTIFACTS_ROUTE_PATH = `${EVE_ROUTE_PREFIX}/dev/runtime-ar
|
|
|
17
18
|
const EVE_DEV_RUNTIME_ARTIFACTS_REBUILD_ROUTE_PATH = `${EVE_DEV_RUNTIME_ARTIFACTS_ROUTE_PATH}/rebuild`;
|
|
18
19
|
const EVE_DEV_RUNTIME_ARTIFACTS_SUSPEND_ROUTE_PATH = `${EVE_DEV_RUNTIME_ARTIFACTS_ROUTE_PATH}/suspend`;
|
|
19
20
|
const EVE_DEV_RUNTIME_ARTIFACTS_RESUME_ROUTE_PATH = `${EVE_DEV_RUNTIME_ARTIFACTS_ROUTE_PATH}/resume`;
|
|
20
|
-
const EVE_CONNECTION_CALLBACK_ROUTE_PATTERN = `${EVE_ROUTE_PREFIX}/connections/:name/callback/:token`;
|
|
21
|
+
const EVE_CONNECTION_CALLBACK_ROUTE_PATTERN = `${EVE_ROUTE_PREFIX}/connections/:name/callback/:attemptId/:token`;
|
|
22
|
+
const EVE_LEGACY_CONNECTION_CALLBACK_ROUTE_PATTERN = `${EVE_ROUTE_PREFIX}/connections/:name/callback/:token`;
|
|
21
23
|
const EVE_CALLBACK_ROUTE_PATTERN = `${EVE_ROUTE_PREFIX}/callback/:token`;
|
|
22
24
|
function createEveSessionRoutePath(sessionId) {
|
|
23
25
|
return `${EVE_SESSION_ROUTE_PATH}/${encodeURIComponent(sessionId)}`;
|
|
@@ -503,19 +505,28 @@ async function* readNdjsonStream(body) {
|
|
|
503
505
|
//#endregion
|
|
504
506
|
//#region src/client/url.ts
|
|
505
507
|
function createClientUrl(host, routePath, searchParams) {
|
|
506
|
-
const
|
|
508
|
+
const queryIndex = routePath.indexOf("?");
|
|
509
|
+
const pathOnly = queryIndex === -1 ? routePath : routePath.slice(0, queryIndex);
|
|
510
|
+
const embeddedQuery = queryIndex === -1 ? "" : routePath.slice(queryIndex + 1);
|
|
511
|
+
const normalizedRoute = pathOnly.startsWith("/") ? pathOnly : `/${pathOnly}`;
|
|
507
512
|
if (isAbsoluteUrl(host)) {
|
|
508
513
|
const url = new URL(host);
|
|
509
514
|
url.pathname = `${trimTrailingSlash(url.pathname)}${normalizedRoute}`;
|
|
515
|
+
mergeEmbeddedQuery(url.searchParams, embeddedQuery);
|
|
510
516
|
mergeSearchParams(url.searchParams, searchParams);
|
|
511
517
|
url.hash = "";
|
|
512
518
|
return url.toString();
|
|
513
519
|
}
|
|
514
520
|
const url = new URL(host, "http://eve.local");
|
|
515
521
|
const basePath = trimTrailingSlash(url.pathname);
|
|
522
|
+
mergeEmbeddedQuery(url.searchParams, embeddedQuery);
|
|
516
523
|
mergeSearchParams(url.searchParams, searchParams);
|
|
517
524
|
return `${basePath}${normalizedRoute}${formatSearch(url.searchParams)}`;
|
|
518
525
|
}
|
|
526
|
+
function mergeEmbeddedQuery(target, embeddedQuery) {
|
|
527
|
+
if (embeddedQuery.length === 0) return;
|
|
528
|
+
for (const [name, value] of new URLSearchParams(embeddedQuery)) target.append(name, value);
|
|
529
|
+
}
|
|
519
530
|
function isAbsoluteUrl(value) {
|
|
520
531
|
return /^[a-z][a-z\d+\-.]*:/i.test(value);
|
|
521
532
|
}
|
|
@@ -888,11 +899,25 @@ function serializeSchema(source, direction) {
|
|
|
888
899
|
return toJsonObject(source, direction);
|
|
889
900
|
}
|
|
890
901
|
function toJsonObject(source, direction) {
|
|
891
|
-
const
|
|
902
|
+
const standard = getStandardSchemaProperties(source);
|
|
903
|
+
const jsonSchema = standard?.jsonSchema;
|
|
904
|
+
const emit = typeof jsonSchema === "object" && jsonSchema !== null ? jsonSchema[direction] : void 0;
|
|
905
|
+
const vendor = typeof standard?.vendor === "string" ? standard.vendor : "unknown";
|
|
906
|
+
if (standard !== void 0 && typeof emit !== "function" && vendor === "zod") {
|
|
907
|
+
if (direction === "input") {
|
|
908
|
+
const { $schema: _schemaVersion, ...canonical } = parseJsonObject(asSchema(source).jsonSchema);
|
|
909
|
+
return canonical;
|
|
910
|
+
}
|
|
911
|
+
throw new Error("Zod 3 cannot emit an output JSON Schema. Upgrade to Zod 4 or provide a plain JSON Schema object.");
|
|
912
|
+
}
|
|
913
|
+
if (standard !== void 0 && typeof emit !== "function") throw new Error(`Standard Schema vendor "${vendor}" does not support JSON Schema conversion. Provide a Standard Schema implementation with JSON Schema conversion or a plain JSON Schema object.`);
|
|
914
|
+
const { $schema: _schemaVersion, ...canonical } = standard === void 0 ? parseJsonObject(source) : parseJsonObject(emit({ target: JSON_SCHEMA_TARGET }));
|
|
892
915
|
return canonical;
|
|
893
916
|
}
|
|
894
|
-
function
|
|
895
|
-
|
|
917
|
+
function getStandardSchemaProperties(value) {
|
|
918
|
+
if (typeof value !== "object" || value === null || !("~standard" in value)) return void 0;
|
|
919
|
+
const standard = value["~standard"];
|
|
920
|
+
return typeof standard === "object" && standard !== null ? standard : void 0;
|
|
896
921
|
}
|
|
897
922
|
|
|
898
923
|
//#endregion
|
|
@@ -5,6 +5,7 @@ import { type Prompter } from "#setup/prompter.js";
|
|
|
5
5
|
import { updateConnectionConnectorUid } from "#setup/scaffold/update/update-connection-connector.js";
|
|
6
6
|
import type { RegistryCommandLogger } from "./registry.js";
|
|
7
7
|
export interface IntegrationConnectOptions {
|
|
8
|
+
nonInteractive?: boolean;
|
|
8
9
|
signal?: AbortSignal;
|
|
9
10
|
}
|
|
10
11
|
export interface IntegrationConnectDependencies {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{NOT_AN_AGENT_MESSAGE}from"./preconditions.js";import{join}from"node:path";import{isEveProject}from"#setup/scaffold/index.js";import{createPrompter}from"#setup/prompter.js";import{cleanupCreatedConnectionConnector,setupConnectionConnector}from"#setup/connection-connector.js";import{runLinkFlow}from"#setup/flows/link.js";import{readProjectLink}from"#setup/project-resolution.js";import{createRegistrySetupClient}from"#setup/registry-setup-client.js";import{updateConnectionConnectorUid}from"#setup/scaffold/update/update-connection-connector.js";const defaultDependencies={readProjectLink,runLinkFlow,setupConnectionConnector,cleanupCreatedConnectionConnector,updateConnectionConnectorUid};async function runIntegrationConnect(e){let
|
|
1
|
+
import{NOT_AN_AGENT_MESSAGE}from"./preconditions.js";import{serializeHeadlessSetupEvent}from"./setup-headless.js";import{join}from"node:path";import{isEveProject}from"#setup/scaffold/index.js";import{createPrompter}from"#setup/prompter.js";import{cleanupCreatedConnectionConnector,setupConnectionConnector}from"#setup/connection-connector.js";import{runLinkFlow}from"#setup/flows/link.js";import{createHeadlessPrompter}from"#setup/headless.js";import{SetupPrerequisiteRequired}from"#setup/integrations/shared/prerequisite.js";import{resolveIntegrationVercelProject}from"#setup/integrations/shared/vercel-project.js";import{readProjectLink}from"#setup/project-resolution.js";import{createRegistrySetupClient}from"#setup/registry-setup-client.js";import{updateConnectionConnectorUid}from"#setup/scaffold/update/update-connection-connector.js";const defaultDependencies={readProjectLink,runLinkFlow,setupConnectionConnector,cleanupCreatedConnectionConnector,updateConnectionConnectorUid};async function runIntegrationConnect(e){let t={...defaultDependencies,...e.dependencies},r=e.options?.nonInteractive===!0,i=t.createPrompter?.()??(r?createHeadlessPrompter(()=>{}):createPrompter()),a=e.options?.signal;i.intro(`Set up ${e.slug}`);let o=await t.readProjectLink(e.appRoot);if(o===void 0)if(r)o=await resolveIntegrationVercelProject({appRoot:e.appRoot,integration:e.slug,signal:a,deps:{readProjectLink:t.readProjectLink}});else{if((await t.runLinkFlow({appRoot:e.appRoot,prompter:i,signal:a,projectSelection:`create-or-link`,teamSelectMessage:()=>`You need to link to a project to use ${e.slug} through Vercel Connect.\n\nSelect your team`,deps:t.linkFlowDeps})).kind===`cancelled`)return;if(o=await t.readProjectLink(e.appRoot),o===void 0)throw Error(`Project link was not found after linking.`)}let s={log:i.log,prompter:i,projectRoot:e.appRoot,slug:e.slug,service:e.service,canonicalConnectorName:e.canonicalConnectorName??e.slug,project:o,signal:a},l=await t.setupConnectionConnector(s),u=join(e.appRoot,`agent`,`connections`,`${e.slug}.ts`);if(!(await t.updateConnectionConnectorUid(u,l.connectorUid)).patched)throw l.kind===`created`&&await t.cleanupCreatedConnectionConnector({log:i.log,projectRoot:e.appRoot,connectorId:l.connectorId,orgId:o.orgId}),Error(`Could not update the connector in agent/connections/${e.slug}.ts.`);i.outro(`Connection ${e.slug} set up.`)}async function runIntegrationConnectCommand(n,i,a,o,c,l={},d=defaultDependencies){if(!await isEveProject(i)){n.error(NOT_AN_AGENT_MESSAGE),process.exitCode=1;return}let f=createRegistrySetupClient({signal:l.signal});try{await runIntegrationConnect({appRoot:i,slug:a,service:o,canonicalConnectorName:c,options:l,dependencies:{...d,createPrompter:()=>f?.prompter??(l.nonInteractive?createHeadlessPrompter(()=>{}):d.createPrompter?.()??createPrompter())}}),f?.complete()}catch(e){if(f?.fail(e),f!==void 0)return;if(l.nonInteractive&&e instanceof SetupPrerequisiteRequired){n.error(serializeHeadlessSetupEvent({version:1,type:`blocked`,status:`prerequisite_required`,prerequisite:e.prerequisite})),process.exitCode=2;return}n.error(e instanceof Error?e.message:String(e)),process.exitCode=1}}export{runIntegrationConnect,runIntegrationConnectCommand};
|
|
@@ -1,13 +1,17 @@
|
|
|
1
1
|
import { type Prompter } from "#setup/prompter.js";
|
|
2
|
+
import { type SetupProcess } from "#setup/registry-setup-client.js";
|
|
2
3
|
import { type IntegrationSetupRunnerDeps } from "#setup/integrations/runner.js";
|
|
3
4
|
import type { RegistryCommandLogger } from "./registry.js";
|
|
4
5
|
export interface IntegrationSetupOptions {
|
|
5
6
|
yes?: boolean;
|
|
7
|
+
nonInteractive?: boolean;
|
|
8
|
+
answers?: Record<string, unknown>;
|
|
6
9
|
signal?: AbortSignal;
|
|
7
10
|
}
|
|
8
11
|
export interface IntegrationSetupDependencies {
|
|
9
12
|
createPrompter?: () => Prompter;
|
|
10
13
|
runnerDeps?: IntegrationSetupRunnerDeps;
|
|
14
|
+
setupProcess?: SetupProcess;
|
|
11
15
|
}
|
|
12
16
|
/** Runs built-in integration setup after its registry payload is installed. */
|
|
13
17
|
export declare function runIntegrationSetupCommand(logger: RegistryCommandLogger, appRoot: string, kind: string, options?: IntegrationSetupOptions, dependencies?: IntegrationSetupDependencies): Promise<void>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{NOT_AN_AGENT_MESSAGE}from"./preconditions.js";import{isEveProject}from"#setup/scaffold/index.js";import{createPrompter}from"#setup/prompter.js";import{createRegistrySetupClient}from"#setup/registry-setup-client.js";import{runIntegrationSetup}from"#setup/integrations/runner.js";const defaultIntegrationSetupDependencies={};async function runIntegrationSetupCommand(
|
|
1
|
+
import{NOT_AN_AGENT_MESSAGE}from"./preconditions.js";import{serializeHeadlessSetupEvent}from"./setup-headless.js";import{isEveProject}from"#setup/scaffold/index.js";import{createPrompter}from"#setup/prompter.js";import{createHeadlessPrompter}from"#setup/headless.js";import{SetupPrerequisiteRequired}from"#setup/integrations/shared/prerequisite.js";import{createRegistrySetupClient}from"#setup/registry-setup-client.js";import{InteractionRequired,InvalidAnswerError,headlessAsker,interactiveAsker,withAnswers,withPolicy}from"#setup/ask.js";import{ensureVercelProject}from"#setup/flows/ensure-vercel-project.js";import{runIntegrationSetup}from"#setup/integrations/runner.js";import{setupQuestionToWire}from"#setup/setup-question-wire.js";const defaultIntegrationSetupDependencies={};async function runIntegrationSetupCommand(a,o,s,c={},l=defaultIntegrationSetupDependencies){if(!await isEveProject(o)){a.error(NOT_AN_AGENT_MESSAGE),process.exitCode=1;return}let u=createRegistrySetupClient({process:l.setupProcess,signal:c.signal});try{let e=c.nonInteractive===!0,t=u?.prompter??l.createPrompter?.()??(e?createHeadlessPrompter(()=>{}):createPrompter()),n=e?headlessAsker():interactiveAsker(t),r=c.yes?withPolicy(`assume`)(n):n,i=await runIntegrationSetup(s,{appRoot:o,prompter:t,asker:withAnswers(c.answers??{})(r),resolveVercelProject:e?void 0:()=>ensureVercelProject({appRoot:o,prompter:t,signal:u?.signal??c.signal}),signal:u?.signal??c.signal,beginExternalAction:e?e=>{let t=`external-action-${crypto.randomUUID()}`;return a.log(serializeHeadlessSetupEvent({version:1,type:`external_action`,id:t,blocking:!0,...e})),{complete(){a.log(serializeHeadlessSetupEvent({version:1,type:`external_action_resolved`,id:t}))}}}:void 0},l.runnerDeps);if(i.kind===`cancelled`){u?.cancel(),process.env.EVE_SETUP===`1`?process.exitCode=130:e&&a.error(serializeHeadlessSetupEvent({version:1,type:`cancelled`,item:s}));return}t.outro(`Integration set up.`),u?.complete(i.completion),e&&u===void 0&&a.log(serializeHeadlessSetupEvent({version:1,type:`completed`,item:s}))}catch(e){if(u?.fail(e),u!==void 0)return;c.nonInteractive&&e instanceof InteractionRequired?(a.error(serializeHeadlessSetupEvent({version:1,type:`blocked`,status:`input_required`,question:setupQuestionToWire(e.question)})),process.exitCode=2):c.nonInteractive&&e instanceof InvalidAnswerError?(a.error(serializeHeadlessSetupEvent({version:1,type:`blocked`,status:`input_required`,question:setupQuestionToWire(e.question),issue:{code:`invalid_answer`,message:e.message}})),process.exitCode=2):c.nonInteractive&&e instanceof SetupPrerequisiteRequired?(a.error(serializeHeadlessSetupEvent({version:1,type:`blocked`,status:`prerequisite_required`,prerequisite:e.prerequisite})),process.exitCode=2):(a.error(e instanceof Error?e.message:String(e)),process.exitCode=1)}}export{runIntegrationSetupCommand};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
function registerIntegrationCommands(
|
|
1
|
+
import{parseSetupAnswer}from"./setup-answers.js";function registerIntegrationCommands(t){let{appRoot:n,logger:r,program:i}=t,a=i.command(`integration`,{hidden:!0});a.command(`setup <kind>`).option(`-y, --yes`).option(`--non-interactive`,`Run without interactive prompts, instead emit structured NDJSON when further input is required`).option(`--answer <key=value>`,`Answer a setup question; requires --non-interactive.`,parseSetupAnswer,{}).action(async(e,t)=>{let{runIntegrationSetupCommand:i}=await import(`./integration-setup.js`);await i(r,n,e,{yes:t.yes,nonInteractive:t.nonInteractive,answers:t.answer})}),a.command(`connect <slug> <service> [canonical-name]`).option(`-y, --yes`).option(`--non-interactive`,`Run without interactive prompts, instead emit structured NDJSON when further input is required`).action(async(e,t,i,a)=>{let{runIntegrationConnectCommand:o}=await import(`./integration-connect.js`);await o(r,n,e,t,i,a)})}export{registerIntegrationCommands};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{InvalidArgumentError}from"#compiled/commander/index.js";function parseSearchLimit(
|
|
1
|
+
import{parseSetupAnswer}from"./setup-answers.js";import{InvalidArgumentError}from"#compiled/commander/index.js";function parseSearchLimit(e){if(!/^\d+$/u.test(e))throw new InvalidArgumentError(`Expected a positive integer, received "${e}".`);let n=Number(e);if(n<1||n>100)throw new InvalidArgumentError(`Expected a limit between 1 and 100, received "${e}".`);return n}function registerRegistryCommands(n){let{appRoot:r,logger:i,program:a}=n;a.command(`add <item>`).description(`Install a registry item; relative paths use the official eve registry.`).option(`-o, --overwrite`,`Overwrite existing files.`).option(`--skip-install`,`Run the item's setup flow without installing it.`).option(`--skip-setup`,`Skip the item's setup flow.`).option(`--non-interactive`,`Run without interactive prompts, instead emit structured NDJSON when further input is required`).option(`--answer <key=value>`,`Answer a setup question with JSON; requires --non-interactive; repeat for multiple answers.`,parseSetupAnswer).option(`-y, --yes`,`Run setup and accept its recommended defaults.`).action(async(e,n)=>{if(n.answer!==void 0&&!n.nonInteractive)throw new InvalidArgumentError(`--answer requires --non-interactive.`);let{runAddCommand:a}=await import(`./registry.js`);await a(i,r,e,{...n,answers:n.answer})});let o=a.command(`registry`).description(`Configure and browse extension and agent registry catalogs.`);o.command(`add <registries...>`).description(`Add registry namespace mappings to package.json.`).action(async e=>{let{runRegistryAddCommand:t}=await import(`./registry.js`);await t(i,r,e)}),o.command(`list`).description(`List items from all registries or one source.`).option(`-r, --registry <source>`,`List items from one registry.`).option(`--json`,`Output as JSON`).action(async e=>{let{runRegistryListCommand:t}=await import(`./registry.js`);await t(i,r,e.registry,e)}),o.command(`search <query>`).description(`Search all registries or one source.`).option(`-r, --registry <source>`,`Search one registry.`).option(`--limit <count>`,`Maximum results to return (default: 10).`,parseSearchLimit,10).option(`--json`,`Output as JSON`).action(async(e,t)=>{let{runRegistrySearchCommand:n}=await import(`./registry.js`);await n(i,r,e,t.registry,t)}),o.command(`view <item>`).description(`Inspect one registry item.`).option(`--json`,`Output the raw registry item as JSON.`).action(async(e,t)=>{let{runRegistryViewCommand:n}=await import(`./registry.js`);await n(i,r,e,t)})}export{registerRegistryCommands};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { type Prompter } from "#setup/prompter.js";
|
|
2
|
+
import type { RegistrySetupCompletion } from "#setup/registry-setup-protocol.js";
|
|
3
|
+
import type { RegistryCommandLogger, RegistrySetupDependencies } from "./registry.js";
|
|
4
|
+
import type { RegistrySetupCommand } from "./registry-setup-command.js";
|
|
5
|
+
export interface DeclaredSetupOptions {
|
|
6
|
+
yes?: boolean;
|
|
7
|
+
nonInteractive?: boolean;
|
|
8
|
+
answers?: Record<string, unknown>;
|
|
9
|
+
silent?: boolean;
|
|
10
|
+
prompter?: Prompter;
|
|
11
|
+
signal?: AbortSignal;
|
|
12
|
+
}
|
|
13
|
+
/** Runs and combines the setup commands declared by one registry item. */
|
|
14
|
+
export declare function runDeclaredSetups(input: {
|
|
15
|
+
logger: RegistryCommandLogger;
|
|
16
|
+
appRoot: string;
|
|
17
|
+
item: string;
|
|
18
|
+
setups: readonly RegistrySetupCommand[] | undefined;
|
|
19
|
+
options: DeclaredSetupOptions;
|
|
20
|
+
dependencies: RegistrySetupDependencies;
|
|
21
|
+
cancelledReminder: string;
|
|
22
|
+
resumeCommand: string;
|
|
23
|
+
}): Promise<RegistrySetupCompletion | false>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{headlessSetupContinuation,serializeHeadlessSetupEvent}from"./setup-headless.js";import{createPrompter}from"#setup/prompter.js";import{createHeadlessPrompter}from"#setup/headless.js";import{mergeRegistrySetupCompletions}from"#setup/registry-setup-completion.js";async function runDeclaredSetups(i){let a={facts:[]};if(i.setups===void 0)return a;let o=await i.dependencies.loadSetupCommandRunner(),s=i.options.prompter??(i.options.nonInteractive?createHeadlessPrompter(i.logger.log):createPrompter());try{for(let n of i.setups){let r=await o(i.appRoot,{...n,args:[...n.args,...i.options.yes?[`--yes`]:[],...i.options.nonInteractive?[`--non-interactive`]:[],...Object.entries(i.options.answers??{}).flatMap(([e,t])=>[`--answer`,`${e}=${JSON.stringify(t)}`])]},i.item,{prompter:s,signal:i.options.signal});if(r.kind===`cancelled`)return i.logger.log(i.cancelledReminder),!1;if(r.kind===`blocked`){if(!i.options.nonInteractive)throw Error(`Setup requires more input.`);return i.logger.error(serializeHeadlessSetupEvent({version:1,type:`blocked`,item:i.item,installed:!0,completedItems:[],...r.blocker,next:headlessSetupContinuation({item:i.item,installed:!0})})),process.exitCode=2,!1}if(i.options.silent!==!0)for(let e of r.facts)i.logger.log(`${e.label}: ${e.value}`);a=mergeRegistrySetupCompletions(a,r)}return a}catch(n){let r=n instanceof Error?n.message:String(n);if(i.options.nonInteractive)return i.logger.error(serializeHeadlessSetupEvent({version:1,type:`failed`,item:i.item,completedItems:[],message:r,next:headlessSetupContinuation({item:i.item,installed:!0})})),process.exitCode=1,!1;throw Error(`${r} Try again with \`${i.resumeCommand}\`.`)}}export{runDeclaredSetups};
|
|
@@ -1,6 +1,45 @@
|
|
|
1
|
+
import { z } from "#compiled/zod/index.js";
|
|
2
|
+
declare const EveRegistryMetadataSchema: z.ZodObject<{
|
|
3
|
+
requires: z.ZodOptional<z.ZodString>;
|
|
4
|
+
docs: z.ZodOptional<z.ZodString>;
|
|
5
|
+
implementation: z.ZodOptional<z.ZodEnum<{
|
|
6
|
+
"chat-sdk": "chat-sdk";
|
|
7
|
+
native: "native";
|
|
8
|
+
}>>;
|
|
9
|
+
setup: z.ZodOptional<z.ZodPipe<z.ZodUnion<readonly [z.ZodObject<{
|
|
10
|
+
package: z.ZodString;
|
|
11
|
+
bin: z.ZodString;
|
|
12
|
+
args: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
13
|
+
}, z.core.$strip>, z.ZodArray<z.ZodObject<{
|
|
14
|
+
package: z.ZodString;
|
|
15
|
+
bin: z.ZodString;
|
|
16
|
+
args: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
17
|
+
}, z.core.$strip>>]>, z.ZodTransform<{
|
|
18
|
+
package: string;
|
|
19
|
+
bin: string;
|
|
20
|
+
args: string[];
|
|
21
|
+
}[], {
|
|
22
|
+
package: string;
|
|
23
|
+
bin: string;
|
|
24
|
+
args: string[];
|
|
25
|
+
}[] | {
|
|
26
|
+
package: string;
|
|
27
|
+
bin: string;
|
|
28
|
+
args: string[];
|
|
29
|
+
}>>>;
|
|
30
|
+
components: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
31
|
+
item: z.ZodString;
|
|
32
|
+
label: z.ZodString;
|
|
33
|
+
description: z.ZodOptional<z.ZodString>;
|
|
34
|
+
default: z.ZodDefault<z.ZodBoolean>;
|
|
35
|
+
}, z.core.$strip>>>;
|
|
36
|
+
}, z.core.$strip>;
|
|
37
|
+
export type RegistrySearchMetadata = Pick<z.infer<typeof EveRegistryMetadataSchema>, "docs" | "implementation">;
|
|
1
38
|
/** Parses eve-owned metadata from a registry item manifest. */
|
|
2
39
|
export declare function eveMetadataFromRegistryItem(item: unknown): {
|
|
3
40
|
requires?: string | undefined;
|
|
41
|
+
docs?: string | undefined;
|
|
42
|
+
implementation?: "chat-sdk" | "native" | undefined;
|
|
4
43
|
setup?: {
|
|
5
44
|
package: string;
|
|
6
45
|
bin: string;
|
|
@@ -13,3 +52,33 @@ export declare function eveMetadataFromRegistryItem(item: unknown): {
|
|
|
13
52
|
default: boolean;
|
|
14
53
|
}[] | undefined;
|
|
15
54
|
} | undefined;
|
|
55
|
+
/** Extracts search metadata from the eve-owned official registry catalog. */
|
|
56
|
+
export declare function parseOfficialRegistrySearchMetadata(input: unknown): ReadonlyMap<string, RegistrySearchMetadata>;
|
|
57
|
+
/** Parses the fields used by the human-readable registry item view. */
|
|
58
|
+
export declare function parseRegistryPresentationManifest(input: unknown): {
|
|
59
|
+
meta?: {
|
|
60
|
+
eve?: {
|
|
61
|
+
requires?: string | undefined;
|
|
62
|
+
docs?: string | undefined;
|
|
63
|
+
implementation?: "chat-sdk" | "native" | undefined;
|
|
64
|
+
setup?: {
|
|
65
|
+
package: string;
|
|
66
|
+
bin: string;
|
|
67
|
+
args: string[];
|
|
68
|
+
}[] | undefined;
|
|
69
|
+
components?: {
|
|
70
|
+
item: string;
|
|
71
|
+
label: string;
|
|
72
|
+
description?: string | undefined;
|
|
73
|
+
default: boolean;
|
|
74
|
+
}[] | undefined;
|
|
75
|
+
} | undefined;
|
|
76
|
+
} | undefined;
|
|
77
|
+
title?: string | undefined;
|
|
78
|
+
description?: string | undefined;
|
|
79
|
+
dependencies?: string[] | undefined;
|
|
80
|
+
files?: {
|
|
81
|
+
target: string;
|
|
82
|
+
}[] | undefined;
|
|
83
|
+
} | undefined;
|
|
84
|
+
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{RegistryPackageComponentSchema}from"./registry-package.js";import{z}from"#compiled/zod/index.js";const RegistrySetupSchema=z.object({package:z.string().min(1),bin:z.string().min(1),args:z.array(z.string()).default([])}),
|
|
1
|
+
import{RegistryPackageComponentSchema}from"./registry-package.js";import{z}from"#compiled/zod/index.js";const RegistrySetupSchema=z.object({package:z.string().min(1),bin:z.string().min(1),args:z.array(z.string()).default([])}),EveRegistryMetadataSchema=z.object({requires:z.string().optional(),docs:z.string().min(1).optional(),implementation:z.enum([`native`,`chat-sdk`]).optional(),setup:z.union([RegistrySetupSchema,z.array(RegistrySetupSchema).min(1)]).transform(e=>Array.isArray(e)?e:[e]).optional(),components:z.array(RegistryPackageComponentSchema).min(1).optional()}),EveRegistryItemMetadataSchema=z.object({meta:z.object({eve:EveRegistryMetadataSchema.optional()}).optional()}),OfficialRegistryCatalogSchema=z.object({items:z.array(z.object({name:z.string().min(1),meta:z.object({eve:EveRegistryMetadataSchema.optional()}).optional()}))}),RegistryPresentationManifestSchema=EveRegistryItemMetadataSchema.extend({title:z.string().optional(),description:z.string().optional(),dependencies:z.array(z.string()).optional(),files:z.array(z.object({target:z.string()})).optional()});function eveMetadataFromRegistryItem(e){return EveRegistryItemMetadataSchema.parse(e).meta?.eve}function parseOfficialRegistrySearchMetadata(e){let{items:t}=OfficialRegistryCatalogSchema.parse(e),n=new Map;for(let e of t){let{docs:t,implementation:r}=e.meta?.eve??{};(t!==void 0||r!==void 0)&&n.set(e.name,{docs:t,implementation:r})}return n}function parseRegistryPresentationManifest(e){return RegistryPresentationManifestSchema.safeParse(e).data}export{eveMetadataFromRegistryItem,parseOfficialRegistrySearchMetadata,parseRegistryPresentationManifest};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { type RegistryConfig } from "#compiled/shadcn-registry/index.js";
|
|
2
2
|
import { z } from "#compiled/zod/index.js";
|
|
3
3
|
import { type Prompter } from "#setup/prompter.js";
|
|
4
|
+
import type { RegistrySetupCompletion } from "#setup/registry-setup-protocol.js";
|
|
4
5
|
import type { AddCommandOptions, RegistryCommandLogger } from "./registry.js";
|
|
5
6
|
import type { RegistrySetupCommand } from "./registry-setup-command.js";
|
|
6
7
|
export declare const RegistryPackageComponentSchema: z.ZodObject<{
|
|
@@ -26,10 +27,9 @@ export interface RegistryPackageOperations {
|
|
|
26
27
|
item: string;
|
|
27
28
|
setups: RegistrySetupCommand[];
|
|
28
29
|
prompter: Prompter;
|
|
29
|
-
}): Promise<
|
|
30
|
+
}): Promise<RegistrySetupCompletion | false>;
|
|
30
31
|
setupReminder(item: string): string;
|
|
31
32
|
}
|
|
32
|
-
/** Resolves, installs, and configures the selected components of a registry package. */
|
|
33
33
|
export declare function runRegistryPackage(input: {
|
|
34
34
|
logger: RegistryCommandLogger;
|
|
35
35
|
appRoot: string;
|
|
@@ -42,5 +42,5 @@ export declare function runRegistryPackage(input: {
|
|
|
42
42
|
};
|
|
43
43
|
dependencies: RegistryPackageDependencies;
|
|
44
44
|
operations: RegistryPackageOperations;
|
|
45
|
-
}): Promise<
|
|
45
|
+
}): Promise<RegistrySetupCompletion | false>;
|
|
46
46
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{hasInteractiveTerminal}from"./preconditions.js";import{z}from"#compiled/zod/index.js";import{createPrompter}from"#setup/prompter.js";import{addRegistryItems,getRegistryItems}from"#compiled/shadcn-registry/index.js";const RegistryPackageComponentSchema=z.object({item:z.string().min(1),label:z.string().min(1),description:z.string().optional(),default:z.boolean().default(!1)});async function selectComponents(e,
|
|
1
|
+
import{hasInteractiveTerminal}from"./preconditions.js";import{headlessSetupContinuation,serializeHeadlessSetupEvent}from"./setup-headless.js";import{z}from"#compiled/zod/index.js";import{createPrompter}from"#setup/prompter.js";import{headlessAsker,interactiveAsker,withAnswers,withPolicy}from"#setup/ask.js";import{mergeRegistrySetupCompletions}from"#setup/registry-setup-completion.js";import{addRegistryItems,getRegistryItems}from"#compiled/shadcn-registry/index.js";const RegistryPackageComponentSchema=z.object({item:z.string().min(1),label:z.string().min(1),description:z.string().optional(),default:z.boolean().default(!1)});async function selectComponents(e,r,i,l,u,d){if(l.prompter===void 0&&!l.nonInteractive&&(l.yes===!0||!u))return i.filter(e=>e.default);let f={key:`components`,message:`Add ${r}`,required:!0,recommended:i.filter(e=>e.default),options:i.map(e=>({id:e.item,value:e,label:e.label,hint:e.description}))},p=l.nonInteractive?withAnswers(l.answers??{})(l.yes?withPolicy(`assume`)(headlessAsker()):headlessAsker()):interactiveAsker(d());try{return await p.askMany(f)}catch(i){if(!l.nonInteractive||!(i instanceof Error)||i.name!==`InteractionRequired`)throw i;let a=i.question,{setupQuestionToWire:o}=await import(`#setup/setup-question-wire.js`);e.error(serializeHeadlessSetupEvent({version:1,type:`blocked`,status:`input_required`,item:r,installed:!1,completedItems:[],question:o(a),next:headlessSetupContinuation({item:r,installed:!1})})),process.exitCode=2;return}}async function runRegistryPackage(t){let{logger:n,appRoot:r,item:a,components:o,config:s,options:c,dependencies:f,operations:p}=t,m=f.hasInteractiveTerminal?.()??hasInteractiveTerminal(),h=c.prompter,getPrompter=()=>h??=f.createPrompter?.()??createPrompter(),g=await selectComponents(n,a,o,c,m,getPrompter);if(g===void 0)return!1;let _=g.map(e=>p.itemAddress(e.item)),v=await getRegistryItems(_,{config:s});if(v.length!==g.length)throw Error(`Registry package "${a}" could not resolve all selected components.`);let y=v.map(e=>{let t=p.metadata(e);return p.assertCompatibleVersion(t?.requires),t});c.skipInstall!==!0&&await addRegistryItems(_,{config:s,cwd:r,overwrite:c.overwrite,silent:c.silent});let b={facts:[]};if(c.skipSetup===!0)return b;if(!c.nonInteractive&&c.yes!==!0&&c.prompter===void 0&&!m)return n.log(p.setupReminder(a)),b;for(let e of y){if(e?.setup===void 0)continue;let t=await p.runSetups({item:a,setups:e.setup,prompter:getPrompter()});if(t===!1)return!1;b=mergeRegistrySetupCompletions(b,t)}return b}export{RegistryPackageComponentSchema,runRegistryPackage};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { RegistrySearchItem } from "#compiled/shadcn-registry/index.js";
|
|
2
|
+
import { type RegistrySearchMetadata } from "./registry-metadata.js";
|
|
3
|
+
export interface RegistrySearchPresentationItem extends RegistrySearchMetadata {
|
|
4
|
+
address: string;
|
|
5
|
+
item: RegistrySearchItem;
|
|
6
|
+
}
|
|
7
|
+
export interface RegistrySearchPresentationSection {
|
|
8
|
+
label: string;
|
|
9
|
+
items: RegistrySearchPresentationItem[];
|
|
10
|
+
total: number;
|
|
11
|
+
}
|
|
12
|
+
export declare function normalizeRegistryText(value: string): string;
|
|
13
|
+
export declare function printRegistrySearchResults(logger: {
|
|
14
|
+
log(message: string): void;
|
|
15
|
+
}, input: {
|
|
16
|
+
json?: unknown;
|
|
17
|
+
query: string | undefined;
|
|
18
|
+
sections: readonly RegistrySearchPresentationSection[];
|
|
19
|
+
}): void;
|
|
20
|
+
export declare function registryViewText(item: string, input: unknown): string;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import{parseRegistryPresentationManifest}from"./registry-metadata.js";import{createCliTheme,sanitizeForTerminal}from"#cli/ui/output.js";import{clipVisible,wrapVisibleLine}from"#cli/ui/terminal-text.js";function normalizeRegistryText(e){return sanitizeForTerminal(e).replaceAll(`\\"`,`"`).replaceAll(`\\'`,`'`).replaceAll(/\s+/gu,` `).trim()}function registryDescriptionSummary(e){let t=normalizeRegistryText(e);return t.match(/^.*?[.!?](?=\s|$)/u)?.[0]??t}function renderSearchItem(e,t,n){let a=Math.max(1,t-4),o=wrapVisibleLine(normalizeRegistryText(e.address),a),s=e.implementation===`native`?`First-class eve channel`:e.implementation===`chat-sdk`?`Chat SDK adapter`:void 0,c=normalizeRegistryText(e.item.name),l=c.split(`/`).at(-1)??c,u=[` ${n.label(l)}${s===void 0?``:n.muted(` · ${s}`)}`,...o.map(e=>` ${e}`)];if(!e.item.description)return u.join(`
|
|
2
|
+
`);let d=registryDescriptionSummary(e.item.description);if(d.length===0)return u.join(`
|
|
3
|
+
`);let f=wrapVisibleLine(d,a),p=f.length<=2?f:[f[0],`${clipVisible(f[1],Math.max(1,a-1)).trimEnd()}…`];return u.push(...p.map(e=>n.muted(` ${e}`))),u.join(`
|
|
4
|
+
`)}function printRegistrySearchResults(e,n){if(n.json!==void 0){e.log(JSON.stringify(n.json,null,2));return}if(n.sections.every(e=>e.items.length===0)){let t=n.query&&normalizeRegistryText(n.query);e.log(t?`No registry items match "${t}".`:`No registry items found.`);return}let r=createCliTheme(),i=Math.max(20,process.stdout.columns??80),a=n.sections.flatMap(e=>{if(e.items.length===0)return[];let t=`${e.total} result${e.total===1?``:`s`}`,n=e.items.length<e.total?`showing ${e.items.length} of ${t}`:t;return[[`${r.label(e.label)} ${r.muted(`(${n})`)}`,...e.items.map(e=>renderSearchItem(e,i,r))].join(`
|
|
5
|
+
`)]});e.log(a.join(`
|
|
6
|
+
`))}function registryViewText(t,n){let r=parseRegistryPresentationManifest(n);if(r===void 0)return JSON.stringify(n,null,2);let i=r.meta?.eve,a=[r.title??t,t];if(r.description!==void 0&&a.push(``,r.description),i?.implementation!==void 0&&a.push(``,`Implementation ${i.implementation===`native`?`First-class eve channel`:`Chat SDK adapter`}`),i?.setup!==void 0&&a.push(`Setup Guided setup`),i?.docs!==void 0){let e=i.docs.startsWith(`/`)?`https://eve.dev${i.docs}`:i.docs;a.push(`Documentation ${e}`)}a.push(`Source Official eve registry`),r.dependencies?.length&&a.push(``,`Packages`,...r.dependencies.map(e=>` ${e}`));let o=r.files?.map(e=>e.target)??[];return o.length>0&&a.push(``,`Files`,...o.map(e=>` ${e}`)),a.join(`
|
|
7
|
+
`)}export{normalizeRegistryText,printRegistrySearchResults,registryViewText};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { RegistrySearchItem } from "#compiled/shadcn-registry/index.js";
|
|
2
|
+
export declare function normalizeRegistryText(value: string): string;
|
|
3
|
+
export declare function printRegistrySearchResults(logger: {
|
|
4
|
+
log(message: string): void;
|
|
5
|
+
}, result: {
|
|
6
|
+
items: RegistrySearchItem[];
|
|
7
|
+
}, options: {
|
|
8
|
+
json?: boolean;
|
|
9
|
+
query: string | undefined;
|
|
10
|
+
sections: readonly {
|
|
11
|
+
label: string;
|
|
12
|
+
items: RegistrySearchItem[];
|
|
13
|
+
total: number;
|
|
14
|
+
address(item: RegistrySearchItem): string;
|
|
15
|
+
}[];
|
|
16
|
+
}): void;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import{createCliTheme,sanitizeForTerminal}from"#cli/ui/output.js";import{clipVisible,wrapVisibleLine}from"#cli/ui/terminal-text.js";function normalizeRegistryText(e){return sanitizeForTerminal(e).replaceAll(`\\"`,`"`).replaceAll(`\\'`,`'`).replaceAll(/\s+/gu,` `).trim()}function registryDescriptionSummary(e){let t=normalizeRegistryText(e);return t.match(/^.*?[.!?](?=\s|$)/u)?.[0]??t}function renderSearchItem(e,t,i,a){let o=Math.max(1,i-4),s=wrapVisibleLine(normalizeRegistryText(t),o),c=normalizeRegistryText(e.name),l=c.split(`/`).at(-1)??c,u=[` ${a.label(l)}`,...s.map(e=>` ${e}`)];if(!e.description)return u.join(`
|
|
2
|
+
`);let d=registryDescriptionSummary(e.description);if(d.length===0)return u.join(`
|
|
3
|
+
`);let f=wrapVisibleLine(d,o),p=f.length<=2?f:[f[0],`${clipVisible(f[1],Math.max(1,o-1)).trimEnd()}…`];return u.push(...p.map(e=>a.muted(` ${e}`))),u.join(`
|
|
4
|
+
`)}function printRegistrySearchResults(t,n,r){if(r.json){t.log(JSON.stringify(n,null,2));return}if(n.items.length===0){let e=r.query&&normalizeRegistryText(r.query);t.log(e?`No registry items match "${e}".`:`No registry items found.`);return}let i=createCliTheme(),a=Math.max(20,process.stdout.columns??80),o=r.sections.flatMap(e=>{if(e.items.length===0)return[];let t=`${e.total} result${e.total===1?``:`s`}`,n=e.items.length<e.total?`showing ${e.items.length} of ${t}`:t;return[[`${i.label(e.label)} ${i.muted(`(${n})`)}`,...e.items.map(t=>renderSearchItem(t,e.address(t),a,i))].join(`
|
|
5
|
+
`)]});t.log(o.join(`
|
|
6
|
+
`))}export{normalizeRegistryText,printRegistrySearchResults};
|
|
@@ -1,12 +1,15 @@
|
|
|
1
1
|
import type { Prompter } from "#setup/prompter.js";
|
|
2
|
+
import { type RegistrySetupCompletion, type RegistrySetupBlocker } from "#setup/registry-setup-protocol.js";
|
|
2
3
|
export interface RegistrySetupCommand {
|
|
3
4
|
package: string;
|
|
4
5
|
bin: string;
|
|
5
6
|
args: string[];
|
|
6
7
|
}
|
|
7
|
-
export type RegistrySetupCommandResult = {
|
|
8
|
+
export type RegistrySetupCommandResult = ({
|
|
8
9
|
kind: "completed";
|
|
9
|
-
|
|
10
|
+
} & RegistrySetupCompletion) | {
|
|
11
|
+
kind: "blocked";
|
|
12
|
+
blocker: RegistrySetupBlocker;
|
|
10
13
|
} | {
|
|
11
14
|
kind: "cancelled";
|
|
12
15
|
};
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
import{findPackageJSON}from"node:module";import{readFile}from"node:fs/promises";import{z}from"#compiled/zod/index.js";import{dirname,isAbsolute,relative,resolve}from"node:path";import{spawn}from"node:child_process";import{WizardCancelledError}from"#setup/step.js";import{pathToFileURL}from"node:url";import{createProcessOutputBuffer}from"#setup/primitives/process-output.js";import{REGISTRY_SETUP_PROTOCOL_VERSION,isRegistrySetupChildMessage}from"#setup/registry-setup-protocol.js";const PackageJsonSchema=z.object({name:z.string().min(1),bin:z.union([z.string(),z.record(z.string(),z.string())]).optional()});function declaredBinPath(e,t){return typeof e.bin==`string`?t===e.name.slice(e.name.lastIndexOf(`/`)+1)?e.bin:void 0:e.bin?.[t]}async function resolveNodePackageBin(e,n){let s=dirname(e),c=PackageJsonSchema.parse(JSON.parse(await readFile(e,`utf8`))),l=declaredBinPath(c,n);if(l===void 0)throw Error(`Package "${c.name}" does not declare a "${n}" binary.`);let u=resolve(s,l),d=relative(s,u);if(d.startsWith(`..`)||isAbsolute(d))throw Error(`Package "${c.name}" declares its "${n}" binary outside the package directory.`);return u}function send(e,t){e.connected&&e.send(t)}async function answerPrompt(e,t,n,r){try{let i,a=n.prompt;switch(a.kind){case`text`:i=await t.text(a);break;case`password`:i=await t.password(a);break;case`select`:i=(a.options.multiple,await t.select(a.options));break;case`editable-select`:i=t.selectEditable===void 0?{kind:`selected`,value:await t.select(a.options)}:await t.selectEditable({...a.options,editable:{...a.options.editable,formatHint:e=>e}});break;case`acknowledge`:await t.acknowledge?.(a.options);break;case`choice`:{if(t.awaitChoice===void 0){i=await t.select({message:a.options.context,options:[...a.options.actions]});break}let e=t.awaitChoice(a.options);r.set(n.id,e.close);try{i=await e.choice}finally{r.delete(n.id)}break}}send(e,{type:`prompt-result`,id:n.id,value:i})}catch(t){if(t instanceof WizardCancelledError){send(e,{type:`prompt-result`,id:n.id,cancelled:!0});return}throw t}}function handlePresentation(e,t,n,r){switch(n.type){case`log`:return t.log[n.level](n.text),!0;case`note`:return t.note(n.message,n.title,{tone:n.tone}),!0;case`intro`:return t.intro(n.text,n.subtitle),!0;case`outro`:return t.outro(n.text),!0;case`result`:return!1;case`status`:if(r.get(n.id)?.(),r.delete(n.id),n.status!==void 0){let e=t.log.spinner?.(n.status);e!==void 0&&r.set(n.id,()=>e.stop())}return!0;case`close-prompt`:return r.get(n.id)?.(),r.delete(n.id),!0;case`prompt`:return answerPrompt(e,t,n,r).catch(t=>{terminateChild(e,`SIGTERM`),e.emit(`error`,t)}),!0;case`ready`:return!1}}async function runRegistrySetupCommand(t,n,r,i){let a=findPackageJSON(n.package,pathToFileURL(resolve(t,`package.json`)));if(a===void 0)throw Error(`Setup package "${n.package}" is not installed. Run \`eve add ${r}\` first.`);let c=await resolveNodePackageBin(a,n.bin);if(i===void 0)throw Error(`Registry setup commands require a parent prompter.`);return new Promise((e,a)=>{let o=spawn(process.execPath,[c,...n.args],{cwd:t,env:{...process.env,EVE_SETUP:`1`,EVE_SETUP_ITEM:r,EVE_SETUP_PROTOCOL:String(REGISTRY_SETUP_PROTOCOL_VERSION)},stdio:[`ignore`,`pipe`,`pipe`,`ipc`],detached:process.platform!==`win32`}),l=!1,f=!1,p,m=new Map,h=createProcessOutputBuffer(({text:e})=>i.prompter.log.commandOutput(e));o.stdout?.on(`data`,e=>h.write(`stdout`,e)),o.stderr?.on(`data`,e=>h.write(`stderr`,e));let g,cancel=()=>{send(o,{type:`cancel`}),g=setTimeout(()=>terminateChild(o,`SIGTERM`),3e3),g.unref()};i.signal?.addEventListener(`abort`,cancel,{once:!0});let cleanup=()=>{h.flush(),i.signal?.removeEventListener(`abort`,cancel),g!==void 0&&clearTimeout(g);for(let e of m.values())e();m.clear()};o.on(`message`,e=>{if(!isRegistrySetupChildMessage(e)){cancel(),a(Error(`Setup command sent an invalid registry protocol message.`));return}if(e.type===`ready`){if(e.version!==REGISTRY_SETUP_PROTOCOL_VERSION){cancel(),a(Error(`Setup command does not support registry setup protocol v${REGISTRY_SETUP_PROTOCOL_VERSION}.`));return}f=!0;return}if(e.type===`result`){p=e.outcome;return}handlePresentation(o,i.prompter,e,m)}),o.once(`error`,e=>{cleanup(),a(e)}),o.once(`close`,(t,n)=>{if(cleanup(),!l){if(l=!0,p?.kind===`completed`){if(t!==0){a(Error(`Setup command reported success, then exited with code ${t??`unknown`}.`));return}
|
|
2
|
-
`)}`:``;a(Error(`${p.error.message}${e}`));return}if(i.signal?.aborted===!0||t===130||n===`SIGINT`){e({kind:`cancelled`});return}if(t===0&&f){a(Error(`Setup command exited without reporting a result.`));return}a(Error(n===null?`Setup command exited with code ${t??`unknown`} before reporting a result.`:`Setup command was terminated by ${n} before reporting a result.`))}})})}function terminateChild(e,t){if(process.platform!==`win32`&&e.pid!==void 0)try{process.kill(-e.pid,t);return}catch{}e.kill(t)}export{runRegistrySetupCommand};
|
|
1
|
+
import{findPackageJSON}from"node:module";import{readFile}from"node:fs/promises";import{z}from"#compiled/zod/index.js";import{dirname,isAbsolute,relative,resolve}from"node:path";import{spawn}from"node:child_process";import{WizardCancelledError}from"#setup/step.js";import{pathToFileURL}from"node:url";import{createProcessOutputBuffer}from"#setup/primitives/process-output.js";import{REGISTRY_SETUP_PROTOCOL_VERSION,isRegistrySetupChildMessage}from"#setup/registry-setup-protocol.js";const PackageJsonSchema=z.object({name:z.string().min(1),bin:z.union([z.string(),z.record(z.string(),z.string())]).optional()});function declaredBinPath(e,t){return typeof e.bin==`string`?t===e.name.slice(e.name.lastIndexOf(`/`)+1)?e.bin:void 0:e.bin?.[t]}async function resolveNodePackageBin(e,n){let s=dirname(e),c=PackageJsonSchema.parse(JSON.parse(await readFile(e,`utf8`))),l=declaredBinPath(c,n);if(l===void 0)throw Error(`Package "${c.name}" does not declare a "${n}" binary.`);let u=resolve(s,l),d=relative(s,u);if(d.startsWith(`..`)||isAbsolute(d))throw Error(`Package "${c.name}" declares its "${n}" binary outside the package directory.`);return u}function send(e,t){e.connected&&e.send(t)}async function answerPrompt(e,t,n,r){try{let i,a=n.prompt;switch(a.kind){case`text`:i=await t.text(a);break;case`password`:i=await t.password(a);break;case`select`:i=(a.options.multiple,await t.select(a.options));break;case`editable-select`:i=t.selectEditable===void 0?{kind:`selected`,value:await t.select(a.options)}:await t.selectEditable({...a.options,editable:{...a.options.editable,formatHint:e=>e}});break;case`acknowledge`:await t.acknowledge?.(a.options);break;case`choice`:{if(t.awaitChoice===void 0){i=await t.select({message:a.options.context,options:[...a.options.actions]});break}let e=t.awaitChoice(a.options);r.set(n.id,e.close);try{i=await e.choice}finally{r.delete(n.id)}break}}send(e,{type:`prompt-result`,id:n.id,value:i})}catch(t){if(t instanceof WizardCancelledError){send(e,{type:`prompt-result`,id:n.id,cancelled:!0});return}throw t}}function handlePresentation(e,t,n,r){switch(n.type){case`log`:return(t.replaceContent===void 0||n.level===`warning`||n.level===`error`||n.level===`commandOutput`)&&t.log[n.level](n.text),!0;case`note`:return(t.replaceContent===void 0||n.tone===`warning`)&&t.note(n.message,n.title,{tone:n.tone}),!0;case`intro`:return t.intro(n.text,n.subtitle),!0;case`outro`:return t.outro(n.text),!0;case`result`:return!1;case`status`:if(r.get(n.id)?.(),r.delete(n.id),n.status!==void 0){let e=t.log.spinner?.(n.status);e!==void 0&&r.set(n.id,()=>e.stop())}return!0;case`close-prompt`:return r.get(n.id)?.(),r.delete(n.id),!0;case`prompt`:return answerPrompt(e,t,n,r).catch(t=>{terminateChild(e,`SIGTERM`),e.emit(`error`,t)}),!0;case`ready`:return!1}}async function runRegistrySetupCommand(t,n,r,i){let a=findPackageJSON(n.package,pathToFileURL(resolve(t,`package.json`)));if(a===void 0)throw Error(`Setup package "${n.package}" is not installed. Run \`eve add ${r}\` first.`);let c=await resolveNodePackageBin(a,n.bin);if(i===void 0)throw Error(`Registry setup commands require a parent prompter.`);return new Promise((e,a)=>{let o=spawn(process.execPath,[c,...n.args],{cwd:t,env:{...process.env,EVE_SETUP:`1`,EVE_SETUP_ITEM:r,EVE_SETUP_PROTOCOL:String(REGISTRY_SETUP_PROTOCOL_VERSION)},stdio:[`ignore`,`pipe`,`pipe`,`ipc`],detached:process.platform!==`win32`}),l=!1,f=!1,p,m=new Map,h=createProcessOutputBuffer(({text:e})=>i.prompter.log.commandOutput(e));o.stdout?.on(`data`,e=>h.write(`stdout`,e)),o.stderr?.on(`data`,e=>h.write(`stderr`,e));let g,cancel=()=>{send(o,{type:`cancel`}),g=setTimeout(()=>terminateChild(o,`SIGTERM`),3e3),g.unref()};i.signal?.addEventListener(`abort`,cancel,{once:!0});let cleanup=()=>{h.flush(),i.signal?.removeEventListener(`abort`,cancel),g!==void 0&&clearTimeout(g);for(let e of m.values())e();m.clear()};o.on(`message`,e=>{if(!isRegistrySetupChildMessage(e)){cancel(),a(Error(`Setup command sent an invalid registry protocol message.`));return}if(e.type===`ready`){if(e.version!==REGISTRY_SETUP_PROTOCOL_VERSION){cancel(),a(Error(`Setup command does not support registry setup protocol v${REGISTRY_SETUP_PROTOCOL_VERSION}.`));return}f=!0;return}if(e.type===`result`){p=e.outcome;return}handlePresentation(o,i.prompter,e,m)}),o.once(`error`,e=>{cleanup(),a(e)}),o.once(`close`,(t,n)=>{if(cleanup(),!l){if(l=!0,p?.kind===`completed`){if(t!==0){a(Error(`Setup command reported success, then exited with code ${t??`unknown`}.`));return}let n={kind:`completed`,facts:p.facts};p.deploymentRequired===!0&&(n.deploymentRequired=!0),e(n);return}if(p?.kind===`blocked`){e({kind:`blocked`,blocker:p.blocker});return}if(p?.kind===`cancelled`){e({kind:`cancelled`});return}if(p?.kind===`failed`){a(Error(p.error.message));return}if(i.signal?.aborted===!0||t===130||n===`SIGINT`){e({kind:`cancelled`});return}if(t===0&&f){a(Error(`Setup command exited without reporting a result.`));return}a(Error(n===null?`Setup command exited with code ${t??`unknown`} before reporting a result.`:`Setup command was terminated by ${n} before reporting a result.`))}})})}function terminateChild(e,t){if(process.platform!==`win32`&&e.pid!==void 0)try{process.kill(-e.pid,t);return}catch{}e.kill(t)}export{runRegistrySetupCommand};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { type Prompter } from "#setup/prompter.js";
|
|
2
|
+
import type { RegistrySetupCompletion } from "#setup/registry-setup-protocol.js";
|
|
2
3
|
import type { runRegistrySetupCommand } from "./registry-setup-command.js";
|
|
3
4
|
export interface RegistryCommandLogger {
|
|
4
5
|
error(message: string): void;
|
|
@@ -9,6 +10,8 @@ export interface AddCommandOptions {
|
|
|
9
10
|
overwrite?: boolean;
|
|
10
11
|
skipSetup?: boolean;
|
|
11
12
|
yes?: boolean;
|
|
13
|
+
nonInteractive?: boolean;
|
|
14
|
+
answers?: Record<string, unknown>;
|
|
12
15
|
/** Suppresses the registry SDK's terminal-native progress output. */
|
|
13
16
|
silent?: boolean;
|
|
14
17
|
}
|
|
@@ -29,6 +32,11 @@ export interface AddCommandDependencies extends RegistrySetupDependencies {
|
|
|
29
32
|
createPrompter?: () => Prompter;
|
|
30
33
|
hasInteractiveTerminal?: () => boolean;
|
|
31
34
|
}
|
|
35
|
+
type RunAddCommandOptions = AddCommandOptions & {
|
|
36
|
+
prompter?: Prompter;
|
|
37
|
+
signal?: AbortSignal;
|
|
38
|
+
setupAuthorized?: boolean;
|
|
39
|
+
};
|
|
32
40
|
/** One discoverable item from an eve-compatible registry catalog. */
|
|
33
41
|
export interface RegistryCatalogItem {
|
|
34
42
|
address: string;
|
|
@@ -67,17 +75,18 @@ export declare function getRegistryItemManifest(appRoot: string, item: string):
|
|
|
67
75
|
export declare function installRegistryItem(appRoot: string, item: string, options?: AddCommandOptions & {
|
|
68
76
|
prompter?: Prompter;
|
|
69
77
|
signal?: AbortSignal;
|
|
70
|
-
}, dependencies?: AddCommandDependencies): Promise<
|
|
78
|
+
}, dependencies?: AddCommandDependencies): Promise<{
|
|
79
|
+
output: readonly string[];
|
|
80
|
+
setup?: RegistrySetupCompletion;
|
|
81
|
+
}>;
|
|
71
82
|
/** Installs an official, configured, or URL-addressed registry item. */
|
|
72
|
-
export declare function runAddCommand(logger: RegistryCommandLogger, appRoot: string, item: string, options:
|
|
73
|
-
prompter?: Prompter;
|
|
74
|
-
signal?: AbortSignal;
|
|
75
|
-
}, dependencies?: AddCommandDependencies): Promise<void>;
|
|
83
|
+
export declare function runAddCommand(logger: RegistryCommandLogger, appRoot: string, item: string, options: RunAddCommandOptions, dependencies?: AddCommandDependencies): Promise<RegistrySetupCompletion | undefined>;
|
|
76
84
|
/** Adds registry namespace mappings to the project's package.json. */
|
|
77
85
|
export declare function runRegistryAddCommand(logger: RegistryCommandLogger, appRoot: string, mappings: readonly string[]): Promise<void>;
|
|
78
86
|
/** Lists registry items from every configured source or one selected source. */
|
|
79
87
|
export declare function runRegistryListCommand(logger: RegistryCommandLogger, appRoot: string, source?: string, options?: RegistryCommandOptions): Promise<void>;
|
|
80
88
|
/** Searches registry items across every configured source or one selected source. */
|
|
81
89
|
export declare function runRegistrySearchCommand(logger: RegistryCommandLogger, appRoot: string, query: string, source?: string, options?: RegistrySearchCommandOptions): Promise<void>;
|
|
82
|
-
/**
|
|
83
|
-
export declare function runRegistryViewCommand(logger: RegistryCommandLogger, appRoot: string, item: string): Promise<void>;
|
|
90
|
+
/** Inspects one official, configured, or URL-addressed registry item. */
|
|
91
|
+
export declare function runRegistryViewCommand(logger: RegistryCommandLogger, appRoot: string, item: string, options?: RegistryCommandOptions): Promise<void>;
|
|
92
|
+
export {};
|