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
@@ -14,10 +14,13 @@ Object.defineProperty(exports, "__esModule", { value: true });
14
14
  exports.rungOf = rungOf;
15
15
  exports.createRecordAttempt = createRecordAttempt;
16
16
  const node_crypto_1 = require("node:crypto");
17
+ const dispatch_1 = require("./dispatch");
18
+ const destination_1 = require("./destination");
17
19
  const failures_1 = require("../types/failures");
18
20
  const cache_stamp_1 = require("./cache-stamp");
19
21
  const cache_handle_1 = require("./cache-handle");
20
22
  const attempt_meta_1 = require("../telemetry/attempt-meta");
23
+ const telemetry_row_1 = require("./telemetry-row");
21
24
  /**
22
25
  * Classify a recorded row's ladder rung (R1 review, F1). `primaryDispatched`
23
26
  * carries the candidate indices already given a primary dispatch on this call —
@@ -99,12 +102,19 @@ function createRecordAttempt(deps) {
99
102
  // meta (metaInputs) plus THIS row's provider/model/usage.
100
103
  const meta = (0, attempt_meta_1.summarizeAttemptMeta)({
101
104
  ...(attempt.metaInputs ?? {}),
105
+ ...(deps.arm !== undefined ? { arm: deps.arm } : {}),
106
+ // SC-1a (spec §5, §8): the counts-only screen receipt rides meta.screen —
107
+ // ZERO migration. The single producer passes it through verbatim.
108
+ ...(attempt.screen !== undefined ? { screen: attempt.screen } : {}),
102
109
  provider: attempt.candidate.provider,
103
110
  model: attempt.candidate.model,
104
111
  usage: {
105
112
  tokensIn: attempt.tokensIn,
106
113
  tokensOut: attempt.tokensOut,
107
114
  tokensCached: attempt.tokensCached,
115
+ // Issue #2 (L6 F1): the SERVED tier, so meta.cost components price at
116
+ // the same tier as cost_estimate_usd and still sum to the row (WI-1).
117
+ servedTier: attempt.servedTier,
108
118
  ...(attempt.tokensCacheWrite !== undefined ? { tokensCacheWrite: attempt.tokensCacheWrite } : {}),
109
119
  ...(attempt.tokensCacheWrite1h !== undefined ? { tokensCacheWrite1h: attempt.tokensCacheWrite1h } : {}),
110
120
  },
@@ -117,9 +127,13 @@ function createRecordAttempt(deps) {
117
127
  // stepKey ?? tags.step ?? the auto `route#n` key, so a caller's own step lands
118
128
  // unchanged and the tag agrees with the ground-truth step row.
119
129
  const stepTag = runCtx !== null && autoStepKey !== null ? { step: autoStepKey } : {};
120
- const row = {
130
+ // U4: the row is assembled — and its tags serialized — by the ONE shared
131
+ // builder (./telemetry-row.ts). `rung` is stamped LAST inside stampRowTags so
132
+ // a caller's extraTags (Q1 quality tags) can never override the
133
+ // recorder-owned rung. Cache-write accounting (WS-A) + WS-C substrate + the
134
+ // CS-1 mask receipt ride the same builder unchanged.
135
+ const row = (0, telemetry_row_1.buildTelemetryRow)({
121
136
  id: (0, node_crypto_1.randomUUID)(),
122
- ts: new Date().toISOString(),
123
137
  route: route.route,
124
138
  routeVersion: route.version,
125
139
  provider: attempt.candidate.provider,
@@ -129,31 +143,35 @@ function createRecordAttempt(deps) {
129
143
  tokensIn: attempt.tokensIn,
130
144
  tokensOut: attempt.tokensOut,
131
145
  tokensCached: attempt.tokensCached,
132
- // Cache-write accounting (WS-A) + request-path substrate (WS-C).
133
146
  tokensCacheWrite: attempt.tokensCacheWrite ?? 0,
134
147
  tokensCacheWrite1h: attempt.tokensCacheWrite1h ?? 0,
135
- cacheKey,
136
- prefixFingerprint: cacheStamp?.prefixFingerprint ?? null,
137
148
  costEstimateUsd: attempt.costUsd,
138
149
  latencyMs: attempt.latencyMs,
139
150
  ttfbMs: attempt.ttfbMs ?? null,
140
151
  failureClass: attempt.failure?.class ?? null,
141
152
  attemptsJson: JSON.stringify(ledger.snapshot()),
142
- // `rung` is stamped LAST so a caller's extraTags (Q1 quality tags) can
143
- // never override the recorder-owned rung.
144
- tagsJson: JSON.stringify({ ...stepTag, ...effectiveTags, ...attempt.extraTags, rung }),
153
+ // U3 (D-2) × U4: the serving `destination` tag rides the ONE shared row
154
+ // builder — `buildTelemetryRow` → `stampRowTags` serializes `tags_json` in a
155
+ // single place, and `rung` is stamped LAST there so a caller's extraTags can
156
+ // never override it. `destinationTag()` returns `{}` for the default `direct`,
157
+ // so a direct/absent routed row stays byte-identical; a `modelrig-served` row
158
+ // gains `destination`. Folded into `baseTags` here because `destination` is a
159
+ // routed-lane concept (the raw/search recorders have none).
160
+ baseTags: { ...stepTag, ...effectiveTags, ...(0, dispatch_1.destinationTag)(deps.destination ?? destination_1.DEFAULT_DESTINATION) },
161
+ extraTags: attempt.extraTags,
162
+ rung,
145
163
  fingerprintCell: route.fingerprintCell,
146
164
  servedVariant,
147
165
  repairedBy: attempt.repairedBy ?? null,
148
166
  pricingMissing: attempt.pricingMissing ?? false,
167
+ cacheKey,
168
+ prefixFingerprint: cacheStamp?.prefixFingerprint ?? null,
149
169
  callId: ladderKey.callId,
150
170
  attemptSeq: ladderKey.attemptSeq,
151
171
  candidateIndex: ladderKey.candidateIndex,
152
172
  meta,
153
- // CS-1 (spec §6): the counts-only mask receipt for this attempt, or absent
154
- // when the route does not mask. NEVER a matched value.
155
- ...(attempt.mask !== undefined ? { mask: attempt.mask } : {}),
156
- };
173
+ mask: attempt.mask,
174
+ });
157
175
  telemetry.record(row);
158
176
  // Mirror this inference into a ground-truth step attempt (fail-open — the
159
177
  // context swallows buffer errors; the run loop is never affected).
@@ -0,0 +1,68 @@
1
+ /**
2
+ * The routed lane's REPAIR RUNG (spec §4, WS2), extracted from run.ts as a
3
+ * factory over the run's per-call state — mirroring the `createRecordAttempt`
4
+ * factory pattern in ./record-attempt.ts, and for the same reason: run.ts sits
5
+ * at the 700-LOC cap (dev-rule P1), and the repair closure is a large,
6
+ * self-contained block (~157 LOC). This is a PURE MOVE (Unified Route U4,
7
+ * behavior-preserving): the logic, the record shapes, the throw conditions, and
8
+ * the returned `RunResult` meta are byte-identical to the former inline closure.
9
+ *
10
+ * The one mechanical change the move forces: the former closure read the run
11
+ * loop's mutable `injectedSources` binding directly; the factory-built function
12
+ * receives it as an explicit call argument instead (the run loop passes the
13
+ * value in scope for the candidate being repaired), so behavior is unchanged.
14
+ */
15
+ import type { ProviderAdapter, CandidateRef } from "../types/provider";
16
+ import type { RigFailure } from "../types/failures";
17
+ import type { RouteBundle, RunResult } from "../types/route";
18
+ import type { ScreenReceipt } from "../screen/types";
19
+ import type { EnvelopeGuard } from "./envelope";
20
+ import type { RunMode } from "./resolve";
21
+ import type { RepairStep } from "./repair";
22
+ import type { AttemptTelemetry } from "./dispatch";
23
+ import type { SearchResultItem } from "./grounding";
24
+ import type { LadderKeyMinter } from "./ladder-key";
25
+ import type { RetryLedger } from "./retry";
26
+ import type { Destination } from "./destination";
27
+ /** User turn for repair calls (WS2) — same terse-trigger convention run.ts uses
28
+ * for the primary directive. Moved here with the repair closure. */
29
+ export declare const REPAIR_DIRECTIVE = "Produce the corrected JSON object now, following the system instructions exactly.";
30
+ /** The user turn of a SAME-MODEL repair re-ask (issue #5, R1): on a route that
31
+ * declares `prompt.user`, the rendered per-call user turn is kept ahead of the
32
+ * repair directive (the delta is content the model needs to correct against —
33
+ * dropping it would be the silent loss R1 closes); on every other route the
34
+ * directive alone, byte-identical to pre-R1. Pure; exported for the tests. */
35
+ export declare function repairUserTurn(route: Pick<RouteBundle, "userTemplate">, originalUserPrompt: string): string;
36
+ export interface RepairAttemptOutcome {
37
+ readonly done?: RunResult;
38
+ readonly invalid?: {
39
+ readonly text: string;
40
+ readonly errors: readonly string[];
41
+ };
42
+ }
43
+ export interface AttemptRepairDeps {
44
+ readonly adapters: ReadonlyMap<string, ProviderAdapter>;
45
+ readonly guard: EnvelopeGuard | null;
46
+ readonly unpricedRatePerTok: number;
47
+ readonly route: RouteBundle;
48
+ readonly mode: RunMode;
49
+ readonly recordAttempt: (attempt: AttemptTelemetry) => string;
50
+ readonly captureAttempt: (inferenceId: string, text: string) => void;
51
+ readonly ledger: RetryLedger;
52
+ readonly servedVariant: string | null;
53
+ readonly ladder: LadderKeyMinter;
54
+ readonly destination: Destination;
55
+ /** run.ts's `failRun` — records a pre-dispatch terminal row and throws. */
56
+ readonly failRun: (candidate: CandidateRef, failure: RigFailure, latencyMs: number, screen?: ScreenReceipt) => never;
57
+ }
58
+ /**
59
+ * Build the run loop's `attemptRepair`. Returns a function performing ONE repair
60
+ * dispatch: `{done}` on schema-valid output, `{invalid}` with the newest
61
+ * output+errors for chaining, or null when the dispatch itself failed (adapter
62
+ * failure / unmintable repair candidate). `injectedSources` is the run loop's
63
+ * current grounding-inject payload for the candidate under repair (null when the
64
+ * run is not spotlight-grounded) — passed in so the returned `done` meta carries
65
+ * the same `groundingMeta` the primary success path would.
66
+ */
67
+ export declare function createAttemptRepair(deps: AttemptRepairDeps): (step: RepairStep, original: CandidateRef, originalSystemPrompt: string, invalidText: string, errors: readonly string[], injectedSources: readonly SearchResultItem[] | null, originalUserPrompt?: string) => Promise<RepairAttemptOutcome | null>;
68
+ //# sourceMappingURL=repair-attempt.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"repair-attempt.d.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 * factory over the run's per-call state — mirroring the `createRecordAttempt`
5
+ * factory pattern in ./record-attempt.ts, and for the same reason: run.ts sits
6
+ * at the 700-LOC cap (dev-rule P1), and the repair closure is a large,
7
+ * self-contained block (~157 LOC). This is a PURE MOVE (Unified Route U4,
8
+ * behavior-preserving): the logic, the record shapes, the throw conditions, and
9
+ * the returned `RunResult` meta are byte-identical to the former inline closure.
10
+ *
11
+ * The one mechanical change the move forces: the former closure read the run
12
+ * loop's mutable `injectedSources` binding directly; the factory-built function
13
+ * receives it as an explicit call argument instead (the run loop passes the
14
+ * value in scope for the candidate being repaired), so behavior is unchanged.
15
+ */
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ exports.REPAIR_DIRECTIVE = void 0;
18
+ exports.repairUserTurn = repairUserTurn;
19
+ exports.createAttemptRepair = createAttemptRepair;
20
+ const failures_1 = require("../types/failures");
21
+ const cost_1 = require("./cost");
22
+ const resolve_1 = require("./resolve");
23
+ const repair_1 = require("./repair");
24
+ const validate_1 = require("./validate");
25
+ const dispatch_1 = require("./dispatch");
26
+ const grounding_1 = require("./grounding");
27
+ /** User turn for repair calls (WS2) — same terse-trigger convention run.ts uses
28
+ * for the primary directive. Moved here with the repair closure. */
29
+ exports.REPAIR_DIRECTIVE = "Produce the corrected JSON object now, following the system instructions exactly.";
30
+ /** The user turn of a SAME-MODEL repair re-ask (issue #5, R1): on a route that
31
+ * declares `prompt.user`, the rendered per-call user turn is kept ahead of the
32
+ * repair directive (the delta is content the model needs to correct against —
33
+ * dropping it would be the silent loss R1 closes); on every other route the
34
+ * directive alone, byte-identical to pre-R1. Pure; exported for the tests. */
35
+ function repairUserTurn(route, originalUserPrompt) {
36
+ return route.userTemplate === undefined ? exports.REPAIR_DIRECTIVE : `${originalUserPrompt}\n\n${exports.REPAIR_DIRECTIVE}`;
37
+ }
38
+ /**
39
+ * Build the run loop's `attemptRepair`. Returns a function performing ONE repair
40
+ * dispatch: `{done}` on schema-valid output, `{invalid}` with the newest
41
+ * output+errors for chaining, or null when the dispatch itself failed (adapter
42
+ * failure / unmintable repair candidate). `injectedSources` is the run loop's
43
+ * current grounding-inject payload for the candidate under repair (null when the
44
+ * run is not spotlight-grounded) — passed in so the returned `done` meta carries
45
+ * the same `groundingMeta` the primary success path would.
46
+ */
47
+ function createAttemptRepair(deps) {
48
+ const { adapters, guard, unpricedRatePerTok, route, mode, recordAttempt, captureAttempt, ledger, servedVariant, ladder, destination, failRun, } = deps;
49
+ return async function attemptRepair(step, original, originalSystemPrompt, invalidText, errors, injectedSources, originalUserPrompt) {
50
+ let repairCandidate;
51
+ let systemPrompt;
52
+ // Issue #5 (R1): the same-model re-ask keeps a declared `prompt.user` turn;
53
+ // the repair-model path re-frames the whole task (invalid output + errors +
54
+ // schema) and is unchanged. REPAIR_DIRECTIVE alone ⇒ byte-identical to pre-R1.
55
+ let userPrompt = exports.REPAIR_DIRECTIVE;
56
+ if (step.kind === "same_model") {
57
+ repairCandidate = original;
58
+ systemPrompt = originalSystemPrompt + (0, repair_1.repairFeedbackBlock)(errors);
59
+ userPrompt = repairUserTurn(route, originalUserPrompt ?? "");
60
+ }
61
+ else {
62
+ // Declare-first backstop (spec §4.4): the loader rejects a `trial` candidate
63
+ // as `repair_model`, but a programmatically-built bundle (runBundle) could
64
+ // bypass the loader — so refuse to mint a trial candidate for LIVE repair
65
+ // here too (the primary ladder's trial-drop has no repair-path equivalent).
66
+ if (mode === "live" &&
67
+ route.candidates.some((c) => c.provider === step.model.provider && c.model === step.model.model && c.trial === true)) {
68
+ return null;
69
+ }
70
+ // Brand stays in resolve.ts; loader validated repairModel ⊆ declared.
71
+ const minted = (0, resolve_1.resolveDeclaredCandidate)(route, step.model);
72
+ if (minted === null)
73
+ return null;
74
+ repairCandidate = minted;
75
+ systemPrompt = (0, repair_1.repairModelPrompt)(invalidText, errors, route.outputSchema);
76
+ }
77
+ const repairedBy = `${repairCandidate.provider}/${repairCandidate.model}`;
78
+ const adapter = adapters.get(repairCandidate.provider);
79
+ if (adapter === undefined)
80
+ return null;
81
+ if (guard !== null) {
82
+ // A1: unpriced repair models fail closed exactly like primaries.
83
+ const breach = guard.precheck((0, cost_1.dispatchEstimateUsd)(repairCandidate.provider, repairCandidate.model, systemPrompt.length + userPrompt.length, unpricedRatePerTok));
84
+ if (breach !== null) {
85
+ failRun(repairCandidate, breach, 0);
86
+ }
87
+ }
88
+ const started = Date.now();
89
+ const result = await adapter.call((0, dispatch_1.buildRepairAdapterRequest)(route, repairCandidate, systemPrompt, userPrompt));
90
+ const latencyMs = Date.now() - started;
91
+ if (!result.ok) {
92
+ let cost = 0;
93
+ let repairFailurePricingMissing = false;
94
+ if (result.usage !== undefined) {
95
+ const settled = (0, cost_1.attemptCost)(repairCandidate.provider, repairCandidate.model, result.usage, unpricedRatePerTok);
96
+ cost = settled.costUsd;
97
+ repairFailurePricingMissing = settled.pricingMissing;
98
+ guard?.settle(settled.envelopeChargeUsd);
99
+ }
100
+ recordAttempt({
101
+ candidate: repairCandidate,
102
+ servedTier: result.usage?.servedTier ?? route.policy.tier,
103
+ tokensIn: result.usage?.tokensIn ?? 0,
104
+ tokensOut: result.usage?.tokensOut ?? 0,
105
+ tokensCached: result.usage?.tokensCached ?? 0,
106
+ tokensCacheWrite: result.usage?.tokensCacheWrite ?? 0,
107
+ tokensCacheWrite1h: result.usage?.tokensCacheWrite1h ?? 0,
108
+ costUsd: cost,
109
+ latencyMs,
110
+ ...(result.usage?.ttfbMs !== undefined ? { ttfbMs: result.usage.ttfbMs } : {}),
111
+ failure: result.failure,
112
+ repairedBy,
113
+ pricingMissing: repairFailurePricingMissing,
114
+ metaInputs: (0, dispatch_1.attemptMetaInputs)({ systemPrompt, userDirective: userPrompt, outputSchema: route.outputSchema, outputKind: route.outputKind, result }),
115
+ });
116
+ if (failures_1.TERMINAL_CLASSES.has(result.failure.class)) {
117
+ throw new failures_1.RigFailureError(result.failure);
118
+ }
119
+ return null;
120
+ }
121
+ const { costUsd, envelopeChargeUsd, pricingMissing: repairPricingMissing, } = (0, cost_1.attemptCost)(repairCandidate.provider, repairCandidate.model, result.usage, unpricedRatePerTok);
122
+ guard?.settle(envelopeChargeUsd);
123
+ const outcome = (0, validate_1.validateOutput)(route, result.text);
124
+ const failure = outcome.valid
125
+ ? null
126
+ : {
127
+ class: "content_invalid",
128
+ message: `repair output failed schema validation: ${outcome.errors.join("; ")}`,
129
+ provider: repairCandidate.provider,
130
+ model: repairCandidate.model,
131
+ };
132
+ const inferenceId = recordAttempt({
133
+ candidate: repairCandidate,
134
+ servedTier: result.usage.servedTier,
135
+ tokensIn: result.usage.tokensIn,
136
+ tokensOut: result.usage.tokensOut,
137
+ tokensCached: result.usage.tokensCached,
138
+ tokensCacheWrite: result.usage.tokensCacheWrite ?? 0,
139
+ tokensCacheWrite1h: result.usage.tokensCacheWrite1h ?? 0,
140
+ costUsd,
141
+ latencyMs,
142
+ ...(result.usage.ttfbMs !== undefined ? { ttfbMs: result.usage.ttfbMs } : {}),
143
+ failure,
144
+ repairedBy,
145
+ pricingMissing: repairPricingMissing,
146
+ metaInputs: (0, dispatch_1.attemptMetaInputs)({ systemPrompt, userDirective: userPrompt, outputSchema: route.outputSchema, outputKind: route.outputKind, result }),
147
+ });
148
+ captureAttempt(inferenceId, result.text);
149
+ if (!outcome.valid) {
150
+ return { invalid: { text: result.text, errors: outcome.errors } };
151
+ }
152
+ return {
153
+ done: {
154
+ output: outcome.parsed,
155
+ meta: {
156
+ inferenceId,
157
+ route: route.route,
158
+ routeVersion: route.version,
159
+ provider: repairCandidate.provider,
160
+ model: repairCandidate.model,
161
+ requestedTier: route.policy.tier,
162
+ servedTier: result.usage.servedTier,
163
+ tokensIn: result.usage.tokensIn,
164
+ tokensOut: result.usage.tokensOut,
165
+ tokensCached: result.usage.tokensCached,
166
+ costEstimateUsd: costUsd,
167
+ latencyMs,
168
+ validated: true,
169
+ attemptsByClass: ledger.snapshot(),
170
+ servedVariant,
171
+ repairedBy,
172
+ callId: ladder.callId, destination, // destination: Unified Route U2 (D-2)
173
+ ...(injectedSources !== null
174
+ ? (0, grounding_1.groundingMeta)(result.text, injectedSources)
175
+ : {}),
176
+ },
177
+ },
178
+ };
179
+ };
180
+ }
@@ -0,0 +1,49 @@
1
+ /**
2
+ * Serving-destination resolution + the U2 fail-closed guard (Unified Route U2,
3
+ * ruling D-2). Its own module so run.ts stays under the 700-LOC cap (EXTRACT,
4
+ * don't grow) and so U3 can wire managed serving through the same two seams.
5
+ *
6
+ * `resolveDestination` is pure: it picks the EFFECTIVE served destination with a
7
+ * fixed precedence — a per-run `RunOptions.destination` override wins, else the
8
+ * route's declared `destination`, else `DEFAULT_DESTINATION` (`direct`). Absent
9
+ * everywhere ⇒ `direct` ⇒ BYTE-IDENTICAL (the top acceptance bar).
10
+ *
11
+ * `assertDestinationServable` is the fail-closed-but-discoverable guard, made
12
+ * flag + capability aware in U3. `modelrig-served` PASSES only when BOTH the
13
+ * managed-serving config flag (`config.managedServing`, set IN CODE via
14
+ * `createRig` — NOT an env var; default off) is on AND the run's provider can be
15
+ * served (`providersServing("modelrig-served")` —
16
+ * fireworks/deepinfra per U1). Otherwise it throws a TEACHING `RigFailureError`
17
+ * (class `invariant_violation`) rather than silently serving `direct`, with a
18
+ * fixHint that distinguishes the two failure cases. `direct` passes untouched —
19
+ * no throw, no telemetry row, no provider call — so an absent/`direct` route is
20
+ * byte-identical, and ANY run with the flag off behaves exactly as today.
21
+ *
22
+ * This is a SEAM, not a key override: the fireworks/deepinfra adapters already
23
+ * carry ModelRig-owned keys on the routed lane (config.ts PROVIDER_KEY_ENV), so
24
+ * a passing `modelrig-served` run dispatches through the SAME adapter/key a
25
+ * `direct` run would — U3 gates it and tags it (record-attempt.ts), it does not
26
+ * flip a credential. True customer-keyless serving now SHIPS as a hosted-server
27
+ * capability (built by the keyless-serving program — SDK transport K1,
28
+ * named-variable K1b, per-org provisioning K2), gated by `config.managedServing`
29
+ * (default off) rather than deferred (spec §4 U3).
30
+ */
31
+ import type { Destination } from "./destination";
32
+ import type { ProviderId } from "../types/provider";
33
+ /** The effective served destination: RunOptions override > route > default
34
+ * `direct`. Pure — no throw; the fail-closed decision lives in the guard below. */
35
+ export declare function resolveDestination(routeDestination: Destination | undefined, runOptionDestination: Destination | undefined): Destination;
36
+ /**
37
+ * Fail-closed-but-discoverable guard (U3, flag + capability aware). `direct`
38
+ * always passes (returns void — byte-identical). `modelrig-served` passes ONLY
39
+ * when the managed-serving flag is on AND `provider` is served-capable; the two
40
+ * failure cases throw a teaching `RigFailureError` with a distinguishing fixHint:
41
+ * • flag OFF → tells the caller to set `managedServing: true` in
42
+ * the rig config (or set `destination: direct`).
43
+ * • flag ON, provider incapable (openai/gemini/grok/deepseek/anthropic) → names
44
+ * the served-capable set from the U1 matrix.
45
+ * `provider` is the run's RESOLVED serving candidate (threaded from run.ts). No
46
+ * silent `direct` fallback either way (spec §4 U3, R3).
47
+ */
48
+ export declare function assertDestinationServable(destination: Destination, managedServingEnabled: boolean, provider: ProviderId): void;
49
+ //# sourceMappingURL=resolve-destination.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"resolve-destination.d.ts","sourceRoot":"","sources":["../../src/run/resolve-destination.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAGjD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAGpD;mFACmF;AACnF,wBAAgB,kBAAkB,CAChC,gBAAgB,EAAE,WAAW,GAAG,SAAS,EACzC,oBAAoB,EAAE,WAAW,GAAG,SAAS,GAC5C,WAAW,CAEb;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,yBAAyB,CACvC,WAAW,EAAE,WAAW,EACxB,qBAAqB,EAAE,OAAO,EAC9B,QAAQ,EAAE,UAAU,GACnB,IAAI,CAuBN"}
@@ -0,0 +1,76 @@
1
+ "use strict";
2
+ /**
3
+ * Serving-destination resolution + the U2 fail-closed guard (Unified Route U2,
4
+ * ruling D-2). Its own module so run.ts stays under the 700-LOC cap (EXTRACT,
5
+ * don't grow) and so U3 can wire managed serving through the same two seams.
6
+ *
7
+ * `resolveDestination` is pure: it picks the EFFECTIVE served destination with a
8
+ * fixed precedence — a per-run `RunOptions.destination` override wins, else the
9
+ * route's declared `destination`, else `DEFAULT_DESTINATION` (`direct`). Absent
10
+ * everywhere ⇒ `direct` ⇒ BYTE-IDENTICAL (the top acceptance bar).
11
+ *
12
+ * `assertDestinationServable` is the fail-closed-but-discoverable guard, made
13
+ * flag + capability aware in U3. `modelrig-served` PASSES only when BOTH the
14
+ * managed-serving config flag (`config.managedServing`, set IN CODE via
15
+ * `createRig` — NOT an env var; default off) is on AND the run's provider can be
16
+ * served (`providersServing("modelrig-served")` —
17
+ * fireworks/deepinfra per U1). Otherwise it throws a TEACHING `RigFailureError`
18
+ * (class `invariant_violation`) rather than silently serving `direct`, with a
19
+ * fixHint that distinguishes the two failure cases. `direct` passes untouched —
20
+ * no throw, no telemetry row, no provider call — so an absent/`direct` route is
21
+ * byte-identical, and ANY run with the flag off behaves exactly as today.
22
+ *
23
+ * This is a SEAM, not a key override: the fireworks/deepinfra adapters already
24
+ * carry ModelRig-owned keys on the routed lane (config.ts PROVIDER_KEY_ENV), so
25
+ * a passing `modelrig-served` run dispatches through the SAME adapter/key a
26
+ * `direct` run would — U3 gates it and tags it (record-attempt.ts), it does not
27
+ * flip a credential. True customer-keyless serving now SHIPS as a hosted-server
28
+ * capability (built by the keyless-serving program — SDK transport K1,
29
+ * named-variable K1b, per-org provisioning K2), gated by `config.managedServing`
30
+ * (default off) rather than deferred (spec §4 U3).
31
+ */
32
+ Object.defineProperty(exports, "__esModule", { value: true });
33
+ exports.resolveDestination = resolveDestination;
34
+ exports.assertDestinationServable = assertDestinationServable;
35
+ const destination_1 = require("./destination");
36
+ const raw_support_1 = require("./raw-support");
37
+ const failures_1 = require("../types/failures");
38
+ /** The effective served destination: RunOptions override > route > default
39
+ * `direct`. Pure — no throw; the fail-closed decision lives in the guard below. */
40
+ function resolveDestination(routeDestination, runOptionDestination) {
41
+ return runOptionDestination ?? routeDestination ?? destination_1.DEFAULT_DESTINATION;
42
+ }
43
+ /**
44
+ * Fail-closed-but-discoverable guard (U3, flag + capability aware). `direct`
45
+ * always passes (returns void — byte-identical). `modelrig-served` passes ONLY
46
+ * when the managed-serving flag is on AND `provider` is served-capable; the two
47
+ * failure cases throw a teaching `RigFailureError` with a distinguishing fixHint:
48
+ * • flag OFF → tells the caller to set `managedServing: true` in
49
+ * the rig config (or set `destination: direct`).
50
+ * • flag ON, provider incapable (openai/gemini/grok/deepseek/anthropic) → names
51
+ * the served-capable set from the U1 matrix.
52
+ * `provider` is the run's RESOLVED serving candidate (threaded from run.ts). No
53
+ * silent `direct` fallback either way (spec §4 U3, R3).
54
+ */
55
+ function assertDestinationServable(destination, managedServingEnabled, provider) {
56
+ if (destination !== "modelrig-served")
57
+ return; // direct ⇒ byte-identical
58
+ if (!managedServingEnabled) {
59
+ throw new failures_1.RigFailureError({
60
+ class: "invariant_violation",
61
+ message: 'resolved destination "modelrig-served", but managed serving is not enabled (config `managedServing` is off)',
62
+ fixHint: "managed serving is not enabled — set `managedServing: true` in your rig config " +
63
+ "(e.g. `createRig({ managedServing: true })`) to serve `destination: modelrig-served`; " +
64
+ "otherwise remove `destination` or set it to `direct`.",
65
+ });
66
+ }
67
+ if (!(0, raw_support_1.providersServing)("modelrig-served").includes(provider)) {
68
+ const served = (0, raw_support_1.providersServing)("modelrig-served").join(", ");
69
+ throw new failures_1.RigFailureError({
70
+ class: "invariant_violation",
71
+ message: `provider ${provider} cannot be modelrig-served`,
72
+ fixHint: `provider ${provider} cannot be modelrig-served; served providers: ${served}. ` +
73
+ "Declare a served-capable candidate (fireworks/deepinfra), or set `destination: direct`.",
74
+ });
75
+ }
76
+ }
@@ -1 +1 @@
1
- {"version":3,"file":"routing-docs.d.ts","sourceRoot":"","sources":["../../src/run/routing-docs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AE,WAAW,CAAC,MAAM,CAAC,GAAG,MAAM,CAoB7E;AAED;;;;+DAI+D;AAC/D,wBAAgB,iBAAiB,IAAI,SAAS,YAAY,EAAE,CAE3D;AA0BD;;;;;GAKG;AACH,wBAAgB,oBAAoB,IAAI,MAAM,CAW7C;AAED,gFAAgF;AAChF,wBAAgB,kBAAkB,CAAC,GAAG,EAAE,YAAY,GAAG,MAAM,CAE5D"}
@@ -52,10 +52,15 @@ exports.ROUTING_BOUNDARY = [
52
52
  },
53
53
  {
54
54
  id: "B2",
55
- status: "not_built",
56
- capability: "Structure on the raw lane",
57
- statement: '`runRaw` never validates or repairs; `responseFormat: "json_object"` shapes MIME, not schema, so `meta.validated` stays false — structure on the raw lane is ruled out by design, and the path is to graduate that step to a route.',
58
- tracking: "ruled schema-free on the raw lane; re-request on file",
55
+ status: "by_design",
56
+ capability: "Repair on the raw lane",
57
+ // R2 (issue #6) narrowed this entry: `responseSchema` now VALIDATES on the
58
+ // raw lane (native directive + client-side Ajv, a miss is `content_invalid`).
59
+ // What stays out by design is the ladder — no repair rung, no retry budget,
60
+ // no fall-through — so `meta.validated` stays false on this lane. The
61
+ // tripwire keeps watching for the route-grade `outputSchema` contract.
62
+ statement: '`runRaw` validates a declared `responseSchema` (the provider\'s native structured-output directive plus a client-side Ajv check; a miss is a billed, terminal `content_invalid`) but never repairs, never retries, and never falls through — `meta.validated` stays false because no ladder stands behind the check, `responseFormat: "json_object"` shapes MIME only, and a schema miss you want recovered means graduating that step to a route.',
63
+ tracking: "route-bundles.md — raw-lane responseSchema (validate, never repair)",
59
64
  tripwire: { file: "src/run/raw.ts", mustNotMatch: /readonly outputSchema\??:/ },
60
65
  },
61
66
  {
@@ -96,7 +101,7 @@ exports.ROUTING_BOUNDARY = [
96
101
  id: "B7",
97
102
  status: "by_design",
98
103
  capability: "Automatic model swap",
99
- statement: "Nothing changes what serves a route without a bake-off and an explicit human approval (`modelrig swap execute <id> --approve`).",
104
+ statement: "No automated change to what serves a route happens without a bake-off and human approval (`modelrig swap execute <id> --approve`); you (or your agent) can change it directly at any time — instant, versioned, reversible.",
100
105
  tracking: "optimization-loop.md — human-approved swaps only",
101
106
  // No file tripwire: the P6 never-silent-swap invariant is covered by its
102
107
  // own dev-rule tests (spec §5.3).
package/dist/run/run.d.ts CHANGED
@@ -9,10 +9,12 @@
9
9
  import type { LoadedRoutes } from "../routes/loader";
10
10
  import type { ProviderAdapter } from "../types/provider";
11
11
  import type { RigManifest } from "../routes/manifest";
12
- import type { RunOptions, RunResult } from "../types/route";
12
+ import type { RouteBundle, RunOptions, RunResult } from "../types/route";
13
+ import type { CapabilityFlag } from "../types/provider";
13
14
  import type { TelemetryStore } from "../types/telemetry";
14
15
  import type { CaptureStore } from "../telemetry/capture";
15
16
  import type { CapabilityLookup, RunMode } from "./resolve";
17
+ import type { ServeFetch, ServeTransportConfig } from "../gateway/serve-client";
16
18
  import type { SearchProvider } from "./grounding";
17
19
  import type { StreamDeltaSink } from "./dispatch";
18
20
  import type { TaskSettingsResolver } from "../settings/task-settings";
@@ -56,6 +58,33 @@ export interface RunDeps {
56
58
  * trial variant; `live` drops trial candidates before minting and rejects a
57
59
  * trial variant. Absent ⇒ live ⇒ byte-identical to the pre-R3 loop. */
58
60
  readonly mode?: RunMode;
61
+ readonly managedServingEnabled?: boolean;
62
+ /** K1 (managed-serving-keyless §2/§3): the hosted-gateway transport config
63
+ * (ingest host + `rig_sk_` key), resolved from the `api`-mode export in
64
+ * `index.ts`. Read ONLY when `managedServingEnabled` is on AND the resolved
65
+ * destination is `modelrig-served`. Absent there ⇒ the served run fails closed
66
+ * (no hosted control plane / no key — never a silent `direct` fall back). */
67
+ readonly serve?: ServeTransportConfig;
68
+ /** K1: injected `fetch` for the serving transport (tests mock it; NO live
69
+ * network, NO real key). Absent ⇒ the global `fetch`. */
70
+ readonly serveFetch?: ServeFetch;
59
71
  }
72
+ /** Phase 1 prompt convention: the bundle's system template carries the whole
73
+ * task (constitution, data, step instructions); the user turn is a terse
74
+ * trigger. Providers treat long system prompts + short user turns well, and
75
+ * it keeps the single-template bundle contract of spec §3. Issue #5 (R1): a
76
+ * route that declares `prompt.user` replaces this trigger with its rendered
77
+ * user template — the per-call delta a cache handle cannot carry in the system
78
+ * slot (see `userTurnFor`). */
79
+ export declare const USER_DIRECTIVE = "Produce the required output now, following the system instructions exactly.";
80
+ /** The user turn for one primary attempt (issue #5, R1): the route's rendered
81
+ * `prompt.user` template when declared — same variables, capability
82
+ * conditionals and `x-trust` removal as the system template — else the fixed
83
+ * trigger (byte-identical to pre-R1). Pure; exported for the run tests. */
84
+ export declare function userTurnFor(route: Pick<RouteBundle, "userTemplate">, ctx: {
85
+ readonly variables: Record<string, unknown>;
86
+ readonly capabilities: ReadonlySet<CapabilityFlag>;
87
+ readonly variableTrust?: Readonly<Record<string, "untrusted">>;
88
+ }): string;
60
89
  export declare function run(deps: RunDeps, routeName: string, opts: RunOptions): Promise<RunResult>;
61
90
  //# sourceMappingURL=run.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"run.d.ts","sourceRoot":"","sources":["../../src/run/run.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAMrD,OAAO,KAAK,EAAE,eAAe,EAAgB,MAAM,mBAAmB,CAAC;AAGvE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAEtD,OAAO,KAAK,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAC5D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACzD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACzD,OAAO,KAAK,EAAE,gBAAgB,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAS3D,OAAO,KAAK,EAAE,cAAc,EAAoC,MAAM,aAAa,CAAC;AAUpF,OAAO,KAAK,EAAe,eAAe,EAA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