eve 0.22.1 → 0.22.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 (95) hide show
  1. package/CHANGELOG.md +11 -0
  2. package/dist/src/cli/commands/init-repl.d.ts +6 -5
  3. package/dist/src/compiled/.vendor-stamp.json +6 -4
  4. package/dist/src/compiled/@workflow/core/create-hook.d.ts +2 -2
  5. package/dist/src/compiled/@workflow/core/events-consumer.d.ts +1 -1
  6. package/dist/src/compiled/@workflow/core/index.js +2 -2
  7. package/dist/src/compiled/@workflow/core/private.js +1 -1
  8. package/dist/src/compiled/@workflow/core/runtime/constants.d.ts +14 -0
  9. package/dist/src/compiled/@workflow/core/runtime/get-world-lazy.d.ts +3 -12
  10. package/dist/src/compiled/@workflow/core/runtime/wait-continuation.d.ts +2 -2
  11. package/dist/src/compiled/@workflow/core/runtime/world-compatibility.d.ts +5 -0
  12. package/dist/src/compiled/@workflow/core/runtime/world-init.d.ts +16 -41
  13. package/dist/src/compiled/@workflow/core/runtime/world-target.d.ts +11 -0
  14. package/dist/src/compiled/@workflow/core/runtime/world.d.ts +21 -9
  15. package/dist/src/compiled/@workflow/core/runtime.d.ts +2 -1
  16. package/dist/src/compiled/@workflow/core/runtime.js +3 -141
  17. package/dist/src/compiled/@workflow/core/version.d.ts +1 -1
  18. package/dist/src/compiled/@workflow/core/workflow/world-init-stub.d.ts +2 -2
  19. package/dist/src/compiled/@workflow/core/workflow.js +1 -1
  20. package/dist/src/compiled/@workflow/errors/index.js +1 -1
  21. package/dist/src/compiled/@workflow/world/analytics.d.ts +182 -0
  22. package/dist/src/compiled/@workflow/world/env-config.d.ts +39 -0
  23. package/dist/src/compiled/@workflow/world/events.d.ts +25 -0
  24. package/dist/src/compiled/@workflow/world/index.d.ts +6 -3
  25. package/dist/src/compiled/@workflow/world/interfaces.d.ts +14 -7
  26. package/dist/src/compiled/@workflow/world/runs.d.ts +9 -1
  27. package/dist/src/compiled/@workflow/world/shared.d.ts +15 -0
  28. package/dist/src/compiled/@workflow/world/steps.d.ts +8 -0
  29. package/dist/src/compiled/@workflow/world-local/LICENSE.md +201 -0
  30. package/dist/src/compiled/@workflow/world-local/index.js +4 -0
  31. package/dist/src/compiled/@workflow/world-vercel/LICENSE.md +201 -0
  32. package/dist/src/compiled/@workflow/world-vercel/index.js +42 -0
  33. package/dist/src/compiled/_chunks/workflow/attribute-changes-BnKD8Y3m.js +20 -0
  34. package/dist/src/compiled/_chunks/workflow/{dist-FLIfyJ4Y.js → dist-CttsoN4D.js} +1 -1
  35. package/dist/src/compiled/_chunks/workflow/dist-DJU_7R9s.js +40 -0
  36. package/dist/src/compiled/_chunks/workflow/dist-DpDDcpTl.js +3 -0
  37. package/dist/src/compiled/_chunks/workflow/resume-hook-DjPY9VGg.js +1 -0
  38. package/dist/src/compiled/_chunks/workflow/run-BSANnUPR.js +1 -0
  39. package/dist/src/compiled/_chunks/workflow/sleep-phozDCW8.js +1 -0
  40. package/dist/src/compiled/_chunks/workflow/token-CaY0nA5J.js +1 -0
  41. package/dist/src/compiled/_chunks/workflow/token-D4VIwGlD.js +1 -0
  42. package/dist/src/compiled/_chunks/workflow/undici-fb54XL8i.js +95 -0
  43. package/dist/src/harness/emission.js +1 -1
  44. package/dist/src/harness/model-call-error.d.ts +5 -0
  45. package/dist/src/harness/model-call-error.js +1 -1
  46. package/dist/src/harness/prompt-cache.d.ts +18 -9
  47. package/dist/src/harness/prompt-cache.js +1 -1
  48. package/dist/src/harness/tool-loop.js +1 -1
  49. package/dist/src/internal/application/compiled-artifacts.d.ts +4 -0
  50. package/dist/src/internal/application/compiled-artifacts.js +5 -4
  51. package/dist/src/internal/application/package.d.ts +9 -5
  52. package/dist/src/internal/application/package.js +1 -1
  53. package/dist/src/internal/nitro/host/configure-nitro-routes.js +2 -2
  54. package/dist/src/internal/nitro/host/create-application-nitro.js +1 -1
  55. package/dist/src/internal/nitro/routes/health.d.ts +3 -3
  56. package/dist/src/internal/workflow/runtime.js +1 -1
  57. package/dist/src/internal/workflow/validate-world.d.ts +16 -0
  58. package/dist/src/internal/workflow/validate-world.js +1 -0
  59. package/dist/src/internal/workflow/world-compatibility.d.ts +1 -12
  60. package/dist/src/node_modules/.pnpm/@workflow_utils@5.0.0-beta.6/node_modules/@workflow/utils/dist/index.js +1 -0
  61. package/dist/src/node_modules/.pnpm/@workflow_utils@5.0.0-beta.6/node_modules/@workflow/utils/dist/parse-name.js +1 -0
  62. package/dist/src/node_modules/.pnpm/@workflow_utils@5.0.0-beta.6/node_modules/@workflow/utils/dist/pluralize.js +1 -0
  63. package/dist/src/node_modules/.pnpm/@workflow_utils@5.0.0-beta.6/node_modules/@workflow/utils/dist/promise.js +1 -0
  64. package/dist/src/node_modules/.pnpm/@workflow_utils@5.0.0-beta.6/node_modules/@workflow/utils/dist/time.js +1 -0
  65. package/dist/src/node_modules/.pnpm/@workflow_utils@5.0.0-beta.6/node_modules/@workflow/utils/dist/workflow-routes.js +1 -0
  66. package/dist/src/node_modules/.pnpm/@workflow_utils@5.0.0-beta.6/node_modules/@workflow/utils/dist/world-target.js +1 -0
  67. package/dist/src/node_modules/.pnpm/ms@2.1.3/node_modules/ms/index.js +1 -0
  68. package/dist/src/public/channels/slack/action-status.d.ts +19 -0
  69. package/dist/src/public/channels/slack/action-status.js +1 -0
  70. package/dist/src/public/channels/slack/defaults.js +2 -2
  71. package/dist/src/public/channels/slack/index.d.ts +1 -0
  72. package/dist/src/public/channels/slack/index.js +1 -1
  73. package/dist/src/public/channels/slack/slackChannel.d.ts +1 -1
  74. package/dist/src/public/next/index.d.ts +9 -9
  75. package/dist/src/public/next/index.js +1 -1
  76. package/dist/src/public/next/vercel-output-config.js +1 -1
  77. package/dist/src/setup/scaffold/create/project.js +2 -2
  78. package/docs/agent-config.md +1 -1
  79. package/docs/channels/github.mdx +35 -2
  80. package/docs/channels/linear.mdx +35 -5
  81. package/docs/channels/slack.mdx +3 -3
  82. package/docs/concepts/execution-model-and-durability.md +1 -1
  83. package/docs/guides/deployment.md +1 -1
  84. package/docs/guides/frontend/nextjs.mdx +7 -7
  85. package/docs/subagents.mdx +2 -0
  86. package/package.json +7 -5
  87. package/dist/src/compiled/_chunks/workflow/attribute-changes-zAifvEhb.js +0 -59
  88. package/dist/src/compiled/_chunks/workflow/dist-Dxrjttr2.js +0 -3
  89. package/dist/src/compiled/_chunks/workflow/resume-hook-C15uJ2ik.js +0 -1
  90. package/dist/src/compiled/_chunks/workflow/run-BJUPZ0Ni.js +0 -1
  91. package/dist/src/compiled/_chunks/workflow/sleep-C8B-TYir.js +0 -1
  92. package/dist/src/compiled/_chunks/workflow/token-Bm-WLAUB.js +0 -1
  93. package/dist/src/compiled/_chunks/workflow/token-J7YP0s9a.js +0 -1
  94. package/dist/src/internal/workflow/configure-world.d.ts +0 -18
  95. package/dist/src/internal/workflow/configure-world.js +0 -1
