@giamme/forge 0.21.0 → 0.23.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 (165) hide show
  1. package/CHANGELOG.md +81 -0
  2. package/README.md +25 -15
  3. package/SKILL.md +137 -216
  4. package/VERSION +1 -1
  5. package/bin/forge.js +104 -0
  6. package/docs/README.md +2 -3
  7. package/docs/add-ons.md +5 -3
  8. package/docs/artifacts.md +17 -2
  9. package/docs/commands.md +85 -63
  10. package/docs/decomposed-runs.md +195 -21
  11. package/docs/development.md +12 -10
  12. package/docs/forge-ui.md +33 -4
  13. package/docs/install.md +127 -6
  14. package/docs/memory.md +6 -1
  15. package/docs/models.md +36 -10
  16. package/docs/reviews.md +50 -29
  17. package/docs/safety.md +27 -2
  18. package/docs/troubleshooting.md +8 -11
  19. package/forge +29 -4
  20. package/forge.cmd +56 -0
  21. package/package.json +6 -3
  22. package/references/dataset.md +10 -9
  23. package/references/decompose-integration.md +337 -0
  24. package/references/decompose-opt-in.md +527 -0
  25. package/references/decompose-recovery.md +569 -0
  26. package/references/decompose-review.md +256 -0
  27. package/references/decompose.md +99 -1606
  28. package/references/findings.md +68 -0
  29. package/references/harnesses.md +7 -12
  30. package/references/memory.md +13 -2
  31. package/references/planning.md +48 -18
  32. package/references/ripwire.md +38 -13
  33. package/references/runtime.md +22 -33
  34. package/references/setup.md +90 -0
  35. package/references/solo.md +13 -42
  36. package/references/ui.md +12 -5
  37. package/registry.tsv +40 -22
  38. package/scripts/forge-artifact.sh +148 -13
  39. package/scripts/forge-compare.py +5 -15
  40. package/scripts/forge-config.py +14 -1
  41. package/scripts/forge-contract.py +216 -53
  42. package/scripts/forge-control.py +781 -51
  43. package/scripts/forge-dispatch.sh +202 -42
  44. package/scripts/forge-du.py +13 -3
  45. package/scripts/forge-guard.py +137 -6
  46. package/scripts/forge-handoff.py +221 -39
  47. package/scripts/forge-install-ripwire.sh +100 -24
  48. package/scripts/forge-install.sh +100 -41
  49. package/scripts/forge-issues.py +6 -4
  50. package/scripts/forge-jev-options.sh +3 -5
  51. package/scripts/forge-lib-adopt.sh +169 -5
  52. package/scripts/forge-lib-attribute.sh +10 -3
  53. package/scripts/forge-lib-decompose.sh +454 -0
  54. package/scripts/forge-lib-env.sh +179 -0
  55. package/scripts/forge-lib-group.sh +9 -6
  56. package/scripts/forge-lib-plans.sh +38 -21
  57. package/scripts/forge-lib-review.sh +28 -8
  58. package/scripts/forge-lib-task.sh +263 -69
  59. package/scripts/forge-lib-verify.sh +59 -10
  60. package/scripts/forge-memory.sh +83 -4
  61. package/scripts/forge-metrics.sh +10 -3
  62. package/scripts/forge-parallel-options.sh +23 -4
  63. package/scripts/forge-parallel.sh +602 -217
  64. package/scripts/forge-plan-check.py +71 -8
  65. package/scripts/forge-planner.py +303 -17
  66. package/scripts/forge-pr.py +9 -1
  67. package/scripts/forge-prompt.py +2 -2
  68. package/scripts/forge-review-links.py +248 -0
  69. package/scripts/forge-ripwire.py +234 -16
  70. package/scripts/forge-route.py +19 -27
  71. package/scripts/forge-runs-rm.py +92 -21
  72. package/scripts/forge-runs.py +46 -5
  73. package/scripts/forge-runtime.py +39 -14
  74. package/scripts/forge-schedule.py +141 -33
  75. package/scripts/forge-setup-stale.py +236 -0
  76. package/scripts/forge-setup.py +804 -0
  77. package/scripts/forge-shadow.py +2 -20
  78. package/scripts/forge-solo-lock.py +46 -0
  79. package/scripts/forge-solo.sh +39 -58
  80. package/scripts/forge-sweep.py +3 -2
  81. package/scripts/forge-ui.py +8 -1
  82. package/scripts/forge-update.sh +8 -3
  83. package/scripts/forge-verify.py +17 -1
  84. package/scripts/forge-version.py +13 -1
  85. package/scripts/forge-watch.py +7 -2
  86. package/scripts/forge-win.sh +156 -0
  87. package/scripts/forge_brief/__init__.py +6 -1
  88. package/scripts/forge_brief/proposals.py +6 -1
  89. package/scripts/forge_dataset/__init__.py +1 -1
  90. package/scripts/forge_dataset/capture.py +0 -34
  91. package/scripts/forge_dataset/checks.py +0 -1
  92. package/scripts/forge_dataset/cli.py +5 -1
  93. package/scripts/forge_dataset/export.py +28 -6
  94. package/scripts/forge_dataset/facts.py +1 -2
  95. package/scripts/forge_dataset/forecast.py +1 -1
  96. package/scripts/forge_dataset/harvest.py +107 -7
  97. package/scripts/forge_dataset/importer.py +3 -2
  98. package/scripts/forge_dataset/pairs.py +3 -3
  99. package/scripts/forge_dataset/reviewers.py +4 -3
  100. package/scripts/forge_dataset/routing.py +6 -3
  101. package/scripts/forge_dataset/tiers.py +1 -1
  102. package/scripts/forge_decide/__init__.py +1 -1
  103. package/scripts/forge_decide/budget.py +12 -7
  104. package/scripts/forge_decide/profiles.py +11 -14
  105. package/scripts/forge_decide/replay.py +9 -4
  106. package/scripts/forge_decompose.py +987 -0
  107. package/scripts/forge_flock.py +17 -2
  108. package/scripts/forge_groups/review.py +6 -1
  109. package/scripts/forge_jev/__init__.py +1 -1
  110. package/scripts/forge_jev/cli.py +10 -1
  111. package/scripts/forge_jev/gates.py +10 -1
  112. package/scripts/forge_jev/verify.py +10 -2
  113. package/scripts/forge_legacy.py +86 -0
  114. package/scripts/forge_memory_home.py +57 -0
  115. package/scripts/forge_models.py +151 -0
  116. package/scripts/forge_posix.py +17 -0
  117. package/scripts/forge_prefs.py +138 -0
  118. package/scripts/forge_proc.py +108 -0
  119. package/scripts/forge_registry.py +2 -2
  120. package/scripts/forge_side/__init__.py +23 -4
  121. package/scripts/forge_storage.py +28 -15
  122. package/ui/README.md +22 -10
  123. package/ui/docs/api.md +121 -99
  124. package/ui/forge_ui/control.py +53 -16
  125. package/ui/forge_ui/export.py +0 -10
  126. package/ui/forge_ui/models.py +15 -2
  127. package/ui/forge_ui/projects.py +4 -1
  128. package/ui/forge_ui/reader.py +462 -60
  129. package/ui/forge_ui/server.py +0 -10
  130. package/ui/forge_ui/static/app.js +28 -9
  131. package/ui/forge_ui/static/checksview.js +12 -3
  132. package/ui/forge_ui/static/controls.js +147 -11
  133. package/ui/forge_ui/static/convo.js +5 -2
  134. package/ui/forge_ui/static/diffview.js +4 -5
  135. package/ui/forge_ui/static/panel.js +180 -77
  136. package/ui/forge_ui/static/projectsview.js +16 -2
  137. package/ui/forge_ui/static/runmodel.js +18 -4
  138. package/ui/forge_ui/static/scene3d.js +52 -31
  139. package/ui/forge_ui/static/settings.js +1 -1
  140. package/ui/forge_ui/static/storageview.js +2 -2
  141. package/ui/forge_ui/static/style.css +23 -6
  142. package/ui/forge_ui/static/worktreesview.js +8 -4
  143. package/ui/forge_ui/transcripts.py +6 -0
  144. package/ui/forge_ui/worktrees.py +13 -1
  145. package/docs/fractal.md +0 -181
  146. package/references/fractal-dashboard.md +0 -21
  147. package/references/fractal.md +0 -307
  148. package/scripts/forge-fractal-dispatch.sh +0 -4
  149. package/scripts/forge-fractal-options.sh +0 -54
  150. package/scripts/forge-fractal.py +0 -6
  151. package/scripts/forge-install-fractal.sh +0 -4
  152. package/scripts/forge_fractal/__init__.py +0 -88
  153. package/scripts/forge_fractal/bridge.py +0 -46
  154. package/scripts/forge_fractal/cli.py +0 -224
  155. package/scripts/forge_fractal/dashboard.css +0 -138
  156. package/scripts/forge_fractal/dashboard.html +0 -41
  157. package/scripts/forge_fractal/dashboard.js +0 -687
  158. package/scripts/forge_fractal/decomposition.py +0 -262
  159. package/scripts/forge_fractal/execution.py +0 -659
  160. package/scripts/forge_fractal/inspection.py +0 -261
  161. package/scripts/forge_fractal/install.py +0 -158
  162. package/scripts/forge_fractal/invocation.py +0 -95
  163. package/scripts/forge_fractal/pipeline.py +0 -125
  164. package/scripts/forge_fractal/selection.py +0 -180
  165. package/ui/forge_ui/fractal.py +0 -582
