@cat-factory/contracts 0.277.0 → 0.279.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.
Files changed (37) hide show
  1. package/dist/debug-api.d.ts +361 -0
  2. package/dist/debug-api.d.ts.map +1 -1
  3. package/dist/debug-api.js +96 -0
  4. package/dist/debug-api.js.map +1 -1
  5. package/dist/index.d.ts +2 -0
  6. package/dist/index.d.ts.map +1 -1
  7. package/dist/index.js +2 -0
  8. package/dist/index.js.map +1 -1
  9. package/dist/mergeTrackRecord.d.ts +14 -0
  10. package/dist/mergeTrackRecord.d.ts.map +1 -1
  11. package/dist/mergeTrackRecord.js +15 -0
  12. package/dist/mergeTrackRecord.js.map +1 -1
  13. package/dist/public-merge-evidence.d.ts +94 -0
  14. package/dist/public-merge-evidence.d.ts.map +1 -0
  15. package/dist/public-merge-evidence.js +106 -0
  16. package/dist/public-merge-evidence.js.map +1 -0
  17. package/dist/public-spend.d.ts +204 -0
  18. package/dist/public-spend.d.ts.map +1 -0
  19. package/dist/public-spend.js +207 -0
  20. package/dist/public-spend.js.map +1 -0
  21. package/dist/routes/debug-api.d.ts +186 -0
  22. package/dist/routes/debug-api.d.ts.map +1 -1
  23. package/dist/routes/debug-api.js +14 -1
  24. package/dist/routes/debug-api.js.map +1 -1
  25. package/dist/routes/index.d.ts +1 -0
  26. package/dist/routes/index.d.ts.map +1 -1
  27. package/dist/routes/index.js +1 -0
  28. package/dist/routes/index.js.map +1 -1
  29. package/dist/routes/public-api.d.ts +91 -2
  30. package/dist/routes/public-api.d.ts.map +1 -1
  31. package/dist/routes/public-api.js +41 -3
  32. package/dist/routes/public-api.js.map +1 -1
  33. package/dist/routes/public-merge-evidence.d.ts +248 -0
  34. package/dist/routes/public-merge-evidence.d.ts.map +1 -0
  35. package/dist/routes/public-merge-evidence.js +80 -0
  36. package/dist/routes/public-merge-evidence.js.map +1 -0
  37. package/package.json +1 -1
package/dist/index.js.map CHANGED
@@ -1 +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ChC,cAAc,gCAAgC,CAAA;AAC9C,cAAc,oBAAoB,CAAA;AAClC,cAAc,2BAA2B,CAAA;AACzC,cAAc,YAAY,CAAA;AAC1B,cAAc,oBAAoB,CAAA;AAClC,cAAc,cAAc,CAAA;AAC5B,cAAc,0BAA0B,CAAA;AACxC,cAAc,sBAAsB,CAAA;AACpC,cAAc,YAAY,CAAA;AAC1B,cAAc,oBAAoB,CAAA;AAClC,cAAc,gBAAgB,CAAA;AAC9B,cAAc,cAAc,CAAA;AAC5B,cAAc,yBAAyB,CAAA;AACvC,cAAc,eAAe,CAAA;AAC7B,cAAc,sBAAsB,CAAA;AACpC,cAAc,iBAAiB,CAAA;AAC/B,cAAc,mBAAmB,CAAA;AACjC,cAAc,sBAAsB,CAAA;AACpC,cAAc,4BAA4B,CAAA;AAC1C,cAAc,mBAAmB,CAAA;AACjC,cAAc,gBAAgB,CAAA;AAC9B,cAAc,uBAAuB,CAAA;AACrC,cAAc,4BAA4B,CAAA;AAC1C,cAAc,6BAA6B,CAAA;AAC3C,cAAc,kBAAkB,CAAA;AAChC,cAAc,iBAAiB,CAAA;AAC/B,cAAc,cAAc,CAAA;AAC5B,cAAc,yBAAyB,CAAA;AACvC,cAAc,qBAAqB,CAAA;AACnC,cAAc,eAAe,CAAA;AAC7B,cAAc,oBAAoB,CAAA;AAClC,cAAc,aAAa,CAAA;AAC3B,cAAc,iBAAiB,CAAA;AAC/B,cAAc,wBAAwB,CAAA;AACtC,cAAc,mBAAmB,CAAA;AACjC,cAAc,mBAAmB,CAAA;AACjC,cAAc,mBAAmB,CAAA"}
@@ -180,4 +180,18 @@ export declare const tagReviewEffortSchema: v.ObjectSchema<{
180
180
  readonly reviewEffort: v.NullableSchema<v.PicklistSchema<["none", "minor", "major"], undefined>, undefined>;
181
181
  }, undefined>;
182
182
  export type TagReviewEffortInput = v.InferOutput<typeof tagReviewEffortSchema>;
