@wjarka/cezarion 0.14.9-dev.1017 → 0.14.9-dev.1020

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.
@@ -486,18 +486,6 @@ export declare function createDelegationRoutes(service: DelegationService, crede
486
486
  } & {
487
487
  "/:workerId": {
488
488
  $get: {
489
- output: {
490
- error: string;
491
- code?: "invalid_input" | undefined;
492
- };
493
- outputFormat: "json";
494
- status: 400;
495
- input: {
496
- param: {
497
- workerId: string;
498
- };
499
- };
500
- } | {
501
489
  output: {
502
490
  workerId: string;
503
491
  parentRunId: string;
@@ -574,11 +562,7 @@ export declare function createDelegationRoutes(service: DelegationService, crede
574
562
  workerId: string;
575
563
  };
576
564
  };
577
- };
578
- };
579
- } & {
580
- "/:workerId/collect": {
581
- $post: {
565
+ } | {
582
566
  output: {
583
567
  error: string;
584
568
  code?: "invalid_input" | undefined;
@@ -589,10 +573,12 @@ export declare function createDelegationRoutes(service: DelegationService, crede
589
573
  param: {
590
574
  workerId: string;
591
575
  };
592
- } & {
593
- json: Record<string, never>;
594
576
  };
595
- } | {
577
+ };
578
+ };
579
+ } & {
580
+ "/:workerId/collect": {
581
+ $post: {
596
582
  output: {
597
583
  workerId: string;
598
584
  parentRunId: string;
@@ -694,11 +680,7 @@ export declare function createDelegationRoutes(service: DelegationService, crede
694
680
  } & {
695
681
  json: Record<string, never>;
696
682
  };
697
- };
698
- };
699
- } & {
700
- "/:workerId/steer": {
701
- $post: {
683
+ } | {
702
684
  output: {
703
685
  error: string;
704
686
  code?: "invalid_input" | undefined;
@@ -710,11 +692,13 @@ export declare function createDelegationRoutes(service: DelegationService, crede
710
692
  workerId: string;
711
693
  };
712
694
  } & {
713
- json: {
714
- text: string;
715
- };
695
+ json: Record<string, never>;
716
696
  };
717
- } | {
697
+ };
698
+ };
699
+ } & {
700
+ "/:workerId/steer": {
701
+ $post: {
718
702
  output: {
719
703
  workerId: string;
720
704
  state: "delivered" | "queued";
@@ -730,11 +714,7 @@ export declare function createDelegationRoutes(service: DelegationService, crede
730
714
  text: string;
731
715
  };
732
716
  };
733
- };
734
- };
735
- } & {
736
- "/:workerId/stop": {
737
- $post: {
717
+ } | {
738
718
  output: {
739
719
  error: string;
740
720
  code?: "invalid_input" | undefined;
@@ -746,9 +726,15 @@ export declare function createDelegationRoutes(service: DelegationService, crede
746
726
  workerId: string;
747
727
  };
748
728
  } & {
749
- json: Record<string, never>;
729
+ json: {
730
+ text: string;
731
+ };
750
732
  };
751
- } | {
733
+ };
734
+ };
735
+ } & {
736
+ "/:workerId/stop": {
737
+ $post: {
752
738
  output: {
753
739
  workerId: string;
754
740
  state: "stopping" | "terminated";
@@ -762,11 +748,7 @@ export declare function createDelegationRoutes(service: DelegationService, crede
762
748
  } & {
763
749
  json: Record<string, never>;
764
750
  };
765
- };
766
- };
767
- } & {
768
- "/:workerId/destroy": {
769
- $post: {
751
+ } | {
770
752
  output: {
771
753
  error: string;
772
754
  code?: "invalid_input" | undefined;
@@ -780,7 +762,11 @@ export declare function createDelegationRoutes(service: DelegationService, crede
780
762
  } & {
781
763
  json: Record<string, never>;
782
764
  };
783
- } | {
765
+ };
766
+ };
767
+ } & {
768
+ "/:workerId/destroy": {
769
+ $post: {
784
770
  output: {
785
771
  workerId: string;
786
772
  state: "complete" | "incomplete";
@@ -803,6 +789,20 @@ export declare function createDelegationRoutes(service: DelegationService, crede
803
789
  } & {
804
790
  json: Record<string, never>;
805
791
  };
792
+ } | {
793
+ output: {
794
+ error: string;
795
+ code?: "invalid_input" | undefined;
796
+ };
797
+ outputFormat: "json";
798
+ status: 400;
799
+ input: {
800
+ param: {
801
+ workerId: string;
802
+ };
803
+ } & {
804
+ json: Record<string, never>;
805
+ };
806
806
  } | {
807
807
  output: {
808
808
  workerId: string;
@@ -832,11 +832,13 @@ export declare function createDelegationRoutes(service: DelegationService, crede
832
832
  "/:workerId/diff": {
833
833
  $get: {
834
834
  output: {
835
- error: string;
836
- code?: "invalid_input" | undefined;
835
+ workerId: string;
836
+ baselineSha: string;
837
+ diff: string;
838
+ truncated: boolean;
837
839
  };
838
840
  outputFormat: "json";
839
- status: 400;
841
+ status: 200;
840
842
  input: {
841
843
  param: {
842
844
  workerId: string;
@@ -844,13 +846,11 @@ export declare function createDelegationRoutes(service: DelegationService, crede
844
846
  };
845
847
  } | {
846
848
  output: {
847
- workerId: string;
848
- baselineSha: string;
849
- diff: string;
850
- truncated: boolean;
849
+ error: string;
850
+ code?: "invalid_input" | undefined;
851
851
  };
852
852
  outputFormat: "json";
853
- status: 200;
853
+ status: 400;
854
854
  input: {
855
855
  param: {
856
856
  workerId: string;
@@ -461,6 +461,18 @@ export declare function createDelegationApp(routes: DelegationRoutes): import("h
461
461
  } & {
462
462
  "/:workerId": {
463
463
  $get: {
464
+ output: {
465
+ error: string;
466
+ code?: "invalid_input" | undefined;
467
+ };
468
+ outputFormat: "json";
469
+ status: 400;
470
+ input: {
471
+ param: {
472
+ workerId: string;
473
+ };
474
+ };
475
+ } | {
464
476
  output: {
465
477
  workerId: string;
466
478
  parentRunId: string;
@@ -537,7 +549,11 @@ export declare function createDelegationApp(routes: DelegationRoutes): import("h
537
549
  workerId: string;
538
550
  };
539
551
  };
540
- } | {
552
+ };
553
+ };
554
+ } & {
555
+ "/:workerId/collect": {
556
+ $post: {
541
557
  output: {
542
558
  error: string;
543
559
  code?: "invalid_input" | undefined;
@@ -548,12 +564,10 @@ export declare function createDelegationApp(routes: DelegationRoutes): import("h
548
564
  param: {
549
565
  workerId: string;
550
566
  };
567
+ } & {
568
+ json: Record<string, never>;
551
569
  };
552
- };
553
- };
554
- } & {
555
- "/:workerId/collect": {
556
- $post: {
570
+ } | {
557
571
  output: {
558
572
  workerId: string;
559
573
  parentRunId: string;
@@ -655,7 +669,11 @@ export declare function createDelegationApp(routes: DelegationRoutes): import("h
655
669
  } & {
656
670
  json: Record<string, never>;
657
671
  };
658
- } | {
672
+ };
673
+ };
674
+ } & {
675
+ "/:workerId/steer": {
676
+ $post: {
659
677
  output: {
660
678
  error: string;
661
679
  code?: "invalid_input" | undefined;
@@ -667,13 +685,11 @@ export declare function createDelegationApp(routes: DelegationRoutes): import("h
667
685
  workerId: string;
668
686
  };
669
687
  } & {
670
- json: Record<string, never>;
688
+ json: {
689
+ text: string;
690
+ };
671
691
  };
672
- };
673
- };
674
- } & {
675
- "/:workerId/steer": {
676
- $post: {
692
+ } | {
677
693
  output: {
678
694
  workerId: string;
679
695
  state: "delivered" | "queued";
@@ -689,7 +705,11 @@ export declare function createDelegationApp(routes: DelegationRoutes): import("h
689
705
  text: string;
690
706
  };
691
707
  };
692
- } | {
708
+ };
709
+ };
710
+ } & {
711
+ "/:workerId/stop": {
712
+ $post: {
693
713
  output: {
694
714
  error: string;
695
715
  code?: "invalid_input" | undefined;
@@ -701,15 +721,9 @@ export declare function createDelegationApp(routes: DelegationRoutes): import("h
701
721
  workerId: string;
702
722
  };
703
723
  } & {
704
- json: {
705
- text: string;
706
- };
724
+ json: Record<string, never>;
707
725
  };
708
- };
709
- };
710
- } & {
711
- "/:workerId/stop": {
712
- $post: {
726
+ } | {
713
727
  output: {
714
728
  workerId: string;
715
729
  state: "stopping" | "terminated";
@@ -723,7 +737,11 @@ export declare function createDelegationApp(routes: DelegationRoutes): import("h
723
737
  } & {
724
738
  json: Record<string, never>;
725
739
  };
726
- } | {
740
+ };
741
+ };
742
+ } & {
743
+ "/:workerId/destroy": {
744
+ $post: {
727
745
  output: {
728
746
  error: string;
729
747
  code?: "invalid_input" | undefined;
@@ -737,11 +755,7 @@ export declare function createDelegationApp(routes: DelegationRoutes): import("h
737
755
  } & {
738
756
  json: Record<string, never>;
739
757
  };
740
- };
741
- };
742
- } & {
743
- "/:workerId/destroy": {
744
- $post: {
758
+ } | {
745
759
  output: {
746
760
  workerId: string;
747
761
  state: "complete" | "incomplete";
@@ -764,20 +778,6 @@ export declare function createDelegationApp(routes: DelegationRoutes): import("h
764
778
  } & {
765
779
  json: Record<string, never>;
766
780
  };
767
- } | {
768
- output: {
769
- error: string;
770
- code?: "invalid_input" | undefined;
771
- };
772
- outputFormat: "json";
773
- status: 400;
774
- input: {
775
- param: {
776
- workerId: string;
777
- };
778
- } & {
779
- json: Record<string, never>;
780
- };
781
781
  } | {
782
782
  output: {
783
783
  workerId: string;
@@ -807,13 +807,11 @@ export declare function createDelegationApp(routes: DelegationRoutes): import("h
807
807
  "/:workerId/diff": {
808
808
  $get: {
809
809
  output: {
810
- workerId: string;
811
- baselineSha: string;
812
- diff: string;
813
- truncated: boolean;
810
+ error: string;
811
+ code?: "invalid_input" | undefined;
814
812
  };
815
813
  outputFormat: "json";
816
- status: 200;
814
+ status: 400;
817
815
  input: {
818
816
  param: {
819
817
  workerId: string;
@@ -821,11 +819,13 @@ export declare function createDelegationApp(routes: DelegationRoutes): import("h
821
819
  };
822
820
  } | {
823
821
  output: {
824
- error: string;
825
- code?: "invalid_input" | undefined;
822
+ workerId: string;
823
+ baselineSha: string;
824
+ diff: string;
825
+ truncated: boolean;
826
826
  };
827
827
  outputFormat: "json";
828
- status: 400;
828
+ status: 200;
829
829
  input: {
830
830
  param: {
831
831
  workerId: string;
@@ -1282,6 +1282,16 @@ export declare class RunStore extends EventEmitter {
1282
1282
  setRepoHandle(handle: RepoHandle | null): void;
1283
1283
  listRuns(): RunRecord[];
1284
1284
  getRun(id: string): RunRecord | undefined;
1285
+ /**
1286
+ * The workers a root run owns, newest first, read off its own `receipts` (#659). Every
1287
+ * `createOwnedRun` writes the receipt and the worker record in one transaction, and the
1288
+ * receipt list is capped at 32, so this is a bounded lookup rather than a walk of the whole
1289
+ * project index. An ordinary or worker run owns nothing and costs one map read; a receipt
1290
+ * whose record has been deleted is skipped, never invented. A parent quarantined to
1291
+ * `invalid` has no readable receipts and reports none, which is also what the cockpit
1292
+ * assumes for that role.
1293
+ */
1294
+ listOwnedWorkers(parentId: string): RunRecord[];
1285
1295
  /** The run an idempotent start already created (#504), archived or not. A deleted run is gone
1286
1296
  * with its record, so a retry after deletion honestly creates a fresh one. */
1287
1297
  findRunByClientRequestId(clientRequestId: string): RunRecord | undefined;
@@ -792,6 +792,27 @@ export class RunStore extends EventEmitter {
792
792
  getRun(id) {
793
793
  return this.runs.get(id);
794
794
  }
795
+ /**
796
+ * The workers a root run owns, newest first, read off its own `receipts` (#659). Every
797
+ * `createOwnedRun` writes the receipt and the worker record in one transaction, and the
798
+ * receipt list is capped at 32, so this is a bounded lookup rather than a walk of the whole
799
+ * project index. An ordinary or worker run owns nothing and costs one map read; a receipt
800
+ * whose record has been deleted is skipped, never invented. A parent quarantined to
801
+ * `invalid` has no readable receipts and reports none, which is also what the cockpit
802
+ * assumes for that role.
803
+ */
804
+ listOwnedWorkers(parentId) {
805
+ const parent = this.runs.get(parentId);
806
+ if (parent?.delegation?.role !== 'root')
807
+ return [];
808
+ const workers = [];
809
+ for (const receipt of parent.delegation.receipts) {
810
+ const worker = this.runs.get(receipt.workerId);
811
+ if (worker?.delegation?.role === 'worker' && worker.delegation.parentRunId === parentId)
812
+ workers.push(worker);
813
+ }
814
+ return workers.sort((a, b) => b.createdAt.localeCompare(a.createdAt));
815
+ }
795
816
  /** The run an idempotent start already created (#504), archived or not. A deleted run is gone
796
817
  * with its record, so a retry after deletion honestly creates a fresh one. */
797
818
  findRunByClientRequestId(clientRequestId) {