eve 0.52.4 → 0.53.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 (149) hide show
  1. package/CHANGELOG.md +28 -0
  2. package/dist/src/cli/commands/init-agent-workspace.d.ts +2 -0
  3. package/dist/src/cli/commands/init-agent-workspace.js +1 -1
  4. package/dist/src/cli/commands/init-install.d.ts +8 -0
  5. package/dist/src/cli/commands/init-install.js +1 -0
  6. package/dist/src/cli/commands/init.d.ts +3 -4
  7. package/dist/src/cli/commands/init.js +1 -1
  8. package/dist/src/cli/dev/tui/message-queue.js +1 -1
  9. package/dist/src/cli/dev/tui/terminal-renderer.js +12 -12
  10. package/dist/src/cli/run.js +2 -2
  11. package/dist/src/cli/telemetry/index.d.ts +3 -0
  12. package/dist/src/cli/telemetry/index.js +1 -1
  13. package/dist/src/compiled/.vendor-stamp.json +17 -16
  14. package/dist/src/compiled/@ai-sdk/anthropic/index.d.ts +23 -2
  15. package/dist/src/compiled/@ai-sdk/anthropic/index.js +2 -4
  16. package/dist/src/compiled/@ai-sdk/google/index.d.ts +145 -33
  17. package/dist/src/compiled/@ai-sdk/google/index.js +10 -7
  18. package/dist/src/compiled/@ai-sdk/mcp/index.d.ts +176 -7
  19. package/dist/src/compiled/@ai-sdk/mcp/index.js +1 -1
  20. package/dist/src/compiled/@ai-sdk/openai/index.d.ts +71 -40
  21. package/dist/src/compiled/@ai-sdk/openai/index.js +8 -8
  22. package/dist/src/compiled/@ai-sdk/otel/index.js +1 -1
  23. package/dist/src/compiled/@ai-sdk/provider/index.d.ts +225 -3
  24. package/dist/src/compiled/@ai-sdk/provider-utils/index.d.ts +220 -151
  25. package/dist/src/compiled/@workflow/core/create-hook.d.ts +3 -0
  26. package/dist/src/compiled/@workflow/core/index.js +2 -2
  27. package/dist/src/compiled/@workflow/core/private.js +1 -1
  28. package/dist/src/compiled/@workflow/core/runtime/resume-hook.d.ts +59 -7
  29. package/dist/src/compiled/@workflow/core/runtime/run.d.ts +42 -0
  30. package/dist/src/compiled/@workflow/core/runtime/start.d.ts +31 -1
  31. package/dist/src/compiled/@workflow/core/runtime.d.ts +2 -2
  32. package/dist/src/compiled/@workflow/core/runtime.js +2 -2
  33. package/dist/src/compiled/@workflow/core/serialization.d.ts +22 -0
  34. package/dist/src/compiled/@workflow/core/version.d.ts +1 -1
  35. package/dist/src/compiled/@workflow/core/workflow.js +1 -1
  36. package/dist/src/compiled/@workflow/errors/index.d.ts +37 -3
  37. package/dist/src/compiled/@workflow/errors/index.js +1 -1
  38. package/dist/src/compiled/@workflow/world/attributes-validation.d.ts +68 -0
  39. package/dist/src/compiled/@workflow/world/index.d.ts +1 -1
  40. package/dist/src/compiled/@workflow/world/interfaces.d.ts +21 -0
  41. package/dist/src/compiled/@workflow/world-local/index.js +5 -5
  42. package/dist/src/compiled/@workflow/world-vercel/index.js +3 -3
  43. package/dist/src/compiled/_chunks/workflow/attribute-changes-C6H-fRVP.js +20 -0
  44. package/dist/src/compiled/_chunks/workflow/dist-DDeH-1ER.js +40 -0
  45. package/dist/src/compiled/_chunks/workflow/dist-DhncQSl7.js +74 -0
  46. package/dist/src/compiled/_chunks/workflow/{dist-BIO9Inoc.js → dist-xTushGCp.js} +1 -1
  47. package/dist/src/compiled/_chunks/workflow/frames-DsEqSDes.js +3 -0
  48. package/dist/src/compiled/_chunks/workflow/{private-aXEeo0fU.js → private-CFJkQA7R.js} +1 -1
  49. package/dist/src/compiled/_chunks/workflow/resume-hook-BRDLAb67.js +1 -0
  50. package/dist/src/compiled/_chunks/workflow/run-BM2OFphk.js +1 -0
  51. package/dist/src/compiled/_chunks/workflow/sleep-6cG0F99-.js +1 -0
  52. package/dist/src/compiled/_chunks/workflow/{ws-transport-M7uk8HV8.js → ws-transport-DuK82LLz.js} +1 -1
  53. package/dist/src/compiler/extension-compatibility.d.ts +7 -6
  54. package/dist/src/compiler/extension-compatibility.js +1 -1
  55. package/dist/src/compiler/manifest.js +1 -1
  56. package/dist/src/compiler/normalize-agent-config.js +1 -1
  57. package/dist/src/compiler/normalize-manifest-helpers.js +1 -1
  58. package/dist/src/context/dynamic-model-lifecycle.js +1 -1
  59. package/dist/src/context/keys.d.ts +11 -2
  60. package/dist/src/context/keys.js +1 -1
  61. package/dist/src/evals/mock-model.js +1 -1
  62. package/dist/src/evals/runner/run-evals.d.ts +1 -1
  63. package/dist/src/evals/runner/run-evals.js +1 -1
  64. package/dist/src/execution/activity-cohort.d.ts +20 -0
  65. package/dist/src/execution/activity-cohort.js +1 -0
  66. package/dist/src/execution/authorization-callback-match.d.ts +1 -0
  67. package/dist/src/execution/authorization-callback-match.js +1 -1
  68. package/dist/src/execution/cancelled-model-call-batch.d.ts +15 -0
  69. package/dist/src/execution/cancelled-model-call-batch.js +1 -0
  70. package/dist/src/execution/coordination-dispatch-shared.js +1 -1
  71. package/dist/src/execution/model-call-batching.d.ts +11 -0
  72. package/dist/src/execution/model-call-batching.js +1 -0
  73. package/dist/src/execution/parked-delivery-wait.js +1 -1
  74. package/dist/src/execution/session-activity-projection.d.ts +2 -0
  75. package/dist/src/execution/session-activity-projection.js +1 -1
  76. package/dist/src/execution/skills/instructions.js +1 -1
  77. package/dist/src/execution/tools/sleep-workflow.js +1 -1
  78. package/dist/src/execution/tools/subagent/invoke-agent.d.ts +5 -5
  79. package/dist/src/execution/tools/subagent/invoke-agent.js +1 -1
  80. package/dist/src/execution/tools/subagent/start.js +1 -1
  81. package/dist/src/execution/tools/workflow/body.js +1 -1
  82. package/dist/src/execution/turn-workflow.js +1 -1
  83. package/dist/src/execution/wire/session-inbox-resume.js +1 -1
  84. package/dist/src/execution/workflow-steps.d.ts +1 -1
  85. package/dist/src/execution/workflow-steps.js +1 -1
  86. package/dist/src/harness/approval-delivery-coordinator.js +1 -1
  87. package/dist/src/harness/authorization.d.ts +1 -0
  88. package/dist/src/harness/authorization.js +1 -1
  89. package/dist/src/harness/compaction.js +1 -1
  90. package/dist/src/harness/current-messages.d.ts +8 -2
  91. package/dist/src/harness/current-messages.js +1 -1
  92. package/dist/src/harness/hitl/approval-input-requests.js +1 -1
  93. package/dist/src/harness/input-requests.js +1 -1
  94. package/dist/src/harness/pending-input-batches.d.ts +4 -0
  95. package/dist/src/harness/pending-input-batches.js +1 -1
  96. package/dist/src/harness/tool-loop.js +2 -2
  97. package/dist/src/harness/turn-client-context.d.ts +1 -1
  98. package/dist/src/internal/application/package.js +1 -1
  99. package/dist/src/internal/authored-definition/core.js +1 -1
  100. package/dist/src/internal/authored-package-boundary.js +1 -1
  101. package/dist/src/internal/mock-model-identity.d.ts +2 -0
  102. package/dist/src/internal/mock-model-identity.js +1 -0
  103. package/dist/src/internal/nitro/routes/agent-info/build-agent-info-response.js +1 -1
  104. package/dist/src/internal/workflow-bundle/authored-workflow-directives.js +1 -1
  105. package/dist/src/public/tools/index.d.ts +1 -0
  106. package/dist/src/public/tools/index.js +1 -1
  107. package/dist/src/runtime/resolve-agent.js +1 -1
  108. package/dist/src/self-modification/agent.d.ts +2 -2
  109. package/dist/src/self-modification/agent.js +1 -1
  110. package/dist/src/self-modification/config.d.ts +15 -0
  111. package/dist/src/self-modification/config.js +1 -1
  112. package/dist/src/self-modification/extension/extension.d.ts +3 -0
  113. package/dist/src/self-modification/extension/extension.js +1 -1
  114. package/dist/src/self-modification/setup.d.ts +3 -0
  115. package/dist/src/self-modification/setup.js +25 -4
  116. package/dist/src/setup/integrations/self-modification/setup.js +1 -1
  117. package/dist/src/setup/scaffold/create/add-to-project.js +1 -1
  118. package/dist/src/setup/scaffold/create/project.js +2 -2
  119. package/dist/src/setup/scaffold/update/web-options.js +1 -1
  120. package/dist/src/shared/agent-definition.d.ts +11 -2
  121. package/dist/src/tasks/delivery-context.d.ts +2 -2
  122. package/dist/src/tasks/delivery-context.js +2 -18
  123. package/dist/src/tasks/delivery-policy.js +1 -1
  124. package/dist/src/tools/durable-callbacks.d.ts +18 -1
  125. package/dist/src/tools/durable-callbacks.js +1 -1
  126. package/dist/src/tools/workflow-definition.d.ts +38 -4
  127. package/docs/agent-config.md +44 -8
  128. package/docs/channels/overview.mdx +2 -0
  129. package/docs/channels/slack.mdx +2 -0
  130. package/docs/concepts/execution-model-and-durability.mdx +20 -2
  131. package/docs/evals/running.mdx +3 -1
  132. package/docs/guides/dev-tui.md +11 -11
  133. package/docs/guides/dynamic-capabilities.md +36 -1
  134. package/docs/guides/instrumentation.md +3 -2
  135. package/docs/instructions.mdx +1 -1
  136. package/docs/reference/cli.md +1 -1
  137. package/docs/reference/telemetry.md +1 -1
  138. package/docs/reference/typescript-api.md +36 -35
  139. package/docs/subagents/index.mdx +1 -1
  140. package/docs/tools/overview.mdx +4 -2
  141. package/docs/tools/workflows.mdx +15 -10
  142. package/package.json +17 -17
  143. package/dist/src/compiled/_chunks/workflow/attribute-changes-DpruylJZ.js +0 -20
  144. package/dist/src/compiled/_chunks/workflow/dist-ChzQSWQA.js +0 -65
  145. package/dist/src/compiled/_chunks/workflow/dist-veFIAdWV.js +0 -40
  146. package/dist/src/compiled/_chunks/workflow/frames-DKxlMf3X.js +0 -3
  147. package/dist/src/compiled/_chunks/workflow/resume-hook-DWDi_wCN.js +0 -1
  148. package/dist/src/compiled/_chunks/workflow/run-vsAdI41O.js +0 -1
  149. package/dist/src/compiled/_chunks/workflow/sleep-BKxoNDRv.js +0 -1
