modelrig 0.8.0 → 0.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (248) hide show
  1. package/CHANGELOG.md +156 -0
  2. package/README.md +27 -2
  3. package/dist/artifacts/artifact.d.ts +12 -13
  4. package/dist/artifacts/artifact.d.ts.map +1 -1
  5. package/dist/artifacts/artifact.js +17 -23
  6. package/dist/artifacts/index.d.ts +13 -5
  7. package/dist/artifacts/index.d.ts.map +1 -1
  8. package/dist/artifacts/index.js +11 -4
  9. package/dist/artifacts/run-context.d.ts +3 -24
  10. package/dist/artifacts/run-context.d.ts.map +1 -1
  11. package/dist/artifacts/run-context.js +3 -39
  12. package/dist/bakeoff/engine.d.ts +29 -0
  13. package/dist/bakeoff/engine.d.ts.map +1 -1
  14. package/dist/bakeoff/engine.js +47 -0
  15. package/dist/bakeoff/eval-cases-rig.d.ts +36 -0
  16. package/dist/bakeoff/eval-cases-rig.d.ts.map +1 -0
  17. package/dist/bakeoff/eval-cases-rig.js +27 -0
  18. package/dist/bakeoff/eval-cases.d.ts +19 -0
  19. package/dist/bakeoff/eval-cases.d.ts.map +1 -1
  20. package/dist/bakeoff/eval-cases.js +18 -1
  21. package/dist/bakeoff/golden-judge.d.ts +47 -0
  22. package/dist/bakeoff/golden-judge.d.ts.map +1 -0
  23. package/dist/bakeoff/golden-judge.js +49 -0
  24. package/dist/bakeoff/quality.d.ts +30 -0
  25. package/dist/bakeoff/quality.d.ts.map +1 -1
  26. package/dist/bakeoff/quality.js +21 -0
  27. package/dist/bakeoff/replay.d.ts +11 -0
  28. package/dist/bakeoff/replay.d.ts.map +1 -1
  29. package/dist/bakeoff/replay.js +8 -0
  30. package/dist/bakeoff/report.d.ts +7 -0
  31. package/dist/bakeoff/report.d.ts.map +1 -1
  32. package/dist/bakeoff/report.js +26 -0
  33. package/dist/cli-judge.d.ts +12 -0
  34. package/dist/cli-judge.d.ts.map +1 -0
  35. package/dist/cli-judge.js +48 -0
  36. package/dist/cli.d.ts.map +1 -1
  37. package/dist/cli.js +14 -42
  38. package/dist/config.d.ts +54 -29
  39. package/dist/config.d.ts.map +1 -1
  40. package/dist/config.js +86 -47
  41. package/dist/detect/detector.d.ts +4 -2
  42. package/dist/detect/detector.d.ts.map +1 -1
  43. package/dist/detect/safe-harbor.d.ts +57 -0
  44. package/dist/detect/safe-harbor.d.ts.map +1 -0
  45. package/dist/detect/safe-harbor.js +278 -0
  46. package/dist/feedback/coverage.d.ts +11 -8
  47. package/dist/feedback/coverage.d.ts.map +1 -1
  48. package/dist/feedback/coverage.js +29 -16
  49. package/dist/feedback/grade.d.ts +51 -0
  50. package/dist/feedback/grade.d.ts.map +1 -0
  51. package/dist/feedback/grade.js +63 -0
  52. package/dist/gateway/http-protocol.d.ts +1 -1
  53. package/dist/gateway/http-protocol.d.ts.map +1 -1
  54. package/dist/gateway/http-protocol.js +1 -1
  55. package/dist/index.d.ts +44 -27
  56. package/dist/index.d.ts.map +1 -1
  57. package/dist/index.js +110 -43
  58. package/dist/init/observe-cli.js +1 -1
  59. package/dist/init/observe.d.ts +2 -2
  60. package/dist/init/observe.d.ts.map +1 -1
  61. package/dist/init/observe.js +11 -7
  62. package/dist/mask/arm.d.ts +112 -0
  63. package/dist/mask/arm.d.ts.map +1 -0
  64. package/dist/mask/arm.js +179 -0
  65. package/dist/mask/index.d.ts +2 -0
  66. package/dist/mask/index.d.ts.map +1 -1
  67. package/dist/mask/index.js +7 -1
  68. package/dist/mask/mask-policy-cli.d.ts +12 -4
  69. package/dist/mask/mask-policy-cli.d.ts.map +1 -1
  70. package/dist/mask/mask-policy-cli.js +34 -9
  71. package/dist/query/grammar.d.ts +2 -2
  72. package/dist/query/grammar.d.ts.map +1 -1
  73. package/dist/query/grammar.js +3 -1
  74. package/dist/query/saved.d.ts +13 -0
  75. package/dist/query/saved.d.ts.map +1 -1
  76. package/dist/query/saved.js +67 -1
  77. package/dist/receipts/types.d.ts +1 -1
  78. package/dist/receipts/types.d.ts.map +1 -1
  79. package/dist/receipts/types.js +1 -0
  80. package/dist/registry/build.d.ts +43 -1
  81. package/dist/registry/build.d.ts.map +1 -1
  82. package/dist/registry/build.js +52 -0
  83. package/dist/registry/pricing-shape.d.ts +29 -0
  84. package/dist/registry/pricing-shape.d.ts.map +1 -1
  85. package/dist/registry/pricing-shape.js +10 -1
  86. package/dist/registry/rows.d.ts.map +1 -1
  87. package/dist/registry/rows.js +1 -0
  88. package/dist/registry/select.d.ts +6 -1
  89. package/dist/registry/select.d.ts.map +1 -1
  90. package/dist/registry/select.js +11 -0
  91. package/dist/routes/call-config.d.ts +199 -0
  92. package/dist/routes/call-config.d.ts.map +1 -0
  93. package/dist/routes/call-config.js +343 -0
  94. package/dist/routes/loader.js +5 -3
  95. package/dist/routes/objective-loader.d.ts +12 -0
  96. package/dist/routes/objective-loader.d.ts.map +1 -1
  97. package/dist/routes/objective-loader.js +82 -0
  98. package/dist/routes/resolved-bundle.d.ts +50 -0
  99. package/dist/routes/resolved-bundle.d.ts.map +1 -1
  100. package/dist/routes/resolved-bundle.js +52 -0
  101. package/dist/routes/screen-loader.d.ts +28 -0
  102. package/dist/routes/screen-loader.d.ts.map +1 -1
  103. package/dist/routes/screen-loader.js +51 -0
  104. package/dist/run/accept.d.ts +2 -0
  105. package/dist/run/accept.d.ts.map +1 -1
  106. package/dist/run/accept.js +1 -0
  107. package/dist/run/dispatch.d.ts +42 -13
  108. package/dist/run/dispatch.d.ts.map +1 -1
  109. package/dist/run/dispatch.js +107 -25
  110. package/dist/run/grounding.d.ts +28 -2
  111. package/dist/run/grounding.d.ts.map +1 -1
  112. package/dist/run/grounding.js +54 -10
  113. package/dist/run/record-attempt.d.ts +4 -0
  114. package/dist/run/record-attempt.d.ts.map +1 -1
  115. package/dist/run/record-attempt.js +4 -0
  116. package/dist/run/routing-docs.js +1 -1
  117. package/dist/run/run.d.ts.map +1 -1
  118. package/dist/run/run.js +21 -26
  119. package/dist/savings/odometer.d.ts +4 -0
  120. package/dist/savings/odometer.d.ts.map +1 -1
  121. package/dist/savings/odometer.js +20 -1
  122. package/dist/savings/swap-execute.d.ts +7 -0
  123. package/dist/savings/swap-execute.d.ts.map +1 -1
  124. package/dist/savings/swap-execute.js +30 -0
  125. package/dist/savings/swaps-client.d.ts +10 -0
  126. package/dist/savings/swaps-client.d.ts.map +1 -1
  127. package/dist/screen/fixtures/probe-corpora.d.ts +23 -0
  128. package/dist/screen/fixtures/probe-corpora.d.ts.map +1 -0
  129. package/dist/screen/fixtures/probe-corpora.js +69 -0
  130. package/dist/screen/index.d.ts +21 -0
  131. package/dist/screen/index.d.ts.map +1 -0
  132. package/dist/screen/index.js +64 -0
  133. package/dist/screen/model-screen.d.ts +111 -0
  134. package/dist/screen/model-screen.d.ts.map +1 -0
  135. package/dist/screen/model-screen.js +178 -0
  136. package/dist/screen/patterns.d.ts +51 -0
  137. package/dist/screen/patterns.d.ts.map +1 -0
  138. package/dist/screen/patterns.js +151 -0
  139. package/dist/screen/phi-gate.d.ts +52 -0
  140. package/dist/screen/phi-gate.d.ts.map +1 -0
  141. package/dist/screen/phi-gate.js +86 -0
  142. package/dist/screen/policy.d.ts +71 -0
  143. package/dist/screen/policy.d.ts.map +1 -0
  144. package/dist/screen/policy.js +334 -0
  145. package/dist/screen/probe.d.ts +118 -0
  146. package/dist/screen/probe.d.ts.map +1 -0
  147. package/dist/screen/probe.js +132 -0
  148. package/dist/screen/screen-cli.d.ts +16 -0
  149. package/dist/screen/screen-cli.d.ts.map +1 -0
  150. package/dist/screen/screen-cli.js +178 -0
  151. package/dist/screen/screen.d.ts +99 -0
  152. package/dist/screen/screen.d.ts.map +1 -0
  153. package/dist/screen/screen.js +0 -0
  154. package/dist/screen/sidecar.d.ts +69 -0
  155. package/dist/screen/sidecar.d.ts.map +1 -0
  156. package/dist/screen/sidecar.js +145 -0
  157. package/dist/screen/types.d.ts +43 -2
  158. package/dist/screen/types.d.ts.map +1 -1
  159. package/dist/settings/api-fetcher.d.ts +14 -3
  160. package/dist/settings/api-fetcher.d.ts.map +1 -1
  161. package/dist/settings/api-fetcher.js +61 -10
  162. package/dist/settings/grading-guide.d.ts +76 -0
  163. package/dist/settings/grading-guide.d.ts.map +1 -0
  164. package/dist/settings/grading-guide.js +23 -0
  165. package/dist/settings/index.d.ts +3 -2
  166. package/dist/settings/index.d.ts.map +1 -1
  167. package/dist/settings/index.js +2 -1
  168. package/dist/settings/task-settings.d.ts +44 -7
  169. package/dist/settings/task-settings.d.ts.map +1 -1
  170. package/dist/settings/task-settings.js +53 -12
  171. package/dist/status.d.ts +26 -20
  172. package/dist/status.d.ts.map +1 -1
  173. package/dist/status.js +47 -29
  174. package/dist/telemetry/artifact-store.d.ts +5 -6
  175. package/dist/telemetry/artifact-store.d.ts.map +1 -1
  176. package/dist/telemetry/artifact-store.js +10 -24
  177. package/dist/telemetry/attempt-meta.d.ts +21 -0
  178. package/dist/telemetry/attempt-meta.d.ts.map +1 -1
  179. package/dist/telemetry/attempt-meta.js +9 -0
  180. package/dist/telemetry/exporter.d.ts +2 -2
  181. package/dist/telemetry/exporter.d.ts.map +1 -1
  182. package/dist/telemetry/exporter.js +22 -41
  183. package/dist/telemetry/grade-mappers.d.ts +22 -0
  184. package/dist/telemetry/grade-mappers.d.ts.map +1 -0
  185. package/dist/telemetry/grade-mappers.js +58 -0
  186. package/dist/telemetry/grades-sql.d.ts +53 -0
  187. package/dist/telemetry/grades-sql.d.ts.map +1 -0
  188. package/dist/telemetry/grades-sql.js +133 -0
  189. package/dist/telemetry/ingest-protocol.d.ts +29 -46
  190. package/dist/telemetry/ingest-protocol.d.ts.map +1 -1
  191. package/dist/telemetry/ingest-protocol.js +16 -54
  192. package/dist/telemetry/store-migrations.d.ts.map +1 -1
  193. package/dist/telemetry/store-migrations.js +51 -0
  194. package/dist/telemetry/store.d.ts +9 -6
  195. package/dist/telemetry/store.d.ts.map +1 -1
  196. package/dist/telemetry/store.js +8 -50
  197. package/dist/tenancy/api-key-format.d.ts +30 -1
  198. package/dist/tenancy/api-key-format.d.ts.map +1 -1
  199. package/dist/tenancy/api-key-format.js +33 -1
  200. package/dist/types/provider.d.ts +3 -0
  201. package/dist/types/provider.d.ts.map +1 -1
  202. package/dist/types/provider.js +25 -0
  203. package/dist/types/route.d.ts +78 -2
  204. package/dist/types/route.d.ts.map +1 -1
  205. package/dist/types/telemetry.d.ts +43 -46
  206. package/dist/types/telemetry.d.ts.map +1 -1
  207. package/dist/validate-cli.d.ts.map +1 -1
  208. package/dist/validate-cli.js +32 -0
  209. package/dist/verify/verify.d.ts +5 -0
  210. package/dist/verify/verify.d.ts.map +1 -1
  211. package/dist/verify/verify.js +2 -0
  212. package/dist/watch/evaluate.d.ts +84 -1
  213. package/dist/watch/evaluate.d.ts.map +1 -1
  214. package/dist/watch/evaluate.js +28 -0
  215. package/dist/watch/monitor.d.ts +8 -2
  216. package/dist/watch/monitor.d.ts.map +1 -1
  217. package/dist/watch/monitor.js +13 -5
  218. package/dist/watch/regret-monitor-cli.d.ts +16 -0
  219. package/dist/watch/regret-monitor-cli.d.ts.map +1 -0
  220. package/dist/watch/regret-monitor-cli.js +137 -0
  221. package/dist/watch/regret-monitor.d.ts +168 -0
  222. package/dist/watch/regret-monitor.d.ts.map +1 -0
  223. package/dist/watch/regret-monitor.js +304 -0
  224. package/dist/watch/upgrade.d.ts +62 -0
  225. package/dist/watch/upgrade.d.ts.map +1 -0
  226. package/dist/watch/upgrade.js +57 -0
  227. package/docs/agent-skill/SKILL.md +109 -5
  228. package/docs/how-it-fits.md +3 -2
  229. package/docs/instrumentation.md +149 -21
  230. package/docs/llms.txt +64 -20
  231. package/docs/mcp-oracle.md +249 -0
  232. package/docs/quickstart.md +103 -9
  233. package/package.json +16 -3
  234. package/registry/leaderboard.json +74 -0
  235. package/registry/registry.json +150 -112
  236. package/screen.d.ts +16 -0
  237. package/templates/call-disposition-qa.json +77 -0
  238. package/templates/catalog-cleansing.json +77 -0
  239. package/templates/compliance-review.json +76 -0
  240. package/templates/cs-next-action.json +76 -0
  241. package/templates/document-extraction.json +78 -0
  242. package/templates/financial-classification.json +75 -0
  243. package/templates/lead-qualification.json +76 -0
  244. package/templates/medical-classification.json +71 -0
  245. package/templates/ticket-triage.json +76 -0
  246. package/dist/telemetry/supabase-exporter.d.ts +0 -64
  247. package/dist/telemetry/supabase-exporter.d.ts.map +0 -1
  248. package/dist/telemetry/supabase-exporter.js +0 -211