package/CHANGELOG.md CHANGED
@@ -1,5 +1,16 @@
1
1
  # eve
2
2
 
3
+ ## 0.22.2
4
+
5
+ ### Patch Changes
6
+
7
+ - 4da4d86: Fixed Anthropic prompt caching placing the final cache breakpoint one message too early. Fresh tool results were billed as uncached input every turn and only entered the cache on the following request, capping the effective cache hit rate near 50%; the breakpoint now sits on the last message of each request, so agentic tool loops get near-full prefix hits.
8
+ - 4446f96: Update the vendored Workflow SDK packages to the latest 5.0 beta releases. eve now delegates world target selection and construction to the upstream SDK instead of maintaining parallel factory and compatibility logic, and no longer disables stable Workflow Turbo mode.
9
+ - 3da5def: Retry transient provider overload errors delivered inside model streams. Classified transient failures get at most three fresh model-call attempts, while other recoverable task-mode errors fall back to Workflow's durable step retries without multiplying retry budgets.
10
+ - 2afed3b: Update `withEve()` to generate Vercel Build Output service routes for eve instead of the legacy Next.js rewrite setup. The generated output now uses the stable `services` field and service routes, including in hosted Vercel builds where no local `.vercel/project.json` exists, so Vercel builds the eve service without Next.js rewrites.
11
+ - 3983d36: The Slack channel's default typing indicator for `actions.requested` now shows the action's contents instead of a generic `Running <tool>...` label: the tool name plus its most telling argument (`grep useEveAgent`, `read_file agent/agent.ts`), the subagent or remote-agent name for dispatched calls, and `+N more` for batches. The label helpers are exported from `eve/channels/slack` as `describeActionRequest` and `describeActionRequests` for use in custom handlers.
12
+ - 15309f3: New projects created with `eve init` now use stable TypeScript 7.0.2 instead of the release candidate.
13
+
3
14
  ## 0.22.1
