@jive-sh/workflow-platform 0.6.3 → 0.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (89) hide show
  1. package/README.md +182 -42
  2. package/dist/budget-states.js +1 -1
  3. package/dist/budget-states.js.map +1 -1
  4. package/dist/dashboard/dashboard.css +42 -28
  5. package/dist/dashboard/drilldown.js +35 -4
  6. package/dist/dashboard/drilldown.js.map +1 -1
  7. package/dist/dashboard/run-doing-words.js +29 -0
  8. package/dist/dashboard/run-doing-words.js.map +1 -0
  9. package/dist/dashboard/setting-words.js +18 -0
  10. package/dist/dashboard/setting-words.js.map +1 -0
  11. package/dist/dashboard/spending-words.js +2 -10
  12. package/dist/dashboard/spending-words.js.map +1 -1
  13. package/dist/index.js +76 -13
  14. package/dist/index.js.map +1 -1
  15. package/dist/keep-running.js +4 -2
  16. package/dist/keep-running.js.map +1 -1
  17. package/dist/pick-wakes.js +2 -2
  18. package/dist/retention.js +59 -0
  19. package/dist/retention.js.map +1 -0
  20. package/dist/settings.js +88 -0
  21. package/dist/settings.js.map +1 -0
  22. package/dist/spending-limit.js +15 -21
  23. package/dist/spending-limit.js.map +1 -1
  24. package/dist/step-times.js +114 -0
  25. package/dist/step-times.js.map +1 -0
  26. package/dist/steps.js +399 -114
  27. package/dist/steps.js.map +1 -1
  28. package/dist/storage/agent-claims.js +3 -0
  29. package/dist/storage/agent-claims.js.map +1 -0
  30. package/dist/storage/budgets.js +40 -4
  31. package/dist/storage/budgets.js.map +1 -1
  32. package/dist/storage/engine-records.js +26 -10
  33. package/dist/storage/engine-records.js.map +1 -1
  34. package/dist/storage/sqlite-store.js +198 -20
  35. package/dist/storage/sqlite-store.js.map +1 -1
  36. package/dist/storage/task-store.js +11 -5
  37. package/dist/storage/task-store.js.map +1 -1
  38. package/dist/system-workflows.js +54 -0
  39. package/dist/system-workflows.js.map +1 -0
  40. package/dist/tasks.js +49 -24
  41. package/dist/tasks.js.map +1 -1
  42. package/dist/views/runs-now.js +80 -38
  43. package/dist/views/runs-now.js.map +1 -1
  44. package/dist/views/step-graph.js +6 -1
  45. package/dist/views/step-graph.js.map +1 -1
  46. package/dist/views/workflows-view.js +29 -23
  47. package/dist/views/workflows-view.js.map +1 -1
  48. package/package.json +1 -1
  49. package/src/budget-states.ts +2 -3
  50. package/src/dashboard/dashboard.css +42 -28
  51. package/src/dashboard/drilldown.ts +32 -5
  52. package/src/dashboard/index.tsx +1 -1
  53. package/src/dashboard/limits-and-runs.tsx +191 -0
  54. package/src/dashboard/queue-bar.tsx +30 -11
  55. package/src/dashboard/queue-chart.tsx +1 -2
  56. package/src/dashboard/run-doing-words.ts +41 -0
  57. package/src/dashboard/setting-words.ts +30 -0
  58. package/src/dashboard/spending-limit-control.tsx +5 -8
  59. package/src/dashboard/spending-words.ts +5 -23
  60. package/src/dashboard/time-distribution.tsx +61 -0
  61. package/src/dashboard/workflow-dag.tsx +247 -129
  62. package/src/dashboard/workflow-drilldown.tsx +13 -71
  63. package/src/dashboard/workflows-dashboard.tsx +345 -227
  64. package/src/index.ts +86 -16
  65. package/src/keep-running.ts +6 -4
  66. package/src/pick-wakes.ts +2 -2
  67. package/src/project.ts +12 -0
  68. package/src/retention.ts +90 -0
  69. package/src/settings.ts +171 -0
  70. package/src/spending-limit.ts +25 -42
  71. package/src/step-times.ts +151 -0
  72. package/src/steps.ts +512 -135
  73. package/src/storage/agent-claims.ts +63 -0
  74. package/src/storage/budgets.ts +43 -4
  75. package/src/storage/engine-records.ts +28 -11
  76. package/src/storage/sqlite-store.ts +225 -32
  77. package/src/storage/step-records.ts +59 -7
  78. package/src/storage/task-store.ts +29 -29
  79. package/src/system-workflows.ts +70 -0
  80. package/src/tasks.ts +49 -24
  81. package/src/views/runs-now.ts +119 -51
  82. package/src/views/step-graph.ts +11 -2
  83. package/src/views/workflows-view.ts +80 -39
  84. package/src/workflow-dag.test.tsx +89 -0
  85. package/src/workflow-page.test.tsx +170 -0
  86. package/dist/views/workflow-flows.js +0 -53
  87. package/dist/views/workflow-flows.js.map +0 -1
  88. package/src/dashboard/step-graph.tsx +0 -106
  89. package/src/views/workflow-flows.ts +0 -97
package/README.md CHANGED
@@ -11,8 +11,8 @@ items. The platform does the rest the same way for every workflow:
11
11
  follow it. Nothing else defines a step.
12
12
  - **Workflows all the way down.** A workflow is a step of another through `defineSubWorkflow`: the step starts it as a run
13
13
  of its own and waits for it, the engine suspending the run above until it ends. One record in the workflow above names