@@ -309,6 +309,28 @@ export declare function getCommonRevivers(global?: Record<string, any>): {
309
309
  reason?: unknown;
310
310
  }) => any) | undefined;
311
311
  };
312
+ /**
313
+ * Resolves the owner's encryption key, preferring its public key, then its
314
+ * deployment, and finally its run record.
315
+ * @internal
316
+ */
317
+ export declare function getForwardedWritableEncryptionKey(runId: string, deploymentId: string | undefined, encryptionPublicKey: string | undefined): Promise<PayloadKey | undefined>;
318
+ /** Tags a forwarded writable with its owner's metadata. @internal */
319
+ export declare function tagForwardedWritableTarget(writable: WritableStream, { deploymentId, encryptionPublicKey, }: {
320
+ deploymentId?: string;
321
+ encryptionPublicKey?: string;
322
+ }): void;
323
+ /** Creates and tags a forwarded writable targeting the owner run. @internal */
324
+ export declare function createForwardedWritable<W = any>({ global, ops, runId, name, key, deploymentId, encryptionPublicKey, runReadyBarrier, }: {
325
+ global: Record<string, any>;
326
+ ops: Promise<any>[];
327
+ runId: string;
328
+ name: string;
329
+ key: EncryptionKeyParam;
330
+ deploymentId?: string;
331
+ encryptionPublicKey?: string;
332
+ runReadyBarrier?: Promise<unknown>;
333
+ }): WritableStream<W>;
312
334
  /**
313
335
  * Create a run's object readable without dispatching its stream GET or
314
336
  * encryption-key lookup until the caller reads it. The external reviver starts
@@ -1,2 +1,2 @@
1
- export declare const version = "5.0.0-beta.48";
1
+ export declare const version = "5.0.0-beta.50";
2
2
  //# sourceMappingURL=version.d.ts.map
@@ -1 +1 @@
1
- import{Ar as e,Cr as t,Fr as n,Nr as r,Tr as i,jr as a,nr as o,rr as s,t as c,vr as l,wr as u}from"../../_chunks/workflow/attribute-changes-DpruylJZ.js";import{i as d,u as f}from"../../_chunks/workflow/dist-BIO9Inoc.js";import{i as p}from"../../_chunks/workflow/workflow-routes-CwqB063q.js";import{t as m}from"../../_chunks/workflow/sleep-BKxoNDRv.js";import{t as h}from"../../_chunks/workflow/run-vsAdI41O.js";s(o,h);function g(e){let n=globalThis[t];return n||a(`createHook()`,`https://workflow-sdk.dev/docs/api-reference/workflow/create-hook`,g),n(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 generated for you. 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=p(s,{type:`webhook`,token:o.token}),o}function v(){function e(t,n){r(`defineHook().resume()`,`https://workflow-sdk.dev/docs/api-reference/workflow-api/resume-hook`,e)}return{create(e){return g(e)},resume:e}}async function y(e,t={}){let n=c(e,t);if(n.length===0)return;let r=t.allowReservedAttributes===!0,a=globalThis[i];if(!a)throw new d("setAttributes() called outside a workflow runtime context. It must be called from within a workflow body (`use workflow`).");await a(n,r?{allowReservedAttributes:!0}:{})}function b(e={}){let{namespace:t}=e,n=globalThis[u](t);return Object.create(globalThis.WritableStream.prototype,{[l]:{value:n,writable:!1}})}function x(){e(`getStepMetadata()`,`https://workflow-sdk.dev/docs/api-reference/workflow/get-step-metadata`,x)}function S(){r(`resumeHook()`,`https://workflow-sdk.dev/docs/api-reference/workflow-api/resume-hook`,S)}export{d as FatalError,f as RetryableError,g as createHook,_ as createWebhook,v as defineHook,x as getStepMetadata,n as getWorkflowMetadata,b as getWritable,S as resumeHook,y as setAttributes,m as sleep};
1
+ import{Dr as e,Er as t,Ir as n,Nr as r,Or as i,Pr as a,Rr as o,ar as s,or as c,t as l,xr as u}from"../../_chunks/workflow/attribute-changes-C6H-fRVP.js";import{i as d,u as f}from"../../_chunks/workflow/dist-xTushGCp.js";import{i as p}from"../../_chunks/workflow/workflow-routes-CwqB063q.js";import{t as m}from"../../_chunks/workflow/sleep-6cG0F99-.js";import{t as h}from"../../_chunks/workflow/run-BM2OFphk.js";c(s,h);function g(e){let n=globalThis[t];return n||a(`createHook()`,`https://workflow-sdk.dev/docs/api-reference/workflow/create-hook`,g),n(e)}function _(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 generated for you. Use `createHook()` with `resumeHook()` for deterministic token patterns.");let i;t!==void 0&&(i={respondWith:t});let a=g({...r,metadata:i,isWebhook:!0}),{url:s}=o();return a.url=p(s,{type:`webhook`,token:a.token}),a}function v(){function e(t,r){n(`defineHook().resume()`,`https://workflow-sdk.dev/docs/api-reference/workflow-api/resume-hook`,e)}return{create(e){return g(e)},resume:e}}async function y(e,t={}){let n=l(e,t);if(n.length===0)return;let r=t.allowReservedAttributes===!0,a=globalThis[i];if(!a)throw new d("setAttributes() called outside a workflow runtime context. It must be called from within a workflow body (`use workflow`).");await a(n,r?{allowReservedAttributes:!0}:{})}function b(t={}){let{namespace:n}=t,r=globalThis[e](n);return Object.create(globalThis.WritableStream.prototype,{[u]:{value:r,writable:!1}})}function x(){r(`getStepMetadata()`,`https://workflow-sdk.dev/docs/api-reference/workflow/get-step-metadata`,x)}function S(){n(`resumeHook()`,`https://workflow-sdk.dev/docs/api-reference/workflow-api/resume-hook`,S)}export{d as FatalError,f as RetryableError,g as createHook,_ as createWebhook,v as defineHook,x as getStepMetadata,o as getWorkflowMetadata,b as getWritable,S as resumeHook,y as setAttributes,m as sleep};
@@ -437,11 +437,45 @@ export declare class EntityConflictError extends WorkflowWorldError {
437
437
  * Thrown when a run is no longer available, either because it has been
438
438
  * cleaned up, expired, or already reached a terminal state (completed/failed).
439
439
  *
440
- * The workflow runtime handles this error automatically. Users interacting
441
- * with world storage backends directly may encounter it.
440
+ * Also thrown by `await run.returnValue` when the run's data passed its
441
+ * retention boundary — because it was started with
442
+ * `experimental_retention: 0`, or simply because it aged out of the World's
443
+ * default window. The run's metadata usually outlives its payloads, so
444
+ * `runStatus` and `expiredAt` are populated when the World still has them: the
445
+ * caller can tell "it succeeded, but the result is gone" from "it failed".
446
+ * When even the metadata is gone the World reports the run as missing and you
447
+ * get {@link WorkflowRunNotFoundError} instead.
448
+ *
449
+ * This is terminal. Retrying cannot bring the data back.
442
450
  */
