modelrig 0.8.0 → 0.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +156 -0
- package/README.md +27 -2
- package/dist/artifacts/artifact.d.ts +12 -13
- package/dist/artifacts/artifact.d.ts.map +1 -1
- package/dist/artifacts/artifact.js +17 -23
- package/dist/artifacts/index.d.ts +13 -5
- package/dist/artifacts/index.d.ts.map +1 -1
- package/dist/artifacts/index.js +11 -4
- package/dist/artifacts/run-context.d.ts +3 -24
- package/dist/artifacts/run-context.d.ts.map +1 -1
- package/dist/artifacts/run-context.js +3 -39
- package/dist/bakeoff/engine.d.ts +29 -0
- package/dist/bakeoff/engine.d.ts.map +1 -1
- package/dist/bakeoff/engine.js +47 -0
- package/dist/bakeoff/eval-cases-rig.d.ts +36 -0
- package/dist/bakeoff/eval-cases-rig.d.ts.map +1 -0
- package/dist/bakeoff/eval-cases-rig.js +27 -0
- package/dist/bakeoff/eval-cases.d.ts +19 -0
- package/dist/bakeoff/eval-cases.d.ts.map +1 -1
- package/dist/bakeoff/eval-cases.js +18 -1
- package/dist/bakeoff/golden-judge.d.ts +47 -0
- package/dist/bakeoff/golden-judge.d.ts.map +1 -0
- package/dist/bakeoff/golden-judge.js +49 -0
- package/dist/bakeoff/quality.d.ts +30 -0
- package/dist/bakeoff/quality.d.ts.map +1 -1
- package/dist/bakeoff/quality.js +21 -0
- package/dist/bakeoff/replay.d.ts +11 -0
- package/dist/bakeoff/replay.d.ts.map +1 -1
- package/dist/bakeoff/replay.js +8 -0
- package/dist/bakeoff/report.d.ts +7 -0
- package/dist/bakeoff/report.d.ts.map +1 -1
- package/dist/bakeoff/report.js +26 -0
- package/dist/cli-judge.d.ts +12 -0
- package/dist/cli-judge.d.ts.map +1 -0
- package/dist/cli-judge.js +48 -0
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +14 -42
- package/dist/config.d.ts +54 -29
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +86 -47
- package/dist/detect/detector.d.ts +4 -2
- package/dist/detect/detector.d.ts.map +1 -1
- package/dist/detect/safe-harbor.d.ts +57 -0
- package/dist/detect/safe-harbor.d.ts.map +1 -0
- package/dist/detect/safe-harbor.js +278 -0
- package/dist/feedback/coverage.d.ts +11 -8
- package/dist/feedback/coverage.d.ts.map +1 -1
- package/dist/feedback/coverage.js +29 -16
- package/dist/feedback/grade.d.ts +51 -0
- package/dist/feedback/grade.d.ts.map +1 -0
- package/dist/feedback/grade.js +63 -0
- package/dist/gateway/http-protocol.d.ts +1 -1
- package/dist/gateway/http-protocol.d.ts.map +1 -1
- package/dist/gateway/http-protocol.js +1 -1
- package/dist/index.d.ts +44 -27
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +110 -43
- package/dist/init/observe-cli.js +1 -1
- package/dist/init/observe.d.ts +2 -2
- package/dist/init/observe.d.ts.map +1 -1
- package/dist/init/observe.js +11 -7
- package/dist/mask/arm.d.ts +112 -0
- package/dist/mask/arm.d.ts.map +1 -0
- package/dist/mask/arm.js +179 -0
- package/dist/mask/index.d.ts +2 -0
- package/dist/mask/index.d.ts.map +1 -1
- package/dist/mask/index.js +7 -1
- package/dist/mask/mask-policy-cli.d.ts +12 -4
- package/dist/mask/mask-policy-cli.d.ts.map +1 -1
- package/dist/mask/mask-policy-cli.js +34 -9
- package/dist/query/grammar.d.ts +2 -2
- package/dist/query/grammar.d.ts.map +1 -1
- package/dist/query/grammar.js +3 -1
- package/dist/query/saved.d.ts +13 -0
- package/dist/query/saved.d.ts.map +1 -1
- package/dist/query/saved.js +67 -1
- package/dist/receipts/types.d.ts +1 -1
- package/dist/receipts/types.d.ts.map +1 -1
- package/dist/receipts/types.js +1 -0
- package/dist/registry/build.d.ts +43 -1
- package/dist/registry/build.d.ts.map +1 -1
- package/dist/registry/build.js +52 -0
- package/dist/registry/pricing-shape.d.ts +29 -0
- package/dist/registry/pricing-shape.d.ts.map +1 -1
- package/dist/registry/pricing-shape.js +10 -1
- package/dist/registry/rows.d.ts.map +1 -1
- package/dist/registry/rows.js +1 -0
- package/dist/registry/select.d.ts +6 -1
- package/dist/registry/select.d.ts.map +1 -1
- package/dist/registry/select.js +11 -0
- package/dist/routes/call-config.d.ts +199 -0
- package/dist/routes/call-config.d.ts.map +1 -0
- package/dist/routes/call-config.js +343 -0
- package/dist/routes/loader.js +5 -3
- package/dist/routes/objective-loader.d.ts +12 -0
- package/dist/routes/objective-loader.d.ts.map +1 -1
- package/dist/routes/objective-loader.js +82 -0
- package/dist/routes/resolved-bundle.d.ts +50 -0
- package/dist/routes/resolved-bundle.d.ts.map +1 -1
- package/dist/routes/resolved-bundle.js +52 -0
- package/dist/routes/screen-loader.d.ts +28 -0
- package/dist/routes/screen-loader.d.ts.map +1 -1
- package/dist/routes/screen-loader.js +51 -0
- package/dist/run/accept.d.ts +2 -0
- package/dist/run/accept.d.ts.map +1 -1
- package/dist/run/accept.js +1 -0
- package/dist/run/dispatch.d.ts +42 -13
- package/dist/run/dispatch.d.ts.map +1 -1
- package/dist/run/dispatch.js +107 -25
- package/dist/run/grounding.d.ts +28 -2
- package/dist/run/grounding.d.ts.map +1 -1
- package/dist/run/grounding.js +54 -10
- package/dist/run/record-attempt.d.ts +4 -0
- package/dist/run/record-attempt.d.ts.map +1 -1
- package/dist/run/record-attempt.js +4 -0
- package/dist/run/routing-docs.js +1 -1
- package/dist/run/run.d.ts.map +1 -1
- package/dist/run/run.js +21 -26
- package/dist/savings/odometer.d.ts +4 -0
- package/dist/savings/odometer.d.ts.map +1 -1
- package/dist/savings/odometer.js +20 -1
- package/dist/savings/swap-execute.d.ts +7 -0
- package/dist/savings/swap-execute.d.ts.map +1 -1
- package/dist/savings/swap-execute.js +30 -0
- package/dist/savings/swaps-client.d.ts +10 -0
- package/dist/savings/swaps-client.d.ts.map +1 -1
- package/dist/screen/fixtures/probe-corpora.d.ts +23 -0
- package/dist/screen/fixtures/probe-corpora.d.ts.map +1 -0
- package/dist/screen/fixtures/probe-corpora.js +69 -0
- package/dist/screen/index.d.ts +21 -0
- package/dist/screen/index.d.ts.map +1 -0
- package/dist/screen/index.js +64 -0
- package/dist/screen/model-screen.d.ts +111 -0
- package/dist/screen/model-screen.d.ts.map +1 -0
- package/dist/screen/model-screen.js +178 -0
- package/dist/screen/patterns.d.ts +51 -0
- package/dist/screen/patterns.d.ts.map +1 -0
- package/dist/screen/patterns.js +151 -0
- package/dist/screen/phi-gate.d.ts +52 -0
- package/dist/screen/phi-gate.d.ts.map +1 -0
- package/dist/screen/phi-gate.js +86 -0
- package/dist/screen/policy.d.ts +71 -0
- package/dist/screen/policy.d.ts.map +1 -0
- package/dist/screen/policy.js +334 -0
- package/dist/screen/probe.d.ts +118 -0
- package/dist/screen/probe.d.ts.map +1 -0
- package/dist/screen/probe.js +132 -0
- package/dist/screen/screen-cli.d.ts +16 -0
- package/dist/screen/screen-cli.d.ts.map +1 -0
- package/dist/screen/screen-cli.js +178 -0
- package/dist/screen/screen.d.ts +99 -0
- package/dist/screen/screen.d.ts.map +1 -0
- package/dist/screen/screen.js +0 -0
- package/dist/screen/sidecar.d.ts +69 -0
- package/dist/screen/sidecar.d.ts.map +1 -0
- package/dist/screen/sidecar.js +145 -0
- package/dist/screen/types.d.ts +43 -2
- package/dist/screen/types.d.ts.map +1 -1
- package/dist/settings/api-fetcher.d.ts +14 -3
- package/dist/settings/api-fetcher.d.ts.map +1 -1
- package/dist/settings/api-fetcher.js +61 -10
- package/dist/settings/grading-guide.d.ts +76 -0
- package/dist/settings/grading-guide.d.ts.map +1 -0
- package/dist/settings/grading-guide.js +23 -0
- package/dist/settings/index.d.ts +3 -2
- package/dist/settings/index.d.ts.map +1 -1
- package/dist/settings/index.js +2 -1
- package/dist/settings/task-settings.d.ts +44 -7
- package/dist/settings/task-settings.d.ts.map +1 -1
- package/dist/settings/task-settings.js +53 -12
- package/dist/status.d.ts +26 -20
- package/dist/status.d.ts.map +1 -1
- package/dist/status.js +47 -29
- package/dist/telemetry/artifact-store.d.ts +5 -6
- package/dist/telemetry/artifact-store.d.ts.map +1 -1
- package/dist/telemetry/artifact-store.js +10 -24
- package/dist/telemetry/attempt-meta.d.ts +21 -0
- package/dist/telemetry/attempt-meta.d.ts.map +1 -1
- package/dist/telemetry/attempt-meta.js +9 -0
- package/dist/telemetry/exporter.d.ts +2 -2
- package/dist/telemetry/exporter.d.ts.map +1 -1
- package/dist/telemetry/exporter.js +22 -41
- package/dist/telemetry/grade-mappers.d.ts +22 -0
- package/dist/telemetry/grade-mappers.d.ts.map +1 -0
- package/dist/telemetry/grade-mappers.js +58 -0
- package/dist/telemetry/grades-sql.d.ts +53 -0
- package/dist/telemetry/grades-sql.d.ts.map +1 -0
- package/dist/telemetry/grades-sql.js +133 -0
- package/dist/telemetry/ingest-protocol.d.ts +29 -46
- package/dist/telemetry/ingest-protocol.d.ts.map +1 -1
- package/dist/telemetry/ingest-protocol.js +16 -54
- package/dist/telemetry/store-migrations.d.ts.map +1 -1
- package/dist/telemetry/store-migrations.js +51 -0
- package/dist/telemetry/store.d.ts +9 -6
- package/dist/telemetry/store.d.ts.map +1 -1
- package/dist/telemetry/store.js +8 -50
- package/dist/tenancy/api-key-format.d.ts +30 -1
- package/dist/tenancy/api-key-format.d.ts.map +1 -1
- package/dist/tenancy/api-key-format.js +33 -1
- package/dist/types/provider.d.ts +3 -0
- package/dist/types/provider.d.ts.map +1 -1
- package/dist/types/provider.js +25 -0
- package/dist/types/route.d.ts +78 -2
- package/dist/types/route.d.ts.map +1 -1
- package/dist/types/telemetry.d.ts +43 -46
- package/dist/types/telemetry.d.ts.map +1 -1
- package/dist/validate-cli.d.ts.map +1 -1
- package/dist/validate-cli.js +32 -0
- package/dist/verify/verify.d.ts +5 -0
- package/dist/verify/verify.d.ts.map +1 -1
- package/dist/verify/verify.js +2 -0
- package/dist/watch/evaluate.d.ts +84 -1
- package/dist/watch/evaluate.d.ts.map +1 -1
- package/dist/watch/evaluate.js +28 -0
- package/dist/watch/monitor.d.ts +8 -2
- package/dist/watch/monitor.d.ts.map +1 -1
- package/dist/watch/monitor.js +13 -5
- package/dist/watch/regret-monitor-cli.d.ts +16 -0
- package/dist/watch/regret-monitor-cli.d.ts.map +1 -0
- package/dist/watch/regret-monitor-cli.js +137 -0
- package/dist/watch/regret-monitor.d.ts +168 -0
- package/dist/watch/regret-monitor.d.ts.map +1 -0
- package/dist/watch/regret-monitor.js +304 -0
- package/dist/watch/upgrade.d.ts +62 -0
- package/dist/watch/upgrade.d.ts.map +1 -0
- package/dist/watch/upgrade.js +57 -0
- package/docs/agent-skill/SKILL.md +109 -5
- package/docs/how-it-fits.md +3 -2
- package/docs/instrumentation.md +149 -21
- package/docs/llms.txt +64 -20
- package/docs/mcp-oracle.md +249 -0
- package/docs/quickstart.md +103 -9
- package/package.json +16 -3
- package/registry/leaderboard.json +74 -0
- package/registry/registry.json +150 -112
- package/screen.d.ts +16 -0
- package/templates/call-disposition-qa.json +77 -0
- package/templates/catalog-cleansing.json +77 -0
- package/templates/compliance-review.json +76 -0
- package/templates/cs-next-action.json +76 -0
- package/templates/document-extraction.json +78 -0
- package/templates/financial-classification.json +75 -0
- package/templates/lead-qualification.json +76 -0
- package/templates/medical-classification.json +71 -0
- package/templates/ticket-triage.json +76 -0
- package/dist/telemetry/supabase-exporter.d.ts +0 -64
- package/dist/telemetry/supabase-exporter.d.ts.map +0 -1
- package/dist/telemetry/supabase-exporter.js +0 -211
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"replay.d.ts","sourceRoot":"","sources":["../../src/bakeoff/replay.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAGH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAGzD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAI1C,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"replay.d.ts","sourceRoot":"","sources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C3B,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;IAC1B,QAAQ,CAAC,QAAQ,EAAE,OAAO,CAAC;IAC3B;wEACoE;IACpE,QAAQ,CAAC,aAAa,EAAE,MAAM,GAAG,IAAI,CAAC;IACtC;;;oCAGgC;IAChC,QAAQ,CAAC,aAAa,EAAE,OAAO,GAAG,IAAI,CAAC;IACvC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,mEAAmE;IACnE,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC;IAC/B;yDACqD;IACrD,QAAQ,CAAC,cAAc,EAAE,OAAO,CAAC;IACjC,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC;IACrC,oEAAoE;IACpE,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;IAC5B;sDACkD;IAClD,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CACrC;AAED,wBAAsB,aAAa,CACjC,IAAI,EAAE,OAAO,EACb,QAAQ,EAAE,YAAY,EACtB,GAAG,EAAE,aAAa,GACjB,OAAO,CAAC,SAAS,kBAAkB,EAAE,CAAC,CAgJxC"}
|
package/dist/bakeoff/replay.js
CHANGED
|
@@ -112,6 +112,7 @@ async function replayVariant(deps, captures, req) {
|
|
|
112
112
|
output: outputValue,
|
|
113
113
|
...(route.valueChecks !== undefined ? { valueChecks: route.valueChecks } : {}),
|
|
114
114
|
...(expected !== undefined ? { hasExpected: true, expected: expected.value } : {}),
|
|
115
|
+
...(req.graderType !== undefined ? { graderType: req.graderType } : {}),
|
|
115
116
|
});
|
|
116
117
|
let gateScore = null;
|
|
117
118
|
if (req.qualityGate !== undefined && gated !== null) {
|
|
@@ -126,6 +127,13 @@ async function replayVariant(deps, captures, req) {
|
|
|
126
127
|
valueAccuracy = det;
|
|
127
128
|
else if (gateScore !== null)
|
|
128
129
|
valueAccuracy = gateScore;
|
|
130
|
+
// LRE-2 llm-judge grader: a golden-set case whose grader is `llm-judge`
|
|
131
|
+
// scores the output against its GOLDEN via the pairwise judge (det is null
|
|
132
|
+
// for llm-judge — resolveDeterministicQuality defers it here). Only a case
|
|
133
|
+
// WITH an expected value is golden-judged; a failure case falls through.
|
|
134
|
+
else if (req.graderType === "llm-judge" && expected !== undefined && req.goldenJudge !== undefined) {
|
|
135
|
+
valueAccuracy = await req.goldenJudge.score(outputValue, expected.value, JSON.parse(capture.variablesJson));
|
|
136
|
+
}
|
|
129
137
|
else if (req.judge !== undefined) {
|
|
130
138
|
valueAccuracy = await req.judge.score(outputValue, JSON.parse(capture.variablesJson));
|
|
131
139
|
}
|
package/dist/bakeoff/report.d.ts
CHANGED
|
@@ -43,6 +43,13 @@ export declare function formatCacheAdjustedSection(rows: readonly CacheAdjustedR
|
|
|
43
43
|
* (returns strings); empty when nothing disagreed. Exported for direct testing.
|
|
44
44
|
*/
|
|
45
45
|
export declare function formatDisagreementSummary(artifact: BakeoffArtifact): string[];
|
|
46
|
+
/**
|
|
47
|
+
* N4 (spec §4.2/§6): the proposed swap's direction line — ⬆/⬇/→ + the signed
|
|
48
|
+
* effective-cost delta ($/1k). An up-swap is framed as a quality investment, NEVER
|
|
49
|
+
* a saving (claim ceiling §8). Pure (returns strings); empty when there is no
|
|
50
|
+
* proposal or the delta is indeterminate. Exported for direct testing.
|
|
51
|
+
*/
|
|
52
|
+
export declare function formatSwapDirection(artifact: BakeoffArtifact): string[];
|
|
46
53
|
export declare function printMatrix(artifact: BakeoffArtifact, cacheAdjusted?: readonly CacheAdjustedRow[]): void;
|
|
47
54
|
/**
|
|
48
55
|
* `modelrig bakeoff --from-eval-cases <task> --variants a,b,c` — replay a task's
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"report.d.ts","sourceRoot":"","sources":["../../src/bakeoff/report.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAKH,OAAO,KAAK,EAAE,SAAS,EA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a,EAAE,MAAM,gBAAgB,CAAC;AA2CpD;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,QAAQ,EAAE,eAAe,GAAG,MAAM,GAAG,IAAI,CAexE;AAED;;;;GAIG;AACH,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,+EAA+E;IAC/E,QAAQ,CAAC,eAAe,EAAE,MAAM,CAAC;IACjC,gFAAgF;IAChF,QAAQ,CAAC,gBAAgB,EAAE,MAAM,CAAC;IAClC,QAAQ,CAAC,WAAW,EAAE,mBAAmB,CAAC;CAC3C;AAED;;;;;;GAMG;AACH,wBAAgB,0BAA0B,CAAC,IAAI,EAAE,SAAS,gBAAgB,EAAE,GAAG,MAAM,EAAE,CAgCtF;AAED;;;;;GAKG;AACH,wBAAgB,yBAAyB,CAAC,QAAQ,EAAE,eAAe,GAAG,MAAM,EAAE,CAiB7E;AAED;;;;;GAKG;AACH,wBAAgB,mBAAmB,CAAC,QAAQ,EAAE,eAAe,GAAG,MAAM,EAAE,CAavE;AAED,wBAAgB,WAAW,CAAC,QAAQ,EAAE,eAAe,EAAE,aAAa,GAAE,SAAS,gBAAgB,EAAO,GAAG,IAAI,CA4D5G;AAED;;;;;;GAMG;AACH,wBAAsB,qBAAqB,CACzC,MAAM,EAAE,SAAS,EACjB,IAAI,EAAE,MAAM,EACZ,QAAQ,EAAE,SAAS,MAAM,EAAE,EAC3B,QAAQ,EAAE,MAAM,GAAG,SAAS,EAC5B,IAAI,EAAE,eAAe,GAAG,SAAS,EACjC,MAAM,EAAE,OAAO,EACf,aAAa,CAAC,EAAE,aAAa,GAC5B,OAAO,CAAC,MAAM,CAAC,CA+CjB"}
|
package/dist/bakeoff/report.js
CHANGED
|
@@ -9,6 +9,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
9
9
|
exports.bakeoffHeadline = bakeoffHeadline;
|
|
10
10
|
exports.formatCacheAdjustedSection = formatCacheAdjustedSection;
|
|
11
11
|
exports.formatDisagreementSummary = formatDisagreementSummary;
|
|
12
|
+
exports.formatSwapDirection = formatSwapDirection;
|
|
12
13
|
exports.printMatrix = printMatrix;
|
|
13
14
|
exports.runEvalCaseBakeoffCli = runEvalCaseBakeoffCli;
|
|
14
15
|
const node_fs_1 = require("node:fs");
|
|
@@ -144,6 +145,26 @@ function formatDisagreementSummary(artifact) {
|
|
|
144
145
|
}
|
|
145
146
|
return lines;
|
|
146
147
|
}
|
|
148
|
+
/**
|
|
149
|
+
* N4 (spec §4.2/§6): the proposed swap's direction line — ⬆/⬇/→ + the signed
|
|
150
|
+
* effective-cost delta ($/1k). An up-swap is framed as a quality investment, NEVER
|
|
151
|
+
* a saving (claim ceiling §8). Pure (returns strings); empty when there is no
|
|
152
|
+
* proposal or the delta is indeterminate. Exported for direct testing.
|
|
153
|
+
*/
|
|
154
|
+
function formatSwapDirection(artifact) {
|
|
155
|
+
const dir = (0, engine_1.deriveSwapDirection)(artifact);
|
|
156
|
+
if (dir === null || dir.costDeltaUsdPer1k === null)
|
|
157
|
+
return [];
|
|
158
|
+
const arrow = dir.direction === "up" ? "⬆" : dir.direction === "down" ? "⬇" : "→";
|
|
159
|
+
const delta = dir.costDeltaUsdPer1k;
|
|
160
|
+
const sign = delta >= 0 ? "+" : "−";
|
|
161
|
+
const note = dir.direction === "up"
|
|
162
|
+
? " — raises effective cost to cut regret; a quality investment, not a saving"
|
|
163
|
+
: dir.direction === "down"
|
|
164
|
+
? " — cost-reducing"
|
|
165
|
+
: "";
|
|
166
|
+
return [` direction: ${arrow} ${dir.direction}-swap (${sign}$${Math.abs(delta).toFixed(2)}/1k effective${note})`];
|
|
167
|
+
}
|
|
147
168
|
function printMatrix(artifact, cacheAdjusted = []) {
|
|
148
169
|
console.log(`bakeoff ${artifact.id}\nroute ${artifact.route}@${artifact.routeVersion} · replayed ${artifact.replayN} captured inputs · ${artifact.ranAt}`);
|
|
149
170
|
// RB-1: a reference arm is present ⇒ show quality + regret columns and badge
|
|
@@ -195,6 +216,11 @@ function printMatrix(artifact, cacheAdjusted = []) {
|
|
|
195
216
|
else {
|
|
196
217
|
console.log("proposal: none (no variant beats the incumbent's gates)");
|
|
197
218
|
}
|
|
219
|
+
// N4 (spec §6/§9): the proposed swap's direction + signed cost delta on the CLI
|
|
220
|
+
// proposal line — an up-swap raises effective cost (a quality investment), a
|
|
221
|
+
// down-swap is the shipped saving. Printed only when a proposal exists.
|
|
222
|
+
for (const l of formatSwapDirection(artifact))
|
|
223
|
+
console.log(l);
|
|
198
224
|
// N6 disagreement summary — printed only when candidates were mined; absent ⇒
|
|
199
225
|
// byte-identical to the pre-N6 matrix output.
|
|
200
226
|
for (const l of formatDisagreementSummary(artifact))
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `modelrig judge <run>` — E5 V.4: explicitly ask the bounded model-judge to
|
|
3
|
+
* score a run. Goes through the API boundary (T12: the CLI never holds a DB
|
|
4
|
+
* client) — POST /v1/runs/:id/judge on the configured server, authed with a
|
|
5
|
+
* rig_sk key. The daily cap + metering are the SERVER's; this just triggers one.
|
|
6
|
+
*
|
|
7
|
+
* Extracted from cli.ts (which sits at the ≤700-LOC cap) into its own module,
|
|
8
|
+
* mirroring `cli-query.ts`. Behaviour is byte-identical to the inline command.
|
|
9
|
+
*/
|
|
10
|
+
import type { Flags } from "./cli";
|
|
11
|
+
export declare function cmdJudge(flags: Flags): Promise<number>;
|
|
12
|
+
//# sourceMappingURL=cli-judge.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cli-judge.d.ts","sourceRoot":"","sources":["../src/cli-judge.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAGH,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,OAAO,CAAC;AAEnC,wBAAsB,QAAQ,CAAC,KAAK,EAAE,KAAK,GAAG,OAAO,CAAC,MAAM,CAAC,CAoC5D"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* `modelrig judge <run>` — E5 V.4: explicitly ask the bounded model-judge to
|
|
4
|
+
* score a run. Goes through the API boundary (T12: the CLI never holds a DB
|
|
5
|
+
* client) — POST /v1/runs/:id/judge on the configured server, authed with a
|
|
6
|
+
* rig_sk key. The daily cap + metering are the SERVER's; this just triggers one.
|
|
7
|
+
*
|
|
8
|
+
* Extracted from cli.ts (which sits at the ≤700-LOC cap) into its own module,
|
|
9
|
+
* mirroring `cli-query.ts`. Behaviour is byte-identical to the inline command.
|
|
10
|
+
*/
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.cmdJudge = cmdJudge;
|
|
13
|
+
const config_1 = require("./config");
|
|
14
|
+
async function cmdJudge(flags) {
|
|
15
|
+
const runId = flags.positional[0] ?? "";
|
|
16
|
+
// Config is the only env reader (package-invariants rule). The judge endpoint
|
|
17
|
+
// lives on the same server as the api-mode ingest sink, so the base is that
|
|
18
|
+
// URL's origin and the credential is the api key.
|
|
19
|
+
const exp = (0, config_1.loadConfigFromEnv)().export;
|
|
20
|
+
const api = exp !== undefined && exp.mode === "api" ? exp : undefined;
|
|
21
|
+
const base = api !== undefined ? new URL(api.ingestUrl).origin : "";
|
|
22
|
+
const key = api?.apiKey ?? "";
|
|
23
|
+
if (runId === "" || base === "" || key === "") {
|
|
24
|
+
console.error([
|
|
25
|
+
"usage: modelrig judge <runId>",
|
|
26
|
+
"",
|
|
27
|
+
"Needs api-mode telemetry configured (the judge is on the same server):",
|
|
28
|
+
" MODELRIG_API_KEY a rig_sk_ key with the `oracle-act` scope",
|
|
29
|
+
" MODELRIG_INGEST_URL optional — the server base; defaults to the hosted API",
|
|
30
|
+
"",
|
|
31
|
+
"The judge is EXPLICIT-only and metered; scoring rides the gateway (a route),",
|
|
32
|
+
"so the org's daily cap and spend-stops apply. Nothing schedules it.",
|
|
33
|
+
].join("\n"));
|
|
34
|
+
return 1;
|
|
35
|
+
}
|
|
36
|
+
const res = await fetch(`${base}/v1/runs/${encodeURIComponent(runId)}/judge`, {
|
|
37
|
+
method: "POST",
|
|
38
|
+
headers: { authorization: `Bearer ${key}`, "content-type": "application/json" },
|
|
39
|
+
body: "{}",
|
|
40
|
+
});
|
|
41
|
+
const body = (await res.json().catch(() => ({})));
|
|
42
|
+
if (!res.ok) {
|
|
43
|
+
console.error(`judge ${res.status}: ${typeof body.error === "string" ? body.error : "failed"}`);
|
|
44
|
+
return 1;
|
|
45
|
+
}
|
|
46
|
+
console.log(JSON.stringify(body, null, 2));
|
|
47
|
+
return 0;
|
|
48
|
+
}
|
package/dist/cli.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";AACA;;;;;;;;;;;;;;;;GAgBG;
|
|
1
|
+
{"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";AACA;;;;;;;;;;;;;;;;GAgBG;AAoDH,MAAM,WAAW,KAAK;IACpB,QAAQ,CAAC,UAAU,EAAE,SAAS,MAAM,EAAE,CAAC;IACvC,QAAQ,CAAC,KAAK,EAAE,WAAW,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC5C,QAAQ,CAAC,IAAI,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;CACpC;AAeD,wBAAgB,SAAS,CAAC,IAAI,EAAE,SAAS,MAAM,EAAE,GAAG,KAAK,CAuBxD;AA6eD,wBAAsB,IAAI,CAAC,IAAI,EAAE,SAAS,MAAM,EAAE,GAAG,OAAO,CAAC,MAAM,CAAC,CA2CnE"}
|
package/dist/cli.js
CHANGED
|
@@ -59,6 +59,9 @@ const state_store_1 = require("./watch/state-store");
|
|
|
59
59
|
const swaps_client_1 = require("./savings/swaps-client");
|
|
60
60
|
const swap_execute_1 = require("./savings/swap-execute");
|
|
61
61
|
const cli_query_1 = require("./cli-query");
|
|
62
|
+
const cli_judge_1 = require("./cli-judge");
|
|
63
|
+
const regret_monitor_cli_1 = require("./watch/regret-monitor-cli");
|
|
64
|
+
const screen_cli_1 = require("./screen/screen-cli");
|
|
62
65
|
const BARE_FLAGS = new Set([
|
|
63
66
|
"json",
|
|
64
67
|
"no-mirror",
|
|
@@ -492,45 +495,6 @@ async function cmdServe() {
|
|
|
492
495
|
// The server owns the process from here (it holds the listener open).
|
|
493
496
|
return 0;
|
|
494
497
|
}
|
|
495
|
-
/** `modelrig judge <run>` — E5 V.4: explicitly ask the bounded model-judge to
|
|
496
|
-
* score a run. Goes through the API boundary (T12: the CLI never holds a DB
|
|
497
|
-
* client) — POST /v1/runs/:id/judge on the configured server, authed with a
|
|
498
|
-
* rig_sk key. The daily cap + metering are the SERVER's; this just triggers one. */
|
|
499
|
-
async function cmdJudge(flags) {
|
|
500
|
-
const runId = flags.positional[0] ?? "";
|
|
501
|
-
// Config is the only env reader (package-invariants rule). The judge endpoint
|
|
502
|
-
// lives on the same server as the api-mode ingest sink, so the base is that
|
|
503
|
-
// URL's origin and the credential is the api key.
|
|
504
|
-
const exp = (0, config_1.loadConfigFromEnv)().export;
|
|
505
|
-
const api = exp !== undefined && exp.mode === "api" ? exp : undefined;
|
|
506
|
-
const base = api !== undefined ? new URL(api.ingestUrl).origin : "";
|
|
507
|
-
const key = api?.apiKey ?? "";
|
|
508
|
-
if (runId === "" || base === "" || key === "") {
|
|
509
|
-
console.error([
|
|
510
|
-
"usage: modelrig judge <runId>",
|
|
511
|
-
"",
|
|
512
|
-
"Needs api-mode telemetry configured (the judge is on the same server):",
|
|
513
|
-
" MODELRIG_API_KEY a rig_sk_ key with the `oracle-act` scope",
|
|
514
|
-
" MODELRIG_INGEST_URL optional — the server base; defaults to the hosted API",
|
|
515
|
-
"",
|
|
516
|
-
"The judge is EXPLICIT-only and metered; scoring rides the gateway (a route),",
|
|
517
|
-
"so the org's daily cap and spend-stops apply. Nothing schedules it.",
|
|
518
|
-
].join("\n"));
|
|
519
|
-
return 1;
|
|
520
|
-
}
|
|
521
|
-
const res = await fetch(`${base}/v1/runs/${encodeURIComponent(runId)}/judge`, {
|
|
522
|
-
method: "POST",
|
|
523
|
-
headers: { authorization: `Bearer ${key}`, "content-type": "application/json" },
|
|
524
|
-
body: "{}",
|
|
525
|
-
});
|
|
526
|
-
const body = (await res.json().catch(() => ({})));
|
|
527
|
-
if (!res.ok) {
|
|
528
|
-
console.error(`judge ${res.status}: ${typeof body.error === "string" ? body.error : "failed"}`);
|
|
529
|
-
return 1;
|
|
530
|
-
}
|
|
531
|
-
console.log(JSON.stringify(body, null, 2));
|
|
532
|
-
return 0;
|
|
533
|
-
}
|
|
534
498
|
/** The one usage block, printed to stdout on `--help` (exit 0) and to stderr on
|
|
535
499
|
* an unknown command (exit 1). Kept as a const so the two paths can never
|
|
536
500
|
* drift. */
|
|
@@ -538,13 +502,17 @@ const USAGE = [
|
|
|
538
502
|
"usage:",
|
|
539
503
|
" modelrig init [path] [--scope glob,glob] [--out dir] [--dry-run] [--include-tests] [--json]",
|
|
540
504
|
" modelrig observe [path] [--scope glob,glob] [--out dir] [--dry-run] [--json] (T0/T1: see your runs first — no migration)",
|
|
541
|
-
" modelrig validate (structurally check rig.yaml + every route bundle — no provider key needed)",
|
|
505
|
+
" modelrig validate (structurally check rig.yaml + every route bundle + effective screen: policy — no provider key needed)",
|
|
506
|
+
" modelrig screen check <file|-> [--source search|variable|proxy_user|tool_result] (SC-1a: dry-run injection scan — COUNTS only, never values)",
|
|
507
|
+
" modelrig screen pull <classifier:name@version> [--url <weights-url>] (SC-1a: fetch an optional classifier's weights to the local cache — never bundled, A3)",
|
|
508
|
+
" modelrig screen probe [--detectors <ids>] [--corpus <ids>] (SC-3: measured TPR/FP per license-clean synthetic corpus — counts + rates only)",
|
|
542
509
|
" modelrig status (print export/artifact/otlp posture)",
|
|
543
510
|
" modelrig serve (needs the modelrig-server package)",
|
|
544
511
|
" modelrig bakeoff --route <route> --variants a,b,c --replay-last N [--budget-usd usd] [--objective quality-first|balanced|cost-first] [--keep-outputs[=all]] [--json] [--no-mirror]",
|
|
545
512
|
" modelrig bakeoff --from-proposal <id> [--replay-last N] [--keep-outputs[=all]] [--json]",
|
|
546
|
-
" modelrig bakeoff --mask-policy <route> [--replay-last N] (CS-1:
|
|
513
|
+
" modelrig bakeoff --mask-policy <route> [--replay-last N] [--leak-only] (CS-1: masked-vs-unmasked value-accuracy Δ + leak proof; --leak-only = offline, no dispatch)",
|
|
547
514
|
" modelrig watch run [--events fixtures.json] [--json]",
|
|
515
|
+
" modelrig regret-monitor --route <route> [--dry-run] [--json] (Q1: one regret-band cycle; files a regret_breach bake-off on breach)",
|
|
548
516
|
" modelrig verify-swap --route <route> --captures <fixture.json> [--budget-usd usd] [--out report.md] [--json]",
|
|
549
517
|
" modelrig swap execute <proposalId> --approve [--approved-by name]",
|
|
550
518
|
" modelrig swap revert <swapId>",
|
|
@@ -567,6 +535,8 @@ async function main(argv) {
|
|
|
567
535
|
return (0, status_cli_1.runStatusCli)();
|
|
568
536
|
case "validate":
|
|
569
537
|
return (0, validate_cli_1.runValidateCli)();
|
|
538
|
+
case "screen":
|
|
539
|
+
return (0, screen_cli_1.runScreenCli)(flags);
|
|
570
540
|
case "bakeoff":
|
|
571
541
|
return cmdBakeoff(flags);
|
|
572
542
|
case "watch":
|
|
@@ -582,9 +552,11 @@ async function main(argv) {
|
|
|
582
552
|
case "verify-swap":
|
|
583
553
|
return cmdVerifySwap(flags);
|
|
584
554
|
case "judge":
|
|
585
|
-
return cmdJudge(flags);
|
|
555
|
+
return (0, cli_judge_1.cmdJudge)(flags);
|
|
586
556
|
case "query":
|
|
587
557
|
return (0, cli_query_1.cmdQuery)(flags);
|
|
558
|
+
case "regret-monitor":
|
|
559
|
+
return (0, regret_monitor_cli_1.cmdRegretMonitor)(flags);
|
|
588
560
|
case "serve":
|
|
589
561
|
return cmdServe();
|
|
590
562
|
default:
|
package/dist/config.d.ts
CHANGED
|
@@ -87,29 +87,42 @@ export interface RigConfig {
|
|
|
87
87
|
*/
|
|
88
88
|
readonly otlp?: OtlpConfig | null;
|
|
89
89
|
/**
|
|
90
|
-
* Artifact / execution-graph namespace (Expansion E2).
|
|
91
|
-
*
|
|
92
|
-
*
|
|
93
|
-
*
|
|
94
|
-
* `
|
|
90
|
+
* Artifact / execution-graph namespace (Expansion E2; P15 CP-3). ON by default
|
|
91
|
+
* when a control plane is configured — a sink exists to ship to, and the ORG's
|
|
92
|
+
* account posture (`artifact_posture`), resolved from the control plane at
|
|
93
|
+
* runtime and enforced authoritatively server-side, is the on/off control (NOT
|
|
94
|
+
* an env var — P15). `enabled: false` (or absent) means the run/artifact SDK
|
|
95
|
+
* surface is inert, the exporter sends protocol v1 byte-identical to before,
|
|
96
|
+
* and zero new rows are written (spec §1.4). A pure local-only rig has no
|
|
97
|
+
* control plane to resolve a posture from, so the namespace is off there unless
|
|
98
|
+
* a dev forces it on (MODELRIG_ARTIFACTS=1, dev-only — see loadConfigFromEnv).
|
|
99
|
+
* Like `otlp`, `loadConfigFromEnv` ALWAYS resolves this so `/status` can answer
|
|
95
100
|
* "enabled|disabled" honestly; optional only so hand-built configs need not
|
|
96
101
|
* spell out the off case.
|
|
97
102
|
*/
|
|
98
103
|
readonly artifacts?: ArtifactsConfig;
|
|
99
104
|
}
|
|
100
105
|
/** Scrub mode applied to content BEFORE upload (E2-C chunk B). Default `detect`
|
|
101
|
-
* when content custody is on.
|
|
106
|
+
* when content custody is on. The EFFECTIVE mode is resolved per task/account
|
|
107
|
+
* from the control-plane settings resolver (P15 — scrub is an account setting,
|
|
108
|
+
* not a client env var; the `MODELRIG_ARTIFACTS_SCRUB` gate was deleted, R3
|
|
109
|
+
* follow-up CP-3b). */
|
|
102
110
|
export type ScrubMode = "off" | "detect" | "redact" | "block";
|
|
111
|
+
/** The scrub mode used when NO control-plane resolver answers for a task
|
|
112
|
+
* (local-only / direct rigs, or a run with no task identity). The content-on
|
|
113
|
+
* default — scan and count, upload verbatim. Kept in sync with
|
|
114
|
+
* `settings/task-settings.ts DEFAULT_TASK_SETTINGS.scrub`. */
|
|
115
|
+
export declare const DEFAULT_CONTENT_SCRUB_MODE: ScrubMode;
|
|
103
116
|
/** Per-rig content-custody config (E2-C chunk A/B). Present ONLY when content
|
|
104
117
|
* custody is turned ON and the transport is configured; ABSENT (the default)
|
|
105
118
|
* means metadata + hash only — today's behaviour, unchanged. Consent, off by
|
|
106
|
-
* default (ruling 6).
|
|
119
|
+
* default (ruling 6). Scrub is NOT here — it is a per-task/account setting
|
|
120
|
+
* resolved at runtime from the control plane (P15 CP-3b), not a boot-time env. */
|
|
107
121
|
export interface ArtifactContentConfig {
|
|
108
122
|
/** Full grant endpoint, e.g. https://server/v1/artifacts/uploads. */
|
|
109
123
|
readonly uploadsUrl: string;
|
|
110
124
|
/** `rig_sk_` key with the `artifact-write` scope (header only; never a URL — C2). */
|
|
111
125
|
readonly apiKey: string;
|
|
112
|
-
readonly scrub: ScrubMode;
|
|
113
126
|
/** Client-side ceiling short-circuit; the server enforces the real one. */
|
|
114
127
|
readonly maxBytes: number;
|
|
115
128
|
}
|
|
@@ -120,34 +133,46 @@ export interface ArtifactsConfig {
|
|
|
120
133
|
readonly content?: ArtifactContentConfig;
|
|
121
134
|
}
|
|
122
135
|
/**
|
|
123
|
-
* Resolve the artifact
|
|
136
|
+
* Resolve the artifact-namespace boot shape (E2 / E2-C; P15 CP-3). Env FEATURE
|
|
137
|
+
* GATES are GONE: capture on/off and content on/off are the ORG's account posture
|
|
138
|
+
* (`artifact_posture`), resolved from the control plane at runtime
|
|
139
|
+
* (settings/task-settings.ts) and enforced authoritatively server-side — metadata
|
|
140
|
+
* is dropped at /v1/ingest for posture `off`; content is 403'd at
|
|
141
|
+
* /v1/artifacts/uploads for posture `metadata`. This function decides only the
|
|
142
|
+
* STATIC boot shape:
|
|
143
|
+
* • the metadata namespace is ON whenever a control plane is configured (a sink
|
|
144
|
+
* exists to ship to); OFF for a pure local-only rig UNLESS `devForceOn` (the
|
|
145
|
+
* dev-only MODELRIG_ARTIFACTS=1 escape hatch — NOT a customer control).
|
|
146
|
+
* • content upload is ATTEMPTED whenever the namespace is on and a transport
|
|
147
|
+
* (uploads URL + key) is present; the SERVER's org posture is the real gate,
|
|
148
|
+
* so a `metadata`/`off` org stores nothing and the SDK degrades on the 403. A
|
|
149
|
+
* half-configured transport (no key) stays metadata-only (fail-safe).
|
|
150
|
+
* Remaining env here is NON-gate config (P15-clean): MODELRIG_CONTENT_UPLOAD_URL
|
|
151
|
+
* (endpoint, defaults to the ingest host + uploads path), MODELRIG_CONTENT_API_KEY
|
|
152
|
+
* (credential), MODELRIG_CONTENT_MAX_BYTES (numeric ceiling, default 50MB). Scrub
|
|
153
|
+
* is NOT an env var — it is a per-task/account setting resolved at runtime from
|
|
154
|
+
* the control plane (P15 CP-3b; `MODELRIG_ARTIFACTS_SCRUB` was deleted).
|
|
124
155
|
* Pure — env is read by the caller (the package's sole env-reader rule).
|
|
125
|
-
* MODELRIG_ARTIFACTS unset → namespace ON when a control plane
|
|
126
|
-
* is configured, OFF for local-only
|
|
127
|
-
* (§2: metadata-on by default).
|
|
128
|
-
* MODELRIG_ARTIFACTS=1|true|on → force the namespace ON.
|
|
129
|
-
* MODELRIG_ARTIFACTS=0|false|off → force it OFF (the explicit opt-out).
|
|
130
|
-
* MODELRIG_ARTIFACTS_CONTENT=on|1|true → content custody ON (E2-C).
|
|
131
|
-
* MODELRIG_CONTENT_UPLOAD_URL, MODELRIG_CONTENT_API_KEY → transport.
|
|
132
|
-
* MODELRIG_ARTIFACTS_SCRUB=off|detect|redact|block → scrub mode (default detect).
|
|
133
|
-
* MODELRIG_CONTENT_MAX_BYTES → client ceiling (default 50MB).
|
|
134
|
-
* Content custody stays OFF (content absent) unless it is explicitly on AND the
|
|
135
|
-
* transport is fully configured — a half-configured custody is refused into the
|
|
136
|
-
* safe default (metadata only), never silently half-on. The metadata default
|
|
137
|
-
* flip does NOT flip content: content is its own gate (§2 "content unchanged").
|
|
138
156
|
*/
|
|
139
157
|
export declare function resolveArtifactsConfig(env: {
|
|
140
|
-
readonly artifacts?: string;
|
|
141
|
-
readonly content?: string;
|
|
142
158
|
readonly uploadsUrl?: string;
|
|
143
159
|
readonly apiKey?: string;
|
|
144
|
-
readonly scrub?: string;
|
|
145
160
|
readonly maxBytes?: string;
|
|
146
161
|
},
|
|
147
|
-
/** Is a cloud sink (api or direct) configured?
|
|
148
|
-
* OFF otherwise. Defaults false so
|
|
149
|
-
*
|
|
150
|
-
controlPlaneConfigured?: boolean
|
|
162
|
+
/** Is a cloud sink (api or direct) configured? The namespace defaults ON when
|
|
163
|
+
* so (the org posture governs at runtime), OFF otherwise. Defaults false so
|
|
164
|
+
* hand-built configs/tests keep local-only semantics unless they opt in. */
|
|
165
|
+
controlPlaneConfigured?: boolean,
|
|
166
|
+
/** Dev-only local-rig force-on (MODELRIG_ARTIFACTS=1). Ignored when a control
|
|
167
|
+
* plane is configured; there, posture is the control. NOT a customer opt-out. */
|
|
168
|
+
devForceOn?: boolean): ArtifactsConfig;
|
|
169
|
+
/** Default `MODELRIG_CONTENT_UPLOAD_URL` when it is unset/blank: the ingest host
|
|
170
|
+
* (`MODELRIG_INGEST_URL`, else the SDK default) + the uploads path. The grant
|
|
171
|
+
* endpoint is always on the same server as ingest — deriving it removes a
|
|
172
|
+
* required var AND forecloses the mismatch footgun (uploads pointed at a server
|
|
173
|
+
* whose control plane lacks the artifact's metadata row would 404 forever). An
|
|
174
|
+
* explicit `MODELRIG_CONTENT_UPLOAD_URL` still wins. */
|
|
175
|
+
export declare function defaultContentUploadsUrl(ingestUrlEnv?: string): string;
|
|
151
176
|
/** Resolved OTLP config (E1). Endpoint + sink-auth headers only; the emitter
|
|
152
177
|
* derives batch/interval + watermark from defaults + the source id. */
|
|
153
178
|
export interface OtlpConfig {
|
package/dist/config.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.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", { value: true });
|
|
8
|
-
exports.PROVIDER_KEY_ENV = void 0;
|
|
8
|
+
exports.PROVIDER_KEY_ENV = exports.DEFAULT_CONTENT_SCRUB_MODE = void 0;
|
|
9
9
|
exports.pipelineShaFromEnv = pipelineShaFromEnv;
|
|
10
10
|
exports.resolveArtifactsConfig = resolveArtifactsConfig;
|
|
11
|
+
exports.defaultContentUploadsUrl = defaultContentUploadsUrl;
|
|
11
12
|
exports.parseOtlpHeaders = parseOtlpHeaders;
|
|
12
13
|
exports.resolveOtlpConfig = resolveOtlpConfig;
|
|
13
14
|
exports.loadConfigFromEnv = loadConfigFromEnv;
|
|
@@ -26,54 +27,71 @@ function pipelineShaFromEnv() {
|
|
|
26
27
|
}
|
|
27
28
|
return undefined;
|
|
28
29
|
}
|
|
30
|
+
/** The scrub mode used when NO control-plane resolver answers for a task
|
|
31
|
+
* (local-only / direct rigs, or a run with no task identity). The content-on
|
|
32
|
+
* default — scan and count, upload verbatim. Kept in sync with
|
|
33
|
+
* `settings/task-settings.ts DEFAULT_TASK_SETTINGS.scrub`. */
|
|
34
|
+
exports.DEFAULT_CONTENT_SCRUB_MODE = "detect";
|
|
29
35
|
const DEFAULT_SDK_CONTENT_MAX_BYTES = 52428800;
|
|
30
|
-
function resolveScrubMode(raw, contentOn) {
|
|
31
|
-
const v = (raw ?? "").trim().toLowerCase();
|
|
32
|
-
if (v === "off" || v === "detect" || v === "redact" || v === "block")
|
|
33
|
-
return v;
|
|
34
|
-
// Default when content is on is `detect` — scan and count, upload verbatim.
|
|
35
|
-
return contentOn ? "detect" : "off";
|
|
36
|
-
}
|
|
37
36
|
/**
|
|
38
|
-
* Resolve the artifact
|
|
37
|
+
* Resolve the artifact-namespace boot shape (E2 / E2-C; P15 CP-3). Env FEATURE
|
|
38
|
+
* GATES are GONE: capture on/off and content on/off are the ORG's account posture
|
|
39
|
+
* (`artifact_posture`), resolved from the control plane at runtime
|
|
40
|
+
* (settings/task-settings.ts) and enforced authoritatively server-side — metadata
|
|
41
|
+
* is dropped at /v1/ingest for posture `off`; content is 403'd at
|
|
42
|
+
* /v1/artifacts/uploads for posture `metadata`. This function decides only the
|
|
43
|
+
* STATIC boot shape:
|
|
44
|
+
* • the metadata namespace is ON whenever a control plane is configured (a sink
|
|
45
|
+
* exists to ship to); OFF for a pure local-only rig UNLESS `devForceOn` (the
|
|
46
|
+
* dev-only MODELRIG_ARTIFACTS=1 escape hatch — NOT a customer control).
|
|
47
|
+
* • content upload is ATTEMPTED whenever the namespace is on and a transport
|
|
48
|
+
* (uploads URL + key) is present; the SERVER's org posture is the real gate,
|
|
49
|
+
* so a `metadata`/`off` org stores nothing and the SDK degrades on the 403. A
|
|
50
|
+
* half-configured transport (no key) stays metadata-only (fail-safe).
|
|
51
|
+
* Remaining env here is NON-gate config (P15-clean): MODELRIG_CONTENT_UPLOAD_URL
|
|
52
|
+
* (endpoint, defaults to the ingest host + uploads path), MODELRIG_CONTENT_API_KEY
|
|
53
|
+
* (credential), MODELRIG_CONTENT_MAX_BYTES (numeric ceiling, default 50MB). Scrub
|
|
54
|
+
* is NOT an env var — it is a per-task/account setting resolved at runtime from
|
|
55
|
+
* the control plane (P15 CP-3b; `MODELRIG_ARTIFACTS_SCRUB` was deleted).
|
|
39
56
|
* Pure — env is read by the caller (the package's sole env-reader rule).
|
|
40
|
-
* MODELRIG_ARTIFACTS unset → namespace ON when a control plane
|
|
41
|
-
* is configured, OFF for local-only
|
|
42
|
-
* (§2: metadata-on by default).
|
|
43
|
-
* MODELRIG_ARTIFACTS=1|true|on → force the namespace ON.
|
|
44
|
-
* MODELRIG_ARTIFACTS=0|false|off → force it OFF (the explicit opt-out).
|
|
45
|
-
* MODELRIG_ARTIFACTS_CONTENT=on|1|true → content custody ON (E2-C).
|
|
46
|
-
* MODELRIG_CONTENT_UPLOAD_URL, MODELRIG_CONTENT_API_KEY → transport.
|
|
47
|
-
* MODELRIG_ARTIFACTS_SCRUB=off|detect|redact|block → scrub mode (default detect).
|
|
48
|
-
* MODELRIG_CONTENT_MAX_BYTES → client ceiling (default 50MB).
|
|
49
|
-
* Content custody stays OFF (content absent) unless it is explicitly on AND the
|
|
50
|
-
* transport is fully configured — a half-configured custody is refused into the
|
|
51
|
-
* safe default (metadata only), never silently half-on. The metadata default
|
|
52
|
-
* flip does NOT flip content: content is its own gate (§2 "content unchanged").
|
|
53
57
|
*/
|
|
54
58
|
function resolveArtifactsConfig(env,
|
|
55
|
-
/** Is a cloud sink (api or direct) configured?
|
|
56
|
-
* OFF otherwise. Defaults false so
|
|
57
|
-
*
|
|
58
|
-
controlPlaneConfigured = false
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
//
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
const
|
|
59
|
+
/** Is a cloud sink (api or direct) configured? The namespace defaults ON when
|
|
60
|
+
* so (the org posture governs at runtime), OFF otherwise. Defaults false so
|
|
61
|
+
* hand-built configs/tests keep local-only semantics unless they opt in. */
|
|
62
|
+
controlPlaneConfigured = false,
|
|
63
|
+
/** Dev-only local-rig force-on (MODELRIG_ARTIFACTS=1). Ignored when a control
|
|
64
|
+
* plane is configured; there, posture is the control. NOT a customer opt-out. */
|
|
65
|
+
devForceOn = false) {
|
|
66
|
+
// Namespace on when there is a control plane to ship to (org posture, resolved
|
|
67
|
+
// at runtime + the server ingest gate, decides what is kept), or when a dev has
|
|
68
|
+
// forced it on for a local-only rig that has no posture to resolve.
|
|
69
|
+
const enabled = controlPlaneConfigured || devForceOn;
|
|
66
70
|
const uploadsUrl = (env.uploadsUrl ?? "").trim();
|
|
67
71
|
const apiKey = (env.apiKey ?? "").trim();
|
|
68
72
|
const maxBytesRaw = env.maxBytes !== undefined && env.maxBytes !== "" ? Number(env.maxBytes) : NaN;
|
|
69
73
|
const maxBytes = Number.isInteger(maxBytesRaw) && maxBytesRaw > 0 ? maxBytesRaw : DEFAULT_SDK_CONTENT_MAX_BYTES;
|
|
70
|
-
// Content is
|
|
71
|
-
//
|
|
72
|
-
|
|
73
|
-
|
|
74
|
+
// Content is ATTEMPTED whenever the namespace is enabled and the transport is
|
|
75
|
+
// present; the server's org posture is the consent gate (a `metadata`/`off` org
|
|
76
|
+
// 403s and the SDK degrades to metadata-only). No client env gate — the opt-out
|
|
77
|
+
// is the account posture. Missing transport → metadata-only (fail-safe).
|
|
78
|
+
const content = enabled && uploadsUrl !== "" && apiKey !== ""
|
|
79
|
+
? { uploadsUrl, apiKey, maxBytes }
|
|
74
80
|
: undefined;
|
|
75
81
|
return { enabled, ...(content !== undefined ? { content } : {}) };
|
|
76
82
|
}
|
|
83
|
+
/** The managed content-custody grant endpoint path on the server. */
|
|
84
|
+
const ARTIFACT_UPLOADS_PATH = "/v1/artifacts/uploads";
|
|
85
|
+
/** Default `MODELRIG_CONTENT_UPLOAD_URL` when it is unset/blank: the ingest host
|
|
86
|
+
* (`MODELRIG_INGEST_URL`, else the SDK default) + the uploads path. The grant
|
|
87
|
+
* endpoint is always on the same server as ingest — deriving it removes a
|
|
88
|
+
* required var AND forecloses the mismatch footgun (uploads pointed at a server
|
|
89
|
+
* whose control plane lacks the artifact's metadata row would 404 forever). An
|
|
90
|
+
* explicit `MODELRIG_CONTENT_UPLOAD_URL` still wins. */
|
|
91
|
+
function defaultContentUploadsUrl(ingestUrlEnv) {
|
|
92
|
+
const raw = ingestUrlEnv !== undefined && ingestUrlEnv.trim() !== "" ? ingestUrlEnv.trim() : ingest_protocol_1.DEFAULT_INGEST_URL;
|
|
93
|
+
return `${raw.replace(/\/+$/, "")}${ARTIFACT_UPLOADS_PATH}`;
|
|
94
|
+
}
|
|
77
95
|
/**
|
|
78
96
|
* Parse `MODELRIG_OTLP_HEADERS` ("k=v,k=v") into a header map (E1). Split on the
|
|
79
97
|
* FIRST `=` only, so a base64 Basic-auth value keeping its `=` padding survives.
|
|
@@ -132,20 +150,41 @@ function loadConfigFromEnv(overrides) {
|
|
|
132
150
|
// OTLP span emission (E1) — off unless an endpoint is set. Additive to
|
|
133
151
|
// `export`; a rig may emit OTLP with no control-plane sink and vice-versa.
|
|
134
152
|
const otlp = resolveOtlpConfig(env.MODELRIG_OTLP_ENDPOINT, env.MODELRIG_OTLP_HEADERS);
|
|
135
|
-
// Artifact / execution-graph namespace (E2
|
|
136
|
-
//
|
|
137
|
-
//
|
|
138
|
-
//
|
|
139
|
-
//
|
|
153
|
+
// Artifact / execution-graph namespace (E2; P15 CP-3) — ON by default when a
|
|
154
|
+
// control plane is configured (api key OR the direct supabase pair). The ORG's
|
|
155
|
+
// account posture (`artifact_posture`), resolved from the control plane at
|
|
156
|
+
// runtime and enforced server-side, is the on/off control — NOT an env var
|
|
157
|
+
// (P15). The old `MODELRIG_ARTIFACTS` / `MODELRIG_ARTIFACTS_CONTENT` opt-out
|
|
158
|
+
// gates are DELETED: opt out by setting org posture `off` (capture nothing) or
|
|
159
|
+
// `metadata` (no content) in the console or via the set_org_settings MCP tool.
|
|
160
|
+
//
|
|
161
|
+
// DEV-ONLY escape hatch: a pure LOCAL-ONLY rig has no control plane to resolve
|
|
162
|
+
// a posture from, so the artifact namespace is off there unless a dev forces it
|
|
163
|
+
// on for local inspection — `MODELRIG_ARTIFACTS=1` is honored ONLY when NO
|
|
164
|
+
// control plane is configured. It is NOT a customer control (never advertised
|
|
165
|
+
// in onboarding/get-started/.env.example) and the deleted `=0` opt-out no
|
|
166
|
+
// longer does anything. When a control plane IS configured, MODELRIG_ARTIFACTS
|
|
167
|
+
// is ignored (posture governs) — warn once so a stale `=0` is not read as an
|
|
168
|
+
// opt-out that silently stopped working. Always resolved so /status + the boot
|
|
169
|
+
// banner answer honestly.
|
|
140
170
|
const controlPlaneConfigured = Boolean(apiKey) || Boolean(supabaseUrl && serviceRoleKey);
|
|
171
|
+
const artifactsGate = (env.MODELRIG_ARTIFACTS ?? "").trim().toLowerCase();
|
|
172
|
+
const devForceOn = !controlPlaneConfigured &&
|
|
173
|
+
(artifactsGate === "1" || artifactsGate === "true" || artifactsGate === "on");
|
|
174
|
+
if (controlPlaneConfigured && artifactsGate !== "") {
|
|
175
|
+
console.warn("[modelrig] MODELRIG_ARTIFACTS is ignored — capture on/off is your account posture " +
|
|
176
|
+
"(artifact_posture), not an env var (P15). To stop capture, set org posture 'off' " +
|
|
177
|
+
"(or 'metadata' for no content) in the console or via the set_org_settings MCP tool.");
|
|
178
|
+
}
|
|
141
179
|
const artifacts = resolveArtifactsConfig({
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
uploadsUrl: env.MODELRIG_CONTENT_UPLOAD_URL
|
|
180
|
+
// Default the grant endpoint to the ingest host so custody needs only the
|
|
181
|
+
// artifact-write key; an explicit override still wins.
|
|
182
|
+
uploadsUrl: env.MODELRIG_CONTENT_UPLOAD_URL?.trim()
|
|
183
|
+
? env.MODELRIG_CONTENT_UPLOAD_URL
|
|
184
|
+
: defaultContentUploadsUrl(env.MODELRIG_INGEST_URL),
|
|
145
185
|
apiKey: env.MODELRIG_CONTENT_API_KEY ?? env.MODELRIG_API_KEY,
|
|
146
|
-
scrub: env.MODELRIG_ARTIFACTS_SCRUB,
|
|
147
186
|
maxBytes: env.MODELRIG_CONTENT_MAX_BYTES,
|
|
148
|
-
}, controlPlaneConfigured);
|
|
187
|
+
}, controlPlaneConfigured, devForceOn);
|
|
149
188
|
const fromEnv = {
|
|
150
189
|
routesDir: env.MODELRIG_ROUTES_DIR ?? DEFAULT_ROUTES_DIR,
|
|
151
190
|
telemetryDbPath: env.MODELRIG_TELEMETRY_DB ?? DEFAULT_TELEMETRY_DB,
|
|
@@ -26,8 +26,10 @@ export type ContentSource = "template" | "variable" | "search" | "tool_result" |
|
|
|
26
26
|
export type TrustTier = "trusted" | "semi" | "untrusted";
|
|
27
27
|
/** The family a detector belongs to — used only as a receipt/registry label and
|
|
28
28
|
* to decide the fail-closed matrix (deterministic never fails a run open;
|
|
29
|
-
* classifier/sidecar absence degrades to a notice).
|
|
30
|
-
|
|
29
|
+
* classifier/sidecar/model absence or failure degrades to a notice). The T3
|
|
30
|
+
* `model` screen (SC-3) is a metered inference over the same interface: a signal
|
|
31
|
+
* into the deterministic actions, never a control (spec-sc3 §2). */
|
|
32
|
+
export type DetectorKind = "deterministic" | "classifier" | "sidecar" | "model";
|
|
31
33
|
/** The category of a finding. `pii:*` reuses scrub v1's ScrubDetectorType
|
|
32
34
|
* values; `entity:*` is dictionary/field typing; `injection:*` is the
|
|
33
35
|
* screening lane. Open string union — the value only ever appears as a COUNT
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"detector.d.ts","sourceRoot":"","sources":["../../src/detect/detector.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH;;wBAEwB;AACxB,MAAM,MAAM,aAAa,GACrB,UAAU,GACV,UAAU,GACV,QAAQ,GACR,aAAa,GACb,YAAY,GACZ,YAAY,GACZ,SAAS,CAAC;AAEd,MAAM,MAAM,SAAS,GAAG,SAAS,GAAG,MAAM,GAAG,WAAW,CAAC;AAEzD
|
|
1
|
+
{"version":3,"file":"detector.d.ts","sourceRoot":"","sources":["../../src/detect/detector.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH;;wBAEwB;AACxB,MAAM,MAAM,aAAa,GACrB,UAAU,GACV,UAAU,GACV,QAAQ,GACR,aAAa,GACb,YAAY,GACZ,YAAY,GACZ,SAAS,CAAC;AAEd,MAAM,MAAM,SAAS,GAAG,SAAS,GAAG,MAAM,GAAG,WAAW,CAAC;AAEzD;;;;oEAIoE;AACpE,MAAM,MAAM,YAAY,GAAG,eAAe,GAAG,YAAY,GAAG,SAAS,GAAG,OAAO,CAAC;AAEhF;;;oCAGoC;AACpC,MAAM,MAAM,aAAa,GAAG,MAAM,GAAG,EAAE,CAAC;AAExC;+DAC+D;AAC/D,MAAM,WAAW,aAAa;IAC5B,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,IAAI,EAAE,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