modelrig 0.2.0 → 0.4.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 +204 -0
- package/README.md +68 -4
- package/dist/adapters/deepseek.d.ts.map +1 -1
- package/dist/adapters/deepseek.js +8 -1
- package/dist/adapters/gemini.d.ts +16 -0
- package/dist/adapters/gemini.d.ts.map +1 -1
- package/dist/adapters/gemini.js +44 -3
- package/dist/adapters/grok.d.ts +7 -0
- package/dist/adapters/grok.d.ts.map +1 -1
- package/dist/adapters/grok.js +23 -1
- package/dist/adapters/openai-compat.d.ts +7 -0
- package/dist/adapters/openai-compat.d.ts.map +1 -1
- package/dist/adapters/openai-compat.js +24 -1
- package/dist/adapters/openai.d.ts +7 -0
- package/dist/adapters/openai.d.ts.map +1 -1
- package/dist/adapters/openai.js +23 -1
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +5 -4
- package/dist/config.d.ts +7 -1
- package/dist/config.d.ts.map +1 -1
- package/dist/index.d.ts +6 -6
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +28 -25
- package/dist/init/init-cli.d.ts.map +1 -1
- package/dist/init/init-cli.js +2 -1
- package/dist/init/observe-cli.d.ts.map +1 -1
- package/dist/init/observe-cli.js +2 -1
- package/dist/routes/loader.d.ts +11 -0
- package/dist/routes/loader.d.ts.map +1 -1
- package/dist/routes/loader.js +29 -0
- package/dist/routes/sampling-config.d.ts.map +1 -1
- package/dist/routes/sampling-config.js +11 -0
- package/dist/run/dispatch.d.ts +14 -2
- package/dist/run/dispatch.d.ts.map +1 -1
- package/dist/run/dispatch.js +31 -2
- package/dist/run/ladder-key.d.ts +40 -0
- package/dist/run/ladder-key.d.ts.map +1 -0
- package/dist/run/ladder-key.js +39 -0
- package/dist/run/raw-support.d.ts +123 -0
- package/dist/run/raw-support.d.ts.map +1 -0
- package/dist/run/raw-support.js +150 -0
- package/dist/run/raw.d.ts +73 -1
- package/dist/run/raw.d.ts.map +1 -1
- package/dist/run/raw.js +129 -8
- package/dist/run/rawonly.d.ts +60 -0
- package/dist/run/rawonly.d.ts.map +1 -0
- package/dist/run/rawonly.js +120 -0
- package/dist/run/record-attempt.d.ts +14 -1
- package/dist/run/record-attempt.d.ts.map +1 -1
- package/dist/run/record-attempt.js +43 -2
- package/dist/run/resolve.d.ts +4 -0
- package/dist/run/resolve.d.ts.map +1 -1
- package/dist/run/resolve.js +9 -2
- package/dist/run/routing-docs.d.ts +73 -0
- package/dist/run/routing-docs.d.ts.map +1 -0
- package/dist/run/routing-docs.js +222 -0
- package/dist/run/run.d.ts.map +1 -1
- package/dist/run/run.js +24 -22
- package/dist/telemetry/exporter.d.ts.map +1 -1
- package/dist/telemetry/exporter.js +6 -0
- package/dist/telemetry/ingest-protocol.d.ts +7 -0
- package/dist/telemetry/ingest-protocol.d.ts.map +1 -1
- package/dist/telemetry/load-error-report.d.ts.map +1 -1
- package/dist/telemetry/load-error-report.js +4 -1
- package/dist/telemetry/otel-map.d.ts.map +1 -1
- package/dist/telemetry/otel-map.js +8 -0
- package/dist/telemetry/store-migrations.d.ts +15 -0
- package/dist/telemetry/store-migrations.d.ts.map +1 -0
- package/dist/telemetry/store-migrations.js +119 -0
- package/dist/telemetry/store.d.ts.map +1 -1
- package/dist/telemetry/store.js +26 -93
- package/dist/types/failures-teaching.js +1 -1
- package/dist/types/provider.d.ts +38 -0
- package/dist/types/provider.d.ts.map +1 -1
- package/dist/types/route.d.ts +6 -1
- package/dist/types/route.d.ts.map +1 -1
- package/dist/types/telemetry.d.ts +31 -0
- package/dist/types/telemetry.d.ts.map +1 -1
- package/dist/validate-cli.d.ts.map +1 -1
- package/dist/validate-cli.js +17 -4
- package/package.json +1 -1
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Routing & reliability — the code-anchored boundary and the failure-class
|
|
3
|
+
* section of https://modelrig.dev/routing-reliability.html.
|
|
4
|
+
*
|
|
5
|
+
* ONE table feeds the published page AND the tripwire test, the same way
|
|
6
|
+
* `RAW_KNOB_SUPPORT` (raw-support.ts) feeds the raw-lane matrix and its runtime
|
|
7
|
+
* guard. The docs builder (scripts/build-docs-site.ts) injects
|
|
8
|
+
* `renderRoutingBoundary()` at `<!-- ROUTING_BOUNDARY -->` and
|
|
9
|
+
* `renderFailureClasses()` at `<!-- FAILURE_CLASSES -->`, and inlines the
|
|
10
|
+
* boundary into llms.txt. Nothing here is exported from the package root.
|
|
11
|
+
*
|
|
12
|
+
* Spec: docs/ModelRig/routing-reliability-overview/spec.md §5–§6.
|
|
13
|
+
*/
|
|
14
|
+
import type { FailureClass } from "../types/failures";
|
|
15
|
+
export type BoundaryStatus = "not_built" | "deferred" | "shadow" | "by_design";
|
|
16
|
+
export interface BoundaryTripwire {
|
|
17
|
+
/** Path relative to packages/modelrig (the test reads it as text). */
|
|
18
|
+
readonly file: string;
|
|
19
|
+
/** Entry is STALE if this matches — the feature appeared. */
|
|
20
|
+
readonly mustNotMatch?: RegExp;
|
|
21
|
+
/** Entry is STALE if this stops matching — the no-op marker vanished. */
|
|
22
|
+
readonly mustMatch?: RegExp;
|
|
23
|
+
}
|
|
24
|
+
export interface BoundaryEntry {
|
|
25
|
+
/** Stable id (B1…) — becomes the first table column and a citable handle. */
|
|
26
|
+
readonly id: string;
|
|
27
|
+
readonly status: BoundaryStatus;
|
|
28
|
+
/** <= 8 words. */
|
|
29
|
+
readonly capability: string;
|
|
30
|
+
/** ONE sentence, present tense: what is true today. */
|
|
31
|
+
readonly statement: string;
|
|
32
|
+
/** Repo doc path (or issue) a reader can cite. */
|
|
33
|
+
readonly tracking: string;
|
|
34
|
+
readonly tripwire?: BoundaryTripwire | {
|
|
35
|
+
readonly noImportersOf: string;
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
/** Rendered group headings, in order. */
|
|
39
|
+
export declare const BOUNDARY_STATUS_LABEL: Readonly<Record<BoundaryStatus, string>>;
|
|
40
|
+
/**
|
|
41
|
+
* The ten boundary entries, transcribed verbatim from spec §5.3. Statuses,
|
|
42
|
+
* statements, and tripwires are BINDING content — do not add, drop, or reword
|
|
43
|
+
* an entry without an architect addendum to the spec. Shipping a capability
|
|
44
|
+
* listed here breaks `routing-docs.test.ts` until the entry is flipped or
|
|
45
|
+
* removed and the page updated.
|
|
46
|
+
*/
|
|
47
|
+
export declare const ROUTING_BOUNDARY: readonly BoundaryEntry[];
|
|
48
|
+
/**
|
|
49
|
+
* Markdown (renderer subset only): one `###` per non-empty status group, a pipe
|
|
50
|
+
* table per group with columns id | capability | what is true today | tracking.
|
|
51
|
+
* No nested lists, no HTML — the docs-site renderer supports neither.
|
|
52
|
+
*
|
|
53
|
+
* `published` (the site's page slugs) is passed by the docs builder so a tracking
|
|
54
|
+
* cell naming a published page renders as a link; a bare call (the shape/tripwire
|
|
55
|
+
* tests, which assert the plain table) leaves every cell as plain text.
|
|
56
|
+
*/
|
|
57
|
+
export declare function renderRoutingBoundary(published?: ReadonlySet<string>): string;
|
|
58
|
+
/** The failure classes in taxonomy order (types/failures.ts `FailureClass`
|
|
59
|
+
* union). FAILURE_TEACHING is keyed in that same order and its completeness is
|
|
60
|
+
* pinned by failures-teaching.test.ts, so its key order is the canonical walk.
|
|
61
|
+
* A test in routing-docs.test.ts asserts this equals the union order in
|
|
62
|
+
* failures.ts, so a taxonomy reorder cannot drift silently. */
|
|
63
|
+
export declare function failureClassOrder(): readonly FailureClass[];
|
|
64
|
+
/**
|
|
65
|
+
* Markdown: `### <class>` per FailureClass in taxonomy order, then the teaching
|
|
66
|
+
* `what`, the retry line, the backoff schedule (when any), and the `fixHint`.
|
|
67
|
+
* Heading text is the bare class name so the docs-site id equals the class
|
|
68
|
+
* (failures-teaching.ts docsUrl anchors depend on it — spec §6).
|
|
69
|
+
*/
|
|
70
|
+
export declare function renderFailureClasses(): string;
|
|
71
|
+
/** Exposed for the anchor-completeness test: the heading id each class gets. */
|
|
72
|
+
export declare function failureClassAnchor(cls: FailureClass): string;
|
|
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MAAM,CAoB7E;AAED;;;;+DAI+D;AAC/D,wBAAgB,iBAAiB,IAAI,SAAS,YAAY,EAAE,CAE3D;AA0BD;;;;;GAKG;AACH,wBAAgB,oBAAoB,IAAI,MAAM,CAW7C;AAED,gFAAgF;AAChF,wBAAgB,kBAAkB,CAAC,GAAG,EAAE,YAAY,GAAG,MAAM,CAE5D"}
|
|
@@ -0,0 +1,222 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Routing & reliability — the code-anchored boundary and the failure-class
|
|
4
|
+
* section of https://modelrig.dev/routing-reliability.html.
|
|
5
|
+
*
|
|
6
|
+
* ONE table feeds the published page AND the tripwire test, the same way
|
|
7
|
+
* `RAW_KNOB_SUPPORT` (raw-support.ts) feeds the raw-lane matrix and its runtime
|
|
8
|
+
* guard. The docs builder (scripts/build-docs-site.ts) injects
|
|
9
|
+
* `renderRoutingBoundary()` at `<!-- ROUTING_BOUNDARY -->` and
|
|
10
|
+
* `renderFailureClasses()` at `<!-- FAILURE_CLASSES -->`, and inlines the
|
|
11
|
+
* boundary into llms.txt. Nothing here is exported from the package root.
|
|
12
|
+
*
|
|
13
|
+
* Spec: docs/ModelRig/routing-reliability-overview/spec.md §5–§6.
|
|
14
|
+
*/
|
|
15
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
16
|
+
exports.ROUTING_BOUNDARY = exports.BOUNDARY_STATUS_LABEL = void 0;
|
|
17
|
+
exports.renderRoutingBoundary = renderRoutingBoundary;
|
|
18
|
+
exports.failureClassOrder = failureClassOrder;
|
|
19
|
+
exports.renderFailureClasses = renderFailureClasses;
|
|
20
|
+
exports.failureClassAnchor = failureClassAnchor;
|
|
21
|
+
const failures_1 = require("../types/failures");
|
|
22
|
+
const failures_teaching_1 = require("../types/failures-teaching");
|
|
23
|
+
/** Rendered group headings, in order. */
|
|
24
|
+
exports.BOUNDARY_STATUS_LABEL = {
|
|
25
|
+
not_built: "Not built",
|
|
26
|
+
deferred: "Deferred",
|
|
27
|
+
shadow: "Built, not actuating",
|
|
28
|
+
by_design: "By design — will not do",
|
|
29
|
+
};
|
|
30
|
+
/**
|
|
31
|
+
* The ten boundary entries, transcribed verbatim from spec §5.3. Statuses,
|
|
32
|
+
* statements, and tripwires are BINDING content — do not add, drop, or reword
|
|
33
|
+
* an entry without an architect addendum to the spec. Shipping a capability
|
|
34
|
+
* listed here breaks `routing-docs.test.ts` until the entry is flipped or
|
|
35
|
+
* removed and the page updated.
|
|
36
|
+
*/
|
|
37
|
+
exports.ROUTING_BOUNDARY = [
|
|
38
|
+
{
|
|
39
|
+
id: "B1",
|
|
40
|
+
status: "not_built",
|
|
41
|
+
capability: "Quality / value-accuracy gate in the ladder",
|
|
42
|
+
statement: "Fall-through is triggered by structure and infrastructure only; no builder-defined predicate or judge can reject a schema-valid output at run time — value accuracy exists offline, in bake-offs.",
|
|
43
|
+
tracking: "customer request on file (2026-08-21); not scheduled",
|
|
44
|
+
tripwire: { file: "src/types/route.ts", mustNotMatch: /qualityGate|"judged"/ },
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
id: "B2",
|
|
48
|
+
status: "not_built",
|
|
49
|
+
capability: "Structure on the raw lane",
|
|
50
|
+
statement: '`runRaw` never validates or repairs; `responseFormat: "json_object"` shapes MIME, not schema, so `meta.validated` stays false (ruled schema-free in CE-2 F4b; re-requested #223 R2).',
|
|
51
|
+
tracking: "ruled schema-free on the raw lane; re-request on file",
|
|
52
|
+
tripwire: { file: "src/run/raw.ts", mustNotMatch: /readonly outputSchema\??:/ },
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
id: "B3",
|
|
56
|
+
status: "deferred",
|
|
57
|
+
capability: "`prefer: latency` / observed-health ordering",
|
|
58
|
+
statement: "`latency` is accepted and does nothing — declared order stands; observed p50/p90/p99 are aggregated but unused by routing.",
|
|
59
|
+
tracking: "deferred to the observed-health work (latency signal first)",
|
|
60
|
+
tripwire: { file: "src/run/resolve.ts", mustMatch: /declared order stands/ },
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
id: "B4",
|
|
64
|
+
status: "shadow",
|
|
65
|
+
capability: "Cache-aware (warmth) candidate ordering",
|
|
66
|
+
statement: "The cache-adjusted ranking is computed and logged beside the chosen order but never changes it.",
|
|
67
|
+
tracking: "cache-aware routing — shadow mode; see caching-lifecycle.md",
|
|
68
|
+
tripwire: { file: "src/run/resolve.ts", mustMatch: /returns the UNCHANGED list-cost order/ },
|
|
69
|
+
},
|
|
70
|
+
{
|
|
71
|
+
id: "B5",
|
|
72
|
+
status: "shadow",
|
|
73
|
+
capability: "Cache-miss streak alert",
|
|
74
|
+
statement: "A miss-streak detector exists; nothing consumes it yet, so no alert fires.",
|
|
75
|
+
tracking: "cache-aware routing — monitor wiring pending",
|
|
76
|
+
tripwire: { noImportersOf: "telemetry/cache-miss-streak" },
|
|
77
|
+
},
|
|
78
|
+
{
|
|
79
|
+
id: "B6",
|
|
80
|
+
status: "not_built",
|
|
81
|
+
capability: "Run-level idempotency / dedupe key",
|
|
82
|
+
statement: "Two identical `rig.run` calls dispatch twice; the only idempotency is the exporter's watermark.",
|
|
83
|
+
// Spec §5.3 tracking reads "— (record here)": B6 has no external tracking
|
|
84
|
+
// doc; this generated boundary IS its record, so the rendered cell is "—".
|
|
85
|
+
tracking: "—",
|
|
86
|
+
tripwire: { file: "src/types/route.ts", mustNotMatch: /idempotencyKey/ },
|
|
87
|
+
},
|
|
88
|
+
{
|
|
89
|
+
id: "B7",
|
|
90
|
+
status: "by_design",
|
|
91
|
+
capability: "Automatic model swap",
|
|
92
|
+
statement: "Nothing changes what serves a route without a bake-off and an explicit human approval (`modelrig swap execute <id> --approve`).",
|
|
93
|
+
tracking: "optimization-loop.md — human-approved swaps only",
|
|
94
|
+
// No file tripwire: the P6 never-silent-swap invariant is covered by its
|
|
95
|
+
// own dev-rule tests (spec §5.3).
|
|
96
|
+
},
|
|
97
|
+
{
|
|
98
|
+
id: "B8",
|
|
99
|
+
status: "by_design",
|
|
100
|
+
capability: "Provider cache resource lifecycle",
|
|
101
|
+
statement: "ModelRig passes your cache handle through and prices the hits; it never creates, refreshes, or deletes the resource — your heartbeat does.",
|
|
102
|
+
tracking: "caching-lifecycle.md — who owns what",
|
|
103
|
+
},
|
|
104
|
+
{
|
|
105
|
+
id: "B9",
|
|
106
|
+
status: "by_design",
|
|
107
|
+
capability: "Tool execution",
|
|
108
|
+
statement: "ModelRig normalizes the tool-call protocol and returns `meta.toolCalls`; the caller runs the tool.",
|
|
109
|
+
tracking: "route-bundles.md — tools are normalized, never executed",
|
|
110
|
+
},
|
|
111
|
+
{
|
|
112
|
+
id: "B10",
|
|
113
|
+
status: "by_design",
|
|
114
|
+
capability: "Raw-lane flex → standard degrade",
|
|
115
|
+
statement: "A flex capacity rejection on `runRaw` surfaces as `capacity_shed` for your own retry ladder; ModelRig does not degrade the tier for you.",
|
|
116
|
+
tracking: "route-bundles.md — raw-lane serviceTier (customer-side degrade)",
|
|
117
|
+
},
|
|
118
|
+
];
|
|
119
|
+
const STATUS_ORDER = ["not_built", "deferred", "shadow", "by_design"];
|
|
120
|
+
/** Escape a table cell so a literal `|` in content cannot break the pipe table.
|
|
121
|
+
* (None of the current statements contain one; this keeps a future edit safe.) */
|
|
122
|
+
function cell(text) {
|
|
123
|
+
return text.replace(/\|/g, "\\|");
|
|
124
|
+
}
|
|
125
|
+
/**
|
|
126
|
+
* Turn a `<slug>.md` token in a tracking cell into a markdown link to that
|
|
127
|
+
* published page (S8) — but ONLY when the slug is one the site actually
|
|
128
|
+
* publishes, so a stray `.md` reference never becomes a dead link. The URL is
|
|
129
|
+
* absolute (`modelrig.dev/<slug>.html`) so the same rendered text works on the
|
|
130
|
+
* page (the docs renderer leaves an already-`.html` href alone) AND inline in
|
|
131
|
+
* llms.txt, which is plain text and never runs the `.md`→`.html` rewrite.
|
|
132
|
+
*/
|
|
133
|
+
function linkifyTracking(text, published) {
|
|
134
|
+
return text.replace(/\b([a-z0-9][a-z0-9-]*)\.md\b/gi, (whole, slug) => published.has(slug) ? `[${slug}](https://modelrig.dev/${slug}.html)` : whole);
|
|
135
|
+
}
|
|
136
|
+
/**
|
|
137
|
+
* Markdown (renderer subset only): one `###` per non-empty status group, a pipe
|
|
138
|
+
* table per group with columns id | capability | what is true today | tracking.
|
|
139
|
+
* No nested lists, no HTML — the docs-site renderer supports neither.
|
|
140
|
+
*
|
|
141
|
+
* `published` (the site's page slugs) is passed by the docs builder so a tracking
|
|
142
|
+
* cell naming a published page renders as a link; a bare call (the shape/tripwire
|
|
143
|
+
* tests, which assert the plain table) leaves every cell as plain text.
|
|
144
|
+
*/
|
|
145
|
+
function renderRoutingBoundary(published) {
|
|
146
|
+
const blocks = [];
|
|
147
|
+
for (const status of STATUS_ORDER) {
|
|
148
|
+
const entries = exports.ROUTING_BOUNDARY.filter((e) => e.status === status);
|
|
149
|
+
if (entries.length === 0)
|
|
150
|
+
continue;
|
|
151
|
+
const rows = entries.map((e) => {
|
|
152
|
+
const tracking = published ? linkifyTracking(e.tracking, published) : e.tracking;
|
|
153
|
+
return `| ${e.id} | ${cell(e.capability)} | ${cell(e.statement)} | ${cell(tracking)} |`;
|
|
154
|
+
});
|
|
155
|
+
blocks.push([
|
|
156
|
+
`### ${exports.BOUNDARY_STATUS_LABEL[status]}`,
|
|
157
|
+
"",
|
|
158
|
+
"| id | capability | what is true today | tracking |",
|
|
159
|
+
"|---|---|---|---|",
|
|
160
|
+
...rows,
|
|
161
|
+
].join("\n"));
|
|
162
|
+
}
|
|
163
|
+
return blocks.join("\n\n");
|
|
164
|
+
}
|
|
165
|
+
/** The failure classes in taxonomy order (types/failures.ts `FailureClass`
|
|
166
|
+
* union). FAILURE_TEACHING is keyed in that same order and its completeness is
|
|
167
|
+
* pinned by failures-teaching.test.ts, so its key order is the canonical walk.
|
|
168
|
+
* A test in routing-docs.test.ts asserts this equals the union order in
|
|
169
|
+
* failures.ts, so a taxonomy reorder cannot drift silently. */
|
|
170
|
+
function failureClassOrder() {
|
|
171
|
+
return Object.keys(failures_teaching_1.FAILURE_TEACHING);
|
|
172
|
+
}
|
|
173
|
+
/**
|
|
174
|
+
* Backoff schedule per class, in reader-facing words. The numbers mirror the
|
|
175
|
+
* (non-exported) constants in run/retry.ts — `CAPACITY_BACKOFF_MS` and the
|
|
176
|
+
* `NETWORK_BACKOFF_*` pair — and a test in routing-docs.test.ts reads retry.ts
|
|
177
|
+
* to pin them, so this string cannot drift from the engine (spec §6).
|
|
178
|
+
*/
|
|
179
|
+
function backoffLine(cls) {
|
|
180
|
+
if (cls === "capacity_shed")
|
|
181
|
+
return "Backoff between retries: 30 s -> 60 s -> 120 s -> 240 s.";
|
|
182
|
+
if (cls === "network")
|
|
183
|
+
return "Backoff between retries: 1 s, doubling each time, capped at 30 s.";
|
|
184
|
+
// A class that is never retried — terminal, or `config_auth` (straight to the
|
|
185
|
+
// next candidate) — has no backoff to describe. Every OTHER class is retryable
|
|
186
|
+
// with a zero delay, so say so: §2 promises "with backoff", and leaving the
|
|
187
|
+
// remaining classes silent read as "unspecified" rather than "none" (S7).
|
|
188
|
+
if (failures_1.TERMINAL_CLASSES.has(cls) || cls === "config_auth")
|
|
189
|
+
return null;
|
|
190
|
+
return "No backoff between retries (immediate retry).";
|
|
191
|
+
}
|
|
192
|
+
/** The retry disposition sentence for one class (spec §6). */
|
|
193
|
+
function retryLine(cls) {
|
|
194
|
+
if (failures_1.TERMINAL_CLASSES.has(cls))
|
|
195
|
+
return "Terminal — never retried; aborts the run.";
|
|
196
|
+
if (cls === "config_auth")
|
|
197
|
+
return "Never retried — the run loop advances to the next candidate.";
|
|
198
|
+
return "Retryable — default budget 0 (declare every budget you want under `policy.retries`).";
|
|
199
|
+
}
|
|
200
|
+
/**
|
|
201
|
+
* Markdown: `### <class>` per FailureClass in taxonomy order, then the teaching
|
|
202
|
+
* `what`, the retry line, the backoff schedule (when any), and the `fixHint`.
|
|
203
|
+
* Heading text is the bare class name so the docs-site id equals the class
|
|
204
|
+
* (failures-teaching.ts docsUrl anchors depend on it — spec §6).
|
|
205
|
+
*/
|
|
206
|
+
function renderFailureClasses() {
|
|
207
|
+
const blocks = [];
|
|
208
|
+
for (const cls of failureClassOrder()) {
|
|
209
|
+
const teaching = failures_teaching_1.FAILURE_TEACHING[cls];
|
|
210
|
+
const parts = [`### ${cls}`, "", teaching.what, "", retryLine(cls)];
|
|
211
|
+
const backoff = backoffLine(cls);
|
|
212
|
+
if (backoff !== null)
|
|
213
|
+
parts.push("", backoff);
|
|
214
|
+
parts.push("", `Fix: ${teaching.fixHint}`);
|
|
215
|
+
blocks.push(parts.join("\n"));
|
|
216
|
+
}
|
|
217
|
+
return blocks.join("\n\n");
|
|
218
|
+
}
|
|
219
|
+
/** Exposed for the anchor-completeness test: the heading id each class gets. */
|
|
220
|
+
function failureClassAnchor(cls) {
|
|
221
|
+
return cls;
|
|
222
|
+
}
|
package/dist/run/run.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"run.d.ts","sourceRoot":"","sources":["../../src/run/run.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAMrD,OAAO,KAAK,EAAE,eAAe,EAAgB,MAAM,mBAAmB,CAAC;AAGvE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAEtD,OAAO,KAAK,EAAsC,UAAU,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAChG,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACzD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACzD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAQlD,OAAO,KAAK,EAAE,cAAc,EAAoC,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"run.d.ts","sourceRoot":"","sources":["../../src/run/run.ts"],"names":[],"mappings":"A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CAAC,KAAK,CAAC,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IAC/C;;;mFAG+E;IAC/E,QAAQ,CAAC,aAAa,CAAC,EAAE,eAAe,CAAC;IACzC;;;;;uDAKmD;IACnD,QAAQ,CAAC,QAAQ,CAAC,EAAE,oBAAoB,GAAG,IAAI,CAAC;CACjD;AAqDD,wBAAsB,GAAG,CAAC,IAAI,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,IAAI,EAAE,UAAU,GAAG,OAAO,CAAC,SAAS,CAAC,CAmjBhG"}
|
package/dist/run/run.js
CHANGED
|
@@ -24,6 +24,7 @@ const grounding_1 = require("./grounding");
|
|
|
24
24
|
const validate_1 = require("./validate");
|
|
25
25
|
const dispatch_1 = require("./dispatch");
|
|
26
26
|
const record_attempt_1 = require("./record-attempt");
|
|
27
|
+
const ladder_key_1 = require("./ladder-key");
|
|
27
28
|
const run_context_1 = require("../artifacts/run-context");
|
|
28
29
|
const capture_write_1 = require("./capture-write");
|
|
29
30
|
/** Look up a named variant; null = default (base config). Unknown names are
|
|
@@ -62,19 +63,6 @@ function effectiveRoute(route, variant) {
|
|
|
62
63
|
const USER_DIRECTIVE = "Produce the required output now, following the system instructions exactly.";
|
|
63
64
|
/** User turn for repair calls (WS2) — same terse-trigger convention. */
|
|
64
65
|
const REPAIR_DIRECTIVE = "Produce the corrected JSON object now, following the system instructions exactly.";
|
|
65
|
-
/** Schema coaching for the json_mode rung — ported from the production
|
|
66
|
-
* DeepSeek provider's schema-in-prompt guidance (minLength-is-a-FLOOR etc.). */
|
|
67
|
-
function jsonModeCoaching(schema) {
|
|
68
|
-
return ("\n\n---\nOUTPUT FORMAT (STRICT): Respond with a SINGLE valid JSON object and nothing else — " +
|
|
69
|
-
'no markdown fences, no introductory text, no sign-off. Your response MUST start with "{" and ' +
|
|
70
|
-
'end with "}". Sanitize every nested string so embedded quotes/brackets do not break the root ' +
|
|
71
|
-
"JSON escaping. The object MUST conform to this JSON Schema — match key names and types " +
|
|
72
|
-
"EXACTLY, include ALL required fields, and do not add commentary fields. CRITICAL: where the " +
|
|
73
|
-
"schema sets a minLength on a narrative/prose field, that is a FLOOR, not a target — write " +
|
|
74
|
-
"thorough, non-repetitive analysis that comfortably EXCEEDS the minimum (do not pad with " +
|
|
75
|
-
"repetition; add real substance). When unsure how long to make a prose field, write more, " +
|
|
76
|
-
`not less:\n\n${JSON.stringify(schema)}`);
|
|
77
|
-
}
|
|
78
66
|
/** prefer:[cost] ordering metric — combined input+output USD per million
|
|
79
67
|
* tokens from the pricing snapshot; null (unknown) sorts last in resolve. */
|
|
80
68
|
function costPerMTok(provider, model) {
|
|
@@ -109,6 +97,9 @@ async function run(deps, routeName, opts) {
|
|
|
109
97
|
// it (attempt-per-row, ruling c). Inert without a run.start on this path.
|
|
110
98
|
const runCtx = (0, run_context_1.getActiveRunContext)();
|
|
111
99
|
const autoStepKey = runCtx !== null ? runCtx.nextStepKey(route.route) : null;
|
|
100
|
+
// Per-call ladder key (spec §2.1 R0): one call_id, a monotonic attempt_seq per
|
|
101
|
+
// row, and the current candidate_index (advanced by nextCandidate below).
|
|
102
|
+
const ladder = (0, ladder_key_1.createLadderKeyMinter)();
|
|
112
103
|
// Capture-WRITE gate (settings-plane §1.5, closes gate 5): the control-plane
|
|
113
104
|
// capture flag wins over the YAML flag, the task's scrub setting is honored,
|
|
114
105
|
// and capture OFF is a no-op writer (byte-identical). See ./capture-write.ts.
|
|
@@ -126,6 +117,7 @@ async function run(deps, routeName, opts) {
|
|
|
126
117
|
autoStepKey,
|
|
127
118
|
cache: opts.cache,
|
|
128
119
|
droppedCacheHandle,
|
|
120
|
+
ladder,
|
|
129
121
|
});
|
|
130
122
|
function failRun(candidate, failure, latencyMs) {
|
|
131
123
|
recordAttempt({
|
|
@@ -254,6 +246,7 @@ async function run(deps, routeName, opts) {
|
|
|
254
246
|
attemptsByClass: ledger.snapshot(),
|
|
255
247
|
servedVariant,
|
|
256
248
|
repairedBy,
|
|
249
|
+
callId: ladder.callId,
|
|
257
250
|
...(injectedSources !== null
|
|
258
251
|
? { citations: (0, grounding_1.extractCitations)(result.text, injectedSources) }
|
|
259
252
|
: {}),
|
|
@@ -263,7 +256,14 @@ async function run(deps, routeName, opts) {
|
|
|
263
256
|
}
|
|
264
257
|
const searchAvailable = deps.search !== undefined && deps.search !== null;
|
|
265
258
|
const iter = (0, resolve_1.resolveCandidates)(route, deps.capabilities, costPerMTok, searchAvailable, (0, resolve_1.candidateFilterFromOptions)(opts));
|
|
266
|
-
|
|
259
|
+
// Advance the iterator AND publish the served candidate's index to the ladder,
|
|
260
|
+
// so every row of this candidate's turn (incl. repair rows) carries it (§2.1).
|
|
261
|
+
const nextCandidate = () => {
|
|
262
|
+
const c = iter.next();
|
|
263
|
+
ladder.setCandidateIndex(iter.index);
|
|
264
|
+
return c;
|
|
265
|
+
};
|
|
266
|
+
let candidate = nextCandidate();
|
|
267
267
|
if (candidate === null) {
|
|
268
268
|
throw new loader_1.RouteConfigError(`route "${route.route}" has no eligible candidate — none of the declared candidates ` +
|
|
269
269
|
`satisfy require=[${route.require.join(", ")}] with json=${route.policy.json}${(0, resolve_1.filterSummary)(opts)}`);
|
|
@@ -294,7 +294,7 @@ async function run(deps, routeName, opts) {
|
|
|
294
294
|
// the next (the invariant guard above already OK'd the pair); nothing
|
|
295
295
|
// dispatched, so nothing billed. All-inert surfaces via the final throw.
|
|
296
296
|
lastFailure = (0, serveability_1.inertCandidateFailure)(candidate, route.route);
|
|
297
|
-
candidate =
|
|
297
|
+
candidate = nextCandidate();
|
|
298
298
|
continue;
|
|
299
299
|
}
|
|
300
300
|
// Render against the SERVING candidate's capability flags.
|
|
@@ -324,14 +324,13 @@ async function run(deps, routeName, opts) {
|
|
|
324
324
|
try {
|
|
325
325
|
searchResponse = await deps.search.search(query);
|
|
326
326
|
guard?.settle(searchResponse.costUsd);
|
|
327
|
-
(0, dispatch_1.recordSearchCostRow)(deps.telemetry, route, effectiveTags, servedVariant, deps.search.id, searchResponse.costUsd);
|
|
327
|
+
(0, dispatch_1.recordSearchCostRow)(deps.telemetry, route, effectiveTags, servedVariant, deps.search.id, searchResponse.costUsd, ladder);
|
|
328
328
|
}
|
|
329
329
|
catch (err) {
|
|
330
330
|
const failure = {
|
|
331
331
|
class: "network",
|
|
332
332
|
message: `grounding search failed: ${err instanceof Error ? err.message : String(err)}`,
|
|
333
|
-
fixHint: "check the search provider key/config (RigConfig.search)",
|
|
334
|
-
cause: err,
|
|
333
|
+
fixHint: "check the search provider key/config (RigConfig.search)", cause: err,
|
|
335
334
|
};
|
|
336
335
|
recordAttempt({
|
|
337
336
|
candidate,
|
|
@@ -342,13 +341,14 @@ async function run(deps, routeName, opts) {
|
|
|
342
341
|
costUsd: 0,
|
|
343
342
|
latencyMs: 0,
|
|
344
343
|
failure,
|
|
344
|
+
rung: "search", // the SEARCH failed, no model was asked — never a candidate dispatch
|
|
345
345
|
});
|
|
346
346
|
lastFailure = failure;
|
|
347
347
|
if (ledger.consume("network")) {
|
|
348
348
|
await sleep(ledger.delayMs("network"));
|
|
349
349
|
continue;
|
|
350
350
|
}
|
|
351
|
-
candidate =
|
|
351
|
+
candidate = nextCandidate();
|
|
352
352
|
continue;
|
|
353
353
|
}
|
|
354
354
|
}
|
|
@@ -360,7 +360,7 @@ async function run(deps, routeName, opts) {
|
|
|
360
360
|
const useJsonModeCoaching = route.outputSchema !== null &&
|
|
361
361
|
(route.policy.json === "json_mode" || !flags.has("structured_native"));
|
|
362
362
|
if (useJsonModeCoaching) {
|
|
363
|
-
systemPrompt += jsonModeCoaching(route.outputSchema);
|
|
363
|
+
systemPrompt += (0, dispatch_1.jsonModeCoaching)(route.outputSchema);
|
|
364
364
|
}
|
|
365
365
|
// Envelope precheck BEFORE dispatch — upper-bound estimate from the
|
|
366
366
|
// pricing snapshot (prompt-length input + full output budget).
|
|
@@ -404,6 +404,7 @@ async function run(deps, routeName, opts) {
|
|
|
404
404
|
attemptsByClass: ledger.snapshot(),
|
|
405
405
|
servedVariant,
|
|
406
406
|
pricingMissing,
|
|
407
|
+
callId: ladder.callId,
|
|
407
408
|
});
|
|
408
409
|
}
|
|
409
410
|
const outcome = (0, validate_1.validateOutput)(route, result.text);
|
|
@@ -440,6 +441,7 @@ async function run(deps, routeName, opts) {
|
|
|
440
441
|
attemptsByClass: ledger.snapshot(),
|
|
441
442
|
servedVariant,
|
|
442
443
|
repairedBy: null,
|
|
444
|
+
callId: ladder.callId,
|
|
443
445
|
...(injectedSources !== null
|
|
444
446
|
? { citations: (0, grounding_1.extractCitations)(result.text, injectedSources) }
|
|
445
447
|
: {}),
|
|
@@ -491,7 +493,7 @@ async function run(deps, routeName, opts) {
|
|
|
491
493
|
if (ledger.consume("content_invalid")) {
|
|
492
494
|
continue; // retry the SAME candidate until the class budget is spent
|
|
493
495
|
}
|
|
494
|
-
candidate =
|
|
496
|
+
candidate = nextCandidate(); // then advance within the declared set
|
|
495
497
|
continue;
|
|
496
498
|
}
|
|
497
499
|
// Adapter-level typed failure. F1: refusals/truncations that BILLED
|
|
@@ -531,7 +533,7 @@ async function run(deps, routeName, opts) {
|
|
|
531
533
|
await sleep(ledger.delayMs(failure.class));
|
|
532
534
|
continue; // retry the SAME candidate
|
|
533
535
|
}
|
|
534
|
-
candidate =
|
|
536
|
+
candidate = nextCandidate(); // class budget spent — advance candidate
|
|
535
537
|
}
|
|
536
538
|
throw new failures_1.RigFailureError(lastFailure ?? {
|
|
537
539
|
class: "network",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"exporter.d.ts","sourceRoot":"","sources":["../../src/telemetry/exporter.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAC;AAErE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gBAAgB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E,GACvC,WAAW,CAcb"}
|
|
@@ -94,6 +94,12 @@ function toWireInference(row) {
|
|
|
94
94
|
tokens_cache_write_1h: row.tokensCacheWrite1h ?? 0,
|
|
95
95
|
cache_key: row.cacheKey ?? null,
|
|
96
96
|
prefix_fingerprint: row.prefixFingerprint ?? null,
|
|
97
|
+
// Ladder key (spec §2.1 R0) — spread-iff-present: a row without it (pre-0.4.0
|
|
98
|
+
// SDK, read back as null) emits NO key, so the wire payload is byte-identical
|
|
99
|
+
// to before R0 and the server leaves the column null.
|
|
100
|
+
...(row.callId != null ? { call_id: row.callId } : {}),
|
|
101
|
+
...(row.attemptSeq != null ? { attempt_seq: row.attemptSeq } : {}),
|
|
102
|
+
...(row.candidateIndex != null ? { candidate_index: row.candidateIndex } : {}),
|
|
97
103
|
};
|
|
98
104
|
}
|
|
99
105
|
function toWireRun(row) {
|
|
@@ -83,6 +83,13 @@ export interface WireInference {
|
|
|
83
83
|
readonly tokens_cache_write_1h?: number;
|
|
84
84
|
readonly cache_key?: string | null;
|
|
85
85
|
readonly prefix_fingerprint?: string | null;
|
|
86
|
+
/** Per-call ladder key (routing-console spec §2.1 R0). OPTIONAL on the wire and
|
|
87
|
+
* OMITTED when unset (spread-iff-present in the exporter), so an older SDK's
|
|
88
|
+
* payload is byte-identical and the server defaults the columns to null.
|
|
89
|
+
* `attempt_seq ≥ 1`, `candidate_index ≥ 0` (ingest.validInference). */
|
|
90
|
+
readonly call_id?: string;
|
|
91
|
+
readonly attempt_seq?: number;
|
|
92
|
+
readonly candidate_index?: number;
|
|
86
93
|
}
|
|
87
94
|
export interface WireFeedback {
|
|
88
95
|
readonly id: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ingest-protocol.d.ts","sourceRoot":"","sources":["../../src/telemetry/ingest-protocol.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mBAA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AClD,0DAA0D;IAC1D,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B;2EACuE;IACvE,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAC;CACzB;AAED;;;;;;GAMG;AACH,wBAAgB,UAAU,CAAC,KAAK,EAAE,WAAW,EAAE,OAAO,EAAE,OAAO,GAAG,UAAU,EAAE,CAgT7E;AAED;;;;;;GAMG;AACH,wBAAgB,kBAAkB,CAChC,IAAI,EAAE,SAAS,YAAY,EAAE,EAC7B,QAAQ,EAAE,MAAM,GACf,SAAS,MAAM,EAAE,CAInB;AAED;;oBAEoB;AACpB,MAAM,WAAW,aAAa;IAC5B,QAAQ,CAAC,QAAQ,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;IACpD,QAAQ,CAAC,OAAO,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;IACnD;qCACiC;IACjC,QAAQ,CAAC,OAAO,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;CACpD"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"load-error-report.d.ts","sourceRoot":"","sources":["../../src/telemetry/load-error-report.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAIH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAC3C,OAAO,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AAOpD,wBAAgB,eAAe,CAAC,MAAM,EAAE,SAAS,EAAE,KAAK,EAAE,gBAAgB,GAAG,IAAI,
|
|
1
|
+
{"version":3,"file":"load-error-report.d.ts","sourceRoot":"","sources":["../../src/telemetry/load-error-report.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAIH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAC3C,OAAO,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AAOpD,wBAAgB,eAAe,CAAC,MAAM,EAAE,SAAS,EAAE,KAAK,EAAE,gBAAgB,GAAG,IAAI,CAsBhF"}
|
|
@@ -35,7 +35,10 @@ function reportLoadError(config, error) {
|
|
|
35
35
|
// name/dimensions/contribution so the reporting upsert doesn't blank them.
|
|
36
36
|
let manifestMeta = null;
|
|
37
37
|
try {
|
|
38
|
-
|
|
38
|
+
// routesDir === null is a runRaw-only rig with no manifest (CE-8); it never
|
|
39
|
+
// reaches here (load errors come from the string path), so null ⇒ no meta.
|
|
40
|
+
if (config.routesDir !== null)
|
|
41
|
+
manifestMeta = (0, manifest_1.loadManifest)((0, node_path_1.dirname)(config.routesDir));
|
|
39
42
|
}
|
|
40
43
|
catch {
|
|
41
44
|
// rig.yaml is itself broken/absent; fall back to source-id naming so the
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"otel-map.d.ts","sourceRoot":"","sources":["../../src/telemetry/otel-map.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAGH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AACvD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAEtD;4EAC4E;AAC5E,eAAO,MAAM,eAAe,WAAW,CAAC;AAMxC;sCACsC;AACtC,QAAA,MAAM,YAAY,IAAI,CAAC;AACvB,QAAA,MAAM,YAAY,IAAI,CAAC;AAGvB,MAAM,MAAM,YAAY,GACpB;IAAE,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAA;CAAE,GAChC;IAAE,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAA;CAAE,GAC7B;IAAE,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAA;CAAE,GAChC;IAAE,QAAQ,CAAC,SAAS,EAAE,OAAO,CAAA;CAAE,CAAC;AAEpC,MAAM,WAAW,aAAa;IAC5B,QAAQ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AChF,eAAO,MAAM,eAAe,qBAAqB,CAAC;AAKlD,MAAM,WAAW,WAAW;IAC1B,6DAA6D;IAC7D,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,oDAAoD;IACpD,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;CAC/B;AAED;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,MAAM,GAAG,SAAS,GAAG,IAAI,GAAG,WAAW,GAAG,IAAI,CAQrF;AAwCD;;;GAGG;AACH,wBAAgB,eAAe,CAAC,GAAG,EAAE,YAAY,GAAG,YAAY,CA8D/D;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,2BAA2B,CAAC,GAAG,EAAE,YAAY,GAAG,aAAa,EAAE,CAiB9E;AAED;;;GAGG;AACH,wBAAgB,uBAAuB,CACrC,KAAK,EAAE,SAAS,YAAY,EAAE,EAC9B,QAAQ,EAAE,YAAY,GACrB,6BAA6B,CAgB/B"}
|
|
@@ -146,6 +146,14 @@ function inferenceToSpan(row) {
|
|
|
146
146
|
attrs.push(strAttr("modelrig.served_variant", row.servedVariant));
|
|
147
147
|
if (row.repairedBy !== null)
|
|
148
148
|
attrs.push(strAttr("modelrig.repaired_by", row.repairedBy));
|
|
149
|
+
// Per-call ladder key (spec §2.1 R0) — emitted only when present, so a pre-0.4.0
|
|
150
|
+
// row's span is byte-identical to before R0.
|
|
151
|
+
if (row.callId != null)
|
|
152
|
+
attrs.push(strAttr("modelrig.call_id", row.callId));
|
|
153
|
+
if (row.attemptSeq != null)
|
|
154
|
+
attrs.push(intAttr("modelrig.attempt_seq", row.attemptSeq));
|
|
155
|
+
if (row.candidateIndex != null)
|
|
156
|
+
attrs.push(intAttr("modelrig.candidate_index", row.candidateIndex));
|
|
149
157
|
if (row.fingerprintCell !== null) {
|
|
150
158
|
// Irreversible by construction (a schema hash) — safe to emit (spec §3).
|
|
151
159
|
attrs.push(strAttr("modelrig.fingerprint_cell", row.fingerprintCell));
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* SQLite telemetry-store migration ladder — extracted from store.ts.
|
|
3
|
+
*
|
|
4
|
+
* Every rung is idempotent on every open: a FRESH database gets the full current
|
|
5
|
+
* schema from `SCHEMA_SQL` (store.ts) and each rung only stamps `user_version`;
|
|
6
|
+
* an OLDER database (whose CREATEs were no-ops) gains the additive columns via
|
|
7
|
+
* `ALTER TABLE … ADD COLUMN`, existing rows reading the nullable/default value.
|
|
8
|
+
* The ladder lives here so store.ts stays under the LOC cap and a new schema
|
|
9
|
+
* epoch is one self-contained rung to add.
|
|
10
|
+
*/
|
|
11
|
+
import type Database from "better-sqlite3";
|
|
12
|
+
/** Apply every pending schema migration to an open telemetry database. Safe to
|
|
13
|
+
* call on every open (idempotent). */
|
|
14
|
+
export declare function runStoreMigrations(db: Database.Database): void;
|
|
15
|
+
//# sourceMappingURL=store-migrations.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"store-migrations.d.ts","sourceRoot":"","sources":["../../src/telemetry/store-migrations.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,KAAK,QAAQ,MAAM,gBAAgB,CAAC;AAE3C;sCACsC;AACtC,wBAAgB,kBAAkB,CAAC,EAAE,EAAE,QAAQ,CAAC,QAAQ,GAAG,IAAI,CAuG9D"}
|