@dadado/agent-kit-cli 6.9.0 → 6.10.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 (28) hide show
  1. package/dashboard/README.md +16 -0
  2. package/dashboard/art/atmospheric-purifier.webp +0 -0
  3. package/dashboard/art/rover-frozen-flats.webp +0 -0
  4. package/dashboard/art/seed-tree-crane.webp +0 -0
  5. package/dashboard/art/uplink-tower-road.webp +0 -0
  6. package/dashboard/dashboard-data.mjs +150 -8
  7. package/dashboard/dashboard.html +398 -3
  8. package/dashboard/lib/live-refresh.mjs +1 -0
  9. package/dashboard/lib/outcome-ledger.d.mts +115 -0
  10. package/dashboard/lib/outcome-ledger.mjs +595 -0
  11. package/dashboard/serve.mjs +1 -0
  12. package/dist/{chunk-BCX5NDQC.js → chunk-GQ6Q3P7C.js} +1 -1
  13. package/dist/{chunk-67G3236R.js → chunk-K5OCGZWA.js} +2 -2
  14. package/dist/{chunk-3LLXDHIU.js → chunk-LFWPB2JR.js} +1 -0
  15. package/dist/{chunk-GO3K752H.js → chunk-SC2DBY2R.js} +2 -0
  16. package/dist/{chunk-3Z4PGEEJ.js → chunk-TUZVOPKY.js} +1 -1
  17. package/dist/{doctor-PZT7EGLQ.js → doctor-E6LOBJYK.js} +2 -2
  18. package/dist/{guard-ZZRQW3DJ.js → guard-M3W3QE62.js} +14 -2
  19. package/dist/index.js +19 -11
  20. package/dist/{init-MGRZ7U7A.js → init-KKVT2RW4.js} +3 -3
  21. package/dist/{install-432KJISB.js → install-BPZTP5KT.js} +3 -3
  22. package/dist/{mission-control-MHQU73XC.js → mission-control-C2QV5D25.js} +1 -1
  23. package/dist/outcome-ledger-XLWHWPVQ.js +297 -0
  24. package/dist/{run-VOVR5O7S.js → run-326EEQYY.js} +2 -2
  25. package/dist/{run-plan-KWGS2SOZ.js → run-plan-2IFO4G4Y.js} +2 -2
  26. package/dist/{scan-UX4HARMJ.js → scan-BWA64R7I.js} +1 -1
  27. package/dist/{status-UDM55MHU.js → status-LNXVLDMP.js} +1 -1
  28. package/package.json +1 -1
@@ -35,6 +35,22 @@ and published as `docs/contracts/mission-control-snapshot.schema.json`. The Flig
35
35
  operator tickets (gate exits awaiting triage) read-only from `gateExit`
36
36
  (`lib/gate-exit-tickets.mjs`, the no-fetch mirror of `agent-kit ground-control status`).
37
37
 
38
+ ## Colony section
39
+
40
+ **Colony** (`#colony`, in the More menu) is a single-player game panel over the snapshot's
41
+ `outcomeLedger` field (1.9.0, `lib/outcome-ledger.mjs`; ADR
42
+ `2026-10-23_colony-game-canon-outcome-ledger-art-policy.md`). A 61-tile hex map (SVG, no image
43
+ needed) turns from fog and grey ground to green as verified outcomes accrue: the ledger alone
44
+ greens up to 60% of it, finished buildings green the rest. Logic, Compute and Rare are the
45
+ ledger totals minus what the player spent. Building queues a structure for a real-time
46
+ duration; the player's state (spent resources, queue, buildings) lives only in this browser's
47
+ `localStorage` (`agent-kit-colony-state-v1`), and timers are `startedAt` + duration evaluated
48
+ when the panel renders: no timer, no extra polling, no server write. A streak of at least 3
49
+ to-dos closed in a row, the last within 2 hours (`outcomeLedger.flow`), runs builds 25% faster.
50
+ Art: at most 4 images, 400 KB together, in `art/` (re-encoded from the Colony app's curated
51
+ set); a host that cannot serve them gets the panel without images. An older engine without
52
+ `outcomeLedger` shows an update hint.
53
+
38
54
  ## Git e CI/CD section
