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
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Template renderer — spec §3, plan §4.
|
|
4
|
+
* Supports {{var}} substitution and capability-conditional blocks:
|
|
5
|
+
* {{#if capability.grounded_native}}...{{/if}}
|
|
6
|
+
* {{#unless capability.structured_native}}...{{/unless}}
|
|
7
|
+
* Deliberately hand-rolled and tiny — NO external template engine (jinja-class
|
|
8
|
+
* engines are a documented CVE surface; see litellm-vendoring-strategy.md §3).
|
|
9
|
+
*/
|
|
10
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
11
|
+
exports.renderTemplate = renderTemplate;
|
|
12
|
+
exports.scanTemplateVariables = scanTemplateVariables;
|
|
13
|
+
const provider_1 = require("../types/provider");
|
|
14
|
+
const CAPABILITY_FLAGS = new Set(provider_1.ALL_CAPABILITY_FLAGS);
|
|
15
|
+
const OPEN_TAG = /\{\{#(if|unless)\s+capability\.([A-Za-z_][A-Za-z0-9_]*)\s*\}\}/g;
|
|
16
|
+
const CLOSE_TAG = /\{\{\/(if|unless)\}\}/g;
|
|
17
|
+
const VAR_TAG = /\{\{\s*([A-Za-z_][A-Za-z0-9_]*)\s*\}\}/g;
|
|
18
|
+
function scanTags(template) {
|
|
19
|
+
const tags = [];
|
|
20
|
+
for (const m of template.matchAll(OPEN_TAG)) {
|
|
21
|
+
tags.push({
|
|
22
|
+
kind: "open",
|
|
23
|
+
block: m[1],
|
|
24
|
+
flag: m[2],
|
|
25
|
+
start: m.index,
|
|
26
|
+
end: m.index + m[0].length,
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
for (const m of template.matchAll(CLOSE_TAG)) {
|
|
30
|
+
tags.push({ kind: "close", block: m[1], start: m.index, end: m.index + m[0].length });
|
|
31
|
+
}
|
|
32
|
+
return tags.sort((a, b) => a.start - b.start);
|
|
33
|
+
}
|
|
34
|
+
/** Pass 1: resolve conditional blocks (flat only — nesting is rejected). */
|
|
35
|
+
function resolveConditionals(template, capabilities) {
|
|
36
|
+
const tags = scanTags(template);
|
|
37
|
+
let out = "";
|
|
38
|
+
let cursor = 0;
|
|
39
|
+
let open = null;
|
|
40
|
+
for (const tag of tags) {
|
|
41
|
+
if (tag.kind === "open") {
|
|
42
|
+
if (open) {
|
|
43
|
+
throw new Error(`template error: nested {{#${tag.block}}} block at index ${tag.start} — nesting is not supported in Phase 1`);
|
|
44
|
+
}
|
|
45
|
+
if (tag.flag === undefined || !CAPABILITY_FLAGS.has(tag.flag)) {
|
|
46
|
+
throw new Error(`template error: unknown capability flag "${tag.flag ?? ""}" at index ${tag.start}`);
|
|
47
|
+
}
|
|
48
|
+
out += template.slice(cursor, tag.start);
|
|
49
|
+
open = tag;
|
|
50
|
+
cursor = tag.end;
|
|
51
|
+
}
|
|
52
|
+
else {
|
|
53
|
+
if (!open) {
|
|
54
|
+
throw new Error(`template error: unmatched {{/${tag.block}}} at index ${tag.start}`);
|
|
55
|
+
}
|
|
56
|
+
if (open.block !== tag.block) {
|
|
57
|
+
throw new Error(`template error: {{#${open.block}}} at index ${open.start} closed by {{/${tag.block}}} at index ${tag.start}`);
|
|
58
|
+
}
|
|
59
|
+
const present = capabilities.has(open.flag);
|
|
60
|
+
const keep = open.block === "if" ? present : !present;
|
|
61
|
+
if (keep)
|
|
62
|
+
out += template.slice(open.end, tag.start);
|
|
63
|
+
open = null;
|
|
64
|
+
cursor = tag.end;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
if (open) {
|
|
68
|
+
throw new Error(`template error: unclosed {{#${open.block}}} block at index ${open.start}`);
|
|
69
|
+
}
|
|
70
|
+
return out + template.slice(cursor);
|
|
71
|
+
}
|
|
72
|
+
/** Pass 2: substitute {{var}} from ctx.variables; missing variables throw. */
|
|
73
|
+
function substituteVariables(template, variables) {
|
|
74
|
+
return template.replace(VAR_TAG, (_match, name) => {
|
|
75
|
+
if (!(name in variables)) {
|
|
76
|
+
throw new Error(`template error: missing variable "${name}"`);
|
|
77
|
+
}
|
|
78
|
+
const value = variables[name];
|
|
79
|
+
if (typeof value === "string")
|
|
80
|
+
return value;
|
|
81
|
+
return JSON.stringify(value);
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
function renderTemplate(template, ctx) {
|
|
85
|
+
return substituteVariables(resolveConditionals(template, ctx.capabilities), ctx.variables);
|
|
86
|
+
}
|
|
87
|
+
/** Distinct {{var}} names referenced anywhere in the template (loader
|
|
88
|
+
* validation: every reference must be a declared variable). */
|
|
89
|
+
function scanTemplateVariables(template) {
|
|
90
|
+
const names = new Set();
|
|
91
|
+
for (const m of template.matchAll(VAR_TAG))
|
|
92
|
+
names.add(m[1]);
|
|
93
|
+
return [...names];
|
|
94
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared Ajv instance factory — JSON-Schema 2020-12 primary, draft-07 still
|
|
3
|
+
* accepted (onboarding-redesign follow-up #1, decision A).
|
|
4
|
+
*
|
|
5
|
+
* We compile output schemas authored in the modern 2020-12 dialect (what most
|
|
6
|
+
* schema tooling emits today) while remaining back-compatible with the draft-07
|
|
7
|
+
* schemas already in the corpus. `ajv/dist/2020` is the 2020-12 instance; it
|
|
8
|
+
* does NOT bundle the draft-07 meta-schema, so we `addMetaSchema` it explicitly
|
|
9
|
+
* — otherwise any schema declaring `$schema: draft-07` fails to compile.
|
|
10
|
+
*
|
|
11
|
+
* `format` stays annotation-only: neither dialect enforces it without
|
|
12
|
+
* `ajv-formats`, and no committed schema relies on format *assertion*. If a
|
|
13
|
+
* fixture ever needs it, register `ajv-formats` here AND in the probe harness
|
|
14
|
+
* (packages/modelrig-probes/src/harness.ts) so gateway and harness agree.
|
|
15
|
+
*/
|
|
16
|
+
import Ajv from "ajv/dist/2020";
|
|
17
|
+
/** The one place the modelrig gateway's Ajv options live. The probe harness in
|
|
18
|
+
* packages/modelrig-probes constructs an identical instance by hand (separate
|
|
19
|
+
* package, no modelrig dependency by design) — the two MUST stay in lockstep,
|
|
20
|
+
* or a fixture would score differently than it serves. */
|
|
21
|
+
export declare function createModelrigAjv(): Ajv;
|
|
22
|
+
//# sourceMappingURL=ajv.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ajv.d.ts","sourceRoot":"","sources":["../../src/run/ajv.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,GAAG,MAAM,eAAe,CAAC;AAGhC;;;0DAG0D;AAC1D,wBAAgB,iBAAiB,IAAI,GAAG,CAIvC"}
|
package/dist/run/ajv.js
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Shared Ajv instance factory — JSON-Schema 2020-12 primary, draft-07 still
|
|
4
|
+
* accepted (onboarding-redesign follow-up #1, decision A).
|
|
5
|
+
*
|
|
6
|
+
* We compile output schemas authored in the modern 2020-12 dialect (what most
|
|
7
|
+
* schema tooling emits today) while remaining back-compatible with the draft-07
|
|
8
|
+
* schemas already in the corpus. `ajv/dist/2020` is the 2020-12 instance; it
|
|
9
|
+
* does NOT bundle the draft-07 meta-schema, so we `addMetaSchema` it explicitly
|
|
10
|
+
* — otherwise any schema declaring `$schema: draft-07` fails to compile.
|
|
11
|
+
*
|
|
12
|
+
* `format` stays annotation-only: neither dialect enforces it without
|
|
13
|
+
* `ajv-formats`, and no committed schema relies on format *assertion*. If a
|
|
14
|
+
* fixture ever needs it, register `ajv-formats` here AND in the probe harness
|
|
15
|
+
* (packages/modelrig-probes/src/harness.ts) so gateway and harness agree.
|
|
16
|
+
*/
|
|
17
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
18
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
19
|
+
};
|
|
20
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
21
|
+
exports.createModelrigAjv = createModelrigAjv;
|
|
22
|
+
const _2020_1 = __importDefault(require("ajv/dist/2020"));
|
|
23
|
+
const json_schema_draft_07_json_1 = __importDefault(require("ajv/dist/refs/json-schema-draft-07.json"));
|
|
24
|
+
/** The one place the modelrig gateway's Ajv options live. The probe harness in
|
|
25
|
+
* packages/modelrig-probes constructs an identical instance by hand (separate
|
|
26
|
+
* package, no modelrig dependency by design) — the two MUST stay in lockstep,
|
|
27
|
+
* or a fixture would score differently than it serves. */
|
|
28
|
+
function createModelrigAjv() {
|
|
29
|
+
const ajv = new _2020_1.default({ strict: false, allErrors: true, allowUnionTypes: true });
|
|
30
|
+
ajv.addMetaSchema(json_schema_draft_07_json_1.default);
|
|
31
|
+
return ajv;
|
|
32
|
+
}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Customer cache-handle resolution — Customer Efficiency CE-1 (spec §2).
|
|
3
|
+
*
|
|
4
|
+
* A CUSTOMER-managed cache handle (`RunOptions.cache`) is a provider-native
|
|
5
|
+
* resource the customer created and owns — a gemini `cachedContents/<id>`, or a
|
|
6
|
+
* `prompt_cache_key` value for a key-hint provider. This module is the ONE pure
|
|
7
|
+
* decision consumed in TWO places so the request wire and the telemetry row can
|
|
8
|
+
* never disagree — exactly the pattern `cache-stamp.ts` uses for GENERATED keys:
|
|
9
|
+
* • the request builder (`dispatch.ts:buildAdapterRequest`) reads the handle
|
|
10
|
+
* and sets `AdapterRequest.cache`, WINNING over the WS-C generated stamp;
|
|
11
|
+
* • the run loop (`run.ts`) reads the SAME handle to stamp the customer key
|
|
12
|
+
* onto the telemetry row's `cache_key` (provenance is then derivable — no
|
|
13
|
+
* new column; see {@link cacheKeyProvenance}).
|
|
14
|
+
*
|
|
15
|
+
* PRECEDENCE (spec §2.2). The customer handle is provider-scoped, so it applies
|
|
16
|
+
* ONLY to a candidate whose provider matches `cache.provider`:
|
|
17
|
+
* 1. handle present AND `candidate.provider === cache.provider` AND not
|
|
18
|
+
* suppressed → the handle (customer wins — including on gemini: a customer
|
|
19
|
+
* handle is a REAL `cachedContents` resource, the adapter's original
|
|
20
|
+
* consumption path; the WS-C gemini exclusion covers GENERATED keys only);
|
|
21
|
+
* 2. non-matching candidate → null (fail-safe: an uncached correct call beats
|
|
22
|
+
* dispatching a fallback provider a handle it would reject);
|
|
23
|
+
* 3. suppressed → null (retry-drop: after a `cache_invalid` on a dispatch that
|
|
24
|
+
* carried the handle, the same candidate's retry re-dispatches WITHOUT it —
|
|
25
|
+
* a gemini fallback to a different model can fail the model+version-scoped
|
|
26
|
+
* cache, and an uncached retry beats a second cache_invalid).
|
|
27
|
+
*
|
|
28
|
+
* Absent `RunOptions.cache`, every call here returns null and the request +
|
|
29
|
+
* recorder fall through to WS-C behavior byte-for-byte (the regression pin).
|
|
30
|
+
*/
|
|
31
|
+
import type { ProviderId } from "../types/provider";
|
|
32
|
+
import type { RunOptions } from "../types/route";
|
|
33
|
+
/** The resolved cache directive for one candidate on one dispatch, shaped for
|
|
34
|
+
* `AdapterRequest.cache`, or null when no customer handle applies. */
|
|
35
|
+
export type ResolvedCustomerCache = {
|
|
36
|
+
readonly key: string;
|
|
37
|
+
readonly ttlSeconds?: number;
|
|
38
|
+
} | null;
|
|
39
|
+
/**
|
|
40
|
+
* Resolve the customer cache handle for `candidate` on this dispatch. Pure and
|
|
41
|
+
* total. `suppressed` carries the retry-drop signal (rule 3 above).
|
|
42
|
+
*/
|
|
43
|
+
export declare function customerCacheHandle(cache: RunOptions["cache"] | undefined, candidate: {
|
|
44
|
+
readonly provider: ProviderId;
|
|
45
|
+
}, suppressed: boolean): ResolvedCustomerCache;
|
|
46
|
+
/** A telemetry row's cache-key origin (spec §2.3), derived — NEVER stored. WS-C
|
|
47
|
+
* stamps `cache_key === prefix_fingerprint` for key-hint providers, so a row's
|
|
48
|
+
* origin is recoverable from the two existing columns with no new DDL:
|
|
49
|
+
* • `cache_key` null → "none" (no key sent)
|
|
50
|
+
* • `cache_key === prefix_fingerprint` → "generated" (ModelRig `cache: auto`)
|
|
51
|
+
* • otherwise (non-null, differs) → "customer" (a passed-through handle)
|
|
52
|
+
* The `pf_`-prefixed fingerprint never collides with a customer opaque key
|
|
53
|
+
* (cache-stamp.ts), so the equality split is exact. WS-B's derived ledger groups
|
|
54
|
+
* by (candidate, fingerprint, key) and is indifferent to origin; the WS-D
|
|
55
|
+
* cache-stats surface MAY label the two origins with this rule. */
|
|
56
|
+
export type CacheKeyProvenance = "none" | "generated" | "customer";
|
|
57
|
+
export declare function cacheKeyProvenance(cacheKey: string | null, prefixFingerprint: string | null): CacheKeyProvenance;
|
|
58
|
+
//# sourceMappingURL=cache-handle.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cache-handle.d.ts","sourceRoot":"","sources":["../../src/run/cache-handle.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAEjD;sEACsE;AACtE,MAAM,MAAM,qBAAqB,GAAG;IAAE,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,CAAA;CAAE,GAAG,IAAI,CAAC;AAElG;;;GAGG;AACH,wBAAgB,mBAAmB,CACjC,KAAK,EAAE,UAAU,CAAC,OAAO,CAAC,GAAG,SAAS,EACtC,SAAS,EAAE;IAAE,QAAQ,CAAC,QAAQ,EAAE,UAAU,CAAA;CAAE,EAC5C,UAAU,EAAE,OAAO,GAClB,qBAAqB,CAKvB;AAED;;;;;;;;;mEASmE;AACnE,MAAM,MAAM,kBAAkB,GAAG,MAAM,GAAG,WAAW,GAAG,UAAU,CAAC;AAEnE,wBAAgB,kBAAkB,CAChC,QAAQ,EAAE,MAAM,GAAG,IAAI,EACvB,iBAAiB,EAAE,MAAM,GAAG,IAAI,GAC/B,kBAAkB,CAIpB"}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Customer cache-handle resolution — Customer Efficiency CE-1 (spec §2).
|
|
4
|
+
*
|
|
5
|
+
* A CUSTOMER-managed cache handle (`RunOptions.cache`) is a provider-native
|
|
6
|
+
* resource the customer created and owns — a gemini `cachedContents/<id>`, or a
|
|
7
|
+
* `prompt_cache_key` value for a key-hint provider. This module is the ONE pure
|
|
8
|
+
* decision consumed in TWO places so the request wire and the telemetry row can
|
|
9
|
+
* never disagree — exactly the pattern `cache-stamp.ts` uses for GENERATED keys:
|
|
10
|
+
* • the request builder (`dispatch.ts:buildAdapterRequest`) reads the handle
|
|
11
|
+
* and sets `AdapterRequest.cache`, WINNING over the WS-C generated stamp;
|
|
12
|
+
* • the run loop (`run.ts`) reads the SAME handle to stamp the customer key
|
|
13
|
+
* onto the telemetry row's `cache_key` (provenance is then derivable — no
|
|
14
|
+
* new column; see {@link cacheKeyProvenance}).
|
|
15
|
+
*
|
|
16
|
+
* PRECEDENCE (spec §2.2). The customer handle is provider-scoped, so it applies
|
|
17
|
+
* ONLY to a candidate whose provider matches `cache.provider`:
|
|
18
|
+
* 1. handle present AND `candidate.provider === cache.provider` AND not
|
|
19
|
+
* suppressed → the handle (customer wins — including on gemini: a customer
|
|
20
|
+
* handle is a REAL `cachedContents` resource, the adapter's original
|
|
21
|
+
* consumption path; the WS-C gemini exclusion covers GENERATED keys only);
|
|
22
|
+
* 2. non-matching candidate → null (fail-safe: an uncached correct call beats
|
|
23
|
+
* dispatching a fallback provider a handle it would reject);
|
|
24
|
+
* 3. suppressed → null (retry-drop: after a `cache_invalid` on a dispatch that
|
|
25
|
+
* carried the handle, the same candidate's retry re-dispatches WITHOUT it —
|
|
26
|
+
* a gemini fallback to a different model can fail the model+version-scoped
|
|
27
|
+
* cache, and an uncached retry beats a second cache_invalid).
|
|
28
|
+
*
|
|
29
|
+
* Absent `RunOptions.cache`, every call here returns null and the request +
|
|
30
|
+
* recorder fall through to WS-C behavior byte-for-byte (the regression pin).
|
|
31
|
+
*/
|
|
32
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
33
|
+
exports.customerCacheHandle = customerCacheHandle;
|
|
34
|
+
exports.cacheKeyProvenance = cacheKeyProvenance;
|
|
35
|
+
/**
|
|
36
|
+
* Resolve the customer cache handle for `candidate` on this dispatch. Pure and
|
|
37
|
+
* total. `suppressed` carries the retry-drop signal (rule 3 above).
|
|
38
|
+
*/
|
|
39
|
+
function customerCacheHandle(cache, candidate, suppressed) {
|
|
40
|
+
if (cache === undefined)
|
|
41
|
+
return null;
|
|
42
|
+
if (suppressed)
|
|
43
|
+
return null;
|
|
44
|
+
if (candidate.provider !== cache.provider)
|
|
45
|
+
return null;
|
|
46
|
+
return cache.ttlSeconds !== undefined ? { key: cache.key, ttlSeconds: cache.ttlSeconds } : { key: cache.key };
|
|
47
|
+
}
|
|
48
|
+
function cacheKeyProvenance(cacheKey, prefixFingerprint) {
|
|
49
|
+
if (cacheKey === null)
|
|
50
|
+
return "none";
|
|
51
|
+
if (cacheKey === prefixFingerprint)
|
|
52
|
+
return "generated";
|
|
53
|
+
return "customer";
|
|
54
|
+
}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Request-path cache stamping — cache-aware-routing WS-C (spec §5.3, §6).
|
|
3
|
+
*
|
|
4
|
+
* ONE pure decision, consumed in TWO places so the request wire and the
|
|
5
|
+
* telemetry row can never disagree:
|
|
6
|
+
* • the run/dispatch path (`buildAdapterRequest`) reads `.request` and sets
|
|
7
|
+
* `AdapterRequest.cache`, which each adapter maps to its native mechanism;
|
|
8
|
+
* • the recorder (`record-attempt.ts`) reads `.cacheKey` + `.prefixFingerprint`
|
|
9
|
+
* and stamps them onto every telemetry row (substrate for WS-B's derived
|
|
10
|
+
* ledger and the §5.6 streak alert).
|
|
11
|
+
*
|
|
12
|
+
* THE STAMPING GATE (spec §6, the QA hazard the plan calls out): a route only
|
|
13
|
+
* caches when it opts in (`cache: auto` in its bundle), and even then the cache
|
|
14
|
+
* KEY is stamped ONLY for providers whose `cache_key_param` accepts an arbitrary
|
|
15
|
+
* key. This is NOT blanket stamping:
|
|
16
|
+
* • openai / grok → `prompt_cache_key` (a routing hint) — key = fingerprint;
|
|
17
|
+
* • anthropic → top-level `cache_control` (prefix-based, no key) — the
|
|
18
|
+
* request carries the directive so the adapter enables cache_control, but no
|
|
19
|
+
* key is "sent", so the telemetry `cacheKey` is null;
|
|
20
|
+
* • gemini → EXCLUDED. `gemini.ts` treats any `cache.key` as a
|
|
21
|
+
* `cachedContents` RESOURCE NAME and drops systemInstruction+tools
|
|
22
|
+
* (gemini.ts:128,145); its `cache_key_param` is null, so this gate never
|
|
23
|
+
* stamps it. Gemini relies on automatic implicit caching (no request change);
|
|
24
|
+
* • deepseek / fireworks → `cache_key_param` null (pure automatic) — no stamp;
|
|
25
|
+
* • deepinfra → `cache_supported: false` — no stamp.
|
|
26
|
+
*
|
|
27
|
+
* The `prefixFingerprint` is stamped into telemetry for EVERY provider on a
|
|
28
|
+
* `cache: auto` route (gemini included), because a non-null `prefix_fingerprint`
|
|
29
|
+
* is exactly the "this row came from a cache-opted route" signal WS-B and the
|
|
30
|
+
* streak alert key off. The fingerprint is v1-scoped (spec §5.3): the run-loop's
|
|
31
|
+
* stable prefix IS the route template, identified by `(route, version,
|
|
32
|
+
* toolschema)`. Named variants share a fingerprint in v1 (they share
|
|
33
|
+
* route/version/schema); hierarchical H1..H5 prefixes land with the gateway phase.
|
|
34
|
+
*/
|
|
35
|
+
import type { CandidateSpec, RouteBundle } from "../types/route";
|
|
36
|
+
/** Hash of the route's structured-output schema — the run-loop's "tool schema"
|
|
37
|
+
* (structured output is a forced tool call on every adapter). Stable across runs,
|
|
38
|
+
* distinct across schema edits. Empty schema (unstructured route) hashes to a
|
|
39
|
+
* fixed constant so those routes still get a stable fingerprint. */
|
|
40
|
+
export declare function toolschemaHash(outputSchema: object | null): string;
|
|
41
|
+
/** v1 prefix fingerprint (spec §5.3): `hash(route, template_version,
|
|
42
|
+
* toolschema_hash)`. `pf_`-prefixed so it is self-describing in telemetry and
|
|
43
|
+
* never collides with a customer-supplied opaque key. */
|
|
44
|
+
export declare function computePrefixFingerprint(route: RouteBundle): string;
|
|
45
|
+
/** The stamping decision for one candidate on one route. */
|
|
46
|
+
export interface CacheStamp {
|
|
47
|
+
/** What to put on `AdapterRequest.cache`, or null to leave it unset (exact
|
|
48
|
+
* back-compat: an un-stamped request behaves identically to pre-WS-C). */
|
|
49
|
+
readonly request: {
|
|
50
|
+
readonly key: string;
|
|
51
|
+
} | null;
|
|
52
|
+
/** The key actually SENT as a routing key (telemetry `cache_key`) — non-null
|
|
53
|
+
* only for `prompt_cache_key` providers; null for cache_control/implicit. */
|
|
54
|
+
readonly cacheKey: string | null;
|
|
55
|
+
/** The stable-prefix fingerprint for this row (telemetry `prefix_fingerprint`)
|
|
56
|
+
* — set for every provider on a `cache: auto` route, null otherwise. */
|
|
57
|
+
readonly prefixFingerprint: string | null;
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Decide the cache stamp for `candidate` on `route`. Pure and total. Returns
|
|
61
|
+
* {@link NO_STAMP} unless the route opted into `cache: auto`; otherwise computes
|
|
62
|
+
* the fingerprint once and applies the per-provider gate above.
|
|
63
|
+
*/
|
|
64
|
+
export declare function cacheStampForCandidate(route: RouteBundle, candidate: Pick<CandidateSpec, "provider">): CacheStamp;
|
|
65
|
+
//# sourceMappingURL=cache-stamp.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cache-stamp.d.ts","sourceRoot":"","sources":["../../src/run/cache-stamp.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AAGH,OAAO,KAAK,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAcjE;;;oEAGoE;AACpE,wBAAgB,cAAc,CAAC,YAAY,EAAE,MAAM,GAAG,IAAI,GAAG,MAAM,CAGlE;AAED;;yDAEyD;AACzD,wBAAgB,wBAAwB,CAAC,KAAK,EAAE,WAAW,GAAG,MAAM,CAQnE;AAED,4DAA4D;AAC5D,MAAM,WAAW,UAAU;IACzB;8EAC0E;IAC1E,QAAQ,CAAC,OAAO,EAAE;QAAE,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI,CAAC;IAClD;iFAC6E;IAC7E,QAAQ,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IACjC;4EACwE;IACxE,QAAQ,CAAC,iBAAiB,EAAE,MAAM,GAAG,IAAI,CAAC;CAC3C;AAMD;;;;GAIG;AACH,wBAAgB,sBAAsB,CACpC,KAAK,EAAE,WAAW,EAClB,SAAS,EAAE,IAAI,CAAC,aAAa,EAAE,UAAU,CAAC,GACzC,UAAU,CAgBZ"}
|
|
Binary file
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Capture-WRITE gate (settings-plane §1.5 — closes settings-plane gate 5).
|
|
3
|
+
*
|
|
4
|
+
* Extracted from the run loop so run.ts stays under the 700-LOC cap. Decides,
|
|
5
|
+
* once per run, whether that run persists a replay capture to the local capture
|
|
6
|
+
* store (the SAME store the bake-off/replay machinery reads — S1: extend, don't
|
|
7
|
+
* twin), and returns a per-attempt writer the loop calls with each output text.
|
|
8
|
+
*
|
|
9
|
+
* ── PRECEDENCE ────────────────────────────────────────────────────────────
|
|
10
|
+
* `effectiveCapture` lets a configured control plane WIN over the YAML `capture:`
|
|
11
|
+
* flag: a console capture-flip turns capture on/off with NO redeploy (the SDK
|
|
12
|
+
* refreshes settings on the exporter interval). A local-only rig (no resolver)
|
|
13
|
+
* keeps the YAML flag, unchanged. Capture OFF ⇒ the writer is a no-op ⇒ nothing
|
|
14
|
+
* is recorded ⇒ byte-identical behavior.
|
|
15
|
+
*
|
|
16
|
+
* ── SCRUB BEFORE PERSIST ──────────────────────────────────────────────────
|
|
17
|
+
* A capture row carries customer content (the rendered replay input + the
|
|
18
|
+
* output text), so the task's scrub setting — the SAME ScrubMode the
|
|
19
|
+
* content-custody path honors — runs BEFORE anything is written: `block` refuses
|
|
20
|
+
* the whole row when PII is found (persist no content), `redact` masks it,
|
|
21
|
+
* off/detect are verbatim. A local-only rig has no per-task policy → "off".
|
|
22
|
+
*/
|
|
23
|
+
import type { CaptureStore } from "../telemetry/capture";
|
|
24
|
+
import type { TaskSettingsResolver } from "../settings/task-settings";
|
|
25
|
+
import type { RouteBundle } from "../types/route";
|
|
26
|
+
/** Records one attempt's output as a capture row; a no-op when capture is off. */
|
|
27
|
+
export type CaptureWriter = (inferenceId: string, outputText: string) => void;
|
|
28
|
+
/**
|
|
29
|
+
* Resolve the effective capture decision for a run and return its writer. Called
|
|
30
|
+
* once per run; the returned writer is invoked per attempt that produced output.
|
|
31
|
+
*/
|
|
32
|
+
export declare function buildCaptureWriter(resolver: TaskSettingsResolver | null, store: CaptureStore | null | undefined, route: RouteBundle, input: unknown): CaptureWriter;
|
|
33
|
+
//# sourceMappingURL=capture-write.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"capture-write.d.ts","sourceRoot":"","sources":["../../src/run/capture-write.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAGzD,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AAEtE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAElD,kFAAkF;AAClF,MAAM,MAAM,aAAa,GAAG,CAAC,WAAW,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,KAAK,IAAI,CAAC;AAI9E;;;GAGG;AACH,wBAAgB,kBAAkB,CAChC,QAAQ,EAAE,oBAAoB,GAAG,IAAI,EACrC,KAAK,EAAE,YAAY,GAAG,IAAI,GAAG,SAAS,EACtC,KAAK,EAAE,WAAW,EAClB,KAAK,EAAE,OAAO,GACb,aAAa,CAoBf"}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Capture-WRITE gate (settings-plane §1.5 — closes settings-plane gate 5).
|
|
4
|
+
*
|
|
5
|
+
* Extracted from the run loop so run.ts stays under the 700-LOC cap. Decides,
|
|
6
|
+
* once per run, whether that run persists a replay capture to the local capture
|
|
7
|
+
* store (the SAME store the bake-off/replay machinery reads — S1: extend, don't
|
|
8
|
+
* twin), and returns a per-attempt writer the loop calls with each output text.
|
|
9
|
+
*
|
|
10
|
+
* ── PRECEDENCE ────────────────────────────────────────────────────────────
|
|
11
|
+
* `effectiveCapture` lets a configured control plane WIN over the YAML `capture:`
|
|
12
|
+
* flag: a console capture-flip turns capture on/off with NO redeploy (the SDK
|
|
13
|
+
* refreshes settings on the exporter interval). A local-only rig (no resolver)
|
|
14
|
+
* keeps the YAML flag, unchanged. Capture OFF ⇒ the writer is a no-op ⇒ nothing
|
|
15
|
+
* is recorded ⇒ byte-identical behavior.
|
|
16
|
+
*
|
|
17
|
+
* ── SCRUB BEFORE PERSIST ──────────────────────────────────────────────────
|
|
18
|
+
* A capture row carries customer content (the rendered replay input + the
|
|
19
|
+
* output text), so the task's scrub setting — the SAME ScrubMode the
|
|
20
|
+
* content-custody path honors — runs BEFORE anything is written: `block` refuses
|
|
21
|
+
* the whole row when PII is found (persist no content), `redact` masks it,
|
|
22
|
+
* off/detect are verbatim. A local-only rig has no per-task policy → "off".
|
|
23
|
+
*/
|
|
24
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
25
|
+
exports.buildCaptureWriter = buildCaptureWriter;
|
|
26
|
+
const scrub_1 = require("../artifacts/scrub");
|
|
27
|
+
const task_settings_1 = require("../settings/task-settings");
|
|
28
|
+
const NO_CAPTURE = () => { };
|
|
29
|
+
/**
|
|
30
|
+
* Resolve the effective capture decision for a run and return its writer. Called
|
|
31
|
+
* once per run; the returned writer is invoked per attempt that produced output.
|
|
32
|
+
*/
|
|
33
|
+
function buildCaptureWriter(resolver, store, route, input) {
|
|
34
|
+
// No store ⇒ never capture, whatever the setting says — and skip the resolver
|
|
35
|
+
// read entirely (this is the replay path: replay.ts nulls the store so its
|
|
36
|
+
// outputs never land in captures — the "never replay-of-replay" invariant).
|
|
37
|
+
if (!store || !(0, task_settings_1.effectiveCapture)(resolver, route.route, route.capture))
|
|
38
|
+
return NO_CAPTURE;
|
|
39
|
+
const mode = resolver !== null ? resolver.get(route.route).scrub : "off";
|
|
40
|
+
return (inferenceId, outputText) => {
|
|
41
|
+
const variablesJson = JSON.stringify(input);
|
|
42
|
+
const vars = (0, scrub_1.scrubContent)(variablesJson, mode);
|
|
43
|
+
const out = (0, scrub_1.scrubContent)(outputText, mode);
|
|
44
|
+
if (vars.blocked || out.blocked)
|
|
45
|
+
return; // block mode: persist no content
|
|
46
|
+
store.record({
|
|
47
|
+
inferenceId,
|
|
48
|
+
ts: new Date().toISOString(),
|
|
49
|
+
route: route.route,
|
|
50
|
+
routeVersion: route.version,
|
|
51
|
+
variablesJson: vars.text ?? variablesJson,
|
|
52
|
+
outputText: out.text ?? outputText,
|
|
53
|
+
});
|
|
54
|
+
};
|
|
55
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Attempt cost accounting — extracted from run.ts (addendum A1 pushed it
|
|
3
|
+
* past the 700-LOC cap). One rule, applied at every dispatch/settlement
|
|
4
|
+
* site: a model with no pricing entry NEVER costs $0 against an active
|
|
5
|
+
* envelope — the envelope is charged a conservative per-token rate instead,
|
|
6
|
+
* while telemetry keeps the honest $0 with `pricing_missing` flagged.
|
|
7
|
+
*/
|
|
8
|
+
import type { AdapterUsage, ProviderId } from "../types/provider";
|
|
9
|
+
export declare const ESTIMATE_CHARS_PER_TOKEN = 4;
|
|
10
|
+
export declare const ESTIMATE_MAX_OUTPUT_TOKENS = 64000;
|
|
11
|
+
/** Addendum A1 conservative default — above the priciest frontier output
|
|
12
|
+
* rate, so an unpriced model can only OVER-charge an envelope, never ride
|
|
13
|
+
* free. Override via MODELRIG_UNPRICED_RATE_USD_PER_MTOK / RigConfig. */
|
|
14
|
+
export declare const DEFAULT_UNPRICED_RATE_USD_PER_MTOK = 100;
|
|
15
|
+
export interface AttemptCost {
|
|
16
|
+
/** What telemetry records — honest $0 when pricing is missing. */
|
|
17
|
+
readonly costUsd: number;
|
|
18
|
+
/** What an active envelope is charged — conservative when unpriced. */
|
|
19
|
+
readonly envelopeChargeUsd: number;
|
|
20
|
+
readonly pricingMissing: boolean;
|
|
21
|
+
}
|
|
22
|
+
export declare function attemptCost(provider: ProviderId, model: string, usage: AdapterUsage, unpricedRatePerTok: number): AttemptCost;
|
|
23
|
+
/** Pre-dispatch upper-bound estimate for the envelope precheck: prompt
|
|
24
|
+
* length + the full output bound, at real pricing or the conservative rate. */
|
|
25
|
+
export declare function dispatchEstimateUsd(provider: ProviderId, model: string, promptChars: number, unpricedRatePerTok: number): number;
|
|
26
|
+
//# sourceMappingURL=cost.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cost.d.ts","sourceRoot":"","sources":["../../src/run/cost.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAGH,OAAO,KAAK,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAElE,eAAO,MAAM,wBAAwB,IAAI,CAAC;AAC1C,eAAO,MAAM,0BAA0B,QAAS,CAAC;AAEjD;;yEAEyE;AACzE,eAAO,MAAM,kCAAkC,MAAM,CAAC;AAEtD,MAAM,WAAW,WAAW;IAC1B,kEAAkE;IAClE,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,uEAAuE;IACvE,QAAQ,CAAC,iBAAiB,EAAE,MAAM,CAAC;IACnC,QAAQ,CAAC,cAAc,EAAE,OAAO,CAAC;CAClC;AAED,wBAAgB,WAAW,CACzB,QAAQ,EAAE,UAAU,EACpB,KAAK,EAAE,MAAM,EACb,KAAK,EAAE,YAAY,EACnB,kBAAkB,EAAE,MAAM,GACzB,WAAW,CAkBb;AAED;+EAC+E;AAC/E,wBAAgB,mBAAmB,CACjC,QAAQ,EAAE,UAAU,EACpB,KAAK,EAAE,MAAM,EACb,WAAW,EAAE,MAAM,EACnB,kBAAkB,EAAE,MAAM,GACzB,MAAM,CAOR"}
|
package/dist/run/cost.js
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Attempt cost accounting — extracted from run.ts (addendum A1 pushed it
|
|
4
|
+
* past the 700-LOC cap). One rule, applied at every dispatch/settlement
|
|
5
|
+
* site: a model with no pricing entry NEVER costs $0 against an active
|
|
6
|
+
* envelope — the envelope is charged a conservative per-token rate instead,
|
|
7
|
+
* while telemetry keeps the honest $0 with `pricing_missing` flagged.
|
|
8
|
+
*/
|
|
9
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
+
exports.DEFAULT_UNPRICED_RATE_USD_PER_MTOK = exports.ESTIMATE_MAX_OUTPUT_TOKENS = exports.ESTIMATE_CHARS_PER_TOKEN = void 0;
|
|
11
|
+
exports.attemptCost = attemptCost;
|
|
12
|
+
exports.dispatchEstimateUsd = dispatchEstimateUsd;
|
|
13
|
+
const pricing_1 = require("../registry/pricing");
|
|
14
|
+
exports.ESTIMATE_CHARS_PER_TOKEN = 4;
|
|
15
|
+
exports.ESTIMATE_MAX_OUTPUT_TOKENS = 64000;
|
|
16
|
+
/** Addendum A1 conservative default — above the priciest frontier output
|
|
17
|
+
* rate, so an unpriced model can only OVER-charge an envelope, never ride
|
|
18
|
+
* free. Override via MODELRIG_UNPRICED_RATE_USD_PER_MTOK / RigConfig. */
|
|
19
|
+
exports.DEFAULT_UNPRICED_RATE_USD_PER_MTOK = 100;
|
|
20
|
+
function attemptCost(provider, model, usage, unpricedRatePerTok) {
|
|
21
|
+
const pricing = (0, pricing_1.getPricing)(provider, model);
|
|
22
|
+
if (pricing === null) {
|
|
23
|
+
return {
|
|
24
|
+
costUsd: 0,
|
|
25
|
+
envelopeChargeUsd: (usage.tokensIn + usage.tokensOut) * unpricedRatePerTok,
|
|
26
|
+
pricingMissing: true,
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
const costUsd = (0, pricing_1.estimateCostUsd)(pricing, usage.tokensIn, usage.tokensOut, usage.tokensCached, usage.tokensCacheWrite ?? 0, usage.tokensCacheWrite1h ?? 0);
|
|
30
|
+
return { costUsd, envelopeChargeUsd: costUsd, pricingMissing: false };
|
|
31
|
+
}
|
|
32
|
+
/** Pre-dispatch upper-bound estimate for the envelope precheck: prompt
|
|
33
|
+
* length + the full output bound, at real pricing or the conservative rate. */
|
|
34
|
+
function dispatchEstimateUsd(provider, model, promptChars, unpricedRatePerTok) {
|
|
35
|
+
const promptTokens = Math.ceil(promptChars / exports.ESTIMATE_CHARS_PER_TOKEN);
|
|
36
|
+
const pricing = (0, pricing_1.getPricing)(provider, model);
|
|
37
|
+
if (pricing === null) {
|
|
38
|
+
return (promptTokens + exports.ESTIMATE_MAX_OUTPUT_TOKENS) * unpricedRatePerTok;
|
|
39
|
+
}
|
|
40
|
+
return (0, pricing_1.estimateCostUsd)(pricing, promptTokens, exports.ESTIMATE_MAX_OUTPUT_TOKENS, 0);
|
|
41
|
+
}
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Dispatch helpers extracted from run.ts (G-1/G-5 Phase A). The run loop is at
|
|
3
|
+
* its LOC cap, so the tool-passthrough and streaming seams live here — the same
|
|
4
|
+
* move G-2 made when it pulled applyRunRequirements/candidateFilterFromOptions
|
|
5
|
+
* into resolve.ts. Pure/near-pure: request shaping, the stream-vs-buffered
|
|
6
|
+
* dispatch fork, and the tool-call RunResult builder.
|
|
7
|
+
*
|
|
8
|
+
* Tool *execution* is never ours (spec §4.4); these helpers normalize the
|
|
9
|
+
* protocol and surface it — nothing here runs a tool.
|
|
10
|
+
*/
|
|
11
|
+
import type { AdapterRequest, AdapterResult, CandidateRef, ProviderAdapter } from "../types/provider";
|
|
12
|
+
import type { RigFailure } from "../types/failures";
|
|
13
|
+
import type { RouteBundle, RunMeta, RunOptions, RunResult, RunTags } from "../types/route";
|
|
14
|
+
import type { TelemetryStore } from "../types/telemetry";
|
|
15
|
+
/** One telemetry attempt row's inputs — shared with run.ts's recordAttempt so
|
|
16
|
+
* the tool-call helper here can record through the same closure. */
|
|
17
|
+
export interface AttemptTelemetry {
|
|
18
|
+
readonly candidate: CandidateRef;
|
|
19
|
+
readonly servedTier: string;
|
|
20
|
+
readonly tokensIn: number;
|
|
21
|
+
readonly tokensOut: number;
|
|
22
|
+
readonly tokensCached: number;
|
|
23
|
+
/** Cache-write buckets (WS-A). Optional — absent ⇒ 0 in the recorded row, so
|
|
24
|
+
* the zero-cost/failure call sites need not set them. */
|
|
25
|
+
readonly tokensCacheWrite?: number;
|
|
26
|
+
readonly tokensCacheWrite1h?: number;
|
|
27
|
+
readonly costUsd: number;
|
|
28
|
+
readonly latencyMs: number;
|
|
29
|
+
/** First-body-byte time from the adapter (WS3, Phase 4) — undefined when
|
|
30
|
+
* nothing arrived. */
|
|
31
|
+
readonly ttfbMs?: number;
|
|
32
|
+
readonly failure: RigFailure | null;
|
|
33
|
+
/** "provider/model" performing a repair call (WS2) — undefined otherwise. */
|
|
34
|
+
readonly repairedBy?: string;
|
|
35
|
+
/** Addendum A1: model had no pricing entry (cost recorded as honest 0). */
|
|
36
|
+
readonly pricingMissing?: boolean;
|
|
37
|
+
}
|
|
38
|
+
/** run.ts's recordAttempt, threaded in so the tool-call path records through
|
|
39
|
+
* the same ledger/tenancy closure the rest of the loop uses. */
|
|
40
|
+
export type RecordAttempt = (attempt: AttemptTelemetry) => string;
|
|
41
|
+
/** Record the grounding-inject search's own telemetry row (WS3): a $-only line
|
|
42
|
+
* under the synthetic "search" provider. Extracted from run.ts to keep it under
|
|
43
|
+
* the LOC cap; behaviour is byte-identical to the prior inline recorder. */
|
|
44
|
+
export declare function recordSearchCostRow(telemetry: TelemetryStore, route: RouteBundle, effectiveTags: RunTags, servedVariant: string | null, searchProviderId: string, costUsd: number): void;
|
|
45
|
+
/** Side-channel for streaming: the run loop hands raw text deltas here as the
|
|
46
|
+
* serving adapter streams. Absent => buffered dispatch via `adapter.call()`
|
|
47
|
+
* (identical to pre-Phase-A behavior). */
|
|
48
|
+
export type StreamDeltaSink = (delta: {
|
|
49
|
+
readonly text: string;
|
|
50
|
+
}) => void;
|
|
51
|
+
export interface PrimaryRequestParts {
|
|
52
|
+
readonly route: RouteBundle;
|
|
53
|
+
readonly candidate: CandidateRef;
|
|
54
|
+
readonly systemPrompt: string;
|
|
55
|
+
readonly userDirective: string;
|
|
56
|
+
/** True when this candidate has native grounding AND the route requires it. */
|
|
57
|
+
readonly nativeGrounded: boolean;
|
|
58
|
+
readonly opts: RunOptions;
|
|
59
|
+
/** CE-1 retry-drop: suppress a customer cache handle on THIS dispatch after a
|
|
60
|
+
* prior `cache_invalid` on the same candidate carried it. Additive; absent /
|
|
61
|
+
* false = normal (the handle applies when provider matches). */
|
|
62
|
+
readonly suppressCustomerCache?: boolean;
|
|
63
|
+
}
|
|
64
|
+
/** Build the primary-attempt AdapterRequest — adds the grounding hint and the
|
|
65
|
+
* unified tools/toolChoice passthrough (spec §4.4). */
|
|
66
|
+
export declare function buildAdapterRequest(parts: PrimaryRequestParts): AdapterRequest;
|
|
67
|
+
/** Build the repair-attempt AdapterRequest (no tools — repair re-asks for the
|
|
68
|
+
* structured object, never a tool call). */
|
|
69
|
+
export declare function buildRepairAdapterRequest(route: RouteBundle, candidate: CandidateRef, systemPrompt: string, repairDirective: string): AdapterRequest;
|
|
70
|
+
/**
|
|
71
|
+
* Dispatch a candidate. When a delta sink is supplied AND the adapter can
|
|
72
|
+
* stream, drain its stream — forwarding raw text deltas to the sink — and
|
|
73
|
+
* return the terminal `AdapterResult` (identical to what `call()` returns, so
|
|
74
|
+
* the run loop's cost/validation/telemetry logic is unchanged). Otherwise
|
|
75
|
+
* buffered `call()`.
|
|
76
|
+
*/
|
|
77
|
+
export declare function dispatchCandidate(adapter: ProviderAdapter, req: AdapterRequest, onDelta?: StreamDeltaSink): Promise<AdapterResult>;
|
|
78
|
+
export interface ToolCallResultParts {
|
|
79
|
+
readonly route: RouteBundle;
|
|
80
|
+
readonly candidate: CandidateRef;
|
|
81
|
+
readonly result: Extract<AdapterResult, {
|
|
82
|
+
ok: true;
|
|
83
|
+
}>;
|
|
84
|
+
readonly costUsd: number;
|
|
85
|
+
readonly latencyMs: number;
|
|
86
|
+
readonly attemptsByClass: RunMeta["attemptsByClass"];
|
|
87
|
+
readonly servedVariant: string | null;
|
|
88
|
+
readonly pricingMissing: boolean;
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* Record a tool-call turn and build its RunResult (spec §4.4). A tool call is
|
|
92
|
+
* NOT a schema-validated JSON turn: it records a normal (non-failure) telemetry
|
|
93
|
+
* row, then returns a result with `validated: false`, `output: null` (the caller
|
|
94
|
+
* reads `meta.toolCalls`, runs the tool, and continues the exchange), and the
|
|
95
|
+
* normalized calls surfaced on the meta. Recording goes through run.ts's own
|
|
96
|
+
* `recordAttempt` so the ledger/tenancy stamping is identical to every other row.
|
|
97
|
+
*/
|
|
98
|
+
export declare function emitToolCallResult(record: RecordAttempt, parts: ToolCallResultParts): RunResult;
|
|
99
|
+
//# sourceMappingURL=dispatch.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dispatch.d.ts","sourceRoot":"","sources":["../../src/run/dispatch.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,KAAK,EACV,cAAc,EACd,aAAa,EACb,YAAY,EACZ,eAAe,EAChB,MAAM,mBAAmB,CAAC;AAE3B,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,KAAK,EAAE,WAAW,EAAE,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAC3F,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAIzD;oEACoE;AACpE,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,SAAS,EAAE,YAAY,CAAC;IACjC,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;IAC9B;6DACyD;IACzD,QAAQ,CAAC,gBAAgB,CAAC,EAAE,MAAM,CAAC;IACnC,QAAQ,CAAC,kBAAkB,CAAC,EAAE,MAAM,CAAC;IACrC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B;0BACsB;IACtB,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,OAAO,EAAE,UAAU,GAAG,IAAI,CAAC;IACpC,6EAA6E;IAC7E,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,CAAC;IAC7B,2EAA2E;IAC3E,QAAQ,CAAC,cAAc,CAAC,EAAE,OAAO,CAAC;CACnC;AAED;gEACgE;AAChE,MAAM,MAAM,aAAa,GAAG,CAAC,OAAO,EAAE,gBAAgB,KAAK,MAAM,CAAC;AAElE;;4EAE4E;AAC5E,wBAAgB,mBAAmB,CACjC,SAAS,EAAE,cAAc,EACzB,KAAK,EAAE,WAAW,EAClB,aAAa,EAAE,OAAO,EACtB,aAAa,EAAE,MAAM,GAAG,IAAI,EAC5B,gBAAgB,EAAE,MAAM,EACxB,OAAO,EAAE,MAAM,GACd,IAAI,CA4BN;AAED;;0CAE0C;AAC1C,MAAM,MAAM,eAAe,GAAG,CAAC,KAAK,EAAE;IAAE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;CAAE,KAAK,IAAI,CAAC;AAEzE,MAAM,WAAW,mBAAmB;IAClC,QAAQ,CAAC,KAAK,EAAE,WAAW,CAAC;IAC5B,QAAQ,CAAC,SAAS,EAAE,YAAY,CAAC;IACjC,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;IAC9B,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC;IAC/B,+EAA+E;IAC/E,QAAQ,CAAC,cAAc,EAAE,OAAO,CAAC;IACjC,QAAQ,CAAC,IAAI,EAAE,UAAU,CAAC;IAC1B;;oEAEgE;IAChE,QAAQ,CAAC,qBAAqB,CAAC,EAAE,OAAO,CAAC;CAC1C;AAED;uDACuD;AACvD,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,mBAAmB,GAAG,cAAc,CAgC9E;AAED;4CAC4C;AAC5C,wBAAgB,yBAAyB,CACvC,KAAK,EAAE,WAAW,EAClB,SAAS,EAAE,YAAY,EACvB,YAAY,EAAE,MAAM,EACpB,eAAe,EAAE,MAAM,GACtB,cAAc,CAmBhB;AAED;;;;;;GAMG;AACH,wBAAsB,iBAAiB,CACrC,OAAO,EAAE,eAAe,EACxB,GAAG,EAAE,cAAc,EACnB,OAAO,CAAC,EAAE,eAAe,GACxB,OAAO,CAAC,aAAa,CAAC,CAuBxB;AAED,MAAM,WAAW,mBAAmB;IAClC,QAAQ,CAAC,KAAK,EAAE,WAAW,CAAC;IAC5B,QAAQ,CAAC,SAAS,EAAE,YAAY,CAAC;IACjC,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAC,aAAa,EAAE;QAAE,EAAE,EAAE,IAAI,CAAA;KAAE,CAAC,CAAC;IACtD,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,eAAe,EAAE,OAAO,CAAC,iBAAiB,CAAC,CAAC;IACrD,QAAQ,CAAC,aAAa,EAAE,MAAM,GAAG,IAAI,CAAC;IACtC,QAAQ,CAAC,cAAc,EAAE,OAAO,CAAC;CAClC;AAED;;;;;;;GAOG;AACH,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,aAAa,EAAE,KAAK,EAAE,mBAAmB,GAAG,SAAS,CA0C/F"}
|