@giamme/forge 0.14.1 → 0.16.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +46 -0
- package/SKILL.md +47 -14
- package/VERSION +1 -1
- package/docs/artifacts.md +1 -1
- package/docs/commands.md +302 -9
- package/docs/forge-ui.md +14 -0
- package/docs/memory.md +22 -0
- package/docs/models.md +53 -0
- package/docs/reviews.md +7 -0
- package/forge +11 -0
- package/package.json +1 -1
- package/references/dataset.md +16 -4
- package/references/decompose.md +154 -9
- package/references/harnesses.md +21 -1
- package/references/planning.md +59 -0
- package/references/solo.md +5 -1
- package/references/ui.md +48 -1
- package/scripts/forge-artifact.sh +53 -0
- package/scripts/forge-compare.py +6 -3
- package/scripts/forge-config.py +531 -4
- package/scripts/forge-contract.py +55 -8
- package/scripts/forge-control.py +0 -2
- package/scripts/forge-dispatch.sh +84 -14
- package/scripts/forge-fail-first.py +3 -1
- package/scripts/forge-guard.py +247 -8
- package/scripts/forge-issues.py +12 -0
- package/scripts/forge-lib-adopt.sh +260 -0
- package/scripts/forge-lib-attribute.sh +10 -2
- package/scripts/forge-lib-plans.sh +35 -6
- package/scripts/forge-lib-review.sh +13 -5
- package/scripts/forge-lib-task.sh +138 -5
- package/scripts/forge-memory.sh +41 -4
- package/scripts/forge-metrics.sh +7 -0
- package/scripts/forge-parallel-options.sh +12 -6
- package/scripts/forge-parallel.sh +659 -32
- package/scripts/forge-plan-check.py +591 -8
- package/scripts/forge-planner.py +480 -0
- package/scripts/forge-route.py +16 -2
- package/scripts/forge-runs-rm.py +23 -7
- package/scripts/forge-runtime.py +111 -2
- package/scripts/forge-schedule.py +5 -2
- package/scripts/forge-shadow.py +53 -7
- package/scripts/forge-solo.sh +87 -7
- package/scripts/forge_dataset/cli.py +26 -0
- package/scripts/forge_dataset/efforts.py +215 -0
- package/scripts/forge_dataset/export.py +1 -0
- package/scripts/forge_dataset/harvest.py +55 -0
- package/scripts/forge_dataset/history.py +126 -0
- package/scripts/forge_dataset/worktrees.py +95 -0
- package/scripts/forge_decide/__init__.py +19 -1
- package/scripts/forge_decide/builtin_profiles.json +25 -0
- package/scripts/forge_decide/cli.py +12 -0
- package/scripts/forge_decide/profiles.py +866 -0
- package/scripts/forge_decide/resolve.py +38 -6
- package/scripts/forge_memory_list.py +153 -0
- package/scripts/forge_worktrees.py +88 -0
- package/ui/README.md +31 -0
- package/ui/docs/api.md +168 -12
- package/ui/forge_ui/__init__.py +14 -1
- package/ui/forge_ui/__main__.py +1 -1
- package/ui/forge_ui/control.py +250 -12
- package/ui/forge_ui/executions.py +28 -8
- package/ui/forge_ui/findings.py +7 -0
- package/ui/forge_ui/models.py +60 -1
- package/ui/forge_ui/projects.py +571 -0
- package/ui/forge_ui/reader.py +48 -8
- package/ui/forge_ui/static/app.js +99 -21
- package/ui/forge_ui/static/cloudui.js +6 -2
- package/ui/forge_ui/static/convo.js +1 -1
- package/ui/forge_ui/static/diffview.js +2 -2
- package/ui/forge_ui/static/files.js +1 -1
- package/ui/forge_ui/static/index.html +5 -1
- package/ui/forge_ui/static/leaderboard.js +5 -1
- package/ui/forge_ui/static/modelstats.js +25 -1
- package/ui/forge_ui/static/panel.js +47 -4
- package/ui/forge_ui/static/projectsview.js +372 -0
- package/ui/forge_ui/static/settings.js +924 -29
- package/ui/forge_ui/static/style.css +116 -3
- package/ui/forge_ui/static/uikit.js +94 -1
- package/ui/forge_ui/static/worktreesview.js +250 -0
- package/ui/forge_ui/worktrees.py +570 -0
package/ui/docs/api.md
CHANGED
|
@@ -52,6 +52,7 @@ written), and the reader must never raise because of one.
|
|
|
52
52
|
| `attribution.json` | the result of `forge-parallel.sh attribute`: `culprit` (a task id or `null`), `base_fails`, `inconclusive` (a reason or `null`), `merges`, `steps`, `verification_runs`, `gate` (`null` without the gate, else `{mode, ranking, tried, outcome}`); returned as `attribution`, see RunDetail |
|
|
53
53
|
| `max_parallel`, `escalate_after`, `verify_retries` | one integer each |
|
|
54
54
|
| `qa_threshold` | `P0`..`P3`, the least severe finding that still blocks; `final_qa` the final review's QA spec |
|
|
55
|
+
| `profile.json` | the profile the run froze: `name`, `level` (`user`, `repo` or `builtin`), `body` (the profile object), `shadowed` (levels the winning copy hid), `frozen_at` (UTC, `YYYY-MM-DDTHH:MM:SSZ`), `overridden` (the sorted dotted keys a flag of the run replaced, such as `routing.qa.any`; empty when none). RunDetail returns `settings.profile` `{name, level, overridden}`, `null` when the file is absent, unreadable or not that shape |
|
|
55
56
|
| `deferrals.txt` | one line per task the wave planner deferred |
|
|
56
57
|
| `integration.base`, `accepted.integration` | one commit each: where the integration branch started, the revision the run accepted |
|
|
57
58
|
| `attempts/<role>-<uuid>/` | one *execution* (below) of the run itself: `parallel` (a `run`) or `verification` |
|
|
@@ -99,7 +100,7 @@ one of `task dwarf qa solo verification parallel` and `<uuid>` 32 lowercase hex
|
|
|
99
100
|
|
|
100
101
|
| Path | Format |
|
|
101
102
|
|---|---|
|
|
102
|
-
| `metrics.json` | `role`, `started` (monotonic), `wall_started` (epoch), `phase`, `phase_started` (monotonic), `elapsed_s` (seconds per phase, `total` once done), `exit_code` (`null` while in flight), `harness`, `prompt_bytes`, `input_tokens`, `cached_input_tokens`, `output_tokens`, `infra_class`, `shadow` |
|
|
103
|
+
| `metrics.json` | `role`, `started` (monotonic), `wall_started` (epoch), `phase`, `phase_started` (monotonic), `elapsed_s` (seconds per phase, `total` once done), `exit_code` (`null` while in flight), `harness`, `prompt_bytes`, `input_tokens`, `cached_input_tokens`, `output_tokens`, `infra_class`, `shadow`, `service_tier` (the tier asked), `speed` (`fast`, `standard` or `default`), `speed_reason` (why it was not fast) |
|
|
103
104
|
| `dataset.json` | may be absent: `parent` (the execution that started this one, e.g. `task-<uuid>`), `trigger`, `attempt_start` and `resume` (task executions) |
|
|
104
105
|
| `<role>.resolved`, `.prompt`, `.last`, `.timedout`, `.log`, `.clock` | copies made when it finished: the model resolution (`key=value`), the prompt, the final message, the timeout marker, the harness log and its clock |
|
|
105
106
|
|
|
@@ -134,6 +135,7 @@ raise because of one. Older solo dirs have `verdict` and not `status`.
|
|
|
134
135
|
| `attempts/<role>-<uuid>/` | the run's executions: `solo`, `dwarf`, `qa` |
|
|
135
136
|
| `dwarf.input`, `qa.input`, `qa.gate`, `known_issues.md` | as for a plan task |
|
|
136
137
|
| `dwarf.last`, `qa.last` | the role's final message. `qa.last` carries `FORGE_VERDICT:` the same way a plan task does |
|
|
138
|
+
| `profile.json` | as for a plan: the profile the run froze. `settings.profile` is `{name, level, overridden}`, or `null` when the file is absent, unreadable or not that shape |
|
|
137
139
|
| `dwarf.log`, `qa.log` | raw logs. The summary stats them and does not read them, so `updated` moves while a model writes |
|
|
138
140
|
| `changes.diff`, `existing.diff` | the run's change, and the uncommitted changes the repo already had when it started |
|
|
139
141
|
| `fractal-selection.json` | as for a plan |
|
|
@@ -257,7 +259,7 @@ its last 20,000 behind a leading `…`. Their `truncated` lists the field names
|
|
|
257
259
|
| `GET /api/runs/<key>/verification/lanes/<lane>/log[/lines/<n>]` | `200 VerificationLog` of `verification.lane.<lane>.log` |
|
|
258
260
|
| `GET /api/runs/<key>/verification/lanes/<lane>/runs/<k>/log[/lines/<n>]` | `200 VerificationLog` of `verification.lane.<lane>.run-<k>.log` |
|
|
259
261
|
| `GET /api/models` | `200 Models` |
|
|
260
|
-
| `GET /api/health` | `200 {"app": "forge-ui", "version", "build", "pid", "controls": true\|false}`; `controls` is `false` in read-only mode |
|
|
262
|
+
| `GET /api/health` | `200 {"app": "forge-ui", "version", "build", "pid", "controls": true\|false}`; `version` is forge's own (the root `VERSION` file, read when this server started), `null` when that file cannot be read; `controls` is `false` in read-only mode |
|
|
261
263
|
| `GET /api/runs/<key>/controls` | `200` the `forge control show --json` object of a plan run (see Controls); `404` for a solo or unknown run |
|
|
262
264
|
| `POST /api/runs/<key>/controls` | change one control or pin; authenticated, see Controls (write endpoints) |
|
|
263
265
|
| `GET /api/runs/<key>/issues?scope=run\|repo&offline=0\|1&plausible=0\|1&dismissed=0\|1&only=fp,fp` | `200` the `forge issues --json` listing, run fresh on every request (no cache); see Controls (write endpoints) |
|
|
@@ -265,8 +267,15 @@ its last 20,000 behind a leading `…`. Their `truncated` lists the field names
|
|
|
265
267
|
| `POST /api/runs/<key>/issues/dismiss` | dismiss or (`undo`) restore findings; authenticated |
|
|
266
268
|
| `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` |
|
|
267
269
|
| `GET /api/models/reviewers` | `200` the `forge dataset reviewers --json` report (how each reviewer's PASSed work held up); no parameters |
|
|
270
|
+
| `GET /api/projects` | `200 {projects: [ProjectRow]}`: one row per repository (see Projects) |
|
|
271
|
+
| `GET /api/projects/<id>` | `200 Project`, `404` for an unknown id |
|
|
272
|
+
| `GET /api/projects/<id>/findings[?refresh=1]` | `200 ProjectFindings`: every review's findings with their status |
|
|
273
|
+
| `GET /api/projects/<id>/memories[?refresh=1]` | `200 ProjectMemories`: what each checkout's memory gives models and every learning's state |
|
|
274
|
+
| `GET /api/worktrees[?refresh=1]` | `200 Worktrees`: every worktree forge created, with its status and the commands to remove it; cached 60 s (see Worktrees) |
|
|
268
275
|
| `GET /api/config?run=<key>` | `200` the `forge config show --json` of that run's repository root (see Config) |
|
|
269
276
|
| `POST /api/config` | set or unset one allowed key (`repo.verify`, `repo.setup`, `repo.verify-subset`, `decide.gate.<gate>`, `decide.gate.<gate>.provider`, `decide.gate.<gate>.model`); `jev.enabled` is gone; authenticated |
|
|
277
|
+
| `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) |
|
|
278
|
+
| `POST /api/config/profiles` | create, edit, set, unset, remove or select a profile through `forge config profile`; authenticated |
|
|
270
279
|
| `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 |
|
|
271
280
|
| `GET /api/runs/<key>/tasks/<id>/fractal` | `200 TaskFractal` |
|
|
272
281
|
| `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}` |
|
|
@@ -388,7 +397,8 @@ Every RunSummary field, plus:
|
|
|
388
397
|
"request": "the user's request, verbatim",
|
|
389
398
|
"settings": {"explore": 0.5, "shadow_rate": 0.5, "shadow_qa": ["opus", "sol:xhigh"], "timeout": 3600,
|
|
390
399
|
"max_parallel": 2, "qa_threshold": "P2", "escalate_after": 3, "verify_retries": 1,
|
|
391
|
-
"final_qa": "opus"
|
|
400
|
+
"final_qa": "opus",
|
|
401
|
+
"profile": {"name": "balanced", "level": "user", "overridden": ["policy.timeout"]}},
|
|
392
402
|
"attribution": {"culprit": "page", "base_fails": false, "inconclusive": null, "verification_runs": 4,
|
|
393
403
|
"gate_outcome": "confirmed"},
|
|
394
404
|
"verification": {"status": "PASS", "command": "python3 -m unittest", "log_tail": "...",
|
|
@@ -412,6 +422,8 @@ Every RunSummary field, plus:
|
|
|
412
422
|
"ended": 1760622300.0}]},
|
|
413
423
|
"final_review": FinalReviewSummary,
|
|
414
424
|
"final_reviews": [FinalReviewSummary, ...],
|
|
425
|
+
"adoptions": [{"at": 1760621000.0, "base": "...", "tip": "...", "verdict": "PASS", "approved": false,
|
|
426
|
+
"spec": "opus", "review": "adopt-1760621000-7", "reason": "..."}],
|
|
415
427
|
"scheduler": {"live": true, "drained": false, "stopping": null, "max_parallel": 3,
|
|
416
428
|
"pauses": [{"scope": "model:codex/gpt-6", "class": "rate_limit", "harness": "codex", "model": "gpt-6",
|
|
417
429
|
"tasks": ["perf"], "cycle": 1, "until": 1760622130.0, "exhausted": false}]},
|
|
@@ -429,8 +441,11 @@ Every RunSummary field, plus:
|
|
|
429
441
|
list (empty when missing). `max_parallel`, `escalate_after`, `verify_retries` are integers,
|
|
430
442
|
`final_qa` the first line of their file. `qa_threshold` is the effective level (`P0`..`P3`):
|
|
431
443
|
a missing file reads `P2` (forge's default) with `qa_threshold_source` `default`; a file reads
|
|
432
|
-
with source `set`, and `none` in it reads `P3`.
|
|
433
|
-
|
|
444
|
+
with source `set`, and `none` in it reads `P3`. `profile` is `{name, level, overridden}` from
|
|
445
|
+
`profile.json`, the profile the run froze, or `null` when that file is missing, unreadable or
|
|
446
|
+
not a frozen profile (`name` and `level` non-empty strings, `overridden` a list of strings). A solo run
|
|
447
|
+
reads `$RUN/profile.json` the same way and has no other plan settings: every other value is
|
|
448
|
+
`null`, including `shadow_qa`, except `qa_threshold` and its source, which read the same way.
|
|
434
449
|
- `attribution` is the result of `forge-parallel.sh attribute` from `attribution.json`, or `null` when
|
|
435
450
|
the file is missing. `culprit` is the merged task's id or `null`; `base_fails` is `true` only when the
|
|
436
451
|
base verified FAIL; `inconclusive` is the reason the search stopped without a culprit, or `null`;
|
|
@@ -699,7 +714,7 @@ the detail is `request.md`.
|
|
|
699
714
|
"phases": {"preparation": 1.2, "preflight": 0.4, "model": 590.1, "snapshot": 3.3, "verification": 0.0},
|
|
700
715
|
"exit_code": 0, "infra_class": null, "timed_out": false,
|
|
701
716
|
"model": {"spec": "sol:xhigh", "alias": "sol", "harness": "codex", "model": "gpt-sol", "effort": "xhigh",
|
|
702
|
-
"clamped": null},
|
|
717
|
+
"clamped": null, "service_tier": "standard", "speed": "fast", "speed_reason": null},
|
|
703
718
|
"tokens": {"input": 120000, "cached": 90000, "output": 8000}, "prompt_bytes": 45678,
|
|
704
719
|
"verdict": null, "findings": null}
|
|
705
720
|
```
|
|
@@ -726,6 +741,13 @@ the detail is `request.md`.
|
|
|
726
741
|
- `model`: from the `<role>.resolved` copy (a running execution without one: the owner dir's
|
|
727
742
|
live `<role>.resolved`); `spec` is `alias[:effort]`, `effort` is `null` for
|
|
728
743
|
`<harness default>`. `null` for the pipeline roles and when there is no alias.
|
|
744
|
+
`service_tier` is the tier that was asked: `metrics.json`'s `service_tier`, else the
|
|
745
|
+
`<role>.resolved` line `service_tier=` (written only when the dispatch asked for one).
|
|
746
|
+
`speed` is what the log reported (`fast`, `standard` or `default`) and `speed_reason` is why
|
|
747
|
+
it was not fast; both come only from `metrics.json`. Each is a non-empty string with
|
|
748
|
+
surrounding whitespace stripped, or `null` when absent, so a dispatch from before these keys
|
|
749
|
+
is otherwise unchanged. While a dispatch is still running and has no resolved copy of its
|
|
750
|
+
own, `service_tier` falls back to the live `<role>.resolved` and the speed stays unknown.
|
|
729
751
|
- `tokens` is `null` when all three counts are; `timed_out` is whether `<role>.timedout` exists.
|
|
730
752
|
- `verdict` and `findings` (FindingsSummary): `qa` only, from its own `qa.last` copy once done.
|
|
731
753
|
- Executions are ordered by `started` (unknown last), then `id`.
|
|
@@ -803,7 +825,8 @@ TaskDetail:
|
|
|
803
825
|
"known_issues": null, "dwarf_input": "...", "qa_input": "..."},
|
|
804
826
|
"gate": {...},
|
|
805
827
|
"reviews": [{"kind": "primary", "execution": "qa-...", "attempt": 1, "spec": "opus",
|
|
806
|
-
"verdict": "FAIL", "state": "done", "findings": [Finding, ...]
|
|
828
|
+
"verdict": "FAIL", "state": "done", "findings": [Finding, ...],
|
|
829
|
+
"tests": {"status": "could_not_run", "reason": "..."}}],
|
|
807
830
|
"truncated": [], "warnings": []}
|
|
808
831
|
```
|
|
809
832
|
|
|
@@ -812,7 +835,9 @@ TaskDetail:
|
|
|
812
835
|
`dwarf.input`, `qa.input`; the others are `null`). `reviews` lists each non-shadow `qa`
|
|
813
836
|
execution with the findings of its own `qa.last` copy (`null` until it is done); then the
|
|
814
837
|
task's current `qa.last` as a `primary` review with `execution` `null`, only when no
|
|
815
|
-
execution's copy is identical to it; then one `shadow` review per shadow dir.
|
|
838
|
+
execution's copy is identical to it; then one `shadow` review per shadow dir. `tests` is the
|
|
839
|
+
reply's `FORGE_TESTS` line: `status` `ran`, `not_needed`, `could_not_run` or `unclear` (it says
|
|
840
|
+
something else), and `reason` or `null`; `null` when the reply has none.
|
|
816
841
|
|
|
817
842
|
ExecutionDetail: the Execution, plus `resolved` (every `key=value` of `<role>.resolved`, or
|
|
818
843
|
`null`), `dataset` (`{trigger, parent, attempt_start, resume}` or `null`), `prompt` (the
|
|
@@ -824,7 +849,8 @@ solo run), `<task>/<attempt>-<k>`, the review name, or `null`), `truncated` and
|
|
|
824
849
|
|
|
825
850
|
FinalReviewDetail: the FinalReviewSummary, plus `meta` (every `review.meta` key),
|
|
826
851
|
`tasks_summary`, `qa_input`, `qa_last`, `known_issues` (texts or `null`), `findings` (a list
|
|
827
|
-
of Findings, in place of the summary), `truncated` and
|
|
852
|
+
of Findings, in place of the summary), `tests` (as on a TaskDetail review), `truncated` and
|
|
853
|
+
`warnings`.
|
|
828
854
|
|
|
829
855
|
## DiffDetail (`forge_ui/diffs.py`)
|
|
830
856
|
|
|
@@ -1117,7 +1143,10 @@ lines follow, a line was cut, or reaching them took more than 64 MB of reading.
|
|
|
1117
1143
|
"repo_root": "/x/y",
|
|
1118
1144
|
"verdict": "FAIL", "findings": FindingsSummary, "duration_s": 270.0, "tokens": {...},
|
|
1119
1145
|
"agreement": null, "primary_alias": null}],
|
|
1120
|
-
"warnings": ["3f9a0c1d2e4b: tasks/x/attempts.tsv line 2: invalid attempt"]
|
|
1146
|
+
"warnings": ["3f9a0c1d2e4b: tasks/x/attempts.tsv line 2: invalid attempt"],
|
|
1147
|
+
"recommended": {"profile": "balanced",
|
|
1148
|
+
"source": "#86 SWE-bench Pro decomposed runs, 2026-10-28; docs/models.md",
|
|
1149
|
+
"dwarf": {"low": "haiku:xhigh", "medium": "sonnet:medium", "high": "opus:high"}}}
|
|
1121
1150
|
```
|
|
1122
1151
|
|
|
1123
1152
|
- `tasks[]`: one per task (`solo` for a solo run). `repo` is the run's `repo` text and `repo_root` its
|
|
@@ -1149,6 +1178,13 @@ lines follow, a line was cut, or reaching them took more than 64 MB of reading.
|
|
|
1149
1178
|
`task_count`, `counts` or `final_review`, or its `repo_root`, changes (4,096 runs); a run with a `RUNNING` task is
|
|
1150
1179
|
read again after 120 s. One computation runs at a time. Past 50,000 task rows the next run
|
|
1151
1180
|
is left out and `truncated` is true. `warnings` (first 500) are prefixed by the run key.
|
|
1181
|
+
- `recommended`: the balanced built-in's first `routing.dwarf` spec of each tier, read from
|
|
1182
|
+
`scripts/forge_decide/builtin_profiles.json` and cached for the life of the process (a later
|
|
1183
|
+
edit of that file is picked up by the next server). `profile` is `"balanced"`. `source` is
|
|
1184
|
+
that profile's `source` when it is a string, otherwise `""`. `dwarf` maps `low`, `medium`
|
|
1185
|
+
and `high` to that tier's first spec; a tier whose pool does not start with one is omitted.
|
|
1186
|
+
The whole value is `null` when the file cannot be read or no tier qualifies. The object
|
|
1187
|
+
above is what the shipped file answers today.
|
|
1152
1188
|
|
|
1153
1189
|
## Fractal (`forge_ui/fractal.py`)
|
|
1154
1190
|
|
|
@@ -1354,8 +1390,8 @@ object its stdout holds, when that parses as one.
|
|
|
1354
1390
|
| timeout | `504` | `timeout` |
|
|
1355
1391
|
|
|
1356
1392
|
For the controls routes, unknown run keys, solo runs (they have no controls) and runs the
|
|
1357
|
-
catalog does not hold are `404 {"error": "not found"}`. The issues, dismiss, delete and
|
|
1358
|
-
routes below accept plan and solo runs alike (`forge issues` and `forge runs rm` take both);
|
|
1393
|
+
catalog does not hold are `404 {"error": "not found"}`. The issues, dismiss, delete, config and
|
|
1394
|
+
profile routes below accept plan and solo runs alike (`forge issues` and `forge runs rm` take both);
|
|
1359
1395
|
for them only unknown keys and runs the catalog does not hold are `404`. Every write that reaches a route logs
|
|
1360
1396
|
`forge-ui: control <route> <run key> -> <status>` unless the server runs with `--quiet`.
|
|
1361
1397
|
|
|
@@ -1448,6 +1484,72 @@ Runs `dataset reviewers --json` and answers with its object: `horizon_days`, `mi
|
|
|
1448
1484
|
request runs the CLI, and the page asks once per change of `/api/models`. Advisory: it feeds the
|
|
1449
1485
|
Reviewers table's Did not hold column and nothing else. Timeout 60 s.
|
|
1450
1486
|
|
|
1487
|
+
### `GET /api/projects` and `/api/projects/<id>[/findings|/memories]`
|
|
1488
|
+
|
|
1489
|
+
The Projects screen (`forge_ui/projects.py`). Read-only, so they answer in `--read-only` mode too, and
|
|
1490
|
+
none of them calls `gh`. A project is one repository root as `repos.py` resolves it; `<id>` is the run
|
|
1491
|
+
cloud's (cloudmodel.js `hashId`: FNV-1a over the root's UTF-16 code units, 8 hex digits).
|
|
1492
|
+
|
|
1493
|
+
```
|
|
1494
|
+
ProjectRow = {id, name, root, exists, runs, live, last, path_only (runs tied by path only), checkouts,
|
|
1495
|
+
memory_lines (lines of <root>/.forge/memory.md, null when absent), open_findings (not superseded)}
|
|
1496
|
+
Project = {id, name, root, exists, live, last, path_only, memory_off_runs,
|
|
1497
|
+
checkouts: [{path, exists, branch, runs, root}], runs: [RunSummary + identity_source, dataset_uid, no_memory]}
|
|
1498
|
+
ProjectFindings = {id, rows: [Finding], notes: [text], runs, dataset_runs, computed, available}
|
|
1499
|
+
Finding = {source: run|dataset, run (key or null), run_id, task, final_review (its dir name, 'final' from the
|
|
1500
|
+
dataset), attempt, kind: primary|shadow|final, reviewer, verdict, at, id, severity, confidence, location,
|
|
1501
|
+
summary, text, fp (forge issues' key, null when it cannot parse the line), count, occurrences: [{run,
|
|
1502
|
+
run_id, task, attempt, kind, reviewer, at, href}], status, fileable, origin, href (the diff at the finding)}
|
|
1503
|
+
ProjectMemories = {id, sources: [{path, root, branch, ok, ledger, memory, rebuilt_differs, max_lines}], differs,
|
|
1504
|
+
learnings: [{category, key, text, count, states: {source path: state}, rows, last, dataset_only}],
|
|
1505
|
+
notes, memory_off_runs, runs, computed}
|
|
1506
|
+
```
|
|
1507
|
+
|
|
1508
|
+
Findings come from every review of every run dir (parsed by forge-contract.py through `findings.py`), and
|
|
1509
|
+
from `dataset history --json` for runs whose dir is gone (their base commit ties a run whose checkout is
|
|
1510
|
+
gone to the project, as `repos.py` does). `status` comes from one `issues <run> --json --offline --all-runs
|
|
1511
|
+
--include-plausible --include-dismissed` listing per project, matched by `forge issues`' own key, else
|
|
1512
|
+
`superseded` when a later review of the same task (or a later final review) passed, else `open`. Repeats
|
|
1513
|
+
within a task collapse by that key; a line it cannot parse is its own row. Memories run `memory learnings
|
|
1514
|
+
<checkout> --json` for the root and each checkout a run started in that still exists. A run's findings
|
|
1515
|
+
are cached by its `updated` time, the CLI's answers for 300 s; `refresh=1` reads everything again; any
|
|
1516
|
+
other parameter is a `400`.
|
|
1517
|
+
|
|
1518
|
+
### `GET /api/worktrees`
|
|
1519
|
+
|
|
1520
|
+
The Worktrees screen (`forge_ui/worktrees.py`). Read-only, so it answers in `--read-only` mode too.
|
|
1521
|
+
It runs `git worktree list --porcelain -z` in every repository forge-ui knows (the roots of the runs
|
|
1522
|
+
it lists, and the repositories `forge dataset worktrees --json` names), `git status` in each forge
|
|
1523
|
+
worktree on disk, one `git show` per repository for the last commits and one `for-each-ref --merged
|
|
1524
|
+
HEAD` for merged branches; it lists the folders under each `.forge-worktrees` that no repository
|
|
1525
|
+
lists, and adds the dataset's history through `dataset worktrees --json`. Who owns a worktree is
|
|
1526
|
+
forge's rule (`scripts/forge_worktrees.py`, the one `forge runs rm` uses). The answer is cached
|
|
1527
|
+
for 60 s per server; `refresh=1` reads everything again, any other parameter is a `400`. Sizes are
|
|
1528
|
+
walked in a background thread and are `null` until measured (`sizes_pending` counts the rest).
|
|
1529
|
+
|
|
1530
|
+
```
|
|
1531
|
+
Worktrees = {
|
|
1532
|
+
rows: [Row], truncated, runs: [{key, run_id, path, repo, active, command}], repos: [root],
|
|
1533
|
+
notes: [text], dataset: {enabled, since} | null (the CLI failed), computed (unix time),
|
|
1534
|
+
totals: {count, on_disk, bytes, by_status: {status: n}}, sizes_pending
|
|
1535
|
+
}
|
|
1536
|
+
Row = {
|
|
1537
|
+
path, repo (the repository's main working tree, or null), git_dir, run (run key or null),
|
|
1538
|
+
run_id, run_path, task, branch (null when detached), kind (task | integration | candidate |
|
|
1539
|
+
attribute | null), status, merged (branch merged into the repository's HEAD; null unknown),
|
|
1540
|
+
head, commit: {sha, time, subject} | null, created, removed (unix times or null), derived
|
|
1541
|
+
(true: from a run dir or the dataset, no dates), locked (git's reason, '' for none, null when
|
|
1542
|
+
not locked), size (bytes or null), note, commands: [{label, command}]
|
|
1543
|
+
}
|
|
1544
|
+
```
|
|
1545
|
+
|
|
1546
|
+
`status` is one of `in_use`, `dirty`, `locked`, `needed`, `failed`, `finished`, `missing`,
|
|
1547
|
+
`foreign`, `unknown`, `removed`. Commands: `dirty` gets `git -C <path> status`; `failed` gets
|
|
1548
|
+
`git -C <repo> worktree remove <path>`; `finished` gets the same plus `git -C <repo> branch -d
|
|
1549
|
+
<branch>` when the branch is merged; `missing` gets `git -C <repo> worktree prune`; every other
|
|
1550
|
+
status gets none. Paths are quoted for the shell and no command has `--force`. `runs[].command` is
|
|
1551
|
+
`forge runs rm <run-dir> --worktrees --branches --dry-run`, null while the run is active.
|
|
1552
|
+
|
|
1451
1553
|
### `GET /api/config?run=<key>` and `POST /api/config`
|
|
1452
1554
|
|
|
1453
1555
|
The repository is the run's `repo_root` (see RunSummary) when that is an existing absolute directory,
|
|
@@ -1481,6 +1583,60 @@ are allowed), not starting with `-`; `repo.verify-subset` must contain `{files}`
|
|
|
1481
1583
|
CLI's object (`ok`, `key`, `previous`, `value`). Writes serialize on one server-wide config lock
|
|
1482
1584
|
(`409 busy`). Unknown run `404`. Timeout 60 s.
|
|
1483
1585
|
|
|
1586
|
+
### `GET /api/config/profiles?run=<key>` and `POST /api/config/profiles`
|
|
1587
|
+
|
|
1588
|
+
The run is resolved as for `/api/config`: the repository is the run's root when that is an
|
|
1589
|
+
existing absolute directory, else the run's own `repo` file, and a missing directory is `409`.
|
|
1590
|
+
An unknown run is `404`. A key that is not 12 hex, or any query parameter other than `run`, is
|
|
1591
|
+
`400` before the CLI runs. `GET` does not take the config lock.
|
|
1592
|
+
|
|
1593
|
+
`GET` runs `config profile list --json --repo <repo>`, then `config profile show <name> --json
|
|
1594
|
+
--repo <repo>` once per row, and answers with the list object with each profile's `body` added.
|
|
1595
|
+
One request is enough for the Settings page. Each row is `{name, level, shadowed, default, body}`:
|
|
1596
|
+
|
|
1597
|
+
- `level` is `user`, `repo` or `builtin` (user hides repo hides builtin).
|
|
1598
|
+
- `shadowed` is the levels that copy hides, in that order, or `[]`.
|
|
1599
|
+
- `default` is whether this profile is the default in effect.
|
|
1600
|
+
- `body` is the winning profile object, the one `show` prints.
|
|
1601
|
+
|
|
1602
|
+
The top-level `default` is `{name, level}` of the default in effect (`default_profile` in the
|
|
1603
|
+
user file, else the repo file), or `{name: null, level: null}` when none is selected. A list or
|
|
1604
|
+
a show that does not print that object, or a row whose name is not a profile name, is `502`.
|
|
1605
|
+
Timeout 60 s per CLI call.
|
|
1606
|
+
|
|
1607
|
+
`POST` takes `{"run": <key>, "action", "level": "user"|"repo", ...}`. `level: "repo"` adds
|
|
1608
|
+
`--repo <repo>` before `--json` and writes `<repo>/.forge/decide.json`; `user` writes the user
|
|
1609
|
+
file and passes no `--repo`. `--json` is always last. The answer is the CLI's `--json` object,
|
|
1610
|
+
`{"ok": true, "name", "level", "body"}` (`rm` returns the removed profile's `name` and
|
|
1611
|
+
`"body": null`; both `name` and `body` are `null` when `use --none` cleared the default).
|
|
1612
|
+
A failure uses the exit mapping above, with `result`
|
|
1613
|
+
set to `{"ok": false, "error"}` when the CLI printed one.
|
|
1614
|
+
|
|
1615
|
+
| `action` | other fields | CLI |
|
|
1616
|
+
|---|---|---|
|
|
1617
|
+
| `create` | `name`, and exactly one of `from` (another profile's name) or `body` (an object) | `config profile create NAME --from OTHER` or `--file -` |
|
|
1618
|
+
| `edit` | `name`, `body` | `config profile edit NAME --file -` |
|
|
1619
|
+
| `set` | `name`, `key`, `value` | `config profile set NAME KEY VALUE` |
|
|
1620
|
+
| `unset` | `name`, `key` | `config profile unset NAME KEY` |
|
|
1621
|
+
| `rm` | `name` | `config profile rm NAME` |
|
|
1622
|
+
| `use` | `name`, or `"none": true` (not both) | `config profile use NAME` or `config profile use --none` |
|
|
1623
|
+
|
|
1624
|
+
A `body` is written to the CLI's stdin as JSON (`--file -`). That text is refused at 64 KiB
|
|
1625
|
+
with `400`; the HTTP body is already capped at 64 KiB (`413`) by the server, and a re-encode
|
|
1626
|
+
can be the larger of the two. This is the one write that passes stdin. Checked before any CLI
|
|
1627
|
+
runs, and a failure there calls nothing: `action` is one of the six; `name` and `from` match
|
|
1628
|
+
`^[A-Za-z0-9][A-Za-z0-9_.-]{0,63}$`; `key` matches `^(routing|policy)\.[a-z_.]+$` (the CLI still
|
|
1629
|
+
rejects a key of that shape that is not a real profile key); `value` is a string with no
|
|
1630
|
+
control characters, newline and tab included, and not starting with `-`; `level` is `user` or
|
|
1631
|
+
`repo`; `body` is a JSON object. Any other field is `400`.
|
|
1632
|
+
|
|
1633
|
+
Writes take the same server-wide config lock as `/api/config` (`409 {"error": "busy"}`) and the
|
|
1634
|
+
same token and Origin checks. Timeout 60 s. Exit 2 is `400` (`invalid`). Exit 3 is `409`
|
|
1635
|
+
(`refused`), as for every other write. That includes editing, setting, unsetting or removing a
|
|
1636
|
+
built-in profile (`balanced`, `lite`) that has no copy at the level being written: the detail
|
|
1637
|
+
says it is read-only and names `forge config profile create NAME --from <name>`. The CLI does the validation and the writing, so a profile created here is
|
|
1638
|
+
byte-for-byte the file `forge config profile create` writes.
|
|
1639
|
+
|
|
1484
1640
|
## Status vocabulary for the page and the graph
|
|
1485
1641
|
|
|
1486
1642
|
Both the page and the graph mark a task by its status with the CSS class
|
package/ui/forge_ui/__init__.py
CHANGED
|
@@ -4,7 +4,20 @@ from __future__ import annotations
|
|
|
4
4
|
import hashlib
|
|
5
5
|
from pathlib import Path
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
# forge's own version: this package ships inside forge, and two numbers could only disagree. What a
|
|
8
|
+
# running server reports is what it started with, which an upgrade underneath it does not change.
|
|
9
|
+
VERSION_FILE = Path(__file__).resolve().parents[2] / 'VERSION'
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
def read_version(path=VERSION_FILE):
|
|
13
|
+
"""The first line of forge's VERSION file, or None when it cannot be read."""
|
|
14
|
+
try:
|
|
15
|
+
return Path(path).read_text(encoding='utf-8').split('\n', 1)[0].strip() or None
|
|
16
|
+
except (OSError, ValueError):
|
|
17
|
+
return None
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
__version__ = read_version()
|
|
8
21
|
|
|
9
22
|
|
|
10
23
|
def build_id():
|
package/ui/forge_ui/__main__.py
CHANGED
|
@@ -38,7 +38,7 @@ def _parser():
|
|
|
38
38
|
parser.add_argument('--read-only', action='store_true',
|
|
39
39
|
help='answer no write at all (also FORGE_UI_READONLY=1); the page shows no controls')
|
|
40
40
|
parser.add_argument('--open', action='store_true', help='open the page in the browser once started')
|
|
41
|
-
parser.add_argument('--version', action='version', version=f'forge-ui {__version__}')
|
|
41
|
+
parser.add_argument('--version', action='version', version=f'forge-ui {__version__ or "unknown"}')
|
|
42
42
|
return parser
|
|
43
43
|
|
|
44
44
|
|