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

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.
@@ -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) {