@rightkit/release 0.6.38 → 0.6.39

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.
@@ -946,7 +946,12 @@ const plainRelative = (p) => typeof p === "string" && p !== "" && !path.posix.is
946
946
  * - An npm package scan (test:npm, tsc, eslint, biome) keys on the package's workspace closure (every dependency that is a workspace
947
947
  * package, whatever its spec, transitively, by package name) and the root npm inputs; test:scripts-ci on scripts/, ci/, .github/, packages/release and the
948
948
  * root install graph. Every other class B scan (generated-docs, swift-build) uses the whole tree.
949
- * - Class A: cargo-deny, cargo-audit, pnpm-audit, pnpm-lockfile and advisory-exceptions are never cached (live answers); rustfmt,
949
+ * - Class A: pnpm-lockfile and advisory-exceptions are never cached (live answers). cargo-deny, cargo-audit and pnpm-audit are cached by
950
+ * their inputs and the identity of the advisory data they read (rightkit#1464, ADR-001 C5; advisoryKey below): a Cargo workspace's lock
951
+ * blob, every Cargo.toml of the commit, the deny and cargo configuration files, and the pinned RustSec commit (cargo-deny and cargo-audit
952
+ * read exactly that commit); a pnpm root's lock, manifests and npm configuration. cargo-deny also reads the crate index (yanked
953
+ * versions) and pnpm audit asks the registry, neither of which a commit pins, so those keys carry the UTC day: a rerun the same day is a
954
+ * hit, the next day is a run. A changed pin, lock, manifest or configuration is a different key; rustfmt,
950
955
  * node-check, actionlint and the parse scans key on their files' blob ids; cargo-package-list on the crate, the manifest projection
951
956
  * and its lock entry; the rest on the whole tree.
952
957
  */
@@ -958,7 +963,15 @@ const LINT_CONFIG_NAMES = [...ESLINT_CONFIG_FILES, ...BIOME_CONFIG_FILES];
958
963
  // The gate's own test suite reads the CI scripts, the gate config and the release package it imports from.
959
964
  const SCRIPTS_CI_INPUTS = ["scripts", "ci", ".github", "packages/release", "package.json", "pnpm-lock.yaml"];
960
965
 
