@wjarka/cezarion 0.17.0-dev.5515 → 0.17.0-dev.5525
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/ci-wait/controller.d.ts +37 -37
- package/dist/delegation/routes.d.ts +62 -62
- package/dist/server/activity-routes.d.ts +23 -23
- package/dist/server/run-checkout.d.ts +26 -1
- package/dist/server/run-checkout.js +80 -1
- package/dist/server/run-checkout.js.map +1 -1
- package/dist/server/self-update-routes.d.ts +19 -19
- package/dist/server/server.d.ts +1413 -1519
- package/dist/server/server.js +36 -69
- package/dist/server/server.js.map +1 -1
- package/dist/voice/routes.d.ts +19 -19
- package/package.json +3 -3
|
@@ -288,11 +288,12 @@ export declare function ciToolRoutes(capabilities: Map<string, Capability>): imp
|
|
|
288
288
|
"/api/v1/tools/ask": {
|
|
289
289
|
$post: {
|
|
290
290
|
output: {
|
|
291
|
-
|
|
291
|
+
ok: false;
|
|
292
|
+
code: 'unavailable';
|
|
292
293
|
message: string;
|
|
293
294
|
};
|
|
294
295
|
outputFormat: "json";
|
|
295
|
-
status:
|
|
296
|
+
status: import("hono/utils/http-status").ContentfulStatusCode;
|
|
296
297
|
input: {
|
|
297
298
|
json: {
|
|
298
299
|
questions: {
|
|
@@ -310,12 +311,11 @@ export declare function ciToolRoutes(capabilities: Map<string, Capability>): imp
|
|
|
310
311
|
};
|
|
311
312
|
} | {
|
|
312
313
|
output: {
|
|
313
|
-
|
|
314
|
-
code: 'unavailable';
|
|
314
|
+
code: 'capability_revoked';
|
|
315
315
|
message: string;
|
|
316
316
|
};
|
|
317
317
|
outputFormat: "json";
|
|
318
|
-
status:
|
|
318
|
+
status: 401;
|
|
319
319
|
input: {
|
|
320
320
|
json: {
|
|
321
321
|
questions: {
|
|
@@ -383,11 +383,12 @@ export declare function ciToolRoutes(capabilities: Map<string, Capability>): imp
|
|
|
383
383
|
"/api/v1/tools/cancel-wait": {
|
|
384
384
|
$post: {
|
|
385
385
|
output: {
|
|
386
|
-
|
|
386
|
+
cancelled: false;
|
|
387
|
+
code: 'unavailable';
|
|
387
388
|
message: string;
|
|
388
389
|
};
|
|
389
390
|
outputFormat: "json";
|
|
390
|
-
status:
|
|
391
|
+
status: import("hono/utils/http-status").ContentfulStatusCode;
|
|
391
392
|
input: {
|
|
392
393
|
json: {
|
|
393
394
|
wait_id: string;
|
|
@@ -395,12 +396,11 @@ export declare function ciToolRoutes(capabilities: Map<string, Capability>): imp
|
|
|
395
396
|
};
|
|
396
397
|
} | {
|
|
397
398
|
output: {
|
|
398
|
-
|
|
399
|
-
code: 'unavailable';
|
|
399
|
+
code: 'capability_revoked';
|
|
400
400
|
message: string;
|
|
401
401
|
};
|
|
402
402
|
outputFormat: "json";
|
|
403
|
-
status:
|
|
403
|
+
status: 401;
|
|
404
404
|
input: {
|
|
405
405
|
json: {
|
|
406
406
|
wait_id: string;
|
|
@@ -448,11 +448,12 @@ export declare function ciToolRoutes(capabilities: Map<string, Capability>): imp
|
|
|
448
448
|
"/api/v1/tools/done": {
|
|
449
449
|
$post: {
|
|
450
450
|
output: {
|
|
451
|
-
|
|
451
|
+
ok: false;
|
|
452
|
+
code: 'unavailable';
|
|
452
453
|
message: string;
|
|
453
454
|
};
|
|
454
455
|
outputFormat: "json";
|
|
455
|
-
status:
|
|
456
|
+
status: import("hono/utils/http-status").ContentfulStatusCode;
|
|
456
457
|
input: {
|
|
457
458
|
json: {
|
|
458
459
|
summary?: string | undefined;
|
|
@@ -460,12 +461,11 @@ export declare function ciToolRoutes(capabilities: Map<string, Capability>): imp
|
|
|
460
461
|
};
|
|
461
462
|
} | {
|
|
462
463
|
output: {
|
|
463
|
-
|
|
464
|
-
code: 'unavailable';
|
|
464
|
+
code: 'capability_revoked';
|
|
465
465
|
message: string;
|
|
466
466
|
};
|
|
467
467
|
outputFormat: "json";
|
|
468
|
-
status:
|
|
468
|
+
status: 401;
|
|
469
469
|
input: {
|
|
470
470
|
json: {
|
|
471
471
|
summary?: string | undefined;
|
|
@@ -533,11 +533,13 @@ export declare function ciToolRoutes(capabilities: Map<string, Capability>): imp
|
|
|
533
533
|
"/api/v1/tools/preview-stop": {
|
|
534
534
|
$post: {
|
|
535
535
|
output: {
|
|
536
|
-
|
|
536
|
+
ok: boolean;
|
|
537
|
+
code: "adopted" | "approval_required" | "headless" | "invalid_input" | "not_registered" | "port_held" | "port_in_use" | "preview_disabled" | "restarted" | "stopped" | "unavailable" | "worktree_missing";
|
|
537
538
|
message: string;
|
|
539
|
+
hint: string;
|
|
538
540
|
};
|
|
539
541
|
outputFormat: "json";
|
|
540
|
-
status:
|
|
542
|
+
status: import("hono/utils/http-status").ContentfulStatusCode;
|
|
541
543
|
input: {
|
|
542
544
|
json: {
|
|
543
545
|
port: number;
|
|
@@ -546,13 +548,11 @@ export declare function ciToolRoutes(capabilities: Map<string, Capability>): imp
|
|
|
546
548
|
};
|
|
547
549
|
} | {
|
|
548
550
|
output: {
|
|
549
|
-
|
|
550
|
-
code: "adopted" | "approval_required" | "headless" | "invalid_input" | "not_registered" | "port_held" | "port_in_use" | "preview_disabled" | "restarted" | "stopped" | "unavailable" | "worktree_missing";
|
|
551
|
+
code: 'capability_revoked';
|
|
551
552
|
message: string;
|
|
552
|
-
hint: string;
|
|
553
553
|
};
|
|
554
554
|
outputFormat: "json";
|
|
555
|
-
status:
|
|
555
|
+
status: 401;
|
|
556
556
|
input: {
|
|
557
557
|
json: {
|
|
558
558
|
port: number;
|
|
@@ -565,11 +565,13 @@ export declare function ciToolRoutes(capabilities: Map<string, Capability>): imp
|
|
|
565
565
|
"/api/v1/tools/preview-serve": {
|
|
566
566
|
$post: {
|
|
567
567
|
output: {
|
|
568
|
-
|
|
568
|
+
ok: boolean;
|
|
569
|
+
code: "cezar_port" | "cwd_outside_worktree" | "headless" | "invalid_input" | "port_held" | "preview_disabled" | "registered" | "replaced" | "too_many" | "unavailable" | "worktree_missing";
|
|
569
570
|
message: string;
|
|
571
|
+
hint: string;
|
|
570
572
|
};
|
|
571
573
|
outputFormat: "json";
|
|
572
|
-
status:
|
|
574
|
+
status: import("hono/utils/http-status").ContentfulStatusCode;
|
|
573
575
|
input: {
|
|
574
576
|
json: {
|
|
575
577
|
command: string;
|
|
@@ -581,13 +583,11 @@ export declare function ciToolRoutes(capabilities: Map<string, Capability>): imp
|
|
|
581
583
|
};
|
|
582
584
|
} | {
|
|
583
585
|
output: {
|
|
584
|
-
|
|
585
|
-
code: "cezar_port" | "cwd_outside_worktree" | "headless" | "invalid_input" | "port_held" | "preview_disabled" | "registered" | "replaced" | "too_many" | "unavailable" | "worktree_missing";
|
|
586
|
+
code: 'capability_revoked';
|
|
586
587
|
message: string;
|
|
587
|
-
hint: string;
|
|
588
588
|
};
|
|
589
589
|
outputFormat: "json";
|
|
590
|
-
status:
|
|
590
|
+
status: 401;
|
|
591
591
|
input: {
|
|
592
592
|
json: {
|
|
593
593
|
command: string;
|
|
@@ -603,11 +603,12 @@ export declare function ciToolRoutes(capabilities: Map<string, Capability>): imp
|
|
|
603
603
|
"/api/v1/tools/schedule-task": {
|
|
604
604
|
$post: {
|
|
605
605
|
output: {
|
|
606
|
-
|
|
606
|
+
ok: false;
|
|
607
|
+
code: import('../contract/index.js').ScheduledTaskRefusalCode;
|
|
607
608
|
message: string;
|
|
608
609
|
};
|
|
609
610
|
outputFormat: "json";
|
|
610
|
-
status:
|
|
611
|
+
status: import("hono/utils/http-status").ContentfulStatusCode;
|
|
611
612
|
input: {
|
|
612
613
|
json: {
|
|
613
614
|
at?: string | undefined;
|
|
@@ -624,12 +625,11 @@ export declare function ciToolRoutes(capabilities: Map<string, Capability>): imp
|
|
|
624
625
|
};
|
|
625
626
|
} | {
|
|
626
627
|
output: {
|
|
627
|
-
|
|
628
|
-
code: import('../contract/index.js').ScheduledTaskRefusalCode;
|
|
628
|
+
code: 'capability_revoked';
|
|
629
629
|
message: string;
|
|
630
630
|
};
|
|
631
631
|
outputFormat: "json";
|
|
632
|
-
status:
|
|
632
|
+
status: 401;
|
|
633
633
|
input: {
|
|
634
634
|
json: {
|
|
635
635
|
at?: string | undefined;
|
|
@@ -684,11 +684,12 @@ export declare function ciToolRoutes(capabilities: Map<string, Capability>): imp
|
|
|
684
684
|
"/api/v1/tools/scheduled-tasks": {
|
|
685
685
|
$post: {
|
|
686
686
|
output: {
|
|
687
|
-
|
|
687
|
+
ok: false;
|
|
688
|
+
code: import('../contract/index.js').ScheduledTaskRefusalCode;
|
|
688
689
|
message: string;
|
|
689
690
|
};
|
|
690
691
|
outputFormat: "json";
|
|
691
|
-
status:
|
|
692
|
+
status: import("hono/utils/http-status").ContentfulStatusCode;
|
|
692
693
|
input: {
|
|
693
694
|
json: {
|
|
694
695
|
at?: string | undefined;
|
|
@@ -721,12 +722,11 @@ export declare function ciToolRoutes(capabilities: Map<string, Capability>): imp
|
|
|
721
722
|
};
|
|
722
723
|
} | {
|
|
723
724
|
output: {
|
|
724
|
-
|
|
725
|
-
code: import('../contract/index.js').ScheduledTaskRefusalCode;
|
|
725
|
+
code: 'capability_revoked';
|
|
726
726
|
message: string;
|
|
727
727
|
};
|
|
728
728
|
outputFormat: "json";
|
|
729
|
-
status:
|
|
729
|
+
status: 401;
|
|
730
730
|
input: {
|
|
731
731
|
json: {
|
|
732
732
|
at?: string | undefined;
|
|
@@ -27,18 +27,6 @@ export declare function delegationFailure(error: unknown): {
|
|
|
27
27
|
export declare function createDelegationRoutes(service: DelegationService, credentials: CredentialRegistry): import("hono/hono-base").HonoBase<Env, {
|
|
28
28
|
"/list": {
|
|
29
29
|
$get: {
|
|
30
|
-
output: {
|
|
31
|
-
error: string;
|
|
32
|
-
code?: "invalid_input" | undefined;
|
|
33
|
-
};
|
|
34
|
-
outputFormat: "json";
|
|
35
|
-
status: 400;
|
|
36
|
-
input: {
|
|
37
|
-
query: {
|
|
38
|
-
offset?: string | undefined;
|
|
39
|
-
};
|
|
40
|
-
};
|
|
41
|
-
} | {
|
|
42
30
|
output: {
|
|
43
31
|
workers: {
|
|
44
32
|
workerId: string;
|
|
@@ -76,6 +64,18 @@ export declare function createDelegationRoutes(service: DelegationService, crede
|
|
|
76
64
|
offset?: string | undefined;
|
|
77
65
|
};
|
|
78
66
|
};
|
|
67
|
+
} | {
|
|
68
|
+
output: {
|
|
69
|
+
error: string;
|
|
70
|
+
code?: "invalid_input" | undefined;
|
|
71
|
+
};
|
|
72
|
+
outputFormat: "json";
|
|
73
|
+
status: 400;
|
|
74
|
+
input: {
|
|
75
|
+
query: {
|
|
76
|
+
offset?: string | undefined;
|
|
77
|
+
};
|
|
78
|
+
};
|
|
79
79
|
};
|
|
80
80
|
};
|
|
81
81
|
} & {
|
|
@@ -613,18 +613,6 @@ export declare function createDelegationRoutes(service: DelegationService, crede
|
|
|
613
613
|
} & {
|
|
614
614
|
"/:workerId": {
|
|
615
615
|
$get: {
|
|
616
|
-
output: {
|
|
617
|
-
error: string;
|
|
618
|
-
code?: "invalid_input" | undefined;
|
|
619
|
-
};
|
|
620
|
-
outputFormat: "json";
|
|
621
|
-
status: 400;
|
|
622
|
-
input: {
|
|
623
|
-
param: {
|
|
624
|
-
workerId: string;
|
|
625
|
-
};
|
|
626
|
-
};
|
|
627
|
-
} | {
|
|
628
616
|
output: {
|
|
629
617
|
workerId: string;
|
|
630
618
|
parentRunId: string;
|
|
@@ -728,11 +716,7 @@ export declare function createDelegationRoutes(service: DelegationService, crede
|
|
|
728
716
|
workerId: string;
|
|
729
717
|
};
|
|
730
718
|
};
|
|
731
|
-
}
|
|
732
|
-
};
|
|
733
|
-
} & {
|
|
734
|
-
"/:workerId/collect": {
|
|
735
|
-
$post: {
|
|
719
|
+
} | {
|
|
736
720
|
output: {
|
|
737
721
|
error: string;
|
|
738
722
|
code?: "invalid_input" | undefined;
|
|
@@ -743,10 +727,12 @@ export declare function createDelegationRoutes(service: DelegationService, crede
|
|
|
743
727
|
param: {
|
|
744
728
|
workerId: string;
|
|
745
729
|
};
|
|
746
|
-
} & {
|
|
747
|
-
json: Record<string, never>;
|
|
748
730
|
};
|
|
749
|
-
}
|
|
731
|
+
};
|
|
732
|
+
};
|
|
733
|
+
} & {
|
|
734
|
+
"/:workerId/collect": {
|
|
735
|
+
$post: {
|
|
750
736
|
output: {
|
|
751
737
|
workerId: string;
|
|
752
738
|
parentRunId: string;
|
|
@@ -848,11 +834,7 @@ export declare function createDelegationRoutes(service: DelegationService, crede
|
|
|
848
834
|
} & {
|
|
849
835
|
json: Record<string, never>;
|
|
850
836
|
};
|
|
851
|
-
}
|
|
852
|
-
};
|
|
853
|
-
} & {
|
|
854
|
-
"/:workerId/steer": {
|
|
855
|
-
$post: {
|
|
837
|
+
} | {
|
|
856
838
|
output: {
|
|
857
839
|
error: string;
|
|
858
840
|
code?: "invalid_input" | undefined;
|
|
@@ -864,11 +846,13 @@ export declare function createDelegationRoutes(service: DelegationService, crede
|
|
|
864
846
|
workerId: string;
|
|
865
847
|
};
|
|
866
848
|
} & {
|
|
867
|
-
json:
|
|
868
|
-
text: string;
|
|
869
|
-
};
|
|
849
|
+
json: Record<string, never>;
|
|
870
850
|
};
|
|
871
|
-
}
|
|
851
|
+
};
|
|
852
|
+
};
|
|
853
|
+
} & {
|
|
854
|
+
"/:workerId/steer": {
|
|
855
|
+
$post: {
|
|
872
856
|
output: {
|
|
873
857
|
workerId: string;
|
|
874
858
|
state: "delivered" | "queued";
|
|
@@ -884,11 +868,7 @@ export declare function createDelegationRoutes(service: DelegationService, crede
|
|
|
884
868
|
text: string;
|
|
885
869
|
};
|
|
886
870
|
};
|
|
887
|
-
}
|
|
888
|
-
};
|
|
889
|
-
} & {
|
|
890
|
-
"/:workerId/stop": {
|
|
891
|
-
$post: {
|
|
871
|
+
} | {
|
|
892
872
|
output: {
|
|
893
873
|
error: string;
|
|
894
874
|
code?: "invalid_input" | undefined;
|
|
@@ -900,9 +880,15 @@ export declare function createDelegationRoutes(service: DelegationService, crede
|
|
|
900
880
|
workerId: string;
|
|
901
881
|
};
|
|
902
882
|
} & {
|
|
903
|
-
json:
|
|
883
|
+
json: {
|
|
884
|
+
text: string;
|
|
885
|
+
};
|
|
904
886
|
};
|
|
905
|
-
}
|
|
887
|
+
};
|
|
888
|
+
};
|
|
889
|
+
} & {
|
|
890
|
+
"/:workerId/stop": {
|
|
891
|
+
$post: {
|
|
906
892
|
output: {
|
|
907
893
|
workerId: string;
|
|
908
894
|
state: "stopping" | "terminated";
|
|
@@ -916,11 +902,7 @@ export declare function createDelegationRoutes(service: DelegationService, crede
|
|
|
916
902
|
} & {
|
|
917
903
|
json: Record<string, never>;
|
|
918
904
|
};
|
|
919
|
-
}
|
|
920
|
-
};
|
|
921
|
-
} & {
|
|
922
|
-
"/:workerId/destroy": {
|
|
923
|
-
$post: {
|
|
905
|
+
} | {
|
|
924
906
|
output: {
|
|
925
907
|
error: string;
|
|
926
908
|
code?: "invalid_input" | undefined;
|
|
@@ -934,7 +916,11 @@ export declare function createDelegationRoutes(service: DelegationService, crede
|
|
|
934
916
|
} & {
|
|
935
917
|
json: Record<string, never>;
|
|
936
918
|
};
|
|
937
|
-
}
|
|
919
|
+
};
|
|
920
|
+
};
|
|
921
|
+
} & {
|
|
922
|
+
"/:workerId/destroy": {
|
|
923
|
+
$post: {
|
|
938
924
|
output: {
|
|
939
925
|
workerId: string;
|
|
940
926
|
state: "complete" | "incomplete";
|
|
@@ -957,6 +943,20 @@ export declare function createDelegationRoutes(service: DelegationService, crede
|
|
|
957
943
|
} & {
|
|
958
944
|
json: Record<string, never>;
|
|
959
945
|
};
|
|
946
|
+
} | {
|
|
947
|
+
output: {
|
|
948
|
+
error: string;
|
|
949
|
+
code?: "invalid_input" | undefined;
|
|
950
|
+
};
|
|
951
|
+
outputFormat: "json";
|
|
952
|
+
status: 400;
|
|
953
|
+
input: {
|
|
954
|
+
param: {
|
|
955
|
+
workerId: string;
|
|
956
|
+
};
|
|
957
|
+
} & {
|
|
958
|
+
json: Record<string, never>;
|
|
959
|
+
};
|
|
960
960
|
} | {
|
|
961
961
|
output: {
|
|
962
962
|
workerId: string;
|
|
@@ -986,11 +986,13 @@ export declare function createDelegationRoutes(service: DelegationService, crede
|
|
|
986
986
|
"/:workerId/diff": {
|
|
987
987
|
$get: {
|
|
988
988
|
output: {
|
|
989
|
-
|
|
990
|
-
|
|
989
|
+
workerId: string;
|
|
990
|
+
baselineSha: string;
|
|
991
|
+
diff: string;
|
|
992
|
+
truncated: boolean;
|
|
991
993
|
};
|
|
992
994
|
outputFormat: "json";
|
|
993
|
-
status:
|
|
995
|
+
status: 200;
|
|
994
996
|
input: {
|
|
995
997
|
param: {
|
|
996
998
|
workerId: string;
|
|
@@ -998,13 +1000,11 @@ export declare function createDelegationRoutes(service: DelegationService, crede
|
|
|
998
1000
|
};
|
|
999
1001
|
} | {
|
|
1000
1002
|
output: {
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
diff: string;
|
|
1004
|
-
truncated: boolean;
|
|
1003
|
+
error: string;
|
|
1004
|
+
code?: "invalid_input" | undefined;
|
|
1005
1005
|
};
|
|
1006
1006
|
outputFormat: "json";
|
|
1007
|
-
status:
|
|
1007
|
+
status: 400;
|
|
1008
1008
|
input: {
|
|
1009
1009
|
param: {
|
|
1010
1010
|
workerId: string;
|
|
@@ -59,6 +59,29 @@ export declare function ciProgressPlugs(demand: ActivityDemand): {
|
|
|
59
59
|
export declare function createActivityRoutes(routeDeps: ActivityRouteDeps): import("hono/hono-base").HonoBase<import("hono/types").BlankEnv, {
|
|
60
60
|
"/workspace/activity": {
|
|
61
61
|
$get: {
|
|
62
|
+
output: {
|
|
63
|
+
error: string;
|
|
64
|
+
code?: "invalid_input" | undefined;
|
|
65
|
+
};
|
|
66
|
+
outputFormat: "json";
|
|
67
|
+
status: 400;
|
|
68
|
+
input: {
|
|
69
|
+
query: {
|
|
70
|
+
project?: string | undefined;
|
|
71
|
+
};
|
|
72
|
+
};
|
|
73
|
+
} | {
|
|
74
|
+
output: {
|
|
75
|
+
error: string;
|
|
76
|
+
};
|
|
77
|
+
outputFormat: "json";
|
|
78
|
+
status: 404 | 409 | 503;
|
|
79
|
+
input: {
|
|
80
|
+
query: {
|
|
81
|
+
project?: string | undefined;
|
|
82
|
+
};
|
|
83
|
+
};
|
|
84
|
+
} | {
|
|
62
85
|
output: {
|
|
63
86
|
generatedAt: string;
|
|
64
87
|
projects: {
|
|
@@ -289,29 +312,6 @@ export declare function createActivityRoutes(routeDeps: ActivityRouteDeps): impo
|
|
|
289
312
|
project?: string | undefined;
|
|
290
313
|
};
|
|
291
314
|
};
|
|
292
|
-
} | {
|
|
293
|
-
output: {
|
|
294
|
-
error: string;
|
|
295
|
-
code?: "invalid_input" | undefined;
|
|
296
|
-
};
|
|
297
|
-
outputFormat: "json";
|
|
298
|
-
status: 400;
|
|
299
|
-
input: {
|
|
300
|
-
query: {
|
|
301
|
-
project?: string | undefined;
|
|
302
|
-
};
|
|
303
|
-
};
|
|
304
|
-
} | {
|
|
305
|
-
output: {
|
|
306
|
-
error: string;
|
|
307
|
-
};
|
|
308
|
-
outputFormat: "json";
|
|
309
|
-
status: 404 | 409 | 503;
|
|
310
|
-
input: {
|
|
311
|
-
query: {
|
|
312
|
-
project?: string | undefined;
|
|
313
|
-
};
|
|
314
|
-
};
|
|
315
315
|
};
|
|
316
316
|
};
|
|
317
317
|
}, "/", "/workspace/activity">;
|
|
@@ -22,7 +22,32 @@ type ReadHandle<Rule extends ReadDirectoryRule> = {
|
|
|
22
22
|
run: RunRecord;
|
|
23
23
|
directory: Rule extends 'existing-worktree' ? string | null : string;
|
|
24
24
|
};
|
|
25
|
-
|
|
25
|
+
type ClaimedHandle = {
|
|
26
|
+
run: RunRecord;
|
|
27
|
+
release: () => void;
|
|
28
|
+
};
|
|
29
|
+
interface RemoveOptions {
|
|
30
|
+
claim: 'publish' | 'reclaim';
|
|
31
|
+
activeBeforeLookup: boolean;
|
|
32
|
+
checksActive: boolean;
|
|
33
|
+
deletion: 'worktree' | 'record' | 'inline';
|
|
34
|
+
ignoresHold: true;
|
|
35
|
+
nullClaimError: string;
|
|
36
|
+
}
|
|
37
|
+
/** Admission stays synchronous: no yield between lookup and claim. */
|
|
38
|
+
export declare function runCheckout(host: RunCheckoutHost, id: string, intent: 'publish'): CheckoutRefusal | ClaimedHandle;
|
|
39
|
+
export declare function runCheckout(host: RunCheckoutHost, id: string, intent: 'remove', options: RemoveOptions): CheckoutRefusal | ClaimedHandle;
|
|
26
40
|
export declare function runCheckout<Rule extends ReadDirectoryRule>(host: RunCheckoutHost, id: string, _intent: Extract<CheckoutIntent, 'read'>, options: ReadOptions<Rule>): CheckoutRefusal | ReadHandle<Rule>;
|
|
27
41
|
export declare function runCheckout(host: RunCheckoutHost, id: string, intent: Extract<CheckoutIntent, 'mutate'>): CheckoutRefusal | ReadHandle<'working-directory'>;
|
|
42
|
+
/** The caller holds publish admission's claim until all publish work finishes. */
|
|
43
|
+
export declare function preparePublishCheckout({ root, store }: RunCheckoutHost, id: string): Promise<CheckoutRefusal | {
|
|
44
|
+
status: 400;
|
|
45
|
+
body: {
|
|
46
|
+
error: string;
|
|
47
|
+
};
|
|
48
|
+
} | {
|
|
49
|
+
run: RunRecord;
|
|
50
|
+
}>;
|
|
51
|
+
/** Reclaim calls this only after reclaimWorktree(...).finally(release) settles. */
|
|
52
|
+
export declare function reclaimCheckoutError(run: RunRecord): Promise<string>;
|
|
28
53
|
export {};
|
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
import { isUsageLimitHold } from '../contract/index.js';
|
|
2
|
+
import { fallbackProjectWriteError } from '../project-paths.js';
|
|
3
|
+
import { rematerializeReclaimedWorktree } from '../runs/retention.js';
|
|
4
|
+
import { getStatus } from './git.js';
|
|
1
5
|
import { existsSync } from 'node:fs';
|
|
2
6
|
import { autosaveCleanupBlocker } from '../autosave-cleanup.js';
|
|
3
7
|
// ---- session git view (redesign R5 Step 1.2 — §"Git/session API additions").
|
|
@@ -10,7 +14,12 @@ const workingDirectoryOf = (run, repoRoot) => run.worktree === false
|
|
|
10
14
|
? repoRoot
|
|
11
15
|
: worktreeOf(run);
|
|
12
16
|
export const NO_WORKTREE = 'no worktree — this task ran directly in the repo working tree';
|
|
13
|
-
export function runCheckout(
|
|
17
|
+
export function runCheckout(host, id, intent, options = { checksAutosave: true, directory: 'existing-worktree' }) {
|
|
18
|
+
if (intent === 'publish')
|
|
19
|
+
return publishCheckout(host, id);
|
|
20
|
+
if ('claim' in options)
|
|
21
|
+
return removeCheckout(host, id, options);
|
|
22
|
+
const { root, store } = host;
|
|
14
23
|
const run = store.getRun(id);
|
|
15
24
|
if (!run)
|
|
16
25
|
return { status: 404, body: { error: 'not found' } };
|
|
@@ -28,4 +37,74 @@ export function runCheckout({ root, store }, id, intent, options = { checksAutos
|
|
|
28
37
|
}
|
|
29
38
|
return { run, directory };
|
|
30
39
|
}
|
|
40
|
+
function publishCheckout({ store, manager }, id) {
|
|
41
|
+
const held = store.getRun(id);
|
|
42
|
+
if (!held)
|
|
43
|
+
return { status: 404, body: { error: 'not found' } };
|
|
44
|
+
const refusal = held.worktreePath && fallbackProjectWriteError(held.worktreePath);
|
|
45
|
+
if (refusal)
|
|
46
|
+
return { status: 409, body: { error: refusal } };
|
|
47
|
+
if (manager.isActive(id))
|
|
48
|
+
return { status: 409, body: { error: 'run is still active — wait for the review gate' } };
|
|
49
|
+
// A hold is live: done would drop its resume (S7 B13). Don’t resume (DELETE …/auto-resume) settles it failed.
|
|
50
|
+
if (isUsageLimitHold(held))
|
|
51
|
+
return { status: 409, body: { error: 'run is waiting on a usage-limit hold — choose Don’t resume in the task’s usage-limit hint, then retry Draft PR' } };
|
|
52
|
+
const release = manager.claimForPublish(id);
|
|
53
|
+
if (!release)
|
|
54
|
+
return { status: 409, body: { error: 'its worktree or branch is being cleaned up — retry in a moment' } };
|
|
55
|
+
return { run: held, release };
|
|
56
|
+
}
|
|
57
|
+
/** The caller holds publish admission's claim until all publish work finishes. */
|
|
58
|
+
export async function preparePublishCheckout({ root, store }, id) {
|
|
59
|
+
// Reclaim (open-mercato/cezar#483, issue 08 §B4) removed the directory and kept the branch, and Not landed
|
|
60
|
+
// offers this on exactly those rows: restore the checkout first, as Continue does.
|
|
61
|
+
await rematerializeReclaimedWorktree(root, store, id);
|
|
62
|
+
const run = store.getRun(id);
|
|
63
|
+
if (!run)
|
|
64
|
+
return { status: 404, body: { error: 'not found' } };
|
|
65
|
+
if (!run.worktreePath || !existsSync(run.worktreePath) || !run.branch) {
|
|
66
|
+
return { status: 400, body: { error: 'no worktree/branch to publish — this task ran in the repo working tree' } };
|
|
67
|
+
}
|
|
68
|
+
return { run };
|
|
69
|
+
}
|
|
70
|
+
function removalRefusal(store, run, id, deletion) {
|
|
71
|
+
if (deletion === 'inline')
|
|
72
|
+
return store.fallbackDeleteError(run.id, 'worktree') ?? store.writeRefusal(run.id);
|
|
73
|
+
if (deletion === 'worktree') {
|
|
74
|
+
if (!store.canDeleteRun(id, 'worktree') || run.delegation?.role === 'worker')
|
|
75
|
+
return 'owned resources require verified worker cleanup';
|
|
76
|
+
}
|
|
77
|
+
else {
|
|
78
|
+
// Delete cleans up after itself: worktree + branch go with the run (spec 006).
|
|
79
|
+
if (!store.canDeleteRun(id))
|
|
80
|
+
return 'owned resources require verified worker cleanup and explicit child history deletion first';
|
|
81
|
+
}
|
|
82
|
+
return undefined;
|
|
83
|
+
}
|
|
84
|
+
function removeCheckout({ store, manager }, id, options) {
|
|
85
|
+
const active = { status: 409, body: { error: 'run is active — cancel it first' } };
|
|
86
|
+
if (options.checksActive && options.activeBeforeLookup && manager.isActive(id))
|
|
87
|
+
return active;
|
|
88
|
+
const run = store.getRun(id);
|
|
89
|
+
if (!run)
|
|
90
|
+
return { status: 404, body: { error: 'not found' } };
|
|
91
|
+
if (options.checksActive && !options.activeBeforeLookup && manager.isActive(id))
|
|
92
|
+
return active;
|
|
93
|
+
const refused = removalRefusal(store, run, id, options.deletion);
|
|
94
|
+
if (refused)
|
|
95
|
+
return { status: 409, body: { error: refused } };
|
|
96
|
+
// Claimed, not merely checked: the claim holds Continue off until the directory is gone.
|
|
97
|
+
const release = options.claim === 'reclaim' ? manager.claimWorktreeReclaim(run.id) : manager.claimForPublish(id);
|
|
98
|
+
if (!release)
|
|
99
|
+
return { status: 409, body: { error: options.nullClaimError } };
|
|
100
|
+
return { run, release };
|
|
101
|
+
}
|
|
102
|
+
/** Reclaim calls this only after reclaimWorktree(...).finally(release) settles. */
|
|
103
|
+
export async function reclaimCheckoutError(run) {
|
|
104
|
+
// Reclaim keeps only what is committed, so it leaves a dirty checkout alone; say which case this was.
|
|
105
|
+
const dirty = run.worktreePath && existsSync(run.worktreePath) ? (await getStatus(run.worktreePath).catch(() => [])).length : 0;
|
|
106
|
+
return dirty > 0
|
|
107
|
+
? `the worktree has ${dirty} uncommitted file${dirty === 1 ? '' : 's'} that exist nowhere else — commit or discard them first`
|
|
108
|
+
: 'the worktree directory could not be removed';
|
|
109
|
+
}
|
|
31
110
|
//# sourceMappingURL=run-checkout.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"run-checkout.js","sourceRoot":"","sources":["../../src/server/run-checkout.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EAAE,sBAAsB,EAAE,MAAM,wBAAwB,CAAC;AAIhE,+EAA+E;AAC/E,wFAAwF;AACxF,2EAA2E;AAC3E,yEAAyE;AACzE,qEAAqE;AACrE,MAAM,UAAU,GAAG,CAAC,GAAc,EAAiB,EAAE,CACnD,GAAG,CAAC,YAAY,IAAI,UAAU,CAAC,GAAG,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,YAAY,CAAC,CAAC,CAAC,IAAI,CAAC;AAC7E,MAAM,kBAAkB,GAAG,CAAC,GAAc,EAAE,QAAgB,EAAiB,EAAE,CAC7E,GAAG,CAAC,QAAQ,KAAK,KAAK;IACpB,CAAC,CAAC,QAAQ;IACV,CAAC,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC;AACtB,MAAM,CAAC,MAAM,WAAW,GAAG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