@jive-sh/workflow-platform 0.7.0 → 1.1.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 +70 -435
- package/component/_generated/api.ts +72 -0
- package/component/_generated/component.ts +629 -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 +756 -0
- package/component/errors.ts +66 -0
- package/component/events.ts +17 -0
- package/component/notes.ts +19 -0
- package/component/places.ts +136 -0
- package/component/retention.ts +205 -0
- package/component/runEngine.ts +25 -0
- package/component/schema.ts +135 -0
- package/component/steps.ts +188 -0
- package/component/store.ts +513 -0
- package/component/tasks.ts +290 -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 +117 -0
- package/dist/definition/workflow.js.map +1 -0
- package/dist/graph.js +310 -9
- package/dist/graph.js.map +1 -1
- package/dist/index.js +7 -196
- 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 +262 -0
- package/src/graph.ts +352 -19
- package/src/index.ts +8 -238
- package/worker/directory-file-store.ts +42 -0
- package/worker/index.ts +12 -0
- package/worker/platform-client.ts +144 -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 -148
- package/dist/dashboard/drilldown.js +0 -47
- 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/run-doing-words.js +0 -29
- package/dist/dashboard/run-doing-words.js.map +0 -1
- package/dist/dashboard/setting-words.js +0 -18
- package/dist/dashboard/setting-words.js.map +0 -1
- package/dist/dashboard/spending-words.js +0 -24
- 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 -79
- 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/retention.js +0 -59
- package/dist/retention.js.map +0 -1
- package/dist/settings.js +0 -88
- package/dist/settings.js.map +0 -1
- package/dist/spending-limit.js +0 -82
- 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-times.js +0 -114
- package/dist/step-times.js.map +0 -1
- package/dist/step-usage.js +0 -19
- package/dist/step-usage.js.map +0 -1
- package/dist/steps.js +0 -1205
- package/dist/steps.js.map +0 -1
- package/dist/storage/agent-claims.js +0 -3
- package/dist/storage/agent-claims.js.map +0 -1
- package/dist/storage/budgets.js +0 -121
- package/dist/storage/budgets.js.map +0 -1
- package/dist/storage/engine-records.js +0 -91
- 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 -901
- 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 -30
- package/dist/storage/task-store.js.map +0 -1
- package/dist/system-workflows.js +0 -54
- package/dist/system-workflows.js.map +0 -1
- package/dist/tasks.js +0 -500
- 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 -117
- 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 -39
- package/dist/views/step-graph.js.map +0 -1
- package/dist/views/workflows-view.js +0 -236
- package/dist/views/workflows-view.js.map +0 -1
- package/src/budget-states.ts +0 -54
- 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 -148
- package/src/dashboard/drilldown.ts +0 -70
- package/src/dashboard/index.tsx +0 -4
- package/src/dashboard/limits-and-runs.tsx +0 -191
- package/src/dashboard/machine-controls.tsx +0 -53
- package/src/dashboard/queue-bar.tsx +0 -62
- package/src/dashboard/queue-chart.tsx +0 -149
- package/src/dashboard/queue-lines.ts +0 -87
- package/src/dashboard/queue-table.ts +0 -37
- package/src/dashboard/run-doing-words.ts +0 -41
- package/src/dashboard/setting-words.ts +0 -30
- package/src/dashboard/spending-limit-control.tsx +0 -47
- package/src/dashboard/spending-words.ts +0 -32
- package/src/dashboard/time-distribution.tsx +0 -61
- package/src/dashboard/workflow-dag.tsx +0 -322
- package/src/dashboard/workflow-drilldown.tsx +0 -31
- package/src/dashboard/workflows-dashboard.tsx +0 -532
- package/src/failure.ts +0 -36
- package/src/keep-running.ts +0 -85
- package/src/outside-failure.ts +0 -39
- package/src/pick-wakes.ts +0 -182
- package/src/project.ts +0 -127
- package/src/queue-counts.ts +0 -64
- package/src/reasons.ts +0 -30
- package/src/retention.ts +0 -90
- package/src/settings.ts +0 -171
- package/src/spending-limit.ts +0 -139
- package/src/step-files.ts +0 -208
- package/src/step-meter.ts +0 -120
- package/src/step-times.ts +0 -151
- package/src/step-usage.ts +0 -23
- package/src/steps.ts +0 -1616
- package/src/storage/agent-claims.ts +0 -63
- package/src/storage/budgets.ts +0 -152
- package/src/storage/engine-records.ts +0 -119
- 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 -1022
- package/src/storage/step-records.ts +0 -358
- package/src/storage/storage-error.ts +0 -35
- package/src/storage/task-store.ts +0 -235
- package/src/system-workflows.ts +0 -70
- package/src/tasks.ts +0 -586
- package/src/views/format.ts +0 -40
- package/src/views/runs-now.ts +0 -188
- package/src/views/step-funnel.ts +0 -163
- package/src/views/step-graph.ts +0 -77
- package/src/views/workflows-view.ts +0 -484
- package/src/workflow-dag.test.tsx +0 -89
- package/src/workflow-page.test.tsx +0 -170
package/dist/index.js
CHANGED
|
@@ -1,197 +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, tasksAreRuns } 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 { makeStepTimes } from './step-times';
|
|
19
|
-
import { makeSpendingLimit } from './spending-limit';
|
|
20
|
-
import { makeRetention } from './retention';
|
|
21
|
-
import { checkedSettings, RUNTIME_SETTINGS, settingValueRefusal, stepSetting, workflowSetting } from './settings';
|
|
22
|
-
import { makeSystemWorkflows } from './system-workflows';
|
|
23
|
-
import { sqliteBudgets } from './storage/budgets';
|
|
24
|
-
import { sqliteEngineRecords } from './storage/engine-records';
|
|
25
|
-
import { sqliteStore } from './storage/sqlite-store';
|
|
26
|
-
export * from './failure';
|
|
27
|
-
export * from './outside-failure';
|
|
28
|
-
export * from './project';
|
|
29
|
-
export * from './budget-states';
|
|
30
|
-
export * from './keep-running';
|
|
31
|
-
export * from './pick-wakes';
|
|
32
|
-
export * from './queue-counts';
|
|
33
|
-
export * from './spending-limit';
|
|
34
|
-
export * from './step-files';
|
|
35
|
-
export * from './step-meter';
|
|
36
|
-
export * from './steps';
|
|
37
|
-
export * from './tasks';
|
|
38
|
-
export * from './cpu-limit/use';
|
|
39
|
-
export * from './cpu-limit/limiter';
|
|
40
|
-
export * from './storage/budgets';
|
|
41
|
-
export * from './storage/engine-records';
|
|
42
|
-
export * from './storage/sqlite-store';
|
|
43
|
-
export * from './storage/step-records';
|
|
44
|
-
export * from './storage/input-records';
|
|
45
|
-
export * from './storage/agent-claims';
|
|
46
|
-
export * from './storage/storage-error';
|
|
47
|
-
export * from './storage/move-store';
|
|
48
|
-
export * from './storage/engine-storage';
|
|
49
|
-
export * from './graph';
|
|
50
|
-
export * from './reasons';
|
|
51
|
-
export * from './views/runs-now';
|
|
52
|
-
export * from './views/step-funnel';
|
|
53
|
-
export * from './views/step-graph';
|
|
54
|
-
export * from './step-times';
|
|
55
|
-
export * from './settings';
|
|
56
|
-
export * from './retention';
|
|
57
|
-
export * from './system-workflows';
|
|
58
|
-
export * from './views/workflows-view';
|
|
59
|
-
/**
|
|
60
|
-
* The storage as SQLite files: the platform's one database (step records, tasks, input runs, the limits, and the schema the
|
|
61
|
-
* project declares beside them), and the engine's own (`STORAGE.md` says why the engine keeps a file of its own). A test
|
|
62
|
-
* may name other files for each.
|
|
63
|
-
*/
|
|
64
|
-
export const sqliteStorage = (options) => {
|
|
65
|
-
const store = sqliteStore({ file: options.stepRecordsFile, processes: options.processes, ...(options.movedFrom === undefined ? {} : { movedFrom: options.movedFrom }), ...(options.creates === undefined ? {} : { creates: options.creates }) });
|
|
66
|
-
return {
|
|
67
|
-
stepRecords: store.stepRecords,
|
|
68
|
-
tasks: store.tasks,
|
|
69
|
-
inputs: store.inputs,
|
|
70
|
-
claims: store.claims,
|
|
71
|
-
engine: sqliteEngineRecords({ file: options.engineFile }),
|
|
72
|
-
budgets: sqliteBudgets({ file: options.budgetsFile }),
|
|
73
|
-
};
|
|
74
|
-
};
|
|
75
|
-
/**
|
|
76
|
-
* ONE PROJECT'S PLATFORM. `R` is what its workflows' lists of work run under.
|
|
77
|
-
*/
|
|
78
|
-
export const createWorkflowPlatform = (input) => {
|
|
79
|
-
const { project, storage } = input;
|
|
80
|
-
const wakes = makePickWakes();
|
|
81
|
-
const stepFiles = makeStepFiles({ tree: project.tree, runLightNow: project.runLightNow });
|
|
82
|
-
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}`))); } });
|
|
83
|
-
const tasks = makeTasks({ store: storage.tasks, engine: storage.engine, stepRecords: storage.stepRecords, wakes, texts: project.texts });
|
|
84
|
-
const spending = makeSpendingLimit({ store: storage.budgets, usage: project.weekUsage === undefined ? null : project.weekUsage, wakes });
|
|
85
|
-
// The app's platform-wide settings, checked where they enter: what every workflow and step inherits (`settings.ts`).
|
|
86
|
-
const appSettings = checkedSettings({ what: "the app's settings", ...(project.settings ?? {}) });
|
|
87
|
-
const { oneStepSystemWorkflow, ...steps } = makeSteps({
|
|
88
|
-
sourceRoot: project.sourceRoot, stepRecords: storage.stepRecords, engine: storage.engine, tasks, wakes, budgets: storage.budgets, stepFiles,
|
|
89
|
-
CurrentStepUsage: stepUsage.CurrentStepUsage, isTransientFailure: project.isTransientFailure, thisProcess: project.processes.thisProcess, inputs: storage.inputs,
|
|
90
|
-
queueChanged: (workflow) => queueCounts.changed(workflow),
|
|
91
|
-
spendingHoldsAgents: spending.holdsAgents,
|
|
92
|
-
claims: storage.claims,
|
|
93
|
-
appSettings,
|
|
94
|
-
});
|
|
95
|
-
/** Whether a workflow's tasks are its runs (`steps.ts` `tasksAreRuns`), among the workflows declared now. */
|
|
96
|
-
const runsAreTasks = (workflow) => {
|
|
97
|
-
const declared = steps.declaredWorkflows();
|
|
98
|
-
const d = declared.find((x) => x.name === workflow);
|
|
99
|
-
return d !== undefined && tasksAreRuns(d, declared);
|
|
100
|
-
};
|
|
101
|
-
const queueCounts = makeQueueCounts({
|
|
102
|
-
store: storage.tasks, tasks, wakes,
|
|
103
|
-
withQueues: () => steps.declaredWorkflows().filter((d) => d.item !== null || runsAreTasks(d.name)).map((d) => d.name),
|
|
104
|
-
});
|
|
105
|
-
/**
|
|
106
|
-
* Every workflow's limits now, by name, in one read: what a page's controls show. Every workflow has a run limit
|
|
107
|
-
* (`steps.ts` `runLimitOf`), none meaning no limit; only one its budget keeps going has an agents' limit. Empty where no
|
|
108
|
-
* store is read (a test).
|
|
109
|
-
*/
|
|
110
|
-
const limitsNow = () => Effect.map(storage.budgets.storedLimits(), (stored) => (stored === null ? {} : Object.fromEntries(steps.declaredWorkflows().map((d) => {
|
|
111
|
-
const limits = stored.get(d.name) ?? { agents: 0, runs: null };
|
|
112
|
-
return [d.name, { agents: keptRunningByItsBudget(d) ? limits.agents : null, runs: runLimitOf(d, limits), runsSet: limits.runs !== null, agentsSet: stored.has(d.name) }];
|
|
113
|
-
}))));
|
|
114
|
-
/** Each source file's text, read again only when the file changed: a page's links name the line a definition is on now. */
|
|
115
|
-
const texts = new Map();
|
|
116
|
-
const locate = (s) => {
|
|
117
|
-
const file = path.join(project.sourceRoot, s.path);
|
|
118
|
-
try {
|
|
119
|
-
const changed = fs.statSync(file).mtimeMs;
|
|
120
|
-
if (texts.get(s.path)?.changed !== changed)
|
|
121
|
-
texts.set(s.path, { changed, text: fs.readFileSync(file, 'utf8') });
|
|
122
|
-
}
|
|
123
|
-
catch {
|
|
124
|
-
texts.set(s.path, null);
|
|
125
|
-
}
|
|
126
|
-
const text = texts.get(s.path)?.text;
|
|
127
|
-
const at = text === undefined ? -1 : text.indexOf(s.anchor);
|
|
128
|
-
return text === undefined || at < 0 ? null : text.slice(0, at).split('\n').length;
|
|
129
|
-
};
|
|
130
|
-
/**
|
|
131
|
-
* Every workflow as a dashboard shows it before one is opened, read now (`views/workflows-view.ts` `buildWorkflowsView`).
|
|
132
|
-
*/
|
|
133
|
-
const view = (r) => Effect.gen(function* () {
|
|
134
|
-
const limits = yield* limitsNow();
|
|
135
|
-
return yield* buildWorkflowsView({ declared: steps.declaredWorkflows(), app: appSettings, stored: yield* storage.budgets.storedSettings(), top: r.top, now: r.now, taskStore: storage.tasks, locate, limitsOf: (name) => limits[name] ?? null, spending: yield* spending.state(r.now) });
|
|
136
|
-
});
|
|
137
|
-
/** One workflow's figures over the `hours` before `now`, read from its own records (`buildWorkflowFigures`); none for one not declared. */
|
|
138
|
-
const figures = (r) => {
|
|
139
|
-
const declaration = steps.declaredWorkflows().find((d) => d.name === r.workflow);
|
|
140
|
-
// The workflows whose runs start it as a step (`defineSubWorkflow`), and the step's name in each: their tasks pass through it.
|
|
141
|
-
const asAStepOf = steps.declaredWorkflows().flatMap((p) => p.steps().flatMap((s) => (s.workflow === r.workflow && s.runsOnItsOwnTrigger !== true ? [{ workflow: p.name, step: s.name }] : [])));
|
|
142
|
-
return declaration === undefined ? Effect.succeed(null) : buildWorkflowFigures({
|
|
143
|
-
declaration, now: r.now, hours: r.hours, records: storage.stepRecords, engine: storage.engine, locate, asAStepOf,
|
|
144
|
-
reasons: declaration.item === null && !runsAreTasks(r.workflow)
|
|
145
|
-
? Effect.succeed({ blocked: [], needingAnAgent: { reasons: [], passedOverBecause: null } })
|
|
146
|
-
: Effect.map(Effect.all({ summaries: tasks.taskSummaries({ workflow: r.workflow }), noAgentFree: steps.whyNoAgentIsFree(r.workflow) }), ({ summaries, noAgentFree }) => ({
|
|
147
|
-
blocked: blockedReasons(summaries),
|
|
148
|
-
needingAnAgent: { reasons: needsAgentReasons(summaries), passedOverBecause: noAgentFree },
|
|
149
|
-
})),
|
|
150
|
-
});
|
|
151
|
-
};
|
|
152
|
-
/** Each step's time distribution over the current version of its workflow, held in memory (`step-times.ts`). */
|
|
153
|
-
const stepTimes = makeStepTimes({
|
|
154
|
-
records: storage.stepRecords, engine: storage.engine, versionOf: steps.versionOf,
|
|
155
|
-
stepsOf: (workflow) => steps.declaredWorkflows().find((d) => d.name === workflow)?.steps().map((s) => s.name) ?? [],
|
|
156
|
-
});
|
|
157
|
-
/** Retention (`retention.ts`): what the platform's own workflow Retention runs to delete the records its workflows keep no longer. */
|
|
158
|
-
const retention = makeRetention({
|
|
159
|
-
declared: steps.declaredWorkflows, app: appSettings, stored: storage.budgets.storedSettings, records: storage.stepRecords, tasks: storage.tasks, engine: storage.engine,
|
|
160
|
-
queueChanged: (workflow) => queueCounts.changed(workflow),
|
|
161
|
-
});
|
|
162
|
-
/**
|
|
163
|
-
* THE PLATFORM'S OWN WORKFLOWS (`system-workflows.ts`), defined here, before the app defines any of its own: the app's
|
|
164
|
-
* engine runs `system.layer`, and its scheduler starts each of `system.workflows` on its schedule.
|
|
165
|
-
*/
|
|
166
|
-
const system = makeSystemWorkflows({ define: oneStepSystemWorkflow, retention, schedules: project.systemSchedules });
|
|
167
|
-
/** The settings every workflow and step inherits (`settings.ts`), over every workflow declared now and the app's. */
|
|
168
|
-
const settings = {
|
|
169
|
-
/** An agent step's model and where it is set: set in code alone, so read at once. */
|
|
170
|
-
model: (r) => stepSetting({ declared: steps.declaredWorkflows(), app: appSettings, stored: [] }, { ...r, name: 'model' }),
|
|
171
|
-
/** Every setting now, the retention settings set while the app runs read from the store first. */
|
|
172
|
-
now: () => Effect.map(storage.budgets.storedSettings(), (stored) => {
|
|
173
|
-
const tree = { declared: steps.declaredWorkflows(), app: appSettings, stored };
|
|
174
|
-
return { ofStep: (r) => stepSetting(tree, r), ofWorkflow: (r) => workflowSetting(tree, r) };
|
|
175
|
-
}),
|
|
176
|
-
/**
|
|
177
|
-
* WHY A CHANGE A PAGE ASKS FOR IS REFUSED, none where the project may store it (`storage/budgets.ts`
|
|
178
|
-
* `SET_WORKFLOW_SETTING_SQL`): a retention setting, at a level declared now, to a good value or none (the code's).
|
|
179
|
-
*/
|
|
180
|
-
changeRefusal: (c) => {
|
|
181
|
-
const name = RUNTIME_SETTINGS.find((n) => n === c.name);
|
|
182
|
-
if (name === undefined)
|
|
183
|
-
return `${c.name} is no setting a page sets: only ${RUNTIME_SETTINGS.join(' and ')}`;
|
|
184
|
-
if (c.level.kind !== 'app') {
|
|
185
|
-
const { level } = c;
|
|
186
|
-
const d = steps.declaredWorkflows().find((x) => x.name === level.workflow);
|
|
187
|
-
if (d === undefined)
|
|
188
|
-
return `no workflow ${level.workflow} is declared`;
|
|
189
|
-
if (level.kind === 'step' && !d.steps().some((s) => s.name === level.step))
|
|
190
|
-
return `${d.name} has no step ${level.step}`;
|
|
191
|
-
}
|
|
192
|
-
return c.value === null ? null : settingValueRefusal(name, c.value);
|
|
193
|
-
},
|
|
194
|
-
};
|
|
195
|
-
return { project, storage, wakes, stepFiles, stepUsage, tasks, steps, view, figures, limitsNow, queueCounts, spending, stepTimes, retention, system, settings };
|
|
196
|
-
};
|
|
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";
|
|
197
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;;;;;;GAMG;AACH,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAChC,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,IAAI,MAAM,WAAW,CAAC;AAG7B,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAC7C,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAC7C,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAC7C,OAAO,EAAE,sBAAsB,EAAE,SAAS,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACtF,OAAO,EAAE,cAAc,EAAE,SAAS,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AACvE,OAAO,EAAE,oBAAoB,EAAE,kBAAkB,EAA+D,MAAM,wBAAwB,CAAC;AAC/I,OAAO,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;A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,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": "
|
|
3
|
+
"version": "1.1.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") {}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { Context, Data, type Effect } from "effect"
|
|
2
|
+
import type { TaskFile } from "../graph"
|
|
3
|
+
|
|
4
|
+
export class FileStoreError extends Data.TaggedError("FileStoreError")<{ readonly file: string; readonly cause: unknown }> {
|
|
5
|
+
override get message() {
|
|
6
|
+
return `file ${this.file} could not be stored or read: ${String(this.cause)}`
|
|
7
|
+
}
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* The interface a workflow uses to save and read its task files; the organization provides the implementation. Convex
|
|
12
|
+
* keeps only each file's reference (`TaskFile.ref`), so large files never reach the Convex bill.
|
|
13
|
+
*/
|
|
14
|
+
export interface IFileStore {
|
|
15
|
+
write(input: { readonly name: string; readonly bytes: Uint8Array }): Effect.fn.Return<TaskFile, FileStoreError>
|
|
16
|
+
read(file: TaskFile): Effect.fn.Return<Uint8Array, FileStoreError>
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export class FileStore extends Context.Service<FileStore, IFileStore>()("FileStore") {}
|
|
20
|
+
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { Context, Data, type Effect, type Option } from "effect"
|
|
2
|
+
|
|
3
|
+
/** The build could not run at all, such as when the toolchain is missing. A build that runs and fails is a result. */
|
|
4
|
+
export class ProgramBuildFailed extends Data.TaggedError("ProgramBuildFailed")<{ readonly cause: unknown }> {
|
|
5
|
+
override get message() {
|
|
6
|
+
return `the program build failed: ${String(this.cause)}`
|
|
7
|
+
}
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
/** What one build of the program produced. */
|
|
11
|
+
export interface ProgramBuildResult {
|
|
12
|
+
/** Whether the compiled functions linked into one runnable program. */
|
|
13
|
+
readonly linked: boolean
|
|
14
|
+
/** Functions in the program, compiled by this build, still failing to compile, and left out because they refused the link. */
|
|
15
|
+
readonly functions: { readonly total: number; readonly compiled: number; readonly failing: number; readonly excluded: number }
|
|
16
|
+
/** Why it didn't link, when it didn't. */
|
|
17
|
+
readonly failure: Option.Option<string>
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* The interface a workflow's build step uses to build the program it works on: compile what changed, link it, and
|
|
22
|
+
* publish the result where the organization serves it. The organization provides the implementation (which toolchain,
|
|
23
|
+
* which machine, where the program and its output live). `changedFunctions` names what the step knows changed; an
|
|
24
|
+
* implementation may find more by itself. The worker records `functions.compiled` as the step's compiles.
|
|
25
|
+
*/
|
|
26
|
+
export interface IProgramBuild {
|
|
27
|
+
build(input: { readonly changedFunctions: ReadonlyArray<string> }): Effect.fn.Return<ProgramBuildResult, ProgramBuildFailed>
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export class ProgramBuild extends Context.Service<ProgramBuild, IProgramBuild>()("ProgramBuild") {}
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
import type { Context, Effect, Option } from "effect"
|
|
2
|
+
import type { Retention, Retries, SubWorkflow, TaskFile, TaskNote } from "../graph"
|
|
3
|
+
import type { Tasks } from "./tasks"
|
|
4
|
+
|
|
5
|
+
export interface StepInput<Fields> {
|
|
6
|
+
readonly taskId: string
|
|
7
|
+
readonly fields: Fields
|
|
8
|
+
readonly files: ReadonlyArray<TaskFile>
|
|
9
|
+
/**
|
|
10
|
+
* Everything said about the task so far, oldest first: its own step runs' notes, the reasons calls sent it back, and
|
|
11
|
+
* the notes on the tasks above it whose sub-workflow steps made it. An agent step puts what it needs of them in its
|
|
12
|
+
* prompt.
|
|
13
|
+
*/
|
|
14
|
+
readonly notes: ReadonlyArray<TaskNote>
|
|
15
|
+
/** For an inputs gate (`inputsChanged`): the fingerprint its last settled turn recorded. */
|
|
16
|
+
readonly lastFingerprint: Option.Option<string>
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* A write a step's run makes to another task: fields (as stored, encoded by that task's workflow's schema) laid over its
|
|
21
|
+
* own, files added to its own, and a note saying what was done. `workflow` is the step's own when absent.
|
|
22
|
+
*/
|
|
23
|
+
export interface OtherTaskWrite {
|
|
24
|
+
readonly workflow?: string
|
|
25
|
+
readonly taskId: string
|
|
26
|
+
readonly fields?: Readonly<Record<string, unknown>>
|
|
27
|
+
readonly files?: ReadonlyArray<{ readonly name: string; readonly bytes: Uint8Array }>
|
|
28
|
+
readonly note: string
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/** What a step reports: one of its end states, and the fields and files it changed (omitted ones stay as they were). */
|
|
32
|
+
export interface StepOutcome<EndState extends string, Fields> {
|
|
33
|
+
readonly endState: EndState
|
|
34
|
+
readonly fields?: Partial<Fields>
|
|
35
|
+
readonly files?: ReadonlyArray<{ readonly name: string; readonly bytes: Uint8Array }>
|
|
36
|
+
/** What the step measured of processes it started, which the worker cannot see. */
|
|
37
|
+
readonly used?: { readonly childCpuSeconds?: number; readonly compiles?: number }
|
|
38
|
+
/** What the step has to say about the task, such as why it matched or what blocked it; kept on the step's run. */
|
|
39
|
+
readonly note?: string
|
|
40
|
+
/** What the step read of its inputs, as one fingerprint; the step's next run is given it as `lastFingerprint`. */
|
|
41
|
+
readonly fingerprint?: string
|
|
42
|
+
/** From a step that syncs a declared item list (`syncList`): every item on it now, each as its task's fields. */
|
|
43
|
+
readonly listed?: ReadonlyArray<Fields>
|
|
44
|
+
/**
|
|
45
|
+
* Writes to other tasks, of workflows the step's `access.tasks.write` lists, applied with this outcome in one
|
|
46
|
+
* transaction. A task in a step at that moment is skipped, and the run records it with why. A run that fails writes none.
|
|
47
|
+
*/
|
|
48
|
+
readonly others?: ReadonlyArray<OtherTaskWrite>
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
/** A service a step can be given: the platform's (`AgentRunner`, `FileStore`, `ProgramBuild`) or one of the organization's. */
|
|
52
|
+
export type ServiceKey = Context.Key<any, any>
|
|
53
|
+
|
|
54
|
+
/** The workflows whose tasks a step may read through `Tasks` and write through `others`, its own included only if listed. */
|
|
55
|
+
export interface TasksGrant {
|
|
56
|
+
readonly read: ReadonlyArray<string>
|
|
57
|
+
readonly write: ReadonlyArray<string>
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* What a step's code may use. Nothing listed grants nothing: the step sees only its own task. The worker gives a run
|
|
62
|
+
* only these services, and Convex refuses a read or write of tasks outside `tasks`.
|
|
63
|
+
*/
|
|
64
|
+
export interface StepAccess<Services extends ReadonlyArray<ServiceKey>, Grant extends TasksGrant | undefined> {
|
|
65
|
+
readonly services?: Services
|
|
66
|
+
readonly tasks?: Grant
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
/** The requirements a step with this access may have: its listed services, and `Tasks` when it lists any tasks. */
|
|
70
|
+
export type Granted<Services extends ReadonlyArray<ServiceKey>, Grant extends TasksGrant | undefined> =
|
|
71
|
+
| Context.Service.Identifier<Services[number]>
|
|
72
|
+
| (Grant extends TasksGrant ? Tasks : never)
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* A step a worker runs: code, or an agent. An agent step takes one unit of its workflow's agent budget, a code step one
|
|
76
|
+
* of its CPU budget. `Services` are what its `run` requires, which its `access` declares.
|
|
77
|
+
*/
|
|
78
|
+
export interface RunnableStep<Fields, EndState extends string, Services = never> {
|
|
79
|
+
readonly kind: "code" | "agent"
|
|
80
|
+
readonly endStates: ReadonlyArray<EndState>
|
|
81
|
+
readonly run: (input: StepInput<Fields>) => Effect.fn.Return<StepOutcome<EndState, Fields>, unknown, Services>
|
|
82
|
+
/** What the step declared it uses; the worker provides exactly these services. */
|
|
83
|
+
readonly access: { readonly services: ReadonlyArray<ServiceKey>; readonly tasks?: TasksGrant }
|
|
84
|
+
/** How a failed run is tried again; absent tries it again at once, however often it fails. */
|
|
85
|
+
readonly retries?: Retries & { readonly giveUp: EndState }
|
|
86
|
+
/** Set on an inputs gate: the workflow end states whose turns settle a fingerprint (`inputsChanged`). */
|
|
87
|
+
readonly inputsSettledBy?: ReadonlyArray<string>
|
|
88
|
+
/** Set on a list sync (`syncList`): the id of the `list` event whose tasks it keeps in step with the list. */
|
|
89
|
+
readonly syncs?: string
|
|
90
|
+
/** What its records keep, over its workflow's (`retentionOf`). */
|
|
91
|
+
readonly retention?: Retention
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
/** A step that is another workflow; it runs inside Convex and takes none of its own workflow's budget. */
|
|
95
|
+
export interface SubWorkflowStep<EndState extends string> {
|
|
96
|
+
readonly kind: "workflow"
|
|
97
|
+
readonly endStates: ReadonlyArray<EndState>
|
|
98
|
+
readonly workflow: SubWorkflow
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
export type AnyStep<Fields> = RunnableStep<Fields, string, any> | SubWorkflowStep<string>
|
|
102
|
+
|
|
103
|
+
/** The services the code and agent steps of `Steps` require, together. */
|
|
104
|
+
export type ServicesOfSteps<Steps> = {
|
|
105
|
+
[K in keyof Steps]: Steps[K] extends RunnableStep<any, any, infer Services> ? Services : never
|
|
106
|
+
}[keyof Steps]
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { Schema } from "effect"
|
|
2
|
+
|
|
3
|
+
/** A schema of a task's attribute fields: an object, encoded to JSON-safe values for Convex. */
|
|
4
|
+
export type FieldsSchema = Schema.Codec<Record<string, any>, Record<string, any>>
|
|
5
|
+
|
|
6
|
+
/** A workflow's task: attribute fields stored in Convex, and the names of the files it carries in the workflow's file store. */
|
|
7
|
+
export interface TaskSchema<Fields extends FieldsSchema> {
|
|
8
|
+
readonly fields: Fields
|
|
9
|
+
readonly files: ReadonlyArray<string>
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export const make = <Fields extends FieldsSchema>(input: { readonly fields: Fields; readonly files?: ReadonlyArray<string> }): TaskSchema<Fields> => ({
|
|
13
|
+
fields: input.fields,
|
|
14
|
+
files: input.files ?? [],
|
|
15
|
+
})
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { Context, Data, type Effect } from "effect"
|
|
2
|
+
import type { TaskFile, TaskNote } from "../graph"
|
|
3
|
+
|
|
4
|
+
export class TasksCallFailed extends Data.TaggedError("TasksCallFailed")<{ readonly cause: unknown }> {
|
|
5
|
+
override get message() {
|
|
6
|
+
return `reading tasks failed: ${String(this.cause)}`
|
|
7
|
+
}
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
/** Where a task is now: waiting on a line, in a step, or at an end state, as the workflow's diagram names them. */
|
|
11
|
+
export type TaskPlace = { readonly line: string } | { readonly step: string } | { readonly end: string }
|
|
12
|
+
|
|
13
|
+
/** Which tasks to look at: those waiting in front of a step, in a step, at an end state, or on one line. */
|
|
14
|
+
export type TasksAt = { readonly inFrontOf: string } | { readonly step: string } | { readonly end: string } | { readonly line: string }
|
|
15
|
+
|
|
16
|
+
/** One task another step's run found: its fields as stored (encoded by its workflow's task schema), files, notes and place. */
|
|
17
|
+
export interface FoundTask {
|
|
18
|
+
readonly taskId: string
|
|
19
|
+
readonly workflow: string
|
|
20
|
+
readonly fields: unknown
|
|
21
|
+
readonly files: ReadonlyArray<TaskFile>
|
|
22
|
+
readonly notes: ReadonlyArray<TaskNote>
|
|
23
|
+
readonly at: TaskPlace
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Other tasks a step's run can read, of the workflows its `access.tasks.read` lists. It writes to them through its
|
|
28
|
+
* outcome's `others`, which Convex applies with the run's own result.
|
|
29
|
+
*/
|
|
30
|
+
export interface ITasks {
|
|
31
|
+
/**
|
|
32
|
+
* Tasks of `workflow` (by default the step's own) whose fields equal every value in `where`, compared as stored,
|
|
33
|
+
* narrowed to one place by `at`; at most `limit` of them, in no set order.
|
|
34
|
+
*/
|
|
35
|
+
find(input: {
|
|
36
|
+
readonly workflow?: string
|
|
37
|
+
readonly where?: Readonly<Record<string, unknown>>
|
|
38
|
+
readonly at?: TasksAt
|
|
39
|
+
readonly limit: number
|
|
40
|
+
}): Effect.fn.Return<ReadonlyArray<FoundTask>, TasksCallFailed>
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
export class Tasks extends Context.Service<Tasks, ITasks>()("Tasks") {}
|