eve 0.48.0 → 0.49.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (189) hide show
  1. package/CHANGELOG.md +15 -0
  2. package/dist/src/channel/channel-address.js +1 -1
  3. package/dist/src/channel/types.d.ts +10 -0
  4. package/dist/src/cli/commands/registry-metadata.d.ts +30 -0
  5. package/dist/src/cli/commands/registry-metadata.js +1 -1
  6. package/dist/src/cli/commands/registry-package.d.ts +6 -0
  7. package/dist/src/cli/commands/registry-package.js +1 -1
  8. package/dist/src/cli/commands/registry-pnpm-build-policy-flow.d.ts +30 -0
  9. package/dist/src/cli/commands/registry-pnpm-build-policy-flow.js +1 -0
  10. package/dist/src/cli/commands/registry-pnpm-build-policy.d.ts +12 -0
  11. package/dist/src/cli/commands/registry-pnpm-build-policy.js +6 -0
  12. package/dist/src/cli/commands/registry-recovery.d.ts +4 -0
  13. package/dist/src/cli/commands/registry-recovery.js +1 -1
  14. package/dist/src/cli/commands/registry.d.ts +1 -1
  15. package/dist/src/cli/commands/registry.js +1 -1
  16. package/dist/src/cli/dev/tui/setup-commands.js +2 -2
  17. package/dist/src/compiled/.vendor-stamp.json +7 -7
  18. package/dist/src/compiled/@workflow/core/attribute-changes.d.ts +2 -4
  19. package/dist/src/compiled/@workflow/core/capabilities.d.ts +10 -9
  20. package/dist/src/compiled/@workflow/core/capture-stack.d.ts +1 -1
  21. package/dist/src/compiled/@workflow/core/class-serialization.d.ts +8 -8
  22. package/dist/src/compiled/@workflow/core/context-violation-error.d.ts +5 -5
  23. package/dist/src/compiled/@workflow/core/create-hook.d.ts +2 -2
  24. package/dist/src/compiled/@workflow/core/describe-error.d.ts +7 -7
  25. package/dist/src/compiled/@workflow/core/encryption.d.ts +5 -5
  26. package/dist/src/compiled/@workflow/core/events-consumer.d.ts +49 -14
  27. package/dist/src/compiled/@workflow/core/flushable-stream.d.ts +4 -4
  28. package/dist/src/compiled/@workflow/core/global.d.ts +4 -2
  29. package/dist/src/compiled/@workflow/core/index.d.ts +1 -1
  30. package/dist/src/compiled/@workflow/core/index.js +2 -2
  31. package/dist/src/compiled/@workflow/core/log-format.d.ts +2 -2
  32. package/dist/src/compiled/@workflow/core/private.d.ts +40 -78
  33. package/dist/src/compiled/@workflow/core/private.js +1 -1
  34. package/dist/src/compiled/@workflow/core/replay-payload-cache.d.ts +13 -17
  35. package/dist/src/compiled/@workflow/core/runtime/compute-instance.d.ts +4 -3
  36. package/dist/src/compiled/@workflow/core/runtime/constants.d.ts +27 -27
  37. package/dist/src/compiled/@workflow/core/runtime/count-step-started-events.d.ts +7 -7
  38. package/dist/src/compiled/@workflow/core/runtime/deployment-guard.d.ts +7 -7
  39. package/dist/src/compiled/@workflow/core/runtime/get-port-lazy.d.ts +2 -2
  40. package/dist/src/compiled/@workflow/core/runtime/get-world-lazy.d.ts +2 -2
  41. package/dist/src/compiled/@workflow/core/runtime/helpers.d.ts +30 -49
  42. package/dist/src/compiled/@workflow/core/runtime/quickjs-entrypoint.d.ts +21 -10
  43. package/dist/src/compiled/@workflow/core/runtime/quickjs-runtime.d.ts +31 -15
  44. package/dist/src/compiled/@workflow/core/runtime/quickjs-serde.d.ts +10 -10
  45. package/dist/src/compiled/@workflow/core/runtime/replay-budget.d.ts +4 -4
  46. package/dist/src/compiled/@workflow/core/runtime/replay-recovery-reporter.d.ts +1 -1
  47. package/dist/src/compiled/@workflow/core/runtime/resume-hook.d.ts +20 -12
  48. package/dist/src/compiled/@workflow/core/runtime/resume-latency.d.ts +37 -30
  49. package/dist/src/compiled/@workflow/core/runtime/run-id-time.d.ts +2 -2
  50. package/dist/src/compiled/@workflow/core/runtime/run.d.ts +22 -5
  51. package/dist/src/compiled/@workflow/core/runtime/runs.d.ts +4 -4
  52. package/dist/src/compiled/@workflow/core/runtime/start.d.ts +3 -3
  53. package/dist/src/compiled/@workflow/core/runtime/step-executor.d.ts +14 -14
  54. package/dist/src/compiled/@workflow/core/runtime/step-latency.d.ts +42 -25
  55. package/dist/src/compiled/@workflow/core/runtime/step-ownership.d.ts +6 -6
  56. package/dist/src/compiled/@workflow/core/runtime/step-single-flight.d.ts +1 -1
  57. package/dist/src/compiled/@workflow/core/runtime/suspension-handler.d.ts +38 -24
  58. package/dist/src/compiled/@workflow/core/runtime/unserializable-step.d.ts +34 -0
  59. package/dist/src/compiled/@workflow/core/runtime/vm-mode.d.ts +2 -2
  60. package/dist/src/compiled/@workflow/core/runtime/wait-continuation.d.ts +31 -9
  61. package/dist/src/compiled/@workflow/core/runtime/wait-until.d.ts +1 -1
  62. package/dist/src/compiled/@workflow/core/runtime/world-compatibility.d.ts +20 -9
  63. package/dist/src/compiled/@workflow/core/runtime/world-init.d.ts +5 -5
  64. package/dist/src/compiled/@workflow/core/runtime.js +3 -3
  65. package/dist/src/compiled/@workflow/core/sealed-box.d.ts +7 -7
  66. package/dist/src/compiled/@workflow/core/serialization/codec-devalue-vm.d.ts +1 -1
  67. package/dist/src/compiled/@workflow/core/serialization/codec-devalue.d.ts +1 -1
  68. package/dist/src/compiled/@workflow/core/serialization/codec.d.ts +4 -4
  69. package/dist/src/compiled/@workflow/core/serialization/compression.d.ts +12 -11
  70. package/dist/src/compiled/@workflow/core/serialization/encryption.d.ts +7 -7
  71. package/dist/src/compiled/@workflow/core/serialization/format.d.ts +6 -6
  72. package/dist/src/compiled/@workflow/core/serialization/hardened.d.ts +23 -22
  73. package/dist/src/compiled/@workflow/core/serialization/index.d.ts +1 -1
  74. package/dist/src/compiled/@workflow/core/serialization/reducers/class-vm.d.ts +1 -1
  75. package/dist/src/compiled/@workflow/core/serialization/reducers/step-function-vm.d.ts +1 -1
  76. package/dist/src/compiled/@workflow/core/serialization/types.d.ts +5 -5
  77. package/dist/src/compiled/@workflow/core/serialization/workflow-vm.d.ts +1 -1
  78. package/dist/src/compiled/@workflow/core/serialization-format.d.ts +11 -11
  79. package/dist/src/compiled/@workflow/core/serialization.d.ts +18 -19
  80. package/dist/src/compiled/@workflow/core/source-map.d.ts +1 -1
  81. package/dist/src/compiled/@workflow/core/step/context-storage.d.ts +5 -5
  82. package/dist/src/compiled/@workflow/core/step/writable-stream.d.ts +3 -3
  83. package/dist/src/compiled/@workflow/core/symbols.d.ts +2 -2
  84. package/dist/src/compiled/@workflow/core/telemetry/semantic-conventions.d.ts +71 -20
  85. package/dist/src/compiled/@workflow/core/telemetry.d.ts +15 -3
  86. package/dist/src/compiled/@workflow/core/version.d.ts +1 -1
  87. package/dist/src/compiled/@workflow/core/vm/script-cache.d.ts +9 -11
  88. package/dist/src/compiled/@workflow/core/workflow/abort-controller.d.ts +1 -1
  89. package/dist/src/compiled/@workflow/core/workflow/set-attributes.d.ts +1 -1
  90. package/dist/src/compiled/@workflow/core/workflow/world-init-stub.d.ts +1 -1
  91. package/dist/src/compiled/@workflow/core/workflow.js +1 -1
  92. package/dist/src/compiled/@workflow/errors/index.d.ts +18 -18
  93. package/dist/src/compiled/@workflow/errors/index.js +1 -1
  94. package/dist/src/compiled/@workflow/world/analytics.d.ts +3 -2
  95. package/dist/src/compiled/@workflow/world/attributes-validation.d.ts +28 -0
  96. package/dist/src/compiled/@workflow/world/attributes.d.ts +8 -107
  97. package/dist/src/compiled/@workflow/world/env-config.d.ts +5 -5
  98. package/dist/src/compiled/@workflow/world/event-metadata.d.ts +132 -0
  99. package/dist/src/compiled/@workflow/world/events.d.ts +42 -96
  100. package/dist/src/compiled/@workflow/world/hooks.d.ts +12 -11
  101. package/dist/src/compiled/@workflow/world/index.d.ts +3 -3
  102. package/dist/src/compiled/@workflow/world/interfaces.d.ts +94 -39
  103. package/dist/src/compiled/@workflow/world/queue.d.ts +29 -22
  104. package/dist/src/compiled/@workflow/world/runs.d.ts +20 -0
  105. package/dist/src/compiled/@workflow/world/slot-identity.d.ts +3 -3
  106. package/dist/src/compiled/@workflow/world/spec-version.d.ts +82 -15
  107. package/dist/src/compiled/@workflow/world/ulid.d.ts +2 -2
  108. package/dist/src/compiled/@workflow/world-local/index.js +5 -5
  109. package/dist/src/compiled/@workflow/world-vercel/index.js +12 -12
  110. package/dist/src/compiled/_chunks/workflow/{attribute-changes-DXbpwBdw.js → attribute-changes-BwAadFfB.js} +3 -3
  111. package/dist/src/compiled/_chunks/workflow/debug-log-CVPstO1D.js +1 -0
  112. package/dist/src/compiled/_chunks/workflow/dist-CgbVZs5l.js +40 -0
  113. package/dist/src/compiled/_chunks/workflow/dist-DjojkP5e.js +3 -0
  114. package/dist/src/compiled/_chunks/workflow/frames-CZ9eHShe.js +3 -0
  115. package/dist/src/compiled/_chunks/workflow/global-singleton-BNinwFrL.js +1 -0
  116. package/dist/src/compiled/_chunks/workflow/private-CZFMABEf.js +1 -0
  117. package/dist/src/compiled/_chunks/workflow/resume-hook-BToMtPbH.js +1 -0
  118. package/dist/src/compiled/_chunks/workflow/run-DzyAoGh4.js +1 -0
  119. package/dist/src/compiled/_chunks/workflow/sleep-3_A5uOp-.js +1 -0
  120. package/dist/src/compiled/_chunks/workflow/undici-DfxNX5og.js +95 -0
  121. package/dist/src/compiled/_chunks/workflow/wait-until-BtySPYD0.js +15 -0
  122. package/dist/src/compiled/_chunks/workflow/ws-transport-PnVVxT0R.js +1 -0
  123. package/dist/src/eve-channel/index.js +1 -1
  124. package/dist/src/execution/agent-handle-dispatch.js +1 -1
  125. package/dist/src/execution/continuation-conflict-step.d.ts +10 -0
  126. package/dist/src/execution/continuation-conflict-step.js +1 -0
  127. package/dist/src/execution/delegated-parent-notification.js +1 -1
  128. package/dist/src/execution/dispatch-runtime-actions-shared.d.ts +7 -29
  129. package/dist/src/execution/dispatch-runtime-actions-shared.js +1 -1
  130. package/dist/src/execution/dispatch-runtime-actions-start.d.ts +33 -0
  131. package/dist/src/execution/dispatch-runtime-actions-start.js +1 -0
  132. package/dist/src/execution/dispatch-runtime-actions-step.js +1 -1
  133. package/dist/src/execution/dispatch-turn-step.js +1 -1
  134. package/dist/src/execution/dynamic-connections.js +1 -1
  135. package/dist/src/execution/inline-turn.js +1 -1
  136. package/dist/src/execution/next-driver-action.d.ts +5 -4
  137. package/dist/src/execution/proxied-deliver-step.js +1 -1
  138. package/dist/src/execution/runtime-errors.d.ts +0 -12
  139. package/dist/src/execution/runtime-errors.js +1 -1
  140. package/dist/src/execution/session-timeout-steps.js +1 -1
  141. package/dist/src/execution/settle-cancelled-turn-step.js +1 -1
  142. package/dist/src/execution/stable-workflow-names.d.ts +2 -2
  143. package/dist/src/execution/subagent-start-local.js +1 -1
  144. package/dist/src/execution/tasks/parent/dispatch-task-step.js +1 -1
  145. package/dist/src/execution/tasks/parent/run-parent.js +1 -1
  146. package/dist/src/execution/tasks/parent/tool-execution.js +1 -1
  147. package/dist/src/execution/tool-run/start.js +1 -1
  148. package/dist/src/execution/tools/subagent/local.js +1 -1
  149. package/dist/src/execution/turn-workflow.js +1 -1
  150. package/dist/src/execution/workflow-entry.d.ts +5 -1
  151. package/dist/src/execution/workflow-entry.js +1 -1
  152. package/dist/src/execution/workflow-runtime.d.ts +12 -12
  153. package/dist/src/execution/workflow-runtime.js +1 -1
  154. package/dist/src/execution/workflow-steps.js +1 -1
  155. package/dist/src/harness/tool-loop.js +1 -1
  156. package/dist/src/internal/application/package.js +1 -1
  157. package/dist/src/internal/workflow/development-world-client.js +1 -1
  158. package/dist/src/packages/eve-catalog/src/index.js +1 -1
  159. package/dist/src/public/channels/slack/slackChannel.d.ts +7 -1
  160. package/dist/src/public/channels/slack/slackChannel.js +1 -1
  161. package/dist/src/setup/flows/registry.js +1 -1
  162. package/dist/src/setup/scaffold/connections/catalog.js +1 -1
  163. package/dist/src/setup/scaffold/create/project.js +1 -1
  164. package/docs/channels/custom.mdx +4 -0
  165. package/docs/channels/eve.mdx +12 -8
  166. package/docs/channels/mcp.mdx +4 -1
  167. package/docs/guides/instrumentation.md +1 -1
  168. package/docs/install-integrations.mdx +2 -0
  169. package/docs/instructions.mdx +1 -1
  170. package/docs/memory/custom-provider.md +214 -0
  171. package/docs/memory/file.md +129 -0
  172. package/docs/memory/meta.json +5 -0
  173. package/docs/memory/overview.mdx +282 -0
  174. package/docs/patterns/multi-tenant-memory.md +12 -20
  175. package/package.json +8 -8
  176. package/dist/src/compiled/_chunks/workflow/dist-CqvWKNQv.js +0 -3
  177. package/dist/src/compiled/_chunks/workflow/dist-Dk0aQqFO.js +0 -40
  178. package/dist/src/compiled/_chunks/workflow/dist-DpYyXbJv.js +0 -1
  179. package/dist/src/compiled/_chunks/workflow/env-config-L94XftKz.js +0 -1
  180. package/dist/src/compiled/_chunks/workflow/frames-Dl2Hcma4.js +0 -3
  181. package/dist/src/compiled/_chunks/workflow/private-CuQ4HTFC.js +0 -1
  182. package/dist/src/compiled/_chunks/workflow/resume-hook-E-Nkx8q_.js +0 -1
  183. package/dist/src/compiled/_chunks/workflow/run-cIeex2KF.js +0 -1
  184. package/dist/src/compiled/_chunks/workflow/sleep-CxFsdxB_.js +0 -1
  185. package/dist/src/compiled/_chunks/workflow/spec-version-DBUVfF_R.js +0 -1
  186. package/dist/src/compiled/_chunks/workflow/undici-DznrXKcM.js +0 -95
  187. package/dist/src/compiled/_chunks/workflow/wait-until-BZHmJCAW.js +0 -15
  188. package/dist/src/compiled/_chunks/workflow/ws-transport-Ct6yyRWZ.js +0 -1
  189. package/docs/memory.md +0 -408
