experimental-ash 0.22.2 → 0.24.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.
Files changed (172) hide show
  1. package/CHANGELOG.md +36 -0
  2. package/dist/docs/internals/hooks.md +13 -16
  3. package/dist/docs/internals/message-runtime.md +1 -1
  4. package/dist/docs/public/auth-and-route-protection.md +3 -3
  5. package/dist/docs/public/faqs.md +67 -0
  6. package/dist/docs/public/meta.json +1 -0
  7. package/dist/docs/public/schedules.md +11 -0
  8. package/dist/docs/public/session-context.md +46 -89
  9. package/dist/docs/public/skills.md +13 -0
  10. package/dist/docs/public/subagents.md +12 -6
  11. package/dist/docs/public/tools.md +9 -13
  12. package/dist/docs/public/typescript-api.md +4 -4
  13. package/dist/src/channel/types.d.ts +10 -12
  14. package/dist/src/chunks/{client-CKsU8Li3.js → client-nshDsWNF.js} +1 -1
  15. package/dist/src/chunks/{dev-authored-source-watcher-BLzYWh05.js → dev-authored-source-watcher-B4PaZGUr.js} +1 -1
  16. package/dist/src/chunks/host-DsW72Q-w.js +65 -0
  17. package/dist/src/chunks/paths-OknjaYR8.js +89 -0
  18. package/dist/src/chunks/prewarm-B4YblQ5m.js +6 -0
  19. package/dist/src/cli/commands/info.js +1 -1
  20. package/dist/src/cli/dev/repl.js +2 -2
  21. package/dist/src/cli/run.js +1 -1
  22. package/dist/src/client/session.js +8 -0
  23. package/dist/src/client/types.d.ts +12 -1
  24. package/dist/src/compiled/.vendor-stamp.json +3 -3
  25. package/dist/src/compiled/@workflow/core/_ms.d.ts +4 -0
  26. package/dist/src/compiled/@workflow/core/_workflow-serde.d.ts +5 -0
  27. package/dist/src/compiled/@workflow/core/_workflow-utils.d.ts +8 -0
  28. package/dist/src/compiled/@workflow/core/_workflow-world.d.ts +59 -0
  29. package/dist/src/compiled/@workflow/core/capabilities.d.ts +45 -0
  30. package/dist/src/compiled/@workflow/core/capture-stack.d.ts +16 -0
  31. package/dist/src/compiled/@workflow/core/class-serialization.d.ts +31 -0
  32. package/dist/src/compiled/@workflow/core/classify-error.d.ts +20 -0
  33. package/dist/src/compiled/@workflow/core/context-errors.d.ts +27 -0
  34. package/dist/src/compiled/@workflow/core/context-violation-error.d.ts +97 -0
  35. package/dist/src/compiled/@workflow/core/create-hook.d.ts +179 -0
  36. package/dist/src/compiled/@workflow/core/define-hook.d.ts +68 -0
  37. package/dist/src/compiled/@workflow/core/describe-error.d.ts +70 -0
  38. package/dist/src/compiled/@workflow/core/encryption.d.ts +51 -0
  39. package/dist/src/compiled/@workflow/core/events-consumer.d.ts +64 -0
  40. package/dist/src/compiled/@workflow/core/flushable-stream.d.ts +82 -0
  41. package/dist/src/compiled/@workflow/core/global.d.ts +48 -0
  42. package/dist/src/compiled/@workflow/core/index.d.ts +19 -38
  43. package/dist/src/compiled/@workflow/core/index.js +2 -2
  44. package/dist/src/compiled/@workflow/core/log-format.d.ts +25 -0
  45. package/dist/src/compiled/@workflow/core/logger.d.ts +29 -0
  46. package/dist/src/compiled/@workflow/core/package.json +1 -1
  47. package/dist/src/compiled/@workflow/core/private.d.ts +59 -10
  48. package/dist/src/compiled/@workflow/core/runtime/constants.d.ts +51 -0
  49. package/dist/src/compiled/@workflow/core/runtime/get-port-lazy.d.ts +10 -0
  50. package/dist/src/compiled/@workflow/core/runtime/get-world-lazy.d.ts +32 -0
  51. package/dist/src/compiled/@workflow/core/runtime/helpers.d.ts +97 -0
  52. package/dist/src/compiled/@workflow/core/runtime/replay-budget.d.ts +98 -0
  53. package/dist/src/compiled/@workflow/core/runtime/resume-hook.d.ts +77 -0
  54. package/dist/src/compiled/@workflow/core/runtime/run.d.ts +134 -0
  55. package/dist/src/compiled/@workflow/core/runtime/runs.d.ts +50 -0
  56. package/dist/src/compiled/@workflow/core/runtime/start.d.ts +59 -0
  57. package/dist/src/compiled/@workflow/core/runtime/step-executor.d.ts +40 -0
  58. package/dist/src/compiled/@workflow/core/runtime/step-handler.d.ts +2 -0
  59. package/dist/src/compiled/@workflow/core/runtime/suspension-handler.d.ts +42 -0
  60. package/dist/src/compiled/@workflow/core/runtime/world-init.d.ts +75 -0
  61. package/dist/src/compiled/@workflow/core/runtime/world.d.ts +32 -0
  62. package/dist/src/compiled/@workflow/core/runtime.d.ts +22 -67
  63. package/dist/src/compiled/@workflow/core/runtime.js +27 -27
  64. package/dist/src/compiled/@workflow/core/schemas.d.ts +15 -0
  65. package/dist/src/compiled/@workflow/core/serialization/client.d.ts +17 -0
  66. package/dist/src/compiled/@workflow/core/serialization/codec-devalue.d.ts +14 -0
  67. package/dist/src/compiled/@workflow/core/serialization/codec.d.ts +90 -0
  68. package/dist/src/compiled/@workflow/core/serialization/encryption.d.ts +32 -0
  69. package/dist/src/compiled/@workflow/core/serialization/errors.d.ts +21 -0
  70. package/dist/src/compiled/@workflow/core/serialization/format.d.ts +60 -0
  71. package/dist/src/compiled/@workflow/core/serialization/index.d.ts +18 -0
  72. package/dist/src/compiled/@workflow/core/serialization/reducers/class.d.ts +11 -0
  73. package/dist/src/compiled/@workflow/core/serialization/reducers/common.d.ts +16 -0
  74. package/dist/src/compiled/@workflow/core/serialization/reducers/step-function.d.ts +35 -0
  75. package/dist/src/compiled/@workflow/core/serialization/step.d.ts +17 -0
  76. package/dist/src/compiled/@workflow/core/serialization/types.d.ts +215 -0
  77. package/dist/src/compiled/@workflow/core/serialization/workflow.d.ts +29 -0
  78. package/dist/src/compiled/@workflow/core/serialization-format.d.ts +171 -0
  79. package/dist/src/compiled/@workflow/core/serialization.d.ts +337 -0
  80. package/dist/src/compiled/@workflow/core/sleep.d.ts +33 -0
  81. package/dist/src/compiled/@workflow/core/source-map.d.ts +10 -0
  82. package/dist/src/compiled/@workflow/core/step/context-storage.d.ts +13 -0
  83. package/dist/src/compiled/@workflow/core/step/get-closure-vars.d.ts +9 -0
  84. package/dist/src/compiled/@workflow/core/step/get-step-metadata.d.ts +42 -0
  85. package/dist/src/compiled/@workflow/core/step/get-workflow-metadata.d.ts +7 -0
  86. package/dist/src/compiled/@workflow/core/step/writable-stream.d.ts +22 -0
  87. package/dist/src/compiled/@workflow/core/step.d.ts +4 -0
  88. package/dist/src/compiled/@workflow/core/symbols.d.ts +36 -0
  89. package/dist/src/compiled/@workflow/core/telemetry/semantic-conventions.d.ts +283 -0
  90. package/dist/src/compiled/@workflow/core/telemetry.d.ts +53 -0
  91. package/dist/src/compiled/@workflow/core/types.d.ts +14 -0
  92. package/dist/src/compiled/@workflow/core/util.d.ts +40 -0
  93. package/dist/src/compiled/@workflow/core/version.d.ts +2 -0
  94. package/dist/src/compiled/@workflow/core/vm/index.d.ts +17 -0
  95. package/dist/src/compiled/@workflow/core/vm/uint8array-base64.d.ts +21 -0
  96. package/dist/src/compiled/@workflow/core/vm/uuid.d.ts +10 -0
  97. package/dist/src/compiled/@workflow/core/workflow/abort-controller.d.ts +65 -0
  98. package/dist/src/compiled/@workflow/core/workflow/create-hook.d.ts +7 -0
  99. package/dist/src/compiled/@workflow/core/workflow/define-hook.d.ts +10 -0
  100. package/dist/src/compiled/@workflow/core/workflow/get-workflow-metadata.d.ts +32 -0
  101. package/dist/src/compiled/@workflow/core/workflow/hook.d.ts +4 -0
  102. package/dist/src/compiled/@workflow/core/workflow/index.d.ts +11 -0
  103. package/dist/src/compiled/@workflow/core/workflow/sleep.d.ts +4 -0
  104. package/dist/src/compiled/@workflow/core/workflow/world-init-stub.d.ts +15 -0
  105. package/dist/src/compiled/@workflow/core/workflow/writable-stream.d.ts +3 -0
  106. package/dist/src/compiled/@workflow/core/workflow.d.ts +1 -38
  107. package/dist/src/compiled/@workflow/core/workflow.js +1 -1
  108. package/dist/src/compiled/@workflow/errors/error-codes.d.ts +5 -1
  109. package/dist/src/compiled/@workflow/errors/index.d.ts +15 -1
  110. package/dist/src/compiled/@workflow/errors/index.js +1 -1
  111. package/dist/src/compiled/@workflow/errors/package.json +1 -1
  112. package/dist/src/compiled/_chunks/workflow/{context-errors-zbKocOyk.js → context-errors-Bbvvp-li.js} +2 -2
  113. package/dist/src/compiled/_chunks/workflow/{dist-0iNBqPYp.js → dist-C7wPwOI9.js} +2 -2
  114. package/dist/src/compiled/_chunks/workflow/{dist-D774SUM4.js → dist-C_oiE-l7.js} +1 -1
  115. package/dist/src/compiled/_chunks/workflow/resume-hook-C3VWUPii.js +12 -0
  116. package/dist/src/compiled/_chunks/workflow/sleep-QTkC1VFe.js +1 -0
  117. package/dist/src/compiled/_chunks/workflow/{symbols-D-4tVV8x.js → symbols-QezhMuLg.js} +1 -1
  118. package/dist/src/evals/cli/eval.js +1 -1
  119. package/dist/src/execution/await-authorization-orchestrator.d.ts +2 -1
  120. package/dist/src/execution/await-authorization-orchestrator.js +4 -0
  121. package/dist/src/execution/connection-auth-steps.d.ts +4 -0
  122. package/dist/src/execution/connection-auth-steps.js +9 -11
  123. package/dist/src/execution/node-step.d.ts +4 -5
  124. package/dist/src/execution/subagent-adapter.d.ts +0 -27
  125. package/dist/src/execution/subagent-adapter.js +2 -66
  126. package/dist/src/execution/subagent-hitl-proxy.d.ts +2 -2
  127. package/dist/src/execution/subagent-hitl-proxy.js +2 -2
  128. package/dist/src/execution/task-mode.d.ts +3 -3
  129. package/dist/src/execution/task-mode.js +3 -3
  130. package/dist/src/execution/turn-workflow.d.ts +41 -0
  131. package/dist/src/execution/turn-workflow.js +96 -0
  132. package/dist/src/execution/workflow-entry.js +77 -87
  133. package/dist/src/execution/workflow-errors.d.ts +14 -0
  134. package/dist/src/execution/workflow-errors.js +54 -0
  135. package/dist/src/execution/workflow-runtime.d.ts +34 -3
  136. package/dist/src/execution/workflow-runtime.js +52 -10
  137. package/dist/src/execution/workflow-steps.d.ts +27 -2
  138. package/dist/src/execution/workflow-steps.js +31 -26
  139. package/dist/src/harness/instrumentation-config.js +14 -7
  140. package/dist/src/harness/messages.d.ts +7 -7
  141. package/dist/src/harness/messages.js +4 -4
  142. package/dist/src/harness/runtime-actions.d.ts +4 -4
  143. package/dist/src/internal/application/package.js +1 -1
  144. package/dist/src/internal/workflow-bundle/workflow-builders.d.ts +1 -1
  145. package/dist/src/internal/workflow-bundle/workflow-builders.js +20 -8
  146. package/dist/src/internal/workflow-bundle/workflow-transformer.d.ts +13 -0
  147. package/dist/src/internal/workflow-bundle/workflow-transformer.js +10 -4
  148. package/dist/src/protocol/message.d.ts +6 -1
  149. package/dist/src/public/channels/ash.js +50 -3
  150. package/dist/src/public/context/index.d.ts +4 -7
  151. package/dist/src/public/context/index.js +4 -5
  152. package/dist/src/public/definitions/state.d.ts +33 -0
  153. package/dist/src/public/definitions/state.js +34 -0
  154. package/dist/src/public/next/index.d.ts +7 -0
  155. package/dist/src/public/next/index.js +2 -0
  156. package/dist/src/public/next/vercel-json.d.ts +1 -0
  157. package/dist/src/public/next/vercel-json.js +1 -0
  158. package/dist/src/react/index.d.ts +1 -1
  159. package/dist/src/react/use-ash-agent.d.ts +8 -0
  160. package/dist/src/react/use-ash-agent.js +26 -4
  161. package/dist/src/services/dev-client.d.ts +4 -1
  162. package/dist/src/services/dev-client.js +1 -0
  163. package/package.json +4 -4
  164. package/dist/src/chunks/host-DREC8e8Z.js +0 -65
  165. package/dist/src/chunks/paths-C6sp4T2U.js +0 -88
  166. package/dist/src/chunks/prewarm-hz8p2jlZ.js +0 -6
  167. package/dist/src/compiled/_chunks/workflow/resume-hook-CL8Ed91K.js +0 -12
  168. package/dist/src/compiled/_chunks/workflow/sleep-Dn3i9nxI.js +0 -1
  169. package/dist/src/execution/continuous-entry.d.ts +0 -59
  170. package/dist/src/execution/continuous-entry.js +0 -487
  171. package/dist/src/execution/continuous-runtime.d.ts +0 -17
  172. package/dist/src/execution/continuous-runtime.js +0 -123
