@jive-sh/workflow-platform 0.6.3 → 1.0.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.
Files changed (174) hide show
  1. package/README.md +66 -295
  2. package/component/_generated/api.ts +72 -0
  3. package/component/_generated/component.ts +621 -0
  4. package/component/_generated/dataModel.ts +60 -0
  5. package/component/_generated/server.ts +169 -0
  6. package/component/convex.config.ts +3 -0
  7. package/component/engine.ts +755 -0
  8. package/component/errors.ts +66 -0
  9. package/component/events.ts +17 -0
  10. package/component/notes.ts +13 -0
  11. package/component/places.ts +136 -0
  12. package/component/retention.ts +205 -0
  13. package/component/runEngine.ts +25 -0
  14. package/component/schema.ts +132 -0
  15. package/component/steps.ts +188 -0
  16. package/component/store.ts +512 -0
  17. package/component/tasks.ts +289 -0
  18. package/component/worker.ts +109 -0
  19. package/component/workflows.ts +83 -0
  20. package/dist/definition/agent-runner.js +9 -0
  21. package/dist/definition/agent-runner.js.map +1 -0
  22. package/dist/definition/file-store.js +9 -0
  23. package/dist/definition/file-store.js.map +1 -0
  24. package/dist/definition/program-build.js +10 -0
  25. package/dist/definition/program-build.js.map +1 -0
  26. package/dist/definition/step.js +1 -0
  27. package/dist/definition/step.js.map +1 -0
  28. package/dist/definition/task-schema.js +5 -0
  29. package/dist/definition/task-schema.js.map +1 -0
  30. package/dist/definition/tasks.js +9 -0
  31. package/dist/definition/tasks.js.map +1 -0
  32. package/dist/definition/workflow.js +111 -0
  33. package/dist/definition/workflow.js.map +1 -0
  34. package/dist/graph.js +301 -9
  35. package/dist/graph.js.map +1 -1
  36. package/dist/index.js +7 -133
  37. package/dist/index.js.map +1 -1
  38. package/package.json +9 -4
  39. package/src/definition/agent-runner.ts +59 -0
  40. package/src/definition/file-store.ts +20 -0
  41. package/src/definition/program-build.ts +30 -0
  42. package/src/definition/step.ts +106 -0
  43. package/src/definition/task-schema.ts +15 -0
  44. package/src/definition/tasks.ts +43 -0
  45. package/src/definition/workflow.ts +255 -0
  46. package/src/graph.ts +341 -19
  47. package/src/index.ts +8 -168
  48. package/worker/directory-file-store.ts +42 -0
  49. package/worker/index.ts +12 -0
  50. package/worker/platform-client.ts +138 -0
  51. package/worker/step-meter.ts +80 -0
  52. package/worker/worker-tasks.ts +27 -0
  53. package/worker/worker.test.ts +200 -0
  54. package/worker/worker.ts +240 -0
  55. package/dist/budget-states.js +0 -30
  56. package/dist/budget-states.js.map +0 -1
  57. package/dist/cpu-limit/limiter.js +0 -839
  58. package/dist/cpu-limit/limiter.js.map +0 -1
  59. package/dist/cpu-limit/use.js +0 -139
  60. package/dist/cpu-limit/use.js.map +0 -1
  61. package/dist/dashboard/agent-usage.js +0 -25
  62. package/dist/dashboard/agent-usage.js.map +0 -1
  63. package/dist/dashboard/dashboard.css +0 -134
  64. package/dist/dashboard/drilldown.js +0 -16
  65. package/dist/dashboard/drilldown.js.map +0 -1
  66. package/dist/dashboard/queue-lines.js +0 -44
  67. package/dist/dashboard/queue-lines.js.map +0 -1
  68. package/dist/dashboard/queue-table.js +0 -16
  69. package/dist/dashboard/queue-table.js.map +0 -1
  70. package/dist/dashboard/spending-words.js +0 -32
  71. package/dist/dashboard/spending-words.js.map +0 -1
  72. package/dist/failure.js +0 -35
  73. package/dist/failure.js.map +0 -1
  74. package/dist/keep-running.js +0 -77
  75. package/dist/keep-running.js.map +0 -1
  76. package/dist/outside-failure.js +0 -31
  77. package/dist/outside-failure.js.map +0 -1
  78. package/dist/pick-wakes.js +0 -125
  79. package/dist/pick-wakes.js.map +0 -1
  80. package/dist/project.js +0 -1
  81. package/dist/project.js.map +0 -1
  82. package/dist/queue-counts.js +0 -51
  83. package/dist/queue-counts.js.map +0 -1
  84. package/dist/reasons.js +0 -33
  85. package/dist/reasons.js.map +0 -1
  86. package/dist/spending-limit.js +0 -88
  87. package/dist/spending-limit.js.map +0 -1
  88. package/dist/step-files.js +0 -200
  89. package/dist/step-files.js.map +0 -1
  90. package/dist/step-meter.js +0 -97
  91. package/dist/step-meter.js.map +0 -1
  92. package/dist/step-usage.js +0 -19
  93. package/dist/step-usage.js.map +0 -1
  94. package/dist/steps.js +0 -920
  95. package/dist/steps.js.map +0 -1
  96. package/dist/storage/budgets.js +0 -85
  97. package/dist/storage/budgets.js.map +0 -1
  98. package/dist/storage/engine-records.js +0 -75
  99. package/dist/storage/engine-records.js.map +0 -1
  100. package/dist/storage/engine-storage.js +0 -67
  101. package/dist/storage/engine-storage.js.map +0 -1
  102. package/dist/storage/input-records.js +0 -12
  103. package/dist/storage/input-records.js.map +0 -1
  104. package/dist/storage/move-store.js +0 -251
  105. package/dist/storage/move-store.js.map +0 -1
  106. package/dist/storage/sqlite-store.js +0 -723
  107. package/dist/storage/sqlite-store.js.map +0 -1
  108. package/dist/storage/step-records.js +0 -11
  109. package/dist/storage/step-records.js.map +0 -1
  110. package/dist/storage/storage-error.js +0 -19
  111. package/dist/storage/storage-error.js.map +0 -1
  112. package/dist/storage/task-store.js +0 -24
  113. package/dist/storage/task-store.js.map +0 -1
  114. package/dist/tasks.js +0 -475
  115. package/dist/tasks.js.map +0 -1
  116. package/dist/views/format.js +0 -37
  117. package/dist/views/format.js.map +0 -1
  118. package/dist/views/runs-now.js +0 -75
  119. package/dist/views/runs-now.js.map +0 -1
  120. package/dist/views/step-funnel.js +0 -98
  121. package/dist/views/step-funnel.js.map +0 -1
  122. package/dist/views/step-graph.js +0 -34
  123. package/dist/views/step-graph.js.map +0 -1
  124. package/dist/views/workflow-flows.js +0 -53
  125. package/dist/views/workflow-flows.js.map +0 -1
  126. package/dist/views/workflows-view.js +0 -230
  127. package/dist/views/workflows-view.js.map +0 -1
  128. package/src/budget-states.ts +0 -55
  129. package/src/cpu-limit/limiter.ts +0 -935
  130. package/src/cpu-limit/use.ts +0 -166
  131. package/src/dashboard/agent-usage-line.tsx +0 -28
  132. package/src/dashboard/agent-usage.ts +0 -48
  133. package/src/dashboard/dashboard.css +0 -134
  134. package/src/dashboard/drilldown.ts +0 -43
  135. package/src/dashboard/index.tsx +0 -4
  136. package/src/dashboard/machine-controls.tsx +0 -53
  137. package/src/dashboard/queue-bar.tsx +0 -43
  138. package/src/dashboard/queue-chart.tsx +0 -150
  139. package/src/dashboard/queue-lines.ts +0 -87
  140. package/src/dashboard/queue-table.ts +0 -37
  141. package/src/dashboard/spending-limit-control.tsx +0 -50
  142. package/src/dashboard/spending-words.ts +0 -50
  143. package/src/dashboard/step-graph.tsx +0 -106
  144. package/src/dashboard/workflow-dag.tsx +0 -204
  145. package/src/dashboard/workflow-drilldown.tsx +0 -89
  146. package/src/dashboard/workflows-dashboard.tsx +0 -414
  147. package/src/failure.ts +0 -36
  148. package/src/keep-running.ts +0 -83
  149. package/src/outside-failure.ts +0 -39
  150. package/src/pick-wakes.ts +0 -182
  151. package/src/project.ts +0 -115
  152. package/src/queue-counts.ts +0 -64
  153. package/src/reasons.ts +0 -30
  154. package/src/spending-limit.ts +0 -156
  155. package/src/step-files.ts +0 -208
  156. package/src/step-meter.ts +0 -120
  157. package/src/step-usage.ts +0 -23
  158. package/src/steps.ts +0 -1239
  159. package/src/storage/budgets.ts +0 -113
  160. package/src/storage/engine-records.ts +0 -102
  161. package/src/storage/engine-storage.ts +0 -82
  162. package/src/storage/input-records.ts +0 -43
  163. package/src/storage/move-store.ts +0 -265
  164. package/src/storage/sqlite-store.ts +0 -829
  165. package/src/storage/step-records.ts +0 -306
  166. package/src/storage/storage-error.ts +0 -35
  167. package/src/storage/task-store.ts +0 -235
  168. package/src/tasks.ts +0 -561
  169. package/src/views/format.ts +0 -40
  170. package/src/views/runs-now.ts +0 -120
  171. package/src/views/step-funnel.ts +0 -163
  172. package/src/views/step-graph.ts +0 -68
  173. package/src/views/workflow-flows.ts +0 -97
  174. package/src/views/workflows-view.ts +0 -443
