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,283 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* OpenTelemetry semantic conventions for Vercel Workflow telemetry.
|
|
3
|
+
*
|
|
4
|
+
* This module provides standardized telemetry attributes following OpenTelemetry semantic conventions
|
|
5
|
+
* for instrumenting workflow execution, step processing, and related operations. Each exported function
|
|
6
|
+
* creates a properly formatted attribute object that can be used with OpenTelemetry spans.
|
|
7
|
+
*
|
|
8
|
+
* The semantic conventions are organized into several categories:
|
|
9
|
+
* - **Workflow attributes**: Track workflow lifecycle, status, and metadata
|
|
10
|
+
* - **Step attributes**: Monitor individual step execution, retries, and results
|
|
11
|
+
* - **Queue attributes**: Instrument message queue operations
|
|
12
|
+
* - **Deployment attributes**: Capture deployment environment information
|
|
13
|
+
*
|
|
14
|
+
* All attribute functions are type-safe and leverage existing backend types to ensure
|
|
15
|
+
* consistency between telemetry data and actual system state.
|
|
16
|
+
*
|
|
17
|
+
* @example
|
|
18
|
+
* ```typescript
|
|
19
|
+
* import * as Attribute from './telemetry/semantic-conventions.js';
|
|
20
|
+
*
|
|
21
|
+
* // Set workflow attributes on a span
|
|
22
|
+
* span.setAttributes({
|
|
23
|
+
* ...Attribute.WorkflowName('my-workflow'),
|
|
24
|
+
* ...Attribute.WorkflowOperation('start'),
|
|
25
|
+
* ...Attribute.WorkflowRunStatus('running'),
|
|
26
|
+
* });
|
|
27
|
+
*
|
|
28
|
+
* // Set step attributes
|
|
29
|
+
* span.setAttributes({
|
|
30
|
+
* ...Attribute.StepName('process-data'),
|
|
31
|
+
* ...Attribute.StepStatus('completed'),
|
|
32
|
+
* ...Attribute.StepAttempt(1),
|
|
33
|
+
* });
|
|
34
|
+
* ```
|
|
35
|
+
*
|
|
36
|
+
* @see {@link https://opentelemetry.io/docs/specs/semconv/} OpenTelemetry Semantic Conventions
|
|
37
|
+
* @packageDocumentation
|
|
38
|
+
*/
|
|
39
|
+
/** The name of the workflow being executed */
|
|
40
|
+
export declare const WorkflowName: (value: string) => {
|
|
41
|
+
[k: string]: string;
|
|
42
|
+
};
|
|
43
|
+
/** The operation being performed on the workflow */
|
|
44
|
+
export declare const WorkflowOperation: (value: "run" | "start" | "execute" | "execute_v2") => {
|
|
45
|
+
[k: string]: "run" | "start" | "execute" | "execute_v2";
|
|
46
|
+
};
|
|
47
|
+
/** Unique identifier for a specific workflow run instance */
|
|
48
|
+
export declare const WorkflowRunId: (value: string) => {
|
|
49
|
+
[k: string]: string;
|
|
50
|
+
};
|
|
51
|
+
/** Current status of the workflow run */
|
|
52
|
+
export declare const WorkflowRunStatus: (value: "pending" | "running" | "cancelled" | "completed" | "failed" | "workflow_suspended") => {
|
|
53
|
+
[k: string]: "pending" | "running" | "cancelled" | "completed" | "failed" | "workflow_suspended";
|
|
54
|
+
};
|
|
55
|
+
/** Timestamp when the workflow execution started (Unix timestamp) */
|
|
56
|
+
export declare const WorkflowStartedAt: (value: number) => {
|
|
57
|
+
[k: string]: number;
|
|
58
|
+
};
|
|
59
|
+
/** Number of events processed during workflow execution */
|
|
60
|
+
export declare const WorkflowEventsCount: (value: number) => {
|
|
61
|
+
[k: string]: number;
|
|
62
|
+
};
|
|
63
|
+
/** Number of arguments passed to the workflow */
|
|
64
|
+
export declare const WorkflowArgumentsCount: (value: number) => {
|
|
65
|
+
[k: string]: number;
|
|
66
|
+
};
|
|
67
|
+
/** Type of the workflow result */
|
|
68
|
+
export declare const WorkflowResultType: (value: string) => {
|
|
69
|
+
[k: string]: string;
|
|
70
|
+
};
|
|
71
|
+
/** Whether trace context was propagated to this workflow execution */
|
|
72
|
+
export declare const WorkflowTracePropagated: (value: boolean) => {
|
|
73
|
+
[k: string]: boolean;
|
|
74
|
+
};
|
|
75
|
+
/** Name of the error that caused workflow failure */
|
|
76
|
+
export declare const WorkflowErrorName: (value: string) => {
|
|
77
|
+
[k: string]: string;
|
|
78
|
+
};
|
|
79
|
+
/** Error message when workflow fails */
|
|
80
|
+
export declare const WorkflowErrorMessage: (value: string) => {
|
|
81
|
+
[k: string]: string;
|
|
82
|
+
};
|
|
83
|
+
/** Error classification code (USER_ERROR, RUNTIME_ERROR, etc.) */
|
|
84
|
+
export declare const WorkflowErrorCode: (value: string) => {
|
|
85
|
+
[k: string]: string;
|
|
86
|
+
};
|
|
87
|
+
/** Number of steps created during workflow execution */
|
|
88
|
+
export declare const WorkflowStepsCreated: (value: number) => {
|
|
89
|
+
[k: string]: number;
|
|
90
|
+
};
|
|
91
|
+
/** Number of hooks created during workflow execution */
|
|
92
|
+
export declare const WorkflowHooksCreated: (value: number) => {
|
|
93
|
+
[k: string]: number;
|
|
94
|
+
};
|
|
95
|
+
/** Number of waits created during workflow execution */
|
|
96
|
+
export declare const WorkflowWaitsCreated: (value: number) => {
|
|
97
|
+
[k: string]: number;
|
|
98
|
+
};
|
|
99
|
+
/** Name of the step function being executed */
|
|
100
|
+
export declare const StepName: (value: string) => {
|
|
101
|
+
[k: string]: string;
|
|
102
|
+
};
|
|
103
|
+
/** Unique identifier for the step instance */
|
|
104
|
+
export declare const StepId: (value: string) => {
|
|
105
|
+
[k: string]: string;
|
|
106
|
+
};
|
|
107
|
+
/** Current attempt number for step execution (starts at 1) */
|
|
108
|
+
export declare const StepAttempt: (value: number) => {
|
|
109
|
+
[k: string]: number;
|
|
110
|
+
};
|
|
111
|
+
/** Current status of the step */
|
|
112
|
+
export declare const StepStatus: (value: "pending" | "running" | "cancelled" | "completed" | "failed") => {
|
|
113
|
+
[k: string]: "pending" | "running" | "cancelled" | "completed" | "failed";
|
|
114
|
+
};
|
|
115
|
+
/** Maximum number of retries allowed for this step */
|
|
116
|
+
export declare const StepMaxRetries: (value: number) => {
|
|
117
|
+
[k: string]: number;
|
|
118
|
+
};
|
|
119
|
+
/** Whether trace context was propagated to this step execution */
|
|
120
|
+
export declare const StepTracePropagated: (value: boolean) => {
|
|
121
|
+
[k: string]: boolean;
|
|
122
|
+
};
|
|
123
|
+
/** Whether the step was skipped during execution */
|
|
124
|
+
export declare const StepSkipped: (value: boolean) => {
|
|
125
|
+
[k: string]: boolean;
|
|
126
|
+
};
|
|
127
|
+
/** Reason why the step was skipped */
|
|
128
|
+
export declare const StepSkipReason: (value: "pending" | "running" | "cancelled" | "completed" | "failed") => {
|
|
129
|
+
[k: string]: "pending" | "running" | "cancelled" | "completed" | "failed";
|
|
130
|
+
};
|
|
131
|
+
/** Number of arguments passed to the step function */
|
|
132
|
+
export declare const StepArgumentsCount: (value: number) => {
|
|
133
|
+
[k: string]: number;
|
|
134
|
+
};
|
|
135
|
+
/** Type of the step result */
|
|
136
|
+
export declare const StepResultType: (value: string) => {
|
|
137
|
+
[k: string]: string;
|
|
138
|
+
};
|
|
139
|
+
/** Name of the error that caused step failure */
|
|
140
|
+
export declare const StepErrorName: (value: string) => {
|
|
141
|
+
[k: string]: string;
|
|
142
|
+
};
|
|
143
|
+
/** Error message when step fails */
|
|
144
|
+
export declare const StepErrorMessage: (value: string) => {
|
|
145
|
+
[k: string]: string;
|
|
146
|
+
};
|
|
147
|
+
/** Whether the step failed with a fatal error (no retries) */
|
|
148
|
+
export declare const StepFatalError: (value: boolean) => {
|
|
149
|
+
[k: string]: boolean;
|
|
150
|
+
};
|
|
151
|
+
/** Whether all retry attempts have been exhausted */
|
|
152
|
+
export declare const StepRetryExhausted: (value: boolean) => {
|
|
153
|
+
[k: string]: boolean;
|
|
154
|
+
};
|
|
155
|
+
/** Number of seconds to wait before next retry attempt */
|
|
156
|
+
export declare const StepRetryTimeoutSeconds: (value: number) => {
|
|
157
|
+
[k: string]: number;
|
|
158
|
+
};
|
|
159
|
+
/** Whether the step will be retried after this failure */
|
|
160
|
+
export declare const StepRetryWillRetry: (value: boolean) => {
|
|
161
|
+
[k: string]: boolean;
|
|
162
|
+
};
|
|
163
|
+
/** Messaging system identifier (standard OTEL: messaging.system) */
|
|
164
|
+
export declare const MessagingSystem: (value: string) => {
|
|
165
|
+
[k: string]: string;
|
|
166
|
+
};
|
|
167
|
+
/** Destination name/queue name (standard OTEL: messaging.destination.name) */
|
|
168
|
+
export declare const MessagingDestinationName: (value: string) => {
|
|
169
|
+
[k: string]: string;
|
|
170
|
+
};
|
|
171
|
+
/** The message id being handled (standard OTEL: messaging.message.id) */
|
|
172
|
+
export declare const MessagingMessageId: (value: string & import("zod").$brand<"MessageId">) => {
|
|
173
|
+
[k: string]: string & import("zod").$brand<"MessageId">;
|
|
174
|
+
};
|
|
175
|
+
/** Operation type (standard OTEL: messaging.operation.type) */
|
|
176
|
+
export declare const MessagingOperationType: (value: "publish" | "receive" | "process") => {
|
|
177
|
+
[k: string]: "publish" | "receive" | "process";
|
|
178
|
+
};
|
|
179
|
+
/** Time taken to enqueue the message in milliseconds (workflow-specific) */
|
|
180
|
+
export declare const QueueOverheadMs: (value: number) => {
|
|
181
|
+
[k: string]: number;
|
|
182
|
+
};
|
|
183
|
+
/** Unique identifier for the deployment environment */
|
|
184
|
+
export declare const DeploymentId: (value: string) => {
|
|
185
|
+
[k: string]: string;
|
|
186
|
+
};
|
|
187
|
+
/** Token identifying a specific hook */
|
|
188
|
+
export declare const HookToken: (value: string) => {
|
|
189
|
+
[k: string]: string;
|
|
190
|
+
};
|
|
191
|
+
/** Unique identifier for a hook instance */
|
|
192
|
+
export declare const HookId: (value: string) => {
|
|
193
|
+
[k: string]: string;
|
|
194
|
+
};
|
|
195
|
+
/** Whether a hook was found by its token */
|
|
196
|
+
export declare const HookFound: (value: boolean) => {
|
|
197
|
+
[k: string]: boolean;
|
|
198
|
+
};
|
|
199
|
+
/** Number of webhook handlers triggered */
|
|
200
|
+
export declare const WebhookHandlersTriggered: (value: number) => {
|
|
201
|
+
[k: string]: number;
|
|
202
|
+
};
|
|
203
|
+
export declare const WorkflowSuspensionState: (value: "suspended") => {
|
|
204
|
+
[k: string]: "suspended";
|
|
205
|
+
};
|
|
206
|
+
export declare const WorkflowSuspensionHookCount: (value: number) => {
|
|
207
|
+
[k: string]: number;
|
|
208
|
+
};
|
|
209
|
+
export declare const WorkflowSuspensionStepCount: (value: number) => {
|
|
210
|
+
[k: string]: number;
|
|
211
|
+
};
|
|
212
|
+
export declare const WorkflowSuspensionWaitCount: (value: number) => {
|
|
213
|
+
[k: string]: number;
|
|
214
|
+
};
|
|
215
|
+
/** HTTP request method (standard OTEL: http.request.method) */
|
|
216
|
+
export declare const HttpRequestMethod: (value: string) => {
|
|
217
|
+
[k: string]: string;
|
|
218
|
+
};
|
|
219
|
+
/** Full URL of the request (standard OTEL: url.full) */
|
|
220
|
+
export declare const UrlFull: (value: string) => {
|
|
221
|
+
[k: string]: string;
|
|
222
|
+
};
|
|
223
|
+
/** Server hostname (standard OTEL: server.address) */
|
|
224
|
+
export declare const ServerAddress: (value: string) => {
|
|
225
|
+
[k: string]: string;
|
|
226
|
+
};
|
|
227
|
+
/** Server port (standard OTEL: server.port) */
|
|
228
|
+
export declare const ServerPort: (value: number) => {
|
|
229
|
+
[k: string]: number;
|
|
230
|
+
};
|
|
231
|
+
/** HTTP response status code (standard OTEL: http.response.status_code) */
|
|
232
|
+
export declare const HttpResponseStatusCode: (value: number) => {
|
|
233
|
+
[k: string]: number;
|
|
234
|
+
};
|
|
235
|
+
/** Error type when request fails (standard OTEL: error.type) */
|
|
236
|
+
export declare const ErrorType: (value: string) => {
|
|
237
|
+
[k: string]: string;
|
|
238
|
+
};
|
|
239
|
+
/** Format used for parsing response body (cbor or json) */
|
|
240
|
+
export declare const WorldParseFormat: (value: "cbor" | "json") => {
|
|
241
|
+
[k: string]: "cbor" | "json";
|
|
242
|
+
};
|
|
243
|
+
/** Number of pagination pages loaded when fetching workflow events */
|
|
244
|
+
export declare const WorkflowEventsPagesLoaded: (value: number) => {
|
|
245
|
+
[k: string]: number;
|
|
246
|
+
};
|
|
247
|
+
/** Time spent deserializing the queue message in milliseconds */
|
|
248
|
+
export declare const QueueDeserializeTimeMs: (value: number) => {
|
|
249
|
+
[k: string]: number;
|
|
250
|
+
};
|
|
251
|
+
/** Time spent executing the handler logic in milliseconds */
|
|
252
|
+
export declare const QueueExecutionTimeMs: (value: number) => {
|
|
253
|
+
[k: string]: number;
|
|
254
|
+
};
|
|
255
|
+
/** Time spent serializing the response in milliseconds */
|
|
256
|
+
export declare const QueueSerializeTimeMs: (value: number) => {
|
|
257
|
+
[k: string]: number;
|
|
258
|
+
};
|
|
259
|
+
/** The remote service name for Datadog service maps (Datadog-specific: peer.service) */
|
|
260
|
+
export declare const PeerService: (value: string) => {
|
|
261
|
+
[k: string]: string;
|
|
262
|
+
};
|
|
263
|
+
/** RPC system identifier (standard OTEL: rpc.system) */
|
|
264
|
+
export declare const RpcSystem: (value: string) => {
|
|
265
|
+
[k: string]: string;
|
|
266
|
+
};
|
|
267
|
+
/** RPC service name (standard OTEL: rpc.service) */
|
|
268
|
+
export declare const RpcService: (value: string) => {
|
|
269
|
+
[k: string]: string;
|
|
270
|
+
};
|
|
271
|
+
/** RPC method name (standard OTEL: rpc.method) */
|
|
272
|
+
export declare const RpcMethod: (value: string) => {
|
|
273
|
+
[k: string]: string;
|
|
274
|
+
};
|
|
275
|
+
/** Whether the error is retryable (workflow-specific) */
|
|
276
|
+
export declare const ErrorRetryable: (value: boolean) => {
|
|
277
|
+
[k: string]: boolean;
|
|
278
|
+
};
|
|
279
|
+
/** Error category (workflow-specific: fatal, retryable, transient) */
|
|
280
|
+
export declare const ErrorCategory: (value: "fatal" | "retryable" | "transient") => {
|
|
281
|
+
[k: string]: "fatal" | "retryable" | "transient";
|
|
282
|
+
};
|
|
283
|
+
//# sourceMappingURL=semantic-conventions.d.ts.map
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import type * as api from '#compiled/@opentelemetry/api/index.js';
|
|
2
|
+
import type { Span, SpanKind, SpanOptions } from '#compiled/@opentelemetry/api/index.js';
|
|
3
|
+
/**
|
|
4
|
+
* Serializes the current trace context into a format that can be passed through queues
|
|
5
|
+
* @returns A record of strings representing the trace context
|
|
6
|
+
*/
|
|
7
|
+
export declare function serializeTraceCarrier(): Promise<Record<string, string>>;
|
|
8
|
+
/**
|
|
9
|
+
* Deserializes trace context and returns a context that can be used to continue the trace
|
|
10
|
+
* @param traceCarrier The serialized trace context
|
|
11
|
+
* @returns OpenTelemetry context with the restored trace
|
|
12
|
+
*/
|
|
13
|
+
export declare function deserializeTraceCarrier(traceCarrier: Record<string, string>): Promise<api.Context | undefined>;
|
|
14
|
+
/**
|
|
15
|
+
* Runs a function within the context of a deserialized trace
|
|
16
|
+
* @param traceCarrier The serialized trace carrier (optional)
|
|
17
|
+
* @param fn The function to run within the trace context
|
|
18
|
+
* @returns The result of the function
|
|
19
|
+
*/
|
|
20
|
+
export declare function withTraceContext<T>(traceCarrier: Record<string, string> | undefined, fn: () => Promise<T>): Promise<T>;
|
|
21
|
+
export declare function trace<T>(spanName: string, ...args: [fn: (span?: Span) => Promise<T>] | [opts: SpanOptions, fn: (span?: Span) => Promise<T>]): Promise<T>;
|
|
22
|
+
export declare function getSpanContextForTraceCarrier(carrier: Record<string, string>): Promise<api.SpanContext | undefined>;
|
|
23
|
+
export declare function getActiveSpan(): Promise<api.Span | undefined>;
|
|
24
|
+
/**
|
|
25
|
+
* Wraps all methods of an object with tracing spans.
|
|
26
|
+
* @param prefix - Prefix for span names (e.g., "WORLD.runs")
|
|
27
|
+
* @param o - Object with methods to instrument
|
|
28
|
+
* @returns Instrumented object with same interface
|
|
29
|
+
*/
|
|
30
|
+
export declare function instrumentObject<T extends object>(prefix: string, o: T): T;
|
|
31
|
+
export declare function getSpanKind(field: keyof typeof SpanKind): Promise<api.SpanKind | undefined>;
|
|
32
|
+
export declare function withOtel<T>(fn: (otel: typeof api) => T): Promise<Awaited<T> | undefined>;
|
|
33
|
+
export declare function linkToCurrentContext(): Promise<[api.Link] | undefined>;
|
|
34
|
+
/**
|
|
35
|
+
* Workflow context to propagate via baggage
|
|
36
|
+
*/
|
|
37
|
+
export interface WorkflowBaggageContext {
|
|
38
|
+
workflowRunId: string;
|
|
39
|
+
workflowName: string;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Sets workflow context as OTEL baggage for automatic propagation.
|
|
43
|
+
* Baggage is propagated across service boundaries via HTTP headers.
|
|
44
|
+
* @param context - Workflow context to set as baggage
|
|
45
|
+
* @returns A function to run within the baggage context
|
|
46
|
+
*/
|
|
47
|
+
export declare function withWorkflowBaggage<T>(context: WorkflowBaggageContext, fn: () => Promise<T>): Promise<T>;
|
|
48
|
+
/**
|
|
49
|
+
* Retrieves workflow context from OTEL baggage.
|
|
50
|
+
* @returns Workflow context if present in baggage, undefined otherwise
|
|
51
|
+
*/
|
|
52
|
+
export declare function getWorkflowBaggage(): Promise<WorkflowBaggageContext | undefined>;
|
|
53
|
+
//# sourceMappingURL=telemetry.d.ts.map
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export declare function getErrorName(v: unknown): string;
|
|
2
|
+
export declare function getErrorStack(v: unknown): string;
|
|
3
|
+
export interface NormalizedUnknownError {
|
|
4
|
+
name: string;
|
|
5
|
+
message: string;
|
|
6
|
+
stack: string;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Normalizes unknown thrown values into a stable error shape.
|
|
10
|
+
* This handles Promise/thenable throw values so logs/events never end up
|
|
11
|
+
* with unhelpful "[object Promise]" messages.
|
|
12
|
+
*/
|
|
13
|
+
export declare function normalizeUnknownError(value: unknown): Promise<NormalizedUnknownError>;
|
|
14
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Builds a workflow suspension log message based on the counts of steps,
|
|
3
|
+
* hooks, and waits. The structured logger attaches the run context, so the
|
|
4
|
+
* message itself only describes what's being enqueued.
|
|
5
|
+
* @param stepCount - Number of steps to be enqueued
|
|
6
|
+
* @param hookCount - Number of hooks to be enqueued
|
|
7
|
+
* @param waitCount - Number of waits to be enqueued
|
|
8
|
+
* @returns The formatted log message or null if all counts are 0
|
|
9
|
+
*/
|
|
10
|
+
export declare function buildWorkflowSuspensionMessage(stepCount: number, hookCount: number, waitCount: number): string | null;
|
|
11
|
+
/**
|
|
12
|
+
* Generates a stream ID for a workflow run.
|
|
13
|
+
* User-defined streams include a "user" segment for isolation from future system-defined streams.
|
|
14
|
+
* Namespaces are base64-encoded to handle characters not allowed in Redis key names.
|
|
15
|
+
*
|
|
16
|
+
* @param runId - The workflow run ID
|
|
17
|
+
* @param namespace - Optional namespace for the stream
|
|
18
|
+
* @returns The stream ID in format: `strm_{ULID}_user_{base64(namespace)?}`
|
|
19
|
+
*/
|
|
20
|
+
export declare function getWorkflowRunStreamId(runId: string, namespace?: string): string;
|
|
21
|
+
/**
|
|
22
|
+
* Generate a stream ID for an abort signal's backing stream.
|
|
23
|
+
* Uses the "_system_abort" namespace to isolate from user-defined streams.
|
|
24
|
+
*
|
|
25
|
+
* @param id - A unique identifier (typically a ULID)
|
|
26
|
+
* @returns The stream ID in format: `strm_{id}_system_abort`
|
|
27
|
+
*/
|
|
28
|
+
export declare function getAbortStreamId(id: string): string;
|
|
29
|
+
/**
|
|
30
|
+
* Derive the abort stream name from a hook token.
|
|
31
|
+
* Hook tokens use the format `abrt_{id}`, and the corresponding stream is
|
|
32
|
+
* `strm_{id}_system_abort`.
|
|
33
|
+
*/
|
|
34
|
+
export declare function getAbortStreamIdFromToken(hookToken: string): string;
|
|
35
|
+
/**
|
|
36
|
+
* A small wrapper around `waitUntil` that also returns
|
|
37
|
+
* the result of the awaited promise.
|
|
38
|
+
*/
|
|
39
|
+
export declare function waitedUntil<T>(fn: () => Promise<T>): Promise<T>;
|
|
40
|
+
//# sourceMappingURL=util.d.ts.map
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export interface CreateContextOptions {
|
|
2
|
+
seed: string;
|
|
3
|
+
fixedTimestamp: number;
|
|
4
|
+
}
|
|
5
|
+
/**
|
|
6
|
+
* Creates a Node.js `vm.Context` configured to be usable for
|
|
7
|
+
* executing workflow logic in a deterministic environment.
|
|
8
|
+
*
|
|
9
|
+
* @param options - The options for the context.
|
|
10
|
+
* @returns The context.
|
|
11
|
+
*/
|
|
12
|
+
export declare function createContext(options: CreateContextOptions): {
|
|
13
|
+
context: import("vm").Context;
|
|
14
|
+
globalThis: typeof globalThis;
|
|
15
|
+
updateTimestamp: (timestamp: number) => void;
|
|
16
|
+
};
|
|
17
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Polyfill for the TC39 Uint8Array base64/hex proposal (Stage 4).
|
|
3
|
+
*
|
|
4
|
+
* Implements:
|
|
5
|
+
* - Uint8Array.prototype.toBase64([options])
|
|
6
|
+
* - Uint8Array.prototype.toHex()
|
|
7
|
+
* - Uint8Array.fromBase64(string[, options])
|
|
8
|
+
* - Uint8Array.fromHex(string)
|
|
9
|
+
* - Uint8Array.prototype.setFromBase64(string[, options])
|
|
10
|
+
* - Uint8Array.prototype.setFromHex(string)
|
|
11
|
+
*
|
|
12
|
+
* @see https://tc39.es/proposal-arraybuffer-base64/spec/
|
|
13
|
+
*/
|
|
14
|
+
/**
|
|
15
|
+
* Installs the Uint8Array base64/hex polyfill onto the given
|
|
16
|
+
* Uint8Array constructor and prototype. This is designed to be
|
|
17
|
+
* used inside the workflow VM context, operating on the VM's
|
|
18
|
+
* own Uint8Array rather than the host's.
|
|
19
|
+
*/
|
|
20
|
+
export declare function installUint8ArrayBase64(Uint8ArrayCtor: typeof Uint8Array): void;
|
|
21
|
+
//# sourceMappingURL=uint8array-base64.d.ts.map
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Returns a function that generates a random UUID, based on the given RNG.
|
|
3
|
+
*
|
|
4
|
+
* `rng` is expected to be a seeded random number generator (i.e. `seedrandom.PRNG` instance).
|
|
5
|
+
*
|
|
6
|
+
* @param rng - A function that returns a random number between 0 and 1.
|
|
7
|
+
* @returns A `crypto.randomUUID`-like function.
|
|
8
|
+
*/
|
|
9
|
+
export declare function createRandomUUID(rng: () => number): () => ReturnType<typeof crypto.randomUUID>;
|
|
10
|
+
//# sourceMappingURL=uuid.d.ts.map
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import type { WorkflowOrchestratorContext } from '../private.js';
|
|
2
|
+
import { ABORT_HOOK_TOKEN, ABORT_STREAM_NAME } from '../symbols.js';
|
|
3
|
+
/**
|
|
4
|
+
* A lightweight AbortSignal implementation for the workflow VM context.
|
|
5
|
+
*
|
|
6
|
+
* `signal.aborted` and listeners are updated in two scenarios:
|
|
7
|
+
* 1. On first-run: when `abort()` is called in the workflow code
|
|
8
|
+
* 2. On replay: when the events consumer processes the `hook_received`
|
|
9
|
+
* event (chained through promiseQueue for deterministic ordering)
|
|
10
|
+
*
|
|
11
|
+
* On replay, `abort()` in the workflow code becomes a no-op since
|
|
12
|
+
* `_setAborted` was already called by the events consumer.
|
|
13
|
+
*/
|
|
14
|
+
export declare class WorkflowAbortSignal {
|
|
15
|
+
#private;
|
|
16
|
+
aborted: boolean;
|
|
17
|
+
reason: unknown;
|
|
18
|
+
readonly [ABORT_STREAM_NAME]: string;
|
|
19
|
+
readonly [ABORT_HOOK_TOKEN]: string;
|
|
20
|
+
get onabort(): ((this: WorkflowAbortSignal) => void) | null;
|
|
21
|
+
set onabort(handler: ((this: WorkflowAbortSignal) => void) | null);
|
|
22
|
+
constructor(streamName: string, hookToken: string);
|
|
23
|
+
/**
|
|
24
|
+
* @internal Sets aborted state and fires listeners.
|
|
25
|
+
* Called by abort() on first-run, or by the events consumer on replay.
|
|
26
|
+
* Idempotent — second call is a no-op.
|
|
27
|
+
*/
|
|
28
|
+
_setAborted(reason?: unknown): void;
|
|
29
|
+
addEventListener(type: string, listener: () => void): void;
|
|
30
|
+
removeEventListener(type: string, listener: () => void): void;
|
|
31
|
+
throwIfAborted(): void;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Creates a workflow-context `AbortController` class that uses hooks for
|
|
35
|
+
* durable state and streams for real-time step propagation.
|
|
36
|
+
*
|
|
37
|
+
* Follows the same pattern as `createCreateHook()` in `workflow/hook.ts`:
|
|
38
|
+
* - Registers a hook in the invocations queue on construction
|
|
39
|
+
* - Subscribes to the events consumer for hook_created/hook_received events
|
|
40
|
+
* - `abort()` calls `_setAborted` + marks the hook for resumption
|
|
41
|
+
* - The suspension handler processes the abort (creates event + writes stream)
|
|
42
|
+
* - On replay, the events consumer calls `_setAborted` when hook_received
|
|
43
|
+
* is processed, and `abort()` in the workflow code becomes a no-op
|
|
44
|
+
*/
|
|
45
|
+
export declare function createCreateAbortController(ctx: WorkflowOrchestratorContext): {
|
|
46
|
+
new (): {
|
|
47
|
+
readonly signal: WorkflowAbortSignal;
|
|
48
|
+
abort(reason?: unknown): void;
|
|
49
|
+
readonly [ABORT_STREAM_NAME]: string;
|
|
50
|
+
readonly [ABORT_HOOK_TOKEN]: string;
|
|
51
|
+
};
|
|
52
|
+
};
|
|
53
|
+
/**
|
|
54
|
+
* Creates a workflow-context `AbortSignal` object with static methods.
|
|
55
|
+
*/
|
|
56
|
+
export declare function createAbortSignalStatics(): {
|
|
57
|
+
abort: (reason?: unknown) => WorkflowAbortSignal;
|
|
58
|
+
any: (signals: Iterable<{
|
|
59
|
+
aborted: boolean;
|
|
60
|
+
reason?: unknown;
|
|
61
|
+
addEventListener?: Function;
|
|
62
|
+
}>) => WorkflowAbortSignal;
|
|
63
|
+
timeout: () => never;
|
|
64
|
+
};
|
|
65
|
+
//# sourceMappingURL=abort-controller.d.ts.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { Hook, HookOptions, RequestWithResponse, Webhook, WebhookOptions } from '../create-hook.js';
|
|
2
|
+
export declare function createHook<T = any>(options?: HookOptions): Hook<T>;
|
|
3
|
+
export declare function createWebhook(options: WebhookOptions & {
|
|
4
|
+
respondWith: 'manual';
|
|
5
|
+
}): Webhook<RequestWithResponse>;
|
|
6
|
+
export declare function createWebhook(options?: WebhookOptions): Webhook<Request>;
|
|
7
|
+
//# sourceMappingURL=create-hook.d.ts.map
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { Hook as HookEntity } from '../_workflow-world.js';
|
|
2
|
+
import type { Hook, HookOptions } from '../create-hook.js';
|
|
3
|
+
/**
|
|
4
|
+
* NOTE: This is the implementation of `defineHook()` that is used in workflow contexts.
|
|
5
|
+
*/
|
|
6
|
+
export declare function defineHook<TInput, TOutput = TInput>(): {
|
|
7
|
+
create(options?: HookOptions): Hook<TOutput>;
|
|
8
|
+
resume: (_token: string, _payload: TInput) => Promise<HookEntity | null>;
|
|
9
|
+
};
|
|
10
|
+
//# sourceMappingURL=define-hook.d.ts.map
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
export interface WorkflowMetadata {
|
|
2
|
+
/**
|
|
3
|
+
* The name of the workflow.
|
|
4
|
+
*/
|
|
5
|
+
workflowName: string;
|
|
6
|
+
/**
|
|
7
|
+
* Unique identifier for the workflow run.
|
|
8
|
+
*/
|
|
9
|
+
workflowRunId: string;
|
|
10
|
+
/**
|
|
11
|
+
* Timestamp when the workflow run started.
|
|
12
|
+
*/
|
|
13
|
+
workflowStartedAt: Date;
|
|
14
|
+
/**
|
|
15
|
+
* The URL where the workflow can be triggered.
|
|
16
|
+
*/
|
|
17
|
+
url: string;
|
|
18
|
+
/**
|
|
19
|
+
* Feature flags indicating which capabilities are active for this workflow run.
|
|
20
|
+
*/
|
|
21
|
+
features: {
|
|
22
|
+
/**
|
|
23
|
+
* Whether encryption is enabled for this workflow run.
|
|
24
|
+
* When `true`, step inputs, outputs, and other serialized data
|
|
25
|
+
* are encrypted at rest.
|
|
26
|
+
*/
|
|
27
|
+
encryption: boolean;
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
export declare const WORKFLOW_CONTEXT_SYMBOL: unique symbol;
|
|
31
|
+
export declare function getWorkflowMetadata(): WorkflowMetadata;
|
|
32
|
+
//# sourceMappingURL=get-workflow-metadata.d.ts.map
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { Hook, HookOptions } from '../create-hook.js';
|
|
2
|
+
import { type WorkflowOrchestratorContext } from '../private.js';
|
|
3
|
+
export declare function createCreateHook(ctx: WorkflowOrchestratorContext): <T = any>(options?: HookOptions) => Hook<T>;
|
|
4
|
+
//# sourceMappingURL=hook.d.ts.map
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { StepMetadata } from '../step/get-step-metadata.js';
|
|
2
|
+
export { FatalError, RetryableError, type RetryableErrorOptions, } from '#compiled/@workflow/errors/index.js';
|
|
3
|
+
export type { Hook, HookOptions } from '../create-hook.js';
|
|
4
|
+
export { sleep } from '../sleep.js';
|
|
5
|
+
export { createHook, createWebhook } from './create-hook.js';
|
|
6
|
+
export { defineHook } from './define-hook.js';
|
|
7
|
+
export { getWorkflowMetadata } from './get-workflow-metadata.js';
|
|
8
|
+
export { getWritable } from './writable-stream.js';
|
|
9
|
+
export declare function getStepMetadata(): StepMetadata;
|
|
10
|
+
export declare function resumeHook(): void;
|
|
11
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { StringValue } from '../_ms.js';
|
|
2
|
+
import { type WorkflowOrchestratorContext } from '../private.js';
|
|
3
|
+
export declare function createSleep(ctx: WorkflowOrchestratorContext): (param: StringValue | Date | number) => Promise<void>;
|
|
4
|
+
//# sourceMappingURL=sleep.d.ts.map
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* VM/step-bundle stub for `@workflow/core/runtime/world-init`.
|
|
3
|
+
*
|
|
4
|
+
* Resolved via the `workflow` export condition. Empty by design — the host
|
|
5
|
+
* is responsible for loading `world.ts` and populating the globalThis
|
|
6
|
+
* world cache before any VM or step code executes. Including this module
|
|
7
|
+
* (rather than letting the resolver fall through to the host file) keeps
|
|
8
|
+
* `world.ts` and its server-only deps (`@workflow/world-vercel`,
|
|
9
|
+
* `@workflow/world-local`, `cbor-x`, …) out of the workflow sandbox.
|
|
10
|
+
*
|
|
11
|
+
* See `../runtime/world-init.ts` for the host-side implementation and the
|
|
12
|
+
* full rationale.
|
|
13
|
+
*/
|
|
14
|
+
export {};
|
|
15
|
+
//# sourceMappingURL=world-init-stub.d.ts.map
|
|
@@ -1,38 +1 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
export interface Hook<T = unknown> extends AsyncIterable<T> {
|
|
4
|
-
readonly token: string;
|
|
5
|
-
dispose(): void;
|
|
6
|
-
[Symbol.dispose](): void;
|
|
7
|
-
}
|
|
8
|
-
export interface HookOptions {
|
|
9
|
-
token?: string | undefined;
|
|
10
|
-
timeout?: string | number | undefined;
|
|
11
|
-
}
|
|
12
|
-
export type RetryableErrorOptions = any;
|
|
13
|
-
export type Webhook<T = unknown> = any;
|
|
14
|
-
export type WebhookOptions = HookOptions;
|
|
15
|
-
export interface StepMetadata {
|
|
16
|
-
[key: string]: unknown;
|
|
17
|
-
}
|
|
18
|
-
export interface WorkflowMetadata {
|
|
19
|
-
readonly url: string;
|
|
20
|
-
readonly workflowRunId: string;
|
|
21
|
-
readonly workflowName: string;
|
|
22
|
-
readonly workflowStartedAt: Date;
|
|
23
|
-
[key: string]: unknown;
|
|
24
|
-
}
|
|
25
|
-
export declare class FatalError extends Error {}
|
|
26
|
-
export declare class RetryableError extends Error {
|
|
27
|
-
constructor(message: string, options?: RetryableErrorOptions);
|
|
28
|
-
}
|
|
29
|
-
export declare function createHook<T = unknown>(options?: HookOptions): Hook<T>;
|
|
30
|
-
export declare function createWebhook<T = unknown>(options?: WebhookOptions): Webhook<T>;
|
|
31
|
-
export declare function defineHook<T = unknown>(): Hook<T>;
|
|
32
|
-
export declare function getStepMetadata(): StepMetadata;
|
|
33
|
-
export declare function getWorkflowMetadata(): WorkflowMetadata;
|
|
34
|
-
export declare function getWritable<T = unknown>(
|
|
35
|
-
options?: WorkflowWritableStreamOptions,
|
|
36
|
-
): WritableStream<T>;
|
|
37
|
-
export declare function resumeHook(): void;
|
|
38
|
-
export declare function sleep(duration: string | number): Promise<void>;
|
|
1
|
+
export * from "./workflow/index.js";
|