eve 0.24.2 → 0.24.3
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 +11 -0
- package/dist/src/cli/dev/environment.d.ts +6 -0
- package/dist/src/cli/dev/environment.js +1 -1
- package/dist/src/compiled/.vendor-stamp.json +2 -1
- package/dist/src/compiled/@chat-adapter/slack/index.js +12 -12
- package/dist/src/compiled/@chat-adapter/twilio/index.js +1 -1
- package/dist/src/compiled/@vercel/sandbox/index.js +19 -19
- package/dist/src/compiled/@workflow/world-local/index.d.ts +14 -0
- package/dist/src/compiled/_chunks/node/{auth-CWHn3Yve.js → auth-BuQkq4Gr.js} +2 -2
- package/dist/src/compiled/_chunks/node/{dist-BdTs18CF.js → chunk-BTyA9uPd.js} +1 -1
- package/dist/src/compiled/_chunks/node/{dist-W8yle6rh.js → dist-CdH_Yoxt.js} +5 -5
- package/dist/src/compiled/_chunks/node/{dist-RHRJZ03Q.js → dist-Drt-_JVK.js} +1 -1
- package/dist/src/compiled/_chunks/node/dist-DsNhwdzf.js +1 -0
- package/dist/src/compiled/_chunks/node/retry-DngYleaI.js +1 -0
- package/dist/src/compiled/_chunks/node/token-DabMnh8F.js +1 -0
- package/dist/src/compiled/_chunks/node/token-util-BoSJPKrG.js +1 -0
- package/dist/src/compiled/_chunks/node/token-util-DVigMYWS.js +1 -0
- package/dist/src/compiled/_chunks/node/virtual-loader-B8K8w9cr.js +1 -0
- package/dist/src/compiled/chat/index.js +1 -1
- package/dist/src/compiled/env-runner/LICENSE +21 -0
- package/dist/src/compiled/env-runner/index.d.ts +38 -0
- package/dist/src/compiled/env-runner/index.js +1 -0
- package/dist/src/compiled/env-runner/node-worker.d.ts +1 -0
- package/dist/src/compiled/env-runner/node-worker.js +12 -0
- package/dist/src/compiler/compile-agent.d.ts +4 -6
- package/dist/src/compiler/compile-agent.js +1 -1
- package/dist/src/execution/create-session-step.d.ts +2 -2
- package/dist/src/execution/create-session-step.js +1 -1
- package/dist/src/execution/workflow-runtime.js +1 -1
- package/dist/src/internal/application/compiled-artifacts.d.ts +13 -0
- package/dist/src/internal/application/compiled-artifacts.js +3 -2
- package/dist/src/internal/application/dev-environment.d.ts +4 -0
- package/dist/src/internal/application/dev-environment.js +1 -0
- package/dist/src/internal/application/optional-package-install.d.ts +2 -10
- package/dist/src/internal/application/optional-package-install.js +1 -1
- package/dist/src/internal/application/output-publication-lock.js +1 -1
- package/dist/src/internal/application/package.js +1 -1
- package/dist/src/internal/application/tsconfig-dependencies.js +1 -1
- package/dist/src/internal/authored-module-loader.d.ts +3 -9
- package/dist/src/internal/authored-module-loader.js +2 -2
- package/dist/src/internal/authored-package-boundary.d.ts +0 -2
- package/dist/src/internal/authored-package-boundary.js +1 -1
- package/dist/src/internal/authored-package-tsconfig-paths.js +1 -1
- package/dist/src/internal/compiled-manifest-fingerprint.d.ts +5 -0
- package/dist/src/internal/compiled-manifest-fingerprint.js +1 -0
- package/dist/src/internal/materialized-authored-modules.d.ts +0 -3
- package/dist/src/internal/materialized-authored-modules.js +1 -1
- package/dist/src/internal/nitro/dev-client-address.d.ts +22 -0
- package/dist/src/internal/nitro/dev-client-address.js +1 -0
- package/dist/src/internal/nitro/dev-runtime-artifacts-retention.d.ts +12 -0
- package/dist/src/internal/nitro/dev-runtime-artifacts-retention.js +1 -0
- package/dist/src/internal/nitro/dev-runtime-artifacts.d.ts +19 -1
- package/dist/src/internal/nitro/dev-runtime-artifacts.js +1 -1
- package/dist/src/internal/nitro/development-generation.d.ts +5 -1
- package/dist/src/internal/nitro/development-generation.js +1 -1
- package/dist/src/internal/nitro/host/artifacts-config.d.ts +2 -0
- package/dist/src/internal/nitro/host/artifacts-config.js +1 -1
- package/dist/src/internal/nitro/host/channel-routes.d.ts +1 -13
- package/dist/src/internal/nitro/host/channel-routes.js +3 -3
- package/dist/src/internal/nitro/host/configure-nitro-routes.d.ts +1 -2
- package/dist/src/internal/nitro/host/configure-nitro-routes.js +2 -2
- package/dist/src/internal/nitro/host/create-application-nitro.d.ts +3 -5
- package/dist/src/internal/nitro/host/create-application-nitro.js +1 -1
- package/dist/src/internal/nitro/host/dev-authored-rebuild-coordinator.d.ts +32 -0
- package/dist/src/internal/nitro/host/dev-authored-rebuild-coordinator.js +1 -0
- package/dist/src/internal/nitro/host/dev-authored-source-watcher.d.ts +4 -15
- package/dist/src/internal/nitro/host/dev-authored-source-watcher.js +1 -1
- package/dist/src/internal/nitro/host/dev-host-candidate.d.ts +16 -0
- package/dist/src/internal/nitro/host/dev-host-candidate.js +1 -0
- package/dist/src/internal/nitro/host/dev-host-fingerprint.d.ts +2 -0
- package/dist/src/internal/nitro/host/dev-host-fingerprint.js +1 -0
- package/dist/src/internal/nitro/host/dev-host-workspace.d.ts +10 -0
- package/dist/src/internal/nitro/host/dev-host-workspace.js +1 -0
- package/dist/src/internal/nitro/host/dev-runner.d.ts +21 -0
- package/dist/src/internal/nitro/host/dev-runner.js +1 -0
- package/dist/src/internal/nitro/host/dev-server-http.d.ts +5 -0
- package/dist/src/internal/nitro/host/dev-server-http.js +1 -0
- package/dist/src/internal/nitro/host/dev-server-url.d.ts +6 -0
- package/dist/src/internal/nitro/host/dev-server-url.js +1 -0
- package/dist/src/internal/nitro/host/dev-workflow-world-setup.d.ts +9 -0
- package/dist/src/internal/nitro/host/dev-workflow-world-setup.js +1 -0
- package/dist/src/internal/nitro/host/dispatch-schedule-in-dev.js +1 -1
- package/dist/src/internal/nitro/host/drained-nitro-dev-server.d.ts +53 -0
- package/dist/src/internal/nitro/host/drained-nitro-dev-server.js +1 -0
- package/dist/src/internal/nitro/host/prepare-application-host.d.ts +4 -5
- package/dist/src/internal/nitro/host/prepare-application-host.js +1 -1
- package/dist/src/internal/nitro/host/start-development-server.d.ts +2 -5
- package/dist/src/internal/nitro/host/start-development-server.js +2 -2
- package/dist/src/internal/nitro/host/types.d.ts +6 -0
- package/dist/src/internal/nitro/routes/channel-dispatch.js +1 -1
- package/dist/src/internal/nitro/routes/runtime-artifacts.d.ts +7 -0
- package/dist/src/internal/nitro/routes/runtime-artifacts.js +1 -1
- package/dist/src/internal/nitro/routes/schedule-task.d.ts +9 -0
- package/dist/src/internal/nitro/routes/schedule-task.js +1 -1
- package/dist/src/internal/workflow/development-generation-context.d.ts +8 -0
- package/dist/src/internal/workflow/development-generation-context.js +1 -0
- package/dist/src/internal/workflow/development-world-client.d.ts +29 -0
- package/dist/src/internal/workflow/development-world-client.js +1 -0
- package/dist/src/internal/workflow/development-world-codec.d.ts +11 -0
- package/dist/src/internal/workflow/development-world-codec.js +1 -0
- package/dist/src/internal/workflow/development-world-protocol.d.ts +31 -0
- package/dist/src/internal/workflow/development-world-protocol.js +1 -0
- package/dist/src/internal/workflow/development-world-server.d.ts +27 -0
- package/dist/src/internal/workflow/development-world-server.js +1 -0
- package/dist/src/runtime/compiled-artifacts-source.d.ts +9 -0
- package/dist/src/runtime/compiled-artifacts-source.js +1 -1
- package/dist/src/runtime/durable-compiled-artifacts-source.d.ts +8 -0
- package/dist/src/runtime/durable-compiled-artifacts-source.js +1 -0
- package/dist/src/runtime/sessions/runtime-context-keys.js +1 -1
- package/dist/src/setup/scaffold/create/project.js +1 -1
- package/dist/src/shared/atomic-write-file.d.ts +1 -1
- package/dist/src/shared/atomic-write-file.js +1 -1
- package/dist/src/shared/rename-with-retry.d.ts +5 -0
- package/dist/src/shared/rename-with-retry.js +1 -0
- package/docs/agent-config.md +2 -0
- package/docs/concepts/execution-model-and-durability.md +1 -1
- package/docs/reference/cli.md +1 -1
- package/package.json +2 -1
- package/dist/src/compiled/_chunks/node/retry-DkR2H1Y0.js +0 -1
- package/dist/src/compiled/_chunks/node/token-ORseRyWn.js +0 -1
- package/dist/src/internal/bundler/nitro-node-file-trace.d.ts +0 -10
- package/dist/src/internal/bundler/nitro-node-file-trace.js +0 -1
- package/dist/src/internal/materialize-authored-external-dependencies.d.ts +0 -10
- package/dist/src/internal/materialize-authored-external-dependencies.js +0 -2
- package/dist/src/internal/nitro/host/dev-live-virtual-modules.d.ts +0 -15
- package/dist/src/internal/nitro/host/dev-live-virtual-modules.js +0 -1
- package/dist/src/internal/nitro/host/server-external-packages.d.ts +0 -5
- package/dist/src/internal/nitro/host/server-external-packages.js +0 -1
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { RuntimeDiskCompiledArtifactsSource } from "#runtime/compiled-artifacts-source.js";
|
|
2
|
+
interface DevelopmentGenerationContext {
|
|
3
|
+
readonly generationId: string;
|
|
4
|
+
readonly source: RuntimeDiskCompiledArtifactsSource;
|
|
5
|
+
}
|
|
6
|
+
export declare function getDevelopmentWorkflowGeneration(): DevelopmentGenerationContext | undefined;
|
|
7
|
+
export declare function withDevelopmentWorkflowGeneration<T>(context: DevelopmentGenerationContext, operation: () => Promise<T>): Promise<T>;
|
|
8
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{ContextContainer,contextStorage}from"#context/container.js";import{ContextKey}from"#context/key.js";const DevelopmentGenerationKey=new ContextKey(`eve.internal.developmentGeneration`);function getDevelopmentWorkflowGeneration(){return contextStorage.getStore()?.get(DevelopmentGenerationKey)}async function withDevelopmentWorkflowGeneration(e,t){let n=new ContextContainer;return n.setVirtualContext(DevelopmentGenerationKey,e),await contextStorage.run(n,t)}export{getDevelopmentWorkflowGeneration,withDevelopmentWorkflowGeneration};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type { World } from "#compiled/@workflow/world/index.js";
|
|
2
|
+
/**
|
|
3
|
+
* Raised when a delivery's recorded generation no longer exists on disk.
|
|
4
|
+
* This never heals on retry, so the queue handler acknowledges and drops
|
|
5
|
+
* the delivery instead of letting the queue redeliver it for its full
|
|
6
|
+
* retry budget.
|
|
7
|
+
*/
|
|
8
|
+
export declare class MissingDevelopmentGenerationError extends Error {
|
|
9
|
+
constructor(generationId: string, cause?: unknown);
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Worker-side Workflow World: an interface-faithful shim whose every method
|
|
13
|
+
* forwards to the real local World in the CLI parent process.
|
|
14
|
+
*
|
|
15
|
+
* Why: a dev worker is disposed on every structural reload, so nothing with
|
|
16
|
+
* run lifetime may live inside it. The `World` interface is already fully
|
|
17
|
+
* async because production Worlds are remote services — inserting HTTP
|
|
18
|
+
* between the runtime and the World changes topology, not semantics, and
|
|
19
|
+
* makes development match production's compute/state split. The runtime
|
|
20
|
+
* cannot observe the difference, so `@workflow/core` needs no changes and
|
|
21
|
+
* this file is deletable the day a multi-process local World ships upstream.
|
|
22
|
+
*
|
|
23
|
+
* Two members are not simple forwards. `streams.get` must return a live
|
|
24
|
+
* `ReadableStream`, so it uses a dedicated route and hands back the response
|
|
25
|
+
* body. `createQueueHandler` points the other way entirely: it returns the
|
|
26
|
+
* HTTP handler that the parent's queue posts deliveries into, and is where a
|
|
27
|
+
* delivery gets pinned to the generation its run started on.
|
|
28
|
+
*/
|
|
29
|
+
export declare function createDevelopmentWorkflowWorld(): World;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{resolvePackageSourceFilePath}from"#internal/application/package.js";import{basename,join}from"node:path";import{readFile}from"node:fs/promises";import{turnWorkflowReference}from"#execution/workflow-runtime.js";import{createDiskRuntimeCompiledArtifactsSource}from"#runtime/compiled-artifacts-source.js";import{DEVELOPMENT_WORKER_APP_ROOT_ENV,DEVELOPMENT_WORKFLOW_DELIVERY_HEADER,DEVELOPMENT_WORKFLOW_SECRET_ENV,DEVELOPMENT_WORKFLOW_STREAM_ROUTE,DEVELOPMENT_WORKFLOW_TRANSPORT_HEADER,DEVELOPMENT_WORKFLOW_WORLD_ROUTE,DEVELOPMENT_WORLD_OPERATIONS}from"#internal/workflow/development-world-protocol.js";import{timingSafeEqualStrings}from"#internal/nitro/dev-client-address.js";import{decodeDevelopmentWorldJson,decodeDevelopmentWorldValue,deserializeDevelopmentWorldError,encodeDevelopmentWorldValue}from"#internal/workflow/development-world-codec.js";import{getDevelopmentWorkflowGeneration,withDevelopmentWorkflowGeneration}from"#internal/workflow/development-generation-context.js";var MissingDevelopmentGenerationError=class extends Error{constructor(e,t){super(`Workflow run references missing development generation "${e}". Remove ".workflow-data" to discard the app's active local Workflow runs.`,t===void 0?void 0:{cause:t}),this.name=`MissingDevelopmentGenerationError`}};async function call(e,t=[]){return decodeDevelopmentWorldValue(await(await fetchDevelopmentWorld(DEVELOPMENT_WORKFLOW_WORLD_ROUTE,{body:encodeDevelopmentWorldValue({arguments:t,operation:e}),method:`POST`})).text())}function createDevelopmentWorkflowWorld(){let e=buildForwardedOperations();return{specVersion:5,processExitTriggersQueueRedelivery:!1,async getDeploymentId(){return getDevelopmentWorkflowGeneration()?.generationId??await call(`getDeploymentId`)},resolveLatestDeploymentId:e.topLevel.resolveLatestDeploymentId,queue:e.topLevel.queue,createQueueHandler,runs:e.groups.runs,steps:e.groups.steps,events:e.groups.events,hooks:e.groups.hooks,streams:{...e.groups.streams,get:async(e,t,n)=>{let r=new URL(resolveDevelopmentWorldBaseUrl());r.pathname=DEVELOPMENT_WORKFLOW_STREAM_ROUTE,r.searchParams.set(`runId`,e),r.searchParams.set(`name`,t),n!==void 0&&r.searchParams.set(`startIndex`,String(n));let i=await fetchDevelopmentWorld(r,{method:`GET`});if(i.body===null)throw Error(`Development Workflow stream response had no body.`);return i.body}},async start(){},async close(){}}}function buildForwardedOperations(){let e={},t={};for(let n of DEVELOPMENT_WORLD_OPERATIONS){let forward=async(...e)=>await call(n,e),r=n.indexOf(`.`);r===-1?t[n]=forward:(e[n.slice(0,r)]??={})[n.slice(r+1)]=forward}return{groups:e,topLevel:t}}function createQueueHandler(t,n){return async r=>{let i=readRequiredEnvironment(DEVELOPMENT_WORKFLOW_SECRET_ENV),c=r.headers.get(DEVELOPMENT_WORKFLOW_DELIVERY_HEADER);if(c===null||!timingSafeEqualStrings(c,i))return Response.json({error:`Workflow delivery is not trusted.`},{status:401});let l=r.headers.get(`x-vqs-queue-name`),u=r.headers.get(`x-vqs-message-id`),d=Number(r.headers.get(`x-vqs-message-attempt`));if(l===null||!l.startsWith(t)||u===null||!Number.isInteger(d)||d<1||r.body===null)return Response.json({error:`Workflow delivery is malformed.`},{status:400});let f=decodeDevelopmentWorldJson(await r.text());try{let t=readRequiredEnvironment(DEVELOPMENT_WORKER_APP_ROOT_ENV),r=await resolveDeliveryGenerationId(f),i=await withDevelopmentWorkflowGeneration({generationId:r,source:createDiskRuntimeCompiledArtifactsSource(await readGenerationRuntimeAppRoot(t,r),{durableReference:`development-generation`,moduleMapLoaderPath:resolvePackageSourceFilePath(`src/internal/authored-module-map-loader.ts`),sandboxAppRoot:t})},async()=>await n(f,{attempt:d,messageId:u,queueName:l}));return Response.json(i===void 0?{ok:!0}:{timeoutSeconds:i.timeoutSeconds})}catch(e){return e instanceof MissingDevelopmentGenerationError?(console.error(`[eve:dev] ${e.message}`),Response.json({ok:!0})):Response.json(String(e),{status:500})}}}async function resolveDeliveryGenerationId(e){if(!isRecord(e))return await call(`resolveLatestDeploymentId`);let t=isRecord(e.runInput)?e.runInput:void 0;if(t!==void 0)return t.workflowName===turnWorkflowReference.workflowId&&typeof t.deploymentId==`string`?t.deploymentId:await call(`resolveLatestDeploymentId`);let n=typeof e.runId==`string`?e.runId:typeof e.workflowRunId==`string`?e.workflowRunId:void 0;if(n===void 0)return await call(`resolveLatestDeploymentId`);let r=await call(`runs.get`,[n,{resolveData:`none`}]);return r.workflowName===turnWorkflowReference.workflowId?r.deploymentId:await call(`resolveLatestDeploymentId`)}async function readGenerationRuntimeAppRoot(e,i){if(i.length===0||i===`.`||i===`..`||basename(i)!==i)throw Error(`Workflow run references invalid development generation "${i}".`);let a=join(e,`.eve`,`dev-runtime`,`snapshots`,i,`generation.json`),o;try{o=await readFile(a,`utf8`)}catch(e){throw isFileNotFoundError(e)?new MissingDevelopmentGenerationError(i,e):e}let s;try{s=JSON.parse(o)}catch(e){throw Error(`Development generation "${i}" has invalid metadata.`,{cause:e})}if(!isRecord(s)||typeof s.runtimeAppRoot!=`string`)throw Error(`Development generation "${i}" has invalid metadata.`);return s.runtimeAppRoot}function isFileNotFoundError(e){return e instanceof Error&&`code`in e&&e.code===`ENOENT`}function isRecord(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}async function fetchDevelopmentWorld(e,t){let n=e instanceof URL?e:new URL(e,resolveDevelopmentWorldBaseUrl()),r=new Headers(t.headers);r.set(DEVELOPMENT_WORKFLOW_TRANSPORT_HEADER,readRequiredEnvironment(DEVELOPMENT_WORKFLOW_SECRET_ENV));let i=await fetch(n,{...t,headers:r});if(!i.ok){let e=await i.text(),t=readDevelopmentWorldError(e);throw t===void 0?Error(`Development Workflow World request failed (${String(i.status)}): ${e}`):t}return i}function readDevelopmentWorldError(e){try{return deserializeDevelopmentWorldError(decodeDevelopmentWorldValue(e))}catch{return}}function resolveDevelopmentWorldBaseUrl(){return readRequiredEnvironment(`WORKFLOW_LOCAL_BASE_URL`)}function readRequiredEnvironment(e){let t=process.env[e];if(t===void 0||t.length===0)throw Error(`Development Workflow transport is missing ${e}.`);return t}export{MissingDevelopmentGenerationError,createDevelopmentWorkflowWorld};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export interface SerializedDevelopmentWorldError {
|
|
2
|
+
readonly details: Readonly<Record<string, unknown>>;
|
|
3
|
+
readonly message: string;
|
|
4
|
+
readonly name: string;
|
|
5
|
+
readonly stack?: string;
|
|
6
|
+
}
|
|
7
|
+
export declare function encodeDevelopmentWorldValue(value: unknown): string;
|
|
8
|
+
export declare function decodeDevelopmentWorldValue(source: string): unknown;
|
|
9
|
+
export declare function decodeDevelopmentWorldJson(source: string): unknown;
|
|
10
|
+
export declare function serializeDevelopmentWorldError(error: unknown): SerializedDevelopmentWorldError;
|
|
11
|
+
export declare function deserializeDevelopmentWorldError(value: unknown): Error | undefined;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const VALUE_TYPE_KEY=`__eveDevelopmentWorldType`,DATE_MARKER=`date`,OBJECT_MARKER=`object`,UINT8_ARRAY_MARKER=`uint8-array`,UNDEFINED_MARKER=`undefined`;function encodeDevelopmentWorldValue(e){return JSON.stringify({value:encodeValue(e)})}function decodeDevelopmentWorldValue(e){let t=JSON.parse(e);return isRecord(t)?decodeTransportValue(t.value):void 0}function decodeDevelopmentWorldJson(e){return decodeWorkflowJsonValue(JSON.parse(e))}function serializeDevelopmentWorldError(e){return e instanceof Error?{details:Object.fromEntries(Object.entries(e)),message:e.message,name:e.name,stack:e.stack}:{details:{},message:String(e),name:`Error`}}function deserializeDevelopmentWorldError(e){if(!isRecord(e)||!isRecord(e.details)||typeof e.message!=`string`||typeof e.name!=`string`)return;let t=Error(e.message);return t.name=e.name,typeof e.stack==`string`&&(t.stack=e.stack),Object.assign(t,e.details),t}function encodeValue(n){return n===void 0?{[VALUE_TYPE_KEY]:UNDEFINED_MARKER}:n instanceof Date?{[VALUE_TYPE_KEY]:DATE_MARKER,data:n.toISOString()}:n instanceof Uint8Array?{[VALUE_TYPE_KEY]:UINT8_ARRAY_MARKER,data:Buffer.from(n).toString(`base64`)}:Array.isArray(n)?n.map(e=>encodeValue(e)):isRecord(n)?{[VALUE_TYPE_KEY]:OBJECT_MARKER,data:Object.fromEntries(Object.entries(n).map(([e,t])=>[e,encodeValue(t)]))}:n}function decodeTransportValue(n){if(Array.isArray(n))return n.map(e=>decodeTransportValue(e));if(!isRecord(n))return n;if(n[VALUE_TYPE_KEY]!==UNDEFINED_MARKER){if(n[VALUE_TYPE_KEY]===DATE_MARKER&&typeof n.data==`string`)return new Date(n.data);if(n[VALUE_TYPE_KEY]===UINT8_ARRAY_MARKER&&typeof n.data==`string`)return Uint8Array.from(Buffer.from(n.data,`base64`));if(n[VALUE_TYPE_KEY]===OBJECT_MARKER&&isRecord(n.data))return Object.fromEntries(Object.entries(n.data).map(([e,t])=>[e,decodeTransportValue(t)]));throw Error(`Development Workflow World transport contained an invalid encoded value.`)}}function decodeWorkflowJsonValue(e){return Array.isArray(e)?e.map(e=>decodeWorkflowJsonValue(e)):isRecord(e)?Object.keys(e).length===2&&e.__type===`Uint8Array`&&typeof e.data==`string`?Uint8Array.from(Buffer.from(e.data,`base64`)):Object.fromEntries(Object.entries(e).map(([e,t])=>[e,decodeWorkflowJsonValue(t)])):e}function isRecord(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}export{decodeDevelopmentWorldJson,decodeDevelopmentWorldValue,deserializeDevelopmentWorldError,encodeDevelopmentWorldValue,serializeDevelopmentWorldError};
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import type { AgentWorkflowWorldDefinition } from "#shared/agent-definition.js";
|
|
2
|
+
export declare const DEVELOPMENT_WORKFLOW_WORLD_ROUTE = "/eve/v1/dev/internal/workflow-world";
|
|
3
|
+
/**
|
|
4
|
+
* Whether development serves this app's Workflow World from the CLI parent.
|
|
5
|
+
* The parent's world creation and the generated worker plugin must agree on
|
|
6
|
+
* this predicate: a worker wired for the parent RPC client fails every World
|
|
7
|
+
* call when the parent never created a World to serve it. An explicit
|
|
8
|
+
* `world: "local"` resolves to the same vendored world as an absent config,
|
|
9
|
+
* so both take the parent-owned path.
|
|
10
|
+
*/
|
|
11
|
+
export declare function usesParentDevelopmentWorkflowWorld(configuredWorld: AgentWorkflowWorldDefinition | undefined): boolean;
|
|
12
|
+
export declare const DEVELOPMENT_WORKFLOW_SECRET_ENV = "EVE_DEV_WORKFLOW_TRANSPORT_SECRET";
|
|
13
|
+
export declare const DEVELOPMENT_WORKER_APP_ROOT_ENV = "EVE_DEV_WORKER_APP_ROOT";
|
|
14
|
+
export declare const DEVELOPMENT_WORKFLOW_STREAM_ROUTE = "/eve/v1/dev/internal/workflow-world/stream";
|
|
15
|
+
export declare const DEVELOPMENT_WORKFLOW_TRANSPORT_HEADER = "x-eve-dev-workflow-transport";
|
|
16
|
+
export declare const DEVELOPMENT_WORKFLOW_DELIVERY_HEADER = "x-eve-dev-workflow-delivery";
|
|
17
|
+
/**
|
|
18
|
+
* The single source of truth for World operations forwarded over the dev
|
|
19
|
+
* RPC: the worker client generates its method forwards from this list and
|
|
20
|
+
* the parent dispatches by walking the same dot-path on the real world, so
|
|
21
|
+
* adapting to a vendored-world interface change is one entry here. The
|
|
22
|
+
* members NOT listed are the deliberate exceptions — `streams.get` returns
|
|
23
|
+
* a live stream over its own route, `createQueueHandler` runs entirely in
|
|
24
|
+
* the worker, and `start`/`close` belong to the parent's lifecycle.
|
|
25
|
+
*/
|
|
26
|
+
export declare const DEVELOPMENT_WORLD_OPERATIONS: readonly ["events.create", "events.get", "events.list", "events.listByCorrelationId", "hooks.get", "hooks.getByToken", "hooks.list", "getDeploymentId", "queue", "resolveLatestDeploymentId", "runs.experimentalSetAttributes", "runs.get", "runs.list", "steps.get", "steps.list", "streams.close", "streams.getChunks", "streams.getInfo", "streams.list", "streams.write", "streams.writeMulti"];
|
|
27
|
+
export type DevelopmentWorldOperation = (typeof DEVELOPMENT_WORLD_OPERATIONS)[number];
|
|
28
|
+
export interface DevelopmentWorldCall {
|
|
29
|
+
readonly arguments: readonly unknown[];
|
|
30
|
+
readonly operation: DevelopmentWorldOperation;
|
|
31
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{getWorldImport}from"../../node_modules/.pnpm/@workflow_utils@5.0.0-beta.6/node_modules/@workflow/utils/dist/world-target.js";import"../../node_modules/.pnpm/@workflow_utils@5.0.0-beta.6/node_modules/@workflow/utils/dist/index.js";const DEVELOPMENT_WORKFLOW_WORLD_ROUTE=`/eve/v1/dev/internal/workflow-world`;function usesParentDevelopmentWorkflowWorld(e){return getWorldImport({WORKFLOW_TARGET_WORLD:e??`local`})===`@workflow/world-local`}const DEVELOPMENT_WORKFLOW_SECRET_ENV=`EVE_DEV_WORKFLOW_TRANSPORT_SECRET`,DEVELOPMENT_WORKER_APP_ROOT_ENV=`EVE_DEV_WORKER_APP_ROOT`,DEVELOPMENT_WORKFLOW_STREAM_ROUTE=`${DEVELOPMENT_WORKFLOW_WORLD_ROUTE}/stream`,DEVELOPMENT_WORKFLOW_TRANSPORT_HEADER=`x-eve-dev-workflow-transport`,DEVELOPMENT_WORKFLOW_DELIVERY_HEADER=`x-eve-dev-workflow-delivery`,DEVELOPMENT_WORLD_OPERATIONS=[`events.create`,`events.get`,`events.list`,`events.listByCorrelationId`,`hooks.get`,`hooks.getByToken`,`hooks.list`,`getDeploymentId`,`queue`,`resolveLatestDeploymentId`,`runs.experimentalSetAttributes`,`runs.get`,`runs.list`,`steps.get`,`steps.list`,`streams.close`,`streams.getChunks`,`streams.getInfo`,`streams.list`,`streams.write`,`streams.writeMulti`];export{DEVELOPMENT_WORKER_APP_ROOT_ENV,DEVELOPMENT_WORKFLOW_DELIVERY_HEADER,DEVELOPMENT_WORKFLOW_SECRET_ENV,DEVELOPMENT_WORKFLOW_STREAM_ROUTE,DEVELOPMENT_WORKFLOW_TRANSPORT_HEADER,DEVELOPMENT_WORKFLOW_WORLD_ROUTE,DEVELOPMENT_WORLD_OPERATIONS,usesParentDevelopmentWorkflowWorld};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The application's one local Workflow World, owned by the CLI parent.
|
|
3
|
+
*
|
|
4
|
+
* Why the parent: run records, the queue, and stream state must outlive the
|
|
5
|
+
* Nitro dev worker, which is disposed on every structural reload. The parent
|
|
6
|
+
* is the only process whose lifetime matches the run data, so it holds the
|
|
7
|
+
* real (stock, vendored) world-local instance and serves it to workers over
|
|
8
|
+
* an RPC route on the public listener; workers hold only an
|
|
9
|
+
* interface-faithful client. Deliveries are not served here — the queue
|
|
10
|
+
* posts them through the public listener to the active worker like any
|
|
11
|
+
* other request, so drained replacement covers them automatically.
|
|
12
|
+
*
|
|
13
|
+
* `handleRequest` must be reachable before `start()` runs: starting the
|
|
14
|
+
* world begins queue redelivery immediately, and a delivery's first World
|
|
15
|
+
* call arrives back on the listener within milliseconds.
|
|
16
|
+
*/
|
|
17
|
+
export interface ParentDevelopmentWorkflowWorld {
|
|
18
|
+
close(): Promise<void>;
|
|
19
|
+
handleRequest(request: Request): Promise<Response | undefined>;
|
|
20
|
+
start(): Promise<void>;
|
|
21
|
+
}
|
|
22
|
+
export declare function createParentDevelopmentWorkflowWorld(input: {
|
|
23
|
+
readonly agentName: string;
|
|
24
|
+
readonly appRoot: string;
|
|
25
|
+
readonly resolveActiveGenerationId: () => string;
|
|
26
|
+
readonly transportSecret: string;
|
|
27
|
+
}): ParentDevelopmentWorkflowWorld;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{existsSync}from"node:fs";import{basename,join}from"node:path";import{turnWorkflowReference}from"#execution/workflow-runtime.js";import{DEVELOPMENT_WORKFLOW_DELIVERY_HEADER,DEVELOPMENT_WORKFLOW_STREAM_ROUTE,DEVELOPMENT_WORKFLOW_TRANSPORT_HEADER,DEVELOPMENT_WORKFLOW_WORLD_ROUTE,DEVELOPMENT_WORLD_OPERATIONS}from"#internal/workflow/development-world-protocol.js";import{deriveEveWorkflowQueuePrefix}from"#internal/workflow/queue-namespace.js";import{timingSafeEqualStrings}from"#internal/nitro/dev-client-address.js";import{decodeDevelopmentWorldValue,encodeDevelopmentWorldValue,serializeDevelopmentWorldError}from"#internal/workflow/development-world-codec.js";import{createWorld}from"#compiled/@workflow/world-local/index.js";function createParentDevelopmentWorkflowWorld(e){return new LocalParentDevelopmentWorkflowWorld(e)}var LocalParentDevelopmentWorkflowWorld=class{#e;#t;#n;#r;#i;#a=!1;#o=!1;constructor(e){if(e.transportSecret.length<16)throw Error(`Development Workflow transport secret is too short to be trusted.`);this.#e=e.agentName,this.#t=e.appRoot,this.#n=e.resolveActiveGenerationId,this.#r=e.transportSecret,this.#i=createWorld({dataDir:join(e.appRoot,`.workflow-data`),recoverActiveRuns:!1})}async start(){if(this.#o)return;let e=await this.#s(),t=new Set;for(let n of e)this.#p(n)||t.add(n);t.size>0&&console.error(`[eve:dev] ${String(t.size)} active local Workflow run(s) reference development generations that no longer exist (${[...t].join(`, `)}). Their deliveries are quarantined; remove ".workflow-data" to discard the app's active local Workflow runs.`),await this.#i.start?.(),this.#o=!0,await reenqueueActiveDevelopmentRuns({enqueue:this.#u.bind(this),prefix:deriveEveWorkflowQueuePrefix(this.#e),quarantinedGenerationIds:t,world:this.#i})}async close(){this.#a||(this.#a=!0,this.#o=!1,await this.#i.close?.())}async handleRequest(e){let t=new URL(e.url);if(t.pathname===DEVELOPMENT_WORKFLOW_WORLD_ROUTE)return await this.#c(e);if(t.pathname===DEVELOPMENT_WORKFLOW_STREAM_ROUTE)return await this.#l(e,t)}async#s(){let e=new Set;for(let t of[`pending`,`running`]){let n;do{let i;try{i=await this.#i.runs.list({pagination:{cursor:n,limit:1e3},resolveData:`none`,status:t})}catch(e){throw Error(`Failed to read the app's active local Workflow runs. Remove ".workflow-data" to discard them.`,{cause:e})}for(let t of i.data)t.workflowName===turnWorkflowReference.workflowId&&e.add(t.deploymentId);n=i.hasMore?i.cursor??void 0:void 0}while(n!==void 0)}return e}async#c(e){if(!this.#f(e)||e.method!==`POST`)return Response.json({error:`Workflow World request is not trusted.`},{status:401});try{let t=decodeDevelopmentWorldValue(await e.text()),n=await this.#d(t);return new Response(encodeDevelopmentWorldValue(n))}catch(e){return new Response(encodeDevelopmentWorldValue(serializeDevelopmentWorldError(e)),{status:500})}}async#l(e,t){if(!this.#f(e)||e.method!==`GET`)return Response.json({error:`Workflow World request is not trusted.`},{status:401});let n=t.searchParams.get(`runId`),r=t.searchParams.get(`name`),i=t.searchParams.get(`startIndex`);if(n===null||r===null)return Response.json({error:`Workflow stream request is malformed.`},{status:400});let a=i===null||i===``?void 0:Number(i);if(i===``||a!==void 0&&!Number.isInteger(a))return Response.json({error:`Workflow stream start index is invalid.`},{status:400});try{return new Response(await this.#i.streams.get(n,r,a))}catch(e){return new Response(encodeDevelopmentWorldValue(serializeDevelopmentWorldError(e)),{status:500})}}async#u(...e){let[t,n,r]=e;return await this.#i.queue(t,n,{...r,headers:{...r?.headers,[DEVELOPMENT_WORKFLOW_DELIVERY_HEADER]:this.#r}})}async#d(e){if(!isDevelopmentWorldCall(e))throw Error(`Development Workflow World call is malformed.`);let t=[...e.arguments];if(e.operation===`getDeploymentId`||e.operation===`resolveLatestDeploymentId`)return this.#n();if(e.operation===`queue`)return await this.#u(...t);if(e.operation===`streams.writeMulti`&&this.#i.streams.writeMulti===void 0){for(let e of t[2])await this.#i.streams.write(t[0],t[1],e);return}let n=e.operation.indexOf(`.`),r=this.#i[e.operation.slice(0,n)],i=typeof r==`object`&&r?r[e.operation.slice(n+1)]:void 0;if(typeof i==`function`)return await Reflect.apply(i,r,t)}#f(e){let t=e.headers.get(DEVELOPMENT_WORKFLOW_TRANSPORT_HEADER);return t!==null&&timingSafeEqualStrings(t,this.#r)}#p(t){return isValidGenerationId(t)?existsSync(join(this.#t,`.eve`,`dev-runtime`,`snapshots`,t,`generation.json`)):!1}};function isValidGenerationId(e){return e.length>0&&e!==`.`&&e!==`..`&&basename(e)===e}const DEVELOPMENT_WORLD_OPERATION_SET=new Set(DEVELOPMENT_WORLD_OPERATIONS);function isDevelopmentWorldCall(e){return isObject(e)&&typeof e.operation==`string`&&DEVELOPMENT_WORLD_OPERATION_SET.has(e.operation)&&Array.isArray(e.arguments)}function isObject(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}async function reenqueueActiveDevelopmentRuns(e){for(let t of[`pending`,`running`]){let n;do{let r;try{r=await e.world.runs.list({pagination:{cursor:n},resolveData:`none`,status:t})}catch(e){throw Error(`Failed to read the app's active local Workflow runs. Remove ".workflow-data" to discard them.`,{cause:e})}for(let t of r.data)e.quarantinedGenerationIds.has(t.deploymentId)||await e.enqueue(`${e.prefix}${t.workflowName}`,{runId:t.runId});n=r.hasMore?r.cursor??void 0:void 0}while(n!==void 0)}}export{createParentDevelopmentWorkflowWorld};
|
|
@@ -29,6 +29,14 @@ export interface RuntimeDiskCompiledArtifactsSource {
|
|
|
29
29
|
* while sandbox state should remain scoped to the authored application.
|
|
30
30
|
*/
|
|
31
31
|
readonly sandboxAppRoot?: string;
|
|
32
|
+
/**
|
|
33
|
+
* How this source is recorded in durable Workflow payloads.
|
|
34
|
+
* `"development-generation"` stores a logical selector resolved from the
|
|
35
|
+
* delivery's generation context — valid only where deliveries install
|
|
36
|
+
* that context (the parent-owned dev World). Absent, the source is stored
|
|
37
|
+
* verbatim, pinning durable work to this exact path.
|
|
38
|
+
*/
|
|
39
|
+
readonly durableReference?: "development-generation";
|
|
32
40
|
}
|
|
33
41
|
/**
|
|
34
42
|
* Creates the bundled compiled-artifact source.
|
|
@@ -38,6 +46,7 @@ export declare function createBundledRuntimeCompiledArtifactsSource(): RuntimeBu
|
|
|
38
46
|
* Creates the disk-backed compiled-artifact source for one authored app root.
|
|
39
47
|
*/
|
|
40
48
|
export declare function createDiskRuntimeCompiledArtifactsSource(appRoot: string, options?: {
|
|
49
|
+
readonly durableReference?: "development-generation";
|
|
41
50
|
readonly moduleMapLoaderPath?: string;
|
|
42
51
|
readonly sandboxAppRoot?: string;
|
|
43
52
|
}): RuntimeDiskCompiledArtifactsSource;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
function createBundledRuntimeCompiledArtifactsSource(){return{kind:`bundled`}}function createDiskRuntimeCompiledArtifactsSource(e,t={}){return t.moduleMapLoaderPath!==void 0||t.sandboxAppRoot!==void 0?{appRoot:e,kind:`disk`,moduleMapLoaderPath:t.moduleMapLoaderPath,sandboxAppRoot:t.sandboxAppRoot}:{appRoot:e,kind:`disk`}}function getRuntimeCompiledArtifactsAppRoot(e){return e.kind===`disk`?e.appRoot:void 0}function getRuntimeCompiledArtifactsSandboxAppRoot(e){return e.kind===`disk`?e.sandboxAppRoot??e.appRoot:void 0}function getRuntimeCompiledArtifactsCacheKey(e){return e.kind===`disk`?e.moduleMapLoaderPath===void 0?`disk:${e.appRoot}`:`disk:${e.appRoot}:authored-source:${e.moduleMapLoaderPath}`:`bundled`}export{createBundledRuntimeCompiledArtifactsSource,createDiskRuntimeCompiledArtifactsSource,getRuntimeCompiledArtifactsAppRoot,getRuntimeCompiledArtifactsCacheKey,getRuntimeCompiledArtifactsSandboxAppRoot};
|
|
1
|
+
function createBundledRuntimeCompiledArtifactsSource(){return{kind:`bundled`}}function createDiskRuntimeCompiledArtifactsSource(e,t={}){return t.moduleMapLoaderPath!==void 0||t.sandboxAppRoot!==void 0||t.durableReference!==void 0?{appRoot:e,durableReference:t.durableReference,kind:`disk`,moduleMapLoaderPath:t.moduleMapLoaderPath,sandboxAppRoot:t.sandboxAppRoot}:{appRoot:e,kind:`disk`}}function getRuntimeCompiledArtifactsAppRoot(e){return e.kind===`disk`?e.appRoot:void 0}function getRuntimeCompiledArtifactsSandboxAppRoot(e){return e.kind===`disk`?e.sandboxAppRoot??e.appRoot:void 0}function getRuntimeCompiledArtifactsCacheKey(e){return e.kind===`disk`?e.moduleMapLoaderPath===void 0?`disk:${e.appRoot}`:`disk:${e.appRoot}:authored-source:${e.moduleMapLoaderPath}`:`bundled`}export{createBundledRuntimeCompiledArtifactsSource,createDiskRuntimeCompiledArtifactsSource,getRuntimeCompiledArtifactsAppRoot,getRuntimeCompiledArtifactsCacheKey,getRuntimeCompiledArtifactsSandboxAppRoot};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { RuntimeCompiledArtifactsSource } from "#runtime/compiled-artifacts-source.js";
|
|
2
|
+
interface DevelopmentCompiledArtifactsSelector {
|
|
3
|
+
readonly kind: "development";
|
|
4
|
+
}
|
|
5
|
+
export type DurableCompiledArtifactsSource = RuntimeCompiledArtifactsSource | DevelopmentCompiledArtifactsSelector;
|
|
6
|
+
export declare function serializeDurableCompiledArtifactsSource(source: RuntimeCompiledArtifactsSource): DurableCompiledArtifactsSource;
|
|
7
|
+
export declare function resolveDurableCompiledArtifactsSource(source: DurableCompiledArtifactsSource): RuntimeCompiledArtifactsSource;
|
|
8
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{getDevelopmentWorkflowGeneration}from"#internal/workflow/development-generation-context.js";function serializeDurableCompiledArtifactsSource(e){return e.kind===`disk`&&e.durableReference===`development-generation`?{kind:`development`}:e}function resolveDurableCompiledArtifactsSource(t){if(t.kind!==`development`)return t;let n=getDevelopmentWorkflowGeneration();if(n===void 0)throw Error(`A development Workflow generation selector was resumed outside a generation-bound delivery.`);return n.source}export{resolveDurableCompiledArtifactsSource,serializeDurableCompiledArtifactsSource};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{getAdapterKind}from"#channel/adapter.js";import{ContextKey}from"#context/key.js";import{getCompiledRuntimeAgentBundle}from"#runtime/sessions/compiled-agent-cache.js";import{deserializeRuntimeAdapter}from"#runtime/channels/registry.js";const ChannelKey=new ContextKey(`eve.channel`,{codec:{serialize(t){return{kind:getAdapterKind(t),state:t.state?{...t.state}:{}}},deserialize(e,t){let n=t.get(BundleKey);if(n===void 0)throw Error(`Cannot deserialize "eve.channel" before "eve.bundle". The runtime bundle must be present in context.`);return deserializeRuntimeAdapter(n.adapterRegistry,e)}}}),BundleKey=new ContextKey(`eve.bundle`,{codec:{serialize:e=>({nodeId:e.nodeId,source:e.compiledArtifactsSource}),deserialize:e=>{let{source:t,nodeId:r}=e;return getCompiledRuntimeAgentBundle({compiledArtifactsSource:t,nodeId:r})}}});export{BundleKey,ChannelKey};
|
|
1
|
+
import{getAdapterKind}from"#channel/adapter.js";import{ContextKey}from"#context/key.js";import{getCompiledRuntimeAgentBundle}from"#runtime/sessions/compiled-agent-cache.js";import{resolveDurableCompiledArtifactsSource,serializeDurableCompiledArtifactsSource}from"#runtime/durable-compiled-artifacts-source.js";import{deserializeRuntimeAdapter}from"#runtime/channels/registry.js";const ChannelKey=new ContextKey(`eve.channel`,{codec:{serialize(t){return{kind:getAdapterKind(t),state:t.state?{...t.state}:{}}},deserialize(e,t){let n=t.get(BundleKey);if(n===void 0)throw Error(`Cannot deserialize "eve.channel" before "eve.bundle". The runtime bundle must be present in context.`);return deserializeRuntimeAdapter(n.adapterRegistry,e)}}}),BundleKey=new ContextKey(`eve.bundle`,{codec:{serialize:e=>({nodeId:e.nodeId,source:serializeDurableCompiledArtifactsSource(e.compiledArtifactsSource)}),deserialize:e=>{let{source:t,nodeId:r}=e;return getCompiledRuntimeAgentBundle({compiledArtifactsSource:resolveDurableCompiledArtifactsSource(t),nodeId:r})}}});export{BundleKey,ChannelKey};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{pinnedNodeEngineMajor}from"../../node-engine.js";import{pathExists,writeTextFile}from"../files.js";import{resolveVersionToken}from"../version-tokens.js";import{applyPackageManagerWorkspaceConfiguration,isPackageManagerWorkspaceMember,patchWorkspaceRootPackageJson}from"../workspace-root.js";import{SUPPORTED_AUTHORED_MODULE_FILE_EXTENSIONS}from"../update/module-files.js";import{WEB_APP_TEMPLATE_FILES}from"./web-template.js";import{basename,join,resolve}from"node:path";import{mkdir,readdir,stat}from"node:fs/promises";const CURRENT_DIRECTORY_PROJECT_NAME=`.`,ALLOWED_CREATE_IN_PLACE_ENTRIES=new Set([`.DS_Store`,`.git`,`.gitkeep`,`.hg`]),DEFAULT_AI_PACKAGE_VERSION=`^7.0.26`,DEFAULT_CONNECT_PACKAGE_VERSION=`0.2.2`,DEFAULT_ZOD_PACKAGE_VERSION=`4.4.3`,DEFAULT_EVE_PACKAGE_CONTRACT={version:`0.24.
|
|
1
|
+
import{pinnedNodeEngineMajor}from"../../node-engine.js";import{pathExists,writeTextFile}from"../files.js";import{resolveVersionToken}from"../version-tokens.js";import{applyPackageManagerWorkspaceConfiguration,isPackageManagerWorkspaceMember,patchWorkspaceRootPackageJson}from"../workspace-root.js";import{SUPPORTED_AUTHORED_MODULE_FILE_EXTENSIONS}from"../update/module-files.js";import{WEB_APP_TEMPLATE_FILES}from"./web-template.js";import{basename,join,resolve}from"node:path";import{mkdir,readdir,stat}from"node:fs/promises";const CURRENT_DIRECTORY_PROJECT_NAME=`.`,ALLOWED_CREATE_IN_PLACE_ENTRIES=new Set([`.DS_Store`,`.git`,`.gitkeep`,`.hg`]),DEFAULT_AI_PACKAGE_VERSION=`^7.0.26`,DEFAULT_CONNECT_PACKAGE_VERSION=`0.2.2`,DEFAULT_ZOD_PACKAGE_VERSION=`4.4.3`,DEFAULT_EVE_PACKAGE_CONTRACT={version:`0.24.3`,nodeEngine:`>=24`};function resolveEvePackageContract(e=DEFAULT_EVE_PACKAGE_CONTRACT){return{version:resolveVersionToken(`evePackage.version`,e.version),nodeEngine:resolveVersionToken(`evePackage.nodeEngine`,e.nodeEngine)}}function modelProviderSlug(e){let t=(e.split(`/`)[0]??``).replaceAll(/[^A-Za-z0-9._-]/gu,``);return t.length>0?t:`anthropic`}function byokProviderEnvVar(e){let t=modelProviderSlug(e).toUpperCase().replaceAll(/[^A-Z0-9]/gu,`_`);return`${/^[0-9]/.test(t)?`_`:``}${t}_API_KEY`}function agentTemplateFiles(e){return{"agent/agent.ts":BASE_AGENT_TEMPLATE.replaceAll(`__EVE_INIT_MODEL__`,e),"agent/channels/eve.ts":WEB_APP_TEMPLATE_FILES[`agent/channels/eve.ts`],"agent/instructions.md":AGENT_INSTRUCTIONS_TEMPLATE}}function renderTemplate(e,t){return e.replaceAll(`__EVE_INIT_APP_NAME__`,t.appName).replaceAll(`__EVE_INIT_MODEL__`,t.model).replaceAll(`__EVE_INIT_BYOK_PROVIDER__`,modelProviderSlug(t.model)).replaceAll(`__EVE_INIT_BYOK_ENV_VAR__`,byokProviderEnvVar(t.model)).replaceAll(`__EVE_INIT_PACKAGE_VERSION__`,formatEveDependencySpecifier(t.eveVersion)).replaceAll(`__EVE_INIT_AI_SDK_VERSION__`,t.aiPackageVersion).replaceAll(`__EVE_INIT_CONNECT_VERSION__`,t.connectPackageVersion).replaceAll(`__EVE_INIT_ZOD_VERSION__`,t.zodPackageVersion).replaceAll(`__EVE_INIT_TYPESCRIPT_VERSION__`,t.typescriptPackageVersion).replaceAll(`__EVE_INIT_TYPES_NODE_VERSION__`,t.nodeTypesVersion).replaceAll(`__EVE_INIT_NODE_ENGINE__`,t.nodeEngine)}function formatEveDependencySpecifier(e){return/^\d+\.\d+\.\d+(?:[-+][0-9A-Za-z-.]+)?$/.test(e)?`^${e}`:e}const BASE_AGENT_TEMPLATE=`import { defineAgent } from "eve";
|
|
2
2
|
|
|
3
3
|
export default defineAgent({
|
|
4
4
|
model: "__EVE_INIT_MODEL__",
|
|
@@ -6,6 +6,6 @@
|
|
|
6
6
|
*
|
|
7
7
|
* Windows refuses to replace a file while another handle is open on it
|
|
8
8
|
* (concurrent readers, `utimes` heartbeats, antivirus scans), surfacing as
|
|
9
|
-
* `EPERM`/`EACCES`, so the replace is retried briefly before giving up.
|
|
9
|
+
* `EPERM`/`EACCES`/`EBUSY`, so the replace is retried briefly before giving up.
|
|
10
10
|
*/
|
|
11
11
|
export declare function atomicWriteFile(targetPath: string, contents: string | Buffer | Uint8Array): Promise<void>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{rm,writeFile}from"node:fs/promises";import{renameWithTransientBusyRetry}from"#shared/rename-with-retry.js";async function atomicWriteFile(t,n){let r=`${t}.tmp-${process.pid}-${Date.now().toString(36)}`;await writeFile(r,n);try{await renameWithTransientBusyRetry(r,t)}catch(e){throw await rm(r,{force:!0}).catch(()=>void 0),e}}export{atomicWriteFile};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Renames a path atomically, retrying the transient busy-handle errors that
|
|
3
|
+
* Windows can report while another process briefly has either path open.
|
|
4
|
+
*/
|
|
5
|
+
export declare function renameWithTransientBusyRetry(sourcePath: string, destinationPath: string): Promise<void>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{rename}from"node:fs/promises";import{isErrnoCode}from"#shared/guards.js";const TRANSIENT_RENAME_RETRY_DELAYS_MS=[10,20,40,80,160,320,640];async function renameWithTransientBusyRetry(t,n){for(let r of TRANSIENT_RENAME_RETRY_DELAYS_MS)try{await rename(t,n);return}catch(e){if(!isTransientRenameError(e))throw e;await new Promise(e=>setTimeout(e,r))}await rename(t,n)}function isTransientRenameError(e){return isErrnoCode(e,`EPERM`)||isErrnoCode(e,`EACCES`)||isErrnoCode(e,`EBUSY`)}export{renameWithTransientBusyRetry};
|
package/docs/agent-config.md
CHANGED
|
@@ -214,6 +214,8 @@ installed package must stay external in hosted output, list it in
|
|
|
214
214
|
|
|
215
215
|
`externalDependencies` is a packaging control only. It keeps selected packages as runtime dependencies in the hosted output; it does not authorize, configure, or review any third-party service those packages may call.
|
|
216
216
|
|
|
217
|
+
During `eve dev`, ordinary dependencies are bundled into each retained runtime generation. Packages listed in `externalDependencies` keep normal Node.js resolution instead, so replacing one of those packages requires restarting the dev server.
|
|
218
|
+
|
|
217
219
|
## Where adjacent settings live
|
|
218
220
|
|
|
219
221
|
| Concern | Lives in |
|
|
@@ -15,7 +15,7 @@ Work nests in three levels:
|
|
|
15
15
|
|
|
16
16
|
Every turn runs as a durable workflow, built on the open-source [Workflow SDK](https://workflow-sdk.dev/) (Vercel Workflow when you deploy on Vercel). eve checkpoints progress and serializes durable state at each step boundary. Your code runs inside a managed step, so tools, the sandbox, and subagents feel synchronous even though the session underneath them is durable.
|
|
17
17
|
|
|
18
|
-
The Workflow SDK is not inherently tied to Vercel. In local development and in a self-deployed `eve start` process, eve uses the SDK's local world by default; that world persists workflow runs on disk
|
|
18
|
+
The Workflow SDK is not inherently tied to Vercel. In local development and in a self-deployed `eve start` process, eve uses the SDK's local world by default; that world persists workflow runs on disk under `.workflow-data` and dispatches through the same Nitro-hosted workflow routes. On Vercel, the same workflow code runs against Vercel Workflow instead, which adds platform features such as latest production deployment routing and dashboard run metadata.
|
|
19
19
|
|
|
20
20
|
When a Vercel production deployment changes, the next model turn in an existing session uses that deployment's current instructions, model, and tools. The durable session keeps its conversation history and authored state, so identity-based channels such as Telegram private chats and Twilio phone-number conversations adopt agent updates without requiring a new session.
|
|
21
21
|
|
package/docs/reference/cli.md
CHANGED
|
@@ -158,7 +158,7 @@ For bearer tokens or custom schemes, pass explicit headers with `-H`.
|
|
|
158
158
|
|
|
159
159
|
Local dev records the last ready URL per resolved app root in `.eve/dev-server-state.v1.json`. A second interactive `eve dev` reconnects only when that URL is loopback and healthy; each terminal UI creates a fresh client session while sharing the server process. A stale or malformed record is replaced when eve starts a new server. Passing `--host`, `--port`, or a `PORT` environment value skips reconnection and reports a healthy recorded server instead.
|
|
160
160
|
|
|
161
|
-
Local dev keeps immutable runtime source snapshots under `.eve/dev-runtime/snapshots/` so in-flight
|
|
161
|
+
Local dev keeps immutable runtime source snapshots under `.eve/dev-runtime/snapshots/` so in-flight turns hold a consistent code revision while new turns pick up rebuilds. After a generation is superseded, `eve dev` retains it for at least 30 minutes and also retains the five most recently superseded generations, regardless of the configured Workflow World. The active generation is never pruned. Old runtime snapshots and local sandbox templates are pruned in the background. For manual cleanup, stop `eve dev` before deleting `.eve/dev-runtime/snapshots/` or `.eve/sandbox-cache/local/templates/`. A turn that remains unfinished beyond the automatic retention window can no longer resume after its generation is pruned.
|
|
162
162
|
|
|
163
163
|
## `eve link`
|
|
164
164
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "eve",
|
|
3
|
-
"version": "0.24.
|
|
3
|
+
"version": "0.24.3",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Filesystem-first framework for durable backend AI agents that run anywhere.",
|
|
6
6
|
"keywords": [
|
|
@@ -316,6 +316,7 @@
|
|
|
316
316
|
"chokidar": "5.0.0",
|
|
317
317
|
"commander": "14.0.3",
|
|
318
318
|
"emulate": "0.6.0",
|
|
319
|
+
"env-runner": "0.1.12",
|
|
319
320
|
"eventsource-parser": "3.0.8",
|
|
320
321
|
"experimental-ai-sdk-code-mode": "1.0.16",
|
|
321
322
|
"gray-matter": "4.0.3",
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as e}from"./dist-BdTs18CF.js";var t=e(((e,t)=>{var n=1e3,r=n*60,i=r*60,a=i*24,o=a*7,s=a*365.25;t.exports=function(e,t){t||={};var n=typeof e;if(n===`string`&&e.length>0)return c(e);if(n===`number`&&isFinite(e))return t.long?u(e):l(e);throw Error(`val is not a non-empty string or a valid number. val=`+JSON.stringify(e))};function c(e){if(e=String(e),!(e.length>100)){var t=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(e);if(t){var c=parseFloat(t[1]);switch((t[2]||`ms`).toLowerCase()){case`years`:case`year`:case`yrs`:case`yr`:case`y`:return c*s;case`weeks`:case`week`:case`w`:return c*o;case`days`:case`day`:case`d`:return c*a;case`hours`:case`hour`:case`hrs`:case`hr`:case`h`:return c*i;case`minutes`:case`minute`:case`mins`:case`min`:case`m`:return c*r;case`seconds`:case`second`:case`secs`:case`sec`:case`s`:return c*n;case`milliseconds`:case`millisecond`:case`msecs`:case`msec`:case`ms`:return c;default:return}}}}function l(e){var t=Math.abs(e);return t>=a?Math.round(e/a)+`d`:t>=i?Math.round(e/i)+`h`:t>=r?Math.round(e/r)+`m`:t>=n?Math.round(e/n)+`s`:e+`ms`}function u(e){var t=Math.abs(e);return t>=a?d(e,t,a,`day`):t>=i?d(e,t,i,`hour`):t>=r?d(e,t,r,`minute`):t>=n?d(e,t,n,`second`):e+` ms`}function d(e,t,n,r){var i=t>=n*1.5;return Math.round(e/n)+` `+r+(i?`s`:``)}})),n=e(((e,t)=>{function n(e,t){typeof t==`boolean`&&(t={forever:t}),this._originalTimeouts=JSON.parse(JSON.stringify(e)),this._timeouts=e,this._options=t||{},this._maxRetryTime=t&&t.maxRetryTime||1/0,this._fn=null,this._errors=[],this._attempts=1,this._operationTimeout=null,this._operationTimeoutCb=null,this._timeout=null,this._operationStart=null,this._timer=null,this._options.forever&&(this._cachedTimeouts=this._timeouts.slice(0))}t.exports=n,n.prototype.reset=function(){this._attempts=1,this._timeouts=this._originalTimeouts.slice(0)},n.prototype.stop=function(){this._timeout&&clearTimeout(this._timeout),this._timer&&clearTimeout(this._timer),this._timeouts=[],this._cachedTimeouts=null},n.prototype.retry=function(e){if(this._timeout&&clearTimeout(this._timeout),!e)return!1;var t=new Date().getTime();if(e&&t-this._operationStart>=this._maxRetryTime)return this._errors.push(e),this._errors.unshift(Error(`RetryOperation timeout occurred`)),!1;this._errors.push(e);var n=this._timeouts.shift();if(n===void 0)if(this._cachedTimeouts)this._errors.splice(0,this._errors.length-1),n=this._cachedTimeouts.slice(-1);else return!1;var r=this;return this._timer=setTimeout(function(){r._attempts++,r._operationTimeoutCb&&(r._timeout=setTimeout(function(){r._operationTimeoutCb(r._attempts)},r._operationTimeout),r._options.unref&&r._timeout.unref()),r._fn(r._attempts)},n),this._options.unref&&this._timer.unref(),!0},n.prototype.attempt=function(e,t){this._fn=e,t&&(t.timeout&&(this._operationTimeout=t.timeout),t.cb&&(this._operationTimeoutCb=t.cb));var n=this;this._operationTimeoutCb&&(this._timeout=setTimeout(function(){n._operationTimeoutCb()},n._operationTimeout)),this._operationStart=new Date().getTime(),this._fn(this._attempts)},n.prototype.try=function(e){console.log(`Using RetryOperation.try() is deprecated`),this.attempt(e)},n.prototype.start=function(e){console.log(`Using RetryOperation.start() is deprecated`),this.attempt(e)},n.prototype.start=n.prototype.try,n.prototype.errors=function(){return this._errors},n.prototype.attempts=function(){return this._attempts},n.prototype.mainError=function(){if(this._errors.length===0)return null;for(var e={},t=null,n=0,r=0;r<this._errors.length;r++){var i=this._errors[r],a=i.message,o=(e[a]||0)+1;e[a]=o,o>=n&&(t=i,n=o)}return t}})),r=e((e=>{var t=n();e.operation=function(n){return new t(e.timeouts(n),{forever:n&&(n.forever||n.retries===1/0),unref:n&&n.unref,maxRetryTime:n&&n.maxRetryTime})},e.timeouts=function(e){if(e instanceof Array)return[].concat(e);var t={retries:10,factor:2,minTimeout:1*1e3,maxTimeout:1/0,randomize:!1};for(var n in e)t[n]=e[n];if(t.minTimeout>t.maxTimeout)throw Error(`minTimeout is greater than maxTimeout`);for(var r=[],i=0;i<t.retries;i++)r.push(this.createTimeout(i,t));return e&&e.forever&&!r.length&&r.push(this.createTimeout(i,t)),r.sort(function(e,t){return e-t}),r},e.createTimeout=function(e,t){var n=t.randomize?Math.random()+1:1,r=Math.round(n*Math.max(t.minTimeout,1)*t.factor**+e);return r=Math.min(r,t.maxTimeout),r},e.wrap=function(t,n,r){if(n instanceof Array&&(r=n,n=null),!r)for(var i in r=[],t)typeof t[i]==`function`&&r.push(i);for(var a=0;a<r.length;a++){var o=r[a],s=t[o];t[o]=function(r){var i=e.operation(n),a=Array.prototype.slice.call(arguments,1),o=a.pop();a.push(function(e){i.retry(e)||(e&&(arguments[0]=i.mainError()),o.apply(this,arguments))}),i.attempt(function(){r.apply(t,a)})}.bind(t,s),t[o].options=n}}})),i=e(((e,t)=>{t.exports=r()}));export{t as n,i as t};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as e}from"./dist-BdTs18CF.js";import{n as t,t as n}from"../../@vercel/sandbox/index.js";var r=e(((e,r)=>{var i=Object.defineProperty,a=Object.getOwnPropertyDescriptor,o=Object.getOwnPropertyNames,s=Object.prototype.hasOwnProperty,c=(e,t)=>{for(var n in t)i(e,n,{get:t[n],enumerable:!0})},l=(e,t,n,r)=>{if(t&&typeof t==`object`||typeof t==`function`)for(let c of o(t))!s.call(e,c)&&c!==n&&i(e,c,{get:()=>t[c],enumerable:!(r=a(t,c))||r.enumerable});return e},u=e=>l(i({},`__esModule`,{value:!0}),e),d={};c(d,{refreshToken:()=>m}),r.exports=u(d);var f=t(),p=n();async function m(e){let t=e?.project,n=e?.team;if(!t&&!n){let e=(0,p.findProjectInfo)();t=e.projectId,n=e.teamId}else if(!t||!n){let e=(0,p.findProjectInfo)();t??=e.projectId,n??=e.teamId}if(!t)throw new f.VercelOidcTokenError("Failed to refresh OIDC token: No project specified. Try re-linking your project with `vc link`");let r=(0,p.loadToken)(t);if(!r||(0,p.isExpired)((0,p.getTokenPayload)(r.token),e?.expirationBufferMs)){let i=await(0,p.getVercelToken)({expirationBufferMs:e?.expirationBufferMs});if(r=await(0,p.getVercelOidcToken)(i,t,n),!r)throw new f.VercelOidcTokenError(`Failed to refresh OIDC token`);(0,p.saveToken)(r,t)}process.env.VERCEL_OIDC_TOKEN=r.token}0&&(r.exports={refreshToken:m})}));export default r();export{};
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
interface NodeFileTraceResult {
|
|
2
|
-
readonly fileList: ReadonlySet<string>;
|
|
3
|
-
readonly warnings: ReadonlySet<Error>;
|
|
4
|
-
}
|
|
5
|
-
export declare function traceNodeEsmFiles(input: {
|
|
6
|
-
readonly base: string;
|
|
7
|
-
readonly entries: readonly string[];
|
|
8
|
-
readonly processCwd: string;
|
|
9
|
-
}): Promise<NodeFileTraceResult>;
|
|
10
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{createRequire}from"node:module";import{pathToFileURL}from"node:url";let nodeFileTraceModulePromise;async function loadNitroNodeFileTrace(){return nodeFileTraceModulePromise??=(async()=>await import(pathToFileURL(createRequire(createRequire(import.meta.url).resolve(`nitro/package.json`)).resolve(`@vercel/nft`)).href))(),await nodeFileTraceModulePromise}async function traceNodeEsmFiles(e){let{nodeFileTrace:t}=await loadNitroNodeFileTrace();return await t([...e.entries],{base:e.base,conditions:[`node`,`import`],processCwd:e.processCwd})}export{traceNodeEsmFiles};
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
export interface ResolvedAuthoredExternalModule {
|
|
2
|
-
readonly packageName: string;
|
|
3
|
-
readonly resolvedId: string;
|
|
4
|
-
}
|
|
5
|
-
export declare function materializeAuthoredExternalDependencies(input: {
|
|
6
|
-
readonly appRoot: string;
|
|
7
|
-
readonly externalModules: readonly ResolvedAuthoredExternalModule[];
|
|
8
|
-
readonly snapshotSourceRoot: string;
|
|
9
|
-
readonly sourceRoot: string;
|
|
10
|
-
}): Promise<string>;
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{constants}from"node:fs";import{dirname,isAbsolute,join,parse,relative,resolve,sep}from"node:path";import{copyFile,lstat,mkdir,readFile,readdir,readlink,realpath,rm,stat,symlink}from"node:fs/promises";import{createHash}from"node:crypto";import{traceNodeEsmFiles}from"#internal/bundler/nitro-node-file-trace.js";const COPY_MODE=constants.COPYFILE_FICLONE;async function materializeAuthoredExternalDependencies(e){if(e.externalModules.length===0)return createHash(`sha256`).digest(`hex`);let n=await realpath(e.sourceRoot),i=await realpath(e.appRoot),s=await resolveExternalPackages(e.externalModules),c=createHash(`sha256`),l=await traceExternalDependencyPaths(s,i),u=new Set,d=new Set;for(let t of s)await materializeDependencyDirectory({fingerprint:c,materializedDirectories:d,materializedPaths:u,snapshotSourceRoot:e.snapshotSourceRoot,sourcePath:t.packageRoot,sourceRoot:n});for(let t of l){let r=await findNearestPackageRoot(t);r!==void 0&&await materializeDependencyDirectory({fingerprint:c,materializedDirectories:d,materializedPaths:u,snapshotSourceRoot:e.snapshotSourceRoot,sourcePath:r,sourceRoot:n})}for(let t of l)await materializeTracedPath({fingerprint:c,materializedPaths:u,snapshotSourceRoot:e.snapshotSourceRoot,sourcePath:t,sourceRoot:n});for(let l of s){let s=toMaterializedPath({snapshotSourceRoot:e.snapshotSourceRoot,sourcePath:l.packageRoot,sourceRoot:n}),u=join(toMaterializedPath({snapshotSourceRoot:e.snapshotSourceRoot,sourcePath:i,sourceRoot:n}),`node_modules`,...l.packageName.split(`/`));resolve(u)!==resolve(s)&&(await rm(u,{force:!0,recursive:!0}),await mkdir(dirname(u),{recursive:!0}),await symlink(relative(dirname(u),s)||`.`,u,`junction`)),c.update(`package\0`).update(l.packageName).update(`\0`).update(toSemanticPath(l.packageRoot,n)).update(`\0`)}return c.digest(`hex`)}async function traceExternalDependencyPaths(e,t){let r=new Map;for(let t of e){let e=parse(t.resolvedId).root,n=normalizePathRoot(e),a=r.get(n)??{base:e,entries:[]};a.entries.push(t.resolvedId),r.set(n,a)}let a=new Set,s=[];for(let e of[...r.values()].sort((e,t)=>normalizePathRoot(e.base).localeCompare(normalizePathRoot(t.base)))){let r=await traceNodeEsmFiles({base:e.base,entries:e.entries.sort(),processCwd:t});s.push(...r.warnings);for(let t of r.fileList)a.add(isAbsolute(t)?t:resolve(e.base,t))}if(s.length>0){let e=s.map(e=>e.message).sort();throw Error(`Failed to trace the complete authored external dependency closure:\n${e.join(`
|
|
2
|
-
`)}`)}return[...a].sort((e,t)=>e.localeCompare(t))}async function materializeDependencyDirectory(e){let t=await realpath(e.sourcePath);if(!e.materializedDirectories.has(t)){e.materializedDirectories.add(t);for(let n of(await readdir(t,{withFileTypes:!0})).sort((e,t)=>e.name.localeCompare(t.name))){let i=join(t,n.name),a=await lstat(i);if(a.isDirectory()){await materializeDependencyDirectory({...e,sourcePath:i});continue}if(a.isSymbolicLink()){await materializeTracedPath({fingerprint:e.fingerprint,materializedPaths:e.materializedPaths,snapshotSourceRoot:e.snapshotSourceRoot,sourcePath:i,sourceRoot:e.sourceRoot});continue}await materializeTracedPath({fingerprint:e.fingerprint,materializedPaths:e.materializedPaths,snapshotSourceRoot:e.snapshotSourceRoot,sourcePath:i,sourceRoot:e.sourceRoot})}}}async function resolveExternalPackages(e){let t=new Map;for(let n of e){let e=await findPackageRoot(n.resolvedId,n.packageName),r=t.get(n.packageName);if(r!==void 0&&resolve(r.packageRoot)!==resolve(e))throw Error(`Authored external dependency "${n.packageName}" resolves to multiple package instances.`);t.set(n.packageName,{packageName:n.packageName,packageRoot:e,resolvedId:n.resolvedId})}return[...t.values()].sort((e,t)=>e.packageName.localeCompare(t.packageName))}async function findPackageRoot(e,n){let i=dirname(await realpath(e));for(;;){let a=join(i,`package.json`);try{if(JSON.parse(await readFile(a,`utf8`)).name===n)return i}catch(e){if(!(e instanceof Error&&`code`in e&&e.code===`ENOENT`))throw e}let o=dirname(i);if(o===i)throw Error(`Cannot find package root for authored external dependency "${n}" from "${e}".`);i=o}}async function findNearestPackageRoot(e){let n=await realpath(e),i=(await stat(n)).isDirectory()?n:dirname(n);for(;;){try{let e=JSON.parse(await readFile(join(i,`package.json`),`utf8`));if(typeof e.name==`string`&&e.name.length>0)return i}catch(e){if(!(e instanceof Error&&`code`in e&&e.code===`ENOENT`))throw e}let e=dirname(i);if(e===i)return;i=e}}async function materializeTracedPath(e){let n=toSemanticPath(e.sourcePath,e.sourceRoot);if(e.materializedPaths.has(n))return;e.materializedPaths.add(n);let r=toMaterializedPath(e),i=await lstat(e.sourcePath),s=toSemanticPath(e.sourcePath,e.sourceRoot);if(i.isSymbolicLink()){let n=await readlink(e.sourcePath),i=await realpath(resolve(dirname(e.sourcePath),n)),c=toMaterializedPath({snapshotSourceRoot:e.snapshotSourceRoot,sourcePath:i,sourceRoot:e.sourceRoot}),l=await stat(e.sourcePath);await rm(r,{force:!0,recursive:!0}),await mkdir(dirname(r),{recursive:!0}),await symlink(relative(dirname(r),c)||`.`,r,l.isDirectory()?`junction`:`file`),e.fingerprint.update(s).update(`\0link\0`).update(toSemanticPath(i,e.sourceRoot)).update(`\0`);return}if(!i.isFile())throw Error(`Unsupported traced authored dependency path "${e.sourcePath}".`);await mkdir(dirname(r),{recursive:!0}),await copyFile(e.sourcePath,r,COPY_MODE),e.fingerprint.update(s).update(`\0file\0`).update(await readFile(e.sourcePath)).update(`\0`)}function toMaterializedPath(e){if(isPathInsideOrEqual(e.sourcePath,e.sourceRoot))return join(e.snapshotSourceRoot,relative(e.sourceRoot,e.sourcePath));let t=parse(resolve(e.sourcePath)).root;return join(e.snapshotSourceRoot,`.eve`,`external-dependencies`,createPathRootKey(t),relative(t,e.sourcePath))}function toSemanticPath(e,t){if(isPathInsideOrEqual(e,t))return`source/${toPortablePath(relative(t,e))}`;let n=parse(resolve(e)).root;return`external/${createPathRootKey(n)}/${toPortablePath(relative(n,e))}`}function createPathRootKey(e){return createHash(`sha256`).update(normalizePathRoot(e)).digest(`hex`).slice(0,12)}function isPathInsideOrEqual(e,t){let r=relative(resolve(t),resolve(e));return!(isAbsolute(r)||r===`..`||r.startsWith(`..${sep}`)||r.startsWith(sep))}function normalizePathRoot(e){return toPortablePath(e).toLowerCase()}function toPortablePath(e){return e.split(sep).join(`/`)}export{materializeAuthoredExternalDependencies};
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import type { Nitro } from "nitro/types";
|
|
2
|
-
/**
|
|
3
|
-
* Starts capturing the dev bundler's live virtual-module map for `nitro`.
|
|
4
|
-
* Call once per dev Nitro instance, before its first build.
|
|
5
|
-
*/
|
|
6
|
-
export declare function captureDevLiveVirtualModules(nitro: Nitro): void;
|
|
7
|
-
/**
|
|
8
|
-
* Mirrors one virtual-module set into the captured dev bundler map: ids
|
|
9
|
-
* under `prefix` are replaced by `entries`. Returns `false` when no live
|
|
10
|
-
* map was captured (the caller should tell the user a restart is needed).
|
|
11
|
-
*/
|
|
12
|
-
export declare function replaceDevLiveVirtualModules(nitro: object, input: {
|
|
13
|
-
readonly entries: Readonly<Record<string, string>>;
|
|
14
|
-
readonly prefix: string;
|
|
15
|
-
}): boolean;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
const liveVirtualModuleMaps=new WeakMap;function captureDevLiveVirtualModules(t){t.hooks.hook(`rollup:before`,(n,r)=>{let i=findNitroVirtualModuleMap(r.plugins);i!==void 0&&liveVirtualModuleMaps.set(t,i)})}function replaceDevLiveVirtualModules(t,n){let r=liveVirtualModuleMaps.get(t);if(r===void 0)return!1;for(let e of r.keys())e.startsWith(n.prefix)&&r.delete(e);for(let[e,t]of Object.entries(n.entries))r.set(e,{module:{id:e,template:t},render:()=>t});return!0}function findNitroVirtualModuleMap(e){if(Array.isArray(e)){for(let t of e.flat(1/0))if(typeof t==`object`&&t&&t.name===`nitro:virtual`){let e=t.api;if(e!==void 0&&e.modules instanceof Map)return e.modules}}}export{captureDevLiveVirtualModules,replaceDevLiveVirtualModules};
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Default server-side packages that should stay external and be traced into
|
|
3
|
-
* hosted output, copied from Next.js' server-external-packages config.
|
|
4
|
-
*/
|
|
5
|
-
export declare const SERVER_EXTERNAL_PACKAGES: readonly ["@alinea/generated", "@appsignal/nodejs", "@aws-sdk/client-kms", "@aws-sdk/client-s3", "@aws-sdk/client-sso", "@aws-sdk/s3-presigned-post", "@blockfrost/blockfrost-js", "@datadog/flagging-core", "@highlight-run/node", "@huggingface/transformers", "@jpg-store/lucid-cardano", "@libsql/client", "@mikro-orm/core", "@mikro-orm/knex", "@node-rs/argon2", "@node-rs/bcrypt", "@prisma/client", "@react-pdf/renderer", "@sentry/profiling-node", "@smithy/util-stream", "@sparticuz/chromium", "@sparticuz/chromium-min", "@statsig/statsig-node-core", "@swc/core", "@xenova/transformers", "@zenstackhq/runtime", "argon2", "autoprefixer", "aws-crt", "bcrypt", "better-sqlite3", "canvas", "chromadb-default-embed", "config", "cpu-features", "cypress", "dd-trace", "eslint", "express", "firebase-admin", "htmlrewriter", "import-in-the-middle", "isolated-vm", "jest", "jsdom", "keyv", "libsql", "mdx-bundler", "mongodb", "mongoose", "newrelic", "next-mdx-remote", "next-seo", "node-cron", "node-pty", "node-web-audio-api", "onnxruntime-node", "oslo", "pg", "pino", "pino-pretty", "pino-roll", "playwright", "playwright-core", "postcss", "prettier", "prisma", "puppeteer", "puppeteer-core", "ravendb", "require-in-the-middle", "rimraf", "sharp", "shiki", "sqlite3", "thread-stream", "ts-morph", "ts-node", "typescript", "vscode-oniguruma", "webpack", "websocket", "zeromq"];
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
const SERVER_EXTERNAL_PACKAGES=`@alinea/generated.@appsignal/nodejs.@aws-sdk/client-kms.@aws-sdk/client-s3.@aws-sdk/client-sso.@aws-sdk/s3-presigned-post.@blockfrost/blockfrost-js.@datadog/flagging-core.@highlight-run/node.@huggingface/transformers.@jpg-store/lucid-cardano.@libsql/client.@mikro-orm/core.@mikro-orm/knex.@node-rs/argon2.@node-rs/bcrypt.@prisma/client.@react-pdf/renderer.@sentry/profiling-node.@smithy/util-stream.@sparticuz/chromium.@sparticuz/chromium-min.@statsig/statsig-node-core.@swc/core.@xenova/transformers.@zenstackhq/runtime.argon2.autoprefixer.aws-crt.bcrypt.better-sqlite3.canvas.chromadb-default-embed.config.cpu-features.cypress.dd-trace.eslint.express.firebase-admin.htmlrewriter.import-in-the-middle.isolated-vm.jest.jsdom.keyv.libsql.mdx-bundler.mongodb.mongoose.newrelic.next-mdx-remote.next-seo.node-cron.node-pty.node-web-audio-api.onnxruntime-node.oslo.pg.pino.pino-pretty.pino-roll.playwright.playwright-core.postcss.prettier.prisma.puppeteer.puppeteer-core.ravendb.require-in-the-middle.rimraf.sharp.shiki.sqlite3.thread-stream.ts-morph.ts-node.typescript.vscode-oniguruma.webpack.websocket.zeromq`.split(`.`);export{SERVER_EXTERNAL_PACKAGES};
|