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
package/dist/init/observe.js
CHANGED
|
@@ -16,8 +16,8 @@
|
|
|
16
16
|
* agent (or human) to apply with judgment, one step at a time.
|
|
17
17
|
*
|
|
18
18
|
* Observe is deliberately NOT migration: it drafts no routes, reroutes no
|
|
19
|
-
* model calls, and changes no behaviour. With
|
|
20
|
-
* pipeline is byte-for-byte identical (instrumentation.md).
|
|
19
|
+
* model calls, and changes no behaviour. With no control plane configured (or the
|
|
20
|
+
* org capture posture `off`) the pipeline is byte-for-byte identical (instrumentation.md).
|
|
21
21
|
*/
|
|
22
22
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
23
23
|
exports.stepKeyFor = stepKeyFor;
|
|
@@ -49,8 +49,8 @@ function seamContent() {
|
|
|
49
49
|
* deleted seam) so it always matches the current SDK. It records each pipeline
|
|
50
50
|
* run as a run -> step -> artifact chain you click through in the console.
|
|
51
51
|
*
|
|
52
|
-
* Observe-only: no routes move, no model calls are rerouted. With
|
|
53
|
-
*
|
|
52
|
+
* Observe-only: no routes move, no model calls are rerouted. With no control
|
|
53
|
+
* plane configured (or the org capture posture set to off) every call here is
|
|
54
54
|
* inert and your pipeline behaves byte-for-byte as before. Nothing here ever
|
|
55
55
|
* throws into your pipeline — a telemetry write that fails is logged and
|
|
56
56
|
* dropped (instrumentation.md, "Never throws into your pipeline").
|
|
@@ -99,7 +99,7 @@ export function recordStep(
|
|
|
99
99
|
const parsed = rig.artifacts.artifact.save(work.json, { name: \`\${stepKey}.output\`, type: "step_output", task: stepKey, stepKey });
|
|
100
100
|
if (p && parsed) rig.artifacts.artifact.link(parsed, p, "derived_from");
|
|
101
101
|
if (raw && parsed) rig.artifacts.artifact.link(parsed, raw, "derived_from");
|
|
102
|
-
if (parsed) rig.
|
|
102
|
+
if (parsed) rig.grade({ kind: "artifact", id: parsed.id }, { score: work.conforms ? 1 : 0, kind: "deterministic", grader: "schema-check" });
|
|
103
103
|
}
|
|
104
104
|
`;
|
|
105
105
|
}
|
|
@@ -146,10 +146,14 @@ function buildObserveMarkdown(plans, seamPath, result, path) {
|
|
|
146
146
|
"each is proposed as one instrumented **step**. Apply the diffs one step at a time — a step",
|
|
147
147
|
"you do not understand yet is a step you can leave for later.",
|
|
148
148
|
"",
|
|
149
|
-
"## 1.
|
|
149
|
+
"## 1. Point at the console (one step, once)",
|
|
150
|
+
"",
|
|
151
|
+
"Capture is **on by default** — one API key turns everything on, and you opt out later in",
|
|
152
|
+
"your **account settings** (the org capture posture), never with an env var. There is no",
|
|
153
|
+
"capture flag to set: once `MODELRIG_API_KEY` is present the run/step/artifact namespace is on.",
|
|
150
154
|
"",
|
|
151
155
|
"```bash",
|
|
152
|
-
"export
|
|
156
|
+
"export MODELRIG_API_KEY=<key> # mint at https://app.modelrig.ai (/keys)",
|
|
153
157
|
"# export MODELRIG_ARTIFACT_STEPS=step_a,step_b # optional: instrument a subset",
|
|
154
158
|
"```",
|
|
155
159
|
"",
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* CS-1 Chunk B — the masked-vs-unmasked value-accuracy arm (spec §7).
|
|
3
|
+
*
|
|
4
|
+
* Chunk A proved the load-bearing property: no detected span leaves (proof.ts,
|
|
5
|
+
* leakage-only, offline over captures). Chunk B answers the customer's second
|
|
6
|
+
* question — "did masking change the answer?" — by replaying the route's
|
|
7
|
+
* captures twice against the INCUMBENT model only:
|
|
8
|
+
* - control = the route with masking OFF (byte-identical to pre-CS-1)
|
|
9
|
+
* - treatment = the route's real `mask:` policy (mask → dispatch → rehydrate)
|
|
10
|
+
* and diffing per-sample quality with a paired-bootstrap CI, then gating
|
|
11
|
+
* promotion on the policy's `tolerance` block (value_accuracy_delta_max /
|
|
12
|
+
* conformance_delta_max). PR-as-actuator: a `mask.mode` promotion is a route
|
|
13
|
+
* bundle change whose PR body is this report — no silent promotion.
|
|
14
|
+
*
|
|
15
|
+
* RB-1 fence: this module ONLY CALLS the RB-1 replay/stats primitives
|
|
16
|
+
* (`replayVariant`, `pairedRegret`, `aggregateVariantMetrics`, `wilson95`). It
|
|
17
|
+
* does not restructure `engine.ts`/`replay.ts`/`stats.ts`. The mask arm is a
|
|
18
|
+
* standalone report (it composes the Chunk-A leak proof + the Chunk-B Δ), not a
|
|
19
|
+
* restructured `BakeoffArtifact` — flagged for the architect (P2).
|
|
20
|
+
*
|
|
21
|
+
* Counts-never-values: every field emitted here is a number, an enum, a policy
|
|
22
|
+
* hash, or a capture id — never a matched value (asserted by the
|
|
23
|
+
* receipt-invariant property test, extended in Chunk B to this report).
|
|
24
|
+
*/
|
|
25
|
+
import type { CaptureStore } from "../telemetry/capture";
|
|
26
|
+
import type { LoadedRoutes } from "../routes/loader";
|
|
27
|
+
import type { RunDeps } from "../run/run";
|
|
28
|
+
import { type ReplaySampleResult } from "../bakeoff/replay";
|
|
29
|
+
import type { ResolvedMaskPolicy, MaskTolerance } from "./types";
|
|
30
|
+
import { type MaskArmProof } from "./proof";
|
|
31
|
+
/** Minimum paired samples before the separation gate may say "promotable"
|
|
32
|
+
* (mirrors engine.ts's `nPaired >= 10` floor — a Δ over <10 pairs is noise). */
|
|
33
|
+
export declare const MASK_ARM_MIN_PAIRED = 10;
|
|
34
|
+
/** A single fixture whose quality dropped most under masking — id + magnitude
|
|
35
|
+
* only (spec §7.2 "the per-fixture worst offenders (fixture ids + types, never
|
|
36
|
+
* values)"). */
|
|
37
|
+
export interface MaskArmOffender {
|
|
38
|
+
readonly captureId: string;
|
|
39
|
+
readonly qualityDrop: number;
|
|
40
|
+
}
|
|
41
|
+
/** The masked-vs-unmasked Δ (spec §7). All counts/rates/CIs — never a value. */
|
|
42
|
+
export interface MaskArmDelta {
|
|
43
|
+
readonly policyHash: string;
|
|
44
|
+
readonly nPaired: number;
|
|
45
|
+
readonly controlValueAccuracyMean: number | null;
|
|
46
|
+
readonly treatmentValueAccuracyMean: number | null;
|
|
47
|
+
/** mean q(control) − q(treatment): how much masking dropped quality. */
|
|
48
|
+
readonly valueAccuracyDelta: number;
|
|
49
|
+
readonly valueAccuracyDeltaCi95: readonly [number, number];
|
|
50
|
+
readonly controlConformRate: number;
|
|
51
|
+
readonly treatmentConformRate: number;
|
|
52
|
+
readonly conformanceDelta: number;
|
|
53
|
+
readonly conformanceDeltaCi95: readonly [number, number];
|
|
54
|
+
readonly tolerance: MaskTolerance | null;
|
|
55
|
+
/** value-accuracy Δ CI upper bound within tolerance (CI not excluding zero harm). */
|
|
56
|
+
readonly valueAccuracyOk: boolean;
|
|
57
|
+
readonly conformanceOk: boolean;
|
|
58
|
+
/** promotable ⇒ gate clears AND enough pairs AND no leak (set by the caller). */
|
|
59
|
+
readonly promotable: boolean;
|
|
60
|
+
readonly worstOffenders: readonly MaskArmOffender[];
|
|
61
|
+
}
|
|
62
|
+
/** The masked-arm report — a bake-off report of `kind: mask-policy` (spec §7.1),
|
|
63
|
+
* the artifact that (a) renders as the promotion PR body, (b) maps to a
|
|
64
|
+
* `Receipt@v1 kind: masking-proof` (RP-0), (c) feeds the console Control card. */
|
|
65
|
+
export interface MaskArmReport {
|
|
66
|
+
readonly kind: "mask-policy";
|
|
67
|
+
readonly route: string;
|
|
68
|
+
readonly routeVersion: number;
|
|
69
|
+
readonly ranAt: string;
|
|
70
|
+
readonly policyHash: string;
|
|
71
|
+
readonly replayN: number;
|
|
72
|
+
readonly models: readonly {
|
|
73
|
+
readonly provider: string;
|
|
74
|
+
readonly model: string;
|
|
75
|
+
}[];
|
|
76
|
+
/** Chunk-A leak proof over the same captures — the load-bearing invariant. */
|
|
77
|
+
readonly proof: MaskArmProof;
|
|
78
|
+
/** Chunk-B value-accuracy Δ. */
|
|
79
|
+
readonly delta: MaskArmDelta;
|
|
80
|
+
}
|
|
81
|
+
/** Wrap a `LoadedRoutes` so the target route resolves with masking stripped —
|
|
82
|
+
* the control (unmasked) arm. Only `.mask` is cleared, and only for `route`;
|
|
83
|
+
* every other field and route is untouched, so the control arm is byte-identical
|
|
84
|
+
* to the pre-CS-1 path (the golden). */
|
|
85
|
+
export declare function stripMaskFromRoutes(routes: LoadedRoutes, route: string): LoadedRoutes;
|
|
86
|
+
/**
|
|
87
|
+
* Compute the masked-vs-unmasked Δ from two replay passes over the SAME captures
|
|
88
|
+
* (same incumbent model; masking the only difference). Pure — reuses stats.ts.
|
|
89
|
+
* `pairedRegret(treatment, control)` yields mean q(control) − q(treatment), i.e.
|
|
90
|
+
* the quality DROP caused by masking, with a seeded paired-bootstrap CI.
|
|
91
|
+
*/
|
|
92
|
+
export declare function computeMaskArmDelta(policy: ResolvedMaskPolicy, control: readonly ReplaySampleResult[], treatment: readonly ReplaySampleResult[]): MaskArmDelta;
|
|
93
|
+
export interface MaskArmBakeoffRequest {
|
|
94
|
+
readonly route: string;
|
|
95
|
+
readonly replayLast: number;
|
|
96
|
+
readonly envelopeUsd: number;
|
|
97
|
+
/** Injectable clock for deterministic `ranAt` in tests. */
|
|
98
|
+
readonly now?: () => Date;
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* Run the full masked-arm bake-off: replay the incumbent twice (control =
|
|
102
|
+
* unmasked, treatment = masked), diff, gate, and compose the report with the
|
|
103
|
+
* Chunk-A leak proof over the same captures. Real (billed) dispatches — the
|
|
104
|
+
* live run over the demo-rig / InferWealth corpus is deferred to a
|
|
105
|
+
* provider-keyed session; unit tests drive it with a fake adapter.
|
|
106
|
+
*/
|
|
107
|
+
export declare function runMaskArmBakeoff(deps: RunDeps, captures: CaptureStore, req: MaskArmBakeoffRequest): Promise<MaskArmReport>;
|
|
108
|
+
/** Render the masked-arm report as counts-only Markdown — the promotion PR body
|
|
109
|
+
* (spec §7.3) and the verification-doc artifact. Extends `formatMaskArmReport`
|
|
110
|
+
* (the Chunk-A leak block) with the Chunk-B Δ + separation gate. */
|
|
111
|
+
export declare function formatMaskArmReportFull(report: MaskArmReport): string;
|
|
112
|
+
//# sourceMappingURL=arm.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"arm.d.ts","sourceRoot":"","sources":["../../src/mask/arm.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACzD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AACrD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAC1C,OAAO,EAAiB,KAAK,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AAE3E,OAAO,KAAK,EAAE,kBAAkB,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAC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 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* CS-1 Chunk B — the masked-vs-unmasked value-accuracy arm (spec §7).
|
|
4
|
+
*
|
|
5
|
+
* Chunk A proved the load-bearing property: no detected span leaves (proof.ts,
|
|
6
|
+
* leakage-only, offline over captures). Chunk B answers the customer's second
|
|
7
|
+
* question — "did masking change the answer?" — by replaying the route's
|
|
8
|
+
* captures twice against the INCUMBENT model only:
|
|
9
|
+
* - control = the route with masking OFF (byte-identical to pre-CS-1)
|
|
10
|
+
* - treatment = the route's real `mask:` policy (mask → dispatch → rehydrate)
|
|
11
|
+
* and diffing per-sample quality with a paired-bootstrap CI, then gating
|
|
12
|
+
* promotion on the policy's `tolerance` block (value_accuracy_delta_max /
|
|
13
|
+
* conformance_delta_max). PR-as-actuator: a `mask.mode` promotion is a route
|
|
14
|
+
* bundle change whose PR body is this report — no silent promotion.
|
|
15
|
+
*
|
|
16
|
+
* RB-1 fence: this module ONLY CALLS the RB-1 replay/stats primitives
|
|
17
|
+
* (`replayVariant`, `pairedRegret`, `aggregateVariantMetrics`, `wilson95`). It
|
|
18
|
+
* does not restructure `engine.ts`/`replay.ts`/`stats.ts`. The mask arm is a
|
|
19
|
+
* standalone report (it composes the Chunk-A leak proof + the Chunk-B Δ), not a
|
|
20
|
+
* restructured `BakeoffArtifact` — flagged for the architect (P2).
|
|
21
|
+
*
|
|
22
|
+
* Counts-never-values: every field emitted here is a number, an enum, a policy
|
|
23
|
+
* hash, or a capture id — never a matched value (asserted by the
|
|
24
|
+
* receipt-invariant property test, extended in Chunk B to this report).
|
|
25
|
+
*/
|
|
26
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
27
|
+
exports.MASK_ARM_MIN_PAIRED = void 0;
|
|
28
|
+
exports.stripMaskFromRoutes = stripMaskFromRoutes;
|
|
29
|
+
exports.computeMaskArmDelta = computeMaskArmDelta;
|
|
30
|
+
exports.runMaskArmBakeoff = runMaskArmBakeoff;
|
|
31
|
+
exports.formatMaskArmReportFull = formatMaskArmReportFull;
|
|
32
|
+
const replay_1 = require("../bakeoff/replay");
|
|
33
|
+
const stats_1 = require("../bakeoff/stats");
|
|
34
|
+
const proof_1 = require("./proof");
|
|
35
|
+
/** Slack for a floating-point threshold comparison — mirrors engine.ts's gate EPS. */
|
|
36
|
+
const GATE_EPS = 1e-9;
|
|
37
|
+
/** Minimum paired samples before the separation gate may say "promotable"
|
|
38
|
+
* (mirrors engine.ts's `nPaired >= 10` floor — a Δ over <10 pairs is noise). */
|
|
39
|
+
exports.MASK_ARM_MIN_PAIRED = 10;
|
|
40
|
+
/** How many worst-offending fixtures the report lists (ids + drop, never values). */
|
|
41
|
+
const WORST_OFFENDERS = 5;
|
|
42
|
+
/** Wrap a `LoadedRoutes` so the target route resolves with masking stripped —
|
|
43
|
+
* the control (unmasked) arm. Only `.mask` is cleared, and only for `route`;
|
|
44
|
+
* every other field and route is untouched, so the control arm is byte-identical
|
|
45
|
+
* to the pre-CS-1 path (the golden). */
|
|
46
|
+
function stripMaskFromRoutes(routes, route) {
|
|
47
|
+
const strip = (b) => b.route === route && b.mask !== undefined ? { ...b, mask: undefined } : b;
|
|
48
|
+
return {
|
|
49
|
+
get: (r) => strip(routes.get(r)),
|
|
50
|
+
list: () => routes.list().map(strip),
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
/** Per-sample quality forced to conformance only (value score dropped), so the
|
|
54
|
+
* shared `pairedRegret` bootstrap yields a conformance-specific Δ CI. */
|
|
55
|
+
function conformanceOnly(s) {
|
|
56
|
+
return { ...s, valueAccuracy: null };
|
|
57
|
+
}
|
|
58
|
+
function meanOrNull(xs) {
|
|
59
|
+
const nums = xs.filter((x) => x !== null);
|
|
60
|
+
return nums.length === 0 ? null : nums.reduce((a, b) => a + b, 0) / nums.length;
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Compute the masked-vs-unmasked Δ from two replay passes over the SAME captures
|
|
64
|
+
* (same incumbent model; masking the only difference). Pure — reuses stats.ts.
|
|
65
|
+
* `pairedRegret(treatment, control)` yields mean q(control) − q(treatment), i.e.
|
|
66
|
+
* the quality DROP caused by masking, with a seeded paired-bootstrap CI.
|
|
67
|
+
*/
|
|
68
|
+
function computeMaskArmDelta(policy, control, treatment) {
|
|
69
|
+
const va = (0, stats_1.pairedRegret)(treatment, control);
|
|
70
|
+
const conf = (0, stats_1.pairedRegret)(treatment.map(conformanceOnly), control.map(conformanceOnly));
|
|
71
|
+
const controlMetrics = (0, stats_1.aggregateVariantMetrics)("control", control);
|
|
72
|
+
const treatmentMetrics = (0, stats_1.aggregateVariantMetrics)("masked", treatment);
|
|
73
|
+
const tolerance = policy.policy.tolerance ?? null;
|
|
74
|
+
const valueAccuracyOk = tolerance === null ? false : va.regretCi95[1] <= tolerance.value_accuracy_delta_max + GATE_EPS;
|
|
75
|
+
const conformanceOk = tolerance === null ? false : conf.regretMean <= tolerance.conformance_delta_max + GATE_EPS;
|
|
76
|
+
const promotable = valueAccuracyOk && conformanceOk && va.nPaired >= exports.MASK_ARM_MIN_PAIRED;
|
|
77
|
+
// Worst offenders: per-capture quality drop q(control) − q(treatment), the
|
|
78
|
+
// fixtures masking hurt most — ids + magnitude only (spec §7.2).
|
|
79
|
+
const controlByCapture = new Map(control.map((s) => [s.captureId, s]));
|
|
80
|
+
const drops = [];
|
|
81
|
+
for (const t of treatment) {
|
|
82
|
+
const c = controlByCapture.get(t.captureId);
|
|
83
|
+
if (c === undefined)
|
|
84
|
+
continue;
|
|
85
|
+
const drop = (c.valueAccuracy ?? (c.conform ? 1 : 0)) - (t.valueAccuracy ?? (t.conform ? 1 : 0));
|
|
86
|
+
if (drop > 0)
|
|
87
|
+
drops.push({ captureId: t.captureId, qualityDrop: drop });
|
|
88
|
+
}
|
|
89
|
+
drops.sort((a, b) => b.qualityDrop - a.qualityDrop);
|
|
90
|
+
return {
|
|
91
|
+
policyHash: policy.policyHash,
|
|
92
|
+
nPaired: va.nPaired,
|
|
93
|
+
controlValueAccuracyMean: meanOrNull(control.map((s) => s.valueAccuracy)),
|
|
94
|
+
treatmentValueAccuracyMean: meanOrNull(treatment.map((s) => s.valueAccuracy)),
|
|
95
|
+
valueAccuracyDelta: va.regretMean,
|
|
96
|
+
valueAccuracyDeltaCi95: va.regretCi95,
|
|
97
|
+
controlConformRate: controlMetrics.conformRate,
|
|
98
|
+
treatmentConformRate: treatmentMetrics.conformRate,
|
|
99
|
+
conformanceDelta: conf.regretMean,
|
|
100
|
+
conformanceDeltaCi95: conf.regretCi95,
|
|
101
|
+
tolerance,
|
|
102
|
+
valueAccuracyOk,
|
|
103
|
+
conformanceOk,
|
|
104
|
+
promotable,
|
|
105
|
+
worstOffenders: drops.slice(0, WORST_OFFENDERS),
|
|
106
|
+
};
|
|
107
|
+
}
|
|
108
|
+
/**
|
|
109
|
+
* Run the full masked-arm bake-off: replay the incumbent twice (control =
|
|
110
|
+
* unmasked, treatment = masked), diff, gate, and compose the report with the
|
|
111
|
+
* Chunk-A leak proof over the same captures. Real (billed) dispatches — the
|
|
112
|
+
* live run over the demo-rig / InferWealth corpus is deferred to a
|
|
113
|
+
* provider-keyed session; unit tests drive it with a fake adapter.
|
|
114
|
+
*/
|
|
115
|
+
async function runMaskArmBakeoff(deps, captures, req) {
|
|
116
|
+
const bundle = deps.routes.get(req.route);
|
|
117
|
+
if (bundle.mask === undefined) {
|
|
118
|
+
throw new Error(`route "${req.route}" has no active mask: policy (mode: mask) — add one before running the masked arm`);
|
|
119
|
+
}
|
|
120
|
+
const policy = bundle.mask;
|
|
121
|
+
const replayReq = {
|
|
122
|
+
route: req.route,
|
|
123
|
+
variant: "default",
|
|
124
|
+
lastN: req.replayLast,
|
|
125
|
+
envelopeUsd: req.envelopeUsd,
|
|
126
|
+
};
|
|
127
|
+
// Treatment: the route as configured (masking ON). Control: masking stripped.
|
|
128
|
+
const treatment = await (0, replay_1.replayVariant)(deps, captures, replayReq);
|
|
129
|
+
const control = await (0, replay_1.replayVariant)({ ...deps, routes: stripMaskFromRoutes(deps.routes, req.route) }, captures, replayReq);
|
|
130
|
+
// The Chunk-A leak proof over the same captures — the invariant that gates all.
|
|
131
|
+
const proof = (0, proof_1.proveMaskArmFromCaptures)(captures.readLast(req.route, req.replayLast), policy);
|
|
132
|
+
const baseDelta = computeMaskArmDelta(policy, control, treatment);
|
|
133
|
+
// A leak voids promotion regardless of the Δ (fail closed on the invariant).
|
|
134
|
+
const delta = { ...baseDelta, promotable: baseDelta.promotable && proof.proven };
|
|
135
|
+
const incumbent = bundle.candidates[0];
|
|
136
|
+
return {
|
|
137
|
+
kind: "mask-policy",
|
|
138
|
+
route: req.route,
|
|
139
|
+
routeVersion: bundle.version,
|
|
140
|
+
ranAt: (req.now ?? (() => new Date()))().toISOString(),
|
|
141
|
+
policyHash: policy.policyHash,
|
|
142
|
+
replayN: proof.samples,
|
|
143
|
+
models: incumbent !== undefined ? [{ provider: incumbent.provider, model: incumbent.model }] : [],
|
|
144
|
+
proof,
|
|
145
|
+
delta,
|
|
146
|
+
};
|
|
147
|
+
}
|
|
148
|
+
function pct(x) {
|
|
149
|
+
return (x * 100).toFixed(2);
|
|
150
|
+
}
|
|
151
|
+
/** Render the masked-arm report as counts-only Markdown — the promotion PR body
|
|
152
|
+
* (spec §7.3) and the verification-doc artifact. Extends `formatMaskArmReport`
|
|
153
|
+
* (the Chunk-A leak block) with the Chunk-B Δ + separation gate. */
|
|
154
|
+
function formatMaskArmReportFull(report) {
|
|
155
|
+
const d = report.delta;
|
|
156
|
+
const lines = [];
|
|
157
|
+
lines.push(`### Masked-arm report — kind: mask-policy — route \`${report.route}\` v${report.routeVersion}`);
|
|
158
|
+
lines.push("");
|
|
159
|
+
lines.push(`- policy: \`${report.policyHash.slice(0, 12)}…\``);
|
|
160
|
+
lines.push(`- samples (leak proof): ${report.proof.samples}`);
|
|
161
|
+
lines.push(`- paired samples (Δ arm): ${d.nPaired}`);
|
|
162
|
+
lines.push(`- masked-arm leaks: ${report.proof.maskedLeaks.reduce((a, f) => a + f.count, 0)} (${report.proof.proven ? "PROVEN none" : "LEAK"})`);
|
|
163
|
+
lines.push("");
|
|
164
|
+
lines.push("| metric | control (unmasked) | masked (treatment) | Δ | CI 95% | budget | within |");
|
|
165
|
+
lines.push("|---|---|---|---|---|---|---|");
|
|
166
|
+
const vaBudget = d.tolerance !== null ? d.tolerance.value_accuracy_delta_max.toFixed(3) : "—";
|
|
167
|
+
const confBudget = d.tolerance !== null ? d.tolerance.conformance_delta_max.toFixed(3) : "—";
|
|
168
|
+
lines.push(`| value_accuracy | ${d.controlValueAccuracyMean === null ? "n/a" : d.controlValueAccuracyMean.toFixed(3)} | ${d.treatmentValueAccuracyMean === null ? "n/a" : d.treatmentValueAccuracyMean.toFixed(3)} | ${d.valueAccuracyDelta.toFixed(3)} | [${d.valueAccuracyDeltaCi95[0].toFixed(3)}, ${d.valueAccuracyDeltaCi95[1].toFixed(3)}] | ${vaBudget} | ${d.valueAccuracyOk ? "yes" : "NO"} |`);
|
|
169
|
+
lines.push(`| conformance | ${pct(d.controlConformRate)}% | ${pct(d.treatmentConformRate)}% | ${d.conformanceDelta.toFixed(3)} | [${d.conformanceDeltaCi95[0].toFixed(3)}, ${d.conformanceDeltaCi95[1].toFixed(3)}] | ${confBudget} | ${d.conformanceOk ? "yes" : "NO"} |`);
|
|
170
|
+
lines.push("");
|
|
171
|
+
lines.push(`**Gate: ${d.promotable ? "promotable" : "blocked-by-evidence"}** (n_paired ${d.nPaired}${d.nPaired < exports.MASK_ARM_MIN_PAIRED ? ` < ${exports.MASK_ARM_MIN_PAIRED} floor` : ""}). PR-as-actuator — promotion is a route-bundle PR, never silent.`);
|
|
172
|
+
if (d.worstOffenders.length > 0) {
|
|
173
|
+
lines.push("");
|
|
174
|
+
lines.push("Worst-offending fixtures (ids + quality drop, never values):");
|
|
175
|
+
for (const o of d.worstOffenders)
|
|
176
|
+
lines.push(`- \`${o.captureId}\` · −${o.qualityDrop.toFixed(3)}`);
|
|
177
|
+
}
|
|
178
|
+
return lines.join("\n");
|
|
179
|
+
}
|
package/dist/mask/index.d.ts
CHANGED
|
@@ -18,4 +18,6 @@ export { createMaskSeam, resetMaskWarningsForTest } from "./seam";
|
|
|
18
18
|
export type { MaskSeam, MaskRequestOutcome } from "./seam";
|
|
19
19
|
export { proveMaskedArm, formatMaskArmReport, proveMaskArmFromCaptures, collectStringLeaves } from "./proof";
|
|
20
20
|
export type { MaskArmProof } from "./proof";
|
|
21
|
+
export { runMaskArmBakeoff, computeMaskArmDelta, formatMaskArmReportFull, stripMaskFromRoutes, MASK_ARM_MIN_PAIRED, } from "./arm";
|
|
22
|
+
export type { MaskArmReport, MaskArmDelta, MaskArmOffender, MaskArmBakeoffRequest } from "./arm";
|
|
21
23
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/mask/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/mask/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,cAAc,SAAS,CAAC;AACxB,OAAO,EAAE,iBAAiB,EAAE,uBAAuB,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AACxG,OAAO,EAAE,WAAW,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAC;AAC5D,YAAY,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAC5C,OAAO,EAAE,cAAc,EAAE,kBAAkB,EAAE,gBAAgB,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAC/F,YAAY,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AACxC,OAAO,EACL,QAAQ,EACR,SAAS,EACT,aAAa,EACb,cAAc,EACd,sBAAsB,GACvB,MAAM,SAAS,CAAC;AACjB,YAAY,EAAE,UAAU,EAAE,gBAAgB,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACxE,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAC1D,YAA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,EAAE,mBAAmB,EAAE,MAAM,SAAS,CAAC;AAC7G,YAAY,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAC5C,OAAO,EACL,iBAAiB,EACjB,mBAAmB,EACnB,uBAAuB,EACvB,mBAAmB,EACnB,mBAAmB,GACpB,MAAM,OAAO,CAAC;AACf,YAAY,EAAE,aAAa,EAAE,YAAY,EAAE,eAAe,EAAE,qBAAqB,EAAE,MAAM,OAAO,CAAC"}
|
package/dist/mask/index.js
CHANGED
|
@@ -14,7 +14,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
exports.collectStringLeaves = exports.proveMaskArmFromCaptures = exports.formatMaskArmReport = exports.proveMaskedArm = exports.resetMaskWarningsForTest = exports.createMaskSeam = exports.rollupFindings = exports.summarizeMask = exports.createStreamRehydrator = exports.rehydrateValue = exports.rehydrateText = exports.maskInput = exports.maskText = exports.tokenTypeLabel = exports.MAX_TOKEN_LENGTH = exports.MASK_TOKEN_PATTERN = exports.createRunVault = exports.resolveFieldTargets = exports.detectSpans = exports.parseDictionary = exports.parseMaskPolicy = exports.validateMaskPolicyShape = exports.resolveMaskPolicy = void 0;
|
|
17
|
+
exports.MASK_ARM_MIN_PAIRED = exports.stripMaskFromRoutes = exports.formatMaskArmReportFull = exports.computeMaskArmDelta = exports.runMaskArmBakeoff = exports.collectStringLeaves = exports.proveMaskArmFromCaptures = exports.formatMaskArmReport = exports.proveMaskedArm = exports.resetMaskWarningsForTest = exports.createMaskSeam = exports.rollupFindings = exports.summarizeMask = exports.createStreamRehydrator = exports.rehydrateValue = exports.rehydrateText = exports.maskInput = exports.maskText = exports.tokenTypeLabel = exports.MAX_TOKEN_LENGTH = exports.MASK_TOKEN_PATTERN = exports.createRunVault = exports.resolveFieldTargets = exports.detectSpans = exports.parseDictionary = exports.parseMaskPolicy = exports.validateMaskPolicyShape = exports.resolveMaskPolicy = void 0;
|
|
18
18
|
/**
|
|
19
19
|
* CS-1 Proven Masking — module surface (WIRED 2026-08-24, CS-1 Chunk A).
|
|
20
20
|
* Wired into the SDK via the run/dispatch seam (src/run/run.ts) and the route
|
|
@@ -52,3 +52,9 @@ Object.defineProperty(exports, "proveMaskedArm", { enumerable: true, get: functi
|
|
|
52
52
|
Object.defineProperty(exports, "formatMaskArmReport", { enumerable: true, get: function () { return proof_1.formatMaskArmReport; } });
|
|
53
53
|
Object.defineProperty(exports, "proveMaskArmFromCaptures", { enumerable: true, get: function () { return proof_1.proveMaskArmFromCaptures; } });
|
|
54
54
|
Object.defineProperty(exports, "collectStringLeaves", { enumerable: true, get: function () { return proof_1.collectStringLeaves; } });
|
|
55
|
+
var arm_1 = require("./arm");
|
|
56
|
+
Object.defineProperty(exports, "runMaskArmBakeoff", { enumerable: true, get: function () { return arm_1.runMaskArmBakeoff; } });
|
|
57
|
+
Object.defineProperty(exports, "computeMaskArmDelta", { enumerable: true, get: function () { return arm_1.computeMaskArmDelta; } });
|
|
58
|
+
Object.defineProperty(exports, "formatMaskArmReportFull", { enumerable: true, get: function () { return arm_1.formatMaskArmReportFull; } });
|
|
59
|
+
Object.defineProperty(exports, "stripMaskFromRoutes", { enumerable: true, get: function () { return arm_1.stripMaskFromRoutes; } });
|
|
60
|
+
Object.defineProperty(exports, "MASK_ARM_MIN_PAIRED", { enumerable: true, get: function () { return arm_1.MASK_ARM_MIN_PAIRED; } });
|
|
@@ -1,11 +1,19 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* CS-1 — `modelrig bakeoff --mask-policy <route>` handler (spec §7). Extracted
|
|
3
|
-
* from cli.ts to keep it under the 700-LOC cap.
|
|
4
|
-
*
|
|
5
|
-
*
|
|
3
|
+
* from cli.ts to keep it under the 700-LOC cap.
|
|
4
|
+
*
|
|
5
|
+
* Chunk A: prove, via the shared detector, that masking leaves NO detected span
|
|
6
|
+
* in the masked arm (offline over captures — no dispatch). Chunk B COMPLETES the
|
|
7
|
+
* command: replay the route's captures twice against the incumbent — unmasked
|
|
8
|
+
* (control) vs masked (treatment) — and report the value-accuracy Δ + CI + the
|
|
9
|
+
* separation gate against the policy's `tolerance` block. Exit 1 ONLY when a
|
|
10
|
+
* detected span leaks (the load-bearing invariant); a blocked-by-evidence Δ is a
|
|
11
|
+
* valid report — promotion is a route-bundle PR, never a silent CLI side effect.
|
|
12
|
+
*
|
|
13
|
+
* `--leak-only` runs just the Chunk-A offline proof (no billed dispatch).
|
|
6
14
|
* Additive — it does NOT touch the RB-1 replay engine (RB-1 fence).
|
|
7
15
|
*/
|
|
8
16
|
import type { RigConfig } from "../config";
|
|
9
17
|
import type { Flags } from "../cli";
|
|
10
|
-
export declare function runMaskPolicyProofCli(config: RigConfig, flags: Flags, route: string): number
|
|
18
|
+
export declare function runMaskPolicyProofCli(config: RigConfig, flags: Flags, route: string): Promise<number>;
|
|
11
19
|
//# sourceMappingURL=mask-policy-cli.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mask-policy-cli.d.ts","sourceRoot":"","sources":["../../src/mask/mask-policy-cli.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"mask-policy-cli.d.ts","sourceRoot":"","sources":["../../src/mask/mask-policy-cli.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAC3C,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,QAAQ,CAAC;AAQpC,wBAAsB,qBAAqB,CACzC,MAAM,EAAE,SAAS,EACjB,KAAK,EAAE,KAAK,EACZ,KAAK,EAAE,MAAM,GACZ,OAAO,CAAC,MAAM,CAAC,CAkCjB"}
|
|
@@ -1,18 +1,28 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
/**
|
|
3
3
|
* CS-1 — `modelrig bakeoff --mask-policy <route>` handler (spec §7). Extracted
|
|
4
|
-
* from cli.ts to keep it under the 700-LOC cap.
|
|
5
|
-
*
|
|
6
|
-
*
|
|
4
|
+
* from cli.ts to keep it under the 700-LOC cap.
|
|
5
|
+
*
|
|
6
|
+
* Chunk A: prove, via the shared detector, that masking leaves NO detected span
|
|
7
|
+
* in the masked arm (offline over captures — no dispatch). Chunk B COMPLETES the
|
|
8
|
+
* command: replay the route's captures twice against the incumbent — unmasked
|
|
9
|
+
* (control) vs masked (treatment) — and report the value-accuracy Δ + CI + the
|
|
10
|
+
* separation gate against the policy's `tolerance` block. Exit 1 ONLY when a
|
|
11
|
+
* detected span leaks (the load-bearing invariant); a blocked-by-evidence Δ is a
|
|
12
|
+
* valid report — promotion is a route-bundle PR, never a silent CLI side effect.
|
|
13
|
+
*
|
|
14
|
+
* `--leak-only` runs just the Chunk-A offline proof (no billed dispatch).
|
|
7
15
|
* Additive — it does NOT touch the RB-1 replay engine (RB-1 fence).
|
|
8
16
|
*/
|
|
9
17
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
18
|
exports.runMaskPolicyProofCli = runMaskPolicyProofCli;
|
|
19
|
+
const index_1 = require("../index");
|
|
11
20
|
const loader_1 = require("../routes/loader");
|
|
12
21
|
const rawonly_1 = require("../run/rawonly");
|
|
13
22
|
const capture_1 = require("../telemetry/capture");
|
|
14
23
|
const proof_1 = require("./proof");
|
|
15
|
-
|
|
24
|
+
const arm_1 = require("./arm");
|
|
25
|
+
async function runMaskPolicyProofCli(config, flags, route) {
|
|
16
26
|
const bundle = (0, loader_1.loadRoutes)((0, rawonly_1.requireRoutesDir)(config, "modelrig bakeoff")).get(route);
|
|
17
27
|
if (bundle.mask === undefined) {
|
|
18
28
|
throw new Error(`route "${route}" has no active mask: policy (mode: mask) — add one before proving the masked arm`);
|
|
@@ -21,13 +31,28 @@ function runMaskPolicyProofCli(config, flags, route) {
|
|
|
21
31
|
const n = nRaw !== undefined ? Number(nRaw) : 25;
|
|
22
32
|
if (!Number.isInteger(n) || n < 1)
|
|
23
33
|
throw new Error("--replay-last must be a positive integer");
|
|
24
|
-
|
|
34
|
+
// --leak-only: the offline invariant proof, NO billed dispatch (Chunk-A behaviour).
|
|
35
|
+
if (flags.bare.has("leak-only")) {
|
|
36
|
+
const captures = (0, capture_1.openCaptureStore)(config.telemetryDbPath);
|
|
37
|
+
try {
|
|
38
|
+
const proof = (0, proof_1.proveMaskArmFromCaptures)(captures.readLast(route, n), bundle.mask);
|
|
39
|
+
console.log((0, proof_1.formatMaskArmReport)(proof));
|
|
40
|
+
return proof.proven ? 0 : 1;
|
|
41
|
+
}
|
|
42
|
+
finally {
|
|
43
|
+
captures.close();
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
// Full masked-arm bake-off (spec §7): leak proof + value-accuracy Δ over the
|
|
47
|
+
// incumbent (real, billed replays). Live runs over the demo-rig / InferWealth
|
|
48
|
+
// corpus are deferred to a provider-keyed session (verification doc).
|
|
49
|
+
const rig = (0, index_1.createRig)(config);
|
|
25
50
|
try {
|
|
26
|
-
const
|
|
27
|
-
console.log((0,
|
|
28
|
-
return proof.proven ? 0 : 1;
|
|
51
|
+
const report = await rig.maskArm(route, { replayLast: n });
|
|
52
|
+
console.log((0, arm_1.formatMaskArmReportFull)(report));
|
|
53
|
+
return report.proof.proven ? 0 : 1;
|
|
29
54
|
}
|
|
30
55
|
finally {
|
|
31
|
-
|
|
56
|
+
await rig.close();
|
|
32
57
|
}
|
|
33
58
|
}
|
package/dist/query/grammar.d.ts
CHANGED
|
@@ -33,8 +33,8 @@
|
|
|
33
33
|
import type { Classification, ColumnSource } from "./columns";
|
|
34
34
|
export { describeAnalyticsSchema, evaluateAnalyticsQuery, planAnalyticsRead, ANALYTICS_SCAN_CAP, selectableColumnsAreMetaSafe, } from "./analytics";
|
|
35
35
|
export type { AnalyticsSchema, AnalyticsSchemaField, AnalyticsResult, AnalyticsReadPlan, AnalyticsRow } from "./analytics";
|
|
36
|
-
export { SAVED_QUERIES, savedQueryById, sinceIsoFor } from "./saved";
|
|
37
|
-
export type { SavedQuery } from "./saved";
|
|
36
|
+
export { SAVED_QUERIES, savedQueryById, sinceIsoFor, LAUNCH_COHORT_QUERIES, cohortQueryById } from "./saved";
|
|
37
|
+
export type { SavedQuery, CohortQuery } from "./saved";
|
|
38
38
|
export { DIMENSION_COLUMNS, METRIC_COLUMNS, RESERVED_DIMENSION_NAMES } from "./columns";
|
|
39
39
|
export type { ColumnDef, Classification, ColumnSource } from "./columns";
|
|
40
40
|
export declare class QueryGrammarError extends Error {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"grammar.d.ts","sourceRoot":"","sources":["../../src/query/grammar.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAa,YAAY,EAAE,MAAM,WAAW,CAAC;AAKzE,OAAO,EACL,uBAAuB,EACvB,sBAAsB,EACtB,iBAAiB,EACjB,kBAAkB,EAClB,4BAA4B,GAC7B,MAAM,aAAa,CAAC;AACrB,YAAY,EAAE,eAAe,EAAE,oBAAoB,EAAE,eAAe,EAAE,iBAAiB,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAC3H,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"grammar.d.ts","sourceRoot":"","sources":["../../src/query/grammar.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAa,YAAY,EAAE,MAAM,WAAW,CAAC;AAKzE,OAAO,EACL,uBAAuB,EACvB,sBAAsB,EACtB,iBAAiB,EACjB,kBAAkB,EAClB,4BAA4B,GAC7B,MAAM,aAAa,CAAC;AACrB,YAAY,EAAE,eAAe,EAAE,oBAAoB,EAAE,eA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a,GACrB;IAAE,QAAQ,CAAC,IAAI,EAAE,QAAQ,CAAC;IAAC,QAAQ,CAAC,MAAM,EAAE,YAAY,CAAA;CAAE,GAC1D;IAAE,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC;IAAC,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAA;CAAE,GACnD;IAAE,QAAQ,CAAC,IAAI,EAAE,WAAW,CAAC;IAAC,QAAQ,CAAC,EAAE,EAAE,KAAK,CAAC;IAAC,QAAQ,CAAC,MAAM,EAAE,YAAY,CAAC;IAAC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAAC;AAE9G,MAAM,WAAW,YAAY;IAC3B,QAAQ,CAAC,MAAM,EAAE,YAAY,CAAC;IAC9B,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAAC;CACjC;AAED,MAAM,WAAW,QAAQ;IACvB,QAAQ,CAAC,MAAM,EAAE,SAAS,aAAa,EAAE,CAAC;IAC1C,QAAQ,CAAC,KAAK,EAAE,SAAS,YAAY,EAAE,CAAC;IACxC,QAAQ,CAAC,OAAO,EAAE,SAAS,YAAY,EAAE,CAAC;IAC1C,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;CACxB;AA8ID;;;;;GAKG;AACH,wBAAgB,UAAU,CAAC,KAAK,EAAE,MAAM,GAAG,QAAQ,CAgIlD;AAuBD;;;;GAIG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,UAAU,GAAG,aAAa,CAqC5E"}
|
package/dist/query/grammar.js
CHANGED
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
* enum/number/boolean/hash/identifier/timestamp (columns.ts), never content.
|
|
33
33
|
*/
|
|
34
34
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
35
|
-
exports.QueryGrammarError = exports.RESERVED_DIMENSION_NAMES = exports.METRIC_COLUMNS = exports.DIMENSION_COLUMNS = exports.sinceIsoFor = exports.savedQueryById = exports.SAVED_QUERIES = exports.selectableColumnsAreMetaSafe = exports.ANALYTICS_SCAN_CAP = exports.planAnalyticsRead = exports.evaluateAnalyticsQuery = exports.describeAnalyticsSchema = void 0;
|
|
35
|
+
exports.QueryGrammarError = exports.RESERVED_DIMENSION_NAMES = exports.METRIC_COLUMNS = exports.DIMENSION_COLUMNS = exports.cohortQueryById = exports.LAUNCH_COHORT_QUERIES = exports.sinceIsoFor = exports.savedQueryById = exports.SAVED_QUERIES = exports.selectableColumnsAreMetaSafe = exports.ANALYTICS_SCAN_CAP = exports.planAnalyticsRead = exports.evaluateAnalyticsQuery = exports.describeAnalyticsSchema = void 0;
|
|
36
36
|
exports.parseQuery = parseQuery;
|
|
37
37
|
exports.compileQuery = compileQuery;
|
|
38
38
|
const columns_1 = require("./columns");
|
|
@@ -48,6 +48,8 @@ var saved_1 = require("./saved");
|
|
|
48
48
|
Object.defineProperty(exports, "SAVED_QUERIES", { enumerable: true, get: function () { return saved_1.SAVED_QUERIES; } });
|
|
49
49
|
Object.defineProperty(exports, "savedQueryById", { enumerable: true, get: function () { return saved_1.savedQueryById; } });
|
|
50
50
|
Object.defineProperty(exports, "sinceIsoFor", { enumerable: true, get: function () { return saved_1.sinceIsoFor; } });
|
|
51
|
+
Object.defineProperty(exports, "LAUNCH_COHORT_QUERIES", { enumerable: true, get: function () { return saved_1.LAUNCH_COHORT_QUERIES; } });
|
|
52
|
+
Object.defineProperty(exports, "cohortQueryById", { enumerable: true, get: function () { return saved_1.cohortQueryById; } });
|
|
51
53
|
var columns_2 = require("./columns");
|
|
52
54
|
Object.defineProperty(exports, "DIMENSION_COLUMNS", { enumerable: true, get: function () { return columns_2.DIMENSION_COLUMNS; } });
|
|
53
55
|
Object.defineProperty(exports, "METRIC_COLUMNS", { enumerable: true, get: function () { return columns_2.METRIC_COLUMNS; } });
|
package/dist/query/saved.d.ts
CHANGED
|
@@ -23,4 +23,17 @@ export declare const SAVED_QUERIES: readonly SavedQuery[];
|
|
|
23
23
|
export declare function savedQueryById(id: string): SavedQuery | null;
|
|
24
24
|
/** The ISO lower bound for a trailing window of `windowDays` ending at `now`. */
|
|
25
25
|
export declare function sinceIsoFor(windowDays: number, now: Date): string;
|
|
26
|
+
export interface CohortQuery {
|
|
27
|
+
readonly id: string;
|
|
28
|
+
readonly title: string;
|
|
29
|
+
readonly description: string;
|
|
30
|
+
/** The trailing window this measure asks over, in days. */
|
|
31
|
+
readonly windowDays: number;
|
|
32
|
+
/** Reference SQL over the control plane, `ts`/`created_at` bound filled in.
|
|
33
|
+
* Operator-run (service role); NOT the metadata-safe `/query` grammar. */
|
|
34
|
+
sql(sinceIso: string): string;
|
|
35
|
+
}
|
|
36
|
+
export declare const LAUNCH_COHORT_QUERIES: readonly CohortQuery[];
|
|
37
|
+
/** Look up a launch cohort question by id, or null. */
|
|
38
|
+
export declare function cohortQueryById(id: string): CohortQuery | null;
|
|
26
39
|
//# sourceMappingURL=saved.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"saved.d.ts","sourceRoot":"","sources":["../../src/query/saved.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,MAAM,WAAW,UAAU;IACzB,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,2DAA2D;IAC3D,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,8DAA8D;IAC9D,OAAO,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAAC;CACnC;AAED,eAAO,MAAM,aAAa,EAAE,SAAS,UAAU,EA8B9C,CAAC;AAEF,+CAA+C;AAC/C,wBAAgB,cAAc,CAAC,EAAE,EAAE,MAAM,GAAG,UAAU,GAAG,IAAI,CAE5D;AAED,iFAAiF;AACjF,wBAAgB,WAAW,CAAC,U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