package/ui/docs/api.md CHANGED
@@ -3,7 +3,8 @@
3
3
  This file is the contract between the three parts of forge-ui. It is fixed for tasks and
4
4
  dwarves: implement it as written, and do not edit it as part of a task. Its owner revised it
5
5
  deliberately for 0.3.0 (executions, findings, final reviews, the lazy endpoints and the 3D view)
6
- and for 0.4.0 (diffs with pinned findings, the files heatmap, model facts and Fractal child tasks).
6
+ and for 0.4.0 (diffs with pinned findings, the files heatmap and model facts). forge 0.23 removed
7
+ Fractal and its endpoints, and added the subtasks of a split task (Decomposition, below).
7
8
 
8
9
  ```
9
10
  forge_ui/reader.py reads forge run dirs from disk, returns plain dicts (no I/O beyond reads)
@@ -11,7 +12,6 @@ forge_ui/executions.py the attempts/<role>-<uuid>/ dirs: parsing, nesting, atte
11
12
  forge_ui/findings.py QA findings and gate lines, parsed by scripts/forge-contract.py
12
13
  forge_ui/diffs.py unified diffs: parsing, the ```diff fence of a review prompt, pinning findings, cached reads
13
14
  forge_ui/models.py per-run model facts (attempts and reviews) for the leaderboard, cached per run
14
- forge_ui/fractal.py Fractal child tasks under $XDG_STATE_HOME/forge/fractal, read through dir fds
15
15
  forge_ui/transcripts.py an agent CLI's `<role>.log` read as one conversation, whichever harness wrote it
16
16
  forge_ui/checks.py the checks an agent ran, its running call and the environment problems it met, from a transcript
17
17
  forge_ui/server.py serves those dicts as JSON plus the static page, 127.0.0.1 only; authenticates writes
@@ -109,7 +109,10 @@ written), and the reader must never raise because of one.
109
109
  | `tasks/<id>/drift.txt`, `conflict.files` | one path per line: files the diff changed without declaring them; files that conflicted on merge |
110
110
  | `attempts/qa-<uuid>/qa.prompt` | the copy of the prompt a reviewer read; the diff it reviewed is its **last** fenced block: a line exactly ` ```diff `, the diff, a line exactly ` ``` ` (a section may follow) |
111
111
  | `final-review-*/combined.diff` | the diff a final review read, absent when larger than 400 KB (then not inlined in `qa.input`) |
112
- | `fractal-selection.json` | `{"enabled": true, "run": "run-<20 hex>"}` (or `enabled: false`): the run's Fractal choice, see Fractal below |
112
+ | `fractal-selection.json` | written by forge before 0.23 only: `{"enabled": true, …}` marks a run made with Fractal, which is read and never run again (RunSummary `removed`) |
113
+ | `decomposition.json` | `{version, nodes: {<task id>: {decision, reason, by, at, limits_used}}}`, and in a root plan also `limits: {depth, children, nodes}` and `frozen`: the split decisions of this plan's tasks (Decomposition below) |
114
+ | `tasks/<id>/sub/` | the subtasks of a split task: a plan dir of its own (`tasks.tsv`, `run_id` `<run>--<id>`, `tasks/…`) with `parent.json` `{task, run_id, start, by, at, reason}`. Beside it: `sub.merged` (the commit of the subtasks' work once it is on the task's branch), `sub.waiting` (the subtasks the task waits for, one per line), `sub.kept` (the commit `split=fresh` set aside) |
115
+ | `later.json`, `chain.json` | `{later: [{title, goal}]}`, the stages a planner proposed after this plan; `{stage, first, previous}`, where a plan made by `next` stands in its goal |
113
116
  | `tasks/<id>/route.jsonl` | one JSON object per line, one per routing decision: `at` (epoch), `task`, `tier`, `epsilon`, `candidates` (list of specs), `default` (spec), `chosen` (spec), `explored` (bool), `propensity` (probability the chosen spec had), `inputs` (object), `decision` (a short hash identifying the decision). Keep unknown fields |
114
117
  | `tasks/<id>/route.explored` | exists when the task's route was an exploratory pick |
115
118
  | `shadow/<id>/<attempt>-<k>/shadow.json` | JSON: `task`, `attempt`, `reviewed`, `primary`, `spec`, `pick` (`other_family`, `same_model`, `same_family` or `control`: identical to the primary), `started`. A second, never-read review of attempt `<attempt>` |
