eve 0.70.0 → 0.70.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 +37 -0
- package/dist/src/channel/adapter.js +1 -1
- package/dist/src/channel/channel-operations.js +1 -1
- package/dist/src/channel/resolve-text.d.ts +8 -0
- package/dist/src/channel/resolve-text.js +2 -1
- package/dist/src/cli/banner.d.ts +2 -2
- package/dist/src/cli/banner.js +1 -1
- package/dist/src/cli/commands/init-agent-workspace.js +1 -1
- package/dist/src/cli/commands/init.js +1 -1
- package/dist/src/cli/dev/tui/prompt-commands.d.ts +7 -7
- package/dist/src/cli/dev/tui/prompt-commands.js +1 -1
- package/dist/src/cli/dev/tui/runner.d.ts +4 -3
- package/dist/src/cli/dev/tui/runner.js +2 -2
- package/dist/src/cli/dev/tui/task-activity.d.ts +0 -17
- package/dist/src/cli/dev/tui/task-activity.js +1 -1
- package/dist/src/cli/dev/tui/task-records.d.ts +17 -0
- package/dist/src/cli/dev/tui/task-records.js +1 -0
- package/dist/src/cli/dev/tui/terminal-renderer.js +2 -2
- package/dist/src/cli/dev/tui/test/mock-terminal.d.ts +7 -1
- package/dist/src/cli/dev/tui/test/mock-terminal.js +4 -3
- package/dist/src/cli/dev/tui/theme.d.ts +1 -1
- package/dist/src/cli/dev/tui/theme.js +1 -1
- package/dist/src/cli/dev/tui/tool-presentation.d.ts +15 -2
- package/dist/src/cli/dev/tui/tool-presentation.js +1 -1
- package/dist/src/cli/dev/tui/transcript-parts.d.ts +10 -2
- package/dist/src/cli/dev/tui/transcript-parts.js +2 -2
- package/dist/src/cli/dev/tui/transcript.js +1 -1
- package/dist/src/compiled/.vendor-stamp.json +8 -8
- package/dist/src/compiled/@photon-ai/chat-adapter-imessage/index.js +1 -1
- package/dist/src/compiled/@vercel/sandbox/index.js +1 -1
- package/dist/src/compiled/@workflow/core/index.js +2 -2
- package/dist/src/compiled/@workflow/core/runtime/constants.d.ts +15 -0
- package/dist/src/compiled/@workflow/core/runtime/dynamic-workflow.d.ts +182 -0
- package/dist/src/compiled/@workflow/core/runtime/helpers.d.ts +7 -0
- package/dist/src/compiled/@workflow/core/runtime/helpers.js +1 -1
- package/dist/src/compiled/@workflow/core/runtime/quickjs-assets.generated.d.ts +7 -0
- package/dist/src/compiled/@workflow/core/runtime/quickjs-entrypoint.d.ts +2 -30
- package/dist/src/compiled/@workflow/core/runtime/quickjs-log-view.d.ts +27 -4
- package/dist/src/compiled/@workflow/core/runtime/quickjs-runtime.d.ts +55 -3
- package/dist/src/compiled/@workflow/core/runtime/quickjs-snapshot-codec.d.ts +74 -0
- package/dist/src/compiled/@workflow/core/runtime/start.d.ts +4 -0
- package/dist/src/compiled/@workflow/core/runtime/vm-mode.d.ts +44 -0
- package/dist/src/compiled/@workflow/core/runtime.d.ts +1 -1
- package/dist/src/compiled/@workflow/core/runtime.js +4 -4
- package/dist/src/compiled/@workflow/core/schemas.d.ts +1 -1
- package/dist/src/compiled/@workflow/core/serialization/compression.d.ts +27 -2
- package/dist/src/compiled/@workflow/core/serialization/hardened.d.ts +8 -0
- package/dist/src/compiled/@workflow/core/serialization/types.d.ts +1 -0
- package/dist/src/compiled/@workflow/core/serialization.d.ts +48 -0
- package/dist/src/compiled/@workflow/core/serialization.js +1 -1
- package/dist/src/compiled/@workflow/core/set-error-stack.d.ts +12 -0
- package/dist/src/compiled/@workflow/core/telemetry/semantic-conventions.d.ts +47 -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/world/events.d.ts +10 -0
- package/dist/src/compiled/@workflow/world/index.d.ts +2 -0
- package/dist/src/compiled/@workflow/world/interfaces.d.ts +127 -0
- package/dist/src/compiled/@workflow/world/queue.d.ts +6 -0
- package/dist/src/compiled/@workflow/world/runs.d.ts +9 -2
- package/dist/src/compiled/@workflow/world/snapshots.d.ts +60 -0
- package/dist/src/compiled/@workflow/world-local/index.js +5 -5
- package/dist/src/compiled/@workflow/world-vercel/index.js +19 -17
- package/dist/src/compiled/_chunks/node/undici-B61sz6UT.js +95 -0
- package/dist/src/compiled/_chunks/workflow/{attribute-changes-D721NpZv.js → attribute-changes-VaTKT4K8.js} +3 -3
- package/dist/src/compiled/_chunks/workflow/dist-B7NC1c9-.js +1 -0
- package/dist/src/compiled/_chunks/workflow/{functions-DpZiBxgQ.js → functions-CKkqf9V6.js} +1 -1
- package/dist/src/compiled/_chunks/workflow/helpers-CP9TjeO8.js +1 -0
- package/dist/src/compiled/_chunks/workflow/{logger-D4GJNTk4.js → logger-oqfblE3p.js} +2 -2
- package/dist/src/compiled/_chunks/workflow/resume-hook-yq-NAdBu.js +1 -0
- package/dist/src/compiled/_chunks/workflow/run-DYKeqbob.js +32 -0
- package/dist/src/compiled/_chunks/workflow/serialization-APSKphN5.js +3 -0
- package/dist/src/compiled/_chunks/workflow/signal-exit-iIdjQcCK.js +95 -0
- package/dist/src/compiled/_chunks/workflow/sleep-Ba8SExMt.js +1 -0
- package/dist/src/compiled/_chunks/workflow/{token-BhlnqoHM.js → token-BKeK6DmC.js} +1 -1
- package/dist/src/compiled/_chunks/workflow/token-Cv2GYj9A.js +1 -0
- package/dist/src/compiled/_chunks/workflow/{token-util-DaeRTzDa.js → token-util-CddTZ_ef.js} +1 -1
- package/dist/src/compiled/_chunks/workflow/{wait-until-3_1djUuL.js → wait-until-Dc9s3yyP.js} +1 -1
- package/dist/src/compiled/_chunks/workflow/{wrapper-CzrF_dmI.js → wrapper-Dq4OeGmJ.js} +4 -4
- package/dist/src/compiled/{gray-matter → js-yaml}/LICENSE +2 -2
- package/dist/src/compiled/js-yaml/index.d.ts +12 -0
- package/dist/src/compiled/js-yaml/index.js +34 -0
- package/dist/src/compiled/shadcn-registry/index.js +4 -4
- package/dist/src/context/serialize.d.ts +5 -1
- package/dist/src/context/serialize.js +1 -1
- package/dist/src/discover/discover-agent.js +1 -1
- package/dist/src/discover/extension-specifier.d.ts +1 -0
- package/dist/src/discover/extension-specifier.js +1 -1
- package/dist/src/discover/extensions.d.ts +1 -1
- package/dist/src/discover/extensions.js +1 -1
- package/dist/src/discover/project-source.d.ts +5 -0
- package/dist/src/discover/project-source.js +1 -1
- package/dist/src/evals/loaders/yaml.js +1 -1
- package/dist/src/evals/session.d.ts +1 -0
- package/dist/src/evals/session.js +1 -1
- package/dist/src/evals/types.d.ts +6 -0
- package/dist/src/execution/dynamic-workflow/tool.js +1 -1
- package/dist/src/execution/legacy-remote-agent/protocol.d.ts +8 -0
- package/dist/src/execution/legacy-remote-agent/protocol.js +1 -1
- package/dist/src/execution/legacy-session/turn-workflow.js +1 -1
- package/dist/src/execution/proxied-deliver-step.d.ts +11 -0
- package/dist/src/execution/proxied-deliver-step.js +1 -1
- package/dist/src/execution/sandbox/read-file.d.ts +8 -1
- package/dist/src/execution/sandbox/read-file.js +3 -3
- package/dist/src/execution/session/active-turn.d.ts +4 -1
- package/dist/src/execution/session/active-turn.js +1 -1
- package/dist/src/execution/session/checkpoint-migrations.d.ts +23 -0
- package/dist/src/execution/session/checkpoint-migrations.js +1 -0
- package/dist/src/execution/session/entry-input.d.ts +23 -5
- package/dist/src/execution/session/entry.js +1 -1
- package/dist/src/execution/session/finalization.js +1 -1
- package/dist/src/execution/session/handoff-steps.d.ts +24 -5
- package/dist/src/execution/session/handoff-steps.js +1 -1
- package/dist/src/execution/session/handoff.d.ts +40 -16
- package/dist/src/execution/session/handoff.js +1 -1
- package/dist/src/execution/session/pending-turn-state.d.ts +2 -0
- package/dist/src/execution/session/pending-turn-state.js +1 -1
- package/dist/src/execution/session/program.d.ts +16 -3
- package/dist/src/execution/session/program.js +1 -1
- package/dist/src/execution/session/turn-step-result.js +1 -1
- package/dist/src/execution/session/turn-step-types.d.ts +13 -1
- package/dist/src/execution/session/turn-step.js +1 -1
- package/dist/src/execution/session/turn.d.ts +14 -2
- package/dist/src/execution/session/turn.js +1 -1
- package/dist/src/execution/tools/agent-router-workflow.js +1 -1
- package/dist/src/execution/workflow-runtime.d.ts +4 -4
- package/dist/src/execution/workflow-runtime.js +1 -1
- package/dist/src/harness/attachment-staging.d.ts +27 -7
- package/dist/src/harness/attachment-staging.js +1 -1
- package/dist/src/harness/compaction-prompt.js +2 -2
- package/dist/src/harness/input-requests.js +1 -1
- package/dist/src/harness/messages.js +1 -1
- package/dist/src/harness/token-estimate.d.ts +5 -3
- package/dist/src/harness/token-estimate.js +1 -1
- package/dist/src/harness/tool-loop.js +2 -2
- package/dist/src/internal/application/package.js +1 -1
- package/dist/src/internal/attachments/media-metadata.d.ts +25 -0
- package/dist/src/internal/attachments/media-metadata.js +1 -0
- package/dist/src/internal/attachments/sandbox-refs.d.ts +12 -7
- package/dist/src/internal/attachments/sandbox-refs.js +1 -1
- package/dist/src/internal/authored-module-loader.js +1 -1
- package/dist/src/internal/bundler/extension-mount-plugin.d.ts +4 -0
- package/dist/src/internal/bundler/extension-mount-plugin.js +1 -1
- package/dist/src/internal/bundler/extension-scope-plugin.js +2 -2
- package/dist/src/internal/helpers/frontmatter.d.ts +24 -0
- package/dist/src/internal/helpers/frontmatter.js +1 -0
- package/dist/src/internal/helpers/markdown.js +1 -3
- package/dist/src/internal/input-text.d.ts +12 -0
- package/dist/src/internal/input-text.js +1 -0
- package/dist/src/internal/nitro/host/create-application-nitro.js +1 -1
- package/dist/src/internal/nitro/host/nitro-bundler-config.js +1 -1
- package/dist/src/internal/node-esm-compat-banner.js +1 -1
- package/dist/src/internal/workflow/vercel-world-defaults.d.ts +1 -1
- package/dist/src/internal/workflow/vercel-world-defaults.js +1 -1
- package/dist/src/public/channels/chat-sdk/input-actions.d.ts +8 -2
- package/dist/src/public/channels/chat-sdk/input-actions.js +4 -1
- package/dist/src/public/channels/github/defaults.js +2 -3
- package/dist/src/public/channels/linear/hitl.js +2 -3
- package/dist/src/public/channels/slack/action-status.d.ts +10 -5
- package/dist/src/public/channels/slack/action-status.js +1 -1
- package/dist/src/public/channels/slack/defaults.js +3 -3
- package/dist/src/public/channels/slack/limits.d.ts +1 -1
- package/dist/src/public/channels/slack/limits.js +1 -1
- package/dist/src/public/channels/slack/slackChannel.d.ts +11 -9
- package/dist/src/public/channels/slack/slackChannel.js +1 -1
- package/dist/src/public/channels/slack/task-card.js +1 -1
- package/dist/src/public/channels/slack/thread-status.d.ts +33 -0
- package/dist/src/public/channels/slack/thread-status.js +1 -0
- package/dist/src/public/channels/twilio/defaults.js +4 -2
- package/dist/src/public/definitions/state.d.ts +2 -0
- package/dist/src/public/definitions/state.js +1 -1
- package/dist/src/runtime/connections/openapi-spec.d.ts +1 -4
- package/dist/src/runtime/connections/openapi-spec.js +1 -1
- package/dist/src/setup/scaffold/create/project.js +1 -1
- package/dist/src/setup/scaffold/create/web-template.d.ts +4 -4
- package/dist/src/setup/scaffold/create/web-template.js +33 -26
- package/dist/src/subagents/callback-route.js +1 -1
- package/dist/src/subagents/hitl-proxy.d.ts +2 -2
- package/dist/src/subagents/hitl-proxy.js +1 -1
- package/dist/src/subagents/parent-notification.d.ts +7 -7
- package/dist/src/subagents/parent-notification.js +1 -1
- package/dist/src/tools/provided/ask-question-workflow.js +1 -1
- package/dist/src/tools/provided/read-file.d.ts +7 -0
- package/dist/src/tools/provided/read-file.js +2 -2
- package/dist/src/tools/provided/sleep-workflow.js +1 -1
- package/docs/agent-config.md +2 -2
- package/docs/channels/chat-sdk.mdx +1 -1
- package/docs/channels/slack.mdx +21 -15
- package/docs/channels/twilio.mdx +1 -1
- package/docs/concepts/built-in-tools.md +1 -1
- package/docs/concepts/default-harness.md +4 -0
- package/docs/concepts/execution-model-and-durability.mdx +9 -1
- package/docs/concepts/sessions-runs-and-streaming.md +3 -3
- package/docs/evals/cases.mdx +1 -0
- package/docs/extensions.md +6 -3
- package/docs/guides/dev-tui.md +5 -3
- package/docs/guides/dynamic-capabilities.md +1 -1
- package/docs/sandbox/index.mdx +11 -0
- package/docs/tools/overview.mdx +4 -2
- package/package.json +8 -8
- package/dist/src/compiled/_chunks/node/undici-h5GH4RBM.js +0 -95
- package/dist/src/compiled/_chunks/workflow/debug-log-CVPstO1D.js +0 -1
- package/dist/src/compiled/_chunks/workflow/dist-BUFGAKRb.js +0 -1
- package/dist/src/compiled/_chunks/workflow/frames-Dr9fHWdo.js +0 -3
- package/dist/src/compiled/_chunks/workflow/helpers-DkKxg_yn.js +0 -1
- package/dist/src/compiled/_chunks/workflow/resume-hook-uTW-jBYz.js +0 -1
- package/dist/src/compiled/_chunks/workflow/run-5DmiMN9b.js +0 -1
- package/dist/src/compiled/_chunks/workflow/serialization-CNIYl1D3.js +0 -3
- package/dist/src/compiled/_chunks/workflow/signal-exit-DZKTacNU.js +0 -95
- package/dist/src/compiled/_chunks/workflow/sleep-DFKgN7UG.js +0 -1
- package/dist/src/compiled/_chunks/workflow/token-1wSBbi5N.js +0 -1
- package/dist/src/compiled/_chunks/workflow/token-util-Cm4Ec1Bg.js +0 -1
- package/dist/src/compiled/_chunks/workflow/ws-transport--rYOVIaf.js +0 -1
- package/dist/src/compiled/gray-matter/index.d.ts +0 -62
- package/dist/src/compiled/gray-matter/index.js +0 -48
- package/dist/src/internal/helpers/gray-matter.d.ts +0 -25
- package/dist/src/internal/helpers/gray-matter.js +0 -1
|
@@ -11,5 +11,5 @@
|
|
|
11
11
|
*/
|
|
12
12
|
export type Serializable = string | number | boolean | null | undefined | Serializable[] | {
|
|
13
13
|
[key: string]: Serializable;
|
|
14
|
-
} | ArrayBuffer | bigint | BigInt64Array | BigUint64Array | Date | DOMException | Error | Float32Array | Float64Array | Headers | Int8Array | Int16Array | Int32Array | Map<Serializable, Serializable> | ReadableStream<Uint8Array> | RegExp | Response | Set<Serializable> | URL | URLSearchParams | Uint8Array | Uint8ClampedArray | Uint16Array | Uint32Array | WritableStream<Uint8Array> | AbortController | AbortSignal | ((...args: Serializable[]) => Promise<Serializable>);
|
|
14
|
+
} | ArrayBuffer | bigint | BigInt64Array | BigUint64Array | DataView | Date | DOMException | Error | Float32Array | Float64Array | Headers | Int8Array | Int16Array | Int32Array | Map<Serializable, Serializable> | ReadableStream<Uint8Array> | RegExp | Response | Set<Serializable> | URL | URLSearchParams | Uint8Array | Uint8ClampedArray | Uint16Array | Uint32Array | WritableStream<Uint8Array> | AbortController | AbortSignal | ((...args: Serializable[]) => Promise<Serializable>);
|
|
15
15
|
//# sourceMappingURL=schemas.d.ts.map
|
|
@@ -47,6 +47,14 @@ export declare const COMPRESSION_MIN_BYTES = 1024;
|
|
|
47
47
|
export declare const COMPRESSION_MIN_SAVINGS_RATIO = 0.05;
|
|
48
48
|
/** Which codec compressed a payload (or `none` when stored uncompressed). */
|
|
49
49
|
export type CompressionCodec = 'zstd' | 'gzip' | 'none';
|
|
50
|
+
/**
|
|
51
|
+
* Thrown by {@link decompress} when a payload inflates past the caller's
|
|
52
|
+
* `maxOutputBytes`, so a small compressed input cannot exhaust memory.
|
|
53
|
+
*/
|
|
54
|
+
export declare class DecompressedSizeLimitError extends Error {
|
|
55
|
+
readonly maxOutputBytes: number;
|
|
56
|
+
constructor(maxOutputBytes: number);
|
|
57
|
+
}
|
|
50
58
|
/**
|
|
51
59
|
* Telemetry sink describing what the compression layer did to a payload.
|
|
52
60
|
* Populated by {@link compress} (write) and {@link decompress} (read) when
|
|
@@ -88,7 +96,16 @@ export interface CompressionStats {
|
|
|
88
96
|
* @returns The compressed data with a codec prefix, or the original data
|
|
89
97
|
* when compression is disabled, unavailable, or not worthwhile.
|
|
90
98
|
*/
|
|
91
|
-
export declare function compress(data: Uint8Array | unknown, enabled: boolean, stats?: CompressionStats
|
|
99
|
+
export declare function compress(data: Uint8Array | unknown, enabled: boolean, stats?: CompressionStats, opts?: {
|
|
100
|
+
/**
|
|
101
|
+
* Compress off the event loop where the codec supports it (zstd via
|
|
102
|
+
* the libuv threadpool; gzip is stream-based and already async).
|
|
103
|
+
* For multi-MB payloads compressed while a response is flushing —
|
|
104
|
+
* the sync zstd path would block the loop for the whole compression.
|
|
105
|
+
* Output bytes are identical either way.
|
|
106
|
+
*/
|
|
107
|
+
preferAsync?: boolean;
|
|
108
|
+
}): Promise<Uint8Array | unknown>;
|
|
92
109
|
/**
|
|
93
110
|
* Decompress a format-prefixed payload if it's compressed.
|
|
94
111
|
* Dispatches on the prefix ('zstd' or 'gzip') and inflates the inner
|
|
@@ -97,7 +114,15 @@ export declare function compress(data: Uint8Array | unknown, enabled: boolean, s
|
|
|
97
114
|
* Non-compressed data (including non-binary legacy data) is returned
|
|
98
115
|
* unchanged, so this is safe to apply unconditionally on read paths.
|
|
99
116
|
*/
|
|
100
|
-
export declare function decompress(data: Uint8Array | unknown, stats?: CompressionStats
|
|
117
|
+
export declare function decompress(data: Uint8Array | unknown, stats?: CompressionStats, opts?: {
|
|
118
|
+
/**
|
|
119
|
+
* Refuse to inflate past this many bytes (throws
|
|
120
|
+
* {@link DecompressedSizeLimitError}). For payloads from storage that
|
|
121
|
+
* may be hostile or corrupt, where a small input could otherwise
|
|
122
|
+
* inflate without bound.
|
|
123
|
+
*/
|
|
124
|
+
maxOutputBytes?: number;
|
|
125
|
+
}): Promise<Uint8Array | unknown>;
|
|
101
126
|
/**
|
|
102
127
|
* Check if data is compressed (has a 'zstd' or 'gzip' format prefix).
|
|
103
128
|
*/
|
|
@@ -132,6 +132,14 @@ export declare function urlSearchParamsToString(value: URLSearchParams): string;
|
|
|
132
132
|
/**
|
|
133
133
|
* Iterates a Headers instance through the captured host iterator, so the
|
|
134
134
|
* iterator object, and its `next`, are host-realm.
|
|
135
|
+
*
|
|
136
|
+
* Some server runtimes hand out Headers look-alikes: objects that inherit
|
|
137
|
+
* from `Headers.prototype` and forward every method to a wrapped native
|
|
138
|
+
* instance (srvx, used by Nitro, does this for incoming request headers).
|
|
139
|
+
* They carry no native header state, so the host iterator rejects them with
|
|
140
|
+
* a TypeError on runtimes whose undici keeps that state in private fields
|
|
141
|
+
* (Node 24+). Those fall back to the object's own iterator, which runs
|
|
142
|
+
* non-intrinsic code and is recorded as such.
|
|
135
143
|
*/
|
|
136
144
|
export declare function headersToEntries(value: Headers): [string, string][];
|
|
137
145
|
/**
|
|
@@ -150,6 +150,7 @@ export declare function getCommonRevivers(global?: Record<string, any>): {
|
|
|
150
150
|
BigInt?: ((value: string) => any) | undefined;
|
|
151
151
|
BigInt64Array?: ((value: string) => any) | undefined;
|
|
152
152
|
BigUint64Array?: ((value: string) => any) | undefined;
|
|
153
|
+
DataViewBytes?: ((value: string) => any) | undefined;
|
|
153
154
|
Date?: ((value: string) => any) | undefined;
|
|
154
155
|
DOMException?: ((value: {
|
|
155
156
|
message: string;
|
|
@@ -531,6 +532,53 @@ export declare function dehydrateStepError(value: unknown, runId: string, key: P
|
|
|
531
532
|
* @returns The hydrated thrown value, ready to reject the step promise
|
|
532
533
|
*/
|
|
533
534
|
export declare function hydrateStepError(value: Uint8Array | unknown, _runId: string, key: PayloadKey | undefined, global?: Record<string, any>, extraRevivers?: Record<string, (value: any) => any>, prepared?: PreparedReplayPayload): Promise<unknown>;
|
|
535
|
+
/**
|
|
536
|
+
* Serialize a dynamic run's generated workflow VM code for storage.
|
|
537
|
+
*
|
|
538
|
+
* Dynamic workflow code is application source, so it gets the same treatment
|
|
539
|
+
* as any other run payload: compressed (it is plain text, which compresses
|
|
540
|
+
* very well), then encrypted with the run's key. At rest it is opaque
|
|
541
|
+
* ciphertext, which is the point — generated orchestration can name internal
|
|
542
|
+
* step ids, prompts, and business rules, and observability surfaces must not
|
|
543
|
+
* read it without going through the decrypt flow.
|
|
544
|
+
*
|
|
545
|
+
* The code is a plain string, so it needs none of the reducers the other
|
|
546
|
+
* payloads go through, but it is still written as real devalue under the
|
|
547
|
+
* `DEVALUE_V1` prefix: the generic hydrators (`hydrateData` behind the CLI
|
|
548
|
+
* and the observability UI) trust that prefix and hand the bytes to
|
|
549
|
+
* devalue's `parse`, which rejects a bare JSON string as invalid input.
|
|
550
|
+
*
|
|
551
|
+
* @param code - Generated workflow VM code.
|
|
552
|
+
* @param key - Encryption key (undefined to skip encryption).
|
|
553
|
+
* @param compression - Whether the target run may carry compressed payloads.
|
|
554
|
+
*/
|
|
555
|
+
export declare function dehydrateDynamicWorkflowCode(code: string, key: PayloadKey | undefined, compression?: boolean): Promise<Uint8Array>;
|
|
556
|
+
/**
|
|
557
|
+
* Hydrate a dynamic run's workflow VM code back into source, on the replay
|
|
558
|
+
* path.
|
|
559
|
+
*
|
|
560
|
+
* When the run has key material, or its execution context records that it was
|
|
561
|
+
* started with encryption, only the symmetric `encr` envelope is accepted.
|
|
562
|
+
* Plaintext would let anyone who can write the run record supply code, and a
|
|
563
|
+
* sealed `encp` envelope can be produced by anyone holding the run's public
|
|
564
|
+
* key, so neither is evidence that the run's own key encrypted it. This gives
|
|
565
|
+
* confidentiality and narrows who can supply code; it is not an integrity
|
|
566
|
+
* guarantee against a holder of the run key.
|
|
567
|
+
*
|
|
568
|
+
* Without key material (Worlds with no encryption), plaintext is accepted.
|
|
569
|
+
*
|
|
570
|
+
* @param value - Stored bytes from the run's `dynamicWorkflowCode`.
|
|
571
|
+
* @param key - Encryption key (undefined when encryption is disabled).
|
|
572
|
+
* @param options.encryptionRequired - The run was started with encryption
|
|
573
|
+
* (`executionContext.features.encryption`), so plaintext is refused even
|
|
574
|
+
* when no key was resolved.
|
|
575
|
+
* @throws SerializationError when the payload is not `encr` although
|
|
576
|
+
* encryption is required, or does not decode to a string: a corrupted or
|
|
577
|
+
* foreign payload must not reach the workflow VM as code.
|
|
578
|
+
*/
|
|
579
|
+
export declare function hydrateDynamicWorkflowCode(value: Uint8Array | unknown, key: PayloadKey | undefined, options?: {
|
|
580
|
+
encryptionRequired?: boolean;
|
|
581
|
+
}): Promise<string>;
|
|
534
582
|
/**
|
|
535
583
|
* Called from the workflow handler when the workflow itself throws.
|
|
536
584
|
* Dehydrates the thrown value from within the workflow execution environment
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{Bn as e,Fn as t,Gn as n,Hn as r,In as i,
|
|
1
|
+
import{Bn as e,Fn as t,Gn as n,Hn as r,In as i,Jn as a,Kn as o,Ln as s,Rn as c,Un as l,Wn as u,Yn as d,qn as f,zn as p}from"../../_chunks/workflow/logger-oqfblE3p.js";import{A as m,C as h,D as g,E as _,F as v,I as y,L as b,M as x,N as S,O as C,P as w,R as T,S as E,T as D,X as O,Y as k,_ as A,a as j,b as M,c as N,d as P,f as F,g as I,h as L,i as R,j as z,k as B,l as V,m as H,n as U,o as W,p as G,r as K,s as q,t as J,u as Y,v as X,w as Z,x as Q,y as $,z as ee}from"../../_chunks/workflow/serialization-APSKphN5.js";export{J as FRAMED_STREAM_MAX_RECONNECTS,U as FRAMED_STREAM_MAX_TOTAL_RECONNECTS,a as SerializationFormat,K as WorkflowServerReadableStream,R as WorkflowServerWritableStream,t as aesKeyOf,j as cancelAbortReaders,k as compress,W as createForwardedWritable,q as createReconnectingFramedStream,u as decodeFormatPrefix,O as decompress,i as decrypt,N as dehydrateDynamicWorkflowCode,V as dehydrateRunError,Y as dehydrateStepArguments,P as dehydrateStepError,F as dehydrateStepReturnValue,G as dehydrateWorkflowArguments,H as dehydrateWorkflowReturnValue,s as deriveRunPayloadKeys,L as deserializePreparedReplayPayload,I as deserializePreparedStepError,n as encodeWithFormatPrefix,c as encrypt,A as getByteFramingStream,X as getByteUnframingStream,$ as getCommonRevivers,M as getDeserializeStream,Q as getExternalReducers,E as getExternalRevivers,h as getForwardedWritableEncryptionKey,Z as getRunReadableStream,D as getSerializeStream,_ as getStreamType,g as getWorkflowReducers,C as getWorkflowRevivers,B as hydrateDynamicWorkflowCode,m as hydrateRunError,z as hydrateStepArguments,x as hydrateStepError,S as hydrateStepReturnValue,w as hydrateWorkflowArguments,v as hydrateWorkflowReturnValue,o as isEncrypted,d as isFormatPrefix,p as isRunPayloadKeys,e as isSealTarget,y as maybeDecrypt,b as maybeEncrypt,f as peekFormatPrefix,T as prepareReplayPayload,r as runPayloadKeys,l as sealTo,ee as tagForwardedWritableTarget};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Replaces `error.stack` with `stack` when the property allows it.
|
|
3
|
+
*
|
|
4
|
+
* Some libraries redefine `stack` on the errors they throw. postgres.js, for
|
|
5
|
+
* example, uses `Object.defineProperties(err, { stack: { value } })`, which
|
|
6
|
+
* turns it into a non-writable data property. Assigning to it throws a
|
|
7
|
+
* `TypeError` in strict mode, and that `TypeError` would replace the user's
|
|
8
|
+
* error. A non-writable `stack` that is still configurable is redefined; one
|
|
9
|
+
* that cannot be changed at all keeps its original value.
|
|
10
|
+
*/
|
|
11
|
+
export declare function setErrorStack(error: Error, stack: string): void;
|
|
12
|
+
//# sourceMappingURL=set-error-stack.d.ts.map
|
|
@@ -64,6 +64,25 @@ export declare const WorkflowEventsCount: (value: number) => {
|
|
|
64
64
|
export declare const WorkflowExecutionMode: (value: "replay" | "retained") => {
|
|
65
65
|
[k: string]: "replay" | "retained";
|
|
66
66
|
};
|
|
67
|
+
/**
|
|
68
|
+
* Whether the run executes dynamic workflow code stored with the run rather
|
|
69
|
+
* than the deployment's workflow bundle.
|
|
70
|
+
*/
|
|
71
|
+
export declare const WorkflowDynamic: (value: boolean) => {
|
|
72
|
+
[k: string]: boolean;
|
|
73
|
+
};
|
|
74
|
+
/** SHA-256 of a dynamic run's source and step bindings. */
|
|
75
|
+
export declare const WorkflowDynamicSourceHash: (value: string) => {
|
|
76
|
+
[k: string]: string;
|
|
77
|
+
};
|
|
78
|
+
/** Size in bytes of a dynamic run's serialized workflow code. */
|
|
79
|
+
export declare const WorkflowDynamicCodeBytes: (value: number) => {
|
|
80
|
+
[k: string]: number;
|
|
81
|
+
};
|
|
82
|
+
/** Whether a dynamic run's code was stored inline or behind a ref. */
|
|
83
|
+
export declare const WorkflowDynamicCodeStorage: (value: "inline" | "ref") => {
|
|
84
|
+
[k: string]: "inline" | "ref";
|
|
85
|
+
};
|
|
67
86
|
/** Whether the compiled application workflow bundle was cached. */
|
|
68
87
|
export declare const WorkflowBundleCompileCacheHit: (value: boolean) => {
|
|
69
88
|
[k: string]: boolean;
|
|
@@ -136,6 +155,34 @@ export declare const QuickJSPendingOpsCount: (value: number) => {
|
|
|
136
155
|
export declare const QuickJSInlineSteps: (value: number) => {
|
|
137
156
|
[k: string]: number;
|
|
138
157
|
};
|
|
158
|
+
/** Whether this QuickJS invocation restored a persisted VM snapshot */
|
|
159
|
+
export declare const QuickJSSnapshotRestored: (value: boolean) => {
|
|
160
|
+
[k: string]: boolean;
|
|
161
|
+
};
|
|
162
|
+
/** Events replayed on top of a restored snapshot (the delta after its cursor) */
|
|
163
|
+
export declare const QuickJSSnapshotDeltaEvents: (value: number) => {
|
|
164
|
+
[k: string]: number;
|
|
165
|
+
};
|
|
166
|
+
/** Time spent loading, verifying and decoding a persisted snapshot */
|
|
167
|
+
export declare const QuickJSSnapshotRestoreMs: (value: number) => {
|
|
168
|
+
[k: string]: number;
|
|
169
|
+
};
|
|
170
|
+
/** Why a stored snapshot was not restored (the invocation replayed in full) */
|
|
171
|
+
export declare const QuickJSSnapshotFallbackReason: (value: string) => {
|
|
172
|
+
[k: string]: string;
|
|
173
|
+
};
|
|
174
|
+
/** Time the post-response snapshot save pipeline took */
|
|
175
|
+
export declare const QuickJSSnapshotSaveMs: (value: number) => {
|
|
176
|
+
[k: string]: number;
|
|
177
|
+
};
|
|
178
|
+
/** Uncompressed size of a saved VM snapshot */
|
|
179
|
+
export declare const QuickJSSnapshotPlaintextBytes: (value: number) => {
|
|
180
|
+
[k: string]: number;
|
|
181
|
+
};
|
|
182
|
+
/** Stored (compressed, encrypted) size of a saved VM snapshot */
|
|
183
|
+
export declare const QuickJSSnapshotStoredBytes: (value: number) => {
|
|
184
|
+
[k: string]: number;
|
|
185
|
+
};
|
|
139
186
|
/** Active trace-correlation mode for this invocation (linked or continuous) */
|
|
140
187
|
export declare const WorkflowTraceMode: (value: "linked" | "continuous") => {
|
|
141
188
|
[k: string]: "linked" | "continuous";
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const version = "5.0.
|
|
1
|
+
export declare const version = "5.0.1";
|
|
2
2
|
//# sourceMappingURL=version.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{d as e,i as t}from"../../_chunks/workflow/dist-CaNNONeg.js";import{i as n}from"../../_chunks/workflow/workflow-routes-CwqB063q.js";import{
|
|
1
|
+
import{d as e,i as t}from"../../_chunks/workflow/dist-CaNNONeg.js";import{i as n}from"../../_chunks/workflow/workflow-routes-CwqB063q.js";import{Q as r,Z as i,gt as a,ht as o,lt as s,mt as c}from"../../_chunks/workflow/serialization-APSKphN5.js";import{c as l,i as u,o as d,r as f,t as p}from"../../_chunks/workflow/attribute-changes-VaTKT4K8.js";import{t as m}from"../../_chunks/workflow/sleep-Ba8SExMt.js";import{t as h}from"../../_chunks/workflow/run-DYKeqbob.js";r(i,h);function g(e){let t=globalThis[c];return t||u(`createHook()`,`https://workflow-sdk.dev/docs/api-reference/workflow/create-hook`,g),t(e)}function _(e){let{respondWith:t,token:r,...i}=e??{};if(r!==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 a;t!==void 0&&(a={respondWith:t});let o=g({...i,metadata:a,isWebhook:!0}),{url:s}=l();return o.url=n(s,{type:`webhook`,token:o.token}),o}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,n={}){let r=p(e,n);if(r.length===0)return;let i=n.allowReservedAttributes===!0,o=globalThis[a];if(!o)throw new t("setAttributes() called outside a workflow runtime context. It must be called from within a workflow body (`use workflow`).");await o(r,i?{allowReservedAttributes:!0}:{})}function b(e={}){let{namespace:t}=e,n=globalThis[o](t);return Object.create(globalThis.WritableStream.prototype,{[s]:{value:n,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{t as FatalError,e 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};
|
|
@@ -187,6 +187,8 @@ declare const RunCreatedEventSchema: z.ZodObject<{
|
|
|
187
187
|
executionContext: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
|
|
188
188
|
attributes: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
189
189
|
allowReservedAttributes: z.ZodOptional<z.ZodLiteral<true>>;
|
|
190
|
+
dynamicWorkflowCode: z.ZodOptional<z.ZodUnion<readonly [z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>, z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>]>>;
|
|
191
|
+
dynamicWorkflowCodeRef: z.ZodOptional<z.ZodString>;
|
|
190
192
|
encryptionPublicKey: z.ZodOptional<z.ZodString>;
|
|
191
193
|
}, z.core.$strip>;
|
|
192
194
|
}, z.core.$strip>;
|
|
@@ -201,6 +203,8 @@ export declare const CreateEventSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
201
203
|
executionContext: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
|
|
202
204
|
attributes: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
203
205
|
allowReservedAttributes: z.ZodOptional<z.ZodLiteral<true>>;
|
|
206
|
+
dynamicWorkflowCode: z.ZodOptional<z.ZodUnion<readonly [z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>, z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>]>>;
|
|
207
|
+
dynamicWorkflowCodeRef: z.ZodOptional<z.ZodString>;
|
|
204
208
|
encryptionPublicKey: z.ZodOptional<z.ZodString>;
|
|
205
209
|
}, z.core.$strip>;
|
|
206
210
|
}, z.core.$strip>, z.ZodObject<{
|
|
@@ -215,6 +219,8 @@ export declare const CreateEventSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
215
219
|
attributes: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
216
220
|
allowReservedAttributes: z.ZodOptional<z.ZodLiteral<true>>;
|
|
217
221
|
encryptionPublicKey: z.ZodOptional<z.ZodString>;
|
|
222
|
+
dynamicWorkflowCode: z.ZodOptional<z.ZodUnion<readonly [z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>, z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>]>>;
|
|
223
|
+
dynamicWorkflowCodeRef: z.ZodOptional<z.ZodString>;
|
|
218
224
|
}, z.core.$strip>>;
|
|
219
225
|
}, z.core.$strip>, z.ZodObject<{
|
|
220
226
|
correlationId: z.ZodOptional<z.ZodString>;
|
|
@@ -380,6 +386,8 @@ export declare const EventSchema: z.ZodIntersection<z.ZodDiscriminatedUnion<[z.Z
|
|
|
380
386
|
executionContext: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
|
|
381
387
|
attributes: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
382
388
|
allowReservedAttributes: z.ZodOptional<z.ZodLiteral<true>>;
|
|
389
|
+
dynamicWorkflowCode: z.ZodOptional<z.ZodUnion<readonly [z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>, z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>]>>;
|
|
390
|
+
dynamicWorkflowCodeRef: z.ZodOptional<z.ZodString>;
|
|
383
391
|
encryptionPublicKey: z.ZodOptional<z.ZodString>;
|
|
384
392
|
}, z.core.$strip>;
|
|
385
393
|
}, z.core.$strip>, z.ZodObject<{
|
|
@@ -394,6 +402,8 @@ export declare const EventSchema: z.ZodIntersection<z.ZodDiscriminatedUnion<[z.Z
|
|
|
394
402
|
attributes: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
395
403
|
allowReservedAttributes: z.ZodOptional<z.ZodLiteral<true>>;
|
|
396
404
|
encryptionPublicKey: z.ZodOptional<z.ZodString>;
|
|
405
|
+
dynamicWorkflowCode: z.ZodOptional<z.ZodUnion<readonly [z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>, z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>]>>;
|
|
406
|
+
dynamicWorkflowCodeRef: z.ZodOptional<z.ZodString>;
|
|
397
407
|
}, z.core.$strip>>;
|
|
398
408
|
}, z.core.$strip>, z.ZodObject<{
|
|
399
409
|
correlationId: z.ZodOptional<z.ZodString>;
|
|
@@ -21,6 +21,8 @@ export type * from './shared.js';
|
|
|
21
21
|
export type { GetChunksOptions, StreamChunk, StreamChunksResponse, StreamInfoResponse, } from './shared.js';
|
|
22
22
|
export { entityResolveData, PaginatedResponseSchema, StructuredErrorSchema, } from './shared.js';
|
|
23
23
|
export { EVENT_ID_BODY_LENGTH, EVENT_ID_PREFIX, eventIdToSlot, FIRST_EVENT_SLOT, isSlotBody, isSlotEventId, MAX_EVENT_SLOT, requireEventSlot, slotToEventId, } from './slot-identity.js';
|
|
24
|
+
export type * from './snapshots.js';
|
|
25
|
+
export { decodeSnapshotEnvelope, encodeSnapshotEnvelope, SNAPSHOT_FORMAT_VERSION, SnapshotMetadataSchema, } from './snapshots.js';
|
|
24
26
|
export type { SpecVersion } from './spec-version.js';
|
|
25
27
|
export { CAPABILITY_ONLY_SPEC_VERSIONS, crossesStructuralSpecVersion, isLegacySpecVersion, mintedSpecVersion, requiresNewerWorld, SEALED_LOG_ENV_VAR, SPEC_VERSION_CURRENT, SPEC_VERSION_LEGACY, SPEC_VERSION_MAX_SUPPORTED, SPEC_VERSION_SUPPORTS_ATTRIBUTES, SPEC_VERSION_SUPPORTS_CBOR_QUEUE_TRANSPORT, SPEC_VERSION_SUPPORTS_COMPRESSION, SPEC_VERSION_SUPPORTS_EVENT_SOURCING, SPEC_VERSION_SUPPORTS_HOOK_FORCE_CLAIM, SPEC_VERSION_SUPPORTS_SEALED_LOG, SPEC_VERSION_SUPPORTS_SLOT_IDENTITY, STRUCTURAL_SPEC_VERSIONS, } from './spec-version.js';
|
|
26
28
|
export type * from './steps.js';
|
|
@@ -5,6 +5,7 @@ import type { GetHookParams, Hook, ListHooksParams } from './hooks.js';
|
|
|
5
5
|
import type { Queue } from './queue.js';
|
|
6
6
|
import type { BulkCancelWorkflowRunsRequest, BulkCancelWorkflowRunsResult, GetWorkflowRunParams, ListWorkflowRunsParams, WaitForTerminalRunStatusParams, WorkflowRun, WorkflowRunWithoutData } from './runs.js';
|
|
7
7
|
import type { GetChunksOptions, PaginatedResponse, StreamChunksResponse, StreamInfoResponse } from './shared.js';
|
|
8
|
+
import type { SnapshotMetadata } from './snapshots.js';
|
|
8
9
|
import type { GetStepParams, ListWorkflowRunStepsParams, Step, StepWithoutData } from './steps.js';
|
|
9
10
|
export interface StreamWriteSession {
|
|
10
11
|
/**
|
|
@@ -357,6 +358,65 @@ export interface Storage {
|
|
|
357
358
|
*/
|
|
358
359
|
list(params: ListHooksParams): Promise<PaginatedResponse<Hook>>;
|
|
359
360
|
};
|
|
361
|
+
/**
|
|
362
|
+
* VM snapshot storage for the QuickJS engine's VM-memory snapshotting.
|
|
363
|
+
*
|
|
364
|
+
* @experimental The shape of this interface and of `SnapshotMetadata`
|
|
365
|
+
* may change without a major version bump. It is OPTIONAL and World
|
|
366
|
+
* implementations do not need to provide it: a World that omits it
|
|
367
|
+
* simply runs every invocation with full event replay, which is always
|
|
368
|
+
* correct (snapshots are an optimization, never a correctness
|
|
369
|
+
* requirement). Consumers must feature-detect
|
|
370
|
+
* (`world.experimental_snapshots?.…`).
|
|
371
|
+
*
|
|
372
|
+
* Snapshots capture the state of the QuickJS WASM VM at a suspension
|
|
373
|
+
* point, allowing workflow execution to resume from the exact point of
|
|
374
|
+
* suspension instead of replaying the full event log.
|
|
375
|
+
*
|
|
376
|
+
* The metadata (including eventsCursor) is stored alongside the snapshot
|
|
377
|
+
* data so that on restore, only events created after the snapshot need
|
|
378
|
+
* to be fetched. Implementations MUST round-trip the metadata object
|
|
379
|
+
* losslessly and atomically with the bytes it describes — a snapshot
|
|
380
|
+
* paired with another suspension's metadata replays from the wrong log
|
|
381
|
+
* position and silently diverges. The `encodeSnapshotEnvelope` /
|
|
382
|
+
* `decodeSnapshotEnvelope` helpers pack both into one self-describing
|
|
383
|
+
* blob so a plain blob store satisfies this with a single atomic
|
|
384
|
+
* write; worlds with transactional metadata storage may store the
|
|
385
|
+
* fields natively instead.
|
|
386
|
+
*/
|
|
387
|
+
experimental_snapshots?: {
|
|
388
|
+
/**
|
|
389
|
+
* Save a VM snapshot for a workflow run.
|
|
390
|
+
* Each save overwrites the previous snapshot for this run.
|
|
391
|
+
*
|
|
392
|
+
* @param runId - The workflow run ID
|
|
393
|
+
* @param data - The serialized snapshot bytes (from QuickJS.serializeSnapshot())
|
|
394
|
+
* @param metadata - Snapshot metadata including the events cursor
|
|
395
|
+
*/
|
|
396
|
+
save(runId: string, data: Uint8Array, metadata: SnapshotMetadata): Promise<void>;
|
|
397
|
+
/**
|
|
398
|
+
* Load the most recent VM snapshot for a workflow run.
|
|
399
|
+
* Returns null if no snapshot exists (first invocation).
|
|
400
|
+
*
|
|
401
|
+
* @param runId - The workflow run ID
|
|
402
|
+
* @returns The snapshot data and metadata, or null if not found
|
|
403
|
+
*/
|
|
404
|
+
load(runId: string): Promise<{
|
|
405
|
+
data: Uint8Array;
|
|
406
|
+
metadata: SnapshotMetadata;
|
|
407
|
+
} | null>;
|
|
408
|
+
/**
|
|
409
|
+
* Delete the snapshot for a workflow run.
|
|
410
|
+
* Called when the workflow reaches a terminal state (completed,
|
|
411
|
+
* failed, cancelled). MUST be idempotent: terminal-state cleanup is
|
|
412
|
+
* exactly the path most likely to retry or run for a run that never
|
|
413
|
+
* snapshotted, so deleting a nonexistent snapshot resolves
|
|
414
|
+
* successfully.
|
|
415
|
+
*
|
|
416
|
+
* @param runId - The workflow run ID
|
|
417
|
+
*/
|
|
418
|
+
delete(runId: string): Promise<void>;
|
|
419
|
+
};
|
|
360
420
|
}
|
|
361
421
|
/**
|
|
362
422
|
* Optional feature capabilities a World implementation declares so the core
|
|
@@ -472,6 +532,19 @@ export interface WorldCapabilities {
|
|
|
472
532
|
* fail ordinary runs after a version bump.
|
|
473
533
|
*/
|
|
474
534
|
deploymentAffinity?: boolean;
|
|
535
|
+
/**
|
|
536
|
+
* Stores a dynamic run's workflow code with the run. The World must persist
|
|
537
|
+
* `dynamicWorkflowCode` from `run_created` (and from a resilient
|
|
538
|
+
* `run_started` that creates the run), echo it on the created run, and
|
|
539
|
+
* return it from `runs.get` with `resolveData: 'all'` for the run's
|
|
540
|
+
* lifetime, because every replay evaluates that code and it exists nowhere
|
|
541
|
+
* else. `start()` refuses a dynamic start on a World that leaves this unset.
|
|
542
|
+
*
|
|
543
|
+
* Code too large for the creating write goes through
|
|
544
|
+
* {@link World.uploadDynamicWorkflowCode} when the World implements it;
|
|
545
|
+
* otherwise it is always sent inline.
|
|
546
|
+
*/
|
|
547
|
+
dynamicWorkflowCode?: boolean;
|
|
475
548
|
}
|
|
476
549
|
/**
|
|
477
550
|
* The "World" interface represents how Workflows are able to communicate with the outside world.
|
|
@@ -504,6 +577,13 @@ export interface World extends Queue, Streamer, Storage {
|
|
|
504
577
|
* "unsupported": runtime optimizations gated on a capability fail closed.
|
|
505
578
|
*/
|
|
506
579
|
capabilities?: WorldCapabilities;
|
|
580
|
+
/**
|
|
581
|
+
* Validates a dynamic run's complete execution context against
|
|
582
|
+
* World-specific limits. `start()` calls it only for dynamic starts, before
|
|
583
|
+
* any durable start side effect, so implementations throw to refuse the
|
|
584
|
+
* start.
|
|
585
|
+
*/
|
|
586
|
+
validateRunExecutionContext?(value: Record<string, unknown>): void;
|
|
507
587
|
/**
|
|
508
588
|
* Absolute wall-clock time when the current function invocation will be
|
|
509
589
|
* terminated by the hosting platform, if known. Used to optimize runtime behavior.
|
|
@@ -581,6 +661,40 @@ export interface World extends Queue, Streamer, Storage {
|
|
|
581
661
|
* tolerate `undefined` for direct callers.
|
|
582
662
|
*/
|
|
583
663
|
createRunId?(options?: Readonly<Record<string, unknown>>): string;
|
|
664
|
+
/**
|
|
665
|
+
* Upload a dynamic run's serialized workflow VM code to the World's blob
|
|
666
|
+
* storage ahead of `run_created`, returning the ref key to attach to the
|
|
667
|
+
* run.
|
|
668
|
+
*
|
|
669
|
+
* The inline path — sending the bytes on `run_created` itself — is the
|
|
670
|
+
* common case and needs nothing from this method: a generated orchestration
|
|
671
|
+
* function is usually a couple of KB, and keeping it on the creating write
|
|
672
|
+
* costs no extra round-trip. This exists for the tail: a definition too
|
|
673
|
+
* large to ride the event wire, which has to be streamed separately and
|
|
674
|
+
* referenced.
|
|
675
|
+
*
|
|
676
|
+
* Worlds that store run records whole (local, Postgres) have no size
|
|
677
|
+
* pressure and leave this unset; `start()` then always sends inline, and a
|
|
678
|
+
* definition over its own source limit is rejected client-side rather than
|
|
679
|
+
* silently truncated.
|
|
680
|
+
*
|
|
681
|
+
* The upload necessarily precedes the run it belongs to, so implementations
|
|
682
|
+
* must accept a `runId` that does not exist yet, and must scope the stored
|
|
683
|
+
* object to the caller's tenant and that run so it is reclaimed with the
|
|
684
|
+
* run's other storage.
|
|
685
|
+
*
|
|
686
|
+
* @param runId - The client-minted ID of the run being started.
|
|
687
|
+
* @param params.workflowName - The run's generated dynamic workflow name.
|
|
688
|
+
* Worlds that embed it in the storage key need it passed in, because the
|
|
689
|
+
* run record does not exist yet to read it from.
|
|
690
|
+
* @param params.code - Serialized (compressed + encrypted) workflow code.
|
|
691
|
+
* @returns The ref key to send as `run_created`'s
|
|
692
|
+
* `eventData.dynamicWorkflowCodeRef`.
|
|
693
|
+
*/
|
|
694
|
+
uploadDynamicWorkflowCode?(runId: string, params: {
|
|
695
|
+
workflowName: string;
|
|
696
|
+
code: Uint8Array;
|
|
697
|
+
}): Promise<string>;
|
|
584
698
|
/**
|
|
585
699
|
* The environment this World's writes are attributed to by the backend
|
|
586
700
|
* (`@workflow/world-vercel`: `'production' | 'preview' | 'development'`).
|
|
@@ -627,5 +741,18 @@ export interface World extends Queue, Streamer, Storage {
|
|
|
627
741
|
* empty object to add nothing for a given run.
|
|
628
742
|
*/
|
|
629
743
|
describeRun?(run: Readonly<Record<string, unknown>>): Record<string, string | null> | null | Promise<Record<string, string | null> | null>;
|
|
744
|
+
/**
|
|
745
|
+
* Optional telemetry write namespace for non-critical observability signals.
|
|
746
|
+
*/
|
|
747
|
+
telemetry?: Telemetry;
|
|
748
|
+
}
|
|
749
|
+
export interface Telemetry {
|
|
750
|
+
/**
|
|
751
|
+
* Called immediately before a step's user code begins executing.
|
|
752
|
+
*
|
|
753
|
+
* Worlds may use this synchronous hook to correlate step execution with the
|
|
754
|
+
* current platform invocation. Implementations must not throw.
|
|
755
|
+
*/
|
|
756
|
+
recordStepExecution?(stepId: string): void;
|
|
630
757
|
}
|
|
631
758
|
//# sourceMappingURL=interfaces.d.ts.map
|
|
@@ -49,6 +49,8 @@ export declare const RunInputSchema: z.ZodObject<{
|
|
|
49
49
|
workflowName: z.ZodString;
|
|
50
50
|
specVersion: z.ZodNumber;
|
|
51
51
|
executionContext: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
|
|
52
|
+
dynamicWorkflowCode: z.ZodOptional<z.ZodUnion<readonly [z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>, z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>]>>;
|
|
53
|
+
dynamicWorkflowCodeRef: z.ZodOptional<z.ZodString>;
|
|
52
54
|
attributes: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
53
55
|
allowReservedAttributes: z.ZodOptional<z.ZodLiteral<true>>;
|
|
54
56
|
environment: z.ZodOptional<z.ZodString>;
|
|
@@ -183,6 +185,8 @@ export declare const WorkflowInvokePayloadSchema: z.ZodObject<{
|
|
|
183
185
|
workflowName: z.ZodString;
|
|
184
186
|
specVersion: z.ZodNumber;
|
|
185
187
|
executionContext: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
|
|
188
|
+
dynamicWorkflowCode: z.ZodOptional<z.ZodUnion<readonly [z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>, z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>]>>;
|
|
189
|
+
dynamicWorkflowCodeRef: z.ZodOptional<z.ZodString>;
|
|
186
190
|
attributes: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
187
191
|
allowReservedAttributes: z.ZodOptional<z.ZodLiteral<true>>;
|
|
188
192
|
environment: z.ZodOptional<z.ZodString>;
|
|
@@ -273,6 +277,8 @@ export declare const QueuePayloadSchema: z.ZodUnion<readonly [z.ZodObject<{
|
|
|
273
277
|
workflowName: z.ZodString;
|
|
274
278
|
specVersion: z.ZodNumber;
|
|
275
279
|
executionContext: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
|
|
280
|
+
dynamicWorkflowCode: z.ZodOptional<z.ZodUnion<readonly [z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>, z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>]>>;
|
|
281
|
+
dynamicWorkflowCodeRef: z.ZodOptional<z.ZodString>;
|
|
276
282
|
attributes: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
277
283
|
allowReservedAttributes: z.ZodOptional<z.ZodLiteral<true>>;
|
|
278
284
|
environment: z.ZodOptional<z.ZodString>;
|
|
@@ -40,6 +40,7 @@ export declare const WorkflowRunBaseSchema: z.ZodObject<{
|
|
|
40
40
|
executionContext: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
|
|
41
41
|
input: z.ZodOptional<z.ZodUnion<readonly [z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>, z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>]>>;
|
|
42
42
|
output: z.ZodOptional<z.ZodUnion<readonly [z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>, z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>]>>;
|
|
43
|
+
dynamicWorkflowCode: z.ZodOptional<z.ZodUnion<readonly [z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>, z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>]>>;
|
|
43
44
|
error: z.ZodOptional<z.ZodUnion<readonly [z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>, z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>]>>;
|
|
44
45
|
errorCode: z.ZodOptional<z.ZodString>;
|
|
45
46
|
attributes: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
@@ -57,6 +58,7 @@ export declare const WorkflowRunSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
57
58
|
specVersion: z.ZodOptional<z.ZodNumber>;
|
|
58
59
|
executionContext: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
|
|
59
60
|
input: z.ZodOptional<z.ZodUnion<readonly [z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>, z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>]>>;
|
|
61
|
+
dynamicWorkflowCode: z.ZodOptional<z.ZodUnion<readonly [z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>, z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>]>>;
|
|
60
62
|
errorCode: z.ZodOptional<z.ZodString>;
|
|
61
63
|
attributes: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
62
64
|
encryptionPublicKey: z.ZodOptional<z.ZodString>;
|
|
@@ -78,6 +80,7 @@ export declare const WorkflowRunSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
78
80
|
specVersion: z.ZodOptional<z.ZodNumber>;
|
|
79
81
|
executionContext: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
|
|
80
82
|
input: z.ZodOptional<z.ZodUnion<readonly [z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>, z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>]>>;
|
|
83
|
+
dynamicWorkflowCode: z.ZodOptional<z.ZodUnion<readonly [z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>, z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>]>>;
|
|
81
84
|
errorCode: z.ZodOptional<z.ZodString>;
|
|
82
85
|
attributes: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
83
86
|
encryptionPublicKey: z.ZodOptional<z.ZodString>;
|
|
@@ -96,6 +99,7 @@ export declare const WorkflowRunSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
96
99
|
specVersion: z.ZodOptional<z.ZodNumber>;
|
|
97
100
|
executionContext: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
|
|
98
101
|
input: z.ZodOptional<z.ZodUnion<readonly [z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>, z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>]>>;
|
|
102
|
+
dynamicWorkflowCode: z.ZodOptional<z.ZodUnion<readonly [z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>, z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>]>>;
|
|
99
103
|
errorCode: z.ZodOptional<z.ZodString>;
|
|
100
104
|
attributes: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
101
105
|
encryptionPublicKey: z.ZodOptional<z.ZodString>;
|
|
@@ -114,6 +118,7 @@ export declare const WorkflowRunSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
114
118
|
specVersion: z.ZodOptional<z.ZodNumber>;
|
|
115
119
|
executionContext: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
|
|
116
120
|
input: z.ZodOptional<z.ZodUnion<readonly [z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>, z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>]>>;
|
|
121
|
+
dynamicWorkflowCode: z.ZodOptional<z.ZodUnion<readonly [z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>, z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>]>>;
|
|
117
122
|
errorCode: z.ZodOptional<z.ZodString>;
|
|
118
123
|
attributes: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
119
124
|
encryptionPublicKey: z.ZodOptional<z.ZodString>;
|
|
@@ -132,12 +137,14 @@ export type StartedWorkflowRun = WorkflowRun & {
|
|
|
132
137
|
startedAt: Date;
|
|
133
138
|
};
|
|
134
139
|
/**
|
|
135
|
-
* WorkflowRun with
|
|
140
|
+
* WorkflowRun with its payload fields excluded (when resolveData='none'):
|
|
141
|
+
* input, output, and a dynamic run's stored workflow code.
|
|
136
142
|
* Used for listing runs without fetching the full serialized data.
|
|
137
143
|
*/
|
|
138
|
-
export type WorkflowRunWithoutData = Omit<WorkflowRun, 'input' | 'output'> & {
|
|
144
|
+
export type WorkflowRunWithoutData = Omit<WorkflowRun, 'input' | 'output' | 'dynamicWorkflowCode'> & {
|
|
139
145
|
input: undefined;
|
|
140
146
|
output: undefined;
|
|
147
|
+
dynamicWorkflowCode?: undefined;
|
|
141
148
|
};
|
|
142
149
|
export interface CreateWorkflowRunRequest {
|
|
143
150
|
deploymentId: string;
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* VM snapshot storage types and helpers backing
|
|
3
|
+
* `Storage.experimental_snapshots`.
|
|
4
|
+
*
|
|
5
|
+
* @experimental Everything exported from this module may change without a
|
|
6
|
+
* major version bump. Worlds are not required to implement snapshot
|
|
7
|
+
* storage.
|
|
8
|
+
*/
|
|
9
|
+
import { z } from '#compiled/zod/index.js';
|
|
10
|
+
/** @experimental See `Storage.experimental_snapshots`. */
|
|
11
|
+
export declare const SnapshotMetadataSchema: z.ZodObject<{
|
|
12
|
+
eventsCursor: z.ZodNullable<z.ZodString>;
|
|
13
|
+
createdAt: z.ZodCoercedDate<unknown>;
|
|
14
|
+
eventCount: z.ZodOptional<z.ZodNumber>;
|
|
15
|
+
rngDraws: z.ZodOptional<z.ZodNumber>;
|
|
16
|
+
serdeRootPtr: z.ZodOptional<z.ZodNumber>;
|
|
17
|
+
lastUlid: z.ZodOptional<z.ZodString>;
|
|
18
|
+
engineVersion: z.ZodOptional<z.ZodString>;
|
|
19
|
+
clockMs: z.ZodOptional<z.ZodNumber>;
|
|
20
|
+
formatVersion: z.ZodOptional<z.ZodNumber>;
|
|
21
|
+
}, z.core.$strip>;
|
|
22
|
+
/**
|
|
23
|
+
* Current snapshot format version, bumped when the heap layout or the
|
|
24
|
+
* metadata contract changes incompatibly.
|
|
25
|
+
*
|
|
26
|
+
* v2: host-side serde + host-side ULID factory (post-#3263 engine) —
|
|
27
|
+
* adds required `serdeRootPtr` and `lastUlid` continuation state. v1
|
|
28
|
+
* snapshots (in-VM serde era) cannot be restored by this engine and are
|
|
29
|
+
* treated as a miss.
|
|
30
|
+
*
|
|
31
|
+
* v3: the stored bytes frame the heap with the restore-relevant metadata,
|
|
32
|
+
* sealed inside the encryption so it can be checked against the envelope
|
|
33
|
+
* on load, and the heap stops retaining consumed step results. v2
|
|
34
|
+
* snapshots are treated as a miss.
|
|
35
|
+
*
|
|
36
|
+
* @experimental See `Storage.experimental_snapshots`.
|
|
37
|
+
*/
|
|
38
|
+
export declare const SNAPSHOT_FORMAT_VERSION = 3;
|
|
39
|
+
/** @experimental See `Storage.experimental_snapshots`. */
|
|
40
|
+
export type SnapshotMetadata = z.infer<typeof SnapshotMetadataSchema>;
|
|
41
|
+
/**
|
|
42
|
+
* Encode a snapshot's metadata and bytes into one atomic blob.
|
|
43
|
+
*
|
|
44
|
+
* @experimental See `Storage.experimental_snapshots`.
|
|
45
|
+
*/
|
|
46
|
+
export declare function encodeSnapshotEnvelope(metadata: SnapshotMetadata, data: Uint8Array): Uint8Array;
|
|
47
|
+
/**
|
|
48
|
+
* Decode a snapshot envelope. Returns null for anything that is not a
|
|
49
|
+
* well-formed, schema-valid envelope (wrong magic, unknown version,
|
|
50
|
+
* truncated, invalid JSON, schema violation) — the caller treats that as
|
|
51
|
+
* a clean miss (full replay) rather than restoring from fabricated or
|
|
52
|
+
* torn state. Never invents metadata.
|
|
53
|
+
*
|
|
54
|
+
* @experimental See `Storage.experimental_snapshots`.
|
|
55
|
+
*/
|
|
56
|
+
export declare function decodeSnapshotEnvelope(bytes: Uint8Array): {
|
|
57
|
+
metadata: SnapshotMetadata;
|
|
58
|
+
data: Uint8Array;
|
|
59
|
+
} | null;
|
|
60
|
+
//# sourceMappingURL=snapshots.d.ts.map
|