@@ -1,38 +1 @@
1
- import type { WorkflowWritableStreamOptions } from "./runtime.js";
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";
@@ -1 +1 @@
1
- import{o as e,r as t}from"../../_chunks/workflow/dist-0iNBqPYp.js";import{a as n,n as r,r as i,s as a}from"../../_chunks/workflow/context-errors-zbKocOyk.js";import{d as o,f as s,s as c}from"../../_chunks/workflow/symbols-D-4tVV8x.js";import{t as l}from"../../_chunks/workflow/sleep-Dn3i9nxI.js";function u(e){let t=globalThis[o];return t||i(`createHook()`,`https://workflow-sdk.dev/docs/api-reference/workflow/create-hook`,u),t(e)}function d(e){let{respondWith:t,token:n,...r}=e??{};if(n!==void 0)throw Error("`createWebhook()` does not accept a `token` option. Webhook tokens are always randomly generated. Use `createHook()` with `resumeHook()` for deterministic token patterns.");let i;t!==void 0&&(i={respondWith:t});let o=u({...r,metadata:i,isWebhook:!0}),{url:s}=a();return o.url=`${s}/.well-known/workflow/v1/webhook/${encodeURIComponent(o.token)}`,o}function f(){function e(t,r){n(`defineHook().resume()`,`https://workflow-sdk.dev/docs/api-reference/workflow-api/resume-hook`,e)}return{create(e){return u(e)},resume:e}}function p(e={}){let{namespace:t}=e,n=globalThis[s](t);return Object.create(globalThis.WritableStream.prototype,{[c]:{value:n,writable:!1}})}function m(){r(`getStepMetadata()`,`https://workflow-sdk.dev/docs/api-reference/workflow/get-step-metadata`,m)}function h(){n(`resumeHook()`,`https://workflow-sdk.dev/docs/api-reference/workflow-api/resume-hook`,h)}export{t as FatalError,e as RetryableError,u as createHook,d as createWebhook,f as defineHook,m as getStepMetadata,a as getWorkflowMetadata,p as getWritable,h as resumeHook,l as sleep};
1
+ import{i as e,s as t}from"../../_chunks/workflow/dist-C7wPwOI9.js";import{a as n,n as r,r as i,s as a}from"../../_chunks/workflow/context-errors-Bbvvp-li.js";import{f as o,p as s,s as c}from"../../_chunks/workflow/symbols-QezhMuLg.js";import{t as l}from"../../_chunks/workflow/sleep-QTkC1VFe.js";function u(e){let t=globalThis[o];return t||i(`createHook()`,`https://workflow-sdk.dev/docs/api-reference/workflow/create-hook`,u),t(e)}function d(e){let{respondWith:t,token:n,...r}=e??{};if(n!==void 0)throw Error("`createWebhook()` does not accept a `token` option. Webhook tokens are always randomly generated. Use `createHook()` with `resumeHook()` for deterministic token patterns.");let i;t!==void 0&&(i={respondWith:t});let o=u({...r,metadata:i,isWebhook:!0}),{url:s}=a();return o.url=`${s}/.well-known/workflow/v1/webhook/${encodeURIComponent(o.token)}`,o}function f(){function e(t,r){n(`defineHook().resume()`,`https://workflow-sdk.dev/docs/api-reference/workflow-api/resume-hook`,e)}return{create(e){return u(e)},resume:e}}function p(e={}){let{namespace:t}=e,n=globalThis[s](t);return Object.create(globalThis.WritableStream.prototype,{[c]:{value:n,writable:!1}})}function m(){r(`getStepMetadata()`,`https://workflow-sdk.dev/docs/api-reference/workflow/get-step-metadata`,m)}function h(){n(`resumeHook()`,`https://workflow-sdk.dev/docs/api-reference/workflow-api/resume-hook`,h)}export{e as FatalError,t as RetryableError,u as createHook,d as createWebhook,f as defineHook,m as getStepMetadata,a as getWorkflowMetadata,p as getWritable,h as resumeHook,l as sleep};
@@ -6,12 +6,16 @@
6
6
  export declare const RUN_ERROR_CODES: {
7
7
  /** Error thrown in user workflow or step code */
8
8
  readonly USER_ERROR: "USER_ERROR";
9
- /** Internal runtime error (corrupted event log, missing timestamps) */
9
+ /** Internal runtime error (missing timestamps, runtime invariant failures) */
10
10
  readonly RUNTIME_ERROR: "RUNTIME_ERROR";
11
+ /** Event log contains orphaned or mismatched events and cannot be replayed */
12
+ readonly CORRUPTED_EVENT_LOG: "CORRUPTED_EVENT_LOG";
11
13
  /** Run exceeded the maximum number of queue deliveries */
12
14
  readonly MAX_DELIVERIES_EXCEEDED: "MAX_DELIVERIES_EXCEEDED";
13
15
  /** Workflow replay exceeded the maximum allowed duration */
14
16
  readonly REPLAY_TIMEOUT: "REPLAY_TIMEOUT";
17
+ /** World response violated the SDK contract and cannot be retried safely */
18
+ readonly WORLD_CONTRACT_ERROR: "WORLD_CONTRACT_ERROR";
15
19
  };