183
+ /**
184
+ * `error.details.reason` for "no merge record under that id in this workspace": the 404 BOTH
185
+ * record-addressed routes answer, the read and the tag alike.
186
+ *
187
+ * It is a constant rather than a literal per site because the two producers live in different
188
+ * packages: the read resolves the row in `@cat-factory/server` and refuses there, while the tag
189
+ * write refuses inside `MergeTrackRecordService` (a lost race between reading and patching is the
190
+ * service's to detect, not a controller's to pre-check). A machine-readable code that two packages
191
+ * spell independently is one rename away from a caller branching on a value only one route emits.
192
+ *
193
+ * Distinct from `no_merge_record`, which the RUN-scoped read answers for a readable run that
194
+ * simply made no merge decision: that is a fact about the run, not a missing id.
195
+ */
196
+ export declare const MERGE_RECORD_NOT_FOUND_REASON = "merge_record_not_found";
183
197
  //# sourceMappingURL=mergeTrackRecord.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"mergeTrackRecord.d.ts","sourceRoot":"","sources":["../src/mergeTrackRecord.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,SAAS,CAAA;AAwB5B;;;;;;;;;;;;;;;;GAgBG;AACH,eAAO,MAAM,iBAAiB,sGAQ5B,CAAA;AACF,MAAM,MAAM,WAAW,GAAG,CAAC,CAAC,WAAW,CAAC,OAAO,iBAAiB,CAAC,CAAA;AAEjE;;;;GAIG;AACH,eAAO,MAAM,cAAc,kFAQgB,CAAA;AAE3C;;;;GAIG;AACH,eAAO,MAAM,uBAAuB,uEAOO,CAAA;AAE3C,MAAM,MAAM,mBAAmB,GAAG,CAAC,OAAO,uBAAuB,CAAC,CAAC,MAAM,CAAC,CAAA;AAE1E;;;;;;;;;;GAUG;AACH,eAAO,MAAM,kBAAkB,yDAAyC,CAAA;AACxE,MAAM,MAAM,YAAY,GAAG,CAAC,CAAC,WAAW,CAAC,OAAO,kBAAkB,CAAC,CAAA;AAEnE,sFAAsF;AACtF,eAAO,MAAM,cAAc,qCAAwE,CAAA;AAEnG;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,wBAAwB,+GAMnC,CAAA;AACF,MAAM,MAAM,kBAAkB,GAAG,CAAC,CAAC,WAAW,CAAC,OAAO,wBAAwB,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Schema = v.object({
249
249
  reviewEffort: v.nullable(reviewEffortSchema),
250
250
  });
251
+ // ---- Refusal vocabulary ---------------------------------------------------
252
+ /**
253
+ * `error.details.reason` for "no merge record under that id in this workspace": the 404 BOTH
254
+ * record-addressed routes answer, the read and the tag alike.
255
+ *
256
+ * It is a constant rather than a literal per site because the two producers live in different
257
+ * packages: the read resolves the row in `@cat-factory/server` and refuses there, while the tag
258
+ * write refuses inside `MergeTrackRecordService` (a lost race between reading and patching is the
259
+ * service's to detect, not a controller's to pre-check). A machine-readable code that two packages
260
+ * spell independently is one rename away from a caller branching on a value only one route emits.
261
+ *
262
+ * Distinct from `no_merge_record`, which the RUN-scoped read answers for a readable run that
263
+ * simply made no merge decision: that is a fact about the run, not a missing id.
264
+ */
265
+ export const MERGE_RECORD_NOT_FOUND_REASON = 'merge_record_not_found';
251
266
  //# sourceMappingURL=mergeTrackRecord.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"mergeTrackRecord.js","sourceRoot":"","sources":["../src/mergeTrackRecord.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,SAAS,CAAA;AAC5B,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAA;AAEpD,8EAA8E;AAC9E,gFAAgF;AAChF,qBAAqB;AACrB,EAAE;AACF,8EAA8E;AAC9E,iFAAiF;AACjF,iFAAiF;AACjF,EAAE;AACF,sFAAsF;AACtF,yDAAyD;AACzD,oFAAoF;AACpF,4DAA4D;AAC5D,sDAAsD;AACtD,EAAE;AACF,kFAAkF;AAClF,mFAAmF;AACnF,EAAE;AACF,kFAAkF;AAClF,wEAAwE;AACxE,8EAA8E;AAE9E;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,CAAC,QAAQ,CAAC;IAC1C,MAAM;IACN,MAAM;IACN,YAAY;IACZ,QAAQ;IACR,QAAQ;IACR,QAAQ;IACR,SAAS;CACV,CAAC,CAAA;AAGF;;;;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isted merge decision, as `/api/v1` speaks it: the deterministic change class, the