443
451
  export declare class RunExpiredError extends WorkflowWorldError {
444
- constructor(message: string);
452
+ /** The run whose data expired, when the caller knew it. */
453
+ readonly runId?: string | undefined;
454
+ /**
455
+ * The run's terminal status, when its metadata outlived its payloads.
456
+ * Lets a caller distinguish a successful run whose result is gone from a
457
+ * failed one whose error is gone.
458
+ *
459
+ * Named `runStatus` rather than `status` because the base
460
+ * {@link WorkflowWorldError} already carries the HTTP `status`.
461
+ */
462
+ readonly runStatus?: string | undefined;
463
+ /** When the data passed its retention boundary, if the World reports it. */
464
+ readonly expiredAt?: Date | undefined;
465
+ constructor(message: string,
466
+ /** The run whose data expired, when the caller knew it. */
467
+ runId?: string | undefined,
468
+ /**
469
+ * The run's terminal status, when its metadata outlived its payloads.
470
+ * Lets a caller distinguish a successful run whose result is gone from a
471
+ * failed one whose error is gone.
472
+ *
473
+ * Named `runStatus` rather than `status` because the base
474
+ * {@link WorkflowWorldError} already carries the HTTP `status`.
475
+ */
476
+ runStatus?: string | undefined,
477
+ /** When the data passed its retention boundary, if the World reports it. */
478
+ expiredAt?: Date | undefined);
445
479
  static is(value: unknown): value is RunExpiredError;
446
480
  }
447
481
  /**
@@ -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,j as g,k as _,l as v,m as y,n as b,o as x,p as S,r as C,s as w,t as T,u as E,v as D,w as O,x as k,y as A}from"../../_chunks/workflow/dist-BIO9Inoc.js";export{T as CorruptedEventLogError,b as ERROR_SLUGS,C as EntityConflictError,h as FatalError,c as HookConflictError,x as HookNotFoundError,w as MaxEventsExceededError,u as PreconditionFailedError,g as RUN_ERROR_CODES,v as ReplayDivergenceError,E as RetryableError,d as RunExpiredError,f as RunNotSupportedError,S as RuntimeDecryptionError,y as SerializationError,m as StepNotRegisteredError,p as StreamError,s as StreamExpiredError,D as ThrottleError,A as TooEarlyError,l as VERCEL_403_ERROR_MESSAGE,k as WorkflowBuildError,a as WorkflowDeploymentMismatchError,t as WorkflowError,O as WorkflowNotRegisteredError,o as WorkflowRunCancelledError,r as WorkflowRunFailedError,n as WorkflowRunNotCompletedError,i as WorkflowRunNotFoundError,_ as WorkflowRuntimeError,e 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,j as g,k as _,l as v,m as y,n as b,o as x,p as S,r as C,s as w,t as T,u as E,v as D,w as O,x as k,y as A}from"../../_chunks/workflow/dist-xTushGCp.js";export{T as CorruptedEventLogError,b as ERROR_SLUGS,C as EntityConflictError,h as FatalError,c as HookConflictError,x as HookNotFoundError,w as MaxEventsExceededError,u as PreconditionFailedError,g as RUN_ERROR_CODES,v as ReplayDivergenceError,E as RetryableError,d as RunExpiredError,f as RunNotSupportedError,S as RuntimeDecryptionError,y as SerializationError,m as StepNotRegisteredError,p as StreamError,s as StreamExpiredError,D as ThrottleError,A as TooEarlyError,l as VERCEL_403_ERROR_MESSAGE,k as WorkflowBuildError,a as WorkflowDeploymentMismatchError,t as WorkflowError,O as WorkflowNotRegisteredError,o as WorkflowRunCancelledError,r as WorkflowRunFailedError,n as WorkflowRunNotCompletedError,i as WorkflowRunNotFoundError,_ as WorkflowRuntimeError,e as WorkflowWorldError};
@@ -6,6 +6,74 @@ export interface AttributeChange {
6
6
  export declare const RESERVED_ATTRIBUTE_KEY_PREFIX = "$";
7
7
  export declare const ROOT_RUN_ID_ATTRIBUTE = "$rootRunId";
8
8
  export declare const PARENT_RUN_ID_ATTRIBUTE = "$parentRunId";
9
+ /**
10
+ * Reserved attribute carrying the caller's data-retention preference, seeded
11
+ * by `start({ retention })`. Worlds read it when a run reaches a terminal
12
+ * state to decide how long user data is kept. Absent means "the World
13
+ * decides", which is also what `'default'` requests.
14
+ *
15
+ * The value is a duration written as a decimal integer, and **its unit is
16
+ * deliberately not decided yet**. `'0'` is the only duration implemented,
17
+ * and zero is the one value that means the same thing in every unit, so it
18
+ * can ship ahead of that decision: it commits to a shape without committing
19
+ * to a scale. A World that reads a non-zero value must treat it as
20
+ * unsupported and fall back to its own default — that is the safe direction,
21
+ * because it keeps data that was asked to be kept rather than deleting data
22
+ * on the strength of a number it cannot scale.
23
+ */
24
+ export declare const RETENTION_ATTRIBUTE = "$retention";
25
+ /**
26
+ * Value accepted by `start({ retention })`, before it is encoded into
27
+ * {@link RETENTION_ATTRIBUTE}.
28
+ *
29
+ * - `0` — delete user data as soon as the run reaches a terminal state.
30
+ * - `'default'` — let the World decide; the same as omitting the option.
31
+ *
32
+ * A number rather than a string because the value is a duration and this
33
+ * namespace is meant to grow. It is the literal `0` rather than `number`
34
+ * because zero is the only duration that can be honored while the unit is
35
+ * undecided: the narrow type is what stops a caller writing some other
36
+ * duration and silently getting the World's default instead.
37
+ */
38
+ export type RunRetention = 0 | 'default';
39
+ /** Wire value of {@link RETENTION_ATTRIBUTE} meaning "delete on finish". */
40
+ export declare const RETENTION_ZERO = "0";
41
+ /** Wire value meaning "use the World's default". Equivalent to absence. */
42
+ export declare const RETENTION_DEFAULT = "default";
43
+ /** How a World should treat a run's {@link RETENTION_ATTRIBUTE}. */
44
+ export interface ResolvedRunRetention {
45
+ /** `'none'` deletes user data at terminal; `'default'` keeps it. */
46
+ mode: 'none' | 'default';
47
+ /** The raw attribute value, when the run carried one. */
48
+ raw?: string;
49
+ /**
50
+ * True when the value parsed as a non-negative integer — which for every
51
+ * value except `0` still means unsupported. Deliberately not the parsed
52
+ * number: there is no unit to interpret it in yet (see
53
+ * {@link RETENTION_ATTRIBUTE}), and exposing one invites a caller to guess.
54
+ */
55
+ wellFormed: boolean;
56
+ /** True when this is a value no World implements today. */
57
+ unsupported: boolean;
58
+ }
59
+ /**
60
+ * Resolve a run's retention preference from its attributes.
61
+ *
62
+ * Shared by every World that implements retention, and that sharing is the
63
+ * point: two Worlds with independently written parsers can drift, and drift
64
+ * here means one World deleting a run another keeps. The safe direction is
65
+ * fixed — anything but `'0'` resolves to `'default'`, so a value this version
66
+ * does not understand keeps the data rather than destroying it.
67
+ */
68
+ export declare function readRunRetention(attributes: Record<string, string> | undefined): ResolvedRunRetention;
69
+ /**
70
+ * Whether a finished run asked for its user data to be deleted now.
71
+ *
72
+ * The predicate most World call sites want. `readRunRetention` is there when
73
+ * a caller also needs to report *why* it declined — an unsupported value is a
74
+ * rollout signal worth surfacing, not just a no-op.
75
+ */
76
+ export declare function purgesUserDataOnFinish(attributes: Record<string, string> | undefined): boolean;
9
77
  export declare const ATTRIBUTE_KEY_MAX_LENGTH = 256;
