@peasant-labs/schema 0.1.0-rc6
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/LICENSE +13 -0
- package/README.md +56 -0
- package/dist/fixtures/quality.d.ts +81 -0
- package/dist/fixtures/quality.js +36 -0
- package/dist/fixtures/timeline.d.ts +22 -0
- package/dist/fixtures/timeline.js +2 -0
- package/dist/fixtures.d.ts +2 -0
- package/dist/fixtures.js +2 -0
- package/dist/index.d.ts +8 -0
- package/dist/index.js +36 -0
- package/dist/internal/generated/contract/zod.gen.d.ts +2740 -0
- package/dist/internal/generated/contract/zod.gen.js +1196 -0
- package/dist/internal/generated/enums.gen.d.ts +318 -0
- package/dist/internal/generated/enums.gen.js +348 -0
- package/dist/internal/generated/local-api.d.ts +946 -0
- package/dist/internal/generated/local-api.js +1 -0
- package/dist/internal/generated/public-contract.gen.d.ts +2 -0
- package/dist/internal/generated/public-contract.gen.js +2 -0
- package/dist/internal/generated/quality-fixtures.gen.d.ts +2 -0
- package/dist/internal/generated/quality-fixtures.gen.js +367 -0
- package/dist/internal/generated/testcase.gen.d.ts +17 -0
- package/dist/internal/generated/testcase.gen.js +20 -0
- package/dist/internal/generated/timeline-fixtures.gen.d.ts +2 -0
- package/dist/internal/generated/timeline-fixtures.gen.js +542 -0
- package/dist/internal/generated/versions.gen.d.ts +4 -0
- package/dist/internal/generated/versions.gen.js +5 -0
- package/dist/internal/generated/village-api.d.ts +585 -0
- package/dist/internal/generated/village-api.js +1 -0
- package/dist/local-api.d.ts +4 -0
- package/dist/local-api.js +1 -0
- package/dist/testcase.d.ts +32 -0
- package/dist/testcase.js +144 -0
- package/dist/types.d.ts +2 -0
- package/dist/types.js +2 -0
- package/dist/village-api.d.ts +4 -0
- package/dist/village-api.js +1 -0
- package/package.json +71 -0
|
@@ -0,0 +1,1196 @@
|
|
|
1
|
+
// This file is auto-generated by @hey-api/openapi-ts
|
|
2
|
+
import * as z from 'zod';
|
|
3
|
+
export const zActivityEdge = z.object({
|
|
4
|
+
from: z.string(),
|
|
5
|
+
taskCount: z.int(),
|
|
6
|
+
to: z.string()
|
|
7
|
+
});
|
|
8
|
+
/**
|
|
9
|
+
* Annotation Axis
|
|
10
|
+
*
|
|
11
|
+
* Subscription dimension for annotation channels
|
|
12
|
+
*/
|
|
13
|
+
export const zAnnotationAxis = z.enum([
|
|
14
|
+
'type',
|
|
15
|
+
'session',
|
|
16
|
+
'project'
|
|
17
|
+
]);
|
|
18
|
+
/**
|
|
19
|
+
* Annotation Datatype
|
|
20
|
+
*
|
|
21
|
+
* Storage type for annotation values (maps to SQLite STRICT column type)
|
|
22
|
+
*/
|
|
23
|
+
export const zAnnotationDatatype = z.enum([
|
|
24
|
+
'text',
|
|
25
|
+
'integer',
|
|
26
|
+
'real',
|
|
27
|
+
'boolean'
|
|
28
|
+
]);
|
|
29
|
+
export const zAnnotationEntryTarget = z.object({
|
|
30
|
+
endIndex: z.int(),
|
|
31
|
+
entryIndex: z.int(),
|
|
32
|
+
sessionId: z.string()
|
|
33
|
+
});
|
|
34
|
+
export const zAnnotationManifestResponse = z.object({
|
|
35
|
+
digest: z.string(),
|
|
36
|
+
hashes: z.array(z.string())
|
|
37
|
+
});
|
|
38
|
+
/**
|
|
39
|
+
* Annotation Push Status
|
|
40
|
+
*
|
|
41
|
+
* Per-item annotation push outcome
|
|
42
|
+
*/
|
|
43
|
+
export const zAnnotationPushStatus = z.enum([
|
|
44
|
+
'created',
|
|
45
|
+
'updated',
|
|
46
|
+
'skipped',
|
|
47
|
+
'error'
|
|
48
|
+
]);
|
|
49
|
+
export const zAnnotationPushResult = z.object({
|
|
50
|
+
contentHash: z.string().optional(),
|
|
51
|
+
error: z.string().optional(),
|
|
52
|
+
status: zAnnotationPushStatus
|
|
53
|
+
});
|
|
54
|
+
export const zAnnotationPushResponse = z.object({
|
|
55
|
+
created: z.int(),
|
|
56
|
+
errors: z.int(),
|
|
57
|
+
results: z.array(zAnnotationPushResult).optional(),
|
|
58
|
+
skipped: z.int(),
|
|
59
|
+
updated: z.int()
|
|
60
|
+
});
|
|
61
|
+
/**
|
|
62
|
+
* Annotation Status
|
|
63
|
+
*
|
|
64
|
+
* ISO 11179 lifecycle state of an annotation type
|
|
65
|
+
*/
|
|
66
|
+
export const zAnnotationStatus = z.enum([
|
|
67
|
+
'proposed',
|
|
68
|
+
'active',
|
|
69
|
+
'deprecated',
|
|
70
|
+
'retired'
|
|
71
|
+
]);
|
|
72
|
+
/**
|
|
73
|
+
* Annotator Kind
|
|
74
|
+
*
|
|
75
|
+
* Type of entity that produced an annotation: human, agent (AI model), or rule (automated classifier)
|
|
76
|
+
*/
|
|
77
|
+
export const zAnnotatorKind = z.enum([
|
|
78
|
+
'human',
|
|
79
|
+
'agent',
|
|
80
|
+
'rule'
|
|
81
|
+
]);
|
|
82
|
+
export const zAnnotatorSummary = z.object({
|
|
83
|
+
description: z.string().optional(),
|
|
84
|
+
displayName: z.string(),
|
|
85
|
+
id: z.string(),
|
|
86
|
+
kind: zAnnotatorKind,
|
|
87
|
+
modelId: z.string().nullish(),
|
|
88
|
+
name: z.string(),
|
|
89
|
+
providerKey: z.string().nullish(),
|
|
90
|
+
status: z.string()
|
|
91
|
+
});
|
|
92
|
+
export const zBatchCreateAnnotationsErrorResponse = z.object({
|
|
93
|
+
error: z.string(),
|
|
94
|
+
failingIndex: z.int()
|
|
95
|
+
});
|
|
96
|
+
export const zBatchCreateAnnotationsResponse = z.object({
|
|
97
|
+
ids: z.array(z.string()).nullable()
|
|
98
|
+
});
|
|
99
|
+
/**
|
|
100
|
+
* Built-in Command
|
|
101
|
+
*
|
|
102
|
+
* Claude Code built-in slash command name without the leading slash
|
|
103
|
+
*/
|
|
104
|
+
export const zBuiltinCommand = z.enum([
|
|
105
|
+
'exit',
|
|
106
|
+
'compact',
|
|
107
|
+
'clear',
|
|
108
|
+
'new',
|
|
109
|
+
'model',
|
|
110
|
+
'usage',
|
|
111
|
+
'cost',
|
|
112
|
+
'context',
|
|
113
|
+
'plugin',
|
|
114
|
+
'permissions',
|
|
115
|
+
'login',
|
|
116
|
+
'resume',
|
|
117
|
+
'plan',
|
|
118
|
+
'fast',
|
|
119
|
+
'voice',
|
|
120
|
+
'todos',
|
|
121
|
+
'reload-plugins',
|
|
122
|
+
'sandbox',
|
|
123
|
+
'config',
|
|
124
|
+
'statusline',
|
|
125
|
+
'upgrade',
|
|
126
|
+
'extra-usage',
|
|
127
|
+
'rate-limit-options',
|
|
128
|
+
'privacy-settings',
|
|
129
|
+
'help',
|
|
130
|
+
'commands'
|
|
131
|
+
]);
|
|
132
|
+
export const zCLILoginQuery = z.object({
|
|
133
|
+
port: z.int(),
|
|
134
|
+
state: z.string()
|
|
135
|
+
});
|
|
136
|
+
/**
|
|
137
|
+
* Change Binding
|
|
138
|
+
*
|
|
139
|
+
* Strength of the evidence connecting a recorded session to a code change
|
|
140
|
+
*/
|
|
141
|
+
export const zChangeBinding = z.enum(['bound', 'candidate']);
|
|
142
|
+
export const zChangeSummary = z.object({
|
|
143
|
+
aheadCount: z.int(),
|
|
144
|
+
baseHash: z.string().optional(),
|
|
145
|
+
behindCount: z.int(),
|
|
146
|
+
branch: z.string(),
|
|
147
|
+
filesChanged: z.int(),
|
|
148
|
+
lastWorkMs: z.int().nullish(),
|
|
149
|
+
mergeCommitHash: z.string().optional(),
|
|
150
|
+
merged: z.boolean(),
|
|
151
|
+
mergedAtMs: z.int().nullish(),
|
|
152
|
+
newEdges: z.int(),
|
|
153
|
+
removedEdges: z.int(),
|
|
154
|
+
reverted: z.boolean().optional(),
|
|
155
|
+
sessionCount: z.int(),
|
|
156
|
+
taskCount: z.int(),
|
|
157
|
+
tipCommitMs: z.int().nullish(),
|
|
158
|
+
violations: z.int()
|
|
159
|
+
});
|
|
160
|
+
/**
|
|
161
|
+
* Channel Topic
|
|
162
|
+
*
|
|
163
|
+
* Subscribable WebSocket data stream
|
|
164
|
+
*/
|
|
165
|
+
export const zChannelTopic = z.enum([
|
|
166
|
+
'dashboard',
|
|
167
|
+
'sessions',
|
|
168
|
+
'session_detail',
|
|
169
|
+
'trends',
|
|
170
|
+
'quality',
|
|
171
|
+
'annotations',
|
|
172
|
+
'project_familiarity'
|
|
173
|
+
]);
|
|
174
|
+
export const zChannelSubscription = z.object({
|
|
175
|
+
axis: zAnnotationAxis.optional(),
|
|
176
|
+
id: z.string().optional(),
|
|
177
|
+
topic: zChannelTopic
|
|
178
|
+
});
|
|
179
|
+
export const zChildSessionRef = z.object({
|
|
180
|
+
id: z.string(),
|
|
181
|
+
project: z.string().optional(),
|
|
182
|
+
startTime: z.iso.datetime()
|
|
183
|
+
});
|
|
184
|
+
export const zCommitInfo = z.object({
|
|
185
|
+
authorEmail: z.string(),
|
|
186
|
+
authorName: z.string(),
|
|
187
|
+
authorTime: z.coerce.bigint().min(BigInt('-9223372036854775808'), { error: 'Invalid value: Expected int64 to be >= -9223372036854775808' }).max(BigInt('9223372036854775807'), { error: 'Invalid value: Expected int64 to be <= 9223372036854775807' }),
|
|
188
|
+
commitTime: z.coerce.bigint().min(BigInt('-9223372036854775808'), { error: 'Invalid value: Expected int64 to be >= -9223372036854775808' }).max(BigInt('9223372036854775807'), { error: 'Invalid value: Expected int64 to be <= 9223372036854775807' }),
|
|
189
|
+
hash: z.string(),
|
|
190
|
+
message: z.string()
|
|
191
|
+
});
|
|
192
|
+
/**
|
|
193
|
+
* Content Kind
|
|
194
|
+
*
|
|
195
|
+
* Payload kind carried by a transcript content envelope
|
|
196
|
+
*/
|
|
197
|
+
export const zContentKind = z.enum(['session_detail']);
|
|
198
|
+
export const zContractVersion = z.string().nullable();
|
|
199
|
+
export const zCreateAnnotationRequest = z.object({
|
|
200
|
+
annotatorName: z.string().optional(),
|
|
201
|
+
confidence: z.number().nullish(),
|
|
202
|
+
isPrimary: z.boolean(),
|
|
203
|
+
reason: z.string().nullish(),
|
|
204
|
+
sessionId: z.string(),
|
|
205
|
+
targetAnnotationId: z.string().nullish(),
|
|
206
|
+
targetEntryEndIndex: z.int().nullish(),
|
|
207
|
+
targetEntryIndex: z.int().nullish(),
|
|
208
|
+
typeId: z.string(),
|
|
209
|
+
value: z.string()
|
|
210
|
+
});
|
|
211
|
+
export const zBatchCreateAnnotationsRequest = z.object({
|
|
212
|
+
annotations: z.array(zCreateAnnotationRequest).nullable()
|
|
213
|
+
});
|
|
214
|
+
export const zCreateAnnotationResponse = z.object({
|
|
215
|
+
id: z.string()
|
|
216
|
+
});
|
|
217
|
+
export const zDashboardPayload = z.object({
|
|
218
|
+
acceptanceRate: z.number(),
|
|
219
|
+
avgDurationMins: z.number(),
|
|
220
|
+
avgTurnsPerSession: z.number(),
|
|
221
|
+
harnessBreakdown: z.record(z.string(), z.int()).nullable(),
|
|
222
|
+
totalSessions: z.int(),
|
|
223
|
+
totalTokens: z.int()
|
|
224
|
+
});
|
|
225
|
+
export const zDayStats = z.object({
|
|
226
|
+
date: z.string(),
|
|
227
|
+
sessions: z.int(),
|
|
228
|
+
tokens: z.int()
|
|
229
|
+
});
|
|
230
|
+
/**
|
|
231
|
+
* Decay Level
|
|
232
|
+
*
|
|
233
|
+
* Recency band for project file familiarity
|
|
234
|
+
*/
|
|
235
|
+
export const zDecayLevel = z.enum([
|
|
236
|
+
'fresh',
|
|
237
|
+
'fading',
|
|
238
|
+
'stale',
|
|
239
|
+
'unexplored'
|
|
240
|
+
]);
|
|
241
|
+
export const zDiagnosticEntry = z.object({
|
|
242
|
+
errorType: z.string(),
|
|
243
|
+
location: z.string(),
|
|
244
|
+
message: z.string(),
|
|
245
|
+
remediation: z.string()
|
|
246
|
+
});
|
|
247
|
+
export const zDiagnosticsInfo = z.object({
|
|
248
|
+
partial: z.boolean().nullish(),
|
|
249
|
+
warnings: z.array(zDiagnosticEntry).nullable()
|
|
250
|
+
});
|
|
251
|
+
/**
|
|
252
|
+
* Diff Line Kind
|
|
253
|
+
*
|
|
254
|
+
* Unified-diff line kind: context, addition, or deletion
|
|
255
|
+
*/
|
|
256
|
+
export const zDiffLineKind = z.enum([
|
|
257
|
+
'context',
|
|
258
|
+
'add',
|
|
259
|
+
'del'
|
|
260
|
+
]);
|
|
261
|
+
export const zDiffLine = z.object({
|
|
262
|
+
kind: zDiffLineKind,
|
|
263
|
+
text: z.string()
|
|
264
|
+
});
|
|
265
|
+
export const zDiffHunk = z.object({
|
|
266
|
+
header: z.string().optional(),
|
|
267
|
+
lines: z.array(zDiffLine).nullable(),
|
|
268
|
+
newLines: z.int(),
|
|
269
|
+
newStart: z.int(),
|
|
270
|
+
oldLines: z.int(),
|
|
271
|
+
oldStart: z.int(),
|
|
272
|
+
sessionId: z.string().optional(),
|
|
273
|
+
sessionTitle: z.string().optional()
|
|
274
|
+
});
|
|
275
|
+
/**
|
|
276
|
+
* Edge Violation Kind
|
|
277
|
+
*
|
|
278
|
+
* Structural violation detected on a map edge
|
|
279
|
+
*/
|
|
280
|
+
export const zEdgeViolationKind = z.enum(['cycle', 'wrong_way']);
|
|
281
|
+
export const zEdgeViolation = z.object({
|
|
282
|
+
from: z.string(),
|
|
283
|
+
kind: zEdgeViolationKind,
|
|
284
|
+
to: z.string()
|
|
285
|
+
});
|
|
286
|
+
/**
|
|
287
|
+
* Entry Type
|
|
288
|
+
*
|
|
289
|
+
* Classification of a single entry within an agent session transcript
|
|
290
|
+
*/
|
|
291
|
+
export const zEntryType = z.enum([
|
|
292
|
+
'text',
|
|
293
|
+
'tool_use',
|
|
294
|
+
'tool_result',
|
|
295
|
+
'thinking',
|
|
296
|
+
'system',
|
|
297
|
+
'error',
|
|
298
|
+
'result'
|
|
299
|
+
]);
|
|
300
|
+
export const zExchangeCodeRequest = z.object({
|
|
301
|
+
code: z.string(),
|
|
302
|
+
state: z.string()
|
|
303
|
+
});
|
|
304
|
+
export const zExchangeCodeResponse = z.object({
|
|
305
|
+
api_key: z.string(),
|
|
306
|
+
key_id: z.string(),
|
|
307
|
+
user_id: z.string(),
|
|
308
|
+
username: z.string()
|
|
309
|
+
});
|
|
310
|
+
/**
|
|
311
|
+
* File Change Status
|
|
312
|
+
*
|
|
313
|
+
* Git file delta status: modified, added, deleted, or renamed
|
|
314
|
+
*/
|
|
315
|
+
export const zFileChangeStatus = z.enum([
|
|
316
|
+
'M',
|
|
317
|
+
'A',
|
|
318
|
+
'D',
|
|
319
|
+
'R'
|
|
320
|
+
]);
|
|
321
|
+
export const zChangeDiffPayload = z.object({
|
|
322
|
+
binary: z.boolean(),
|
|
323
|
+
branch: z.string(),
|
|
324
|
+
file: z.string(),
|
|
325
|
+
hunks: z.array(zDiffHunk).nullable(),
|
|
326
|
+
oldPath: z.string().nullish(),
|
|
327
|
+
status: zFileChangeStatus,
|
|
328
|
+
truncated: z.boolean()
|
|
329
|
+
});
|
|
330
|
+
export const zFileChange = z.object({
|
|
331
|
+
linesAdded: z.int(),
|
|
332
|
+
linesRemoved: z.int(),
|
|
333
|
+
oldPath: z.string().nullish(),
|
|
334
|
+
path: z.string(),
|
|
335
|
+
status: zFileChangeStatus
|
|
336
|
+
});
|
|
337
|
+
export const zFileFamiliarity = z.object({
|
|
338
|
+
daysSince: z.int().nullable(),
|
|
339
|
+
decayLevel: zDecayLevel,
|
|
340
|
+
depth: z.int(),
|
|
341
|
+
humanTurns: z.int(),
|
|
342
|
+
isSourceFile: z.boolean(),
|
|
343
|
+
lastEngagedAt: z.string().nullable(),
|
|
344
|
+
path: z.string(),
|
|
345
|
+
sessionCount: z.int(),
|
|
346
|
+
totalTurns: z.int()
|
|
347
|
+
});
|
|
348
|
+
export const zFrictionCluster = z.object({
|
|
349
|
+
count: z.int(),
|
|
350
|
+
file: z.string(),
|
|
351
|
+
kind: z.string(),
|
|
352
|
+
label: z.string(),
|
|
353
|
+
sessions: z.int()
|
|
354
|
+
});
|
|
355
|
+
export const zGitContext = z.object({
|
|
356
|
+
branch: z.string().nullish(),
|
|
357
|
+
commits: z.array(zCommitInfo).optional(),
|
|
358
|
+
remote: z.string().nullish(),
|
|
359
|
+
tracking: z.string().nullish(),
|
|
360
|
+
worktree: z.string().nullish()
|
|
361
|
+
});
|
|
362
|
+
/**
|
|
363
|
+
* Harness
|
|
364
|
+
*
|
|
365
|
+
* AI coding tool or development environment
|
|
366
|
+
*/
|
|
367
|
+
export const zHarness = z.enum([
|
|
368
|
+
'claude-code',
|
|
369
|
+
'gemini-cli',
|
|
370
|
+
'codex',
|
|
371
|
+
'opencode',
|
|
372
|
+
'cursor',
|
|
373
|
+
'antigravity'
|
|
374
|
+
]);
|
|
375
|
+
export const zHealthResponse = z.object({
|
|
376
|
+
status: z.string()
|
|
377
|
+
});
|
|
378
|
+
/**
|
|
379
|
+
* Host Slug
|
|
380
|
+
*
|
|
381
|
+
* Sanitized, filesystem-safe identifier derived from git remote; contains only [a-zA-Z0-9._<>-]
|
|
382
|
+
*/
|
|
383
|
+
export const zHostSlug = z.string().regex(/^[a-zA-Z0-9._<>-]+$/);
|
|
384
|
+
/**
|
|
385
|
+
* Interaction Type
|
|
386
|
+
*
|
|
387
|
+
* How deeply a session engaged with a project file
|
|
388
|
+
*/
|
|
389
|
+
export const zInteractionType = z.enum([
|
|
390
|
+
'mentioned',
|
|
391
|
+
'read',
|
|
392
|
+
'discussed',
|
|
393
|
+
'questioned'
|
|
394
|
+
]);
|
|
395
|
+
/**
|
|
396
|
+
* License
|
|
397
|
+
*
|
|
398
|
+
* Content license for a published transcript
|
|
399
|
+
*/
|
|
400
|
+
export const zLicense = z.enum([
|
|
401
|
+
'CC0-1.0',
|
|
402
|
+
'CC-BY-4.0',
|
|
403
|
+
'CC-BY-SA-4.0'
|
|
404
|
+
]);
|
|
405
|
+
export const zMapEdge = z.object({
|
|
406
|
+
count: z.int(),
|
|
407
|
+
from: z.string(),
|
|
408
|
+
to: z.string()
|
|
409
|
+
});
|
|
410
|
+
/**
|
|
411
|
+
* Map Node Kind
|
|
412
|
+
*
|
|
413
|
+
* Path-derived map node classification
|
|
414
|
+
*/
|
|
415
|
+
export const zMapNodeKind = z.enum([
|
|
416
|
+
'module',
|
|
417
|
+
'package',
|
|
418
|
+
'file'
|
|
419
|
+
]);
|
|
420
|
+
export const zMapNode = z.object({
|
|
421
|
+
effortDensity: z.number(),
|
|
422
|
+
fileCount: z.int(),
|
|
423
|
+
id: z.string(),
|
|
424
|
+
kind: zMapNodeKind,
|
|
425
|
+
language: z.string().optional(),
|
|
426
|
+
layer: z.int(),
|
|
427
|
+
loc: z.int(),
|
|
428
|
+
name: z.string(),
|
|
429
|
+
order: z.int(),
|
|
430
|
+
parent: z.string().optional(),
|
|
431
|
+
recordedFiles: z.int(),
|
|
432
|
+
totalFiles: z.int(),
|
|
433
|
+
touchCount: z.int()
|
|
434
|
+
});
|
|
435
|
+
export const zMapSlice = z.object({
|
|
436
|
+
activityEdges: z.array(zActivityEdge).nullable(),
|
|
437
|
+
nodes: z.array(zMapNode).nullable(),
|
|
438
|
+
structureEdges: z.array(zMapEdge).nullable()
|
|
439
|
+
});
|
|
440
|
+
/**
|
|
441
|
+
* Message Type
|
|
442
|
+
*
|
|
443
|
+
* WebSocket message discriminator
|
|
444
|
+
*/
|
|
445
|
+
export const zMessageType = z.enum([
|
|
446
|
+
'subscribe',
|
|
447
|
+
'unsubscribe',
|
|
448
|
+
'dashboard',
|
|
449
|
+
'sessions',
|
|
450
|
+
'session_detail',
|
|
451
|
+
'trends',
|
|
452
|
+
'quality',
|
|
453
|
+
'annotations',
|
|
454
|
+
'project_familiarity',
|
|
455
|
+
'connected',
|
|
456
|
+
'error'
|
|
457
|
+
]);
|
|
458
|
+
export const zClientMessage = z.object({
|
|
459
|
+
channels: z.array(zChannelSubscription).optional(),
|
|
460
|
+
type: zMessageType
|
|
461
|
+
});
|
|
462
|
+
export const zMockConfigResponse = z.object({
|
|
463
|
+
api: z.array(z.string()).optional(),
|
|
464
|
+
enabled: z.boolean(),
|
|
465
|
+
tui: z.array(z.string()).optional(),
|
|
466
|
+
web: z.array(z.string()).optional()
|
|
467
|
+
});
|
|
468
|
+
/**
|
|
469
|
+
* Model ID
|
|
470
|
+
*
|
|
471
|
+
* Model identifier (e.g. 'claude-opus-4-6', 'gemini-2.0-flash')
|
|
472
|
+
*/
|
|
473
|
+
export const zModelID = z.string().min(1);
|
|
474
|
+
export const zModelInfo = z.object({
|
|
475
|
+
harness: zHarness,
|
|
476
|
+
hostSlug: zHostSlug.optional(),
|
|
477
|
+
model: zModelID,
|
|
478
|
+
version: z.string().optional()
|
|
479
|
+
});
|
|
480
|
+
/**
|
|
481
|
+
* Project Hash
|
|
482
|
+
*
|
|
483
|
+
* SHA-256 hex digest of the project's origin URL or local path
|
|
484
|
+
*/
|
|
485
|
+
export const zProjectHash = z.string().regex(/^[0-9a-f]{64}$/).brand();
|
|
486
|
+
export const zMapGraphPayload = z.object({
|
|
487
|
+
activityEdges: z.array(zActivityEdge).nullable(),
|
|
488
|
+
atCommit: z.string().optional(),
|
|
489
|
+
generatedAtMs: z.coerce.bigint().min(BigInt('-9223372036854775808'), { error: 'Invalid value: Expected int64 to be >= -9223372036854775808' }).max(BigInt('9223372036854775807'), { error: 'Invalid value: Expected int64 to be <= 9223372036854775807' }),
|
|
490
|
+
nodes: z.array(zMapNode).nullable(),
|
|
491
|
+
parsedLanguages: z.array(z.string()).nullable(),
|
|
492
|
+
projectHash: zProjectHash,
|
|
493
|
+
repoFound: z.boolean(),
|
|
494
|
+
repoPath: z.string().optional(),
|
|
495
|
+
structureEdges: z.array(zMapEdge).nullable(),
|
|
496
|
+
violations: z.array(zEdgeViolation).nullable()
|
|
497
|
+
});
|
|
498
|
+
export const zProjectContext = z.object({
|
|
499
|
+
filePath: z.string().optional(),
|
|
500
|
+
hash: zProjectHash,
|
|
501
|
+
name: z.string()
|
|
502
|
+
});
|
|
503
|
+
export const zProjectResolutionPayload = z.object({
|
|
504
|
+
project: z.string(),
|
|
505
|
+
projectHash: zProjectHash
|
|
506
|
+
});
|
|
507
|
+
export const zProjectSummary = z.object({
|
|
508
|
+
lastWorkMs: z.int().nullish(),
|
|
509
|
+
openChanges: z.int(),
|
|
510
|
+
project: z.string(),
|
|
511
|
+
projectHash: zProjectHash,
|
|
512
|
+
recordedFiles: z.int(),
|
|
513
|
+
sessions: z.int(),
|
|
514
|
+
totalFiles: z.int()
|
|
515
|
+
});
|
|
516
|
+
export const zProjectSummariesPayload = z.object({
|
|
517
|
+
projects: z.array(zProjectSummary).nullable()
|
|
518
|
+
});
|
|
519
|
+
export const zProvenance = z.object({
|
|
520
|
+
details: z.record(z.string(), z.string()).optional(),
|
|
521
|
+
function: z.string().optional(),
|
|
522
|
+
method: z.string(),
|
|
523
|
+
version: z.string().optional()
|
|
524
|
+
});
|
|
525
|
+
export const zPublishResponse = z.object({
|
|
526
|
+
blobKey: z.string(),
|
|
527
|
+
blobSizeBytes: z.coerce.bigint().min(BigInt('-9223372036854775808'), { error: 'Invalid value: Expected int64 to be >= -9223372036854775808' }).max(BigInt('9223372036854775807'), { error: 'Invalid value: Expected int64 to be <= 9223372036854775807' }),
|
|
528
|
+
created: z.boolean(),
|
|
529
|
+
publishedAt: z.coerce.bigint().min(BigInt('-9223372036854775808'), { error: 'Invalid value: Expected int64 to be >= -9223372036854775808' }).max(BigInt('9223372036854775807'), { error: 'Invalid value: Expected int64 to be <= 9223372036854775807' }),
|
|
530
|
+
transcriptId: z.string(),
|
|
531
|
+
updatedAt: z.coerce.bigint().min(BigInt('-9223372036854775808'), { error: 'Invalid value: Expected int64 to be >= -9223372036854775808' }).max(BigInt('9223372036854775807'), { error: 'Invalid value: Expected int64 to be <= 9223372036854775807' })
|
|
532
|
+
});
|
|
533
|
+
export const zRedactionInfo = z.object({
|
|
534
|
+
applied: z.boolean(),
|
|
535
|
+
content_hash_at_redact: z.string().optional(),
|
|
536
|
+
level: z.string().optional(),
|
|
537
|
+
redacted_at_ms: z.int().nullish(),
|
|
538
|
+
rule_set_version: z.string().optional()
|
|
539
|
+
});
|
|
540
|
+
export const zReviewSuggestion = z.object({
|
|
541
|
+
daysSince: z.int(),
|
|
542
|
+
lastEngaged: z.string(),
|
|
543
|
+
path: z.string(),
|
|
544
|
+
suggestedPrompt: z.string()
|
|
545
|
+
});
|
|
546
|
+
/**
|
|
547
|
+
* Role
|
|
548
|
+
*
|
|
549
|
+
* Sender role of a message turn
|
|
550
|
+
*/
|
|
551
|
+
export const zRole = z.enum([
|
|
552
|
+
'user',
|
|
553
|
+
'assistant',
|
|
554
|
+
'tool',
|
|
555
|
+
'system'
|
|
556
|
+
]);
|
|
557
|
+
/**
|
|
558
|
+
* Scale Kind
|
|
559
|
+
*
|
|
560
|
+
* Stevens measurement level: nominal (categories without order), ordinal (ordered categories), continuous (numeric range)
|
|
561
|
+
*/
|
|
562
|
+
export const zScaleKind = z.enum([
|
|
563
|
+
'nominal',
|
|
564
|
+
'ordinal',
|
|
565
|
+
'continuous'
|
|
566
|
+
]);
|
|
567
|
+
export const zSchemaVersionResponse = z.object({
|
|
568
|
+
annotationSchemaVersion: z.string(),
|
|
569
|
+
minPullContractVersion: z.string().optional(),
|
|
570
|
+
minPushContractVersion: z.string(),
|
|
571
|
+
pullContractVersion: z.string().optional(),
|
|
572
|
+
pushContractVersion: z.string(),
|
|
573
|
+
supportedTargetKinds: z.array(z.string()).nullable(),
|
|
574
|
+
supportedTypeIds: z.array(z.string()).nullable()
|
|
575
|
+
});
|
|
576
|
+
export const zSearchResult = z.object({
|
|
577
|
+
entryIndex: z.int(),
|
|
578
|
+
project: z.string(),
|
|
579
|
+
projectHash: zProjectHash.optional(),
|
|
580
|
+
role: z.string(),
|
|
581
|
+
score: z.number(),
|
|
582
|
+
sessionId: z.string(),
|
|
583
|
+
snippet: z.string()
|
|
584
|
+
});
|
|
585
|
+
export const zSearchPayload = z.object({
|
|
586
|
+
query: z.string(),
|
|
587
|
+
results: z.array(zSearchResult).nullable()
|
|
588
|
+
});
|
|
589
|
+
export const zServerMessage = z.object({
|
|
590
|
+
axis: zAnnotationAxis.optional(),
|
|
591
|
+
data: z.unknown().optional(),
|
|
592
|
+
id: z.string().optional(),
|
|
593
|
+
message: z.string().optional(),
|
|
594
|
+
topic: zChannelTopic.optional(),
|
|
595
|
+
type: zMessageType,
|
|
596
|
+
version: z.string().optional()
|
|
597
|
+
});
|
|
598
|
+
/**
|
|
599
|
+
* Session ID
|
|
600
|
+
*
|
|
601
|
+
* Unique session identifier (UUID, agent-{hex}, ses_{id}, sess_{id} (ACP), or msg_{id})
|
|
602
|
+
*/
|
|
603
|
+
export const zSessionID = z.string().regex(/^([0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}|agent-[a-f0-9]+|sess?_[a-zA-Z0-9]+|msg_[a-zA-Z0-9]+)$/);
|
|
604
|
+
export const zCommitRef = z.object({
|
|
605
|
+
hasSession: z.boolean(),
|
|
606
|
+
hash: z.string(),
|
|
607
|
+
sessionIds: z.array(zSessionID),
|
|
608
|
+
subject: z.string(),
|
|
609
|
+
timeMs: z.int().nullish()
|
|
610
|
+
});
|
|
611
|
+
export const zSessionIdentity = z.object({
|
|
612
|
+
parentUuid: zSessionID.nullish(),
|
|
613
|
+
schemaVersion: z.int(),
|
|
614
|
+
sessionId: zSessionID
|
|
615
|
+
});
|
|
616
|
+
/**
|
|
617
|
+
* Session Outcome
|
|
618
|
+
*
|
|
619
|
+
* Resolution status of the session
|
|
620
|
+
*/
|
|
621
|
+
export const zSessionOutcome = z.enum([
|
|
622
|
+
'resolved',
|
|
623
|
+
'partial',
|
|
624
|
+
'failed'
|
|
625
|
+
]);
|
|
626
|
+
export const zQualityMetrics = z.object({
|
|
627
|
+
computeVersion: z.int().nullish(),
|
|
628
|
+
computedAt: z.int().nullish(),
|
|
629
|
+
costCacheReadUsd: z.number().nullish(),
|
|
630
|
+
costCacheWriteUsd: z.number().nullish(),
|
|
631
|
+
costInputUsd: z.number().nullish(),
|
|
632
|
+
costModelId: z.string().nullish(),
|
|
633
|
+
costOutputUsd: z.number().nullish(),
|
|
634
|
+
costReasoningUsd: z.number().nullish(),
|
|
635
|
+
costTotalUsd: z.number().nullish(),
|
|
636
|
+
discoveryTurns: z.int().nullish(),
|
|
637
|
+
durationMinutes: z.number().nullish(),
|
|
638
|
+
explorationRatio: z.number().nullish(),
|
|
639
|
+
filesTouched: z.int().nullish(),
|
|
640
|
+
inputTokens: z.int().nullish(),
|
|
641
|
+
linesChanged: z.int().nullish(),
|
|
642
|
+
m2TokenOutcomeRatio: z.number().nullish(),
|
|
643
|
+
m3UniqueToolCount: z.int().nullish(),
|
|
644
|
+
m4ConsecutiveErrorMax: z.int().nullish(),
|
|
645
|
+
m4ErrorRecoveryCount: z.int().nullish(),
|
|
646
|
+
m5AvgMessageTokens: z.int().nullish(),
|
|
647
|
+
m5ContextUtilizationPct: z.number().nullish(),
|
|
648
|
+
m5PeakContextTokens: z.int().nullish(),
|
|
649
|
+
m6LinesSurvived: z.int().nullish(),
|
|
650
|
+
m6LinesTotal: z.int().nullish(),
|
|
651
|
+
m6OutputSurvivalPct: z.number().nullish(),
|
|
652
|
+
m7SpecHasConstraints: z.boolean().nullish(),
|
|
653
|
+
m7SpecHasExamples: z.boolean().nullish(),
|
|
654
|
+
m7SpecWordCount: z.int().nullish(),
|
|
655
|
+
outcome: zSessionOutcome.nullish(),
|
|
656
|
+
outputTokens: z.int().nullish(),
|
|
657
|
+
retryLoops: z.int().nullish(),
|
|
658
|
+
retryTokensWasted: z.int().nullish(),
|
|
659
|
+
scope: z.string().nullish(),
|
|
660
|
+
scopeBreadth: z.int().nullish(),
|
|
661
|
+
signalDensity: z.number().nullish(),
|
|
662
|
+
specQualityScore: z.number().nullish(),
|
|
663
|
+
subagentCount: z.int().nullish(),
|
|
664
|
+
titleGenerated: z.string().nullish(),
|
|
665
|
+
toolCalls: z.int().nullish(),
|
|
666
|
+
totalTokens: z.int().nullish(),
|
|
667
|
+
turnCount: z.int().nullish(),
|
|
668
|
+
withinSessionReverts: z.int().nullish()
|
|
669
|
+
});
|
|
670
|
+
export const zSessionScorecard = z.object({
|
|
671
|
+
costTotalUsd: z.number().nullish(),
|
|
672
|
+
m2TokenOutcomeRatio: z.number().nullish(),
|
|
673
|
+
m4ConsecutiveErrorMax: z.int().nullish(),
|
|
674
|
+
m5ContextUtilizationPct: z.number().nullish(),
|
|
675
|
+
m6OutputSurvivalPct: z.number().nullish(),
|
|
676
|
+
m7SpecHasConstraints: z.boolean().nullish(),
|
|
677
|
+
m7SpecHasExamples: z.boolean().nullish(),
|
|
678
|
+
outcome: zSessionOutcome.optional(),
|
|
679
|
+
retryTokensWasted: z.int().nullish(),
|
|
680
|
+
signalDensity: z.number().nullish(),
|
|
681
|
+
specQualityScore: z.number().nullish(),
|
|
682
|
+
totalTokens: z.int().nullish(),
|
|
683
|
+
withinSessionReverts: z.int().nullish()
|
|
684
|
+
});
|
|
685
|
+
export const zSessionStats = z.object({
|
|
686
|
+
cachedReadTokens: z.int().nullish(),
|
|
687
|
+
cachedWriteTokens: z.int().nullish(),
|
|
688
|
+
durationMs: z.coerce.bigint().min(BigInt('-9223372036854775808'), { error: 'Invalid value: Expected int64 to be >= -9223372036854775808' }).max(BigInt('9223372036854775807'), { error: 'Invalid value: Expected int64 to be <= 9223372036854775807' }),
|
|
689
|
+
subagentCount: z.int(),
|
|
690
|
+
thoughtTokens: z.int().nullish(),
|
|
691
|
+
tokensIn: z.int(),
|
|
692
|
+
tokensOut: z.int(),
|
|
693
|
+
toolCallCount: z.int(),
|
|
694
|
+
turnCount: z.int()
|
|
695
|
+
});
|
|
696
|
+
export const zSessionSummary = z.object({
|
|
697
|
+
durationMins: z.number(),
|
|
698
|
+
harness: zHarness,
|
|
699
|
+
id: z.string(),
|
|
700
|
+
outcome: z.string().optional(),
|
|
701
|
+
parentSessionId: z.string().nullish(),
|
|
702
|
+
preview: z.string().optional(),
|
|
703
|
+
project: z.string().optional(),
|
|
704
|
+
projectHash: zProjectHash.optional(),
|
|
705
|
+
startTime: z.iso.datetime(),
|
|
706
|
+
toolCallCount: z.int(),
|
|
707
|
+
totalTokens: z.int(),
|
|
708
|
+
turnCount: z.int()
|
|
709
|
+
});
|
|
710
|
+
export const zSessionsPayload = z.object({
|
|
711
|
+
sessions: z.array(zSessionSummary).nullable()
|
|
712
|
+
});
|
|
713
|
+
export const zShutdownResponse = z.object({
|
|
714
|
+
status: z.string()
|
|
715
|
+
});
|
|
716
|
+
/**
|
|
717
|
+
* Source Format
|
|
718
|
+
*
|
|
719
|
+
* Transcript file format
|
|
720
|
+
*/
|
|
721
|
+
export const zSourceFormat = z.enum(['jsonl', 'json']);
|
|
722
|
+
export const zSourceInfo = z.object({
|
|
723
|
+
filePath: z.string().optional(),
|
|
724
|
+
format: zSourceFormat
|
|
725
|
+
});
|
|
726
|
+
/**
|
|
727
|
+
* Stop Reason
|
|
728
|
+
*
|
|
729
|
+
* Reason why a session or turn ended (ACP-aligned)
|
|
730
|
+
*/
|
|
731
|
+
export const zStopReason = z.enum([
|
|
732
|
+
'end_turn',
|
|
733
|
+
'cancelled',
|
|
734
|
+
'max_tokens',
|
|
735
|
+
'max_turn_requests',
|
|
736
|
+
'refusal'
|
|
737
|
+
]);
|
|
738
|
+
export const zSubagentRef = z.object({
|
|
739
|
+
parentUuid: zSessionID,
|
|
740
|
+
sessionId: zSessionID
|
|
741
|
+
});
|
|
742
|
+
/**
|
|
743
|
+
* Target Kind
|
|
744
|
+
*
|
|
745
|
+
* What is being annotated: session-level, entry-level (turn/tool call), meta-annotation, or project-level
|
|
746
|
+
*/
|
|
747
|
+
export const zTargetKind = z.enum([
|
|
748
|
+
'session',
|
|
749
|
+
'entry',
|
|
750
|
+
'annotation',
|
|
751
|
+
'project'
|
|
752
|
+
]);
|
|
753
|
+
export const zAnnotationPushItem = z.object({
|
|
754
|
+
annotationId: z.string().nullish(),
|
|
755
|
+
annotatorName: z.string().optional(),
|
|
756
|
+
confidence: z.number().nullish(),
|
|
757
|
+
contentHash: z.string(),
|
|
758
|
+
entryTarget: zAnnotationEntryTarget.nullish(),
|
|
759
|
+
isPrimary: z.boolean(),
|
|
760
|
+
projectHash: zProjectHash.nullish(),
|
|
761
|
+
provenance: zProvenance.nullish(),
|
|
762
|
+
reason: z.string().nullish(),
|
|
763
|
+
sessionId: z.string().nullish(),
|
|
764
|
+
targetKind: zTargetKind,
|
|
765
|
+
typeId: z.string(),
|
|
766
|
+
value: z.string()
|
|
767
|
+
});
|
|
768
|
+
export const zAnnotationPushRequest = z.object({
|
|
769
|
+
annotations: z.array(zAnnotationPushItem).nullable(),
|
|
770
|
+
retractions: z.array(z.string()).optional()
|
|
771
|
+
});
|
|
772
|
+
export const zAnnotationSummary = z.object({
|
|
773
|
+
annotatorKind: zAnnotatorKind,
|
|
774
|
+
annotatorName: z.string(),
|
|
775
|
+
confidence: z.number().nullish(),
|
|
776
|
+
contentHash: z.string().nullish(),
|
|
777
|
+
createdAt: z.coerce.bigint().min(BigInt('-9223372036854775808'), { error: 'Invalid value: Expected int64 to be >= -9223372036854775808' }).max(BigInt('9223372036854775807'), { error: 'Invalid value: Expected int64 to be <= 9223372036854775807' }),
|
|
778
|
+
id: z.string(),
|
|
779
|
+
isPrimary: z.boolean(),
|
|
780
|
+
provenance: zProvenance.nullish(),
|
|
781
|
+
reason: z.string().nullish(),
|
|
782
|
+
supersededBy: z.string().nullish(),
|
|
783
|
+
targetAnnotationId: z.string().nullish(),
|
|
784
|
+
targetEntryEndIndex: z.int().nullish(),
|
|
785
|
+
targetEntryIndex: z.int().nullish(),
|
|
786
|
+
targetKind: zTargetKind,
|
|
787
|
+
targetProjectHash: zProjectHash.nullish(),
|
|
788
|
+
targetSessionId: z.string().nullish(),
|
|
789
|
+
typeId: z.string(),
|
|
790
|
+
typeName: z.string(),
|
|
791
|
+
value: z.string()
|
|
792
|
+
});
|
|
793
|
+
export const zAnnotationsPayload = z.object({
|
|
794
|
+
annotations: z.array(zAnnotationSummary).nullable(),
|
|
795
|
+
axis: zAnnotationAxis,
|
|
796
|
+
id: z.string()
|
|
797
|
+
});
|
|
798
|
+
export const zPullAnnotation = z.object({
|
|
799
|
+
annotatorKind: zAnnotatorKind.optional(),
|
|
800
|
+
annotatorName: z.string().optional(),
|
|
801
|
+
authorUserId: z.string(),
|
|
802
|
+
authorUsername: z.string(),
|
|
803
|
+
confidence: z.number().nullish(),
|
|
804
|
+
contentHash: z.string().nullish(),
|
|
805
|
+
createdAt: z.coerce.bigint().min(BigInt('-9223372036854775808'), { error: 'Invalid value: Expected int64 to be >= -9223372036854775808' }).max(BigInt('9223372036854775807'), { error: 'Invalid value: Expected int64 to be <= 9223372036854775807' }).optional(),
|
|
806
|
+
id: z.string().optional(),
|
|
807
|
+
isPrimary: z.boolean().optional(),
|
|
808
|
+
provenance: zProvenance.optional(),
|
|
809
|
+
reason: z.string().nullish(),
|
|
810
|
+
supersededBy: z.string().nullish(),
|
|
811
|
+
targetAnnotationId: z.string().nullish(),
|
|
812
|
+
targetEntryEndIndex: z.int().nullish(),
|
|
813
|
+
targetEntryIndex: z.int().nullish(),
|
|
814
|
+
targetKind: zTargetKind.optional(),
|
|
815
|
+
targetProjectHash: zProjectHash.optional(),
|
|
816
|
+
targetSessionId: z.string().nullish(),
|
|
817
|
+
typeId: z.string().optional(),
|
|
818
|
+
typeName: z.string().optional(),
|
|
819
|
+
value: z.string().optional()
|
|
820
|
+
});
|
|
821
|
+
export const zQualitySession = z.object({
|
|
822
|
+
date: z.string(),
|
|
823
|
+
discoveryTurns: z.int(),
|
|
824
|
+
durationMinutes: z.number(),
|
|
825
|
+
effectiveAnnotations: z.array(zAnnotationSummary).optional(),
|
|
826
|
+
explorationRatio: z.number(),
|
|
827
|
+
filesTouched: z.int(),
|
|
828
|
+
id: z.string(),
|
|
829
|
+
inputTokens: z.int(),
|
|
830
|
+
linesChanged: z.int(),
|
|
831
|
+
outcome: z.string(),
|
|
832
|
+
outputTokens: z.int(),
|
|
833
|
+
project: z.string(),
|
|
834
|
+
retryLoops: z.int(),
|
|
835
|
+
retryTokensWasted: z.int(),
|
|
836
|
+
scope: z.string(),
|
|
837
|
+
scopeBreadth: z.int(),
|
|
838
|
+
signalDensity: z.number(),
|
|
839
|
+
specQualityScore: z.number(),
|
|
840
|
+
title: z.string(),
|
|
841
|
+
toolCalls: z.int(),
|
|
842
|
+
totalTokens: z.int(),
|
|
843
|
+
turnCount: z.int(),
|
|
844
|
+
withinSessionReverts: z.int()
|
|
845
|
+
});
|
|
846
|
+
export const zQualityPayload = z.object({
|
|
847
|
+
sessions: z.array(zQualitySession).nullable()
|
|
848
|
+
});
|
|
849
|
+
export const zTaskSummary = z.object({
|
|
850
|
+
editedFiles: z.array(z.string()).nullable(),
|
|
851
|
+
entryIndex: z.int(),
|
|
852
|
+
labels: z.array(z.string()).nullable(),
|
|
853
|
+
outcome: z.string().optional(),
|
|
854
|
+
readCount: z.int(),
|
|
855
|
+
retryLoop: z.boolean(),
|
|
856
|
+
sessionId: z.string(),
|
|
857
|
+
startMs: z.int().nullish(),
|
|
858
|
+
title: z.string()
|
|
859
|
+
});
|
|
860
|
+
export const zChangeSession = z.object({
|
|
861
|
+
binding: zChangeBinding,
|
|
862
|
+
harness: z.string(),
|
|
863
|
+
sessionId: z.string(),
|
|
864
|
+
startMs: z.int().nullish(),
|
|
865
|
+
tasks: z.array(zTaskSummary).nullable(),
|
|
866
|
+
title: z.string()
|
|
867
|
+
});
|
|
868
|
+
export const zMapNodeDetailPayload = z.object({
|
|
869
|
+
costUsd: z.number().nullish(),
|
|
870
|
+
dependsOn: z.array(z.string()).nullable(),
|
|
871
|
+
kind: zMapNodeKind,
|
|
872
|
+
language: z.string().optional(),
|
|
873
|
+
lastTouchMs: z.int().nullish(),
|
|
874
|
+
loc: z.int(),
|
|
875
|
+
path: z.string(),
|
|
876
|
+
reEdits: z.int(),
|
|
877
|
+
recentCommits: z.array(zCommitRef).nullable(),
|
|
878
|
+
recordedFiles: z.int(),
|
|
879
|
+
retryLoops: z.int(),
|
|
880
|
+
sessionCount: z.int(),
|
|
881
|
+
shapedBy: z.array(zTaskSummary).nullable(),
|
|
882
|
+
taskCount: z.int(),
|
|
883
|
+
totalFiles: z.int(),
|
|
884
|
+
usedBy: z.array(z.string()).nullable()
|
|
885
|
+
});
|
|
886
|
+
export const zProjectTasksPayload = z.object({
|
|
887
|
+
fileFilter: z.string().optional(),
|
|
888
|
+
projectHash: zProjectHash,
|
|
889
|
+
tasks: z.array(zTaskSummary).nullable()
|
|
890
|
+
});
|
|
891
|
+
export const zTimelineSessionRef = z.object({
|
|
892
|
+
harness: zHarness,
|
|
893
|
+
hasCommitBinding: z.boolean(),
|
|
894
|
+
sessionId: zSessionID,
|
|
895
|
+
startMs: z.int().nullish(),
|
|
896
|
+
title: z.string()
|
|
897
|
+
});
|
|
898
|
+
export const zReviewListPayload = z.object({
|
|
899
|
+
changes: z.array(zChangeSummary),
|
|
900
|
+
defaultBranch: z.string().optional(),
|
|
901
|
+
projectHash: zProjectHash,
|
|
902
|
+
recentCommits: z.array(zCommitRef),
|
|
903
|
+
repoFound: z.boolean(),
|
|
904
|
+
sessions: z.array(zTimelineSessionRef)
|
|
905
|
+
});
|
|
906
|
+
export const zTimestampInfo = z.object({
|
|
907
|
+
end: z.coerce.bigint().min(BigInt('-9223372036854775808'), { error: 'Invalid value: Expected int64 to be >= -9223372036854775808' }).max(BigInt('9223372036854775807'), { error: 'Invalid value: Expected int64 to be <= 9223372036854775807' }),
|
|
908
|
+
ingested: z.int().nullish(),
|
|
909
|
+
start: z.coerce.bigint().min(BigInt('-9223372036854775808'), { error: 'Invalid value: Expected int64 to be >= -9223372036854775808' }).max(BigInt('9223372036854775807'), { error: 'Invalid value: Expected int64 to be <= 9223372036854775807' })
|
|
910
|
+
});
|
|
911
|
+
/**
|
|
912
|
+
* Tool Call Kind
|
|
913
|
+
*
|
|
914
|
+
* Classification of a tool call, aligned with ACP ToolCallUpdate.kind
|
|
915
|
+
*/
|
|
916
|
+
export const zToolCallKind = z.enum([
|
|
917
|
+
'read',
|
|
918
|
+
'edit',
|
|
919
|
+
'delete',
|
|
920
|
+
'move',
|
|
921
|
+
'search',
|
|
922
|
+
'execute',
|
|
923
|
+
'think',
|
|
924
|
+
'fetch',
|
|
925
|
+
'other'
|
|
926
|
+
]);
|
|
927
|
+
export const zSessionEntry = z.object({
|
|
928
|
+
contentPreview: z.string().nullish(),
|
|
929
|
+
depth: z.int(),
|
|
930
|
+
entryId: z.string().nullish(),
|
|
931
|
+
entryIndex: z.int(),
|
|
932
|
+
entryType: zEntryType,
|
|
933
|
+
extra: z.string().nullish(),
|
|
934
|
+
harness: zHarness,
|
|
935
|
+
hasThinking: z.boolean(),
|
|
936
|
+
hasToolUse: z.boolean(),
|
|
937
|
+
isError: z.boolean(),
|
|
938
|
+
parentEntryId: z.string().nullish(),
|
|
939
|
+
parentIndex: z.int().nullish(),
|
|
940
|
+
partType: z.string().nullish(),
|
|
941
|
+
rawByteLength: z.int().nullish(),
|
|
942
|
+
role: zRole,
|
|
943
|
+
sessionId: zSessionID,
|
|
944
|
+
stopReason: zStopReason.nullish(),
|
|
945
|
+
timestampMs: z.int().nullish(),
|
|
946
|
+
tokensIn: z.int().nullish(),
|
|
947
|
+
tokensOut: z.int().nullish(),
|
|
948
|
+
toolCallId: z.string().nullish(),
|
|
949
|
+
toolInput: z.string().nullish(),
|
|
950
|
+
toolKind: zToolCallKind.nullish(),
|
|
951
|
+
toolNamesCsv: z.string().nullish(),
|
|
952
|
+
toolOutput: z.string().nullish()
|
|
953
|
+
});
|
|
954
|
+
export const zPublishRequest = z.object({
|
|
955
|
+
diagnostics: zDiagnosticsInfo,
|
|
956
|
+
entries: z.array(zSessionEntry).optional(),
|
|
957
|
+
git: zGitContext,
|
|
958
|
+
identity: zSessionIdentity,
|
|
959
|
+
license: zLicense.optional(),
|
|
960
|
+
model: zModelInfo,
|
|
961
|
+
project: zProjectContext,
|
|
962
|
+
quality: zQualityMetrics.nullish(),
|
|
963
|
+
source: zSourceInfo,
|
|
964
|
+
stats: zSessionStats,
|
|
965
|
+
subagents: z.array(zSubagentRef).optional(),
|
|
966
|
+
timestamp: zTimestampInfo
|
|
967
|
+
});
|
|
968
|
+
export const zToolCallDetail = z.object({
|
|
969
|
+
arguments: z.string(),
|
|
970
|
+
durationMs: z.int().nullish(),
|
|
971
|
+
exitCode: z.int().nullish(),
|
|
972
|
+
filePath: z.string().optional(),
|
|
973
|
+
id: z.string(),
|
|
974
|
+
isError: z.boolean().optional(),
|
|
975
|
+
name: z.string(),
|
|
976
|
+
result: z.string(),
|
|
977
|
+
toolKind: zToolCallKind.optional()
|
|
978
|
+
});
|
|
979
|
+
/**
|
|
980
|
+
* Transcript ID
|
|
981
|
+
*
|
|
982
|
+
* Village-side transcript identifier (canonical lowercase-hex UUID)
|
|
983
|
+
*/
|
|
984
|
+
export const zTranscriptID = z.uuid().regex(/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/);
|
|
985
|
+
export const zPullSkipGateItem = z.object({
|
|
986
|
+
annotationHashes: z.array(z.string()),
|
|
987
|
+
contentHash: z.string(),
|
|
988
|
+
transcriptId: zTranscriptID
|
|
989
|
+
});
|
|
990
|
+
export const zPullSkipGateRequest = z.object({
|
|
991
|
+
items: z.array(zPullSkipGateItem)
|
|
992
|
+
});
|
|
993
|
+
export const zPullSkipGateResult = z.object({
|
|
994
|
+
annotationsCurrent: z.boolean(),
|
|
995
|
+
contentCurrent: z.boolean(),
|
|
996
|
+
transcriptId: zTranscriptID
|
|
997
|
+
});
|
|
998
|
+
export const zPullSkipGateResponse = z.object({
|
|
999
|
+
results: z.array(zPullSkipGateResult)
|
|
1000
|
+
});
|
|
1001
|
+
export const zTrendsPayload = z.object({
|
|
1002
|
+
days: z.array(zDayStats).nullable(),
|
|
1003
|
+
totalSessions: z.int(),
|
|
1004
|
+
totalTokens: z.int()
|
|
1005
|
+
});
|
|
1006
|
+
export const zTurnDetail = z.object({
|
|
1007
|
+
agentName: z.string().optional(),
|
|
1008
|
+
content: z.string(),
|
|
1009
|
+
depth: z.int(),
|
|
1010
|
+
entryType: zEntryType.optional(),
|
|
1011
|
+
hasThinking: z.boolean().optional(),
|
|
1012
|
+
index: z.int(),
|
|
1013
|
+
parentIndex: z.int().nullish(),
|
|
1014
|
+
role: zRole,
|
|
1015
|
+
stopReason: zStopReason.nullish(),
|
|
1016
|
+
timestamp: z.iso.datetime(),
|
|
1017
|
+
tokensIn: z.int().nullish(),
|
|
1018
|
+
tokensOut: z.int().nullish(),
|
|
1019
|
+
toolCalls: z.array(zToolCallDetail).optional()
|
|
1020
|
+
});
|
|
1021
|
+
export const zSessionDetailPayload = z.object({
|
|
1022
|
+
childSessions: z.array(zChildSessionRef).optional(),
|
|
1023
|
+
durationMins: z.number(),
|
|
1024
|
+
endTime: z.iso.datetime(),
|
|
1025
|
+
gitBranch: z.string().optional(),
|
|
1026
|
+
gitRemote: z.string().optional(),
|
|
1027
|
+
harness: zHarness,
|
|
1028
|
+
id: z.string(),
|
|
1029
|
+
model: z.string().optional(),
|
|
1030
|
+
outcome: zSessionOutcome.optional(),
|
|
1031
|
+
project: z.string().optional(),
|
|
1032
|
+
schemaVersion: z.string().optional(),
|
|
1033
|
+
scorecard: zSessionScorecard.nullish(),
|
|
1034
|
+
source: z.string().optional(),
|
|
1035
|
+
startTime: z.iso.datetime(),
|
|
1036
|
+
status: z.string().optional(),
|
|
1037
|
+
tokensIn: z.int(),
|
|
1038
|
+
tokensOut: z.int(),
|
|
1039
|
+
toolCallCount: z.int(),
|
|
1040
|
+
totalTokens: z.int(),
|
|
1041
|
+
turnCount: z.int(),
|
|
1042
|
+
turns: z.array(zTurnDetail).nullable(),
|
|
1043
|
+
workingDirectory: z.string().optional()
|
|
1044
|
+
});
|
|
1045
|
+
export const zTranscriptContent = z.object({
|
|
1046
|
+
contractVersion: z.string(),
|
|
1047
|
+
kind: zContentKind,
|
|
1048
|
+
sessionDetail: zSessionDetailPayload.nullish()
|
|
1049
|
+
});
|
|
1050
|
+
/**
|
|
1051
|
+
* Type Origin
|
|
1052
|
+
*
|
|
1053
|
+
* Who created an annotation type: system (built-in), user (individual), or group (shared)
|
|
1054
|
+
*/
|
|
1055
|
+
export const zTypeOrigin = z.enum([
|
|
1056
|
+
'system',
|
|
1057
|
+
'user',
|
|
1058
|
+
'group'
|
|
1059
|
+
]);
|
|
1060
|
+
export const zUnifiedMetadata = z.object({
|
|
1061
|
+
contentHash: z.string(),
|
|
1062
|
+
cwd: z.string().optional(),
|
|
1063
|
+
derivedAt: z.int().nullish(),
|
|
1064
|
+
diagnostics: zDiagnosticsInfo,
|
|
1065
|
+
git: zGitContext,
|
|
1066
|
+
harness: zHarness,
|
|
1067
|
+
hostSlug: zHostSlug,
|
|
1068
|
+
metadataHash: z.string(),
|
|
1069
|
+
model: zModelID,
|
|
1070
|
+
parentUuid: zSessionID.nullable(),
|
|
1071
|
+
project: zProjectContext,
|
|
1072
|
+
redaction: zRedactionInfo,
|
|
1073
|
+
schemaVersion: z.int(),
|
|
1074
|
+
sessionId: zSessionID,
|
|
1075
|
+
source: zSourceInfo,
|
|
1076
|
+
stats: zSessionStats,
|
|
1077
|
+
subagents: z.array(zSubagentRef).nullable(),
|
|
1078
|
+
timestamp: zTimestampInfo,
|
|
1079
|
+
version: z.string()
|
|
1080
|
+
});
|
|
1081
|
+
export const zUnusualSignal = z.object({
|
|
1082
|
+
kind: z.string(),
|
|
1083
|
+
label: z.string(),
|
|
1084
|
+
perChange: z.number(),
|
|
1085
|
+
perProject: z.number()
|
|
1086
|
+
});
|
|
1087
|
+
export const zChangeDetailPayload = z.object({
|
|
1088
|
+
baseRef: z.string(),
|
|
1089
|
+
branch: z.string(),
|
|
1090
|
+
costUsd: z.number().nullish(),
|
|
1091
|
+
defaultBranch: z.string(),
|
|
1092
|
+
files: z.array(zFileChange).nullable(),
|
|
1093
|
+
frictions: z.array(zFrictionCluster).nullable(),
|
|
1094
|
+
linesAdded: z.int(),
|
|
1095
|
+
linesRemoved: z.int(),
|
|
1096
|
+
newEdges: z.array(zMapEdge).nullable(),
|
|
1097
|
+
newNodes: z.array(z.string()).nullable(),
|
|
1098
|
+
outputTokens: z.coerce.bigint().min(BigInt('-9223372036854775808'), { error: 'Invalid value: Expected int64 to be >= -9223372036854775808' }).max(BigInt('9223372036854775807'), { error: 'Invalid value: Expected int64 to be <= 9223372036854775807' }),
|
|
1099
|
+
removedEdges: z.array(zMapEdge).nullable(),
|
|
1100
|
+
removedNodes: z.array(z.string()).nullable(),
|
|
1101
|
+
slice: zMapSlice,
|
|
1102
|
+
unrecordedCommits: z.array(zCommitRef).nullable(),
|
|
1103
|
+
unusual: z.array(zUnusualSignal).nullable(),
|
|
1104
|
+
violations: z.array(zEdgeViolation).nullable(),
|
|
1105
|
+
work: z.array(zChangeSession).nullable()
|
|
1106
|
+
});
|
|
1107
|
+
/**
|
|
1108
|
+
* Value Domain Kind
|
|
1109
|
+
*
|
|
1110
|
+
* ISO 11179 value domain: enumerated (finite allowed set) or described (range/pattern constraint)
|
|
1111
|
+
*/
|
|
1112
|
+
export const zValueDomainKind = z.enum(['enumerated', 'described']);
|
|
1113
|
+
export const zValueDomain = z.object({
|
|
1114
|
+
constraintSpec: z.string().optional(),
|
|
1115
|
+
datatype: zAnnotationDatatype,
|
|
1116
|
+
kind: zValueDomainKind,
|
|
1117
|
+
permissibleValues: z.array(z.string()).optional()
|
|
1118
|
+
});
|
|
1119
|
+
export const zAnnotationTypeSummary = z.object({
|
|
1120
|
+
allowedTargetKinds: z.array(zTargetKind).optional(),
|
|
1121
|
+
class: z.string(),
|
|
1122
|
+
description: z.string().optional(),
|
|
1123
|
+
displayName: z.string(),
|
|
1124
|
+
family: z.string(),
|
|
1125
|
+
id: z.string().optional(),
|
|
1126
|
+
lowerIsBetter: z.boolean().nullish(),
|
|
1127
|
+
origin: zTypeOrigin,
|
|
1128
|
+
priorityOverride: z.int().nullish(),
|
|
1129
|
+
scaleKind: zScaleKind.optional(),
|
|
1130
|
+
status: zAnnotationStatus,
|
|
1131
|
+
typeId: z.string(),
|
|
1132
|
+
valueDomain: zValueDomain,
|
|
1133
|
+
version: z.int()
|
|
1134
|
+
});
|
|
1135
|
+
export const zTaxonomyFamilyNode = z.object({
|
|
1136
|
+
family: z.string(),
|
|
1137
|
+
types: z.array(zAnnotationTypeSummary).nullable()
|
|
1138
|
+
});
|
|
1139
|
+
export const zTaxonomyNode = z.object({
|
|
1140
|
+
class: z.string(),
|
|
1141
|
+
families: z.array(zTaxonomyFamilyNode).nullable()
|
|
1142
|
+
});
|
|
1143
|
+
/**
|
|
1144
|
+
* Visibility
|
|
1145
|
+
*
|
|
1146
|
+
* Access control level for a published transcript
|
|
1147
|
+
*/
|
|
1148
|
+
export const zVisibility = z.enum([
|
|
1149
|
+
'private',
|
|
1150
|
+
'group',
|
|
1151
|
+
'public'
|
|
1152
|
+
]);
|
|
1153
|
+
export const zPullTranscriptInfo = z.object({
|
|
1154
|
+
annotationCount: z.int(),
|
|
1155
|
+
contentHash: z.string().optional(),
|
|
1156
|
+
contractVersion: z.string().optional(),
|
|
1157
|
+
harness: zHarness.optional(),
|
|
1158
|
+
license: zLicense.optional(),
|
|
1159
|
+
localId: z.string().optional(),
|
|
1160
|
+
ownerUserId: z.string(),
|
|
1161
|
+
ownerUsername: z.string(),
|
|
1162
|
+
projectName: z.string().optional(),
|
|
1163
|
+
publishedAt: z.coerce.bigint().min(BigInt('-9223372036854775808'), { error: 'Invalid value: Expected int64 to be >= -9223372036854775808' }).max(BigInt('9223372036854775807'), { error: 'Invalid value: Expected int64 to be <= 9223372036854775807' }),
|
|
1164
|
+
title: z.string().optional(),
|
|
1165
|
+
transcriptId: zTranscriptID,
|
|
1166
|
+
updatedAt: z.coerce.bigint().min(BigInt('-9223372036854775808'), { error: 'Invalid value: Expected int64 to be >= -9223372036854775808' }).max(BigInt('9223372036854775807'), { error: 'Invalid value: Expected int64 to be <= 9223372036854775807' }),
|
|
1167
|
+
visibility: zVisibility
|
|
1168
|
+
});
|
|
1169
|
+
export const zPullListResponse = z.object({
|
|
1170
|
+
limit: z.int(),
|
|
1171
|
+
page: z.int(),
|
|
1172
|
+
total: z.int(),
|
|
1173
|
+
transcripts: z.array(zPullTranscriptInfo).nullable()
|
|
1174
|
+
});
|
|
1175
|
+
export const zWalkthroughStep = z.object({
|
|
1176
|
+
excerpt: z.string(),
|
|
1177
|
+
file: z.string(),
|
|
1178
|
+
line: z.int().nullish()
|
|
1179
|
+
});
|
|
1180
|
+
export const zWalkthroughTrail = z.object({
|
|
1181
|
+
date: z.string(),
|
|
1182
|
+
isCoherent: z.boolean(),
|
|
1183
|
+
sessionId: z.string(),
|
|
1184
|
+
steps: z.array(zWalkthroughStep).nullable(),
|
|
1185
|
+
title: z.string(),
|
|
1186
|
+
turnCount: z.int()
|
|
1187
|
+
});
|
|
1188
|
+
export const zFamiliarityPayload = z.object({
|
|
1189
|
+
familiarityPct: z.number(),
|
|
1190
|
+
files: z.array(zFileFamiliarity).nullable(),
|
|
1191
|
+
freshnessDays: z.int().nullable(),
|
|
1192
|
+
projectHash: zProjectHash,
|
|
1193
|
+
suggestions: z.array(zReviewSuggestion).nullable(),
|
|
1194
|
+
trails: z.array(zWalkthroughTrail).nullable(),
|
|
1195
|
+
unexploredCount: z.int()
|
|
1196
|
+
});
|