@jive-sh/workflow-platform 0.7.0 → 1.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (195) hide show
  1. package/README.md +70 -435
  2. package/component/_generated/api.ts +72 -0
  3. package/component/_generated/component.ts +629 -0
  4. package/component/_generated/dataModel.ts +60 -0
  5. package/component/_generated/server.ts +169 -0
  6. package/component/convex.config.ts +3 -0
  7. package/component/engine.ts +756 -0
  8. package/component/errors.ts +66 -0
  9. package/component/events.ts +17 -0
  10. package/component/notes.ts +19 -0
  11. package/component/places.ts +136 -0
  12. package/component/retention.ts +205 -0
  13. package/component/runEngine.ts +25 -0
  14. package/component/schema.ts +135 -0
  15. package/component/steps.ts +188 -0
  16. package/component/store.ts +513 -0
  17. package/component/tasks.ts +290 -0
  18. package/component/worker.ts +109 -0
  19. package/component/workflows.ts +83 -0
  20. package/dist/definition/agent-runner.js +9 -0
  21. package/dist/definition/agent-runner.js.map +1 -0
  22. package/dist/definition/file-store.js +9 -0
  23. package/dist/definition/file-store.js.map +1 -0
  24. package/dist/definition/program-build.js +10 -0
  25. package/dist/definition/program-build.js.map +1 -0
  26. package/dist/definition/step.js +1 -0
  27. package/dist/definition/step.js.map +1 -0
  28. package/dist/definition/task-schema.js +5 -0
  29. package/dist/definition/task-schema.js.map +1 -0
  30. package/dist/definition/tasks.js +9 -0
  31. package/dist/definition/tasks.js.map +1 -0
  32. package/dist/definition/workflow.js +117 -0
  33. package/dist/definition/workflow.js.map +1 -0
  34. package/dist/graph.js +310 -9
  35. package/dist/graph.js.map +1 -1
  36. package/dist/index.js +7 -196
  37. package/dist/index.js.map +1 -1
  38. package/package.json +9 -4
  39. package/src/definition/agent-runner.ts +59 -0
  40. package/src/definition/file-store.ts +20 -0
  41. package/src/definition/program-build.ts +30 -0
  42. package/src/definition/step.ts +106 -0
  43. package/src/definition/task-schema.ts +15 -0
  44. package/src/definition/tasks.ts +43 -0
  45. package/src/definition/workflow.ts +262 -0
  46. package/src/graph.ts +352 -19
  47. package/src/index.ts +8 -238
  48. package/worker/directory-file-store.ts +42 -0
  49. package/worker/index.ts +12 -0
  50. package/worker/platform-client.ts +144 -0
  51. package/worker/step-meter.ts +80 -0
  52. package/worker/worker-tasks.ts +27 -0
  53. package/worker/worker.test.ts +200 -0
  54. package/worker/worker.ts +240 -0
  55. package/dist/budget-states.js +0 -30
  56. package/dist/budget-states.js.map +0 -1
  57. package/dist/cpu-limit/limiter.js +0 -839
  58. package/dist/cpu-limit/limiter.js.map +0 -1
  59. package/dist/cpu-limit/use.js +0 -139
  60. package/dist/cpu-limit/use.js.map +0 -1
  61. package/dist/dashboard/agent-usage.js +0 -25
  62. package/dist/dashboard/agent-usage.js.map +0 -1
  63. package/dist/dashboard/dashboard.css +0 -148
  64. package/dist/dashboard/drilldown.js +0 -47
  65. package/dist/dashboard/drilldown.js.map +0 -1
  66. package/dist/dashboard/queue-lines.js +0 -44
  67. package/dist/dashboard/queue-lines.js.map +0 -1
  68. package/dist/dashboard/queue-table.js +0 -16
  69. package/dist/dashboard/queue-table.js.map +0 -1
  70. package/dist/dashboard/run-doing-words.js +0 -29
  71. package/dist/dashboard/run-doing-words.js.map +0 -1
  72. package/dist/dashboard/setting-words.js +0 -18
  73. package/dist/dashboard/setting-words.js.map +0 -1
  74. package/dist/dashboard/spending-words.js +0 -24
  75. package/dist/dashboard/spending-words.js.map +0 -1
  76. package/dist/failure.js +0 -35
  77. package/dist/failure.js.map +0 -1
  78. package/dist/keep-running.js +0 -79
  79. package/dist/keep-running.js.map +0 -1
  80. package/dist/outside-failure.js +0 -31
  81. package/dist/outside-failure.js.map +0 -1
  82. package/dist/pick-wakes.js +0 -125
  83. package/dist/pick-wakes.js.map +0 -1
  84. package/dist/project.js +0 -1
  85. package/dist/project.js.map +0 -1
  86. package/dist/queue-counts.js +0 -51
  87. package/dist/queue-counts.js.map +0 -1
  88. package/dist/reasons.js +0 -33
  89. package/dist/reasons.js.map +0 -1
  90. package/dist/retention.js +0 -59
  91. package/dist/retention.js.map +0 -1
  92. package/dist/settings.js +0 -88
  93. package/dist/settings.js.map +0 -1
  94. package/dist/spending-limit.js +0 -82
  95. package/dist/spending-limit.js.map +0 -1
  96. package/dist/step-files.js +0 -200
  97. package/dist/step-files.js.map +0 -1
  98. package/dist/step-meter.js +0 -97
  99. package/dist/step-meter.js.map +0 -1
  100. package/dist/step-times.js +0 -114
  101. package/dist/step-times.js.map +0 -1
  102. package/dist/step-usage.js +0 -19
  103. package/dist/step-usage.js.map +0 -1
  104. package/dist/steps.js +0 -1205
  105. package/dist/steps.js.map +0 -1
  106. package/dist/storage/agent-claims.js +0 -3
  107. package/dist/storage/agent-claims.js.map +0 -1
  108. package/dist/storage/budgets.js +0 -121
  109. package/dist/storage/budgets.js.map +0 -1
  110. package/dist/storage/engine-records.js +0 -91
  111. package/dist/storage/engine-records.js.map +0 -1
  112. package/dist/storage/engine-storage.js +0 -67
  113. package/dist/storage/engine-storage.js.map +0 -1
  114. package/dist/storage/input-records.js +0 -12
  115. package/dist/storage/input-records.js.map +0 -1
  116. package/dist/storage/move-store.js +0 -251
  117. package/dist/storage/move-store.js.map +0 -1
  118. package/dist/storage/sqlite-store.js +0 -901
  119. package/dist/storage/sqlite-store.js.map +0 -1
  120. package/dist/storage/step-records.js +0 -11
  121. package/dist/storage/step-records.js.map +0 -1
  122. package/dist/storage/storage-error.js +0 -19
  123. package/dist/storage/storage-error.js.map +0 -1
  124. package/dist/storage/task-store.js +0 -30
  125. package/dist/storage/task-store.js.map +0 -1
  126. package/dist/system-workflows.js +0 -54
  127. package/dist/system-workflows.js.map +0 -1
  128. package/dist/tasks.js +0 -500
  129. package/dist/tasks.js.map +0 -1
  130. package/dist/views/format.js +0 -37
  131. package/dist/views/format.js.map +0 -1
  132. package/dist/views/runs-now.js +0 -117
  133. package/dist/views/runs-now.js.map +0 -1
  134. package/dist/views/step-funnel.js +0 -98
  135. package/dist/views/step-funnel.js.map +0 -1
  136. package/dist/views/step-graph.js +0 -39
  137. package/dist/views/step-graph.js.map +0 -1
  138. package/dist/views/workflows-view.js +0 -236
  139. package/dist/views/workflows-view.js.map +0 -1
  140. package/src/budget-states.ts +0 -54
  141. package/src/cpu-limit/limiter.ts +0 -935
  142. package/src/cpu-limit/use.ts +0 -166
  143. package/src/dashboard/agent-usage-line.tsx +0 -28
  144. package/src/dashboard/agent-usage.ts +0 -48
  145. package/src/dashboard/dashboard.css +0 -148
  146. package/src/dashboard/drilldown.ts +0 -70
  147. package/src/dashboard/index.tsx +0 -4
  148. package/src/dashboard/limits-and-runs.tsx +0 -191
  149. package/src/dashboard/machine-controls.tsx +0 -53
  150. package/src/dashboard/queue-bar.tsx +0 -62
  151. package/src/dashboard/queue-chart.tsx +0 -149
  152. package/src/dashboard/queue-lines.ts +0 -87
  153. package/src/dashboard/queue-table.ts +0 -37
  154. package/src/dashboard/run-doing-words.ts +0 -41
  155. package/src/dashboard/setting-words.ts +0 -30
  156. package/src/dashboard/spending-limit-control.tsx +0 -47
  157. package/src/dashboard/spending-words.ts +0 -32
  158. package/src/dashboard/time-distribution.tsx +0 -61
  159. package/src/dashboard/workflow-dag.tsx +0 -322
  160. package/src/dashboard/workflow-drilldown.tsx +0 -31
  161. package/src/dashboard/workflows-dashboard.tsx +0 -532
  162. package/src/failure.ts +0 -36
  163. package/src/keep-running.ts +0 -85
  164. package/src/outside-failure.ts +0 -39
  165. package/src/pick-wakes.ts +0 -182
  166. package/src/project.ts +0 -127
  167. package/src/queue-counts.ts +0 -64
  168. package/src/reasons.ts +0 -30
  169. package/src/retention.ts +0 -90
  170. package/src/settings.ts +0 -171
  171. package/src/spending-limit.ts +0 -139
  172. package/src/step-files.ts +0 -208
  173. package/src/step-meter.ts +0 -120
  174. package/src/step-times.ts +0 -151
  175. package/src/step-usage.ts +0 -23
  176. package/src/steps.ts +0 -1616
  177. package/src/storage/agent-claims.ts +0 -63
  178. package/src/storage/budgets.ts +0 -152
  179. package/src/storage/engine-records.ts +0 -119
  180. package/src/storage/engine-storage.ts +0 -82
  181. package/src/storage/input-records.ts +0 -43
  182. package/src/storage/move-store.ts +0 -265
  183. package/src/storage/sqlite-store.ts +0 -1022
  184. package/src/storage/step-records.ts +0 -358
  185. package/src/storage/storage-error.ts +0 -35
  186. package/src/storage/task-store.ts +0 -235
  187. package/src/system-workflows.ts +0 -70
  188. package/src/tasks.ts +0 -586
  189. package/src/views/format.ts +0 -40
  190. package/src/views/runs-now.ts +0 -188
  191. package/src/views/step-funnel.ts +0 -163
  192. package/src/views/step-graph.ts +0 -77
  193. package/src/views/workflows-view.ts +0 -484
  194. package/src/workflow-dag.test.tsx +0 -89
  195. package/src/workflow-page.test.tsx +0 -170