10
78
  export declare const ATTRIBUTE_VALUE_MAX_BYTES = 256;
11
79
  export declare const ATTRIBUTE_MAX_PER_RUN = 64;
@@ -1,7 +1,7 @@
1
1
  export type * from './analytics.js';
2
2
  export { ANALYTICS_EVENTS_GET_MANY_LIMIT, ANALYTICS_MAX_ATTRIBUTE_FILTERS, ANALYTICS_PAGE_LIMIT, ANALYTICS_RUN_SCOPED_PAGE_LIMIT, AnalyticsAttributeKeySchema, AnalyticsEventSchema, AnalyticsHookSchema, AnalyticsRunSchema, AnalyticsStepSchema, AnalyticsWaitSchema, } from './analytics.js';
3
3
  export type * from './attributes.js';
4
- export { ATTRIBUTE_KEY_MAX_LENGTH, ATTRIBUTE_MAX_PER_RUN, ATTRIBUTE_VALUE_MAX_BYTES, AttributeChangeSchema, AttributeChangesSchema, AttributeKeySchema, AttributeValidationError, AttributeValueSchema, applyAttributeChanges, PARENT_RUN_ID_ATTRIBUTE, RESERVED_ATTRIBUTE_KEY_PREFIX, ROOT_RUN_ID_ATTRIBUTE, validateAttributeChanges, } from './attributes.js';
4
+ export { ATTRIBUTE_KEY_MAX_LENGTH, ATTRIBUTE_MAX_PER_RUN, ATTRIBUTE_VALUE_MAX_BYTES, AttributeChangeSchema, AttributeChangesSchema, AttributeKeySchema, AttributeValidationError, AttributeValueSchema, applyAttributeChanges, PARENT_RUN_ID_ATTRIBUTE, purgesUserDataOnFinish, RESERVED_ATTRIBUTE_KEY_PREFIX, RETENTION_ATTRIBUTE, RETENTION_DEFAULT, RETENTION_ZERO, type ResolvedRunRetention, ROOT_RUN_ID_ATTRIBUTE, type RunRetention, readRunRetention, validateAttributeChanges, } from './attributes.js';
5
5
  export { _resetEnvWarnCacheForTests, type EnvNumberOptions, envFlag, envNumber, getMaxEventsPerRun, } from './env-config.js';
