eve 0.7.0 → 0.7.3
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 +27 -0
- package/dist/docs/public/README.md +16 -11
- package/dist/docs/public/agent-config.md +9 -9
- package/dist/docs/public/channels/custom.mdx +4 -4
- package/dist/docs/public/channels/discord.mdx +1 -1
- package/dist/docs/public/channels/eve.mdx +9 -9
- package/dist/docs/public/channels/github.mdx +1 -1
- package/dist/docs/public/channels/overview.mdx +21 -15
- package/dist/docs/public/channels/slack.mdx +2 -2
- package/dist/docs/public/channels/teams.mdx +1 -1
- package/dist/docs/public/channels/telegram.mdx +1 -1
- package/dist/docs/public/channels/twilio.mdx +1 -1
- package/dist/docs/public/{advanced → concepts}/context-control.md +3 -3
- package/dist/docs/public/{advanced → concepts}/default-harness.md +3 -3
- package/dist/docs/public/{advanced → concepts}/execution-model-and-durability.md +3 -1
- package/dist/docs/public/concepts/meta.json +10 -0
- package/dist/docs/public/{advanced → concepts}/security-model.md +2 -2
- package/dist/docs/public/{advanced → concepts}/sessions-runs-and-streaming.md +7 -7
- package/dist/docs/public/connections.mdx +3 -3
- package/dist/docs/public/evals/cases.mdx +2 -3
- package/dist/docs/public/evals/judge.mdx +1 -1
- package/dist/docs/public/evals/overview.mdx +4 -4
- package/dist/docs/public/evals/running.mdx +5 -10
- package/dist/docs/public/evals/targets.mdx +4 -23
- package/dist/docs/public/getting-started.mdx +28 -35
- package/dist/docs/public/{advanced → guides}/auth-and-route-protection.md +2 -2
- package/dist/docs/public/{client → guides/client}/continuations.mdx +2 -2
- package/dist/docs/public/{client → guides/client}/messages.mdx +1 -1
- package/dist/docs/public/{client → guides/client}/meta.json +1 -1
- package/dist/docs/public/{client → guides/client}/output-schema.mdx +2 -2
- package/dist/docs/public/{client → guides/client}/overview.mdx +5 -5
- package/dist/docs/public/{client → guides/client}/streaming.mdx +1 -1
- package/dist/docs/public/{advanced → guides}/deployment.md +9 -1
- package/dist/docs/public/{advanced → guides}/dynamic-capabilities.md +1 -1
- package/dist/docs/public/{advanced → guides}/dynamic-workflows.md +1 -1
- package/dist/docs/public/{frontend → guides/frontend}/nextjs.mdx +3 -3
- package/dist/docs/public/{frontend → guides/frontend}/nuxt.mdx +3 -3
- package/dist/docs/public/{frontend → guides/frontend}/overview.mdx +6 -6
- package/dist/docs/public/{frontend → guides/frontend}/sveltekit.mdx +3 -3
- package/dist/docs/public/{frontend → guides/frontend}/use-eve-agent-svelte.mdx +2 -2
- package/dist/docs/public/{frontend → guides/frontend}/use-eve-agent-vue.mdx +2 -2
- package/dist/docs/public/{advanced → guides}/hooks.md +2 -2
- package/dist/docs/public/{advanced → guides}/instrumentation.md +2 -0
- package/dist/docs/public/{advanced → guides}/meta.json +8 -11
- package/dist/docs/public/{advanced → guides}/session-context.md +2 -2
- package/dist/docs/public/{advanced → guides}/state.md +1 -1
- package/dist/docs/public/instructions.mdx +2 -2
- package/dist/docs/public/introduction.md +5 -2
- package/dist/docs/public/meta.json +3 -3
- package/dist/docs/public/reference/cli.md +3 -3
- package/dist/docs/public/reference/meta.json +1 -1
- package/dist/docs/public/reference/project-layout.md +5 -1
- package/dist/docs/public/reference/typescript-api.md +23 -23
- package/dist/docs/public/sandbox.mdx +1 -1
- package/dist/docs/public/schedules.mdx +2 -2
- package/dist/docs/public/skills.mdx +3 -3
- package/dist/docs/public/subagents.mdx +3 -3
- package/dist/docs/public/tools.mdx +4 -4
- package/dist/docs/public/tutorial/connect-a-warehouse.mdx +2 -2
- package/dist/docs/public/tutorial/first-agent.mdx +1 -1
- package/dist/docs/public/tutorial/guard-the-spend.mdx +1 -1
- package/dist/docs/public/tutorial/how-it-runs.mdx +2 -2
- package/dist/docs/public/tutorial/meta.json +1 -1
- package/dist/docs/public/tutorial/query-sample-data.mdx +1 -1
- package/dist/docs/public/tutorial/remember-definitions.mdx +3 -3
- package/dist/docs/public/tutorial/run-analysis.mdx +1 -1
- package/dist/docs/public/tutorial/ship-it.mdx +4 -4
- package/dist/docs/public/tutorial/team-playbooks.mdx +3 -3
- package/dist/src/cli/dev/tui/prompt-command-handler.js +1 -1
- package/dist/src/cli/dev/tui/runner.d.ts +2 -2
- package/dist/src/cli/dev/tui/runner.js +1 -1
- package/dist/src/cli/dev/tui/tui.js +1 -1
- package/dist/src/cli/run.d.ts +0 -2
- package/dist/src/cli/run.js +1 -1
- package/dist/src/client/types.d.ts +0 -1
- package/dist/src/compiled/.vendor-stamp.json +2 -2
- package/dist/src/compiled/@workflow/core/capabilities.d.ts +19 -1
- package/dist/src/compiled/@workflow/core/class-serialization.d.ts +32 -0
- package/dist/src/compiled/@workflow/core/create-hook.d.ts +37 -0
- package/dist/src/compiled/@workflow/core/global.d.ts +11 -1
- package/dist/src/compiled/@workflow/core/index.js +2 -2
- package/dist/src/compiled/@workflow/core/runtime/start.d.ts +6 -0
- package/dist/src/compiled/@workflow/core/runtime/suspension-handler.d.ts +15 -2
- package/dist/src/compiled/@workflow/core/runtime/wait-continuation.d.ts +84 -0
- package/dist/src/compiled/@workflow/core/runtime.js +27 -27
- package/dist/src/compiled/@workflow/core/serialization/types.d.ts +21 -0
- package/dist/src/compiled/@workflow/core/serialization.d.ts +72 -6
- package/dist/src/compiled/@workflow/core/symbols.d.ts +2 -0
- package/dist/src/compiled/@workflow/core/version.d.ts +1 -1
- package/dist/src/compiled/@workflow/core/workflow/attribute-dispatcher.d.ts +6 -0
- package/dist/src/compiled/@workflow/core/workflow/set-attributes.d.ts +3 -4
- package/dist/src/compiled/@workflow/core/workflow.js +1 -1
- package/dist/src/compiled/@workflow/world/events.d.ts +48 -0
- package/dist/src/compiled/@workflow/world/index.d.ts +1 -1
- package/dist/src/compiled/@workflow/world/queue.d.ts +3 -0
- package/dist/src/compiled/@workflow/world/runs.d.ts +2 -0
- package/dist/src/compiled/@workflow/world/spec-version.d.ts +2 -1
- package/dist/src/compiled/_chunks/workflow/attribute-changes-DGVGRGfw.js +59 -0
- package/dist/src/compiled/_chunks/workflow/resume-hook-DMSadN9o.js +1 -0
- package/dist/src/compiled/_chunks/workflow/run-BRdn7zy_.js +1 -0
- package/dist/src/compiled/_chunks/workflow/sleep-CpXfoXLF.js +1 -0
- package/dist/src/evals/cli/eval.d.ts +0 -2
- package/dist/src/evals/cli/eval.js +1 -1
- package/dist/src/evals/define-eval.d.ts +1 -1
- package/dist/src/evals/define-eval.js +1 -1
- package/dist/src/evals/index.d.ts +1 -2
- package/dist/src/evals/index.js +1 -1
- package/dist/src/evals/runner/artifacts.js +1 -1
- package/dist/src/evals/runner/execute-eval.d.ts +2 -3
- package/dist/src/evals/runner/execute-eval.js +1 -1
- package/dist/src/evals/runner/execute-task.d.ts +1 -2
- package/dist/src/evals/runner/execute-task.js +1 -1
- package/dist/src/evals/runner/reporters/console.js +1 -1
- package/dist/src/evals/runner/reporters/junit.js +3 -4
- package/dist/src/evals/runner/run-evals.d.ts +0 -1
- package/dist/src/evals/runner/run-evals.js +1 -1
- package/dist/src/evals/target.d.ts +1 -6
- package/dist/src/evals/target.js +1 -1
- package/dist/src/evals/types.d.ts +2 -18
- package/dist/src/execution/node-step.js +1 -1
- package/dist/src/execution/sandbox/bindings/vercel.d.ts +2 -6
- package/dist/src/execution/sandbox/bindings/vercel.js +1 -1
- package/dist/src/internal/application/package.js +1 -1
- package/dist/src/internal/nitro/routes/agent-info/build-agent-info-response-from-manifest.js +1 -1
- package/dist/src/internal/nitro/routes/agent-info/build-agent-info-response.d.ts +0 -1
- package/dist/src/internal/nitro/routes/agent-info/build-agent-info-response.js +1 -1
- package/dist/src/runtime/agent/mock-model-adapter.d.ts +3 -6
- package/dist/src/runtime/agent/mock-model-adapter.js +2 -2
- package/dist/src/runtime/agent/resolve-model.d.ts +2 -2
- package/dist/src/runtime/agent/resolve-model.js +1 -1
- package/dist/src/runtime/sandbox/keys.js +1 -1
- package/dist/src/setup/primitives/pm/pnpm.js +1 -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/update/channels.js +1 -1
- package/package.json +6 -6
- package/dist/docs/public/reference/faqs.md +0 -48
- package/dist/src/compiled/_chunks/workflow/resume-hook-CEAS3opc.js +0 -12
- package/dist/src/compiled/_chunks/workflow/sleep-Cup6vPoA.js +0 -1
- package/dist/src/compiled/_chunks/workflow/symbols-BUTtwS7j.js +0 -48
- package/dist/src/evals/requirements.d.ts +0 -3
- package/dist/src/evals/requirements.js +0 -1
- /package/dist/docs/public/{advanced → guides}/dev-tui.md +0 -0
- /package/dist/docs/public/{frontend → guides/frontend}/meta.json +0 -0
- /package/dist/docs/public/{advanced → guides}/remote-agents.md +0 -0
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { Run } from './runtime/run.js';
|
|
1
2
|
import type { Serializable } from './schemas.js';
|
|
2
3
|
/**
|
|
3
4
|
* An object that can be awaited to receive a value.
|
|
@@ -24,6 +25,42 @@ export interface Hook<T = any> extends AsyncIterable<T>, Thenable<T> {
|
|
|
24
25
|
* The token used to identify this hook.
|
|
25
26
|
*/
|
|
26
27
|
token: string;
|
|
28
|
+
/**
|
|
29
|
+
* Returns a promise that resolves with the conflicting {@link Run} if
|
|
30
|
+
* another active hook already owns this hook's token, or `null` once
|
|
31
|
+
* the hook has been registered and is ready to receive payloads.
|
|
32
|
+
*
|
|
33
|
+
* Calling `createHook()` alone does not register the hook — registration
|
|
34
|
+
* only happens when the workflow suspends. Awaiting `getConflict()`
|
|
35
|
+
* suspends the workflow to commit the hook registration, so it can be
|
|
36
|
+
* used to claim the token (and detect token conflicts early) without
|
|
37
|
+
* waiting for payload data.
|
|
38
|
+
*
|
|
39
|
+
* When a conflict is detected, the resolved `Run` is the run that
|
|
40
|
+
* currently owns the token. The workflow can decide how to handle the
|
|
41
|
+
* duplicate in code: return or log `conflict.runId`, inspect
|
|
42
|
+
* `await conflict.status`, await `conflict.returnValue`, or cancel the
|
|
43
|
+
* owner with `await conflict.cancel()` and continue in the current run.
|
|
44
|
+
*
|
|
45
|
+
* Note that awaiting the hook's payload (`await hook`) when the token is
|
|
46
|
+
* already owned by another active hook still rejects with
|
|
47
|
+
* `HookConflictError`. In the rare case where the conflicting run cannot
|
|
48
|
+
* be identified (a `hook_conflict` event persisted by an old world that
|
|
49
|
+
* did not record the owning run's ID), `getConflict()` also rejects with
|
|
50
|
+
* `HookConflictError` rather than resolving with an incomplete value.
|
|
51
|
+
*
|
|
52
|
+
* @example
|
|
53
|
+
* ```ts
|
|
54
|
+
* using hook = createHook({ token: `order:${orderId}` });
|
|
55
|
+
* const conflict = await hook.getConflict();
|
|
56
|
+
* if (conflict) {
|
|
57
|
+
* // another run already owns this token
|
|
58
|
+
* return { dedupedTo: conflict.runId };
|
|
59
|
+
* }
|
|
60
|
+
* // token is now claimed, without waiting for payload data
|
|
61
|
+
* ```
|
|
62
|
+
*/
|
|
63
|
+
getConflict(): Promise<Run<unknown> | null>;
|
|
27
64
|
/**
|
|
28
65
|
* Disposes the hook, releasing its token for reuse by other workflows.
|
|
29
66
|
*
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { AttributeChange } from '#compiled/@workflow/world/index.js';
|
|
1
2
|
import type { Serializable } from './schemas.js';
|
|
2
3
|
export interface StepInvocationQueueItem {
|
|
3
4
|
type: 'step';
|
|
@@ -14,6 +15,8 @@ export interface HookInvocationQueueItem {
|
|
|
14
15
|
token: string;
|
|
15
16
|
metadata?: Serializable;
|
|
16
17
|
hasCreatedEvent?: boolean;
|
|
18
|
+
/** Whether the workflow is awaiting `hook.getConflict()` for this hook */
|
|
19
|
+
hasConflictAwaiter?: boolean;
|
|
17
20
|
disposed?: boolean;
|
|
18
21
|
isWebhook?: boolean;
|
|
19
22
|
isSystem?: boolean;
|
|
@@ -26,7 +29,13 @@ export interface WaitInvocationQueueItem {
|
|
|
26
29
|
resumeAt: Date;
|
|
27
30
|
hasCreatedEvent?: boolean;
|
|
28
31
|
}
|
|
29
|
-
export
|
|
32
|
+
export interface AttributeInvocationQueueItem {
|
|
33
|
+
type: 'attribute';
|
|
34
|
+
correlationId: string;
|
|
35
|
+
changes: AttributeChange[];
|
|
36
|
+
allowReservedAttributes?: true;
|
|
37
|
+
}
|
|
38
|
+
export type QueueItem = StepInvocationQueueItem | HookInvocationQueueItem | WaitInvocationQueueItem | AttributeInvocationQueueItem;
|
|
30
39
|
/**
|
|
31
40
|
* An error that is thrown when one or more operations (steps/hooks/etc.) are called but do
|
|
32
41
|
* not yet have corresponding entries in the event log. The workflow
|
|
@@ -39,6 +48,7 @@ export declare class WorkflowSuspension extends Error {
|
|
|
39
48
|
stepCount: number;
|
|
40
49
|
hookCount: number;
|
|
41
50
|
waitCount: number;
|
|
51
|
+
attributeCount: number;
|
|
42
52
|
hookDisposedCount: number;
|
|
43
53
|
abortCount: number;
|
|
44
54
|
constructor(stepsInput: Map<string, QueueItem>, global: typeof globalThis);
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{c as e,i as t}from"../../_chunks/workflow/dist-6a3viBXZ.js";import{
|
|
2
|
-
`)}`)}return await
|
|
1
|
+
import{c as e,i as t}from"../../_chunks/workflow/dist-6a3viBXZ.js";import{Jn as n,Jt as r,Kt as i,L as a,R as o,S as s,Xn as c,Yn as l,an as u,h as d,in as f,on as p,qt as m,rn as h,t as g,w as _}from"../../_chunks/workflow/attribute-changes-DGVGRGfw.js";import{n as v}from"../../_chunks/workflow/resume-hook-DMSadN9o.js";import{t as y}from"../../_chunks/workflow/sleep-CpXfoXLF.js";function b(e){l(`createHook()`,`https://workflow-sdk.dev/docs/api-reference/workflow/create-hook`,b)}function x(e){l(`createWebhook()`,`https://workflow-sdk.dev/docs/api-reference/workflow/create-webhook`,x)}function S({schema:e}={}){function t(e){l(`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=o.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=g(e,n);a.length!==0&&await(await h()).events.create(i,{eventType:`attr_set`,specVersion:4,eventData:{changes:a,writer:{type:`step`,stepId:r.stepMetadata.stepId,attempt:r.stepMetadata.attempt},...n.allowReservedAttributes===!0?{allowReservedAttributes:!0}:{}}})}function w(){let e=o.getStore();return e||n(`getStepMetadata()`,`https://workflow-sdk.dev/docs/api-reference/workflow/get-step-metadata`,w),e.stepMetadata}function T(){let e=o.getStore();return e||c(`getWorkflowMetadata()`,`https://workflow-sdk.dev/docs/api-reference/workflow/get-workflow-metadata`,T),e.workflowMetadata}function E(e={}){let t=o.getStore();t||c(`getWritable()`,`https://workflow-sdk.dev/docs/api-reference/workflow/get-writable`,E);let{namespace:n}=e,l=t.workflowMetadata.workflowRunId,h=a(l,n),g=t.writables??=new Map,v=g.get(h);if(v)return v.writable;let y=_(s(globalThis,t.ops,l,t.encryptionKey,!0),t.encryptionKey),b=new d(l,h),x=f();return t.ops.push(x.promise),u(y.readable,b,x).catch(()=>{}),p(y.writable,x),Object.defineProperty(y.writable,i,{value:h,writable:!1}),Object.defineProperty(y.writable,r,{value:l,writable:!1}),t.workflowDeploymentId&&Object.defineProperty(y.writable,m,{value:t.workflowDeploymentId,writable:!1}),g.set(h,{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};
|
|
@@ -10,6 +10,12 @@ export interface StartOptionsBase {
|
|
|
10
10
|
* The spec version to use for the workflow run. Defaults to the latest version.
|
|
11
11
|
*/
|
|
12
12
|
specVersion?: number;
|
|
13
|
+
/**
|
|
14
|
+
* Plaintext attributes to seed on the run as it is created.
|
|
15
|
+
*
|
|
16
|
+
* Available for native-attributes runs (spec version 4 and later).
|
|
17
|
+
*/
|
|
18
|
+
attributes?: Record<string, string>;
|
|
13
19
|
}
|
|
14
20
|
export interface StartOptionsWithDeploymentId extends StartOptionsBase {
|
|
15
21
|
/**
|
|
@@ -24,10 +24,23 @@ export interface SuspensionHandlerResult {
|
|
|
24
24
|
* into the same batch boundary.
|
|
25
25
|
*/
|
|
26
26
|
createdStepCorrelationIds: Set<string>;
|
|
27
|
-
/**
|
|
28
|
-
|
|
27
|
+
/**
|
|
28
|
+
* The soonest pending wait, if any: seconds until it elapses and the
|
|
29
|
+
* correlationId of the wait that produced that timeout. The
|
|
30
|
+
* correlationId seeds the idempotency key for the wait-continuation
|
|
31
|
+
* queue message so that repeated suspension passes over the same
|
|
32
|
+
* pending wait collapse into a single delayed continuation.
|
|
33
|
+
*/
|
|
34
|
+
waitTimeout?: {
|
|
35
|
+
seconds: number;
|
|
36
|
+
correlationId: string;
|
|
37
|
+
};
|
|
29
38
|
/** Whether a hook conflict was detected (should re-invoke immediately) */
|
|
30
39
|
hasHookConflict: boolean;
|
|
40
|
+
/** Whether a `hook.getConflict()` awaiter needs the workflow to continue immediately */
|
|
41
|
+
hasAwaitedHookCreation: boolean;
|
|
42
|
+
/** Whether native workflow attribute events were written for replay. */
|
|
43
|
+
hasAttributeEvents: boolean;
|
|
31
44
|
}
|
|
32
45
|
/**
|
|
33
46
|
* Handles a workflow suspension by processing all pending operations (hooks, steps, waits).
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Wait-continuation dispatch: delay + idempotency-key selection.
|
|
3
|
+
*
|
|
4
|
+
* When V2 suspension processing observes a pending wait, it enqueues a
|
|
5
|
+
* delayed "continuation" message that fires once the wait elapses and
|
|
6
|
+
* drives the next replay (which completes the wait via the "complete
|
|
7
|
+
* elapsed waits" pass). This module decides the message's `delaySeconds`
|
|
8
|
+
* and `idempotencyKey`.
|
|
9
|
+
*
|
|
10
|
+
* The continuation is keyed on the wait's correlationId: while a wait is
|
|
11
|
+
* pending, every replay pass over the run re-observes it (e.g., once per
|
|
12
|
+
* step completion in `Promise.all([steps..., sleep()])`), and without
|
|
13
|
+
* dedupe each pass would enqueue another delayed continuation — each one
|
|
14
|
+
* a spurious full replay when the wait elapses, and each a fresh message
|
|
15
|
+
* that resets the delivery-attempt runaway guard. A key is attached in
|
|
16
|
+
* all cases: some worlds (e.g. world-postgres) serialize key-less
|
|
17
|
+
* workflow messages per run, which would park the continuation behind
|
|
18
|
+
* the handler's own inline step execution and defeat the race semantics
|
|
19
|
+
* the continuation exists to provide.
|
|
20
|
+
*
|
|
21
|
+
* The bare correlationId cannot be the key in every case, though: world
|
|
22
|
+
* dedupe windows outlive the first delivery (VQS keeps idempotency
|
|
23
|
+
* records until message-retention TTL; world-postgres keeps a
|
|
24
|
+
* completed-keys cache), so once a key has been used, a later enqueue
|
|
25
|
+
* under the same key is silently dropped. Any situation where a
|
|
26
|
+
* continuation is delivered while its wait is still pending therefore
|
|
27
|
+
* needs a fresh key for the re-enqueue, or the wait's timer is lost and
|
|
28
|
+
* the run stalls until unrelated traffic happens to wake it. Two such
|
|
29
|
+
* situations exist, each with its own key variation:
|
|
30
|
+
*
|
|
31
|
+
* - Waits longer than the maximum queue delay are chained: the delay is
|
|
32
|
+
* clamped to `WAIT_CONTINUATION_MAX_DELAY_SECONDS` (23h — VQS messages
|
|
33
|
+
* have a 24h retention limit, and one hour of buffer matches
|
|
34
|
+
* world-vercel's own clamp for delayed re-enqueues), so the
|
|
35
|
+
* continuation intentionally fires early, re-observes the wait, and
|
|
36
|
+
* must enqueue the next hop. The key is suffixed with the hop index
|
|
37
|
+
* (`ceil(timeoutSeconds / maxDelay)`): stable for every re-observation
|
|
38
|
+
* within the same hop window (so passes dedupe), decremented at each
|
|
39
|
+
* hop delivery (so the chain always advances). Worlds without a delay
|
|
40
|
+
* limit (world-postgres, world-local) simply take the same ≤23h hops.
|
|
41
|
+
*
|
|
42
|
+
* - Near-elapsed waits (≤2s remaining) get a second-bucketed suffix. A
|
|
43
|
+
* continuation delivered marginally early (clock skew between the
|
|
44
|
+
* enqueuing and handling hosts; the ceil() on the delay can leave a ~0
|
|
45
|
+
* margin) re-observes the wait as pending with ~1s remaining and must
|
|
46
|
+
* be able to enqueue a fresh short-delay retry. The bucket suffix
|
|
47
|
+
* keeps that retry enqueueable (its ≥1s delay guarantees a later
|
|
48
|
+
* bucket) while still collapsing same-instant duplicates.
|
|
49
|
+
*
|
|
50
|
+
* Mid-range waits (more than the near-elapsed threshold, at most one
|
|
51
|
+
* hop) use the bare correlationId: every re-observation targets the same
|
|
52
|
+
* deadline, so deduping to the first message is semantically lossless.
|
|
53
|
+
* Host clock skew beyond the near-elapsed threshold could in principle
|
|
54
|
+
* deliver such a continuation early enough to re-observe its wait and
|
|
55
|
+
* lose the re-enqueue to the burnt key; the threshold is the skew
|
|
56
|
+
* tolerance we accept for the benefit of exactly-one continuation per
|
|
57
|
+
* wait.
|
|
58
|
+
*/
|
|
59
|
+
/**
|
|
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
|
|
63
|
+
* world-vercel's `MAX_DELAY_SECONDS`.
|
|
64
|
+
*/
|
|
65
|
+
export declare const WAIT_CONTINUATION_MAX_DELAY_SECONDS = 82800;
|
|
66
|
+
/**
|
|
67
|
+
* Waits with at most this many seconds remaining use a second-bucketed
|
|
68
|
+
* idempotency key so an early-delivered continuation can re-enqueue its
|
|
69
|
+
* short-delay retry. This is also the host clock-skew tolerance for
|
|
70
|
+
* mid-range waits keyed on the bare correlationId.
|
|
71
|
+
*/
|
|
72
|
+
export declare const NEAR_ELAPSED_WAIT_THRESHOLD_SECONDS = 2;
|
|
73
|
+
export interface WaitContinuationDispatch {
|
|
74
|
+
delaySeconds: number;
|
|
75
|
+
idempotencyKey: string;
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* Computes the queue delay and idempotency key for a wait-continuation
|
|
79
|
+
* message. `timeoutSeconds` is the time until the wait's `resumeAt`
|
|
80
|
+
* (floored at 1s by the suspension handler); `waitCorrelationId`
|
|
81
|
+
* identifies the wait so repeated suspension passes dedupe.
|
|
82
|
+
*/
|
|
83
|
+
export declare function getWaitContinuationDispatch(timeoutSeconds: number, waitCorrelationId: string, now?: number): WaitContinuationDispatch;
|
|
84
|
+
//# sourceMappingURL=wait-continuation.d.ts.map
|