@app-vitals/agent-lib 0.16.2 → 1.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,3256 +0,0 @@
1
- /**
2
- * This file was auto-generated by openapi-typescript.
3
- * Do not make direct changes to the file.
4
- */
5
-
6
- export interface paths {
7
- "/tasks": {
8
- parameters: {
9
- query?: never;
10
- header?: never;
11
- path?: never;
12
- cookie?: never;
13
- };
14
- /**
15
- * List tasks
16
- * @description Returns `{ tasks, total, limit, offset, scopeDegraded }`. `?ready=true` (or `?state=ready`) is an unpaginated convenience endpoint that computes over the whole dependency graph and returns only tasks that are `pending`, non-HITL, non-autonomous-plan-session, free of a fresh same-branch in-progress sibling, and fully dependency-satisfied — always oldest-first. `?state=blocked` similarly walks the whole graph to compute each task's `blockedBy` entries. Agent tokens with repo scope see the OR union of tasks assigned to them and unassigned pool tasks in their scoped repos; agent tokens without repo scope see only their own assigned tasks; admin tokens see everything matching the filters.
17
- */
18
- get: {
19
- parameters: {
20
- query?: {
21
- status?: string;
22
- state?: "open" | "closed" | "in_progress" | "ready" | "blocked";
23
- source?: string;
24
- session?: string;
25
- repo?: string | string[];
26
- org?: string | string[];
27
- assignee?: string;
28
- claimedBy?: string;
29
- branch?: string;
30
- pr?: string;
31
- limit?: string;
32
- offset?: string;
33
- ready?: "true" | "false";
34
- hitl?: "true" | "false";
35
- kind?: "dev" | "prd";
36
- sort?: "asc" | "desc";
37
- updatedSince?: string;
38
- };
39
- header?: never;
40
- path?: never;
41
- cookie?: never;
42
- };
43
- requestBody?: never;
44
- responses: {
45
- /** @description List of tasks with total count */
46
- 200: {
47
- headers: {
48
- [name: string]: unknown;
49
- };
50
- content: {
51
- "application/json": components["schemas"]["TaskListResponse"];
52
- };
53
- };
54
- /** @description Unauthorized */
55
- 401: {
56
- headers: {
57
- [name: string]: unknown;
58
- };
59
- content: {
60
- "application/json": components["schemas"]["Error"];
61
- };
62
- };
63
- };
64
- };
65
- put?: never;
66
- /**
67
- * Create a task
68
- * @description Creates a single task. `title`, `status`, and `repo` are required — the `repo` key must be present, though `null` is a valid value for tasks not scoped to a specific repository. Agent tokens leave `assignee` as supplied by the caller, defaulting to `null` (unassigned/pool task) when omitted. Returns `201` with the created task; an existing `id` collision is not given dedicated handling and surfaces as an unhandled error rather than a clean `409` (use `POST /tasks/bulk` for collision-safe inserts).
69
- */
70
- post: {
71
- parameters: {
72
- query?: never;
73
- header?: never;
74
- path?: never;
75
- cookie?: never;
76
- };
77
- requestBody?: {
78
- content: {
79
- "application/json": components["schemas"]["CreateTaskBody"];
80
- };
81
- };
82
- responses: {
83
- /** @description Created task */
84
- 201: {
85
- headers: {
86
- [name: string]: unknown;
87
- };
88
- content: {
89
- "application/json": components["schemas"]["Task"];
90
- };
91
- };
92
- /** @description Bad request */
93
- 400: {
94
- headers: {
95
- [name: string]: unknown;
96
- };
97
- content: {
98
- "application/json": components["schemas"]["Error"];
99
- };
100
- };
101
- /** @description Unauthorized */
102
- 401: {
103
- headers: {
104
- [name: string]: unknown;
105
- };
106
- content: {
107
- "application/json": components["schemas"]["Error"];
108
- };
109
- };
110
- };
111
- };
112
- delete?: never;
113
- options?: never;
114
- head?: never;
115
- patch?: never;
116
- trace?: never;
117
- };
118
- "/tasks/bulk": {
119
- parameters: {
120
- query?: never;
121
- header?: never;
122
- path?: never;
123
- cookie?: never;
124
- };
125
- get?: never;
126
- put?: never;
127
- /**
128
- * Bulk insert tasks
129
- * @description Inserts the whole array in one transaction (TSW-1.3): a single task's id collision or a webhook delivery failure rolls back the entire batch, not just that task. At most 500 tasks per call — the transaction's budget scales with batch size, and this cap bounds it.
130
- */
131
- post: {
132
- parameters: {
133
- query?: never;
134
- header?: never;
135
- path?: never;
136
- cookie?: never;
137
- };
138
- requestBody?: {
139
- content: {
140
- "application/json": components["schemas"]["BulkInsertBody"];
141
- };
142
- };
143
- responses: {
144
- /** @description Bulk insert result */
145
- 200: {
146
- headers: {
147
- [name: string]: unknown;
148
- };
149
- content: {
150
- "application/json": components["schemas"]["BulkInsertResponse"];
151
- };
152
- };
153
- /** @description Bad request — malformed body, a missing repo key, or more than 500 tasks in one batch */
154
- 400: {
155
- headers: {
156
- [name: string]: unknown;
157
- };
158
- content: {
159
- "application/json": components["schemas"]["Error"];
160
- };
161
- };
162
- /** @description Unauthorized */
163
- 401: {
164
- headers: {
165
- [name: string]: unknown;
166
- };
167
- content: {
168
- "application/json": components["schemas"]["Error"];
169
- };
170
- };
171
- /** @description Conflict — a task id in the batch already exists; the entire batch was rolled back */
172
- 409: {
173
- headers: {
174
- [name: string]: unknown;
175
- };
176
- content: {
177
- "application/json": components["schemas"]["Error"];
178
- };
179
- };
180
- /** @description Webhook delivery failed; the entire batch was rolled back */
181
- 502: {
182
- headers: {
183
- [name: string]: unknown;
184
- };
185
- content: {
186
- "application/json": components["schemas"]["Error"];
187
- };
188
- };
189
- };
190
- };
191
- delete?: never;
192
- options?: never;
193
- head?: never;
194
- patch?: never;
195
- trace?: never;
196
- };
197
- "/tasks/distinct": {
198
- parameters: {
199
- query?: never;
200
- header?: never;
201
- path?: never;
202
- cookie?: never;
203
- };
204
- /**
205
- * Get distinct session and repo values
206
- * @description Returns distinct `sessions`, `repos` (`org/repo` strings), and `orgs` (the `org` prefix of each `repo`) across the caller's visible task set — useful for populating filter dropdowns in a UI.
207
- */
208
- get: {
209
- parameters: {
210
- query?: never;
211
- header?: never;
212
- path?: never;
213
- cookie?: never;
214
- };
215
- requestBody?: never;
216
- responses: {
217
- /** @description Distinct values */
218
- 200: {
219
- headers: {
220
- [name: string]: unknown;
221
- };
222
- content: {
223
- "application/json": components["schemas"]["DistinctResponse"];
224
- };
225
- };
226
- /** @description Unauthorized */
227
- 401: {
228
- headers: {
229
- [name: string]: unknown;
230
- };
231
- content: {
232
- "application/json": components["schemas"]["Error"];
233
- };
234
- };
235
- };
236
- };
237
- put?: never;
238
- post?: never;
239
- delete?: never;
240
- options?: never;
241
- head?: never;
242
- patch?: never;
243
- trace?: never;
244
- };
245
- "/tasks/{id}": {
246
- parameters: {
247
- query?: never;
248
- header?: never;
249
- path?: never;
250
- cookie?: never;
251
- };
252
- /**
253
- * Get a task by ID
254
- * @description Fetches a single task by its ID. Returns `404` if the task doesn't exist or is outside the calling agent token's ownership/repo scope.
255
- */
256
- get: {
257
- parameters: {
258
- query?: never;
259
- header?: never;
260
- path: {
261
- id: string;
262
- };
263
- cookie?: never;
264
- };
265
- requestBody?: never;
266
- responses: {
267
- /** @description Task */
268
- 200: {
269
- headers: {
270
- [name: string]: unknown;
271
- };
272
- content: {
273
- "application/json": components["schemas"]["Task"];
274
- };
275
- };
276
- /** @description Unauthorized */
277
- 401: {
278
- headers: {
279
- [name: string]: unknown;
280
- };
281
- content: {
282
- "application/json": components["schemas"]["Error"];
283
- };
284
- };
285
- /** @description Forbidden */
286
- 403: {
287
- headers: {
288
- [name: string]: unknown;
289
- };
290
- content: {
291
- "application/json": components["schemas"]["Error"];
292
- };
293
- };
294
- /** @description Not found */
295
- 404: {
296
- headers: {
297
- [name: string]: unknown;
298
- };
299
- content: {
300
- "application/json": components["schemas"]["Error"];
301
- };
302
- };
303
- };
304
- };
305
- put?: never;
306
- post?: never;
307
- /**
308
- * Delete a task
309
- * @description Deletes a task and its TaskEvent audit rows. Agent tokens can only delete tasks within their ownership/repo scope (by `assignee`, `claimedBy`, or a `repo` in the token's scoped repos). Returns `204` on success; this write does not fire a `task.write` webhook, since the deleted row can't be sent as the event payload.
310
- */
311
- delete: {
312
- parameters: {
313
- query?: never;
314
- header?: never;
315
- path: {
316
- id: string;
317
- };
318
- cookie?: never;
319
- };
320
- requestBody?: never;
321
- responses: {
322
- /** @description Deleted */
323
- 204: {
324
- headers: {
325
- [name: string]: unknown;
326
- };
327
- content?: never;
328
- };
329
- /** @description Unauthorized */
330
- 401: {
331
- headers: {
332
- [name: string]: unknown;
333
- };
334
- content: {
335
- "application/json": components["schemas"]["Error"];
336
- };
337
- };
338
- /** @description Forbidden */
339
- 403: {
340
- headers: {
341
- [name: string]: unknown;
342
- };
343
- content: {
344
- "application/json": components["schemas"]["Error"];
345
- };
346
- };
347
- /** @description Not found */
348
- 404: {
349
- headers: {
350
- [name: string]: unknown;
351
- };
352
- content: {
353
- "application/json": components["schemas"]["Error"];
354
- };
355
- };
356
- };
357
- };
358
- options?: never;
359
- head?: never;
360
- /**
361
- * Update a task
362
- * @description Applies partial task fields. Agent tokens can only update tasks within their ownership/repo scope (by `assignee`, `claimedBy`, or a `repo` in the token's scoped repos) and cannot set `claimedBy`, `claimedAt`, `heartbeatAt`, or `status: 'pending'` via this route — those are managed exclusively by `/claim` and `/release` so a generic PATCH can never bypass the atomic claim protocol. Admin tokens may set any field. A common use is setting `status: 'blocked'` alongside `blockedReason` when an agent hits an unrecoverable dead end.
363
- */
364
- patch: {
365
- parameters: {
366
- query?: never;
367
- header?: never;
368
- path: {
369
- id: string;
370
- };
371
- cookie?: never;
372
- };
373
- requestBody?: {
374
- content: {
375
- "application/json": components["schemas"]["UpdateTaskBody"];
376
- };
377
- };
378
- responses: {
379
- /** @description Updated task */
380
- 200: {
381
- headers: {
382
- [name: string]: unknown;
383
- };
384
- content: {
385
- "application/json": components["schemas"]["Task"];
386
- };
387
- };
388
- /** @description Bad request */
389
- 400: {
390
- headers: {
391
- [name: string]: unknown;
392
- };
393
- content: {
394
- "application/json": components["schemas"]["Error"];
395
- };
396
- };
397
- /** @description Unauthorized */
398
- 401: {
399
- headers: {
400
- [name: string]: unknown;
401
- };
402
- content: {
403
- "application/json": components["schemas"]["Error"];
404
- };
405
- };
406
- /** @description Forbidden */
407
- 403: {
408
- headers: {
409
- [name: string]: unknown;
410
- };
411
- content: {
412
- "application/json": components["schemas"]["Error"];
413
- };
414
- };
415
- /** @description Not found */
416
- 404: {
417
- headers: {
418
- [name: string]: unknown;
419
- };
420
- content: {
421
- "application/json": components["schemas"]["Error"];
422
- };
423
- };
424
- };
425
- };
426
- trace?: never;
427
- };
428
- "/tasks/{id}/claim": {
429
- parameters: {
430
- query?: never;
431
- header?: never;
432
- path?: never;
433
- cookie?: never;
434
- };
435
- get?: never;
436
- put?: never;
437
- /**
438
- * Atomically claim a task
439
- * @description Atomically claims a pending task via a single conditional `UPDATE ... WHERE status='pending' AND "claimedBy" IS NULL`, setting `status=in_progress`, `claimedBy`, `claimedAt`, `heartbeatAt`, and `startedAt` (or keeping it if already set) in one round-trip. Agent tokens send no body — the service pins `claimedBy` to the calling agent's ID server-side; admin tokens must supply `{ claimedBy: string }`. Returns `200` with the claimed task, or `409` if the task is already claimed or not in `pending` status. A DB-level CHECK constraint independently enforces that a row can never have `status='pending'` with a non-null `claimedBy` simultaneously, as defense-in-depth against any write path — including manual admin PATCHes — that might otherwise leave a task claimed-yet-pending.
440
- */
441
- post: {
442
- parameters: {
443
- query?: never;
444
- header?: never;
445
- path: {
446
- id: string;
447
- };
448
- cookie?: never;
449
- };
450
- requestBody?: {
451
- content: {
452
- "application/json": components["schemas"]["ClaimBody"];
453
- };
454
- };
455
- responses: {
456
- /** @description Claimed task */
457
- 200: {
458
- headers: {
459
- [name: string]: unknown;
460
- };
461
- content: {
462
- "application/json": components["schemas"]["Task"];
463
- };
464
- };
465
- /** @description Bad request */
466
- 400: {
467
- headers: {
468
- [name: string]: unknown;
469
- };
470
- content: {
471
- "application/json": components["schemas"]["Error"];
472
- };
473
- };
474
- /** @description Unauthorized */
475
- 401: {
476
- headers: {
477
- [name: string]: unknown;
478
- };
479
- content: {
480
- "application/json": components["schemas"]["Error"];
481
- };
482
- };
483
- /** @description Forbidden */
484
- 403: {
485
- headers: {
486
- [name: string]: unknown;
487
- };
488
- content: {
489
- "application/json": components["schemas"]["Error"];
490
- };
491
- };
492
- /** @description Not found */
493
- 404: {
494
- headers: {
495
- [name: string]: unknown;
496
- };
497
- content: {
498
- "application/json": components["schemas"]["Error"];
499
- };
500
- };
501
- /** @description Conflict — already claimed */
502
- 409: {
503
- headers: {
504
- [name: string]: unknown;
505
- };
506
- content: {
507
- "application/json": components["schemas"]["Error"];
508
- };
509
- };
510
- };
511
- };
512
- delete?: never;
513
- options?: never;
514
- head?: never;
515
- patch?: never;
516
- trace?: never;
517
- };
518
- "/tasks/{id}/heartbeat": {
519
- parameters: {
520
- query?: never;
521
- header?: never;
522
- path?: never;
523
- cookie?: never;
524
- };
525
- get?: never;
526
- put?: never;
527
- /**
528
- * Touch heartbeatAt on a claimed task
529
- * @description Updates `heartbeatAt` to now. Agents call this periodically to renew a claim before any long-running operation (dispatching a subagent, waiting on CI) so the stale-claim reaper doesn't reclaim the task mid-pipeline. This write is deliberately excluded from both the `task.write` webhook and the TaskEvent audit trail — it's the highest-volume write path in the service and a heartbeat-only change isn't an audit-worthy event.
530
- */
531
- post: {
532
- parameters: {
533
- query?: never;
534
- header?: never;
535
- path: {
536
- id: string;
537
- };
538
- cookie?: never;
539
- };
540
- requestBody?: never;
541
- responses: {
542
- /** @description Updated task */
543
- 200: {
544
- headers: {
545
- [name: string]: unknown;
546
- };
547
- content: {
548
- "application/json": components["schemas"]["Task"];
549
- };
550
- };
551
- /** @description Unauthorized */
552
- 401: {
553
- headers: {
554
- [name: string]: unknown;
555
- };
556
- content: {
557
- "application/json": components["schemas"]["Error"];
558
- };
559
- };
560
- /** @description Forbidden */
561
- 403: {
562
- headers: {
563
- [name: string]: unknown;
564
- };
565
- content: {
566
- "application/json": components["schemas"]["Error"];
567
- };
568
- };
569
- /** @description Not found */
570
- 404: {
571
- headers: {
572
- [name: string]: unknown;
573
- };
574
- content: {
575
- "application/json": components["schemas"]["Error"];
576
- };
577
- };
578
- };
579
- };
580
- delete?: never;
581
- options?: never;
582
- head?: never;
583
- patch?: never;
584
- trace?: never;
585
- };
586
- "/tasks/{id}/complete": {
587
- parameters: {
588
- query?: never;
589
- header?: never;
590
- path?: never;
591
- cookie?: never;
592
- };
593
- get?: never;
594
- put?: never;
595
- /**
596
- * Mark a task as done
597
- * @description Sets `status=done` and `completedAt` to now, ending the task's lifecycle successfully.
598
- */
599
- post: {
600
- parameters: {
601
- query?: never;
602
- header?: never;
603
- path: {
604
- id: string;
605
- };
606
- cookie?: never;
607
- };
608
- requestBody?: never;
609
- responses: {
610
- /** @description Updated task */
611
- 200: {
612
- headers: {
613
- [name: string]: unknown;
614
- };
615
- content: {
616
- "application/json": components["schemas"]["Task"];
617
- };
618
- };
619
- /** @description Unauthorized */
620
- 401: {
621
- headers: {
622
- [name: string]: unknown;
623
- };
624
- content: {
625
- "application/json": components["schemas"]["Error"];
626
- };
627
- };
628
- /** @description Forbidden */
629
- 403: {
630
- headers: {
631
- [name: string]: unknown;
632
- };
633
- content: {
634
- "application/json": components["schemas"]["Error"];
635
- };
636
- };
637
- /** @description Not found */
638
- 404: {
639
- headers: {
640
- [name: string]: unknown;
641
- };
642
- content: {
643
- "application/json": components["schemas"]["Error"];
644
- };
645
- };
646
- };
647
- };
648
- delete?: never;
649
- options?: never;
650
- head?: never;
651
- patch?: never;
652
- trace?: never;
653
- };
654
- "/tasks/{id}/fail": {
655
- parameters: {
656
- query?: never;
657
- header?: never;
658
- path?: never;
659
- cookie?: never;
660
- };
661
- get?: never;
662
- put?: never;
663
- /**
664
- * Mark a task as blocked
665
- * @description Sets `status=blocked`, pausing the task (it returns to `pending` on retry). Optional body `{ reason: string }` records why.
666
- */
667
- post: {
668
- parameters: {
669
- query?: never;
670
- header?: never;
671
- path: {
672
- id: string;
673
- };
674
- cookie?: never;
675
- };
676
- requestBody?: {
677
- content: {
678
- "application/json": components["schemas"]["FailBody"];
679
- };
680
- };
681
- responses: {
682
- /** @description Updated task */
683
- 200: {
684
- headers: {
685
- [name: string]: unknown;
686
- };
687
- content: {
688
- "application/json": components["schemas"]["Task"];
689
- };
690
- };
691
- /** @description Unauthorized */
692
- 401: {
693
- headers: {
694
- [name: string]: unknown;
695
- };
696
- content: {
697
- "application/json": components["schemas"]["Error"];
698
- };
699
- };
700
- /** @description Forbidden */
701
- 403: {
702
- headers: {
703
- [name: string]: unknown;
704
- };
705
- content: {
706
- "application/json": components["schemas"]["Error"];
707
- };
708
- };
709
- /** @description Not found */
710
- 404: {
711
- headers: {
712
- [name: string]: unknown;
713
- };
714
- content: {
715
- "application/json": components["schemas"]["Error"];
716
- };
717
- };
718
- };
719
- };
720
- delete?: never;
721
- options?: never;
722
- head?: never;
723
- patch?: never;
724
- trace?: never;
725
- };
726
- "/tasks/{id}/release": {
727
- parameters: {
728
- query?: never;
729
- header?: never;
730
- path?: never;
731
- cookie?: never;
732
- };
733
- get?: never;
734
- put?: never;
735
- /**
736
- * Release a task back to pending
737
- * @description Clears `claimedBy`, `claimedAt`, and `heartbeatAt`, and resets `status=pending`. Use when an agent stops work without completing or failing, so the task becomes claimable again.
738
- */
739
- post: {
740
- parameters: {
741
- query?: never;
742
- header?: never;
743
- path: {
744
- id: string;
745
- };
746
- cookie?: never;
747
- };
748
- requestBody?: never;
749
- responses: {
750
- /** @description Updated task */
751
- 200: {
752
- headers: {
753
- [name: string]: unknown;
754
- };
755
- content: {
756
- "application/json": components["schemas"]["Task"];
757
- };
758
- };
759
- /** @description Unauthorized */
760
- 401: {
761
- headers: {
762
- [name: string]: unknown;
763
- };
764
- content: {
765
- "application/json": components["schemas"]["Error"];
766
- };
767
- };
768
- /** @description Forbidden */
769
- 403: {
770
- headers: {
771
- [name: string]: unknown;
772
- };
773
- content: {
774
- "application/json": components["schemas"]["Error"];
775
- };
776
- };
777
- /** @description Not found */
778
- 404: {
779
- headers: {
780
- [name: string]: unknown;
781
- };
782
- content: {
783
- "application/json": components["schemas"]["Error"];
784
- };
785
- };
786
- };
787
- };
788
- delete?: never;
789
- options?: never;
790
- head?: never;
791
- patch?: never;
792
- trace?: never;
793
- };
794
- "/tasks/{id}/skip": {
795
- parameters: {
796
- query?: never;
797
- header?: never;
798
- path?: never;
799
- cookie?: never;
800
- };
801
- get?: never;
802
- put?: never;
803
- /**
804
- * Record a skip — increments skipCount, auto-blocks at threshold
805
- * @description Increments `skipCount` and updates `lastSkippedAt` to now. Called by orchestrators when a task is repeatedly re-selected but produces no visible outcome ([silent] dispatch). When `skipCount` crosses the threshold (3, `SPIN_DETECTION_THRESHOLD`), the task is auto-set to `status=blocked` with `blockedReason="Auto-blocked after {skipCount} consecutive skips (dispatched but found nothing to do)"` to halt further dispatches.
806
- */
807
- post: {
808
- parameters: {
809
- query?: never;
810
- header?: never;
811
- path: {
812
- id: string;
813
- };
814
- cookie?: never;
815
- };
816
- requestBody?: never;
817
- responses: {
818
- /** @description Updated task */
819
- 200: {
820
- headers: {
821
- [name: string]: unknown;
822
- };
823
- content: {
824
- "application/json": components["schemas"]["Task"];
825
- };
826
- };
827
- /** @description Unauthorized */
828
- 401: {
829
- headers: {
830
- [name: string]: unknown;
831
- };
832
- content: {
833
- "application/json": components["schemas"]["Error"];
834
- };
835
- };
836
- /** @description Forbidden */
837
- 403: {
838
- headers: {
839
- [name: string]: unknown;
840
- };
841
- content: {
842
- "application/json": components["schemas"]["Error"];
843
- };
844
- };
845
- /** @description Not found */
846
- 404: {
847
- headers: {
848
- [name: string]: unknown;
849
- };
850
- content: {
851
- "application/json": components["schemas"]["Error"];
852
- };
853
- };
854
- };
855
- };
856
- delete?: never;
857
- options?: never;
858
- head?: never;
859
- patch?: never;
860
- trace?: never;
861
- };
862
- "/tasks/{id}/skip/reset": {
863
- parameters: {
864
- query?: never;
865
- header?: never;
866
- path?: never;
867
- cookie?: never;
868
- };
869
- get?: never;
870
- put?: never;
871
- /**
872
- * Reset skip tracking — skipCount back to 0
873
- * @description Resets `skipCount` back to 0 and clears `lastSkippedAt`. Called after a human reviews and unblocks a task that was auto-blocked by the skip threshold.
874
- */
875
- post: {
876
- parameters: {
877
- query?: never;
878
- header?: never;
879
- path: {
880
- id: string;
881
- };
882
- cookie?: never;
883
- };
884
- requestBody?: never;
885
- responses: {
886
- /** @description Updated task */
887
- 200: {
888
- headers: {
889
- [name: string]: unknown;
890
- };
891
- content: {
892
- "application/json": components["schemas"]["Task"];
893
- };
894
- };
895
- /** @description Unauthorized */
896
- 401: {
897
- headers: {
898
- [name: string]: unknown;
899
- };
900
- content: {
901
- "application/json": components["schemas"]["Error"];
902
- };
903
- };
904
- /** @description Forbidden */
905
- 403: {
906
- headers: {
907
- [name: string]: unknown;
908
- };
909
- content: {
910
- "application/json": components["schemas"]["Error"];
911
- };
912
- };
913
- /** @description Not found */
914
- 404: {
915
- headers: {
916
- [name: string]: unknown;
917
- };
918
- content: {
919
- "application/json": components["schemas"]["Error"];
920
- };
921
- };
922
- };
923
- };
924
- delete?: never;
925
- options?: never;
926
- head?: never;
927
- patch?: never;
928
- trace?: never;
929
- };
930
- "/tasks/{id}/unblock": {
931
- parameters: {
932
- query?: never;
933
- header?: never;
934
- path?: never;
935
- cookie?: never;
936
- };
937
- get?: never;
938
- put?: never;
939
- /**
940
- * Atomically unblock a task back to pending
941
- * @description Atomically unblocks a task via a single conditional `UPDATE ... WHERE status='blocked'`, setting `status=pending` and clearing `blockedReason`, `blockedAt`, `claimedBy`, `claimedAt`, and `heartbeatAt`, and resetting `skipCount` to `0` and `lastSkippedAt` to `null` — all in one round-trip. Returns `409` if the task is not currently in `blocked` status (never a silent no-op, unlike `/release` on a non-`in_progress` task).
942
- */
943
- post: {
944
- parameters: {
945
- query?: never;
946
- header?: never;
947
- path: {
948
- id: string;
949
- };
950
- cookie?: never;
951
- };
952
- requestBody?: never;
953
- responses: {
954
- /** @description Unblocked task */
955
- 200: {
956
- headers: {
957
- [name: string]: unknown;
958
- };
959
- content: {
960
- "application/json": components["schemas"]["Task"];
961
- };
962
- };
963
- /** @description Unauthorized */
964
- 401: {
965
- headers: {
966
- [name: string]: unknown;
967
- };
968
- content: {
969
- "application/json": components["schemas"]["Error"];
970
- };
971
- };
972
- /** @description Forbidden */
973
- 403: {
974
- headers: {
975
- [name: string]: unknown;
976
- };
977
- content: {
978
- "application/json": components["schemas"]["Error"];
979
- };
980
- };
981
- /** @description Not found */
982
- 404: {
983
- headers: {
984
- [name: string]: unknown;
985
- };
986
- content: {
987
- "application/json": components["schemas"]["Error"];
988
- };
989
- };
990
- /** @description Conflict — task is not currently blocked */
991
- 409: {
992
- headers: {
993
- [name: string]: unknown;
994
- };
995
- content: {
996
- "application/json": components["schemas"]["Error"];
997
- };
998
- };
999
- };
1000
- };
1001
- delete?: never;
1002
- options?: never;
1003
- head?: never;
1004
- patch?: never;
1005
- trace?: never;
1006
- };
1007
- "/tasks/{id}/events": {
1008
- parameters: {
1009
- query?: never;
1010
- header?: never;
1011
- path?: never;
1012
- cookie?: never;
1013
- };
1014
- /**
1015
- * Fetch a task's TaskEvent audit trail, ordered by `at` ascending (oldest first)
1016
- * @description Returns `{ events, total, limit, offset }` — the task's append-only `TaskEvent` rows recording field-level state transitions, oldest first. `total` counts all events regardless of `limit`/`offset` (default `limit=50`, `offset=0`). Returns `404` if the task doesn't exist or is outside the caller's scope.
1017
- */
1018
- get: {
1019
- parameters: {
1020
- query?: {
1021
- limit?: string;
1022
- offset?: string;
1023
- };
1024
- header?: never;
1025
- path: {
1026
- id: string;
1027
- };
1028
- cookie?: never;
1029
- };
1030
- requestBody?: never;
1031
- responses: {
1032
- /** @description Task's event history */
1033
- 200: {
1034
- headers: {
1035
- [name: string]: unknown;
1036
- };
1037
- content: {
1038
- "application/json": components["schemas"]["TaskEventsResponse"];
1039
- };
1040
- };
1041
- /** @description Unauthorized */
1042
- 401: {
1043
- headers: {
1044
- [name: string]: unknown;
1045
- };
1046
- content: {
1047
- "application/json": components["schemas"]["Error"];
1048
- };
1049
- };
1050
- /** @description Forbidden */
1051
- 403: {
1052
- headers: {
1053
- [name: string]: unknown;
1054
- };
1055
- content: {
1056
- "application/json": components["schemas"]["Error"];
1057
- };
1058
- };
1059
- /** @description Not found */
1060
- 404: {
1061
- headers: {
1062
- [name: string]: unknown;
1063
- };
1064
- content: {
1065
- "application/json": components["schemas"]["Error"];
1066
- };
1067
- };
1068
- };
1069
- };
1070
- put?: never;
1071
- post?: never;
1072
- delete?: never;
1073
- options?: never;
1074
- head?: never;
1075
- patch?: never;
1076
- trace?: never;
1077
- };
1078
- "/tokens": {
1079
- parameters: {
1080
- query?: never;
1081
- header?: never;
1082
- path?: never;
1083
- cookie?: never;
1084
- };
1085
- /**
1086
- * List all tokens
1087
- * @description Admin-only. Returns token metadata (hash, label, agentId) for every token — raw token values are never returned once past creation.
1088
- */
1089
- get: {
1090
- parameters: {
1091
- query?: never;
1092
- header?: never;
1093
- path?: never;
1094
- cookie?: never;
1095
- };
1096
- requestBody?: never;
1097
- responses: {
1098
- /** @description Array of token metadata */
1099
- 200: {
1100
- headers: {
1101
- [name: string]: unknown;
1102
- };
1103
- content: {
1104
- "application/json": components["schemas"]["TaskToken"][];
1105
- };
1106
- };
1107
- /** @description Forbidden — admin token required */
1108
- 403: {
1109
- headers: {
1110
- [name: string]: unknown;
1111
- };
1112
- content: {
1113
- "application/json": components["schemas"]["Error"];
1114
- };
1115
- };
1116
- };
1117
- };
1118
- put?: never;
1119
- /**
1120
- * Create a new token — raw value returned exactly once
1121
- * @description Admin-only. Body is optional: `{ label?, agentId? }`. Omitting `agentId` creates an unrestricted admin token; supplying it creates an agent-scoped token. Only the token's SHA-256 hash is persisted — the raw value is included in this response and never retrievable again.
1122
- */
1123
- post: {
1124
- parameters: {
1125
- query?: never;
1126
- header?: never;
1127
- path?: never;
1128
- cookie?: never;
1129
- };
1130
- requestBody?: {
1131
- content: {
1132
- "application/json": components["schemas"]["TokenBody"];
1133
- };
1134
- };
1135
- responses: {
1136
- /** @description Created token including the one-time raw value */
1137
- 201: {
1138
- headers: {
1139
- [name: string]: unknown;
1140
- };
1141
- content: {
1142
- "application/json": components["schemas"]["TaskTokenWithRaw"];
1143
- };
1144
- };
1145
- /** @description Forbidden — admin token required */
1146
- 403: {
1147
- headers: {
1148
- [name: string]: unknown;
1149
- };
1150
- content: {
1151
- "application/json": components["schemas"]["Error"];
1152
- };
1153
- };
1154
- };
1155
- };
1156
- delete?: never;
1157
- options?: never;
1158
- head?: never;
1159
- patch?: never;
1160
- trace?: never;
1161
- };
1162
- "/tokens/{id}": {
1163
- parameters: {
1164
- query?: never;
1165
- header?: never;
1166
- path?: never;
1167
- cookie?: never;
1168
- };
1169
- get?: never;
1170
- put?: never;
1171
- post?: never;
1172
- /**
1173
- * Revoke a token
1174
- * @description Admin-only. Soft-deletes the token by setting `revokedAt` — the record is not removed, so its history stays intact, but the raw token stops authenticating requests.
1175
- */
1176
- delete: {
1177
- parameters: {
1178
- query?: never;
1179
- header?: never;
1180
- path: {
1181
- id: string;
1182
- };
1183
- cookie?: never;
1184
- };
1185
- requestBody?: never;
1186
- responses: {
1187
- /** @description Revoked token metadata */
1188
- 200: {
1189
- headers: {
1190
- [name: string]: unknown;
1191
- };
1192
- content: {
1193
- "application/json": components["schemas"]["TaskToken"];
1194
- };
1195
- };
1196
- /** @description Forbidden — admin token required */
1197
- 403: {
1198
- headers: {
1199
- [name: string]: unknown;
1200
- };
1201
- content: {
1202
- "application/json": components["schemas"]["Error"];
1203
- };
1204
- };
1205
- /** @description Token not found */
1206
- 404: {
1207
- headers: {
1208
- [name: string]: unknown;
1209
- };
1210
- content: {
1211
- "application/json": components["schemas"]["Error"];
1212
- };
1213
- };
1214
- };
1215
- };
1216
- options?: never;
1217
- head?: never;
1218
- /**
1219
- * Update token label and/or agentId
1220
- * @description Admin-only. Body: `{ label?, agentId? }`. Returns `400` if the target token has already been revoked.
1221
- */
1222
- patch: {
1223
- parameters: {
1224
- query?: never;
1225
- header?: never;
1226
- path: {
1227
- id: string;
1228
- };
1229
- cookie?: never;
1230
- };
1231
- requestBody?: {
1232
- content: {
1233
- "application/json": components["schemas"]["TokenBody"];
1234
- };
1235
- };
1236
- responses: {
1237
- /** @description Updated token metadata */
1238
- 200: {
1239
- headers: {
1240
- [name: string]: unknown;
1241
- };
1242
- content: {
1243
- "application/json": components["schemas"]["TaskToken"];
1244
- };
1245
- };
1246
- /** @description Bad request — token is revoked */
1247
- 400: {
1248
- headers: {
1249
- [name: string]: unknown;
1250
- };
1251
- content: {
1252
- "application/json": components["schemas"]["Error"];
1253
- };
1254
- };
1255
- /** @description Forbidden — admin token required */
1256
- 403: {
1257
- headers: {
1258
- [name: string]: unknown;
1259
- };
1260
- content: {
1261
- "application/json": components["schemas"]["Error"];
1262
- };
1263
- };
1264
- /** @description Token not found */
1265
- 404: {
1266
- headers: {
1267
- [name: string]: unknown;
1268
- };
1269
- content: {
1270
- "application/json": components["schemas"]["Error"];
1271
- };
1272
- };
1273
- };
1274
- };
1275
- trace?: never;
1276
- };
1277
- "/prs": {
1278
- parameters: {
1279
- query?: never;
1280
- header?: never;
1281
- path?: never;
1282
- cookie?: never;
1283
- };
1284
- /**
1285
- * List pull requests
1286
- * @description Returns `{ prs, total, limit, offset }`. `?ready=true` returns only unclaimed PRs (`claimedBy IS NULL`); `?blocked=true` returns PRs where `pr.blocked===true` OR a linked task has `status='blocked'` (resolved live via `(Task.repo, Task.pr)`, so a PR shared by several bundled tasks is blocked if any one of them is). `repo`/`org` are repeatable query params combined via AND; `sort` orders by `createdAt` (`asc` default).
1287
- */
1288
- get: {
1289
- parameters: {
1290
- query?: {
1291
- repo?: string | string[];
1292
- org?: string | string[];
1293
- prNumber?: string;
1294
- state?: "open" | "merged" | "closed";
1295
- reviewState?: "pending" | "in_progress" | "posted" | "approved";
1296
- staged?: "true" | "false";
1297
- limit?: string;
1298
- offset?: string;
1299
- ready?: "true" | "false";
1300
- blocked?: "true" | "false";
1301
- sort?: "asc" | "desc";
1302
- updatedSince?: string;
1303
- origin?: string;
1304
- };
1305
- header?: never;
1306
- path?: never;
1307
- cookie?: never;
1308
- };
1309
- requestBody?: never;
1310
- responses: {
1311
- /** @description List of pull requests */
1312
- 200: {
1313
- headers: {
1314
- [name: string]: unknown;
1315
- };
1316
- content: {
1317
- "application/json": components["schemas"]["PrListResponse"];
1318
- };
1319
- };
1320
- };
1321
- };
1322
- put?: never;
1323
- post?: never;
1324
- delete?: never;
1325
- options?: never;
1326
- head?: never;
1327
- patch?: never;
1328
- trace?: never;
1329
- };
1330
- "/prs/claim": {
1331
- parameters: {
1332
- query?: never;
1333
- header?: never;
1334
- path?: never;
1335
- cookie?: never;
1336
- };
1337
- get?: never;
1338
- put?: never;
1339
- /**
1340
- * Claim a pull request (atomic)
1341
- * @description Atomic via Postgres row locking, keyed on `(repo, prNumber)`. No existing record creates and returns `201` (a concurrent INSERT loser hits the `@@unique([repo, prNumber])` constraint and gets `409`). Against an existing record, the conflict conditions are re-checked inside the UPDATE's own WHERE clause so only one writer can win: same `commitSha` + same `phase` + already claimed by another agent returns `409` (phase locked); already claimed + same `commitSha` + `reviewState !== pending` (review phase only) returns `409` (already reviewed at this commit); otherwise the row is updated and `200` returned (new cycle). Agent tokens pin `claimedBy` to their own ID; admin tokens supply it in the body. Optional `phase` (default `review`) sets the pipeline phase — `patch`/`deploy` phases preserve `reviewState` as-is rather than resetting it. Optional `authorLogin`/`headRef`/`title` (POM-1.2) are forwarded server-side into an atomic origin-stamping write: a linked Task row (matching `repo`+`pr`) always derives `origin='shipwright'`; otherwise `authorLogin`/`headRef` are pattern-matched against known CI/dependency-bot signals, falling back to `human`/`unknown`. Origin is first-write-wins (never overwritten once set); `authorLogin`/`headRef`/`title` are refreshed to the latest value on every claim.
1342
- */
1343
- post: {
1344
- parameters: {
1345
- query?: never;
1346
- header?: never;
1347
- path?: never;
1348
- cookie?: never;
1349
- };
1350
- requestBody: {
1351
- content: {
1352
- "application/json": components["schemas"]["ClaimPrBody"];
1353
- };
1354
- };
1355
- responses: {
1356
- /** @description Updated existing claim */
1357
- 200: {
1358
- headers: {
1359
- [name: string]: unknown;
1360
- };
1361
- content: {
1362
- "application/json": components["schemas"]["PullRequest"];
1363
- };
1364
- };
1365
- /** @description New claim created */
1366
- 201: {
1367
- headers: {
1368
- [name: string]: unknown;
1369
- };
1370
- content: {
1371
- "application/json": components["schemas"]["PullRequest"];
1372
- };
1373
- };
1374
- /** @description Bad request */
1375
- 400: {
1376
- headers: {
1377
- [name: string]: unknown;
1378
- };
1379
- content: {
1380
- "application/json": components["schemas"]["Error"];
1381
- };
1382
- };
1383
- /** @description Conflict — already claimed with same commitSha */
1384
- 409: {
1385
- headers: {
1386
- [name: string]: unknown;
1387
- };
1388
- content: {
1389
- "application/json": components["schemas"]["Error"];
1390
- };
1391
- };
1392
- };
1393
- };
1394
- delete?: never;
1395
- options?: never;
1396
- head?: never;
1397
- patch?: never;
1398
- trace?: never;
1399
- };
1400
- "/prs/claim-next": {
1401
- parameters: {
1402
- query?: never;
1403
- header?: never;
1404
- path?: never;
1405
- cookie?: never;
1406
- };
1407
- get?: never;
1408
- put?: never;
1409
- /**
1410
- * Atomic find-and-claim of oldest eligible PR
1411
- * @description Atomically finds and claims the oldest eligible PR not yet claimed by the calling agent, in one round-trip — useful for agents implementing a pull-based queue instead of manually claiming a specific PR. Optional `maxConcurrent` (default `1`) caps how many PRs the agent may hold at once; if the agent already has that many claimed, returns `204`. Agent tokens see only PRs in their configured repo scope; admin tokens see all. Returns `200` with `{ pr, phase }`, or `204` if nothing eligible.
1412
- */
1413
- post: {
1414
- parameters: {
1415
- query?: never;
1416
- header?: never;
1417
- path?: never;
1418
- cookie?: never;
1419
- };
1420
- requestBody?: {
1421
- content: {
1422
- "application/json": components["schemas"]["ClaimNextBody"];
1423
- };
1424
- };
1425
- responses: {
1426
- /** @description PR claimed — returns {pr, phase} */
1427
- 200: {
1428
- headers: {
1429
- [name: string]: unknown;
1430
- };
1431
- content: {
1432
- "application/json": components["schemas"]["ClaimNextResponse"];
1433
- };
1434
- };
1435
- /** @description No eligible PR found */
1436
- 204: {
1437
- headers: {
1438
- [name: string]: unknown;
1439
- };
1440
- content?: never;
1441
- };
1442
- /** @description Bad request */
1443
- 400: {
1444
- headers: {
1445
- [name: string]: unknown;
1446
- };
1447
- content: {
1448
- "application/json": components["schemas"]["Error"];
1449
- };
1450
- };
1451
- };
1452
- };
1453
- delete?: never;
1454
- options?: never;
1455
- head?: never;
1456
- patch?: never;
1457
- trace?: never;
1458
- };
1459
- "/prs/census": {
1460
- parameters: {
1461
- query?: never;
1462
- header?: never;
1463
- path?: never;
1464
- cookie?: never;
1465
- };
1466
- get?: never;
1467
- put?: never;
1468
- /**
1469
- * Batch upsert PR origin/author/branch/title/state metadata
1470
- * @description Upserts a PullRequest row for each (repo, prNumber) entry — at most 200 entries per call, all in one transaction. Writes `authorLogin`/`headRef`/`title`/`state`/`mergedAt`/`prCreatedAt`/`commitCount`/`commitsDocsRefresh`/`commitsReviewPatch`/`commitsCiFix`/`commitsImplementation` unconditionally; `origin` follows first-write-wins (only applied when the row's existing origin is currently null). Never touches claim/phase/review/patch/blocked fields — safe to run alongside review/patch/deploy's separate POST /prs/claim lock. New rows get `phase=null`, `reviewState='pending'`, `staged=false`. Not part of the public MCP tool surface.
1471
- */
1472
- post: {
1473
- parameters: {
1474
- query?: never;
1475
- header?: never;
1476
- path?: never;
1477
- cookie?: never;
1478
- };
1479
- requestBody: {
1480
- content: {
1481
- "application/json": components["schemas"]["CensusBody"];
1482
- };
1483
- };
1484
- responses: {
1485
- /** @description Upserted PR rows, one per input entry */
1486
- 200: {
1487
- headers: {
1488
- [name: string]: unknown;
1489
- };
1490
- content: {
1491
- "application/json": components["schemas"]["CensusResponse"];
1492
- };
1493
- };
1494
- /** @description Bad request — malformed entry, or more than 200 entries in one batch */
1495
- 400: {
1496
- headers: {
1497
- [name: string]: unknown;
1498
- };
1499
- content: {
1500
- "application/json": components["schemas"]["Error"];
1501
- };
1502
- };
1503
- /** @description Forbidden — an entry's repo is outside the agent token's scope */
1504
- 403: {
1505
- headers: {
1506
- [name: string]: unknown;
1507
- };
1508
- content: {
1509
- "application/json": components["schemas"]["Error"];
1510
- };
1511
- };
1512
- };
1513
- };
1514
- delete?: never;
1515
- options?: never;
1516
- head?: never;
1517
- patch?: never;
1518
- trace?: never;
1519
- };
1520
- "/prs/census/cursor": {
1521
- parameters: {
1522
- query?: never;
1523
- header?: never;
1524
- path?: never;
1525
- cookie?: never;
1526
- };
1527
- /**
1528
- * Get the census incremental-search-window cursor for a repo
1529
- * @description Returns `{ cursor }`: the max `mergedAt` (ISO string) among rows scoped to `repo` whose `origin` is not null, or `null` when no such row exists. Used by POM-4.1's census sweep to derive its incremental search window.
1530
- */
1531
- get: {
1532
- parameters: {
1533
- query: {
1534
- repo: string;
1535
- };
1536
- header?: never;
1537
- path?: never;
1538
- cookie?: never;
1539
- };
1540
- requestBody?: never;
1541
- responses: {
1542
- /** @description Census cursor */
1543
- 200: {
1544
- headers: {
1545
- [name: string]: unknown;
1546
- };
1547
- content: {
1548
- "application/json": components["schemas"]["CensusCursorResponse"];
1549
- };
1550
- };
1551
- /** @description Bad request — missing or malformed repo */
1552
- 400: {
1553
- headers: {
1554
- [name: string]: unknown;
1555
- };
1556
- content: {
1557
- "application/json": components["schemas"]["Error"];
1558
- };
1559
- };
1560
- /** @description Forbidden — repo is outside the agent token's scope */
1561
- 403: {
1562
- headers: {
1563
- [name: string]: unknown;
1564
- };
1565
- content: {
1566
- "application/json": components["schemas"]["Error"];
1567
- };
1568
- };
1569
- };
1570
- };
1571
- put?: never;
1572
- post?: never;
1573
- delete?: never;
1574
- options?: never;
1575
- head?: never;
1576
- patch?: never;
1577
- trace?: never;
1578
- };
1579
- "/prs/{id}": {
1580
- parameters: {
1581
- query?: never;
1582
- header?: never;
1583
- path?: never;
1584
- cookie?: never;
1585
- };
1586
- /**
1587
- * Fetch a single pull request
1588
- * @description Fetches a single PR record by its ID. Returns `404` if not found.
1589
- */
1590
- get: {
1591
- parameters: {
1592
- query?: never;
1593
- header?: never;
1594
- path: {
1595
- id: string;
1596
- };
1597
- cookie?: never;
1598
- };
1599
- requestBody?: never;
1600
- responses: {
1601
- /** @description Pull request record */
1602
- 200: {
1603
- headers: {
1604
- [name: string]: unknown;
1605
- };
1606
- content: {
1607
- "application/json": components["schemas"]["PullRequest"];
1608
- };
1609
- };
1610
- /** @description Not found */
1611
- 404: {
1612
- headers: {
1613
- [name: string]: unknown;
1614
- };
1615
- content: {
1616
- "application/json": components["schemas"]["Error"];
1617
- };
1618
- };
1619
- };
1620
- };
1621
- put?: never;
1622
- post?: never;
1623
- delete?: never;
1624
- options?: never;
1625
- head?: never;
1626
- /**
1627
- * Update pull request fields
1628
- * @description Writable fields: `staged`, `commitSha`, `reviewedCommitSha`, `agentId`, `state`, `mergedAt`, `reviewState`, `reviewedAt`, `phase`, `readyForReviewAt`, `readyForPatchAt`, `readyForDeployAt`, `blocked`, `blockedReason` — every other field is managed by a lifecycle endpoint instead. Returns `400` if no writable field is provided. Unlike the lifecycle endpoints, PATCH does not record a PullRequestEvent audit row; it's meant for late-stage corrections (e.g. force-setting `state=merged` after GitHub confirms it) that don't need transactional field-diff auditing. Setting `state` to `merged`/`closed`, or `reviewState` to `posted`/`approved`, clears the claim fields (`claimedBy`, `claimedAt`, `heartbeatAt`, `phase`) as a side effect so a completed PR isn't left held by a stale claim. Setting `reviewState=posted` together with `reviewedCommitSha` records the commit-level dedup marker the review phase's staged-review guard reads to decide whether re-review is needed.
1629
- */
1630
- patch: {
1631
- parameters: {
1632
- query?: never;
1633
- header?: never;
1634
- path: {
1635
- id: string;
1636
- };
1637
- cookie?: never;
1638
- };
1639
- requestBody: {
1640
- content: {
1641
- "application/json": components["schemas"]["UpdatePrBody"];
1642
- };
1643
- };
1644
- responses: {
1645
- /** @description Updated pull request */
1646
- 200: {
1647
- headers: {
1648
- [name: string]: unknown;
1649
- };
1650
- content: {
1651
- "application/json": components["schemas"]["PullRequest"];
1652
- };
1653
- };
1654
- /** @description Bad request */
1655
- 400: {
1656
- headers: {
1657
- [name: string]: unknown;
1658
- };
1659
- content: {
1660
- "application/json": components["schemas"]["Error"];
1661
- };
1662
- };
1663
- /** @description Not found */
1664
- 404: {
1665
- headers: {
1666
- [name: string]: unknown;
1667
- };
1668
- content: {
1669
- "application/json": components["schemas"]["Error"];
1670
- };
1671
- };
1672
- };
1673
- };
1674
- trace?: never;
1675
- };
1676
- "/prs/{id}/heartbeat": {
1677
- parameters: {
1678
- query?: never;
1679
- header?: never;
1680
- path?: never;
1681
- cookie?: never;
1682
- };
1683
- get?: never;
1684
- put?: never;
1685
- /**
1686
- * Touch heartbeatAt for a claimed PR
1687
- * @description Updates `heartbeatAt` to now to signal the claiming agent is still working. Deliberately excluded from the PullRequestEvent audit trail — a bare liveness ping recording would be a guaranteed no-op, and keeping this a single cheap UPDATE avoids dominating write volume.
1688
- */
1689
- post: {
1690
- parameters: {
1691
- query?: never;
1692
- header?: never;
1693
- path: {
1694
- id: string;
1695
- };
1696
- cookie?: never;
1697
- };
1698
- requestBody?: never;
1699
- responses: {
1700
- /** @description PR with updated heartbeatAt */
1701
- 200: {
1702
- headers: {
1703
- [name: string]: unknown;
1704
- };
1705
- content: {
1706
- "application/json": components["schemas"]["PullRequest"];
1707
- };
1708
- };
1709
- };
1710
- };
1711
- delete?: never;
1712
- options?: never;
1713
- head?: never;
1714
- patch?: never;
1715
- trace?: never;
1716
- };
1717
- "/prs/{id}/complete": {
1718
- parameters: {
1719
- query?: never;
1720
- header?: never;
1721
- path?: never;
1722
- cookie?: never;
1723
- };
1724
- get?: never;
1725
- put?: never;
1726
- /**
1727
- * Mark PR review as complete (reviewState=posted)
1728
- * @description Sets `reviewState=posted`, increments `reviewCycles`, sets `reviewedAt`, and clears `claimedBy`/`claimedAt`/`heartbeatAt`/`phase` so the review claim is released as soon as the review is done. Records field-level transitions as PullRequestEvent rows.
1729
- */
1730
- post: {
1731
- parameters: {
1732
- query?: never;
1733
- header?: never;
1734
- path: {
1735
- id: string;
1736
- };
1737
- cookie?: never;
1738
- };
1739
- requestBody?: never;
1740
- responses: {
1741
- /** @description Completed PR */
1742
- 200: {
1743
- headers: {
1744
- [name: string]: unknown;
1745
- };
1746
- content: {
1747
- "application/json": components["schemas"]["PullRequest"];
1748
- };
1749
- };
1750
- /** @description Not found */
1751
- 404: {
1752
- headers: {
1753
- [name: string]: unknown;
1754
- };
1755
- content: {
1756
- "application/json": components["schemas"]["Error"];
1757
- };
1758
- };
1759
- };
1760
- };
1761
- delete?: never;
1762
- options?: never;
1763
- head?: never;
1764
- patch?: never;
1765
- trace?: never;
1766
- };
1767
- "/prs/{id}/patch": {
1768
- parameters: {
1769
- query?: never;
1770
- header?: never;
1771
- path?: never;
1772
- cookie?: never;
1773
- };
1774
- get?: never;
1775
- put?: never;
1776
- /**
1777
- * Increment patchCycles and conditionally reset reviewState=pending; optionally track a CI-failure streak via ciFailureSignature
1778
- * @description Increments `patchCycles`, sets `patchedAt`, and clears `claimedBy`/`claimedAt`/`heartbeatAt`/`phase`. `reviewState` is reset conditionally based on the optional `commitSha` field: omitted resets unconditionally to `pending`; provided and differing from the stored `commitSha` also resets to `pending` and updates `commitSha`; provided and matching leaves `reviewState` untouched (a no-op patch cycle). The optional `ciFailureSignature` field tracks consecutive patch cycles hitting the same CI failure — a matching signature increments `consecutiveCiFailureCount`, a differing or absent one resets it to 1; crossing the threshold (3, `SPIN_DETECTION_THRESHOLD`) auto-sets `blocked=true` with a descriptive `blockedReason`. Records field-level transitions as PullRequestEvent rows.
1779
- */
1780
- post: {
1781
- parameters: {
1782
- query?: never;
1783
- header?: never;
1784
- path: {
1785
- id: string;
1786
- };
1787
- cookie?: never;
1788
- };
1789
- requestBody?: {
1790
- content: {
1791
- "application/json": components["schemas"]["PatchPrBody"];
1792
- };
1793
- };
1794
- responses: {
1795
- /** @description Patched PR */
1796
- 200: {
1797
- headers: {
1798
- [name: string]: unknown;
1799
- };
1800
- content: {
1801
- "application/json": components["schemas"]["PullRequest"];
1802
- };
1803
- };
1804
- /** @description Not found */
1805
- 404: {
1806
- headers: {
1807
- [name: string]: unknown;
1808
- };
1809
- content: {
1810
- "application/json": components["schemas"]["Error"];
1811
- };
1812
- };
1813
- };
1814
- };
1815
- delete?: never;
1816
- options?: never;
1817
- head?: never;
1818
- patch?: never;
1819
- trace?: never;
1820
- };
1821
- "/prs/{id}/release": {
1822
- parameters: {
1823
- query?: never;
1824
- header?: never;
1825
- path?: never;
1826
- cookie?: never;
1827
- };
1828
- get?: never;
1829
- put?: never;
1830
- /**
1831
- * Release a claim (reviewState=pending, claimedBy cleared)
1832
- * @description Clears `claimedBy`, `claimedAt`, and `heartbeatAt`. Resets `reviewState=pending` unless it's already a terminal value (`posted`/`approved`), in which case `reviewState` is left untouched. Records field-level transitions as PullRequestEvent rows.
1833
- */
1834
- post: {
1835
- parameters: {
1836
- query?: never;
1837
- header?: never;
1838
- path: {
1839
- id: string;
1840
- };
1841
- cookie?: never;
1842
- };
1843
- requestBody?: never;
1844
- responses: {
1845
- /** @description Released PR */
1846
- 200: {
1847
- headers: {
1848
- [name: string]: unknown;
1849
- };
1850
- content: {
1851
- "application/json": components["schemas"]["PullRequest"];
1852
- };
1853
- };
1854
- /** @description Not found */
1855
- 404: {
1856
- headers: {
1857
- [name: string]: unknown;
1858
- };
1859
- content: {
1860
- "application/json": components["schemas"]["Error"];
1861
- };
1862
- };
1863
- };
1864
- };
1865
- delete?: never;
1866
- options?: never;
1867
- head?: never;
1868
- patch?: never;
1869
- trace?: never;
1870
- };
1871
- "/prs/{id}/skip": {
1872
- parameters: {
1873
- query?: never;
1874
- header?: never;
1875
- path?: never;
1876
- cookie?: never;
1877
- };
1878
- get?: never;
1879
- put?: never;
1880
- /**
1881
- * Record a skip — increments skipCount, auto-blocks at threshold
1882
- * @description Increments `skipCount` and updates `lastSkippedAt` to now. When `skipCount` crosses the threshold (3), auto-sets `blocked=true` and `blockedReason="Auto-blocked after {skipCount} consecutive skips (dispatched but found nothing to do)"`. Mirrors `POST /tasks/:id/skip`. Records field-level transitions as PullRequestEvent rows.
1883
- */
1884
- post: {
1885
- parameters: {
1886
- query?: never;
1887
- header?: never;
1888
- path: {
1889
- id: string;
1890
- };
1891
- cookie?: never;
1892
- };
1893
- requestBody?: never;
1894
- responses: {
1895
- /** @description Updated PR */
1896
- 200: {
1897
- headers: {
1898
- [name: string]: unknown;
1899
- };
1900
- content: {
1901
- "application/json": components["schemas"]["PullRequest"];
1902
- };
1903
- };
1904
- /** @description Not found */
1905
- 404: {
1906
- headers: {
1907
- [name: string]: unknown;
1908
- };
1909
- content: {
1910
- "application/json": components["schemas"]["Error"];
1911
- };
1912
- };
1913
- };
1914
- };
1915
- delete?: never;
1916
- options?: never;
1917
- head?: never;
1918
- patch?: never;
1919
- trace?: never;
1920
- };
1921
- "/prs/{id}/skip/reset": {
1922
- parameters: {
1923
- query?: never;
1924
- header?: never;
1925
- path?: never;
1926
- cookie?: never;
1927
- };
1928
- get?: never;
1929
- put?: never;
1930
- /**
1931
- * Reset skip tracking — skipCount back to 0; also clears blocked/blockedReason if the PR was blocked by the skip mechanism
1932
- * @description Resets `skipCount` to 0 and clears `lastSkippedAt`. If the PR is currently blocked with a `blockedReason` matching the skip-auto-block message (contains "consecutive skips"), also clears `blocked=false` and `blockedReason=null` in the same update — a block set by a different mechanism (e.g. the CI-failure-streak auto-block from `POST /:id/patch`) is left untouched. Records field-level transitions as PullRequestEvent rows.
1933
- */
1934
- post: {
1935
- parameters: {
1936
- query?: never;
1937
- header?: never;
1938
- path: {
1939
- id: string;
1940
- };
1941
- cookie?: never;
1942
- };
1943
- requestBody?: never;
1944
- responses: {
1945
- /** @description Updated PR */
1946
- 200: {
1947
- headers: {
1948
- [name: string]: unknown;
1949
- };
1950
- content: {
1951
- "application/json": components["schemas"]["PullRequest"];
1952
- };
1953
- };
1954
- /** @description Not found */
1955
- 404: {
1956
- headers: {
1957
- [name: string]: unknown;
1958
- };
1959
- content: {
1960
- "application/json": components["schemas"]["Error"];
1961
- };
1962
- };
1963
- };
1964
- };
1965
- delete?: never;
1966
- options?: never;
1967
- head?: never;
1968
- patch?: never;
1969
- trace?: never;
1970
- };
1971
- "/prs/{id}/findings": {
1972
- parameters: {
1973
- query?: never;
1974
- header?: never;
1975
- path?: never;
1976
- cookie?: never;
1977
- };
1978
- get?: never;
1979
- put?: never;
1980
- /**
1981
- * Append a review/patch finding to a PR — source:'patch' may only submit disposition:'rejected'
1982
- * @description Appends a `PrFinding` row: `{ ref, disposition, source, evidence, at?, agentId? }`, where `disposition` is one of `resolved`, `superseded`, `rejected`, and `source` is one of `review`, `patch`. Server-enforced authority rule: `source:"patch"` may only submit `disposition:"rejected"` (patch cannot unilaterally resolve or supersede a finding it didn't originate) — any other combination returns `400`. `source:"review"` may submit any disposition. Returns `201` with the created finding.
1983
- */
1984
- post: {
1985
- parameters: {
1986
- query?: never;
1987
- header?: never;
1988
- path: {
1989
- id: string;
1990
- };
1991
- cookie?: never;
1992
- };
1993
- requestBody: {
1994
- content: {
1995
- "application/json": components["schemas"]["CreateFindingBody"];
1996
- };
1997
- };
1998
- responses: {
1999
- /** @description Finding recorded */
2000
- 201: {
2001
- headers: {
2002
- [name: string]: unknown;
2003
- };
2004
- content: {
2005
- "application/json": components["schemas"]["PrFinding"];
2006
- };
2007
- };
2008
- /** @description Bad request — including the authority violation of source:'patch' submitting a disposition other than 'rejected' */
2009
- 400: {
2010
- headers: {
2011
- [name: string]: unknown;
2012
- };
2013
- content: {
2014
- "application/json": components["schemas"]["Error"];
2015
- };
2016
- };
2017
- /** @description Not found */
2018
- 404: {
2019
- headers: {
2020
- [name: string]: unknown;
2021
- };
2022
- content: {
2023
- "application/json": components["schemas"]["Error"];
2024
- };
2025
- };
2026
- };
2027
- };
2028
- delete?: never;
2029
- options?: never;
2030
- head?: never;
2031
- patch?: never;
2032
- trace?: never;
2033
- };
2034
- "/prs/{id}/events": {
2035
- parameters: {
2036
- query?: never;
2037
- header?: never;
2038
- path?: never;
2039
- cookie?: never;
2040
- };
2041
- /**
2042
- * Fetch a PR's PullRequestEvent audit trail, ordered by `at` ascending (oldest first)
2043
- * @description Returns `{ events, total, limit, offset }` — the PR's append-only `PullRequestEvent` rows recording field-level state transitions, oldest first. `total` counts all events regardless of `limit`/`offset` (default `limit=50`, `offset=0`). Returns `404` if the PR doesn't exist.
2044
- */
2045
- get: {
2046
- parameters: {
2047
- query?: {
2048
- limit?: string;
2049
- offset?: string;
2050
- };
2051
- header?: never;
2052
- path: {
2053
- id: string;
2054
- };
2055
- cookie?: never;
2056
- };
2057
- requestBody?: never;
2058
- responses: {
2059
- /** @description PR's event history */
2060
- 200: {
2061
- headers: {
2062
- [name: string]: unknown;
2063
- };
2064
- content: {
2065
- "application/json": components["schemas"]["PrEventsResponse"];
2066
- };
2067
- };
2068
- /** @description Not found */
2069
- 404: {
2070
- headers: {
2071
- [name: string]: unknown;
2072
- };
2073
- content: {
2074
- "application/json": components["schemas"]["Error"];
2075
- };
2076
- };
2077
- };
2078
- };
2079
- put?: never;
2080
- post?: never;
2081
- delete?: never;
2082
- options?: never;
2083
- head?: never;
2084
- patch?: never;
2085
- trace?: never;
2086
- };
2087
- "/sessions": {
2088
- parameters: {
2089
- query?: never;
2090
- header?: never;
2091
- path?: never;
2092
- cookie?: never;
2093
- };
2094
- /**
2095
- * List sessions
2096
- * @description Returns `{ sessions, total, limit, offset }` — each session's Task rows rolled up into a single object (`state`, `waitingSince`, `lastActivityAt`, per-status `counts`, distinct `agentIds`/`repos`, `waitingTasks`) flattened with the Session row's own fields. Omitting `?state` defaults to non-archived, non-closed sessions. Every agent token (agentId set) is scoped: it only sees sessions with at least one qualifying task — one where `assignee === agentId` OR the task's repo is in the agent's resolved scope; a token with no resolved repos degrades to assignee-only matching rather than unrestricted visibility. Only admin tokens see every session unrestricted.
2097
- */
2098
- get: {
2099
- parameters: {
2100
- query?: {
2101
- state?: "waiting" | "active" | "closed" | "empty" | "archived" | "all";
2102
- sort?: "waitingSince" | "lastActivityAt";
2103
- agentId?: string;
2104
- repo?: string | string[];
2105
- org?: string | string[];
2106
- q?: string;
2107
- limit?: string;
2108
- offset?: string;
2109
- };
2110
- header?: never;
2111
- path?: never;
2112
- cookie?: never;
2113
- };
2114
- requestBody?: never;
2115
- responses: {
2116
- /** @description List of sessions with total count */
2117
- 200: {
2118
- headers: {
2119
- [name: string]: unknown;
2120
- };
2121
- content: {
2122
- "application/json": components["schemas"]["SessionListResponse"];
2123
- };
2124
- };
2125
- /** @description Unauthorized */
2126
- 401: {
2127
- headers: {
2128
- [name: string]: unknown;
2129
- };
2130
- content: {
2131
- "application/json": components["schemas"]["Error"];
2132
- };
2133
- };
2134
- };
2135
- };
2136
- put?: never;
2137
- post?: never;
2138
- delete?: never;
2139
- options?: never;
2140
- head?: never;
2141
- patch?: never;
2142
- trace?: never;
2143
- };
2144
- "/sessions/{slug}": {
2145
- parameters: {
2146
- query?: never;
2147
- header?: never;
2148
- path?: never;
2149
- cookie?: never;
2150
- };
2151
- /**
2152
- * Get a session by slug
2153
- * @description Returns the same flattened session+rollup shape as the list route. Returns `404` if the session doesn't exist, or if an agent token has no qualifying task in it (same visibility rule as list) — the two cases are indistinguishable to the caller by design.
2154
- */
2155
- get: {
2156
- parameters: {
2157
- query?: never;
2158
- header?: never;
2159
- path: {
2160
- slug: string;
2161
- };
2162
- cookie?: never;
2163
- };
2164
- requestBody?: never;
2165
- responses: {
2166
- /** @description Session */
2167
- 200: {
2168
- headers: {
2169
- [name: string]: unknown;
2170
- };
2171
- content: {
2172
- "application/json": components["schemas"]["Session"];
2173
- };
2174
- };
2175
- /** @description Unauthorized */
2176
- 401: {
2177
- headers: {
2178
- [name: string]: unknown;
2179
- };
2180
- content: {
2181
- "application/json": components["schemas"]["Error"];
2182
- };
2183
- };
2184
- /** @description Not found */
2185
- 404: {
2186
- headers: {
2187
- [name: string]: unknown;
2188
- };
2189
- content: {
2190
- "application/json": components["schemas"]["Error"];
2191
- };
2192
- };
2193
- };
2194
- };
2195
- put?: never;
2196
- post?: never;
2197
- delete?: never;
2198
- options?: never;
2199
- head?: never;
2200
- /**
2201
- * Rename/archive a session — admin-only
2202
- * @description Admin-only, no exceptions — agent tokens get `403` regardless of ownership. Body: `{ title?: string | null, archived?: boolean }`, both optional (an empty body is a no-op). `title: null` clears the title; `archived: true` sets `archivedAt`/`archivedBy`, `archived: false` clears both. Returns `404` if the session doesn't exist.
2203
- */
2204
- patch: {
2205
- parameters: {
2206
- query?: never;
2207
- header?: never;
2208
- path: {
2209
- slug: string;
2210
- };
2211
- cookie?: never;
2212
- };
2213
- requestBody?: {
2214
- content: {
2215
- "application/json": components["schemas"]["SessionPatchBody"];
2216
- };
2217
- };
2218
- responses: {
2219
- /** @description Updated session */
2220
- 200: {
2221
- headers: {
2222
- [name: string]: unknown;
2223
- };
2224
- content: {
2225
- "application/json": components["schemas"]["Session"];
2226
- };
2227
- };
2228
- /** @description Unauthorized */
2229
- 401: {
2230
- headers: {
2231
- [name: string]: unknown;
2232
- };
2233
- content: {
2234
- "application/json": components["schemas"]["Error"];
2235
- };
2236
- };
2237
- /** @description Forbidden — admin tokens only */
2238
- 403: {
2239
- headers: {
2240
- [name: string]: unknown;
2241
- };
2242
- content: {
2243
- "application/json": components["schemas"]["Error"];
2244
- };
2245
- };
2246
- /** @description Not found */
2247
- 404: {
2248
- headers: {
2249
- [name: string]: unknown;
2250
- };
2251
- content: {
2252
- "application/json": components["schemas"]["Error"];
2253
- };
2254
- };
2255
- };
2256
- };
2257
- trace?: never;
2258
- };
2259
- "/verification-checks": {
2260
- parameters: {
2261
- query?: never;
2262
- header?: never;
2263
- path?: never;
2264
- cookie?: never;
2265
- };
2266
- /**
2267
- * List verification checks for a task, a PR, or a repo+checkName pair
2268
- * @description Returns `{ checks, total, limit, offset }` for exactly one of three mutually-exclusive modes: `?taskId=`, `?prId=`, or `?repo=`+`?checkName=` together (supplying none, or more than one mode, or only half of the repo+checkName pair, is `400`). The `?taskId=`/`?prId=` modes are ordered by `at` ascending (oldest first, default `limit=50`, `offset=0`) and `404` if the referenced task/pr doesn't exist. The `?repo=`+`?checkName=` mode (LVB-4.4) spans every task/PR that recorded that repo+check — there's no single parent to `404` on, so an unmatched pair returns `200` with an empty list — and is ordered by `at` DESCENDING (most recent first) so a caller can walk backward from the latest outcome to detect a consecutive skipped/timed_out streak.
2269
- */
2270
- get: {
2271
- parameters: {
2272
- query?: {
2273
- taskId?: string;
2274
- prId?: string;
2275
- repo?: string;
2276
- checkName?: string;
2277
- limit?: string;
2278
- offset?: string;
2279
- };
2280
- header?: never;
2281
- path?: never;
2282
- cookie?: never;
2283
- };
2284
- requestBody?: never;
2285
- responses: {
2286
- /** @description Verification check history */
2287
- 200: {
2288
- headers: {
2289
- [name: string]: unknown;
2290
- };
2291
- content: {
2292
- "application/json": components["schemas"]["VerificationCheckListResponse"];
2293
- };
2294
- };
2295
- /** @description Bad request — none, or more than one, of ?taskId=/?prId=/(?repo=+?checkName=) supplied, or only one half of the ?repo=/?checkName= pair given */
2296
- 400: {
2297
- headers: {
2298
- [name: string]: unknown;
2299
- };
2300
- content: {
2301
- "application/json": components["schemas"]["Error"];
2302
- };
2303
- };
2304
- /** @description Not found (?taskId=/?prId= modes only — the referenced task/pr doesn't exist) */
2305
- 404: {
2306
- headers: {
2307
- [name: string]: unknown;
2308
- };
2309
- content: {
2310
- "application/json": components["schemas"]["Error"];
2311
- };
2312
- };
2313
- };
2314
- };
2315
- put?: never;
2316
- /**
2317
- * Record a single per-check verification outcome
2318
- * @description Records one VerificationCheck row against exactly one parent — `taskId` (a task still in progress, before a PR exists) or `prId` (an already-open PR); supplying neither or both is `400`. `status` is `ran_passed | ran_failed | skipped | timed_out`. `reasonCategory` is a closed set of ENVIRONMENTAL causes and is only valid alongside `status: skipped | timed_out` — a `ran_failed` row (the check ran and produced a genuine failure) must never carry one; supplying it anyway is `400`, enforced server-side (not just by convention). `learnedFromCategory` is only valid alongside `reasonCategory: learned_skip`, and must not itself be `learned_skip`. `at` defaults to the current time when omitted.
2319
- */
2320
- post: {
2321
- parameters: {
2322
- query?: never;
2323
- header?: never;
2324
- path?: never;
2325
- cookie?: never;
2326
- };
2327
- requestBody: {
2328
- content: {
2329
- "application/json": components["schemas"]["CreateVerificationCheckBody"];
2330
- };
2331
- };
2332
- responses: {
2333
- /** @description Recorded verification check */
2334
- 201: {
2335
- headers: {
2336
- [name: string]: unknown;
2337
- };
2338
- content: {
2339
- "application/json": components["schemas"]["VerificationCheck"];
2340
- };
2341
- };
2342
- /** @description Bad request — missing/invalid fields, taskId/prId neither-or-both, or a status/reasonCategory combination that violates the ran_failed-never-carries-a-reasonCategory rule */
2343
- 400: {
2344
- headers: {
2345
- [name: string]: unknown;
2346
- };
2347
- content: {
2348
- "application/json": components["schemas"]["Error"];
2349
- };
2350
- };
2351
- /** @description Not found — the referenced task/pr does not exist */
2352
- 404: {
2353
- headers: {
2354
- [name: string]: unknown;
2355
- };
2356
- content: {
2357
- "application/json": components["schemas"]["Error"];
2358
- };
2359
- };
2360
- };
2361
- };
2362
- delete?: never;
2363
- options?: never;
2364
- head?: never;
2365
- patch?: never;
2366
- trace?: never;
2367
- };
2368
- }
2369
- export type webhooks = Record<string, never>;
2370
- export interface components {
2371
- schemas: {
2372
- Task: {
2373
- /** @example clx1234567890 */
2374
- id: string;
2375
- /** @example Implement feature X */
2376
- title: string;
2377
- /**
2378
- * @example pending
2379
- * @enum {string}
2380
- */
2381
- status: "pending" | "in_progress" | "pr_open" | "approved" | "merged" | "done" | "deploying" | "deployed" | "blocked" | "cancelled";
2382
- /** @example manual */
2383
- source?: string | null;
2384
- /** @example session-123 */
2385
- session?: string | null;
2386
- /** @example org/repo */
2387
- repo?: string | null;
2388
- /** @example Task description */
2389
- description?: string | null;
2390
- /**
2391
- * @example [
2392
- * "Criterion 1",
2393
- * "Criterion 2"
2394
- * ]
2395
- */
2396
- acceptanceCriteria?: string[];
2397
- /** @example feature */
2398
- layer?: string | null;
2399
- /** @example feat/feature-x */
2400
- branch?: string | null;
2401
- /**
2402
- * @example [
2403
- * "task-1",
2404
- * "task-2"
2405
- * ]
2406
- */
2407
- dependencies?: string[];
2408
- /** @example 42 */
2409
- pr?: number | null;
2410
- /** @example 5.5 */
2411
- hours?: number | null;
2412
- /** @example 2026-01-02T00:00:00.000Z */
2413
- startedAt?: string | null;
2414
- /** @example 2026-01-03T00:00:00.000Z */
2415
- prCreatedAt?: string | null;
2416
- /** @example 2026-01-04T00:00:00.000Z */
2417
- mergedAt?: string | null;
2418
- /** @example null */
2419
- blockedAt?: string | null;
2420
- /** @example Waiting on dependency */
2421
- blockedReason?: string | null;
2422
- /** @example Some notes */
2423
- note?: string | null;
2424
- /** @example feature */
2425
- type?: string | null;
2426
- /** @example high */
2427
- priority?: string | null;
2428
- /** @example null */
2429
- cancelledAt?: string | null;
2430
- /** @example 2026-01-05T00:00:00.000Z */
2431
- completedAt?: string | null;
2432
- /** @example null */
2433
- deployingAt?: string | null;
2434
- /** @example 2026-01-06T00:00:00.000Z */
2435
- deployedAt?: string | null;
2436
- /** @example 2 */
2437
- ciFixAttempts?: number | null;
2438
- /** @example abc123def456 */
2439
- mergeCommit?: string | null;
2440
- /** @example https://github.com/org/repo/pull/42 */
2441
- prUrl?: string | null;
2442
- /** @example user@example.com */
2443
- assignee?: string | null;
2444
- /** @example GH-123 */
2445
- issue?: string | null;
2446
- /** @example sonnet */
2447
- model?: string | null;
2448
- /** @example 7 */
2449
- complexity?: number | null;
2450
- /** @example true */
2451
- hitl?: boolean | null;
2452
- /**
2453
- * @description What the task is: `dev` (ordinary work item, the default) or `prd` (a product spec awaiting an autonomous plan session). A `prd` task is never part of the `?ready=true` set.
2454
- * @default dev
2455
- * @example dev
2456
- * @enum {string}
2457
- */
2458
- kind: "dev" | "prd";
2459
- /**
2460
- * @description Consecutive skip count. Auto-blocks (hitl+blockedReason) once it crosses the threshold (3).
2461
- * @default 0
2462
- * @example 0
2463
- */
2464
- skipCount: number;
2465
- /** @example 2026-01-02T00:00:00.000Z */
2466
- lastSkippedAt?: string | null;
2467
- /** @example agent-id-123 */
2468
- claimedBy?: string | null;
2469
- /** @example prefer-sonnet */
2470
- agentHint?: string | null;
2471
- /** @example 2026-01-02T00:00:00.000Z */
2472
- claimedAt?: string | null;
2473
- /** @example 2026-01-06T12:00:00.000Z */
2474
- heartbeatAt?: string | null;
2475
- /** @example 10 */
2476
- simplifyTotal?: number | null;
2477
- /** @example 2 */
2478
- simplifyDry?: number | null;
2479
- /** @example 3 */
2480
- simplifyDeadCode?: number | null;
2481
- /** @example 1 */
2482
- simplifyNaming?: number | null;
2483
- /** @example 2 */
2484
- simplifyComplexity?: number | null;
2485
- /** @example 2 */
2486
- simplifyConsistency?: number | null;
2487
- /** @example 5.5 */
2488
- coverageDelta?: number | null;
2489
- /** @example medium */
2490
- effortLevel?: string | null;
2491
- /** @example 1000 */
2492
- inputTokens?: number | null;
2493
- /** @example 500 */
2494
- outputTokens?: number | null;
2495
- /** @example 100 */
2496
- cacheReadTokens?: number | null;
2497
- /** @example 50 */
2498
- cacheCreationTokens?: number | null;
2499
- /** @example 0.02 */
2500
- costUsd?: number | null;
2501
- /**
2502
- * @example {
2503
- * "customKey": "customValue"
2504
- * }
2505
- */
2506
- metadata?: {
2507
- [key: string]: unknown;
2508
- } | null;
2509
- /**
2510
- * Format: date-time
2511
- * @example 2026-01-01T00:00:00.000Z
2512
- */
2513
- createdAt: string;
2514
- /**
2515
- * Format: date-time
2516
- * @example 2026-01-06T12:00:00.000Z
2517
- */
2518
- updatedAt: string;
2519
- };
2520
- TaskListResponse: {
2521
- tasks: components["schemas"]["Task"][];
2522
- /** @example 10 */
2523
- total: number;
2524
- /**
2525
- * @description True only when the agent token's repo-scope resolver call itself failed upstream (network error, timeout, non-2xx, malformed JSON) — distinct from a legitimate empty repo scope. Always false for admin tokens.
2526
- * @example false
2527
- */
2528
- scopeDegraded: boolean;
2529
- };
2530
- Error: {
2531
- /** @example not found */
2532
- error: string;
2533
- };
2534
- CreateTaskBody: {
2535
- /** @example Implement feature X */
2536
- title?: string;
2537
- /** @example pending */
2538
- status?: string;
2539
- /** @example org/repo */
2540
- repo?: string | null;
2541
- /** @example session-123 */
2542
- session?: string;
2543
- /** @example Task description */
2544
- description?: string;
2545
- /** @example service */
2546
- layer?: string;
2547
- /** @example feat/feature-x */
2548
- branch?: string;
2549
- /** @example [] */
2550
- dependencies?: string[];
2551
- /** @example [] */
2552
- acceptanceCriteria?: string[];
2553
- /** @example user@example.com */
2554
- assignee?: string;
2555
- /** @example high */
2556
- priority?: string;
2557
- /** @example feature */
2558
- type?: string;
2559
- /** @example manual */
2560
- source?: string;
2561
- /**
2562
- * @description What the task is (TKD-1.1). Defaults to `dev`.
2563
- * @example dev
2564
- * @enum {string}
2565
- */
2566
- kind?: "dev" | "prd";
2567
- [key: string]: unknown;
2568
- };
2569
- BulkInsertResponse: {
2570
- /** @example 3 */
2571
- inserted: number;
2572
- /** @example 1 */
2573
- updated: number;
2574
- /**
2575
- * @description Always empty on success (TSW-1.3). bulk() is atomic — a single task id collision (P2002) now hard-fails the whole batch with 409 instead of skipping that task and continuing. This field is retained only for response-shape backward compatibility.
2576
- * @example []
2577
- */
2578
- skipped: string[];
2579
- };
2580
- /** @description Tasks to insert, at most 500 per call (TSW-1.3: the whole array runs in one transaction, and the cap bounds that transaction's budget). An over-cap batch is rejected with 400 — split it. */
2581
- BulkInsertBody: {
2582
- /** @example Implement feature X */
2583
- title?: string;
2584
- /** @example pending */
2585
- status?: string;
2586
- /** @example org/repo */
2587
- repo?: string | null;
2588
- [key: string]: unknown;
2589
- }[];
2590
- DistinctResponse: {
2591
- /**
2592
- * @example [
2593
- * "session-1"
2594
- * ]
2595
- */
2596
- sessions: string[];
2597
- /**
2598
- * @example [
2599
- * "org/repo"
2600
- * ]
2601
- */
2602
- repos: string[];
2603
- /**
2604
- * @example [
2605
- * "org"
2606
- * ]
2607
- */
2608
- orgs: string[];
2609
- };
2610
- UpdateTaskBody: {
2611
- [key: string]: unknown;
2612
- };
2613
- ClaimBody: {
2614
- /** @example agent-id-123 */
2615
- claimedBy?: string;
2616
- };
2617
- FailBody: {
2618
- /** @example build failed */
2619
- reason?: string;
2620
- };
2621
- TaskEvent: {
2622
- /** @example clxevent123456 */
2623
- id: string;
2624
- /** @example clx0987654321 */
2625
- taskId: string;
2626
- /** @example status */
2627
- field: string;
2628
- /** @example pending */
2629
- oldValue: string | null;
2630
- /** @example in_progress */
2631
- newValue: string | null;
2632
- /** @example agent-abc123 */
2633
- actor: string | null;
2634
- /** @example claim */
2635
- method: string;
2636
- /** @example 2026-08-17T12:00:00.000Z */
2637
- at: string;
2638
- /**
2639
- * Format: date-time
2640
- * @example 2026-08-17T12:00:00.000Z
2641
- */
2642
- createdAt: string;
2643
- };
2644
- TaskEventsResponse: {
2645
- /** @description This task's TaskEvent audit trail, ordered by `at` ascending (oldest first). */
2646
- events: components["schemas"]["TaskEvent"][];
2647
- /** @example 1 */
2648
- total: number;
2649
- /** @example 50 */
2650
- limit: number;
2651
- /** @example 0 */
2652
- offset: number;
2653
- };
2654
- TaskToken: {
2655
- /** @example clxtoken123456 */
2656
- id: string;
2657
- /** @example ci-runner */
2658
- label?: string | null;
2659
- /** @example agent-id-123 */
2660
- agentId?: string | null;
2661
- /**
2662
- * Format: date-time
2663
- * @example 2026-01-01T00:00:00.000Z
2664
- */
2665
- createdAt: string;
2666
- /**
2667
- * Format: date-time
2668
- * @example null
2669
- */
2670
- revokedAt?: string | null;
2671
- };
2672
- TaskTokenWithRaw: components["schemas"]["TaskToken"] & {
2673
- /** @example raw-token-value-shown-once */
2674
- rawToken: string;
2675
- };
2676
- TokenBody: {
2677
- /** @example ci-runner */
2678
- label?: string;
2679
- /** @example agent-id-123 */
2680
- agentId?: string;
2681
- };
2682
- PrFinding: {
2683
- /** @example clxfinding123456 */
2684
- id: string;
2685
- /** @example clx0987654321 */
2686
- prRecordId: string;
2687
- /** @example src/foo.ts:42 */
2688
- ref: string;
2689
- /**
2690
- * @example resolved
2691
- * @enum {string}
2692
- */
2693
- disposition: "resolved" | "superseded" | "rejected";
2694
- /**
2695
- * @example review
2696
- * @enum {string}
2697
- */
2698
- source: "review" | "patch";
2699
- /** @example Fixed the null check in the follow-up commit. */
2700
- evidence: string;
2701
- /** @example 2026-08-17T12:00:00.000Z */
2702
- at: string;
2703
- /**
2704
- * @description Agent instance that triaged this finding, if any.
2705
- * @example agent-abc123
2706
- */
2707
- agentId: string | null;
2708
- /**
2709
- * Format: date-time
2710
- * @example 2026-08-17T12:00:00.000Z
2711
- */
2712
- createdAt: string;
2713
- };
2714
- PullRequestEvent: {
2715
- /** @example clxevent123456 */
2716
- id: string;
2717
- /** @example clx0987654321 */
2718
- prRecordId: string;
2719
- /** @example reviewState */
2720
- field: string;
2721
- /** @example pending */
2722
- oldValue: string | null;
2723
- /** @example in_progress */
2724
- newValue: string | null;
2725
- /** @example agent-abc123 */
2726
- actor: string | null;
2727
- /** @example claim */
2728
- method: string;
2729
- /** @example 2026-08-17T12:00:00.000Z */
2730
- at: string;
2731
- /**
2732
- * Format: date-time
2733
- * @example 2026-08-17T12:00:00.000Z
2734
- */
2735
- createdAt: string;
2736
- };
2737
- PullRequest: {
2738
- /** @example clx0987654321 */
2739
- id: string;
2740
- /** @example org/repo */
2741
- repo: string;
2742
- /** @example 42 */
2743
- prNumber: number;
2744
- /**
2745
- * @default false
2746
- * @example false
2747
- */
2748
- staged: boolean;
2749
- /**
2750
- * @default open
2751
- * @example open
2752
- * @enum {string}
2753
- */
2754
- state: "open" | "merged" | "closed";
2755
- /**
2756
- * @default pending
2757
- * @example pending
2758
- * @enum {string}
2759
- */
2760
- reviewState: "pending" | "in_progress" | "posted" | "approved";
2761
- /** @example abc123def456 */
2762
- commitSha?: string | null;
2763
- /**
2764
- * @description The review pipeline's exclusive commit-tracking field, separate from the shared commitSha field written by claim()/patch()/deploy for their own multi-phase bookkeeping.
2765
- * @example abc123def456
2766
- */
2767
- reviewedCommitSha?: string | null;
2768
- /**
2769
- * @default 0
2770
- * @example 1
2771
- */
2772
- patchCycles: number;
2773
- /**
2774
- * @default 0
2775
- * @example 0
2776
- */
2777
- reviewCycles: number;
2778
- /** @example agent-id-123 */
2779
- agentId?: string | null;
2780
- /** @example 2026-01-03T00:00:00.000Z */
2781
- reviewedAt?: string | null;
2782
- /** @example null */
2783
- patchedAt?: string | null;
2784
- /** @example null */
2785
- mergedAt?: string | null;
2786
- /**
2787
- * @description ISO timestamp of the GitHub PR's actual creation time. Set once via POST /prs/claim (first claim only); read-only thereafter.
2788
- * @example 2026-01-01T00:00:00.000Z
2789
- */
2790
- prCreatedAt?: string | null;
2791
- /** @example agent-id-123 */
2792
- claimedBy?: string | null;
2793
- /** @example 2026-01-02T00:00:00.000Z */
2794
- claimedAt?: string | null;
2795
- /** @example 2026-01-06T12:00:00.000Z */
2796
- heartbeatAt?: string | null;
2797
- /**
2798
- * @example review
2799
- * @enum {string|null}
2800
- */
2801
- phase?: "review" | "patch" | "deploy" | null;
2802
- /** @example 2026-01-02T00:00:00.000Z */
2803
- readyForReviewAt?: string | null;
2804
- /** @example null */
2805
- readyForPatchAt?: string | null;
2806
- /** @example null */
2807
- readyForDeployAt?: string | null;
2808
- /**
2809
- * @default false
2810
- * @example false
2811
- */
2812
- blocked: boolean;
2813
- /** @example no linked task */
2814
- blockedReason?: string | null;
2815
- /**
2816
- * @description Where this PR record first learned about the PR — first-write-wins (see PullRequestService.stampOrigin()). Null means the row has never been stamped (POM-1.1's accepted gap: a PR that never passes through the pr_open transition, POST /prs/claim, or the census sweep has no origin at all).
2817
- * @example shipwright
2818
- * @enum {string|null}
2819
- */
2820
- origin?: "shipwright" | "ci" | "dependency_bot" | "human" | "unknown" | null;
2821
- /** @example octocat */
2822
- authorLogin?: string | null;
2823
- /** @example feat/some-branch */
2824
- headRef?: string | null;
2825
- /** @example Add the origin metrics dimension */
2826
- title?: string | null;
2827
- /**
2828
- * @description Total commit count on this PR (CPP-1.1). Written unconditionally by POST /prs/census whenever supplied — mirrors authorLogin/headRef/title, not origin's first-write-wins semantic.
2829
- * @example 12
2830
- */
2831
- commitCount?: number | null;
2832
- /**
2833
- * @description Commits attributed to the docs-refresher subagent (CPP-1.1).
2834
- * @example 1
2835
- */
2836
- commitsDocsRefresh?: number | null;
2837
- /**
2838
- * @description Commits attributed to the review/patch cycle (CPP-1.1).
2839
- * @example 3
2840
- */
2841
- commitsReviewPatch?: number | null;
2842
- /**
2843
- * @description Commits attributed to CI-fix cycles (CPP-1.1).
2844
- * @example 2
2845
- */
2846
- commitsCiFix?: number | null;
2847
- /**
2848
- * @description Commits attributed to the initial implementation (CPP-1.1).
2849
- * @example 6
2850
- */
2851
- commitsImplementation?: number | null;
2852
- /**
2853
- * @description Consecutive skip count. Auto-blocks (blocked+blockedReason) once it crosses the threshold (3). POST /prs/:id/skip/reset resets this to 0 and, only when blockedReason matches the skip-auto-block message pattern (contains 'consecutive skips'), also clears blocked/blockedReason — a block set by a different mechanism (e.g. the CI-failure-streak auto-block) is left untouched.
2854
- * @default 0
2855
- * @example 0
2856
- */
2857
- skipCount: number;
2858
- /** @example 2026-01-02T00:00:00.000Z */
2859
- lastSkippedAt?: string | null;
2860
- /**
2861
- * @description Signature of the most recent CI failure reported via POST /prs/:id/patch's ciFailureSignature field. Used to detect consecutive patch cycles hitting the same CI failure.
2862
- * @example npm-test-failed-foo.unit.test.ts
2863
- */
2864
- lastCiFailureSignature?: string | null;
2865
- /**
2866
- * @description Count of consecutive patch() calls whose ciFailureSignature matched lastCiFailureSignature. Auto-blocks (blocked+blockedReason) once it crosses the threshold (3).
2867
- * @default 0
2868
- * @example 0
2869
- */
2870
- consecutiveCiFailureCount: number;
2871
- /**
2872
- * Format: date-time
2873
- * @example 2026-01-01T00:00:00.000Z
2874
- */
2875
- createdAt: string;
2876
- /**
2877
- * Format: date-time
2878
- * @example 2026-01-06T12:00:00.000Z
2879
- */
2880
- updatedAt: string;
2881
- /** @description Review/patch findings recorded against this PR, if the caller's query included them (GET /prs/:id and list responses always include this array). */
2882
- findings?: components["schemas"]["PrFinding"][];
2883
- /** @description Field-level state transition audit trail for this PR, if the caller's query included them (GET /prs/:id and list responses always include this array). */
2884
- events?: components["schemas"]["PullRequestEvent"][];
2885
- };
2886
- PrListResponse: {
2887
- /** @description Array of pull requests */
2888
- prs: components["schemas"]["PullRequest"][];
2889
- /** @example 1 */
2890
- total: number;
2891
- /** @example 50 */
2892
- limit: number;
2893
- /** @example 0 */
2894
- offset: number;
2895
- };
2896
- ClaimPrBody: {
2897
- /**
2898
- * @description Repository in org/repo format
2899
- * @example org/repo
2900
- */
2901
- repo: string;
2902
- /**
2903
- * @description Pull request number
2904
- * @example 42
2905
- */
2906
- prNumber: number;
2907
- /**
2908
- * @description Commit SHA to associate
2909
- * @example abc123def456
2910
- */
2911
- commitSha: string;
2912
- /**
2913
- * @description Agent claiming this PR (admin tokens only)
2914
- * @example agent-id-123
2915
- */
2916
- claimedBy?: string;
2917
- /**
2918
- * @description Pipeline phase this claim is for (defaults to 'review' when omitted)
2919
- * @example patch
2920
- * @enum {string}
2921
- */
2922
- phase?: "review" | "patch" | "deploy";
2923
- /**
2924
- * @description ISO timestamp of the GitHub PR's actual creation time. Only applied on first claim (record creation); ignored on subsequent claims since the field is immutable once set.
2925
- * @example 2026-01-01T00:00:00.000Z
2926
- */
2927
- prCreatedAt?: string;
2928
- /**
2929
- * @description PR author's GitHub login (POM-1.2). Used server-side to derive `origin` (first-write-wins) and refreshed unconditionally on every claim.
2930
- * @example octocat
2931
- */
2932
- authorLogin?: string | null;
2933
- /**
2934
- * @description PR's head branch name (POM-1.2). Used server-side to derive `origin` (first-write-wins) and refreshed unconditionally on every claim.
2935
- * @example feat/some-branch
2936
- */
2937
- headRef?: string | null;
2938
- /**
2939
- * @description PR title (POM-1.2). Refreshed unconditionally on every claim.
2940
- * @example Add the origin metrics dimension
2941
- */
2942
- title?: string | null;
2943
- };
2944
- ClaimNextResponse: {
2945
- pr: components["schemas"]["PullRequest"];
2946
- /**
2947
- * @example review
2948
- * @enum {string}
2949
- */
2950
- phase: "review" | "patch" | "deploy";
2951
- };
2952
- ClaimNextBody: {
2953
- /**
2954
- * @description Agent ID (admin tokens only; agent tokens use token identity)
2955
- * @example agent-id-123
2956
- */
2957
- agentId?: string;
2958
- /**
2959
- * @description Maximum concurrent PRs to claim
2960
- * @example 1
2961
- */
2962
- maxConcurrent?: number;
2963
- };
2964
- CensusResponse: {
2965
- /** @description The upserted PullRequest rows, one per input entry. */
2966
- prs: components["schemas"]["PullRequest"][];
2967
- };
2968
- CensusEntry: {
2969
- /** @example org/repo */
2970
- repo: string;
2971
- /** @example 42 */
2972
- prNumber: number;
2973
- /**
2974
- * @description First-write-wins: only applied when the row's existing origin is currently null.
2975
- * @example unknown
2976
- * @enum {string}
2977
- */
2978
- origin?: "shipwright" | "ci" | "dependency_bot" | "human" | "unknown";
2979
- /** @example octocat */
2980
- authorLogin?: string | null;
2981
- /** @example feat/some-branch */
2982
- headRef?: string | null;
2983
- /** @example Add the origin metrics dimension */
2984
- title?: string | null;
2985
- /**
2986
- * @example merged
2987
- * @enum {string}
2988
- */
2989
- state?: "open" | "merged" | "closed";
2990
- /** @example 2026-01-04T00:00:00.000Z */
2991
- mergedAt?: string | null;
2992
- /** @example 2026-01-01T00:00:00.000Z */
2993
- prCreatedAt?: string | null;
2994
- /** @example 12 */
2995
- commitCount?: number | null;
2996
- /** @example 1 */
2997
- commitsDocsRefresh?: number | null;
2998
- /** @example 3 */
2999
- commitsReviewPatch?: number | null;
3000
- /** @example 2 */
3001
- commitsCiFix?: number | null;
3002
- /** @example 6 */
3003
- commitsImplementation?: number | null;
3004
- };
3005
- /** @description Entries to upsert, at most 200 per call — the whole batch runs in one transaction. An over-cap batch is rejected with 400. */
3006
- CensusBody: components["schemas"]["CensusEntry"][];
3007
- CensusCursorResponse: {
3008
- /**
3009
- * @description Max mergedAt (ISO string) among rows scoped to `repo` whose origin is not null, or null when no such row exists.
3010
- * @example 2026-01-04T00:00:00.000Z
3011
- */
3012
- cursor: string | null;
3013
- };
3014
- UpdatePrBody: {
3015
- [key: string]: unknown;
3016
- };
3017
- PatchPrBody: {
3018
- /**
3019
- * @description Current head commit SHA. When provided and it differs from the record's stored commitSha, reviewState resets to pending and commitSha is updated. When it matches, reviewState is left untouched (no-op patch cycle). When omitted, reviewState unconditionally resets to pending (legacy behavior).
3020
- * @example abc123def456
3021
- */
3022
- commitSha?: string;
3023
- /**
3024
- * @description Signature identifying the current CI failure (e.g. which check + which test). When it matches the record's stored lastCiFailureSignature, consecutiveCiFailureCount increments; when it differs (or none is stored), the count resets to 1 and the new signature is stored. Crossing CI_FAILURE_BLOCK_THRESHOLD (3) auto-sets blocked:true plus a descriptive blockedReason. When omitted (e.g. merge-conflict/review-fix patch calls unrelated to CI), both fields are left untouched.
3025
- * @example npm-test-failed-foo.unit.test.ts
3026
- */
3027
- ciFailureSignature?: string;
3028
- };
3029
- CreateFindingBody: {
3030
- /**
3031
- * @description Identifier for the finding (e.g. file:line or a slug).
3032
- * @example src/foo.ts:42
3033
- */
3034
- ref: string;
3035
- /**
3036
- * @description Triage outcome. source:'patch' may only submit 'rejected' — server-enforced (400 otherwise); source:'review' may submit any value.
3037
- * @example resolved
3038
- * @enum {string}
3039
- */
3040
- disposition: "resolved" | "superseded" | "rejected";
3041
- /**
3042
- * @description Which pipeline phase is recording this finding.
3043
- * @example review
3044
- * @enum {string}
3045
- */
3046
- source: "review" | "patch";
3047
- /** @example Fixed the null check in the follow-up commit. */
3048
- evidence: string;
3049
- /**
3050
- * @description ISO timestamp of when the finding was triaged. Defaults to the current time when omitted.
3051
- * @example 2026-08-17T12:00:00.000Z
3052
- */
3053
- at?: string;
3054
- /**
3055
- * @description Agent instance that triaged this finding.
3056
- * @example agent-abc123
3057
- */
3058
- agentId?: string;
3059
- };
3060
- PrEventsResponse: {
3061
- /** @description This PR's PullRequestEvent audit trail, ordered by `at` ascending (oldest first). */
3062
- events: components["schemas"]["PullRequestEvent"][];
3063
- /** @example 1 */
3064
- total: number;
3065
- /** @example 50 */
3066
- limit: number;
3067
- /** @example 0 */
3068
- offset: number;
3069
- };
3070
- Session: {
3071
- /** @example shipwright-may-launch */
3072
- slug: string;
3073
- /** @example May launch prep */
3074
- title?: string | null;
3075
- /**
3076
- * Format: date-time
3077
- * @example 2026-01-01T00:00:00.000Z
3078
- */
3079
- createdAt: string;
3080
- /**
3081
- * Format: date-time
3082
- * @example 2026-01-06T12:00:00.000Z
3083
- */
3084
- updatedAt: string;
3085
- /** @example null */
3086
- archivedAt?: string | null;
3087
- /** @example null */
3088
- archivedBy?: string | null;
3089
- /**
3090
- * @example active
3091
- * @enum {string}
3092
- */
3093
- state: "waiting" | "active" | "closed" | "empty";
3094
- /** @example 2026-01-01T00:00:00.000Z */
3095
- waitingSince: string | null;
3096
- /** @example 2026-01-06T12:00:00.000Z */
3097
- lastActivityAt: string | null;
3098
- /**
3099
- * @example {
3100
- * "total": 3,
3101
- * "open": 2,
3102
- * "closed": 1
3103
- * }
3104
- */
3105
- counts: {
3106
- total: number;
3107
- open: number;
3108
- closed: number;
3109
- };
3110
- /**
3111
- * @example [
3112
- * "agent-1"
3113
- * ]
3114
- */
3115
- agentIds: string[];
3116
- /**
3117
- * @example [
3118
- * "org/repo"
3119
- * ]
3120
- */
3121
- repos: string[];
3122
- /**
3123
- * @example [
3124
- * {
3125
- * "id": "task-1",
3126
- * "kind": "hitl"
3127
- * }
3128
- * ]
3129
- */
3130
- waitingTasks: {
3131
- id: string;
3132
- /** @enum {string} */
3133
- kind: "hitl" | "blocked" | "pr_blocked";
3134
- }[];
3135
- /** @example false */
3136
- archived: boolean;
3137
- };
3138
- SessionListResponse: {
3139
- sessions: components["schemas"]["Session"][];
3140
- /** @example 10 */
3141
- total: number;
3142
- /** @example 50 */
3143
- limit: number;
3144
- /** @example 0 */
3145
- offset: number;
3146
- };
3147
- SessionPatchBody: {
3148
- /**
3149
- * @description Omitted: title untouched. A string: set. null: clears the title.
3150
- * @example May launch prep
3151
- */
3152
- title?: string | null;
3153
- /**
3154
- * @description Omitted: archive fields untouched. true: stamps archivedAt/archivedBy. false: clears both.
3155
- * @example true
3156
- */
3157
- archived?: boolean;
3158
- };
3159
- VerificationCheck: {
3160
- /** @example clxvcheck1234567 */
3161
- id: string;
3162
- /** @example null */
3163
- taskId: string | null;
3164
- /** @example clx0987654321 */
3165
- prRecordId: string | null;
3166
- /** @example org/repo */
3167
- repo: string;
3168
- /** @example unit */
3169
- checkName: string;
3170
- /**
3171
- * @description Outcome of the check attempt. A 'ran_failed' row must never carry a reasonCategory — that field means the agent could not attempt/complete the check in its own environment, never that the code has a real problem.
3172
- * @example ran_passed
3173
- * @enum {string}
3174
- */
3175
- status: "ran_passed" | "ran_failed" | "skipped" | "timed_out";
3176
- /**
3177
- * @description A closed set of ENVIRONMENTAL causes, only valid alongside status: 'skipped' or 'timed_out'.
3178
- * @example null
3179
- * @enum {string|null}
3180
- */
3181
- reasonCategory: "check_timeout" | "install_timeout" | "resource_limit" | "missing_tool" | "missing_secret" | "missing_dependency" | "not_configured" | "learned_skip" | null;
3182
- /**
3183
- * @description Only valid alongside reasonCategory: 'learned_skip' — the original root-cause category that triggered the learned classification.
3184
- * @example null
3185
- * @enum {string|null}
3186
- */
3187
- learnedFromCategory: "check_timeout" | "install_timeout" | "resource_limit" | "missing_tool" | "missing_secret" | "missing_dependency" | "not_configured" | "learned_skip" | null;
3188
- /** @example 4200 */
3189
- durationMs: number | null;
3190
- /** @example 2026-09-24T12:00:00.000Z */
3191
- at: string;
3192
- /**
3193
- * Format: date-time
3194
- * @example 2026-09-24T12:00:00.000Z
3195
- */
3196
- createdAt: string;
3197
- };
3198
- CreateVerificationCheckBody: {
3199
- /**
3200
- * @description Exactly one of taskId/prId is required — supplying neither or both is 400.
3201
- * @example clx1234567890
3202
- */
3203
- taskId?: string;
3204
- /** @example clx0987654321 */
3205
- prId?: string;
3206
- /** @example org/repo */
3207
- repo: string;
3208
- /**
3209
- * @description Free-form check name — 'install', 'lint', 'typecheck', 'unit', 'integration', etc.
3210
- * @example unit
3211
- */
3212
- checkName: string;
3213
- /**
3214
- * @example ran_passed
3215
- * @enum {string}
3216
- */
3217
- status: "ran_passed" | "ran_failed" | "skipped" | "timed_out";
3218
- /**
3219
- * @description Only valid alongside status: 'skipped' or 'timed_out'. A status:'ran_failed' (or 'ran_passed') request supplying this is 400.
3220
- * @example missing_tool
3221
- * @enum {string}
3222
- */
3223
- reasonCategory?: "check_timeout" | "install_timeout" | "resource_limit" | "missing_tool" | "missing_secret" | "missing_dependency" | "not_configured" | "learned_skip";
3224
- /**
3225
- * @description Only valid alongside reasonCategory: 'learned_skip', and must not itself be 'learned_skip'.
3226
- * @example missing_tool
3227
- * @enum {string}
3228
- */
3229
- learnedFromCategory?: "check_timeout" | "install_timeout" | "resource_limit" | "missing_tool" | "missing_secret" | "missing_dependency" | "not_configured" | "learned_skip";
3230
- /** @example 4200 */
3231
- durationMs?: number;
3232
- /**
3233
- * @description ISO timestamp of when the check completed. Defaults to the current time when omitted.
3234
- * @example 2026-09-24T12:00:00.000Z
3235
- */
3236
- at?: string;
3237
- };
3238
- VerificationCheckListResponse: {
3239
- /** @description Verification checks matching the selected mode. Ordered by `at` ascending (oldest first) for taskId/prId modes; ordered by `at` descending (most recent first) for repo+checkName mode. */
3240
- checks: components["schemas"]["VerificationCheck"][];
3241
- /** @example 1 */
3242
- total: number;
3243
- /** @example 50 */
3244
- limit: number;
3245
- /** @example 0 */
3246
- offset: number;
3247
- };
3248
- };
3249
- responses: never;
3250
- parameters: never;
3251
- requestBodies: never;
3252
- headers: never;
3253
- pathItems: never;
3254
- }
3255
- export type $defs = Record<string, never>;
3256
- export type operations = Record<string, never>;