16
20
  export type RunErrorCode = (typeof RUN_ERROR_CODES)[keyof typeof RUN_ERROR_CODES];
17
21
  //# sourceMappingURL=error-codes.d.ts.map
@@ -139,6 +139,19 @@ export declare class WorkflowRuntimeError extends WorkflowError {
139
139
  constructor(message: string, options?: WorkflowErrorOptions);
140
140
  static is(value: unknown): value is WorkflowRuntimeError;
141
141
  }
142
+ /**
143
+ * Thrown when the persisted workflow event log cannot be replayed because it
144
+ * contains orphaned, duplicate, or mismatched events.
145
+ *
146
+ * This is a runtime/infrastructure failure rather than user code throwing.
147
+ * When this reaches run failure handling, it is recorded with the distinct
148
+ * `CORRUPTED_EVENT_LOG` code so worlds and backends can track it separately
149
+ * from generic runtime failures.
150
+ */
151
+ export declare class CorruptedEventLogError extends WorkflowRuntimeError {
152
+ constructor(message: string, options?: ErrorOptions);
153
+ static is(value: unknown): value is CorruptedEventLogError;
154
+ }
142
155
  interface WorkflowBuildErrorOptions extends ErrorOptions {
143
156
  /**
144
157
  * An optional actionable hint appended to the main message, explaining how
@@ -269,7 +282,8 @@ export declare class WorkflowRunNotFoundError extends WorkflowError {
269
282
  */
270
283
  export declare class HookConflictError extends WorkflowError {
271
284
  token: string;
272
- constructor(token: string);
285
+ conflictingRunId?: string;
286
+ constructor(token: string, conflictingRunId?: string);
273
287
  static is(value: unknown): value is HookConflictError;
274
288
  }
275
289
  /**
@@ -1 +1 @@
1
- import{C as e,S as t,_ as n,a as r,b as i,c as a,d as o,f as s,g as c,h as l,i as u,l as d,m as f,n as p,o as m,p as h,r as g,s as _,t as v,u as y,v as b,x,y as S}from"../../_chunks/workflow/dist-0iNBqPYp.js";export{v as ERROR_SLUGS,p as EntityConflictError,g as FatalError,u as HookConflictError,r as HookNotFoundError,e as RUN_ERROR_CODES,m as RetryableError,_ as RunExpiredError,a as RunNotSupportedError,d as SerializationError,y as StepNotRegisteredError,o as ThrottleError,s as TooEarlyError,h as VERCEL_403_ERROR_MESSAGE,f as WorkflowBuildError,l as WorkflowError,c as WorkflowNotRegisteredError,n as WorkflowRunCancelledError,b as WorkflowRunFailedError,S as WorkflowRunNotCompletedError,i as WorkflowRunNotFoundError,x as WorkflowRuntimeError,t as WorkflowWorldError};
1
+ import{C as e,S as t,_ as n,a as r,b as i,c as a,d as o,f as s,g as c,h as l,i as u,l as d,m as f,n as p,o as m,p as h,r as g,s as _,t as v,u as y,v as b,w as x,x as S,y as C}from"../../_chunks/workflow/dist-C7wPwOI9.js";export{v as CorruptedEventLogError,p as ERROR_SLUGS,g as EntityConflictError,u as FatalError,r as HookConflictError,m as HookNotFoundError,x as RUN_ERROR_CODES,_ as RetryableError,a as RunExpiredError,d as RunNotSupportedError,y as SerializationError,o as StepNotRegisteredError,s as ThrottleError,h as TooEarlyError,f as VERCEL_403_ERROR_MESSAGE,l as WorkflowBuildError,c as WorkflowError,n as WorkflowNotRegisteredError,b as WorkflowRunCancelledError,C as WorkflowRunFailedError,i as WorkflowRunNotCompletedError,S as WorkflowRunNotFoundError,t as WorkflowRuntimeError,e as WorkflowWorldError};
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "experimental-ash-compiled-workflow-errors",
3
- "version": "5.0.0-beta.2",
3
+ "version": "5.0.0-beta.4",
4
4
  "private": true,
5
5
  "type": "module",
6
6
  "license": "Apache-2.0"
@@ -1,6 +1,6 @@
1
- import{_ as e,g as t,v as n,y as r}from"./symbols-D-4tVV8x.js";function i(e,t){let n=Error.captureStackTrace;n?.(e,t)}const a=Symbol.for(`nodejs.util.inspect.custom`);function o(e){return`code`in e?`\`${e.code}\``:`dim`in e?e.dim:e.text}function s(n){return`code`in n?t(n.code):`dim`in n?e(n.dim):n.text}function c(e){return e.type===`docs`?`docs: ${e.url}`:e.segments.map(o).join(``)}function l(e){return e.type===`docs`?n(e.url):e.segments.map(s).join(``)}function u(e){let t=[e.title.map(o).join(``)];return e.details.forEach((n,r)=>{let i=r===e.details.length-1,a=i?`╰▶ `:`├▶ `,o=i?` `:`│ `;c(n).split(`
1
+ import{_ as e,b as t,v as n,y as r}from"./symbols-QezhMuLg.js";function i(e,t){let n=Error.captureStackTrace;n?.(e,t)}const a=Symbol.for(`nodejs.util.inspect.custom`);function o(e){return`code`in e?`\`${e.code}\``:`dim`in e?e.dim:e.text}function s(t){return`code`in t?e(t.code):`dim`in t?n(t.dim):t.text}function c(e){return e.type===`docs`?`docs: ${e.url}`:e.segments.map(o).join(``)}function l(e){return e.type===`docs`?r(e.url):e.segments.map(s).join(``)}function u(e){let t=[e.title.map(o).join(``)];return e.details.forEach((n,r)=>{let i=r===e.details.length-1,a=i?`╰▶ `:`├▶ `,o=i?` `:`│ `;c(n).split(`
2
2
  `).forEach((e,n)=>t.push(`${n===0?a:o}${e}`))}),t.join(`
3
- `)}function d(e){return r(e.title.map(s).join(``),e.details.map(l))}var f=class extends Error{fatal=!0;#e;constructor(e){super(u(e)),this.#e=e}[a](){let e=d(this.#e),t=this.message.split(`
3
+ `)}function d(e){return t(e.title.map(s).join(``),e.details.map(l))}var f=class extends Error{fatal=!0;#e;constructor(e){super(u(e)),this.#e=e}[a](){let e=d(this.#e),t=this.message.split(`
4
4
  `).length,n=(this.stack??``).split(`
5
5
  `).slice(t).join(`
6
6
  `);return n?`${this.name}: ${e}\n${n}`:`${this.name}: ${e}`}toString(){return`${this.name}: ${d(this.#e)}`}},p=class extends f{name=`NotInWorkflowContextError`;constructor(e,t){super({title:[{code:e},{text:` can only be called inside a workflow function`}],details:[{type:`docs`,url:t}]})}},m=class extends f{name=`NotInStepContextError`;constructor(e,t){super({title:[{code:e},{text:` can only be called inside a step function`}],details:[{type:`docs`,url:t}]})}},h=class extends f{name=`NotInWorkflowOrStepContextError`;constructor(e,t){super({title:[{code:e},{text:` can only be called inside a workflow or step function`}],details:[{type:`docs`,url:t}]})}};const g=Symbol.for(`WORKFLOW_CONTEXT`);function _(){let e=globalThis[g];if(!e){let e=new h(`getWorkflowMetadata()`,`https://workflow-sdk.dev/docs/api-reference/workflow/get-workflow-metadata`);throw i(e,_),e}return e}var v=class extends f{name=`UnavailableInWorkflowContextError`;constructor(e,t){let n=globalThis[g]?.workflowName,r=(()=>{if(!n)return null;let e=n.match(/^(workflow\/|step\/)(.*)$/);return e?[{dim:e[1]},{text:e[2]}]:[{text:n}]})(),i=r?{type:`plain`,segments:[{text:`this call was made from the `},...r,{text:` workflow context.`}]}:{type:`plain`,segments:[{text:`this call was made from a workflow context.`}]};super({title:[{code:e},{text:` cannot be called from a workflow context.`}],details:[{type:`plain`,segments:[{text:`calling this in a workflow context can cause determinism issues.`}]},i,{type:`docs`,url:t}]})}};function y(e,t,n){let r=new p(e,t);throw i(r,n),r}function b(e,t,n){let r=new m(e,t);throw i(r,n),r}function x(e,t,n){let r=new h(e,t);throw i(r,n),r}function S(e,t,n){let r=new v(e,t);throw i(r,n),r}export{S as a,m as c,x as i,p as l,b as n,g as o,y as r,_ as s,v as t,h as u};
@@ -1,3 +1,3 @@
1
- import{i as e,t}from"./chunk-DHhdAPOb.js";function n(e,t,n){return n===1?e:t}function r(e,t){if(typeof t!=`string`)return null;let[n,r,...i]=t.split(`//`);if(n!==e||!r||i.length===0)return null;let a=i.join(`//`),o=a.split(`/`).at(-1)??``,s=``;return s=r.startsWith(`./`)?r.split(`/`).at(-1)??``:(r.split(`@`).slice(0,-1).join(`@`)||r.split(`@`)[0])?.split(`/`).at(-1)??``,[`default`,`__default`].includes(o)&&s&&(o=s),{shortName:o,moduleSpecifier:r,functionName:a}}function i(e){return r(`workflow`,e)}function a(e){return r(`step`,e)}function o(e){return c(a(e),e)}function s(e){return c(i(e),e)}function c(e,t){return e?`${e.shortName} (${e.moduleSpecifier})`:t}function l(){let e,t;return{promise:new Promise((n,r)=>{e=n,t=r}),resolve:e,reject:t}}function u(e){let t={get value(){let n=e();return Object.defineProperty(t,`value`,{value:n}),n}};return t}var d=e(t(((e,t)=>{var n=1e3,r=n*60,i=r*60,a=i*24,o=a*7,s=a*365.25;t.exports=function(e,t){t||={};var n=typeof e;if(n===`string`&&e.length>0)return c(e);if(n===`number`&&isFinite(e))return t.long?u(e):l(e);throw Error(`val is not a non-empty string or a valid number. val=`+JSON.stringify(e))};function c(e){if(e=String(e),!(e.length>100)){var t=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(e);if(t){var c=parseFloat(t[1]);switch((t[2]||`ms`).toLowerCase()){case`years`:case`year`:case`yrs`:case`yr`:case`y`:return c*s;case`weeks`:case`week`:case`w`:return c*o;case`days`:case`day`:case`d`:return c*a;case`hours`:case`hour`:case`hrs`:case`hr`:case`h`:return c*i;case`minutes`:case`minute`:case`mins`:case`min`:case`m`:return c*r;case`seconds`:case`second`:case`secs`:case`sec`:case`s`:return c*n;case`milliseconds`:case`millisecond`:case`msecs`:case`msec`:case`ms`:return c;default:return}}}}function l(e){var t=Math.abs(e);return t>=a?Math.round(e/a)+`d`:t>=i?Math.round(e/i)+`h`:t>=r?Math.round(e/r)+`m`:t>=n?Math.round(e/n)+`s`:e+`ms`}function u(e){var t=Math.abs(e);return t>=a?d(e,t,a,`day`):t>=i?d(e,t,i,`hour`):t>=r?d(e,t,r,`minute`):t>=n?d(e,t,n,`second`):e+` ms`}function d(e,t,n,r){var i=t>=n*1.5;return Math.round(e/n)+` `+r+(i?`s`:``)}}))(),1);function f(e){if(typeof e==`string`){let t=(0,d.default)(e);if(typeof t!=`number`||t<0)throw Error(`Invalid duration: "${e}". Expected a valid duration string like "1s", "1m", "1h", etc.`);return new Date(Date.now()+t)}else if(typeof e==`number`){if(e<0||!Number.isFinite(e))throw Error(`Invalid duration: ${e}. Expected a non-negative finite number of milliseconds.`);return new Date(Date.now()+e)}else if(e instanceof Date||e&&typeof e==`object`&&typeof e.getTime==`function`)return e instanceof Date?e:new Date(e.getTime());else throw Error(`Invalid duration parameter. Expected a duration string, number (milliseconds), or Date object.`)}function p(e=process.env){return e.WORKFLOW_TARGET_WORLD||(e.VERCEL_DEPLOYMENT_ID?`vercel`:`local`)}function m(e){return e===`vercel`||e===`@workflow/world-vercel`}const h={USER_ERROR:`USER_ERROR`,RUNTIME_ERROR:`RUNTIME_ERROR`,MAX_DELIVERIES_EXCEEDED:`MAX_DELIVERIES_EXCEEDED`,REPLAY_TIMEOUT:`REPLAY_TIMEOUT`};function g(e){return typeof e==`object`&&!!e&&`name`in e&&`message`in e}function _(e,t){if(t.length===0)return e;let n=[e];return t.forEach((e,r)=>{let i=r===t.length-1,a=i?`╰▶ `:`├▶ `,o=i?` `:`│ `;`${e.label}: ${e.value}`.split(`
1
+ import{i as e,t}from"./chunk-DHhdAPOb.js";function n(e,t,n){return n===1?e:t}function r(e,t){if(typeof t!=`string`)return null;let[n,r,...i]=t.split(`//`);if(n!==e||!r||i.length===0)return null;let a=i.join(`//`),o=a.split(`/`).at(-1)??``,s=``;return s=r.startsWith(`./`)?r.split(`/`).at(-1)??``:(r.split(`@`).slice(0,-1).join(`@`)||r.split(`@`)[0])?.split(`/`).at(-1)??``,[`default`,`__default`].includes(o)&&s&&(o=s),{shortName:o,moduleSpecifier:r,functionName:a}}function i(e){return r(`workflow`,e)}function a(e){return r(`step`,e)}function o(e){return c(a(e),e)}function s(e){return c(i(e),e)}function c(e,t){return e?`${e.shortName} (${e.moduleSpecifier})`:t}function l(){let e,t;return{promise:new Promise((n,r)=>{e=n,t=r}),resolve:e,reject:t}}function u(e){let t={get value(){let n=e();return Object.defineProperty(t,`value`,{value:n}),n}};return t}var d=e(t(((e,t)=>{var n=1e3,r=n*60,i=r*60,a=i*24,o=a*7,s=a*365.25;t.exports=function(e,t){t||={};var n=typeof e;if(n===`string`&&e.length>0)return c(e);if(n===`number`&&isFinite(e))return t.long?u(e):l(e);throw Error(`val is not a non-empty string or a valid number. val=`+JSON.stringify(e))};function c(e){if(e=String(e),!(e.length>100)){var t=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(e);if(t){var c=parseFloat(t[1]);switch((t[2]||`ms`).toLowerCase()){case`years`:case`year`:case`yrs`:case`yr`:case`y`:return c*s;case`weeks`:case`week`:case`w`:return c*o;case`days`:case`day`:case`d`:return c*a;case`hours`:case`hour`:case`hrs`:case`hr`:case`h`:return c*i;case`minutes`:case`minute`:case`mins`:case`min`:case`m`:return c*r;case`seconds`:case`second`:case`secs`:case`sec`:case`s`:return c*n;case`milliseconds`:case`millisecond`:case`msecs`:case`msec`:case`ms`:return c;default:return}}}}function l(e){var t=Math.abs(e);return t>=a?Math.round(e/a)+`d`:t>=i?Math.round(e/i)+`h`:t>=r?Math.round(e/r)+`m`:t>=n?Math.round(e/n)+`s`:e+`ms`}function u(e){var t=Math.abs(e);return t>=a?d(e,t,a,`day`):t>=i?d(e,t,i,`hour`):t>=r?d(e,t,r,`minute`):t>=n?d(e,t,n,`second`):e+` ms`}function d(e,t,n,r){var i=t>=n*1.5;return Math.round(e/n)+` `+r+(i?`s`:``)}}))(),1);function f(e){if(typeof e==`string`){let t=(0,d.default)(e);if(typeof t!=`number`||t<0)throw Error(`Invalid duration: "${e}". Expected a valid duration string like "1s", "1m", "1h", etc.`);return new Date(Date.now()+t)}else if(typeof e==`number`){if(e<0||!Number.isFinite(e))throw Error(`Invalid duration: ${e}. Expected a non-negative finite number of milliseconds.`);return new Date(Date.now()+e)}else if(e instanceof Date||e&&typeof e==`object`&&typeof e.getTime==`function`)return e instanceof Date?e:new Date(e.getTime());else throw Error(`Invalid duration parameter. Expected a duration string, number (milliseconds), or Date object.`)}function p(e=process.env){return e.WORKFLOW_TARGET_WORLD||(e.VERCEL_DEPLOYMENT_ID?`vercel`:`local`)}function m(e){return e===`vercel`||e===`@workflow/world-vercel`}const h={USER_ERROR:`USER_ERROR`,RUNTIME_ERROR:`RUNTIME_ERROR`,CORRUPTED_EVENT_LOG:`CORRUPTED_EVENT_LOG`,MAX_DELIVERIES_EXCEEDED:`MAX_DELIVERIES_EXCEEDED`,REPLAY_TIMEOUT:`REPLAY_TIMEOUT`,WORLD_CONTRACT_ERROR:`WORLD_CONTRACT_ERROR`};function g(e){return typeof e==`object`&&!!e&&`name`in e&&`message`in e}function _(e,t){if(t.length===0)return e;let n=[e];return t.forEach((e,r)=>{let i=r===t.length-1,a=i?`╰▶ `:`├▶ `,o=i?` `:`│ `;`${e.label}: ${e.value}`.split(`
2
2
  `).forEach((e,t)=>n.push(`${t===0?a:o}${e}`))}),n.join(`
3
- `)}function v(e,t){let n=[];return e&&n.push({label:`hint`,value:e}),t&&n.push({label:`docs`,value:`https://workflow-sdk.dev/err/${t}`}),n}const y={NODE_JS_MODULE_IN_WORKFLOW:`node-js-module-in-workflow`,START_INVALID_WORKFLOW_FUNCTION:`start-invalid-workflow-function`,SERIALIZATION_FAILED:`serialization-failed`,WEBHOOK_INVALID_RESPOND_WITH_VALUE:`webhook-invalid-respond-with-value`,WEBHOOK_RESPONSE_NOT_SENT:`webhook-response-not-sent`,FETCH_IN_WORKFLOW_FUNCTION:`fetch-in-workflow`,TIMEOUT_FUNCTIONS_IN_WORKFLOW:`timeout-in-workflow`,HOOK_CONFLICT:`hook-conflict`,CORRUPTED_EVENT_LOG:`corrupted-event-log`,STEP_NOT_REGISTERED:`step-not-registered`,WORKFLOW_NOT_REGISTERED:`workflow-not-registered`};var b=class extends Error{cause;constructor(e,t){let n=_(e,v(void 0,t?.slug));super(n,{cause:t?.cause}),t?.cause!==void 0&&(this.cause=t.cause),t?.cause instanceof Error&&(this.stack=`${this.stack}\nCaused by: ${t.cause.stack}`)}static is(e){return g(e)&&e.name===`WorkflowError`}},x=class extends b{status;code;url;retryAfter;constructor(e,t){super(e,{cause:t?.cause}),this.name=`WorkflowWorldError`,this.status=t?.status,this.code=t?.code,this.url=t?.url,this.retryAfter=t?.retryAfter}static is(e){return g(e)&&e.name===`WorkflowWorldError`}},S=class extends b{runId;errorCode;constructor(e,t,n={}){let r=t instanceof Error?t.message:typeof t==`string`?t:t&&typeof t==`object`&&`message`in t?String(t.message):`Unknown error`;super(`Workflow run "${e}" failed: ${r}`,{cause:t}),this.name=`WorkflowRunFailedError`,this.runId=e,n.errorCode!==void 0&&(this.errorCode=n.errorCode)}static is(e){return g(e)&&e.name===`WorkflowRunFailedError`}},C=class extends b{runId;status;constructor(e,t){super(`Workflow run "${e}" has not completed`,{}),this.name=`WorkflowRunNotCompletedError`,this.runId=e,this.status=t}static is(e){return g(e)&&e.name===`WorkflowRunNotCompletedError`}},w=class extends b{constructor(e,t){super(e,{...t}),this.name=`WorkflowRuntimeError`}static is(e){return g(e)&&e.name===`WorkflowRuntimeError`}},T=class extends b{hint;constructor(e,t){let n=_(e,v(t?.hint,void 0));super(n,{cause:t?.cause}),this.name=`WorkflowBuildError`,this.hint=t?.hint}static is(e){return g(e)&&e.name===`WorkflowBuildError`}},E=class extends b{hint;fatal=!0;constructor(e,t){let n=_(e,v(t?.hint,void 0));super(n,{cause:t?.cause}),this.name=`SerializationError`,this.hint=t?.hint}static is(e){return g(e)&&e.name===`SerializationError`}},D=class extends w{stepName;constructor(e){super(`Step "${e}" is not registered in the current deployment. This usually indicates a build or bundling issue that caused the step to not be included in the deployment.`,{slug:y.STEP_NOT_REGISTERED}),this.name=`StepNotRegisteredError`,this.stepName=e}static is(e){return g(e)&&e.name===`StepNotRegisteredError`}},O=class extends w{workflowName;constructor(e){super(`Workflow "${e}" is not registered in the current deployment. This usually means a run was started against a deployment that does not have this workflow, or there was a build/bundling issue.`,{slug:y.WORKFLOW_NOT_REGISTERED}),this.name=`WorkflowNotRegisteredError`,this.workflowName=e}static is(e){return g(e)&&e.name===`WorkflowNotRegisteredError`}},k=class extends b{runId;constructor(e){super(`Workflow run "${e}" not found`,{}),this.name=`WorkflowRunNotFoundError`,this.runId=e}static is(e){return g(e)&&e.name===`WorkflowRunNotFoundError`}},A=class extends b{token;constructor(e){super(`Hook token "${e}" is already in use by another workflow`,{slug:y.HOOK_CONFLICT}),this.name=`HookConflictError`,this.token=e}static is(e){return g(e)&&e.name===`HookConflictError`}},j=class extends b{token;constructor(e){super(`Hook not found`,{}),this.name=`HookNotFoundError`,this.token=e}static is(e){return g(e)&&e.name===`HookNotFoundError`}},M=class extends x{constructor(e){super(e),this.name=`EntityConflictError`}static is(e){return g(e)&&e.name===`EntityConflictError`}},N=class extends x{constructor(e){super(e),this.name=`RunExpiredError`}static is(e){return g(e)&&e.name===`RunExpiredError`}},P=class extends x{constructor(e,t){super(e,{retryAfter:t?.retryAfter}),this.name=`TooEarlyError`}static is(e){return g(e)&&e.name===`TooEarlyError`}},F=class extends x{retryAfter;constructor(e,t){super(e),this.name=`ThrottleError`,this.retryAfter=t?.retryAfter}static is(e){return g(e)&&e.name===`ThrottleError`}},I=class extends b{runId;constructor(e){super(`Workflow run "${e}" cancelled`,{}),this.name=`WorkflowRunCancelledError`,this.runId=e}static is(e){return g(e)&&e.name===`WorkflowRunCancelledError`}},L=class extends b{runSpecVersion;worldSpecVersion;constructor(e,t){super(`Run requires spec version ${e}, but world supports version ${t}. Please upgrade 'workflow' package.`),this.name=`RunNotSupportedError`,this.runSpecVersion=e,this.worldSpecVersion=t}static is(e){return g(e)&&e.name===`RunNotSupportedError`}},R=class extends Error{fatal=!0;constructor(e){super(e),this.name=`FatalError`}static is(e){return g(e)?e.name===`FatalError`?!0:e.fatal===!0:!1}},z=class extends Error{retryAfter;constructor(e,t={}){super(e),this.name=`RetryableError`,t.retryAfter===void 0?this.retryAfter=new Date(Date.now()+1e3):this.retryAfter=f(t.retryAfter)}static is(e){return g(e)&&e.name===`RetryableError`}};const B="Your current vercel account does not have access to this resource. Use `vercel login` or `vercel switch` to ensure you are linked to the right account.",V=Symbol.for(`@workflow/errors//FatalError`),H=Symbol.for(`@workflow/errors//RetryableError`);typeof globalThis<`u`&&(Object.hasOwn(globalThis,V)||Object.defineProperty(globalThis,V,{value:R,writable:!1,enumerable:!1,configurable:!1}),Object.hasOwn(globalThis,H)||Object.defineProperty(globalThis,H,{value:z,writable:!1,enumerable:!1,configurable:!1}));export{s as A,h as C,u as D,f as E,i as M,n as N,l as O,x as S,p as T,I as _,j as a,k as b,L as c,F as d,P as f,O as g,b as h,A as i,a as j,o as k,E as l,T as m,M as n,z as o,B as p,R as r,N as s,y as t,D as u,S as v,m as w,w as x,C as y};
3
+ `)}function v(e,t){let n=[];return e&&n.push({label:`hint`,value:e}),t&&n.push({label:`docs`,value:`https://workflow-sdk.dev/err/${t}`}),n}const y={NODE_JS_MODULE_IN_WORKFLOW:`node-js-module-in-workflow`,START_INVALID_WORKFLOW_FUNCTION:`start-invalid-workflow-function`,SERIALIZATION_FAILED:`serialization-failed`,WEBHOOK_INVALID_RESPOND_WITH_VALUE:`webhook-invalid-respond-with-value`,WEBHOOK_RESPONSE_NOT_SENT:`webhook-response-not-sent`,FETCH_IN_WORKFLOW_FUNCTION:`fetch-in-workflow`,TIMEOUT_FUNCTIONS_IN_WORKFLOW:`timeout-in-workflow`,HOOK_CONFLICT:`hook-conflict`,CORRUPTED_EVENT_LOG:`corrupted-event-log`,STEP_NOT_REGISTERED:`step-not-registered`,WORKFLOW_NOT_REGISTERED:`workflow-not-registered`};var b=class extends Error{cause;constructor(e,t){let n=_(e,v(void 0,t?.slug));super(n,{cause:t?.cause}),t?.cause!==void 0&&(this.cause=t.cause),t?.cause instanceof Error&&(this.stack=`${this.stack}\nCaused by: ${t.cause.stack}`)}static is(e){return g(e)&&e.name===`WorkflowError`}},x=class extends b{status;code;url;retryAfter;constructor(e,t){super(e,{cause:t?.cause}),this.name=`WorkflowWorldError`,this.status=t?.status,this.code=t?.code,this.url=t?.url,this.retryAfter=t?.retryAfter}static is(e){return g(e)&&e.name===`WorkflowWorldError`}},S=class extends b{runId;errorCode;constructor(e,t,n={}){let r=t instanceof Error?t.message:typeof t==`string`?t:t&&typeof t==`object`&&`message`in t?String(t.message):`Unknown error`;super(`Workflow run "${e}" failed: ${r}`,{cause:t}),this.name=`WorkflowRunFailedError`,this.runId=e,n.errorCode!==void 0&&(this.errorCode=n.errorCode)}static is(e){return g(e)&&e.name===`WorkflowRunFailedError`}},C=class extends b{runId;status;constructor(e,t){super(`Workflow run "${e}" has not completed`,{}),this.name=`WorkflowRunNotCompletedError`,this.runId=e,this.status=t}static is(e){return g(e)&&e.name===`WorkflowRunNotCompletedError`}},w=class extends b{constructor(e,t){super(e,{...t}),this.name=`WorkflowRuntimeError`}static is(e){return g(e)&&e.name===`WorkflowRuntimeError`}},T=class extends w{constructor(e,t){super(e,{...t,slug:y.CORRUPTED_EVENT_LOG}),this.name=`CorruptedEventLogError`}static is(e){return g(e)&&e.name===`CorruptedEventLogError`}},E=class extends b{hint;constructor(e,t){let n=_(e,v(t?.hint,void 0));super(n,{cause:t?.cause}),this.name=`WorkflowBuildError`,this.hint=t?.hint}static is(e){return g(e)&&e.name===`WorkflowBuildError`}},D=class extends b{hint;fatal=!0;constructor(e,t){let n=_(e,v(t?.hint,void 0));super(n,{cause:t?.cause}),this.name=`SerializationError`,this.hint=t?.hint}static is(e){return g(e)&&e.name===`SerializationError`}},O=class extends w{stepName;constructor(e){super(`Step "${e}" is not registered in the current deployment. This usually indicates a build or bundling issue that caused the step to not be included in the deployment.`,{slug:y.STEP_NOT_REGISTERED}),this.name=`StepNotRegisteredError`,this.stepName=e}static is(e){return g(e)&&e.name===`StepNotRegisteredError`}},k=class extends w{workflowName;constructor(e){super(`Workflow "${e}" is not registered in the current deployment. This usually means a run was started against a deployment that does not have this workflow, or there was a build/bundling issue.`,{slug:y.WORKFLOW_NOT_REGISTERED}),this.name=`WorkflowNotRegisteredError`,this.workflowName=e}static is(e){return g(e)&&e.name===`WorkflowNotRegisteredError`}},A=class extends b{runId;constructor(e){super(`Workflow run "${e}" not found`,{}),this.name=`WorkflowRunNotFoundError`,this.runId=e}static is(e){return g(e)&&e.name===`WorkflowRunNotFoundError`}},j=class extends b{token;conflictingRunId;constructor(e,t){super(`Hook token "${e}" is already in use by another workflow${t?` (run "${t}")`:``}`,{slug:y.HOOK_CONFLICT}),this.name=`HookConflictError`,this.token=e,t!==void 0&&(this.conflictingRunId=t)}static is(e){return g(e)&&e.name===`HookConflictError`}},M=class extends b{token;constructor(e){super(`Hook not found`,{}),this.name=`HookNotFoundError`,this.token=e}static is(e){return g(e)&&e.name===`HookNotFoundError`}},N=class extends x{constructor(e){super(e),this.name=`EntityConflictError`}static is(e){return g(e)&&e.name===`EntityConflictError`}},P=class extends x{constructor(e){super(e),this.name=`RunExpiredError`}static is(e){return g(e)&&e.name===`RunExpiredError`}},F=class extends x{constructor(e,t){super(e,{retryAfter:t?.retryAfter}),this.name=`TooEarlyError`}static is(e){return g(e)&&e.name===`TooEarlyError`}},I=class extends x{retryAfter;constructor(e,t){super(e),this.name=`ThrottleError`,this.retryAfter=t?.retryAfter}static is(e){return g(e)&&e.name===`ThrottleError`}},L=class extends b{runId;constructor(e){super(`Workflow run "${e}" cancelled`,{}),this.name=`WorkflowRunCancelledError`,this.runId=e}static is(e){return g(e)&&e.name===`WorkflowRunCancelledError`}},R=class extends b{runSpecVersion;worldSpecVersion;constructor(e,t){super(`Run requires spec version ${e}, but world supports version ${t}. Please upgrade 'workflow' package.`),this.name=`RunNotSupportedError`,this.runSpecVersion=e,this.worldSpecVersion=t}static is(e){return g(e)&&e.name===`RunNotSupportedError`}},z=class extends Error{fatal=!0;constructor(e){super(e),this.name=`FatalError`}static is(e){return g(e)?e.name===`FatalError`?!0:e.fatal===!0:!1}},B=class extends Error{retryAfter;constructor(e,t={}){super(e),this.name=`RetryableError`,t.retryAfter===void 0?this.retryAfter=new Date(Date.now()+1e3):this.retryAfter=f(t.retryAfter)}static is(e){return g(e)&&e.name===`RetryableError`}};const V="Your current vercel account does not have access to this resource. Use `vercel login` or `vercel switch` to ensure you are linked to the right account.",H=Symbol.for(`@workflow/errors//FatalError`),U=Symbol.for(`@workflow/errors//RetryableError`),W=Symbol.for(`@workflow/errors//HookConflictError`);typeof globalThis<`u`&&(Object.hasOwn(globalThis,H)||Object.defineProperty(globalThis,H,{value:z,writable:!1,enumerable:!1,configurable:!1}),Object.hasOwn(globalThis,U)||Object.defineProperty(globalThis,U,{value:B,writable:!1,enumerable:!1,configurable:!1}),Object.hasOwn(globalThis,W)||Object.defineProperty(globalThis,W,{value:j,writable:!1,enumerable:!1,configurable:!1}));export{o as A,x as C,f as D,p as E,a as M,i as N,u as O,n as P,w as S,m as T,k as _,j as a,C as b,P as c,O as d,I as f,b as g,E as h,z as i,s as j,l as k,R as l,V as m,y as n,M as o,F as p,N as r,B as s,T as t,D as u,L as v,h as w,A as x,S as y};