@feigi/fleet-ctl 3.123.2 → 3.124.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/package.json +1 -1
- package/scripts/board-gather.mjs +35 -2
- package/scripts/board.html +91 -8
- package/scripts/compute-board.mjs +7 -2
- package/scripts/compute-cell-evidence.mjs +226 -10
- package/scripts/member-record.mjs +11 -5
- package/scripts/ticket-router.mjs +46 -26
package/package.json
CHANGED
package/scripts/board-gather.mjs
CHANGED
|
@@ -34,7 +34,7 @@ import {
|
|
|
34
34
|
isOmpSessionDirName, ompSessionTranscripts, foldOmpTranscript, ompMemberRecord,
|
|
35
35
|
} from "./member-record.mjs";
|
|
36
36
|
import { readReceipt } from "./phase0-receipt.mjs";
|
|
37
|
-
import { RECEIPT, RECEIPT_HELD, CLOSEOUT_RECEIPT } from "./ledger-grammar.mjs";
|
|
37
|
+
import { RECEIPT, RECEIPT_HELD, CLOSEOUT_RECEIPT, OBJECTIVES } from "./ledger-grammar.mjs";
|
|
38
38
|
import { NAME, warnOnce, execRead } from "./board-common.mjs";
|
|
39
39
|
import { mergedReadPrs, issuesOfPrs } from "./compute-board.mjs";
|
|
40
40
|
import { readCostGuard } from "./fleet-tick.mjs";
|
|
@@ -798,6 +798,37 @@ export function readAgents(scriptDir) {
|
|
|
798
798
|
return { list, error: null };
|
|
799
799
|
}
|
|
800
800
|
|
|
801
|
+
// The install's own `package.json`, `../package.json` from the script's
|
|
802
|
+
// directory: `{ name, version, repository, error }`, `repository` the url its
|
|
803
|
+
// field names (the field is a string or `{ url }`), null where it names none.
|
|
804
|
+
// A file that cannot be read or parsed is `error`, with the rest null: the tab
|
|
805
|
+
// words an install it cannot name, never a guess.
|
|
806
|
+
export function readInstall(scriptDir) {
|
|
807
|
+
const file = join(scriptDir, "..", "package.json");
|
|
808
|
+
let pkg;
|
|
809
|
+
try {
|
|
810
|
+
pkg = JSON.parse(readFileSync(file, "utf8"));
|
|
811
|
+
} catch (e) {
|
|
812
|
+
return { name: null, version: null, repository: null, error: `${file}: ${e instanceof SyntaxError ? "not JSON" : (e.code ?? e.message)}` };
|
|
813
|
+
}
|
|
814
|
+
if (!isJsonObject(pkg)) return { name: null, version: null, repository: null, error: `${file}: not a JSON object` };
|
|
815
|
+
const repo = isJsonObject(pkg.repository) ? pkg.repository.url : pkg.repository;
|
|
816
|
+
return {
|
|
817
|
+
name: typeof pkg.name === "string" ? pkg.name : null,
|
|
818
|
+
version: typeof pkg.version === "string" ? pkg.version : null,
|
|
819
|
+
repository: typeof repo === "string" ? repo : null,
|
|
820
|
+
error: null,
|
|
821
|
+
};
|
|
822
|
+
}
|
|
823
|
+
|
|
824
|
+
// The live run's Objective, off the phase-0 receipt in the workspace's `.fleet`
|
|
825
|
+
// (the file readReceipt owns), or null: no receipt, as between runs, one that
|
|
826
|
+
// will not read, or one that records none.
|
|
827
|
+
export function readObjective(stateDir) {
|
|
828
|
+
const read = readReceipt(join(stateDir, RECEIPT));
|
|
829
|
+
return read.state === "ok" && OBJECTIVES.includes(read.receipt.objective) ? read.receipt.objective : null;
|
|
830
|
+
}
|
|
831
|
+
|
|
801
832
|
// `modelRoles` is read at most once in this many milliseconds: it is one more
|
|
802
833
|
// child spawn per read, and a role changes rarely.
|
|
803
834
|
export const MODEL_ROLES_EVERY_MS = 60_000;
|
|
@@ -1121,9 +1152,11 @@ export async function gather({ ledgerFile, prevFile, stateFile = null, stateDir
|
|
|
1121
1152
|
? { phase0: null, closeout: null }
|
|
1122
1153
|
: { phase0: readMetricsStep(join(stateDir, RECEIPT)), closeout: readMetricsStep(join(stateDir, CLOSEOUT_RECEIPT)) };
|
|
1123
1154
|
const agents = readAgents(scriptDir);
|
|
1155
|
+
const install = readInstall(scriptDir);
|
|
1156
|
+
const objective = stateDir === null ? null : readObjective(stateDir);
|
|
1124
1157
|
const modelRoles = stateDir === null ? heldRead(prev?.modelRoles) : await carryModelRoles(prev?.modelRoles, now);
|
|
1125
1158
|
return { ledger, issues, prs, merged, closed, closedIssues, ci, prev, repo, repoUrl, workspace, port, spend, beat, ticked, acted, controller, stallOwner: stallOwnerOf, poolOk,
|
|
1126
1159
|
roles, labelMapError,
|
|
1127
|
-
poolCapped, prsCapped, guard, receipts, agents, modelRoles, implementers: [...implementers.values()], routerTable,
|
|
1160
|
+
poolCapped, prsCapped, guard, receipts, agents, modelRoles, install, objective, implementers: [...implementers.values()], routerTable,
|
|
1128
1161
|
now, interval };
|
|
1129
1162
|
}
|
package/scripts/board.html
CHANGED
|
@@ -104,6 +104,13 @@
|
|
|
104
104
|
.ce-foot { margin-top:8px; }
|
|
105
105
|
#cells-declared summary { cursor:pointer; color:var(--dim); }
|
|
106
106
|
.ce-member { display:flex; gap:10px; flex-wrap:wrap; font-size:12px; margin:2px 0 0 18px; }
|
|
107
|
+
.ce-sides { display:flex; gap:18px; flex-wrap:wrap; margin-bottom:8px; }
|
|
108
|
+
.ce-side { flex:1 1 20em; }
|
|
109
|
+
.ce-row { display:grid; gap:12px; border-top:1px solid var(--line); padding:6px 0; font-size:12px; }
|
|
110
|
+
.ce-row a { color:var(--blue); text-decoration:none; }
|
|
111
|
+
.ce-cand { color:var(--dim); margin-left:10px; }
|
|
112
|
+
.ce-stratum { font-weight:600; }
|
|
113
|
+
.ce-obj { margin-top:10px; }
|
|
107
114
|
.ce.flash { animation:flash 1.2s ease-out 1; }
|
|
108
115
|
.spend-wrap { background:var(--panel); border:1px solid var(--line); border-radius:8px; padding:10px 12px; }
|
|
109
116
|
.spend-hd { display:flex; align-items:baseline; gap:10px; margin-bottom:8px; }
|
|
@@ -162,8 +169,9 @@ function boardTitle(repo) { return repo ? `${TITLE} — ${repo}` : TITLE; }
|
|
|
162
169
|
//
|
|
163
170
|
// Every hash the page draws is a tab (`#board`, `#cells`, `#tokens`), a card on
|
|
164
171
|
// the Board (`#board/<issue>`, the issue number as a string) or a place on Cell
|
|
165
|
-
// evidence: a section (`#cells/guard`, `#cells/declared`), a
|
|
166
|
-
// (`#cells/<
|
|
172
|
+
// evidence: a section (`#cells/rows`, `#cells/guard`, `#cells/declared`), a policy
|
|
173
|
+
// row (`#cells/row/<objective>/<stratum>`, the stratum `*` or one of the three), a
|
|
174
|
+
// Cell (`#cells/<cell>`) or one of its generations (`#cells/<cell>@<generation>`).
|
|
167
175
|
// Anything else — no hash, a tab the page does not have, a target the tab does
|
|
168
176
|
// not have — lands on Board's top, or the named tab's top, never on a blank
|
|
169
177
|
// page and never on an error.
|
|
@@ -171,18 +179,24 @@ function routeHash(hash) {
|
|
|
171
179
|
const [tab, target, ...more] = String(hash).replace(/^#/, "").split("/");
|
|
172
180
|
if (tab === "board") return { tab, target: more.length === 0 && /^[1-9]\d*$/.test(target) ? target : null };
|
|
173
181
|
if (tab === "cells") {
|
|
174
|
-
|
|
182
|
+
if (target === "row") {
|
|
183
|
+
const [objective, stratum] = more;
|
|
184
|
+
const ok = more.length === 2 && /^(cost|speed)$/.test(objective) && /^(\*|light|heavy|unknown)$/.test(stratum);
|
|
185
|
+
return { tab, target: ok ? `row/${objective}/${stratum}` : null };
|
|
186
|
+
}
|
|
187
|
+
const place = /^(rows|guard|declared|(slow|task|smol)-(minimal|low|medium|high|xhigh|max)(@[^\s/@]+)?)$/;
|
|
175
188
|
return { tab, target: more.length === 0 && place.test(target ?? "") ? target : null };
|
|
176
189
|
}
|
|
177
190
|
if (tab === "tokens") return { tab, target: null };
|
|
178
191
|
return { tab: "board", target: null };
|
|
179
192
|
}
|
|
180
193
|
|
|
181
|
-
// The element a route's target names: a card on Board, a section, a
|
|
182
|
-
// generation on Cell evidence.
|
|
194
|
+
// The element a route's target names: a card on Board, a section, a policy row, a
|
|
195
|
+
// Cell or a generation on Cell evidence.
|
|
183
196
|
function anchorId(tab, target) {
|
|
184
197
|
if (tab === "board") return "card-" + target;
|
|
185
|
-
|
|
198
|
+
if (target === "rows" || target === "guard" || target === "declared") return "cells-" + target;
|
|
199
|
+
return target.startsWith("row/") ? "cells-" + target.replace(/\//g, "-") : "cell-" + target;
|
|
186
200
|
}
|
|
187
201
|
|
|
188
202
|
// Each tab, and the pane it opens.
|
|
@@ -440,6 +454,74 @@ function ceEntry(e) {
|
|
|
440
454
|
return box;
|
|
441
455
|
}
|
|
442
456
|
|
|
457
|
+
// One side's heading on the policy rows: its title, source line, the check it
|
|
458
|
+
// could not make, its burn-in or no-guard heading, its shared dispatch and its
|
|
459
|
+
// model-name line, where each is set.
|
|
460
|
+
function cePolicySide(s) {
|
|
461
|
+
const box = el("div", "ce-side");
|
|
462
|
+
box.append(el("div", "ce-verdict", s.title), el("div", "ce-source", s.source.text));
|
|
463
|
+
if (s.source.check) box.append(el("div", "ce-note", s.source.check));
|
|
464
|
+
if (s.heading) box.append(el("div", "ce-note", s.heading));
|
|
465
|
+
if (s.dispatch) box.append(el("div", "ce-note", "dispatch: " + s.dispatch));
|
|
466
|
+
if (s.modelLine) box.append(el("div", "ce-note ce-amber", s.modelLine));
|
|
467
|
+
return box;
|
|
468
|
+
}
|
|
469
|
+
|
|
470
|
+
// One side's cell of a row: the Cell it routes to and why, its own dispatch where
|
|
471
|
+
// it differs from the side's, and each candidate's n, verdict and interval.
|
|
472
|
+
function cePolicyCell(s, href) {
|
|
473
|
+
const box = el("div", "ce-polcell");
|
|
474
|
+
if (s.unread || s.follows) { box.append(el("span", "ce-dim", s.unread || s.follows)); return box; }
|
|
475
|
+
const hd = el("div", "ce-hd");
|
|
476
|
+
hd.append(el("span", "ce-cell", s.cell));
|
|
477
|
+
const reason = el("a", "ce-dim", s.reason);
|
|
478
|
+
reason.href = href;
|
|
479
|
+
hd.append(reason);
|
|
480
|
+
if (s.held) hd.append(el("span", "ce-amber", s.held));
|
|
481
|
+
box.append(hd);
|
|
482
|
+
if (s.dispatch) box.append(el("div", "ce-note", "dispatch: " + s.dispatch));
|
|
483
|
+
for (const c of s.candidates) {
|
|
484
|
+
const line = el("div", "ce-cand", `${c.cell} · n ${c.n ?? "not checked"} · ${c.verdict} · ${c.interval}`);
|
|
485
|
+
if (c.model && c.model.text) line.append(el("span", "ce-amber", " · " + c.model.text));
|
|
486
|
+
box.append(line);
|
|
487
|
+
}
|
|
488
|
+
return box;
|
|
489
|
+
}
|
|
490
|
+
|
|
491
|
+
// One line of the policy rows: a Stratum's row across every side, or the one
|
|
492
|
+
// line a Stratum with no row of its own collapses to. Either way it is a place
|
|
493
|
+
// `#cells/row/<objective>/<stratum>` lands on.
|
|
494
|
+
function cePolicyLine(line) {
|
|
495
|
+
const box = ceBox("div", "ce-row", line.anchor);
|
|
496
|
+
if (line.collapsed) {
|
|
497
|
+
box.append(el("span", "ce-dim", line.collapsed));
|
|
498
|
+
return box;
|
|
499
|
+
}
|
|
500
|
+
box.style.gridTemplateColumns = `6em repeat(${line.sides.length}, minmax(0, 1fr))`;
|
|
501
|
+
box.append(el("span", "ce-stratum", line.stratum));
|
|
502
|
+
for (const s of line.sides) box.append(cePolicyCell(s, line.href));
|
|
503
|
+
return box;
|
|
504
|
+
}
|
|
505
|
+
|
|
506
|
+
// The policy rows, Objective × Stratum: each side's heading, then one row-aligned
|
|
507
|
+
// table with the live run's Objective marked.
|
|
508
|
+
function cePolicy(p) {
|
|
509
|
+
const sec = ceBox("section", "ce-sec", "cells-rows");
|
|
510
|
+
sec.append(el("h2", null, "Policy rows: Objective × Stratum"));
|
|
511
|
+
const sides = el("div", "ce-sides");
|
|
512
|
+
for (const s of p.sides) sides.append(cePolicySide(s));
|
|
513
|
+
sec.append(sides);
|
|
514
|
+
for (const o of p.objectives) {
|
|
515
|
+
const hd = el("div", "ce-hd ce-obj");
|
|
516
|
+
hd.append(el("span", "ce-cell", o.objective));
|
|
517
|
+
if (o.live) hd.append(el("span", "badge", "this run's Objective"));
|
|
518
|
+
sec.append(hd);
|
|
519
|
+
for (const line of o.lines) sec.append(cePolicyLine(line));
|
|
520
|
+
}
|
|
521
|
+
for (const s of p.sides) for (const f of s.footnotes) sec.append(el("div", "ce-foot", `${f.mark} ${f.text}`));
|
|
522
|
+
return sec;
|
|
523
|
+
}
|
|
524
|
+
|
|
443
525
|
// The Cell evidence tab. The model is `m.cellEvidence`; this only lays it out.
|
|
444
526
|
// Every Cell and every generation the model names is drawn, so each hash link
|
|
445
527
|
// the page draws has its target.
|
|
@@ -449,7 +531,8 @@ function renderCells(ce) {
|
|
|
449
531
|
const g = ce.guard;
|
|
450
532
|
|
|
451
533
|
const links = el("div", "ce-links");
|
|
452
|
-
for (const [href, text] of [["#cells/guard", "the guard"], ["#cells/declared", "declared, not measured"]]) {
|
|
534
|
+
for (const [href, text] of [["#cells/rows", "policy rows"], ["#cells/guard", "the guard"], ["#cells/declared", "declared, not measured"]]) {
|
|
535
|
+
if (!ce.policy && href === "#cells/rows") continue;
|
|
453
536
|
if (links.children.length) links.append(document.createTextNode(" · "));
|
|
454
537
|
const a = el("a", null, text);
|
|
455
538
|
a.href = href;
|
|
@@ -473,7 +556,7 @@ function renderCells(ce) {
|
|
|
473
556
|
dec.append(row);
|
|
474
557
|
}
|
|
475
558
|
|
|
476
|
-
host.replaceChildren(links, sec, dec);
|
|
559
|
+
host.replaceChildren(links, ...(ce.policy ? [cePolicy(ce.policy)] : []), sec, dec);
|
|
477
560
|
}
|
|
478
561
|
|
|
479
562
|
function render(m) {
|
|
@@ -855,8 +855,9 @@ export function computeBoard(inputs) {
|
|
|
855
855
|
}, now),
|
|
856
856
|
attention,
|
|
857
857
|
// The Cell evidence tab's model (compute-cell-evidence.mjs), built from the
|
|
858
|
-
// guard, the receipts' metrics steps, the definitions
|
|
859
|
-
//
|
|
858
|
+
// guard, the receipts' metrics steps, the definitions, the installed router
|
|
859
|
+
// table and package, the live run's Objective and the carried `modelRoles`
|
|
860
|
+
// read gather() answered, and this run's Pulls: each card's
|
|
860
861
|
// Cell line, booked As-routed to its Cell. A caller that read none of them
|
|
861
862
|
// (every hand-built input in this suite) gets the tab's no-guard state:
|
|
862
863
|
// computeCellEvidence reads an input left out as nothing read.
|
|
@@ -865,6 +866,10 @@ export function computeBoard(inputs) {
|
|
|
865
866
|
receipts: inputs.receipts,
|
|
866
867
|
agents: inputs.agents,
|
|
867
868
|
modelRoles: inputs.modelRoles,
|
|
869
|
+
table: inputs.routerTable,
|
|
870
|
+
install: inputs.install,
|
|
871
|
+
repoUrl: inputs.repoUrl,
|
|
872
|
+
objective: inputs.objective,
|
|
868
873
|
pulls: tickets.filter((t) => t.cellLine).map((t) => ({ issue: t.issue, cell: t.cellLine.cell, mark: t.cellLine.mark, targets: t.cellLine.targets })),
|
|
869
874
|
}),
|
|
870
875
|
// The `omp config get modelRoles` read, carried tick to tick the way `ci`
|
|
@@ -1,24 +1,30 @@
|
|
|
1
1
|
// The cockpit's Cell evidence tab, as a value: computeCellEvidence() turns what
|
|
2
2
|
// gather() read (the cost guard, the receipts' `metrics` steps, the installed
|
|
3
|
-
// definitions, the
|
|
3
|
+
// definitions, the installed router table and package, the carried `modelRoles`
|
|
4
|
+
// read) into the model the page lays out.
|
|
4
5
|
// Pure, like compute-board.mjs, which calls it and puts the answer in
|
|
5
6
|
// `board.json` as `cellEvidence`: no file, no process, no clock. Every word the
|
|
6
7
|
// tab shows is built here, so a test pins it where it is made and the page only
|
|
7
8
|
// places it.
|
|
8
9
|
//
|
|
9
|
-
// What this
|
|
10
|
+
// What this holds is the guard section — what the cost guard holds each
|
|
10
11
|
// implementer Cell to, from the guard file and nothing recomputed, with this
|
|
11
|
-
// run's Pulls booked to each Cell off the board's cards
|
|
12
|
-
//
|
|
13
|
-
// the
|
|
14
|
-
//
|
|
12
|
+
// run's Pulls booked to each Cell off the board's cards — "Declared, not
|
|
13
|
+
// measured", and the policy rows' routes-now side: for each Objective × Stratum
|
|
14
|
+
// row, the Cell the installed router table plus the workspace's guard route to,
|
|
15
|
+
// why, and how a Pull on that row is dispatched (ticket-router.mjs's
|
|
16
|
+
// rowDispatch, the function `route` itself calls). Figures show only from a
|
|
17
|
+
// guard `readCostGuard` (fleet-tick.mjs, the reader the tick judges the file by)
|
|
18
|
+
// accepts; `guard` here is that reader's own answer, `{ status: "ok", guard }` or
|
|
19
|
+
// `{ status: "missing" | "unreadable" }`.
|
|
15
20
|
//
|
|
16
21
|
// A figure the guard file lacks reads "not checked", never 0: the file written
|
|
17
22
|
// before the per-Cell counts existed carries only `n`, `mean_usd`, `fail_rate`
|
|
18
23
|
// and `untimed` per Cell, and each count the file does not carry is named as not
|
|
19
24
|
// checked where its figure would show.
|
|
20
25
|
|
|
21
|
-
import { CELL } from "./ledger-grammar.mjs";
|
|
26
|
+
import { CELL, OBJECTIVES, POLICY_CELL, STRATA } from "./ledger-grammar.mjs";
|
|
27
|
+
import { MIN_N, readGuard, rowDispatch } from "./ticket-router.mjs";
|
|
22
28
|
import { implementerCell, modelsEqual, parseModelRoute, resolveRole } from "./tier-roles.mjs";
|
|
23
29
|
|
|
24
30
|
// The implementer Cells, in the order the guard section draws them. All five are
|
|
@@ -384,6 +390,210 @@ function guardSection(read, receipts, modelRoles, pulls) {
|
|
|
384
390
|
return { state, heading, source, notes, cells, footnotes };
|
|
385
391
|
}
|
|
386
392
|
|
|
393
|
+
// ---------------------------------------------------------------------------
|
|
394
|
+
// Policy rows: Objective × Stratum, routes now.
|
|
395
|
+
// ---------------------------------------------------------------------------
|
|
396
|
+
|
|
397
|
+
// A repository's host and `owner/name` off a `package.json` `repository` url (an
|
|
398
|
+
// npm shorthand, a scp-style address or a URL), or null when it names none. A
|
|
399
|
+
// `#ref` pin and a `www.` host name the same repository; a segment of dots only
|
|
400
|
+
// names none.
|
|
401
|
+
export function repoIdentity(url) {
|
|
402
|
+
if (typeof url !== "string") return null;
|
|
403
|
+
const s = url.trim().replace(/^git\+/, "").replace(/#.*$/, "");
|
|
404
|
+
let host;
|
|
405
|
+
let path;
|
|
406
|
+
const short = /^(github|gitlab|bitbucket):([^/\s]+\/[^/\s]+)$/.exec(s);
|
|
407
|
+
const scp = /^[^@/\s]+@([^:/\s]+):(.+)$/.exec(s);
|
|
408
|
+
if (short) {
|
|
409
|
+
host = `${short[1]}.${short[1] === "bitbucket" ? "org" : "com"}`;
|
|
410
|
+
path = short[2];
|
|
411
|
+
} else if (scp) {
|
|
412
|
+
[, host, path] = scp;
|
|
413
|
+
} else if (/^[\w.-]+\/[\w.-]+$/.test(s)) {
|
|
414
|
+
host = "github.com";
|
|
415
|
+
path = s;
|
|
416
|
+
} else {
|
|
417
|
+
try { ({ hostname: host, pathname: path } = new URL(s)); } catch { return null; }
|
|
418
|
+
}
|
|
419
|
+
const [owner, rest] = path.split("/").filter(Boolean);
|
|
420
|
+
const name = rest?.replace(/\.git$/, "");
|
|
421
|
+
if (!host || !owner || !name || /^\.+$/.test(owner) || /^\.+$/.test(name)) return null;
|
|
422
|
+
return { host: host.toLowerCase().replace(/^www\./, ""), name: `${owner}/${name}` };
|
|
423
|
+
}
|
|
424
|
+
|
|
425
|
+
const plural = (n, word) => `${n} ${word}${n === 1 ? "" : "s"}`;
|
|
426
|
+
const list = (xs) => (xs.length < 2 ? xs.join("") : `${xs.slice(0, -1).join(", ")} and ${xs.at(-1)}`);
|
|
427
|
+
|
|
428
|
+
// Whose runs the installed table is, and what the install is: "this repository's
|
|
429
|
+
// runs · fitted at 1a2b3c4 on 198 Pulls · @feigi/fleet-ctl 3.105.0". `install` is
|
|
430
|
+
// `{ name, version, repository, error }`, `repository` the package's url.
|
|
431
|
+
function routesSource(table, install, repoUrl) {
|
|
432
|
+
const named = repoIdentity(install?.repository);
|
|
433
|
+
const here = repoIdentity(repoUrl);
|
|
434
|
+
const same = named !== null && here !== null && named.host === here.host && named.name.toLowerCase() === here.name.toLowerCase();
|
|
435
|
+
const runs = same ? "this repository's runs" : named !== null ? `${named.name}'s runs` : "another repository's runs";
|
|
436
|
+
let fitted;
|
|
437
|
+
if (table === null) fitted = "no router table read";
|
|
438
|
+
else if (!table.fitted_commit) fitted = "never fitted";
|
|
439
|
+
else {
|
|
440
|
+
const on = Number.isInteger(table.n_rows) ? `on ${plural(table.n_rows, "Pull")}` : "on a number of Pulls not checked";
|
|
441
|
+
fitted = `fitted at ${String(table.fitted_commit).slice(0, 7)} ${on}`;
|
|
442
|
+
}
|
|
443
|
+
let installed;
|
|
444
|
+
if (install == null || install.error) installed = `install not read${install?.error ? `: ${install.error}` : ""}`;
|
|
445
|
+
else installed = `${install.name ?? "unnamed package"} ${install.version === "0.0.0" ? "linked checkout" : (install.version ?? "no version")}`;
|
|
446
|
+
const check = install == null || install.error
|
|
447
|
+
? "not checked: the install was not read"
|
|
448
|
+
: named === null
|
|
449
|
+
? "not checked: the install names no repository"
|
|
450
|
+
: here === null ? "not checked: this workspace's repository is not known" : null;
|
|
451
|
+
return { same, owner: named === null ? "another repository" : named.name, runs, text: [runs, fitted, installed].join(" · "), check };
|
|
452
|
+
}
|
|
453
|
+
|
|
454
|
+
// The Cells short of `MIN_N` merged PRs at the fit, in the table's order, as one
|
|
455
|
+
// past-tense phrase: the counts are what the fit saw.
|
|
456
|
+
function shortWords(table) {
|
|
457
|
+
const short = table.cells.filter((c) => (table.guard.n[c] ?? 0) < MIN_N).map((c) => [c, table.guard.n[c] ?? 0]);
|
|
458
|
+
if (short.length === 0) return null;
|
|
459
|
+
const each = short.length === 1 ? "it needs" : "each needs";
|
|
460
|
+
const counts = new Set(short.map(([, n]) => n));
|
|
461
|
+
if (counts.size === 1) return `${list(short.map(([c]) => c))} had ${short[0][1]} of the ${MIN_N} merged PRs ${each}`;
|
|
462
|
+
return `${list(short.map(([c, n]) => `${c} had ${n}`))} of the ${MIN_N} merged PRs ${each}`;
|
|
463
|
+
}
|
|
464
|
+
|
|
465
|
+
// The side's burn-in or no-guard heading, or null while neither holds. Past tense
|
|
466
|
+
// for a fitted table, whose counts are what its fit saw.
|
|
467
|
+
function routesHeading(table, guard, source) {
|
|
468
|
+
if (table === null) return "no router table read: the rows are not known";
|
|
469
|
+
if (guard === null) return `no cost guard: every Pull runs at ${POLICY_CELL}, the default Cell`;
|
|
470
|
+
if (!table.burn_in) return null;
|
|
471
|
+
const K = rowDispatch({ table, guard, objective: "cost", stratum: "*" }).draw?.cells.length ?? 0;
|
|
472
|
+
const drawn = K === 0 ? "no Cell is left to draw, so every Pull runs at its row's Cell" : `every Pull drawn over ${plural(K, "Cell")}`;
|
|
473
|
+
if (!table.fitted_commit) return `never fitted: ${drawn}`;
|
|
474
|
+
const short = shortWords(table);
|
|
475
|
+
const ends = source.same ? "" : "; it ends with a later fit, reaching this install with a plugin release";
|
|
476
|
+
return `stage ${table.stage} at its fit on ${source.owner}'s runs: ${short === null ? "every Cell had its merged PRs" : short}; ${drawn}${ends}`;
|
|
477
|
+
}
|
|
478
|
+
|
|
479
|
+
// One row's dispatch, in the words a heading or a row carries: what `route` does
|
|
480
|
+
// with a Pull on it under the guard, from rowDispatch.
|
|
481
|
+
function dispatchWords(table, rd, row) {
|
|
482
|
+
const tripped = rd.reason === "table-cell-tripped" ? `the row's ${row} tripped` : null;
|
|
483
|
+
if (rd.reason === "guard-missing") return `${POLICY_CELL} only`;
|
|
484
|
+
if (rd.draw?.by === "burn-in") {
|
|
485
|
+
return `drawn over ${plural(rd.draw.cells.length, "Cell")}: ${rd.draw.cells.join(", ")}${tripped ? `; ${tripped}, so its policy Cell is ${POLICY_CELL}` : ""}`;
|
|
486
|
+
}
|
|
487
|
+
const fifth = rd.draw === null ? "no draw: no other Cell is left" : "every 5th Pull drawn over the rest";
|
|
488
|
+
return `${tripped ? `${POLICY_CELL}, ${tripped}` : "the row's Cell"}; ${fifth}`;
|
|
489
|
+
}
|
|
490
|
+
|
|
491
|
+
// A candidate's judged generation against the Tier route model of its Cell:
|
|
492
|
+
// null for a row with no estimate (it names no generation), else `{ state,
|
|
493
|
+
// generation, text }`, `text` set where the two differ or cannot be compared.
|
|
494
|
+
function generationCheck(cell, generation, modelRoles) {
|
|
495
|
+
if (typeof generation !== "string" || generation === "") return null;
|
|
496
|
+
const parsed = CELL.exec(cell);
|
|
497
|
+
if (parsed === null) return { state: "not checked", generation, text: "not checked: not a Cell the fleet defines" };
|
|
498
|
+
const model = routeModel(parsed[1], modelRoles);
|
|
499
|
+
if (model === undefined) return { state: "not checked", generation, text: "not checked: modelRoles not read yet" };
|
|
500
|
+
if (model === null) return { state: "not checked", generation, text: `not checked: modelRoles.${parsed[1]} unset: omp picks the model` };
|
|
501
|
+
if (modelsEqual(model, generation)) return { state: "same", generation, text: null };
|
|
502
|
+
return { state: "differs", generation, text: `judged on ${generation}; ${cell} runs ${model} here` };
|
|
503
|
+
}
|
|
504
|
+
|
|
505
|
+
// A candidate's 95% interval, of (candidate − base) per merged PR: dollars under
|
|
506
|
+
// `cost`, minutes of work time under `speed`.
|
|
507
|
+
function intervalWords(range, objective) {
|
|
508
|
+
if (!Array.isArray(range) || range.length !== 2 || !range.every(Number.isFinite)) return "no 95% interval";
|
|
509
|
+
const one = (x) => `${x < 0 ? MINUS : ""}${objective === "cost" ? `$${Math.abs(x).toFixed(2)}` : `${Math.abs(x).toFixed(1)} min`}`;
|
|
510
|
+
return `95% interval [${one(range[0])}, ${one(range[1])}]`;
|
|
511
|
+
}
|
|
512
|
+
|
|
513
|
+
// One row of the installed table under the guard: the Cell it routes to and why,
|
|
514
|
+
// its dispatch, and each candidate's n (null where the table carries no count),
|
|
515
|
+
// verdict and interval.
|
|
516
|
+
function routesEntry(table, guard, modelRoles, objective, stratum) {
|
|
517
|
+
const rd = rowDispatch({ table, guard, objective, stratum });
|
|
518
|
+
const row = table.rows[objective][stratum];
|
|
519
|
+
const record = isRecord(table.reasons?.[objective]?.[stratum]) ? table.reasons[objective][stratum] : null;
|
|
520
|
+
const estimates = isRecord(table.estimates?.[stratum]) ? table.estimates[stratum] : {};
|
|
521
|
+
const held = row === rd.policy ? null
|
|
522
|
+
: rd.reason === "guard-missing" ? `${row} held: no cost guard` : `${row} tripped`;
|
|
523
|
+
return {
|
|
524
|
+
cell: rd.policy,
|
|
525
|
+
held,
|
|
526
|
+
reason: record !== null && typeof record.reason === "string" ? record.reason : "not checked",
|
|
527
|
+
dispatch: dispatchWords(table, rd, row),
|
|
528
|
+
candidates: Object.entries(isRecord(record?.cells) ? record.cells : {}).map(([cell, x]) => ({
|
|
529
|
+
cell,
|
|
530
|
+
n: count(estimates[cell]?.merged),
|
|
531
|
+
verdict: typeof x?.verdict === "string" ? x.verdict : "not checked",
|
|
532
|
+
interval: intervalWords(x?.range, objective),
|
|
533
|
+
model: generationCheck(cell, estimates[cell]?.generation, modelRoles),
|
|
534
|
+
})),
|
|
535
|
+
};
|
|
536
|
+
}
|
|
537
|
+
|
|
538
|
+
// The routes-now side of the policy rows: its heading words and every row the
|
|
539
|
+
// installed table holds, `rows[objective][stratum]` — `*` and each Stratum with a
|
|
540
|
+
// row of its own. `rows` is null when no table could be read.
|
|
541
|
+
function routesNow({ table, guard, modelRoles, install, repoUrl }) {
|
|
542
|
+
const source = routesSource(table, install, repoUrl);
|
|
543
|
+
const foot = source.same ? [] : [{ mark: "¹", text: "this repository's runs reach routing only through its cost guard, which can hold a Cell back but never picks one" }];
|
|
544
|
+
return {
|
|
545
|
+
title: "routes now",
|
|
546
|
+
source: { text: source.text + (foot.length ? " ¹" : ""), check: source.check },
|
|
547
|
+
heading: routesHeading(table, guard, source),
|
|
548
|
+
footnotes: foot,
|
|
549
|
+
rows: table === null ? null : Object.fromEntries(OBJECTIVES.map((o) => [o,
|
|
550
|
+
Object.fromEntries(["*", ...STRATA].filter((s) => Object.hasOwn(table.rows[o], s)).map((s) => [s, routesEntry(table, guard, modelRoles, o, s)])),
|
|
551
|
+
])),
|
|
552
|
+
};
|
|
553
|
+
}
|
|
554
|
+
|
|
555
|
+
// The policy rows as the page lays them out, from each side built above. Pure
|
|
556
|
+
// and side-agnostic: a side's shared dispatch (the one most rows have, the rest
|
|
557
|
+
// showing theirs on the row), its one model-name line when every candidate it
|
|
558
|
+
// names differs, a Stratum no side has a row for collapsed to one line, and the
|
|
559
|
+
// Objective of the live run marked. Every row, collapsed or not, has an anchor
|
|
560
|
+
// the `#cells/row/<objective>/<stratum>` link lands on.
|
|
561
|
+
export function policyRowsView({ sides, objective = null }) {
|
|
562
|
+
const entries = (s) => (s.rows === null ? [] : OBJECTIVES.flatMap((o) => Object.values(s.rows[o])));
|
|
563
|
+
const shared = sides.map((s) => {
|
|
564
|
+
const seen = new Map();
|
|
565
|
+
for (const e of entries(s)) seen.set(e.dispatch, (seen.get(e.dispatch) ?? 0) + 1);
|
|
566
|
+
return [...seen].sort((a, b) => b[1] - a[1])[0]?.[0] ?? null;
|
|
567
|
+
});
|
|
568
|
+
const modelLine = sides.map((s) => {
|
|
569
|
+
const checks = entries(s).flatMap((e) => e.candidates.map((c) => c.model)).filter((m) => m !== null);
|
|
570
|
+
return checks.length > 0 && checks.every((m) => m.state === "differs") ? [...new Set(checks.map((m) => m.text))].join("; ") : null;
|
|
571
|
+
});
|
|
572
|
+
const show = (e, i) => ({
|
|
573
|
+
...e,
|
|
574
|
+
dispatch: e.dispatch === shared[i] ? null : e.dispatch,
|
|
575
|
+
candidates: e.candidates.map((c) => (c.model !== null && modelLine[i] !== null ? { ...c, model: { ...c.model, text: null } } : c)),
|
|
576
|
+
});
|
|
577
|
+
return {
|
|
578
|
+
sides: sides.map((s, i) => ({ title: s.title, source: s.source, heading: s.heading, dispatch: shared[i], modelLine: modelLine[i], footnotes: s.footnotes })),
|
|
579
|
+
objectives: OBJECTIVES.map((o) => ({
|
|
580
|
+
objective: o,
|
|
581
|
+
live: o === objective,
|
|
582
|
+
lines: ["*", ...STRATA].map((stratum) => {
|
|
583
|
+
const line = { stratum, anchor: `cells-row-${o}-${stratum}`, href: `#cells/row/${o}/${stratum}` };
|
|
584
|
+
const own = sides.map((s) => s.rows?.[o]?.[stratum] ?? null);
|
|
585
|
+
if (stratum !== "*" && sides.every((s) => s.rows !== null) && own.every((e) => e === null)) {
|
|
586
|
+
return { ...line, collapsed: `${stratum}: ${sides.length > 1 ? "no row on either side" : "no row"}, follows *` };
|
|
587
|
+
}
|
|
588
|
+
return {
|
|
589
|
+
...line,
|
|
590
|
+
sides: sides.map((s, i) => (s.rows === null ? { unread: "router table not read" } : own[i] === null ? { follows: "no row of its own: follows *" } : show(own[i], i))),
|
|
591
|
+
};
|
|
592
|
+
}),
|
|
593
|
+
})),
|
|
594
|
+
};
|
|
595
|
+
}
|
|
596
|
+
|
|
387
597
|
// ---------------------------------------------------------------------------
|
|
388
598
|
// Declared, not measured.
|
|
389
599
|
// ---------------------------------------------------------------------------
|
|
@@ -423,11 +633,17 @@ function declaredSection(agents, modelRoles) {
|
|
|
423
633
|
* `modelRoles` the carried `{ value, readAt, error }` or null — `error` being
|
|
424
634
|
* `{ at, message }`, and `pulls` this run's Pulls, one per card with a Cell line:
|
|
425
635
|
* `{ issue, cell, mark, targets: [{ cell, generation }] }` (compute-board.mjs's
|
|
426
|
-
* cellLine).
|
|
427
|
-
*
|
|
636
|
+
* cellLine). `table` is the installed router table `validateTable` accepted or
|
|
637
|
+
* null, `install` the install's `{ name, version, repository, error }`
|
|
638
|
+
* (`repository` its url), `repoUrl` the workspace's, and `objective` the live
|
|
639
|
+
* run's Objective or null between runs. An input left out reads as nothing
|
|
640
|
+
* read: a missing guard, no receipt, no definitions, no `modelRoles` read, no
|
|
641
|
+
* Pull, no table, no install, no Objective.
|
|
428
642
|
*/
|
|
429
|
-
export function computeCellEvidence({ guard, receipts, agents, modelRoles = null, pulls = [] }) {
|
|
643
|
+
export function computeCellEvidence({ guard, receipts, agents, modelRoles = null, pulls = [], table = null, install = null, repoUrl = null, objective = null }) {
|
|
644
|
+
const routed = guard?.status === "ok" ? readGuard(guard.guard) : null;
|
|
430
645
|
return {
|
|
646
|
+
policy: policyRowsView({ sides: [routesNow({ table, guard: routed, modelRoles, install, repoUrl })], objective }),
|
|
431
647
|
guard: guardSection(guard, receipts, modelRoles, pulls),
|
|
432
648
|
declared: declaredSection(agents, modelRoles),
|
|
433
649
|
};
|
|
@@ -357,7 +357,6 @@ function createdPrNumbers(text) {
|
|
|
357
357
|
// numbers in first-seen order.
|
|
358
358
|
export function foldOmpTranscript(jsonlText, filePath) {
|
|
359
359
|
let model = null, thinking = null, task = null, resolvedModelIdentity = null, agent = null;
|
|
360
|
-
let firstTs = null;
|
|
361
360
|
// For the `work_s` column (member-outcomes.mjs): every timestamped entry's
|
|
362
361
|
// instant, and the member's working parts — each run of timestamped entries
|
|
363
362
|
// between two `session_exit` entries, as [first, last] in epoch ms. The
|
|
@@ -368,6 +367,9 @@ export function foldOmpTranscript(jsonlText, filePath) {
|
|
|
368
367
|
let input = 0, cacheWrite = 0, cacheWrite1h = 0, cacheRead = 0, output = 0, cost = 0, turns = 0;
|
|
369
368
|
let sawCost = false, unsplit = false, unpriced = false;
|
|
370
369
|
let malformedNonLastLines = 0;
|
|
370
|
+
// Entries that carry a `timestamp` from which no finite instant was read;
|
|
371
|
+
// an entry with no `timestamp` at all is ordinary and not counted.
|
|
372
|
+
let unparseableStamps = 0;
|
|
371
373
|
// What the transcript's END says, read for the `ending` column: the last
|
|
372
374
|
// assistant turn's stopReason, whether a model fell back, whether the
|
|
373
375
|
// session exited cleanly, whether a budget notice reached the member, and
|
|
@@ -390,9 +392,9 @@ export function foldOmpTranscript(jsonlText, filePath) {
|
|
|
390
392
|
try { d = JSON.parse(raw); }
|
|
391
393
|
catch { if (i !== lines.length - 1) malformedNonLastLines++; continue; }
|
|
392
394
|
assertOmpShaped(d, filePath);
|
|
393
|
-
|
|
394
|
-
if (typeof d.timestamp === "string") { firstTs ??= d.timestamp; ms = Date.parse(d.timestamp); }
|
|
395
|
+
const ms = typeof d.timestamp === "string" ? Date.parse(d.timestamp) : NaN;
|
|
395
396
|
if (Number.isFinite(ms)) stamps.push(ms);
|
|
397
|
+
else if (Object.hasOwn(d, "timestamp")) unparseableStamps++;
|
|
396
398
|
if (d.type === "custom" && d.customType === "session_exit") {
|
|
397
399
|
sessionExit = true;
|
|
398
400
|
if (partFirst !== null) workParts.push([partFirst, partLast]);
|
|
@@ -449,10 +451,12 @@ export function foldOmpTranscript(jsonlText, filePath) {
|
|
|
449
451
|
if (partFirst !== null) workParts.push([partFirst, partLast]);
|
|
450
452
|
// `wall_s` is the span of the parseable stamps, latest minus earliest, so it
|
|
451
453
|
// does not depend on file order and cannot go negative; an unparseable
|
|
452
|
-
// stamp is skipped, and a transcript with none spans 0.
|
|
454
|
+
// stamp is skipped, and a transcript with none spans 0. `startedAt` is the
|
|
455
|
+
// same earliest stamp as an ISO string, or null when none parsed.
|
|
453
456
|
let earliest = Infinity, latest = -Infinity;
|
|
454
457
|
for (const t of stamps) { if (t < earliest) earliest = t; if (t > latest) latest = t; }
|
|
455
458
|
const span = stamps.length ? (latest - earliest) / 1000 : 0;
|
|
459
|
+
const startedAt = stamps.length ? new Date(earliest).toISOString() : null;
|
|
456
460
|
return {
|
|
457
461
|
model, thinking, task, resolvedModelIdentity, agent,
|
|
458
462
|
input, cacheWrite, cacheRead, output,
|
|
@@ -470,8 +474,9 @@ export function foldOmpTranscript(jsonlText, filePath) {
|
|
|
470
474
|
wallS: Math.round(span),
|
|
471
475
|
entries,
|
|
472
476
|
malformedNonLastLines,
|
|
477
|
+
unparseableStamps,
|
|
473
478
|
openedPrs: [...openedPrs],
|
|
474
|
-
startedAt
|
|
479
|
+
startedAt,
|
|
475
480
|
stamps, workParts,
|
|
476
481
|
reportWrites,
|
|
477
482
|
lastStopReason, providerFallback, sessionExit, budgetNotice,
|
|
@@ -915,6 +920,7 @@ export function readOmpSession(sessionDir, activity = null) {
|
|
|
915
920
|
lastStopReason: folded.lastStopReason, providerFallback: folded.providerFallback,
|
|
916
921
|
sessionExit: folded.sessionExit, budgetNotice: folded.budgetNotice,
|
|
917
922
|
malformedNonLastLines: folded.malformedNonLastLines,
|
|
923
|
+
unparseableStamps: folded.unparseableStamps,
|
|
918
924
|
hasYield: existsSync(file.replace(/\.jsonl$/, ".md")),
|
|
919
925
|
timed: folded.stamps.length > 0, workParts: folded.workParts,
|
|
920
926
|
} });
|
|
@@ -71,7 +71,7 @@ export const HEAVY_CRITERIA = 5;
|
|
|
71
71
|
// Exploration cadence after burn-in: the Pull that creates `impl-` row 5k.
|
|
72
72
|
const EXPLORE_EVERY = 5;
|
|
73
73
|
// The fit's adoption floor (merged PRs per side), margin, and cadence.
|
|
74
|
-
const MIN_N = 20;
|
|
74
|
+
export const MIN_N = 20;
|
|
75
75
|
const ADOPT_RATIO = 0.75;
|
|
76
76
|
export const FIT_EVERY_MERGED = 50;
|
|
77
77
|
// Stage 2 adds the effort cells on the roles whose stage-1 cell survived.
|
|
@@ -195,7 +195,35 @@ export function bArmLive(table, objective) {
|
|
|
195
195
|
return table.classifier.b !== null && Object.values(table.rows[objective]).some((c) => c !== POLICY_CELL);
|
|
196
196
|
}
|
|
197
197
|
|
|
198
|
-
|
|
198
|
+
/** The row a stratum routes by: its own, else the `*` row's. */
|
|
199
|
+
export const rowFor = (rows, stratum) => rows[stratum] ?? rows["*"];
|
|
200
|
+
|
|
201
|
+
/**
|
|
202
|
+
* What `route` does with one row under one guard, with no per-Pull input.
|
|
203
|
+
* `guard` is readGuard's answer or null. `policy` is the row's Cell, or the
|
|
204
|
+
* default cell when there is no guard or the row's Cell is tripped; `reason`
|
|
205
|
+
* is `guard-missing`, `table-cell-tripped` or `ok`. `draw` is what an
|
|
206
|
+
* exploring Pull picks from — `by` `burn-in` (every Pull) or `every-5th` —
|
|
207
|
+
* over `cells`: the table's Cells less the tripped, and on an every-5th draw
|
|
208
|
+
* less the `cost` row's Cell for the stratum too, as the guard leaves it (the
|
|
209
|
+
* default cell when that row's Cell is tripped), whichever objective routes
|
|
210
|
+
* the row. It is null with no guard and when no Cell is left to draw.
|
|
211
|
+
* @returns {{ policy: string, reason: "guard-missing"|"table-cell-tripped"|"ok", draw: null | { by: "burn-in"|"every-5th", cells: string[] } }}
|
|
212
|
+
*/
|
|
213
|
+
export function rowDispatch({ table, guard, objective, stratum }) {
|
|
214
|
+
if (guard === null) return { policy: POLICY_CELL, reason: "guard-missing", draw: null };
|
|
215
|
+
const tripped = new Set(guard.tripped);
|
|
216
|
+
const adjust = (cell) => (tripped.has(cell) ? POLICY_CELL : cell);
|
|
217
|
+
const row = rowFor(table.rows[objective], stratum);
|
|
218
|
+
const by = table.burn_in ? "burn-in" : "every-5th";
|
|
219
|
+
const left = table.cells.filter((c) => !tripped.has(c));
|
|
220
|
+
const cells = table.burn_in ? left : left.filter((c) => c !== adjust(rowFor(table.rows.cost, stratum)));
|
|
221
|
+
return {
|
|
222
|
+
policy: adjust(row),
|
|
223
|
+
reason: tripped.has(row) ? "table-cell-tripped" : "ok",
|
|
224
|
+
draw: cells.length > 0 ? { by, cells } : null,
|
|
225
|
+
};
|
|
226
|
+
}
|
|
199
227
|
|
|
200
228
|
// ---------------------------------------------------------------------------
|
|
201
229
|
// route
|
|
@@ -273,37 +301,29 @@ export function route({ session, ticket, arm, implRow, chainHead = false, issue,
|
|
|
273
301
|
}
|
|
274
302
|
}
|
|
275
303
|
|
|
276
|
-
const
|
|
277
|
-
|
|
278
|
-
|
|
304
|
+
const dispatch = (o, s) => rowDispatch({ table, guard, objective: o, stratum: s });
|
|
305
|
+
const policyRow = dispatch(objective, ruleS);
|
|
306
|
+
const baseRow = b ? dispatch(objective, stratum) : policyRow;
|
|
279
307
|
const costB = arm === "B" && bArmLive(table, "cost");
|
|
280
|
-
|
|
281
|
-
|
|
308
|
+
const drawRow = dispatch("cost", costB ? sized?.stratum ?? "unknown" : ruleS);
|
|
309
|
+
for (const r of [policyRow.reason, baseRow.reason]) if (r !== "ok") degrade(r);
|
|
310
|
+
// With no guard the default cell is the only one: the guard cannot be
|
|
311
|
+
// evaded by deleting it.
|
|
312
|
+
const policy = policyRow.policy;
|
|
313
|
+
let cell = baseRow.policy;
|
|
282
314
|
let draw = null;
|
|
283
315
|
let by = null;
|
|
284
|
-
if (guard
|
|
285
|
-
// The guard cannot be evaded by deleting it: no guard, default cell only.
|
|
286
|
-
degrade("guard-missing");
|
|
287
|
-
policy = POLICY_CELL;
|
|
288
|
-
cell = POLICY_CELL;
|
|
289
|
-
} else {
|
|
290
|
-
const tripped = new Set(guard.tripped);
|
|
291
|
-
if (tripped.has(policy) || tripped.has(base)) {
|
|
292
|
-
degrade("table-cell-tripped");
|
|
293
|
-
if (tripped.has(policy)) policy = POLICY_CELL;
|
|
294
|
-
if (tripped.has(base)) base = POLICY_CELL;
|
|
295
|
-
}
|
|
296
|
-
if (tripped.has(drawBase)) drawBase = POLICY_CELL;
|
|
297
|
-
cell = base;
|
|
316
|
+
if (guard !== null) {
|
|
298
317
|
const exploring = table.burn_in || (implRow % EXPLORE_EVERY === 0 && !chainHead);
|
|
299
318
|
if (exploring) {
|
|
300
|
-
const policyCell = table.burn_in ? null :
|
|
301
|
-
if (table.cells.some((c) => c !== policyCell && tripped.
|
|
302
|
-
|
|
303
|
-
|
|
319
|
+
const policyCell = table.burn_in ? null : drawRow.policy;
|
|
320
|
+
if (table.cells.some((c) => c !== policyCell && guard.tripped.includes(c))) degrade("guard-tripped");
|
|
321
|
+
if (drawRow.draw !== null) {
|
|
322
|
+
// rowDispatch already left the policy Cell out of `cells`: nothing more to withhold.
|
|
323
|
+
const d = drawCell({ session, ticket, policyCell: null, cells: drawRow.draw.cells });
|
|
304
324
|
cell = d.cell;
|
|
305
325
|
draw = { k: d.k, K: d.K };
|
|
306
|
-
by =
|
|
326
|
+
by = drawRow.draw.by;
|
|
307
327
|
}
|
|
308
328
|
}
|
|
309
329
|
}
|