4
15
 
5
16
  ### Patch Changes
@@ -1,20 +1,21 @@
1
1
  import { type Prompter } from "#setup/prompter.js";
2
+ declare const positional: (prompt: string) => string[];
2
3
  declare const CODING_AGENT_REPLS: readonly [{
3
4
  readonly command: "claude";
4
5
  readonly label: "Claude Code";
5
- readonly promptArgs: (prompt: string) => string[];
6
+ readonly promptArgs: typeof positional;
6
7
  }, {
7
8
  readonly command: "codex";
8
9
  readonly label: "Codex";
9
- readonly promptArgs: (prompt: string) => string[];
10
+ readonly promptArgs: typeof positional;
10
11
  }, {
11
12
  readonly command: "cursor-agent";
12
13
  readonly label: "Cursor";
13
- readonly promptArgs: (prompt: string) => string[];
14
+ readonly promptArgs: typeof positional;
14
15
  }, {
15
16
  readonly command: "droid";
16
17
  readonly label: "Droid";
17
- readonly promptArgs: (prompt: string) => string[];
18
+ readonly promptArgs: typeof positional;
18
19
  }, {
19
20
  readonly command: "gemini";
20
21
  readonly label: "Gemini CLI";
@@ -26,7 +27,7 @@ declare const CODING_AGENT_REPLS: readonly [{
26
27
  }, {
27
28
  readonly command: "pi";
28
29
  readonly label: "Pi";
29
- readonly promptArgs: (prompt: string) => string[];
30
+ readonly promptArgs: typeof positional;
30
31
  }];
31
32
  type CodingAgentReplDefinition = (typeof CODING_AGENT_REPLS)[number];
32
33
  /** A coding-agent REPL that can take over the terminal after `eve init`. */
@@ -27,12 +27,14 @@
27
27
  "@vercel/detect-agent": "1.2.3",
28
28
  "@vercel/oidc": "3.5.0",
29
29
  "@vercel/sandbox": "2.3.0",
30
- "@workflow/core": "5.0.0-beta.26",
31
- "@workflow/errors": "5.0.0-beta.8",
30
+ "@workflow/core": "5.0.0-beta.28",
31
+ "@workflow/errors": "5.0.0-beta.10",
32
32
  "@workflow/serde": "5.0.0-beta.2",
33
- "@workflow/world": "5.0.0-beta.14",
33
+ "@workflow/world": "5.0.0-beta.16",
34
+ "@workflow/world-local": "5.0.0-beta.24",
35
+ "@workflow/world-vercel": "5.0.0-beta.24",
34
36
  "zod": "4.4.3",
35
37
  "zod-validation-error": "5.0.0"
36
38
  },
37
- "scriptHash": "5bf2d1b5f6695983ae1a233467bb9baa93e057fdbb25283f4603c1d46d5e16bf"
39
+ "scriptHash": "b46518404fb685affcfcac4ee0dd5559c3e7b1b1472e79a6d8ecf043b445c792"
38
40
  }
