@workflow/core 5.0.0-beta.40 → 5.0.0-beta.42
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/dist/events-consumer.d.ts +224 -6
- package/dist/events-consumer.d.ts.map +1 -1
- package/dist/events-consumer.js +497 -50
- package/dist/private.d.ts +87 -18
- package/dist/private.d.ts.map +1 -1
- package/dist/private.js +118 -47
- package/dist/runtime/constants.d.ts +50 -1
- package/dist/runtime/constants.d.ts.map +1 -1
- package/dist/runtime/constants.js +59 -3
- package/dist/runtime/helpers.d.ts +212 -70
- package/dist/runtime/helpers.d.ts.map +1 -1
- package/dist/runtime/helpers.js +275 -86
- package/dist/runtime/quickjs-assets.generated.d.ts.map +1 -1
- package/dist/runtime/quickjs-assets.generated.js +2 -2
- package/dist/runtime/quickjs-entrypoint.d.ts +8 -9
- package/dist/runtime/quickjs-entrypoint.d.ts.map +1 -1
- package/dist/runtime/quickjs-entrypoint.js +172 -41
- package/dist/runtime/quickjs-runtime.d.ts +36 -1
- package/dist/runtime/quickjs-runtime.d.ts.map +1 -1
- package/dist/runtime/quickjs-runtime.js +613 -185
- package/dist/runtime/quickjs-serde.d.ts +107 -0
- package/dist/runtime/quickjs-serde.d.ts.map +1 -0
- package/dist/runtime/quickjs-serde.js +2098 -0
- package/dist/runtime/replay-budget.d.ts +13 -14
- package/dist/runtime/replay-budget.d.ts.map +1 -1
- package/dist/runtime/replay-budget.js +20 -73
- package/dist/runtime/resume-hook.d.ts.map +1 -1
- package/dist/runtime/resume-hook.js +57 -13
- package/dist/runtime/resume-latency.d.ts +143 -0
- package/dist/runtime/resume-latency.d.ts.map +1 -0
- package/dist/runtime/resume-latency.js +153 -0
- package/dist/runtime/runs.d.ts.map +1 -1
- package/dist/runtime/runs.js +3 -4
- package/dist/runtime/start.js +2 -7
- package/dist/runtime/step-executor.d.ts +27 -12
- package/dist/runtime/step-executor.d.ts.map +1 -1
- package/dist/runtime/step-executor.js +105 -15
- package/dist/runtime/suspension-handler.d.ts +46 -8
- package/dist/runtime/suspension-handler.d.ts.map +1 -1
- package/dist/runtime/suspension-handler.js +173 -15
- package/dist/runtime/world-compatibility.d.ts +16 -0
- package/dist/runtime/world-compatibility.d.ts.map +1 -1
- package/dist/runtime/world-compatibility.js +26 -5
- package/dist/runtime.d.ts.map +1 -1
- package/dist/runtime.js +911 -524
- package/dist/serialization/codec-devalue-vm.d.ts +7 -0
- package/dist/serialization/codec-devalue-vm.d.ts.map +1 -1
- package/dist/serialization/codec-devalue-vm.js +12 -1
- package/dist/serialization/codec-devalue.d.ts.map +1 -1
- package/dist/serialization/codec-devalue.js +15 -4
- package/dist/serialization/workflow-vm.d.ts +8 -3
- package/dist/serialization/workflow-vm.d.ts.map +1 -1
- package/dist/serialization/workflow-vm.js +9 -4
- package/dist/serialization.d.ts.map +1 -1
- package/dist/serialization.js +8 -3
- package/dist/step.js +2 -2
- package/dist/telemetry/semantic-conventions.d.ts +104 -0
- package/dist/telemetry/semantic-conventions.d.ts.map +1 -1
- package/dist/telemetry/semantic-conventions.js +84 -1
- package/dist/test-support/orchestrator-context.d.ts +25 -0
- package/dist/test-support/orchestrator-context.d.ts.map +1 -0
- package/dist/test-support/orchestrator-context.js +91 -0
- package/dist/version.d.ts +1 -1
- package/dist/version.js +2 -2
- package/dist/vm/index.d.ts.map +1 -1
- package/dist/vm/index.js +9 -6
- package/dist/workflow/abort-controller.d.ts.map +1 -1
- package/dist/workflow/abort-controller.js +4 -6
- package/dist/workflow/attribute-dispatcher.js +2 -2
- package/dist/workflow/hook.js +2 -2
- package/dist/workflow/sleep.js +2 -2
- package/dist/workflow.d.ts +10 -0
- package/dist/workflow.d.ts.map +1 -1
- package/dist/workflow.js +94 -20
- package/docs/how-it-works/event-sourcing.mdx +11 -3
- package/package.json +7 -7
- package/dist/correlation-id.d.ts +0 -109
- package/dist/correlation-id.d.ts.map +0 -1
- package/dist/correlation-id.js +0 -139
- package/dist/serialization/vm-bundle-entry.d.ts +0 -12
- package/dist/serialization/vm-bundle-entry.d.ts.map +0 -1
- package/dist/serialization/vm-bundle-entry.js +0 -58
|
@@ -15,7 +15,9 @@
|
|
|
15
15
|
*
|
|
16
16
|
* The VM bootstrap is deliberately split into two phases:
|
|
17
17
|
* 1. Static initialization (`initWorkflowVM`) — run-independent setup:
|
|
18
|
-
* VM creation
|
|
18
|
+
* VM creation and the workflow primitives. (Serialization lives on
|
|
19
|
+
* the host — see quickjs-serde.ts — so no serde code is evaluated
|
|
20
|
+
* in the VM.)
|
|
19
21
|
* 2. Per-run initialization (inline in `runQuickJSWorkflow`) — seeded
|
|
20
22
|
* PRNG/ULID host functions, workflow bundle evaluation, run metadata,
|
|
21
23
|
* workflow input, and start.
|
|
@@ -27,6 +29,7 @@
|
|
|
27
29
|
* `node:vm` engine's replay determinism.
|
|
28
30
|
*/
|
|
29
31
|
import type { Event, RunInput, WorkflowRun, WorldCapabilities } from '@workflow/world';
|
|
32
|
+
import { type Snapshot } from 'quickjs-wasi';
|
|
30
33
|
import type { DecryptionKey } from '../serialization/encryption.js';
|
|
31
34
|
export interface PendingStep {
|
|
32
35
|
type: 'step';
|
|
@@ -163,6 +166,37 @@ export interface QuickJSRuntimeOptions {
|
|
|
163
166
|
*/
|
|
164
167
|
runInput?: RunInput;
|
|
165
168
|
}
|
|
169
|
+
/**
|
|
170
|
+
* Eval filename used when hydrating the baseline VM. The baseline is
|
|
171
|
+
* shared by EVERY workflow in the bundle, so the filename baked into
|
|
172
|
+
* its compiled code (and therefore into snapshot-path stack frames)
|
|
173
|
+
* must be workflow-independent — hydrating under the first caller's
|
|
174
|
+
* workflowId would break `remapErrorStack`'s filename matching for
|
|
175
|
+
* every other workflow in the bundle. Remap call sites match this
|
|
176
|
+
* constant IN ADDITION to the run's module specifier (which covers
|
|
177
|
+
* fresh-path frames).
|
|
178
|
+
*/
|
|
179
|
+
export declare const BASELINE_BUNDLE_FILENAME = "workflow-bundle.js";
|
|
180
|
+
type BaselineEntry = {
|
|
181
|
+
state: 'ready';
|
|
182
|
+
snapshot: Snapshot;
|
|
183
|
+
/**
|
|
184
|
+
* Raw box pointer of the serde capture root created BEFORE the
|
|
185
|
+
* bundle evaluated (see captureSerdeRoot). The box lives in the
|
|
186
|
+
* snapshot's memory image at this offset; every restored VM
|
|
187
|
+
* re-adopts it so serde initialization executes no guest code
|
|
188
|
+
* after user code has run — capture-before-user-code semantics,
|
|
189
|
+
* identical to the fresh path.
|
|
190
|
+
*/
|
|
191
|
+
serdeRootPtr: number;
|
|
192
|
+
} | {
|
|
193
|
+
state: 'ineligible';
|
|
194
|
+
reason: string;
|
|
195
|
+
};
|
|
196
|
+
/** Test-only: reset the baseline cache between test cases. */
|
|
197
|
+
export declare function __clearBaselineSnapshotCacheForTests(): void;
|
|
198
|
+
/** Test-only: observe how a bundle was classified. */
|
|
199
|
+
export declare function __peekBaselineEntryForTests(workflowCode: string): Promise<BaselineEntry | undefined>;
|
|
166
200
|
/**
|
|
167
201
|
* A live QuickJS workflow invocation. When the initial `result` is
|
|
168
202
|
* `suspended`, the VM is kept alive so the caller can feed newly recorded
|
|
@@ -190,4 +224,5 @@ export interface QuickJSWorkflowSession {
|
|
|
190
224
|
*/
|
|
191
225
|
export declare function runQuickJSWorkflow(options: QuickJSRuntimeOptions): Promise<QuickJSRuntimeResult>;
|
|
192
226
|
export declare function startQuickJSWorkflow(options: QuickJSRuntimeOptions): Promise<QuickJSWorkflowSession>;
|
|
227
|
+
export {};
|
|
193
228
|
//# sourceMappingURL=quickjs-runtime.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"quickjs-runtime.d.ts","sourceRoot":"","sources":["../../src/runtime/quickjs-runtime.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"quickjs-runtime.d.ts","sourceRoot":"","sources":["../../src/runtime/quickjs-runtime.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AAEH,OAAO,KAA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