ruvnet-brain 4.3.21 → 4.3.26

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (143) hide show
  1. package/README.md +5 -5
  2. package/bin/install.mjs +275 -60
  3. package/console/app.js +189 -9
  4. package/console/index.html +70 -24
  5. package/console/scope.css +137 -0
  6. package/console/scope.html +144 -0
  7. package/console/scope.js +209 -0
  8. package/console/style.css +26 -0
  9. package/console/tips.html +1 -0
  10. package/kb/corpus-release-identity.mjs +239 -0
  11. package/kb/update-storage-transaction.mjs +20 -3
  12. package/package.json +9 -2
  13. package/plugin/.claude-plugin/plugin.json +2 -2
  14. package/plugin/.codex-plugin/plugin.json +1 -1
  15. package/plugin/commands/checkpoint.md +61 -0
  16. package/plugin/hooks/codex-hooks.json +64 -1
  17. package/plugin/hooks/hook-contracts.json +299 -6
  18. package/plugin/hooks/hooks.json +81 -1
  19. package/plugin/mcp/server.mjs +23 -0
  20. package/plugin/scripts/advocacy-catalog.mjs +245 -0
  21. package/plugin/scripts/advocacy-route.mjs +460 -0
  22. package/plugin/scripts/continuation-gate.mjs +25 -2
  23. package/plugin/scripts/continuation-objective.mjs +7 -1
  24. package/plugin/scripts/continuity-hook-policy.mjs +190 -15
  25. package/plugin/scripts/coverage-integrity.mjs +7 -0
  26. package/plugin/scripts/gates.mjs +113 -10
  27. package/plugin/scripts/grounding-turn-gate.mjs +167 -0
  28. package/plugin/scripts/grounding-turn-mark.mjs +91 -0
  29. package/plugin/scripts/hook-shim.mjs +14 -0
  30. package/plugin/scripts/nightly-scheduler.mjs +37 -4
  31. package/plugin/scripts/project-progression-checkpoint.mjs +145 -0
  32. package/plugin/scripts/project-progression-contract.mjs +16 -0
  33. package/plugin/scripts/project-progression-hook.mjs +3 -0
  34. package/plugin/scripts/project-progression-producer.mjs +252 -0
  35. package/plugin/scripts/project-progression-reader.mjs +271 -0
  36. package/plugin/scripts/project-progression-session-start.mjs +93 -16
  37. package/plugin/scripts/project-progression-sources.mjs +220 -0
  38. package/plugin/scripts/project-progression-store.mjs +106 -13
  39. package/plugin/scripts/ruvnet-gate1-pattern.mjs +29 -0
  40. package/plugin/scripts/session-snapshot-hook.mjs +115 -7
  41. package/plugin/scripts/session-start-budget.mjs +59 -0
  42. package/plugin/scripts/session-start-core.mjs +234 -457
  43. package/plugin/scripts/session-start-fsutil.mjs +61 -0
  44. package/plugin/scripts/session-start-health.mjs +64 -0
  45. package/plugin/scripts/session-start-hook-description.mjs +45 -0
  46. package/plugin/scripts/session-start-issue-alert.mjs +77 -0
  47. package/plugin/scripts/session-start-repo-identity.mjs +54 -0
  48. package/plugin/scripts/session-start-signals.mjs +73 -0
  49. package/plugin/scripts/session-start-trace.mjs +86 -0
  50. package/plugin/scripts/session-start-update-plane.mjs +104 -0
  51. package/plugin/scripts/unprompted-runtime.mjs +32 -2
  52. package/plugin/skills/ruvnet-brain/PLAYBOOK.md +26 -2
  53. package/plugin/skills/ruvnet-brain/SKILL.md +67 -2
  54. package/scripts/adr-072-completion.mjs +1 -1
  55. package/scripts/agentdb-fleet-doctor.mjs +5 -1
  56. package/scripts/approved-runtime.mjs +197 -0
  57. package/scripts/brain-novice-50.mjs +16 -1
  58. package/scripts/brain-score.mjs +23 -5
  59. package/scripts/build-bundle.mjs +971 -530
  60. package/scripts/build-concepts.mjs +36 -116
  61. package/scripts/console-engine.test.mjs +8 -7
  62. package/scripts/console-runtime-identity.mjs +4 -0
  63. package/scripts/corpus-aggregates.mjs +94 -77
  64. package/scripts/corpus-candidate.mjs +475 -222
  65. package/scripts/corpus-next-seed.mjs +225 -0
  66. package/scripts/corpus-promotion.mjs +58 -0
  67. package/scripts/corpus-reconcile.mjs +411 -105
  68. package/scripts/doc-currency.mjs +16 -1
  69. package/scripts/dual-host-deliberation.mjs +25 -2
  70. package/scripts/dual-host-suggest.mjs +17 -1
  71. package/scripts/falsify.mjs +13 -3
  72. package/scripts/gist-receipts.mjs +482 -87
  73. package/scripts/github-health-watch.mjs +12 -2
  74. package/scripts/handoff-asset.mjs +34 -0
  75. package/scripts/hook-retirement-check.mjs +8 -1
  76. package/scripts/host-registry.mjs +1 -1
  77. package/scripts/ingest-gists.mjs +74 -101
  78. package/scripts/job-heartbeat.sh +77 -14
  79. package/scripts/learning-replay-execution.mjs +10 -4
  80. package/scripts/nightly-gists.sh +27 -13
  81. package/scripts/nightly-two-run-proof.mjs +1 -1
  82. package/scripts/nightly-watchdog.mjs +61 -4
  83. package/scripts/onboarding-console.mjs +364 -28
  84. package/scripts/oracle/produce-questions.mjs +293 -0
  85. package/scripts/oracle/producer-hosts.mjs +235 -0
  86. package/scripts/oracle/repo-recall.mjs +448 -0
  87. package/scripts/oracle/retrieval-accuracy.mjs +818 -0
  88. package/scripts/oracle/source-tree.mjs +165 -0
  89. package/scripts/oracle/source-units.mjs +391 -0
  90. package/scripts/oracle/spike-run.mjs +98 -0
  91. package/scripts/oracle/unit-inventory.mjs +141 -0
  92. package/scripts/oracle/unit-sampling.mjs +128 -0
  93. package/scripts/oracle/validate-labels.mjs +250 -0
  94. package/scripts/private-overlay.mjs +248 -0
  95. package/scripts/product-integrity-contract.mjs +1 -1
  96. package/scripts/proxy/claude-proxied.sh +6 -0
  97. package/scripts/proxy/proxy-revert.sh +5 -0
  98. package/scripts/proxy/proxy-up.sh +6 -0
  99. package/scripts/proxy/proxy-verify.mjs +4 -0
  100. package/scripts/public-inputs.mjs +409 -0
  101. package/scripts/public-verification-inputs.mjs +112 -26
  102. package/scripts/public-verification-lane.mjs +1 -1
  103. package/scripts/published-surface-probe.mjs +34 -4
  104. package/scripts/qe/card-lane-gate.mjs +16 -1
  105. package/scripts/qe/session-start-gate.mjs +16 -1
  106. package/scripts/rebuild-gists-from-receipts.mjs +58 -78
  107. package/scripts/record-lesson.mjs +4 -1
  108. package/scripts/rehearse-corpus-pipeline.mjs +994 -0
  109. package/scripts/release-abort-stale.mjs +5 -1
  110. package/scripts/release-authority.mjs +104 -12
  111. package/scripts/release-channel-kind.mjs +86 -0
  112. package/scripts/release-convergence-watchdog.mjs +7 -2
  113. package/scripts/release-projection.mjs +177 -72
  114. package/scripts/release-transaction-provider.mjs +47 -10
  115. package/scripts/release-transaction.mjs +40 -11
  116. package/scripts/release.mjs +252 -17
  117. package/scripts/retrieval-canary.mjs +87 -0
  118. package/scripts/rvf-index-audit.mjs +573 -13
  119. package/scripts/rvf-wire.mjs +269 -0
  120. package/scripts/seal-gist-receipt.mjs +65 -0
  121. package/scripts/selfcheck.mjs +42 -21
  122. package/scripts/source-coverage.mjs +253 -24
  123. package/scripts/status-honesty.mjs +25 -0
  124. package/scripts/sync-census.mjs +0 -0
  125. package/scripts/sync-version.mjs +2 -0
  126. package/scripts/trismart.mjs +42 -0
  127. package/scripts/updater-manifest.mjs +162 -0
  128. package/scripts/verify-channels.mjs +17 -5
  129. package/scripts/wired-check.mjs +48 -10
  130. package/tri-smart-skill/QUICKSTART.md +37 -0
  131. package/tri-smart-skill/README.md +92 -0
  132. package/tri-smart-skill/install.cmd +14 -0
  133. package/tri-smart-skill/install.command +13 -0
  134. package/tri-smart-skill/install.mjs +51 -0
  135. package/tri-smart-skill/install.sh +9 -0
  136. package/tri-smart-skill/tri-smart/SKILL.md +90 -0
  137. package/tri-smart-skill/tri-smart/evals/evals.json +25 -0
  138. package/tri-smart-skill/tri-smart/references/protocol.md +25 -0
  139. package/tri-smart-skill/tri-smart/references/provider-cli.md +18 -0
  140. package/tri-smart-skill/tri-smart/scripts/review.mjs +154 -0
  141. package/tri-smart-skill/tri-smart/scripts/setup.mjs +97 -0
  142. package/tri-smart-skill/tri-smart/scripts/verify-access.mjs +107 -0
  143. package/scripts/corpus-seed-publish.mjs +0 -110
