experimental-ash 0.22.2 → 0.23.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 +14 -0
- package/dist/docs/public/faqs.md +67 -0
- package/dist/docs/public/meta.json +1 -0
- package/dist/docs/public/schedules.md +11 -0
- package/dist/docs/public/session-context.md +46 -89
- package/dist/docs/public/skills.md +13 -0
- package/dist/docs/public/subagents.md +12 -6
- package/dist/docs/public/tools.md +9 -13
- package/dist/docs/public/typescript-api.md +2 -2
- package/dist/src/chunks/{client-CKsU8Li3.js → client-nshDsWNF.js} +1 -1
- package/dist/src/chunks/{dev-authored-source-watcher-BLzYWh05.js → dev-authored-source-watcher-d_35Mp8T.js} +1 -1
- package/dist/src/chunks/{host-DREC8e8Z.js → host-tji7W0Nn.js} +2 -2
- package/dist/src/chunks/paths-YoCQlavu.js +89 -0
- package/dist/src/chunks/{prewarm-hz8p2jlZ.js → prewarm-6duWvvb5.js} +1 -1
- package/dist/src/cli/commands/info.js +1 -1
- package/dist/src/cli/dev/repl.js +2 -2
- package/dist/src/cli/run.js +1 -1
- package/dist/src/client/session.js +8 -0
- package/dist/src/client/types.d.ts +12 -1
- package/dist/src/compiled/.vendor-stamp.json +1 -1
- package/dist/src/compiled/@workflow/core/_ms.d.ts +4 -0
- package/dist/src/compiled/@workflow/core/_workflow-serde.d.ts +5 -0
- package/dist/src/compiled/@workflow/core/_workflow-utils.d.ts +8 -0
- package/dist/src/compiled/@workflow/core/_workflow-world.d.ts +59 -0
- package/dist/src/compiled/@workflow/core/capabilities.d.ts +45 -0
- package/dist/src/compiled/@workflow/core/capture-stack.d.ts +16 -0
- package/dist/src/compiled/@workflow/core/class-serialization.d.ts +31 -0
- package/dist/src/compiled/@workflow/core/classify-error.d.ts +19 -0
- package/dist/src/compiled/@workflow/core/context-errors.d.ts +27 -0
- package/dist/src/compiled/@workflow/core/context-violation-error.d.ts +97 -0
- package/dist/src/compiled/@workflow/core/create-hook.d.ts +179 -0
- package/dist/src/compiled/@workflow/core/define-hook.d.ts +68 -0
- package/dist/src/compiled/@workflow/core/describe-error.d.ts +70 -0
- package/dist/src/compiled/@workflow/core/encryption.d.ts +45 -0
- package/dist/src/compiled/@workflow/core/events-consumer.d.ts +64 -0
- package/dist/src/compiled/@workflow/core/flushable-stream.d.ts +82 -0
- package/dist/src/compiled/@workflow/core/global.d.ts +48 -0
- package/dist/src/compiled/@workflow/core/index.d.ts +19 -38
- package/dist/src/compiled/@workflow/core/log-format.d.ts +25 -0
- package/dist/src/compiled/@workflow/core/logger.d.ts +29 -0
- package/dist/src/compiled/@workflow/core/private.d.ts +59 -10
- package/dist/src/compiled/@workflow/core/runtime/constants.d.ts +4 -0
- package/dist/src/compiled/@workflow/core/runtime/get-port-lazy.d.ts +10 -0
- package/dist/src/compiled/@workflow/core/runtime/get-world-lazy.d.ts +32 -0
- package/dist/src/compiled/@workflow/core/runtime/helpers.d.ts +97 -0
- package/dist/src/compiled/@workflow/core/runtime/resume-hook.d.ts +77 -0
- package/dist/src/compiled/@workflow/core/runtime/run.d.ts +134 -0
- package/dist/src/compiled/@workflow/core/runtime/runs.d.ts +50 -0
- package/dist/src/compiled/@workflow/core/runtime/start.d.ts +59 -0
- package/dist/src/compiled/@workflow/core/runtime/step-executor.d.ts +40 -0
- package/dist/src/compiled/@workflow/core/runtime/step-handler.d.ts +2 -0
- package/dist/src/compiled/@workflow/core/runtime/suspension-handler.d.ts +42 -0
- package/dist/src/compiled/@workflow/core/runtime/world-init.d.ts +75 -0
- package/dist/src/compiled/@workflow/core/runtime/world.d.ts +32 -0
- package/dist/src/compiled/@workflow/core/runtime.d.ts +22 -67
- package/dist/src/compiled/@workflow/core/schemas.d.ts +15 -0
- package/dist/src/compiled/@workflow/core/serialization/client.d.ts +17 -0
- package/dist/src/compiled/@workflow/core/serialization/codec-devalue.d.ts +14 -0
- package/dist/src/compiled/@workflow/core/serialization/codec.d.ts +90 -0
- package/dist/src/compiled/@workflow/core/serialization/encryption.d.ts +32 -0
- package/dist/src/compiled/@workflow/core/serialization/errors.d.ts +21 -0
- package/dist/src/compiled/@workflow/core/serialization/format.d.ts +60 -0
- package/dist/src/compiled/@workflow/core/serialization/index.d.ts +18 -0
- package/dist/src/compiled/@workflow/core/serialization/reducers/class.d.ts +11 -0
- package/dist/src/compiled/@workflow/core/serialization/reducers/common.d.ts +16 -0
- package/dist/src/compiled/@workflow/core/serialization/reducers/step-function.d.ts +35 -0
- package/dist/src/compiled/@workflow/core/serialization/step.d.ts +17 -0
- package/dist/src/compiled/@workflow/core/serialization/types.d.ts +201 -0
- package/dist/src/compiled/@workflow/core/serialization/workflow.d.ts +29 -0
- package/dist/src/compiled/@workflow/core/serialization-format.d.ts +171 -0
- package/dist/src/compiled/@workflow/core/serialization.d.ts +329 -0
- package/dist/src/compiled/@workflow/core/sleep.d.ts +33 -0
- package/dist/src/compiled/@workflow/core/source-map.d.ts +10 -0
- package/dist/src/compiled/@workflow/core/step/context-storage.d.ts +13 -0
- package/dist/src/compiled/@workflow/core/step/get-closure-vars.d.ts +9 -0
- package/dist/src/compiled/@workflow/core/step/get-step-metadata.d.ts +42 -0
- package/dist/src/compiled/@workflow/core/step/get-workflow-metadata.d.ts +7 -0
- package/dist/src/compiled/@workflow/core/step/writable-stream.d.ts +22 -0
- package/dist/src/compiled/@workflow/core/step.d.ts +4 -0
- package/dist/src/compiled/@workflow/core/symbols.d.ts +20 -0
- package/dist/src/compiled/@workflow/core/telemetry/semantic-conventions.d.ts +283 -0
- package/dist/src/compiled/@workflow/core/telemetry.d.ts +53 -0
- package/dist/src/compiled/@workflow/core/types.d.ts +14 -0
- package/dist/src/compiled/@workflow/core/util.d.ts +40 -0
- package/dist/src/compiled/@workflow/core/version.d.ts +2 -0
- package/dist/src/compiled/@workflow/core/vm/index.d.ts +17 -0
- package/dist/src/compiled/@workflow/core/vm/uint8array-base64.d.ts +21 -0
- package/dist/src/compiled/@workflow/core/vm/uuid.d.ts +10 -0
- package/dist/src/compiled/@workflow/core/workflow/abort-controller.d.ts +65 -0
- package/dist/src/compiled/@workflow/core/workflow/create-hook.d.ts +7 -0
- package/dist/src/compiled/@workflow/core/workflow/define-hook.d.ts +10 -0
- package/dist/src/compiled/@workflow/core/workflow/get-workflow-metadata.d.ts +32 -0
- package/dist/src/compiled/@workflow/core/workflow/hook.d.ts +4 -0
- package/dist/src/compiled/@workflow/core/workflow/index.d.ts +11 -0
- package/dist/src/compiled/@workflow/core/workflow/sleep.d.ts +4 -0
- package/dist/src/compiled/@workflow/core/workflow/world-init-stub.d.ts +15 -0
- package/dist/src/compiled/@workflow/core/workflow/writable-stream.d.ts +3 -0
- package/dist/src/compiled/@workflow/core/workflow.d.ts +1 -38
- package/dist/src/evals/cli/eval.js +1 -1
- package/dist/src/internal/application/package.js +1 -1
- package/dist/src/protocol/message.d.ts +6 -1
- package/dist/src/public/channels/ash.js +50 -3
- package/dist/src/public/context/index.d.ts +4 -7
- package/dist/src/public/context/index.js +4 -5
- package/dist/src/public/definitions/state.d.ts +33 -0
- package/dist/src/public/definitions/state.js +34 -0
- package/dist/src/public/next/index.d.ts +7 -0
- package/dist/src/public/next/index.js +2 -0
- package/dist/src/public/next/vercel-json.d.ts +1 -0
- package/dist/src/public/next/vercel-json.js +1 -0
- package/dist/src/react/index.d.ts +1 -1
- package/dist/src/react/use-ash-agent.d.ts +8 -0
- package/dist/src/react/use-ash-agent.js +26 -4
- package/dist/src/services/dev-client.d.ts +4 -1
- package/dist/src/services/dev-client.js +1 -0
- package/package.json +1 -1
- package/dist/src/chunks/paths-C6sp4T2U.js +0 -88
|
@@ -0,0 +1,329 @@
|
|
|
1
|
+
import { type CryptoKey } from './encryption.js';
|
|
2
|
+
import { decrypt, type EncryptionKeyParam, encrypt } from './serialization/encryption.js';
|
|
3
|
+
import { decodeFormatPrefix, encodeWithFormatPrefix, isEncrypted, peekFormatPrefix } from './serialization/format.js';
|
|
4
|
+
import { type FormatPrefix, isFormatPrefix, SerializationFormat } from './serialization/types.js';
|
|
5
|
+
export { SerializationFormat, type FormatPrefix, isFormatPrefix, encodeWithFormatPrefix, decodeFormatPrefix, peekFormatPrefix, isEncrypted, encrypt, decrypt, type EncryptionKeyParam, };
|
|
6
|
+
export type SerializationFormatType = (typeof SerializationFormat)[keyof typeof SerializationFormat];
|
|
7
|
+
/**
|
|
8
|
+
* Detect if a readable stream is a byte stream.
|
|
9
|
+
*
|
|
10
|
+
* @param stream
|
|
11
|
+
* @returns `"bytes"` if the stream is a byte stream, `undefined` otherwise
|
|
12
|
+
*/
|
|
13
|
+
export declare function getStreamType(stream: ReadableStream): 'bytes' | undefined;
|
|
14
|
+
export declare function getSerializeStream(reducers: Partial<Reducers>, cryptoKey: EncryptionKeyParam): TransformStream<any, Uint8Array>;
|
|
15
|
+
export declare function getDeserializeStream(revivers: Partial<Revivers>, cryptoKey: EncryptionKeyParam): TransformStream<Uint8Array, any>;
|
|
16
|
+
export declare class WorkflowServerReadableStream extends ReadableStream<Uint8Array> {
|
|
17
|
+
#private;
|
|
18
|
+
constructor(runId: string, name: string, startIndex?: number);
|
|
19
|
+
}
|
|
20
|
+
export declare class WorkflowServerWritableStream extends WritableStream<Uint8Array> {
|
|
21
|
+
constructor(runId: string, name: string);
|
|
22
|
+
}
|
|
23
|
+
export type { Reducers, Revivers, SerializableSpecial, } from './serialization/types.js';
|
|
24
|
+
import type { Reducers, Revivers } from './serialization/types.js';
|
|
25
|
+
/**
|
|
26
|
+
* Reducers for serialization boundary from the client side, passing arguments
|
|
27
|
+
* to the workflow handler.
|
|
28
|
+
*
|
|
29
|
+
* @param global
|
|
30
|
+
* @param ops
|
|
31
|
+
* @returns
|
|
32
|
+
*/
|
|
33
|
+
export declare function getExternalReducers(global: Record<string, any> | undefined, ops: Promise<void>[], runId: string, cryptoKey: EncryptionKeyParam): Partial<Reducers>;
|
|
34
|
+
/**
|
|
35
|
+
* Reducers for serialization boundary from within the workflow execution
|
|
36
|
+
* environment, passing return value to the client side and into step arguments.
|
|
37
|
+
*
|
|
38
|
+
* @param global
|
|
39
|
+
* @returns
|
|
40
|
+
*/
|
|
41
|
+
export declare function getWorkflowReducers(global?: Record<string, any>): Partial<Reducers>;
|
|
42
|
+
/**
|
|
43
|
+
* Cancel dangling abort-stream readers on any AbortController instances found
|
|
44
|
+
* in the hydrated step arguments. Called after the step function returns
|
|
45
|
+
* (success or failure) to prevent reader promises from keeping the serverless
|
|
46
|
+
* function alive indefinitely.
|
|
47
|
+
*/
|
|
48
|
+
export declare function cancelAbortReaders(...values: unknown[]): void;
|
|
49
|
+
/**
|
|
50
|
+
* Base revivers shared across all serialization boundaries.
|
|
51
|
+
* Composes: class + common revivers from the modular modules.
|
|
52
|
+
*
|
|
53
|
+
* This is exported because serialization-format.ts and other files reference it.
|
|
54
|
+
*/
|
|
55
|
+
export declare function getCommonRevivers(global?: Record<string, any>): {
|
|
56
|
+
ArrayBuffer?: ((value: string) => any) | undefined;
|
|
57
|
+
BigInt?: ((value: string) => any) | undefined;
|
|
58
|
+
BigInt64Array?: ((value: string) => any) | undefined;
|
|
59
|
+
BigUint64Array?: ((value: string) => any) | undefined;
|
|
60
|
+
Date?: ((value: string) => any) | undefined;
|
|
61
|
+
DOMException?: ((value: {
|
|
62
|
+
message: string;
|
|
63
|
+
name: string;
|
|
64
|
+
stack?: string;
|
|
65
|
+
cause?: unknown;
|
|
66
|
+
}) => any) | undefined;
|
|
67
|
+
FatalError?: ((value: {
|
|
68
|
+
message: string;
|
|
69
|
+
stack?: string;
|
|
70
|
+
cause?: unknown;
|
|
71
|
+
}) => any) | undefined;
|
|
72
|
+
Float32Array?: ((value: string) => any) | undefined;
|
|
73
|
+
Float64Array?: ((value: string) => any) | undefined;
|
|
74
|
+
Error?: ((value: {
|
|
75
|
+
name: string;
|
|
76
|
+
message: string;
|
|
77
|
+
stack?: string;
|
|
78
|
+
cause?: unknown;
|
|
79
|
+
}) => any) | undefined;
|
|
80
|
+
EvalError?: ((value: {
|
|
81
|
+
message: string;
|
|
82
|
+
stack?: string;
|
|
83
|
+
cause?: unknown;
|
|
84
|
+
}) => any) | undefined;
|
|
85
|
+
Headers?: ((value: [string, string][]) => any) | undefined;
|
|
86
|
+
Int8Array?: ((value: string) => any) | undefined;
|
|
87
|
+
Int16Array?: ((value: string) => any) | undefined;
|
|
88
|
+
Int32Array?: ((value: string) => any) | undefined;
|
|
89
|
+
Map?: ((value: [any, any][]) => any) | undefined;
|
|
90
|
+
RangeError?: ((value: {
|
|
91
|
+
message: string;
|
|
92
|
+
stack?: string;
|
|
93
|
+
cause?: unknown;
|
|
94
|
+
}) => any) | undefined;
|
|
95
|
+
ReadableStream?: ((value: {
|
|
96
|
+
name: string;
|
|
97
|
+
type?: "bytes";
|
|
98
|
+
startIndex?: number;
|
|
99
|
+
} | {
|
|
100
|
+
bodyInit: any;
|
|
101
|
+
}) => any) | undefined;
|
|
102
|
+
ReferenceError?: ((value: {
|
|
103
|
+
message: string;
|
|
104
|
+
stack?: string;
|
|
105
|
+
cause?: unknown;
|
|
106
|
+
}) => any) | undefined;
|
|
107
|
+
RegExp?: ((value: {
|
|
108
|
+
source: string;
|
|
109
|
+
flags: string;
|
|
110
|
+
}) => any) | undefined;
|
|
111
|
+
RetryableError?: ((value: {
|
|
112
|
+
message: string;
|
|
113
|
+
stack?: string;
|
|
114
|
+
cause?: unknown;
|
|
115
|
+
retryAfter: number;
|
|
116
|
+
}) => any) | undefined;
|
|
117
|
+
Request?: ((value: {
|
|
118
|
+
method: string;
|
|
119
|
+
url: string;
|
|
120
|
+
headers: Headers;
|
|
121
|
+
body: Request["body"];
|
|
122
|
+
duplex: Request["duplex"];
|
|
123
|
+
responseWritable?: WritableStream<Response>;
|
|
124
|
+
signal?: AbortSignal;
|
|
125
|
+
}) => any) | undefined;
|
|
126
|
+
Response?: ((value: {
|
|
127
|
+
type: Response["type"];
|
|
128
|
+
url: string;
|
|
129
|
+
status: number;
|
|
130
|
+
statusText: string;
|
|
131
|
+
headers: Headers;
|
|
132
|
+
body: Response["body"];
|
|
133
|
+
redirected: boolean;
|
|
134
|
+
}) => any) | undefined;
|
|
135
|
+
Class?: ((value: {
|
|
136
|
+
classId: string;
|
|
137
|
+
}) => any) | undefined;
|
|
138
|
+
Instance?: ((value: {
|
|
139
|
+
classId: string;
|
|
140
|
+
data: unknown;
|
|
141
|
+
}) => any) | undefined;
|
|
142
|
+
Set?: ((value: any[]) => any) | undefined;
|
|
143
|
+
SyntaxError?: ((value: {
|
|
144
|
+
message: string;
|
|
145
|
+
stack?: string;
|
|
146
|
+
cause?: unknown;
|
|
147
|
+
}) => any) | undefined;
|
|
148
|
+
StepFunction?: ((value: {
|
|
149
|
+
stepId: string;
|
|
150
|
+
closureVars?: Record<string, any>;
|
|
151
|
+
boundThis?: unknown;
|
|
152
|
+
boundArgs?: unknown[];
|
|
153
|
+
}) => any) | undefined;
|
|
154
|
+
TypeError?: ((value: {
|
|
155
|
+
message: string;
|
|
156
|
+
stack?: string;
|
|
157
|
+
cause?: unknown;
|
|
158
|
+
}) => any) | undefined;
|
|
159
|
+
URIError?: ((value: {
|
|
160
|
+
message: string;
|
|
161
|
+
stack?: string;
|
|
162
|
+
cause?: unknown;
|
|
163
|
+
}) => any) | undefined;
|
|
164
|
+
URL?: ((value: string) => any) | undefined;
|
|
165
|
+
WorkflowFunction?: ((value: {
|
|
166
|
+
workflowId: string;
|
|
167
|
+
}) => any) | undefined;
|
|
168
|
+
URLSearchParams?: ((value: string) => any) | undefined;
|
|
169
|
+
Uint8Array?: ((value: string) => any) | undefined;
|
|
170
|
+
Uint8ClampedArray?: ((value: string) => any) | undefined;
|
|
171
|
+
Uint16Array?: ((value: string) => any) | undefined;
|
|
172
|
+
Uint32Array?: ((value: string) => any) | undefined;
|
|
173
|
+
AggregateError?: ((value: {
|
|
174
|
+
message: string;
|
|
175
|
+
stack?: string;
|
|
176
|
+
cause?: unknown;
|
|
177
|
+
errors: unknown[];
|
|
178
|
+
}) => any) | undefined;
|
|
179
|
+
WritableStream?: ((value: {
|
|
180
|
+
name: string;
|
|
181
|
+
}) => any) | undefined;
|
|
182
|
+
AbortController?: ((value: {
|
|
183
|
+
streamName: string;
|
|
184
|
+
hookToken: string;
|
|
185
|
+
aborted: boolean;
|
|
186
|
+
reason?: unknown;
|
|
187
|
+
}) => any) | undefined;
|
|
188
|
+
AbortSignal?: ((value: {
|
|
189
|
+
streamName: string;
|
|
190
|
+
hookToken: string;
|
|
191
|
+
aborted: boolean;
|
|
192
|
+
reason?: unknown;
|
|
193
|
+
}) => any) | undefined;
|
|
194
|
+
};
|
|
195
|
+
/**
|
|
196
|
+
* Revivers for deserialization boundary from the client side,
|
|
197
|
+
* receiving the return value from the workflow handler.
|
|
198
|
+
*
|
|
199
|
+
* @param global
|
|
200
|
+
* @param ops
|
|
201
|
+
* @param runId
|
|
202
|
+
*/
|
|
203
|
+
export declare function getExternalRevivers(global: Record<string, any> | undefined, ops: Promise<void>[], runId: string, cryptoKey: EncryptionKeyParam): Partial<Revivers>;
|
|
204
|
+
/**
|
|
205
|
+
* Revivers for deserialization boundary from within the workflow execution
|
|
206
|
+
* environment, receiving arguments from the client side, and return values
|
|
207
|
+
* from the steps.
|
|
208
|
+
*
|
|
209
|
+
* @param global
|
|
210
|
+
* @returns
|
|
211
|
+
*/
|
|
212
|
+
export declare function getWorkflowRevivers(global?: Record<string, any>): Partial<Revivers>;
|
|
213
|
+
/**
|
|
214
|
+
* Encrypt data if the world supports encryption.
|
|
215
|
+
* Returns original data if encryption is not available.
|
|
216
|
+
*
|
|
217
|
+
* @deprecated Use `encrypt` from `./serialization/encryption.js` instead.
|
|
218
|
+
*/
|
|
219
|
+
export declare function maybeEncrypt(data: Uint8Array, key: CryptoKey | undefined): Promise<Uint8Array>;
|
|
220
|
+
/**
|
|
221
|
+
* Decrypt data if it has the 'encr' prefix.
|
|
222
|
+
*
|
|
223
|
+
* @deprecated Use `decrypt` from `./serialization/encryption.js` instead.
|
|
224
|
+
*/
|
|
225
|
+
export declare function maybeDecrypt(data: Uint8Array | unknown, key: CryptoKey | undefined): Promise<Uint8Array | unknown>;
|
|
226
|
+
/**
|
|
227
|
+
* Called from the `start()` function to serialize the workflow arguments
|
|
228
|
+
* into a format that can be saved to the database and then hydrated from
|
|
229
|
+
* within the workflow execution environment.
|
|
230
|
+
*/
|
|
231
|
+
export declare function dehydrateWorkflowArguments(value: unknown, runId: string, key: CryptoKey | undefined, ops?: Promise<void>[], global?: Record<string, any>, v1Compat?: boolean): Promise<Uint8Array | unknown>;
|
|
232
|
+
/**
|
|
233
|
+
* Called from workflow execution environment to hydrate the workflow
|
|
234
|
+
* arguments from the database at the start of workflow execution.
|
|
235
|
+
*/
|
|
236
|
+
export declare function hydrateWorkflowArguments(value: Uint8Array | unknown, _runId: string, key: CryptoKey | undefined, global?: Record<string, any>, extraRevivers?: Record<string, (value: any) => any>): Promise<any>;
|
|
237
|
+
/**
|
|
238
|
+
* Dehydrate workflow return value for storage.
|
|
239
|
+
*/
|
|
240
|
+
export declare function dehydrateWorkflowReturnValue(value: unknown, _runId: string, key: CryptoKey | undefined, global?: Record<string, any>, v1Compat?: boolean): Promise<Uint8Array | unknown>;
|
|
241
|
+
/**
|
|
242
|
+
* Called from the client side to hydrate the workflow return value
|
|
243
|
+
* of a completed workflow run.
|
|
244
|
+
*/
|
|
245
|
+
export declare function hydrateWorkflowReturnValue(value: Uint8Array | unknown, runId: string, key: CryptoKey | undefined, ops?: Promise<void>[], global?: Record<string, any>, extraRevivers?: Record<string, (value: any) => any>): Promise<any>;
|
|
246
|
+
/**
|
|
247
|
+
* Called from the workflow handler when a step is being created.
|
|
248
|
+
* Dehydrates values from within the workflow execution environment.
|
|
249
|
+
*/
|
|
250
|
+
export declare function dehydrateStepArguments(value: unknown, _runId: string, key: CryptoKey | undefined, global?: Record<string, any>, v1Compat?: boolean): Promise<Uint8Array | unknown>;
|
|
251
|
+
/**
|
|
252
|
+
* Called from the step handler to hydrate the arguments of a step
|
|
253
|
+
* from the database at the start of the step execution.
|
|
254
|
+
*/
|
|
255
|
+
export declare function hydrateStepArguments(value: Uint8Array | unknown, runId: string, key: CryptoKey | undefined, ops?: Promise<any>[], global?: Record<string, any>, extraRevivers?: Record<string, (value: any) => any>): Promise<any>;
|
|
256
|
+
/**
|
|
257
|
+
* Called from the step handler when a step has completed.
|
|
258
|
+
* Dehydrates values from within the step execution environment.
|
|
259
|
+
*/
|
|
260
|
+
export declare function dehydrateStepReturnValue(value: unknown, runId: string, key: CryptoKey | undefined, ops?: Promise<any>[], global?: Record<string, any>, v1Compat?: boolean): Promise<Uint8Array | unknown>;
|
|
261
|
+
/**
|
|
262
|
+
* Called from the step handler when a step throws. Dehydrates the thrown
|
|
263
|
+
* value from within the step execution environment into a format that can
|
|
264
|
+
* be saved to the database in a `step_failed` or `step_retrying` event.
|
|
265
|
+
*
|
|
266
|
+
* Any JavaScript value can be thrown (strings, numbers, objects, Errors,
|
|
267
|
+
* Error subclasses), so the same serialization pipeline used for step
|
|
268
|
+
* arguments and return values is applied here.
|
|
269
|
+
*
|
|
270
|
+
* @param value - The thrown value to serialize (can be any type)
|
|
271
|
+
* @param runId - Run ID for encryption context
|
|
272
|
+
* @param key - Encryption key (undefined to skip encryption)
|
|
273
|
+
* @param ops - Promise array for stream operations
|
|
274
|
+
* @param global - Global object for serialization context
|
|
275
|
+
* @returns The dehydrated value as binary data (Uint8Array) with format prefix
|
|
276
|
+
*/
|
|
277
|
+
export declare function dehydrateStepError(value: unknown, runId: string, key: CryptoKey | undefined, ops?: Promise<any>[], global?: Record<string, any>): Promise<Uint8Array>;
|
|
278
|
+
/**
|
|
279
|
+
* Called from the workflow handler when replaying the event log of a
|
|
280
|
+
* `step_failed` or `step_retrying` event. Hydrates the thrown value from
|
|
281
|
+
* the database so the workflow can see the original thrown value.
|
|
282
|
+
*
|
|
283
|
+
* @param value - Binary serialized data (Uint8Array) with format prefix
|
|
284
|
+
* @param runId - Run ID for decryption context
|
|
285
|
+
* @param key - Encryption key (undefined to skip decryption)
|
|
286
|
+
* @param global - Global object for deserialization context
|
|
287
|
+
* @param extraRevivers - Additional revivers for custom types
|
|
288
|
+
* @returns The hydrated thrown value, ready to reject the step promise
|
|
289
|
+
*/
|
|
290
|
+
export declare function hydrateStepError(value: Uint8Array | unknown, _runId: string, key: CryptoKey | undefined, global?: Record<string, any>, extraRevivers?: Record<string, (value: any) => any>): Promise<unknown>;
|
|
291
|
+
/**
|
|
292
|
+
* Called from the workflow handler when the workflow itself throws.
|
|
293
|
+
* Dehydrates the thrown value from within the workflow execution environment
|
|
294
|
+
* into a format that can be saved to the database in a `run_failed` event.
|
|
295
|
+
*
|
|
296
|
+
* @param value - The thrown value to serialize (can be any type)
|
|
297
|
+
* @param runId - Run ID for encryption context
|
|
298
|
+
* @param key - Encryption key (undefined to skip encryption)
|
|
299
|
+
* @param global - Global object for serialization context
|
|
300
|
+
* @returns The dehydrated value as binary data (Uint8Array) with format prefix
|
|
301
|
+
*/
|
|
302
|
+
export declare function dehydrateRunError(value: unknown, _runId: string, key: CryptoKey | undefined, global?: Record<string, any>): Promise<Uint8Array>;
|
|
303
|
+
/**
|
|
304
|
+
* Called from the client side (or observability tools) to hydrate the run
|
|
305
|
+
* error value of a failed workflow run.
|
|
306
|
+
*
|
|
307
|
+
* @param value - Binary serialized data (Uint8Array) with format prefix
|
|
308
|
+
* @param runId - Run ID for decryption context
|
|
309
|
+
* @param key - Encryption key (undefined to skip decryption)
|
|
310
|
+
* @param ops - Promise array for stream operations
|
|
311
|
+
* @param global - Global object for deserialization context
|
|
312
|
+
* @param extraRevivers - Additional revivers for custom types
|
|
313
|
+
* @returns The hydrated thrown value, ready to be consumed by the client
|
|
314
|
+
*/
|
|
315
|
+
export declare function hydrateRunError(value: Uint8Array | unknown, runId: string, key: CryptoKey | undefined, ops?: Promise<void>[], global?: Record<string, any>, extraRevivers?: Record<string, (value: any) => any>): Promise<unknown>;
|
|
316
|
+
/**
|
|
317
|
+
* Called from the workflow handler when replaying the event log of a `step_completed` event.
|
|
318
|
+
* Hydrates the return value of a step from the database.
|
|
319
|
+
*
|
|
320
|
+
* @param value - Binary serialized data (Uint8Array) with format prefix
|
|
321
|
+
* @param runId - Run ID for decryption context
|
|
322
|
+
* @param key - Encryption key (undefined to skip decryption)
|
|
323
|
+
* @param global - Global object for deserialization context
|
|
324
|
+
* @param extraRevivers - Additional revivers for custom types
|
|
325
|
+
* Called from the workflow handler when replaying the event log
|
|
326
|
+
* of a `step_completed` event.
|
|
327
|
+
*/
|
|
328
|
+
export declare function hydrateStepReturnValue(value: Uint8Array | unknown, _runId: string, key: CryptoKey | undefined, global?: Record<string, any>, extraRevivers?: Record<string, (value: any) => any>): Promise<any>;
|
|
329
|
+
//# sourceMappingURL=serialization.d.ts.map
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import type { StringValue } from './_ms.js';
|
|
2
|
+
/**
|
|
3
|
+
* Sleep within a workflow for a given duration.
|
|
4
|
+
*
|
|
5
|
+
* This is a built-in runtime function that uses timer events in the event log.
|
|
6
|
+
*
|
|
7
|
+
* @param duration - The duration to sleep for, this is a string in the format
|
|
8
|
+
* of `"1000ms"`, `"1s"`, `"1m"`, `"1h"`, or `"1d"`.
|
|
9
|
+
* @overload
|
|
10
|
+
* @returns A promise that resolves when the sleep is complete.
|
|
11
|
+
*/
|
|
12
|
+
export declare function sleep(duration: StringValue): Promise<void>;
|
|
13
|
+
/**
|
|
14
|
+
* Sleep within a workflow until a specific date.
|
|
15
|
+
*
|
|
16
|
+
* This is a built-in runtime function that uses timer events in the event log.
|
|
17
|
+
*
|
|
18
|
+
* @param date - The date to sleep until, this must be a future date.
|
|
19
|
+
* @overload
|
|
20
|
+
* @returns A promise that resolves when the sleep is complete.
|
|
21
|
+
*/
|
|
22
|
+
export declare function sleep(date: Date): Promise<void>;
|
|
23
|
+
/**
|
|
24
|
+
* Sleep within a workflow for a given duration in milliseconds.
|
|
25
|
+
*
|
|
26
|
+
* This is a built-in runtime function that uses timer events in the event log.
|
|
27
|
+
*
|
|
28
|
+
* @param durationMs - The duration to sleep for in milliseconds.
|
|
29
|
+
* @overload
|
|
30
|
+
* @returns A promise that resolves when the sleep is complete.
|
|
31
|
+
*/
|
|
32
|
+
export declare function sleep(durationMs: number): Promise<void>;
|
|
33
|
+
//# sourceMappingURL=sleep.d.ts.map
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Remaps an error stack trace using inline source maps to show original source locations.
|
|
3
|
+
*
|
|
4
|
+
* @param stack - The error stack trace to remap
|
|
5
|
+
* @param filename - The workflow filename to match in stack frames
|
|
6
|
+
* @param workflowCode - The workflow bundle code containing inline source maps
|
|
7
|
+
* @returns The remapped stack trace with original source locations
|
|
8
|
+
*/
|
|
9
|
+
export declare function remapErrorStack(stack: string, filename: string, workflowCode: string): string;
|
|
10
|
+
//# sourceMappingURL=source-map.d.ts.map
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { AsyncLocalStorage } from 'node:async_hooks';
|
|
2
|
+
import type { CryptoKey } from '../encryption.js';
|
|
3
|
+
import type { WorkflowMetadata } from '../workflow/get-workflow-metadata.js';
|
|
4
|
+
import type { StepMetadata } from './get-step-metadata.js';
|
|
5
|
+
export type StepContext = {
|
|
6
|
+
stepMetadata: StepMetadata;
|
|
7
|
+
workflowMetadata: WorkflowMetadata;
|
|
8
|
+
ops: Promise<void>[];
|
|
9
|
+
closureVars?: Record<string, any>;
|
|
10
|
+
encryptionKey?: CryptoKey;
|
|
11
|
+
};
|
|
12
|
+
export declare const contextStorage: AsyncLocalStorage<StepContext>;
|
|
13
|
+
//# sourceMappingURL=context-storage.d.ts.map
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Returns the closure variables for the current step function.
|
|
3
|
+
* This is an internal function used by the SWC transform to access
|
|
4
|
+
* variables from the parent workflow scope.
|
|
5
|
+
*
|
|
6
|
+
* @internal
|
|
7
|
+
*/
|
|
8
|
+
export declare function __private_getClosureVars(): Record<string, any>;
|
|
9
|
+
//# sourceMappingURL=get-closure-vars.d.ts.map
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
export interface StepMetadata {
|
|
2
|
+
/**
|
|
3
|
+
* The name of the step.
|
|
4
|
+
*/
|
|
5
|
+
stepName: string;
|
|
6
|
+
/**
|
|
7
|
+
* Unique identifier for the currently executing step.
|
|
8
|
+
* Useful to use as part of an idempotency key for critical
|
|
9
|
+
* operations that must only be executed once (such as charging a customer).
|
|
10
|
+
*
|
|
11
|
+
* @remarks
|
|
12
|
+
*
|
|
13
|
+
* Only available inside a step function.
|
|
14
|
+
* Accessing this property in a workflow function will throw an error.
|
|
15
|
+
*/
|
|
16
|
+
stepId: string;
|
|
17
|
+
/**
|
|
18
|
+
* Timestamp when the current step started.
|
|
19
|
+
*
|
|
20
|
+
* @remarks
|
|
21
|
+
*
|
|
22
|
+
* Only available inside a step function.
|
|
23
|
+
* Accessing this property in a workflow function will throw an error.
|
|
24
|
+
*/
|
|
25
|
+
stepStartedAt: Date;
|
|
26
|
+
/**
|
|
27
|
+
* The number of times the current step has been executed. This will increase with each retry.
|
|
28
|
+
*
|
|
29
|
+
* @remarks
|
|
30
|
+
*
|
|
31
|
+
* Only available inside a step function.
|
|
32
|
+
* Accessing this property in a workflow function will throw an error.
|
|
33
|
+
*/
|
|
34
|
+
attempt: number;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Returns metadata available in the current step function.
|
|
38
|
+
* It uses `AsyncLocalStorage` to store the context and
|
|
39
|
+
* retrieve it in the step function.
|
|
40
|
+
*/
|
|
41
|
+
export declare function getStepMetadata(): StepMetadata;
|
|
42
|
+
//# sourceMappingURL=get-step-metadata.d.ts.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { WorkflowMetadata } from '../workflow/get-workflow-metadata.js';
|
|
2
|
+
export type { WorkflowMetadata };
|
|
3
|
+
/**
|
|
4
|
+
* Returns metadata available in the current workflow run inside a step function.
|
|
5
|
+
*/
|
|
6
|
+
export declare function getWorkflowMetadata(): WorkflowMetadata;
|
|
7
|
+
//# sourceMappingURL=get-workflow-metadata.d.ts.map
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The options for {@link getWritable}.
|
|
3
|
+
*/
|
|
4
|
+
export interface WorkflowWritableStreamOptions {
|
|
5
|
+
/**
|
|
6
|
+
* An optional namespace to distinguish between multiple streams associated
|
|
7
|
+
* with the same workflow run.
|
|
8
|
+
*/
|
|
9
|
+
namespace?: string;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Retrieves a writable stream that is associated with the current workflow.
|
|
13
|
+
*
|
|
14
|
+
* The writable stream is intended to be used within step functions to write
|
|
15
|
+
* data that can be read outside the workflow by using the readable method of getRun.
|
|
16
|
+
*
|
|
17
|
+
* @param options - Optional configuration for the writable stream
|
|
18
|
+
* @returns The writable stream associated with the current workflow run
|
|
19
|
+
* @throws Error if called outside a workflow or step function
|
|
20
|
+
*/
|
|
21
|
+
export declare function getWritable<W = any>(options?: WorkflowWritableStreamOptions): WritableStream<W>;
|
|
22
|
+
//# sourceMappingURL=writable-stream.d.ts.map
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { type WorkflowOrchestratorContext } from './private.js';
|
|
2
|
+
import type { Serializable } from './schemas.js';
|
|
3
|
+
export declare function createUseStep(ctx: WorkflowOrchestratorContext): <Args extends Serializable[], Result>(stepName: string, closureVarsFn?: () => Record<string, Serializable>) => (this: unknown, ...args: Args) => Promise<Result>;
|
|
4
|
+
//# sourceMappingURL=step.d.ts.map
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export declare const WORKFLOW_USE_STEP: unique symbol;
|
|
2
|
+
export declare const WORKFLOW_CREATE_HOOK: unique symbol;
|
|
3
|
+
export declare const WORKFLOW_SLEEP: unique symbol;
|
|
4
|
+
export declare const WORKFLOW_CONTEXT: unique symbol;
|
|
5
|
+
export declare const WORKFLOW_GET_STREAM_ID: unique symbol;
|
|
6
|
+
export declare const STABLE_ULID: unique symbol;
|
|
7
|
+
export declare const STREAM_NAME_SYMBOL: unique symbol;
|
|
8
|
+
export declare const STREAM_TYPE_SYMBOL: unique symbol;
|
|
9
|
+
export declare const BODY_INIT_SYMBOL: unique symbol;
|
|
10
|
+
export declare const WEBHOOK_RESPONSE_WRITABLE: unique symbol;
|
|
11
|
+
/**
|
|
12
|
+
* Symbol used to store the class registry on globalThis in workflow mode.
|
|
13
|
+
* This allows the deserializer to find classes by classId in the VM context.
|
|
14
|
+
*/
|
|
15
|
+
export declare const WORKFLOW_CLASS_REGISTRY: unique symbol;
|
|
16
|
+
export declare const ABORT_STREAM_NAME: unique symbol;
|
|
17
|
+
export declare const ABORT_HOOK_TOKEN: unique symbol;
|
|
18
|
+
export declare const ABORT_LISTENER_ATTACHED: unique symbol;
|
|
19
|
+
export declare const ABORT_READER_CANCEL: unique symbol;
|
|
20
|
+
//# sourceMappingURL=symbols.d.ts.map
|