@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.
Files changed (37) hide show
  1. package/LICENSE +13 -0
  2. package/README.md +56 -0
  3. package/dist/fixtures/quality.d.ts +81 -0
  4. package/dist/fixtures/quality.js +36 -0
  5. package/dist/fixtures/timeline.d.ts +22 -0
  6. package/dist/fixtures/timeline.js +2 -0
  7. package/dist/fixtures.d.ts +2 -0
  8. package/dist/fixtures.js +2 -0
  9. package/dist/index.d.ts +8 -0
  10. package/dist/index.js +36 -0
  11. package/dist/internal/generated/contract/zod.gen.d.ts +2740 -0
  12. package/dist/internal/generated/contract/zod.gen.js +1196 -0
  13. package/dist/internal/generated/enums.gen.d.ts +318 -0
  14. package/dist/internal/generated/enums.gen.js +348 -0
  15. package/dist/internal/generated/local-api.d.ts +946 -0
  16. package/dist/internal/generated/local-api.js +1 -0
  17. package/dist/internal/generated/public-contract.gen.d.ts +2 -0
  18. package/dist/internal/generated/public-contract.gen.js +2 -0
  19. package/dist/internal/generated/quality-fixtures.gen.d.ts +2 -0
  20. package/dist/internal/generated/quality-fixtures.gen.js +367 -0
  21. package/dist/internal/generated/testcase.gen.d.ts +17 -0
  22. package/dist/internal/generated/testcase.gen.js +20 -0
  23. package/dist/internal/generated/timeline-fixtures.gen.d.ts +2 -0
  24. package/dist/internal/generated/timeline-fixtures.gen.js +542 -0
  25. package/dist/internal/generated/versions.gen.d.ts +4 -0
  26. package/dist/internal/generated/versions.gen.js +5 -0
  27. package/dist/internal/generated/village-api.d.ts +585 -0
  28. package/dist/internal/generated/village-api.js +1 -0
  29. package/dist/local-api.d.ts +4 -0
  30. package/dist/local-api.js +1 -0
  31. package/dist/testcase.d.ts +32 -0
  32. package/dist/testcase.js +144 -0
  33. package/dist/types.d.ts +2 -0
  34. package/dist/types.js +2 -0
  35. package/dist/village-api.d.ts +4 -0
  36. package/dist/village-api.js +1 -0
  37. package/package.json +71 -0
