@jive-sh/workflow-platform 0.1.0 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +17 -5
- package/dist/index.js +19 -7
- package/dist/index.js.map +1 -1
- package/dist/steps.js +40 -3
- package/dist/steps.js.map +1 -1
- package/dist/storage/sqlite-store.js +33 -0
- package/dist/storage/sqlite-store.js.map +1 -1
- package/dist/views/workflow-flows.js +53 -0
- package/dist/views/workflow-flows.js.map +1 -0
- package/dist/views/workflows-view.js +12 -1
- package/dist/views/workflows-view.js.map +1 -1
- package/package.json +1 -1
- package/src/index.ts +19 -7
- package/src/steps.ts +48 -3
- package/src/storage/sqlite-store.ts +42 -1
- package/src/storage/task-store.ts +32 -0
- package/src/views/workflow-flows.ts +97 -0
- package/src/views/workflows-view.ts +40 -5
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/** Whether `to` reaches `from` through `feeds`: work goes from `to`, by way of others, to `from`. */
|
|
2
|
+
const reaches = (feeds, start, target) => {
|
|
3
|
+
const seen = new Set([start]);
|
|
4
|
+
const next = [start];
|
|
5
|
+
while (next.length > 0) {
|
|
6
|
+
const at = next.pop();
|
|
7
|
+
for (const f of feeds) {
|
|
8
|
+
if (f.from !== at || seen.has(f.to))
|
|
9
|
+
continue;
|
|
10
|
+
if (f.to === target)
|
|
11
|
+
return true;
|
|
12
|
+
seen.add(f.to);
|
|
13
|
+
next.push(f.to);
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
return false;
|
|
17
|
+
};
|
|
18
|
+
export const workflowFlows = (input) => {
|
|
19
|
+
const names = new Set(input.declared.map((d) => d.name));
|
|
20
|
+
const recorded = (from, to) => input.newInputs.find((n) => n.from === from && n.to === to);
|
|
21
|
+
const feeds = input.declared.flatMap((d) => (d.fedBy ?? []).filter((f) => names.has(f) && f !== d.name).map((f) => ({ from: f, to: d.name })));
|
|
22
|
+
const declaredFlows = feeds.map((f) => {
|
|
23
|
+
const r = recorded(f.from, f.to);
|
|
24
|
+
return { from: f.from, to: f.to, kind: 'feeds', declared: true, notes: r?.notes ?? 0, last: r?.last ?? null, waiting: 0, why: null };
|
|
25
|
+
});
|
|
26
|
+
const recordedOnly = input.newInputs
|
|
27
|
+
.filter((n) => names.has(n.from) && names.has(n.to) && !feeds.some((f) => f.from === n.from && f.to === n.to))
|
|
28
|
+
.map((n) => ({ from: n.from, to: n.to, kind: reaches(feeds, n.to, n.from) ? 'sends back' : 'gives input', declared: false, notes: n.notes, last: n.last, waiting: 0, why: null }));
|
|
29
|
+
// A wait on the workflow that feeds it is that feed's work still to come, drawn as the feed; one on another is an edge.
|
|
30
|
+
const waitedOn = input.waits
|
|
31
|
+
.filter((w) => names.has(w.on) && w.on !== w.workflow && !feeds.some((f) => f.from === w.on && f.to === w.workflow))
|
|
32
|
+
.map((w) => ({ from: w.workflow, to: w.on, kind: 'waits on', declared: false, notes: 0, last: null, waiting: w.tasks, why: w.label }));
|
|
33
|
+
return [...declaredFlows, ...recordedOnly, ...waitedOn];
|
|
34
|
+
};
|
|
35
|
+
/** Each workflow's place: its stage by `stageOf` in `stages`' order (one not among them after them), then its depth there. */
|
|
36
|
+
export const pipelinePlaces = (input) => {
|
|
37
|
+
const stageIndex = (s) => (input.stages.includes(s) ? input.stages.indexOf(s) : input.stages.length);
|
|
38
|
+
const stageOf = new Map(input.workflows.map((w) => [w.name, stageIndex(w.stage)]));
|
|
39
|
+
// Forward work only: feeds, and input given to one not upstream. A send-back points against the pipeline.
|
|
40
|
+
const forward = input.flows.filter((f) => f.kind !== 'sends back');
|
|
41
|
+
const depth = new Map();
|
|
42
|
+
const depthOf = (name, path) => {
|
|
43
|
+
const known = depth.get(name);
|
|
44
|
+
if (known !== undefined)
|
|
45
|
+
return known;
|
|
46
|
+
const into = forward.filter((f) => f.to === name && !path.has(f.from) && stageOf.get(f.from) === stageOf.get(name));
|
|
47
|
+
const d = into.length === 0 ? 0 : Math.max(...into.map((f) => depthOf(f.from, new Set([...path, name])) + 1));
|
|
48
|
+
depth.set(name, d);
|
|
49
|
+
return d;
|
|
50
|
+
};
|
|
51
|
+
return input.workflows.map((w) => ({ workflow: w.name, stage: stageIndex(w.stage), depth: depthOf(w.name, new Set()) }));
|
|
52
|
+
};
|
|
53
|
+
//# sourceMappingURL=workflow-flows.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"workflow-flows.js","sourceRoot":"","sources":["../../../../src/views/workflow-flows.ts"],"names":[],"mappings":"AAsCA,qGAAqG;AACrG,MAAM,OAAO,GAAG,CAAC,KAAoE,EAAE,KAAa,EAAE,MAAc,EAAW,EAAE;IAC/H,MAAM,IAAI,GAAG,IAAI,GAAG,CAAS,CAAC,KAAK,CAAC,CAAC,CAAC;IACtC,MAAM,IAAI,GAAG,CAAC,KAAK,CAAC,CAAC;IACrB,OAAO,IAAI,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QACvB,MAAM,EAAE,GAAG,IAAI,CAAC,GAAG,EAAG,CAAC;QACvB,KAAK,MAAM,CAAC,IAAI,KAAK,EAAE,CAAC;YACtB,IAAI,CAAC,CAAC,IAAI,KAAK,EAAE,IAAI,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC;gBAAE,SAAS;YAC9C,IAAI,CAAC,CAAC,EAAE,KAAK,MAAM;gBAAE,OAAO,IAAI,CAAC;YACjC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;YACf,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;QAClB,CAAC;IACH,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,KAI7B,EAA+B,EAAE;IAChC,MAAM,KAAK,GAAG,IAAI,GAAG,CAAC,KAAK,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,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,EAAE,KAAK,IAAI,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC;QACpH,MAAM,CAAC,GAAG,IAAI,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,EAAE,IAAI,GAAG,CAAC,CAAC,GAAG,IAAI,EAAE,IAAI,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;QAC9G,KAAK,CAAC,GAAG,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC;QACnB,OAAO,CAAC,CAAC;IACX,CAAC,CAAC;IACF,OAAO,KAAK,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,EAAE,QAAQ,EAAE,CAAC,CAAC,IAAI,EAAE,KAAK,EAAE,UAAU,CAAC,CAAC,CAAC,KAAK,CAAC,EAAE,KAAK,EAAE,OAAO,CAAC,CAAC,CAAC,IAAI,EAAE,IAAI,GAAG,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;AAC3H,CAAC,CAAC"}
|
|
@@ -2,6 +2,9 @@ import { Effect } from 'effect';
|
|
|
2
2
|
import { bucketCounts } from '../tasks';
|
|
3
3
|
import { stepFunnel } from './step-funnel';
|
|
4
4
|
import { workflowGraphs } from './step-graph';
|
|
5
|
+
import { pipelinePlaces, workflowFlows } from './workflow-flows';
|
|
6
|
+
/** How long the queues' history reaches back. */
|
|
7
|
+
export const QUEUE_HISTORY_DAYS = 7;
|
|
5
8
|
const medianOf = (xs) => {
|
|
6
9
|
const sorted = [...xs].sort((a, b) => a - b);
|
|
7
10
|
const mid = Math.floor(sorted.length / 2);
|
|
@@ -79,6 +82,10 @@ export const buildWorkflowsView = (input) => Effect.gen(function* () {
|
|
|
79
82
|
const going = new Set((yield* input.engine.unfinishedRuns()).map((u) => u.run));
|
|
80
83
|
const queues = new Map(yield* Effect.forEach(input.declared.filter((d) => d.item !== null), (d) => Effect.map(input.tasks.taskSummaries({ workflow: d.name }), (tasks) => [d.name, bucketCounts(tasks)])));
|
|
81
84
|
const graphs = new Map(workflowGraphs({ declared: input.declared, taken: moves.edges, lasts: moves.lasts, going }).map((g) => [g.workflow, g]));
|
|
85
|
+
const flows = workflowFlows({ declared: input.declared, newInputs: yield* input.taskStore.newInputFlows(), waits: yield* input.taskStore.listedWaits() });
|
|
86
|
+
const phases = [...input.phases, ...[...new Set(input.declared.map((d) => d.phase))].filter((p) => !input.phases.includes(p))];
|
|
87
|
+
const places = new Map(pipelinePlaces({ workflows: input.declared.map((d) => ({ name: d.name, stage: d.phase })), stages: phases, flows }).map((p) => [p.workflow, p]));
|
|
88
|
+
const queueHistory = yield* input.taskStore.queueCountsSince(input.now - QUEUE_HISTORY_DAYS * 86_400);
|
|
82
89
|
const link = (s) => ({ ...s, line: input.locate(s) });
|
|
83
90
|
const workflowView = (d) => {
|
|
84
91
|
const own = rows.filter((r) => r.workflow === d.name);
|
|
@@ -118,12 +125,16 @@ export const buildWorkflowsView = (input) => Effect.gen(function* () {
|
|
|
118
125
|
total: steps.reduce((t, s) => (s.cost === null ? t : addCosts(t, s.cost)), NO_COST),
|
|
119
126
|
graph: graphs.get(d.name),
|
|
120
127
|
queue: queues.get(d.name) ?? null,
|
|
128
|
+
startsOn: d.pending !== undefined ? { kind: 'queue' } : d.inputs !== undefined ? { kind: 'inputs', says: d.inputs.says } : { kind: 'timer or request' },
|
|
129
|
+
fedBy: d.fedBy ?? [],
|
|
130
|
+
place: places.get(d.name),
|
|
121
131
|
};
|
|
122
132
|
};
|
|
123
|
-
const phases = [...input.phases, ...[...new Set(input.declared.map((d) => d.phase))].filter((p) => !input.phases.includes(p))];
|
|
124
133
|
return {
|
|
125
134
|
at: input.now, hours: input.hours, since,
|
|
126
135
|
groups: phases.map((phase) => ({ phase, workflows: input.declared.filter((d) => d.phase === phase).map(workflowView) })).filter((g) => g.workflows.length > 0),
|
|
136
|
+
flows,
|
|
137
|
+
queueHistory,
|
|
127
138
|
};
|
|
128
139
|
});
|
|
129
140
|
//# sourceMappingURL=workflows-view.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"workflows-view.js","sourceRoot":"","sources":["../../../../src/views/workflows-view.ts"],"names":[],"mappings":"AAYA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAIhC,OAAO,EAAE,YAAY,EAA2B,MAAM,UAAU,CAAC;AACjE,OAAO,EAAE,UAAU,EAAmB,MAAM,eAAe,CAAC;AAC5D,OAAO,EAAE,cAAc,EAAsB,MAAM,cAAc,CAAC;AA4DlE,MAAM,QAAQ,GAAG,CAAC,EAAyB,EAAU,EAAE;IACrD,MAAM,MAAM,GAAG,CAAC,GAAG,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;IAC7C,MAAM,GAAG,GAAG,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;IAC1C,OAAO,MAAM,CAAC,MAAM,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAE,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,GAAG,CAAC,CAAE,GAAG,MAAM,CAAC,GAAG,CAAE,CAAC,GAAG,CAAC,CAAC;AACxF,CAAC,CAAC;AAEF,yGAAyG;AACzG,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC,KAA6B,EAAY,EAAE;IACpE,MAAM,KAAK,GAAG,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC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,GAAG,CAAC,CAAC;QAC9J,KAAK;QACL,YAAY;KACb,CAAC;AACJ,CAAC,CAAC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jive-sh/workflow-platform",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"description": "Durable workflows on effect/workflow: steps, step records, task queues, waiting picks, budgets, the trigger that keeps runs going, and a dashboard of them.",
|
package/src/index.ts
CHANGED
|
@@ -13,10 +13,10 @@ import type { WorkflowProject } from './project';
|
|
|
13
13
|
import { makePickWakes } from './pick-wakes';
|
|
14
14
|
import { makeStepFiles } from './step-files';
|
|
15
15
|
import { makeStepUsage } from './step-usage';
|
|
16
|
-
import { keptRunningByItsBudget, makeSteps } from './steps';
|
|
16
|
+
import { keptRunningByItsBudget, makeSteps, runLimitOf } from './steps';
|
|
17
17
|
import { makeTasks, type TaskRules } from './tasks';
|
|
18
18
|
import { buildWorkflowsView, type WorkflowsView, type WorkflowView } from './views/workflows-view';
|
|
19
|
-
import {
|
|
19
|
+
import { sqliteBudgets, type LimitStore } from './storage/budgets';
|
|
20
20
|
import { sqliteEngineRecords, type EngineRecords } from './storage/engine-records';
|
|
21
21
|
import { sqliteStore } from './storage/sqlite-store';
|
|
22
22
|
import type { StepRecords } from './storage/step-records';
|
|
@@ -48,6 +48,7 @@ export * from './views/runs-now';
|
|
|
48
48
|
export * from './views/step-funnel';
|
|
49
49
|
export * from './views/step-graph';
|
|
50
50
|
export * from './views/workflows-view';
|
|
51
|
+
export * from './views/workflow-flows';
|
|
51
52
|
export type { NewNote, TaskStore, TextChange } from './storage/task-store';
|
|
52
53
|
|
|
53
54
|
/** Where a project's records live: each store an interface, so another database can stand behind any of them. */
|
|
@@ -106,11 +107,16 @@ export const createWorkflowPlatform = <Phase extends string, R>(input: {
|
|
|
106
107
|
* Every workflow as a dashboard shows it, over the `hours` before `now` (`views/workflows-view.ts`). `phases` is the order the
|
|
107
108
|
* project's page shows them in; `pausedOf`, why a workflow is paused, none while it is not.
|
|
108
109
|
*/
|
|
109
|
-
/**
|
|
110
|
+
/**
|
|
111
|
+
* A workflow's limits now, as stored. Every workflow has a run limit (`steps.ts` `runLimitOf`), none meaning no limit;
|
|
112
|
+
* only one its budget keeps going has an agents' limit. None where no store is read (a test).
|
|
113
|
+
*/
|
|
110
114
|
const limitsOf = (name: string): Effect.Effect<WorkflowView['limits'], StorageError> => {
|
|
111
115
|
const d = steps.declaredWorkflows().find((w) => w.name === name);
|
|
112
|
-
if (d === undefined
|
|
113
|
-
return Effect.map(storage.budgets.limitsOf(name), (limits) => (limits === null ? null : {
|
|
116
|
+
if (d === undefined) return Effect.succeed(null);
|
|
117
|
+
return Effect.map(storage.budgets.limitsOf(name), (limits) => (limits === null ? null : {
|
|
118
|
+
agents: keptRunningByItsBudget(d) ? limits.agents : null, runs: runLimitOf(d, limits), runsSet: limits.runs !== null,
|
|
119
|
+
}));
|
|
114
120
|
};
|
|
115
121
|
|
|
116
122
|
/** Every limited workflow's two limits now, by name: what a page's controls show, read at each request. */
|
|
@@ -131,9 +137,9 @@ export const createWorkflowPlatform = <Phase extends string, R>(input: {
|
|
|
131
137
|
}
|
|
132
138
|
return texts.get(file) ?? null;
|
|
133
139
|
};
|
|
134
|
-
|
|
140
|
+
const built = yield* buildWorkflowsView({
|
|
135
141
|
declared, phases: r.phases, now: r.now, hours: r.hours,
|
|
136
|
-
records: storage.stepRecords, engine: storage.engine, tasks,
|
|
142
|
+
records: storage.stepRecords, engine: storage.engine, tasks, taskStore: storage.tasks,
|
|
137
143
|
locate: (s) => {
|
|
138
144
|
const text = textOf(s.path);
|
|
139
145
|
const at = text === null ? -1 : text.indexOf(s.anchor);
|
|
@@ -142,6 +148,12 @@ export const createWorkflowPlatform = <Phase extends string, R>(input: {
|
|
|
142
148
|
limitsOf: (name) => limits[name] ?? null,
|
|
143
149
|
pausedOf: r.pausedOf,
|
|
144
150
|
});
|
|
151
|
+
// EACH QUEUE'S HISTORY, recorded here since the view counts every queue anyway: a row only where a count moved.
|
|
152
|
+
yield* storage.tasks.recordQueueCounts({
|
|
153
|
+
at: r.now,
|
|
154
|
+
counts: built.groups.flatMap((g) => g.workflows.flatMap((w) => (w.queue === null ? [] : Object.entries(w.queue).map(([bucket, n]) => ({ workflow: w.name, bucket, tasks: n }))))),
|
|
155
|
+
});
|
|
156
|
+
return built;
|
|
145
157
|
});
|
|
146
158
|
return { project, storage, wakes, stepFiles, stepUsage, tasks, steps, view, limitsNow };
|
|
147
159
|
};
|
package/src/steps.ts
CHANGED
|
@@ -40,7 +40,7 @@
|
|
|
40
40
|
* step one record per item, and a step whose work no one item owns declares `shared` rather than dividing it up.
|
|
41
41
|
*/
|
|
42
42
|
import path from 'node:path';
|
|
43
|
-
import { Cause, Context, Effect, Exit, pipe, Result, Schedule, Schema, Semaphore } from 'effect';
|
|
43
|
+
import { Cause, Context, Data, Effect, Exit, pipe, Result, Schedule, Schema, Semaphore } from 'effect';
|
|
44
44
|
import { Activity, Workflow, WorkflowEngine } from 'effect/workflow';
|
|
45
45
|
import { describeFailure, startAndEnd } from './failure';
|
|
46
46
|
import { oneLine, standardReason } from './reasons';
|
|
@@ -180,6 +180,12 @@ export interface WorkflowDeclaration<Phase extends string = string, R = never> {
|
|
|
180
180
|
readonly pending?: () => Effect.Effect<PendingWork, unknown, R>;
|
|
181
181
|
/** Its Pick takes the first task of its queue it can claim (`tasks.ts` `queueOrder`), so a dashboard lists that queue. */
|
|
182
182
|
readonly picksQueueHead?: true;
|
|
183
|
+
/**
|
|
184
|
+
* The workflows whose results it works on: what its list of work (`pending`) is made from, or what its inputs (`inputs`)
|
|
185
|
+
* read. The dashboard draws each as an edge into it, and a workflow that gives one upstream of it new input
|
|
186
|
+
* (`giveNewInput`) is sending work back. None where it works on no other workflow's results.
|
|
187
|
+
*/
|
|
188
|
+
readonly fedBy?: ReadonlyArray<string>;
|
|
183
189
|
/** Its step graph (`StepEdge`); none until it declares one. */
|
|
184
190
|
readonly graph?: () => ReadonlyArray<StepEdge>;
|
|
185
191
|
/** What it runs on (`WorkflowInputs`); none until it declares them, and it runs whenever its trigger says. */
|
|
@@ -195,6 +201,19 @@ export interface WorkflowDeclaration<Phase extends string = string, R = never> {
|
|
|
195
201
|
readonly executionIdOf: (payload: object) => Effect.Effect<string>;
|
|
196
202
|
}
|
|
197
203
|
|
|
204
|
+
/** A run not started: its workflow's run limit was reached. What a start that waits for its result fails with. */
|
|
205
|
+
export class RunLimitReached extends Data.TaggedError('RunLimitReached')<{ readonly workflow: string; readonly limit: number }> {}
|
|
206
|
+
|
|
207
|
+
/** How often a workflow's refused starts are said, at most: a timer at 0 would say it every turn. */
|
|
208
|
+
const REFUSED_SAID_EVERY_MS = 10 * 60 * 1000;
|
|
209
|
+
|
|
210
|
+
/**
|
|
211
|
+
* A WORKFLOW'S RUN LIMIT, whatever starts it: for one its budget keeps going, its run limit or its agents' limit
|
|
212
|
+
* (`runLimit`); for any other its run limit, none meaning no limit. 0 starts nothing new. Pure.
|
|
213
|
+
*/
|
|
214
|
+
export const runLimitOf = (d: Pick<WorkflowDeclaration<string, unknown>, 'pending' | 'steps'>, limits: WorkflowLimits): number | null =>
|
|
215
|
+
keptRunningByItsBudget(d) ? runLimit(limits) : limits.runs;
|
|
216
|
+
|
|
198
217
|
/** Whether a workflow's budget rules it: an agent step and a declared list of work. Pure. */
|
|
199
218
|
export const keptRunningByItsBudget = (d: Pick<WorkflowDeclaration<string, unknown>, 'pending' | 'steps'>): boolean =>
|
|
200
219
|
d.pending !== undefined && d.steps().some((s) => s.agent);
|
|
@@ -682,6 +701,8 @@ export const makeSteps = <Phase extends string, R>(deps: {
|
|
|
682
701
|
readonly steps: () => ReadonlyArray<StepDeclaration>;
|
|
683
702
|
readonly pending?: () => Effect.Effect<PendingWork, unknown, R>;
|
|
684
703
|
readonly picksQueueHead?: true;
|
|
704
|
+
/** The workflows whose results it works on (`WorkflowDeclaration.fedBy`). */
|
|
705
|
+
readonly fedBy?: ReadonlyArray<string>;
|
|
685
706
|
/** Its step graph: which step can follow which, and when. */
|
|
686
707
|
readonly graph?: () => ReadonlyArray<StepEdge>;
|
|
687
708
|
/** What it runs on: its trigger starts a run only when they changed (`runIfInputsChanged`). */
|
|
@@ -692,22 +713,46 @@ export const makeSteps = <Phase extends string, R>(deps: {
|
|
|
692
713
|
((name: string, options: Parameters<typeof Workflow.make>[1]) => {
|
|
693
714
|
// The one place a workflow's own types do not matter: every workflow passes through here the same way.
|
|
694
715
|
const workflow: RunnableWorkflow = Workflow.make(name, options) as RunnableWorkflow;
|
|
716
|
+
/**
|
|
717
|
+
* EVERY START OF IT, WHATEVER CALLS IT (a timer, its inputs changing, its queue, a request), PASSES ITS RUN LIMIT: a new
|
|
718
|
+
* run starts only while fewer of its runs are going than its limit. One already going, by the same execution id, is
|
|
719
|
+
* joined as before. A start refused for the limit starts nothing: one that discards its run gets its id back, one that
|
|
720
|
+
* waits for its result fails with `RunLimitReached`. Where the limit cannot be read, the run starts, and that is said.
|
|
721
|
+
*/
|
|
722
|
+
const execute = workflow.execute.bind(workflow);
|
|
723
|
+
let refusedSaidAt = 0;
|
|
724
|
+
const startAllowed = (payload: object): Effect.Effect<{ readonly allowed: true } | { readonly allowed: false; readonly limit: number }> => Effect.gen(function* () {
|
|
725
|
+
const limits = yield* deps.budgets.limitsOf(name);
|
|
726
|
+
const limit = limits === null ? null : runLimitOf({ pending: d.pending, steps: d.steps }, limits);
|
|
727
|
+
if (limit === null) return { allowed: true } as const;
|
|
728
|
+
const going = (yield* deps.engine.unfinishedRuns()).filter((u) => u.workflow === name).map((u) => u.run);
|
|
729
|
+
if (going.length < limit) return { allowed: true } as const;
|
|
730
|
+
const id = yield* workflow.executionId(payload);
|
|
731
|
+
return going.includes(id) ? { allowed: true } as const : { allowed: false, limit } as const;
|
|
732
|
+
}).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 } as const)));
|
|
733
|
+
const gatedExecute: RunnableWorkflow['execute'] = (payload, startOptions) => Effect.flatMap(startAllowed(payload), (gate) => {
|
|
734
|
+
if (gate.allowed) return startOptions === undefined ? execute(payload) : execute(payload, startOptions);
|
|
735
|
+
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`); });
|
|
736
|
+
return Effect.andThen(say, startOptions?.discard === true ? workflow.executionId(payload) : Effect.fail(new RunLimitReached({ workflow: name, limit: gate.limit })));
|
|
737
|
+
});
|
|
695
738
|
DECLARED.set(name, {
|
|
696
739
|
name, phase: d.phase, description: d.description, steps: d.steps,
|
|
697
740
|
...(d.graph === undefined ? {} : { graph: d.graph }),
|
|
698
741
|
source: { path: sourcePath(d.at), anchor: `'${name}'` },
|
|
699
742
|
...(d.pending === undefined ? {} : { pending: d.pending }),
|
|
700
743
|
...(d.picksQueueHead === undefined ? {} : { picksQueueHead: d.picksQueueHead }),
|
|
744
|
+
...(d.fedBy === undefined ? {} : { fedBy: d.fedBy }),
|
|
701
745
|
...(d.inputs === undefined ? {} : { inputs: d.inputs }),
|
|
702
746
|
...(d.taskInputs === undefined ? {} : { taskInputs: d.taskInputs }),
|
|
703
747
|
item: d.item,
|
|
704
748
|
finishedWord: d.item === null ? null : d.finishedWord,
|
|
705
749
|
gate: d.item === null ? null : (d.gate ?? null),
|
|
706
|
-
start: (run) =>
|
|
707
|
-
startOn: (payload, options) => Effect.asVoid(options.wait ?
|
|
750
|
+
start: (run) => gatedExecute({ run }, { discard: true }),
|
|
751
|
+
startOn: (payload, options) => Effect.asVoid(options.wait ? gatedExecute(payload) : gatedExecute(payload, { discard: true })),
|
|
708
752
|
executionIdOf: (payload) => workflow.executionId(payload),
|
|
709
753
|
});
|
|
710
754
|
const toLayer = workflow.toLayer.bind(workflow);
|
|
755
|
+
Object.assign(workflow, { execute: gatedExecute });
|
|
711
756
|
// Every run of every workflow ends here: its items' outcomes are recorded, and the next run can start at once.
|
|
712
757
|
return Object.assign(workflow, {
|
|
713
758
|
toLayer: (execute: WorkflowBody) =>
|
|
@@ -11,7 +11,7 @@ import {
|
|
|
11
11
|
stepErrorKept, type FunnelStepRecord, type ItemCost, type ItemHistoryRow, type LastStepNow, type NewestStepRecord, type RunCost, type RunOutcomeRow, type StepEdgeTaken,
|
|
12
12
|
type StepFileCount, type StepRecords, type StepRunRow, type UndeclaredWrites, type WorkStep, AGENT_LIVE_SECONDS,
|
|
13
13
|
} from './step-records';
|
|
14
|
-
import type { Listed, NewNote, TaskFacts, TaskNote, TaskRef, TaskStore } from './task-store';
|
|
14
|
+
import type { Listed, ListedWait, NewInputFlow, NewNote, QueueCount, TaskFacts, TaskNote, TaskRef, TaskStore } from './task-store';
|
|
15
15
|
import type { InputRecords, InputRun } from './input-records';
|
|
16
16
|
import { storeCall, storeCalls } from './storage-error';
|
|
17
17
|
|
|
@@ -145,6 +145,20 @@ CREATE TABLE IF NOT EXISTS input_runs (
|
|
|
145
145
|
);
|
|
146
146
|
CREATE INDEX IF NOT EXISTS input_runs_by_workflow ON input_runs (workflow, at);`;
|
|
147
147
|
|
|
148
|
+
/**
|
|
149
|
+
* EACH QUEUE'S COUNTS OVER TIME: a row where a workflow's tasks in one bucket changed, so a dashboard draws its history.
|
|
150
|
+
* Written as the platform's view is built (`index.ts` `view`), only where a count moved.
|
|
151
|
+
*/
|
|
152
|
+
const QUEUE_COUNTS_SCHEMA = `
|
|
153
|
+
CREATE TABLE IF NOT EXISTS queue_counts (
|
|
154
|
+
at REAL NOT NULL,
|
|
155
|
+
workflow TEXT NOT NULL,
|
|
156
|
+
bucket TEXT NOT NULL,
|
|
157
|
+
tasks INTEGER NOT NULL,
|
|
158
|
+
PRIMARY KEY (workflow, bucket, at)
|
|
159
|
+
);
|
|
160
|
+
CREATE INDEX IF NOT EXISTS queue_counts_by_at ON queue_counts (at);`;
|
|
161
|
+
|
|
148
162
|
/** Brings a records file up to the schema this code reads, as a writer or a first reader finds it. */
|
|
149
163
|
export const applyStepRecordsSchema = (db: Database): void => {
|
|
150
164
|
db.exec(STEP_RUNS_SCHEMA);
|
|
@@ -177,6 +191,7 @@ export const applyStepRecordsSchema = (db: Database): void => {
|
|
|
177
191
|
if (!noteColumns.includes('input_sha')) db.exec('ALTER TABLE task_notes ADD COLUMN input_sha TEXT');
|
|
178
192
|
// On an outcome, the fingerprint of the task's inputs as its run left them (`tasks.ts` `TaskInputs`).
|
|
179
193
|
if (!noteColumns.includes('inputs')) db.exec('ALTER TABLE task_notes ADD COLUMN inputs TEXT');
|
|
194
|
+
db.exec(QUEUE_COUNTS_SCHEMA);
|
|
180
195
|
db.exec(RUN_OUTCOMES_VIEW);
|
|
181
196
|
// After the columns it reads.
|
|
182
197
|
db.exec(FUNCTION_COSTS_VIEW);
|
|
@@ -637,6 +652,32 @@ export const sqliteStore = (options: {
|
|
|
637
652
|
read((db) => (db.query(`${NOTE_SELECT} WHERE t.workflow = ? AND t.item_key = ? ORDER BY n.id`).all(task.workflow, keyOf(task.item)) as ReadonlyArray<NoteRow>).map(noteOf), [])),
|
|
638
653
|
taskId: (task) => storeCall('tasks: taskId', () =>
|
|
639
654
|
read((db) => (db.query('SELECT id FROM tasks WHERE workflow = ? AND item_key = ?').get(task.workflow, keyOf(task.item)) as { id: number } | null)?.id ?? null, null)),
|
|
655
|
+
recordQueueCounts: ({ at, counts }) => storeCall('tasks: recordQueueCounts', () => {
|
|
656
|
+
if (counts.length === 0) return;
|
|
657
|
+
tryWrite((db) => db.transaction(() => {
|
|
658
|
+
const last = db.query('SELECT tasks FROM queue_counts WHERE workflow = ? AND bucket = ? ORDER BY at DESC LIMIT 1');
|
|
659
|
+
const insert = db.query('INSERT OR REPLACE INTO queue_counts (at, workflow, bucket, tasks) VALUES (?, ?, ?, ?)');
|
|
660
|
+
for (const c of counts) {
|
|
661
|
+
if ((last.get(c.workflow, c.bucket) as { tasks: number } | null)?.tasks !== c.tasks) insert.run(at, c.workflow, c.bucket, c.tasks);
|
|
662
|
+
}
|
|
663
|
+
}).immediate());
|
|
664
|
+
}),
|
|
665
|
+
queueCountsSince: (since) => storeCall('tasks: queueCountsSince', () =>
|
|
666
|
+
read((db) => db.query(
|
|
667
|
+
`SELECT at, workflow, bucket, tasks FROM queue_counts q
|
|
668
|
+
WHERE at >= ?1 OR at = (SELECT MAX(p.at) FROM queue_counts p WHERE p.workflow = q.workflow AND p.bucket = q.bucket AND p.at < ?1)
|
|
669
|
+
ORDER BY at`,
|
|
670
|
+
).all(since) as ReadonlyArray<QueueCount>, [])),
|
|
671
|
+
newInputFlows: () => storeCall('tasks: newInputFlows', () =>
|
|
672
|
+
read((db) => db.query(
|
|
673
|
+
`SELECT n.by_workflow AS "from", t.workflow AS "to", COUNT(*) AS notes, MAX(n.at) AS last FROM task_notes n JOIN tasks t ON t.id = n.task
|
|
674
|
+
WHERE n.kind = 'new input' AND n.by_workflow IS NOT NULL AND n.by_workflow <> t.workflow GROUP BY 1, 2 ORDER BY 1, 2`,
|
|
675
|
+
).all() as ReadonlyArray<NewInputFlow>, [])),
|
|
676
|
+
listedWaits: () => storeCall('tasks: listedWaits', () =>
|
|
677
|
+
read((db) => db.query(
|
|
678
|
+
`SELECT workflow, json_extract(listed, '$.on') AS "on", json_extract(listed, '$.label') AS label, COUNT(*) AS tasks FROM tasks
|
|
679
|
+
WHERE listed IS NOT NULL AND json_extract(listed, '$.kind') = 'wait' GROUP BY 1, 2, 3 ORDER BY 1, 2, 3`,
|
|
680
|
+
).all() as ReadonlyArray<ListedWait>, [])),
|
|
640
681
|
writable: () => options.file() !== null,
|
|
641
682
|
};
|
|
642
683
|
|
|
@@ -76,6 +76,30 @@ export interface TaskFacts {
|
|
|
76
76
|
readonly notes: ReadonlyArray<TaskNote>;
|
|
77
77
|
}
|
|
78
78
|
|
|
79
|
+
/** How many of a workflow's tasks stood in one bucket from `at` on, unix seconds. */
|
|
80
|
+
export interface QueueCount {
|
|
81
|
+
readonly at: number;
|
|
82
|
+
readonly workflow: string;
|
|
83
|
+
readonly bucket: string;
|
|
84
|
+
readonly tasks: number;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
/** New input one workflow's runs gave another workflow's tasks (`tasks.ts` `giveNewInput`): how many notes, the last when. */
|
|
88
|
+
export interface NewInputFlow {
|
|
89
|
+
readonly from: string;
|
|
90
|
+
readonly to: string;
|
|
91
|
+
readonly notes: number;
|
|
92
|
+
readonly last: number;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
/** A workflow's tasks its list last put on one wait, by what they wait on and the list's words for it. */
|
|
96
|
+
export interface ListedWait {
|
|
97
|
+
readonly workflow: string;
|
|
98
|
+
readonly on: string;
|
|
99
|
+
readonly label: string;
|
|
100
|
+
readonly tasks: number;
|
|
101
|
+
}
|
|
102
|
+
|
|
79
103
|
export interface TaskStore {
|
|
80
104
|
/**
|
|
81
105
|
* Appends notes in one transaction, in order; each one's id, or null for an outcome a run already has (a resumed run ends
|
|
@@ -100,6 +124,14 @@ export interface TaskStore {
|
|
|
100
124
|
readonly notes: (task: TaskRef) => Effect.Effect<ReadonlyArray<TaskNote>, StorageError>;
|
|
101
125
|
/** A task's stable id; null for one no workflow has named yet. */
|
|
102
126
|
readonly taskId: (task: TaskRef) => Effect.Effect<number | null, StorageError>;
|
|
127
|
+
/** Records each queue's counts as they are `at`, a count only where it differs from the last recorded for it. */
|
|
128
|
+
readonly recordQueueCounts: (r: { readonly at: number; readonly counts: ReadonlyArray<Omit<QueueCount, 'at'>> }) => Effect.Effect<void, StorageError>;
|
|
129
|
+
/** Each count recorded since `since`, and for each queue and bucket the last recorded before it, oldest first. */
|
|
130
|
+
readonly queueCountsSince: (since: number) => Effect.Effect<ReadonlyArray<QueueCount>, StorageError>;
|
|
131
|
+
/** Every workflow that gave another's tasks new input, by the two. */
|
|
132
|
+
readonly newInputFlows: () => Effect.Effect<ReadonlyArray<NewInputFlow>, StorageError>;
|
|
133
|
+
/** Every wait a workflow's list puts its tasks on now, with how many. */
|
|
134
|
+
readonly listedWaits: () => Effect.Effect<ReadonlyArray<ListedWait>, StorageError>;
|
|
103
135
|
/** Whether the store can be written: false in a test that named no store. */
|
|
104
136
|
readonly writable: () => boolean;
|
|
105
137
|
}
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WHERE WORK FLOWS BETWEEN WORKFLOWS: the edges of a project's DAG of workflows, and each workflow's place in its pipeline.
|
|
3
|
+
* Built from what the platform knows and nothing written for the page:
|
|
4
|
+
*
|
|
5
|
+
* feeds a workflow declares the other among those whose results it works on (`fedBy`);
|
|
6
|
+
* sends back a workflow gave new input (`giveNewInput`) to a task of one that is upstream of it, through feeds;
|
|
7
|
+
* gives input it gave new input to a task of one that is not upstream of it, and no feed is declared between them;
|
|
8
|
+
* waits on its list puts tasks on a wait that names another workflow (`PendingWork.waits`), not the one that feeds it:
|
|
9
|
+
* the list's own words say why (`why`).
|
|
10
|
+
*
|
|
11
|
+
* Its place: its stage (the project's phases, in order), then how many feeds lead into it within its stage. Pure.
|
|
12
|
+
*/
|
|
13
|
+
import type { ListedWait, NewInputFlow } from '../storage/task-store';
|
|
14
|
+
|
|
15
|
+
export type FlowKind = 'feeds' | 'sends back' | 'gives input' | 'waits on';
|
|
16
|
+
|
|
17
|
+
/** One edge: work going from one workflow to another. */
|
|
18
|
+
export interface WorkflowFlow {
|
|
19
|
+
readonly from: string;
|
|
20
|
+
readonly to: string;
|
|
21
|
+
readonly kind: FlowKind;
|
|
22
|
+
/** Whether a declaration says it (`fedBy`); a recorded one only is not declared. */
|
|
23
|
+
readonly declared: boolean;
|
|
24
|
+
/** The new-input notes recorded along it, and the last one's time; 0 and none where none was recorded. */
|
|
25
|
+
readonly notes: number;
|
|
26
|
+
readonly last: number | null;
|
|
27
|
+
/** Along a `waits on` edge: the tasks waiting, and the list's words for the wait; 0 and none on any other. */
|
|
28
|
+
readonly waiting: number;
|
|
29
|
+
readonly why: string | null;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
/** A workflow's place in its pipeline: its stage's index, then its depth within the stage through feeds. */
|
|
33
|
+
export interface PipelinePlace {
|
|
34
|
+
readonly workflow: string;
|
|
35
|
+
readonly stage: number;
|
|
36
|
+
readonly depth: number;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
/** Whether `to` reaches `from` through `feeds`: work goes from `to`, by way of others, to `from`. */
|
|
40
|
+
const reaches = (feeds: ReadonlyArray<{ readonly from: string; readonly to: string }>, start: string, target: string): boolean => {
|
|
41
|
+
const seen = new Set<string>([start]);
|
|
42
|
+
const next = [start];
|
|
43
|
+
while (next.length > 0) {
|
|
44
|
+
const at = next.pop()!;
|
|
45
|
+
for (const f of feeds) {
|
|
46
|
+
if (f.from !== at || seen.has(f.to)) continue;
|
|
47
|
+
if (f.to === target) return true;
|
|
48
|
+
seen.add(f.to);
|
|
49
|
+
next.push(f.to);
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
return false;
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
export const workflowFlows = (input: {
|
|
56
|
+
readonly declared: ReadonlyArray<{ readonly name: string; readonly fedBy?: ReadonlyArray<string> }>;
|
|
57
|
+
readonly newInputs: ReadonlyArray<NewInputFlow>;
|
|
58
|
+
readonly waits: ReadonlyArray<ListedWait>;
|
|
59
|
+
}): ReadonlyArray<WorkflowFlow> => {
|
|
60
|
+
const names = new Set(input.declared.map((d) => d.name));
|
|
61
|
+
const recorded = (from: string, to: string) => input.newInputs.find((n) => n.from === from && n.to === to);
|
|
62
|
+
const feeds = input.declared.flatMap((d) => (d.fedBy ?? []).filter((f) => names.has(f) && f !== d.name).map((f) => ({ from: f, to: d.name })));
|
|
63
|
+
const declaredFlows: ReadonlyArray<WorkflowFlow> = feeds.map((f) => {
|
|
64
|
+
const r = recorded(f.from, f.to);
|
|
65
|
+
return { from: f.from, to: f.to, kind: 'feeds', declared: true, notes: r?.notes ?? 0, last: r?.last ?? null, waiting: 0, why: null };
|
|
66
|
+
});
|
|
67
|
+
const recordedOnly: ReadonlyArray<WorkflowFlow> = input.newInputs
|
|
68
|
+
.filter((n) => names.has(n.from) && names.has(n.to) && !feeds.some((f) => f.from === n.from && f.to === n.to))
|
|
69
|
+
.map((n) => ({ from: n.from, to: n.to, kind: reaches(feeds, n.to, n.from) ? 'sends back' : 'gives input', declared: false, notes: n.notes, last: n.last, waiting: 0, why: null }));
|
|
70
|
+
// A wait on the workflow that feeds it is that feed's work still to come, drawn as the feed; one on another is an edge.
|
|
71
|
+
const waitedOn: ReadonlyArray<WorkflowFlow> = input.waits
|
|
72
|
+
.filter((w) => names.has(w.on) && w.on !== w.workflow && !feeds.some((f) => f.from === w.on && f.to === w.workflow))
|
|
73
|
+
.map((w) => ({ from: w.workflow, to: w.on, kind: 'waits on', declared: false, notes: 0, last: null, waiting: w.tasks, why: w.label }));
|
|
74
|
+
return [...declaredFlows, ...recordedOnly, ...waitedOn];
|
|
75
|
+
};
|
|
76
|
+
|
|
77
|
+
/** Each workflow's place: its stage by `stageOf` in `stages`' order (one not among them after them), then its depth there. */
|
|
78
|
+
export const pipelinePlaces = (input: {
|
|
79
|
+
readonly workflows: ReadonlyArray<{ readonly name: string; readonly stage: string }>;
|
|
80
|
+
readonly stages: ReadonlyArray<string>;
|
|
81
|
+
readonly flows: ReadonlyArray<WorkflowFlow>;
|
|
82
|
+
}): ReadonlyArray<PipelinePlace> => {
|
|
83
|
+
const stageIndex = (s: string) => (input.stages.includes(s) ? input.stages.indexOf(s) : input.stages.length);
|
|
84
|
+
const stageOf = new Map(input.workflows.map((w) => [w.name, stageIndex(w.stage)]));
|
|
85
|
+
// Forward work only: feeds, and input given to one not upstream. A send-back points against the pipeline.
|
|
86
|
+
const forward = input.flows.filter((f) => f.kind !== 'sends back');
|
|
87
|
+
const depth = new Map<string, number>();
|
|
88
|
+
const depthOf = (name: string, path: ReadonlySet<string>): number => {
|
|
89
|
+
const known = depth.get(name);
|
|
90
|
+
if (known !== undefined) return known;
|
|
91
|
+
const into = forward.filter((f) => f.to === name && !path.has(f.from) && stageOf.get(f.from) === stageOf.get(name));
|
|
92
|
+
const d = into.length === 0 ? 0 : Math.max(...into.map((f) => depthOf(f.from, new Set([...path, name])) + 1));
|
|
93
|
+
depth.set(name, d);
|
|
94
|
+
return d;
|
|
95
|
+
};
|
|
96
|
+
return input.workflows.map((w) => ({ workflow: w.name, stage: stageIndex(w.stage), depth: depthOf(w.name, new Set()) }));
|
|
97
|
+
};
|