@intx/workflow-host 0.2.2 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +56 -10
- package/dist/adapters/repo-store.d.ts +22 -1
- package/dist/adapters/repo-store.js +53 -53
- package/dist/adapters/spawn-child.d.ts +71 -42
- package/dist/adapters/spawn-child.js +83 -77
- package/dist/adapters/step-invoker.js +84 -7
- package/dist/child/env-bootstrap.d.ts +20 -6
- package/dist/child/env-bootstrap.js +9 -1
- package/dist/child/index.d.ts +2 -1
- package/dist/child/parked-correlations.d.ts +42 -0
- package/dist/child/parked-correlations.js +80 -0
- package/dist/child/proxy-repo-store.d.ts +3 -2
- package/dist/child/proxy-repo-store.js +2 -0
- package/dist/child/run-child.d.ts +107 -13
- package/dist/child/run-child.js +290 -108
- package/dist/child/self-discovery.d.ts +10 -0
- package/dist/child/self-discovery.js +25 -1
- package/dist/child/verified-definition-loader.d.ts +33 -0
- package/dist/child/verified-definition-loader.js +43 -0
- package/dist/conversation-text.d.ts +23 -0
- package/dist/conversation-text.js +56 -0
- package/dist/index.d.ts +4 -3
- package/dist/index.js +3 -2
- package/dist/ipc/control-channel.d.ts +58 -0
- package/dist/ipc/control-channel.js +94 -1
- package/dist/ipc/event-channel.d.ts +32 -1
- package/dist/mail-bus/hub-transport-adapter.d.ts +12 -7
- package/dist/mail-bus/hub-transport-adapter.js +9 -5
- package/dist/seams/scheduler.d.ts +4 -6
- package/dist/seams/scheduler.js +74 -93
- package/dist/supervisor/cancel-signing.d.ts +2 -2
- package/dist/supervisor/cancel-signing.js +1 -1
- package/dist/supervisor/credentials.d.ts +11 -10
- package/dist/supervisor/credentials.js +7 -7
- package/dist/supervisor/dispatch-attribution.js +1 -1
- package/dist/supervisor/drain-timeout.d.ts +2 -2
- package/dist/supervisor/drain-timeout.js +1 -1
- package/dist/supervisor/index.d.ts +3 -3
- package/dist/supervisor/index.js +2 -2
- package/dist/supervisor/recycle.d.ts +5 -2
- package/dist/supervisor/recycle.js +18 -7
- package/dist/supervisor/run-event-compaction.d.ts +5 -5
- package/dist/supervisor/run-event-compaction.js +5 -5
- package/dist/supervisor/spawn-env.d.ts +2 -2
- package/dist/supervisor/spawn-env.js +1 -1
- package/dist/supervisor/supervisor.d.ts +82 -25
- package/dist/supervisor/supervisor.js +1313 -410
- package/dist/supervisor/terminal-commit.d.ts +36 -0
- package/dist/supervisor/terminal-commit.js +134 -0
- package/dist/supervisor/types.d.ts +150 -23
- package/dist/workflow-definition-loader.d.ts +131 -0
- package/dist/workflow-definition-loader.js +316 -0
- package/package.json +12 -11
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { type CredentialDelivery } from "@intx/types/sidecar";
|
|
1
2
|
import type { InferenceSource } from "@intx/types/runtime";
|
|
2
3
|
import type { CancelOrigin } from "@intx/workflow";
|
|
3
4
|
import { type EventPayload } from "../ipc/index.js";
|
|
@@ -5,20 +6,57 @@ import { type CredentialsSnapshot } from "./credentials.js";
|
|
|
5
6
|
import { type RecycleAttempt, type RecycleOrigin } from "./recycle.js";
|
|
6
7
|
import type { WorkflowSupervisorBindings } from "./types.js";
|
|
7
8
|
/**
|
|
8
|
-
* Default
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
* unbounded wait would chain into a child / runtime / dispatch loop
|
|
13
|
-
* deadlock if `markConsumed` never armed (bug in the dispatch loop, a
|
|
14
|
-
* torn-down cohort, a stalled inbox primitive). 30s sits between the
|
|
15
|
-
* recycle path's `DEFAULT_KILL_TIMEOUT_MS` (5s, a hard process-level
|
|
16
|
-
* kill cap) and `DEFAULT_DRAIN_TIMEOUT_MS` (60s, the per-deployment
|
|
17
|
-
* drain budget) -- generous enough to absorb a slow legitimate
|
|
18
|
-
* markConsumed, tight enough to surface a real deadlock long before
|
|
19
|
-
* the drainTimeout would otherwise mask it.
|
|
9
|
+
* Default crash-loop bound: the supervisor stops respawning and latches
|
|
10
|
+
* the deployment once the workflow-process child exits unexpectedly this
|
|
11
|
+
* many times within `DEFAULT_CRASH_LOOP_WINDOW_MS`. Overridable via
|
|
12
|
+
* `WorkflowSupervisorBindings.crashLoopMaxCount`.
|
|
20
13
|
*/
|
|
21
|
-
export declare const
|
|
14
|
+
export declare const DEFAULT_CRASH_LOOP_MAX_COUNT = 3;
|
|
15
|
+
/**
|
|
16
|
+
* Default sliding window (ms) over which `DEFAULT_CRASH_LOOP_MAX_COUNT`
|
|
17
|
+
* unexpected exits latch the deployment. Overridable via
|
|
18
|
+
* `WorkflowSupervisorBindings.crashLoopWindowMs`.
|
|
19
|
+
*/
|
|
20
|
+
export declare const DEFAULT_CRASH_LOOP_WINDOW_MS = 60000;
|
|
21
|
+
/**
|
|
22
|
+
* Default stable-run duration (ms): once a respawned child stays up this
|
|
23
|
+
* long, the crash counter resets so flapping followed by stability does
|
|
24
|
+
* not permanently latch. Overridable via
|
|
25
|
+
* `WorkflowSupervisorBindings.crashLoopStableResetMs`.
|
|
26
|
+
*/
|
|
27
|
+
export declare const DEFAULT_CRASH_LOOP_STABLE_RESET_MS = 60000;
|
|
28
|
+
/**
|
|
29
|
+
* Default initial respawn backoff (ms): the wait before the first respawn
|
|
30
|
+
* after an unexpected exit. Overridable via
|
|
31
|
+
* `WorkflowSupervisorBindings.respawnBackoffInitialMs`.
|
|
32
|
+
*/
|
|
33
|
+
export declare const DEFAULT_RESPAWN_BACKOFF_INITIAL_MS = 1000;
|
|
34
|
+
/**
|
|
35
|
+
* Default cap (ms) on the exponential respawn backoff. Kept below
|
|
36
|
+
* `DEFAULT_CRASH_LOOP_WINDOW_MS` so a slow flapper's crashes still fall
|
|
37
|
+
* within the window and latch the guard. Overridable via
|
|
38
|
+
* `WorkflowSupervisorBindings.respawnBackoffMaxMs`.
|
|
39
|
+
*/
|
|
40
|
+
export declare const DEFAULT_RESPAWN_BACKOFF_MAX_MS = 30000;
|
|
41
|
+
/**
|
|
42
|
+
* Default watchdog for `reEmitParkedCorrelations`' wait on the child's
|
|
43
|
+
* `parked-correlations.response`. 30s is generous enough for a healthy child
|
|
44
|
+
* to enumerate its in-flight runs and load each parked snapshot, tight
|
|
45
|
+
* enough that a wedged-but-alive child does not hang the reconnect caller
|
|
46
|
+
* until some coarser timeout intervenes.
|
|
47
|
+
*/
|
|
48
|
+
export declare const DEFAULT_PARKED_QUERY_WATCHDOG_MS = 30000;
|
|
49
|
+
/**
|
|
50
|
+
* Backstop for `waitForRunTerminalOrPark`. A dispatch waits here for the child
|
|
51
|
+
* to park or terminate the run before releasing `markConsumed`; a lost park
|
|
52
|
+
* wake or a wedged child would otherwise hang the deployment's dispatch loop
|
|
53
|
+
* forever. Five minutes is far beyond any healthy per-message dispatch (which
|
|
54
|
+
* settles in well under a second), so this never fires on a legitimately long
|
|
55
|
+
* run without also being a genuine fault -- and when it does fire it is logged
|
|
56
|
+
* loudly and fails the dispatch (the mail is left reclaimable, never consumed
|
|
57
|
+
* on the assumption the run made progress), not silently swallowed.
|
|
58
|
+
*/
|
|
59
|
+
export declare const TERMINAL_OR_PARK_BACKSTOP_MS = 300000;
|
|
22
60
|
/**
|
|
23
61
|
* Public surface returned by `createWorkflowSupervisor`. Each method
|
|
24
62
|
* advances the supervisor through one lifecycle transition; the
|
|
@@ -89,6 +127,29 @@ export interface WorkflowSupervisor {
|
|
|
89
127
|
* closing pipe. Throws otherwise.
|
|
90
128
|
*/
|
|
91
129
|
deliverSources(opts: DeliverSourcesOpts): Promise<void>;
|
|
130
|
+
/**
|
|
131
|
+
* Push refreshed credential material to the child's in-memory cell. Mirrors
|
|
132
|
+
* `deliverSources`: the supervisor is the single producer of
|
|
133
|
+
* `credentials-updated` control frames, phase-guarded to starting/running so
|
|
134
|
+
* a frame is never written into a recycling child's closing pipe. A revoked
|
|
135
|
+
* credential is delivered by omitting its material so the child evicts it.
|
|
136
|
+
*/
|
|
137
|
+
deliverCredentials(opts: DeliverCredentialsOpts): Promise<void>;
|
|
138
|
+
/**
|
|
139
|
+
* Re-register every correlation the child is currently parked on by
|
|
140
|
+
* querying it for its parked correlations and re-emitting each through
|
|
141
|
+
* `onSuspensionRegister`. Recovers a `park.notify` register the hub may have
|
|
142
|
+
* missed while it was down at suspend time.
|
|
143
|
+
*
|
|
144
|
+
* Best-effort and safe to call at any time, including concurrently. Unlike
|
|
145
|
+
* `deliverSignal`/`deliverSources`, which throw when the child is not
|
|
146
|
+
* addressable, this NO-OPS on a non-addressable phase (idle / stopping /
|
|
147
|
+
* stopped / recycling): a re-establishment landing mid-recycle must not
|
|
148
|
+
* crash, and the next spawn re-drives it. A query that fails or times out is
|
|
149
|
+
* logged and dropped; the hub co-write is idempotent, so the next
|
|
150
|
+
* re-establishment re-drives it. The caller need not guard the call site.
|
|
151
|
+
*/
|
|
152
|
+
reEmitParkedCorrelations(): Promise<void>;
|
|
92
153
|
/**
|
|
93
154
|
* Current snapshot of the credentials pushed to the child. Surfaced
|
|
94
155
|
* so the host can audit the per-step contentHash without
|
|
@@ -172,6 +233,14 @@ export type DeliverSourcesOpts = {
|
|
|
172
233
|
/** The default source id; the wire boundary requires it to equal `sources[0].id`. */
|
|
173
234
|
defaultSource: string;
|
|
174
235
|
};
|
|
236
|
+
export type DeliverCredentialsOpts = {
|
|
237
|
+
/**
|
|
238
|
+
* The refreshed credential material and per-handle descriptors. A revoked
|
|
239
|
+
* credential is delivered by omitting its material entry, so the child's
|
|
240
|
+
* wholesale swap evicts it.
|
|
241
|
+
*/
|
|
242
|
+
delivery: CredentialDelivery;
|
|
243
|
+
};
|
|
175
244
|
export type RecycleOpts = {
|
|
176
245
|
reason: string;
|
|
177
246
|
/**
|
|
@@ -182,18 +251,6 @@ export type RecycleOpts = {
|
|
|
182
251
|
*/
|
|
183
252
|
origin?: RecycleOrigin;
|
|
184
253
|
};
|
|
185
|
-
/**
|
|
186
|
-
* Raised when a `pendingMerges` entry or a
|
|
187
|
-
* `markConsumedCompletionWaiters` waiter is rejected because the
|
|
188
|
-
* cohort it was registered against has been aborted (cohort transition
|
|
189
|
-
* during a recycle, or a supervisor shutdown). Callers awaiting the
|
|
190
|
-
* resolved value receive an instance of this error so the failure mode
|
|
191
|
-
* is recognisable from a generic substrate-merge or markConsumed
|
|
192
|
-
* failure.
|
|
193
|
-
*/
|
|
194
|
-
export declare class MergeAbortedError extends Error {
|
|
195
|
-
constructor(reason: string);
|
|
196
|
-
}
|
|
197
254
|
/**
|
|
198
255
|
* Construct a per-deployment supervisor. All host-specific
|
|
199
256
|
* dependencies are pulled in via `bindings`; nothing in the
|