6
6
  export type * from './events.js';
7
7
  export { BaseEventSchema, CHILD_ENTITY_CREATION_EVENT_TYPES, CreateEventSchema, classifyEntityEvent, EventSchema, EventTypeSchema, entityEventClass, getEventDataPayloadField, getEventDataRefFields, HOOK_EVENTS_REQUIRING_EXISTENCE, HOOK_LIFECYCLE_EVENT_TYPES, HookCreatedEventSchema, isChildEntityCreationEvent, isChildEntityCreationEventType, isHookEventRequiringExistence, isHookLifecycleEventType, isRunEventType, isSealedNoopEvent, isStepEventType, isTerminalRunEventType, isTerminalStepEventType, isWaitEventType, RUN_ENTITY_KEY, RUN_EVENT_TYPES, STEP_EVENT_TYPES, stripEventDataRefs, TERMINAL_EVENT_CLASSES, TERMINAL_RUN_EVENT_TYPES, TERMINAL_STEP_EVENT_TYPES, TerminalRunEventTypeSchema, WAIT_EVENT_TYPES, } from './events.js';
@@ -6,6 +6,21 @@ import type { Queue } from './queue.js';
6
6
  import type { BulkCancelWorkflowRunsRequest, BulkCancelWorkflowRunsResult, GetWorkflowRunParams, ListWorkflowRunsParams, WaitForTerminalRunStatusParams, WorkflowRun, WorkflowRunWithoutData } from './runs.js';
