@outerlayer/cli 0.36.1-next.20261104161854 → 0.37.0-next.20261104191505

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 (181) hide show
  1. package/dist/agent-setup-DUE6IXPP.js +40 -0
  2. package/dist/{agent-subcommand-ASYEDGY2.js → agent-subcommand-C625JDSN.js} +4 -4
  3. package/dist/{artifact-link-cmd-ZPQXVG5O.js → artifact-link-cmd-72FQTBGO.js} +2 -2
  4. package/dist/{bridge-JYWNVBZW.js → bridge-UHNGV6DM.js} +7 -7
  5. package/dist/{build-G25G35OY.js → build-ALG3MYX2.js} +13 -13
  6. package/dist/{build-disk-LCBVNYLL.js → build-disk-JU2QHE64.js} +11 -11
  7. package/dist/build-info.json +1 -1
  8. package/dist/{builder-VV5Q3IOR.js → builder-4LK2FDCX.js} +10 -10
  9. package/dist/caller-JQC4VW36.js +23 -0
  10. package/dist/{check-3DBOM5UT.js → check-VOJWXIRZ.js} +55 -55
  11. package/dist/{chunk-WUKLQWGY.js → chunk-2JIGPSVF.js} +6 -3
  12. package/dist/{chunk-XGGXKR4M.js → chunk-2KFLMNQU.js} +1 -1
  13. package/dist/{chunk-FHKZZHM3.js → chunk-2LXO2YIW.js} +6 -6
  14. package/dist/{chunk-2CSXFU4A.js → chunk-2QFRAMJX.js} +1 -1
  15. package/dist/{chunk-G3JG75DP.js → chunk-3LT6REKE.js} +2 -2
  16. package/dist/{chunk-IHW5KZN7.js → chunk-3Z5GISKU.js} +42 -142
  17. package/dist/{chunk-ALPMGHDV.js → chunk-4U57GP2X.js} +2 -2
  18. package/dist/{chunk-SMT2K2AR.js → chunk-62RPMJXQ.js} +3 -3
  19. package/dist/{chunk-2BUZUDSH.js → chunk-6BS4DDCY.js} +8 -8
  20. package/dist/{chunk-MA4ZUS4A.js → chunk-6MWBZHBW.js} +1 -1
  21. package/dist/{chunk-ZDFZWQUF.js → chunk-6SC66WGJ.js} +94 -122
  22. package/dist/{chunk-DU2QDWHB.js → chunk-A75ZPAOP.js} +5 -5
  23. package/dist/{chunk-R6G7OGS6.js → chunk-DQZ7XFCI.js} +1 -1
  24. package/dist/{chunk-GXZTSNVW.js → chunk-E2DJ6TWB.js} +3 -3
  25. package/dist/{chunk-5Y7ZBX4U.js → chunk-EDEBGBPL.js} +4 -4
  26. package/dist/{chunk-ZOT3CD34.js → chunk-ERGU3OZP.js} +25 -25
  27. package/dist/{chunk-CQWXQDAZ.js → chunk-FBZE3LGM.js} +1 -1
  28. package/dist/{chunk-EKPSKSEJ.js → chunk-FV52S3JR.js} +2 -2
  29. package/dist/{chunk-TADKX7OA.js → chunk-FX4ZG4E5.js} +16 -16
  30. package/dist/{chunk-6C6WH6KL.js → chunk-FYPVUT27.js} +1 -1
  31. package/dist/{chunk-KNGCCNVO.js → chunk-G43WGW64.js} +4 -4
  32. package/dist/{chunk-ULFMR5UJ.js → chunk-G62P3EFL.js} +3 -3
  33. package/dist/{chunk-3Z5KIYBR.js → chunk-GBCQ3KHH.js} +3 -3
  34. package/dist/{chunk-A72Q4LSP.js → chunk-GF4O3M23.js} +1 -1
  35. package/dist/{chunk-PDBYH3V5.js → chunk-GQA54433.js} +2 -2
  36. package/dist/{chunk-IZKRPQIU.js → chunk-HN76DIHX.js} +7 -7
  37. package/dist/{chunk-C47K5UDL.js → chunk-HOTRWPVM.js} +4 -4
  38. package/dist/{chunk-TLVRBSOX.js → chunk-IHPJFMSV.js} +8 -8
  39. package/dist/{chunk-L2J7B7V6.js → chunk-IJU6DMQA.js} +1 -1
  40. package/dist/{chunk-EJ4MVQYZ.js → chunk-JAHR4LAD.js} +4 -4
  41. package/dist/{chunk-DOSM5H4B.js → chunk-JNGKTJ7L.js} +7 -7
  42. package/dist/{chunk-3TEZYUG6.js → chunk-JO2FOEZE.js} +4 -4
  43. package/dist/{chunk-R6CQLTRC.js → chunk-KCNL7KX2.js} +9 -9
  44. package/dist/{chunk-RFNETJEH.js → chunk-KSSHEWPV.js} +3 -3
  45. package/dist/{chunk-2A5LRRGL.js → chunk-L2PT4NRI.js} +1 -1
  46. package/dist/{chunk-ZV5QX3GK.js → chunk-LLZG5A2J.js} +9 -9
  47. package/dist/{chunk-QQVX4HUP.js → chunk-LNTZH3UL.js} +5 -5
  48. package/dist/{chunk-ULIDETYK.js → chunk-LUQWY7BX.js} +5 -5
  49. package/dist/{chunk-VB6ODZL2.js → chunk-LVZ3UV7T.js} +1 -1
  50. package/dist/{chunk-JXHN4E4Q.js → chunk-MITBH4LH.js} +3 -3
  51. package/dist/{chunk-UDX4B237.js → chunk-MZ2OOMOT.js} +1 -1
  52. package/dist/{chunk-4LA7E3HT.js → chunk-N3FPRSUZ.js} +6 -6
  53. package/dist/{chunk-UYCK4L43.js → chunk-NBGBMZE4.js} +1 -1
  54. package/dist/{chunk-4PGTFUTY.js → chunk-NSDQESOY.js} +1 -1
  55. package/dist/{chunk-NKQL3LHK.js → chunk-NSX2KF4L.js} +1 -1
  56. package/dist/{chunk-V6VMFAKC.js → chunk-OG6RJXQ3.js} +1 -1
  57. package/dist/{chunk-TYLXRXDY.js → chunk-OLZVQCDX.js} +1 -1
  58. package/dist/{chunk-S6AZPAUS.js → chunk-P3KL3ZJF.js} +1 -1
  59. package/dist/{chunk-UN6X7TYJ.js → chunk-P4YTEF6T.js} +1 -1
  60. package/dist/{chunk-K72IBKLA.js → chunk-PNZN656P.js} +1 -1
  61. package/dist/{chunk-FFJHFOFD.js → chunk-Q6FXWSN3.js} +7 -7
  62. package/dist/{chunk-HNKGBQFA.js → chunk-R2IPYS6A.js} +11 -11
  63. package/dist/{chunk-YATN35MN.js → chunk-RFCAK6OI.js} +7 -7
  64. package/dist/{chunk-KWOQTSSZ.js → chunk-RXWFZB3P.js} +1 -1
  65. package/dist/{chunk-Q7CXOTVR.js → chunk-SQWYFCEU.js} +3 -3
  66. package/dist/{chunk-R6SOMMDQ.js → chunk-TCWYLSE3.js} +1 -1
  67. package/dist/{chunk-MFVANFEJ.js → chunk-THL7WJ3F.js} +2 -2
  68. package/dist/{chunk-GBTHXD74.js → chunk-TSYTPW6Y.js} +161 -155
  69. package/dist/{chunk-KQSRABR6.js → chunk-UZNSGMUZ.js} +2 -2
  70. package/dist/{chunk-3NWBJVIL.js → chunk-VNMTA2JE.js} +3 -3
  71. package/dist/{chunk-PCIWQUBH.js → chunk-VTJ5MGGC.js} +6 -6
  72. package/dist/{chunk-KYFMMW65.js → chunk-VV3Y32EV.js} +1 -1
  73. package/dist/{chunk-F3T5QJ24.js → chunk-VVZIFOAN.js} +1 -1
  74. package/dist/{chunk-YMYYRYKE.js → chunk-W6GP4CNN.js} +7 -7
  75. package/dist/{chunk-RTPGEOBA.js → chunk-WCJCGFVQ.js} +1 -1
  76. package/dist/{chunk-RJTFSUZI.js → chunk-XGJXLITW.js} +6 -6
  77. package/dist/{chunk-GPVZFUTD.js → chunk-XMIUPI5N.js} +6 -6
  78. package/dist/{chunk-BCQDEM2N.js → chunk-YLJXRXPX.js} +1 -1
  79. package/dist/{chunk-A6RI6KTI.js → chunk-ZBPUHNUZ.js} +1 -1
  80. package/dist/{chunk-ZEM4IRBH.js → chunk-ZHOPDD7U.js} +5 -5
  81. package/dist/{chunk-FGA3EXGJ.js → chunk-ZQNYV4OZ.js} +1 -1
  82. package/dist/{chunk-3GHHGCNU.js → chunk-ZRITZJ36.js} +6 -6
  83. package/dist/{claude-launcher-WZPO6HPI.js → claude-launcher-HW5YVYWR.js} +7 -7
  84. package/dist/{cli-UPBWBSZK.js → cli-FFPFIMPZ.js} +148 -148
  85. package/dist/{command-FJIGATGO.js → command-MYYGFCW3.js} +50 -50
  86. package/dist/{config-2APX7UB2.js → config-CZJINZN5.js} +12 -12
  87. package/dist/{connect-cmd-NA6MMPXY.js → connect-cmd-4ZEF4WNR.js} +13 -13
  88. package/dist/{container-start-SUDA7O4K.js → container-start-ICNSSPBS.js} +48 -48
  89. package/dist/{context-cleanup-2PECPCE4.js → context-cleanup-7QZQJXID.js} +4 -4
  90. package/dist/{context-show-cmd-PCKELSP2.js → context-show-cmd-JYV7RKMC.js} +14 -14
  91. package/dist/{control-plane-launch-T33K3464.js → control-plane-launch-HLFLGLW6.js} +14 -14
  92. package/dist/{demo-record-cmd-6TY4YHDY.js → demo-record-cmd-MDPZD53Q.js} +8 -8
  93. package/dist/{demo-voice-cmd-LAYGJR4O.js → demo-voice-cmd-4JEXQP4I.js} +20 -20
  94. package/dist/{dist-P4VFDPWT.js → dist-NEH3H3EL.js} +2 -2
  95. package/dist/{docker-PS5OVPIF.js → docker-F4S3PBPD.js} +10 -10
  96. package/dist/{doctor-D6IRPOAQ.js → doctor-LEGPWSQ3.js} +50 -50
  97. package/dist/{emit-artifact-cmd-PQZZORYH.js → emit-artifact-cmd-QDYKKQT5.js} +19 -19
  98. package/dist/{emit-cmd-7JNFV35K.js → emit-cmd-ANJGKYSQ.js} +7 -7
  99. package/dist/{emit-criteria-cmd-HXP5RCRU.js → emit-criteria-cmd-OCLNKIL4.js} +16 -16
  100. package/dist/{emit-demo-cmd-7SGOM2YU.js → emit-demo-cmd-RO3OXK4U.js} +20 -20
  101. package/dist/{emit-finding-cmd-2LEHV4FK.js → emit-finding-cmd-M4OKFZPF.js} +16 -16
  102. package/dist/{emit-result-cmd-P4NAJ2CH.js → emit-result-cmd-CUTNYSOQ.js} +18 -18
  103. package/dist/{emit-step-cmd-K6HYSFGW.js → emit-step-cmd-SY54AQYM.js} +16 -16
  104. package/dist/{exec-client-GEN7MH5Q.js → exec-client-3ZVMZRZD.js} +8 -8
  105. package/dist/find-unit-5ALT2LU3.js +24 -0
  106. package/dist/{findings-cmd-KCDAXNUH.js → findings-cmd-246XYZSE.js} +16 -16
  107. package/dist/{fleet-readiness-OBHMDNEQ.js → fleet-readiness-SOSSKSII.js} +14 -14
  108. package/dist/{governing-source-4PJ6W6RY.js → governing-source-2UXHLXCS.js} +21 -21
  109. package/dist/{guest-init-XN7ZOOK5.js → guest-init-ZNSEHMXA.js} +9 -9
  110. package/dist/{hook-fast-J26JZG67.js → hook-fast-27GO6BM2.js} +1 -1
  111. package/dist/{hook-install-SVEA6RYI.js → hook-install-5OS6ZH4B.js} +4 -4
  112. package/dist/host-checks-VGJVO23Y.js +79 -0
  113. package/dist/host-key-ZRJ4CGFC.js +18 -0
  114. package/dist/{image-tag-MAWC5FC5.js → image-tag-WQB5HVLI.js} +8 -8
  115. package/dist/index.js +4 -4
  116. package/dist/{init-RTJUSLNZ.js → init-F3L4CTBJ.js} +46 -46
  117. package/dist/init-Z6ZVLUJ5.js +79 -0
  118. package/dist/{init-agent-ZQICLASB.js → init-agent-DO233UTF.js} +46 -46
  119. package/dist/{init-cmd-QCLXU6F3.js → init-cmd-AKIPYTNP.js} +27 -27
  120. package/dist/{init-update-4MNOI44P.js → init-update-BIHC42CB.js} +24 -24
  121. package/dist/{install-cmd-LTIF23I4.js → install-cmd-YMPTGHE4.js} +10 -10
  122. package/dist/{layout-J7NA2HJ3.js → layout-DBSSMC4R.js} +4 -4
  123. package/dist/{login-browser-NUQQYH5J.js → login-browser-AMCRDS5C.js} +2 -2
  124. package/dist/{logs-44SEY5AH.js → logs-HIXNEXBT.js} +7 -7
  125. package/dist/loop-MUPQOIW6.js +90 -0
  126. package/dist/machine-WFZ5KM76.js +79 -0
  127. package/dist/{machine-skills-UOF5X7OU.js → machine-skills-QEAB6375.js} +4 -4
  128. package/dist/{mcp-install-cmd-6CP7ODB4.js → mcp-install-cmd-ZL2TJUIK.js} +4 -4
  129. package/dist/{mcp-serve-cmd-QOPRMVCR.js → mcp-serve-cmd-4EGVZBCK.js} +9 -9
  130. package/dist/{paths-IMTP2VFJ.js → paths-AGOA7QX6.js} +7 -7
  131. package/dist/{pending-6LTQDPDQ.js → pending-625SL7WI.js} +8 -8
  132. package/dist/{pidfile-2FKC65BM.js → pidfile-H2DZIODT.js} +8 -8
  133. package/dist/{record-KD3622E7.js → record-UHMPQIUU.js} +8 -8
  134. package/dist/{relay-3RRPUZKH.js → relay-MS7QJ53J.js} +5 -5
  135. package/dist/{relay-protocol-ZFQ3QL76.js → relay-protocol-7LG6NHYA.js} +5 -5
  136. package/dist/{runner-agents-3A2SJEZ7.js → runner-agents-QJCL4MO3.js} +4 -4
  137. package/dist/runner-env-YPIZG3VG.js +24 -0
  138. package/dist/{runner-identity-6UUYHJVJ.js → runner-identity-RPRUONRJ.js} +10 -10
  139. package/dist/{runner-key-R5HMAPIW.js → runner-key-2SKLS37E.js} +46 -46
  140. package/dist/{session-sender-SOYN2W4Z.js → session-sender-B526LNJ6.js} +19 -19
  141. package/dist/{spec-cmd-HVQQ73ST.js → spec-cmd-6TZVHED2.js} +17 -17
  142. package/dist/{starter-pack-RI3RMOOM.js → starter-pack-6TS4PJYJ.js} +5 -5
  143. package/dist/state-ALHXVNOS.js +18 -0
  144. package/dist/{status-AGLJZQF2.js → status-WZCEHCL2.js} +46 -46
  145. package/dist/{sync-cmd-LGYH6DQH.js → sync-cmd-NMWPCIFU.js} +18 -18
  146. package/dist/update-steps-5BGDQTVG.js +80 -0
  147. package/dist/{watch-CHUOAXUM.js → watch-INJRAQRE.js} +18 -18
  148. package/dist/{work-claim-cmd-2LDQQYWT.js → work-claim-cmd-2IOJVHR5.js} +22 -22
  149. package/dist/{work-cmd-ALCIHXMP.js → work-cmd-6JUZHKXN.js} +16 -16
  150. package/dist/{work-comment-cmd-OSC5UISU.js → work-comment-cmd-KK7H6F67.js} +18 -18
  151. package/dist/{work-demo-cmd-EUQ733UV.js → work-demo-cmd-32PXKPZK.js} +16 -16
  152. package/dist/{work-logs-cmd-ILW6PUQT.js → work-logs-cmd-QYSBE2SP.js} +16 -16
  153. package/dist/{work-open-pr-cmd-6IZNKXUC.js → work-open-pr-cmd-PSATZ2BK.js} +17 -17
  154. package/dist/{work-pr-cmd-NC3L2W73.js → work-pr-cmd-BEYPR7TL.js} +16 -16
  155. package/dist/{work-proofs-cmd-24BTANI3.js → work-proofs-cmd-P33QGSIQ.js} +18 -18
  156. package/dist/{work-proofs-record-KGB7FN5R.js → work-proofs-record-FN6M7BIZ.js} +24 -24
  157. package/dist/{work-stop-cmd-C6TTKZW3.js → work-stop-cmd-MUSKJC5M.js} +16 -16
  158. package/package.json +1 -1
  159. package/skill-pack/maintained/outerlayer-amend/SKILL.md +1 -1
  160. package/skill-pack/maintained/outerlayer-build/SKILL.md +4 -6
  161. package/skill-pack/maintained/outerlayer-build/references/agent-briefs.md +13 -12
  162. package/skill-pack/maintained/outerlayer-build/references/criteria-judge.md +40 -36
  163. package/skill-pack/maintained/outerlayer-build/references/evidence.md +5 -7
  164. package/skill-pack/maintained/outerlayer-build/references/release.md +6 -4
  165. package/skill-pack/maintained/outerlayer-build/references/review-briefs.md +5 -5
  166. package/skill-pack/maintained/outerlayer-build/scripts/criterion-citations.mjs +44 -80
  167. package/skill-pack/maintained/outerlayer-cli/references/merge-base-branch.md +28 -11
  168. package/skill-pack/shipped.json +2 -0
  169. package/skill-pack/template/writing-tests/SKILL.md +6 -11
  170. package/skill-pack/validators/acceptance-criteria.yaml +11 -9
  171. package/dist/agent-setup-PBHLFTH5.js +0 -40
  172. package/dist/caller-GSOX6OEA.js +0 -23
  173. package/dist/find-unit-UCWO22YS.js +0 -24
  174. package/dist/host-checks-OLB3DXCU.js +0 -79
  175. package/dist/host-key-V6D7QGRX.js +0 -18
  176. package/dist/init-5LCIMEBR.js +0 -79
  177. package/dist/loop-7T33PKFZ.js +0 -90
  178. package/dist/machine-D7P4L63X.js +0 -79
  179. package/dist/runner-env-CDNYK5XI.js +0 -24
  180. package/dist/state-LBWBA36C.js +0 -18
  181. package/dist/update-steps-HN2DF4QW.js +0 -80
