eve 0.7.0 → 0.7.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (113) hide show
  1. package/CHANGELOG.md +15 -0
  2. package/dist/docs/public/README.md +16 -11
  3. package/dist/docs/public/agent-config.md +9 -9
  4. package/dist/docs/public/channels/custom.mdx +4 -4
  5. package/dist/docs/public/channels/discord.mdx +1 -1
  6. package/dist/docs/public/channels/eve.mdx +9 -9
  7. package/dist/docs/public/channels/github.mdx +1 -1
  8. package/dist/docs/public/channels/overview.mdx +21 -15
  9. package/dist/docs/public/channels/slack.mdx +2 -2
  10. package/dist/docs/public/channels/teams.mdx +1 -1
  11. package/dist/docs/public/channels/telegram.mdx +1 -1
  12. package/dist/docs/public/channels/twilio.mdx +1 -1
  13. package/dist/docs/public/{advanced → concepts}/context-control.md +3 -3
  14. package/dist/docs/public/{advanced → concepts}/default-harness.md +3 -3
  15. package/dist/docs/public/{advanced → concepts}/execution-model-and-durability.md +3 -1
  16. package/dist/docs/public/concepts/meta.json +10 -0
  17. package/dist/docs/public/{advanced → concepts}/security-model.md +2 -2
  18. package/dist/docs/public/{advanced → concepts}/sessions-runs-and-streaming.md +7 -7
  19. package/dist/docs/public/connections.mdx +3 -3
  20. package/dist/docs/public/evals/cases.mdx +1 -1
  21. package/dist/docs/public/evals/overview.mdx +2 -2
  22. package/dist/docs/public/evals/running.mdx +1 -1
  23. package/dist/docs/public/evals/targets.mdx +1 -1
  24. package/dist/docs/public/getting-started.mdx +28 -35
  25. package/dist/docs/public/{advanced → guides}/auth-and-route-protection.md +2 -2
  26. package/dist/docs/public/{client → guides/client}/continuations.mdx +2 -2
  27. package/dist/docs/public/{client → guides/client}/messages.mdx +1 -1
  28. package/dist/docs/public/{client → guides/client}/meta.json +1 -1
  29. package/dist/docs/public/{client → guides/client}/output-schema.mdx +2 -2
  30. package/dist/docs/public/{client → guides/client}/overview.mdx +5 -5
  31. package/dist/docs/public/{client → guides/client}/streaming.mdx +1 -1
  32. package/dist/docs/public/{advanced → guides}/deployment.md +9 -1
  33. package/dist/docs/public/{advanced → guides}/dynamic-capabilities.md +1 -1
  34. package/dist/docs/public/{advanced → guides}/dynamic-workflows.md +1 -1
  35. package/dist/docs/public/{frontend → guides/frontend}/nextjs.mdx +3 -3
  36. package/dist/docs/public/{frontend → guides/frontend}/nuxt.mdx +3 -3
  37. package/dist/docs/public/{frontend → guides/frontend}/overview.mdx +6 -6
  38. package/dist/docs/public/{frontend → guides/frontend}/sveltekit.mdx +3 -3
  39. package/dist/docs/public/{frontend → guides/frontend}/use-eve-agent-svelte.mdx +2 -2
  40. package/dist/docs/public/{frontend → guides/frontend}/use-eve-agent-vue.mdx +2 -2
  41. package/dist/docs/public/{advanced → guides}/hooks.md +2 -2
  42. package/dist/docs/public/{advanced → guides}/instrumentation.md +2 -0
  43. package/dist/docs/public/{advanced → guides}/meta.json +8 -11
  44. package/dist/docs/public/{advanced → guides}/session-context.md +2 -2
  45. package/dist/docs/public/{advanced → guides}/state.md +1 -1
  46. package/dist/docs/public/instructions.mdx +2 -2
  47. package/dist/docs/public/introduction.md +5 -2
  48. package/dist/docs/public/meta.json +3 -3
  49. package/dist/docs/public/reference/cli.md +3 -3
  50. package/dist/docs/public/reference/meta.json +1 -1
  51. package/dist/docs/public/reference/project-layout.md +5 -1
  52. package/dist/docs/public/reference/typescript-api.md +23 -23
  53. package/dist/docs/public/sandbox.mdx +1 -1
  54. package/dist/docs/public/schedules.mdx +2 -2
  55. package/dist/docs/public/skills.mdx +3 -3
  56. package/dist/docs/public/subagents.mdx +3 -3
  57. package/dist/docs/public/tools.mdx +4 -4
  58. package/dist/docs/public/tutorial/connect-a-warehouse.mdx +2 -2
  59. package/dist/docs/public/tutorial/first-agent.mdx +1 -1
  60. package/dist/docs/public/tutorial/guard-the-spend.mdx +1 -1
  61. package/dist/docs/public/tutorial/how-it-runs.mdx +2 -2
  62. package/dist/docs/public/tutorial/meta.json +1 -1
  63. package/dist/docs/public/tutorial/query-sample-data.mdx +1 -1
  64. package/dist/docs/public/tutorial/remember-definitions.mdx +3 -3
  65. package/dist/docs/public/tutorial/run-analysis.mdx +1 -1
  66. package/dist/docs/public/tutorial/ship-it.mdx +4 -4
  67. package/dist/docs/public/tutorial/team-playbooks.mdx +3 -3
  68. package/dist/src/cli/dev/tui/prompt-command-handler.js +1 -1
  69. package/dist/src/cli/dev/tui/runner.d.ts +2 -2
  70. package/dist/src/cli/dev/tui/runner.js +1 -1
  71. package/dist/src/cli/dev/tui/tui.js +1 -1
  72. package/dist/src/compiled/.vendor-stamp.json +2 -2
  73. package/dist/src/compiled/@workflow/core/capabilities.d.ts +19 -1
  74. package/dist/src/compiled/@workflow/core/class-serialization.d.ts +32 -0
  75. package/dist/src/compiled/@workflow/core/create-hook.d.ts +37 -0
  76. package/dist/src/compiled/@workflow/core/global.d.ts +11 -1
  77. package/dist/src/compiled/@workflow/core/index.js +2 -2
  78. package/dist/src/compiled/@workflow/core/runtime/start.d.ts +6 -0
  79. package/dist/src/compiled/@workflow/core/runtime/suspension-handler.d.ts +15 -2
  80. package/dist/src/compiled/@workflow/core/runtime/wait-continuation.d.ts +84 -0
  81. package/dist/src/compiled/@workflow/core/runtime.js +27 -27
  82. package/dist/src/compiled/@workflow/core/serialization/types.d.ts +21 -0
  83. package/dist/src/compiled/@workflow/core/serialization.d.ts +72 -6
  84. package/dist/src/compiled/@workflow/core/symbols.d.ts +2 -0
  85. package/dist/src/compiled/@workflow/core/version.d.ts +1 -1
  86. package/dist/src/compiled/@workflow/core/workflow/attribute-dispatcher.d.ts +6 -0
  87. package/dist/src/compiled/@workflow/core/workflow/set-attributes.d.ts +3 -4
  88. package/dist/src/compiled/@workflow/core/workflow.js +1 -1
  89. package/dist/src/compiled/@workflow/world/events.d.ts +48 -0
  90. package/dist/src/compiled/@workflow/world/index.d.ts +1 -1
  91. package/dist/src/compiled/@workflow/world/queue.d.ts +3 -0
  92. package/dist/src/compiled/@workflow/world/runs.d.ts +2 -0
  93. package/dist/src/compiled/@workflow/world/spec-version.d.ts +2 -1
  94. package/dist/src/compiled/_chunks/workflow/attribute-changes-DGVGRGfw.js +59 -0
  95. package/dist/src/compiled/_chunks/workflow/resume-hook-DMSadN9o.js +1 -0
  96. package/dist/src/compiled/_chunks/workflow/run-BRdn7zy_.js +1 -0
  97. package/dist/src/compiled/_chunks/workflow/sleep-CpXfoXLF.js +1 -0
  98. package/dist/src/execution/sandbox/bindings/vercel.d.ts +2 -6
  99. package/dist/src/execution/sandbox/bindings/vercel.js +1 -1
  100. package/dist/src/internal/application/package.js +1 -1
  101. package/dist/src/runtime/sandbox/keys.js +1 -1
  102. package/dist/src/setup/primitives/pm/pnpm.js +1 -1
  103. package/dist/src/setup/scaffold/create/add-to-project.js +1 -1
  104. package/dist/src/setup/scaffold/create/project.js +2 -2
  105. package/dist/src/setup/scaffold/update/channels.js +1 -1
  106. package/package.json +6 -6
  107. package/dist/docs/public/reference/faqs.md +0 -48
  108. package/dist/src/compiled/_chunks/workflow/resume-hook-CEAS3opc.js +0 -12
  109. package/dist/src/compiled/_chunks/workflow/sleep-Cup6vPoA.js +0 -1
  110. package/dist/src/compiled/_chunks/workflow/symbols-BUTtwS7j.js +0 -48
  111. /package/dist/docs/public/{advanced → guides}/dev-tui.md +0 -0
  112. /package/dist/docs/public/{frontend → guides/frontend}/meta.json +0 -0
  113. /package/dist/docs/public/{advanced → guides}/remote-agents.md +0 -0