@@ -54,7 +54,7 @@ export declare class WorkflowError extends Error {
54
54
  * This is the catch-all error for world implementations. Specific,
55
55
  * well-known failure modes have dedicated error types (e.g.
56
56
  * EntityConflictError, RunExpiredError, ThrottleError). This error
57
- * covers everything else — validation failures, missing entities
57
+ * covers everything else: validation failures, missing entities
58
58
  * without a dedicated type, or unexpected HTTP errors from world-vercel.
59
59
  */
60
60
  export declare class WorkflowWorldError extends WorkflowError {
@@ -184,7 +184,7 @@ export declare class MaxEventsExceededError extends WorkflowError {
184
184
  * failure without poking through stacks.
185
185
  */
186
186
  export interface RuntimeDecryptionErrorContext {
187
- /** The operation that failed — useful to tell encrypt vs decrypt apart. */
187
+ /** The operation that failed, useful to tell encrypt vs decrypt apart. */
188
188
  operation?: 'encrypt' | 'decrypt';
189
189
  /** Byte length of the input payload at the time of the failure. */
190
190
  byteLength?: number;
@@ -200,7 +200,7 @@ export interface RuntimeDecryptionErrorContext {
200
200
  * Thrown when the SDK's built-in AES-GCM encryption layer fails to encrypt
201
201
  * or decrypt a workflow payload.
202
202
  *
203
- * This is an internal SDK failure — user code never invokes the SDK's
203
+ * This is an internal SDK failure: user code never invokes the SDK's
204
204
  * encryption primitives directly. Common causes:
205
205
  *
206
206
  * - A ciphertext / auth tag mismatch, typically surfaced as the native Web
@@ -235,11 +235,11 @@ interface WorkflowBuildErrorOptions extends ErrorOptions {
235
235
  * discovery, bundler integration) fails in a way the user can act on.
236
236
  *
237
237
  * This is distinct from `WorkflowRuntimeError` (which is raised at runtime
238
- * by the workflow engine) — `WorkflowBuildError` fires during `pnpm build`,
238
+ * by the workflow engine): `WorkflowBuildError` fires during `pnpm build`,
239
239
  * `next build`, or equivalent, before any workflow has started executing.
240
240
  *
241
241
  * Prefer attaching a short, actionable `hint` (e.g. `run \`pnpm install workflow\``)
242
- * as plain text — the rendering layer is responsible for any styling or
242
+ * as plain text; the rendering layer is responsible for any styling or
243
243
  * "hint:" label. Keeping `hint` plain keeps it useful in non-TTY contexts
244
244
  * (CI logs, structured error serialization) where ANSI escapes are noise.
245
245
  */
@@ -266,13 +266,13 @@ interface SerializationErrorOptions extends ErrorOptions {
266
266
  * returning from a step.
267
267
  *
268
268
  * Internal invariants (corrupted buffers, unknown format bytes) should use
269
- * `WorkflowRuntimeError` instead — this class is scoped to things the user
269
+ * `WorkflowRuntimeError` instead; this class is scoped to things the user
270
270
  * can fix in their own code.
271
271
  */
272
272
  export declare class SerializationError extends WorkflowError {
273
273
  readonly hint?: string;
274
274
  /**
275
- * Serialization errors are deterministic — if a step returns a non-POJO,
275
+ * Serialization errors are deterministic: if a step returns a non-POJO,
276
276
  * replaying the step will always produce the same non-serializable value.
277
277
  * Retrying is guaranteed to fail, so these errors are surfaced as fatal
278
278
  * and skip the step-retry loop. `FatalError.is()` recognizes any error
@@ -286,7 +286,7 @@ export declare class SerializationError extends WorkflowError {
286
286
  /**
287
287
  * Thrown when a step function is not registered in the current deployment.
288
288
  *
289
- * This is an infrastructure error — not a user code error. It typically means
289
+ * This is an infrastructure error, not a user code error. It typically means
290
290
  * something went wrong with the bundling/build tooling that caused the step
291
291
  * to not get built correctly.
292
292
  *
@@ -301,7 +301,7 @@ export declare class StepNotRegisteredError extends WorkflowRuntimeError {
301
301
  /**
302
302
  * Thrown when a workflow function is not registered in the current deployment.
303
303
  *
304
- * This is an infrastructure error — not a user code error. It typically means:
304
+ * This is an infrastructure error, not a user code error. It typically means:
305
305
  * - A run was started against a deployment that does not have the workflow
306
306
  * (e.g., the workflow was renamed or moved and a new run targeted the latest deployment)
307
307
  * - Something went wrong with the bundling/build tooling that caused the workflow
@@ -343,7 +343,7 @@ export declare class WorkflowDeploymentMismatchError extends WorkflowRuntimeErro
343
343
  * This error occurs when you call methods on a run object (e.g. `run.status`,
344
344
  * `run.cancel()`, `run.returnValue`) but the underlying run ID does not match
345
345
  * any known workflow run. Note that `getRun(id)` itself is synchronous and will
346
- * not throw — this error is raised when subsequent operations discover the run
346
+ * not throw; this error is raised when subsequent operations discover the run
347
347
  * is missing.
348
348
  *
349
349
  * Use the static `WorkflowRunNotFoundError.is()` method for type-safe checking
@@ -370,7 +370,7 @@ export declare class WorkflowRunNotFoundError extends WorkflowError {
370
370
  /**
371
371
  * Thrown when a hook token is already in use by another active workflow run.
372
372
  *
373
- * This is a user error — it means the same custom token was passed to
373
+ * This is a user error: it means the same custom token was passed to
374
374
  * `createHook` in two or more concurrent runs. Use a unique token per run
375
375
  * (or omit the token to let the runtime generate one automatically).
376
376
  */
@@ -403,7 +403,7 @@ export declare class HookConflictError extends WorkflowError {
403
403
  * await resumeHook(token, payload);
404
404
  * } catch (error) {
405
405
  * if (HookNotFoundError.is(error)) {
406
- * // Hook doesn't exist — start a new workflow run instead
406
+ * // Hook doesn't exist, so start a new workflow run instead
407
407
  * await startWorkflow("myWorkflow", payload);
408
408
  * }
409
409
  * }
@@ -427,7 +427,7 @@ export declare class EntityConflictError extends WorkflowWorldError {
427
427
  static is(value: unknown): value is EntityConflictError;
428
428
  }
429
429
  /**
430
- * Thrown when a run is no longer available — either because it has been
430
+ * Thrown when a run is no longer available, either because it has been
431
431
  * cleaned up, expired, or already reached a terminal state (completed/failed).
432
432
  *
433
433
  * The workflow runtime handles this error automatically. Users interacting
@@ -484,7 +484,7 @@ export declare class ThrottleError extends WorkflowWorldError {
484
484
  }
485
485
  /**
486
486
  * Thrown when the backend rejects an event creation because the client's
487
- * event-log snapshot is stale — the log the client replayed from is missing
487
+ * event-log snapshot is stale: the log the client replayed from is missing
488
488
  * an event the backend has already recorded (HTTP 412).
489
489
  *
490
490
  * The workflow runtime handles this automatically: it restarts the replay from
@@ -500,7 +500,7 @@ export declare class ThrottleError extends WorkflowWorldError {
500
500
  * for the whole discrepancy the rejection reported or be omitted entirely; a
501
501
  * client that receives nothing does the authoritative full reload, which is
502
502
  * always correct. Typed `unknown` because this package cannot depend
503
- * on the event type — consumers narrow it themselves and must treat a
503
+ * on the event type; consumers narrow it themselves and must treat a
504
504
  * missing or malformed value as "no detail" (a full reload is always
505
505
  * correct).
506
506
  */
@@ -580,9 +580,9 @@ export declare class RunNotSupportedError extends WorkflowError {
580
580
  * Any error can opt into the non-retry behavior by setting a `fatal: true`
581
581
  * own property. This is how structured error classes that aren't direct
582
582
  * `FatalError` subclasses (e.g. context-violation errors) signal to the
583
- * step executor that retrying will never help — the user's code is calling
584
- * a workflow-only API from the wrong context, or similar — and burning
585
- * retry attempts just produces a wall of duplicated log output.
583
+ * step executor that retrying will never help (the user's code is calling
584
+ * a workflow-only API from the wrong context, or similar) and burning
585
+ * retry attempts produces a wall of duplicated log output.
586
586
  */
587
587
  export declare class FatalError extends Error {
588
588
  fatal: boolean;
@@ -1 +1 @@
1
- import{A as e,C as t,D as n,E as r,O as i,S as a,T as o,_ as s,a as c,b as l,c as u,d,f,g as p,h as m,i as h,k as g,l as _,m as v,n as y,o as b,p as x,r as S,s as C,t as w,u as T,v as E,w as D,x as O,y as k}from"../../_chunks/workflow/dist-CqvWKNQv.js";export{w as CorruptedEventLogError,y as ERROR_SLUGS,S as EntityConflictError,h as FatalError,c as HookConflictError,b as HookNotFoundError,C as MaxEventsExceededError,u as PreconditionFailedError,e as RUN_ERROR_CODES,_ as ReplayDivergenceError,T as RetryableError,d as RunExpiredError,f as RunNotSupportedError,x as RuntimeDecryptionError,v as SerializationError,m as StepNotRegisteredError,p as StreamExpiredError,s as ThrottleError,E as TooEarlyError,k as VERCEL_403_ERROR_MESSAGE,l as WorkflowBuildError,O as WorkflowDeploymentMismatchError,a as WorkflowError,t as WorkflowNotRegisteredError,D as WorkflowRunCancelledError,o as WorkflowRunFailedError,r as WorkflowRunNotCompletedError,n as WorkflowRunNotFoundError,i as WorkflowRuntimeError,g as WorkflowWorldError};
1
+ import{A as e,C as t,D as n,E as r,O as i,S as a,T as o,_ as s,a as c,b as l,c as u,d,f,g as p,h as m,i as h,k as g,l as _,m as v,n as y,o as b,p as x,r as S,s as C,t as w,u as T,v as E,w as D,x as O,y as k}from"../../_chunks/workflow/dist-DjojkP5e.js";export{w as CorruptedEventLogError,y as ERROR_SLUGS,S as EntityConflictError,h as FatalError,c as HookConflictError,b as HookNotFoundError,C as MaxEventsExceededError,u as PreconditionFailedError,e as RUN_ERROR_CODES,_ as ReplayDivergenceError,T as RetryableError,d as RunExpiredError,f as RunNotSupportedError,x as RuntimeDecryptionError,v as SerializationError,m as StepNotRegisteredError,p as StreamExpiredError,s as ThrottleError,E as TooEarlyError,k as VERCEL_403_ERROR_MESSAGE,l as WorkflowBuildError,O as WorkflowDeploymentMismatchError,a as WorkflowError,t as WorkflowNotRegisteredError,D as WorkflowRunCancelledError,o as WorkflowRunFailedError,r as WorkflowRunNotCompletedError,n as WorkflowRunNotFoundError,i as WorkflowRuntimeError,g as WorkflowWorldError};
@@ -47,6 +47,7 @@ export declare const AnalyticsEventSchema: z.ZodObject<{
47
47
  runId: z.ZodString;
48
48
  eventId: z.ZodString;
49
49
  eventType: z.ZodEnum<{
50
+ noop: "noop";
50
51
  run_created: "run_created";
51
52
  run_started: "run_started";
52
53
  run_completed: "run_completed";
@@ -135,8 +136,8 @@ export interface AnalyticsListRunsParams {
135
136
  /**
136
137
  * Bound the listing to runs active between `startTime` and `endTime`
137
138
  * (ISO 8601 timestamps). Both must be provided together. A bounded window
138
- * lets the backend prune its scan — the ClickHouse-backed Vercel
139
- * implementation is significantly faster with one. Requesting a window
139
+ * lets the backend prune its scan, so the ClickHouse-backed Vercel
140
+ * implementation is faster with one. Requesting a window
140
141
  * older than the plan's observability lookback fails with
141
142
  * `observability-upgrade-required`.
142
143
  */
@@ -0,0 +1,28 @@
1
+ /** A single run-attribute change. `null` removes the key. */
2
+ export interface AttributeChange {
3
+ key: string;
4
+ value: string | null;
5
+ }
6
+ export declare const RESERVED_ATTRIBUTE_KEY_PREFIX = "$";
7
+ export declare const ROOT_RUN_ID_ATTRIBUTE = "$rootRunId";
8
+ export declare const PARENT_RUN_ID_ATTRIBUTE = "$parentRunId";
9
+ export declare const ATTRIBUTE_KEY_MAX_LENGTH = 256;
10
+ export declare const ATTRIBUTE_VALUE_MAX_BYTES = 256;
11
+ export declare const ATTRIBUTE_MAX_PER_RUN = 64;
12
+ /** A validation failure that callers can translate at their API boundary. */
13
+ export declare class AttributeValidationError extends Error {
14
+ constructor(message: string);
15
+ }
16
+ /** Validates constraints that apply across a batch of individually valid changes. */
17
+ export declare function validateAttributeBatchConstraints(changes: AttributeChange[], context?: {
18
+ /** Existing keys make the post-merge count exact. */
19
+ existingKeys?: Iterable<string>;
20
+ }): void;
21
+ export declare function validateAttributeChanges(changes: AttributeChange[], context?: {
22
+ /** Existing keys make the post-merge count exact. */
23
+ existingKeys?: Iterable<string>;
24
+ /** Reserved `$` keys are only available to framework code. */
25
+ allowReservedAttributes?: boolean;
26
+ }): void;
27
+ export declare function applyAttributeChanges(existing: Record<string, string> | undefined, changes: AttributeChange[]): Record<string, string>;
28
+ //# sourceMappingURL=attributes-validation.d.ts.map
@@ -1,117 +1,18 @@
1
- import { z } from '#compiled/zod/index.js';
2
- /**
3
- * Reserved key prefix for system-managed attributes. User code may not set
4
- * keys starting with `$` — those are blocked at validation time so the
5
- * namespace remains available for future system use.
6
- */
7
- export declare const RESERVED_ATTRIBUTE_KEY_PREFIX = "$";
8
- /**
9
- * Reserved attribute keys recording cross-run lineage. `start()` sets these on
10
- * a run created from inside another run: `$rootRunId` is the root of the chain,
11
- * `$parentRunId` the direct parent edge.
12
- */
13
- export declare const ROOT_RUN_ID_ATTRIBUTE = "$rootRunId";
14
- export declare const PARENT_RUN_ID_ATTRIBUTE = "$parentRunId";
15
- /** Max length of an attribute key, in characters. */
16
- export declare const ATTRIBUTE_KEY_MAX_LENGTH = 256;
17
- /** Max length of an attribute value, in bytes (UTF-8). */
18
- export declare const ATTRIBUTE_VALUE_MAX_BYTES = 256;
19
- /** Max number of attributes on a single run (post-merge). */
20
- export declare const ATTRIBUTE_MAX_PER_RUN = 64;
21
- /**
22
- * A single change in an `experimentalSetAttributes` call. `value: null`
23
- * means "remove this key from the run's attributes".
24
- *
25
- * The shape is deliberately the same as the future `attr_set` event's
26
- * `eventData.changes` entries so the SDK and wire format do not change
27
- * when the full attributes feature lands.
28
- */
1
+ import * as z from '#compiled/zod/index.js';
2
+ export * from './attributes-validation.js';
3
+ export declare const AttributeKeySchema: z.ZodString;
4
+ export declare const AttributeValueSchema: z.ZodNullable<z.ZodString>;
5
+ /** Runtime schema for a single run-attribute change. */
29
6
  export declare const AttributeChangeSchema: z.ZodObject<{
30
7
  key: z.ZodString;
31
- value: z.ZodUnion<readonly [z.ZodString, z.ZodNull]>;
8
+ value: z.ZodNullable<z.ZodString>;
32
9
  }, z.core.$strip>;
33
- export type AttributeChange = z.infer<typeof AttributeChangeSchema>;
34
10
  export declare const AttributeChangesSchema: z.ZodArray<z.ZodObject<{
35
11
  key: z.ZodString;
36
- value: z.ZodUnion<readonly [z.ZodString, z.ZodNull]>;
12
+ value: z.ZodNullable<z.ZodString>;
37
13
  }, z.core.$strip>>;
38
- /**
39
- * Result returned by `runs.experimentalSetAttributes` — the post-merge
40
- * snapshot of all attributes on the run. Provided so callers (notably
41
- * `setAttributes` and observability emitters) do not need a follow-up read.
42
- */
14
+ /** The post-merge attribute snapshot returned by a World. */
43
15
  export interface ExperimentalSetAttributesResult {
44
16
  attributes: Record<string, string>;
45
17
  }
46
- export interface AttributeValidationContext {
47
- /**
48
- * Existing attribute keys on the run, used to enforce the per-run
49
- * cap accurately against the post-merge total — an incoming change
50
- * that updates an already-present key contributes zero net adds.
51
- *
52
- * If omitted, the cap check assumes every non-null change is a fresh
53
- * add, which is conservative but still safe (the only false-positive
54
- * shape rejects updates to existing keys at the cap boundary; the
55
- * authoritative server-side check uses the real post-merge size).
56
- */
57
- existingKeys?: Iterable<string>;
58
- /**
59
- * Permit keys that start with the reserved `$` prefix. Default `false`.
60
- *
61
- * The `$` namespace is reserved for framework / library code built on
62
- * top of the workflow SDK (telemetry, agent metadata, etc.). User code
63
- * MUST NOT set it; if a user tries, validation rejects the call so
64
- * accidental conflicts with tooling-owned keys can't slip through.
65
- *
66
- * Set this to `true` only from framework-level code that is aware of
67
- * the namespace conventions in use. Misuse can collide with tooling
68
- * keys and break observability surfaces.
69
- */
70
- allowReservedAttributes?: boolean;
71
- }
72
- export interface AttributeKeyValidationOptions {
73
- /**
74
- * Permit keys that start with the reserved `$` prefix. See the
75
- * `allowReservedAttributes` note on `AttributeValidationContext`.
76
- */
77
- allowReservedAttributes?: boolean;
78
- }
79
- /**
80
- * Thrown when an attribute key or value violates one of the validation
81
- * rules. Use a plain `Error` here so the world layer can decide whether
82
- * to wrap as `FatalError` (SDK) or return a 400 (server endpoint).
83
- */
84
- export declare class AttributeValidationError extends Error {
85
- constructor(message: string);
86
- }
87
- /**
88
- * Validate a single attribute key. Returns an `AttributeValidationError`
89
- * on violation, or `null` if the key is valid. Returning instead of
90
- * throwing lets callers aggregate or wrap the failure as needed.
91
- *
92
- * The reserved `$`-prefix rule is enforced by default; framework code
93
- * may pass `allowReservedAttributes: true` to opt out.
94
- */
95
- export declare function validateAttributeKey(key: string, options?: AttributeKeyValidationOptions): AttributeValidationError | null;
96
- /**
97
- * Validate a single attribute value. `null` represents an unset and is
98
- * always valid. Returns an `AttributeValidationError` on violation or
99
- * `null` if the value is valid.
100
- */
101
- export declare function validateAttributeValue(value: string | null): AttributeValidationError | null;
102
- /**
103
- * Validate a batch of attribute changes. Throws `AttributeValidationError`
104
- * on the first violation found. Pass `existingKeys` (in `context`) so
105
- * the per-run cap check can use the real post-merge total — without it
106
- * the check is conservative and may reject an update to an
107
- * already-present key when the run is at the cap.
108
- */
109
- export declare function validateAttributeChanges(changes: AttributeChange[], context?: AttributeValidationContext): void;
110
- /**
111
- * Apply a batch of validated changes to an existing attribute map. Returns
112
- * a new map; does not mutate the input. The world layer uses this to
113
- * compute the post-merge snapshot when the underlying store cannot do the
114
- * merge in a single atomic operation.
115
- */
116
- export declare function applyAttributeChanges(existing: Record<string, string> | undefined, changes: AttributeChange[]): Record<string, string>;
117
18
  //# sourceMappingURL=attributes.d.ts.map
@@ -3,14 +3,14 @@
3
3
  * variables.
4
4
  *
5
5
  * Several SDK constants (timeouts, retry counts, stream buffering, …) are
6
- * useful to tune per-deployment — most notably to dial them down on a
6
+ * useful to tune per-deployment, most notably to dial them down on a
7
7
  * dedicated e2e deployment so the test suite exercises edge paths (reconnects,
8
8
  * batch splitting, retries) that otherwise only trigger after long durations
9
9
  * or large payloads.
10
10
  *
11
11
  * `envNumber` reads `process.env[name]` lazily (so tests and deployments can
12
12
  * override per invocation), clamps to an optional `[min, max]` range, and
13
- * never throws — an env override is an escape hatch, not a hard requirement,
13
+ * never throws: an env override is an escape hatch, not a hard requirement,
14
14
  * so an invalid value falls back to the constant's compiled-in default. A
15
15
  * misconfigured value warns once per process so the mistake is observable
16
16
  * without spamming logs.
@@ -35,13 +35,13 @@ export declare function envNumber(name: string, fallback: number, options?: EnvN
35
35
  * Matches the convention the runtime flags already use (`WORKFLOW_TURBO`,
36
36
  * `WORKFLOW_SLOT_IDENTITY`, …): unset or empty takes `fallback`, and the only
37
37
  * values that force a side are `0` / `false` and `1` / `true`
38
- * (case-insensitive). Anything else falls back rather than throwing — a flag is
39
- * an escape hatch, not a hard requirement — and warns once per process.
38
+ * (case-insensitive). Anything else falls back rather than throwing (a flag is
39
+ * an escape hatch, not a hard requirement) and warns once per process.
40
40
  */
41
41
  export declare function envFlag(name: string, fallback: boolean, env?: Record<string, string | undefined>): boolean;
42
42
  export declare function getMaxEventsPerRun(): number;
43
43
  /**
44
- * Reset the warn-once cache. Test-only — exported so unit tests can exercise
44
+ * Reset the warn-once cache. Test-only, exported so unit tests can exercise
45
45
  * the warning path repeatedly without sharing state across cases.
46
46
  *
47
47
  * @internal
@@ -0,0 +1,132 @@
1
+ /**
2
+ * Whether an event is a sealed-log filler occupying an abandoned slot.
3
+ *
4
+ * The single home for this test, deliberately: a noop is invisible to the run
5
+ * but it is a real row of the log, so every pass over a log has to decide
6
+ * whether it is walking positions (count it) or reconstructing what happened
7
+ * (skip it). The replay engines and observability trace builder must agree
8
+ * that a noop's `createdAt` — the sealer's wall clock, which can postdate every
9
+ * real event around it — never becomes a time the run observed.
10
+ *
11
+ * Keeping the classifier in this schema-free module lets replay code make that
12
+ * decision without pulling the event validation graph into workflow bundles.
13
+ */
14
+ export declare function isSealedNoopEvent(event: {
15
+ eventType: string;
16
+ }): boolean;
17
+ /**
18
+ * Groups event types into the classes a replay tracks per entity: the entity
19
+ * named by the event's `correlationId`, or the run itself for run events,
20
+ * which carry none.
21
+ *
22
+ * Types that share a class are the mutually exclusive outcomes of one
23
+ * decision, so the log records the class once and the first event of it is the
24
+ * one that counts: a step either completes or fails.
25
+ *
26
+ * Classes are independent of each other. A step whose result is in the log has
27
+ * still recorded exactly one `step_created`, and can still record another
28
+ * `step_started` if an attempt is running somewhere. What a class bounds is
29
+ * which events can be *ignored*: a replay may pass over an event whose class
30
+ * it already recorded for that entity and which no consumer wants (see
31
+ * `EventsConsumer`), and only then.
32
+ *
33
+ * `attr_set` is here for the correlation id a workflow-body attribute write
34
+ * draws, which resolves exactly once: the dispatcher's consumer takes the
35
+ * matching event and deregisters, so a second event under that id has no
36
+ * callback left and never will. Without a class it would instead be parked for
37
+ * a consumer that cannot come, and parking is only ever settled by the
38
+ * workflow function returning, at which point it is reported as a stranded
39
+ * event and kills a run that did all its work correctly. An attribute write
40
+ * from a *step* body carries no correlation id and is claimed by the
41
+ * structural lifecycle consumer in `workflow.ts` on the way past, so it is
42
+ * consumed rather than skipped and several of them never collapse into one
43
+ * class.
44
+ *
45
+ * Note the omissions, all of them types a mapping would be dead weight for.
46
+ * `hook_received` and `hook_conflict` are deliveries whose consumer subscribes
47
+ * lazily, and `run_created` precedes every replay. The terminal run types are
48
+ * absent for a different reason: recording a class requires a consumer to take
49
+ * an event of it, and no consumer takes `run_completed` / `run_failed` /
50
+ * `run_cancelled`: the runtime exits before replaying the body once the log
51
+ * holds one, so they never reach a consumer at all. An entry for them could
52
+ * never match.
53
+ */
54
+ declare const ENTITY_EVENT_CLASS_BY_TYPE: {
55
+ readonly attr_set: "attr_set";
56
+ readonly step_created: "step_created";
57
+ readonly step_started: "step_started";
58
+ readonly step_retrying: "step_retrying";
59
+ readonly step_completed: "step_terminal";
60
+ readonly step_failed: "step_terminal";
61
+ readonly wait_created: "wait_created";
62
+ readonly wait_completed: "wait_completed";
63
+ readonly hook_created: "hook_created";
64
+ readonly hook_disposed: "hook_disposed";
65
+ readonly run_started: "run_started";
66
+ };
67
+ export type EntityEventClass = (typeof ENTITY_EVENT_CLASS_BY_TYPE)[keyof typeof ENTITY_EVENT_CLASS_BY_TYPE];
68
+ export declare function entityEventClass(eventType: string): EntityEventClass | undefined;
69
+ /** Entity key for a class the log records once per run rather than per entity. */
70
+ export declare const RUN_ENTITY_KEY = "";
71
+ /** The class an event belongs to, and the entity that class is tracked under. */
72
+ export interface EntityEventClassification {
73
+ eventClass: EntityEventClass;
74
+ /** The event's `correlationId`, or {@link RUN_ENTITY_KEY} for run classes. */
75
+ entity: string;
76
+ }
77
+ /**
78
+ * Classes whose event closes its entity: the consumer deregisters on it, so
79
+ * nothing claims another event under that correlation id afterwards.
80
+ *
81
+ * This is what makes a later event of an already-recorded class a straggler
82
+ * rather than another attempt. A class not listed here leaves its entity open,
83
+ * and a repeat is claimed by the live consumer: each retry of a step writes
84
+ * another `step_started`, and a step that has not finished absorbs a second
85
+ * `step_created`.
86
+ *
87
+ * `attr_set` is one of these. The dispatcher's consumer in
88
+ * `attribute-dispatcher.ts` returns `Finished` on the event it matches, so an
89
+ * attribute id closes on the first event under it.
90
+ */
91
+ export declare const TERMINAL_EVENT_CLASSES: ReadonlySet<EntityEventClass>;
92
+ /**
93
+ * The class and entity an event is tracked under, or `undefined` when it is
94
+ * tracked under none and can therefore never be read as a repeat of one.
95
+ *
96
+ * The single home for the rule, because two codebases apply it and a run is
97
+ * misread if they disagree: the runtime skips an event by it while replaying
98
+ * (`EventsConsumer`), and the observability UI greys one out by it after the
99
+ * fact (`@workflow/web-shared`). A shared fixture corpus pins them together
100
+ * (see `test-support/duplicate-event-fixtures.ts`).
101
+ *
102
+ * An entity class needs an entity. Every classed type carries a correlation id
103
+ * except two: `run_started`, whose class is the run's own and keys off
104
+ * {@link RUN_ENTITY_KEY}, and an `attr_set` written from a *step* body, which
105
+ * has no workflow-body call behind it and so names no entity. Without this the
106
+ * step-written ones would all collapse into one class for the run and the
107
+ * second of them would read as a repeat of the first, which would hide
108
+ * attribute writes that really happened — a run can carry dozens.
109
+ */
110
+ export declare function classifyEntityEvent(event: {
111
+ eventType: string;
112
+ correlationId?: string | null;
113
+ }): EntityEventClassification | undefined;
114
+ /** Opaque payload fields removed when events load without referenced data. */
115
+ declare const EVENT_DATA_REF_FIELDS_BY_EVENT_TYPE: {
116
+ readonly run_created: readonly ["input"];
117
+ readonly run_started: readonly ["input"];
118
+ readonly run_completed: readonly ["output"];
119
+ readonly run_failed: readonly ["error"];
120
+ readonly step_created: readonly ["input"];
121
+ readonly step_started: readonly ["input"];
122
+ readonly step_completed: readonly ["result"];
123
+ readonly step_failed: readonly ["error"];
124
+ readonly step_retrying: readonly ["error"];
125
+ readonly hook_created: readonly ["metadata"];
126
+ readonly hook_received: readonly ["payload"];
127
+ };
128
+ export type EventDataPayloadField = (typeof EVENT_DATA_REF_FIELDS_BY_EVENT_TYPE)[keyof typeof EVENT_DATA_REF_FIELDS_BY_EVENT_TYPE][number];
129
+ export declare function getEventDataRefFields(eventType: string): readonly EventDataPayloadField[];
130
+ export declare function getEventDataPayloadField(eventType: string): EventDataPayloadField | undefined;
131
+ export {};
132
+ //# sourceMappingURL=event-metadata.d.ts.map