7
7
  import type { GetChunksOptions, PaginatedResponse, StreamChunksResponse, StreamInfoResponse } from './shared.js';
8
8
  import type { GetStepParams, ListWorkflowRunStepsParams, Step, StepWithoutData } from './steps.js';
9
+ export interface StreamWriteSession {
10
+ /**
11
+ * Write one ordered group from this in-memory writer lifetime.
12
+ * `chunkSeq` is writer-local and identifies the first chunk in `chunks`.
13
+ */
14
+ write(chunkSeq: number, chunks: (string | Uint8Array)[]): Promise<void>;
15
+ /** Close this writer lifetime after all prior writes are durable. */
16
+ close(): Promise<void>;
17
+ /** Release transport resources without semantically closing the stream. */
18
+ dispose?(): Promise<void> | void;
19
+ }
20
+ export interface CreateStreamWriteSessionOptions {
21
+ /** Stable observational id for this in-memory writer lifetime. */
22
+ writerId: `wrtr_${string}`;
23
+ }
9
24
  export interface Streamer {
10
25
  /**
11
26
  * Number of milliseconds a stream waits for additional chunks to arrive
@@ -22,6 +37,12 @@ export interface Streamer {
22
37
  */
23
38
  streamFlushIntervalMs?: number;
24
39
  streams: {
40
+ /**
41
+ * Optionally create a stateful writer session. Core creates at most one
42
+ * session per in-memory WritableStream and otherwise uses the stateless
43
+ * write/writeMulti/close methods below unchanged.
44
+ */
45
+ createWriteSession?(runId: string, name: string, options: CreateStreamWriteSessionOptions): StreamWriteSession;
25
46
  write(runId: string, name: string, chunk: string | Uint8Array): Promise<void>;
26
47
  /**
27
48
  * Write multiple chunks to a stream in a single operation.