961
- export function buildCacheDigest({ objectId, headTree, rustUnits = [], npmUnits = [], cargoDir = ".", rustLock = null, rustLocks = null, crateFeatures = {}, listFiles = null, readBlob = null }) {
966
+ /** ci/shards.json `solo` (crate names that always get an invocation of their own), read from the gated tree; empty when the file is absent or unreadable. */
967
+ function shardSoloOf(o, repo) {
968
+ try {
969
+ const solo = JSON.parse(o.readFile(path.join(repo, "ci", "shards.json"))).solo;
970
+ return Array.isArray(solo) ? solo.filter((n) => typeof n === "string") : [];
971
+ } catch { return []; }
972
+ }
973
+
974
+ export function buildCacheDigest({ objectId, headTree, rustUnits = [], npmUnits = [], cargoDir = ".", rustLock = null, rustLocks = null, crateFeatures = {}, listFiles = null, readBlob = null, today = () => new Date().toISOString().slice(0, 10) }) {
962
975
  const memo = new Map(); const reachMemos = new Map(); const externalMemo = new Map();
963
976
  const idOf = (p) => { if (!memo.has(p)) memo.set(p, p === "." ? headTree : objectId(p)); return memo.get(p); };
964
977
  // npm: a package's test, tsc and eslint scans read the package, every workspace package it depends on (package.json
@@ -1026,6 +1039,28 @@ export function buildCacheDigest({ objectId, headTree, rustUnits = [], npmUnits
1026
1039
  // projection and its own lock entry; anything else (cargo metadata, licence, ownership catalog, secret scan) on the whole tree,
1027
1040
  // so it is reused for a rerun of the same commit and nothing else.
1028
1041
  const liveScan = (id) => /^(cargo-deny|cargo-audit|pnpm-audit|pnpm-lockfile|advisory-exceptions)(:|$)/.test(id);
1042
+ const ADVISORY_SCAN = /^(cargo-deny|cargo-audit|pnpm-audit)(:|$)/;
1043
+ // The key of an advisory scan (rightkit#1464), or null when an input cannot be identified (the scan then runs). Every input that decides the
1044
+ // verdict and is not in the scan's id, command or environment is here; the advisory database's commit (cargo) is in the scan's own environment
1045
+ // (RK_ADVISORY_DB_COMMIT) and its pin object, the gate's code and advisory-db.json are in the environment digest the caller appends.
1046
+ const advisoryKey = (scan) => {
1047
+ if (typeof listFiles !== "function") return null;
1048
+ const dir = typeof scan.cwd === "string" && scan.cwd !== "" ? scan.cwd : ".";
1049
+ const idsOf = (paths) => [...new Set(paths)].sort().map((p) => [p, idOf(p) ?? null]);
1050
+ const all = listFiles(".");
1051
+ if (/^pnpm-audit(:|$)/.test(scan.id)) {
1052
+ const lock = inWs(dir, "pnpm-lock.yaml");
1053
+ if (idOf(lock) === null || idOf(lock) === undefined) return null;
1054
+ const manifests = all.filter((f) => /(^|\/)package\.json$/.test(f) && (dir === "." || f === inWs(dir, "package.json") || f.startsWith(`${dir}/`)));
1055
+ return canonicalJson({ kind: "pnpm-audit", id: scan.id, day: today(), inputs: idsOf([lock, inWs(dir, "pnpm-workspace.yaml"), inWs(dir, ".npmrc"), ".npmrc", ...manifests]) });
1056
+ }
1057
+ const lock = inWs(dir, "Cargo.lock");
1058
+ if (idOf(lock) === null || idOf(lock) === undefined) return null;
1059
+ const ancestors = ancestorDirsOf(dir);
1060
+ const config = [dir, ...ancestors].flatMap((d) => [".cargo", "deny.toml", "audit.toml", "rust-toolchain", "rust-toolchain.toml"].map((f) => inWs(d, f)));
1061
+ const manifests = all.filter((f) => /(^|\/)Cargo\.toml$/.test(f));
1062
+ return canonicalJson({ kind: scan.id.startsWith("cargo-deny") ? "cargo-deny" : "cargo-audit", id: scan.id, day: today(), pin: scan.advisoryPin ?? null, inputs: idsOf([lock, ...manifests, ...config]) });
1063
+ };
1029
1064
  const fileList = (scan) => {
1030
1065
  if (Array.isArray(scan.files) && scan.files.length) return scan.files;
1031
1066
  const args = Array.isArray(scan.args) ? scan.args : [];
@@ -1036,8 +1071,9 @@ export function buildCacheDigest({ objectId, headTree, rustUnits = [], npmUnits
1036
1071
  };
1037
1072
  return (scan) => {
1038
1073
  if (scan.class === "A") {
1039
- if (liveScan(scan.id)) return null;
1074
+ if (liveScan(scan.id) && !ADVISORY_SCAN.test(scan.id)) return null;
1040
1075
  try {
1076
+ if (ADVISORY_SCAN.test(scan.id)) return advisoryKey(scan);
1041
1077
  const files = fileList(scan);
1042
1078
  if (files) return canonicalJson({ kind: "files", id: scan.id, files: [...new Set(files)].sort().map((p) => [p, idOf(p)]) });
1043
1079
  if (/^cargo-package-list:/.test(scan.id)) {
@@ -1055,9 +1091,11 @@ export function buildCacheDigest({ objectId, headTree, rustUnits = [], npmUnits
1055
1091
  }
1056
1092
  if (scan.class !== "B") return null;
1057
1093
  try {
1058
- // A batched Clippy scan (clippy:batch:*, planScans `clippyBatching`) is keyed on the inputs of every member it names: each member's
1059
- // own compile key, in member order. Any member that falls back to the whole tree makes the batch fall back too.
1060
- if (/^clippy:batch:/.test(String(scan.id)) && Array.isArray(scan.batch?.units) && scan.batch.units.length && scan.batch.units.every((n) => known.has(n))) {
1094
+ // A batched compile (clippy:batch:*, from planScans `clippyBatching` or runScans' class B batching, and check:batch:*) is keyed on the inputs of
1095
+ // every member it names: each member's own compile key, in member order, plus the batch's own id and command (its member list, target and
1096
+ // environment). Any member that falls back to the whole tree makes the batch fall back too. A changed member changes the key, so the
1097
+ // batch runs again as a whole (cargo is incremental); no member's result is ever taken from another invocation's.
1098
+ if (/^(?:clippy|check):batch:/.test(String(scan.id)) && Array.isArray(scan.batch?.units) && scan.batch.units.length && scan.batch.units.every((n) => known.has(n))) {
1061
1099
  const keys = scan.batch.units.map((n) => rustUnitKey(n, scan));
1062
1100
  return keys.includes(undefined) ? whole() : canonicalJson({ kind: "rust-batch", id: scan.id, units: scan.batch.units.map((n, i) => [n, keys[i]]) });
1063
1101
  }
@@ -1079,7 +1117,17 @@ export function buildCacheDigest({ objectId, headTree, rustUnits = [], npmUnits
1079
1117
  } catch { return null; }
1080
1118
  };
1081
1119
  // The cache key of one Rust unit's compile or test scan, or undefined when the scan must fall back to the whole tree.
1120
+ // A unit's key is a function of the unit, whether the scan is a test scan and the commit; it never names the scan, so the 5 to 10 scans of one
1121
+ // crate share one computation (B7: per-job prep, one git read of the manifest and one closure walk per scan before).
1122
+ const unitKeyMemo = new Map();
1082
1123
  function rustUnitKey(unit, scan) {
1124
+ const memoKey = `${unit}\0${/^test:rust(?:-serial)?:/.test(scan.id) ? "test" : "compile"}`;
1125
+ if (unitKeyMemo.has(memoKey)) return unitKeyMemo.get(memoKey);
1126
+ const keyed = rustUnitKeyOf(unit, scan);
1127
+ unitKeyMemo.set(memoKey, keyed);
1128
+ return keyed;
1129
+ }
1130
+ function rustUnitKeyOf(unit, scan) {
1083
1131
  const head = byName.get(unit);
1084
1132
  const ws = wsOf(head); const lock = lockFor(ws);
1085
1133
  if (!lock || typeof listFiles !== "function" || typeof readBlob !== "function") return undefined;
@@ -1588,8 +1636,8 @@ async function runStages(o, args, root, git, io) {
1588
1636
  const tierAtLeast = (have, need) => have === "release" || need === "compile";
1589
1637
  // GB-12 (GATE 36/44/86, E18): Class A admission runs at every stage boundary a door run crosses; an outer receipt boolean or an intact
1590
1638
  // sealed set never stands in for it. The deterministic scans reuse through their own complete result-cache key (never this receipt's
1591
- // coarse binding, which names the entry file only), and the live scans (cargo-deny, cargo-audit, pnpm-audit, pnpm-lockfile,
1592
- // advisory-exceptions) are never cached, so the day's advisories are re-asked on every reuse. The one exception is the trusted
1639
+ // coarse binding, which names the entry file only), and the live scans (pnpm-lockfile, advisory-exceptions) are never cached; cargo-deny, cargo-audit
1640
+ // and pnpm-audit are keyed on lock, configuration, advisory identity and the UTC day (GC-A19), and the door's `live-scans` refresh re-asks the registry. The one exception is the trusted
1593
1641
  // publisher's upload (`--to release` on a desktop platform): it runs no build environment, only uploads bytes whose earlier stages
1594
1642
  // (Class A included) another job of the same pipeline recorded in the receipt it imported (--receipt-in).
1595
1643
  const publisherUploadOnly = to === "release" && !mobile;
@@ -3631,8 +3679,11 @@ export async function main(argv, io = {}) {
3631
3679
  const pathKey = o.platform === "win32" ? (Object.keys(o.env).find((k) => k.toUpperCase() === "PATH") ?? "Path") : "PATH";
3632
3680
  const direct = directCargoPath({ env: { ...o.env, PATH: o.env[pathKey] }, exists: o.exists, platform: o.platform, gateWrappers: true });
3633
3681
  const readOpts = { cargoCommand: planCargoCommand, snapshotRoot: repo, directPath: direct.path, pathKey, tmpRoot: gateTmpRoot({ env: o.env, platform: o.platform, exists: o.exists }), env: o.env, err: o.err };
3634
- snapshotSpawn = directReadSpawn({ spawn: withDeclaredClient((c, a, opts) => o.spawn(c, a, opts)), ...readOpts });
3635
- scanSpawn = directReadSpawn({ spawn: withDeclaredClient(defaultSpawnAsync), ...readOpts });
3682
+ // One memo for the run (rightkit#1460): the unit discovery's `metadata --no-deps --locked` and the Class A `cargo-metadata` scan of the same
3683
+ // workspace are the same call on the same verified snapshot, so the scan reuses the discovery's result instead of running Cargo again.
3684
+ const readMemo = new Map();
3685
+ snapshotSpawn = directReadSpawn({ spawn: withDeclaredClient((c, a, opts) => o.spawn(c, a, opts)), ...readOpts, memo: readMemo });
3686
+ scanSpawn = directReadSpawn({ spawn: withDeclaredClient(defaultSpawnAsync), ...readOpts, memo: readMemo, isAsync: true });
3636
3687
  }
3637
3688
  npm = discoverNpmUnits({ root: repo, tracked, readFile: readSnap, exists: o.exists });
3638
3689
  npmRoots = discoverPnpmRoots({ root: repo, tracked, exists: o.exists });
@@ -3874,6 +3925,9 @@ export async function main(argv, io = {}) {
3874
3925
  quietTests: fullA || o.env.RK_GATE_QUIET_TESTS === "local" ? "local" : "ci", packageFeatures, liveExecution: (fullA && (args.includes("--worktree") || Boolean(snapshotA))) || Boolean(snapshotB),
3875
3926
  e2eCrateDirs, swiftPackages,
3876
3927
  rustUnits: rust.units, npmUnits: npm, npmRoots, cargoDir: ".", rustLocks, crateFeatures, crateDependents, externalInputs,
3928
+ // B1 (rightkit#1458): compile scans of one Cargo workspace run as one cargo invocation per configuration; ci/shards.json `solo` crates never join one.
3929
+ // Batching is opt-in (RK_GATE_CLASS_B_BATCH=1) until the batch-equivalence run (GATE-CONTRACT GC-I11) shows a batch passes exactly when each crate passes alone: one cargo call unifies the members' features.
3930
+ classBBatching: o.env.RK_GATE_CLASS_B_BATCH === "1", shardSolo: shardSoloOf(o, repo),
3877
3931
  // The broker (or, on a direct host, the gate itself) admits compiles; no separate grant file decides it here.
3878
3932
  localCompile: true,
3879
3933
  exists: o.exists, readFile: o.readFile, platform: o.platform,
@@ -4021,7 +4075,9 @@ export async function main(argv, io = {}) {
4021
4075
  // The verdict also depends on what is not in the tree: the gate's own code and advisory data, the node and pnpm that run
4022
4076
  // the checks, the installed dependencies (pnpm's install state) and the platform. Any change there is a cache miss.
4023
4077
  // Tool caches (vitest, tsc build info, ...) are left out: the scans write them themselves, so keying on them made every rerun miss.
4024
- const environment = classAEnvironmentDigest({ root: liveBase, gatePackage: o.gatePackage, files, spawn: o.spawn, includeCaches: false });
4078
+ // A6: the digest bound at the start of this run is this very computation (same root, gate package, files and tool-cache setting), so it is
4079
+ // reused: each call walks every installed dependency file, and the run made three of these walks before its first scan.
4080
+ const environment = envAtStart ?? classAEnvironmentDigest({ root: liveBase, gatePackage: o.gatePackage, files, spawn: o.spawn, includeCaches: false });
4025
4081
  const digest = buildCacheDigest({ objectId, headTree: digestOf(files), rustUnits: rust.units, npmUnits: npm, cargoDir: ".", rustLocks, crateFeatures, listFiles, readBlob });
4026
4082
  // A row's key is its own inputs plus the environment; the run's scope and scan set are not inputs of one row, and keying on them
4027
4083
  // missed every row whenever one file joined or left the plan. build-helpers is never reused: it reads the host's trace list,
@@ -4084,7 +4140,7 @@ export async function main(argv, io = {}) {
4084
4140
  directTiming.cargoStart = Date.now();
4085
4141
  census?.start();
4086
4142
  const scanResult = await (o.runScans ?? runScans)(plan, {
4087
- classes: classAOnly ? ["A"] : classAEarlier ? ["B"] : ["A", "B"], ...(classAEarlier ? { classAEarlier: true } : {}), jobs, testJobs, classBJobs, ...(brokerHost ? { brokerHost: true } : {}), ...(brokerLive ? { brokerLive } : {}), signal: ac.signal, ...(cache ? { cache } : {}),
4143
+ classes: classAOnly ? ["A"] : classAEarlier ? ["B"] : ["A", "B"], ...(classAEarlier ? { classAEarlier: true } : {}), jobs, testJobs, classBJobs, classBBatching: o.env.RK_GATE_CLASS_B_BATCH === "1", classBPipeline: Math.max(1, Number(o.env.RK_GATE_CLASS_B_PIPELINE ?? 2) || 2), ...(brokerHost ? { brokerHost: true } : {}), ...(brokerLive ? { brokerLive } : {}), signal: ac.signal, ...(cache ? { cache } : {}),
4088
4144
  ...(census ? { spawn: census.wrapSpawn(defaultSpawnAsync) } : {}),
4089
4145
  // The declared Linux broker route: the scans are planned with the logical `rustright`, which this spawn (and scanSpawn's pass-through below) starts as the
4090
4146
  // executor's validated client, never a PATH lookup (withDeclaredClient).
@@ -4122,7 +4178,7 @@ export async function main(argv, io = {}) {
4122
4178
  return path.join(base, "rightkit-gate-scan-logs", `${path.basename(root)}-${stamp}-${process.pid}`);
4123
4179
  } catch { return null; }
4124
4180
  })(),
4125
- onResult: (row, p) => o.out(`${tag} [${p.done}/${p.total}] ${(row.cached ? "cached" : row.status).padEnd(7)} ${row.id} (${p.seconds}s)${row.status === "fail" ? ` :: ${String(row.detail ?? "").slice(0, 300)}` : ""}`),
4181
+ onResult: (row, p) => o.out(`${tag} [${p.done}/${p.total}] ${(row.cached ? "cached" : row.status).padEnd(7)} ${row.id} (${p.seconds}s)${row.batchedWith ? ` [batch of ${row.batchedWith.units.length}]` : ""}${row.status === "fail" ? ` :: ${String(row.detail ?? "").slice(0, 300)}` : ""}`),
4126
4182
  });
4127
4183
  directTiming.cargoEnd = Date.now();
4128
4184
  const freshness = census ? census.finish() : null;
@@ -4208,7 +4264,7 @@ export async function main(argv, io = {}) {
4208
4264
  }
4209
4265
  const outputWorkspaces = (snapshotBroker ? scanResult.scans.map((r) => r.snapshotEvidence?.outputDir) : Object.values(targetDirs ?? {})).filter(Boolean).map((dir) => [dir]);
4210
4266
  o.onCompileOutputs?.(outputWorkspaces.map(([dir]) => dir), builtBins);
4211
- if (snapshotBroker) o.out(`${tag} broker compile: ${scanResult.scans.filter((r) => r.snapshotEvidence).length} carried request(s) with verified signed receipts; no direct receipt on a broker host`);
4267
+ if (snapshotBroker) o.out(`${tag} broker compile: ${new Set(scanResult.scans.map((r) => r.snapshotEvidence?.requestId).filter(Boolean)).size} carried request(s) with verified signed receipts (${scanResult.scans.filter((r) => r.snapshotEvidence).length} scan row(s)); no direct receipt on a broker host`);
4212
4268
  else {
4213
4269
  // The direct host's own receipt (GATE-CONTRACT "Broker interface", row 7.18): the contract's returned-evidence names minus the
4214
4270
  // broker-only ones (admission, queue, reusedFrom): the run, the commit, the snapshot's tree at start and exit, the declared
@@ -938,6 +938,12 @@ export function planScans({
938
938
  // planner emits one scan per compatible batch and no per-crate Clippy scan for a crate that belongs to one (row 8.15).
939
939
  // `shardSolo` is ci/shards.json `solo`; `clippySeparate` maps a unit name to the reason equivalence found batching changed it.
940
940
  clippyBatching = false, shardSolo = [], clippySeparate = new Map(),
941
+ // Class B execution batching (B1, rightkit#1458): the compile scans (check, check-features, check-dependent, clippy, each cross target) of
942
+ // one Cargo workspace that differ only in their `-p <crate>` are marked `batchable`, and runScans runs each group as ONE cargo invocation
943
+ // (`-p a -p b ...`). Unlike clippyBatching above, ids, commands and the scan-set digest are unchanged: the plan still lists one scan per
944
+ // crate and configuration, so required ids (GC-A14's three targets, scan-receipt) and GC-T14 keys are untouched; only the run is shared.
945
+ // `shardSolo` and `clippySeparate` keep a crate out of every group, as they do for clippyBatching. Off unless the caller (rightkit-gate) asks.
946
+ classBBatching = false,
941
947
  } = {}) {
942
948
  if (!contentRoot) throw new TypeError("planScans: contentRoot is required");
943
949
  if (!Array.isArray(cargoCommand) || cargoCommand.length === 0 || !["rustright", "cargo"].includes(cargoCommand[0]) || cargoCommand.slice(1).some((a) => a !== "cargo")) {
@@ -1329,10 +1335,10 @@ export function planScans({
1329
1335
  const ws = wsOf(name); const crate = crateOf(name);
1330
1336
  // `cargo clippy --all-targets` type-checks exactly what `cargo check --all-targets` does: the default
1331
1337
  // check runs only when no clippy set covers default features.
1332
- if (defaultCheck) add({ id: rustScanId.check(name), class: B, ...cargoIn(ws, ...checkArgs(crate, { locked: true })) });
1333
- checkSets.forEach((set, i) => add({ id: rustScanId.checkFeatures(name, i), class: B, ...cargoIn(ws, ...checkArgs(crate, { features: set, locked: true })) }));
1338
+ if (defaultCheck) add({ id: rustScanId.check(name), class: B, batchUnit: name, ...cargoIn(ws, ...checkArgs(crate, { locked: true })) });
1339
+ checkSets.forEach((set, i) => add({ id: rustScanId.checkFeatures(name, i), class: B, batchUnit: name, ...cargoIn(ws, ...checkArgs(crate, { features: set, locked: true })) }));
1334
1340
  if (clippyBatching) lintSets.forEach((set) => clippyEntries.push({ name, crate, ws, set, count: lintSets.length, env: targetDirs?.[ws] ?? null }));
1335
- else lintSets.forEach((set, i) => add({ id: rustScanId.clippy(name, lintSets.length, i), class: B, ...cargoIn(ws, ...clippyArgs(crate, { features: set, locked: true })) }));
1341
+ else lintSets.forEach((set, i) => add({ id: rustScanId.clippy(name, lintSets.length, i), class: B, batchUnit: name, ...cargoIn(ws, ...clippyArgs(crate, { features: set, locked: true })) }));
1336
1342
  // The other two OS targets, every lint set, -D warnings, on every host (cross-targets.mjs; Adrian 2026-11-02/03, no skip). The zig C
1337
1343
  // toolchain must be provisioned (crossCcDir); without it the scan fails naming the fix, never skipped. On a broker host the broker must
1338
1344
  // admit the cross target and its CC_/CXX_/AR_ variables; a refusal there fails the scan.
@@ -1342,7 +1348,7 @@ export function planScans({
1342
1348
  const id = `${rustScanId.clippy(name, lintSets.length, i)}@${target}`;
1343
1349
  if (!crossEnv) { add({ id, class: B, tool: "node", args: ["-e", `console.error("RK_CROSS_CC_UNPROVISIONED: the zig C toolchain for ${target} is not provisioned; run node scripts/ci/provision-zig.mjs <managed data root>/zig (or set RIGHTKIT_CROSS_CC_DIR)"); process.exit(1)`] }); return; }
1344
1350
  const scan = cargoIn(ws, ...clippyArgs(crate, { features: set, locked: true, target }));
1345
- add({ id, class: B, ...scan, env: { ...(scan.env ?? {}), ...crossEnv } });
1351
+ add({ id, class: B, batchUnit: name, ...scan, env: { ...(scan.env ?? {}), ...crossEnv } });
1346
1352
  });
1347
1353
  }
1348
1354
  // rustdoc flags go after `--` for this crate's library only: the broker owns RUSTDOCFLAGS and refuses
@@ -1369,13 +1375,13 @@ export function planScans({
1369
1375
  const scoped = crateNames.filter((n) => wsOf(n) === ws).map(crateOf);
1370
1376
  const workspace = (rustMap ? [...rustMap.keys()] : listDir(path.join(contentRoot, "crates"))).filter((n) => wsOf(n) === ws);
1371
1377
  const dependents = safeUnits(workspace.filter((n) => !inScope.has(n) && exists(path.join(contentRoot, rustDir(n), "Cargo.toml")) && scoped.some((t) => reach(lock, crateOf(n), memo).has(t))).sort(), "crate");
1372
- for (const name of dependents) { planned.add(name); add({ id: `check-dependent:${name}`, class: B, ...cargoIn(ws, ...checkArgs(crateOf(name), { locked: true })) }); }
1378
+ for (const name of dependents) { planned.add(name); add({ id: `check-dependent:${name}`, class: B, batchUnit: name, ...cargoIn(ws, ...checkArgs(crateOf(name), { locked: true })) }); }
1373
1379
  }
1374
1380
  // Across Cargo workspaces (one workspace and lock per crate): a unit that path-depends on a unit in scope, transitively, is judged by
1375
1381
  // the manifests' path dependencies, since no lock holds both.
1376
1382
  if (typeof crateDependents === "function" && rustMap && crateNames.length) {
1377
1383
  const across = [...crateDependents(new Set(crateNames))].filter((n) => !inScope.has(n) && !planned.has(n) && rustMap.has(n) && exists(path.join(contentRoot, rustDir(n), "Cargo.toml"))).sort();
1378
- for (const name of safeUnits(across, "crate")) add({ id: `check-dependent:${name}`, class: B, ...cargoIn(wsOf(name), ...checkArgs(crateOf(name), { locked: true })) });
1384
+ for (const name of safeUnits(across, "crate")) add({ id: `check-dependent:${name}`, class: B, batchUnit: name, ...cargoIn(wsOf(name), ...checkArgs(crateOf(name), { locked: true })) });
1379
1385
  }
1380
1386
  // A linter config in the unit's directory or any ancestor of it (a repository-level config covers every unit, as the tools look it up).
1381
1387
  const hasConfig = (dir, names) => ancestorDirsOf(dir).some((d) => names.some((f) => exists(path.join(liveRoot, inDir(d, f)))));
@@ -1591,6 +1597,35 @@ export function planScans({
1591
1597
  });
1592
1598
  if (deferred.length) notes.push(`deferred, not passed (no local compile grant): ${deferred.join(", ")}`);
1593
1599
  }
1600
+ // Class B execution batching (see classBBatching above). A scan is batchable only when it is a carried-or-direct cargo compile with exactly one
1601
+ // `-p <crate>`, names no crate-specific feature (`--features`: unifying them across crates changes what compiles; the same rule as
1602
+ // clippyBatchPlan's crate-specific feature sets), is not a solo, separate or sidecar-bound crate, and is not deferred. Its group key is the
1603
+ // scan with the `-p` pair removed (tool, directory, root, environment, remaining argv, and where the pair sat), so only identical
1604
+ // configurations of one workspace and target share an invocation. The plan carries no argv for the group: runScans rebuilds it from members.
1605
+ const batchNotes = new Map(); const groupCount = new Map();
1606
+ scans = scans.map((x) => {
1607
+ if (x.batchUnit === undefined) return x;
1608
+ const { batchUnit: unit, ...plain } = x;
1609
+ if (!classBBatching || x.deferred || !Array.isArray(x.args) || (x.tool !== "rustright" && x.tool !== "cargo")) return plain;
1610
+ const at = x.args.indexOf("-p");
1611
+ const crate = at >= 0 ? x.args[at + 1] : null;
1612
+ const rest = at >= 0 ? [...x.args.slice(0, at), ...x.args.slice(at + 2)] : [];
1613
+ let why = null;
1614
+ if (at < 0 || typeof crate !== "string" || x.args.indexOf("-p", at + 1) >= 0) why = "it does not name exactly one `-p <crate>`";
1615
+ else if (rest.some((w) => /^(?:--features(?:=.*)?|-F.*)$/.test(w))) why = "its feature set names crate-specific features";
1616
+ else if (shardSolo.includes(unit) || shardSolo.includes(crateOf(unit))) why = "ci/shards.json solo";
1617
+ else if (clippySeparate instanceof Map && clippySeparate.has(unit)) why = String(clippySeparate.get(unit));
1618
+ else if (sidecarBoundCrate({ dir: path.join(contentRoot, rustDir(unit)), exists, readFile }).bound) why = "sidecar-bound";
1619
+ if (why) { batchNotes.set(why, (batchNotes.get(why) ?? 0) + 1); return plain; }
1620
+ const key = sha256(canonicalJson({ tool: x.tool, cwd: x.cwd ?? ".", root: x.root, env: x.env, rest, at })).slice(0, 16);
1621
+ groupCount.set(key, (groupCount.get(key) ?? 0) + 1);
1622
+ return { ...plain, batchable: { key, at, crate, unit } };
1623
+ });
1624
+ if (groupCount.size) {
1625
+ const grouped = [...groupCount.values()].filter((n) => n > 1);
1626
+ notes.push(`class B batching: ${scans.filter((x) => x.batchable).length} compile scan(s) in ${groupCount.size} configuration group(s); each group of one Cargo workspace and target runs as one cargo invocation (${grouped.reduce((a, n) => a + n, 0)} scan(s) in ${grouped.length} shared group(s)), a failed group is bisected to the crate that fails, every row keeps its own id and command; the batch-equivalence run (GATE-CONTRACT GC-I11, item 8 row 8.7) has NOT been run, so a crate whose own features differ when unified with its group's can pass here and fail alone`);
1627
+ for (const [why, n] of batchNotes) notes.push(`class B batching: ${n} compile scan(s) stay their own invocation: ${why}`);
1628
+ }
1594
1629
  const ids = scans.map((s) => s.id);
1595
1630
  const dup = ids.find((id, i) => ids.indexOf(id) !== i);
1596
1631
  if (dup) throw new Error(`planScans: duplicate scan id ${dup}`);
@@ -2086,7 +2121,7 @@ export function classBChainKey(scan, carried) {
2086
2121
  * every chain started at once. A broker-carried scan starts without a count; the broker queues and orders it. A scan the broker never sees (an npm or node suite) holds one
2087
2122
  * of `localJobs` local slots while it runs. `run(index)` runs one scan and never rejects.
2088
2123
  */
2089
- export async function scheduleBrokerHostClassB({ scans, lanes, carried, localJobs, run }) {
2124
+ export async function scheduleBrokerHostClassB({ scans, lanes, carried, localJobs, run, pipeline = 1 }) {
2090
2125
  const chains = new Map();
2091
2126
  for (const lane of ["compile", "doc", "tests"]) {
2092
2127
  for (const i of lanes[lane] ?? []) { const key = classBChainKey(scans[i], carried(scans[i])); if (!chains.has(key)) chains.set(key, []); chains.get(key).push(i); }
@@ -2095,12 +2130,27 @@ export async function scheduleBrokerHostClassB({ scans, lanes, carried, localJob
2095
2130
  let held = 0; const waiters = [];
2096
2131
  const take = async () => { while (held >= limit) await new Promise((resolve) => waiters.push(resolve)); held += 1; };
2097
2132
  const free = () => { held -= 1; waiters.shift()?.(); };
2133
+ // B4 (rightkit#1458 audit): with `pipeline` 1 a chain runs one scan at a time, so the gate's work after one job (receipt read, signed-evidence
2134
+ // verification, ledger check) and before the next (cache key, request file) was dead time at the broker (about 10.6 s a job on the Dell). With
2135
+ // `pipeline` n, up to n carried scans of one chain are in flight: the next is submitted while the previous is still running or being verified, and the
2136
+ // broker (which owns ordering and holds one build per repository) queues it. Starts stay in plan order; a scan the broker never sees keeps its
2137
+ // local slot and runs alone, after the carried scans started before it have finished.
2138
+ const depth = Math.max(1, Number(pipeline) || 1);
2098
2139
  await Promise.all([...chains.values()].map(async (chain) => {
2140
+ const flight = new Set();
2099
2141
  for (const i of chain) {
2100
2142
  const local = !carried(scans[i]);
2101
- if (local) await take();
2102
- try { await run(i); } finally { if (local) free(); }
2143
+ if (local) {
2144
+ await Promise.all(flight);
2145
+ await take();
2146
+ try { await run(i); } finally { free(); }
2147
+ continue;
2148
+ }
2149
+ while (flight.size >= depth) await Promise.race(flight);
2150
+ const job = run(i).finally(() => flight.delete(job));
2151
+ flight.add(job);
2103
2152
  }
2153
+ await Promise.all(flight);
2104
2154
  }));
2105
2155
  }
2106
2156
 
@@ -2630,6 +2680,57 @@ export async function runScans(plan, options = {}) {
2630
2680
  // broker queues and orders them. A scan the broker never sees (an npm or node test suite) is a process of this host: those keep the local limit.
2631
2681
  const bJobs = Math.max(1, Number(options.classBJobs ?? (brokerHost ? LOCAL_CLASS_B_JOBS : 1)) || 1);
2632
2682
  const failedRow = (i, error) => ({ id: bScans[i].id, class: bScans[i].class, command: bScans[i].command, tool: bScans[i].tool ?? null, toolVersion: null, status: "fail", code: "SCAN_ERROR", detail: String(error?.message ?? error) });
2683
+ // Class B batching (B1, rightkit#1458; planScans `classBBatching`). The compile scans of one Cargo workspace that differ only in their `-p <crate>`
2684
+ // are one group; a group of two or more runs as ONE cargo invocation naming every member (`-p a -p b ...`) and the invocation's verdict becomes each
2685
+ // member's row, under the member's own id and command (so required scan ids and the scan-set digest are what the plan said). The invocation is a scan
2686
+ // of its own for everything else: it takes its own cache entry (the gate keys it on every member's inputs, `check:batch:` / `clippy:batch:`), cargo
2687
+ // ledger token, signed broker receipt and run limit. A cargo failure (code EXIT: a compile diagnostic) is bisected, never reported for the group: each
2688
+ // half runs again as a smaller invocation, down to one crate, which runs as its own per-crate scan, so a failure always names the crate that fails and
2689
+ // the crates that pass still pass. Any other failure (a refused or unverified receipt, a timeout, a missing tool) is the group's and is not retried:
2690
+ // running it N times would repeat it N times. Equivalence caveat (GC-I11): one invocation unifies features across its crates, so a pass here is not
2691
+ // proof that every member passes alone; the plan notes say the equivalence run has not been done.
2692
+ const groupOf = new Map();
2693
+ if (options.classBBatching === true) {
2694
+ const byKey = new Map();
2695
+ bScans.forEach((s, i) => { if (s.batchable && !s.deferred && laneOf(s) === "compile") { if (!byKey.has(s.batchable.key)) byKey.set(s.batchable.key, []); byKey.get(s.batchable.key).push(i); } });
2696
+ for (const members of byKey.values()) if (members.length > 1) { const group = { members, promise: null }; for (const i of members) groupOf.set(i, group); }
2697
+ }
2698
+ const batchScanOf = (idx) => {
2699
+ const lead = bScans[idx[0]];
2700
+ const { batchable: _batchable, ...plain } = lead; void _batchable;
2701
+ const args = [...lead.args.slice(0, lead.batchable.at), ...idx.flatMap((i) => ["-p", bScans[i].batchable.crate]), ...lead.args.slice(lead.batchable.at + 2)];
2702
+ const units = idx.map((i) => bScans[i].batchable.unit);
2703
+ const id = `${/^clippy/.test(lead.id) ? "clippy" : "check"}:batch:${sha256(`${lead.batchable.key}\0${units.join("\0")}`).slice(0, 8)}`;
2704
+ return { ...plain, id, args, command: commandText({ ...plain, args }), batch: { units, members: idx.map((i) => bScans[i].id) } };
2705
+ };
2706
+ const runGroup = async (idx, extraEnv) => {
2707
+ if (idx.length === 1) { const i = idx[0]; slots[i] = await runOne(bScans[i], extraEnv).catch((error) => failedRow(i, error)); return; }
2708
+ const started = Date.now();
2709
+ const bs = batchScanOf(idx);
2710
+ let row;
2711
+ try { row = await scanRow(bs, extraEnv); } catch (error) { row = { id: bs.id, status: "fail", code: "SCAN_ERROR", detail: String(error?.message ?? error) }; }
2712
+ if (row.status === "fail" && row.code === "EXIT" && !signal?.aborted) {
2713
+ const half = Math.ceil(idx.length / 2);
2714
+ await runGroup(idx.slice(0, half), extraEnv);
2715
+ await runGroup(idx.slice(half), extraEnv);
2716
+ return;
2717
+ }
2718
+ for (const i of idx) {
2719
+ const m = bScans[i];
2720
+ const own = { id: m.id, class: m.class, command: m.command, tool: m.tool ?? null, toolVersion: row.toolVersion ?? null, status: row.status, ...(row.code ? { code: row.code } : {}), ...(row.detail ? { detail: row.status === "fail" ? `${row.id} (${idx.length} crates: ${bs.batch.units.join(", ")}): ${row.detail}` : row.detail } : {}), ...(row.cached ? { cached: true } : {}), batchedWith: { id: row.id, units: bs.batch.units }, ...(row.snapshotEvidence ? { snapshotEvidence: row.snapshotEvidence } : {}), ...(row.identities ? { identities: row.identities } : {}), ...(row.log ? { log: row.log } : {}) };
2721
+ slots[i] = own; done += 1;
2722
+ try { onResult(own, { done, total, seconds: Math.round((Date.now() - started) / 1000) }); } catch { /* reporting never fails a scan */ }
2723
+ }
2724
+ };
2725
+ // The one entry both schedulers use: a scan outside every group runs as before; the first member of a group to start runs the whole group, and a later
2726
+ // member (same component, so it starts after) finds its row already in place.
2727
+ const runB = async (i, extraEnv = null) => {
2728
+ const group = groupOf.get(i);
2729
+ if (!group) return runOne(bScans[i], extraEnv);
2730
+ if (!group.promise) group.promise = runGroup(group.members, extraEnv);
2731
+ await group.promise;
2732
+ return slots[i] ?? failedRow(i, "its batched invocation produced no row");
2733
+ };
2633
2734
  const drain = async (queue, extraEnv = null) => {
2634
2735
  const busy = new Set(); const running = new Set();
2635
2736
  const keyOf = (i) => bScans[i].cwd ?? ".";
@@ -2638,7 +2739,7 @@ export async function runScans(plan, options = {}) {
2638
2739
  if (at === -1) { await Promise.race(running); continue; }
2639
2740
  const [i] = queue.splice(at, 1); const key = keyOf(i); busy.add(key);
2640
2741
  // A scan that throws becomes a failed row: with several components in flight, a rejection must not abandon the others.
2641
- const job = runOne(bScans[i], extraEnv)
2742
+ const job = runB(i, extraEnv)
2642
2743
  .catch((error) => failedRow(i, error))
2643
2744
  .then((row) => { slots[i] = row; }).finally(() => { busy.delete(key); running.delete(job); });
2644
2745
  running.add(job);
@@ -2646,8 +2747,8 @@ export async function runScans(plan, options = {}) {
2646
2747
  };
2647
2748
  if (brokerHost) {
2648
2749
  await scheduleBrokerHostClassB({
2649
- scans: bScans, lanes, localJobs: bJobs, carried: (scan) => isBrokerScheduledScan(scan, carriedCtx),
2650
- run: async (i) => { try { slots[i] = await runOne(bScans[i]); } catch (error) { slots[i] = failedRow(i, error); } },
2750
+ scans: bScans, lanes, localJobs: bJobs, carried: (scan) => isBrokerScheduledScan(scan, carriedCtx), pipeline: options.classBPipeline ?? 1,
2751
+ run: async (i) => { try { slots[i] = await runB(i); } catch (error) { slots[i] = failedRow(i, error); } },
2651
2752
  });
2652
2753
  } else {
2653
2754
  await drain(lanes.compile);
package/local-publish.mjs CHANGED
@@ -77,6 +77,31 @@ export class LocalPublishError extends Error {
77
77
  }
78
78
  const refuse = (message) => { throw new LocalPublishError(message); };
79
79
 
80
+ /** Lines of a failed step's output kept in its refusal: the tail, where test failures and the final errors are. */
81
+ export const STEP_FAILURE_LINES = 400;
82
+
83
+ /**
84
+ * A failed step's output as a refusal can carry it. cargo's `--message-format=json-render-diagnostics` stdout is mostly
85
+ * compiler-artifact and build-script records (megabytes for a large crate); embedded whole, the refusal was cut off as the
86
+ * process exited and the test failures after them never reached the log. Artifact, build-script and build-finished records are
87
+ * dropped, a compiler message keeps its rendered text, and only the last STEP_FAILURE_LINES lines are kept, with a count of
88
+ * what was cut.
89
+ */
90
+ export function stepFailureOutput(text, limit = STEP_FAILURE_LINES) {
91
+ const lines = [];
92
+ for (const line of String(text ?? "").split("\n")) {
93
+ if (line.startsWith("{\"reason\":")) {
94
+ let record;
95
+ try { record = JSON.parse(line); } catch { lines.push(line); continue; }
96
+ if (record.reason === "compiler-message" && typeof record.message?.rendered === "string") lines.push(...record.message.rendered.replace(/\n$/, "").split("\n"));
97
+ continue;
98
+ }
99
+ lines.push(line);
100
+ }
101
+ if (lines.length <= limit) return lines.join("\n");
102
+ return `[${lines.length - limit} earlier line(s) cut]\n${lines.slice(-limit).join("\n")}`;
103
+ }
104
+
80
105
  export const DEFAULT_CONCURRENCY = 4;
81
106
  const MAX_CONCURRENCY = 8;
82
107
  const CRATE_NAME = /^[a-z0-9]+(?:-[a-z0-9]+)*$/;
@@ -724,7 +749,7 @@ async function* publishUnitStages(parsed, deps, batch) {
724
749
  const row = { command: commandText, ok: false, isTest: step.test && TEST_COMMAND.test(commandText) };
725
750
  if (result.error || result.status !== 0) {
726
751
  steps.push(row);
727
- refuse(`${plan.id} step failed (${result.error?.message ?? `exit ${result.status}`}): ${commandText}\nstdout:\n${result.stdout ?? ""}\nstderr:\n${result.stderr ?? ""}`);
752
+ refuse(`${plan.id} step failed (${result.error?.message ?? `exit ${result.status}`}): ${commandText}\nstdout:\n${stepFailureOutput(result.stdout)}\nstderr:\n${stepFailureOutput(result.stderr)}`);
728
753
  }
729
754
  row.ok = true;
730
755
  // GATE-CONTRACT GC-A08: a broker compiles a `cargo test` and never runs it. Its reply names that; the executables its JSON listing
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rightkit/release",
3
- "version": "0.6.38",
3
+ "version": "0.6.39",
4
4
  "description": "Portable release CLI/SDK with fail-closed public GitHub Releases and private R2 + RightApps distribution.",
5
5
  "license": "MIT OR Apache-2.0",
6
6
  "type": "module",
@@ -1,7 +1,8 @@
1
1
  #!/usr/bin/env node
2
2
  // `right-release publish-local cargo --crate <name> --commit <sha> --compile-report <file>`: the local crates route (Adrian, 2026-11-03,
3
- // rightkit#1471: "the npm and crates are both local ... feel free to push but no ci"). The crates.io token is cargo's own, read by cargo's
4
- // credential provider from the OS store (Mac: `cargo:macos-keychain`); this command never reads it.
3
+ // rightkit#1471: "the npm and crates are both local ... feel free to push but no ci"). The crates.io token is cargo's own,
4
+ // stored by cargo's macOS Keychain provider; on the Mac this command reads it through /usr/bin/security and hands it to its one `cargo publish`
5
+ // call (cargo's own provider is admitted per program path, which the broker's pinned toolchain changes).
5
6
  //
6
7
  // It publishes exactly one commit's crate, and only when:
7
8
  // 1. the commit is on origin/main;
@@ -23,6 +24,11 @@ import { directCargoPath } from "./managed-cargo.mjs";
23
24
 
24
25
  export const UNIT_REPORT_SCHEMA = "rightkit.unit-gate-report/1";
25
26
 
27
+ /** The Keychain item cargo's macOS provider stores the crates.io token under. */
28
+ export const CARGO_KEYCHAIN_SERVICE = "cargo-registry:https://github.com/rust-lang/crates.io-index";
29
+ const KEYCHAIN_READ_MS = 60_000;
30
+ const PUBLISH_CALL_MS = 10 * 60_000;
31
+
26
32
  function fail(message) { throw new Error(message); }
27
33
 
28
34
  export function parseArgs(argv) {
@@ -115,8 +121,18 @@ export async function publishLocalCargo(argv, { run = spawnSync, log = console.l
115
121
  const sha256 = crypto.createHash("sha256").update(fs.readFileSync(crateFile)).digest("hex");
116
122
  log(`publish-local: packaged ${name}-${version}.crate sha256 ${sha256}`);
117
123
 
118
- const pub = run("cargo", ["publish", "--no-verify", "--locked", "--manifest-path", manifestPath, "--target-dir", targetDir], { encoding: "utf8", env: cargoEnv });
119
- if (pub.status !== 0) fail(`cargo publish failed: ${String(pub.stderr ?? "").trim().split(/\r?\n/).slice(-4).join(" | ")}`);
124
+ // Mac: cargo's own Keychain provider is admitted per program path, and the broker's pinned toolchain moves that path with every
125
+ // toolchain, so a background publish waited on an approval prompt nobody saw. The token is read here through /usr/bin/security (one
126
+ // fixed path, as the npm route reads its token), bounded so a refusal fails instead of hanging, and handed to this one cargo call only.
127
+ const publishEnv = { ...cargoEnv };
128
+ if (platform === "darwin") {
129
+ const read = run("/usr/bin/security", ["find-generic-password", "-s", CARGO_KEYCHAIN_SERVICE, "-w"], { encoding: "utf8", stdio: ["ignore", "pipe", "ignore"], timeout: KEYCHAIN_READ_MS });
130
+ const token = read.status === 0 ? String(read.stdout ?? "").trim() : "";
131
+ if (!token) fail(`the crates.io token could not be read from the Keychain item ${CARGO_KEYCHAIN_SERVICE} within ${KEYCHAIN_READ_MS / 1000} s (${read.error?.code === "ETIMEDOUT" ? "waiting for an access approval: allow /usr/bin/security on that item once in Keychain Access" : "missing or refused"})`);
132
+ Object.assign(publishEnv, { CARGO_REGISTRY_TOKEN: token, CARGO_REGISTRY_GLOBAL_CREDENTIAL_PROVIDERS: "cargo:token" });
133
+ }
134
+ const pub = run("cargo", ["publish", "--no-verify", "--locked", "--manifest-path", manifestPath, "--target-dir", targetDir], { encoding: "utf8", env: publishEnv, timeout: PUBLISH_CALL_MS });
135
+ if (pub.status !== 0) fail(`cargo publish failed${pub.error?.code === "ETIMEDOUT" ? ` (no answer within ${PUBLISH_CALL_MS / 60000} min)` : ""}: ${String(pub.stderr ?? "").trim().split(/\r?\n/).slice(-4).join(" | ")}`);
120
136
 
121
137
  let entry = null;
122
138
  for (let i = 0; i < 20 && !entry; i += 1) { entry = await indexEntry(name, version, fetchImpl); if (!entry) await sleep(15000); }
@@ -49,7 +49,7 @@
49
49
  "@rightkit/qa": "0.6.2",
50
50
  "@rightkit/qa-chrome": "0.1.12",
51
51
  "@rightkit/react-shell": "0.7.2",
52
- "@rightkit/release": "0.6.38",
52
+ "@rightkit/release": "0.6.39",
53
53
  "@rightkit/settings-ui": "0.7.0",
54
54
  "@rightkit/social-ui": "0.1.0",
55
55
  "@rightkit/system-ui": "0.1.0",
@@ -481,6 +481,7 @@
481
481
  "rightkit-adapt": "0.1.0",
482
482
  "rightkit-adapt-taste": "0.1.0",
483
483
  "rightkit-agent-demo": "0.1.0",
484
+ "rightkit-agent-engine": "0.1.0",
484
485
  "rightkit-agent-engine-api-integrations": "0.1.0",
485
486
  "rightkit-agent-engine-api-platform": "0.1.0",
486
487
  "rightkit-agent-engine-api-sessions": "0.1.0",
@@ -496,18 +497,21 @@
496
497
  "rightkit-agent-engine-storage": "0.1.0",
497
498
  "rightkit-agent-engine-tasks": "0.1.0",
498
499
  "rightkit-agent-gateway": "0.1.0",
499
- "rightkit-agent-host-traits": "0.1.0",
500
+ "rightkit-agent-host-traits": "0.1.1",
500
501
  "rightkit-agent-orchestration": "0.1.1",
501
502
  "rightkit-agent-orchestration-handoff": "0.1.0",
502
503
  "rightkit-agent-plugins": "0.1.0",
503
504
  "rightkit-agent-policy": "0.1.0",
504
505
  "rightkit-agent-recipes": "0.1.0",
506
+ "rightkit-agent-server": "0.1.0",
507
+ "rightkit-agent-skills": "0.1.0",
505
508
  "rightkit-agent-tools": "0.3.2",
506
509
  "rightkit-agent-transcript": "0.1.0",
507
- "rightkit-agents": "0.2.1",
510
+ "rightkit-agents": "0.2.2",
508
511
  "rightkit-ai-accounts": "0.1.0",
509
512
  "rightkit-android": "0.3.0",
510
513
  "rightkit-app-host": "0.1.0",
514
+ "rightkit-app-lock": "0.1.0",
511
515
  "rightkit-app-manager": "0.1.0",
512
516
  "rightkit-app-settings": "0.3.1",
513
517
  "rightkit-apple-ops": "0.1.1",
@@ -524,7 +528,11 @@
524
528
  "rightkit-channel-memory": "0.2.2",
525
529
  "rightkit-chat-bridge": "0.1.0",
526
530
  "rightkit-child-process": "0.5.7",
531
+ "rightkit-clipboard-history": "0.1.0",
532
+ "rightkit-code-audit-commands": "0.1.0",
533
+ "rightkit-code-audit-engine": "0.1.0",
527
534
  "rightkit-code-audit-provider-sdk": "0.1.0",
535
+ "rightkit-code-audit-qualification": "0.1.0",
528
536
  "rightkit-color": "0.1.0",
529
537
  "rightkit-compose": "0.2.2",
530
538
  "rightkit-compositor": "0.2.0",
@@ -542,16 +550,19 @@
542
550
  "rightkit-credentials": "0.4.4",
543
551
  "rightkit-crypto": "0.1.0",
544
552
  "rightkit-daemon": "0.5.1",
545
- "rightkit-db": "0.5.3",
553
+ "rightkit-db": "0.5.4",
554
+ "rightkit-desktop-tweaks": "0.1.0",
546
555
  "rightkit-device": "0.4.0",
547
556
  "rightkit-device-link-types": "0.1.0",
548
557
  "rightkit-dictation-app-runtime": "0.1.0",
549
558
  "rightkit-dictation-command-host": "0.1.0",
550
559
  "rightkit-dictation-core": "0.2.1",
551
560
  "rightkit-dictation-engine": "0.1.0",
561
+ "rightkit-dictation-ffi": "0.1.0",
552
562
  "rightkit-dictation-inference": "0.1.0",
553
563
  "rightkit-dictation-models": "0.1.0",
554
564
  "rightkit-dictation-runtime": "0.1.0",
565
+ "rightkit-dictation-tauri": "0.1.0",
555
566
  "rightkit-dictation-telemetry": "0.1.0",
556
567
  "rightkit-dictation-text-pipeline": "0.1.0",
557
568
  "rightkit-disk-cleanup": "0.1.0",
@@ -561,39 +572,44 @@
561
572
  "rightkit-embed": "0.6.2",
562
573
  "rightkit-engine-host": "0.1.1",
563
574
  "rightkit-evidence": "0.1.0",
575
+ "rightkit-evidence-application": "0.1.0",
576
+ "rightkit-evidence-commands": "0.1.0",
564
577
  "rightkit-evidence-contracts": "0.1.0",
565
578
  "rightkit-evidence-decisions": "0.1.0",
566
579
  "rightkit-evidence-effects": "0.1.0",
567
580
  "rightkit-evidence-governance": "0.1.0",
568
581
  "rightkit-evidence-report": "0.1.0",
569
- "rightkit-ffmpeg": "0.2.13",
582
+ "rightkit-ffmpeg": "0.2.14",
570
583
  "rightkit-file-watch": "0.4.2",
571
- "rightkit-fs": "0.4.9",
584
+ "rightkit-fs": "0.4.10",
572
585
  "rightkit-fsindex": "0.6.0",
573
586
  "rightkit-github": "0.1.1",
574
587
  "rightkit-google-apis": "0.1.0",
575
588
  "rightkit-google-identity": "0.2.0",
576
589
  "rightkit-hooks": "0.2.1",
577
590
  "rightkit-hotkeys": "0.1.2",
578
- "rightkit-http": "0.3.9",
591
+ "rightkit-http": "0.3.10",
579
592
  "rightkit-identity": "0.1.0",
580
593
  "rightkit-job-queue": "0.5.1",
594
+ "rightkit-launcher": "0.1.0",
581
595
  "rightkit-library": "0.1.1",
582
596
  "rightkit-license": "0.2.6",
583
597
  "rightkit-llm": "0.3.2",
584
598
  "rightkit-local-gen": "0.1.0",
585
599
  "rightkit-logs": "0.3.7",
586
600
  "rightkit-mail": "0.1.1",
601
+ "rightkit-mail-store": "0.1.0",
587
602
  "rightkit-mcp": "0.7.2",
588
603
  "rightkit-media-fetch": "0.1.1",
589
604
  "rightkit-media-gen": "0.1.0",
590
605
  "rightkit-media-pipeline": "0.1.0",
591
- "rightkit-memory": "0.1.0",
606
+ "rightkit-memory": "0.1.1",
592
607
  "rightkit-memory-core": "0.1.0",
593
608
  "rightkit-memory-store": "0.1.0",
594
609
  "rightkit-mesh": "0.1.1",
595
610
  "rightkit-models": "0.5.3",
596
611
  "rightkit-motion": "0.2.1",
612
+ "rightkit-notch-ui": "0.1.0",
597
613
  "rightkit-oauth": "0.10.0",
598
614
  "rightkit-ocr": "0.2.3",
599
615
  "rightkit-onnx": "0.2.9",
@@ -607,6 +623,7 @@
607
623
  "rightkit-playback": "0.3.0",
608
624
  "rightkit-policy-rules": "0.1.0",
609
625
  "rightkit-privileged-helper": "0.1.0",
626
+ "rightkit-prompt-recipes": "0.1.0",
610
627
  "rightkit-qa": "0.10.2",
611
628
  "rightkit-qa-driver": "0.7.0",
612
629
  "rightkit-record": "0.3.3",
@@ -616,7 +633,7 @@
616
633
  "rightkit-repo-graph": "0.1.0",
617
634
  "rightkit-repo-graph-grammars": "0.1.0",
618
635
  "rightkit-research": "0.1.1",
619
- "rightkit-review": "0.4.1",
636
+ "rightkit-review": "0.4.2",
620
637
  "rightkit-sandbox": "0.6.2",
621
638
  "rightkit-scheduler": "0.1.0",
622
639
  "rightkit-search": "0.4.1",
@@ -647,6 +664,7 @@
647
664
  "rightkit-voice-commands": "0.1.0",
648
665
  "rightkit-web-extract": "0.1.1",
649
666
  "rightkit-web-session": "0.1.0",
667
+ "rightkit-win-ui": "0.1.0",
650
668
  "rightkit-workflow": "0.2.1"
651
669
  },
652
670
  "swift": {
@@ -130,8 +130,14 @@ export function snapshotCargoSpawn({ spawn, carrySpawn = spawn, cargoCommand, sn
130
130
  * otherwise write target/.rustc_info.json beside the manifest and the snapshot would no longer be the commit's tree); the scratch is removed
131
131
  * when the call returns. Every other cargo call inside the snapshot is refused (a compile belongs to the broker); calls outside the snapshot
132
132
  * and every non-cargo command pass through to `spawn` unchanged. `spawn` may be synchronous or return a promise.
133
+ *
134
+ * `memo` (a Map the caller shares between the synchronous and the asynchronous spawn of one run; `isAsync` says which this one is) answers a
135
+ * repeated metadata call from the first one's result (rightkit#1460): the gate reads each workspace's `metadata --no-deps --locked` once to
136
+ * discover units and again as the Class A `cargo-metadata` scan, in the same verified snapshot, with the same toolchain and registry state, so the
137
+ * second run can only repeat the first. Only a successful call that streams to no file is kept (a failure is never replayed), keyed on the snapshot
138
+ * directory it ran in and its exact words; every other call (fetch, deny, audit, package, fmt) always runs.
133
139
  */
134
- export function directReadSpawn({ spawn, cargoCommand, snapshotRoot, directPath, pathKey = "PATH", tmpRoot, env, err = () => {} }) {
140
+ export function directReadSpawn({ spawn, cargoCommand, snapshotRoot, directPath, pathKey = "PATH", tmpRoot, env, err = () => {}, memo = null, isAsync = false }) {
135
141
  const prefix = cargoCommand.slice(1);
136
142
  const refused = (code, message) => { err(`rightkit-gate: ${code}: ${message}`); return { status: BROKER_REFUSAL_STATUS, signal: null, error: null, stdout: "", stderr: `rightkit-gate: ${code}: ${message}\n` }; };
137
143
  return (cmd, args, opts = {}) => {
@@ -140,6 +146,9 @@ export function directReadSpawn({ spawn, cargoCommand, snapshotRoot, directPath,
140
146
  const words = args.slice(prefix.length);
141
147
  const shape = carriedScanRefusal(words);
142
148
  if (shape !== null) return refused(CARRIED_METADATA_REFUSED, `\`cargo ${words.join(" ")}\` would run inside the managed snapshot ${snapshotRoot} and is not one of the read-only shapes Class A runs directly (GC-A11): ${shape}`);
149
+ const memoKey = memo && words[0] === "metadata" && opts.stdoutFile === undefined ? `${real(opts.cwd)}\0${words.join(" ")}` : null;
150
+ if (memoKey !== null && memo.has(memoKey)) { const hit = { ...memo.get(memoKey) }; return isAsync ? Promise.resolve(hit) : hit; }
151
+ const remember = (result) => { if (memoKey !== null && result && !result.error && result.status === 0 && typeof result.stdout === "string") memo.set(memoKey, { status: 0, signal: null, error: null, stdout: result.stdout, stderr: result.stderr ?? "" }); return result; };
143
152
  let scratch;
144
153
  try { fs.mkdirSync(tmpRoot, { recursive: true }); scratch = fs.mkdtempSync(path.join(tmpRoot, "rk-class-a-cargo-")); }
145
154
  catch (e) { return refused("RK_CLASS_A_SCRATCH", `cannot create a scratch target under ${tmpRoot}: ${e.message}`); }
@@ -148,8 +157,8 @@ export function directReadSpawn({ spawn, cargoCommand, snapshotRoot, directPath,
148
157
  let r;
149
158
  try { r = spawn("cargo", words, { ...opts, env: childEnv }); }
150
159
  catch (e) { cleanup(); throw e; }
151
- if (r && typeof r.then === "function") return r.finally(cleanup);
160
+ if (r && typeof r.then === "function") return r.then(remember).finally(cleanup);
152
161
  cleanup();
153
- return r;
162
+ return remember(r);
154
163
  };
155
164
  }