4
+ * merger's scores at the decision, what happened to the pull request, and the reviewer-effort
5
+ * tag a human left (null until somebody tags it; tagging is never mandatory).
6
+ *
7
+ * The projection of the stored row (`mergeTrackRecordSchema`) onto the public id vocabulary:
8
+ * `recordId`/`taskId`/`runId` for the row, its task and its run. Provider-neutral by
9
+ * construction, so a GitLab deployment reads the same shape.
10
+ */
11
+ export declare const publicMergeRecordSchema: v.ObjectSchema<{
12
+ /** The id to pass to `POST /api/v1/merge-records/{recordId}/effort`. */
13
+ readonly recordId: v.StringSchema<undefined>;
14
+ /** The board task whose pull request this covers (`GET /api/v1/tasks/{taskId}`). */
15
+ readonly taskId: v.StringSchema<undefined>;
16
+ /**
17
+ * The run that produced the pull request (`GET /api/v1/runs/{runId}/report`). Nullable
18
+ * because the column is; every record written today is born at a merge decision inside a run,
19
+ * so in practice it is set. An external merge does not mint a record, it settles the one the
20
+ * run already wrote.
21
+ */
22
+ readonly runId: v.NullableSchema<v.StringSchema<undefined>, undefined>;
23
+ /**
24
+ * What kind of change the pull request made, derived on the backend from its changed-file
25
+ * list and never from an agent's opinion. A mixed diff resolves to the highest-ranked class
26
+ * present, so a per-class rule can only fire on a diff carrying nothing riskier.
27
+ */
28
+ readonly changeClass: v.PicklistSchema<["docs", "test", "dependency", "config", "source", "schema", "unknown"], undefined>;
29
+ /** How many files the pull request changed, when the changed-file list was readable. */
30
+ readonly changedFileCount: v.NullableSchema<v.NumberSchema<undefined>, undefined>;
31
+ /**
32
+ * The merger's complexity score at the decision, 0..1. The three scores move together: all
33
+ * null means the merger produced no parseable assessment, not that it scored zero.
34
+ */
35
+ readonly complexity: v.NullableSchema<v.NumberSchema<undefined>, undefined>;
36
+ /** The merger's risk score at the decision, 0..1 (see `complexity`). */
37
+ readonly risk: v.NullableSchema<v.NumberSchema<undefined>, undefined>;
38
+ /** The merger's impact score at the decision, 0..1 (see `complexity`). */
39
+ readonly impact: v.NullableSchema<v.NumberSchema<undefined>, undefined>;
40
+ /**
41
+ * The merge-threshold preset the decision was compared against. The id is absent for the
42
+ * deployment's built-in fallback preset, which has no stored row; the name is set either way.
43
+ */
44
+ readonly mergePresetId: v.NullableSchema<v.StringSchema<undefined>, undefined>;
45
+ readonly mergePresetName: v.NullableSchema<v.StringSchema<undefined>, undefined>;
46
+ /** What ultimately happened to the pull request. */
47
+ readonly decision: v.PicklistSchema<["pending_review", "auto_merged", "human_merged", "external_merged", "rejected"], undefined>;
48
+ /** How much review a human spent, once somebody tagged it; null while untagged. */
49
+ readonly reviewEffort: v.NullableSchema<v.PicklistSchema<["none", "minor", "major"], undefined>, undefined>;
50
+ /** The pull-request number within its repository, when known. */
51
+ readonly prNumber: v.NullableSchema<v.NumberSchema<undefined>, undefined>;
52
+ /** The pull request's web URL. */
53
+ readonly prUrl: v.NullableSchema<v.StringSchema<undefined>, undefined>;
54
+ /** Provider-neutral id of the repository the pull request belongs to. */
55
+ readonly repoId: v.NullableSchema<v.StringSchema<undefined>, undefined>;
56
+ /** Which VCS provider hosts it, so a mixed-provider workspace reads back correctly. */
57
+ readonly provider: v.NullableSchema<v.PicklistSchema<["github", "gitlab"], undefined>, undefined>;
58
+ /** Epoch ms the decision was recorded (the merger step's resolution). */
59
+ readonly createdAt: v.NumberSchema<undefined>;
60
+ /** Epoch ms the decision became terminal; null while `pending_review`. */
61
+ readonly resolvedAt: v.NullableSchema<v.NumberSchema<undefined>, undefined>;
62
+ /** Epoch ms the effort tag was recorded; null while untagged. */
63
+ readonly taggedAt: v.NullableSchema<v.NumberSchema<undefined>, undefined>;
64
+ }, undefined>;
65
+ export type PublicMergeRecord = v.InferOutput<typeof publicMergeRecordSchema>;
66
+ /**
67
+ * Every change class's accumulated track record, whole rather than paginated: the set is the
68
+ * closed {@link changeClassSchema} union, so the response is seven rows on every workspace and
69
+ * its size is computable before the request.
70
+ *
71
+ * A class with no records is present as zeros rather than absent, for the same reason the app's
72
+ * table renders every class: "nothing has landed in this class yet" and "this class was left out
73
+ * of the response" are different facts, and only one of them is about the workspace.
74
+ */
75
+ export declare const publicMergeClassRollupListSchema: v.ObjectSchema<{
76
+ readonly rollups: v.ArraySchema<v.ObjectSchema<{
77
+ readonly changeClass: v.PicklistSchema<["docs", "test", "dependency", "config", "source", "schema", "unknown"], undefined>;
78
+ readonly total: v.NumberSchema<undefined>;
79
+ readonly merged: v.NumberSchema<undefined>;
80
+ readonly autoMerged: v.NumberSchema<undefined>;
81
+ readonly humanMerged: v.NumberSchema<undefined>;
82
+ readonly externalMerged: v.NumberSchema<undefined>;
83
+ readonly rejected: v.NumberSchema<undefined>;
84
+ readonly pendingReview: v.NumberSchema<undefined>;
85
+ readonly effort: v.ObjectSchema<{
86
+ readonly none: v.NumberSchema<undefined>;
87
+ readonly minor: v.NumberSchema<undefined>;
88
+ readonly major: v.NumberSchema<undefined>;
89
+ readonly untagged: v.NumberSchema<undefined>;
90
+ }, undefined>;
91
+ }, undefined>, undefined>;
92
+ }, undefined>;
93
+ export type PublicMergeClassRollupList = v.InferOutput<typeof publicMergeClassRollupListSchema>;
94
+ //# sourceMappingURL=public-merge-evidence.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"public-merge-evidence.d.ts","sourceRoot":"","sources":["../src/public-merge-evidence.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,SAAS,CAAA;AAqC5B;;;;;;;;GAQG;AACH,eAAO,MAAM,uBAAuB;IAClC,wEAAwE;;IAExE,oFAAoF;;IAEpF;;;;;OAKG;;IAEH;;;;OAIG;;IAEH,wFAAwF;;IAExF;;;OAGG;;IAEH,wEAAwE;;IAExE,0EAA0E;;IAE1E;;;OAGG;;;IAGH,oDAAoD;;IAEpD,mFAAmF;;IAEnF,iEAAiE;;IAEjE,kCAAkC;;IAElC,yEAAyE;;IAEzE,uFAAuF;;IAEvF,yEAAyE;;IAEzE,0EAA0E;;IAE1E,iEAAiE;;aAEjE,CAAA;AACF,MAAM,MAAM,iBAAiB,GAAG,CAAC,CAAC,WAAW,CAAC,OAAO,uBAAuB,CAAC,CAAA;AAE7E;;;;;;;;GAQG;AACH,eAAO,MAAM,gCAAgC;;;;;;;;;;;;;;;;;aAE3C,CAAA;AACF,MAAM,MAAM,0BAA0B,GAAG,CAAC,CAAC,WAAW,CAAC,OAAO,gCAAgC,CAAC,CAAA"}
@@ -0,0 +1,106 @@
1
+ import * as v from 'valibot';
2
+ import { changeClassSchema, mergeClassRollupSchema, mergeTrackDecisionSchema, reviewEffortSchema, } from './mergeTrackRecord.js';
3
+ import { vcsProviderSchema } from './routes/auth.js';
4
+ // ---------------------------------------------------------------------------
5
+ // Public MERGE-EVIDENCE wire shapes (`/api/v1/runs/:runId/merge-record`,
6
+ // `/api/v1/merge-records/:recordId`, `…/effort`, and `/api/v1/merge-records/rollups`).
7
+ //
8
+ // The merge track record (ADR 0046) is the accumulated human evidence behind the auto-merge
9
+ // policy: what KIND of change a run made, what the merger scored it, what happened, and how
10
+ // much review a human actually spent. It was reachable only from a browser session, which
11
+ // split the headless story in half: an integration could START a run and MERGE its pull
12
+ // request through `/api/v1`, and then had nowhere to record how much review that merge took,
13
+ // nor any way to read back what the workspace has accumulated. So the one signal the policy is
14
+ // meant to eventually stand on was collectable only by the people who were not driving the runs.
15
+ //
16
+ // Three rules shape these shapes:
17
+ //
18
+ // 1. **The ROLLUPS are served verbatim** ({@link mergeClassRollupSchema}), the same aggregate
19
+ // the preset editor renders each class's rule against. A second, API-shaped projection of
20
+ // one `GROUP BY` is how two surfaces start reporting different auto-merge shares for one
21
+ // workspace. The consequence is worth stating: that schema is now part of the STABLE public
22
+ // surface and grows additively (CLAUDE.md, "The public API does not break").
23
+ // 2. **The RECORD is projected, because its id vocabulary differs.** `/api/v1` says `taskId`
24
+ // and `runId` where the stored row says `blockId` and `executionId`; publishing the row
25
+ // as-is would hand a caller two ids it cannot address anything with, next to the ones it
26
+ // can. Nothing is dropped in the projection: a consumer sees every field the record holds.
27
+ // 3. **`unknown` reaches the wire.** It is a first-class outcome (no VCS client wired, or an
28
+ // unreadable diff), not an error, and it never matches a per-class rule. A consumer that
29
+ // collapsed it onto a class would be reading a classification failure as a policy input.
30
+ // ---------------------------------------------------------------------------
31
+ /**
32
+ * One persisted merge decision, as `/api/v1` speaks it: the deterministic change class, the
33
+ * merger's scores at the decision, what happened to the pull request, and the reviewer-effort
34
+ * tag a human left (null until somebody tags it; tagging is never mandatory).
35
+ *
36
+ * The projection of the stored row (`mergeTrackRecordSchema`) onto the public id vocabulary:
37
+ * `recordId`/`taskId`/`runId` for the row, its task and its run. Provider-neutral by
38
+ * construction, so a GitLab deployment reads the same shape.
39
+ */
40
+ export const publicMergeRecordSchema = v.object({
41
+ /** The id to pass to `POST /api/v1/merge-records/{recordId}/effort`. */
42
+ recordId: v.string(),
43
+ /** The board task whose pull request this covers (`GET /api/v1/tasks/{taskId}`). */
44
+ taskId: v.string(),
45
+ /**
46
+ * The run that produced the pull request (`GET /api/v1/runs/{runId}/report`). Nullable
47
+ * because the column is; every record written today is born at a merge decision inside a run,
48
+ * so in practice it is set. An external merge does not mint a record, it settles the one the
49
+ * run already wrote.
50
+ */
51
+ runId: v.nullable(v.string()),
52
+ /**
53
+ * What kind of change the pull request made, derived on the backend from its changed-file
54
+ * list and never from an agent's opinion. A mixed diff resolves to the highest-ranked class
55
+ * present, so a per-class rule can only fire on a diff carrying nothing riskier.
56
+ */
57
+ changeClass: changeClassSchema,
58
+ /** How many files the pull request changed, when the changed-file list was readable. */
59
+ changedFileCount: v.nullable(v.number()),
60
+ /**
61
+ * The merger's complexity score at the decision, 0..1. The three scores move together: all
62
+ * null means the merger produced no parseable assessment, not that it scored zero.
63
+ */
64
+ complexity: v.nullable(v.number()),
65
+ /** The merger's risk score at the decision, 0..1 (see `complexity`). */
66
+ risk: v.nullable(v.number()),
67
+ /** The merger's impact score at the decision, 0..1 (see `complexity`). */
68
+ impact: v.nullable(v.number()),
69
+ /**
70
+ * The merge-threshold preset the decision was compared against. The id is absent for the
71
+ * deployment's built-in fallback preset, which has no stored row; the name is set either way.
72
+ */
73
+ mergePresetId: v.nullable(v.string()),
74
+ mergePresetName: v.nullable(v.string()),
75
+ /** What ultimately happened to the pull request. */
76
+ decision: mergeTrackDecisionSchema,
77
+ /** How much review a human spent, once somebody tagged it; null while untagged. */
78
+ reviewEffort: v.nullable(reviewEffortSchema),
79
+ /** The pull-request number within its repository, when known. */
80
+ prNumber: v.nullable(v.number()),
81
+ /** The pull request's web URL. */
82
+ prUrl: v.nullable(v.string()),
83
+ /** Provider-neutral id of the repository the pull request belongs to. */
84
+ repoId: v.nullable(v.string()),
85
+ /** Which VCS provider hosts it, so a mixed-provider workspace reads back correctly. */
86
+ provider: v.nullable(vcsProviderSchema),
87
+ /** Epoch ms the decision was recorded (the merger step's resolution). */
88
+ createdAt: v.number(),
89
+ /** Epoch ms the decision became terminal; null while `pending_review`. */
90
+ resolvedAt: v.nullable(v.number()),
91
+ /** Epoch ms the effort tag was recorded; null while untagged. */
92
+ taggedAt: v.nullable(v.number()),
93
+ });
94
+ /**
95
+ * Every change class's accumulated track record, whole rather than paginated: the set is the
96
+ * closed {@link changeClassSchema} union, so the response is seven rows on every workspace and
97
+ * its size is computable before the request.
98
+ *
99
+ * A class with no records is present as zeros rather than absent, for the same reason the app's
100
+ * table renders every class: "nothing has landed in this class yet" and "this class was left out
101
+ * of the response" are different facts, and only one of them is about the workspace.
102
+ */
103
+ export const publicMergeClassRollupListSchema = v.object({
104
+ rollups: v.array(mergeClassRollupSchema),
105
+ });
106
+ //# sourceMappingURL=public-merge-evidence.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"public-merge-evidence.js","sourceRoot":"","sources":["../src/public-merge-evidence.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,SAAS,CAAA;AAC5B,OAAO,EACL,iBAAiB,EACjB,sBAAsB,EACtB,wBAAwB,EACxB,kBAAkB,GACnB,MAAM,uBAAuB,CAAA;AAC9B,OAAO,EAAE,iBAAiB,E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Q,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC;IACvC,oDAAoD;IACpD,QAAQ,EAAE,wBAAwB;IAClC,mFAAmF;IACnF,YAAY,EAAE,CAAC,CAAC,QAAQ,CAAC,kBAAkB,CAAC;IAC5C,iEAAiE;IACjE,QAAQ,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC;IAChC,kCAAkC;IAClC,KAAK,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC;IAC7B,yEAAyE;IACzE,MAAM,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC;IAC9B,uFAAuF;IACvF,QAAQ,EAAE,CAAC,CAAC,QAAQ,CAAC,iBAAiB,CAAC;IACvC,yEAAyE;IACzE,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE;IACrB,0EAA0E;IAC1E,UAAU,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC;IAClC,iEAAiE;IACjE,QAAQ,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC;CACjC,CAAC,CAAA;AAGF;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,gCAAgC,GAAG,CAAC,CAAC,MAAM,CAAC;IACvD,OAAO,EAAE,CAAC,CAAC,KAAK,CAAC,sBAAsB,CAAC;CACzC,CAAC,CAAA"}
@@ -0,0 +1,204 @@
1
+ import * as v from 'valibot';
2
+ /**
3
+ * The time window a breakdown aggregates over, measured back from `generatedAt` and snapped
4
+ * DOWN to a bucket edge (see {@link publicSpendSchema}'s `since`).
5
+ *
6
+ * Same members as the internal `reportWindowSchema` in `reports.ts`, and `public-spend.test.ts`
7
+ * asserts the two stay in step, but this is the FROZEN copy: adding a
8
+ * window internally does not publish it, and removing one internally has to arrive here as a
9
+ * deliberate `/api/v1` decision rather than as a member that quietly stopped being accepted.
10
+ */
11
+ export declare const publicSpendWindowSchema: v.PicklistSchema<["24h", "7d", "30d", "90d"], undefined>;
12
+ export type PublicSpendWindow = v.InferOutput<typeof publicSpendWindowSchema>;
13
+ /**
14
+ * Which store answered a breakdown. Frozen here for the same reason the window is: this is a
15
+ * value an external consumer branches on, so the internal spelling of it is not free to move.
16
+ */
17
+ export declare const publicSpendSourceSchema: v.PicklistSchema<["ledger", "daily-rollup"], undefined>;
18
+ export type PublicSpendSource = v.InferOutput<typeof publicSpendSourceSchema>;
19
+ /**
20
+ * Hard ceiling on the slices one response may carry.
21
+ *
22
+ * A real bound rather than a suggestion: two of the published dimensions grow with ACTIVITY
23
+ * rather than with a catalog (`run` is one row per pipeline execution, `ticket` one per issue
24
+ * a run touched), so an unbounded `90d` breakdown on a busy board is a response nobody sized.
25
+ * The rows are heaviest first, so the cap is a prefix by cost: the slice a cost question is
26
+ * about, with {@link publicSpendSchema}'s `truncated` saying when there was a tail.
27
+ */
28
+ export declare const PUBLIC_SPEND_MAX_ROWS = 500;
29
+ /**
30
+ * What a public spend breakdown groups by.
31
+ *
32
+ * The two axes this surface exists for are `repo` and `ticket`: what an organisation budgets
33
+ * against, and the pair no other public read can produce. `run` is the finest of the three
34
+ * (one pipeline execution, end to end), and the rest are the same slices the usage read
35
+ * already implies, offered here because they come from one grouped query rather than four.
36
+ */
37
+ export declare const publicSpendDimensionSchema: v.PicklistSchema<["model", "agentKind", "service", "repo", "taskType", "ticket", "run"], undefined>;
38
+ export type PublicSpendDimension = v.InferOutput<typeof publicSpendDimensionSchema>;
39
+ /**
40
+ * The spend dimensions this surface deliberately does NOT offer, each with the reason.
41
+ *
42
+ * Stated rather than left as an absence, and paired with a test asserting every internal
43
+ * `reportSpendDimensionSchema` member is EXACTLY ONCE across the two lists: a dimension
44
+ * added internally then has to be either published or explained, instead of silently missing
45
+ * from the surface that four SDKs are generated against.
46
+ */
47
+ export declare const PUBLIC_SPEND_DIMENSIONS_OMITTED: Record<string, string>;
48
+ /**
49
+ * One slice of a spend breakdown.
50
+ *
51
+ * `key` is the raw dimension value and the row's identity; the EMPTY string is a real bucket
52
+ * meaning UNATTRIBUTED (a call whose run, service, repository or ticket could not be resolved),
53
+ * never a dropped row. Dropping it would under-report the window while the breakdown still
54
+ * looked complete, which is the one thing `totals` and `truncated` exist to prevent.
55
+ *
56
+ * The two costs are separate on purpose and must never be summed: only `meteredCost` is money.
57
+ * `subscriptionCost` is what the same tokens WOULD have cost on the metered API, which is what
58
+ * a flat-rate harness plan (Claude Code, Codex, …) spends nothing per token on, and it is why
59
+ * the spend budget excludes it.
60
+ */
61
+ export declare const publicSpendRowSchema: v.ObjectSchema<{
62
+ readonly key: v.StringSchema<undefined>;
63
+ /**
64
+ * A display name for `key` where the store can resolve one (a service's frame title, a
65
+ * repository's `owner/name`, the title of the block a run targets); null where the key is
66
+ * self-describing (a model id, an agent kind, a task type) or where nothing could be joined
67
+ * (a repository this board holds no projection row for keeps its money and loses its name).
68
+ */
69
+ readonly label: v.NullableSchema<v.StringSchema<undefined>, undefined>;
70
+ readonly inputTokens: v.NumberSchema<undefined>;
71
+ readonly outputTokens: v.NumberSchema<undefined>;
72
+ /** Recorded LLM calls in this slice, both billing kinds. */
73
+ readonly calls: v.NumberSchema<undefined>;
74
+ /** Real per-token cost, in the response's `currency`. */
75
+ readonly meteredCost: v.NumberSchema<undefined>;
76
+ /** Illustrative equivalent-API cost of flat-rate subscription usage. Never real spend. */
77
+ readonly subscriptionCost: v.NumberSchema<undefined>;
78
+ }, undefined>;
79
+ export type PublicSpendRow = v.InferOutput<typeof publicSpendRowSchema>;
80
+ /**
81
+ * Window-wide totals, over EVERY slice the window holds rather than only the ones `rows`
82
+ * carries. So a `truncated` breakdown still reports what the board actually spent, the same
83
+ * rule the run LLM export states about its own rollups, and a caller reading the top twenty
84
+ * repositories can still say what share of the bill they are. On an untruncated response the
85
+ * rows sum to exactly this.
86
+ */
87
+ export declare const publicSpendTotalsSchema: v.ObjectSchema<{
88
+ readonly inputTokens: v.NumberSchema<undefined>;
89
+ readonly outputTokens: v.NumberSchema<undefined>;
90
+ readonly calls: v.NumberSchema<undefined>;
91
+ readonly meteredCost: v.NumberSchema<undefined>;
92
+ readonly subscriptionCost: v.NumberSchema<undefined>;
93
+ }, undefined>;
94
+ export type PublicSpendTotals = v.InferOutput<typeof publicSpendTotalsSchema>;
95
+ /** Query of `GET /api/v1/usage/spend`. */
96
+ export declare const publicSpendQuerySchema: v.ObjectSchema<{
97
+ readonly dimension: v.PicklistSchema<["model", "agentKind", "service", "repo", "taskType", "ticket", "run"], undefined>;
98
+ /** Defaults to `7d`, the widest window served live off the ledger. */
99
+ readonly window: v.OptionalSchema<v.PicklistSchema<["24h", "7d", "30d", "90d"], undefined>, undefined>;
100
+ /**
101
+ * How many SLICES to return, 1..{@link PUBLIC_SPEND_MAX_ROWS} (default 100), heaviest first.
102
+ * `totals` is unaffected: it aggregates the whole window whatever this says, so a capped
103
+ * response still reports what the board spent.
104
+ *
105
+ * Digit-checked before the numeric coercion, like every other query number on this API:
106
+ * bare `Number()` also accepts `1e9`, `0x64` and `' '`, which read as plausible values
107
+ * rather than as the 400 a malformed request has earned.
108
+ */
109
+ readonly limit: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RegexAction<string, "Must be a whole number">, v.TransformAction<any, number>, v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 1, undefined>, v.MaxValueAction<number, 500, undefined>]>, undefined>;
110
+ }, undefined>;
111
+ export type PublicSpendQuery = v.InferOutput<typeof publicSpendQuerySchema>;
112
+ /**
113
+ * The workspace's spend over a window, sliced one way.
114
+ *
115
+ * ONE dimension per request rather than every dimension at once (the shape the internal
116
+ * Reports panel reads): a panel renders all of them together, where a caller asks a question
117
+ * and each dimension is its own grouped query. Serving seven would make the common request
118
+ * seven times the work and the response mostly rows nobody asked for.
119
+ */
120
+ export declare const publicSpendSchema: v.ObjectSchema<{
121
+ /** Echoes the requested dimension, so a stored response says what it grouped by. */
122
+ readonly dimension: v.PicklistSchema<["model", "agentKind", "service", "repo", "taskType", "ticket", "run"], undefined>;
123
+ readonly window: v.PicklistSchema<["24h", "7d", "30d", "90d"], undefined>;
124
+ /** When the breakdown was computed (epoch ms). */
125
+ readonly generatedAt: v.NumberSchema<undefined>;
126
+ /**
127
+ * Start of the window (epoch ms): `generatedAt - window`, snapped DOWN to a bucket edge, and
128
+ * the real span every number here was computed over. A window therefore covers up to one
129
+ * bucket more than its nominal length, which is why this is reported rather than left to be
130
+ * re-derived from `window`.
131
+ */
132
+ readonly since: v.NumberSchema<undefined>;
133
+ /** ISO 4217 currency both costs are denominated in (the deployment's base currency). */
134
+ readonly currency: v.StringSchema<undefined>;
135
+ /**
136
+ * Which store answered: a live scan of the metered ledger (`ledger`, the `24h`/`7d` windows)
137
+ * or the durable daily cost-attribution rollup (`daily-rollup`, `30d`/`90d`).
138
+ *
139
+ * They differ in more than freshness. The ledger resolves a repository or a ticket through
140
+ * the LIVE links, so it re-attributes history whenever a service is re-pointed or an issue
141
+ * re-imported, and it forgets whatever retention has pruned. The rollup froze that
142
+ * attribution while the money was being spent and is never pruned, at the cost of being only
143
+ * as current as the last sweep. A reader comparing two windows has to know which is talking.
144
+ */
145
+ readonly source: v.PicklistSchema<["ledger", "daily-rollup"], undefined>;
146
+ /**
147
+ * On a `daily-rollup` window: the newest UTC day (epoch ms, midnight) the rollup sweep has
148
+ * covered, or null when no pass has ever completed. Always null on a `ledger` window, where
149
+ * there is no rollup in the path to be behind.
150
+ *
151
+ * Null is why the field exists: a rollup that has never run and a board that spent nothing
152
+ * produce the same empty breakdown, and they call for opposite reactions. Read it before
153
+ * reporting a quiet quarter.
154
+ */
155
+ readonly rolledUpThrough: v.NullableSchema<v.NumberSchema<undefined>, undefined>;
156
+ readonly totals: v.ObjectSchema<{
157
+ readonly inputTokens: v.NumberSchema<undefined>;
158
+ readonly outputTokens: v.NumberSchema<undefined>;
159
+ readonly calls: v.NumberSchema<undefined>;
160
+ readonly meteredCost: v.NumberSchema<undefined>;
161
+ readonly subscriptionCost: v.NumberSchema<undefined>;
162
+ }, undefined>;
163
+ /**
164
+ * True when the window holds more slices than `limit`, so `rows` is the heaviest prefix of
165
+ * them rather than all of them. STATED rather than left to be inferred from
166
+ * `rows.length === limit`, which cannot tell a board with exactly `limit` slices from one
167
+ * with a tail, and which is the reading that turns a capped list into a complete one.
168
+ *
169
+ * `totals` above is unaffected, so the share the returned rows account for is computable:
170
+ * what a truncated breakdown loses is the identity of the long tail, never its money.
171
+ */
172
+ readonly truncated: v.BooleanSchema<undefined>;
173
+ /**
174
+ * The slices, heaviest by metered cost first, capped at `limit`.
175
+ *
176
+ * Capped rather than served whole because two of the published dimensions grow with
177
+ * ACTIVITY rather than with a catalog: `run` is one row per pipeline execution and `ticket`
178
+ * one per issue a run touched, so a busy board over `90d` is thousands of rows on a
179
+ * response nobody sized. (`model`, `agentKind`, `service`, `repo` and `taskType` all key on
180
+ * a catalog and stay small on their own.) The order is what makes the cap honest: a cost
181
+ * question is about the heavy end, `truncated` says when there was a tail, and `totals`
182
+ * still covers all of it.
183
+ */
184
+ readonly rows: v.ArraySchema<v.ObjectSchema<{
185
+ readonly key: v.StringSchema<undefined>;
186
+ /**
187
+ * A display name for `key` where the store can resolve one (a service's frame title, a
188
+ * repository's `owner/name`, the title of the block a run targets); null where the key is
189
+ * self-describing (a model id, an agent kind, a task type) or where nothing could be joined
190
+ * (a repository this board holds no projection row for keeps its money and loses its name).
191
+ */
192
+ readonly label: v.NullableSchema<v.StringSchema<undefined>, undefined>;
193
+ readonly inputTokens: v.NumberSchema<undefined>;
194
+ readonly outputTokens: v.NumberSchema<undefined>;
195
+ /** Recorded LLM calls in this slice, both billing kinds. */
196
+ readonly calls: v.NumberSchema<undefined>;
197
+ /** Real per-token cost, in the response's `currency`. */
198
+ readonly meteredCost: v.NumberSchema<undefined>;
199
+ /** Illustrative equivalent-API cost of flat-rate subscription usage. Never real spend. */
200
+ readonly subscriptionCost: v.NumberSchema<undefined>;
201
+ }, undefined>, undefined>;
202
+ }, undefined>;
203
+ export type PublicSpend = v.InferOutput<typeof publicSpendSchema>;
204
+ //# sourceMappingURL=public-spend.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"public-spend.d.ts","sourceRoot":"","sources":["../src/public-spend.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,SAAS,CAAA;AAwB5B;;;;;;;;GAQG;AACH,eAAO,MAAM,uBAAuB,0DAA0C,CAAA;AAC9E,MAAM,MAAM,iBAAiB,GAAG,CAAC,CAAC,WAAW,CAAC,OAAO,uBAAuB,CAAC,CAAA;AAE7E;;;GAGG;AACH,eAAO,MAAM,uBAAuB,yDAAyC,CAAA;AAC7E,MAAM,MAAM,iBAAiB,GAAG,CAAC,CAAC,WAAW,CAAC,OAAO,uBAAuB,CAAC,CAAA;AAE7E;;;;;;;;GAQG;AACH,eAAO,MAAM,qBAAqB,MAAM,CAAA;AAExC;;;;;;;GAOG;AACH,eAAO,MAAM,0BAA0B,qGAQrC,CAAA;AACF,MAAM,MAAM,oBAAoB,GAAG,CAAC,CAAC,WAAW,CAAC,OAAO,0BAA0B,CAAC,CAAA;AAEnF;;;;;;;GAOG;AACH,eAAO,MAAM,+BAA+B,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAKlE,CAAA;AAED;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,oBAAoB;;IAE/B;;;;;OAKG;;;;IAIH,4DAA4D;;IAE5D,yDAAyD;;IAEzD,0FAA0F;;aAE1F,CAAA;AACF,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,WAAW,CAAC,OAAO,oBAAoB,CAAC,CAAA;AAEvE;;;;;;GAMG;AACH,eAAO,MAAM,uBAAuB;;;;;;aAMlC,CAAA;AACF,MAAM,MAAM,iBAAiB,GAAG,CAAC,CAAC,WAAW,CAAC,OAAO,uBAAuB,CAAC,CAAA;AAE7E,0CAA0C;AAC1C,eAAO,MAAM,sBAAsB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