@@ -1,15 +1,15 @@
1
1
  #!/usr/bin/env node
2
2
  import { createRequire } from 'node:module';
3
- import { criteriaOf, loadCitationFinder, hostItemsOf, criterionInputs, NO_CITING_TEST_REASON, NO_TEST_FILES_REASON, NO_VERDICT_REASON, isFoundInReason, uncitedIds, planCriteria, pickSearchable, IdScan, testFileMatcher, foundInReason, MAX_TEST_FILE_BYTES, MAX_TEST_FILES, groupBySize } from './chunk-ZDFZWQUF.js';
4
- import { WorkCommandError, resolveCredentials, getJson } from './chunk-2BUZUDSH.js';
5
- import { sanitizeTerminal } from './chunk-F3T5QJ24.js';
3
+ import { criteriaOf, loadCitationFinder, testFileMatcher, hostItemsOf, NO_VERDICT_REASON } from './chunk-6SC66WGJ.js';
4
+ import { WorkCommandError, resolveCredentials, getJson } from './chunk-6BS4DDCY.js';
5
+ import { sanitizeTerminal } from './chunk-VVZIFOAN.js';
6
6
  import { C } from './chunk-2AM6Z5BP.js';
7
- import { defaultFetch } from './chunk-6C6WH6KL.js';
7
+ import { defaultFetch } from './chunk-FYPVUT27.js';
8
8
  import { parseWorkItemEnv } from './chunk-4OD45RBP.js';
