@dadado/agent-kit-cli 6.9.0 → 6.10.1
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/dashboard/README.md +16 -0
- package/dashboard/art/atmospheric-purifier.webp +0 -0
- package/dashboard/art/rover-frozen-flats.webp +0 -0
- package/dashboard/art/seed-tree-crane.webp +0 -0
- package/dashboard/art/uplink-tower-road.webp +0 -0
- package/dashboard/dashboard-data.mjs +150 -8
- package/dashboard/dashboard.html +398 -3
- package/dashboard/lib/live-refresh.mjs +1 -0
- package/dashboard/lib/outcome-ledger.d.mts +115 -0
- package/dashboard/lib/outcome-ledger.mjs +595 -0
- package/dashboard/lib/semantic-model.d.mts +14 -0
- package/dashboard/lib/semantic-model.mjs +3 -0
- package/dashboard/serve.mjs +1 -0
- package/dist/{chunk-BCX5NDQC.js → chunk-GQ6Q3P7C.js} +1 -1
- package/dist/{chunk-67G3236R.js → chunk-K5OCGZWA.js} +2 -2
- package/dist/{chunk-3LLXDHIU.js → chunk-LFWPB2JR.js} +1 -0
- package/dist/{chunk-GO3K752H.js → chunk-SC2DBY2R.js} +2 -0
- package/dist/{chunk-3Z4PGEEJ.js → chunk-TUZVOPKY.js} +1 -1
- package/dist/{doctor-PZT7EGLQ.js → doctor-E6LOBJYK.js} +2 -2
- package/dist/{guard-ZZRQW3DJ.js → guard-X6FNFZ27.js} +24 -2
- package/dist/index.js +19 -11
- package/dist/{init-MGRZ7U7A.js → init-KKVT2RW4.js} +3 -3
- package/dist/{install-432KJISB.js → install-BPZTP5KT.js} +3 -3
- package/dist/{mission-control-MHQU73XC.js → mission-control-C2QV5D25.js} +1 -1
- package/dist/outcome-ledger-XLWHWPVQ.js +297 -0
- package/dist/{run-VOVR5O7S.js → run-326EEQYY.js} +2 -2
- package/dist/{run-plan-KWGS2SOZ.js → run-plan-2IFO4G4Y.js} +2 -2
- package/dist/{scan-UX4HARMJ.js → scan-BWA64R7I.js} +1 -1
- package/dist/{status-UDM55MHU.js → status-LNXVLDMP.js} +1 -1
- package/package.json +1 -1
package/dashboard/dashboard.html
CHANGED
|
@@ -945,6 +945,42 @@ body.mc-fullscreen .top-tabs-row {
|
|
|
945
945
|
}
|
|
946
946
|
.terminal-item:hover { background: var(--bg-card-hover); }
|
|
947
947
|
|
|
948
|
+
/* ===== Colony (game panel over outcomeLedger) ===== */
|
|
949
|
+
.colony-layout { display: grid; grid-template-columns: minmax(260px, 1fr) minmax(260px, 1fr); gap: var(--mc-space-xl); align-items: start; }
|
|
950
|
+
.colony-map-wrap { border: 1px solid var(--border); border-radius: var(--mc-radius); padding: var(--mc-space-lg); background: var(--bg-card); }
|
|
951
|
+
.colony-map { display: block; width: 100%; max-width: 420px; margin: 0 auto; height: auto; }
|
|
952
|
+
.colony-tile { stroke: var(--bg-primary); stroke-width: 1.5; }
|
|
953
|
+
.colony-tile[data-tile="fog"] { fill: var(--bg-secondary); }
|
|
954
|
+
.colony-tile[data-tile="barren"] { fill: #4b5563; }
|
|
955
|
+
.colony-tile[data-tile="green"] { fill: #3f7d5a; }
|
|
956
|
+
.colony-glyph { font: 600 11px var(--mc-font-mono); fill: #f5e6c8; pointer-events: none; }
|
|
957
|
+
.colony-side { display: flex; flex-direction: column; gap: var(--mc-space-lg); }
|
|
958
|
+
.colony-resources { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--mc-space-md); }
|
|
959
|
+
.colony-resource { border: 1px solid var(--border); border-radius: var(--mc-radius); padding: var(--mc-card-padding-dense); background: var(--bg-card); display: flex; flex-direction: column; gap: 2px; }
|
|
960
|
+
.colony-resource-label { font-size: 11px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.04em; }
|
|
961
|
+
.colony-resource-value { font: 600 20px var(--mc-font-mono); color: var(--text-primary); }
|
|
962
|
+
.colony-resource-meta { font-size: 11px; color: var(--text-muted); }
|
|
963
|
+
.colony-panel { border: 1px solid var(--border); border-radius: var(--mc-radius); padding: var(--mc-card-padding-dense); background: var(--bg-card); }
|
|
964
|
+
.colony-panel-title { font-size: 12px; font-weight: 600; color: var(--text-secondary); margin-bottom: var(--mc-space-sm); }
|
|
965
|
+
.colony-panel-meta { font-weight: 400; color: var(--text-muted); font-family: var(--mc-font-mono); }
|
|
966
|
+
.colony-queue, .colony-log { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
|
|
967
|
+
.colony-queue-item, .colony-log-item { display: flex; gap: var(--mc-space-md); font-size: 12px; color: var(--text-secondary); min-width: 0; }
|
|
968
|
+
.colony-queue-name { flex: 1; color: var(--text-primary); }
|
|
969
|
+
.colony-queue-time, .colony-log-kind { color: var(--text-muted); font-family: var(--mc-font-mono); white-space: nowrap; }
|
|
970
|
+
.colony-log-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
|
971
|
+
.colony-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: var(--mc-space-lg); margin-top: var(--mc-space-xl); }
|
|
972
|
+
.colony-card { border: 1px solid var(--border); border-radius: var(--mc-radius); background: var(--bg-card); overflow: hidden; display: flex; flex-direction: column; }
|
|
973
|
+
.colony-card:hover { border-color: var(--border-active); }
|
|
974
|
+
.colony-card-art { display: block; width: 100%; aspect-ratio: 16 / 9; object-fit: cover; background: var(--bg-secondary); }
|
|
975
|
+
.colony-card-body { padding: var(--mc-card-padding-dense); display: flex; flex-direction: column; gap: 6px; flex: 1; }
|
|
976
|
+
.colony-card-name { font-size: 13px; font-weight: 600; color: var(--text-primary); }
|
|
977
|
+
.colony-card-blurb { font-size: 12px; color: var(--text-secondary); margin: 0; flex: 1; }
|
|
978
|
+
.colony-card-meta { font-size: 11px; color: var(--text-muted); font-family: var(--mc-font-mono); }
|
|
979
|
+
.colony-build-btn { align-self: flex-start; }
|
|
980
|
+
.colony-build-btn:disabled { cursor: not-allowed; opacity: 0.6; }
|
|
981
|
+
.colony-note { font-size: 12px; color: var(--text-muted); margin: var(--mc-space-md) 0 0; }
|
|
982
|
+
@media (max-width: 860px) { .colony-layout { grid-template-columns: 1fr; } }
|
|
983
|
+
|
|
948
984
|
/* ===== Chats (saved agent sessions) ===== */
|
|
949
985
|
.chat-list { display: flex; flex-direction: column; gap: 4px; }
|
|
950
986
|
.chat-item {
|
|
@@ -1336,8 +1372,8 @@ body.mc-fullscreen .top-tabs-row {
|
|
|
1336
1372
|
border-radius: var(--mc-radius);
|
|
1337
1373
|
background: var(--bg-card);
|
|
1338
1374
|
}
|
|
1339
|
-
.ship-row.is-red {
|
|
1340
|
-
.ship-row.is-yellow {
|
|
1375
|
+
.ship-row.is-red { border-color: var(--red); }
|
|
1376
|
+
.ship-row.is-yellow { border-color: var(--yellow); }
|
|
1341
1377
|
.ship-row-label {
|
|
1342
1378
|
font-weight: 600;
|
|
1343
1379
|
color: var(--text-primary);
|
|
@@ -3879,6 +3915,9 @@ html[data-monitor-density="comfortable"] .live-activity-feed .monitor-row .monit
|
|
|
3879
3915
|
Chats
|
|
3880
3916
|
<span class="top-tab-badge" id="navChatsBadge">0</span>
|
|
3881
3917
|
</a>
|
|
3918
|
+
<a class="top-tab nav-more-item" role="menuitem" href="#" data-section="colony" tabindex="0" onclick="return showSection('colony')" aria-label="Colony section">
|
|
3919
|
+
Colony
|
|
3920
|
+
</a>
|
|
3882
3921
|
<a class="top-tab nav-more-item" role="menuitem" href="#" data-section="processes" tabindex="0" onclick="return showSection('processes')" aria-label="Processes section">
|
|
3883
3922
|
Processes
|
|
3884
3923
|
<span class="top-tab-badge" id="navProcessesBadge">0</span>
|
|
@@ -4069,6 +4108,7 @@ const SECTION_IDS = [
|
|
|
4069
4108
|
'memory',
|
|
4070
4109
|
'terminals',
|
|
4071
4110
|
'chats',
|
|
4111
|
+
'colony',
|
|
4072
4112
|
'processes',
|
|
4073
4113
|
'config',
|
|
4074
4114
|
];
|
|
@@ -6791,6 +6831,351 @@ function renderChatsSection(d) {
|
|
|
6791
6831
|
`;
|
|
6792
6832
|
}
|
|
6793
6833
|
|
|
6834
|
+
// ===== Colony (game panel over the snapshot `outcomeLedger`, 1.9.0) =====
|
|
6835
|
+
// ADR 2026-10-23 colony-game-canon-outcome-ledger-art-policy points 1, 4, 6, 8.
|
|
6836
|
+
// Earned totals come only from the ledger; what the player spends, queues and
|
|
6837
|
+
// builds lives in this browser (localStorage), like the skin preference. No
|
|
6838
|
+
// server write, no route, no timer: build timers are startedAt + duration,
|
|
6839
|
+
// evaluated when the panel renders (each snapshot refresh).
|
|
6840
|
+
|
|
6841
|
+
const COLONY_STATE_KEY = 'agent-kit-colony-state-v1';
|
|
6842
|
+
const COLONY_MAP_RADIUS = 4;
|
|
6843
|
+
const COLONY_MAX_ACTIVE_BUILDS = 3;
|
|
6844
|
+
const COLONY_FLOW_STREAK = 3;
|
|
6845
|
+
const COLONY_FLOW_WINDOW_MS = 2 * 60 * 60 * 1000;
|
|
6846
|
+
const COLONY_OVERCLOCK_FACTOR = 0.75;
|
|
6847
|
+
const COLONY_STRUCTURES = Object.freeze([
|
|
6848
|
+
{ id: 'uplink', name: 'IDE-Core Uplink', glyph: 'U', cost: { logic: 0, compute: 3, rare: 0 }, minutes: 60, greens: 2, unique: true, art: '/art/uplink-tower-road.webp', blurb: 'Central command: links the colony to the work you ship. One per map.' },
|
|
6849
|
+
{ id: 'nursery', name: 'Sapling Nursery', glyph: 'N', cost: { logic: 2, compute: 0, rare: 0 }, minutes: 45, greens: 3, unique: false, art: '/art/seed-tree-crane.webp', blurb: 'First green ground around the landing site.' },
|
|
6850
|
+
{ id: 'tundra', name: 'Tundra Reforestation Node', glyph: 'T', cost: { logic: 5, compute: 2, rare: 0 }, minutes: 180, greens: 5, unique: false, art: '/art/rover-frozen-flats.webp', blurb: 'Turns frozen flats green.' },
|
|
6851
|
+
{ id: 'transit', name: 'Levitating Transit Hub', glyph: 'H', cost: { logic: 4, compute: 4, rare: 0 }, minutes: 360, greens: 4, unique: false, art: null, blurb: 'Connects settlements across the map.' },
|
|
6852
|
+
{ id: 'purifier', name: 'Atmospheric Purifier', glyph: 'P', cost: { logic: 10, compute: 6, rare: 1 }, minutes: 720, greens: 8, unique: false, art: '/art/atmospheric-purifier.webp', blurb: 'Vents clean mist and raises the atmosphere meter.' },
|
|
6853
|
+
]);
|
|
6854
|
+
|
|
6855
|
+
/** Axial hex coordinates in spiral order from the landing site (center). */
|
|
6856
|
+
function colonyHexTiles(radius) {
|
|
6857
|
+
const tiles = [{ q: 0, r: 0 }];
|
|
6858
|
+
const dirs = [[1, 0], [1, -1], [0, -1], [-1, 0], [-1, 1], [0, 1]];
|
|
6859
|
+
for (let k = 1; k <= radius; k += 1) {
|
|
6860
|
+
let q = -k;
|
|
6861
|
+
let r = k;
|
|
6862
|
+
for (let side = 0; side < 6; side += 1) {
|
|
6863
|
+
for (let step = 0; step < k; step += 1) {
|
|
6864
|
+
tiles.push({ q, r });
|
|
6865
|
+
q += dirs[side][0];
|
|
6866
|
+
r += dirs[side][1];
|
|
6867
|
+
}
|
|
6868
|
+
}
|
|
6869
|
+
}
|
|
6870
|
+
return tiles;
|
|
6871
|
+
}
|
|
6872
|
+
|
|
6873
|
+
/** Normalized player state from storage (malformed input -> empty colony). */
|
|
6874
|
+
function parseColonyState(raw) {
|
|
6875
|
+
const empty = { v: 1, seq: 0, queue: [], built: [], spent: { logic: 0, compute: 0, rare: 0 } };
|
|
6876
|
+
if (!raw || typeof raw !== 'object' || raw.v !== 1) return empty;
|
|
6877
|
+
const ids = new Set(COLONY_STRUCTURES.map((s) => s.id));
|
|
6878
|
+
const num = (n) => (Number.isFinite(n) && n >= 0 ? Math.floor(n) : 0);
|
|
6879
|
+
const queue = (Array.isArray(raw.queue) ? raw.queue : [])
|
|
6880
|
+
.filter((b) => b && ids.has(b.structure) && Number.isFinite(b.startedAt) && Number.isFinite(b.durationMs) && b.durationMs > 0)
|
|
6881
|
+
.slice(0, COLONY_MAX_ACTIVE_BUILDS)
|
|
6882
|
+
.map((b) => ({ id: num(b.id), structure: b.structure, startedAt: b.startedAt, durationMs: b.durationMs }));
|
|
6883
|
+
const built = (Array.isArray(raw.built) ? raw.built : [])
|
|
6884
|
+
.filter((b) => b && ids.has(b.structure) && Number.isFinite(b.completedAt))
|
|
6885
|
+
.slice(0, 500)
|
|
6886
|
+
.map((b) => ({ structure: b.structure, completedAt: b.completedAt }));
|
|
6887
|
+
const spent = raw.spent && typeof raw.spent === 'object' ? raw.spent : {};
|
|
6888
|
+
return {
|
|
6889
|
+
v: 1,
|
|
6890
|
+
seq: num(raw.seq),
|
|
6891
|
+
queue,
|
|
6892
|
+
built,
|
|
6893
|
+
spent: { logic: num(spent.logic), compute: num(spent.compute), rare: num(spent.rare) },
|
|
6894
|
+
};
|
|
6895
|
+
}
|
|
6896
|
+
|
|
6897
|
+
function loadColonyState() {
|
|
6898
|
+
try {
|
|
6899
|
+
const raw = localStorage.getItem(COLONY_STATE_KEY);
|
|
6900
|
+
return parseColonyState(raw ? JSON.parse(raw) : null);
|
|
6901
|
+
} catch (e) {
|
|
6902
|
+
return parseColonyState(null);
|
|
6903
|
+
}
|
|
6904
|
+
}
|
|
6905
|
+
|
|
6906
|
+
function saveColonyState(state) {
|
|
6907
|
+
try {
|
|
6908
|
+
localStorage.setItem(COLONY_STATE_KEY, JSON.stringify(state));
|
|
6909
|
+
return true;
|
|
6910
|
+
} catch (e) {
|
|
6911
|
+
return false;
|
|
6912
|
+
}
|
|
6913
|
+
}
|
|
6914
|
+
|
|
6915
|
+
/** Earned totals from the snapshot field (zeros when absent). */
|
|
6916
|
+
function colonyEarned(ledger) {
|
|
6917
|
+
const t = ledger && ledger.totals && typeof ledger.totals === 'object' ? ledger.totals : {};
|
|
6918
|
+
const n = (v) => (Number.isFinite(v) && v >= 0 ? Math.floor(v) : 0);
|
|
6919
|
+
return { logic: n(t.logic), compute: n(t.compute), rare: n(t.rare) };
|
|
6920
|
+
}
|
|
6921
|
+
|
|
6922
|
+
/** Spendable = earned - spent, never below zero. */
|
|
6923
|
+
function colonyWallet(earned, state) {
|
|
6924
|
+
return {
|
|
6925
|
+
logic: Math.max(0, earned.logic - state.spent.logic),
|
|
6926
|
+
compute: Math.max(0, earned.compute - state.spent.compute),
|
|
6927
|
+
rare: Math.max(0, earned.rare - state.spent.rare),
|
|
6928
|
+
};
|
|
6929
|
+
}
|
|
6930
|
+
|
|
6931
|
+
/**
|
|
6932
|
+
* Flow overclock (ADR point 6): an unbroken streak of closed to-dos, the last
|
|
6933
|
+
* one recent. Tuning: COLONY_FLOW_STREAK closes, within COLONY_FLOW_WINDOW_MS.
|
|
6934
|
+
*/
|
|
6935
|
+
function colonyOverclockActive(flow, nowMs) {
|
|
6936
|
+
if (!flow || !Number.isFinite(flow.streak) || flow.streak < COLONY_FLOW_STREAK) return false;
|
|
6937
|
+
const last = Date.parse(flow.lastClosedAt || '');
|
|
6938
|
+
return Number.isFinite(last) && nowMs - last >= 0 && nowMs - last <= COLONY_FLOW_WINDOW_MS;
|
|
6939
|
+
}
|
|
6940
|
+
|
|
6941
|
+
function colonyBuildEndsAt(build, overclock) {
|
|
6942
|
+
return build.startedAt + build.durationMs * (overclock ? COLONY_OVERCLOCK_FACTOR : 1);
|
|
6943
|
+
}
|
|
6944
|
+
|
|
6945
|
+
/**
|
|
6946
|
+
* Lazy settle: queued builds whose time has come move to `built`. Returns the
|
|
6947
|
+
* next state and whether it changed (the caller persists only on change, so a
|
|
6948
|
+
* finished build never flips back when the overclock ends).
|
|
6949
|
+
*/
|
|
6950
|
+
function settleColonyState(state, nowMs, overclock) {
|
|
6951
|
+
const done = [];
|
|
6952
|
+
const queue = [];
|
|
6953
|
+
for (const b of state.queue) {
|
|
6954
|
+
const endsAt = colonyBuildEndsAt(b, overclock);
|
|
6955
|
+
if (nowMs >= endsAt) done.push({ structure: b.structure, completedAt: Math.round(endsAt) });
|
|
6956
|
+
else queue.push(b);
|
|
6957
|
+
}
|
|
6958
|
+
if (done.length === 0) return { state, changed: false };
|
|
6959
|
+
return { state: { ...state, queue, built: [...state.built, ...done] }, changed: true };
|
|
6960
|
+
}
|
|
6961
|
+
|
|
6962
|
+
/** Why a structure cannot be queued now, or null when it can. */
|
|
6963
|
+
function colonyBuildBlocker(structure, state, wallet) {
|
|
6964
|
+
if (!structure) return 'Unknown structure';
|
|
6965
|
+
if (structure.unique && (state.built.some((b) => b.structure === structure.id) || state.queue.some((b) => b.structure === structure.id))) {
|
|
6966
|
+
return 'Already on the map';
|
|
6967
|
+
}
|
|
6968
|
+
if (state.queue.length >= COLONY_MAX_ACTIVE_BUILDS) return 'Build queue full';
|
|
6969
|
+
const c = structure.cost;
|
|
6970
|
+
if (wallet.logic < c.logic || wallet.compute < c.compute || wallet.rare < c.rare) return 'Not enough resources';
|
|
6971
|
+
return null;
|
|
6972
|
+
}
|
|
6973
|
+
|
|
6974
|
+
/** Queue a build: spend its cost and start its timer. Returns the next state or null. */
|
|
6975
|
+
function queueColonyBuild(state, structureId, earned, nowMs) {
|
|
6976
|
+
const structure = COLONY_STRUCTURES.find((s) => s.id === structureId);
|
|
6977
|
+
if (colonyBuildBlocker(structure, state, colonyWallet(earned, state))) return null;
|
|
6978
|
+
const seq = state.seq + 1;
|
|
6979
|
+
return {
|
|
6980
|
+
...state,
|
|
6981
|
+
seq,
|
|
6982
|
+
queue: [...state.queue, { id: seq, structure: structure.id, startedAt: nowMs, durationMs: structure.minutes * 60 * 1000 }],
|
|
6983
|
+
spent: {
|
|
6984
|
+
logic: state.spent.logic + structure.cost.logic,
|
|
6985
|
+
compute: state.spent.compute + structure.cost.compute,
|
|
6986
|
+
rare: state.spent.rare + structure.cost.rare,
|
|
6987
|
+
},
|
|
6988
|
+
};
|
|
6989
|
+
}
|
|
6990
|
+
|
|
6991
|
+
/**
|
|
6992
|
+
* Green tiles: earned outcomes clear ground slowly (square root, so a long
|
|
6993
|
+
* history does not paint the map at once) and on their own reach at most
|
|
6994
|
+
* 60% of the map; finished buildings green the rest. Pure function of the
|
|
6995
|
+
* ledger totals and the built list.
|
|
6996
|
+
*/
|
|
6997
|
+
function colonyGreenTiles(earned, state, tileCount) {
|
|
6998
|
+
const points = earned.logic + earned.compute / 4;
|
|
6999
|
+
const fromLedger = Math.floor(Math.sqrt(points) * 2) + earned.rare;
|
|
7000
|
+
let green = Math.min(Math.floor(tileCount * 0.6), fromLedger);
|
|
7001
|
+
for (const b of state.built) {
|
|
7002
|
+
const s = COLONY_STRUCTURES.find((x) => x.id === b.structure);
|
|
7003
|
+
if (s) green += s.greens;
|
|
7004
|
+
}
|
|
7005
|
+
return Math.max(0, Math.min(tileCount, green));
|
|
7006
|
+
}
|
|
7007
|
+
|
|
7008
|
+
function formatColonyDuration(ms) {
|
|
7009
|
+
const minutes = Math.max(1, Math.ceil(ms / 60000));
|
|
7010
|
+
if (minutes < 60) return `${minutes} min`;
|
|
7011
|
+
const h = Math.floor(minutes / 60);
|
|
7012
|
+
const m = minutes % 60;
|
|
7013
|
+
return m ? `${h} h ${m} min` : `${h} h`;
|
|
7014
|
+
}
|
|
7015
|
+
|
|
7016
|
+
function formatColonyCost(cost) {
|
|
7017
|
+
const parts = [];
|
|
7018
|
+
if (cost.logic) parts.push(`${cost.logic} Logic`);
|
|
7019
|
+
if (cost.compute) parts.push(`${cost.compute} Compute`);
|
|
7020
|
+
if (cost.rare) parts.push(`${cost.rare} Rare`);
|
|
7021
|
+
return parts.join(' · ') || 'Free';
|
|
7022
|
+
}
|
|
7023
|
+
|
|
7024
|
+
/** Hex map SVG. Static geometry and constant glyphs only (no snapshot text). */
|
|
7025
|
+
function renderColonyMapSvg(green, state) {
|
|
7026
|
+
const tiles = colonyHexTiles(COLONY_MAP_RADIUS);
|
|
7027
|
+
const size = 14;
|
|
7028
|
+
const fogFrom = Math.min(tiles.length, green + 12);
|
|
7029
|
+
const placed = [];
|
|
7030
|
+
const uplink = state.built.find((b) => b.structure === 'uplink');
|
|
7031
|
+
if (uplink) placed[0] = 'U';
|
|
7032
|
+
let slot = 1;
|
|
7033
|
+
for (const b of state.built) {
|
|
7034
|
+
if (b.structure === 'uplink') continue;
|
|
7035
|
+
const s = COLONY_STRUCTURES.find((x) => x.id === b.structure);
|
|
7036
|
+
if (s && slot < tiles.length) placed[slot++] = s.glyph;
|
|
7037
|
+
}
|
|
7038
|
+
const corner = (cx, cy, i) => {
|
|
7039
|
+
const a = (Math.PI / 180) * (60 * i - 30);
|
|
7040
|
+
return `${(cx + size * Math.cos(a)).toFixed(1)},${(cy + size * Math.sin(a)).toFixed(1)}`;
|
|
7041
|
+
};
|
|
7042
|
+
const cells = tiles.map((t, i) => {
|
|
7043
|
+
const cx = size * Math.sqrt(3) * (t.q + t.r / 2);
|
|
7044
|
+
const cy = size * 1.5 * t.r;
|
|
7045
|
+
const tileState = i < green ? 'green' : i < fogFrom ? 'barren' : 'fog';
|
|
7046
|
+
const points = [0, 1, 2, 3, 4, 5].map((k) => corner(cx, cy, k)).join(' ');
|
|
7047
|
+
const glyph = placed[i]
|
|
7048
|
+
? `<text class="colony-glyph" x="${cx.toFixed(1)}" y="${(cy + 4).toFixed(1)}" text-anchor="middle">${placed[i]}</text>`
|
|
7049
|
+
: '';
|
|
7050
|
+
return `<polygon class="colony-tile" data-tile="${tileState}" points="${points}"/>${glyph}`;
|
|
7051
|
+
}).join('');
|
|
7052
|
+
const span = size * Math.sqrt(3) * (COLONY_MAP_RADIUS + 0.6);
|
|
7053
|
+
const vb = `${(-span).toFixed(1)} ${(-span).toFixed(1)} ${(span * 2).toFixed(1)} ${(span * 2).toFixed(1)}`;
|
|
7054
|
+
return `<svg class="colony-map" viewBox="${vb}" role="img" aria-label="Colony map: ${green} of ${tiles.length} tiles green">${cells}</svg>`;
|
|
7055
|
+
}
|
|
7056
|
+
|
|
7057
|
+
/** Colony section body. Ledger labels are repo text: escapeHtml / escapeAttr only. */
|
|
7058
|
+
function renderColonySection(d, state, nowMs) {
|
|
7059
|
+
const ledger = d && d.outcomeLedger && typeof d.outcomeLedger === 'object' ? d.outcomeLedger : null;
|
|
7060
|
+
const tileCount = colonyHexTiles(COLONY_MAP_RADIUS).length;
|
|
7061
|
+
const earned = colonyEarned(ledger);
|
|
7062
|
+
const wallet = colonyWallet(earned, state);
|
|
7063
|
+
const overclock = colonyOverclockActive(ledger && ledger.flow, nowMs);
|
|
7064
|
+
const green = colonyGreenTiles(earned, state, tileCount);
|
|
7065
|
+
const title = (subtitle, body) => `
|
|
7066
|
+
<div class="content-section" id="section-colony">
|
|
7067
|
+
<div class="section-title">
|
|
7068
|
+
Colony
|
|
7069
|
+
<span class="section-subtitle">${escapeHtml(subtitle)}</span>
|
|
7070
|
+
</div>
|
|
7071
|
+
${body}
|
|
7072
|
+
</div>
|
|
7073
|
+
`;
|
|
7074
|
+
if (!ledger) {
|
|
7075
|
+
return title('no ledger', renderEmptyStateCta({
|
|
7076
|
+
iconKind: 'colony',
|
|
7077
|
+
headline: 'No outcome ledger in this snapshot',
|
|
7078
|
+
support: 'The Colony grows from the outcome ledger (Mission Control snapshot 1.9.0 or later). Update the kit engine to play.',
|
|
7079
|
+
}));
|
|
7080
|
+
}
|
|
7081
|
+
const res = (label, key) => `
|
|
7082
|
+
<div class="colony-resource">
|
|
7083
|
+
<span class="colony-resource-label">${label}</span>
|
|
7084
|
+
<span class="colony-resource-value">${wallet[key]}</span>
|
|
7085
|
+
<span class="colony-resource-meta">${earned[key]} earned · ${state.spent[key]} spent</span>
|
|
7086
|
+
</div>`;
|
|
7087
|
+
const flow = ledger.flow;
|
|
7088
|
+
const flowText = overclock
|
|
7089
|
+
? `Flow overclock on: streak of ${flow.streak} closed to-dos, builds run 25% faster`
|
|
7090
|
+
: flow && Number.isFinite(flow.streak)
|
|
7091
|
+
? `Flow streak ${flow.streak} (overclock at ${COLONY_FLOW_STREAK} closes in a row, the last within 2 h)`
|
|
7092
|
+
: 'Flow: no closed to-do in a mission yet';
|
|
7093
|
+
const queueRows = state.queue.map((b) => {
|
|
7094
|
+
const s = COLONY_STRUCTURES.find((x) => x.id === b.structure);
|
|
7095
|
+
const endsAt = colonyBuildEndsAt(b, overclock);
|
|
7096
|
+
const left = formatColonyDuration(endsAt - nowMs);
|
|
7097
|
+
const at = new Date(endsAt);
|
|
7098
|
+
const clock = `${String(at.getHours()).padStart(2, '0')}:${String(at.getMinutes()).padStart(2, '0')}`;
|
|
7099
|
+
return `<li class="colony-queue-item"><span class="colony-queue-name">${escapeHtml(s ? s.name : b.structure)}</span><span class="colony-queue-time" title="${escapeAttr(at.toISOString())}">${escapeHtml(`${left} left · ready at ${clock}`)}</span></li>`;
|
|
7100
|
+
}).join('');
|
|
7101
|
+
const queueBlock = `
|
|
7102
|
+
<div class="colony-panel">
|
|
7103
|
+
<div class="colony-panel-title">Build queue <span class="colony-panel-meta">${state.queue.length}/${COLONY_MAX_ACTIVE_BUILDS}</span></div>
|
|
7104
|
+
${queueRows ? `<ul class="colony-queue">${queueRows}</ul>` : '<p class="colony-note">Nothing under construction. Timers are read when this panel refreshes; nothing runs in the background.</p>'}
|
|
7105
|
+
</div>`;
|
|
7106
|
+
const cards = COLONY_STRUCTURES.map((s) => {
|
|
7107
|
+
const blocker = colonyBuildBlocker(s, state, wallet);
|
|
7108
|
+
const count = state.built.filter((b) => b.structure === s.id).length;
|
|
7109
|
+
const art = s.art
|
|
7110
|
+
? `<img class="colony-card-art" src="${escapeAttr(s.art)}" alt="" loading="lazy" decoding="async">`
|
|
7111
|
+
: '<div class="colony-card-art colony-card-art-none" aria-hidden="true"></div>';
|
|
7112
|
+
return `
|
|
7113
|
+
<div class="colony-card">
|
|
7114
|
+
${art}
|
|
7115
|
+
<div class="colony-card-body">
|
|
7116
|
+
<div class="colony-card-name">${escapeHtml(s.name)}${count ? ` <span class="colony-panel-meta">×${count}</span>` : ''}</div>
|
|
7117
|
+
<p class="colony-card-blurb">${escapeHtml(s.blurb)}</p>
|
|
7118
|
+
<div class="colony-card-meta">${escapeHtml(`${formatColonyCost(s.cost)} · ${formatColonyDuration(s.minutes * 60000)}`)}</div>
|
|
7119
|
+
<button type="button" class="process-copy-btn colony-build-btn" data-colony-build="${escapeAttr(s.id)}"${blocker ? ` disabled title="${escapeAttr(blocker)}"` : ` title="${escapeAttr(`Spend ${formatColonyCost(s.cost)} and start building`)}"`} aria-label="${escapeAttr(`Build ${s.name}`)}">${blocker ? escapeHtml(blocker) : 'Build'}</button>
|
|
7120
|
+
</div>
|
|
7121
|
+
</div>`;
|
|
7122
|
+
}).join('');
|
|
7123
|
+
const recent = (Array.isArray(ledger.recent) ? ledger.recent : []).slice(0, 6).map((e) => {
|
|
7124
|
+
const kindLabel = { todo: 'To-do done', test: 'Tests passed', ci: 'CI passed', releaseCut: 'Release cut', plan: 'Plan closed', review: 'Clean review', releasePublished: 'Release published' }[e && e.kind] || 'Outcome';
|
|
7125
|
+
return `<li class="colony-log-item"><span class="colony-log-kind">${escapeHtml(kindLabel)}</span><span class="colony-log-label" title="${escapeAttr(String(e.label || ''))}">${escapeHtml(String(e.label || ''))}</span></li>`;
|
|
7126
|
+
}).join('');
|
|
7127
|
+
const skipped = ledger.available === false
|
|
7128
|
+
? '<p class="colony-note">The ledger was not read on this refresh (snapshot budget); totals come back on the next one.</p>'
|
|
7129
|
+
: '';
|
|
7130
|
+
const emptyNote = ledger.available !== false && ledger.entries === 0
|
|
7131
|
+
? '<p class="colony-note">Nothing earned yet. Close a to-do, pass the tests (agent-kit outcome-ledger test) or ship a green CI run and the ground starts to turn.</p>'
|
|
7132
|
+
: '';
|
|
7133
|
+
const body = `
|
|
7134
|
+
<div class="colony-layout">
|
|
7135
|
+
<div class="colony-map-wrap">
|
|
7136
|
+
${renderColonyMapSvg(green, state)}
|
|
7137
|
+
<p class="colony-note">${escapeHtml(flowText)}</p>
|
|
7138
|
+
${emptyNote}${skipped}
|
|
7139
|
+
</div>
|
|
7140
|
+
<div class="colony-side">
|
|
7141
|
+
<div class="colony-resources">${res('Logic', 'logic')}${res('Compute', 'compute')}${res('Rare', 'rare')}</div>
|
|
7142
|
+
${queueBlock}
|
|
7143
|
+
<div class="colony-panel">
|
|
7144
|
+
<div class="colony-panel-title">Ship log</div>
|
|
7145
|
+
${recent ? `<ul class="colony-log">${recent}</ul>` : '<p class="colony-note">No outcomes yet.</p>'}
|
|
7146
|
+
</div>
|
|
7147
|
+
</div>
|
|
7148
|
+
</div>
|
|
7149
|
+
<div class="colony-cards">${cards}</div>
|
|
7150
|
+
<p class="colony-note">Resources come only from verified outcomes in the ledger, never from lines of code, commits or time. What you build is kept in this browser.</p>`;
|
|
7151
|
+
return title(`${green} of ${tileCount} tiles green`, body);
|
|
7152
|
+
}
|
|
7153
|
+
|
|
7154
|
+
/** Settle finished builds before render (persist only on change). */
|
|
7155
|
+
function colonyStateForRender(d, nowMs) {
|
|
7156
|
+
const loaded = loadColonyState();
|
|
7157
|
+
const flow = d && d.outcomeLedger ? d.outcomeLedger.flow : null;
|
|
7158
|
+
const { state, changed } = settleColonyState(loaded, nowMs, colonyOverclockActive(flow, nowMs));
|
|
7159
|
+
if (changed) saveColonyState(state);
|
|
7160
|
+
return state;
|
|
7161
|
+
}
|
|
7162
|
+
|
|
7163
|
+
function wireColonyButtons() {
|
|
7164
|
+
document.querySelectorAll('.colony-build-btn[data-colony-build]').forEach((btn) => {
|
|
7165
|
+
btn.addEventListener('click', (e) => {
|
|
7166
|
+
e.stopPropagation();
|
|
7167
|
+
if (btn.disabled || !data) return;
|
|
7168
|
+
const now = Date.now();
|
|
7169
|
+
const next = queueColonyBuild(colonyStateForRender(data, now), btn.dataset.colonyBuild, colonyEarned(data.outcomeLedger), now);
|
|
7170
|
+
if (next && saveColonyState(next)) render();
|
|
7171
|
+
});
|
|
7172
|
+
});
|
|
7173
|
+
// The panel works with no image at all: hide art a host cannot serve.
|
|
7174
|
+
document.querySelectorAll('img.colony-card-art').forEach((img) => {
|
|
7175
|
+
img.addEventListener('error', () => { img.hidden = true; }, { once: true });
|
|
7176
|
+
});
|
|
7177
|
+
}
|
|
7178
|
+
|
|
6794
7179
|
function wireChatResumeButtons() {
|
|
6795
7180
|
document.querySelectorAll('.chat-resume-btn[data-chat-resume]').forEach((btn) => {
|
|
6796
7181
|
btn.addEventListener('click', (e) => {
|
|
@@ -7586,7 +7971,7 @@ function nowMetaIconSvg(kind, opts) {
|
|
|
7586
7971
|
* features >= 1 unit. Detail that cannot meet the floor is drawn filled
|
|
7587
7972
|
* (fill="currentColor" stroke="none"), never as a sub-stroke stroked shape.
|
|
7588
7973
|
* Static path markup only; never concatenate untrusted text into the SVG.
|
|
7589
|
-
* @param {'current-mission'|'monitor'|'field-report'|'checklist'|'more-sections'|'overview'|'plans'|'activity'|'agents'|'skills'|'skins'|'commands'|'health'|'git'|'devops'|'memory'|'terminals'|'chats'|'processes'|'config'} kind
|
|
7974
|
+
* @param {'current-mission'|'monitor'|'field-report'|'checklist'|'more-sections'|'overview'|'plans'|'activity'|'agents'|'skills'|'skins'|'commands'|'health'|'git'|'devops'|'memory'|'terminals'|'chats'|'colony'|'processes'|'config'} kind
|
|
7590
7975
|
* @param {{ decorative?: boolean }} [opts] decorative true (default): aria-hidden next to a visible label.
|
|
7591
7976
|
* decorative false: role=img + aria-label + title for icon-only controls (e.g. more-sections).
|
|
7592
7977
|
*/
|
|
@@ -7612,6 +7997,7 @@ function spaceIconSvg(kind, opts) {
|
|
|
7612
7997
|
memory: 'Memory',
|
|
7613
7998
|
terminals: 'Terminals',
|
|
7614
7999
|
chats: 'Chats',
|
|
8000
|
+
colony: 'Colony',
|
|
7615
8001
|
processes: 'Processes',
|
|
7616
8002
|
config: 'Config',
|
|
7617
8003
|
};
|
|
@@ -7695,6 +8081,10 @@ function spaceIconSvg(kind, opts) {
|
|
|
7695
8081
|
// Speech bubble (chats) — Feather message-square on the 16 grid
|
|
7696
8082
|
chats:
|
|
7697
8083
|
'<path d="M14 10a1.5 1.5 0 01-1.5 1.5H5L2 14.5v-11A1.5 1.5 0 013.5 2h9A1.5 1.5 0 0114 3.5z"/>',
|
|
8084
|
+
// Hexagon with a sprout (colony)
|
|
8085
|
+
colony:
|
|
8086
|
+
'<path d="M8 1.75l5.5 3.125v6.25L8 14.25l-5.5-3.125v-6.25z"/>' +
|
|
8087
|
+
'<path d="M8 11V7.5M8 8.5c0-1.25 1-2 2.25-2M8 9.25c0-1-.85-1.75-2-1.75"/>',
|
|
7698
8088
|
// Layers (processes)
|
|
7699
8089
|
processes:
|
|
7700
8090
|
'<path d="M8 2.5l6 3-6 3-6-3 6-3z"/>' +
|
|
@@ -9213,6 +9603,10 @@ function renderUnsafe() {
|
|
|
9213
9603
|
// ===== Chats =====
|
|
9214
9604
|
parts.push(renderChatsSection(d));
|
|
9215
9605
|
|
|
9606
|
+
// ===== Colony =====
|
|
9607
|
+
const colonyNow = Date.now();
|
|
9608
|
+
parts.push(renderColonySection(d, colonyStateForRender(d, colonyNow), colonyNow));
|
|
9609
|
+
|
|
9216
9610
|
// ===== Processes =====
|
|
9217
9611
|
const processes = d.processes || [];
|
|
9218
9612
|
// Detached audit-session visibility (phase3): host-wide agent-kit-audit-* PTYs.
|
|
@@ -9376,6 +9770,7 @@ function renderUnsafe() {
|
|
|
9376
9770
|
|
|
9377
9771
|
wireTerminalExpandButtons();
|
|
9378
9772
|
wireChatResumeButtons();
|
|
9773
|
+
wireColonyButtons();
|
|
9379
9774
|
|
|
9380
9775
|
updateTransportChrome();
|
|
9381
9776
|
|
|
@@ -37,6 +37,7 @@ export const SNAPSHOT_REPO_SOURCE_RELS = Object.freeze([
|
|
|
37
37
|
".cursor/context/field-report-dismissals.json",
|
|
38
38
|
".cursor/context/mission-timing.json",
|
|
39
39
|
".cursor/context/flight-log.json",
|
|
40
|
+
".cursor/context/test-results.json",
|
|
40
41
|
".cursor/context/field-report-cadence.json",
|
|
41
42
|
".cursor/skills",
|
|
42
43
|
"package.json",
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
/** Ambient types for dashboard/lib/outcome-ledger.mjs (consumed by CLI TypeScript). */
|
|
2
|
+
|
|
3
|
+
export const OUTCOME_LEDGER_REL: ".cursor/context/outcome-ledger.json";
|
|
4
|
+
export const TEST_RESULTS_REL: ".cursor/context/test-results.json";
|
|
5
|
+
export const REPOSITORY_PROFILE_REL: ".cursor/agent-kit.config.json";
|
|
6
|
+
export const OUTCOME_LEDGER_VERSION: 1;
|
|
7
|
+
export const MAX_LEDGER_ENTRIES: number;
|
|
8
|
+
export const MAX_TEST_RESULTS: number;
|
|
9
|
+
export const MAX_RECENT_ENTRIES: number;
|
|
10
|
+
|
|
11
|
+
export type OutcomeKind =
|
|
12
|
+
| "todo"
|
|
13
|
+
| "test"
|
|
14
|
+
| "ci"
|
|
15
|
+
| "releaseCut"
|
|
16
|
+
| "plan"
|
|
17
|
+
| "review"
|
|
18
|
+
| "releasePublished";
|
|
19
|
+
export type OutcomeResource = "logic" | "compute" | "rare";
|
|
20
|
+
export const OUTCOME_KINDS: Readonly<Record<OutcomeKind, OutcomeResource>>;
|
|
21
|
+
|
|
22
|
+
export interface OutcomeEntry {
|
|
23
|
+
/** A kind from a newer engine is kept with resource null and not counted. */
|
|
24
|
+
kind: OutcomeKind | string;
|
|
25
|
+
resource: OutcomeResource | null;
|
|
26
|
+
at: string | null;
|
|
27
|
+
label: string;
|
|
28
|
+
}
|
|
29
|
+
export interface OutcomeEvent extends OutcomeEntry {
|
|
30
|
+
key: string;
|
|
31
|
+
}
|
|
32
|
+
export interface OutcomeLedger {
|
|
33
|
+
version: 1;
|
|
34
|
+
entries: Record<string, OutcomeEntry>;
|
|
35
|
+
sources: Record<string, string>;
|
|
36
|
+
}
|
|
37
|
+
export interface FlowSignal {
|
|
38
|
+
plan: string;
|
|
39
|
+
streak: number;
|
|
40
|
+
lastClosedAt: string | null;
|
|
41
|
+
brokenAt: string | null;
|
|
42
|
+
}
|
|
43
|
+
export interface TestRun {
|
|
44
|
+
at: string;
|
|
45
|
+
ok: boolean;
|
|
46
|
+
exitCode: number | null;
|
|
47
|
+
head: string | null;
|
|
48
|
+
commands: string[];
|
|
49
|
+
}
|
|
50
|
+
export interface TestResults {
|
|
51
|
+
version: 1;
|
|
52
|
+
runs: TestRun[];
|
|
53
|
+
}
|
|
54
|
+
export interface TestCollectorStatus {
|
|
55
|
+
configured: boolean;
|
|
56
|
+
lastRun: { at: string; ok: boolean; head: string | null } | null;
|
|
57
|
+
}
|
|
58
|
+
export interface OutcomeLedgerSummary {
|
|
59
|
+
available: boolean;
|
|
60
|
+
reason: string | null;
|
|
61
|
+
version: 1;
|
|
62
|
+
path: string;
|
|
63
|
+
entries: number;
|
|
64
|
+
totals: Record<OutcomeResource, number>;
|
|
65
|
+
byKind: Record<OutcomeKind, number>;
|
|
66
|
+
recent: OutcomeEvent[];
|
|
67
|
+
flow: FlowSignal | null;
|
|
68
|
+
tests: TestCollectorStatus;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
export function emptyOutcomeLedger(): OutcomeLedger;
|
|
72
|
+
export function parseOutcomeLedger(raw: unknown): OutcomeLedger;
|
|
73
|
+
export function serializeOutcomeLedger(ledger: unknown): string;
|
|
74
|
+
export function parsePlanTodos(content: string): Array<{ id: string; status: string }>;
|
|
75
|
+
export function fullReviewHeadSha(content: string): string | null;
|
|
76
|
+
export function extractOutcomeEvents(inputs?: Record<string, unknown>): OutcomeEvent[];
|
|
77
|
+
export function foldOutcomeLedger(
|
|
78
|
+
prev: unknown,
|
|
79
|
+
events: OutcomeEvent[],
|
|
80
|
+
sources?: Record<string, string>,
|
|
81
|
+
): { ledger: OutcomeLedger; added: number };
|
|
82
|
+
export function deriveFlowSignal(
|
|
83
|
+
timing: unknown,
|
|
84
|
+
runLogs?: unknown[],
|
|
85
|
+
plans?: Array<{ file: string; todos: Array<{ id: string; status: string }> }> | null,
|
|
86
|
+
): FlowSignal | null;
|
|
87
|
+
export function summarizeOutcomeLedger(
|
|
88
|
+
ledger: unknown,
|
|
89
|
+
extras?: {
|
|
90
|
+
available?: boolean;
|
|
91
|
+
reason?: string | null;
|
|
92
|
+
flow?: FlowSignal | null;
|
|
93
|
+
tests?: TestCollectorStatus;
|
|
94
|
+
},
|
|
95
|
+
): OutcomeLedgerSummary;
|
|
96
|
+
export function emptyOutcomeLedgerSummary(reason?: string | null): OutcomeLedgerSummary;
|
|
97
|
+
export function readOutcomeLedger(root: string): OutcomeLedger;
|
|
98
|
+
export function readOutcomeLedgerFile(root: string): { ledger: OutcomeLedger; foldable: boolean };
|
|
99
|
+
export function isFoldableOutcomeLedger(raw: unknown): boolean;
|
|
100
|
+
export function persistOutcomeLedger(root: string, ledger: unknown): boolean;
|
|
101
|
+
export function parseTestResults(raw: unknown): TestResults;
|
|
102
|
+
export function readTestResults(root: string): TestResults;
|
|
103
|
+
export function appendTestResult(root: string, run: TestRun): TestResults;
|
|
104
|
+
export function readProfileTestCommands(root: string): string[];
|
|
105
|
+
export function testCollectorStatus(root: string, testResults: TestResults): TestCollectorStatus;
|
|
106
|
+
export function runAndRecordTests(
|
|
107
|
+
root: string,
|
|
108
|
+
opts?: {
|
|
109
|
+
commands?: string[];
|
|
110
|
+
spawn?: (...args: unknown[]) => { status: number | null; stdout?: unknown };
|
|
111
|
+
stdio?: unknown;
|
|
112
|
+
now?: Date;
|
|
113
|
+
onCommand?: (command: string) => void;
|
|
114
|
+
},
|
|
115
|
+
): { status: "no-commands" } | { status: "recorded"; run: TestRun };
|