modelrig 0.8.1 → 0.10.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 (382) hide show
  1. package/CHANGELOG.md +324 -0
  2. package/README.md +55 -29
  3. package/data/PROVENANCE.md +14 -0
  4. package/data/pricing-map.json +26 -0
  5. package/dist/adapters/attempt-meta-map.d.ts +8 -1
  6. package/dist/adapters/attempt-meta-map.d.ts.map +1 -1
  7. package/dist/adapters/attempt-meta-map.js +4 -0
  8. package/dist/adapters/build-adapters.js +2 -2
  9. package/dist/adapters/gemini.d.ts +28 -1
  10. package/dist/adapters/gemini.d.ts.map +1 -1
  11. package/dist/adapters/gemini.js +38 -9
  12. package/dist/adapters/grok.d.ts.map +1 -1
  13. package/dist/adapters/grok.js +53 -4
  14. package/dist/adapters/openai-compat.d.ts +8 -2
  15. package/dist/adapters/openai-compat.d.ts.map +1 -1
  16. package/dist/adapters/openai-compat.js +8 -1
  17. package/dist/adapters/openai-stream.d.ts +10 -2
  18. package/dist/adapters/openai-stream.d.ts.map +1 -1
  19. package/dist/adapters/openai-stream.js +5 -1
  20. package/dist/adapters/openai.d.ts +10 -1
  21. package/dist/adapters/openai.d.ts.map +1 -1
  22. package/dist/adapters/openai.js +57 -7
  23. package/dist/adapters/responses-api.d.ts +61 -0
  24. package/dist/adapters/responses-api.d.ts.map +1 -0
  25. package/dist/adapters/responses-api.js +124 -0
  26. package/dist/artifacts/artifact.d.ts +31 -12
  27. package/dist/artifacts/artifact.d.ts.map +1 -1
  28. package/dist/artifacts/artifact.js +218 -188
  29. package/dist/artifacts/index.d.ts +15 -5
  30. package/dist/artifacts/index.d.ts.map +1 -1
  31. package/dist/artifacts/index.js +19 -5
  32. package/dist/artifacts/run-context.d.ts +3 -24
  33. package/dist/artifacts/run-context.d.ts.map +1 -1
  34. package/dist/artifacts/run-context.js +3 -39
  35. package/dist/bakeoff/engine.d.ts +29 -0
  36. package/dist/bakeoff/engine.d.ts.map +1 -1
  37. package/dist/bakeoff/engine.js +47 -0
  38. package/dist/bakeoff/eval-cases-rig.d.ts +36 -0
  39. package/dist/bakeoff/eval-cases-rig.d.ts.map +1 -0
  40. package/dist/bakeoff/eval-cases-rig.js +27 -0
  41. package/dist/bakeoff/eval-cases.d.ts +19 -0
  42. package/dist/bakeoff/eval-cases.d.ts.map +1 -1
  43. package/dist/bakeoff/eval-cases.js +18 -1
  44. package/dist/bakeoff/golden-judge.d.ts +47 -0
  45. package/dist/bakeoff/golden-judge.d.ts.map +1 -0
  46. package/dist/bakeoff/golden-judge.js +49 -0
  47. package/dist/bakeoff/groundedness.d.ts +58 -0
  48. package/dist/bakeoff/groundedness.d.ts.map +1 -0
  49. package/dist/bakeoff/groundedness.js +165 -0
  50. package/dist/bakeoff/quality.d.ts +43 -0
  51. package/dist/bakeoff/quality.d.ts.map +1 -1
  52. package/dist/bakeoff/quality.js +31 -0
  53. package/dist/bakeoff/replay.d.ts +11 -0
  54. package/dist/bakeoff/replay.d.ts.map +1 -1
  55. package/dist/bakeoff/replay.js +12 -0
  56. package/dist/bakeoff/report.d.ts +7 -0
  57. package/dist/bakeoff/report.d.ts.map +1 -1
  58. package/dist/bakeoff/report.js +26 -0
  59. package/dist/cli-judge.d.ts +12 -0
  60. package/dist/cli-judge.d.ts.map +1 -0
  61. package/dist/cli-judge.js +48 -0
  62. package/dist/cli.d.ts.map +1 -1
  63. package/dist/cli.js +22 -42
  64. package/dist/config.d.ts +85 -29
  65. package/dist/config.d.ts.map +1 -1
  66. package/dist/config.js +109 -47
  67. package/dist/detect/detector.d.ts +4 -2
  68. package/dist/detect/detector.d.ts.map +1 -1
  69. package/dist/detect/safe-harbor.d.ts +57 -0
  70. package/dist/detect/safe-harbor.d.ts.map +1 -0
  71. package/dist/detect/safe-harbor.js +278 -0
  72. package/dist/doctor-cli.d.ts +7 -0
  73. package/dist/doctor-cli.d.ts.map +1 -0
  74. package/dist/doctor-cli.js +67 -0
  75. package/dist/doctor-preflight.d.ts +52 -0
  76. package/dist/doctor-preflight.d.ts.map +1 -0
  77. package/dist/doctor-preflight.js +112 -0
  78. package/dist/feedback/coverage.d.ts +11 -8
  79. package/dist/feedback/coverage.d.ts.map +1 -1
  80. package/dist/feedback/coverage.js +29 -16
  81. package/dist/feedback/grade.d.ts +58 -0
  82. package/dist/feedback/grade.d.ts.map +1 -0
  83. package/dist/feedback/grade.js +67 -0
  84. package/dist/gateway/http-protocol.d.ts +20 -1
  85. package/dist/gateway/http-protocol.d.ts.map +1 -1
  86. package/dist/gateway/http-protocol.js +1 -1
  87. package/dist/gateway/serve-client.d.ts +99 -0
  88. package/dist/gateway/serve-client.d.ts.map +1 -0
  89. package/dist/gateway/serve-client.js +360 -0
  90. package/dist/index.d.ts +68 -29
  91. package/dist/index.d.ts.map +1 -1
  92. package/dist/index.js +167 -46
  93. package/dist/init/observe-cli.js +1 -1
  94. package/dist/init/observe.d.ts +2 -2
  95. package/dist/init/observe.d.ts.map +1 -1
  96. package/dist/init/observe.js +11 -7
  97. package/dist/mask/arm.d.ts +112 -0
  98. package/dist/mask/arm.d.ts.map +1 -0
  99. package/dist/mask/arm.js +179 -0
  100. package/dist/mask/index.d.ts +2 -0
  101. package/dist/mask/index.d.ts.map +1 -1
  102. package/dist/mask/index.js +7 -1
  103. package/dist/mask/mask-policy-cli.d.ts +12 -4
  104. package/dist/mask/mask-policy-cli.d.ts.map +1 -1
  105. package/dist/mask/mask-policy-cli.js +34 -9
  106. package/dist/prompts/manifest.d.ts +128 -0
  107. package/dist/prompts/manifest.d.ts.map +1 -0
  108. package/dist/prompts/manifest.js +214 -0
  109. package/dist/prompts/prompt-fetch.d.ts +84 -0
  110. package/dist/prompts/prompt-fetch.d.ts.map +1 -0
  111. package/dist/prompts/prompt-fetch.js +120 -0
  112. package/dist/prompts/prompt-resolve.d.ts +76 -0
  113. package/dist/prompts/prompt-resolve.d.ts.map +1 -0
  114. package/dist/prompts/prompt-resolve.js +93 -0
  115. package/dist/prompts/slot-resolver.d.ts +91 -0
  116. package/dist/prompts/slot-resolver.d.ts.map +1 -0
  117. package/dist/prompts/slot-resolver.js +135 -0
  118. package/dist/prompts/tools-register.d.ts +60 -0
  119. package/dist/prompts/tools-register.d.ts.map +1 -0
  120. package/dist/prompts/tools-register.js +48 -0
  121. package/dist/prompts/version-hash.d.ts +29 -0
  122. package/dist/prompts/version-hash.d.ts.map +1 -0
  123. package/dist/prompts/version-hash.js +54 -0
  124. package/dist/prompts-export-cli.d.ts +21 -0
  125. package/dist/prompts-export-cli.d.ts.map +1 -0
  126. package/dist/prompts-export-cli.js +130 -0
  127. package/dist/query/grammar.d.ts +2 -2
  128. package/dist/query/grammar.d.ts.map +1 -1
  129. package/dist/query/grammar.js +3 -1
  130. package/dist/query/saved.d.ts +13 -0
  131. package/dist/query/saved.d.ts.map +1 -1
  132. package/dist/query/saved.js +67 -1
  133. package/dist/receipts/types.d.ts +1 -1
  134. package/dist/receipts/types.d.ts.map +1 -1
  135. package/dist/receipts/types.js +1 -0
  136. package/dist/registry/build.d.ts +43 -1
  137. package/dist/registry/build.d.ts.map +1 -1
  138. package/dist/registry/build.js +52 -0
  139. package/dist/registry/cache-policy.d.ts.map +1 -1
  140. package/dist/registry/cache-policy.js +22 -0
  141. package/dist/registry/pricing-shape.d.ts +67 -8
  142. package/dist/registry/pricing-shape.d.ts.map +1 -1
  143. package/dist/registry/pricing-shape.js +50 -13
  144. package/dist/registry/pricing.d.ts +6 -5
  145. package/dist/registry/pricing.d.ts.map +1 -1
  146. package/dist/registry/pricing.js +9 -5
  147. package/dist/registry/rows.d.ts.map +1 -1
  148. package/dist/registry/rows.js +1 -0
  149. package/dist/registry/select.d.ts +6 -1
  150. package/dist/registry/select.d.ts.map +1 -1
  151. package/dist/registry/select.js +11 -0
  152. package/dist/routes/call-config.d.ts +199 -0
  153. package/dist/routes/call-config.d.ts.map +1 -0
  154. package/dist/routes/call-config.js +343 -0
  155. package/dist/routes/destination-loader.d.ts +16 -0
  156. package/dist/routes/destination-loader.d.ts.map +1 -0
  157. package/dist/routes/destination-loader.js +29 -0
  158. package/dist/routes/draft.d.ts +7 -0
  159. package/dist/routes/draft.d.ts.map +1 -1
  160. package/dist/routes/draft.js +12 -0
  161. package/dist/routes/loader.d.ts.map +1 -1
  162. package/dist/routes/loader.js +31 -56
  163. package/dist/routes/objective-loader.d.ts +12 -0
  164. package/dist/routes/objective-loader.d.ts.map +1 -1
  165. package/dist/routes/objective-loader.js +82 -0
  166. package/dist/routes/output-loader.d.ts +42 -0
  167. package/dist/routes/output-loader.d.ts.map +1 -0
  168. package/dist/routes/output-loader.js +112 -0
  169. package/dist/routes/prompt-loader.d.ts +49 -0
  170. package/dist/routes/prompt-loader.d.ts.map +1 -0
  171. package/dist/routes/prompt-loader.js +113 -0
  172. package/dist/routes/resolved-bundle.d.ts +69 -0
  173. package/dist/routes/resolved-bundle.d.ts.map +1 -1
  174. package/dist/routes/resolved-bundle.js +76 -0
  175. package/dist/routes/screen-loader.d.ts +29 -1
  176. package/dist/routes/screen-loader.d.ts.map +1 -1
  177. package/dist/routes/screen-loader.js +59 -1
  178. package/dist/run/accept.d.ts +5 -0
  179. package/dist/run/accept.d.ts.map +1 -1
  180. package/dist/run/accept.js +2 -0
  181. package/dist/run/cost.d.ts +31 -2
  182. package/dist/run/cost.d.ts.map +1 -1
  183. package/dist/run/cost.js +57 -2
  184. package/dist/run/destination.d.ts +39 -0
  185. package/dist/run/destination.d.ts.map +1 -0
  186. package/dist/run/destination.js +45 -0
  187. package/dist/run/dispatch.d.ts +67 -16
  188. package/dist/run/dispatch.d.ts.map +1 -1
  189. package/dist/run/dispatch.js +133 -29
  190. package/dist/run/grounding.d.ts +28 -2
  191. package/dist/run/grounding.d.ts.map +1 -1
  192. package/dist/run/grounding.js +54 -10
  193. package/dist/run/raw-defaults.d.ts.map +1 -1
  194. package/dist/run/raw-defaults.js +6 -1
  195. package/dist/run/raw-finalize.d.ts +50 -0
  196. package/dist/run/raw-finalize.d.ts.map +1 -0
  197. package/dist/run/raw-finalize.js +266 -0
  198. package/dist/run/raw-knobs.d.ts +36 -0
  199. package/dist/run/raw-knobs.d.ts.map +1 -0
  200. package/dist/run/raw-knobs.js +99 -0
  201. package/dist/run/raw-request.d.ts +24 -0
  202. package/dist/run/raw-request.d.ts.map +1 -0
  203. package/dist/run/raw-request.js +69 -0
  204. package/dist/run/raw-schema.d.ts +76 -0
  205. package/dist/run/raw-schema.d.ts.map +1 -0
  206. package/dist/run/raw-schema.js +166 -0
  207. package/dist/run/raw-search-cost.d.ts +48 -0
  208. package/dist/run/raw-search-cost.d.ts.map +1 -0
  209. package/dist/run/raw-search-cost.js +78 -0
  210. package/dist/run/raw-support.d.ts +64 -6
  211. package/dist/run/raw-support.d.ts.map +1 -1
  212. package/dist/run/raw-support.js +84 -11
  213. package/dist/run/raw.d.ts +25 -26
  214. package/dist/run/raw.d.ts.map +1 -1
  215. package/dist/run/raw.js +30 -351
  216. package/dist/run/record-attempt.d.ts +12 -0
  217. package/dist/run/record-attempt.d.ts.map +1 -1
  218. package/dist/run/record-attempt.js +30 -12
  219. package/dist/run/repair-attempt.d.ts +68 -0
  220. package/dist/run/repair-attempt.d.ts.map +1 -0
  221. package/dist/run/repair-attempt.js +180 -0
  222. package/dist/run/resolve-destination.d.ts +49 -0
  223. package/dist/run/resolve-destination.d.ts.map +1 -0
  224. package/dist/run/resolve-destination.js +76 -0
  225. package/dist/run/routing-docs.d.ts.map +1 -1
  226. package/dist/run/routing-docs.js +10 -5
  227. package/dist/run/run.d.ts +30 -1
  228. package/dist/run/run.d.ts.map +1 -1
  229. package/dist/run/run.js +94 -172
  230. package/dist/run/telemetry-row.d.ts +92 -0
  231. package/dist/run/telemetry-row.d.ts.map +1 -0
  232. package/dist/run/telemetry-row.js +81 -0
  233. package/dist/run/validate.d.ts +12 -1
  234. package/dist/run/validate.d.ts.map +1 -1
  235. package/dist/run/validate.js +31 -0
  236. package/dist/run/web-search-pricing.d.ts +43 -0
  237. package/dist/run/web-search-pricing.d.ts.map +1 -0
  238. package/dist/run/web-search-pricing.js +56 -0
  239. package/dist/savings/odometer.d.ts +4 -0
  240. package/dist/savings/odometer.d.ts.map +1 -1
  241. package/dist/savings/odometer.js +20 -1
  242. package/dist/savings/swap-execute.d.ts +7 -0
  243. package/dist/savings/swap-execute.d.ts.map +1 -1
  244. package/dist/savings/swap-execute.js +30 -0
  245. package/dist/savings/swaps-client.d.ts +10 -0
  246. package/dist/savings/swaps-client.d.ts.map +1 -1
  247. package/dist/screen/fixtures/probe-corpora.d.ts +23 -0
  248. package/dist/screen/fixtures/probe-corpora.d.ts.map +1 -0
  249. package/dist/screen/fixtures/probe-corpora.js +69 -0
  250. package/dist/screen/index.d.ts +21 -0
  251. package/dist/screen/index.d.ts.map +1 -0
  252. package/dist/screen/index.js +64 -0
  253. package/dist/screen/model-screen.d.ts +111 -0
  254. package/dist/screen/model-screen.d.ts.map +1 -0
  255. package/dist/screen/model-screen.js +178 -0
  256. package/dist/screen/patterns.d.ts +51 -0
  257. package/dist/screen/patterns.d.ts.map +1 -0
  258. package/dist/screen/patterns.js +151 -0
  259. package/dist/screen/phi-gate.d.ts +52 -0
  260. package/dist/screen/phi-gate.d.ts.map +1 -0
  261. package/dist/screen/phi-gate.js +86 -0
  262. package/dist/screen/policy.d.ts +71 -0
  263. package/dist/screen/policy.d.ts.map +1 -0
  264. package/dist/screen/policy.js +334 -0
  265. package/dist/screen/probe.d.ts +118 -0
  266. package/dist/screen/probe.d.ts.map +1 -0
  267. package/dist/screen/probe.js +132 -0
  268. package/dist/screen/screen-cli.d.ts +16 -0
  269. package/dist/screen/screen-cli.d.ts.map +1 -0
  270. package/dist/screen/screen-cli.js +178 -0
  271. package/dist/screen/screen.d.ts +99 -0
  272. package/dist/screen/screen.d.ts.map +1 -0
  273. package/dist/screen/screen.js +0 -0
  274. package/dist/screen/sidecar.d.ts +69 -0
  275. package/dist/screen/sidecar.d.ts.map +1 -0
  276. package/dist/screen/sidecar.js +145 -0
  277. package/dist/screen/types.d.ts +43 -2
  278. package/dist/screen/types.d.ts.map +1 -1
  279. package/dist/settings/api-fetcher.d.ts +14 -3
  280. package/dist/settings/api-fetcher.d.ts.map +1 -1
  281. package/dist/settings/api-fetcher.js +61 -10
  282. package/dist/settings/grading-guide.d.ts +102 -0
  283. package/dist/settings/grading-guide.d.ts.map +1 -0
  284. package/dist/settings/grading-guide.js +23 -0
  285. package/dist/settings/index.d.ts +3 -2
  286. package/dist/settings/index.d.ts.map +1 -1
  287. package/dist/settings/index.js +2 -1
  288. package/dist/settings/task-settings.d.ts +44 -7
  289. package/dist/settings/task-settings.d.ts.map +1 -1
  290. package/dist/settings/task-settings.js +53 -12
  291. package/dist/status.d.ts +32 -20
  292. package/dist/status.d.ts.map +1 -1
  293. package/dist/status.js +51 -30
  294. package/dist/telemetry/artifact-store.d.ts +5 -6
  295. package/dist/telemetry/artifact-store.d.ts.map +1 -1
  296. package/dist/telemetry/artifact-store.js +21 -24
  297. package/dist/telemetry/attempt-meta.d.ts +76 -1
  298. package/dist/telemetry/attempt-meta.d.ts.map +1 -1
  299. package/dist/telemetry/attempt-meta.js +33 -1
  300. package/dist/telemetry/exporter-setup.d.ts +2 -0
  301. package/dist/telemetry/exporter-setup.d.ts.map +1 -1
  302. package/dist/telemetry/exporter-setup.js +6 -1
  303. package/dist/telemetry/exporter.d.ts +2 -2
  304. package/dist/telemetry/exporter.d.ts.map +1 -1
  305. package/dist/telemetry/exporter.js +22 -41
  306. package/dist/telemetry/grade-mappers.d.ts +25 -0
  307. package/dist/telemetry/grade-mappers.d.ts.map +1 -0
  308. package/dist/telemetry/grade-mappers.js +64 -0
  309. package/dist/telemetry/grades-sql.d.ts +56 -0
  310. package/dist/telemetry/grades-sql.d.ts.map +1 -0
  311. package/dist/telemetry/grades-sql.js +156 -0
  312. package/dist/telemetry/ingest-protocol.d.ts +55 -48
  313. package/dist/telemetry/ingest-protocol.d.ts.map +1 -1
  314. package/dist/telemetry/ingest-protocol.js +48 -83
  315. package/dist/telemetry/org-identity.d.ts +44 -0
  316. package/dist/telemetry/org-identity.d.ts.map +1 -0
  317. package/dist/telemetry/org-identity.js +98 -0
  318. package/dist/telemetry/route-registration.d.ts +48 -0
  319. package/dist/telemetry/route-registration.d.ts.map +1 -0
  320. package/dist/telemetry/route-registration.js +77 -0
  321. package/dist/telemetry/sinks.d.ts +10 -1
  322. package/dist/telemetry/sinks.d.ts.map +1 -1
  323. package/dist/telemetry/sinks.js +52 -6
  324. package/dist/telemetry/store-migrations.d.ts.map +1 -1
  325. package/dist/telemetry/store-migrations.js +64 -0
  326. package/dist/telemetry/store.d.ts +9 -6
  327. package/dist/telemetry/store.d.ts.map +1 -1
  328. package/dist/telemetry/store.js +8 -50
  329. package/dist/tenancy/api-key-format.d.ts +45 -1
  330. package/dist/tenancy/api-key-format.d.ts.map +1 -1
  331. package/dist/tenancy/api-key-format.js +50 -1
  332. package/dist/types/provider.d.ts +23 -3
  333. package/dist/types/provider.d.ts.map +1 -1
  334. package/dist/types/provider.js +26 -0
  335. package/dist/types/route.d.ts +154 -2
  336. package/dist/types/route.d.ts.map +1 -1
  337. package/dist/types/telemetry.d.ts +73 -48
  338. package/dist/types/telemetry.d.ts.map +1 -1
  339. package/dist/validate-cli.d.ts.map +1 -1
  340. package/dist/validate-cli.js +32 -0
  341. package/dist/verify/verify.d.ts +5 -0
  342. package/dist/verify/verify.d.ts.map +1 -1
  343. package/dist/verify/verify.js +2 -0
  344. package/dist/watch/evaluate.d.ts +84 -1
  345. package/dist/watch/evaluate.d.ts.map +1 -1
  346. package/dist/watch/evaluate.js +28 -0
  347. package/dist/watch/monitor.d.ts +8 -2
  348. package/dist/watch/monitor.d.ts.map +1 -1
  349. package/dist/watch/monitor.js +13 -5
  350. package/dist/watch/regret-monitor-cli.d.ts +16 -0
  351. package/dist/watch/regret-monitor-cli.d.ts.map +1 -0
  352. package/dist/watch/regret-monitor-cli.js +137 -0
  353. package/dist/watch/regret-monitor.d.ts +168 -0
  354. package/dist/watch/regret-monitor.d.ts.map +1 -0
  355. package/dist/watch/regret-monitor.js +304 -0
  356. package/dist/watch/upgrade.d.ts +62 -0
  357. package/dist/watch/upgrade.d.ts.map +1 -0
  358. package/dist/watch/upgrade.js +57 -0
  359. package/docs/agent-skill/SKILL.md +181 -9
  360. package/docs/how-it-fits.md +3 -2
  361. package/docs/instrumentation.md +219 -46
  362. package/docs/llms.txt +158 -35
  363. package/docs/managed-serving.md +150 -0
  364. package/docs/mcp-oracle.md +322 -0
  365. package/docs/migration-playbook.md +5 -4
  366. package/docs/quickstart.md +263 -89
  367. package/package.json +18 -4
  368. package/registry/leaderboard.json +74 -0
  369. package/registry/registry.json +232 -112
  370. package/screen.d.ts +16 -0
  371. package/templates/call-disposition-qa.json +77 -0
  372. package/templates/catalog-cleansing.json +77 -0
  373. package/templates/compliance-review.json +76 -0
  374. package/templates/cs-next-action.json +76 -0
  375. package/templates/document-extraction.json +78 -0
  376. package/templates/financial-classification.json +75 -0
  377. package/templates/lead-qualification.json +76 -0
  378. package/templates/medical-classification.json +71 -0
  379. package/templates/ticket-triage.json +76 -0
  380. package/dist/feedback/feedback.d.ts +0 -35
  381. package/dist/feedback/feedback.d.ts.map +0 -1
  382. package/dist/feedback/feedback.js +0 -39
