owenloop 0.5.7 → 0.5.9
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 +41 -0
- package/README.md +7 -8
- package/dist/packages/work/src/agent/capability-model.d.ts +64 -82
- package/dist/packages/work/src/agent/capability-model.js +94 -91
- package/dist/packages/work/src/agent/loop.d.ts +55 -26
- package/dist/packages/work/src/agent/loop.js +144 -50
- package/dist/packages/work/src/bundle/types.d.ts +3 -3
- package/dist/packages/work/src/consumed-verifier.js +6 -17
- package/dist/packages/work/src/exec/loop.d.ts +1 -1
- package/dist/packages/work/src/exec/loop.js +206 -35
- package/dist/packages/work/src/exec/receipt.d.ts +7 -7
- package/dist/packages/work/src/exec/receipt.js +6 -6
- package/dist/packages/work/src/harness/child-env.js +4 -5
- package/dist/packages/work/src/harness/claude.js +100 -0
- package/dist/packages/work/src/harness/codex.js +3 -4
- package/dist/packages/work/src/harness/session-store.d.ts +63 -3
- package/dist/packages/work/src/harness/session-store.js +104 -9
- package/dist/packages/work/src/hub/client.d.ts +19 -4
- package/dist/packages/work/src/hub/client.js +7 -3
- package/dist/packages/work/src/hub/types.d.ts +87 -3
- package/dist/packages/work/src/main.js +1 -0
- package/dist/packages/work/src/roles/agent-run.js +46 -43
- package/dist/packages/work/src/roles/exec.js +2 -0
- package/dist/packages/work/src/roles/sessions.d.ts +3 -2
- package/dist/packages/work/src/roles/sessions.js +9 -2
- package/dist/packages/work/src/roles/settings.js +3 -1
- package/dist/packages/work/src/roles/shift.js +14 -2
- package/dist/packages/work/src/roles/util.d.ts +1 -0
- package/dist/packages/work/src/roles/util.js +10 -0
- package/dist/packages/work/src/settings/hub-roster-cache.d.ts +68 -0
- package/dist/packages/work/src/settings/hub-roster-cache.js +370 -0
- package/dist/packages/work/src/settings/roster.d.ts +105 -0
- package/dist/packages/work/src/settings/roster.js +439 -0
- package/dist/packages/work/src/settings/serving.d.ts +17 -0
- package/dist/packages/work/src/settings/serving.js +79 -0
- package/dist/packages/work/src/settings/settings.d.ts +25 -24
- package/dist/packages/work/src/settings/settings.js +29 -33
- package/dist/packages/work/src/shift/loop.d.ts +108 -5
- package/dist/packages/work/src/shift/loop.js +299 -51
- package/dist/packages/work/src/shift/protocol.d.ts +7 -5
- package/dist/packages/work/src/shift/runtime.d.ts +15 -0
- package/dist/packages/work/src/shift/runtime.js +95 -13
- package/dist/packages/work/src/shift/server.js +2 -0
- package/dist/packages/work/src/shift/spawn.d.ts +18 -50
- package/dist/packages/work/src/shift/spawn.js +30 -65
- package/dist/packages/work/src/shift/state.d.ts +29 -2
- package/dist/packages/work/src/shift/state.js +45 -15
- package/dist/packages/work/src/usage.d.ts +1 -1
- package/dist/packages/work/src/usage.js +10 -5
- package/dist/packages/work/src/util/modifier-init.d.ts +7 -0
- package/dist/packages/work/src/util/modifier-init.js +73 -0
- package/dist/src/bundle/tar.d.ts +9 -4
- package/dist/src/bundle/tar.js +9 -4
- package/dist/src/capabilities.d.ts +50 -0
- package/dist/src/capabilities.js +38 -0
- package/dist/src/cli.d.ts +15 -1
- package/dist/src/cli.js +1099 -32
- package/dist/src/config-dir.d.ts +14 -19
- package/dist/src/config-dir.js +16 -24
- package/dist/src/credentials.d.ts +1 -1
- package/dist/src/credentials.js +1 -1
- package/dist/src/crypto/index.d.ts +1 -1
- package/dist/src/crypto/index.js +1 -1
- package/dist/src/crypto/org-root.d.ts +30 -12
- package/dist/src/crypto/org-root.js +162 -14
- package/dist/src/crypto/records.d.ts +3 -0
- package/dist/src/crypto/records.js +8 -0
- package/dist/src/crypto/trust-roots.d.ts +2 -2
- package/dist/src/crypto/trust-roots.js +2 -2
- package/dist/src/defs.d.ts +6 -1
- package/dist/src/defs.js +203 -8
- package/dist/src/engine.d.ts +55 -6
- package/dist/src/engine.js +172 -22
- package/dist/src/global-config.d.ts +4 -7
- package/dist/src/global-config.js +4 -7
- package/dist/src/hub.d.ts +207 -5
- package/dist/src/hub.js +263 -3
- package/dist/src/index.d.ts +5 -5
- package/dist/src/index.js +3 -3
- package/dist/src/mcp/serve.d.ts +22 -0
- package/dist/src/mcp/serve.js +88 -8
- package/dist/src/model.d.ts +2 -0
- package/dist/src/model.js +32 -25
- package/dist/src/order-resolver.d.ts +1 -0
- package/dist/src/order-resolver.js +8 -1
- package/dist/src/schemas/index.d.ts +19 -0
- package/dist/src/schemas/order.v1.schema.json +13 -2
- package/dist/src/store/pre-commit-verifier.js +1 -1
- package/dist/src/store.d.ts +5 -0
- package/dist/src/store.js +43 -8
- package/dist/src/types.d.ts +64 -7
- package/dist/src/work-settings.d.ts +2 -4
- package/dist/src/work-settings.js +2 -4
- package/docs/agent-runner.md +2 -2
- package/docs/authoring.md +90 -2
- package/docs/bundles.md +29 -3
- package/docs/cli.md +456 -120
- package/docs/crypto.md +32 -16
- package/docs/design.md +70 -1
- package/docs/routing.md +762 -0
- package/docs/shift-logs.md +37 -10
- package/docs/wire-contracts.md +50 -7
- package/examples/workflows/delivery.yaml +31 -14
- package/examples/workflows/ship.yaml +10 -2
- package/package.json +1 -1
- package/plugins/claude-code/plugin/.claude-plugin/plugin.json +1 -1
- package/plugins/claude-code/plugin/.mcp.json +1 -1
- package/plugins/claude-code/plugin/skills/author/SKILL.md +1 -2
- package/plugins/codex/plugins/owenloop/.codex-plugin/plugin.json +1 -1
- package/plugins/codex/plugins/owenloop/.mcp.json +1 -1
- package/plugins/codex/plugins/owenloop/skills/author/SKILL.md +1 -2
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
import { existsSync, readFileSync } from 'node:fs';
|
|
16
16
|
import { isAbsolute, join } from 'node:path';
|
|
17
17
|
import { owenloopConfigDir } from "../../../../src/config-dir.js";
|
|
18
|
-
import {
|
|
18
|
+
import { validateRoster } from "../agent/capability-model.js";
|
|
19
19
|
/** The known settings keys, in the order `owenloop work settings` prints them. */
|
|
20
20
|
export const KNOWN_SETTINGS_KEYS = [
|
|
21
21
|
'hubOrigin',
|
|
@@ -28,34 +28,30 @@ export const KNOWN_SETTINGS_KEYS = [
|
|
|
28
28
|
'defPolicy',
|
|
29
29
|
'artifactPolicy',
|
|
30
30
|
'maxConcurrentAgents',
|
|
31
|
+
'execReserve',
|
|
32
|
+
'localQueueHoldMs',
|
|
31
33
|
'workRoot',
|
|
32
34
|
'workRepo',
|
|
33
35
|
'allowedWorkdirRoots',
|
|
34
|
-
'
|
|
36
|
+
'roster',
|
|
35
37
|
];
|
|
36
38
|
/**
|
|
37
39
|
* Keys owenloop still RECOGNIZES but no longer acts on. Each one produces a
|
|
38
40
|
* warning naming what replaced it, and is excluded from `unrecognized` so the
|
|
39
41
|
* same key is not also reported as a likely typo.
|
|
40
42
|
*
|
|
41
|
-
* Distinct from
|
|
42
|
-
*
|
|
43
|
-
*
|
|
43
|
+
* Distinct from unrecognized keys, which are surfaced as likely typos. These
|
|
44
|
+
* are recognized legacy settings whose removal leaves current shift behavior
|
|
45
|
+
* unchanged, so they remain a warning rather than a load failure.
|
|
44
46
|
*/
|
|
45
47
|
export const RETIRED_IGNORED_KEYS = ['escalateAt', 'escalationExtensionKey'];
|
|
46
48
|
/**
|
|
47
49
|
* Resolve the settings file path from the caller's env, through the one shared
|
|
48
50
|
* ladder in `src/config-dir.ts`: `$OWENLOOP_CONFIG_DIR/settings.json` when
|
|
49
51
|
* `OWENLOOP_CONFIG_DIR` is set and non-blank (it must be absolute), else
|
|
50
|
-
* `$
|
|
51
|
-
*
|
|
52
|
-
*
|
|
53
|
-
*
|
|
54
|
-
* `OWENLOOP_CONFIG_DIR` is the variable an operator running SEVERAL shifts on
|
|
55
|
-
* one machine should reach for. Setting `XDG_CONFIG_HOME` per shift also works,
|
|
56
|
-
* but a shift spreads its whole environment into every worker and every command
|
|
57
|
-
* step's child, so relocating `XDG_CONFIG_HOME` relocates the config of `gh`,
|
|
58
|
-
* `git`, `gcloud`, and everything else those steps shell out to.
|
|
52
|
+
* `$HOME/.owenloop/settings.json`. Throws when no rung yields a value rather
|
|
53
|
+
* than guessing a home directory. `OWENLOOP_CONFIG_DIR` remains for tests and
|
|
54
|
+
* throwaway isolation, not normal operator configuration.
|
|
59
55
|
*/
|
|
60
56
|
export function settingsPath(env) {
|
|
61
57
|
return join(owenloopConfigDir(env), 'settings.json');
|
|
@@ -102,17 +98,16 @@ export function validateSettings(raw, path) {
|
|
|
102
98
|
throw bad('maxConcurrentAgents', 'a positive integer', v);
|
|
103
99
|
}
|
|
104
100
|
}
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
`Depth now rides on the capability's modifier suffix, not on a tier rung.`);
|
|
101
|
+
if ('execReserve' in obj) {
|
|
102
|
+
const v = obj['execReserve'];
|
|
103
|
+
if (typeof v !== 'number' || !Number.isInteger(v) || v < 0) {
|
|
104
|
+
throw bad('execReserve', 'a non-negative integer', v);
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
if ('localQueueHoldMs' in obj) {
|
|
108
|
+
const v = obj['localQueueHoldMs'];
|
|
109
|
+
if (typeof v !== 'number' || !Number.isInteger(v) || v < 0) {
|
|
110
|
+
throw bad('localQueueHoldMs', 'a non-negative integer', v);
|
|
116
111
|
}
|
|
117
112
|
}
|
|
118
113
|
if ('allowedWorkdirRoots' in obj) {
|
|
@@ -137,22 +132,23 @@ export function validateSettings(raw, path) {
|
|
|
137
132
|
}
|
|
138
133
|
}
|
|
139
134
|
if ('capabilityModels' in obj) {
|
|
140
|
-
|
|
135
|
+
throw new Error(`invalid settings file at ${path}: 'capabilityModels' was replaced by 'roster'. ` +
|
|
136
|
+
`Use {"roster":{"wise":[{"harness":"<harness-id>","model":"<model-id>","effort":"high"}]}}.`);
|
|
137
|
+
}
|
|
138
|
+
if ('roster' in obj) {
|
|
139
|
+
const v = obj['roster'];
|
|
141
140
|
if (typeof v !== 'object' || v === null || Array.isArray(v)) {
|
|
142
|
-
throw bad('
|
|
141
|
+
throw bad('roster', 'a JSON object mapping capabilities to candidate arrays', v);
|
|
143
142
|
}
|
|
144
|
-
// Row shape and effort validity are checked at LOAD, not at resolution: a
|
|
145
|
-
// shift whose map is wrong should fail when it starts, not on the first
|
|
146
|
-
// order that happens to land on the broken row, hours later.
|
|
147
143
|
try {
|
|
148
|
-
|
|
144
|
+
validateRoster(v, 'roster');
|
|
149
145
|
}
|
|
150
146
|
catch (e) {
|
|
151
147
|
throw new Error(`invalid settings file at ${path}: ${e instanceof Error ? e.message : String(e)}`);
|
|
152
148
|
}
|
|
153
149
|
}
|
|
154
|
-
// RETIRED, BUT ONLY A WARNING
|
|
155
|
-
//
|
|
150
|
+
// RETIRED, BUT ONLY A WARNING. The difference is what happens if the key is
|
|
151
|
+
// silently ignored.
|
|
156
152
|
//
|
|
157
153
|
// These two configured the WORKER-LOCAL escalation that bumped an order's
|
|
158
154
|
// model after N judgment rejections. Escalation is now entirely the engine's:
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
+
import { type AcquireFileLockOpts } from '../../../../src/lock.ts';
|
|
1
2
|
import type { HubClient } from '../hub/client.ts';
|
|
2
3
|
import { type WorkOrder } from '../hub/types.ts';
|
|
3
4
|
import type { FetchedStep } from '../bundle/types.ts';
|
|
4
|
-
import { type Liveness } from './state.ts';
|
|
5
|
+
import { type ReconcileOptions, type Liveness } from './state.ts';
|
|
5
6
|
import { sweepWorkDirs as sweepWorkDirsImpl } from '../agent/workdir.ts';
|
|
6
7
|
import type { Spawner } from './spawn.ts';
|
|
7
8
|
import { type ShiftEvent } from './protocol.ts';
|
|
@@ -22,7 +23,8 @@ export interface ShiftLoopOptions {
|
|
|
22
23
|
onEvent?: (event: ShiftEvent) => void;
|
|
23
24
|
cacheDir: string;
|
|
24
25
|
stateDir: string;
|
|
25
|
-
/** Max concurrent in-flight orders (exec + agent-run children)
|
|
26
|
+
/** Max concurrent in-flight orders (exec + agent-run children), including
|
|
27
|
+
* any slots reserved from the agent lane for exec work. */
|
|
26
28
|
cap: number;
|
|
27
29
|
/** Serve crews this shift accepts (sent to presence + whats_next). INITIAL
|
|
28
30
|
* value only — live-mutable via the `ShiftLoop.setShift` (MCP `clock_in`). */
|
|
@@ -49,12 +51,37 @@ export interface ShiftLoopOptions {
|
|
|
49
51
|
resolveOrderStep?: (order: WorkOrder) => Promise<FetchedStep | undefined>;
|
|
50
52
|
pollIntervalMs: number;
|
|
51
53
|
presenceIntervalMs: number;
|
|
54
|
+
/** Weak hub-roster cache refresh cadence; undefined disables refresh. */
|
|
55
|
+
rosterSyncIntervalMs?: number;
|
|
56
|
+
/** Upper bound for one low-priority refresh attempt. */
|
|
57
|
+
rosterSyncTimeoutMs?: number;
|
|
58
|
+
/** Daemon-owned cache write, injected so failure cannot kill the loop. */
|
|
59
|
+
syncRosters?: (signal: AbortSignal) => Promise<void>;
|
|
60
|
+
/**
|
|
61
|
+
* Compute the serving set for the live serve crews. Kept injectable so the
|
|
62
|
+
* loop does no filesystem work; absent means the legitimate empty set.
|
|
63
|
+
*/
|
|
64
|
+
computeServeCapabilities?: (crews: readonly string[]) => string[];
|
|
52
65
|
/**
|
|
53
66
|
* Max concurrent `agent-run` children (default 4). A SECOND budget, applied
|
|
54
|
-
*
|
|
55
|
-
*
|
|
67
|
+
* INSIDE `cap` — never a replacement for it. The effective budget also
|
|
68
|
+
* accounts for `execReserve`. An agent turn is long and memory-heavy where
|
|
69
|
+
* a command is short, so the two cannot share one number.
|
|
56
70
|
*/
|
|
57
71
|
maxConcurrentAgents?: number;
|
|
72
|
+
/**
|
|
73
|
+
* Slots INSIDE `cap` that `agent-run` children may never occupy, so an
|
|
74
|
+
* exec/command order always has somewhere to land (default 1).
|
|
75
|
+
*
|
|
76
|
+
* A scheduling control, not a capacity one: it never raises the total child
|
|
77
|
+
* ceiling. Clamped to `cap - 1` so it cannot consume the whole cap.
|
|
78
|
+
*/
|
|
79
|
+
execReserve?: number;
|
|
80
|
+
/**
|
|
81
|
+
* How long to retain a claim this shift cannot dispatch before returning it
|
|
82
|
+
* to the hub. Defaults to 0: do not queue locally.
|
|
83
|
+
*/
|
|
84
|
+
localQueueHoldMs?: number;
|
|
58
85
|
/**
|
|
59
86
|
* PHASE 4 — the root under which per-RUN agent work directories live
|
|
60
87
|
* (`<workRoot>/<workflow>/<run>/`). ABSENT DISABLES THE REAPER entirely: with
|
|
@@ -72,10 +99,34 @@ export interface ShiftLoopOptions {
|
|
|
72
99
|
once?: boolean;
|
|
73
100
|
/** Injectable liveness probe (tests). */
|
|
74
101
|
isAlive?: Liveness;
|
|
102
|
+
/** Test seam for deterministic races at the shared dispatch lock. */
|
|
103
|
+
dispatchLockOptions?: Pick<AcquireFileLockOpts, 'beforeOpen'>;
|
|
75
104
|
/** PHASE 4 — injected in tests so the reaper can be exercised without a
|
|
76
105
|
* filesystem. Defaults to `sweepWorkDirs` from `src/agent/workdir.ts`. */
|
|
77
106
|
sweepWorkDirs?: typeof sweepWorkDirsImpl;
|
|
78
107
|
}
|
|
108
|
+
export interface LockedRemovalOptions {
|
|
109
|
+
dispatchLockOptions?: Pick<AcquireFileLockOpts, 'beforeOpen'>;
|
|
110
|
+
waitMs?: number;
|
|
111
|
+
label?: string;
|
|
112
|
+
}
|
|
113
|
+
/** Run a state mutation while holding the lock that serializes dispatch state. */
|
|
114
|
+
export declare function withDispatchLock<T>(stateDir: string, options: LockedRemovalOptions | undefined, fn: () => T): T;
|
|
115
|
+
/**
|
|
116
|
+
* Remove one child record while holding the same lock that serializes durable
|
|
117
|
+
* reservation creation. The record is deliberately re-read by
|
|
118
|
+
* `removeChildRecord` only after acquisition, so a stale observer cannot erase
|
|
119
|
+
* a newer dispatch for the same run.
|
|
120
|
+
*/
|
|
121
|
+
export declare function removeChildRecordUnderDispatchLock(stateDir: string, run: string, recordOptions?: {
|
|
122
|
+
pid?: number;
|
|
123
|
+
}, options?: LockedRemovalOptions): boolean;
|
|
124
|
+
/**
|
|
125
|
+
* Reconciliation callbacks for every unlocked Shift daemon path. Keep these
|
|
126
|
+
* together with the lock-held removal primitive so startup and the poll loop
|
|
127
|
+
* cannot silently diverge.
|
|
128
|
+
*/
|
|
129
|
+
export declare function createLockedRemovalCallbacks(stateDir: string, options?: LockedRemovalOptions): Pick<ReconcileOptions, 'removeAbandonedReservation' | 'removeDeadChild' | 'settleLiveChild'>;
|
|
79
130
|
export interface ShiftLoop {
|
|
80
131
|
run(): Promise<number>;
|
|
81
132
|
stop(): void;
|
|
@@ -90,6 +141,8 @@ export interface ShiftLoop {
|
|
|
90
141
|
freeCapacity(): number;
|
|
91
142
|
/** Live dispatch-cap used by status and next responses. */
|
|
92
143
|
getCap(): number;
|
|
144
|
+
/** Live agent-lane ceiling after the exec reserve is applied. */
|
|
145
|
+
agentCeiling(): number;
|
|
93
146
|
/** Adjust the live dispatch cap for internal callers and tests. */
|
|
94
147
|
setCap(cap: number): void;
|
|
95
148
|
/** The shift's live identity: the presence name and the crew scope (`serve_crews`)
|
|
@@ -99,6 +152,8 @@ export interface ShiftLoop {
|
|
|
99
152
|
name: string;
|
|
100
153
|
serveCrews: string[];
|
|
101
154
|
};
|
|
155
|
+
/** The derived serving set currently advertised to the hub. */
|
|
156
|
+
getServeCapabilities(): string[];
|
|
102
157
|
/** Set the live shift identity (the socket `clock_in` operation). A field left ABSENT is
|
|
103
158
|
* left unchanged; `serveCrews: []` explicitly means "all crews". Also makes the
|
|
104
159
|
* next presence ping due immediately, so the new identity reaches the hub on the
|
|
@@ -124,6 +179,17 @@ export interface ShiftLoop {
|
|
|
124
179
|
* next reconcile's pid probe frees the slot anyway.
|
|
125
180
|
*/
|
|
126
181
|
noteRunEnded(run: string): void;
|
|
182
|
+
/**
|
|
183
|
+
* A dispatched worker process ENDED. Frees the dispatch slot it held on every
|
|
184
|
+
* terminal outcome, including a mid-turn completion that exits 0. This is the
|
|
185
|
+
* primary release path; reconciliation remains the crash/restart backstop.
|
|
186
|
+
*/
|
|
187
|
+
noteChildExited(exit: {
|
|
188
|
+
workflow: string;
|
|
189
|
+
run: string;
|
|
190
|
+
kind: 'exec' | 'agent-run';
|
|
191
|
+
pid: number;
|
|
192
|
+
}): void;
|
|
127
193
|
/**
|
|
128
194
|
* A dispatched child exited non-zero. Charges one failure against that run's
|
|
129
195
|
* STEP and arms the brake window — see `STEP_BRAKE_DELAYS_MS`.
|
|
@@ -142,9 +208,46 @@ export interface ShiftLoop {
|
|
|
142
208
|
run: string;
|
|
143
209
|
}): void;
|
|
144
210
|
}
|
|
211
|
+
/** The hub reaps a never-contacted claim after this long. Every client-side
|
|
212
|
+
* re-offer latency must stay strictly under it. */
|
|
213
|
+
export declare const HUB_PICKUP_WINDOW_MS = 120000;
|
|
145
214
|
/**
|
|
146
215
|
* The hub reaps a never-contacted claim after 120 seconds. Stop local queueing
|
|
147
216
|
* after 90 seconds so a detached child retains 30 seconds to make first contact.
|
|
148
217
|
*/
|
|
149
|
-
export declare const MAX_PENDING_CANDIDATE_AGE_MS
|
|
218
|
+
export declare const MAX_PENDING_CANDIDATE_AGE_MS: number;
|
|
219
|
+
/**
|
|
220
|
+
* THE PER-STEP FAILURE BRAKE.
|
|
221
|
+
*
|
|
222
|
+
* Every in-flight guard in this file keys on the RUN id — `liveRuns`,
|
|
223
|
+
* `workerRuns`, `claimed`, `pendingCandidates`. That is correct for the case
|
|
224
|
+
* they were written for: one claim, one child. It is blind to the case where a
|
|
225
|
+
* step fails the same way forever.
|
|
226
|
+
*
|
|
227
|
+
* Observed 2026-08-12: `local-check` of one instance was dispatched five-plus
|
|
228
|
+
* times in seconds under a DIFFERENT run id each time
|
|
229
|
+
* (run_fd94d88a…, run_5ec4d807…, run_d8cdf03f…, run_67c8e2db…, run_072755ba…).
|
|
230
|
+
* The child refused its consumed artifact, exited non-zero WITHOUT submitting,
|
|
231
|
+
* the hub released the claim, and the next poll handed the same step back under
|
|
232
|
+
* a fresh run id. A fresh run id matches none of the run-keyed guards, so
|
|
233
|
+
* nothing bounded the respawns.
|
|
234
|
+
*
|
|
235
|
+
* So the brake is keyed on the identity that actually repeats — the STEP, as
|
|
236
|
+
* `(workflow, step, key)`. `key` is part of the identity because a fanned-out
|
|
237
|
+
* step has one legitimately concurrent order per key, and those must not brake
|
|
238
|
+
* each other.
|
|
239
|
+
*
|
|
240
|
+
* WHAT IS COUNTED, AND WHY IT IS NOT DISPATCHES. The event counted against that
|
|
241
|
+
* key is a WORKER FAILURE — a child that exited non-zero, reported into the
|
|
242
|
+
* loop through `noteWorkerFailure` — never a dispatch. Counting dispatches
|
|
243
|
+
* conflates a storm with legitimate concurrency: the hub can offer several
|
|
244
|
+
* DISTINCT runs of one step in a single sweep, and metering the second through
|
|
245
|
+
* fifth of those would throttle healthy work. A failure is direct evidence that
|
|
246
|
+
* running this step again right now is unlikely to help; a dispatch is evidence
|
|
247
|
+
* of nothing.
|
|
248
|
+
*
|
|
249
|
+
* It is a rate limit, never a ban. A step that has not failed is dispatched
|
|
250
|
+
* with zero delay, however many orders arrive for it at once.
|
|
251
|
+
*/
|
|
252
|
+
export declare const STEP_BRAKE_DELAYS_MS: readonly [2000, 8000, 30000, 60000, 90000];
|
|
150
253
|
export declare function createShiftLoop(opts: ShiftLoopOptions): ShiftLoop;
|