@@ -169,6 +169,72 @@ export function validateRetrievalQueryEvidence(evidence) {
169
169
  return evidence;
170
170
  }
171
171
 
172
+ // An exemption is a RECORDED, EVIDENCED admission that one eligible store's upstream bytes cannot
173
+ // support a source-grounded question — never a bypass. It satisfies the inventory obligation only;
174
+ // buildRetrievalCanaryPlan still demands a row for every eligible store, so an exempted store must
175
+ // also leave the eligible corpus before a canary plan can be sealed. Recording one is a coverage
176
+ // policy decision that someone has to make in the open, which is the entire point.
177
+ export function validateOracleExemptions(exemptions) {
178
+ if (exemptions === null || exemptions === undefined) return [];
179
+ if (canonicalJson(Object.keys(exemptions || {}).sort()) !== canonicalJson(['exemptions', 'kind', 'schemaVersion'])
180
+ || exemptions.schemaVersion !== 1 || exemptions.kind !== 'ruvnet-brain-retrieval-oracle-exemptions'
181
+ || !Array.isArray(exemptions.exemptions)) {
182
+ throw new Error('retrieval oracle exemptions are malformed');
183
+ }
184
+ for (const row of exemptions.exemptions) {
185
+ if (canonicalJson(Object.keys(row || {}).sort()) !== canonicalJson(['evidencePaths', 'reason', 'store', 'upstreamSha'])
186
+ || typeof row.store !== 'string' || !/^[a-z0-9][a-z0-9._-]*$/.test(row.store)
187
+ || typeof row.reason !== 'string' || row.reason.trim().length < 24
188
+ || !HEX40.test(String(row.upstreamSha || ''))
189
+ || !Array.isArray(row.evidencePaths) || row.evidencePaths.length < 1
190
+ || row.evidencePaths.some((file) => typeof file !== 'string' || !file || path.isAbsolute(file)
191
+ || file.split(/[\\/]/).includes('..'))) {
192
+ throw new Error(`retrieval oracle exemption for ${row?.store || '(missing)'} is malformed`);
193
+ }
194
+ }
195
+ const stores = exemptions.exemptions.map((row) => row.store);
196
+ if (new Set(stores).size !== stores.length) throw new Error('retrieval oracle exemptions name a store twice');
197
+ return exemptions.exemptions;
198
+ }
199
+
200
+ // The cheap, standalone form of the denominator gate buildRetrievalCanaryPlan enforces at release
201
+ // time against a 567MB seed. Missing evidence is a FAILURE here, named store by store, seconds after
202
+ // a new repository lands in coverage — not six minutes into release-qe on a runner.
203
+ export function auditOracleCoverage({ coverage, queryEvidence, exemptions = null } = {}) {
204
+ const checked = validateCoverageLedger(coverage);
205
+ if (!checked.valid) throw new Error(`coverage ledger is invalid: ${checked.failures.join('; ')}`);
206
+ validateRetrievalQueryEvidence(queryEvidence);
207
+ const eligibleRows = coverage.rows.filter((row) => row.kind === 'repository'
208
+ && row.disposition === 'eligible' && row.status === 'CURRENT');
209
+ const eligible = ordered(eligibleRows.map(storeOf));
210
+ if (!eligible.length || new Set(eligible).size !== eligible.length || eligible.some((store) => !store)) {
211
+ throw new Error('eligible coverage denominator is invalid');
212
+ }
213
+ const oracle = new Set(Object.keys(queryEvidence.queries));
214
+ const exempted = validateOracleExemptions(exemptions);
215
+ const exemptStores = new Set(exempted.map((row) => row.store));
216
+ const uncovered = eligible.filter((store) => !oracle.has(store));
217
+ const missing = uncovered.filter((store) => !exemptStores.has(store));
218
+ const exempt = uncovered.filter((store) => exemptStores.has(store));
219
+ const extra = ordered([...oracle].filter((store) => !eligible.includes(store)));
220
+ const stale = ordered(exempted.map((row) => row.store).filter((store) => !uncovered.includes(store)));
221
+ const result = { eligible: eligible.length, covered: eligible.length - uncovered.length,
222
+ missing, exempt, extra, staleExemptions: stale };
223
+ if (missing.length) {
224
+ throw new Error(`independent retrieval oracle has no source-grounded row for ${missing.length} of `
225
+ + `${eligible.length} eligible stores: ${missing.join(', ')}`);
226
+ }
227
+ if (extra.length) {
228
+ throw new Error(`independent retrieval oracle covers ${extra.length} store(s) outside the eligible `
229
+ + `denominator: ${extra.join(', ')}`);
230
+ }
231
+ if (stale.length) {
232
+ throw new Error(`retrieval oracle exemption is stale for ${stale.join(', ')}; the store is covered `
233
+ + 'or no longer eligible, so the recorded admission must be removed');
234
+ }
235
+ return result;
236
+ }
237
+
172
238
  export function verifyQueryOracleSource(queryEvidence, candidateSourceSha, {
173
239
  cwd = process.cwd(), run = spawnSync, allowSquashedSource = false,
174
240
  } = {}) {
@@ -600,13 +666,34 @@ export function buildPlanFromFiles({ coverageFile, baselineFile, candidateFile,
600
666
  return plan;
601
667
  }
602
668
 
669
+ export function auditOracleCoverageFromFiles({ coverageFile, oracleFile, exemptionsFile = null,
670
+ candidateSourceSha = null, cwd = process.cwd() }) {
671
+ const coverage = JSON.parse(fs.readFileSync(regular(coverageFile, 'coverage'), 'utf8'));
672
+ const queryEvidence = JSON.parse(fs.readFileSync(regular(oracleFile, 'query oracle'), 'utf8'));
673
+ const exemptions = exemptionsFile
674
+ ? JSON.parse(fs.readFileSync(regular(exemptionsFile, 'oracle exemptions'), 'utf8')) : null;
675
+ const inventory = auditOracleCoverage({ coverage, queryEvidence, exemptions });
676
+ // The second half of step 7's proof: the oracle's own commit must be a strict ancestor of the
677
+ // candidate that consumes it, and its tracked bytes must be identical at both.
678
+ const strictAncestor = candidateSourceSha
679
+ ? Boolean(verifyQueryOracleSource(queryEvidence, candidateSourceSha, { cwd })) : null;
680
+ return { ...inventory, oracleSourceCommit: queryEvidence.sourceCommit, strictAncestor };
681
+ }
682
+
603
683
  if (process.argv[1] && path.resolve(process.argv[1]) === fileURLToPath(import.meta.url)) {
604
684
  try {
605
685
  const argv = process.argv.slice(2);
686
+ if (argv.includes('--audit')) {
687
+ const report = auditOracleCoverageFromFiles({ coverageFile: arg(argv, '--coverage'),
688
+ oracleFile: arg(argv, '--oracle'), exemptionsFile: arg(argv, '--exemptions'),
689
+ candidateSourceSha: arg(argv, '--candidate-sha'), cwd: arg(argv, '--repo') || process.cwd() });
690
+ console.log(JSON.stringify({ ok: true, ...report }));
691
+ } else {
606
692
  const plan = buildPlanFromFiles({ coverageFile: arg(argv, '--coverage'), baselineFile: arg(argv, '--baseline'),
607
693
  candidateFile: arg(argv, '--candidate'), oracleFile: arg(argv, '--oracle'), assetsDir: arg(argv, '--assets'),
608
694
  outFile: arg(argv, '--out'), cwd: arg(argv, '--repo') || process.cwd() });
609
695
  console.log(JSON.stringify({ ok: true, planSha256: plan.planSha256, cases: plan.cases.length }));
696
+ }
610
697
  } catch (error) {
611
698
  console.error(`[retrieval-canary] ${error.message}`);
612
699
  process.exitCode = 1;