modelrig 0.0.1 → 0.2.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.
- package/CHANGELOG.md +94 -0
- package/LICENSE +201 -0
- package/README.md +145 -8
- package/data/PROVENANCE.md +19 -0
- package/data/pricing-manual.json +22 -0
- package/data/pricing-map.json +46362 -0
- package/data/pricing-overlay.json +419 -0
- package/dist/adapters/anthropic.d.ts +90 -0
- package/dist/adapters/anthropic.d.ts.map +1 -0
- package/dist/adapters/anthropic.js +296 -0
- package/dist/adapters/build-adapters.d.ts +11 -0
- package/dist/adapters/build-adapters.d.ts.map +1 -0
- package/dist/adapters/build-adapters.js +45 -0
- package/dist/adapters/deepseek.d.ts +47 -0
- package/dist/adapters/deepseek.d.ts.map +1 -0
- package/dist/adapters/deepseek.js +216 -0
- package/dist/adapters/gemini.d.ts +44 -0
- package/dist/adapters/gemini.d.ts.map +1 -0
- package/dist/adapters/gemini.js +262 -0
- package/dist/adapters/grok.d.ts +53 -0
- package/dist/adapters/grok.d.ts.map +1 -0
- package/dist/adapters/grok.js +232 -0
- package/dist/adapters/openai-compat.d.ts +80 -0
- package/dist/adapters/openai-compat.d.ts.map +1 -0
- package/dist/adapters/openai-compat.js +244 -0
- package/dist/adapters/openai-stream.d.ts +58 -0
- package/dist/adapters/openai-stream.d.ts.map +1 -0
- package/dist/adapters/openai-stream.js +120 -0
- package/dist/adapters/openai.d.ts +55 -0
- package/dist/adapters/openai.d.ts.map +1 -0
- package/dist/adapters/openai.js +281 -0
- package/dist/adapters/sampling.d.ts +28 -0
- package/dist/adapters/sampling.d.ts.map +1 -0
- package/dist/adapters/sampling.js +34 -0
- package/dist/adapters/tool-mapping.d.ts +92 -0
- package/dist/adapters/tool-mapping.d.ts.map +1 -0
- package/dist/adapters/tool-mapping.js +143 -0
- package/dist/artifacts/artifact.d.ts +137 -0
- package/dist/artifacts/artifact.d.ts.map +1 -0
- package/dist/artifacts/artifact.js +377 -0
- package/dist/artifacts/content-uploader.d.ts +87 -0
- package/dist/artifacts/content-uploader.d.ts.map +1 -0
- package/dist/artifacts/content-uploader.js +124 -0
- package/dist/artifacts/index.d.ts +63 -0
- package/dist/artifacts/index.d.ts.map +1 -0
- package/dist/artifacts/index.js +80 -0
- package/dist/artifacts/run-context.d.ts +129 -0
- package/dist/artifacts/run-context.d.ts.map +1 -0
- package/dist/artifacts/run-context.js +208 -0
- package/dist/artifacts/scrub.d.ts +60 -0
- package/dist/artifacts/scrub.d.ts.map +1 -0
- package/dist/artifacts/scrub.js +139 -0
- package/dist/artifacts/step.d.ts +26 -0
- package/dist/artifacts/step.d.ts.map +1 -0
- package/dist/artifacts/step.js +37 -0
- package/dist/artifacts/taint.d.ts +63 -0
- package/dist/artifacts/taint.d.ts.map +1 -0
- package/dist/artifacts/taint.js +76 -0
- package/dist/bakeoff/cache-sim.d.ts +99 -0
- package/dist/bakeoff/cache-sim.d.ts.map +1 -0
- package/dist/bakeoff/cache-sim.js +126 -0
- package/dist/bakeoff/engine.d.ts +52 -0
- package/dist/bakeoff/engine.d.ts.map +1 -0
- package/dist/bakeoff/engine.js +163 -0
- package/dist/bakeoff/eval-cases.d.ts +96 -0
- package/dist/bakeoff/eval-cases.d.ts.map +1 -0
- package/dist/bakeoff/eval-cases.js +105 -0
- package/dist/bakeoff/replay.d.ts +52 -0
- package/dist/bakeoff/replay.d.ts.map +1 -0
- package/dist/bakeoff/replay.js +94 -0
- package/dist/bakeoff/report.d.ts +41 -0
- package/dist/bakeoff/report.d.ts.map +1 -0
- package/dist/bakeoff/report.js +142 -0
- package/dist/bakeoff/samples.d.ts +77 -0
- package/dist/bakeoff/samples.d.ts.map +1 -0
- package/dist/bakeoff/samples.js +148 -0
- package/dist/bakeoff/stats.d.ts +13 -0
- package/dist/bakeoff/stats.d.ts.map +1 -0
- package/dist/bakeoff/stats.js +48 -0
- package/dist/bakeoff/types.d.ts +37 -0
- package/dist/bakeoff/types.d.ts.map +1 -0
- package/dist/bakeoff/types.js +10 -0
- package/dist/cli.d.ts +25 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +590 -0
- package/dist/config.d.ts +204 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/config.js +252 -0
- package/dist/deprecations.d.ts +32 -0
- package/dist/deprecations.d.ts.map +1 -0
- package/dist/deprecations.js +59 -0
- package/dist/feedback/coverage.d.ts +32 -0
- package/dist/feedback/coverage.d.ts.map +1 -0
- package/dist/feedback/coverage.js +95 -0
- package/dist/feedback/feedback.d.ts +35 -0
- package/dist/feedback/feedback.d.ts.map +1 -0
- package/dist/feedback/feedback.js +39 -0
- package/dist/gateway/http-protocol.d.ts +175 -0
- package/dist/gateway/http-protocol.d.ts.map +1 -0
- package/dist/gateway/http-protocol.js +105 -0
- package/dist/index.d.ts +242 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +576 -0
- package/dist/init/finder.d.ts +94 -0
- package/dist/init/finder.d.ts.map +1 -0
- package/dist/init/finder.js +343 -0
- package/dist/init/init-cli.d.ts +10 -0
- package/dist/init/init-cli.d.ts.map +1 -0
- package/dist/init/init-cli.js +86 -0
- package/dist/init/observe-cli.d.ts +19 -0
- package/dist/init/observe-cli.d.ts.map +1 -0
- package/dist/init/observe-cli.js +73 -0
- package/dist/init/observe.d.ts +81 -0
- package/dist/init/observe.d.ts.map +1 -0
- package/dist/init/observe.js +245 -0
- package/dist/init/run.d.ts +99 -0
- package/dist/init/run.d.ts.map +1 -0
- package/dist/init/run.js +281 -0
- package/dist/init/signatures.d.ts +39 -0
- package/dist/init/signatures.d.ts.map +1 -0
- package/dist/init/signatures.js +116 -0
- package/dist/matrix/aggregate.d.ts +89 -0
- package/dist/matrix/aggregate.d.ts.map +1 -0
- package/dist/matrix/aggregate.js +186 -0
- package/dist/query/grammar.d.ts +35 -0
- package/dist/query/grammar.d.ts.map +1 -0
- package/dist/query/grammar.js +279 -0
- package/dist/query/run.d.ts +8 -0
- package/dist/query/run.d.ts.map +1 -0
- package/dist/query/run.js +21 -0
- package/dist/registry/build.d.ts +219 -0
- package/dist/registry/build.d.ts.map +1 -0
- package/dist/registry/build.js +313 -0
- package/dist/registry/cache-policy.d.ts +94 -0
- package/dist/registry/cache-policy.d.ts.map +1 -0
- package/dist/registry/cache-policy.js +238 -0
- package/dist/registry/call-notes.d.ts +11 -0
- package/dist/registry/call-notes.d.ts.map +1 -0
- package/dist/registry/call-notes.js +110 -0
- package/dist/registry/claims.d.ts +63 -0
- package/dist/registry/claims.d.ts.map +1 -0
- package/dist/registry/claims.js +107 -0
- package/dist/registry/effective-rate.d.ts +151 -0
- package/dist/registry/effective-rate.d.ts.map +1 -0
- package/dist/registry/effective-rate.js +156 -0
- package/dist/registry/facts.d.ts +32 -0
- package/dist/registry/facts.d.ts.map +1 -0
- package/dist/registry/facts.js +136 -0
- package/dist/registry/fingerprint.d.ts +20 -0
- package/dist/registry/fingerprint.d.ts.map +1 -0
- package/dist/registry/fingerprint.js +150 -0
- package/dist/registry/parity.d.ts +52 -0
- package/dist/registry/parity.d.ts.map +1 -0
- package/dist/registry/parity.js +82 -0
- package/dist/registry/pricing-shape.d.ts +113 -0
- package/dist/registry/pricing-shape.d.ts.map +1 -0
- package/dist/registry/pricing-shape.js +123 -0
- package/dist/registry/pricing.d.ts +43 -0
- package/dist/registry/pricing.d.ts.map +1 -0
- package/dist/registry/pricing.js +127 -0
- package/dist/registry/rows.d.ts +16 -0
- package/dist/registry/rows.d.ts.map +1 -0
- package/dist/registry/rows.js +57 -0
- package/dist/registry/seed.d.ts +43 -0
- package/dist/registry/seed.d.ts.map +1 -0
- package/dist/registry/seed.js +97 -0
- package/dist/registry/select.d.ts +68 -0
- package/dist/registry/select.d.ts.map +1 -0
- package/dist/registry/select.js +141 -0
- package/dist/registry/staleness.d.ts +18 -0
- package/dist/registry/staleness.d.ts.map +1 -0
- package/dist/registry/staleness.js +39 -0
- package/dist/rigindex/bootstrap.d.ts +36 -0
- package/dist/rigindex/bootstrap.d.ts.map +1 -0
- package/dist/rigindex/bootstrap.js +97 -0
- package/dist/rigindex/fit.d.ts +24 -0
- package/dist/rigindex/fit.d.ts.map +1 -0
- package/dist/rigindex/fit.js +76 -0
- package/dist/rigindex/gates.d.ts +52 -0
- package/dist/rigindex/gates.d.ts.map +1 -0
- package/dist/rigindex/gates.js +109 -0
- package/dist/rigindex/graph.d.ts +31 -0
- package/dist/rigindex/graph.d.ts.map +1 -0
- package/dist/rigindex/graph.js +120 -0
- package/dist/rigindex/index.d.ts +23 -0
- package/dist/rigindex/index.d.ts.map +1 -0
- package/dist/rigindex/index.js +112 -0
- package/dist/rigindex/types.d.ts +76 -0
- package/dist/rigindex/types.d.ts.map +1 -0
- package/dist/rigindex/types.js +8 -0
- package/dist/routes/cache-lint.d.ts +41 -0
- package/dist/routes/cache-lint.d.ts.map +1 -0
- package/dist/routes/cache-lint.js +81 -0
- package/dist/routes/draft.d.ts +83 -0
- package/dist/routes/draft.d.ts.map +1 -0
- package/dist/routes/draft.js +135 -0
- package/dist/routes/loader.d.ts +63 -0
- package/dist/routes/loader.d.ts.map +1 -0
- package/dist/routes/loader.js +574 -0
- package/dist/routes/manifest.d.ts +24 -0
- package/dist/routes/manifest.d.ts.map +1 -0
- package/dist/routes/manifest.js +118 -0
- package/dist/routes/resolved-bundle.d.ts +79 -0
- package/dist/routes/resolved-bundle.d.ts.map +1 -0
- package/dist/routes/resolved-bundle.js +148 -0
- package/dist/routes/sampling-config.d.ts +32 -0
- package/dist/routes/sampling-config.d.ts.map +1 -0
- package/dist/routes/sampling-config.js +91 -0
- package/dist/routes/serveability.d.ts +52 -0
- package/dist/routes/serveability.d.ts.map +1 -0
- package/dist/routes/serveability.js +73 -0
- package/dist/routes/template.d.ts +18 -0
- package/dist/routes/template.d.ts.map +1 -0
- package/dist/routes/template.js +94 -0
- package/dist/run/ajv.d.ts +22 -0
- package/dist/run/ajv.d.ts.map +1 -0
- package/dist/run/ajv.js +32 -0
- package/dist/run/cache-handle.d.ts +58 -0
- package/dist/run/cache-handle.d.ts.map +1 -0
- package/dist/run/cache-handle.js +54 -0
- package/dist/run/cache-stamp.d.ts +65 -0
- package/dist/run/cache-stamp.d.ts.map +1 -0
- package/dist/run/cache-stamp.js +0 -0
- package/dist/run/capture-write.d.ts +33 -0
- package/dist/run/capture-write.d.ts.map +1 -0
- package/dist/run/capture-write.js +55 -0
- package/dist/run/cost.d.ts +26 -0
- package/dist/run/cost.d.ts.map +1 -0
- package/dist/run/cost.js +41 -0
- package/dist/run/dispatch.d.ts +99 -0
- package/dist/run/dispatch.d.ts.map +1 -0
- package/dist/run/dispatch.js +191 -0
- package/dist/run/envelope.d.ts +21 -0
- package/dist/run/envelope.d.ts.map +1 -0
- package/dist/run/envelope.js +45 -0
- package/dist/run/grounding.d.ts +56 -0
- package/dist/run/grounding.d.ts.map +1 -0
- package/dist/run/grounding.js +89 -0
- package/dist/run/raw.d.ts +88 -0
- package/dist/run/raw.d.ts.map +1 -0
- package/dist/run/raw.js +286 -0
- package/dist/run/record-attempt.d.ts +40 -0
- package/dist/run/record-attempt.d.ts.map +1 -0
- package/dist/run/record-attempt.js +99 -0
- package/dist/run/repair.d.ts +36 -0
- package/dist/run/repair.d.ts.map +1 -0
- package/dist/run/repair.js +61 -0
- package/dist/run/resolve.d.ts +99 -0
- package/dist/run/resolve.d.ts.map +1 -0
- package/dist/run/resolve.js +203 -0
- package/dist/run/retry.d.ts +19 -0
- package/dist/run/retry.d.ts.map +1 -0
- package/dist/run/retry.js +50 -0
- package/dist/run/run.d.ts +55 -0
- package/dist/run/run.d.ts.map +1 -0
- package/dist/run/run.js +540 -0
- package/dist/run/stream.d.ts +49 -0
- package/dist/run/stream.d.ts.map +1 -0
- package/dist/run/stream.js +87 -0
- package/dist/run/validate.d.ts +15 -0
- package/dist/run/validate.d.ts.map +1 -0
- package/dist/run/validate.js +55 -0
- package/dist/savings/cache-ledger.d.ts +108 -0
- package/dist/savings/cache-ledger.d.ts.map +1 -0
- package/dist/savings/cache-ledger.js +174 -0
- package/dist/savings/cache-reconcile.d.ts +64 -0
- package/dist/savings/cache-reconcile.d.ts.map +1 -0
- package/dist/savings/cache-reconcile.js +59 -0
- package/dist/savings/cache-stats.d.ts +63 -0
- package/dist/savings/cache-stats.d.ts.map +1 -0
- package/dist/savings/cache-stats.js +108 -0
- package/dist/savings/emit.d.ts +38 -0
- package/dist/savings/emit.d.ts.map +1 -0
- package/dist/savings/emit.js +100 -0
- package/dist/savings/odometer.d.ts +32 -0
- package/dist/savings/odometer.d.ts.map +1 -0
- package/dist/savings/odometer.js +70 -0
- package/dist/savings/swap-execute.d.ts +58 -0
- package/dist/savings/swap-execute.d.ts.map +1 -0
- package/dist/savings/swap-execute.js +130 -0
- package/dist/savings/swaps-client.d.ts +55 -0
- package/dist/savings/swaps-client.d.ts.map +1 -0
- package/dist/savings/swaps-client.js +95 -0
- package/dist/settings/api-fetcher.d.ts +39 -0
- package/dist/settings/api-fetcher.d.ts.map +1 -0
- package/dist/settings/api-fetcher.js +92 -0
- package/dist/settings/index.d.ts +10 -0
- package/dist/settings/index.d.ts.map +1 -0
- package/dist/settings/index.js +15 -0
- package/dist/settings/task-settings.d.ts +91 -0
- package/dist/settings/task-settings.d.ts.map +1 -0
- package/dist/settings/task-settings.js +116 -0
- package/dist/status.d.ts +77 -0
- package/dist/status.d.ts.map +1 -0
- package/dist/status.js +113 -0
- package/dist/telemetry/artifact-store.d.ts +48 -0
- package/dist/telemetry/artifact-store.d.ts.map +1 -0
- package/dist/telemetry/artifact-store.js +189 -0
- package/dist/telemetry/cache-miss-streak.d.ts +79 -0
- package/dist/telemetry/cache-miss-streak.d.ts.map +1 -0
- package/dist/telemetry/cache-miss-streak.js +99 -0
- package/dist/telemetry/capture.d.ts +31 -0
- package/dist/telemetry/capture.d.ts.map +1 -0
- package/dist/telemetry/capture.js +81 -0
- package/dist/telemetry/exporter-setup.d.ts +28 -0
- package/dist/telemetry/exporter-setup.d.ts.map +1 -0
- package/dist/telemetry/exporter-setup.js +34 -0
- package/dist/telemetry/exporter.d.ts +137 -0
- package/dist/telemetry/exporter.d.ts.map +1 -0
- package/dist/telemetry/exporter.js +510 -0
- package/dist/telemetry/health.d.ts +76 -0
- package/dist/telemetry/health.d.ts.map +1 -0
- package/dist/telemetry/health.js +92 -0
- package/dist/telemetry/ingest-protocol.d.ts +310 -0
- package/dist/telemetry/ingest-protocol.d.ts.map +1 -0
- package/dist/telemetry/ingest-protocol.js +363 -0
- package/dist/telemetry/load-error-report.d.ts +24 -0
- package/dist/telemetry/load-error-report.d.ts.map +1 -0
- package/dist/telemetry/load-error-report.js +50 -0
- package/dist/telemetry/otel-map.d.ts +121 -0
- package/dist/telemetry/otel-map.d.ts.map +1 -0
- package/dist/telemetry/otel-map.js +224 -0
- package/dist/telemetry/otel-normalize.d.ts +104 -0
- package/dist/telemetry/otel-normalize.d.ts.map +1 -0
- package/dist/telemetry/otel-normalize.js +530 -0
- package/dist/telemetry/otlp-emitter.d.ts +52 -0
- package/dist/telemetry/otlp-emitter.d.ts.map +1 -0
- package/dist/telemetry/otlp-emitter.js +144 -0
- package/dist/telemetry/otlp-proto.d.ts +29 -0
- package/dist/telemetry/otlp-proto.d.ts.map +1 -0
- package/dist/telemetry/otlp-proto.js +266 -0
- package/dist/telemetry/sinks.d.ts +90 -0
- package/dist/telemetry/sinks.d.ts.map +1 -0
- package/dist/telemetry/sinks.js +180 -0
- package/dist/telemetry/store.d.ts +65 -0
- package/dist/telemetry/store.d.ts.map +1 -0
- package/dist/telemetry/store.js +547 -0
- package/dist/tenancy/api-key-format.d.ts +77 -0
- package/dist/tenancy/api-key-format.d.ts.map +1 -0
- package/dist/tenancy/api-key-format.js +110 -0
- package/dist/tenancy/constants.d.ts +23 -0
- package/dist/tenancy/constants.d.ts.map +1 -0
- package/dist/tenancy/constants.js +25 -0
- package/dist/tenancy/scrub.d.ts +47 -0
- package/dist/tenancy/scrub.d.ts.map +1 -0
- package/dist/tenancy/scrub.js +85 -0
- package/dist/types/config-teaching.d.ts +62 -0
- package/dist/types/config-teaching.d.ts.map +1 -0
- package/dist/types/config-teaching.js +183 -0
- package/dist/types/failures-teaching.d.ts +56 -0
- package/dist/types/failures-teaching.d.ts.map +1 -0
- package/dist/types/failures-teaching.js +177 -0
- package/dist/types/failures.d.ts +27 -0
- package/dist/types/failures.d.ts.map +1 -0
- package/dist/types/failures.js +41 -0
- package/dist/types/provider.d.ts +200 -0
- package/dist/types/provider.d.ts.map +1 -0
- package/dist/types/provider.js +40 -0
- package/dist/types/route.d.ts +205 -0
- package/dist/types/route.d.ts.map +1 -0
- package/dist/types/route.js +6 -0
- package/dist/types/telemetry.d.ts +206 -0
- package/dist/types/telemetry.d.ts.map +1 -0
- package/dist/types/telemetry.js +6 -0
- package/dist/validate-cli.d.ts +12 -0
- package/dist/validate-cli.d.ts.map +1 -0
- package/dist/validate-cli.js +57 -0
- package/dist/verify/capture.d.ts +66 -0
- package/dist/verify/capture.d.ts.map +1 -0
- package/dist/verify/capture.js +180 -0
- package/dist/verify/cli-run.d.ts +23 -0
- package/dist/verify/cli-run.d.ts.map +1 -0
- package/dist/verify/cli-run.js +57 -0
- package/dist/verify/diff.d.ts +48 -0
- package/dist/verify/diff.d.ts.map +1 -0
- package/dist/verify/diff.js +157 -0
- package/dist/verify/index.d.ts +17 -0
- package/dist/verify/index.d.ts.map +1 -0
- package/dist/verify/index.js +24 -0
- package/dist/verify/report.d.ts +14 -0
- package/dist/verify/report.d.ts.map +1 -0
- package/dist/verify/report.js +88 -0
- package/dist/verify/types.d.ts +101 -0
- package/dist/verify/types.d.ts.map +1 -0
- package/dist/verify/types.js +17 -0
- package/dist/verify/verify.d.ts +29 -0
- package/dist/verify/verify.d.ts.map +1 -0
- package/dist/verify/verify.js +148 -0
- package/dist/watch/budget.d.ts +19 -0
- package/dist/watch/budget.d.ts.map +1 -0
- package/dist/watch/budget.js +35 -0
- package/dist/watch/evaluate.d.ts +225 -0
- package/dist/watch/evaluate.d.ts.map +1 -0
- package/dist/watch/evaluate.js +155 -0
- package/dist/watch/monitor.d.ts +116 -0
- package/dist/watch/monitor.d.ts.map +1 -0
- package/dist/watch/monitor.js +199 -0
- package/dist/watch/proposals.d.ts +89 -0
- package/dist/watch/proposals.d.ts.map +1 -0
- package/dist/watch/proposals.js +197 -0
- package/dist/watch/run-record.d.ts +64 -0
- package/dist/watch/run-record.d.ts.map +1 -0
- package/dist/watch/run-record.js +86 -0
- package/dist/watch/run-reported.d.ts +20 -0
- package/dist/watch/run-reported.d.ts.map +1 -0
- package/dist/watch/run-reported.js +53 -0
- package/dist/watch/run.d.ts +73 -0
- package/dist/watch/run.d.ts.map +1 -0
- package/dist/watch/run.js +83 -0
- package/dist/watch/state-store.d.ts +48 -0
- package/dist/watch/state-store.d.ts.map +1 -0
- package/dist/watch/state-store.js +86 -0
- package/dist/watch/state.d.ts +21 -0
- package/dist/watch/state.d.ts.map +1 -0
- package/dist/watch/state.js +93 -0
- package/package.json +56 -14
- package/registry/LICENSE +20 -0
- package/registry/leaderboard.json +3639 -0
- package/registry/registry.json +7263 -0
- package/index.js +0 -3
package/dist/config.d.ts
ADDED
|
@@ -0,0 +1,204 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Configuration — plan §3. THE ONLY FILE that reads process.env in this
|
|
3
|
+
* package (adapters receive keys via constructors; enforced by
|
|
4
|
+
* __tests__/package-invariants.test.ts).
|
|
5
|
+
*/
|
|
6
|
+
import type { CapabilityFlag, ProviderId } from "./types/provider";
|
|
7
|
+
export interface RigConfig {
|
|
8
|
+
readonly routesDir: string;
|
|
9
|
+
/** OPTIONAL directory of deployment-bundled INTERNAL infra routes, merged
|
|
10
|
+
* INTO `routesDir`'s routes (union, not replacement) by createRig. The server
|
|
11
|
+
* passes its gateway-internal-routes/ here so run-judge@v1 /
|
|
12
|
+
* analyst-summarize@v1 always resolve, independent of the operator's
|
|
13
|
+
* MODELRIG_ROUTES_DIR. Absent ⇒ exactly the pre-existing single-dir behavior. */
|
|
14
|
+
readonly extraRoutesDir?: string;
|
|
15
|
+
readonly telemetryDbPath: string;
|
|
16
|
+
readonly keys: {
|
|
17
|
+
readonly gemini?: string;
|
|
18
|
+
readonly openai?: string;
|
|
19
|
+
readonly deepseek?: string;
|
|
20
|
+
readonly anthropic?: string;
|
|
21
|
+
/** xAI — env: XAI_API_KEY (xAI's own convention). */
|
|
22
|
+
readonly grok?: string;
|
|
23
|
+
/** A1 aggregator hosts (generic openai-compatible adapter). */
|
|
24
|
+
readonly deepinfra?: string;
|
|
25
|
+
readonly fireworks?: string;
|
|
26
|
+
};
|
|
27
|
+
/** Budget for envelopes first opened by this rig (default: envelope.ts's $25). */
|
|
28
|
+
readonly envelopeBudgetUsd?: number;
|
|
29
|
+
/** Addendum A1: USD/MTok charged to an active envelope for models with no
|
|
30
|
+
* pricing entry (default $100 — generous-high; envelopes fail closed). */
|
|
31
|
+
readonly unpricedRateUsdPerMTok?: number;
|
|
32
|
+
/** Capability overrides — the escape hatch ABOVE the registry (precedence:
|
|
33
|
+
* overrides > probed > declared). When set for a provider, REPLACES the
|
|
34
|
+
* whole resolved flag set for every model of that provider — any misprobed
|
|
35
|
+
* fact is one config line from fixed. */
|
|
36
|
+
readonly capabilityOverrides?: Partial<Record<ProviderId, readonly CapabilityFlag[]>>;
|
|
37
|
+
/** Registry facts file (Phase 3 WS6) — default: the packaged
|
|
38
|
+
* registry/registry.json. Env: MODELRIG_REGISTRY_PATH. */
|
|
39
|
+
readonly registryPath?: string;
|
|
40
|
+
/** Search provider for the grounding-inject rung (Phase 3 WS3) — omitted
|
|
41
|
+
* means `require: grounded` routes resolve natively-grounded candidates
|
|
42
|
+
* only. */
|
|
43
|
+
readonly search?: {
|
|
44
|
+
readonly tavilyApiKey: string;
|
|
45
|
+
readonly costPerSearchUsd?: number;
|
|
46
|
+
readonly searchDepth?: "basic" | "advanced";
|
|
47
|
+
};
|
|
48
|
+
/** Watch loop (Phase 4 WS1): monthly paid-run cap + material-shift
|
|
49
|
+
* threshold. Defaults apply when unset; the loop itself is opt-in (a cron
|
|
50
|
+
* running `modelrig watch run`). */
|
|
51
|
+
readonly watch?: {
|
|
52
|
+
readonly monthlyUsd?: number;
|
|
53
|
+
readonly thresholdPct?: number;
|
|
54
|
+
};
|
|
55
|
+
/**
|
|
56
|
+
* Cloud telemetry sink — omitted => local SQLite only.
|
|
57
|
+
*
|
|
58
|
+
* telemetry-ingestion-boundary.md §2.4's three modes, as a discriminated
|
|
59
|
+
* union rather than a bag of optional fields: `api` and `direct` need
|
|
60
|
+
* different credentials and it should be impossible to half-configure one.
|
|
61
|
+
*
|
|
62
|
+
* local-only pure-router users, ZDR-strict no credentials
|
|
63
|
+
* api every hosted customer their rig_sk_ key only
|
|
64
|
+
* direct self-host + our own deployments their own database
|
|
65
|
+
*/
|
|
66
|
+
readonly export?: ApiExportConfig | DirectExportConfig;
|
|
67
|
+
/**
|
|
68
|
+
* OTLP span emission (E1) — ADDITIVE alongside `export`, never instead of it.
|
|
69
|
+
* `null` means no endpoint configured ⇒ no emitter is ever constructed and
|
|
70
|
+
* behaviour is unchanged (spec §6a). Set via MODELRIG_OTLP_ENDPOINT (+ optional
|
|
71
|
+
* MODELRIG_OTLP_HEADERS). `loadConfigFromEnv` ALWAYS resolves this (to null or
|
|
72
|
+
* a config) so `/status` can answer "configured|disabled" honestly; the field
|
|
73
|
+
* is optional only so hand-built configs (tests) need not spell out the
|
|
74
|
+
* off case — an absent value is read identically to null.
|
|
75
|
+
*/
|
|
76
|
+
readonly otlp?: OtlpConfig | null;
|
|
77
|
+
/**
|
|
78
|
+
* Artifact / execution-graph namespace (Expansion E2). OFF by default —
|
|
79
|
+
* `enabled: false` (or absent) means the run/artifact SDK surface is inert,
|
|
80
|
+
* the exporter sends protocol v1 byte-identical to before, and zero new rows
|
|
81
|
+
* are written (spec §1.4). Set via `MODELRIG_ARTIFACTS=1`. Like `otlp`,
|
|
82
|
+
* `loadConfigFromEnv` ALWAYS resolves this so `/status` can answer
|
|
83
|
+
* "enabled|disabled" honestly; optional only so hand-built configs need not
|
|
84
|
+
* spell out the off case.
|
|
85
|
+
*/
|
|
86
|
+
readonly artifacts?: ArtifactsConfig;
|
|
87
|
+
}
|
|
88
|
+
/** Scrub mode applied to content BEFORE upload (E2-C chunk B). Default `detect`
|
|
89
|
+
* when content custody is on. */
|
|
90
|
+
export type ScrubMode = "off" | "detect" | "redact" | "block";
|
|
91
|
+
/** Per-rig content-custody config (E2-C chunk A/B). Present ONLY when content
|
|
92
|
+
* custody is turned ON and the transport is configured; ABSENT (the default)
|
|
93
|
+
* means metadata + hash only — today's behaviour, unchanged. Consent, off by
|
|
94
|
+
* default (ruling 6). */
|
|
95
|
+
export interface ArtifactContentConfig {
|
|
96
|
+
/** Full grant endpoint, e.g. https://server/v1/artifacts/uploads. */
|
|
97
|
+
readonly uploadsUrl: string;
|
|
98
|
+
/** `rig_sk_` key with the `artifact-write` scope (header only; never a URL — C2). */
|
|
99
|
+
readonly apiKey: string;
|
|
100
|
+
readonly scrub: ScrubMode;
|
|
101
|
+
/** Client-side ceiling short-circuit; the server enforces the real one. */
|
|
102
|
+
readonly maxBytes: number;
|
|
103
|
+
}
|
|
104
|
+
/** Resolved artifact-namespace config (E2 / E2-C). `enabled` is the E2 gate;
|
|
105
|
+
* `content` (E2-C) is present only when content custody is configured on. */
|
|
106
|
+
export interface ArtifactsConfig {
|
|
107
|
+
readonly enabled: boolean;
|
|
108
|
+
readonly content?: ArtifactContentConfig;
|
|
109
|
+
}
|
|
110
|
+
/**
|
|
111
|
+
* Resolve the artifact config from raw env values (E2 / E2-C, default flip §2).
|
|
112
|
+
* Pure — env is read by the caller (the package's sole env-reader rule).
|
|
113
|
+
* MODELRIG_ARTIFACTS unset → namespace ON when a control plane
|
|
114
|
+
* is configured, OFF for local-only
|
|
115
|
+
* (§2: metadata-on by default).
|
|
116
|
+
* MODELRIG_ARTIFACTS=1|true|on → force the namespace ON.
|
|
117
|
+
* MODELRIG_ARTIFACTS=0|false|off → force it OFF (the explicit opt-out).
|
|
118
|
+
* MODELRIG_ARTIFACTS_CONTENT=on|1|true → content custody ON (E2-C).
|
|
119
|
+
* MODELRIG_CONTENT_UPLOAD_URL, MODELRIG_CONTENT_API_KEY → transport.
|
|
120
|
+
* MODELRIG_ARTIFACTS_SCRUB=off|detect|redact|block → scrub mode (default detect).
|
|
121
|
+
* MODELRIG_CONTENT_MAX_BYTES → client ceiling (default 50MB).
|
|
122
|
+
* Content custody stays OFF (content absent) unless it is explicitly on AND the
|
|
123
|
+
* transport is fully configured — a half-configured custody is refused into the
|
|
124
|
+
* safe default (metadata only), never silently half-on. The metadata default
|
|
125
|
+
* flip does NOT flip content: content is its own gate (§2 "content unchanged").
|
|
126
|
+
*/
|
|
127
|
+
export declare function resolveArtifactsConfig(env: {
|
|
128
|
+
readonly artifacts?: string;
|
|
129
|
+
readonly content?: string;
|
|
130
|
+
readonly uploadsUrl?: string;
|
|
131
|
+
readonly apiKey?: string;
|
|
132
|
+
readonly scrub?: string;
|
|
133
|
+
readonly maxBytes?: string;
|
|
134
|
+
},
|
|
135
|
+
/** Is a cloud sink (api or direct) configured? Unset gate defaults ON when so,
|
|
136
|
+
* OFF otherwise. Defaults false so existing callers/tests keep local-only
|
|
137
|
+
* semantics (gate-only) unless they opt into the flip. */
|
|
138
|
+
controlPlaneConfigured?: boolean): ArtifactsConfig;
|
|
139
|
+
/** Resolved OTLP config (E1). Endpoint + sink-auth headers only; the emitter
|
|
140
|
+
* derives batch/interval + watermark from defaults + the source id. */
|
|
141
|
+
export interface OtlpConfig {
|
|
142
|
+
/** OTLP/HTTP traces endpoint. NEVER logged/displayed — may embed a token (C2). */
|
|
143
|
+
readonly endpoint: string;
|
|
144
|
+
/** Sink auth headers from MODELRIG_OTLP_HEADERS (`k=v,k=v`). NEVER logged (C2). */
|
|
145
|
+
readonly headers: Record<string, string>;
|
|
146
|
+
}
|
|
147
|
+
/**
|
|
148
|
+
* Parse `MODELRIG_OTLP_HEADERS` ("k=v,k=v") into a header map (E1). Split on the
|
|
149
|
+
* FIRST `=` only, so a base64 Basic-auth value keeping its `=` padding survives.
|
|
150
|
+
* Blank/whitespace pairs and pairs with an empty key are dropped. Pure — env is
|
|
151
|
+
* read by the caller, this only shapes the string (keeps this file the sole
|
|
152
|
+
* env reader without smearing parsing into it).
|
|
153
|
+
*/
|
|
154
|
+
export declare function parseOtlpHeaders(raw: string | undefined): Record<string, string>;
|
|
155
|
+
/**
|
|
156
|
+
* Resolve the OTLP config from raw env values (E1). Pure so it is testable
|
|
157
|
+
* without touching `process.env` (the package-invariants env-reader rule) —
|
|
158
|
+
* `loadConfigFromEnv` reads the two vars and hands them here. A blank/absent
|
|
159
|
+
* endpoint ⇒ `null` = off by default (spec §6a).
|
|
160
|
+
*/
|
|
161
|
+
export declare function resolveOtlpConfig(endpoint: string | undefined, headersRaw: string | undefined): OtlpConfig | null;
|
|
162
|
+
interface ExportCommon {
|
|
163
|
+
readonly sourceId?: string;
|
|
164
|
+
readonly batchSize?: number;
|
|
165
|
+
readonly intervalMs?: number;
|
|
166
|
+
}
|
|
167
|
+
export interface ApiExportConfig extends ExportCommon {
|
|
168
|
+
readonly mode: "api";
|
|
169
|
+
/** `rig_sk_…` with the `ingest` scope. The ONLY credential a hosted
|
|
170
|
+
* customer holds — database credentials never leave our infrastructure. */
|
|
171
|
+
readonly apiKey: string;
|
|
172
|
+
readonly ingestUrl: string;
|
|
173
|
+
}
|
|
174
|
+
export interface DirectExportConfig extends ExportCommon {
|
|
175
|
+
readonly mode: "direct";
|
|
176
|
+
readonly supabaseUrl: string;
|
|
177
|
+
readonly serviceRoleKey: string;
|
|
178
|
+
/** The tenant this deployment stamps. Defaults to the house org, which is
|
|
179
|
+
* the right answer for a self-hosted control plane: there is one org there
|
|
180
|
+
* and everything belongs to it. */
|
|
181
|
+
readonly orgId?: string;
|
|
182
|
+
readonly projectId?: string | null;
|
|
183
|
+
}
|
|
184
|
+
/** Provider → the env var that keys it. One table so error surfaces can say
|
|
185
|
+
* WHICH variable to set rather than "no key configured" (F1 / WS3: errors
|
|
186
|
+
* that teach). `loadConfigFromEnv` below reads the same names. */
|
|
187
|
+
export declare const PROVIDER_KEY_ENV: Readonly<Record<string, string>>;
|
|
188
|
+
export declare function loadConfigFromEnv(overrides?: Partial<RigConfig>): RigConfig;
|
|
189
|
+
/**
|
|
190
|
+
* Narrow `config.export` to DIRECT mode, or explain why the command cannot run.
|
|
191
|
+
*
|
|
192
|
+
* Phase 6 WS2 gave the export config two modes. Every command below needs a
|
|
193
|
+
* service-role control-plane client — proposals, swap events, bake-off
|
|
194
|
+
* mirrors, sample purges — and none of those has an ingest endpoint. A rig
|
|
195
|
+
* configured in api mode therefore genuinely cannot run them, and saying so is
|
|
196
|
+
* better than the `undefined` deref this used to be one refactor away from.
|
|
197
|
+
*/
|
|
198
|
+
export declare function directExportOf(config: RigConfig, what: string): {
|
|
199
|
+
readonly supabaseUrl: string;
|
|
200
|
+
readonly serviceRoleKey: string;
|
|
201
|
+
readonly sourceId?: string;
|
|
202
|
+
};
|
|
203
|
+
export {};
|
|
204
|
+
//# sourceMappingURL=config.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"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"}
|
package/dist/config.js
ADDED
|
@@ -0,0 +1,252 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Configuration — plan §3. THE ONLY FILE that reads process.env in this
|
|
4
|
+
* package (adapters receive keys via constructors; enforced by
|
|
5
|
+
* __tests__/package-invariants.test.ts).
|
|
6
|
+
*/
|
|
7
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
|
+
exports.PROVIDER_KEY_ENV = void 0;
|
|
9
|
+
exports.resolveArtifactsConfig = resolveArtifactsConfig;
|
|
10
|
+
exports.parseOtlpHeaders = parseOtlpHeaders;
|
|
11
|
+
exports.resolveOtlpConfig = resolveOtlpConfig;
|
|
12
|
+
exports.loadConfigFromEnv = loadConfigFromEnv;
|
|
13
|
+
exports.directExportOf = directExportOf;
|
|
14
|
+
const ingest_protocol_1 = require("./telemetry/ingest-protocol");
|
|
15
|
+
const DEFAULT_SDK_CONTENT_MAX_BYTES = 52428800;
|
|
16
|
+
function resolveScrubMode(raw, contentOn) {
|
|
17
|
+
const v = (raw ?? "").trim().toLowerCase();
|
|
18
|
+
if (v === "off" || v === "detect" || v === "redact" || v === "block")
|
|
19
|
+
return v;
|
|
20
|
+
// Default when content is on is `detect` — scan and count, upload verbatim.
|
|
21
|
+
return contentOn ? "detect" : "off";
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Resolve the artifact config from raw env values (E2 / E2-C, default flip §2).
|
|
25
|
+
* Pure — env is read by the caller (the package's sole env-reader rule).
|
|
26
|
+
* MODELRIG_ARTIFACTS unset → namespace ON when a control plane
|
|
27
|
+
* is configured, OFF for local-only
|
|
28
|
+
* (§2: metadata-on by default).
|
|
29
|
+
* MODELRIG_ARTIFACTS=1|true|on → force the namespace ON.
|
|
30
|
+
* MODELRIG_ARTIFACTS=0|false|off → force it OFF (the explicit opt-out).
|
|
31
|
+
* MODELRIG_ARTIFACTS_CONTENT=on|1|true → content custody ON (E2-C).
|
|
32
|
+
* MODELRIG_CONTENT_UPLOAD_URL, MODELRIG_CONTENT_API_KEY → transport.
|
|
33
|
+
* MODELRIG_ARTIFACTS_SCRUB=off|detect|redact|block → scrub mode (default detect).
|
|
34
|
+
* MODELRIG_CONTENT_MAX_BYTES → client ceiling (default 50MB).
|
|
35
|
+
* Content custody stays OFF (content absent) unless it is explicitly on AND the
|
|
36
|
+
* transport is fully configured — a half-configured custody is refused into the
|
|
37
|
+
* safe default (metadata only), never silently half-on. The metadata default
|
|
38
|
+
* flip does NOT flip content: content is its own gate (§2 "content unchanged").
|
|
39
|
+
*/
|
|
40
|
+
function resolveArtifactsConfig(env,
|
|
41
|
+
/** Is a cloud sink (api or direct) configured? Unset gate defaults ON when so,
|
|
42
|
+
* OFF otherwise. Defaults false so existing callers/tests keep local-only
|
|
43
|
+
* semantics (gate-only) unless they opt into the flip. */
|
|
44
|
+
controlPlaneConfigured = false) {
|
|
45
|
+
const gate = (env.artifacts ?? "").trim().toLowerCase();
|
|
46
|
+
const explicitOn = gate === "1" || gate === "true" || gate === "on";
|
|
47
|
+
const explicitOff = gate === "0" || gate === "false" || gate === "off";
|
|
48
|
+
// §2 default flip: explicit wins; an unset gate follows the control plane.
|
|
49
|
+
const enabled = explicitOn || (!explicitOff && controlPlaneConfigured);
|
|
50
|
+
const contentGate = (env.content ?? "").trim().toLowerCase();
|
|
51
|
+
const contentOn = contentGate === "on" || contentGate === "1" || contentGate === "true";
|
|
52
|
+
const uploadsUrl = (env.uploadsUrl ?? "").trim();
|
|
53
|
+
const apiKey = (env.apiKey ?? "").trim();
|
|
54
|
+
const maxBytesRaw = env.maxBytes !== undefined && env.maxBytes !== "" ? Number(env.maxBytes) : NaN;
|
|
55
|
+
const maxBytes = Number.isInteger(maxBytesRaw) && maxBytesRaw > 0 ? maxBytesRaw : DEFAULT_SDK_CONTENT_MAX_BYTES;
|
|
56
|
+
// Content is on ONLY when the namespace is enabled, the gate is on, AND the
|
|
57
|
+
// transport is present. Missing transport → stays metadata-only (fail-safe).
|
|
58
|
+
const content = enabled && contentOn && uploadsUrl !== "" && apiKey !== ""
|
|
59
|
+
? { uploadsUrl, apiKey, scrub: resolveScrubMode(env.scrub, true), maxBytes }
|
|
60
|
+
: undefined;
|
|
61
|
+
return { enabled, ...(content !== undefined ? { content } : {}) };
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Parse `MODELRIG_OTLP_HEADERS` ("k=v,k=v") into a header map (E1). Split on the
|
|
65
|
+
* FIRST `=` only, so a base64 Basic-auth value keeping its `=` padding survives.
|
|
66
|
+
* Blank/whitespace pairs and pairs with an empty key are dropped. Pure — env is
|
|
67
|
+
* read by the caller, this only shapes the string (keeps this file the sole
|
|
68
|
+
* env reader without smearing parsing into it).
|
|
69
|
+
*/
|
|
70
|
+
function parseOtlpHeaders(raw) {
|
|
71
|
+
const out = {};
|
|
72
|
+
if (raw === undefined || raw.trim() === "")
|
|
73
|
+
return out;
|
|
74
|
+
for (const pair of raw.split(",")) {
|
|
75
|
+
const eq = pair.indexOf("=");
|
|
76
|
+
if (eq === -1)
|
|
77
|
+
continue;
|
|
78
|
+
const key = pair.slice(0, eq).trim();
|
|
79
|
+
const value = pair.slice(eq + 1).trim();
|
|
80
|
+
if (key === "")
|
|
81
|
+
continue;
|
|
82
|
+
out[key] = value;
|
|
83
|
+
}
|
|
84
|
+
return out;
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* Resolve the OTLP config from raw env values (E1). Pure so it is testable
|
|
88
|
+
* without touching `process.env` (the package-invariants env-reader rule) —
|
|
89
|
+
* `loadConfigFromEnv` reads the two vars and hands them here. A blank/absent
|
|
90
|
+
* endpoint ⇒ `null` = off by default (spec §6a).
|
|
91
|
+
*/
|
|
92
|
+
function resolveOtlpConfig(endpoint, headersRaw) {
|
|
93
|
+
if (endpoint === undefined || endpoint.trim() === "")
|
|
94
|
+
return null;
|
|
95
|
+
return { endpoint: endpoint.trim(), headers: parseOtlpHeaders(headersRaw) };
|
|
96
|
+
}
|
|
97
|
+
/** Provider → the env var that keys it. One table so error surfaces can say
|
|
98
|
+
* WHICH variable to set rather than "no key configured" (F1 / WS3: errors
|
|
99
|
+
* that teach). `loadConfigFromEnv` below reads the same names. */
|
|
100
|
+
exports.PROVIDER_KEY_ENV = {
|
|
101
|
+
gemini: "GEMINI_API_KEY",
|
|
102
|
+
openai: "OPENAI_API_KEY",
|
|
103
|
+
deepseek: "DEEPSEEK_API_KEY",
|
|
104
|
+
anthropic: "ANTHROPIC_API_KEY",
|
|
105
|
+
grok: "XAI_API_KEY",
|
|
106
|
+
deepinfra: "MODELRIG_DEEPINFRA_API_KEY",
|
|
107
|
+
fireworks: "MODELRIG_FIREWORKS_API_KEY",
|
|
108
|
+
};
|
|
109
|
+
const DEFAULT_ROUTES_DIR = "./modelrig/routes";
|
|
110
|
+
const DEFAULT_TELEMETRY_DB = "./.modelrig/telemetry.db";
|
|
111
|
+
function loadConfigFromEnv(overrides) {
|
|
112
|
+
const env = process.env;
|
|
113
|
+
const budgetRaw = env.MODELRIG_ENVELOPE_BUDGET_USD;
|
|
114
|
+
const budget = budgetRaw !== undefined && budgetRaw !== "" ? Number(budgetRaw) : undefined;
|
|
115
|
+
const supabaseUrl = env.MODELRIG_SUPABASE_URL;
|
|
116
|
+
const serviceRoleKey = env.MODELRIG_SUPABASE_SERVICE_ROLE_KEY;
|
|
117
|
+
const apiKey = env.MODELRIG_API_KEY;
|
|
118
|
+
// OTLP span emission (E1) — off unless an endpoint is set. Additive to
|
|
119
|
+
// `export`; a rig may emit OTLP with no control-plane sink and vice-versa.
|
|
120
|
+
const otlp = resolveOtlpConfig(env.MODELRIG_OTLP_ENDPOINT, env.MODELRIG_OTLP_HEADERS);
|
|
121
|
+
// Artifact / execution-graph namespace (E2, default flip §2) — ON by default
|
|
122
|
+
// when a control plane is configured (api key OR the direct supabase pair),
|
|
123
|
+
// OFF for a pure local-only rig; MODELRIG_ARTIFACTS=0 is the explicit opt-out.
|
|
124
|
+
// Always resolved so /status + the boot banner answer honestly. Content
|
|
125
|
+
// custody (E2-C) stays its own gate — the metadata flip never flips content.
|
|
126
|
+
const controlPlaneConfigured = Boolean(apiKey) || Boolean(supabaseUrl && serviceRoleKey);
|
|
127
|
+
const artifacts = resolveArtifactsConfig({
|
|
128
|
+
artifacts: env.MODELRIG_ARTIFACTS,
|
|
129
|
+
content: env.MODELRIG_ARTIFACTS_CONTENT,
|
|
130
|
+
uploadsUrl: env.MODELRIG_CONTENT_UPLOAD_URL,
|
|
131
|
+
apiKey: env.MODELRIG_CONTENT_API_KEY ?? env.MODELRIG_API_KEY,
|
|
132
|
+
scrub: env.MODELRIG_ARTIFACTS_SCRUB,
|
|
133
|
+
maxBytes: env.MODELRIG_CONTENT_MAX_BYTES,
|
|
134
|
+
}, controlPlaneConfigured);
|
|
135
|
+
const fromEnv = {
|
|
136
|
+
routesDir: env.MODELRIG_ROUTES_DIR ?? DEFAULT_ROUTES_DIR,
|
|
137
|
+
telemetryDbPath: env.MODELRIG_TELEMETRY_DB ?? DEFAULT_TELEMETRY_DB,
|
|
138
|
+
otlp,
|
|
139
|
+
artifacts,
|
|
140
|
+
...(env.MODELRIG_REGISTRY_PATH ? { registryPath: env.MODELRIG_REGISTRY_PATH } : {}),
|
|
141
|
+
keys: {
|
|
142
|
+
...(env.GEMINI_API_KEY ? { gemini: env.GEMINI_API_KEY } : {}),
|
|
143
|
+
...(env.OPENAI_API_KEY ? { openai: env.OPENAI_API_KEY } : {}),
|
|
144
|
+
...(env.DEEPSEEK_API_KEY ? { deepseek: env.DEEPSEEK_API_KEY } : {}),
|
|
145
|
+
...(env.ANTHROPIC_API_KEY ? { anthropic: env.ANTHROPIC_API_KEY } : {}),
|
|
146
|
+
...(env.XAI_API_KEY ? { grok: env.XAI_API_KEY } : {}),
|
|
147
|
+
// A1 hosts: ModelRig-scoped names on purpose (same doctrine as Tavily).
|
|
148
|
+
...(env.MODELRIG_DEEPINFRA_API_KEY ? { deepinfra: env.MODELRIG_DEEPINFRA_API_KEY } : {}),
|
|
149
|
+
...(env.MODELRIG_FIREWORKS_API_KEY ? { fireworks: env.MODELRIG_FIREWORKS_API_KEY } : {}),
|
|
150
|
+
},
|
|
151
|
+
...(budget !== undefined && Number.isFinite(budget) ? { envelopeBudgetUsd: budget } : {}),
|
|
152
|
+
...(env.MODELRIG_UNPRICED_RATE_USD_PER_MTOK &&
|
|
153
|
+
Number.isFinite(Number(env.MODELRIG_UNPRICED_RATE_USD_PER_MTOK))
|
|
154
|
+
? { unpricedRateUsdPerMTok: Number(env.MODELRIG_UNPRICED_RATE_USD_PER_MTOK) }
|
|
155
|
+
: {}),
|
|
156
|
+
// Grounding-inject search (WS3). ModelRig-scoped key on purpose — never
|
|
157
|
+
// silently reusing another app's TAVILY_API_KEY.
|
|
158
|
+
...(env.MODELRIG_TAVILY_API_KEY
|
|
159
|
+
? {
|
|
160
|
+
search: {
|
|
161
|
+
tavilyApiKey: env.MODELRIG_TAVILY_API_KEY,
|
|
162
|
+
...(env.MODELRIG_SEARCH_COST_USD && Number.isFinite(Number(env.MODELRIG_SEARCH_COST_USD))
|
|
163
|
+
? { costPerSearchUsd: Number(env.MODELRIG_SEARCH_COST_USD) }
|
|
164
|
+
: {}),
|
|
165
|
+
...(env.MODELRIG_SEARCH_DEPTH === "advanced" ? { searchDepth: "advanced" } : {}),
|
|
166
|
+
},
|
|
167
|
+
}
|
|
168
|
+
: {}),
|
|
169
|
+
// Watch loop caps (Phase 4 WS1) — folded only when either env is set.
|
|
170
|
+
...(() => {
|
|
171
|
+
const monthly = env.MODELRIG_WATCH_MONTHLY_USD;
|
|
172
|
+
const threshold = env.MODELRIG_WATCH_THRESHOLD_PCT;
|
|
173
|
+
const monthlyNum = monthly !== undefined && monthly !== "" ? Number(monthly) : undefined;
|
|
174
|
+
const thresholdNum = threshold !== undefined && threshold !== "" ? Number(threshold) : undefined;
|
|
175
|
+
const watch = {
|
|
176
|
+
...(monthlyNum !== undefined && Number.isFinite(monthlyNum) && monthlyNum > 0
|
|
177
|
+
? { monthlyUsd: monthlyNum }
|
|
178
|
+
: {}),
|
|
179
|
+
...(thresholdNum !== undefined && Number.isFinite(thresholdNum) && thresholdNum > 0
|
|
180
|
+
? { thresholdPct: thresholdNum }
|
|
181
|
+
: {}),
|
|
182
|
+
};
|
|
183
|
+
return Object.keys(watch).length > 0 ? { watch } : {};
|
|
184
|
+
})(),
|
|
185
|
+
// The sink is optional and never required for the run loop (spec §5).
|
|
186
|
+
// Selection follows telemetry-ingestion-boundary.md §2.1 exactly.
|
|
187
|
+
...(() => {
|
|
188
|
+
const common = {
|
|
189
|
+
...(env.MODELRIG_SOURCE_ID ? { sourceId: env.MODELRIG_SOURCE_ID } : {}),
|
|
190
|
+
};
|
|
191
|
+
if (apiKey) {
|
|
192
|
+
if (supabaseUrl && serviceRoleKey) {
|
|
193
|
+
// Both configured. api wins — it is the mode that does not hand a
|
|
194
|
+
// service-role key to a client — and the warning is loud because a
|
|
195
|
+
// silent choice between two live sinks is how telemetry ends up in
|
|
196
|
+
// the wrong place with nobody looking.
|
|
197
|
+
console.warn("[modelrig] both MODELRIG_API_KEY and MODELRIG_SUPABASE_URL are set — using api mode. " +
|
|
198
|
+
"Remove the MODELRIG_SUPABASE_* pair unless this deployment is self-hosting its own " +
|
|
199
|
+
"control plane.");
|
|
200
|
+
}
|
|
201
|
+
return {
|
|
202
|
+
export: {
|
|
203
|
+
mode: "api",
|
|
204
|
+
apiKey,
|
|
205
|
+
ingestUrl: env.MODELRIG_INGEST_URL || ingest_protocol_1.DEFAULT_INGEST_URL,
|
|
206
|
+
...common,
|
|
207
|
+
},
|
|
208
|
+
};
|
|
209
|
+
}
|
|
210
|
+
if (supabaseUrl && serviceRoleKey) {
|
|
211
|
+
return {
|
|
212
|
+
export: {
|
|
213
|
+
mode: "direct",
|
|
214
|
+
supabaseUrl,
|
|
215
|
+
serviceRoleKey,
|
|
216
|
+
...(env.MODELRIG_ORG_ID ? { orgId: env.MODELRIG_ORG_ID } : {}),
|
|
217
|
+
...(env.MODELRIG_PROJECT_ID ? { projectId: env.MODELRIG_PROJECT_ID } : {}),
|
|
218
|
+
...common,
|
|
219
|
+
},
|
|
220
|
+
};
|
|
221
|
+
}
|
|
222
|
+
return {};
|
|
223
|
+
})(),
|
|
224
|
+
};
|
|
225
|
+
return {
|
|
226
|
+
...fromEnv,
|
|
227
|
+
...overrides,
|
|
228
|
+
keys: { ...fromEnv.keys, ...overrides?.keys },
|
|
229
|
+
};
|
|
230
|
+
}
|
|
231
|
+
/**
|
|
232
|
+
* Narrow `config.export` to DIRECT mode, or explain why the command cannot run.
|
|
233
|
+
*
|
|
234
|
+
* Phase 6 WS2 gave the export config two modes. Every command below needs a
|
|
235
|
+
* service-role control-plane client — proposals, swap events, bake-off
|
|
236
|
+
* mirrors, sample purges — and none of those has an ingest endpoint. A rig
|
|
237
|
+
* configured in api mode therefore genuinely cannot run them, and saying so is
|
|
238
|
+
* better than the `undefined` deref this used to be one refactor away from.
|
|
239
|
+
*/
|
|
240
|
+
function directExportOf(config, what) {
|
|
241
|
+
const exp = config.export;
|
|
242
|
+
if (exp === undefined) {
|
|
243
|
+
throw new Error(`${what} needs the control plane: set MODELRIG_SUPABASE_URL and ` +
|
|
244
|
+
"MODELRIG_SUPABASE_SERVICE_ROLE_KEY");
|
|
245
|
+
}
|
|
246
|
+
if (exp.mode !== "direct") {
|
|
247
|
+
throw new Error(`${what} needs direct control-plane access, and this rig is in api mode ` +
|
|
248
|
+
"(MODELRIG_API_KEY). Telemetry ingest goes through the hosted API; this command does " +
|
|
249
|
+
"not — run it where MODELRIG_SUPABASE_URL and MODELRIG_SUPABASE_SERVICE_ROLE_KEY are set.");
|
|
250
|
+
}
|
|
251
|
+
return exp;
|
|
252
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Loud, one-time deprecation warnings (settings-plane §3).
|
|
3
|
+
*
|
|
4
|
+
* Two flags are on their way out now that governance lives in the control plane:
|
|
5
|
+
* • YAML `capture:` — IGNORED when a control plane is configured; capture is a
|
|
6
|
+
* task setting (console / API / MCP). Honored only for local-only rigs.
|
|
7
|
+
* • the `direct` sink (MODELRIG_SUPABASE_*) — the supported path is api mode
|
|
8
|
+
* (a `rig_sk_` key). Still works; will be removed (Matt's §0-row-5 decision).
|
|
9
|
+
*
|
|
10
|
+
* "Loud, never silent divergence" (spec §1.5): each warning fires ONCE per
|
|
11
|
+
* process (a module-level guard) so a user learns their YAML flag is being
|
|
12
|
+
* ignored, rather than quietly diverging from the console. The parked chunk-0.2
|
|
13
|
+
* commit carried no warn-once mechanism, so it is authored here from scratch.
|
|
14
|
+
*/
|
|
15
|
+
import type { RigConfig } from "./config";
|
|
16
|
+
import type { RouteBundle } from "./types/route";
|
|
17
|
+
/**
|
|
18
|
+
* Warn (once) that YAML `capture:` is ignored under a control plane. Fires only
|
|
19
|
+
* when a control plane is configured AND at least one loaded route still sets
|
|
20
|
+
* `capture: true` in YAML — a local-only rig keeps YAML as its mechanism and
|
|
21
|
+
* hears nothing.
|
|
22
|
+
*/
|
|
23
|
+
export declare function warnYamlCaptureDeprecated(routes: readonly RouteBundle[], controlPlaneConfigured: boolean): void;
|
|
24
|
+
/**
|
|
25
|
+
* Warn (once) that the `direct` sink is deprecated, naming api mode as the path.
|
|
26
|
+
* Fires only for a rig actually configured in direct mode.
|
|
27
|
+
*/
|
|
28
|
+
export declare function warnDirectSinkDeprecated(config: RigConfig): void;
|
|
29
|
+
/** Reset the once-per-process guards — TESTS ONLY, so warn-once cases are
|
|
30
|
+
* independent of run order. */
|
|
31
|
+
export declare function __resetDeprecationWarningsForTest(): void;
|
|
32
|
+
//# sourceMappingURL=deprecations.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"deprecations.d.ts","sourceRoot":"","sources":["../src/deprecations.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAC1C,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAKjD;;;;;GAKG;AACH,wBAAgB,yBAAyB,CACvC,MAAM,EAAE,SAAS,WAAW,EAAE,EAC9B,sBAAsB,EAAE,OAAO,GAC9B,IAAI,CAYN;AAED;;;GAGG;AACH,wBAAgB,wBAAwB,CAAC,MAAM,EAAE,SAAS,GAAG,IAAI,CAShE;AAED;+BAC+B;AAC/B,wBAAgB,iCAAiC,IAAI,IAAI,CAGxD"}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Loud, one-time deprecation warnings (settings-plane §3).
|
|
4
|
+
*
|
|
5
|
+
* Two flags are on their way out now that governance lives in the control plane:
|
|
6
|
+
* • YAML `capture:` — IGNORED when a control plane is configured; capture is a
|
|
7
|
+
* task setting (console / API / MCP). Honored only for local-only rigs.
|
|
8
|
+
* • the `direct` sink (MODELRIG_SUPABASE_*) — the supported path is api mode
|
|
9
|
+
* (a `rig_sk_` key). Still works; will be removed (Matt's §0-row-5 decision).
|
|
10
|
+
*
|
|
11
|
+
* "Loud, never silent divergence" (spec §1.5): each warning fires ONCE per
|
|
12
|
+
* process (a module-level guard) so a user learns their YAML flag is being
|
|
13
|
+
* ignored, rather than quietly diverging from the console. The parked chunk-0.2
|
|
14
|
+
* commit carried no warn-once mechanism, so it is authored here from scratch.
|
|
15
|
+
*/
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
exports.warnYamlCaptureDeprecated = warnYamlCaptureDeprecated;
|
|
18
|
+
exports.warnDirectSinkDeprecated = warnDirectSinkDeprecated;
|
|
19
|
+
exports.__resetDeprecationWarningsForTest = __resetDeprecationWarningsForTest;
|
|
20
|
+
let yamlCaptureWarned = false;
|
|
21
|
+
let directSinkWarned = false;
|
|
22
|
+
/**
|
|
23
|
+
* Warn (once) that YAML `capture:` is ignored under a control plane. Fires only
|
|
24
|
+
* when a control plane is configured AND at least one loaded route still sets
|
|
25
|
+
* `capture: true` in YAML — a local-only rig keeps YAML as its mechanism and
|
|
26
|
+
* hears nothing.
|
|
27
|
+
*/
|
|
28
|
+
function warnYamlCaptureDeprecated(routes, controlPlaneConfigured) {
|
|
29
|
+
if (yamlCaptureWarned || !controlPlaneConfigured)
|
|
30
|
+
return;
|
|
31
|
+
const withCapture = routes.filter((b) => b.capture).map((b) => b.route);
|
|
32
|
+
if (withCapture.length === 0)
|
|
33
|
+
return;
|
|
34
|
+
yamlCaptureWarned = true;
|
|
35
|
+
console.warn(`[modelrig] DEPRECATED: ${withCapture.length} route(s) set \`capture:\` in YAML ` +
|
|
36
|
+
`(${withCapture.join(", ")}). This flag is IGNORED when a control plane is configured — ` +
|
|
37
|
+
"capture is a task setting now. Set it in the console, the API " +
|
|
38
|
+
"(PATCH /v1/tasks/:task/settings), or via the MCP tool. YAML `capture:` is honored only " +
|
|
39
|
+
"for local-only rigs (no control plane).");
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Warn (once) that the `direct` sink is deprecated, naming api mode as the path.
|
|
43
|
+
* Fires only for a rig actually configured in direct mode.
|
|
44
|
+
*/
|
|
45
|
+
function warnDirectSinkDeprecated(config) {
|
|
46
|
+
if (directSinkWarned || config.export?.mode !== "direct")
|
|
47
|
+
return;
|
|
48
|
+
directSinkWarned = true;
|
|
49
|
+
console.warn("[modelrig] DEPRECATED: the `direct` sink (MODELRIG_SUPABASE_URL + " +
|
|
50
|
+
"MODELRIG_SUPABASE_SERVICE_ROLE_KEY) is on its way out. The supported path is api mode — " +
|
|
51
|
+
"a `rig_sk_` key in MODELRIG_API_KEY, no database credentials in the client. Direct mode " +
|
|
52
|
+
"still works; migrate when convenient.");
|
|
53
|
+
}
|
|
54
|
+
/** Reset the once-per-process guards — TESTS ONLY, so warn-once cases are
|
|
55
|
+
* independent of run order. */
|
|
56
|
+
function __resetDeprecationWarningsForTest() {
|
|
57
|
+
yamlCaptureWarned = false;
|
|
58
|
+
directSinkWarned = false;
|
|
59
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Optimization coverage, rungs 0–1 — Phase 4 WS2. Pure aggregation over
|
|
3
|
+
* telemetry + feedback rows; no store access, so the console, the server
|
|
4
|
+
* and tests all compute identically.
|
|
5
|
+
*
|
|
6
|
+
* Rungs (the eval ladder's bottom, per plan §4):
|
|
7
|
+
* rung 0 — implicit signals only: conformance / repair / refusal rates
|
|
8
|
+
* from telemetry. Enough confidence for schema-mechanical swap
|
|
9
|
+
* proposals (the bake-off gate).
|
|
10
|
+
* rung 1 — ≥ RUNG1_MIN_FEEDBACK human/agent verdicts attached: prose
|
|
11
|
+
* routes (no schema to conform to) gain proposal confidence.
|
|
12
|
+
* rung 2+ — judges; Phase 5+, out of scope by decision.
|
|
13
|
+
*/
|
|
14
|
+
import type { FeedbackRow, TelemetryRow } from "../types/telemetry";
|
|
15
|
+
export declare const RUNG1_MIN_FEEDBACK = 10;
|
|
16
|
+
export interface RouteCoverage {
|
|
17
|
+
readonly route: string;
|
|
18
|
+
readonly samples: number;
|
|
19
|
+
/** Share of rows with no failure class — the implicit conformance signal. */
|
|
20
|
+
readonly conformRate: number;
|
|
21
|
+
readonly repairRate: number;
|
|
22
|
+
readonly refusalRate: number;
|
|
23
|
+
readonly feedbackCount: number;
|
|
24
|
+
readonly rung: 0 | 1;
|
|
25
|
+
/** Teaching copy: what reaching the next rung takes and unlocks. */
|
|
26
|
+
readonly nextRungUnlock: string;
|
|
27
|
+
}
|
|
28
|
+
/** Attribution: a feedback row joins a route via its inference id, or via
|
|
29
|
+
* its episode key matching a row's run_id tag. Unmatched feedback attaches
|
|
30
|
+
* to nothing (never guessed). */
|
|
31
|
+
export declare function computeCoverage(rows: readonly TelemetryRow[], feedback: readonly FeedbackRow[]): RouteCoverage[];
|
|
32
|
+
//# sourceMappingURL=coverage.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"coverage.d.ts","sourceRoot":"","sources":["../../src/feedback/coverage.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAEpE,eAAO,MAAM,kBAAkB,KAAK,CAAC;AAErC,MAAM,WAAW,aAAa;IAC5B,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,6EAA6E;IAC7E,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC;IAC/B,QAAQ,CAAC,IAAI,EAAE,CAAC,GAAG,CAAC,CAAC;IACrB,oEAAoE;IACpE,QAAQ,CAAC,cAAc,EAAE,MAAM,CAAC;CACjC;AAED;;iCAEiC;AACjC,wBAAgB,eAAe,CAC7B,IAAI,EAAE,SAAS,YAAY,EAAE,EAC7B,QAAQ,EAAE,SAAS,WAAW,EAAE,GAC/B,aAAa,EAAE,CA2EjB"}
|