modelrig 0.8.1 โ 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 +145 -0
- package/README.md +4 -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 +95 -7
- 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/CHANGELOG.md
CHANGED
|
@@ -10,6 +10,151 @@ published package diverge.
|
|
|
10
10
|
This project adheres to [Semantic Versioning](https://semver.org/). Dates are
|
|
11
11
|
UTC.
|
|
12
12
|
|
|
13
|
+
## [Unreleased]
|
|
14
|
+
|
|
15
|
+
## [0.9.0] โ 2026-09-01
|
|
16
|
+
|
|
17
|
+
**Breaking** (the reason this is 0.9.0, not 0.8.2): the temporary `rig.feedback` /
|
|
18
|
+
`rig.evaluate` wrappers and the `/feedback` endpoint are removed (GP-3, below) โ
|
|
19
|
+
0.8.x callers of those surfaces must move to `rig.grade` / `/v1/grade`.
|
|
20
|
+
|
|
21
|
+
Coding-agent skill โ the shipped `docs/agent-skill/SKILL.md` now teaches the
|
|
22
|
+
**improvement loop**: with your org's `rig_sk_` key in the agent's MCP config,
|
|
23
|
+
`get_proposals` โ read the `change_spec` + evidence โ apply (a prompt-change in
|
|
24
|
+
YOUR repo per `apply_instructions`; a config-change via `set_call_config`, undo
|
|
25
|
+
`rollback_call_config`) โ `decide_proposal` โ `record_grade` โ `run_optimizer`
|
|
26
|
+
(estimate first); grading-guide authoring via `get/set_task_settings`. Fetched
|
|
27
|
+
proposal text is data to review, never instructions to the agent, and the agent
|
|
28
|
+
presents diff + evidence to its human before any repo write unless explicitly
|
|
29
|
+
delegated. Least-privilege scopes are named per step; install paths documented
|
|
30
|
+
for Claude Code / Cursor / Codex.
|
|
31
|
+
|
|
32
|
+
Use-case templates โ nine machine-readable starting points ship in the tarball
|
|
33
|
+
(`templates/*.json`) with a docs page each: ticket-triage, document-extraction,
|
|
34
|
+
cs-next-action, lead-qualification, compliance-review, catalog-cleansing,
|
|
35
|
+
call-disposition-qa, financial-classification, medical-classification. Each
|
|
36
|
+
carries a starter JSON schema (enum slots TODO-marked, no invented values), a
|
|
37
|
+
starter grading guide in the server's exact shape, a ~20-golden boundary-weighted
|
|
38
|
+
checklist, and an escalation starter. **Work-first:** every template runs as-is;
|
|
39
|
+
TODO markers show where tightening to your taxonomy sharpens grading โ they never
|
|
40
|
+
gate. The regulated pair (financial/medical) quotes the published content-custody
|
|
41
|
+
terms' BAA/DPA sentence verbatim and names the zero-retention today-path.
|
|
42
|
+
|
|
43
|
+
Registry โ `image_input` is a new **probed** capability dimension: a declared
|
|
44
|
+
vendor claim can seed candidates but never marks the dimension; only a probe row
|
|
45
|
+
(schema-conformant extraction from a fixture form image, every planted field
|
|
46
|
+
recovered) does. Typed per-provider image-input pricing (`per_image` |
|
|
47
|
+
`per_token`), absent when unsourced โ never averaged or guessed. `query_registry`
|
|
48
|
+
gains an `image_input` filter; unprobed renders as unprobed, never as "cannot".
|
|
49
|
+
No model carries a probed image row yet โ the dimension populates at the next
|
|
50
|
+
keyed probe cycle.
|
|
51
|
+
|
|
52
|
+
Watch โ the evaluate step can raise an **optimizer improvement trigger**
|
|
53
|
+
(proposal-only, explicit-trigger; nothing actuates โ F5 unchanged).
|
|
54
|
+
|
|
55
|
+
Fixed โ `rig.close()` now awaits the content-upload flush, so short-lived
|
|
56
|
+
processes no longer exit before managed-custody bytes finish uploading (E2E-1).
|
|
57
|
+
|
|
58
|
+
Capture posture (P15 CP-3) โ the env FEATURE GATES for capture are **removed**.
|
|
59
|
+
`MODELRIG_ARTIFACTS` (as an opt-out) and `MODELRIG_ARTIFACTS_CONTENT` no longer
|
|
60
|
+
gate capture: one API key turns capture on, and the **account posture**
|
|
61
|
+
(`artifact_posture`: `off` | `metadata` | `managed`) โ set in the console or via
|
|
62
|
+
the `set_org_settings` MCP tool โ is the single opt-out, resolved by the SDK from
|
|
63
|
+
the control plane at boot (the same channel that pulls per-task settings) and
|
|
64
|
+
enforced authoritatively server-side. An unreachable control plane fails **OPEN**
|
|
65
|
+
to the namespace default (capture continues; the server ingest gate is the
|
|
66
|
+
backstop). The boot banner and `modelrig status` now name the posture and that its
|
|
67
|
+
source is your account settings. `MODELRIG_ARTIFACTS=1` remains a **dev-only**
|
|
68
|
+
local-rig force-on (never a customer control); `MODELRIG_CONTENT_UPLOAD_URL`,
|
|
69
|
+
`MODELRIG_CONTENT_API_KEY`, and `MODELRIG_CONTENT_MAX_BYTES` are unchanged.
|
|
70
|
+
**`MODELRIG_ARTIFACTS_SCRUB` is removed** (R3 follow-up, CP-3b): the scrub mode is
|
|
71
|
+
now the per-task/account setting resolved from the control plane (the same channel
|
|
72
|
+
as capture and per-task settings), so the artifact content-upload path reads scrub
|
|
73
|
+
from task/account settings rather than an env var โ one control surface, no
|
|
74
|
+
duplicate client gate (P15). A rig with no control plane (local-only / direct) uses
|
|
75
|
+
the built-in default (`detect` when content custody is configured).
|
|
76
|
+
|
|
77
|
+
Grade primitive โ GP-1 (ADDITIVE foundation). Introduces the unified **`grade`**
|
|
78
|
+
judgment primitive alongside the existing feedback/evaluation/verdict mechanisms,
|
|
79
|
+
with nothing removed and every existing reader unchanged. `rig.grade(subject,
|
|
80
|
+
opts)` writes one 0โ1 **score** (the pass/fail verdict is DERIVED at read time,
|
|
81
|
+
never stored) on an inference / run / artifact subject; `rig.feedback`,
|
|
82
|
+
`artifact.evaluate`, and `run.evaluate` are reimplemented as thin wrappers over
|
|
83
|
+
the grade path (same signatures, same observable rows). A local SQLite `grades`
|
|
84
|
+
table (store version v14) backfills from existing feedback/evaluation rows; the
|
|
85
|
+
exporter ships a `grades` wire stream; ingest accepts `WireGrade` (older SDKs'
|
|
86
|
+
`WireFeedback`/`WireArtifactEvaluation` are still accepted and mapped to grades);
|
|
87
|
+
`computeCoverage` counts grades; and native run-outcome/run-judge verdicts are
|
|
88
|
+
written as grades. A per-route `grade.pass_threshold` (default 0.5) is declared on
|
|
89
|
+
the route bundle + YAML, plumbed but unread until GP-2.
|
|
90
|
+
|
|
91
|
+
QA hardening: the `artifact_evaluations` compat-view uuid casts are regex-guarded
|
|
92
|
+
(a non-UUID episode-key run subject reads NULL, never a read-time 500), and a
|
|
93
|
+
GP-1-only nullable `legacy_score` compat column preserves the old NULLABLE score
|
|
94
|
+
semantics (a verdict/thumbs-only judgment reads NULL, not 1.0) so score-averaging
|
|
95
|
+
readers are unchanged; the "thumbs-up as numeric 1.0" question is deferred to GP-2.
|
|
96
|
+
|
|
97
|
+
Migration **00070** (`grades` table + row migration + `feedback` /
|
|
98
|
+
`artifact_evaluations` compatibility VIEWS) is WRITTEN but **not applied** โ Matt
|
|
99
|
+
applies it, and the server build's deploy is gated on it (the writers/readers
|
|
100
|
+
target `grades` / its compat views only after 00070 lands). Unreleased โ
|
|
101
|
+
workspace only; ships in the grade-primitive release once GP-1/2/3 land.
|
|
102
|
+
|
|
103
|
+
Grade primitive โ GP-2 (CUTOVER). Every reader now addresses `grades` directly:
|
|
104
|
+
the server console/AI-read DTOs, the console UI (one `GradeBadge` + `GradesPanel`
|
|
105
|
+
replacing the Verdicts/Feedback/Evaluations panels; a `gradeCount` "grades" column
|
|
106
|
+
on Route readiness; the Action queue reads grades; `GRADE_SNIPPET` = `rig.grade`;
|
|
107
|
+
the "Attach a grade" setup step), the `/v1/read/*` surface (org-scoping preserved โ
|
|
108
|
+
`grades` is org-scoped everywhere `feedback` was), and the oracle MCP read
|
|
109
|
+
resources. The GP-1 compatibility VIEWS (`feedback`, `artifact_evaluations`) and
|
|
110
|
+
the three GP-1-only compat columns (`legacy_score`, `origin`, `label`) are dropped
|
|
111
|
+
by migration **00072** (WRITTEN, not applied โ Matt applies it as part of the GP-2
|
|
112
|
+
deploy). The SDK `GradeRow`/`WireGrade` drop those three fields; a legacy display
|
|
113
|
+
`label` folds into `scale_label` (the one display-label column); the local SQLite
|
|
114
|
+
`grades` table drops the columns via store version **v15**. **B1 semantic (model
|
|
115
|
+
change):** a reader reads the NOT-NULL primitive `score` directly, so a human
|
|
116
|
+
thumbs-up now counts as a numeric **1.0** (thumbs-down 0.0) in score averages โ
|
|
117
|
+
`aggregateGrades` (was `aggregateFeedback`) averages `score` across ALL grades,
|
|
118
|
+
retiring the old "meanScore null when no numeric scores" rule (there is no
|
|
119
|
+
scoreless judgment in the grade model). Rubric vs binary grades are distinguished
|
|
120
|
+
by the presence of `scaleMax`/`scaleLabel`, not by nullability. Coverage Rung 1
|
|
121
|
+
now counts every route-resolvable grade (R6), not only wrapper-written thumbs. The
|
|
122
|
+
`rig.feedback`/`artifact.evaluate`/`run.evaluate` wrappers and the `POST /feedback`
|
|
123
|
+
endpoint stay (removed in GP-3). Docs/glossary/outward copy are unchanged (GP-3).
|
|
124
|
+
The Monitor cron's deterministic-eval read (`watch/monitor.ts`) now reads `grades`
|
|
125
|
+
directly (`subject_kind=artifact`, `kind=deterministic`, `passed = score โฅ 0.5`)
|
|
126
|
+
instead of the dropped `artifact_evaluations` view, with a URL-pinned regression
|
|
127
|
+
test so the "green in CI, 404 after 00072" class is caught going forward.
|
|
128
|
+
|
|
129
|
+
Grade primitive โ GP-3 (cleanup). Removed the temporary `rig.feedback` /
|
|
130
|
+
`artifact.evaluate` / `run.evaluate` compat wrappers and the `WireFeedback` /
|
|
131
|
+
`WireArtifactEvaluation` wire shapes; `rig.grade` is the sole judgment write API.
|
|
132
|
+
The SDK drops the `FeedbackTarget`/`FeedbackOpts`/`FeedbackRow` and
|
|
133
|
+
`ArtifactEvaluationRow`/`RunEvaluateOptions`/`ArtifactEvaluateOptions` types, the
|
|
134
|
+
`buildFeedbackRow`/`feedbackOptsToGrade`/`evaluateOptsToGrade`/`gradeToFeedbackRow`
|
|
135
|
+
adapters, the `foreignOrgFeedback`/`feedbackToGradeRow`/`evaluationToGradeRow`
|
|
136
|
+
mappers, and the local store's `recordFeedback`/`readFeedbackAfter`/`listFeedback`
|
|
137
|
+
+ `recordArtifactEvaluation`/`readEvaluationsAfter` methods; the exporter no longer
|
|
138
|
+
drains the `:feedback` / `:evals` streams. The API-key `feedback` scope becomes
|
|
139
|
+
`grade` (migration 00073; the server already requires `grade`). Legacy local-SQLite
|
|
140
|
+
backfill substrate is retained (the `feedback` / `artifact_evaluations` tables +
|
|
141
|
+
`grades-sql` backfills, read once into `grades`).
|
|
142
|
+
|
|
143
|
+
The HTTP judgment endpoint is renamed `POST /feedback` โ **`POST /grade`** (and
|
|
144
|
+
`POST /v1/feedback` โ `POST /v1/grade`); its body is now the grade shape
|
|
145
|
+
`{inferenceId | episode, score (0โ1), scale?, comment?, kind?, source?}` (was
|
|
146
|
+
`{โฆ, verdict: up|down, note?}`). The oracle MCP tool `record_feedback` becomes
|
|
147
|
+
**`record_grade`** (score in place of verdict). **Docs/outward copy (HELD for
|
|
148
|
+
Matt's review):** `feedback-protocol.md` + `run-verdicts.md` are merged into a
|
|
149
|
+
single **`grade-protocol.md`** (the doc-site `PAGES` + both `llms.txt` copies +
|
|
150
|
+
every cross-doc link repointed; the old `/โฆโ.html` slugs are retired, no
|
|
151
|
+
redirect โ hard rename, no live users); the console glossary (`glossary.ts` โ
|
|
152
|
+
`/concepts`) leads with **grade** (`feedback`/`verdict`/`evaluation` folded, with
|
|
153
|
+
`is`/`isNot`/`interacts` per the OB-2 clarity standard and `feedback`/`evaluation`
|
|
154
|
+
kept as aliases); the `MIGRATION_PROMPT` / setup / get-started / www copy teach a
|
|
155
|
+
grade ("your judgment โ from your code, a human, or an AI"). Supersedes OB-1 #365
|
|
156
|
+
(its bake-off-lane content carried forward).
|
|
157
|
+
|
|
13
158
|
## [0.8.1] โ 2026-08-24
|
|
14
159
|
|
|
15
160
|
Docs โ deploy guidance for the native `better-sqlite3` dependency. The SDK loads
|
package/README.md
CHANGED
|
@@ -299,8 +299,10 @@ rig.close();
|
|
|
299
299
|
default once a control plane is configured** โ set `MODELRIG_API_KEY=rig_sk_โฆ`
|
|
300
300
|
(or the self-host Supabase pair) and runs record automatically, metadata and
|
|
301
301
|
hashes only. A **pure local-only rig** (no sink to ship to) stays off; force it
|
|
302
|
-
on there with `MODELRIG_ARTIFACTS=1
|
|
303
|
-
`
|
|
302
|
+
on there with `MODELRIG_ARTIFACTS=1`. To **opt out of capture**, set posture
|
|
303
|
+
`off` in your account settings (the console or the `set_org_settings` MCP tool) โ
|
|
304
|
+
the account posture is the customer control, not a deployment env var. With the
|
|
305
|
+
namespace off (a local-only rig) it is inert โ `run.start` is a
|
|
304
306
|
no-op, `artifact.save` returns null, zero rows are written, and your pipeline
|
|
305
307
|
behaves byte-for-byte as before. `modelrig status` prints the current posture.
|
|
306
308
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Artifact namespace โ Expansion E2 chunk B (spec ยง2.2, ยง9).
|
|
3
3
|
*
|
|
4
|
-
* `save/load/link
|
|
4
|
+
* `save/load/link` over a durable work product's METADATA. The
|
|
5
5
|
* serialized value is hashed (sha256, node:crypto โ no new dep) and the bytes
|
|
6
6
|
* are DISCARDED; nothing but the metadata row is persisted (the 00030
|
|
7
7
|
* counter-annotation). Lineage v0: artifacts saved within a run get
|
|
@@ -16,6 +16,7 @@
|
|
|
16
16
|
import type { ArtifactStore } from "../telemetry/artifact-store";
|
|
17
17
|
import type { EvalCaseOrigin } from "../types/telemetry";
|
|
18
18
|
import { type ScrubMode } from "./scrub";
|
|
19
|
+
import { type TaskSettingsResolver } from "../settings/task-settings";
|
|
19
20
|
import type { ContentUploadInput, ContentUploadOutcome } from "./content-uploader";
|
|
20
21
|
/** The upload transport `save` fires content through โ injected so the SDK's
|
|
21
22
|
* networked implementation and the tests share one seam. */
|
|
@@ -23,7 +24,15 @@ export type ArtifactContentUploader = (input: ContentUploadInput) => Promise<Con
|
|
|
23
24
|
/** Per-rig content-custody wiring passed to the artifact api (E2-C). Absent =
|
|
24
25
|
* metadata + hash only, today's behaviour. */
|
|
25
26
|
export interface ArtifactContentDeps {
|
|
26
|
-
|
|
27
|
+
/** Per-task scrub resolver (settings-plane ยง1.5; P15 CP-3b). The control-plane
|
|
28
|
+
* task/account setting WINS โ scrub is an account setting, not a client env var
|
|
29
|
+
* (`MODELRIG_ARTIFACTS_SCRUB` was deleted). null for local-only / direct rigs
|
|
30
|
+
* that have no control plane, and for a run with no task identity โ then
|
|
31
|
+
* `defaultScrub` governs. */
|
|
32
|
+
readonly resolver: TaskSettingsResolver | null;
|
|
33
|
+
/** Fallback scrub mode when no resolver answers for the task. The content-on
|
|
34
|
+
* default (`detect`). */
|
|
35
|
+
readonly defaultScrub: ScrubMode;
|
|
27
36
|
readonly upload: ArtifactContentUploader;
|
|
28
37
|
}
|
|
29
38
|
export interface ArtifactHandle {
|
|
@@ -55,14 +64,6 @@ export interface ArtifactSaveOptions {
|
|
|
55
64
|
readonly supersedes?: ArtifactHandle;
|
|
56
65
|
readonly expiresAt?: string;
|
|
57
66
|
}
|
|
58
|
-
export interface ArtifactEvaluateOptions {
|
|
59
|
-
readonly evaluator: string;
|
|
60
|
-
readonly kind: "deterministic" | "model-judge" | "human";
|
|
61
|
-
readonly score?: number;
|
|
62
|
-
readonly passed?: boolean;
|
|
63
|
-
readonly label?: string;
|
|
64
|
-
readonly explanation?: string;
|
|
65
|
-
}
|
|
66
67
|
export interface ArtifactPromoteOptions {
|
|
67
68
|
readonly note?: string;
|
|
68
69
|
/** The route/task this case belongs to. Falls back to the task the source
|
|
@@ -84,8 +85,6 @@ export interface ArtifactApi {
|
|
|
84
85
|
load(ref: ArtifactHandle | string): void;
|
|
85
86
|
/** Explicit lineage edge the runtime cannot infer. */
|
|
86
87
|
link(from: ArtifactHandle | string, to: ArtifactHandle | string, kind: "consumed" | "derived_from"): void;
|
|
87
|
-
/** Record an evaluation against an artifact. */
|
|
88
|
-
evaluate(ref: ArtifactHandle | string, opts: ArtifactEvaluateOptions): void;
|
|
89
88
|
/** Promote an artifact into the org's durable eval suite (E4 chunk A) โ a
|
|
90
89
|
* regression case replayable via `bakeoff --from-eval-cases`. `corrected` set
|
|
91
90
|
* โ a golden-corrected pair; absent โ a failure-case. The `task` binds the
|
|
@@ -94,7 +93,7 @@ export interface ArtifactApi {
|
|
|
94
93
|
* Returns the new case id on success. */
|
|
95
94
|
promoteToEval(ref: ArtifactHandle | string, opts?: ArtifactPromoteOptions): string | null;
|
|
96
95
|
/** Run `fn` inside a single store transaction and return its value (H8), so a
|
|
97
|
-
* step's several save/link
|
|
96
|
+
* step's several save/link writes commit with ONE fsync. On a
|
|
98
97
|
* disabled/inert namespace `fn` runs directly (no store, no transaction). */
|
|
99
98
|
batch<T>(fn: () => T): T;
|
|
100
99
|
/** Await every in-flight content upload (E2-C). Content upload is fire-and-
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"artifact.d.ts","sourceRoot":"","sources":["../../src/artifacts/artifact.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAGH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AACjE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAGzD,OAAO,EAAgC,KAAK,SAAS,EAAE,MAAM,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AC;IACzB;;kFAE8E;IAC9E,YAAY,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IAC9B;;;;;;0DAMsD;IACtD,mBAAmB,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IACrC;8EAC0E;IAC1E,QAAQ,IAAI;QACV,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;QACvB,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC;QAC/B,QAAQ,CAAC,oBAAoB,EAAE,MAAM,CAAC;QACtC,8CAA8C;QAC9C,QAAQ,CAAC,eAAe,EAAE,MAAM,CAAC;QACjC,6EAA6E;QAC7E,QAAQ,CAAC,eAAe,EAAE,MAAM,CAAC;QACjC,yDAAyD;QACzD,QAAQ,CAAC,cAAc,EAAE,MAAM,CAAC;QAChC;;0EAEkE;QAClE,QAAQ,CAAC,cAAc,EAAE,MAAM,CAAC;QAChC,oEAAoE;QACpE,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC;KAChC,CAAC;CACH;AA0CD,wBAAgB,iBAAiB,CAAC,IAAI,EAAE;IACtC,QAAQ,CAAC,KAAK,EAAE,aAAa,CAAC;IAC9B,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;IAC1B,oEAAoE;IACpE,QAAQ,CAAC,OAAO,CAAC,EAAE,mBAAmB,CAAC;CACxC,GAAG,WAAW,CA4Ud"}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
/**
|
|
3
3
|
* Artifact namespace โ Expansion E2 chunk B (spec ยง2.2, ยง9).
|
|
4
4
|
*
|
|
5
|
-
* `save/load/link
|
|
5
|
+
* `save/load/link` over a durable work product's METADATA. The
|
|
6
6
|
* serialized value is hashed (sha256, node:crypto โ no new dep) and the bytes
|
|
7
7
|
* are DISCARDED; nothing but the metadata row is persisted (the 00030
|
|
8
8
|
* counter-annotation). Lineage v0: artifacts saved within a run get
|
|
@@ -22,6 +22,16 @@ const run_context_1 = require("./run-context");
|
|
|
22
22
|
const scrub_1 = require("./scrub");
|
|
23
23
|
const classification_1 = require("./classification");
|
|
24
24
|
const task_settings_1 = require("../settings/task-settings");
|
|
25
|
+
/** The configured scrub mode for one artifact save (BEFORE the S8-c PII/PHI
|
|
26
|
+
* floor). Resolved EXACTLY as capture-write.ts / samples.ts do: a configured
|
|
27
|
+
* control plane WINS (`resolver.get(task).scrub`), else the rig's default. A
|
|
28
|
+
* task with no identity to key on falls back to the default (no row to resolve).
|
|
29
|
+
* Pure and synchronous โ the resolver read is cache-only. */
|
|
30
|
+
function resolveContentScrubMode(content, task) {
|
|
31
|
+
return content.resolver !== null && task !== undefined
|
|
32
|
+
? content.resolver.get(task).scrub
|
|
33
|
+
: content.defaultScrub;
|
|
34
|
+
}
|
|
25
35
|
/** Map an artifact `type` to a content-type for the object store. */
|
|
26
36
|
function contentTypeFor(type) {
|
|
27
37
|
const t = type.toLowerCase();
|
|
@@ -48,7 +58,6 @@ function inertApi() {
|
|
|
48
58
|
save: () => null,
|
|
49
59
|
load: () => { },
|
|
50
60
|
link: () => { },
|
|
51
|
-
evaluate: () => { },
|
|
52
61
|
promoteToEval: () => null,
|
|
53
62
|
batch: (fn) => fn(),
|
|
54
63
|
flushContent: () => Promise.resolve(),
|
|
@@ -192,11 +201,15 @@ function createArtifactApi(deps) {
|
|
|
192
201
|
const custodyApplies = content !== undefined && opts.contentRef === undefined;
|
|
193
202
|
// Scrub is computed HERE (before the row is written) so its counts-only
|
|
194
203
|
// summary can ride the immutable artifact row (00039). Only when custody
|
|
195
|
-
// applies; null otherwise (custody off โ nothing was scanned).
|
|
204
|
+
// applies; null otherwise (custody off โ nothing was scanned). The
|
|
205
|
+
// configured mode comes from the per-task/account control-plane setting
|
|
206
|
+
// (P15 CP-3b โ resolver wins; `content.defaultScrub` fallback local/direct).
|
|
196
207
|
// S8-c: a `pii`/`phi` artifact forces the scrub mode to a floor of
|
|
197
208
|
// `redact`, so PII/PHI content is never uploaded verbatim even when the
|
|
198
209
|
// task's configured mode is `off`/`detect`. A stronger `block` stays.
|
|
199
|
-
const effScrub = content !== undefined
|
|
210
|
+
const effScrub = content !== undefined
|
|
211
|
+
? (0, task_settings_1.effectiveScrubMode)(resolveContentScrubMode(content, opts.task), classification)
|
|
212
|
+
: null;
|
|
200
213
|
const scrubbed = custodyApplies && content !== undefined && effScrub !== null ? (0, scrub_1.scrubContent)(serialized, effScrub) : null;
|
|
201
214
|
const scrubSummary = scrubbed !== null && effScrub !== null ? (0, scrub_1.summarizeScrub)(effScrub, scrubbed) : null;
|
|
202
215
|
if (scrubbed !== null)
|
|
@@ -329,25 +342,6 @@ function createArtifactApi(deps) {
|
|
|
329
342
|
warn("link", err);
|
|
330
343
|
}
|
|
331
344
|
},
|
|
332
|
-
evaluate(ref, opts) {
|
|
333
|
-
try {
|
|
334
|
-
store.recordArtifactEvaluation({
|
|
335
|
-
id: (0, node_crypto_1.randomUUID)(),
|
|
336
|
-
artifactId: idOf(ref),
|
|
337
|
-
runId: null,
|
|
338
|
-
evaluator: opts.evaluator,
|
|
339
|
-
evaluatorKind: opts.kind,
|
|
340
|
-
score: opts.score ?? null,
|
|
341
|
-
passed: opts.passed ?? null,
|
|
342
|
-
label: opts.label ?? null,
|
|
343
|
-
explanation: opts.explanation ?? null,
|
|
344
|
-
createdBy: null,
|
|
345
|
-
});
|
|
346
|
-
}
|
|
347
|
-
catch (err) {
|
|
348
|
-
warn("evaluate", err);
|
|
349
|
-
}
|
|
350
|
-
},
|
|
351
345
|
promoteToEval(ref, opts) {
|
|
352
346
|
const sourceArtifactId = idOf(ref);
|
|
353
347
|
// Resolve the task: explicit wins, else the task this artifact was saved
|
|
@@ -3,19 +3,20 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Lives here (not spread through `index.ts`) so the SDK entrypoint stays under
|
|
5
5
|
* the LOC cap and the run/artifact surface has one home. Chunk A ships the run
|
|
6
|
-
* lifecycle + `@step`; chunk B adds the artifact primitives (save/load/
|
|
6
|
+
* lifecycle + `@step`; chunk B adds the artifact primitives (save/load/link).
|
|
7
7
|
*/
|
|
8
8
|
import type { ArtifactBuffer, RunNamespace } from "./run-context";
|
|
9
9
|
import type { ArtifactApi, ArtifactContentDeps } from "./artifact";
|
|
10
10
|
import type { ArtifactContentConfig, ArtifactsConfig } from "../config";
|
|
11
|
+
import type { TaskSettingsResolver } from "../settings/task-settings";
|
|
11
12
|
import type { ArtifactStore } from "../telemetry/artifact-store";
|
|
12
13
|
export { getActiveRunContext, createRunNamespace } from "./run-context";
|
|
13
|
-
export type { RunNamespace, RunHandle, RunStartOptions,
|
|
14
|
+
export type { RunNamespace, RunHandle, RunStartOptions, RunStatus, ActiveRunContext, ArtifactBuffer, GroundTruthStepInput, } from "./run-context";
|
|
14
15
|
export { step } from "./step";
|
|
15
16
|
export { createArtifactApi } from "./artifact";
|
|
16
17
|
export { openArtifactStore } from "../telemetry/artifact-store";
|
|
17
18
|
export type { ArtifactStore } from "../telemetry/artifact-store";
|
|
18
|
-
export type { ArtifactApi, ArtifactHandle, ArtifactSaveOptions,
|
|
19
|
+
export type { ArtifactApi, ArtifactHandle, ArtifactSaveOptions, ArtifactPromoteOptions, ArtifactContentDeps, ArtifactContentUploader, } from "./artifact";
|
|
19
20
|
export { uploadArtifactContent } from "./content-uploader";
|
|
20
21
|
export type { ContentUploadConfig, ContentUploadInput, ContentUploadOutcome, } from "./content-uploader";
|
|
21
22
|
export { scrubContent, luhnValid, detectSpans, scrubDetectors } from "./scrub";
|
|
@@ -24,7 +25,7 @@ export { DATA_CLASSIFICATIONS, SENSITIVE_CLASSIFICATIONS, isDataClassification,
|
|
|
24
25
|
export type { DataClassification } from "./classification";
|
|
25
26
|
export { computeDownstreamClosure, TAINT_DEFAULT_MAX_DEPTH, TAINT_DEFAULT_CAP, } from "./taint";
|
|
26
27
|
export type { TaintEdge, Supersession, TaintNode, TaintClosure, TaintOptions, } from "./taint";
|
|
27
|
-
export type { RunRow, StepRow, ArtifactRow, ArtifactEdgeRow,
|
|
28
|
+
export type { RunRow, StepRow, ArtifactRow, ArtifactEdgeRow, EvalCaseRow, EvalCaseOrigin, } from "../types/telemetry";
|
|
28
29
|
/** The rig-bound artifact surface exposed as `rig.artifacts`: the run lifecycle
|
|
29
30
|
* (chunk A) + the artifact primitives (chunk B). */
|
|
30
31
|
export interface ArtifactNamespace {
|
|
@@ -40,6 +41,9 @@ export declare function wireRigArtifacts(deps: {
|
|
|
40
41
|
readonly enabled: boolean;
|
|
41
42
|
readonly artifactStore: ArtifactStore | null;
|
|
42
43
|
readonly artifacts?: ArtifactsConfig;
|
|
44
|
+
/** Control-plane settings resolver (ยง1.5; P15 CP-3b) โ the per-task/account
|
|
45
|
+
* scrub source the content-upload path reads. null local-only/direct. */
|
|
46
|
+
readonly resolver?: TaskSettingsResolver | null;
|
|
43
47
|
}): {
|
|
44
48
|
readonly namespace: ArtifactNamespace;
|
|
45
49
|
readonly onArtifactsFlushed?: () => Promise<void>;
|
|
@@ -49,7 +53,7 @@ export declare function wireRigArtifacts(deps: {
|
|
|
49
53
|
* custody is off. Kept here (not in the SDK entrypoint) so index.ts stays under
|
|
50
54
|
* the LOC cap (P1) and the content wiring lives beside the namespace it feeds.
|
|
51
55
|
*/
|
|
52
|
-
export declare function buildArtifactContentDeps(content: ArtifactContentConfig | undefined): ArtifactContentDeps | undefined;
|
|
56
|
+
export declare function buildArtifactContentDeps(content: ArtifactContentConfig | undefined, resolver: TaskSettingsResolver | null): ArtifactContentDeps | undefined;
|
|
53
57
|
/** Build the rig-bound artifact namespace. Disabled โ every entry is inert
|
|
54
58
|
* (run.start is a no-op, save returns null, no rows written) โ spec ยง1.4. The
|
|
55
59
|
* artifact store is present only when enabled (index.ts opens it then). */
|
|
@@ -61,5 +65,9 @@ export declare function createArtifactNamespace(deps: {
|
|
|
61
65
|
* deps are built here (buildArtifactContentDeps) so the SDK entrypoint stays
|
|
62
66
|
* under the LOC cap. */
|
|
63
67
|
readonly content?: ArtifactContentConfig;
|
|
68
|
+
/** Control-plane settings resolver (ยง1.5; P15 CP-3b) โ threaded into the
|
|
69
|
+
* content deps so the upload path resolves scrub per task/account. null
|
|
70
|
+
* local-only/direct (then the content-on default governs). */
|
|
71
|
+
readonly resolver?: TaskSettingsResolver | null;
|
|
64
72
|
}): ArtifactNamespace;
|
|
65
73
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/artifacts/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAElE,OAAO,KAAK,EAAE,WAAW,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC;AAGnE,OAAO,KAAK,EAAE,qBAAqB,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/artifacts/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAElE,OAAO,KAAK,EAAE,WAAW,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC;AAGnE,OAAO,KAAK,EAAE,qBAAqB,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAExE,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AACtE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAEjE,OAAO,EAAE,mBAAmB,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AACxE,YAAY,EACV,YAAY,EACZ,SAAS,EACT,eAAe,EACf,SAAS,EACT,gBAAgB,EAChB,cAAc,EACd,oBAAoB,GACrB,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAC9B,OAAO,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAC/C,OAAO,EAAE,iBAA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,EAAE,aAAa,GAAG,IAAI,CAAC;IAC7C,QAAQ,CAAC,SAAS,CAAC,EAAE,eAAe,CAAC;IACrC;6EACyE;IACzE,QAAQ,CAAC,QAAQ,CAAC,EAAE,oBAAoB,GAAG,IAAI,CAAC;CACjD,GAAG;IAAE,QAAQ,CAAC,SAAS,EAAE,iBAAiB,CAAC;IAAC,QAAQ,CAAC,kBAAkB,CAAC,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAA;CAAE,CAa/F;AAED;;;;GAIG;AACH,wBAAgB,wBAAwB,CACtC,OAAO,EAAE,qBAAqB,GAAG,SAAS,EAC1C,QAAQ,EAAE,oBAAoB,GAAG,IAAI,GACpC,mBAAmB,GAAG,SAAS,CAcjC;AAED;;2EAE2E;AAC3E,wBAAgB,uBAAuB,CAAC,IAAI,EAAE;IAC5C,QAAQ,CAAC,MAAM,EAAE,cAAc,CAAC;IAChC,QAAQ,CAAC,aAAa,CAAC,EAAE,aAAa,CAAC;IACvC,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;IAC1B;;4BAEwB;IACxB,QAAQ,CAAC,OAAO,CAAC,EAAE,qBAAqB,CAAC;IACzC;;kEAE8D;IAC9D,QAAQ,CAAC,QAAQ,CAAC,EAAE,oBAAoB,GAAG,IAAI,CAAC;CACjD,GAAG,iBAAiB,CAcpB"}
|
package/dist/artifacts/index.js
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
*
|
|
5
5
|
* Lives here (not spread through `index.ts`) so the SDK entrypoint stays under
|
|
6
6
|
* the LOC cap and the run/artifact surface has one home. Chunk A ships the run
|
|
7
|
-
* lifecycle + `@step`; chunk B adds the artifact primitives (save/load/
|
|
7
|
+
* lifecycle + `@step`; chunk B adds the artifact primitives (save/load/link).
|
|
8
8
|
*/
|
|
9
9
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
10
|
exports.TAINT_DEFAULT_CAP = exports.TAINT_DEFAULT_MAX_DEPTH = exports.computeDownstreamClosure = exports.normalizeClassification = exports.isDataClassification = exports.SENSITIVE_CLASSIFICATIONS = exports.DATA_CLASSIFICATIONS = exports.scrubDetectors = exports.detectSpans = exports.luhnValid = exports.scrubContent = exports.uploadArtifactContent = exports.openArtifactStore = exports.createArtifactApi = exports.step = exports.createRunNamespace = exports.getActiveRunContext = void 0;
|
|
@@ -14,6 +14,7 @@ exports.createArtifactNamespace = createArtifactNamespace;
|
|
|
14
14
|
const run_context_1 = require("./run-context");
|
|
15
15
|
const artifact_1 = require("./artifact");
|
|
16
16
|
const content_uploader_1 = require("./content-uploader");
|
|
17
|
+
const config_1 = require("../config");
|
|
17
18
|
var run_context_2 = require("./run-context");
|
|
18
19
|
Object.defineProperty(exports, "getActiveRunContext", { enumerable: true, get: function () { return run_context_2.getActiveRunContext; } });
|
|
19
20
|
Object.defineProperty(exports, "createRunNamespace", { enumerable: true, get: function () { return run_context_2.createRunNamespace; } });
|
|
@@ -49,6 +50,7 @@ function wireRigArtifacts(deps) {
|
|
|
49
50
|
const namespace = createArtifactNamespace({
|
|
50
51
|
buffer: deps.buffer,
|
|
51
52
|
enabled: deps.enabled,
|
|
53
|
+
resolver: deps.resolver ?? null,
|
|
52
54
|
...(deps.artifactStore !== null ? { artifactStore: deps.artifactStore } : {}),
|
|
53
55
|
...(deps.artifacts?.content !== undefined ? { content: deps.artifacts.content } : {}),
|
|
54
56
|
});
|
|
@@ -63,11 +65,14 @@ function wireRigArtifacts(deps) {
|
|
|
63
65
|
* custody is off. Kept here (not in the SDK entrypoint) so index.ts stays under
|
|
64
66
|
* the LOC cap (P1) and the content wiring lives beside the namespace it feeds.
|
|
65
67
|
*/
|
|
66
|
-
function buildArtifactContentDeps(content) {
|
|
68
|
+
function buildArtifactContentDeps(content, resolver) {
|
|
67
69
|
if (content === undefined)
|
|
68
70
|
return undefined;
|
|
69
71
|
return {
|
|
70
|
-
|
|
72
|
+
// Scrub comes from the per-task/account control-plane setting at runtime
|
|
73
|
+
// (P15 CP-3b); the resolver wins, `defaultScrub` is the local/direct fallback.
|
|
74
|
+
resolver,
|
|
75
|
+
defaultScrub: config_1.DEFAULT_CONTENT_SCRUB_MODE,
|
|
71
76
|
upload: (input) => (0, content_uploader_1.uploadArtifactContent)(input, { uploadsUrl: content.uploadsUrl, apiKey: content.apiKey, maxBytes: content.maxBytes }, fetch),
|
|
72
77
|
};
|
|
73
78
|
}
|
|
@@ -75,7 +80,9 @@ function buildArtifactContentDeps(content) {
|
|
|
75
80
|
* (run.start is a no-op, save returns null, no rows written) โ spec ยง1.4. The
|
|
76
81
|
* artifact store is present only when enabled (index.ts opens it then). */
|
|
77
82
|
function createArtifactNamespace(deps) {
|
|
78
|
-
const contentDeps = deps.enabled
|
|
83
|
+
const contentDeps = deps.enabled
|
|
84
|
+
? buildArtifactContentDeps(deps.content, deps.resolver ?? null)
|
|
85
|
+
: undefined;
|
|
79
86
|
return {
|
|
80
87
|
run: (0, run_context_1.createRunNamespace)(deps),
|
|
81
88
|
artifact: (0, artifact_1.createArtifactApi)({
|
|
@@ -13,12 +13,13 @@
|
|
|
13
13
|
* write that fails is logged and dropped; the customer's pipeline is untouched.
|
|
14
14
|
*
|
|
15
15
|
* โโ GATING โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
|
|
16
|
-
* The namespace is inert unless the rig enabled it (
|
|
16
|
+
* The namespace is inert unless the rig enabled it (a control plane is configured,
|
|
17
|
+
* or the dev-only local force-on; the org capture posture governs at runtime).
|
|
17
18
|
* A disabled namespace's `run.start()` sets NO context, so `getActiveRunContext`
|
|
18
19
|
* returns null everywhere and the run loop's auto-step is never reached โ
|
|
19
20
|
* v1 wire, zero new rows, zero behaviour change (spec ยง1.4).
|
|
20
21
|
*/
|
|
21
|
-
import type {
|
|
22
|
+
import type { RunRow, StepRow } from "../types/telemetry";
|
|
22
23
|
import type { RunMetaV1 } from "../telemetry/attempt-meta";
|
|
23
24
|
/** The narrow buffer the run/artifact namespace writes through โ the local
|
|
24
25
|
* telemetry store satisfies it. Kept narrow so this module depends on the row
|
|
@@ -119,23 +120,10 @@ export declare function isValidStepKey(key: string): boolean;
|
|
|
119
120
|
export declare function resolveStepKey(explicit: string | undefined, tagStep: string | undefined, auto: () => string): string;
|
|
120
121
|
/** Test-only: clear the once-per-process invalid-stepKey warning latch. */
|
|
121
122
|
export declare function resetStepKeyWarningsForTest(): void;
|
|
122
|
-
/** A run-level evaluation the caller attaches (E5 chunk V.2) โ the run-subject
|
|
123
|
-
* mirror of ArtifactEvaluateOptions. The subject is the run, so there is no ref. */
|
|
124
|
-
export interface RunEvaluateOptions {
|
|
125
|
-
readonly evaluator: string;
|
|
126
|
-
readonly kind: "deterministic" | "model-judge" | "human";
|
|
127
|
-
readonly score?: number;
|
|
128
|
-
readonly passed?: boolean;
|
|
129
|
-
readonly label?: string;
|
|
130
|
-
readonly explanation?: string;
|
|
131
|
-
}
|
|
132
123
|
/** A handle a caller holds to end a run it started. */
|
|
133
124
|
export interface RunHandle {
|
|
134
125
|
readonly runId: string;
|
|
135
126
|
end(status?: RunStatus): void;
|
|
136
|
-
/** Attach a run-level evaluation to THIS run (E5 V.2). Works after end() โ
|
|
137
|
-
* verdicts are often post-hoc. Fail-open + inert when the namespace is off. */
|
|
138
|
-
evaluate(opts: RunEvaluateOptions): void;
|
|
139
127
|
}
|
|
140
128
|
/** The `run` namespace, bound to one rig's buffer + gate. Disabled โ inert. */
|
|
141
129
|
export interface RunNamespace {
|
|
@@ -147,9 +135,6 @@ export interface RunNamespace {
|
|
|
147
135
|
start(opts: RunStartOptions): RunHandle;
|
|
148
136
|
/** End the active run with a terminal status (default "succeeded"). */
|
|
149
137
|
end(status?: RunStatus): void;
|
|
150
|
-
/** Attach a run-level evaluation to the ACTIVE run (E5 V.2) โ the run-subject
|
|
151
|
-
* mirror of `artifact.evaluate`. No active run โ a warned no-op (fail-open). */
|
|
152
|
-
evaluate(opts: RunEvaluateOptions): void;
|
|
153
138
|
/** Concurrency-safe run scope. Runs `fn` inside `AsyncLocalStorage.run`, so
|
|
154
139
|
* overlapping `scope()` calls each keep their OWN ambient run context โ the
|
|
155
140
|
* correct primitive for `Promise.all` over items. Ends the run "succeeded" on
|
|
@@ -160,11 +145,5 @@ export interface RunNamespace {
|
|
|
160
145
|
export declare function createRunNamespace(deps: {
|
|
161
146
|
readonly buffer: ArtifactBuffer;
|
|
162
147
|
readonly enabled: boolean;
|
|
163
|
-
/** The evaluation writer (E5 V.2) โ the artifact store's recordArtifactEvaluation.
|
|
164
|
-
* Absent (disabled / no store) โ run.evaluate is inert. Kept OFF the narrow
|
|
165
|
-
* ArtifactBuffer so that contract stays "cannot reach anything but run/step". */
|
|
166
|
-
readonly artifactStore?: {
|
|
167
|
-
recordArtifactEvaluation(row: ArtifactEvaluationRow): void;
|
|
168
|
-
};
|
|
169
148
|
}): RunNamespace;
|
|
170
149
|
//# sourceMappingURL=run-context.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"run-context.d.ts","sourceRoot":"","sources":["../../src/artifacts/run-context.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"run-context.d.ts","sourceRoot":"","sources":["../../src/artifacts/run-context.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAIH,OAAO,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAE1D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAC;AAI3D;;sEAEsE;AACtE,MAAM,WAAW,cAAc;IAC7B,SAAS,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7B,UAAU,CAAC,GAAG,EAAE,OAAO,GAAG,IAAI,CAAC;CAChC;AAED,MAAM,MAAM,SAAS,GAAG,MAAM,CAAC,QAAQ,CAAC,CAAC;AAEzC,MAAM,WAAW,eAAe;IAC9B,8DAA8D;IAC9D,QAAQ,CAAC,QAAQ,EAAE,M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C,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC;CACnE;AASD,wBAAgB,kBAAkB,CAAC,IAAI,EAAE;IACvC,QAAQ,CAAC,MAAM,EAAE,cAAc,CAAC;IAChC,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;CAC3B,GAAG,YAAY,CAoJf"}
|
|
@@ -14,7 +14,8 @@
|
|
|
14
14
|
* write that fails is logged and dropped; the customer's pipeline is untouched.
|
|
15
15
|
*
|
|
16
16
|
* โโ GATING โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
|
|
17
|
-
* The namespace is inert unless the rig enabled it (
|
|
17
|
+
* The namespace is inert unless the rig enabled it (a control plane is configured,
|
|
18
|
+
* or the dev-only local force-on; the org capture posture governs at runtime).
|
|
18
19
|
* A disabled namespace's `run.start()` sets NO context, so `getActiveRunContext`
|
|
19
20
|
* returns null everywhere and the run loop's auto-step is never reached โ
|
|
20
21
|
* v1 wire, zero new rows, zero behaviour change (spec ยง1.4).
|
|
@@ -129,30 +130,7 @@ function warnOnce(scope, err) {
|
|
|
129
130
|
}
|
|
130
131
|
function createRunNamespace(deps) {
|
|
131
132
|
const { buffer, enabled } = deps;
|
|
132
|
-
const
|
|
133
|
-
/** Write ONE run-subject evaluation (artifactId null, runId set). Fail-open. */
|
|
134
|
-
function writeRunEvaluation(runId, opts) {
|
|
135
|
-
if (!enabled || evalStore === undefined || runId === "")
|
|
136
|
-
return;
|
|
137
|
-
try {
|
|
138
|
-
evalStore.recordArtifactEvaluation({
|
|
139
|
-
id: (0, node_crypto_1.randomUUID)(),
|
|
140
|
-
artifactId: null,
|
|
141
|
-
runId,
|
|
142
|
-
evaluator: opts.evaluator,
|
|
143
|
-
evaluatorKind: opts.kind,
|
|
144
|
-
score: opts.score ?? null,
|
|
145
|
-
passed: opts.passed ?? null,
|
|
146
|
-
label: opts.label ?? null,
|
|
147
|
-
explanation: opts.explanation ?? null,
|
|
148
|
-
createdBy: null,
|
|
149
|
-
});
|
|
150
|
-
}
|
|
151
|
-
catch (err) {
|
|
152
|
-
warnOnce("run.evaluate", err);
|
|
153
|
-
}
|
|
154
|
-
}
|
|
155
|
-
const inertHandle = { runId: "", end() { }, evaluate() { } };
|
|
133
|
+
const inertHandle = { runId: "", end() { } };
|
|
156
134
|
function buildContext(startRow, traceId, zeroRetention) {
|
|
157
135
|
const runId = startRow.id;
|
|
158
136
|
const episodeKey = startRow.episodeKey;
|
|
@@ -250,7 +228,6 @@ function createRunNamespace(deps) {
|
|
|
250
228
|
return {
|
|
251
229
|
runId: ctx.runId,
|
|
252
230
|
end: (status) => endContext(ctx, status),
|
|
253
|
-
evaluate: (opts2) => writeRunEvaluation(ctx.runId, opts2),
|
|
254
231
|
};
|
|
255
232
|
},
|
|
256
233
|
end(status) {
|
|
@@ -258,19 +235,6 @@ function createRunNamespace(deps) {
|
|
|
258
235
|
if (ctx !== undefined)
|
|
259
236
|
endContext(ctx, status);
|
|
260
237
|
},
|
|
261
|
-
evaluate(opts) {
|
|
262
|
-
const ctx = storage.getStore();
|
|
263
|
-
// `ended` counts as gone โ same rule as getActiveRunContext. `enterWith`
|
|
264
|
-
// has no lexical exit, so an ended run's context stays ambient on this
|
|
265
|
-
// async path; without this check ns.evaluate re-attributes verdicts to
|
|
266
|
-
// the ended run (post-end verdicts belong to the HANDLE, which closes
|
|
267
|
-
// over its runId โ that path is unaffected).
|
|
268
|
-
if (ctx === undefined || ctx.ended) {
|
|
269
|
-
console.warn("[modelrig artifacts] run.evaluate() with no active run โ dropped");
|
|
270
|
-
return;
|
|
271
|
-
}
|
|
272
|
-
writeRunEvaluation(ctx.runId, opts);
|
|
273
|
-
},
|
|
274
238
|
async scope(opts, fn) {
|
|
275
239
|
if (!enabled)
|
|
276
240
|
return fn();
|