audit-tools 0.32.13 → 0.32.15
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/dist/audit/cli/dispatch/quotaPool.d.ts +6 -0
- package/dist/audit/cli/dispatch/quotaPool.d.ts.map +1 -1
- package/dist/audit/cli/dispatch/quotaPool.js +11 -4
- package/dist/audit/cli/dispatch/quotaPool.js.map +1 -1
- package/dist/audit/cli/dispatch.d.ts.map +1 -1
- package/dist/audit/cli/dispatch.js +6 -1
- package/dist/audit/cli/dispatch.js.map +1 -1
- package/dist/audit/cli/nextStepCommand.d.ts.map +1 -1
- package/dist/audit/cli/nextStepCommand.js +29 -0
- package/dist/audit/cli/nextStepCommand.js.map +1 -1
- package/dist/audit/cli/nextStepHelpers.d.ts +4 -0
- package/dist/audit/cli/nextStepHelpers.d.ts.map +1 -1
- package/dist/audit/cli/nextStepHelpers.js +57 -5
- package/dist/audit/cli/nextStepHelpers.js.map +1 -1
- package/dist/audit/cli/providerConfirmationStep.d.ts +24 -0
- package/dist/audit/cli/providerConfirmationStep.d.ts.map +1 -0
- package/dist/audit/cli/providerConfirmationStep.js +93 -0
- package/dist/audit/cli/providerConfirmationStep.js.map +1 -0
- package/dist/audit/cli/steps.d.ts +4 -4
- package/dist/audit/cli/steps.d.ts.map +1 -1
- package/dist/audit/cli/steps.js +1 -0
- package/dist/audit/cli/steps.js.map +1 -1
- package/dist/audit/orchestrator/executorRunners.js +1 -1
- package/dist/audit/orchestrator/executorRunners.js.map +1 -1
- package/dist/audit/orchestrator/intakeExecutors.d.ts +1 -1
- package/dist/audit/orchestrator/intakeExecutors.d.ts.map +1 -1
- package/dist/audit/orchestrator/intakeExecutors.js +21 -5
- package/dist/audit/orchestrator/intakeExecutors.js.map +1 -1
- package/dist/audit/orchestrator/providerConfirmation.d.ts +6 -2
- package/dist/audit/orchestrator/providerConfirmation.d.ts.map +1 -1
- package/dist/audit/orchestrator/providerConfirmation.js +11 -3
- package/dist/audit/orchestrator/providerConfirmation.js.map +1 -1
- package/dist/remediate/steps/dispatch.d.ts +6 -1
- package/dist/remediate/steps/dispatch.d.ts.map +1 -1
- package/dist/remediate/steps/dispatch.js +24 -7
- package/dist/remediate/steps/dispatch.js.map +1 -1
- package/dist/shared/dispatch/costRank.d.ts +114 -0
- package/dist/shared/dispatch/costRank.d.ts.map +1 -0
- package/dist/shared/dispatch/costRank.js +155 -0
- package/dist/shared/dispatch/costRank.js.map +1 -0
- package/dist/shared/index.d.ts +6 -4
- package/dist/shared/index.d.ts.map +1 -1
- package/dist/shared/index.js +5 -3
- package/dist/shared/index.js.map +1 -1
- package/dist/shared/providers/providerConfirmation.d.ts +39 -0
- package/dist/shared/providers/providerConfirmation.d.ts.map +1 -1
- package/dist/shared/providers/providerConfirmation.js +95 -0
- package/dist/shared/providers/providerConfirmation.js.map +1 -1
- package/dist/shared/providers/sharedProviderConfirmation.d.ts +42 -2
- package/dist/shared/providers/sharedProviderConfirmation.d.ts.map +1 -1
- package/dist/shared/providers/sharedProviderConfirmation.js +128 -3
- package/dist/shared/providers/sharedProviderConfirmation.js.map +1 -1
- package/dist/shared/types/providerConfirmation.d.ts +93 -1
- package/dist/shared/types/providerConfirmation.d.ts.map +1 -1
- package/dist/shared/types/providerConfirmation.js +17 -1
- package/dist/shared/types/providerConfirmation.js.map +1 -1
- package/package.json +1 -1
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
*/
|
|
34
34
|
import type { ResolvedProviderName, SessionConfig } from "../types/sessionConfig.js";
|
|
35
35
|
import type { RunLogger } from "../observability/runLog.js";
|
|
36
|
-
import type { ConfirmedPoolEntry } from "../types/providerConfirmation.js";
|
|
36
|
+
import type { ConfirmedPoolEntry, HostModelCostEntry, ProviderConfirmationInput } from "../types/providerConfirmation.js";
|
|
37
37
|
/**
|
|
38
38
|
* Schema version for the shared confirmation artifact. Bumped independently of
|
|
39
39
|
* the per-tool seam contract (PROVIDER_CONFIRMATION_RESULT_VERSION) — this is
|
|
@@ -62,6 +62,13 @@ export interface SharedProviderConfirmation {
|
|
|
62
62
|
confirmed_at: string;
|
|
63
63
|
/** Confirmed provider pool, with exclusion flags. */
|
|
64
64
|
provider_pool: ConfirmedPoolEntry[];
|
|
65
|
+
/**
|
|
66
|
+
* Host self-reported model tiers with their operator-confirmed cost positions
|
|
67
|
+
* (follow-up c). Merged into the model-keyed dispatch positions map by
|
|
68
|
+
* `readConfirmedCostPositions` so host-native tiers route by their confirmed
|
|
69
|
+
* order. Absent/empty on the headless path (no host roster is reported).
|
|
70
|
+
*/
|
|
71
|
+
host_model_cost_order?: HostModelCostEntry[];
|
|
65
72
|
/**
|
|
66
73
|
* Sorted snapshot of the provider NAMES discovered when this was written.
|
|
67
74
|
* Compared against the current discovered roster to detect staleness.
|
|
@@ -112,8 +119,15 @@ export declare function currentProviderRoster(sessionConfig: SessionConfig, env?
|
|
|
112
119
|
* overriding the default self-spawn-blocked exclusion for those names.
|
|
113
120
|
* @param detectCommand - Injectable PATH-detection hook, forwarded to
|
|
114
121
|
* `discoverProviders` so tests can drive discovery deterministically.
|
|
122
|
+
* @param input - Operator's Gate-0 submission (interactive path): its
|
|
123
|
+
* `cost_order` overrides the suggested ordering and its `host_models` become
|
|
124
|
+
* priced, orderable host-native tiers (`host_model_cost_order`). Omit for the
|
|
125
|
+
* headless / no-operator path — the tool then emits its price-ascending
|
|
126
|
+
* suggestion with no host models, exactly as before. `exclude`/`include` are
|
|
127
|
+
* passed via the dedicated params above (the executor forwards them from the
|
|
128
|
+
* same input), so this arg governs ordering + host roster only.
|
|
115
129
|
*/
|
|
116
|
-
export declare function buildSharedProviderConfirmation(sessionConfig?: SessionConfig, env?: NodeJS.ProcessEnv, exclude?: ResolvedProviderName[], include?: ResolvedProviderName[], detectCommand?: (command: string) => boolean): SharedProviderConfirmation;
|
|
130
|
+
export declare function buildSharedProviderConfirmation(sessionConfig?: SessionConfig, env?: NodeJS.ProcessEnv, exclude?: ResolvedProviderName[], include?: ResolvedProviderName[], detectCommand?: (command: string) => boolean, input?: ProviderConfirmationInput): SharedProviderConfirmation;
|
|
117
131
|
/**
|
|
118
132
|
* Atomically write the shared confirmation to
|
|
119
133
|
* `<root>/.audit-tools/provider-confirmation.json`. The durable write goes
|
|
@@ -143,4 +157,30 @@ export declare function writeSharedProviderConfirmation(root: string, confirmati
|
|
|
143
157
|
* complete file either way — CE-003) and so cannot deadlock against a writer.
|
|
144
158
|
*/
|
|
145
159
|
export declare function readSharedProviderConfirmation(root: string, sessionConfig?: SessionConfig, env?: NodeJS.ProcessEnv): Promise<SharedProviderConfirmationRead>;
|
|
160
|
+
/**
|
|
161
|
+
* Read the operator-confirmed cost ordering (rung 1 of costRank; see
|
|
162
|
+
* spec/cost-first-routing.md) from the shared Gate-0 confirmation as a model-keyed
|
|
163
|
+
* `Map<model_id, cost_order>` for the dispatch build sites. Single-sourced so audit
|
|
164
|
+
* and remediate honor it identically. Best-effort and never throws: an absent
|
|
165
|
+
* `root`, a missing/malformed confirmation, or a roster that has since changed
|
|
166
|
+
* (`reconfirm`) all yield an empty map — dispatch then falls to real price then
|
|
167
|
+
* tier. Only a `confirmed` (roster-fresh) confirmation contributes positions.
|
|
168
|
+
*/
|
|
169
|
+
export declare function readConfirmedCostPositions(root: string | undefined, sessionConfig?: SessionConfig, env?: NodeJS.ProcessEnv): Promise<Map<string, number>>;
|
|
170
|
+
/** File name of the host-written Gate-0 input under the audit artifacts dir. */
|
|
171
|
+
export declare const PROVIDER_CONFIRMATION_INPUT_FILENAME = "provider-confirmation.input.json";
|
|
172
|
+
/**
|
|
173
|
+
* Validate a parsed value as a ProviderConfirmationInput. Degrade-safe: returns
|
|
174
|
+
* `null` for absent/malformed so a missing or corrupt input is never an error
|
|
175
|
+
* (the executor then falls back to the tool's suggested ordering). Only the
|
|
176
|
+
* version is required; every other field is optional and validated to its
|
|
177
|
+
* expected shape (a malformed field is dropped, not fatal).
|
|
178
|
+
*/
|
|
179
|
+
export declare function parseProviderConfirmationInput(value: unknown): ProviderConfirmationInput | null;
|
|
180
|
+
/**
|
|
181
|
+
* Read the operator's Gate-0 input from `<artifactsDir>/provider-confirmation.input.json`.
|
|
182
|
+
* Returns `null` when the file is absent, unreadable, or malformed — the "operator
|
|
183
|
+
* has not acted yet" signal the gate uses to decide emit-vs-consume. Never throws.
|
|
184
|
+
*/
|
|
185
|
+
export declare function readProviderConfirmationInput(artifactsDir: string): Promise<ProviderConfirmationInput | null>;
|
|
146
186
|
//# sourceMappingURL=sharedProviderConfirmation.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sharedProviderConfirmation.d.ts","sourceRoot":"","sources":["../../../src/shared/providers/sharedProviderConfirmation.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AAIH,OAAO,KAAK,EAAE,oBAAoB,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAIrF,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,4BAA4B,CAAC;
|
|
1
|
+
{"version":3,"file":"sharedProviderConfirmation.d.ts","sourceRoot":"","sources":["../../../src/shared/providers/sharedProviderConfirmation.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AAIH,OAAO,KAAK,EAAE,oBAAoB,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAIrF,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,4BAA4B,CAAC;AAO5D,OAAO,KAAK,EACV,kBAAkB,EAClB,kBAAkB,EAClB,yBAAyB,EAC1B,MAAM,kCAAkC,CAAC;AAO1C;;;;;GAKG;AACH,eAAO,MAAM,oCAAoC,EAAG,OAAgB,CAAC;AAErE,gFAAgF;AAChF,eAAO,MAAM,qCAAqC,+BACpB,CAAC;AAE/B,mEAAmE;AACnE,wBAAgB,8BAA8B,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAEnE;AAMD;;;;;;;GAOG;AACH,MAAM,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AAkFD;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAsB,8BAA8B,CAClD,IAAI,EAAE,MAAM,EACZ,aAAa,GAAE,aAAkB,EACjC,GAAG,GAAE,MAAM,CAAC,UAAwB,GACnC,OAAO,CAAC,8BAA8B,CAAC,CA8BzC;AAED;;;;;;;;GAQG;AACH,wBAAsB,0BAA0B,CAC9C,IAAI,EAAE,MAAM,GAAG,SAAS,EACxB,aAAa,GAAE,aAAkB,EACjC,GAAG,GAAE,MAAM,CAAC,UAAwB,GACnC,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAmB9B;AAMD,gFAAgF;AAChF,eAAO,MAAM,oCAAoC,qCACb,CAAC;AAErC;;;;;;GAMG;AACH,wBAAgB,8BAA8B,CAC5C,KAAK,EAAE,OAAO,GACb,yBAAyB,GAAG,IAAI,CAuClC;AAED;;;;GAIG;AACH,wBAAsB,6BAA6B,CACjD,YAAY,EAAE,MAAM,GACnB,OAAO,CAAC,yBAAyB,GAAG,IAAI,CAAC,CAS3C"}
|
|
@@ -36,7 +36,9 @@ import { join } from "node:path";
|
|
|
36
36
|
import { auditToolsDir } from "../io/auditToolsPaths.js";
|
|
37
37
|
import { readJsonFile, writeJsonFile } from "../io/json.js";
|
|
38
38
|
import { withFileLock } from "../quota/fileLock.js";
|
|
39
|
-
import { discoverProviders, } from "./providerConfirmation.js";
|
|
39
|
+
import { discoverProviders, annotateConfirmedPool, } from "./providerConfirmation.js";
|
|
40
|
+
import { resolveConfirmedCostPositions } from "../dispatch/costRank.js";
|
|
41
|
+
import { PROVIDER_CONFIRMATION_INPUT_VERSION } from "../types/providerConfirmation.js";
|
|
40
42
|
// ---------------------------------------------------------------------------
|
|
41
43
|
// Version + on-disk location
|
|
42
44
|
// ---------------------------------------------------------------------------
|
|
@@ -106,8 +108,15 @@ function rostersEqual(a, b) {
|
|
|
106
108
|
* overriding the default self-spawn-blocked exclusion for those names.
|
|
107
109
|
* @param detectCommand - Injectable PATH-detection hook, forwarded to
|
|
108
110
|
* `discoverProviders` so tests can drive discovery deterministically.
|
|
111
|
+
* @param input - Operator's Gate-0 submission (interactive path): its
|
|
112
|
+
* `cost_order` overrides the suggested ordering and its `host_models` become
|
|
113
|
+
* priced, orderable host-native tiers (`host_model_cost_order`). Omit for the
|
|
114
|
+
* headless / no-operator path — the tool then emits its price-ascending
|
|
115
|
+
* suggestion with no host models, exactly as before. `exclude`/`include` are
|
|
116
|
+
* passed via the dedicated params above (the executor forwards them from the
|
|
117
|
+
* same input), so this arg governs ordering + host roster only.
|
|
109
118
|
*/
|
|
110
|
-
export function buildSharedProviderConfirmation(sessionConfig = {}, env = process.env, exclude = [], include = [], detectCommand) {
|
|
119
|
+
export function buildSharedProviderConfirmation(sessionConfig = {}, env = process.env, exclude = [], include = [], detectCommand, input) {
|
|
111
120
|
const discovered = discoverProviders(sessionConfig, env, detectCommand);
|
|
112
121
|
const excludeSet = new Set(exclude);
|
|
113
122
|
const includeSet = new Set(include);
|
|
@@ -138,11 +147,18 @@ export function buildSharedProviderConfirmation(sessionConfig = {}, env = proces
|
|
|
138
147
|
reason: provider.reason,
|
|
139
148
|
});
|
|
140
149
|
}
|
|
150
|
+
// Cost-first routing: annotate with representative model price + cost_order,
|
|
151
|
+
// read at dispatch as rung 1 of costRank (spec/cost-first-routing.md). When an
|
|
152
|
+
// operator input is present its ordering wins and its host roster is priced.
|
|
153
|
+
const annotated = annotateConfirmedPool(pool, sessionConfig, input);
|
|
141
154
|
return {
|
|
142
155
|
schema_version: SHARED_PROVIDER_CONFIRMATION_VERSION,
|
|
143
156
|
session_level: true,
|
|
144
157
|
confirmed_at: new Date().toISOString(),
|
|
145
|
-
provider_pool:
|
|
158
|
+
provider_pool: annotated.provider_pool,
|
|
159
|
+
...(annotated.host_model_cost_order.length > 0
|
|
160
|
+
? { host_model_cost_order: annotated.host_model_cost_order }
|
|
161
|
+
: {}),
|
|
146
162
|
roster: sortRoster(discovered.map((p) => p.name)),
|
|
147
163
|
};
|
|
148
164
|
}
|
|
@@ -183,6 +199,16 @@ function isConfirmedPoolEntry(value) {
|
|
|
183
199
|
typeof obj.capability_tier === "string" &&
|
|
184
200
|
typeof obj.excluded === "boolean");
|
|
185
201
|
}
|
|
202
|
+
function isHostModelCostEntry(value) {
|
|
203
|
+
if (value === null || typeof value !== "object" || Array.isArray(value)) {
|
|
204
|
+
return false;
|
|
205
|
+
}
|
|
206
|
+
const obj = value;
|
|
207
|
+
return (typeof obj.model_id === "string" &&
|
|
208
|
+
(obj.blended_price_usd_per_mtok === null ||
|
|
209
|
+
typeof obj.blended_price_usd_per_mtok === "number") &&
|
|
210
|
+
typeof obj.cost_order === "number");
|
|
211
|
+
}
|
|
186
212
|
/**
|
|
187
213
|
* Validate a parsed value as a SharedProviderConfirmation. Returns the typed
|
|
188
214
|
* value or `null` when any required field is missing or malformed — a corrupt
|
|
@@ -205,11 +231,20 @@ function parseSharedProviderConfirmation(value) {
|
|
|
205
231
|
}
|
|
206
232
|
if (!isResolvedProviderNameArray(obj.roster))
|
|
207
233
|
return null;
|
|
234
|
+
// host_model_cost_order is optional + additive; a malformed value degrades to
|
|
235
|
+
// absent (the field never blocks parsing — INV-DC1-6 never-block spirit).
|
|
236
|
+
const hostModels = Array.isArray(obj.host_model_cost_order) &&
|
|
237
|
+
obj.host_model_cost_order.every(isHostModelCostEntry)
|
|
238
|
+
? obj.host_model_cost_order
|
|
239
|
+
: undefined;
|
|
208
240
|
return {
|
|
209
241
|
schema_version: SHARED_PROVIDER_CONFIRMATION_VERSION,
|
|
210
242
|
session_level: true,
|
|
211
243
|
confirmed_at: obj.confirmed_at,
|
|
212
244
|
provider_pool: obj.provider_pool,
|
|
245
|
+
...(hostModels && hostModels.length > 0
|
|
246
|
+
? { host_model_cost_order: hostModels }
|
|
247
|
+
: {}),
|
|
213
248
|
roster: obj.roster,
|
|
214
249
|
};
|
|
215
250
|
}
|
|
@@ -262,4 +297,94 @@ export async function readSharedProviderConfirmation(root, sessionConfig = {}, e
|
|
|
262
297
|
}
|
|
263
298
|
return { status: "confirmed", confirmation };
|
|
264
299
|
}
|
|
300
|
+
/**
|
|
301
|
+
* Read the operator-confirmed cost ordering (rung 1 of costRank; see
|
|
302
|
+
* spec/cost-first-routing.md) from the shared Gate-0 confirmation as a model-keyed
|
|
303
|
+
* `Map<model_id, cost_order>` for the dispatch build sites. Single-sourced so audit
|
|
304
|
+
* and remediate honor it identically. Best-effort and never throws: an absent
|
|
305
|
+
* `root`, a missing/malformed confirmation, or a roster that has since changed
|
|
306
|
+
* (`reconfirm`) all yield an empty map — dispatch then falls to real price then
|
|
307
|
+
* tier. Only a `confirmed` (roster-fresh) confirmation contributes positions.
|
|
308
|
+
*/
|
|
309
|
+
export async function readConfirmedCostPositions(root, sessionConfig = {}, env = process.env) {
|
|
310
|
+
if (!root)
|
|
311
|
+
return new Map();
|
|
312
|
+
const read = await readSharedProviderConfirmation(root, sessionConfig, env);
|
|
313
|
+
if (!read || read.status !== "confirmed")
|
|
314
|
+
return new Map();
|
|
315
|
+
// Provider-pool positions (configured models) PLUS any host-native tiers the
|
|
316
|
+
// operator confirmed at Gate-0 (follow-up c). Both are model-keyed; a host tier
|
|
317
|
+
// and a configured pool thread to dispatch identically. Host entries are already
|
|
318
|
+
// in the single unified cost order, so a plain merge preserves the total order.
|
|
319
|
+
const positions = resolveConfirmedCostPositions(read.confirmation.provider_pool);
|
|
320
|
+
for (const entry of read.confirmation.host_model_cost_order ?? []) {
|
|
321
|
+
if (entry.model_id &&
|
|
322
|
+
Number.isFinite(entry.cost_order) &&
|
|
323
|
+
entry.cost_order >= 0) {
|
|
324
|
+
positions.set(entry.model_id, entry.cost_order);
|
|
325
|
+
}
|
|
326
|
+
}
|
|
327
|
+
return positions;
|
|
328
|
+
}
|
|
329
|
+
// ---------------------------------------------------------------------------
|
|
330
|
+
// Interactive Gate-0 operator input (spec/cost-first-routing.md — Gate-0)
|
|
331
|
+
// ---------------------------------------------------------------------------
|
|
332
|
+
/** File name of the host-written Gate-0 input under the audit artifacts dir. */
|
|
333
|
+
export const PROVIDER_CONFIRMATION_INPUT_FILENAME = "provider-confirmation.input.json";
|
|
334
|
+
/**
|
|
335
|
+
* Validate a parsed value as a ProviderConfirmationInput. Degrade-safe: returns
|
|
336
|
+
* `null` for absent/malformed so a missing or corrupt input is never an error
|
|
337
|
+
* (the executor then falls back to the tool's suggested ordering). Only the
|
|
338
|
+
* version is required; every other field is optional and validated to its
|
|
339
|
+
* expected shape (a malformed field is dropped, not fatal).
|
|
340
|
+
*/
|
|
341
|
+
export function parseProviderConfirmationInput(value) {
|
|
342
|
+
if (value === null || typeof value !== "object" || Array.isArray(value)) {
|
|
343
|
+
return null;
|
|
344
|
+
}
|
|
345
|
+
const obj = value;
|
|
346
|
+
if (obj.schema_version !== PROVIDER_CONFIRMATION_INPUT_VERSION)
|
|
347
|
+
return null;
|
|
348
|
+
const stringArray = (v) => Array.isArray(v) && v.every((x) => typeof x === "string")
|
|
349
|
+
? v
|
|
350
|
+
: undefined;
|
|
351
|
+
const costOrder = stringArray(obj.cost_order);
|
|
352
|
+
const exclude = stringArray(obj.exclude);
|
|
353
|
+
const include = stringArray(obj.include);
|
|
354
|
+
const hostModels = Array.isArray(obj.host_models)
|
|
355
|
+
? obj.host_models
|
|
356
|
+
.filter((m) => m !== null &&
|
|
357
|
+
typeof m === "object" &&
|
|
358
|
+
typeof m.model_id === "string")
|
|
359
|
+
.map((m) => ({
|
|
360
|
+
model_id: m.model_id,
|
|
361
|
+
...(typeof m.tier === "string"
|
|
362
|
+
? { tier: m.tier }
|
|
363
|
+
: {}),
|
|
364
|
+
}))
|
|
365
|
+
: undefined;
|
|
366
|
+
return {
|
|
367
|
+
schema_version: PROVIDER_CONFIRMATION_INPUT_VERSION,
|
|
368
|
+
...(costOrder ? { cost_order: costOrder } : {}),
|
|
369
|
+
...(exclude ? { exclude } : {}),
|
|
370
|
+
...(include ? { include } : {}),
|
|
371
|
+
...(hostModels && hostModels.length > 0 ? { host_models: hostModels } : {}),
|
|
372
|
+
};
|
|
373
|
+
}
|
|
374
|
+
/**
|
|
375
|
+
* Read the operator's Gate-0 input from `<artifactsDir>/provider-confirmation.input.json`.
|
|
376
|
+
* Returns `null` when the file is absent, unreadable, or malformed — the "operator
|
|
377
|
+
* has not acted yet" signal the gate uses to decide emit-vs-consume. Never throws.
|
|
378
|
+
*/
|
|
379
|
+
export async function readProviderConfirmationInput(artifactsDir) {
|
|
380
|
+
const path = join(artifactsDir, PROVIDER_CONFIRMATION_INPUT_FILENAME);
|
|
381
|
+
let raw;
|
|
382
|
+
try {
|
|
383
|
+
raw = await readJsonFile(path);
|
|
384
|
+
}
|
|
385
|
+
catch {
|
|
386
|
+
return null;
|
|
387
|
+
}
|
|
388
|
+
return parseProviderConfirmationInput(raw);
|
|
389
|
+
}
|
|
265
390
|
//# sourceMappingURL=sharedProviderConfirmation.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sharedProviderConfirmation.js","sourceRoot":"","sources":["../../../src/shared/providers/sharedProviderConfirmation.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AAEH,OAAO,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AACzC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEjC,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AACzD,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAC5D,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAEpD,OAAO,EACL,iBAAiB,
|
|
1
|
+
{"version":3,"file":"sharedProviderConfirmation.js","sourceRoot":"","sources":["../../../src/shared/providers/sharedProviderConfirmation.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AAEH,OAAO,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AACzC,OAAO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AAG,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,UAAU,EAAE,SAAS,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QAC/C,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QAC/B,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QAC/B,GAAG,CAAC,UAAU,IAAI,UAAU,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,WAAW,EAAE,UAAU,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;KAC5E,CAAC;AACJ,CAAC;AAED;;;;GAIG;AACH,MAAM,CAAC,KAAK,UAAU,6BAA6B,CACjD,YAAoB;IAEpB,MAAM,IAAI,GAAG,IAAI,CAAC,YAAY,EAAE,oCAAoC,CAAC,CAAC;IACtE,IAAI,GAAY,CAAC;IACjB,IAAI,CAAC;QACH,GAAG,GAAG,MAAM,YAAY,CAAU,IAAI,CAAC,CAAC;IAC1C,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,IAAI,CAAC;IACd,CAAC;IACD,OAAO,8BAA8B,CAAC,GAAG,CAAC,CAAC;AAC7C,CAAC"}
|
|
@@ -13,8 +13,78 @@ import type { CapabilityTier } from "../providers/providerConfirmation.js";
|
|
|
13
13
|
/**
|
|
14
14
|
* Version string for the ProviderConfirmationResult contract.
|
|
15
15
|
* Increment when any breaking interface change lands.
|
|
16
|
+
*
|
|
17
|
+
* 1.1.0 — additive cost-first-routing fields on ConfirmedPoolEntry
|
|
18
|
+
* (`model_id`, `blended_price_usd_per_mtok`, `cost_order`). See
|
|
19
|
+
* spec/cost-first-routing.md.
|
|
20
|
+
*/
|
|
21
|
+
export declare const PROVIDER_CONFIRMATION_RESULT_VERSION: "1.1.0";
|
|
22
|
+
/**
|
|
23
|
+
* Schema version for the operator-written Gate-0 input file
|
|
24
|
+
* (`<root>/.audit-tools/provider-confirmation.input.json`). The HOST writes this
|
|
25
|
+
* plain input; the tool owns the canonical envelope it is promoted into (the
|
|
26
|
+
* per-tool `provider_confirmation.json` seam + the shared
|
|
27
|
+
* `provider-confirmation.json`) — the input/envelope split so the tool stays the
|
|
28
|
+
* sole writer of the roster snapshot + cost annotation.
|
|
29
|
+
*/
|
|
30
|
+
export declare const PROVIDER_CONFIRMATION_INPUT_VERSION: "provider-confirmation-input/v1";
|
|
31
|
+
/**
|
|
32
|
+
* One model the host self-reports at the confirmation step so its host-native
|
|
33
|
+
* tiers are priced + ordered at Gate-0 (follow-up c) rather than only
|
|
34
|
+
* deterministically at dispatch. `model_id` is both the price-lookup key
|
|
35
|
+
* (models.dev) and the dispatch cost-position key. Never hardcoded — the host
|
|
36
|
+
* supplies it.
|
|
37
|
+
*/
|
|
38
|
+
export interface HostRosterModel {
|
|
39
|
+
/** Model id used to price (models.dev) and to key the dispatch cost position. */
|
|
40
|
+
model_id: string;
|
|
41
|
+
/** Optional capability tier for the price-unknown tiebreak in the suggestion. */
|
|
42
|
+
tier?: CapabilityTier;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* The operator's Gate-0 submission. Every field is optional beyond the version:
|
|
46
|
+
* an empty `{ schema_version }` accepts the tool's suggested ordering verbatim
|
|
47
|
+
* (the presence of the file is the "operator has acted" signal). The tool applies
|
|
48
|
+
* it degrade-safe — unknown keys in `cost_order` are ignored, omitted candidates
|
|
49
|
+
* keep their suggested relative order.
|
|
50
|
+
*/
|
|
51
|
+
export interface ProviderConfirmationInput {
|
|
52
|
+
/** Must equal PROVIDER_CONFIRMATION_INPUT_VERSION. */
|
|
53
|
+
schema_version: typeof PROVIDER_CONFIRMATION_INPUT_VERSION;
|
|
54
|
+
/**
|
|
55
|
+
* Operator's confirmed ordering as a list of candidate keys (provider names
|
|
56
|
+
* and/or host `model_id`s), cheapest-first. Array index becomes `cost_order`.
|
|
57
|
+
* Omit to accept the tool's price-ascending suggestion. A unified space over
|
|
58
|
+
* both provider pools and host models so one total cost order drives dispatch.
|
|
59
|
+
*/
|
|
60
|
+
cost_order?: string[];
|
|
61
|
+
/** Provider names to exclude from the dispatchable pool. */
|
|
62
|
+
exclude?: ResolvedProviderName[];
|
|
63
|
+
/** Self-spawn-blocked provider names the operator opts back IN. */
|
|
64
|
+
include?: ResolvedProviderName[];
|
|
65
|
+
/**
|
|
66
|
+
* Host self-reported model roster (follow-up c). Each becomes a priced,
|
|
67
|
+
* orderable candidate whose confirmed position threads to dispatch by
|
|
68
|
+
* `model_id` via `host_model_cost_order`.
|
|
69
|
+
*/
|
|
70
|
+
host_models?: HostRosterModel[];
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* A host-native model's persisted cost position (follow-up c). Lives on the
|
|
74
|
+
* shared confirmation alongside `provider_pool`; merged into the model-keyed
|
|
75
|
+
* dispatch positions map by `resolveConfirmedCostPositions` so a host tier routes
|
|
76
|
+
* by its operator-confirmed order exactly like a configured pool does. Kept as a
|
|
77
|
+
* separate list (not extra `provider_pool` entries) so no `provider_pool` consumer
|
|
78
|
+
* has to tolerate duplicate provider names.
|
|
16
79
|
*/
|
|
17
|
-
export
|
|
80
|
+
export interface HostModelCostEntry {
|
|
81
|
+
/** Host model id — the dispatch cost-position key. */
|
|
82
|
+
model_id: string;
|
|
83
|
+
/** Blended $/Mtok from models.dev, or `null` when unpriceable. Advisory. */
|
|
84
|
+
blended_price_usd_per_mtok: number | null;
|
|
85
|
+
/** Operator-confirmed 0-based cost position (rung 1 of costRank). */
|
|
86
|
+
cost_order: number;
|
|
87
|
+
}
|
|
18
88
|
/** One entry in the confirmed provider pool. */
|
|
19
89
|
export interface ConfirmedPoolEntry {
|
|
20
90
|
/** Canonical provider name. */
|
|
@@ -37,6 +107,28 @@ export interface ConfirmedPoolEntry {
|
|
|
37
107
|
self_spawn_blocked?: boolean;
|
|
38
108
|
/** Optional reason for exclusion or detection restriction. */
|
|
39
109
|
reason?: string;
|
|
110
|
+
/**
|
|
111
|
+
* Representative model id this entry is priced/ordered by (cost-first routing;
|
|
112
|
+
* spec/cost-first-routing.md). For a configured API pool it is the configured
|
|
113
|
+
* model; for a host-reported roster entry it is that roster model. Absent when
|
|
114
|
+
* the concrete model is not knowable at confirmation time (e.g. a CLI backend
|
|
115
|
+
* whose roster arrives only at the dispatch handshake).
|
|
116
|
+
*/
|
|
117
|
+
model_id?: string;
|
|
118
|
+
/**
|
|
119
|
+
* Suggested blended price ($/Mtok) the tool computed from the models.dev
|
|
120
|
+
* snapshot for `model_id`, or `null` when the dataset can't price it (surfaced
|
|
121
|
+
* to the operator as "price unknown"). Advisory — the authoritative routing key
|
|
122
|
+
* is `cost_order` once the operator confirms.
|
|
123
|
+
*/
|
|
124
|
+
blended_price_usd_per_mtok?: number | null;
|
|
125
|
+
/**
|
|
126
|
+
* Operator-confirmed 0-based cost position (rung 1 of costRank). Lower routes
|
|
127
|
+
* first. Defaults to the tool's price-ascending suggestion; the operator may
|
|
128
|
+
* reorder. Read back at dispatch via `resolveConfirmedCostPositions`. Absent ⇒
|
|
129
|
+
* the pool falls to real price then tier at dispatch.
|
|
130
|
+
*/
|
|
131
|
+
cost_order?: number;
|
|
40
132
|
}
|
|
41
133
|
/**
|
|
42
134
|
* Output of Gate-0 / Gate-1 provider confirmation.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"providerConfirmation.d.ts","sourceRoot":"","sources":["../../../src/shared/types/providerConfirmation.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAC;AAC/D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,sCAAsC,CAAC;AAM3E
|
|
1
|
+
{"version":3,"file":"providerConfirmation.d.ts","sourceRoot":"","sources":["../../../src/shared/types/providerConfirmation.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAA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IAClB;;;;;OAKG;IACH,0BAA0B,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3C;;;;;OAKG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED;;;;;GAKG;AACH,MAAM,WAAW,0BAA0B;IACzC,wEAAwE;IACxE,cAAc,EAAE,OAAO,oCAAoC,CAAC;IAC5D,yDAAyD;IACzD,YAAY,EAAE,MAAM,CAAC;IACrB,8EAA8E;IAC9E,aAAa,EAAE,kBAAkB,EAAE,CAAC;IACpC;;;OAGG;IACH,aAAa,EAAE,OAAO,CAAC;CACxB"}
|
|
@@ -14,6 +14,22 @@
|
|
|
14
14
|
/**
|
|
15
15
|
* Version string for the ProviderConfirmationResult contract.
|
|
16
16
|
* Increment when any breaking interface change lands.
|
|
17
|
+
*
|
|
18
|
+
* 1.1.0 — additive cost-first-routing fields on ConfirmedPoolEntry
|
|
19
|
+
* (`model_id`, `blended_price_usd_per_mtok`, `cost_order`). See
|
|
20
|
+
* spec/cost-first-routing.md.
|
|
21
|
+
*/
|
|
22
|
+
export const PROVIDER_CONFIRMATION_RESULT_VERSION = "1.1.0";
|
|
23
|
+
// ---------------------------------------------------------------------------
|
|
24
|
+
// Interactive Gate-0 operator input (spec/cost-first-routing.md — Gate-0)
|
|
25
|
+
// ---------------------------------------------------------------------------
|
|
26
|
+
/**
|
|
27
|
+
* Schema version for the operator-written Gate-0 input file
|
|
28
|
+
* (`<root>/.audit-tools/provider-confirmation.input.json`). The HOST writes this
|
|
29
|
+
* plain input; the tool owns the canonical envelope it is promoted into (the
|
|
30
|
+
* per-tool `provider_confirmation.json` seam + the shared
|
|
31
|
+
* `provider-confirmation.json`) — the input/envelope split so the tool stays the
|
|
32
|
+
* sole writer of the roster snapshot + cost annotation.
|
|
17
33
|
*/
|
|
18
|
-
export const
|
|
34
|
+
export const PROVIDER_CONFIRMATION_INPUT_VERSION = "provider-confirmation-input/v1";
|
|
19
35
|
//# sourceMappingURL=providerConfirmation.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"providerConfirmation.js","sourceRoot":"","sources":["../../../src/shared/types/providerConfirmation.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAKH,8EAA8E;AAC9E,mBAAmB;AACnB,8EAA8E;AAE9E
|
|
1
|
+
{"version":3,"file":"providerConfirmation.js","sourceRoot":"","sources":["../../../src/shared/types/providerConfirmation.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAKH,8EAA8E;AAC9E,mBAAmB;AACnB,8EAA8E;AAE9E;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,oCAAoC,GAAG,OAAgB,CAAC;AAErE,8EAA8E;AAC9E,0EAA0E;AAC1E,8EAA8E;AAE9E;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,mCAAmC,GAC9C,gCAAyC,CAAC"}
|