@giamme/forge 0.13.0 → 0.14.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 +40 -0
- package/SKILL.md +17 -11
- package/VERSION +1 -1
- package/docs/artifacts.md +1 -0
- package/docs/commands.md +121 -7
- package/docs/development.md +3 -0
- package/docs/forge-ui.md +7 -1
- package/docs/reviews.md +2 -0
- package/docs/troubleshooting.md +5 -1
- package/forge +28 -1
- package/package.json +1 -1
- package/references/dataset.md +3 -1
- package/references/decision-models.md +5 -1
- package/references/decompose.md +199 -61
- package/references/runtime.md +29 -0
- package/references/ui.md +10 -0
- package/scripts/forge-compare.py +491 -0
- package/scripts/forge-config.py +3 -3
- package/scripts/forge-contract.py +34 -8
- package/scripts/forge-control.py +105 -13
- package/scripts/forge-dispatch.sh +9 -5
- package/scripts/forge-jev-options.sh +17 -4
- package/scripts/forge-ledger.py +387 -0
- package/scripts/forge-lib-plans.sh +16 -2
- package/scripts/forge-lib-task.sh +390 -28
- package/scripts/forge-parallel-options.sh +20 -4
- package/scripts/forge-parallel.sh +118 -12
- package/scripts/forge-plan-check.py +68 -3
- package/scripts/forge-pr.py +276 -0
- package/scripts/forge-route.py +350 -34
- package/scripts/forge-runs.py +18 -1
- package/scripts/forge-runtime.py +23 -7
- package/scripts/forge-schedule.py +303 -46
- package/scripts/forge-solo.sh +1 -0
- package/scripts/forge-ui-options.sh +25 -0
- package/scripts/forge-verify-failed.py +111 -0
- package/scripts/forge-watch.py +372 -0
- package/scripts/forge_dataset/export.py +87 -41
- package/scripts/forge_dataset/harvest.py +3 -1
- package/scripts/forge_decide/budget.py +39 -8
- package/scripts/forge_decide/doctor.py +49 -0
- package/scripts/forge_fractal/cli.py +23 -6
- package/scripts/forge_infra.py +274 -0
- package/scripts/forge_jev/client.py +13 -9
- package/ui/docs/api.md +83 -15
- package/ui/forge_ui/control.py +11 -3
- package/ui/forge_ui/export.py +6 -2
- package/ui/forge_ui/models.py +16 -16
- package/ui/forge_ui/reader.py +217 -13
- package/ui/forge_ui/repos.py +428 -0
- package/ui/forge_ui/static/app.js +24 -5
- package/ui/forge_ui/static/checksview.js +20 -7
- package/ui/forge_ui/static/cloudmodel.js +8 -5
- package/ui/forge_ui/static/controls.js +6 -3
- package/ui/forge_ui/static/modelstats.js +12 -8
- package/ui/forge_ui/static/panel.js +69 -4
- package/ui/forge_ui/static/runmodel.js +55 -10
- package/ui/forge_ui/static/scene3d.js +3 -2
- package/ui/forge_ui/static/settings.js +147 -29
- package/ui/forge_ui/static/style.css +49 -7
|
@@ -571,6 +571,21 @@ def session_continued(event) -> bool:
|
|
|
571
571
|
return (event.get('d') or {}).get('session_continue') is not None
|
|
572
572
|
|
|
573
573
|
|
|
574
|
+
def _ending_qa(rows) -> dict:
|
|
575
|
+
"""Index, per attempt, of the last primary dispatch with a PASS or FAIL verdict.
|
|
576
|
+
|
|
577
|
+
`rows` is the chronological list `runs.dispatches[(run, task, 'qa')]`. The choice is
|
|
578
|
+
made before continued sessions are removed: the dispatch the attempt ended on may have
|
|
579
|
+
continued a reviewer session, and an earlier fresh verdict must not stand in for it.
|
|
580
|
+
Same choice as `shadow_pairs`.
|
|
581
|
+
"""
|
|
582
|
+
ending = {}
|
|
583
|
+
for index, event in enumerate(rows):
|
|
584
|
+
if (event.get('d') or {}).get('verdict') in ('PASS', 'FAIL'):
|
|
585
|
+
ending[event['attempt']] = index
|
|
586
|
+
return ending
|
|
587
|
+
|
|
588
|
+
|
|
574
589
|
def _qa_rows(runs: Runs):
|
|
575
590
|
"""Every independent QA dispatch with a verdict, with the diff it was shown and its task text.
|
|
576
591
|
|
|
@@ -578,6 +593,11 @@ def _qa_rows(runs: Runs):
|
|
|
578
593
|
one whose continue failed after it had already printed a verdict. A fresh fallback in
|
|
579
594
|
the same round has no `session_continue` and stays. There is no switch to put the
|
|
580
595
|
continued ones back, so a slice never mixes the two.
|
|
596
|
+
|
|
597
|
+
The attempt event's gate belongs to the QA execution the attempt ended on (see
|
|
598
|
+
`_ending_qa`). Every earlier dispatch of that attempt gets `gate=None`. When the one
|
|
599
|
+
the attempt ended on continued a session, it is skipped below, so no row of the
|
|
600
|
+
attempt carries the gate.
|
|
581
601
|
"""
|
|
582
602
|
store = runs.store
|
|
583
603
|
effort = {}
|
|
@@ -592,7 +612,8 @@ def _qa_rows(runs: Runs):
|
|
|
592
612
|
for (run, task, role), rows in runs.dispatches.items():
|
|
593
613
|
if role != 'qa':
|
|
594
614
|
continue
|
|
595
|
-
|
|
615
|
+
ending = _ending_qa(rows)
|
|
616
|
+
for index, e in enumerate(rows):
|
|
596
617
|
if session_continued(e):
|
|
597
618
|
continue
|
|
598
619
|
d = e['d']
|
|
@@ -603,15 +624,24 @@ def _qa_rows(runs: Runs):
|
|
|
603
624
|
if not blocks or not blocks[-1].strip():
|
|
604
625
|
continue
|
|
605
626
|
found = d.get('findings') or []
|
|
627
|
+
# Only the dispatch the attempt ended on was gated. An earlier one in the same
|
|
628
|
+
# attempt (a QA-only re-run keeps the number) was never the gate's input.
|
|
629
|
+
gate = gates.get((run, task, e['attempt'])) if ending.get(e['attempt']) == index else None
|
|
606
630
|
yield dict(run=run, task=task, attempt=e['attempt'], repo=e['repo'], verdict=d['verdict'],
|
|
607
|
-
gate=
|
|
631
|
+
gate=gate,
|
|
608
632
|
diff=blocks[-1], review=store.text((d.get('blobs') or {}).get('message')),
|
|
609
633
|
effort=effort.get((run, task, e['attempt'])), model=d.get('model'),
|
|
610
634
|
reviewer=dict(model=d.get('model'), effort=d.get('effort'), harness=d.get('harness')),
|
|
611
635
|
# Receipts from before findings_parse existed: an empty list then cannot
|
|
612
636
|
# tell a clean review from a parser failure, which was rare; read it as clean.
|
|
613
637
|
completeness=d.get('findings_parse') or review_completeness(d['verdict'], found),
|
|
614
|
-
worst=_worst(found)
|
|
638
|
+
worst=_worst(found),
|
|
639
|
+
# The dispatch this row was built from. A shadow pair names that event,
|
|
640
|
+
# so an earlier execution of the same attempt cannot claim it.
|
|
641
|
+
dispatch=e,
|
|
642
|
+
# Its place in the task's chronological QA dispatches: a split review
|
|
643
|
+
# case is keyed by it, never by the order rows come out of the store.
|
|
644
|
+
execution=index)
|
|
615
645
|
|
|
616
646
|
|
|
617
647
|
def _worst(found) -> str:
|
|
@@ -694,44 +724,60 @@ def review_cases(runs: Runs):
|
|
|
694
724
|
if len(verdicts) != 1:
|
|
695
725
|
# Two reviews of the same diff disagreed: the label is noise, not an outcome.
|
|
696
726
|
continue
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
#
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
727
|
+
# Same verdict on one diff stays one case, separate runs that met the same diff
|
|
728
|
+
# included. Only the executions of one attempt split, when forge gated them
|
|
729
|
+
# differently: the first row's gate must not hide the one the attempt ended on.
|
|
730
|
+
gates = defaultdict(set)
|
|
731
|
+
for item, _ in items:
|
|
732
|
+
gates[(item['run'], item['task'], item['attempt'])].add(item['gate'])
|
|
733
|
+
split = any(len(g) > 1 for g in gates.values())
|
|
734
|
+
exported = items if split else [items[0]]
|
|
735
|
+
for r, task in exported:
|
|
736
|
+
cohort = [(r, task)] if split else items
|
|
737
|
+
diff = r['diff']
|
|
738
|
+
# Who reviews decides the outcome as much as the diff: the same diff meets a 0.93 pass rate
|
|
739
|
+
# from one reviewer and 0.39 from another, so the reviewer is part of the state.
|
|
740
|
+
state = dict(diff=diff[:DIFF_CHARS], task=task, truncated=len(diff) > DIFF_CHARS, reviewer=r['reviewer'])
|
|
741
|
+
baseline = {}
|
|
742
|
+
if r['effort'] and r['effort'][0] in EFFORT_RANK:
|
|
743
|
+
baseline['passes'] = dict(source='hosted-jev qa effort', risk=EFFORT_RANK[r['effort'][0]] / 4.0)
|
|
744
|
+
questions, expected = dict(passes=review_passes()), dict(passes=r['verdict'] == 'PASS')
|
|
745
|
+
label_source = dict(passes='QA verdict')
|
|
746
|
+
# A graded label only where every review of this diff agrees. The gate split
|
|
747
|
+
# exports each execution, but severity stays a property of the whole group:
|
|
748
|
+
# a clean PASS beside a PASS that lists a confirmed P2 disagree, so neither
|
|
749
|
+
# case is graded. Skipping an unreadable review keeps "none" honest.
|
|
750
|
+
if all(item['completeness'] in ('clean', 'graded') for item, _ in items) and \
|
|
751
|
+
len({item['worst'] for item, _ in items}) == 1:
|
|
752
|
+
questions['severity'], expected['severity'] = review_severity(), r['worst']
|
|
753
|
+
label_source['severity'] = 'worst CONFIRMED finding (%s)' % r['completeness']
|
|
754
|
+
meta = dict(completeness=r['completeness'], gate=r['gate'])
|
|
755
|
+
# A second reviewer of the same diff, never consulted by the run: agreement is how
|
|
756
|
+
# much of this label is the diff and how much is who happened to review it.
|
|
757
|
+
# shadow_pairs binds that comparison to the dispatch the attempt ended on. A gate
|
|
758
|
+
# split exports every execution; only the cohort that contains that dispatch may
|
|
759
|
+
# carry it, or an earlier review of the same attempt would count the pair too.
|
|
760
|
+
paired = next((shadows[k] for k in dict.fromkeys((i['run'], i['task'], i['attempt']) for i, _ in cohort)
|
|
761
|
+
if k in shadows and any(item.get('dispatch') is shadows[k][0] for item, _ in cohort)), None)
|
|
762
|
+
if paired:
|
|
763
|
+
primary, shadow = paired
|
|
764
|
+
meta['shadow'] = dict(verdict=shadow['d']['verdict'], reviewer=shadow['d'].get('model'),
|
|
765
|
+
worst=_worst(shadow['d'].get('findings') or []))
|
|
766
|
+
meta['consensus'] = shadow['d']['verdict'] == primary['d']['verdict']
|
|
767
|
+
# The one label here no reviewer decides: whether the merged diff's lines stayed.
|
|
768
|
+
landed = next((runs.survival[c] for c in (runs.reviewed.get((i['run'], i['task'], i['attempt']))
|
|
769
|
+
for i, _ in cohort) if c in runs.survival), None)
|
|
770
|
+
if landed:
|
|
771
|
+
kept = landed['surviving'] / landed['added']
|
|
772
|
+
questions['survives'] = review_survives()
|
|
773
|
+
expected['survives'] = kept >= SURVIVES_AT and not landed.get('reverted_by')
|
|
774
|
+
label_source['survives'] = 'git blame %d days after integrate' % landed['horizon_days']
|
|
775
|
+
meta['survival'] = dict(added=landed['added'], surviving=landed['surviving'],
|
|
776
|
+
reverted_by=landed.get('reverted_by') or [], horizon_days=landed['horizon_days'])
|
|
777
|
+
yield dict(slice='review', key=key if not split else _sha(key, r['run'], r['task'], r['attempt'], r['execution']),
|
|
778
|
+
run=r['run'], repo=r['repo'], task=r['task'], state=state,
|
|
779
|
+
questions=questions, expected=expected, baseline=baseline, label_source=label_source,
|
|
780
|
+
reviewer=r['model'], meta=meta)
|
|
735
781
|
|
|
736
782
|
|
|
737
783
|
_SKIP_PREFIXES = ('.git/', '.forge/', 'node_modules/', 'vendor/', 'target/', 'dist/',
|
|
@@ -45,7 +45,8 @@ WATCHED = (
|
|
|
45
45
|
'verification.retry.log', 'verification.flaky', 'verification.coverage.txt',
|
|
46
46
|
'verification.jev.json', 'verification.runs.tsv', 'verification.commit', 'verification.fingerprint',
|
|
47
47
|
'verification.lanes.json', 'results.tsv',
|
|
48
|
-
'prereview.failed', 'bounced', 'message.failed', 'needs_input.md',
|
|
48
|
+
'prereview.failed', 'bounced', 'message.failed', 'needs_input.md', 'lateral.tsv',
|
|
49
|
+
'decision.md', 'decisions.tsv', 'ledger.tsv',
|
|
49
50
|
)
|
|
50
51
|
|
|
51
52
|
# The markers of an attempt forge sent back without a review, and the kind each one records.
|
|
@@ -358,6 +359,7 @@ def run_uid(run_dir: Path, create: bool) -> str:
|
|
|
358
359
|
|
|
359
360
|
INTERVENTIONS = {
|
|
360
361
|
'escalation': ('after_attempt', 'from', 'to', 'source'),
|
|
362
|
+
'lateral': ('attempt', 'role', 'from', 'to', 'cause'),
|
|
361
363
|
'control': ('at', 'actor', 'action', 'key', 'value', 'previous'),
|
|
362
364
|
}
|
|
363
365
|
|
|
@@ -7,9 +7,12 @@ left alone). The transports call check() before a request and charge() after it;
|
|
|
7
7
|
has been reached turns every remaining call into a skip with reason 'budget'.
|
|
8
8
|
|
|
9
9
|
Fail-open throughout: check() and charge() never raise, a counter that cannot be read or
|
|
10
|
-
parsed counts as zero, and a lock or write failure skips the charge.
|
|
11
|
-
|
|
12
|
-
|
|
10
|
+
parsed counts as zero, and a lock or write failure skips the charge. A stored usd of positive
|
|
11
|
+
infinity is kept: an overflowed cost has reached the USD caps, and a later charge leaves it
|
|
12
|
+
infinite. NaN, a negative, a non-number and an integer too big for a float still count as
|
|
13
|
+
zero. Several processes of one run may charge at once, so each read-modify-write holds
|
|
14
|
+
flock(LOCK_EX) on a sibling .lock file and the write is a temp file plus os.replace. Standard
|
|
15
|
+
library only.
|
|
13
16
|
"""
|
|
14
17
|
from __future__ import annotations
|
|
15
18
|
|
|
@@ -37,6 +40,31 @@ def _number(value) -> float:
|
|
|
37
40
|
return 0
|
|
38
41
|
|
|
39
42
|
|
|
43
|
+
def _usd(value) -> float:
|
|
44
|
+
"""Stored USD spend. +inf stays inf: an overflowed cost reached the cap. NaN, a negative,
|
|
45
|
+
a non-number, or an integer too big for a float counts as zero."""
|
|
46
|
+
if isinstance(value, bool) or not isinstance(value, (int, float)):
|
|
47
|
+
return 0.0
|
|
48
|
+
try:
|
|
49
|
+
number = float(value)
|
|
50
|
+
except OverflowError:
|
|
51
|
+
return 0.0
|
|
52
|
+
if math.isnan(number) or number <= 0:
|
|
53
|
+
return 0.0
|
|
54
|
+
return number
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
def _sum_usd(current: float, extra: float) -> float:
|
|
58
|
+
"""Positive infinity stays infinity. A later charge must not turn it into NaN or zero."""
|
|
59
|
+
if _positive_inf(current) or _positive_inf(extra):
|
|
60
|
+
return math.inf
|
|
61
|
+
return current + extra
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
def _positive_inf(value) -> bool:
|
|
65
|
+
return isinstance(value, float) and math.isinf(value) and value > 0
|
|
66
|
+
|
|
67
|
+
|
|
40
68
|
def usage_tokens(usage) -> int:
|
|
41
69
|
"""Tokens a response used: input+output, else prompt+completion, else total."""
|
|
42
70
|
if not isinstance(usage, dict):
|
|
@@ -76,7 +104,7 @@ def _read(path: Path | None) -> dict:
|
|
|
76
104
|
return zero
|
|
77
105
|
try:
|
|
78
106
|
data = json.loads(path.read_text())
|
|
79
|
-
return {'tokens': int(_number(data['tokens'])), 'usd':
|
|
107
|
+
return {'tokens': int(_number(data['tokens'])), 'usd': _usd(data['usd'])}
|
|
80
108
|
except (OSError, ValueError, KeyError, TypeError, OverflowError, RecursionError):
|
|
81
109
|
return zero
|
|
82
110
|
|
|
@@ -88,7 +116,7 @@ def _add(path: Path, tokens: int, usd: float) -> None:
|
|
|
88
116
|
fcntl.flock(lock, fcntl.LOCK_EX)
|
|
89
117
|
total = _read(path)
|
|
90
118
|
total['tokens'] += tokens
|
|
91
|
-
total['usd']
|
|
119
|
+
total['usd'] = _sum_usd(total['usd'], usd)
|
|
92
120
|
tmp = path.with_name(f'{path.name}.{os.getpid()}.tmp')
|
|
93
121
|
try:
|
|
94
122
|
tmp.write_text(json.dumps(total))
|
|
@@ -100,12 +128,15 @@ def _add(path: Path, tokens: int, usd: float) -> None:
|
|
|
100
128
|
|
|
101
129
|
|
|
102
130
|
def _reached(spent, cap, slack=0.0) -> bool:
|
|
103
|
-
#
|
|
104
|
-
#
|
|
105
|
-
#
|
|
131
|
+
# Token caps pass no slack and compare as integers, so a count above 2^53 is exact.
|
|
132
|
+
# USD caps pass USD_SLACK, which scales the (finite) spend, never the cap: an int cap
|
|
133
|
+
# too big for a float still compares exactly. A cap that cannot be compared never
|
|
134
|
+
# blocks, and never stops the other caps from being checked.
|
|
106
135
|
if cap is None:
|
|
107
136
|
return False
|
|
108
137
|
try:
|
|
138
|
+
if not slack:
|
|
139
|
+
return spent >= cap
|
|
109
140
|
return spent * (1 + slack) >= cap
|
|
110
141
|
except Exception:
|
|
111
142
|
return False
|
|
@@ -14,6 +14,11 @@ and thresholds only. Kinds:
|
|
|
14
14
|
shadowed a repo value the user file overrides
|
|
15
15
|
misplaced a user-only key in a repo file, or `privacy` in a user file
|
|
16
16
|
key-file a provider's key file is missing or not mode 0600
|
|
17
|
+
bad-price a provider's price_usd_per_mtok is not a finite number above zero,
|
|
18
|
+
so the price is ignored ({provider, value}). NaN and ±Infinity are
|
|
19
|
+
the strings "NaN", "Infinity" and "-Infinity" wherever they sit,
|
|
20
|
+
including inside a list or object: they are not JSON numbers, and
|
|
21
|
+
`doctor --json` must stay standard JSON
|
|
17
22
|
privacy-floor the repo has `privacy: never-send`
|
|
18
23
|
not-migrated jev.json exists but decide.json does not
|
|
19
24
|
config-error anything else wrong with reading the files
|
|
@@ -27,6 +32,7 @@ from pathlib import Path
|
|
|
27
32
|
|
|
28
33
|
from . import GATES, config_dir, load_repo, load_user, repo_path, user_path
|
|
29
34
|
from .migrate import retired_thresholds
|
|
35
|
+
from .providers import _positive
|
|
30
36
|
from .resolve import resolve
|
|
31
37
|
|
|
32
38
|
MISPLACED_MARKERS = ('user file only', 'only in a repo file')
|
|
@@ -133,6 +139,48 @@ def _key_path(value: str) -> Path:
|
|
|
133
139
|
return path if path.is_absolute() else config_dir() / path
|
|
134
140
|
|
|
135
141
|
|
|
142
|
+
def _price_text(value) -> str:
|
|
143
|
+
if isinstance(value, float) and value != value:
|
|
144
|
+
return 'NaN'
|
|
145
|
+
if value == float('inf'):
|
|
146
|
+
return 'Infinity'
|
|
147
|
+
if value == float('-inf'):
|
|
148
|
+
return '-Infinity'
|
|
149
|
+
return str(value)
|
|
150
|
+
|
|
151
|
+
|
|
152
|
+
def _json_price(value):
|
|
153
|
+
"""The stored price as strict JSON can carry it. NaN and Infinity are not JSON numbers,
|
|
154
|
+
so each becomes the string "NaN", "Infinity" or "-Infinity", including one nested in a
|
|
155
|
+
list or object. A finite number (0, -1) stays a number."""
|
|
156
|
+
if isinstance(value, float):
|
|
157
|
+
shown = _price_text(value)
|
|
158
|
+
if shown in ('NaN', 'Infinity', '-Infinity'):
|
|
159
|
+
return shown
|
|
160
|
+
return value
|
|
161
|
+
if isinstance(value, list):
|
|
162
|
+
return [_json_price(item) for item in value]
|
|
163
|
+
if isinstance(value, dict):
|
|
164
|
+
return {key: _json_price(item) for key, item in value.items()}
|
|
165
|
+
return value
|
|
166
|
+
|
|
167
|
+
|
|
168
|
+
def _bad_prices(providers: dict, items: list) -> None:
|
|
169
|
+
"""A stored price _positive() would drop never counts toward a USD cap. A missing price
|
|
170
|
+
is unpriced on purpose and is not reported."""
|
|
171
|
+
for name in sorted(providers):
|
|
172
|
+
provider = providers[name]
|
|
173
|
+
if not isinstance(provider, dict) or 'price_usd_per_mtok' not in provider:
|
|
174
|
+
continue
|
|
175
|
+
value = provider['price_usd_per_mtok']
|
|
176
|
+
if value is None or _positive(value) is not None:
|
|
177
|
+
continue
|
|
178
|
+
shown = _price_text(value)
|
|
179
|
+
items.append(dict(kind='bad-price', provider=name, value=_json_price(value),
|
|
180
|
+
message=f'provider {name}: price_usd_per_mtok {shown} is ignored; '
|
|
181
|
+
f'set a finite number above zero with `forge decide provider add --price`'))
|
|
182
|
+
|
|
183
|
+
|
|
136
184
|
def _key_files(providers: dict, items: list) -> None:
|
|
137
185
|
for name, provider in sorted(providers.items()):
|
|
138
186
|
key_file = provider.get('key_file') if isinstance(provider, dict) else None
|
|
@@ -195,6 +243,7 @@ def _checks(repo, env, items: list) -> None:
|
|
|
195
243
|
if name not in used:
|
|
196
244
|
items.append(dict(kind='unused-provider', provider=name,
|
|
197
245
|
message=f'provider {name!r} is configured but no gate uses it'))
|
|
246
|
+
_bad_prices(providers, items)
|
|
198
247
|
|
|
199
248
|
for entry in resolved['shadowed']:
|
|
200
249
|
items.append(dict(kind='shadowed', **entry,
|
|
@@ -12,21 +12,38 @@ import subprocess
|
|
|
12
12
|
from . import DEFAULTS, identifier, managed_run, read_json, safe_file, write_json
|
|
13
13
|
|
|
14
14
|
|
|
15
|
+
# One line each in `forge fractal --help`. status, tree, activity, costs, messages and config
|
|
16
|
+
# print the same captured run view (references/fractal.md); --task and --node narrow it.
|
|
17
|
+
_HELP = dict(
|
|
18
|
+
status="a run's captured state as JSON; --html PATH writes a page",
|
|
19
|
+
tree='the same view as status, read for task and node ids',
|
|
20
|
+
activity='the same view as status; page history with --offset and --limit',
|
|
21
|
+
logs='the same view with logs; --follow prints each change',
|
|
22
|
+
costs='the same view as status, read for usage and costs',
|
|
23
|
+
messages='the same view as status, read for messages',
|
|
24
|
+
config="the same view as status, read for the run's config",
|
|
25
|
+
report='a portable HTML report with full history and logs (default RUN.html)',
|
|
26
|
+
pause='pause a run, or one --task (and --node) in it',
|
|
27
|
+
resume="resume a run's whole pipeline, or one --task",
|
|
28
|
+
stop='stop a run; work and artifacts are kept',
|
|
29
|
+
)
|
|
30
|
+
|
|
31
|
+
|
|
15
32
|
def parser() -> argparse.ArgumentParser:
|
|
16
33
|
p = argparse.ArgumentParser(prog='forge fractal', description='Opt-in Fractal execution and read-only observability for Forge')
|
|
17
34
|
sub = p.add_subparsers(dest='command', required=True)
|
|
18
|
-
install = sub.add_parser('install')
|
|
35
|
+
install = sub.add_parser('install', help='install the Fractal runtime; --dry-run previews')
|
|
19
36
|
for flag in ('dry-run', 'yes', 'with-prerequisites'):
|
|
20
37
|
install.add_argument('--' + flag, action='store_true')
|
|
21
|
-
doctor = sub.add_parser('doctor')
|
|
38
|
+
doctor = sub.add_parser('doctor', help='whether Fractal is ready to run (exit 3 when not)')
|
|
22
39
|
doctor.add_argument('--spec', action='append', default=[])
|
|
23
40
|
doctor.add_argument('--json', action='store_true')
|
|
24
|
-
listing = sub.add_parser('runs')
|
|
41
|
+
listing = sub.add_parser('runs', help="a repo's managed Fractal runs and their RUN ids")
|
|
25
42
|
listing.add_argument('--repo')
|
|
26
43
|
listing.add_argument('--json', action='store_true')
|
|
27
44
|
listing.add_argument('--html', type=Path)
|
|
28
45
|
for name in ('status', 'tree', 'activity', 'logs', 'costs', 'messages', 'config', 'report', 'pause', 'resume', 'stop'):
|
|
29
|
-
command = sub.add_parser(name)
|
|
46
|
+
command = sub.add_parser(name, help=_HELP[name])
|
|
30
47
|
command.add_argument('run')
|
|
31
48
|
command.add_argument('--task')
|
|
32
49
|
command.add_argument('--node')
|
|
@@ -36,10 +53,10 @@ def parser() -> argparse.ArgumentParser:
|
|
|
36
53
|
command.add_argument('--limit', type=int, default=100)
|
|
37
54
|
if name == 'logs':
|
|
38
55
|
command.add_argument('--follow', action='store_true')
|
|
39
|
-
opening = sub.add_parser('open')
|
|
56
|
+
opening = sub.add_parser('open', help="the run inspector in a browser: every run, or RUN's live detail")
|
|
40
57
|
opening.add_argument('run', nargs='?')
|
|
41
58
|
opening.add_argument('--port', type=int, default=0)
|
|
42
|
-
selection = sub.add_parser('select')
|
|
59
|
+
selection = sub.add_parser('select', help="used by the runners: resolve and record a run's Fractal selection")
|
|
43
60
|
selection.add_argument('--run-dir', required=True)
|
|
44
61
|
selection.add_argument('--repo', required=True)
|
|
45
62
|
selection.add_argument('--mode', choices=('solo', 'parallel'), required=True)
|