duo-agents 1.19.6 → 1.19.8
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/CORE_VERSION +1 -1
- package/README.md +5 -0
- package/engine/__pycache__/build_workflow.cpython-313.pyc +0 -0
- package/engine/__pycache__/goal_loop.cpython-313.pyc +0 -0
- package/engine/__pycache__/handoff.cpython-313.pyc +0 -0
- package/engine/__pycache__/relay.cpython-313.pyc +0 -0
- package/engine/__pycache__/roleflow.cpython-313.pyc +0 -0
- package/engine/__pycache__/session.cpython-313.pyc +0 -0
- package/engine/__pycache__/task_output.cpython-313.pyc +0 -0
- package/engine/build_workflow.py +9 -5
- package/engine/goal_loop.py +1 -1
- package/engine/handoff.py +1 -1
- package/engine/relay.py +7 -2
- package/engine/roleflow.py +8 -2
- package/engine/session.py +41 -6
- package/engine/task_output.py +14 -0
- package/package.json +1 -1
- package/web/index.html +19 -1
- package/web/task-map.js +41 -2
package/CORE_VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
1.19.
|
|
1
|
+
1.19.8
|
package/README.md
CHANGED
|
@@ -70,6 +70,11 @@ Models are matched to roles by tier (large, medium, small) from what your CLIs r
|
|
|
70
70
|
tier, Duo uses the nearest tier, then the CLI's own default. Failures are tracked, so a model that is out of
|
|
71
71
|
quota or signed out is skipped and the work moves to another one. Saved work is kept.
|
|
72
72
|
|
|
73
|
+
Open **What this run contributed** in the task map to see the latest reported result for each named outcome.
|
|
74
|
+
Expand **Build review history** to compare cycles and open their evidence. Quick runs show the builder's report.
|
|
75
|
+
When a build package needs an external input, Duo can finish independent packages within the existing run budget.
|
|
76
|
+
The task map shows which items must wait.
|
|
77
|
+
|
|
73
78
|
Each handoff is a short brief generated from the run's state: the ask, constraints, open defects, changed
|
|
74
79
|
files and who does what next. Older turns collapse to counts, so context stays small without losing work.
|
|
75
80
|
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/engine/build_workflow.py
CHANGED
|
@@ -37,7 +37,7 @@ def prompt(report, task_text):
|
|
|
37
37
|
"Include stable observed input identities or hashes in each detail. A new log timestamp is not a changed prerequisite. "
|
|
38
38
|
"Distinguish downloaded files from evidence needed for a claim. Record observed throughput and a workload estimate when relevant. "
|
|
39
39
|
"If irrelevant, explain not_applicable. Do not infer undocumented model cutoffs. "
|
|
40
|
-
"
|
|
40
|
+
"Map independent goals to separate packages. Group only work that must be delivered together. Put true prerequisites in depends. Use exact product file paths, dependencies, "
|
|
41
41
|
"a concrete delivered behavior, and an acceptance command or inspection. For empirical research, include an executable "
|
|
42
42
|
"experiment runner when requested, separate from dated evidence acquisition and scored experiments. "
|
|
43
43
|
"Keep required registration before scored experiments. Paper polish must not substitute for an experimental deliverable. "
|
|
@@ -197,7 +197,7 @@ def complete(workflow):
|
|
|
197
197
|
|
|
198
198
|
def package_prompt(package):
|
|
199
199
|
return ("\nBUILD PACKAGE: " + json.dumps(package) + "\n"
|
|
200
|
-
"
|
|
200
|
+
"This package is the current goal within the accepted global goal. Deliver its assigned capability. "
|
|
201
201
|
"Feasibility is finished for this package. Do not spend build on repeated planning, status reports, "
|
|
202
202
|
"or unrelated paper edits. Preserve registration and evidence requirements. "
|
|
203
203
|
"Return build_evidence with behavior (what now works). Include supporting evidence when relevant. "
|
|
@@ -275,7 +275,11 @@ def blocked_text(workflow):
|
|
|
275
275
|
lines.append("%s: %s. Affected: %s." % (check["id"], check["detail"], ", ".join(affected)))
|
|
276
276
|
for package in workflow["packages"]:
|
|
277
277
|
if package.get("status") == "blocked":
|
|
278
|
-
d = package
|
|
279
|
-
|
|
280
|
-
|
|
278
|
+
d = package.get("blocker_detail") or {}
|
|
279
|
+
missing = d.get("missing") or "See the build report"
|
|
280
|
+
retry = d.get("retry_when") or "the blocker changes"
|
|
281
|
+
lines.append(f"{package['id']}: {missing}. Retry when: {retry}.")
|
|
282
|
+
for label, field in (("Alternatives", "alternatives"), ("Evidence", "attempts")):
|
|
283
|
+
if isinstance(d.get(field), list) and d[field]:
|
|
284
|
+
lines.append(label + ": " + "; ".join(map(str, d[field])))
|
|
281
285
|
return "\n".join(lines) or "No build package is ready. Check its dependencies."
|
package/engine/goal_loop.py
CHANGED
|
@@ -94,7 +94,7 @@ def prompt(inputs, report, research=False):
|
|
|
94
94
|
return (
|
|
95
95
|
'You are the independent Goal checker. Read the saved goal input at ' + str(inputs) + '. '
|
|
96
96
|
'Read referenced deliverables, reviews, experiment results, and previous cycle summaries. '
|
|
97
|
-
'
|
|
97
|
+
'Check the global goal against every required numbered outcome and explicit user update. A completed current goal alone cannot close the global goal. '
|
|
98
98
|
'A passed build review or completed summary alone does not establish goal achievement. '
|
|
99
99
|
'Ask: why did this fail, which assumption failed, why not another technique, and what evidence would decide? '
|
|
100
100
|
'Answer from saved evidence; mark uncertainty. Compare materially different alternatives before selecting further work. '
|
package/engine/handoff.py
CHANGED
|
@@ -136,7 +136,7 @@ def brief(state, kind=None, rel='.duo', patch=None):
|
|
|
136
136
|
state.get('round', 0), state.get('max_rounds'), state.get('cycle', 1)))
|
|
137
137
|
if asks:
|
|
138
138
|
first, later = asks[0], asks[1:]
|
|
139
|
-
out.append('
|
|
139
|
+
out.append('Global goal (original ask): ' + _block(first.get('prose')))
|
|
140
140
|
for e in later:
|
|
141
141
|
out.append('Follow-up %s: %s' % (e.get('cycle', ''), _block(e.get('prose'))))
|
|
142
142
|
notes = [e for e in state.get('entries', []) if e.get('author') == 'human' and e.get('kind') == 'message']
|
package/engine/relay.py
CHANGED
|
@@ -30,5 +30,10 @@ def requirements(root):
|
|
|
30
30
|
|
|
31
31
|
REVIEW = ('Check the finished stage against every requirement and the saved check evidence; reuse passing evidence only while its inputs are unchanged. '
|
|
32
32
|
'Include concrete security risks. Start with APPROVED or REVISE on its own line. For REVISE, list EVERY required fix now, in this one review, '
|
|
33
|
-
'one per line as `file: problem -> fix`; do not hold any back for a later round.
|
|
34
|
-
'
|
|
33
|
+
'one per line as `file: problem -> fix`; do not hold any back for a later round. Tie each fix to an unmet user requirement or a regression. Optional ideas never require another round. '
|
|
34
|
+
'Account for every required goal at first review; then report changes only. Use Outcome <stable item ID and name>: '
|
|
35
|
+
'Achieved / Needs revision / Needs user input / Waiting on <ID> / Unverified, followed by evidence or the exact missing input. '
|
|
36
|
+
'Approve the integrated build only when all required goals pass, including integration checks in the plan. '
|
|
37
|
+
'Include regressions, useful discoveries, or no demonstrated gain. If work remains, add Next: <action and expected result, '
|
|
38
|
+
'or owner and condition for retry>. Continue an independent goal whenever possible. Only if all remaining items need external action or depend on such items, use a separate '
|
|
39
|
+
'Blocked: line naming the owner and retry condition. Use existing evidence. Never approve because a round limit was reached.')
|
package/engine/roleflow.py
CHANGED
|
@@ -131,7 +131,13 @@ def plan_signature(path):
|
|
|
131
131
|
|
|
132
132
|
def plan_prompt(shared, feedback=''):
|
|
133
133
|
return ('Write a complete implementation plan. Inspect the relevant source and available skills. '
|
|
134
|
-
'State
|
|
134
|
+
'State the global goal from the user request and explicit updates. For multi-part work, number required goals (1, 2) '
|
|
135
|
+
'and necessary subgoals (2.1). For each, state its outcome, success check, and "depends on <IDs>" or '
|
|
136
|
+
'"independent goal". Numbering is not a dependency. Write "Current goal: <ID and outcome>" on its own line for the first actionable item. '
|
|
137
|
+
'For an open UI decision, compare two interactions. Reuse the nearest design reference or find one relevant example. '
|
|
138
|
+
'Generate one mockup only if it settles that decision and the tool is available. Give the builder its path and a short description. '
|
|
139
|
+
'For open-ended research, use the closest prior work to identify one credible alternative and the cheapest test that could '
|
|
140
|
+
'distinguish it. Reuse existing evidence first. Preserve fixed protocols. '
|
|
135
141
|
'Do not implement product changes during planning. Resolve required review findings.\n' +
|
|
136
142
|
instructions('lead') + '\n' + shared + '\n# Previous review\n' + feedback)
|
|
137
143
|
|
|
@@ -140,5 +146,5 @@ def review_prompt(shared, plan_path):
|
|
|
140
146
|
return ('Review this plan in a fresh session; you did not write it. Inspect source when needed; do not edit the plan or product. '
|
|
141
147
|
'Start with APPROVED or REVISE on its own line. For REVISE, list EVERY required correction now, in this one review, '
|
|
142
148
|
'one per line as `plan step: problem -> fix`, quoting the plan text you object to; hold nothing back for later rounds. '
|
|
143
|
-
'Keep optional
|
|
149
|
+
'Tie required corrections to the user goal and current constraints. Keep optional ideas outside the acceptance checks.\n' +
|
|
144
150
|
instructions('challenger') + '\n' + shared + '\n# Plan\nRead the plan at `' + plan_path + '`.')
|
package/engine/session.py
CHANGED
|
@@ -524,6 +524,7 @@ class Session:
|
|
|
524
524
|
history_recorded=False, verify_failures=0, paused=False, pending=[])
|
|
525
525
|
s.pop("build_task_id", None)
|
|
526
526
|
s.pop("review_exchanges", None)
|
|
527
|
+
s.pop("planned_current_goal", None)
|
|
527
528
|
s.pop("failed_turn", None)
|
|
528
529
|
s.pop("task_delivery", None)
|
|
529
530
|
for key in ('relay_input', 'relay_step', 'assessments', 'stage_requests'):
|
|
@@ -927,6 +928,9 @@ class Session:
|
|
|
927
928
|
parts.append(INSTRUCTIONS[turn.kind].format(d=self.rel, chosen=chosen, title=ctitle,
|
|
928
929
|
gate_log=(s.get("gate_log") or "")))
|
|
929
930
|
if turn.kind in ("build", "revise") and s.get("size") != "trivial":
|
|
931
|
+
if not package:
|
|
932
|
+
parts.append("Advance the current goal, then the next ready goal. Follow the latest review within the accepted plan. If an item is blocked, finish independent goals. Report which items wait on it, "
|
|
933
|
+
"who can unblock them, and what must change before retrying.")
|
|
930
934
|
parts.append("Python deps: use a project virtualenv, run bootstrap steps as separate commands, keep caches in the workspace. "
|
|
931
935
|
"Fetch public models and datasets with native permissions and retry the current route; if access still fails, "
|
|
932
936
|
"report blocker network_access with the host and exact error. Routine checks: 120 s timeout, logs saved. "
|
|
@@ -1420,6 +1424,7 @@ class Session:
|
|
|
1420
1424
|
broker.import_user_questions(self.dir,p.get("broker_task_id",p["task_id"]),reply.prose,str(self.dir/p["file"]))
|
|
1421
1425
|
if reply.outcome == "needs_human":
|
|
1422
1426
|
broker.ask(self.dir,p.get("broker_task_id",p["task_id"]),reply.prose.strip() or "What information should I use to continue this task?")
|
|
1427
|
+
notes = task_output.review_notes(reply.summary) if p["kind"] == "critique" else {}
|
|
1423
1428
|
clean = broker.route_result(self.dir, p, text, reply.to_dict())
|
|
1424
1429
|
if clean != text:
|
|
1425
1430
|
reply.prose = reply.summary = clean
|
|
@@ -1430,9 +1435,19 @@ class Session:
|
|
|
1430
1435
|
verdict=reply.verdict, outcome=reply.outcome)
|
|
1431
1436
|
if reply.outcome in ("blocked", "needs_human"):
|
|
1432
1437
|
broker.event(self.dir, "task_status", p.get("broker_task_id", p["task_id"]), status="partial")
|
|
1433
|
-
|
|
1434
|
-
|
|
1435
|
-
|
|
1438
|
+
package_blocker = (p.get("build_package") and s.get("build_workflow") and
|
|
1439
|
+
(reply.blocker in buildflow.BLOCKERS or
|
|
1440
|
+
(reply.outcome == "needs_human" and not reply.blocker)))
|
|
1441
|
+
if not package_blocker:
|
|
1442
|
+
if p["kind"] in ("build", "revise", "critique"):
|
|
1443
|
+
self.add_entry(p["agent"], p["phase"], p["kind"], reply.prose, summary=reply.summary,
|
|
1444
|
+
n=p["n"], file=p["file"], task_id=p["task_id"], verdict=reply.verdict,
|
|
1445
|
+
outcome=reply.outcome, blocker=reply.blocker, **notes)
|
|
1446
|
+
s['failed_turn'] = dict(p)
|
|
1447
|
+
self._pause('Task blocked', reply.summary,
|
|
1448
|
+
notes.get("review_next") or 'Resolve the specific missing input or task blocker, then resume.',
|
|
1449
|
+
blocker=reply.blocker or "needs_human")
|
|
1450
|
+
return
|
|
1436
1451
|
if goal_loop.full_cycle(s) and p['kind'] == 'exchange':
|
|
1437
1452
|
name = '02-build-assignment.md'
|
|
1438
1453
|
archive = reply.prose
|
|
@@ -1572,7 +1587,8 @@ class Session:
|
|
|
1572
1587
|
task_id=p.get("task_id"), outputs=reply.outputs, complete=reply.complete,
|
|
1573
1588
|
security=[f.to_dict() for f in sec], review=reply.security if p["kind"] == "secure" else [],
|
|
1574
1589
|
build_evidence=reply.build_evidence, blocker_detail=reply.blocker_detail,
|
|
1575
|
-
build_package=(p.get("build_package") or {}).get("id")
|
|
1590
|
+
build_package=(p.get("build_package") or {}).get("id"),
|
|
1591
|
+
**notes)
|
|
1576
1592
|
if p['kind'] in ('assess', 'exchange') and outcome in ('blocked', 'needs_human'):
|
|
1577
1593
|
s['failed_turn'] = dict(p, failure_problems=[reply.summary])
|
|
1578
1594
|
self._pause('Task assessment blocked', reply.summary, 'Resolve the named input or decision, then resume.')
|
|
@@ -1687,7 +1703,14 @@ class Session:
|
|
|
1687
1703
|
if e['kind'] == 'plan_review':
|
|
1688
1704
|
s['plan_verdict'] = reply.verdict
|
|
1689
1705
|
s['plan_feedback'] = reply.prose
|
|
1690
|
-
|
|
1706
|
+
plan = self.dir / 'plan.md'
|
|
1707
|
+
s['accepted_plan_signature'] = roleflow.plan_signature(plan) if reply.verdict == 'APPROVED' else None
|
|
1708
|
+
s.pop('planned_current_goal', None)
|
|
1709
|
+
if s['accepted_plan_signature']:
|
|
1710
|
+
for line in plan.read_text(errors="replace").splitlines():
|
|
1711
|
+
if line.strip().lower().startswith('current goal:'):
|
|
1712
|
+
s['planned_current_goal'] = line.split(':', 1)[1].strip()
|
|
1713
|
+
break
|
|
1691
1714
|
self.save()
|
|
1692
1715
|
return
|
|
1693
1716
|
if e['kind'] == 'exchange':
|
|
@@ -2504,6 +2527,18 @@ def load(duo_dir):
|
|
|
2504
2527
|
return Session(json.loads(p.read_text())) if p.exists() else None
|
|
2505
2528
|
|
|
2506
2529
|
|
|
2530
|
+
def _latest_contribution(state):
|
|
2531
|
+
for entry in reversed(state.get("entries", [])):
|
|
2532
|
+
if entry.get("invalid") or entry.get("kind") not in ("build", "revise", "critique"):
|
|
2533
|
+
continue
|
|
2534
|
+
notes = entry.get("review_outcomes") or {}
|
|
2535
|
+
label = "Reviewer" if entry["kind"] == "critique" else "Builder"
|
|
2536
|
+
text = " · ".join(f"{item}: {result}" for item, result in notes.items()) or entry.get("summary")
|
|
2537
|
+
if text:
|
|
2538
|
+
return orch.redact(state, label + ": " + " ".join(text[:240].split()))
|
|
2539
|
+
return ""
|
|
2540
|
+
|
|
2541
|
+
|
|
2507
2542
|
def list_sessions(all_projects=True):
|
|
2508
2543
|
out = []
|
|
2509
2544
|
for _, i in session_index.entries(all_projects=all_projects):
|
|
@@ -2513,7 +2548,7 @@ def list_sessions(all_projects=True):
|
|
|
2513
2548
|
st = json.loads(sp.read_text())
|
|
2514
2549
|
out.append({"id": st["id"], "title": st["title"], "created": st["created"], "status": st["status"],
|
|
2515
2550
|
"task_type": st.get("task_type"), "project": st.get("project"),
|
|
2516
|
-
"entries": len(st["entries"])})
|
|
2551
|
+
"contribution": _latest_contribution(st), "entries": len(st["entries"])})
|
|
2517
2552
|
except Exception:
|
|
2518
2553
|
pass
|
|
2519
2554
|
out.sort(key=lambda item: str(item['created']), reverse=True)
|
package/engine/task_output.py
CHANGED
|
@@ -181,6 +181,20 @@ def collect(packet, root, folder, number):
|
|
|
181
181
|
shutil.copy2(path, target)
|
|
182
182
|
|
|
183
183
|
|
|
184
|
+
def review_notes(text):
|
|
185
|
+
"""Optional display notes. Missing notes never invalidate a review or trigger a turn."""
|
|
186
|
+
outcomes = {}
|
|
187
|
+
next_action = ""
|
|
188
|
+
for line in text.splitlines():
|
|
189
|
+
line = line.strip().lstrip("- ").strip()
|
|
190
|
+
match = re.fullmatch(r"Outcome ([^:\n]{1,100}):\s*(.+)", line, re.I)
|
|
191
|
+
if match:
|
|
192
|
+
outcomes[match[1].strip()] = match[2].strip()
|
|
193
|
+
elif line.lower().startswith("next:"):
|
|
194
|
+
next_action = line[5:].strip()
|
|
195
|
+
return {"review_outcomes": outcomes, "review_next": next_action} if outcomes or next_action else {}
|
|
196
|
+
|
|
197
|
+
|
|
184
198
|
def metadata(text):
|
|
185
199
|
"""Read optional old metadata without requiring it or trusting its identity."""
|
|
186
200
|
for block in reversed(list(protocol.BLOCK.finditer(text.replace(protocol.END_MARK, "")))):
|
package/package.json
CHANGED
package/web/index.html
CHANGED
|
@@ -940,7 +940,25 @@ function renderTimeline(s) {
|
|
|
940
940
|
}
|
|
941
941
|
|
|
942
942
|
function renderRunMap(s) {
|
|
943
|
+
const currentEntries = (s?.entries || []).filter(e => (e.cycle || 1) === (s?.cycle || 1));
|
|
944
|
+
const lastReview = currentEntries.findLast(e => e.kind === 'critique' && !e.invalid);
|
|
945
|
+
const currentGoal = s?.pending?.find(p => p.build_package)?.build_package?.title ||
|
|
946
|
+
(s?.goal?.status === 'active' && s.goal.next_action) ||
|
|
947
|
+
(lastReview ? lastReview.review_next : s?.planned_current_goal);
|
|
943
948
|
renderTaskMap($("#taskmap-root"), s?.broker || {nodes:[]}, {
|
|
949
|
+
globalGoal:s?.task,
|
|
950
|
+
goalUpdates:(s?.entries || []).filter(e => e.kind === 'followup' && e.author === 'human').map(e => e.prose),
|
|
951
|
+
currentGoal:s?.status === 'running' ? currentGoal : '',
|
|
952
|
+
contributions: (s?.entries || []).filter(e => !e.invalid && ['build','revise','critique'].includes(e.kind)).map(e => ({
|
|
953
|
+
n:e.n, kind:e.kind, verdict:e.verdict, outcomes:e.review_outcomes, next:e.review_next,
|
|
954
|
+
summary:(e.summary || '').slice(0,350)
|
|
955
|
+
})),
|
|
956
|
+
openTurn:n => select("e:" + n),
|
|
957
|
+
packages:(s?.build_workflow?.packages || []).map(p => ({
|
|
958
|
+
id:p.id,title:p.title,status:p.status,depends:p.depends,requires:p.requires,
|
|
959
|
+
retry:p.blocker_detail?.retry_when
|
|
960
|
+
})),
|
|
961
|
+
checks:(s?.build_workflow?.checks || []).map(c => ({id:c.id,status:c.status})),
|
|
944
962
|
runId:s?.id, helper:[...(s?.helper || []),...(s?.conversation || [])], runStatus:s?.status,
|
|
945
963
|
createCompletionSummary:() => api('/api/completion-summary', {id:s.id}),
|
|
946
964
|
openCompletionSummary:() => {setRunPane('summary');renderSummaryDocument(s);},
|
|
@@ -1278,7 +1296,7 @@ async function loadSessions() {
|
|
|
1278
1296
|
const groups = new Map();
|
|
1279
1297
|
for (const x of shown) { const k = x.project ?? "Other"; if (!groups.has(k)) groups.set(k, []); groups.get(k).push(x); }
|
|
1280
1298
|
const row = x => `<div class="sessrow"><button class="sess ${x.id === cur ? "on" : ""}" data-id="${esc(x.id)}">
|
|
1281
|
-
<span class="t">${esc(x.title)}</span
|
|
1299
|
+
<span class="t">${esc(x.title)}</span>${x.contribution ? `<span class="m">${esc(x.contribution)}</span>` : ''}<span class="m">${esc(x.created.slice(5, 16).replace("T", " "))} ${x.status === "stopped" || x.status === "error" ? "<b>unfinished</b>" : esc(STATUS_WORD[x.status] ?? x.status)}${x.decisions ? " " + x.decisions + " decision" + (x.decisions > 1 ? "s" : "") : ""}</span></button><button class="sessdel" data-del="${esc(x.id)}" aria-label="Delete this run" title="Delete this run">✕</button></div>`;
|
|
1282
1300
|
$("#sessions").innerHTML = (list.length >= 10 ? `<input class="filter" id="sessFilter" placeholder="Filter runs" value="${esc(sessFilter)}">` : "") +
|
|
1283
1301
|
`<p class="hint" style="margin:8px">${(live?.runs || []).filter(r=>ACTIVE.includes(r.status)).length} active · limit ${live?.max_active_runs || 4}. Separate projects can run together.</p>` +
|
|
1284
1302
|
(shown.length ? [...groups].map(([p, xs]) => `<div class="group"><h3>${esc(p)}</h3>${xs.map(row).join("")}</div>`).join("")
|
package/web/task-map.js
CHANGED
|
@@ -22,10 +22,10 @@ export function renderTaskMap(root, graph, options = {}) {
|
|
|
22
22
|
styles(); root.classList.add('duo-taskmap');
|
|
23
23
|
let state = roots.get(root);
|
|
24
24
|
if (!state || state.run !== options.runId) {
|
|
25
|
-
state = {run: options.runId, selected: null, open: new Set(['map','nodes','completion']), files: new Map(), errors: null, errorsBusy: false};
|
|
25
|
+
state = {run: options.runId, selected: null, open: new Set(['map','nodes','completion','contributions','goals']), files: new Map(), errors: null, errorsBusy: false};
|
|
26
26
|
roots.set(root, state);
|
|
27
27
|
}
|
|
28
|
-
const signature = JSON.stringify([graph, options.helper, options.runStatus]);
|
|
28
|
+
const signature = JSON.stringify([graph, options.helper, options.runStatus, options.globalGoal, options.goalUpdates, options.currentGoal, options.contributions, options.packages, options.checks]);
|
|
29
29
|
if (state.signature === signature && !state.dirty) return;
|
|
30
30
|
state.signature = signature; state.dirty = false;
|
|
31
31
|
if (state.version !== graph?.updated) {
|
|
@@ -85,6 +85,45 @@ export function renderTaskMap(root, graph, options = {}) {
|
|
|
85
85
|
toolbar.append(make('p', 'Select a task to inspect its assignment, saved work, and continuation.', 'taskmap-hint'),
|
|
86
86
|
action('Collapse details', () => { state.open = new Set(['map']); state.selected = null; redraw(); }));
|
|
87
87
|
body.append(toolbar);
|
|
88
|
+
if (options.globalGoal) {
|
|
89
|
+
body.append(block('goals', 'Global goal and current assignment', content => {
|
|
90
|
+
content.append(make('h4', 'Global goal'), make('p', options.globalGoal));
|
|
91
|
+
for (const update of options.goalUpdates || []) content.append(make('p', 'User update · ' + update));
|
|
92
|
+
if (options.currentGoal) content.append(make('h4', 'Current goal'), make('p', options.currentGoal));
|
|
93
|
+
}));
|
|
94
|
+
}
|
|
95
|
+
const turns = options.contributions || [];
|
|
96
|
+
const packages = options.packages || [];
|
|
97
|
+
if (turns.length || packages.length) body.append(block('contributions', 'What this run contributed', content => {
|
|
98
|
+
const reviews = turns.filter(turn => turn.kind === 'critique');
|
|
99
|
+
const latest = new Map();
|
|
100
|
+
for (const review of reviews) {
|
|
101
|
+
for (const [item, result] of Object.entries(review.outcomes || {})) latest.set(item, result);
|
|
102
|
+
}
|
|
103
|
+
for (const [item, result] of latest) content.append(make('p', item + ' · ' + result));
|
|
104
|
+
const last = turns.at(-1);
|
|
105
|
+
if (last && !Object.keys(last.outcomes || {}).length) content.append(make('p', (last.kind === 'critique' ? 'Reviewer' : 'Builder') + ' reported · ' + last.summary));
|
|
106
|
+
if (last && options.openTurn) content.append(action('Open latest report', () => options.openTurn(last.n)));
|
|
107
|
+
if (last?.next) content.append(make('p', 'Next · ' + last.next));
|
|
108
|
+
const done = new Set(packages.filter(p => p.status === 'done').map(p => p.id));
|
|
109
|
+
const blocked = new Set((options.checks || []).filter(c => c.status === 'blocked').map(c => c.id));
|
|
110
|
+
for (const p of packages) {
|
|
111
|
+
const waiting = [...(p.depends || []).filter(id => !done.has(id)), ...(p.requires || []).filter(id => blocked.has(id))];
|
|
112
|
+
const status = p.status === 'done' ? 'Built' : p.status === 'blocked' ? 'Blocked' :
|
|
113
|
+
waiting.length ? 'Waiting on ' + waiting.join(', ') : 'Pending';
|
|
114
|
+
content.append(make('p', p.id + ' · ' + p.title + ' · ' + status + (p.retry ? ' · ' + p.retry : '')));
|
|
115
|
+
}
|
|
116
|
+
if (reviews.length) content.append(block('cycle-history', 'Build review history', history => {
|
|
117
|
+
for (const review of reviews) {
|
|
118
|
+
history.append(make('h4', 'Review ' + review.n + ' · ' + (review.verdict || 'Recorded')));
|
|
119
|
+
const notes = Object.entries(review.outcomes || {});
|
|
120
|
+
if (!notes.length) history.append(make('p', review.summary));
|
|
121
|
+
for (const [item, result] of notes) history.append(make('p', item + ' · ' + result));
|
|
122
|
+
if (options.openTurn) history.append(action('Open review ' + review.n, () => options.openTurn(review.n)));
|
|
123
|
+
if (review.next) history.append(make('p', 'Next · ' + review.next));
|
|
124
|
+
}
|
|
125
|
+
}));
|
|
126
|
+
}));
|
|
88
127
|
const completion = state.graph.completion_summary;
|
|
89
128
|
if (completion || options.runStatus === 'done') body.append(block('completion', 'Detailed completion handoff', content => {
|
|
90
129
|
const status = completion?.status || 'not_started';
|