@@ -0,0 +1,585 @@
1
+ import type * as Schema from "../../index.js";
2
+ export interface paths {
3
+ "/api/v1/annotations/manifest": {
4
+ parameters: {
5
+ query?: never;
6
+ header?: never;
7
+ path?: never;
8
+ cookie?: never;
9
+ };
10
+ /** @description Return the set of annotation content-hashes the village holds for the authenticated owner (the server-authoritative skip-gate manifest), plus a deterministic digest over the sorted hash set for a no-op short-circuit. */
11
+ get: operations["getAnnotationManifest"];
12
+ put?: never;
13
+ post?: never;
14
+ delete?: never;
15
+ options?: never;
16
+ head?: never;
17
+ patch?: never;
18
+ trace?: never;
19
+ };
20
+ "/api/v1/auth/cli/exchange": {
21
+ parameters: {
22
+ query?: never;
23
+ header?: never;
24
+ path?: never;
25
+ cookie?: never;
26
+ };
27
+ get?: never;
28
+ put?: never;
29
+ /** @description Exchange an OAuth authorization code and state for API credentials. Called by the CLI's local callback server after receiving the browser redirect. */
30
+ post: operations["cliExchangeCode"];
31
+ delete?: never;
32
+ options?: never;
33
+ head?: never;
34
+ patch?: never;
35
+ trace?: never;
36
+ };
37
+ "/api/v1/auth/cli/login": {
38
+ parameters: {
39
+ query?: never;
40
+ header?: never;
41
+ path?: never;
42
+ cookie?: never;
43
+ };
44
+ /** @description Initiate CLI login via browser OAuth flow. The CLI opens this URL in the user's browser with a local callback port and CSRF state. After authentication, the village redirects the browser to the CLI's local callback server. */
45
+ get: operations["cliLogin"];
46
+ put?: never;
47
+ post?: never;
48
+ delete?: never;
49
+ options?: never;
50
+ head?: never;
51
+ patch?: never;
52
+ trace?: never;
53
+ };
54
+ "/api/v1/pull/transcripts": {
55
+ parameters: {
56
+ query?: never;
57
+ header?: never;
58
+ path?: never;
59
+ cookie?: never;
60
+ };
61
+ /** @description List transcripts the authenticated user may pull (own + group-shared; public excluded by the canPullTranscript policy). Offset pagination. */
62
+ get: operations["listPullableTranscripts"];
63
+ put?: never;
64
+ post?: never;
65
+ delete?: never;
66
+ options?: never;
67
+ head?: never;
68
+ patch?: never;
69
+ trace?: never;
70
+ };
71
+ "/api/v1/pull/transcripts/skip-gate": {
72
+ parameters: {
73
+ query?: never;
74
+ header?: never;
75
+ path?: never;
76
+ cookie?: never;
77
+ };
78
+ get?: never;
79
+ put?: never;
80
+ /** @description Batch currency check for a pulling client: per transcript it holds, send the id, the content-hash it holds, and its own annotation-hash set; receive per pullable id {contentCurrent, annotationsCurrent}. Non-pullable ids are withheld by omission from results. */
81
+ post: operations["pullSkipGate"];
82
+ delete?: never;
83
+ options?: never;
84
+ head?: never;
85
+ patch?: never;
86
+ trace?: never;
87
+ };
88
+ "/api/v1/pull/transcripts/{id}": {
89
+ parameters: {
90
+ query?: never;
91
+ header?: never;
92
+ path?: never;
93
+ cookie?: never;
94
+ };
95
+ /** @description Get a pullable transcript's metadata (owner, visibility, server-computed content_hash, push contract version). 404 (not 403) when not pullable. */
96
+ get: operations["getPullTranscript"];
97
+ put?: never;
98
+ post?: never;
99
+ delete?: never;
100
+ options?: never;
101
+ head?: never;
102
+ patch?: never;
103
+ trace?: never;
104
+ };
105
+ "/api/v1/pull/transcripts/{id}/annotations": {
106
+ parameters: {
107
+ query?: never;
108
+ header?: never;
109
+ path?: never;
110
+ cookie?: never;
111
+ };
112
+ /** @description List a transcript's annotations as PullAnnotation rows (AnnotationSummary plus author identity), so pulled annotations can be foreign-marked and own-authored rows excluded. */
113
+ get: operations["getPullTranscriptAnnotations"];
114
+ put?: never;
115
+ post?: never;
116
+ delete?: never;
117
+ options?: never;
118
+ head?: never;
119
+ patch?: never;
120
+ trace?: never;
121
+ };
122
+ "/api/v1/pull/transcripts/{id}/content": {
123
+ parameters: {
124
+ query?: never;
125
+ header?: never;
126
+ path?: never;
127
+ cookie?: never;
128
+ };
129
+ /** @description Stream the transcript blob as served. Sends ETag: "<content_hash>"; a matching If-None-Match request yields 304 Not Modified. */
130
+ get: operations["getPullTranscriptContent"];
131
+ put?: never;
132
+ post?: never;
133
+ delete?: never;
134
+ options?: never;
135
+ head?: never;
136
+ patch?: never;
137
+ trace?: never;
138
+ };
139
+ "/api/v1/schema/version": {
140
+ parameters: {
141
+ query?: never;
142
+ header?: never;
143
+ path?: never;
144
+ cookie?: never;
145
+ };
146
+ /** @description Advertise the annotation schema version plus the push and pull contract acceptance/negotiation windows ([Min, Current]) so the CLI can preflight and version-negotiate before publishing or pulling. */
147
+ get: operations["getSchemaVersion"];
148
+ put?: never;
149
+ post?: never;
150
+ delete?: never;
151
+ options?: never;
152
+ head?: never;
153
+ patch?: never;
154
+ trace?: never;
155
+ };
156
+ "/api/v1/transcripts/publish": {
157
+ parameters: {
158
+ query?: never;
159
+ header?: never;
160
+ path?: never;
161
+ cookie?: never;
162
+ };
163
+ get?: never;
164
+ put?: never;
165
+ /** @description Publish a transcript with session entries to the village. */
166
+ post: operations["publishTranscript"];
167
+ delete?: never;
168
+ options?: never;
169
+ head?: never;
170
+ patch?: never;
171
+ trace?: never;
172
+ };
173
+ }
174
+ export type webhooks = Record<string, never>;
175
+ export interface components {
176
+ schemas: {
177
+ /**
178
+ * Harness
179
+ * @description AI coding tool or development environment
180
+ * @example claude-code
181
+ * @example opencode
182
+ * @enum {string}
183
+ */
184
+ BestiaryHarness: Schema.Harness;
185
+ OpenapiTranscriptPublishRequest: {
186
+ diagnostics?: components["schemas"]["SchemaDiagnosticsInfo"];
187
+ entries?: components["schemas"]["SchemaSessionEntry"][];
188
+ git?: components["schemas"]["SchemaGitContext"];
189
+ identity?: components["schemas"]["SchemaSessionIdentity"];
190
+ license?: components["schemas"]["SchemaLicense"];
191
+ model: components["schemas"]["SchemaModelInfo"];
192
+ project?: components["schemas"]["SchemaProjectContext"];
193
+ quality?: components["schemas"]["SchemaQualityMetrics"];
194
+ source?: components["schemas"]["SchemaSourceInfo"];
195
+ stats?: components["schemas"]["SchemaSessionStats"];
196
+ subagents?: components["schemas"]["SchemaSubagentRef"][];
197
+ timestamp?: components["schemas"]["SchemaTimestampInfo"];
198
+ };
199
+ SchemaAnnotationManifestResponse: Schema.AnnotationManifestResponse;
200
+ /**
201
+ * Annotator Kind
202
+ * @description Type of entity that produced an annotation: human, agent (AI model), or rule (automated classifier)
203
+ * @example human
204
+ * @example agent
205
+ * @example rule
206
+ * @enum {string}
207
+ */
208
+ SchemaAnnotatorKind: Schema.AnnotatorKind;
209
+ SchemaCommitInfo: Schema.CommitInfo;
210
+ SchemaDiagnosticEntry: Schema.DiagnosticEntry;
211
+ SchemaDiagnosticsInfo: Schema.DiagnosticsInfo;
212
+ /**
213
+ * Entry Type
214
+ * @description Classification of a single entry within an agent session transcript
215
+ * @example text
216
+ * @example tool_use
217
+ * @example tool_result
218
+ * @enum {string}
219
+ */
220
+ SchemaEntryType: Schema.EntryType;
221
+ SchemaExchangeCodeRequest: Schema.ExchangeCodeRequest;
222
+ SchemaExchangeCodeResponse: Schema.ExchangeCodeResponse;
223
+ SchemaGitContext: Schema.GitContext;
224
+ /**
225
+ * Host Slug
226
+ * @description Sanitized, filesystem-safe identifier derived from git remote; contains only [a-zA-Z0-9._<>-]
227
+ * @example github.com--user--repo
228
+ * @example local--home-user-projects-myapp
229
+ */
230
+ SchemaHostSlug: Schema.HostSlug;
231
+ /**
232
+ * License
233
+ * @description Content license for a published transcript
234
+ * @example CC0-1.0
235
+ * @enum {string}
236
+ */
237
+ SchemaLicense: Schema.License;
238
+ /**
239
+ * Model ID
240
+ * @description Model identifier (e.g. 'claude-opus-4-6', 'gemini-2.0-flash')
241
+ * @example claude-opus-4-6
242
+ * @example gemini-2.0-flash
243
+ * @example codex-mini-latest
244
+ */
245
+ SchemaModelID: Schema.ModelID;
246
+ SchemaModelInfo: Schema.ModelInfo;
247
+ SchemaProjectContext: Schema.ProjectContext;
248
+ /**
249
+ * Project Hash
250
+ * @description SHA-256 hex digest of the project's origin URL or local path
251
+ * @example a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4e5f6a1b2
252
+ */
253
+ SchemaProjectHash: Schema.ProjectHash;
254
+ SchemaProvenance: Schema.Provenance;
255
+ SchemaPublishResponse: Schema.PublishResponse;
256
+ SchemaPullAnnotation: Schema.PullAnnotation;
257
+ SchemaPullListResponse: Schema.PullListResponse;
258
+ SchemaPullSkipGateItem: Schema.PullSkipGateItem;
259
+ SchemaPullSkipGateRequest: Schema.PullSkipGateRequest;
260
+ SchemaPullSkipGateResponse: Schema.PullSkipGateResponse;
261
+ SchemaPullSkipGateResult: Schema.PullSkipGateResult;
262
+ SchemaPullTranscriptInfo: Schema.PullTranscriptInfo;
263
+ SchemaQualityMetrics: Schema.QualityMetrics;
264
+ /**
265
+ * Role
266
+ * @description Sender role of a message turn
267
+ * @example user
268
+ * @example assistant
269
+ * @enum {string}
270
+ */
271
+ SchemaRole: Schema.Role;
272
+ SchemaSchemaVersionResponse: Schema.SchemaVersionResponse;
273
+ SchemaSessionEntry: Schema.SessionEntry;
274
+ /**
275
+ * Session ID
276
+ * Format: session-id
277
+ * @description Unique session identifier (UUID, agent-{hex}, ses_{id}, sess_{id} (ACP), or msg_{id})
278
+ * @example 99d59925-36bc-424c-a789-8be54d9702ba
279
+ * @example agent-a3aee4f
280
+ * @example ses_3cd91f52effeXd3QAJ54jOyzv5
281
+ * @example sess_3cd91f52effeXd3QAJ54jOyzv5
282
+ */
283
+ SchemaSessionID: Schema.SessionID;
284
+ SchemaSessionIdentity: Schema.SessionIdentity;
285
+ /**
286
+ * Session Outcome
287
+ * @description Resolution status of the session
288
+ * @example resolved
289
+ * @example partial
290
+ * @example failed
291
+ * @enum {string}
292
+ */
293
+ SchemaSessionOutcome: Schema.SessionOutcome;
294
+ SchemaSessionStats: Schema.SessionStats;
295
+ /**
296
+ * Source Format
297
+ * @description Transcript file format
298
+ * @example jsonl
299
+ * @example json
300
+ * @enum {string}
301
+ */
302
+ SchemaSourceFormat: Schema.SourceFormat;
303
+ SchemaSourceInfo: Schema.SourceInfo;
304
+ /**
305
+ * Stop Reason
306
+ * @description Reason why a session or turn ended (ACP-aligned)
307
+ * @example end_turn
308
+ * @example max_tokens
309
+ * @enum {string}
310
+ */
311
+ SchemaStopReason: Schema.StopReason;
312
+ SchemaSubagentRef: Schema.SubagentRef;
313
+ /**
314
+ * Target Kind
315
+ * @description What is being annotated: session-level, entry-level (turn/tool call), meta-annotation, or project-level
316
+ * @example session
317
+ * @example entry
318
+ * @enum {string}
319
+ */
320
+ SchemaTargetKind: Schema.TargetKind;
321
+ SchemaTimestampInfo: Schema.TimestampInfo;
322
+ /**
323
+ * Tool Call Kind
324
+ * @description Classification of a tool call, aligned with ACP ToolCallUpdate.kind
325
+ * @example read
326
+ * @example edit
327
+ * @example execute
328
+ * @enum {string}
329
+ */
330
+ SchemaToolCallKind: Schema.ToolCallKind;
331
+ /**
332
+ * Transcript ID
333
+ * Format: uuid
334
+ * @description Village-side transcript identifier (canonical lowercase-hex UUID)
335
+ * @example 99d59925-36bc-424c-a789-8be54d9702ba
336
+ */
337
+ SchemaTranscriptID: Schema.TranscriptID;
338
+ /**
339
+ * Visibility
340
+ * @description Access control level for a published transcript
341
+ * @example public
342
+ * @example private
343
+ * @enum {string}
344
+ */
345
+ SchemaVisibility: Schema.Visibility;
346
+ /**
347
+ * Visibility
348
+ * @description Access control level for a published transcript
349
+ * @example public
350
+ * @example private
351
+ * @enum {string}
352
+ */
353
+ Visibility: Schema.Visibility;
354
+ };
355
+ responses: never;
356
+ parameters: never;
357
+ requestBodies: never;
358
+ headers: never;
359
+ pathItems: never;
360
+ }
361
+ export type $defs = Record<string, never>;
362
+ export interface operations {
363
+ getAnnotationManifest: {
364
+ parameters: {
365
+ query?: never;
366
+ header?: never;
367
+ path?: never;
368
+ cookie?: never;
369
+ };
370
+ requestBody?: never;
371
+ responses: {
372
+ /** @description OK */
373
+ 200: {
374
+ headers: {
375
+ [name: string]: unknown;
376
+ };
377
+ content: {
378
+ "application/json": components["schemas"]["SchemaAnnotationManifestResponse"];
379
+ };
380
+ };
381
+ };
382
+ };
383
+ cliExchangeCode: {
384
+ parameters: {
385
+ query?: never;
386
+ header?: never;
387
+ path?: never;
388
+ cookie?: never;
389
+ };
390
+ requestBody?: {
391
+ content: {
392
+ "application/json": components["schemas"]["SchemaExchangeCodeRequest"];
393
+ };
394
+ };
395
+ responses: {
396
+ /** @description OK */
397
+ 200: {
398
+ headers: {
399
+ [name: string]: unknown;
400
+ };
401
+ content: {
402
+ "application/json": components["schemas"]["SchemaExchangeCodeResponse"];
403
+ };
404
+ };
405
+ };
406
+ };
407
+ cliLogin: {
408
+ parameters: {
409
+ query?: {
410
+ /** @description Local callback server port */
411
+ port?: number;
412
+ /** @description OAuth state parameter for CSRF protection */
413
+ state?: string;
414
+ };
415
+ header?: never;
416
+ path?: never;
417
+ cookie?: never;
418
+ };
419
+ requestBody?: never;
420
+ responses: {
421
+ /** @description No Content */
422
+ 204: {
423
+ headers: {
424
+ [name: string]: unknown;
425
+ };
426
+ content?: never;
427
+ };
428
+ };
429
+ };
430
+ listPullableTranscripts: {
431
+ parameters: {
432
+ query?: {
433
+ page?: number;
434
+ limit?: number;
435
+ };
436
+ header?: never;
437
+ path?: never;
438
+ cookie?: never;
439
+ };
440
+ requestBody?: never;
441
+ responses: {
442
+ /** @description OK */
443
+ 200: {
444
+ headers: {
445
+ [name: string]: unknown;
446
+ };
447
+ content: {
448
+ "application/json": components["schemas"]["SchemaPullListResponse"];
449
+ };
450
+ };
451
+ };
452
+ };
453
+ pullSkipGate: {
454
+ parameters: {
455
+ query?: never;
456
+ header?: never;
457
+ path?: never;
458
+ cookie?: never;
459
+ };
460
+ requestBody?: {
461
+ content: {
462
+ "application/json": components["schemas"]["SchemaPullSkipGateRequest"];
463
+ };
464
+ };
465
+ responses: {
466
+ /** @description OK */
467
+ 200: {
468
+ headers: {
469
+ [name: string]: unknown;
470
+ };
471
+ content: {
472
+ "application/json": components["schemas"]["SchemaPullSkipGateResponse"];
473
+ };
474
+ };
475
+ };
476
+ };
477
+ getPullTranscript: {
478
+ parameters: {
479
+ query?: never;
480
+ header?: never;
481
+ path: {
482
+ id: string;
483
+ };
484
+ cookie?: never;
485
+ };
486
+ requestBody?: never;
487
+ responses: {
488
+ /** @description OK */
489
+ 200: {
490
+ headers: {
491
+ [name: string]: unknown;
492
+ };
493
+ content: {
494
+ "application/json": components["schemas"]["SchemaPullTranscriptInfo"];
495
+ };
496
+ };
497
+ };
498
+ };
499
+ getPullTranscriptAnnotations: {
500
+ parameters: {
501
+ query?: never;
502
+ header?: never;
503
+ path: {
504
+ id: string;
505
+ };
506
+ cookie?: never;
507
+ };
508
+ requestBody?: never;
509
+ responses: {
510
+ /** @description OK */
511
+ 200: {
512
+ headers: {
513
+ [name: string]: unknown;
514
+ };
515
+ content: {
516
+ "application/json": null | components["schemas"]["SchemaPullAnnotation"][];
517
+ };
518
+ };
519
+ };
520
+ };
521
+ getPullTranscriptContent: {
522
+ parameters: {
523
+ query?: never;
524
+ header?: never;
525
+ path: {
526
+ id: string;
527
+ };
528
+ cookie?: never;
529
+ };
530
+ requestBody?: never;
531
+ responses: {
532
+ /** @description No Content */
533
+ 204: {
534
+ headers: {
535
+ [name: string]: unknown;
536
+ };
537
+ content?: never;
538
+ };
539
+ };
540
+ };
541
+ getSchemaVersion: {
542
+ parameters: {
543
+ query?: never;
544
+ header?: never;
545
+ path?: never;
546
+ cookie?: never;
547
+ };
548
+ requestBody?: never;
549
+ responses: {
550
+ /** @description OK */
551
+ 200: {
552
+ headers: {
553
+ [name: string]: unknown;
554
+ };
555
+ content: {
556
+ "application/json": components["schemas"]["SchemaSchemaVersionResponse"];
557
+ };
558
+ };
559
+ };
560
+ };
561
+ publishTranscript: {
562
+ parameters: {
563
+ query?: never;
564
+ header?: never;
565
+ path?: never;
566
+ cookie?: never;
567
+ };
568
+ requestBody?: {
569
+ content: {
570
+ "application/json": components["schemas"]["OpenapiTranscriptPublishRequest"];
571
+ };
572
+ };
573
+ responses: {
574
+ /** @description OK */
575
+ 200: {
576
+ headers: {
577
+ [name: string]: unknown;
578
+ };
579
+ content: {
580
+ "application/json": components["schemas"]["SchemaPublishResponse"];
581
+ };
582
+ };
583
+ };
584
+ };
585
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,4 @@
1
+ import type { operations as GeneratedOperations, paths as GeneratedPaths } from "./internal/generated/local-api.js";
2
+ export { PeasantLocalAPIVersion } from "./index.js";
3
+ export type paths = GeneratedPaths;
4
+ export type operations = GeneratedOperations;
@@ -0,0 +1 @@
1
+ export { PeasantLocalAPIVersion } from "./index.js";
@@ -0,0 +1,32 @@
1
+ import { Classification, AllClassifications, isClassification, ProvenanceSource, AllProvenanceSources, isProvenanceSource } from "./internal/generated/testcase.gen.js";
2
+ export { Classification, AllClassifications, isClassification, ProvenanceSource, AllProvenanceSources, isProvenanceSource };
3
+ export interface Provenance {
4
+ source: ProvenanceSource;
5
+ ref: string;
6
+ }
7
+ export interface Mutation {
8
+ description: string;
9
+ }
10
+ export interface Case<I, E> {
11
+ name: string;
12
+ input: I;
13
+ expected: E;
14
+ classification: Classification;
15
+ provenance: Provenance;
16
+ mutation: Mutation;
17
+ }
18
+ export interface Corpus<I, E> {
19
+ cases: Case<I, E>[];
20
+ }
21
+ export declare function checkMin<I, E>(corpus: Corpus<I, E>, minimum: number): Error | undefined;
22
+ export declare function validateCase<I, E>(testCase: Case<I, E>): Error | undefined;
23
+ export declare function validateCorpus<I, E>(corpus: Corpus<I, E>): Error | undefined;
24
+ export interface CorpusDecoders<I, E> {
25
+ decodeInput(value: unknown, path: string): I;
26
+ decodeExpected(value: unknown, path: string): E;
27
+ }
28
+ export declare class CorpusError extends Error {
29
+ readonly path: string;
30
+ constructor(path: string, message: string, options?: ErrorOptions);
31
+ }
32
+ export declare function loadCorpus<I, E>(source: string, decoders: CorpusDecoders<I, E>): Corpus<I, E>;