@jive-sh/workflow-platform 0.7.0 → 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 -435
- 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 -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 +255 -0
- package/src/graph.ts +341 -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 +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 -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/src/cpu-limit/use.ts
DELETED
|
@@ -1,166 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* THE CPU LIMIT'S ARITHMETIC, pure: how many more may start, what project work uses from the system's process list, and
|
|
3
|
-
* which running work to pause or resume to keep it to the limit. `limiter.ts` reads the system and the pool and asks these.
|
|
4
|
-
*/
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* HOW MANY MORE MAY START, IN THREADS: the limit less what project work is using, as read, less the slots taken since, and
|
|
8
|
-
* never more than the limit less the slots held. So every process of the project, any started without a slot included,
|
|
9
|
-
* counts against the limit, and a slot whose process uses two threads counts as two. With nothing held one may always
|
|
10
|
-
* start, so work the limit cannot see never stops the line for good. Pure.
|
|
11
|
-
*/
|
|
12
|
-
export const roomInThreads = (limit: number, held: number, justTaken: number, using: number): number => {
|
|
13
|
-
const byCount = Math.max(0, limit - held);
|
|
14
|
-
const byUse = Math.max(0, Math.floor(limit - using - justTaken + 1e-9));
|
|
15
|
-
return held === 0 ? Math.min(byCount, Math.max(1, byUse)) : Math.min(byCount, byUse);
|
|
16
|
-
};
|
|
17
|
-
|
|
18
|
-
/**
|
|
19
|
-
* A SLOT HELD THIS LONG IS REPORTED AS STUCK, by name: at 22:12 UTC on 2026-11-11 the first project's figures steps had held
|
|
20
|
-
* both slots for 27 and 19 minutes, on a slow query, and nothing said so while 62 waited. A real compile takes seconds.
|
|
21
|
-
*/
|
|
22
|
-
export const STUCK_AFTER_SECONDS = 15 * 60;
|
|
23
|
-
|
|
24
|
-
/** The held slots taken before `now - STUCK_AFTER_SECONDS`, oldest first. Pure. */
|
|
25
|
-
export const stuckSlots = <S extends { readonly since: number }>(held: ReadonlyArray<S>, now: number): ReadonlyArray<S> =>
|
|
26
|
-
held.filter((h) => now - h.since >= STUCK_AFTER_SECONDS).sort((a, b) => a.since - b.since);
|
|
27
|
-
|
|
28
|
-
/** `ps`'s cumulative CPU time in seconds: "1:02.50" or "1:02:03". Pure. */
|
|
29
|
-
export const cpuTimeSeconds = (time: string): number => time.trim().split(':').reduce((total, part) => total * 60 + Number(part), 0);
|
|
30
|
-
|
|
31
|
-
/** `ps`'s CPU time (`[[d-]h:]m:s.cc`, minutes past 59 allowed) in seconds. Pure. */
|
|
32
|
-
export const cpuSeconds = (time: string): number => {
|
|
33
|
-
const [days, rest] = time.includes('-') ? [Number(time.split('-')[0]), time.split('-')[1]!] : [0, time];
|
|
34
|
-
return days * 86_400 + rest.split(':').reduce((sum, part) => sum * 60 + Number(part), 0);
|
|
35
|
-
};
|
|
36
|
-
|
|
37
|
-
/** What a reader calls a process: the file it runs (`job-runner.ts`, `CL.EXE`), else its program and first word (`node tsc`). Pure. */
|
|
38
|
-
export const processName = (command: string): string => {
|
|
39
|
-
const words = command.split(/\s+/);
|
|
40
|
-
const file = words.find((word, i) => i > 0 && /\.(?:ts|exe|cpp)$/i.test(word));
|
|
41
|
-
if (file !== undefined) return file.split(/[/\\]/).pop() ?? file;
|
|
42
|
-
const program = (words[0] ?? '').split('/').pop() ?? '';
|
|
43
|
-
const first = words.slice(1).find((word) => word !== '' && !word.startsWith('-'));
|
|
44
|
-
return first === undefined ? program : `${program} ${first.split('/').pop() ?? first}`;
|
|
45
|
-
};
|
|
46
|
-
|
|
47
|
-
export interface ProjectUse {
|
|
48
|
-
readonly machine: number;
|
|
49
|
-
readonly service: number;
|
|
50
|
-
readonly project: number;
|
|
51
|
-
readonly top: string;
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
/** How a project tells its own processes from the rest of the machine's, by command line. */
|
|
55
|
-
export interface ProcessKinds {
|
|
56
|
-
/** A process of the service whatever its group (its Wine servers, say). */
|
|
57
|
-
readonly ofTheService: (command: string) => boolean;
|
|
58
|
-
/** What runs in the project's folders without being its work: a coding session's own process, an application. */
|
|
59
|
-
readonly notProjectWork: (command: string) => boolean;
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
/**
|
|
63
|
-
* The machine's, the service's and project work's use from `ps`'s lines (pid, group, CPU, command), in whole threads, with
|
|
64
|
-
* project work's busiest named. Project work is the service's process group, what `kinds` counts as the service's, and every
|
|
65
|
-
* process running in the project's folders however it was started, but what `kinds` says is not project work. `inProject`
|
|
66
|
-
* says whether a pid runs in the project's folders. Pure.
|
|
67
|
-
*/
|
|
68
|
-
export const readUse = (ps: string, serviceGroup: number, inProject: (pid: number) => boolean, kinds: ProcessKinds): ProjectUse => {
|
|
69
|
-
let machine = 0;
|
|
70
|
-
let service = 0;
|
|
71
|
-
let project = 0;
|
|
72
|
-
const busiest = new Map<string, number>();
|
|
73
|
-
for (const line of ps.split('\n')) {
|
|
74
|
-
const m = /^\s*(\d+)\s+(\d+)\s+([\d.]+)\s+(.*)$/.exec(line);
|
|
75
|
-
if (m === null) continue;
|
|
76
|
-
const cores = Number(m[3]) / 100;
|
|
77
|
-
machine += cores;
|
|
78
|
-
const command = m[4]!;
|
|
79
|
-
const ofTheService = Number(m[2]) === serviceGroup || kinds.ofTheService(command);
|
|
80
|
-
if (ofTheService) service += cores;
|
|
81
|
-
if (!ofTheService && (kinds.notProjectWork(command) || !inProject(Number(m[1])))) continue;
|
|
82
|
-
project += cores;
|
|
83
|
-
const name = processName(command);
|
|
84
|
-
busiest.set(name, (busiest.get(name) ?? 0) + cores);
|
|
85
|
-
}
|
|
86
|
-
const top = [...busiest.entries()].sort((a, b) => b[1] - a[1]).slice(0, 5).map(([name, n]) => `${name} ${n.toFixed(1)}`).join(', ');
|
|
87
|
-
return { machine, service, project, top };
|
|
88
|
-
};
|
|
89
|
-
|
|
90
|
-
/**
|
|
91
|
-
* `ps`'s lines (pid, group, %cpu, CPU time, command) as pid, group, percent and command, the percent the CPU time each used
|
|
92
|
-
* since `before`, `seconds` ago: a process started since counts all of its time. Without `before`, `%cpu` as it is. Pure.
|
|
93
|
-
*
|
|
94
|
-
* WHY: `%cpu` on macOS is a decaying average, so a sample missed every burst between two. On 2026-11-07 at 03:20 UTC the
|
|
95
|
-
* kernel's busy cores, every 5 s, were 6.3 3.2 2.3 2.1 2.7 2.0 2.2 2.9 3.6 4.9 5.0 3.0, and `%cpu` summed 6.0 3.8 2.6 1.4 1.6
|
|
96
|
-
* 1.5 1.4 1.9 2.1 2.7 4.1 1.9: under by a fifth, by over a core at 03:20.
|
|
97
|
-
*/
|
|
98
|
-
export const usedSince = (ps: string, before: ReadonlyMap<number, number> | null, seconds: number): { readonly lines: string; readonly times: ReadonlyMap<number, number> } => {
|
|
99
|
-
const times = new Map<number, number>();
|
|
100
|
-
const lines = ps.split('\n').flatMap((line) => {
|
|
101
|
-
const m = /^\s*(\d+)\s+(\d+)\s+([\d.]+)\s+(\S+)\s+(.*)$/.exec(line);
|
|
102
|
-
if (m === null) return [];
|
|
103
|
-
const pid = Number(m[1]);
|
|
104
|
-
const used = cpuSeconds(m[4]!);
|
|
105
|
-
times.set(pid, used);
|
|
106
|
-
const was = before?.get(pid);
|
|
107
|
-
// A pid used again by a newer process has less time than the one before it had.
|
|
108
|
-
const percent = before === null ? Number(m[3]) : (100 * (was === undefined || was > used ? used : used - was)) / seconds;
|
|
109
|
-
return [`${pid} ${m[2]} ${percent.toFixed(1)} ${m[5]}`];
|
|
110
|
-
});
|
|
111
|
-
return { lines: lines.join('\n'), times };
|
|
112
|
-
};
|
|
113
|
-
|
|
114
|
-
/** How often running work is held to the limit (`limiter.ts` `holdToTheLimit`). */
|
|
115
|
-
export const HOLD_EVERY_MS = 2_000;
|
|
116
|
-
/** Over the limit by more than this pauses slots: `ps`'s times are in hundredths of a second. */
|
|
117
|
-
const OVER_BY = 0.25;
|
|
118
|
-
/** A slot using less than this is not worth pausing: pausing it would not bring project work down. */
|
|
119
|
-
const WORTH_PAUSING = 0.2;
|
|
120
|
-
/** A slot paused this long is resumed even if it does not fit, so work the limit cannot pause never stops one for good. */
|
|
121
|
-
export const LONGEST_PAUSE_SECONDS = 60;
|
|
122
|
-
|
|
123
|
-
export interface PausableSlot {
|
|
124
|
-
readonly id: number;
|
|
125
|
-
readonly taken: number;
|
|
126
|
-
/** What its processes used over the last reading, in threads. */
|
|
127
|
-
readonly use: number;
|
|
128
|
-
/** When it was paused, and what it used just before; null while it runs. */
|
|
129
|
-
readonly paused: number | null;
|
|
130
|
-
readonly pausedUse: number | null;
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
/**
|
|
134
|
-
* Which slots to pause, and which to resume, now. Over the limit, the newest running slots that use something are paused
|
|
135
|
-
* until what is left fits, at the first reading over: two in a row let `tsc` and test runs over for 4 s a time, and sample
|
|
136
|
-
* averages over the limit (2026-11-07, 6 readings in 101). A paused slot resumes, oldest first, only once what it used
|
|
137
|
-
* before fits: resumed when project work was merely under, `tsc` came back at 2 threads and put it over again. Pure.
|
|
138
|
-
*/
|
|
139
|
-
export const pauseOrResume = (limit: number, using: number, slots: ReadonlyArray<PausableSlot>, now: number): { readonly pause: ReadonlyArray<number>; readonly resume: number | null } => {
|
|
140
|
-
if (using > limit + OVER_BY) {
|
|
141
|
-
const pause: number[] = [];
|
|
142
|
-
let left = using;
|
|
143
|
-
for (const s of slots.filter((x) => x.paused === null && x.use >= WORTH_PAUSING).sort((a, b) => b.taken - a.taken)) {
|
|
144
|
-
if (left <= limit) break;
|
|
145
|
-
pause.push(s.id);
|
|
146
|
-
left -= s.use;
|
|
147
|
-
}
|
|
148
|
-
return { pause, resume: null };
|
|
149
|
-
}
|
|
150
|
-
const oldest = slots.filter((s) => s.paused !== null).sort((a, b) => a.paused! - b.paused!)[0];
|
|
151
|
-
if (oldest === undefined) return { pause: [], resume: null };
|
|
152
|
-
const fits = using + (oldest.pausedUse ?? 1) <= limit;
|
|
153
|
-
return { pause: [], resume: fits || now - oldest.paused! >= LONGEST_PAUSE_SECONDS ? oldest.id : null };
|
|
154
|
-
};
|
|
155
|
-
|
|
156
|
-
/** Every process under `root`, `root` first, from `ps`'s pid and parent pid lines. Pure. */
|
|
157
|
-
export const processTree = (ps: string, root: number): ReadonlyArray<number> => {
|
|
158
|
-
const children = new Map<number, number[]>();
|
|
159
|
-
for (const line of ps.split('\n')) {
|
|
160
|
-
const m = /^\s*(\d+)\s+(\d+)/.exec(line);
|
|
161
|
-
if (m !== null) children.set(Number(m[2]), [...(children.get(Number(m[2])) ?? []), Number(m[1])]);
|
|
162
|
-
}
|
|
163
|
-
const tree = [root];
|
|
164
|
-
for (let i = 0; i < tree.length; i++) tree.push(...(children.get(tree[i]!) ?? []));
|
|
165
|
-
return tree;
|
|
166
|
-
};
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* THE AGENTS' ACCOUNT, one row a limit: its name, what is used of it as a figure and a bar with its pace line marked, and
|
|
5
|
-
* what stands beside it in words (`agent-usage.ts`). The bar only repeats the figure: nothing is told by it alone.
|
|
6
|
-
*/
|
|
7
|
-
import { limitDetail, readWords, usedWords, type AgentUsage } from './agent-usage';
|
|
8
|
-
|
|
9
|
-
export function AgentUsageLine({ usage, now }: { readonly usage: AgentUsage; readonly now: number }) {
|
|
10
|
-
return (
|
|
11
|
-
<section className="wp-usage" aria-label="What the agents' account has used">
|
|
12
|
-
<div className="wp-chart-head">
|
|
13
|
-
<span>Agent usage</span>
|
|
14
|
-
<span className={usage.fault === null ? 'wp-mut' : 'wp-bad'}>{usage.fault ?? readWords(usage, now)}</span>
|
|
15
|
-
</div>
|
|
16
|
-
{usage.limits.map((l) => (
|
|
17
|
-
<div key={l.label} className="wp-usage-limit">
|
|
18
|
-
<div className="wp-usage-head"><span>{l.label}</span><strong>{usedWords(l)}</strong></div>
|
|
19
|
-
<div className="wp-usage-bar" role="img" aria-label={`${usedWords(l)}${l.pacePercent === null ? '' : `, pace line at ${l.pacePercent.toFixed(1)}%`}`}>
|
|
20
|
-
<span className="wp-usage-used" style={{ width: `${Math.min(100, Math.max(0, l.usedPercent))}%` }} />
|
|
21
|
-
{l.pacePercent === null ? null : <span className="wp-usage-pace" style={{ left: `${Math.min(100, Math.max(0, l.pacePercent))}%` }} />}
|
|
22
|
-
</div>
|
|
23
|
-
<div className="wp-mut wp-usage-detail">{limitDetail(l, now)}</div>
|
|
24
|
-
</div>
|
|
25
|
-
))}
|
|
26
|
-
</section>
|
|
27
|
-
);
|
|
28
|
-
}
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* WHAT THE AGENTS' ACCOUNT HAS USED OF EACH OF ITS LIMITS, in words: generic to any project whose workflows call agents
|
|
3
|
-
* on an account with usage limits. A project gives the figures (`AgentUsage`); every time is written here, on the reader's
|
|
4
|
-
* device, in its own clock. Pure, with no React and no JSX, so a test reads it without a page.
|
|
5
|
-
*/
|
|
6
|
-
import { localTime, whenAgo } from '../views/format';
|
|
7
|
-
|
|
8
|
-
/** One limit of the account: a week's, a 5-hour window's. */
|
|
9
|
-
export interface UsageLimit {
|
|
10
|
-
/** Its name in the project's words: "Week", "5-hour window". */
|
|
11
|
-
readonly label: string;
|
|
12
|
-
readonly usedPercent: number;
|
|
13
|
-
/** When it starts again, unix seconds; none where the account does not say. */
|
|
14
|
-
readonly resetsAt: number | null;
|
|
15
|
-
/** Where use would stand now if it were spread evenly to the reset; none where no pace is kept for it. */
|
|
16
|
-
readonly pacePercent: number | null;
|
|
17
|
-
/** When it runs out at the rate so far, unix seconds; none where that is not worked out. */
|
|
18
|
-
readonly runsOutAt: number | null;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
export interface AgentUsage {
|
|
22
|
-
readonly limits: ReadonlyArray<UsageLimit>;
|
|
23
|
-
/** When the figures were read from the account, unix seconds; none before a first reading. */
|
|
24
|
-
readonly readAt: number | null;
|
|
25
|
-
/** Why the figures are not current, in words (a reading failed, or is late); none while they are. */
|
|
26
|
-
readonly fault: string | null;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
/** When a limit runs out at the rate so far, against its reset. */
|
|
30
|
-
const forecast = (l: UsageLimit, now: number): string | null => {
|
|
31
|
-
if (l.runsOutAt === null || l.resetsAt === null) return null;
|
|
32
|
-
if (l.runsOutAt >= l.resetsAt) return 'at this rate it lasts to the reset';
|
|
33
|
-
return `at this rate it runs out ${localTime(l.runsOutAt, now)}, ${Math.round((l.resetsAt - l.runsOutAt) / 3600)} h before the reset`;
|
|
34
|
-
};
|
|
35
|
-
|
|
36
|
-
/** A limit's figure: "41% used". */
|
|
37
|
-
export const usedWords = (l: Pick<UsageLimit, 'usedPercent'>): string => `${Math.round(l.usedPercent)}% used`;
|
|
38
|
-
|
|
39
|
-
/** What stands beside a limit's figure: its pace line, its reset and when it runs out, each only where known. */
|
|
40
|
-
export const limitDetail = (l: UsageLimit, now: number): string => [
|
|
41
|
-
l.pacePercent === null ? null : `pace line ${l.pacePercent.toFixed(1)}%`,
|
|
42
|
-
l.resetsAt === null ? null : `resets ${localTime(l.resetsAt, now)}`,
|
|
43
|
-
forecast(l, now),
|
|
44
|
-
].filter((x) => x !== null).join(' · ');
|
|
45
|
-
|
|
46
|
-
/** When the figures were read, or that none has been. */
|
|
47
|
-
export const readWords = (usage: Pick<AgentUsage, 'readAt'>, now: number): string =>
|
|
48
|
-
usage.readAt === null ? 'never read' : `read ${whenAgo(usage.readAt, now)}`;
|
|
@@ -1,148 +0,0 @@
|
|
|
1
|
-
/* The workflow platform's dashboard. Colours come from the host page's variables, with these where it has none. */
|
|
2
|
-
/*
|
|
3
|
-
* The host page's colours, light or dark as it is, with these where it has none. Muted text, edges and node borders are mixed
|
|
4
|
-
* from its foreground toward its background, so they keep strong contrast in either theme.
|
|
5
|
-
*/
|
|
6
|
-
.wp-page {
|
|
7
|
-
--wp-fg: var(--fg, #e9edf5); --wp-bg: var(--bg, #0f1218); --wp-node: var(--panel, #151a23);
|
|
8
|
-
--wp-dim: color-mix(in srgb, var(--wp-fg) 74%, var(--wp-bg)); --wp-line: color-mix(in srgb, var(--wp-fg) 18%, var(--wp-bg));
|
|
9
|
-
--wp-band: color-mix(in srgb, var(--wp-fg) 5%, var(--wp-bg)); --wp-edge: color-mix(in srgb, var(--wp-fg) 78%, var(--wp-bg)); --wp-node-line: color-mix(in srgb, var(--wp-fg) 40%, var(--wp-bg));
|
|
10
|
-
--wp-warn: var(--warn, #e2574c); --wp-ok: var(--ok, #49c57f);
|
|
11
|
-
}
|
|
12
|
-
.wp-line { margin: 6px 0; }
|
|
13
|
-
.wp-mut { color: var(--wp-dim); }
|
|
14
|
-
.wp-bad { color: var(--wp-warn); }
|
|
15
|
-
.wp-r { text-align: right; white-space: nowrap; }
|
|
16
|
-
.wp-h4 { font-size: 11px; color: var(--wp-dim); margin: 12px 0 2px; font-weight: normal; }
|
|
17
|
-
.wp-count { color: var(--wp-ok); }
|
|
18
|
-
.wp-tablewrap { overflow-x: auto; }
|
|
19
|
-
.wp-table { border-collapse: collapse; width: 100%; margin: 4px 0; }
|
|
20
|
-
.wp-table th { color: var(--wp-dim); font-weight: normal; text-align: left; padding: 2px 8px 2px 0; border-bottom: 1px solid var(--wp-line); }
|
|
21
|
-
.wp-table td { padding: 2px 8px 2px 0; vertical-align: top; }
|
|
22
|
-
.wp-total td { border-top: 1px solid var(--wp-line); }
|
|
23
|
-
.wp-limit { display: inline-flex; gap: 4px; align-items: baseline; }
|
|
24
|
-
.wp-limit button { background: none; color: var(--wp-fg); border: 1px solid var(--wp-line); border-radius: 3px; padding: 0 6px; cursor: pointer; font: inherit; }
|
|
25
|
-
.wp-limit button:disabled { color: var(--wp-dim); cursor: default; }
|
|
26
|
-
.wp-limits { width: auto; border-collapse: collapse; margin-top: 4px; font-size: 11.5px; line-height: 1.6; }
|
|
27
|
-
.wp-limits td { padding: 0 10px 0 0; border: 0; background: none; vertical-align: baseline; }
|
|
28
|
-
.wp-limits td:last-child { display: flex; flex-wrap: wrap; gap: 2px 8px; align-items: baseline; }
|
|
29
|
-
.wp-limits .wp-limits-label { white-space: nowrap; color: var(--wp-dim); }
|
|
30
|
-
.wp-app-settings { margin: 4px 0; }
|
|
31
|
-
|
|
32
|
-
.wp-h3 { font-size: 13px; margin: 4px 0; }
|
|
33
|
-
/* The queues' chart: small type, thin lines. */
|
|
34
|
-
.wp-chart { margin: 14px 0 6px; }
|
|
35
|
-
.wp-chart-head { display: flex; flex-wrap: wrap; gap: 4px 12px; align-items: baseline; font-size: 12px; }
|
|
36
|
-
.wp-chart-choose summary { cursor: pointer; color: var(--wp-dim); }
|
|
37
|
-
.wp-chart-box { width: 100%; overflow: hidden; }
|
|
38
|
-
|
|
39
|
-
.wp-node-status { display: flex; flex-wrap: wrap; gap: 2px 10px; align-items: baseline; margin-top: 4px; font-size: 11px; }
|
|
40
|
-
/* A queue's bar: segments told apart by lightness, and every count also in words below it. */
|
|
41
|
-
.wp-queue { margin-top: 5px; }
|
|
42
|
-
.wp-bar { display: flex; height: 7px; border-radius: 2px; overflow: hidden; background: var(--wp-line); }
|
|
43
|
-
.wp-seg-done { background: var(--wp-ok); }
|
|
44
|
-
.wp-seg-running { background: var(--wp-fg); }
|
|
45
|
-
.wp-seg-queued { background: color-mix(in srgb, var(--wp-fg) 50%, var(--wp-bg)); }
|
|
46
|
-
.wp-seg-rest { background: color-mix(in srgb, var(--wp-fg) 28%, var(--wp-bg)); }
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
/* A queue's tasks as a column addition: each category's count right-aligned in one column of tabular figures, one plus
|
|
50
|
-
sign beside the last addend, a rule under the addends, and the total beneath in the same column. */
|
|
51
|
-
/* Its own width and no line of its own but the one rule, whatever the host page gives its tables. */
|
|
52
|
-
.wp-sum { width: auto; border-collapse: collapse; margin-top: 5px; font-size: 11.5px; line-height: 1.4; font-variant-numeric: tabular-nums; color: var(--wp-fg); }
|
|
53
|
-
.wp-sum td { padding: 0; border: 0; white-space: nowrap; background: none; }
|
|
54
|
-
.wp-sum .wp-sum-plus { width: 1ch; font-weight: 600; }
|
|
55
|
-
.wp-sum .wp-sum-n { text-align: right; min-width: 5ch; padding-left: 3ch; }
|
|
56
|
-
.wp-sum .wp-sum-label { padding-left: 3ch; }
|
|
57
|
-
.wp-sum-total .wp-sum-plus, .wp-sum-total .wp-sum-n { border-top: 2px solid var(--wp-fg); }
|
|
58
|
-
.wp-sum-total td { font-weight: 600; padding-top: 1px; }
|
|
59
|
-
|
|
60
|
-
/* The drill-down: the breadcrumb of the workflows opened, then one workflow's own steps, each a row with its kind in words. */
|
|
61
|
-
.wp-crumbs { display: flex; flex-wrap: wrap; gap: 2px 8px; align-items: baseline; margin: 12px 0 2px; font-size: 13px; }
|
|
62
|
-
/* The path reads as navigation, labelled as the path, in the body's size: the title below names the page. */
|
|
63
|
-
.wp-crumbs-label { color: var(--wp-dim); }
|
|
64
|
-
.wp-crumbs a { color: var(--wp-fg); text-decoration: underline; padding: 6px 0; }
|
|
65
|
-
.wp-crumb-sep { color: var(--wp-dim); }
|
|
66
|
-
.wp-crumb-here { color: var(--wp-fg); }
|
|
67
|
-
.wp-title { font-size: 18px; font-weight: 600; margin: 4px 0 8px; display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: baseline; }
|
|
68
|
-
.wp-drill-source { font-size: 11px; font-weight: normal; }
|
|
69
|
-
.wp-others { font-size: 12.5px; }
|
|
70
|
-
.wp-drill-status { margin: 6px 0 10px; font-size: 12px; }
|
|
71
|
-
/* The kind is words in a plain outline: nothing about it is told by colour. */
|
|
72
|
-
.wp-kind { border: 1px solid var(--wp-node-line); border-radius: 3px; padding: 0 5px; font-size: 11px; white-space: nowrap; }
|
|
73
|
-
|
|
74
|
-
/* Tasks over time: the key under the chart, a numbered line of words per chart line, and the table lines are chosen in. */
|
|
75
|
-
.wp-chart-axis { margin: 0 0 2px; font-size: 11px; }
|
|
76
|
-
.wp-chart-key { margin: 2px 0 6px; padding-left: 22px; font-size: 11.5px; line-height: 1.5; font-variant-numeric: tabular-nums; }
|
|
77
|
-
/* The sample of its line, at its own size whatever the host page gives its drawings. */
|
|
78
|
-
.wp-chart-key svg { display: inline-block; width: 26px; height: 8px; vertical-align: middle; margin: 0 6px 0 0; }
|
|
79
|
-
.wp-chart-choose { font-size: 12px; }
|
|
80
|
-
.wp-choose { border-collapse: collapse; font-size: 11.5px; font-variant-numeric: tabular-nums; margin: 4px 0; }
|
|
81
|
-
/* Its own type, whatever the host page gives its table headings: a workflow's name is read as written. */
|
|
82
|
-
.wp-choose th, .wp-choose td { padding: 3px 0 3px 10px; border-bottom: 1px solid var(--wp-line); vertical-align: baseline; background: none; text-transform: none; letter-spacing: 0; font-size: inherit; color: var(--wp-fg); }
|
|
83
|
-
.wp-choose thead th { color: var(--wp-dim); font-weight: normal; }
|
|
84
|
-
.wp-choose th[scope='row'], .wp-choose thead th:first-child { text-align: left; padding-left: 0; font-weight: normal; }
|
|
85
|
-
.wp-choose label { display: inline-flex; gap: 4px; align-items: center; justify-content: flex-end; white-space: nowrap; cursor: pointer; }
|
|
86
|
-
.wp-choose input { margin: 0; width: 14px; height: 14px; }
|
|
87
|
-
|
|
88
|
-
/* Why a workflow's blocked tasks are blocked: a count beside each reason in words. */
|
|
89
|
-
.wp-reasons { border-collapse: collapse; width: auto; margin: 2px 0 8px; font-size: 12px; font-variant-numeric: tabular-nums; }
|
|
90
|
-
.wp-reasons td { padding: 2px 0; border: 0; background: none; vertical-align: top; line-height: 1.35; }
|
|
91
|
-
.wp-reasons td:first-child { padding-right: 2ch; min-width: 5ch; font-weight: 600; }
|
|
92
|
-
|
|
93
|
-
/* The machine's controls: the CPU limit with its buttons, and the stop of everything. */
|
|
94
|
-
.wp-machine { display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: center; margin: 8px 0; font-size: 12.5px; }
|
|
95
|
-
.wp-machine .wp-limit button, .wp-stop { min-width: 30px; min-height: 30px; font-size: 14px; touch-action: manipulation; }
|
|
96
|
-
.wp-stop { background: none; color: var(--wp-fg); border: 1px solid var(--wp-node-line); border-radius: 4px; padding: 2px 10px; cursor: pointer; font: inherit; }
|
|
97
|
-
|
|
98
|
-
/* The spending limit: its setting with its buttons, then its verdict, a stale reading and the steps waiting, each a line of words. */
|
|
99
|
-
.wp-spending { margin: 8px 0; font-size: 12.5px; }
|
|
100
|
-
.wp-spending .wp-limit button { min-width: 30px; min-height: 30px; font-size: 14px; touch-action: manipulation; }
|
|
101
|
-
.wp-spending .wp-line { margin: 4px 0; }
|
|
102
|
-
|
|
103
|
-
/* The agents' account: a row a limit, its figure in words and a bar that only repeats it, the pace line a mark on the bar. */
|
|
104
|
-
.wp-usage { margin: 10px 0 14px; }
|
|
105
|
-
.wp-usage-limit { margin: 6px 0; font-size: 12px; }
|
|
106
|
-
.wp-usage-head { display: flex; gap: 10px; align-items: baseline; }
|
|
107
|
-
.wp-usage-bar { position: relative; height: 7px; border-radius: 2px; background: var(--wp-line); margin: 3px 0; max-width: 420px; }
|
|
108
|
-
.wp-usage-used { position: absolute; left: 0; top: 0; bottom: 0; background: var(--wp-ok); border-radius: 2px; }
|
|
109
|
-
.wp-usage-pace { position: absolute; top: -3px; bottom: -3px; width: 2px; background: var(--wp-fg); }
|
|
110
|
-
.wp-usage-detail { font-size: 11.5px; line-height: 1.35; }
|
|
111
|
-
|
|
112
|
-
/* Every button is large enough for a finger where a finger presses it: Alex reads the page on a phone. */
|
|
113
|
-
.wp-limit button { min-width: 30px; min-height: 30px; }
|
|
114
|
-
@media (max-width: 620px), (pointer: coarse) { .wp-page button, .wp-page .wp-limit button { min-width: 44px; min-height: 44px; } }
|
|
115
|
-
|
|
116
|
-
/* A workflow's steps: laid out by ELK, its boxes placed where it says, scrolled sideways inside its own box where it is wider than the page. */
|
|
117
|
-
.wp-dag-wrap { margin: 6px 0 14px; }
|
|
118
|
-
.wp-dag-scroll { overflow-x: auto; overflow-y: hidden; max-width: 100%; border: 1px solid var(--wp-line); border-radius: 6px; cursor: grab; }
|
|
119
|
-
.wp-dag-scroll .wp-node { cursor: auto; }
|
|
120
|
-
.wp-dag-scroll:focus-visible { outline: 2px solid var(--wp-fg); outline-offset: 2px; }
|
|
121
|
-
/* Its scrollbar always drawn, so a frame wider than the page shows it scrolls: an overlay one is hidden until one scrolls. */
|
|
122
|
-
.wp-dag-scroll::-webkit-scrollbar { height: 12px; }
|
|
123
|
-
.wp-dag-scroll::-webkit-scrollbar-track { background: var(--wp-band); }
|
|
124
|
-
.wp-dag-scroll::-webkit-scrollbar-thumb { background: var(--wp-node-line); border-radius: 6px; border: 2px solid var(--wp-band); }
|
|
125
|
-
@supports not selector(::-webkit-scrollbar) { .wp-dag-scroll { scrollbar-width: auto; scrollbar-color: var(--wp-node-line) var(--wp-band); } }
|
|
126
|
-
.wp-dag { position: relative; min-height: 40px; }
|
|
127
|
-
.wp-dag-edges { position: absolute; left: 0; top: 0; pointer-events: none; z-index: 0; }
|
|
128
|
-
.wp-node { box-sizing: border-box; position: relative; z-index: 1; background: var(--wp-node); border: 1px solid var(--wp-node-line); border-radius: 6px; padding: 7px 9px; width: 250px; font-size: 12px; color: var(--wp-fg); }
|
|
129
|
-
/* Steps that feed no other step, as many across as fit: four in the 1,026 px frame of a 1,280 px window, one on a phone. */
|
|
130
|
-
.wp-dag-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; margin-top: 6px; }
|
|
131
|
-
.wp-dag-grid .wp-node { width: auto; height: 100%; }
|
|
132
|
-
.wp-node-name { display: inline-block; color: var(--wp-fg); font-size: 13px; font-weight: 600; padding: 4px 0; margin-right: 6px; }
|
|
133
|
-
a.wp-node-name { text-decoration: underline; }
|
|
134
|
-
/* The run's start and end: small dashed boxes, so no step is read as one. */
|
|
135
|
-
.wp-node-end { width: 96px; padding: 4px 6px; border-style: dashed; color: var(--wp-dim); font-size: 11px; text-align: center; }
|
|
136
|
-
.wp-node .wp-line { margin: 4px 0 0; font-size: 11.5px; }
|
|
137
|
-
/* A step's description, whole and wrapped: Alex audits what each step does from it, on a phone too. */
|
|
138
|
-
.wp-node-what { margin: 4px 0 2px; font-size: 11.5px; line-height: 1.35; color: var(--wp-fg); overflow-wrap: anywhere; }
|
|
139
|
-
.wp-section { margin: 14px 0 0; }
|
|
140
|
-
.wp-passing { margin: 4px 0 8px; }
|
|
141
|
-
/* A step's time distribution (`time-distribution.tsx`): n, median and p90 in words, the bars, the axis key under them. */
|
|
142
|
-
.wp-times { margin: 6px 0 0; }
|
|
143
|
-
.wp-times-words { margin: 0 0 2px; font-size: 11.5px; font-variant-numeric: tabular-nums; }
|
|
144
|
-
.wp-times svg { display: block; overflow: visible; }
|
|
145
|
-
.wp-times-axis { font-size: 10.5px; color: var(--wp-dim); }
|
|
146
|
-
@media (max-width: 620px), (pointer: coarse) { a.wp-node-name { min-height: 44px; display: inline-flex; align-items: center; } }
|
|
147
|
-
/* What a step keeps and runs on (`setting-words.ts`): a line each, in words, with where it is set. */
|
|
148
|
-
.wp-node-settings { margin: 3px 0 2px; font-size: 11px; line-height: 1.35; color: var(--wp-dim); overflow-wrap: anywhere; }
|
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* WHERE A PAGE IS IN THE DRILL-DOWN: the top workflow, then each sub-workflow step opened below it. Alex, 2026-11-19:
|
|
3
|
-
* "ideally when i click into a workflow's step i get a drilldown into the sub workflow. then the [top] shows a breadcrumb
|
|
4
|
-
* list of the drilled down workflows".
|
|
5
|
-
*
|
|
6
|
-
* A path is the names of the sub-workflow steps opened, top first; the empty path is the top workflow. Each level has an
|
|
7
|
-
* address of its own, so a level can be linked to and a browser's back button goes up one. Pure, with no React and no
|
|
8
|
-
* JSX, so a test reads it without a page.
|
|
9
|
-
*/
|
|
10
|
-
import type { StepSummary, WorkflowView, WorkflowsView } from '../views/workflows-view';
|
|
11
|
-
|
|
12
|
-
/** One part of the breadcrumb: a workflow's name and the path that opens it. */
|
|
13
|
-
export interface Crumb {
|
|
14
|
-
readonly name: string;
|
|
15
|
-
readonly path: ReadonlyArray<string>;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
/** The level a path opens: its breadcrumb, its steps, and its workflow (none where the top is not declared). */
|
|
19
|
-
export interface DrillLevel {
|
|
20
|
-
readonly crumbs: ReadonlyArray<Crumb>;
|
|
21
|
-
readonly name: string;
|
|
22
|
-
readonly description: string;
|
|
23
|
-
readonly steps: ReadonlyArray<StepSummary>;
|
|
24
|
-
readonly workflow: WorkflowView | null;
|
|
25
|
-
/** The first part of the path that is no sub-workflow step of the level above it; none where every part opened. */
|
|
26
|
-
readonly notFound: string | null;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
/**
|
|
30
|
-
* The level `path` opens. A part that opens nothing stops there: the level above it is shown, and the part is named. A path
|
|
31
|
-
* that begins with the top workflow's own name (`/workflows/Decompile game/Match the original`) opens what follows it, and
|
|
32
|
-
* its links are the path without it: the top's address is `/`.
|
|
33
|
-
*/
|
|
34
|
-
export const drillLevel = (view: Pick<WorkflowsView, 'top' | 'workflows' | 'outermost' | 'system'>, asked: ReadonlyArray<string>): DrillLevel => {
|
|
35
|
-
const path = asked[0] === view.top.name && !view.top.steps.some((s) => s.name === asked[0]) ? asked.slice(1) : asked;
|
|
36
|
-
const workflows = new Map(view.workflows.map((w) => [w.name, w]));
|
|
37
|
-
let level: DrillLevel = { crumbs: [{ name: view.top.name, path: [] }], name: view.top.name, description: view.top.description, steps: view.top.steps, workflow: workflows.get(view.top.name) ?? null, notFound: null };
|
|
38
|
-
// A path may begin at one of the other workflows no workflow has as a step, a top of its own: the app's, or the platform's.
|
|
39
|
-
const otherTop = path[0] === undefined || level.steps.some((s) => s.name === path[0]) || ![...view.outermost, ...view.system].includes(path[0]) ? undefined : workflows.get(path[0]);
|
|
40
|
-
if (otherTop !== undefined) level = { crumbs: [{ name: otherTop.name, path: [otherTop.name] }], name: otherTop.name, description: otherTop.description, steps: otherTop.steps, workflow: otherTop, notFound: null };
|
|
41
|
-
for (const [i, part] of path.entries()) {
|
|
42
|
-
if (i === 0 && otherTop !== undefined) continue;
|
|
43
|
-
const step = level.steps.find((s) => s.name === part && s.workflow !== null);
|
|
44
|
-
const workflow = step === undefined || step.workflow === null ? undefined : workflows.get(step.workflow);
|
|
45
|
-
if (workflow === undefined) return { ...level, notFound: part };
|
|
46
|
-
level = { crumbs: [...level.crumbs, { name: part, path: path.slice(0, i + 1) }], name: workflow.name, description: workflow.description, steps: workflow.steps, workflow, notFound: null };
|
|
47
|
-
}
|
|
48
|
-
return level;
|
|
49
|
-
};
|
|
50
|
-
|
|
51
|
-
/**
|
|
52
|
-
* A WORKFLOW AND EVERY WORKFLOW UNDER IT, AT ANY DEPTH, through its steps that are workflows, each once, the workflow first
|
|
53
|
-
* and the rest in the order its steps reach them: what its tasks over time are drawn from. On Decompile game's page, only
|
|
54
|
-
* its own steps were read, its parts, none of which records tasks, and Decompile, which does, two levels down, was missed. Pure.
|
|
55
|
-
*/
|
|
56
|
-
export const workflowsUnder = (view: Pick<WorkflowsView, 'workflows'>, workflow: string): ReadonlyArray<WorkflowView> => {
|
|
57
|
-
const byName = new Map(view.workflows.map((w) => [w.name, w]));
|
|
58
|
-
const out: WorkflowView[] = [];
|
|
59
|
-
const visit = (name: string) => {
|
|
60
|
-
const w = byName.get(name);
|
|
61
|
-
if (w === undefined || out.includes(w)) return;
|
|
62
|
-
out.push(w);
|
|
63
|
-
for (const s of w.steps) if (s.workflow !== null) visit(s.workflow);
|
|
64
|
-
};
|
|
65
|
-
visit(workflow);
|
|
66
|
-
return out;
|
|
67
|
-
};
|
|
68
|
-
|
|
69
|
-
/** What a step is and how it runs, in the words its row shows: a sub-workflow step says only that, its own steps say how they run. */
|
|
70
|
-
export const kindWords = (step: Pick<StepSummary, 'kind' | 'runs'>): string => (step.runs === null ? step.kind : `${step.kind} · ${step.runs}`);
|
package/src/dashboard/index.tsx
DELETED
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
/** The workflow platform's dashboard: React components for any project's workflows, and how they write figures. */
|
|
2
|
-
export { usePolledJson, WorkflowsDashboard, type LimitName, type SetLimit, type SetSetting, type WorkflowsDashboardProps, type WorkflowsPageData } from './workflows-dashboard';
|
|
3
|
-
export type { AgentUsage, UsageLimit } from './agent-usage';
|
|
4
|
-
export { clockTime, compact, duration, localTime, whenAgo } from '../views/format';
|