eve 0.48.0 → 0.49.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +15 -0
- package/dist/src/channel/channel-address.js +1 -1
- package/dist/src/channel/types.d.ts +10 -0
- package/dist/src/cli/commands/registry-metadata.d.ts +30 -0
- package/dist/src/cli/commands/registry-metadata.js +1 -1
- package/dist/src/cli/commands/registry-package.d.ts +6 -0
- package/dist/src/cli/commands/registry-package.js +1 -1
- package/dist/src/cli/commands/registry-pnpm-build-policy-flow.d.ts +30 -0
- package/dist/src/cli/commands/registry-pnpm-build-policy-flow.js +1 -0
- package/dist/src/cli/commands/registry-pnpm-build-policy.d.ts +12 -0
- package/dist/src/cli/commands/registry-pnpm-build-policy.js +6 -0
- package/dist/src/cli/commands/registry-recovery.d.ts +4 -0
- package/dist/src/cli/commands/registry-recovery.js +1 -1
- package/dist/src/cli/commands/registry.d.ts +1 -1
- package/dist/src/cli/commands/registry.js +1 -1
- package/dist/src/cli/dev/tui/setup-commands.js +2 -2
- package/dist/src/compiled/.vendor-stamp.json +7 -7
- package/dist/src/compiled/@workflow/core/attribute-changes.d.ts +2 -4
- package/dist/src/compiled/@workflow/core/capabilities.d.ts +10 -9
- package/dist/src/compiled/@workflow/core/capture-stack.d.ts +1 -1
- package/dist/src/compiled/@workflow/core/class-serialization.d.ts +8 -8
- package/dist/src/compiled/@workflow/core/context-violation-error.d.ts +5 -5
- package/dist/src/compiled/@workflow/core/create-hook.d.ts +2 -2
- package/dist/src/compiled/@workflow/core/describe-error.d.ts +7 -7
- package/dist/src/compiled/@workflow/core/encryption.d.ts +5 -5
- package/dist/src/compiled/@workflow/core/events-consumer.d.ts +49 -14
- package/dist/src/compiled/@workflow/core/flushable-stream.d.ts +4 -4
- package/dist/src/compiled/@workflow/core/global.d.ts +4 -2
- package/dist/src/compiled/@workflow/core/index.d.ts +1 -1
- package/dist/src/compiled/@workflow/core/index.js +2 -2
- package/dist/src/compiled/@workflow/core/log-format.d.ts +2 -2
- package/dist/src/compiled/@workflow/core/private.d.ts +40 -78
- package/dist/src/compiled/@workflow/core/private.js +1 -1
- package/dist/src/compiled/@workflow/core/replay-payload-cache.d.ts +13 -17
- package/dist/src/compiled/@workflow/core/runtime/compute-instance.d.ts +4 -3
- package/dist/src/compiled/@workflow/core/runtime/constants.d.ts +27 -27
- package/dist/src/compiled/@workflow/core/runtime/count-step-started-events.d.ts +7 -7
- package/dist/src/compiled/@workflow/core/runtime/deployment-guard.d.ts +7 -7
- package/dist/src/compiled/@workflow/core/runtime/get-port-lazy.d.ts +2 -2
- package/dist/src/compiled/@workflow/core/runtime/get-world-lazy.d.ts +2 -2
- package/dist/src/compiled/@workflow/core/runtime/helpers.d.ts +30 -49
- package/dist/src/compiled/@workflow/core/runtime/quickjs-entrypoint.d.ts +21 -10
- package/dist/src/compiled/@workflow/core/runtime/quickjs-runtime.d.ts +31 -15
- package/dist/src/compiled/@workflow/core/runtime/quickjs-serde.d.ts +10 -10
- package/dist/src/compiled/@workflow/core/runtime/replay-budget.d.ts +4 -4
- package/dist/src/compiled/@workflow/core/runtime/replay-recovery-reporter.d.ts +1 -1
- package/dist/src/compiled/@workflow/core/runtime/resume-hook.d.ts +20 -12
- package/dist/src/compiled/@workflow/core/runtime/resume-latency.d.ts +37 -30
- package/dist/src/compiled/@workflow/core/runtime/run-id-time.d.ts +2 -2
- package/dist/src/compiled/@workflow/core/runtime/run.d.ts +22 -5
- package/dist/src/compiled/@workflow/core/runtime/runs.d.ts +4 -4
- package/dist/src/compiled/@workflow/core/runtime/start.d.ts +3 -3
- package/dist/src/compiled/@workflow/core/runtime/step-executor.d.ts +14 -14
- package/dist/src/compiled/@workflow/core/runtime/step-latency.d.ts +42 -25
- package/dist/src/compiled/@workflow/core/runtime/step-ownership.d.ts +6 -6
- package/dist/src/compiled/@workflow/core/runtime/step-single-flight.d.ts +1 -1
- package/dist/src/compiled/@workflow/core/runtime/suspension-handler.d.ts +38 -24
- package/dist/src/compiled/@workflow/core/runtime/unserializable-step.d.ts +34 -0
- package/dist/src/compiled/@workflow/core/runtime/vm-mode.d.ts +2 -2
- package/dist/src/compiled/@workflow/core/runtime/wait-continuation.d.ts +31 -9
- package/dist/src/compiled/@workflow/core/runtime/wait-until.d.ts +1 -1
- package/dist/src/compiled/@workflow/core/runtime/world-compatibility.d.ts +20 -9
- package/dist/src/compiled/@workflow/core/runtime/world-init.d.ts +5 -5
- package/dist/src/compiled/@workflow/core/runtime.js +3 -3
- package/dist/src/compiled/@workflow/core/sealed-box.d.ts +7 -7
- package/dist/src/compiled/@workflow/core/serialization/codec-devalue-vm.d.ts +1 -1
- package/dist/src/compiled/@workflow/core/serialization/codec-devalue.d.ts +1 -1
- package/dist/src/compiled/@workflow/core/serialization/codec.d.ts +4 -4
- package/dist/src/compiled/@workflow/core/serialization/compression.d.ts +12 -11
- package/dist/src/compiled/@workflow/core/serialization/encryption.d.ts +7 -7
- package/dist/src/compiled/@workflow/core/serialization/format.d.ts +6 -6
- package/dist/src/compiled/@workflow/core/serialization/hardened.d.ts +23 -22
- package/dist/src/compiled/@workflow/core/serialization/index.d.ts +1 -1
- package/dist/src/compiled/@workflow/core/serialization/reducers/class-vm.d.ts +1 -1
- package/dist/src/compiled/@workflow/core/serialization/reducers/step-function-vm.d.ts +1 -1
- package/dist/src/compiled/@workflow/core/serialization/types.d.ts +5 -5
- package/dist/src/compiled/@workflow/core/serialization/workflow-vm.d.ts +1 -1
- package/dist/src/compiled/@workflow/core/serialization-format.d.ts +11 -11
- package/dist/src/compiled/@workflow/core/serialization.d.ts +18 -19
- package/dist/src/compiled/@workflow/core/source-map.d.ts +1 -1
- package/dist/src/compiled/@workflow/core/step/context-storage.d.ts +5 -5
- package/dist/src/compiled/@workflow/core/step/writable-stream.d.ts +3 -3
- package/dist/src/compiled/@workflow/core/symbols.d.ts +2 -2
- package/dist/src/compiled/@workflow/core/telemetry/semantic-conventions.d.ts +71 -20
- package/dist/src/compiled/@workflow/core/telemetry.d.ts +15 -3
- package/dist/src/compiled/@workflow/core/version.d.ts +1 -1
- package/dist/src/compiled/@workflow/core/vm/script-cache.d.ts +9 -11
- package/dist/src/compiled/@workflow/core/workflow/abort-controller.d.ts +1 -1
- package/dist/src/compiled/@workflow/core/workflow/set-attributes.d.ts +1 -1
- package/dist/src/compiled/@workflow/core/workflow/world-init-stub.d.ts +1 -1
- package/dist/src/compiled/@workflow/core/workflow.js +1 -1
- package/dist/src/compiled/@workflow/errors/index.d.ts +18 -18
- package/dist/src/compiled/@workflow/errors/index.js +1 -1
- package/dist/src/compiled/@workflow/world/analytics.d.ts +3 -2
- package/dist/src/compiled/@workflow/world/attributes-validation.d.ts +28 -0
- package/dist/src/compiled/@workflow/world/attributes.d.ts +8 -107
- package/dist/src/compiled/@workflow/world/env-config.d.ts +5 -5
- package/dist/src/compiled/@workflow/world/event-metadata.d.ts +132 -0
- package/dist/src/compiled/@workflow/world/events.d.ts +42 -96
- package/dist/src/compiled/@workflow/world/hooks.d.ts +12 -11
- package/dist/src/compiled/@workflow/world/index.d.ts +3 -3
- package/dist/src/compiled/@workflow/world/interfaces.d.ts +94 -39
- package/dist/src/compiled/@workflow/world/queue.d.ts +29 -22
- package/dist/src/compiled/@workflow/world/runs.d.ts +20 -0
- package/dist/src/compiled/@workflow/world/slot-identity.d.ts +3 -3
- package/dist/src/compiled/@workflow/world/spec-version.d.ts +82 -15
- package/dist/src/compiled/@workflow/world/ulid.d.ts +2 -2
- package/dist/src/compiled/@workflow/world-local/index.js +5 -5
- package/dist/src/compiled/@workflow/world-vercel/index.js +12 -12
- package/dist/src/compiled/_chunks/workflow/{attribute-changes-DXbpwBdw.js → attribute-changes-BwAadFfB.js} +3 -3
- package/dist/src/compiled/_chunks/workflow/debug-log-CVPstO1D.js +1 -0
- package/dist/src/compiled/_chunks/workflow/dist-CgbVZs5l.js +40 -0
- package/dist/src/compiled/_chunks/workflow/dist-DjojkP5e.js +3 -0
- package/dist/src/compiled/_chunks/workflow/frames-CZ9eHShe.js +3 -0
- package/dist/src/compiled/_chunks/workflow/global-singleton-BNinwFrL.js +1 -0
- package/dist/src/compiled/_chunks/workflow/private-CZFMABEf.js +1 -0
- package/dist/src/compiled/_chunks/workflow/resume-hook-BToMtPbH.js +1 -0
- package/dist/src/compiled/_chunks/workflow/run-DzyAoGh4.js +1 -0
- package/dist/src/compiled/_chunks/workflow/sleep-3_A5uOp-.js +1 -0
- package/dist/src/compiled/_chunks/workflow/undici-DfxNX5og.js +95 -0
- package/dist/src/compiled/_chunks/workflow/wait-until-BtySPYD0.js +15 -0
- package/dist/src/compiled/_chunks/workflow/ws-transport-PnVVxT0R.js +1 -0
- package/dist/src/eve-channel/index.js +1 -1
- package/dist/src/execution/agent-handle-dispatch.js +1 -1
- package/dist/src/execution/continuation-conflict-step.d.ts +10 -0
- package/dist/src/execution/continuation-conflict-step.js +1 -0
- package/dist/src/execution/delegated-parent-notification.js +1 -1
- package/dist/src/execution/dispatch-runtime-actions-shared.d.ts +7 -29
- package/dist/src/execution/dispatch-runtime-actions-shared.js +1 -1
- package/dist/src/execution/dispatch-runtime-actions-start.d.ts +33 -0
- package/dist/src/execution/dispatch-runtime-actions-start.js +1 -0
- package/dist/src/execution/dispatch-runtime-actions-step.js +1 -1
- package/dist/src/execution/dispatch-turn-step.js +1 -1
- package/dist/src/execution/dynamic-connections.js +1 -1
- package/dist/src/execution/inline-turn.js +1 -1
- package/dist/src/execution/next-driver-action.d.ts +5 -4
- package/dist/src/execution/proxied-deliver-step.js +1 -1
- package/dist/src/execution/runtime-errors.d.ts +0 -12
- package/dist/src/execution/runtime-errors.js +1 -1
- package/dist/src/execution/session-timeout-steps.js +1 -1
- package/dist/src/execution/settle-cancelled-turn-step.js +1 -1
- package/dist/src/execution/stable-workflow-names.d.ts +2 -2
- package/dist/src/execution/subagent-start-local.js +1 -1
- package/dist/src/execution/tasks/parent/dispatch-task-step.js +1 -1
- package/dist/src/execution/tasks/parent/run-parent.js +1 -1
- package/dist/src/execution/tasks/parent/tool-execution.js +1 -1
- package/dist/src/execution/tool-run/start.js +1 -1
- package/dist/src/execution/tools/subagent/local.js +1 -1
- package/dist/src/execution/turn-workflow.js +1 -1
- package/dist/src/execution/workflow-entry.d.ts +5 -1
- package/dist/src/execution/workflow-entry.js +1 -1
- package/dist/src/execution/workflow-runtime.d.ts +12 -12
- package/dist/src/execution/workflow-runtime.js +1 -1
- package/dist/src/execution/workflow-steps.js +1 -1
- package/dist/src/harness/tool-loop.js +1 -1
- package/dist/src/internal/application/package.js +1 -1
- package/dist/src/internal/workflow/development-world-client.js +1 -1
- package/dist/src/packages/eve-catalog/src/index.js +1 -1
- package/dist/src/public/channels/slack/slackChannel.d.ts +7 -1
- package/dist/src/public/channels/slack/slackChannel.js +1 -1
- package/dist/src/setup/flows/registry.js +1 -1
- package/dist/src/setup/scaffold/connections/catalog.js +1 -1
- package/dist/src/setup/scaffold/create/project.js +1 -1
- package/docs/channels/custom.mdx +4 -0
- package/docs/channels/eve.mdx +12 -8
- package/docs/channels/mcp.mdx +4 -1
- package/docs/guides/instrumentation.md +1 -1
- package/docs/install-integrations.mdx +2 -0
- package/docs/instructions.mdx +1 -1
- package/docs/memory/custom-provider.md +214 -0
- package/docs/memory/file.md +129 -0
- package/docs/memory/meta.json +5 -0
- package/docs/memory/overview.mdx +282 -0
- package/docs/patterns/multi-tenant-memory.md +12 -20
- package/package.json +8 -8
- package/dist/src/compiled/_chunks/workflow/dist-CqvWKNQv.js +0 -3
- package/dist/src/compiled/_chunks/workflow/dist-Dk0aQqFO.js +0 -40
- package/dist/src/compiled/_chunks/workflow/dist-DpYyXbJv.js +0 -1
- package/dist/src/compiled/_chunks/workflow/env-config-L94XftKz.js +0 -1
- package/dist/src/compiled/_chunks/workflow/frames-Dl2Hcma4.js +0 -3
- package/dist/src/compiled/_chunks/workflow/private-CuQ4HTFC.js +0 -1
- package/dist/src/compiled/_chunks/workflow/resume-hook-E-Nkx8q_.js +0 -1
- package/dist/src/compiled/_chunks/workflow/run-cIeex2KF.js +0 -1
- package/dist/src/compiled/_chunks/workflow/sleep-CxFsdxB_.js +0 -1
- package/dist/src/compiled/_chunks/workflow/spec-version-DBUVfF_R.js +0 -1
- package/dist/src/compiled/_chunks/workflow/undici-DznrXKcM.js +0 -95
- package/dist/src/compiled/_chunks/workflow/wait-until-BZHmJCAW.js +0 -15
- package/dist/src/compiled/_chunks/workflow/ws-transport-Ct6yyRWZ.js +0 -1
- package/docs/memory.md +0 -408
|
@@ -18,7 +18,7 @@ export declare function getDeserializeStream(revivers: Partial<Revivers>, crypto
|
|
|
18
18
|
* Wraps each chunk of a byte stream in a 4-byte big-endian length
|
|
19
19
|
* prefix. Used by the producer side of a framed byte-stream pipe.
|
|
20
20
|
*
|
|
21
|
-
* Empty chunks (length 0) are dropped
|
|
21
|
+
* Empty chunks (length 0) are dropped: the resulting `[0x00 0x00 0x00 0x00]`
|
|
22
22
|
* frame would be ambiguous with the legacy "looks framed" detection in
|
|
23
23
|
* `getDeserializeStream`, and it carries no information.
|
|
24
24
|
*
|
|
@@ -27,7 +27,7 @@ export declare function getDeserializeStream(revivers: Partial<Revivers>, crypto
|
|
|
27
27
|
* writable performs one wire write per chunk, preserving boundaries). The
|
|
28
28
|
* server therefore stores one frame per chunk index, which is what allows
|
|
29
29
|
* a future reconnecting reader to resume a framed byte stream at
|
|
30
|
-
* `startIndex + consumedFrames
|
|
30
|
+
* `startIndex + consumedFrames`, the same arithmetic
|
|
31
31
|
* `createReconnectingFramedStream` relies on for object streams. Do not
|
|
32
32
|
* coalesce or split frames here without revisiting that resume logic.
|
|
33
33
|
*/
|
|
@@ -36,7 +36,7 @@ export declare function getByteFramingStream(): TransformStream<Uint8Array, Uint
|
|
|
36
36
|
* Unwraps length-prefixed byte-stream frames back into the original user
|
|
37
37
|
* chunks. Used by the consumer side of a framed byte-stream pipe.
|
|
38
38
|
*
|
|
39
|
-
* Buffers across read boundaries
|
|
39
|
+
* Buffers across read boundaries, since the transport may split a single
|
|
40
40
|
* frame across multiple reads (header in one chunk, payload in another)
|
|
41
41
|
* or coalesce multiple frames into a single read. The transform emits
|
|
42
42
|
* whole user chunks regardless of transport chunking.
|
|
@@ -55,7 +55,7 @@ export declare class WorkflowServerReadableStream extends ReadableStream<Uint8Ar
|
|
|
55
55
|
* Maximum consecutive reconnect attempts for a single framed stream session.
|
|
56
56
|
* The counter resets to zero whenever a reconnect makes forward progress (a
|
|
57
57
|
* frame is delivered), so this bounds *consecutive* failures, not the lifetime
|
|
58
|
-
* total
|
|
58
|
+
* total: a long-lived serverless stream may legitimately reconnect far more
|
|
59
59
|
* than this many times as long as each reconnect keeps delivering data. We only
|
|
60
60
|
* give up after this many reconnects in a row produce nothing.
|
|
61
61
|
*/
|
|
@@ -66,7 +66,7 @@ export declare const FRAMED_STREAM_MAX_RECONNECTS = 50;
|
|
|
66
66
|
* correct for a well-behaved backend that honors `startIndex`. But if a World's
|
|
67
67
|
* `streams.get` ever ignored `startIndex` and re-delivered earlier chunks,
|
|
68
68
|
* "progress" would be reported every reconnect and the consecutive cap would
|
|
69
|
-
* never trip
|
|
69
|
+
* never trip, turning a bounded failure into an unbounded reconnect loop. This
|
|
70
70
|
* hard ceiling guarantees the loop always terminates. It is set high enough
|
|
71
71
|
* (hours of streaming at realistic per-session timeouts) to never interfere
|
|
72
72
|
* with legitimate long-lived streams.
|
|
@@ -81,7 +81,7 @@ export declare const FRAMED_STREAM_MAX_TOTAL_RECONNECTS = 1000;
|
|
|
81
81
|
* the writable buffers one frame per chunk when multi-writing). The wrapper
|
|
82
82
|
* counts completed frames and, on upstream error, reopens the connection
|
|
83
83
|
* with `startIndex = resolvedStartIndex + consumedFrames`. Partial-frame
|
|
84
|
-
* bytes buffered before the cut are discarded
|
|
84
|
+
* bytes buffered before the cut are discarded; the server will resend the
|
|
85
85
|
* in-flight chunk in full from the new startIndex.
|
|
86
86
|
*
|
|
87
87
|
* A clean upstream close (EOF with no error) is NOT trusted as completion
|
|
@@ -97,7 +97,7 @@ export declare const FRAMED_STREAM_MAX_TOTAL_RECONNECTS = 1000;
|
|
|
97
97
|
*
|
|
98
98
|
* Negative `startIndex` values (last-N semantics) skip the reconnect
|
|
99
99
|
* machinery because we cannot compute an absolute resume position without
|
|
100
|
-
* a tail-index lookup
|
|
100
|
+
* a tail-index lookup; the returned stream behaves as a single-shot read.
|
|
101
101
|
*/
|
|
102
102
|
export declare function createReconnectingFramedStream(runId: string, name: string, startIndex?: number): ReadableStream<Uint8Array>;
|
|
103
103
|
export declare class WorkflowServerWritableStream extends WritableStream<Uint8Array> {
|
|
@@ -125,11 +125,11 @@ import type { ByteStreamFraming, Reducers, Revivers } from './serialization/type
|
|
|
125
125
|
* @param framedByteStreams - When `true`, byte streams (`type: 'bytes'`)
|
|
126
126
|
* are wrapped in length-prefixed frames on the wire so the consumer
|
|
127
127
|
* can reconnect on transient errors. Should match the target run's
|
|
128
|
-
* capability
|
|
128
|
+
* capability: see `getRunCapabilities` in `capabilities.ts`. Defaults
|
|
129
129
|
* to `false` for backwards compatibility with older runs.
|
|
130
130
|
* @returns
|
|
131
131
|
*/
|
|
132
|
-
export declare function getExternalReducers(global: Record<string, any> | undefined, ops: Promise<void>[], runId: string, cryptoKey: EncryptionKeyParam, framedByteStreams?: boolean, runReadyBarrier?: Promise<unknown>): Partial<Reducers>;
|
|
132
|
+
export declare function getExternalReducers(global: Record<string, any> | undefined, ops: Promise<void>[], runId: string, cryptoKey: EncryptionKeyParam, framedByteStreams?: boolean, runReadyBarrier?: Promise<unknown>, readbackOps?: Promise<void>[]): Partial<Reducers>;
|
|
133
133
|
export declare function getWorkflowReducers(global?: Record<string, any>): Partial<Reducers>;
|
|
134
134
|
/**
|
|
135
135
|
* Cancel dangling abort-stream readers on any AbortController instances found
|
|
@@ -381,12 +381,12 @@ export declare function deserializePreparedStepError(prepared: PreparedReplayPay
|
|
|
381
381
|
* @param global - Global object for serialization context
|
|
382
382
|
* @param v1Compat - Enable legacy v1 compatibility mode
|
|
383
383
|
* @param framedByteStreams - Whether the target run can decode wire-framed
|
|
384
|
-
* byte streams. Should match the target deployment's capability
|
|
384
|
+
* byte streams. Should match the target deployment's capability: see
|
|
385
385
|
* `getRunCapabilities` in `capabilities.ts`. Defaults to `false` for
|
|
386
386
|
* backwards compatibility with older runs.
|
|
387
387
|
* @returns The dehydrated value as binary data (Uint8Array) with format prefix
|
|
388
388
|
*/
|
|
389
|
-
export declare function dehydrateWorkflowArguments(value: unknown, runId: string, key: PayloadKey | undefined, ops?: Promise<void>[], global?: Record<string, any>, v1Compat?: boolean, framedByteStreams?: boolean, compression?: boolean): Promise<Uint8Array | unknown>;
|
|
389
|
+
export declare function dehydrateWorkflowArguments(value: unknown, runId: string, key: PayloadKey | undefined, ops?: Promise<void>[], global?: Record<string, any>, v1Compat?: boolean, framedByteStreams?: boolean, compression?: boolean, readbackOps?: Promise<void>[]): Promise<Uint8Array | unknown>;
|
|
390
390
|
/**
|
|
391
391
|
* Called from workflow execution environment to hydrate the workflow
|
|
392
392
|
* arguments from the database at the start of workflow execution. A prepared
|
|
@@ -398,12 +398,11 @@ export declare function hydrateWorkflowArguments(value: Uint8Array | unknown, _r
|
|
|
398
398
|
*/
|
|
399
399
|
export declare function dehydrateWorkflowReturnValue(value: unknown, _runId: string, key: PayloadKey | undefined, global?: Record<string, any>, v1Compat?: boolean, compression?: boolean,
|
|
400
400
|
/**
|
|
401
|
-
* Optional sink receiving
|
|
402
|
-
*
|
|
403
|
-
*
|
|
404
|
-
*
|
|
405
|
-
*
|
|
406
|
-
* runtime/suspension-handler.ts passes one for step-input dehydration.
|
|
401
|
+
* Optional sink receiving the first five samples and exact total count of
|
|
402
|
+
* workflow-code executions serialization could not avoid. The diagnostics
|
|
403
|
+
* are emitted as span attributes either way, so omitting this loses nothing
|
|
404
|
+
* observability-wise. The retained-VM gate in runtime/suspension-handler.ts
|
|
405
|
+
* passes one for step-input dehydration.
|
|
407
406
|
*/
|
|
408
407
|
guestCodeStatsOut?: GuestCodeStats): Promise<Uint8Array | unknown>;
|
|
409
408
|
/**
|
|
@@ -435,12 +434,12 @@ export declare function hydrateStepArguments(value: Uint8Array | unknown, runId:
|
|
|
435
434
|
* @param global - Global object for serialization context
|
|
436
435
|
* @param v1Compat - Enable legacy v1 compatibility mode
|
|
437
436
|
* @param framedByteStreams - Whether the target run can decode wire-framed
|
|
438
|
-
* byte streams. Should match the target deployment's capability
|
|
437
|
+
* byte streams. Should match the target deployment's capability: see
|
|
439
438
|
* `getRunCapabilities` in `capabilities.ts`. Defaults to `false` for
|
|
440
439
|
* backwards compatibility with older runs.
|
|
441
440
|
* @returns The dehydrated value as binary data (Uint8Array) with format prefix
|
|
442
441
|
*/
|
|
443
|
-
export declare function dehydrateStepReturnValue(value: unknown, runId: string, key: PayloadKey | undefined, ops?: Promise<any>[], global?: Record<string, any>, v1Compat?: boolean, framedByteStreams?: boolean, compression?: boolean, runReadyBarrier?: Promise<unknown>): Promise<Uint8Array | unknown>;
|
|
442
|
+
export declare function dehydrateStepReturnValue(value: unknown, runId: string, key: PayloadKey | undefined, ops?: Promise<any>[], global?: Record<string, any>, v1Compat?: boolean, framedByteStreams?: boolean, compression?: boolean, runReadyBarrier?: Promise<unknown>, readbackOps?: Promise<void>[]): Promise<Uint8Array | unknown>;
|
|
444
443
|
/**
|
|
445
444
|
* Called from the step executor when a step throws. Dehydrates the thrown
|
|
446
445
|
* value from within the step execution environment into a format that can
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* present.
|
|
5
5
|
*
|
|
6
6
|
* Use this on the host side before evaluating workflow bundles inside
|
|
7
|
-
* the QuickJS VM
|
|
7
|
+
* the QuickJS VM: the inline map can account for several MB of bundle
|
|
8
8
|
* text (measured ~30%+ of VM heap bytes on the example workbench's
|
|
9
9
|
* bundle), and the VM never needs it; only host-side `remapErrorStack`
|
|
10
10
|
* reads the map (and it can do so against the original, unstripped
|
|
@@ -9,7 +9,7 @@ import type { StepMetadata } from './get-step-metadata.js';
|
|
|
9
9
|
* Holds the user-facing `WritableStream` and the shared `FlushableStreamState`
|
|
10
10
|
* driving the background pipe to the workflow server. Re-used so repeat calls
|
|
11
11
|
* to `getWritable()` within the same step return the same handle instead of
|
|
12
|
-
* spawning racing pipes
|
|
12
|
+
* spawning racing pipes; see https://github.com/vercel/workflow/issues/2058.
|
|
13
13
|
*/
|
|
14
14
|
export interface CachedWritable {
|
|
15
15
|
writable: WritableStream<any>;
|
|
@@ -35,14 +35,14 @@ export type StepContext = {
|
|
|
35
35
|
* The canonical case is a step-initiated `AbortController.abort()`: the
|
|
36
36
|
* durable `hook_received` event records the cancellation in the workflow's
|
|
37
37
|
* event log. If it is flushed in the background (like `ops`), the workflow
|
|
38
|
-
* continuation enqueued by `step_completed` can run
|
|
39
|
-
* abort, dispatching a later step with a stale, non-aborted `signal`
|
|
38
|
+
* continuation enqueued by `step_completed` can run (and advance past the
|
|
39
|
+
* abort, dispatching a later step with a stale, non-aborted `signal`) before
|
|
40
40
|
* the `hook_received` event exists. Awaiting these inline before completion
|
|
41
41
|
* guarantees the abort is ordered ahead of any continuation that observes the
|
|
42
42
|
* step's result. Unlike these, `ops` holds best-effort real-time stream
|
|
43
43
|
* writes that should fire ASAP and are intentionally left in the background.
|
|
44
44
|
*
|
|
45
|
-
* Contract: producers MUST NOT push a promise that can reject
|
|
45
|
+
* Contract: producers MUST NOT push a promise that can reject; these are
|
|
46
46
|
* awaited only to enforce ordering, never to surface an outcome. A rejection
|
|
47
47
|
* here would propagate as an infra error (queue re-delivery), not the
|
|
48
48
|
* user-code failure path, so each producer swallows its own errors (see
|
|
@@ -60,7 +60,7 @@ export type StepContext = {
|
|
|
60
60
|
/**
|
|
61
61
|
* Turbo mode only: a promise that resolves once the backgrounded
|
|
62
62
|
* `run_started` has landed (the run exists). Set when the step body runs
|
|
63
|
-
* optimistically
|
|
63
|
+
* optimistically (before `run_started`/`step_started` are confirmed), so a
|
|
64
64
|
* direct step-body world write (e.g. `setAttributes`, which
|
|
65
65
|
* resolves to a host-side `attr_set` create) can gate on it and never race
|
|
66
66
|
* ahead of the run's creation. `undefined` outside turbo and on the await
|
|
@@ -9,10 +9,10 @@ export interface WorkflowWritableStreamOptions {
|
|
|
9
9
|
namespace?: string;
|
|
10
10
|
}
|
|
11
11
|
/**
|
|
12
|
-
* Retrieves
|
|
12
|
+
* Retrieves the writable stream associated with the current workflow.
|
|
13
13
|
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
14
|
+
* Use the writable stream within step functions to write data. Read the data
|
|
15
|
+
* outside the workflow by using the readable method of `getRun`.
|
|
16
16
|
*
|
|
17
17
|
* @param options - Optional configuration for the writable stream
|
|
18
18
|
* @returns The writable stream associated with the current workflow run
|
|
@@ -18,7 +18,7 @@ export declare const STREAM_FRAMING_SYMBOL: unique symbol;
|
|
|
18
18
|
* `start()`) sees both symbols on a writable, it includes the `runId` in
|
|
19
19
|
* the descriptor it emits. The child run's step-side reviver then opens
|
|
20
20
|
* a server writable against the original `(runId, name)` and resolves
|
|
21
|
-
* that run's encryption key directly
|
|
21
|
+
* that run's encryption key directly, so the child's writes land on
|
|
22
22
|
* the parent's stream as-is, with no client process in the loop. That
|
|
23
23
|
* keeps the forwarding alive for the full lifetime of the child run,
|
|
24
24
|
* not just for the parent step that initiated `start()`.
|
|
@@ -39,7 +39,7 @@ export declare const STREAM_SERVER_DEPLOYMENT_ID_SYMBOL: unique symbol;
|
|
|
39
39
|
* when it creates the stream, so the key travels inside the serialized
|
|
40
40
|
* descriptor; a child on another deployment can then seal frames immediately.
|
|
41
41
|
* Without it the child would have to either fetch the owning run or fetch its
|
|
42
|
-
* symmetric key from the API
|
|
42
|
+
* symmetric key from the API, the round trip this whole mechanism exists to
|
|
43
43
|
* avoid.
|
|
44
44
|
*/
|
|
45
45
|
export declare const STREAM_SERVER_PUBLIC_KEY_SYMBOL: unique symbol;
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*
|
|
4
4
|
* This module provides standardized telemetry attributes following OpenTelemetry semantic conventions
|
|
5
5
|
* for instrumenting workflow execution, step processing, and related operations. Each exported function
|
|
6
|
-
* creates a properly formatted attribute object
|
|
6
|
+
* creates a properly formatted attribute object for use with OpenTelemetry spans.
|
|
7
7
|
*
|
|
8
8
|
* The semantic conventions are organized into several categories:
|
|
9
9
|
* - **Workflow attributes**: Track workflow lifecycle, status, and metadata
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
* - **Queue attributes**: Instrument message queue operations
|
|
12
12
|
* - **Deployment attributes**: Capture deployment environment information
|
|
13
13
|
*
|
|
14
|
-
* All attribute functions are type-safe and
|
|
14
|
+
* All attribute functions are type-safe and use existing backend types to ensure
|
|
15
15
|
* consistency between telemetry data and actual system state.
|
|
16
16
|
*
|
|
17
17
|
* @example
|
|
@@ -64,6 +64,15 @@ export declare const WorkflowEventsCount: (value: number) => {
|
|
|
64
64
|
export declare const WorkflowExecutionMode: (value: "replay" | "retained") => {
|
|
65
65
|
[k: string]: "replay" | "retained";
|
|
66
66
|
};
|
|
67
|
+
/** Whether the compiled application workflow bundle was cached. */
|
|
68
|
+
export declare const WorkflowBundleCompileCacheHit: (value: boolean) => {
|
|
69
|
+
[k: string]: boolean;
|
|
70
|
+
};
|
|
71
|
+
/** Operation that supplied events to the current replay. */
|
|
72
|
+
export type WorkflowReplayLoadSource = 'run_started' | 'hook_preload' | 'events_list' | 'events_list_incremental';
|
|
73
|
+
export declare const WorkflowReplayLoadSource: (value: WorkflowReplayLoadSource) => {
|
|
74
|
+
[k: string]: WorkflowReplayLoadSource;
|
|
75
|
+
};
|
|
67
76
|
/**
|
|
68
77
|
* Events the replay walked past that no consumer claimed, still held when the
|
|
69
78
|
* replay stopped.
|
|
@@ -159,10 +168,18 @@ export declare const WorkflowHooksCreated: (value: number) => {
|
|
|
159
168
|
export declare const WorkflowWaitsCreated: (value: number) => {
|
|
160
169
|
[k: string]: number;
|
|
161
170
|
};
|
|
171
|
+
/**
|
|
172
|
+
* Number of steps this suspension finalized as failed because their
|
|
173
|
+
* arguments refused to serialize (step_created placeholder + step_failed
|
|
174
|
+
* carrying the SerializationError; see finalizeUnserializableStep).
|
|
175
|
+
*/
|
|
176
|
+
export declare const WorkflowStepsFailedSerialization: (value: number) => {
|
|
177
|
+
[k: string]: number;
|
|
178
|
+
};
|
|
162
179
|
/**
|
|
163
180
|
* Number of inline-owned steps this invocation re-executed because it is a
|
|
164
181
|
* redelivery of their owning queue message (crash recovery for inline
|
|
165
|
-
* steps
|
|
182
|
+
* steps; see the inline step ownership changelog, workflow#2780).
|
|
166
183
|
*/
|
|
167
184
|
export declare const WorkflowOwnedRecoverySteps: (value: number) => {
|
|
168
185
|
[k: string]: number;
|
|
@@ -196,7 +213,7 @@ export declare const WorkflowRouteModuleBodyInitMs: (value: number) => {
|
|
|
196
213
|
[k: string]: number;
|
|
197
214
|
};
|
|
198
215
|
/**
|
|
199
|
-
* Compute instance handling this route
|
|
216
|
+
* Compute instance handling this route: the synthesized `COMPUTE_INSTANCE_ID`.
|
|
200
217
|
* Uses OTEL `faas.instance` (execution-environment id, reused across
|
|
201
218
|
* invocations to the same function):
|
|
202
219
|
* https://opentelemetry.io/docs/specs/semconv/attributes-registry/faas/
|
|
@@ -259,11 +276,11 @@ export declare const StepRsfsMs: (value: number) => {
|
|
|
259
276
|
/**
|
|
260
277
|
* Client-measured synchronous workflow-function replay duration in
|
|
261
278
|
* milliseconds, excluding awaited network I/O, of only the FINAL replay pass
|
|
262
|
-
* within the rsfs window
|
|
279
|
+
* within the rsfs window: the pass that reached and scheduled the first
|
|
263
280
|
* step. Not accumulated across earlier pre-first-step passes (e.g. a
|
|
264
281
|
* workflow-body `setAttributes()` detour replays more than once, and a
|
|
265
282
|
* redelivery omits earlier invocations' work entirely), so this must not be
|
|
266
|
-
* read as "the replay portion of rsfs"
|
|
283
|
+
* read as "the replay portion of rsfs"; step.rsfs_ms covers the whole
|
|
267
284
|
* window. Only present alongside step.rsfs_ms and only for the run's first
|
|
268
285
|
* step (see runtime/step-latency.ts).
|
|
269
286
|
*/
|
|
@@ -370,20 +387,50 @@ export declare const HookFound: (value: boolean) => {
|
|
|
370
387
|
* `hook_received` write failed transiently but the queue dispatch succeeded, so
|
|
371
388
|
* the resume is recovered via the consumer's re-ensure. Corresponds to
|
|
372
389
|
* `ResumedHook.resilientResume === true`.
|
|
390
|
+
*
|
|
391
|
+
* No longer emitted: current producers require the durable event write to
|
|
392
|
+
* succeed. Retained so dashboards and queries built on the attribute keep
|
|
393
|
+
* resolving while older producers are still deployed.
|
|
373
394
|
*/
|
|
374
395
|
export declare const HookResilientResume: (value: boolean) => {
|
|
375
396
|
[k: string]: boolean;
|
|
376
397
|
};
|
|
398
|
+
/**
|
|
399
|
+
* Producer-side signal (on the `hook.resume` span) that the durable
|
|
400
|
+
* `hook_received` write COMMITTED. Stamped after the write resolves, so it
|
|
401
|
+
* distinguishes a committed resume from an attempted one — an entry-time
|
|
402
|
+
* attribute cannot, because a span that later records an exception may have
|
|
403
|
+
* failed either before or after the commit.
|
|
404
|
+
*/
|
|
405
|
+
export declare const HookResumeCommitted: (value: boolean) => {
|
|
406
|
+
[k: string]: boolean;
|
|
407
|
+
};
|
|
408
|
+
/**
|
|
409
|
+
* Producer-side signal (on the `hook.resume` span) that the workflow wake was
|
|
410
|
+
* ACCEPTED by the queue, stamped after the publish resolves.
|
|
411
|
+
*
|
|
412
|
+
* Together with {@link HookResumeCommitted} this makes stranded resumes
|
|
413
|
+
* queryable: `resume_committed=true` with `wake_published` absent is a resume
|
|
414
|
+
* whose durable event exists but whose wake publish failed (the caller was
|
|
415
|
+
* told, but nothing re-drives it), and `resume_committed=true` +
|
|
416
|
+
* `wake_published=true` with no subsequent workflow execution for the run is
|
|
417
|
+
* a wake the queue accepted but never delivered. Both are detection-only
|
|
418
|
+
* signals — nothing recovers such a run automatically today beyond a later
|
|
419
|
+
* wake from any other source.
|
|
420
|
+
*/
|
|
421
|
+
export declare const HookWakePublished: (value: boolean) => {
|
|
422
|
+
[k: string]: boolean;
|
|
423
|
+
};
|
|
377
424
|
/**
|
|
378
425
|
* Consumer-side signal (on the workflow execution span) that this replay
|
|
379
426
|
* materialized the `hook_received` event from the queue message's `hookInput`
|
|
380
|
-
* because
|
|
381
|
-
*
|
|
427
|
+
* because no committed event was found, which completes the recovery path
|
|
428
|
+
* {@link HookResilientResume} began.
|
|
382
429
|
*
|
|
383
|
-
* Legacy / non-atomic re-ensure signal only.
|
|
430
|
+
* Legacy / non-atomic re-ensure signal only. Legacy atomic lazy resumes
|
|
384
431
|
* (resumeId + digest) go through the hoisted preload write instead, whose
|
|
385
432
|
* response cannot tell whether the producer or the consumer won the
|
|
386
|
-
* `(runId, resumeId)` claim
|
|
433
|
+
* `(runId, resumeId)` claim, so this attribute is deliberately NOT emitted
|
|
387
434
|
* for them (emitting `true` unconditionally would count every producer-won
|
|
388
435
|
* resume as a recovery). The producer-begin ({@link HookResilientResume}) /
|
|
389
436
|
* consumer-materialized pairing is therefore no longer complete for atomic
|
|
@@ -396,10 +443,10 @@ export declare const HookResilientResumeMaterialized: (value: boolean) => {
|
|
|
396
443
|
* Consumer-side signal (on the workflow execution span) of how a lazy hook
|
|
397
444
|
* resume initialized its replay state:
|
|
398
445
|
*
|
|
399
|
-
* - `hook_received_stream
|
|
446
|
+
* - `hook_received_stream`: the hoisted `hook_received` write returned a
|
|
400
447
|
* usable replay preload (run + complete event log), so the invocation
|
|
401
448
|
* skipped both the `run_started` write and the initial `events.list`.
|
|
402
|
-
* - `hook_received_fallback
|
|
449
|
+
* - `hook_received_fallback`: the hoisted write succeeded but returned no
|
|
403
450
|
* usable preload (a CBOR response from an older server, a World that
|
|
404
451
|
* ignored the opt-in, a bounded `hasMore` page, or a preload that failed
|
|
405
452
|
* validation); the invocation fell back to the `run_started` setup without
|
|
@@ -410,8 +457,8 @@ export declare const HookResilientResumeMaterialized: (value: boolean) => {
|
|
|
410
457
|
*
|
|
411
458
|
* This is a latency/setup-path signal: it says which requests initialized
|
|
412
459
|
* the invocation, NOT that this consumer created the `hook_received` event
|
|
413
|
-
* (the hoisted write may equally have converged on the producer's
|
|
414
|
-
* ownership is not observable client-side; cf.
|
|
460
|
+
* (the hoisted write may equally have converged on the producer's, since
|
|
461
|
+
* claim ownership is not observable client-side; cf.
|
|
415
462
|
* {@link HookResilientResumeMaterialized}).
|
|
416
463
|
*/
|
|
417
464
|
export declare const HookResumeSetupSource: (value: string) => {
|
|
@@ -429,7 +476,7 @@ export declare const StepResilientDispatchRecovered: (value: number) => {
|
|
|
429
476
|
/**
|
|
430
477
|
* Consumer-side signal (on the workflow execution span) that this delivery
|
|
431
478
|
* materialized the `step_created` event from the queue message's `stepInput`
|
|
432
|
-
* because the producer's direct write had not landed
|
|
479
|
+
* because the producer's direct write had not landed, which completes the
|
|
433
480
|
* recovery path {@link StepResilientDispatchRecovered} began.
|
|
434
481
|
*/
|
|
435
482
|
export declare const StepResilientDispatchMaterialized: (value: boolean) => {
|
|
@@ -480,9 +527,13 @@ export declare const ResumeStepPrepareMs: (value: number) => {
|
|
|
480
527
|
export declare const ResumeTrigger: (value: "hook") => {
|
|
481
528
|
[k: string]: "hook";
|
|
482
529
|
};
|
|
483
|
-
/**
|
|
484
|
-
|
|
485
|
-
|
|
530
|
+
/**
|
|
531
|
+
* Which `resumeHook()` dispatch path produced this resume. `parallel` only
|
|
532
|
+
* appears for messages published by an older producer, which wrote
|
|
533
|
+
* `hook_received` itself in parallel with the publish.
|
|
534
|
+
*/
|
|
535
|
+
export declare const ResumeStrategy: (value: "lazy" | "parallel" | "sequential") => {
|
|
536
|
+
[k: string]: "lazy" | "parallel" | "sequential";
|
|
486
537
|
};
|
|
487
538
|
/**
|
|
488
539
|
* How the consuming invocation initialized replay state. Distinct from the
|
|
@@ -491,8 +542,8 @@ export declare const ResumeStrategy: (value: "parallel" | "sequential") => {
|
|
|
491
542
|
* hoisted-write outcome; this one is the TTR dimension and shares the metric's
|
|
492
543
|
* three-value vocabulary.
|
|
493
544
|
*/
|
|
494
|
-
export declare const ResumeSetupSource: (value: "
|
|
495
|
-
[k: string]: "
|
|
545
|
+
export declare const ResumeSetupSource: (value: "run_started" | "hook_preload" | "event_load") => {
|
|
546
|
+
[k: string]: "run_started" | "hook_preload" | "event_load";
|
|
496
547
|
};
|
|
497
548
|
/** Whether the measured step ran in the resuming invocation or a queued one. */
|
|
498
549
|
export declare const ResumeStepExecution: (value: "inline" | "dispatched") => {
|
|
@@ -25,7 +25,7 @@ export declare function getWorkflowTraceMode(): WorkflowTraceMode;
|
|
|
25
25
|
* Returns whether a serialized trace carrier is usable, i.e. present and
|
|
26
26
|
* non-empty. `serializeTraceCarrier()` returns `{}` when no OTEL SDK is
|
|
27
27
|
* registered or no span is active, and `start()` always attaches the
|
|
28
|
-
* carrier to the first queue message
|
|
28
|
+
* carrier to the first queue message, so an empty carrier must be treated
|
|
29
29
|
* the same as an absent one wherever the trace-mode logic branches.
|
|
30
30
|
*/
|
|
31
31
|
export declare function isUsableTraceCarrier(carrier: Record<string, string> | undefined): carrier is Record<string, string>;
|
|
@@ -33,7 +33,7 @@ export declare function isUsableTraceCarrier(carrier: Record<string, string> | u
|
|
|
33
33
|
* Returns the trace carrier to attach to messages the current invocation
|
|
34
34
|
* enqueues. In `linked` mode the ORIGINAL run-origin carrier is forwarded
|
|
35
35
|
* unchanged (when usable) so every future invocation links back to the same
|
|
36
|
-
* origin; otherwise
|
|
36
|
+
* origin; otherwise (`continuous` mode, or no usable incoming carrier)
|
|
37
37
|
* the current (active) context is serialized, so the trace keeps chaining
|
|
38
38
|
* (continuous) or the first instrumented invocation becomes the de-facto
|
|
39
39
|
* origin (linked).
|
|
@@ -45,7 +45,7 @@ export declare function getNextTraceCarrier(traceMode: WorkflowTraceMode, incomi
|
|
|
45
45
|
*
|
|
46
46
|
* - In `linked` mode the invocation span is a CHILD of the local delivery
|
|
47
47
|
* (flow-route) context, so the only link is to the run-origin context
|
|
48
|
-
* from the message's trace carrier
|
|
48
|
+
* from the message's trace carrier, connecting this bounded per-invocation
|
|
49
49
|
* trace back to where the run was started. The run-origin context is a
|
|
50
50
|
* link, never a parent, and re-enqueues forward the original carrier
|
|
51
51
|
* unchanged, so the whole run is never stitched into one giant trace.
|
|
@@ -73,6 +73,18 @@ export declare function deserializeTraceCarrier(traceCarrier: Record<string, str
|
|
|
73
73
|
*/
|
|
74
74
|
export declare function withTraceContext<T>(traceCarrier: Record<string, string> | undefined, fn: () => Promise<T>): Promise<T>;
|
|
75
75
|
export declare function trace<T>(spanName: string, ...args: [fn: (span?: Span) => Promise<T>] | [opts: SpanOptions, fn: (span?: Span) => Promise<T>]): Promise<T>;
|
|
76
|
+
/** Starts a child span without installing it as the active context. */
|
|
77
|
+
export declare function startTraceSpan(spanName: string): Promise<{
|
|
78
|
+
end: () => void;
|
|
79
|
+
fail: (error: unknown) => void;
|
|
80
|
+
}>;
|
|
81
|
+
/** Bind work to the currently active span even when it starts from a child. */
|
|
82
|
+
export declare function bindActiveTraceContext<Args extends unknown[], Result>(fn: (...args: Args) => Result): Promise<(...args: Args) => Result>;
|
|
83
|
+
/** Keeps a parked workflow's ambient trace context aligned with each resume. */
|
|
84
|
+
export declare function createRefreshableTraceContext(): Promise<{
|
|
85
|
+
refresh(): void;
|
|
86
|
+
run: <T>(fn: () => T) => T;
|
|
87
|
+
}>;
|
|
76
88
|
/**
|
|
77
89
|
* Emit a span whose start is back-dated to `startEpochMs` and whose end is now,
|
|
78
90
|
* so its duration reflects an interval only measurable at its end (e.g.
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const version = "5.0.0-beta.
|
|
1
|
+
export declare const version = "5.0.0-beta.47";
|
|
2
2
|
//# sourceMappingURL=version.d.ts.map
|
|
@@ -1,27 +1,25 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Script } from 'node:vm';
|
|
2
2
|
/**
|
|
3
|
-
* Returns a compiled `vm.Script` for the given
|
|
4
|
-
*
|
|
5
|
-
*
|
|
3
|
+
* Returns a compiled `vm.Script` for the given source code and filename,
|
|
4
|
+
* compiling and caching it on first use. Subsequent calls with the same
|
|
5
|
+
* `(code, filename)` return the cached `Script`.
|
|
6
6
|
*
|
|
7
7
|
* The returned `Script` is not yet bound to any context; the caller runs it
|
|
8
8
|
* against a specific VM context via `script.runInContext(context)`. This is
|
|
9
9
|
* equivalent to `vm.runInContext(code, context, { filename })` but skips the
|
|
10
10
|
* recompile.
|
|
11
11
|
*/
|
|
12
|
-
export declare function getCachedWorkflowScript(code: string, filename: string):
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
*/
|
|
17
|
-
export declare function runCachedWorkflowScript(code: string, filename: string, context: Context): unknown;
|
|
12
|
+
export declare function getCachedWorkflowScript(code: string, filename: string): {
|
|
13
|
+
script: Script;
|
|
14
|
+
cacheHit: boolean;
|
|
15
|
+
};
|
|
18
16
|
/**
|
|
19
17
|
* Clears the compiled-script cache. Intended for tests that want to assert
|
|
20
18
|
* compile-vs-cache behaviour in isolation; not used on the hot path.
|
|
21
19
|
*/
|
|
22
20
|
export declare function clearWorkflowScriptCache(): void;
|
|
23
21
|
/**
|
|
24
|
-
* Number of distinct
|
|
22
|
+
* Number of distinct script source strings currently retained. Exposed for
|
|
25
23
|
* tests asserting the LRU bound; not used on the hot path.
|
|
26
24
|
*/
|
|
27
25
|
export declare function workflowScriptCacheSize(): number;
|
|
@@ -23,7 +23,7 @@ export declare class WorkflowAbortSignal {
|
|
|
23
23
|
/**
|
|
24
24
|
* @internal Sets aborted state and fires listeners.
|
|
25
25
|
* Called by abort() on first-run, or by the events consumer on replay.
|
|
26
|
-
* Idempotent
|
|
26
|
+
* Idempotent: second call is a no-op.
|
|
27
27
|
*/
|
|
28
28
|
_setAborted(reason?: unknown): void;
|
|
29
29
|
addEventListener(type: string, listener: () => void): void;
|
|
@@ -35,7 +35,7 @@ export interface SetAttributesOptions {
|
|
|
35
35
|
* framework/library code (telemetry, agent metadata, etc.). User code
|
|
36
36
|
* trying to write a `$`-prefixed key throws `FatalError`. If you are a
|
|
37
37
|
* framework author and need to set a reserved key, pass
|
|
38
|
-
* `{ allowReservedAttributes: true }` as the second argument
|
|
38
|
+
* `{ allowReservedAttributes: true }` as the second argument; see
|
|
39
39
|
* `SetAttributesOptions` for the trade-offs.
|
|
40
40
|
*
|
|
41
41
|
* **WARNING**: Calling e.g.
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* VM/step-bundle stub for `@workflow/core/runtime/world-init`.
|
|
3
3
|
*
|
|
4
|
-
* Resolved via the `workflow` export condition. Empty by design
|
|
4
|
+
* Resolved via the `workflow` export condition. Empty by design: the host
|
|
5
5
|
* is responsible for loading `world.ts` and populating the globalThis
|
|
6
6
|
* world cache before any VM or step code executes. Including this module
|
|
7
7
|
* (rather than letting the resolver fall through to the host file) keeps
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{Cr as e,Sr as t,_r as n,nr as r,tr as i,wr as a}from"../../_chunks/workflow/wait-until-BtySPYD0.js";import{i as o,u as s}from"../../_chunks/workflow/dist-DjojkP5e.js";import{i as c}from"../../_chunks/workflow/workflow-routes-CwqB063q.js";import{c as l,i as u,o as d,r as f,t as p}from"../../_chunks/workflow/attribute-changes-BwAadFfB.js";import{t as m}from"../../_chunks/workflow/sleep-3_A5uOp-.js";import{t as h}from"../../_chunks/workflow/run-DzyAoGh4.js";r(i,h);function g(e){let n=globalThis[t];return n||u(`createHook()`,`https://workflow-sdk.dev/docs/api-reference/workflow/create-hook`,g),n(e)}function _(e){let{respondWith:t,token:n,...r}=e??{};if(n!==void 0)throw Error("`createWebhook()` does not accept a `token` option. Webhook tokens are always generated for you. Use `createHook()` with `resumeHook()` for deterministic token patterns.");let i;t!==void 0&&(i={respondWith:t});let a=g({...r,metadata:i,isWebhook:!0}),{url:o}=l();return a.url=c(o,{type:`webhook`,token:a.token}),a}function v(){function e(t,n){d(`defineHook().resume()`,`https://workflow-sdk.dev/docs/api-reference/workflow-api/resume-hook`,e)}return{create(e){return g(e)},resume:e}}async function y(e,t={}){let n=p(e,t);if(n.length===0)return;let r=t.allowReservedAttributes===!0,i=globalThis[a];if(!i)throw new o("setAttributes() called outside a workflow runtime context. It must be called from within a workflow body (`use workflow`).");await i(n,r?{allowReservedAttributes:!0}:{})}function b(t={}){let{namespace:r}=t,i=globalThis[e](r);return Object.create(globalThis.WritableStream.prototype,{[n]:{value:i,writable:!1}})}function x(){f(`getStepMetadata()`,`https://workflow-sdk.dev/docs/api-reference/workflow/get-step-metadata`,x)}function S(){d(`resumeHook()`,`https://workflow-sdk.dev/docs/api-reference/workflow-api/resume-hook`,S)}export{o as FatalError,s as RetryableError,g as createHook,_ as createWebhook,v as defineHook,x as getStepMetadata,l as getWorkflowMetadata,b as getWritable,S as resumeHook,y as setAttributes,m as sleep};
|