package/dist/steps.js DELETED
@@ -1,920 +0,0 @@
1
- /**
2
- * THE ONE WAY TO DEFINE A WORKFLOW AND ITS STEPS.
3
- *
4
- * A workflow states its phase (where the project shows it), its steps and the item it works on, and each step states
5
- * whether it needs an agent; nothing else defines a step. Every run of every step goes through the same code here, which
6
- * writes its one record (`storage/step-records.ts`): start, end, outcome, tokens, compiles, and a heartbeat while an agent
7
- * works. A dashboard derives all it says from those records and these declarations.
8
- *
9
- * const PICK = defineStep({ name: 'Pick', runs: 'deterministic', description: '...', at: import.meta.path, success: Schema.Number });
10
- * export const MyWorkflow = defineWorkflow({ phase: 'main', description: '...', at: import.meta.path, steps: () => [PICK],
11
- * graph: () => [{ from: RUN_STARTS, to: PICK.name, when: 'each run' }, { from: PICK.name, to: RUN_ENDS, when: 'always' }] })('My workflow', { payload, success, error, idempotencyKey });
12
- * ... yield* PICK.run(Effect.gen(...)); a repeating step gives its number: PICK.run(body, { call: 2 })
13
- *
14
- * Its `graph` says which step can follow which, and when, in plain words (`StepEdge`): a dashboard draws it, and a run that
15
- * takes an edge it does not declare fails in tests.
16
- *
17
- * A step can name the run's item from its result (`subject`), usually at Pick, and later steps inherit it. When the run
18
- * ends the definer records each item's real outcome (`outcomes`). A workflow with an agent step and a list of work needs no
19
- * trigger: the trigger (`keep-running.ts`) keeps its budget's number of runs of it going, so its payload is `{ run }`.
20
- *
21
- * AN ITEM IS TESTED BEFORE AN AGENT SEES IT. Alex, 2026-11-04: "work in the queue should probably undergo an initial round
22
- * of testing before the work gets handed to an agent". A no-agent test step (`defineItemTest`) comes before a workflow's
23
- * first agent step: an item that passes now is finished, with no agent and no tokens; one that fails gives the agent the
24
- * exact failure as its input; one that cannot be tested says why.
25
- *
26
- * An agent call needs `AgentStep`, which only a step that runs agentically (`runs: 'agentic'`) provides, so it cannot compile anywhere else.
27
- *
28
- * A BUDGET LIMITS THE AGENTS WORKING, NOT ONLY THE RUNS STARTED. Before each agent step, a run its workflow's budget has no
29
- * room for ends: oldest runs keep their places, so with 10 going and a budget of 5 exactly the newest 5 end, and no two runs
30
- * have to agree on anything. No agent call is cut off. The check is part of the step's activity, so a resumed run decides
31
- * the same way. The step fails with `STOOD_DOWN`, and the run ends through its failure path, or through its normal one where
32
- * it asks `isStoodDown`.
33
- *
34
- * EVERY ITEM IS A TASK, in one of four statuses read from its notes (`tasks.ts`). A Pick orders its own candidates through `pickOrder`, or
35
- * takes its queue's head; a Pick that finds nothing waits for an event that can change that (`picked`, `pick-wakes.ts`),
36
- * so a run never ends for want of an item.
37
- *
38
- * WHAT A STEP USES IS MEASURED, never reported (`step-meter.ts`): time, tokens, CPU, peak memory, files written and
39
- * compiles, on its one record. A step working on items says which: `subject` names the run's one, `eachItem` gives a batch
40
- * step one record per item, and a step whose work no one item owns declares `shared` rather than dividing it up.
41
- */
42
- import path from 'node:path';
43
- import { Cause, Context, Data, Effect, Exit, pipe, Result, Schedule, Schema, Semaphore } from 'effect';
44
- import { Activity, Workflow, WorkflowEngine } from 'effect/workflow';
45
- import { describeFailure, startAndEnd } from './failure';
46
- import { oneLine, standardReason } from './reasons';
47
- import { filesChanged } from './step-files';
48
- import { edgeDeclared, RUN_ENDS, RUN_STARTS } from './graph';
49
- import { meterClosed, meterOpened, StepMeter } from './step-meter';
50
- import { runLimit } from './storage/budgets';
51
- import { AGENT_BEAT_MS, noSpend } from './storage/step-records';
52
- import { inPickOrder, listOf, queueOrder } from './tasks';
53
- export { A_STEP_FAILS, edgeDeclared, isRetry, RUN_ENDS, RUN_STARTS } from './graph';
54
- /** Provided only inside a step that runs agentically; an agent call reports what it spent through it. */
55
- export class AgentStep extends Context.Service()('AgentStep') {
56
- }
57
- /** The outcome of an item its test passed: finished, with no agent. */
58
- export const CLEARED_BY_TEST = 'cleared by its test, no agent';
59
- /** What an agent step fails with when its run is one too many for its workflow's budget. Stored as the step's result. */
60
- export const STOOD_DOWN = 'stood down: its workflow has more runs going than its budget';
61
- /**
62
- * What a step waiting for work or for an agent fails with when its process hands its runs to the next one
63
- * (`pick-wakes.ts` `releaseWaiting`): its run stands down untried, and the next process starts one.
64
- */
65
- export const HANDED_OVER = 'stood down: its process is handing its runs to the next';
66
- /**
67
- * What a step of a run a sub-workflow step started fails with once the run above it has ended: nothing is left to read its
68
- * result, so it does no more work. Two runs of Write C went on writing, an agent each, for ten minutes after the runs of
69
- * Decompile above them had failed (2026-11-19).
70
- */
71
- export const ABOVE_ENDED = 'stood down: the run above it has ended';
72
- /**
73
- * What an agent step of a run with a task fails with where no agent can be had (`untilAgentSlot`): its task went to the
74
- * back of its queue, marked as needing an agent, and the run gives its slot up untried.
75
- */
76
- export const NEEDS_AN_AGENT_STOOD_DOWN = 'stood down: no agent can be had, so its task went to the back of its queue, marked as needing one';
77
- export const isStoodDown = (failure) => failure === STOOD_DOWN || failure === HANDED_OVER || failure === ABOVE_ENDED || failure === NEEDS_AN_AGENT_STOOD_DOWN;
78
- /** Why no agent can be had at an agents' limit of 0, in words. */
79
- export const AGENTS_LIMIT_ZERO = "its agents' limit is 0";
80
- /** Whether a run is surplus: it is past the budget in the workflow's runs, oldest first. A run not listed is not counted. Pure. */
81
- export const surplusRun = (oldestFirst, run, budget) => oldestFirst.indexOf(run) >= budget;
82
- /**
83
- /**
84
- * WHAT A STEP IS, as a page says it in words. Alex, 2026-11-19: "there are different kinds of workflow steps. like a check,
85
- * like a sub workflow."
86
- *
87
- * step does part of the work;
88
- * check decides whether the work passes;
89
- * sub-workflow a workflow used as a step of another workflow (`StepDeclaration.workflow` names it).
90
- */
91
- export const STEP_KINDS = ['step', 'check', 'sub-workflow'];
92
- /**
93
- * HOW A STEP RUNS, a separate question from what it is. Alex, 2026-11-19: "rather than 'no ai' or 'agent' I think a step
94
- * should be labeled as one of the following 'deterministic', 'agentic' or 'classification' where that third option allows
95
- * for steps which use a separate classifier model".
96
- *
97
- * deterministic code only;
98
- * agentic an agent does it: it waits for one of its workflow's agents (`untilAgentSlot`);
99
- * classification a separate classifier model decides.
100
- *
101
- * A step or a check is any of the three. A sub-workflow step states none: its workflow's own steps state theirs.
102
- */
103
- export const STEP_RUNS = ['deterministic', 'agentic', 'classification'];
104
- /** A step's kind, from its declaration: the kind it states, a check where it is its workflow's test, a step otherwise. Pure. */
105
- export const stepKindOf = (s) => s.kind ?? (s.test === true ? 'check' : 'step');
106
- /** What the test said of an item: it passes now, the exact failure the agent gets, or why it cannot be tested. */
107
- export const ItemTest = Schema.Union([
108
- Schema.Struct({ result: Schema.Literal('passes'), detail: Schema.String }),
109
- Schema.Struct({ result: Schema.Literal('fails'), failure: Schema.String }),
110
- Schema.Struct({ result: Schema.Literal('cannot'), why: Schema.String }),
111
- ]);
112
- /** A run not started: its workflow's run limit was reached. What a start that waits for its result fails with. */
113
- export class RunLimitReached extends Data.TaggedError('RunLimitReached') {
114
- }
115
- /** How often a workflow's refused starts are said, at most: a timer at 0 would say it every turn. */
116
- const REFUSED_SAID_EVERY_MS = 10 * 60 * 1000;
117
- /**
118
- * A WORKFLOW'S RUN LIMIT, whatever starts it: for one its budget keeps going, its run limit or its agents' limit
119
- * (`runLimit`); for any other its run limit, none meaning no limit. 0 starts nothing new. Pure.
120
- */
121
- export const runLimitOf = (d, limits) => keptRunningByItsBudget(d) ? runLimit(limits) : limits.runs;
122
- /** Whether a workflow declares a list, of either kind: it has tasks and a queue. Pure. */
123
- export const hasAList = (d) => d.pending !== undefined || d.items !== undefined;
124
- /** Whether a step uses an agent: it is an agent step, or a sub-workflow step whose workflow has one at any depth. Pure. */
125
- export const stepUsesAnAgent = (s) => s.runs === 'agentic' || s.agentUnder?.() === true;
126
- /** Whether a workflow's budget rules it: a declared list, and an agent step of its own or under a sub-workflow step. Pure. */
127
- export const keptRunningByItsBudget = (d) => hasAList(d) && d.steps().some(stepUsesAnAgent);
128
- const CurrentMeter = Context.Reference('CurrentStepMeter', { defaultValue: () => null });
129
- /** The definer of one project's workflows and steps, on its stores. */
130
- export const makeSteps = (deps) => {
131
- const { stepRecords: records, stepFiles } = deps;
132
- const DECLARED = new Map();
133
- const PICKING = new Map();
134
- const RUN_ENDED = new Set();
135
- const undeclaredSaid = new Set();
136
- /** Each workflow's run items a mark was refused for, said once (`markedAsNeedingAnAgent`). */
137
- const offItsListSaid = new Set();
138
- /**
139
- * EACH RUN'S LAST STEP, as this process ran it, until the run ends. A run resumed from another process has none here, and
140
- * the records of that process say; a record this process wrote for a run that has ended is no step of this one. Read from
141
- * the records alone, a test that names no records file saw every step as a run's first, and two tests reusing a run's id
142
- * saw the other's last step.
143
- */
144
- const lastStepRan = new Map();
145
- const lastStepBefore = (run) => {
146
- const ran = lastStepRan.get(run);
147
- if (ran !== undefined)
148
- return Effect.succeed(ran);
149
- return Effect.map(records.lastStepOf(run), (recorded) => {
150
- const self = deps.thisProcess();
151
- return recorded === null || (recorded.owner !== null && recorded.owner.pid === self.pid && recorded.owner.startedAt === self.startedAt) ? null : recorded;
152
- });
153
- };
154
- /**
155
- * A RECORD FAILING TO WRITE NEVER FAILS THE STEP IT MEASURES: what the store could not write is said, and the step goes
156
- * on with none (`null`).
157
- */
158
- const recorded = (what, write) => Effect.catchTag(write, 'StorageError', (e) => Effect.as(Effect.logError(`[step-runs] ${what}: ${e.reason}`), null));
159
- /** The same from a callback outside any effect (a heartbeat, usage as it arrives): run at once, never waited for. */
160
- const recordNow = (what, write) => { Effect.runFork(recorded(what, write)); };
161
- /** A file's path relative to the project's source root, from its absolute path. */
162
- const sourcePath = (absolute) => path.relative(deps.sourceRoot, absolute).split(path.sep).join('/');
163
- /** The runs of these workflows not finished now, oldest first. */
164
- const runsOldestFirst = (workflows) => deps.engine.runsOldestFirst(workflows);
165
- /** The runs of a workflow not finished now, by the id its step records carry. */
166
- const runningRunIds = (workflow) => deps.engine.runsOldestFirst([workflow]);
167
- /** Runs of a workflow not finished now. */
168
- const runningRuns = (workflow) => deps.engine.runningRuns(workflow);
169
- /**
170
- * One item's part of a batch step: its own record under the step's, with its own time and CPU, and what it used added to
171
- * the step's. Outside a step it just runs the work.
172
- */
173
- const eachItem = (subject, work) => Effect.flatMap(CurrentMeter, (step) => {
174
- if (step === null)
175
- return work;
176
- return Effect.acquireUseRelease(Effect.gen(function* () {
177
- const id = step.record === null ? null : yield* recorded('open an item', records.openStepItem({ stepRun: step.record, subject }));
178
- const meter = new StepMeter(step.record, false, step.writes, step);
179
- meterOpened(meter);
180
- return { id, meter };
181
- }), ({ meter }) => pipe(work, Effect.provideService(deps.CurrentStepUsage, meter)), ({ id, meter }, exit) => Effect.gen(function* () {
182
- meterClosed(meter);
183
- if (id !== null)
184
- yield* recorded('close an item', records.closeStepItem({ id, outcome: Exit.isSuccess(exit) ? 'success' : Cause.hasInterrupts(exit.cause) ? 'interrupted' : 'failure', used: meter.used() }));
185
- }));
186
- });
187
- /**
188
- * Whether this run should stand down before its next agent call, and whether its Pick, finding nothing it can claim, waits
189
- * for work rather than ending its run. A test supplies others.
190
- */
191
- /**
192
- * A declared workflow's limits: its run limit (`runLimitOf`, none for no limit), and its agents' limit where its budget
193
- * keeps it going (none for any other). None for one not declared, or with no store to read.
194
- */
195
- const limitsOf = (workflow) => {
196
- const d = DECLARED.get(workflow);
197
- if (d === undefined)
198
- return Effect.succeed(null);
199
- return Effect.map(deps.budgets.limitsOf(workflow), (limits) => (limits === null ? null : { runs: runLimitOf(d, limits), agents: keptRunningByItsBudget(d) ? limits.agents : null }));
200
- };
201
- /** Whether a run is past the runs its workflow's run limit keeps, oldest first; never where it has no run limit. */
202
- const pastItsRunLimit = (workflow, run) => Effect.flatMap(limitsOf(workflow), (w) => {
203
- const runs = w === null ? null : w.runs;
204
- return runs === null ? Effect.succeed(false) : Effect.map(runsOldestFirst([workflow]), (going) => surplusRun(going, run, runs));
205
- });
206
- /**
207
- * LIMITS THAT CANNOT BE READ HOLD THE RUN WHERE IT IS: it does not stand down, its Pick waits, and its agent step waits for a
208
- * slot, each until the next wake reads them again. Read as no limits, a store that failed would start agents at 0.
209
- */
210
- const unreadLimits = (workflow, held) => (e) => Effect.as(Effect.logError(`[budget] ${workflow}: its limits could not be read (${e.reason}); its runs wait`), held(e.reason));
211
- /**
212
- * THE RUN AT THE TOP OF A RUN: itself, or, for a run a sub-workflow step started, the run at the top of those above it
213
- * (`StepRecords.rootOfRun`). A workflow's limits govern every run under its runs, so a sub-workflow's agent step counts
214
- * against the agents' limit of the workflow at the top. Kept while the run goes: it never changes.
215
- */
216
- const TOPS = new Map();
217
- /** Each workflow's start with no run limit asked, by name: what a sub-workflow step starts it by (`defineSubWorkflow`). */
218
- const STARTS_AS_A_STEP = new Map();
219
- const topOf = (workflow, run) => {
220
- const known = TOPS.get(run);
221
- if (known !== undefined)
222
- return Effect.succeed(known);
223
- return Effect.map(records.rootOfRun(run), (root) => {
224
- const top = root ?? { run, workflow };
225
- TOPS.set(run, top);
226
- return top;
227
- });
228
- };
229
- const AgentBudgets = Context.Reference('AgentBudgets', {
230
- defaultValue: () => ({
231
- // Among its workflow's unfinished runs, oldest first, the run is past those its run limit keeps (`runLimit`). A run not
232
- // listed is not counted. A run a sub-workflow step started stands down with the run at its top.
233
- standsDown: (workflow, run) => pipe(topOf(workflow, run), Effect.flatMap((top) => Effect.zipWith(pastItsRunLimit(workflow, run), top.run === run ? Effect.succeed(false) : pastItsRunLimit(top.workflow, top.run), (own, above) => own || above)), Effect.catchTag('StorageError', unreadLimits(workflow, () => false))),
234
- waitsForWork: (workflow, run) => pipe(pastItsRunLimit(workflow, run), Effect.map((past) => !past), Effect.catchTag('StorageError', unreadLimits(workflow, () => true))),
235
- // The other runs of the workflow at its top that an agent works for, a waiting one not counted, against that
236
- // workflow's agents' limit: at 0 none is ever free, which no agent ending changes.
237
- agentSlot: (workflow, run) => pipe(topOf(workflow, run), Effect.flatMap((top) => Effect.flatMap(limitsOf(top.workflow), (w) => {
238
- const agents = w === null ? null : w.agents;
239
- if (agents === null)
240
- return Effect.succeed({ free: true });
241
- if (agents === 0)
242
- return Effect.succeed({ free: false, why: `waits for an agent: ${AGENTS_LIMIT_ZERO}`, unavailable: AGENTS_LIMIT_ZERO });
243
- return Effect.map(Effect.all({ runs: runsOldestFirst([top.workflow]), inAgentStep: records.runsInAgentStep(top.workflow) }), ({ runs, inAgentStep }) => {
244
- const going = new Set(runs);
245
- const busy = inAgentStep.filter((r) => r !== top.run && going.has(r)).length;
246
- return busy < agents ? { free: true } : { free: false, why: `waits for an agent: ${busy} of its ${agents} in use`, unavailable: null };
247
- });
248
- })), Effect.catchTag('StorageError', unreadLimits(workflow, (why) => ({ free: false, why: `waits for an agent: its limits could not be read (${why})`, unavailable: null })))),
249
- }),
250
- });
251
- /** The task a run at the top works on: its workflow's, where that workflow has a list, on the run's item; none otherwise. */
252
- const taskOfTop = (top) => {
253
- const d = DECLARED.get(top.workflow);
254
- if (d === undefined || !hasAList(d))
255
- return Effect.succeed(null);
256
- return Effect.map(Effect.orElseSucceed(records.subjectOfRun(top.run), () => null), (item) => (item === null ? null : { workflow: top.workflow, item }));
257
- };
258
- /**
259
- * Marks the task of the run at the top as needing an agent; whether it was marked (a run with no task, or no store, is not).
260
- *
261
- * ONLY A TASK ITS PICK READS IS MARKED (`tasks.ts` `readByItsPick`). A mark on any other passes over nothing: the run
262
- * ends, the next takes the same work and ends the same way. Fix conflicts' runs named conflicts while its list named
263
- * functions, and it took the same 3 names 907 times in 75 minutes (2026-11-20). Such a run is a fault in its workflow,
264
- * which names its run's item differently from its list: in a test it fails the run, and live it is said once, and the
265
- * run waits for an agent as a run with no task does. A task whose state cannot be read is marked as before.
266
- */
267
- const markedAsNeedingAnAgent = (top, step, why) => Effect.flatMap(taskOfTop(top), (task) => {
268
- if (task === null)
269
- return Effect.succeed(false);
270
- return Effect.flatMap(Effect.orElseSucceed(deps.tasks.readByItsPick(task), () => true), (read) => {
271
- if (read)
272
- return deps.tasks.markNeedsAgent({ task, by: { workflow: top.workflow, run: top.run, step }, why });
273
- const fault = `${top.workflow}: its run ${top.run} works on ${task.item}, which is not a task its Pick reads (not on its list, nor returned to its queue), so a mark at ${step} would pass over nothing; it waits for an agent instead`;
274
- if (process.env.NODE_ENV === 'test')
275
- return Effect.die(new Error(fault));
276
- if (!offItsListSaid.has(`${top.workflow}\n${task.item}`)) {
277
- offItsListSaid.add(`${top.workflow}\n${task.item}`);
278
- console.error(`[agents] ${fault}`);
279
- }
280
- return Effect.succeed(false);
281
- });
282
- });
283
- /**
284
- * WHY NO AGENT CAN BE HAD FOR A WORKFLOW'S RUNS NOW, in words; none where one can: the spending limit holds, or its
285
- * agents' limit is 0. While it says so, its Pick passes over its tasks marked as needing an agent, and those with nothing
286
- * new since their last run (`queueNow`, `pickOrder`, `tasks.ts` `passedOverWithoutAnAgent`), and takes them in their
287
- * queue's order again once an agent can be had. A limit that cannot be read passes over none.
288
- */
289
- const agentsUnavailable = (workflow) => Effect.gen(function* () {
290
- const held = yield* deps.spendingHoldsAgents();
291
- if (held !== null && held.unavailable !== null)
292
- return held.unavailable;
293
- const limits = yield* Effect.orElseSucceed(limitsOf(workflow), () => null);
294
- return limits !== null && limits.agents === 0 ? AGENTS_LIMIT_ZERO : null;
295
- });
296
- /**
297
- * AN AGENT STEP TAKES AN AGENT SLOT FIRST: with its workflow's agents' limit in use by its other runs it waits, its record
298
- * saying so, until an agent step ends or a limit changes (`pick-wakes.ts`), and never polls. Its record starts again when
299
- * it has a slot, since the wait was no work. A limit lowered meanwhile to 0 agents, or below its run, stands it down.
300
- * While the spending limit holds (`spending-limit.ts`) every agent step waits the same way, in every workflow, until a
301
- * reading below it or a new limit wakes it.
302
- *
303
- * A RUN WITH A TASK DOES NOT WAIT WHERE NO AGENT CAN BE HAD (its workflow's agents' limit is 0, or the spending limit
304
- * holds): it marks its task as needing an agent, which puts it at the back of its queue (`tasks.ts` `markNeedsAgent`),
305
- * and ends, giving its run slot to work that needs none. Its Pick passes over such tasks while no agent is available
306
- * (`agentsUnavailable`). Waiting, a few such runs filled every run slot of Decompile and nothing behind them moved
307
- * (2026-11-20). A run with no task, or one waiting for an agent another run holds, still waits here.
308
- *
309
- * A step that gets past it took an agent, and clears its task's mark when it ends (`measured`, `agentStepRan`).
310
- */
311
- const untilAgentSlot = (instance, step, record) => Effect.gen(function* () {
312
- const rules = yield* AgentBudgets;
313
- const workflow = instance.workflow._tag;
314
- // An agent is freed, and a limit set, on the workflow at the top of this run: its wakes are the ones this wait hears.
315
- const top = yield* Effect.orElseSucceed(topOf(workflow, instance.executionId), () => ({ run: instance.executionId, workflow }));
316
- const heardOn = top.workflow;
317
- let waited = false;
318
- for (;;) {
319
- const wakes = deps.wakes.pickWakesSoFar(heardOn);
320
- if (yield* rules.standsDown(workflow, instance.executionId))
321
- return yield* Effect.fail(STOOD_DOWN);
322
- const spendingHeld = yield* deps.spendingHoldsAgents();
323
- const slot = spendingHeld !== null ? { free: false, why: spendingHeld.why, unavailable: spendingHeld.unavailable } : yield* rules.agentSlot(workflow, instance.executionId);
324
- const id = record();
325
- if (slot.free) {
326
- if (waited && id !== null) {
327
- yield* recorded('end its wait', records.setStepWaiting({ id, waiting: null }));
328
- yield* recorded('start its record again', records.restartStepRun(id));
329
- }
330
- return;
331
- }
332
- if (slot.unavailable !== null && (yield* markedAsNeedingAnAgent(top, step, slot.unavailable))) {
333
- console.log(`[agents] ${workflow} run ${instance.executionId} ended at its agent step: no agent can be had (${slot.unavailable}); its task goes to the back of its queue, marked as needing one`);
334
- return yield* Effect.fail(NEEDS_AN_AGENT_STOOD_DOWN);
335
- }
336
- if (id !== null)
337
- yield* recorded('say what it waits on', records.setStepWaiting({ id, waiting: slot.why }));
338
- waited = true;
339
- if ((yield* deps.wakes.untilPickWoken({ workflow: heardOn, after: wakes })) === 'released')
340
- return yield* Effect.fail(HANDED_OVER);
341
- }
342
- });
343
- /**
344
- * A RUN OF A WORKFLOW WITH A LIST WORKS ON ONE OF ITS TASKS: the item its Pick named, which every later step inherits. A
345
- * step naming another is the fault `markedAsNeedingAnAgent` guards against, caught where it is made: in tests it fails
346
- * the run; live, it is said once.
347
- */
348
- const checkItem = (workflow, run, step, item) => Effect.gen(function* () {
349
- const d = DECLARED.get(workflow);
350
- if (item === null || d === undefined || !hasAList(d))
351
- return;
352
- const named = yield* Effect.orElseSucceed(records.subjectOfRun(run), () => null);
353
- if (named === null || named.toLowerCase() === item.toLowerCase())
354
- return;
355
- const fault = `${workflow}: its step ${step} names ${item}, while its run works on ${named}: a run of a workflow with a list works on one of its tasks`;
356
- if (process.env.NODE_ENV === 'test')
357
- throw new Error(fault);
358
- if (!undeclaredSaid.has(fault)) {
359
- undeclaredSaid.add(fault);
360
- console.error(`[steps] ${fault}`);
361
- }
362
- });
363
- /** Checks the move to `step` against its workflow's graph: in tests an undeclared one fails the run; live, it is said once. */
364
- const checkEdge = (workflow, run, step) => Effect.gen(function* () {
365
- const graph = DECLARED.get(workflow)?.graph?.();
366
- if (graph === undefined)
367
- return;
368
- const read = yield* Effect.result(lastStepBefore(run));
369
- // With its last step unread, the move cannot be checked; it is said, and the step goes on.
370
- if (Result.isFailure(read))
371
- return yield* Effect.logError(`[steps] ${workflow}: the move to ${step} was not checked: ${read.failure.reason}`);
372
- const last = read.success;
373
- if (edgeDeclared(graph, last, step))
374
- return;
375
- const move = `${workflow}: ${last === null ? RUN_STARTS : `${last.step}${last.failed ? ' (failed)' : ''}`} to ${step}`;
376
- if (process.env.NODE_ENV === 'test')
377
- throw new Error(`a run took an edge its workflow does not declare: ${move}`);
378
- if (!undeclaredSaid.has(move)) {
379
- undeclaredSaid.add(move);
380
- console.error(`[steps] a run took an edge its workflow does not declare: ${move}`);
381
- }
382
- });
383
- /** Runs `execute` as this step of the workflow it is in, and writes its record. */
384
- const measured = (step, call, subject, subjectOf, reasonOf, mayWrite, execute, childRun = null) => Effect.flatMap(WorkflowEngine.WorkflowInstance, (instance) => {
385
- // A call's running sum is by request; its final figures replace it. `settled` is what finished calls reported.
386
- const settled = noSpend();
387
- const running = new Map();
388
- const spendNow = () => {
389
- const out = { ...settled };
390
- for (const r of running.values()) {
391
- out.fresh += r.fresh;
392
- out.cacheWrite += r.cacheWrite;
393
- out.cacheRead += r.cacheRead;
394
- out.output += r.output;
395
- out.requests += 1;
396
- }
397
- return out;
398
- };
399
- const usage = (message, model, u) => {
400
- const was = running.get(message) ?? noSpend();
401
- running.set(message, {
402
- ...was,
403
- fresh: u.input_tokens ?? was.fresh,
404
- cacheRead: u.cache_read_input_tokens ?? was.cacheRead,
405
- cacheWrite: u.cache_creation_input_tokens ?? was.cacheWrite,
406
- output: u.output_tokens ?? was.output,
407
- });
408
- if (recordId !== null)
409
- recordNow('its spend so far', records.updateStepSpend({ id: recordId, spend: spendNow(), model }));
410
- };
411
- const report = (spent) => {
412
- const requests = running.size;
413
- running.clear();
414
- for (const [k, v] of Object.entries(spent))
415
- settled[k] += v ?? 0;
416
- if (spent.requests === undefined)
417
- settled.requests += requests;
418
- };
419
- const toolInputs = [];
420
- let before = null;
421
- let recordId = null;
422
- let meter = new StepMeter(null, (step.runs === 'agentic'), [], null);
423
- /** Whether this agent step took an agent: past its slot, its task's mark as needing one clears when it ends. */
424
- let tookAnAgent = false;
425
- return Effect.acquireUseRelease(Effect.flatMap(Effect.gen(function* () {
426
- yield* checkEdge(instance.workflow._tag, instance.executionId, step.name);
427
- yield* checkItem(instance.workflow._tag, instance.executionId, step.name, subject);
428
- // A sub-workflow step is run again when its workflow has ended: it takes its open record up again, and names the run it started.
429
- const id = yield* recorded('open its record', records.openStepRun({ workflow: instance.workflow._tag, run: instance.executionId, step: step.name, call, agent: (step.runs === 'agentic'), subject, ...(childRun === null ? {} : { resume: true }) }));
430
- if (id !== null && childRun !== null)
431
- yield* recorded('name the run it started', records.setStepChild({ id, childRun }));
432
- const beat = (step.runs === 'agentic') && id !== null ? setInterval(() => recordNow('its heartbeat', records.beatStepRun(id)), AGENT_BEAT_MS) : null;
433
- recordId = id;
434
- meter = new StepMeter(id, (step.runs === 'agentic'), step.writes ?? [], null);
435
- meterOpened(meter);
436
- return { id, beat };
437
- }), (opened) => (mayWrite === undefined
438
- ? Effect.succeed(opened)
439
- : Effect.map(Effect.promise(async () => {
440
- const hashes = await stepFiles.treeHashes();
441
- if (opened.id !== null)
442
- await stepFiles.snapshotTree(stepFiles.snapshotOf(opened.id), hashes);
443
- return hashes;
444
- }), (hashes) => {
445
- before = hashes;
446
- return opened;
447
- }))), () => pipe((step.runs === 'agentic') ? Effect.andThen(untilAgentSlot(instance, step.name, () => recordId), Effect.andThen(Effect.sync(() => { tookAnAgent = true; }), execute)) : execute,
448
- // What it changed, on its record, and a change it named outside where it may write refuses the step.
449
- Effect.tap(() => Effect.suspend(() => {
450
- const earlier = before;
451
- if (earlier === null || mayWrite === undefined)
452
- return Effect.void;
453
- return Effect.flatMap(Effect.promise(() => stepFiles.treeHashes()), (after) => Effect.gen(function* () {
454
- const files = filesChanged(earlier, after, mayWrite, toolInputs);
455
- const snapshot = recordId === null ? null : stepFiles.snapshotOf(recordId);
456
- if (snapshot !== null)
457
- stepFiles.keepWhatItChanged(snapshot, files.attributed);
458
- if (recordId !== null)
459
- yield* recorded('the files it changed', records.recordStepFiles({ id: recordId, files: JSON.stringify({ ...files, snapshot }) }));
460
- // Refused here means undone here: a change that stayed would make the refusal decorative.
461
- if (snapshot !== null)
462
- stepFiles.undoFiles(snapshot, files.refused);
463
- return files.refused.length === 0 ? yield* Effect.void : yield* Effect.fail(`refused: it changed ${files.refused.join(', ')}, outside ${mayWrite.join(', ') || 'nothing it may write'}`);
464
- }));
465
- })), Effect.provideService(CurrentMeter, meter), Effect.provideService(deps.CurrentStepUsage, meter), (step.runs === 'agentic') ? Effect.provideService(AgentStep, { usage, report, touched: (inputs) => { toolInputs.push(...inputs); }, waiting: (why) => { if (recordId !== null)
466
- recordNow('say what it waits on', records.setStepWaiting({ id: recordId, waiting: why })); } }) : (e) => e), ({ id, beat }, exit) => Effect.gen(function* () {
467
- if (beat !== null)
468
- clearInterval(beat);
469
- // An agent step that ran on a task marked as needing an agent clears the mark: it may need none now.
470
- if (tookAnAgent && (Exit.isSuccess(exit) || !Cause.hasInterrupts(exit.cause))) {
471
- const top = TOPS.get(instance.executionId) ?? { run: instance.executionId, workflow: instance.workflow._tag };
472
- const task = yield* taskOfTop(top);
473
- if (task !== null)
474
- yield* deps.tasks.agentStepRan({ task, by: { workflow: top.workflow, run: top.run, step: step.name } });
475
- }
476
- // Its agent slot is free for its workflow's next run waiting on one.
477
- if ((step.runs === 'agentic'))
478
- deps.wakes.wakePicksOf(TOPS.get(instance.executionId)?.workflow ?? instance.workflow._tag, 'an agent step ended');
479
- // An interrupted step is no move: the run does it again.
480
- if (Exit.isSuccess(exit) || !Cause.hasInterrupts(exit.cause))
481
- lastStepRan.set(instance.executionId, { step: step.name, failed: !Exit.isSuccess(exit) });
482
- meterClosed(meter);
483
- if (id === null)
484
- return;
485
- const spend = spendNow();
486
- const used = meter.used();
487
- const named = Exit.isSuccess(exit) ? subjectOf?.(exit.value) ?? null : null;
488
- yield* checkItem(instance.workflow._tag, instance.executionId, step.name, named);
489
- // A batch that started no process and recorded no item had none to do; one that worked outside `eachItem` stays undeclared.
490
- const idleBatch = step.perItem === true && Exit.isSuccess(exit) && used.childCpuSeconds === 0 && used.compiles === 0;
491
- const scope = meter.items > 0 ? 'functions' : step.shared === true ? 'shared' : idleBatch ? 'none due' : subjectOf !== undefined && Exit.isSuccess(exit) && named === null ? 'nothing' : 'undeclared';
492
- if (Exit.isSuccess(exit))
493
- yield* recorded('close its record', records.closeStepRun({ id, outcome: 'success', reason: (reasonOf ?? standardReason)(exit.value), error: null, spend, subject: named, used, scope }));
494
- // A sub-workflow step whose run is suspended until its workflow ends is still in that step: its record stays open.
495
- else if (Cause.hasInterrupts(exit.cause) && childRun !== null && instance.suspended)
496
- yield* Effect.void;
497
- else if (Cause.hasInterrupts(exit.cause))
498
- yield* recorded('close its record', records.closeStepRun({ id, outcome: 'interrupted', reason: 'interrupted', error: null, spend, subject: null, used, scope }));
499
- else
500
- yield* recorded('close its record', records.closeStepRun({ id, outcome: 'failure', reason: oneLine(describeFailure(Cause.squash(exit.cause))), error: describeFailure(Cause.squash(exit.cause)), spend, subject: null, used, scope }));
501
- }));
502
- });
503
- /**
504
- * TAKES BACK WHAT THIS RUN'S AGENT STEP CHANGED, from that step's record: the one way a refused change leaves the tree. Run
505
- * it as a step of its own, then rebuild, or the tree still holds what was refused.
506
- */
507
- const undoAgentStep = (stepName) => Effect.flatMap(WorkflowEngine.WorkflowInstance, (instance) => Effect.map(records.stepFilesOf({ run: instance.executionId, step: stepName }), (record) => {
508
- if (record === null)
509
- return { restored: [], conflicts: [] };
510
- const { snapshot, attributed } = JSON.parse(record);
511
- return snapshot === null ? { restored: [], conflicts: [] } : stepFiles.undoFiles(snapshot, attributed ?? []);
512
- }));
513
- /**
514
- * A RUN PAST ITS WORKFLOW'S RUN LIMIT ENDS BEFORE IT TAKES ON MORE WORK, inside the step's activity. It fails with
515
- * `STOOD_DOWN`. At a run limit of 0 every run is past it, so each run already going ends this way.
516
- *
517
- * A workflow its budget keeps going before an agent step, and nowhere else: a run past its limit still picks and
518
- * (`keptRunningByItsBudget`) tests with no agent, so an item its test clears is finished at no cost, and its
519
- * Pick ends its run where it finds nothing (`untilPicked`).
520
- * Any other workflow before a Pick, before an agent step, and before the first step this process runs
521
- * of it (a run the engine resumed after a restart): nothing else would end its run.
522
- *
523
- * A step between those goes on, so what an agent step just made is still checked and recorded.
524
- */
525
- const standDownIfSurplus = (step) => Effect.flatMap(WorkflowEngine.WorkflowInstance, (instance) =>
526
- // A run a sub-workflow step started is its top run's work: its steps stand down as that run's own would, by that
527
- // workflow's budget. Asked of its own, a step with no agent stood the run above down where that run's own never would.
528
- Effect.flatMap(Effect.orElseSucceed(topOf(instance.workflow._tag, instance.executionId), () => ({ run: instance.executionId, workflow: instance.workflow._tag })), (top) => Effect.flatMap(
529
- // IT ENDS WITH THE RUN ABOVE IT. Once that run has ended (failed, or stopped), no step of this one starts: its result
530
- // would be read by nothing. A read of the engine's records that fails stops no step.
531
- top.run === instance.executionId ? Effect.succeed(false) : Effect.orElseSucceed(Effect.map(runsOldestFirst([top.workflow]), (unfinished) => !unfinished.includes(top.run)), () => false), (aboveEnded) => {
532
- if (aboveEnded) {
533
- console.log(`[run limit] ${instance.workflow._tag} run ${instance.executionId} stood down: the ${top.workflow} run above it, ${top.run}, has ended`);
534
- return Effect.fail(ABOVE_ENDED);
535
- }
536
- const declared = DECLARED.get(top.workflow);
537
- const budgetKeepsIt = declared !== undefined && keptRunningByItsBudget(declared);
538
- if (!step.agent && (budgetKeepsIt || (!step.picks && lastStepRan.has(instance.executionId))))
539
- return Effect.void;
540
- return Effect.flatMap(AgentBudgets, (budgets) => Effect.flatMap(budgets.standsDown(instance.workflow._tag, instance.executionId), (surplus) => {
541
- if (!surplus)
542
- return Effect.void;
543
- console.log(`[run limit] ${instance.workflow._tag} run ${instance.executionId} stood down: its workflow has more runs going than its run limit`);
544
- return Effect.fail(STOOD_DOWN);
545
- }));
546
- })));
547
- /** One run of a workflow picks at a time: its choice is on its step record before the next reads what is taken. */
548
- const pickingOneAtATime = (workflow, pick) => {
549
- const lock = PICKING.get(workflow) ?? Semaphore.makeUnsafe(1);
550
- PICKING.set(workflow, lock);
551
- return lock.withPermits(1)(pick);
552
- };
553
- /** Why a Pick waits, on its open record: its queued tasks, none of which it can claim now, and what wakes it. */
554
- const nothingToClaim = (workflow) => pipe(deps.tasks.taskSummaries({ workflow }), Effect.map((tasks) => {
555
- const queued = queueOrder(tasks);
556
- const needAnAgent = queued.filter((t) => deps.tasks.passedOverNow(t) !== null).length;
557
- return `${queued.length} queued${queued.length === 0 ? '' : ', none it can claim now'}${needAnAgent === 0 ? '' : `, ${needAnAgent} of them passed over as needing an agent or with nothing new since their last run`}`;
558
- }), Effect.catchTag('StorageError', (e) => Effect.succeed(`its tasks could not be read: ${e.reason}`)), Effect.map((queued) => `no task it can claim (${queued}); it waits for a task returned to its queue, a new item, a run ending or a limit change`));
559
- /**
560
- * A PICK THAT FINDS NOTHING IT CAN CLAIM WAITS FOR AN EVENT THAT CAN CHANGE THAT (`pick-wakes.ts`), and never polls: one
561
- * open record, its `waiting` saying on what, and no new record while nothing changes. The run keeps its place in its
562
- * workflow's count, and its record starts again when it found an item, since the wait was no work. It ends with nothing
563
- * when its run is past the runs its run limit keeps (`runLimit`), or when no agent can be had and nothing in its queue
564
- * can be taken without one (`whyNoRunCanTakeWork`): kept waiting there, 4 Decompile runs held their run slots for 51
565
- * minutes on 2026-11-20 with each of its 751 queued tasks marked, and showed as running.
566
- */
567
- const untilPicked = (picked, pick) => Effect.gen(function* () {
568
- const instance = yield* WorkflowEngine.WorkflowInstance;
569
- const workflow = instance.workflow._tag;
570
- const budgets = yield* AgentBudgets;
571
- const meter = yield* CurrentMeter;
572
- const record = meter?.record ?? null;
573
- let waited = false;
574
- for (;;) {
575
- const wakes = deps.wakes.pickWakesSoFar(workflow);
576
- const began = performance.now();
577
- const found = yield* pickingOneAtATime(workflow, pick);
578
- if (waited)
579
- deps.wakes.countRePick(workflow, performance.now() - began);
580
- // With no agent to be had and nothing it can take, it ends rather than wait (`whyNoRunCanTakeWork`).
581
- const noWork = picked(found) ? null : yield* noWorkByInputsLastRead(workflow);
582
- if (noWork !== null)
583
- console.log(`[agents] ${workflow} run ${instance.executionId} ended at its Pick: ${noWork}`);
584
- if (picked(found) || noWork !== null || !(yield* budgets.waitsForWork(workflow, instance.executionId))) {
585
- if (picked(found))
586
- deps.queueChanged(workflow);
587
- if (waited && record !== null) {
588
- yield* recorded('end its wait', records.setStepWaiting({ id: record, waiting: null }));
589
- yield* recorded('start its record again', records.restartStepRun(record));
590
- }
591
- return found;
592
- }
593
- if (record !== null)
594
- yield* recorded('say what it waits on', records.setStepWaiting({ id: record, waiting: yield* nothingToClaim(workflow) }));
595
- waited = true;
596
- if ((yield* deps.wakes.untilPickWoken({ workflow, after: wakes })) === 'released')
597
- return yield* Effect.fail(HANDED_OVER);
598
- }
599
- });
600
- /** A step: its declaration, and `run`, the only way to run it. */
601
- const defineStep = (d) => {
602
- const writes = [...(d.mayWrite ?? []), ...(d.writes ?? [])];
603
- const declaration = {
604
- name: d.name, runs: d.runs, description: d.description, ...(d.kind === undefined ? {} : { kind: d.kind }), ...(d.test === undefined ? {} : { test: true }), ...(d.shared === undefined ? {} : { shared: true }), ...(d.perItem === undefined ? {} : { perItem: true }), ...(d.picked === undefined ? {} : { picks: true }), ...(d.subject === undefined ? {} : { namesItem: true }),
605
- ...(writes.length === 0 ? {} : { writes }),
606
- source: d.prompt ?? { path: sourcePath(d.at), anchor: `'${d.name}'` },
607
- };
608
- return {
609
- ...declaration,
610
- run: (execute, options) => Activity.make({
611
- name: options?.call === undefined ? d.name : `${d.name} ${options.call}`,
612
- success: d.success,
613
- error: Schema.String,
614
- execute: pipe(standDownIfSurplus({ agent: d.runs === 'agentic', picks: d.picked !== undefined }), Effect.andThen(measured(declaration, options?.call ?? null, options?.subject ?? null, d.subject, d.reason, d.mayWrite, d.picked === undefined ? execute : untilPicked(d.picked, execute))), Effect.retry({ while: deps.isTransientFailure, times: 10, schedule: Schedule.spaced('3 seconds') }), Effect.mapError(describeFailure)),
615
- }),
616
- };
617
- };
618
- /**
619
- * "CLEARED" MEANS OFF THE LIST, by construction: a pass counts only if the list the workflow shows and Pick takes from no
620
- * longer holds the item. One still on it is a fault, recorded and named, and its agent starts, told so.
621
- */
622
- const heldToItsList = (test, subject) => Effect.gen(function* () {
623
- const said = yield* test;
624
- if (said.result !== 'passes')
625
- return said;
626
- const instance = yield* WorkflowEngine.WorkflowInstance;
627
- const workflow = instance.workflow._tag;
628
- const item = subject ?? (yield* recorded('read its item', records.subjectOfRun(instance.executionId)));
629
- const pending = DECLARED.get(workflow)?.pending;
630
- if (item === null || pending === undefined)
631
- return said;
632
- // Only a workflow with a list comes here, and those run under what its list reads.
633
- const work = yield* Effect.exit(pending());
634
- if (!Exit.isSuccess(work) || !listOf(work.value).some((i) => i.toLowerCase() === item.toLowerCase()))
635
- return said;
636
- yield* recorded('a pass its list still holds', records.recordClearedButListed({ workflow, run: instance.executionId, item, said: said.detail }));
637
- return { result: 'cannot', why: `its test passed (${said.detail}), and it is still on this workflow's list, so it has not cleared` };
638
- });
639
- /** The no-agent test step of a workflow, before its first agent step. */
640
- const defineItemTest = (d) => {
641
- const step = defineStep({ name: 'Test', runs: 'deterministic', test: true, description: d.description, at: d.at, prompt: { path: sourcePath(d.at), anchor: 'defineItemTest(' }, success: ItemTest });
642
- return { ...step, run: (test, options) => step.run(heldToItsList(test, options?.subject ?? null), options) };
643
- };
644
- /** The sub-workflows whose agent steps are being asked for now: a workflow that used itself as a step would ask for ever. */
645
- const askingForAgents = new Set();
646
- /**
647
- * A SUB-WORKFLOW STEP: a workflow used as a step of another. Alex, 2026-11-19: "decompile is itself a workflow composed of
648
- * other workflows. the long term goal of Jive is to be workflows all the way down".
649
- *
650
- * Running it starts `workflow` as a run of its own on `payload` and waits for it: the engine suspends the run above until
651
- * it ends, across restarts, and then runs this step again, which reads the result. The step keeps ONE record in the
652
- * workflow above, open while its workflow runs and naming that run, so:
653
- *
654
- * the page shows the run above in this step, and the workflow's own view shows its steps and what they cost;
655
- * the workflow's steps work on the item the run above works on, with no code naming it (`StepRecords.openStepRun`);
656
- * its agent steps count against the agents' limit of the workflow at the top, and stand down with its run (`topOf`).
657
- *
658
- * Its start is the step's, so no run limit of its own gates it: the run above is the one a limit lets start or not, and a
659
- * limit on a workflow used only as a step would fail the steps of runs already going.
660
- */
661
- const defineSubWorkflow = (d) => {
662
- const child = d.workflow._tag;
663
- // What its workflow gave is what the step declares, or the step fails saying so: no result is taken on trust.
664
- const isDeclared = Schema.is(d.success);
665
- const given = (result) => (isDeclared(result) ? Effect.succeed(result) : Effect.fail(`${child} gave a result that is not what this step declares`));
666
- const name = d.as ?? child;
667
- const startAsAStep = (payload) => (STARTS_AS_A_STEP.get(child) ?? d.workflow.execute)(payload);
668
- /**
669
- * ITS WORKFLOW STARTED, AND WAITED FOR. In a process handing its runs to the next, the wait is cut: its workflow's run
670
- * has gone to the next process, which this one's engine can no longer reach, so the call is interrupted. Left to the
671
- * engine's activity, that interrupt was tried again 10 times and then failed the run above, while its workflow went on
672
- * in the next process with a result nothing would read: two runs of Decompile ended so on 2026-11-19, their agents
673
- * still writing. The run above is suspended instead, as it is whenever its workflow has not ended: the next process
674
- * resumes it when that workflow ends, this step runs again there and reads the result, and its record stays the one.
675
- */
676
- const startedAndWaitedFor = (payload) => pipe(startAsAStep(payload), Effect.sandbox, Effect.catch((cause) => Effect.flatMap(WorkflowEngine.WorkflowInstance, (instance) => (Cause.hasInterruptsOnly(cause) && !instance.suspended && deps.wakes.handingOver() ? Workflow.suspend(instance) : Effect.failCause(cause)))));
677
- const declaration = {
678
- name, runs: null, kind: 'sub-workflow', workflow: child,
679
- description: DECLARED.get(child)?.description ?? `Runs ${child}.`,
680
- source: DECLARED.get(child)?.source ?? { path: sourcePath(d.at), anchor: `'${child}'` },
681
- agentUnder: () => {
682
- if (askingForAgents.has(child))
683
- return false;
684
- askingForAgents.add(child);
685
- try {
686
- return DECLARED.get(child)?.steps().some(stepUsesAnAgent) === true;
687
- }
688
- finally {
689
- askingForAgents.delete(child);
690
- }
691
- },
692
- };
693
- return {
694
- ...declaration,
695
- run: (payload, options) => Activity.make({
696
- name: options?.call === undefined ? name : `${name} ${options.call}`,
697
- success: d.success,
698
- error: Schema.String,
699
- execute: pipe(standDownIfSurplus({ agent: false, picks: false }), Effect.andThen(Effect.flatMap(d.workflow.executionId(payload), (childRun) => measured(declaration, options?.call ?? null, null, undefined, undefined, undefined, Effect.flatMap(startedAndWaitedFor(payload), given), childRun))), Effect.mapError(describeFailure)),
700
- }),
701
- };
702
- };
703
- /** Every workflow defined so far, in the order defined. */
704
- const declaredWorkflows = () => [...DECLARED.values()];
705
- /** Calls `listener` shortly after any run ends, when the engine has stored its end. */
706
- const onRunEnded = (listener) => {
707
- RUN_ENDED.add(listener);
708
- };
709
- const runEnded = () => {
710
- for (const after of [1000, 5000]) {
711
- for (const listener of RUN_ENDED)
712
- setTimeout(listener, after);
713
- }
714
- };
715
- /** A workflow's tasks' inputs now (`WorkflowDeclaration.taskInputs`), recorded for every summary of its tasks; none for one that declares none. */
716
- const readTaskInputs = (workflow) => Effect.gen(function* () {
717
- const d = DECLARED.get(workflow);
718
- if (d?.taskInputs === undefined)
719
- return null;
720
- const read = yield* d.taskInputs();
721
- const byItem = new Map([...read].map(([item, inputs]) => [item.toLowerCase(), inputs]));
722
- deps.tasks.recordTaskInputs(workflow, byItem);
723
- return byItem;
724
- });
725
- /** The step a Pick's notes are written by: every Pick is the step that reads its queue. */
726
- const pickedBy = (input) => ({ workflow: input.workflow, run: input.run, step: 'Pick' });
727
- /**
728
- * A WORKFLOW'S QUEUE AS ITS PICK TAKES IT: first in, first out (`tasks.ts` `queueOrder`), another run's tasks left out.
729
- * The Pick first reads what its tasks run on and settles its queue (`tasks.ts` `settleQueue`): a task a standard reason
730
- * holds for is blocked, and a blocked one whose reason lapsed is back in the queue.
731
- */
732
- const queueNow = (input) => Effect.gen(function* () {
733
- yield* readTaskInputs(input.workflow);
734
- const queue = queueOrder(yield* deps.tasks.settleQueue({ workflow: input.workflow, excludingRun: input.run, by: pickedBy(input) }));
735
- // While no agent can be had, a task marked as needing one is passed over (`agentsUnavailable`).
736
- return (yield* agentsUnavailable(input.workflow)) === null ? queue : queue.filter((t) => deps.tasks.passedOverNow(t) === null);
737
- });
738
- /**
739
- * WHY NO RUN OF A WORKFLOW CAN TAKE WORK NOW, none where one can: no agent can be had for it (`agentsUnavailable`), and
740
- * every task in its queue is one its Pick passes over meanwhile, marked as needing an agent or with nothing new since its
741
- * last run (`tasks.ts` `passedOverWithoutAnAgent`), or its queue is empty. Then a run would only hold a run slot and show
742
- * as running: its trigger starts none (`keep-running.ts` `planRunStarts`), and a Pick that found nothing ends its run
743
- * rather than wait (`untilPicked`). An agent to be had (a limit lifted, the spending limit no longer holding), a mark
744
- * cleared, new input or a new item lets runs start again. Only a workflow with a list and an agent step: one with no agent
745
- * step needs none. Read where it cannot be, it says nothing, and runs start and wait as before.
746
- */
747
- const whyNoRunCanTakeWork = (workflow) => Effect.gen(function* () {
748
- // Its tasks' inputs, a read of every task's, are read again only where the inputs its last Pick read leave no work.
749
- if ((yield* noWorkByInputsLastRead(workflow)) === null)
750
- return null;
751
- yield* Effect.orElseSucceed(readTaskInputs(workflow), () => null);
752
- return yield* noWorkByInputsLastRead(workflow);
753
- });
754
- /** `whyNoRunCanTakeWork` by its tasks' inputs as its last Pick read them: what a Pick that just read them asks. */
755
- const noWorkByInputsLastRead = (workflow) => pipe(Effect.gen(function* () {
756
- const d = DECLARED.get(workflow);
757
- if (d === undefined || !keptRunningByItsBudget(d))
758
- return null;
759
- const unavailable = yield* agentsUnavailable(workflow);
760
- if (unavailable === null)
761
- return null;
762
- const queued = queueOrder(yield* deps.tasks.taskSummaries({ workflow }));
763
- if (queued.some((t) => deps.tasks.passedOverNow(t) === null))
764
- return null;
765
- return `no agent can be had (${unavailable}), and ${queued.length === 0 ? 'its queue is empty' : `each of its ${queued.length} queued tasks needs one or has nothing new since its last run`}`;
766
- }), Effect.orElseSucceed(() => null));
767
- /** A workflow: what it states about itself, then `Workflow.make`'s own name and options. */
768
- const defineWorkflow = (d) => ((name, options) => {
769
- // The one place a workflow's own types do not matter: every workflow passes through here the same way.
770
- const workflow = Workflow.make(name, options);
771
- /**
772
- * EVERY START OF IT, WHATEVER CALLS IT (a timer, its inputs changing, its queue, a request), PASSES ITS RUN LIMIT: a new
773
- * run starts only while fewer of its runs are going than its limit. One already going, by the same execution id, is
774
- * joined as before. A start refused for the limit starts nothing: one that discards its run gets its id back, one that
775
- * waits for its result fails with `RunLimitReached`. Where the limit cannot be read, the run starts, and that is said.
776
- */
777
- const execute = workflow.execute.bind(workflow);
778
- let refusedSaidAt = 0;
779
- const startAllowed = (payload) => Effect.gen(function* () {
780
- const limits = yield* deps.budgets.limitsOf(name);
781
- const limit = limits === null ? null : runLimitOf(d, limits);
782
- if (limit === null)
783
- return { allowed: true };
784
- const going = (yield* deps.engine.unfinishedRuns()).filter((u) => u.workflow === name).map((u) => u.run);
785
- if (going.length < limit)
786
- return { allowed: true };
787
- const id = yield* workflow.executionId(payload);
788
- return going.includes(id) ? { allowed: true } : { allowed: false, limit };
789
- }).pipe(Effect.catchTag('StorageError', (e) => Effect.as(Effect.logError(`[run limit] ${name}: its limit could not be read, so the run starts: ${e.reason}`), { allowed: true })));
790
- const gatedExecute = (payload, startOptions) => Effect.flatMap(startAllowed(payload), (gate) => {
791
- if (gate.allowed)
792
- return startOptions === undefined ? execute(payload) : execute(payload, startOptions);
793
- const say = Date.now() - refusedSaidAt < REFUSED_SAID_EVERY_MS ? Effect.void : Effect.sync(() => { refusedSaidAt = Date.now(); console.log(`[run limit] ${name}: not started, its run limit of ${gate.limit} is reached`); });
794
- return Effect.andThen(say, startOptions?.discard === true ? workflow.executionId(payload) : Effect.fail(new RunLimitReached({ workflow: name, limit: gate.limit })));
795
- });
796
- DECLARED.set(name, {
797
- name, phase: d.phase, description: d.description, steps: d.steps,
798
- ...(d.graph === undefined ? {} : { graph: d.graph }),
799
- source: { path: sourcePath(d.at), anchor: `'${name}'` },
800
- ...(d.pending === undefined ? {} : { pending: d.pending }),
801
- ...(d.items === undefined ? {} : { items: d.items }),
802
- ...(d.picksQueueHead === undefined ? {} : { picksQueueHead: d.picksQueueHead }),
803
- ...(d.fedBy === undefined ? {} : { fedBy: d.fedBy }),
804
- ...(d.inputs === undefined ? {} : { inputs: d.inputs }),
805
- ...(d.taskInputs === undefined ? {} : { taskInputs: d.taskInputs }),
806
- item: d.item,
807
- finishedWord: d.item === null ? null : d.finishedWord,
808
- gate: d.item === null ? null : (d.gate ?? null),
809
- start: (run) => gatedExecute({ run }, { discard: true }),
810
- startOn: (payload, options) => Effect.asVoid(options.wait ? gatedExecute(payload) : gatedExecute(payload, { discard: true })),
811
- executionIdOf: (payload) => workflow.executionId(payload),
812
- });
813
- const toLayer = workflow.toLayer.bind(workflow);
814
- // Its start as a step of another workflow, which no run limit of its own gates (`defineSubWorkflow`).
815
- STARTS_AS_A_STEP.set(name, execute);
816
- Object.assign(workflow, { execute: gatedExecute });
817
- // Every run of every workflow ends here: its items' outcomes are recorded, and the next run can start at once.
818
- return Object.assign(workflow, {
819
- toLayer: (execute) => toLayer((payload, executionId) => Effect.onExit(execute(payload, executionId), (exit) => Effect.flatMap(
820
- // ITS TASK'S INPUTS AS THE RUN LEFT THEM go on its outcome: a run that changed what it ran on (a Test's trials)
821
- // left nothing new for the next. Taken when it picked, 490 Tests ran on 107 functions in 41 minutes (2026-11-14).
822
- !Exit.isSuccess(exit) && Cause.hasInterrupts(exit.cause) || d.item === null ? Effect.succeed(null) : Effect.orElseSucceed(readTaskInputs(name), () => null), (leftWith) => Effect.gen(function* () {
823
- const interrupted = !Exit.isSuccess(exit) && Cause.hasInterrupts(exit.cause);
824
- const runItem = yield* recorded('read its item', records.subjectOfRun(executionId));
825
- const inputsLeft = (subject) => {
826
- const item = subject ?? runItem;
827
- return item === null ? null : leftWith?.get(item.toLowerCase())?.fingerprint ?? null;
828
- };
829
- if (!interrupted && d.item !== null) {
830
- if (Exit.isSuccess(exit)) {
831
- for (const o of d.outcomes(exit.value))
832
- yield* deps.tasks.appendOutcome({ workflow: name, run: executionId, subject: o.subject ?? null, outcome: o.outcome, finished: o.finished || o.outcome === CLEARED_BY_TEST, inputs: inputsLeft(o.subject ?? null), blocked: o.blocked ?? null });
833
- }
834
- else {
835
- // With its cause, as its step's record has it: a bare "failed" sent whoever read it to the records for why.
836
- const failure = Cause.squash(exit.cause);
837
- const outcome = isStoodDown(failure) ? 'stood down' : `failed: ${startAndEnd(describeFailure(failure), { cap: 1000, end: 400, what: 'the failure' })}`;
838
- yield* deps.tasks.appendOutcome({ workflow: name, run: executionId, subject: null, outcome, finished: false, inputs: inputsLeft(null), blocked: null });
839
- }
840
- }
841
- // What it ran on gave this result, which stands until its inputs change. Only a run its trigger started on its
842
- // inputs has a record to end.
843
- if (d.inputs !== undefined) {
844
- yield* Effect.catchTag(deps.inputs.recordEnd({
845
- run: executionId,
846
- outcome: Exit.isSuccess(exit) ? 'success' : Cause.hasInterrupts(exit.cause) ? 'interrupted' : 'failure',
847
- result: Exit.isSuccess(exit) ? JSON.stringify(exit.value) ?? null : null,
848
- }), 'StorageError', (e) => Effect.logError(`[inputs] ${name} run ${executionId}: its end could not be recorded: ${e.reason}`));
849
- }
850
- lastStepRan.delete(executionId);
851
- TOPS.delete(executionId);
852
- runEnded();
853
- // Its claim and its item are free now for its workflow's other runs, once the engine has stored its end. Only its
854
- // own: about 25 short runs end a minute, and waking every Pick on each re-read every task twice each time.
855
- setTimeout(() => deps.wakes.wakePicksOf(name, 'one of its runs ended'), 1000);
856
- })))),
857
- });
858
- });
859
- /**
860
- * RUNS A WORKFLOW ON `payload` ONLY WHEN ITS INPUTS CHANGED since its last successful run: it reads their fingerprint, and
861
- * when it is that run's, the result that run stored stands and nothing starts. Otherwise the run starts, recorded with the
862
- * fingerprint it ran on before it starts, so its end finds the record. A workflow that declares no inputs runs each time.
863
- * `wait` waits for the run to end.
864
- */
865
- const runIfInputsChanged = (r) => Effect.gen(function* () {
866
- const d = DECLARED.get(r.workflow);
867
- if (d === undefined)
868
- return yield* Effect.fail(`no workflow ${r.workflow} is declared`);
869
- if (d.inputs !== undefined) {
870
- const inputs = yield* d.inputs.read();
871
- const last = yield* deps.inputs.lastSuccess(r.workflow);
872
- if (last !== null && last.inputs === inputs)
873
- return 'unchanged';
874
- const run = yield* d.executionIdOf(r.payload);
875
- yield* deps.inputs.recordStart({ workflow: r.workflow, inputs, run });
876
- }
877
- yield* d.startOn(r.payload, { wait: r.wait });
878
- return 'started';
879
- });
880
- /** The items a workflow's other unfinished runs are on, lower case, so a budget above 1 never puts two agents on one. */
881
- const itemsOfOtherRuns = (workflow, run) => Effect.flatMap(runningRunIds(workflow), (runs) => Effect.map(Effect.forEach(runs.filter((r) => r !== run), (r) => records.subjectOfRun(r)), (subjects) => new Set(subjects.flatMap((subject) => (subject === null ? [] : [subject.toLowerCase()])))));
882
- /**
883
- * The candidates of this run's Pick in the order it takes them (`tasks.ts` `inPickOrder`), its queue settled first as
884
- * `queueNow` settles it: none blocked, another run's left out. `fromItem` builds a candidate for a task a step or a person
885
- * returned to the queue that the candidates do not hold.
886
- */
887
- const pickOrder = (input) => Effect.map(Effect.all({ tasks: deps.tasks.settleQueue({ workflow: input.workflow, excludingRun: input.run, by: pickedBy(input) }), unavailable: agentsUnavailable(input.workflow) }), ({ tasks, unavailable }) => inPickOrder({
888
- candidates: input.candidates, subjectOf: input.subjectOf, tasks, ...(input.fromItem === undefined ? {} : { fromItem: input.fromItem }),
889
- // While no agent can be had, a task marked as needing one is passed over (`agentsUnavailable`).
890
- ...(unavailable === null ? {} : { alsoLeaveOut: new Set(tasks.filter((t) => deps.tasks.passedOverNow(t) !== null).map((t) => t.ref.item)) }),
891
- }));
892
- /**
893
- * A workflow of one code step, run each turn of its trigger: `run` waits for the run to finish (a heavy one, in line with
894
- * the other heavy jobs), `start` leaves it to the engine.
895
- */
896
- const oneStepWorkflow = (
897
- // One step of the project's code: no agent, and no single item.
898
- states, name, step, success, execute) => {
899
- const theStep = defineStep({ name: step, runs: 'deterministic', shared: true, description: states.stepDescription, at: states.at, success, ...(states.writes === undefined ? {} : { writes: states.writes }) });
900
- const workflow = defineWorkflow({ phase: states.phase, description: states.description, at: states.at, steps: () => [theStep], item: null, ...(states.inputs === undefined ? {} : { inputs: states.inputs }),
901
- graph: () => [{ from: RUN_STARTS, to: step, when: 'each turn' }, { from: step, to: RUN_ENDS, when: 'always' }] })(name, {
902
- payload: { turn: Schema.Number },
903
- idempotencyKey: ({ turn }) => String(turn),
904
- success,
905
- error: Schema.String,
906
- });
907
- return {
908
- name, step, workflow, layer: workflow.toLayer(() => theStep.run(execute)),
909
- // Each turn of its trigger starts a run only when its inputs changed, where it declares them (`runIfInputsChanged`).
910
- run: (turn) => Effect.asVoid(runIfInputsChanged({ workflow: name, payload: { turn }, wait: true })),
911
- start: (turn) => Effect.asVoid(runIfInputsChanged({ workflow: name, payload: { turn }, wait: false })),
912
- };
913
- };
914
- return {
915
- defineStep, defineItemTest, defineSubWorkflow, defineWorkflow, oneStepWorkflow, declaredWorkflows, onRunEnded,
916
- eachItem, undoAgentStep, AgentBudgets, pickingOneAtATime, pickOrder, itemsOfOtherRuns,
917
- runsOldestFirst, runningRunIds, runningRuns, sourcePath, runIfInputsChanged, queueNow, readTaskInputs, agentsUnavailable, whyNoRunCanTakeWork,
918
- };
919
- };
920
- //# sourceMappingURL=steps.js.map