@@ -156,8 +156,8 @@ export interface HookOptions {
156
156
  * Whether this hook can be resumed via the public webhook endpoint.
157
157
  *
158
158
  * When `true`, the hook can be triggered by sending an HTTP request to the
159
- * public `/.well-known/workflow/v1/webhook/{token}` URL. This is automatically
160
- * set when using `createWebhook()`.
159
+ * public workflow webhook URL. This is automatically set when using
160
+ * `createWebhook()`.
161
161
  *
162
162
  * When `false` (the default), the hook can only be resumed server-side
163
163
  * via `resumeHook()`.
@@ -1,4 +1,4 @@
1
- import type { Event } from '#compiled/@workflow/world/index.js';
1
+ import { type Event } from '#compiled/@workflow/world/index.js';
2
2
  /**
3
3
  * Delay before firing the deferred unconsumed-event check after the promise
4
4
  * queue has drained. Must be long enough for cross-VM microtask chains to
@@ -1,2 +1,2 @@
1
- import{c as e,i as t}from"../../_chunks/workflow/dist-Dxrjttr2.js";import{L as n,R as r,S as i,_n as a,bn as o,cn as s,dr as c,h as l,lr as u,on as d,sn as f,t as p,ur as m,vn as h,w as g,yn as _}from"../../_chunks/workflow/attribute-changes-zAifvEhb.js";import{n as v}from"../../_chunks/workflow/resume-hook-C15uJ2ik.js";import{t as y}from"../../_chunks/workflow/sleep-C8B-TYir.js";function b(e){m(`createHook()`,`https://workflow-sdk.dev/docs/api-reference/workflow/create-hook`,b)}function x(e){m(`createWebhook()`,`https://workflow-sdk.dev/docs/api-reference/workflow/create-webhook`,x)}function S({schema:e}={}){function t(e){m(`defineHook().create()`,`https://workflow-sdk.dev/docs/api-reference/workflow/define-hook`,t)}return{create:t,async resume(t,n){if(!e?.[`~standard`])return await v(t,n);let r=e[`~standard`].validate(n);if(r instanceof Promise&&(r=await r),r.issues){let e=r.issues.map(e=>{let t=e.path?.map(e=>String(typeof e==`object`&&e?e.key:e)).join(`.`);return t?` at "${t}": ${e.message}`:` ${e.message}`});throw Error(`Hook payload did not match the defined schema:\n${e.join(`
2
- `)}`)}return await v(t,r.value)}}}async function C(e,n={}){let i=r.getStore(),o=i?.workflowMetadata?.workflowRunId;if(!o)throw new t(`experimental_setAttributes() must be called from a 'use workflow' or 'use step' function. Calling it from plain host code is not supported.`);let s=p(e,n);if(s.length!==0){if(i.runReadyBarrier)try{await i.runReadyBarrier}catch{}await(await a()).events.create(o,{eventType:`attr_set`,specVersion:5,eventData:{changes:s,writer:{type:`step`,stepId:i.stepMetadata.stepId,attempt:i.stepMetadata.attempt},...n.allowReservedAttributes===!0?{allowReservedAttributes:!0}:{}}})}}function w(){let e=r.getStore();return e||u(`getStepMetadata()`,`https://workflow-sdk.dev/docs/api-reference/workflow/get-step-metadata`,w),e.stepMetadata}function T(){let e=r.getStore();return e||c(`getWorkflowMetadata()`,`https://workflow-sdk.dev/docs/api-reference/workflow/get-workflow-metadata`,T),e.workflowMetadata}function E(e={}){let t=r.getStore();t||c(`getWritable()`,`https://workflow-sdk.dev/docs/api-reference/workflow/get-writable`,E);let{namespace:a}=e,u=t.workflowMetadata.workflowRunId,p=n(u,a),m=t.writables??=new Map,v=m.get(p);if(v)return v.writable;let y=g(i(globalThis,t.ops,u,t.encryptionKey,!0,t.runReadyBarrier),t.encryptionKey),b=new l(u,p,t.runReadyBarrier),x=h();return t.ops.push(x.promise),_(y.readable,b,x).catch(()=>{}),o(y.writable,x),Object.defineProperty(y.writable,d,{value:p,writable:!1}),Object.defineProperty(y.writable,s,{value:u,writable:!1}),t.workflowDeploymentId&&Object.defineProperty(y.writable,f,{value:t.workflowDeploymentId,writable:!1}),m.set(p,{writable:y.writable,state:x}),y.writable}export{t as FatalError,e as RetryableError,b as createHook,x as createWebhook,S as defineHook,C as experimental_setAttributes,w as getStepMetadata,T as getWorkflowMetadata,E as getWritable,y as sleep};
1
+ import{c as e,i as t}from"../../_chunks/workflow/dist-DpDDcpTl.js";import{C as n,Dn as r,En as i,R as a,Sn as o,T as s,Tn as c,bn as l,cn as u,h as d,ln as f,sn as p,t as m,vn as h,xn as g,z as _}from"../../_chunks/workflow/attribute-changes-BnKD8Y3m.js";import"../../_chunks/workflow/dist-DJU_7R9s.js";import{n as v}from"../../_chunks/workflow/resume-hook-DjPY9VGg.js";import{t as y}from"../../_chunks/workflow/sleep-phozDCW8.js";function b(e){i(`createHook()`,`https://workflow-sdk.dev/docs/api-reference/workflow/create-hook`,b)}function x(e){i(`createWebhook()`,`https://workflow-sdk.dev/docs/api-reference/workflow/create-webhook`,x)}function S({schema:e}={}){function t(e){i(`defineHook().create()`,`https://workflow-sdk.dev/docs/api-reference/workflow/define-hook`,t)}return{create:t,async resume(t,n){if(!e?.[`~standard`])return await v(t,n);let r=e[`~standard`].validate(n);if(r instanceof Promise&&(r=await r),r.issues){let e=r.issues.map(e=>{let t=e.path?.map(e=>String(typeof e==`object`&&e?e.key:e)).join(`.`);return t?` at "${t}": ${e.message}`:` ${e.message}`});throw Error(`Hook payload did not match the defined schema:\n${e.join(`
2
+ `)}`)}return await v(t,r.value)}}}async function C(e,n={}){let r=_.getStore(),i=r?.workflowMetadata?.workflowRunId;if(!i)throw new t(`experimental_setAttributes() must be called from a 'use workflow' or 'use step' function. Calling it from plain host code is not supported.`);let a=m(e,n);if(a.length!==0){if(r.runReadyBarrier)try{await r.runReadyBarrier}catch{}await(await h()).events.create(i,{eventType:`attr_set`,specVersion:5,eventData:{changes:a,writer:{type:`step`,stepId:r.stepMetadata.stepId,attempt:r.stepMetadata.attempt},...n.allowReservedAttributes===!0?{allowReservedAttributes:!0}:{}}})}}function w(){let e=_.getStore();return e||c(`getStepMetadata()`,`https://workflow-sdk.dev/docs/api-reference/workflow/get-step-metadata`,w),e.stepMetadata}function T(){let e=_.getStore();return e||r(`getWorkflowMetadata()`,`https://workflow-sdk.dev/docs/api-reference/workflow/get-workflow-metadata`,T),e.workflowMetadata}function E(e={}){let t=_.getStore();t||r(`getWritable()`,`https://workflow-sdk.dev/docs/api-reference/workflow/get-writable`,E);let{namespace:i}=e,c=t.workflowMetadata.workflowRunId,m=a(c,i),h=t.writables??=new Map,v=h.get(m);if(v)return v.writable;let y=s(n(globalThis,t.ops,c,t.encryptionKey,!0,t.runReadyBarrier),t.encryptionKey),b=new d(c,m,t.runReadyBarrier),x=l();return t.ops.push(x.promise),g(y.readable,b,x).catch(()=>{}),o(y.writable,x),Object.defineProperty(y.writable,p,{value:m,writable:!1}),Object.defineProperty(y.writable,f,{value:c,writable:!1}),t.workflowDeploymentId&&Object.defineProperty(y.writable,u,{value:t.workflowDeploymentId,writable:!1}),h.set(m,{writable:y.writable,state:x}),y.writable}export{t as FatalError,e as RetryableError,b as createHook,x as createWebhook,S as defineHook,C as experimental_setAttributes,w as getStepMetadata,T as getWorkflowMetadata,E as getWritable,y as sleep};
@@ -1 +1 @@
1
- import{a as e}from"../../_chunks/workflow/dist-FLIfyJ4Y.js";const t=Symbol.for(`@workflow/core//registeredSteps`),n=globalThis,r=n[t]??=new Map,i=new Set([`__builtin_response_array_buffer`,`__builtin_response_json`,`__builtin_response_text`]);function a(e){let t=e.split(`//`);if(t.length!==3||t[0]!==`step`)return[];let n=t[1],r=t[2],i=new Set,a=e=>{e!==n&&i.add(e)};if(n.startsWith(`./workflows/`)){let e=n.slice(2);a(`./example/${e}`),a(`./src/${e}`)}else if(n.startsWith(`./example/workflows/`)){let e=n.slice(10);a(`./${e}`),a(`./src/${e}`)}else if(n.startsWith(`./src/workflows/`)){let e=n.slice(6);a(`./${e}`),a(`./example/${e}`)}return Array.from(i,e=>`step//${e}//${r}`)}function o(e){if(i.has(e)){for(let[t,n]of r.entries())if(t.endsWith(`//${e}`))return n}}function s(e,t){r.set(e,t),t.stepId=e}function c(e){let t=r.get(e);if(t)return t;for(let t of a(e)){let e=r.get(t);if(e)return e}let n=o(e);if(n)return n}async function l(e,t,n){if(t===void 0||!e.pendingDeliveryBarriers||e.pendingDeliveryBarriers.size===0)return;let r=[];for(let[i,a]of e.pendingDeliveryBarriers)i<t&&n.includes(a.kind)&&r.push(a.delivered);r.length>0&&await Promise.all(r)}function u(t,n,r){let i=t.pendingDeliveryBarriers;if(!i||n===void 0)return{markDelivered:()=>{}};let a=!1,{promise:o,resolve:s}=e(),c={kind:r,delivered:o};i.set(n,c);let l=()=>{a||(a=!0,i.get(n)===c&&i.delete(n),s())};return d(t,l),{markDelivered:l}}function d(e,t){let n=()=>{e.pendingDeliveries>0?e.promiseQueue.then(()=>{setTimeout(n,0)}):t()};setTimeout(n,0)}export{l as awaitEarlierDeliveries,c as getStepFunction,u as registerDeliveryBarrier,s as registerStepFunction,d as scheduleWhenIdle};
1
+ import{c as e}from"../../_chunks/workflow/dist-CttsoN4D.js";const t=Symbol.for(`@workflow/core//registeredSteps`),n=globalThis,r=n[t]??=new Map,i=new Set([`__builtin_response_array_buffer`,`__builtin_response_json`,`__builtin_response_text`]);function a(e){let t=e.split(`//`);if(t.length!==3||t[0]!==`step`)return[];let n=t[1],r=t[2],i=new Set,a=e=>{e!==n&&i.add(e)};if(n.startsWith(`./workflows/`)){let e=n.slice(2);a(`./example/${e}`),a(`./src/${e}`)}else if(n.startsWith(`./example/workflows/`)){let e=n.slice(10);a(`./${e}`),a(`./src/${e}`)}else if(n.startsWith(`./src/workflows/`)){let e=n.slice(6);a(`./${e}`),a(`./example/${e}`)}return Array.from(i,e=>`step//${e}//${r}`)}function o(e){if(i.has(e)){for(let[t,n]of r.entries())if(t.endsWith(`//${e}`))return n}}function s(e,t){r.set(e,t),t.stepId=e}function c(e){let t=r.get(e);if(t)return t;for(let t of a(e)){let e=r.get(t);if(e)return e}let n=o(e);if(n)return n}async function l(e,t,n){if(t===void 0||!e.pendingDeliveryBarriers||e.pendingDeliveryBarriers.size===0)return;let r=[];for(let[i,a]of e.pendingDeliveryBarriers)i<t&&n.includes(a.kind)&&r.push(a.delivered);r.length>0&&await Promise.all(r)}function u(t,n,r){let i=t.pendingDeliveryBarriers;if(!i||n===void 0)return{markDelivered:()=>{}};let a=!1,{promise:o,resolve:s}=e(),c={kind:r,delivered:o};i.set(n,c);let l=()=>{a||(a=!0,i.get(n)===c&&i.delete(n),s())};return d(t,l),{markDelivered:l}}function d(e,t){let n=()=>{e.pendingDeliveries>0?e.promiseQueue.then(()=>{setTimeout(n,0)}):t()};setTimeout(n,0)}export{l as awaitEarlierDeliveries,c as getStepFunction,u as registerDeliveryBarrier,s as registerStepFunction,d as scheduleWhenIdle};
@@ -1,4 +1,8 @@
1
1
  export declare const MAX_QUEUE_DELIVERIES = 48;
2
+ /**
3
+ * Effective max queue deliveries. Override via `WORKFLOW_MAX_QUEUE_DELIVERIES`.
4
+ */
5
+ export declare function getMaxQueueDeliveries(): number;
2
6
  /**
3
7
  * Default maximum time allowed for the *replay* portion of a single workflow
4
8
  * handler invocation (in ms). This budget only covers deterministic-replay
@@ -48,6 +52,11 @@ export declare function getReplayTimeoutMs(): number;
48
52
  */
49
53
  export declare function _resetReplayTimeoutWarnCacheForTests(): void;
50
54
  export declare const REPLAY_TIMEOUT_MAX_RETRIES = 3;
55
+ /**
56
+ * Effective replay-timeout retry budget. Override via
57
+ * `WORKFLOW_REPLAY_TIMEOUT_MAX_RETRIES`.
58
+ */
59
+ export declare function getReplayTimeoutMaxRetries(): number;
51
60
  /**
52
61
  * Default maximum number of steps the owned-inline path runs inline (in
53
62
  * parallel) per suspension. The rest are queued to background handlers. Each
@@ -122,4 +131,9 @@ export declare function isOptimisticInlineStartExplicitlyDisabled(): boolean;
122
131
  */
123
132
  export declare function isTurboEnabled(): boolean;
124
133
  export declare const REPLAY_DIVERGENCE_MAX_RETRIES = 3;
134
+ /**
135
+ * Effective replay-divergence recovery budget. Override via
136
+ * `WORKFLOW_REPLAY_DIVERGENCE_MAX_RETRIES`.
137
+ */
138
+ export declare function getReplayDivergenceMaxRetries(): number;
125
139
  //# sourceMappingURL=constants.d.ts.map
@@ -13,19 +13,10 @@
13
13
  * `getWorld()` call. This is the steady-state hot path.
14
14
  * 2. `globalThis[GetWorldFnKey]` — populated by the module-load side
15
15
  * effect at the bottom of `./world.ts`. Fires on every server bundle
16
- * that reaches this file via `workflow/api` (which imports
16
+ * that reaches this file via `workflow` or `workflow/api` (which import
17
17
  * `./world-init.ts` for its side effect; see that file for the full
18
- * rationale). This is the cold-start path for routes that consume
19
- * `start` without any prior workflow run.
20
- * 3. Dynamic `import('./world.js')` — last-resort fallback for
21
- * environments where neither (1) nor (2) is available (CJS test
22
- * runners, scripts that import deeply into `@workflow/core` without
23
- * going through `workflow/api`, future bundlers we haven't validated).
24
- * The specifier is built at runtime so esbuild can't trace it into
25
- * step bundles. Note: this branch is unreliable in webpack-bundled
26
- * routes because webpack inlines this module into the route file and
27
- * the relative path resolves against the bundle location — paths (1)
28
- * and (2) cover those cases instead.
18
+ * rationale). This is the cold-start path for routes that consume host
19
+ * helpers without any prior workflow run.
29
20
  */
30
21
  import type { World } from '#compiled/@workflow/world/index.js';
31
22
  export declare function getWorldLazy(): Promise<World>;
@@ -58,8 +58,8 @@
58
58
  */
59
59
  /**
60
60
  * Maximum `delaySeconds` for a single wait-continuation message. Waits
61
- * longer than this are chained across multiple hops. 23 hours: VQS
62
- * messages have a 24h retention limit; the 1h buffer mirrors
61
+ * longer than this are chained across multiple hops. 23 hours leaves a 1h
62
+ * buffer under Vercel Queues' default 24h message TTL and mirrors
63
63
  * world-vercel's `MAX_DELAY_SECONDS`.
64
64
  */
65
65
  export declare const WAIT_CONTINUATION_MAX_DELAY_SECONDS = 82800;
@@ -0,0 +1,5 @@
1
+ import type { World } from '#compiled/@workflow/world/index.js';
2
+ type WorldSpecVersionMetadata = Pick<World, 'specVersion'>;
3
+ export declare function assertWorldSupportsRuntimeProtocol(world: WorldSpecVersionMetadata): void;
4
+ export {};
5
+ //# sourceMappingURL=world-compatibility.d.ts.map
@@ -6,30 +6,17 @@
6
6
  * # Why this exists
7
7
  *
8
8
  * `getWorldLazy()` in `./get-world-lazy.ts` checks the globalThis cache
9
- * (populated by `world.ts`'s module-load side effect) before falling back
10
- * to a runtime-built dynamic `import('./world.js')`. When a server route
11
- * only consumes a single helper that goes through `getWorldLazy` — most
12
- * commonly `start` from `workflow/api` — webpack/turbopack tree-shake the
13
- * named import `{ getWorld } from './runtime/world.js'` out of
14
- * `runtime.ts`, taking `world.ts`'s module evaluation with it. The
9
+ * populated by `world.ts`'s module-load side effect. When a server route
10
+ * only consumes a helper that goes through `getWorldLazy` for example
11
+ * `start` from `workflow/api`, or `defineHook().resume()` from `workflow`
12
+ * — webpack/turbopack can tree-shake the named import `{ getWorld }` out
13
+ * of `runtime.ts`, taking `world.ts`'s module evaluation with it. The
15
14
  * globalThis registration never fires.
16
15
  *
17
- * `getWorldLazy` then falls through to its dynamic-import fallback, which
18
- * itself fails: webpack inlines `get-world-lazy.js` into the bundled route
19
- * file, so the relative specifier `./world.js` resolves against
20
- * `/var/task/<app>/.next/server/app/<...>/route.js` where no sibling
21
- * `world.js` exists — and Node throws `MODULE_NOT_FOUND`. The symptom is a
22
- * cold-start regression: the very first user request that goes through
23
- * `start()` fails until some other code path (typically the queue-driven
24
- * `/.well-known/workflow/v1/flow` route, which uses `getWorld` directly
25
- * via `workflowEntrypoint`) has loaded `world.ts` and populated the
26
- * cache.
27
- *
28
- * Importing this module for its side effect — exactly once, from the
29
- * host-side `workflow/api` (`packages/workflow/src/api.ts`) — guarantees
30
- * `world.ts` enters the bundle, the global is registered at module load,
31
- * and `getWorldLazy()` short-circuits to the registered function on the
32
- * first call.
16
+ * Importing this module for its side effect from the host-side `workflow`
17
+ * and `workflow/api` entries guarantees `world.ts` enters the bundle, the
18
+ * global is registered at module load, and `getWorldLazy()` short-circuits
19
+ * to the registered function on the first call.
33
20
  *
34
21
  * # Why a separate module instead of importing `./world.js` directly
35
22
  *
@@ -47,29 +34,17 @@
47
34
  * `workflow` condition active, so they pick up the stub and never reach
48
35
  * `world.ts`. Host bundlers (webpack, turbopack, Node.js) use the
49
36
  * `default` (or `node`) condition and pick up this file, loading
50
- * `world.ts` as intended. The split keeps `@workflow/world-vercel`,
51
- * `@workflow/world-local`, `cbor-x`, and other server-only deps out of
52
- * the workflow sandbox bundle.
53
- *
54
- * # Why we keep the `getWorldLazy` dynamic-import fallback
55
- *
56
- * The fallback remains in `./get-world-lazy.ts` as a defense-in-depth for
57
- * environments we haven't accounted for (CJS test runners, scripts that
58
- * import `start` without going through `workflow/api`, future bundlers
59
- * with stricter tree-shaking). With this init module in place, the
60
- * fallback should never fire in normal use — but if it does, the
61
- * dynamic-import branch still resolves correctly when `world.js` is
62
- * physically adjacent on disk (e.g., direct Node.js execution of
63
- * unbundled source).
37
+ * `world.ts` as intended. The split keeps the configured world package
38
+ * and other server-only deps out of the workflow sandbox bundle.
64
39
  *
65
40
  * # Maintenance notes
66
41
  *
67
42
  * If you add another `getWorldLazy()` consumer that's reachable from a
68
- * host route without going through `workflow/api` (e.g., a new helper in
69
- * `workflow/runtime`), make sure that entry also imports this module —
70
- * or that it transitively reaches `world.ts` via a non-tree-shakeable
71
- * path. Adding a regression test in `world-init.test.ts` is preferred to
72
- * relying on careful manual tracing.
43
+ * host route without going through `workflow` or `workflow/api`, make
44
+ * sure that entry also imports this module — or that it transitively
45
+ * reaches `world.ts` via a non-tree-shakeable path. Adding a regression
46
+ * test in `world-init.test.ts` is preferred to relying on careful manual
47
+ * tracing.
73
48
  */
74
49
  import './world.js';
75
50
  //# sourceMappingURL=world-init.d.ts.map
@@ -0,0 +1,11 @@
1
+ import type { World } from '#compiled/@workflow/world/index.js';
2
+ /**
3
+ * Unaliased target stub.
4
+ *
5
+ * Framework integrations alias this module to the configured world package at
6
+ * build time, including the default local world. Reaching this file means that
7
+ * static injection did not happen, so fail loudly instead of importing a
8
+ * fallback world that bundlers could retain alongside the configured one.
9
+ */
10
+ export declare function createWorld(): World | Promise<World>;
11
+ //# sourceMappingURL=world-target.d.ts.map
@@ -1,15 +1,27 @@
1
1
  import type { World } from '#compiled/@workflow/world/index.js';
2
+ export type WorldFactoryModule = {
3
+ createWorld?: () => World | Promise<World>;
4
+ /** @deprecated World packages should export `createWorld()` instead. */
5
+ createLocalWorld?: () => World | Promise<World>;
6
+ /** @deprecated World packages should export `createWorld()` instead. */
7
+ createVercelWorld?: () => World | Promise<World>;
8
+ default?: (() => World | Promise<World>) | World;
9
+ };
2
10
  /**
3
- * Create a new world instance based on environment variables.
4
- * WORKFLOW_TARGET_WORLD is used to determine the target world.
11
+ * Create a World instance from a world factory module. Shared by
12
+ * `createWorld()` (for the statically injected target world module) and
13
+ * tooling that loads a world module dynamically (e.g. the Nitro dev
14
+ * handler and `@workflow/world-testing`). Legacy world-specific factory
15
+ * names are still accepted for compatibility, but world packages should
16
+ * export `createWorld()`.
17
+ */
18
+ export declare function createWorldFromModule(mod: WorldFactoryModule): World | Promise<World>;
19
+ /**
20
+ * Create a new world instance from the statically imported target world module.
5
21
  *
6
- * Note: WORKFLOW_VERCEL_* env vars (PROJECT, TEAM, AUTH_TOKEN, etc.) are
7
- * intentionally NOT read here. Those are for CLI/observability tooling only
8
- * and should not affect runtime behavior. The Vercel runtime provides
9
- * authentication via OIDC tokens and project context via system env vars
10
- * (VERCEL_DEPLOYMENT_ID, VERCEL_PROJECT_ID). Tooling that needs these env
11
- * vars should call createVercelWorld() directly with an explicit config and
12
- * use setWorld() to inject the instance.
22
+ * Framework integrations alias `@workflow/core/runtime/world-target` to the
23
+ * concrete world package at build time, so bundlers see a static import path
24
+ * instead of tracing a runtime-built require/import expression.
13
25
  */
14
26
  export declare const createWorld: () => Promise<World>;
15
27
  export type WorldHandlers = Pick<World, 'createQueueHandler' | 'specVersion'>;
@@ -6,7 +6,7 @@ export { getHookByToken, resumeHook, resumeWebhook, } from './runtime/resume-hoo
6
6
  export { getRun, Run, type WorkflowReadableStream, type WorkflowReadableStreamOptions, } from './runtime/run.js';
7
7
  export { cancelRun, listStreams, type ReadStreamOptions, type RecreateRunOptions, readStream, recreateRunFromExisting, reenqueueRun, type StopSleepOptions, type StopSleepResult, wakeUpRun, } from './runtime/runs.js';
8
8
  export { type StartOptions, type StartOptionsBase, type StartOptionsWithDeploymentId, type StartOptionsWithoutDeploymentId, start, } from './runtime/start.js';
9
- export { createWorld, getWorld, getWorldHandlers, setWorld, } from './runtime/world.js';
9
+ export { createWorld, createWorldFromModule, getWorld, getWorldHandlers, setWorld, type WorldFactoryModule, } from './runtime/world.js';
10
10
  /**
11
11
  * Creates a single route which handles workflow execution requests,
12
12
  * executing steps inline when possible to reduce function invocations
@@ -21,5 +21,6 @@ export { createWorld, getWorld, getWorldHandlers, setWorld, } from './runtime/wo
21
21
  export declare function workflowEntrypoint(workflowCode: string, options?: {
22
22
  namespace?: string;
23
23
  routeModuleBodyStartedAt?: number;
24
+ basePath?: string;
24
25
  }): (req: Request) => Promise<Response>;
25
26
  //# sourceMappingURL=runtime.d.ts.map