eve 0.27.0 → 0.27.1
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.
- package/CHANGELOG.md +18 -0
- package/dist/src/channel/resolve-active-session.d.ts +4 -0
- package/dist/src/channel/resolve-active-session.js +1 -0
- package/dist/src/channel/routes.d.ts +11 -0
- package/dist/src/cli/dev/tui/vercel-trusted-sources-policy.d.ts +1 -1
- package/dist/src/cli/dev/tui/vercel-trusted-sources.js +1 -1
- package/dist/src/compiled/.vendor-stamp.json +16 -16
- package/dist/src/compiled/@ai-sdk/anthropic/index.js +2 -2
- package/dist/src/compiled/@ai-sdk/google/index.d.ts +9 -2
- package/dist/src/compiled/@ai-sdk/google/index.js +6 -6
- package/dist/src/compiled/@ai-sdk/mcp/index.d.ts +18 -3
- package/dist/src/compiled/@ai-sdk/mcp/index.js +1 -1
- package/dist/src/compiled/@ai-sdk/openai/index.d.ts +285 -24
- package/dist/src/compiled/@ai-sdk/openai/index.js +2 -2
- package/dist/src/compiled/@ai-sdk/otel/index.js +1 -1
- package/dist/src/compiled/@ai-sdk/provider-utils/index.d.ts +7 -3
- package/dist/src/compiled/@vercel/oidc/index.js +28 -2
- package/dist/src/compiled/@vercel/sandbox/api-client/api-client.d.ts +11 -0
- package/dist/src/compiled/@vercel/sandbox/api-client/validators.d.ts +7 -0
- package/dist/src/compiled/@vercel/sandbox/command.d.ts +8 -0
- package/dist/src/compiled/@vercel/sandbox/execution-context.d.ts +116 -0
- package/dist/src/compiled/@vercel/sandbox/index.d.ts +3 -1
- package/dist/src/compiled/@vercel/sandbox/index.js +20 -19
- package/dist/src/compiled/@vercel/sandbox/network-policy.d.ts +13 -5
- package/dist/src/compiled/@vercel/sandbox/sandbox-user.d.ts +212 -0
- package/dist/src/compiled/@vercel/sandbox/sandbox.d.ts +133 -2
- package/dist/src/compiled/@vercel/sandbox/session.d.ts +2 -1
- package/dist/src/compiled/@vercel/sandbox/snapshot.d.ts +1 -1
- package/dist/src/compiled/@workflow/core/create-hook.d.ts +41 -22
- package/dist/src/compiled/@workflow/core/flushable-stream.d.ts +29 -0
- package/dist/src/compiled/@workflow/core/global.d.ts +2 -0
- package/dist/src/compiled/@workflow/core/index.js +2 -2
- package/dist/src/compiled/@workflow/core/private.d.ts +6 -17
- package/dist/src/compiled/@workflow/core/private.js +1 -1
- package/dist/src/compiled/@workflow/core/replay-payload-cache.d.ts +56 -0
- package/dist/src/compiled/@workflow/core/runtime/constants.d.ts +11 -0
- package/dist/src/compiled/@workflow/core/runtime/helpers.d.ts +6 -4
- package/dist/src/compiled/@workflow/core/runtime/resume-hook.d.ts +4 -1
- package/dist/src/compiled/@workflow/core/runtime/step-executor.d.ts +39 -0
- package/dist/src/compiled/@workflow/core/runtime.js +3 -3
- package/dist/src/compiled/@workflow/core/serialization.d.ts +44 -4
- package/dist/src/compiled/@workflow/core/symbols.d.ts +13 -0
- package/dist/src/compiled/@workflow/core/version.d.ts +1 -1
- package/dist/src/compiled/@workflow/core/workflow.js +1 -1
- package/dist/src/compiled/@workflow/errors/error-codes.d.ts +2 -0
- package/dist/src/compiled/@workflow/errors/index.d.ts +14 -0
- package/dist/src/compiled/@workflow/errors/index.js +1 -1
- package/dist/src/compiled/@workflow/world/events.d.ts +15 -0
- package/dist/src/compiled/@workflow/world/hooks.d.ts +2 -1
- package/dist/src/compiled/@workflow/world/interfaces.d.ts +77 -4
- package/dist/src/compiled/@workflow/world-local/index.js +4 -4
- package/dist/src/compiled/@workflow/world-vercel/index.js +16 -16
- package/dist/src/compiled/_chunks/node/{auth-BuQkq4Gr.js → auth-l7F2PF2b.js} +2 -2
- package/dist/src/compiled/_chunks/node/{version-DD-FX9rK.js → version-CjHTLx2a.js} +1 -1
- package/dist/src/compiled/_chunks/node/virtual-loader-Cwgujv7l.js +1 -0
- package/dist/src/compiled/_chunks/workflow/attribute-changes-Dk1fP6vt.js +20 -0
- package/dist/src/compiled/_chunks/workflow/{chunk-BHKSVoKr.js → chunk-BTyA9uPd.js} +1 -1
- package/dist/src/compiled/_chunks/workflow/dist-B3qkUnLJ.js +3 -0
- package/dist/src/compiled/_chunks/workflow/{dist-CSfKNxQW.js → dist-BX517Nmz.js} +2 -2
- package/dist/src/compiled/_chunks/workflow/{dist-zLevmMyU.js → dist-C_VDTghO.js} +10 -10
- package/dist/src/compiled/_chunks/workflow/{dist-CttsoN4D.js → dist-CrxV2rsR.js} +1 -1
- package/dist/src/compiled/_chunks/workflow/{functions-PT9ri9Hu.js → functions-Dv8dc_-I.js} +1 -1
- package/dist/src/compiled/_chunks/workflow/resume-hook-czpG5xnP.js +1 -0
- package/dist/src/compiled/_chunks/workflow/run-6zaMjFY6.js +1 -0
- package/dist/src/compiled/_chunks/workflow/sleep-B2u06FWc.js +1 -0
- package/dist/src/compiled/_chunks/workflow/{src-CQuMexnO.js → src-D1EltLDA.js} +1 -1
- package/dist/src/compiled/_chunks/workflow/{token-CaY0nA5J.js → token-Cz223z3C.js} +1 -1
- package/dist/src/compiled/_chunks/workflow/token-DWqA5-DA.js +1 -0
- package/dist/src/compiled/_chunks/workflow/token-util-B6qBs3-0.js +27 -0
- package/dist/src/compiled/_chunks/workflow/{undici-fb54XL8i.js → undici-C2ZhYnV9.js} +1 -1
- package/dist/src/compiled/_chunks/workflow/wrapper-Cc2otuUR.js +6 -0
- package/dist/src/compiled/env-runner/index.js +1 -1
- package/dist/src/compiled/env-runner/node-worker.js +1 -1
- package/dist/src/compiled/eventsource-parser/stream/index.d.ts +16 -3
- package/dist/src/compiled/jose/index.js +1 -1
- package/dist/src/compiler/compile-from-memory.d.ts +5 -0
- package/dist/src/compiler/compile-from-memory.js +1 -1
- package/dist/src/compiler/extension-compatibility.d.ts +10 -10
- package/dist/src/compiler/extension-compatibility.js +1 -1
- package/dist/src/execution/deliver-payloads.d.ts +1 -1
- package/dist/src/execution/deliver-payloads.js +1 -1
- package/dist/src/execution/workflow-entry.js +1 -1
- package/dist/src/execution/workflow-steps.js +1 -1
- package/dist/src/harness/session-limit-continuation.d.ts +8 -0
- package/dist/src/harness/session-limit-continuation.js +1 -1
- package/dist/src/harness/session-limit-enforcement.d.ts +9 -6
- package/dist/src/harness/session-limit-enforcement.js +1 -1
- package/dist/src/harness/stale-input-responses.d.ts +21 -3
- package/dist/src/harness/stale-input-responses.js +2 -2
- package/dist/src/harness/tool-loop.js +2 -2
- package/dist/src/harness/turn-cancellation.d.ts +13 -0
- package/dist/src/harness/turn-cancellation.js +1 -1
- package/dist/src/internal/application/package.js +1 -1
- package/dist/src/internal/nitro/routes/channel-dispatch.js +1 -1
- package/dist/src/internal/workflow-bundle/vercel-workflow-output.js +1 -1
- package/dist/src/node_modules/.pnpm/@vercel_sdk@1.28.8/node_modules/@vercel/sdk/esm/models/updateprojectblock.js +1 -0
- package/dist/src/node_modules/.pnpm/@vercel_sdk@1.28.8/node_modules/@vercel/sdk/esm/models/updateprojectprojectsbranchmatcher.js +1 -0
- package/dist/src/packages/eve-catalog/src/index.js +1 -1
- package/dist/src/public/channels/discord/defaults.js +1 -1
- package/dist/src/public/channels/linear/api.d.ts +2 -0
- package/dist/src/public/channels/linear/api.js +3 -1
- package/dist/src/public/channels/linear/defaults.js +2 -2
- package/dist/src/public/channels/linear/hitl.d.ts +8 -13
- package/dist/src/public/channels/linear/hitl.js +3 -3
- package/dist/src/public/channels/linear/index.d.ts +1 -1
- package/dist/src/public/channels/linear/index.js +1 -1
- package/dist/src/public/channels/linear/linearChannel.js +1 -1
- package/dist/src/public/channels/slack/api.d.ts +20 -0
- package/dist/src/public/channels/slack/api.js +1 -1
- package/dist/src/public/channels/slack/defaults.js +1 -1
- package/dist/src/public/channels/slack/inbound.d.ts +31 -0
- package/dist/src/public/channels/slack/inbound.js +1 -1
- package/dist/src/public/channels/slack/index.d.ts +2 -2
- package/dist/src/public/channels/slack/slackChannel.d.ts +72 -4
- package/dist/src/public/channels/slack/slackChannel.js +1 -1
- package/dist/src/public/channels/teams/defaults.js +2 -2
- package/dist/src/public/channels/teams/index.d.ts +1 -1
- package/dist/src/public/channels/teams/teamsChannel.d.ts +7 -2
- package/dist/src/public/channels/teams/teamsChannel.js +1 -1
- package/dist/src/public/channels/telegram/defaults.js +1 -1
- package/dist/src/public/definitions/channel.d.ts +1 -1
- package/dist/src/runtime/framework-tools/connection-search-dynamic.js +2 -1
- package/dist/src/setup/scaffold/create/add-to-project.js +1 -1
- package/dist/src/setup/scaffold/create/project.js +2 -2
- package/dist/src/setup/scaffold/create/web-template.d.ts +1 -1
- package/dist/src/setup/scaffold/create/web-template.js +90 -5
- package/dist/src/setup/scaffold/update/channels.js +2 -2
- package/dist/src/setup/scaffold/update/connections.js +1 -1
- package/docs/agent-config.md +10 -5
- package/docs/channels/slack.mdx +76 -10
- package/docs/channels/teams.mdx +10 -3
- package/docs/guides/deployment/vercel.mdx +1 -1
- package/docs/guides/frontend/overview.mdx +2 -0
- package/package.json +22 -22
- package/dist/src/compiled/@workflow/core/step-hydration-cache.d.ts +0 -148
- package/dist/src/compiled/_chunks/node/virtual-loader-B8K8w9cr.js +0 -1
- package/dist/src/compiled/_chunks/workflow/attribute-changes-CXiYB8h9.js +0 -20
- package/dist/src/compiled/_chunks/workflow/dist-BYo8Gno2.js +0 -3
- package/dist/src/compiled/_chunks/workflow/resume-hook-CHXbXuRZ.js +0 -1
- package/dist/src/compiled/_chunks/workflow/run-BjtAGa3_.js +0 -1
- package/dist/src/compiled/_chunks/workflow/sleep-BJAv0MFP.js +0 -1
- package/dist/src/compiled/_chunks/workflow/token-D4VIwGlD.js +0 -1
- package/dist/src/compiled/_chunks/workflow/wrapper-ulTvoTdW.js +0 -6
- package/dist/src/node_modules/.pnpm/@vercel_sdk@1.28.1/node_modules/@vercel/sdk/esm/models/updateprojectprojectsaction.js +0 -1
- package/dist/src/node_modules/.pnpm/@vercel_sdk@1.28.1/node_modules/@vercel/sdk/esm/models/updateprojectprojectsoptionsallowlist.js +0 -1
- /package/dist/src/node_modules/.pnpm/{@vercel_sdk@1.28.1 → @vercel_sdk@1.28.8}/node_modules/@vercel/sdk/esm/lib/primitives.js +0 -0
- /package/dist/src/node_modules/.pnpm/{@vercel_sdk@1.28.1 → @vercel_sdk@1.28.8}/node_modules/@vercel/sdk/esm/lib/schemas.js +0 -0
- /package/dist/src/node_modules/.pnpm/{@vercel_sdk@1.28.1 → @vercel_sdk@1.28.8}/node_modules/@vercel/sdk/esm/models/aclaction.js +0 -0
- /package/dist/src/node_modules/.pnpm/{@vercel_sdk@1.28.1 → @vercel_sdk@1.28.8}/node_modules/@vercel/sdk/esm/models/sdkvalidationerror.js +0 -0
- /package/dist/src/node_modules/.pnpm/{@vercel_sdk@1.28.1 → @vercel_sdk@1.28.8}/node_modules/@vercel/sdk/esm/types/defaultToZeroValue.js +0 -0
- /package/dist/src/node_modules/.pnpm/{@vercel_sdk@1.28.1 → @vercel_sdk@1.28.8}/node_modules/@vercel/sdk/esm/types/fp.js +0 -0
- /package/dist/src/node_modules/.pnpm/{@vercel_sdk@1.28.1 → @vercel_sdk@1.28.8}/node_modules/@vercel/sdk/esm/types/primitives.js +0 -0
- /package/dist/src/node_modules/.pnpm/{@vercel_sdk@1.28.1 → @vercel_sdk@1.28.8}/node_modules/@vercel/sdk/esm/types/rfcdate.js +0 -0
- /package/dist/src/node_modules/.pnpm/{@vercel_sdk@1.28.1 → @vercel_sdk@1.28.8}/node_modules/@vercel/sdk/esm/types/smartUnion.js +0 -0
- /package/dist/src/node_modules/.pnpm/{@vercel_sdk@1.28.1 → @vercel_sdk@1.28.8}/node_modules/@vercel/sdk/esm/types/unrecognized.js +0 -0
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Utils used by the bundler when transforming code
|
|
3
3
|
*/
|
|
4
|
+
import type { WorldCapabilities } from '#compiled/@workflow/world/index.js';
|
|
4
5
|
import type { CryptoKey } from './encryption.js';
|
|
5
6
|
import type { EventsConsumer } from './events-consumer.js';
|
|
6
7
|
import type { QueueItem } from './global.js';
|
|
8
|
+
import type { ReplayPayloadCache } from './replay-payload-cache.js';
|
|
7
9
|
import type { Serializable } from './schemas.js';
|
|
8
|
-
import type { StepHydrationCache } from './step-hydration-cache.js';
|
|
9
10
|
export type StepFunction<Args extends Serializable[] = any[], Result extends Serializable | unknown = unknown> = ((...args: Args) => Promise<Result>) & {
|
|
10
11
|
maxRetries?: number;
|
|
11
12
|
stepId?: string;
|
|
@@ -27,6 +28,7 @@ export declare function getStepFunction(stepId: string): StepFunction | undefine
|
|
|
27
28
|
export interface WorkflowOrchestratorContext {
|
|
28
29
|
runId: string;
|
|
29
30
|
encryptionKey: CryptoKey | undefined;
|
|
31
|
+
worldCapabilities?: WorldCapabilities;
|
|
30
32
|
globalThis: typeof globalThis;
|
|
31
33
|
eventsConsumer: EventsConsumer;
|
|
32
34
|
/**
|
|
@@ -85,23 +87,10 @@ export interface WorkflowOrchestratorContext {
|
|
|
85
87
|
*/
|
|
86
88
|
pendingDeliveryBarriers?: Map<number, DeliveryBarrierEntry>;
|
|
87
89
|
/**
|
|
88
|
-
*
|
|
89
|
-
*
|
|
90
|
-
* and threaded through each `runWorkflow` call so it survives across replay
|
|
91
|
-
* iterations of the SAME run (a fresh context is created each iteration) but
|
|
92
|
-
* never leaks across unrelated runs.
|
|
93
|
-
*
|
|
94
|
-
* On replay K of a sequential N-step workflow, the step consumer would
|
|
95
|
-
* otherwise re-decrypt and re-parse the results of all K already-completed
|
|
96
|
-
* steps — O(N²) across an invocation. This cache makes a completed step's
|
|
97
|
-
* result available in O(1) on subsequent replays. Only primitive results are
|
|
98
|
-
* memoized, so a shared reference can never let one replay's mutation leak
|
|
99
|
-
* into the next; see `step-hydration-cache.ts` for the full rationale.
|
|
100
|
-
*
|
|
101
|
-
* Optional so contexts that do not initialize it (test harnesses) degrade
|
|
102
|
-
* gracefully to re-hydrating every replay — identical to previous behavior.
|
|
90
|
+
* Invocation-scoped cache of prepared serialized payloads and immutable final
|
|
91
|
+
* values. Prepared bytes survive fresh replay VMs; object graphs do not.
|
|
103
92
|
*/
|
|
104
|
-
|
|
93
|
+
replayPayloadCache: ReplayPayloadCache;
|
|
105
94
|
}
|
|
106
95
|
/** The kind of branch-deciding delivery a barrier represents. */
|
|
107
96
|
export type DeliveryKind = 'hook' | 'wait';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{c as e}from"../../_chunks/workflow/dist-
|
|
1
|
+
import{c as e}from"../../_chunks/workflow/dist-CrxV2rsR.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};
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import type { Event, WorkflowRun } from '#compiled/@workflow/world/index.js';
|
|
2
|
+
import type { CryptoKey } from './encryption.js';
|
|
3
|
+
import { type PreparedReplayPayload, type ReplayPayloadPreparer } from './serialization.js';
|
|
4
|
+
type ReplayPayloadField = 'result' | 'error' | 'payload';
|
|
5
|
+
/**
|
|
6
|
+
* Invocation-scoped cache for replay payload hydration.
|
|
7
|
+
*
|
|
8
|
+
* A workflow invocation may replay the same event log through several fresh
|
|
9
|
+
* VMs. This cache keeps the VM-independent decrypt/decompress result across
|
|
10
|
+
* those replays. Deserialization still runs against each VM's globals so every
|
|
11
|
+
* replay receives fresh object graphs and correctly revived Workflow objects.
|
|
12
|
+
*
|
|
13
|
+
* Successful prepared plaintext remains resident for the invocation lifetime.
|
|
14
|
+
* Its memory cost is the sum of decrypted and decompressed payload sizes, but
|
|
15
|
+
* it never crosses workflow runs or queue deliveries.
|
|
16
|
+
*/
|
|
17
|
+
export declare class ReplayPayloadCache {
|
|
18
|
+
private readonly encryptionKey;
|
|
19
|
+
private readonly preparer;
|
|
20
|
+
private readonly preparedPayloads;
|
|
21
|
+
private readonly primitiveStepResults;
|
|
22
|
+
constructor(encryptionKey: CryptoKey | undefined, preparer?: ReplayPayloadPreparer);
|
|
23
|
+
/**
|
|
24
|
+
* Start every missing binary preparation before workflow execution. Failures
|
|
25
|
+
* are intentionally retained: the ordered event consumer must observe the
|
|
26
|
+
* original rejection before that entry becomes retryable.
|
|
27
|
+
*/
|
|
28
|
+
prewarm(workflowRun: WorkflowRun, events: Event[]): Promise<void>;
|
|
29
|
+
/** Return the workflow input after shared host-side preparation. */
|
|
30
|
+
prepareWorkflowInput(workflowRun: WorkflowRun): Promise<PreparedReplayPayload>;
|
|
31
|
+
/**
|
|
32
|
+
* Return an event payload after shared host-side preparation. A rejected
|
|
33
|
+
* preparation is evicted only after this ordered consumer requests it, so a
|
|
34
|
+
* later replay can retry without hiding the original failure.
|
|
35
|
+
*/
|
|
36
|
+
prepareEventPayload(eventId: string, field: ReplayPayloadField, value: unknown): Promise<PreparedReplayPayload>;
|
|
37
|
+
/**
|
|
38
|
+
* Reuse final step values only when sharing them across VMs is unobservable.
|
|
39
|
+
* Objects and large strings/bigints always run `hydrate` again, producing a
|
|
40
|
+
* fresh VM-specific value from the separately cached prepared payload.
|
|
41
|
+
*/
|
|
42
|
+
getStepResult(eventId: string, hydrate: () => Promise<unknown>): Promise<unknown>;
|
|
43
|
+
/**
|
|
44
|
+
* Consumer-facing lookup. Binary payloads share preparation; legacy values
|
|
45
|
+
* bypass the cache because their flattened representation may be mutated.
|
|
46
|
+
*/
|
|
47
|
+
private consumePreparation;
|
|
48
|
+
/** Start preparation once and share the exact in-flight promise. */
|
|
49
|
+
private ensurePreparation;
|
|
50
|
+
/** Normalize synchronous and asynchronous preparers to one promise contract. */
|
|
51
|
+
private runPreparation;
|
|
52
|
+
private workflowInputKey;
|
|
53
|
+
private eventPayloadKey;
|
|
54
|
+
}
|
|
55
|
+
export {};
|
|
56
|
+
//# sourceMappingURL=replay-payload-cache.d.ts.map
|
|
@@ -85,6 +85,17 @@ export declare const MAX_MAX_INLINE_STEPS = 16;
|
|
|
85
85
|
* one-time warning so misconfiguration is observable.
|
|
86
86
|
*/
|
|
87
87
|
export declare function getMaxInlineSteps(): number;
|
|
88
|
+
/**
|
|
89
|
+
* Optional client-side override for the server-supplied per-run event ceiling.
|
|
90
|
+
* When set to a positive integer, the runtime clamps the server's limit *down*
|
|
91
|
+
* to this value (never raises it) so enforcement can be exercised without a
|
|
92
|
+
* server-side change. `undefined` (unset) ⇒ use the server value as-is.
|
|
93
|
+
*
|
|
94
|
+
* Reads `process.env.WORKFLOW_MAX_EVENTS_OVERRIDE` lazily so tests and
|
|
95
|
+
* deployments can override per invocation. Invalid values fall back to unset
|
|
96
|
+
* (no throw — the env var is an escape hatch) and emit a one-time warning.
|
|
97
|
+
*/
|
|
98
|
+
export declare function getMaxEventsOverride(): number | undefined;
|
|
88
99
|
/**
|
|
89
100
|
* Whether optimistic inline step start is enabled. When on, the owned-inline
|
|
90
101
|
* path begins running a brand-new step's body *before* its lazy `step_started`
|
|
@@ -89,10 +89,12 @@ export interface MutableEventLog {
|
|
|
89
89
|
cursor: string | null;
|
|
90
90
|
}
|
|
91
91
|
/**
|
|
92
|
-
* Whether the optimistic-concurrency guard for event creation is enabled
|
|
93
|
-
*
|
|
94
|
-
*
|
|
95
|
-
*
|
|
92
|
+
* Whether the optimistic-concurrency guard for event creation is enabled.
|
|
93
|
+
* **On by default** where the runtime executes: replay-context creates send a
|
|
94
|
+
* `stateUpdatedAt` snapshot (and can be rejected with 412 by a supporting
|
|
95
|
+
* backend) unless `WORKFLOW_PRECONDITION_GUARD` is set to `0`. Backends without
|
|
96
|
+
* guard support ignore the snapshot, so enabling by default is
|
|
97
|
+
* backward-compatible.
|
|
96
98
|
*/
|
|
97
99
|
export declare function isPreconditionGuardEnabled(): boolean;
|
|
98
100
|
/**
|
|
@@ -5,6 +5,9 @@ import { type CryptoKey } from '../encryption.js';
|
|
|
5
5
|
* and hydrate the `metadata` property if it was set from within
|
|
6
6
|
* the workflow run.
|
|
7
7
|
*
|
|
8
|
+
* A Hook kept by minimum retention remains available here after its run ends,
|
|
9
|
+
* but cannot be resumed.
|
|
10
|
+
*
|
|
8
11
|
* @param token - The unique token identifying the hook
|
|
9
12
|
*/
|
|
10
13
|
export declare function getHookByToken(token: string): Promise<Hook>;
|
|
@@ -17,7 +20,7 @@ export declare function getHookByToken(token: string): Promise<Hook>;
|
|
|
17
20
|
* @param tokenOrHook - The unique token identifying the hook, or the hook object itself
|
|
18
21
|
* @param payload - The data payload to send to the hook
|
|
19
22
|
* @returns Promise resolving to the hook
|
|
20
|
-
* @throws
|
|
23
|
+
* @throws {HookNotFoundError} If the Hook does not exist or its run has ended
|
|
21
24
|
*
|
|
22
25
|
* @example
|
|
23
26
|
*
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { Event, SerializedData, World } from '#compiled/@workflow/world/index.js';
|
|
2
2
|
import type { CryptoKey } from '../encryption.js';
|
|
3
3
|
import { type StepLatencyTracking } from './step-latency.js';
|
|
4
|
+
export declare const DEFAULT_STEP_MAX_RETRIES = 3;
|
|
4
5
|
export interface StepExecutorParams {
|
|
5
6
|
world: World;
|
|
6
7
|
workflowRunId: string;
|
|
@@ -54,6 +55,33 @@ export interface StepExecutorParams {
|
|
|
54
55
|
* handler is the sole inline writer for the run on this iteration.
|
|
55
56
|
*/
|
|
56
57
|
inlineDeltaSinceCursor?: string;
|
|
58
|
+
/**
|
|
59
|
+
* Precondition-guard snapshot (epoch ms of the latest event the caller's
|
|
60
|
+
* replay loaded) to attach to this step's `step_started` claim. On the lazy
|
|
61
|
+
* inline path the claim is the step's FIRST durable write (its
|
|
62
|
+
* `step_created` is deferred), so without this the claim would bypass the
|
|
63
|
+
* optimistic-concurrency guard entirely: a replay working from a stale view
|
|
64
|
+
* could claim — and then commit — a step scheduled without observing an
|
|
65
|
+
* out-of-band event. A guard-enforcing World rejects a stale claim with
|
|
66
|
+
* `PreconditionFailedError` (412); executeStep does NOT translate that
|
|
67
|
+
* rejection (re-claiming in place would still commit the stale schedule),
|
|
68
|
+
* so it propagates for the caller to abandon the batch and force a fresh
|
|
69
|
+
* replay. Undefined when the guard is disabled or the caller has no
|
|
70
|
+
* snapshot; Worlds that don't enforce the guard ignore it.
|
|
71
|
+
*/
|
|
72
|
+
stateUpdatedAt?: number;
|
|
73
|
+
/**
|
|
74
|
+
* Suppress optimistic inline start for this step regardless of
|
|
75
|
+
* `WORKFLOW_OPTIMISTIC_INLINE_START` / `forceOptimisticStart`: take the
|
|
76
|
+
* await-then-run path so the body only runs after the `step_started` claim
|
|
77
|
+
* succeeds. Set by the runtime for guard-enforced batches that are
|
|
78
|
+
* stale-sensitive (an open hook means an out-of-band event can make the
|
|
79
|
+
* scheduling view stale): the guard's 412 fence can reject a stale claim's
|
|
80
|
+
* durable writes, but it cannot un-run a body that optimistic start began
|
|
81
|
+
* before the claim settled — awaiting the claim extends the fence to user
|
|
82
|
+
* code. Wins over `forceOptimisticStart` and the env flag.
|
|
83
|
+
*/
|
|
84
|
+
suppressOptimisticStart?: boolean;
|
|
57
85
|
/**
|
|
58
86
|
* Force optimistic inline start regardless of
|
|
59
87
|
* `WORKFLOW_OPTIMISTIC_INLINE_START`. Set by turbo mode on the first delivery
|
|
@@ -80,6 +108,17 @@ export interface StepExecutorParams {
|
|
|
80
108
|
* runtime/step-latency.ts.
|
|
81
109
|
*/
|
|
82
110
|
latencyTracking?: StepLatencyTracking;
|
|
111
|
+
/**
|
|
112
|
+
* Authoritative attempt number for this execution, used to bound retries
|
|
113
|
+
* against `maxRetries` BEFORE the body runs. In order to also catch
|
|
114
|
+
* step timeouts (which we can't have catch handlers for), we determine
|
|
115
|
+
* the attempt count based as follows:
|
|
116
|
+
* - Inline (combined handler): the number of `step_started` events already
|
|
117
|
+
* in the event log for this step, plus one for the attempt about to run.
|
|
118
|
+
* - Background (queue-dispatched): the queue delivery count
|
|
119
|
+
* (`metadata.attempt`), which increments on every redelivery.
|
|
120
|
+
*/
|
|
121
|
+
authoritativeAttempt?: number;
|
|
83
122
|
}
|
|
84
123
|
/**
|
|
85
124
|
* Inline-delta returned by a step-terminal write when the caller passed
|