9
9
  import { parseTrackerNumber, trackerNumberError } from './chunk-WZBHBH3J.js';
10
10
  import { readDeliveryRecord } from './chunk-YQR6E6OV.js';
11
- import { resolveRepoIdentity } from './chunk-FGA3EXGJ.js';
12
- import { inferArtifactKind, mediaTypeForArtifactPath, WORK_ITEM_COMMENT_MAX_BODY_LENGTH } from './chunk-WUKLQWGY.js';
11
+ import { resolveRepoIdentity } from './chunk-ZQNYV4OZ.js';
12
+ import { inferArtifactKind, mediaTypeForArtifactPath, WORK_ITEM_COMMENT_MAX_BODY_LENGTH } from './chunk-2JIGPSVF.js';
13
13
  import { createHash } from 'crypto';
14
14
  import { spawnSync } from 'child_process';
15
15
  import { existsSync, statSync, readFileSync } from 'fs';
@@ -49,147 +49,58 @@ function ownPullRequest(pullRequests, requested, checkoutRepository) {
49
49
  if (open.length > 1) return { ambiguous: open.map((pr) => pr.prNumber) };
50
50
  return { pr: open[0]?.prNumber };
51
51
  }
52
- var NO_BRIEF = "";
53
52
  var GITHUB_BLOB = /^https:\/\/github\.com\/[^/]+\/[^/]+\/blob\/([0-9a-f]{7,64})\//;