@@ -24,6 +24,7 @@ exports.createTelemetryExporter = createTelemetryExporter;
24
24
  exports.buildLoadErrorBatch = buildLoadErrorBatch;
25
25
  const resolved_bundle_1 = require("../routes/resolved-bundle");
26
26
  const ingest_protocol_1 = require("./ingest-protocol");
27
+ const grade_mappers_1 = require("./grade-mappers");
27
28
  const sinks_1 = require("./sinks");
28
29
  /**
29
30
  * Build the `routes` mirror payload from loaded bundles (Phase D, spec §13).
@@ -35,6 +36,10 @@ const sinks_1 = require("./sinks");
35
36
  */
36
37
  function buildExportedRouteMirrors(bundles) {
37
38
  return bundles.map((b) => {
39
+ // SC-1b req 1: refuse to mirror a `screen: enforce` route whose enforcement
40
+ // can't be guaranteed to re-resolve on the hosted lane (a T1 classifier) —
41
+ // a teaching failure at sync, never a silent inert enforce at request.
42
+ (0, resolved_bundle_1.assertMirrorSafe)(b);
38
43
  const bundle = (0, resolved_bundle_1.resolveRouteBundle)(b);
39
44
  return {
40
45
  route: b.route,
@@ -104,6 +109,14 @@ function toWireInference(row) {
104
109
  // (pre-WI-1a, or a null envelope) emits nothing, so the payload is
105
110
  // byte-identical to before and the server leaves inferences.meta null.
106
111
  ...(row.meta != null ? { meta: row.meta } : {}),
112
+ // CS-1 Chunk B (spec §6): the counts-only MaskReceipt. spread-iff-present —
113
+ // an unmasked route (no receipt) emits NOTHING, so the payload is
114
+ // byte-identical to before CS-1 and the server leaves inferences.mask null.
115
+ // Requires migration 00062 (inferences.mask jsonb) server-side; apply it
116
+ // BEFORE deploying this build (migrate-first) or the insert 4xx's and the
117
+ // exporter poison-skips the batch. NEVER a matched value (summarizeMask is
118
+ // counts-only; counts-never-values property test covers the wire).
119
+ ...(row.mask != null ? { mask: row.mask } : {}),
107
120
  };
108
121
  }
109
122
  function toWireRun(row) {
@@ -172,37 +185,6 @@ function toWireEvalCase(row) {
172
185
  created_by: row.createdBy,
173
186
  };
174
187
  }
175
- function toWireEvaluation(row) {
176
- return {
177
- id: row.id,
178
- artifact_id: row.artifactId,
179
- run_id: row.runId,
180
- evaluator: row.evaluator,
181
- evaluator_kind: row.evaluatorKind,
182
- score: row.score,
183
- passed: row.passed,
184
- label: row.label,
185
- explanation: row.explanation,
186
- created_by: row.createdBy,
187
- };
188
- }
189
- function toWireFeedback(row) {
190
- return {
191
- id: row.id,
192
- ts: row.ts,
193
- inference_id: row.inferenceId,
194
- episode_key: row.episodeKey,
195
- verdict: row.verdict,
196
- score: row.score,
197
- note: row.note,
198
- source: row.source,
199
- created_by: row.createdBy,
200
- // Present only when the verdict names its own org. Omitted (not null) so
201
- // that `stampBatch` can fall back to the exporter's tenant without having
202
- // to distinguish "no org" from "explicitly no org".
203
- ...(row.orgId !== null ? { org_id: row.orgId } : {}),
204
- };
205
- }
206
188
  function createTelemetryExporter(store, config) {
207
189
  const batchSize = config.batchSize ?? DEFAULT_BATCH_SIZE;
208
190
  const intervalMs = config.intervalMs ?? exports.DEFAULT_INTERVAL_MS;
@@ -330,8 +312,8 @@ function createTelemetryExporter(store, config) {
330
312
  let header = pendingHeader();
331
313
  /**
332
314
  * Drain one watermarked stream to exhaustion, batch by batch, through the
333
- * poison-pill state machine. Every stream (inferences, feedback, runs,
334
- * steps, artifacts, edges, evals) is the SAME at-least-once dance behind its
315
+ * poison-pill state machine. Every stream (inferences, grades, runs,
316
+ * steps, artifacts, edges) is the SAME at-least-once dance behind its
335
317
  * own export_state key — factored here so the watermark/header/poison
336
318
  * bookkeeping lives in exactly one place and no stream can drift from
337
319
  * another. A "skip" advances the watermark past a poison batch WITHOUT
@@ -371,11 +353,13 @@ function createTelemetryExporter(store, config) {
371
353
  inferences: rows.map((row) => toWireInference(row)),
372
354
  watermarkAt: new Date().toISOString(),
373
355
  }));
374
- // Feedback, runs, steps, artifacts, edges, evals: the same dance, each
375
- // behind its own export_state key so no stream ever blocks another — a
376
- // poison in one is skipped past without touching the rest.
377
- await drainStream(`${sourceId}:feedback`, (w, n) => store.readFeedbackAfter(w, n), (rows) => ({
378
- feedback: rows.map((row) => toWireFeedback(row)),
356
+ // Grades (grade primitive, R1) — the unified judgment stream, the SDK's
357
+ // sole write path. Same at-least-once dance behind its own watermark key;
358
+ // a grade lands in `public.grades` (idempotent by id). Runs, steps,
359
+ // artifacts, edges: the same dance, each behind its own export_state key so
360
+ // no stream ever blocks another — a poison in one is skipped past.
361
+ await drainStream(`${sourceId}:grades`, (w, n) => store.readGradesAfter(w, n), (rows) => ({
362
+ grades: rows.map((row) => (0, grade_mappers_1.toWireGrade)(row)),
379
363
  }));
380
364
  // Execution graph (Expansion E2 chunk A) — ONLY when the artifact namespace
381
365
  // is active. When artifacts are off these streams never drain and no
@@ -397,9 +381,6 @@ function createTelemetryExporter(store, config) {
397
381
  await drainStream(`${sourceId}:edges`, (w, n) => artStore.readEdgesAfter(w, n), (rows) => ({
398
382
  artifact_edges: rows.map((row) => toWireEdge(row)),
399
383
  }));
400
- await drainStream(`${sourceId}:evals`, (w, n) => artStore.readEvaluationsAfter(w, n), (rows) => ({
401
- artifact_evaluations: rows.map((row) => toWireEvaluation(row)),
402
- }));
403
384
  // Promoted eval cases (E4 chunk A) — same at-least-once dance behind its
404
385
  // own watermark key.
405
386
  await drainStream(`${sourceId}:eval_cases`, (w, n) => artStore.readEvalCasesAfter(w, n), (rows) => ({
@@ -0,0 +1,25 @@
1
+ /**
2
+ * Wire → `grades` row mappers (grade primitive, 00070). Extracted from
3
+ * ingest-protocol.ts so stampBatch stays under the LOC cap (P1). A `WireGrade`
4
+ * lands in the ONE `grades` table; the pass/fail verdict is DERIVED at read
5
+ * time, never stored. Tenancy is stamped from the principal (T3); a grade may
6
+ * name its OWN org (QA-P6-010), verified by foreignOrgGrades before the write.
7
+ */
8
+ import type { GradeRow } from "../types/telemetry";
9
+ import type { Tenancy } from "./ingest-protocol";
10
+ import type { WireGrade } from "./ingest-protocol";
11
+ /** GradeRow → WireGrade (the exporter's `:grades` stream mapper). org_id is
12
+ * spread-iff-present so stampBatch falls back to the exporter's tenant. */
13
+ export declare function toWireGrade(row: GradeRow): WireGrade;
14
+ /** WireGrade → a grades row (the SDK's sole judgment write path). `criteria`
15
+ * (F4) is deliberately destructured OUT here: `public.grades` has no criteria
16
+ * column — the per-criterion breakdown fans out to `grade_criteria` in a
17
+ * separate best-effort write at the ingest boundary, keyed to this grade's id. */
18
+ export declare function gradeToRow({ org_id, criteria: _criteria, ...g }: WireGrade, tenancy: Tenancy): Record<string, unknown>;
19
+ /**
20
+ * Grades naming an org other than the presented key's. The ingest endpoint drops
21
+ * and COUNTS these so a caller cannot file a judgment into another tenant's corpus
22
+ * (QA-P6-010). Returns the offending ids. A service-role exporter needs no such check.
23
+ */
24
+ export declare function foreignOrgGrades(rows: readonly WireGrade[], keyOrgId: string): readonly string[];
25
+ //# sourceMappingURL=grade-mappers.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"grade-mappers.d.ts","sourceRoot":"","sources":["../../src/telemetry/grade-mappers.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAEnD;2EAC2E;AAC3E,wBAAgB,WAAW,CAAC,GAAG,EAAE,QAAQ,GAAG,SAAS,CAmBpD;AAED;;;kFAGkF;AAClF,wBAAgB,UAAU,CAAC,EAAE,MAAM,EAAE,QAAQ,EAAE,SAAS,EAAE,GAAG,CAAC,EAAE,EAAE,SAAS,EAAE,OAAO,EAAE,OAAO,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAiBtH;AAED;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,SAAS,SAAS,EAAE,EAAE,QAAQ,EAAE,MAAM,GAAG,SAAS,MAAM,EAAE,CAEhG"}
@@ -0,0 +1,64 @@
1
+ "use strict";
2
+ /**
3
+ * Wire → `grades` row mappers (grade primitive, 00070). Extracted from
4
+ * ingest-protocol.ts so stampBatch stays under the LOC cap (P1). A `WireGrade`
5
+ * lands in the ONE `grades` table; the pass/fail verdict is DERIVED at read
6
+ * time, never stored. Tenancy is stamped from the principal (T3); a grade may
7
+ * name its OWN org (QA-P6-010), verified by foreignOrgGrades before the write.
8
+ */
9
+ Object.defineProperty(exports, "__esModule", { value: true });
10
+ exports.toWireGrade = toWireGrade;
11
+ exports.gradeToRow = gradeToRow;
12
+ exports.foreignOrgGrades = foreignOrgGrades;
13
+ /** GradeRow → WireGrade (the exporter's `:grades` stream mapper). org_id is
14
+ * spread-iff-present so stampBatch falls back to the exporter's tenant. */
15
+ function toWireGrade(row) {
16
+ return {
17
+ id: row.id,
18
+ subject_kind: row.subjectKind,
19
+ subject_id: row.subjectId,
20
+ score: row.score,
21
+ scale_max: row.scaleMax,
22
+ scale_label: row.scaleLabel,
23
+ comment: row.comment,
24
+ kind: row.kind,
25
+ grader: row.grader,
26
+ source: row.source,
27
+ created_by: row.createdBy,
28
+ ts: row.ts,
29
+ ...(row.orgId !== null ? { org_id: row.orgId } : {}),
30
+ // F4: mirror the per-criterion breakdown iff present (spread-iff — a
31
+ // single-score grade's wire shape is byte-identical to pre-F4).
32
+ ...(row.criteria !== undefined ? { criteria: row.criteria } : {}),
33
+ };
34
+ }
35
+ /** WireGrade → a grades row (the SDK's sole judgment write path). `criteria`
36
+ * (F4) is deliberately destructured OUT here: `public.grades` has no criteria
37
+ * column — the per-criterion breakdown fans out to `grade_criteria` in a
38
+ * separate best-effort write at the ingest boundary, keyed to this grade's id. */
39
+ function gradeToRow({ org_id, criteria: _criteria, ...g }, tenancy) {
40
+ return {
41
+ org_id: org_id ?? tenancy.org_id,
42
+ project_id: tenancy.project_id,
43
+ id: g.id,
44
+ subject_kind: g.subject_kind,
45
+ subject_id: g.subject_id,
46
+ score: g.score,
47
+ scale_max: g.scale_max,
48
+ scale_label: g.scale_label,
49
+ comment: g.comment,
50
+ kind: g.kind,
51
+ grader: g.grader,
52
+ source: g.source,
53
+ created_by: g.created_by,
54
+ ts: g.ts,
55
+ };
56
+ }
57
+ /**
58
+ * Grades naming an org other than the presented key's. The ingest endpoint drops
59
+ * and COUNTS these so a caller cannot file a judgment into another tenant's corpus
60
+ * (QA-P6-010). Returns the offending ids. A service-role exporter needs no such check.
61
+ */
62
+ function foreignOrgGrades(rows, keyOrgId) {
63
+ return rows.filter((r) => r.org_id !== undefined && r.org_id !== keyOrgId).map((r) => r.id);
64
+ }
@@ -0,0 +1,56 @@
1
+ /**
2
+ * Shared SQLite DDL + row mapping for the local `grades` table (grade primitive).
3
+ *
4
+ * The unified judgment table is written by TWO better-sqlite3 handles over the
5
+ * same telemetry file — the main telemetry store (`store.ts`, for inference/run
6
+ * grades via `rig.grade`) and the artifact store (`artifact-store.ts`, for
7
+ * artifact-subject grades, which already transact on that handle). Both must
8
+ * agree on the table shape and the bind mapping, so both live here once (DRY,
9
+ * and the two cannot drift). The telemetry handle owns the READ side (the
10
+ * exporter's `:grades` stream).
11
+ *
12
+ * project_id is NOT stored locally: like every telemetry row, it is stamped at
13
+ * export from the principal, never held on the row (one rig = one tenant).
14
+ */
15
+ import type Database from "better-sqlite3";
16
+ import type { GradeRow } from "../types/telemetry";
17
+ /** `CREATE TABLE IF NOT EXISTS grades …` — safe to run on every open. Mirrors
18
+ * `public.grades` minus the export-stamped columns (org handling below). */
19
+ export declare const GRADES_TABLE_SQL = "\nCREATE TABLE IF NOT EXISTS grades (\n id TEXT PRIMARY KEY,\n ts TEXT,\n subject_kind TEXT NOT NULL CHECK (subject_kind IN ('inference','run','artifact')),\n subject_id TEXT NOT NULL,\n score REAL NOT NULL,\n scale_max REAL,\n scale_label TEXT,\n comment TEXT,\n kind TEXT NOT NULL CHECK (kind IN ('human','model-judge','deterministic')),\n grader TEXT,\n source TEXT,\n org_id TEXT,\n created_by TEXT,\n criteria TEXT\n);\nCREATE INDEX IF NOT EXISTS idx_grades_subject ON grades (subject_kind, subject_id);\n";
20
+ /** The row shape as it sits in SQLite (snake_case, nullable columns as read back). */
21
+ export interface GradeDbRow {
22
+ id: string;
23
+ ts: string | null;
24
+ subject_kind: string;
25
+ subject_id: string;
26
+ score: number;
27
+ scale_max: number | null;
28
+ scale_label: string | null;
29
+ comment: string | null;
30
+ kind: string;
31
+ grader: string | null;
32
+ source: string | null;
33
+ org_id: string | null;
34
+ created_by: string | null;
35
+ /** JSON-encoded per-criterion breakdown (call-qa F4), or null for a
36
+ * single-score grade / a row written before the v16 rung. */
37
+ criteria: string | null;
38
+ }
39
+ /** Prepare the grade insert statement against an open handle. INSERT OR IGNORE:
40
+ * a grade id is unique, and a re-inserted id (e.g. the backfill racing a live
41
+ * write) is a harmless no-op. */
42
+ export declare function prepareGradeInsert(db: Database.Database): Database.Statement;
43
+ /** Bind a GradeRow to the insert statement's named params. */
44
+ export declare function gradeBindParams(row: GradeRow): Record<string, unknown>;
45
+ /** Read one SQLite grade row back into a GradeRow. */
46
+ export declare function toGradeRow(r: GradeDbRow): GradeRow;
47
+ /** Backfill `grades` from the local `feedback` table, if it exists (grade
48
+ * primitive, GP-1). Same mapping as migration 00070's feedback→grades leg.
49
+ * Idempotent (INSERT OR IGNORE keyed on the source row id). Runs inside the
50
+ * telemetry store's migration ladder. */
51
+ export declare function backfillGradesFromFeedback(db: Database.Database): void;
52
+ /** Backfill `grades` from the local `artifact_evaluations` table, if it exists
53
+ * (grade primitive, GP-1). Same mapping as migration 00070's evaluation leg.
54
+ * Idempotent. Runs when the artifact store opens (it owns that table). */
55
+ export declare function backfillGradesFromEvaluations(db: Database.Database): void;
56
+ //# sourceMappingURL=grades-sql.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"grades-sql.d.ts","sourceRoot":"","sources":["../../src/telemetry/grades-sql.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,KAAK,QAAQ,MAAM,gBAAgB,CAAC;AAC3C,OAAO,KAAK,EAAkB,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAEnE;4EAC4E;AAC5E,eAAO,MAAM,gBAAgB,ulBAkB5B,CAAC;AAEF,sFAAsF;AACtF,MAAM,WAAW,UAAU;IACzB,EAAE,EAAE,MAAM,CAAC;IACX,EAAE,EAAE,MAAM,GAAG,IAAI,CAAC;IAClB,YAAY,EAAE,MAAM,CAAC;IACrB,UAAU,EAAE,MAAM,CAAC;IACnB,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IACvB,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B;iEAC6D;IAC7D,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;CACzB;AAWD;;iCAEiC;AACjC,wBAAgB,kBAAkB,CAAC,EAAE,EAAE,QAAQ,CAAC,QAAQ,GAAG,QAAQ,CAAC,SAAS,CAE5E;AAED,8DAA8D;AAC9D,wBAAgB,eAAe,CAAC,GAAG,EAAE,QAAQ,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAoBtE;AAED,sDAAsD;AACtD,wBAAgB,UAAU,CAAC,CAAC,EAAE,UAAU,GAAG,QAAQ,CAqBlD;AAcD;;;yCAGyC;AACzC,wBAAgB,0BAA0B,CAAC,EAAE,EAAE,QAAQ,CAAC,QAAQ,GAAG,IAAI,CAetE;AAED;;0EAE0E;AAC1E,wBAAgB,6BAA6B,CAAC,EAAE,EAAE,QAAQ,CAAC,QAAQ,GAAG,IAAI,CAgBzE"}
@@ -0,0 +1,156 @@
1
+ "use strict";
2
+ /**
3
+ * Shared SQLite DDL + row mapping for the local `grades` table (grade primitive).
4
+ *
5
+ * The unified judgment table is written by TWO better-sqlite3 handles over the
6
+ * same telemetry file — the main telemetry store (`store.ts`, for inference/run
7
+ * grades via `rig.grade`) and the artifact store (`artifact-store.ts`, for
8
+ * artifact-subject grades, which already transact on that handle). Both must
9
+ * agree on the table shape and the bind mapping, so both live here once (DRY,
10
+ * and the two cannot drift). The telemetry handle owns the READ side (the
11
+ * exporter's `:grades` stream).
12
+ *
13
+ * project_id is NOT stored locally: like every telemetry row, it is stamped at
14
+ * export from the principal, never held on the row (one rig = one tenant).
15
+ */
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ exports.GRADES_TABLE_SQL = void 0;
18
+ exports.prepareGradeInsert = prepareGradeInsert;
19
+ exports.gradeBindParams = gradeBindParams;
20
+ exports.toGradeRow = toGradeRow;
21
+ exports.backfillGradesFromFeedback = backfillGradesFromFeedback;
22
+ exports.backfillGradesFromEvaluations = backfillGradesFromEvaluations;
23
+ /** `CREATE TABLE IF NOT EXISTS grades …` — safe to run on every open. Mirrors
24
+ * `public.grades` minus the export-stamped columns (org handling below). */
25
+ exports.GRADES_TABLE_SQL = `
26
+ CREATE TABLE IF NOT EXISTS grades (
27
+ id TEXT PRIMARY KEY,
28
+ ts TEXT,
29
+ subject_kind TEXT NOT NULL CHECK (subject_kind IN ('inference','run','artifact')),
30
+ subject_id TEXT NOT NULL,
31
+ score REAL NOT NULL,
32
+ scale_max REAL,
33
+ scale_label TEXT,
34
+ comment TEXT,
35
+ kind TEXT NOT NULL CHECK (kind IN ('human','model-judge','deterministic')),
36
+ grader TEXT,
37
+ source TEXT,
38
+ org_id TEXT,
39
+ created_by TEXT,
40
+ criteria TEXT
41
+ );
42
+ CREATE INDEX IF NOT EXISTS idx_grades_subject ON grades (subject_kind, subject_id);
43
+ `;
44
+ const INSERT_GRADE_SQL = `
45
+ INSERT OR IGNORE INTO grades (
46
+ id, ts, subject_kind, subject_id, score, scale_max, scale_label, comment,
47
+ kind, grader, source, org_id, created_by, criteria
48
+ ) VALUES (
49
+ @id, @ts, @subject_kind, @subject_id, @score, @scale_max, @scale_label, @comment,
50
+ @kind, @grader, @source, @org_id, @created_by, @criteria
51
+ )`;
52
+ /** Prepare the grade insert statement against an open handle. INSERT OR IGNORE:
53
+ * a grade id is unique, and a re-inserted id (e.g. the backfill racing a live
54
+ * write) is a harmless no-op. */
55
+ function prepareGradeInsert(db) {
56
+ return db.prepare(INSERT_GRADE_SQL);
57
+ }
58
+ /** Bind a GradeRow to the insert statement's named params. */
59
+ function gradeBindParams(row) {
60
+ return {
61
+ id: row.id,
62
+ ts: row.ts,
63
+ subject_kind: row.subjectKind,
64
+ subject_id: row.subjectId,
65
+ score: row.score,
66
+ scale_max: row.scaleMax,
67
+ scale_label: row.scaleLabel,
68
+ comment: row.comment,
69
+ kind: row.kind,
70
+ grader: row.grader,
71
+ source: row.source,
72
+ org_id: row.orgId,
73
+ created_by: row.createdBy,
74
+ // F4: the per-criterion breakdown is stored as a JSON string (or null for a
75
+ // single-score grade). One column, no sidecar table locally — the server is
76
+ // where it fans out to `grade_criteria`.
77
+ criteria: row.criteria !== undefined ? JSON.stringify(row.criteria) : null,
78
+ };
79
+ }
80
+ /** Read one SQLite grade row back into a GradeRow. */
81
+ function toGradeRow(r) {
82
+ return {
83
+ id: r.id,
84
+ ts: r.ts,
85
+ subjectKind: r.subject_kind,
86
+ subjectId: r.subject_id,
87
+ score: r.score,
88
+ scaleMax: r.scale_max,
89
+ scaleLabel: r.scale_label,
90
+ comment: r.comment,
91
+ kind: r.kind,
92
+ grader: r.grader,
93
+ source: r.source,
94
+ orgId: r.org_id ?? null,
95
+ createdBy: r.created_by ?? null,
96
+ // F4: parse the JSON `criteria` column back. Null (pre-F4 or single-score) ⇒
97
+ // the field is ABSENT on the GradeRow (spread-iff), so the wire stays
98
+ // byte-identical for a plain grade. A malformed value degrades to absent
99
+ // rather than throwing on the export read.
100
+ ...parseCriteriaColumn(r.criteria),
101
+ };
102
+ }
103
+ /** Narrow the stored JSON `criteria` column to a spread-iff-present GradeRow
104
+ * fragment. Malformed / null ⇒ `{}` (field absent). Never throws on the read. */
105
+ function parseCriteriaColumn(raw) {
106
+ if (raw === null)
107
+ return {};
108
+ try {
109
+ const parsed = JSON.parse(raw);
110
+ return Array.isArray(parsed) ? { criteria: parsed } : {};
111
+ }
112
+ catch {
113
+ return {};
114
+ }
115
+ }
116
+ /** Backfill `grades` from the local `feedback` table, if it exists (grade
117
+ * primitive, GP-1). Same mapping as migration 00070's feedback→grades leg.
118
+ * Idempotent (INSERT OR IGNORE keyed on the source row id). Runs inside the
119
+ * telemetry store's migration ladder. */
120
+ function backfillGradesFromFeedback(db) {
121
+ const hasFeedback = db.prepare("PRAGMA table_info(feedback)").all().length > 0;
122
+ if (!hasFeedback)
123
+ return;
124
+ db.exec(`
125
+ INSERT OR IGNORE INTO grades
126
+ (id, ts, subject_kind, subject_id, score, comment, kind, grader, source, org_id, created_by)
127
+ SELECT
128
+ f.id, f.ts,
129
+ CASE WHEN f.inference_id IS NOT NULL THEN 'inference' ELSE 'run' END,
130
+ COALESCE(f.inference_id, f.episode_key),
131
+ COALESCE(f.score, CASE WHEN f.verdict = 'up' THEN 1.0 ELSE 0.0 END),
132
+ f.note, 'human', f.source, f.source, f.org_id, f.created_by
133
+ FROM feedback f
134
+ WHERE COALESCE(f.inference_id, f.episode_key) IS NOT NULL
135
+ `);
136
+ }
137
+ /** Backfill `grades` from the local `artifact_evaluations` table, if it exists
138
+ * (grade primitive, GP-1). Same mapping as migration 00070's evaluation leg.
139
+ * Idempotent. Runs when the artifact store opens (it owns that table). */
140
+ function backfillGradesFromEvaluations(db) {
141
+ const hasEvals = db.prepare("PRAGMA table_info(artifact_evaluations)").all().length > 0;
142
+ if (!hasEvals)
143
+ return;
144
+ db.exec(`
145
+ INSERT OR IGNORE INTO grades
146
+ (id, ts, subject_kind, subject_id, score, scale_label, comment, kind, grader, source, org_id, created_by)
147
+ SELECT
148
+ e.id, NULL,
149
+ CASE WHEN e.artifact_id IS NOT NULL THEN 'artifact' ELSE 'run' END,
150
+ COALESCE(e.artifact_id, e.run_id),
151
+ COALESCE(e.score, CASE WHEN e.passed = 1 THEN 1.0 ELSE 0.0 END),
152
+ e.label, e.explanation, e.evaluator_kind, e.evaluator, NULL, NULL, e.created_by
153
+ FROM artifact_evaluations e
154
+ WHERE COALESCE(e.artifact_id, e.run_id) IS NOT NULL
155
+ `);
156
+ }
@@ -22,16 +22,18 @@
22
22
  * stamped by whoever holds the principal — the exporter's config in direct
23
23
  * mode, the resolved key in api mode.
24
24
  *
25
- * The single exception is `feedback.org_id`, and it is the reason WS2 exists.
26
- * A verdict recorded on OUR hosted server belongs to the org of the person who
25
+ * The single exception is `grade.org_id`, and it is the reason WS2 exists.
26
+ * A judgment recorded on OUR hosted server belongs to the org of the person who
27
27
  * recorded it, not to the org the server runs as, and one SQLite store holds
28
- * verdicts for many orgs. So a feedback row may name its own org — and the
29
- * ingest endpoint VERIFIES that name against the key rather than trusting it
30
- * (see `foreignOrgFeedback`). A service-role exporter needs no such check: it
31
- * already holds a credential that can write any row in the database.
28
+ * grades for many orgs. So a grade row may name its own org — and the ingest
29
+ * endpoint VERIFIES that name against the key rather than trusting it (see
30
+ * `foreignOrgGrades`). A service-role exporter needs no such check: it already
31
+ * holds a credential that can write any row in the database.
32
32
  */
33
33
  import type { FailureClass } from "../types/failures";
34
+ import type { EvalCaseOrigin } from "../types/telemetry";
34
35
  import type { ResolvedRouteBundle } from "../routes/resolved-bundle";
36
+ export { foreignOrgGrades } from "./grade-mappers";
35
37
  /** The path the api sink posts to. Spelled once. */
36
38
  export declare const INGEST_PATH = "/v1/ingest";
37
39
  /** The CURRENT protocol version — the maximum the SDK can speak (ruling d).
@@ -106,21 +108,42 @@ export interface WireInference {
106
108
  * the batch). NEVER carries a matched value. */
107
109
  readonly mask?: unknown;
108
110
  }
109
- export interface WireFeedback {
111
+ /**
112
+ * A unified judgment (grade primitive, R1) — the wire shape of a `grades` row.
113
+ * `score` is the 0–1 primitive (always present); the pass/fail verdict is DERIVED
114
+ * server-side, never carried. A grade may name its OWN org (a verdict recorded
115
+ * through a hosted server for another org); the ingest endpoint verifies that name
116
+ * against the key (`foreignOrgGrades`). `scale_label` is the one display label.
117
+ */
118
+ export interface WireGrade {
110
119
  readonly id: string;
111
- readonly ts: string;
112
- readonly inference_id: string | null;
113
- readonly episode_key: string | null;
114
- readonly verdict: "up" | "down";
115
- readonly score: number | null;
116
- readonly note: string | null;
117
- /** WHO judged — "sdk", "console", a review-agent name. Not a tenant. */
118
- readonly source: string;
119
- /** Authenticated user who recorded it (00017), or null. */
120
+ readonly subject_kind: "inference" | "run" | "artifact";
121
+ readonly subject_id: string;
122
+ readonly score: number;
123
+ readonly scale_max: number | null;
124
+ readonly scale_label: string | null;
125
+ readonly comment: string | null;
126
+ readonly kind: "human" | "model-judge" | "deterministic";
127
+ readonly grader: string | null;
128
+ readonly source: string | null;
120
129
  readonly created_by: string | null;
121
- /** The verdict's OWN org, when it differs from the exporter's. See the
122
- * module header — this is the one field the ingest endpoint must verify. */
130
+ readonly ts: string | null;
131
+ /** The grade's OWN org, when it differs from the exporter's (feedback doctrine). */
123
132
  readonly org_id?: string;
133
+ /** OPTIONAL per-criterion breakdown (call-qa F4). Carried on the wire so a
134
+ * client-recorded HUMAN scorecard reaches the server, which fans it out to
135
+ * `grade_criteria` (kind=human) after the parent grades row lands. NOT written
136
+ * to `public.grades` (no column there — `gradeToRow` drops it). Absent ⇒ a
137
+ * single-score grade. `turn_id` is optional on each evidence citation. */
138
+ readonly criteria?: readonly {
139
+ readonly id: string;
140
+ readonly score: number;
141
+ readonly evidence?: readonly {
142
+ readonly quote: string;
143
+ readonly turn_id?: number;
144
+ }[];
145
+ readonly comment?: string;
146
+ }[];
124
147
  }
125
148
  export interface WireEnvelope {
126
149
  readonly envelope_key: string;
@@ -236,28 +259,10 @@ export interface WireEvalCase {
236
259
  readonly task: string;
237
260
  readonly source_artifact_id: string;
238
261
  readonly corrected_artifact_id: string | null;
239
- readonly origin: "promoted-failure" | "human-corrected" | "manual";
262
+ readonly origin: EvalCaseOrigin;
240
263
  readonly note: string | null;
241
264
  readonly created_by: string | null;
242
265
  }
243
- /** An evaluation recorded against a SUBJECT — one of an artifact or a whole run
244
- * (E5 chunk V, subject-one-of per trajectory F3). Exactly one of artifact_id /
245
- * run_id is non-null; the server's validEvaluation enforces the XOR and the
246
- * 00051 CHECK is the backstop. A fact. */
247
- export interface WireArtifactEvaluation {
248
- readonly id: string;
249
- /** The artifact subject — null when this evaluates a whole run instead. */
250
- readonly artifact_id: string | null;
251
- /** The run subject (E5 V) — null when this evaluates an artifact. */
252
- readonly run_id?: string | null;
253
- readonly evaluator: string;
254
- readonly evaluator_kind: "deterministic" | "model-judge" | "human";
255
- readonly score: number | null;
256
- readonly passed: boolean | null;
257
- readonly label: string | null;
258
- readonly explanation: string | null;
259
- readonly created_by: string | null;
260
- }
261
266
  export interface WireManifest {
262
267
  readonly name: string;
263
268
  readonly dimensions: unknown;
@@ -279,7 +284,9 @@ export interface IngestBatch {
279
284
  * trusted to be unique across tenants. */
280
285
  readonly source: string;
281
286
  readonly inferences?: readonly WireInference[];
282
- readonly feedback?: readonly WireFeedback[];
287
+ /** Unified judgments (grade primitive, R1) — the SOLE judgment write path;
288
+ * a grade lands in `public.grades`. */
289
+ readonly grades?: readonly WireGrade[];
283
290
  readonly envelopes?: readonly WireEnvelope[];
284
291
  readonly routes?: readonly WireRoute[];
285
292
  /** Protocol v2 (spec §1). Present only when the SDK's artifact namespace is
@@ -288,7 +295,6 @@ export interface IngestBatch {
288
295
  readonly steps?: readonly WireStep[];
289
296
  readonly artifacts?: readonly WireArtifact[];
290
297
  readonly artifact_edges?: readonly WireArtifactEdge[];
291
- readonly artifact_evaluations?: readonly WireArtifactEvaluation[];
292
298
  /** Promoted eval cases (E4 chunk A). Present only when the SDK's artifact
293
299
  * namespace is active and a promote happened; a v1 batch never carries them. */
294
300
  readonly eval_cases?: readonly WireEvalCase[];
@@ -314,15 +320,16 @@ export interface TableWrite {
314
320
  * telemetry row. If you are about to add a table to the export, add it here
315
321
  * and both modes gain it at once — which is the point.
316
322
  */
317
- export declare function stampBatch(batch: IngestBatch, tenancy: Tenancy): TableWrite[];
318
- /**
319
- * Feedback rows naming an org other than the presented key's.
320
- *
321
- * Exists as its own exported function because the ingest endpoint must drop
322
- * these and COUNT them, and a check that lives inline in a request handler is
323
- * a check nobody can test in isolation. Returns the offending ids.
324
- */
325
- export declare function foreignOrgFeedback(rows: readonly WireFeedback[], keyOrgId: string): readonly string[];
323
+ /** How `stampBatch` treats route bundles. `declaredBundles` (the HOSTED ingest,
324
+ * RV-1): a bundle that arrived over `/v1/ingest` is stored as route CONFIG with
325
+ * `synced_at = null` — readable for pins/effective/bake-offs, but never picked
326
+ * by the hosted gateway, which serves only `synced_at`-stamped bundles (written
327
+ * by a trusted sync path). An `ingest`-scoped key must not decide what the
328
+ * gateway serves. Absent ⇒ the direct-mode behaviour (`synced_at = now`). */
329
+ export interface StampOptions {
330
+ readonly declaredBundles?: boolean;
331
+ }
332
+ export declare function stampBatch(batch: IngestBatch, tenancy: Tenancy, opts?: StampOptions): TableWrite[];
326
333
  /** What `/v1/ingest` answers. Counts only — a per-row error list on a
327
334
  * fire-and-forget telemetry path is a payload nobody reads and a leak surface
328
335
  * nobody audits. */
@@ -1 +1 @@
1
- {"version":3,"file":"ingest-protocol.d.ts","sourceRoot":"","sources":["../../src/telemetry/ingest-protocol.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACtD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAC;AAGrE,oDAAoD;AACpD,eAAO,MAAM,WAAW,eAAe,CAAC;AAExC;;;;6DAI6D;AAC7D,eAAO,MAAM,uBAAuB,IAAI,CAAC;AAEzC;;+EAE+E;AAC/E,eAAO,MAAM,0BAA0B,IAAI,CAAC;AAE5C,kEAAkE;AAClE,eAAO,MAAM,kBAAkB,4BAA4B,CAAC;AAE5D;kBACkB;AAClB,MAAM,WAAW,OAAO;IACtB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;IACnC,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;CAC5B;AAED,MAAM,WAAW,aAAa;IAC5B,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,aAAa,EAAE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