eve 0.31.0 → 0.31.2
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 +15 -0
- package/dist/src/channel/cross-channel-receive.d.ts +1 -1
- package/dist/src/compiled/.vendor-stamp.json +6 -6
- package/dist/src/compiled/@workflow/core/_quickjs-wasi.d.ts +8 -0
- package/dist/src/compiled/@workflow/core/correlation-id.d.ts +109 -0
- package/dist/src/compiled/@workflow/core/events-consumer.d.ts +1 -0
- package/dist/src/compiled/@workflow/core/index.js +2 -2
- package/dist/src/compiled/@workflow/core/private.d.ts +17 -1
- package/dist/src/compiled/@workflow/core/private.js +1 -1
- package/dist/src/compiled/@workflow/core/runtime/constants.d.ts +19 -0
- package/dist/src/compiled/@workflow/core/runtime/deployment-guard.d.ts +99 -0
- package/dist/src/compiled/@workflow/core/runtime/quickjs-assets.generated.d.ts +14 -0
- package/dist/src/compiled/@workflow/core/runtime/quickjs-entrypoint.d.ts +124 -0
- package/dist/src/compiled/@workflow/core/runtime/quickjs-runtime.d.ts +193 -0
- package/dist/src/compiled/@workflow/core/runtime/run.d.ts +2 -0
- package/dist/src/compiled/@workflow/core/runtime/runs.d.ts +18 -1
- package/dist/src/compiled/@workflow/core/runtime/suspension-handler.d.ts +7 -0
- package/dist/src/compiled/@workflow/core/runtime/vm-mode.d.ts +44 -0
- package/dist/src/compiled/@workflow/core/runtime/vm-serde-bundle.generated.d.ts +14 -0
- package/dist/src/compiled/@workflow/core/runtime.d.ts +1 -1
- package/dist/src/compiled/@workflow/core/runtime.js +3 -3
- package/dist/src/compiled/@workflow/core/serialization/codec-devalue-vm.d.ts +9 -0
- package/dist/src/compiled/@workflow/core/serialization/reducers/class-vm.d.ts +20 -0
- package/dist/src/compiled/@workflow/core/serialization/reducers/common-vm.d.ts +15 -0
- package/dist/src/compiled/@workflow/core/serialization/reducers/step-function-vm.d.ts +44 -0
- package/dist/src/compiled/@workflow/core/serialization/vm-bundle-entry.d.ts +12 -0
- package/dist/src/compiled/@workflow/core/serialization/workflow-vm.d.ts +24 -0
- package/dist/src/compiled/@workflow/core/serialization.d.ts +2 -1
- package/dist/src/compiled/@workflow/core/source-map.d.ts +20 -0
- package/dist/src/compiled/@workflow/core/telemetry/semantic-conventions.d.ts +78 -0
- package/dist/src/compiled/@workflow/core/telemetry.d.ts +5 -0
- package/dist/src/compiled/@workflow/core/version.d.ts +1 -1
- package/dist/src/compiled/@workflow/core/workflow.js +1 -1
- package/dist/src/compiled/@workflow/errors/error-codes.d.ts +2 -0
- package/dist/src/compiled/@workflow/errors/index.d.ts +24 -0
- package/dist/src/compiled/@workflow/errors/index.js +1 -1
- package/dist/src/compiled/@workflow/world/analytics.d.ts +2 -0
- package/dist/src/compiled/@workflow/world/events.d.ts +51 -1
- package/dist/src/compiled/@workflow/world/hooks.d.ts +1 -0
- package/dist/src/compiled/@workflow/world/index.d.ts +1 -1
- package/dist/src/compiled/@workflow/world/interfaces.d.ts +28 -1
- package/dist/src/compiled/@workflow/world/queue.d.ts +8 -0
- package/dist/src/compiled/@workflow/world/runs.d.ts +83 -0
- package/dist/src/compiled/@workflow/world-local/index.js +5 -4
- package/dist/src/compiled/@workflow/world-vercel/index.js +15 -15
- package/dist/src/compiled/_chunks/workflow/_eve-core-quickjs-entrypoint-stub-qIV0OaFz.js +1 -0
- package/dist/src/compiled/_chunks/workflow/{attribute-changes-DROfGk6l.js → attribute-changes-Du5ztewf.js} +2 -2
- package/dist/src/compiled/_chunks/workflow/{dist-D5bR13zs.js → dist-CNXUKQCp.js} +1 -1
- package/dist/src/compiled/_chunks/workflow/dist-CRTn4Sg8.js +3 -0
- package/dist/src/compiled/_chunks/workflow/dist-tJoQXAF6.js +1 -0
- package/dist/src/compiled/_chunks/workflow/functions-ClJbpZhR.js +1 -0
- package/dist/src/compiled/_chunks/workflow/{private-BcwCGTV5.js → private-CiWVdS5v.js} +1 -1
- package/dist/src/compiled/_chunks/workflow/resume-hook-CT0keOww.js +1 -0
- package/dist/src/compiled/_chunks/workflow/run-DBheaFhH.js +1 -0
- package/dist/src/compiled/_chunks/workflow/signal-exit-C8vsI6zj.js +1 -0
- package/dist/src/compiled/_chunks/workflow/sleep-BeH4B0Cd.js +1 -0
- package/dist/src/compiled/_chunks/workflow/{token-hiUWkDKe.js → token-DtCUEpJs.js} +1 -1
- package/dist/src/compiled/_chunks/workflow/{token-util-DURSL1l8.js → token-util-DNwIAn_u.js} +9 -9
- package/dist/src/compiled/_chunks/workflow/undici-CUIybhQ2.js +95 -0
- package/dist/src/compiled/_chunks/workflow/wait-until-CMX5LUWJ.js +15 -0
- package/dist/src/compiler/extension-compatibility.d.ts +2 -2
- package/dist/src/compiler/extension-compatibility.js +1 -1
- package/dist/src/context/container.d.ts +3 -0
- package/dist/src/context/container.js +1 -1
- package/dist/src/discover/filesystem.js +1 -1
- package/dist/src/execution/parked-delivery-wait.js +1 -1
- package/dist/src/execution/session-command-inbox.d.ts +11 -3
- package/dist/src/execution/session-command-wire.d.ts +24 -0
- package/dist/src/execution/session-command-wire.js +1 -0
- package/dist/src/execution/turn-control-receiver.js +1 -1
- package/dist/src/execution/workflow-runtime.js +1 -1
- package/dist/src/execution/workflow-steps.js +1 -1
- package/dist/src/harness/authorization.d.ts +8 -0
- package/dist/src/harness/authorization.js +1 -1
- package/dist/src/internal/application/package.js +1 -1
- package/dist/src/internal/nitro/dev-runtime-source-snapshot-copy.js +1 -1
- package/dist/src/internal/nitro/host/dev-authored-source-watcher.js +1 -1
- package/dist/src/public/definitions/tool.d.ts +18 -14
- 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/setup/scaffold/create/project.js +1 -1
- package/docs/guides/meta.json +2 -1
- package/docs/guides/remote-agents.md +6 -4
- package/docs/guides/ucp.mdx +181 -0
- package/package.json +6 -6
- package/dist/src/compiled/_chunks/workflow/dist-B-vbuNqP.js +0 -1
- package/dist/src/compiled/_chunks/workflow/dist-dNxTT6nO.js +0 -3
- package/dist/src/compiled/_chunks/workflow/functions-CiVUVDNB.js +0 -1
- package/dist/src/compiled/_chunks/workflow/resume-hook-bc-OQVI0.js +0 -1
- package/dist/src/compiled/_chunks/workflow/run-DM3ouA3U.js +0 -1
- package/dist/src/compiled/_chunks/workflow/sleep-D5iWly6-.js +0 -1
- package/dist/src/compiled/_chunks/workflow/undici-DWL_MYmT.js +0 -95
- package/dist/src/compiled/_chunks/workflow/wait-until-DoW76jdb.js +0 -15
|
@@ -0,0 +1,193 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* QuickJS WASM workflow VM.
|
|
3
|
+
*
|
|
4
|
+
* An alternative engine for the event-replay execution model: the workflow
|
|
5
|
+
* code runs inside a QuickJS WASM VM (via quickjs-wasi) instead of a
|
|
6
|
+
* `node:vm` context. Every invocation creates a fresh VM, re-executes the
|
|
7
|
+
* workflow function from the top, and replays the recorded event log to
|
|
8
|
+
* resolve awaited primitives — the same replay semantics as the `node:vm`
|
|
9
|
+
* engine.
|
|
10
|
+
*
|
|
11
|
+
* The workflow primitives (useStep, sleep, createHook) are implemented as
|
|
12
|
+
* JavaScript code running inside the QuickJS VM. The host communicates with
|
|
13
|
+
* the VM by evaluating small JS snippets to read pending operations and
|
|
14
|
+
* resolve/reject promises.
|
|
15
|
+
*
|
|
16
|
+
* The VM bootstrap is deliberately split into two phases:
|
|
17
|
+
* 1. Static initialization (`initWorkflowVM`) — run-independent setup:
|
|
18
|
+
* VM creation, the serde bundle, and the workflow primitives.
|
|
19
|
+
* 2. Per-run initialization (inline in `runQuickJSWorkflow`) — seeded
|
|
20
|
+
* PRNG/ULID host functions, workflow bundle evaluation, run metadata,
|
|
21
|
+
* workflow input, and start.
|
|
22
|
+
* Keeping the phases separate is groundwork for VM-memory snapshotting:
|
|
23
|
+
* a follow-up can persist/restore the VM at the phase boundary (e.g. a
|
|
24
|
+
* build-time initial snapshot) without restructuring this module. Note
|
|
25
|
+
* that bundle evaluation currently sits in the per-run phase so that
|
|
26
|
+
* module-scope user code observes the seeded `Math.random`, matching the
|
|
27
|
+
* `node:vm` engine's replay determinism.
|
|
28
|
+
*/
|
|
29
|
+
import type { Event, RunInput, WorkflowRun, WorldCapabilities } from '#compiled/@workflow/world/index.js';
|
|
30
|
+
import type { DecryptionKey } from '../serialization/encryption.js';
|
|
31
|
+
export interface PendingStep {
|
|
32
|
+
type: 'step';
|
|
33
|
+
correlationId: string;
|
|
34
|
+
stepId: string;
|
|
35
|
+
/** Format-prefixed devalue-serialized step input (args + closureVars) */
|
|
36
|
+
input: Uint8Array;
|
|
37
|
+
/** Whether a step_created event already exists for this step */
|
|
38
|
+
hasCreatedEvent: boolean;
|
|
39
|
+
}
|
|
40
|
+
export interface PendingWait {
|
|
41
|
+
type: 'wait';
|
|
42
|
+
correlationId: string;
|
|
43
|
+
/** ISO string of when to resume */
|
|
44
|
+
resumeAt: string;
|
|
45
|
+
/** Whether a wait_created event already exists for this wait */
|
|
46
|
+
hasCreatedEvent: boolean;
|
|
47
|
+
}
|
|
48
|
+
export interface PendingHook {
|
|
49
|
+
type: 'hook';
|
|
50
|
+
correlationId: string;
|
|
51
|
+
token: string;
|
|
52
|
+
/** Earliest token reuse time, as milliseconds since the Unix epoch. */
|
|
53
|
+
tokenRetentionUntil?: number;
|
|
54
|
+
isWebhook: boolean;
|
|
55
|
+
metadata?: unknown;
|
|
56
|
+
hasCreatedEvent: boolean;
|
|
57
|
+
/**
|
|
58
|
+
* True for internal system hooks (e.g. AbortController's hook), which
|
|
59
|
+
* are exempt from user-hook token namespace conflict checks.
|
|
60
|
+
*/
|
|
61
|
+
isSystem?: boolean;
|
|
62
|
+
/**
|
|
63
|
+
* Set when the workflow called AbortController.abort() during this
|
|
64
|
+
* invocation. The host must record the abort: create a hook_received
|
|
65
|
+
* event carrying `abortPayload` and write/close the abort stream.
|
|
66
|
+
*/
|
|
67
|
+
abortRequested?: boolean;
|
|
68
|
+
/** VM-serialized `{ aborted: true, reason }` payload for the abort. */
|
|
69
|
+
abortPayload?: Uint8Array;
|
|
70
|
+
/** Set by the completion drain when a system hook is implicitly disposed. */
|
|
71
|
+
disposed?: boolean;
|
|
72
|
+
/**
|
|
73
|
+
* True when the workflow is awaiting hook.getConflict() for this hook.
|
|
74
|
+
* The entrypoint re-invokes the workflow right after writing
|
|
75
|
+
* hook_created so replay can confirm creation and resolve the awaiter.
|
|
76
|
+
*/
|
|
77
|
+
hasGetConflictAwaiter?: boolean;
|
|
78
|
+
}
|
|
79
|
+
export interface PendingAttribute {
|
|
80
|
+
type: 'attribute';
|
|
81
|
+
correlationId: string;
|
|
82
|
+
/** Normalized attribute changes (plain JSON-able objects) */
|
|
83
|
+
changes: unknown[];
|
|
84
|
+
allowReservedAttributes?: boolean;
|
|
85
|
+
/** Whether an attr_set event already exists for this write */
|
|
86
|
+
hasCreatedEvent: boolean;
|
|
87
|
+
}
|
|
88
|
+
export interface PendingHookDispose {
|
|
89
|
+
type: 'hook_dispose';
|
|
90
|
+
correlationId: string;
|
|
91
|
+
/**
|
|
92
|
+
* Token of the hook being disposed. Used by the entrypoint to order
|
|
93
|
+
* same-token hook operations sequentially in code order.
|
|
94
|
+
*/
|
|
95
|
+
token?: string;
|
|
96
|
+
hasCreatedEvent: boolean;
|
|
97
|
+
}
|
|
98
|
+
export type PendingOperation = PendingStep | PendingWait | PendingHook | PendingAttribute | PendingHookDispose;
|
|
99
|
+
export interface QuickJSRuntimeResult {
|
|
100
|
+
/** The workflow completed — result is format-prefixed devalue bytes */
|
|
101
|
+
completed?: {
|
|
102
|
+
result: Uint8Array;
|
|
103
|
+
/**
|
|
104
|
+
* Leftover pending operations that still need durable side effects at
|
|
105
|
+
* completion: abort recordings, system-hook disposals, fire-and-forget
|
|
106
|
+
* attribute/hook/step events. Mirrors the node:vm engine's
|
|
107
|
+
* drainPendingQueueItems. The entrypoint dispatches these WITHOUT
|
|
108
|
+
* queueing steps or requeuing the run.
|
|
109
|
+
*/
|
|
110
|
+
drainOperations?: PendingOperation[];
|
|
111
|
+
};
|
|
112
|
+
/** The workflow suspended with pending operations */
|
|
113
|
+
suspended?: {
|
|
114
|
+
pendingOperations: PendingOperation[];
|
|
115
|
+
};
|
|
116
|
+
/** The workflow failed */
|
|
117
|
+
failed?: {
|
|
118
|
+
message: string;
|
|
119
|
+
stack?: string;
|
|
120
|
+
name?: string;
|
|
121
|
+
/** See completed.drainOperations — same semantics on failure. */
|
|
122
|
+
drainOperations?: PendingOperation[];
|
|
123
|
+
/**
|
|
124
|
+
* Format-prefixed devalue bytes of the original thrown value
|
|
125
|
+
* (Error subclass with cause chain, plain object, primitive, etc.).
|
|
126
|
+
* Set when the VM-side rejection handler successfully serializes
|
|
127
|
+
* the thrown value. The host uses these bytes to reconstruct the
|
|
128
|
+
* original value through the standard error hydration pipeline,
|
|
129
|
+
* preserving type identity (TypeError, FatalError) and non-Error
|
|
130
|
+
* throws verbatim. Falls back to the message/stack/name fields
|
|
131
|
+
* when this is undefined (e.g. extractError pseudo-failures).
|
|
132
|
+
*/
|
|
133
|
+
valueBytes?: Uint8Array;
|
|
134
|
+
};
|
|
135
|
+
}
|
|
136
|
+
export interface QuickJSRuntimeOptions {
|
|
137
|
+
/** The compiled workflow bundle code (workflow mode output from SWC) */
|
|
138
|
+
workflowCode: string;
|
|
139
|
+
/** The workflow ID (e.g. "workflow//./workflows/1_simple//simple") */
|
|
140
|
+
workflowId: string;
|
|
141
|
+
/** The workflow run entity */
|
|
142
|
+
workflowRun: WorkflowRun;
|
|
143
|
+
/** Features supported by the World executing this workflow. */
|
|
144
|
+
worldCapabilities?: WorldCapabilities;
|
|
145
|
+
/**
|
|
146
|
+
* The full event log for the run. Every invocation replays the complete
|
|
147
|
+
* log from the start (same replay semantics as the `node:vm` engine).
|
|
148
|
+
*/
|
|
149
|
+
events: Event[];
|
|
150
|
+
/** Encryption key for decrypting event payloads (undefined if unencrypted) */
|
|
151
|
+
encryptionKey?: DecryptionKey;
|
|
152
|
+
/**
|
|
153
|
+
* The local port the workflow server is listening on, used to populate
|
|
154
|
+
* `workflowMetadata.url`. Resolved at call time on the host side so the
|
|
155
|
+
* VM doesn't have to probe the filesystem. Ignored on Vercel — VERCEL_URL
|
|
156
|
+
* takes precedence there.
|
|
157
|
+
*/
|
|
158
|
+
port?: number;
|
|
159
|
+
/**
|
|
160
|
+
* Fallback workflow input from the queue message's resilient-start
|
|
161
|
+
* payload. Used when the fetched event log lacks a `run_created` event
|
|
162
|
+
* (eventually-consistent read after the parent's start() wrote it).
|
|
163
|
+
*/
|
|
164
|
+
runInput?: RunInput;
|
|
165
|
+
}
|
|
166
|
+
/**
|
|
167
|
+
* A live QuickJS workflow invocation. When the initial `result` is
|
|
168
|
+
* `suspended`, the VM is kept alive so the caller can feed newly recorded
|
|
169
|
+
* events (e.g. terminal events of inline-executed steps) into the SAME VM
|
|
170
|
+
* via `continueWithEvents` — resuming execution exactly where it left off
|
|
171
|
+
* without a fresh-VM re-replay. Terminal results dispose the VM
|
|
172
|
+
* automatically; `dispose()` must be called when abandoning a suspended
|
|
173
|
+
* session (idempotent).
|
|
174
|
+
*/
|
|
175
|
+
export interface QuickJSWorkflowSession {
|
|
176
|
+
result: QuickJSRuntimeResult;
|
|
177
|
+
/**
|
|
178
|
+
* Process newly recorded events in the live VM and re-evaluate the
|
|
179
|
+
* workflow state. Only valid while the last result was `suspended`.
|
|
180
|
+
* Resets the VM's interrupt budget for the new execution burst.
|
|
181
|
+
*/
|
|
182
|
+
continueWithEvents(newEvents: Event[]): Promise<QuickJSRuntimeResult>;
|
|
183
|
+
/** Dispose the VM if it is still alive. Safe to call multiple times. */
|
|
184
|
+
dispose(): void;
|
|
185
|
+
}
|
|
186
|
+
/**
|
|
187
|
+
* Run a workflow invocation to its first settled state and dispose the
|
|
188
|
+
* VM. Convenience wrapper over {@link startQuickJSWorkflow} for callers
|
|
189
|
+
* (and tests) that don't use live-VM continuation.
|
|
190
|
+
*/
|
|
191
|
+
export declare function runQuickJSWorkflow(options: QuickJSRuntimeOptions): Promise<QuickJSRuntimeResult>;
|
|
192
|
+
export declare function startQuickJSWorkflow(options: QuickJSRuntimeOptions): Promise<QuickJSWorkflowSession>;
|
|
193
|
+
//# sourceMappingURL=quickjs-runtime.d.ts.map
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { WORKFLOW_DESERIALIZE, WORKFLOW_SERIALIZE } from '../_workflow-serde.js';
|
|
2
2
|
import { type WorkflowRunStatus } from '#compiled/@workflow/world/index.js';
|
|
3
3
|
import { type CancelRunOptions, type StopSleepOptions, type StopSleepResult } from './runs.js';
|
|
4
|
+
/** @internal */
|
|
5
|
+
export declare function getReturnValuePollIntervalMs(): number;
|
|
4
6
|
/**
|
|
5
7
|
* A `ReadableStream` extended with workflow-specific helpers.
|
|
6
8
|
*/
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type World } from '#compiled/@workflow/world/index.js';
|
|
1
|
+
import { type BulkCancelWorkflowRunsResult, type World } from '#compiled/@workflow/world/index.js';
|
|
2
2
|
export interface RecreateRunOptions {
|
|
3
3
|
deploymentId?: string;
|
|
4
4
|
specVersion?: number;
|
|
@@ -64,6 +64,23 @@ export declare function recreateRunFromExisting(world: World, runId: string, opt
|
|
|
64
64
|
* free-text reason (max 512 chars) on the run_cancelled event.
|
|
65
65
|
*/
|
|
66
66
|
export declare function cancelRun(world: World, runId: string, options?: CancelRunOptions): Promise<void>;
|
|
67
|
+
/**
|
|
68
|
+
* Cancel many runs in one call.
|
|
69
|
+
*
|
|
70
|
+
* Fast path: if the world implements `runs.cancelMany`, the whole batch is
|
|
71
|
+
* delegated to it in a single operation (one backend round-trip on
|
|
72
|
+
* `@workflow/world-vercel`).
|
|
73
|
+
*
|
|
74
|
+
* Fallback: for worlds without `cancelMany`, this issues single-run
|
|
75
|
+
* `cancelRun()` calls with at most {@link CANCEL_RUNS_FALLBACK_CONCURRENCY}
|
|
76
|
+
* in flight at a time. Fallback successes are reported as `cancelled`;
|
|
77
|
+
* failures are reported as `failed` with `code: 'internal_error'` and
|
|
78
|
+
* `retryable: true` — deliberately without per-world error classification.
|
|
79
|
+
*
|
|
80
|
+
* @throws if `runIds` is empty, contains duplicates, or exceeds
|
|
81
|
+
* {@link BULK_CANCEL_MAX_RUN_IDS}.
|
|
82
|
+
*/
|
|
83
|
+
export declare function cancelRuns(world: World, runIds: string[], options?: CancelRunOptions): Promise<BulkCancelWorkflowRunsResult>;
|
|
67
84
|
/**
|
|
68
85
|
* Re-enqueue a workflow run.
|
|
69
86
|
*/
|
|
@@ -98,6 +98,13 @@ export interface SuspensionHandlerResult {
|
|
|
98
98
|
* durably creating the user's hooks doesn't count as runtime overhead.
|
|
99
99
|
*/
|
|
100
100
|
hookCreationMs: number;
|
|
101
|
+
/**
|
|
102
|
+
* Whether serializing this suspension's new step inputs was passive (did
|
|
103
|
+
* not execute workflow-owned code such as getters, proxy traps, or custom
|
|
104
|
+
* serializers). `false` means the retained VM may have diverged from what
|
|
105
|
+
* a cold replay would compute, so the caller must demote to replay.
|
|
106
|
+
*/
|
|
107
|
+
retainedStepInputsSafe: boolean;
|
|
101
108
|
}
|
|
102
109
|
/**
|
|
103
110
|
* Handles a workflow suspension by processing all pending operations (hooks, steps, waits).
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* VM engine selection for workflow execution.
|
|
3
|
+
*
|
|
4
|
+
* The Node.js `node:vm` engine is the default. The QuickJS WASM engine is
|
|
5
|
+
* opt-in via the `WORKFLOW_VM` env var or `executionContext.workflowVm`.
|
|
6
|
+
*
|
|
7
|
+
* Both engines implement the same event-replay execution model: on every
|
|
8
|
+
* workflow handler invocation the workflow function is re-executed from the
|
|
9
|
+
* top and the recorded event log resolves awaited primitives. The QuickJS
|
|
10
|
+
* engine runs the workflow code in a QuickJS WASM VM (via quickjs-wasi)
|
|
11
|
+
* instead of a `node:vm` context, which makes it usable on platforms that
|
|
12
|
+
* do not implement `node:vm` (e.g. Cloudflare Workers) and is the
|
|
13
|
+
* foundation for VM-memory snapshotting.
|
|
14
|
+
*/
|
|
15
|
+
import type { WorkflowRun } from '#compiled/@workflow/world/index.js';
|
|
16
|
+
/**
|
|
17
|
+
* Known workflow VM engines. Any other `WORKFLOW_VM` value is treated as
|
|
18
|
+
* a misconfiguration and rejected at startup.
|
|
19
|
+
*/
|
|
20
|
+
export declare const WORKFLOW_VMS: readonly ["node", "quickjs"];
|
|
21
|
+
export type WorkflowVmMode = (typeof WORKFLOW_VMS)[number];
|
|
22
|
+
/**
|
|
23
|
+
* Read and validate the `WORKFLOW_VM` env var.
|
|
24
|
+
*
|
|
25
|
+
* Returns the configured engine, or `undefined` if unset/empty.
|
|
26
|
+
* Throws {@link WorkflowRuntimeError} if the value is set but not one of
|
|
27
|
+
* the known engines — catching misconfiguration early is better than
|
|
28
|
+
* silently falling back to the default.
|
|
29
|
+
*/
|
|
30
|
+
export declare function getWorkflowVmFromEnv(env?: NodeJS.ProcessEnv): WorkflowVmMode | undefined;
|
|
31
|
+
/**
|
|
32
|
+
* Whether to use the QuickJS WASM VM for a given run.
|
|
33
|
+
*
|
|
34
|
+
* The run's `executionContext.workflowVm` (stamped by the SDK at `start()`
|
|
35
|
+
* when `WORKFLOW_VM` is set on the client) takes precedence so a run keeps
|
|
36
|
+
* executing on the engine it started on. When the run doesn't specify an
|
|
37
|
+
* engine, the `WORKFLOW_VM` env var on the workflow handler decides.
|
|
38
|
+
* The default is the `node:vm` engine.
|
|
39
|
+
*
|
|
40
|
+
* Throws if `WORKFLOW_VM` or `executionContext.workflowVm` is set to an
|
|
41
|
+
* unknown value.
|
|
42
|
+
*/
|
|
43
|
+
export declare function useQuickJSVm(workflowRun: WorkflowRun): boolean;
|
|
44
|
+
//# sourceMappingURL=vm-mode.d.ts.map
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Auto-generated by scripts/build-vm-serde-bundle.js
|
|
3
|
+
* Do not edit manually.
|
|
4
|
+
*
|
|
5
|
+
* This is the VM serialization bundle — a self-contained IIFE that sets up
|
|
6
|
+
* the serialize/deserialize functions inside the QuickJS WASM VM. It
|
|
7
|
+
* includes devalue and all workflow-mode reducers/revivers. (TextEncoder,
|
|
8
|
+
* TextDecoder, and Headers are provided by quickjs-wasi's native C
|
|
9
|
+
* extensions — no JS polyfills are bundled.)
|
|
10
|
+
*
|
|
11
|
+
* Size: 25.6 KB minified
|
|
12
|
+
*/
|
|
13
|
+
export declare const VM_SERDE_BUNDLE: string;
|
|
14
|
+
//# sourceMappingURL=vm-serde-bundle.generated.d.ts.map
|
|
@@ -4,7 +4,7 @@ export { WorkflowSuspension } from './global.js';
|
|
|
4
4
|
export { type HealthCheckOptions, type HealthCheckResult, healthCheck, } from './runtime/helpers.js';
|
|
5
5
|
export { getHookByToken, type ResumedHook, resumeHook, resumeWebhook, } from './runtime/resume-hook.js';
|
|
6
6
|
export { getRun, Run, type WorkflowReadableStream, type WorkflowReadableStreamOptions, } from './runtime/run.js';
|
|
7
|
-
export { type CancelRunOptions, cancelRun, listStreams, type ReadStreamOptions, type RecreateRunOptions, type ReenqueueRunOptions, readStream, recreateRunFromExisting, reenqueueRun, type StopSleepOptions, type StopSleepResult, wakeUpRun, } from './runtime/runs.js';
|
|
7
|
+
export { type CancelRunOptions, cancelRun, cancelRuns, listStreams, type ReadStreamOptions, type RecreateRunOptions, type ReenqueueRunOptions, readStream, recreateRunFromExisting, reenqueueRun, type StopSleepOptions, type StopSleepResult, wakeUpRun, } from './runtime/runs.js';
|
|
8
8
|
export { type StartOptions, type StartOptionsBase, type StartOptionsWithDeploymentId, type StartOptionsWithoutDeploymentId, start, } from './runtime/start.js';
|
|
9
9
|
export { createWorld, createWorldFromModule, getWorld, getWorldHandlers, setWorld, type WorldFactoryModule, } from './runtime/world.js';
|
|
10
10
|
/**
|