@@ -1 +0,0 @@
1
- {"version":3,"file":"setting-words.js","sourceRoot":"","sources":["../../../../src/dashboard/setting-words.ts"],"names":[],"mappings":"AAQA,gHAAgH;AAChH,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC,KAAY,EAAE,IAAiE,EAAU,EAAE,CACpH,KAAK,CAAC,IAAI,KAAK,kBAAkB,CAAC,CAAC,CAAC,wBAAwB;IAC1D,CAAC,CAAC,KAAK,CAAC,IAAI,KAAK,KAAK,CAAC,CAAC,CAAC,gBAAgB;QACvC,CAAC,CAAC,KAAK,CAAC,IAAI,KAAK,UAAU,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,KAAK,IAAI,IAAI,KAAK,CAAC,QAAQ,KAAK,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,sBAAsB,CAAC,CAAC,CAAC,UAAU,KAAK,CAAC,QAAQ,EAAE,CAAC;YAC1I,CAAC,CAAC,KAAK,CAAC,QAAQ,KAAK,IAAI,CAAC,QAAQ,IAAI,KAAK,CAAC,IAAI,KAAK,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,kBAAkB;gBACjF,CAAC,CAAC,mBAAmB,KAAK,CAAC,IAAI,OAAO,KAAK,CAAC,QAAQ,EAAE,CAAC;AAEjE,MAAM,MAAM,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o } from '../views/format';
2
- /** What the limit is set to: "agents stop at 95% of the week (the default)". */
3
- export const spendingSettingWords = (s) => `Spending limit: agents stop at ${s.limitPercent}% of the week${s.setAt === null ? ' (the default)' : ''}`;
4
- /** The week's reading against the limit, and whether it withholds every agent. */
5
- export const spendingVerdictWords = (s, now) => {
6
- if (s.reading === null) {
7
- return s.failedSince === null
8
- ? "Holds nothing: there is no reading of the week's use yet."
9
- : `Holds nothing: there is no good reading of the week's use yet; the newest read failed at ${whenAgo(s.failedSince.at, now)}: ${s.failedSince.error}`;
10
- }
11
- const reading = `the week's use is ${percentCut(s.reading.usedPercent)}, read ${whenAgo(s.reading.readAt, now)}`;
12
- return s.holds
13
- ? `Withholding every agent: ${reading}, at or past the limit. No run is given one, and a run holding one ends before its next agent call, its task back in its queue, until a reading is below ${s.limitPercent}%.`
14
- : `Holds nothing: ${reading}, below the limit.`;
15
- };
16
- /** Why the reading is stale and what the limit does meanwhile; none while it is current. */
17
- export const spendingStaleWords = (s, now) => {
18
- if (!s.stale)
19
- return null;
20
- return s.failedSince === null
21
- ? "The reading is stale: none came since. The limit keeps that reading's verdict until a new one."
22
- : `The reading is stale: the newest read failed at ${whenAgo(s.failedSince.at, now)} (${s.failedSince.error}). The limit keeps the last good reading's verdict until a read succeeds.`;
23
- };
24
- //# sourceMappingURL=spending-words.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"spending-words.js","sourceRoot":"","sources":["../../../../src/dashboard/spending-words.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC;AAEtD,gFAAgF;AAChF,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,CAAqD,EAAU,EAAE,CACpG,kCAAkC,CAAC,CAAC,YAAY,gBAAgB,CAAC,CAAC,KAAK,KAAK,IAAI,CAAC,CAAC,CAAC,gBAAgB,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC;AAE7G,kFAAkF;AAClF,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,CAAqB,EAAE,GAAW,EAAU,EAAE;IACjF,IAAI,CAAC,CAAC,OAAO,KAAK,IAAI,EAAE,CAAC;QACvB,OAAO,CAAC,CAAC,WAAW,KAAK,IAAI;YAC3B,CAAC,CAAC,2DAA2D;YAC7D,CAAC,CAAC,4FAA4F,OAAO,CAAC,CAAC,CAAC,WAAW,CAAC,EAAE,EAAE,GAAG,CAAC,KAAK,CAAC,CAAC,WAAW,CAAC,KAAK,EAAE,CAAC;IAC3J,CAAC;IACD,MAAM,OAAO,GAAG,qBAAqB,UAAU,CAAC,CAAC,CAAC,OAAO,CAAC,WAAW,CAAC,UAAU,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC,MAAM,EAAE,GAAG,CAAC,EAAE,CAAC;IACjH,OAAO,CAAC,CAAC,KAAK;QACZ,CAAC,CAAC,4BAA4B,OAAO,4JAA4J,CAAC,CAAC,YAAY,IAAI;QACnN,CAAC,CAAC,kBAAkB,OAAO,oBAAoB,CAAC;AACpD,CAAC,CAAC;AAEF,4FAA4F;AAC5F,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,CAAqB,EAAE,GAAW,EAAiB,EAAE;IACtF,IAAI,CAAC,CAAC,CAAC,KAAK;QAAE,OAAO,IAAI,CAAC;IAC1B,OAAO,CAAC,CAAC,WAAW,KAAK,IAAI;QAC3B,CAAC,CAAC,gGAAgG;QAClG,CAAC,CAAC,mDAAmD,OAAO,CAAC,CAAC,CAAC,WAAW,CAAC,EAAE,EAAE,GAAG,CAAC,KAAK,CAAC,CAAC,WAAW,CAAC,KAAK,2EAA2E,CAAC;AAC3L,CAAC,CAAC"}
package/dist/failure.js DELETED
@@ -1,35 +0,0 @@
1
- /**
2
- * What a failure actually was, as one line.
3
- *
4
- * `Effect.runPromise` rejects with the typed failure itself, and a
5
- * `Schema.TaggedError` has an empty `message`: reading only that printed a
6
- * worker's label and nothing else, which reads as a successful quiet tick --
7
- * and recorded the gate canary's Docker failure as "", which hid from both a
8
- * reader and `/api/health` that the cause was outside the service.
9
- */
10
- /**
11
- * A long failure text as it is kept: whole when it fits in `cap`, else its start and its last `end` characters, with
12
- * how much was left out between. Never only the start: a failure's own words are usually last, and a step error cut
13
- * at 500 characters kept a compiler's source echo and ended "Refere", its `ReferenceError` lost (2026-11-07).
14
- */
15
- export const startAndEnd = (text, kept) => text.length <= kept.cap
16
- ? text
17
- : `${text.slice(0, kept.cap - kept.end)}\n[... ${text.length - kept.cap} characters of ${kept.what} left out ...]\n${text.slice(-kept.end)}`;
18
- export const describeFailure = (cause) => {
19
- if (cause !== null && typeof cause === 'object') {
20
- const tagged = cause;
21
- if (typeof tagged._tag === 'string') {
22
- const fields = Object.entries(cause)
23
- .filter(([key]) => key !== '_tag')
24
- .map(([key, value]) => `${key}=${typeof value === 'string' ? value : JSON.stringify(value)}`)
25
- .join(' ');
26
- return fields === '' ? tagged._tag : `${tagged._tag}: ${fields}`;
27
- }
28
- if (cause instanceof Error) {
29
- return cause.message === '' ? (cause.stack ?? String(cause)) : cause.message;
30
- }
31
- return JSON.stringify(cause);
32
- }
33
- return String(cause);
34
- };
35
- //# sourceMappingURL=failure.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"failure.js","sourceRoot":"","sources":["../../../src/failure.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH;;;;GAIG;AACH,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,IAAY,EAAE,IAA2E,EAAU,EAAE,CAC/H,IAAI,CAAC,MAAM,IAAI,IAAI,CAAC,GAAG;IACrB,CAAC,CAAC,IAAI;IACN,CAAC,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,IAAI,CAAC,GAAG,GAAG,IAAI,CAAC,GAAG,CAAC,UAAU,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,GAAG,kBAAkB,IAAI,CAAC,IAAI,mBAAmB,IAAI,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC,GAAG,CAA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T.
3
- *
4
- * Alex, 2026-11-06: "We simply have desire concurrent run rate per phase", then "move the concurrent run controls on the
5
- * workflow level rather than on the phase level, then you can eliminate any logic that goes into decideing which workflows
6
- * get the available runs". A workflow with an agent step and a list of work (`keptRunningByItsBudget`) is kept running by
7
- * one trigger, with no code of its own: each turn it starts as many runs as the workflow's run limit keeps (`runLimit`) above
8
- * the runs going, as soon as a run ends and otherwise on a fallback timer. There is no sharing between workflows, no order,
9
- * no cap per item and no check of usage: a run with nothing to pick waits for an item (`steps.ts` `untilPicked`), and the
10
- * blocking a Pick runs and the queue's order keep a run off what it cannot finish. A run limit of 0 holds one workflow.
11
- *
12
- * NO RUN STARTS THAT COULD TAKE NO WORK: while no agent can be had for a workflow and its Pick would pass over every task
13
- * in its queue (`steps.ts` `whyNoRunCanTakeWork`), it starts none, and a run waiting in its Pick ends. Alex, relayed on 2026-11-20:
14
- * "if the number of queued tasks that require agents is all of them, and if there is no remaining agentic budget or all
15
- * agents are in use, then the workflow runner doesn't just continually cycle picking up tasks and moving them to the back
16
- * of the queue again". The next turn after an agent can be had, a mark clears or new input lands starts runs again. While
17
- * its agents are only all in use, runs start: a Pick passes over the marked tasks and waits, with nothing it can take,
18
- * until an agent step ends (`steps.ts` `whyNoAgentIsFree`), so no run cycles through them either.
19
- */
20
- import { keptRunningByItsBudget } from './steps';
21
- import { runLimit } from './storage/budgets';
22
- /** With no run ending to wake it, how often the trigger looks. */
23
- export const KEEP_RUNNING_EVERY_SECONDS = 60;
24
- /** How long one turn of the trigger may take, less than its minute; a turn past it is abandoned and the next one runs. */
25
- export const TURN_LIMIT_MS = 50_000;
26
- /** How long one run's start may take. */
27
- export const START_LIMIT_SECONDS = 20;
28
- /** The workflows this trigger keeps running, each with a budget. Pure. */
29
- export const budgetedWorkflows = (declared) => declared.filter(keptRunningByItsBudget);
30
- /**
31
- * How many runs of one workflow to start now: the runs its run limit keeps above the runs going. Its agents' limit plays
32
- * no part: a run with a task that finds no agent free at its first agent step gives its task back and ends. Pure.
33
- */
34
- export const runsToStart = (w) => Math.max(w.kept - w.running, 0);
35
- /**
36
- * One turn's plan: for each budgeted workflow, the runs going and how many to start; none where no run could take work
37
- * (`noWork`, from `steps.ts` `whyNoRunCanTakeWork`), which says why. Pure but for the reads it is given.
38
- */
39
- export const planRunStarts = (input) => budgetedWorkflows(input.declared).map((d) => {
40
- const running = input.runningRuns(d.name);
41
- const noWork = input.noWork(d.name);
42
- return { declaration: d, running, noWork, start: noWork !== null ? 0 : runsToStart({ kept: runLimit(input.limitsOf(d.name)), running }) };
43
- });
44
- /**
45
- * ONE TURN AT A TIME, AND NO TURN HOLDS THE NEXT UP FOR LONG. A call during a turn shares its result and asks for one more
46
- * after it. A turn past `limitMs` fails, so nothing it hung on can leave the trigger shut, and `stillCurrent` turns false
47
- * for it, so if it wakes later it starts nothing on figures that have gone old.
48
- */
49
- export const oneTurnAtATime = (turn, limitMs) => {
50
- let going = null;
51
- let again = false;
52
- let current = 0;
53
- const trigger = () => {
54
- if (going !== null) {
55
- again = true;
56
- return going;
57
- }
58
- current += 1;
59
- const mine = current;
60
- let timer;
61
- const limit = new Promise((_, reject) => {
62
- timer = setTimeout(() => reject(new Error(`a turn of the trigger was abandoned after ${limitMs / 1000} s`)), limitMs);
63
- });
64
- going = Promise.race([turn(() => current === mine), limit]).finally(() => {
65
- clearTimeout(timer);
66
- current += 1;
67
- going = null;
68
- if (again) {
69
- again = false;
70
- void trigger().catch(() => undefined);
71
- }
72
- });
73
- return going;
74
- };
75
- return trigger;
76
- };
77
- /** A run's id: the time it was made, and a random tail so two made in one millisecond differ. */
78
- export const newRunId = () => `${Date.now().toString(36)}${Math.floor(Math.random() * 1296).toString(36).padStart(2, '0')}`;
79
- //# sourceMappingURL=keep-running.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"keep-running.js","sourceRoot":"","sources":["../../../src/keep-running.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AACH,OAAO,EAAE,sBAAs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,CAAC,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC,QAAQ,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,EAAE,GAAG,IAAI,CAAC,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC,EAAE,CAAC"}
@@ -1,31 +0,0 @@
1
- /**
2
- * A RUN AN OUTSIDE SERVICE FAILED IS NO TRY. A task is blocked after `BLOCK_AFTER_TRIES` failed tries (`tasks.ts`), and
3
- * only a run that did its work and ended without success is one. A run that failed because a service outside it could
4
- * not do the work (a Claude usage limit, a model server that does not answer) says nothing about its item: counted, two
5
- * weekly-limit failures took an item of skill-sync's skill refinement workflow from 9 tries to 11, and it was blocked
6
- * for good once the limit reset (2026-11-25).
7
- *
8
- * A step says so by failing with `OutsideServiceUnavailable`. Claude's own usage-limit and rate-limit words are read the
9
- * same way whatever error carries them, so outcomes recorded before this error existed count right too.
10
- *
11
- * The task store counts tries in SQL, from each outcome's text (`storage/sqlite-store.ts`): `OUTSIDE_FAILURE_PATTERNS`
12
- * are its `LIKE` patterns, which SQLite matches without regard to ASCII case, and `isOutsideFailure` reads them the same
13
- * way in code.
14
- */
15
- import { Data } from 'effect';
16
- /** What a step fails with when a service outside it could not do its work: its run's outcome is no try. */
17
- export class OutsideServiceUnavailable extends Data.TaggedError('OutsideServiceUnavailable') {
18
- }
19
- /** The outcomes of runs an outside service failed, as SQL `LIKE` patterns on an outcome's text. */
20
- export const OUTSIDE_FAILURE_PATTERNS = [
21
- 'failed: OutsideServiceUnavailable:%',
22
- // Claude's own words: "You've hit your weekly limit · resets 6am (UTC)", "Claude usage limit reached", a 429's "rate limit".
23
- 'failed: %hit your % limit%',
24
- 'failed: %usage limit%',
25
- 'failed: %rate limit%',
26
- ];
27
- const asRegExp = (pattern) => new RegExp(`^${pattern.split('%').map((part) => part.replace(/[.*+?^$()|[\]\\{}_]/g, (c) => (c === '_' ? '.' : `\\${c}`))).join('.*')}$`, 'is');
28
- const OUTSIDE_FAILURES = OUTSIDE_FAILURE_PATTERNS.map(asRegExp);
29
- /** Whether a run's outcome says an outside service failed it, as the task store reads it. */
30
- export const isOutsideFailure = (outcome) => OUTSIDE_FAILURES.some((p) => p.test(outcome));
31
- //# sourceMappingURL=outside-failure.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"outside-failure.js","sourceRoot":"","sources":["../../../src/outside-failure.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AACH,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAE9B,2GAA2G;AAC3G,MAAM,OAAO,yBAA0B,SAAQ,IAAI,CAAC,WAAW,CAAC,2BAA2B,CAKzF;CAAG;AAEL,mGAAmG;AACnG,MAAM,CAAC,MAAM,wBAAwB,GAA0B;IAC7D,qCAAqC;IACrC,6HAA6H;IAC7H,4BAA4B;IAC5B,uBAAuB;IACvB,sBAAsB;CACvB,CAAC;AAEF,MAAM,QAAQ,GAAG,CAAC,OAAe,EAAU,EAAE,CAC3C,IAAI,MAAM,CAAC,IAAI,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,OAAO,CAAC,sBAAsB,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,KAAK,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC;AAClJ,MAAM,gBAAgB,GAAG,wBAAwB,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;AAEhE,6FAA6F;AAC7F,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,OAAe,EAAW,EAAE,CAAC,gBAAgB,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC"}
@@ -1,125 +0,0 @@
1
- /**
2
- * WHAT WAKES A PICK THAT FOUND NOTHING IT CAN CLAIM (`steps.ts` `untilPicked`), never a timer. A wake is any event that can
3
- * change what a Pick can claim: a note on one of its workflow's tasks (new input, a reopen, a release, a hold, an outcome:
4
- * `tasks.ts`), an item new to its list (`recordListing`), its limits set (which also has the run planner plan
5
- * again: `runPlanChanged`), an agent step of its runs ending, which frees an agent for a task marked as needing one
6
- * (`steps.ts` `whyNoAgentIsFree`), or one of its runs ending, which lets that run's claim go. A claim held outside its workflow's runs ending, or a lease running out, wakes nothing: the next of these events
7
- * re-checks it. Before 2026-11-11 a Pick with nothing picked again each minute, and at budget 0 it ended its run at once:
8
- * the first project's main workflow then ran Pick and Finish about once a second, 17,844 times in 6 hours.
9
- *
10
- * EVERY WAKE NAMES ITS SOURCE, and each minute the log says, per workflow, how many wakes came from where and how many
11
- * re-picks they cost (`[pick wakes]`): a waiting Pick that keeps picking again shows the event doing it (2026-11-12: the
12
- * job runner spent 84-90% of its thread in re-picks, and nothing said what woke them).
13
- *
14
- * Wakes reach the Picks of the process that raised them: an event in another process wakes nothing here.
15
- */
16
- import { Effect } from 'effect';
17
- const SUMMARY_MS = 60_000;
18
- export const makePickWakes = () => {
19
- const waiters = new Set();
20
- const wakesOfWorkflow = new Map();
21
- let wakesOfEvery = 0;
22
- /** This minute's wakes, by workflow and source, and the re-picks they cost. */
23
- const wakesBySource = new Map();
24
- const rePicks = new Map();
25
- const countWake = (workflow, source) => {
26
- const sources = wakesBySource.get(workflow) ?? new Map();
27
- sources.set(source, (sources.get(source) ?? 0) + 1);
28
- wakesBySource.set(workflow, sources);
29
- };
30
- setInterval(() => {
31
- for (const workflow of new Set([...wakesBySource.keys(), ...rePicks.keys()])) {
32
- const sources = [...(wakesBySource.get(workflow) ?? new Map())].map(([source, n]) => `${n} ${source}`).join(', ');
33
- const picked = rePicks.get(workflow);
34
- console.log(`[pick wakes] pid ${process.pid}, ${workflow} in the last minute: wakes ${sources === '' ? 'none' : sources}; ${picked === undefined ? 'no re-pick' : `${picked.count} re-picks taking ${Math.round(picked.ms)} ms`}`);
35
- }
36
- wakesBySource.clear();
37
- rePicks.clear();
38
- }, SUMMARY_MS).unref();
39
- const pickWakesSoFar = (workflow) => (wakesOfWorkflow.get(workflow) ?? 0) + wakesOfEvery;
40
- /**
41
- * Wakes the waiting Picks after the code that called it has finished: a note written in a transaction is committed
42
- * before any Pick reads the tasks again.
43
- */
44
- const wake = (reaches) => {
45
- queueMicrotask(() => {
46
- for (const waiter of [...waiters])
47
- if (reaches(waiter))
48
- waiter.wake();
49
- });
50
- };
51
- let relay = null;
52
- const runPlanListeners = new Set();
53
- const wakeListeners = new Set();
54
- let released = false;
55
- const wakeHere = (w) => {
56
- for (const listener of wakeListeners)
57
- queueMicrotask(() => listener(w));
58
- if (w.runPlan === true)
59
- for (const listener of runPlanListeners)
60
- queueMicrotask(() => listener(w.workflow));
61
- if (w.workflow === null) {
62
- wakesOfEvery += 1;
63
- countWake('every workflow', w.source);
64
- wake(() => true);
65
- return;
66
- }
67
- const workflow = w.workflow;
68
- wakesOfWorkflow.set(workflow, (wakesOfWorkflow.get(workflow) ?? 0) + 1);
69
- countWake(workflow, w.source);
70
- wake((waiter) => waiter.workflow === workflow);
71
- };
72
- const raise = (w) => {
73
- wakeHere(w);
74
- if (relay !== null)
75
- relay(w);
76
- };
77
- return {
78
- pickWakesSoFar,
79
- wakePicksOf: (workflow, source) => raise({ workflow, source }),
80
- wakeEveryPick: (source) => raise({ workflow: null, source }),
81
- runPlanChanged: ({ workflow, source }) => raise({ workflow, source, runPlan: true }),
82
- onRunPlanChanged: (listener) => {
83
- runPlanListeners.add(listener);
84
- },
85
- onWake: (listener) => {
86
- wakeListeners.add(listener);
87
- },
88
- relayTo: (send) => {
89
- relay = send;
90
- },
91
- wake: wakeHere,
92
- handingOver: () => released,
93
- releaseWaiting: () => {
94
- released = true;
95
- for (const waiter of [...waiters])
96
- waiter.release();
97
- },
98
- untilPickWoken: (input) => Effect.callback((resume) => {
99
- if (released)
100
- return resume(Effect.succeed('released'));
101
- if (pickWakesSoFar(input.workflow) !== input.after)
102
- return resume(Effect.succeed('woken'));
103
- const waiter = {
104
- workflow: input.workflow,
105
- wake: () => {
106
- waiters.delete(waiter);
107
- resume(Effect.succeed('woken'));
108
- },
109
- release: () => {
110
- waiters.delete(waiter);
111
- resume(Effect.succeed('released'));
112
- },
113
- };
114
- waiters.add(waiter);
115
- return Effect.sync(() => {
116
- waiters.delete(waiter);
117
- });
118
- }),
119
- countRePick: (workflow, ms) => {
120
- const was = rePicks.get(workflow) ?? { count: 0, ms: 0 };
121
- rePicks.set(workflow, { count: was.count + 1, ms: was.ms + ms });
122
- },
123
- };
124
- };
125
- //# sourceMappingURL=pick-wakes.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"pick-wakes.js","sourceRoot":"","sources":["../../../src/pick-wakes.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AACH,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AA0DhC,MAAM,UAAU,GAAG,MAAM,CAAC;AAE1B,MAAM,CAAC,MAAM,aAAa,GAAG,GAAc,EAAE;IAC3C,MAAM,OAAO,GAAG,IAAI,GAAG,EAAU,CAAC;IAClC,MAAM,eAAe,GAAG,IAAI,GAAG,EAAkB,CAAC;IAClD,IAAI,YAAY,GAAG,CAAC,CAAC;IACrB,+EAA+E;IAC/E,MAAM,aAAa,GAAG,IAAI,GAAG,EAA+B,CAAC;IAC7D,MAAM,OAAO,GAAG,IAAI,GAAG,EAAyC,CAAC;IAEjE,MAAM,SAAS,GAAG,CAAC,QAAgB,EAAE,MAAc,EAAQ,EAAE;QAC3D,MAAM,OAAO,GAAG,aAAa,CAAC,GAAG,CAAC,QAAQ,CAAC,IAAI,IAAI,GAAG,EAAkB,CAAC;QACzE,OAAO,CAAC,GAAG,CAAC,MAAM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C,EAAE,GAAG,EAAE,EAAE,CAAC,CAAC;QACnE,CAAC;KACF,CAAC;AACJ,CAAC,CAAC"}
package/dist/project.js DELETED
@@ -1 +0,0 @@
1
- //# sourceMappingURL=project.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"project.js","sourceRoot":"","sources":["../../../src/project.ts"],"names":[],"mappings":""}
@@ -1,51 +0,0 @@
1
- /**
2
- * EACH QUEUE'S COUNTS, RECORDED WHEN ITS QUEUE MAY HAVE CHANGED (`queue_counts`), so a page reads the newest row and its
3
- * history and never counts. A workflow's tasks by status are read from its tasks' notes (`tasks.ts` `taskSummaries`), once
4
- * per change, in the one process that runs the project's workflows. A count only counts: blocking a task is its Pick's
5
- * step, never a page's or this (`tasks.ts` `settleQueue`).
6
- *
7
- * WHAT COUNTS AS A CHANGE: every wake of a workflow's Picks (`pick-wakes.ts`: a note on one of its tasks, an item new to
8
- * its list, one of its runs ending, a limit set), and a Pick claiming an item (`changed`). Every change within
9
- * `COUNT_AFTER_MS` of the first is one count, taken at its end, so 25 short runs ending a minute cost 12 counts and each
10
- * change shows within 5 seconds. A row is written only where a count moved.
11
- */
12
- import { Effect } from 'effect';
13
- import { statusCounts } from './tasks';
14
- /** How long after a queue's first change it is counted: every change in that time is in the one count. */
15
- export const COUNT_AFTER_MS = 5_000;
16
- /**
17
- * The count recorded beside the four statuses: how many queued tasks are marked as needing an agent (`tasks.ts`
18
- * `TaskSummary.needsAgent`). Part of `queued`, never an addend of its own: a page shows it beside that row.
19
- */
20
- export const QUEUED_NEEDING_AN_AGENT = 'queued, needing an agent';
21
- export const makeQueueCounts = (deps) => {
22
- /** Counts one workflow's queue now and records it. */
23
- const count = (workflow) => Effect.gen(function* () {
24
- const summaries = yield* deps.tasks.taskSummaries({ workflow });
25
- const counts = { ...statusCounts(summaries), [QUEUED_NEEDING_AN_AGENT]: summaries.filter((t) => t.status === 'queued' && t.needsAgent !== null).length };
26
- yield* deps.store.recordQueueCounts({ at: Date.now() / 1000, counts: Object.entries(counts).map(([bucket, tasks]) => ({ workflow, bucket, tasks })) });
27
- });
28
- let countSoon = () => undefined;
29
- /**
30
- * Starts recording: for the one process that runs the project's workflows, which gives `run`, how it runs an effect of
31
- * theirs. Every queue is counted once at the start, then each on its changes.
32
- */
33
- const record = (run) => {
34
- const due = new Set();
35
- countSoon = (workflow) => {
36
- if (due.has(workflow) || !deps.withQueues().includes(workflow))
37
- return;
38
- due.add(workflow);
39
- setTimeout(() => {
40
- due.delete(workflow);
41
- void run(count(workflow)).catch((e) => console.error(`[queue counts] ${workflow}: not counted: ${e instanceof Error ? e.message : String(e)}`));
42
- }, deps.countAfterMs ?? COUNT_AFTER_MS).unref?.();
43
- };
44
- deps.wakes.onWake((wake) => { for (const workflow of wake.workflow === null ? deps.withQueues() : [wake.workflow])
45
- countSoon(workflow); });
46
- for (const workflow of deps.withQueues())
47
- countSoon(workflow);
48
- };
49
- return { count, record, changed: (workflow) => countSoon(workflow) };
50
- };
51
- //# sourceMappingURL=queue-counts.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"queue-counts.js","sourceRoot":"","sources":["../../../src/queue-counts.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAIhC,OAAO,EAAE,YAAY,EAAc,MAAM,SAAS,CAAC;AAEnD,0GAA0G;AAC1G,MAAM,CAAC,MAAM,cAAc,GAAG,KAAK,CAAC;AAEpC;;;GAGG;AACH,MAAM,CAAC,MAAM,uBAAuB,GAAG,0BAA0B,CAAC;AAElE,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,IAQ/B,EAAE,EAAE;IACH,sDAAsD;IACtD,MAAM,KAAK,GAAG,CAAC,QAAgB,EAAqC,EAAE,CAAC,MAAM,CAAC,GAAG,CAAC,QAAQ,CAAC;QACzF,MAAM,SAAS,GAAG,KAAK,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,aAAa,CAAC,EAAE,QAAQ,E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kB,CAAC,YAAY,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;YAC3J,CAAC,EAAE,IAAI,CAAC,YAAY,IAAI,cAAc,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC;QACpD,CAAC,CAAC;QACF,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,GAAG,KAAK,MAAM,QAAQ,IAAI,IAAI,CAAC,QAAQ,KAAK,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,UAAU,EAAE,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC;YAAE,SAAS,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QAC3I,KAAK,MAAM,QAAQ,IAAI,IAAI,CAAC,UAAU,EAAE;YAAE,SAAS,CAAC,QAAQ,CAAC,CAAC;IAChE,CAAC,CAAC;IAEF,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC,QAAgB,EAAQ,EAAE,CAAC,SAAS,CAAC,QAAQ,CAAC,EAAE,CAAC;AACrF,CAAC,CAAC"}
package/dist/reasons.js DELETED
@@ -1,33 +0,0 @@
1
- /**
2
- * WHY A STEP ENDED AS IT DID, IN A LINE, on every step record: what outcomes are counted by, per workflow and step. A step
3
- * can say how its result gives its reason (`defineStep`'s `reason`); otherwise `standardReason` reads it from the result's
4
- * own words. A failure's reason is its error's first line, and an interruption's is "interrupted". Dependency-free, so a
5
- * page can import it.
6
- */
7
- /** The most a reason keeps, so reasons compare and count. */
8
- export const REASON_CHARACTERS = 160;
9
- /** A text as one comparable line: its first line, cut short. Pure. */
10
- export const oneLine = (text) => {
11
- const first = text.trim().split('\n')[0].trim();
12
- return first.length <= REASON_CHARACTERS ? first : `${first.slice(0, REASON_CHARACTERS - 1)}…`;
13
- };
14
- /**
15
- * A result's reason, read from its own words: a text is its own reason; an object gives its `reason`, `why` or `outcome`,
16
- * the first that is a text; an empty `Option` or none found nothing; anything else succeeded with no words of its own. Pure.
17
- */
18
- export const standardReason = (result) => {
19
- if (typeof result === 'string')
20
- return oneLine(result);
21
- if (result === null || result === undefined)
22
- return 'found nothing';
23
- if (typeof result === 'object') {
24
- const r = result;
25
- for (const words of [r.reason, r.why, r.outcome])
26
- if (typeof words === 'string' && words.trim() !== '')
27
- return oneLine(words);
28
- if (r._tag === 'None')
29
- return 'found nothing';
30
- }
31
- return 'succeeded';
32
- };
33
- //# sourceMappingURL=reasons.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"reasons.js","sourceRoot":"","sources":["../../../src/reasons.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,6DAA6D;AAC7D,MAAM,CAAC,MAAM,iBAAiB,GAAG,GAAG,CAAC;AAErC,sEAAsE;AACtE,MAAM,CAAC,MAAM,OAAO,GAAG,CAAC,IAAY,EAAU,EAAE;IAC9C,MAAM,KAAK,GAAG,IAAI,CAAC,IAAI,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,CAAE,CAAC,IAAI,EAAE,CAAC;IACjD,OAAO,KAAK,CAAC,MAAM,IAAI,iBAAiB,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC,KAAK,CAAC,CAAC,EAAE,iBAAiB,GAAG,CAAC,CAAC,GAAG,CAAC;AACjG,CAAC,CAAC;AAEF;;;GAGG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,MAAe,EAAU,EAAE;IACxD,IAAI,OAAO,MAAM,KAAK,QAAQ;QAAE,OAAO,OAAO,CAAC,MAAM,CAAC,CAAC;IACvD,IAAI,MAAM,KAAK,IAAI,IAAI,MAAM,KAAK,SAAS;QAAE,OAAO,eAAe,CAAC;IACpE,IAAI,OAAO,MAAM,KAAK,QAAQ,EAAE,CAAC;QAC/B,MAAM,CAAC,GAAG,MAAoH,CAAC;QAC/H,KAAK,MAAM,KAAK,IAAI,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC,GAAG,EAAE,CAAC,CAAC,OAAO,CAAC;YAAE,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,CAAC,IAAI,EAAE,KAAK,EAAE;gBAAE,OAAO,OAAO,CAAC,KAAK,CAAC,CAAC;QAC9H,IAAI,CAAC,CAAC,IAAI,KAAK,MAAM;YAAE,OAAO,eAAe,CAAC;IAChD,CAAC;IACD,OAAO,WAAW,CAAC;AACrB,CAAC,CAAC"}
package/dist/retention.js DELETED
@@ -1,59 +0,0 @@
1
- /**
2
- * RETENTION: A RUN'S RECORDS GO ONCE THE RUN HAS BEEN OVER LONGER THAN ITS STEPS KEEP THEM, AND IS NOT ONE OF EACH STEP'S
3
- * NEWEST. Alex, 2026-11-21: "time based retention is a good idea. it should be configurable at the highest level with
4
- * allowed step level overrides ... i think 7 days sounds reasonable." Then, 2026-11-22: "a project might complete or stall
5
- * but we shouldn't lose run data in that case", and "10k runs". How long, and how many runs at least, is each step's own
6
- * setting, else its workflow's, from the top down, else the app's (`settings.ts`), stored while the app runs or in code; 7
7
- * days and 10,000 runs where nothing sets them. There is no most a step keeps.
8
- *
9
- * What goes: each step record and its per-item parts (`step_runs`, `step_functions`), once every record of its run has
10
- * ended that long ago, the engine has the run finished, and the run is none of that step's newest kept at least; and, for a
11
- * workflow whose tasks are its runs (`steps.ts` `tasksAreRuns`), each run's task with its notes, as its workflow keeps them,
12
- * its newest kept at least the same way. An item's task (a function Decompile works on: queued, in progress, blocked or done)
13
- * is the work's state, not its history, and never goes. Records of a step no longer declared go as its workflow keeps them,
14
- * and those of a workflow no longer declared as the app keeps them.
15
- *
16
- * No app runs it: the platform's own workflow Retention does, on a schedule (`system-workflows.ts`), so each pass is
17
- * measured and recorded like any other step's work.
18
- */
19
- import { Effect } from 'effect';
20
- import { appSetting, stepSetting, workflowSetting } from './settings';
21
- import { tasksAreRuns } from './steps';
22
- const SECONDS_A_DAY = 86_400;
23
- export const makeRetention = (deps) => {
24
- /** One pass at `now`, unix seconds: what each record's step keeps, applied to every declared workflow and the rest. */
25
- const prune = (now) => Effect.gen(function* () {
26
- const declared = deps.declared();
27
- const tree = { declared, app: deps.app, stored: yield* deps.stored() };
28
- // A run the engine has not finished keeps every record and its task, however old: its next step reads them.
29
- const keepRuns = (yield* deps.engine.unfinishedRuns()).map((u) => u.run);
30
- const before = (days) => now - days * SECONDS_A_DAY;
31
- let pass = { records: 0, parts: 0, runTasks: 0, runTaskNotes: 0 };
32
- const add = (more) => {
33
- pass = { records: pass.records + (more.records ?? 0), parts: pass.parts + (more.parts ?? 0), runTasks: pass.runTasks + (more.runTasks ?? 0), runTaskNotes: pass.runTaskNotes + (more.runTaskNotes ?? 0) };
34
- };
35
- for (const d of declared) {
36
- const steps = d.steps();
37
- for (const s of steps) {
38
- const at = { workflow: d.name, step: s.name };
39
- add(yield* deps.records.deleteRecordsOfRunsEndedBefore({
40
- select: at, before: before(stepSetting(tree, { ...at, name: 'retentionDays' }).value), keepRuns, keepNewest: stepSetting(tree, { ...at, name: 'keepAtLeastRuns' }).value,
41
- }));
42
- }
43
- const workflowKeeps = { days: workflowSetting(tree, { workflow: d.name, name: 'retentionDays' }).value, atLeastRuns: workflowSetting(tree, { workflow: d.name, name: 'keepAtLeastRuns' }).value };
44
- add(yield* deps.records.deleteRecordsOfRunsEndedBefore({ select: { workflow: d.name, stepsOtherThan: steps.map((s) => s.name) }, before: before(workflowKeeps.days), keepRuns, keepNewest: workflowKeeps.atLeastRuns }));
45
- if (tasksAreRuns(d, declared)) {
46
- const gone = yield* deps.tasks.deleteRunTasksEndedBefore({ workflow: d.name, before: before(workflowKeeps.days), keepItems: keepRuns, keepNewest: workflowKeeps.atLeastRuns });
47
- add({ runTasks: gone.tasks, runTaskNotes: gone.notes });
48
- if (gone.tasks > 0)
49
- deps.queueChanged(d.name);
50
- }
51
- }
52
- add(yield* deps.records.deleteRecordsOfRunsEndedBefore({
53
- select: { workflowsOtherThan: declared.map((d) => d.name) }, before: before(appSetting(tree, 'retentionDays').value), keepRuns, keepNewest: appSetting(tree, 'keepAtLeastRuns').value,
54
- }));
55
- return pass;
56
- });
57
- return { prune };
58
- };
59
- //# sourceMappingURL=retention.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"retention.js","sourceRoot":"","sources":["../../../src/retention.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AACH,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAChC,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,eAAe,EAAmF,MAAM,YAAY,CAAC;AACvJ,OAAO,EAAE,YAAY,EAAkD,MAAM,SAAS,CAAC;AAcvF,MAAM,aAAa,GAAG,MAAM,CAAC;AAO7B,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,IAY7B,EAAE,EAAE;IACH,uHAAuH;IACvH,MAAM,KAAK,GAAG,CAAC,GAAW,EAA8C,EAAE,CAAC,MAAM,CAAC,GAAG,CAAC,QAAQ,CAAC;QAC7F,MAAM,QAAQ,GAAG,IAAI,CAAC,QAAQ,EAAE,CAAC;QACjC,MAAM,IAAI,GAAiB,EAAE,QAAQ,EAAE,GAAG,EAAE,IAAI,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,CAAC,CAAC,IAAI,CAAC,MAAM,EAAE,EAAE,CAAC;QACrF,4GAA4G;QAC5G,MAAM,QAAQ,GAAG,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,cAAc,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;QACzE,MAAM,MAAM,GAAG,CAAC,IAAY,EAAE,EAAE,CAAC,GAAG,GAAG,IAAI,GAAG,aAAa,CAAC;QAC5D,IAAI,IAAI,GAAkB,EAAE,OAAO,EAAE,CAAC,EAAE,KAAK,EAAE,CAAC,EA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AE,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,EAAE,EAAE,MAAM,EAAE,MAAM,CAAC,UAAU,CAAC,IAAI,EAAE,eAAe,CAAC,CAAC,KAAK,CAAC,EAAE,QAAQ,EAAE,UAAU,EAAE,UAAU,CAAC,IAAI,EAAE,iBAAiB,CAAC,CAAC,KAAK;SACtL,CAAC,CAAC,CAAC;QACJ,OAAO,IAAI,CAAC;IACd,CAAC,CAAC,CAAC;IACH,OAAO,EAAE,KAAK,EAAE,CAAC;AACnB,CAAC,CAAC"}
package/dist/settings.js DELETED
@@ -1,88 +0,0 @@
1
- /**
2
- * Each setting where neither the app nor any workflow or step sets it: records kept 7 days, and each step's newest 10,000
3
- * runs however old (Alex, 2026-11-22: "10k runs"); no model, which an agent step cannot run without.
4
- */
5
- export const PLATFORM_DEFAULTS = { retentionDays: 7, keepAtLeastRuns: 10_000, model: null };
6
- /** The settings a page may set while the app runs; the model is set in code alone. */
7
- export const RUNTIME_SETTINGS = ['retentionDays', 'keepAtLeastRuns'];
8
- /** A level as one comparable text, each part its own segment. Pure. */
9
- const levelKey = (l) => (l.kind === 'app' ? 'app' : l.kind === 'workflow' ? `workflow\u0000${l.workflow}` : `step\u0000${l.workflow}\u0000${l.step}`);
10
- /** Whether two levels are one. Pure. */
11
- export const sameLevel = (a, b) => levelKey(a) === levelKey(b);
12
- /** The value stored at a level now, where one is and it is not back to the code's. Pure. */
13
- export const storedAt = (stored, level, name) => {
14
- const found = stored.find((s) => s.name === name && sameLevel(s.level, level));
15
- return found === undefined ? null : found.value;
16
- };
17
- /** A level's own value: what is stored there now, else what its code sets. */
18
- const ownAt = (tree, level, name, code) => {
19
- const stored = storedAt(tree.stored, level, name);
20
- return (stored !== null ? stored : code);
21
- };
22
- /** A setting above every workflow: the app's, stored or in code, else the platform's default. Pure. */
23
- export const appSetting = (tree, name) => {
24
- const own = ownAt({ ...tree, declared: [] }, { kind: 'app' }, name, tree.app[name]);
25
- return own !== undefined ? { value: own, setOn: { kind: 'app' } } : { value: PLATFORM_DEFAULTS[name], setOn: { kind: 'platform default' } };
26
- };
27
- /** Two parents of a workflow that would hand it different values: the declarations are at fault, said once. */
28
- const faultsSaid = new Set();
29
- /**
30
- * A WORKFLOW'S VALUE OF A SETTING: its own, else from the step that holds it in the workflow above (that step's own, else
31
- * that workflow's), up to the top, else the app's, else the platform's default. A workflow held by two workflows that hand
32
- * it different values is a fault in their declarations: in tests it throws; live, it is said once, and the first, in the
33
- * order declared, holds. Pure but for that.
34
- */
35
- export const workflowSetting = (tree, r, seen = new Set()) => {
36
- const own = ownAt(tree, { kind: 'workflow', workflow: r.workflow }, r.name, tree.declared.find((x) => x.name === r.workflow)?.[r.name]);
37
- if (own !== undefined)
38
- return { value: own, setOn: { kind: 'workflow', workflow: r.workflow } };
39
- const fallback = appSetting(tree, r.name);
40
- if (seen.has(r.workflow))
41
- return fallback;
42
- const under = new Set([...seen, r.workflow]);
43
- const fromAbove = tree.declared.flatMap((parent) => parent.steps().filter((s) => s.workflow === r.workflow).map((s) => {
44
- const set = ownAt(tree, { kind: 'step', workflow: parent.name, step: s.name }, r.name, s[r.name]);
45
- return set !== undefined ? { value: set, setOn: { kind: 'step', workflow: parent.name, step: s.name } } : workflowSetting(tree, { workflow: parent.name, name: r.name }, under);
46
- }));
47
- const first = fromAbove[0];
48
- if (first === undefined)
49
- return fallback;
50
- const other = fromAbove.find((x) => x.value !== first.value);
51
- if (other !== undefined) {
52
- const fault = `${r.workflow} is a step of workflows that hand it different values of ${r.name}: ${String(first.value)} and ${String(other.value)}`;
53
- if (process.env.NODE_ENV === 'test')
54
- throw new Error(fault);
55
- if (!faultsSaid.has(fault)) {
56
- faultsSaid.add(fault);
57
- console.error(`[settings] ${fault}; the first holds`);
58
- }
59
- }
60
- return first;
61
- };
62
- /** A step's value of a setting: its own, else its workflow's (`workflowSetting`). */
63
- export const stepSetting = (tree, r) => {
64
- const own = ownAt(tree, { kind: 'step', workflow: r.workflow, step: r.step }, r.name, tree.declared.find((x) => x.name === r.workflow)?.steps().find((s) => s.name === r.step)?.[r.name]);
65
- if (own !== undefined)
66
- return { value: own, setOn: { kind: 'step', workflow: r.workflow, step: r.step } };
67
- return workflowSetting(tree, { workflow: r.workflow, name: r.name });
68
- };
69
- /** Why a retention setting's value is refused, none where it is good: days a positive number, runs a whole number from 0. Pure. */
70
- export const settingValueRefusal = (name, value) => name === 'retentionDays'
71
- ? (Number.isFinite(value) && value > 0 ? null : `its records must be kept a positive number of days, not ${value}`)
72
- : (Number.isInteger(value) && value >= 0 ? null : `the runs it keeps at least must be a whole number from 0, not ${value}`);
73
- /** Settings as written on the app, a workflow or a step, checked there (`settingValueRefusal`), a model a name. */
74
- export const checkedSettings = (d) => {
75
- for (const name of RUNTIME_SETTINGS) {
76
- const value = d[name];
77
- const refusal = value === undefined ? null : settingValueRefusal(name, value);
78
- if (refusal !== null)
79
- throw new Error(`${d.what}: ${refusal}`);
80
- }
81
- if (d.model !== undefined && d.model.trim() === '')
82
- throw new Error(`${d.what}: its model is an empty name`);
83
- return {
84
- ...(d.retentionDays === undefined ? {} : { retentionDays: d.retentionDays }), ...(d.keepAtLeastRuns === undefined ? {} : { keepAtLeastRuns: d.keepAtLeastRuns }),
85
- ...(d.model === undefined ? {} : { model: d.model }),
86
- };
87
- };
88
- //# sourceMappingURL=settings.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"settings.js","sourceRoot":"","sources":["../../../src/settings.ts"],"names":[],"mappings":"AAwCA;;;GAGG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAkB,EAAE,aAAa,EAAE,CAAC,EAAE,eAAe,EAAE,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;AAE3G,sFAAsF;AACtF,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,eAAe,EAAE,iBAAiB,CAAU,CAAC;AAyC9E,uEAAuE;AACvE,MAAM,QAAQ,GAAG,CAAC,CA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