@humain/humain-code-contracts 0.3.2 → 0.3.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +24 -0
- package/README.md +10 -1
- package/dist/trace-artifact.d.ts +1 -1
- package/dist/trace-artifact.d.ts.map +1 -1
- package/dist/trace-artifact.js +3 -1
- package/dist/trace-artifact.js.map +1 -1
- package/dist/trace-http.d.ts.map +1 -1
- package/dist/trace-http.js +3 -0
- package/dist/trace-http.js.map +1 -1
- package/dist/trace-payload.d.ts +25 -1
- package/dist/trace-payload.d.ts.map +1 -1
- package/dist/trace-payload.js +2 -0
- package/dist/trace-payload.js.map +1 -1
- package/dist/trace-records.d.ts +985 -0
- package/dist/trace-records.d.ts.map +1 -0
- package/dist/trace-records.js +535 -0
- package/dist/trace-records.js.map +1 -0
- package/dist/trace.d.ts +1 -0
- package/dist/trace.d.ts.map +1 -1
- package/dist/trace.js +1 -0
- package/dist/trace.js.map +1 -1
- package/package.json +5 -5
|
@@ -0,0 +1,985 @@
|
|
|
1
|
+
import { type Static, Type } from "typebox";
|
|
2
|
+
import { dhUsageMeasurementSchema } from "./trace-payload.ts";
|
|
3
|
+
export declare const DH_RECORDS_SCHEMA_IDS: Readonly<{
|
|
4
|
+
readonly generationDeleteRequest: "dh.generation-delete-request/1";
|
|
5
|
+
readonly generationDeletion: "dh.generation-deletion/1";
|
|
6
|
+
readonly legalHold: "dh.legal-hold/1";
|
|
7
|
+
readonly legalHoldReleaseRequest: "dh.legal-hold-release-request/1";
|
|
8
|
+
readonly legalHoldRequest: "dh.legal-hold-request/1";
|
|
9
|
+
readonly usageCorrection: "dh.usage-correction/1";
|
|
10
|
+
readonly usageResponse: "dh.usage-response/1";
|
|
11
|
+
readonly usageSearchPage: "dh.usage-search-page/1";
|
|
12
|
+
}>;
|
|
13
|
+
/** Route to schema mapping. DH_ROUTES stays byte-identical; DELETE routes carry no body, so their request DTO is path-derived. */
|
|
14
|
+
export declare const DH_RECORDS_ROUTE_SCHEMAS: Readonly<{
|
|
15
|
+
readonly usage: Readonly<{
|
|
16
|
+
response: "dh.usage-response/1";
|
|
17
|
+
}>;
|
|
18
|
+
readonly search: Readonly<{
|
|
19
|
+
response: "dh.usage-search-page/1";
|
|
20
|
+
}>;
|
|
21
|
+
readonly generationDelete: Readonly<{
|
|
22
|
+
request: "dh.generation-delete-request/1";
|
|
23
|
+
response: "dh.generation-deletion/1";
|
|
24
|
+
}>;
|
|
25
|
+
readonly legalHoldCreate: Readonly<{
|
|
26
|
+
request: "dh.legal-hold-request/1";
|
|
27
|
+
response: "dh.legal-hold/1";
|
|
28
|
+
}>;
|
|
29
|
+
readonly legalHoldRelease: Readonly<{
|
|
30
|
+
request: "dh.legal-hold-release-request/1";
|
|
31
|
+
}>;
|
|
32
|
+
}>;
|
|
33
|
+
export declare const DH_USAGE_PAGE_MAX_ITEMS = 100;
|
|
34
|
+
export declare const DH_USAGE_RESPONSE_MAX_ATTEMPTS = 4096;
|
|
35
|
+
export declare const DH_USAGE_MAX_CURRENCIES = 16;
|
|
36
|
+
export declare const DH_LEGAL_HOLD_REASONS: readonly ["litigation", "regulatory-inquiry", "internal-investigation", "audit"];
|
|
37
|
+
export declare const DH_LEGAL_HOLD_STATES: readonly ["active", "released"];
|
|
38
|
+
export declare const DH_DELETION_STATES: readonly ["blocked-by-hold", "accepted", "claimed", "tombstoned"];
|
|
39
|
+
export declare const DH_USAGE_CORRECTION_REASONS: readonly ["provider-reconciliation", "price-correction", "capture-error", "duplicate-owner"];
|
|
40
|
+
export declare const DH_DELETION_MAX_HOLD_IDS = 64;
|
|
41
|
+
/** Upper bound for one currency amount; keeps float sums finite and the comparison tolerance meaningful. */
|
|
42
|
+
export declare const DH_USAGE_MAX_AMOUNT = 1000000000000000;
|
|
43
|
+
declare function totalsSchema(): Type.TObject<{
|
|
44
|
+
/** Counted submission-owned records only: superseded records and inclusive Flow aggregates are excluded. */
|
|
45
|
+
readonly submissions: Type.TInteger;
|
|
46
|
+
readonly input: Type.TUnion<[Type.TObject<{
|
|
47
|
+
readonly state: Type.TLiteral<"unknown">;
|
|
48
|
+
readonly unknownSubmissions: Type.TInteger;
|
|
49
|
+
}>, Type.TObject<{
|
|
50
|
+
readonly state: Type.TLiteral<"known">;
|
|
51
|
+
readonly value: Type.TInteger;
|
|
52
|
+
readonly knownSubmissions: Type.TInteger;
|
|
53
|
+
}>, Type.TObject<{
|
|
54
|
+
readonly state: Type.TLiteral<"partial">;
|
|
55
|
+
readonly value: Type.TInteger;
|
|
56
|
+
readonly knownSubmissions: Type.TInteger;
|
|
57
|
+
readonly unknownSubmissions: Type.TInteger;
|
|
58
|
+
}>]>;
|
|
59
|
+
readonly output: Type.TUnion<[Type.TObject<{
|
|
60
|
+
readonly state: Type.TLiteral<"unknown">;
|
|
61
|
+
readonly unknownSubmissions: Type.TInteger;
|
|
62
|
+
}>, Type.TObject<{
|
|
63
|
+
readonly state: Type.TLiteral<"known">;
|
|
64
|
+
readonly value: Type.TInteger;
|
|
65
|
+
readonly knownSubmissions: Type.TInteger;
|
|
66
|
+
}>, Type.TObject<{
|
|
67
|
+
readonly state: Type.TLiteral<"partial">;
|
|
68
|
+
readonly value: Type.TInteger;
|
|
69
|
+
readonly knownSubmissions: Type.TInteger;
|
|
70
|
+
readonly unknownSubmissions: Type.TInteger;
|
|
71
|
+
}>]>;
|
|
72
|
+
readonly cacheRead: Type.TUnion<[Type.TObject<{
|
|
73
|
+
readonly state: Type.TLiteral<"unknown">;
|
|
74
|
+
readonly unknownSubmissions: Type.TInteger;
|
|
75
|
+
}>, Type.TObject<{
|
|
76
|
+
readonly state: Type.TLiteral<"known">;
|
|
77
|
+
readonly value: Type.TInteger;
|
|
78
|
+
readonly knownSubmissions: Type.TInteger;
|
|
79
|
+
}>, Type.TObject<{
|
|
80
|
+
readonly state: Type.TLiteral<"partial">;
|
|
81
|
+
readonly value: Type.TInteger;
|
|
82
|
+
readonly knownSubmissions: Type.TInteger;
|
|
83
|
+
readonly unknownSubmissions: Type.TInteger;
|
|
84
|
+
}>]>;
|
|
85
|
+
readonly cacheWrite: Type.TUnion<[Type.TObject<{
|
|
86
|
+
readonly state: Type.TLiteral<"unknown">;
|
|
87
|
+
readonly unknownSubmissions: Type.TInteger;
|
|
88
|
+
}>, Type.TObject<{
|
|
89
|
+
readonly state: Type.TLiteral<"known">;
|
|
90
|
+
readonly value: Type.TInteger;
|
|
91
|
+
readonly knownSubmissions: Type.TInteger;
|
|
92
|
+
}>, Type.TObject<{
|
|
93
|
+
readonly state: Type.TLiteral<"partial">;
|
|
94
|
+
readonly value: Type.TInteger;
|
|
95
|
+
readonly knownSubmissions: Type.TInteger;
|
|
96
|
+
readonly unknownSubmissions: Type.TInteger;
|
|
97
|
+
}>]>;
|
|
98
|
+
readonly reasoning: Type.TUnion<[Type.TObject<{
|
|
99
|
+
readonly state: Type.TLiteral<"unknown">;
|
|
100
|
+
readonly unknownSubmissions: Type.TInteger;
|
|
101
|
+
}>, Type.TObject<{
|
|
102
|
+
readonly state: Type.TLiteral<"known">;
|
|
103
|
+
readonly value: Type.TInteger;
|
|
104
|
+
readonly knownSubmissions: Type.TInteger;
|
|
105
|
+
}>, Type.TObject<{
|
|
106
|
+
readonly state: Type.TLiteral<"partial">;
|
|
107
|
+
readonly value: Type.TInteger;
|
|
108
|
+
readonly knownSubmissions: Type.TInteger;
|
|
109
|
+
readonly unknownSubmissions: Type.TInteger;
|
|
110
|
+
}>]>;
|
|
111
|
+
readonly totalTokens: Type.TUnion<[Type.TObject<{
|
|
112
|
+
readonly state: Type.TLiteral<"unknown">;
|
|
113
|
+
readonly unknownSubmissions: Type.TInteger;
|
|
114
|
+
}>, Type.TObject<{
|
|
115
|
+
readonly state: Type.TLiteral<"known">;
|
|
116
|
+
readonly value: Type.TInteger;
|
|
117
|
+
readonly knownSubmissions: Type.TInteger;
|
|
118
|
+
}>, Type.TObject<{
|
|
119
|
+
readonly state: Type.TLiteral<"partial">;
|
|
120
|
+
readonly value: Type.TInteger;
|
|
121
|
+
readonly knownSubmissions: Type.TInteger;
|
|
122
|
+
readonly unknownSubmissions: Type.TInteger;
|
|
123
|
+
}>]>;
|
|
124
|
+
readonly durationMs: Type.TUnion<[Type.TObject<{
|
|
125
|
+
readonly state: Type.TLiteral<"unknown">;
|
|
126
|
+
readonly unknownSubmissions: Type.TInteger;
|
|
127
|
+
}>, Type.TObject<{
|
|
128
|
+
readonly state: Type.TLiteral<"known">;
|
|
129
|
+
readonly value: Type.TInteger;
|
|
130
|
+
readonly knownSubmissions: Type.TInteger;
|
|
131
|
+
}>, Type.TObject<{
|
|
132
|
+
readonly state: Type.TLiteral<"partial">;
|
|
133
|
+
readonly value: Type.TInteger;
|
|
134
|
+
readonly knownSubmissions: Type.TInteger;
|
|
135
|
+
readonly unknownSubmissions: Type.TInteger;
|
|
136
|
+
}>]>;
|
|
137
|
+
readonly cost: Type.TUnion<[Type.TObject<{
|
|
138
|
+
readonly state: Type.TLiteral<"unknown">;
|
|
139
|
+
readonly unknownSubmissions: Type.TInteger;
|
|
140
|
+
}>, Type.TObject<{
|
|
141
|
+
readonly state: Type.TLiteral<"known">;
|
|
142
|
+
readonly byCurrency: Type.TArray<Type.TObject<{
|
|
143
|
+
readonly currency: Type.TString;
|
|
144
|
+
readonly amount: Type.TNumber;
|
|
145
|
+
readonly submissions: Type.TInteger;
|
|
146
|
+
}>>;
|
|
147
|
+
}>, Type.TObject<{
|
|
148
|
+
readonly state: Type.TLiteral<"partial">;
|
|
149
|
+
readonly byCurrency: Type.TArray<Type.TObject<{
|
|
150
|
+
readonly currency: Type.TString;
|
|
151
|
+
readonly amount: Type.TNumber;
|
|
152
|
+
readonly submissions: Type.TInteger;
|
|
153
|
+
}>>;
|
|
154
|
+
readonly unknownSubmissions: Type.TInteger;
|
|
155
|
+
}>]>;
|
|
156
|
+
}>;
|
|
157
|
+
export type DhUsageTotals = Static<ReturnType<typeof totalsSchema>>;
|
|
158
|
+
type Measurement = Static<ReturnType<typeof dhUsageMeasurementSchema>>;
|
|
159
|
+
/** Sums totals. Unknown never contributes a value; any unknown submission turns known into partial. */
|
|
160
|
+
export declare function sumDhUsageTotals(parts: readonly DhUsageTotals[]): DhUsageTotals;
|
|
161
|
+
/** Totals for counted submission-owned measurements. No measurements is unknown, not zero. */
|
|
162
|
+
export declare function dhUsageTotalsOf(measurements: readonly Measurement[]): DhUsageTotals;
|
|
163
|
+
declare function usageResponseSchema(): Type.TObject<{
|
|
164
|
+
readonly schema: Type.TLiteral<"dh.usage-response/1">;
|
|
165
|
+
readonly generationId: Type.TString;
|
|
166
|
+
readonly captureCutoff: Type.TString;
|
|
167
|
+
/** Sum of every attempt below, failed attempts included. */
|
|
168
|
+
readonly totals: Type.TObject<{
|
|
169
|
+
/** Counted submission-owned records only: superseded records and inclusive Flow aggregates are excluded. */
|
|
170
|
+
readonly submissions: Type.TInteger;
|
|
171
|
+
readonly input: Type.TUnion<[Type.TObject<{
|
|
172
|
+
readonly state: Type.TLiteral<"unknown">;
|
|
173
|
+
readonly unknownSubmissions: Type.TInteger;
|
|
174
|
+
}>, Type.TObject<{
|
|
175
|
+
readonly state: Type.TLiteral<"known">;
|
|
176
|
+
readonly value: Type.TInteger;
|
|
177
|
+
readonly knownSubmissions: Type.TInteger;
|
|
178
|
+
}>, Type.TObject<{
|
|
179
|
+
readonly state: Type.TLiteral<"partial">;
|
|
180
|
+
readonly value: Type.TInteger;
|
|
181
|
+
readonly knownSubmissions: Type.TInteger;
|
|
182
|
+
readonly unknownSubmissions: Type.TInteger;
|
|
183
|
+
}>]>;
|
|
184
|
+
readonly output: Type.TUnion<[Type.TObject<{
|
|
185
|
+
readonly state: Type.TLiteral<"unknown">;
|
|
186
|
+
readonly unknownSubmissions: Type.TInteger;
|
|
187
|
+
}>, Type.TObject<{
|
|
188
|
+
readonly state: Type.TLiteral<"known">;
|
|
189
|
+
readonly value: Type.TInteger;
|
|
190
|
+
readonly knownSubmissions: Type.TInteger;
|
|
191
|
+
}>, Type.TObject<{
|
|
192
|
+
readonly state: Type.TLiteral<"partial">;
|
|
193
|
+
readonly value: Type.TInteger;
|
|
194
|
+
readonly knownSubmissions: Type.TInteger;
|
|
195
|
+
readonly unknownSubmissions: Type.TInteger;
|
|
196
|
+
}>]>;
|
|
197
|
+
readonly cacheRead: Type.TUnion<[Type.TObject<{
|
|
198
|
+
readonly state: Type.TLiteral<"unknown">;
|
|
199
|
+
readonly unknownSubmissions: Type.TInteger;
|
|
200
|
+
}>, Type.TObject<{
|
|
201
|
+
readonly state: Type.TLiteral<"known">;
|
|
202
|
+
readonly value: Type.TInteger;
|
|
203
|
+
readonly knownSubmissions: Type.TInteger;
|
|
204
|
+
}>, Type.TObject<{
|
|
205
|
+
readonly state: Type.TLiteral<"partial">;
|
|
206
|
+
readonly value: Type.TInteger;
|
|
207
|
+
readonly knownSubmissions: Type.TInteger;
|
|
208
|
+
readonly unknownSubmissions: Type.TInteger;
|
|
209
|
+
}>]>;
|
|
210
|
+
readonly cacheWrite: Type.TUnion<[Type.TObject<{
|
|
211
|
+
readonly state: Type.TLiteral<"unknown">;
|
|
212
|
+
readonly unknownSubmissions: Type.TInteger;
|
|
213
|
+
}>, Type.TObject<{
|
|
214
|
+
readonly state: Type.TLiteral<"known">;
|
|
215
|
+
readonly value: Type.TInteger;
|
|
216
|
+
readonly knownSubmissions: Type.TInteger;
|
|
217
|
+
}>, Type.TObject<{
|
|
218
|
+
readonly state: Type.TLiteral<"partial">;
|
|
219
|
+
readonly value: Type.TInteger;
|
|
220
|
+
readonly knownSubmissions: Type.TInteger;
|
|
221
|
+
readonly unknownSubmissions: Type.TInteger;
|
|
222
|
+
}>]>;
|
|
223
|
+
readonly reasoning: Type.TUnion<[Type.TObject<{
|
|
224
|
+
readonly state: Type.TLiteral<"unknown">;
|
|
225
|
+
readonly unknownSubmissions: Type.TInteger;
|
|
226
|
+
}>, Type.TObject<{
|
|
227
|
+
readonly state: Type.TLiteral<"known">;
|
|
228
|
+
readonly value: Type.TInteger;
|
|
229
|
+
readonly knownSubmissions: Type.TInteger;
|
|
230
|
+
}>, Type.TObject<{
|
|
231
|
+
readonly state: Type.TLiteral<"partial">;
|
|
232
|
+
readonly value: Type.TInteger;
|
|
233
|
+
readonly knownSubmissions: Type.TInteger;
|
|
234
|
+
readonly unknownSubmissions: Type.TInteger;
|
|
235
|
+
}>]>;
|
|
236
|
+
readonly totalTokens: Type.TUnion<[Type.TObject<{
|
|
237
|
+
readonly state: Type.TLiteral<"unknown">;
|
|
238
|
+
readonly unknownSubmissions: Type.TInteger;
|
|
239
|
+
}>, Type.TObject<{
|
|
240
|
+
readonly state: Type.TLiteral<"known">;
|
|
241
|
+
readonly value: Type.TInteger;
|
|
242
|
+
readonly knownSubmissions: Type.TInteger;
|
|
243
|
+
}>, Type.TObject<{
|
|
244
|
+
readonly state: Type.TLiteral<"partial">;
|
|
245
|
+
readonly value: Type.TInteger;
|
|
246
|
+
readonly knownSubmissions: Type.TInteger;
|
|
247
|
+
readonly unknownSubmissions: Type.TInteger;
|
|
248
|
+
}>]>;
|
|
249
|
+
readonly durationMs: Type.TUnion<[Type.TObject<{
|
|
250
|
+
readonly state: Type.TLiteral<"unknown">;
|
|
251
|
+
readonly unknownSubmissions: Type.TInteger;
|
|
252
|
+
}>, Type.TObject<{
|
|
253
|
+
readonly state: Type.TLiteral<"known">;
|
|
254
|
+
readonly value: Type.TInteger;
|
|
255
|
+
readonly knownSubmissions: Type.TInteger;
|
|
256
|
+
}>, Type.TObject<{
|
|
257
|
+
readonly state: Type.TLiteral<"partial">;
|
|
258
|
+
readonly value: Type.TInteger;
|
|
259
|
+
readonly knownSubmissions: Type.TInteger;
|
|
260
|
+
readonly unknownSubmissions: Type.TInteger;
|
|
261
|
+
}>]>;
|
|
262
|
+
readonly cost: Type.TUnion<[Type.TObject<{
|
|
263
|
+
readonly state: Type.TLiteral<"unknown">;
|
|
264
|
+
readonly unknownSubmissions: Type.TInteger;
|
|
265
|
+
}>, Type.TObject<{
|
|
266
|
+
readonly state: Type.TLiteral<"known">;
|
|
267
|
+
readonly byCurrency: Type.TArray<Type.TObject<{
|
|
268
|
+
readonly currency: Type.TString;
|
|
269
|
+
readonly amount: Type.TNumber;
|
|
270
|
+
readonly submissions: Type.TInteger;
|
|
271
|
+
}>>;
|
|
272
|
+
}>, Type.TObject<{
|
|
273
|
+
readonly state: Type.TLiteral<"partial">;
|
|
274
|
+
readonly byCurrency: Type.TArray<Type.TObject<{
|
|
275
|
+
readonly currency: Type.TString;
|
|
276
|
+
readonly amount: Type.TNumber;
|
|
277
|
+
readonly submissions: Type.TInteger;
|
|
278
|
+
}>>;
|
|
279
|
+
readonly unknownSubmissions: Type.TInteger;
|
|
280
|
+
}>]>;
|
|
281
|
+
}>;
|
|
282
|
+
readonly attempts: Type.TArray<Type.TObject<{
|
|
283
|
+
readonly agentId: Type.TString;
|
|
284
|
+
readonly attemptId: Type.TString;
|
|
285
|
+
/** Absent while the attempt has no recorded terminal outcome. */
|
|
286
|
+
readonly outcome: Type.TOptional<Type.TEnum<["succeeded", "failed", "cancelled", "unknown"]>>;
|
|
287
|
+
readonly totals: Type.TObject<{
|
|
288
|
+
/** Counted submission-owned records only: superseded records and inclusive Flow aggregates are excluded. */
|
|
289
|
+
readonly submissions: Type.TInteger;
|
|
290
|
+
readonly input: Type.TUnion<[Type.TObject<{
|
|
291
|
+
readonly state: Type.TLiteral<"unknown">;
|
|
292
|
+
readonly unknownSubmissions: Type.TInteger;
|
|
293
|
+
}>, Type.TObject<{
|
|
294
|
+
readonly state: Type.TLiteral<"known">;
|
|
295
|
+
readonly value: Type.TInteger;
|
|
296
|
+
readonly knownSubmissions: Type.TInteger;
|
|
297
|
+
}>, Type.TObject<{
|
|
298
|
+
readonly state: Type.TLiteral<"partial">;
|
|
299
|
+
readonly value: Type.TInteger;
|
|
300
|
+
readonly knownSubmissions: Type.TInteger;
|
|
301
|
+
readonly unknownSubmissions: Type.TInteger;
|
|
302
|
+
}>]>;
|
|
303
|
+
readonly output: Type.TUnion<[Type.TObject<{
|
|
304
|
+
readonly state: Type.TLiteral<"unknown">;
|
|
305
|
+
readonly unknownSubmissions: Type.TInteger;
|
|
306
|
+
}>, Type.TObject<{
|
|
307
|
+
readonly state: Type.TLiteral<"known">;
|
|
308
|
+
readonly value: Type.TInteger;
|
|
309
|
+
readonly knownSubmissions: Type.TInteger;
|
|
310
|
+
}>, Type.TObject<{
|
|
311
|
+
readonly state: Type.TLiteral<"partial">;
|
|
312
|
+
readonly value: Type.TInteger;
|
|
313
|
+
readonly knownSubmissions: Type.TInteger;
|
|
314
|
+
readonly unknownSubmissions: Type.TInteger;
|
|
315
|
+
}>]>;
|
|
316
|
+
readonly cacheRead: Type.TUnion<[Type.TObject<{
|
|
317
|
+
readonly state: Type.TLiteral<"unknown">;
|
|
318
|
+
readonly unknownSubmissions: Type.TInteger;
|
|
319
|
+
}>, Type.TObject<{
|
|
320
|
+
readonly state: Type.TLiteral<"known">;
|
|
321
|
+
readonly value: Type.TInteger;
|
|
322
|
+
readonly knownSubmissions: Type.TInteger;
|
|
323
|
+
}>, Type.TObject<{
|
|
324
|
+
readonly state: Type.TLiteral<"partial">;
|
|
325
|
+
readonly value: Type.TInteger;
|
|
326
|
+
readonly knownSubmissions: Type.TInteger;
|
|
327
|
+
readonly unknownSubmissions: Type.TInteger;
|
|
328
|
+
}>]>;
|
|
329
|
+
readonly cacheWrite: Type.TUnion<[Type.TObject<{
|
|
330
|
+
readonly state: Type.TLiteral<"unknown">;
|
|
331
|
+
readonly unknownSubmissions: Type.TInteger;
|
|
332
|
+
}>, Type.TObject<{
|
|
333
|
+
readonly state: Type.TLiteral<"known">;
|
|
334
|
+
readonly value: Type.TInteger;
|
|
335
|
+
readonly knownSubmissions: Type.TInteger;
|
|
336
|
+
}>, Type.TObject<{
|
|
337
|
+
readonly state: Type.TLiteral<"partial">;
|
|
338
|
+
readonly value: Type.TInteger;
|
|
339
|
+
readonly knownSubmissions: Type.TInteger;
|
|
340
|
+
readonly unknownSubmissions: Type.TInteger;
|
|
341
|
+
}>]>;
|
|
342
|
+
readonly reasoning: Type.TUnion<[Type.TObject<{
|
|
343
|
+
readonly state: Type.TLiteral<"unknown">;
|
|
344
|
+
readonly unknownSubmissions: Type.TInteger;
|
|
345
|
+
}>, Type.TObject<{
|
|
346
|
+
readonly state: Type.TLiteral<"known">;
|
|
347
|
+
readonly value: Type.TInteger;
|
|
348
|
+
readonly knownSubmissions: Type.TInteger;
|
|
349
|
+
}>, Type.TObject<{
|
|
350
|
+
readonly state: Type.TLiteral<"partial">;
|
|
351
|
+
readonly value: Type.TInteger;
|
|
352
|
+
readonly knownSubmissions: Type.TInteger;
|
|
353
|
+
readonly unknownSubmissions: Type.TInteger;
|
|
354
|
+
}>]>;
|
|
355
|
+
readonly totalTokens: Type.TUnion<[Type.TObject<{
|
|
356
|
+
readonly state: Type.TLiteral<"unknown">;
|
|
357
|
+
readonly unknownSubmissions: Type.TInteger;
|
|
358
|
+
}>, Type.TObject<{
|
|
359
|
+
readonly state: Type.TLiteral<"known">;
|
|
360
|
+
readonly value: Type.TInteger;
|
|
361
|
+
readonly knownSubmissions: Type.TInteger;
|
|
362
|
+
}>, Type.TObject<{
|
|
363
|
+
readonly state: Type.TLiteral<"partial">;
|
|
364
|
+
readonly value: Type.TInteger;
|
|
365
|
+
readonly knownSubmissions: Type.TInteger;
|
|
366
|
+
readonly unknownSubmissions: Type.TInteger;
|
|
367
|
+
}>]>;
|
|
368
|
+
readonly durationMs: Type.TUnion<[Type.TObject<{
|
|
369
|
+
readonly state: Type.TLiteral<"unknown">;
|
|
370
|
+
readonly unknownSubmissions: Type.TInteger;
|
|
371
|
+
}>, Type.TObject<{
|
|
372
|
+
readonly state: Type.TLiteral<"known">;
|
|
373
|
+
readonly value: Type.TInteger;
|
|
374
|
+
readonly knownSubmissions: Type.TInteger;
|
|
375
|
+
}>, Type.TObject<{
|
|
376
|
+
readonly state: Type.TLiteral<"partial">;
|
|
377
|
+
readonly value: Type.TInteger;
|
|
378
|
+
readonly knownSubmissions: Type.TInteger;
|
|
379
|
+
readonly unknownSubmissions: Type.TInteger;
|
|
380
|
+
}>]>;
|
|
381
|
+
readonly cost: Type.TUnion<[Type.TObject<{
|
|
382
|
+
readonly state: Type.TLiteral<"unknown">;
|
|
383
|
+
readonly unknownSubmissions: Type.TInteger;
|
|
384
|
+
}>, Type.TObject<{
|
|
385
|
+
readonly state: Type.TLiteral<"known">;
|
|
386
|
+
readonly byCurrency: Type.TArray<Type.TObject<{
|
|
387
|
+
readonly currency: Type.TString;
|
|
388
|
+
readonly amount: Type.TNumber;
|
|
389
|
+
readonly submissions: Type.TInteger;
|
|
390
|
+
}>>;
|
|
391
|
+
}>, Type.TObject<{
|
|
392
|
+
readonly state: Type.TLiteral<"partial">;
|
|
393
|
+
readonly byCurrency: Type.TArray<Type.TObject<{
|
|
394
|
+
readonly currency: Type.TString;
|
|
395
|
+
readonly amount: Type.TNumber;
|
|
396
|
+
readonly submissions: Type.TInteger;
|
|
397
|
+
}>>;
|
|
398
|
+
readonly unknownSubmissions: Type.TInteger;
|
|
399
|
+
}>]>;
|
|
400
|
+
}>;
|
|
401
|
+
}>>;
|
|
402
|
+
/** Appended correction records that replaced an earlier record; they are retained and contribute zero. */
|
|
403
|
+
readonly supersededRecords: Type.TInteger;
|
|
404
|
+
/** Inclusive Flow aggregate records: listed by search, contribute zero to totals. */
|
|
405
|
+
readonly inclusiveAggregateRecords: Type.TInteger;
|
|
406
|
+
readonly coverage: Type.TObject<{
|
|
407
|
+
readonly state: Type.TEnum<["captured", "redacted", "truncated", "unavailable", "not-applicable", "inferred"]>;
|
|
408
|
+
readonly reason: Type.TOptional<Type.TEnum<["secret_redacted", "policy_redacted", "size_limit", "producer_lost", "worker_exited_before_flush", "legacy_producer", "not_captured_by_version", "provider_hidden", "not_applicable", "derived_from_summary"]>>;
|
|
409
|
+
}>;
|
|
410
|
+
}>;
|
|
411
|
+
export type DhUsageResponse = Static<ReturnType<typeof usageResponseSchema>>;
|
|
412
|
+
export declare const parseDhUsageResponse: (value: unknown) => {
|
|
413
|
+
readonly schema: "dh.usage-response/1";
|
|
414
|
+
readonly generationId: string;
|
|
415
|
+
readonly captureCutoff: string;
|
|
416
|
+
readonly totals: {
|
|
417
|
+
readonly submissions: number;
|
|
418
|
+
readonly input: {
|
|
419
|
+
readonly state: "unknown";
|
|
420
|
+
readonly unknownSubmissions: number;
|
|
421
|
+
} | {
|
|
422
|
+
readonly state: "known";
|
|
423
|
+
readonly value: number;
|
|
424
|
+
readonly knownSubmissions: number;
|
|
425
|
+
} | {
|
|
426
|
+
readonly state: "partial";
|
|
427
|
+
readonly value: number;
|
|
428
|
+
readonly knownSubmissions: number;
|
|
429
|
+
readonly unknownSubmissions: number;
|
|
430
|
+
};
|
|
431
|
+
readonly output: {
|
|
432
|
+
readonly state: "unknown";
|
|
433
|
+
readonly unknownSubmissions: number;
|
|
434
|
+
} | {
|
|
435
|
+
readonly state: "known";
|
|
436
|
+
readonly value: number;
|
|
437
|
+
readonly knownSubmissions: number;
|
|
438
|
+
} | {
|
|
439
|
+
readonly state: "partial";
|
|
440
|
+
readonly value: number;
|
|
441
|
+
readonly knownSubmissions: number;
|
|
442
|
+
readonly unknownSubmissions: number;
|
|
443
|
+
};
|
|
444
|
+
readonly cacheRead: {
|
|
445
|
+
readonly state: "unknown";
|
|
446
|
+
readonly unknownSubmissions: number;
|
|
447
|
+
} | {
|
|
448
|
+
readonly state: "known";
|
|
449
|
+
readonly value: number;
|
|
450
|
+
readonly knownSubmissions: number;
|
|
451
|
+
} | {
|
|
452
|
+
readonly state: "partial";
|
|
453
|
+
readonly value: number;
|
|
454
|
+
readonly knownSubmissions: number;
|
|
455
|
+
readonly unknownSubmissions: number;
|
|
456
|
+
};
|
|
457
|
+
readonly cacheWrite: {
|
|
458
|
+
readonly state: "unknown";
|
|
459
|
+
readonly unknownSubmissions: number;
|
|
460
|
+
} | {
|
|
461
|
+
readonly state: "known";
|
|
462
|
+
readonly value: number;
|
|
463
|
+
readonly knownSubmissions: number;
|
|
464
|
+
} | {
|
|
465
|
+
readonly state: "partial";
|
|
466
|
+
readonly value: number;
|
|
467
|
+
readonly knownSubmissions: number;
|
|
468
|
+
readonly unknownSubmissions: number;
|
|
469
|
+
};
|
|
470
|
+
readonly reasoning: {
|
|
471
|
+
readonly state: "unknown";
|
|
472
|
+
readonly unknownSubmissions: number;
|
|
473
|
+
} | {
|
|
474
|
+
readonly state: "known";
|
|
475
|
+
readonly value: number;
|
|
476
|
+
readonly knownSubmissions: number;
|
|
477
|
+
} | {
|
|
478
|
+
readonly state: "partial";
|
|
479
|
+
readonly value: number;
|
|
480
|
+
readonly knownSubmissions: number;
|
|
481
|
+
readonly unknownSubmissions: number;
|
|
482
|
+
};
|
|
483
|
+
readonly totalTokens: {
|
|
484
|
+
readonly state: "unknown";
|
|
485
|
+
readonly unknownSubmissions: number;
|
|
486
|
+
} | {
|
|
487
|
+
readonly state: "known";
|
|
488
|
+
readonly value: number;
|
|
489
|
+
readonly knownSubmissions: number;
|
|
490
|
+
} | {
|
|
491
|
+
readonly state: "partial";
|
|
492
|
+
readonly value: number;
|
|
493
|
+
readonly knownSubmissions: number;
|
|
494
|
+
readonly unknownSubmissions: number;
|
|
495
|
+
};
|
|
496
|
+
readonly durationMs: {
|
|
497
|
+
readonly state: "unknown";
|
|
498
|
+
readonly unknownSubmissions: number;
|
|
499
|
+
} | {
|
|
500
|
+
readonly state: "known";
|
|
501
|
+
readonly value: number;
|
|
502
|
+
readonly knownSubmissions: number;
|
|
503
|
+
} | {
|
|
504
|
+
readonly state: "partial";
|
|
505
|
+
readonly value: number;
|
|
506
|
+
readonly knownSubmissions: number;
|
|
507
|
+
readonly unknownSubmissions: number;
|
|
508
|
+
};
|
|
509
|
+
readonly cost: {
|
|
510
|
+
readonly state: "unknown";
|
|
511
|
+
readonly unknownSubmissions: number;
|
|
512
|
+
} | {
|
|
513
|
+
readonly state: "known";
|
|
514
|
+
readonly byCurrency: {
|
|
515
|
+
readonly currency: string;
|
|
516
|
+
readonly amount: number;
|
|
517
|
+
readonly submissions: number;
|
|
518
|
+
}[];
|
|
519
|
+
} | {
|
|
520
|
+
readonly state: "partial";
|
|
521
|
+
readonly byCurrency: {
|
|
522
|
+
readonly currency: string;
|
|
523
|
+
readonly amount: number;
|
|
524
|
+
readonly submissions: number;
|
|
525
|
+
}[];
|
|
526
|
+
readonly unknownSubmissions: number;
|
|
527
|
+
};
|
|
528
|
+
};
|
|
529
|
+
readonly attempts: {
|
|
530
|
+
readonly agentId: string;
|
|
531
|
+
readonly attemptId: string;
|
|
532
|
+
readonly outcome?: "cancelled" | "failed" | "succeeded" | "unknown" | undefined;
|
|
533
|
+
readonly totals: {
|
|
534
|
+
readonly submissions: number;
|
|
535
|
+
readonly input: {
|
|
536
|
+
readonly state: "unknown";
|
|
537
|
+
readonly unknownSubmissions: number;
|
|
538
|
+
} | {
|
|
539
|
+
readonly state: "known";
|
|
540
|
+
readonly value: number;
|
|
541
|
+
readonly knownSubmissions: number;
|
|
542
|
+
} | {
|
|
543
|
+
readonly state: "partial";
|
|
544
|
+
readonly value: number;
|
|
545
|
+
readonly knownSubmissions: number;
|
|
546
|
+
readonly unknownSubmissions: number;
|
|
547
|
+
};
|
|
548
|
+
readonly output: {
|
|
549
|
+
readonly state: "unknown";
|
|
550
|
+
readonly unknownSubmissions: number;
|
|
551
|
+
} | {
|
|
552
|
+
readonly state: "known";
|
|
553
|
+
readonly value: number;
|
|
554
|
+
readonly knownSubmissions: number;
|
|
555
|
+
} | {
|
|
556
|
+
readonly state: "partial";
|
|
557
|
+
readonly value: number;
|
|
558
|
+
readonly knownSubmissions: number;
|
|
559
|
+
readonly unknownSubmissions: number;
|
|
560
|
+
};
|
|
561
|
+
readonly cacheRead: {
|
|
562
|
+
readonly state: "unknown";
|
|
563
|
+
readonly unknownSubmissions: number;
|
|
564
|
+
} | {
|
|
565
|
+
readonly state: "known";
|
|
566
|
+
readonly value: number;
|
|
567
|
+
readonly knownSubmissions: number;
|
|
568
|
+
} | {
|
|
569
|
+
readonly state: "partial";
|
|
570
|
+
readonly value: number;
|
|
571
|
+
readonly knownSubmissions: number;
|
|
572
|
+
readonly unknownSubmissions: number;
|
|
573
|
+
};
|
|
574
|
+
readonly cacheWrite: {
|
|
575
|
+
readonly state: "unknown";
|
|
576
|
+
readonly unknownSubmissions: number;
|
|
577
|
+
} | {
|
|
578
|
+
readonly state: "known";
|
|
579
|
+
readonly value: number;
|
|
580
|
+
readonly knownSubmissions: number;
|
|
581
|
+
} | {
|
|
582
|
+
readonly state: "partial";
|
|
583
|
+
readonly value: number;
|
|
584
|
+
readonly knownSubmissions: number;
|
|
585
|
+
readonly unknownSubmissions: number;
|
|
586
|
+
};
|
|
587
|
+
readonly reasoning: {
|
|
588
|
+
readonly state: "unknown";
|
|
589
|
+
readonly unknownSubmissions: number;
|
|
590
|
+
} | {
|
|
591
|
+
readonly state: "known";
|
|
592
|
+
readonly value: number;
|
|
593
|
+
readonly knownSubmissions: number;
|
|
594
|
+
} | {
|
|
595
|
+
readonly state: "partial";
|
|
596
|
+
readonly value: number;
|
|
597
|
+
readonly knownSubmissions: number;
|
|
598
|
+
readonly unknownSubmissions: number;
|
|
599
|
+
};
|
|
600
|
+
readonly totalTokens: {
|
|
601
|
+
readonly state: "unknown";
|
|
602
|
+
readonly unknownSubmissions: number;
|
|
603
|
+
} | {
|
|
604
|
+
readonly state: "known";
|
|
605
|
+
readonly value: number;
|
|
606
|
+
readonly knownSubmissions: number;
|
|
607
|
+
} | {
|
|
608
|
+
readonly state: "partial";
|
|
609
|
+
readonly value: number;
|
|
610
|
+
readonly knownSubmissions: number;
|
|
611
|
+
readonly unknownSubmissions: number;
|
|
612
|
+
};
|
|
613
|
+
readonly durationMs: {
|
|
614
|
+
readonly state: "unknown";
|
|
615
|
+
readonly unknownSubmissions: number;
|
|
616
|
+
} | {
|
|
617
|
+
readonly state: "known";
|
|
618
|
+
readonly value: number;
|
|
619
|
+
readonly knownSubmissions: number;
|
|
620
|
+
} | {
|
|
621
|
+
readonly state: "partial";
|
|
622
|
+
readonly value: number;
|
|
623
|
+
readonly knownSubmissions: number;
|
|
624
|
+
readonly unknownSubmissions: number;
|
|
625
|
+
};
|
|
626
|
+
readonly cost: {
|
|
627
|
+
readonly state: "unknown";
|
|
628
|
+
readonly unknownSubmissions: number;
|
|
629
|
+
} | {
|
|
630
|
+
readonly state: "known";
|
|
631
|
+
readonly byCurrency: {
|
|
632
|
+
readonly currency: string;
|
|
633
|
+
readonly amount: number;
|
|
634
|
+
readonly submissions: number;
|
|
635
|
+
}[];
|
|
636
|
+
} | {
|
|
637
|
+
readonly state: "partial";
|
|
638
|
+
readonly byCurrency: {
|
|
639
|
+
readonly currency: string;
|
|
640
|
+
readonly amount: number;
|
|
641
|
+
readonly submissions: number;
|
|
642
|
+
}[];
|
|
643
|
+
readonly unknownSubmissions: number;
|
|
644
|
+
};
|
|
645
|
+
};
|
|
646
|
+
}[];
|
|
647
|
+
readonly supersededRecords: number;
|
|
648
|
+
readonly inclusiveAggregateRecords: number;
|
|
649
|
+
readonly coverage: {
|
|
650
|
+
readonly state: "captured" | "inferred" | "not-applicable" | "redacted" | "truncated" | "unavailable";
|
|
651
|
+
readonly reason?: "derived_from_summary" | "legacy_producer" | "not_applicable" | "not_captured_by_version" | "policy_redacted" | "producer_lost" | "provider_hidden" | "secret_redacted" | "size_limit" | "worker_exited_before_flush" | undefined;
|
|
652
|
+
};
|
|
653
|
+
};
|
|
654
|
+
declare function usageRecordSchema(): Type.TObject<{
|
|
655
|
+
readonly usageId: Type.TString;
|
|
656
|
+
readonly eventId: Type.TString;
|
|
657
|
+
readonly generationId: Type.TString;
|
|
658
|
+
readonly agentId: Type.TString;
|
|
659
|
+
/** Required for submission-owned records so failed and retried attempts stay separable. */
|
|
660
|
+
readonly attemptId: Type.TOptional<Type.TString>;
|
|
661
|
+
readonly origin: Type.TUnion<[Type.TObject<{
|
|
662
|
+
readonly owner: Type.TLiteral<"submission">;
|
|
663
|
+
readonly submissionId: Type.TString;
|
|
664
|
+
}>, Type.TObject<{
|
|
665
|
+
readonly owner: Type.TLiteral<"flow-aggregate">;
|
|
666
|
+
readonly inclusive: Type.TLiteral<true>;
|
|
667
|
+
}>]>;
|
|
668
|
+
readonly measurement: Type.TUnion<[Type.TObject<{
|
|
669
|
+
readonly state: Type.TLiteral<"unknown">;
|
|
670
|
+
}>, Type.TObject<{
|
|
671
|
+
readonly state: Type.TLiteral<"reported">;
|
|
672
|
+
readonly input: Type.TOptional<Type.TInteger>;
|
|
673
|
+
readonly output: Type.TOptional<Type.TInteger>;
|
|
674
|
+
readonly cacheRead: Type.TOptional<Type.TInteger>;
|
|
675
|
+
readonly cacheWrite: Type.TOptional<Type.TInteger>;
|
|
676
|
+
readonly reasoning: Type.TOptional<Type.TInteger>;
|
|
677
|
+
readonly totalTokens: Type.TOptional<Type.TInteger>;
|
|
678
|
+
readonly durationMs: Type.TOptional<Type.TInteger>;
|
|
679
|
+
readonly cost: Type.TUnion<[Type.TObject<{
|
|
680
|
+
readonly state: Type.TLiteral<"unknown">;
|
|
681
|
+
}>, Type.TObject<{
|
|
682
|
+
readonly state: Type.TLiteral<"known">;
|
|
683
|
+
readonly amount: Type.TNumber;
|
|
684
|
+
readonly currency: Type.TString;
|
|
685
|
+
readonly priceProvenance: Type.TString;
|
|
686
|
+
}>]>;
|
|
687
|
+
}>]>;
|
|
688
|
+
/** True only for a submission-owned record that no correction supersedes. */
|
|
689
|
+
readonly counted: Type.TBoolean;
|
|
690
|
+
readonly supersedesUsageId: Type.TOptional<Type.TString>;
|
|
691
|
+
/** Query-time pointer to the correction that replaced this record; the stored record is never mutated. */
|
|
692
|
+
readonly supersededByUsageId: Type.TOptional<Type.TString>;
|
|
693
|
+
}>;
|
|
694
|
+
export type DhUsageRecord = Static<ReturnType<typeof usageRecordSchema>>;
|
|
695
|
+
export declare const parseDhUsageRecord: (value: unknown) => {
|
|
696
|
+
readonly usageId: string;
|
|
697
|
+
readonly eventId: string;
|
|
698
|
+
readonly generationId: string;
|
|
699
|
+
readonly agentId: string;
|
|
700
|
+
readonly attemptId?: string | undefined;
|
|
701
|
+
readonly origin: {
|
|
702
|
+
readonly owner: "submission";
|
|
703
|
+
readonly submissionId: string;
|
|
704
|
+
} | {
|
|
705
|
+
readonly owner: "flow-aggregate";
|
|
706
|
+
readonly inclusive: true;
|
|
707
|
+
};
|
|
708
|
+
readonly measurement: {
|
|
709
|
+
readonly state: "unknown";
|
|
710
|
+
} | {
|
|
711
|
+
readonly state: "reported";
|
|
712
|
+
readonly input?: number | undefined;
|
|
713
|
+
readonly output?: number | undefined;
|
|
714
|
+
readonly cacheRead?: number | undefined;
|
|
715
|
+
readonly cacheWrite?: number | undefined;
|
|
716
|
+
readonly reasoning?: number | undefined;
|
|
717
|
+
readonly totalTokens?: number | undefined;
|
|
718
|
+
readonly durationMs?: number | undefined;
|
|
719
|
+
readonly cost: {
|
|
720
|
+
readonly state: "unknown";
|
|
721
|
+
} | {
|
|
722
|
+
readonly state: "known";
|
|
723
|
+
readonly amount: number;
|
|
724
|
+
readonly currency: string;
|
|
725
|
+
readonly priceProvenance: string;
|
|
726
|
+
};
|
|
727
|
+
};
|
|
728
|
+
readonly counted: boolean;
|
|
729
|
+
readonly supersedesUsageId?: string | undefined;
|
|
730
|
+
readonly supersededByUsageId?: string | undefined;
|
|
731
|
+
};
|
|
732
|
+
declare function usageSearchPageSchema(): Type.TObject<{
|
|
733
|
+
readonly schema: Type.TLiteral<"dh.usage-search-page/1">;
|
|
734
|
+
readonly generationId: Type.TString;
|
|
735
|
+
readonly captureCutoff: Type.TString;
|
|
736
|
+
readonly filterSha256: Type.TString;
|
|
737
|
+
readonly nextCursor: Type.TUnion<[Type.TNull, Type.TString]>;
|
|
738
|
+
readonly items: Type.TArray<Type.TObject<{
|
|
739
|
+
readonly usageId: Type.TString;
|
|
740
|
+
readonly eventId: Type.TString;
|
|
741
|
+
readonly generationId: Type.TString;
|
|
742
|
+
readonly agentId: Type.TString;
|
|
743
|
+
/** Required for submission-owned records so failed and retried attempts stay separable. */
|
|
744
|
+
readonly attemptId: Type.TOptional<Type.TString>;
|
|
745
|
+
readonly origin: Type.TUnion<[Type.TObject<{
|
|
746
|
+
readonly owner: Type.TLiteral<"submission">;
|
|
747
|
+
readonly submissionId: Type.TString;
|
|
748
|
+
}>, Type.TObject<{
|
|
749
|
+
readonly owner: Type.TLiteral<"flow-aggregate">;
|
|
750
|
+
readonly inclusive: Type.TLiteral<true>;
|
|
751
|
+
}>]>;
|
|
752
|
+
readonly measurement: Type.TUnion<[Type.TObject<{
|
|
753
|
+
readonly state: Type.TLiteral<"unknown">;
|
|
754
|
+
}>, Type.TObject<{
|
|
755
|
+
readonly state: Type.TLiteral<"reported">;
|
|
756
|
+
readonly input: Type.TOptional<Type.TInteger>;
|
|
757
|
+
readonly output: Type.TOptional<Type.TInteger>;
|
|
758
|
+
readonly cacheRead: Type.TOptional<Type.TInteger>;
|
|
759
|
+
readonly cacheWrite: Type.TOptional<Type.TInteger>;
|
|
760
|
+
readonly reasoning: Type.TOptional<Type.TInteger>;
|
|
761
|
+
readonly totalTokens: Type.TOptional<Type.TInteger>;
|
|
762
|
+
readonly durationMs: Type.TOptional<Type.TInteger>;
|
|
763
|
+
readonly cost: Type.TUnion<[Type.TObject<{
|
|
764
|
+
readonly state: Type.TLiteral<"unknown">;
|
|
765
|
+
}>, Type.TObject<{
|
|
766
|
+
readonly state: Type.TLiteral<"known">;
|
|
767
|
+
readonly amount: Type.TNumber;
|
|
768
|
+
readonly currency: Type.TString;
|
|
769
|
+
readonly priceProvenance: Type.TString;
|
|
770
|
+
}>]>;
|
|
771
|
+
}>]>;
|
|
772
|
+
/** True only for a submission-owned record that no correction supersedes. */
|
|
773
|
+
readonly counted: Type.TBoolean;
|
|
774
|
+
readonly supersedesUsageId: Type.TOptional<Type.TString>;
|
|
775
|
+
/** Query-time pointer to the correction that replaced this record; the stored record is never mutated. */
|
|
776
|
+
readonly supersededByUsageId: Type.TOptional<Type.TString>;
|
|
777
|
+
}>>;
|
|
778
|
+
}>;
|
|
779
|
+
export type DhUsageSearchPage = Static<ReturnType<typeof usageSearchPageSchema>>;
|
|
780
|
+
export declare const parseDhUsageSearchPage: (value: unknown) => {
|
|
781
|
+
readonly schema: "dh.usage-search-page/1";
|
|
782
|
+
readonly generationId: string;
|
|
783
|
+
readonly captureCutoff: string;
|
|
784
|
+
readonly filterSha256: string;
|
|
785
|
+
readonly nextCursor: string | null;
|
|
786
|
+
readonly items: {
|
|
787
|
+
readonly usageId: string;
|
|
788
|
+
readonly eventId: string;
|
|
789
|
+
readonly generationId: string;
|
|
790
|
+
readonly agentId: string;
|
|
791
|
+
readonly attemptId?: string | undefined;
|
|
792
|
+
readonly origin: {
|
|
793
|
+
readonly owner: "submission";
|
|
794
|
+
readonly submissionId: string;
|
|
795
|
+
} | {
|
|
796
|
+
readonly owner: "flow-aggregate";
|
|
797
|
+
readonly inclusive: true;
|
|
798
|
+
};
|
|
799
|
+
readonly measurement: {
|
|
800
|
+
readonly state: "unknown";
|
|
801
|
+
} | {
|
|
802
|
+
readonly state: "reported";
|
|
803
|
+
readonly input?: number | undefined;
|
|
804
|
+
readonly output?: number | undefined;
|
|
805
|
+
readonly cacheRead?: number | undefined;
|
|
806
|
+
readonly cacheWrite?: number | undefined;
|
|
807
|
+
readonly reasoning?: number | undefined;
|
|
808
|
+
readonly totalTokens?: number | undefined;
|
|
809
|
+
readonly durationMs?: number | undefined;
|
|
810
|
+
readonly cost: {
|
|
811
|
+
readonly state: "unknown";
|
|
812
|
+
} | {
|
|
813
|
+
readonly state: "known";
|
|
814
|
+
readonly amount: number;
|
|
815
|
+
readonly currency: string;
|
|
816
|
+
readonly priceProvenance: string;
|
|
817
|
+
};
|
|
818
|
+
};
|
|
819
|
+
readonly counted: boolean;
|
|
820
|
+
readonly supersedesUsageId?: string | undefined;
|
|
821
|
+
readonly supersededByUsageId?: string | undefined;
|
|
822
|
+
}[];
|
|
823
|
+
};
|
|
824
|
+
declare function usageCorrectionSchema(): Type.TObject<{
|
|
825
|
+
readonly schema: Type.TLiteral<"dh.usage-correction/1">;
|
|
826
|
+
/** The new record's id. Append-only: it never reuses the superseded id. */
|
|
827
|
+
readonly usageId: Type.TString;
|
|
828
|
+
readonly supersedesUsageId: Type.TString;
|
|
829
|
+
readonly generationId: Type.TString;
|
|
830
|
+
readonly agentId: Type.TString;
|
|
831
|
+
readonly attemptId: Type.TString;
|
|
832
|
+
readonly submissionId: Type.TString;
|
|
833
|
+
readonly reason: Type.TEnum<["provider-reconciliation", "price-correction", "capture-error", "duplicate-owner"]>;
|
|
834
|
+
readonly recordedAt: Type.TString;
|
|
835
|
+
/** Replacement measurement. An explicit unknown retracts a value; zero is never implied. */
|
|
836
|
+
readonly measurement: Type.TUnion<[Type.TObject<{
|
|
837
|
+
readonly state: Type.TLiteral<"unknown">;
|
|
838
|
+
}>, Type.TObject<{
|
|
839
|
+
readonly state: Type.TLiteral<"reported">;
|
|
840
|
+
readonly input: Type.TOptional<Type.TInteger>;
|
|
841
|
+
readonly output: Type.TOptional<Type.TInteger>;
|
|
842
|
+
readonly cacheRead: Type.TOptional<Type.TInteger>;
|
|
843
|
+
readonly cacheWrite: Type.TOptional<Type.TInteger>;
|
|
844
|
+
readonly reasoning: Type.TOptional<Type.TInteger>;
|
|
845
|
+
readonly totalTokens: Type.TOptional<Type.TInteger>;
|
|
846
|
+
readonly durationMs: Type.TOptional<Type.TInteger>;
|
|
847
|
+
readonly cost: Type.TUnion<[Type.TObject<{
|
|
848
|
+
readonly state: Type.TLiteral<"unknown">;
|
|
849
|
+
}>, Type.TObject<{
|
|
850
|
+
readonly state: Type.TLiteral<"known">;
|
|
851
|
+
readonly amount: Type.TNumber;
|
|
852
|
+
readonly currency: Type.TString;
|
|
853
|
+
readonly priceProvenance: Type.TString;
|
|
854
|
+
}>]>;
|
|
855
|
+
}>]>;
|
|
856
|
+
}>;
|
|
857
|
+
export type DhUsageCorrection = Static<ReturnType<typeof usageCorrectionSchema>>;
|
|
858
|
+
export declare const parseDhUsageCorrection: (value: unknown) => {
|
|
859
|
+
readonly schema: "dh.usage-correction/1";
|
|
860
|
+
readonly usageId: string;
|
|
861
|
+
readonly supersedesUsageId: string;
|
|
862
|
+
readonly generationId: string;
|
|
863
|
+
readonly agentId: string;
|
|
864
|
+
readonly attemptId: string;
|
|
865
|
+
readonly submissionId: string;
|
|
866
|
+
readonly reason: "capture-error" | "duplicate-owner" | "price-correction" | "provider-reconciliation";
|
|
867
|
+
readonly recordedAt: string;
|
|
868
|
+
readonly measurement: {
|
|
869
|
+
readonly state: "unknown";
|
|
870
|
+
} | {
|
|
871
|
+
readonly state: "reported";
|
|
872
|
+
readonly input?: number | undefined;
|
|
873
|
+
readonly output?: number | undefined;
|
|
874
|
+
readonly cacheRead?: number | undefined;
|
|
875
|
+
readonly cacheWrite?: number | undefined;
|
|
876
|
+
readonly reasoning?: number | undefined;
|
|
877
|
+
readonly totalTokens?: number | undefined;
|
|
878
|
+
readonly durationMs?: number | undefined;
|
|
879
|
+
readonly cost: {
|
|
880
|
+
readonly state: "unknown";
|
|
881
|
+
} | {
|
|
882
|
+
readonly state: "known";
|
|
883
|
+
readonly amount: number;
|
|
884
|
+
readonly currency: string;
|
|
885
|
+
readonly priceProvenance: string;
|
|
886
|
+
};
|
|
887
|
+
};
|
|
888
|
+
};
|
|
889
|
+
/**
|
|
890
|
+
* Checks a correction against the stored record it supersedes and the records already stored.
|
|
891
|
+
* `existing` lists every stored usageId (originals and corrections; supersedesUsageId for corrections).
|
|
892
|
+
* Same submission, no fork (one correction per superseded record), no reuse of any stored id or of the
|
|
893
|
+
* superseded record's predecessor, only submission-owned targets.
|
|
894
|
+
*/
|
|
895
|
+
export declare function assertDhUsageCorrection(correctionInput: unknown, supersededInput: unknown, existing?: readonly {
|
|
896
|
+
usageId: string;
|
|
897
|
+
supersedesUsageId?: string;
|
|
898
|
+
}[]): void;
|
|
899
|
+
/** DELETE has no body, so this is the path-derived request context, not a wire body. */
|
|
900
|
+
export declare const parseDhGenerationDeleteRequest: (value: unknown) => {
|
|
901
|
+
readonly schema: "dh.generation-delete-request/1";
|
|
902
|
+
readonly generationId: string;
|
|
903
|
+
};
|
|
904
|
+
export type DhGenerationDeleteRequest = ReturnType<typeof parseDhGenerationDeleteRequest>;
|
|
905
|
+
/** Path-derived like the delete request; release is explicit and authorized, never implied by deletion. */
|
|
906
|
+
export declare const parseDhLegalHoldReleaseRequest: (value: unknown) => {
|
|
907
|
+
readonly schema: "dh.legal-hold-release-request/1";
|
|
908
|
+
readonly generationId: string;
|
|
909
|
+
readonly holdId: string;
|
|
910
|
+
};
|
|
911
|
+
export type DhLegalHoldReleaseRequest = ReturnType<typeof parseDhLegalHoldReleaseRequest>;
|
|
912
|
+
/** Reason is an enum and matterRef an opaque reference: no free text, so a hold cannot carry content. */
|
|
913
|
+
export declare const parseDhLegalHoldRequest: (value: unknown) => {
|
|
914
|
+
readonly schema: "dh.legal-hold-request/1";
|
|
915
|
+
readonly requestId: string;
|
|
916
|
+
readonly generationId: string;
|
|
917
|
+
readonly reasonCode: "audit" | "internal-investigation" | "litigation" | "regulatory-inquiry";
|
|
918
|
+
readonly matterRef?: string | undefined;
|
|
919
|
+
};
|
|
920
|
+
export type DhLegalHoldRequest = ReturnType<typeof parseDhLegalHoldRequest>;
|
|
921
|
+
declare function legalHoldSchema(): Type.TObject<{
|
|
922
|
+
readonly schema: Type.TLiteral<"dh.legal-hold/1">;
|
|
923
|
+
readonly holdId: Type.TString;
|
|
924
|
+
readonly requestId: Type.TString;
|
|
925
|
+
readonly generationId: Type.TString;
|
|
926
|
+
readonly state: Type.TEnum<["active", "released"]>;
|
|
927
|
+
readonly reasonCode: Type.TEnum<["litigation", "regulatory-inquiry", "internal-investigation", "audit"]>;
|
|
928
|
+
readonly matterRef: Type.TOptional<Type.TString>;
|
|
929
|
+
readonly placedAt: Type.TString;
|
|
930
|
+
readonly releasedAt: Type.TOptional<Type.TString>;
|
|
931
|
+
}>;
|
|
932
|
+
export type DhLegalHold = Static<ReturnType<typeof legalHoldSchema>>;
|
|
933
|
+
export declare const parseDhLegalHold: (value: unknown) => {
|
|
934
|
+
readonly schema: "dh.legal-hold/1";
|
|
935
|
+
readonly holdId: string;
|
|
936
|
+
readonly requestId: string;
|
|
937
|
+
readonly generationId: string;
|
|
938
|
+
readonly state: "active" | "released";
|
|
939
|
+
readonly reasonCode: "audit" | "internal-investigation" | "litigation" | "regulatory-inquiry";
|
|
940
|
+
readonly matterRef?: string | undefined;
|
|
941
|
+
readonly placedAt: string;
|
|
942
|
+
readonly releasedAt?: string | undefined;
|
|
943
|
+
};
|
|
944
|
+
declare function generationDeletionSchema(): Type.TObject<{
|
|
945
|
+
readonly schema: Type.TLiteral<"dh.generation-deletion/1">;
|
|
946
|
+
readonly generationId: Type.TString;
|
|
947
|
+
readonly state: Type.TEnum<["blocked-by-hold", "accepted", "claimed", "tombstoned"]>;
|
|
948
|
+
/** Evidence from the same locked snapshot as the state: held iff blocked-by-hold. */
|
|
949
|
+
readonly holdCheck: Type.TUnion<[Type.TObject<{
|
|
950
|
+
readonly state: Type.TLiteral<"clear">;
|
|
951
|
+
}>, Type.TObject<{
|
|
952
|
+
readonly state: Type.TLiteral<"held">;
|
|
953
|
+
readonly holdIds: Type.TArray<Type.TString>;
|
|
954
|
+
}>]>;
|
|
955
|
+
/** Durable deletion claim time; present exactly when claimed or tombstoned. */
|
|
956
|
+
readonly claimedAt: Type.TOptional<Type.TString>;
|
|
957
|
+
}>;
|
|
958
|
+
export type DhGenerationDeletion = Static<ReturnType<typeof generationDeletionSchema>>;
|
|
959
|
+
export declare const parseDhGenerationDeletion: (value: unknown) => {
|
|
960
|
+
readonly schema: "dh.generation-deletion/1";
|
|
961
|
+
readonly generationId: string;
|
|
962
|
+
readonly state: "accepted" | "blocked-by-hold" | "claimed" | "tombstoned";
|
|
963
|
+
readonly holdCheck: {
|
|
964
|
+
readonly state: "clear";
|
|
965
|
+
} | {
|
|
966
|
+
readonly state: "held";
|
|
967
|
+
readonly holdIds: string[];
|
|
968
|
+
};
|
|
969
|
+
readonly claimedAt?: string | undefined;
|
|
970
|
+
};
|
|
971
|
+
/** A generation with a durable deletion claim cannot accept a new hold. */
|
|
972
|
+
export declare function assertDhHoldPlacementAllowed(deletionInput: unknown): void;
|
|
973
|
+
/**
|
|
974
|
+
* Hold wins. Given one snapshot's deletion status and holds: an active hold forbids any state but
|
|
975
|
+
* blocked-by-hold and must be named in holdCheck. A hold placed at or before the claim that was released
|
|
976
|
+
* only after the claim (or never) blocks the deletion; a hold placed after the claim is also rejected.
|
|
977
|
+
*/
|
|
978
|
+
export declare function assertDhHoldPrecedence(deletionInput: unknown, holdInputs: readonly unknown[]): void;
|
|
979
|
+
/** The body must match the route's path generation (and hold). Route params are validated by buildDhRoutePath. */
|
|
980
|
+
export declare function assertDhRecordsRequestForPath(requestInput: unknown, params: Readonly<{
|
|
981
|
+
generationId: string;
|
|
982
|
+
holdId?: string;
|
|
983
|
+
}>): void;
|
|
984
|
+
export {};
|
|
985
|
+
//# sourceMappingURL=trace-records.d.ts.map
|