@hearsay-tools/squawk 0.18.0-dev.7952 → 0.18.0-dev.7956

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.
@@ -285,12 +285,11 @@ export declare function ciToolRoutes(capabilities: Map<string, Capability>): imp
285
285
  "/api/v1/tools/ask": {
286
286
  $post: {
287
287
  output: {
288
- ok: false;
289
- code: 'unavailable';
288
+ code: 'capability_revoked';
290
289
  message: string;
291
290
  };
292
291
  outputFormat: "json";
293
- status: import("hono/utils/http-status").ContentfulStatusCode;
292
+ status: 401;
294
293
  input: {
295
294
  json: {
296
295
  questions: {
@@ -309,11 +308,12 @@ export declare function ciToolRoutes(capabilities: Map<string, Capability>): imp
309
308
  };
310
309
  } | {
311
310
  output: {
312
- code: 'capability_revoked';
311
+ ok: false;
312
+ code: 'unavailable';
313
313
  message: string;
314
314
  };
315
315
  outputFormat: "json";
316
- status: 401;
316
+ status: import("hono/utils/http-status").ContentfulStatusCode;
317
317
  input: {
318
318
  json: {
319
319
  questions: {
@@ -383,12 +383,11 @@ export declare function ciToolRoutes(capabilities: Map<string, Capability>): imp
383
383
  "/api/v1/tools/cancel-wait": {
384
384
  $post: {
385
385
  output: {
386
- cancelled: false;
387
- code: 'unavailable';
386
+ code: 'capability_revoked';
388
387
  message: string;
389
388
  };
390
389
  outputFormat: "json";
391
- status: import("hono/utils/http-status").ContentfulStatusCode;
390
+ status: 401;
392
391
  input: {
393
392
  json: {
394
393
  wait_id: string;
@@ -396,11 +395,12 @@ export declare function ciToolRoutes(capabilities: Map<string, Capability>): imp
396
395
  };
397
396
  } | {
398
397
  output: {
399
- code: 'capability_revoked';
398
+ cancelled: false;
399
+ code: 'unavailable';
400
400
  message: string;
401
401
  };
402
402
  outputFormat: "json";
403
- status: 401;
403
+ status: import("hono/utils/http-status").ContentfulStatusCode;
404
404
  input: {
405
405
  json: {
406
406
  wait_id: string;
@@ -448,12 +448,11 @@ export declare function ciToolRoutes(capabilities: Map<string, Capability>): imp
448
448
  "/api/v1/tools/done": {
449
449
  $post: {
450
450
  output: {
451
- ok: false;
452
- code: 'unavailable';
451
+ code: 'capability_revoked';
453
452
  message: string;
454
453
  };
455
454
  outputFormat: "json";
456
- status: import("hono/utils/http-status").ContentfulStatusCode;
455
+ status: 401;
457
456
  input: {
458
457
  json: {
459
458
  summary?: string | undefined;
@@ -461,11 +460,12 @@ export declare function ciToolRoutes(capabilities: Map<string, Capability>): imp
461
460
  };
462
461
  } | {
463
462
  output: {
464
- code: 'capability_revoked';
463
+ ok: false;
464
+ code: 'unavailable';
465
465
  message: string;
466
466
  };
467
467
  outputFormat: "json";
468
- status: 401;
468
+ status: import("hono/utils/http-status").ContentfulStatusCode;
469
469
  input: {
470
470
  json: {
471
471
  summary?: string | undefined;
@@ -548,13 +548,11 @@ export declare function ciToolRoutes(capabilities: Map<string, Capability>): imp
548
548
  "/api/v1/tools/preview-stop": {
549
549
  $post: {
550
550
  output: {
551
- ok: boolean;
552
- 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';
553
552
  message: string;
554
- hint: string;
555
553
  };
556
554
  outputFormat: "json";
557
- status: import("hono/utils/http-status").ContentfulStatusCode;
555
+ status: 401;
558
556
  input: {
559
557
  json: {
560
558
  port: number;
@@ -563,11 +561,13 @@ export declare function ciToolRoutes(capabilities: Map<string, Capability>): imp
563
561
  };
564
562
  } | {
565
563
  output: {
566
- code: 'capability_revoked';
564
+ ok: boolean;
565
+ code: "adopted" | "approval_required" | "headless" | "invalid_input" | "not_registered" | "port_held" | "port_in_use" | "preview_disabled" | "restarted" | "stopped" | "unavailable" | "worktree_missing";
567
566
  message: string;
567
+ hint: string;
568
568
  };
569
569
  outputFormat: "json";
570
- status: 401;
570
+ status: import("hono/utils/http-status").ContentfulStatusCode;
571
571
  input: {
572
572
  json: {
573
573
  port: number;
@@ -580,13 +580,11 @@ export declare function ciToolRoutes(capabilities: Map<string, Capability>): imp
580
580
  "/api/v1/tools/preview-serve": {
581
581
  $post: {
582
582
  output: {
583
- ok: boolean;
584
- code: "cezar_port" | "cwd_outside_worktree" | "headless" | "invalid_input" | "port_held" | "preview_disabled" | "registered" | "replaced" | "too_many" | "unavailable" | "worktree_missing";
583
+ code: 'capability_revoked';
585
584
  message: string;
586
- hint: string;
587
585
  };
588
586
  outputFormat: "json";
589
- status: import("hono/utils/http-status").ContentfulStatusCode;
587
+ status: 401;
590
588
  input: {
591
589
  json: {
592
590
  command: string;
@@ -598,11 +596,13 @@ export declare function ciToolRoutes(capabilities: Map<string, Capability>): imp
598
596
  };
599
597
  } | {
600
598
  output: {
601
- code: 'capability_revoked';
599
+ ok: boolean;
600
+ code: "cezar_port" | "cwd_outside_worktree" | "headless" | "invalid_input" | "port_held" | "preview_disabled" | "registered" | "replaced" | "too_many" | "unavailable" | "worktree_missing";
602
601
  message: string;
602
+ hint: string;
603
603
  };
604
604
  outputFormat: "json";
605
- status: 401;
605
+ status: import("hono/utils/http-status").ContentfulStatusCode;
606
606
  input: {
607
607
  json: {
608
608
  command: string;
@@ -618,12 +618,11 @@ export declare function ciToolRoutes(capabilities: Map<string, Capability>): imp
618
618
  "/api/v1/tools/automation": {
619
619
  $post: {
620
620
  output: {
621
- ok: false;
622
- code: import('../contract/index.js').ScheduledTaskRefusalCode;
621
+ code: 'capability_revoked';
623
622
  message: string;
624
623
  };
625
624
  outputFormat: "json";
626
- status: import("hono/utils/http-status").ContentfulStatusCode;
625
+ status: 401;
627
626
  input: {
628
627
  json: {
629
628
  action: "create";
@@ -703,11 +702,12 @@ export declare function ciToolRoutes(capabilities: Map<string, Capability>): imp
703
702
  };
704
703
  } | {
705
704
  output: {
706
- code: 'capability_revoked';
705
+ ok: false;
706
+ code: import('../contract/index.js').ScheduledTaskRefusalCode;
707
707
  message: string;
708
708
  };
709
709
  outputFormat: "json";
710
- status: 401;
710
+ status: import("hono/utils/http-status").ContentfulStatusCode;
711
711
  input: {
712
712
  json: {
713
713
  action: "create";
@@ -963,12 +963,11 @@ export declare function ciToolRoutes(capabilities: Map<string, Capability>): imp
963
963
  "/api/v1/tools/schedule-task": {
964
964
  $post: {
965
965
  output: {
966
- ok: false;
967
- code: import('../contract/index.js').ScheduledTaskRefusalCode;
966
+ code: 'capability_revoked';
968
967
  message: string;
969
968
  };
970
969
  outputFormat: "json";
971
- status: import("hono/utils/http-status").ContentfulStatusCode;
970
+ status: 401;
972
971
  input: {
973
972
  json: {
974
973
  at?: string | undefined;
@@ -985,11 +984,12 @@ export declare function ciToolRoutes(capabilities: Map<string, Capability>): imp
985
984
  };
986
985
  } | {
987
986
  output: {
988
- code: 'capability_revoked';
987
+ ok: false;
988
+ code: import('../contract/index.js').ScheduledTaskRefusalCode;
989
989
  message: string;
990
990
  };
991
991
  outputFormat: "json";
992
- status: 401;
992
+ status: import("hono/utils/http-status").ContentfulStatusCode;
993
993
  input: {
994
994
  json: {
995
995
  at?: string | undefined;
@@ -1044,12 +1044,11 @@ export declare function ciToolRoutes(capabilities: Map<string, Capability>): imp
1044
1044
  "/api/v1/tools/scheduled-tasks": {
1045
1045
  $post: {
1046
1046
  output: {
1047
- ok: false;
1048
- code: import('../contract/index.js').ScheduledTaskRefusalCode;
1047
+ code: 'capability_revoked';
1049
1048
  message: string;
1050
1049
  };
1051
1050
  outputFormat: "json";
1052
- status: import("hono/utils/http-status").ContentfulStatusCode;
1051
+ status: 401;
1053
1052
  input: {
1054
1053
  json: {
1055
1054
  at?: string | undefined;
@@ -1082,11 +1081,12 @@ export declare function ciToolRoutes(capabilities: Map<string, Capability>): imp
1082
1081
  };
1083
1082
  } | {
1084
1083
  output: {
1085
- code: 'capability_revoked';
1084
+ ok: false;
1085
+ code: import('../contract/index.js').ScheduledTaskRefusalCode;
1086
1086
  message: string;
1087
1087
  };
1088
1088
  outputFormat: "json";
1089
- status: 401;
1089
+ status: import("hono/utils/http-status").ContentfulStatusCode;
1090
1090
  input: {
1091
1091
  json: {
1092
1092
  at?: string | undefined;
@@ -1,7 +1,7 @@
1
1
  import type { RunRecord } from '../runs/store.ts';
2
- import type { RunAccess, RunFamilyReads, RunLookup, RunWrites, StoreHandle, WorkerExecutions } from '../runs/ports.ts';
2
+ import type { RunAccess, RunFamilyReads, RunLookup, RunQueries, RunWrites, StoreHandle, WorkerExecutions } from '../runs/ports.ts';
3
3
  export type FamilyEndStore = RunLookup & {
4
- readonly queries: Pick<RunFamilyReads, 'listWorkersOf'>;
4
+ readonly queries: Pick<RunFamilyReads, 'listWorkersOf'> & Partial<Pick<RunQueries, 'verifiedWorkerReleases'>>;
5
5
  } & Pick<RunWrites, 'commitDelegation'> & {
6
6
  readonly workerExecutions: Pick<WorkerExecutions, 'readWorkerExecution' | 'workerResourcesSafe'>;
7
7
  } & Pick<StoreHandle, 'unavailable'> & {
@@ -36,9 +36,12 @@ export async function releaseEndedWorkerBranches(repoRoot, store, claim, signal)
36
36
  if (store.unavailable)
37
37
  return [];
38
38
  const released = [];
39
+ const verified = store.queries.verifiedWorkerReleases?.();
39
40
  for (const { workspace, cleaned } of await ownedWorkspaceReceipts(repoRoot).catch(() => [])) {
40
41
  if (signal?.aborted)
41
42
  break;
43
+ if (cleaned && verified?.skip(workspace.ownerRunId))
44
+ continue;
42
45
  const run = store.getRun(workspace.ownerRunId);
43
46
  const due = run
44
47
  ? endedWorkerBranch(run, store) && JSON.stringify(run.delegation?.role === 'worker' && run.delegation.workspace) === JSON.stringify(workspace)
@@ -46,6 +49,7 @@ export async function releaseEndedWorkerBranches(repoRoot, store, claim, signal)
46
49
  if (due && await releaseBranch(repoRoot, store, workspace, run, claim))
47
50
  released.push(workspace.ownerRunId);
48
51
  }
52
+ verified?.flush();
49
53
  return released;
50
54
  }
51
55
  /** Receipts live in the repository's shared Git directory: another checkout's are not this
@@ -1 +1 @@
1
- {"version":3,"file":"family-end.js","sourceRoot":"","sources":["../../src/delegation/family-end.ts"],"names":[],"mappings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CAAC,EAAE,EAAE,EAAE,OAAO,CAAC,EAAE,EAAE,UAAU,EAAE,EAAE,GAAG,OAAO,CAAC,UAAU;wBAC3E,OAAO,EAAE,EAAE,WAAW,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE,EAAE,KAAK,EAAE,UAAU,EAAE,SAAS,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC,CAAC,CAAC;QAC/F,CAAC;QACD,OAAO,IAAI,CAAC;IACd,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,KAAK,CAAC;IACf,CAAC;YAAS,CAAC;QACT,OAAO,EAAE,CAAC;IACZ,CAAC;AACH,CAAC"}
@@ -0,0 +1,9 @@
1
+ import type { Stats } from 'node:fs';
2
+ /** Only successful reads survive, bounded across repositories. Every caller still stats each file. */
3
+ export declare class ReceiptCache<T> {
4
+ private readonly entries;
5
+ key(info: Stats): string;
6
+ get(path: string, info: Stats): T | undefined;
7
+ set(path: string, info: Stats, value: T): void;
8
+ prune(directory: string, paths: ReadonlySet<string>): void;
9
+ }
@@ -0,0 +1,26 @@
1
+ import { dirname } from 'node:path';
2
+ /** Only successful reads survive, bounded across repositories. Every caller still stats each file. */
3
+ export class ReceiptCache {
4
+ entries = new Map();
5
+ key(info) {
6
+ return [info.dev, info.ino, info.size, info.mtimeMs, info.ctimeMs, info.mode, info.uid].join(':');
7
+ }
8
+ get(path, info) {
9
+ const entry = this.entries.get(path);
10
+ if (entry?.key === this.key(info))
11
+ return structuredClone(entry.value);
12
+ this.entries.delete(path);
13
+ return undefined;
14
+ }
15
+ set(path, info, value) {
16
+ if (this.entries.size >= 20_000)
17
+ this.entries.delete(this.entries.keys().next().value);
18
+ this.entries.set(path, { key: this.key(info), value: structuredClone(value) });
19
+ }
20
+ prune(directory, paths) {
21
+ for (const path of this.entries.keys())
22
+ if (dirname(path) === directory && !paths.has(path))
23
+ this.entries.delete(path);
24
+ }
25
+ }
26
+ //# sourceMappingURL=receipt-cache.js.map
@@ -0,0 +1 @@
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AAE,KAA0B;QACjD,KAAK,MAAM,IAAI,IAAI,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE;YAAE,IAAI,OAAO,CAAC,IAAI,CAAC,KAAK,SAAS,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC;gBAAE,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;IACzH,CAAC;CACF"}
@@ -91,16 +91,6 @@ export declare function createDelegationRoutes(service: DelegationService, crede
91
91
  "/discover": {
92
92
  $post: {
93
93
  output: {
94
- scope: "host-default-account";
95
- runners: {
96
- requiresAccountHome?: boolean | undefined;
97
- status: "connected" | "disconnected" | "not-installed" | "unknown";
98
- enabled?: boolean | undefined;
99
- hint?: string | undefined;
100
- authFailureId?: string | undefined;
101
- runner: string;
102
- }[];
103
- } | {
104
94
  runner: string;
105
95
  models: {
106
96
  id: string;
@@ -111,6 +101,16 @@ export declare function createDelegationRoutes(service: DelegationService, crede
111
101
  source: "cache" | "live" | "unavailable";
112
102
  stale: boolean;
113
103
  reason?: string | undefined;
104
+ } | {
105
+ scope: "host-default-account";
106
+ runners: {
107
+ requiresAccountHome?: boolean | undefined;
108
+ status: "connected" | "disconnected" | "not-installed" | "unknown";
109
+ enabled?: boolean | undefined;
110
+ hint?: string | undefined;
111
+ authFailureId?: string | undefined;
112
+ runner: string;
113
+ }[];
114
114
  } | {
115
115
  tasks: {
116
116
  id: string;
@@ -2,18 +2,6 @@ import type { DelegationRoutes } from './routes.ts';
2
2
  export declare function createDelegationApp(routes: DelegationRoutes): import("hono/hono-base").HonoBase<import("hono/types").BlankEnv, import("hono/types").BlankSchema | import("hono/types").MergeSchemaPath<{
3
3
  "/list": {
4
4
  $get: {
5
- output: {
6
- error: string;
7
- code?: "invalid_input" | undefined;
8
- };
9
- outputFormat: "json";
10
- status: 400;
11
- input: {
12
- query: {
13
- offset?: string | undefined;
14
- };
15
- };
16
- } | {
17
5
  output: {
18
6
  workers: {
19
7
  workerId: string;
@@ -60,23 +48,24 @@ export declare function createDelegationApp(routes: DelegationRoutes): import("h
60
48
  offset?: string | undefined;
61
49
  };
62
50
  };
51
+ } | {
52
+ output: {
53
+ error: string;
54
+ code?: "invalid_input" | undefined;
55
+ };
56
+ outputFormat: "json";
57
+ status: 400;
58
+ input: {
59
+ query: {
60
+ offset?: string | undefined;
61
+ };
62
+ };
63
63
  };
64
64
  };
65
65
  } & {
66
66
  "/discover": {
67
67
  $post: {
68
68
  output: {
69
- runner: string;
70
- models: {
71
- id: string;
72
- label: string;
73
- description: string;
74
- effortLevels?: ("high" | "low" | "max" | "medium" | "xhigh")[] | undefined;
75
- }[];
76
- source: "cache" | "live" | "unavailable";
77
- stale: boolean;
78
- reason?: string | undefined;
79
- } | {
80
69
  tasks: {
81
70
  id: string;
82
71
  title: string;
@@ -98,6 +87,17 @@ export declare function createDelegationApp(routes: DelegationRoutes): import("h
98
87
  authFailureId?: string | undefined;
99
88
  runner: string;
100
89
  }[];
90
+ } | {
91
+ runner: string;
92
+ models: {
93
+ id: string;
94
+ label: string;
95
+ description: string;
96
+ effortLevels?: ("high" | "low" | "max" | "medium" | "xhigh")[] | undefined;
97
+ }[];
98
+ source: "cache" | "live" | "unavailable";
99
+ stale: boolean;
100
+ reason?: string | undefined;
101
101
  };
102
102
  outputFormat: "json";
103
103
  status: 200;
@@ -207,13 +207,13 @@ export declare function createDelegationApp(routes: DelegationRoutes): import("h
207
207
  status: 200;
208
208
  input: {
209
209
  json: {
210
- requestIds: string[];
211
- mode?: "all" | "any" | "one" | undefined;
212
- timeoutSeconds?: number | undefined;
213
- } | {
214
210
  workerIds: string[];
215
211
  timeoutSeconds?: number | undefined;
216
212
  mode?: "all" | "any" | "one" | undefined;
213
+ } | {
214
+ requestIds: string[];
215
+ mode?: "all" | "any" | "one" | undefined;
216
+ timeoutSeconds?: number | undefined;
217
217
  } | {
218
218
  peerIds: string[];
219
219
  timeoutSeconds?: number | undefined;
@@ -604,18 +604,6 @@ export declare function createDelegationApp(routes: DelegationRoutes): import("h
604
604
  } & {
605
605
  "/:workerId": {
606
606
  $get: {
607
- output: {
608
- error: string;
609
- code?: "invalid_input" | undefined;
610
- };
611
- outputFormat: "json";
612
- status: 400;
613
- input: {
614
- param: {
615
- workerId: string;
616
- };
617
- };
618
- } | {
619
607
  output: {
620
608
  workerId: string;
621
609
  settled: boolean;
@@ -733,11 +721,7 @@ export declare function createDelegationApp(routes: DelegationRoutes): import("h
733
721
  workerId: string;
734
722
  };
735
723
  };
736
- };
737
- };
738
- } & {
739
- "/:workerId/collect": {
740
- $post: {
724
+ } | {
741
725
  output: {
742
726
  error: string;
743
727
  code?: "invalid_input" | undefined;
@@ -748,10 +732,12 @@ export declare function createDelegationApp(routes: DelegationRoutes): import("h
748
732
  param: {
749
733
  workerId: string;
750
734
  };
751
- } & {
752
- json: Record<string, never>;
753
735
  };
754
- } | {
736
+ };
737
+ };
738
+ } & {
739
+ "/:workerId/collect": {
740
+ $post: {
755
741
  output: {
756
742
  workerId: string;
757
743
  parentRunId: string;
@@ -874,11 +860,7 @@ export declare function createDelegationApp(routes: DelegationRoutes): import("h
874
860
  } & {
875
861
  json: Record<string, never>;
876
862
  };
877
- };
878
- };
879
- } & {
880
- "/:workerId/steer": {
881
- $post: {
863
+ } | {
882
864
  output: {
883
865
  error: string;
884
866
  code?: "invalid_input" | undefined;
@@ -890,11 +872,13 @@ export declare function createDelegationApp(routes: DelegationRoutes): import("h
890
872
  workerId: string;
891
873
  };
892
874
  } & {
893
- json: {
894
- text: string;
895
- };
875
+ json: Record<string, never>;
896
876
  };
897
- } | {
877
+ };
878
+ };
879
+ } & {
880
+ "/:workerId/steer": {
881
+ $post: {
898
882
  output: {
899
883
  workerId: string;
900
884
  state: "delivered" | "queued";
@@ -910,11 +894,7 @@ export declare function createDelegationApp(routes: DelegationRoutes): import("h
910
894
  text: string;
911
895
  };
912
896
  };
913
- };
914
- };
915
- } & {
916
- "/:workerId/stop": {
917
- $post: {
897
+ } | {
918
898
  output: {
919
899
  error: string;
920
900
  code?: "invalid_input" | undefined;
@@ -926,9 +906,15 @@ export declare function createDelegationApp(routes: DelegationRoutes): import("h
926
906
  workerId: string;
927
907
  };
928
908
  } & {
929
- json: Record<string, never>;
909
+ json: {
910
+ text: string;
911
+ };
930
912
  };
931
- } | {
913
+ };
914
+ };
915
+ } & {
916
+ "/:workerId/stop": {
917
+ $post: {
932
918
  output: {
933
919
  workerId: string;
934
920
  state: "stopping" | "terminated";
@@ -942,11 +928,7 @@ export declare function createDelegationApp(routes: DelegationRoutes): import("h
942
928
  } & {
943
929
  json: Record<string, never>;
944
930
  };
945
- };
946
- };
947
- } & {
948
- "/:workerId/destroy": {
949
- $post: {
931
+ } | {
950
932
  output: {
951
933
  error: string;
952
934
  code?: "invalid_input" | undefined;
@@ -958,11 +940,13 @@ export declare function createDelegationApp(routes: DelegationRoutes): import("h
958
940
  workerId: string;
959
941
  };
960
942
  } & {
961
- json: {
962
- discardWork?: true | undefined;
963
- };
943
+ json: Record<string, never>;
964
944
  };
965
- } | {
945
+ };
946
+ };
947
+ } & {
948
+ "/:workerId/destroy": {
949
+ $post: {
966
950
  output: {
967
951
  workerId: string;
968
952
  state: "complete" | "incomplete";
@@ -991,6 +975,22 @@ export declare function createDelegationApp(routes: DelegationRoutes): import("h
991
975
  discardWork?: true | undefined;
992
976
  };
993
977
  };
978
+ } | {
979
+ output: {
980
+ error: string;
981
+ code?: "invalid_input" | undefined;
982
+ };
983
+ outputFormat: "json";
984
+ status: 400;
985
+ input: {
986
+ param: {
987
+ workerId: string;
988
+ };
989
+ } & {
990
+ json: {
991
+ discardWork?: true | undefined;
992
+ };
993
+ };
994
994
  } | {
995
995
  output: {
996
996
  workerId: string;
@@ -1026,11 +1026,13 @@ export declare function createDelegationApp(routes: DelegationRoutes): import("h
1026
1026
  "/:workerId/diff": {
1027
1027
  $get: {
1028
1028
  output: {
1029
- error: string;
1030
- code?: "invalid_input" | undefined;
1029
+ workerId: string;
1030
+ baselineSha: string;
1031
+ diff: string;
1032
+ truncated: boolean;
1031
1033
  };
1032
1034
  outputFormat: "json";
1033
- status: 400;
1035
+ status: 200;
1034
1036
  input: {
1035
1037
  param: {
1036
1038
  workerId: string;
@@ -1038,13 +1040,11 @@ export declare function createDelegationApp(routes: DelegationRoutes): import("h
1038
1040
  };
1039
1041
  } | {
1040
1042
  output: {
1041
- workerId: string;
1042
- baselineSha: string;
1043
- diff: string;
1044
- truncated: boolean;
1043
+ error: string;
1044
+ code?: "invalid_input" | undefined;
1045
1045
  };
1046
1046
  outputFormat: "json";
1047
- status: 200;
1047
+ status: 400;
1048
1048
  input: {
1049
1049
  param: {
1050
1050
  workerId: string;
@@ -54,8 +54,7 @@ export declare function receiptLocation(repoRoot: string, workspace: OwnedWorker
54
54
  /** The receipt and cleanup checkpoint files in the repository's shared receipt directory, checked
55
55
  * as `receiptLocation` checks it; none when it does not exist. The project migration rewrites them. */
56
56
  export declare function ownedWorkspaceRecordFiles(repoRoot: string): Promise<string[]>;
57
- /** Each readable receipt's workspace, and whether its cleanup checkpoint says the removal completed.
58
- * An unreadable record is skipped: only an explicit destroy acts on it. */
57
+ /** Each readable receipt's workspace and cleanup state. Unreadable records are skipped. */
59
58
  export declare function ownedWorkspaceReceipts(repoRoot: string): Promise<Array<{
60
59
  workspace: OwnedWorkerWorkspace;
61
60
  cleaned: boolean;