14
- that run, its steps work on the item the run above works on, and its agent steps count against the agents' limit of the
15
- workflow at the top. The top of a project is one workflow, which a page enters at and drills down from.
14
+ that run, its steps work on the item the run above works on, and its run's agent claim counts against the agents' limit
15
+ of the workflow at the top. The top of a project is one workflow, which a page enters at and drills down from.
16
16
  - **Every step is measured, never self-reported.** Time, tokens, CPU (its own and its child processes'), peak memory,
17
17
  files written and compiles go on one record per step run, per item.
18
18
  - **Every item is a task**, with an append-only log of notes and one of four statuses read from them: queued, in
@@ -27,31 +27,40 @@ items. The platform does the rest the same way for every workflow:
27
27
  - **A run limit on every workflow, and an agents' limit where it has agent steps.** Every start of every workflow, however it
28
28
  starts (a timer, its inputs changing, its queue, a request), passes its run limit (`steps.ts` `gatedExecute`): a new run
29
29
  starts only while fewer are going, 0 starts none, and none set is no limit, or for a workflow with an agent step and a list
30
- of work its agents' limit. That kind of workflow also keeps its run limit's number of runs going, and at most its agents'
31
- limit of them are in an agent step at once: a run at an agent step whose agents are all in use waits there, its task kept and its
32
- record saying so, until one frees. At 0 agents nothing gets past a first agent step: a run with a task ends there, its task marked as needing an agent (below). Setting either limit
30
+ of work its agents' limit. That kind of workflow also keeps its run limit's number of runs going, and the runs under it
31
+ hold at most its agents' limit of agents at once (below). Setting either limit
33
32
  (`runPlanChanged`) has the run planner plan again at once. The run limit is the one way to stop a workflow: at 0 no run
34
33
  of it starts, and a run already going ends before it takes on more work (`steps.ts` `standDownIfSurplus`). In a workflow
35
34
  its budget keeps going that is before an agent step: the run still picks and tests with no agent, and ends at a Pick
36
35
  that finds nothing. In any other it is before a Pick, before an agent step, or at its first step when the engine
37
36
  resumes it after a restart. A step between those still runs, so what an agent step just made is checked and recorded.
38
37
  There is no pause beside it.
39
- - **A task that needs an agent no run can have gives its run slot up** (`steps.ts` `untilAgentSlot`). Where no agent
40
- can be had (its workflow's agents' limit is 0, or the spending limit holds), a run with a task ends at its agent step
41
- instead of waiting there: its task goes to the back of its queue, marked "needs an agent" with why in words, and its
42
- slot goes to work that needs none. Its Pick passes over marked tasks while no agent can be had, and takes them in queue
43
- order once one can. Something new from outside the workflow clears the mark (a return to its queue, a move to the
44
- front, any note by a person or another workflow), and so do an agent step that ran on the task and its final check
45
- passing. A run with no task, or one waiting for an agent another run holds, still waits. The status table's queued row
46
- says how many need agent, "804 queued (12 need agent)", and an open workflow lists them by reason.
38
+ - **A run claims its agents at its first agent step and holds them to its end** (`steps.ts` `claimAgentsOrEnd`; Alex, 2026-11-22: "a subworkflow write C
39
+ claims one on decompiles agents so while that task's own workflow is doing all these different things ... decompile is
40
+ down one agent"). A workflow with an agent step of its own claims 1 agent, or the number it declares (`agentsClaimed`),
41
+ at a run's first agent step, against the agents' limit of the workflow at the top of the run: Write C's against
42
+ Decompile's. Its steps before that (a Pick, a Test with no agent) run with none, so a run at 0 agents still does what
43
+ needs no agent and reaches its agent step with its task named. From then it holds the claim through every step, agent and deterministic, and through a handover or a restart, until the run ends, and its
44
+ agent steps never wait for or take an agent of their own. A run under a run that holds a claim takes none. Each claim is
45
+ a row of `agent_claims` (`storage/agent-claims.ts`: its start, end and outcome), and counts only while the run at its top
46
+ is unfinished in the engine, so a claim whose end was never written cannot hold an agent once that run is gone.
47
+ - **A run that can have no agent never waits: it gives its task back and ends.** Where no claim is free (every agent the
48
+ limit allows is claimed, the limit is 0, or the spending limit holds), the run marks its task "needs an agent" with why
49
+ in words, which puts it at the back of its queue, and ends, giving its run slot to the next task. A run already holding a
50
+ claim does the same before its next agent call once the limit is set to 0 or the spending limit holds; a limit lowered
51
+ to above 0 ends no run. Its Pick passes over marked tasks while no agent is free, and takes them in queue order once a
52
+ claim ends, which wakes it. Something new from outside the workflow clears the mark (a return to its queue, a move to
53
+ the front, any note by a person or another workflow), and so do a run on the task taking an agent and its final check
54
+ passing. A run with no task ends the same way, unmarked, and its trigger tries again. The status table's queued row says
55
+ how many need agent, "804 queued (12 need agent)", and an open workflow lists them by reason.
47
56
  - **One spending limit for the whole account: "agents stop at X% of the week"** (`spending-limit.ts`, 95 when none is
48
- set). While the newest good reading of the week is at or past X, every agent step of every workflow waits before its
49
- agent call, as at an agents' limit of 0, its record saying "waits: the week's use is N%, at or past the spending limit of
50
- X%", and goes on by itself once a reading is below X. It judges the account's week, not the step records' tokens,
57
+ set). While the newest good reading of the week is at or past X, no run of any workflow is given an agent claim, and a
58
+ run holding one ends before its next agent call, as at an agents' limit of 0, its task marked "needs an agent: the week's
59
+ use is N%, at or past the spending limit of X%"; runs claim again once a reading is below X. It judges the account's week, not the step records' tokens,
51
60
  because the week also counts what no workflow runs (agent threads run by hand). The project gives the reading
52
61
  (`WorkflowProject.weekUsage`) and tells the platform of each one it takes (`platform.spending.readingTaken`); a project
53
62
  that gives none has no spending limit. A failed or old reading never lifts it: the limit keeps the newest good reading's
54
- verdict, however old, and the page says the reading is stale and why. An unreadable one holds every agent step.
63
+ verdict, however old, and the page says the reading is stale and why. An unreadable one holds the same way.
55
64
  - **Each queue's counts, kept current.** When a queue may have changed (a wake of its Picks, or a Pick claiming an item),
56
65
  the process that runs the workflows counts it within 5 seconds and stores each status's count where it moved
57
66
  (`queue-counts.ts`, `queue_counts`). A page reads the newest rows and their history and never counts.
@@ -90,7 +99,7 @@ It runs today inside the aoe2-in-browser decompilation service, its first projec
90
99
  import { createWorkflowPlatform, sqliteStorage, RUN_STARTS, RUN_ENDS } from '@jive-sh/workflow-platform';
91
100
  import { Effect, Schema } from 'effect';
92
101
 
93
- const platform = createWorkflowPlatform<'main', never>({
102
+ const platform = createWorkflowPlatform<never>({
94
103
  project: {
95
104
  sourceRoot: ROOT,
96
105
  tree: { root: ROOT, snapshots: `${ROOT}/local/step-files`, notTree: ['local'] },
@@ -107,7 +116,7 @@ const { defineStep, defineWorkflow } = platform.steps;
107
116
  const COUNT = defineStep({ name: 'Count', runs: 'deterministic', shared: true, description: 'Counts the files.', at: import.meta.path, success: Schema.Number });
108
117
 
109
118
  export const CountFiles = defineWorkflow({
110
- phase: 'main', item: null, description: 'Counts the files.', at: import.meta.path, steps: () => [COUNT],
119
+ item: null, description: 'Counts the files.', at: import.meta.path, steps: () => [COUNT],
111
120
  graph: () => [{ from: RUN_STARTS, to: COUNT.name, when: 'each run' }, { from: COUNT.name, to: RUN_ENDS, when: 'always' }],
112
121
  })('Count files', { payload: { turn: Schema.Number }, idempotencyKey: ({ turn }) => String(turn), success: Schema.Number, error: Schema.String });
113
122
 
@@ -150,9 +159,10 @@ Each module's inputs come from `createWorkflowPlatform` (`src/index.ts`), which
150
159
  | `storage/step-records.ts` | The step records' interface: one record per step run, and every read of them | n/a | `StepRecords`, its row types, `noSpend`, `StepScope` |
151
160
  | `storage/task-store.ts` | The task store's interface: tasks, their append-only notes, their listing | n/a | `TaskStore`, `TaskNote`, `TaskRef`, `Listed` |
152
161
  | `storage/engine-records.ts` | Which runs the engine has not finished, from its `cluster_*` tables | the engine's file | `EngineRecords`, `sqliteEngineRecords`, `ensureEngineIndexes` |
153
- | `storage/budgets.ts` | Each workflow's two limits: runs going and agents in an agent step; and the one spending limit | the file with `workflow_budgets` and `spending_limit` | `LimitStore`, `runLimit`, the limit SQL |
162
+ | `storage/budgets.ts` | Each workflow's two limits: runs going and agents its runs may hold; and the one spending limit | the file with `workflow_budgets` and `spending_limit` | `LimitStore`, `runLimit`, the limit SQL |
154
163
  | `spending-limit.ts` | The spending limit: the rule, its verdict for a page, its wake on a reading, the one way to set it | limits, the project's `WeekUsage`, wakes | `makeSpendingLimit` (also `platform.spending`), `judgeSpending`, `spendingWait` |
155
164
  | `storage/input-records.ts` | What each run ran on and how it ended; the check of re-runs on unchanged inputs | runs a trigger started | `InputRecords`, `rerunsOnUnchangedInputs` |
165
+ | `storage/agent-claims.ts` | Each run's claim on its top workflow's agents: taken at its first agent step, ended as it ends, with its outcome | `agent_claims` in the platform's database | `AgentClaims`, `claimsCounting` |
156
166
  | `reasons.ts` | Why a step ended as it did, in a line, read from its result | a step's result | `standardReason`, `oneLine` |
157
167
  | `storage/sqlite-store.ts` | Step records, tasks and input runs in the project's database | its file, the project's processes, the file they moved from | `sqliteStore`, `applyStepRecordsSchema` |
158
168
  | `storage/move-store.ts` | The live move of the step records and tasks, and of the engine's records, from files of their own into the project's database | both files | `moveRecordsInto`, `catchUpMove`, `engineFileFree`, `moveEngineInto`, `movedInto` |
@@ -162,19 +172,22 @@ Each module's inputs come from `createWorkflowPlatform` (`src/index.ts`), which
162
172
  | `step-usage.ts` | Which step a piece of code works for, so its processes' usage reaches it | the step-record variable | `CurrentStepUsage` |
163
173
  | `step-files.ts` | What an agent step changed in the tree, and taking it back | the project's tree | `StepFiles`, `filesChanged` |
164
174
  | `tasks.ts` | The task rules (the four statuses, first-in-first-out order and the reorder call, the blocking a Pick runs) and the task writes | task store, engine records, step records, wakes, texts | `Tasks`, `queueOrder`, `standardBlock`, `PendingWork` |
165
- | `steps.ts` | `defineWorkflow`, `defineStep`, `defineItemTest`: running and recording every step | every store above | `Steps` |
175
+ | `settings.ts` | What every workflow and step inherits, set once on the app (`WorkflowProject.settings`) and overridable on any workflow or step below: how long its runs' records are kept (7 days where nothing sets it) and its agent steps' model | declarations, the app's settings | `stepSetting`, `workflowSetting`, `appSetting`, `InheritedSettings` (also `platform.settings`) |
176
+ | `steps.ts` | `defineWorkflow`, `defineStep`, `defineItemTest`: running and recording every step; an agent step's `AgentStep.model` | every store above | `Steps` |
177
+ | `retention.ts` | Deletes each finished run's records, and each task that was a run, once past what its steps keep; the platform's Retention runs it | declarations, the app's settings, step records, task store, engine records | `makeRetention` |
178
+ | `system-workflows.ts` | The platform's own workflows, which every app has and none defines (Retention, hourly): defined before the app's, refused to the app to define or hold as a step, their schedules the app's | the definer, retention, the app's schedules | `makeSystemWorkflows` (also `platform.system`), `SYSTEM_WORKFLOW_SCHEDULES` |
166
179
  | `keep-running.ts` | The trigger's plan: how many runs of each budgeted workflow to start | declarations, budgets, runs going | `planRunStarts`, `oneTurnAtATime` |
167
180
  | `budget-states.ts` | Each budget against the runs it has, for a page | budgets, runs | `workflowBudgetStates` |
168
181
  | `failure.ts` | A failure as one line of text | any failure | `describeFailure`, `startAndEnd` |
169
182
  | `cpu-limit/use.ts` | The CPU limit's arithmetic: room to start, what project work uses, what to pause | `ps` output, the pool's counts | `roomInThreads`, `readUse`, `pauseOrResume` |
170
183
  | `cpu-limit/limiter.ts` | The CPU limit: the slot pool, the line, readings of use, holding work to the limit, the one way to start a process | the project's facts (`CpuLimiterFacts`) | `makeCpuLimiter`, `CpuLimiter` |
171
184
  | `graph.ts` | A workflow's declared step graph and the check of a move against it; no dependencies, so a page can import it | declared edges, a run's last step | `StepEdge`, `edgeDeclared`, `RUN_STARTS`, `RUN_ENDS` |
172
- | `views/runs-now.ts` | Where each unfinished run is now: the step it is in or waits after, and what a waiting step waits on | unfinished runs, their newest step records, the phase order | `runsNow`, `PhaseRunsNow` |
185
+ | `views/runs-now.ts` | Where each unfinished run is now: the step it is in or waits after, and what a waiting step waits on | unfinished runs, their newest step records | `runsNow`, `WorkflowRunsNow` |
173
186
  | `views/step-funnel.ts` | For each step, the window's runs that reached it, stopped or finished there, and why most stopped | the window's step records and item outcomes | `stepFunnel` |
174
- | `views/step-graph.ts` | The declared graph with the window's runs on each edge, and the moves it does not declare | declarations, the window's moves | `workflowGraphs` |
187
+ | `views/step-graph.ts` | The declared graph (or, with none declared, the steps in their declared order) with the window's runs on each edge, and the moves it does not declare | declarations, the window's moves | `workflowGraphs`, `inOrder` |
175
188
  | `queue-counts.ts` | Each queue counted when it may have changed, and stored where a count moved | tasks, task store, wakes | `makeQueueCounts` (also `platform.queueCounts`) |
176
- | `views/workflows-view.ts` | The dashboard's two readings: every workflow (limits, queue, flows), and one workflow's figures (steps with their cost, graph, funnel) | task store, limits; step records, engine records | `buildWorkflowsView`, `buildWorkflowFigures` (also `platform.view`, `platform.figures`) |
177
- | `dashboard/` | React components for a project's page: `WorkflowsDashboard`, which a project gives its own header, phase names and controls; `dashboard.css` | the two readings and runs now, as JSON | `src/dashboard/index.tsx`, named by path from the host page |
189
+ | `views/workflows-view.ts` | The dashboard's two readings: every workflow (limits, queue, the top and the other outermost workflows), and one workflow's figures (steps with their cost, graph, funnel) | task store, limits; step records, engine records | `buildWorkflowsView`, `buildWorkflowFigures` (also `platform.view`, `platform.figures`) |
190
+ | `dashboard/` | React components for a project's page: `WorkflowsDashboard`, which a project gives its own header and controls; `dashboard.css` | the two readings and runs now, as JSON | `src/dashboard/index.tsx`, named by path from the host page |
178
191
 
179
192
  `src/imports.test.ts` fails on any import from outside this package other than effect, Bun and Node (and, in a test, the
180
193
  SQL client it runs the engine on), and on a dashboard file importing anything but React, its own folder, `graph.ts`,
@@ -192,9 +205,67 @@ SQL client it runs the engine on), and on a dashboard file importing anything bu
192
205
  (`relayTo`, then `wake` there).
193
206
  - A task's inputs changed by anything but a note, a listing or one of its workflow's runs ending (another workflow's write,
194
207
  say) wake no waiting Pick: the next of those events reads them.
195
- - A run waiting at an agent step for an agent another run holds keeps its task for as long as it waits; a lease the project keeps on the item itself can
196
- run out meanwhile.
197
- - The scheduler's job ledger (which job turn is due) is still the first project's own.
208
+ - A claim lasts one run: Write C's rounds are each a run of it, so between two rounds, while Decompile's Byte check runs,
209
+ the agent is free and another run can claim it first; the round after then gives its task back, as no try.
210
+ - `agent_claims` is not in retention or the records export yet: its rows stay in the working database.
211
+ - The scheduler's job ledger (which job turn is due) is still the first project's own, so an app starts the platform's own
212
+ workflows on their schedules itself (below).
213
+
214
+ ## Agents claimed by a run, held to its end (2026-11-22)
215
+
216
+ A run of a workflow with an agent step claims its agents at its first agent step and holds them to its end, and a run that
217
+ can claim none gives its task back and ends: nothing waits for an agent any more (above). What a consumer changes:
218
+
219
+ - **`WorkflowStorage` has `claims`** (`storage/agent-claims.ts`): `sqliteStorage` gives it, in the `agent_claims` table the
220
+ store makes. `StepRecords` no longer has `runsInAgentStep` or `agentTakenUnder`.
221
+ - **`runsNow` takes `claims`**, the claims that count now (`platform.steps.agentClaimsNow()`). Its `RunDoing` kinds are
222
+ `holding an agent`, `in a step`, `waiting at a step`, `between steps` and `not started`: `with an agent`, `waiting for an
223
+ agent` and `held by the spending limit` are gone, and so is `StepRunsNow.heldBySpendingLimit`. `onAgents` is the agents
224
+ its runs hold.
225
+ - **The spending limit** gives `holdsAgents()` as why in words, or none; `SpendingHold`, `spendingWait`,
226
+ `isSpendingLimitWait`, `heldSteps` and `heldStepsWords` are gone, and `SpendingLimitControl` takes no `held`.
227
+ - **An agent step under a sub-workflow** is how a workflow does its work with no agent while none is free: Decompile has
228
+ none of its own, and its Write C and Judge claim about another file runs claim one each.
229
+ - **A mark clears** on the new note kind `a run took an agent for it` (`AGENT_TAKEN`); `an agent step ran` is read on
230
+ older notes. `defineWorkflow` takes `agentsClaimed` for a run that claims more than 1.
231
+
232
+ ## The platform's own workflows, and the app's settings (2026-11-22)
233
+
234
+ Alex, 2026-11-22: "retention is supposed to be configurable at the platform layer and something configurable for all
235
+ tasks. not a bespoke workflow that every implementation must define. perhaps there can be some notion of system workflows
236
+ at the top level which can be configured but not amended without changing the platform itself".
237
+
238
+ - **Every app has the platform's own workflows and defines none of them** (`system-workflows.ts`). `createWorkflowPlatform`
239
+ defines each before the app defines any of its own, so each is declared, measured, queued and shown like any workflow,
240
+ marked `system`. The first is **Retention**: one step, Prune, that runs `retention.prune` every hour and whose record
241
+ says what it deleted ("deleted 1,204 step records, 0 per-item parts of them, and 31 tasks that were runs with 62 notes").
242
+ - **The app configures them, never amends them.** It sets each one's schedule (`WorkflowProject.systemSchedules`), its run
243
+ limit (the limits table and the page's − / +, as for any workflow) and the settings it inherits. A workflow of the app
244
+ named like one, or holding one as a step (`defineWorkflowStep`, `defineSubWorkflow`), fails the app's start; the definer
245
+ the app gets (`platform.steps`) has no way to define one. Changing their steps is changing the platform.
246
+ - **The app's settings are the top level** (`WorkflowProject.settings`): `retentionDays`, `keepAtLeastRuns` and `model`, given
247
+ once, over the platform's defaults (7 days, 10,000 runs, no model), for every workflow and step, the platform's own
248
+ included. A workflow or step below still sets its own. A page says where each is set: "keeps 7 days, at least 10,000
249
+ runs (set on the app)".
250
+ - **Retention keeps each step's newest runs however old** (Alex, 2026-11-22: "a project might complete or stall but we
251
+ shouldn't lose run data in that case", "10k runs"): a step's records of a run go only once the run ended more than
252
+ `retentionDays` ago and it is none of that step's newest `keepAtLeastRuns` runs; a workflow whose tasks are its runs
253
+ keeps its newest that many tasks the same way. There is no most it keeps.
254
+ - **The retention settings are set while the app runs** (Alex: "like it needs to be configurable"): on the app, a workflow
255
+ or a step, from the page's − / + (`SetSetting`), stored with when (`workflow_settings`, `storage/budgets.ts`), a value
256
+ stored at a level winning over the code's value there, "default" putting it back. The model is set in code alone. The
257
+ project makes the table and serves the route, as for `workflow_budgets`; `platform.settings.changeRefusal` checks a change.
258
+ - **What an app wires once**, for every system workflow there is or will be: its engine runs `platform.system.layer` beside
259
+ its own workflows' layers, and its scheduler starts each of `platform.system.workflows` every `everySeconds`, first
260
+ `firstAfterSeconds` after its start, with `run(turn)` (it waits for the run) or `start(turn)`.
261
+ - **The page** shows them on each top-level page under "Platform workflows", after the workflow's own sections (every
262
+ workflow's page keeps the same sections), each said in words to be part of the platform, with its runs and its limits; a
263
+ system workflow's own page says the same under its title.
264
+ - **Every workflow's page has a Runs section and a Limits section** (`dashboard/limits-and-runs.tsx`; Alex: "i really want
265
+ to see all this on separate lines. the set limits controls and the current runs status"): Runs, a line for each state its
266
+ runs are in and their total, laid out as its tasks are; Limits, a line each for its run limit, its agents' limit, the
267
+ days it keeps and the runs it keeps at least, each with its − / + and where its value is set. Each step's box has its own
268
+ retention lines, and the page's header the app's.
198
269
 
199
270
  ## The dashboard
200
271
 
@@ -203,25 +274,33 @@ workflow's figures at a route of their own (`platform.figures(...)`), which the
203
274
  the process that runs its workflows it starts the queue counts once: `platform.queueCounts.record((count) => runtime.runPromise(count))`.
204
275
  It renders `WorkflowsDashboard` on a page of its own, which brings React. The page shows a workflow at a time
205
276
  (`src/dashboard/drilldown.ts`): it enters at the project's top workflow, a sub-workflow step opens that workflow's view,
206
- and a breadcrumb says where it is. The host routes each level's address back as `path`. A workflow's view draws:
207
-
208
- - its tasks as a column addition, `queued + in progress + blocked + done = total` (`src/dashboard/queue-table.ts`), its
209
- runs now and its two limits with − and +;
210
- - its tasks over time, each line one status as a percent of the workflow's tasks, chosen in a table with a row per
211
- workflow and a column per status (`src/dashboard/queue-chart.tsx`);
212
- - its own steps, each with what it is (step, check, sub-workflow) and how it runs (deterministic, agentic, classification) in
213
- words (`src/dashboard/workflow-drilldown.tsx`), and at the top the map of its steps: each workflow a box whose name opens
214
- it, with the arrows work takes between them (`src/dashboard/workflow-dag.tsx`, `src/views/workflow-flows.ts`);
215
- - while it is open: why its blocked tasks are blocked, what each step cost, its step graph and where its runs stopped.
216
-
217
- At the top it also draws what the project gives of its machine and its agents' account, each only where given: the CPU
277
+ and a breadcrumb says where it is. The host routes each level's address back as `path`. Every workflow, at every depth,
278
+ the top included, gets the same page (`WorkflowPage`), with these sections in this order whatever kind of workflow it is;
279
+ a section with nothing to show says so in a line:
280
+
281
+ - **Tasks**: its tasks as a column addition, `queued + in progress + blocked + done = total` (`src/dashboard/queue-table.ts`),
282
+ its runs now and its two limits with − and +. A workflow with no item on its own trigger has one task a run (below). One
283
+ run as a step of another (`defineSubWorkflow`) shows that workflow's calls of it, its tasks passing through
284
+ (`WorkflowFigures.passingThrough`); one made of workflows says its tasks are its steps', each counted under its own;
285
+ - **Steps**: its step graph (`src/dashboard/workflow-dag.tsx`), laid out by ELK, its declared graph or, where it declares
286
+ none, its steps in their declared order (`views/step-graph.ts` `inOrder`). Each step is a box headed by its name, with
287
+ what it is and how it runs in words and its description as text. A step that is a workflow links to that workflow's own
288
+ page and shows that workflow's tasks, runs and limits, or, where it has none of its own, this workflow's calls of it;
289
+ any other step shows its own calls in the window as an addition, `in progress + failed + done = calls` (its step
290
+ records: nothing records a task's status at a step), its runs in it now, and what its calls cost. Each edge carries its
291
+ condition and the window's runs beside its own line;
292
+ - **Tasks over time**: each line one status as a percent of a workflow's tasks, chosen in a table with a row for it and
293
+ each workflow among its steps (`src/dashboard/queue-chart.tsx`);
294
+ - **Blocked, by reason**, **Queued, needing an agent**, **What its runs gave** and **Where runs stopped**, read from its
295
+ own records while it is open.
296
+
297
+ Above it, the same on every page, it draws what the project gives of its machine and its agents' account, each only where given: the CPU
218
298
  limit with − and + (`setCpuLimit`, `cpu.threads`), the stop of everything and its resume (`stopEverything`, `resume`,
219
299
  `stopped`), and what the account has used of each of its limits (`usage`, `src/dashboard/agent-usage.ts`).
220
300
 
221
301
  On every level it draws the spending limit where the project reads its week (`view.spending`,
222
302
  `src/dashboard/spending-limit-control.tsx`): what it is set to with − and + (`setSpendingLimit`), the week's reading
223
- against it and whether it holds every agent step, why the reading is stale where it is, and which agent steps wait on it,
224
- each in words.
303
+ against it and whether it withholds every agent, and why the reading is stale where it is, each in words.
225
304
 
226
305
  ```tsx
227
306
  import { usePolledJson, WorkflowsDashboard, type WorkflowsPageData } from '@jive-sh/workflow-platform/dashboard';
@@ -239,6 +318,14 @@ release exports the main entry only, so a host names the dashboard's two files b
239
318
  `tsconfig.json`'s `paths`. It has no React of its own: add the package to `transpilePackages`, and alias `react` and `elkjs/lib/elk.bundled.js` to the
240
319
  app's copies (`aoe2-in-browser/decomp-dashboard/next.config.ts` does this).
241
320
 
321
+ ## 0.7.0 (2026-11-28): workflows made of workflows, agent claims, inherited settings
322
+
323
+ The last minor release of the 0.x line, which takes only fixes from here on (branch `v0`); 1.0.0 is the Convex
324
+ platform. It brings the changes described in the sections dated 2026-11-21 and 2026-11-22: workflows made of workflows
325
+ with no phases, agents claimed by a run and held to its end, the platform's own workflows and the app's settings, and
326
+ one dashboard page for every workflow. Breaking for a 0.6 caller: `phase` is gone from every declaration and view (see
327
+ "Workflows made of workflows, and no phases").
328
+
242
329
  ## A block for failed tries lapses once fewer count (0.6.3, 2026-11-28)
243
330
 
244
331
  A Pick returns a task it blocked for its failed tries to the queue once fewer than 10 count, as it returns one blocked for
@@ -253,6 +340,59 @@ that fails because a service outside it could not do the work fails with `Outsid
253
340
  and its outcome is no try. Claude's own usage-limit and rate-limit words in a failure are read the same way whatever
254
341
  error carries them, so outcomes recorded before 0.6.2 count right too: a task that had 9 tries and 2 such failures, and
255
342
  so was blocked, gets its tenth try without being returned to its queue. Nothing stored changes shape.
343
+ ## Workflows made of workflows, and no phases (2026-11-21)
344
+
345
+ One concept at every depth: a workflow is steps, and a step is code, an agent call or another workflow (Alex: "just one
346
+ fucking workflow that has steps some of which can be other workflows"). A project's top is a workflow it declares like
347
+ any other, and so is each grouping of workflows under it.
348
+
349
+ - **`steps.defineWorkflowStep(name)`** is a step that is another workflow on its own trigger (its queue, its inputs, a
350
+ timer): no run of the workflow above starts it, so its runs and limits stay its own. A workflow whose steps are all such
351
+ steps (`isMadeOfWorkflows`) has no runs of its own: its runs and agents now are its steps', added up (`runsNow`), it has
352
+ no limits, and its view says it starts on its steps (`StartsOn` `its steps`). `defineSubWorkflow` is unchanged: a step
353
+ whose workflow a run of the one above starts and waits for. `startedAsSteps` names those.
354
+ - **`steps.graphOfFeeds(steps)`** is the step graph of a workflow made of workflows, from `fedBy` at any depth under each step.
355
+ - **`platform.view({ now, top })`**: `top` is the name of the declared workflow a page enters at, and `phases` is gone.
356
+ `WorkflowsView.workflows` lists every workflow in the order defined (it was `groups`, by phase), and `outermost` names
357
+ the other workflows no workflow has as a step, which a page opens at their own names. `flows` is gone.
358
+
359
+ Phases are gone. `defineWorkflow` and `oneStepWorkflow` take no `phase`; `WorkflowDeclaration<R>`, `makeSteps<R>`,
360
+ `createWorkflowPlatform<R>` and `WorkflowPlatform<R>` lose their `Phase` parameter; `AssignedRun` and
361
+ `WorkflowBudgetState` lose `phase`, `WorkflowView` loses `phase` and `place`, and `runsNow` takes no `phases` and
362
+ returns one `WorkflowRunsNow` a workflow (`PhaseRunsNow` is gone). A project moves each group of its workflows into a
363
+ workflow made of them, and its top into one more.
364
+
365
+ One renderer: the map of workflows (`views/workflow-flows.ts`) is gone, and with it the store's `returnedBetween` and
366
+ `listedWaits`, which only it read. `WorkflowsDashboard` takes no `phaseLabel`. Nothing stored changes shape.
367
+
368
+ One page and one graph, the map's: every workflow's page has the same sections, and its steps are drawn by the map's
369
+ renderer and box (`dashboard/workflow-dag.tsx`, ELK), each step a box with its name, kind, description and bar; the bare
370
+ step graph (`dashboard/step-graph.tsx`) and the list of steps (`StepList`) are gone. A workflow that declares no graph has
371
+ its steps in their declared order (`inOrder`), so `WorkflowGraph.edges` is never empty for one with steps. A host keeps its
372
+ alias for `elkjs/lib/elk.bundled.js`.
373
+
374
+ One task a run: a workflow that works on no item, has runs of its own and runs on its own trigger (`steps.tasksAreRuns`)
375
+ gets a task for each run, its item the run's id (`tasks.runStarted`): in progress while the run goes, done when it
376
+ succeeds, blocked when it fails or stands down, with why (the step it failed at, or the stand-down's reason). A start its
377
+ run limit refuses leaves no run waiting, so none is queued. Every task is kept and read, as any workflow's are. Its
378
+ counts start at its first run after this change.
379
+
380
+ Each step's time distribution, over the current version of its workflow, from every task's data:
381
+
382
+ - **A workflow's version** (`steps.versionOf`) is a hash of the code a process loaded: its own file and each step's file (an
383
+ agent step's prompt included), a step that is a workflow counted by that workflow's version. Each step record carries
384
+ its run's version (`step_runs.version`, indexed with workflow and step); a run resumed under newer code keeps the version
385
+ of its first record. Whole files are hashed (`codeOf`), so any change in such a file is a new version; records from
386
+ before versions were recorded have none, and are no version's (`previousVersion` reads only versions).
387
+ - **One value per task per run** (`step-times.ts` `taskTimes`): the task's whole time in the step within the run, its calls
388
+ added up; a batch record counts each item by its own part. A value counts once the run has left the step.
389
+ - **Held in memory** (`makeStepTimes`, `platform.stepTimes.timesOf`): a version's records are read once through their index,
390
+ then each read takes only the records written since and those still open. Where the current version has no value yet,
391
+ the previous version's are given, said to be that. A host routes it (`/api/platform/workflows/<name>/times`) and names
392
+ the route as `timesUrl`; the page reads it each minute.
393
+ - **Drawn in each step's box** (`dashboard/time-distribution.tsx`): a continuous bar graph, x time taken on a linear axis
394
+ from 0 to the slowest, one bar per pixel column, y how many tasks took that long; n, the median (▲) and the 90th
395
+ percentile (◆) in words, both marked on the axis by those shapes.
256
396
 
257
397
  ## The spending limit, and tasks that need an agent (0.6.0, 2026-11-20)
258
398
 
@@ -5,7 +5,7 @@ export const workflowBudgetStates = (workflows, budgets, work, assigned) => work
5
5
  const runs = assigned.filter((a) => a.workflow === w.name);
6
6
  const limits = { agents: row?.budget ?? 0, runs: row?.runs ?? null };
7
7
  return {
8
- workflow: w.name, phase: w.phase, budget: limits.agents, runs: runLimit(limits),
8
+ workflow: w.name, budget: limits.agents, runs: runLimit(limits),
9
9
  changedAt: row?.changed_at ?? 0, running: runs.length,
10
10
  items: work.find((x) => x.workflow === w.name)?.items ?? 0,
11
11
  newestStart: runs.length === 0 ? null : Math.max(...runs.map((r) => r.started)),
@@ -1 +1 @@
1
- {"version":3,"file":"budget-states.js","sourceRoot":"","sources":["../../../src/budget-states.ts"],"names":[],"mappings":"AAAA,+HAA+H;AAC/H,OAAO,EAAE,QAAQ,EAA0B,MAAM,mBAAmB,CAAC;AAmBrE,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAClC,SAA2E,EAC3E,OAAyC,EACzC,IAA0E,EAC1E,QAAgF,EAC5C,EAAE,CACtC,SAAS,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE;IAClB,MAAM,GAAG,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,QAAQ,KAAK,CAAC,CAAC,IAAI,CAAC,C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,GAAG,EAAE,KAAK,EAAE,eAAe,KAAK,EAAE,EAAE,CAAC;IAC7E,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,QAAQ,CAAC;QAAE,OAAO,EAAE,MAAM,EAAE,GAAG,EAAE,KAAK,EAAE,GAAG,QAAQ,6DAA6D,EAAE,CAAC;IAC1I,OAAO,OAAO,MAAM,KAAK,QAAQ,IAAI,MAAM,CAAC,SAAS,CAAC,MAAM,CAAC,IAAI,MAAM,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,GAAG,EAAE,KAAK,EAAE,0CAA0C,EAAE,CAAC;AAC3J,CAAC,CAAC"}
@@ -23,6 +23,11 @@
23
23
  .wp-limit { display: inline-flex; gap: 4px; align-items: baseline; }
24
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
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; }
26
31
 
27
32
  .wp-h3 { font-size: 13px; margin: 4px 0; }
28
33
  /* The queues' chart: small type, thin lines. */
@@ -40,14 +45,6 @@
40
45
  .wp-seg-queued { background: color-mix(in srgb, var(--wp-fg) 50%, var(--wp-bg)); }
41
46
  .wp-seg-rest { background: color-mix(in srgb, var(--wp-fg) 28%, var(--wp-bg)); }
42
47
 
43
- /* One workflow's step graph, small: rows of steps, numbered arrows, the numbers' conditions below. */
44
- .wp-steps-box { position: relative; display: inline-block; min-width: 260px; padding: 4px 0; margin-right: 240px; }
45
- .wp-steps-edges { position: absolute; left: 0; top: 0; pointer-events: none; overflow: visible; }
46
- .wp-steps-row { position: relative; display: flex; flex-wrap: wrap; gap: 8px 14px; margin: 0 0 14px; }
47
- .wp-step { position: relative; z-index: 1; background: var(--wp-node); border: 1px solid var(--wp-node-line); border-radius: 4px; padding: 2px 7px; font-size: 11px; color: var(--wp-fg); }
48
- .wp-step em { font-style: normal; color: var(--wp-ok); }
49
- .wp-step-end { border-style: dashed; color: var(--wp-dim); }
50
- .wp-steps-when { margin: 0 0 6px 18px; padding: 0; font-size: 11px; color: var(--wp-dim); }
51
48
 
52
49
  /* A queue's tasks as a column addition: each category's count right-aligned in one column of tabular figures, one plus
53
50
  sign beside the last addend, a rule under the addends, and the total beneath in the same column. */
@@ -61,23 +58,18 @@
61
58
  .wp-sum-total td { font-weight: 600; padding-top: 1px; }
62
59
 
63
60
  /* The drill-down: the breadcrumb of the workflows opened, then one workflow's own steps, each a row with its kind in words. */
64
- .wp-crumbs { display: flex; flex-wrap: wrap; gap: 2px 8px; align-items: baseline; margin: 12px 0 6px; font-size: 13px; }
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); }
65
64
  .wp-crumbs a { color: var(--wp-fg); text-decoration: underline; padding: 6px 0; }
66
65
  .wp-crumb-sep { color: var(--wp-dim); }
67
- .wp-crumb-here { font-weight: 600; font-size: 17px; }
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
68
  .wp-drill-source { font-size: 11px; font-weight: normal; }
69
+ .wp-others { font-size: 12.5px; }
69
70
  .wp-drill-status { margin: 6px 0 10px; font-size: 12px; }
70
- .wp-drill-steps { list-style: none; margin: 4px 0 18px; padding: 0; counter-reset: wp-drill-step; }
71
- .wp-drill-step { counter-increment: wp-drill-step; border: 1px solid var(--wp-node-line); border-radius: 6px; background: var(--wp-node); padding: 7px 9px; margin: 0 0 6px; font-size: 12.5px; }
72
- .wp-drill-head { display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: baseline; }
73
- .wp-drill-head::before { content: counter(wp-drill-step) "."; color: var(--wp-dim); min-width: 2ch; }
74
- .wp-drill-name { font-size: 13.5px; font-weight: 600; color: var(--wp-fg); }
75
- a.wp-drill-name { text-decoration: underline; padding: 4px 0; }
76
71
  /* The kind is words in a plain outline: nothing about it is told by colour. */
77
72
  .wp-kind { border: 1px solid var(--wp-node-line); border-radius: 3px; padding: 0 5px; font-size: 11px; white-space: nowrap; }
78
- .wp-drill-what { margin: 2px 0 0; line-height: 1.35; }
79
- .wp-drill-figures { margin: 2px 0 0; font-size: 11.5px; font-variant-numeric: tabular-nums; line-height: 1.35; }
80
- .wp-drill-group { font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em; margin: 14px 0 5px; padding-bottom: 3px; border-bottom: 1px solid var(--wp-line); }
81
73
 
82
74
  /* Tasks over time: the key under the chart, a numbered line of words per chart line, and the table lines are chosen in. */
83
75
  .wp-chart-axis { margin: 0 0 2px; font-size: 11px; }
@@ -119,16 +111,38 @@ a.wp-drill-name { text-decoration: underline; padding: 4px 0; }
119
111
 
120
112
  /* Every button is large enough for a finger where a finger presses it: Alex reads the page on a phone. */
121
113
  .wp-limit button { min-width: 30px; min-height: 30px; }
122
- @media (max-width: 620px), (pointer: coarse) { .wp-page button { min-width: 44px; min-height: 44px; } }
114
+ @media (max-width: 620px), (pointer: coarse) { .wp-page button, .wp-page .wp-limit button { min-width: 44px; min-height: 44px; } }
123
115
 
124
- /* The map: laid out by ELK, its boxes placed where it says, scrolled sideways inside its own box where it is wider than the page. */
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. */
125
117
  .wp-dag-wrap { margin: 6px 0 14px; }
126
- .wp-dag-scroll { overflow-x: auto; overflow-y: hidden; max-width: 100%; border: 1px solid var(--wp-line); border-radius: 6px; }
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); } }
127
126
  .wp-dag { position: relative; min-height: 40px; }
128
- .wp-band-name { font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--wp-fg); line-height: 1.35; }
129
127
  .wp-dag-edges { position: absolute; left: 0; top: 0; pointer-events: none; z-index: 0; }
130
- .wp-node { 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); }
131
- .wp-node-name { display: inline-block; color: var(--wp-fg); font-size: 13px; font-weight: 600; text-decoration: underline; padding: 6px 0; }
132
- /* A sub-workflow step in a step graph is a link to its workflow's own level, said in words and underlined. */
133
- a.wp-step-link { text-decoration: underline; cursor: pointer; }
134
- @media (max-width: 620px), (pointer: coarse) { .wp-node-name, a.wp-step-link { min-height: 44px; display: inline-flex; align-items: center; } }
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,8 +1,19 @@
1
- /** The level `path` opens. A part that opens nothing stops there: the level above it is shown, and the part is named. */
2
- export const drillLevel = (view, path) => {
3
- const workflows = new Map(view.groups.flatMap((g) => g.workflows).map((w) => [w.name, w]));
4
- let level = { crumbs: [{ name: view.top.name, path: [] }], name: view.top.name, description: view.top.description, steps: view.top.steps, workflow: null, notFound: null };
1
+ /**
2
+ * The level `path` opens. A part that opens nothing stops there: the level above it is shown, and the part is named. A path
3
+ * that begins with the top workflow's own name (`/workflows/Decompile game/Match the original`) opens what follows it, and
4
+ * its links are the path without it: the top's address is `/`.
5
+ */
6
+ export const drillLevel = (view, asked) => {
7
+ const path = asked[0] === view.top.name && !view.top.steps.some((s) => s.name === asked[0]) ? asked.slice(1) : asked;
8
+ const workflows = new Map(view.workflows.map((w) => [w.name, w]));
9
+ let level = { 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 };
10
+ // 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.
11
+ 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]);
12
+ if (otherTop !== undefined)
13
+ level = { crumbs: [{ name: otherTop.name, path: [otherTop.name] }], name: otherTop.name, description: otherTop.description, steps: otherTop.steps, workflow: otherTop, notFound: null };
5
14
  for (const [i, part] of path.entries()) {
15
+ if (i === 0 && otherTop !== undefined)
16
+ continue;
6
17
  const step = level.steps.find((s) => s.name === part && s.workflow !== null);
7
18
  const workflow = step === undefined || step.workflow === null ? undefined : workflows.get(step.workflow);
8
19
  if (workflow === undefined)
@@ -11,6 +22,26 @@ export const drillLevel = (view, path) => {
11
22
  }
12
23
  return level;
13
24
  };
25
+ /**
26
+ * A WORKFLOW AND EVERY WORKFLOW UNDER IT, AT ANY DEPTH, through its steps that are workflows, each once, the workflow first
27
+ * and the rest in the order its steps reach them: what its tasks over time are drawn from. On Decompile game's page, only
28
+ * its own steps were read, its parts, none of which records tasks, and Decompile, which does, two levels down, was missed. Pure.
29
+ */
30
+ export const workflowsUnder = (view, workflow) => {
31
+ const byName = new Map(view.workflows.map((w) => [w.name, w]));
32
+ const out = [];
33
+ const visit = (name) => {
34
+ const w = byName.get(name);
35
+ if (w === undefined || out.includes(w))
36
+ return;
37
+ out.push(w);
38
+ for (const s of w.steps)
39
+ if (s.workflow !== null)
40
+ visit(s.workflow);
41
+ };
42
+ visit(workflow);
43
+ return out;
44
+ };
14
45
  /** 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. */
15
46
  export const kindWords = (step) => (step.runs === null ? step.kind : `${step.kind} · ${step.runs}`);
16
47
  //# sourceMappingURL=drilldown.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"drilldown.js","sourceRoot":"","sources":["../../../../src/dashboard/drilldown.ts"],"names":[],"mappings":"AA4BA,yHAAyH;AACzH,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC,IAA2C,EAAE,IAA2B,EAAc,EAAE;IACjH,MAAM,SAAS,GAAG,IAAI,GAAG,CAAC,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;IAC3F,IAAI,KAAK,GAAe,EAAE,MAAM,EAAE,CAAC,EAAE,IAAI,EAAE,IAAI,CAAC,GAAG,CAAC,IAAI,EAAE,IAAI,EAAE,EAAE,EAAE,CAAC,EAAE,IAAI,EAAE,IAAI,CAAC,GAAG,CAAC,IAAI,EAAE,WAAW,EAAE,IAAI,CAAC,GAAG,CAAC,WAAW,EAAE,KAAK,EAAE,IAAI,CAAC,GAAG,CAAC,KAAK,EAAE,QAAQ,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;IACvL,KAAK,MAAM,CAAC,CAAC,EAAE,IAAI,CAAC,IAAI,IAAI,CAAC,OAAO,EAAE,EAAE,CAAC;QACvC,MAAM,IAAI,GAAG,KAAK,CAAC,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 -0,0 +1,29 @@
1
+ const runsWord = (n) => `${n} run${n === 1 ? '' : 's'}`;
2
+ /** One count's words; runs holding an agent name the agents' limit they hold them under, where the workflow has one. */
3
+ const countWords = (c, agentsLimit) => `${c.runs} ${doingWords(c.doing, agentsLimit)}`;
4
+ const doingWords = (d, agentsLimit) => d.kind === 'holding an agent' ? `holding an agent${agentsLimit === null ? '' : ` (limit ${agentsLimit})`}`
5
+ : d.kind === 'in a step' ? `in ${d.step}`
6
+ : d.kind === 'waiting at a step' ? `waiting at ${d.step}`
7
+ : d.kind;
8
+ /** Its counts, with one of runs holding an agent, none included, where it uses agents: its agent count is never missing. Pure. */
9
+ const withAgentCount = (r) => r.usesAgents && !r.doing.some((c) => c.doing.kind === 'holding an agent') ? [{ doing: { kind: 'holding an agent' }, runs: 0 }, ...r.doing] : r.doing;
10
+ /**
11
+ * A workflow's going runs and what each is doing. One that uses agents always says how many hold one, none included, so its
12
+ * agent count is never missing; its agents' limit is the one its runs' claims count against.
13
+ */
14
+ export const runsGoingWords = (r) => {
15
+ if (r.runs === 0)
16
+ return 'no run going';
17
+ const counts = withAgentCount(r);
18
+ return `${runsWord(r.runs)} going: ${counts.map((c) => countWords(c, r.agentsLimit)).join(', ')}`;
19
+ };
20
+ /**
21
+ * A WORKFLOW'S GOING RUNS AS LINES, one a state, each its count and its words, as the page's Runs section adds them up to
22
+ * the runs going; its agents' limit is on the Limits section. One that uses agents always has its line of runs holding an
23
+ * agent, none included. Pure.
24
+ */
25
+ export const runsDoingLines = (r) => {
26
+ const counts = withAgentCount(r);
27
+ return counts.map((c) => ({ runs: c.runs, words: doingWords(c.doing, null) }));
28
+ };
29
+ //# sourceMappingURL=run-doing-words.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"run-doing-words.js","sourceRoot":"","sources":["../../../../src/dashboard/run-doing-words.ts"],"names":[],"mappings":"AAOA,MAAM,QAAQ,GAAG,CAAC,CAAS,EAAE,EAAE,CAAC,GAAG,CAAC,OAAO,CAAC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,CAAC;IACxC,MAAM,MAAM,GAAG,cAAc,CAAC,CAAC,CAAC,CAAC;IACjC,OAAO,GAAG,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,WAAW,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,UAAU,CAAC,CAAC,EAAE,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC;AACpG,CAAC,CAAC;AAEF;;;;GAIG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,CAA6E,EAAoE,EAAE;IAChL,MAAM,MAAM,GAAG,cAAc,CAAC,CAAC,CAAC,CAAC;IACjC,OAAO,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC,IAAI,EAAE,KAAK,EAAE,UAAU,CAAC,CAAC,CAAC,KAAK,EAAE,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC;AACjF,CAAC,CAAC"}
@@ -0,0 +1,18 @@
1
+ /** Where a setting is set, in words, as the box of step `here.step` on `here.workflow`'s page says it. Pure. */
2
+ export const setOnWords = (setOn, here) => setOn.kind === 'platform default' ? "the platform's default"
3
+ : setOn.kind === 'app' ? 'set on the app'
4
+ : setOn.kind === 'workflow' ? (here.step === null && setOn.workflow === here.workflow ? 'set on this workflow' : `set on ${setOn.workflow}`)
5
+ : setOn.workflow === here.workflow && setOn.step === here.step ? 'set on this step'
6
+ : `set on its step ${setOn.step} in ${setOn.workflow}`;
7
+ const plural = (n, one, many) => `${n.toLocaleString('en-US')} ${n === 1 ? one : many}`;
8
+ /** How long a step's records are kept and the fewest of its runs kept however old, and where each is set: once where both are set in one place. Pure. */
9
+ export const retentionWords = (kept, here) => {
10
+ const days = `keeps ${plural(kept.days.value, 'day', 'days')}`;
11
+ const runs = `at least ${plural(kept.atLeastRuns.value, 'run', 'runs')}`;
12
+ const daysOn = setOnWords(kept.days.setOn, here);
13
+ const runsOn = setOnWords(kept.atLeastRuns.setOn, here);
14
+ return daysOn === runsOn ? `${days}, ${runs} (${daysOn})` : `${days} (${daysOn}), ${runs} (${runsOn})`;
15
+ };
16
+ /** The model a step's agents run on, and where that is set; none set says so, since such a step fails before its agent. Pure. */
17
+ export const modelWords = (model, here) => model.value === null ? `no model set (${setOnWords(model.setOn, here)}): its agent steps fail until one is` : `model ${model.value} (${setOnWords(model.setOn, here)})`;
18
+ //# sourceMappingURL=setting-words.js.map