39
55
 
40
56
  The former Git and DevOps tabs are one section, **Git e CI/CD** (`#git`; `#devops` and
@@ -18,6 +18,19 @@ import {
18
18
  truncateStr,
19
19
  } from "./lib/guards.mjs";
20
20
  import { projectSlugFromRoot } from "./lib/live-refresh.mjs";
21
+ import {
22
+ deriveFlowSignal,
23
+ emptyOutcomeLedgerSummary,
24
+ extractOutcomeEvents,
25
+ foldOutcomeLedger,
26
+ fullReviewHeadSha,
27
+ parsePlanTodos,
28
+ persistOutcomeLedger,
29
+ readOutcomeLedgerFile,
30
+ readTestResults,
31
+ summarizeOutcomeLedger,
32
+ testCollectorStatus,
33
+ } from "./lib/outcome-ledger.mjs";
21
34
  import { PIPELINE_CACHE_ENV, readCachedPipeline } from "./lib/pipeline-cache.mjs";
22
35
  import { selectWorkspaceProcesses } from "./lib/processes.mjs";
23
36
  import { collectRunLogs } from "./lib/run-logs.mjs";
@@ -151,7 +164,7 @@ function redactTerminalOutput(text) {
151
164
 
152
165
  const SNAPSHOT = {
153
166
  _schema: {
154
- version: "1.8.0",
167
+ version: "1.9.0",
155
168
  description: "Mission Control dashboard data model",
156
169
  fields: {
157
170
  generatedAt: "ISO-8601 timestamp of snapshot generation",
@@ -176,6 +189,8 @@ const SNAPSHOT = {
176
189
  "Saved agent chats of this workspace: {withheld, vendors[]} with one envelope per vendor {vendor: claude|codex|cursor, status: ok|unsupported|none, projectDir, sessions[] ({id, title, titleSource: custom|ai|first-prompt|none, modified unix ms, sizeBytes}, newest first, capped at 200), total}; same contract as agent-kit sessions --json. withheld is true (vendors empty) in broadcast mode: chat titles never leave the machine (1.7.0)",
177
190
  shipLane:
178
191
  "Release ship lane for the Git e CI/CD section (read-only, copy-only next commands): {lane: factory|consumer|null, repo, publicRepo, local {latestTag, version, mainRef, stagingAheadOfMain, mainInStaging, tagOnMain}, remote ({available, reason?, fetchedAt?, repo, tag, prs[] (number, capped title, base, head, draft, mergeable, mergeState, stackedOn, checks {state, total, failing[], pending, signatureScan}), prsTotal, originRelease, tagCi {workflow, runId, jobs[]}, public {release, syncPrs[]}, npm {name, version}}; one gh api graphql call + one npm registry read, run alongside gh run list and reused from serve.mjs for up to 120s; reason budget|gh-missing|gh-auth|timeout|call-failed|no-remote|provider-unsupported), rows[] ({id, label, state: green|red|pending|unknown, detail, next {text, destination}|null}) mirroring the /kit-prod Done rows} (1.8.0)",
192
+ outcomeLedger:
193
+ "Verified-outcome ledger (read-only, product-neutral; ADR 2026-10-23 colony-game-canon-outcome-ledger-art-policy): {available, reason (budget|unreadable)|null, version, path (.cursor/context/outcome-ledger.json), entries, totals {logic, compute, rare}, byKind {todo, test, ci, releaseCut, plan, review, releasePublished}, recent[] ({key, kind, resource, at, label}, newest 20), flow {plan, streak, lastClosedAt, brokenAt}|null (from mission-timing.json; a failed, gated or stopped tick breaks it), tests {configured, lastRun {at, ok, head}|null}}. Folded on every snapshot, idempotent by event key, entries never removed; never rewards lines of code, commits, diff size, tokens or time (1.9.0)",
179
194
  processes:
180
195
  "Running process snapshots (node, serve.mjs, git operations) with elapsed time and a generated narration per process",
181
196
  skills: "Available skills discovered in .cursor/skills/",
@@ -184,7 +199,7 @@ const SNAPSHOT = {
184
199
  },
185
200
  },
186
201
  generatedAt: new Date().toISOString(),
187
- dashboardDataVersion: "1.8.0",
202
+ dashboardDataVersion: "1.9.0",
188
203
  plans: [],
189
204
  system: {
190
205
  repoRoot: ROOT,
@@ -198,6 +213,7 @@ const SNAPSHOT = {
198
213
  runLogs: [],
199
214
  gateExit: { marker: "absent", base: "staging", tickets: [], skipped: [], truncated: false },
200
215
  chats: { withheld: false, vendors: [] },
216
+ outcomeLedger: emptyOutcomeLedgerSummary(),
201
217
  processes: [],
202
218
  skills: [],
203
219
  health: { status: "ok", checks: [] },
@@ -636,10 +652,10 @@ function collectPipelineRuns() {
636
652
  const fetchedAt = new Date().toISOString();
637
653
  try {
638
654
  // Trimmed to the fields renderDevopsPipelineCard() / navDevopsDot actually
639
- // read (workflow, status, conclusion, branch, event, createdAt). databaseId
640
- // and url are dropped: the pipeline card is display-only with no
641
- // paste-destination for a run URL (ADR 2026-07-25 copy-only convention),
642
- // so requesting them only adds payload cost without a consumer.
655
+ // read (workflow, status, conclusion, branch, event, createdAt) plus
656
+ // databaseId, the outcome ledger's identity for a passing run (1.9.0). url
657
+ // stays dropped: the pipeline card is display-only with no
658
+ // paste-destination for a run URL (ADR 2026-07-25 copy-only convention).
643
659
  const out = execFileSync(
644
660
  "gh",
645
661
  [
@@ -648,7 +664,7 @@ function collectPipelineRuns() {
648
664
  "--limit",
649
665
  String(MAX_PIPELINE_RUNS),
650
666
  "--json",
651
- "workflowName,status,conclusion,headBranch,event,createdAt",
667
+ "databaseId,workflowName,status,conclusion,headBranch,event,createdAt",
652
668
  ],
653
669
  { cwd: ROOT, encoding: "utf-8", timeout: GH_RUN_LIST_TIMEOUT_MS },
654
670
  );
@@ -657,6 +673,8 @@ function collectPipelineRuns() {
657
673
  return { available: false, runs: [], reason: "call-failed", fetchedAt };
658
674
  }
659
675
  const runs = rows.slice(0, MAX_PIPELINE_RUNS).map((r) => ({
676
+ // Run id: the outcome ledger's key for a passing CI run (never a link).
677
+ id: Number.isSafeInteger(r.databaseId) ? r.databaseId : null,
660
678
  workflow: truncateStr(String(r.workflowName || ""), MAX_PIPELINE_NAME_CHARS),
661
679
  status: String(r.status || ""),
662
680
  conclusion: r.conclusion ? String(r.conclusion) : null,
@@ -1285,10 +1303,17 @@ function collectAgentPrompts() {
1285
1303
  * lives in `isReportTriaged`. A missing or unreadable `.cursor/memory/`
1286
1304
  * directory yields an empty list, never an error state.
1287
1305
  */
1306
+ /** Review outcomes for the outcome ledger (filled by collectExternalReports). */
1307
+ const reviewOutcomes = [];
1308
+ /** False when the report scan was skipped or failed (no plan rewards then). */
1309
+ let reviewOutcomesCollected = false;
1288
1310
  function collectExternalReports() {
1289
1311
  if (!withinSnapshotBudget(600)) return [];
1290
1312
  const memoryDir = join(ROOT, ".cursor", "memory");
1291
- if (!existsSync(memoryDir)) return [];
1313
+ if (!existsSync(memoryDir)) {
1314
+ reviewOutcomesCollected = true; // no reports at all: nothing open
1315
+ return [];
1316
+ }
1292
1317
 
1293
1318
  const reports = [];
1294
1319
  try {
@@ -1324,10 +1349,18 @@ function collectExternalReports() {
1324
1349
  });
1325
1350
  if (!report) continue;
1326
1351
  reports.push(report);
1352
+ reviewOutcomes.push({
1353
+ file: report.file,
1354
+ reviewedPlanFile: report.reviewedPlanFile,
1355
+ hasOpenReviewGaps: report.hasOpenReviewGaps,
1356
+ fullReviewHead: fullReviewHeadSha(content),
1357
+ modifiedAt: report.modifiedAt,
1358
+ });
1327
1359
  }
1328
1360
  } catch {
1329
1361
  return [];
1330
1362
  }
1363
+ reviewOutcomesCollected = true;
1331
1364
  return reports;
1332
1365
  }
1333
1366
 
@@ -1565,6 +1598,7 @@ function readPreviousInventory() {
1565
1598
  }
1566
1599
  }
1567
1600
 
1601
+ let finalTimingLedger = null;
1568
1602
  {
1569
1603
  const missionControl = buildMissionControlView({
1570
1604
  plans: SNAPSHOT.plans,
@@ -1590,6 +1624,7 @@ function readPreviousInventory() {
1590
1624
  gateExitTickets: SNAPSHOT.gateExit?.tickets || [],
1591
1625
  });
1592
1626
  persistMissionTimingLedger(missionControl.timingLedger);
1627
+ finalTimingLedger = missionControl.timingLedger;
1593
1628
  persistFlightLogLedger(missionControl.flightLogLedger);
1594
1629
  // Do not expose the writable ledger blobs on the public snapshot wire.
1595
1630
  const {
@@ -1654,4 +1689,111 @@ SNAPSHOT.devops = {
1654
1689
  };
1655
1690
  }
1656
1691
 
1692
+ // 7. Outcome ledger (ADR 2026-10-23 colony-game-canon-outcome-ledger-art-policy).
1693
+ // Last, after shipLane: it folds what the collectors above already read (plans,
1694
+ // mission timing, run logs, review reports, CI rows, the Release Latest) plus
1695
+ // local v* tags, archived plans, test-results.json and the optional factory
1696
+ // history ledger. No network call of its own; write-on-change only.
1697
+ const MAX_ARCHIVED_PLAN_READS = 200;
1698
+ const MAX_LEDGER_TAGS = 500;
1699
+ function collectLedgerTags() {
1700
+ try {
1701
+ // Newest first, so the cap drops the oldest tags, never a new release.
1702
+ const out = execFileSync(
1703
+ "git",
1704
+ [
1705
+ "for-each-ref",
1706
+ "--sort=-creatordate",
1707
+ "--format=%(refname:short)|%(creatordate:iso-strict)",
1708
+ `--count=${MAX_LEDGER_TAGS}`,
1709
+ "refs/tags/v*",
1710
+ ],
1711
+ { cwd: ROOT, encoding: "utf-8", timeout: 5000, stdio: ["ignore", "pipe", "ignore"] },
1712
+ );
1713
+ return out
1714
+ .split("\n")
1715
+ .filter(Boolean)
1716
+ .map((line) => {
1717
+ const [name, date] = line.split("|");
1718
+ return { name: (name || "").trim(), date: (date || "").trim() || null };
1719
+ });
1720
+ } catch {
1721
+ return [];
1722
+ }
1723
+ }
1724
+ function collectArchivedPlanTodos() {
1725
+ const rows = [];
1726
+ for (const file of archivedPlanFiles.slice(0, MAX_ARCHIVED_PLAN_READS)) {
1727
+ try {
1728
+ const path = join(plansArchiveDir, file);
1729
+ if (statSync(path).size > 512 * 1024) continue;
1730
+ rows.push({ file, todos: parsePlanTodos(readFileSync(path, "utf-8")) });
1731
+ } catch {
1732
+ // unreadable archived plan: skipped
1733
+ }
1734
+ }
1735
+ return rows;
1736
+ }
1737
+ /** Factory-only evidence (optional): parsed only when its size+mtime changed. */
1738
+ function readHistoryLedger(prevStamp) {
1739
+ const path = join(ROOT, "docs", "evidence", "history-ledger.json");
1740
+ try {
1741
+ if (!existsSync(path)) return { stamp: null, data: null };
1742
+ const st = statSync(path);
1743
+ const stamp = `${st.size}-${Math.trunc(st.mtimeMs)}`;
1744
+ if (stamp === prevStamp || st.size > 32 * 1024 * 1024) return { stamp, data: null };
1745
+ return { stamp, data: JSON.parse(readFileSync(path, "utf-8")) };
1746
+ } catch {
1747
+ return { stamp: null, data: null };
1748
+ }
1749
+ }
1750
+ const ledgerPlans = () => SNAPSHOT.plans.map((p) => ({ file: p.file, todos: p.todos.items }));
1751
+ if (!withinSnapshotBudget(400)) {
1752
+ // No fold this time: show what is already earned rather than zeros.
1753
+ try {
1754
+ const persisted = readOutcomeLedgerFile(ROOT);
1755
+ SNAPSHOT.outcomeLedger = {
1756
+ ...summarizeOutcomeLedger(persisted.ledger, {
1757
+ tests: testCollectorStatus(ROOT, readTestResults(ROOT)),
1758
+ }),
1759
+ available: false,
1760
+ reason: "budget",
1761
+ };
1762
+ } catch {
1763
+ SNAPSHOT.outcomeLedger = emptyOutcomeLedgerSummary("budget");
1764
+ }
1765
+ } else {
1766
+ try {
1767
+ const testResults = readTestResults(ROOT);
1768
+ const { ledger: prevLedger, foldable } = readOutcomeLedgerFile(ROOT);
1769
+ if (!foldable) throw new Error("outcome ledger unreadable or another version: left as is");
1770
+ const history = readHistoryLedger(prevLedger.sources.historyLedger ?? null);
1771
+ const allPlans = [...ledgerPlans(), ...collectArchivedPlanTodos()];
1772
+ const events = extractOutcomeEvents({
1773
+ plans: allPlans,
1774
+ timing: finalTimingLedger,
1775
+ reviews: reviewOutcomes,
1776
+ reviewsCollected: reviewOutcomesCollected,
1777
+ tags: collectLedgerTags(),
1778
+ ciRuns: SNAPSHOT.devops?.pipeline?.runs || [],
1779
+ originRelease: SNAPSHOT.shipLane?.remote?.originRelease ?? null,
1780
+ testResults,
1781
+ historyLedger: history.data,
1782
+ historyRepo: SNAPSHOT.shipLane?.repo ?? null,
1783
+ });
1784
+ const { ledger } = foldOutcomeLedger(
1785
+ prevLedger,
1786
+ events,
1787
+ history.data ? { historyLedger: history.stamp } : {},
1788
+ );
1789
+ persistOutcomeLedger(ROOT, ledger);
1790
+ SNAPSHOT.outcomeLedger = summarizeOutcomeLedger(ledger, {
1791
+ flow: deriveFlowSignal(finalTimingLedger, SNAPSHOT.runLogs, allPlans),
1792
+ tests: testCollectorStatus(ROOT, testResults),
1793
+ });
1794
+ } catch {
1795
+ SNAPSHOT.outcomeLedger = emptyOutcomeLedgerSummary("unreadable");
1796
+ }
1797
+ }
1798
+
1657
1799
  process.stdout.write(JSON.stringify(SNAPSHOT, null, 2));