@cat-factory/kernel 0.225.0 → 0.227.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/dist/domain/binary-generators.d.ts +11 -28
- package/dist/domain/binary-generators.d.ts.map +1 -1
- package/dist/domain/binary-generators.js +64 -21
- package/dist/domain/binary-generators.js.map +1 -1
- package/dist/domain/catalog.d.ts +13 -1
- package/dist/domain/catalog.d.ts.map +1 -1
- package/dist/domain/catalog.js +16 -2
- package/dist/domain/catalog.js.map +1 -1
- package/dist/domain/change-class.d.ts +47 -1
- package/dist/domain/change-class.d.ts.map +1 -1
- package/dist/domain/change-class.js +59 -0
- package/dist/domain/change-class.js.map +1 -1
- package/dist/domain/llm-rollup.d.ts +51 -4
- package/dist/domain/llm-rollup.d.ts.map +1 -1
- package/dist/domain/llm-rollup.js +77 -5
- package/dist/domain/llm-rollup.js.map +1 -1
- package/dist/domain/seed.d.ts.map +1 -1
- package/dist/domain/seed.js +14 -4
- package/dist/domain/seed.js.map +1 -1
- package/dist/domain/types.d.ts +1 -1
- package/dist/domain/types.d.ts.map +1 -1
- package/dist/index.d.ts +4 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +7 -3
- package/dist/index.js.map +1 -1
- package/dist/ports/agent-executor.d.ts +1 -1
- package/dist/ports/index.d.ts +2 -1
- package/dist/ports/index.d.ts.map +1 -1
- package/dist/ports/index.js.map +1 -1
- package/dist/ports/llm-metrics.d.ts +37 -6
- package/dist/ports/llm-metrics.d.ts.map +1 -1
- package/dist/ports/llm-metrics.js.map +1 -1
- package/dist/ports/operational-metrics.d.ts +19 -1
- package/dist/ports/operational-metrics.d.ts.map +1 -1
- package/dist/ports/operational-metrics.js.map +1 -1
- package/dist/ports/runner-transport.d.ts +1 -1
- package/dist/ports/tutorial-progress-repositories.d.ts +17 -0
- package/dist/ports/tutorial-progress-repositories.d.ts.map +1 -0
- package/dist/ports/tutorial-progress-repositories.js +2 -0
- package/dist/ports/tutorial-progress-repositories.js.map +1 -0
- package/dist/shared/host-markdown.logic.d.ts +59 -0
- package/dist/shared/host-markdown.logic.d.ts.map +1 -1
- package/dist/shared/host-markdown.logic.js +100 -4
- package/dist/shared/host-markdown.logic.js.map +1 -1
- package/package.json +2 -2
|
@@ -80,32 +80,14 @@ export interface ResolvedBinaryGeneratorSelection {
|
|
|
80
80
|
* Resolve a step's `generatorIds` against the registry's views. Pure and shared by admission and
|
|
81
81
|
* the brief, so the two can never disagree about which integrations a step has — the brief runs
|
|
82
82
|
* per dispatch and would otherwise re-derive a set admission already judged.
|
|
83
|
-
*/
|
|
84
|
-
export declare function resolveBinaryGeneratorSelection(config: BinaryOutputConfig | undefined, generators: readonly BinaryGeneratorView[]): ResolvedBinaryGeneratorSelection;
|
|
85
|
-
/**
|
|
86
|
-
* How a step's declared FORMATS stand against what its selected integrations say they emit.
|
|
87
83
|
*
|
|
88
|
-
*
|
|
89
|
-
*
|
|
90
|
-
*
|
|
91
|
-
*
|
|
92
|
-
*
|
|
93
|
-
* of health nobody issued, on the surface that decides whether the run may start. So the run is
|
|
94
|
-
* admitted and the gap is STATED — to the agent in its brief, and to whoever composes the step —
|
|
95
|
-
* which is the same disposition `generatorsUnverified` takes on the settlement side.
|
|
96
|
-
*
|
|
97
|
-
* Pure and shared by admission, the brief and the SPA's mirror, so none of them can hold a
|
|
98
|
-
* different opinion about the same selection.
|
|
84
|
+
* A repeated id resolves ONCE, on its first appearance. Nothing refuses a stored selection that
|
|
85
|
+
* names one integration twice, and every reader downstream of this states a COUNT of some kind:
|
|
86
|
+
* left in, the brief renders that integration's whole entry a second time (an agent reading two
|
|
87
|
+
* identical entries has been told nothing and charged tokens for it) and an overlap report would
|
|
88
|
+
* say a step holds two producers of what it holds one of.
|
|
99
89
|
*/
|
|
100
|
-
export
|
|
101
|
-
/** Declared formats no selected integration emits, judged against integrations that DECLARED
|
|
102
|
-
* theirs. These refuse the run. */
|
|
103
|
-
uncovered: string[];
|
|
104
|
-
/** Declared formats nothing selected claims, where at least one selected integration declares
|
|
105
|
-
* no formats at all — so the requirement MIGHT be met and nothing here may say otherwise. */
|
|
106
|
-
unverifiable: string[];
|
|
107
|
-
}
|
|
108
|
-
export declare function binaryFormatCoverage(required: readonly string[], selected: readonly Pick<BinaryGeneratorView, 'mediaTypes'>[]): BinaryFormatCoverage;
|
|
90
|
+
export declare function resolveBinaryGeneratorSelection(config: BinaryOutputConfig | undefined, generators: readonly BinaryGeneratorView[]): ResolvedBinaryGeneratorSelection;
|
|
109
91
|
/**
|
|
110
92
|
* Validate a step's generative selection against the RESOLVED registry: every selected id must
|
|
111
93
|
* be registered, and every content type the step declares it delivers must be produced by at
|
|
@@ -150,10 +132,11 @@ export declare function describeBinaryGeneratorSelectionIssues(agentKind: string
|
|
|
150
132
|
*
|
|
151
133
|
* Every rule here exists because the alternative is an agent guessing. It names the content types
|
|
152
134
|
* per integration so a step holding both an image and a music generator cannot ask one for the
|
|
153
|
-
* other's output; it names the
|
|
154
|
-
* (
|
|
155
|
-
*
|
|
156
|
-
*
|
|
135
|
+
* other's output; it names the OVERLAP where that per-content-type rule stops deciding
|
|
136
|
+
* ({@link overlapLines}); it names the credential's ENVIRONMENT VARIABLE and says what an unset
|
|
137
|
+
* one means (the platform could not provide it: do not call, report), because the agent is the
|
|
138
|
+
* only party that can see whether the value arrived; and it states an unresolved id rather than
|
|
139
|
+
* dropping it, because a selection that silently shrinks reads as a step nobody configured.
|
|
157
140
|
*/
|
|
158
141
|
export declare function renderBinaryGeneratorSection(input: {
|
|
159
142
|
selection: ResolvedBinaryGeneratorSelection;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"binary-generators.d.ts","sourceRoot":"","sources":["../../src/domain/binary-generators.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"binary-generators.d.ts","sourceRoot":"","sources":["../../src/domain/binary-generators.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,kBAAkB,EAAE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AED;;;;;;;;;;;;GAYG;AACH,wBAAgB,8BAA8B,CAC5C,MAAM,EAAE,kBAAkB,GAAG,SAAS,EACtC,UAAU,EAAE,SAAS,mBAAmB,EAAE,GACzC,6BAA6B,EAAE,CAgBjC;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,cAAc,GAAG,MAAM,CAiBjE;AAcD;;;;;;;GAOG;AACH,wBAAgB,sCAAsC,CACpD,SAAS,EAAE,MAAM,EACjB,MAAM,EAAE,SAAS,6BAA6B,EAAE,GAC/C,MAAM,CAgBR;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,4BAA4B,CAAC,KAAK,EAAE;IAClD,SAAS,EAAE,gCAAgC,CAAA;IAC3C,mGAAmG;IACnG,mBAAmB,EAAE,cAAc,EAAE,CAAA;IACrC,oFAAoF;IACpF,mBAAmB,CAAC,EAAE,MAAM,EAAE,CAAA;CAC/B,GAAG,MAAM,EAAE,CA2CX"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { binaryFormatCoverage, binaryModalityOverlaps } from '@cat-factory/contracts';
|
|
1
2
|
import { BINARY_GENERATOR_CONTEXT_DIR, binaryGeneratorContextFileFor, } from './binary-output-paths.js';
|
|
2
3
|
// ---------------------------------------------------------------------------
|
|
3
4
|
// Pure logic for the GENERATIVE half of a binary-output step: resolving a step's selected
|
|
@@ -36,12 +37,22 @@ export function dispatchBinaryGenerators(selection) {
|
|
|
36
37
|
* Resolve a step's `generatorIds` against the registry's views. Pure and shared by admission and
|
|
37
38
|
* the brief, so the two can never disagree about which integrations a step has — the brief runs
|
|
38
39
|
* per dispatch and would otherwise re-derive a set admission already judged.
|
|
40
|
+
*
|
|
41
|
+
* A repeated id resolves ONCE, on its first appearance. Nothing refuses a stored selection that
|
|
42
|
+
* names one integration twice, and every reader downstream of this states a COUNT of some kind:
|
|
43
|
+
* left in, the brief renders that integration's whole entry a second time (an agent reading two
|
|
44
|
+
* identical entries has been told nothing and charged tokens for it) and an overlap report would
|
|
45
|
+
* say a step holds two producers of what it holds one of.
|
|
39
46
|
*/
|
|
40
47
|
export function resolveBinaryGeneratorSelection(config, generators) {
|
|
41
48
|
const byId = new Map(generators.map((generator) => [generator.id, generator]));
|
|
42
49
|
const selected = [];
|
|
43
50
|
const unresolvedIds = [];
|
|
51
|
+
const seen = new Set();
|
|
44
52
|
for (const id of config?.generatorIds ?? []) {
|
|
53
|
+
if (seen.has(id))
|
|
54
|
+
continue;
|
|
55
|
+
seen.add(id);
|
|
45
56
|
const generator = byId.get(id);
|
|
46
57
|
if (generator)
|
|
47
58
|
selected.push(generator);
|
|
@@ -50,23 +61,6 @@ export function resolveBinaryGeneratorSelection(config, generators) {
|
|
|
50
61
|
}
|
|
51
62
|
return { selected, unresolvedIds };
|
|
52
63
|
}
|
|
53
|
-
export function binaryFormatCoverage(required, selected) {
|
|
54
|
-
const emitted = new Set(selected.flatMap((generator) => generator.mediaTypes));
|
|
55
|
-
// An EMPTY selection declares nothing and hides nothing: with no integration to be silent, a
|
|
56
|
-
// format requirement is uncovered outright, exactly as a modality requirement already is.
|
|
57
|
-
const undeclared = selected.some((generator) => generator.mediaTypes.length === 0);
|
|
58
|
-
const uncovered = [];
|
|
59
|
-
const unverifiable = [];
|
|
60
|
-
for (const mediaType of required) {
|
|
61
|
-
if (emitted.has(mediaType))
|
|
62
|
-
continue;
|
|
63
|
-
if (undeclared)
|
|
64
|
-
unverifiable.push(mediaType);
|
|
65
|
-
else
|
|
66
|
-
uncovered.push(mediaType);
|
|
67
|
-
}
|
|
68
|
-
return { uncovered, unverifiable };
|
|
69
|
-
}
|
|
70
64
|
/**
|
|
71
65
|
* Validate a step's generative selection against the RESOLVED registry: every selected id must
|
|
72
66
|
* be registered, and every content type the step declares it delivers must be produced by at
|
|
@@ -170,10 +164,11 @@ export function describeBinaryGeneratorSelectionIssues(agentKind, issues) {
|
|
|
170
164
|
*
|
|
171
165
|
* Every rule here exists because the alternative is an agent guessing. It names the content types
|
|
172
166
|
* per integration so a step holding both an image and a music generator cannot ask one for the
|
|
173
|
-
* other's output; it names the
|
|
174
|
-
* (
|
|
175
|
-
*
|
|
176
|
-
*
|
|
167
|
+
* other's output; it names the OVERLAP where that per-content-type rule stops deciding
|
|
168
|
+
* ({@link overlapLines}); it names the credential's ENVIRONMENT VARIABLE and says what an unset
|
|
169
|
+
* one means (the platform could not provide it: do not call, report), because the agent is the
|
|
170
|
+
* only party that can see whether the value arrived; and it states an unresolved id rather than
|
|
171
|
+
* dropping it, because a selection that silently shrinks reads as a step nobody configured.
|
|
177
172
|
*/
|
|
178
173
|
export function renderBinaryGeneratorSection(input) {
|
|
179
174
|
const { selected, unresolvedIds } = input.selection;
|
|
@@ -205,6 +200,7 @@ export function renderBinaryGeneratorSection(input) {
|
|
|
205
200
|
lines.push('', generator.guidance.trim());
|
|
206
201
|
lines.push('', ...credentialLines(generator), ...contractLines(generator), '');
|
|
207
202
|
}
|
|
203
|
+
lines.push(...overlapLines(selected));
|
|
208
204
|
}
|
|
209
205
|
if (unresolvedIds.length > 0) {
|
|
210
206
|
lines.push(`This step also selects ${unresolvedIds.map((id) => `\`${id}\``).join(', ')}, which this deployment does not register — no endpoint and no contract are available for ${unresolvedIds.length === 1 ? 'it' : 'them'}. Do not guess at ${unresolvedIds.length === 1 ? 'its' : 'their'} API; report the gap and deliver what the remaining integrations can produce.`, '');
|
|
@@ -212,6 +208,53 @@ export function renderBinaryGeneratorSection(input) {
|
|
|
212
208
|
lines.push(...requirementLines(input.requestedModalities, input.requestedMediaTypes ?? [], selected));
|
|
213
209
|
return lines;
|
|
214
210
|
}
|
|
211
|
+
/**
|
|
212
|
+
* The content types more than one selected integration produces, and what to do about it.
|
|
213
|
+
*
|
|
214
|
+
* The section's routing rule ("never ask one for a kind of output it does not produce") is stated
|
|
215
|
+
* per CONTENT TYPE, and it is complete only while the content type determines the integration.
|
|
216
|
+
* Hand an agent two image APIs and it under-determines in silence: every artifact is an image,
|
|
217
|
+
* both produce images, and nothing has said that a choice is being made. What follows is not a
|
|
218
|
+
* random error, which is what makes it worth a paragraph. The agent picks one and keeps picking
|
|
219
|
+
* it, for every artifact of the run, and the result is the wrong kind of correct at the price of
|
|
220
|
+
* the right one, on a file whose modality, format and storage verdict all check out.
|
|
221
|
+
*
|
|
222
|
+
* So this states the fact and refuses to state a preference. The platform has no cost model, no
|
|
223
|
+
* quality model and no view of what the step is for, and a confident wrong preference is worse
|
|
224
|
+
* than none because it displaces the per-integration notes the agent would otherwise have read.
|
|
225
|
+
* It is computed from the RESOLVED selection alone and never the registry, because a step is not
|
|
226
|
+
* affected by integrations it did not select, and never from the step's REQUIREMENTS, because the
|
|
227
|
+
* case that motivates selecting two producers is routinely the one where neither is the
|
|
228
|
+
* deliverable (concept art generated to feed a mesh API's image path).
|
|
229
|
+
*
|
|
230
|
+
* It renders after the per-integration entries so that "the notes above" is literally true: those
|
|
231
|
+
* descriptions are what the choice is actually made from, and this paragraph's only job is to
|
|
232
|
+
* make the agent notice that it is deciding. Silent with no overlap, because a paragraph that
|
|
233
|
+
* rides every brief is one agents stop reading.
|
|
234
|
+
*
|
|
235
|
+
* It also asks for the `generator` field the declaration block treats as optional. Optional is
|
|
236
|
+
* right in general: most steps hold one producer per content type and the answer is not in doubt.
|
|
237
|
+
* The moment two are held it becomes the ONLY record of a choice nothing downstream can check,
|
|
238
|
+
* and without it nobody can tell afterwards that forty sprites came from the wrong one.
|
|
239
|
+
*/
|
|
240
|
+
function overlapLines(selected) {
|
|
241
|
+
const overlaps = binaryModalityOverlaps(selected);
|
|
242
|
+
if (overlaps.length === 0)
|
|
243
|
+
return [];
|
|
244
|
+
return [
|
|
245
|
+
'More than one of these integrations produces the same kind of output, so the content type does not tell you which to call:',
|
|
246
|
+
'',
|
|
247
|
+
...overlaps.map((overlap) => `- ${joinIds(overlap.generatorIds)} ${overlap.generatorIds.length === 2 ? 'both' : 'all'} produce ${describeModality(overlap.modality)}.`),
|
|
248
|
+
'',
|
|
249
|
+
"They are not interchangeable. Read each one's notes above and choose per artifact; where this step's own instructions say which to use, those decide. Record the integration you used in each entry's `generator` field, so the choice is on the record.",
|
|
250
|
+
'',
|
|
251
|
+
];
|
|
252
|
+
}
|
|
253
|
+
/** `` `a` and `b` ``; `` `a`, `b` and `c` ``. Total for any length, including the empty list. */
|
|
254
|
+
function joinIds(ids) {
|
|
255
|
+
const quoted = ids.map((id) => `\`${id}\``);
|
|
256
|
+
return [quoted.slice(0, -1).join(', '), ...quoted.slice(-1)].filter(Boolean).join(' and ');
|
|
257
|
+
}
|
|
215
258
|
/**
|
|
216
259
|
* What this step OWES, and what nothing selected can be shown to deliver.
|
|
217
260
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"binary-generators.js","sourceRoot":"","sources":["../../src/domain/binary-generators.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"binary-generators.js","sourceRoot":"","sources":["../../src/domain/binary-generators.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,sBAAsB,EAAE,MAAM,wBAAwB,CAAA;AAGrF,OAAO,EACL,4BAA4B,EAC5B,6BAA6B,GAC9B,MAAM,0BAA0B,CAAA;AAEjC,8EAA8E;AAC9E,0FAA0F;AAC1F,6FAA6F;AAC7F,6EAA6E;AAC7E,EAAE;AACF,+FAA+F;AAC/F,8FAA8F;AAC9F,8FAA8F;AAC9F,gGAAgG;AAChG,2FAA2F;AAC3F,EAAE;AACF,6FAA6F;AAC7F,iGAAiG;AACjG,uCAAuC;AACvC,8EAA8E;AAE9E,kGAAkG;AAClG,iGAAiG;AACjG,kGAAkG;AAClG,uEAAuE;AACvE,OAAO,EAAE,4BAA4B,EAAE,6BAA6B,EAAE,CAAA;AAqCtE;;kGAEkG;AAClG,MAAM,UAAU,wBAAwB,CACtC,SAA2C;IAE3C,OAAO,SAAS,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,SAAS,EAAE,EAAE,CAAC,CAAC;QAC5C,EAA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AAO,IAAI,UAAU,CAAC,GAAG,CAAA;IACpD,MAAM,QAAQ,GAAG,wBAAwB,SAAS,CAAC,EAAE,gEAAgE,OAAO,MAAM,KAAK,+FAA+F,CAAA;IACtO,+FAA+F;IAC/F,8FAA8F;IAC9F,+CAA+C;IAC/C,IAAI,UAAU,CAAC,QAAQ,KAAK,KAAK,EAAE,CAAC;QAClC,OAAO;YACL,QAAQ;YACR,KAAK,OAAO,wBAAwB,SAAS,CAAC,EAAE,qJAAqJ;SACtM,CAAA;IACH,CAAC;IACD,OAAO;QACL,QAAQ;QACR,QAAQ,OAAO,sFAAsF,SAAS,CAAC,EAAE,mGAAmG;KACrN,CAAA;AACH,CAAC;AAED,oGAAoG;AACpG,SAAS,aAAa,CAAC,SAA8B;IACnD,IAAI,SAAS,CAAC,SAAS,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACrC,OAAO;YACL,uCAAuC,SAAS,CAAC,EAAE,sJAAsJ;SAC1M,CAAA;IACH,CAAC;IACD,OAAO;QACL,kDAAkD,6BAA6B,CAAC,SAAS,CAAC,EAAE,CAAC,qFAAqF;KACnL,CAAA;AACH,CAAC"}
|
package/dist/domain/catalog.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { BlockType, MergeClassRules, ModelPreset, RequirementConcernLevel, StepGating, WorkspaceSettings } from './types.js';
|
|
1
|
+
import type { BlockType, ClassRulesByRole, MergeClassRules, ModelPreset, RequirementConcernLevel, StepGating, WorkspaceRole, WorkspaceSettings } from './types.js';
|
|
2
2
|
/**
|
|
3
3
|
* The runtime settings every workspace starts with (lazily seeded on first read).
|
|
4
4
|
* `waitingEscalationMinutes` is how long a run may wait for human input before its
|
|
@@ -43,6 +43,14 @@ export declare const DEFAULT_RISK_POLICY: {
|
|
|
43
43
|
* justifies it — never something a seed decides on their behalf.
|
|
44
44
|
*/
|
|
45
45
|
export declare const DEFAULT_MERGE_CLASS_RULES: MergeClassRules;
|
|
46
|
+
/**
|
|
47
|
+
* The built-in presets ship with NO role-scoped narrowing and NO sandboxed roles, for the same
|
|
48
|
+
* reason they ship no per-class rules: who a deployment trusts with what is exactly the judgement
|
|
49
|
+
* a seed cannot make on an operator's behalf, and the identity of these two empties is what keeps
|
|
50
|
+
* every existing workspace on byte-for-byte its previous merge behaviour.
|
|
51
|
+
*/
|
|
52
|
+
export declare const DEFAULT_CLASS_RULES_BY_ROLE: ClassRulesByRole;
|
|
53
|
+
export declare const DEFAULT_DRY_RUN_ROLES: readonly WorkspaceRole[];
|
|
46
54
|
/**
|
|
47
55
|
* A built-in merge-preset template (no `createdAt` yet, but with a STABLE id so a
|
|
48
56
|
* workspace's persisted copy can be matched against the catalog and reseeded). The
|
|
@@ -74,6 +82,10 @@ export interface RiskPolicySeed {
|
|
|
74
82
|
forkDecision: StepGating | null;
|
|
75
83
|
/** Per-change-class auto-merge rules; empty on the built-ins (see DEFAULT_MERGE_CLASS_RULES). */
|
|
76
84
|
classRules: MergeClassRules;
|
|
85
|
+
/** Per-role narrowing of `classRules`; empty on the built-ins. */
|
|
86
|
+
classRulesByRole: ClassRulesByRole;
|
|
87
|
+
/** Roles whose runs are forced into dry-run mode; empty on the built-ins. */
|
|
88
|
+
dryRunRoles: WorkspaceRole[];
|
|
77
89
|
/** The workspace's fallback preset, used by tasks that pick none. Exactly one is true. */
|
|
78
90
|
isDefault: boolean;
|
|
79
91
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"catalog.d.ts","sourceRoot":"","sources":["../../src/domain/catalog.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,SAAS,EACT,eAAe,EACf,WAAW,EACX,uBAAuB,EACvB,UAAU,EACV,iBAAiB,EAClB,MAAM,YAAY,CAAA;AAkBnB;;;;;GAKG;AACH,eAAO,MAAM,0BAA0B,EAAE,iBA4BxC,CAAA;AAED;;;;;;GAMG;AACH,eAAO,MAAM,mBAAmB;aAC9B,IAAI,EAAE,UAAU;aAChB,aAAa,EAAE,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AM,qBAAqB;aAChC,IAAI,EAAE,UAAU;aAChB,GAAG,EAAE,SAAS;aACd,MAAM,EAAE,YAAY;CACZ,CAAA;AAEV;;;;;;;;;;GAUG;AACH,eAAO,MAAM,qBAAqB,EAAE,eAAe,EAmBlD,CAAA;AAED;;;;;;GAMG;AACH,eAAO,MAAM,uBAAuB,EAAE,MAAmC,CAAA;AAEzE,2FAA2F;AAC3F,wBAAgB,gBAAgB,IAAI,eAAe,EAAE,CAEpD;AAED,mGAAmG;AACnG,eAAO,MAAM,oBAAoB,EAAE,eAC+D,CAAA;AAElG;;;;;GAKG;AACH,wBAAgB,sBAAsB,CACpC,MAAM,EAAE,WAAW,GAAG,eAAe,GAAG,IAAI,GAAG,SAAS,EACxD,SAAS,EAAE,MAAM,GAChB,MAAM,CAGR;AAED,mFAAmF;AACnF,eAAO,MAAM,gBAAgB,EAAE,MAAM,CAAC,SAAS,EAAE,MAAM,CAWtD,CAAA"}
|
package/dist/domain/catalog.js
CHANGED
|
@@ -95,6 +95,14 @@ export const DEFAULT_RISK_POLICY = {
|
|
|
95
95
|
* justifies it — never something a seed decides on their behalf.
|
|
96
96
|
*/
|
|
97
97
|
export const DEFAULT_MERGE_CLASS_RULES = {};
|
|
98
|
+
/**
|
|
99
|
+
* The built-in presets ship with NO role-scoped narrowing and NO sandboxed roles, for the same
|
|
100
|
+
* reason they ship no per-class rules: who a deployment trusts with what is exactly the judgement
|
|
101
|
+
* a seed cannot make on an operator's behalf, and the identity of these two empties is what keeps
|
|
102
|
+
* every existing workspace on byte-for-byte its previous merge behaviour.
|
|
103
|
+
*/
|
|
104
|
+
export const DEFAULT_CLASS_RULES_BY_ROLE = {};
|
|
105
|
+
export const DEFAULT_DRY_RUN_ROLES = [];
|
|
98
106
|
/**
|
|
99
107
|
* The built-in merge threshold presets seeded for every workspace. `Balanced` is the
|
|
100
108
|
* default auto-merge policy; `Manual review only` disables auto-merge entirely
|
|
@@ -123,8 +131,10 @@ export const RISK_POLICY_SEEDS = [
|
|
|
123
131
|
autoMergeEnabled: DEFAULT_RISK_POLICY.autoMergeEnabled,
|
|
124
132
|
forkDecision: { ...DEFAULT_FORK_DECISION_GATING },
|
|
125
133
|
classRules: { ...DEFAULT_MERGE_CLASS_RULES },
|
|
134
|
+
classRulesByRole: { ...DEFAULT_CLASS_RULES_BY_ROLE },
|
|
135
|
+
dryRunRoles: [...DEFAULT_DRY_RUN_ROLES],
|
|
126
136
|
isDefault: true,
|
|
127
|
-
version:
|
|
137
|
+
version: 6,
|
|
128
138
|
},
|
|
129
139
|
{
|
|
130
140
|
id: 'mp_manual_review',
|
|
@@ -150,8 +160,12 @@ export const RISK_POLICY_SEEDS = [
|
|
|
150
160
|
// No per-class rules: a class rule can never override `autoMergeEnabled: false`, and
|
|
151
161
|
// shipping one here would only mislead an operator reading the preset.
|
|
152
162
|
classRules: { ...DEFAULT_MERGE_CLASS_RULES },
|
|
163
|
+
// Nor any role-scoped narrowing: narrowing is subtractive, and there is nothing left to
|
|
164
|
+
// subtract from a preset that already routes every PR to a human.
|
|
165
|
+
classRulesByRole: { ...DEFAULT_CLASS_RULES_BY_ROLE },
|
|
166
|
+
dryRunRoles: [...DEFAULT_DRY_RUN_ROLES],
|
|
153
167
|
isDefault: false,
|
|
154
|
-
version:
|
|
168
|
+
version: 6,
|
|
155
169
|
},
|
|
156
170
|
];
|
|
157
171
|
/** The built-in merge presets, fresh copies so callers can stamp ids/timestamps safely. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"catalog.js","sourceRoot":"","sources":["../../src/domain/catalog.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,yBAAyB,EAAE,uBAAuB,EAAE,MAAM,wBAAwB,CAAA;
|
|
1
|
+
{"version":3,"file":"catalog.js","sourceRoot":"","sources":["../../src/domain/catalog.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,yBAAyB,EAAE,uBAAuB,EAAE,MAAM,wBAAwB,CAAA;AAY3F;;;;;GAKG;AACH,MAAM,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EAAE,CAAC,CAAC,EAAE,GAAG,CAAC,EAAE,SAAS,EAAE,EAAE,GAAG,CAAC,CAAC,SAAS,EAAE,EAAE,CAAC,CAAC,CAAA;AACpF,CAAC;AAED,mGAAmG;AACnG,MAAM,CAAC,MAAM,oBAAoB,GAC/B,qBAAqB,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,KAAK,uBAAuB,CAAC,IAAI,qBAAqB,CAAC,CAAC,CAAE,CAAA;AAElG;;;;;GAKG;AACH,MAAM,UAAU,sBAAsB,CACpC,MAAwD,EACxD,SAAiB;IAEjB,MAAM,CAAC,GAAG,MAAM,IAAI,oBAAoB,CAAA;IACxC,OAAO,CAAC,CAAC,SAAS,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,WAAW,CAAA;AAChD,CAAC;AAED,mFAAmF;AACnF,MAAM,CAAC,MAAM,gBAAgB,GAA8B;IACzD,QAAQ,EAAE,UAAU;IACpB,OAAO,EAAE,SAAS;IAClB,OAAO,EAAE,SAAS;IAClB,QAAQ,EAAE,qBAAqB;IAC/B,GAAG,EAAE,KAAK;IACV,QAAQ,EAAE,UAAU;IACpB,KAAK,EAAE,OAAO;IACd,WAAW,EAAE,aAAa;IAC1B,QAAQ,EAAE,UAAU;IACpB,WAAW,EAAE,aAAa;CAC3B,CAAA"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ChangeClass, MergeClassRule, MergeClassRules } from '@cat-factory/contracts';
|
|
1
|
+
import type { ChangeClass, ClassRulesByRole, MergeClassRule, MergeClassRules, WorkspaceRole } from '@cat-factory/contracts';
|
|
2
2
|
/**
|
|
3
3
|
* Risk rank per class — HIGHER means riskier, and a mixed diff resolves to the highest rank
|
|
4
4
|
* present. That precedence is what makes a per-class rule safe by construction: "always
|
|
@@ -57,4 +57,50 @@ export declare function classifyChangedFiles(paths: readonly string[]): ChangeCl
|
|
|
57
57
|
* comparison instead of silently adopting a widened (or tightened) policy.
|
|
58
58
|
*/
|
|
59
59
|
export declare function resolveMergeClassRule(rules: MergeClassRules | null | undefined, changeClass: ChangeClass): MergeClassRule;
|
|
60
|
+
/**
|
|
61
|
+
* Compose a base rule with a ROLE's rule, taking the STRICTER of the two.
|
|
62
|
+
*
|
|
63
|
+
* Narrow-only is the whole safety property of role-scoped rules, and it is enforced here rather
|
|
64
|
+
* than trusted to whoever authors a preset: a role entry can subtract capability but can never add
|
|
65
|
+
* it, so `{ source: 'always' }` under `viewer` on a preset whose base holds `source` at
|
|
66
|
+
* `thresholds` grants a viewer nothing — it reads as a mistake and behaves as a no-op, instead of
|
|
67
|
+
* quietly becoming the widest rule in the preset for its least-trusted tier.
|
|
68
|
+
*
|
|
69
|
+
* The consequence worth stating: a role entry is REVIEWABLE ON ITS OWN. Reading one tells you what
|
|
70
|
+
* that role at most may do, with no need to hold the base map in your head at the same time.
|
|
71
|
+
*/
|
|
72
|
+
export declare function narrowMergeClassRule(base: MergeClassRule, role: MergeClassRule): MergeClassRule;
|
|
73
|
+
/** The rule that governs a run, before and after its initiator's role narrowed it. */
|
|
74
|
+
export interface RoleScopedMergeClassRule {
|
|
75
|
+
/** What the preset's base `classRules` say for this change class. */
|
|
76
|
+
base: MergeClassRule;
|
|
77
|
+
/** What actually applies: `base` narrowed by the initiator's role entry. */
|
|
78
|
+
effective: MergeClassRule;
|
|
79
|
+
/**
|
|
80
|
+
* Whether the role CHANGED the outcome. False both when no role was pinned and when the role's
|
|
81
|
+
* entry was no stricter than the base, so a caller can report "a role narrowed this" without
|
|
82
|
+
* re-comparing — and never attributes to a role a refusal the base map would have made anyway.
|
|
83
|
+
*/
|
|
84
|
+
narrowedByRole: boolean;
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* Resolve the per-class rule that governs one run: the preset's base rule for the run's change
|
|
88
|
+
* class, narrowed by the entry (if any) its initiator's ROLE carries.
|
|
89
|
+
*
|
|
90
|
+
* Two absences pass straight through to the base rule, deliberately and for the same reason:
|
|
91
|
+
* an unattributed run (no pinned role — a schedule fire, a public-API start, auth-disabled dev)
|
|
92
|
+
* and a role with no authored entry. Neither is evidence about how much review the work needs,
|
|
93
|
+
* and inventing a tier for the first would either hand it the preset's widest rules or sandbox
|
|
94
|
+
* every scheduled run in the deployment the day someone first authors a role entry.
|
|
95
|
+
*
|
|
96
|
+
* `unknown` remains inert through both layers: {@link resolveMergeClassRule} already forces it to
|
|
97
|
+
* `thresholds`, and narrowing `thresholds` by a rule authored for some OTHER class cannot reach
|
|
98
|
+
* it, so a diff we could not read still falls back to the score comparison whoever started it.
|
|
99
|
+
*/
|
|
100
|
+
export declare function resolveRoleScopedMergeClassRule(input: {
|
|
101
|
+
rules: MergeClassRules | null | undefined;
|
|
102
|
+
byRole: ClassRulesByRole | null | undefined;
|
|
103
|
+
role: WorkspaceRole | null | undefined;
|
|
104
|
+
changeClass: ChangeClass;
|
|
105
|
+
}): RoleScopedMergeClassRule;
|
|
60
106
|
//# sourceMappingURL=change-class.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"change-class.d.ts","sourceRoot":"","sources":["../../src/domain/change-class.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"change-class.d.ts","sourceRoot":"","sources":["../../src/domain/change-class.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,WAAW,EACX,gBAAgB,EAChB,cAAc,EACd,eAAe,EACf,aAAa,EACd,MAAM,wBAAwB,CAAA;AAiB/B;;;;;;;;;GASG;AACH,eAAO,MAAM,iBAAiB,EAAE,MAAM,CAAC,WAAW,EAAE,MAAM,CAQzD,CAAA;AAqLD;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,EAAE,SAAS,CAAC,CAwCjF;AAED,uDAAuD;AACvD,MAAM,WAAW,oBAAoB;IACnC,+FAA+F;IAC/F,WAAW,EAAE,WAAW,CAAA;IACxB,yEAAyE;IACzE,SAAS,EAAE,MAAM,CAAA;CAClB;AAED;;;;;;;GAOG;AACH,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,SAAS,MAAM,EAAE,GAAG,oBAAoB,CAUnF;AAED;;;;;;;GAOG;AACH,wBAAgB,qBAAqB,CACnC,KAAK,EAAE,eAAe,GAAG,IAAI,GAAG,SAAS,EACzC,WAAW,EAAE,WAAW,GACvB,cAAc,CAGhB;AAiBD;;;;;;;;;;;GAWG;AACH,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,cAAc,EAAE,IAAI,EAAE,cAAc,GAAG,cAAc,CAE/F;AAED,sFAAsF;AACtF,MAAM,WAAW,wBAAwB;IACvC,qEAAqE;IACrE,IAAI,EAAE,cAAc,CAAA;IACpB,4EAA4E;IAC5E,SAAS,EAAE,cAAc,CAAA;IACzB;;;;OAIG;IACH,cAAc,EAAE,OAAO,CAAA;CACxB;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,+BAA+B,CAAC,KAAK,EAAE;IACrD,KAAK,EAAE,eAAe,GAAG,IAAI,GAAG,SAAS,CAAA;IACzC,MAAM,EAAE,gBAAgB,GAAG,IAAI,GAAG,SAAS,CAAA;IAC3C,IAAI,EAAE,aAAa,GAAG,IAAI,GAAG,SAAS,CAAA;IACtC,WAAW,EAAE,WAAW,CAAA;CACzB,GAAG,wBAAwB,CAc3B"}
|
|
@@ -303,4 +303,63 @@ export function resolveMergeClassRule(rules, changeClass) {
|
|
|
303
303
|
return 'thresholds';
|
|
304
304
|
return rules?.[changeClass] ?? 'thresholds';
|
|
305
305
|
}
|
|
306
|
+
/**
|
|
307
|
+
* How much review a rule DEMANDS — higher is stricter. The ordering is the point of the scale:
|
|
308
|
+
* `always` merges with nothing consulted, `thresholds` merges only within the score ceilings, and
|
|
309
|
+
* `never` merges nothing, so it is total and every pair has a strictest member.
|
|
310
|
+
*
|
|
311
|
+
* A plain rank rather than a `Record<MergeClassRule, number>` of opaque numbers used once: this is
|
|
312
|
+
* the only place the three rules are ORDERED, and {@link narrowMergeClassRule} is the only
|
|
313
|
+
* consumer, so the two are kept adjacent and a new rule fails the typecheck here first.
|
|
314
|
+
*/
|
|
315
|
+
const MERGE_CLASS_RULE_STRICTNESS = {
|
|
316
|
+
always: 0,
|
|
317
|
+
thresholds: 1,
|
|
318
|
+
never: 2,
|
|
319
|
+
};
|
|
320
|
+
/**
|
|
321
|
+
* Compose a base rule with a ROLE's rule, taking the STRICTER of the two.
|
|
322
|
+
*
|
|
323
|
+
* Narrow-only is the whole safety property of role-scoped rules, and it is enforced here rather
|
|
324
|
+
* than trusted to whoever authors a preset: a role entry can subtract capability but can never add
|
|
325
|
+
* it, so `{ source: 'always' }` under `viewer` on a preset whose base holds `source` at
|
|
326
|
+
* `thresholds` grants a viewer nothing — it reads as a mistake and behaves as a no-op, instead of
|
|
327
|
+
* quietly becoming the widest rule in the preset for its least-trusted tier.
|
|
328
|
+
*
|
|
329
|
+
* The consequence worth stating: a role entry is REVIEWABLE ON ITS OWN. Reading one tells you what
|
|
330
|
+
* that role at most may do, with no need to hold the base map in your head at the same time.
|
|
331
|
+
*/
|
|
332
|
+
export function narrowMergeClassRule(base, role) {
|
|
333
|
+
return MERGE_CLASS_RULE_STRICTNESS[role] > MERGE_CLASS_RULE_STRICTNESS[base] ? role : base;
|
|
334
|
+
}
|
|
335
|
+
/**
|
|
336
|
+
* Resolve the per-class rule that governs one run: the preset's base rule for the run's change
|
|
337
|
+
* class, narrowed by the entry (if any) its initiator's ROLE carries.
|
|
338
|
+
*
|
|
339
|
+
* Two absences pass straight through to the base rule, deliberately and for the same reason:
|
|
340
|
+
* an unattributed run (no pinned role — a schedule fire, a public-API start, auth-disabled dev)
|
|
341
|
+
* and a role with no authored entry. Neither is evidence about how much review the work needs,
|
|
342
|
+
* and inventing a tier for the first would either hand it the preset's widest rules or sandbox
|
|
343
|
+
* every scheduled run in the deployment the day someone first authors a role entry.
|
|
344
|
+
*
|
|
345
|
+
* `unknown` remains inert through both layers: {@link resolveMergeClassRule} already forces it to
|
|
346
|
+
* `thresholds`, and narrowing `thresholds` by a rule authored for some OTHER class cannot reach
|
|
347
|
+
* it, so a diff we could not read still falls back to the score comparison whoever started it.
|
|
348
|
+
*/
|
|
349
|
+
export function resolveRoleScopedMergeClassRule(input) {
|
|
350
|
+
const base = resolveMergeClassRule(input.rules, input.changeClass);
|
|
351
|
+
if (!input.role || input.changeClass === 'unknown') {
|
|
352
|
+
return { base, effective: base, narrowedByRole: false };
|
|
353
|
+
}
|
|
354
|
+
// Read the role's entry as an OPTIONAL lookup, NOT through `resolveMergeClassRule`. That helper
|
|
355
|
+
// substitutes `thresholds` for an absent class, which is right when it IS the policy and wrong
|
|
356
|
+
// here: a role that authored nothing has said nothing, and folding its silence in as
|
|
357
|
+
// `thresholds` would narrow every `always` in the base map the moment a preset gained its first
|
|
358
|
+
// role entry — for the roles that entry is not even about. Absent is not a rule.
|
|
359
|
+
const roleRule = input.byRole?.[input.role]?.[input.changeClass];
|
|
360
|
+
if (!roleRule)
|
|
361
|
+
return { base, effective: base, narrowedByRole: false };
|
|
362
|
+
const effective = narrowMergeClassRule(base, roleRule);
|
|
363
|
+
return { base, effective, narrowedByRole: effective !== base };
|
|
364
|
+
}
|
|
306
365
|
//# sourceMappingURL=change-class.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"change-class.js","sourceRoot":"","sources":["../../src/domain/change-class.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"change-class.js","sourceRoot":"","sources":["../../src/domain/change-class.ts"],"names":[],"mappings":"AAQA,8EAA8E;AAC9E,4EAA4E;AAC5E,6EAA6E;AAC7E,iFAAiF;AACjF,iFAAiF;AACjF,EAAE;AACF,mFAAmF;AACnF,mFAAmF;AACnF,iFAAiF;AACjF,wDAAwD;AACxD,EAAE;AACF,uDAAuD;AACvD,4CAA4C;AAC5C,8EAA8E;AAE9E;;;;;;;;;GASG;AACH,MAAM,C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K,SAAS,EAAE,CAAC;QACnD,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,cAAc,EAAE,KAAK,EAAE,CAAA;IACzD,CAAC;IACD,gGAAgG;IAChG,+FAA+F;IAC/F,qFAAqF;IACrF,gGAAgG;IAChG,iFAAiF;IACjF,MAAM,QAAQ,GAAG,KAAK,CAAC,MAAM,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,KAAK,CAAC,WAAW,CAAC,CAAA;IAChE,IAAI,CAAC,QAAQ;QAAE,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,cAAc,EAAE,KAAK,EAAE,CAAA;IACtE,MAAM,SAAS,GAAG,oBAAoB,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAA;IACtD,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,cAAc,EAAE,SAAS,KAAK,IAAI,EAAE,CAAA;AAChE,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { LlmCallMetricSummary, LlmCallRollupTotals } from '../ports/llm-metrics.js';
|
|
1
|
+
import type { LlmCallMetricSummary, LlmCallRollupTotals, LlmRollupCell } from '../ports/llm-metrics.js';
|
|
2
2
|
/** A rollup of one agent kind's calls, folded across that kind's phases. */
|
|
3
3
|
export interface LlmKindRollup extends LlmCallRollupTotals {
|
|
4
4
|
agentKind: string;
|
|
@@ -7,21 +7,68 @@ export interface LlmKindRollup extends LlmCallRollupTotals {
|
|
|
7
7
|
export interface LlmPhaseRollup extends LlmCallRollupTotals {
|
|
8
8
|
phase: string;
|
|
9
9
|
}
|
|
10
|
+
/**
|
|
11
|
+
* Per-1M rates for one model's four token classes — the shape a price table resolves to,
|
|
12
|
+
* restated here so the pricing fold stays in the domain without kernel depending on the spend
|
|
13
|
+
* package (which depends on kernel).
|
|
14
|
+
*/
|
|
15
|
+
export interface LlmTokenRates {
|
|
16
|
+
inputPerMillion: number;
|
|
17
|
+
cacheReadPerMillion: number;
|
|
18
|
+
cacheWritePerMillion: number;
|
|
19
|
+
outputPerMillion: number;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Resolve a cell's rates, or null where this deployment cannot price that model — which is
|
|
23
|
+
* NOT the same as pricing it at zero (see {@link LlmCallRollupTotals.costEstimate}).
|
|
24
|
+
*/
|
|
25
|
+
export type LlmRateResolver = (provider: string, model: string) => LlmTokenRates | null;
|
|
26
|
+
/** The four token counts a cost is a function of, however they were aggregated. */
|
|
27
|
+
export interface LlmTokenClassCounts {
|
|
28
|
+
/** FRESH (uncached) input tokens, exclusive of both cache classes. */
|
|
29
|
+
promptTokens: number;
|
|
30
|
+
cacheReadTokens: number;
|
|
31
|
+
cacheWriteTokens: number;
|
|
32
|
+
completionTokens: number;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Cost of a set of token counts at one model's rates, each class at its own tier.
|
|
36
|
+
*
|
|
37
|
+
* The ONE place this arithmetic lives. Every producer of money in the codebase routes through
|
|
38
|
+
* it — the ledger's per-call estimate, the rollup fold, the export's per-call sum — because
|
|
39
|
+
* three copies of a four-term sum are three chances for a class to be priced at the wrong
|
|
40
|
+
* tier, and a wrong cost looks exactly like a right one.
|
|
41
|
+
*/
|
|
42
|
+
export declare function costOfTokenClasses(rates: LlmTokenRates, tokens: LlmTokenClassCounts): number;
|
|
43
|
+
/**
|
|
44
|
+
* Price each cell of the store's finest grain and collapse the MODEL dimension, returning the
|
|
45
|
+
* {@link LlmRollupCell}s every consumer reads — now carrying `costEstimate`.
|
|
46
|
+
*
|
|
47
|
+
* This is the one place the model is used, and the reason it is in the grain at all: cost is a
|
|
48
|
+
* function of `(model, token classes)`, so it has to be computed while the model is still
|
|
49
|
+
* attached and can only be summed afterwards. Every coarser view is then the same pure fold it
|
|
50
|
+
* always was, and the costs it adds up agree with the breakdown beside it by construction.
|
|
51
|
+
*
|
|
52
|
+
* `rates` is OPTIONAL because collapsing is not conditional on pricing: a deployment with no
|
|
53
|
+
* price table still owes its consumers the same `(agentKind, phase)` shape, with every cost
|
|
54
|
+
* null. Omitting it is that case stated in code, rather than a resolver that answers nothing.
|
|
55
|
+
*/
|
|
56
|
+
export declare function priceRollupCells(cells: readonly LlmCallMetricSummary[], rates?: LlmRateResolver): LlmRollupCell[];
|
|
10
57
|
/** Fold every cell into one set of run-wide totals. */
|
|
11
|
-
export declare function foldRollupTotals(cells: readonly
|
|
58
|
+
export declare function foldRollupTotals(cells: readonly LlmRollupCell[]): LlmCallRollupTotals;
|
|
12
59
|
/**
|
|
13
60
|
* Fold the cells into one rollup per agent kind — the grain a pipeline step's `metrics`
|
|
14
61
|
* carries, since the proxy keys a conversation by `(execution, agentKind)` and not by step
|
|
15
62
|
* index. Insertion-ordered on first appearance, so a caller that wants a stable order sorts.
|
|
16
63
|
*/
|
|
17
|
-
export declare function foldRollupsByAgentKind(cells: readonly
|
|
64
|
+
export declare function foldRollupsByAgentKind(cells: readonly LlmRollupCell[]): LlmKindRollup[];
|
|
18
65
|
/**
|
|
19
66
|
* Fold the cells into one rollup per phase — the burn breakdown. The `''` phase is a cell like
|
|
20
67
|
* any other and is NEVER filtered out: a run whose calls are all unattributed was metered by a
|
|
21
68
|
* channel with no phase concept, not one that spent nothing, and hiding the cell makes the two
|
|
22
69
|
* indistinguishable while the table still looks complete.
|
|
23
70
|
*/
|
|
24
|
-
export declare function foldRollupsByPhase(cells: readonly
|
|
71
|
+
export declare function foldRollupsByPhase(cells: readonly LlmRollupCell[]): LlmPhaseRollup[];
|
|
25
72
|
/**
|
|
26
73
|
* Total input tokens a rollup covers: the three classes are orthogonal at the source, so the
|
|
27
74
|
* volume figure is simply their sum (the like-for-like of Claude Code's own context gauge,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"llm-rollup.d.ts","sourceRoot":"","sources":["../../src/domain/llm-rollup.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"llm-rollup.d.ts","sourceRoot":"","sources":["../../src/domain/llm-rollup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