@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.
- package/README.md +66 -295
- package/component/_generated/api.ts +72 -0
- package/component/_generated/component.ts +621 -0
- package/component/_generated/dataModel.ts +60 -0
- package/component/_generated/server.ts +169 -0
- package/component/convex.config.ts +3 -0
- package/component/engine.ts +755 -0
- package/component/errors.ts +66 -0
- package/component/events.ts +17 -0
- package/component/notes.ts +13 -0
- package/component/places.ts +136 -0
- package/component/retention.ts +205 -0
- package/component/runEngine.ts +25 -0
- package/component/schema.ts +132 -0
- package/component/steps.ts +188 -0
- package/component/store.ts +512 -0
- package/component/tasks.ts +289 -0
- package/component/worker.ts +109 -0
- package/component/workflows.ts +83 -0
- package/dist/definition/agent-runner.js +9 -0
- package/dist/definition/agent-runner.js.map +1 -0
- package/dist/definition/file-store.js +9 -0
- package/dist/definition/file-store.js.map +1 -0
- package/dist/definition/program-build.js +10 -0
- package/dist/definition/program-build.js.map +1 -0
- package/dist/definition/step.js +1 -0
- package/dist/definition/step.js.map +1 -0
- package/dist/definition/task-schema.js +5 -0
- package/dist/definition/task-schema.js.map +1 -0
- package/dist/definition/tasks.js +9 -0
- package/dist/definition/tasks.js.map +1 -0
- package/dist/definition/workflow.js +111 -0
- package/dist/definition/workflow.js.map +1 -0
- package/dist/graph.js +301 -9
- package/dist/graph.js.map +1 -1
- package/dist/index.js +7 -133
- package/dist/index.js.map +1 -1
- package/package.json +9 -4
- package/src/definition/agent-runner.ts +59 -0
- package/src/definition/file-store.ts +20 -0
- package/src/definition/program-build.ts +30 -0
- package/src/definition/step.ts +106 -0
- package/src/definition/task-schema.ts +15 -0
- package/src/definition/tasks.ts +43 -0
- package/src/definition/workflow.ts +255 -0
- package/src/graph.ts +341 -19
- package/src/index.ts +8 -168
- package/worker/directory-file-store.ts +42 -0
- package/worker/index.ts +12 -0
- package/worker/platform-client.ts +138 -0
- package/worker/step-meter.ts +80 -0
- package/worker/worker-tasks.ts +27 -0
- package/worker/worker.test.ts +200 -0
- package/worker/worker.ts +240 -0
- package/dist/budget-states.js +0 -30
- package/dist/budget-states.js.map +0 -1
- package/dist/cpu-limit/limiter.js +0 -839
- package/dist/cpu-limit/limiter.js.map +0 -1
- package/dist/cpu-limit/use.js +0 -139
- package/dist/cpu-limit/use.js.map +0 -1
- package/dist/dashboard/agent-usage.js +0 -25
- package/dist/dashboard/agent-usage.js.map +0 -1
- package/dist/dashboard/dashboard.css +0 -134
- package/dist/dashboard/drilldown.js +0 -16
- package/dist/dashboard/drilldown.js.map +0 -1
- package/dist/dashboard/queue-lines.js +0 -44
- package/dist/dashboard/queue-lines.js.map +0 -1
- package/dist/dashboard/queue-table.js +0 -16
- package/dist/dashboard/queue-table.js.map +0 -1
- package/dist/dashboard/spending-words.js +0 -32
- package/dist/dashboard/spending-words.js.map +0 -1
- package/dist/failure.js +0 -35
- package/dist/failure.js.map +0 -1
- package/dist/keep-running.js +0 -77
- package/dist/keep-running.js.map +0 -1
- package/dist/outside-failure.js +0 -31
- package/dist/outside-failure.js.map +0 -1
- package/dist/pick-wakes.js +0 -125
- package/dist/pick-wakes.js.map +0 -1
- package/dist/project.js +0 -1
- package/dist/project.js.map +0 -1
- package/dist/queue-counts.js +0 -51
- package/dist/queue-counts.js.map +0 -1
- package/dist/reasons.js +0 -33
- package/dist/reasons.js.map +0 -1
- package/dist/spending-limit.js +0 -88
- package/dist/spending-limit.js.map +0 -1
- package/dist/step-files.js +0 -200
- package/dist/step-files.js.map +0 -1
- package/dist/step-meter.js +0 -97
- package/dist/step-meter.js.map +0 -1
- package/dist/step-usage.js +0 -19
- package/dist/step-usage.js.map +0 -1
- package/dist/steps.js +0 -920
- package/dist/steps.js.map +0 -1
- package/dist/storage/budgets.js +0 -85
- package/dist/storage/budgets.js.map +0 -1
- package/dist/storage/engine-records.js +0 -75
- package/dist/storage/engine-records.js.map +0 -1
- package/dist/storage/engine-storage.js +0 -67
- package/dist/storage/engine-storage.js.map +0 -1
- package/dist/storage/input-records.js +0 -12
- package/dist/storage/input-records.js.map +0 -1
- package/dist/storage/move-store.js +0 -251
- package/dist/storage/move-store.js.map +0 -1
- package/dist/storage/sqlite-store.js +0 -723
- package/dist/storage/sqlite-store.js.map +0 -1
- package/dist/storage/step-records.js +0 -11
- package/dist/storage/step-records.js.map +0 -1
- package/dist/storage/storage-error.js +0 -19
- package/dist/storage/storage-error.js.map +0 -1
- package/dist/storage/task-store.js +0 -24
- package/dist/storage/task-store.js.map +0 -1
- package/dist/tasks.js +0 -475
- package/dist/tasks.js.map +0 -1
- package/dist/views/format.js +0 -37
- package/dist/views/format.js.map +0 -1
- package/dist/views/runs-now.js +0 -75
- package/dist/views/runs-now.js.map +0 -1
- package/dist/views/step-funnel.js +0 -98
- package/dist/views/step-funnel.js.map +0 -1
- package/dist/views/step-graph.js +0 -34
- package/dist/views/step-graph.js.map +0 -1
- package/dist/views/workflow-flows.js +0 -53
- package/dist/views/workflow-flows.js.map +0 -1
- package/dist/views/workflows-view.js +0 -230
- package/dist/views/workflows-view.js.map +0 -1
- package/src/budget-states.ts +0 -55
- package/src/cpu-limit/limiter.ts +0 -935
- package/src/cpu-limit/use.ts +0 -166
- package/src/dashboard/agent-usage-line.tsx +0 -28
- package/src/dashboard/agent-usage.ts +0 -48
- package/src/dashboard/dashboard.css +0 -134
- package/src/dashboard/drilldown.ts +0 -43
- package/src/dashboard/index.tsx +0 -4
- package/src/dashboard/machine-controls.tsx +0 -53
- package/src/dashboard/queue-bar.tsx +0 -43
- package/src/dashboard/queue-chart.tsx +0 -150
- package/src/dashboard/queue-lines.ts +0 -87
- package/src/dashboard/queue-table.ts +0 -37
- package/src/dashboard/spending-limit-control.tsx +0 -50
- package/src/dashboard/spending-words.ts +0 -50
- package/src/dashboard/step-graph.tsx +0 -106
- package/src/dashboard/workflow-dag.tsx +0 -204
- package/src/dashboard/workflow-drilldown.tsx +0 -89
- package/src/dashboard/workflows-dashboard.tsx +0 -414
- package/src/failure.ts +0 -36
- package/src/keep-running.ts +0 -83
- package/src/outside-failure.ts +0 -39
- package/src/pick-wakes.ts +0 -182
- package/src/project.ts +0 -115
- package/src/queue-counts.ts +0 -64
- package/src/reasons.ts +0 -30
- package/src/spending-limit.ts +0 -156
- package/src/step-files.ts +0 -208
- package/src/step-meter.ts +0 -120
- package/src/step-usage.ts +0 -23
- package/src/steps.ts +0 -1239
- package/src/storage/budgets.ts +0 -113
- package/src/storage/engine-records.ts +0 -102
- package/src/storage/engine-storage.ts +0 -82
- package/src/storage/input-records.ts +0 -43
- package/src/storage/move-store.ts +0 -265
- package/src/storage/sqlite-store.ts +0 -829
- package/src/storage/step-records.ts +0 -306
- package/src/storage/storage-error.ts +0 -35
- package/src/storage/task-store.ts +0 -235
- package/src/tasks.ts +0 -561
- package/src/views/format.ts +0 -40
- package/src/views/runs-now.ts +0 -120
- package/src/views/step-funnel.ts +0 -163
- package/src/views/step-graph.ts +0 -68
- package/src/views/workflow-flows.ts +0 -97
- package/src/views/workflows-view.ts +0 -443
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"workflow.js","sourceRoot":"","sources":["../../../../src/definition/workflow.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAA;AAC5D,OAAO,EAEL,yBAAyB,EAGzB,QAAQ,GAIT,MAAM,UAAU,CAAA;AAoHjB,mGAAmG;AACnG,MAAM,QAAQ,GAAG,CAAC,MAA8G,EAAE,EAAE,CAAC,CAAC;IACpI,QAAQ,EAAE,CAAC,GAAG,CAAC,MAAM,EAAE,QAAQ,IAAI,EAAE,CAAC,CAAC;IACvC,GAAG,CAAC,MAAM,EAAE,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,EAAE,IAAI,EAAE,CAAC,GAAG,MAAM,CAAC,KAAK,CAAC,IAAI,C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,IAAI,CAAC,IAAI,KAAK,UAAU;YAAE,aAAa,CAAC,EAAE,CAAC,GAAG,IAAI,CAAA;IACxD,CAAC;IACD,OAAO;QACL,IAAI,EAAE,KAAK,CAAC,IAAI;QAChB,IAAI,EAAE,KAAK,CAAC,IAAI;QAChB,SAAS,EAAE,KAAK,CAAC,SAAS;QAC1B,aAAa;QACb,KAAK,EAAE;YACL,IAAI,EAAE,KAAK,CAAC,IAAI;YAChB,SAAS,EAAE,CAAC,GAAG,KAAK,CAAC,SAAS,CAAC;YAC/B,MAAM;YACN,KAAK,EAAE,UAAU;YACjB,KAAK,EAAE,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,EAAE,EAAE,EAAE,QAAQ,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,IAAI,CAAC,IAAI,EAAE,EAAE,EAAE,IAAI,CAAC,EAAE,EAAE,CAAC,CAAC;YACxF,OAAO,EAAE,KAAK,CAAC,OAAO;YACtB,GAAG,CAAC,KAAK,CAAC,SAAS,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,SAAS,EAAE,EAAE,GAAG,KAAK,CAAC,SAAS,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;YAC/E,GAAG,CAAC,KAAK,CAAC,UAAU,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,UAAU,EAAE,EAAE,GAAG,KAAK,CAAC,UAAU,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;SACnF;KACF,CAAA;AACH,CAAC,CAAA"}
|
package/dist/graph.js
CHANGED
|
@@ -1,10 +1,302 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
export const
|
|
8
|
-
|
|
9
|
-
|
|
1
|
+
import { Option } from "effect";
|
|
2
|
+
import { v } from "convex/values";
|
|
3
|
+
/**
|
|
4
|
+
* The serializable form of one workflow: what the compiler emits and what the Convex component stores and runs.
|
|
5
|
+
* Every place a task can be is derived from it: a line, a step, or an end state.
|
|
6
|
+
*/
|
|
7
|
+
export const stepKindValidator = v.union(v.literal("code"), v.literal("agent"), v.literal("workflow"));
|
|
8
|
+
export const eventValidator = v.union(v.object({ id: v.string(), kind: v.literal("task") }),
|
|
9
|
+
/**
|
|
10
|
+
* A change of `field` starts a flow for the task. With `resumes`, it instead moves the task's flow waiting at that end
|
|
11
|
+
* state onto this event's line: an end state that names why a task stopped (it waits for a name) is left when what it
|
|
12
|
+
* waited for changes.
|
|
13
|
+
*/
|
|
14
|
+
v.object({ id: v.string(), kind: v.literal("change"), field: v.string(), resumes: v.optional(v.string()) }),
|
|
15
|
+
/**
|
|
16
|
+
* A turn every `everyMs`: a task with `fields`, what the workflow's task schema decodes from `{}`. `fieldsProblem` says
|
|
17
|
+
* why the schema cannot, and a graph with one is refused.
|
|
18
|
+
*/
|
|
19
|
+
v.object({ id: v.string(), kind: v.literal("timer"), everyMs: v.number(), fields: v.optional(v.any()), fieldsProblem: v.optional(v.string()) }), v.object({ id: v.string(), kind: v.literal("request") }),
|
|
20
|
+
/**
|
|
21
|
+
* A declared item list: a sync step (`syncs` naming this event) reads the list, and each item it has no task for
|
|
22
|
+
* becomes a task arriving here, keyed by the string field `key`. A task whose item left the list before it ended ends in
|
|
23
|
+
* `leftAs`, saying so; one that left and is listed again goes back on this event's line.
|
|
24
|
+
*/
|
|
25
|
+
v.object({ id: v.string(), kind: v.literal("list"), key: v.string(), leftAs: v.string() }));
|
|
26
|
+
export const subWorkflowValidator = v.object({
|
|
27
|
+
name: v.string(),
|
|
28
|
+
/** One task of the sub-workflow per entry of this list field of the task; absent means one task with the same fields. */
|
|
29
|
+
each: v.optional(v.string()),
|
|
30
|
+
/** When a sub-workflow task ends in `endState`, its fields are appended to the list field `into` of this task. */
|
|
31
|
+
collect: v.optional(v.object({ endState: v.string(), into: v.string() })),
|
|
32
|
+
});
|
|
33
|
+
/**
|
|
34
|
+
* How a code or agent step treats a failed run: the task goes back to the front of its queue, and no worker takes it
|
|
35
|
+
* again until `delayMs` has passed. After `limit` failed runs in a row it leaves the step through `giveUp`, one of the
|
|
36
|
+
* step's own end states, with why as a task note. A step with none is tried again at once, however often it fails.
|
|
37
|
+
*/
|
|
38
|
+
export const retriesValidator = v.object({ limit: v.number(), delayMs: v.number(), giveUp: v.string() });
|
|
39
|
+
/**
|
|
40
|
+
* What a code or agent step's code may use, as its definition declares it: the services the worker gives its runs (by
|
|
41
|
+
* key), and the workflows whose tasks it may read through `Tasks` and write through `others`.
|
|
42
|
+
*/
|
|
43
|
+
export const stepAccessValidator = v.object({
|
|
44
|
+
services: v.array(v.string()),
|
|
45
|
+
tasks: v.optional(v.object({ read: v.array(v.string()), write: v.array(v.string()) })),
|
|
46
|
+
});
|
|
47
|
+
/**
|
|
48
|
+
* How long a workflow keeps its records, set on the workflow and overridden on a step. A step run of a task that has
|
|
49
|
+
* ended goes once it ended more than `days` ago, unless it is one of its step's newest `keepAtLeastRuns`; a turn task (one
|
|
50
|
+
* a timer made) goes the same way, its runs and notes with it, unless it is one of the newest that many at its end state.
|
|
51
|
+
* An item's task, made by a request, a list or `createTask`, is the work's state, not its history, and never goes. Alex,
|
|
52
|
+
* 2026-11-21: "time based retention is a good idea. it should be configurable at the highest level with allowed step
|
|
53
|
+
* level overrides ... i think 7 days sounds reasonable"; 2026-11-22: "10k runs".
|
|
54
|
+
*/
|
|
55
|
+
export const retentionValidator = v.object({ days: v.optional(v.number()), keepAtLeastRuns: v.optional(v.number()) });
|
|
56
|
+
export const defaultRetention = { days: 7, keepAtLeastRuns: 10_000 };
|
|
57
|
+
/** What a step keeps: its own setting, else its workflow's, else the platform's. */
|
|
58
|
+
export const retentionOf = (graph, step) => {
|
|
59
|
+
const own = step === null ? undefined : graph.steps.find((candidate) => candidate.id === step)?.retention;
|
|
60
|
+
return {
|
|
61
|
+
days: own?.days ?? graph.retention?.days ?? defaultRetention.days,
|
|
62
|
+
keepAtLeastRuns: own?.keepAtLeastRuns ?? graph.retention?.keepAtLeastRuns ?? defaultRetention.keepAtLeastRuns,
|
|
63
|
+
};
|
|
64
|
+
};
|
|
65
|
+
export const stepValidator = v.object({
|
|
66
|
+
id: v.string(),
|
|
67
|
+
kind: stepKindValidator,
|
|
68
|
+
endStates: v.array(v.string()),
|
|
69
|
+
/** What this step's records keep, over its workflow's (`retentionOf`). */
|
|
70
|
+
retention: v.optional(retentionValidator),
|
|
71
|
+
/** Set on every code and agent step; nothing listed grants nothing. */
|
|
72
|
+
access: v.optional(stepAccessValidator),
|
|
73
|
+
workflow: v.optional(subWorkflowValidator),
|
|
74
|
+
retries: v.optional(retriesValidator),
|
|
75
|
+
/**
|
|
76
|
+
* An inputs gate (`inputsChanged`): its runs record a fingerprint, and each run is given the newest one whose turn
|
|
77
|
+
* settled it, meaning its task ended in one of these workflow end states. A turn that saw changed inputs and then failed
|
|
78
|
+
* settles nothing, so the next one sees the change again.
|
|
79
|
+
*/
|
|
80
|
+
inputsSettledBy: v.optional(v.array(v.string())),
|
|
81
|
+
/** A code step that reads a declared item list: the id of the `list` event whose tasks its runs keep in step with it. */
|
|
82
|
+
syncs: v.optional(v.string()),
|
|
83
|
+
});
|
|
84
|
+
export const lineStartValidator = v.union(v.object({ event: v.string() }), v.object({ step: v.string(), endState: v.string() }),
|
|
85
|
+
/** A step consuming one of the workflow's end states: tasks that reach that end state wait there as a queue. */
|
|
86
|
+
v.object({ end: v.string() }));
|
|
87
|
+
export const lineEndValidator = v.union(v.object({ step: v.string() }), v.object({ end: v.string() }));
|
|
88
|
+
export const lineValidator = v.object({ id: v.string(), from: lineStartValidator, to: lineEndValidator });
|
|
89
|
+
export const budgetsValidator = v.object({ agents: v.number(), cpu: v.number() });
|
|
90
|
+
export const graphValidator = v.object({
|
|
91
|
+
name: v.string(),
|
|
92
|
+
endStates: v.array(v.string()),
|
|
93
|
+
events: v.array(eventValidator),
|
|
94
|
+
steps: v.array(stepValidator),
|
|
95
|
+
lines: v.array(lineValidator),
|
|
96
|
+
/** Defaults only: a registered workflow keeps the budgets it was given with `setBudgets`. */
|
|
97
|
+
budgets: budgetsValidator,
|
|
98
|
+
/** What the workflow's records keep, unless a step sets its own (`retentionOf`). */
|
|
99
|
+
retention: v.optional(retentionValidator),
|
|
100
|
+
/**
|
|
101
|
+
* At most `limit` of its tasks in progress at once: past the line an event put them on, and not yet ended. With
|
|
102
|
+
* `per`, the limit holds for each value of that field instead, so a workflow with `{ limit: 1, per: "function" }` is a
|
|
103
|
+
* lock on each function, held from its first step to its end by whichever workflow's task (through a sub-workflow
|
|
104
|
+
* step) got there first. A budget counts running steps; this counts tasks, so it holds across several steps.
|
|
105
|
+
*/
|
|
106
|
+
inProgress: v.optional(v.object({ limit: v.number(), per: v.optional(v.string()) })),
|
|
107
|
+
});
|
|
108
|
+
export const taskFileValidator = v.object({ name: v.string(), ref: v.string() });
|
|
109
|
+
/** Which budget a step takes one unit of while a task is in it. A sub-workflow step takes none: its tasks use the sub-workflow's budgets. */
|
|
110
|
+
export const budgetOfStepKind = (kind) => kind === "agent" ? "agents" : kind === "code" ? "cpu" : "none";
|
|
111
|
+
export const lineIdOf = (line) => {
|
|
112
|
+
const from = "event" in line.from
|
|
113
|
+
? `event.${line.from.event}`
|
|
114
|
+
: "step" in line.from
|
|
115
|
+
? `step.${line.from.step}.${line.from.endState}`
|
|
116
|
+
: `end.${line.from.end}`;
|
|
117
|
+
const to = "step" in line.to ? `step.${line.to.step}` : `end.${line.to.end}`;
|
|
118
|
+
return `${from}>${to}`;
|
|
119
|
+
};
|
|
120
|
+
/** The place a task waits after travelling a line: the line itself, or the end state it leads to. */
|
|
121
|
+
export const placeAtEndOf = (line) => ("end" in line.to ? `end:${line.to.end}` : `line:${line.id}`);
|
|
122
|
+
/** A line out of an end state makes that end state the queue in front of its step. */
|
|
123
|
+
export const placeAtStartOf = (line) => ("end" in line.from ? `end:${line.from.end}` : `line:${line.id}`);
|
|
124
|
+
export const endStateOfPlace = (place) => place.startsWith("end:") ? Option.some(place.slice("end:".length)) : Option.none();
|
|
125
|
+
export const stepOfPlace = (place) => place.startsWith("step:") ? Option.some(place.slice("step:".length)) : Option.none();
|
|
126
|
+
export const sameStart = (a, b) => ("event" in a && "event" in b && a.event === b.event) ||
|
|
127
|
+
("step" in a && "step" in b && a.step === b.step && a.endState === b.endState) ||
|
|
128
|
+
("end" in a && "end" in b && a.end === b.end);
|
|
129
|
+
export const lineFrom = (graph, start) => Option.fromNullishOr(graph.lines.find((line) => sameStart(line.from, start)));
|
|
130
|
+
export const inputPlacesOf = (graph, step) => graph.lines.filter((line) => "step" in line.to && line.to.step === step).map(placeAtStartOf);
|
|
131
|
+
/** Events that bring a new task into the workflow; a change event starts a flow for a task already in it. */
|
|
132
|
+
export const createsTasks = (event) => event.kind !== "change";
|
|
133
|
+
/** Every structural problem in a graph, so a broken definition is refused at registration, not mid-run. */
|
|
134
|
+
export const problemsOf = (graph) => {
|
|
135
|
+
const problems = [];
|
|
136
|
+
const steps = new Map(graph.steps.map((step) => [step.id, step]));
|
|
137
|
+
const events = new Map(graph.events.map((event) => [event.id, event]));
|
|
138
|
+
if (steps.size !== graph.steps.length)
|
|
139
|
+
problems.push("two steps share an id");
|
|
140
|
+
if (events.size !== graph.events.length)
|
|
141
|
+
problems.push("two events share an id");
|
|
142
|
+
const ends = new Set(graph.endStates);
|
|
143
|
+
const starts = [];
|
|
144
|
+
for (const line of graph.lines) {
|
|
145
|
+
if (line.id !== lineIdOf(line))
|
|
146
|
+
problems.push(`line ${line.id} should have id ${lineIdOf(line)}`);
|
|
147
|
+
if (starts.some((start) => sameStart(start, line.from)))
|
|
148
|
+
problems.push(`two lines leave ${lineIdOf(line).split(">")[0]}`);
|
|
149
|
+
starts.push(line.from);
|
|
150
|
+
if ("event" in line.from && !events.has(line.from.event))
|
|
151
|
+
problems.push(`line ${line.id} leaves unknown event ${line.from.event}`);
|
|
152
|
+
if ("step" in line.from) {
|
|
153
|
+
const step = steps.get(line.from.step);
|
|
154
|
+
if (step === undefined)
|
|
155
|
+
problems.push(`line ${line.id} leaves unknown step ${line.from.step}`);
|
|
156
|
+
else if (!step.endStates.includes(line.from.endState))
|
|
157
|
+
problems.push(`line ${line.id} leaves unknown end state ${line.from.endState} of ${step.id}`);
|
|
158
|
+
}
|
|
159
|
+
if ("end" in line.from && !ends.has(line.from.end))
|
|
160
|
+
problems.push(`line ${line.id} leaves unknown workflow end state ${line.from.end}`);
|
|
161
|
+
if ("step" in line.to && !steps.has(line.to.step))
|
|
162
|
+
problems.push(`line ${line.id} enters unknown step ${line.to.step}`);
|
|
163
|
+
if ("end" in line.to && !ends.has(line.to.end))
|
|
164
|
+
problems.push(`line ${line.id} enters unknown workflow end state ${line.to.end}`);
|
|
165
|
+
}
|
|
166
|
+
for (const event of graph.events) {
|
|
167
|
+
if (Option.isNone(lineFrom(graph, { event: event.id })))
|
|
168
|
+
problems.push(`event ${event.id} has no line out of it`);
|
|
169
|
+
if (event.kind === "change" && event.resumes !== undefined && !ends.has(event.resumes))
|
|
170
|
+
problems.push(`event ${event.id} resumes unknown end state ${event.resumes}`);
|
|
171
|
+
if (event.kind === "timer" && event.fieldsProblem !== undefined)
|
|
172
|
+
problems.push(`timer event ${event.id} cannot start a turn: ${event.fieldsProblem}`);
|
|
173
|
+
if (event.kind === "timer" && event.fieldsProblem === undefined && event.fields === undefined)
|
|
174
|
+
problems.push(`timer event ${event.id} has no fields for its turn task`);
|
|
175
|
+
if (event.kind === "list" && !ends.has(event.leftAs))
|
|
176
|
+
problems.push(`event ${event.id} ends a task that left its list in ${event.leftAs}, which is not an end state of the workflow`);
|
|
177
|
+
if (event.kind === "list" && !graph.steps.some((step) => step.syncs === event.id))
|
|
178
|
+
problems.push(`list event ${event.id} has no step that syncs it`);
|
|
179
|
+
}
|
|
180
|
+
for (const step of graph.steps) {
|
|
181
|
+
if ((step.kind === "workflow") !== (step.workflow !== undefined))
|
|
182
|
+
problems.push(`step ${step.id} must name a sub-workflow exactly when its kind is workflow`);
|
|
183
|
+
if (step.kind === "workflow" && step.access !== undefined)
|
|
184
|
+
problems.push(`step ${step.id} is a sub-workflow step, whose code runs in its own workflow, so it declares no access`);
|
|
185
|
+
for (const workflow of [...(step.access?.tasks?.read ?? []), ...(step.access?.tasks?.write ?? [])]) {
|
|
186
|
+
if (workflow.length === 0)
|
|
187
|
+
problems.push(`step ${step.id} names a workflow with no name in its access`);
|
|
188
|
+
}
|
|
189
|
+
for (const end of step.inputsSettledBy ?? []) {
|
|
190
|
+
if (!ends.has(end))
|
|
191
|
+
problems.push(`step ${step.id} settles its inputs by ${end}, which is not an end state of the workflow`);
|
|
192
|
+
}
|
|
193
|
+
if (step.inputsSettledBy !== undefined && step.inputsSettledBy.length === 0)
|
|
194
|
+
problems.push(`step ${step.id} names no end state that settles its inputs`);
|
|
195
|
+
if (step.syncs !== undefined) {
|
|
196
|
+
if (events.get(step.syncs)?.kind !== "list")
|
|
197
|
+
problems.push(`step ${step.id} syncs ${step.syncs}, which is not a list event of the workflow`);
|
|
198
|
+
if (step.kind !== "code")
|
|
199
|
+
problems.push(`step ${step.id} syncs a list, which only a code step does`);
|
|
200
|
+
}
|
|
201
|
+
if (step.retries !== undefined) {
|
|
202
|
+
if (step.kind === "workflow")
|
|
203
|
+
problems.push(`step ${step.id} is a sub-workflow step, which has no runs to retry`);
|
|
204
|
+
if (!Number.isInteger(step.retries.limit) || step.retries.limit < 1)
|
|
205
|
+
problems.push(`step ${step.id} retries a run at least once`);
|
|
206
|
+
if (step.retries.delayMs < 0)
|
|
207
|
+
problems.push(`step ${step.id} waits no less than 0 ms between tries`);
|
|
208
|
+
if (!step.endStates.includes(step.retries.giveUp))
|
|
209
|
+
problems.push(`step ${step.id} gives up through ${step.retries.giveUp}, which is not one of its end states`);
|
|
210
|
+
}
|
|
211
|
+
for (const endState of step.endStates) {
|
|
212
|
+
if (Option.isNone(lineFrom(graph, { step: step.id, endState })))
|
|
213
|
+
problems.push(`end state ${endState} of step ${step.id} has nowhere to go`);
|
|
214
|
+
}
|
|
215
|
+
if (inputPlacesOf(graph, step.id).length === 0)
|
|
216
|
+
problems.push(`step ${step.id} has no line into it`);
|
|
217
|
+
}
|
|
218
|
+
if (graph.inProgress !== undefined && !(Number.isInteger(graph.inProgress.limit) && graph.inProgress.limit >= 1))
|
|
219
|
+
problems.push("the workflow lets at least one task be in progress at once");
|
|
220
|
+
for (const [who, retention] of [["the workflow", graph.retention], ...graph.steps.map((step) => [`step ${step.id}`, step.retention])]) {
|
|
221
|
+
if (retention?.days !== undefined && !(retention.days >= 0))
|
|
222
|
+
problems.push(`${who} keeps its records no fewer than 0 days`);
|
|
223
|
+
// A gate reads its newest settled run, so every step keeps at least its newest one.
|
|
224
|
+
if (retention?.keepAtLeastRuns !== undefined && !(Number.isInteger(retention.keepAtLeastRuns) && retention.keepAtLeastRuns >= 1))
|
|
225
|
+
problems.push(`${who} keeps at least its newest run`);
|
|
226
|
+
}
|
|
227
|
+
return problems;
|
|
228
|
+
};
|
|
229
|
+
/** The end state of a step making one sub-workflow task per list entry, reached once every one of them has ended. */
|
|
230
|
+
export const everySubWorkflowTaskEnded = "ended";
|
|
231
|
+
/**
|
|
232
|
+
* One thing a step, or a call that sent the task back, said about a task, at the time it was said. `step` is absent on a
|
|
233
|
+
* note no step wrote, such as the reason a task was requeued. `workflow` names the task's workflow, which differs from
|
|
234
|
+
* the reader's for a note on a parent task.
|
|
235
|
+
*/
|
|
236
|
+
export const taskNoteValidator = v.object({ workflow: v.string(), step: v.optional(v.string()), note: v.string(), at: v.number() });
|
|
237
|
+
/**
|
|
238
|
+
* Where a sub-workflow task came from: the parent workflow, the sub-workflow step and the parent task that started it,
|
|
239
|
+
* the parent's flow waiting in that step, and the list entry it is for.
|
|
240
|
+
*/
|
|
241
|
+
export const parentRefValidator = v.object({ workflow: v.string(), step: v.string(), task: v.string(), flow: v.string(), entryIndex: v.number() });
|
|
242
|
+
/**
|
|
243
|
+
* The workforce mutations (Convex function handles) a workflow component schedules to reach another workflow's
|
|
244
|
+
* component: one creates sub-workflow tasks, the other tells a parent that one of them ended.
|
|
245
|
+
*/
|
|
246
|
+
export const workforceHooksValidator = v.object({ startSubWorkflowTasks: v.string(), subWorkflowTaskEnded: v.string() });
|
|
247
|
+
/**
|
|
248
|
+
* What one step run spent and used, as the worker measured it; the old platform's step records keep the same figures.
|
|
249
|
+
* Input tokens are split by how the provider prices them; `requests` counts the API calls an agent made, and `costUsd`
|
|
250
|
+
* is what those calls cost in US dollars, as the organization's agent runner reports it.
|
|
251
|
+
*/
|
|
252
|
+
export const stepSpendValidator = v.object({
|
|
253
|
+
fresh: v.number(),
|
|
254
|
+
cacheWrite: v.number(),
|
|
255
|
+
cacheRead: v.number(),
|
|
256
|
+
output: v.number(),
|
|
257
|
+
requests: v.number(),
|
|
258
|
+
costUsd: v.number(),
|
|
259
|
+
compiles: v.number(),
|
|
260
|
+
});
|
|
261
|
+
export const noSpend = { fresh: 0, cacheWrite: 0, cacheRead: 0, output: 0, requests: 0, costUsd: 0, compiles: 0 };
|
|
262
|
+
export const stepUsedValidator = v.object({
|
|
263
|
+
/** CPU of the worker process's own work while the step ran. */
|
|
264
|
+
ownCpuSeconds: v.number(),
|
|
265
|
+
/** CPU of processes the step started, as the step reports it. */
|
|
266
|
+
childCpuSeconds: v.number(),
|
|
267
|
+
peakMemoryMb: v.number(),
|
|
268
|
+
filesWritten: v.number(),
|
|
269
|
+
});
|
|
270
|
+
export const nothingUsed = { ownCpuSeconds: 0, childCpuSeconds: 0, peakMemoryMb: 0, filesWritten: 0 };
|
|
271
|
+
/** A worker's measurements of one step run, sent with its end state or its failure. */
|
|
272
|
+
export const stepMeasurementsValidator = v.object({
|
|
273
|
+
spend: stepSpendValidator,
|
|
274
|
+
used: stepUsedValidator,
|
|
275
|
+
/** The agent (provider and model) that ran an agent step; absent for a step that ran no agent. */
|
|
276
|
+
agent: v.optional(v.string()),
|
|
277
|
+
/** Names of the files the step wrote. */
|
|
278
|
+
files: v.array(v.string()),
|
|
279
|
+
/** The transcripts of the agent runs the step made, kept through the organization's `FileStore`. */
|
|
280
|
+
transcripts: v.array(taskFileValidator),
|
|
281
|
+
/** What the step read of its inputs, as one fingerprint, for the next run of the step to compare (`inputsChanged`). */
|
|
282
|
+
fingerprint: v.optional(v.string()),
|
|
283
|
+
});
|
|
284
|
+
/** A failed step's error as its record keeps it: 8,000 characters, the start and the end of a longer one. */
|
|
285
|
+
export const errorKept = (error) => error.length <= 8000 ? error : `${error.slice(0, 5000)}\n… ${error.length - 8000} characters of the error left out …\n${error.slice(-3000)}`;
|
|
286
|
+
/** A short fingerprint of a graph, recorded on every step run so a record says which version of its workflow ran. */
|
|
287
|
+
export const versionOf = (graph) => {
|
|
288
|
+
let hash = 0x811c9dc5;
|
|
289
|
+
for (const character of JSON.stringify(graph)) {
|
|
290
|
+
hash ^= character.charCodeAt(0);
|
|
291
|
+
hash = Math.imul(hash, 0x01000193) >>> 0;
|
|
292
|
+
}
|
|
293
|
+
return hash.toString(16).padStart(8, "0");
|
|
294
|
+
};
|
|
295
|
+
/**
|
|
296
|
+
* One place of a workflow's diagram, as the renderer names it: a line by its id, a step by its id, an end state by its
|
|
297
|
+
* name. `inFrontOf` names a step and means its whole queue: every task waiting on any line into it.
|
|
298
|
+
*/
|
|
299
|
+
export const placeRefValidator = v.union(v.object({ line: v.string() }), v.object({ step: v.string() }), v.object({ end: v.string() }), v.object({ inFrontOf: v.string() }));
|
|
300
|
+
/** A write to another task (`others`) a run made that was not applied: the task, its workflow, and why, in words. */
|
|
301
|
+
export const skippedOtherValidator = v.object({ workflow: v.string(), task: v.string(), reason: v.string() });
|
|
10
302
|
//# sourceMappingURL=graph.js.map
|
package/dist/graph.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"graph.js","sourceRoot":"","sources":["../../../src/graph.ts"],"names":[],"mappings":"AAaA,yEAAyE;AACzE,MAAM,CAAC,MAAM,UAAU,GAAG,YAAY,CAAC;AACvC,MAAM,C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AAE,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CACpC,CAAA;AAGD,qHAAqH;AACrH,MAAM,CAAC,MAAM,qBAAqB,GAAG,CAAC,CAAC,MAAM,CAAC,EAAE,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE,EAAE,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,EAAE,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAA"}
|
package/dist/index.js
CHANGED
|
@@ -1,134 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
*
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
|
|
8
|
-
import { Effect } from 'effect';
|
|
9
|
-
import fs from 'node:fs';
|
|
10
|
-
import path from 'node:path';
|
|
11
|
-
import { makePickWakes } from './pick-wakes';
|
|
12
|
-
import { makeStepFiles } from './step-files';
|
|
13
|
-
import { makeStepUsage } from './step-usage';
|
|
14
|
-
import { keptRunningByItsBudget, makeSteps, runLimitOf } from './steps';
|
|
15
|
-
import { blockedReasons, makeTasks, needsAgentReasons } from './tasks';
|
|
16
|
-
import { buildWorkflowFigures, buildWorkflowsView } from './views/workflows-view';
|
|
17
|
-
import { makeQueueCounts } from './queue-counts';
|
|
18
|
-
import { makeSpendingLimit } from './spending-limit';
|
|
19
|
-
import { sqliteBudgets } from './storage/budgets';
|
|
20
|
-
import { sqliteEngineRecords } from './storage/engine-records';
|
|
21
|
-
import { sqliteStore } from './storage/sqlite-store';
|
|
22
|
-
export * from './failure';
|
|
23
|
-
export * from './outside-failure';
|
|
24
|
-
export * from './project';
|
|
25
|
-
export * from './budget-states';
|
|
26
|
-
export * from './keep-running';
|
|
27
|
-
export * from './pick-wakes';
|
|
28
|
-
export * from './queue-counts';
|
|
29
|
-
export * from './spending-limit';
|
|
30
|
-
export * from './step-files';
|
|
31
|
-
export * from './step-meter';
|
|
32
|
-
export * from './steps';
|
|
33
|
-
export * from './tasks';
|
|
34
|
-
export * from './cpu-limit/use';
|
|
35
|
-
export * from './cpu-limit/limiter';
|
|
36
|
-
export * from './storage/budgets';
|
|
37
|
-
export * from './storage/engine-records';
|
|
38
|
-
export * from './storage/sqlite-store';
|
|
39
|
-
export * from './storage/step-records';
|
|
40
|
-
export * from './storage/input-records';
|
|
41
|
-
export * from './storage/storage-error';
|
|
42
|
-
export * from './storage/move-store';
|
|
43
|
-
export * from './storage/engine-storage';
|
|
44
|
-
export * from './graph';
|
|
45
|
-
export * from './reasons';
|
|
46
|
-
export * from './views/runs-now';
|
|
47
|
-
export * from './views/step-funnel';
|
|
48
|
-
export * from './views/step-graph';
|
|
49
|
-
export * from './views/workflows-view';
|
|
50
|
-
export * from './views/workflow-flows';
|
|
51
|
-
/**
|
|
52
|
-
* The storage as SQLite files: the platform's one database (step records, tasks, input runs, the limits, and the schema the
|
|
53
|
-
* project declares beside them), and the engine's own (`STORAGE.md` says why the engine keeps a file of its own). A test
|
|
54
|
-
* may name other files for each.
|
|
55
|
-
*/
|
|
56
|
-
export const sqliteStorage = (options) => {
|
|
57
|
-
const store = sqliteStore({ file: options.stepRecordsFile, processes: options.processes, ...(options.movedFrom === undefined ? {} : { movedFrom: options.movedFrom }), ...(options.creates === undefined ? {} : { creates: options.creates }) });
|
|
58
|
-
return {
|
|
59
|
-
stepRecords: store.stepRecords,
|
|
60
|
-
tasks: store.tasks,
|
|
61
|
-
inputs: store.inputs,
|
|
62
|
-
engine: sqliteEngineRecords({ file: options.engineFile }),
|
|
63
|
-
budgets: sqliteBudgets({ file: options.budgetsFile }),
|
|
64
|
-
};
|
|
65
|
-
};
|
|
66
|
-
/**
|
|
67
|
-
* ONE PROJECT'S PLATFORM. `Phase` is where the project shows a workflow; `R` what its workflows' lists of work run under.
|
|
68
|
-
*/
|
|
69
|
-
export const createWorkflowPlatform = (input) => {
|
|
70
|
-
const { project, storage } = input;
|
|
71
|
-
const wakes = makePickWakes();
|
|
72
|
-
const stepFiles = makeStepFiles({ tree: project.tree, runLightNow: project.runLightNow });
|
|
73
|
-
const stepUsage = makeStepUsage({ variable: project.stepRecordVariable, addStepCompile: (record) => { Effect.runFork(Effect.catchTag(storage.stepRecords.addStepCompile(record), 'StorageError', (e) => Effect.logError(`[step-runs] a compile of step record ${record}: ${e.reason}`))); } });
|
|
74
|
-
const tasks = makeTasks({ store: storage.tasks, engine: storage.engine, stepRecords: storage.stepRecords, wakes, texts: project.texts });
|
|
75
|
-
const spending = makeSpendingLimit({ store: storage.budgets, usage: project.weekUsage === undefined ? null : project.weekUsage, wakes });
|
|
76
|
-
const steps = makeSteps({
|
|
77
|
-
sourceRoot: project.sourceRoot, stepRecords: storage.stepRecords, engine: storage.engine, tasks, wakes, budgets: storage.budgets, stepFiles,
|
|
78
|
-
CurrentStepUsage: stepUsage.CurrentStepUsage, isTransientFailure: project.isTransientFailure, thisProcess: project.processes.thisProcess, inputs: storage.inputs,
|
|
79
|
-
queueChanged: (workflow) => queueCounts.changed(workflow),
|
|
80
|
-
spendingHoldsAgents: spending.holdsAgents,
|
|
81
|
-
});
|
|
82
|
-
const queueCounts = makeQueueCounts({
|
|
83
|
-
store: storage.tasks, tasks, wakes,
|
|
84
|
-
withQueues: () => steps.declaredWorkflows().filter((d) => d.item !== null).map((d) => d.name),
|
|
85
|
-
});
|
|
86
|
-
/**
|
|
87
|
-
* Every workflow's limits now, by name, in one read: what a page's controls show. Every workflow has a run limit
|
|
88
|
-
* (`steps.ts` `runLimitOf`), none meaning no limit; only one its budget keeps going has an agents' limit. Empty where no
|
|
89
|
-
* store is read (a test).
|
|
90
|
-
*/
|
|
91
|
-
const limitsNow = () => Effect.map(storage.budgets.storedLimits(), (stored) => (stored === null ? {} : Object.fromEntries(steps.declaredWorkflows().map((d) => {
|
|
92
|
-
const limits = stored.get(d.name) ?? { agents: 0, runs: null };
|
|
93
|
-
return [d.name, { agents: keptRunningByItsBudget(d) ? limits.agents : null, runs: runLimitOf(d, limits), runsSet: limits.runs !== null }];
|
|
94
|
-
}))));
|
|
95
|
-
/** Each source file's text, read again only when the file changed: a page's links name the line a definition is on now. */
|
|
96
|
-
const texts = new Map();
|
|
97
|
-
const locate = (s) => {
|
|
98
|
-
const file = path.join(project.sourceRoot, s.path);
|
|
99
|
-
try {
|
|
100
|
-
const changed = fs.statSync(file).mtimeMs;
|
|
101
|
-
if (texts.get(s.path)?.changed !== changed)
|
|
102
|
-
texts.set(s.path, { changed, text: fs.readFileSync(file, 'utf8') });
|
|
103
|
-
}
|
|
104
|
-
catch {
|
|
105
|
-
texts.set(s.path, null);
|
|
106
|
-
}
|
|
107
|
-
const text = texts.get(s.path)?.text;
|
|
108
|
-
const at = text === undefined ? -1 : text.indexOf(s.anchor);
|
|
109
|
-
return text === undefined || at < 0 ? null : text.slice(0, at).split('\n').length;
|
|
110
|
-
};
|
|
111
|
-
/**
|
|
112
|
-
* Every workflow as a dashboard shows it before one is opened, read now (`views/workflows-view.ts` `buildWorkflowsView`).
|
|
113
|
-
* `phases` is the order the project's page shows them in.
|
|
114
|
-
*/
|
|
115
|
-
const view = (r) => Effect.gen(function* () {
|
|
116
|
-
const limits = yield* limitsNow();
|
|
117
|
-
return yield* buildWorkflowsView({ declared: steps.declaredWorkflows(), phases: r.phases, top: r.top, now: r.now, taskStore: storage.tasks, locate, limitsOf: (name) => limits[name] ?? null, spending: yield* spending.state(r.now) });
|
|
118
|
-
});
|
|
119
|
-
/** One workflow's figures over the `hours` before `now`, read from its own records (`buildWorkflowFigures`); none for one not declared. */
|
|
120
|
-
const figures = (r) => {
|
|
121
|
-
const declaration = steps.declaredWorkflows().find((d) => d.name === r.workflow);
|
|
122
|
-
return declaration === undefined ? Effect.succeed(null) : buildWorkflowFigures({
|
|
123
|
-
declaration, now: r.now, hours: r.hours, records: storage.stepRecords, engine: storage.engine, locate,
|
|
124
|
-
reasons: declaration.item === null
|
|
125
|
-
? Effect.succeed({ blocked: [], needingAnAgent: { reasons: [], passedOverBecause: null } })
|
|
126
|
-
: Effect.map(Effect.all({ summaries: tasks.taskSummaries({ workflow: r.workflow }), unavailable: steps.agentsUnavailable(r.workflow) }), ({ summaries, unavailable }) => ({
|
|
127
|
-
blocked: blockedReasons(summaries),
|
|
128
|
-
needingAnAgent: { reasons: needsAgentReasons(summaries), passedOverBecause: unavailable },
|
|
129
|
-
})),
|
|
130
|
-
});
|
|
131
|
-
};
|
|
132
|
-
return { project, storage, wakes, stepFiles, stepUsage, tasks, steps, view, figures, limitsNow, queueCounts, spending };
|
|
133
|
-
};
|
|
1
|
+
export * as AgentRunner from "./definition/agent-runner";
|
|
2
|
+
export * as FileStore from "./definition/file-store";
|
|
3
|
+
export * as ProgramBuild from "./definition/program-build";
|
|
4
|
+
export * as Tasks from "./definition/tasks";
|
|
5
|
+
export * as TaskSchema from "./definition/task-schema";
|
|
6
|
+
export * as Workflow from "./definition/workflow";
|
|
7
|
+
export * from "./graph";
|
|
134
8
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/index.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,WAAW,MAAM,2BAA2B,CAAA;AACxD,OAAO,KAAK,SAAS,MAAM,yBAAyB,CAAA;AACpD,OAAO,KAAK,YAAY,MAAM,4BAA4B,CAAA;AAC1D,OAAO,KAAK,KAAK,MAAM,oBAAoB,CAAA;AAC3C,OAAO,KAAK,UAAU,MAAM,0BAA0B,CAAA;AACtD,OAAO,KAAK,QAAQ,MAAM,uBAAuB,CAAA;AAEjD,cAAc,SAAS,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jive-sh/workflow-platform",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "1.0.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"type": "module",
|
|
6
|
-
"description": "Durable workflows
|
|
6
|
+
"description": "Durable workflows in Convex: one workflow primitive with a task schema, queues on every line, workflow budgets, named end states, events and sub-workflows; worker processes run the steps.",
|
|
7
7
|
"repository": {
|
|
8
8
|
"type": "git",
|
|
9
9
|
"url": "git+https://github.com/jive-sh/workflow-platform.git"
|
|
@@ -16,14 +16,19 @@
|
|
|
16
16
|
"types": "./src/index.ts",
|
|
17
17
|
"import": "./dist/index.js"
|
|
18
18
|
},
|
|
19
|
-
"./README.md": "./README.md"
|
|
19
|
+
"./README.md": "./README.md",
|
|
20
|
+
"./component/*": "./component/*",
|
|
21
|
+
"./worker/*": "./worker/*"
|
|
20
22
|
},
|
|
21
23
|
"files": [
|
|
22
24
|
"README.md",
|
|
25
|
+
"component",
|
|
26
|
+
"worker",
|
|
23
27
|
"dist",
|
|
24
28
|
"src"
|
|
25
29
|
],
|
|
26
30
|
"peerDependencies": {
|
|
27
|
-
"
|
|
31
|
+
"convex": "^1.51.0",
|
|
32
|
+
"effect": "^4.1.7"
|
|
28
33
|
}
|
|
29
34
|
}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { Context, Data, type Effect } from "effect"
|
|
2
|
+
import type { TaskFile } from "../graph"
|
|
3
|
+
|
|
4
|
+
export class AgentRunFailed extends Data.TaggedError("AgentRunFailed")<{ readonly cause: unknown }> {
|
|
5
|
+
override get message() {
|
|
6
|
+
return `the agent run failed: ${String(this.cause)}`
|
|
7
|
+
}
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* What one agent run produced: its final answer, which agent (provider and model) ran it, and what it spent. Input
|
|
12
|
+
* tokens are split the way providers price them; `requests` counts the API calls it made, and `costUsd` is what they
|
|
13
|
+
* cost in US dollars at the prices of the agent that ran them: the runner knows the model, so it prices the run.
|
|
14
|
+
*/
|
|
15
|
+
export interface AgentRunResult {
|
|
16
|
+
readonly output: string
|
|
17
|
+
readonly agent: string
|
|
18
|
+
/** The run's whole transcript, kept through the organization's `FileStore`; the step's record lists it. */
|
|
19
|
+
readonly transcript: TaskFile
|
|
20
|
+
/** Whether the run stopped at its `maxTurns` before it answered; `output` is then empty, and its spend still counts. */
|
|
21
|
+
readonly stoppedAtTurnLimit: boolean
|
|
22
|
+
readonly spend: { readonly fresh: number; readonly cacheWrite: number; readonly cacheRead: number; readonly output: number; readonly requests: number; readonly costUsd: number }
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* What an agent run may do besides answer. `none` (the default) answers in one turn with no tools. `reading` reads the
|
|
27
|
+
* files of `folder` (read, search, list) for up to `maxTurns` turns and changes nothing. `working` also edits, writes
|
|
28
|
+
* and runs commands there, with git refused; it may change only the files matching one of `mayWrite`, globs relative
|
|
29
|
+
* to `folder`.
|
|
30
|
+
*/
|
|
31
|
+
export type AgentTools =
|
|
32
|
+
| { readonly kind: "none" }
|
|
33
|
+
| { readonly kind: "reading"; readonly folder: string; readonly maxTurns: number }
|
|
34
|
+
| { readonly kind: "working"; readonly folder: string; readonly maxTurns: number; readonly mayWrite: ReadonlyArray<string> }
|
|
35
|
+
|
|
36
|
+
/** What a step asks of one agent run. */
|
|
37
|
+
export interface AgentRunInput {
|
|
38
|
+
readonly instructions?: string
|
|
39
|
+
/**
|
|
40
|
+
* Text that stays the same from run to run, such as a function's disassembly and its notes on a second try, sent after
|
|
41
|
+
* the instructions so the provider reads it from its cache rather than charging for it fresh.
|
|
42
|
+
*/
|
|
43
|
+
readonly cached?: string
|
|
44
|
+
readonly prompt: string
|
|
45
|
+
readonly files: ReadonlyArray<TaskFile>
|
|
46
|
+
readonly tools?: AgentTools
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* The interface a workflow's agent steps use to run an agent; the organization provides the implementation (which
|
|
51
|
+
* model or provider, which machine, which credentials). The step says what the agent is told to be (`instructions`, its
|
|
52
|
+
* system prompt), what it is asked, which of the task's files it may read, and which tools it may use where. The worker
|
|
53
|
+
* adds every run's spend and transcript to the step's record.
|
|
54
|
+
*/
|
|
55
|
+
export interface IAgentRunner {
|
|
56
|
+
run(input: AgentRunInput): Effect.fn.Return<AgentRunResult, AgentRunFailed>
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
export class AgentRunner extends Context.Service<AgentRunner, IAgentRunner>()("AgentRunner") {}
|