eve 0.13.3 → 0.13.4
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 +12 -0
- package/dist/src/chunks/use-eve-agent-BLv-Mj5g.js +1512 -0
- package/dist/src/chunks/use-eve-agent-C8UVUMA4.js +1542 -0
- package/dist/src/client/agent-info-schema.d.ts +1 -1
- package/dist/src/client/agent-info-schema.js +1 -1
- package/dist/src/compiled/.vendor-stamp.json +3 -3
- package/dist/src/compiled/@ai-sdk/anthropic/index.js +2 -2
- package/dist/src/compiled/@ai-sdk/google/index.js +6 -6
- package/dist/src/compiled/@ai-sdk/mcp/index.js +1 -1
- package/dist/src/compiled/@ai-sdk/openai/index.js +2 -2
- package/dist/src/compiled/@workflow/core/create-hook.d.ts +3 -1
- package/dist/src/compiled/@workflow/core/events-consumer.d.ts +9 -0
- package/dist/src/compiled/@workflow/core/index.js +2 -2
- package/dist/src/compiled/@workflow/core/logger.d.ts +1 -0
- package/dist/src/compiled/@workflow/core/private.d.ts +35 -2
- package/dist/src/compiled/@workflow/core/runtime/constants.d.ts +73 -0
- package/dist/src/compiled/@workflow/core/runtime/get-port-lazy.d.ts +15 -0
- package/dist/src/compiled/@workflow/core/runtime/run-id-time.d.ts +10 -0
- package/dist/src/compiled/@workflow/core/runtime/step-executor.d.ts +61 -1
- package/dist/src/compiled/@workflow/core/runtime/suspension-handler.d.ts +38 -2
- package/dist/src/compiled/@workflow/core/runtime.d.ts +1 -0
- package/dist/src/compiled/@workflow/core/runtime.js +28 -28
- package/dist/src/compiled/@workflow/core/source-map.d.ts +5 -0
- package/dist/src/compiled/@workflow/core/step/context-storage.d.ts +27 -0
- package/dist/src/compiled/@workflow/core/step-hydration-cache.d.ts +148 -0
- package/dist/src/compiled/@workflow/core/telemetry/semantic-conventions.d.ts +28 -0
- package/dist/src/compiled/@workflow/core/telemetry.d.ts +9 -6
- package/dist/src/compiled/@workflow/core/version.d.ts +1 -1
- package/dist/src/compiled/@workflow/core/vm/script-cache.d.ts +28 -0
- package/dist/src/compiled/@workflow/core/workflow.js +1 -1
- package/dist/src/compiled/@workflow/world/events.d.ts +78 -3
- package/dist/src/compiled/@workflow/world/index.d.ts +1 -1
- package/dist/src/compiled/@workflow/world/spec-version.d.ts +11 -1
- package/dist/src/compiled/_chunks/{workflow/core-CXJbIkCL.js → client/core-Bm8azZA6.js} +5 -5
- package/dist/src/compiled/_chunks/workflow/{attribute-changes-Bi5DLT8S.js → attribute-changes-DUxG-Gic.js} +3 -3
- package/dist/src/compiled/_chunks/workflow/dist-C9PV_vnE.js +77 -0
- package/dist/src/compiled/_chunks/workflow/resume-hook-CUCPW67D.js +1 -0
- package/dist/src/compiled/_chunks/workflow/{run-XM8dTRAo.js → run-CVlF84yI.js} +1 -1
- package/dist/src/compiled/_chunks/workflow/sleep-Dxuzj5to.js +1 -0
- package/dist/src/compiled/zod/index.js +1 -1
- package/dist/src/compiled/zod-validation-error/index.js +1 -1
- package/dist/src/execution/workflow-steps.js +1 -1
- package/dist/src/harness/authorization.d.ts +1 -0
- package/dist/src/harness/authorization.js +1 -1
- package/dist/src/internal/application/optional-package-install.js +15 -1
- package/dist/src/internal/application/package.js +1 -1
- package/dist/src/setup/scaffold/create/project.js +1 -1
- package/dist/src/svelte/index.js +1 -1
- package/dist/src/svelte/use-eve-agent.js +1 -1
- package/dist/src/vue/index.js +1 -1
- package/dist/src/vue/use-eve-agent.js +1 -1
- package/package.json +4 -4
- package/dist/src/chunks/use-eve-agent-B18LYpfZ.js +0 -5765
- package/dist/src/chunks/use-eve-agent-BPI1nbo5.js +0 -5795
- package/dist/src/compiled/_chunks/workflow/coerce-B-Ro4Nfe.js +0 -1
- package/dist/src/compiled/_chunks/workflow/compat-DLpWymPP.js +0 -1
- package/dist/src/compiled/_chunks/workflow/dist-DTchiX0N.js +0 -14
- package/dist/src/compiled/_chunks/workflow/resume-hook-CKTw-lb5.js +0 -1
- package/dist/src/compiled/_chunks/workflow/schemas-iG9Z4s4o.js +0 -1
- package/dist/src/compiled/_chunks/workflow/sleep-DPjVkRY-.js +0 -1
|
@@ -5,6 +5,7 @@ import type { CryptoKey } from './encryption.js';
|
|
|
5
5
|
import type { EventsConsumer } from './events-consumer.js';
|
|
6
6
|
import type { QueueItem } from './global.js';
|
|
7
7
|
import type { Serializable } from './schemas.js';
|
|
8
|
+
import type { StepHydrationCache } from './step-hydration-cache.js';
|
|
8
9
|
export type StepFunction<Args extends Serializable[] = any[], Result extends Serializable | unknown = unknown> = ((...args: Args) => Promise<Result>) & {
|
|
9
10
|
maxRetries?: number;
|
|
10
11
|
stepId?: string;
|
|
@@ -46,8 +47,10 @@ export interface WorkflowOrchestratorContext {
|
|
|
46
47
|
promiseQueue: Promise<void>;
|
|
47
48
|
/**
|
|
48
49
|
* Counter of in-flight async data delivery operations (step result
|
|
49
|
-
* hydration, hook payload hydration). Suspensions
|
|
50
|
-
* to reach 0 before firing, to avoid preempting data
|
|
50
|
+
* hydration, hook payload hydration, abort signal hydration). Suspensions
|
|
51
|
+
* must wait for this to reach 0 before firing, to avoid preempting data
|
|
52
|
+
* delivery — e.g. dehydrating a step's arguments while an abort that should
|
|
53
|
+
* be reflected in those arguments is still hydrating its reason.
|
|
51
54
|
*/
|
|
52
55
|
pendingDeliveries: number;
|
|
53
56
|
/**
|
|
@@ -81,6 +84,24 @@ export interface WorkflowOrchestratorContext {
|
|
|
81
84
|
* that do not initialize it degrade gracefully to the previous behavior.
|
|
82
85
|
*/
|
|
83
86
|
pendingDeliveryBarriers?: Map<number, DeliveryBarrierEntry>;
|
|
87
|
+
/**
|
|
88
|
+
* Per-run memoization cache for hydrated step return values, keyed by the
|
|
89
|
+
* `step_completed` event id. Owned by the inline replay loop in `runtime.ts`
|
|
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.
|
|
103
|
+
*/
|
|
104
|
+
stepHydrationCache?: StepHydrationCache;
|
|
84
105
|
}
|
|
85
106
|
/** The kind of branch-deciding delivery a barrier represents. */
|
|
86
107
|
export type DeliveryKind = 'hook' | 'wait';
|
|
@@ -129,6 +150,18 @@ export declare function registerDeliveryBarrier(ctx: WorkflowOrchestratorContext
|
|
|
129
150
|
* if > 0, wait for promiseQueue → repeat. This handles the multi-round
|
|
130
151
|
* delivery pattern where each hook payload delivery cycle appends new
|
|
131
152
|
* async work to the promiseQueue.
|
|
153
|
+
*
|
|
154
|
+
* The initial `setTimeout(0)` macrotask is load-bearing and must NOT be
|
|
155
|
+
* downgraded to a microtask (`queueMicrotask`/`Promise.resolve().then`).
|
|
156
|
+
* `pendingDeliveries` only guards the host-side hydration window; between a
|
|
157
|
+
* delivery's `resolve()` and the workflow VM body running its continuation to
|
|
158
|
+
* register the next subscriber, `pendingDeliveries` is already 0 even though
|
|
159
|
+
* the VM is mid-reaction. Node does not guarantee a microtask scheduled in
|
|
160
|
+
* the host context settles after the cross-VM promise chain (resolve in host
|
|
161
|
+
* → workflow code in VM → subscribe back in host); the macrotask boundary
|
|
162
|
+
* gives that chain time to run, so the suspension does not preempt a sibling
|
|
163
|
+
* delivery still in flight. Empirically, replacing it with `queueMicrotask`
|
|
164
|
+
* breaks hook/sleep `Promise.race` ordering (CorruptedEventLogError).
|
|
132
165
|
*/
|
|
133
166
|
export declare function scheduleWhenIdle(ctx: WorkflowOrchestratorContext, fn: () => void): void;
|
|
134
167
|
export {};
|
|
@@ -48,5 +48,78 @@ export declare function getReplayTimeoutMs(): number;
|
|
|
48
48
|
*/
|
|
49
49
|
export declare function _resetReplayTimeoutWarnCacheForTests(): void;
|
|
50
50
|
export declare const REPLAY_TIMEOUT_MAX_RETRIES = 3;
|
|
51
|
+
/**
|
|
52
|
+
* Default maximum number of steps the owned-inline path runs inline (in
|
|
53
|
+
* parallel) per suspension. The rest are queued to background handlers. Each
|
|
54
|
+
* inline step is created lazily — its `step_created` is folded into the
|
|
55
|
+
* `step_started` that `executeStep` sends — so inlining N steps saves N queue
|
|
56
|
+
* round-trips for a `Promise.all`-style fan-out. `1` reproduces the
|
|
57
|
+
* single-inline-step behavior exactly (useful kill-switch).
|
|
58
|
+
*
|
|
59
|
+
* Override via `WORKFLOW_MAX_INLINE_STEPS` (clamped to
|
|
60
|
+
* `MIN_MAX_INLINE_STEPS`..`MAX_MAX_INLINE_STEPS`).
|
|
61
|
+
*/
|
|
62
|
+
export declare const MAX_INLINE_STEPS = 3;
|
|
63
|
+
/** Lower bound for the inline-steps env override (1 = single inline step). */
|
|
64
|
+
export declare const MIN_MAX_INLINE_STEPS = 1;
|
|
65
|
+
/**
|
|
66
|
+
* Upper bound for the inline-steps env override. Inline bodies run in parallel
|
|
67
|
+
* within one function invocation, so this caps memory/CPU fan-out per handler.
|
|
68
|
+
*/
|
|
69
|
+
export declare const MAX_MAX_INLINE_STEPS = 16;
|
|
70
|
+
/**
|
|
71
|
+
* Resolve the effective max number of inline steps for the current process.
|
|
72
|
+
*
|
|
73
|
+
* Reads `process.env.WORKFLOW_MAX_INLINE_STEPS` lazily so tests and
|
|
74
|
+
* deployments can override per invocation. Invalid / out-of-range values fall
|
|
75
|
+
* back to a safe value (no throw — the env var is an escape hatch) and emit a
|
|
76
|
+
* one-time warning so misconfiguration is observable.
|
|
77
|
+
*/
|
|
78
|
+
export declare function getMaxInlineSteps(): number;
|
|
79
|
+
/**
|
|
80
|
+
* Whether optimistic inline step start is enabled. When on, the owned-inline
|
|
81
|
+
* path begins running a brand-new step's body *before* its lazy `step_started`
|
|
82
|
+
* network call resolves (the input is already known locally), awaiting the
|
|
83
|
+
* `step_started` only before the terminal write.
|
|
84
|
+
*
|
|
85
|
+
* This can run a step body more than once when handlers race for the same
|
|
86
|
+
* step's create-claim — both run the body before one wins. That is unsafe for
|
|
87
|
+
* steps with non-idempotent side effects; in particular, two concurrent runs
|
|
88
|
+
* of a step that writes to the workflow stream (e.g. an AI agent streaming
|
|
89
|
+
* tokens) can interleave and corrupt the stream data. So the optimization is
|
|
90
|
+
* **off by default** and must be explicitly opted into per deployment.
|
|
91
|
+
*
|
|
92
|
+
* Reads `process.env.WORKFLOW_OPTIMISTIC_INLINE_START` lazily. Default OFF;
|
|
93
|
+
* enabled only by an explicit `'1'` / `'true'`.
|
|
94
|
+
*/
|
|
95
|
+
export declare function isOptimisticInlineStartEnabled(): boolean;
|
|
96
|
+
/**
|
|
97
|
+
* Whether an operator has **explicitly disabled** optimistic inline start via
|
|
98
|
+
* `WORKFLOW_OPTIMISTIC_INLINE_START=0` / `=false`. Distinct from "unset": unset
|
|
99
|
+
* leaves the optimization off by default but lets turbo force it on; an explicit
|
|
100
|
+
* `0`/`false` is an operator opt-out that turbo must honor (turbo's forced
|
|
101
|
+
* optimistic start still runs a step body before `step_started`/`run_started` is
|
|
102
|
+
* confirmed, the property such an operator is opting out of), so
|
|
103
|
+
* `forceOptimisticStart` defers to this. Reads the env var lazily.
|
|
104
|
+
*/
|
|
105
|
+
export declare function isOptimisticInlineStartExplicitlyDisabled(): boolean;
|
|
106
|
+
/**
|
|
107
|
+
* Whether "turbo mode" is enabled. Turbo mode fast-paths the *first delivery of
|
|
108
|
+
* the first invocation* of a run (detected by the entrypoint via `runInput`
|
|
109
|
+
* presence + `metadata.attempt === 1`): it backgrounds the `run_started` event
|
|
110
|
+
* creation, skips the initial event-log load (nothing has been written yet),
|
|
111
|
+
* and forces optimistic inline step start for that invocation — independent of
|
|
112
|
+
* `WORKFLOW_OPTIMISTIC_INLINE_START`.
|
|
113
|
+
*
|
|
114
|
+
* Forcing optimistic start is safe here because the first delivery has no
|
|
115
|
+
* concurrent peer handler to race the step create-claim, so a step body runs
|
|
116
|
+
* exactly once. That single-handler guarantee ends as soon as the run creates a
|
|
117
|
+
* hook or wait (which introduce resume/parallel invocations), so the runtime
|
|
118
|
+
* exits turbo at that point.
|
|
119
|
+
*
|
|
120
|
+
* Reads `process.env.WORKFLOW_TURBO` lazily. Default **ON**; disabled only by an
|
|
121
|
+
* explicit `'0'` / `'false'` (case-insensitive).
|
|
122
|
+
*/
|
|
123
|
+
export declare function isTurboEnabled(): boolean;
|
|
51
124
|
export declare const REPLAY_DIVERGENCE_MAX_RETRIES = 3;
|
|
52
125
|
//# sourceMappingURL=constants.d.ts.map
|
|
@@ -7,4 +7,19 @@
|
|
|
7
7
|
* dependency is invisible to bundler static analysis.
|
|
8
8
|
*/
|
|
9
9
|
export declare function getPortLazy(): Promise<number | undefined>;
|
|
10
|
+
/**
|
|
11
|
+
* Resets the per-process port cache. Intended for tests; not used on the hot
|
|
12
|
+
* path. Callers must let any in-flight lookup settle (await the pending
|
|
13
|
+
* `getPortLazy()` call) before resetting: clearing `_inFlight` here does not
|
|
14
|
+
* cancel an already-scheduled resolution, so a late `.then` could otherwise
|
|
15
|
+
* repopulate `_cachedPort` after the reset and bleed into the next test.
|
|
16
|
+
*/
|
|
17
|
+
export declare function resetPortCacheForTesting(): void;
|
|
18
|
+
/**
|
|
19
|
+
* Installs a fake port resolver and clears the cache. Test-only seam: the real
|
|
20
|
+
* resolver is loaded via `createRequire` with a runtime-built specifier (to
|
|
21
|
+
* hide it from bundlers), which also defeats module mocking, so injection is
|
|
22
|
+
* the only deterministic way to exercise the caching contract.
|
|
23
|
+
*/
|
|
24
|
+
export declare function setPortResolverForTesting(fn: () => Promise<number | undefined>): void;
|
|
10
25
|
//# sourceMappingURL=get-port-lazy.d.ts.map
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Extracts the run's creation timestamp (epoch milliseconds) from a `wrun_`
|
|
3
|
+
* run ID by decoding the embedded ULID time component.
|
|
4
|
+
*
|
|
5
|
+
* Returns `undefined` when `runId` is not a decodable `wrun_<ulid>` (e.g. a
|
|
6
|
+
* legacy/non-ULID id, or a test fixture like `wrun_test`); callers fall back to
|
|
7
|
+
* an authoritative timestamp from the run snapshot (`createdAt`) in that case.
|
|
8
|
+
*/
|
|
9
|
+
export declare function runIdCreatedAt(runId: string): number | undefined;
|
|
10
|
+
//# sourceMappingURL=run-id-time.d.ts.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { World } from '#compiled/@workflow/world/index.js';
|
|
1
|
+
import type { Event, SerializedData, World } from '#compiled/@workflow/world/index.js';
|
|
2
2
|
import type { CryptoKey } from '../encryption.js';
|
|
3
3
|
export interface StepExecutorParams {
|
|
4
4
|
world: World;
|
|
@@ -16,14 +16,74 @@ export interface StepExecutorParams {
|
|
|
16
16
|
* as possibly containing compressed payloads (specVersion >= 5).
|
|
17
17
|
*/
|
|
18
18
|
runSpecVersion?: number;
|
|
19
|
+
/**
|
|
20
|
+
* Lazy step start: the already-dehydrated step input. When provided, the
|
|
21
|
+
* `step_started` event carries this input so the world creates the step on
|
|
22
|
+
* the fly (no separate `step_created` round-trip). Set by the owned-inline
|
|
23
|
+
* path for the step whose `step_created` the suspension handler deferred.
|
|
24
|
+
* The world's atomic create-claim is the exactly-one-owner gate: losing it
|
|
25
|
+
* surfaces as `EntityConflictError` → `{ type: 'skipped' }`, so a handler
|
|
26
|
+
* that did not win the create never runs the body. Omitted on every other
|
|
27
|
+
* path, where the step already has a `step_created` and `step_started`
|
|
28
|
+
* carries no payload (the legacy contract).
|
|
29
|
+
*/
|
|
30
|
+
lazyStepInput?: SerializedData;
|
|
31
|
+
/**
|
|
32
|
+
* Inline-delta optimization (opt-in). When provided, the cursor of the
|
|
33
|
+
* event log as observed by the caller *before* this step's events were
|
|
34
|
+
* written. It is threaded into the step-terminal `events.create` so a
|
|
35
|
+
* supporting World can return the delta of events written since (see
|
|
36
|
+
* {@link import('@workflow/world').CreateEventParams.sinceCursor}).
|
|
37
|
+
* Only set this when `correlationId`-based ownership guarantees this
|
|
38
|
+
* handler is the sole inline writer for the run on this iteration.
|
|
39
|
+
*/
|
|
40
|
+
inlineDeltaSinceCursor?: string;
|
|
41
|
+
/**
|
|
42
|
+
* Force optimistic inline start regardless of
|
|
43
|
+
* `WORKFLOW_OPTIMISTIC_INLINE_START`. Set by turbo mode on the first delivery
|
|
44
|
+
* of the first invocation, where forcing it is safe: there is no concurrent
|
|
45
|
+
* peer handler to race the create-claim, so the body runs exactly once. Only
|
|
46
|
+
* meaningful together with `lazyStepInput` (a brand-new lazy step).
|
|
47
|
+
*/
|
|
48
|
+
forceOptimisticStart?: boolean;
|
|
49
|
+
/**
|
|
50
|
+
* Turbo mode only: a promise that resolves once the backgrounded
|
|
51
|
+
* `run_started` has landed. When set, the lazy/optimistic `step_started` is
|
|
52
|
+
* chained on it so the step is never created before its run exists. The body
|
|
53
|
+
* still runs immediately against locally-synthesized state — only the network
|
|
54
|
+
* write waits — so the `run_started` round-trip overlaps the body. `undefined`
|
|
55
|
+
* outside turbo, where `run_started` was already awaited up front.
|
|
56
|
+
*/
|
|
57
|
+
runReadyBarrier?: Promise<unknown>;
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Inline-delta returned by a step-terminal write when the caller passed
|
|
61
|
+
* {@link StepExecutorParams.inlineDeltaSinceCursor} and the World supports
|
|
62
|
+
* the optimization. `events` are the events written strictly after that
|
|
63
|
+
* cursor (this step's events plus anything interleaved in-band), `cursor`
|
|
64
|
+
* is the position past the last one, and `hasMore` signals a further page
|
|
65
|
+
* (the caller then falls back to a full incremental fetch). Absent when
|
|
66
|
+
* the World did not return a delta.
|
|
67
|
+
*/
|
|
68
|
+
export interface InlineEventDelta {
|
|
69
|
+
events: Event[];
|
|
70
|
+
cursor: string | null;
|
|
71
|
+
hasMore: boolean;
|
|
19
72
|
}
|
|
20
73
|
/**
|
|
21
74
|
* Result of a step execution attempt. The caller decides what to do
|
|
22
75
|
* based on the result type (e.g., queue workflow continuation, replay inline, etc.).
|
|
76
|
+
*
|
|
77
|
+
* `inlineDelta` is attached to a `completed` result when the caller
|
|
78
|
+
* requested it via {@link StepExecutorParams.inlineDeltaSinceCursor} and
|
|
79
|
+
* the World returned one. Step failures are rare and not the inline
|
|
80
|
+
* optimization's target, so the `failed` path leaves it to the normal
|
|
81
|
+
* incremental fetch.
|
|
23
82
|
*/
|
|
24
83
|
export type StepExecutionResult = {
|
|
25
84
|
type: 'completed';
|
|
26
85
|
hasPendingOps?: boolean;
|
|
86
|
+
inlineDelta?: InlineEventDelta;
|
|
27
87
|
} | {
|
|
28
88
|
type: 'failed';
|
|
29
89
|
} | {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Span } from '#compiled/@opentelemetry/api/index.js';
|
|
2
|
-
import { type WorkflowRun, type World } from '#compiled/@workflow/world/index.js';
|
|
2
|
+
import { type SerializedData, type WorkflowRun, type World } from '#compiled/@workflow/world/index.js';
|
|
3
3
|
import type { StepInvocationQueueItem, WorkflowSuspension } from '../global.js';
|
|
4
4
|
export interface SuspensionHandlerParams {
|
|
5
5
|
suspension: WorkflowSuspension;
|
|
@@ -7,6 +7,16 @@ export interface SuspensionHandlerParams {
|
|
|
7
7
|
run: WorkflowRun;
|
|
8
8
|
span?: Span;
|
|
9
9
|
requestId?: string;
|
|
10
|
+
/**
|
|
11
|
+
* Turbo mode only: a promise that resolves once the backgrounded
|
|
12
|
+
* `run_started` has landed (the run exists). When present, every world write
|
|
13
|
+
* this suspension performs (`hook_created`, `wait_created`, eager overflow
|
|
14
|
+
* `step_created`, …) is gated on it so the write never races ahead of the
|
|
15
|
+
* run's creation. The pure inline hot path defers all of its steps and writes
|
|
16
|
+
* nothing here, so it never awaits this barrier. `undefined` outside turbo,
|
|
17
|
+
* where `run_started` was already awaited up front.
|
|
18
|
+
*/
|
|
19
|
+
runReadyBarrier?: Promise<unknown>;
|
|
10
20
|
}
|
|
11
21
|
/**
|
|
12
22
|
* Result of handling a suspension. Returns pending step items so the caller
|
|
@@ -24,6 +34,24 @@ export interface SuspensionHandlerResult {
|
|
|
24
34
|
* into the same batch boundary.
|
|
25
35
|
*/
|
|
26
36
|
createdStepCorrelationIds: Set<string>;
|
|
37
|
+
/**
|
|
38
|
+
* The steps whose `step_created` writes were intentionally deferred so the
|
|
39
|
+
* caller can run them inline via lazy `step_started` events (which create
|
|
40
|
+
* the step on the fly), saving one world round-trip per inline step. Up to
|
|
41
|
+
* `getMaxInlineSteps()` steps are deferred; the caller runs them inline in
|
|
42
|
+
* parallel and queues the rest. Empty when no step was deferred (nothing
|
|
43
|
+
* pending, or a `hook.getConflict()` awaiter is present so nothing is
|
|
44
|
+
* executed inline). The caller passes each `dehydratedInput` straight to
|
|
45
|
+
* `executeStep`, which sends it as the `step_started` payload. The atomic
|
|
46
|
+
* create-claim inside each `step_started` is the exactly-one-owner gate that
|
|
47
|
+
* the standalone `step_created` provided before: the loser of the race gets
|
|
48
|
+
* `EntityConflictError` → `skipped` and does not run the body.
|
|
49
|
+
*/
|
|
50
|
+
lazyInlineSteps: Array<{
|
|
51
|
+
correlationId: string;
|
|
52
|
+
stepName: string;
|
|
53
|
+
dehydratedInput: SerializedData;
|
|
54
|
+
}>;
|
|
27
55
|
/**
|
|
28
56
|
* The soonest pending wait, if any: seconds until it elapses and the
|
|
29
57
|
* correlationId of the wait that produced that timeout. The
|
|
@@ -41,6 +69,14 @@ export interface SuspensionHandlerResult {
|
|
|
41
69
|
hasAwaitedHookCreation: boolean;
|
|
42
70
|
/** Whether native workflow attribute events were written for replay. */
|
|
43
71
|
hasAttributeEvents: boolean;
|
|
72
|
+
/**
|
|
73
|
+
* Whether this suspension created any hook (`hook_created`) events. Unlike
|
|
74
|
+
* `hasHookConflict` / `hasAwaitedHookCreation`, this is true even for a plain
|
|
75
|
+
* fire-and-forget hook with no conflict and no awaiter. Turbo mode uses it to
|
|
76
|
+
* detect "a hook was created this suspension" and stop forcing optimistic
|
|
77
|
+
* inline start (a hook introduces later resume invocations that could race).
|
|
78
|
+
*/
|
|
79
|
+
hasHookEvents: boolean;
|
|
44
80
|
}
|
|
45
81
|
/**
|
|
46
82
|
* Handles a workflow suspension by processing all pending operations (hooks, steps, waits).
|
|
@@ -51,5 +87,5 @@ export interface SuspensionHandlerResult {
|
|
|
51
87
|
* 1. Hooks are processed first to prevent race conditions with webhook receivers
|
|
52
88
|
* 2. Step events and wait events are created in parallel
|
|
53
89
|
*/
|
|
54
|
-
export declare function handleSuspension({ suspension, world, run, span, requestId, }: SuspensionHandlerParams): Promise<SuspensionHandlerResult>;
|
|
90
|
+
export declare function handleSuspension({ suspension, world, run, span, requestId, runReadyBarrier, }: SuspensionHandlerParams): Promise<SuspensionHandlerResult>;
|
|
55
91
|
//# sourceMappingURL=suspension-handler.d.ts.map
|
|
@@ -20,5 +20,6 @@ export { createWorld, getWorld, getWorldHandlers, setWorld, } from './runtime/wo
|
|
|
20
20
|
*/
|
|
21
21
|
export declare function workflowEntrypoint(workflowCode: string, options?: {
|
|
22
22
|
namespace?: string;
|
|
23
|
+
routeModuleBodyStartedAt?: number;
|
|
23
24
|
}): (req: Request) => Promise<Response>;
|
|
24
25
|
//# sourceMappingURL=runtime.d.ts.map
|