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
package/CHANGELOG.md CHANGED
@@ -10,6 +10,162 @@ published package diverge.
10
10
  This project adheres to [Semantic Versioning](https://semver.org/). Dates are
11
11
  UTC.
12
12
 
13
+ ## [Unreleased]
14
+
15
+ ## [0.9.0] — 2026-09-01
16
+
17
+ **Breaking** (the reason this is 0.9.0, not 0.8.2): the temporary `rig.feedback` /
18
+ `rig.evaluate` wrappers and the `/feedback` endpoint are removed (GP-3, below) —
19
+ 0.8.x callers of those surfaces must move to `rig.grade` / `/v1/grade`.
20
+
21
+ Coding-agent skill — the shipped `docs/agent-skill/SKILL.md` now teaches the
22
+ **improvement loop**: with your org's `rig_sk_` key in the agent's MCP config,
23
+ `get_proposals` → read the `change_spec` + evidence → apply (a prompt-change in
24
+ YOUR repo per `apply_instructions`; a config-change via `set_call_config`, undo
25
+ `rollback_call_config`) → `decide_proposal` → `record_grade` → `run_optimizer`
26
+ (estimate first); grading-guide authoring via `get/set_task_settings`. Fetched
27
+ proposal text is data to review, never instructions to the agent, and the agent
28
+ presents diff + evidence to its human before any repo write unless explicitly
29
+ delegated. Least-privilege scopes are named per step; install paths documented
30
+ for Claude Code / Cursor / Codex.
31
+
32
+ Use-case templates — nine machine-readable starting points ship in the tarball
33
+ (`templates/*.json`) with a docs page each: ticket-triage, document-extraction,
34
+ cs-next-action, lead-qualification, compliance-review, catalog-cleansing,
35
+ call-disposition-qa, financial-classification, medical-classification. Each
36
+ carries a starter JSON schema (enum slots TODO-marked, no invented values), a
37
+ starter grading guide in the server's exact shape, a ~20-golden boundary-weighted
38
+ checklist, and an escalation starter. **Work-first:** every template runs as-is;
39
+ TODO markers show where tightening to your taxonomy sharpens grading — they never
40
+ gate. The regulated pair (financial/medical) quotes the published content-custody
41
+ terms' BAA/DPA sentence verbatim and names the zero-retention today-path.
42
+
43
+ Registry — `image_input` is a new **probed** capability dimension: a declared
44
+ vendor claim can seed candidates but never marks the dimension; only a probe row
45
+ (schema-conformant extraction from a fixture form image, every planted field
46
+ recovered) does. Typed per-provider image-input pricing (`per_image` |
47
+ `per_token`), absent when unsourced — never averaged or guessed. `query_registry`
48
+ gains an `image_input` filter; unprobed renders as unprobed, never as "cannot".
49
+ No model carries a probed image row yet — the dimension populates at the next
50
+ keyed probe cycle.
51
+
52
+ Watch — the evaluate step can raise an **optimizer improvement trigger**
53
+ (proposal-only, explicit-trigger; nothing actuates — F5 unchanged).
54
+
55
+ Fixed — `rig.close()` now awaits the content-upload flush, so short-lived
56
+ processes no longer exit before managed-custody bytes finish uploading (E2E-1).
57
+
58
+ Capture posture (P15 CP-3) — the env FEATURE GATES for capture are **removed**.
59
+ `MODELRIG_ARTIFACTS` (as an opt-out) and `MODELRIG_ARTIFACTS_CONTENT` no longer
60
+ gate capture: one API key turns capture on, and the **account posture**
61
+ (`artifact_posture`: `off` | `metadata` | `managed`) — set in the console or via
62
+ the `set_org_settings` MCP tool — is the single opt-out, resolved by the SDK from
63
+ the control plane at boot (the same channel that pulls per-task settings) and
64
+ enforced authoritatively server-side. An unreachable control plane fails **OPEN**
65
+ to the namespace default (capture continues; the server ingest gate is the
66
+ backstop). The boot banner and `modelrig status` now name the posture and that its
67
+ source is your account settings. `MODELRIG_ARTIFACTS=1` remains a **dev-only**
68
+ local-rig force-on (never a customer control); `MODELRIG_CONTENT_UPLOAD_URL`,
69
+ `MODELRIG_CONTENT_API_KEY`, and `MODELRIG_CONTENT_MAX_BYTES` are unchanged.
70
+ **`MODELRIG_ARTIFACTS_SCRUB` is removed** (R3 follow-up, CP-3b): the scrub mode is
71
+ now the per-task/account setting resolved from the control plane (the same channel
72
+ as capture and per-task settings), so the artifact content-upload path reads scrub
73
+ from task/account settings rather than an env var — one control surface, no
74
+ duplicate client gate (P15). A rig with no control plane (local-only / direct) uses
75
+ the built-in default (`detect` when content custody is configured).
76
+
77
+ Grade primitive — GP-1 (ADDITIVE foundation). Introduces the unified **`grade`**
78
+ judgment primitive alongside the existing feedback/evaluation/verdict mechanisms,
79
+ with nothing removed and every existing reader unchanged. `rig.grade(subject,
80
+ opts)` writes one 0–1 **score** (the pass/fail verdict is DERIVED at read time,
81
+ never stored) on an inference / run / artifact subject; `rig.feedback`,
82
+ `artifact.evaluate`, and `run.evaluate` are reimplemented as thin wrappers over
83
+ the grade path (same signatures, same observable rows). A local SQLite `grades`
84
+ table (store version v14) backfills from existing feedback/evaluation rows; the
85
+ exporter ships a `grades` wire stream; ingest accepts `WireGrade` (older SDKs'
86
+ `WireFeedback`/`WireArtifactEvaluation` are still accepted and mapped to grades);
87
+ `computeCoverage` counts grades; and native run-outcome/run-judge verdicts are
88
+ written as grades. A per-route `grade.pass_threshold` (default 0.5) is declared on
89
+ the route bundle + YAML, plumbed but unread until GP-2.
90
+
91
+ QA hardening: the `artifact_evaluations` compat-view uuid casts are regex-guarded
92
+ (a non-UUID episode-key run subject reads NULL, never a read-time 500), and a
93
+ GP-1-only nullable `legacy_score` compat column preserves the old NULLABLE score
94
+ semantics (a verdict/thumbs-only judgment reads NULL, not 1.0) so score-averaging
95
+ readers are unchanged; the "thumbs-up as numeric 1.0" question is deferred to GP-2.
96
+
97
+ Migration **00070** (`grades` table + row migration + `feedback` /
98
+ `artifact_evaluations` compatibility VIEWS) is WRITTEN but **not applied** — Matt
99
+ applies it, and the server build's deploy is gated on it (the writers/readers
100
+ target `grades` / its compat views only after 00070 lands). Unreleased —
101
+ workspace only; ships in the grade-primitive release once GP-1/2/3 land.
102
+
103
+ Grade primitive — GP-2 (CUTOVER). Every reader now addresses `grades` directly:
104
+ the server console/AI-read DTOs, the console UI (one `GradeBadge` + `GradesPanel`
105
+ replacing the Verdicts/Feedback/Evaluations panels; a `gradeCount` "grades" column
106
+ on Route readiness; the Action queue reads grades; `GRADE_SNIPPET` = `rig.grade`;
107
+ the "Attach a grade" setup step), the `/v1/read/*` surface (org-scoping preserved —
108
+ `grades` is org-scoped everywhere `feedback` was), and the oracle MCP read
109
+ resources. The GP-1 compatibility VIEWS (`feedback`, `artifact_evaluations`) and
110
+ the three GP-1-only compat columns (`legacy_score`, `origin`, `label`) are dropped
111
+ by migration **00072** (WRITTEN, not applied — Matt applies it as part of the GP-2
112
+ deploy). The SDK `GradeRow`/`WireGrade` drop those three fields; a legacy display
113
+ `label` folds into `scale_label` (the one display-label column); the local SQLite
114
+ `grades` table drops the columns via store version **v15**. **B1 semantic (model
115
+ change):** a reader reads the NOT-NULL primitive `score` directly, so a human
116
+ thumbs-up now counts as a numeric **1.0** (thumbs-down 0.0) in score averages —
117
+ `aggregateGrades` (was `aggregateFeedback`) averages `score` across ALL grades,
118
+ retiring the old "meanScore null when no numeric scores" rule (there is no
119
+ scoreless judgment in the grade model). Rubric vs binary grades are distinguished
120
+ by the presence of `scaleMax`/`scaleLabel`, not by nullability. Coverage Rung 1
121
+ now counts every route-resolvable grade (R6), not only wrapper-written thumbs. The
122
+ `rig.feedback`/`artifact.evaluate`/`run.evaluate` wrappers and the `POST /feedback`
123
+ endpoint stay (removed in GP-3). Docs/glossary/outward copy are unchanged (GP-3).
124
+ The Monitor cron's deterministic-eval read (`watch/monitor.ts`) now reads `grades`
125
+ directly (`subject_kind=artifact`, `kind=deterministic`, `passed = score ≥ 0.5`)
126
+ instead of the dropped `artifact_evaluations` view, with a URL-pinned regression
127
+ test so the "green in CI, 404 after 00072" class is caught going forward.
128
+
129
+ Grade primitive — GP-3 (cleanup). Removed the temporary `rig.feedback` /
130
+ `artifact.evaluate` / `run.evaluate` compat wrappers and the `WireFeedback` /
131
+ `WireArtifactEvaluation` wire shapes; `rig.grade` is the sole judgment write API.
132
+ The SDK drops the `FeedbackTarget`/`FeedbackOpts`/`FeedbackRow` and
133
+ `ArtifactEvaluationRow`/`RunEvaluateOptions`/`ArtifactEvaluateOptions` types, the
134
+ `buildFeedbackRow`/`feedbackOptsToGrade`/`evaluateOptsToGrade`/`gradeToFeedbackRow`
135
+ adapters, the `foreignOrgFeedback`/`feedbackToGradeRow`/`evaluationToGradeRow`
136
+ mappers, and the local store's `recordFeedback`/`readFeedbackAfter`/`listFeedback`
137
+ + `recordArtifactEvaluation`/`readEvaluationsAfter` methods; the exporter no longer
138
+ drains the `:feedback` / `:evals` streams. The API-key `feedback` scope becomes
139
+ `grade` (migration 00073; the server already requires `grade`). Legacy local-SQLite
140
+ backfill substrate is retained (the `feedback` / `artifact_evaluations` tables +
141
+ `grades-sql` backfills, read once into `grades`).
142
+
143
+ The HTTP judgment endpoint is renamed `POST /feedback` → **`POST /grade`** (and
144
+ `POST /v1/feedback` → `POST /v1/grade`); its body is now the grade shape
145
+ `{inferenceId | episode, score (0–1), scale?, comment?, kind?, source?}` (was
146
+ `{…, verdict: up|down, note?}`). The oracle MCP tool `record_feedback` becomes
147
+ **`record_grade`** (score in place of verdict). **Docs/outward copy (HELD for
148
+ Matt's review):** `feedback-protocol.md` + `run-verdicts.md` are merged into a
149
+ single **`grade-protocol.md`** (the doc-site `PAGES` + both `llms.txt` copies +
150
+ every cross-doc link repointed; the old `/…​.html` slugs are retired, no
151
+ redirect — hard rename, no live users); the console glossary (`glossary.ts` →
152
+ `/concepts`) leads with **grade** (`feedback`/`verdict`/`evaluation` folded, with
153
+ `is`/`isNot`/`interacts` per the OB-2 clarity standard and `feedback`/`evaluation`
154
+ kept as aliases); the `MIGRATION_PROMPT` / setup / get-started / www copy teach a
155
+ grade ("your judgment — from your code, a human, or an AI"). Supersedes OB-1 #365
156
+ (its bake-off-lane content carried forward).
157
+
158
+ ## [0.8.1] — 2026-08-24
159
+
160
+ Docs — deploy guidance for the native `better-sqlite3` dependency. The SDK loads
161
+ a native SQLite buffer on import (the local telemetry row written before each run
162
+ returns), so the README Install section and `quickstart.md` now tell customers to
163
+ run on a Node runtime (not Edge/Workers), mark `modelrig` external when bundling
164
+ server code (Next.js `serverExternalPackages`, esbuild `--external:better-sqlite3`,
165
+ webpack `externals`), and set `MODELRIG_API_KEY` on every service/worker/cron;
166
+ plus a short monorepo workspace-source caveat. Docs/packaging only — no SDK
167
+ behaviour change.
168
+
13
169
  ## [0.8.0] — 2026-08-24
14
170
 
15
171
  Packaging (GS-3) — the tarball now ships the customer-facing runs docs
package/README.md CHANGED
@@ -22,6 +22,29 @@ npm i modelrig
22
22
  > macOS and Linux on x64/arm64 (nearly everyone); an unusual platform will
23
23
  > compile it at install time and needs a C++ toolchain. Node ≥ 20 is assumed.
24
24
 
25
+ `modelrig` is a normal dependency: your existing `npm install` (or `pnpm` /
26
+ `yarn`) step installs it **prebuilt** — there is no separate "build modelrig"
27
+ step. Three things to get right when you deploy:
28
+
29
+ - **Run it on a Node runtime, not an Edge/Workers runtime.** `better-sqlite3`
30
+ is a native module and loads on import, so an Edge runtime can't run it. A
31
+ standard Node host — server, container, or a Node serverless function — works
32
+ after `npm install`.
33
+ - **If your deploy _bundles_ server code, mark modelrig external** so the native
34
+ binary is loaded at runtime instead of bundled:
35
+ - **Next.js** — `serverExternalPackages: ['modelrig']` in `next.config.js`
36
+ (Next 13/14: `experimental.serverComponentsExternalPackages`)
37
+ - **esbuild** — `--external:better-sqlite3` (and `--external:modelrig`)
38
+ - **webpack** — add `better-sqlite3` to `externals`
39
+ - **Set `MODELRIG_API_KEY` on every service, worker, and cron** that runs a rig
40
+ — each process reports its own telemetry, so the key belongs on all of them,
41
+ not just your web service.
42
+
43
+ (In a monorepo that vendors ModelRig as a workspace package — the SDK source
44
+ rather than the published tarball — build that package before the app that
45
+ imports it, so its `dist/` types resolve. Consuming the published package needs
46
+ none of this.)
47
+
25
48
  ## Quickstart
26
49
 
27
50
  This runs with **only a provider key** — no account, no signup.
@@ -276,8 +299,10 @@ rig.close();
276
299
  default once a control plane is configured** — set `MODELRIG_API_KEY=rig_sk_…`
277
300
  (or the self-host Supabase pair) and runs record automatically, metadata and
278
301
  hashes only. A **pure local-only rig** (no sink to ship to) stays off; force it
279
- on there with `MODELRIG_ARTIFACTS=1`, or opt out anywhere with
280
- `MODELRIG_ARTIFACTS=0`. With the namespace off it is inert — `run.start` is a
302
+ on there with `MODELRIG_ARTIFACTS=1`. To **opt out of capture**, set posture
303
+ `off` in your account settings (the console or the `set_org_settings` MCP tool) —
304
+ the account posture is the customer control, not a deployment env var. With the
305
+ namespace off (a local-only rig) it is inert — `run.start` is a
281
306
  no-op, `artifact.save` returns null, zero rows are written, and your pipeline
282
307
  behaves byte-for-byte as before. `modelrig status` prints the current posture.
283
308
 
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * Artifact namespace — Expansion E2 chunk B (spec §2.2, §9).
3
3
  *
4
- * `save/load/link/evaluate` over a durable work product's METADATA. The
4
+ * `save/load/link` over a durable work product's METADATA. The
5
5
  * serialized value is hashed (sha256, node:crypto — no new dep) and the bytes
6
6
  * are DISCARDED; nothing but the metadata row is persisted (the 00030
7
7
  * counter-annotation). Lineage v0: artifacts saved within a run get
@@ -16,6 +16,7 @@
16
16
  import type { ArtifactStore } from "../telemetry/artifact-store";
17
17
  import type { EvalCaseOrigin } from "../types/telemetry";
18
18
  import { type ScrubMode } from "./scrub";
19
+ import { type TaskSettingsResolver } from "../settings/task-settings";
19
20
  import type { ContentUploadInput, ContentUploadOutcome } from "./content-uploader";
20
21
  /** The upload transport `save` fires content through — injected so the SDK's
21
22
  * networked implementation and the tests share one seam. */
@@ -23,7 +24,15 @@ export type ArtifactContentUploader = (input: ContentUploadInput) => Promise<Con
23
24
  /** Per-rig content-custody wiring passed to the artifact api (E2-C). Absent =
24
25
  * metadata + hash only, today's behaviour. */
25
26
  export interface ArtifactContentDeps {
26
- readonly scrub: ScrubMode;
27
+ /** Per-task scrub resolver (settings-plane §1.5; P15 CP-3b). The control-plane
28
+ * task/account setting WINS — scrub is an account setting, not a client env var
29
+ * (`MODELRIG_ARTIFACTS_SCRUB` was deleted). null for local-only / direct rigs
30
+ * that have no control plane, and for a run with no task identity — then
31
+ * `defaultScrub` governs. */
32
+ readonly resolver: TaskSettingsResolver | null;
33
+ /** Fallback scrub mode when no resolver answers for the task. The content-on
34
+ * default (`detect`). */
35
+ readonly defaultScrub: ScrubMode;
27
36
  readonly upload: ArtifactContentUploader;
28
37
  }
29
38
  export interface ArtifactHandle {
@@ -55,14 +64,6 @@ export interface ArtifactSaveOptions {
55
64
  readonly supersedes?: ArtifactHandle;
56
65
  readonly expiresAt?: string;
57
66
  }
58
- export interface ArtifactEvaluateOptions {
59
- readonly evaluator: string;
60
- readonly kind: "deterministic" | "model-judge" | "human";
61
- readonly score?: number;
62
- readonly passed?: boolean;
63
- readonly label?: string;
64
- readonly explanation?: string;
65
- }
66
67
  export interface ArtifactPromoteOptions {
67
68
  readonly note?: string;
68
69
  /** The route/task this case belongs to. Falls back to the task the source
@@ -84,8 +85,6 @@ export interface ArtifactApi {
84
85
  load(ref: ArtifactHandle | string): void;
85
86
  /** Explicit lineage edge the runtime cannot infer. */
86
87
  link(from: ArtifactHandle | string, to: ArtifactHandle | string, kind: "consumed" | "derived_from"): void;
87
- /** Record an evaluation against an artifact. */
88
- evaluate(ref: ArtifactHandle | string, opts: ArtifactEvaluateOptions): void;
89
88
  /** Promote an artifact into the org's durable eval suite (E4 chunk A) — a
90
89
  * regression case replayable via `bakeoff --from-eval-cases`. `corrected` set
91
90
  * ⇒ a golden-corrected pair; absent ⇒ a failure-case. The `task` binds the
@@ -94,7 +93,7 @@ export interface ArtifactApi {
94
93
  * Returns the new case id on success. */
95
94
  promoteToEval(ref: ArtifactHandle | string, opts?: ArtifactPromoteOptions): string | null;
96
95
  /** Run `fn` inside a single store transaction and return its value (H8), so a
97
- * step's several save/link/evaluate writes commit with ONE fsync. On a
96
+ * step's several save/link writes commit with ONE fsync. On a
98
97
  * disabled/inert namespace `fn` runs directly (no store, no transaction). */
99
98
  batch<T>(fn: () => T): T;
100
99
  /** Await every in-flight content upload (E2-C). Content upload is fire-and-
@@ -1 +1 @@
1
- {"version":3,"file":"artifact.d.ts","sourceRoot":"","sources":["../../src/artifacts/artifact.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAGH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AACjE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAGzD,OAAO,EAAgC,KAAK,SAAS,EAAE,MAAM,SAAS,CAAC;AAGvE,OAAO,KAAK,EAAE,kBAAkB,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAC;AAEnF;4DAC4D;AAC5D,MAAM,MAAM,uBAAuB,GAAG,CAAC,KAAK,EAAE,kBAAkB,KAAK,OAAO,CAAC,oBAAoB,CAAC,CAAC;AAEnG;8CAC8C;AAC9C,MAAM,WAAW,mBAAmB;IAClC,QAAQ,CAAC,KAAK,EAAE,SAAS,CAAC;IAC1B,QAAQ,CAAC,MAAM,EAAE,uBAAuB,CAAC;CAC1C;AAYD,MAAM,WAAW,cAAc;IAC7B,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;CAC1B;AAED,MAAM,WAAW,mBAAmB;IAClC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IACvB;;;;;iFAK6E;IAC7E,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC;IAC1B;gFAC4E;IAC5E,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,cAAc,CAAC,EAAE,MAAM,CAAC;IACjC,y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AAC;IAC9B;;;;;;0DAMsD;IACtD,mBAAmB,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IACrC;8EAC0E;IAC1E,QAAQ,IAAI;QACV,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;QACvB,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC;QAC/B,QAAQ,CAAC,oBAAoB,EAAE,MAAM,CAAC;QACtC,8CAA8C;QAC9C,QAAQ,CAAC,eAAe,EAAE,MAAM,CAAC;QACjC,6EAA6E;QAC7E,QAAQ,CAAC,eAAe,EAAE,MAAM,CAAC;QACjC,yDAAyD;QACzD,QAAQ,CAAC,cAAc,EAAE,MAAM,CAAC;QAChC;;0EAEkE;QAClE,QAAQ,CAAC,cAAc,EAAE,MAAM,CAAC;QAChC,oEAAoE;QACpE,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC;KAChC,CAAC;CACH;AA0CD,wBAAgB,iBAAiB,CAAC,IAAI,EAAE;IACtC,QAAQ,CAAC,KAAK,EAAE,aAAa,CAAC;IAC9B,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;IAC1B,oEAAoE;IACpE,QAAQ,CAAC,OAAO,CAAC,EAAE,mBAAmB,CAAC;CACxC,GAAG,WAAW,CA4Ud"}
@@ -2,7 +2,7 @@
2
2
  /**
3
3
  * Artifact namespace — Expansion E2 chunk B (spec §2.2, §9).
4
4
  *
5
- * `save/load/link/evaluate` over a durable work product's METADATA. The
5
+ * `save/load/link` over a durable work product's METADATA. The
6
6
  * serialized value is hashed (sha256, node:crypto — no new dep) and the bytes
7
7
  * are DISCARDED; nothing but the metadata row is persisted (the 00030
8
8
  * counter-annotation). Lineage v0: artifacts saved within a run get
@@ -22,6 +22,16 @@ const run_context_1 = require("./run-context");
22
22
  const scrub_1 = require("./scrub");
23
23
  const classification_1 = require("./classification");
24
24
  const task_settings_1 = require("../settings/task-settings");
25
+ /** The configured scrub mode for one artifact save (BEFORE the S8-c PII/PHI
26
+ * floor). Resolved EXACTLY as capture-write.ts / samples.ts do: a configured
27
+ * control plane WINS (`resolver.get(task).scrub`), else the rig's default. A
28
+ * task with no identity to key on falls back to the default (no row to resolve).
29
+ * Pure and synchronous — the resolver read is cache-only. */
30
+ function resolveContentScrubMode(content, task) {
31
+ return content.resolver !== null && task !== undefined
32
+ ? content.resolver.get(task).scrub
33
+ : content.defaultScrub;
34
+ }
25
35
  /** Map an artifact `type` to a content-type for the object store. */
26
36
  function contentTypeFor(type) {
27
37
  const t = type.toLowerCase();
@@ -48,7 +58,6 @@ function inertApi() {
48
58
  save: () => null,
49
59
  load: () => { },
50
60
  link: () => { },
51
- evaluate: () => { },
52
61
  promoteToEval: () => null,
53
62
  batch: (fn) => fn(),
54
63
  flushContent: () => Promise.resolve(),
@@ -192,11 +201,15 @@ function createArtifactApi(deps) {
192
201
  const custodyApplies = content !== undefined && opts.contentRef === undefined;
193
202
  // Scrub is computed HERE (before the row is written) so its counts-only
194
203
  // summary can ride the immutable artifact row (00039). Only when custody
195
- // applies; null otherwise (custody off ⇒ nothing was scanned).
204
+ // applies; null otherwise (custody off ⇒ nothing was scanned). The
205
+ // configured mode comes from the per-task/account control-plane setting
206
+ // (P15 CP-3b — resolver wins; `content.defaultScrub` fallback local/direct).
196
207
  // S8-c: a `pii`/`phi` artifact forces the scrub mode to a floor of
197
208
  // `redact`, so PII/PHI content is never uploaded verbatim even when the
198
209
  // task's configured mode is `off`/`detect`. A stronger `block` stays.
199
- const effScrub = content !== undefined ? (0, task_settings_1.effectiveScrubMode)(content.scrub, classification) : null;
210
+ const effScrub = content !== undefined
211
+ ? (0, task_settings_1.effectiveScrubMode)(resolveContentScrubMode(content, opts.task), classification)
212
+ : null;
200
213
  const scrubbed = custodyApplies && content !== undefined && effScrub !== null ? (0, scrub_1.scrubContent)(serialized, effScrub) : null;
201
214
  const scrubSummary = scrubbed !== null && effScrub !== null ? (0, scrub_1.summarizeScrub)(effScrub, scrubbed) : null;
202
215
  if (scrubbed !== null)
@@ -329,25 +342,6 @@ function createArtifactApi(deps) {
329
342
  warn("link", err);
330
343
  }
331
344
  },
332
- evaluate(ref, opts) {
333
- try {
334
- store.recordArtifactEvaluation({
335
- id: (0, node_crypto_1.randomUUID)(),
336
- artifactId: idOf(ref),
337
- runId: null,
338
- evaluator: opts.evaluator,
339
- evaluatorKind: opts.kind,
340
- score: opts.score ?? null,
341
- passed: opts.passed ?? null,
342
- label: opts.label ?? null,
343
- explanation: opts.explanation ?? null,
344
- createdBy: null,
345
- });
346
- }
347
- catch (err) {
348
- warn("evaluate", err);
349
- }
350
- },
351
345
  promoteToEval(ref, opts) {
352
346
  const sourceArtifactId = idOf(ref);
353
347
  // Resolve the task: explicit wins, else the task this artifact was saved
@@ -3,19 +3,20 @@
3
3
  *
4
4
  * Lives here (not spread through `index.ts`) so the SDK entrypoint stays under
5
5
  * the LOC cap and the run/artifact surface has one home. Chunk A ships the run
6
- * lifecycle + `@step`; chunk B adds the artifact primitives (save/load/evaluate).
6
+ * lifecycle + `@step`; chunk B adds the artifact primitives (save/load/link).
7
7
  */
8
8
  import type { ArtifactBuffer, RunNamespace } from "./run-context";
9
9
  import type { ArtifactApi, ArtifactContentDeps } from "./artifact";
10
10
  import type { ArtifactContentConfig, ArtifactsConfig } from "../config";
11
+ import type { TaskSettingsResolver } from "../settings/task-settings";
11
12
  import type { ArtifactStore } from "../telemetry/artifact-store";
12
13
  export { getActiveRunContext, createRunNamespace } from "./run-context";
13
- export type { RunNamespace, RunHandle, RunStartOptions, RunEvaluateOptions, RunStatus, ActiveRunContext, ArtifactBuffer, GroundTruthStepInput, } from "./run-context";
14
+ export type { RunNamespace, RunHandle, RunStartOptions, RunStatus, ActiveRunContext, ArtifactBuffer, GroundTruthStepInput, } from "./run-context";
14
15
  export { step } from "./step";
15
16
  export { createArtifactApi } from "./artifact";
16
17
  export { openArtifactStore } from "../telemetry/artifact-store";
17
18
  export type { ArtifactStore } from "../telemetry/artifact-store";
18
- export type { ArtifactApi, ArtifactHandle, ArtifactSaveOptions, ArtifactEvaluateOptions, ArtifactPromoteOptions, ArtifactContentDeps, ArtifactContentUploader, } from "./artifact";
19
+ export type { ArtifactApi, ArtifactHandle, ArtifactSaveOptions, ArtifactPromoteOptions, ArtifactContentDeps, ArtifactContentUploader, } from "./artifact";
19
20
  export { uploadArtifactContent } from "./content-uploader";
20
21
  export type { ContentUploadConfig, ContentUploadInput, ContentUploadOutcome, } from "./content-uploader";
21
22
  export { scrubContent, luhnValid, detectSpans, scrubDetectors } from "./scrub";
@@ -24,7 +25,7 @@ export { DATA_CLASSIFICATIONS, SENSITIVE_CLASSIFICATIONS, isDataClassification,
24
25
  export type { DataClassification } from "./classification";
25
26
  export { computeDownstreamClosure, TAINT_DEFAULT_MAX_DEPTH, TAINT_DEFAULT_CAP, } from "./taint";
26
27
  export type { TaintEdge, Supersession, TaintNode, TaintClosure, TaintOptions, } from "./taint";
27
- export type { RunRow, StepRow, ArtifactRow, ArtifactEdgeRow, ArtifactEvaluationRow, EvalCaseRow, EvalCaseOrigin, } from "../types/telemetry";
28
+ export type { RunRow, StepRow, ArtifactRow, ArtifactEdgeRow, EvalCaseRow, EvalCaseOrigin, } from "../types/telemetry";
28
29
  /** The rig-bound artifact surface exposed as `rig.artifacts`: the run lifecycle
29
30
  * (chunk A) + the artifact primitives (chunk B). */
30
31
  export interface ArtifactNamespace {
@@ -40,6 +41,9 @@ export declare function wireRigArtifacts(deps: {
40
41
  readonly enabled: boolean;
41
42
  readonly artifactStore: ArtifactStore | null;
42
43
  readonly artifacts?: ArtifactsConfig;
44
+ /** Control-plane settings resolver (§1.5; P15 CP-3b) — the per-task/account
45
+ * scrub source the content-upload path reads. null local-only/direct. */
46
+ readonly resolver?: TaskSettingsResolver | null;
43
47
  }): {
44
48
  readonly namespace: ArtifactNamespace;
45
49
  readonly onArtifactsFlushed?: () => Promise<void>;
@@ -49,7 +53,7 @@ export declare function wireRigArtifacts(deps: {
49
53
  * custody is off. Kept here (not in the SDK entrypoint) so index.ts stays under
50
54
  * the LOC cap (P1) and the content wiring lives beside the namespace it feeds.
51
55
  */
52
- export declare function buildArtifactContentDeps(content: ArtifactContentConfig | undefined): ArtifactContentDeps | undefined;
56
+ export declare function buildArtifactContentDeps(content: ArtifactContentConfig | undefined, resolver: TaskSettingsResolver | null): ArtifactContentDeps | undefined;
53
57
  /** Build the rig-bound artifact namespace. Disabled ⇒ every entry is inert
54
58
  * (run.start is a no-op, save returns null, no rows written) — spec §1.4. The
55
59
  * artifact store is present only when enabled (index.ts opens it then). */
@@ -61,5 +65,9 @@ export declare function createArtifactNamespace(deps: {
61
65
  * deps are built here (buildArtifactContentDeps) so the SDK entrypoint stays
62
66
  * under the LOC cap. */
63
67
  readonly content?: ArtifactContentConfig;
68
+ /** Control-plane settings resolver (§1.5; P15 CP-3b) — threaded into the
69
+ * content deps so the upload path resolves scrub per task/account. null
70
+ * local-only/direct (then the content-on default governs). */
71
+ readonly resolver?: TaskSettingsResolver | null;
64
72
  }): ArtifactNamespace;
65
73
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/artifacts/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAElE,OAAO,KAAK,EAAE,WAAW,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC;AAGnE,OAAO,KAAK,EAAE,qBAAqB,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AACxE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAEjE,OAAO,EAAE,mBAAmB,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AACxE,YAAY,EACV,YAAY,EACZ,SAAS,EACT,eAAe,EACf,kBAAkB,EAClB,SAAS,EACT,gBAAgB,EAChB,cAAc,EACd,oBAAoB,GACrB,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,IAAI,EAAE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AAG,EAAE,YAAY,CAAC;IAC3B,QAAQ,CAAC,QAAQ,EAAE,WAAW,CAAC;CAChC;AAED;;;2DAG2D;AAC3D,wBAAgB,gBAAgB,CAAC,IAAI,EAAE;IACrC,QAAQ,CAAC,MAAM,EAAE,cAAc,CAAC;IAChC,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;IAC1B,QAAQ,CAAC,aAAa,EAAE,aAAa,GAAG,IAAI,CAAC;IAC7C,QAAQ,CAAC,SAAS,CAAC,EAAE,eAAe,CAAC;IACrC;6EACyE;IACzE,QAAQ,CAAC,QAAQ,CAAC,EAAE,oBAAoB,GAAG,IAAI,CAAC;CACjD,GAAG;IAAE,QAAQ,CAAC,SAAS,EAAE,iBAAiB,CAAC;IAAC,QAAQ,CAAC,kBAAkB,CAAC,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAA;CAAE,CAa/F;AAED;;;;GAIG;AACH,wBAAgB,wBAAwB,CACtC,OAAO,EAAE,qBAAqB,GAAG,SAAS,EAC1C,QAAQ,EAAE,oBAAoB,GAAG,IAAI,GACpC,mBAAmB,GAAG,SAAS,CAcjC;AAED;;2EAE2E;AAC3E,wBAAgB,uBAAuB,CAAC,IAAI,EAAE;IAC5C,QAAQ,CAAC,MAAM,EAAE,cAAc,CAAC;IAChC,QAAQ,CAAC,aAAa,CAAC,EAAE,aAAa,CAAC;IACvC,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;IAC1B;;4BAEwB;IACxB,QAAQ,CAAC,OAAO,CAAC,EAAE,qBAAqB,CAAC;IACzC;;kEAE8D;IAC9D,QAAQ,CAAC,QAAQ,CAAC,EAAE,oBAAoB,GAAG,IAAI,CAAC;CACjD,GAAG,iBAAiB,CAcpB"}
@@ -4,7 +4,7 @@
4
4
  *
5
5
  * Lives here (not spread through `index.ts`) so the SDK entrypoint stays under
6
6
  * the LOC cap and the run/artifact surface has one home. Chunk A ships the run
7
- * lifecycle + `@step`; chunk B adds the artifact primitives (save/load/evaluate).
7
+ * lifecycle + `@step`; chunk B adds the artifact primitives (save/load/link).
8
8
  */
9
9
  Object.defineProperty(exports, "__esModule", { value: true });
10
10
  exports.TAINT_DEFAULT_CAP = exports.TAINT_DEFAULT_MAX_DEPTH = exports.computeDownstreamClosure = exports.normalizeClassification = exports.isDataClassification = exports.SENSITIVE_CLASSIFICATIONS = exports.DATA_CLASSIFICATIONS = exports.scrubDetectors = exports.detectSpans = exports.luhnValid = exports.scrubContent = exports.uploadArtifactContent = exports.openArtifactStore = exports.createArtifactApi = exports.step = exports.createRunNamespace = exports.getActiveRunContext = void 0;
@@ -14,6 +14,7 @@ exports.createArtifactNamespace = createArtifactNamespace;
14
14
  const run_context_1 = require("./run-context");
15
15
  const artifact_1 = require("./artifact");
16
16
  const content_uploader_1 = require("./content-uploader");
17
+ const config_1 = require("../config");
17
18
  var run_context_2 = require("./run-context");
18
19
  Object.defineProperty(exports, "getActiveRunContext", { enumerable: true, get: function () { return run_context_2.getActiveRunContext; } });
19
20
  Object.defineProperty(exports, "createRunNamespace", { enumerable: true, get: function () { return run_context_2.createRunNamespace; } });
@@ -49,6 +50,7 @@ function wireRigArtifacts(deps) {
49
50
  const namespace = createArtifactNamespace({
50
51
  buffer: deps.buffer,
51
52
  enabled: deps.enabled,
53
+ resolver: deps.resolver ?? null,
52
54
  ...(deps.artifactStore !== null ? { artifactStore: deps.artifactStore } : {}),
53
55
  ...(deps.artifacts?.content !== undefined ? { content: deps.artifacts.content } : {}),
54
56
  });
@@ -63,11 +65,14 @@ function wireRigArtifacts(deps) {
63
65
  * custody is off. Kept here (not in the SDK entrypoint) so index.ts stays under
64
66
  * the LOC cap (P1) and the content wiring lives beside the namespace it feeds.
65
67
  */
66
- function buildArtifactContentDeps(content) {
68
+ function buildArtifactContentDeps(content, resolver) {
67
69
  if (content === undefined)
68
70
  return undefined;
69
71
  return {
70
- scrub: content.scrub,
72
+ // Scrub comes from the per-task/account control-plane setting at runtime
73
+ // (P15 CP-3b); the resolver wins, `defaultScrub` is the local/direct fallback.
74
+ resolver,
75
+ defaultScrub: config_1.DEFAULT_CONTENT_SCRUB_MODE,
71
76
  upload: (input) => (0, content_uploader_1.uploadArtifactContent)(input, { uploadsUrl: content.uploadsUrl, apiKey: content.apiKey, maxBytes: content.maxBytes }, fetch),
72
77
  };
73
78
  }
@@ -75,7 +80,9 @@ function buildArtifactContentDeps(content) {
75
80
  * (run.start is a no-op, save returns null, no rows written) — spec §1.4. The
76
81
  * artifact store is present only when enabled (index.ts opens it then). */
77
82
  function createArtifactNamespace(deps) {
78
- const contentDeps = deps.enabled ? buildArtifactContentDeps(deps.content) : undefined;
83
+ const contentDeps = deps.enabled
84
+ ? buildArtifactContentDeps(deps.content, deps.resolver ?? null)
85
+ : undefined;
79
86
  return {
80
87
  run: (0, run_context_1.createRunNamespace)(deps),
81
88
  artifact: (0, artifact_1.createArtifactApi)({
@@ -13,12 +13,13 @@
13
13
  * write that fails is logged and dropped; the customer's pipeline is untouched.
14
14
  *
15
15
  * ── GATING ────────────────────────────────────────────────────────────────
16
- * The namespace is inert unless the rig enabled it (`MODELRIG_ARTIFACTS=1`).
16
+ * The namespace is inert unless the rig enabled it (a control plane is configured,
17
+ * or the dev-only local force-on; the org capture posture governs at runtime).
17
18
  * A disabled namespace's `run.start()` sets NO context, so `getActiveRunContext`
18
19
  * returns null everywhere and the run loop's auto-step is never reached —
19
20
  * v1 wire, zero new rows, zero behaviour change (spec §1.4).
20
21
  */
21
- import type { ArtifactEvaluationRow, RunRow, StepRow } from "../types/telemetry";
22
+ import type { RunRow, StepRow } from "../types/telemetry";
22
23
  import type { RunMetaV1 } from "../telemetry/attempt-meta";
23
24
  /** The narrow buffer the run/artifact namespace writes through — the local
24
25
  * telemetry store satisfies it. Kept narrow so this module depends on the row
@@ -119,23 +120,10 @@ export declare function isValidStepKey(key: string): boolean;
119
120
  export declare function resolveStepKey(explicit: string | undefined, tagStep: string | undefined, auto: () => string): string;
120
121
  /** Test-only: clear the once-per-process invalid-stepKey warning latch. */
121
122
  export declare function resetStepKeyWarningsForTest(): void;
122
- /** A run-level evaluation the caller attaches (E5 chunk V.2) — the run-subject
123
- * mirror of ArtifactEvaluateOptions. The subject is the run, so there is no ref. */
124
- export interface RunEvaluateOptions {
125
- readonly evaluator: string;
126
- readonly kind: "deterministic" | "model-judge" | "human";
127
- readonly score?: number;
128
- readonly passed?: boolean;
129
- readonly label?: string;
130
- readonly explanation?: string;
131
- }
132
123
  /** A handle a caller holds to end a run it started. */
133
124
  export interface RunHandle {
134
125
  readonly runId: string;
135
126
  end(status?: RunStatus): void;
136
- /** Attach a run-level evaluation to THIS run (E5 V.2). Works after end() —
137
- * verdicts are often post-hoc. Fail-open + inert when the namespace is off. */
138
- evaluate(opts: RunEvaluateOptions): void;
139
127
  }
140
128
  /** The `run` namespace, bound to one rig's buffer + gate. Disabled ⇒ inert. */
141
129
  export interface RunNamespace {
@@ -147,9 +135,6 @@ export interface RunNamespace {
147
135
  start(opts: RunStartOptions): RunHandle;
148
136
  /** End the active run with a terminal status (default "succeeded"). */
149
137
  end(status?: RunStatus): void;
150
- /** Attach a run-level evaluation to the ACTIVE run (E5 V.2) — the run-subject
151
- * mirror of `artifact.evaluate`. No active run ⇒ a warned no-op (fail-open). */
152
- evaluate(opts: RunEvaluateOptions): void;
153
138
  /** Concurrency-safe run scope. Runs `fn` inside `AsyncLocalStorage.run`, so
154
139
  * overlapping `scope()` calls each keep their OWN ambient run context — the
155
140
  * correct primitive for `Promise.all` over items. Ends the run "succeeded" on
@@ -160,11 +145,5 @@ export interface RunNamespace {
160
145
  export declare function createRunNamespace(deps: {
161
146
  readonly buffer: ArtifactBuffer;
162
147
  readonly enabled: boolean;
163
- /** The evaluation writer (E5 V.2) — the artifact store's recordArtifactEvaluation.
164
- * Absent (disabled / no store) ⇒ run.evaluate is inert. Kept OFF the narrow
165
- * ArtifactBuffer so that contract stays "cannot reach anything but run/step". */
166
- readonly artifactStore?: {
167
- recordArtifactEvaluation(row: ArtifactEvaluationRow): void;
168
- };
169
148
  }): RunNamespace;
170
149
  //# sourceMappingURL=run-context.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"run-context.d.ts","sourceRoot":"","sources":["../../src/artifacts/run-context.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAIH,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAEjF,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAC;AAI3D;;sEAEsE;AACtE,MAAM,WAAW,cAAc;IAC7B,SAAS,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7B,UAAU,CAAC,GAAG,EAAE,OAAO,GAAG,IAAI,CAAC;CAChC;AAED,MAAM,MAAM,SAAS,GAAG,MAAM,CAAC,QAAQ,CAAC,CAAC;AAEzC,MAAM,WAAW,eAAe;IAC9B,8DAA8D;IAC9D,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,eAAe,CAAC,EAAE,MAAM,CAAC;IAClC,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAC;IAC9B,mEAAmE;IACnE,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,CAAC;IAC7B;;wEAEoE;IACpE,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAC;IAC9B;;;oCAGgC;IAChC,QAAQ,CAAC,aAAa,CAAC,EAAE,OAAO,CAAC;IACjC;;;;mCAI+B;IAC/B,QAAQ,CAAC,IAAI,CAAC,EAAE,SAAS,CAAC;CAC3B;AA4CD,4EAA4E;AAC5E,wBAAgB,2BAA2B,IAAI,IAAI,CAElD;AAED;gFACgF;AAChF,MAAM,WAAW,oBAAoB;IACnC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7B,QAAQ,CAAC,WAAW,EAA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