54
- function commitOf(refs) {
55
- for (const ref of refs) {
53
+ function commitOf(item) {
54
+ if (item.commit !== void 0) return item.commit;
55
+ for (const ref of item.refs ?? []) {
56
56
  const match = GITHUB_BLOB.exec(ref.href ?? "");
57
57
  if (match !== null) return match[1];
58
58
  }
59
59
  return void 0;
60
60
  }
61
61
  function unprovenCriteria(input) {
62
- const { criteria, finder } = input;
63
- const citations = finder.buildCitations({ ids: criteria.map((c) => c.id), files: [...input.headFiles], repository: null, sha: null });
64
- const headTexts = new Map(input.headFiles.map((file) => [file.path, file.contents]));
65
- const inputs = new Map(criteria.map((c) => [c.id, criterionInputs({ brief: NO_BRIEF, criterion: c, citations, testFiles: headTexts })]));
66
62
  const notes = [];
67
- const commits = /* @__PURE__ */ new Map();
68
- const previous = /* @__PURE__ */ new Map();
69
- const filesByCommit = /* @__PURE__ */ new Map();
70
- for (const item of input.items) {
71
- const criterion = criteria.find((c) => c.id === item.id);
72
- if (criterion === void 0 || item.result !== "fail" || item.inputs === void 0) continue;
73
- if (item.reason === NO_CITING_TEST_REASON || item.reason === NO_TEST_FILES_REASON || item.reason === NO_VERDICT_REASON) continue;
74
- if (item.refs === void 0 && isFoundInReason(item.reason, item.id)) continue;
75
- const commit = item.refs === void 0 ? void 0 : commitOf(item.refs);
76
- if (commit === void 0) {
77
- notes.push(`the links of ${item.id} name no commit`);
78
- continue;
79
- }
80
- if (!filesByCommit.has(commit)) filesByCommit.set(commit, input.testFilesAt(commit));
81
- const files = filesByCommit.get(commit);
82
- if (files === void 0) {
83
- notes.push(`this checkout does not hold ${item.id}'s cited tests at ${commit.slice(0, 7)}`);
63
+ const entries = [];
64
+ const changed = /* @__PURE__ */ new Map();
65
+ for (const criterion of input.criteria) {
66
+ if (criterion.proof !== null) continue;
67
+ const item = input.items.find((entry) => entry.id === criterion.id);
68
+ if (item === void 0 || item.result !== "fail" || item.reason === NO_VERDICT_REASON) continue;
69
+ const commit = commitOf(item);
70
+ if (commit === void 0) continue;
71
+ if (!changed.has(commit)) changed.set(commit, input.changedTestsSince(commit));
72
+ const since = changed.get(commit);
73
+ if (since === void 0) {
74
+ notes.push(`this checkout does not hold ${commit.slice(0, 7)}, where the judge failed ${item.id}`);
84
75
  continue;
85
76
  }
86
- const judgedCitations = finder.buildCitations({ ids: [item.id], files: [...files], repository: null, sha: null });
87
- const judged = new Map(files.map((file) => [file.path, file.contents]));
88
- commits.set(item.id, commit);
89
- previous.set(item.id, { ...item, inputs: criterionInputs({ brief: NO_BRIEF, criterion, citations: judgedCitations, testFiles: judged }) });
90
- }
91
- const uncited = uncitedIds(criteria, citations);
92
- const foundIn = uncited.length === 0 ? void 0 : input.foundOutsideTestsAt?.(uncited);
93
- if (uncited.length > 0 && input.foundOutsideTestsAt !== void 0 && foundIn === void 0) {
94
- notes.push("the files that could hold the id of a criterion no test cites cannot be read, so its row names none");
95
- }
96
- const plan = planCriteria({ criteria, citations, inputs, previous: [...previous.values()], noTestFiles: input.headFiles.length === 0 });
97
- const settled = new Map(plan.settled.map((item) => [item.id, item]));
98
- const entries = [];
99
- for (const criterion of criteria) {
100
- const item = settled.get(criterion.id);
101
- if (item === void 0 || item.result !== "fail") continue;
102
- if (item.refs === void 0) {
103
- const where = foundIn?.get(criterion.id);
104
- entries.push({ id: criterion.id, proof: null, state: "uncited", ...where !== void 0 ? { foundIn: where } : item.reason === NO_TEST_FILES_REASON ? { noTestFiles: true } : {} });
105
- } else entries.push({ id: criterion.id, proof: null, state: "failed", commit: commits.get(criterion.id) ?? "", reason: item.reason ?? "no reason recorded" });
77
+ if (since.length > 0) continue;
78
+ entries.push({ id: criterion.id, proof: null, state: "failed", commit, reason: item.reason ?? "no reason recorded" });
106
79
  }
107
80
  return { entries, notes };
108
81
  }
109
- function git(cwd, args, input) {
110
- const run = spawnSync("git", args, { cwd, input, maxBuffer: 268435456 });
82
+ function git(cwd, args) {
83
+ const run = spawnSync("git", args, { cwd, maxBuffer: 268435456 });
111
84
  if (run.status !== 0) throw new Error(`git ${args[0]} failed`);
112
85
  return run.stdout;
113
86
  }
114
- function treeAt(cwd, head) {
115
- const listing = git(cwd, ["ls-tree", "-r", "-l", "-z", "--full-tree", head]);
116
- const entries = [];
117
- for (const entry of listing.toString("utf8").split("\0")) {
118
- const match = /^(\d+) blob ([0-9a-f]+)\s+(\d+)\t(.*)$/s.exec(entry);
119
- if (match !== null && match[1].startsWith("100")) entries.push({ path: match[4], oid: match[2], size: Number(match[3]) });
120
- }
121
- return entries;
122
- }
123
- function readObjects(cwd, specs) {
124
- const out = git(cwd, ["cat-file", "--batch"], `${specs.join("\n")}
125
- `);
126
- const texts = [];
127
- let at = 0;
128
- for (let n = 0; n < specs.length; n += 1) {
129
- const end = out.indexOf(10, at);
130
- const header = out.subarray(at, end).toString("utf8");
131
- at = end + 1;
132
- const match = /^[0-9a-f]+ blob (\d+)$/.exec(header);
133
- if (match === null) {
134
- texts.push(void 0);
135
- continue;
136
- }
137
- const size = Number(match[1]);
138
- texts.push(out.subarray(at, at + size).toString("utf8"));
139
- at += size + 1;
140
- }
141
- return texts;
142
- }
143
- function readTexts(cwd, entries, visit) {
144
- for (const [start, end] of groupBySize(entries.map((entry) => entry.size))) {
145
- for (const [n, text] of readObjects(cwd, entries.slice(start, end).map((entry) => entry.oid)).entries()) {
146
- if (text !== void 0 && visit(start + n, text) === false) return;
147
- }
148
- }
149
- }
150
- function testFilesAt(cwd, head, isTest) {
151
- try {
152
- const picked = [];
153
- for (const entry of treeAt(cwd, head)) {
154
- if (entry.size > MAX_TEST_FILE_BYTES || !isTest(entry.path)) continue;
155
- if (picked.length >= MAX_TEST_FILES) break;
156
- picked.push(entry);
157
- }
158
- const files = [];
159
- readTexts(cwd, picked, (n, text) => {
160
- files.push({ path: picked[n].path, contents: text });
161
- });
162
- return files;
163
- } catch {
164
- return void 0;
165
- }
166
- }
167
- function findIdsOutsideTestsAt(cwd, head, input, limits) {
87
+ function proofsFileAt(cwd, commit) {
168
88
  try {
169
- const picked = pickSearchable(treeAt(cwd, head), input, limits);
170
- const scan = new IdScan(input.finder, input.ids);
171
- readTexts(cwd, picked, (n, text) => {
172
- scan.offer(picked[n].path, text);
173
- return !scan.complete;
174
- });
175
- return scan.result();
89
+ return git(cwd, ["show", `${commit}:.outerlayer-proofs.yaml`]).toString("utf8");
176
90
  } catch {
177
91
  return void 0;
178
92
  }
179
93
  }
180
- function proofsFileAt(cwd, commit) {
94
+ function changedTestsBetween(cwd, commit, head, isTest) {
181
95
  try {
182
- return git(cwd, ["show", `${commit}:.outerlayer-proofs.yaml`]).toString("utf8");
96
+ const listing = git(cwd, ["diff", "--name-only", "-z", "--no-renames", commit, head, "--"]).toString("utf8");
97
+ const atCommit = isTest.at(commit);
98
+ const atHead = isTest.at(head);
99
+ return listing.split("\0").filter((path) => path !== "" && (atCommit(path) || atHead(path)));
183
100
  } catch {
184
101
  return void 0;
185
102
  }
186
103
  }
187
- function matcherAt(cwd, commit, finder) {
188
- return testFileMatcher(finder, proofsFileAt(cwd, commit));
189
- }
190
- function testFilesOf(cwd, commit, finder) {
191
- return testFilesAt(cwd, commit, matcherAt(cwd, commit, finder));
192
- }
193
104
  function checkoutPlaces(cwd) {
194
105
  for (let dir = resolve(cwd); ; dir = dirname(dir)) {
195
106
  const dotGit = resolve(dir, ".git");
@@ -217,14 +128,14 @@ function governingDir(cwd) {
217
128
  async function testProofMode(cwd) {
218
129
  const dir = governingDir(cwd);
219
130
  if (dir === void 0) return "any";
220
- const { testProofIn } = await import('./host-checks-OLB3DXCU.js');
131
+ const { testProofIn } = await import('./host-checks-VGJVO23Y.js');
221
132
  return testProofIn(dir);
222
133
  }
223
134
  async function judgeCheckName(cwd) {
224
135
  const dir = governingDir(cwd);
225
136
  if (dir === void 0) return {};
226
137
  if (!existsSync(dir)) return { note: `the governed context at ${dir} is not readable` };
227
- const { checksIn, isJudgeCheck } = await import('./host-checks-OLB3DXCU.js');
138
+ const { checksIn, isJudgeCheck } = await import('./host-checks-VGJVO23Y.js');
228
139
  const quiet = { line: () => void 0, error: () => void 0 };
229
140
  const check = checksIn(dir, quiet, "").checks.find((c) => isJudgeCheck(c) && c.judge.subjects === "criteria");
230
141
  return check === void 0 ? {} : { name: check.name };
@@ -236,17 +147,13 @@ async function findUnproven(input) {
236
147
  const criteria = criteriaOf(input.item);
237
148
  if (criteria === void 0) return { entries: [], notes: [] };
238
149
  const finder = await loadCitationFinder();
239
- const headFiles = testFilesOf(input.cwd, input.head, finder);
240
- if (headFiles === void 0) return { entries: [], notes: [`the test files at ${input.head.slice(0, 7)} cannot be read`] };
150
+ const matchers = /* @__PURE__ */ new Map();
151
+ const at = (commit) => {
152
+ if (!matchers.has(commit)) matchers.set(commit, testFileMatcher(finder, proofsFileAt(input.cwd, commit)));
153
+ return matchers.get(commit);
154
+ };
241
155
  const items = hostItemsOf(input.item, found.name);
242
- const result = unprovenCriteria({
243
- criteria,
244
- finder,
245
- headFiles,
246
- items,
247
- testFilesAt: (commit) => testFilesOf(input.cwd, commit, finder),
248
- foundOutsideTestsAt: (ids) => findIdsOutsideTestsAt(input.cwd, input.head, { isTest: matcherAt(input.cwd, input.head, finder), isSearchable: finder.isSearchableFile, finder, ids })
249
- });
156
+ const result = unprovenCriteria({ criteria, items, changedTestsSince: (commit) => changedTestsBetween(input.cwd, commit, input.head, { at }) });
250
157
  const check = Object(input.item).checks?.find((c) => Object(c).name === found.name);
251
158
  if (check?.source === "host" && check.result === "fail" && items.length === 0) result.notes.unshift("the gateway returned no check items for the judge's result");
252
159
  return result;
@@ -298,15 +205,8 @@ function classifyProofsAt(data, heads, listing = {}) {
298
205
  var STATE_LABEL = { current: "current", "out-of-date": "out of date", missing: "missing" };
299
206
  function renderEntry(e) {
300
207
  const id = sanitizeTerminal(e.id);
301
- if (e.state === "uncited") {
302
- if (e.foundIn !== void 0) return `${id} none uncited ${sanitizeTerminal(foundInReason(e.id, e.foundIn))}`;
303
- if (e.noTestFiles === true) {
304
- return `${id} none uncited ${NO_TEST_FILES_REASON}`;
305
- }
306
- return `${id} none uncited No test at HEAD cites it. Put ${id} in a test's title or in a comment above the test, as in // proves ${id}`;
307
- }
308
208
  if (e.state === "failed") {
309
- return `${id} none failed ${sanitizeTerminal(e.commit)} The judge failed it: ${sanitizeTerminal(e.reason)} No test that cites it has changed since. Change a test that cites ${id}.`;
209
+ return `${id} none failed ${sanitizeTerminal(e.commit)} The judge failed it: ${sanitizeTerminal(e.reason)} No test file has changed since. Add or change a test that proves ${id}.`;
310
210
  }
311
211
  const row = `${id} ${sanitizeTerminal(e.proof)} ${STATE_LABEL[e.state]} ${sanitizeTerminal(e.commit ?? "no commit")}`;
312
212
  if (e.proof !== "test" || e.state === "current") return row;
@@ -369,7 +269,7 @@ async function runWorkProofs(opts) {
369
269
  async function runWorkProofsCommand(opts) {
370
270
  try {
371
271
  if (opts.record) {
372
- const { runWorkProofsRecord } = await import('./work-proofs-record-KGB7FN5R.js');
272
+ const { runWorkProofsRecord } = await import('./work-proofs-record-FN6M7BIZ.js');
373
273
  const result2 = await runWorkProofsRecord(opts);
374
274
  process.exitCode = result2.exitCode;
375
275
  return;
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  import { createRequire } from 'node:module';
3
- import { parseSize, BUILD_LABEL, RUNNER_LABEL, runnerLabelValue } from './chunk-HNKGBQFA.js';
4
- import { buildsDir, storeScopes, rootfsDir, orgStoreIn, runnerDir, imagesDir, builderCacheDiskPath } from './chunk-KWOQTSSZ.js';
3
+ import { parseSize, BUILD_LABEL, RUNNER_LABEL, runnerLabelValue } from './chunk-R2IPYS6A.js';
4
+ import { buildsDir, storeScopes, rootfsDir, orgStoreIn, runnerDir, imagesDir, builderCacheDiskPath } from './chunk-RXWFZB3P.js';
5
5
  import { spawnSync } from 'child_process';
6
6
  import { statfsSync, statSync, existsSync, readdirSync } from 'fs';
7
7
  import { dirname, join } from 'path';
@@ -1,9 +1,9 @@
1
1
  #!/usr/bin/env node
2
2
  import { createRequire } from 'node:module';
3
- import { launcherPath, pathNotes, writeLauncher, LauncherWriteError } from './chunk-BCQDEM2N.js';
4
- import { currentVersion, currentLink, versionDir, execStartLine, isInLayout, packageRootIn, switchCurrent } from './chunk-L2J7B7V6.js';
3
+ import { launcherPath, pathNotes, writeLauncher, LauncherWriteError } from './chunk-YLJXRXPX.js';
4
+ import { currentVersion, currentLink, versionDir, execStartLine, isInLayout, packageRootIn, switchCurrent } from './chunk-IJU6DMQA.js';
5
5
  import { compareVersions } from './chunk-TQMI335S.js';
6
- import { runnerDir, RUNNER_DIR_MODE } from './chunk-KWOQTSSZ.js';
6
+ import { runnerDir, RUNNER_DIR_MODE } from './chunk-RXWFZB3P.js';
7
7
  import { lchownSync, lstatSync, realpathSync, readFileSync, mkdirSync, rmSync, cpSync, existsSync, readdirSync } from 'fs';
8
8
  import { dirname, sep, join } from 'path';
9
9
  import { spawnSync } from 'child_process';
@@ -1,17 +1,17 @@
1
1
  #!/usr/bin/env node
2
2
  import { createRequire } from 'node:module';
3
- import { detectActiveSession } from './chunk-MA4ZUS4A.js';
4
- import { autoConnect } from './chunk-3Z5KIYBR.js';
5
- import { workPageUrl } from './chunk-RJTFSUZI.js';
6
- import { sanitizeTerminal } from './chunk-F3T5QJ24.js';
3
+ import { detectActiveSession } from './chunk-6MWBZHBW.js';
4
+ import { autoConnect } from './chunk-GBCQ3KHH.js';
5
+ import { workPageUrl } from './chunk-XGJXLITW.js';
6
+ import { sanitizeTerminal } from './chunk-VVZIFOAN.js';
7
7
  import { C } from './chunk-2AM6Z5BP.js';
8
- import { resolveGatewayCredentials, unauthorizedMessage, defaultFetch } from './chunk-6C6WH6KL.js';
9
- import { signRunnerRequest } from './chunk-UDX4B237.js';
8
+ import { resolveGatewayCredentials, unauthorizedMessage, defaultFetch } from './chunk-FYPVUT27.js';
9
+ import { signRunnerRequest } from './chunk-MZ2OOMOT.js';
10
10
  import { readRepoConnection } from './chunk-BJ3KTMDH.js';
11
11
  import { parseTrackerNumber, trackerNumberError } from './chunk-WZBHBH3J.js';
12
12
  import { NATIVE_AGENTS, LEGACY_AGENT } from './chunk-QJKW4MKH.js';
13
13
  import { homeFromEnv } from './chunk-352DHUTP.js';
14
- import { resolveRepoIdentity } from './chunk-FGA3EXGJ.js';
14
+ import { resolveRepoIdentity } from './chunk-ZQNYV4OZ.js';
15
15
 
16
16
  createRequire(import.meta.url);
17
17
 
@@ -486,7 +486,7 @@ async function runWorkLinkSession(opts) {
486
486
  return await linkSession(opts);
487
487
  } catch (err) {
488
488
  if (opts.logFailures) {
489
- const { logHookError } = await import('./hook-fast-J26JZG67.js');
489
+ const { logHookError } = await import('./hook-fast-27GO6BM2.js');
490
490
  const reason = err instanceof Error ? err.message : String(err);
491
491
  logHookError(opts.home ?? homeFromEnv(opts.env ?? process.env), new Error(`work link-session #${opts.number} failed: ${reason}`));
492
492
  }
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env node
2
2
  import { createRequire } from 'node:module';
3
- import { defaultAgents } from './chunk-KQSRABR6.js';
3
+ import { defaultAgents } from './chunk-UZNSGMUZ.js';
4
4
  import { openSync, fstatSync, readSync, closeSync } from 'fs';
5
5
  import { join } from 'path';
6
6
 
@@ -1,87 +1,94 @@
1
1
  #!/usr/bin/env node
2
2
  import { createRequire } from 'node:module';
3
- import { sanitizeTerminal } from './chunk-F3T5QJ24.js';
4
- import { resolvePackRoot, parseProofsConfig } from './chunk-KQSRABR6.js';
5
- import { CHECK_ITEM_REASON_MAX_LENGTH, CheckItemsSchema } from './chunk-WUKLQWGY.js';
3
+ import { sanitizeTerminal } from './chunk-VVZIFOAN.js';
4
+ import { resolvePackRoot, parseProofsConfig } from './chunk-UZNSGMUZ.js';
5
+ import { CHECK_ITEM_REASON_MAX_LENGTH, CheckItemsSchema, CHECK_ITEM_REFS_MAX, CHECK_ITEM_REF_PATH_MAX_LENGTH } from './chunk-2JIGPSVF.js';
6
6
  import { createHash } from 'crypto';
7
7
  import { join } from 'path';
8
8
  import { pathToFileURL } from 'url';
9
9
 
10
10
  createRequire(import.meta.url);
11
11
  var ARTIFACT_PROOF_REASON = "Its declared artifact proves it; the judge does not judge artifacts.";
12
- var NO_CITING_TEST_REASON = "No test cites this criterion, and it declares no artifact proof.";
13
- var NO_TEST_FILES_REASON = "No file at this commit is recognized as a test. Name the repository's test files with a runner glob in `.outerlayer-proofs.yaml`.";
12
+ var NO_NAMED_TEST_REASON = "The judge named no test file that proves this criterion.";
14
13
  var NO_VERDICT_REASON = "The judge gave no result for this criterion.";
15
- function foundInReason(id, paths) {
14
+ var JUDGE_GROUP_SIZE = 12;
15
+ function notReadAsTestReason(paths) {
16
16
  const named = paths.slice(0, 3).map((path2) => `\`${path2}\``);
17
- const list = paths.length > 3 ? `${named.join(", ")} and other files` : named.length === 1 ? named[0] : `${named.slice(0, -1).join(", ")} and ${named.at(-1)}`;
18
- const many = paths.length > 1;
19
- return `${foundInOpening(id)}${list}, which ${many ? "are" : "is"} not read as ${many ? "tests" : "a test"}. If ${many ? "one" : "that file"} holds the test, name it with a runner glob in \`.outerlayer-proofs.yaml\`.`;
17
+ const list = named.length === 1 ? named[0] : `${named.slice(0, -1).join(", ")} and ${named.at(-1)}`;
18
+ const more = paths.length > 3 ? " and other files" : "";
19
+ const one = paths.length === 1;
20
+ return `The judge named ${list}${more}, which ${one ? "is" : "are"} not read as ${one ? "a test" : "tests"}. If ${one ? "that file holds" : "one of them holds"} the test, name it with a runner glob in \`.outerlayer-proofs.yaml\`.`;
20
21
  }
21
- var foundInOpening = (id) => `\`${id}\` appears in `;
22
- var FOUND_IN_ENDING = " holds the test, name it with a runner glob in `.outerlayer-proofs.yaml`.";
23
- function isFoundInReason(reason, id) {
24
- return reason !== void 0 && reason.startsWith(foundInOpening(id)) && reason.endsWith(FOUND_IN_ENDING);
25
- }
26
- function uncitedIds(criteria, citations) {
27
- return criteria.filter((criterion) => criterion.proof === null && refsFor(criterion.id, citations) === void 0).map((criterion) => criterion.id);
22
+ function treePath(raw, treeRoot) {
23
+ let path2 = raw.trim().replace(/\\/g, "/");
24
+ const root = `${treeRoot.replace(/\/+$/, "")}/`;
25
+ if (path2.startsWith(root)) path2 = path2.slice(root.length);
26
+ while (path2.startsWith("./")) path2 = path2.slice(2);
27
+ if (path2 === "" || path2.length > CHECK_ITEM_REF_PATH_MAX_LENGTH || path2.startsWith("/") || /[\u0000-\u001f\u007f]/.test(path2)) return void 0;
28
+ if (path2.split("/").some((segment) => segment === ".." || segment === "")) return void 0;
29
+ return path2;
28
30
  }
29
31
  function criterionInputs(input) {
30
- const paths = [...new Set((input.citations[input.criterion.id] ?? []).map((citation) => citation.path))].sort();
31
32
  const hash = createHash("sha256");
32
33
  const part = (text) => {
33
34
  hash.update(`${Buffer.byteLength(text)}:`);
34
35
  hash.update(text);
35
36
  };
36
- part("judge-criterion-v1");
37
+ part("judge-criterion-v2");
37
38
  part(input.brief);
38
39
  part(input.criterion.id);
39
40
  part(input.criterion.text);
40
41
  part(input.criterion.proof ?? "");
41
- for (const path2 of paths) {
42
+ for (const path2 of [...input.files.keys()].sort()) {
43
+ const text = input.files.get(path2);
42
44
  part(path2);
43
- part(input.testFiles.get(path2) ?? "");
45
+ part(text === void 0 ? "missing" : `text:${text}`);
44
46
  }
45
47
  return hash.digest("hex");
46
48
  }
47
- var HTTPS_LINK = /^https:\/\/\S+$/;
48
- function refsFor(id, citations) {
49
- const refs = (citations[id] ?? []).slice(0, 20).map((citation) => ({
50
- path: citation.path,
51
- line: citation.line,
52
- // Only an https link becomes an href on a page; any other is left off rather than refusing the check.
53
- ...HTTPS_LINK.test(citation.href ?? "") ? { href: citation.href } : {}
54
- }));
55
- return refs.length === 0 ? void 0 : refs;
49
+ function refPaths(refs) {
50
+ return [...new Set((refs ?? []).map((ref) => ref.path))].sort();
56
51
  }
57
52
  function planCriteria(input) {
58
53
  const previousById = new Map(input.previous.map((item) => [item.id, item]));
59
54
  const settled = [];
60
55
  const toJudge = [];
61
56
  for (const criterion of input.criteria) {
62
- const inputs = input.inputs.get(criterion.id);
63
- const base = { id: criterion.id, criterion: criterion.id, ...inputs === void 0 ? {} : { inputs } };
64
- const refs = refsFor(criterion.id, input.citations);
57
+ const base = { id: criterion.id, criterion: criterion.id };
65
58
  if (criterion.proof !== null) {
66
59
  settled.push({ ...base, result: "skipped", reason: ARTIFACT_PROOF_REASON });
67
60
  continue;
68
61
  }
69
- if (refs === void 0) {
70
- const where = input.foundIn?.get(criterion.id) ?? [];
71
- const reason = where.length > 0 ? foundInReason(criterion.id, where) : input.noTestFiles === true ? NO_TEST_FILES_REASON : NO_CITING_TEST_REASON;
72
- settled.push({ ...base, result: "fail", reason });
73
- continue;
74
- }
75
62
  const kept = previousById.get(criterion.id);
76
- if (kept !== void 0 && inputs !== void 0 && kept.inputs === inputs && (kept.result === "pass" || kept.result === "fail")) {
77
- settled.push({ ...base, result: kept.result, ...kept.reason === void 0 ? {} : { reason: kept.reason }, refs });
78
- continue;
63
+ const paths = refPaths(kept?.refs);
64
+ if (kept !== void 0 && kept.result === "pass" && kept.inputs !== void 0 && paths.length > 0) {
65
+ const inputs = input.inputsFor(criterion, paths);
66
+ if (inputs === kept.inputs) {
67
+ settled.push({ ...base, ...kept.commit === void 0 ? {} : { commit: kept.commit }, result: "pass", ...kept.reason === void 0 ? {} : { reason: kept.reason }, refs: kept.refs, inputs });
68
+ continue;
69
+ }
79
70
  }
80
71
  toJudge.push(criterion);
81
72
  }
82
73
  return { settled, toJudge };
83
74
  }
75
+ function judgeGroups(criteria, size = JUDGE_GROUP_SIZE) {
76
+ const groups = [];
77
+ for (let start = 0; start < criteria.length; start += size) groups.push(criteria.slice(start, start + size));
78
+ return groups;
79
+ }
84
80
  var MAX_ANSWER_ENTRIES = 500;
81
+ var MAX_NAMED_TESTS = 50;
82
+ function readTests(raw) {
83
+ if (!Array.isArray(raw)) return void 0;
84
+ const tests = [];
85
+ for (const entry of raw.slice(0, MAX_NAMED_TESTS)) {
86
+ const { path: path2, line } = typeof entry === "object" && entry !== null ? entry : {};
87
+ if (typeof path2 !== "string" || path2 === "" || path2.length > 1024) continue;
88
+ tests.push({ path: path2, ...typeof line === "number" && Number.isInteger(line) && line > 0 ? { line } : {} });
89
+ }
90
+ return tests;
91
+ }
85
92
  function readAnswer(raw) {
86
93
  if (typeof raw !== "object" || raw === null || Array.isArray(raw)) return { ok: false, problem: "expected an object" };
87
94
  const { result, items } = raw;
@@ -91,11 +98,12 @@ function readAnswer(raw) {
91
98
  if (entries.length > MAX_ANSWER_ENTRIES) return { ok: false, problem: `items: at most ${MAX_ANSWER_ENTRIES} entries` };
92
99
  const read = [];
93
100
  for (const [index, entry] of entries.entries()) {
94
- const { id, result: itemResult, reason } = typeof entry === "object" && entry !== null ? entry : {};
101
+ const { id, result: itemResult, reason, tests } = typeof entry === "object" && entry !== null ? entry : {};
95
102
  if (typeof id !== "string" || id === "" || id.length > 200) return { ok: false, problem: `items.${index}.id: must be text of 1 to 200 characters` };
96
103
  if (itemResult !== "pass" && itemResult !== "fail") return { ok: false, problem: `items.${index}.result: must be "pass" or "fail"` };
97
104
  if (reason !== void 0 && typeof reason !== "string") return { ok: false, problem: `items.${index}.reason: must be text` };
98
- read.push({ id, result: itemResult, ...reason === void 0 ? {} : { reason } });
105
+ const named = readTests(tests);
106
+ read.push({ id, result: itemResult, ...reason === void 0 ? {} : { reason }, ...named === void 0 ? {} : { tests: named } });
99
107
  }
100
108
  return { ok: true, answer: { ...result === void 0 ? {} : { result }, items: read } };
101
109
  }
@@ -116,22 +124,53 @@ function oneLineReason(text) {
116
124
  if (line === "") return void 0;
117
125
  return line.length <= CHECK_ITEM_REASON_MAX_LENGTH ? line : `${line.slice(0, CHECK_ITEM_REASON_MAX_LENGTH - 1)}\u2026`;
118
126
  }
127
+ function namedTests(tests, input) {
128
+ const refs = [];
129
+ const notTests = [];
130
+ const seen = /* @__PURE__ */ new Set();
131
+ for (const test of tests ?? []) {
132
+ const written = treePath(test.path, input.treeRoot);
133
+ if (written === void 0) continue;
134
+ const path2 = written.startsWith("tree/") && input.ownTree !== true ? written.slice("tree/".length) : written;
135
+ if (path2 === "") continue;
136
+ const known = input.check(path2, test.line);
137
+ if (known === void 0) continue;
138
+ const key = `${path2}:${test.line ?? ""}`;
139
+ if (seen.has(key)) continue;
140
+ if (known === "not-a-test") {
141
+ if (!notTests.includes(path2)) notTests.push(path2);
142
+ continue;
143
+ }
144
+ seen.add(key);
145
+ refs.push({ path: path2, ...test.line === void 0 ? {} : { line: test.line }, ...known.href === void 0 ? {} : { href: known.href } });
146
+ if (refs.length >= CHECK_ITEM_REFS_MAX) break;
147
+ }
148
+ return { refs, notTests };
149
+ }
119
150
  function judgedItems(input) {
120
151
  return input.toJudge.map((criterion) => {
121
152
  const said = input.results.get(criterion.id);
122
- const inputs = input.inputs.get(criterion.id);
123
- const refs = refsFor(criterion.id, input.citations);
124
- const reason = said === void 0 ? NO_VERDICT_REASON : oneLineReason(said.reason);
125
- return {
126
- id: criterion.id,
127
- criterion: criterion.id,
128
- result: said?.result ?? "fail",
129
- ...reason === void 0 ? {} : { reason },
130
- ...refs === void 0 ? {} : { refs },
131
- ...inputs === void 0 || said === void 0 ? {} : { inputs }
132
- };
153
+ const base = { id: criterion.id, criterion: criterion.id, commit: input.commit };
154
+ if (said === void 0) return { ...base, result: "fail", reason: NO_VERDICT_REASON };
155
+ const { refs, notTests } = namedTests(said.tests, { treeRoot: input.treeRoot, check: input.check, ownTree: input.ownTree });
156
+ const withRefs = refs.length === 0 ? {} : { refs };
157
+ if (said.result === "pass" && refs.length === 0) return { ...base, result: "fail", reason: notTests.length > 0 ? oneLineReason(notReadAsTestReason(notTests)) : NO_NAMED_TEST_REASON };
158
+ const reason = oneLineReason(said.reason);
159
+ const kept = said.result === "pass" ? { inputs: input.inputsFor(criterion, refPaths(refs)) } : {};
160
+ return { ...base, result: said.result, ...reason === void 0 ? {} : { reason }, ...withRefs, ...kept };
133
161
  });
134
162
  }
163
+ function failedItems(criteria, reason) {
164
+ const said = oneLineReason(reason) ?? NO_VERDICT_REASON;
165
+ return criteria.map((criterion) => ({ id: criterion.id, criterion: criterion.id, result: "fail", reason: said }));
166
+ }
167
+ function testsByCriterion(items) {
168
+ const tests = {};
169
+ for (const item of items) {
170
+ tests[item.id] = (item.refs ?? []).flatMap((ref) => ref.line === void 0 ? [] : [{ path: ref.path, line: ref.line, href: ref.href ?? null }]);
171
+ }
172
+ return tests;
173
+ }
135
174
  function inCriteriaOrder(items, criteria) {
136
175
  const order = new Map(criteria.map((criterion, index) => [criterion.id, index]));
137
176
  return [...items].sort((a, b) => (order.get(a.id) ?? Number.MAX_SAFE_INTEGER) - (order.get(b.id) ?? Number.MAX_SAFE_INTEGER));
@@ -2041,7 +2080,6 @@ function runnerMatcher(runners) {
2041
2080
  return index === -1 ? void 0 : index;
2042
2081
  };
2043
2082
  }
2044
- var MAX_TEST_FILES = 2e4;
2045
2083
  var MAX_TEST_FILE_BYTES = 1024 * 1024;
2046
2084
  async function loadCitationFinder() {
2047
2085
  return await import(pathToFileURL(join(resolvePackRoot(), "maintained", "outerlayer-build", "scripts", "criterion-citations.mjs")).href);
@@ -2074,70 +2112,4 @@ function hostItemsOf(workItem, name) {
2074
2112
  return parsed.success ? parsed.data : [];
2075
2113
  }
2076
2114
 
2077
- // src/runner/judge-found.ts
2078
- var MAX_FOUND_FILES = 4;
2079
- var MAX_NAMED_PATH_LENGTH = 200;
2080
- var JUDGE_LIMITS = { files: MAX_TEST_FILES, bytes: MAX_TEST_FILE_BYTES };
2081
- function isSearchCandidate(file, rules, maxBytes = MAX_TEST_FILE_BYTES) {
2082
- return file.size <= maxBytes && !rules.isTest(file.path) && rules.isSearchable(file.path);
2083
- }
2084
- function firstInPathOrder(files, limit) {
2085
- return [...files].sort((a, b) => a.path < b.path ? -1 : 1).slice(0, limit);
2086
- }
2087
- function pickSearchable(candidates, rules, limits = JUDGE_LIMITS) {
2088
- return firstInPathOrder(
2089
- candidates.filter((file) => isSearchCandidate(file, rules, limits.bytes)),
2090
- limits.files
2091
- );
2092
- }
2093
- var READ_GROUP = { files: 500, bytes: 33554432 };
2094
- function groupBySize(sizes, limit = READ_GROUP) {
2095
- const groups = [];
2096
- let start = 0;
2097
- let bytes = 0;
2098
- for (let at = 0; at < sizes.length; at += 1) {
2099
- if (at > start && (at - start >= limit.files || bytes + sizes[at] > limit.bytes)) {
2100
- groups.push([start, at]);
2101
- start = at;
2102
- bytes = 0;
2103
- }
2104
- bytes += sizes[at];
2105
- }
2106
- if (start < sizes.length) groups.push([start, sizes.length]);
2107
- return groups;
2108
- }
2109
- function isNameable(path2) {
2110
- if (path2.length > MAX_NAMED_PATH_LENGTH) return false;
2111
- for (const character of path2) {
2112
- const code = character.codePointAt(0);
2113
- if (code < 32 || code >= 127 && code <= 159 || character === "`") return false;
2114
- if (code === 8232 || code === 8233 || code >= 8234 && code <= 8238 || code >= 8294 && code <= 8297) return false;
2115
- }
2116
- return true;
2117
- }
2118
- var IdScan = class {
2119
- constructor(finder, ids) {
2120
- this.found = /* @__PURE__ */ new Map();
2121
- this.pending = [...new Set(ids)].filter((id) => id !== "");
2122
- this.patterns = new Map(this.pending.map((id) => [id, finder.idPattern(id)]));
2123
- }
2124
- /** True when every id has all its paths, so no later file can change the result. */
2125
- get complete() {
2126
- return this.pending.length === 0;
2127
- }
2128
- offer(path2, contents) {
2129
- if (this.complete || !isNameable(path2) || contents.includes("\0")) return;
2130
- for (const id of [...this.pending]) {
2131
- if (!contents.includes(id) || !this.patterns.get(id).test(contents)) continue;
2132
- const paths = this.found.get(id) ?? [];
2133
- paths.push(path2);
2134
- this.found.set(id, paths);
2135
- if (paths.length >= MAX_FOUND_FILES) this.pending.splice(this.pending.indexOf(id), 1);
2136
- }
2137
- }
2138
- result() {
2139
- return this.found;
2140
- }
2141
- };
2142
-
2143
- export { IdScan, MAX_TEST_FILES, MAX_TEST_FILE_BYTES, NO_CITING_TEST_REASON, NO_TEST_FILES_REASON, NO_VERDICT_REASON, criteriaOf, criterionInputs, firstInPathOrder, foundInReason, groupBySize, hostItemsOf, inCriteriaOrder, isFoundInReason, isSearchCandidate, itemsSentence, judgedItems, loadCitationFinder, oneLineReason, parseJudgeAnswer, pickSearchable, planCriteria, runnerMatcher, testFileMatcher, uncitedIds };
2115
+ export { MAX_TEST_FILE_BYTES, NO_VERDICT_REASON, criteriaOf, criterionInputs, failedItems, hostItemsOf, inCriteriaOrder, itemsSentence, judgeGroups, judgedItems, loadCitationFinder, oneLineReason, parseJudgeAnswer, planCriteria, runnerMatcher, testFileMatcher, testsByCriterion };