@@ -140,6 +143,14 @@ task that depends on one waits on it (it is not a stopped dependency). `status_c
140
143
  leaves it in `on` only. `PASS` is neither: it is saved and not merged yet, so a dependent
141
144
  still lists it.
142
145
 
146
+ A task whose `status` file says `RUNNING` reads as `INTERRUPTED` when the run dir records the forge
147
+ process that ran it (`scheduler.live` or `schedule.holder`) and none of it is running: neither the pid
148
+ in `scheduler.live` nor a `run` or `retry` command holding the plan lock (`schedule.holder`). That is a
149
+ run killed outright, which nothing could mark `INTERRUPTED` (#229). Its clock stops, the run and its
150
+ project stop counting as live, its worktrees stop being in use, and `scheduler.stale` and the task's
151
+ `waiting` name it and `forge handoff resume`. The reader writes nothing, and a run dir with neither file
152
+ reads as before.
153
+
143
154
  Only the ids listed in `tasks.tsv` are tasks: `tasks/` may also hold forge's own dirs (e.g.
144
155
  `tasks/_integration/`), and a task dir holds many other files (`attempts/` is a directory of
145
156
  receipts, not `attempts.tsv`), all of which the reader ignores.
@@ -217,9 +228,8 @@ def execution_transcript(path, name, source='plan') -> dict | None # an Executio
217
228
  def execution_checks(path, name, source='plan') -> dict | None # ExecutionChecks
218
229
  def task_checks(path, task_id, source='plan') -> dict | None # TaskChecks
219
230
  def run_environment(path, source='plan') -> dict | None # RunEnvironment
220
- def fractal_detail(path, task_id, source='plan') -> dict | None # a TaskFractal
221
- def fractal_node(path, task_id, node, source='plan') -> dict | None # a FractalNodeDetail
222
- def fractal_node_diff(path, task_id, node, source='plan') -> dict | None # a DiffDetail
231
+ def sub_plan(path, task_id) -> Path | None # the plan dir of a split task's subtasks
232
+ def sub_plans(path) -> list[Path] # every sub-plan under a plan, through every level
223
233
  def verification_log(path, lane=None, k=None, first=None, retry=False, source='plan') -> dict | None # a VerificationLog
224
234
 
225
235
  class Catalog:
@@ -234,8 +244,6 @@ class Catalog:
234
244
  def diff(self, key, task_id, which='current'), execution_diff(self, key, name),
235
245
  final_review_diff(self, key, name), files(self, key), findings(self, key), transcript(self, key, name),
236
246
  execution_checks(self, key, name), task_checks(self, key, task_id), environment(self, key),
237
- fractal(self, key, task_id),
238
- fractal_node(self, key, task_id, node), fractal_node_diff(self, key, task_id, node),
239
247
  verification_log(self, key, lane=None, k=None, first=None) -> dict | None
240
248
  def models(self) -> dict # Models, over every run
241
249
  def locate(self, key) -> tuple[str, str] | None # (run dir, 'plan' | 'solo'); None for an unknown key
@@ -303,6 +311,7 @@ its last 20,000 behind a leading `…`. Their `truncated` lists the field names
303
311
  | `POST /api/runs/<key>/issues/dismiss` | dismiss or (`undo`) restore findings; authenticated |
304
312
  | `POST /api/runs/<key>/delete` | dry-run or delete a run with `forge runs rm`; authenticated, 900 s timeout; later requests for the key answer `404` |
305
313
  | `POST /api/runs/<key>/tasks/<id>/answer` | answer a task that waits for input (`forge control retry … --answer-file -`); authenticated, see Controls |
314
+ | `POST /api/runs/<key>/tasks/<id>/steer` | queue a message for a task's next attempt, or with `now` send it to its running implementer (`forge control steer … --file - [--now]`); authenticated, see Controls |
306
315
  | `POST /api/worktrees/remove` | remove chosen worktrees (`forge worktrees rm`); authenticated, 900 s timeout |
307
316
  | `POST /api/projects/<id>/memories/forget` | forget learnings in a project's checkouts (`forge memory forget`); authenticated |
308
317
  | `POST /api/projects/<id>/memories/add` | add a learning in a project's checkouts (`forge memory add`); body `{path?, category, text, paths?}`; authenticated |
@@ -333,8 +342,6 @@ its last 20,000 behind a leading `…`. Their `truncated` lists the field names
333
342
  | `GET /api/config/profiles?run=<key>` | `200` every profile of that run's repository, each with its level, shadowed levels, default flag and body (see Profiles) |
334
343
  | `POST /api/config/profiles` | create, edit, set, unset, remove or select a profile through `forge config profile`; authenticated |
335
344
  | `GET /api/runs/<key>/export?texts=0\|1&paths=0\|1` | `200` the run as one HTML file (see Export), `Content-Disposition: attachment`, `Content-Security-Policy: default-src 'none'; sandbox`; `404` for an unknown run |
336
- | `GET /api/runs/<key>/tasks/<id>/fractal` | `200 TaskFractal` |
337
- | `GET /api/runs/<key>/tasks/<id>/fractal/nodes/<node>[/diff]` | `200 FractalNodeDetail`, or with `/diff` a `DiffDetail` of its `candidate.diff`; `<node>` matches `[A-Za-z0-9][A-Za-z0-9_-]{0,100}` |
338
345
  | `GET /` | `forge_ui/static/index.html` |
339
346
  | `GET /<name>` | that file from `forge_ui/static/` (`.html .js .css .svg` only, no subdirs) |
340
347
  | anything else | `404 {"error": "not found"}` (an unknown path or run); a method a path does not take (PUT, DELETE, OPTIONS, a POST to a read path): `405` with `Allow`, except that a GET to a path that only takes POST (`/api/runs/<key>/delete`, `/api/runs/<key>/issues/dismiss`) answers `404` |
@@ -342,8 +349,7 @@ its last 20,000 behind a leading `…`. Their `truncated` lists the field names
342
349
  The lazy endpoints answer `404 {"error": "not found"}` for an unknown run, task, group,
343
350
  execution or review; the diff endpoints also for a `<which>` the run kind has not (`existing`
344
351
  of a plan task, `prev` of a solo run), the diff and transcript endpoints for an execution that is
345
- not `qa` or `dwarf`; the
346
- Fractal node endpoints for an unknown node or a task whose Fractal state is not `available`. A
352
+ not `qa` or `dwarf`. A
347
353
  diff that is not there yet is a `200` with `available: false`. An execution is looked for only where executions are written:
348
354
  `attempts/`, `tasks/<id>/attempts/`, `shadow/<id>/<a>-<k>/attempts/`,
349
355
  `final-review-*/attempts/`, `integrate-*/final-review/attempts/` and `groups/<gid>/attempts/`,
@@ -430,6 +436,12 @@ nothing when there is none. Every other response keeps
430
436
  `accepted.integration` is missing; always `null` for a solo run. RunDetail keeps this field
431
437
  (it is not replaced by the newest review's `outdated`).
432
438
 
439
+ - `removed`: `null`, or `{name, since, note}` for a run made with a part of forge that no longer
440
+ exists (today `name` `Fractal`, `since` `0.23`). Such a run is read as any other and nothing can
441
+ run it again: the page shows `note` and offers no control that would.
442
+ - `parent`, `decomposition`: Decomposition, below. Both keys are **absent** on a plan that records
443
+ none, so a client reads them with a default.
444
+
433
445
  `kind` is `"plan"` or `"solo"`. `updated` is the newest mtime (epoch seconds, float) among
434
446
  the run dir and the files the reader read. Any field it cannot determine is `null`
435
447
  (`counts` is then `{}`, `task_count` 0).
@@ -602,7 +614,8 @@ Every RunSummary field, plus:
602
614
  `max_parallel` (the `max_parallel` file when it holds 1 to 64, else `null`) and `pauses` (the scopes of
603
615
  `infra.paused`, `[]` without it; each with `needs_you` (`true` only for a bool `true`), `hint` (a string or
604
616
  `null`) and `reset_at` (an epoch or `null`), which an older scope lacks, so they read as `false`, `null`, `null`);
605
- while no scheduler runs they are `false`, `null`, `null` and `[]`.
617
+ while no scheduler runs they are `false`, `null`, `null` and `[]`. `stale` lists the tasks a forge process
618
+ that is gone left `RUNNING` (see the task `status` below), `[]` otherwise.
606
619
  A solo run's `scheduler` is `null`.
607
620
  - `sweep`: the run's finding sweep (`run --sweep`), `null` without `sweep/plan.json` (and for a solo
608
621
  run). `tasks` are its fix tasks (tasks with a `sweep.json`), `findings` how many findings they took
@@ -612,8 +625,8 @@ Every RunSummary field, plus:
612
625
  `group-cap`, `over-max`, `no-model`) and, for `changed`, the tasks that `merged_since` the review.
613
626
  - `deferrals`: the non-empty lines of `deferrals.txt`, `[]` when it is missing.
614
627
  - `findings_available`: whether `scripts/forge-contract.py` could be loaded.
615
- - `fractal`: `null` without `fractal-selection.json`, else `{"enabled", "run", "available", "reason"}`
616
- (Fractal below). Plan and solo runs alike.
628
+ - `later`: only on a plan that is one stage of a larger goal (Decomposition below); the key is
629
+ absent otherwise.
617
630
  - A solo run has `integration` `null`, `final_review` `null`, `final_reviews` and
618
631
  `deferrals` `[]`.
619
632
  - `waves` comes from `waves.tsv` (index 0 is wave 1); `[]` when it is missing. A solo run's
@@ -816,6 +829,8 @@ Every RunSummary field, plus:
816
829
  `started` comes from the harness's own times, from `<role>.clock`, or, when the call is the log's
817
830
  last line, the log's mtime. Every value but the call is `null` when unknown.
818
831
  - `waiting`: why a task that is not running waits, as far as the run dir says, or `null`:
832
+ `{"kind": "stale", "status": "RUNNING", "command": "forge handoff resume <plan>"}` for a task a forge
833
+ process that is gone left `RUNNING` (#229); else
819
834
  `{"kind": "escalation", "attempts", "model", "split"}` when `escalation.stop` exists (whether or
820
835
  not a scheduler runs); else, while `scheduler.live` is true, for a `PENDING` or `INFRA` task:
821
836
  `infra` (a pause in `scheduler.pauses` holds it: scope `all`, or its id in `tasks`; the pause's
@@ -844,6 +859,13 @@ Every RunSummary field, plus:
844
859
  a merge changes the status the page shows. `error` is the text of `tasks/<id>/summary.error`, or `null` when
845
860
  the file is missing or blank. A task whose first generation failed has no `summary.json`, so its `summary` is
846
861
  `null` and its error is not shown. The export blanks `text` and `error` unless texts are chosen.
862
+ - `steer_waiting`: the messages `forge control steer` queued for the task's next attempt, oldest first, from
863
+ `tasks/<id>/steer.jsonl`: `{actor, at, chars, text}` (text capped at 8000 characters). `[]` for a solo task. Each
864
+ `trail` entry has `steered`, the same objects without `text`, from `tasks/<id>/steered.<attempt>.jsonl`: the
865
+ messages that attempt was given (`[]` when none), with `mode: "live"` on one sent while it ran.
866
+ - `steer_live`: the attempt whose implementer takes messages live now (#252: `tasks/<id>/steer.live` names a
867
+ live feeder), or `null`. `steer_sending`: the `--now` messages not yet sent to it, from
868
+ `tasks/<id>/steer.inbox.jsonl`, shaped as `steer_waiting`. A solo task has `null` and `[]`.
847
869
  - `summaries_override`: `on` or `off` from `tasks/<id>/summaries`, or `null` when the file is missing or holds
848
870
  anything else (the task then follows the run's switch). A solo run's task has `null` for `summary` and
849
871
  `summaries_override`.
@@ -1091,7 +1113,7 @@ TaskDetail:
1091
1113
  execution with the findings of its own `qa.last` copy (`null` until it is done); then the
1092
1114
  task's current `qa.last` as a `primary` review with `execution` `null`, only when no
1093
1115
  execution's copy is identical to it; then one `shadow` review per shadow dir. `tests` is the
1094
- reply's `FORGE_TESTS` line: `status` `ran`, `not_needed`, `could_not_run` or `unclear` (it says
1116
+ reply's `FORGE_TESTS` line: `status` `ran`, `partial`, `not_needed`, `could_not_run` or `unclear` (it says
1095
1117
  something else), and `reason` or `null`; `null` when the reply has none.
1096
1118
 
1097
1119
  ExecutionDetail: the Execution, plus `resolved` (every `key=value` of `<role>.resolved`, or
@@ -1132,10 +1154,10 @@ of Findings, in place of the summary), `tests` (as on a TaskDetail review), `tru
1132
1154
 