@@ -27,6 +27,17 @@ export declare const SerializationFormat: {
27
27
  /** Encrypted payload (inner payload has its own format prefix) */
28
28
  readonly ENCRYPTED: FormatPrefix;
29
29
  };
30
+ /**
31
+ * Wire-framing format identifier carried in the serialized
32
+ * `ReadableStream` ref's `framing` field.
33
+ *
34
+ * - absent / `'raw'`: chunks are written to the transport verbatim
35
+ * (legacy format — no auto-reconnect support).
36
+ * - `'framed-v1'`: each chunk is wrapped in a 4-byte big-endian length
37
+ * prefix, allowing the reader to identify chunk boundaries and
38
+ * transparently reconnect on transient stream errors.
39
+ */
40
+ export type ByteStreamFraming = 'raw' | 'framed-v1';
30
41
  /**
31
42
  * Types that need specialized handling when serialized/deserialized.
32
43
  * If a type is added here, it MUST also be added to the `Serializable`
@@ -83,6 +94,16 @@ export interface SerializableSpecial {
83
94
  name: string;
84
95
  type?: 'bytes';
85
96
  startIndex?: number;
97
+ /**
98
+ * Wire-framing format for byte streams. See {@link ByteStreamFraming}
99
+ * and `getByteFramingStream` / `getByteUnframingStream`.
100
+ *
101
+ * Only meaningful when `type === 'bytes'`. Absent on object streams
102
+ * (which always use length-prefixed devalue framing) and on legacy
103
+ * byte streams written by SDKs that predate framing support — those
104
+ * are interpreted as `'raw'` by the consumer.
105
+ */
106
+ framing?: ByteStreamFraming;
86
107
  } | {
87
108
  bodyInit: any;
88
109
  };
@@ -13,6 +13,39 @@ export type SerializationFormatType = (typeof SerializationFormat)[keyof typeof
13
13
  export declare function getStreamType(stream: ReadableStream): 'bytes' | undefined;
14
14
  export declare function getSerializeStream(reducers: Partial<Reducers>, cryptoKey: EncryptionKeyParam): TransformStream<any, Uint8Array>;
15
15
  export declare function getDeserializeStream(revivers: Partial<Revivers>, cryptoKey: EncryptionKeyParam): TransformStream<Uint8Array, any>;
16
+ /**
17
+ * Wraps each chunk of a byte stream in a 4-byte big-endian length
18
+ * prefix. Used by the producer side of a framed byte-stream pipe.
19
+ *
20
+ * Empty chunks (length 0) are dropped — the resulting `[0x00 0x00 0x00 0x00]`
21
+ * frame would be ambiguous with the legacy "looks framed" detection in
22
+ * `getDeserializeStream`, and it carries no information.
23
+ *
24
+ * Load-bearing invariant: each user chunk becomes exactly one frame, and
25
+ * each frame is enqueued as exactly one transport chunk (the downstream
26
+ * writable performs one wire write per chunk, preserving boundaries). The
27
+ * server therefore stores one frame per chunk index, which is what allows
28
+ * a future reconnecting reader to resume a framed byte stream at
29
+ * `startIndex + consumedFrames` — the same arithmetic
30
+ * `createReconnectingFramedStream` relies on for object streams. Do not
31
+ * coalesce or split frames here without revisiting that resume logic.
32
+ */
33
+ export declare function getByteFramingStream(): TransformStream<Uint8Array, Uint8Array>;
34
+ /**
35
+ * Unwraps length-prefixed byte-stream frames back into the original user
36
+ * chunks. Used by the consumer side of a framed byte-stream pipe.
37
+ *
38
+ * Buffers across read boundaries — the transport may split a single
39
+ * frame across multiple reads (header in one chunk, payload in another)
40
+ * or coalesce multiple frames into a single read. The transform emits
41
+ * whole user chunks regardless of transport chunking.
42
+ *
43
+ * Errors the stream if the length header advertises a frame larger than
44
+ * `MAX_FRAME_SIZE` bytes, since that almost certainly indicates a
45
+ * misframed wire (e.g. a raw byte stream being fed through this transform
46
+ * by mistake) and we don't want to allocate an enormous buffer.
47
+ */
48
+ export declare function getByteUnframingStream(): TransformStream<Uint8Array, Uint8Array>;
16
49
  export declare class WorkflowServerReadableStream extends ReadableStream<Uint8Array> {
17
50
  #private;
18
51
  constructor(runId: string, name: string, startIndex?: number);
@@ -61,17 +94,24 @@ export declare function createReconnectingFramedStream(runId: string, name: stri
61
94
  export declare class WorkflowServerWritableStream extends WritableStream<Uint8Array> {
62
95
  constructor(runId: string, name: string);
63
96
  }
64
- export type { Reducers, Revivers, SerializableSpecial, } from './serialization/types.js';
65
- import type { Reducers, Revivers } from './serialization/types.js';
97
+ export type { ByteStreamFraming, Reducers, Revivers, SerializableSpecial, } from './serialization/types.js';
98
+ import type { ByteStreamFraming, Reducers, Revivers } from './serialization/types.js';
66
99
  /**
67
100
  * Reducers for serialization boundary from the client side, passing arguments
68
101
  * to the workflow handler.
69
102
  *
70
103
  * @param global
71
104
  * @param ops
105
+ * @param runId
106
+ * @param cryptoKey
107
+ * @param framedByteStreams - When `true`, byte streams (`type: 'bytes'`)
108
+ * are wrapped in length-prefixed frames on the wire so the consumer
109
+ * can reconnect on transient errors. Should match the target run's
110
+ * capability — see `getRunCapabilities` in `capabilities.ts`. Defaults
111
+ * to `false` for backwards compatibility with older runs.
72
112
  * @returns
73
113
  */
74
- export declare function getExternalReducers(global: Record<string, any> | undefined, ops: Promise<void>[], runId: string, cryptoKey: EncryptionKeyParam): Partial<Reducers>;
114
+ export declare function getExternalReducers(global: Record<string, any> | undefined, ops: Promise<void>[], runId: string, cryptoKey: EncryptionKeyParam, framedByteStreams?: boolean): Partial<Reducers>;
75
115
  /**
76
116
  * Reducers for serialization boundary from within the workflow execution
77
117
  * environment, passing return value to the client side and into step arguments.
@@ -144,6 +184,7 @@ export declare function getCommonRevivers(global?: Record<string, any>): {
144
184
  name: string;
145
185
  type?: "bytes";
146
186
  startIndex?: number;
187
+ framing?: ByteStreamFraming;
147
188
  } | {
148
189
  bodyInit: any;
149
190
  }) => any) | undefined;
@@ -283,8 +324,20 @@ export declare function maybeDecrypt(data: Uint8Array | unknown, key: CryptoKey
283
324
  * Called from the `start()` function to serialize the workflow arguments
284
325
  * into a format that can be saved to the database and then hydrated from
285
326
  * within the workflow execution environment.
327
+ *
328
+ * @param value - The value to serialize
329
+ * @param runId - The workflow run ID (required for encryption context)
330
+ * @param key - Encryption key (undefined to skip encryption)
331
+ * @param ops - Promise array for stream operations
332
+ * @param global - Global object for serialization context
333
+ * @param v1Compat - Enable legacy v1 compatibility mode
334
+ * @param framedByteStreams - Whether the target run can decode wire-framed
335
+ * byte streams. Should match the target deployment's capability — see
336
+ * `getRunCapabilities` in `capabilities.ts`. Defaults to `false` for
337
+ * backwards compatibility with older runs.
338
+ * @returns The dehydrated value as binary data (Uint8Array) with format prefix
286
339
  */
287
- export declare function dehydrateWorkflowArguments(value: unknown, runId: string, key: CryptoKey | undefined, ops?: Promise<void>[], global?: Record<string, any>, v1Compat?: boolean): Promise<Uint8Array | unknown>;
340
+ export declare function dehydrateWorkflowArguments(value: unknown, runId: string, key: CryptoKey | undefined, ops?: Promise<void>[], global?: Record<string, any>, v1Compat?: boolean, framedByteStreams?: boolean): Promise<Uint8Array | unknown>;
288
341
  /**
289
342
  * Called from workflow execution environment to hydrate the workflow
290
343
  * arguments from the database at the start of workflow execution.
@@ -311,9 +364,22 @@ export declare function dehydrateStepArguments(value: unknown, _runId: string, k
311
364
  export declare function hydrateStepArguments(value: Uint8Array | unknown, runId: string, key: CryptoKey | undefined, ops?: Promise<any>[], global?: Record<string, any>, extraRevivers?: Record<string, (value: any) => any>, deploymentId?: string): Promise<any>;
312
365
  /**
313
366
  * Called from the step handler when a step has completed.
314
- * Dehydrates values from within the step execution environment.
367
+ * Dehydrates values from within the step execution environment
368
+ * into a format that can be saved to the database.
369
+ *
370
+ * @param value - The value to serialize
371
+ * @param runId - Run ID for encryption context
372
+ * @param key - Encryption key (undefined to skip encryption)
373
+ * @param ops - Promise array for stream operations
374
+ * @param global - Global object for serialization context
375
+ * @param v1Compat - Enable legacy v1 compatibility mode
376
+ * @param framedByteStreams - Whether the target run can decode wire-framed
377
+ * byte streams. Should match the target deployment's capability — see
378
+ * `getRunCapabilities` in `capabilities.ts`. Defaults to `false` for
379
+ * backwards compatibility with older runs.
380
+ * @returns The dehydrated value as binary data (Uint8Array) with format prefix
315
381
  */
316
- export declare function dehydrateStepReturnValue(value: unknown, runId: string, key: CryptoKey | undefined, ops?: Promise<any>[], global?: Record<string, any>, v1Compat?: boolean): Promise<Uint8Array | unknown>;
382
+ export declare function dehydrateStepReturnValue(value: unknown, runId: string, key: CryptoKey | undefined, ops?: Promise<any>[], global?: Record<string, any>, v1Compat?: boolean, framedByteStreams?: boolean): Promise<Uint8Array | unknown>;
317
383
  /**
318
384
  * Called from the step handler when a step throws. Dehydrates the thrown
319
385
  * value from within the step execution environment into a format that can
@@ -1,4 +1,5 @@
1
1
  export declare const WORKFLOW_USE_STEP: unique symbol;
2
+ export declare const WORKFLOW_SET_ATTRIBUTES: unique symbol;
2
3
  export declare const WORKFLOW_CREATE_HOOK: unique symbol;
3
4
  export declare const WORKFLOW_SLEEP: unique symbol;
4
5
  export declare const WORKFLOW_CONTEXT: unique symbol;
@@ -6,6 +7,7 @@ export declare const WORKFLOW_GET_STREAM_ID: unique symbol;
6
7
  export declare const STABLE_ULID: unique symbol;
7
8
  export declare const STREAM_NAME_SYMBOL: unique symbol;
8
9
  export declare const STREAM_TYPE_SYMBOL: unique symbol;
10
+ export declare const STREAM_FRAMING_SYMBOL: unique symbol;
9
11
  /**
10
12
  * Stamped on a real `WritableStream` (the user-visible `serialize.writable`
11
13
  * returned from a step-side reviver or step-context `getWritable()`) to
@@ -1,2 +1,2 @@
1
- export declare const version = "5.0.0-beta.14";
1
+ export declare const version = "5.0.0-beta.15";
2
2
  //# sourceMappingURL=version.d.ts.map
@@ -0,0 +1,6 @@
1
+ import type { AttributeChange } from '#compiled/@workflow/world/index.js';
2
+ import { type WorkflowOrchestratorContext } from '../private.js';
3
+ export declare function createSetAttributes(ctx: WorkflowOrchestratorContext): (changes: AttributeChange[], options?: {
4
+ allowReservedAttributes?: boolean;
5
+ }) => Promise<void>;
6
+ //# sourceMappingURL=attribute-dispatcher.d.ts.map
@@ -29,11 +29,10 @@ export interface ExperimentalSetAttributesOptions {
29
29
  * breaking rename later.
30
30
  *
31
31
  * Callable only from a workflow body (`'use workflow'`). The call is
32
- * dispatched through the workflow runtime as a step, so the mutation
33
- * is recorded in the event log and survives replay.
32
+ * dispatched as a native `attr_set` event and materialized on the run.
34
33
  *
35
- * Validation runs in the VM (cheap, deterministic) before the step
36
- * dispatch violations throw `FatalError` without queuing a step. An
34
+ * Validation runs in the VM (cheap, deterministic) before event
35
+ * dispatch - violations throw `FatalError` without writing an event. An
37
36
  * empty record is a no-op. `value: undefined` removes the key from the
38
37
  * run's attribute map.
39
38
  *
@@ -1 +1 @@
1
- import{c as e,i as t}from"../../_chunks/workflow/dist-6a3viBXZ.js";import{at as n,g as r,it as i,lt as a,m as o,p as s,s as c,st as l}from"../../_chunks/workflow/symbols-BUTtwS7j.js";import{n as u,t as d}from"../../_chunks/workflow/sleep-Cup6vPoA.js";async function f(e,n={}){let i=u(e,n);if(i.length===0)return;let a=n.allowReservedAttributes===!0,o=globalThis[r];if(!o)throw new t("experimental_setAttributes() called outside a workflow runtime context. It must be called from within a workflow body (`use workflow`).");await o(`__builtin_set_attributes`)(i,a?{allowReservedAttributes:!0}:{})}function p(e){let t=globalThis[s];return t||n(`createHook()`,`https://workflow-sdk.dev/docs/api-reference/workflow/create-hook`,p),t(e)}function m(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=p({...r,metadata:i,isWebhook:!0}),{url:s}=a();return o.url=`${s}/.well-known/workflow/v1/webhook/${encodeURIComponent(o.token)}`,o}function h(){function e(t,n){l(`defineHook().resume()`,`https://workflow-sdk.dev/docs/api-reference/workflow-api/resume-hook`,e)}return{create(e){return p(e)},resume:e}}function g(e={}){let{namespace:t}=e,n=globalThis[o](t);return Object.create(globalThis.WritableStream.prototype,{[c]:{value:n,writable:!1}})}function _(){i(`getStepMetadata()`,`https://workflow-sdk.dev/docs/api-reference/workflow/get-step-metadata`,_)}function v(){l(`resumeHook()`,`https://workflow-sdk.dev/docs/api-reference/workflow-api/resume-hook`,v)}export{t as FatalError,e as RetryableError,p as createHook,m as createWebhook,h as defineHook,f as experimental_setAttributes,_ as getStepMetadata,a as getWorkflowMetadata,g as getWritable,v as resumeHook,d as sleep};
1
+ import{c as e,i as t}from"../../_chunks/workflow/dist-6a3viBXZ.js";import{$n as n,Ht as r,Jn as i,Kt as a,Qt as o,Vt as s,Xt as c,Yn as l,Zn as u,Zt as d,t as f}from"../../_chunks/workflow/attribute-changes-DGVGRGfw.js";import{t as p}from"../../_chunks/workflow/sleep-CpXfoXLF.js";import{t as m}from"../../_chunks/workflow/run-BRdn7zy_.js";async function h(e,n={}){let r=f(e,n);if(r.length===0)return;let i=n.allowReservedAttributes===!0,a=globalThis[o];if(!a)throw new t("experimental_setAttributes() called outside a workflow runtime context. It must be called from within a workflow body (`use workflow`).");await a(r,i?{allowReservedAttributes:!0}:{})}r(s,m);function g(e){let t=globalThis[c];return t||l(`createHook()`,`https://workflow-sdk.dev/docs/api-reference/workflow/create-hook`,g),t(e)}function _(e){let{respondWith:t,token:r,...i}=e??{};if(r!==void 0)throw Error("`createWebhook()` does not accept a `token` option. Webhook tokens are always randomly generated. Use `createHook()` with `resumeHook()` for deterministic token patterns.");let a;t!==void 0&&(a={respondWith:t});let o=g({...i,metadata:a,isWebhook:!0}),{url:s}=n();return o.url=`${s}/.well-known/workflow/v1/webhook/${encodeURIComponent(o.token)}`,o}function v(){function e(t,n){u(`defineHook().resume()`,`https://workflow-sdk.dev/docs/api-reference/workflow-api/resume-hook`,e)}return{create(e){return g(e)},resume:e}}function y(e={}){let{namespace:t}=e,n=globalThis[d](t);return Object.create(globalThis.WritableStream.prototype,{[a]:{value:n,writable:!1}})}function b(){i(`getStepMetadata()`,`https://workflow-sdk.dev/docs/api-reference/workflow/get-step-metadata`,b)}function x(){u(`resumeHook()`,`https://workflow-sdk.dev/docs/api-reference/workflow-api/resume-hook`,x)}export{t as FatalError,e as RetryableError,g as createHook,_ as createWebhook,v as defineHook,h as experimental_setAttributes,b as getStepMetadata,n as getWorkflowMetadata,y as getWritable,x as resumeHook,p as sleep};
@@ -24,6 +24,7 @@ export declare const EventTypeSchema: z.ZodEnum<{
24
24
  hook_received: "hook_received";
25
25
  run_started: "run_started";
26
26
  run_cancelled: "run_cancelled";
27
+ attr_set: "attr_set";
27
28
  step_started: "step_started";
28
29
  hook_disposed: "hook_disposed";
29
30
  hook_conflict: "hook_conflict";
@@ -43,6 +44,7 @@ export declare const BaseEventSchema: z.ZodObject<{
43
44
  hook_received: "hook_received";
44
45
  run_started: "run_started";
45
46
  run_cancelled: "run_cancelled";
47
+ attr_set: "attr_set";
46
48
  step_started: "step_started";
47
49
  hook_disposed: "hook_disposed";
48
50
  hook_conflict: "hook_conflict";
@@ -91,6 +93,8 @@ declare const RunCreatedEventSchema: z.ZodObject<{
91
93
  workflowName: z.ZodString;
92
94
  input: z.ZodUnion<readonly [z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>, z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>]>;
93
95
  executionContext: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
96
+ attributes: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
97
+ allowReservedAttributes: z.ZodOptional<z.ZodLiteral<true>>;
94
98
  }, z.core.$strip>;
95
99
  }, z.core.$strip>;
96
100
  export declare const CreateEventSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
@@ -102,6 +106,8 @@ export declare const CreateEventSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
102
106
  workflowName: z.ZodString;
103
107
  input: z.ZodUnion<readonly [z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>, z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>]>;
104
108
  executionContext: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
109
+ attributes: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
110
+ allowReservedAttributes: z.ZodOptional<z.ZodLiteral<true>>;
105
111
  }, z.core.$strip>;
106
112
  }, z.core.$strip>, z.ZodObject<{
107
113
  correlationId: z.ZodOptional<z.ZodString>;
@@ -112,6 +118,8 @@ export declare const CreateEventSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
112
118
  deploymentId: z.ZodOptional<z.ZodString>;
113
119
  workflowName: z.ZodOptional<z.ZodString>;
114
120
  executionContext: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
121
+ attributes: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
122
+ allowReservedAttributes: z.ZodOptional<z.ZodLiteral<true>>;
115
123
  }, z.core.$strip>>;
116
124
  }, z.core.$strip>, z.ZodObject<{
117
125
  correlationId: z.ZodOptional<z.ZodString>;
@@ -132,6 +140,24 @@ export declare const CreateEventSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
132
140
  correlationId: z.ZodOptional<z.ZodString>;
133
141
  specVersion: z.ZodOptional<z.ZodNumber>;
134
142
  eventType: z.ZodLiteral<"run_cancelled">;
143
+ }, z.core.$strip>, z.ZodObject<{
144
+ specVersion: z.ZodOptional<z.ZodNumber>;
145
+ eventType: z.ZodLiteral<"attr_set">;
146
+ correlationId: z.ZodOptional<z.ZodString>;
147
+ eventData: z.ZodObject<{
148
+ changes: z.ZodArray<z.ZodObject<{
149
+ key: z.ZodString;
150
+ value: z.ZodUnion<readonly [z.ZodString, z.ZodNull]>;
151
+ }, z.core.$strip>>;
152
+ writer: z.ZodDiscriminatedUnion<[z.ZodObject<{
153
+ type: z.ZodLiteral<"workflow">;
154
+ }, z.core.$strip>, z.ZodObject<{
155
+ type: z.ZodLiteral<"step">;
156
+ stepId: z.ZodString;
157
+ attempt: z.ZodNumber;
158
+ }, z.core.$strip>], "type">;
159
+ allowReservedAttributes: z.ZodOptional<z.ZodLiteral<true>>;
160
+ }, z.core.$strip>;
135
161
  }, z.core.$strip>, z.ZodObject<{
136
162
  specVersion: z.ZodOptional<z.ZodNumber>;
137
163
  eventType: z.ZodLiteral<"step_created">;
@@ -222,6 +248,8 @@ export declare const EventSchema: z.ZodIntersection<z.ZodDiscriminatedUnion<[z.Z
222
248
  workflowName: z.ZodString;
223
249
  input: z.ZodUnion<readonly [z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>, z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>]>;
224
250
  executionContext: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
251
+ attributes: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
252
+ allowReservedAttributes: z.ZodOptional<z.ZodLiteral<true>>;
225
253
  }, z.core.$strip>;
226
254
  }, z.core.$strip>, z.ZodObject<{
227
255
  correlationId: z.ZodOptional<z.ZodString>;
@@ -232,6 +260,8 @@ export declare const EventSchema: z.ZodIntersection<z.ZodDiscriminatedUnion<[z.Z
232
260
  deploymentId: z.ZodOptional<z.ZodString>;
233
261
  workflowName: z.ZodOptional<z.ZodString>;
234
262
  executionContext: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
263
+ attributes: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
264
+ allowReservedAttributes: z.ZodOptional<z.ZodLiteral<true>>;
235
265
  }, z.core.$strip>>;
236
266
  }, z.core.$strip>, z.ZodObject<{
237
267
  correlationId: z.ZodOptional<z.ZodString>;
@@ -252,6 +282,24 @@ export declare const EventSchema: z.ZodIntersection<z.ZodDiscriminatedUnion<[z.Z
252
282
  correlationId: z.ZodOptional<z.ZodString>;
253
283
  specVersion: z.ZodOptional<z.ZodNumber>;
254
284
  eventType: z.ZodLiteral<"run_cancelled">;
285
+ }, z.core.$strip>, z.ZodObject<{
286
+ specVersion: z.ZodOptional<z.ZodNumber>;
287
+ eventType: z.ZodLiteral<"attr_set">;
288
+ correlationId: z.ZodOptional<z.ZodString>;
289
+ eventData: z.ZodObject<{
290
+ changes: z.ZodArray<z.ZodObject<{
291
+ key: z.ZodString;
292
+ value: z.ZodUnion<readonly [z.ZodString, z.ZodNull]>;
293
+ }, z.core.$strip>>;
294
+ writer: z.ZodDiscriminatedUnion<[z.ZodObject<{
295
+ type: z.ZodLiteral<"workflow">;
296
+ }, z.core.$strip>, z.ZodObject<{
297
+ type: z.ZodLiteral<"step">;
298
+ stepId: z.ZodString;
299
+ attempt: z.ZodNumber;
300
+ }, z.core.$strip>], "type">;
301
+ allowReservedAttributes: z.ZodOptional<z.ZodLiteral<true>>;
302
+ }, z.core.$strip>;
255
303
  }, z.core.$strip>, z.ZodObject<{
256
304
  specVersion: z.ZodOptional<z.ZodNumber>;
257
305
  eventType: z.ZodLiteral<"step_created">;
@@ -16,7 +16,7 @@ export type * from './shared.js';
16
16
  export type { GetChunksOptions, StreamChunk, StreamChunksResponse, StreamInfoResponse, } from './shared.js';
17
17
  export { PaginatedResponseSchema, StructuredErrorSchema, } from './shared.js';
18
18
  export type { SpecVersion } from './spec-version.js';
19
- export { isLegacySpecVersion, requiresNewerWorld, SPEC_VERSION_CURRENT, SPEC_VERSION_LEGACY, SPEC_VERSION_SUPPORTS_CBOR_QUEUE_TRANSPORT, SPEC_VERSION_SUPPORTS_EVENT_SOURCING, } from './spec-version.js';
19
+ export { isLegacySpecVersion, requiresNewerWorld, SPEC_VERSION_CURRENT, SPEC_VERSION_LEGACY, SPEC_VERSION_SUPPORTS_ATTRIBUTES, SPEC_VERSION_SUPPORTS_CBOR_QUEUE_TRANSPORT, SPEC_VERSION_SUPPORTS_EVENT_SOURCING, } from './spec-version.js';
20
20
  export type * from './steps.js';
21
21
  export { StepSchema, StepStatusSchema } from './steps.js';
22
22
  export { DEFAULT_TIMESTAMP_THRESHOLD_FUTURE_MS, DEFAULT_TIMESTAMP_THRESHOLD_MS, DEFAULT_TIMESTAMP_THRESHOLD_PAST_MS, ulidToDate, validateUlidTimestamp, } from './ulid.js';
@@ -48,6 +48,7 @@ export declare const RunInputSchema: z.ZodObject<{
48
48
  workflowName: z.ZodString;
49
49
  specVersion: z.ZodNumber;
50
50
  executionContext: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
51
+ attributes: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
51
52
  }, z.core.$strip>;
52
53
  export type RunInput = z.infer<typeof RunInputSchema>;
53
54
  export declare const WorkflowInvokePayloadSchema: z.ZodObject<{
@@ -67,6 +68,7 @@ export declare const WorkflowInvokePayloadSchema: z.ZodObject<{
67
68
  workflowName: z.ZodString;
68
69
  specVersion: z.ZodNumber;
69
70
  executionContext: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
71
+ attributes: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
70
72
  }, z.core.$strip>>;
71
73
  }, z.core.$strip>;
72
74
  export declare const StepInvokePayloadSchema: z.ZodObject<{
@@ -105,6 +107,7 @@ export declare const QueuePayloadSchema: z.ZodUnion<readonly [z.ZodObject<{
105
107
  workflowName: z.ZodString;
106
108
  specVersion: z.ZodNumber;
107
109
  executionContext: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
110
+ attributes: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
108
111
  }, z.core.$strip>>;
109
112
  }, z.core.$strip>, z.ZodObject<{
110
113
  workflowName: z.ZodString;
@@ -128,6 +128,8 @@ export interface CreateWorkflowRunRequest {
128
128
  input: SerializedData;
129
129
  executionContext?: SerializedData;
130
130
  specVersion?: number;
131
+ /** Plaintext attributes to seed when the run is created. */
132
+ attributes?: Record<string, string>;
131
133
  }
132
134
  export interface GetWorkflowRunParams {
133
135
  resolveData?: ResolveData;
@@ -19,7 +19,8 @@ export type SpecVersion = number & {
19
19
  export declare const SPEC_VERSION_LEGACY: SpecVersion;
20
20
  export declare const SPEC_VERSION_SUPPORTS_EVENT_SOURCING: SpecVersion;
21
21
  export declare const SPEC_VERSION_SUPPORTS_CBOR_QUEUE_TRANSPORT: SpecVersion;
22
- /** Current spec version (event-sourced architecture with CBOR queue transport). */
22
+ export declare const SPEC_VERSION_SUPPORTS_ATTRIBUTES: SpecVersion;
23
+ /** Current spec version (event-sourced architecture with native attributes). */
23
24
  export declare const SPEC_VERSION_CURRENT: SpecVersion;
24
25
  /**
25
26
  * Check if a spec version is legacy (<= SPEC_VERSION_LEGACY or undefined).