@@ -7,7 +7,9 @@
7
7
  * unit-tested directly.
8
8
  */
9
9
  Object.defineProperty(exports, "__esModule", { value: true });
10
+ exports.DEFAULT_GRADE_PASS_THRESHOLD = void 0;
10
11
  exports.parseRb1Fields = parseRb1Fields;
12
+ exports.parseGradeBlock = parseGradeBlock;
11
13
  exports.parseObjective = parseObjective;
12
14
  exports.parseBakeoffConfig = parseBakeoffConfig;
13
15
  exports.parseValueChecks = parseValueChecks;
@@ -19,6 +21,9 @@ function parseRb1Fields(doc, route, candidates, problems) {
19
21
  const objective = parseObjective(doc.objective, problems);
20
22
  const bakeoff = parseBakeoffConfig(doc.bakeoff, candidates, problems);
21
23
  const valueChecks = parseValueChecks(doc.value_checks, problems);
24
+ // Grade primitive (R2): the optional per-route pass threshold rides the same
25
+ // additive-route-knobs parse, keeping loader.ts under the LOC cap.
26
+ const grade = parseGradeBlock(doc.grade, problems);
22
27
  // Only nag routes that OPT INTO RB-1 (declare objective/bakeoff) but omit a
23
28
  // bound — a legacy route with neither block is not using regret bake-offs.
24
29
  if (objective !== undefined || bakeoff !== undefined) {
@@ -30,6 +35,7 @@ function parseRb1Fields(doc, route, candidates, problems) {
30
35
  ...(objective !== undefined ? { objective } : {}),
31
36
  ...(bakeoff !== undefined ? { bakeoff } : {}),
32
37
  ...(valueChecks !== undefined ? { valueChecks } : {}),
38
+ ...(grade !== undefined ? { grade } : {}),
33
39
  };
34
40
  }
35
41
  const OBJECTIVE_MODES = new Set([
@@ -40,6 +46,28 @@ const OBJECTIVE_MODES = new Set([
40
46
  function isRecord(v) {
41
47
  return typeof v === "object" && v !== null && !Array.isArray(v);
42
48
  }
49
+ /** Default grade pass threshold when a route declares no `grade:` block (R2). */
50
+ exports.DEFAULT_GRADE_PASS_THRESHOLD = 0.5;
51
+ /** Parse the optional `grade:` block (grade primitive, R2). Currently one knob,
52
+ * `pass_threshold` (0–1). Declared + validated here but UNREAD until GP-2 wires
53
+ * verdict derivation. Absent ⇒ undefined (⇒ the default 0.5 is applied downstream).
54
+ * A malformed value pushes a teaching problem, exactly like every other field. */
55
+ function parseGradeBlock(raw, problems) {
56
+ if (raw === undefined || raw === null)
57
+ return undefined;
58
+ if (!isRecord(raw)) {
59
+ problems.push("grade must be an object { pass_threshold: <0..1> }");
60
+ return undefined;
61
+ }
62
+ const t = raw.pass_threshold;
63
+ if (t === undefined)
64
+ return undefined;
65
+ if (typeof t !== "number" || !Number.isFinite(t) || t < 0 || t > 1) {
66
+ problems.push(`grade.pass_threshold must be a number in [0, 1], got ${String(t)}`);
67
+ return undefined;
68
+ }
69
+ return { passThreshold: t };
70
+ }
43
71
  function parsePriceCeiling(raw, field, problems) {
44
72
  if (raw === undefined || raw === null)
45
73
  return undefined;
@@ -222,15 +250,69 @@ function parseBakeoffConfig(raw, candidates, problems) {
222
250
  pairwise = { judge: pwJudge };
223
251
  }
224
252
  }
253
+ // Q1 regret monitor (spec §5) + N4 upgrade watch (spec §4) — additive, optional.
254
+ const regretMonitor = parseRegretMonitor(raw.regret_monitor, problems);
255
+ let upgradeWatch;
256
+ if (raw.upgrade_watch !== undefined) {
257
+ if (typeof raw.upgrade_watch !== "boolean") {
258
+ problems.push("bakeoff.upgrade_watch must be a boolean");
259
+ }
260
+ else {
261
+ upgradeWatch = raw.upgrade_watch;
262
+ }
263
+ }
264
+ // Teaching (spec §3 opt-in rule): a monitor/upgrade-watch with NO reference has
265
+ // nothing to measure against — warn (non-fatal), mirroring missingBoundWarning.
266
+ const noReference = reference === undefined;
267
+ if (noReference && (regretMonitor?.enabled === true || upgradeWatch === true)) {
268
+ console.warn(`modelrig: route bakeoff sets ${regretMonitor?.enabled === true ? "regret_monitor.enabled" : "upgrade_watch"}` +
269
+ " but declares no bakeoff.reference — there is no ceiling to measure regret against, so neither the" +
270
+ " regret monitor nor the up-swap watch can fire. Declare bakeoff.reference (auto or provider/model).");
271
+ }
225
272
  const out = {
226
273
  ...(reference !== undefined ? { reference } : {}),
227
274
  ...(referenceAllowExternal ? { referenceAllowExternal: true } : {}),
228
275
  ...(referenceEnvelopeUsd !== undefined ? { referenceEnvelopeUsd } : {}),
229
276
  ...(judge !== undefined ? { judge } : {}),
230
277
  ...(pairwise !== undefined ? { pairwise } : {}),
278
+ ...(regretMonitor !== undefined ? { regretMonitor } : {}),
279
+ ...(upgradeWatch !== undefined ? { upgradeWatch } : {}),
231
280
  };
232
281
  return Object.freeze(out);
233
282
  }
283
+ /** Parse `bakeoff.regret_monitor: { enabled, sample_n?, window_days?,
284
+ * baseline_days? }` (spec §5). Absent ⇒ undefined. Each numeric bound must be a
285
+ * positive integer when present. */
286
+ function parseRegretMonitor(raw, problems) {
287
+ if (raw === undefined || raw === null)
288
+ return undefined;
289
+ if (!isRecord(raw)) {
290
+ problems.push("bakeoff.regret_monitor must be an object { enabled, sample_n?, window_days?, baseline_days? }");
291
+ return undefined;
292
+ }
293
+ if (typeof raw.enabled !== "boolean") {
294
+ problems.push("bakeoff.regret_monitor.enabled must be a boolean");
295
+ return undefined;
296
+ }
297
+ const posInt = (v, field) => {
298
+ if (v === undefined)
299
+ return undefined;
300
+ if (typeof v !== "number" || !Number.isInteger(v) || v < 1) {
301
+ problems.push(`bakeoff.regret_monitor.${field} must be a positive integer`);
302
+ return undefined;
303
+ }
304
+ return v;
305
+ };
306
+ const sampleN = posInt(raw.sample_n, "sample_n");
307
+ const windowDays = posInt(raw.window_days, "window_days");
308
+ const baselineDays = posInt(raw.baseline_days, "baseline_days");
309
+ return Object.freeze({
310
+ enabled: raw.enabled,
311
+ ...(sampleN !== undefined ? { sampleN } : {}),
312
+ ...(windowDays !== undefined ? { windowDays } : {}),
313
+ ...(baselineDays !== undefined ? { baselineDays } : {}),
314
+ });
315
+ }
234
316
  /** Parse a `{ model, max_samples }` judge spec (shared by `bakeoff.judge` and
235
317
  * `bakeoff.pairwise.judge`). Enforces #223 F3: the judge model must be a declared
236
318
  * candidate. Returns the parsed spec, or undefined when absent/invalid (problems
@@ -25,6 +25,8 @@
25
25
  * schema it fingerprints.
26
26
  */
27
27
  import type { LoadedRoutes } from "./loader";
28
+ import type { ScreenPolicy } from "../screen/types";
29
+ import type { ResolvedMaskPolicy } from "../mask/types";
28
30
  import type { CandidateSpec, Preference, RepairPolicy, Requirement, RouteBundle, RoutePolicy, RouteVariant } from "../types/route";
29
31
  /**
30
32
  * The canonical, JSON-serialisable form of a resolved route bundle. Every field
@@ -48,10 +50,58 @@ export interface ResolvedRouteBundle {
48
50
  readonly variants: readonly RouteVariant[];
49
51
  readonly capture: boolean;
50
52
  readonly groundingQuery?: string;
53
+ /** S1 grounding assembly mode (`legacy` | `spotlight`). Carried so a route's
54
+ * spotlight opt-in survives to the hosted (mirror) lane. Absent ⇒ legacy. */
55
+ readonly groundingAssembly?: "legacy" | "spotlight";
56
+ /** S2 per-variable `x-trust` annotation. S3 mirror plumbing (spec §11.3, gap
57
+ * #3): previously DROPPED on the round-trip, so any bundle-borne trust signal
58
+ * was `undefined` on every mirror-lane run. Carried now so route `x-trust`
59
+ * annotations survive to the hosted lane. Absent ⇒ every variable stays `semi`
60
+ * (byte-identical). */
61
+ readonly variableTrust?: Readonly<Record<string, "untrusted">>;
62
+ /** SC-1b mirror fix (spec §4, SC-1b req 1 — the #322 QA finding). Previously
63
+ * DROPPED on the round-trip: `route.screen` was `undefined` on every
64
+ * mirror-lane run, so screening was silently INERT (a fail-open) — an
65
+ * `enforce` route did not screen at all on the hosted lane. Carried now as the
66
+ * RAW `ScreenPolicy` (the serialisable `.policy` — the built detector closures
67
+ * on `ResolvedScreenPolicy` cannot cross the wire); `bundleFromResolved`
68
+ * RE-RESOLVES it with `resolveScreenPolicy`, which always rebuilds the T0
69
+ * pattern detector deterministically. Absent ⇒ no screening (byte-identical).
70
+ * A `screen: enforce` route that relies on a T1 `classifier:` detector is
71
+ * REFUSED at export by {@link assertMirrorSafe} (weights can't be guaranteed on
72
+ * the gateway ⇒ it would silently degrade to T0 — never a silent inert
73
+ * enforce). */
74
+ readonly screenPolicy?: ScreenPolicy;
75
+ /** SC-1b mirror fix (spec §3, SC-1b req 1). The `mask:` block had the IDENTICAL
76
+ * drop gap — `route.mask` was `undefined` on the mirror lane, so masking was
77
+ * silently INERT. Carried now as the FULLY-RESOLVED policy: unlike screen, a
78
+ * `ResolvedMaskPolicy` has its dictionary `entries` INLINED and is fully
79
+ * serialisable, so it is passed straight through (no re-resolve, no filesystem
80
+ * on the gateway) and re-materialises byte-identically — so `mask: block`
81
+ * always re-resolves on the mirror and needs no export refusal. Absent ⇒ no
82
+ * masking (byte-identical). */
83
+ readonly mask?: ResolvedMaskPolicy;
51
84
  }
52
85
  /** Project an already-loaded (resolved) bundle to its serialisable form. Pure —
53
86
  * no filesystem; the loader already followed every file reference. */
54
87
  export declare function resolveRouteBundle(bundle: RouteBundle): ResolvedRouteBundle;
88
+ /**
89
+ * Refuse-on-export guard (SC-1b req 1 — the #322 QA finding). A route that
90
+ * declares `screen: enforce` MUST be guaranteed to re-resolve its enforcement on
91
+ * the hosted (mirror) lane, or the hosted lane silently fails open. The mirror
92
+ * rebuilds the screen policy with `resolveScreenPolicy`, which ALWAYS builds the
93
+ * T0 pattern detector deterministically (no filesystem) — so a pure-T0 enforce
94
+ * policy re-resolves identically and mirrors safely. A T1 `classifier:` detector,
95
+ * though, depends on gateway-local weights the mirror cannot guarantee: there it
96
+ * would DEGRADE to T0 SILENTLY, weaker than what was authored and proven. Rather
97
+ * than ship a silently-degraded enforce we REFUSE at export with a teaching
98
+ * error. `mask` needs no guard: its resolved policy (dictionary entries inlined)
99
+ * crosses the wire whole and re-materialises identically.
100
+ *
101
+ * Called from the exporter (`buildExportedRouteMirrors`) — a hard failure at
102
+ * SYNC, on the developer's machine, never a silent inert enforce at request.
103
+ */
104
+ export declare function assertMirrorSafe(bundle: RouteBundle): void;
55
105
  /** The canonical serialisation whose hash becomes `bundle_sha`. */
56
106
  export declare function canonicalBundleJson(bundle: ResolvedRouteBundle): string;
57
107
  /** Content hash of the canonical bundle — `sha256:<hex>`. Self-describing so a
@@ -1 +1 @@
1
- {"version":3,"file":"resolved-bundle.d.ts","sourceRoot":"","sources":["../../src/routes/resolved-bundle.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAIH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAE7C,OAAO,KAAK,EACV,aAAa,EACb,UAAU,EACV,YAAY,EACZ,WAAW,EACX,WAAW,EACX,WAAW,EACX,YAAY,EACb,MAAM,gBAAgB,CAAC;AAExB;;;;;GAKG;AACH,MAAM,WAAW,mBAAmB;IAClC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,iFAAiF;IACjF,QAAQ,CAAC,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC;IACrC,QAAQ,CAAC,UAAU,EAAE,SAAS,aAAa,EAAE,CAAC;IAC9C,QAAQ,CAAC,OAAO,EAAE,SAAS,WAAW,EAAE,CAAC;IACzC,QAAQ,CAAC,MAAM,EAAE,SAAS,UAAU,EAAE,CAAC;IACvC,4DAA4D;IAC5D,QAAQ,CAAC,cAAc,EAAE,MAAM,CAAC;IAChC,QAAQ,CAAC,SAAS,EAAE,SAAS,MAAM,EAAE,CAAC;IACtC,QAAQ,CAAC,MAAM,EAAE,WAAW,CAAC;IAC7B,QAAQ,CAAC,MAAM,CAAC,EAAE,YAAY,CAAC;IAC/B,QAAQ,CAAC,QAAQ,EAAE,SAAS,YAAY,EAAE,CAAC;IAC3C,QAAQ,CAAC,OAAO,EAAE,OAAO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G,YAAY,CAclE"}
@@ -27,6 +27,7 @@
27
27
  */
28
28
  Object.defineProperty(exports, "__esModule", { value: true });
29
29
  exports.resolveRouteBundle = resolveRouteBundle;
30
+ exports.assertMirrorSafe = assertMirrorSafe;
30
31
  exports.canonicalBundleJson = canonicalBundleJson;
31
32
  exports.hashResolvedBundle = hashResolvedBundle;
32
33
  exports.bundleFromResolved = bundleFromResolved;
@@ -34,6 +35,7 @@ exports.singleRouteStore = singleRouteStore;
34
35
  const node_crypto_1 = require("node:crypto");
35
36
  const fingerprint_1 = require("../registry/fingerprint");
36
37
  const loader_1 = require("./loader");
38
+ const policy_1 = require("../screen/policy");
37
39
  /** Project an already-loaded (resolved) bundle to its serialisable form. Pure —
38
40
  * no filesystem; the loader already followed every file reference. */
39
41
  function resolveRouteBundle(bundle) {
@@ -51,8 +53,46 @@ function resolveRouteBundle(bundle) {
51
53
  variants: bundle.variants,
52
54
  capture: bundle.capture,
53
55
  ...(bundle.groundingQuery !== undefined ? { groundingQuery: bundle.groundingQuery } : {}),
56
+ ...(bundle.groundingAssembly !== undefined ? { groundingAssembly: bundle.groundingAssembly } : {}),
57
+ ...(bundle.variableTrust !== undefined ? { variableTrust: bundle.variableTrust } : {}),
58
+ // SC-1b mirror fix (req 1): carry the RAW screen policy (re-resolved on the
59
+ // gateway) + the fully-resolved mask policy (entries inlined) so neither is
60
+ // silently inert on the hosted lane. Absent ⇒ omitted ⇒ byte-identical.
61
+ ...(bundle.screen !== undefined ? { screenPolicy: bundle.screen.policy } : {}),
62
+ ...(bundle.mask !== undefined ? { mask: bundle.mask } : {}),
54
63
  };
55
64
  }
65
+ /**
66
+ * Refuse-on-export guard (SC-1b req 1 — the #322 QA finding). A route that
67
+ * declares `screen: enforce` MUST be guaranteed to re-resolve its enforcement on
68
+ * the hosted (mirror) lane, or the hosted lane silently fails open. The mirror
69
+ * rebuilds the screen policy with `resolveScreenPolicy`, which ALWAYS builds the
70
+ * T0 pattern detector deterministically (no filesystem) — so a pure-T0 enforce
71
+ * policy re-resolves identically and mirrors safely. A T1 `classifier:` detector,
72
+ * though, depends on gateway-local weights the mirror cannot guarantee: there it
73
+ * would DEGRADE to T0 SILENTLY, weaker than what was authored and proven. Rather
74
+ * than ship a silently-degraded enforce we REFUSE at export with a teaching
75
+ * error. `mask` needs no guard: its resolved policy (dictionary entries inlined)
76
+ * crosses the wire whole and re-materialises identically.
77
+ *
78
+ * Called from the exporter (`buildExportedRouteMirrors`) — a hard failure at
79
+ * SYNC, on the developer's machine, never a silent inert enforce at request.
80
+ */
81
+ function assertMirrorSafe(bundle) {
82
+ const screen = bundle.screen;
83
+ if (screen === undefined || screen.policy.mode !== "enforce")
84
+ return;
85
+ const classifiers = (screen.policy.detectors ?? []).filter((d) => d.startsWith("classifier:"));
86
+ if (classifiers.length > 0) {
87
+ throw new loader_1.RouteConfigError(`route "${bundle.route}" declares screen.mode: enforce with a classifier detector ` +
88
+ `(${classifiers.join(", ")}), which cannot be guaranteed to re-resolve on the hosted ` +
89
+ `(mirror) lane: the gateway has no access to the local classifier weights and would ` +
90
+ `silently DEGRADE to the T0 pattern tier — an enforce weaker than the one you authored ` +
91
+ `and proved. Fix: self-host this route, or drop the classifier from the enforce policy ` +
92
+ `(T0 patterns re-resolve deterministically on the mirror; the classifier stays a signal ` +
93
+ `under detect). Spec: screening §4.3, SC-1b req 1.`);
94
+ }
95
+ }
56
96
  /** Deterministic JSON: object keys sorted recursively, array order preserved.
57
97
  * The whole point is that the SAME bundle always produces the SAME bytes, so
58
98
  * the content hash is stable across processes and machines. */
@@ -119,6 +159,18 @@ function bundleFromResolved(raw) {
119
159
  variants: Object.freeze([...(b.variants ?? [])]),
120
160
  capture: b.capture === true,
121
161
  ...(b.groundingQuery !== undefined ? { groundingQuery: b.groundingQuery } : {}),
162
+ ...(b.groundingAssembly !== undefined ? { groundingAssembly: b.groundingAssembly } : {}),
163
+ ...(b.variableTrust !== undefined ? { variableTrust: Object.freeze({ ...b.variableTrust }) } : {}),
164
+ // SC-1b mirror fix (req 1): RE-RESOLVE the raw screen policy so `route.screen`
165
+ // is a live `ResolvedScreenPolicy` (built detectors) on the hosted lane — no
166
+ // longer `undefined` (the silent fail-open). `resolveScreenPolicy` always
167
+ // builds the T0 pattern detector; a configured-but-absent T1 classifier
168
+ // degrades to T0 with `degraded: true` (never a silent inert enforce — and
169
+ // `assertMirrorSafe` already refused a T1-classifier enforce at export).
170
+ ...(b.screenPolicy !== undefined ? { screen: (0, policy_1.resolveScreenPolicy)(b.screenPolicy) } : {}),
171
+ // Mask carries its FULLY-RESOLVED policy (entries inlined) — passed through,
172
+ // re-materialising byte-identically so `mask: block` is never inert.
173
+ ...(b.mask !== undefined ? { mask: b.mask } : {}),
122
174
  // Recomputed, never trusted from the wire — cannot drift from the schema.
123
175
  fingerprintCell: (0, fingerprint_1.fingerprintSchema)(outputSchema)?.cellKey ?? null,
124
176
  });
@@ -4,6 +4,34 @@
4
4
  * Pure functions that push into the shared `problems[]`; unit-tested directly.
5
5
  * Spec: docs/ModelRig/screening/spec.md §2.4 (S1 assembly knob, S2 x-trust).
6
6
  */
7
+ import type { ResolvedScreenPolicy } from "../screen/types";
8
+ import type { DataClassification } from "../artifacts/classification";
9
+ import type { ResolvedMaskPolicy } from "../mask/types";
10
+ import type { Requirement } from "../types/route";
11
+ /**
12
+ * Parse + resolve the optional `screen:` block (SC-1a, spec §4.1). Returns the
13
+ * resolved policy, or `undefined` when the block is absent OR `mode: off` (both
14
+ * ⇒ byte-identical, no screening). Pushes teaching-style problems for a
15
+ * malformed block: an unknown detector / action, or a `sources` key that loosens
16
+ * a default tier, is a LOAD error (validated at the SAME point as `require:` /
17
+ * `mask:`). A configured-but-unavailable optional classifier is NOT a load error
18
+ * — resolution degrades to T0 (spec §4.3), surfaced later on the receipt.
19
+ */
20
+ export declare function parseScreenBlock(raw: unknown, problems: string[]): ResolvedScreenPolicy | undefined;
21
+ /**
22
+ * SC-2 (spec-sc2 §4): parse the route-level `classification` (rides the 00058
23
+ * `data_classification` enum — zero-DDL) and, for a `phi` value, GATE the route
24
+ * posture at load. A `phi` route must mask (≥ redact) AND (`require:
25
+ * zero_retention` OR a `sidecar` detector present), else it refuses to load with
26
+ * the specific teaching message (checkPhiPosture). Returns the parsed
27
+ * classification, or `undefined` when absent/invalid (an invalid value is a
28
+ * pushed problem). Runs at the same point as `require:` / `mask:` / `screen:`.
29
+ */
30
+ export declare function parseClassificationAndPhiGate(raw: unknown, ctx: {
31
+ mask?: ResolvedMaskPolicy;
32
+ screen?: ResolvedScreenPolicy;
33
+ require: readonly Requirement[];
34
+ }, problems: string[]): DataClassification | undefined;
7
35
  /** Push a problem for every `{{var}}` referenced in the system template or the
8
36
  * grounding query that was not declared in `prompt.variables`. Colocated with
9
37
  * the variable parser it validates. */
@@ -1 +1 @@
1
- {"version":3,"file":"screen-loader.d.ts","sourceRoot":"","sources":["../../src/routes/screen-loader.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAQH;;uCAEuC;AACvC,wBAAgB,8BAA8B,CAC5C,cAAc,EAAE,MAAM,EACtB,cAAc,EAAE,MAAM,GAAG,SAAS,EAClC,SAAS,EAAE,SAAS,MAAM,EAAE,EAC5B,QAAQ,EAAE,MAAM,EAAE,GACjB,IAAI,CAcN;AAED;;;iFAGiF;AACjF,wBAAgB,cAAc,CAC5B,OAAO,EAAE,OAAO,EAChB,QAAQ,EAAE,MAAM,EAAE,GACjB;IAAE,QAAQ,CAAC,KAAK,EAAE,MAAM,EAAE,CAAC;IAAC,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,WAAW,CAAC,CAAA;CAAE,CAwB5E;AAED;;iFAEiF;AACjF,wBAAgB,sBAAsB,CACpC,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAClC,QAAQ,EAAE,MAAM,EAAE,GACjB,QAAQ,GAAG,WAAW,GAAG,SAAS,CAQpC"}
1
+ {"version":3,"file":"screen-loader.d.ts","sourceRoot":"","sources":["../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EAAE,GACjB,QAAQ,GAAG,WAAW,GAAG,SAAS,CAQpC"}
@@ -6,13 +6,64 @@
6
6
  * Spec: docs/ModelRig/screening/spec.md §2.4 (S1 assembly knob, S2 x-trust).
7
7
  */
8
8
  Object.defineProperty(exports, "__esModule", { value: true });
9
+ exports.parseScreenBlock = parseScreenBlock;
10
+ exports.parseClassificationAndPhiGate = parseClassificationAndPhiGate;
9
11
  exports.pushUndeclaredVariableProblems = pushUndeclaredVariableProblems;
10
12
  exports.parseVariables = parseVariables;
11
13
  exports.parseGroundingAssembly = parseGroundingAssembly;
12
14
  const template_1 = require("./template");
15
+ const policy_1 = require("../screen/policy");
16
+ const phi_gate_1 = require("../screen/phi-gate");
17
+ const classification_1 = require("../artifacts/classification");
13
18
  function isRecord(v) {
14
19
  return typeof v === "object" && v !== null && !Array.isArray(v);
15
20
  }
21
+ /**
22
+ * Parse + resolve the optional `screen:` block (SC-1a, spec §4.1). Returns the
23
+ * resolved policy, or `undefined` when the block is absent OR `mode: off` (both
24
+ * ⇒ byte-identical, no screening). Pushes teaching-style problems for a
25
+ * malformed block: an unknown detector / action, or a `sources` key that loosens
26
+ * a default tier, is a LOAD error (validated at the SAME point as `require:` /
27
+ * `mask:`). A configured-but-unavailable optional classifier is NOT a load error
28
+ * — resolution degrades to T0 (spec §4.3), surfaced later on the receipt.
29
+ */
30
+ function parseScreenBlock(raw, problems) {
31
+ if (raw === undefined)
32
+ return undefined;
33
+ const shapeProblems = (0, policy_1.validateScreenPolicyShape)(raw);
34
+ if (shapeProblems.length > 0) {
35
+ for (const p of shapeProblems)
36
+ problems.push(`screen: ${p}`);
37
+ return undefined;
38
+ }
39
+ const policy = (0, policy_1.parseScreenPolicy)(raw);
40
+ if (policy.mode === "off")
41
+ return undefined; // off ⇒ no screening, byte-identical
42
+ return (0, policy_1.resolveScreenPolicy)(policy);
43
+ }
44
+ /**
45
+ * SC-2 (spec-sc2 §4): parse the route-level `classification` (rides the 00058
46
+ * `data_classification` enum — zero-DDL) and, for a `phi` value, GATE the route
47
+ * posture at load. A `phi` route must mask (≥ redact) AND (`require:
48
+ * zero_retention` OR a `sidecar` detector present), else it refuses to load with
49
+ * the specific teaching message (checkPhiPosture). Returns the parsed
50
+ * classification, or `undefined` when absent/invalid (an invalid value is a
51
+ * pushed problem). Runs at the same point as `require:` / `mask:` / `screen:`.
52
+ */
53
+ function parseClassificationAndPhiGate(raw, ctx, problems) {
54
+ if (raw === undefined || raw === null)
55
+ return undefined;
56
+ const norm = (0, classification_1.normalizeClassification)(raw);
57
+ if (norm === null || !classification_1.DATA_CLASSIFICATIONS.includes(norm)) {
58
+ problems.push(`classification "${String(raw)}" is not one of ${classification_1.DATA_CLASSIFICATIONS.join(" | ")}`);
59
+ return undefined;
60
+ }
61
+ const classification = norm;
62
+ for (const p of (0, phi_gate_1.checkPhiPosture)({ classification, mask: ctx.mask, screen: ctx.screen, require: ctx.require })) {
63
+ problems.push(`phi posture: ${p}`);
64
+ }
65
+ return classification;
66
+ }
16
67
  /** Push a problem for every `{{var}}` referenced in the system template or the
17
68
  * grounding query that was not declared in `prompt.variables`. Colocated with
18
69
  * the variable parser it validates. */
@@ -40,6 +40,8 @@ export interface SuccessMetaInput {
40
40
  readonly quality?: RunMeta["quality"];
41
41
  /** CS-1 mask receipt (spec §6) — counts-only, when the route masks. */
42
42
  readonly mask?: RunMeta["mask"];
43
+ /** SC-1a screen receipt (spec §5) — counts-only, when the route screens. */
44
+ readonly screen?: RunMeta["screen"];
43
45
  }
44
46
  /** The validated `RunMeta` for the accept path — `repairedBy` is null here (the
45
47
  * repair path builds its own meta), `validated` is always true. */
@@ -1 +1 @@
1
- {"version":3,"file":"accept.d.ts","sourceRoot":"","sources":["../../src/run/accept.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACtD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACtD,OAA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AM,CAAC;IACzB,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,eAAe,EAAE,OAAO,CAAC,MAAM,CAAC,YAAY,EAAE,MAAM,CAAC,CAAC,CAAC;IAChE,QAAQ,CAAC,aAAa,EAAE,MAAM,GAAG,IAAI,CAAC;IACtC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,wEAAwE;IACxE,QAAQ,CAAC,SAAS,CAAC,EAAE,OAAO,CAAC,WAAW,CAAC,CAAC;IAC1C,wEAAwE;IACxE,QAAQ,CAAC,SAAS,CAAC,EAAE,OAAO,CAAC,WAAW,CAAC,CAAC;IAC1C,uDAAuD;IACvD,QAAQ,CAAC,OAAO,CAAC,EAAE,OAAO,CAAC,SAAS,CAAC,CAAC;IACtC,uEAAuE;IACvE,QAAQ,CAAC,IAAI,CAAC,EAAE,OAAO,CAAC,MAAM,CAAC,CAAC;IAChC,4EAA4E;IAC5E,QAAQ,CAAC,MAAM,CAAC,EAAE,OAAO,CAAC,QAAQ,CAAC,CAAC;CACrC;AAED;mEACmE;AACnE,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,gBAAgB,GAAG,OAAO,CA0BjE"}
@@ -63,5 +63,6 @@ function buildSuccessMeta(input) {
63
63
  ...(input.grounding !== undefined ? { grounding: input.grounding } : {}),
64
64
  ...(input.quality !== undefined ? { quality: input.quality } : {}),
65
65
  ...(input.mask !== undefined ? { mask: input.mask } : {}),
66
+ ...(input.screen !== undefined ? { screen: input.screen } : {}),
66
67
  };
67
68
  }
@@ -17,6 +17,8 @@ import type { LadderKeyMinter } from "./ladder-key";
17
17
  import type { MaskReceipt, ResolvedMaskPolicy } from "../mask/types";
18
18
  import type { RunVault } from "../mask/vault";
19
19
  import { type MaskSeam } from "../mask/seam";
20
+ import { type SearchResultItem } from "./grounding";
21
+ import type { ResolvedScreenPolicy, ScreenReceipt } from "../screen/types";
20
22
  /** One telemetry attempt row's inputs — shared with run.ts's recordAttempt so
21
23
  * the tool-call helper here can record through the same closure. */
22
24
  export interface AttemptTelemetry {
@@ -56,6 +58,11 @@ export interface AttemptTelemetry {
56
58
  * this attempt, written to `inferences.mask` by record-attempt.ts. Present
57
59
  * only on a masked route; NEVER a matched value. Additive & optional. */
58
60
  readonly mask?: MaskReceipt;
61
+ /** SC-1a screen receipt (spec §5) — the counts-only screen summary for this
62
+ * attempt, merged onto `inferences.meta.screen` by record-attempt.ts (ZERO
63
+ * migration, §8). Present only on a screened route; NEVER a matched value.
64
+ * Additive & optional. */
65
+ readonly screen?: ScreenReceipt;
59
66
  }
60
67
  /** Assemble the recorder's `metaInputs` from a completed dispatch (WI-1) — the
61
68
  * adapter's native meta plus the rendered request (system+user+schema, hashed)
@@ -93,6 +100,11 @@ export interface PrimaryRequestParts {
93
100
  /** True when this candidate has native grounding AND the route requires it. */
94
101
  readonly nativeGrounded: boolean;
95
102
  readonly opts: RunOptions;
103
+ /** Screening SC-1a (spec §2.2): the grounding-inject results for THIS candidate
104
+ * (or null/absent when the run is not spotlight-grounded). Threaded so the
105
+ * dispatch helper can collect the `search`-source untrusted segments the screen
106
+ * engine scans + the assembler spotlights. Optional ⇒ treated as null. */
107
+ readonly injectedSources?: readonly SearchResultItem[] | null;
96
108
  /** CE-1 retry-drop: suppress a customer cache handle on THIS dispatch after a
97
109
  * prior `cache_invalid` on the same candidate carried it. Additive; absent /
98
110
  * false = normal (the handle applies when provider matches). */
@@ -118,28 +130,45 @@ export interface MaskContext {
118
130
  readonly policy: ResolvedMaskPolicy;
119
131
  readonly vault: RunVault;
120
132
  }
121
- /** The outcome of a build+mask+dispatch (CS-1 seam, spec §1.2). Carries the
122
- * (possibly masked) request, the adapter result, measured latency, and the
123
- * per-attempt {@link MaskSeam} the run loop uses to rehydrate the response and
124
- * build the receipt. `maskRefusal` is set when masking FAILED CLOSED
125
- * pre-dispatch (`block` found a match, or a detector threw in mask/block) — no
126
- * request was sent, and the run loop fails the run with `invariant_violation`. */
133
+ /** The per-run guards the run loop hands the dispatch seam: the CS-1 mask
134
+ * context and the SC-1a resolved screen policy (spec §4). Both null ⇒ the
135
+ * dispatch path is byte-identical to `buildAdapterRequest` + `dispatchCandidate`
136
+ * over the assembled request (the golden test). */
137
+ export interface RunGuards {
138
+ readonly mask: MaskContext | null;
139
+ readonly screen: ResolvedScreenPolicy | null;
140
+ }
141
+ /** Build the per-run guards for a route (called ONCE at run start). The mask
142
+ * vault is run-scoped (shared across attempts); the screen policy is resolved at
143
+ * load and reused. Null members ⇒ that guard is inert (byte-identical). */
144
+ export declare function buildRunGuards(route: RouteBundle, newVault: () => RunVault): RunGuards;
145
+ /** The outcome of an assemble+screen+mask+dispatch (CS-1/SC-1a seam). Carries the
146
+ * (possibly rewritten) request, the adapter result, measured latency, the
147
+ * per-attempt {@link MaskSeam} the run loop uses to rehydrate, and the counts-only
148
+ * screen receipt for `meta.screen`. `maskRefusal` is set when masking failed
149
+ * closed; `screenRefusal` when screening resolved `block` (spec §4.3) — in both
150
+ * cases NO request was sent and the run loop fails the run with
151
+ * `invariant_violation`. */
127
152
  export interface DispatchOutcome {
128
153
  readonly request: AdapterRequest;
129
154
  readonly result: AdapterResult;
130
155
  readonly latencyMs: number;
131
156
  readonly seam: MaskSeam | null;
132
157
  readonly maskRefusal?: "blocked" | "error";
158
+ readonly screenRefusal?: "block";
159
+ readonly screenReceipt?: ScreenReceipt;
133
160
  }
134
161
  /**
135
- * Build the primary AdapterRequest, mask its outgoing user slot when the route
136
- * has an active policy (spec §1.2 — "rewrites the AdapterRequest before dispatch
137
- * and rehydrates the AdapterResult after"), dispatch, and time it. With no mask
138
- * context this is byte-identical to `buildAdapterRequest` + `dispatchCandidate`
139
- * (the golden test). The trusted system slot is never masked (B3 keeps untrusted
140
- * content in the user path).
162
+ * Assemble the untrusted block, SCREEN it (spec §4 — the request-side seam),
163
+ * MASK the user slot (CS-1, screening runs BEFORE masking so mask tokens never
164
+ * confuse a detector), dispatch, and apply the output-side screen (canary /
165
+ * citations / Unicode strip + quarantine drop-count). With both guards null this
166
+ * is byte-identical to `buildAdapterRequest(assembled)` + `dispatchCandidate`
167
+ * (the golden test) — the untrusted-block assembly moved here from run.ts so the
168
+ * loop stays under the LOC cap (spec §10(i)). The trusted system slot is never
169
+ * masked (B3 keeps untrusted content in the user path).
141
170
  */
142
- export declare function buildDispatchMaybeMasked(adapter: ProviderAdapter, parts: PrimaryRequestParts, onDelta: StreamDeltaSink | undefined, mask: MaskContext | null): Promise<DispatchOutcome>;
171
+ export declare function buildDispatchMaybeMasked(adapter: ProviderAdapter, parts: PrimaryRequestParts, onDelta: StreamDeltaSink | undefined, guards: RunGuards): Promise<DispatchOutcome>;
143
172
  export interface ToolCallResultParts {
144
173
  readonly route: RouteBundle;
145
174
  readonly candidate: CandidateRef;
@@ -1 +1 @@
1
- {"version":3,"file":"dispatch.d.ts","sourceRoot":"","sources":["../../src/run/dispatch.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,KAAK,EACV,cAAc,EACd,aAAa,EACb,YAAY,EACZ,eAAe,EACf,cAAc,EACf,MAAM,mBAAmB,CAAC;AAE3B,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,KAAK,EAAE,WAAW,EAAE,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAC3F,OAAO,KAAK,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACxE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AAInE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AACpD,OAAO,KAAK,EAAE,WAAW,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AACrE,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAC9C,OAAO,EAAkB,KAAK,QAAQ,EAAE,MAAM,cAAc,CAAC;AAE7D;oEACoE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