1133
1155
  | Field | Meaning |
1134
1156
  |---|---|
1135
- | `source.kind` | `task`, `execution`, `final_review` or `fractal`; `id` the task id, execution name, review name or node |
1136
- | `source.which` | `current` `prev` `committed` `existing` (task), `reviewed` (execution, final review), `candidate` (fractal) |
1157
+ | `source.kind` | `task`, `execution` or `final_review`; `id` the task id, execution name or review name |
1158
+ | `source.which` | `current` `prev` `committed` `existing` (task), `reviewed` (execution, final review) |
1137
1159
  | `source.execution`, `attempt` | the qa execution whose prompt held the diff (a final review: its newest), its attempt; a task's `current` and `committed` carry the task's attempt, `prev` and `existing` `null` |
1138
- | `source.file` | the file read, relative to the run dir (fractal: to the Fractal state's `runs/<run>/tasks/`); `null` when none was |
1160
+ | `source.file` | the file read, relative to the run dir; `null` when none was |
1139
1161
  | `sources` | what else can be shown. Task (and its executions): every diff file present (`id` = `which`, `label` = file name, `bytes` its size), then every primary and shadow qa execution whose prompt has a fence (`id` the execution, `label` `reviewed diff, attempt N` / `shadow review, attempt N`, `attempt`, `verdict`, `kind` `primary`/`shadow`, `bytes` of the fenced diff). Final review: itself plus the newest 20 reviews that kept a `combined.diff` (`id` the name, `kind` `final`, `verdict`, `bytes` or `null`). Fractal: `[{"id": "candidate", "label": "candidate.diff", "bytes"}]`. Every entry but fractal's has `url`, the endpoint that shows it |
1140
1162
  | `available`, `reason` | whether a diff was read; else why: `no changes.diff` (any missing file's name), `unreadable (see warnings)`, `no diff in the review prompt`, `no review prompt`, `no review of this attempt` (a dwarf), `not inlined (larger than 400 KB)` (final reviews), `no review prompt yet`, `no candidate diff yet` |
1141
1163
  | `bytes` | the file's size, or the fenced diff's (UTF-8); `null` when unavailable |
@@ -1155,8 +1177,7 @@ is `combined.diff`, else the fence of its newest execution's `qa.prompt`, then o
1155
1177
 
1156
1178
  Which findings: a task diff gets every review (primary, the task's own `qa.last` when no copy
1157
1179
  matches it, shadows) of the task's latest attempt; an execution diff that review's (a
1158
- primary's also brings the shadows of its attempt); a final review's its `qa.last`'s; a fractal
1159
- node's none.
1180
+ primary's also brings the shadows of its attempt); a final review's its `qa.last`'s.
1160
1181
 
1161
1182
  Parsing: `git diff --binary` output and plain unified diffs; renames, copies, mode changes,
1162
1183
  `/dev/null`, C-quoted paths (`"a/caf\303\251"`), CRLF, the mnemonic and no-prefix forms.
@@ -1441,78 +1462,58 @@ lines follow, a line was cut, or reaching them took more than 64 MB of reading.
1441
1462
  The whole value is `null` when the file cannot be read or no tier qualifies. The object
1442
1463
  above is what the shipped file answers today.
1443
1464
 
1444
- ## Fractal (`forge_ui/fractal.py`)
1465
+ ## Decomposition (subtasks of a split task)
1445
1466
 
1446
- A run that chose Fractal (`fractal-selection.json`) has its tasks executed by
1447
- `scripts/forge_fractal` as trees of child tasks, in a managed run under the state root:
1448
- `realpath($XDG_STATE_HOME or ~/.local/state)/forge/fractal` (unlike forge, an empty
1449
- `XDG_STATE_HOME` counts as unset). forge-ui never imports that package.
1467
+ A task of a plan can be split into subtasks, which are a plan dir of their own under the task
1468
+ (`tasks/<id>/sub`), and a subtask can be split again. A sub-plan is **never listed** by
1469
+ `/api/runs`: it belongs to its run. It is a run all the same: its key (`run_key` of its path)
1470
+ answers every `/api/runs/<key>/…` endpoint, with `source` `sub`, so a subtask's detail, executions,
1471
+ diffs and controls are those of a task of that run. The keys below are absent, not `null`, where
1472
+ a plan records nothing, so older plans read exactly as before.
1450
1473
 
1451
- | Path under `runs/<run>/` | Read |
1452
- |---|---|
1453
- | `run.json` (≤ 1 MiB) | its `runner` must be the run dir's realpath |
1454
- | `tasks/task-<sha256(T)[:16]>/` | the Fractal task of forge task `T` = realpath of `tasks/<id>` (plan) or of the run dir (solo) |
1455
- | `…/request.json` (≤ 2 MiB) | its `output` must be `T` |
1456
- | `…/state.json`, `outcome.json` (≤ 256 KiB) | `state`, `outcome` |
1457
- | `…/events.jsonl` | its last 64 KiB |
1458
- | `…/nodes/<n>/node.json` (≤ 4 MiB) | one node; a bigger one is skipped with a warning |
1459
- | `…/nodes/<n>/candidate.diff` | the node's imported change |
1460
-
1461
- Everything is opened through directory fds, one component at a time with `O_NOFOLLOW`
1462
- (files also `O_NONBLOCK`, regular only, bounded): a symlink anywhere is refused with a
1463
- warning. `nodes/` is the only dir listed, and only names matching
1464
- `[A-Za-z0-9][A-Za-z0-9_-]{0,100}`. `control/`, `nodes/*/product/`, `planning/`, `steps/` and
1465
- the ledger are never opened, nor any absolute path a node stores. Parses are kept by
1466
- signature and path.
1467
-
1468
- RunDetail `fractal`: `{"enabled", "run", "available", "reason"}`. `enabled` is true only for
1469
- `"enabled": true`; `run` must match `run-[0-9a-f]{20}`. Reasons: `Fractal is off for this run`,
1470
- `invalid fractal-selection.json` (not a ≤ 64 KiB JSON object), `invalid run id`,
1471
- `managed run not found`, `invalid run.json`, `runner mismatch`, `not supported on this
1472
- platform`.
1473
-
1474
- TaskFractal:
1474
+ RunSummary (and RunDetail):
1475
+
1476
+ - `parent`: only on a sub-plan. `{"key", "task", "run_id", "path"}`: the run and the task it holds
1477
+ the subtasks of.
1478
+ - `decomposition`: only on a plan with `decomposition.json`.
1479
+ `{"limits": {"depth", "children", "nodes", "frozen"}, "split", "subtasks", "statuses"}`. `limits`
1480
+ are the tree's (the root plan's, each default where it set none: 2, 6, 24), `frozen` once the
1481
+ plan has run. `split` counts this plan's tasks that have subtasks, `subtasks` the tasks of every
1482
+ sub-plan below it, and `statuses` is `[{"id": "d/a", "status"}]` for those, in tree order.
1483
+
1484
+ RunDetail:
1485
+
1486
+ - `later`: only on a stage of a larger goal. `{"stages": [{"title", "goal"}], "stage", "first"}`:
1487
+ the stages its planner proposed after it (at most 10), which stage of its chain this plan is
1488
+ (`null` for the first), and `first`, `{"key", "path"}` of the chain's first plan, or `null`.
1489
+
1490
+ Task (in RunDetail `tasks` and in TaskDetail), only on a plan with `decomposition.json`:
1475
1491
 
1476
1492
  ```json
1477
- {"run": "3f9a0c1d2e4b", "task": "reader", "fractal_run": "run-…", "fractal_task": "task-…",
1478
- "available": true, "reason": null,
1479
- "state": {"status": "active", "acceptance": "pending", "elapsed": 120.5, "started_at": 1760600020.0,
1480
- "ended_at": null, "exit_code": null, "error": null, "qa_status": null},
1481
- "outcome": {"acceptance": "PASS", "verification": "passed", "task_status": "PASS"},
1482
- "nodes": [{"id": "implementation", "parent": null, "depth": 0, "goal": "…", "difficulty": "medium",
1483
- "paths": ["ui"], "deps": [], "model": "sol:xhigh", "resolved_model": "…", "status": "waiting",
1484
- "ui_status": "RUNNING", "phase": "implementation", "iteration": 1, "started_at": 1760600022.0,
1485
- "ended_at": null, "cost": 0.42, "unknown_cost_steps": 0,
1486
- "tokens": {"input_tokens": 1, "cached_input_tokens": 0, "output_tokens": 2},
1487
- "decomposition": {"phase": "accepted", "decision": "split", "reason": "…", "children": ["a", "b"]},
1488
- "error": null, "has_diff": false, "reserved": false}],
1489
- "events": [{"at": 1760600021.0, "kind": "node_created", "node": "implementation"}],
1490
- "warnings": [], "truncated": []}
1493
+ "decomposition": {
1494
+ "decision": "split", "reason": "two halves that can be reviewed apart", "by": "user", "at": 1760621000.0,
1495
+ "sub": {"key": "9d2c41aa07fe", "run_id": "20261016-153012-ab12--page", "path": "…/tasks/page/sub"},
1496
+ "merged": false, "waiting": ["docs"], "start": "keep", "kept": null,
1497
+ "nodes": [{"id": "page/markup", "parent": null, "run": "9d2c41aa07fe", "run_id": "20261016-153012-ab12--page",
1498
+ "task": "markup", "level": 1, "title": "Write the markup", "status": "MERGED", "difficulty": "low",
1499
+ "model": "sol:high", "qa": "opus", "decision": "atomic", "reason": null, "by": "default",
1500
+ "attempts": 1, "tokens": {"input": 1200, "cached": 900, "output": 300}, "has_diff": true}]
1501
+ }
1491
1502
  ```
1492
1503
 
1493
- - `available: false` (`state`, `outcome` `null`, `nodes`, `events` `[]`) with the RunDetail
1494
- reasons, or `Fractal is not selected for this run`, `no Fractal task for this task yet`,
1495
- `request does not match this task`, `invalid request.json`.
1496
- - `nodes`: tree order (a parent, then its children by id), at most 500 node dirs (else
1497
- `truncated` has `nodes`). Children a decomposition admitted (`decomposition.admission` and
1498
- `decomposition_history[].admission`) that have no dir yet are listed with `status`
1499
- `reserved` and `reserved: true`. `depth` counts parents. `goal` and `error` keep 240
1500
- characters, a decision's `reason` 2,000. Values of the wrong type are `null` (lists `[]`).
1501
- `has_diff`: `candidate.diff` is a regular file.
1502
- - `ui_status`: `pending` `PENDING`, `active`/`waiting` `RUNNING`, `paused` `BLOCKED`,
1503
- `completed` `MERGED`, `timeout` `TIMEOUT`, `interrupted`/`stopped` `INTERRUPTED`, `reserved`
1504
- `PENDING`, any other status `FAIL`, none `UNKNOWN`.
1505
- - `events`: the newest 50 JSON lines of `events.jsonl` with a `kind`, oldest first: `at`,
1506
- `kind`, `node`, and those of `phase decision status acceptance exit_code iteration cost
1507
- difficulty model reason` the line has. Other lines are counted in a warning.
1508
-
1509
- FractalNodeDetail (`…/fractal/nodes/<node>`): the node as listed, plus `goal`, `error` (20,000
1510
- characters), `last` and `planning_last` (their last 20,000, behind `…`), `planning_tokens`,
1511
- `decomposition` in full (`phase decision reason attempts error`, and `admission`: `name goal
1512
- difficulty paths deps model` each), `decomposition_history` (its newest 20, each like
1513
- `decomposition`, `reason` and `error` 2,000), and `run`, `task`, `fractal_run`,
1514
- `fractal_task`, `warnings`, `truncated` (the texts cut). A reserved node has these `null` or
1515
- `[]`, with its admission's `goal`.
1504
+ - `decision`: `atomic` (kept whole), `split` or `bounded` (a split a limit of the run refused; the
1505
+ task runs as one). `by`: `planner`, `user`, `auto` (`run --auto-split`) or `default` (nobody
1506
+ decided). `reason` and `at` may be `null`.
1507
+ - `sub`: the sub-plan as a run, or `null` for a task that is not split. `merged`: its subtasks'
1508
+ work is on the task's branch. `waiting`: the subtasks the task waits for. `start`: `keep` or
1509
+ `fresh`; `kept`: the commit `fresh` set aside, else `null`.
1510
+ - `nodes`: every subtask below the task, through every level, in tree order (at most 600; past it
1511
+ the detail's `truncated` names `decomposition`). `id` is the path from the task
1512
+ (`page/markup/one`), `parent` the node above (`null` for a direct subtask), `run` the key of the
1513
+ sub-plan the node is a task of and `task` its id there: its detail is
1514
+ `/api/runs/<run>/tasks/<task>` and its diff `/api/runs/<run>/tasks/<task>/diff`. `tokens` sums
1515
+ the node's executions, or is `null`; forge records tokens, not a price. `has_diff` says its
1516
+ `changes.diff` is there and not empty.
1516
1517
 
1517
1518
  ## Export (`forge_ui/export.py`)
1518
1519
 
@@ -1529,10 +1530,9 @@ difficulty paths deps model` each), `decomposition_history` (its newest 20, each
1529
1530
  exported), which `map3d.js` imports from a `blob:` URL.
1530
1531
  - `api` maps each path the page requests to that endpoint's response as the server would answer
1531
1532
  it (server.api_get): `/api/runs` (this run only), the RunDetail, every TaskDetail, every
1532
- Group detail, every ExecutionDetail the RunDetail or a Group names, every FinalReviewDetail, Files, RunFindings, and the
1533
- Fractal trees and nodes. A script named above whose file is not in `forge_ui/static/` yet is left out,
1533
+ Group detail, every ExecutionDetail the RunDetail or a Group names, every FinalReviewDetail, Files and RunFindings. A script named above whose file is not in `forge_ui/static/` yet is left out,
1534
1534
  so `groupsview.js` can be listed before the group page adds it. With `texts=1` also every diff the page can open (each task's diff and its `sources`,
1535
- each final review's, each Fractal node's), every `dwarf` and `qa` ExecutionTranscript (at most 2 MB each)
1535
+ each final review's), every `dwarf` and `qa` ExecutionTranscript (at most 2 MB each)
1536
1536
  and ExecutionChecks, every TaskChecks, the RunEnvironment,
1537
1537
  and the VerificationLog tail of `verification.log`, of each lane's log and of each lane run's log
1538
1538
  (under their tail paths; line ranges are not stored, so the page shows the tail).
@@ -1646,7 +1646,7 @@ object its stdout holds, when that parses as one.
1646
1646
  |---|---|---|
1647
1647
  | 0 | `200` | the CLI's stdout JSON object, as it is |
1648
1648
  | 2 (invalid input) | `400` | `invalid` |
1649
- | 3 (refused: not live, MERGED, a Fractal plan, a pin that fails doctor, the control lock busy) | `409` | `refused` |
1649
+ | 3 (refused: not live, MERGED, a plan made with Fractal, a pin that fails doctor, the control lock busy) | `409` | `refused` |
1650
1650
  | 4 (a failure the CLI reported) | `500` | `failed` |
1651
1651
  | anything else, a signal, a missing CLI, or a 0 with no JSON object | `502` | `bad gateway` |
1652
1652
  | timeout | `504` | `timeout` |
@@ -1663,9 +1663,14 @@ for them only unknown keys and runs the catalog does not hold are `404`. Every w
1663
1663
 
1664
1664
  ### `GET /api/runs/<key>/controls`
1665
1665
 
1666
- `forge control show <plan dir> --json`: `200` with its object (`plan`, `run_id`, `live`, `fractal`,
1666
+ `forge control show <plan dir> --json`: `200` with its object (`plan`, `run_id`, `live`, `removed` (`"Fractal"` for a plan made with it, else `null`),
1667
+ `decomposition` (`{limits: {depth, children, nodes, frozen}, nodes: [{id, plan, task, level, status, title, decision, reason, by, …}]}`, every node of the tree in order),
1667
1668
  `run` (the plan-wide controls; `qa_threshold` is the effective level and `qa_threshold_source` is `set` or `default`), `tasks` (per task: `status`, `dwarf`, `qa`, `qa_threshold`,
1668
- `retry_budget`, `retries_used`, `pin`, `escalation_stop`, `escalation_next`) and `log`). No token
1669
+ `retry_budget`, `retries_used`, `pin`, `escalation_stop`, `escalation_next`), `log`, `tiers` (per
1670
+ difficulty `low`/`medium`/`high`: `tasks`, `pending` (not started yet) and the `dwarf` and `qa` specs those
1671
+ pending tasks use), `models` ({spec: "gpt-6.2-sol on codex"} for every spec the tasks name) and
1672
+ `registry` ({alias: [[harness, model], ...]}, the first row the alias's default), from which the page
1673
+ resolves a spec typed in a picker before it is applied). No token
1669
1674
  is needed to read it. Of `run` the page also reads `max_parallel` (1–64 or `null`), `infra_backoff`
1670
1675
  (the shape, `exp:60` when unset), `escalate_effort` (`on`/`off`), `drained` and `stopping`
1671
1676
  (`graceful`, `now` or `null`) while live, and `infra_paused` while live: one
@@ -1687,9 +1692,11 @@ known or a spec runs is for the CLI to say (its `400` or `409` comes back as abo
1687
1692
  | `{"action": "set", "key": "qa-threshold", "value": "P2"}` (`default` at run level removes the setting, `none` is P3; for a task `inherit` drops the override) | `control set <dir> qa-threshold P2 --actor ui --json` |
1688
1693
  | `{"action": "set", "key": "retry-budget", "value": "inherit", "task": "reader"}` | `control set <dir> retry-budget inherit --task reader --actor ui --json` |
1689
1694
  | `{"action": "set", "key": "summaries", "value": "on"}` (or `off`) | `control set <dir> summaries on --actor ui --json` |
1695
+ | `{"action": "set", "key": "summaries-model", "value": "haiku:low"}` (or `default`) | `control set <dir> summaries-model haiku:low --actor ui --json` |
1690
1696
  | `{"action": "set", "key": "summaries", "value": "inherit", "task": "reader"}` (`on` or `off` with `task` too) | `control set <dir> summaries inherit --task reader --actor ui --json` |
1691
1697
  | `{"action": "pin", "task": "graph", "spec": "sol:high:codex"}` | `control pin <dir> graph sol:high:codex --actor ui --json` |
1692
1698
  | `{"action": "unpin", "task": "graph"}` | `control unpin <dir> graph --actor ui --json` |
1699
+ | `{"action": "models", "tier": "low", "dwarf": "haiku:xhigh,sonnet", "qa": "opus"}` (`dwarf`, `qa` or both; each one spec or a comma-separated pool) | `control models <dir> low --dwarf haiku:xhigh,sonnet --qa opus --actor ui --json` |
1693
1700
  | `{"action": "drain"}` | `control drain <dir> --actor ui --json` |
1694
1701
  | `{"action": "resume"}` | `control resume <dir> --actor ui --json` |
1695
1702
  | `{"action": "stop"}` (or `"now": false`) | `control stop <dir> --actor ui --json` |
@@ -1707,6 +1714,9 @@ hand, so its CLI is the place to queue it. A success is
1707
1714
  (`409`) when no scheduler is live. A `retry` only queues: `200 {"queued": true, "request": "<id>"}`.
1708
1715
  Its refusals before queueing (not live, a MERGED task, a spec that fails doctor) are the CLI's
1709
1716
  `409`/`400`; the scheduler applies or refuses it later, in the `log` line with that `request` id.
1717
+ A `models` change answers like `set`, plus `tasks` (each changed task with its `dwarf` and `qa` as
1718
+ `[before, after]`), `kept` ({task: status} of the tier's tasks that had already started and keep their
1719
+ model) and `models` (the label of each spec given).
1710
1720
 
1711
1721
  ### `POST /api/runs/<key>/tasks/<id>/brief/<qid>`
1712
1722
 
@@ -1895,6 +1905,17 @@ RunDetail's `scheduler.live`) and `result` is `{"queued": true, "request"}` or `
1895
1905
  "prepared": true}`. Exit 3 (the task is not `NEEDS_INPUT`) is `409` with the CLI's message. Holds
1896
1906
  the run's write lock (`409 busy`); timeout 60 s. Refused under `--read-only` and without the token.
1897
1907
 
1908
+ ### `POST /api/runs/<key>/tasks/<id>/steer`
1909
+
1910
+ Body: `{"text": string, "now"?: boolean}`, checked as for `/answer`. The run must be a plan (`404`
1911
+ otherwise). Runs `control steer <plan> <id> --file - --actor ui --json` with the stripped text on
1912
+ stdin, plus `--now` when `now` is true; the answer is `200` with the CLI's object, `{"ok": true,
1913
+ "queued": true, "task", "waiting", "live", "chars"}`, or with `now` `{"ok": true, "queued": false,
1914
+ "sent": true, "task", "attempt", "waiting", "live": true, "chars"}`. Exit 3 (a MERGED task, 20
1915
+ messages already waiting, or with `now` no implementer running live) is `409` with the CLI's message. Nothing is
1916
+ started: the task's next implementer attempt gets the message (#134). Holds the run's write lock
1917
+ (`409 busy`); timeout 60 s. Refused under `--read-only` and without the token.
1918
+
1898
1919
  ### `GET /api/models/reviewers`
1899
1920
 
1900
1921
  Runs `dataset reviewers --json` and answers with its object: `horizon_days`, `min_landed`,
@@ -1918,7 +1939,7 @@ ProjectRow = {id, name, root, exists, runs, live, last, path_only (runs tied by
1918
1939
  Project = {id, name, root, exists, live, last, path_only, memory_off_runs,
1919
1940
  checkouts: [{path, exists, branch, runs, root}], runs: [RunSummary + identity_source, dataset_uid, no_memory]}
1920
1941
  ProjectFindings = {id, rows: [Finding], notes: [text], runs, dataset_runs, computed, available,
1921
- issues_online (true when that listing was the online one), issues_read_at (unix time the listing was read, or null)}
1942
+ issues_online (true when that listing was the online one and asked GitHub: false for a repository with no GitHub remote), issues_read_at (unix time the listing was read, or null)}
1922
1943
  Finding = {source: run|dataset, run (key or null), run_id, task, final_review (its dir name, 'final' from the
1923
1944
  dataset), attempt, kind: primary|shadow|final, reviewer, verdict, at, id, severity, confidence, location,
1924
1945
  summary, text, fp (forge issues' key, null when it cannot parse the line), record_fp (the finding
@@ -2004,9 +2025,10 @@ Storage = {state: measuring | ready | error | unavailable, error, started, progr
2004
2025
  data: Report | null (the last measurement, kept while the next one runs)}
2005
2026
  Report = {repo: null, computed, complete, totals: {runs, worktrees, data_home, reclaimable, snapshots, logs, strays},
2006
2027
  runs: [{path, run_id, repo, updated, total, snapshots, snapshot_count, logs, gz, compressible, strays,
2007
- fractal, other, reclaimable, complete, key: forge-ui run key | null (not in the run list), commands: [{label, command}]}],
2028
+ other, reclaimable, complete, key: forge-ui run key | null (not in the run list), commands: [{label, command}]}],
2008
2029
  strays: [{path, bytes, kind: dependencies | git, run}], worktrees: [{repo, run_id, path, bytes, complete}],
2009
2030
  data_home: {path, bytes, parts: {dataset, blobs, archive, exports, legacy, storage, other}} | null,
2031
+ removed: [{name, path, bytes, since, complete}] (what a removed part of forge left on disk: today Fractal's state dir),
2010
2032
  commands: [{label, command, bytes?}]}
2011
2033
  ```
2012
2034
 
@@ -2150,7 +2172,7 @@ Plain scripts unless noted; each defines one global and none parses API text as
2150
2172
  |---|---|---|
2151
2173
  | `runmodel.js` | `ForgeRunModel` | pure data, no DOM: the plate layout (archivision's `plate()`), the atlas, plan and execution models, forge-schedule's rules projected forward, the critical path, concurrency, the state of every node at a time `t` (replay, verification lanes included), the finish node's verification LEDs (`verifyLeds`: one per lane in lanes mode, else one per run), filters. Also a CommonJS module, for `node --test` |
2152
2174
  | `gantt.js` | `ForgeGantt` | `render(container, run, {now, onSelect, sel, replay, critical, ghosts})`: attempts on wall-clock time in lanes; `strip(container, run, {now, replay})`: busy attempts and model calls against `max_parallel`. Under the attempts, the finish rows: `verify` (single-command verifications; the newest split into its runs back to back from its start, dashed because that placement is approximate), a `verify · <lane>` row per lane of a lanes verification (each run and rerun at its own time; a run with no exit is UNKNOWN once it ended, never FAIL) and `final review`. A lane or run item opens the verification inspector |
2153
- | `panel.js` | `ForgePanel` | `render(host, ctx)`: the inspector for a run, task, execution, final review, verification, integration or Fractal node; for a task it opens on its `header` (its Prompt, Approach and Acceptance criteria texts, from the lazy detail once loaded), then its `trail`, its `summary` with the `summaries_override` switch, and `ForgeBrief`'s questions; fetches the lazy endpoints once per node; `ctx.diffHash(spec)` links into the diff viewer, `ctx.onFractal(task, TaskFractal)` hands a task's tree to the stage |
2175
+ | `panel.js` | `ForgePanel` | `render(host, ctx)`: the inspector for a run, task, execution, final review, verification or integration; a split task's `Decomposition` section lists its subtasks (`decompositionSection`); for a task it opens on its `header` (its Prompt, Approach and Acceptance criteria texts, from the lazy detail once loaded), then its `trail`, its `summary` with the `summaries_override` switch, and `ForgeBrief`'s questions; fetches the lazy endpoints once per node; `ctx.diffHash(spec)` links into the diff viewer, `ctx.onFractal(task, TaskFractal)` hands a task's tree to the stage |
2154
2176
  | `verifyview.js` | `ForgeVerify` | `render(host, {run, now, fetchJSON, rerender})`: the verification inspector panel.js delegates to: while it runs, the elapsed time, step, last line and a flag past 5 minutes without output, and a live tail of the followed lane's log (or the single log) read again each poll; when it failed, the failing tests first, grouped by lane with new or known, each opening its lane's log at its line (in an export, the tail); a lanes table (state, time, reruns, counts). Pure helpers (`model`, `laneRow`, `groupFailing`, `idleWarning`, `openStep`, `tailLane`, `logPath`, `linesPath`, `tailLines`) are a CommonJS module too |
2155
2177
  | `checksview.js` | `ForgeChecks` | where each task stands and the checks its agents ran: `cell(task, now, ctx)` (the task table's Now column: the running call and for how long, a `quiet N min` flag past 5 minutes without output, or why it waits), `nowSection`, `execSection` and the attempts' checks and acceptance-criteria lines (`taskChecks`, `underExecution`, `attemptCriteria`) for panel.js, `schedulerFields` (the run inspector), `banner(head, ctx)` (the run header: environment problems more than one task met, read again at most every 15 s while tasks run) and `tick(root, now)`, which app.js calls each refresh to move `data-since`, `data-until` and `data-quiet` times. Pure helpers (`nowModel`, `waitingModel`, `nowRank`, `checkRow`, `countsText`, `coverageModel`, `bannerProblems`, `schedulerModel`, `quietText`, `untilText`) are a CommonJS module too |
2156
2178
  | `controls.js` | `ForgeControls` | the run and task control panels that panel.js mounts (`mountRun`, `mountTask`) and the pure model under them: what each key is called and where it applies (`KEYS`), `prepare` (a draft's request body and confirm text), `bodyFor`, `savedText` and `agoText`. Every change goes through `ForgeUI` (uikit.js) to `POST /api/runs/<key>/controls`. Also a CommonJS module |
@@ -2173,10 +2195,10 @@ Routes (the URL hash): `#/` the map of every run; `#/cloud`, `#/cloud/runs/<key>
2173
2195
  selected), `#/cloud/projects/<id>` (a project in focus), `#/cloud/models/<alias>` (the cloud
2174
2196
  filtered to that model); `#/models` the leaderboard; `#/runs/<key>`; `…/tasks/<id>`;
2175
2197
  `…/tasks/<id>/executions/<name>`; `…/executions/<name>` (an execution that belongs to no
2176
- task); an agent's conversation, `…/executions/<name>/conversation[/event/<n>]` after either; `…/final-review[/<name>]`; `…/verification`; `…/integration`; `…/tasks/<id>/fractal/<node>`;
2198
+ task); an agent's conversation, `…/executions/<name>/conversation[/event/<n>]` after either; `…/final-review[/<name>]`; `…/verification`; `…/integration`; a subtask is a task of its sub-plan's run, `#/runs/<sub-plan key>/tasks/<id>`;
2177
2199
  and the diff viewer: `…/tasks/<id>/diff[/<source>][/file/<path>]` (`source` is `current`, `prev`,
2178
- `committed`, `existing` or an execution), `…/final-review/<name>/diff[/file/<path>]`,
2179
- `…/tasks/<id>/fractal/<node>/diff[/file/<path>]` (`path` percent-encoded whole).
2200
+ `committed`, `existing` or an execution) and `…/final-review/<name>/diff[/file/<path>]`
2201
+ (`path` percent-encoded whole).
2180
2202
 
2181
2203
  Kept in the browser (localStorage, every access guarded): `forge-ui-view`, `-mode`, `-overlay`,
2182
2204
  `-speed`, `-map-filter`; `forge-ui-cloud` (filter, layout, shape, panel) and
@@ -306,6 +306,7 @@ def validate_body(body):
306
306
  shapes = {'set': ({'action', 'key', 'value', 'task'}, ('key', 'value')),
307
307
  'pin': ({'action', 'task', 'spec'}, ('task', 'spec')),
308
308
  'unpin': ({'action', 'task'}, ('task',)),
309
+ 'models': ({'action', 'tier', 'dwarf', 'qa'}, ('tier',)),
309
310
  'retry': ({'action', 'task', 'dwarf'}, ('task',)),
310
311
  'drain': ({'action'}, ()),
311
312
  'resume': ({'action'}, ()),
@@ -321,6 +322,12 @@ def validate_body(body):
321
322
  tail += ['--task', _text(body, 'task')]
322
323
  if action == 'retry' and 'dwarf' in body:
323
324
  tail += ['--dwarf', _text(body, 'dwarf')]
325
+ if action == 'models':
326
+ if 'dwarf' not in body and 'qa' not in body:
327
+ raise BadBody('models needs dwarf, qa or both')
328
+ for role in ('dwarf', 'qa'):
329
+ if role in body:
330
+ tail += ['--' + role, _text(body, role)]
324
331
  if action == 'stop' and 'now' in body:
325
332
  if not isinstance(body['now'], bool):
326
333
  raise BadBody('now must be true or false')
@@ -349,7 +356,9 @@ class Context:
349
356
  `limit` is the route's timeout; a timeout given to `dispatch` (a test's) replaces it.
350
357
  `stdin` is bytes for a call that uses `--file -`, or None. `json_stdout` is false when a
351
358
  successful CLI prints text (a brief answer, including a late-answer notice)."""
352
- result = run_cli([str(self.cli), *args], self.timeout or limit or TIMEOUT_S, stdin=stdin)
359
+ raw = [str(self.cli), *args]
360
+ argv = forge_proc.resolve_win_command(raw)[1] if forge_proc.IS_WINDOWS else raw
361
+ result = run_cli(argv, self.timeout or limit or TIMEOUT_S, stdin=stdin)
353
362
  return map_exit(result) if json_stdout else _text_exit(result)
354
363
 
355
364
  def locked(self, work):
@@ -1450,6 +1459,43 @@ def _scheduler_live(path):
1450
1459
  return forge_proc.pid_alive(pid)
1451
1460
 
1452
1461
 
1462
+ def _task_text(ctx, allowed=('text',)):
1463
+ """The stripped `text` of a task message body as UTF-8 bytes (an answer, a steer message), or BadBody."""
1464
+ body = _body_object(ctx, allowed)
1465
+ text = body.get('text')
1466
+ if not isinstance(text, str):
1467
+ raise BadBody('text must be a string')
1468
+ text = text.strip()
1469
+ if '\x00' in text:
1470
+ raise BadBody('text must not contain a NUL')
1471
+ if not 1 <= len(text) <= MAX_TASK_ANSWER:
1472
+ raise BadBody(f'text must be 1 to {MAX_TASK_ANSWER} characters')
1473
+ try:
1474
+ return text.encode('utf-8')
1475
+ except UnicodeEncodeError:
1476
+ raise BadBody('text must be valid text')
1477
+
1478
+
1479
+ def _task_steer(ctx):
1480
+ """POST `{text, now?}`: `forge control steer <plan> <id> --file - --actor ui --json`, the text on stdin (#134).
1481
+ The message waits in the task's steer.jsonl for its next implementer attempt; nothing is started. With `now`
1482
+ true it goes to the running implementer instead (#252: `--now`), refused when none runs live."""
1483
+ ctx.route = 'steer'
1484
+ task = ctx.parts[0]
1485
+ try:
1486
+ stdin = _task_text(ctx, ('text', 'now'))
1487
+ now = ctx.body.get('now', False)
1488
+ if not isinstance(now, bool):
1489
+ raise BadBody('now must be true or false')
1490
+ except BadBody as exc:
1491
+ return _invalid(str(exc))
1492
+ path = ctx.locate(('plan',))
1493
+ if path is None:
1494
+ return 404, {'error': 'not found'}
1495
+ return ctx.locked(lambda: ctx.call('control', 'steer', path, task, '--file', '-', '--actor', 'ui', '--json',
1496
+ *(('--now',) if now else ()), stdin=stdin))
1497
+
1498
+
1453
1499
  def _task_answer(ctx):
1454
1500
  """POST `{text}`: `forge control retry <plan> <id> --answer-file - --actor ui --json`, the text on stdin.
1455
1501
 
@@ -1457,19 +1503,7 @@ def _task_answer(ctx):
1457
1503
  ctx.route = 'answer'
1458
1504
  task = ctx.parts[0]
1459
1505
  try:
1460
- body = _body_object(ctx, ('text',))
1461
- text = body.get('text')
1462
- if not isinstance(text, str):
1463
- raise BadBody('text must be a string')
1464
- text = text.strip()
1465
- if '\x00' in text:
1466
- raise BadBody('text must not contain a NUL')
1467
- if not 1 <= len(text) <= MAX_TASK_ANSWER:
1468
- raise BadBody(f'text must be 1 to {MAX_TASK_ANSWER} characters')
1469
- try:
1470
- stdin = text.encode('utf-8')
1471
- except UnicodeEncodeError:
1472
- raise BadBody('text must be valid text')
1506
+ stdin = _task_text(ctx)
1473
1507
  except BadBody as exc:
1474
1508
  return _invalid(str(exc))
1475
1509
  path = ctx.locate(('plan',))
@@ -1644,7 +1678,6 @@ def _findings_action(ctx):
1644
1678
  `--text-file`). `findings_lock` makes a second write 409 `busy`. Exit 3 is 409 with the CLI's
1645
1679
  message. A successful call drops the project screen's issues listings and its run cache.
1646
1680
  """
1647
- from forge_ui import projects
1648
1681
  op = ctx.parts[0]
1649
1682
  ctx.route = 'findings ' + op
1650
1683
  try:
@@ -1943,7 +1976,10 @@ def _specs_check(ctx):
1943
1976
  spec = _triage_spec(params['spec'])
1944
1977
  except BadBody as exc:
1945
1978
  return _invalid(str(exc))
1946
- result = run_cli(['bash', _DISPATCH, 'doctor', '--spec', spec, '--role', 'side'], ctx.timeout or TIMEOUT_S)
1979
+ argv = forge_proc.bash_cmd(_DISPATCH, 'doctor', '--spec', spec, '--role', 'side') if forge_proc.IS_WINDOWS else [
1980
+ 'bash', _DISPATCH, 'doctor', '--spec', spec, '--role', 'side',
1981
+ ]
1982
+ result = run_cli(argv, ctx.timeout or TIMEOUT_S)
1947
1983
  if result.timed_out:
1948
1984
  return 504, {'error': 'timeout', 'detail': TIMEOUT_DETAIL}
1949
1985
  if result.error:
@@ -1966,6 +2002,7 @@ ROUTES = [
1966
2002
  ('POST', re.compile(r'/api/runs/([0-9a-f]{12})/issues/dismiss'), _issues_dismiss),
1967
2003
  ('POST', re.compile(r'/api/runs/([0-9a-f]{12})/delete'), _delete),
1968
2004
  ('POST', re.compile(r'/api/runs/([0-9a-f]{12})/tasks/([A-Za-z0-9][A-Za-z0-9._-]{0,127})/answer'), _task_answer),
2005
+ ('POST', re.compile(r'/api/runs/([0-9a-f]{12})/tasks/([A-Za-z0-9][A-Za-z0-9._-]{0,127})/steer'), _task_steer),
1969
2006
  ('POST', re.compile(r'/api/worktrees/remove()'), _worktrees_remove),
1970
2007
  ('POST', re.compile(r'/api/storage/compact()'), _storage_compact),
1971
2008
  ('POST', re.compile(r'/api/projects/([0-9a-f]{8})/memories/forget'), _memories_forget),
@@ -17,7 +17,6 @@ import base64
17
17
  import hashlib
18
18
  import json
19
19
  import os
20
- from pathlib import Path
21
20
  import re
22
21
  import time
23
22
  import urllib.parse
@@ -225,15 +224,6 @@ def build(catalog, key, texts=False, paths=False, now=None):
225
224
  snap.add(f'{base}/adoptions/{_enc(name)}')
226
225
  snap.add(f'{base}/files')
227
226
  snap.add(f'{base}/findings')
228
- fractal = run.get('fractal') or {}
229
- if fractal.get('enabled') and fractal.get('available'):
230
- for task in tasks:
231
- tree = snap.add(f"{base}/tasks/{_enc(task['id'])}/fractal")
232
- for node in (tree or {}).get('nodes') or []:
233
- if isinstance(node, dict) and node.get('id') and not node.get('reserved'):
234
- snap.add(f"{base}/tasks/{_enc(task['id'])}/fractal/nodes/{_enc(node['id'])}")
235
- if texts and node.get('has_diff'):
236
- snap.add(f"{base}/tasks/{_enc(task['id'])}/fractal/nodes/{_enc(node['id'])}/diff", cap=DIFF_CAP)
237
227
  if texts:
238
228
  # every diff a page of this run can open: each task's files and each review's, the final reviews'
239
229
  for task in tasks: