clearotron 0.6.0 → 0.7.0-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/INSTALL.md +7 -4
- package/QUICKSTART.md +1 -0
- package/README.md +5 -2
- package/THIRD-PARTY-NOTICES.md +1 -1
- package/bin/clearotron.mjs +4 -2
- package/bin/onboard.mjs +158 -29
- package/build-info.json +2 -2
- package/docs/CLIENT-MCP.md +3 -1
- package/docs/DELIVERY.md +6 -3
- package/docs/architecture/02-architecture.md +1 -1
- package/docs/branding.md +4 -4
- package/docs/report-data/clearance-1.schema.json +320 -0
- package/docs/report-data/knockout-1.schema.json +268 -0
- package/driver/CHANGELOG.md +39 -0
- package/driver/connotation-search.mjs +1 -1
- package/driver/contract-e3-backlog.mjs +1 -1
- package/driver/coverage-ledger.mjs +18 -2
- package/driver/deferral-row.mjs +1 -1
- package/driver/degraded-parts.mjs +1 -0
- package/driver/driver.config.mjs +4 -3
- package/driver/effective-scope.mjs +3 -1
- package/driver/engagement-receipt.mjs +3 -3
- package/driver/engine/anthropic-agent.mjs +15 -1
- package/driver/engine/common.mjs +7 -0
- package/driver/engine/mcp/band-server.mjs +7 -16
- package/driver/engine/mcp/codex-config.mjs +3 -0
- package/driver/engine/mcp/recording-server.mjs +45 -34
- package/driver/engine/openai-agent.mjs +74 -7
- package/driver/gateway.mjs +67 -10
- package/driver/jx.mjs +13 -5
- package/driver/manuals-seen.mjs +146 -0
- package/driver/mark-logos.mjs +144 -0
- package/driver/methodology-witness.mjs +2 -1
- package/driver/owner-use-check.mjs +3 -3
- package/driver/package.json +1 -1
- package/driver/pipeline-knockout.mjs +4 -0
- package/driver/pipeline.mjs +92 -7
- package/driver/portal-local-auth.mjs +6 -2
- package/driver/portal-report.mjs +43 -12
- package/driver/portal-routes/me.mjs +4 -1
- package/driver/portal-runs.mjs +6 -9
- package/driver/profiles.mjs +4 -4
- package/driver/publish/README.md +9 -7
- package/driver/publish/email-conditions.mjs +2 -2
- package/driver/publish/evidence-words.mjs +21 -0
- package/driver/publish/index.mjs +104 -90
- package/driver/publish/knockout.mjs +75 -49
- package/driver/publish/office-record-links.mjs +11 -9
- package/driver/publish/page-shell.mjs +98 -0
- package/driver/publish/publish-inputs.mjs +4 -0
- package/driver/publish/regions.mjs +24 -3
- package/driver/publish/register-record.mjs +150 -0
- package/driver/publish/render-knockout.mjs +195 -642
- package/driver/publish/render.mjs +270 -363
- package/driver/publish/report-data.mjs +225 -12
- package/driver/publish/strings.mjs +662 -0
- package/driver/publish/templates/knockout.css +200 -0
- package/driver/publish/templates/report.css +72 -52
- package/driver/publish/xlsx.mjs +148 -125
- package/driver/record-goods.mjs +42 -0
- package/driver/reference-score.mjs +4 -1
- package/driver/register-reach.mjs +39 -0
- package/driver/registry-fidelity.mjs +3 -8
- package/driver/repair-composers.mjs +6 -2
- package/driver/repair-targets.mjs +4 -1
- package/driver/run-delivered.mjs +6 -1
- package/driver/runner.mjs +73 -29
- package/driver/scope-facts.mjs +27 -6
- package/driver/search-policy.mjs +9 -4
- package/driver/stages.mjs +3 -3
- package/driver/steps/overview-and-cards.mjs +50 -14
- package/driver/steps/verdict-gate.mjs +33 -13
- package/driver/suite-census.json +368 -68
- package/driver/terminal-clamp.mjs +6 -1
- package/mcp-server/CHANGELOG.md +4 -0
- package/mcp-server/lib/audit-view.mjs +5 -2
- package/mcp-server/lib/brief.mjs +2 -1
- package/mcp-server/lib/evidence.mjs +31 -4
- package/mcp-server/lib/knockout.mjs +1 -1
- package/mcp-server/lib/scrub.mjs +1 -1
- package/mcp-server/package.json +1 -1
- package/mcp-server/server.mjs +5 -3
- package/package.json +4 -1
- package/portal-ui/dist/assets/{index-CYaO2ygd.js → index-CtkllKJ2.js} +225 -77
- package/portal-ui/dist/assets/{index-izLa9apq.css → index-CxAkJXIT.css} +25 -5
- package/portal-ui/dist/index.html +2 -2
- package/portal-ui/package.json +3 -3
- package/providers/_shared/ledger.mjs +30 -2
- package/providers/_shared/record-uri.mjs +15 -0
- package/providers/clarivate/src/adapter.js +11 -0
- package/providers/clarivate/src/core.js +17 -1
- package/providers/oauth-mcp-bridge/CHANGELOG.md +4 -0
- package/providers/oauth-mcp-bridge/package.json +1 -1
- package/scripts/README.md +147 -3
- package/scripts/e2e-first-time.mjs +3 -3
- package/scripts/freeze-example-run.mjs +3 -3
- package/scripts/mint-search-level-tags.mjs +61 -0
- package/scripts/mint-source-pin-census.mjs +89 -0
- package/scripts/release-note-required.mjs +65 -6
- package/scripts/test-durations-reporter.mjs +25 -0
- package/scripts/test-full.mjs +72 -18
- package/scripts/test-run.mjs +18 -1
- package/shared/brand.mjs +85 -5
- package/shared/inline-markdown.mjs +53 -0
- package/shared/portal-tokens.mjs +2 -1
- package/shared/register-selection.mjs +8 -3
- package/shared/search-level-tags.json +25 -0
- package/shared/tools/derive-band-pairs.mjs +10 -0
- package/driver/own-rights.mjs +0 -83
- package/driver/use-check.mjs +0 -85
package/driver/pipeline.mjs
CHANGED
|
@@ -8042,6 +8042,19 @@ export function scriptScopeDisclosure(lane) { // @internal
|
|
|
8042
8042
|
};
|
|
8043
8043
|
}
|
|
8044
8044
|
|
|
8045
|
+
/** Several script lanes' rows as one, in the approved words: the lanes' names and their territories joined, the
|
|
8046
|
+
* sentence and the offer once. PURE. */
|
|
8047
|
+
export function mergedScriptScopeRow(lanes, state = "coverage-limited") { // @internal
|
|
8048
|
+
const parts = lanes.map((lane) => scriptScopeDisclosure(lane)).filter(Boolean);
|
|
8049
|
+
const names = parts.map((d) => d.area.replace(/\s*register equivalents\s*\(.*\)$/, ""));
|
|
8050
|
+
const joined = names.length <= 1 ? names.join("") : `${names.slice(0, -1).join(", ")} and ${names[names.length - 1]}`;
|
|
8051
|
+
return {
|
|
8052
|
+
area: `${joined} register equivalents (${parts.flatMap((d) => d.territories).join(" / ")})`,
|
|
8053
|
+
state,
|
|
8054
|
+
note: `${joined} same-meaning/phonetic register equivalents not searched on this search — ${NATIVE_LANGUAGE_REMEDY}`,
|
|
8055
|
+
};
|
|
8056
|
+
}
|
|
8057
|
+
|
|
8045
8058
|
/** The pure decision: should the honesty row be injected, and what row. Exported for the unit tests.
|
|
8046
8059
|
* `scope` is the requested-territory list (jxScopeJurisdictions precedence: instructed wins, else
|
|
8047
8060
|
* profile defaults); the zh match is EXACTLY the codes decideJxLanes would have matched with the lane
|
|
@@ -8153,7 +8166,7 @@ export function injectScriptScopeCoverage(P, runDir, note, { searchPolicy = null
|
|
|
8153
8166
|
const doc = JSON.parse(readFileSync(P.findings, "utf8"));
|
|
8154
8167
|
if (!Array.isArray(doc.coverage)) doc.coverage = []; // T1 (G8) posture: never silently lose the disclosure
|
|
8155
8168
|
const rowText = (c) => `${c?.area ?? ""} ${c?.note ?? ""}`.toLowerCase();
|
|
8156
|
-
const added = [];
|
|
8169
|
+
const added = [], owed = [];
|
|
8157
8170
|
for (const p of pending) {
|
|
8158
8171
|
// Suppression is PER LANE. The old check treated any coverage row mentioning "clearance-jx" as
|
|
8159
8172
|
// covering the disclosure, which was harmless while zh was the only lane and is a silent row-
|
|
@@ -8171,9 +8184,18 @@ export function injectScriptScopeCoverage(P, runDir, note, { searchPolicy = null
|
|
|
8171
8184
|
|| (p.marker != null && t.includes(p.marker) && SCRIPT_SCOPE_RECOMMENDATION_TOKENS.some((tok) => t.includes(tok)));
|
|
8172
8185
|
});
|
|
8173
8186
|
if (already) continue;
|
|
8174
|
-
|
|
8175
|
-
added.push(p.lane);
|
|
8187
|
+
owed.push(p);
|
|
8176
8188
|
}
|
|
8189
|
+
// THE SCRIPT ROWS ARE ONE ROW (owner, 2026-11-18). A worldwide order owed a row per script lane, each ending
|
|
8190
|
+
// in the same offer, so "Left open" said it three times. The lanes still owed a row are now one row: their
|
|
8191
|
+
// names and territories joined, the same approved sentence once. One lane writes the row it always wrote.
|
|
8192
|
+
// The merged row carries every lane's marker and the offer's own words, so the per-lane check above finds
|
|
8193
|
+
// it on a second pass and writes nothing more.
|
|
8194
|
+
const scriptRows = owed.filter((p) => p.marker != null);
|
|
8195
|
+
const rows = [...owed.filter((p) => p.marker == null).map((p) => p.row),
|
|
8196
|
+
...(scriptRows.length > 1 ? [mergedScriptScopeRow(scriptRows.map((p) => p.lane), scriptRows[0].row.state)] : scriptRows.map((p) => p.row))];
|
|
8197
|
+
doc.coverage.push(...rows);
|
|
8198
|
+
added.push(...owed.map((p) => p.lane));
|
|
8177
8199
|
if (!added.length) return;
|
|
8178
8200
|
parseFindingsJson(JSON.stringify(doc)); // re-validate the shape (throws → catch keeps original)
|
|
8179
8201
|
writeFindings(runDir, doc, { why: "script-scope-coverage-row", settles: [] }); // B5 — never a truncated findings.json
|
|
@@ -8240,7 +8262,10 @@ export function injectLaneDepthCoverage(P, runDir, note) { // @internal
|
|
|
8240
8262
|
// `jx.mjs` writes them as this cause's `why`, and the reader gets them as they are, under a label in words: no
|
|
8241
8263
|
// opening that restates them in the code's terms, and no closing line about verdicts, which belongs to the run's
|
|
8242
8264
|
// own coverage judgment. Every other cause keeps the fuller note below.
|
|
8243
|
-
|
|
8265
|
+
// A depth the record cannot confirm, and a full ask that ran candidates only, are said the same way, each in the
|
|
8266
|
+
// owner's sentence (2026-11-18).
|
|
8267
|
+
const plain = (v.cause === "not-built-for-lane" && v.ran === "candidates" || v.cause === "not-established"
|
|
8268
|
+
|| v.cause === "requested-full-ran-candidates") && typeof v.why === "string" && v.why;
|
|
8244
8269
|
const language = String(LANGUAGE_LANES[lane]?.label ?? "").replace(/-script deepening$/, "") || lane; // as jx.mjs names it
|
|
8245
8270
|
const area = plain ? `${language}-language search depth` : `Native-language investigation depth / ${lane}`;
|
|
8246
8271
|
const areas = [area, `Native-language investigation depth / ${lane}`, `${language}-language search depth`].map((a) => a.toLowerCase());
|
|
@@ -8393,6 +8418,54 @@ export function injectScreenGateCoverage(P, runDir, note, ctx = {}) { // @inte
|
|
|
8393
8418
|
}
|
|
8394
8419
|
}
|
|
8395
8420
|
|
|
8421
|
+
// Imported down here, below every line the rest of the tree cites by number, so adding them moved none of those lines.
|
|
8422
|
+
import { registerReach, NOT_COVERED_REASON } from "./register-reach.mjs"; // — what the register service reaches, against the order's markets
|
|
8423
|
+
import { regionName } from "./publish/regions.mjs";
|
|
8424
|
+
|
|
8425
|
+
// THE MARKETS AN ORDER IS FOR, as the register's reach is read against them: a worldwide order's are the client's
|
|
8426
|
+
// markets (the account's default markets, else the major markets, plus any market the order names), and a territorial
|
|
8427
|
+
// order's are its own. Read from the run's frozen order and profile. Never throws: an order it cannot read has no
|
|
8428
|
+
// markets here, and the coverage line and the rows then say what they said before.
|
|
8429
|
+
export function orderMarketsOf(ctx, plan) { // @internal
|
|
8430
|
+
try {
|
|
8431
|
+
const order = instructedOrder(ctx.paths, ctx.job);
|
|
8432
|
+
return plan?.scope_basis === "worldwide" ? clientMarkets(order, ctx.profile) : orderTerritories(order, ctx.profile);
|
|
8433
|
+
} catch { return []; }
|
|
8434
|
+
}
|
|
8435
|
+
|
|
8436
|
+
/** EVERY MARKET THE REGISTER SERVICE DOES NOT REACH GETS A "NOT SEARCHED" ROW, WRITTEN BY CODE (owner, 2026-11-18).
|
|
8437
|
+
* Whether such a market was named used to depend on what the writer chose to write: on three deliveries of one
|
|
8438
|
+
* order, one named Japan alone, and Vietnam was named on none. The reach is register-reach.mjs's, the same answer the
|
|
8439
|
+
* coverage line names, so the row and the line cannot disagree. The area is the country's name and the reason is the
|
|
8440
|
+
* approved one. A row the writer added for the same market stays beside it. Idempotent by area and reason, so a resume
|
|
8441
|
+
* or a second pass never doubles a row; never-kill, as its siblings. */
|
|
8442
|
+
export function injectUncoveredMarketCoverage(P, runDir, note, ctx = {}) { // @internal
|
|
8443
|
+
try {
|
|
8444
|
+
if (!existsSync(P.findings)) return;
|
|
8445
|
+
let plan = ctx.registerPlan ?? null;
|
|
8446
|
+
if (!plan) { try { plan = JSON.parse(readFileSync(P.registerPlan, "utf8")); } catch { return; } }
|
|
8447
|
+
const reach = registerReach(plan?.provider, orderMarketsOf(ctx, plan));
|
|
8448
|
+
if (!reach?.uncovered.length) return;
|
|
8449
|
+
const doc = JSON.parse(readFileSync(P.findings, "utf8"));
|
|
8450
|
+
if (!Array.isArray(doc.coverage)) doc.coverage = [];
|
|
8451
|
+
let added = 0;
|
|
8452
|
+
for (const code of reach.uncovered) {
|
|
8453
|
+
const area = regionName(code);
|
|
8454
|
+
if (doc.coverage.some((c) => String(c?.area ?? "") === area && String(c?.note ?? "") === NOT_COVERED_REASON)) continue;
|
|
8455
|
+
doc.coverage.push({ area, state: "not-searched", note: NOT_COVERED_REASON });
|
|
8456
|
+
added++;
|
|
8457
|
+
}
|
|
8458
|
+
if (!added) return;
|
|
8459
|
+
parseFindingsJson(JSON.stringify(doc)); // re-validate the shape (throws → catch keeps original)
|
|
8460
|
+
writeFindings(runDir, doc, { why: "uncovered-market-rows", settles: [] });
|
|
8461
|
+
runLog(runDir, { event: "uncovered-market-rows", service: reach.service, offices: reach.offices, markets: reach.uncovered, added });
|
|
8462
|
+
note(`[register-reach] ${added} "Not searched" row(s) for market(s) outside ${reach.service}'s ${reach.offices} offices: ${reach.uncovered.join(", ")}`);
|
|
8463
|
+
} catch (e) {
|
|
8464
|
+
note(`[register-reach] coverage rows skipped: ${String(e?.message || e).replace(/\s+/g, " ").slice(0, 100)}`);
|
|
8465
|
+
coverageRowNotAdded(runDir, "register-reach", e);
|
|
8466
|
+
}
|
|
8467
|
+
}
|
|
8468
|
+
|
|
8396
8469
|
// spec 64 (B3) — within-run deadline propagation (the DEMVENZY drop): the register bands carried
|
|
8397
8470
|
// oppositionEndDate 2026-07-13 two days before the window closed, and it never reached the delivered
|
|
8398
8471
|
// findings/prose. Deterministic join: a finding whose registration matches a band/record opposition
|
|
@@ -9829,7 +9902,7 @@ async function pipelineInner(job, opts = {}) {
|
|
|
9829
9902
|
note(`\n=== clearotron-driver: ${run.slug} / ${run.date}-${run.codename} (agent=${agent}) ===`);
|
|
9830
9903
|
|
|
9831
9904
|
// How the run ends delivered (run-delivered.mjs).
|
|
9832
|
-
const { deliverWithoutTheAssessment, publishAndDeliver } = await deliveryEndState({ P, agent, ctx, job, run }, { applyScopeFrontMatterOf, archive, assessmentCoverageOfRun, localLanguageStateOf, reportIdentityRecord, searchLogAuditMd, sentinel, setAsideTheAssessment, writeScopeFactsOf });
|
|
9905
|
+
const { deliverWithoutTheAssessment, publishAndDeliver } = await deliveryEndState({ P, agent, ctx, job, run, opts }, { applyScopeFrontMatterOf, archive, assessmentCoverageOfRun, localLanguageStateOf, reportIdentityRecord, searchLogAuditMd, sentinel, setAsideTheAssessment, writeScopeFactsOf });
|
|
9833
9906
|
|
|
9834
9907
|
// The clearance's own steps, in order, run by run-shell.mjs. A value one step hands a later one is held here, between
|
|
9835
9908
|
// them; a step that returns a result ends the run with it. A failure in any step ends through run-failed.mjs.
|
|
@@ -9932,7 +10005,7 @@ async function pipelineInner(job, opts = {}) {
|
|
|
9932
10005
|
} },
|
|
9933
10006
|
{ name: "overview-and-cards", run: async () => {
|
|
9934
10007
|
// The report's overview and its cards (steps/overview-and-cards.mjs).
|
|
9935
|
-
({ applyRatedUnderFrontMatter, applyScopeFrontMatter, applyVerdictFrontMatter, assembledOrdinals, byRight, cardOrdinals, findingsForCards, groupedMembers, overviewOpen, rebuildTheDeliveredRecord, restoreTheBrokenRecord, rov, writeScopeFacts, writeUps } = await runOverviewAndCards({ P, applyCoverageFloor, clampOnTheWritersDuty, ctx, followTheRecordsActions, job, run, runState, saveTheLabel, writeVerdictSidecar }, { StageFailure, applyScopeFrontMatterOf, asPartNotCompleted, assembleReportMd, caseLawJoin, consolidateFindingsFile, correctionsTheRestoreLacks, deriveCommonLawCarry, deriveRecordCarry, inScopeClassList, injectDeferralCoverage, injectFrontMatter, injectLaneDepthCoverage, injectMeaningGapCoverage, injectScreenGateCoverage, injectScriptScopeCoverage, keepDeliveredRecordAsHistory, localLanguageStateOf, must, openAskForClosure, originRowsForReport, planWriteUps, readFindingsForReport, readReadingLog, rebuildDeliveredRecord, reportIdentityRecord, restoreTheRecordThatPassed, rewriteFromBeforeTheSeam, runBatched, safeReadJson, settleDerivedBases, stage, stampCoverageJudgmentRows, withdrawSupersededAudit, writeScopeFactsOf, writeShortEntries }));
|
|
10008
|
+
({ applyRatedUnderFrontMatter, applyScopeFrontMatter, applyVerdictFrontMatter, assembledOrdinals, byRight, cardOrdinals, findingsForCards, groupedMembers, overviewOpen, rebuildTheDeliveredRecord, restoreTheBrokenRecord, rov, writeScopeFacts, writeUps } = await runOverviewAndCards({ P, applyCoverageFloor, clampOnTheWritersDuty, ctx, followTheRecordsActions, job, run, runState, saveTheLabel, writeVerdictSidecar }, { StageFailure, applyScopeFrontMatterOf, asPartNotCompleted, assembleReportMd, caseLawJoin, consolidateFindingsFile, correctionsTheRestoreLacks, deriveCommonLawCarry, deriveRecordCarry, inScopeClassList, injectDeferralCoverage, injectFrontMatter, injectLaneDepthCoverage, injectMeaningGapCoverage, injectScreenGateCoverage, injectScriptScopeCoverage, injectUncoveredMarketCoverage, keepDeliveredRecordAsHistory, localLanguageStateOf, must, openAskForClosure, originRowsForReport, planWriteUps, readFindingsForReport, readReadingLog, rebuildDeliveredRecord, reportIdentityRecord, restoreTheRecordThatPassed, rewriteFromBeforeTheSeam, runBatched, safeReadJson, settleDerivedBases, stage, stampCoverageJudgmentRows, withdrawSupersededAudit, writeScopeFactsOf, writeShortEntries }));
|
|
9936
10009
|
} },
|
|
9937
10010
|
{ name: "delivery", run: async () => {
|
|
9938
10011
|
// The checks before delivery, their repairs, and the publish (steps/delivery.mjs).
|
|
@@ -10049,6 +10122,7 @@ export function writeScopeFactsOf(ctx, P, runDir) { // @internal
|
|
|
10049
10122
|
planExecution,
|
|
10050
10123
|
coverageRows: loadCoverageLedger(runDir).rows,
|
|
10051
10124
|
withheldQids: waitingFamilyStates(runDir, planExecution?.awaiting).withheld.map((f) => f.qid),
|
|
10125
|
+
markets: orderMarketsOf(ctx, plan),
|
|
10052
10126
|
});
|
|
10053
10127
|
facts.derived_from = Object.fromEntries([
|
|
10054
10128
|
["instructed_scope", P.instructedScope], ["register_plan", P.registerPlan],
|
|
@@ -10860,6 +10934,7 @@ function parseArgv(argv) {
|
|
|
10860
10934
|
"--experiment": "experiment", "--model": "model", "--instructions": "instructions",
|
|
10861
10935
|
"--label": "label", "--axis": "axis", "--dispatch-trigger": "dispatchTrigger", "--research": "research", "--records": "records" };
|
|
10862
10936
|
for (let i = 0; i < argv.length; i++) {
|
|
10937
|
+
if (argv[i] === "--help" || argv[i] === "-h") { o.help = true; continue; }
|
|
10863
10938
|
const key = flags[argv[i]];
|
|
10864
10939
|
if (!key) {
|
|
10865
10940
|
throw new Error(argv[i].startsWith("-")
|
|
@@ -11029,6 +11104,8 @@ export function resumeAdvice({ result = null, error = null, signal = null, jobPa
|
|
|
11029
11104
|
return lines;
|
|
11030
11105
|
}
|
|
11031
11106
|
|
|
11107
|
+
// What a reader who typed `clearotron run` is told; the developer usage below stays for `node driver/pipeline.mjs`.
|
|
11108
|
+
const RUN_USAGE = "usage: clearotron run --job <file.json> — runs one clearance from a job file. An example job is examples/job.euipo.json.";
|
|
11032
11109
|
const USAGE = "usage: node pipeline.mjs --job <file.json> [--agent <id>]\n" +
|
|
11033
11110
|
" [--resume <codename> [--from <stage>] [--records live|replay]]\n" +
|
|
11034
11111
|
" [--resume <codename> --experiment <stage> [--model <id>] [--instructions <text>] [--axis <axis>] [--label <text>] [--dispatch-trigger <t>] [--research live|replay]]\n" +
|
|
@@ -11076,7 +11153,15 @@ if (isEntrypoint(import.meta.url)) void (async () => {
|
|
|
11076
11153
|
let a;
|
|
11077
11154
|
try { a = parseArgv(process.argv.slice(2)); }
|
|
11078
11155
|
catch (e) { console.error(`error: ${e.message}`); console.error(USAGE); process.exit(2); }
|
|
11079
|
-
|
|
11156
|
+
const usage = process.env.CLEAROTRON_INVOKED_AS ? RUN_USAGE : USAGE; // reached through `clearotron run`, or directly
|
|
11157
|
+
// Reached through `clearotron run`, the help keeps the dispatcher's spend line, which it printed before this
|
|
11158
|
+
// program had a --help of its own.
|
|
11159
|
+
if (a.help) {
|
|
11160
|
+
console.log(usage);
|
|
11161
|
+
if (process.env.CLEAROTRON_INVOKED_AS) console.log("THIS SPENDS: hours of model time and real register calls. See INSTALL.md §5 and §6.");
|
|
11162
|
+
process.exit(0);
|
|
11163
|
+
}
|
|
11164
|
+
if (!a.job && !a.codename) { console.error(usage); process.exit(2); } // --resume alone rebuilds the job below
|
|
11080
11165
|
// composition guards
|
|
11081
11166
|
if (a.fromStage && !a.codename) { console.error("error: --from requires --resume <codename>"); process.exit(2); }
|
|
11082
11167
|
if (a.experiment && !a.codename) { console.error("error: --experiment requires --resume <codename>"); process.exit(2); }
|
|
@@ -160,9 +160,13 @@ export function credentialPathFor(env = process.env, home = null) {
|
|
|
160
160
|
* file, names it. That also covers an operator who set `PORTAL_LOCAL_CREDENTIAL` themselves, who had
|
|
161
161
|
* the same broken line and no demo in sight.
|
|
162
162
|
*/
|
|
163
|
-
export function passphraseResetCommand({ prefix = "", credentialPath = null, env = process.env, home = null } = {}) {
|
|
164
|
-
const base = `${prefix}clearotron passphrase --reset`;
|
|
163
|
+
export function passphraseResetCommand({ prefix = "", credentialPath = null, env = process.env, home = null, exists = existsSync } = {}) {
|
|
165
164
|
const path = credentialPath ?? env.PORTAL_LOCAL_CREDENTIAL ?? null;
|
|
165
|
+
// THE DEMO'S OWN PROGRAM, WHERE IT HAS ONE. A demo started through npx keeps a copy of the program in its
|
|
166
|
+
// base (shared/permanent-install.mjs), and a bare `clearotron` names no program that reader has on PATH.
|
|
167
|
+
const demoProgram = path && basename(path) === INSTALL_CREDENTIAL_FILE ? join(dirname(path), "program", "bin", "clearotron") : null;
|
|
168
|
+
const program = demoProgram && exists(demoProgram) ? (/\s/.test(demoProgram) ? `"${demoProgram}"` : demoProgram) : `${prefix}clearotron`;
|
|
169
|
+
const base = `${program} passphrase --reset`;
|
|
166
170
|
if (!path || path === credentialPathFor({}, home)) return base;
|
|
167
171
|
// AN INSTALL'S OWN FILE IS NAMED BY ITS INSTALL, the way `clearotron start` names it: `--base`, which the
|
|
168
172
|
// verb resolves through installCredential exactly as start does, and nothing at all for the default
|
package/driver/portal-report.mjs
CHANGED
|
@@ -197,6 +197,31 @@ const CHROME_RES = [
|
|
|
197
197
|
{ tag: "div", open: /<div class="[^"]*\bfab-stack\b[^"]*"[^>]*>/ },
|
|
198
198
|
];
|
|
199
199
|
|
|
200
|
+
// ── the chrome a renderer marks as its own ──────────────────────────────────────────────────────────
|
|
201
|
+
//
|
|
202
|
+
// Both renderers put `data-report-chrome` on the root of each piece of chrome the portal draws for itself:
|
|
203
|
+
// the sticky header on both reports, and the Knockout's floating theme toggle. A report rendered with the
|
|
204
|
+
// marker is stripped by it, element by element and balanced by its own tag, so a renamed class or a
|
|
205
|
+
// reshaped header no longer stops a strip without a sound. The attribute changes nothing a reader sees,
|
|
206
|
+
// and no stylesheet selects on it.
|
|
207
|
+
//
|
|
208
|
+
// THE CLASS RULES ABOVE STAY. Stored reports are served from their own bytes for as long as they are
|
|
209
|
+
// kept, and a report rendered before the marker carries only the classes. A class rule leaves only when
|
|
210
|
+
// no stored report matches it any more. On a marked report they find nothing left to remove.
|
|
211
|
+
const MARKED_CHROME_RE = /<([a-z]+)\b[^>]*\sdata-report-chrome\b[^>]*>/gi;
|
|
212
|
+
|
|
213
|
+
function stripMarkedChrome(html, onUnbalanced = () => {}) {
|
|
214
|
+
const tags = new Set([...html.matchAll(MARKED_CHROME_RE)].map((m) => m[1].toLowerCase()));
|
|
215
|
+
let out = html;
|
|
216
|
+
let removed = 0;
|
|
217
|
+
for (const tag of tags) {
|
|
218
|
+
const r = stripBalanced(out, new RegExp(`<${tag}\\b[^>]*\\sdata-report-chrome\\b[^>]*>`), tag, onUnbalanced);
|
|
219
|
+
out = r.html;
|
|
220
|
+
removed += r.removed;
|
|
221
|
+
}
|
|
222
|
+
return { html: out, removed };
|
|
223
|
+
}
|
|
224
|
+
|
|
200
225
|
// ── labelled internal tails: the MID-LINE form the element strip cannot see ──────────────────────────
|
|
201
226
|
//
|
|
202
227
|
// publish/parse.mjs is the authority on what `[internal] ` means: stripInternal({client:false}) labels
|
|
@@ -359,8 +384,8 @@ const MCP_HOST_RE = /https?:\/\/[A-Za-z0-9.-]+\/mcp/gi;
|
|
|
359
384
|
// The footer's "Rated under:" line — the ONE piece of engine scaffolding that is not element-shaped.
|
|
360
385
|
//
|
|
361
386
|
// It renders inline in the confidentiality footer as `<br>Rated under: <span class="mono">…</span>.` and
|
|
362
|
-
// carries the account key, the framework name and a profile content hash ("
|
|
363
|
-
// default framework · profile
|
|
387
|
+
// carries the account key, the framework name and a profile content hash ("Quillmere Labs (quillmere) · house
|
|
388
|
+
// default framework · profile 5e0c7d21a94f"). The hash is a fingerprint of an internal config file: it
|
|
364
389
|
// means nothing to a reader, identifies an internal artefact, and travels in a document designed to be
|
|
365
390
|
// forwarded. Same ruling as the blocks above; a different removal only because the markup gives nothing
|
|
366
391
|
// balanced to strip.
|
|
@@ -378,6 +403,12 @@ const RUN_UNDER_PROJECT_RE = /<br\s*\/?>Run under project:\s*<span class="mono">
|
|
|
378
403
|
|
|
379
404
|
const CONNECTOR_TOKEN_RE = /([?&])token=v1\.[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+(&)?/g;
|
|
380
405
|
|
|
406
|
+
// WHAT DRIFT LOOKS LIKE, read from the served document rather than from what the strips removed: any
|
|
407
|
+
// `<nav>` carrying a site-nav class, and any `token=` query value of the connector's dotted shape, in any
|
|
408
|
+
// version. Wider than the strips on purpose, so a renamed class or a new token version is still seen.
|
|
409
|
+
const navSurvived = (html) => /<nav\b[^>]*\bclass\s*=\s*["'][^"']*\bsite-?nav\b/i.test(html);
|
|
410
|
+
const tokenSurvived = (html) => /[?&]token=v\d+\.[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+/.test(html);
|
|
411
|
+
|
|
381
412
|
function dropConnectorToken(html) {
|
|
382
413
|
let dropped = 0;
|
|
383
414
|
// The separator arithmetic, which is the only fiddly part: a parameter is removed together with ONE
|
|
@@ -911,6 +942,7 @@ export function prepareReportForEmbed(html, { staff = false, poolRoot = null, fe
|
|
|
911
942
|
let out = nav.html;
|
|
912
943
|
const strippedNav = nav.removed;
|
|
913
944
|
|
|
945
|
+
out = stripMarkedChrome(out, note).html;
|
|
914
946
|
for (const { open, tag } of CHROME_RES) out = stripBalanced(out, open, tag, note).html;
|
|
915
947
|
|
|
916
948
|
// The baked connector credential comes out for EVERYONE, before the audience branch below decides
|
|
@@ -1118,17 +1150,16 @@ export function readReport(dir, { log = () => {}, staff = false, poolRoot = null
|
|
|
1118
1150
|
if (neutralised > 0) {
|
|
1119
1151
|
log(`report-embed: ${neutralised} cross-tenant link(s) survived the nav strip in ${dir} — nav markup may have drifted`);
|
|
1120
1152
|
}
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
|
|
1153
|
+
// THE TWO CANARIES SPEAK ONLY ON DRIFT. They used to log whenever nothing was stripped, and no renderer
|
|
1154
|
+
// writes a site nav or a connector token any more, so they logged on every current report and drift read
|
|
1155
|
+
// the same as normal. Now each looks at what is SERVED: a site nav or a token still in it means a report
|
|
1156
|
+
// carried one in a shape the strip no longer matches.
|
|
1157
|
+
if (navSurvived(html)) {
|
|
1158
|
+
log(`report-embed: a site nav survived the strip in ${dir} (stripped ${strippedNav}) — nav markup drifted`);
|
|
1125
1159
|
}
|
|
1126
|
-
if (
|
|
1127
|
-
//
|
|
1128
|
-
|
|
1129
|
-
// and this strip is now a no-op — which would put a bearer credential back into a served document with
|
|
1130
|
-
// nothing else to catch it. Said at INFO rather than asserted, because the benign case is real.
|
|
1131
|
-
log(`report-embed: no connector token found in ${dir} (fine on a pre-connector run; otherwise the renderer's URL shape moved)`);
|
|
1160
|
+
if (tokenSurvived(html)) {
|
|
1161
|
+
// A bearer credential in a served document, with nothing else to catch it.
|
|
1162
|
+
log(`report-embed: a connector token survived the strip in ${dir} (dropped ${tokensDropped}) — the renderer's URL shape moved`);
|
|
1132
1163
|
}
|
|
1133
1164
|
return html;
|
|
1134
1165
|
}
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
// the searches an account can order.
|
|
6
6
|
//
|
|
7
7
|
// One of the portal service's route groups, moved out of its dispatcher unchanged; makePortalService says how it asks them.
|
|
8
|
-
import { ADMINISTRATOR_CONTACT, ORGANISATION_NAME } from "../../shared/brand.mjs";
|
|
8
|
+
import { ADMINISTRATOR_CONTACT, ORGANISATION_NAME, BRAND } from "../../shared/brand.mjs";
|
|
9
9
|
import { browserCommand, installRoute } from "../../shared/invocation.mjs";
|
|
10
10
|
import { productIdentity } from "../../shared/product-identity.mjs";
|
|
11
11
|
import { assertPrincipal, principalView, seesEverything } from "../portal-access.mjs";
|
|
@@ -106,6 +106,9 @@ export async function meRoutes({ poolRoot, stopControl, demo, orderRefusal, load
|
|
|
106
106
|
return { status: 200, json: { email: principal.email, ...principalView(principal, grantsHere, accountNames),
|
|
107
107
|
accounts: principal.accounts, accountNames, accountFacts,
|
|
108
108
|
concurrentRuns: concurrentRunsCap(), brand: ORGANISATION_NAME, engineMode: meEngineMode, houseMarketplaces,
|
|
109
|
+
// WHAT THIS INSTALLATION CALLS ITSELF: the logo, the page title and the sentences that name the
|
|
110
|
+
// installation read it. Not `brand`, which is who OPERATES it and is null until somebody names one.
|
|
111
|
+
brandName: BRAND.name,
|
|
109
112
|
// WHERE A PERSON ASKS FOR A CHANGE TO THEIR SIGN-IN, beside the brand and read where it is read:
|
|
110
113
|
// an href Preferences links "Clearotron administrator" to, or null, and then the words are plain.
|
|
111
114
|
administratorContact: ADMINISTRATOR_CONTACT,
|
package/driver/portal-runs.mjs
CHANGED
|
@@ -184,16 +184,13 @@ export function scanAccountRuns({ poolRoot, workspaceRoot, account = null, gener
|
|
|
184
184
|
? meta.marks.filter((m) => m && typeof m.name === "string")
|
|
185
185
|
.map((m) => ({ name: m.name, band: m.band ?? null, tone: toneFor(m.band ?? null) }))
|
|
186
186
|
: [],
|
|
187
|
-
//
|
|
188
|
-
//
|
|
189
|
-
//
|
|
190
|
-
//
|
|
191
|
-
// 'report-data/1' — gating on `typeof === "number"` alone meant the native-render flag NEVER
|
|
192
|
-
// armed, even for runs with a report-data.json on disk (2026-07-29, filed during PR-9). The
|
|
193
|
-
// string form maps to its numeric version; a bare number is honoured; anything else is legacy.
|
|
187
|
+
// The data file's version: present ⇒ the run has a report-data.json beside its report; absent
|
|
188
|
+
// (null) ⇒ it has none. Both writers stamp a STRING: `report-data/clearance-1` or
|
|
189
|
+
// `report-data/knockout-1` since the two shapes were named, `report-data/1` on runs stored before
|
|
190
|
+
// that. Each maps to its number; a bare number is honoured; anything else is null.
|
|
194
191
|
reportSchema: typeof meta.reportSchema === "number" ? meta.reportSchema
|
|
195
|
-
: typeof meta.reportSchema === "string" && /^report-data\/(\d+)$/.test(meta.reportSchema)
|
|
196
|
-
? Number(meta.reportSchema
|
|
192
|
+
: typeof meta.reportSchema === "string" && /^report-data\/(?:(?:clearance|knockout)-)?(\d+)$/.test(meta.reportSchema)
|
|
193
|
+
? Number(/(\d+)$/.exec(meta.reportSchema)[1]) : null,
|
|
197
194
|
// `report` is the run-level link and it is NULL for a batch — there is no run-level document
|
|
198
195
|
// to open. `reports` is the list, one entry per name, and it is what a batch's row renders.
|
|
199
196
|
// A single-document run carries both, pointing at the same place, so nothing that reads
|
package/driver/profiles.mjs
CHANGED
|
@@ -414,10 +414,10 @@ export function normalizeDelivery(d) {
|
|
|
414
414
|
|
|
415
415
|
// delivery.template (Phase 1): a NAMED deliverable-template variant, validated against this closed registry.
|
|
416
416
|
// One variant exists today — "standard" (the current code-composed report); a profile that omits it gets the
|
|
417
|
-
// default.
|
|
418
|
-
//
|
|
419
|
-
// the field is a live consumer, not a dead knob
|
|
420
|
-
// hard-fails at load rather than silently rendering the default.
|
|
417
|
+
// default. A second format, when one is defined, is a SKIN the one renderer reads (its tokens, its section list,
|
|
418
|
+
// its string set), named here; never a second render branch chosen by this value. The publish path records the
|
|
419
|
+
// chosen name in meta.json, so the field is a live consumer, not a dead knob. Keeping it a closed enum means a
|
|
420
|
+
// typo'd template name hard-fails at load rather than silently rendering the default.
|
|
421
421
|
export const DEFAULT_DELIVERY_TEMPLATE = "standard";
|
|
422
422
|
export const KNOWN_DELIVERY_TEMPLATES = [DEFAULT_DELIVERY_TEMPLATE];
|
|
423
423
|
|
package/driver/publish/README.md
CHANGED
|
@@ -30,17 +30,17 @@ field. `publishReport()` writes the pool run dir from that document. `coverNoteO
|
|
|
30
30
|
note's options from the run's frozen files, for the document and for the delivery's email.
|
|
31
31
|
`knockout.mjs` is built the same way: `readKnockoutDocument()`, then `publishKnockout()`.
|
|
32
32
|
|
|
33
|
-
**`render.mjs`** — but read `../test/render-frozen.test.mjs` first. The
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
33
|
+
**`render.mjs`** — but read `../test/render-frozen.test.mjs` first. The four demo runs' report pages are
|
|
34
|
+
compared with a stored record, so a change to what a page prints, from this file, `templates/report.css` or
|
|
35
|
+
`../../shared/brand.mjs`, fails that test until it is re-stamped in the same commit. Republishing a run made
|
|
36
|
+
by another build is refused, so a delivered report keeps the page it was issued with.
|
|
37
37
|
|
|
38
38
|
## Files
|
|
39
39
|
|
|
40
40
|
| File | Role |
|
|
41
41
|
|---|---|
|
|
42
42
|
| `index.mjs` | `readClearanceDocument` and `publishReport` — the clearance publish step; also `regenIndex` (staff + per-customer pool indexes), the email composers, `coverNoteOptions` and `riskTier`/`TONE_TIER` |
|
|
43
|
-
| `render.mjs` | `report.md` + `findings.json` → `report.html`.
|
|
43
|
+
| `render.mjs` | `report.md` + `findings.json` → `report.html`. Its page is guarded — see above |
|
|
44
44
|
| `parse.mjs` | The presentation-agnostic `report.md` parse the clearance renderer and the audit workbook build from |
|
|
45
45
|
| `publish-inputs.mjs` | The closed table of run-side stores publish reads, and what an absent one means |
|
|
46
46
|
| `report-data.mjs` | `report-data.json` for a clearance run — the client cut by construction, pure (no IO) |
|
|
@@ -48,10 +48,12 @@ Editing it is a decision to argue for in the commit message; almost every visual
|
|
|
48
48
|
| `audit-from-spine.mjs` | Builds the `audit.md` contract from the spine's markdown tables — no LLM, count-guarded |
|
|
49
49
|
| `knockout.mjs` | The knockout publisher: `readKnockoutDocument`, then per-mark reports, its workbook, its cover note |
|
|
50
50
|
| `shell.mjs` | What publishing does whichever report it is: the run's pool folder and its writers, a part that fails without stopping the report, `meta.json` last with the index refresh, and the staff pages |
|
|
51
|
-
| `render-knockout.mjs` | The knockout report's HTML. A sibling of `render.mjs
|
|
51
|
+
| `render-knockout.mjs` | The knockout report's HTML. A sibling of `render.mjs`: it takes the demo banner and the served-models line from it |
|
|
52
|
+
| `page-shell.mjs` | The document both renderers wrap their page in: head, title, typefaces, favicon, theme script and the base, dark and print styles. Each renderer passes its own title, sheet and chrome address |
|
|
52
53
|
| `report-registry.mjs` | Template name → publisher, and `republishRun` |
|
|
53
54
|
| `archive-tags.mjs` | The pool's `archive-tags.json` visibility sidecar, and its single writer |
|
|
54
55
|
| `pool-admin.mjs` | Operator CLI over the pool: list, archive/unarchive, reassign, regen, republish |
|
|
55
56
|
| `regions.mjs` | The one country/jurisdiction naming source for every render surface |
|
|
56
57
|
| `profiles-page.mjs` | Generates the pool's `profiles.html` from `../profile-page.html` |
|
|
57
|
-
| `templates/report.css` | The report layout vocabulary, shared by both renderers
|
|
58
|
+
| `templates/report.css` | The report layout vocabulary, shared by both renderers |
|
|
59
|
+
| `templates/knockout.css` | The layout the knockout report adds on top of `report.css`, every selector `ko-`prefixed |
|
|
@@ -4,8 +4,8 @@
|
|
|
4
4
|
// email-conditions.mjs — the conditions the cover email carries in its "Only you can close these" box.
|
|
5
5
|
//
|
|
6
6
|
// The email composes its box from this list, and the delivery check reads the same list as the email's own action
|
|
7
|
-
// lines, so the two cannot differ. It lives beside the renderer rather than in it: render.mjs
|
|
8
|
-
// (render-frozen.test.mjs), and this reads it without changing it.
|
|
7
|
+
// lines, so the two cannot differ. It lives beside the renderer rather than in it: render.mjs was hash-frozen
|
|
8
|
+
// when this was written (render-frozen.test.mjs), and this reads it without changing it.
|
|
9
9
|
//
|
|
10
10
|
// The delivery check is HANDED the list, by the run and by the replay, rather than importing this: the check runs inside
|
|
11
11
|
// the tool servers too, and the renderer would bring the brand settings into every server's environment.
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
// SPDX-License-Identifier: AGPL-3.0-only
|
|
2
|
+
// Copyright 2026 Cordillera Sàrl. Additional terms under section 7 of the AGPL-3.0 apply — see ADDITIONAL-TERMS.md
|
|
3
|
+
// publish/evidence-words.mjs — how well a meter's value is evidenced, in the report's own words.
|
|
4
|
+
//
|
|
5
|
+
// A meter's evidence is its joined status (registry-fidelity.mjs joinEvidenceStatus stamps `_status` on each
|
|
6
|
+
// meter), said in four words. The report's meters and the audit workbook's driver cells both say it, and they
|
|
7
|
+
// say it from here, so the lawyer reads the same word for the same value in both. On Use no verification word
|
|
8
|
+
// is printed (2026-08-31): its receipt join cannot reach the use surface, so only "inferred" and "not checked"
|
|
9
|
+
// are said there. Under Similarity no evidence word is printed at all (2026-11-18).
|
|
10
|
+
export const EVIDENCE_LABEL = Object.freeze({ confirmed: 'verified', assumed: 'not yet verified', inferred: 'inferred', 'not-checked': 'not checked' });
|
|
11
|
+
export const EVIDENCE_BASIS_LABEL = Object.freeze({ 'verified-from-record': 'verified', 'inferred-from-signal': 'inferred' });
|
|
12
|
+
export const USE_EVIDENCE_LABEL = Object.freeze({ inferred: 'inferred', 'not-checked': 'not checked' });
|
|
13
|
+
|
|
14
|
+
/** The evidence word for one meter, as the report prints it, or '' where it prints none. */
|
|
15
|
+
export function meterEvidence(name, entry) {
|
|
16
|
+
const e = entry || {};
|
|
17
|
+
if (name === 'mark_similarity') return '';
|
|
18
|
+
if (name === 'use') return USE_EVIDENCE_LABEL[e._status] || '';
|
|
19
|
+
// With a joined status the status replaces the raw basis word on the enforcer.
|
|
20
|
+
return EVIDENCE_LABEL[e._status] || (name === 'enforcer' ? EVIDENCE_BASIS_LABEL[e.basis] || '' : '');
|
|
21
|
+
}
|